@transcend-io/cli 10.28.0 → 10.29.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 (338) hide show
  1. package/README.md +81 -15
  2. package/dist/{app-DCY8E776.mjs → app-C5baDSA2.mjs} +21 -21
  3. package/dist/app-C5baDSA2.mjs.map +1 -0
  4. package/dist/{approvePrivacyRequests-80SV_94y.mjs → approvePrivacyRequests-B8x7oxTn.mjs} +2 -2
  5. package/dist/{approvePrivacyRequests-80SV_94y.mjs.map → approvePrivacyRequests-B8x7oxTn.mjs.map} +1 -1
  6. package/dist/bin/bash-complete.mjs +1 -1
  7. package/dist/bin/cli.mjs +1 -1
  8. package/dist/bin/deprecated-command.mjs +1 -1
  9. package/dist/{buildExamples-2YDkSvtA.mjs → buildExamples-7KXBjl-b.mjs} +2 -2
  10. package/dist/{buildExamples-2YDkSvtA.mjs.map → buildExamples-7KXBjl-b.mjs.map} +1 -1
  11. package/dist/{buildXdiSyncEndpoint-B3zUrI16.mjs → buildXdiSyncEndpoint-DcrkZ2Gu.mjs} +2 -2
  12. package/dist/{buildXdiSyncEndpoint-B3zUrI16.mjs.map → buildXdiSyncEndpoint-DcrkZ2Gu.mjs.map} +1 -1
  13. package/dist/{bulkRestartRequests-BLb8OJmf.mjs → bulkRestartRequests-CysUfl98.mjs} +2 -2
  14. package/dist/{bulkRestartRequests-BLb8OJmf.mjs.map → bulkRestartRequests-CysUfl98.mjs.map} +1 -1
  15. package/dist/{bulkRetryEnrichers-BA9cboSe.mjs → bulkRetryEnrichers-DaLE67Ht.mjs} +2 -2
  16. package/dist/{bulkRetryEnrichers-BA9cboSe.mjs.map → bulkRetryEnrichers-DaLE67Ht.mjs.map} +1 -1
  17. package/dist/{cancelPrivacyRequests-BEyOBJ2r.mjs → cancelPrivacyRequests-D0zNUNdS.mjs} +2 -2
  18. package/dist/{cancelPrivacyRequests-BEyOBJ2r.mjs.map → cancelPrivacyRequests-D0zNUNdS.mjs.map} +1 -1
  19. package/dist/codecs-CTxFjCg4.mjs +2 -0
  20. package/dist/codecs-CTxFjCg4.mjs.map +1 -0
  21. package/dist/{collectCsvFilesOrExit-BqnmK63h.mjs → collectCsvFilesOrExit-B1VOVGWN.mjs} +1 -1
  22. package/dist/{collectCsvFilesOrExit-BqnmK63h.mjs.map → collectCsvFilesOrExit-B1VOVGWN.mjs.map} +1 -1
  23. package/dist/{collectParquetFilesOrExit-BiksFI-Q.mjs → collectParquetFilesOrExit-DVlv5ctt.mjs} +1 -1
  24. package/dist/{collectParquetFilesOrExit-BiksFI-Q.mjs.map → collectParquetFilesOrExit-DVlv5ctt.mjs.map} +1 -1
  25. package/dist/{command-eIenZMOx.mjs → command-CIv9yk86.mjs} +2 -2
  26. package/dist/{command-eIenZMOx.mjs.map → command-CIv9yk86.mjs.map} +1 -1
  27. package/dist/commands/admin/chunk-csv/worker.mjs +1 -1
  28. package/dist/commands/admin/parquet-to-csv/worker.mjs +1 -1
  29. package/dist/{consentManagersToBusinessEntities-O4KBox9u.mjs → consentManagersToBusinessEntities-CBJ81aGO.mjs} +1 -1
  30. package/dist/{consentManagersToBusinessEntities-O4KBox9u.mjs.map → consentManagersToBusinessEntities-CBJ81aGO.mjs.map} +1 -1
  31. package/dist/{constants-BpQ5awGp.mjs → constants-DXzsg2CQ.mjs} +2 -2
  32. package/dist/{constants-BpQ5awGp.mjs.map → constants-DXzsg2CQ.mjs.map} +1 -1
  33. package/dist/{constants-C1seVfCu.mjs → constants-D_HVDaOy.mjs} +1 -1
  34. package/dist/{constants-C1seVfCu.mjs.map → constants-D_HVDaOy.mjs.map} +1 -1
  35. package/dist/{constants-BG53Mbi9.mjs → constants-jjHIzHGm.mjs} +2 -2
  36. package/dist/{constants-BG53Mbi9.mjs.map → constants-jjHIzHGm.mjs.map} +1 -1
  37. package/dist/{context-CZYrQfAn.mjs → context-B33NT3ki.mjs} +1 -1
  38. package/dist/{context-CZYrQfAn.mjs.map → context-B33NT3ki.mjs.map} +1 -1
  39. package/dist/{createPoolingCommandUi-C39R_zo3.mjs → createPoolingCommandUi-uiDjLlqf.mjs} +2 -2
  40. package/dist/{createPoolingCommandUi-C39R_zo3.mjs.map → createPoolingCommandUi-uiDjLlqf.mjs.map} +1 -1
  41. package/dist/{dataFlowsToDataSilos-CLSHb1GA.mjs → dataFlowsToDataSilos-BF6fzWcm.mjs} +1 -1
  42. package/dist/{dataFlowsToDataSilos-CLSHb1GA.mjs.map → dataFlowsToDataSilos-BF6fzWcm.mjs.map} +1 -1
  43. package/dist/deno-runtime-DV52X8-P.mjs +2 -0
  44. package/dist/deno-runtime-DV52X8-P.mjs.map +1 -0
  45. package/dist/{done-input-validation-Cjk7a3jX.mjs → done-input-validation-BUz-aVC5.mjs} +1 -1
  46. package/dist/{done-input-validation-Cjk7a3jX.mjs.map → done-input-validation-BUz-aVC5.mjs.map} +1 -1
  47. package/dist/{downloadPrivacyRequestFiles-CLFgQItk.mjs → downloadPrivacyRequestFiles-B_BVxW5Z.mjs} +2 -2
  48. package/dist/{downloadPrivacyRequestFiles-CLFgQItk.mjs.map → downloadPrivacyRequestFiles-B_BVxW5Z.mjs.map} +1 -1
  49. package/dist/{extractClientError-C_6ly7Gw.mjs → extractClientError-HZ2U7yqV.mjs} +1 -1
  50. package/dist/{extractClientError-C_6ly7Gw.mjs.map → extractClientError-HZ2U7yqV.mjs.map} +1 -1
  51. package/dist/{fetchAllRequests-CEDKdq0c.mjs → fetchAllRequests-2TZr-LfT.mjs} +2 -2
  52. package/dist/{fetchAllRequests-CEDKdq0c.mjs.map → fetchAllRequests-2TZr-LfT.mjs.map} +1 -1
  53. package/dist/{formatPolicyBundleVersionSummary-CrFtcPwS.mjs → formatPolicyBundleVersionSummary-CJmMCLtJ.mjs} +1 -1
  54. package/dist/{formatPolicyBundleVersionSummary-CrFtcPwS.mjs.map → formatPolicyBundleVersionSummary-CJmMCLtJ.mjs.map} +1 -1
  55. package/dist/{fuzzyMatchColumns-OTsFJ21f.mjs → fuzzyMatchColumns-CQCzpjWC.mjs} +2 -2
  56. package/dist/{fuzzyMatchColumns-OTsFJ21f.mjs.map → fuzzyMatchColumns-CQCzpjWC.mjs.map} +1 -1
  57. package/dist/{generateCrossAccountApiKeys-D6O_Qm3Y.mjs → generateCrossAccountApiKeys-Bnqgmj-H.mjs} +2 -2
  58. package/dist/{generateCrossAccountApiKeys-D6O_Qm3Y.mjs.map → generateCrossAccountApiKeys-Bnqgmj-H.mjs.map} +1 -1
  59. package/dist/impl--JGnR3wp.mjs +3 -0
  60. package/dist/{impl-CzxvoiGW.mjs.map → impl--JGnR3wp.mjs.map} +1 -1
  61. package/dist/{impl-BqrSLoig.mjs → impl-2iVTxNn4.mjs} +2 -2
  62. package/dist/{impl-BqrSLoig.mjs.map → impl-2iVTxNn4.mjs.map} +1 -1
  63. package/dist/{impl-Drql0g72.mjs → impl-7UqkSO3x2.mjs} +2 -2
  64. package/dist/impl-7UqkSO3x2.mjs.map +1 -0
  65. package/dist/{impl-C50tdWlL2.mjs → impl-B-j5ACi02.mjs} +2 -2
  66. package/dist/{impl-C50tdWlL2.mjs.map → impl-B-j5ACi02.mjs.map} +1 -1
  67. package/dist/impl-B4BgGuF_.mjs +3 -0
  68. package/dist/impl-B4BgGuF_.mjs.map +1 -0
  69. package/dist/{impl-zZFaSmxd2.mjs → impl-BDrvzlpf2.mjs} +2 -2
  70. package/dist/{impl-zZFaSmxd2.mjs.map → impl-BDrvzlpf2.mjs.map} +1 -1
  71. package/dist/{impl-Dk6TZKrp2.mjs → impl-BH_A5rgL.mjs} +2 -2
  72. package/dist/impl-BH_A5rgL.mjs.map +1 -0
  73. package/dist/{impl-CHmjV-Pa.mjs → impl-BOawPhYE.mjs} +2 -2
  74. package/dist/{impl-CHmjV-Pa.mjs.map → impl-BOawPhYE.mjs.map} +1 -1
  75. package/dist/{impl-CXUJ1eRC.mjs → impl-BPoEH3Nf2.mjs} +2 -2
  76. package/dist/impl-BPoEH3Nf2.mjs.map +1 -0
  77. package/dist/{impl-CqF9xIIy.mjs → impl-BXUYpR27.mjs} +2 -2
  78. package/dist/{impl-CqF9xIIy.mjs.map → impl-BXUYpR27.mjs.map} +1 -1
  79. package/dist/{impl-DYf10-BD2.mjs → impl-Bc6p8A1l2.mjs} +2 -2
  80. package/dist/{impl-DYf10-BD2.mjs.map → impl-Bc6p8A1l2.mjs.map} +1 -1
  81. package/dist/{impl-M3Eu4QjS.mjs → impl-BqWQh9Ss.mjs} +2 -2
  82. package/dist/{impl-M3Eu4QjS.mjs.map → impl-BqWQh9Ss.mjs.map} +1 -1
  83. package/dist/impl-C6HtWd1t.mjs +2 -0
  84. package/dist/{impl-BcJ019T2.mjs.map → impl-C6HtWd1t.mjs.map} +1 -1
  85. package/dist/{impl-GHukPBnk.mjs → impl-CL29fOWM.mjs} +2 -2
  86. package/dist/{impl-GHukPBnk.mjs.map → impl-CL29fOWM.mjs.map} +1 -1
  87. package/dist/{impl-BvNZqLrT.mjs → impl-CO4ZqlLV.mjs} +2 -2
  88. package/dist/{impl-BvNZqLrT.mjs.map → impl-CO4ZqlLV.mjs.map} +1 -1
  89. package/dist/{impl-DJLlcqSg.mjs → impl-COujMWgp.mjs} +2 -2
  90. package/dist/{impl-DJLlcqSg.mjs.map → impl-COujMWgp.mjs.map} +1 -1
  91. package/dist/{impl-Bs-drNBf.mjs → impl-CPSEzCc9.mjs} +2 -2
  92. package/dist/{impl-Bs-drNBf.mjs.map → impl-CPSEzCc9.mjs.map} +1 -1
  93. package/dist/{impl-Dib6Fff12.mjs → impl-CQVy2k3o.mjs} +2 -2
  94. package/dist/impl-CQVy2k3o.mjs.map +1 -0
  95. package/dist/{impl-B3_hrFPX.mjs → impl-CUOVJsRg.mjs} +2 -2
  96. package/dist/{impl-B3_hrFPX.mjs.map → impl-CUOVJsRg.mjs.map} +1 -1
  97. package/dist/{impl-BySmbxEt.mjs → impl-CUiYbk6G.mjs} +2 -2
  98. package/dist/{impl-BySmbxEt.mjs.map → impl-CUiYbk6G.mjs.map} +1 -1
  99. package/dist/{impl-CWh9H7mL.mjs → impl-CXTBcYo6.mjs} +2 -2
  100. package/dist/{impl-CWh9H7mL.mjs.map → impl-CXTBcYo6.mjs.map} +1 -1
  101. package/dist/{impl-Cx3T0Iei.mjs → impl-CfvxD3RI.mjs} +2 -2
  102. package/dist/{impl-Cx3T0Iei.mjs.map → impl-CfvxD3RI.mjs.map} +1 -1
  103. package/dist/{impl-DHfYO9T52.mjs → impl-Cli2XRp02.mjs} +2 -2
  104. package/dist/{impl-DHfYO9T52.mjs.map → impl-Cli2XRp02.mjs.map} +1 -1
  105. package/dist/{impl-CDtUusmg.mjs → impl-CuDs6SsI.mjs} +2 -2
  106. package/dist/{impl-CDtUusmg.mjs.map → impl-CuDs6SsI.mjs.map} +1 -1
  107. package/dist/{impl-BYGNx-8W2.mjs → impl-CvLI_Jig.mjs} +2 -2
  108. package/dist/impl-CvLI_Jig.mjs.map +1 -0
  109. package/dist/{impl-BFJtKA2o2.mjs → impl-CwKYKBYb.mjs} +2 -2
  110. package/dist/impl-CwKYKBYb.mjs.map +1 -0
  111. package/dist/{impl-BewF8tB6.mjs → impl-CwXp3Tbr.mjs} +2 -2
  112. package/dist/{impl-BewF8tB6.mjs.map → impl-CwXp3Tbr.mjs.map} +1 -1
  113. package/dist/{impl-B--lr5RJ2.mjs → impl-CyQRmuM72.mjs} +2 -2
  114. package/dist/{impl-B--lr5RJ2.mjs.map → impl-CyQRmuM72.mjs.map} +1 -1
  115. package/dist/impl-DEJpYLPB.mjs +2 -0
  116. package/dist/impl-DEJpYLPB.mjs.map +1 -0
  117. package/dist/impl-DEhw1iNn.mjs +2 -0
  118. package/dist/impl-DEhw1iNn.mjs.map +1 -0
  119. package/dist/impl-DK7nSMle2.mjs +303 -0
  120. package/dist/impl-DK7nSMle2.mjs.map +1 -0
  121. package/dist/{impl-DOoR93T6.mjs → impl-DKepRc812.mjs} +2 -2
  122. package/dist/impl-DKepRc812.mjs.map +1 -0
  123. package/dist/{impl-CTIWliTx.mjs → impl-DLG0Egy6.mjs} +2 -2
  124. package/dist/{impl-CTIWliTx.mjs.map → impl-DLG0Egy6.mjs.map} +1 -1
  125. package/dist/impl-DMe_OqJx.mjs +2 -0
  126. package/dist/{impl-BsC1KVxS.mjs.map → impl-DMe_OqJx.mjs.map} +1 -1
  127. package/dist/{impl-BwRcpAno.mjs → impl-DNe-gRXe2.mjs} +2 -2
  128. package/dist/impl-DNe-gRXe2.mjs.map +1 -0
  129. package/dist/{impl-Dm-Fkr392.mjs → impl-DNzkRayg.mjs} +2 -2
  130. package/dist/impl-DNzkRayg.mjs.map +1 -0
  131. package/dist/{impl-DzNk41xd.mjs → impl-DPtx5iZO.mjs} +2 -2
  132. package/dist/{impl-DzNk41xd.mjs.map → impl-DPtx5iZO.mjs.map} +1 -1
  133. package/dist/{impl-syp5hclX.mjs → impl-DRpK-QLC.mjs} +2 -2
  134. package/dist/{impl-syp5hclX.mjs.map → impl-DRpK-QLC.mjs.map} +1 -1
  135. package/dist/{impl-Bq6g_xYv.mjs → impl-DVQmuZQY.mjs} +2 -2
  136. package/dist/{impl-Bq6g_xYv.mjs.map → impl-DVQmuZQY.mjs.map} +1 -1
  137. package/dist/{impl-DYwojWvN.mjs → impl-DVeGQCrr.mjs} +2 -2
  138. package/dist/{impl-DYwojWvN.mjs.map → impl-DVeGQCrr.mjs.map} +1 -1
  139. package/dist/{impl-DF8RGVlT.mjs → impl-DXRDWiB1.mjs} +2 -2
  140. package/dist/{impl-DF8RGVlT.mjs.map → impl-DXRDWiB1.mjs.map} +1 -1
  141. package/dist/{impl-CiYKuCHV.mjs → impl-DXowiNOz.mjs} +2 -2
  142. package/dist/{impl-CiYKuCHV.mjs.map → impl-DXowiNOz.mjs.map} +1 -1
  143. package/dist/{impl-DpuhHpuk.mjs → impl-DaH1_ZzK.mjs} +2 -2
  144. package/dist/{impl-DpuhHpuk.mjs.map → impl-DaH1_ZzK.mjs.map} +1 -1
  145. package/dist/{impl-DIPvFKiP.mjs → impl-DdIa0zla.mjs} +2 -2
  146. package/dist/{impl-DIPvFKiP.mjs.map → impl-DdIa0zla.mjs.map} +1 -1
  147. package/dist/{impl-DbZ1cYoR.mjs → impl-DqhZR11m.mjs} +2 -2
  148. package/dist/{impl-DbZ1cYoR.mjs.map → impl-DqhZR11m.mjs.map} +1 -1
  149. package/dist/{impl-VPBEqV0w2.mjs → impl-Dqqb0lVN.mjs} +2 -2
  150. package/dist/impl-Dqqb0lVN.mjs.map +1 -0
  151. package/dist/{impl-6m7GXUAe.mjs → impl-DryC3OJu.mjs} +2 -2
  152. package/dist/{impl-6m7GXUAe.mjs.map → impl-DryC3OJu.mjs.map} +1 -1
  153. package/dist/{impl-CQGeH47F.mjs → impl-DuZjI6p0.mjs} +2 -2
  154. package/dist/{impl-CQGeH47F.mjs.map → impl-DuZjI6p0.mjs.map} +1 -1
  155. package/dist/{impl-C5dzaDga2.mjs → impl-Dw8NYkzw.mjs} +2 -2
  156. package/dist/impl-Dw8NYkzw.mjs.map +1 -0
  157. package/dist/impl-Dx_TfvW1.mjs +2 -0
  158. package/dist/{impl-C8BmxFQ2.mjs.map → impl-Dx_TfvW1.mjs.map} +1 -1
  159. package/dist/{impl-DXNcD7CZ.mjs → impl-DypttZd6.mjs} +2 -2
  160. package/dist/{impl-DXNcD7CZ.mjs.map → impl-DypttZd6.mjs.map} +1 -1
  161. package/dist/{impl-CfPXYgT42.mjs → impl-DzUTmaID2.mjs} +2 -2
  162. package/dist/{impl-CfPXYgT42.mjs.map → impl-DzUTmaID2.mjs.map} +1 -1
  163. package/dist/{impl-BJlKQJdS2.mjs → impl-INhq_CiK.mjs} +2 -2
  164. package/dist/impl-INhq_CiK.mjs.map +1 -0
  165. package/dist/{impl-KKrDTraf.mjs → impl-KmCNH-yw.mjs} +2 -2
  166. package/dist/{impl-KKrDTraf.mjs.map → impl-KmCNH-yw.mjs.map} +1 -1
  167. package/dist/{impl-CE56-wQh.mjs → impl-RPG-BTmX.mjs} +2 -2
  168. package/dist/{impl-CE56-wQh.mjs.map → impl-RPG-BTmX.mjs.map} +1 -1
  169. package/dist/{impl-amV0wRWk.mjs → impl-XrTL-TDl.mjs} +2 -2
  170. package/dist/{impl-amV0wRWk.mjs.map → impl-XrTL-TDl.mjs.map} +1 -1
  171. package/dist/impl-Z8oWVENM.mjs +2 -0
  172. package/dist/impl-Z8oWVENM.mjs.map +1 -0
  173. package/dist/{impl-m3QXCc6n.mjs → impl-a_Y8bnSn.mjs} +4 -4
  174. package/dist/impl-a_Y8bnSn.mjs.map +1 -0
  175. package/dist/{impl-CEmXPEq22.mjs → impl-hwpT9u5o2.mjs} +2 -2
  176. package/dist/{impl-CEmXPEq22.mjs.map → impl-hwpT9u5o2.mjs.map} +1 -1
  177. package/dist/{impl-BWVe4VGF2.mjs → impl-xq89cSSz2.mjs} +2 -2
  178. package/dist/{impl-BWVe4VGF2.mjs.map → impl-xq89cSSz2.mjs.map} +1 -1
  179. package/dist/index.d.mts +12797 -1840
  180. package/dist/index.d.mts.map +1 -1
  181. package/dist/index.mjs +3 -3
  182. package/dist/index.mjs.map +1 -1
  183. package/dist/{initializeCliRuntime-802-P8MC.mjs → initializeCliRuntime-6wI_VIHV.mjs} +1 -1
  184. package/dist/{initializeCliRuntime-802-P8MC.mjs.map → initializeCliRuntime-6wI_VIHV.mjs.map} +1 -1
  185. package/dist/{inquirer-DkFTQU00.mjs → inquirer-BeaBetMO.mjs} +2 -2
  186. package/dist/{inquirer-DkFTQU00.mjs.map → inquirer-BeaBetMO.mjs.map} +1 -1
  187. package/dist/jsonc-D9dDWb1J.mjs +6 -0
  188. package/dist/jsonc-D9dDWb1J.mjs.map +1 -0
  189. package/dist/{listFiles-CWHAdKY-.mjs → listFiles-BdFUbX5x.mjs} +1 -1
  190. package/dist/{listFiles-CWHAdKY-.mjs.map → listFiles-BdFUbX5x.mjs.map} +1 -1
  191. package/dist/logger-zplFSeXU.mjs +2 -0
  192. package/dist/logger-zplFSeXU.mjs.map +1 -0
  193. package/dist/manifest-BNIpO_zW.mjs +2 -0
  194. package/dist/manifest-BNIpO_zW.mjs.map +1 -0
  195. package/dist/{mapConsentCsvRowsToInputs-MMPZwzrV.mjs → mapConsentCsvRowsToInputs-Dqb6WL4r.mjs} +1 -1
  196. package/dist/{mapConsentCsvRowsToInputs-MMPZwzrV.mjs.map → mapConsentCsvRowsToInputs-Dqb6WL4r.mjs.map} +1 -1
  197. package/dist/{markRequestDataSiloIdsCompleted-PKCcn5wQ.mjs → markRequestDataSiloIdsCompleted-B5N-cQWr.mjs} +2 -2
  198. package/dist/{markRequestDataSiloIdsCompleted-PKCcn5wQ.mjs.map → markRequestDataSiloIdsCompleted-B5N-cQWr.mjs.map} +1 -1
  199. package/dist/{markSilentPrivacyRequests-7l9I99pe.mjs → markSilentPrivacyRequests-BiaButWF.mjs} +2 -2
  200. package/dist/{markSilentPrivacyRequests-7l9I99pe.mjs.map → markSilentPrivacyRequests-BiaButWF.mjs.map} +1 -1
  201. package/dist/mergeTranscendInputs-DFQcbh8b.mjs +3 -0
  202. package/dist/mergeTranscendInputs-DFQcbh8b.mjs.map +1 -0
  203. package/dist/missing-manifest-DgcukXfg.mjs +2 -0
  204. package/dist/missing-manifest-DgcukXfg.mjs.map +1 -0
  205. package/dist/{module-graph-DBC7ZvyA.mjs → module-graph-Cb0g74Ft.mjs} +1 -1
  206. package/dist/{module-graph-DBC7ZvyA.mjs.map → module-graph-Cb0g74Ft.mjs.map} +1 -1
  207. package/dist/{notifyPrivacyRequestsAdditionalTime-BPIYuCov.mjs → notifyPrivacyRequestsAdditionalTime-D3Vtvg5G.mjs} +2 -2
  208. package/dist/{notifyPrivacyRequestsAdditionalTime-BPIYuCov.mjs.map → notifyPrivacyRequestsAdditionalTime-D3Vtvg5G.mjs.map} +1 -1
  209. package/dist/{parquetToCsvOneFile-CSVdrLvq.mjs → parquetToCsvOneFile-ChmPC6dL.mjs} +2 -2
  210. package/dist/{parquetToCsvOneFile-CSVdrLvq.mjs.map → parquetToCsvOneFile-ChmPC6dL.mjs.map} +1 -1
  211. package/dist/{parseAttributesFromString-C5-KGkPH.mjs → parseAttributesFromString-CO16oAlx.mjs} +2 -2
  212. package/dist/{parseAttributesFromString-C5-KGkPH.mjs.map → parseAttributesFromString-CO16oAlx.mjs.map} +1 -1
  213. package/dist/{parseVariablesFromString-Cr3x2uq3.mjs → parseVariablesFromString-BOSfQ4QF.mjs} +1 -1
  214. package/dist/{parseVariablesFromString-Cr3x2uq3.mjs.map → parseVariablesFromString-BOSfQ4QF.mjs.map} +1 -1
  215. package/dist/path-safety-D5Qwl40b.mjs +2 -0
  216. package/dist/path-safety-D5Qwl40b.mjs.map +1 -0
  217. package/dist/policy-bundle-manifest-D6dkbjNi.mjs +7 -0
  218. package/dist/policy-bundle-manifest-D6dkbjNi.mjs.map +1 -0
  219. package/dist/policy-runtime-BMKa-Upy.mjs +2 -0
  220. package/dist/policy-runtime-BMKa-Upy.mjs.map +1 -0
  221. package/dist/{printResult-esxW3HhT.mjs → printResult-CHe3nRN4.mjs} +5 -5
  222. package/dist/printResult-CHe3nRN4.mjs.map +1 -0
  223. package/dist/project-plan-apply-Dvndx455.mjs +3 -0
  224. package/dist/project-plan-apply-Dvndx455.mjs.map +1 -0
  225. package/dist/prompts-ClBXdELk.mjs +4 -0
  226. package/dist/prompts-ClBXdELk.mjs.map +1 -0
  227. package/dist/{pullAllDatapoints-H92qjLSx.mjs → pullAllDatapoints-uk5ggk6O.mjs} +2 -2
  228. package/dist/{pullAllDatapoints-H92qjLSx.mjs.map → pullAllDatapoints-uk5ggk6O.mjs.map} +1 -1
  229. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-BrDmPbvc.mjs → pullChunkedCustomSiloOutstandingIdentifiers-D85P1W_8.mjs} +2 -2
  230. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-BrDmPbvc.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-D85P1W_8.mjs.map} +1 -1
  231. package/dist/{pullConsentManagerMetrics-Cvex-gpd.mjs → pullConsentManagerMetrics-Dv5n1ZGp.mjs} +2 -2
  232. package/dist/{pullConsentManagerMetrics-Cvex-gpd.mjs.map → pullConsentManagerMetrics-Dv5n1ZGp.mjs.map} +1 -1
  233. package/dist/{pullManualEnrichmentIdentifiersToCsv-qjdNA75O.mjs → pullManualEnrichmentIdentifiersToCsv-DbNSrKEk.mjs} +2 -2
  234. package/dist/{pullManualEnrichmentIdentifiersToCsv-qjdNA75O.mjs.map → pullManualEnrichmentIdentifiersToCsv-DbNSrKEk.mjs.map} +1 -1
  235. package/dist/{pullTranscendConfiguration-CD7Frn8z.mjs → pullTranscendConfiguration-B63M3ild.mjs} +3 -3
  236. package/dist/{pullTranscendConfiguration-CD7Frn8z.mjs.map → pullTranscendConfiguration-B63M3ild.mjs.map} +1 -1
  237. package/dist/{pullUnstructuredSubDataPointRecommendations-Dmh_-r95.mjs → pullUnstructuredSubDataPointRecommendations-YTBzfkRZ.mjs} +2 -2
  238. package/dist/{pullUnstructuredSubDataPointRecommendations-Dmh_-r95.mjs.map → pullUnstructuredSubDataPointRecommendations-YTBzfkRZ.mjs.map} +1 -1
  239. package/dist/{pushCronIdentifiersFromCsv-DjeY7TtK.mjs → pushCronIdentifiersFromCsv-5ruUKHtL.mjs} +2 -2
  240. package/dist/{pushCronIdentifiersFromCsv-DjeY7TtK.mjs.map → pushCronIdentifiersFromCsv-5ruUKHtL.mjs.map} +1 -1
  241. package/dist/{pushManualEnrichmentIdentifiersFromCsv-BDtMo13j.mjs → pushManualEnrichmentIdentifiersFromCsv-B0i2239u.mjs} +2 -2
  242. package/dist/{pushManualEnrichmentIdentifiersFromCsv-BDtMo13j.mjs.map → pushManualEnrichmentIdentifiersFromCsv-B0i2239u.mjs.map} +1 -1
  243. package/dist/{readCsv-Cr_1t8F5.mjs → readCsv-DLg8pwjd.mjs} +1 -1
  244. package/dist/{readCsv-Cr_1t8F5.mjs.map → readCsv-DLg8pwjd.mjs.map} +1 -1
  245. package/dist/readTranscendYaml-BNn6-Ofi.mjs +4 -0
  246. package/dist/readTranscendYaml-BNn6-Ofi.mjs.map +1 -0
  247. package/dist/{removeUnverifiedRequestIdentifiers-B9uPApVR.mjs → removeUnverifiedRequestIdentifiers-QmeqrmxM.mjs} +2 -2
  248. package/dist/{removeUnverifiedRequestIdentifiers-B9uPApVR.mjs.map → removeUnverifiedRequestIdentifiers-QmeqrmxM.mjs.map} +1 -1
  249. package/dist/{renderTable-DKTZbMjY.mjs → renderTable-D68QasPc.mjs} +1 -1
  250. package/dist/{renderTable-DKTZbMjY.mjs.map → renderTable-D68QasPc.mjs.map} +1 -1
  251. package/dist/{request-B1yRTdG-.mjs → request-BiPv6jmP.mjs} +1 -1
  252. package/dist/{request-B1yRTdG-.mjs.map → request-BiPv6jmP.mjs.map} +1 -1
  253. package/dist/{resolveBundleIdByName-DuxWYrDF.mjs → resolveBundleIdByName-qXZBrUz_.mjs} +2 -2
  254. package/dist/{resolveBundleIdByName-DuxWYrDF.mjs.map → resolveBundleIdByName-qXZBrUz_.mjs.map} +1 -1
  255. package/dist/{resolvePolicyBundleVersion-DhXZKwb4.mjs → resolvePolicyBundleVersion-BG7XqBBP.mjs} +2 -2
  256. package/dist/{resolvePolicyBundleVersion-DhXZKwb4.mjs.map → resolvePolicyBundleVersion-BG7XqBBP.mjs.map} +1 -1
  257. package/dist/{retryRequestDataSilos-D9dBtbdl.mjs → retryRequestDataSilos-BfckLjOJ.mjs} +2 -2
  258. package/dist/{retryRequestDataSilos-D9dBtbdl.mjs.map → retryRequestDataSilos-BfckLjOJ.mjs.map} +1 -1
  259. package/dist/{run-captured-process-CpZBh0lG.mjs → run-captured-process-BXwWXuTh.mjs} +1 -1
  260. package/dist/{run-captured-process-CpZBh0lG.mjs.map → run-captured-process-BXwWXuTh.mjs.map} +1 -1
  261. package/dist/runOpa-CswzJxIs.mjs +2 -0
  262. package/dist/runOpa-CswzJxIs.mjs.map +1 -0
  263. package/dist/scaffold-model-BAbYTR0q.mjs +2 -0
  264. package/dist/scaffold-model-BAbYTR0q.mjs.map +1 -0
  265. package/dist/scaffold-planning-CNv83t_v.mjs +123 -0
  266. package/dist/scaffold-planning-CNv83t_v.mjs.map +1 -0
  267. package/dist/scaffold-templates-DzDGTZie.mjs +84 -0
  268. package/dist/scaffold-templates-DzDGTZie.mjs.map +1 -0
  269. package/dist/{skipPreflightJobs-Beia_iB6.mjs → skipPreflightJobs-Do_kwu3m.mjs} +2 -2
  270. package/dist/{skipPreflightJobs-Beia_iB6.mjs.map → skipPreflightJobs-Do_kwu3m.mjs.map} +1 -1
  271. package/dist/{skipRequestDataSilos-BSNLacnR.mjs → skipRequestDataSilos-BNDhdllD.mjs} +2 -2
  272. package/dist/{skipRequestDataSilos-BSNLacnR.mjs.map → skipRequestDataSilos-BNDhdllD.mjs.map} +1 -1
  273. package/dist/{streamPrivacyRequestsToCsv-Cksb9D49.mjs → streamPrivacyRequestsToCsv-CbJfhV6A.mjs} +2 -2
  274. package/dist/{streamPrivacyRequestsToCsv-Cksb9D49.mjs.map → streamPrivacyRequestsToCsv-CbJfhV6A.mjs.map} +1 -1
  275. package/dist/{syncCodePackages-DsC1tE8B.mjs → syncCodePackages-BHE2Tn1Q.mjs} +2 -2
  276. package/dist/{syncCodePackages-DsC1tE8B.mjs.map → syncCodePackages-BHE2Tn1Q.mjs.map} +1 -1
  277. package/dist/{updateConsentManagerVersionToLatest-CaEkTnlL.mjs → updateConsentManagerVersionToLatest-DEFwH4Se.mjs} +2 -2
  278. package/dist/{updateConsentManagerVersionToLatest-CaEkTnlL.mjs.map → updateConsentManagerVersionToLatest-DEFwH4Se.mjs.map} +1 -1
  279. package/dist/{uploadConsents-CNyuYx0o.mjs → uploadConsents-ChmFIw_j.mjs} +2 -2
  280. package/dist/{uploadConsents-CNyuYx0o.mjs.map → uploadConsents-ChmFIw_j.mjs.map} +1 -1
  281. package/dist/{uploadPrivacyRequestsFromCsv-BdTQOZnF.mjs → uploadPrivacyRequestsFromCsv-D3KSb1qH.mjs} +2 -2
  282. package/dist/{uploadPrivacyRequestsFromCsv-BdTQOZnF.mjs.map → uploadPrivacyRequestsFromCsv-D3KSb1qH.mjs.map} +1 -1
  283. package/dist/{validateTranscendAuth-CnHMn77m.mjs → validateTranscendAuth-D6Wr1cxY.mjs} +2 -2
  284. package/dist/{validateTranscendAuth-CnHMn77m.mjs.map → validateTranscendAuth-D6Wr1cxY.mjs.map} +1 -1
  285. package/dist/{writeCsv-D46aDkGf.mjs → writeCsv-D-2siSwE.mjs} +1 -1
  286. package/dist/{writeCsv-D46aDkGf.mjs.map → writeCsv-D-2siSwE.mjs.map} +1 -1
  287. package/package.json +8 -7
  288. package/dist/app-DCY8E776.mjs.map +0 -1
  289. package/dist/codecs-BsQFAFGT.mjs +0 -2
  290. package/dist/codecs-BsQFAFGT.mjs.map +0 -1
  291. package/dist/constants-BMAOvdcA.mjs +0 -2
  292. package/dist/constants-BMAOvdcA.mjs.map +0 -1
  293. package/dist/deno-runtime-QqwBDKXX.mjs +0 -2
  294. package/dist/deno-runtime-QqwBDKXX.mjs.map +0 -1
  295. package/dist/impl-BFJtKA2o2.mjs.map +0 -1
  296. package/dist/impl-BJlKQJdS2.mjs.map +0 -1
  297. package/dist/impl-BNPgYSBT.mjs +0 -3
  298. package/dist/impl-BNPgYSBT.mjs.map +0 -1
  299. package/dist/impl-BYGNx-8W2.mjs.map +0 -1
  300. package/dist/impl-BcJ019T2.mjs +0 -2
  301. package/dist/impl-BsC1KVxS.mjs +0 -2
  302. package/dist/impl-BwRcpAno.mjs.map +0 -1
  303. package/dist/impl-C5dzaDga2.mjs.map +0 -1
  304. package/dist/impl-C8BmxFQ2.mjs +0 -2
  305. package/dist/impl-CXUJ1eRC.mjs.map +0 -1
  306. package/dist/impl-CzxvoiGW.mjs +0 -3
  307. package/dist/impl-D-SQJc3t.mjs +0 -2
  308. package/dist/impl-D-SQJc3t.mjs.map +0 -1
  309. package/dist/impl-D23kJPAQ2.mjs +0 -3
  310. package/dist/impl-D23kJPAQ2.mjs.map +0 -1
  311. package/dist/impl-DOoR93T6.mjs.map +0 -1
  312. package/dist/impl-Dib6Fff12.mjs.map +0 -1
  313. package/dist/impl-Dk6TZKrp2.mjs.map +0 -1
  314. package/dist/impl-Dm-Fkr392.mjs.map +0 -1
  315. package/dist/impl-Drql0g72.mjs.map +0 -1
  316. package/dist/impl-FLj_mWLO.mjs +0 -2
  317. package/dist/impl-FLj_mWLO.mjs.map +0 -1
  318. package/dist/impl-VPBEqV0w2.mjs.map +0 -1
  319. package/dist/impl-m3QXCc6n.mjs.map +0 -1
  320. package/dist/logger-9T6vva73.mjs +0 -2
  321. package/dist/logger-9T6vva73.mjs.map +0 -1
  322. package/dist/manifest-DVuW_vvO.mjs +0 -2
  323. package/dist/manifest-DVuW_vvO.mjs.map +0 -1
  324. package/dist/mergeTranscendInputs-CWHXH0kF.mjs +0 -3
  325. package/dist/mergeTranscendInputs-CWHXH0kF.mjs.map +0 -1
  326. package/dist/missing-manifest-BKj1j-jg.mjs +0 -2
  327. package/dist/missing-manifest-BKj1j-jg.mjs.map +0 -1
  328. package/dist/printResult-esxW3HhT.mjs.map +0 -1
  329. package/dist/project-plan-apply-C2DfikVN.mjs +0 -3
  330. package/dist/project-plan-apply-C2DfikVN.mjs.map +0 -1
  331. package/dist/readTranscendYaml-STYnRzq-.mjs +0 -4
  332. package/dist/readTranscendYaml-STYnRzq-.mjs.map +0 -1
  333. package/dist/runOpa-CkKAwsvB.mjs +0 -2
  334. package/dist/runOpa-CkKAwsvB.mjs.map +0 -1
  335. package/dist/scaffold-planning-DMACXSnX.mjs +0 -121
  336. package/dist/scaffold-planning-DMACXSnX.mjs.map +0 -1
  337. package/dist/scaffold-templates-CsHM1y80.mjs +0 -84
  338. package/dist/scaffold-templates-CsHM1y80.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DIPvFKiP.mjs","names":[],"sources":["../src/commands/policy/bundles/impl.ts"],"sourcesContent":["import colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { EMPTY_CELL } from '../constants.js';\nimport {\n buildPolicyEngineClient,\n policyEngineRequest,\n printResult,\n renderTable,\n setPolicyEngineCliDebug,\n} from '../helpers/index.js';\nimport type { PolicyBundleListResponse } from '../types.js';\n\n/** CLI flags for `transcend policy bundles`. */\nexport interface BundlesCommandFlags {\n /** Transcend API key */\n auth: string;\n /** Transcend API URL */\n 'transcend-url': string;\n /** Page size */\n limit: number;\n /** Number of records to skip */\n offset: number;\n /** Print raw JSON response */\n json: boolean;\n /** Include technical error details when a command fails */\n debug?: boolean;\n}\n\n/**\n * List policy bundles for the current organization.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function bundles(\n this: LocalContext,\n { auth, 'transcend-url': transcendUrl, limit, offset, json, debug = false }: BundlesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n setPolicyEngineCliDebug(debug);\n\n const client = buildPolicyEngineClient(transcendUrl, auth);\n\n this.logger.info(colors.green('Listing policy bundles...'));\n\n const body = await policyEngineRequest(\n client\n .get('v1/policy-engine/policy-bundles', {\n searchParams: { limit, offset },\n })\n .json<PolicyBundleListResponse>(),\n );\n\n printResult(this.process.stdout, {\n json,\n data: body,\n renderTable: () => {\n if (body.nodes.length === 0) {\n return 'No policy bundles found.';\n }\n\n const rows = body.nodes.map((bundle) => [\n bundle.id,\n bundle.bundleName,\n bundle.activeVersionId ?? EMPTY_CELL,\n bundle.lastActivatedAt ?? EMPTY_CELL,\n bundle.createdAt,\n ]);\n\n let table = renderTable(\n ['id', 'bundleName', 'activeVersionId', 'lastActivatedAt', 'createdAt'],\n rows,\n );\n table += `\\n\\ntotalCount: ${body.totalCount}`;\n if (offset + body.nodes.length < body.totalCount) {\n table += `\\nnextOffset: ${offset + body.nodes.length}`;\n }\n return table;\n },\n });\n}\n"],"mappings":"8OAoCA,eAAsB,EAEpB,CAAE,OAAM,gBAAiB,EAAc,QAAO,SAAQ,OAAM,QAAQ,IACrD,CACf,EAAoB,KAAK,QAAQ,CACjC,EAAwB,EAAM,CAE9B,IAAM,EAAS,EAAwB,EAAc,EAAK,CAE1D,KAAK,OAAO,KAAK,EAAO,MAAM,4BAA4B,CAAC,CAE3D,IAAM,EAAO,MAAM,EACjB,EACG,IAAI,kCAAmC,CACtC,aAAc,CAAE,QAAO,SAAQ,CAChC,CAAC,CACD,MAAgC,CACpC,CAED,EAAY,KAAK,QAAQ,OAAQ,CAC/B,OACA,KAAM,EACN,gBAAmB,CACjB,GAAI,EAAK,MAAM,SAAW,EACxB,MAAO,2BAWT,IAAI,EAAQ,EACV,CAAC,KAAM,aAAc,kBAAmB,kBAAmB,YAAY,CAT5D,EAAK,MAAM,IAAK,GAAW,CACtC,EAAO,GACP,EAAO,WACP,EAAO,iBAAA,IACP,EAAO,iBAAA,IACP,EAAO,UACR,CAIK,CACL,CAKD,MAJA,IAAS,mBAAmB,EAAK,aAC7B,EAAS,EAAK,MAAM,OAAS,EAAK,aACpC,GAAS,iBAAiB,EAAS,EAAK,MAAM,UAEzC,GAEV,CAAC"}
1
+ {"version":3,"file":"impl-DdIa0zla.mjs","names":[],"sources":["../src/commands/policy/bundles/impl.ts"],"sourcesContent":["import colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { EMPTY_CELL } from '../constants.js';\nimport {\n buildPolicyEngineClient,\n policyEngineRequest,\n printResult,\n renderTable,\n setPolicyEngineCliDebug,\n} from '../helpers/index.js';\nimport type { PolicyBundleListResponse } from '../types.js';\n\n/** CLI flags for `transcend policy bundles`. */\nexport interface BundlesCommandFlags {\n /** Transcend API key */\n auth: string;\n /** Transcend API URL */\n 'transcend-url': string;\n /** Page size */\n limit: number;\n /** Number of records to skip */\n offset: number;\n /** Print raw JSON response */\n json: boolean;\n /** Include technical error details when a command fails */\n debug?: boolean;\n}\n\n/**\n * List policy bundles for the current organization.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function bundles(\n this: LocalContext,\n { auth, 'transcend-url': transcendUrl, limit, offset, json, debug = false }: BundlesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n setPolicyEngineCliDebug(debug);\n\n const client = buildPolicyEngineClient(transcendUrl, auth);\n\n this.logger.info(colors.green('Listing policy bundles...'));\n\n const body = await policyEngineRequest(\n client\n .get('v1/policy-engine/policy-bundles', {\n searchParams: { limit, offset },\n })\n .json<PolicyBundleListResponse>(),\n );\n\n printResult(this.process.stdout, {\n json,\n data: body,\n renderTable: () => {\n if (body.nodes.length === 0) {\n return 'No policy bundles found.';\n }\n\n const rows = body.nodes.map((bundle) => [\n bundle.id,\n bundle.bundleName,\n bundle.activeVersionId ?? EMPTY_CELL,\n bundle.lastActivatedAt ?? EMPTY_CELL,\n bundle.createdAt,\n ]);\n\n let table = renderTable(\n ['id', 'bundleName', 'activeVersionId', 'lastActivatedAt', 'createdAt'],\n rows,\n );\n table += `\\n\\ntotalCount: ${body.totalCount}`;\n if (offset + body.nodes.length < body.totalCount) {\n table += `\\nnextOffset: ${offset + body.nodes.length}`;\n }\n return table;\n },\n });\n}\n"],"mappings":"8OAoCA,eAAsB,EAEpB,CAAE,OAAM,gBAAiB,EAAc,QAAO,SAAQ,OAAM,QAAQ,IACrD,CACf,EAAoB,KAAK,QAAQ,CACjC,EAAwB,EAAM,CAE9B,IAAM,EAAS,EAAwB,EAAc,EAAK,CAE1D,KAAK,OAAO,KAAK,EAAO,MAAM,4BAA4B,CAAC,CAE3D,IAAM,EAAO,MAAM,EACjB,EACG,IAAI,kCAAmC,CACtC,aAAc,CAAE,QAAO,SAAQ,CAChC,CAAC,CACD,MAAgC,CACpC,CAED,EAAY,KAAK,QAAQ,OAAQ,CAC/B,OACA,KAAM,EACN,gBAAmB,CACjB,GAAI,EAAK,MAAM,SAAW,EACxB,MAAO,2BAWT,IAAI,EAAQ,EACV,CAAC,KAAM,aAAc,kBAAmB,kBAAmB,YAAY,CAT5D,EAAK,MAAM,IAAK,GAAW,CACtC,EAAO,GACP,EAAO,WACP,EAAO,iBAAA,IACP,EAAO,iBAAA,IACP,EAAO,UACR,CAIK,CACL,CAKD,MAJA,IAAS,mBAAmB,EAAK,aAC7B,EAAS,EAAK,MAAM,OAAS,EAAK,aACpC,GAAS,iBAAiB,EAAS,EAAK,MAAM,UAEzC,GAEV,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./readCsv-Cr_1t8F5.mjs";import{a as t}from"./writeCsv-D46aDkGf.mjs";import{t as n}from"./done-input-validation-Cjk7a3jX.mjs";import{SombraStandardScope as r}from"@transcend-io/privacy-types";import i from"colors";import*as a from"io-ts";import{buildTranscendGraphQLClient as o,createPreferenceAccessTokens as s}from"@transcend-io/sdk";import c from"cli-progress";async function l({auth:l,file:u,transcendUrl:d,duration:f,subjectType:p,emailColumnName:m,coreIdentifierColumnName:h}){n(this.process),this.fs.existsSync(u)||(this.logger.error(i.red(`File does not exist: "${u}". Please provide a valid path to a CSV file.`)),this.process.exit(1));try{let n=o(d,l),g=a.type({[m]:a.string,...h?{[h]:a.string}:{}}),_=e(this.fs.readFileSync(u,`utf8`),g);if(!_.length)throw Error(`Input CSV is empty.`);let v=_.map((e,t)=>[e,t]).filter(([e])=>!e[m]?.trim());if(v.length){let e=v.map(([,e])=>e+2).join(`, `);throw Error(`The following rows are missing the required "${m}" column: ${e}`)}if(h){let e=_.map((e,t)=>[e,t]).filter(([e])=>!e[h]?.trim());if(e.length){let t=e.map(([,e])=>e+2).join(`, `);throw Error(`The following rows are missing the required "${h}" column: ${t}`)}}let y=Math.max(1,Math.floor(f/1e3)),b=_.map((e,t)=>{let n=e[m].trim(),i=h?e[h]?.trim():void 0;return{subjectType:p,scopes:[r.PreferenceManagement],expiresIn:y,email:n,...i?{coreIdentifier:i}:{},index:t}}),x=new c.SingleBar({},c.Presets.shades_classic);x.start(b.length,0);let S=Date.now(),C=await s(n,{records:b,logger:this.logger,emitProgress:e=>{x.update(e)}});x.update(b.length),x.stop();let w=C.map(({accessToken:e,input:t})=>{if(typeof t.index!=`number`)throw Error(`Internal error: missing input index.`);return{..._[t.index],token:e}});this.logger.info(i.magenta(`Writing access tokens to file "${u}"...`)),await t(u,w,!0);let T=Math.round((Date.now()-S)/1e3);this.logger.info(i.green(`Successfully generated ${C.length} access tokens to "${u}" in ${T}s!`))}catch(e){this.logger.error(i.red(`An error occurred while generating access tokens: ${e?.message||String(e)}`)),this.process.exit(1)}}export{l as generateAccessTokens};
2
- //# sourceMappingURL=impl-DbZ1cYoR.mjs.map
1
+ import{t as e}from"./readCsv-DLg8pwjd.mjs";import{a as t}from"./writeCsv-D-2siSwE.mjs";import{t as n}from"./done-input-validation-BUz-aVC5.mjs";import{SombraStandardScope as r}from"@transcend-io/privacy-types";import i from"colors";import*as a from"io-ts";import{buildTranscendGraphQLClient as o,createPreferenceAccessTokens as s}from"@transcend-io/sdk";import c from"cli-progress";async function l({auth:l,file:u,transcendUrl:d,duration:f,subjectType:p,emailColumnName:m,coreIdentifierColumnName:h}){n(this.process),this.fs.existsSync(u)||(this.logger.error(i.red(`File does not exist: "${u}". Please provide a valid path to a CSV file.`)),this.process.exit(1));try{let n=o(d,l),g=a.type({[m]:a.string,...h?{[h]:a.string}:{}}),_=e(this.fs.readFileSync(u,`utf8`),g);if(!_.length)throw Error(`Input CSV is empty.`);let v=_.map((e,t)=>[e,t]).filter(([e])=>!e[m]?.trim());if(v.length){let e=v.map(([,e])=>e+2).join(`, `);throw Error(`The following rows are missing the required "${m}" column: ${e}`)}if(h){let e=_.map((e,t)=>[e,t]).filter(([e])=>!e[h]?.trim());if(e.length){let t=e.map(([,e])=>e+2).join(`, `);throw Error(`The following rows are missing the required "${h}" column: ${t}`)}}let y=Math.max(1,Math.floor(f/1e3)),b=_.map((e,t)=>{let n=e[m].trim(),i=h?e[h]?.trim():void 0;return{subjectType:p,scopes:[r.PreferenceManagement],expiresIn:y,email:n,...i?{coreIdentifier:i}:{},index:t}}),x=new c.SingleBar({},c.Presets.shades_classic);x.start(b.length,0);let S=Date.now(),C=await s(n,{records:b,logger:this.logger,emitProgress:e=>{x.update(e)}});x.update(b.length),x.stop();let w=C.map(({accessToken:e,input:t})=>{if(typeof t.index!=`number`)throw Error(`Internal error: missing input index.`);return{..._[t.index],token:e}});this.logger.info(i.magenta(`Writing access tokens to file "${u}"...`)),await t(u,w,!0);let T=Math.round((Date.now()-S)/1e3);this.logger.info(i.green(`Successfully generated ${C.length} access tokens to "${u}" in ${T}s!`))}catch(e){this.logger.error(i.red(`An error occurred while generating access tokens: ${e?.message||String(e)}`)),this.process.exit(1)}}export{l as generateAccessTokens};
2
+ //# sourceMappingURL=impl-DqhZR11m.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DbZ1cYoR.mjs","names":[],"sources":["../src/commands/consent/generate-access-tokens/impl.ts"],"sourcesContent":["import { SombraStandardScope } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n createPreferenceAccessTokens,\n type PreferenceAccessTokenInputWithIndex,\n} from '@transcend-io/sdk';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\nimport * as t from 'io-ts';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { writeCsv } from '../../../lib/helpers/index.js';\nimport { parseCsv } from '../../../lib/requests/readCsv.js';\n\n/**\n * CLI flags accepted by the `generate-access-tokens` command.\n *\n * These are passed down from the CLI parser into the parent process.\n */\nexport type GenerateAccessTokenCommandFlags = {\n auth: string;\n file: string;\n duration: number;\n transcendUrl: string;\n subjectType: string;\n emailColumnName: string;\n coreIdentifierColumnName?: string;\n};\n\n/**\n * Take in a CSV of user identifiers and generate access tokens for each user.\n *\n * Expected CSV columns:\n * - [emailColumnName] (required)\n * - [coreIdentifierColumnName] (optional)\n *\n * @param this - Bound CLI context (provides process exit + logging).\n * @param flags - CLI options for the run.\n */\nexport async function generateAccessTokens(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n duration,\n subjectType,\n emailColumnName,\n coreIdentifierColumnName,\n }: GenerateAccessTokenCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n if (!this.fs.existsSync(file)) {\n this.logger.error(\n colors.red(`File does not exist: \"${file}\". Please provide a valid path to a CSV file.`),\n );\n this.process.exit(1);\n }\n\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read + parse CSV\n const codec = t.type({\n [emailColumnName]: t.string,\n ...(coreIdentifierColumnName ? { [coreIdentifierColumnName]: t.string } : {}),\n });\n const rows: Array<Record<string, string>> = parseCsv(this.fs.readFileSync(file, 'utf8'), codec);\n if (!rows.length) {\n throw new Error('Input CSV is empty.');\n }\n\n // Ensure emails and core identifiers exist\n const missingEmail = rows\n .map((r, i) => [r, i] as const)\n .filter(([r]) => !r[emailColumnName]?.trim());\n if (missingEmail.length) {\n const rowNumbers = missingEmail\n .map(([, i]) => i + 2) // +2 to account for header row and 0-indexing\n .join(', ');\n throw new Error(\n `The following rows are missing the required \"${emailColumnName}\" column: ${rowNumbers}`,\n );\n }\n if (coreIdentifierColumnName) {\n const missingCoreId = rows\n .map((r, i) => [r, i] as const)\n .filter(([r]) => !r[coreIdentifierColumnName]?.trim());\n if (missingCoreId.length) {\n const rowNumbers = missingCoreId\n .map(([, i]) => i + 2) // +2 to account for header row and 0-indexing\n .join(', ');\n throw new Error(\n `The following rows are missing the required \"${coreIdentifierColumnName}\" column: ${rowNumbers}`,\n );\n }\n }\n\n // Duration provided by CLI is in ms; GraphQL expects seconds\n const expiresInSeconds = Math.max(1, Math.floor(duration / 1000));\n\n // Build inputs for GraphQL\n const inputs = rows.map((r, index): PreferenceAccessTokenInputWithIndex => {\n const email = r[emailColumnName].trim();\n const coreIdentifier = coreIdentifierColumnName\n ? r[coreIdentifierColumnName]?.trim()\n : undefined;\n const scopes = [SombraStandardScope.PreferenceManagement];\n return {\n subjectType,\n scopes,\n expiresIn: expiresInSeconds,\n email,\n ...(coreIdentifier ? { coreIdentifier } : {}),\n index,\n };\n });\n\n // Progress bar\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n progressBar.start(inputs.length, 0);\n\n // Kick off token creation (batched internally)\n const t0 = Date.now();\n const results = await createPreferenceAccessTokens(client, {\n records: inputs,\n logger: this.logger,\n emitProgress: (progress) => {\n progressBar.update(progress);\n },\n });\n progressBar.update(inputs.length);\n progressBar.stop();\n\n // Prepare output CSV rows\n const outputRows = results.map(({ accessToken, input }) => {\n if (typeof input.index !== 'number') {\n throw new Error('Internal error: missing input index.');\n }\n return {\n ...rows[input.index],\n token: accessToken,\n };\n });\n\n this.logger.info(colors.magenta(`Writing access tokens to file \"${file}\"...`));\n await writeCsv(file, outputRows, true);\n\n const totalTimeSec = Math.round((Date.now() - t0) / 1000);\n this.logger.info(\n colors.green(\n `Successfully generated ${results.length} access tokens to \"${file}\" in ${totalTimeSec}s!`,\n ),\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (err: any) {\n this.logger.error(\n colors.red(\n `An error occurred while generating access tokens: ${err?.message || String(err)}`,\n ),\n );\n this.process.exit(1);\n }\n}\n"],"mappings":"8XAwCA,eAAsB,EAEpB,CACE,OACA,OACA,eACA,WACA,cACA,kBACA,4BAEa,CACf,EAAoB,KAAK,QAAQ,CAC5B,KAAK,GAAG,WAAW,EAAK,GAC3B,KAAK,OAAO,MACV,EAAO,IAAI,yBAAyB,EAAK,+CAA+C,CACzF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,GAAI,CAEF,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAQ,EAAE,KAAK,EAClB,GAAkB,EAAE,OACrB,GAAI,EAA2B,EAAG,GAA2B,EAAE,OAAQ,CAAG,EAAE,CAC7E,CAAC,CACI,EAAsC,EAAS,KAAK,GAAG,aAAa,EAAM,OAAO,CAAE,EAAM,CAC/F,GAAI,CAAC,EAAK,OACR,MAAU,MAAM,sBAAsB,CAIxC,IAAM,EAAe,EAClB,KAAK,EAAG,IAAM,CAAC,EAAG,EAAE,CAAU,CAC9B,QAAQ,CAAC,KAAO,CAAC,EAAE,IAAkB,MAAM,CAAC,CAC/C,GAAI,EAAa,OAAQ,CACvB,IAAM,EAAa,EAChB,KAAK,EAAG,KAAO,EAAI,EAAE,CACrB,KAAK,KAAK,CACb,MAAU,MACR,gDAAgD,EAAgB,YAAY,IAC7E,CAEH,GAAI,EAA0B,CAC5B,IAAM,EAAgB,EACnB,KAAK,EAAG,IAAM,CAAC,EAAG,EAAE,CAAU,CAC9B,QAAQ,CAAC,KAAO,CAAC,EAAE,IAA2B,MAAM,CAAC,CACxD,GAAI,EAAc,OAAQ,CACxB,IAAM,EAAa,EAChB,KAAK,EAAG,KAAO,EAAI,EAAE,CACrB,KAAK,KAAK,CACb,MAAU,MACR,gDAAgD,EAAyB,YAAY,IACtF,EAKL,IAAM,EAAmB,KAAK,IAAI,EAAG,KAAK,MAAM,EAAW,IAAK,CAAC,CAG3D,EAAS,EAAK,KAAK,EAAG,IAA+C,CACzE,IAAM,EAAQ,EAAE,GAAiB,MAAM,CACjC,EAAiB,EACnB,EAAE,IAA2B,MAAM,CACnC,IAAA,GAEJ,MAAO,CACL,cACA,OAAA,CAHc,EAAoB,qBAG5B,CACN,UAAW,EACX,QACA,GAAI,EAAiB,CAAE,iBAAgB,CAAG,EAAE,CAC5C,QACD,EACD,CAGI,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CACrF,EAAY,MAAM,EAAO,OAAQ,EAAE,CAGnC,IAAM,EAAK,KAAK,KAAK,CACf,EAAU,MAAM,EAA6B,EAAQ,CACzD,QAAS,EACT,OAAQ,KAAK,OACb,aAAe,GAAa,CAC1B,EAAY,OAAO,EAAS,EAE/B,CAAC,CACF,EAAY,OAAO,EAAO,OAAO,CACjC,EAAY,MAAM,CAGlB,IAAM,EAAa,EAAQ,KAAK,CAAE,cAAa,WAAY,CACzD,GAAI,OAAO,EAAM,OAAU,SACzB,MAAU,MAAM,uCAAuC,CAEzD,MAAO,CACL,GAAG,EAAK,EAAM,OACd,MAAO,EACR,EACD,CAEF,KAAK,OAAO,KAAK,EAAO,QAAQ,kCAAkC,EAAK,MAAM,CAAC,CAC9E,MAAM,EAAS,EAAM,EAAY,GAAK,CAEtC,IAAM,EAAe,KAAK,OAAO,KAAK,KAAK,CAAG,GAAM,IAAK,CACzD,KAAK,OAAO,KACV,EAAO,MACL,0BAA0B,EAAQ,OAAO,qBAAqB,EAAK,OAAO,EAAa,IACxF,CACF,OAEM,EAAU,CACjB,KAAK,OAAO,MACV,EAAO,IACL,qDAAqD,GAAK,SAAW,OAAO,EAAI,GACjF,CACF,CACD,KAAK,QAAQ,KAAK,EAAE"}
1
+ {"version":3,"file":"impl-DqhZR11m.mjs","names":[],"sources":["../src/commands/consent/generate-access-tokens/impl.ts"],"sourcesContent":["import { SombraStandardScope } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n createPreferenceAccessTokens,\n type PreferenceAccessTokenInputWithIndex,\n} from '@transcend-io/sdk';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\nimport * as t from 'io-ts';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { writeCsv } from '../../../lib/helpers/index.js';\nimport { parseCsv } from '../../../lib/requests/readCsv.js';\n\n/**\n * CLI flags accepted by the `generate-access-tokens` command.\n *\n * These are passed down from the CLI parser into the parent process.\n */\nexport type GenerateAccessTokenCommandFlags = {\n auth: string;\n file: string;\n duration: number;\n transcendUrl: string;\n subjectType: string;\n emailColumnName: string;\n coreIdentifierColumnName?: string;\n};\n\n/**\n * Take in a CSV of user identifiers and generate access tokens for each user.\n *\n * Expected CSV columns:\n * - [emailColumnName] (required)\n * - [coreIdentifierColumnName] (optional)\n *\n * @param this - Bound CLI context (provides process exit + logging).\n * @param flags - CLI options for the run.\n */\nexport async function generateAccessTokens(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n duration,\n subjectType,\n emailColumnName,\n coreIdentifierColumnName,\n }: GenerateAccessTokenCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n if (!this.fs.existsSync(file)) {\n this.logger.error(\n colors.red(`File does not exist: \"${file}\". Please provide a valid path to a CSV file.`),\n );\n this.process.exit(1);\n }\n\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read + parse CSV\n const codec = t.type({\n [emailColumnName]: t.string,\n ...(coreIdentifierColumnName ? { [coreIdentifierColumnName]: t.string } : {}),\n });\n const rows: Array<Record<string, string>> = parseCsv(this.fs.readFileSync(file, 'utf8'), codec);\n if (!rows.length) {\n throw new Error('Input CSV is empty.');\n }\n\n // Ensure emails and core identifiers exist\n const missingEmail = rows\n .map((r, i) => [r, i] as const)\n .filter(([r]) => !r[emailColumnName]?.trim());\n if (missingEmail.length) {\n const rowNumbers = missingEmail\n .map(([, i]) => i + 2) // +2 to account for header row and 0-indexing\n .join(', ');\n throw new Error(\n `The following rows are missing the required \"${emailColumnName}\" column: ${rowNumbers}`,\n );\n }\n if (coreIdentifierColumnName) {\n const missingCoreId = rows\n .map((r, i) => [r, i] as const)\n .filter(([r]) => !r[coreIdentifierColumnName]?.trim());\n if (missingCoreId.length) {\n const rowNumbers = missingCoreId\n .map(([, i]) => i + 2) // +2 to account for header row and 0-indexing\n .join(', ');\n throw new Error(\n `The following rows are missing the required \"${coreIdentifierColumnName}\" column: ${rowNumbers}`,\n );\n }\n }\n\n // Duration provided by CLI is in ms; GraphQL expects seconds\n const expiresInSeconds = Math.max(1, Math.floor(duration / 1000));\n\n // Build inputs for GraphQL\n const inputs = rows.map((r, index): PreferenceAccessTokenInputWithIndex => {\n const email = r[emailColumnName].trim();\n const coreIdentifier = coreIdentifierColumnName\n ? r[coreIdentifierColumnName]?.trim()\n : undefined;\n const scopes = [SombraStandardScope.PreferenceManagement];\n return {\n subjectType,\n scopes,\n expiresIn: expiresInSeconds,\n email,\n ...(coreIdentifier ? { coreIdentifier } : {}),\n index,\n };\n });\n\n // Progress bar\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n progressBar.start(inputs.length, 0);\n\n // Kick off token creation (batched internally)\n const t0 = Date.now();\n const results = await createPreferenceAccessTokens(client, {\n records: inputs,\n logger: this.logger,\n emitProgress: (progress) => {\n progressBar.update(progress);\n },\n });\n progressBar.update(inputs.length);\n progressBar.stop();\n\n // Prepare output CSV rows\n const outputRows = results.map(({ accessToken, input }) => {\n if (typeof input.index !== 'number') {\n throw new Error('Internal error: missing input index.');\n }\n return {\n ...rows[input.index],\n token: accessToken,\n };\n });\n\n this.logger.info(colors.magenta(`Writing access tokens to file \"${file}\"...`));\n await writeCsv(file, outputRows, true);\n\n const totalTimeSec = Math.round((Date.now() - t0) / 1000);\n this.logger.info(\n colors.green(\n `Successfully generated ${results.length} access tokens to \"${file}\" in ${totalTimeSec}s!`,\n ),\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (err: any) {\n this.logger.error(\n colors.red(\n `An error occurred while generating access tokens: ${err?.message || String(err)}`,\n ),\n );\n this.process.exit(1);\n }\n}\n"],"mappings":"8XAwCA,eAAsB,EAEpB,CACE,OACA,OACA,eACA,WACA,cACA,kBACA,4BAEa,CACf,EAAoB,KAAK,QAAQ,CAC5B,KAAK,GAAG,WAAW,EAAK,GAC3B,KAAK,OAAO,MACV,EAAO,IAAI,yBAAyB,EAAK,+CAA+C,CACzF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,GAAI,CAEF,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAQ,EAAE,KAAK,EAClB,GAAkB,EAAE,OACrB,GAAI,EAA2B,EAAG,GAA2B,EAAE,OAAQ,CAAG,EAAE,CAC7E,CAAC,CACI,EAAsC,EAAS,KAAK,GAAG,aAAa,EAAM,OAAO,CAAE,EAAM,CAC/F,GAAI,CAAC,EAAK,OACR,MAAU,MAAM,sBAAsB,CAIxC,IAAM,EAAe,EAClB,KAAK,EAAG,IAAM,CAAC,EAAG,EAAE,CAAU,CAC9B,QAAQ,CAAC,KAAO,CAAC,EAAE,IAAkB,MAAM,CAAC,CAC/C,GAAI,EAAa,OAAQ,CACvB,IAAM,EAAa,EAChB,KAAK,EAAG,KAAO,EAAI,EAAE,CACrB,KAAK,KAAK,CACb,MAAU,MACR,gDAAgD,EAAgB,YAAY,IAC7E,CAEH,GAAI,EAA0B,CAC5B,IAAM,EAAgB,EACnB,KAAK,EAAG,IAAM,CAAC,EAAG,EAAE,CAAU,CAC9B,QAAQ,CAAC,KAAO,CAAC,EAAE,IAA2B,MAAM,CAAC,CACxD,GAAI,EAAc,OAAQ,CACxB,IAAM,EAAa,EAChB,KAAK,EAAG,KAAO,EAAI,EAAE,CACrB,KAAK,KAAK,CACb,MAAU,MACR,gDAAgD,EAAyB,YAAY,IACtF,EAKL,IAAM,EAAmB,KAAK,IAAI,EAAG,KAAK,MAAM,EAAW,IAAK,CAAC,CAG3D,EAAS,EAAK,KAAK,EAAG,IAA+C,CACzE,IAAM,EAAQ,EAAE,GAAiB,MAAM,CACjC,EAAiB,EACnB,EAAE,IAA2B,MAAM,CACnC,IAAA,GAEJ,MAAO,CACL,cACA,OAAA,CAHc,EAAoB,qBAG5B,CACN,UAAW,EACX,QACA,GAAI,EAAiB,CAAE,iBAAgB,CAAG,EAAE,CAC5C,QACD,EACD,CAGI,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CACrF,EAAY,MAAM,EAAO,OAAQ,EAAE,CAGnC,IAAM,EAAK,KAAK,KAAK,CACf,EAAU,MAAM,EAA6B,EAAQ,CACzD,QAAS,EACT,OAAQ,KAAK,OACb,aAAe,GAAa,CAC1B,EAAY,OAAO,EAAS,EAE/B,CAAC,CACF,EAAY,OAAO,EAAO,OAAO,CACjC,EAAY,MAAM,CAGlB,IAAM,EAAa,EAAQ,KAAK,CAAE,cAAa,WAAY,CACzD,GAAI,OAAO,EAAM,OAAU,SACzB,MAAU,MAAM,uCAAuC,CAEzD,MAAO,CACL,GAAG,EAAK,EAAM,OACd,MAAO,EACR,EACD,CAEF,KAAK,OAAO,KAAK,EAAO,QAAQ,kCAAkC,EAAK,MAAM,CAAC,CAC9E,MAAM,EAAS,EAAM,EAAY,GAAK,CAEtC,IAAM,EAAe,KAAK,OAAO,KAAK,KAAK,CAAG,GAAM,IAAK,CACzD,KAAK,OAAO,KACV,EAAO,MACL,0BAA0B,EAAQ,OAAO,qBAAqB,EAAK,OAAO,EAAa,IACxF,CACF,OAEM,EAAU,CACjB,KAAK,OAAO,MACV,EAAO,IACL,qDAAqD,GAAK,SAAW,OAAO,EAAI,GACjF,CACF,CACD,KAAK,QAAQ,KAAK,EAAE"}
@@ -1,4 +1,4 @@
1
- import"./enums-OiLcZ26O.mjs";import{t as e}from"./logger-9T6vva73.mjs";import{t}from"./done-input-validation-Cjk7a3jX.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 l,{createReadStream as u}from"node:fs";import d from"got";import f from"colors";import{decodeCodec as p}from"@transcend-io/type-utils";import{IMPORT_ONE_TRUST_ASSESSMENT_FORMS as m,buildTranscendGraphQLClient as h,makeGraphQLRequest as g}from"@transcend-io/sdk";import{map as _,mapSeries as v}from"@transcend-io/utils";import y from"JSONStream";const b=({assessment:e,index:t,total:n,wrap:r=!0})=>{let i=``;(t===0||r)&&(i=`[
1
+ import"./enums-OiLcZ26O.mjs";import{t as e}from"./logger-zplFSeXU.mjs";import{t}from"./done-input-validation-BUz-aVC5.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 l,{createReadStream as u}from"node:fs";import d from"got";import f from"colors";import{decodeCodec as p}from"@transcend-io/type-utils";import{IMPORT_ONE_TRUST_ASSESSMENT_FORMS as m,buildTranscendGraphQLClient as h,makeGraphQLRequest as g}from"@transcend-io/sdk";import{map as _,mapSeries as v}from"@transcend-io/utils";import y from"JSONStream";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?l.writeFileSync(t,b({assessment:n,index:r,total:i,wrap:!1})):l.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:l}=p(i,s);o.push(...l??[]),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 p(r,n)},w=async({oneTrust:e,riskId:t})=>{let{body:n}=await e.get(`api/risk/v2/risks/${t}`);return p(a,n)},T=async({oneTrust:e,userId:t})=>{let{body:n}=await e.get(`api/scim/v2/Users/${t}`);return p(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 g(t,m,{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 v(Array.from({length:Math.ceil(a.length/5)},(e,t)=>a.slice(t*5,(t+1)*5)),async(s,l)=>{let u=[];await _(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:g}=p,v=[];g.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 _(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 _(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 v(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=u(r,{encoding:`utf-8`,highWaterMark:64*1024}),s=y.parse(`*`),c=0;o.pipe(s),s.on(`data`,async i=>{try{s.pause(),await D({assessment:p(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})=>d.extend({prefixUrl:`https://${e}`,headers:{accept:`application/json`,"content-type":`application/json`,authorization:`Bearer ${t}`}});async function j({hostname:e,oneTrustAuth:n,source:r,transcendAuth:i,transcendUrl:a,resource:o,file:s,dryRun:c,debug:l}){if(!c&&!i)throw Error('Must specify a "transcendAuth" parameter to sync resources to Transcend. e.g. --transcendAuth=${TRANSCEND_API_KEY}');if(c&&!s)throw Error(`Must set a "file" parameter when "dryRun" is "true". e.g. --file=./oneTrustAssessments.json`);if(s){let e=s.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 '${s}' to be 'json', but got '${e.at(-1)}'.`)}if(r===`oneTrust`){if(!e)throw Error(`Missing required parameter "hostname". e.g. --hostname=customer.my.onetrust.com`);if(!n)throw Error(`Missing required parameter "oneTrustAuth". e.g. --oneTrustAuth=$ONE_TRUST_AUTH_TOKEN`)}else{if(!s)throw Error(`Must specify a "file" parameter to read the OneTrust assessments from. e.g. --source=./oneTrustAssessments.json`);if(c)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);let u=e&&n?A({hostname:e,auth:n}):void 0,d=a&&i?h(a,i):void 0;try{o===`assessments`&&(r===`oneTrust`&&u?await O({oneTrust:u,file:s,dryRun:c,...d&&{transcend:d}}):r===`file`&&s&&d&&await k({file:s,transcend:d}))}catch(e){throw Error(`An error occurred syncing the resource ${o} from OneTrust: ${l?e.stack:e.message}`)}this.logger.info(f.green(`Successfully synced OneTrust ${o} to ${c?`disk at "${s}"`:`Transcend`}!`))}export{j as syncOt};
4
- //# sourceMappingURL=impl-VPBEqV0w2.mjs.map
4
+ //# sourceMappingURL=impl-Dqqb0lVN.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl-Dqqb0lVN.mjs","names":[],"sources":["../src/lib/oneTrust/helpers/oneTrustAssessmentToJson.ts","../src/lib/oneTrust/helpers/syncOneTrustAssessmentToDisk.ts","../src/lib/oneTrust/endpoints/getListOfOneTrustAssessments.ts","../src/lib/oneTrust/endpoints/getOneTrustAssessment.ts","../src/lib/oneTrust/endpoints/getOneTrustRisk.ts","../src/lib/oneTrust/endpoints/getOneTrustUser.ts","../src/lib/oneTrust/helpers/enrichOneTrustAssessment.ts","../src/lib/oneTrust/helpers/syncOneTrustAssessmentToTranscend.ts","../src/lib/oneTrust/helpers/syncOneTrustAssessmentsFromOneTrust.ts","../src/lib/oneTrust/helpers/syncOneTrustAssessmentsFromFile.ts","../src/lib/oneTrust/createOneTrustGotInstance.ts","../src/commands/migration/sync-ot/impl.ts"],"sourcesContent":["import { OneTrustEnrichedAssessment } from '@transcend-io/privacy-types';\n\n/**\n * Converts the assessment into a json entry.\n *\n * @param param - information about the assessment and amount of entries\n * @returns a stringified json entry ready to be appended to a file\n */\nexport const oneTrustAssessmentToJson = ({\n assessment,\n index,\n total,\n wrap = true,\n}: {\n /** The assessment to convert */\n assessment: OneTrustEnrichedAssessment;\n /** The position of the assessment in the final Json object */\n index: number;\n /** The total amount of the assessments in the final Json object */\n total?: number;\n /** Whether to wrap every entry in brackets */\n wrap?: boolean;\n}): string => {\n let jsonEntry = '';\n // start with an opening bracket\n if (index === 0 || wrap) {\n jsonEntry = '[\\n';\n }\n\n const stringifiedAssessment = JSON.stringify(assessment);\n\n // Add comma for all items except the last one\n const comma = total && index < total - 1 && !wrap ? ',' : '';\n\n // write to file\n jsonEntry = `${jsonEntry + stringifiedAssessment + comma}\\n`;\n\n // end with closing bracket\n if ((total && index === total - 1) || wrap) {\n jsonEntry += '\\n]';\n }\n\n return jsonEntry;\n};\n","import fs from 'node:fs';\n\nimport { OneTrustEnrichedAssessment } from '@transcend-io/privacy-types';\nimport colors from 'colors';\n\nimport { logger } from '../../../logger.js';\nimport { oneTrustAssessmentToJson } from './oneTrustAssessmentToJson.js';\n\n/**\n * Write the assessment to disk at the specified file path.\n *\n *\n * @param param - information about the assessment to write\n */\nexport const syncOneTrustAssessmentToDisk = ({\n file,\n assessment,\n index,\n total,\n}: {\n /** The file path to write the assessment to */\n file: string;\n /** The basic assessment */\n assessment: OneTrustEnrichedAssessment;\n /** The index of the assessment being written to the file */\n index: number;\n /** The total amount of assessments that we will write */\n total: number;\n}): void => {\n logger.info(\n colors.magenta(`Writing enriched assessment ${index + 1} of ${total} to file \"${file}\"...`),\n );\n\n if (index === 0) {\n fs.writeFileSync(\n file,\n oneTrustAssessmentToJson({\n assessment,\n index,\n total,\n wrap: false,\n }),\n );\n } else {\n fs.appendFileSync(\n file,\n oneTrustAssessmentToJson({\n assessment,\n index,\n total,\n wrap: false,\n }),\n );\n }\n};\n","import {\n OneTrustAssessment,\n OneTrustGetListOfAssessmentsResponse,\n} from '@transcend-io/privacy-types';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport { Got } from 'got';\n\nimport { logger } from '../../../logger.js';\n\n/**\n * Fetch a list of all assessments from the OneTrust client.\n * ref: https://developer.onetrust.com/onetrust/reference/getallassessmentbasicdetailsusingget\n *\n * @param param - the information about the OneTrust client\n * @returns a list of OneTrustAssessment\n */\nexport const getListOfOneTrustAssessments = async ({\n oneTrust,\n}: {\n /** The OneTrust client instance */\n oneTrust: Got;\n}): Promise<OneTrustAssessment[]> => {\n let currentPage = 0;\n let totalPages = 1;\n let totalElements = 0;\n\n const allAssessments: OneTrustAssessment[] = [];\n\n while (currentPage < totalPages) {\n const { body } = await oneTrust.get(\n `api/assessment/v2/assessments?page=${currentPage}&size=2000`,\n );\n\n const { page, content } = decodeCodec(OneTrustGetListOfAssessmentsResponse, body);\n allAssessments.push(...(content ?? []));\n if (currentPage === 0) {\n totalPages = page?.totalPages ?? 0;\n totalElements = page?.totalElements ?? 0;\n }\n currentPage += 1;\n\n // log progress\n logger.info(`Fetched ${allAssessments.length} of ${totalElements} assessments.`);\n }\n\n return allAssessments;\n};\n","import { OneTrustGetAssessmentResponse } from '@transcend-io/privacy-types';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport { Got } from 'got';\n\n/**\n * Retrieve details about a particular assessment.\n * ref: https://developer.onetrust.com/onetrust/reference/exportassessmentusingget\n *\n * @param param - the information about the OneTrust client and assessment to retrieve\n * @returns details about the assessment\n */\nexport const getOneTrustAssessment = async ({\n oneTrust,\n assessmentId,\n}: {\n /** The OneTrust client instance */\n oneTrust: Got;\n /** The ID of the assessment to retrieve */\n assessmentId: string;\n}): Promise<OneTrustGetAssessmentResponse> => {\n const { body } = await oneTrust.get(\n `api/assessment/v2/assessments/${assessmentId}/export?ExcludeSkippedQuestions=false`,\n );\n\n return decodeCodec(OneTrustGetAssessmentResponse, body);\n};\n","import { OneTrustGetRiskResponse } from '@transcend-io/privacy-types';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport { Got } from 'got';\n\n/**\n * Retrieve details about a particular risk.\n * ref: https://developer.onetrust.com/onetrust/reference/getriskusingget\n *\n * @param param - the information about the OneTrust client and risk to retrieve\n * @returns the OneTrust risk\n */\nexport const getOneTrustRisk = async ({\n oneTrust,\n riskId,\n}: {\n /** The OneTrust client instance */\n oneTrust: Got;\n /** The ID of the OneTrust risk to retrieve */\n riskId: string;\n}): Promise<OneTrustGetRiskResponse> => {\n const { body } = await oneTrust.get(`api/risk/v2/risks/${riskId}`);\n\n return decodeCodec(OneTrustGetRiskResponse, body);\n};\n","import { OneTrustGetUserResponse } from '@transcend-io/privacy-types';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport { Got } from 'got';\n\n/**\n * Retrieve details about a particular user.\n * ref: https://developer.onetrust.com/onetrust/reference/getriskusingget\n *\n * @param param - the information about the OneTrust client and risk to retrieve\n * @returns the OneTrust risk\n */\nexport const getOneTrustUser = async ({\n oneTrust,\n userId,\n}: {\n /** The OneTrust client instance */\n oneTrust: Got;\n /** The ID of the OneTrust user to retrieve */\n userId: string;\n}): Promise<OneTrustGetUserResponse> => {\n const { body } = await oneTrust.get(`api/scim/v2/Users/${userId}`);\n\n return decodeCodec(OneTrustGetUserResponse, body);\n};\n","import {\n OneTrustAssessment,\n OneTrustEnrichedAssessment,\n OneTrustGetAssessmentResponse,\n OneTrustGetRiskResponse,\n OneTrustGetUserResponse,\n} from '@transcend-io/privacy-types';\nimport { keyBy } from 'lodash-es';\n\n/**\n * Merge the assessment, assessmentDetails, and riskDetails into one object.\n *\n * @param param - the assessment and risk information\n * @returns the assessment enriched with details and risk information\n */\nexport const enrichOneTrustAssessment = ({\n assessment,\n assessmentDetails,\n riskDetails,\n creatorDetails,\n approversDetails,\n respondentsDetails,\n}: {\n /** The OneTrust risk details */\n riskDetails: OneTrustGetRiskResponse[];\n /** The OneTrust assessment as returned from Get List of Assessments endpoint */\n assessment: OneTrustAssessment;\n /** The OneTrust assessment details */\n assessmentDetails: OneTrustGetAssessmentResponse;\n /** The OneTrust assessment creator details */\n creatorDetails: OneTrustGetUserResponse;\n /** The OneTrust assessment approvers details */\n approversDetails: OneTrustGetUserResponse[];\n /** The OneTrust assessment internal respondents details */\n respondentsDetails: OneTrustGetUserResponse[];\n}): OneTrustEnrichedAssessment => {\n const riskDetailsById = keyBy(riskDetails, 'id');\n const { sections, createdBy, ...restAssessmentDetails } = assessmentDetails;\n const sectionsWithEnrichedRisk = sections.map((section) => {\n const { questions, ...restSection } = section;\n const enrichedQuestions = questions.map((question) => {\n const { risks, ...restQuestion } = question;\n const enrichedRisks = (risks ?? []).map((risk) => {\n const details = riskDetailsById[risk.riskId];\n return {\n ...risk,\n ...details,\n level: risk.level,\n impactLevel: risk.impactLevel ?? 0,\n };\n });\n return {\n ...restQuestion,\n risks: enrichedRisks,\n };\n });\n return {\n ...restSection,\n questions: enrichedQuestions,\n };\n });\n\n // grab creator details\n const enrichedCreatedBy = {\n ...createdBy,\n active: creatorDetails?.active ?? false,\n userType: creatorDetails?.userType ?? 'Internal',\n emails: creatorDetails?.emails ?? [],\n title: creatorDetails?.title ?? null,\n givenName: creatorDetails?.name.givenName ?? null,\n familyName: creatorDetails?.name.familyName ?? null,\n };\n\n // grab approvers details\n const approverDetailsById = keyBy(approversDetails, 'id');\n const enrichedApprovers = assessmentDetails.approvers.flatMap((originalApprover) =>\n approverDetailsById[originalApprover.id]\n ? [\n {\n ...originalApprover,\n approver: {\n ...originalApprover.approver,\n active: approverDetailsById[originalApprover.id].active,\n userType: approverDetailsById[originalApprover.id].userType,\n emails: approverDetailsById[originalApprover.id].emails,\n title: approverDetailsById[originalApprover.id].title,\n givenName: approverDetailsById[originalApprover.id].name.givenName ?? null,\n familyName: approverDetailsById[originalApprover.id].name.familyName ?? null,\n },\n },\n ]\n : [],\n );\n\n // grab respondents details\n const respondentsDetailsById = keyBy(respondentsDetails, 'id');\n const enrichedRespondents = assessmentDetails.respondents\n .filter((r) => !r.name.includes('@')) // search only internal respondents\n .flatMap((respondent) =>\n respondentsDetailsById[respondent.id]\n ? [\n {\n ...respondent,\n active: respondentsDetailsById[respondent.id].active,\n userType: respondentsDetailsById[respondent.id].userType,\n emails: respondentsDetailsById[respondent.id].emails,\n title: respondentsDetailsById[respondent.id].title,\n givenName: respondentsDetailsById[respondent.id].name.givenName ?? null,\n familyName: respondentsDetailsById[respondent.id].name.familyName ?? null,\n },\n ]\n : [],\n );\n\n // combine everything into a single enriched assessment\n return {\n ...assessment,\n ...restAssessmentDetails,\n approvers: enrichedApprovers,\n respondents: enrichedRespondents,\n createdBy: enrichedCreatedBy,\n sections: sectionsWithEnrichedRisk,\n };\n};\n","import { OneTrustEnrichedAssessment } from '@transcend-io/privacy-types';\nimport { makeGraphQLRequest, IMPORT_ONE_TRUST_ASSESSMENT_FORMS } from '@transcend-io/sdk';\nimport colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\n\nimport { ImportOnetrustAssessmentsInput } from '../../../codecs.js';\nimport { logger } from '../../../logger.js';\nimport { oneTrustAssessmentToJson } from './oneTrustAssessmentToJson.js';\n\nexport interface AssessmentForm {\n /** ID of Assessment Form */\n id: string;\n /** Title of Assessment Form */\n name: string;\n}\n\n/**\n * Write the assessment to a Transcend instance.\n *\n *\n * @param param - information about the assessment and Transcend instance to write to\n */\nexport const syncOneTrustAssessmentToTranscend = async ({\n transcend,\n assessment,\n total,\n index,\n}: {\n /** the Transcend client instance */\n transcend: GraphQLClient;\n /** the assessment to sync to Transcend */\n assessment: OneTrustEnrichedAssessment;\n /** The index of the assessment being written to the file */\n index: number;\n /** The total amount of assessments that we will write */\n total?: number;\n}): Promise<void> => {\n logger.info(\n colors.magenta(\n `Writing enriched assessment ${index + 1} ${total ? `of ${total} ` : ' '}to Transcend...`,\n ),\n );\n\n // convert the OneTrust assessment object into a json record\n const json = oneTrustAssessmentToJson({\n assessment,\n index,\n total,\n });\n\n // transform the json record into a valid input to the mutation\n const input: ImportOnetrustAssessmentsInput = {\n json,\n };\n\n try {\n await makeGraphQLRequest<{\n /** the importOneTrustAssessmentForms mutation */\n importOneTrustAssessmentForms: {\n /** Created Assessment Forms */\n assessmentForms: AssessmentForm[];\n };\n }>(transcend, IMPORT_ONE_TRUST_ASSESSMENT_FORMS, {\n variables: { input },\n logger,\n });\n } catch (error) {\n logger.error(\n colors.red(\n `Failed to sync assessment ${index + 1} ${total ? `of ${total} ` : ' '}to Transcend.\\n` +\n `\\tAssessment Title: ${assessment.name}. Template Title: ${assessment.template.name}\\n`,\n ),\n error,\n );\n }\n};\n","import {\n OneTrustAssessmentQuestion,\n OneTrustAssessmentSection,\n OneTrustEnrichedAssessment,\n OneTrustGetRiskResponse,\n OneTrustGetUserResponse,\n} from '@transcend-io/privacy-types';\nimport { mapSeries, map } from '@transcend-io/utils';\nimport colors from 'colors';\nimport type { Got } from 'got';\nimport { GraphQLClient } from 'graphql-request';\nimport { uniq } from 'lodash-es';\n\nimport { logger } from '../../../logger.js';\nimport {\n getListOfOneTrustAssessments,\n getOneTrustAssessment,\n getOneTrustRisk,\n getOneTrustUser,\n} from '../endpoints/index.js';\nimport { enrichOneTrustAssessment } from './enrichOneTrustAssessment.js';\nimport { syncOneTrustAssessmentToDisk } from './syncOneTrustAssessmentToDisk.js';\nimport { syncOneTrustAssessmentToTranscend } from './syncOneTrustAssessmentToTranscend.js';\n\nexport interface AssessmentForm {\n /** ID of Assessment Form */\n id: string;\n /** Title of Assessment Form */\n name: string;\n}\n\n/**\n * Reads all the assessments from a OneTrust instance and syncs them to Transcend or to Disk.\n *\n * @param param - the information about the assessment, its OneTrust source, and destination (disk or Transcend)\n */\nexport const syncOneTrustAssessmentsFromOneTrust = async ({\n oneTrust,\n file,\n dryRun,\n transcend,\n}: {\n /** the OneTrust client instance */\n oneTrust: Got;\n /** the Transcend client instance */\n transcend?: GraphQLClient;\n /** Whether to write to file instead of syncing to Transcend */\n dryRun: boolean;\n /** the path to the file in case dryRun is true */\n file?: string;\n}): Promise<void> => {\n // fetch the list of all assessments in the OneTrust organization\n logger.info('Getting list of all assessments from OneTrust...');\n const assessments = await getListOfOneTrustAssessments({ oneTrust });\n\n // a cache of OneTrust users so we avoid requesting already fetched users\n const oneTrustCachedUsers: Record<string, OneTrustGetUserResponse> = {};\n\n // split all assessments in batches, so we can process some of steps in parallel\n const BATCH_SIZE = 5;\n const assessmentBatches = Array.from(\n {\n length: Math.ceil(assessments.length / BATCH_SIZE),\n },\n (_, i) => assessments.slice(i * BATCH_SIZE, (i + 1) * BATCH_SIZE),\n );\n\n // process each batch and sync the batch right away so it's garbage collected and we don't run out of memory\n await mapSeries(assessmentBatches, async (assessmentBatch, batch) => {\n const batchEnrichedAssessments: OneTrustEnrichedAssessment[] = [];\n\n // fetch assessment details from OneTrust in parallel\n await map(\n assessmentBatch,\n async (assessment, index) => {\n const assessmentNumber = BATCH_SIZE * batch + index + 1;\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching details...`,\n );\n const { templateName, assessmentId } = assessment;\n const assessmentDetails = await getOneTrustAssessment({\n oneTrust,\n assessmentId,\n });\n // fetch assessment's creator information\n const creatorId = assessmentDetails.createdBy.id;\n let creator = oneTrustCachedUsers[creatorId];\n if (!creator) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching creator...`,\n );\n try {\n creator = await getOneTrustUser({\n oneTrust,\n userId: creatorId,\n });\n oneTrustCachedUsers[creatorId] = creator;\n } catch (error) {\n logger.warn(\n colors.yellow(\n `[assessment ${assessmentNumber} of ${assessments.length}]: failed to fetch form creator.` +\n `\\tcreatorId: ${creatorId}. Assessment Title: ${assessment.name}. Template Title: ${templateName}`,\n ),\n error,\n );\n }\n }\n\n // fetch assessment approvers information\n const { approvers } = assessmentDetails;\n let approversDetails: OneTrustGetUserResponse[][] = [];\n if (approvers.length > 0) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching approvers...`,\n );\n approversDetails = await map(\n approvers.map(({ id }) => id),\n async (userId) => {\n try {\n let approver = oneTrustCachedUsers[userId];\n if (!approver) {\n approver = await getOneTrustUser({ oneTrust, userId });\n oneTrustCachedUsers[userId] = approver;\n }\n return [approver];\n } catch (error) {\n logger.warn(\n colors.yellow(\n `[assessment ${assessmentNumber} of ${assessments.length}]: failed to fetch a form approver.` +\n `\\tapproverId: ${userId}. Assessment Title: ${assessment.name}. Template Title: ${templateName}`,\n ),\n error,\n );\n return [];\n }\n },\n { concurrency: 5 },\n );\n }\n\n // fetch assessment internal respondents information\n const { respondents } = assessmentDetails;\n // if a user is an internal respondents, their 'name' field can't be an email.\n const internalRespondents = respondents.filter((r) => !r.name.includes('@'));\n let respondentsDetails: OneTrustGetUserResponse[][] = [];\n if (internalRespondents.length > 0) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching respondents...`,\n );\n respondentsDetails = await map(\n internalRespondents.map(({ id }) => id),\n async (userId) => {\n try {\n let respondent = oneTrustCachedUsers[userId];\n if (!respondent) {\n respondent = await getOneTrustUser({ oneTrust, userId });\n oneTrustCachedUsers[userId] = respondent;\n }\n return [respondent];\n } catch (error) {\n logger.warn(\n colors.yellow(\n `[assessment ${assessmentNumber} of ${assessments.length}]: failed to fetch a respondent.` +\n `\\trespondentId: ${userId}. Assessment Title: ${assessment.name}. Template Title: ${templateName}`,\n ),\n error,\n );\n return [];\n }\n },\n { concurrency: 5 },\n );\n }\n\n // fetch assessment risk information\n let riskDetails: OneTrustGetRiskResponse[] = [];\n const riskIds = uniq(\n assessmentDetails.sections.flatMap((s: OneTrustAssessmentSection) =>\n s.questions.flatMap((q: OneTrustAssessmentQuestion) =>\n (q.risks ?? []).flatMap((r) => r.riskId),\n ),\n ),\n );\n if (riskIds.length > 0) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching risks...`,\n );\n riskDetails = await map(\n riskIds,\n (riskId) => getOneTrustRisk({ oneTrust, riskId: riskId as string }),\n {\n concurrency: 5,\n },\n );\n }\n\n // enrich the assessments with user and risk details\n const enrichedAssessment = enrichOneTrustAssessment({\n assessment,\n assessmentDetails,\n riskDetails,\n creatorDetails: creator,\n approversDetails: approversDetails.flat(),\n respondentsDetails: respondentsDetails.flat(),\n });\n\n batchEnrichedAssessments.push(enrichedAssessment);\n },\n { concurrency: BATCH_SIZE },\n );\n\n // sync assessments in series to avoid concurrency bugs\n await mapSeries(batchEnrichedAssessments, async (enrichedAssessment, index) => {\n // the assessment's global index takes its batch into consideration\n const globalIndex = batch * BATCH_SIZE + index;\n\n if (dryRun && file) {\n // sync to file\n syncOneTrustAssessmentToDisk({\n assessment: enrichedAssessment,\n index: globalIndex,\n total: assessments.length,\n file,\n });\n } else if (transcend) {\n // sync to transcend\n await syncOneTrustAssessmentToTranscend({\n assessment: enrichedAssessment,\n transcend,\n total: assessments.length,\n index: globalIndex,\n });\n }\n });\n });\n};\n","import { createReadStream } from 'node:fs';\n\nimport { OneTrustEnrichedAssessment } from '@transcend-io/privacy-types';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport JSONStream from 'JSONStream';\n\nimport { logger } from '../../../logger.js';\nimport { syncOneTrustAssessmentToTranscend } from './syncOneTrustAssessmentToTranscend.js';\n\n/**\n * Reads assessments from a file and syncs them to Transcend.\n *\n * @param param - the information about the source file and Transcend instance to write them to.\n */\nexport const syncOneTrustAssessmentsFromFile = ({\n transcend,\n file,\n}: {\n /** the Transcend client instance */\n transcend: GraphQLClient;\n /** The name of the file from which to read the OneTrust assessments */\n file: string;\n}): Promise<void> => {\n logger.info(`Getting list of all assessments from file ${file}...`);\n\n return new Promise((resolve, reject) => {\n // Create a readable stream from the file\n const fileStream = createReadStream(file, {\n encoding: 'utf-8',\n highWaterMark: 64 * 1024, // 64KB chunks\n });\n\n // Create a JSONStream parser to parse the array of OneTrust assessments from the file\n const parser = JSONStream.parse('*'); // '*' matches each element in the root array\n\n let index = 0;\n\n // Pipe the file stream into the JSON parser\n fileStream.pipe(parser);\n\n // Handle each parsed assessment object\n parser.on('data', async (assessment) => {\n try {\n // Pause the stream while processing to avoid overwhelming memory\n parser.pause();\n\n // Decode and validate the assessment\n const parsedAssessment = decodeCodec(OneTrustEnrichedAssessment, assessment);\n\n // Sync the assessment to transcend\n await syncOneTrustAssessmentToTranscend({\n assessment: parsedAssessment,\n transcend,\n index,\n });\n\n index += 1;\n\n // Resume the stream after processing\n parser.resume();\n } catch (e) {\n // if failed to parse a line, report error and continue\n logger.error(\n colors.red(`Failed to parse the assessment ${index} from file '${file}': ${e.message}.`),\n );\n }\n });\n\n // Handle completion\n parser.on('end', () => {\n logger.info(`Finished processing ${index} assessments from file ${file}`);\n resolve();\n });\n\n // Handle stream or parsing errors\n parser.on('error', (error) => {\n logger.error(colors.red(`Error parsing file '${file}': ${error.message}`));\n reject(error);\n });\n\n fileStream.on('error', (error) => {\n logger.error(colors.red(`Error reading file '${file}': ${error.message}`));\n reject(error);\n });\n });\n};\n","import got, { Got } from 'got';\n\n/**\n * Instantiate an instance of got that is capable of making requests to OneTrust\n *\n * @param param - information about the OneTrust URL\n * @returns The instance of got that is capable of making requests to the customer ingress\n */\nexport const createOneTrustGotInstance = ({\n hostname,\n auth,\n}: {\n /** Hostname of the OneTrust API */\n hostname: string;\n /** The OAuth access token */\n auth: string;\n}): Got =>\n got.extend({\n prefixUrl: `https://${hostname}`,\n headers: {\n accept: 'application/json',\n 'content-type': 'application/json',\n authorization: `Bearer ${auth}`,\n },\n });\n","import { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { OneTrustFileFormat, OneTrustPullResource, OneTrustPullSource } from '../../../enums.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport {\n syncOneTrustAssessmentsFromFile,\n syncOneTrustAssessmentsFromOneTrust,\n} from '../../../lib/oneTrust/helpers/index.js';\nimport { createOneTrustGotInstance } from '../../../lib/oneTrust/index.js';\n\n// Command flag interface\nexport interface SyncOtCommandFlags {\n hostname?: string;\n oneTrustAuth?: string;\n source: OneTrustPullSource;\n transcendAuth?: string;\n transcendUrl: string;\n file?: string;\n resource: OneTrustPullResource;\n dryRun: boolean;\n debug: boolean;\n}\n\n// Command implementation\nexport async function syncOt(\n this: LocalContext,\n {\n hostname,\n oneTrustAuth,\n source,\n transcendAuth,\n transcendUrl,\n resource,\n file,\n dryRun,\n debug,\n }: SyncOtCommandFlags,\n): Promise<void> {\n // Must be able to authenticate to transcend to sync resources to it\n if (!dryRun && !transcendAuth) {\n throw new Error(\n // eslint-disable-next-line no-template-curly-in-string\n 'Must specify a \"transcendAuth\" parameter to sync resources to Transcend. e.g. --transcendAuth=${TRANSCEND_API_KEY}',\n );\n }\n\n // If trying to sync to disk, must specify a file path\n if (dryRun && !file) {\n throw new Error(\n 'Must set a \"file\" parameter when \"dryRun\" is \"true\". e.g. --file=./oneTrustAssessments.json',\n );\n }\n\n if (file) {\n const splitFile = file.split('.');\n if (splitFile.length < 2) {\n throw new Error(\n 'The \"file\" parameter has an invalid format. Expected a path with extensions. e.g. --file=./pathToFile.json.',\n );\n }\n if (splitFile.at(-1) !== OneTrustFileFormat.Json) {\n throw new Error(\n `Expected the format of the \"file\" parameters '${file}' to be '${\n OneTrustFileFormat.Json\n }', but got '${splitFile.at(-1)}'.`,\n );\n }\n }\n\n // if reading assessments from a OneTrust\n if (source === OneTrustPullSource.OneTrust) {\n // must specify the OneTrust hostname\n if (!hostname) {\n throw new Error(\n 'Missing required parameter \"hostname\". e.g. --hostname=customer.my.onetrust.com',\n );\n }\n // must specify the OneTrust auth\n if (!oneTrustAuth) {\n throw new Error(\n 'Missing required parameter \"oneTrustAuth\". e.g. --oneTrustAuth=$ONE_TRUST_AUTH_TOKEN',\n );\n }\n } else {\n // if reading the assessments from a file, must specify a file to read from\n if (!file) {\n throw new Error(\n 'Must specify a \"file\" parameter to read the OneTrust assessments from. e.g. --source=./oneTrustAssessments.json',\n );\n }\n\n // Cannot try reading from file and save assessments to a file simultaneously\n if (dryRun) {\n throw new Error(\n 'Cannot read and write to a file simultaneously.' +\n ` Emit the \"source\" parameter or set it to ${OneTrustPullSource.OneTrust} if \"dryRun\" is enabled.`,\n );\n }\n }\n\n doneInputValidation(this.process);\n\n // instantiate a client to talk to OneTrust\n const oneTrust =\n hostname && oneTrustAuth\n ? createOneTrustGotInstance({\n hostname,\n auth: oneTrustAuth,\n })\n : undefined;\n\n // instantiate a client to talk to Transcend\n const transcend =\n transcendUrl && transcendAuth\n ? buildTranscendGraphQLClient(transcendUrl, transcendAuth)\n : undefined;\n\n try {\n if (resource === OneTrustPullResource.Assessments) {\n if (source === OneTrustPullSource.OneTrust && oneTrust) {\n await syncOneTrustAssessmentsFromOneTrust({\n oneTrust,\n file,\n dryRun,\n ...(transcend && { transcend }),\n });\n } else if (source === OneTrustPullSource.File && file && transcend) {\n await syncOneTrustAssessmentsFromFile({ file, transcend });\n }\n }\n } catch (err) {\n throw new Error(\n `An error occurred syncing the resource ${resource} from OneTrust: ${\n debug ? err.stack : err.message\n }`,\n );\n }\n\n // Indicate success\n this.logger.info(\n colors.green(\n `Successfully synced OneTrust ${resource} to ${dryRun ? `disk at \"${file}\"` : 'Transcend'}!`,\n ),\n );\n}\n"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import{n as e,r as t}from"./runOpa-CkKAwsvB.mjs";import{t as n}from"./done-input-validation-Cjk7a3jX.mjs";import r from"node:path";import i from"colors";async function a({pkg:a,input:o,bundle:s}){n(this.process),t();let c=r.resolve(o);if(!this.fs.existsSync(c))throw Error(`Input file not found: ${c}`);let l=[`eval`,`--format`,`pretty`,`--input`,c];s&&l.push(`-b`,r.resolve(s)),l.push(a),this.logger.info(i.green(`Evaluating ${a} with input ${c}...`));let u=await e(l);u!==0&&this.process.exit(u)}export{a as _eval};
2
- //# sourceMappingURL=impl-6m7GXUAe.mjs.map
1
+ import{n as e,r as t}from"./runOpa-CswzJxIs.mjs";import{t as n}from"./done-input-validation-BUz-aVC5.mjs";import r from"node:path";import i from"colors";async function a({pkg:a,input:o,bundle:s}){n(this.process),t();let c=r.resolve(o);if(!this.fs.existsSync(c))throw Error(`Input file not found: ${c}`);let l=[`eval`,`--format`,`pretty`,`--input`,c];s&&l.push(`-b`,r.resolve(s)),l.push(a),this.logger.info(i.green(`Evaluating ${a} with input ${c}...`));let u=await e(l);u!==0&&this.process.exit(u)}export{a as _eval};
2
+ //# sourceMappingURL=impl-DryC3OJu.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-6m7GXUAe.mjs","names":[],"sources":["../src/commands/policy/eval/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 { assertOpaInstalled, runOpa } from '../helpers/index.js';\n\n/** CLI flags for `transcend policy eval`. */\nexport interface EvalCommandFlags {\n /** OPA package/query to evaluate (e.g. `data.transcend.decision`) */\n pkg: string;\n /** Path to a JSON envelope input file */\n input: string;\n /** Optional local policy bundle directory */\n bundle?: string;\n}\n\n/**\n * Evaluate one envelope against a local policy bundle via `opa eval`.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function _eval(\n this: LocalContext,\n { pkg, input, bundle }: EvalCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n assertOpaInstalled();\n\n const inputPath = path.resolve(input);\n if (!this.fs.existsSync(inputPath)) {\n throw new Error(`Input file not found: ${inputPath}`);\n }\n\n const args = ['eval', '--format', 'pretty', '--input', inputPath];\n if (bundle) {\n args.push('-b', path.resolve(bundle));\n }\n args.push(pkg);\n\n this.logger.info(colors.green(`Evaluating ${pkg} with input ${inputPath}...`));\n\n const exitCode = await runOpa(args);\n if (exitCode !== 0) {\n this.process.exit(exitCode);\n }\n}\n"],"mappings":"yJAwBA,eAAsB,EAEpB,CAAE,MAAK,QAAO,UACC,CACf,EAAoB,KAAK,QAAQ,CAEjC,GAAoB,CAEpB,IAAM,EAAY,EAAK,QAAQ,EAAM,CACrC,GAAI,CAAC,KAAK,GAAG,WAAW,EAAU,CAChC,MAAU,MAAM,yBAAyB,IAAY,CAGvD,IAAM,EAAO,CAAC,OAAQ,WAAY,SAAU,UAAW,EAAU,CAC7D,GACF,EAAK,KAAK,KAAM,EAAK,QAAQ,EAAO,CAAC,CAEvC,EAAK,KAAK,EAAI,CAEd,KAAK,OAAO,KAAK,EAAO,MAAM,cAAc,EAAI,cAAc,EAAU,KAAK,CAAC,CAE9E,IAAM,EAAW,MAAM,EAAO,EAAK,CAC/B,IAAa,GACf,KAAK,QAAQ,KAAK,EAAS"}
1
+ {"version":3,"file":"impl-DryC3OJu.mjs","names":[],"sources":["../src/commands/policy/eval/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 { assertOpaInstalled, runOpa } from '../helpers/index.js';\n\n/** CLI flags for `transcend policy eval`. */\nexport interface EvalCommandFlags {\n /** OPA package/query to evaluate (e.g. `data.transcend.decision`) */\n pkg: string;\n /** Path to a JSON envelope input file */\n input: string;\n /** Optional local policy bundle directory */\n bundle?: string;\n}\n\n/**\n * Evaluate one envelope against a local policy bundle via `opa eval`.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function _eval(\n this: LocalContext,\n { pkg, input, bundle }: EvalCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n assertOpaInstalled();\n\n const inputPath = path.resolve(input);\n if (!this.fs.existsSync(inputPath)) {\n throw new Error(`Input file not found: ${inputPath}`);\n }\n\n const args = ['eval', '--format', 'pretty', '--input', inputPath];\n if (bundle) {\n args.push('-b', path.resolve(bundle));\n }\n args.push(pkg);\n\n this.logger.info(colors.green(`Evaluating ${pkg} with input ${inputPath}...`));\n\n const exitCode = await runOpa(args);\n if (exitCode !== 0) {\n this.process.exit(exitCode);\n }\n}\n"],"mappings":"yJAwBA,eAAsB,EAEpB,CAAE,MAAK,QAAO,UACC,CACf,EAAoB,KAAK,QAAQ,CAEjC,GAAoB,CAEpB,IAAM,EAAY,EAAK,QAAQ,EAAM,CACrC,GAAI,CAAC,KAAK,GAAG,WAAW,EAAU,CAChC,MAAU,MAAM,yBAAyB,IAAY,CAGvD,IAAM,EAAO,CAAC,OAAQ,WAAY,SAAU,UAAW,EAAU,CAC7D,GACF,EAAK,KAAK,KAAM,EAAK,QAAQ,EAAO,CAAC,CAEvC,EAAK,KAAK,EAAI,CAEd,KAAK,OAAO,KAAK,EAAO,MAAM,cAAc,EAAI,cAAc,EAAU,KAAK,CAAC,CAE9E,IAAM,EAAW,MAAM,EAAO,EAAK,CAC/B,IAAa,GACf,KAAK,QAAQ,KAAK,EAAS"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./collectParquetFilesOrExit-BiksFI-Q.mjs";import{t}from"./done-input-validation-Cjk7a3jX.mjs";import{n,r,t as i}from"./createPoolingCommandUi-C39R_zo3.mjs";import a from"colors";import{CHILD_FLAG as o,PoolCancelledError as s,computePoolSize as c,resolveWorkerPath as l,runPool as u}from"@transcend-io/utils";function d(e){return n(e)}function f(e){return r(e)}const p={renderHeader:d,renderWorkers:f};async function m(n){t(this.process);let{directory:r,outputDir:d,clearOutputDir:f,concurrency:m,viewerMode:h}=n,g=i(this,p,h),_=e(r,this),{poolSize:v,cpuCount:y}=c(m,_.length);this.logger.info(a.green(`Converting ${_.length} Parquet file(s) → CSV with pool size ${v} (CPU=${y})`));let b=_.map(e=>({filePath:e,options:{outputDir:d,clearOutputDir:f}}));await u({title:`Parquet → CSV - ${r}`,baseDir:r||d||this.process.cwd(),childFlag:o,childModulePath:l(import.meta.url,`commands/admin/parquet-to-csv/worker.mjs`),poolSize:v,cpuCount:y,filesTotal:_.length,hooks:{nextTask:()=>b.shift(),taskLabel:e=>e.filePath,initTotals:()=>({}),initSlotProgress:()=>void 0,onProgress:e=>e,onResult:(e,t)=>({totals:e,ok:!!t.ok}),postProcess:async()=>{}},viewerMode:h,...g}).catch(e=>{throw e instanceof s&&this.process.exit(130),e})}export{m as parquetToCsv};
2
- //# sourceMappingURL=impl-CQGeH47F.mjs.map
1
+ import{t as e}from"./collectParquetFilesOrExit-DVlv5ctt.mjs";import{t}from"./done-input-validation-BUz-aVC5.mjs";import{n,r,t as i}from"./createPoolingCommandUi-uiDjLlqf.mjs";import a from"colors";import{CHILD_FLAG as o,PoolCancelledError as s,computePoolSize as c,resolveWorkerPath as l,runPool as u}from"@transcend-io/utils";function d(e){return n(e)}function f(e){return r(e)}const p={renderHeader:d,renderWorkers:f};async function m(n){t(this.process);let{directory:r,outputDir:d,clearOutputDir:f,concurrency:m,viewerMode:h}=n,g=i(this,p,h),_=e(r,this),{poolSize:v,cpuCount:y}=c(m,_.length);this.logger.info(a.green(`Converting ${_.length} Parquet file(s) → CSV with pool size ${v} (CPU=${y})`));let b=_.map(e=>({filePath:e,options:{outputDir:d,clearOutputDir:f}}));await u({title:`Parquet → CSV - ${r}`,baseDir:r||d||this.process.cwd(),childFlag:o,childModulePath:l(import.meta.url,`commands/admin/parquet-to-csv/worker.mjs`),poolSize:v,cpuCount:y,filesTotal:_.length,hooks:{nextTask:()=>b.shift(),taskLabel:e=>e.filePath,initTotals:()=>({}),initSlotProgress:()=>void 0,onProgress:e=>e,onResult:(e,t)=>({totals:e,ok:!!t.ok}),postProcess:async()=>{}},viewerMode:h,...g}).catch(e=>{throw e instanceof s&&this.process.exit(130),e})}export{m as parquetToCsv};
2
+ //# sourceMappingURL=impl-DuZjI6p0.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-CQGeH47F.mjs","names":[],"sources":["../src/commands/admin/parquet-to-csv/ui/plugin.ts","../src/commands/admin/parquet-to-csv/impl.ts"],"sourcesContent":["import {\n makeHeader,\n makeWorkerRows,\n type ChunkSlotProgress,\n type CommonCtx,\n type DashboardPlugin,\n} from '../../../../lib/pooling/index.js';\n\n/**\n * Header for parquet-to-csv (no extra totals block).\n *\n * @param ctx - Dashboard context.\n * @returns Header lines.\n */\nfunction renderHeader<TTotals>(ctx: CommonCtx<TTotals, ChunkSlotProgress>): string[] {\n // no extra lines — reuse the shared header as-is\n return makeHeader(ctx);\n}\n\n/**\n * Worker rows for parquet-to-csv — share the generic row renderer.\n *\n * @param ctx - Dashboard context.\n * @returns Array of strings, each representing one worker row.\n */\nfunction renderWorkers<TTotals>(ctx: CommonCtx<TTotals, ChunkSlotProgress>): string[] {\n return makeWorkerRows(ctx);\n}\n\nexport const parquetToCsvPlugin: DashboardPlugin<unknown, ChunkSlotProgress> = {\n renderHeader,\n renderWorkers,\n // no extras\n};\n","import {\n CHILD_FLAG,\n type PoolHooks,\n runPool,\n computePoolSize,\n PoolCancelledError,\n resolveWorkerPath,\n} from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { collectParquetFilesOrExit } from '../../../lib/helpers/index.js';\nimport { createPoolingCommandUi } from '../../../lib/pooling/index.js';\nimport { parquetToCsvPlugin } from './ui/index.js';\nimport type { ParquetProgress, ParquetResult, ParquetTask } from './worker.js';\n\n/** No custom totals for the header; the runner’s built-ins suffice. */\ntype Totals = Record<string, never>;\n\nexport type ParquetToCsvCommandFlags = {\n directory: string;\n outputDir?: string;\n clearOutputDir: boolean;\n concurrency?: number;\n viewerMode: boolean;\n};\n\n/**\n * Convert all Parquet files in a directory to CSV, in parallel.\n *\n * @param flags - The command flags.\n */\nexport async function parquetToCsv(\n this: LocalContext,\n flags: ParquetToCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n const { directory, outputDir, clearOutputDir, concurrency, viewerMode } = flags;\n const poolingUi = createPoolingCommandUi(this, parquetToCsvPlugin, viewerMode);\n\n /* 1) Discover .parquet inputs */\n const files = collectParquetFilesOrExit(directory, this);\n\n /* 2) Size the pool */\n const { poolSize, cpuCount } = computePoolSize(concurrency, files.length);\n\n this.logger.info(\n colors.green(\n `Converting ${files.length} Parquet file(s) → CSV with pool size ${poolSize} (CPU=${cpuCount})`,\n ),\n );\n\n /* 3) Build FIFO queue of tasks (one per file) */\n const queue = files.map<ParquetTask>((filePath) => ({\n filePath,\n options: { outputDir, clearOutputDir },\n }));\n\n /* 4) Pool hooks */\n const hooks: PoolHooks<ParquetTask, ParquetProgress, ParquetResult, Totals> = {\n nextTask: () => queue.shift(),\n taskLabel: (t) => t.filePath,\n initTotals: () => ({}) as Totals,\n initSlotProgress: () => undefined,\n onProgress: (totals) => totals,\n onResult: (totals, res) => ({ totals, ok: !!res.ok }),\n postProcess: async () => {\n // nothing special post-run\n },\n };\n\n /* 5) Launch the pool runner with custom dashboard plugin */\n await runPool({\n title: `Parquet → CSV - ${directory}`,\n baseDir: directory || outputDir || this.process.cwd(),\n childFlag: CHILD_FLAG,\n childModulePath: resolveWorkerPath(import.meta.url, 'commands/admin/parquet-to-csv/worker.mjs'),\n poolSize,\n cpuCount,\n filesTotal: files.length,\n hooks,\n viewerMode,\n ...poolingUi,\n }).catch((err) => {\n if (err instanceof PoolCancelledError) {\n this.process.exit(130);\n }\n throw err;\n });\n}\n"],"mappings":"uUAcA,SAAS,EAAsB,EAAsD,CAEnF,OAAO,EAAW,EAAI,CASxB,SAAS,EAAuB,EAAsD,CACpF,OAAO,EAAe,EAAI,CAG5B,MAAa,EAAkE,CAC7E,eACA,gBAED,CCAD,eAAsB,EAEpB,EACe,CACf,EAAoB,KAAK,QAAQ,CAEjC,GAAM,CAAE,YAAW,YAAW,iBAAgB,cAAa,cAAe,EACpE,EAAY,EAAuB,KAAM,EAAoB,EAAW,CAGxE,EAAQ,EAA0B,EAAW,KAAK,CAGlD,CAAE,WAAU,YAAa,EAAgB,EAAa,EAAM,OAAO,CAEzE,KAAK,OAAO,KACV,EAAO,MACL,cAAc,EAAM,OAAO,wCAAwC,EAAS,QAAQ,EAAS,GAC9F,CACF,CAGD,IAAM,EAAQ,EAAM,IAAkB,IAAc,CAClD,WACA,QAAS,CAAE,YAAW,iBAAgB,CACvC,EAAE,CAgBH,MAAM,EAAQ,CACZ,MAAO,mBAAmB,IAC1B,QAAS,GAAa,GAAa,KAAK,QAAQ,KAAK,CACrD,UAAW,EACX,gBAAiB,EAAkB,OAAO,KAAK,IAAK,2CAA2C,CAC/F,WACA,WACA,WAAY,EAAM,OAClB,MAAA,CApBA,aAAgB,EAAM,OAAO,CAC7B,UAAY,GAAM,EAAE,SACpB,gBAAmB,EAAE,EACrB,qBAAwB,IAAA,GACxB,WAAa,GAAW,EACxB,UAAW,EAAQ,KAAS,CAAE,SAAQ,GAAI,CAAC,CAAC,EAAI,GAAI,EACpD,YAAa,SAAY,GAcpB,CACL,aACA,GAAG,EACJ,CAAC,CAAC,MAAO,GAAQ,CAIhB,MAHI,aAAe,GACjB,KAAK,QAAQ,KAAK,IAAI,CAElB,GACN"}
1
+ {"version":3,"file":"impl-DuZjI6p0.mjs","names":[],"sources":["../src/commands/admin/parquet-to-csv/ui/plugin.ts","../src/commands/admin/parquet-to-csv/impl.ts"],"sourcesContent":["import {\n makeHeader,\n makeWorkerRows,\n type ChunkSlotProgress,\n type CommonCtx,\n type DashboardPlugin,\n} from '../../../../lib/pooling/index.js';\n\n/**\n * Header for parquet-to-csv (no extra totals block).\n *\n * @param ctx - Dashboard context.\n * @returns Header lines.\n */\nfunction renderHeader<TTotals>(ctx: CommonCtx<TTotals, ChunkSlotProgress>): string[] {\n // no extra lines — reuse the shared header as-is\n return makeHeader(ctx);\n}\n\n/**\n * Worker rows for parquet-to-csv — share the generic row renderer.\n *\n * @param ctx - Dashboard context.\n * @returns Array of strings, each representing one worker row.\n */\nfunction renderWorkers<TTotals>(ctx: CommonCtx<TTotals, ChunkSlotProgress>): string[] {\n return makeWorkerRows(ctx);\n}\n\nexport const parquetToCsvPlugin: DashboardPlugin<unknown, ChunkSlotProgress> = {\n renderHeader,\n renderWorkers,\n // no extras\n};\n","import {\n CHILD_FLAG,\n type PoolHooks,\n runPool,\n computePoolSize,\n PoolCancelledError,\n resolveWorkerPath,\n} from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { collectParquetFilesOrExit } from '../../../lib/helpers/index.js';\nimport { createPoolingCommandUi } from '../../../lib/pooling/index.js';\nimport { parquetToCsvPlugin } from './ui/index.js';\nimport type { ParquetProgress, ParquetResult, ParquetTask } from './worker.js';\n\n/** No custom totals for the header; the runner’s built-ins suffice. */\ntype Totals = Record<string, never>;\n\nexport type ParquetToCsvCommandFlags = {\n directory: string;\n outputDir?: string;\n clearOutputDir: boolean;\n concurrency?: number;\n viewerMode: boolean;\n};\n\n/**\n * Convert all Parquet files in a directory to CSV, in parallel.\n *\n * @param flags - The command flags.\n */\nexport async function parquetToCsv(\n this: LocalContext,\n flags: ParquetToCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n const { directory, outputDir, clearOutputDir, concurrency, viewerMode } = flags;\n const poolingUi = createPoolingCommandUi(this, parquetToCsvPlugin, viewerMode);\n\n /* 1) Discover .parquet inputs */\n const files = collectParquetFilesOrExit(directory, this);\n\n /* 2) Size the pool */\n const { poolSize, cpuCount } = computePoolSize(concurrency, files.length);\n\n this.logger.info(\n colors.green(\n `Converting ${files.length} Parquet file(s) → CSV with pool size ${poolSize} (CPU=${cpuCount})`,\n ),\n );\n\n /* 3) Build FIFO queue of tasks (one per file) */\n const queue = files.map<ParquetTask>((filePath) => ({\n filePath,\n options: { outputDir, clearOutputDir },\n }));\n\n /* 4) Pool hooks */\n const hooks: PoolHooks<ParquetTask, ParquetProgress, ParquetResult, Totals> = {\n nextTask: () => queue.shift(),\n taskLabel: (t) => t.filePath,\n initTotals: () => ({}) as Totals,\n initSlotProgress: () => undefined,\n onProgress: (totals) => totals,\n onResult: (totals, res) => ({ totals, ok: !!res.ok }),\n postProcess: async () => {\n // nothing special post-run\n },\n };\n\n /* 5) Launch the pool runner with custom dashboard plugin */\n await runPool({\n title: `Parquet → CSV - ${directory}`,\n baseDir: directory || outputDir || this.process.cwd(),\n childFlag: CHILD_FLAG,\n childModulePath: resolveWorkerPath(import.meta.url, 'commands/admin/parquet-to-csv/worker.mjs'),\n poolSize,\n cpuCount,\n filesTotal: files.length,\n hooks,\n viewerMode,\n ...poolingUi,\n }).catch((err) => {\n if (err instanceof PoolCancelledError) {\n this.process.exit(130);\n }\n throw err;\n });\n}\n"],"mappings":"uUAcA,SAAS,EAAsB,EAAsD,CAEnF,OAAO,EAAW,EAAI,CASxB,SAAS,EAAuB,EAAsD,CACpF,OAAO,EAAe,EAAI,CAG5B,MAAa,EAAkE,CAC7E,eACA,gBAED,CCAD,eAAsB,EAEpB,EACe,CACf,EAAoB,KAAK,QAAQ,CAEjC,GAAM,CAAE,YAAW,YAAW,iBAAgB,cAAa,cAAe,EACpE,EAAY,EAAuB,KAAM,EAAoB,EAAW,CAGxE,EAAQ,EAA0B,EAAW,KAAK,CAGlD,CAAE,WAAU,YAAa,EAAgB,EAAa,EAAM,OAAO,CAEzE,KAAK,OAAO,KACV,EAAO,MACL,cAAc,EAAM,OAAO,wCAAwC,EAAS,QAAQ,EAAS,GAC9F,CACF,CAGD,IAAM,EAAQ,EAAM,IAAkB,IAAc,CAClD,WACA,QAAS,CAAE,YAAW,iBAAgB,CACvC,EAAE,CAgBH,MAAM,EAAQ,CACZ,MAAO,mBAAmB,IAC1B,QAAS,GAAa,GAAa,KAAK,QAAQ,KAAK,CACrD,UAAW,EACX,gBAAiB,EAAkB,OAAO,KAAK,IAAK,2CAA2C,CAC/F,WACA,WACA,WAAY,EAAM,OAClB,MAAA,CApBA,aAAgB,EAAM,OAAO,CAC7B,UAAY,GAAM,EAAE,SACpB,gBAAmB,EAAE,EACrB,qBAAwB,IAAA,GACxB,WAAa,GAAW,EACxB,UAAW,EAAQ,KAAS,CAAE,SAAQ,GAAI,CAAC,CAAC,EAAI,GAAI,EACpD,YAAa,SAAY,GAcpB,CACL,aACA,GAAG,EACJ,CAAC,CAAC,MAAO,GAAQ,CAIhB,MAHI,aAAe,GACjB,KAAK,QAAQ,KAAK,IAAI,CAElB,GACN"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./pullManualEnrichmentIdentifiersToCsv-qjdNA75O.mjs";import{t}from"./done-input-validation-Cjk7a3jX.mjs";async function n({auth:n,transcendUrl:r,file:i,concurrency:a,actions:o,sombraAuth:s}){t(this.process),await e({file:i,transcendUrl:r,concurrency:a,requestActions:o,auth:n,sombraAuth:s})}export{n as pullIdentifiers};
2
- //# sourceMappingURL=impl-C5dzaDga2.mjs.map
1
+ import{t as e}from"./pullManualEnrichmentIdentifiersToCsv-DbNSrKEk.mjs";import{t}from"./done-input-validation-BUz-aVC5.mjs";async function n({auth:n,transcendUrl:r,file:i,concurrency:a,actions:o,sombraAuth:s}){t(this.process),await e({file:i,transcendUrl:r,concurrency:a,requestActions:o,auth:n,sombraAuth:s})}export{n as pullIdentifiers};
2
+ //# sourceMappingURL=impl-Dw8NYkzw.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl-Dw8NYkzw.mjs","names":[],"sources":["../src/commands/request/preflight/pull-identifiers/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { pullManualEnrichmentIdentifiersToCsv } from '../../../../lib/manual-enrichment/index.js';\n\nexport interface PullIdentifiersCommandFlags {\n auth: string;\n sombraAuth?: string;\n transcendUrl: string;\n file: string;\n actions?: RequestAction[];\n concurrency: number;\n}\n\nexport async function pullIdentifiers(\n this: LocalContext,\n { auth, transcendUrl, file, concurrency, actions, sombraAuth }: PullIdentifiersCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await pullManualEnrichmentIdentifiersToCsv({\n file,\n transcendUrl,\n concurrency,\n requestActions: actions,\n auth,\n sombraAuth,\n });\n}\n"],"mappings":"4HAeA,eAAsB,EAEpB,CAAE,OAAM,eAAc,OAAM,cAAa,UAAS,cACnC,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAqC,CACzC,OACA,eACA,cACA,eAAgB,EAChB,OACA,aACD,CAAC"}
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./retryRequestDataSilos-BfckLjOJ.mjs";import{t}from"./done-input-validation-BUz-aVC5.mjs";async function n({auth:n,dataSiloId:r,actions:i,transcendUrl:a}){t(this.process),await e({requestActions:i,transcendUrl:a,auth:n,dataSiloId:r})}export{n as retryRequestDataSilos};
2
+ //# sourceMappingURL=impl-Dx_TfvW1.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-C8BmxFQ2.mjs","names":["retryRequestDataSilosHelper"],"sources":["../src/commands/request/system/retry-request-data-silos/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { retryRequestDataSilos as retryRequestDataSilosHelper } from '../../../../lib/requests/index.js';\n\nexport interface RetryRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n actions: RequestAction[];\n transcendUrl: string;\n}\n\nexport async function retryRequestDataSilos(\n this: LocalContext,\n { auth, dataSiloId, actions, transcendUrl }: RetryRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await retryRequestDataSilosHelper({\n requestActions: actions,\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"],"mappings":"6GAaA,eAAsB,EAEpB,CAAE,OAAM,aAAY,UAAS,gBACd,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAMA,EAA4B,CAChC,eAAgB,EAChB,eACA,OACA,aACD,CAAC"}
1
+ {"version":3,"file":"impl-Dx_TfvW1.mjs","names":["retryRequestDataSilosHelper"],"sources":["../src/commands/request/system/retry-request-data-silos/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { retryRequestDataSilos as retryRequestDataSilosHelper } from '../../../../lib/requests/index.js';\n\nexport interface RetryRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n actions: RequestAction[];\n transcendUrl: string;\n}\n\nexport async function retryRequestDataSilos(\n this: LocalContext,\n { auth, dataSiloId, actions, transcendUrl }: RetryRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await retryRequestDataSilosHelper({\n requestActions: actions,\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"],"mappings":"6GAaA,eAAsB,EAEpB,CAAE,OAAM,aAAY,UAAS,gBACd,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAMA,EAA4B,CAChC,eAAgB,EAChB,eACA,OACA,aACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{n as e}from"./buildXdiSyncEndpoint-B3zUrI16.mjs";import{t}from"./validateTranscendAuth-CnHMn77m.mjs";import{t as n}from"./done-input-validation-Cjk7a3jX.mjs";import r from"colors";async function i({auth:i,xdiLocation:a,file:o,removeIpAddresses:s,domainBlockList:c,xdiAllowedCommands:l,transcendUrl:u}){n(this.process);let{syncGroups:d,html:f}=await e(await t(i,this),{xdiLocation:a,transcendUrl:u,removeIpAddresses:s,domainBlockList:c.length>0?c:void 0,xdiAllowedCommands:l});this.logger.info(r.green(`Successfully constructed sync endpoint for sync groups: ${JSON.stringify(d,null,2)}`)),this.fs.writeFileSync(o,f),this.logger.info(r.green(`Wrote configuration to file "${o}"!`))}export{i as buildXdiSyncEndpoint};
2
- //# sourceMappingURL=impl-DXNcD7CZ.mjs.map
1
+ import{n as e}from"./buildXdiSyncEndpoint-DcrkZ2Gu.mjs";import{t}from"./validateTranscendAuth-D6Wr1cxY.mjs";import{t as n}from"./done-input-validation-BUz-aVC5.mjs";import r from"colors";async function i({auth:i,xdiLocation:a,file:o,removeIpAddresses:s,domainBlockList:c,xdiAllowedCommands:l,transcendUrl:u}){n(this.process);let{syncGroups:d,html:f}=await e(await t(i,this),{xdiLocation:a,transcendUrl:u,removeIpAddresses:s,domainBlockList:c.length>0?c:void 0,xdiAllowedCommands:l});this.logger.info(r.green(`Successfully constructed sync endpoint for sync groups: ${JSON.stringify(d,null,2)}`)),this.fs.writeFileSync(o,f),this.logger.info(r.green(`Wrote configuration to file "${o}"!`))}export{i as buildXdiSyncEndpoint};
2
+ //# sourceMappingURL=impl-DypttZd6.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DXNcD7CZ.mjs","names":["buildXdiSyncEndpointHelper"],"sources":["../src/commands/consent/build-xdi-sync-endpoint/impl.ts"],"sourcesContent":["import colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { buildXdiSyncEndpoint as buildXdiSyncEndpointHelper } from '../../../lib/consent-manager/index.js';\n\nexport interface BuildXdiSyncEndpointCommandFlags {\n auth: string;\n xdiLocation: string;\n file: string;\n removeIpAddresses: boolean;\n domainBlockList: string[];\n xdiAllowedCommands: string;\n transcendUrl: string;\n}\n\nexport async function buildXdiSyncEndpoint(\n this: LocalContext,\n {\n auth,\n xdiLocation,\n file,\n removeIpAddresses,\n domainBlockList,\n xdiAllowedCommands,\n transcendUrl,\n }: BuildXdiSyncEndpointCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth, this);\n\n // Build the sync endpoint\n const { syncGroups, html } = await buildXdiSyncEndpointHelper(apiKeyOrList, {\n xdiLocation,\n transcendUrl,\n removeIpAddresses,\n domainBlockList: domainBlockList.length > 0 ? domainBlockList : undefined,\n xdiAllowedCommands,\n });\n\n // Log success\n this.logger.info(\n colors.green(\n `Successfully constructed sync endpoint for sync groups: ${JSON.stringify(\n syncGroups,\n null,\n 2,\n )}`,\n ),\n );\n\n // Write to disk\n this.fs.writeFileSync(file, html);\n this.logger.info(colors.green(`Wrote configuration to file \"${file}\"!`));\n}\n"],"mappings":"2LAiBA,eAAsB,EAEpB,CACE,OACA,cACA,OACA,oBACA,kBACA,qBACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,CAMjC,GAAM,CAAE,aAAY,QAAS,MAAMA,EAA2B,MAHnC,EAAsB,EAAM,KAAK,CAGgB,CAC1E,cACA,eACA,oBACA,gBAAiB,EAAgB,OAAS,EAAI,EAAkB,IAAA,GAChE,qBACD,CAAC,CAGF,KAAK,OAAO,KACV,EAAO,MACL,2DAA2D,KAAK,UAC9D,EACA,KACA,EACD,GACF,CACF,CAGD,KAAK,GAAG,cAAc,EAAM,EAAK,CACjC,KAAK,OAAO,KAAK,EAAO,MAAM,gCAAgC,EAAK,IAAI,CAAC"}
1
+ {"version":3,"file":"impl-DypttZd6.mjs","names":["buildXdiSyncEndpointHelper"],"sources":["../src/commands/consent/build-xdi-sync-endpoint/impl.ts"],"sourcesContent":["import colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { buildXdiSyncEndpoint as buildXdiSyncEndpointHelper } from '../../../lib/consent-manager/index.js';\n\nexport interface BuildXdiSyncEndpointCommandFlags {\n auth: string;\n xdiLocation: string;\n file: string;\n removeIpAddresses: boolean;\n domainBlockList: string[];\n xdiAllowedCommands: string;\n transcendUrl: string;\n}\n\nexport async function buildXdiSyncEndpoint(\n this: LocalContext,\n {\n auth,\n xdiLocation,\n file,\n removeIpAddresses,\n domainBlockList,\n xdiAllowedCommands,\n transcendUrl,\n }: BuildXdiSyncEndpointCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth, this);\n\n // Build the sync endpoint\n const { syncGroups, html } = await buildXdiSyncEndpointHelper(apiKeyOrList, {\n xdiLocation,\n transcendUrl,\n removeIpAddresses,\n domainBlockList: domainBlockList.length > 0 ? domainBlockList : undefined,\n xdiAllowedCommands,\n });\n\n // Log success\n this.logger.info(\n colors.green(\n `Successfully constructed sync endpoint for sync groups: ${JSON.stringify(\n syncGroups,\n null,\n 2,\n )}`,\n ),\n );\n\n // Write to disk\n this.fs.writeFileSync(file, html);\n this.logger.info(colors.green(`Wrote configuration to file \"${file}\"!`));\n}\n"],"mappings":"2LAiBA,eAAsB,EAEpB,CACE,OACA,cACA,OACA,oBACA,kBACA,qBACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,CAMjC,GAAM,CAAE,aAAY,QAAS,MAAMA,EAA2B,MAHnC,EAAsB,EAAM,KAAK,CAGgB,CAC1E,cACA,eACA,oBACA,gBAAiB,EAAgB,OAAS,EAAI,EAAkB,IAAA,GAChE,qBACD,CAAC,CAGF,KAAK,OAAO,KACV,EAAO,MACL,2DAA2D,KAAK,UAC9D,EACA,KACA,EACD,GACF,CACF,CAGD,KAAK,GAAG,cAAc,EAAM,EAAK,CACjC,KAAK,OAAO,KAAK,EAAO,MAAM,gCAAgC,EAAK,IAAI,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./pullUnstructuredSubDataPointRecommendations-Dmh_-r95.mjs";import{s as t}from"./writeCsv-D46aDkGf.mjs";import{t as n}from"./done-input-validation-Cjk7a3jX.mjs";import{uniq as r}from"lodash-es";import i from"colors";import{buildTranscendGraphQLClient as a}from"@transcend-io/sdk";async function o({auth:o,file:s,transcendUrl:c,dataSiloIds:l,subCategories:u,status:d,includeEncryptedSnippets:f}){n(this.process);try{let n=await e(a(c,o),{dataSiloIds:l,subCategories:u,status:d,includeEncryptedSnippets:f});this.logger.info(i.magenta(`Writing unstructured discovery files to file "${s}"...`));let p=[];await t(s,n.map(e=>{let t={"Entry ID":e.id,"Data Silo ID":e.dataSiloId,"Object Path ID":e.scannedObjectPathId,"Object ID":e.scannedObjectId,...f?{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 p=r([...p,...Object.keys(t)]),t}),p)}catch(e){this.logger.error(i.red(`An error occurred syncing the unstructured discovery files: ${e.message}`)),this.process.exit(1)}this.logger.info(i.green(`Successfully synced unstructured discovery files to disk at ${s}!`))}export{o as pullUnstructuredDiscoveryFiles};
2
- //# sourceMappingURL=impl-CfPXYgT42.mjs.map
1
+ import{t as e}from"./pullUnstructuredSubDataPointRecommendations-YTBzfkRZ.mjs";import{s as t}from"./writeCsv-D-2siSwE.mjs";import{t as n}from"./done-input-validation-BUz-aVC5.mjs";import{uniq as r}from"lodash-es";import i from"colors";import{buildTranscendGraphQLClient as a}from"@transcend-io/sdk";async function o({auth:o,file:s,transcendUrl:c,dataSiloIds:l,subCategories:u,status:d,includeEncryptedSnippets:f}){n(this.process);try{let n=await e(a(c,o),{dataSiloIds:l,subCategories:u,status:d,includeEncryptedSnippets:f});this.logger.info(i.magenta(`Writing unstructured discovery files to file "${s}"...`));let p=[];await t(s,n.map(e=>{let t={"Entry ID":e.id,"Data Silo ID":e.dataSiloId,"Object Path ID":e.scannedObjectPathId,"Object ID":e.scannedObjectId,...f?{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 p=r([...p,...Object.keys(t)]),t}),p)}catch(e){this.logger.error(i.red(`An error occurred syncing the unstructured discovery files: ${e.message}`)),this.process.exit(1)}this.logger.info(i.green(`Successfully synced unstructured discovery files to disk at ${s}!`))}export{o as pullUnstructuredDiscoveryFiles};
2
+ //# sourceMappingURL=impl-DzUTmaID2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-CfPXYgT42.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';\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);\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 this.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 this.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 this.logger.info(\n colors.green(`Successfully synced unstructured discovery files to disk at ${file}!`),\n );\n}\n"],"mappings":"2SAoBA,eAAsB,EAEpB,CACE,OACA,OACA,eACA,cACA,gBACA,SACA,4BAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,GAAI,CAIF,IAAM,EAAU,MAAM,EAFP,EAA4B,EAAc,EAEe,CAAE,CACxE,cACA,gBACA,SACA,2BACD,CAAC,CAEF,KAAK,OAAO,KAAK,EAAO,QAAQ,iDAAiD,EAAK,MAAM,CAAC,CAC7F,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,KAAK,OAAO,MACV,EAAO,IAAI,+DAA+D,EAAI,UAAU,CACzF,CACD,KAAK,QAAQ,KAAK,EAAE,CAItB,KAAK,OAAO,KACV,EAAO,MAAM,+DAA+D,EAAK,GAAG,CACrF"}
1
+ {"version":3,"file":"impl-DzUTmaID2.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';\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);\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 this.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 this.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 this.logger.info(\n colors.green(`Successfully synced unstructured discovery files to disk at ${file}!`),\n );\n}\n"],"mappings":"2SAoBA,eAAsB,EAEpB,CACE,OACA,OACA,eACA,cACA,gBACA,SACA,4BAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,GAAI,CAIF,IAAM,EAAU,MAAM,EAFP,EAA4B,EAAc,EAEe,CAAE,CACxE,cACA,gBACA,SACA,2BACD,CAAC,CAEF,KAAK,OAAO,KAAK,EAAO,QAAQ,iDAAiD,EAAK,MAAM,CAAC,CAC7F,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,KAAK,OAAO,MACV,EAAO,IAAI,+DAA+D,EAAI,UAAU,CACzF,CACD,KAAK,QAAQ,KAAK,EAAE,CAItB,KAAK,OAAO,KACV,EAAO,MAAM,+DAA+D,EAAK,GAAG,CACrF"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./constants-BG53Mbi9.mjs";import{t}from"./logger-9T6vva73.mjs";import{n}from"./syncCodePackages-DsC1tE8B.mjs";import{t as r}from"./done-input-validation-Cjk7a3jX.mjs";import{t as i}from"./constants-BpQ5awGp.mjs";import a from"fast-glob";import o from"colors";import{getEntries as s}from"@transcend-io/type-utils";import{buildTranscendGraphQLClient as c}from"@transcend-io/sdk";import{execSync as l}from"child_process";async function u({scanPath:e,ignoreDirs:n=[],repositoryName:r}){return(await Promise.all(s(i).map(async([i,s])=>{let{ignoreDirs:c,supportedFiles:l,scanFunction:u}=s,d=[...n,...c].filter(e=>e.length>0);try{let n=await a(`${e}/**/${l.join(`|`)}`,{ignore:d.map(t=>`${e}/**/${t}`),unique:!0,onlyFiles:!0});t.info(o.magenta(`Scanning: ${n.length} files of type ${i}`));let s=n.map(t=>u(t).map(n=>({...n,relativePath:t.replace(`${e}/`,``)}))).flat();return t.info(o.green(`Found: ${s.length} packages and ${s.map(({softwareDevelopmentKits:e=[]})=>e).flat().length} sdks`)),s.map(e=>({...e,type:i,repositoryName:r}))}catch(e){throw Error(`Error scanning globs ${l} with error: ${e}`)}}))).flat()}const d=`A repository name must be provided. You can specify using --repositoryName=$REPO_NAME or by ensuring the command "git config --get remote.origin.url" returns the name of the repository`;async function f({auth:t,scanPath:i,ignoreDirs:a,repositoryName:s,transcendUrl:f}){r(this.process);let p=s;if(!p)try{let e=l(`cd ${i} && git config --get remote.origin.url`).toString(`utf-8`).trim();[p]=e.includes(`https:`)?e.split(`/`).slice(3).join(`/`).split(`.`):(e.split(`:`).pop()||``).split(`.`),p||(this.logger.error(o.red(d)),this.process.exit(1))}catch(e){this.logger.error(o.red(`${d} - Got error: ${e.message}`)),this.process.exit(1)}let m=c(f,t),h=await u({scanPath:i,ignoreDirs:a,repositoryName:p});await n(m,h);let g=new URL(e);g.pathname=`/code-scanning/code-packages`,this.logger.info(o.green(`Scan found ${h.length} packages at ${i}! View results at '${g.href}'`))}export{f as scanPackages};
2
- //# sourceMappingURL=impl-BJlKQJdS2.mjs.map
1
+ import{t as e}from"./constants-jjHIzHGm.mjs";import{t}from"./logger-zplFSeXU.mjs";import{n}from"./syncCodePackages-BHE2Tn1Q.mjs";import{t as r}from"./done-input-validation-BUz-aVC5.mjs";import{t as i}from"./constants-DXzsg2CQ.mjs";import a from"fast-glob";import o from"colors";import{getEntries as s}from"@transcend-io/type-utils";import{buildTranscendGraphQLClient as c}from"@transcend-io/sdk";import{execSync as l}from"child_process";async function u({scanPath:e,ignoreDirs:n=[],repositoryName:r}){return(await Promise.all(s(i).map(async([i,s])=>{let{ignoreDirs:c,supportedFiles:l,scanFunction:u}=s,d=[...n,...c].filter(e=>e.length>0);try{let n=await a(`${e}/**/${l.join(`|`)}`,{ignore:d.map(t=>`${e}/**/${t}`),unique:!0,onlyFiles:!0});t.info(o.magenta(`Scanning: ${n.length} files of type ${i}`));let s=n.map(t=>u(t).map(n=>({...n,relativePath:t.replace(`${e}/`,``)}))).flat();return t.info(o.green(`Found: ${s.length} packages and ${s.map(({softwareDevelopmentKits:e=[]})=>e).flat().length} sdks`)),s.map(e=>({...e,type:i,repositoryName:r}))}catch(e){throw Error(`Error scanning globs ${l} with error: ${e}`)}}))).flat()}const d=`A repository name must be provided. You can specify using --repositoryName=$REPO_NAME or by ensuring the command "git config --get remote.origin.url" returns the name of the repository`;async function f({auth:t,scanPath:i,ignoreDirs:a,repositoryName:s,transcendUrl:f}){r(this.process);let p=s;if(!p)try{let e=l(`cd ${i} && git config --get remote.origin.url`).toString(`utf-8`).trim();[p]=e.includes(`https:`)?e.split(`/`).slice(3).join(`/`).split(`.`):(e.split(`:`).pop()||``).split(`.`),p||(this.logger.error(o.red(d)),this.process.exit(1))}catch(e){this.logger.error(o.red(`${d} - Got error: ${e.message}`)),this.process.exit(1)}let m=c(f,t),h=await u({scanPath:i,ignoreDirs:a,repositoryName:p});await n(m,h);let g=new URL(e);g.pathname=`/code-scanning/code-packages`,this.logger.info(o.green(`Scan found ${h.length} packages at ${i}! View results at '${g.href}'`))}export{f as scanPackages};
2
+ //# sourceMappingURL=impl-INhq_CiK.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl-INhq_CiK.mjs","names":[],"sources":["../src/lib/code-scanning/findCodePackagesInFolder.ts","../src/commands/inventory/scan-packages/impl.ts"],"sourcesContent":["import { getEntries } from '@transcend-io/type-utils';\nimport colors from 'colors';\nimport fastGlob from 'fast-glob';\n\nimport { CodePackageInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { CODE_SCANNING_CONFIGS } from './constants.js';\n\n/**\n * Helper to scan and discovery all of the code packages within a folder\n *\n * @param options - Options\n * @returns the list of integrations\n */\nexport async function findCodePackagesInFolder({\n scanPath,\n ignoreDirs = [],\n repositoryName,\n}: {\n /** The name of the github repository reporting packages for */\n repositoryName: string;\n /** Where to look for package.json files */\n scanPath: string;\n /** The directories to ignore (excludes node_modules and serverless-build) */\n ignoreDirs?: string[];\n}): Promise<CodePackageInput[]> {\n const allCodePackages = await Promise.all(\n getEntries(CODE_SCANNING_CONFIGS).map(async ([codePackageType, config]) => {\n const { ignoreDirs: configIgnoreDirs, supportedFiles, scanFunction } = config;\n const dirsToIgnore = [...ignoreDirs, ...configIgnoreDirs].filter((dir) => dir.length > 0);\n try {\n const filesToScan: string[] = await fastGlob(`${scanPath}/**/${supportedFiles.join('|')}`, {\n ignore: dirsToIgnore.map((dir: string) => `${scanPath}/**/${dir}`),\n unique: true,\n onlyFiles: true,\n });\n logger.info(\n colors.magenta(`Scanning: ${filesToScan.length} files of type ${codePackageType}`),\n );\n const allPackages = filesToScan\n .map((filePath) =>\n scanFunction(filePath).map((result) => ({\n ...result,\n relativePath: filePath.replace(`${scanPath}/`, ''),\n })),\n )\n .flat();\n logger.info(\n colors.green(\n `Found: ${allPackages.length} packages and ${\n allPackages.map(({ softwareDevelopmentKits = [] }) => softwareDevelopmentKits).flat()\n .length\n } sdks`,\n ),\n );\n\n return allPackages.map(\n (pkg): CodePackageInput => ({\n ...pkg,\n type: codePackageType,\n repositoryName,\n }),\n );\n } catch (error) {\n throw new Error(`Error scanning globs ${supportedFiles} with error: ${error}`);\n }\n }),\n );\n\n return allCodePackages.flat();\n}\n","import { execSync } from 'child_process';\n\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport colors from 'colors';\n\nimport { ADMIN_DASH } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { findCodePackagesInFolder } from '../../../lib/code-scanning/index.js';\nimport { syncCodePackages } from '../../../lib/graphql/index.js';\n\nconst REPO_ERROR =\n 'A repository name must be provided. ' +\n 'You can specify using --repositoryName=$REPO_NAME or by ensuring the ' +\n 'command \"git config --get remote.origin.url\" returns the name of the repository';\n\nexport interface ScanPackagesCommandFlags {\n auth: string;\n scanPath: string;\n ignoreDirs?: string[];\n repositoryName?: string;\n transcendUrl: string;\n}\n\nexport async function scanPackages(\n this: LocalContext,\n { auth, scanPath, ignoreDirs, repositoryName, transcendUrl }: ScanPackagesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n // Ensure repository name is specified\n let gitRepositoryName = repositoryName;\n if (!gitRepositoryName) {\n try {\n const name = execSync(`cd ${scanPath} && git config --get remote.origin.url`);\n // Trim and parse the URL\n const url = name.toString('utf-8').trim();\n [gitRepositoryName] = !url.includes('https:')\n ? (url.split(':').pop() || '').split('.')\n : url.split('/').slice(3).join('/').split('.');\n if (!gitRepositoryName) {\n this.logger.error(colors.red(REPO_ERROR));\n this.process.exit(1);\n }\n } catch (err) {\n this.logger.error(colors.red(`${REPO_ERROR} - Got error: ${err.message}`));\n this.process.exit(1);\n }\n }\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Scan the codebase to discovery packages\n const results = await findCodePackagesInFolder({\n scanPath,\n ignoreDirs,\n repositoryName: gitRepositoryName,\n });\n\n // Report scan to Transcend\n await syncCodePackages(client, results);\n\n const newUrl = new URL(ADMIN_DASH);\n newUrl.pathname = '/code-scanning/code-packages';\n\n // Indicate success\n this.logger.info(\n colors.green(\n `Scan found ${results.length} packages at ${scanPath}! ` + `View results at '${newUrl.href}'`,\n ),\n );\n}\n"],"mappings":"qbAcA,eAAsB,EAAyB,CAC7C,WACA,aAAa,EAAE,CACf,kBAQ8B,CA4C9B,OAAO,MA3CuB,QAAQ,IACpC,EAAW,EAAsB,CAAC,IAAI,MAAO,CAAC,EAAiB,KAAY,CACzE,GAAM,CAAE,WAAY,EAAkB,iBAAgB,gBAAiB,EACjE,EAAe,CAAC,GAAG,EAAY,GAAG,EAAiB,CAAC,OAAQ,GAAQ,EAAI,OAAS,EAAE,CACzF,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,KACL,EAAO,QAAQ,aAAa,EAAY,OAAO,iBAAiB,IAAkB,CACnF,CACD,IAAM,EAAc,EACjB,IAAK,GACJ,EAAa,EAAS,CAAC,IAAK,IAAY,CACtC,GAAG,EACH,aAAc,EAAS,QAAQ,GAAG,EAAS,GAAI,GAAG,CACnD,EAAE,CACJ,CACA,MAAM,CAUT,OATA,EAAO,KACL,EAAO,MACL,UAAU,EAAY,OAAO,gBAC3B,EAAY,KAAK,CAAE,0BAA0B,EAAE,IAAO,EAAwB,CAAC,MAAM,CAClF,OACJ,OACF,CACF,CAEM,EAAY,IAChB,IAA2B,CAC1B,GAAG,EACH,KAAM,EACN,iBACD,EACF,OACM,EAAO,CACd,MAAU,MAAM,wBAAwB,EAAe,eAAe,IAAQ,GAEhF,CACH,EAEsB,MAAM,CC1D/B,MAAM,EACJ,2LAYF,eAAsB,EAEpB,CAAE,OAAM,WAAU,aAAY,iBAAgB,gBAC/B,CACf,EAAoB,KAAK,QAAQ,CAGjC,IAAI,EAAoB,EACxB,GAAI,CAAC,EACH,GAAI,CAGF,IAAM,EAFO,EAAS,MAAM,EAAS,wCAErB,CAAC,SAAS,QAAQ,CAAC,MAAM,CACzC,CAAC,GAAsB,EAAI,SAAS,SAAS,CAEzC,EAAI,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC,MAAM,IAAI,EAD3C,EAAI,MAAM,IAAI,CAAC,KAAK,EAAI,IAAI,MAAM,IAAI,CAEtC,IACH,KAAK,OAAO,MAAM,EAAO,IAAI,EAAW,CAAC,CACzC,KAAK,QAAQ,KAAK,EAAE,QAEf,EAAK,CACZ,KAAK,OAAO,MAAM,EAAO,IAAI,GAAG,EAAW,gBAAgB,EAAI,UAAU,CAAC,CAC1E,KAAK,QAAQ,KAAK,EAAE,CAKxB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAU,MAAM,EAAyB,CAC7C,WACA,aACA,eAAgB,EACjB,CAAC,CAGF,MAAM,EAAiB,EAAQ,EAAQ,CAEvC,IAAM,EAAS,IAAI,IAAI,EAAW,CAClC,EAAO,SAAW,+BAGlB,KAAK,OAAO,KACV,EAAO,MACL,cAAc,EAAQ,OAAO,eAAe,EAAS,qBAA0B,EAAO,KAAK,GAC5F,CACF"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./pushManualEnrichmentIdentifiersFromCsv-BDtMo13j.mjs";import{t}from"./done-input-validation-Cjk7a3jX.mjs";async function n({auth:n,transcendUrl:r,file:i,enricherId:a,concurrency:o,markSilent:s,sombraAuth:c}){t(this.process),await e({file:i,transcendUrl:r,enricherId:a,concurrency:o,markSilent:s,auth:n,sombraAuth:c})}export{n as pushIdentifiers};
2
- //# sourceMappingURL=impl-KKrDTraf.mjs.map
1
+ import{t as e}from"./pushManualEnrichmentIdentifiersFromCsv-B0i2239u.mjs";import{t}from"./done-input-validation-BUz-aVC5.mjs";async function n({auth:n,transcendUrl:r,file:i,enricherId:a,concurrency:o,markSilent:s,sombraAuth:c}){t(this.process),await e({file:i,transcendUrl:r,enricherId:a,concurrency:o,markSilent:s,auth:n,sombraAuth:c})}export{n as pushIdentifiers};
2
+ //# sourceMappingURL=impl-KmCNH-yw.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-KKrDTraf.mjs","names":[],"sources":["../src/commands/request/preflight/push-identifiers/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { pushManualEnrichmentIdentifiersFromCsv } from '../../../../lib/manual-enrichment/index.js';\n\nexport interface PushIdentifiersCommandFlags {\n auth: string;\n enricherId: string;\n sombraAuth?: string;\n transcendUrl: string;\n file: string;\n markSilent: boolean;\n concurrency: number;\n}\n\nexport async function pushIdentifiers(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n file,\n enricherId,\n concurrency,\n markSilent,\n sombraAuth,\n }: PushIdentifiersCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await pushManualEnrichmentIdentifiersFromCsv({\n file,\n transcendUrl,\n enricherId,\n concurrency,\n markSilent,\n auth,\n sombraAuth,\n });\n}\n"],"mappings":"8HAcA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,aACA,cACA,aACA,cAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAuC,CAC3C,OACA,eACA,aACA,cACA,aACA,OACA,aACD,CAAC"}
1
+ {"version":3,"file":"impl-KmCNH-yw.mjs","names":[],"sources":["../src/commands/request/preflight/push-identifiers/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { pushManualEnrichmentIdentifiersFromCsv } from '../../../../lib/manual-enrichment/index.js';\n\nexport interface PushIdentifiersCommandFlags {\n auth: string;\n enricherId: string;\n sombraAuth?: string;\n transcendUrl: string;\n file: string;\n markSilent: boolean;\n concurrency: number;\n}\n\nexport async function pushIdentifiers(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n file,\n enricherId,\n concurrency,\n markSilent,\n sombraAuth,\n }: PushIdentifiersCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await pushManualEnrichmentIdentifiersFromCsv({\n file,\n transcendUrl,\n enricherId,\n concurrency,\n markSilent,\n auth,\n sombraAuth,\n });\n}\n"],"mappings":"8HAcA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,aACA,cACA,aACA,cAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAuC,CAC3C,OACA,eACA,aACA,cACA,aACA,OACA,aACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./bulkRetryEnrichers-BA9cboSe.mjs";import{t}from"./done-input-validation-Cjk7a3jX.mjs";async function n({auth:n,enricherId:r,actions:i,requestEnricherStatuses:a,requestIds:o,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u,concurrency:d,transcendUrl:f}){t(this.process),await e({auth:n,enricherId:r,requestActions:i,requestEnricherStatuses:a,requestIds:o,createdAtBefore:s?new Date(s):void 0,createdAtAfter:c?new Date(c):void 0,updatedAtBefore:l?new Date(l):void 0,updatedAtAfter:u?new Date(u):void 0,concurrency:d,transcendUrl:f})}export{n as enricherRestart};
2
- //# sourceMappingURL=impl-CE56-wQh.mjs.map
1
+ import{t as e}from"./bulkRetryEnrichers-DaLE67Ht.mjs";import{t}from"./done-input-validation-BUz-aVC5.mjs";async function n({auth:n,enricherId:r,actions:i,requestEnricherStatuses:a,requestIds:o,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u,concurrency:d,transcendUrl:f}){t(this.process),await e({auth:n,enricherId:r,requestActions:i,requestEnricherStatuses:a,requestIds:o,createdAtBefore:s?new Date(s):void 0,createdAtAfter:c?new Date(c):void 0,updatedAtBefore:l?new Date(l):void 0,updatedAtAfter:u?new Date(u):void 0,concurrency:d,transcendUrl:f})}export{n as enricherRestart};
2
+ //# sourceMappingURL=impl-RPG-BTmX.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-CE56-wQh.mjs","names":[],"sources":["../src/commands/request/enricher-restart/impl.ts"],"sourcesContent":["import type { RequestAction, RequestEnricherStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { bulkRetryEnrichers } from '../../../lib/requests/index.js';\n\nexport interface EnricherRestartCommandFlags {\n auth: string;\n enricherId: string;\n actions?: RequestAction[];\n requestEnricherStatuses?: RequestEnricherStatus[];\n transcendUrl: string;\n concurrency: number;\n requestIds?: string[];\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n}\n\nexport async function enricherRestart(\n this: LocalContext,\n {\n auth,\n enricherId,\n actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n transcendUrl,\n }: EnricherRestartCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await bulkRetryEnrichers({\n auth,\n enricherId,\n requestActions: actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore: createdAtBefore ? new Date(createdAtBefore) : undefined,\n createdAtAfter: createdAtAfter ? new Date(createdAtAfter) : undefined,\n updatedAtBefore: updatedAtBefore ? new Date(updatedAtBefore) : undefined,\n updatedAtAfter: updatedAtAfter ? new Date(updatedAtAfter) : undefined,\n concurrency,\n transcendUrl,\n });\n}\n"],"mappings":"0GAoBA,eAAsB,EAEpB,CACE,OACA,aACA,UACA,0BACA,aACA,kBACA,iBACA,kBACA,iBACA,cACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAmB,CACvB,OACA,aACA,eAAgB,EAChB,0BACA,aACA,gBAAiB,EAAkB,IAAI,KAAK,EAAgB,CAAG,IAAA,GAC/D,eAAgB,EAAiB,IAAI,KAAK,EAAe,CAAG,IAAA,GAC5D,gBAAiB,EAAkB,IAAI,KAAK,EAAgB,CAAG,IAAA,GAC/D,eAAgB,EAAiB,IAAI,KAAK,EAAe,CAAG,IAAA,GAC5D,cACA,eACD,CAAC"}
1
+ {"version":3,"file":"impl-RPG-BTmX.mjs","names":[],"sources":["../src/commands/request/enricher-restart/impl.ts"],"sourcesContent":["import type { RequestAction, RequestEnricherStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { bulkRetryEnrichers } from '../../../lib/requests/index.js';\n\nexport interface EnricherRestartCommandFlags {\n auth: string;\n enricherId: string;\n actions?: RequestAction[];\n requestEnricherStatuses?: RequestEnricherStatus[];\n transcendUrl: string;\n concurrency: number;\n requestIds?: string[];\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n}\n\nexport async function enricherRestart(\n this: LocalContext,\n {\n auth,\n enricherId,\n actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n transcendUrl,\n }: EnricherRestartCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await bulkRetryEnrichers({\n auth,\n enricherId,\n requestActions: actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore: createdAtBefore ? new Date(createdAtBefore) : undefined,\n createdAtAfter: createdAtAfter ? new Date(createdAtAfter) : undefined,\n updatedAtBefore: updatedAtBefore ? new Date(updatedAtBefore) : undefined,\n updatedAtAfter: updatedAtAfter ? new Date(updatedAtAfter) : undefined,\n concurrency,\n transcendUrl,\n });\n}\n"],"mappings":"0GAoBA,eAAsB,EAEpB,CACE,OACA,aACA,UACA,0BACA,aACA,kBACA,iBACA,kBACA,iBACA,cACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAmB,CACvB,OACA,aACA,eAAgB,EAChB,0BACA,aACA,gBAAiB,EAAkB,IAAI,KAAK,EAAgB,CAAG,IAAA,GAC/D,eAAgB,EAAiB,IAAI,KAAK,EAAe,CAAG,IAAA,GAC5D,gBAAiB,EAAkB,IAAI,KAAK,EAAgB,CAAG,IAAA,GAC/D,eAAgB,EAAiB,IAAI,KAAK,EAAe,CAAG,IAAA,GAC5D,cACA,eACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./notifyPrivacyRequestsAdditionalTime-BPIYuCov.mjs";import{t}from"./done-input-validation-Cjk7a3jX.mjs";async function n({auth:n,transcendUrl:r,createdAtBefore:i,createdAtAfter:a,updatedAtBefore:o,updatedAtAfter:s,actions:c,daysLeft:l,days:u,requestIds:d,emailTemplate:f,concurrency:p}){t(this.process),await e({transcendUrl:r,requestActions:c,auth:n,emailTemplate:f,days:u,daysLeft:l,requestIds:d,concurrency:p,createdAtBefore:i,createdAtAfter:a,updatedAtBefore:o,updatedAtAfter:s})}export{n as notifyAdditionalTime};
2
- //# sourceMappingURL=impl-amV0wRWk.mjs.map
1
+ import{t as e}from"./notifyPrivacyRequestsAdditionalTime-D3Vtvg5G.mjs";import{t}from"./done-input-validation-BUz-aVC5.mjs";async function n({auth:n,transcendUrl:r,createdAtBefore:i,createdAtAfter:a,updatedAtBefore:o,updatedAtAfter:s,actions:c,daysLeft:l,days:u,requestIds:d,emailTemplate:f,concurrency:p}){t(this.process),await e({transcendUrl:r,requestActions:c,auth:n,emailTemplate:f,days:u,daysLeft:l,requestIds:d,concurrency:p,createdAtBefore:i,createdAtAfter:a,updatedAtBefore:o,updatedAtAfter:s})}export{n as notifyAdditionalTime};
2
+ //# sourceMappingURL=impl-XrTL-TDl.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-amV0wRWk.mjs","names":[],"sources":["../src/commands/request/notify-additional-time/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 { notifyPrivacyRequestsAdditionalTime } from '../../../lib/requests/index.js';\n\nexport interface NotifyAdditionalTimeCommandFlags {\n auth: string;\n createdAtBefore: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n actions?: RequestAction[];\n daysLeft: number;\n days: number;\n requestIds?: string[];\n emailTemplate: string;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function notifyAdditionalTime(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n actions,\n daysLeft,\n days,\n requestIds,\n emailTemplate,\n concurrency,\n }: NotifyAdditionalTimeCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await notifyPrivacyRequestsAdditionalTime({\n transcendUrl,\n requestActions: actions,\n auth,\n emailTemplate,\n days,\n daysLeft,\n requestIds,\n concurrency,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n });\n}\n"],"mappings":"2HAqBA,eAAsB,EAEpB,CACE,OACA,eACA,kBACA,iBACA,kBACA,iBACA,UACA,WACA,OACA,aACA,gBACA,eAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAoC,CACxC,eACA,eAAgB,EAChB,OACA,gBACA,OACA,WACA,aACA,cACA,kBACA,iBACA,kBACA,iBACD,CAAC"}
1
+ {"version":3,"file":"impl-XrTL-TDl.mjs","names":[],"sources":["../src/commands/request/notify-additional-time/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 { notifyPrivacyRequestsAdditionalTime } from '../../../lib/requests/index.js';\n\nexport interface NotifyAdditionalTimeCommandFlags {\n auth: string;\n createdAtBefore: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n actions?: RequestAction[];\n daysLeft: number;\n days: number;\n requestIds?: string[];\n emailTemplate: string;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function notifyAdditionalTime(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n actions,\n daysLeft,\n days,\n requestIds,\n emailTemplate,\n concurrency,\n }: NotifyAdditionalTimeCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await notifyPrivacyRequestsAdditionalTime({\n transcendUrl,\n requestActions: actions,\n auth,\n emailTemplate,\n days,\n daysLeft,\n requestIds,\n concurrency,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n });\n}\n"],"mappings":"2HAqBA,eAAsB,EAEpB,CACE,OACA,eACA,kBACA,iBACA,kBACA,iBACA,UACA,WACA,OACA,aACA,gBACA,eAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAoC,CACxC,eACA,eAAgB,EAChB,OACA,gBACA,OACA,WACA,aACA,cACA,kBACA,iBACA,kBACA,iBACD,CAAC"}
@@ -0,0 +1,2 @@
1
+ import{i as e,n as t,o as n,r,t as i}from"./scaffold-templates-DzDGTZie.mjs";import{t as a}from"./done-input-validation-BUz-aVC5.mjs";import{h as o,n as s,p as c,r as l,t as u}from"./prompts-ClBXdELk.mjs";import{t as d}from"./missing-manifest-DgcukXfg.mjs";import{a as f,i as p,o as m}from"./deno-runtime-DV52X8-P.mjs";import{t as h}from"./project-plan-apply-Dvndx455.mjs";import{a as g,l as _,o as v,r as y,s as b,t as x,u as S}from"./scaffold-planning-CNv83t_v.mjs";import{CustomFunctionType as C}from"@transcend-io/privacy-types";import{join as w}from"node:path";import T from"colors";function E(e,t,n){return!e.json&&!e.noInteractive&&!!(t&&n)}async function D(n){let i=await n.select(`Custom Function type:`,[{name:r[C.General],value:C.General},{name:r[C.Dsr],value:C.Dsr}],C.General),a=e[i];if(a.length<2){let[e]=a;if(e===void 0)throw Error(`No Custom Function templates are defined for type ${i}.`);return e}return n.select(`Template:`,a.map(e=>({name:t[e],value:e})),a[0])}async function O(e,t){a(this.process);try{let r=f(this,{...t?{directory:t}:{},...e.manifest?{manifest:e.manifest}:{}});if(!this.fs.existsSync(r.manifestPath)){let e=this.process.cwd();throw Error(d({cwd:e,manifestPath:r.manifestPath,discoveredManifestPaths:p(this,e),command:`new`}))}let a=new s(this),u=E(e,this.process.stdin.isTTY,this.process.stderr.isTTY),C=e.name??(u?await a.text(`Custom Function display name:`,void 0,e=>{try{return n(e),!0}catch(e){return e instanceof Error?e.message:String(e)}}):void 0);if(!C)throw Error(`Missing Custom Function name. Pass --name in a non-interactive invocation.`);let O=e.template??(u?await D(a):void 0);if(!O||!i.includes(O))throw Error(`Missing Custom Function template. Pass --template=general, --template=dsr-datapoint, --template=dsr-enricher, or --template=dsr-both.`);let k=v(C,O),A=x({state:r,snapshots:l(this,r.manifestDirectory,y(r,k))},{generated:k});this.fs.existsSync(r.denoConfigPath)||A.warnings.push(`No Deno configuration was found. Run transcend custom-functions init ${m(r.targetDirectory,r.manifestPath,this.process.cwd())} --deno --noInteractive.`),e.json||this.logger.info(o(A,{cwd:this.process.cwd(),title:`Custom Function plan`,details:[{label:`Target`,path:A.targetDirectory},{label:`Manifest`,path:A.manifestPath}]}));let j=A.changes.length===0||e.dryRun;if(A.changes.length>0&&!e.dryRun)if(e.yes)j=!0;else if(u)j=await a.confirm(`Apply this complete plan?`,!0);else throw Error(`The plan requires approval in a non-interactive invocation. Review with --dryRun, then pass --yes.`);j&&!e.dryRun&&A.changes.length>0&&await h(this,A);let M=j&&!e.dryRun&&A.changes.length>0,N=r.existingSkillDirectories.some(({path:e})=>this.fs.existsSync(w(r.projectRoot,e,S,`SKILL.md`))),P=_({displayName:k.displayName,sourcePath:c(this.process.cwd(),w(r.manifestDirectory,k.sourceFile.path)),targetDirectory:c(this.process.cwd(),r.targetDirectory),manifestPath:c(this.process.cwd(),r.manifestPath),hasSkill:N,variableNames:g(k.manifestEntry)}),F=b(A,{applied:M,dryRun:e.dryRun,cwd:this.process.cwd(),aiHandoff:P});if(e.json){this.process.stdout.write(`${JSON.stringify(F)}\n`);return}if(e.dryRun){this.logger.info(T.yellow(`Dry run complete. No changes were written.`));return}if(!j){this.logger.info(T.yellow(`No changes applied.`));return}this.logger.info(T.green(`Custom Function added.`)),A.nextSteps.length>0&&(this.logger.info(`\n${T.bold(`Next steps`)}`),A.nextSteps.forEach(e=>this.logger.info(e))),this.logger.info(`\n${T.bold(`AI handoff — paste into your coding agent`)}`),this.logger.info(P)}catch(e){throw e instanceof u&&this.process.exit(130),e}}export{O as _new,O as newCustomFunction};
2
+ //# sourceMappingURL=impl-Z8oWVENM.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl-Z8oWVENM.mjs","names":[],"sources":["../src/commands/custom-functions/new/impl.ts"],"sourcesContent":["import { join } from 'node:path';\n\nimport { CustomFunctionType } from '@transcend-io/privacy-types';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { buildNewFunctionAiHandoff } from '../../../lib/custom-functions/ai-handoff.js';\nimport { CUSTOM_FUNCTION_SKILL_NAME } from '../../../lib/custom-functions/custom-function-skill.js';\nimport { formatMissingManifestMessage } from '../../../lib/custom-functions/missing-manifest.js';\nimport { buildCustomFunctionProjectArguments } from '../../../lib/custom-functions/paths.js';\nimport {\n discoverCustomFunctionManifests,\n discoverCustomFunctionProject,\n} from '../../../lib/custom-functions/project-discovery.js';\nimport { buildPlanResult } from '../../../lib/custom-functions/scaffold-output.js';\nimport {\n buildAddFunctionPlan,\n getAddFunctionPlanningCandidatePaths,\n parameterNamesInManifestValue,\n prepareGeneratedCustomFunction,\n} from '../../../lib/custom-functions/scaffold-planning.js';\nimport {\n CUSTOM_FUNCTION_TEMPLATE_NAMES,\n CUSTOM_FUNCTION_TEMPLATE_PROMPT_LABELS,\n CUSTOM_FUNCTION_TYPE_PROMPT_LABELS,\n TEMPLATES_FOR_CUSTOM_FUNCTION_TYPE,\n type CustomFunctionTemplateName,\n validateCustomFunctionDisplayName,\n} from '../../../lib/custom-functions/scaffold-templates.js';\nimport { collectPlanningSnapshots } from '../../../lib/scaffolding/project-discovery.js';\nimport { applyProjectPlan } from '../../../lib/scaffolding/project-plan-apply.js';\nimport {\n displayProjectPath,\n renderProjectPlan,\n} from '../../../lib/scaffolding/project-plan-output.js';\nimport { PromptCancelledError, ScaffoldPrompts } from '../../../lib/scaffolding/prompts.js';\n\n/** Flags for `custom-functions new`. */\nexport interface CustomFunctionNewFlags {\n /** Explicit existing manifest path. */\n manifest?: string;\n /** Custom Function display name. */\n name?: string;\n /** Starter handler shape. */\n template?: CustomFunctionTemplateName;\n /** Disable prompts. */\n noInteractive: boolean;\n /** Render but do not apply. */\n dryRun: boolean;\n /** Approve the final displayed plan. */\n yes: boolean;\n /** Emit one stable JSON result on stdout. */\n json: boolean;\n}\n\n/**\n * Whether this invocation can ask questions.\n *\n * @param context - CLI context\n * @param flags - Interaction flags\n * @returns Whether prompts are enabled\n */\nfunction isInteractiveInvocation(\n flags: Pick<CustomFunctionNewFlags, 'json' | 'noInteractive'>,\n stdinIsTTY: boolean | undefined,\n stderrIsTTY: boolean | undefined,\n): boolean {\n return !flags.json && !flags.noInteractive && Boolean(stdinIsTTY && stderrIsTTY);\n}\n\n/**\n * Ask for the product-level function type, then its available starter template.\n *\n * General currently has one template, so selecting it completes the choice immediately.\n *\n * @param prompts - Context-bound prompt adapter\n * @returns Selected starter template\n */\nexport async function selectInteractiveTemplate(\n prompts: Pick<ScaffoldPrompts, 'select'>,\n): Promise<CustomFunctionTemplateName> {\n const functionType = await prompts.select<CustomFunctionType>(\n 'Custom Function type:',\n [\n {\n name: CUSTOM_FUNCTION_TYPE_PROMPT_LABELS[CustomFunctionType.General],\n value: CustomFunctionType.General,\n },\n {\n name: CUSTOM_FUNCTION_TYPE_PROMPT_LABELS[CustomFunctionType.Dsr],\n value: CustomFunctionType.Dsr,\n },\n ],\n CustomFunctionType.General,\n );\n const templates = TEMPLATES_FOR_CUSTOM_FUNCTION_TYPE[functionType];\n if (templates.length < 2) {\n const [onlyTemplate] = templates;\n if (onlyTemplate === undefined) {\n throw new Error(`No Custom Function templates are defined for type ${functionType}.`);\n }\n return onlyTemplate;\n }\n return prompts.select<CustomFunctionTemplateName>(\n 'Template:',\n templates.map((value) => ({\n name: CUSTOM_FUNCTION_TEMPLATE_PROMPT_LABELS[value],\n value,\n })),\n templates[0],\n );\n}\n\n/**\n * Scaffold one deterministic local Custom Function.\n *\n * @param this - CLI context\n * @param flags - Template and interaction flags\n * @param directory - Optional target directory\n */\nexport async function _new(\n this: LocalContext,\n flags: CustomFunctionNewFlags,\n directory?: string,\n): Promise<void> {\n doneInputValidation(this.process);\n try {\n const state = discoverCustomFunctionProject(this, {\n ...(directory ? { directory } : {}),\n ...(flags.manifest ? { manifest: flags.manifest } : {}),\n });\n if (!this.fs.existsSync(state.manifestPath)) {\n const cwd = this.process.cwd();\n throw new Error(\n formatMissingManifestMessage({\n cwd,\n manifestPath: state.manifestPath,\n discoveredManifestPaths: discoverCustomFunctionManifests(this, cwd),\n command: 'new',\n }),\n );\n }\n const prompts = new ScaffoldPrompts(this);\n const interactive = isInteractiveInvocation(\n flags,\n this.process.stdin.isTTY,\n this.process.stderr.isTTY,\n );\n const name =\n flags.name ??\n (interactive\n ? await prompts.text('Custom Function display name:', undefined, (value) => {\n try {\n validateCustomFunctionDisplayName(value);\n return true;\n } catch (error) {\n return error instanceof Error ? error.message : String(error);\n }\n })\n : undefined);\n if (!name) {\n throw new Error('Missing Custom Function name. Pass --name in a non-interactive invocation.');\n }\n const template =\n flags.template ?? (interactive ? await selectInteractiveTemplate(prompts) : undefined);\n if (!template || !CUSTOM_FUNCTION_TEMPLATE_NAMES.includes(template)) {\n throw new Error(\n 'Missing Custom Function template. Pass --template=general, --template=dsr-datapoint, --template=dsr-enricher, or --template=dsr-both.',\n );\n }\n const generated = prepareGeneratedCustomFunction(name, template);\n const snapshots = collectPlanningSnapshots(\n this,\n state.manifestDirectory,\n getAddFunctionPlanningCandidatePaths(state, generated),\n );\n const plan = buildAddFunctionPlan(\n {\n state,\n snapshots,\n },\n { generated },\n );\n if (!this.fs.existsSync(state.denoConfigPath)) {\n plan.warnings.push(\n `No Deno configuration was found. Run ` +\n `transcend custom-functions init ${buildCustomFunctionProjectArguments(\n state.targetDirectory,\n state.manifestPath,\n this.process.cwd(),\n )} --deno --noInteractive.`,\n );\n }\n if (!flags.json) {\n this.logger.info(\n renderProjectPlan(plan, {\n cwd: this.process.cwd(),\n title: 'Custom Function plan',\n details: [\n { label: 'Target', path: plan.targetDirectory },\n { label: 'Manifest', path: plan.manifestPath },\n ],\n }),\n );\n }\n\n let approved = plan.changes.length === 0 || flags.dryRun;\n if (plan.changes.length > 0 && !flags.dryRun) {\n if (flags.yes) {\n approved = true;\n } else if (interactive) {\n approved = await prompts.confirm('Apply this complete plan?', true);\n } else {\n throw new Error(\n 'The plan requires approval in a non-interactive invocation. Review with --dryRun, then pass --yes.',\n );\n }\n }\n\n if (approved && !flags.dryRun && plan.changes.length > 0) {\n await applyProjectPlan(this, plan);\n }\n const applied = approved && !flags.dryRun && plan.changes.length > 0;\n const hasSkill = state.existingSkillDirectories.some(({ path }) =>\n this.fs.existsSync(join(state.projectRoot, path, CUSTOM_FUNCTION_SKILL_NAME, 'SKILL.md')),\n );\n const aiHandoff = buildNewFunctionAiHandoff({\n displayName: generated.displayName,\n sourcePath: displayProjectPath(\n this.process.cwd(),\n join(state.manifestDirectory, generated.sourceFile.path),\n ),\n targetDirectory: displayProjectPath(this.process.cwd(), state.targetDirectory),\n manifestPath: displayProjectPath(this.process.cwd(), state.manifestPath),\n hasSkill,\n variableNames: parameterNamesInManifestValue(generated.manifestEntry),\n });\n const result = buildPlanResult(plan, {\n applied,\n dryRun: flags.dryRun,\n cwd: this.process.cwd(),\n aiHandoff,\n });\n if (flags.json) {\n this.process.stdout.write(`${JSON.stringify(result)}\\n`);\n return;\n }\n if (flags.dryRun) {\n this.logger.info(colors.yellow('Dry run complete. No changes were written.'));\n return;\n }\n if (!approved) {\n this.logger.info(colors.yellow('No changes applied.'));\n return;\n }\n this.logger.info(colors.green('Custom Function added.'));\n if (plan.nextSteps.length > 0) {\n this.logger.info(`\\n${colors.bold('Next steps')}`);\n plan.nextSteps.forEach((step) => this.logger.info(step));\n }\n this.logger.info(`\\n${colors.bold('AI handoff — paste into your coding agent')}`);\n this.logger.info(aiHandoff);\n } catch (error) {\n if (error instanceof PromptCancelledError) {\n this.process.exit(130);\n }\n throw error;\n }\n}\n\nexport { _new as newCustomFunction };\n"],"mappings":"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"}
@@ -1,4 +1,4 @@
1
- import{t as e}from"./parseVariablesFromString-Cr3x2uq3.mjs";import{t}from"./done-input-validation-Cjk7a3jX.mjs";import{a as n,c as r,i,r as a,s as o,t as s}from"./deno-runtime-QqwBDKXX.mjs";import{t as c}from"./missing-manifest-BKj1j-jg.mjs";import{c as l,i as u,r as d,s as f}from"./manifest-DVuW_vvO.mjs";import{t as p}from"./run-captured-process-CpZBh0lG.mjs";import{t as m}from"./module-graph-DBC7ZvyA.mjs";import{CustomFunctionPayloadType as h,CustomFunctionType as g}from"@transcend-io/privacy-types";import{tmpdir as _}from"node:os";import{join as v}from"node:path";import y from"colors";import{Buffer as b}from"node:buffer";import{DSR_DATAPOINT_CUSTOM_FUNCTION_PAYLOAD_SCHEMA as x,DSR_REQUEST_ENRICHER_CUSTOM_FUNCTION_PAYLOAD_SCHEMA as S,GENERAL_CUSTOM_FUNCTION_PAYLOAD_SCHEMA as C}from"@transcend-io/custom-function-types";import w from"ajv";import{stripVTControlCharacters as T}from"node:util";const E=3e4,D=1024*1024,O=v(_(),`transcend-custom-functions-deno`),k=new w({allErrors:!0,strict:!1}),A={general:k.compile(C),datapoint:k.compile(x),enricher:k.compile(S)};function j(e,t,n){let r=t,i=r.extras??{},a=i.profile,o=e.type??g.General,s=o===g.Dsr&&n!==h.RequestEnricher&&a?.identifier===`{{identifier}}`?{...a,identifier:`example-identifier`}:a,c=i.dataSilo,l=o===g.Dsr?{...i,...s?{profile:s}:{},dataSilo:{title:e.name,description:``,link:``,...c,id:e.dataSiloId??c?.id??`00000000-0000-4000-8000-000000000000`}}:s?{...i,profile:s}:i;return{...r,...Object.keys(l).length>0?{extras:l}:{},coreIdentifier:r.coreIdentifier??{value:`example-identifier`}}}function M(e,t){let n=(e.type??g.General)===g.Dsr?t.payloadType===h.RequestEnricher?A.enricher:A.datapoint:A.general;if(!n(t.payload)){let t=(n.errors??[]).map(e=>`${e.instancePath||`/`} ${e.message??`is invalid`}`).join(`; `);throw Error(`Invalid test payload for "${e.name}": ${t}`)}}function N(e,t,n={}){M(e,t);let r=e.env??{},i=Object.keys(r),a=e.allowedHosts??[];f(e);let o=n.allowNetwork?a.length===0?[`--allow-net=localhost`]:a[0]===`*`?[`--allow-net`]:[`--allow-net=${a.join(`,`)}`]:[],s=(e.type??g.General)===g.Dsr&&t.payloadType===h.RequestEnricher?`enricher`:`default`,c=`data:application/javascript;base64,${b.from(`
1
+ import{t as e}from"./parseVariablesFromString-BOSfQ4QF.mjs";import{t}from"./done-input-validation-BUz-aVC5.mjs";import{n,t as r}from"./prompts-ClBXdELk.mjs";import{t as i}from"./missing-manifest-DgcukXfg.mjs";import{a,i as o,r as s,t as c}from"./deno-runtime-DV52X8-P.mjs";import{t as l}from"./path-safety-D5Qwl40b.mjs";import{i as u,r as d,s as f}from"./manifest-BNIpO_zW.mjs";import{t as p}from"./run-captured-process-BXwWXuTh.mjs";import{t as m}from"./module-graph-Cb0g74Ft.mjs";import{CustomFunctionPayloadType as h,CustomFunctionType as g}from"@transcend-io/privacy-types";import{tmpdir as _}from"node:os";import{join as v}from"node:path";import y from"colors";import{Buffer as b}from"node:buffer";import{DSR_DATAPOINT_CUSTOM_FUNCTION_PAYLOAD_SCHEMA as x,DSR_REQUEST_ENRICHER_CUSTOM_FUNCTION_PAYLOAD_SCHEMA as S,GENERAL_CUSTOM_FUNCTION_PAYLOAD_SCHEMA as C}from"@transcend-io/custom-function-types";import w from"ajv";import{stripVTControlCharacters as T}from"node:util";const E=3e4,D=1024*1024,O=v(_(),`transcend-custom-functions-deno`),k=new w({allErrors:!0,strict:!1}),A={general:k.compile(C),datapoint:k.compile(x),enricher:k.compile(S)};function j(e,t,n){let r=t,i=r.extras??{},a=i.profile,o=e.type??g.General,s=o===g.Dsr&&n!==h.RequestEnricher&&a?.identifier===`{{identifier}}`?{...a,identifier:`example-identifier`}:a,c=i.dataSilo,l=o===g.Dsr?{...i,...s?{profile:s}:{},dataSilo:{title:e.name,description:``,link:``,...c,id:e.dataSiloId??c?.id??`00000000-0000-4000-8000-000000000000`}}:s?{...i,profile:s}:i;return{...r,...Object.keys(l).length>0?{extras:l}:{},coreIdentifier:r.coreIdentifier??{value:`example-identifier`}}}function M(e,t){let n=(e.type??g.General)===g.Dsr?t.payloadType===h.RequestEnricher?A.enricher:A.datapoint:A.general;if(!n(t.payload)){let t=(n.errors??[]).map(e=>`${e.instancePath||`/`} ${e.message??`is invalid`}`).join(`; `);throw Error(`Invalid test payload for "${e.name}": ${t}`)}}function N(e,t,n={}){M(e,t);let r=e.env??{},i=Object.keys(r),a=e.allowedHosts??[];f(e);let o=n.allowNetwork?a.length===0?[`--allow-net=localhost`]:a[0]===`*`?[`--allow-net`]:[`--allow-net=${a.join(`,`)}`]:[],s=(e.type??g.General)===g.Dsr&&t.payloadType===h.RequestEnricher?`enricher`:`default`,c=`data:application/javascript;base64,${b.from(`
2
2
  const input = JSON.parse(await new Response(Deno.stdin.readable).text());
3
3
  for (const [name, value] of Object.entries(input.functionArgs.environment)) {
4
4
  Deno.env.set(name, value);
@@ -85,7 +85,7 @@ try {
85
85
  Deno.exit(1);
86
86
  }
87
87
  `).toString(`base64`)}`;return{args:[`run`,`--no-check`,`--no-prompt`,`--no-lock`,`--node-modules-dir=none`,`--vendor=false`,`--allow-read=${O}`,...i.length>0?[`--allow-env=${i.join(`,`)}`]:[],...n.denoConfigPath?[`--config=${n.denoConfigPath}`]:[`--no-config`],...o,...e.allowThirdPartyImports?[]:[`--no-remote`,`--no-npm`],c],input:JSON.stringify({base64Function:b.from(e.code).toString(`base64`),functionToRun:s,functionArgs:{environment:r,payload:j(e,t.payload,t.payloadType),nonce:`local-simulator`}}),env:{...r,DENO_DIR:O,DENO_TLS_CA_STORE:`system`,NO_COLOR:`1`},timeoutMs:e.timeoutMs&&e.timeoutMs>0?Math.min(e.timeoutMs,E):E}}function P(e){return Array.from(T(e.replace(/data:application\/(?:javascript|typescript);base64,[A-Za-z\d+/=]+/gu,`<local-module>`)).replace(/\r(?!\n)/gu,`
88
- `)).filter(e=>{let t=e.codePointAt(0);return t===9||t===10||t>=32&&t!==127&&!(t>=128&&t<=159)}).join(``)}function F(e,t={},n=!1){let r=Object.values(t).filter(e=>e.length>0).map(P).sort((e,t)=>t.length-e.length),i=P(e);if(n){let e=Math.max(0,...r.map(e=>{let t=Math.min(e.length-1,i.length);for(let n=t;n>0;--n)if(i.endsWith(e.slice(0,n)))return n;return 0}));e>0&&(i=i.slice(0,-e))}return r.reduce((e,t)=>e.split(t).join(`[REDACTED]`),i)}function I(e,t=D){let n=b.from(e);if(n.length<=t)return{output:e,truncated:!1};let r=t;for(;r>0&&(n[r]&192)==128;)--r;return{output:n.subarray(0,r).toString(`utf8`),truncated:!0}}function L(e,t){if(!t)return e.length===1?e[0]:void 0;let n=e.filter(e=>e.name===t||e.id===t);if(n.length===0)throw Error(`Custom Function "${t}" was not found in the manifest.`);if(n.length>1)throw Error(`Custom Function selector "${t}" is ambiguous. Pass its manifest ID instead.`);return n[0]}async function R(f,h){t(this.process);try{let t=r(this,{...h?{directory:h}:{},...f.manifest?{manifest:f.manifest}:{}});if(!this.fs.existsSync(t.manifestPath)){let e=this.process.cwd();throw Error(c({cwd:e,manifestPath:t.manifestPath,discoveredManifestPaths:o(this,e),command:`run`}))}let n=d(this.fs.readFileSync(t.manifestPath,`utf8`));if(n.functions.length===0)throw Error(`The Custom Function manifest does not define any functions.`);let g=!f.noInteractive&&!!(this.process.stdin.isTTY&&this.process.stderr.isTTY),_=L(n.functions,f.function);if(!_&&g){let e=await new i(this).select(`Custom Function to run:`,n.functions.map((e,t)=>({name:e.id?`${e.name} (${e.id})`:e.name,value:String(t)})),`0`);_=n.functions[Number(e)]}if(!_)throw Error(`Select a Custom Function with --function in a non-interactive invocation.`);let{config:v,sourcePath:x}=u(t.manifestPath,_,e(f.variables),e=>l(this,t.manifestDirectory,e));if(!v.testPayloads||v.testPayloads.length===0)throw Error(`Custom Function "${v.name}" has no test payloads. Add test-payload or test-payloads to its manifest entry.`);let S=this.fs.existsSync(t.denoConfigPath)?{denoConfigPath:t.denoConfigPath}:{},C=v.testPayloads.map(e=>({testPayload:e,invocation:N(v,e,{...S,allowNetwork:f.allowNetwork})})),w=await p(`deno`,[`--version`],{cwd:t.manifestDirectory},this);if(w.error?.code===`ENOENT`)throw Error(`Deno 2.x is required. Install it from ${s}`);if(w.code!==0)throw Error(`Deno was found, but its version could not be determined.`);let T=a(w.stdout);if(T.level===`error`)throw Error(T.message);T.level===`warning`&&this.logger.warn(T.message);let E=await p(`deno`,[`info`,`--json`,...S.denoConfigPath?[`--config=${S.denoConfigPath}`]:[`--no-config`],x],{cwd:t.manifestDirectory},this);if(E.code!==0)throw Error(`Could not inspect Custom Function runtime imports: ${E.stderr.trim()||`Deno exited with code ${E.code}`}`);let O=m(E.stdout);if(O.length>0)throw Error(`Custom Functions must be self-contained. Local or import-map runtime dependencies are not deployed: ${O.join(`, `)}`);this.logger.warn(y.yellow(`Local simulator: sdk.fetch calls are logged and return HTTP 200 without sending a request; KV state starts empty for each payload.`)),f.allowNetwork?this.logger.warn(y.yellow(`Network enabled: native fetch can make real requests to ${v.allowedHosts?.length?v.allowedHosts.join(`, `):`localhost`}.`)):v.allowedHosts?.length&&this.logger.warn(y.yellow(`Native network access is disabled. Pass --allowNetwork to permit calls to allowed-hosts.`));let k=!1;for(let[e,{invocation:n,testPayload:r}]of C.entries()){let i=r.payloadType??`payload ${e+1}`;this.logger.info(`\n${y.bold(`Running "${v.name}" (${i})`)}`);let a=await p(`deno`,n.args,{cwd:t.manifestDirectory,input:n.input,env:n.env,timeoutMs:n.timeoutMs,maxOutputBytes:D+Math.max(0,...Object.values(v.env??{}).map(e=>b.byteLength(e)))},this),o=v.env??{},s=I(F(a.stdout,o,a.stdoutTruncated)),c=I(F(a.stderr,o,a.stderrTruncated));if(s.output&&this.process.stdout.write(s.output.endsWith(`
88
+ `)).filter(e=>{let t=e.codePointAt(0);return t===9||t===10||t>=32&&t!==127&&!(t>=128&&t<=159)}).join(``)}function F(e,t={},n=!1){let r=Object.values(t).filter(e=>e.length>0).map(P).sort((e,t)=>t.length-e.length),i=P(e);if(n){let e=Math.max(0,...r.map(e=>{let t=Math.min(e.length-1,i.length);for(let n=t;n>0;--n)if(i.endsWith(e.slice(0,n)))return n;return 0}));e>0&&(i=i.slice(0,-e))}return r.reduce((e,t)=>e.split(t).join(`[REDACTED]`),i)}function I(e,t=D){let n=b.from(e);if(n.length<=t)return{output:e,truncated:!1};let r=t;for(;r>0&&(n[r]&192)==128;)--r;return{output:n.subarray(0,r).toString(`utf8`),truncated:!0}}function L(e,t){if(!t)return e.length===1?e[0]:void 0;let n=e.filter(e=>e.name===t||e.id===t);if(n.length===0)throw Error(`Custom Function "${t}" was not found in the manifest.`);if(n.length>1)throw Error(`Custom Function selector "${t}" is ambiguous. Pass its manifest ID instead.`);return n[0]}async function R(f,h){t(this.process);try{let t=a(this,{...h?{directory:h}:{},...f.manifest?{manifest:f.manifest}:{}});if(!this.fs.existsSync(t.manifestPath)){let e=this.process.cwd();throw Error(i({cwd:e,manifestPath:t.manifestPath,discoveredManifestPaths:o(this,e),command:`run`}))}let r=d(this.fs.readFileSync(t.manifestPath,`utf8`));if(r.functions.length===0)throw Error(`The Custom Function manifest does not define any functions.`);let g=!f.noInteractive&&!!(this.process.stdin.isTTY&&this.process.stderr.isTTY),_=L(r.functions,f.function);if(!_&&g){let e=await new n(this).select(`Custom Function to run:`,r.functions.map((e,t)=>({name:e.id?`${e.name} (${e.id})`:e.name,value:String(t)})),`0`);_=r.functions[Number(e)]}if(!_)throw Error(`Select a Custom Function with --function in a non-interactive invocation.`);let{config:v,sourcePath:x}=u(t.manifestPath,_,e(f.variables),e=>l(this,t.manifestDirectory,e));if(!v.testPayloads||v.testPayloads.length===0)throw Error(`Custom Function "${v.name}" has no test payloads. Add test-payload or test-payloads to its manifest entry.`);let S=this.fs.existsSync(t.denoConfigPath)?{denoConfigPath:t.denoConfigPath}:{},C=v.testPayloads.map(e=>({testPayload:e,invocation:N(v,e,{...S,allowNetwork:f.allowNetwork})})),w=await p(`deno`,[`--version`],{cwd:t.manifestDirectory},this);if(w.error?.code===`ENOENT`)throw Error(`Deno 2.x is required. Install it from ${c}`);if(w.code!==0)throw Error(`Deno was found, but its version could not be determined.`);let T=s(w.stdout);if(T.level===`error`)throw Error(T.message);T.level===`warning`&&this.logger.warn(T.message);let E=await p(`deno`,[`info`,`--json`,...S.denoConfigPath?[`--config=${S.denoConfigPath}`]:[`--no-config`],x],{cwd:t.manifestDirectory},this);if(E.code!==0)throw Error(`Could not inspect Custom Function runtime imports: ${E.stderr.trim()||`Deno exited with code ${E.code}`}`);let O=m(E.stdout);if(O.length>0)throw Error(`Custom Functions must be self-contained. Local or import-map runtime dependencies are not deployed: ${O.join(`, `)}`);this.logger.warn(y.yellow(`Local simulator: sdk.fetch calls are logged and return HTTP 200 without sending a request; KV state starts empty for each payload.`)),f.allowNetwork?this.logger.warn(y.yellow(`Network enabled: native fetch can make real requests to ${v.allowedHosts?.length?v.allowedHosts.join(`, `):`localhost`}.`)):v.allowedHosts?.length&&this.logger.warn(y.yellow(`Native network access is disabled. Pass --allowNetwork to permit calls to allowed-hosts.`));let k=!1;for(let[e,{invocation:n,testPayload:r}]of C.entries()){let i=r.payloadType??`payload ${e+1}`;this.logger.info(`\n${y.bold(`Running "${v.name}" (${i})`)}`);let a=await p(`deno`,n.args,{cwd:t.manifestDirectory,input:n.input,env:n.env,timeoutMs:n.timeoutMs,maxOutputBytes:D+Math.max(0,...Object.values(v.env??{}).map(e=>b.byteLength(e)))},this),o=v.env??{},s=I(F(a.stdout,o,a.stdoutTruncated)),c=I(F(a.stderr,o,a.stderrTruncated));if(s.output&&this.process.stdout.write(s.output.endsWith(`
89
89
  `)?s.output:`${s.output}\n`),c.output&&this.process.stderr.write(c.output.endsWith(`
90
- `)?c.output:`${c.output}\n`),(a.outputTruncated||s.truncated||c.truncated)&&this.logger.warn(y.yellow(`Simulator output was truncated after ${D} bytes per stream.`)),a.code===0)this.logger.info(y.green(`Passed "${v.name}" (${i})`));else{k=!0;let e=a.timedOut?`timed out after ${n.timeoutMs}ms`:a.inputError?`could not send the fixture to Deno: ${a.inputError.message}`:a.error?`could not start Deno: ${a.error.message}`:a.signal?`was terminated with ${a.signal}`:`exited with code ${a.code}`;this.logger.error(y.red(`Failed "${v.name}" (${i}): ${e}`))}}k&&(this.process.exitCode=1)}catch(e){throw e instanceof n&&this.process.exit(130),e}}export{R as run};
91
- //# sourceMappingURL=impl-m3QXCc6n.mjs.map
90
+ `)?c.output:`${c.output}\n`),(a.outputTruncated||s.truncated||c.truncated)&&this.logger.warn(y.yellow(`Simulator output was truncated after ${D} bytes per stream.`)),a.code===0)this.logger.info(y.green(`Passed "${v.name}" (${i})`));else{k=!0;let e=a.timedOut?`timed out after ${n.timeoutMs}ms`:a.inputError?`could not send the fixture to Deno: ${a.inputError.message}`:a.error?`could not start Deno: ${a.error.message}`:a.signal?`was terminated with ${a.signal}`:`exited with code ${a.code}`;this.logger.error(y.red(`Failed "${v.name}" (${i}): ${e}`))}}k&&(this.process.exitCode=1)}catch(e){throw e instanceof r&&this.process.exit(130),e}}export{R as run};
91
+ //# sourceMappingURL=impl-a_Y8bnSn.mjs.map