@transcend-io/cli 11.0.0 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (379) hide show
  1. package/README.md +286 -130
  2. package/dist/app-CfJlhIn8.mjs +148 -0
  3. package/dist/app-CfJlhIn8.mjs.map +1 -0
  4. package/dist/{approvePrivacyRequests-C165wLBa.mjs → approvePrivacyRequests-BWj6SsgX.mjs} +2 -2
  5. package/dist/{approvePrivacyRequests-C165wLBa.mjs.map → approvePrivacyRequests-BWj6SsgX.mjs.map} +1 -1
  6. package/dist/bin/bash-complete.mjs +1 -1
  7. package/dist/bin/cli.mjs +1 -1
  8. package/dist/bin/deprecated-command.mjs +1 -1
  9. package/dist/buildExamples-1I3xKR1X.mjs +2 -0
  10. package/dist/buildExamples-1I3xKR1X.mjs.map +1 -0
  11. package/dist/{buildXdiSyncEndpoint-DeStnIit.mjs → buildXdiSyncEndpoint-CAal3Xc4.mjs} +2 -2
  12. package/dist/{buildXdiSyncEndpoint-DeStnIit.mjs.map → buildXdiSyncEndpoint-CAal3Xc4.mjs.map} +1 -1
  13. package/dist/{bulkRestartRequests-_Mu1rwZQ.mjs → bulkRestartRequests-B3wupylo.mjs} +2 -2
  14. package/dist/{bulkRestartRequests-_Mu1rwZQ.mjs.map → bulkRestartRequests-B3wupylo.mjs.map} +1 -1
  15. package/dist/{bulkRetryEnrichers-C2keTKuQ.mjs → bulkRetryEnrichers-D801tBcB.mjs} +2 -2
  16. package/dist/{bulkRetryEnrichers-C2keTKuQ.mjs.map → bulkRetryEnrichers-D801tBcB.mjs.map} +1 -1
  17. package/dist/{cancelPrivacyRequests-DwQr18Fk.mjs → cancelPrivacyRequests-CAKTZF47.mjs} +2 -2
  18. package/dist/{cancelPrivacyRequests-DwQr18Fk.mjs.map → cancelPrivacyRequests-CAKTZF47.mjs.map} +1 -1
  19. package/dist/{codecs-CTxFjCg4.mjs → codecs-CfcaFoZR.mjs} +1 -1
  20. package/dist/{codecs-CTxFjCg4.mjs.map → codecs-CfcaFoZR.mjs.map} +1 -1
  21. package/dist/{collectCsvFilesOrExit-B1VOVGWN.mjs → collectCsvFilesOrExit-BindZ0dF.mjs} +1 -1
  22. package/dist/{collectCsvFilesOrExit-B1VOVGWN.mjs.map → collectCsvFilesOrExit-BindZ0dF.mjs.map} +1 -1
  23. package/dist/{collectParquetFilesOrExit-DVlv5ctt.mjs → collectParquetFilesOrExit-CbNQ9CJc.mjs} +1 -1
  24. package/dist/{collectParquetFilesOrExit-DVlv5ctt.mjs.map → collectParquetFilesOrExit-CbNQ9CJc.mjs.map} +1 -1
  25. package/dist/command-BDQOL_MQ.mjs +9 -0
  26. package/dist/command-BDQOL_MQ.mjs.map +1 -0
  27. package/dist/command-output-BJcDRXNr.mjs +2 -0
  28. package/dist/command-output-BJcDRXNr.mjs.map +1 -0
  29. package/dist/command-output-BRfF3YFv.mjs +2 -0
  30. package/dist/command-output-BRfF3YFv.mjs.map +1 -0
  31. package/dist/commands/admin/chunk-csv/worker.mjs +1 -1
  32. package/dist/commands/admin/parquet-to-csv/worker.mjs +1 -1
  33. package/dist/{consentManagersToBusinessEntities-CBJ81aGO.mjs → consentManagersToBusinessEntities-DG0_eby5.mjs} +1 -1
  34. package/dist/{consentManagersToBusinessEntities-CBJ81aGO.mjs.map → consentManagersToBusinessEntities-DG0_eby5.mjs.map} +1 -1
  35. package/dist/{constants-Upxn_rQF.mjs → constants-BlKpAm3R.mjs} +2 -2
  36. package/dist/{constants-Upxn_rQF.mjs.map → constants-BlKpAm3R.mjs.map} +1 -1
  37. package/dist/{constants-DXzsg2CQ.mjs → constants-DC_bBO09.mjs} +3 -3
  38. package/dist/{constants-DXzsg2CQ.mjs.map → constants-DC_bBO09.mjs.map} +1 -1
  39. package/dist/{constants-D_HVDaOy.mjs → constants-qvGk0wlN.mjs} +1 -1
  40. package/dist/{constants-D_HVDaOy.mjs.map → constants-qvGk0wlN.mjs.map} +1 -1
  41. package/dist/{context-B33NT3ki.mjs → context-D0A0LxsP.mjs} +1 -1
  42. package/dist/{context-B33NT3ki.mjs.map → context-D0A0LxsP.mjs.map} +1 -1
  43. package/dist/{createPoolingCommandUi-CKH-24w5.mjs → createPoolingCommandUi-JBOW5UxY.mjs} +5 -5
  44. package/dist/{createPoolingCommandUi-CKH-24w5.mjs.map → createPoolingCommandUi-JBOW5UxY.mjs.map} +1 -1
  45. package/dist/{dataFlowsToDataSilos-BF6fzWcm.mjs → dataFlowsToDataSilos-CRqbNjZ0.mjs} +1 -1
  46. package/dist/{dataFlowsToDataSilos-BF6fzWcm.mjs.map → dataFlowsToDataSilos-CRqbNjZ0.mjs.map} +1 -1
  47. package/dist/deno-runtime-CB2HBach.mjs +2 -0
  48. package/dist/deno-runtime-CB2HBach.mjs.map +1 -0
  49. package/dist/{done-input-validation-BUz-aVC5.mjs → done-input-validation-LiTaCEzF.mjs} +1 -1
  50. package/dist/{done-input-validation-BUz-aVC5.mjs.map → done-input-validation-LiTaCEzF.mjs.map} +1 -1
  51. package/dist/downloadPrivacyRequestFiles-Cf14MQR4.mjs +2 -0
  52. package/dist/{downloadPrivacyRequestFiles-D3bzcegH.mjs.map → downloadPrivacyRequestFiles-Cf14MQR4.mjs.map} +1 -1
  53. package/dist/{extractClientError-HZ2U7yqV.mjs → extractClientError-DUJxHv07.mjs} +1 -1
  54. package/dist/{extractClientError-HZ2U7yqV.mjs.map → extractClientError-DUJxHv07.mjs.map} +1 -1
  55. package/dist/{fetchAllRequests-2TZr-LfT.mjs → fetchAllRequests-BI0tFl_a.mjs} +2 -2
  56. package/dist/{fetchAllRequests-2TZr-LfT.mjs.map → fetchAllRequests-BI0tFl_a.mjs.map} +1 -1
  57. package/dist/{formatPolicyBundleVersionSummary-CJmMCLtJ.mjs → formatPolicyBundleVersionSummary-DCHl1Vhy.mjs} +1 -1
  58. package/dist/{formatPolicyBundleVersionSummary-CJmMCLtJ.mjs.map → formatPolicyBundleVersionSummary-DCHl1Vhy.mjs.map} +1 -1
  59. package/dist/{fuzzyMatchColumns-CQCzpjWC.mjs → fuzzyMatchColumns-2NmQqCZI.mjs} +2 -2
  60. package/dist/{fuzzyMatchColumns-CQCzpjWC.mjs.map → fuzzyMatchColumns-2NmQqCZI.mjs.map} +1 -1
  61. package/dist/{generateCrossAccountApiKeys-DWfJtB3t.mjs → generateCrossAccountApiKeys-CVdsJFOe.mjs} +2 -2
  62. package/dist/{generateCrossAccountApiKeys-DWfJtB3t.mjs.map → generateCrossAccountApiKeys-CVdsJFOe.mjs.map} +1 -1
  63. package/dist/impl-0-_oxvck.mjs +2 -0
  64. package/dist/impl-0-_oxvck.mjs.map +1 -0
  65. package/dist/{impl-ByFyaZkK.mjs → impl-2sYR_UFO.mjs} +2 -2
  66. package/dist/{impl-ByFyaZkK.mjs.map → impl-2sYR_UFO.mjs.map} +1 -1
  67. package/dist/{impl-DRpK-QLC.mjs → impl-ApZGIx6l.mjs} +2 -2
  68. package/dist/{impl-DRpK-QLC.mjs.map → impl-ApZGIx6l.mjs.map} +1 -1
  69. package/dist/{impl-DVeGQCrr.mjs → impl-Ay6JeH-7.mjs} +2 -2
  70. package/dist/{impl-DVeGQCrr.mjs.map → impl-Ay6JeH-7.mjs.map} +1 -1
  71. package/dist/impl-B-Oe7DcE2.mjs +421 -0
  72. package/dist/impl-B-Oe7DcE2.mjs.map +1 -0
  73. package/dist/{impl-BPoEH3Nf2.mjs → impl-B94dMG4x2.mjs} +2 -2
  74. package/dist/{impl-BPoEH3Nf2.mjs.map → impl-B94dMG4x2.mjs.map} +1 -1
  75. package/dist/{impl-BEA5cQOT2.mjs → impl-BD03bzB-.mjs} +2 -2
  76. package/dist/impl-BD03bzB-.mjs.map +1 -0
  77. package/dist/{impl-BpMQYnbR.mjs → impl-BGtup1F9.mjs} +2 -2
  78. package/dist/{impl-BpMQYnbR.mjs.map → impl-BGtup1F9.mjs.map} +1 -1
  79. package/dist/{impl-DXowiNOz.mjs → impl-BH1fCPDh.mjs} +2 -2
  80. package/dist/{impl-DXowiNOz.mjs.map → impl-BH1fCPDh.mjs.map} +1 -1
  81. package/dist/{impl-CfvxD3RI.mjs → impl-BLOhoP-b2.mjs} +2 -2
  82. package/dist/impl-BLOhoP-b2.mjs.map +1 -0
  83. package/dist/impl-BQRP9NIv.mjs +2 -0
  84. package/dist/impl-BQRP9NIv.mjs.map +1 -0
  85. package/dist/{impl-BppXJ1AD2.mjs → impl-BQe6vddz.mjs} +2 -2
  86. package/dist/impl-BQe6vddz.mjs.map +1 -0
  87. package/dist/impl-BQj1Ien4.mjs +3 -0
  88. package/dist/impl-BQj1Ien4.mjs.map +1 -0
  89. package/dist/{impl-C_62Z4ED.mjs → impl-BRFL8xp7.mjs} +2 -2
  90. package/dist/{impl-C_62Z4ED.mjs.map → impl-BRFL8xp7.mjs.map} +1 -1
  91. package/dist/impl-BTvZxws5.mjs +2 -0
  92. package/dist/impl-BTvZxws5.mjs.map +1 -0
  93. package/dist/{impl-D94m3EPp.mjs → impl-BVcy_GYa.mjs} +2 -2
  94. package/dist/{impl-D94m3EPp.mjs.map → impl-BVcy_GYa.mjs.map} +1 -1
  95. package/dist/{impl-zRAjMVgz.mjs → impl-B_CRtRo8.mjs} +2 -2
  96. package/dist/{impl-zRAjMVgz.mjs.map → impl-B_CRtRo8.mjs.map} +1 -1
  97. package/dist/{impl-D4Ne3Vbg.mjs → impl-BgD7TeMD.mjs} +2 -2
  98. package/dist/{impl-D4Ne3Vbg.mjs.map → impl-BgD7TeMD.mjs.map} +1 -1
  99. package/dist/{impl-Cw0L2xEU.mjs → impl-BgkovGOz.mjs} +2 -2
  100. package/dist/{impl-Cw0L2xEU.mjs.map → impl-BgkovGOz.mjs.map} +1 -1
  101. package/dist/{impl-C9OmNI49.mjs → impl-Bh02zrTq.mjs} +2 -2
  102. package/dist/{impl-C9OmNI49.mjs.map → impl-Bh02zrTq.mjs.map} +1 -1
  103. package/dist/{impl-CiBT9-GH2.mjs → impl-BopWGXnH.mjs} +2 -2
  104. package/dist/impl-BopWGXnH.mjs.map +1 -0
  105. package/dist/impl-BpVe6fMe.mjs +3 -0
  106. package/dist/{impl--JGnR3wp.mjs.map → impl-BpVe6fMe.mjs.map} +1 -1
  107. package/dist/impl-BxvKe9_7.mjs +2 -0
  108. package/dist/impl-BxvKe9_7.mjs.map +1 -0
  109. package/dist/{impl-C8jjYvgu.mjs → impl-BzIyVAg_.mjs} +2 -2
  110. package/dist/{impl-C8jjYvgu.mjs.map → impl-BzIyVAg_.mjs.map} +1 -1
  111. package/dist/{impl-DXQHLpMw.mjs → impl-C-PvYlFE.mjs} +2 -2
  112. package/dist/{impl-DXQHLpMw.mjs.map → impl-C-PvYlFE.mjs.map} +1 -1
  113. package/dist/impl-C36c5NfN.mjs +2 -0
  114. package/dist/impl-C36c5NfN.mjs.map +1 -0
  115. package/dist/{impl-BhfxcCgN2.mjs → impl-CC-yFYWt.mjs} +2 -2
  116. package/dist/impl-CC-yFYWt.mjs.map +1 -0
  117. package/dist/{impl-lsmXIGSo2.mjs → impl-CFB_508q.mjs} +2 -2
  118. package/dist/impl-CFB_508q.mjs.map +1 -0
  119. package/dist/{impl-D2Q4nxUO.mjs → impl-CG3f4B6u.mjs} +2 -2
  120. package/dist/{impl-D2Q4nxUO.mjs.map → impl-CG3f4B6u.mjs.map} +1 -1
  121. package/dist/{impl-DaH1_ZzK.mjs → impl-CVUD-7mJ.mjs} +5 -5
  122. package/dist/{impl-DaH1_ZzK.mjs.map → impl-CVUD-7mJ.mjs.map} +1 -1
  123. package/dist/impl-CY8C-Fvj2.mjs +2 -0
  124. package/dist/impl-CY8C-Fvj2.mjs.map +1 -0
  125. package/dist/{impl-DqhZR11m.mjs → impl-ClqrQo1M.mjs} +2 -2
  126. package/dist/{impl-DqhZR11m.mjs.map → impl-ClqrQo1M.mjs.map} +1 -1
  127. package/dist/impl-CnHfn7rr.mjs +5 -0
  128. package/dist/{impl-DPtx5iZO.mjs.map → impl-CnHfn7rr.mjs.map} +1 -1
  129. package/dist/{impl-Dqqb0lVN.mjs → impl-CoqCyj7e.mjs} +3 -3
  130. package/dist/{impl-Dqqb0lVN.mjs.map → impl-CoqCyj7e.mjs.map} +1 -1
  131. package/dist/{impl-CHUxKOz_.mjs → impl-Cq-GARM1.mjs} +2 -2
  132. package/dist/{impl-CHUxKOz_.mjs.map → impl-Cq-GARM1.mjs.map} +1 -1
  133. package/dist/{impl-DzUTmaID2.mjs → impl-CsaT3aM2.mjs} +2 -2
  134. package/dist/impl-CsaT3aM2.mjs.map +1 -0
  135. package/dist/impl-Cvyc-iTI2.mjs +2 -0
  136. package/dist/impl-Cvyc-iTI2.mjs.map +1 -0
  137. package/dist/impl-CwBa15M42.mjs +3 -0
  138. package/dist/impl-CwBa15M42.mjs.map +1 -0
  139. package/dist/impl-D3gqip90.mjs +2 -0
  140. package/dist/impl-D3gqip90.mjs.map +1 -0
  141. package/dist/{impl-nz1MyjX22.mjs → impl-D6Lzwd-R2.mjs} +2 -2
  142. package/dist/{impl-nz1MyjX22.mjs.map → impl-D6Lzwd-R2.mjs.map} +1 -1
  143. package/dist/impl-DG-041kN.mjs +3 -0
  144. package/dist/impl-DG-041kN.mjs.map +1 -0
  145. package/dist/{impl-CD2R3L0v.mjs → impl-DTvnDByz.mjs} +2 -2
  146. package/dist/{impl-CD2R3L0v.mjs.map → impl-DTvnDByz.mjs.map} +1 -1
  147. package/dist/{impl-CTwyYUw3.mjs → impl-DUg1sDwg.mjs} +2 -2
  148. package/dist/{impl-CTwyYUw3.mjs.map → impl-DUg1sDwg.mjs.map} +1 -1
  149. package/dist/{impl-DKepRc812.mjs → impl-DeCRXfAh2.mjs} +2 -2
  150. package/dist/{impl-DKepRc812.mjs.map → impl-DeCRXfAh2.mjs.map} +1 -1
  151. package/dist/{impl-COujMWgp.mjs → impl-Dg7XSQdO2.mjs} +2 -2
  152. package/dist/impl-Dg7XSQdO2.mjs.map +1 -0
  153. package/dist/{impl-a_Y8bnSn.mjs → impl-DhXzxQDN2.mjs} +5 -5
  154. package/dist/impl-DhXzxQDN2.mjs.map +1 -0
  155. package/dist/{impl-C2sSZ8qF.mjs → impl-DldrBJEa.mjs} +2 -2
  156. package/dist/{impl-C2sSZ8qF.mjs.map → impl-DldrBJEa.mjs.map} +1 -1
  157. package/dist/{impl-gs5wJ1BK.mjs → impl-Dmn1CWts.mjs} +3 -3
  158. package/dist/{impl-gs5wJ1BK.mjs.map → impl-Dmn1CWts.mjs.map} +1 -1
  159. package/dist/impl-Dr9Jezjh2.mjs +2 -0
  160. package/dist/impl-Dr9Jezjh2.mjs.map +1 -0
  161. package/dist/impl-DtTfsHtL.mjs +2 -0
  162. package/dist/impl-DtTfsHtL.mjs.map +1 -0
  163. package/dist/impl-DzNEfRoS2.mjs +4 -0
  164. package/dist/{impl-D-AHlqlD2.mjs.map → impl-DzNEfRoS2.mjs.map} +1 -1
  165. package/dist/{impl-a0BFtbna.mjs → impl-HnrcGt_T.mjs} +2 -2
  166. package/dist/{impl-a0BFtbna.mjs.map → impl-HnrcGt_T.mjs.map} +1 -1
  167. package/dist/{impl-B5df-igZ.mjs → impl-QdSegO65.mjs} +2 -2
  168. package/dist/{impl-B5df-igZ.mjs.map → impl-QdSegO65.mjs.map} +1 -1
  169. package/dist/{impl-BJyzyrZD.mjs → impl-S90NUBGm.mjs} +2 -2
  170. package/dist/{impl-BJyzyrZD.mjs.map → impl-S90NUBGm.mjs.map} +1 -1
  171. package/dist/impl-Tr08dgdk.mjs +2 -0
  172. package/dist/{impl-DQPmSYSE.mjs.map → impl-Tr08dgdk.mjs.map} +1 -1
  173. package/dist/{impl-CPSEzCc9.mjs → impl-WJBuS_0m.mjs} +2 -2
  174. package/dist/{impl-CPSEzCc9.mjs.map → impl-WJBuS_0m.mjs.map} +1 -1
  175. package/dist/impl-b4KAEVci.mjs +2 -0
  176. package/dist/{impl-GytUVAMP.mjs.map → impl-b4KAEVci.mjs.map} +1 -1
  177. package/dist/impl-defjX-97.mjs +3 -0
  178. package/dist/impl-defjX-97.mjs.map +1 -0
  179. package/dist/{impl-DhxDp4GN.mjs → impl-fg0UZYw6.mjs} +2 -2
  180. package/dist/{impl-DhxDp4GN.mjs.map → impl-fg0UZYw6.mjs.map} +1 -1
  181. package/dist/{impl-CzdUHruN.mjs → impl-hRK54juc.mjs} +2 -2
  182. package/dist/{impl-CzdUHruN.mjs.map → impl-hRK54juc.mjs.map} +1 -1
  183. package/dist/{impl-CSk_okwj.mjs → impl-mjDxMEDR.mjs} +2 -2
  184. package/dist/{impl-CSk_okwj.mjs.map → impl-mjDxMEDR.mjs.map} +1 -1
  185. package/dist/index.d.mts +1 -1
  186. package/dist/index.mjs +2 -2
  187. package/dist/index.mjs.map +1 -1
  188. package/dist/{initializeCliRuntime-6wI_VIHV.mjs → initializeCliRuntime-BaATMO1X.mjs} +1 -1
  189. package/dist/{initializeCliRuntime-6wI_VIHV.mjs.map → initializeCliRuntime-BaATMO1X.mjs.map} +1 -1
  190. package/dist/{inquirer-BeaBetMO.mjs → inquirer-BU5IpgA8.mjs} +2 -2
  191. package/dist/{inquirer-BeaBetMO.mjs.map → inquirer-BU5IpgA8.mjs.map} +1 -1
  192. package/dist/{jsonc-D9dDWb1J.mjs → jsonc-CdTubr53.mjs} +1 -1
  193. package/dist/{jsonc-D9dDWb1J.mjs.map → jsonc-CdTubr53.mjs.map} +1 -1
  194. package/dist/{listFiles-BdFUbX5x.mjs → listFiles-DDGCBdtx.mjs} +1 -1
  195. package/dist/{listFiles-BdFUbX5x.mjs.map → listFiles-DDGCBdtx.mjs.map} +1 -1
  196. package/dist/logger-CPu6zbyQ.mjs +2 -0
  197. package/dist/logger-CPu6zbyQ.mjs.map +1 -0
  198. package/dist/{mapConsentCsvRowsToInputs-Dqb6WL4r.mjs → mapConsentCsvRowsToInputs-CkLfxaIf.mjs} +1 -1
  199. package/dist/{mapConsentCsvRowsToInputs-Dqb6WL4r.mjs.map → mapConsentCsvRowsToInputs-CkLfxaIf.mjs.map} +1 -1
  200. package/dist/markRequestDataSiloIdsCompleted-C6lV_My-.mjs +2 -0
  201. package/dist/{markRequestDataSiloIdsCompleted-Br5gIS3S.mjs.map → markRequestDataSiloIdsCompleted-C6lV_My-.mjs.map} +1 -1
  202. package/dist/{markSilentPrivacyRequests-Cs_iZNJs.mjs → markSilentPrivacyRequests-D3bFOMLh.mjs} +2 -2
  203. package/dist/{markSilentPrivacyRequests-Cs_iZNJs.mjs.map → markSilentPrivacyRequests-D3bFOMLh.mjs.map} +1 -1
  204. package/dist/{mergeTranscendInputs-DFQcbh8b.mjs → mergeTranscendInputs-B7WjxYMN.mjs} +3 -3
  205. package/dist/{mergeTranscendInputs-DFQcbh8b.mjs.map → mergeTranscendInputs-B7WjxYMN.mjs.map} +1 -1
  206. package/dist/missing-manifest-D8y1VL4p.mjs +2 -0
  207. package/dist/missing-manifest-D8y1VL4p.mjs.map +1 -0
  208. package/dist/{module-graph-Cb0g74Ft.mjs → module-graph-CAT8_JCG.mjs} +1 -1
  209. package/dist/{module-graph-Cb0g74Ft.mjs.map → module-graph-CAT8_JCG.mjs.map} +1 -1
  210. package/dist/{notifyPrivacyRequestsAdditionalTime-kPXTdjgT.mjs → notifyPrivacyRequestsAdditionalTime-BGUxsWLN.mjs} +2 -2
  211. package/dist/{notifyPrivacyRequestsAdditionalTime-kPXTdjgT.mjs.map → notifyPrivacyRequestsAdditionalTime-BGUxsWLN.mjs.map} +1 -1
  212. package/dist/{parquetToCsvOneFile-ChmPC6dL.mjs → parquetToCsvOneFile-DtbCFm08.mjs} +3 -3
  213. package/dist/{parquetToCsvOneFile-ChmPC6dL.mjs.map → parquetToCsvOneFile-DtbCFm08.mjs.map} +1 -1
  214. package/dist/{parseAttributesFromString-CO16oAlx.mjs → parseAttributesFromString-C5hJMRvt.mjs} +2 -2
  215. package/dist/{parseAttributesFromString-CO16oAlx.mjs.map → parseAttributesFromString-C5hJMRvt.mjs.map} +1 -1
  216. package/dist/{parseVariablesFromString-BOSfQ4QF.mjs → parseVariablesFromString-6TYW65LF.mjs} +1 -1
  217. package/dist/{parseVariablesFromString-BOSfQ4QF.mjs.map → parseVariablesFromString-6TYW65LF.mjs.map} +1 -1
  218. package/dist/paths-J5KScOaQ.mjs +2 -0
  219. package/dist/paths-J5KScOaQ.mjs.map +1 -0
  220. package/dist/policy-bundle-manifest-RgsjPnfI.mjs +7 -0
  221. package/dist/policy-bundle-manifest-RgsjPnfI.mjs.map +1 -0
  222. package/dist/policy-project-discovery-B4cFXUlA.mjs +430 -0
  223. package/dist/policy-project-discovery-B4cFXUlA.mjs.map +1 -0
  224. package/dist/{policy-runtime-BMKa-Upy.mjs → policy-runtime-6jmkXlBk.mjs} +2 -2
  225. package/dist/{policy-runtime-BMKa-Upy.mjs.map → policy-runtime-6jmkXlBk.mjs.map} +1 -1
  226. package/dist/policy-scaffold-config-CwlygiTz.mjs +76 -0
  227. package/dist/policy-scaffold-config-CwlygiTz.mjs.map +1 -0
  228. package/dist/{policyEngineCliError-DY8V-qkK.mjs → policyEngineCliError-CZrOHhLv.mjs} +1 -1
  229. package/dist/{policyEngineCliError-DY8V-qkK.mjs.map → policyEngineCliError-CZrOHhLv.mjs.map} +1 -1
  230. package/dist/printResult-Dmwv78e7.mjs +33 -0
  231. package/dist/printResult-Dmwv78e7.mjs.map +1 -0
  232. package/dist/project-discovery-BkHpTXDx.mjs +2 -0
  233. package/dist/project-discovery-BkHpTXDx.mjs.map +1 -0
  234. package/dist/project-discovery-CWRjlFnC.mjs +2 -0
  235. package/dist/project-discovery-CWRjlFnC.mjs.map +1 -0
  236. package/dist/project-plan-apply-Bg_1eMX9.mjs +3 -0
  237. package/dist/{project-plan-apply-Dvndx455.mjs.map → project-plan-apply-Bg_1eMX9.mjs.map} +1 -1
  238. package/dist/project-plan-output-BHHlkLxe.mjs +4 -0
  239. package/dist/project-plan-output-BHHlkLxe.mjs.map +1 -0
  240. package/dist/prompts-BhXfYD6g.mjs +2 -0
  241. package/dist/prompts-BhXfYD6g.mjs.map +1 -0
  242. package/dist/{pullAllDatapoints-uk5ggk6O.mjs → pullAllDatapoints-CNqQSSmF.mjs} +3 -3
  243. package/dist/{pullAllDatapoints-uk5ggk6O.mjs.map → pullAllDatapoints-CNqQSSmF.mjs.map} +1 -1
  244. package/dist/pullChunkedCustomSiloOutstandingIdentifiers-BfNNWqeI.mjs +2 -0
  245. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-DbFFXAVM.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-BfNNWqeI.mjs.map} +1 -1
  246. package/dist/{pullConsentManagerMetrics-Dv5n1ZGp.mjs → pullConsentManagerMetrics-DKCkfbCB.mjs} +2 -2
  247. package/dist/{pullConsentManagerMetrics-Dv5n1ZGp.mjs.map → pullConsentManagerMetrics-DKCkfbCB.mjs.map} +1 -1
  248. package/dist/pullManualEnrichmentIdentifiersToCsv-B_lWa6Yg.mjs +2 -0
  249. package/dist/{pullManualEnrichmentIdentifiersToCsv-D5is0Nrs.mjs.map → pullManualEnrichmentIdentifiersToCsv-B_lWa6Yg.mjs.map} +1 -1
  250. package/dist/{pullTranscendConfiguration-B63M3ild.mjs → pullTranscendConfiguration-CDUDqxpm.mjs} +2 -2
  251. package/dist/{pullTranscendConfiguration-B63M3ild.mjs.map → pullTranscendConfiguration-CDUDqxpm.mjs.map} +1 -1
  252. package/dist/{pullUnstructuredSubDataPointRecommendations-YTBzfkRZ.mjs → pullUnstructuredSubDataPointRecommendations-Ci4AOxyH.mjs} +2 -2
  253. package/dist/{pullUnstructuredSubDataPointRecommendations-YTBzfkRZ.mjs.map → pullUnstructuredSubDataPointRecommendations-Ci4AOxyH.mjs.map} +1 -1
  254. package/dist/{pushCronIdentifiersFromCsv-Ctq38wAY.mjs → pushCronIdentifiersFromCsv-CDhlEf6n.mjs} +2 -2
  255. package/dist/{pushCronIdentifiersFromCsv-Ctq38wAY.mjs.map → pushCronIdentifiersFromCsv-CDhlEf6n.mjs.map} +1 -1
  256. package/dist/pushManualEnrichmentIdentifiersFromCsv-Bn_028w5.mjs +2 -0
  257. package/dist/{pushManualEnrichmentIdentifiersFromCsv-0WHf6d_m.mjs.map → pushManualEnrichmentIdentifiersFromCsv-Bn_028w5.mjs.map} +1 -1
  258. package/dist/{readCsv-DLg8pwjd.mjs → readCsv-DNcJ_UfU.mjs} +1 -1
  259. package/dist/{readCsv-DLg8pwjd.mjs.map → readCsv-DNcJ_UfU.mjs.map} +1 -1
  260. package/dist/{readTranscendYaml-BNn6-Ofi.mjs → readTranscendYaml-BfqQbPiT.mjs} +3 -3
  261. package/dist/{readTranscendYaml-BNn6-Ofi.mjs.map → readTranscendYaml-BfqQbPiT.mjs.map} +1 -1
  262. package/dist/{removeUnverifiedRequestIdentifiers-Do3Pus6m.mjs → removeUnverifiedRequestIdentifiers-DcI9ut4q.mjs} +2 -2
  263. package/dist/{removeUnverifiedRequestIdentifiers-Do3Pus6m.mjs.map → removeUnverifiedRequestIdentifiers-DcI9ut4q.mjs.map} +1 -1
  264. package/dist/{renderTable-D68QasPc.mjs → renderTable-CZP2roD1.mjs} +1 -1
  265. package/dist/{renderTable-D68QasPc.mjs.map → renderTable-CZP2roD1.mjs.map} +1 -1
  266. package/dist/{request-BiPv6jmP.mjs → request-BpKyN9Xm.mjs} +1 -1
  267. package/dist/{request-BiPv6jmP.mjs.map → request-BpKyN9Xm.mjs.map} +1 -1
  268. package/dist/resolveBundleIdByName-BPrMkU0w.mjs +2 -0
  269. package/dist/resolveBundleIdByName-BPrMkU0w.mjs.map +1 -0
  270. package/dist/resolvePolicyBundleVersion-BrVz4LKN.mjs +2 -0
  271. package/dist/resolvePolicyBundleVersion-BrVz4LKN.mjs.map +1 -0
  272. package/dist/{retryRequestDataSilos-CEgUW6Fx.mjs → retryRequestDataSilos-ZdY2PM0S.mjs} +2 -2
  273. package/dist/{retryRequestDataSilos-CEgUW6Fx.mjs.map → retryRequestDataSilos-ZdY2PM0S.mjs.map} +1 -1
  274. package/dist/{run-captured-process-BXwWXuTh.mjs → run-captured-process-BjaSDWXG.mjs} +1 -1
  275. package/dist/{run-captured-process-BXwWXuTh.mjs.map → run-captured-process-BjaSDWXG.mjs.map} +1 -1
  276. package/dist/{runOpa-CswzJxIs.mjs → runOpa-ojIqU1tO.mjs} +2 -2
  277. package/dist/{runOpa-CswzJxIs.mjs.map → runOpa-ojIqU1tO.mjs.map} +1 -1
  278. package/dist/{scaffold-model-BAbYTR0q.mjs → scaffold-model-CUZER0BC.mjs} +1 -1
  279. package/dist/scaffold-model-CUZER0BC.mjs.map +1 -0
  280. package/dist/{scaffold-planning-CNv83t_v.mjs → scaffold-planning-CaetLfv8.mjs} +9 -9
  281. package/dist/{scaffold-planning-CNv83t_v.mjs.map → scaffold-planning-CaetLfv8.mjs.map} +1 -1
  282. package/dist/{scaffold-templates-DzDGTZie.mjs → scaffold-templates-CUL82Zf8.mjs} +1 -1
  283. package/dist/{scaffold-templates-DzDGTZie.mjs.map → scaffold-templates-CUL82Zf8.mjs.map} +1 -1
  284. package/dist/{skipPreflightJobs-D_1mZ9mr.mjs → skipPreflightJobs-KdcSw8Td.mjs} +2 -2
  285. package/dist/{skipPreflightJobs-D_1mZ9mr.mjs.map → skipPreflightJobs-KdcSw8Td.mjs.map} +1 -1
  286. package/dist/{skipRequestDataSilos-CcGl9Z8M.mjs → skipRequestDataSilos-Cy2NfP47.mjs} +2 -2
  287. package/dist/{skipRequestDataSilos-CcGl9Z8M.mjs.map → skipRequestDataSilos-Cy2NfP47.mjs.map} +1 -1
  288. package/dist/{streamPrivacyRequestsToCsv-1l8RAcnK.mjs → streamPrivacyRequestsToCsv-ByRBG8Mb.mjs} +2 -2
  289. package/dist/{streamPrivacyRequestsToCsv-1l8RAcnK.mjs.map → streamPrivacyRequestsToCsv-ByRBG8Mb.mjs.map} +1 -1
  290. package/dist/{syncCodePackages-BHE2Tn1Q.mjs → syncCodePackages-DJnrcX5l.mjs} +2 -2
  291. package/dist/{syncCodePackages-BHE2Tn1Q.mjs.map → syncCodePackages-DJnrcX5l.mjs.map} +1 -1
  292. package/dist/updateConsentManagerVersionToLatest-KwMaAkwh.mjs +2 -0
  293. package/dist/{updateConsentManagerVersionToLatest-yZhBDcv8.mjs.map → updateConsentManagerVersionToLatest-KwMaAkwh.mjs.map} +1 -1
  294. package/dist/{uploadConsents-DQqApEaH.mjs → uploadConsents-C5LmI-9T.mjs} +2 -2
  295. package/dist/{uploadConsents-DQqApEaH.mjs.map → uploadConsents-C5LmI-9T.mjs.map} +1 -1
  296. package/dist/{uploadPrivacyRequestsFromCsv-ntuK0eSR.mjs → uploadPrivacyRequestsFromCsv-BsYnCgbl.mjs} +2 -2
  297. package/dist/{uploadPrivacyRequestsFromCsv-ntuK0eSR.mjs.map → uploadPrivacyRequestsFromCsv-BsYnCgbl.mjs.map} +1 -1
  298. package/dist/validateTranscendAuth-D-dDINof.mjs +2 -0
  299. package/dist/{validateTranscendAuth-D6Wr1cxY.mjs.map → validateTranscendAuth-D-dDINof.mjs.map} +1 -1
  300. package/dist/{writeCsv-D-2siSwE.mjs → writeCsv-CNZrq3zU.mjs} +1 -1
  301. package/dist/{writeCsv-D-2siSwE.mjs.map → writeCsv-CNZrq3zU.mjs.map} +1 -1
  302. package/package.json +8 -7
  303. package/dist/app-DhG-JhT3.mjs +0 -148
  304. package/dist/app-DhG-JhT3.mjs.map +0 -1
  305. package/dist/buildExamples-DOopJFYY.mjs +0 -2
  306. package/dist/buildExamples-DOopJFYY.mjs.map +0 -1
  307. package/dist/command-Ds6oNo0v.mjs +0 -9
  308. package/dist/command-Ds6oNo0v.mjs.map +0 -1
  309. package/dist/deno-runtime-DV52X8-P.mjs +0 -2
  310. package/dist/deno-runtime-DV52X8-P.mjs.map +0 -1
  311. package/dist/downloadPrivacyRequestFiles-D3bzcegH.mjs +0 -2
  312. package/dist/impl--JGnR3wp.mjs +0 -3
  313. package/dist/impl-7UqkSO3x2.mjs +0 -2
  314. package/dist/impl-7UqkSO3x2.mjs.map +0 -1
  315. package/dist/impl-B4BgGuF_.mjs +0 -3
  316. package/dist/impl-B4BgGuF_.mjs.map +0 -1
  317. package/dist/impl-B5oVsX-F2.mjs +0 -303
  318. package/dist/impl-B5oVsX-F2.mjs.map +0 -1
  319. package/dist/impl-BEA5cQOT2.mjs.map +0 -1
  320. package/dist/impl-BhfxcCgN2.mjs.map +0 -1
  321. package/dist/impl-BppXJ1AD2.mjs.map +0 -1
  322. package/dist/impl-C6HtWd1t.mjs +0 -2
  323. package/dist/impl-C6HtWd1t.mjs.map +0 -1
  324. package/dist/impl-CO4ZqlLV.mjs +0 -3
  325. package/dist/impl-CO4ZqlLV.mjs.map +0 -1
  326. package/dist/impl-COujMWgp.mjs.map +0 -1
  327. package/dist/impl-CUOVJsRg.mjs +0 -3
  328. package/dist/impl-CUOVJsRg.mjs.map +0 -1
  329. package/dist/impl-CUiYbk6G.mjs +0 -3
  330. package/dist/impl-CUiYbk6G.mjs.map +0 -1
  331. package/dist/impl-CfvxD3RI.mjs.map +0 -1
  332. package/dist/impl-CiBT9-GH2.mjs.map +0 -1
  333. package/dist/impl-Cli2XRp02.mjs +0 -2
  334. package/dist/impl-Cli2XRp02.mjs.map +0 -1
  335. package/dist/impl-D-AHlqlD2.mjs +0 -4
  336. package/dist/impl-DPN1En7L.mjs +0 -2
  337. package/dist/impl-DPN1En7L.mjs.map +0 -1
  338. package/dist/impl-DPtx5iZO.mjs +0 -5
  339. package/dist/impl-DQPmSYSE.mjs +0 -2
  340. package/dist/impl-DXRDWiB1.mjs +0 -2
  341. package/dist/impl-DXRDWiB1.mjs.map +0 -1
  342. package/dist/impl-DdIa0zla.mjs +0 -2
  343. package/dist/impl-DdIa0zla.mjs.map +0 -1
  344. package/dist/impl-Dp4bZvAV.mjs +0 -2
  345. package/dist/impl-Dp4bZvAV.mjs.map +0 -1
  346. package/dist/impl-DryC3OJu.mjs +0 -2
  347. package/dist/impl-DryC3OJu.mjs.map +0 -1
  348. package/dist/impl-DzUTmaID2.mjs.map +0 -1
  349. package/dist/impl-GytUVAMP.mjs +0 -2
  350. package/dist/impl-Z8oWVENM.mjs +0 -2
  351. package/dist/impl-Z8oWVENM.mjs.map +0 -1
  352. package/dist/impl-a_Y8bnSn.mjs.map +0 -1
  353. package/dist/impl-lsmXIGSo2.mjs.map +0 -1
  354. package/dist/logger-zplFSeXU.mjs +0 -2
  355. package/dist/logger-zplFSeXU.mjs.map +0 -1
  356. package/dist/manifest-BNIpO_zW.mjs +0 -2
  357. package/dist/manifest-BNIpO_zW.mjs.map +0 -1
  358. package/dist/markRequestDataSiloIdsCompleted-Br5gIS3S.mjs +0 -2
  359. package/dist/missing-manifest-DgcukXfg.mjs +0 -2
  360. package/dist/missing-manifest-DgcukXfg.mjs.map +0 -1
  361. package/dist/path-safety-D5Qwl40b.mjs +0 -2
  362. package/dist/path-safety-D5Qwl40b.mjs.map +0 -1
  363. package/dist/policy-bundle-manifest-D6dkbjNi.mjs +0 -7
  364. package/dist/policy-bundle-manifest-D6dkbjNi.mjs.map +0 -1
  365. package/dist/printResult-CHe3nRN4.mjs +0 -33
  366. package/dist/printResult-CHe3nRN4.mjs.map +0 -1
  367. package/dist/project-plan-apply-Dvndx455.mjs +0 -3
  368. package/dist/prompts-ClBXdELk.mjs +0 -4
  369. package/dist/prompts-ClBXdELk.mjs.map +0 -1
  370. package/dist/pullChunkedCustomSiloOutstandingIdentifiers-DbFFXAVM.mjs +0 -2
  371. package/dist/pullManualEnrichmentIdentifiersToCsv-D5is0Nrs.mjs +0 -2
  372. package/dist/pushManualEnrichmentIdentifiersFromCsv-0WHf6d_m.mjs +0 -2
  373. package/dist/resolveBundleIdByName-qXZBrUz_.mjs +0 -2
  374. package/dist/resolveBundleIdByName-qXZBrUz_.mjs.map +0 -1
  375. package/dist/resolvePolicyBundleVersion-BG7XqBBP.mjs +0 -2
  376. package/dist/resolvePolicyBundleVersion-BG7XqBBP.mjs.map +0 -1
  377. package/dist/scaffold-model-BAbYTR0q.mjs.map +0 -1
  378. package/dist/updateConsentManagerVersionToLatest-yZhBDcv8.mjs +0 -2
  379. package/dist/validateTranscendAuth-D6Wr1cxY.mjs +0 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl-B-Oe7DcE2.mjs","names":["POLICY_SKILL_MD","POLICY_SETUP_TOOLING_REFERENCE_MD","POLICY_AUTHORING_REFERENCE_MD","POLICY_TESTING_DEBUGGING_REFERENCE_MD","POLICY_PUBLISHING_REFERENCE_MD","CLI_VERSION"],"sources":["../src/lib/policy/policy-scaffold-model.ts","../../../skills/transcend-policy-engine/references/authoring.md","../../../skills/transcend-policy-engine/references/publishing.md","../../../skills/transcend-policy-engine/references/setup-tooling.md","../../../skills/transcend-policy-engine/references/testing-debugging.md","../../../skills/transcend-policy-engine/SKILL.md","../src/lib/policy/policy-skill.ts","../src/lib/policy/policy-scaffold-output.ts","../src/lib/policy/policy-scaffold-planning.ts","../src/commands/policy/init/impl.ts"],"sourcesContent":["import type { ExistingProjectSkillDirectory } from '../scaffolding/agent-skill.js';\nimport type { ProjectPlan } from '../scaffolding/project-plan.js';\n\n/** Version of the stable policy initialization JSON result. */\nexport const POLICY_INIT_RESULT_VERSION = 3 as const;\n\n/** Optional repository integrations for policy authoring. */\nexport const PolicySetupFeature = {\n /** Repository-level editor configuration. */\n Editor: 'editor',\n /** Managed policy authoring skill. */\n Skill: 'skill',\n /** Credential-free continuous integration. */\n Ci: 'ci',\n} as const;\n\n/** Optional repository integration for policy authoring. */\nexport type PolicySetupFeature = (typeof PolicySetupFeature)[keyof typeof PolicySetupFeature];\n\n/** Repository and target state collected before policy planning. */\nexport interface PolicyProjectState {\n /** Directory from which the CLI was invoked. */\n invocationDirectory: string;\n /** Absolute user-selected policy directory. */\n targetDirectory: string;\n /** Repository or invocation root that owns setup artifacts. */\n projectRoot: string;\n /** Nearest repository root, when present. */\n repositoryRoot?: string;\n /** Existing project-level skill directories. */\n existingSkillDirectories: ExistingProjectSkillDirectory[];\n /** Whether the repository appears to use GitHub. */\n usesGithub: boolean;\n /** Case-preserving relative paths below the policy directory. */\n relativePaths: string[];\n /** Relative file and link paths below the policy directory. */\n relativeFilePaths: string[];\n}\n\n/** A complete, validated policy initialization plan. */\nexport interface PolicyInitProjectPlan extends ProjectPlan {\n /** JSON contract version. */\n version: typeof POLICY_INIT_RESULT_VERSION;\n /** Command that produced the plan. */\n command: 'init';\n /** Absolute policy project directory. */\n targetDirectory: string;\n /** Absolute policy manifest path. */\n manifestPath: string;\n /** Files inspected and deliberately left unchanged. */\n unchanged: string[];\n /** Non-fatal plan warnings. */\n warnings: string[];\n /** Raw commands shown after a successful apply. */\n nextSteps: string[];\n /** Exact generated example that remains safe to replace. */\n disposableExamplePath?: string;\n /** Selected repository integrations. */\n features: PolicySetupFeature[];\n}\n",null,null,null,null,null,"import POLICY_AUTHORING_REFERENCE_MD from '../../../../../skills/transcend-policy-engine/references/authoring.md';\nimport POLICY_PUBLISHING_REFERENCE_MD from '../../../../../skills/transcend-policy-engine/references/publishing.md';\nimport POLICY_SETUP_TOOLING_REFERENCE_MD from '../../../../../skills/transcend-policy-engine/references/setup-tooling.md';\nimport POLICY_TESTING_DEBUGGING_REFERENCE_MD from '../../../../../skills/transcend-policy-engine/references/testing-debugging.md';\nimport POLICY_SKILL_MD from '../../../../../skills/transcend-policy-engine/SKILL.md';\nimport type { AgentSkillFile } from '../scaffolding/agent-skill.js';\n\n/** Namespaced directory and frontmatter name for the installed Agent Skill. */\nexport const POLICY_SKILL_NAME = 'transcend-policy-engine';\n\nexport {\n POLICY_AUTHORING_REFERENCE_MD,\n POLICY_PUBLISHING_REFERENCE_MD,\n POLICY_SETUP_TOOLING_REFERENCE_MD,\n POLICY_SKILL_MD,\n POLICY_TESTING_DEBUGGING_REFERENCE_MD,\n};\n\n/** Complete portable Policy Engine Agent Skill file set. */\nexport const POLICY_SKILL_FILES: readonly AgentSkillFile[] = [\n { path: 'SKILL.md', contents: POLICY_SKILL_MD },\n { path: 'references/setup-tooling.md', contents: POLICY_SETUP_TOOLING_REFERENCE_MD },\n { path: 'references/authoring.md', contents: POLICY_AUTHORING_REFERENCE_MD },\n { path: 'references/testing-debugging.md', contents: POLICY_TESTING_DEBUGGING_REFERENCE_MD },\n { path: 'references/publishing.md', contents: POLICY_PUBLISHING_REFERENCE_MD },\n];\n","import {\n toPublicPlannedChange,\n type PublicPlannedChange,\n} from '../scaffolding/project-plan-output.js';\nimport type { PolicyInitProjectPlan, PolicySetupFeature } from './policy-scaffold-model.js';\nimport { POLICY_SKILL_NAME } from './policy-skill.js';\n\n/** Detected local policy tool versions. */\nexport interface PolicyInitToolVersions {\n /** OPA version, or null when missing or incompatible. */\n opa: string | null;\n /** Regal version, or null when missing or incompatible. */\n regal: string | null;\n}\n\n/** Stable machine-readable policy initialization result. */\nexport interface PolicyInitPlanResult {\n /** JSON contract version. */\n version: number;\n /** Command that produced the result. */\n command: 'init';\n /** Whether the plan was applied. */\n applied: boolean;\n /** Whether this was a dry run. */\n dryRun: boolean;\n /** Absolute policy target directory. */\n targetDirectory: string;\n /** Absolute policy manifest path. */\n manifestPath: string;\n /** Planned mutations without file contents. */\n changes: PublicPlannedChange[];\n /** Non-fatal preservation and runtime warnings. */\n warnings: string[];\n /** Suggested raw one-line follow-up commands. */\n nextSteps: string[];\n /** Explicitly selected repository integrations. */\n features: PolicySetupFeature[];\n /** Compact prompt for continuing with a coding agent. */\n aiHandoff: string;\n /** Compatible local policy tool versions. */\n tools: PolicyInitToolVersions;\n}\n\n/**\n * Build the compact policy implementation and CI handoff.\n *\n * @param options - Portable project path and next step\n * @returns Raw one-line prompt\n */\nexport function buildPolicyInitAiHandoff(options: {\n /** Display path to the policy project. */\n projectPath: string;\n /** Whether the policy authoring skill was installed. */\n hasSkill: boolean;\n /** Copyable new-bundle command. */\n newCommand: string;\n}): string {\n const instruction = options.hasSkill ? `Use the \\`${POLICY_SKILL_NAME}\\` skill and run` : 'Run';\n return (\n `${instruction} ${options.newCommand} to add a bundle from a template, ` +\n `then adapt the policy document tree and input/output contract to the intended application.`\n );\n}\n\n/**\n * Build the stable machine-readable initialization result.\n *\n * @param plan - Policy project plan\n * @param options - Apply and runtime state\n * @returns Public JSON result\n */\nexport function buildPolicyInitPlanResult(\n plan: PolicyInitProjectPlan,\n options: {\n /** Whether the plan was applied. */\n applied: boolean;\n /** Whether this was a dry run. */\n dryRun: boolean;\n /** Working directory for portable paths. */\n cwd: string;\n /** Compact coding-agent prompt. */\n aiHandoff: string;\n /** Compatible local policy tool versions. */\n tools: PolicyInitToolVersions;\n },\n): PolicyInitPlanResult {\n return {\n version: plan.version,\n command: plan.command,\n applied: options.applied,\n dryRun: options.dryRun,\n targetDirectory: plan.targetDirectory,\n manifestPath: plan.manifestPath,\n changes: plan.changes.map((change) => toPublicPlannedChange(options.cwd, change)),\n warnings: plan.warnings,\n nextSteps: plan.nextSteps,\n features: [...plan.features],\n aiHandoff: options.aiHandoff,\n tools: options.tools,\n };\n}\n","import { isAbsolute, join, posix, relative, sep } from 'node:path';\n\nimport {\n getManagedAgentSkillCandidatePaths,\n planManagedAgentSkill,\n type ManagedAgentSkillDefinition,\n} from '../scaffolding/agent-skill.js';\nimport { displayProjectPath } from '../scaffolding/project-plan-output.js';\nimport {\n getPlanningPathSnapshot,\n getPlanningFileSnapshot,\n planFileChange,\n type PlanningPathSnapshot,\n} from '../scaffolding/project-plan.js';\nimport {\n generatePolicyGithubActionsWorkflow,\n POLICY_CI_WORKFLOW_PATH,\n} from './policy-scaffold-artifacts.js';\nimport {\n mergePolicyEditorExtensions,\n mergePolicyEditorSettings,\n mergePolicyEditorTasks,\n type PolicyEditorMergeResult,\n} from './policy-scaffold-config.js';\nimport {\n POLICY_INIT_RESULT_VERSION,\n PolicySetupFeature,\n type PolicyInitProjectPlan,\n type PolicyProjectState,\n type PolicySetupFeature as PolicySetupFeatureType,\n} from './policy-scaffold-model.js';\nimport {\n generatePolicyWorkspaceFiles,\n POLICY_STARTER_BUNDLE_DIRECTORY,\n type PolicyStarterFile,\n} from './policy-scaffold-templates.js';\nimport { POLICY_SKILL_FILES, POLICY_SKILL_NAME } from './policy-skill.js';\n\n/** Managed Policy Engine Agent Skill definition. */\nconst POLICY_MANAGED_SKILL: ManagedAgentSkillDefinition = {\n name: POLICY_SKILL_NAME,\n displayName: 'Policy Engine',\n owner: '@transcend-io/cli',\n files: POLICY_SKILL_FILES,\n};\n\n/** In-memory input consumed by the pure policy initializer. */\nexport interface PolicyInitPlanningInput {\n /** Project discovery state. */\n state: PolicyProjectState;\n /** Potential mutation paths keyed by absolute path. */\n snapshots: Readonly<Record<string, PlanningPathSnapshot>>;\n}\n\n/** Optional repository setup selected for policy initialization. */\nexport interface PolicyInitPlanOptions {\n /** Selected setup features. */\n features: readonly PolicySetupFeatureType[];\n /** Exact released Transcend CLI version for generated CI. */\n cliVersion: string;\n}\n\n/**\n * Enumerate all core starter paths that could be created.\n *\n * @param state - Policy project state\n * @param options - Selected repository setup\n * @returns Absolute candidate paths\n */\nexport function getPolicyInitPlanningCandidatePaths(\n state: PolicyProjectState,\n options: Pick<PolicyInitPlanOptions, 'features'>,\n): string[] {\n const paths = new Set(\n generatePolicyWorkspaceFiles().map(({ path }) => join(state.targetDirectory, path)),\n );\n const selected = new Set(options.features);\n if (selected.has(PolicySetupFeature.Editor)) {\n paths.add(join(state.projectRoot, '.vscode', 'settings.json'));\n paths.add(join(state.projectRoot, '.vscode', 'extensions.json'));\n paths.add(join(state.projectRoot, '.vscode', 'tasks.json'));\n }\n if (selected.has(PolicySetupFeature.Skill)) {\n getManagedAgentSkillCandidatePaths(\n state.projectRoot,\n state.existingSkillDirectories,\n POLICY_MANAGED_SKILL,\n ).forEach((path) => paths.add(path));\n }\n if (selected.has(PolicySetupFeature.Ci) && state.repositoryRoot && state.usesGithub) {\n paths.add(join(state.repositoryRoot, POLICY_CI_WORKFLOW_PATH));\n }\n return [...paths].sort((left, right) => left.localeCompare(right));\n}\n\n/**\n * Ensure a destination stays below an approved project root.\n *\n * @param root - Approved root\n * @param path - Candidate path\n */\nfunction assertContained(root: string, path: string): void {\n const child = relative(root, path);\n if (child === '..' || child.startsWith(`..${sep}`) || isAbsolute(child)) {\n throw new Error(`Refusing to modify path outside project root: ${path}`);\n }\n}\n\n/**\n * Enumerate generated file and directory paths allowed in an exact starter.\n *\n * @param files - Starter files\n * @returns POSIX relative paths\n */\nfunction starterRelativePaths(files: readonly PolicyStarterFile[]): Set<string> {\n const paths = new Set<string>([`${POLICY_STARTER_BUNDLE_DIRECTORY}/input.json`]);\n files.forEach(({ path }) => {\n paths.add(path);\n let parent = posix.dirname(path);\n while (parent !== '.') {\n paths.add(parent);\n parent = posix.dirname(parent);\n }\n });\n return paths;\n}\n\n/**\n * Add or classify one regular-file mutation.\n *\n * @param plan - Policy plan being assembled\n * @param input - Collected snapshots\n * @param options - Desired file\n */\nfunction addFileChange(\n plan: PolicyInitProjectPlan,\n input: PolicyInitPlanningInput,\n options: {\n /** Absolute destination path. */\n path: string;\n /** Complete desired contents. */\n contents: string;\n /** Human-readable plan description. */\n description: string;\n /** Refuse existing contents. */\n createOnly?: boolean;\n },\n): void {\n const change = planFileChange({\n snapshot: getPlanningFileSnapshot(input.snapshots, options.path),\n after: options.contents,\n description: options.description,\n ...(options.createOnly === undefined ? {} : { createOnly: options.createOnly }),\n });\n if (change) {\n plan.changes.push(change);\n } else {\n plan.unchanged.push(options.path);\n }\n}\n\n/**\n * Add one safe editor merge and its preservation warnings.\n *\n * @param plan - Policy plan being assembled\n * @param input - Collected snapshots\n * @param path - Absolute editor artifact path\n * @param result - Pure JSONC merge result\n * @param description - Human-readable plan description\n * @param cwd - Invocation directory for portable warning paths\n */\nfunction addEditorMerge(\n plan: PolicyInitProjectPlan,\n input: PolicyInitPlanningInput,\n path: string,\n result: PolicyEditorMergeResult,\n description: string,\n cwd: string,\n): void {\n addFileChange(plan, input, {\n path,\n contents: result.contents,\n description,\n });\n plan.warnings.push(\n ...result.warnings.map((warning) => `${warning} (${displayProjectPath(cwd, path)})`),\n );\n}\n\n/**\n * Build a safe policy project plan without reading the filesystem.\n *\n * Empty targets receive the complete starter. Existing targets are classified\n * only; no domain file is added, merged, or overwritten.\n *\n * @param input - Collected project state and path snapshots\n * @param options - Selected setup and pinned CLI version\n * @returns Validated policy initialization plan\n */\nexport function buildPolicyInitPlan(\n input: PolicyInitPlanningInput,\n options: PolicyInitPlanOptions,\n): PolicyInitProjectPlan {\n const { state } = input;\n const files = generatePolicyWorkspaceFiles();\n const newCommand = 'transcend policy new';\n const plan: PolicyInitProjectPlan = {\n version: POLICY_INIT_RESULT_VERSION,\n command: 'init',\n rootDirectory: state.projectRoot,\n targetDirectory: state.targetDirectory,\n // Init creates a workspace only; bundles (and their .manifest) come from `policy new`.\n manifestPath: state.targetDirectory,\n changes: [],\n unchanged: [],\n warnings: [],\n nextSteps: [newCommand],\n features: [...options.features],\n };\n\n const candidatePaths = getPolicyInitPlanningCandidatePaths(state, options);\n assertContained(state.projectRoot, state.targetDirectory);\n candidatePaths.forEach((path) => assertContained(state.projectRoot, path));\n\n if (state.relativeFilePaths.length === 0) {\n plan.directoryPreconditions = [\n {\n path: state.targetDirectory,\n relativePaths: [...state.relativePaths],\n },\n ];\n files.forEach((file) => {\n const path = join(state.targetDirectory, file.path);\n const snapshot = getPlanningPathSnapshot(input.snapshots, path);\n if (snapshot.kind !== 'absent') {\n throw new Error(`Expected an empty policy target, but found an entry at: ${path}`);\n }\n addFileChange(plan, input, {\n path,\n contents: file.contents,\n description: file.description,\n createOnly: true,\n });\n });\n } else {\n let allWorkspaceFilesMatch = true;\n files.forEach((file) => {\n const path = join(state.targetDirectory, file.path);\n const snapshot = getPlanningPathSnapshot(input.snapshots, path);\n if (snapshot.kind === 'file' && snapshot.contents === file.contents) {\n plan.unchanged.push(path);\n return;\n }\n allWorkspaceFilesMatch = false;\n if (snapshot.kind !== 'absent') {\n plan.unchanged.push(path);\n plan.warnings.push(\n `Existing policy scaffold path was left unchanged: ${displayProjectPath(\n state.invocationDirectory,\n path,\n )}`,\n );\n }\n });\n\n const allowedPaths = starterRelativePaths(files);\n const hasCustomPaths = state.relativeFilePaths.some((path) => !allowedPaths.has(path));\n if (!allWorkspaceFilesMatch || hasCustomPaths) {\n plan.warnings.push(\n `Existing policy target contains custom or partial content, so no workspace files were added or overwritten. ` +\n `Review ${displayProjectPath(\n state.invocationDirectory,\n state.targetDirectory,\n )} manually, then run \\`${newCommand}\\`.`,\n );\n }\n }\n\n const selected = new Set(options.features);\n const root = state.projectRoot;\n if (selected.has(PolicySetupFeature.Editor)) {\n const settingsPath = join(root, '.vscode', 'settings.json');\n const extensionsPath = join(root, '.vscode', 'extensions.json');\n const tasksPath = join(root, '.vscode', 'tasks.json');\n\n type EditorMergeFn = (\n contents: string | null,\n repositoryRoot: string,\n targetDirectory: string,\n ) => PolicyEditorMergeResult;\n const editorArtifacts: {\n /** Absolute path. */\n path: string;\n /** Plan description. */\n description: string;\n /** Merge function. */\n merge: EditorMergeFn;\n }[] = [\n {\n path: settingsPath,\n description: 'Merge strict target-scoped OPA and Rego editor settings',\n merge: (contents, repositoryRoot, targetDirectory) =>\n mergePolicyEditorSettings(contents, repositoryRoot, targetDirectory),\n },\n {\n path: extensionsPath,\n description: 'Recommend the OPA extension and discourage its syntax-only conflict',\n merge: (contents) => mergePolicyEditorExtensions(contents),\n },\n {\n path: tasksPath,\n description: 'Create the VS Code task configuration',\n merge: (contents, repositoryRoot, targetDirectory) =>\n mergePolicyEditorTasks(contents, repositoryRoot, targetDirectory),\n },\n ];\n editorArtifacts.forEach(({ path, description, merge }) => {\n const snapshot = getPlanningPathSnapshot(input.snapshots, path);\n if (snapshot.kind !== 'absent' && snapshot.kind !== 'file') {\n plan.unchanged.push(path);\n plan.warnings.push(\n `Existing VS Code artifact is not a regular file and was left unchanged: ${displayProjectPath(\n state.invocationDirectory,\n path,\n )}`,\n );\n return;\n }\n addEditorMerge(\n plan,\n input,\n path,\n merge(snapshot.kind === 'file' ? snapshot.contents : null, root, state.targetDirectory),\n description,\n state.invocationDirectory,\n );\n });\n }\n\n if (selected.has(PolicySetupFeature.Skill)) {\n const skillPlan = planManagedAgentSkill({\n rootDirectory: root,\n existingDirectories: state.existingSkillDirectories,\n snapshots: input.snapshots,\n skill: POLICY_MANAGED_SKILL,\n preserveModified: true,\n });\n plan.changes.push(...skillPlan.changes);\n plan.unchanged.push(...skillPlan.unchanged);\n plan.warnings.push(\n ...skillPlan.warnings.map((warning) => {\n return skillPlan.unchanged.reduce(\n (rendered, path) =>\n rendered.replace(path, displayProjectPath(state.invocationDirectory, path)),\n warning,\n );\n }),\n );\n }\n\n if (selected.has(PolicySetupFeature.Ci)) {\n if (!state.repositoryRoot || !state.usesGithub) {\n plan.warnings.push(\n 'GitHub Actions setup was selected, but this target is not inside a detected GitHub repository.',\n );\n } else {\n const workflowPath = join(state.repositoryRoot, POLICY_CI_WORKFLOW_PATH);\n const workspaceDirectory =\n relative(state.repositoryRoot, state.targetDirectory).split(sep).join('/') || '.';\n const workflowContents = generatePolicyGithubActionsWorkflow({\n cliVersion: options.cliVersion,\n workspaceDirectory,\n bundleDirectories: [],\n });\n const workflowSnapshot = getPlanningPathSnapshot(input.snapshots, workflowPath);\n if (workflowSnapshot.kind === 'absent') {\n addFileChange(plan, input, {\n path: workflowPath,\n contents: workflowContents,\n description: 'Add credential-free Policy Engine validation',\n createOnly: true,\n });\n } else if (\n workflowSnapshot.kind === 'file' &&\n workflowSnapshot.contents === workflowContents\n ) {\n plan.unchanged.push(workflowPath);\n } else {\n plan.unchanged.push(workflowPath);\n plan.warnings.push(\n `Existing GitHub Actions workflow was left unchanged: ${displayProjectPath(\n state.invocationDirectory,\n workflowPath,\n )}. Adapt it manually to validate each policy bundle.`,\n );\n }\n }\n }\n\n plan.changes.forEach(({ path }) => assertContained(state.projectRoot, path));\n return plan;\n}\n","import colors from 'colors';\n\nimport { version as CLI_VERSION } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport {\n runCapturedProcess,\n type CapturedProcessResult,\n type CapturedProcessRunner,\n} from '../../../lib/cli/run-captured-process.js';\nimport {\n DEFAULT_POLICY_PROJECT_DIRECTORY,\n discoverPolicyProject,\n} from '../../../lib/policy/policy-project-discovery.js';\nimport {\n OPA_INSTALL_URL,\n OPA_MISSING_MESSAGE,\n parsePolicyToolVersion,\n MINIMUM_POLICY_STARTER_REGAL_VERSION,\n REGAL_INSTALL_URL,\n REGAL_MISSING_MESSAGE,\n unsupportedOpaVersionMessage,\n unsupportedRegalVersionMessage,\n} from '../../../lib/policy/policy-runtime.js';\nimport {\n PolicySetupFeature,\n type PolicySetupFeature as PolicySetupFeatureType,\n} from '../../../lib/policy/policy-scaffold-model.js';\nimport {\n buildPolicyInitAiHandoff,\n buildPolicyInitPlanResult,\n type PolicyInitToolVersions,\n} from '../../../lib/policy/policy-scaffold-output.js';\nimport {\n buildPolicyInitPlan,\n getPolicyInitPlanningCandidatePaths,\n} from '../../../lib/policy/policy-scaffold-planning.js';\nimport { POLICY_STARTER_OPA_VERSION } from '../../../lib/policy/policy-scaffold-templates.js';\nimport { collectPlanningSnapshots } from '../../../lib/scaffolding/project-discovery.js';\nimport { applyProjectPlan } from '../../../lib/scaffolding/project-plan-apply.js';\nimport {\n displayProjectPath,\n quoteShellArgument,\n renderProjectPlan,\n} from '../../../lib/scaffolding/project-plan-output.js';\nimport {\n isInteractivePromptInvocation,\n PromptCancelledError,\n resolveSetupFeatures,\n ScaffoldPrompts,\n} from '../../../lib/scaffolding/prompts.js';\n\n/** Flags for `transcend policy init`. */\nexport interface PolicyInitFlags {\n /** Install repository-level VS Code setup. */\n editor?: boolean;\n /** Install the Policy Engine Agent Skill. */\n skill?: boolean;\n /** Install validation-only GitHub Actions CI. */\n ci?: boolean;\n /** Disable prompts. */\n noInteractive: boolean;\n /** Render but do not apply the plan. */\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/** User-facing optional setup labels. */\nconst SETUP_LABELS: Readonly<Record<PolicySetupFeatureType, string>> = {\n [PolicySetupFeature.Editor]: 'VS Code settings and lint task',\n [PolicySetupFeature.Skill]: 'Policy Engine Agent Skill',\n [PolicySetupFeature.Ci]: 'Validation-only GitHub Actions',\n};\n\n/** All optional setup features in stable prompt order. */\nconst ALL_SETUP_FEATURES = Object.values(PolicySetupFeature);\n\n/** Runtime compatibility detected before policy planning. */\ninterface PolicyRuntimeProbe {\n /** Compatible tool versions. */\n tools: PolicyInitToolVersions;\n /** Missing or incompatible runtime guidance. */\n warnings: string[];\n}\n\n/**\n * Explain a failed version subprocess with official installation guidance.\n *\n * @param tool - Policy tool name\n * @param result - Failed captured process\n * @returns Actionable warning\n */\nfunction failedVersionProbeMessage(tool: 'OPA' | 'Regal', result: CapturedProcessResult): string {\n const detail = [result.stdout.trim(), result.stderr.trim()].filter(Boolean).join('\\n');\n const url = tool === 'OPA' ? OPA_INSTALL_URL : REGAL_INSTALL_URL;\n const requirement =\n tool === 'OPA' ? 'OPA 1.x' : `Regal ${MINIMUM_POLICY_STARTER_REGAL_VERSION} or newer`;\n return (\n `${requirement} is required, but \\`${tool.toLowerCase()} version\\` exited with code ` +\n `${result.code}${detail ? `: ${detail}` : '.'} ` +\n `Install or upgrade it using the official instructions: ${url}`\n );\n}\n\n/**\n * Probe both local policy runtimes without installing or modifying them.\n *\n * @param context - CLI context\n * @param cwd - Invocation working directory\n * @param runner - Captured subprocess runner\n * @returns Compatible versions and exact runtime guidance\n */\nasync function probePolicyRuntimes(\n context: LocalContext,\n cwd: string,\n runner: CapturedProcessRunner,\n): Promise<PolicyRuntimeProbe> {\n const tools: PolicyInitToolVersions = { opa: null, regal: null };\n const warnings: string[] = [];\n\n const opaResult = await runner('opa', ['version'], { cwd }, context);\n if (opaResult.error?.code === 'ENOENT') {\n warnings.push(OPA_MISSING_MESSAGE);\n } else {\n const output = `${opaResult.stdout}\\n${opaResult.stderr}`;\n const unsupported = unsupportedOpaVersionMessage(output);\n if (opaResult.code !== 0) {\n warnings.push(unsupported ?? failedVersionProbeMessage('OPA', opaResult));\n } else if (unsupported) {\n warnings.push(unsupported);\n } else {\n tools.opa = parsePolicyToolVersion(output)!.version;\n }\n }\n\n const regalResult = await runner('regal', ['version'], { cwd }, context);\n if (regalResult.error?.code === 'ENOENT') {\n warnings.push(REGAL_MISSING_MESSAGE);\n } else {\n const output = `${regalResult.stdout}\\n${regalResult.stderr}`;\n const unsupported = unsupportedRegalVersionMessage(\n output,\n MINIMUM_POLICY_STARTER_REGAL_VERSION,\n `the generated OPA ${POLICY_STARTER_OPA_VERSION} capabilities configuration`,\n );\n if (regalResult.code !== 0) {\n warnings.push(unsupported ?? failedVersionProbeMessage('Regal', regalResult));\n } else if (unsupported) {\n warnings.push(unsupported);\n } else {\n tools.regal = parsePolicyToolVersion(output)!.version;\n }\n }\n\n return { tools, warnings };\n}\n\n/**\n * Initialize a credential-free local Policy Engine project.\n *\n * @param this - CLI context\n * @param flags - Scaffold and interaction flags\n * @param directory - Target policy directory\n * @param runner - Captured policy tool runner\n */\nexport async function init(\n this: LocalContext,\n flags: PolicyInitFlags,\n directory: string = DEFAULT_POLICY_PROJECT_DIRECTORY,\n runner: CapturedProcessRunner = runCapturedProcess,\n): Promise<void> {\n doneInputValidation(this.process);\n try {\n const runtime = await probePolicyRuntimes(this, this.process.cwd(), runner);\n const state = discoverPolicyProject(this, directory);\n const prompts = new ScaffoldPrompts(this);\n const interactive = isInteractivePromptInvocation(\n flags,\n this.process.stdin.isTTY,\n this.process.stderr.isTTY,\n );\n const features = await resolveSetupFeatures(prompts, {\n features: ALL_SETUP_FEATURES,\n labels: SETUP_LABELS,\n enabled: {\n [PolicySetupFeature.Editor]: flags.editor,\n [PolicySetupFeature.Skill]: flags.skill,\n [PolicySetupFeature.Ci]: flags.ci,\n },\n interactive,\n });\n const candidatePaths = getPolicyInitPlanningCandidatePaths(state, { features });\n const snapshots = collectPlanningSnapshots(this, state.projectRoot, candidatePaths);\n\n const plan = buildPolicyInitPlan(\n { state, snapshots },\n {\n features,\n cliVersion: CLI_VERSION,\n },\n );\n plan.warnings.push(...runtime.warnings);\n\n if (!flags.json) {\n this.logger.info(\n renderProjectPlan(plan, {\n cwd: this.process.cwd(),\n title: 'Policy initialization plan',\n details: [{ label: 'Target', path: plan.targetDirectory }],\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 setupAvailable = approved && !flags.dryRun;\n const aiHandoff = buildPolicyInitAiHandoff({\n projectPath: quoteShellArgument(\n displayProjectPath(this.process.cwd(), state.targetDirectory),\n ),\n hasSkill: setupAvailable && features.includes(PolicySetupFeature.Skill),\n newCommand: plan.nextSteps[0]!,\n });\n const result = buildPolicyInitPlanResult(plan, {\n applied,\n dryRun: flags.dryRun,\n cwd: this.process.cwd(),\n aiHandoff,\n tools: runtime.tools,\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 if (plan.changes.length === 0) {\n const message =\n plan.warnings.length === runtime.warnings.length\n ? 'Policy project is already initialized.'\n : 'Existing policy project was left unchanged.';\n this.logger.info(colors.green(message));\n } else {\n this.logger.info(colors.green('Policy project initialized.'));\n }\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) {\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,GAAI,aAAiB,EACnB,OAAO,KAAK,QAAQ,KAAK,IAAI,CAE/B,MAAM"}
@@ -1,2 +1,2 @@
1
- import{o as e,r as t}from"./readTranscendYaml-BNn6-Ofi.mjs";import{t as n}from"./listFiles-BdFUbX5x.mjs";import{t as r}from"./done-input-validation-BUz-aVC5.mjs";import{t as i}from"./dataFlowsToDataSilos-BF6fzWcm.mjs";import a from"node:path";import o from"colors";import{buildTranscendGraphQLClient as s,fetchAndIndexCatalogs as c}from"@transcend-io/sdk";async function l({auth:l,dataFlowsYmlFolder:u,dataSilosYmlFolder:d,ignoreYmls:f=[],transcendUrl:p}){r(this.process),(!this.fs.existsSync(u)||!this.fs.lstatSync(u).isDirectory())&&(this.logger.error(o.red(`Folder does not exist: "${u}"`)),this.process.exit(1)),(!this.fs.existsSync(d)||!this.fs.lstatSync(d).isDirectory())&&(this.logger.error(o.red(`Folder does not exist: "${d}"`)),this.process.exit(1));let{serviceToTitle:m,serviceToSupportedIntegration:h}=await c(s(p,l),{logger:this.logger});n(this.fs.readdirSync(u)).forEach(n=>{let r=a.join(u,n),{"data-flows":o=[]}=t(this.fs.readFileSync(r,`utf8`),{},r),{adTechDataSilos:s,siteTechDataSilos:c}=i(o,{serviceToSupportedIntegration:h,serviceToTitle:m}),l=[...s,...c];this.logger.log(`Total Services: ${l.length}`),this.logger.log(`Ad Tech Services: ${s.length}`),this.logger.log(`Site Tech Services: ${c.length}`),this.fs.writeFileSync(a.join(d,n),e({"data-silos":f.includes(n)?[]:l}))})}export{l as deriveDataSilosFromDataFlows};
2
- //# sourceMappingURL=impl-BPoEH3Nf2.mjs.map
1
+ import{o as e,r as t}from"./readTranscendYaml-BfqQbPiT.mjs";import{t as n}from"./listFiles-DDGCBdtx.mjs";import{t as r}from"./done-input-validation-LiTaCEzF.mjs";import{t as i}from"./dataFlowsToDataSilos-CRqbNjZ0.mjs";import a from"node:path";import o from"colors";import{buildTranscendGraphQLClient as s,fetchAndIndexCatalogs as c}from"@transcend-io/sdk";async function l({auth:l,dataFlowsYmlFolder:u,dataSilosYmlFolder:d,ignoreYmls:f=[],transcendUrl:p}){r(this.process),(!this.fs.existsSync(u)||!this.fs.lstatSync(u).isDirectory())&&(this.logger.error(o.red(`Folder does not exist: "${u}"`)),this.process.exit(1)),(!this.fs.existsSync(d)||!this.fs.lstatSync(d).isDirectory())&&(this.logger.error(o.red(`Folder does not exist: "${d}"`)),this.process.exit(1));let{serviceToTitle:m,serviceToSupportedIntegration:h}=await c(s(p,l),{logger:this.logger});n(this.fs.readdirSync(u)).forEach(n=>{let r=a.join(u,n),{"data-flows":o=[]}=t(this.fs.readFileSync(r,`utf8`),{},r),{adTechDataSilos:s,siteTechDataSilos:c}=i(o,{serviceToSupportedIntegration:h,serviceToTitle:m}),l=[...s,...c];this.logger.log(`Total Services: ${l.length}`),this.logger.log(`Ad Tech Services: ${s.length}`),this.logger.log(`Site Tech Services: ${c.length}`),this.fs.writeFileSync(a.join(d,n),e({"data-silos":f.includes(n)?[]:l}))})}export{l as deriveDataSilosFromDataFlows};
2
+ //# sourceMappingURL=impl-B94dMG4x2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-BPoEH3Nf2.mjs","names":[],"sources":["../src/commands/inventory/derive-data-silos-from-data-flows/impl.ts"],"sourcesContent":["import path from 'node:path';\n\nimport { buildTranscendGraphQLClient, fetchAndIndexCatalogs } from '@transcend-io/sdk';\nimport colors from 'colors';\n\nimport { DataFlowInput } from '../../../codecs.js';\nimport type { LocalContext } from '../../../context.js';\nimport { filterFileNames } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { dataFlowsToDataSilos } from '../../../lib/consent-manager/dataFlowsToDataSilos.js';\nimport { parseTranscendYaml, serializeTranscendYaml } from '../../../lib/readTranscendYaml.js';\n\nexport interface DeriveDataSilosFromDataFlowsCommandFlags {\n auth: string;\n dataFlowsYmlFolder: string;\n dataSilosYmlFolder: string;\n ignoreYmls?: string[];\n transcendUrl: string;\n}\n\nexport async function deriveDataSilosFromDataFlows(\n this: LocalContext,\n {\n auth,\n dataFlowsYmlFolder,\n dataSilosYmlFolder,\n ignoreYmls = [],\n transcendUrl,\n }: DeriveDataSilosFromDataFlowsCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n // Ensure folder is passed\n if (\n !this.fs.existsSync(dataFlowsYmlFolder) ||\n !this.fs.lstatSync(dataFlowsYmlFolder).isDirectory()\n ) {\n this.logger.error(colors.red(`Folder does not exist: \"${dataFlowsYmlFolder}\"`));\n this.process.exit(1);\n }\n\n // Ensure folder is passed\n if (\n !this.fs.existsSync(dataSilosYmlFolder) ||\n !this.fs.lstatSync(dataSilosYmlFolder).isDirectory()\n ) {\n this.logger.error(colors.red(`Folder does not exist: \"${dataSilosYmlFolder}\"`));\n this.process.exit(1);\n }\n\n // Fetch all integrations in the catalog\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const { serviceToTitle, serviceToSupportedIntegration } = await fetchAndIndexCatalogs(client, {\n logger: this.logger,\n });\n\n // List of each data flow yml file\n filterFileNames(this.fs.readdirSync(dataFlowsYmlFolder)).forEach((directory) => {\n const inputPath = path.join(dataFlowsYmlFolder, directory);\n\n // read in the data flows for a specific instance\n const { 'data-flows': dataFlows = [] } = parseTranscendYaml(\n this.fs.readFileSync(inputPath, 'utf8'),\n {},\n inputPath,\n );\n\n // map the data flows to data silos\n const { adTechDataSilos, siteTechDataSilos } = dataFlowsToDataSilos(\n dataFlows as DataFlowInput[],\n {\n serviceToSupportedIntegration,\n serviceToTitle,\n },\n );\n\n // combine and write to yml file\n const dataSilos = [...adTechDataSilos, ...siteTechDataSilos];\n this.logger.log(`Total Services: ${dataSilos.length}`);\n this.logger.log(`Ad Tech Services: ${adTechDataSilos.length}`);\n this.logger.log(`Site Tech Services: ${siteTechDataSilos.length}`);\n this.fs.writeFileSync(\n path.join(dataSilosYmlFolder, directory),\n serializeTranscendYaml({\n 'data-silos': ignoreYmls.includes(directory) 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sources":["../src/commands/inventory/derive-data-silos-from-data-flows/impl.ts"],"sourcesContent":["import path from 'node:path';\n\nimport { buildTranscendGraphQLClient, fetchAndIndexCatalogs } from '@transcend-io/sdk';\nimport colors from 'colors';\n\nimport { DataFlowInput } from '../../../codecs.js';\nimport type { LocalContext } from '../../../context.js';\nimport { filterFileNames } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { dataFlowsToDataSilos } from '../../../lib/consent-manager/dataFlowsToDataSilos.js';\nimport { parseTranscendYaml, serializeTranscendYaml } from '../../../lib/readTranscendYaml.js';\n\nexport interface DeriveDataSilosFromDataFlowsCommandFlags {\n auth: string;\n dataFlowsYmlFolder: string;\n dataSilosYmlFolder: string;\n ignoreYmls?: string[];\n transcendUrl: string;\n}\n\nexport async function deriveDataSilosFromDataFlows(\n this: LocalContext,\n {\n auth,\n dataFlowsYmlFolder,\n dataSilosYmlFolder,\n ignoreYmls = [],\n transcendUrl,\n }: DeriveDataSilosFromDataFlowsCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n // Ensure folder is passed\n if (\n !this.fs.existsSync(dataFlowsYmlFolder) ||\n !this.fs.lstatSync(dataFlowsYmlFolder).isDirectory()\n ) {\n this.logger.error(colors.red(`Folder does not exist: \"${dataFlowsYmlFolder}\"`));\n this.process.exit(1);\n }\n\n // Ensure folder is passed\n if (\n !this.fs.existsSync(dataSilosYmlFolder) ||\n !this.fs.lstatSync(dataSilosYmlFolder).isDirectory()\n ) {\n this.logger.error(colors.red(`Folder does not exist: \"${dataSilosYmlFolder}\"`));\n this.process.exit(1);\n }\n\n // Fetch all integrations in the catalog\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const { serviceToTitle, serviceToSupportedIntegration } = await fetchAndIndexCatalogs(client, {\n logger: this.logger,\n });\n\n // List of each data flow yml file\n filterFileNames(this.fs.readdirSync(dataFlowsYmlFolder)).forEach((directory) => {\n const inputPath = path.join(dataFlowsYmlFolder, directory);\n\n // read in the data flows for a specific instance\n const { 'data-flows': dataFlows = [] } = parseTranscendYaml(\n this.fs.readFileSync(inputPath, 'utf8'),\n {},\n inputPath,\n );\n\n // map the data flows to data silos\n const { adTechDataSilos, siteTechDataSilos } = dataFlowsToDataSilos(\n dataFlows as DataFlowInput[],\n {\n serviceToSupportedIntegration,\n serviceToTitle,\n },\n );\n\n // combine and write to yml file\n const dataSilos = [...adTechDataSilos, ...siteTechDataSilos];\n this.logger.log(`Total Services: ${dataSilos.length}`);\n this.logger.log(`Ad Tech Services: ${adTechDataSilos.length}`);\n this.logger.log(`Site Tech Services: ${siteTechDataSilos.length}`);\n this.fs.writeFileSync(\n path.join(dataSilosYmlFolder, directory),\n serializeTranscendYaml({\n 'data-silos': ignoreYmls.includes(directory) ? [] : dataSilos,\n }),\n );\n });\n}\n"],"mappings":"oWAoBA,eAAsB,EAEpB,CACE,OACA,qBACA,qBACA,aAAa,EAAE,CACf,gBAEa,CACf,EAAoB,KAAK,QAAQ,EAI/B,CAAC,KAAK,GAAG,WAAW,EAAmB,EACvC,CAAC,KAAK,GAAG,UAAU,EAAmB,CAAC,aAAa,IAEpD,KAAK,OAAO,MAAM,EAAO,IAAI,2BAA2B,EAAmB,GAAG,CAAC,CAC/E,KAAK,QAAQ,KAAK,EAAE,GAKpB,CAAC,KAAK,GAAG,WAAW,EAAmB,EACvC,CAAC,KAAK,GAAG,UAAU,EAAmB,CAAC,aAAa,IAEpD,KAAK,OAAO,MAAM,EAAO,IAAI,2BAA2B,EAAmB,GAAG,CAAC,CAC/E,KAAK,QAAQ,KAAK,EAAE,EAKtB,GAAM,CAAE,iBAAgB,iCAAkC,MAAM,EADjD,EAA4B,EAAc,EACmC,CAAE,CAC5F,OAAQ,KAAK,OACd,CAAC,CAGF,EAAgB,KAAK,GAAG,YAAY,EAAmB,CAAC,CAAC,QAAS,GAAc,CAC9E,IAAM,EAAY,EAAK,KAAK,EAAoB,EAAU,CAGpD,CAAE,aAAc,EAAY,EAAE,EAAK,EACvC,KAAK,GAAG,aAAa,EAAW,OAAO,CACvC,EAAE,CACF,EACD,CAGK,CAAE,kBAAiB,qBAAsB,EAC7C,EACA,CACE,gCACA,iBACD,CACF,CAGK,EAAY,CAAC,GAAG,EAAiB,GAAG,EAAkB,CAC5D,KAAK,OAAO,IAAI,mBAAmB,EAAU,SAAS,CACtD,KAAK,OAAO,IAAI,qBAAqB,EAAgB,SAAS,CAC9D,KAAK,OAAO,IAAI,uBAAuB,EAAkB,SAAS,CAClE,KAAK,GAAG,cACN,EAAK,KAAK,EAAoB,EAAU,CACxC,EAAuB,CACrB,aAAc,EAAW,SAAS,EAAU,CAAG,EAAE,CAAG,EACrD,CAAC,CACH,EACD"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./pullChunkedCustomSiloOutstandingIdentifiers-DbFFXAVM.mjs";import{i as t,s as n}from"./writeCsv-D-2siSwE.mjs";import{t as r}from"./done-input-validation-BUz-aVC5.mjs";import{uniq as i}from"lodash-es";import a from"colors";async function o({file:o,transcendUrl:s,auth:c,sombraAuth:l,dataSiloId:u,actions:d,pageLimit:f,skipRequestCount:p,chunkSize:m}){p&&this.logger.info(a.yellow(`Skipping request count as requested. This may help speed up the call.`)),(Number.isNaN(m)||m<=0||m%f!==0)&&(this.logger.error(a.red(`Invalid chunk size: "${m}". Must be a positive integer that is a multiple of ${f}.`)),this.process.exit(1)),r(this.process);let{baseName:h,extension:g}=t(o),_=0;await e({transcendUrl:s,apiPageSize:f,savePageSize:m,onSave:async e=>{let t=`${h}-${_}${g}`;return this.logger.info(a.blue(`Saving ${e.length} identifiers to file "${t}"`)),await n(t,e,i(e.map(e=>Object.keys(e)).flat())),this.logger.info(a.green(`Successfully wrote ${e.length} identifiers to file "${t}"`)),_+=1,Promise.resolve()},actions:d,auth:c,sombraAuth:l,dataSiloId:u,skipRequestCount:p})}export{o as pullIdentifiers};
2
- //# sourceMappingURL=impl-BEA5cQOT2.mjs.map
1
+ import{t as e}from"./pullChunkedCustomSiloOutstandingIdentifiers-BfNNWqeI.mjs";import{i as t,s as n}from"./writeCsv-CNZrq3zU.mjs";import{t as r}from"./done-input-validation-LiTaCEzF.mjs";import{uniq as i}from"lodash-es";import a from"colors";async function o({file:o,transcendUrl:s,auth:c,sombraAuth:l,dataSiloId:u,actions:d,pageLimit:f,skipRequestCount:p,chunkSize:m}){p&&this.logger.info(a.yellow(`Skipping request count as requested. This may help speed up the call.`)),(Number.isNaN(m)||m<=0||m%f!==0)&&(this.logger.error(a.red(`Invalid chunk size: "${m}". Must be a positive integer that is a multiple of ${f}.`)),this.process.exit(1)),r(this.process);let{baseName:h,extension:g}=t(o),_=0;await e({transcendUrl:s,apiPageSize:f,savePageSize:m,onSave:async e=>{let t=`${h}-${_}${g}`;return this.logger.info(a.blue(`Saving ${e.length} identifiers to file "${t}"`)),await n(t,e,i(e.map(e=>Object.keys(e)).flat())),this.logger.info(a.green(`Successfully wrote ${e.length} identifiers to file "${t}"`)),_+=1,Promise.resolve()},actions:d,auth:c,sombraAuth:l,dataSiloId:u,skipRequestCount:p})}export{o as pullIdentifiers};
2
+ //# sourceMappingURL=impl-BD03bzB-.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl-BD03bzB-.mjs","names":[],"sources":["../src/commands/request/cron/pull-identifiers/impl.ts"],"sourcesContent":["import { RequestAction } from '@transcend-io/privacy-types';\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 {\n CsvFormattedIdentifier,\n pullChunkedCustomSiloOutstandingIdentifiers,\n} from '../../../../lib/cron/index.js';\nimport { parseFilePath, writeLargeCsv } from '../../../../lib/helpers/index.js';\n\nexport interface PullIdentifiersCommandFlags {\n file: string;\n transcendUrl: string;\n auth: string;\n sombraAuth?: string;\n dataSiloId: string;\n actions: RequestAction[];\n pageLimit: number;\n skipRequestCount: boolean;\n chunkSize: number;\n}\n\nexport async function pullIdentifiers(\n this: LocalContext,\n {\n file,\n transcendUrl,\n auth,\n sombraAuth,\n dataSiloId,\n actions,\n pageLimit,\n skipRequestCount,\n chunkSize,\n }: PullIdentifiersCommandFlags,\n): Promise<void> {\n if (skipRequestCount) {\n this.logger.info(\n colors.yellow('Skipping request count as requested. This may help speed up the call.'),\n );\n }\n\n if (Number.isNaN(chunkSize) || chunkSize <= 0 || chunkSize % pageLimit !== 0) {\n this.logger.error(\n colors.red(\n `Invalid chunk size: \"${chunkSize}\". Must be a positive integer that is a multiple of ${pageLimit}.`,\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process);\n\n const { baseName, extension } = parseFilePath(file);\n let fileCount = 0;\n\n const onSave = async (chunk: CsvFormattedIdentifier[]): Promise<void> => {\n const numberedFileName = `${baseName}-${fileCount}${extension}`;\n this.logger.info(\n colors.blue(`Saving ${chunk.length} identifiers to file \"${numberedFileName}\"`),\n );\n\n const headers = uniq(chunk.map((d) => Object.keys(d)).flat());\n await writeLargeCsv(numberedFileName, chunk, headers);\n this.logger.info(\n colors.green(`Successfully wrote ${chunk.length} identifiers to file \"${numberedFileName}\"`),\n );\n fileCount += 1;\n return Promise.resolve();\n };\n\n // Pull down outstanding identifiers\n await pullChunkedCustomSiloOutstandingIdentifiers({\n transcendUrl,\n apiPageSize: pageLimit,\n savePageSize: chunkSize,\n onSave,\n actions,\n auth,\n sombraAuth,\n dataSiloId,\n skipRequestCount,\n });\n}\n"],"mappings":"kPAwBA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,aACA,aACA,UACA,YACA,mBACA,aAEa,CACX,GACF,KAAK,OAAO,KACV,EAAO,OAAO,wEAAwE,CACvF,EAGC,OAAO,MAAM,EAAU,EAAI,GAAa,GAAK,EAAY,IAAc,KACzE,KAAK,OAAO,MACV,EAAO,IACL,wBAAwB,EAAU,sDAAsD,EAAU,GACnG,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,EAAoB,KAAK,QAAQ,CAEjC,GAAM,CAAE,WAAU,aAAc,EAAc,EAAK,CAC/C,EAAY,EAkBhB,MAAM,EAA4C,CAChD,eACA,YAAa,EACb,aAAc,EACd,YApBoB,IAAmD,CACvE,IAAM,EAAmB,GAAG,EAAS,GAAG,IAAY,IAWpD,OAVA,KAAK,OAAO,KACV,EAAO,KAAK,UAAU,EAAM,OAAO,wBAAwB,EAAiB,GAAG,CAChF,CAGD,MAAM,EAAc,EAAkB,EADtB,EAAK,EAAM,IAAK,GAAM,OAAO,KAAK,EAAE,CAAC,CAAC,MAAM,CACR,CAAC,CACrD,KAAK,OAAO,KACV,EAAO,MAAM,sBAAsB,EAAM,OAAO,wBAAwB,EAAiB,GAAG,CAC7F,CACD,GAAa,EACN,QAAQ,SAAS,EASxB,UACA,OACA,aACA,aACA,mBACD,CAAC"}
@@ -1,2 +1,2 @@
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-CKH-24w5.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-BpMQYnbR.mjs.map
1
+ import{t as e}from"./collectParquetFilesOrExit-CbNQ9CJc.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";import{n,r,t as i}from"./createPoolingCommandUi-JBOW5UxY.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-BGtup1F9.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-BpMQYnbR.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-BGtup1F9.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{r as e,t}from"./writeCsv-D-2siSwE.mjs";import{t as n}from"./done-input-validation-BUz-aVC5.mjs";import r from"colors";import{buildTranscendGraphQLClient as i,createSombraGotInstance as a,fetchAllIdentifiers as o,fetchAllPurposesAndPreferences as s,fetchConsentPreferences as c,fetchConsentPreferencesChunked as l,transformPreferenceRecordToCsv as u}from"@transcend-io/sdk";const d=[`userId`,`timestamp`,`partition`,`decryptionStatus`,`updatedAt`,`usp`,`gpp`,`tcf`,`airgapVersion`,`metadata`,`metadataTimestamp`];async function f({auth:f,partition:p,sombraAuth:m,file:h,transcendUrl:g,timestampBefore:_,timestampAfter:v,updatedBefore:y,updatedAfter:b,identifiers:x=[],concurrency:S,shouldChunk:C,windowConcurrency:w,maxChunks:T,exportIdentifiersWithDelimiter:E,maxLookbackDays:D}){n(this.process);let O=await a(g,f,{logger:this.logger,sombraApiKey:m,sombraUrl:this.process.env.SOMBRA_URL}),k=i(g,f),A=x.map(e=>{if(!e.includes(`:`))return{name:`email`,value:e};let[t,n]=e.split(`:`);return{name:t,value:n}}),j={..._?{timestampBefore:_.toISOString()}:{},...v?{timestampAfter:v.toISOString()}:{},...b||y?{system:{...y?{updatedBefore:y.toISOString()}:{},...b?{updatedAfter:b.toISOString()}:{}}}:{},...A.length>0?{identifiers:A}:{}};this.logger.info(`Fetching consent preferences from partition ${p}, using mode=${C?`chunked-stream`:`paged-stream`}...`),this.logger.info(r.magenta(`Preparing CSV at: ${h}`));let[M,N]=await Promise.all([s(k,{logger:this.logger}),o(k,{logger:this.logger})]),P=N.map(e=>e.name),F=Array.from(new Set(M.flatMap(e=>e.topics?.map(t=>`${e.trackingType}_${t.slug}`)??[]))).sort((e,t)=>e.localeCompare(t)),I=Array.from(new Set(M.map(e=>e.trackingType))).sort((e,t)=>e.localeCompare(t)),L=[...d,...P,...I,...F],R=null,z=!1,B=n=>{if(!n||n.length===0)return;let r=n.map(e=>u(e,E));if(!z){let t=Object.keys(r[0]??{}),n=new Set;R=[...L,...t].filter(e=>e===void 0||n.has(e)?!1:(n.add(e),!0)),e(h,R),z=!0}t(h,r,R)};if(C){await l(O,{partition:p,filterBy:j,limit:S,windowConcurrency:w,maxChunks:T,maxLookbackDays:D,logger:this.logger,onItems:e=>B(e)}),this.logger.info(r.green(`Finished writing CSV to ${h}`));return}await c(O,{partition:p,filterBy:j,limit:S,logger:this.logger,onItems:e=>B(e)}),this.logger.info(r.green(`Finished writing CSV to ${h}`))}export{f as pullConsentPreferences};
2
- //# sourceMappingURL=impl-DXowiNOz.mjs.map
1
+ import{r as e,t}from"./writeCsv-CNZrq3zU.mjs";import{t as n}from"./done-input-validation-LiTaCEzF.mjs";import r from"colors";import{buildTranscendGraphQLClient as i,createSombraGotInstance as a,fetchAllIdentifiers as o,fetchAllPurposesAndPreferences as s,fetchConsentPreferences as c,fetchConsentPreferencesChunked as l,transformPreferenceRecordToCsv as u}from"@transcend-io/sdk";const d=[`userId`,`timestamp`,`partition`,`decryptionStatus`,`updatedAt`,`usp`,`gpp`,`tcf`,`airgapVersion`,`metadata`,`metadataTimestamp`];async function f({auth:f,partition:p,sombraAuth:m,file:h,transcendUrl:g,timestampBefore:_,timestampAfter:v,updatedBefore:y,updatedAfter:b,identifiers:x=[],concurrency:S,shouldChunk:C,windowConcurrency:w,maxChunks:T,exportIdentifiersWithDelimiter:E,maxLookbackDays:D}){n(this.process);let O=await a(g,f,{logger:this.logger,sombraApiKey:m,sombraUrl:this.process.env.SOMBRA_URL}),k=i(g,f),A=x.map(e=>{if(!e.includes(`:`))return{name:`email`,value:e};let[t,n]=e.split(`:`);return{name:t,value:n}}),j={..._?{timestampBefore:_.toISOString()}:{},...v?{timestampAfter:v.toISOString()}:{},...b||y?{system:{...y?{updatedBefore:y.toISOString()}:{},...b?{updatedAfter:b.toISOString()}:{}}}:{},...A.length>0?{identifiers:A}:{}};this.logger.info(`Fetching consent preferences from partition ${p}, using mode=${C?`chunked-stream`:`paged-stream`}...`),this.logger.info(r.magenta(`Preparing CSV at: ${h}`));let[M,N]=await Promise.all([s(k,{logger:this.logger}),o(k,{logger:this.logger})]),P=N.map(e=>e.name),F=Array.from(new Set(M.flatMap(e=>e.topics?.map(t=>`${e.trackingType}_${t.slug}`)??[]))).sort((e,t)=>e.localeCompare(t)),I=Array.from(new Set(M.map(e=>e.trackingType))).sort((e,t)=>e.localeCompare(t)),L=[...d,...P,...I,...F],R=null,z=!1,B=n=>{if(!n||n.length===0)return;let r=n.map(e=>u(e,E));if(!z){let t=Object.keys(r[0]??{}),n=new Set;R=[...L,...t].filter(e=>e===void 0||n.has(e)?!1:(n.add(e),!0)),e(h,R),z=!0}t(h,r,R)};if(C){await l(O,{partition:p,filterBy:j,limit:S,windowConcurrency:w,maxChunks:T,maxLookbackDays:D,logger:this.logger,onItems:e=>B(e)}),this.logger.info(r.green(`Finished writing CSV to ${h}`));return}await c(O,{partition:p,filterBy:j,limit:S,logger:this.logger,onItems:e=>B(e)}),this.logger.info(r.green(`Finished writing CSV to ${h}`))}export{f as pullConsentPreferences};
2
+ //# sourceMappingURL=impl-BH1fCPDh.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DXowiNOz.mjs","names":[],"sources":["../src/commands/consent/pull-consent-preferences/impl.ts"],"sourcesContent":["import type { PreferenceQueryResponseItem } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n fetchAllIdentifiers,\n fetchAllPurposesAndPreferences,\n fetchConsentPreferences,\n fetchConsentPreferencesChunked,\n transformPreferenceRecordToCsv,\n type PreferenceIdentifier,\n} from '@transcend-io/sdk';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { initCsvFile, appendCsvRowsOrdered } from '../../../lib/helpers/index.js';\n\n// Known “core” columns your transformer usually produces up front.\n// Leave this list conservative; we’ll still union with transformer keys.\nconst CORE_COLS = [\n 'userId',\n 'timestamp',\n 'partition',\n 'decryptionStatus',\n 'updatedAt',\n 'usp',\n 'gpp',\n 'tcf',\n 'airgapVersion',\n 'metadata',\n 'metadataTimestamp',\n];\n\nexport interface PullConsentPreferencesCommandFlags {\n auth: string;\n partition: string;\n sombraAuth?: string;\n file: string;\n transcendUrl: string;\n timestampBefore?: Date;\n exportIdentifiersWithDelimiter: string;\n timestampAfter?: Date;\n updatedBefore?: Date;\n updatedAfter?: Date;\n identifiers?: string[];\n concurrency: number;\n shouldChunk: boolean;\n windowConcurrency: number;\n maxChunks: number;\n maxLookbackDays: number;\n}\n\nexport async function pullConsentPreferences(\n this: LocalContext,\n {\n auth,\n partition,\n sombraAuth,\n file,\n transcendUrl,\n timestampBefore,\n timestampAfter,\n updatedBefore,\n updatedAfter,\n identifiers = [],\n concurrency,\n shouldChunk,\n windowConcurrency,\n maxChunks,\n exportIdentifiersWithDelimiter,\n maxLookbackDays,\n }: PullConsentPreferencesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, {\n logger: this.logger,\n sombraApiKey: sombraAuth,\n sombraUrl: this.process.env.SOMBRA_URL,\n });\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Identifiers are key:value, parse to PreferenceIdentifier[]\n const parsedIdentifiers = identifiers.map((identifier): PreferenceIdentifier => {\n if (!identifier.includes(':')) {\n return {\n name: 'email',\n value: identifier,\n };\n }\n const [name, value] = identifier.split(':');\n return { name, value };\n });\n\n // Build filter\n const filterBy = {\n ...(timestampBefore ? { timestampBefore: timestampBefore.toISOString() } : {}),\n ...(timestampAfter ? { timestampAfter: timestampAfter.toISOString() } : {}),\n ...(updatedAfter || updatedBefore\n ? {\n system: {\n ...(updatedBefore ? { updatedBefore: updatedBefore.toISOString() } : {}),\n ...(updatedAfter ? { updatedAfter: updatedAfter.toISOString() } : {}),\n },\n }\n : {}),\n ...(parsedIdentifiers.length > 0 ? { identifiers: parsedIdentifiers } : {}),\n };\n\n this.logger.info(\n `Fetching consent preferences from partition ${partition}, using mode=${\n shouldChunk ? 'chunked-stream' : 'paged-stream'\n }...`,\n );\n\n this.logger.info(colors.magenta(`Preparing CSV at: ${file}`));\n\n // Fetch full sets (purposes+topics, identifiers) to ensure header completeness\n const [purposesWithTopics, allIdentifiers] = await Promise.all([\n fetchAllPurposesAndPreferences(client, { logger: this.logger }),\n fetchAllIdentifiers(client, { logger: this.logger }),\n ]);\n\n // Identifier columns: exactly the identifier names\n const identifierCols = allIdentifiers.map((i) => i.name);\n\n // Preference topic columns: topic names (de-duped)\n const topicCols = Array.from(\n new Set(\n purposesWithTopics.flatMap((p) => p.topics?.map((t) => `${p.trackingType}_${t.slug}`) ?? []),\n ),\n ).sort((a, b) => a.localeCompare(b));\n\n // Some setups also want a per-purpose boolean column (e.g., “Email”, “Sms”).\n // If your transformer includes those, list them here, derived from purposes:\n const purposeCols = Array.from(new Set(purposesWithTopics.map((p) => p.trackingType))).sort(\n (a, b) => a.localeCompare(b),\n );\n\n // Build the complete header skeleton.\n // We’ll still union with the first transformed row’s keys to be safe.\n const completeHeadersList = [...CORE_COLS, ...identifierCols, ...purposeCols, ...topicCols];\n\n // Lazily initialize CSV header order from the first transformed row.\n let headerOrder: string[] | null = null;\n let wroteHeader = false;\n const writeRows = (items: PreferenceQueryResponseItem[]): void => {\n if (!items || items.length === 0) return;\n const rows = items.map((row) =>\n transformPreferenceRecordToCsv(row, exportIdentifiersWithDelimiter),\n );\n if (!wroteHeader) {\n const firstKeys = Object.keys(rows[0] ?? {});\n const seen = new Set<string>();\n headerOrder = [...completeHeadersList, ...firstKeys].filter((k) => {\n if (k === undefined) return false;\n if (seen.has(k)) return false;\n seen.add(k);\n return true;\n });\n initCsvFile(file, headerOrder);\n wroteHeader = true;\n }\n appendCsvRowsOrdered(file, rows, headerOrder!);\n };\n\n if (shouldChunk) {\n // Stream via chunked fetcher with page callback\n await fetchConsentPreferencesChunked(sombra, {\n partition,\n filterBy,\n limit: concurrency,\n windowConcurrency,\n maxChunks,\n maxLookbackDays,\n logger: this.logger,\n onItems: (items) => writeRows(items),\n });\n\n this.logger.info(colors.green(`Finished writing CSV to ${file}`));\n return;\n }\n\n // Non-chunked path: still stream page-by-page via onItems (no in-memory accumulation)\n await fetchConsentPreferences(sombra, {\n partition,\n filterBy,\n limit: concurrency, // page size (API max 50 enforced internally)\n logger: this.logger,\n onItems: (items) => writeRows(items),\n });\n\n this.logger.info(colors.green(`Finished writing CSV to ${file}`));\n}\n"],"mappings":"4XAmBA,MAAM,EAAY,CAChB,SACA,YACA,YACA,mBACA,YACA,MACA,MACA,MACA,gBACA,WACA,oBACD,CAqBD,eAAsB,EAEpB,CACE,OACA,YACA,aACA,OACA,eACA,kBACA,iBACA,gBACA,eACA,cAAc,EAAE,CAChB,cACA,cACA,oBACA,YACA,iCACA,mBAEa,CACf,EAAoB,KAAK,QAAQ,CAGjC,IAAM,EAAS,MAAM,EAAwB,EAAc,EAAM,CAC/D,OAAQ,KAAK,OACb,aAAc,EACd,UAAW,KAAK,QAAQ,IAAI,WAC7B,CAAC,CACI,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAoB,EAAY,IAAK,GAAqC,CAC9E,GAAI,CAAC,EAAW,SAAS,IAAI,CAC3B,MAAO,CACL,KAAM,QACN,MAAO,EACR,CAEH,GAAM,CAAC,EAAM,GAAS,EAAW,MAAM,IAAI,CAC3C,MAAO,CAAE,OAAM,QAAO,EACtB,CAGI,EAAW,CACf,GAAI,EAAkB,CAAE,gBAAiB,EAAgB,aAAa,CAAE,CAAG,EAAE,CAC7E,GAAI,EAAiB,CAAE,eAAgB,EAAe,aAAa,CAAE,CAAG,EAAE,CAC1E,GAAI,GAAgB,EAChB,CACE,OAAQ,CACN,GAAI,EAAgB,CA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,IAAM,IAAA,IACN,EAAK,IAAI,EAAE,CAAS,IACxB,EAAK,IAAI,EAAE,CACJ,IACP,CACF,EAAY,EAAM,EAAY,CAC9B,EAAc,GAEhB,EAAqB,EAAM,EAAM,EAAa,EAGhD,GAAI,EAAa,CAEf,MAAM,EAA+B,EAAQ,CAC3C,YACA,WACA,MAAO,EACP,oBACA,YACA,kBACA,OAAQ,KAAK,OACb,QAAU,GAAU,EAAU,EAAM,CACrC,CAAC,CAEF,KAAK,OAAO,KAAK,EAAO,MAAM,2BAA2B,IAAO,CAAC,CACjE,OAIF,MAAM,EAAwB,EAAQ,CACpC,YACA,WACA,MAAO,EACP,OAAQ,KAAK,OACb,QAAU,GAAU,EAAU,EAAM,CACrC,CAAC,CAEF,KAAK,OAAO,KAAK,EAAO,MAAM,2BAA2B,IAAO,CAAC"}
1
+ {"version":3,"file":"impl-BH1fCPDh.mjs","names":[],"sources":["../src/commands/consent/pull-consent-preferences/impl.ts"],"sourcesContent":["import type { PreferenceQueryResponseItem } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n fetchAllIdentifiers,\n fetchAllPurposesAndPreferences,\n fetchConsentPreferences,\n fetchConsentPreferencesChunked,\n transformPreferenceRecordToCsv,\n type PreferenceIdentifier,\n} from '@transcend-io/sdk';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { initCsvFile, appendCsvRowsOrdered } from '../../../lib/helpers/index.js';\n\n// Known “core” columns your transformer usually produces up front.\n// Leave this list conservative; we’ll still union with transformer keys.\nconst CORE_COLS = [\n 'userId',\n 'timestamp',\n 'partition',\n 'decryptionStatus',\n 'updatedAt',\n 'usp',\n 'gpp',\n 'tcf',\n 'airgapVersion',\n 'metadata',\n 'metadataTimestamp',\n];\n\nexport interface PullConsentPreferencesCommandFlags {\n auth: string;\n partition: string;\n sombraAuth?: string;\n file: string;\n transcendUrl: string;\n timestampBefore?: Date;\n exportIdentifiersWithDelimiter: string;\n timestampAfter?: Date;\n updatedBefore?: Date;\n updatedAfter?: Date;\n identifiers?: string[];\n concurrency: number;\n shouldChunk: boolean;\n windowConcurrency: number;\n maxChunks: number;\n maxLookbackDays: number;\n}\n\nexport async function pullConsentPreferences(\n this: LocalContext,\n {\n auth,\n partition,\n sombraAuth,\n file,\n transcendUrl,\n timestampBefore,\n timestampAfter,\n updatedBefore,\n updatedAfter,\n identifiers = [],\n concurrency,\n shouldChunk,\n windowConcurrency,\n maxChunks,\n exportIdentifiersWithDelimiter,\n maxLookbackDays,\n }: PullConsentPreferencesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, {\n logger: this.logger,\n sombraApiKey: sombraAuth,\n sombraUrl: this.process.env.SOMBRA_URL,\n });\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Identifiers are key:value, parse to PreferenceIdentifier[]\n const parsedIdentifiers = identifiers.map((identifier): PreferenceIdentifier => {\n if (!identifier.includes(':')) {\n return {\n name: 'email',\n value: identifier,\n };\n }\n const [name, value] = identifier.split(':');\n return { name, value };\n });\n\n // Build filter\n const filterBy = {\n ...(timestampBefore ? { timestampBefore: timestampBefore.toISOString() } : {}),\n ...(timestampAfter ? { timestampAfter: timestampAfter.toISOString() } : {}),\n ...(updatedAfter || updatedBefore\n ? {\n system: {\n ...(updatedBefore ? { updatedBefore: updatedBefore.toISOString() } : {}),\n ...(updatedAfter ? { updatedAfter: updatedAfter.toISOString() } : {}),\n },\n }\n : {}),\n ...(parsedIdentifiers.length > 0 ? { identifiers: parsedIdentifiers } : {}),\n };\n\n this.logger.info(\n `Fetching consent preferences from partition ${partition}, using mode=${\n shouldChunk ? 'chunked-stream' : 'paged-stream'\n }...`,\n );\n\n this.logger.info(colors.magenta(`Preparing CSV at: ${file}`));\n\n // Fetch full sets (purposes+topics, identifiers) to ensure header completeness\n const [purposesWithTopics, allIdentifiers] = await Promise.all([\n fetchAllPurposesAndPreferences(client, { logger: this.logger }),\n fetchAllIdentifiers(client, { logger: this.logger }),\n ]);\n\n // Identifier columns: exactly the identifier names\n const identifierCols = allIdentifiers.map((i) => i.name);\n\n // Preference topic columns: topic names (de-duped)\n const topicCols = Array.from(\n new Set(\n purposesWithTopics.flatMap((p) => p.topics?.map((t) => `${p.trackingType}_${t.slug}`) ?? []),\n ),\n ).sort((a, b) => a.localeCompare(b));\n\n // Some setups also want a per-purpose boolean column (e.g., “Email”, “Sms”).\n // If your transformer includes those, list them here, derived from purposes:\n const purposeCols = Array.from(new Set(purposesWithTopics.map((p) => p.trackingType))).sort(\n (a, b) => a.localeCompare(b),\n );\n\n // Build the complete header skeleton.\n // We’ll still union with the first transformed row’s keys to be safe.\n const completeHeadersList = [...CORE_COLS, ...identifierCols, ...purposeCols, ...topicCols];\n\n // Lazily initialize CSV header order from the first transformed row.\n let headerOrder: string[] | null = null;\n let wroteHeader = false;\n const writeRows = (items: PreferenceQueryResponseItem[]): void => {\n if (!items || items.length === 0) return;\n const rows = items.map((row) =>\n transformPreferenceRecordToCsv(row, exportIdentifiersWithDelimiter),\n );\n if (!wroteHeader) {\n const firstKeys = Object.keys(rows[0] ?? {});\n const seen = new Set<string>();\n headerOrder = [...completeHeadersList, ...firstKeys].filter((k) => {\n if (k === undefined) return false;\n if (seen.has(k)) return false;\n seen.add(k);\n return true;\n });\n initCsvFile(file, headerOrder);\n wroteHeader = true;\n }\n appendCsvRowsOrdered(file, rows, headerOrder!);\n };\n\n if (shouldChunk) {\n // Stream via chunked fetcher with page callback\n await fetchConsentPreferencesChunked(sombra, {\n partition,\n filterBy,\n limit: concurrency,\n windowConcurrency,\n maxChunks,\n maxLookbackDays,\n logger: this.logger,\n onItems: (items) => writeRows(items),\n });\n\n this.logger.info(colors.green(`Finished writing CSV to ${file}`));\n return;\n }\n\n // Non-chunked path: still stream page-by-page via onItems (no in-memory accumulation)\n await fetchConsentPreferences(sombra, {\n partition,\n filterBy,\n limit: concurrency, // page size (API max 50 enforced internally)\n logger: this.logger,\n onItems: (items) => writeRows(items),\n });\n\n this.logger.info(colors.green(`Finished writing CSV to ${file}`));\n}\n"],"mappings":"4XAmBA,MAAM,EAAY,CAChB,SACA,YACA,YACA,mBACA,YACA,MACA,MACA,MACA,gBACA,WACA,oBACD,CAqBD,eAAsB,EAEpB,CACE,OACA,YACA,aACA,OACA,eACA,kBACA,iBACA,gBACA,eACA,cAAc,EAAE,CAChB,cACA,cACA,oBACA,YACA,iCACA,mBAEa,CACf,EAAoB,KAAK,QAAQ,CAGjC,IAAM,EAAS,MAAM,EAAwB,EAAc,EAAM,CAC/D,OAAQ,KAAK,OACb,aAAc,EACd,UAAW,KAAK,QAAQ,IAAI,WAC7B,CAAC,CACI,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAoB,EAAY,IAAK,GAAqC,CAC9E,GAAI,CAAC,EAAW,SAAS,IAAI,CAC3B,MAAO,CACL,KAAM,QACN,MAAO,EACR,CAEH,GAAM,CAAC,EAAM,GAAS,EAAW,MAAM,IAAI,CAC3C,MAAO,CAAE,OAAM,QAAO,EACtB,CAGI,EAAW,CACf,GAAI,EAAkB,CAAE,gBAAiB,EAAgB,aAAa,CAAE,CAAG,EAAE,CAC7E,GAAI,EAAiB,CAAE,eAAgB,EAAe,aAAa,CAAE,CAAG,EAAE,CAC1E,GAAI,GAAgB,EAChB,CACE,OAAQ,CACN,GAAI,EAAgB,CAAE,cAAe,EAAc,aAAa,CAAE,CAAG,EAAE,CACvE,GAAI,EAAe,CAAE,aAAc,EAAa,aAAa,CAAE,CAAG,EAAE,CACrE,CACF,CACD,EAAE,CACN,GAAI,EAAkB,OAAS,EAAI,CAAE,YAAa,EAAmB,CAAG,EAAE,CAC3E,CAED,KAAK,OAAO,KACV,+CAA+C,EAAU,eACvD,EAAc,iBAAmB,eAClC,KACF,CAED,KAAK,OAAO,KAAK,EAAO,QAAQ,qBAAqB,IAAO,CAAC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,EAAO,MAAM,2BAA2B,IAAO,CAAC,CACjE,OAIF,MAAM,EAAwB,EAAQ,CACpC,YACA,WACA,MAAO,EACP,OAAQ,KAAK,OACb,QAAU,GAAU,EAAU,EAAM,CACrC,CAAC,CAEF,KAAK,OAAO,KAAK,EAAO,MAAM,2BAA2B,IAAO,CAAC"}
@@ -1,2 +1,2 @@
1
- import{C as e}from"./codecs-CTxFjCg4.mjs";import{o as t}from"./readTranscendYaml-BNn6-Ofi.mjs";import{t as n}from"./done-input-validation-BUz-aVC5.mjs";import{ConsentTrackerStatus as r,DataFlowScope as i}from"@transcend-io/privacy-types";import a from"colors";import{decodeCodec as o}from"@transcend-io/type-utils";import*as s from"io-ts";function c({file:c,output:l}){n(this.process),this.fs.existsSync(c)||(this.logger.error(a.red(`File does not exist: --file="${c}"`)),this.process.exit(1));let u=o(s.array(e),this.fs.readFileSync(c,`utf-8`)),d=[],f=[];u.forEach(e=>{e.dataFlows.filter(({type:e})=>e!==i.CSP).forEach(e=>{d.push({value:e.value,type:e.type,status:r.Live,trackingPurposes:e.trackingPurposes})}),e.cookies.forEach(e=>{f.push({name:e.name,status:r.Live,trackingPurposes:e.trackingPurposes})})}),this.fs.writeFileSync(l,t({"data-flows":d,cookies:f})),this.logger.info(a.green(`Successfully wrote ${d.length} data flows and ${f.length} cookies to file "${l}"`))}export{c as consentManagerServiceJsonToYml};
2
- //# sourceMappingURL=impl-CfvxD3RI.mjs.map
1
+ import{C as e}from"./codecs-CfcaFoZR.mjs";import{o as t}from"./readTranscendYaml-BfqQbPiT.mjs";import{t as n}from"./done-input-validation-LiTaCEzF.mjs";import{ConsentTrackerStatus as r,DataFlowScope as i}from"@transcend-io/privacy-types";import a from"colors";import{decodeCodec as o}from"@transcend-io/type-utils";import*as s from"io-ts";function c({file:c,output:l}){n(this.process),this.fs.existsSync(c)||(this.logger.error(a.red(`File does not exist: --file="${c}"`)),this.process.exit(1));let u=o(s.array(e),this.fs.readFileSync(c,`utf-8`)),d=[],f=[];u.forEach(e=>{e.dataFlows.filter(({type:e})=>e!==i.CSP).forEach(e=>{d.push({value:e.value,type:e.type,status:r.Live,trackingPurposes:e.trackingPurposes})}),e.cookies.forEach(e=>{f.push({name:e.name,status:r.Live,trackingPurposes:e.trackingPurposes})})}),this.fs.writeFileSync(l,t({"data-flows":d,cookies:f})),this.logger.info(a.green(`Successfully wrote ${d.length} data flows and ${f.length} cookies to file "${l}"`))}export{c as consentManagerServiceJsonToYml};
2
+ //# sourceMappingURL=impl-BLOhoP-b2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl-BLOhoP-b2.mjs","names":[],"sources":["../src/commands/inventory/consent-manager-service-json-to-yml/impl.ts"],"sourcesContent":["import { ConsentTrackerStatus, DataFlowScope } from '@transcend-io/privacy-types';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport colors from 'colors';\nimport * as t from 'io-ts';\n\nimport { ConsentManagerServiceMetadata, CookieInput, DataFlowInput } from '../../../codecs.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { serializeTranscendYaml } from '../../../lib/readTranscendYaml.js';\n\nexport interface ConsentManagerServiceJsonToYmlCommandFlags {\n file: string;\n output: string;\n}\n\nexport function consentManagerServiceJsonToYml(\n this: LocalContext,\n { file, output }: ConsentManagerServiceJsonToYmlCommandFlags,\n): void {\n doneInputValidation(this.process);\n\n // Ensure files exist\n if (!this.fs.existsSync(file)) {\n this.logger.error(colors.red(`File does not exist: --file=\"${file}\"`));\n this.process.exit(1);\n }\n\n // Read in each consent manager configuration\n const services = decodeCodec(\n t.array(ConsentManagerServiceMetadata),\n this.fs.readFileSync(file, 'utf-8'),\n );\n\n // Create data flows and cookie configurations\n const dataFlows: DataFlowInput[] = [];\n const cookies: CookieInput[] = [];\n services.forEach((service) => {\n service.dataFlows\n .filter(({ type }) => type !== DataFlowScope.CSP)\n .forEach((dataFlow) => {\n dataFlows.push({\n value: dataFlow.value,\n type: dataFlow.type,\n status: ConsentTrackerStatus.Live,\n trackingPurposes: dataFlow.trackingPurposes,\n });\n });\n\n service.cookies.forEach((cookie) => {\n cookies.push({\n name: cookie.name,\n status: ConsentTrackerStatus.Live,\n trackingPurposes: cookie.trackingPurposes,\n });\n });\n });\n\n this.fs.writeFileSync(\n output,\n serializeTranscendYaml({\n 'data-flows': dataFlows,\n cookies,\n }),\n );\n\n this.logger.info(\n colors.green(\n `Successfully wrote ${dataFlows.length} data flows and ${cookies.length} cookies to file \"${output}\"`,\n ),\n );\n}\n"],"mappings":"mVAeA,SAAgB,EAEd,CAAE,OAAM,UACF,CACN,EAAoB,KAAK,QAAQ,CAG5B,KAAK,GAAG,WAAW,EAAK,GAC3B,KAAK,OAAO,MAAM,EAAO,IAAI,gCAAgC,EAAK,GAAG,CAAC,CACtE,KAAK,QAAQ,KAAK,EAAE,EAItB,IAAM,EAAW,EACf,EAAE,MAAM,EAA8B,CACtC,KAAK,GAAG,aAAa,EAAM,QAAQ,CACpC,CAGK,EAA6B,EAAE,CAC/B,EAAyB,EAAE,CACjC,EAAS,QAAS,GAAY,CAC5B,EAAQ,UACL,QAAQ,CAAE,UAAW,IAAS,EAAc,IAAI,CAChD,QAAS,GAAa,CACrB,EAAU,KAAK,CACb,MAAO,EAAS,MAChB,KAAM,EAAS,KACf,OAAQ,EAAqB,KAC7B,iBAAkB,EAAS,iBAC5B,CAAC,EACF,CAEJ,EAAQ,QAAQ,QAAS,GAAW,CAClC,EAAQ,KAAK,CACX,KAAM,EAAO,KACb,OAAQ,EAAqB,KAC7B,iBAAkB,EAAO,iBAC1B,CAAC,EACF,EACF,CAEF,KAAK,GAAG,cACN,EACA,EAAuB,CACrB,aAAc,EACd,UACD,CAAC,CACH,CAED,KAAK,OAAO,KACV,EAAO,MACL,sBAAsB,EAAU,OAAO,kBAAkB,EAAQ,OAAO,oBAAoB,EAAO,GACpG,CACF"}
@@ -0,0 +1,2 @@
1
+ import{g as e}from"./constants-BlKpAm3R.mjs";import{r as t,t as n}from"./project-plan-output-BHHlkLxe.mjs";import{d as r,f as i,t as a,u as o}from"./project-discovery-CWRjlFnC.mjs";import{S as s,_ as ee,c,h as te,m as l,p as u,r as d,t as f,v as p,x as ne,y as m}from"./policy-project-discovery-B4cFXUlA.mjs";import{t as h}from"./done-input-validation-LiTaCEzF.mjs";import{n as g,r as _,t as v}from"./prompts-BhXfYD6g.mjs";import{t as y}from"./project-plan-apply-Bg_1eMX9.mjs";import{a as b,i as x,n as S,o as re,r as ie}from"./policy-scaffold-config-CwlygiTz.mjs";import{join as C,relative as ae,sep as w}from"node:path";import T from"colors";const E=/^[a-z][a-z0-9_]*$/u;function D(e){return e?E.test(e)?e.length>64?`Root name cannot exceed 64 characters.`:!0:`Root name must be lowercase alphanumeric with underscores (e.g. "example", "permissions").`:`Enter a bundle root name.`}async function O(E,O=f){h(this.process);try{let f=d(this,O),h=C(f.targetDirectory,`.regal`,`config.yaml`);if(!this.fs.existsSync(h))throw Error(`No policy workspace found at ${n(f.invocationDirectory,f.targetDirectory)}. Run \`transcend policy init\` first.`);let v=new g(this),k=_(E,this.process.stdin.isTTY,this.process.stderr.isTTY),A=E.template??(k?await v.select(`Template:`,l.map(e=>({name:te[e],value:e})),l[0]):void 0);if(!A||!l.includes(A))throw Error(`Missing policy template. Pass --template=${l.join(` or --template=`)}.`);let j=u[A],M=E.name??(k?await v.text(`Bundle root name:`,j,e=>{let t=D(e);return t===!0?!0:t}):void 0);if(!M)throw Error(`Missing bundle root name. Pass --name in a non-interactive invocation.`);let N=D(M);if(N!==!0)throw Error(N);let P=ee(M),F=E[`bundle-dir`]??(k?await v.text(`Bundle directory name:`,P,e=>{let t=s(e);return t===!0?!0:t}):P),I=s(F);if(I!==!0)throw Error(I);let L=C(f.targetDirectory,F);if(this.fs.existsSync(L))throw Error(`Bundle directory already exists: ${n(f.invocationDirectory,L)}. Choose a different --bundle-dir.`);let R=m(A,M,F),{contents:z,roots:B}=ne(this.fs.readFileSync(h,`utf8`),M),V=B.map(e=>e===M?{root:e,bundleDir:F,template:A}:x(e)),H=[h,...R.map(({path:e})=>C(f.targetDirectory,e))],U=C(f.projectRoot,`.vscode`,`settings.json`),W=C(f.projectRoot,`.vscode`,`tasks.json`),G=this.fs.existsSync(C(f.projectRoot,`.vscode`));G&&H.push(U,W);let K=f.repositoryRoot&&f.usesGithub?C(f.repositoryRoot,b):void 0;K&&this.fs.existsSync(K)&&H.push(K);let q=a(this,f.projectRoot,H.sort((e,t)=>e.localeCompare(t))),J=[],Y=[],X=[],Z=i({snapshot:o(q,h),after:z,description:`Merge ${M} root into Regal config`});if(Z?J.push(Z):X.push(h),R.forEach(e=>{let t=C(f.targetDirectory,e.path);if(r(q,t).kind!==`absent`)throw Error(`Expected an empty path but found an entry at: ${t}`);let n=i({snapshot:o(q,t),after:e.contents,description:e.description});n?J.push(n):X.push(t)}),G){let e=r(q,U);if(e.kind===`file`||e.kind===`absent`){let t=S(e.kind===`file`?e.contents:null,f.projectRoot,f.targetDirectory,V),r=i({snapshot:e.kind===`file`?{path:U,contents:e.contents,mode:e.mode}:{path:U,contents:null},after:t.contents,description:`Merge bundle root into VS Code OPA settings`});r?J.push(r):X.push(U),Y.push(...t.warnings.map(e=>`${e} (${n(f.invocationDirectory,U)})`))}let t=r(q,W);if(t.kind===`file`||t.kind===`absent`){let e=ie(t.kind===`file`?t.contents:null,f.projectRoot,f.targetDirectory,V),r=i({snapshot:t.kind===`file`?{path:W,contents:t.contents,mode:t.mode}:{path:W,contents:null},after:e.contents,description:`Add per-bundle and aggregate lint tasks`});r?J.push(r):X.push(W),Y.push(...e.warnings.map(e=>`${e} (${n(f.invocationDirectory,W)})`))}}if(K&&f.repositoryRoot){let t=r(q,K);if(t.kind===`file`){let r=ae(f.repositoryRoot,f.targetDirectory).split(w).join(`/`)||`.`,a=re({cliVersion:e,workspaceDirectory:r,bundleDirectories:V.map(e=>r===`.`?e.bundleDir:`${r}/${e.bundleDir}`)});if(t.contents.startsWith(`# Generated by transcend policy init`)){let e=i({snapshot:{path:K,contents:t.contents,mode:t.mode},after:a,description:`Update Policy Engine CI matrix for all publish directories`});e?J.push(e):X.push(K)}else Y.push(`Existing GitHub Actions workflow was left unchanged: ${n(f.invocationDirectory,K)}. Adapt it manually to lint each \`*-bundle/\` publish directory.`),X.push(K)}}let oe=p({bundleDirectory:n(f.invocationDirectory,L),root:M,template:A}),Q={rootDirectory:f.projectRoot,targetDirectory:f.targetDirectory,manifestPath:C(L,c),changes:J,unchanged:X,warnings:Y,nextSteps:[oe]};E.json||this.logger.info(t(Q,{cwd:this.process.cwd(),title:`Policy bundle plan`,details:[{label:`Workspace`,path:Q.targetDirectory},{label:`Bundle`,path:L}]}));let $=Q.changes.length===0||E.dryRun;if(Q.changes.length>0&&!E.dryRun)if(E.yes)$=!0;else if(k)$=await v.confirm(`Apply this complete plan?`,!0);else throw Error(`The plan requires approval in a non-interactive invocation. Review with --dryRun, then pass --yes.`);$&&!E.dryRun&&Q.changes.length>0&&await y(this,Q);let se=$&&!E.dryRun&&Q.changes.length>0;if(E.json){this.process.stdout.write(`${JSON.stringify({applied:se,dryRun:E.dryRun,template:A,root:M,bundleDirectory:L,targetDirectory:Q.targetDirectory,manifestPath:Q.manifestPath,changes:Q.changes.map(e=>({kind:e.kind,target:n(this.process.cwd(),e.path),description:e.description})),warnings:Q.warnings,nextSteps:Q.nextSteps})}\n`);return}if(E.dryRun){this.logger.info(T.yellow(`Dry run complete. No changes were written.`));return}if(!$){this.logger.info(T.yellow(`No changes applied.`));return}this.logger.info(T.green(`Policy bundle ${M} added.`)),Q.nextSteps.length>0&&(this.logger.info(`\n${T.bold(`Next steps`)}`),Q.nextSteps.forEach(e=>this.logger.info(e)))}catch(e){throw e instanceof v&&this.process.exit(130),e}}export{O as _new};
2
+ //# sourceMappingURL=impl-BQRP9NIv.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl-BQRP9NIv.mjs","names":["CLI_VERSION"],"sources":["../src/commands/policy/new/impl.ts"],"sourcesContent":["import { join, relative, sep } from 'node:path';\n\nimport colors from 'colors';\n\nimport { version as CLI_VERSION } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport {\n DEFAULT_POLICY_PROJECT_DIRECTORY,\n discoverPolicyProject,\n} from '../../../lib/policy/policy-project-discovery.js';\nimport {\n generatePolicyGithubActionsWorkflow,\n POLICY_CI_WORKFLOW_PATH,\n} from '../../../lib/policy/policy-scaffold-artifacts.js';\nimport {\n mergePolicyEditorSettings,\n mergePolicyEditorTasks,\n policyBundleRef,\n type PolicyBundleRef,\n} from '../../../lib/policy/policy-scaffold-config.js';\nimport {\n buildBundleDirectoryName,\n buildPolicyBundleEvalNextStep,\n generatePolicyBundleFiles,\n mergePolicyRegalConfigRoots,\n POLICY_MANIFEST_FILENAME,\n POLICY_TEMPLATE_DEFAULT_ROOTS,\n POLICY_TEMPLATE_NAMES,\n POLICY_TEMPLATE_PROMPT_LABELS,\n validateBundleDirectoryName,\n type PolicyTemplateName,\n} from '../../../lib/policy/policy-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 {\n planFileChange,\n getPlanningFileSnapshot,\n getPlanningPathSnapshot,\n type PlannedChange,\n type ProjectPlan,\n} from '../../../lib/scaffolding/project-plan.js';\nimport {\n isInteractivePromptInvocation,\n PromptCancelledError,\n ScaffoldPrompts,\n} from '../../../lib/scaffolding/prompts.js';\n\n/** Flags for `transcend policy new`. */\nexport interface PolicyNewFlags {\n /** Package root name. */\n name?: string;\n /** Local publish directory basename under the workspace. */\n 'bundle-dir'?: string;\n /** Starter template. */\n template?: PolicyTemplateName;\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/** Validate a bundle root name. */\nconst VALID_ROOT_PATTERN = /^[a-z][a-z0-9_]*$/u;\n\n/**\n * Validate a policy bundle root name.\n *\n * @param value - Proposed root name\n * @returns True or error message\n */\nfunction validateRootName(value: string): true | string {\n if (!value) {\n return 'Enter a bundle root name.';\n }\n if (!VALID_ROOT_PATTERN.test(value)) {\n return 'Root name must be lowercase alphanumeric with underscores (e.g. \"example\", \"permissions\").';\n }\n if (value.length > 64) {\n return 'Root name cannot exceed 64 characters.';\n }\n return true;\n}\n\n/**\n * Scaffold one policy bundle from a template.\n *\n * @param this - CLI context\n * @param flags - Template and interaction flags\n * @param directory - Target policy workspace directory\n */\nexport async function _new(\n this: LocalContext,\n flags: PolicyNewFlags,\n directory: string = DEFAULT_POLICY_PROJECT_DIRECTORY,\n): Promise<void> {\n doneInputValidation(this.process);\n try {\n const state = discoverPolicyProject(this, directory);\n const regalConfigPath = join(state.targetDirectory, '.regal', 'config.yaml');\n\n if (!this.fs.existsSync(regalConfigPath)) {\n throw new Error(\n `No policy workspace found at ${displayProjectPath(\n state.invocationDirectory,\n state.targetDirectory,\n )}. Run \\`transcend policy init\\` first.`,\n );\n }\n\n const prompts = new ScaffoldPrompts(this);\n const interactive = isInteractivePromptInvocation(\n flags,\n this.process.stdin.isTTY,\n this.process.stderr.isTTY,\n );\n\n const template =\n flags.template ??\n (interactive\n ? await prompts.select<PolicyTemplateName>(\n 'Template:',\n POLICY_TEMPLATE_NAMES.map((value) => ({\n name: POLICY_TEMPLATE_PROMPT_LABELS[value],\n value,\n })),\n POLICY_TEMPLATE_NAMES[0],\n )\n : undefined);\n if (!template || !POLICY_TEMPLATE_NAMES.includes(template)) {\n throw new Error(\n `Missing policy template. Pass --template=${POLICY_TEMPLATE_NAMES.join(' or --template=')}.`,\n );\n }\n\n const defaultRoot = POLICY_TEMPLATE_DEFAULT_ROOTS[template];\n const name =\n flags.name ??\n (interactive\n ? await prompts.text('Bundle root name:', defaultRoot, (value) => {\n const result = validateRootName(value);\n return result === true ? true : result;\n })\n : undefined);\n if (!name) {\n throw new Error('Missing bundle root name. Pass --name in a non-interactive invocation.');\n }\n const rootValidation = validateRootName(name);\n if (rootValidation !== true) {\n throw new Error(rootValidation);\n }\n\n const defaultBundleDir = buildBundleDirectoryName(name);\n const bundleDir =\n flags['bundle-dir'] ??\n (interactive\n ? await prompts.text('Bundle directory name:', defaultBundleDir, (value) => {\n const result = validateBundleDirectoryName(value);\n return result === true ? true : result;\n })\n : defaultBundleDir);\n const bundleDirValidation = validateBundleDirectoryName(bundleDir);\n if (bundleDirValidation !== true) {\n throw new Error(bundleDirValidation);\n }\n\n const bundlePath = join(state.targetDirectory, bundleDir);\n if (this.fs.existsSync(bundlePath)) {\n throw new Error(\n `Bundle directory already exists: ${displayProjectPath(\n state.invocationDirectory,\n bundlePath,\n )}. Choose a different --bundle-dir.`,\n );\n }\n\n const files = generatePolicyBundleFiles(template, name, bundleDir);\n const existingRegalContents = this.fs.readFileSync(regalConfigPath, 'utf8');\n const { contents: updatedRegalConfig, roots: allRoots } = mergePolicyRegalConfigRoots(\n existingRegalContents,\n name,\n );\n const bundleRefs: PolicyBundleRef[] = allRoots.map((root) =>\n root === name ? { root, bundleDir, template } : policyBundleRef(root),\n );\n\n const candidatePaths = [\n regalConfigPath,\n ...files.map(({ path }) => join(state.targetDirectory, path)),\n ];\n\n const vscodeSettingsPath = join(state.projectRoot, '.vscode', 'settings.json');\n const vscodeTasksPath = join(state.projectRoot, '.vscode', 'tasks.json');\n const hasVscode = this.fs.existsSync(join(state.projectRoot, '.vscode'));\n if (hasVscode) {\n candidatePaths.push(vscodeSettingsPath, vscodeTasksPath);\n }\n\n const workflowPath =\n state.repositoryRoot && state.usesGithub\n ? join(state.repositoryRoot, POLICY_CI_WORKFLOW_PATH)\n : undefined;\n if (workflowPath && this.fs.existsSync(workflowPath)) {\n candidatePaths.push(workflowPath);\n }\n\n const snapshots = collectPlanningSnapshots(\n this,\n state.projectRoot,\n candidatePaths.sort((a, b) => a.localeCompare(b)),\n );\n\n const changes: PlannedChange[] = [];\n const warnings: string[] = [];\n const unchanged: string[] = [];\n\n const regalChange = planFileChange({\n snapshot: getPlanningFileSnapshot(snapshots, regalConfigPath),\n after: updatedRegalConfig,\n description: `Merge ${name} root into Regal config`,\n });\n if (regalChange) {\n changes.push(regalChange);\n } else {\n unchanged.push(regalConfigPath);\n }\n\n files.forEach((file) => {\n const path = join(state.targetDirectory, file.path);\n const snapshot = getPlanningPathSnapshot(snapshots, path);\n if (snapshot.kind !== 'absent') {\n throw new Error(`Expected an empty path but found an entry at: ${path}`);\n }\n const change = planFileChange({\n snapshot: getPlanningFileSnapshot(snapshots, path),\n after: file.contents,\n description: file.description,\n });\n if (change) {\n changes.push(change);\n } else {\n unchanged.push(path);\n }\n });\n\n if (hasVscode) {\n const settingsSnapshot = getPlanningPathSnapshot(snapshots, vscodeSettingsPath);\n if (settingsSnapshot.kind === 'file' || settingsSnapshot.kind === 'absent') {\n const settingsResult = mergePolicyEditorSettings(\n settingsSnapshot.kind === 'file' ? settingsSnapshot.contents : null,\n state.projectRoot,\n state.targetDirectory,\n bundleRefs,\n );\n const settingsChange = planFileChange({\n snapshot:\n settingsSnapshot.kind === 'file'\n ? {\n path: vscodeSettingsPath,\n contents: settingsSnapshot.contents,\n mode: settingsSnapshot.mode,\n }\n : { path: vscodeSettingsPath, contents: null },\n after: settingsResult.contents,\n description: 'Merge bundle root into VS Code OPA settings',\n });\n if (settingsChange) {\n changes.push(settingsChange);\n } else {\n unchanged.push(vscodeSettingsPath);\n }\n warnings.push(\n ...settingsResult.warnings.map(\n (w) => `${w} (${displayProjectPath(state.invocationDirectory, vscodeSettingsPath)})`,\n ),\n );\n }\n\n const tasksSnapshot = getPlanningPathSnapshot(snapshots, vscodeTasksPath);\n if (tasksSnapshot.kind === 'file' || tasksSnapshot.kind === 'absent') {\n const tasksResult = mergePolicyEditorTasks(\n tasksSnapshot.kind === 'file' ? tasksSnapshot.contents : null,\n state.projectRoot,\n state.targetDirectory,\n bundleRefs,\n );\n const tasksChange = planFileChange({\n snapshot:\n tasksSnapshot.kind === 'file'\n ? {\n path: vscodeTasksPath,\n contents: tasksSnapshot.contents,\n mode: tasksSnapshot.mode,\n }\n : { path: vscodeTasksPath, contents: null },\n after: tasksResult.contents,\n description: 'Add per-bundle and aggregate lint tasks',\n });\n if (tasksChange) {\n changes.push(tasksChange);\n } else {\n unchanged.push(vscodeTasksPath);\n }\n warnings.push(\n ...tasksResult.warnings.map(\n (w) => `${w} (${displayProjectPath(state.invocationDirectory, vscodeTasksPath)})`,\n ),\n );\n }\n }\n\n if (workflowPath && state.repositoryRoot) {\n const workflowSnapshot = getPlanningPathSnapshot(snapshots, workflowPath);\n if (workflowSnapshot.kind === 'file') {\n const workspaceDirectory =\n relative(state.repositoryRoot, state.targetDirectory).split(sep).join('/') || '.';\n const bundleDirectories = bundleRefs.map((bundle) => {\n return workspaceDirectory === '.'\n ? bundle.bundleDir\n : `${workspaceDirectory}/${bundle.bundleDir}`;\n });\n const desiredWorkflow = generatePolicyGithubActionsWorkflow({\n cliVersion: CLI_VERSION,\n workspaceDirectory,\n bundleDirectories,\n });\n if (workflowSnapshot.contents.startsWith('# Generated by transcend policy init')) {\n const workflowChange = planFileChange({\n snapshot: {\n path: workflowPath,\n contents: workflowSnapshot.contents,\n mode: workflowSnapshot.mode,\n },\n after: desiredWorkflow,\n description: 'Update Policy Engine CI matrix for all publish directories',\n });\n if (workflowChange) {\n changes.push(workflowChange);\n } else {\n unchanged.push(workflowPath);\n }\n } else {\n warnings.push(\n `Existing GitHub Actions workflow was left unchanged: ${displayProjectPath(\n state.invocationDirectory,\n workflowPath,\n )}. Adapt it manually to lint each \\`*-bundle/\\` publish directory.`,\n );\n unchanged.push(workflowPath);\n }\n }\n }\n\n const bundleDisplayPath = displayProjectPath(state.invocationDirectory, bundlePath);\n const evalCommand = buildPolicyBundleEvalNextStep({\n bundleDirectory: bundleDisplayPath,\n root: name,\n template,\n });\n\n const plan: ProjectPlan & {\n /** Absolute workspace directory. */\n targetDirectory: string;\n /** Absolute manifest path. */\n manifestPath: string;\n /** Unchanged paths. */\n unchanged: string[];\n /** Non-fatal warnings. */\n warnings: string[];\n /** Follow-up commands. */\n nextSteps: string[];\n } = {\n rootDirectory: state.projectRoot,\n targetDirectory: state.targetDirectory,\n manifestPath: join(bundlePath, POLICY_MANIFEST_FILENAME),\n changes,\n unchanged,\n warnings,\n nextSteps: [evalCommand],\n };\n\n if (!flags.json) {\n this.logger.info(\n renderProjectPlan(plan, {\n cwd: this.process.cwd(),\n title: 'Policy bundle plan',\n details: [\n { label: 'Workspace', path: plan.targetDirectory },\n { label: 'Bundle', path: bundlePath },\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\n if (flags.json) {\n this.process.stdout.write(\n `${JSON.stringify({\n applied,\n dryRun: flags.dryRun,\n template,\n root: name,\n bundleDirectory: bundlePath,\n targetDirectory: plan.targetDirectory,\n manifestPath: plan.manifestPath,\n changes: plan.changes.map((change) => ({\n kind: change.kind,\n target: displayProjectPath(this.process.cwd(), change.path),\n description: change.description,\n })),\n warnings: plan.warnings,\n nextSteps: plan.nextSteps,\n })}\\n`,\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(`Policy bundle ${name} 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 } catch (error) {\n if (error instanceof PromptCancelledError) {\n this.process.exit(130);\n }\n throw error;\n }\n}\n"],"mappings":"ooBAuEA,MAAM,EAAqB,qBAQ3B,SAAS,EAAiB,EAA8B,CAUtD,OATK,EAGA,EAAmB,KAAK,EAAM,CAG/B,EAAM,OAAS,GACV,yCAEF,GALE,6FAHA,4BAkBX,eAAsB,EAEpB,EACA,EAAoB,EACL,CACf,EAAoB,KAAK,QAAQ,CACjC,GAAI,CACF,IAAM,EAAQ,EAAsB,KAAM,EAAU,CAC9C,EAAkB,EAAK,EAAM,gBAAiB,SAAU,cAAc,CAE5E,GAAI,CAAC,KAAK,GAAG,WAAW,EAAgB,CACtC,MAAU,MACR,gCAAgC,EAC9B,EAAM,oBACN,EAAM,gBACP,CAAC,wCACH,CAGH,IAAM,EAAU,IAAI,EAAgB,KAAK,CACnC,EAAc,EAClB,EACA,KAAK,QAAQ,MAAM,MACnB,KAAK,QAAQ,OAAO,MACrB,CAEK,EACJ,EAAM,WACL,EACG,MAAM,EAAQ,OACZ,YACA,EAAsB,IAAK,IAAW,CACpC,KAAM,GAA8B,GACpC,QACD,EAAE,CACH,EAAsB,GACvB,CACD,IAAA,IACN,GAAI,CAAC,GAAY,CAAC,EAAsB,SAAS,EAAS,CACxD,MAAU,MACR,4CAA4C,EAAsB,KAAK,kBAAkB,CAAC,GAC3F,CAGH,IAAM,EAAc,EAA8B,GAC5C,EACJ,EAAM,OACL,EACG,MAAM,EAAQ,KAAK,oBAAqB,EAAc,GAAU,CAC9D,IAAM,EAAS,EAAiB,EAAM,CACtC,OAAO,IAAW,GAAO,GAAO,GAChC,CACF,IAAA,IACN,GAAI,CAAC,EACH,MAAU,MAAM,yEAAyE,CAE3F,IAAM,EAAiB,EAAiB,EAAK,CAC7C,GAAI,IAAmB,GACrB,MAAU,MAAM,EAAe,CAGjC,IAAM,EAAmB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AAQ,KAAK,IAAI,CAElB"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./pullChunkedCustomSiloOutstandingIdentifiers-DbFFXAVM.mjs";import{i as t,s as n}from"./writeCsv-D-2siSwE.mjs";import{t as r}from"./done-input-validation-BUz-aVC5.mjs";import{chunk as i,uniq as a}from"lodash-es";import o from"colors";import{buildTranscendGraphQLClient as s,fetchRequestFilesForRequest as c}from"@transcend-io/sdk";import{map as l}from"@transcend-io/utils";async function u({file:u,fileTarget:d,transcendUrl:f,auth:p,sombraAuth:m,cronDataSiloId:h,targetDataSiloId:g,actions:_,skipRequestCount:v,pageLimit:y,chunkSize:b}){v&&this.logger.info(o.yellow(`Skipping request count as requested. This may help speed up the call.`)),(Number.isNaN(b)||b<=0||b%y!==0)&&(this.logger.error(o.red(`Invalid chunk size: "${b}". Must be a positive integer that is a multiple of ${y}.`)),this.process.exit(1)),r(this.process);let x=s(f,p),{baseName:S,extension:C}=t(u),{baseName:w,extension:T}=t(d),E=0,D=0,O=0;await e({dataSiloId:h,auth:p,sombraAuth:m,actions:_,apiPageSize:y,savePageSize:b,onSave:async e=>{E+=e.length;let t=await l(i(a(e.map(e=>e.requestId)),y),async e=>(this.logger.info(o.magenta(`Fetching target identifiers for ${e.length} requests`)),(await c(x,{logger:this.logger,pageSize:y*2,filterBy:{requestIds:e,dataSiloIds:[g]}})).map(({fileName:e,remoteId:t})=>{if(!t)throw Error(`Failed to find remoteId for ${e}`);return{RecordId:t,Object:e.replace(`.json`,``).split(`/`).pop()?.replace(` Information`,``),Comment:`Customer data deletion request submitted via transcend.io`}})),{concurrency:1});D+=t.flat().length;let r=a(e.map(e=>Object.keys(e)).flat()),s=`${S}-${O}${C}`,f=`${w}-${O}${T}`;await n(s,e,r),this.logger.info(o.green(`Successfully wrote ${e.length} identifiers to file "${u}"`));let p=t.flat();await n(f,p,a(p.map(e=>Object.keys(e)).flat())),this.logger.info(o.green(`Successfully wrote ${p.length} identifiers to file "${d}"`)),this.logger.info(o.blue(`Processed chunk of ${i.length} identifiers, found ${p.length} target identifiers`)),O+=1},transcendUrl:f,skipRequestCount:v}),this.logger.info(o.green(`Successfully wrote ${E} identifiers to file "${u}"`)),this.logger.info(o.green(`Successfully wrote ${D} identifiers to file "${d}"`))}export{u as pullProfiles};
2
- //# sourceMappingURL=impl-BppXJ1AD2.mjs.map
1
+ import{t as e}from"./pullChunkedCustomSiloOutstandingIdentifiers-BfNNWqeI.mjs";import{i as t,s as n}from"./writeCsv-CNZrq3zU.mjs";import{t as r}from"./done-input-validation-LiTaCEzF.mjs";import{chunk as i,uniq as a}from"lodash-es";import o from"colors";import{map as s}from"@transcend-io/utils";import{buildTranscendGraphQLClient as c,fetchRequestFilesForRequest as l}from"@transcend-io/sdk";async function u({file:u,fileTarget:d,transcendUrl:f,auth:p,sombraAuth:m,cronDataSiloId:h,targetDataSiloId:g,actions:_,skipRequestCount:v,pageLimit:y,chunkSize:b}){v&&this.logger.info(o.yellow(`Skipping request count as requested. This may help speed up the call.`)),(Number.isNaN(b)||b<=0||b%y!==0)&&(this.logger.error(o.red(`Invalid chunk size: "${b}". Must be a positive integer that is a multiple of ${y}.`)),this.process.exit(1)),r(this.process);let x=c(f,p),{baseName:S,extension:C}=t(u),{baseName:w,extension:T}=t(d),E=0,D=0,O=0;await e({dataSiloId:h,auth:p,sombraAuth:m,actions:_,apiPageSize:y,savePageSize:b,onSave:async e=>{E+=e.length;let t=await s(i(a(e.map(e=>e.requestId)),y),async e=>(this.logger.info(o.magenta(`Fetching target identifiers for ${e.length} requests`)),(await l(x,{logger:this.logger,pageSize:y*2,filterBy:{requestIds:e,dataSiloIds:[g]}})).map(({fileName:e,remoteId:t})=>{if(!t)throw Error(`Failed to find remoteId for ${e}`);return{RecordId:t,Object:e.replace(`.json`,``).split(`/`).pop()?.replace(` Information`,``),Comment:`Customer data deletion request submitted via transcend.io`}})),{concurrency:1});D+=t.flat().length;let r=a(e.map(e=>Object.keys(e)).flat()),c=`${S}-${O}${C}`,f=`${w}-${O}${T}`;await n(c,e,r),this.logger.info(o.green(`Successfully wrote ${e.length} identifiers to file "${u}"`));let p=t.flat();await n(f,p,a(p.map(e=>Object.keys(e)).flat())),this.logger.info(o.green(`Successfully wrote ${p.length} identifiers to file "${d}"`)),this.logger.info(o.blue(`Processed chunk of ${i.length} identifiers, found ${p.length} target identifiers`)),O+=1},transcendUrl:f,skipRequestCount:v}),this.logger.info(o.green(`Successfully wrote ${E} identifiers to file "${u}"`)),this.logger.info(o.green(`Successfully wrote ${D} identifiers to file "${d}"`))}export{u as pullProfiles};
2
+ //# sourceMappingURL=impl-BQe6vddz.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl-BQe6vddz.mjs","names":[],"sources":["../src/commands/request/cron/pull-profiles/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, fetchRequestFilesForRequest } from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport colors from 'colors';\nimport { uniq, chunk } from 'lodash-es';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport {\n pullChunkedCustomSiloOutstandingIdentifiers,\n type CsvFormattedIdentifier,\n} from '../../../../lib/cron/index.js';\nimport { parseFilePath, writeLargeCsv } from '../../../../lib/helpers/index.js';\n\nexport interface PullProfilesCommandFlags {\n file: string;\n fileTarget: string;\n transcendUrl: string;\n auth: string;\n sombraAuth?: string;\n cronDataSiloId: string;\n targetDataSiloId: string;\n actions: RequestAction[];\n skipRequestCount: boolean;\n pageLimit: number;\n chunkSize: number;\n}\n\nexport async function pullProfiles(\n this: LocalContext,\n {\n file,\n fileTarget,\n transcendUrl,\n auth,\n sombraAuth,\n cronDataSiloId,\n targetDataSiloId,\n actions,\n skipRequestCount,\n pageLimit,\n chunkSize,\n }: PullProfilesCommandFlags,\n): Promise<void> {\n if (skipRequestCount) {\n this.logger.info(\n colors.yellow('Skipping request count as requested. This may help speed up the call.'),\n );\n }\n\n if (Number.isNaN(chunkSize) || chunkSize <= 0 || chunkSize % pageLimit !== 0) {\n this.logger.error(\n colors.red(\n `Invalid chunk size: \"${chunkSize}\". Must be a positive integer that is a multiple of ${pageLimit}.`,\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process);\n\n // Create GraphQL client to connect to Transcend backend\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const { baseName, extension } = parseFilePath(file);\n const { baseName: baseNameTarget, extension: extensionTarget } = parseFilePath(fileTarget);\n\n let allIdentifiersCount = 0;\n let allTargetIdentifiersCount = 0;\n let fileCount = 0;\n // Create onSave callback to handle chunked processing\n const onSave = async (chunkToSave: CsvFormattedIdentifier[]): Promise<void> => {\n // Add to all identifiers\n allIdentifiersCount += chunkToSave.length;\n\n // Get unique request IDs from this chunk\n const requestIds = chunkToSave.map((d) => d.requestId as string);\n const uniqueRequestIds = uniq(requestIds);\n\n // Pull down target identifiers for this chunk\n const chunkedRequestIds = chunk(uniqueRequestIds, pageLimit);\n const results = await map(\n chunkedRequestIds,\n async (requestIds) => {\n this.logger.info(\n colors.magenta(`Fetching target identifiers for ${requestIds.length} requests`),\n );\n const results = await fetchRequestFilesForRequest(client, {\n logger: this.logger,\n pageSize: pageLimit * 2,\n filterBy: {\n requestIds,\n dataSiloIds: [targetDataSiloId],\n },\n });\n return results.map(({ fileName, remoteId }) => {\n if (!remoteId) {\n throw new Error(`Failed to find remoteId for ${fileName}`);\n }\n return {\n RecordId: remoteId,\n Object: fileName.replace('.json', '').split('/').pop()?.replace(' Information', ''),\n Comment: 'Customer data deletion request submitted via transcend.io',\n };\n });\n },\n // We are grabbing all the request files for the 'pageLimit' # of requests at a time\n {\n concurrency: 1,\n },\n );\n\n allTargetIdentifiersCount += results.flat().length;\n\n // Write the identifiers and target identifiers to CSV\n const headers = uniq(chunkToSave.map((d) => Object.keys(d)).flat());\n const numberedFileName = `${baseName}-${fileCount}${extension}`;\n const numberedFileNameTarget = `${baseNameTarget}-${fileCount}${extensionTarget}`;\n await writeLargeCsv(numberedFileName, chunkToSave, headers);\n this.logger.info(\n colors.green(`Successfully wrote ${chunkToSave.length} identifiers to file \"${file}\"`),\n );\n\n const targetIdentifiers = results.flat();\n const headers2 = uniq(targetIdentifiers.map((d) => Object.keys(d)).flat());\n await writeLargeCsv(numberedFileNameTarget, targetIdentifiers, headers2);\n this.logger.info(\n colors.green(\n `Successfully wrote ${targetIdentifiers.length} identifiers to file \"${fileTarget}\"`,\n ),\n );\n\n this.logger.info(\n colors.blue(\n `Processed chunk of ${chunk.length} identifiers, found ${targetIdentifiers.length} target identifiers`,\n ),\n );\n fileCount += 1;\n };\n\n // Pull down outstanding identifiers using the new chunked function\n await pullChunkedCustomSiloOutstandingIdentifiers({\n dataSiloId: cronDataSiloId,\n auth,\n sombraAuth,\n actions,\n apiPageSize: pageLimit,\n savePageSize: chunkSize,\n onSave,\n transcendUrl,\n skipRequestCount,\n });\n\n this.logger.info(\n colors.green(`Successfully wrote ${allIdentifiersCount} identifiers to file \"${file}\"`),\n );\n this.logger.info(\n colors.green(\n `Successfully wrote ${allTargetIdentifiersCount} identifiers to file \"${fileTarget}\"`,\n ),\n );\n}\n"],"mappings":"wYA4BA,eAAsB,EAEpB,CACE,OACA,aACA,eACA,OACA,aACA,iBACA,mBACA,UACA,mBACA,YACA,aAEa,CACX,GACF,KAAK,OAAO,KACV,EAAO,OAAO,wEAAwE,CACvF,EAGC,OAAO,MAAM,EAAU,EAAI,GAAa,GAAK,EAAY,IAAc,KACzE,KAAK,OAAO,MACV,EAAO,IACL,wBAAwB,EAAU,sDAAsD,EAAU,GACnG,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,EAAoB,KAAK,QAAQ,CAGjC,IAAM,EAAS,EAA4B,EAAc,EAAK,CACxD,CAAE,WAAU,aAAc,EAAc,EAAK,CAC7C,CAAE,SAAU,EAAgB,UAAW,GAAoB,EAAc,EAAW,CAEtF,EAAsB,EACtB,EAA4B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sB,EAAM,OAAO,sBAAsB,EAAkB,OAAO,qBACnF,CACF,CACD,GAAa,GAYb,eACA,mBACD,CAAC,CAEF,KAAK,OAAO,KACV,EAAO,MAAM,sBAAsB,EAAoB,wBAAwB,EAAK,GAAG,CACxF,CACD,KAAK,OAAO,KACV,EAAO,MACL,sBAAsB,EAA0B,wBAAwB,EAAW,GACpF,CACF"}
@@ -0,0 +1,3 @@
1
+ import{c as e,i as t,n,t as r}from"./policy-project-discovery-B4cFXUlA.mjs";import{c as i,i as a,l as o,o as s,s as c}from"./policy-runtime-6jmkXlBk.mjs";import{n as l}from"./policy-bundle-manifest-RgsjPnfI.mjs";import{n as u}from"./inquirer-BU5IpgA8.mjs";import{t as d}from"./done-input-validation-LiTaCEzF.mjs";import{r as f}from"./prompts-BhXfYD6g.mjs";import{t as p}from"./run-captured-process-BjaSDWXG.mjs";import m from"node:path";import h from"colors";const g=[`manifest`,`opa-version`,`regal-version`,`format`,`opa-check`,`regal-lint`,`opa-test`],_={manifest:`Manifest and package roots`,"opa-version":`OPA 1.x`,"regal-version":`Regal`,format:`OPA formatting`,"opa-check":`OPA strict check`,"regal-lint":`Regal lint`,"opa-test":`OPA tests`};function v(e,t){return[e.stdout.trim(),e.stderr.trim()].filter(Boolean).join(`
2
+ `)||t}function y(e,t){return[...new Set(e.split(/\r?\n/gu).map(e=>e.trim()).filter(Boolean).map(e=>m.isAbsolute(e)?m.relative(t,e).split(m.sep).join(`/`):e.split(m.sep).join(`/`)))].sort()}function b(e,t,n=t){return e.fs.readdirSync(n,{withFileTypes:!0}).sort((e,t)=>e.name.localeCompare(t.name)).flatMap(r=>{let i=m.join(n,r.name);return r.isDirectory()?b(e,t,i):!r.isFile()||!r.name.endsWith(`.rego`)?[]:[{path:m.relative(t,i).split(m.sep).join(`/`),contents:e.fs.readFileSync(i,`utf8`)}]})}function x(e,t){let n=t;for(;;){let t=m.join(n,`.regal`,`config.yaml`);if(e.fs.existsSync(t))return t;let r=m.join(n,`.regal.yaml`);if(e.fs.existsSync(r))return r;let i=m.dirname(n);if(i===n)return;n=i}}function S(e,t,n){n?e.logger.info(`${h.bold(n)}\n`):e.logger.info(`${h.bold(`Policy verification`)}\n`),t.checks.forEach(({name:n,status:r})=>{let i=r===`passed`?`PASS`:r===`failed`?`FAIL`:`SKIP`,a=r===`passed`?h.green(i):r===`failed`?h.red(i):h.yellow(i),o=n===`opa-version`&&t.tools.opa?` (${t.tools.opa})`:n===`regal-version`&&t.tools.regal?` (${t.tools.regal})`:``;e.logger.info(`${a} ${_[n]}${o}`)}),t.diagnostics.length>0&&e.logger.error(``),t.diagnostics.forEach(t=>{let n=t.path?`${t.path}: `:``;e.logger.error(h.red(`error [${t.code}]: ${n}${t.message}`))}),t.status===`passed`?(e.logger.info(``),e.logger.info(h.green(`Policy verification passed.`))):(e.logger.error(``),e.logger.error(h.red(`Policy verification failed.`)))}async function C({fix:t,noInteractive:n,json:r},d,p){let _=g.map(e=>({name:e,status:`skipped`})),S=[],C={version:1,status:`passed`,directory:d,fix:t,tools:{opa:null,regal:null},checks:_,unformattedFiles:[],fixedFiles:[],diagnostics:S},w=(e,t)=>{_.find(t=>t.name===e).status=t},T=(e,t,n)=>{S.push({code:e,severity:`error`,message:t,...n?{path:n}:{}})};if(!this.fs.existsSync(d)||!this.fs.statSync(d).isDirectory())return w(`manifest`,`failed`),T(`project.directory`,`Policy directory does not exist or is not a directory: ${d}`,m.relative(this.process.cwd(),d)),C.status=`failed`,C;let E=m.join(d,e);try{l(this.fs.existsSync(E)?this.fs.readFileSync(E,`utf8`):void 0,b(this,d)),w(`manifest`,`passed`)}catch(e){w(`manifest`,`failed`),T(`manifest.invalid`,e instanceof Error?e.message:String(e),m.relative(this.process.cwd(),E))}let D=await p(`opa`,[`version`],{cwd:d},this);if(D.error?.code===`ENOENT`)w(`opa-version`,`failed`),T(`opa.missing`,a);else{let e=`${D.stdout}\n${D.stderr}`,t=i(e);D.code!==0||t?(w(`opa-version`,`failed`),T(`opa.version`,t??v(D,`Unable to determine the installed OPA version.`))):(C.tools.opa=c(e).version,w(`opa-version`,`passed`))}let O=await p(`regal`,[`version`],{cwd:d},this);if(O.error?.code===`ENOENT`)w(`regal-version`,`failed`),T(`regal.missing`,s);else{let e=`${O.stdout}\n${O.stderr}`,t=o(e);O.code!==0||t?(w(`regal-version`,`failed`),T(`regal.version`,t??v(O,`Unable to determine the installed Regal version.`))):(C.tools.regal=c(e).version,w(`regal-version`,`passed`))}if(C.tools.opa){let e=await p(`opa`,[`fmt`,`--list`,d],{cwd:d},this);if(e.code!==0)w(`format`,`failed`),T(`opa.format`,v(e,`opa fmt --list failed with exit code ${e.code}`));else if(C.unformattedFiles=y(e.stdout,d),C.unformattedFiles.length===0)w(`format`,`passed`);else{let e=t,i=f({json:r,noInteractive:n},this.process.stdin.isTTY,this.process.stderr.isTTY);if(!r&&!t){this.logger.error(h.red(`Policy files are not formatted:`)),C.unformattedFiles.forEach(e=>{this.logger.error(h.red(` - ${e}`))});let e=await p(`opa`,[`fmt`,`--diff`,d],{cwd:d},this),t=e.stdout.trim()||e.stderr.trim();t&&(this.logger.error(``),this.logger.error(t))}if(!t&&i)try{e=await u({message:`Format the unformatted policy files listed above?`})}catch(e){let t=e instanceof Error?e.message:String(e);throw/force closed|prompt.*cancel|user.*close|SIGINT/iu.test(t)&&this.process.exit(130),e}if(e){let e=await p(`opa`,[`fmt`,`--write`,d],{cwd:d},this);e.code===0?(C.fixedFiles=[...C.unformattedFiles],w(`format`,`passed`)):(w(`format`,`failed`),T(`opa.format-fix`,v(e,`opa fmt --write failed with exit code ${e.code}`)))}else w(`format`,`failed`),T(`opa.format-required`,"Policy files are not formatted. Re-run `transcend policy lint --fix` to repair them.")}let i=await p(`opa`,[`check`,`--strict`,`--ignore`,`*_test.rego`,d],{cwd:d},this);i.code===0?w(`opa-check`,`passed`):(w(`opa-check`,`failed`),T(`opa.check`,v(i,`opa check failed with exit code ${i.code}`)))}if(C.tools.regal){let e=x(this,d),t=await p(`regal`,[`lint`,`--fail-level`,`warning`,...e?[`--config-file`,e]:[],d],{cwd:d},this);t.code===0?w(`regal-lint`,`passed`):(w(`regal-lint`,`failed`),T(`regal.lint`,v(t,`regal lint failed with exit code ${t.code}`)))}if(C.tools.opa){let e=await p(`opa`,[`test`,`--fail-on-empty`,`-b`,d],{cwd:d},this);e.code===0?w(`opa-test`,`passed`):(w(`opa-test`,`failed`),T(`opa.test`,v(e,`opa test --fail-on-empty -b failed with exit code ${e.code}`)))}return C.status=_.some(({status:e})=>e===`failed`)?`failed`:`passed`,C}async function w(e,i=r,a=p){d(this.process);let{fix:o=!1,noInteractive:s=!1,json:c=!1}=e,l=t(this.process.cwd(),i);if(!this.fs.existsSync(l)||!this.fs.statSync(l).isDirectory()){let e={version:1,status:`failed`,directory:l,fix:o,tools:{opa:null,regal:null},checks:g.map(e=>({name:e,status:e===`manifest`?`failed`:`skipped`})),unformattedFiles:[],fixedFiles:[],diagnostics:[{code:`project.directory`,severity:`error`,message:`Policy directory does not exist or is not a directory: ${l}`,path:m.relative(this.process.cwd(),l)}]};c?this.process.stdout.write(`${JSON.stringify(e)}\n`):S(this,e),this.process.exitCode=1;return}let u=n(this,l);if(u.length===0){let e={version:1,status:`failed`,directory:l,fix:o,tools:{opa:null,regal:null},checks:g.map(e=>({name:e,status:e===`manifest`?`failed`:`skipped`})),unformattedFiles:[],fixedFiles:[],diagnostics:[{code:`project.bundles`,severity:`error`,message:"No publishable policy bundles found. Add one with `transcend policy new`, or pass a directory that contains a `.manifest`.",path:m.relative(this.process.cwd(),l)||`.`}]};c?this.process.stdout.write(`${JSON.stringify(e)}\n`):S(this,e),this.process.exitCode=1;return}let f=[];for(let e of u)f.push(await C.call(this,{fix:o,noInteractive:s,json:c},e,a));let h=f.some(e=>e.status===`failed`);if(c)if(f.length===1)this.process.stdout.write(`${JSON.stringify(f[0])}\n`);else{let e={version:2,status:h?`failed`:`passed`,directory:l,fix:o,results:f};this.process.stdout.write(`${JSON.stringify(e)}\n`)}else f.length===1?S(this,f[0]):f.forEach((e,t)=>{t>0&&this.logger.info(``);let n=m.relative(this.process.cwd(),e.directory)||e.directory;S(this,e,`Policy verification — ${n}`)});h&&(this.process.exitCode=1)}export{w as lint};
3
+ //# sourceMappingURL=impl-BQj1Ien4.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl-BQj1Ien4.mjs","names":[],"sources":["../src/lib/policy/policy-lint-model.ts","../src/lib/policy/policy-lint-output.ts","../src/commands/policy/lint/impl.ts"],"sourcesContent":["/** Stable policy lint result schema version. */\nexport const POLICY_LINT_RESULT_VERSION = 1;\n\n/** Stable multi-bundle lint result schema version. */\nexport const POLICY_LINT_MULTI_RESULT_VERSION = 2;\n\n/** Status of the full gate or an individual verification. */\nexport type PolicyLintStatus = 'passed' | 'failed' | 'skipped';\n\n/** One named policy verification. */\nexport interface PolicyLintCheck {\n /** Stable verification name. */\n name:\n | 'manifest'\n | 'opa-version'\n | 'regal-version'\n | 'format'\n | 'opa-check'\n | 'regal-lint'\n | 'opa-test';\n /** Verification outcome. */\n status: PolicyLintStatus;\n}\n\n/** Stable verification execution order. */\nexport const POLICY_LINT_CHECK_NAMES: PolicyLintCheck['name'][] = [\n 'manifest',\n 'opa-version',\n 'regal-version',\n 'format',\n 'opa-check',\n 'regal-lint',\n 'opa-test',\n];\n\n/** User-facing verification labels. */\nexport const POLICY_LINT_CHECK_LABELS: Readonly<Record<PolicyLintCheck['name'], string>> = {\n manifest: 'Manifest and package roots',\n 'opa-version': 'OPA 1.x',\n 'regal-version': 'Regal',\n format: 'OPA formatting',\n 'opa-check': 'OPA strict check',\n 'regal-lint': 'Regal lint',\n 'opa-test': 'OPA tests',\n};\n\n/** One machine-readable policy lint diagnostic. */\nexport interface PolicyLintDiagnostic {\n /** Stable diagnostic identifier. */\n code: string;\n /** Diagnostic severity. */\n severity: 'error';\n /** Human-readable detail, including captured tool output when available. */\n message: string;\n /** Optional path relative to the invocation directory. */\n path?: string;\n}\n\n/** Detected local policy tool versions. */\nexport interface PolicyLintTools {\n /** Detected OPA version, or null when missing or unsupported. */\n opa: string | null;\n /** Detected Regal version, or null when missing or unsupported. */\n regal: string | null;\n}\n\n/** Stable result emitted by `transcend policy lint --json` for one bundle. */\nexport interface PolicyLintResult {\n /** Result schema version. */\n version: typeof POLICY_LINT_RESULT_VERSION;\n /** Overall verification outcome. */\n status: Exclude<PolicyLintStatus, 'skipped'>;\n /** Absolute policy bundle directory. */\n directory: string;\n /** Whether formatting repair was explicitly requested. */\n fix: boolean;\n /** Detected supported tool versions. */\n tools: PolicyLintTools;\n /** Verification outcomes in stable execution order. */\n checks: PolicyLintCheck[];\n /** Files found to need OPA formatting, relative to the policy directory. */\n unformattedFiles: string[];\n /** Files repaired with OPA formatting, relative to the policy directory. */\n fixedFiles: string[];\n /** Ordered verification diagnostics. */\n diagnostics: PolicyLintDiagnostic[];\n}\n\n/**\n * Stable result when `transcend policy lint --json` verifies multiple bundles.\n *\n * Emitted only when the selected path is a workspace with more than one\n * publishable `*-bundle/` directory.\n */\nexport interface PolicyLintMultiResult {\n /** Result schema version. */\n version: typeof POLICY_LINT_MULTI_RESULT_VERSION;\n /** Overall verification outcome across all bundles. */\n status: Exclude<PolicyLintStatus, 'skipped'>;\n /** Absolute policy workspace directory that was searched. */\n directory: string;\n /** Whether formatting repair was explicitly requested. */\n fix: boolean;\n /** Per-bundle results in discovery order. */\n results: PolicyLintResult[];\n}\n","import path from 'node:path';\n\nimport type { CapturedProcessResult } from '../cli/run-captured-process.js';\n\n/**\n * Use captured tool output as a concise diagnostic.\n *\n * @param result - Captured process result\n * @param fallback - Message used when the tool emitted no output\n * @returns Diagnostic message\n */\nexport function getPolicyProcessFailureMessage(\n result: CapturedProcessResult,\n fallback: string,\n): string {\n const output = [result.stdout.trim(), result.stderr.trim()].filter(Boolean).join('\\n');\n return output || fallback;\n}\n\n/**\n * Convert absolute OPA formatter paths to stable project-relative paths.\n *\n * @param stdout - `opa fmt --list` output\n * @param projectDirectory - Absolute policy directory\n * @returns Sorted unique paths\n */\nexport function parseUnformattedPolicyFiles(stdout: string, projectDirectory: string): string[] {\n return [\n ...new Set(\n stdout\n .split(/\\r?\\n/gu)\n .map((file) => file.trim())\n .filter(Boolean)\n .map((file) =>\n path.isAbsolute(file)\n ? path.relative(projectDirectory, file).split(path.sep).join('/')\n : file.split(path.sep).join('/'),\n ),\n ),\n ].sort();\n}\n","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 {\n runCapturedProcess,\n type CapturedProcessRunner,\n} from '../../../lib/cli/run-captured-process.js';\nimport { inquirerConfirmBoolean } from '../../../lib/helpers/inquirer.js';\nimport {\n type PolicyBundleRegoFile,\n validatePolicyBundleContents,\n} from '../../../lib/policy/policy-bundle-manifest.js';\nimport {\n type PolicyLintCheck,\n type PolicyLintDiagnostic,\n type PolicyLintMultiResult,\n type PolicyLintResult,\n POLICY_LINT_CHECK_LABELS,\n POLICY_LINT_CHECK_NAMES,\n POLICY_LINT_MULTI_RESULT_VERSION,\n POLICY_LINT_RESULT_VERSION,\n} from '../../../lib/policy/policy-lint-model.js';\nimport {\n getPolicyProcessFailureMessage,\n parseUnformattedPolicyFiles,\n} from '../../../lib/policy/policy-lint-output.js';\nimport {\n DEFAULT_POLICY_PROJECT_DIRECTORY,\n discoverPolicyBundleDirectories,\n resolvePolicyProjectDirectory,\n} from '../../../lib/policy/policy-project-discovery.js';\nimport {\n OPA_MISSING_MESSAGE,\n parsePolicyToolVersion,\n REGAL_MISSING_MESSAGE,\n unsupportedOpaVersionMessage,\n unsupportedRegalVersionMessage,\n} from '../../../lib/policy/policy-runtime.js';\nimport { POLICY_MANIFEST_FILENAME } from '../../../lib/policy/policy-scaffold-templates.js';\nimport { isInteractivePromptInvocation } from '../../../lib/scaffolding/prompts.js';\n\n/** CLI flags for `transcend policy lint`. */\nexport interface LintCommandFlags {\n /** Apply OPA formatting. */\n fix: boolean;\n /** Disable the optional formatting confirmation. */\n noInteractive: boolean;\n /** Emit one stable JSON result on stdout. */\n json: boolean;\n}\n\n/**\n * Collect Rego source snapshots without following symlinks.\n *\n * @param context - CLI context\n * @param projectDirectory - Absolute policy directory\n * @param currentDirectory - Current recursive directory\n * @returns Deterministically ordered Rego snapshots\n */\nfunction collectRegoFiles(\n context: LocalContext,\n projectDirectory: string,\n currentDirectory: string = projectDirectory,\n): PolicyBundleRegoFile[] {\n return context.fs\n .readdirSync(currentDirectory, { withFileTypes: true })\n .sort((left, right) => left.name.localeCompare(right.name))\n .flatMap((entry) => {\n const absolutePath = path.join(currentDirectory, entry.name);\n if (entry.isDirectory()) {\n return collectRegoFiles(context, projectDirectory, absolutePath);\n }\n if (!entry.isFile() || !entry.name.endsWith('.rego')) {\n return [];\n }\n return [\n {\n path: path.relative(projectDirectory, absolutePath).split(path.sep).join('/'),\n contents: context.fs.readFileSync(absolutePath, 'utf8'),\n },\n ];\n });\n}\n\n/**\n * Resolve a Regal config file for a bundle, walking up to the workspace.\n *\n * @param context - CLI context\n * @param bundleDirectory - Absolute bundle directory\n * @returns Absolute config path, or undefined when none is found\n */\nfunction resolveRegalConfigFile(\n context: LocalContext,\n bundleDirectory: string,\n): string | undefined {\n let current = bundleDirectory;\n for (;;) {\n const nestedRegalConfig = path.join(current, '.regal', 'config.yaml');\n if (context.fs.existsSync(nestedRegalConfig)) {\n return nestedRegalConfig;\n }\n const rootRegalConfig = path.join(current, '.regal.yaml');\n if (context.fs.existsSync(rootRegalConfig)) {\n return rootRegalConfig;\n }\n const parent = path.dirname(current);\n if (parent === current) {\n return undefined;\n }\n current = parent;\n }\n}\n\n/**\n * Render the terminal summary for a policy verification result.\n *\n * @param context - CLI context\n * @param result - Completed verification result\n * @param heading - Optional section heading when linting multiple bundles\n */\nfunction renderResult(context: LocalContext, result: PolicyLintResult, heading?: string): void {\n if (heading) {\n context.logger.info(`${colors.bold(heading)}\\n`);\n } else {\n context.logger.info(`${colors.bold('Policy verification')}\\n`);\n }\n result.checks.forEach(({ name, status }) => {\n const label = status === 'passed' ? 'PASS' : status === 'failed' ? 'FAIL' : 'SKIP';\n const styledLabel =\n status === 'passed'\n ? colors.green(label)\n : status === 'failed'\n ? colors.red(label)\n : colors.yellow(label);\n const version =\n name === 'opa-version' && result.tools.opa\n ? ` (${result.tools.opa})`\n : name === 'regal-version' && result.tools.regal\n ? ` (${result.tools.regal})`\n : '';\n context.logger.info(`${styledLabel} ${POLICY_LINT_CHECK_LABELS[name]}${version}`);\n });\n if (result.diagnostics.length > 0) {\n context.logger.error('');\n }\n result.diagnostics.forEach((diagnostic) => {\n const location = diagnostic.path ? `${diagnostic.path}: ` : '';\n context.logger.error(\n colors.red(`error [${diagnostic.code}]: ${location}${diagnostic.message}`),\n );\n });\n if (result.status === 'passed') {\n context.logger.info('');\n context.logger.info(colors.green('Policy verification passed.'));\n } else {\n context.logger.error('');\n context.logger.error(colors.red('Policy verification failed.'));\n }\n}\n\n/**\n * Verify one publishable policy bundle directory.\n *\n * @param context - CLI context\n * @param flags - Command flags\n * @param resolvedDir - Absolute bundle directory\n * @param runner - Captured subprocess runner\n * @returns Completed verification result\n */\nasync function lintBundle(\n this: LocalContext,\n { fix, noInteractive, json }: LintCommandFlags,\n resolvedDir: string,\n runner: CapturedProcessRunner,\n): Promise<PolicyLintResult> {\n const checks: PolicyLintCheck[] = POLICY_LINT_CHECK_NAMES.map((name) => ({\n name,\n status: 'skipped',\n }));\n const diagnostics: PolicyLintDiagnostic[] = [];\n const result: PolicyLintResult = {\n version: POLICY_LINT_RESULT_VERSION,\n status: 'passed',\n directory: resolvedDir,\n fix,\n tools: { opa: null, regal: null },\n checks,\n unformattedFiles: [],\n fixedFiles: [],\n diagnostics,\n };\n const setStatus = (name: PolicyLintCheck['name'], status: PolicyLintCheck['status']): void => {\n checks.find((check) => check.name === name)!.status = status;\n };\n const addError = (code: string, message: string, diagnosticPath?: string): void => {\n diagnostics.push({\n code,\n severity: 'error',\n message,\n ...(diagnosticPath ? { path: diagnosticPath } : {}),\n });\n };\n\n if (!this.fs.existsSync(resolvedDir) || !this.fs.statSync(resolvedDir).isDirectory()) {\n setStatus('manifest', 'failed');\n addError(\n 'project.directory',\n `Policy directory does not exist or is not a directory: ${resolvedDir}`,\n path.relative(this.process.cwd(), resolvedDir),\n );\n result.status = 'failed';\n return result;\n }\n\n const manifestPath = path.join(resolvedDir, POLICY_MANIFEST_FILENAME);\n try {\n validatePolicyBundleContents(\n this.fs.existsSync(manifestPath) ? this.fs.readFileSync(manifestPath, 'utf8') : undefined,\n collectRegoFiles(this, resolvedDir),\n );\n setStatus('manifest', 'passed');\n } catch (error) {\n setStatus('manifest', 'failed');\n addError(\n 'manifest.invalid',\n error instanceof Error ? error.message : String(error),\n path.relative(this.process.cwd(), manifestPath),\n );\n }\n\n const opaVersionResult = await runner('opa', ['version'], { cwd: resolvedDir }, this);\n if (opaVersionResult.error?.code === 'ENOENT') {\n setStatus('opa-version', 'failed');\n addError('opa.missing', OPA_MISSING_MESSAGE);\n } else {\n const opaVersionOutput = `${opaVersionResult.stdout}\\n${opaVersionResult.stderr}`;\n const unsupportedOpa = unsupportedOpaVersionMessage(opaVersionOutput);\n if (opaVersionResult.code !== 0 || unsupportedOpa) {\n setStatus('opa-version', 'failed');\n addError(\n 'opa.version',\n unsupportedOpa ??\n getPolicyProcessFailureMessage(\n opaVersionResult,\n 'Unable to determine the installed OPA version.',\n ),\n );\n } else {\n result.tools.opa = parsePolicyToolVersion(opaVersionOutput)!.version;\n setStatus('opa-version', 'passed');\n }\n }\n\n const regalVersionResult = await runner('regal', ['version'], { cwd: resolvedDir }, this);\n if (regalVersionResult.error?.code === 'ENOENT') {\n setStatus('regal-version', 'failed');\n addError('regal.missing', REGAL_MISSING_MESSAGE);\n } else {\n const regalVersionOutput = `${regalVersionResult.stdout}\\n${regalVersionResult.stderr}`;\n const unsupportedRegal = unsupportedRegalVersionMessage(regalVersionOutput);\n if (regalVersionResult.code !== 0 || unsupportedRegal) {\n setStatus('regal-version', 'failed');\n addError(\n 'regal.version',\n unsupportedRegal ??\n getPolicyProcessFailureMessage(\n regalVersionResult,\n 'Unable to determine the installed Regal version.',\n ),\n );\n } else {\n result.tools.regal = parsePolicyToolVersion(regalVersionOutput)!.version;\n setStatus('regal-version', 'passed');\n }\n }\n\n if (result.tools.opa) {\n const formatResult = await runner(\n 'opa',\n ['fmt', '--list', resolvedDir],\n { cwd: resolvedDir },\n this,\n );\n if (formatResult.code !== 0) {\n setStatus('format', 'failed');\n addError(\n 'opa.format',\n getPolicyProcessFailureMessage(\n formatResult,\n `opa fmt --list failed with exit code ${formatResult.code}`,\n ),\n );\n } else {\n result.unformattedFiles = parseUnformattedPolicyFiles(formatResult.stdout, resolvedDir);\n if (result.unformattedFiles.length === 0) {\n setStatus('format', 'passed');\n } else {\n let shouldFormat = fix;\n const interactive = isInteractivePromptInvocation(\n { json, noInteractive },\n this.process.stdin.isTTY,\n this.process.stderr.isTTY,\n );\n if (!json && !fix) {\n this.logger.error(colors.red('Policy files are not formatted:'));\n result.unformattedFiles.forEach((file) => {\n this.logger.error(colors.red(` - ${file}`));\n });\n const diffResult = await runner(\n 'opa',\n ['fmt', '--diff', resolvedDir],\n { cwd: resolvedDir },\n this,\n );\n const diff = diffResult.stdout.trim() || diffResult.stderr.trim();\n if (diff) {\n this.logger.error('');\n this.logger.error(diff);\n }\n }\n if (!fix && interactive) {\n try {\n shouldFormat = await inquirerConfirmBoolean({\n message: 'Format the unformatted policy files listed above?',\n });\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n if (/force closed|prompt.*cancel|user.*close|SIGINT/iu.test(message)) {\n this.process.exit(130);\n }\n throw error;\n }\n }\n if (shouldFormat) {\n const writeResult = await runner(\n 'opa',\n ['fmt', '--write', resolvedDir],\n { cwd: resolvedDir },\n this,\n );\n if (writeResult.code === 0) {\n result.fixedFiles = [...result.unformattedFiles];\n setStatus('format', 'passed');\n } else {\n setStatus('format', 'failed');\n addError(\n 'opa.format-fix',\n getPolicyProcessFailureMessage(\n writeResult,\n `opa fmt --write failed with exit code ${writeResult.code}`,\n ),\n );\n }\n } else {\n setStatus('format', 'failed');\n addError(\n 'opa.format-required',\n 'Policy files are not formatted. Re-run `transcend policy lint --fix` to repair them.',\n );\n }\n }\n }\n\n const checkResult = await runner(\n 'opa',\n ['check', '--strict', '--ignore', '*_test.rego', resolvedDir],\n { cwd: resolvedDir },\n this,\n );\n if (checkResult.code === 0) {\n setStatus('opa-check', 'passed');\n } else {\n setStatus('opa-check', 'failed');\n addError(\n 'opa.check',\n getPolicyProcessFailureMessage(\n checkResult,\n `opa check failed with exit code ${checkResult.code}`,\n ),\n );\n }\n }\n\n if (result.tools.regal) {\n const regalConfig = resolveRegalConfigFile(this, resolvedDir);\n const regalResult = await runner(\n 'regal',\n [\n 'lint',\n '--fail-level',\n 'warning',\n ...(regalConfig ? ['--config-file', regalConfig] : []),\n resolvedDir,\n ],\n { cwd: resolvedDir },\n this,\n );\n if (regalResult.code === 0) {\n setStatus('regal-lint', 'passed');\n } else {\n setStatus('regal-lint', 'failed');\n addError(\n 'regal.lint',\n getPolicyProcessFailureMessage(\n regalResult,\n `regal lint failed with exit code ${regalResult.code}`,\n ),\n );\n }\n }\n\n if (result.tools.opa) {\n const testResult = await runner(\n 'opa',\n ['test', '--fail-on-empty', '-b', resolvedDir],\n { cwd: resolvedDir },\n this,\n );\n if (testResult.code === 0) {\n setStatus('opa-test', 'passed');\n } else {\n setStatus('opa-test', 'failed');\n addError(\n 'opa.test',\n getPolicyProcessFailureMessage(\n testResult,\n `opa test --fail-on-empty -b failed with exit code ${testResult.code}`,\n ),\n );\n }\n }\n\n result.status = checks.some(({ status }) => status === 'failed') ? 'failed' : 'passed';\n return result;\n}\n\n/**\n * Verify local policy bundles with the shared upload contract, OPA, and Regal.\n *\n * With no directory (or the default workspace path), discovers every immediate\n * child that contains a `.manifest` and verifies each. Pass one bundle path to\n * verify a single publishable unit.\n *\n * @param this - CLI context\n * @param flags - Command flags\n * @param directory - Policy workspace or bundle directory\n * @param runner - Captured subprocess runner\n */\nexport async function lint(\n this: LocalContext,\n flags: LintCommandFlags,\n directory: string = DEFAULT_POLICY_PROJECT_DIRECTORY,\n runner: CapturedProcessRunner = runCapturedProcess,\n): Promise<void> {\n doneInputValidation(this.process);\n\n const { fix = false, noInteractive = false, json = false } = flags;\n const resolvedDir = resolvePolicyProjectDirectory(this.process.cwd(), directory);\n\n if (!this.fs.existsSync(resolvedDir) || !this.fs.statSync(resolvedDir).isDirectory()) {\n const missing: PolicyLintResult = {\n version: POLICY_LINT_RESULT_VERSION,\n status: 'failed',\n directory: resolvedDir,\n fix,\n tools: { opa: null, regal: null },\n checks: POLICY_LINT_CHECK_NAMES.map((name) => ({\n name,\n status: name === 'manifest' ? 'failed' : 'skipped',\n })),\n unformattedFiles: [],\n fixedFiles: [],\n diagnostics: [\n {\n code: 'project.directory',\n severity: 'error',\n message: `Policy directory does not exist or is not a directory: ${resolvedDir}`,\n path: path.relative(this.process.cwd(), resolvedDir),\n },\n ],\n };\n if (json) {\n this.process.stdout.write(`${JSON.stringify(missing)}\\n`);\n } else {\n renderResult(this, missing);\n }\n this.process.exitCode = 1;\n return;\n }\n\n const bundleDirectories = discoverPolicyBundleDirectories(this, resolvedDir);\n if (bundleDirectories.length === 0) {\n const empty: PolicyLintResult = {\n version: POLICY_LINT_RESULT_VERSION,\n status: 'failed',\n directory: resolvedDir,\n fix,\n tools: { opa: null, regal: null },\n checks: POLICY_LINT_CHECK_NAMES.map((name) => ({\n name,\n status: name === 'manifest' ? 'failed' : 'skipped',\n })),\n unformattedFiles: [],\n fixedFiles: [],\n diagnostics: [\n {\n code: 'project.bundles',\n severity: 'error',\n message:\n 'No publishable policy bundles found. Add one with `transcend policy new`, ' +\n 'or pass a directory that contains a `.manifest`.',\n path: path.relative(this.process.cwd(), resolvedDir) || '.',\n },\n ],\n };\n if (json) {\n this.process.stdout.write(`${JSON.stringify(empty)}\\n`);\n } else {\n renderResult(this, empty);\n }\n this.process.exitCode = 1;\n return;\n }\n\n const results: PolicyLintResult[] = [];\n for (const bundleDirectory of bundleDirectories) {\n results.push(\n await lintBundle.call(this, { fix, noInteractive, json }, bundleDirectory, runner),\n );\n }\n\n const failed = results.some((result) => result.status === 'failed');\n if (json) {\n if (results.length === 1) {\n this.process.stdout.write(`${JSON.stringify(results[0])}\\n`);\n } else {\n const multi: PolicyLintMultiResult = {\n version: POLICY_LINT_MULTI_RESULT_VERSION,\n status: failed ? 'failed' : 'passed',\n directory: resolvedDir,\n fix,\n results,\n };\n this.process.stdout.write(`${JSON.stringify(multi)}\\n`);\n }\n } else if (results.length === 1) {\n renderResult(this, results[0]!);\n } else {\n results.forEach((result, index) => {\n if (index > 0) {\n this.logger.info('');\n }\n const relative = path.relative(this.process.cwd(), result.directory) || result.directory;\n renderResult(this, result, `Policy verification — ${relative}`);\n });\n }\n\n if (failed) {\n this.process.exitCode = 1;\n }\n}\n"],"mappings":"2cAyBA,MAAa,EAAqD,CAChE,WACA,cACA,gBACA,SACA,YACA,aACA,WACD,CAGY,EAA8E,CACzF,SAAU,6BACV,cAAe,UACf,gBAAiB,QACjB,OAAQ,iBACR,YAAa,mBACb,aAAc,aACd,WAAY,YACb,CCjCD,SAAgB,EACd,EACA,EACQ,CAER,MADe,CAAC,EAAO,OAAO,MAAM,CAAE,EAAO,OAAO,MAAM,CAAC,CAAC,OAAO,QAAQ,CAAC,KAAK;EACpE,EAAI,EAUnB,SAAgB,EAA4B,EAAgB,EAAoC,CAC9F,MAAO,CACL,GAAG,IAAI,IACL,EACG,MAAM,UAAU,CAChB,IAAK,GAAS,EAAK,MAAM,CAAC,CAC1B,OAAO,QAAQ,CACf,IAAK,GACJ,EAAK,WAAW,EAAK,CACjB,EAAK,SAAS,EAAkB,EAAK,CAAC,MAAM,EAAK,IAAI,CAAC,KAAK,IAAI,CAC/D,EAAK,MAAM,EAAK,IAAI,CAAC,KAAK,IAAI,CACnC,CACJ,CACF,CAAC,MAAM,C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AAK,gBAAe,OAAM,CAAE,EAAiB,EAAO,CACnF,CAGH,IAAM,EAAS,EAAQ,KAAM,GAAW,EAAO,SAAW,SAAS,CACnE,GAAI,EACF,GAAI,EAAQ,SAAW,EACrB,KAAK,QAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,EAAQ,GAAG,CAAC,IAAI,KACvD,CACL,IAAM,EAA+B,CACnC,QAAA,EACA,OAAQ,EAAS,SAAW,SAC5B,UAAW,EACX,MACA,UACD,CACD,KAAK,QAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,EAAM,CAAC,IAAI,MAEhD,EAAQ,SAAW,EAC5B,EAAa,KAAM,EAAQ,GAAI,CAE/B,EAAQ,SAAS,EAAQ,IAAU,CAC7B,EAAQ,GACV,KAAK,OAAO,KAAK,GAAG,CAEtB,IAAM,EAAW,EAAK,SAAS,KAAK,QAAQ,KAAK,CAAE,EAAO,UAAU,EAAI,EAAO,UAC/E,EAAa,KAAM,EAAQ,yBAAyB,IAAW,EAC/D,CAGA,IACF,KAAK,QAAQ,SAAW"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./markSilentPrivacyRequests-Cs_iZNJs.mjs";import{t}from"./done-input-validation-BUz-aVC5.mjs";async function n({auth:n,transcendUrl:r,actions:i,statuses:a,requestIds:o,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u,concurrency:d}){t(this.process),await e({transcendUrl:r,requestActions:i,auth:n,requestIds:o,statuses:a,concurrency:d,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u})}export{n as markSilent};
2
- //# sourceMappingURL=impl-C_62Z4ED.mjs.map
1
+ import{t as e}from"./markSilentPrivacyRequests-D3bFOMLh.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";async function n({auth:n,transcendUrl:r,actions:i,statuses:a,requestIds:o,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u,concurrency:d}){t(this.process),await e({transcendUrl:r,requestActions:i,auth:n,requestIds:o,statuses:a,concurrency:d,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u})}export{n as markSilent};
2
+ //# sourceMappingURL=impl-BRFL8xp7.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-C_62Z4ED.mjs","names":[],"sources":["../src/commands/request/mark-silent/impl.ts"],"sourcesContent":["import type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { markSilentPrivacyRequests } from '../../../lib/requests/index.js';\n\nexport interface MarkSilentCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses?: RequestStatus[];\n requestIds?: string[];\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function markSilent(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n actions,\n statuses,\n requestIds,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n }: MarkSilentCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await markSilentPrivacyRequests({\n transcendUrl,\n requestActions: actions,\n auth,\n requestIds,\n statuses,\n concurrency,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n });\n}\n"],"mappings":"iHAmBA,eAAsB,EAEpB,CACE,OACA,eACA,UACA,WACA,aACA,kBACA,iBACA,kBACA,iBACA,eAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAA0B,CAC9B,eACA,eAAgB,EAChB,OACA,aACA,WACA,cACA,kBACA,iBACA,kBACA,iBACD,CAAC"}
1
+ {"version":3,"file":"impl-BRFL8xp7.mjs","names":[],"sources":["../src/commands/request/mark-silent/impl.ts"],"sourcesContent":["import type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { markSilentPrivacyRequests } from '../../../lib/requests/index.js';\n\nexport interface MarkSilentCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses?: RequestStatus[];\n requestIds?: string[];\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function markSilent(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n actions,\n statuses,\n requestIds,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n }: MarkSilentCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await markSilentPrivacyRequests({\n transcendUrl,\n requestActions: actions,\n auth,\n requestIds,\n statuses,\n concurrency,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n });\n}\n"],"mappings":"iHAmBA,eAAsB,EAEpB,CACE,OACA,eACA,UACA,WACA,aACA,kBACA,iBACA,kBACA,iBACA,eAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAA0B,CAC9B,eACA,eAAgB,EAChB,OACA,aACA,WACA,cACA,kBACA,iBACA,kBACA,iBACD,CAAC"}
@@ -0,0 +1,2 @@
1
+ import{i as e,n as t,t as n}from"./policy-project-discovery-B4cFXUlA.mjs";import{n as r,r as i}from"./runOpa-ojIqU1tO.mjs";import{t as a}from"./done-input-validation-LiTaCEzF.mjs";import o from"node:path";import s from"colors";async function c({format:c,verbose:l,run:u,coverage:d,threshold:f,timeout:p,"var-values":m,explain:h,schema:g,"exit-zero-on-skipped":_},v=n){a(this.process),i();let y=e(this.process.cwd(),v);if(!this.fs.existsSync(y)||!this.fs.statSync(y).isDirectory())throw Error(`Policy directory does not exist or is not a directory: ${y}`);if(f!==void 0&&!d)throw Error(`--threshold requires --coverage.`);if(f!==void 0){let e=Number(f);if(!Number.isFinite(e)||e<0||e>100)throw Error(`--threshold must be a number between 0 and 100, got: ${f}`)}let b=g?o.resolve(this.process.cwd(),g):void 0;if(b&&!this.fs.existsSync(b))throw Error(`Schema path not found: ${b}`);let x=t(this,y);if(x.length===0)throw Error("No publishable policy bundles found. Add one with `transcend policy new`, or pass a directory that contains a `.manifest`.");for(let e of x){this.logger.info(s.green(`Running policy tests in ${e}...`));let t=await r([`test`,`--fail-on-empty`,`-b`,e,`--format`,c,...l?[`--verbose`]:[],...u?[`--run`,u]:[],...d?[`--coverage`]:[],...f===void 0?[]:[`--threshold`,f],...p?[`--timeout`,p]:[],...m?[`--var-values`]:[],...h?[`--explain`,h]:[],...b?[`--schema`,b]:[],..._?[`--exit-zero-on-skipped`]:[]]);t!==0&&this.process.exit(t)}this.logger.info(s.green(`Policy tests passed.`))}export{c as test};
2
+ //# sourceMappingURL=impl-BTvZxws5.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl-BTvZxws5.mjs","names":[],"sources":["../src/commands/policy/test/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 {\n DEFAULT_POLICY_PROJECT_DIRECTORY,\n discoverPolicyBundleDirectories,\n resolvePolicyProjectDirectory,\n} from '../../../lib/policy/policy-project-discovery.js';\nimport { assertOpaInstalled, runOpa } from '../helpers/index.js';\nimport type { PolicyTestExplainMode, PolicyTestFormat } from './command.js';\n\n/** CLI flags for `transcend policy test`. */\nexport interface TestCommandFlags {\n /** `opa test --format` value. */\n format: PolicyTestFormat;\n /** `opa test --verbose`. */\n verbose: boolean;\n /** Optional `opa test --run` regex. */\n run?: string;\n /** `opa test --coverage`. */\n coverage: boolean;\n /** Optional `opa test --threshold` coverage percent. */\n threshold?: string;\n /** Optional `opa test --timeout` duration. */\n timeout?: string;\n /** `opa test --var-values`. */\n 'var-values': boolean;\n /** Optional `opa test --explain` mode. */\n explain?: PolicyTestExplainMode;\n /** Optional `opa test --schema` path. */\n schema?: string;\n /** `opa test --exit-zero-on-skipped`. */\n 'exit-zero-on-skipped': boolean;\n}\n\n/**\n * Run OPA tests against local policy bundles.\n *\n * With no directory (or the default workspace path), discovers every immediate\n * child that contains a `.manifest` and tests each. Pass one bundle path to\n * test a single publishable unit.\n *\n * @param this - CLI context\n * @param flags - Command flags\n * @param directory - Policy workspace or bundle directory\n */\nexport async function test(\n this: LocalContext,\n {\n format,\n verbose,\n run,\n coverage,\n threshold,\n timeout,\n 'var-values': varValues,\n explain,\n schema,\n 'exit-zero-on-skipped': exitZeroOnSkipped,\n }: TestCommandFlags,\n directory: string = DEFAULT_POLICY_PROJECT_DIRECTORY,\n): Promise<void> {\n doneInputValidation(this.process);\n\n assertOpaInstalled();\n const resolvedDir = resolvePolicyProjectDirectory(this.process.cwd(), directory);\n if (!this.fs.existsSync(resolvedDir) || !this.fs.statSync(resolvedDir).isDirectory()) {\n throw new Error(`Policy directory does not exist or is not a directory: ${resolvedDir}`);\n }\n\n if (threshold !== undefined && !coverage) {\n throw new Error('--threshold requires --coverage.');\n }\n if (threshold !== undefined) {\n const parsed = Number(threshold);\n if (!Number.isFinite(parsed) || parsed < 0 || parsed > 100) {\n throw new Error(`--threshold must be a number between 0 and 100, got: ${threshold}`);\n }\n }\n\n const schemaPath = schema ? path.resolve(this.process.cwd(), schema) : undefined;\n if (schemaPath && !this.fs.existsSync(schemaPath)) {\n throw new Error(`Schema path not found: ${schemaPath}`);\n }\n\n const bundleDirectories = discoverPolicyBundleDirectories(this, resolvedDir);\n if (bundleDirectories.length === 0) {\n throw new Error(\n 'No publishable policy bundles found. Add one with `transcend policy new`, ' +\n 'or pass a directory that contains a `.manifest`.',\n );\n }\n\n for (const bundleDirectory of bundleDirectories) {\n this.logger.info(colors.green(`Running policy tests in ${bundleDirectory}...`));\n const exitCode = await runOpa([\n 'test',\n '--fail-on-empty',\n '-b',\n bundleDirectory,\n '--format',\n format,\n ...(verbose ? ['--verbose'] : []),\n ...(run ? ['--run', run] : []),\n ...(coverage ? ['--coverage'] : []),\n ...(threshold !== undefined ? ['--threshold', threshold] : []),\n ...(timeout ? ['--timeout', timeout] : []),\n ...(varValues ? ['--var-values'] : []),\n ...(explain ? ['--explain', explain] : []),\n ...(schemaPath ? ['--schema', schemaPath] : []),\n ...(exitZeroOnSkipped ? ['--exit-zero-on-skipped'] : []),\n ]);\n if (exitCode !== 0) {\n this.process.exit(exitCode);\n }\n }\n\n this.logger.info(colors.green('Policy tests passed.'));\n}\n"],"mappings":"mOAiDA,eAAsB,EAEpB,CACE,SACA,UACA,MACA,WACA,YACA,UACA,aAAc,EACd,UACA,SACA,uBAAwB,GAE1B,EAAoB,EACL,CACf,EAAoB,KAAK,QAAQ,CAEjC,GAAoB,CACpB,IAAM,EAAc,EAA8B,KAAK,QAAQ,KAAK,CAAE,EAAU,CAChF,GAAI,CAAC,KAAK,GAAG,WAAW,EAAY,EAAI,CAAC,KAAK,GAAG,SAAS,EAAY,CAAC,aAAa,CAClF,MAAU,MAAM,0DAA0D,IAAc,CAG1F,GAAI,IAAc,IAAA,IAAa,CAAC,EAC9B,MAAU,MAAM,mCAAmC,CAErD,GAAI,IAAc,IAAA,GAAW,CAC3B,IAAM,EAAS,OAAO,EAAU,CAChC,GAAI,CAAC,OAAO,SAAS,EAAO,EAAI,EAAS,GAAK,EAAS,IACrD,MAAU,MAAM,wDAAwD,IAAY,CAIxF,IAAM,EAAa,EAAS,EAAK,QAAQ,KAAK,QAAQ,KAAK,CAAE,EAAO,CAAG,IAAA,GACvE,GAAI,GAAc,CAAC,KAAK,GAAG,WAAW,EAAW,CAC/C,MAAU,MAAM,0BAA0B,IAAa,CAGzD,IAAM,EAAoB,EAAgC,KAAM,EAAY,CAC5E,GAAI,EAAkB,SAAW,EAC/B,MAAU,MACR,6HAED,CAGH,IAAK,IAAM,KAAmB,EAAmB,CAC/C,KAAK,OAAO,KAAK,EAAO,MAAM,2BAA2B,EAAgB,KAAK,CAAC,CAC/E,IAAM,EAAW,MAAM,EAAO,CAC5B,OACA,kBACA,KACA,EACA,WACA,EACA,GAAI,EAAU,CAAC,YAAY,CAAG,EAAE,CAChC,GAAI,EAAM,CAAC,QAAS,EAAI,CAAG,EAAE,CAC7B,GAAI,EAAW,CAAC,aAAa,CAAG,EAAE,CAClC,GAAI,IAAc,IAAA,GAAyC,EAAE,CAA/B,CAAC,cAAe,EAAU,CACxD,GAAI,EAAU,CAAC,YAAa,EAAQ,CAAG,EAAE,CACzC,GAAI,EAAY,CAAC,eAAe,CAAG,EAAE,CACrC,GAAI,EAAU,CAAC,YAAa,EAAQ,CAAG,EAAE,CACzC,GAAI,EAAa,CAAC,WAAY,EAAW,CAAG,EAAE,CAC9C,GAAI,EAAoB,CAAC,yBAAyB,CAAG,EAAE,CACxD,CAAC,CACE,IAAa,GACf,KAAK,QAAQ,KAAK,EAAS,CAI/B,KAAK,OAAO,KAAK,EAAO,MAAM,uBAAuB,CAAC"}
@@ -1,2 +1,2 @@
1
- import{r as e}from"./constants-Upxn_rQF.mjs";import{r as t}from"./readTranscendYaml-BNn6-Ofi.mjs";import{n,t as r}from"./mergeTranscendInputs-DFQcbh8b.mjs";import{t as i}from"./parseVariablesFromString-BOSfQ4QF.mjs";import{t as a}from"./validateTranscendAuth-D6Wr1cxY.mjs";import{t as o}from"./listFiles-BdFUbX5x.mjs";import{t as s}from"./done-input-validation-BUz-aVC5.mjs";import c from"node:path";import l from"colors";import{buildTranscendGraphQLClient as u}from"@transcend-io/sdk";import{mapSeries as d}from"@transcend-io/utils";async function f({transcendUrl:e,auth:t,pageSize:r,publishToPrivacyCenter:i,contents:a,deleteExtraAttributeValues:o=!1,classifyService:s=!1,logger:c}){let d=u(e,t);try{let e=await n(a,d,{pageSize:r,publishToPrivacyCenter:i,classifyService:s,deleteExtraAttributeValues:o,logger:c});return e.success||e.errors.forEach(({resource:e,item:t,message:n})=>{c.error(l.red(`Failed to sync ${e}${t?` "${t}"`:``}: ${n}`))}),e.success}catch(e){return c.error(l.red(`An unexpected error occurred syncing the schema: ${e.message}`)),!1}}async function p({file:n=`./transcend.yml`,transcendUrl:u,auth:p,variables:m,pageSize:h,publishToPrivacyCenter:g,classifyService:_,deleteExtraAttributeValues:v}){s(this.process);let y=await a(p,this),b=i(m),x;if(x=Array.isArray(y)&&this.fs.lstatSync(n).isDirectory()?o(this.fs.readdirSync(n)).map(e=>c.join(n,e)):n.split(`,`),x.length<1)throw Error(`No file specified!`);let S=x.map(e=>{this.fs.existsSync(e)?this.logger.info(l.magenta(`Reading file "${e}"...`)):(this.logger.error(l.red(`The file path does not exist on disk: ${e}. You can specify the filepath using --file=./examples/transcend.yml`)),this.process.exit(1));try{let n=t(this.fs.readFileSync(e,`utf8`),b,e);return this.logger.info(l.green(`Successfully read in "${e}"`)),{content:n,name:e.split(`/`).pop().replace(`.yml`,``)}}catch(e){this.logger.error(l.red(`The shape of your yaml file is invalid with the following errors: ${e.message}`)),this.process.exit(1)}});if(typeof y==`string`){let[t,...n]=S.map(({content:e})=>e);await f({transcendUrl:u,auth:y,contents:r(t,...n),publishToPrivacyCenter:g,deleteExtraAttributeValues:v,pageSize:h,classifyService:!!_,logger:this.logger})||(this.logger.info(l.red(`Sync encountered errors. View output above for more information, or check out ${e}`)),this.process.exit(1))}else{if(S.length!==1&&S.length!==y.length)throw Error(`Expected list of yml files to be equal to the list of API keys.Got ${S.length} YML file${S.length===1?``:`s`} and ${y.length} API key${y.length===1?``:`s`}`);let t=[];await d(y,async(e,n)=>{let r=`[${n+1}/${y.length}][${e.organizationName}] `;this.logger.info(l.magenta(`~~~\n\n${r}Attempting to push configuration...\n\n~~~`));let i=S.length===1?S[0].content:S.find(t=>t.name===e.organizationName)?.content;if(!i){this.logger.error(l.red(`${r}Failed to find transcend.yml file for organization: "${e.organizationName}".`)),t.push(e.organizationName);return}await f({transcendUrl:u,auth:e.apiKey,contents:i,pageSize:h,publishToPrivacyCenter:g,deleteExtraAttributeValues:v,classifyService:_,logger:this.logger})?this.logger.info(l.green(`${r}Successfully pushed configuration!`)):(this.logger.error(l.red(`${r}Failed to sync configuration.`)),t.push(e.organizationName))}),t.length>0&&(this.logger.info(l.red(`Sync encountered errors for "${t.join(`,`)}". View output above for more information, or check out ${e}`)),this.process.exit(1))}this.logger.info(l.green(`Successfully synced yaml file to Transcend! View at ${e}`))}export{p as push};
2
- //# sourceMappingURL=impl-D94m3EPp.mjs.map
1
+ import{r as e}from"./constants-BlKpAm3R.mjs";import{r as t}from"./readTranscendYaml-BfqQbPiT.mjs";import{n,t as r}from"./mergeTranscendInputs-B7WjxYMN.mjs";import{t as i}from"./parseVariablesFromString-6TYW65LF.mjs";import{t as a}from"./validateTranscendAuth-D-dDINof.mjs";import{t as o}from"./listFiles-DDGCBdtx.mjs";import{t as s}from"./done-input-validation-LiTaCEzF.mjs";import c from"node:path";import l from"colors";import{mapSeries as u}from"@transcend-io/utils";import{buildTranscendGraphQLClient as d}from"@transcend-io/sdk";async function f({transcendUrl:e,auth:t,pageSize:r,publishToPrivacyCenter:i,contents:a,deleteExtraAttributeValues:o=!1,classifyService:s=!1,logger:c}){let u=d(e,t);try{let e=await n(a,u,{pageSize:r,publishToPrivacyCenter:i,classifyService:s,deleteExtraAttributeValues:o,logger:c});return e.success||e.errors.forEach(({resource:e,item:t,message:n})=>{c.error(l.red(`Failed to sync ${e}${t?` "${t}"`:``}: ${n}`))}),e.success}catch(e){return c.error(l.red(`An unexpected error occurred syncing the schema: ${e.message}`)),!1}}async function p({file:n=`./transcend.yml`,transcendUrl:d,auth:p,variables:m,pageSize:h,publishToPrivacyCenter:g,classifyService:_,deleteExtraAttributeValues:v}){s(this.process);let y=await a(p,this),b=i(m),x;if(x=Array.isArray(y)&&this.fs.lstatSync(n).isDirectory()?o(this.fs.readdirSync(n)).map(e=>c.join(n,e)):n.split(`,`),x.length<1)throw Error(`No file specified!`);let S=x.map(e=>{this.fs.existsSync(e)?this.logger.info(l.magenta(`Reading file "${e}"...`)):(this.logger.error(l.red(`The file path does not exist on disk: ${e}. You can specify the filepath using --file=./examples/transcend.yml`)),this.process.exit(1));try{let n=t(this.fs.readFileSync(e,`utf8`),b,e);return this.logger.info(l.green(`Successfully read in "${e}"`)),{content:n,name:e.split(`/`).pop().replace(`.yml`,``)}}catch(e){this.logger.error(l.red(`The shape of your yaml file is invalid with the following errors: ${e.message}`)),this.process.exit(1)}});if(typeof y==`string`){let[t,...n]=S.map(({content:e})=>e);await f({transcendUrl:d,auth:y,contents:r(t,...n),publishToPrivacyCenter:g,deleteExtraAttributeValues:v,pageSize:h,classifyService:!!_,logger:this.logger})||(this.logger.info(l.red(`Sync encountered errors. View output above for more information, or check out ${e}`)),this.process.exit(1))}else{if(S.length!==1&&S.length!==y.length)throw Error(`Expected list of yml files to be equal to the list of API keys.Got ${S.length} YML file${S.length===1?``:`s`} and ${y.length} API key${y.length===1?``:`s`}`);let t=[];await u(y,async(e,n)=>{let r=`[${n+1}/${y.length}][${e.organizationName}] `;this.logger.info(l.magenta(`~~~\n\n${r}Attempting to push configuration...\n\n~~~`));let i=S.length===1?S[0].content:S.find(t=>t.name===e.organizationName)?.content;if(!i){this.logger.error(l.red(`${r}Failed to find transcend.yml file for organization: "${e.organizationName}".`)),t.push(e.organizationName);return}await f({transcendUrl:d,auth:e.apiKey,contents:i,pageSize:h,publishToPrivacyCenter:g,deleteExtraAttributeValues:v,classifyService:_,logger:this.logger})?this.logger.info(l.green(`${r}Successfully pushed configuration!`)):(this.logger.error(l.red(`${r}Failed to sync configuration.`)),t.push(e.organizationName))}),t.length>0&&(this.logger.info(l.red(`Sync encountered errors for "${t.join(`,`)}". View output above for more information, or check out ${e}`)),this.process.exit(1))}this.logger.info(l.green(`Successfully synced yaml file to Transcend! View at ${e}`))}export{p as push};
2
+ //# sourceMappingURL=impl-BVcy_GYa.mjs.map