@transcend-io/cli 10.29.3 → 12.0.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 (367) hide show
  1. package/README.md +229 -84
  2. package/dist/app-CR3U95JW.mjs +148 -0
  3. package/dist/app-CR3U95JW.mjs.map +1 -0
  4. package/dist/{approvePrivacyRequests-DmQY27tf.mjs → approvePrivacyRequests-BDG82nlp.mjs} +2 -2
  5. package/dist/{approvePrivacyRequests-DmQY27tf.mjs.map → approvePrivacyRequests-BDG82nlp.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-COM0o0UR.mjs → buildExamples-B6BdW0FD.mjs} +2 -2
  10. package/dist/{buildExamples-COM0o0UR.mjs.map → buildExamples-B6BdW0FD.mjs.map} +1 -1
  11. package/dist/{buildXdiSyncEndpoint-5tSouA2b.mjs → buildXdiSyncEndpoint-FExEagKc.mjs} +2 -2
  12. package/dist/{buildXdiSyncEndpoint-5tSouA2b.mjs.map → buildXdiSyncEndpoint-FExEagKc.mjs.map} +1 -1
  13. package/dist/{bulkRestartRequests-CZrXs34U.mjs → bulkRestartRequests-OKwKXc52.mjs} +2 -2
  14. package/dist/{bulkRestartRequests-CZrXs34U.mjs.map → bulkRestartRequests-OKwKXc52.mjs.map} +1 -1
  15. package/dist/{bulkRetryEnrichers-BOXW2gK0.mjs → bulkRetryEnrichers-Dl-n8AFF.mjs} +2 -2
  16. package/dist/{bulkRetryEnrichers-BOXW2gK0.mjs.map → bulkRetryEnrichers-Dl-n8AFF.mjs.map} +1 -1
  17. package/dist/{cancelPrivacyRequests-CA8X4g4A.mjs → cancelPrivacyRequests-BIgX5SDz.mjs} +2 -2
  18. package/dist/{cancelPrivacyRequests-CA8X4g4A.mjs.map → cancelPrivacyRequests-BIgX5SDz.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-X7lkPELf.mjs +9 -0
  26. package/dist/command-X7lkPELf.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-BRsj50Nb.mjs +2 -0
  36. package/dist/{constants-XH8NIJGC.mjs.map → constants-BRsj50Nb.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-BtyIMQcK.mjs → createPoolingCommandUi-CyPZ3GqN.mjs} +5 -5
  44. package/dist/{createPoolingCommandUi-BtyIMQcK.mjs.map → createPoolingCommandUi-CyPZ3GqN.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-DbZjPjHw.mjs → downloadPrivacyRequestFiles-EBySRnvd.mjs} +2 -2
  52. package/dist/{downloadPrivacyRequestFiles-DbZjPjHw.mjs.map → downloadPrivacyRequestFiles-EBySRnvd.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-C1iD6Las.mjs → generateCrossAccountApiKeys-pWTrIUE6.mjs} +2 -2
  62. package/dist/{generateCrossAccountApiKeys-C1iD6Las.mjs.map → generateCrossAccountApiKeys-pWTrIUE6.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-CNgOWzOX.mjs → impl-1SsreZWo.mjs} +2 -2
  66. package/dist/{impl-CNgOWzOX.mjs.map → impl-1SsreZWo.mjs.map} +1 -1
  67. package/dist/{impl-BjoGaK1M.mjs → impl-7rdGuHOC.mjs} +2 -2
  68. package/dist/{impl-BjoGaK1M.mjs.map → impl-7rdGuHOC.mjs.map} +1 -1
  69. package/dist/{impl-DRpK-QLC.mjs → impl-ApZGIx6l.mjs} +2 -2
  70. package/dist/{impl-DRpK-QLC.mjs.map → impl-ApZGIx6l.mjs.map} +1 -1
  71. package/dist/{impl-DVeGQCrr.mjs → impl-Ay6JeH-7.mjs} +2 -2
  72. package/dist/{impl-DVeGQCrr.mjs.map → impl-Ay6JeH-7.mjs.map} +1 -1
  73. package/dist/{impl-BR4ReYFA.mjs → impl-B2ZXtnpX.mjs} +2 -2
  74. package/dist/{impl-BR4ReYFA.mjs.map → impl-B2ZXtnpX.mjs.map} +1 -1
  75. package/dist/impl-B440iuvL.mjs +3 -0
  76. package/dist/impl-B440iuvL.mjs.map +1 -0
  77. package/dist/{impl-v_P8hszk2.mjs → impl-B7l4bLG5.mjs} +2 -2
  78. package/dist/impl-B7l4bLG5.mjs.map +1 -0
  79. package/dist/{impl-BPoEH3Nf2.mjs → impl-B94dMG4x2.mjs} +2 -2
  80. package/dist/{impl-BPoEH3Nf2.mjs.map → impl-B94dMG4x2.mjs.map} +1 -1
  81. package/dist/{impl-DXowiNOz.mjs → impl-BH1fCPDh.mjs} +2 -2
  82. package/dist/{impl-DXowiNOz.mjs.map → impl-BH1fCPDh.mjs.map} +1 -1
  83. package/dist/{impl-CfvxD3RI.mjs → impl-BLOhoP-b2.mjs} +2 -2
  84. package/dist/impl-BLOhoP-b2.mjs.map +1 -0
  85. package/dist/{impl-CMxliF19.mjs → impl-BLQDgwxL.mjs} +2 -2
  86. package/dist/{impl-CMxliF19.mjs.map → impl-BLQDgwxL.mjs.map} +1 -1
  87. package/dist/{impl-Dqqb0lVN.mjs → impl-BWPPVXG3.mjs} +3 -3
  88. package/dist/{impl-Dqqb0lVN.mjs.map → impl-BWPPVXG3.mjs.map} +1 -1
  89. package/dist/{impl-DceiaFcK.mjs → impl-BdTxFv63.mjs} +2 -2
  90. package/dist/{impl-DceiaFcK.mjs.map → impl-BdTxFv63.mjs.map} +1 -1
  91. package/dist/impl-BpVe6fMe.mjs +3 -0
  92. package/dist/{impl--JGnR3wp.mjs.map → impl-BpVe6fMe.mjs.map} +1 -1
  93. package/dist/impl-BqTMPbwc2.mjs +2 -0
  94. package/dist/impl-BqTMPbwc2.mjs.map +1 -0
  95. package/dist/impl-CAoIp9Nl2.mjs +3 -0
  96. package/dist/impl-CAoIp9Nl2.mjs.map +1 -0
  97. package/dist/{impl-99xoQXHW.mjs → impl-CU38kdj8.mjs} +2 -2
  98. package/dist/{impl-99xoQXHW.mjs.map → impl-CU38kdj8.mjs.map} +1 -1
  99. package/dist/{impl-DxnrCWeR2.mjs → impl-CWP6AXSb.mjs} +2 -2
  100. package/dist/impl-CWP6AXSb.mjs.map +1 -0
  101. package/dist/impl-CY8C-Fvj2.mjs +2 -0
  102. package/dist/impl-CY8C-Fvj2.mjs.map +1 -0
  103. package/dist/{impl-CfPDnai_.mjs → impl-C_Ifcb00.mjs} +2 -2
  104. package/dist/{impl-CfPDnai_.mjs.map → impl-C_Ifcb00.mjs.map} +1 -1
  105. package/dist/{impl-CPSEzCc9.mjs → impl-Cb42aI60.mjs} +2 -2
  106. package/dist/{impl-CPSEzCc9.mjs.map → impl-Cb42aI60.mjs.map} +1 -1
  107. package/dist/impl-Cee7Q1Ne.mjs +2 -0
  108. package/dist/impl-Cee7Q1Ne.mjs.map +1 -0
  109. package/dist/impl-CieztjdM.mjs +2 -0
  110. package/dist/impl-CieztjdM.mjs.map +1 -0
  111. package/dist/{impl-DqhZR11m.mjs → impl-ClqrQo1M.mjs} +2 -2
  112. package/dist/{impl-DqhZR11m.mjs.map → impl-ClqrQo1M.mjs.map} +1 -1
  113. package/dist/impl-CnHfn7rr.mjs +5 -0
  114. package/dist/{impl-DPtx5iZO.mjs.map → impl-CnHfn7rr.mjs.map} +1 -1
  115. package/dist/{impl-jJnYd4tJ.mjs → impl-CrdqsTUy.mjs} +2 -2
  116. package/dist/{impl-jJnYd4tJ.mjs.map → impl-CrdqsTUy.mjs.map} +1 -1
  117. package/dist/{impl-DzUTmaID2.mjs → impl-CsaT3aM2.mjs} +2 -2
  118. package/dist/impl-CsaT3aM2.mjs.map +1 -0
  119. package/dist/{impl-DB8Kt2qF2.mjs → impl-CspH2ZWx.mjs} +2 -2
  120. package/dist/impl-CspH2ZWx.mjs.map +1 -0
  121. package/dist/{impl-H9kweQnu2.mjs → impl-CudSYx-g.mjs} +2 -2
  122. package/dist/impl-CudSYx-g.mjs.map +1 -0
  123. package/dist/{impl-DUBsZL5O.mjs → impl-Cxprr2hw.mjs} +2 -2
  124. package/dist/{impl-DUBsZL5O.mjs.map → impl-Cxprr2hw.mjs.map} +1 -1
  125. package/dist/{impl-C5Mq4wv0.mjs → impl-D-a5xGld.mjs} +2 -2
  126. package/dist/{impl-C5Mq4wv0.mjs.map → impl-D-a5xGld.mjs.map} +1 -1
  127. package/dist/{impl-CGioITgZ.mjs → impl-D1UogVAq.mjs} +2 -2
  128. package/dist/{impl-CGioITgZ.mjs.map → impl-D1UogVAq.mjs.map} +1 -1
  129. package/dist/{impl-B37wtYBz.mjs → impl-D1f9mJL_.mjs} +2 -2
  130. package/dist/{impl-B37wtYBz.mjs.map → impl-D1f9mJL_.mjs.map} +1 -1
  131. package/dist/{impl-Cl9ndadE.mjs → impl-DJcNhpbx.mjs} +2 -2
  132. package/dist/{impl-Cl9ndadE.mjs.map → impl-DJcNhpbx.mjs.map} +1 -1
  133. package/dist/impl-DQG1pMzD2.mjs +2 -0
  134. package/dist/impl-DQG1pMzD2.mjs.map +1 -0
  135. package/dist/impl-DQcgEx7V2.mjs +298 -0
  136. package/dist/impl-DQcgEx7V2.mjs.map +1 -0
  137. package/dist/impl-DRKPx_I9.mjs +2 -0
  138. package/dist/impl-DRKPx_I9.mjs.map +1 -0
  139. package/dist/{impl-CXQ3OYR9.mjs → impl-DTadLabu.mjs} +2 -2
  140. package/dist/{impl-CXQ3OYR9.mjs.map → impl-DTadLabu.mjs.map} +1 -1
  141. package/dist/{impl-B9lSnjby.mjs → impl-DXbxO2VJ.mjs} +2 -2
  142. package/dist/{impl-B9lSnjby.mjs.map → impl-DXbxO2VJ.mjs.map} +1 -1
  143. package/dist/{impl-Cel22rUg2.mjs → impl-DcL-8NEa2.mjs} +2 -2
  144. package/dist/{impl-Cel22rUg2.mjs.map → impl-DcL-8NEa2.mjs.map} +1 -1
  145. package/dist/{impl-DKepRc812.mjs → impl-DeCRXfAh2.mjs} +2 -2
  146. package/dist/{impl-DKepRc812.mjs.map → impl-DeCRXfAh2.mjs.map} +1 -1
  147. package/dist/impl-DezV3QMo.mjs +3 -0
  148. package/dist/impl-DezV3QMo.mjs.map +1 -0
  149. package/dist/{impl-COujMWgp.mjs → impl-Dg7XSQdO2.mjs} +2 -2
  150. package/dist/impl-Dg7XSQdO2.mjs.map +1 -0
  151. package/dist/{impl-a_Y8bnSn.mjs → impl-DhXzxQDN2.mjs} +5 -5
  152. package/dist/impl-DhXzxQDN2.mjs.map +1 -0
  153. package/dist/impl-DiwxYcux.mjs +2 -0
  154. package/dist/{impl-BKmibZoG.mjs.map → impl-DiwxYcux.mjs.map} +1 -1
  155. package/dist/{impl-p_M16BEd.mjs → impl-Do2TNA3-.mjs} +2 -2
  156. package/dist/{impl-p_M16BEd.mjs.map → impl-Do2TNA3-.mjs.map} +1 -1
  157. package/dist/{impl-DaH1_ZzK.mjs → impl-DqHEIzpj.mjs} +2 -2
  158. package/dist/{impl-DaH1_ZzK.mjs.map → impl-DqHEIzpj.mjs.map} +1 -1
  159. package/dist/{impl-GH9uVaGu.mjs → impl-Dr_l_SLd.mjs} +2 -2
  160. package/dist/{impl-GH9uVaGu.mjs.map → impl-Dr_l_SLd.mjs.map} +1 -1
  161. package/dist/{impl-Dt5Iik_-.mjs → impl-Ds-gQfdc.mjs} +2 -2
  162. package/dist/{impl-Dt5Iik_-.mjs.map → impl-Ds-gQfdc.mjs.map} +1 -1
  163. package/dist/{impl-CJML1Gwo.mjs → impl-DtnYcktN.mjs} +2 -2
  164. package/dist/{impl-CJML1Gwo.mjs.map → impl-DtnYcktN.mjs.map} +1 -1
  165. package/dist/impl-DtpgD_as.mjs +2 -0
  166. package/dist/{impl-DWD4fAPO.mjs.map → impl-DtpgD_as.mjs.map} +1 -1
  167. package/dist/{impl-CL0y3SFr.mjs → impl-DxQ9yj3H.mjs} +2 -2
  168. package/dist/{impl-CL0y3SFr.mjs.map → impl-DxQ9yj3H.mjs.map} +1 -1
  169. package/dist/impl-FerHBNJx2.mjs +4 -0
  170. package/dist/{impl-BFn-S-Wy2.mjs.map → impl-FerHBNJx2.mjs.map} +1 -1
  171. package/dist/{impl-Cs1z9k1h2.mjs → impl-HUfaARep.mjs} +2 -2
  172. package/dist/impl-HUfaARep.mjs.map +1 -0
  173. package/dist/impl-btKJ1-VJ.mjs +3 -0
  174. package/dist/impl-btKJ1-VJ.mjs.map +1 -0
  175. package/dist/impl-eeS2lVi5.mjs +2 -0
  176. package/dist/impl-eeS2lVi5.mjs.map +1 -0
  177. package/dist/impl-iD6Fknfe.mjs +2 -0
  178. package/dist/impl-iD6Fknfe.mjs.map +1 -0
  179. package/dist/impl-ijoNwhGI.mjs +2 -0
  180. package/dist/impl-ijoNwhGI.mjs.map +1 -0
  181. package/dist/{impl-C83WRl40.mjs → impl-vmLq6HCI.mjs} +2 -2
  182. package/dist/{impl-C83WRl40.mjs.map → impl-vmLq6HCI.mjs.map} +1 -1
  183. package/dist/{impl-C8vx7N5j.mjs → impl-wBcVYHlA.mjs} +2 -2
  184. package/dist/{impl-C8vx7N5j.mjs.map → impl-wBcVYHlA.mjs.map} +1 -1
  185. package/dist/index.d.mts +2 -2
  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-B5JCHcqh.mjs → markRequestDataSiloIdsCompleted-BYNMCkhy.mjs} +2 -2
  201. package/dist/{markRequestDataSiloIdsCompleted-B5JCHcqh.mjs.map → markRequestDataSiloIdsCompleted-BYNMCkhy.mjs.map} +1 -1
  202. package/dist/{markSilentPrivacyRequests-BAIZ97iB.mjs → markSilentPrivacyRequests-gKYivzH1.mjs} +2 -2
  203. package/dist/{markSilentPrivacyRequests-BAIZ97iB.mjs.map → markSilentPrivacyRequests-gKYivzH1.mjs.map} +1 -1
  204. package/dist/{mergeTranscendInputs-DFQcbh8b.mjs → mergeTranscendInputs-D1CvxQu0.mjs} +2 -2
  205. package/dist/{mergeTranscendInputs-DFQcbh8b.mjs.map → mergeTranscendInputs-D1CvxQu0.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-C2lUoWKP.mjs → notifyPrivacyRequestsAdditionalTime-DbERhQ1Q.mjs} +2 -2
  211. package/dist/{notifyPrivacyRequestsAdditionalTime-C2lUoWKP.mjs.map → notifyPrivacyRequestsAdditionalTime-DbERhQ1Q.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-BZnBMZQq.mjs +7 -0
  221. package/dist/policy-bundle-manifest-BZnBMZQq.mjs.map +1 -0
  222. package/dist/policy-project-discovery-C29UxWwt.mjs +427 -0
  223. package/dist/policy-project-discovery-C29UxWwt.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-BUKAyPad.mjs +76 -0
  227. package/dist/policy-scaffold-config-BUKAyPad.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-CHe3nRN4.mjs → printResult-C2K9ODeE.mjs} +3 -3
  231. package/dist/printResult-C2K9ODeE.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-Bm-Orhse.mjs} +2 -2
  243. package/dist/{pullAllDatapoints-uk5ggk6O.mjs.map → pullAllDatapoints-Bm-Orhse.mjs.map} +1 -1
  244. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-BmhJiquf.mjs → pullChunkedCustomSiloOutstandingIdentifiers-DTGQOw--.mjs} +2 -2
  245. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-BmhJiquf.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-DTGQOw--.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-BbQc9MDM.mjs → pullManualEnrichmentIdentifiersToCsv-DMC5CQtE.mjs} +2 -2
  249. package/dist/{pullManualEnrichmentIdentifiersToCsv-BbQc9MDM.mjs.map → pullManualEnrichmentIdentifiersToCsv-DMC5CQtE.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-Cfo2GibV.mjs → pushCronIdentifiersFromCsv-DhS2z8IG.mjs} +2 -2
  255. package/dist/{pushCronIdentifiersFromCsv-Cfo2GibV.mjs.map → pushCronIdentifiersFromCsv-DhS2z8IG.mjs.map} +1 -1
  256. package/dist/{pushManualEnrichmentIdentifiersFromCsv-DokcIxh1.mjs → pushManualEnrichmentIdentifiersFromCsv-BTJGOmdU.mjs} +2 -2
  257. package/dist/{pushManualEnrichmentIdentifiersFromCsv-DokcIxh1.mjs.map → pushManualEnrichmentIdentifiersFromCsv-BTJGOmdU.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-p4gFagI0.mjs → removeUnverifiedRequestIdentifiers-BkAcUZZN.mjs} +2 -2
  263. package/dist/{removeUnverifiedRequestIdentifiers-p4gFagI0.mjs.map → removeUnverifiedRequestIdentifiers-BkAcUZZN.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-qXZBrUz_.mjs → resolveBundleIdByName-Dm_o5_bg.mjs} +2 -2
  269. package/dist/{resolveBundleIdByName-qXZBrUz_.mjs.map → resolveBundleIdByName-Dm_o5_bg.mjs.map} +1 -1
  270. package/dist/{resolvePolicyBundleVersion-BG7XqBBP.mjs → resolvePolicyBundleVersion-DRUwe7fA.mjs} +2 -2
  271. package/dist/{resolvePolicyBundleVersion-BG7XqBBP.mjs.map → resolvePolicyBundleVersion-DRUwe7fA.mjs.map} +1 -1
  272. package/dist/{retryRequestDataSilos-C6mvi-ET.mjs → retryRequestDataSilos-BoPmcB8-.mjs} +2 -2
  273. package/dist/{retryRequestDataSilos-C6mvi-ET.mjs.map → retryRequestDataSilos-BoPmcB8-.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-CgUcTgzf.mjs → skipPreflightJobs-DkBdYw-r.mjs} +2 -2
  285. package/dist/{skipPreflightJobs-CgUcTgzf.mjs.map → skipPreflightJobs-DkBdYw-r.mjs.map} +1 -1
  286. package/dist/{skipRequestDataSilos-Be-6OhWe.mjs → skipRequestDataSilos-BRFiokix.mjs} +2 -2
  287. package/dist/{skipRequestDataSilos-Be-6OhWe.mjs.map → skipRequestDataSilos-BRFiokix.mjs.map} +1 -1
  288. package/dist/{streamPrivacyRequestsToCsv-BaeFrrGF.mjs → streamPrivacyRequestsToCsv-Bt-H5J-y.mjs} +2 -2
  289. package/dist/{streamPrivacyRequestsToCsv-BaeFrrGF.mjs.map → streamPrivacyRequestsToCsv-Bt-H5J-y.mjs.map} +1 -1
  290. package/dist/{syncCodePackages-BHE2Tn1Q.mjs → syncCodePackages-CPkEukDm.mjs} +2 -2
  291. package/dist/{syncCodePackages-BHE2Tn1Q.mjs.map → syncCodePackages-CPkEukDm.mjs.map} +1 -1
  292. package/dist/{updateConsentManagerVersionToLatest-3mQX2U8F.mjs → updateConsentManagerVersionToLatest-DWblAwus.mjs} +2 -2
  293. package/dist/{updateConsentManagerVersionToLatest-3mQX2U8F.mjs.map → updateConsentManagerVersionToLatest-DWblAwus.mjs.map} +1 -1
  294. package/dist/{uploadConsents-Dnbtx9P5.mjs → uploadConsents-D7Vg8ZRW.mjs} +2 -2
  295. package/dist/{uploadConsents-Dnbtx9P5.mjs.map → uploadConsents-D7Vg8ZRW.mjs.map} +1 -1
  296. package/dist/{uploadPrivacyRequestsFromCsv-BIW2JPjA.mjs → uploadPrivacyRequestsFromCsv-B_hQwIn6.mjs} +2 -2
  297. package/dist/{uploadPrivacyRequestsFromCsv-BIW2JPjA.mjs.map → uploadPrivacyRequestsFromCsv-B_hQwIn6.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 +6 -5
  303. package/dist/app-D-IPyX64.mjs +0 -148
  304. package/dist/app-D-IPyX64.mjs.map +0 -1
  305. package/dist/command-Ddx7b9ik.mjs +0 -9
  306. package/dist/command-Ddx7b9ik.mjs.map +0 -1
  307. package/dist/constants-XH8NIJGC.mjs +0 -2
  308. package/dist/deno-runtime-DV52X8-P.mjs +0 -2
  309. package/dist/deno-runtime-DV52X8-P.mjs.map +0 -1
  310. package/dist/impl--JGnR3wp.mjs +0 -3
  311. package/dist/impl-7UqkSO3x2.mjs +0 -2
  312. package/dist/impl-7UqkSO3x2.mjs.map +0 -1
  313. package/dist/impl-B4BgGuF_.mjs +0 -3
  314. package/dist/impl-B4BgGuF_.mjs.map +0 -1
  315. package/dist/impl-BFn-S-Wy2.mjs +0 -4
  316. package/dist/impl-BKmibZoG.mjs +0 -2
  317. package/dist/impl-C6HtWd1t.mjs +0 -2
  318. package/dist/impl-C6HtWd1t.mjs.map +0 -1
  319. package/dist/impl-CO4ZqlLV.mjs +0 -3
  320. package/dist/impl-CO4ZqlLV.mjs.map +0 -1
  321. package/dist/impl-COujMWgp.mjs.map +0 -1
  322. package/dist/impl-CUOVJsRg.mjs +0 -3
  323. package/dist/impl-CUOVJsRg.mjs.map +0 -1
  324. package/dist/impl-CUiYbk6G.mjs +0 -3
  325. package/dist/impl-CUiYbk6G.mjs.map +0 -1
  326. package/dist/impl-CbAvM_1J.mjs +0 -2
  327. package/dist/impl-CbAvM_1J.mjs.map +0 -1
  328. package/dist/impl-CfvxD3RI.mjs.map +0 -1
  329. package/dist/impl-Cli2XRp02.mjs +0 -2
  330. package/dist/impl-Cli2XRp02.mjs.map +0 -1
  331. package/dist/impl-Cs1z9k1h2.mjs.map +0 -1
  332. package/dist/impl-DB8Kt2qF2.mjs.map +0 -1
  333. package/dist/impl-DHQh34Eh2.mjs +0 -303
  334. package/dist/impl-DHQh34Eh2.mjs.map +0 -1
  335. package/dist/impl-DN6CgOI6.mjs +0 -2
  336. package/dist/impl-DN6CgOI6.mjs.map +0 -1
  337. package/dist/impl-DPtx5iZO.mjs +0 -5
  338. package/dist/impl-DWD4fAPO.mjs +0 -2
  339. package/dist/impl-DXRDWiB1.mjs +0 -2
  340. package/dist/impl-DXRDWiB1.mjs.map +0 -1
  341. package/dist/impl-DdIa0zla.mjs +0 -2
  342. package/dist/impl-DdIa0zla.mjs.map +0 -1
  343. package/dist/impl-DryC3OJu.mjs +0 -2
  344. package/dist/impl-DryC3OJu.mjs.map +0 -1
  345. package/dist/impl-DxnrCWeR2.mjs.map +0 -1
  346. package/dist/impl-DzUTmaID2.mjs.map +0 -1
  347. package/dist/impl-H9kweQnu2.mjs.map +0 -1
  348. package/dist/impl-Z8oWVENM.mjs +0 -2
  349. package/dist/impl-Z8oWVENM.mjs.map +0 -1
  350. package/dist/impl-a_Y8bnSn.mjs.map +0 -1
  351. package/dist/impl-v_P8hszk2.mjs.map +0 -1
  352. package/dist/logger-zplFSeXU.mjs +0 -2
  353. package/dist/logger-zplFSeXU.mjs.map +0 -1
  354. package/dist/manifest-BNIpO_zW.mjs +0 -2
  355. package/dist/manifest-BNIpO_zW.mjs.map +0 -1
  356. package/dist/missing-manifest-DgcukXfg.mjs +0 -2
  357. package/dist/missing-manifest-DgcukXfg.mjs.map +0 -1
  358. package/dist/path-safety-D5Qwl40b.mjs +0 -2
  359. package/dist/path-safety-D5Qwl40b.mjs.map +0 -1
  360. package/dist/policy-bundle-manifest-D6dkbjNi.mjs +0 -7
  361. package/dist/policy-bundle-manifest-D6dkbjNi.mjs.map +0 -1
  362. package/dist/printResult-CHe3nRN4.mjs.map +0 -1
  363. package/dist/project-plan-apply-Dvndx455.mjs +0 -3
  364. package/dist/prompts-ClBXdELk.mjs +0 -4
  365. package/dist/prompts-ClBXdELk.mjs.map +0 -1
  366. package/dist/scaffold-model-BAbYTR0q.mjs.map +0 -1
  367. package/dist/validateTranscendAuth-D6Wr1cxY.mjs +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"impl-C5Mq4wv0.mjs","names":[],"sources":["../src/commands/consent/pull-consent-metrics/impl.ts"],"sourcesContent":["import path from 'node:path';\n\nimport { ConsentManagerMetricBin } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport { map, mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { pullConsentManagerMetrics } from '../../../lib/consent-manager/index.js';\nimport { writeCsv } from '../../../lib/helpers/index.js';\n\nexport interface PullConsentMetricsCommandFlags {\n auth: string;\n start: Date;\n end?: Date;\n folder: string;\n bin: string;\n transcendUrl: string;\n}\n\nexport async function pullConsentMetrics(\n this: LocalContext,\n { auth, start, end, folder, bin, transcendUrl }: PullConsentMetricsCommandFlags,\n): Promise<void> {\n // Validate bin\n const parsedBin = bin as ConsentManagerMetricBin;\n if (!Object.values(ConsentManagerMetricBin).includes(parsedBin)) {\n this.logger.error(\n colors.red(\n `Failed to parse argument \"bin\" with value \"${bin}\"\\n` +\n `Expected one of: \\n${Object.values(ConsentManagerMetricBin).join('\\n')}`,\n ),\n );\n this.process.exit(1);\n }\n\n // Parse the dates\n const startDate = new Date(start);\n const endDate = end ? new Date(end) : new Date();\n if (Number.isNaN(startDate.getTime())) {\n this.logger.error(\n colors.red(\n `Start date provided is invalid date. Got --start=\"${start}\" expected --start=\"01/01/2023\"`,\n ),\n );\n this.process.exit(1);\n }\n if (Number.isNaN(endDate.getTime())) {\n this.logger.error(\n colors.red(\n `End date provided is invalid date. Got --end=\"${end}\" expected --end=\"01/01/2023\"`,\n ),\n );\n this.process.exit(1);\n }\n if (startDate > endDate) {\n this.logger.error(\n colors.red(\n `Got a start date \"${startDate.toISOString()}\" that was larger than the end date \"${endDate.toISOString()}\". ` +\n 'Start date must be before end date.',\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth, this);\n\n // Ensure folder either does not exist or is not a file\n if (this.fs.existsSync(folder) && !this.fs.lstatSync(folder).isDirectory()) {\n this.logger.error(\n colors.red(\n 'The provided argument \"folder\" was passed a file. expected: folder=\"./consent-metrics/\"',\n ),\n );\n this.process.exit(1);\n }\n\n // Create the folder if it does not exist\n if (!this.fs.existsSync(folder)) {\n this.fs.mkdirSync(folder);\n }\n\n this.logger.info(\n colors.magenta(\n `Pulling consent metrics from start=${startDate.toString()} to end=${endDate.toISOString()} with bin size \"${bin}\"`,\n ),\n );\n\n // Sync to Disk\n if (typeof apiKeyOrList === 'string') {\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKeyOrList);\n\n // Pull the metrics\n const configuration = await pullConsentManagerMetrics(client, {\n bin: parsedBin,\n start: startDate,\n end: endDate,\n });\n\n // Write to file\n await map(\n Object.entries(configuration),\n async ([metricName, metrics]) => {\n await map(\n metrics,\n async ({ points, name }) => {\n const file = path.join(folder, `${metricName}_${name}.csv`);\n this.logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n await writeCsv(\n file,\n points.map(({ key, value }: { key: string; value: string }) => ({\n timestamp: key,\n value,\n })),\n );\n },\n {\n concurrency: 5,\n },\n );\n },\n { concurrency: 5 },\n );\n } catch (err) {\n this.logger.error(colors.red(`An error occurred syncing the schema: ${err.message}`));\n this.process.exit(1);\n }\n\n // Indicate success\n this.logger.info(\n colors.green(\n `Successfully synced consent metrics to disk in folder \"${folder}\"! View at ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n } else {\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${apiKey.organizationName}] `;\n this.logger.info(\n colors.magenta(`~~~\\n\\n${prefix}Attempting to pull consent metrics...\\n\\n~~~`),\n );\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKey.apiKey);\n\n try {\n const configuration = await pullConsentManagerMetrics(client, {\n bin: parsedBin,\n start: startDate,\n end: endDate,\n });\n\n // ensure folder exists for that organization\n const subFolder = path.join(folder, apiKey.organizationName);\n if (!this.fs.existsSync(subFolder)) {\n this.fs.mkdirSync(subFolder);\n }\n\n // Write to file\n Object.entries(configuration).forEach(([metricName, metrics]) => {\n metrics.forEach(({ points, name }) => {\n const file = path.join(subFolder, `${metricName}_${name}.csv`);\n this.logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n writeCsv(\n file,\n points.map(({ key, value }: { key: string; value: string }) => ({\n timestamp: key,\n value,\n })),\n );\n });\n });\n\n this.logger.info(colors.green(`${prefix}Successfully pulled configuration!`));\n } catch (err) {\n this.logger.error(colors.red(`${prefix}Failed to sync configuration.`), err);\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n this.logger.info(\n colors.red(\n `Sync encountered errors for \"${encounteredErrors.join(\n ',',\n )}\". View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n }\n}\n"],"mappings":"sfAuBA,eAAsB,EAEpB,CAAE,OAAM,QAAO,MAAK,SAAQ,MAAK,gBAClB,CAEf,IAAM,EAAY,EACb,OAAO,OAAO,EAAwB,CAAC,SAAS,EAAU,GAC7D,KAAK,OAAO,MACV,EAAO,IACL,8CAA8C,EAAI,wBAC1B,OAAO,OAAO,EAAwB,CAAC,KAAK;EAAK,GAC1E,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAItB,IAAM,EAAY,IAAI,KAAK,EAAM,CAC3B,EAAU,EAAM,IAAI,KAAK,EAAI,CAAG,IAAI,KACtC,OAAO,MAAM,EAAU,SAAS,CAAC,GACnC,KAAK,OAAO,MACV,EAAO,IACL,qDAAqD,EAAM,iCAC5D,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAElB,OAAO,MAAM,EAAQ,SAAS,CAAC,GACjC,KAAK,OAAO,MACV,EAAO,IACL,iDAAiD,EAAI,+BACtD,CACF,CACD,KA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sourcesContent":["import path from 'node:path';\n\nimport { ConsentManagerMetricBin } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport { map, mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { pullConsentManagerMetrics } from '../../../lib/consent-manager/index.js';\nimport { writeCsv } from '../../../lib/helpers/index.js';\n\nexport interface PullConsentMetricsCommandFlags {\n auth: string;\n start: Date;\n end?: Date;\n folder: string;\n bin: string;\n transcendUrl: string;\n}\n\nexport async function pullConsentMetrics(\n this: LocalContext,\n { auth, start, end, folder, bin, transcendUrl }: PullConsentMetricsCommandFlags,\n): Promise<void> {\n // Validate bin\n const parsedBin = bin as ConsentManagerMetricBin;\n if (!Object.values(ConsentManagerMetricBin).includes(parsedBin)) {\n this.logger.error(\n colors.red(\n `Failed to parse argument \"bin\" with value \"${bin}\"\\n` +\n `Expected one of: \\n${Object.values(ConsentManagerMetricBin).join('\\n')}`,\n ),\n );\n this.process.exit(1);\n }\n\n // Parse the dates\n const startDate = new Date(start);\n const endDate = end ? new Date(end) : new Date();\n if (Number.isNaN(startDate.getTime())) {\n this.logger.error(\n colors.red(\n `Start date provided is invalid date. Got --start=\"${start}\" expected --start=\"01/01/2023\"`,\n ),\n );\n this.process.exit(1);\n }\n if (Number.isNaN(endDate.getTime())) {\n this.logger.error(\n colors.red(\n `End date provided is invalid date. Got --end=\"${end}\" expected --end=\"01/01/2023\"`,\n ),\n );\n this.process.exit(1);\n }\n if (startDate > endDate) {\n this.logger.error(\n colors.red(\n `Got a start date \"${startDate.toISOString()}\" that was larger than the end date \"${endDate.toISOString()}\". ` +\n 'Start date must be before end date.',\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth, this);\n\n // Ensure folder either does not exist or is not a file\n if (this.fs.existsSync(folder) && !this.fs.lstatSync(folder).isDirectory()) {\n this.logger.error(\n colors.red(\n 'The provided argument \"folder\" was passed a file. expected: folder=\"./consent-metrics/\"',\n ),\n );\n this.process.exit(1);\n }\n\n // Create the folder if it does not exist\n if (!this.fs.existsSync(folder)) {\n this.fs.mkdirSync(folder);\n }\n\n this.logger.info(\n colors.magenta(\n `Pulling consent metrics from start=${startDate.toString()} to end=${endDate.toISOString()} with bin size \"${bin}\"`,\n ),\n );\n\n // Sync to Disk\n if (typeof apiKeyOrList === 'string') {\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKeyOrList);\n\n // Pull the metrics\n const configuration = await pullConsentManagerMetrics(client, {\n bin: parsedBin,\n start: startDate,\n end: endDate,\n });\n\n // Write to file\n await map(\n Object.entries(configuration),\n async ([metricName, metrics]) => {\n await map(\n metrics,\n async ({ points, name }) => {\n const file = path.join(folder, `${metricName}_${name}.csv`);\n this.logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n await writeCsv(\n file,\n points.map(({ key, value }: { key: string; value: string }) => ({\n timestamp: key,\n value,\n })),\n );\n },\n {\n concurrency: 5,\n },\n );\n },\n { concurrency: 5 },\n );\n } catch (err) {\n this.logger.error(colors.red(`An error occurred syncing the schema: ${err.message}`));\n this.process.exit(1);\n }\n\n // Indicate success\n this.logger.info(\n colors.green(\n `Successfully synced consent metrics to disk in folder \"${folder}\"! View at ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n } else {\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${apiKey.organizationName}] `;\n this.logger.info(\n colors.magenta(`~~~\\n\\n${prefix}Attempting to pull consent metrics...\\n\\n~~~`),\n );\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKey.apiKey);\n\n try {\n const configuration = await pullConsentManagerMetrics(client, {\n bin: parsedBin,\n start: startDate,\n end: endDate,\n });\n\n // ensure folder exists for that organization\n const subFolder = path.join(folder, apiKey.organizationName);\n if (!this.fs.existsSync(subFolder)) {\n this.fs.mkdirSync(subFolder);\n }\n\n // Write to file\n Object.entries(configuration).forEach(([metricName, metrics]) => {\n metrics.forEach(({ points, name }) => {\n const file = path.join(subFolder, `${metricName}_${name}.csv`);\n this.logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n writeCsv(\n file,\n points.map(({ key, value }: { key: string; value: string }) => ({\n timestamp: key,\n value,\n })),\n );\n });\n });\n\n this.logger.info(colors.green(`${prefix}Successfully pulled configuration!`));\n } catch (err) {\n this.logger.error(colors.red(`${prefix}Failed to sync configuration.`), err);\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n this.logger.info(\n colors.red(\n `Sync encountered errors for \"${encounteredErrors.join(\n ',',\n )}\". View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n }\n}\n"],"mappings":"sfAuBA,eAAsB,EAEpB,CAAE,OAAM,QAAO,MAAK,SAAQ,MAAK,gBAClB,CAEf,IAAM,EAAY,EACb,OAAO,OAAO,EAAwB,CAAC,SAAS,EAAU,GAC7D,KAAK,OAAO,MACV,EAAO,IACL,8CAA8C,EAAI,wBAC1B,OAAO,OAAO,EAAwB,CAAC,KAAK;EAAK,GAC1E,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAItB,IAAM,EAAY,IAAI,KAAK,EAAM,CAC3B,EAAU,EAAM,IAAI,KAAK,EAAI,CAAG,IAAI,KACtC,OAAO,MAAM,EAAU,SAAS,CAAC,GACnC,KAAK,OAAO,MACV,EAAO,IACL,qDAAqD,EAAM,iCAC5D,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAElB,OAAO,MAAM,EAAQ,SAAS,CAAC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+1,2 @@
1
- import{r as e}from"./constants-XH8NIJGC.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-CGioITgZ.mjs.map
1
+ import{r as e}from"./constants-BRsj50Nb.mjs";import{r as t}from"./readTranscendYaml-BfqQbPiT.mjs";import{n,t as r}from"./mergeTranscendInputs-D1CvxQu0.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{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-D1UogVAq.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-CGioITgZ.mjs","names":[],"sources":["../src/commands/inventory/push/impl.ts"],"sourcesContent":["import path from 'node:path';\n\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport { mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { TranscendInput } from '../../../codecs.js';\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth, filterFileNames } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { syncConfigurationToTranscend } from '../../../lib/graphql/index.js';\nimport { parseVariablesFromString } from '../../../lib/helpers/parseVariablesFromString.js';\nimport { mergeTranscendInputs } from '../../../lib/mergeTranscendInputs.js';\nimport { parseTranscendYaml } from '../../../lib/readTranscendYaml.js';\n\n/**\n * Sync configuration to Transcend\n *\n * @param options - Options\n * @returns True if synced successfully, false if error occurs\n */\nasync function syncConfiguration({\n transcendUrl,\n auth,\n pageSize,\n publishToPrivacyCenter,\n contents,\n deleteExtraAttributeValues = false,\n classifyService = false,\n logger,\n}: {\n /** Transcend YAML */\n contents: TranscendInput;\n /** Transcend URL */\n transcendUrl: string;\n /** API key */\n auth: string;\n /** Page size */\n pageSize: number;\n /** Skip privacy center publish step */\n publishToPrivacyCenter: boolean;\n /** classify data flow service if missing */\n classifyService?: boolean;\n /** Delete attributes when syncing */\n deleteExtraAttributeValues?: boolean;\n /** Logger for reporting sync progress and errors */\n logger: LocalContext['logger'];\n}): Promise<boolean> {\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Sync to Transcend\n try {\n const result = await syncConfigurationToTranscend(contents, client, {\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n logger,\n });\n if (!result.success) {\n result.errors.forEach(({ resource, item, message }) => {\n logger.error(\n colors.red(`Failed to sync ${resource}${item ? ` \"${item}\"` : ''}: ${message}`),\n );\n });\n }\n return result.success;\n } catch (err) {\n logger.error(colors.red(`An unexpected error occurred syncing the schema: ${err.message}`));\n return false;\n }\n}\n\nexport interface PushCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n pageSize: number;\n variables: string;\n publishToPrivacyCenter: boolean;\n classifyService: boolean;\n deleteExtraAttributeValues: boolean;\n}\n\nexport async function push(\n this: LocalContext,\n {\n file = './transcend.yml',\n transcendUrl,\n auth,\n variables,\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n }: PushCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth, this);\n\n const vars = parseVariablesFromString(variables);\n\n // check if we are being passed a list of API keys and a list of files\n let fileList: string[];\n if (Array.isArray(apiKeyOrList) && this.fs.lstatSync(file).isDirectory()) {\n fileList = filterFileNames(this.fs.readdirSync(file)).map((filePath) =>\n path.join(file, filePath),\n );\n } else {\n fileList = file.split(',');\n }\n\n // Ensure at least one file is parsed\n if (fileList.length < 1) {\n throw new Error('No file specified!');\n }\n\n // eslint-disable-next-line array-callback-return,consistent-return\n const transcendInputs = fileList.map((filePath) => {\n // Ensure yaml file exists on disk\n if (!this.fs.existsSync(filePath)) {\n this.logger.error(\n colors.red(\n `The file path does not exist on disk: ${filePath}. You can specify the filepath using --file=./examples/transcend.yml`,\n ),\n );\n this.process.exit(1);\n } else {\n this.logger.info(colors.magenta(`Reading file \"${filePath}\"...`));\n }\n\n try {\n // Read in the yaml file and validate it's shape\n const newContents = parseTranscendYaml(\n this.fs.readFileSync(filePath, 'utf8'),\n vars,\n filePath,\n );\n this.logger.info(colors.green(`Successfully read in \"${filePath}\"`));\n return {\n content: newContents,\n name: filePath.split('/').pop()!.replace('.yml', ''),\n };\n } catch (err) {\n this.logger.error(\n colors.red(\n `The shape of your yaml file is invalid with the following errors: ${err.message}`,\n ),\n );\n this.process.exit(1);\n }\n });\n\n // process a single API key\n if (typeof apiKeyOrList === 'string') {\n // if passed multiple inputs, merge them together\n const [base, ...rest] = transcendInputs.map(({ content }) => content);\n const contents = mergeTranscendInputs(base, ...rest);\n\n // sync the configuration\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKeyOrList,\n contents,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n pageSize,\n classifyService: !!classifyService,\n logger: this.logger,\n });\n\n // exist with error code\n if (!success) {\n this.logger.info(\n colors.red(\n `Sync encountered errors. View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n } else {\n // if passed multiple inputs, expect them to be one per instance\n if (transcendInputs.length !== 1 && transcendInputs.length !== apiKeyOrList.length) {\n throw new Error(\n 'Expected list of yml files to be equal to the list of API keys.' +\n `Got ${transcendInputs.length} YML file${\n transcendInputs.length === 1 ? '' : 's'\n } and ${apiKeyOrList.length} API key${apiKeyOrList.length === 1 ? '' : 's'}`,\n );\n }\n\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${apiKey.organizationName}] `;\n this.logger.info(\n colors.magenta(`~~~\\n\\n${prefix}Attempting to push configuration...\\n\\n~~~`),\n );\n\n // use the merged contents if 1 yml passed, else use the contents that map to that organization\n const useContents =\n transcendInputs.length === 1\n ? transcendInputs[0].content\n : transcendInputs.find((input) => input.name === apiKey.organizationName)?.content;\n\n // Throw error if cannot find a yml file matching that organization name\n if (!useContents) {\n this.logger.error(\n colors.red(\n `${prefix}Failed to find transcend.yml file for organization: \"${apiKey.organizationName}\".`,\n ),\n );\n encounteredErrors.push(apiKey.organizationName);\n return;\n }\n\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKey.apiKey,\n contents: useContents,\n pageSize,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n classifyService,\n logger: this.logger,\n });\n\n if (success) {\n this.logger.info(colors.green(`${prefix}Successfully pushed configuration!`));\n } else {\n this.logger.error(colors.red(`${prefix}Failed to sync configuration.`));\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n this.logger.info(\n colors.red(\n `Sync encountered errors for \"${encounteredErrors.join(\n ',',\n )}\". View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n }\n\n // Indicate success\n this.logger.info(\n colors.green(`Successfully synced yaml file to Transcend! View at ${ADMIN_DASH_INTEGRATIONS}`),\n );\n}\n"],"mappings":"shBAsBA,eAAe,EAAkB,CAC/B,eACA,OACA,WACA,yBACA,WACA,6BAA6B,GAC7B,kBAAkB,GAClB,UAkBmB,CACnB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAG9D,GAAI,CACF,IAAM,EAAS,MAAM,EAA6B,EAAU,EAAQ,CAClE,WACA,yBACA,kBACA,6BACA,SACD,CAAC,CAQF,OAPK,EAAO,SACV,EAAO,OAAO,SAAS,CAAE,WAAU,OAAM,aAAc,CACrD,EAAO,MACL,EAAO,IAAI,kBAAkB,IAAW,EAAO,KAAK,EAAK,GAAK,GAAG,IAAI,IAAU,CA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CACF,CAED,KAAK,QAAQ,KAAK,EAAE,EAKxB,KAAK,OAAO,KACV,EAAO,MAAM,uDAAuD,IAA0B,CAC/F"}
1
+ {"version":3,"file":"impl-D1UogVAq.mjs","names":[],"sources":["../src/commands/inventory/push/impl.ts"],"sourcesContent":["import path from 'node:path';\n\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport { mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { TranscendInput } from '../../../codecs.js';\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth, filterFileNames } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { syncConfigurationToTranscend } from '../../../lib/graphql/index.js';\nimport { parseVariablesFromString } from '../../../lib/helpers/parseVariablesFromString.js';\nimport { mergeTranscendInputs } from '../../../lib/mergeTranscendInputs.js';\nimport { parseTranscendYaml } from '../../../lib/readTranscendYaml.js';\n\n/**\n * Sync configuration to Transcend\n *\n * @param options - Options\n * @returns True if synced successfully, false if error occurs\n */\nasync function syncConfiguration({\n transcendUrl,\n auth,\n pageSize,\n publishToPrivacyCenter,\n contents,\n deleteExtraAttributeValues = false,\n classifyService = false,\n logger,\n}: {\n /** Transcend YAML */\n contents: TranscendInput;\n /** Transcend URL */\n transcendUrl: string;\n /** API key */\n auth: string;\n /** Page size */\n pageSize: number;\n /** Skip privacy center publish step */\n publishToPrivacyCenter: boolean;\n /** classify data flow service if missing */\n classifyService?: boolean;\n /** Delete attributes when syncing */\n deleteExtraAttributeValues?: boolean;\n /** Logger for reporting sync progress and errors */\n logger: LocalContext['logger'];\n}): Promise<boolean> {\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Sync to Transcend\n try {\n const result = await syncConfigurationToTranscend(contents, client, {\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n logger,\n });\n if (!result.success) {\n result.errors.forEach(({ resource, item, message }) => {\n logger.error(\n colors.red(`Failed to sync ${resource}${item ? ` \"${item}\"` : ''}: ${message}`),\n );\n });\n }\n return result.success;\n } catch (err) {\n logger.error(colors.red(`An unexpected error occurred syncing the schema: ${err.message}`));\n return false;\n }\n}\n\nexport interface PushCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n pageSize: number;\n variables: string;\n publishToPrivacyCenter: boolean;\n classifyService: boolean;\n deleteExtraAttributeValues: boolean;\n}\n\nexport async function push(\n this: LocalContext,\n {\n file = './transcend.yml',\n transcendUrl,\n auth,\n variables,\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n }: PushCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth, this);\n\n const vars = parseVariablesFromString(variables);\n\n // check if we are being passed a list of API keys and a list of files\n let fileList: string[];\n if (Array.isArray(apiKeyOrList) && this.fs.lstatSync(file).isDirectory()) {\n fileList = filterFileNames(this.fs.readdirSync(file)).map((filePath) =>\n path.join(file, filePath),\n );\n } else {\n fileList = file.split(',');\n }\n\n // Ensure at least one file is parsed\n if (fileList.length < 1) {\n throw new Error('No file specified!');\n }\n\n // eslint-disable-next-line array-callback-return,consistent-return\n const transcendInputs = fileList.map((filePath) => {\n // Ensure yaml file exists on disk\n if (!this.fs.existsSync(filePath)) {\n this.logger.error(\n colors.red(\n `The file path does not exist on disk: ${filePath}. You can specify the filepath using --file=./examples/transcend.yml`,\n ),\n );\n this.process.exit(1);\n } else {\n this.logger.info(colors.magenta(`Reading file \"${filePath}\"...`));\n }\n\n try {\n // Read in the yaml file and validate it's shape\n const newContents = parseTranscendYaml(\n this.fs.readFileSync(filePath, 'utf8'),\n vars,\n filePath,\n );\n this.logger.info(colors.green(`Successfully read in \"${filePath}\"`));\n return {\n content: newContents,\n name: filePath.split('/').pop()!.replace('.yml', ''),\n };\n } catch (err) {\n this.logger.error(\n colors.red(\n `The shape of your yaml file is invalid with the following errors: ${err.message}`,\n ),\n );\n this.process.exit(1);\n }\n });\n\n // process a single API key\n if (typeof apiKeyOrList === 'string') {\n // if passed multiple inputs, merge them together\n const [base, ...rest] = transcendInputs.map(({ content }) => content);\n const contents = mergeTranscendInputs(base, ...rest);\n\n // sync the configuration\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKeyOrList,\n contents,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n pageSize,\n classifyService: !!classifyService,\n logger: this.logger,\n });\n\n // exist with error code\n if (!success) {\n this.logger.info(\n colors.red(\n `Sync encountered errors. View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n } else {\n // if passed multiple inputs, expect them to be one per instance\n if (transcendInputs.length !== 1 && transcendInputs.length !== apiKeyOrList.length) {\n throw new Error(\n 'Expected list of yml files to be equal to the list of API keys.' +\n `Got ${transcendInputs.length} YML file${\n transcendInputs.length === 1 ? '' : 's'\n } and ${apiKeyOrList.length} API key${apiKeyOrList.length === 1 ? '' : 's'}`,\n );\n }\n\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${apiKey.organizationName}] `;\n this.logger.info(\n colors.magenta(`~~~\\n\\n${prefix}Attempting to push configuration...\\n\\n~~~`),\n );\n\n // use the merged contents if 1 yml passed, else use the contents that map to that organization\n const useContents =\n transcendInputs.length === 1\n ? transcendInputs[0].content\n : transcendInputs.find((input) => input.name === apiKey.organizationName)?.content;\n\n // Throw error if cannot find a yml file matching that organization name\n if (!useContents) {\n this.logger.error(\n colors.red(\n `${prefix}Failed to find transcend.yml file for organization: \"${apiKey.organizationName}\".`,\n ),\n );\n encounteredErrors.push(apiKey.organizationName);\n return;\n }\n\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKey.apiKey,\n contents: useContents,\n pageSize,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n classifyService,\n logger: this.logger,\n });\n\n if (success) {\n this.logger.info(colors.green(`${prefix}Successfully pushed configuration!`));\n } else {\n this.logger.error(colors.red(`${prefix}Failed to sync configuration.`));\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n this.logger.info(\n colors.red(\n `Sync encountered errors for \"${encounteredErrors.join(\n ',',\n )}\". View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n }\n\n // Indicate success\n this.logger.info(\n colors.green(`Successfully synced yaml file to Transcend! View at ${ADMIN_DASH_INTEGRATIONS}`),\n );\n}\n"],"mappings":"shBAsBA,eAAe,EAAkB,CAC/B,eACA,OACA,WACA,yBACA,WACA,6BAA6B,GAC7B,kBAAkB,GAClB,UAkBmB,CACnB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAG9D,GAAI,CACF,IAAM,EAAS,MAAM,EAA6B,EAAU,EAAQ,CAClE,WACA,yBACA,kBACA,6BACA,SACD,CAAC,CAQF,OAPK,EAAO,SACV,EAAO,OAAO,SAAS,CAAE,WAAU,OAAM,aAAc,CACrD,EAAO,MACL,EAAO,IAAI,kBAAkB,IAAW,EAAO,KAAK,EAAK,GAAK,GAAG,IAAI,IAAU,CAChF,EACD,CAEG,EAAO,cACP,EAAK,CAEZ,OADA,EAAO,MAAM,EAAO,IAAI,oDAAoD,EAAI,UAAU,CAAC,CACpF,IAeX,eAAsB,EAEpB,CACE,OAAO,kBACP,eACA,OACA,YACA,WACA,yBACA,kBACA,8BAEa,CACf,EAAoB,KAAK,QAAQ,CAGjC,IAAM,EAAe,MAAM,EAAsB,EAAM,KAAK,CAEtD,EAAO,EAAyB,EAAU,CAG5C,EAUJ,GATA,AAKE,EALE,MAAM,QAAQ,EAAa,EAAI,KAAK,GAAG,UAAU,EAAK,CAAC,aAAa,CAC3D,EAAgB,KAAK,GAAG,YAAY,EAAK,CAAC,CAAC,IAAK,GACzD,EAA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,EAAU,EAAc,MAAO,EAAQ,IAAQ,CACnD,IAAM,EAAS,IAAI,EAAM,EAAE,GAAG,EAAa,OAAO,IAAI,EAAO,iBAAiB,IAC9E,KAAK,OAAO,KACV,EAAO,QAAQ,UAAU,EAAO,4CAA4C,CAC7E,CAGD,IAAM,EACJ,EAAgB,SAAW,EACvB,EAAgB,GAAG,QACnB,EAAgB,KAAM,GAAU,EAAM,OAAS,EAAO,iBAAiB,EAAE,QAG/E,GAAI,CAAC,EAAa,CAChB,KAAK,OAAO,MACV,EAAO,IACL,GAAG,EAAO,uDAAuD,EAAO,iBAAiB,IAC1F,CACF,CACD,EAAkB,KAAK,EAAO,iBAAiB,CAC/C,OAcE,MAXkB,EAAkB,CACtC,eACA,KAAM,EAAO,OACb,SAAU,EACV,WACA,yBACA,6BACA,kBACA,OAAQ,KAAK,OACd,CAAC,CAGA,KAAK,OAAO,KAAK,EAAO,MAAM,GAAG,EAAO,oCAAoC,CAAC,EAE7E,KAAK,OAAO,MAAM,EAAO,IAAI,GAAG,EAAO,+BAA+B,CAAC,CACvE,EAAkB,KAAK,EAAO,iBAAiB,GAEjD,CAEE,EAAkB,OAAS,IAC7B,KAAK,OAAO,KACV,EAAO,IACL,gCAAgC,EAAkB,KAChD,IACD,CAAC,0DAA0D,IAC7D,CACF,CAED,KAAK,QAAQ,KAAK,EAAE,EAKxB,KAAK,OAAO,KACV,EAAO,MAAM,uDAAuD,IAA0B,CAC/F"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./pullManualEnrichmentIdentifiersToCsv-BbQc9MDM.mjs";import{t}from"./done-input-validation-BUz-aVC5.mjs";async function n({auth:n,transcendUrl:r,file:i,concurrency:a,actions:o,sombraAuth:s}){t(this.process),await e({file:i,transcendUrl:r,concurrency:a,requestActions:o,auth:n,sombraAuth:s})}export{n as pullIdentifiers};
2
- //# sourceMappingURL=impl-B37wtYBz.mjs.map
1
+ import{t as e}from"./pullManualEnrichmentIdentifiersToCsv-DMC5CQtE.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";async function n({auth:n,transcendUrl:r,file:i,concurrency:a,actions:o,sombraAuth:s}){t(this.process),await e({file:i,transcendUrl:r,concurrency:a,requestActions:o,auth:n,sombraAuth:s})}export{n as pullIdentifiers};
2
+ //# sourceMappingURL=impl-D1f9mJL_.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-B37wtYBz.mjs","names":[],"sources":["../src/commands/request/preflight/pull-identifiers/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { pullManualEnrichmentIdentifiersToCsv } from '../../../../lib/manual-enrichment/index.js';\n\nexport interface PullIdentifiersCommandFlags {\n auth: string;\n sombraAuth?: string;\n transcendUrl: string;\n file: string;\n actions?: RequestAction[];\n concurrency: number;\n}\n\nexport async function pullIdentifiers(\n this: LocalContext,\n { auth, transcendUrl, file, concurrency, actions, sombraAuth }: PullIdentifiersCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await pullManualEnrichmentIdentifiersToCsv({\n file,\n transcendUrl,\n concurrency,\n requestActions: actions,\n auth,\n sombraAuth,\n });\n}\n"],"mappings":"4HAeA,eAAsB,EAEpB,CAAE,OAAM,eAAc,OAAM,cAAa,UAAS,cACnC,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAqC,CACzC,OACA,eACA,cACA,eAAgB,EAChB,OACA,aACD,CAAC"}
1
+ {"version":3,"file":"impl-D1f9mJL_.mjs","names":[],"sources":["../src/commands/request/preflight/pull-identifiers/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { pullManualEnrichmentIdentifiersToCsv } from '../../../../lib/manual-enrichment/index.js';\n\nexport interface PullIdentifiersCommandFlags {\n auth: string;\n sombraAuth?: string;\n transcendUrl: string;\n file: string;\n actions?: RequestAction[];\n concurrency: number;\n}\n\nexport async function pullIdentifiers(\n this: LocalContext,\n { auth, transcendUrl, file, concurrency, actions, sombraAuth }: PullIdentifiersCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await pullManualEnrichmentIdentifiersToCsv({\n file,\n transcendUrl,\n concurrency,\n requestActions: actions,\n auth,\n sombraAuth,\n });\n}\n"],"mappings":"4HAeA,eAAsB,EAEpB,CAAE,OAAM,eAAc,OAAM,cAAa,UAAS,cACnC,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAqC,CACzC,OACA,eACA,cACA,eAAgB,EAChB,OACA,aACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{l as e}from"./constants-XH8NIJGC.mjs";import{t}from"./generateCrossAccountApiKeys-C1iD6Las.mjs";import{t as n}from"./done-input-validation-BUz-aVC5.mjs";async function r({email:r,password:i,apiKeyTitle:a,file:o,scopes:s,deleteExistingApiKey:c,createNewApiKey:l,parentOrganizationId:u,transcendUrl:d}){n(this.process);let{errors:f,apiKeys:p}=await t({transcendUrl:d,password:i,email:r,parentOrganizationId:u,deleteExistingApiKey:c,createNewApiKey:l,apiKeyTitle:a,scopes:s.map(t=>e[t].name)});this.fs.writeFileSync(o,`${JSON.stringify(p,null,2)}\n`),f.length>0&&this.process.exit(1)}export{r as generateApiKeys};
2
- //# sourceMappingURL=impl-Cl9ndadE.mjs.map
1
+ import{l as e}from"./constants-BRsj50Nb.mjs";import{t}from"./generateCrossAccountApiKeys-pWTrIUE6.mjs";import{t as n}from"./done-input-validation-LiTaCEzF.mjs";async function r({email:r,password:i,apiKeyTitle:a,file:o,scopes:s,deleteExistingApiKey:c,createNewApiKey:l,parentOrganizationId:u,transcendUrl:d}){n(this.process);let{errors:f,apiKeys:p}=await t({transcendUrl:d,password:i,email:r,parentOrganizationId:u,deleteExistingApiKey:c,createNewApiKey:l,apiKeyTitle:a,scopes:s.map(t=>e[t].name)});this.fs.writeFileSync(o,`${JSON.stringify(p,null,2)}\n`),f.length>0&&this.process.exit(1)}export{r as generateApiKeys};
2
+ //# sourceMappingURL=impl-DJcNhpbx.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-Cl9ndadE.mjs","names":[],"sources":["../src/commands/admin/generate-api-keys/impl.ts"],"sourcesContent":["import { ScopeName } from '@transcend-io/privacy-types';\n\nimport { SCOPES_BY_TITLE } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { generateCrossAccountApiKeys } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\n\n// Command flag interface\nexport interface GenerateApiKeysCommandFlags {\n email: string;\n password: string;\n apiKeyTitle: string;\n file: string;\n scopes: string[];\n deleteExistingApiKey: boolean;\n createNewApiKey: boolean;\n parentOrganizationId?: string;\n transcendUrl: string;\n}\n\n// Command implementation\nexport async function generateApiKeys(\n this: LocalContext,\n {\n email,\n password,\n apiKeyTitle,\n file,\n scopes,\n deleteExistingApiKey,\n createNewApiKey,\n parentOrganizationId,\n transcendUrl,\n }: GenerateApiKeysCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n const scopeNames = scopes.map((scopeTitle) => SCOPES_BY_TITLE[scopeTitle].name as ScopeName);\n\n // Upload privacy requests\n const { errors, apiKeys } = await generateCrossAccountApiKeys({\n transcendUrl,\n password,\n email,\n parentOrganizationId,\n deleteExistingApiKey,\n createNewApiKey,\n apiKeyTitle,\n scopes: scopeNames,\n });\n\n // Write to disk\n this.fs.writeFileSync(file, `${JSON.stringify(apiKeys, null, 2)}\\n`);\n if (errors.length > 0) {\n this.process.exit(1);\n }\n}\n"],"mappings":"gKAqBA,eAAsB,EAEpB,CACE,QACA,WACA,cACA,OACA,SACA,uBACA,kBACA,uBACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,CAKjC,GAAM,CAAE,SAAQ,WAAY,MAAM,EAA4B,CAC5D,eACA,WACA,QACA,uBACA,uBACA,kBACA,cACA,OAXiB,EAAO,IAAK,GAAe,EAAgB,GAAY,KAWtD,CACnB,CAAC,CAGF,KAAK,GAAG,cAAc,EAAM,GAAG,KAAK,UAAU,EAAS,KAAM,EAAE,CAAC,IAAI,CAChE,EAAO,OAAS,GAClB,KAAK,QAAQ,KAAK,EAAE"}
1
+ {"version":3,"file":"impl-DJcNhpbx.mjs","names":[],"sources":["../src/commands/admin/generate-api-keys/impl.ts"],"sourcesContent":["import { ScopeName } from '@transcend-io/privacy-types';\n\nimport { SCOPES_BY_TITLE } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { generateCrossAccountApiKeys } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\n\n// Command flag interface\nexport interface GenerateApiKeysCommandFlags {\n email: string;\n password: string;\n apiKeyTitle: string;\n file: string;\n scopes: string[];\n deleteExistingApiKey: boolean;\n createNewApiKey: boolean;\n parentOrganizationId?: string;\n transcendUrl: string;\n}\n\n// Command implementation\nexport async function generateApiKeys(\n this: LocalContext,\n {\n email,\n password,\n apiKeyTitle,\n file,\n scopes,\n deleteExistingApiKey,\n createNewApiKey,\n parentOrganizationId,\n transcendUrl,\n }: GenerateApiKeysCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n const scopeNames = scopes.map((scopeTitle) => SCOPES_BY_TITLE[scopeTitle].name as ScopeName);\n\n // Upload privacy requests\n const { errors, apiKeys } = await generateCrossAccountApiKeys({\n transcendUrl,\n password,\n email,\n parentOrganizationId,\n deleteExistingApiKey,\n createNewApiKey,\n apiKeyTitle,\n scopes: scopeNames,\n });\n\n // Write to disk\n this.fs.writeFileSync(file, `${JSON.stringify(apiKeys, null, 2)}\\n`);\n if (errors.length > 0) {\n this.process.exit(1);\n }\n}\n"],"mappings":"gKAqBA,eAAsB,EAEpB,CACE,QACA,WACA,cACA,OACA,SACA,uBACA,kBACA,uBACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,CAKjC,GAAM,CAAE,SAAQ,WAAY,MAAM,EAA4B,CAC5D,eACA,WACA,QACA,uBACA,uBACA,kBACA,cACA,OAXiB,EAAO,IAAK,GAAe,EAAgB,GAAY,KAWtD,CACnB,CAAC,CAGF,KAAK,GAAG,cAAc,EAAM,GAAG,KAAK,UAAU,EAAS,KAAM,EAAE,CAAC,IAAI,CAChE,EAAO,OAAS,GAClB,KAAK,QAAQ,KAAK,EAAE"}
@@ -0,0 +1,2 @@
1
+ import{i as e}from"./paths-J5KScOaQ.mjs";import{o as t}from"./project-discovery-CWRjlFnC.mjs";import{t as n}from"./parseVariablesFromString-6TYW65LF.mjs";import{t as r}from"./validateTranscendAuth-D-dDINof.mjs";import{t as i}from"./done-input-validation-LiTaCEzF.mjs";import{t as a}from"./missing-manifest-D8y1VL4p.mjs";import{c as o,s,t as c}from"./project-discovery-BkHpTXDx.mjs";import{t as l}from"./command-output-BJcDRXNr.mjs";import{n as u}from"./command-output-BRfF3YFv.mjs";import{CustomFunctionPayloadType as d,CustomFunctionType as f}from"@transcend-io/privacy-types";import p from"colors";import{buildTranscendGraphQLClient as m,createSombraGotInstance as h,fetchAllCustomFunctions as g,resolveEffectiveSombraId as _,resolveExistingCustomFunction as v,syncCustomFunction as y}from"@transcend-io/sdk";import{mapSeries as b}from"@transcend-io/utils";async function x({auth:x,sombraAuth:S,transcendUrl:C,manifest:w,variables:T,dryRun:E,json:D,promote:O,force:k,skipTests:A,updateManifest:j,sombraId:M},N){i(this.process);let P=this.process.cwd(),{manifestDirectory:F,manifestPath:I}=e(P,{...N?{directory:N}:{},...w?{manifest:w}:{}});if(!this.fs.existsSync(I)){let e=a({cwd:P,manifestPath:I,discoveredManifestPaths:c(this,P),command:`push`});this.logger.error(p.red(e)),this.process.exit(1)}let L=r(x,this);Array.isArray(L)&&(this.logger.error(p.red(`transcend custom-functions push does not support a list of API keys — pass a single API key.`)),this.process.exit(1));let R=L,z=l(this.logger,D),B=n(T);z.info(p.magenta(`Reading manifest "${I}"...`));let V=s(I,B,e=>t(this,F,e));z.info(p.green(`Found ${V.length} custom function(s) in "${I}"`));let H=m(C,R),U=await g(H,{logger:z}),W=new Map,G=async(e,t)=>{let n=`${e??``}\u0000${t??``}`,r=W.get(n);if(r)return r;z.info(p.magenta(`Connecting to the ${e?`Sombra gateway "${e}"`:`primary Sombra gateway`} to sign code...`));let i=await h(C,R,{logger:z,sombraApiKey:t,...e?{sombraId:e}:{}});return W.set(n,i),i},K=e=>{if(!e.sombraAuthEnv)return S;let t=this.process.env[e.sombraAuthEnv];if(!t)throw Error(`Custom function "${e.name}" sets sombra-auth-env: ${e.sombraAuthEnv}, but that environment variable is not set. Export it (e.g. from a CI secret) before pushing.`);return t},q=[];if(await b(V,async e=>{try{let t=_(e,v(U,e),M),n=await y(H,{input:e,sombra:E?void 0:await G(t,K(e)),defaultSombraId:M,existing:U,promote:O,dryRun:E,force:k,...!A&&e.testPayloads!==void 0?{testPayloads:e.testPayloads}:{},logger:z});q.push({name:e.name,result:n});let r=n.versionNumber?` (version ${n.versionNumber})`:``,i=n.changedFields.length>0?` [${n.changedFields.join(`, `)}]`:``;switch(n.outcome){case`created`:n.createdDataSilo&&n.dataSiloId&&z.info(p.green(`Created DSR integration (data silo ${n.dataSiloId}) for "${e.name}"`)),z.info(p.green(`Created custom function "${e.name}"${r}`));break;case`updated`:z.info(p.green(`Pushed new revision to "${e.name}"${r}${i}${n.promoted?` and promoted to active`:` as a draft`}`));break;case`metadata-updated`:z.info(p.green(`Updated metadata for "${e.name}"${i} — code unchanged, no new revision`));break;case`skipped`:z.info(p.yellow(`Skipped "${e.name}" — no changes detected (env variable values cannot be diffed; use --force if only values changed)`));break;case`would-create`:z.info(p.cyan(`[dry run] Would create custom function "${e.name}"${e.type===f.Dsr&&!e.dataSiloId?` and its DSR integration (data silo)`:``}`));break;case`would-update`:z.info(p.cyan(`[dry run] Would push a new revision to "${e.name}"${i}`));break;case`test-failed`:{let t=(n.testResults??[]).filter(({passed:e})=>!e);z.error(p.red(`Rejected "${e.name}" — ${t.length} of ${n.testResults?.length??0} test run(s) failed`)),t.forEach(({payloadType:e,result:t})=>{let n=e?`[${e}] `:``;z.error(p.red(` ${n}${t.error?t.error.message:`failed with exit code ${t.exitCode}`}`)),t.logs.forEach(({file:e,message:t})=>{z.error(p.red(` [${e}] ${t}`))})}),n.createdDataSilo&&z.error(p.red(` The DSR integration (data silo) created for "${e.name}" was rolled back.`));break}}if(!A&&(e.testPayloads===void 0||e.testPayloads.length===0)&&(n.outcome===`created`||n.outcome===`updated`)&&z.warn(p.yellow(`Custom function "${e.name}" was pushed without a test run — add a test-payload to its manifest entry to enable test-before-promote.`)),!A&&e.type===f.Dsr&&e.testPayloads!==void 0&&e.testPayloads.length>0&&(n.outcome===`created`||n.outcome===`updated`)){let t=new Set(e.testPayloads.map(({payloadType:e})=>e??d.DataPoint));if(t.size===1){let[n]=t,r=n===d.DataPoint?d.RequestEnricher:d.DataPoint;z.warn(p.yellow(`DSR custom function "${e.name}" only tests its ${n} export — if it also implements the ${r} export, add a test payload with payload-type: ${r} so both entry points are tested on every push.`))}}}catch(t){q.push({name:e.name,error:t}),z.error(p.red(`Failed to sync custom function "${e.name}": ${t.message}`))}}),j&&!E){let e=o(I,V.map((e,t)=>{let n=q[t]?.result;if(!n)return;let r={...!e.id&&n.customFunctionId?{id:n.customFunctionId}:{},...!e.dataSiloId&&n.dataSiloId?{dataSiloId:n.dataSiloId}:{}};return Object.keys(r).length>0?r:void 0}));e>0&&z.info(p.green(`Wrote assigned id(s) back to ${e} manifest entr(ies) in "${I}" — commit this change so future pushes match by ID.`))}let J=u(I,E,q);if(D)this.process.stdout.write(`${JSON.stringify(J)}\n`);else{let{summary:e}=J;z.info(p.magenta(`Custom function sync complete: ${e.created} created, ${e.updated} updated, ${e.metadataUpdated} metadata-only, ${e.skipped} skipped, ${e.rejected} rejected (test failed), ${e.failed} failed${E?` (dry run)`:``}`))}J.status===`failed`&&this.process.exit(1)}export{x as push};
2
+ //# sourceMappingURL=impl-DQG1pMzD2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl-DQG1pMzD2.mjs","names":[],"sources":["../src/commands/custom-functions/push/impl.ts"],"sourcesContent":["import { CustomFunctionPayloadType, CustomFunctionType } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n fetchAllCustomFunctions,\n resolveEffectiveSombraId,\n resolveExistingCustomFunction,\n syncCustomFunction,\n type CustomFunctionSyncResult,\n} from '@transcend-io/sdk';\nimport { mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth } from '../../../lib/api-keys/index.js';\nimport { selectCommandLogger } from '../../../lib/cli/command-output.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { buildCustomFunctionPushJsonResult } from '../../../lib/custom-functions/command-output.js';\nimport {\n readCustomFunctionsManifest,\n writeCustomFunctionIdsToManifest,\n} from '../../../lib/custom-functions/manifest.js';\nimport { formatMissingManifestMessage } from '../../../lib/custom-functions/missing-manifest.js';\nimport { resolveCustomFunctionProjectPaths } from '../../../lib/custom-functions/paths.js';\nimport { discoverCustomFunctionManifests } from '../../../lib/custom-functions/project-discovery.js';\nimport { parseVariablesFromString } from '../../../lib/helpers/parseVariablesFromString.js';\nimport { assertPathPhysicallyContained } from '../../../lib/scaffolding/path-safety.js';\n\nexport interface CustomFunctionsPushCommandFlags {\n /** Transcend API key. */\n auth: string;\n /** Optional Sombra internal key. */\n sombraAuth?: string;\n /** Transcend backend URL. */\n transcendUrl: string;\n /** Explicit manifest path. */\n manifest?: string;\n /** Manifest variable substitutions. */\n variables: string;\n /** Preview remote changes without applying them. */\n dryRun: boolean;\n /** Emit stable JSON output. */\n json: boolean;\n /** Promote new revisions to active. */\n promote: boolean;\n /** Push even when no changes can be detected. */\n force: boolean;\n /** Skip test payload execution. */\n skipTests: boolean;\n /** Write assigned IDs back to the manifest. */\n updateManifest: boolean;\n /** Default Sombra gateway ID. */\n sombraId?: string;\n}\n\nexport async function push(\n this: LocalContext,\n {\n auth,\n sombraAuth,\n transcendUrl,\n manifest,\n variables,\n dryRun,\n json,\n promote,\n force,\n skipTests,\n updateManifest,\n sombraId,\n }: CustomFunctionsPushCommandFlags,\n directory?: string,\n): Promise<void> {\n doneInputValidation(this.process);\n\n const cwd = this.process.cwd();\n const { manifestDirectory, manifestPath } = resolveCustomFunctionProjectPaths(cwd, {\n ...(directory ? { directory } : {}),\n ...(manifest ? { manifest } : {}),\n });\n\n // Read and validate the manifest before performing auth or network setup.\n if (!this.fs.existsSync(manifestPath)) {\n const message = formatMissingManifestMessage({\n cwd,\n manifestPath,\n discoveredManifestPaths: discoverCustomFunctionManifests(this, cwd),\n command: 'push',\n });\n this.logger.error(colors.red(message));\n this.process.exit(1);\n }\n\n // This command operates on a single Transcend instance\n const apiKeyOrList = validateTranscendAuth(auth, this);\n if (Array.isArray(apiKeyOrList)) {\n this.logger.error(\n colors.red(\n 'transcend custom-functions push does not support a list of API keys — pass a single API key.',\n ),\n );\n this.process.exit(1);\n }\n const apiKey = apiKeyOrList as string;\n const commandLogger = selectCommandLogger(this.logger, json);\n\n const vars = parseVariablesFromString(variables);\n commandLogger.info(colors.magenta(`Reading manifest \"${manifestPath}\"...`));\n const configs = readCustomFunctionsManifest(manifestPath, vars, (path) =>\n assertPathPhysicallyContained(this, manifestDirectory, path),\n );\n commandLogger.info(\n colors.green(`Found ${configs.length} custom function(s) in \"${manifestPath}\"`),\n );\n\n const client = buildTranscendGraphQLClient(transcendUrl, apiKey);\n\n // Fetch existing functions once to diff against\n const existing = await fetchAllCustomFunctions(client, { logger: commandLogger });\n\n // Each custom function belongs to a single Sombra gateway whose keys sign\n // its code, so code must be signed against that specific gateway's customer\n // ingress. Cache one connection per distinct gateway + internal key across\n // the run.\n type SombraGot = Awaited<ReturnType<typeof createSombraGotInstance>>;\n const sombraByGateway = new Map<string, SombraGot>();\n const getSombraForGateway = async (\n gatewaySombraId: string | undefined,\n sombraApiKey: string | undefined,\n ): Promise<SombraGot> => {\n const key = `${gatewaySombraId ?? ''}\\u0000${sombraApiKey ?? ''}`;\n const cached = sombraByGateway.get(key);\n if (cached) {\n return cached;\n }\n commandLogger.info(\n colors.magenta(\n `Connecting to the ${\n gatewaySombraId ? `Sombra gateway \"${gatewaySombraId}\"` : 'primary Sombra gateway'\n } to sign code...`,\n ),\n );\n const sombra = await createSombraGotInstance(transcendUrl, apiKey, {\n logger: commandLogger,\n sombraApiKey,\n ...(gatewaySombraId ? { sombraId: gatewaySombraId } : {}),\n });\n sombraByGateway.set(key, sombra);\n return sombra;\n };\n\n /**\n * Resolve the Sombra internal key for a manifest entry: the env variable\n * named by `sombra-auth-env` when set (which must be exported), else the\n * `--sombraAuth` flag.\n *\n * @param input - The manifest entry\n * @returns The internal key to authenticate with, if any\n */\n const resolveEntrySombraAuth = (input: {\n /** Function name, for error messages */\n name: string;\n /** Env variable name holding the gateway's internal key */\n sombraAuthEnv?: string;\n }): string | undefined => {\n if (!input.sombraAuthEnv) {\n return sombraAuth;\n }\n const value = this.process.env[input.sombraAuthEnv];\n if (!value) {\n throw new Error(\n `Custom function \"${input.name}\" sets sombra-auth-env: ${input.sombraAuthEnv}, ` +\n 'but that environment variable is not set. Export it (e.g. from a CI secret) ' +\n 'before pushing.',\n );\n }\n return value;\n };\n\n // Sync each function in order\n const results: { name: string; result?: CustomFunctionSyncResult; error?: Error }[] = [];\n await mapSeries(configs, async (input) => {\n try {\n // Resolve the gateway this function belongs to: manifest sombra-id,\n // else the existing function's gateway, else --sombraId, else primary.\n // Also validates manifest-vs-existing gateway mismatches.\n const effectiveSombraId = resolveEffectiveSombraId(\n input,\n resolveExistingCustomFunction(existing, input),\n sombraId,\n );\n const result = await syncCustomFunction(client, {\n input,\n sombra: dryRun\n ? undefined\n : await getSombraForGateway(effectiveSombraId, resolveEntrySombraAuth(input)),\n defaultSombraId: sombraId,\n existing,\n promote,\n dryRun,\n force,\n // Test the freshly signed code before pushing; every payload must\n // pass or the function is rejected. Dry runs never sign, so nothing\n // is tested either.\n ...(!skipTests && input.testPayloads !== undefined\n ? { testPayloads: input.testPayloads }\n : {}),\n logger: commandLogger,\n });\n results.push({ name: input.name, result });\n\n const suffix = result.versionNumber ? ` (version ${result.versionNumber})` : '';\n const changes =\n result.changedFields.length > 0 ? ` [${result.changedFields.join(', ')}]` : '';\n switch (result.outcome) {\n case 'created':\n if (result.createdDataSilo && result.dataSiloId) {\n commandLogger.info(\n colors.green(\n `Created DSR integration (data silo ${result.dataSiloId}) for \"${input.name}\"`,\n ),\n );\n }\n commandLogger.info(colors.green(`Created custom function \"${input.name}\"${suffix}`));\n break;\n case 'updated':\n commandLogger.info(\n colors.green(\n `Pushed new revision to \"${input.name}\"${suffix}${changes}${\n result.promoted ? ' and promoted to active' : ' as a draft'\n }`,\n ),\n );\n break;\n case 'metadata-updated':\n commandLogger.info(\n colors.green(\n `Updated metadata for \"${input.name}\"${changes} — code unchanged, no new revision`,\n ),\n );\n break;\n case 'skipped':\n commandLogger.info(\n colors.yellow(\n `Skipped \"${input.name}\" — no changes detected ` +\n '(env variable values cannot be diffed; use --force if only values changed)',\n ),\n );\n break;\n case 'would-create':\n commandLogger.info(\n colors.cyan(\n `[dry run] Would create custom function \"${input.name}\"${\n input.type === CustomFunctionType.Dsr && !input.dataSiloId\n ? ' and its DSR integration (data silo)'\n : ''\n }`,\n ),\n );\n break;\n case 'would-update':\n commandLogger.info(\n colors.cyan(`[dry run] Would push a new revision to \"${input.name}\"${changes}`),\n );\n break;\n case 'test-failed': {\n const failed = (result.testResults ?? []).filter(({ passed }) => !passed);\n commandLogger.error(\n colors.red(\n `Rejected \"${input.name}\" — ${failed.length} of ${\n result.testResults?.length ?? 0\n } test run(s) failed`,\n ),\n );\n failed.forEach(({ payloadType, result: execution }) => {\n const label = payloadType ? `[${payloadType}] ` : '';\n commandLogger.error(\n colors.red(\n ` ${label}${\n execution.error\n ? execution.error.message\n : `failed with exit code ${execution.exitCode}`\n }`,\n ),\n );\n execution.logs.forEach(({ file: logFile, message }) => {\n commandLogger.error(colors.red(` [${logFile}] ${message}`));\n });\n });\n if (result.createdDataSilo) {\n commandLogger.error(\n colors.red(\n ` The DSR integration (data silo) created for \"${input.name}\" was rolled back.`,\n ),\n );\n }\n break;\n }\n }\n\n // Anything that reached the push path without a test payload was\n // promoted untested — call it out so payloads get added over time\n if (\n !skipTests &&\n (input.testPayloads === undefined || input.testPayloads.length === 0) &&\n (result.outcome === 'created' || result.outcome === 'updated')\n ) {\n commandLogger.warn(\n colors.yellow(\n `Custom function \"${input.name}\" was pushed without a test run — add a ` +\n 'test-payload to its manifest entry to enable test-before-promote.',\n ),\n );\n }\n\n // DSR functions have two entry points (default export = DATA_POINT,\n // enricher export = REQUEST_ENRICHER); nudge toward covering both\n if (\n !skipTests &&\n input.type === CustomFunctionType.Dsr &&\n input.testPayloads !== undefined &&\n input.testPayloads.length > 0 &&\n (result.outcome === 'created' || result.outcome === 'updated')\n ) {\n const coveredTypes = new Set(\n input.testPayloads.map(\n ({ payloadType }) => payloadType ?? CustomFunctionPayloadType.DataPoint,\n ),\n );\n if (coveredTypes.size === 1) {\n const [covered] = coveredTypes;\n const uncovered =\n covered === CustomFunctionPayloadType.DataPoint\n ? CustomFunctionPayloadType.RequestEnricher\n : CustomFunctionPayloadType.DataPoint;\n commandLogger.warn(\n colors.yellow(\n `DSR custom function \"${input.name}\" only tests its ${covered} export — if it ` +\n `also implements the ${uncovered} export, add a test payload with ` +\n `payload-type: ${uncovered} so both entry points are tested on every push.`,\n ),\n );\n }\n }\n } catch (err) {\n results.push({ name: input.name, error: err as Error });\n commandLogger.error(\n colors.red(`Failed to sync custom function \"${input.name}\": ${(err as Error).message}`),\n );\n }\n });\n\n // Write assigned IDs back into the manifest so future pushes match by ID\n // instead of by (potentially non-unique) name, and DSR entries keep\n // pointing at their (possibly auto-created) integration\n if (updateManifest && !dryRun) {\n const idsByIndex = configs.map((input, index) => {\n const result = results[index]?.result;\n if (!result) {\n return undefined;\n }\n const ids = {\n ...(!input.id && result.customFunctionId ? { id: result.customFunctionId } : {}),\n ...(!input.dataSiloId && result.dataSiloId ? { dataSiloId: result.dataSiloId } : {}),\n };\n return Object.keys(ids).length > 0 ? ids : undefined;\n });\n const updatedCount = writeCustomFunctionIdsToManifest(manifestPath, idsByIndex);\n if (updatedCount > 0) {\n commandLogger.info(\n colors.green(\n `Wrote assigned id(s) back to ${updatedCount} manifest entr(ies) in \"${manifestPath}\" — ` +\n 'commit this change so future pushes match by ID.',\n ),\n );\n }\n }\n\n const output = buildCustomFunctionPushJsonResult(manifestPath, dryRun, results);\n if (json) {\n this.process.stdout.write(`${JSON.stringify(output)}\\n`);\n } else {\n const { summary } = output;\n commandLogger.info(\n colors.magenta(\n `Custom function sync complete: ${summary.created} created, ${summary.updated} updated, ` +\n `${summary.metadataUpdated} metadata-only, ${summary.skipped} skipped, ` +\n `${summary.rejected} rejected (test failed), ${summary.failed} failed${\n dryRun ? ' (dry run)' : ''\n }`,\n ),\n );\n }\n\n if (output.status === 'failed') {\n this.process.exit(1);\n }\n}\n"],"mappings":"21BAuDA,eAAsB,EAEpB,CACE,OACA,aACA,eACA,WACA,YACA,SACA,OACA,UACA,QACA,YACA,iBACA,YAEF,EACe,CACf,EAAoB,KAAK,QAAQ,CAEjC,IAAM,EAAM,KAAK,QAAQ,KAAK,CACxB,CAAE,oBAAmB,gBAAiB,EAAkC,EAAK,CACjF,GAAI,EAAY,CAAE,YAAW,CAAG,EAAE,CAClC,GAAI,EAAW,CAAE,WAAU,CAAG,EAAE,CACjC,CAAC,CAGF,GAAI,CAAC,KAAK,GAAG,WAAW,EAAa,CAAE,CACrC,IAAM,EAAU,EAA6B,CAC3C,MACA,eACA,wBAAyB,EAAgC,KAAM,EAAI,CACnE,QAAS,OACV,CAAC,CACF,KAAK,OAAO,MAAM,EAAO,IAAI,EAAQ,CAAC,CACtC,KAAK,QAAQ,KAAK,EAAE,CAItB,IAAM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AAM,KAAK,KAAM,EAAc,UAAU,CACxF,GAEH,CAKE,GAAkB,CAAC,EAAQ,CAY7B,IAAM,EAAe,EAAiC,EAXnC,EAAQ,KAAK,EAAO,IAAU,CAC/C,IAAM,EAAS,EAAQ,IAAQ,OAC/B,GAAI,CAAC,EACH,OAEF,IAAM,EAAM,CACV,GAAI,CAAC,EAAM,IAAM,EAAO,iBAAmB,CAAE,GAAI,EAAO,iBAAkB,CAAG,EAAE,CAC/E,GAAI,CAAC,EAAM,YAAc,EAAO,WAAa,CAAE,WAAY,EAAO,WAAY,CAAG,EAAE,CACpF,CACD,OAAO,OAAO,KAAK,EAAI,CAAC,OAAS,EAAI,EAAM,IAAA,IAEiC,CAAC,CAC3E,EAAe,GACjB,EAAc,KACZ,EAAO,MACL,gCAAgC,EAAa,0BAA0B,EAAa,sDAErF,CACF,CAIL,IAAM,EAAS,EAAkC,EAAc,EAAQ,EAAQ,CAC/E,GAAI,EACF,KAAK,QAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,EAAO,CAAC,IAAI,KACnD,CACL,GAAM,CAAE,WAAY,EACpB,EAAc,KACZ,EAAO,QACL,kCAAkC,EAAQ,QAAQ,YAAY,EAAQ,QAAQ,YACzE,EAAQ,gBAAgB,kBAAkB,EAAQ,QAAQ,YAC1D,EAAQ,SAAS,2BAA2B,EAAQ,OAAO,SAC5D,EAAS,aAAe,KAE7B,CACF,CAGC,EAAO,SAAW,UACpB,KAAK,QAAQ,KAAK,EAAE"}
@@ -0,0 +1,298 @@
1
+ import{g as e}from"./constants-BRsj50Nb.mjs";import{i as t,n,r,t as i}from"./project-plan-output-BHHlkLxe.mjs";import{c as a,d as o,f as s,l as c,t as l,u}from"./project-discovery-CWRjlFnC.mjs";import{c as d,g as f,l as p,r as m,t as h}from"./policy-project-discovery-C29UxWwt.mjs";import{a as g,c as _,i as v,l as y,o as b,r as ee,s as x,t as S}from"./policy-runtime-6jmkXlBk.mjs";import{t as C}from"./done-input-validation-LiTaCEzF.mjs";import{i as w,n as T,r as E,t as D}from"./prompts-BhXfYD6g.mjs";import{t as O}from"./run-captured-process-BjaSDWXG.mjs";import{t as k}from"./project-plan-apply-Bg_1eMX9.mjs";import{a as A,i as j,n as te,r as ne,t as M}from"./policy-scaffold-config-BUKAyPad.mjs";import{isAbsolute as N,join as P,posix as F,relative as I,sep as L}from"node:path";import R from"colors";const z={Editor:`editor`,Skill:`skill`,Ci:`ci`};var B=`# Idiomatic Rego and document-tree authoring
2
+
3
+ ## Start from the document tree
4
+
5
+ OPA evaluates queries against one document tree:
6
+
7
+ - \`input\` is the request-specific document supplied by the caller.
8
+ - \`data\` contains loaded policy packages and static data.
9
+ - A Rego \`package\` determines where a module contributes documents below \`data\`.
10
+
11
+ Choose package paths from the application's required query and ownership
12
+ boundaries. Keep directory and package names aligned
13
+ (\`directory-package-mismatch\`), and cover every publishable package with a
14
+ \`.manifest\` root.
15
+
16
+ ### Multi-bundle template layout
17
+
18
+ Prefer a publish directory named \`{root}-bundle/\` so the package-root folder can
19
+ be \`{root}/\` without doubling names:
20
+
21
+ \`\`\`
22
+ example-bundle/ # transcend policy publish … <dir>
23
+ .manifest # roots + optional metadata.transcend.io.template
24
+ example/
25
+ result/… # package example.result
26
+ input.example.json
27
+ input.json # gitignored; VS Code / Regal Evaluate
28
+ \`\`\`
29
+
30
+ Permissions starters use the same layout. Upload does not branch on template
31
+ metadata; Permissions API still loads only the remote bundle named
32
+ \`permissions\` (publish with \`--bundle-name=permissions\`).
33
+
34
+ OPA \`.rego\` placement follows the \`package\` line; \`data.json\` paths follow the
35
+ filesystem and must sit under the manifest root prefix on disk.
36
+
37
+ Use Rego v1 explicitly:
38
+
39
+ \`\`\`rego
40
+ package example.result
41
+
42
+ import rego.v1
43
+ \`\`\`
44
+
45
+ When one publishable package reads another package under the same manifest root,
46
+ import it and use the local name:
47
+
48
+ \`\`\`rego
49
+ import data.example.facts
50
+
51
+ allow if facts.subject_is_trusted
52
+ \`\`\`
53
+
54
+ Do not use a fully qualified \`data.<root>…\` reference directly in a rule body.
55
+ Policy Engine re-namespaces package declarations and imports during activation,
56
+ and \`transcend policy lint\` rejects direct self-root references that would
57
+ change meaning.
58
+
59
+ ## Define the contract before implementation
60
+
61
+ Find the actual caller and document:
62
+
63
+ 1. the query path below \`data\`;
64
+ 2. required and optional \`input\` fields;
65
+ 3. the result document consumed by the caller;
66
+ 4. fail-closed behavior for absent, malformed, or unknown input;
67
+ 5. stable reason codes and any fields reserved for later extension.
68
+
69
+ Do not infer a product contract from the generated example. Replace its package
70
+ names and fields when the repository's contract is known.
71
+
72
+ Wire input JSON Schemas with \`# METADATA\` \`schemas:\` annotations and a schemas
73
+ directory passed to \`opa check -s\` / VS Code \`opa.schema\`.
74
+
75
+ ## Prefer declarative result construction
76
+
77
+ String decisions inside an object remain readable and extensible. Keep one
78
+ result document shape and derive its fields from named rules:
79
+
80
+ \`\`\`rego
81
+ default decision := "deny"
82
+
83
+ decision := "allow" if {
84
+ input.subject.trusted == true
85
+ }
86
+
87
+ default reason_code := "untrusted_or_invalid_input"
88
+
89
+ reason_code := "trusted_subject" if {
90
+ decision == "allow"
91
+ }
92
+ \`\`\`
93
+
94
+ Rego rules define documents; they are not an imperative sequence of variable
95
+ assignments. Prefer small named predicates and one result constructor over
96
+ repeated branch-specific copies of the full output object.
97
+
98
+ ## Fail closed
99
+
100
+ - Give the externally queried decision or result a deny/error default.
101
+ - Treat missing fields and unknown enum values as non-authorizing.
102
+ - Avoid broad truthiness checks when exact values are required.
103
+ - Add tests for malformed and incomplete inputs, not only expected allow cases.
104
+ - Add result fields compatibly so existing consumers can continue reading the
105
+ stable core.
106
+ `,V=`# Publishing
107
+
108
+ ## Validate the upload contract
109
+
110
+ \`.manifest\` declares the document-tree roots included in the Policy Engine
111
+ bundle. Each non-test Rego package must equal a root or be nested below one.
112
+ Test modules remain local and are excluded from the upload archive.
113
+
114
+ In this template, the publish directory is \`{root}-bundle/\` (the folder that
115
+ contains \`.manifest\`), not the inner \`{root}/\` package tree alone.
116
+
117
+ Scaffolded manifests may include optional OPA \`metadata\`:
118
+
119
+ \`\`\`json
120
+ "metadata": {
121
+ "transcend.io": {
122
+ "template": "generic"
123
+ }
124
+ }
125
+ \`\`\`
126
+
127
+ \`template\` is an **authoring hint** (\`generic\` or \`permissions\`). Upload does
128
+ not branch on it.
129
+
130
+ Before publishing:
131
+
132
+ 1. confirm the intended package and query paths with the consuming application;
133
+ 2. run \`transcend policy lint <bundle-directory> --noInteractive\` and tests;
134
+ 3. review the generated bundle name, version, description, and target Transcend environment;
135
+ 4. keep API keys in the environment or the repository's approved secret store.
136
+
137
+ The publish path validates strict Rego compatibility and bundle compilation
138
+ before creating the upload tarball.
139
+
140
+ ## Bundle names: generic vs Permissions
141
+
142
+ Upload uses one create/version path for every bundle. What makes a bundle
143
+ “Permissions” is convention plus where Sombra queries it:
144
+
145
+ - **Permissions API** always loads the fixed remote bundle name
146
+ \`permissions\`. Publish that starter with \`--bundle-name=permissions\`.
147
+ - **Generic / decide** bundles use any other \`--bundle-name\` and the decide
148
+ path.
149
+
150
+ \`policy publish\` may warn when \`.manifest\` metadata/roots look Permissions-
151
+ oriented but \`--bundle-name\` is not \`permissions\` (or the reverse). The warning
152
+ does not block upload.
153
+
154
+ ## Publish deliberately
155
+
156
+ \`\`\`sh
157
+ # Generic / decide path
158
+ transcend policy publish --bundle-name example --auth "$TRANSCEND_API_KEY" \\
159
+ transcend/policy/example-bundle
160
+
161
+ # Permissions API path (fixed remote name)
162
+ transcend policy publish --bundle-name permissions --auth "$TRANSCEND_API_KEY" \\
163
+ transcend/policy/permissions-bundle
164
+ \`\`\`
165
+
166
+ Run \`transcend policy publish --help\` for current flags and scopes. Publishing
167
+ creates or updates remote Policy Engine bundle resources, so keep it out of
168
+ pull-request validation and require the repository's normal deployment approval.
169
+
170
+ Publish each \`{root}-bundle/\` separately with its own \`--bundle-name\`. Do not
171
+ add publishing, Transcend API credentials, or environment activation to the
172
+ validation-only workflow generated by \`policy init\`.
173
+ `,H="# Setup and tooling\n\n## Install the CLI\n\nInstall the Transcend CLI **≥ 11**:\n\n```sh\nnpm install --global @transcend-io/cli@^11\ntranscend policy --help # should list init, new, lint [<directory>], …\n```\n\n## Initialize safely\n\nRun `transcend policy init --help` before choosing flags. The default target is\n`transcend/policy`.\n\n`policy init` creates an empty multi-bundle workspace — shared Regal config\n(`project.roots: []`) and a README. No bundles or Rego are created.\n\nInteractive initialization offers VS Code setup, this Agent Skill, and\nvalidation-only GitHub Actions. Non-interactive automation enables only\nexplicitly supplied `--editor`, `--skill`, and `--ci` flags:\n\n```sh\ntranscend policy init ./transcend/policy --editor --skill --ci --noInteractive --yes\n```\n\nUse `--dryRun` to inspect the complete transactional plan. Existing policy\nfiles, manifests, Regal configuration, workflows, and customized managed\nartifacts are preserved.\n\n## Add bundles\n\nAfter initializing the workspace, add bundles with `transcend policy new`:\n\n```sh\ntranscend policy new --template generic --name example --yes\ntranscend policy new --template permissions --name permissions --yes\n```\n\nTemplates available:\n\n- `generic` — A fail-closed teaching entrypoint (default root: `example`)\n- `permissions` — A Permission API starter with purpose preferences (default root: `permissions`)\n\n`policy new` creates the `{name}-bundle/` directory, its `.manifest`, Rego tree,\ninput fixtures, and input schema. It also merges the root into Regal config and\nupdates VS Code settings/tasks when `.vscode` is present.\n\n## Required tools\n\n- Use OPA 1.x for Rego v1 parsing, formatting, checks, tests, and bundle compilation.\n- Use Regal for idiomatic Rego linting and editor language-server features.\n- Run `opa version` and `regal version` to confirm the active executables.\n\nThe generated Regal configuration targets OPA 1.18.2 capabilities. Generated CI\ninstalls OPA 1.18.2 and Regal 0.42.0; local tools only need to satisfy the\ncompatible versions reported by `policy init` and `policy lint`. Follow their\nofficial installation links when a compatible tool is missing.\n\n## Editor and CI\n\nRepository-level VS Code settings should include:\n\n- `opa.roots` — one entry per `{root}-bundle/` publish directory\n- `opa.bundleMode: true` — avoid loading fixture JSON as data\n- `opa.schema` — directory of input JSON Schemas (shared when multiple bundles\n need different envelopes)\n- `json.schemas` — optional validation of `input.json` / `input.example.json`\n\nPreserve custom settings and tasks when adapting generated editor files.\n\nGenerated GitHub Actions CI is read-only and credential-free: it installs pinned\ntools and the pinned Transcend CLI, then runs `transcend policy lint` per\npublish directory (matrix when multiple bundles exist). Locally, bare\n`transcend policy lint` verifies every child under the workspace that contains\na `.manifest`:\n\n```sh\ntranscend policy lint --noInteractive --json\ntranscend policy lint transcend/policy/example-bundle --noInteractive --json\n```\n\nAdapt triggers, runner labels, dependency installation, and caching to\nestablished repository conventions without adding publish steps or secrets.\n",U=`# Testing and debugging
174
+
175
+ ## Write executable tests
176
+
177
+ Place tests next to the package they exercise and suffix test modules with
178
+ \`_test.rego\`. A separate \`_test\` package makes the production API and test
179
+ helpers easy to distinguish. Keep the \`_test\` package under the same manifest
180
+ root (for example \`example.result_test\`, not a sibling root), so bundle-mode
181
+ loads accept it.
182
+
183
+ \`\`\`rego
184
+ package example.result_test
185
+
186
+ import data.example.result
187
+ import rego.v1
188
+
189
+ test_denies_missing_input if {
190
+ result.decision == "deny" with input as {}
191
+ result.reason_code == "untrusted_or_invalid_input" with input as {}
192
+ }
193
+ \`\`\`
194
+
195
+ Cover at least:
196
+
197
+ - the ordinary allow case;
198
+ - explicit deny cases;
199
+ - absent, malformed, and unknown input;
200
+ - important result fields and reason codes;
201
+ - interactions between packages when one policy reads another document.
202
+
203
+ \`transcend policy lint\` requires a non-empty test suite.
204
+
205
+ ## Use local inputs safely
206
+
207
+ Keep a sanitized \`input.example.json\` in each publish directory. \`policy new\`
208
+ also writes a gitignored \`input.json\` beside it (same contents) so VS Code /
209
+ Regal Evaluate work immediately. Customize \`input.json\` locally; keep
210
+ \`input.example.json\` committed and free of credentials or personal data.
211
+
212
+ ## Run the complete gate
213
+
214
+ With no directory argument, \`policy lint\` and \`policy test\` verify every
215
+ immediate child under the workspace (\`transcend/policy\`) that contains a
216
+ \`.manifest\`. Pass one bundle path to target a single unit:
217
+
218
+ \`\`\`sh
219
+ transcend policy lint --noInteractive
220
+ transcend policy test
221
+ transcend policy lint transcend/policy/example-bundle --noInteractive
222
+ transcend policy test transcend/policy/example-bundle
223
+ opa check --strict -b transcend/policy/example-bundle -s transcend/policy/schemas
224
+ \`\`\`
225
+
226
+ \`policy lint\` and \`policy test\` run \`opa test -b\` (bundle mode) so a local
227
+ gitignored \`input.json\` beside \`input.example.json\` does not cause a merge
228
+ error. Prefer the CLI over raw directory-mode \`opa test\`. Strict OPA checks use
229
+ Rego v1 (no \`--v0-compatible\`).
230
+
231
+ Use \`transcend policy lint --help\` for formatter flags. Review Regal findings
232
+ deliberately instead of applying broad rewrites.
233
+
234
+ ## Evaluate a query
235
+
236
+ \`policy eval\` requires an explicit bundle directory:
237
+
238
+ \`\`\`sh
239
+ transcend policy eval transcend/policy/example-bundle \\
240
+ --package data.example.result \\
241
+ --input transcend/policy/example-bundle/input.json
242
+ \`\`\`
243
+
244
+ Or pipe the envelope with \`--stdin-input\`. Use \`transcend policy eval --help\` for
245
+ curated \`opa eval\` pass-through flags (format, explain, metrics, and similar).
246
+ Exit-on-result flags like OPA \`--fail\` are not exposed — production Evaluate uses
247
+ the Data API (policy deny is a successful evaluation).
248
+
249
+ Or \`opa eval -b … -i …\` with the caller's query path. If the result differs from
250
+ expectations, inspect package paths, imports, defaults, input field presence,
251
+ and the selected bundle directory before changing policy logic.
252
+ `,W=`---
253
+ name: transcend-policy-engine
254
+ description: Sets up, authors, validates, tests, and publishes Transcend Policy Engine projects backed by OPA and Rego. Use for .manifest roots, Rego v1 policy trees, Regal configuration, local policy inputs, Policy Engine CI, or transcend policy CLI commands.
255
+ compatibility: Requires OPA 1.x, Regal, and Transcend CLI ≥ 11 for local validation.
256
+ ---
257
+
258
+ # Transcend Policy Engine
259
+
260
+ Use the CLI for deterministic scaffolding and validation. Treat generated
261
+ examples as disposable teaching material and derive the real policy contract
262
+ from repository code and product requirements.
263
+
264
+ Requires **Transcend CLI ≥ 11** (\`transcend policy lint [<directory>]\`, with
265
+ \`init\` available).
266
+
267
+ ## Workflow
268
+
269
+ 1. Locate each publishable bundle directory (a directory with a \`.manifest\`;
270
+ \`policy new\` scaffolds these as \`{root}-bundle/\` with a \`{root}/\` package
271
+ tree inside).
272
+ 2. For initialization, editor support, tools, or CI, read [references/setup-tooling.md](references/setup-tooling.md).
273
+ 3. For package layout, document-tree design, decisions, and inputs, read [references/authoring.md](references/authoring.md).
274
+ 4. For tests, local inputs, linting, and evaluation, read [references/testing-debugging.md](references/testing-debugging.md).
275
+ 5. For bundle validation and publishing, read [references/publishing.md](references/publishing.md).
276
+ 6. Preserve repository conventions and finish with:
277
+
278
+ \`\`\`sh
279
+ transcend policy lint --noInteractive
280
+ \`\`\`
281
+
282
+ ## Documentation
283
+
284
+ - Every Transcend CLI command and subcommand provides contextual help with \`transcend <command> --help\`.
285
+ - Use the [Transcend CLI README](https://github.com/transcend-io/tools/tree/main/packages/cli#readme) for command documentation and examples.
286
+ - Use the [Transcend documentation index](https://docs.transcend.io/llms.txt) to find current product documentation.
287
+
288
+ ## Guardrails
289
+
290
+ - Do not invent an input shape, output contract, package tree, or deployment convention.
291
+ - Keep decisions fail-closed and make result documents extensible.
292
+ - Never commit credentials or a real local \`input.json\`.
293
+ - Keep every publishable Rego package covered by a \`.manifest\` root.
294
+ - One publish directory = one Policy Engine bundle; do not merge unrelated
295
+ products into a single \`.manifest\` unless they share activation and callers.
296
+ `;const G=`transcend-policy-engine`,K=[{path:`SKILL.md`,contents:W},{path:`references/setup-tooling.md`,contents:H},{path:`references/authoring.md`,contents:B},{path:`references/testing-debugging.md`,contents:U},{path:`references/publishing.md`,contents:V}];function q(e){return`${e.hasSkill?`Use the \`${G}\` skill and run`:`Run`} ${e.newCommand} to add a bundle from a template, then adapt the policy document tree and input/output contract to the intended application.`}function J(e,n){return{version:e.version,command:e.command,applied:n.applied,dryRun:n.dryRun,targetDirectory:e.targetDirectory,manifestPath:e.manifestPath,changes:e.changes.map(e=>t(n.cwd,e)),warnings:e.warnings,nextSteps:e.nextSteps,features:[...e.features],aiHandoff:n.aiHandoff,tools:n.tools}}const Y={name:G,displayName:`Policy Engine`,owner:`@transcend-io/cli`,files:K};function X(e,t){let n=new Set(f().map(({path:t})=>P(e.targetDirectory,t))),r=new Set(t.features);return r.has(z.Editor)&&(n.add(P(e.projectRoot,`.vscode`,`settings.json`)),n.add(P(e.projectRoot,`.vscode`,`extensions.json`)),n.add(P(e.projectRoot,`.vscode`,`tasks.json`))),r.has(z.Skill)&&a(e.projectRoot,e.existingSkillDirectories,Y).forEach(e=>n.add(e)),r.has(z.Ci)&&e.repositoryRoot&&e.usesGithub&&n.add(P(e.repositoryRoot,j)),[...n].sort((e,t)=>e.localeCompare(t))}function Z(e,t){let n=I(e,t);if(n===`..`||n.startsWith(`..${L}`)||N(n))throw Error(`Refusing to modify path outside project root: ${t}`)}function re(e){let t=new Set([`${d}/input.json`]);return e.forEach(({path:e})=>{t.add(e);let n=F.dirname(e);for(;n!==`.`;)t.add(n),n=F.dirname(n)}),t}function Q(e,t,n){let r=s({snapshot:u(t.snapshots,n.path),after:n.contents,description:n.description,...n.createOnly===void 0?{}:{createOnly:n.createOnly}});r?e.changes.push(r):e.unchanged.push(n.path)}function ie(e,t,n,r,a,o){Q(e,t,{path:n,contents:r.contents,description:a}),e.warnings.push(...r.warnings.map(e=>`${e} (${i(o,n)})`))}function ae(e,t){let{state:n}=e,r=f(),a=`transcend policy new`,s={version:3,command:`init`,rootDirectory:n.projectRoot,targetDirectory:n.targetDirectory,manifestPath:n.targetDirectory,changes:[],unchanged:[],warnings:[],nextSteps:[a],features:[...t.features]},l=X(n,t);if(Z(n.projectRoot,n.targetDirectory),l.forEach(e=>Z(n.projectRoot,e)),n.relativeFilePaths.length===0)s.directoryPreconditions=[{path:n.targetDirectory,relativePaths:[...n.relativePaths]}],r.forEach(t=>{let r=P(n.targetDirectory,t.path);if(o(e.snapshots,r).kind!==`absent`)throw Error(`Expected an empty policy target, but found an entry at: ${r}`);Q(s,e,{path:r,contents:t.contents,description:t.description,createOnly:!0})});else{let t=!0;r.forEach(r=>{let a=P(n.targetDirectory,r.path),c=o(e.snapshots,a);if(c.kind===`file`&&c.contents===r.contents){s.unchanged.push(a);return}t=!1,c.kind!==`absent`&&(s.unchanged.push(a),s.warnings.push(`Existing policy scaffold path was left unchanged: ${i(n.invocationDirectory,a)}`))});let c=re(r),l=n.relativeFilePaths.some(e=>!c.has(e));(!t||l)&&s.warnings.push(`Existing policy target contains custom or partial content, so no workspace files were added or overwritten. Review ${i(n.invocationDirectory,n.targetDirectory)} manually, then run \`${a}\`.`)}let u=new Set(t.features),d=n.projectRoot;if(u.has(z.Editor)){let t=P(d,`.vscode`,`settings.json`),r=P(d,`.vscode`,`extensions.json`),a=P(d,`.vscode`,`tasks.json`);[{path:t,description:`Merge strict target-scoped OPA and Rego editor settings`,merge:(e,t,n)=>te(e,t,n)},{path:r,description:`Recommend the OPA extension and discourage its syntax-only conflict`,merge:e=>M(e)},{path:a,description:`Create the VS Code task configuration`,merge:(e,t,n)=>ne(e,t,n)}].forEach(({path:t,description:r,merge:a})=>{let c=o(e.snapshots,t);if(c.kind!==`absent`&&c.kind!==`file`){s.unchanged.push(t),s.warnings.push(`Existing VS Code artifact is not a regular file and was left unchanged: ${i(n.invocationDirectory,t)}`);return}ie(s,e,t,a(c.kind===`file`?c.contents:null,d,n.targetDirectory),r,n.invocationDirectory)})}if(u.has(z.Skill)){let t=c({rootDirectory:d,existingDirectories:n.existingSkillDirectories,snapshots:e.snapshots,skill:Y,preserveModified:!0});s.changes.push(...t.changes),s.unchanged.push(...t.unchanged),s.warnings.push(...t.warnings.map(e=>t.unchanged.reduce((e,t)=>e.replace(t,i(n.invocationDirectory,t)),e)))}if(u.has(z.Ci))if(!n.repositoryRoot||!n.usesGithub)s.warnings.push(`GitHub Actions setup was selected, but this target is not inside a detected GitHub repository.`);else{let r=P(n.repositoryRoot,j),a=I(n.repositoryRoot,n.targetDirectory).split(L).join(`/`)||`.`,c=A({cliVersion:t.cliVersion,workspaceDirectory:a,bundleDirectories:[]}),l=o(e.snapshots,r);l.kind===`absent`?Q(s,e,{path:r,contents:c,description:`Add credential-free Policy Engine validation`,createOnly:!0}):l.kind===`file`&&l.contents===c?s.unchanged.push(r):(s.unchanged.push(r),s.warnings.push(`Existing GitHub Actions workflow was left unchanged: ${i(n.invocationDirectory,r)}. Adapt it manually to validate each policy bundle.`))}return s.changes.forEach(({path:e})=>Z(n.projectRoot,e)),s}const oe={[z.Editor]:`VS Code settings and lint task`,[z.Skill]:`Policy Engine Agent Skill`,[z.Ci]:`Validation-only GitHub Actions`},se=Object.values(z);function $(e,t){let n=[t.stdout.trim(),t.stderr.trim()].filter(Boolean).join(`
297
+ `),r=e===`OPA`?ee:g;return`${e===`OPA`?`OPA 1.x`:`Regal ${S} or newer`} is required, but \`${e.toLowerCase()} version\` exited with code ${t.code}${n?`: ${n}`:`.`} Install or upgrade it using the official instructions: ${r}`}async function ce(e,t,n){let r={opa:null,regal:null},i=[],a=await n(`opa`,[`version`],{cwd:t},e);if(a.error?.code===`ENOENT`)i.push(v);else{let e=`${a.stdout}\n${a.stderr}`,t=_(e);a.code===0?t?i.push(t):r.opa=x(e).version:i.push(t??$(`OPA`,a))}let o=await n(`regal`,[`version`],{cwd:t},e);if(o.error?.code===`ENOENT`)i.push(b);else{let e=`${o.stdout}\n${o.stderr}`,t=y(e,S,`the generated OPA ${p} capabilities configuration`);o.code===0?t?i.push(t):r.regal=x(e).version:i.push(t??$(`Regal`,o))}return{tools:r,warnings:i}}async function le(t,a=h,o=O){C(this.process);try{let s=await ce(this,this.process.cwd(),o),c=m(this,a),u=new T(this),d=E(t,this.process.stdin.isTTY,this.process.stderr.isTTY),f=await w(u,{features:se,labels:oe,enabled:{[z.Editor]:t.editor,[z.Skill]:t.skill,[z.Ci]:t.ci},interactive:d}),p=X(c,{features:f}),h=ae({state:c,snapshots:l(this,c.projectRoot,p)},{features:f,cliVersion:e});h.warnings.push(...s.warnings),t.json||this.logger.info(r(h,{cwd:this.process.cwd(),title:`Policy initialization plan`,details:[{label:`Target`,path:h.targetDirectory}]}));let g=h.changes.length===0||t.dryRun;if(h.changes.length>0&&!t.dryRun)if(t.yes)g=!0;else if(d)g=await u.confirm(`Apply this complete plan?`,!0);else throw Error(`The plan requires approval in a non-interactive invocation. Review with --dryRun, then pass --yes.`);g&&!t.dryRun&&h.changes.length>0&&await k(this,h);let _=g&&!t.dryRun&&h.changes.length>0,v=g&&!t.dryRun,y=q({projectPath:n(i(this.process.cwd(),c.targetDirectory)),hasSkill:v&&f.includes(z.Skill),newCommand:h.nextSteps[0]}),b=J(h,{applied:_,dryRun:t.dryRun,cwd:this.process.cwd(),aiHandoff:y,tools:s.tools});if(t.json){this.process.stdout.write(`${JSON.stringify(b)}\n`);return}if(t.dryRun){this.logger.info(R.yellow(`Dry run complete. No changes were written.`));return}if(!g){this.logger.info(R.yellow(`No changes applied.`));return}if(h.changes.length===0){let e=h.warnings.length===s.warnings.length?`Policy project is already initialized.`:`Existing policy project was left unchanged.`;this.logger.info(R.green(e))}else this.logger.info(R.green(`Policy project initialized.`));h.nextSteps.length>0&&(this.logger.info(`\n${R.bold(`Next steps`)}`),h.nextSteps.forEach(e=>this.logger.info(e))),this.logger.info(`\n${R.bold(`AI handoff — paste into your coding agent`)}`),this.logger.info(y)}catch(e){if(e instanceof D)return this.process.exit(130);throw e}}export{le as init};
298
+ //# sourceMappingURL=impl-DQcgEx7V2.mjs.map