@transcend-io/cli 11.0.0 → 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 (365) 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-C165wLBa.mjs → approvePrivacyRequests-BDG82nlp.mjs} +2 -2
  5. package/dist/{approvePrivacyRequests-C165wLBa.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-DOopJFYY.mjs → buildExamples-B6BdW0FD.mjs} +2 -2
  10. package/dist/{buildExamples-DOopJFYY.mjs.map → buildExamples-B6BdW0FD.mjs.map} +1 -1
  11. package/dist/{buildXdiSyncEndpoint-DeStnIit.mjs → buildXdiSyncEndpoint-FExEagKc.mjs} +2 -2
  12. package/dist/{buildXdiSyncEndpoint-DeStnIit.mjs.map → buildXdiSyncEndpoint-FExEagKc.mjs.map} +1 -1
  13. package/dist/{bulkRestartRequests-_Mu1rwZQ.mjs → bulkRestartRequests-OKwKXc52.mjs} +2 -2
  14. package/dist/{bulkRestartRequests-_Mu1rwZQ.mjs.map → bulkRestartRequests-OKwKXc52.mjs.map} +1 -1
  15. package/dist/{bulkRetryEnrichers-C2keTKuQ.mjs → bulkRetryEnrichers-Dl-n8AFF.mjs} +2 -2
  16. package/dist/{bulkRetryEnrichers-C2keTKuQ.mjs.map → bulkRetryEnrichers-Dl-n8AFF.mjs.map} +1 -1
  17. package/dist/{cancelPrivacyRequests-DwQr18Fk.mjs → cancelPrivacyRequests-BIgX5SDz.mjs} +2 -2
  18. package/dist/{cancelPrivacyRequests-DwQr18Fk.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-Upxn_rQF.mjs → constants-BRsj50Nb.mjs} +2 -2
  36. package/dist/{constants-Upxn_rQF.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-CKH-24w5.mjs → createPoolingCommandUi-CyPZ3GqN.mjs} +5 -5
  44. package/dist/{createPoolingCommandUi-CKH-24w5.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-D3bzcegH.mjs → downloadPrivacyRequestFiles-EBySRnvd.mjs} +2 -2
  52. package/dist/{downloadPrivacyRequestFiles-D3bzcegH.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-DWfJtB3t.mjs → generateCrossAccountApiKeys-pWTrIUE6.mjs} +2 -2
  62. package/dist/{generateCrossAccountApiKeys-DWfJtB3t.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-ByFyaZkK.mjs → impl-1SsreZWo.mjs} +2 -2
  66. package/dist/{impl-ByFyaZkK.mjs.map → impl-1SsreZWo.mjs.map} +1 -1
  67. package/dist/{impl-D4Ne3Vbg.mjs → impl-7rdGuHOC.mjs} +2 -2
  68. package/dist/{impl-D4Ne3Vbg.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-C2sSZ8qF.mjs → impl-B2ZXtnpX.mjs} +2 -2
  74. package/dist/{impl-C2sSZ8qF.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-BhfxcCgN2.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-CHUxKOz_.mjs → impl-BLQDgwxL.mjs} +2 -2
  86. package/dist/{impl-CHUxKOz_.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-Cw0L2xEU.mjs → impl-BdTxFv63.mjs} +2 -2
  90. package/dist/{impl-Cw0L2xEU.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-C_62Z4ED.mjs → impl-CU38kdj8.mjs} +2 -2
  98. package/dist/{impl-C_62Z4ED.mjs.map → impl-CU38kdj8.mjs.map} +1 -1
  99. package/dist/{impl-BppXJ1AD2.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-BJyzyrZD.mjs → impl-C_Ifcb00.mjs} +2 -2
  104. package/dist/{impl-BJyzyrZD.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-BpMQYnbR.mjs → impl-CrdqsTUy.mjs} +2 -2
  116. package/dist/{impl-BpMQYnbR.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-BEA5cQOT2.mjs → impl-CspH2ZWx.mjs} +2 -2
  120. package/dist/impl-CspH2ZWx.mjs.map +1 -0
  121. package/dist/{impl-lsmXIGSo2.mjs → impl-CudSYx-g.mjs} +2 -2
  122. package/dist/impl-CudSYx-g.mjs.map +1 -0
  123. package/dist/{impl-DXQHLpMw.mjs → impl-Cxprr2hw.mjs} +2 -2
  124. package/dist/{impl-DXQHLpMw.mjs.map → impl-Cxprr2hw.mjs.map} +1 -1
  125. package/dist/{impl-gs5wJ1BK.mjs → impl-D-a5xGld.mjs} +2 -2
  126. package/dist/{impl-gs5wJ1BK.mjs.map → impl-D-a5xGld.mjs.map} +1 -1
  127. package/dist/{impl-D94m3EPp.mjs → impl-D1UogVAq.mjs} +2 -2
  128. package/dist/{impl-D94m3EPp.mjs.map → impl-D1UogVAq.mjs.map} +1 -1
  129. package/dist/{impl-B5df-igZ.mjs → impl-D1f9mJL_.mjs} +2 -2
  130. package/dist/{impl-B5df-igZ.mjs.map → impl-D1f9mJL_.mjs.map} +1 -1
  131. package/dist/{impl-CSk_okwj.mjs → impl-DJcNhpbx.mjs} +2 -2
  132. package/dist/{impl-CSk_okwj.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-DhxDp4GN.mjs → impl-DTadLabu.mjs} +2 -2
  140. package/dist/{impl-DhxDp4GN.mjs.map → impl-DTadLabu.mjs.map} +1 -1
  141. package/dist/{impl-CD2R3L0v.mjs → impl-DXbxO2VJ.mjs} +2 -2
  142. package/dist/{impl-CD2R3L0v.mjs.map → impl-DXbxO2VJ.mjs.map} +1 -1
  143. package/dist/{impl-nz1MyjX22.mjs → impl-DcL-8NEa2.mjs} +2 -2
  144. package/dist/{impl-nz1MyjX22.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-GytUVAMP.mjs.map → impl-DiwxYcux.mjs.map} +1 -1
  155. package/dist/{impl-C9OmNI49.mjs → impl-Do2TNA3-.mjs} +2 -2
  156. package/dist/{impl-C9OmNI49.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-CzdUHruN.mjs → impl-Dr_l_SLd.mjs} +2 -2
  160. package/dist/{impl-CzdUHruN.mjs.map → impl-Dr_l_SLd.mjs.map} +1 -1
  161. package/dist/{impl-CTwyYUw3.mjs → impl-Ds-gQfdc.mjs} +2 -2
  162. package/dist/{impl-CTwyYUw3.mjs.map → impl-Ds-gQfdc.mjs.map} +1 -1
  163. package/dist/{impl-C8jjYvgu.mjs → impl-DtnYcktN.mjs} +2 -2
  164. package/dist/{impl-C8jjYvgu.mjs.map → impl-DtnYcktN.mjs.map} +1 -1
  165. package/dist/impl-DtpgD_as.mjs +2 -0
  166. package/dist/{impl-DQPmSYSE.mjs.map → impl-DtpgD_as.mjs.map} +1 -1
  167. package/dist/{impl-D2Q4nxUO.mjs → impl-DxQ9yj3H.mjs} +2 -2
  168. package/dist/{impl-D2Q4nxUO.mjs.map → impl-DxQ9yj3H.mjs.map} +1 -1
  169. package/dist/impl-FerHBNJx2.mjs +4 -0
  170. package/dist/{impl-D-AHlqlD2.mjs.map → impl-FerHBNJx2.mjs.map} +1 -1
  171. package/dist/{impl-CiBT9-GH2.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-zRAjMVgz.mjs → impl-vmLq6HCI.mjs} +2 -2
  182. package/dist/{impl-zRAjMVgz.mjs.map → impl-vmLq6HCI.mjs.map} +1 -1
  183. package/dist/{impl-a0BFtbna.mjs → impl-wBcVYHlA.mjs} +2 -2
  184. package/dist/{impl-a0BFtbna.mjs.map → impl-wBcVYHlA.mjs.map} +1 -1
  185. package/dist/index.mjs +2 -2
  186. package/dist/index.mjs.map +1 -1
  187. package/dist/{initializeCliRuntime-6wI_VIHV.mjs → initializeCliRuntime-BaATMO1X.mjs} +1 -1
  188. package/dist/{initializeCliRuntime-6wI_VIHV.mjs.map → initializeCliRuntime-BaATMO1X.mjs.map} +1 -1
  189. package/dist/{inquirer-BeaBetMO.mjs → inquirer-BU5IpgA8.mjs} +2 -2
  190. package/dist/{inquirer-BeaBetMO.mjs.map → inquirer-BU5IpgA8.mjs.map} +1 -1
  191. package/dist/{jsonc-D9dDWb1J.mjs → jsonc-CdTubr53.mjs} +1 -1
  192. package/dist/{jsonc-D9dDWb1J.mjs.map → jsonc-CdTubr53.mjs.map} +1 -1
  193. package/dist/{listFiles-BdFUbX5x.mjs → listFiles-DDGCBdtx.mjs} +1 -1
  194. package/dist/{listFiles-BdFUbX5x.mjs.map → listFiles-DDGCBdtx.mjs.map} +1 -1
  195. package/dist/logger-CPu6zbyQ.mjs +2 -0
  196. package/dist/logger-CPu6zbyQ.mjs.map +1 -0
  197. package/dist/{mapConsentCsvRowsToInputs-Dqb6WL4r.mjs → mapConsentCsvRowsToInputs-CkLfxaIf.mjs} +1 -1
  198. package/dist/{mapConsentCsvRowsToInputs-Dqb6WL4r.mjs.map → mapConsentCsvRowsToInputs-CkLfxaIf.mjs.map} +1 -1
  199. package/dist/{markRequestDataSiloIdsCompleted-Br5gIS3S.mjs → markRequestDataSiloIdsCompleted-BYNMCkhy.mjs} +2 -2
  200. package/dist/{markRequestDataSiloIdsCompleted-Br5gIS3S.mjs.map → markRequestDataSiloIdsCompleted-BYNMCkhy.mjs.map} +1 -1
  201. package/dist/{markSilentPrivacyRequests-Cs_iZNJs.mjs → markSilentPrivacyRequests-gKYivzH1.mjs} +2 -2
  202. package/dist/{markSilentPrivacyRequests-Cs_iZNJs.mjs.map → markSilentPrivacyRequests-gKYivzH1.mjs.map} +1 -1
  203. package/dist/{mergeTranscendInputs-DFQcbh8b.mjs → mergeTranscendInputs-D1CvxQu0.mjs} +2 -2
  204. package/dist/{mergeTranscendInputs-DFQcbh8b.mjs.map → mergeTranscendInputs-D1CvxQu0.mjs.map} +1 -1
  205. package/dist/missing-manifest-D8y1VL4p.mjs +2 -0
  206. package/dist/missing-manifest-D8y1VL4p.mjs.map +1 -0
  207. package/dist/{module-graph-Cb0g74Ft.mjs → module-graph-CAT8_JCG.mjs} +1 -1
  208. package/dist/{module-graph-Cb0g74Ft.mjs.map → module-graph-CAT8_JCG.mjs.map} +1 -1
  209. package/dist/{notifyPrivacyRequestsAdditionalTime-kPXTdjgT.mjs → notifyPrivacyRequestsAdditionalTime-DbERhQ1Q.mjs} +2 -2
  210. package/dist/{notifyPrivacyRequestsAdditionalTime-kPXTdjgT.mjs.map → notifyPrivacyRequestsAdditionalTime-DbERhQ1Q.mjs.map} +1 -1
  211. package/dist/{parquetToCsvOneFile-ChmPC6dL.mjs → parquetToCsvOneFile-DtbCFm08.mjs} +3 -3
  212. package/dist/{parquetToCsvOneFile-ChmPC6dL.mjs.map → parquetToCsvOneFile-DtbCFm08.mjs.map} +1 -1
  213. package/dist/{parseAttributesFromString-CO16oAlx.mjs → parseAttributesFromString-C5hJMRvt.mjs} +2 -2
  214. package/dist/{parseAttributesFromString-CO16oAlx.mjs.map → parseAttributesFromString-C5hJMRvt.mjs.map} +1 -1
  215. package/dist/{parseVariablesFromString-BOSfQ4QF.mjs → parseVariablesFromString-6TYW65LF.mjs} +1 -1
  216. package/dist/{parseVariablesFromString-BOSfQ4QF.mjs.map → parseVariablesFromString-6TYW65LF.mjs.map} +1 -1
  217. package/dist/paths-J5KScOaQ.mjs +2 -0
  218. package/dist/paths-J5KScOaQ.mjs.map +1 -0
  219. package/dist/policy-bundle-manifest-BZnBMZQq.mjs +7 -0
  220. package/dist/policy-bundle-manifest-BZnBMZQq.mjs.map +1 -0
  221. package/dist/policy-project-discovery-C29UxWwt.mjs +427 -0
  222. package/dist/policy-project-discovery-C29UxWwt.mjs.map +1 -0
  223. package/dist/{policy-runtime-BMKa-Upy.mjs → policy-runtime-6jmkXlBk.mjs} +2 -2
  224. package/dist/{policy-runtime-BMKa-Upy.mjs.map → policy-runtime-6jmkXlBk.mjs.map} +1 -1
  225. package/dist/policy-scaffold-config-BUKAyPad.mjs +76 -0
  226. package/dist/policy-scaffold-config-BUKAyPad.mjs.map +1 -0
  227. package/dist/{policyEngineCliError-DY8V-qkK.mjs → policyEngineCliError-CZrOHhLv.mjs} +1 -1
  228. package/dist/{policyEngineCliError-DY8V-qkK.mjs.map → policyEngineCliError-CZrOHhLv.mjs.map} +1 -1
  229. package/dist/{printResult-CHe3nRN4.mjs → printResult-C2K9ODeE.mjs} +3 -3
  230. package/dist/printResult-C2K9ODeE.mjs.map +1 -0
  231. package/dist/project-discovery-BkHpTXDx.mjs +2 -0
  232. package/dist/project-discovery-BkHpTXDx.mjs.map +1 -0
  233. package/dist/project-discovery-CWRjlFnC.mjs +2 -0
  234. package/dist/project-discovery-CWRjlFnC.mjs.map +1 -0
  235. package/dist/project-plan-apply-Bg_1eMX9.mjs +3 -0
  236. package/dist/{project-plan-apply-Dvndx455.mjs.map → project-plan-apply-Bg_1eMX9.mjs.map} +1 -1
  237. package/dist/project-plan-output-BHHlkLxe.mjs +4 -0
  238. package/dist/project-plan-output-BHHlkLxe.mjs.map +1 -0
  239. package/dist/prompts-BhXfYD6g.mjs +2 -0
  240. package/dist/prompts-BhXfYD6g.mjs.map +1 -0
  241. package/dist/{pullAllDatapoints-uk5ggk6O.mjs → pullAllDatapoints-Bm-Orhse.mjs} +2 -2
  242. package/dist/{pullAllDatapoints-uk5ggk6O.mjs.map → pullAllDatapoints-Bm-Orhse.mjs.map} +1 -1
  243. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-DbFFXAVM.mjs → pullChunkedCustomSiloOutstandingIdentifiers-DTGQOw--.mjs} +2 -2
  244. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-DbFFXAVM.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-DTGQOw--.mjs.map} +1 -1
  245. package/dist/{pullConsentManagerMetrics-Dv5n1ZGp.mjs → pullConsentManagerMetrics-DKCkfbCB.mjs} +2 -2
  246. package/dist/{pullConsentManagerMetrics-Dv5n1ZGp.mjs.map → pullConsentManagerMetrics-DKCkfbCB.mjs.map} +1 -1
  247. package/dist/{pullManualEnrichmentIdentifiersToCsv-D5is0Nrs.mjs → pullManualEnrichmentIdentifiersToCsv-DMC5CQtE.mjs} +2 -2
  248. package/dist/{pullManualEnrichmentIdentifiersToCsv-D5is0Nrs.mjs.map → pullManualEnrichmentIdentifiersToCsv-DMC5CQtE.mjs.map} +1 -1
  249. package/dist/{pullTranscendConfiguration-B63M3ild.mjs → pullTranscendConfiguration-CDUDqxpm.mjs} +2 -2
  250. package/dist/{pullTranscendConfiguration-B63M3ild.mjs.map → pullTranscendConfiguration-CDUDqxpm.mjs.map} +1 -1
  251. package/dist/{pullUnstructuredSubDataPointRecommendations-YTBzfkRZ.mjs → pullUnstructuredSubDataPointRecommendations-Ci4AOxyH.mjs} +2 -2
  252. package/dist/{pullUnstructuredSubDataPointRecommendations-YTBzfkRZ.mjs.map → pullUnstructuredSubDataPointRecommendations-Ci4AOxyH.mjs.map} +1 -1
  253. package/dist/{pushCronIdentifiersFromCsv-Ctq38wAY.mjs → pushCronIdentifiersFromCsv-DhS2z8IG.mjs} +2 -2
  254. package/dist/{pushCronIdentifiersFromCsv-Ctq38wAY.mjs.map → pushCronIdentifiersFromCsv-DhS2z8IG.mjs.map} +1 -1
  255. package/dist/{pushManualEnrichmentIdentifiersFromCsv-0WHf6d_m.mjs → pushManualEnrichmentIdentifiersFromCsv-BTJGOmdU.mjs} +2 -2
  256. package/dist/{pushManualEnrichmentIdentifiersFromCsv-0WHf6d_m.mjs.map → pushManualEnrichmentIdentifiersFromCsv-BTJGOmdU.mjs.map} +1 -1
  257. package/dist/{readCsv-DLg8pwjd.mjs → readCsv-DNcJ_UfU.mjs} +1 -1
  258. package/dist/{readCsv-DLg8pwjd.mjs.map → readCsv-DNcJ_UfU.mjs.map} +1 -1
  259. package/dist/{readTranscendYaml-BNn6-Ofi.mjs → readTranscendYaml-BfqQbPiT.mjs} +3 -3
  260. package/dist/{readTranscendYaml-BNn6-Ofi.mjs.map → readTranscendYaml-BfqQbPiT.mjs.map} +1 -1
  261. package/dist/{removeUnverifiedRequestIdentifiers-Do3Pus6m.mjs → removeUnverifiedRequestIdentifiers-BkAcUZZN.mjs} +2 -2
  262. package/dist/{removeUnverifiedRequestIdentifiers-Do3Pus6m.mjs.map → removeUnverifiedRequestIdentifiers-BkAcUZZN.mjs.map} +1 -1
  263. package/dist/{renderTable-D68QasPc.mjs → renderTable-CZP2roD1.mjs} +1 -1
  264. package/dist/{renderTable-D68QasPc.mjs.map → renderTable-CZP2roD1.mjs.map} +1 -1
  265. package/dist/{request-BiPv6jmP.mjs → request-BpKyN9Xm.mjs} +1 -1
  266. package/dist/{request-BiPv6jmP.mjs.map → request-BpKyN9Xm.mjs.map} +1 -1
  267. package/dist/{resolveBundleIdByName-qXZBrUz_.mjs → resolveBundleIdByName-Dm_o5_bg.mjs} +2 -2
  268. package/dist/{resolveBundleIdByName-qXZBrUz_.mjs.map → resolveBundleIdByName-Dm_o5_bg.mjs.map} +1 -1
  269. package/dist/{resolvePolicyBundleVersion-BG7XqBBP.mjs → resolvePolicyBundleVersion-DRUwe7fA.mjs} +2 -2
  270. package/dist/{resolvePolicyBundleVersion-BG7XqBBP.mjs.map → resolvePolicyBundleVersion-DRUwe7fA.mjs.map} +1 -1
  271. package/dist/{retryRequestDataSilos-CEgUW6Fx.mjs → retryRequestDataSilos-BoPmcB8-.mjs} +2 -2
  272. package/dist/{retryRequestDataSilos-CEgUW6Fx.mjs.map → retryRequestDataSilos-BoPmcB8-.mjs.map} +1 -1
  273. package/dist/{run-captured-process-BXwWXuTh.mjs → run-captured-process-BjaSDWXG.mjs} +1 -1
  274. package/dist/{run-captured-process-BXwWXuTh.mjs.map → run-captured-process-BjaSDWXG.mjs.map} +1 -1
  275. package/dist/{runOpa-CswzJxIs.mjs → runOpa-ojIqU1tO.mjs} +2 -2
  276. package/dist/{runOpa-CswzJxIs.mjs.map → runOpa-ojIqU1tO.mjs.map} +1 -1
  277. package/dist/{scaffold-model-BAbYTR0q.mjs → scaffold-model-CUZER0BC.mjs} +1 -1
  278. package/dist/scaffold-model-CUZER0BC.mjs.map +1 -0
  279. package/dist/{scaffold-planning-CNv83t_v.mjs → scaffold-planning-CaetLfv8.mjs} +9 -9
  280. package/dist/{scaffold-planning-CNv83t_v.mjs.map → scaffold-planning-CaetLfv8.mjs.map} +1 -1
  281. package/dist/{scaffold-templates-DzDGTZie.mjs → scaffold-templates-CUL82Zf8.mjs} +1 -1
  282. package/dist/{scaffold-templates-DzDGTZie.mjs.map → scaffold-templates-CUL82Zf8.mjs.map} +1 -1
  283. package/dist/{skipPreflightJobs-D_1mZ9mr.mjs → skipPreflightJobs-DkBdYw-r.mjs} +2 -2
  284. package/dist/{skipPreflightJobs-D_1mZ9mr.mjs.map → skipPreflightJobs-DkBdYw-r.mjs.map} +1 -1
  285. package/dist/{skipRequestDataSilos-CcGl9Z8M.mjs → skipRequestDataSilos-BRFiokix.mjs} +2 -2
  286. package/dist/{skipRequestDataSilos-CcGl9Z8M.mjs.map → skipRequestDataSilos-BRFiokix.mjs.map} +1 -1
  287. package/dist/{streamPrivacyRequestsToCsv-1l8RAcnK.mjs → streamPrivacyRequestsToCsv-Bt-H5J-y.mjs} +2 -2
  288. package/dist/{streamPrivacyRequestsToCsv-1l8RAcnK.mjs.map → streamPrivacyRequestsToCsv-Bt-H5J-y.mjs.map} +1 -1
  289. package/dist/{syncCodePackages-BHE2Tn1Q.mjs → syncCodePackages-CPkEukDm.mjs} +2 -2
  290. package/dist/{syncCodePackages-BHE2Tn1Q.mjs.map → syncCodePackages-CPkEukDm.mjs.map} +1 -1
  291. package/dist/{updateConsentManagerVersionToLatest-yZhBDcv8.mjs → updateConsentManagerVersionToLatest-DWblAwus.mjs} +2 -2
  292. package/dist/{updateConsentManagerVersionToLatest-yZhBDcv8.mjs.map → updateConsentManagerVersionToLatest-DWblAwus.mjs.map} +1 -1
  293. package/dist/{uploadConsents-DQqApEaH.mjs → uploadConsents-D7Vg8ZRW.mjs} +2 -2
  294. package/dist/{uploadConsents-DQqApEaH.mjs.map → uploadConsents-D7Vg8ZRW.mjs.map} +1 -1
  295. package/dist/{uploadPrivacyRequestsFromCsv-ntuK0eSR.mjs → uploadPrivacyRequestsFromCsv-B_hQwIn6.mjs} +2 -2
  296. package/dist/{uploadPrivacyRequestsFromCsv-ntuK0eSR.mjs.map → uploadPrivacyRequestsFromCsv-B_hQwIn6.mjs.map} +1 -1
  297. package/dist/validateTranscendAuth-D-dDINof.mjs +2 -0
  298. package/dist/{validateTranscendAuth-D6Wr1cxY.mjs.map → validateTranscendAuth-D-dDINof.mjs.map} +1 -1
  299. package/dist/{writeCsv-D-2siSwE.mjs → writeCsv-CNZrq3zU.mjs} +1 -1
  300. package/dist/{writeCsv-D-2siSwE.mjs.map → writeCsv-CNZrq3zU.mjs.map} +1 -1
  301. package/package.json +6 -5
  302. package/dist/app-DhG-JhT3.mjs +0 -148
  303. package/dist/app-DhG-JhT3.mjs.map +0 -1
  304. package/dist/command-Ds6oNo0v.mjs +0 -9
  305. package/dist/command-Ds6oNo0v.mjs.map +0 -1
  306. package/dist/deno-runtime-DV52X8-P.mjs +0 -2
  307. package/dist/deno-runtime-DV52X8-P.mjs.map +0 -1
  308. package/dist/impl--JGnR3wp.mjs +0 -3
  309. package/dist/impl-7UqkSO3x2.mjs +0 -2
  310. package/dist/impl-7UqkSO3x2.mjs.map +0 -1
  311. package/dist/impl-B4BgGuF_.mjs +0 -3
  312. package/dist/impl-B4BgGuF_.mjs.map +0 -1
  313. package/dist/impl-B5oVsX-F2.mjs +0 -303
  314. package/dist/impl-B5oVsX-F2.mjs.map +0 -1
  315. package/dist/impl-BEA5cQOT2.mjs.map +0 -1
  316. package/dist/impl-BhfxcCgN2.mjs.map +0 -1
  317. package/dist/impl-BppXJ1AD2.mjs.map +0 -1
  318. package/dist/impl-C6HtWd1t.mjs +0 -2
  319. package/dist/impl-C6HtWd1t.mjs.map +0 -1
  320. package/dist/impl-CO4ZqlLV.mjs +0 -3
  321. package/dist/impl-CO4ZqlLV.mjs.map +0 -1
  322. package/dist/impl-COujMWgp.mjs.map +0 -1
  323. package/dist/impl-CUOVJsRg.mjs +0 -3
  324. package/dist/impl-CUOVJsRg.mjs.map +0 -1
  325. package/dist/impl-CUiYbk6G.mjs +0 -3
  326. package/dist/impl-CUiYbk6G.mjs.map +0 -1
  327. package/dist/impl-CfvxD3RI.mjs.map +0 -1
  328. package/dist/impl-CiBT9-GH2.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-D-AHlqlD2.mjs +0 -4
  332. package/dist/impl-DPN1En7L.mjs +0 -2
  333. package/dist/impl-DPN1En7L.mjs.map +0 -1
  334. package/dist/impl-DPtx5iZO.mjs +0 -5
  335. package/dist/impl-DQPmSYSE.mjs +0 -2
  336. package/dist/impl-DXRDWiB1.mjs +0 -2
  337. package/dist/impl-DXRDWiB1.mjs.map +0 -1
  338. package/dist/impl-DdIa0zla.mjs +0 -2
  339. package/dist/impl-DdIa0zla.mjs.map +0 -1
  340. package/dist/impl-Dp4bZvAV.mjs +0 -2
  341. package/dist/impl-Dp4bZvAV.mjs.map +0 -1
  342. package/dist/impl-DryC3OJu.mjs +0 -2
  343. package/dist/impl-DryC3OJu.mjs.map +0 -1
  344. package/dist/impl-DzUTmaID2.mjs.map +0 -1
  345. package/dist/impl-GytUVAMP.mjs +0 -2
  346. package/dist/impl-Z8oWVENM.mjs +0 -2
  347. package/dist/impl-Z8oWVENM.mjs.map +0 -1
  348. package/dist/impl-a_Y8bnSn.mjs.map +0 -1
  349. package/dist/impl-lsmXIGSo2.mjs.map +0 -1
  350. package/dist/logger-zplFSeXU.mjs +0 -2
  351. package/dist/logger-zplFSeXU.mjs.map +0 -1
  352. package/dist/manifest-BNIpO_zW.mjs +0 -2
  353. package/dist/manifest-BNIpO_zW.mjs.map +0 -1
  354. package/dist/missing-manifest-DgcukXfg.mjs +0 -2
  355. package/dist/missing-manifest-DgcukXfg.mjs.map +0 -1
  356. package/dist/path-safety-D5Qwl40b.mjs +0 -2
  357. package/dist/path-safety-D5Qwl40b.mjs.map +0 -1
  358. package/dist/policy-bundle-manifest-D6dkbjNi.mjs +0 -7
  359. package/dist/policy-bundle-manifest-D6dkbjNi.mjs.map +0 -1
  360. package/dist/printResult-CHe3nRN4.mjs.map +0 -1
  361. package/dist/project-plan-apply-Dvndx455.mjs +0 -3
  362. package/dist/prompts-ClBXdELk.mjs +0 -4
  363. package/dist/prompts-ClBXdELk.mjs.map +0 -1
  364. package/dist/scaffold-model-BAbYTR0q.mjs.map +0 -1
  365. package/dist/validateTranscendAuth-D6Wr1cxY.mjs +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"pushManualEnrichmentIdentifiersFromCsv-0WHf6d_m.mjs","names":[],"sources":["../src/lib/manual-enrichment/enrichPrivacyRequest.ts","../src/lib/manual-enrichment/pushManualEnrichmentIdentifiersFromCsv.ts"],"sourcesContent":["import { splitCsvToList } from '@transcend-io/utils';\nimport colors from 'colors';\nimport type { Got } from 'got';\nimport * as t from 'io-ts';\nimport { uniq } from 'lodash-es';\n\nimport { logger } from '../../logger.js';\n\nconst ADMIN_URL = 'https://app.transcend.io/privacy-requests/incoming-requests/';\n/**\n * Minimal set required to mark as completed\n */\nexport const EnrichPrivacyRequest = t.record(t.string, t.string);\n\n/** Type override */\nexport type EnrichPrivacyRequest = t.TypeOf<typeof EnrichPrivacyRequest>;\n\n/**\n * Upload identifiers to a privacy request or mark request as\n *\n * @param sombra - Sombra instance configured to make requests\n * @param request - Request to enricher\n * @param enricherId - The ID of the enricher being uploaded to\n * @param index - Index of request ID\n * @returns True if enriched successfully, false if skipped, throws error if failed\n */\nexport async function enrichPrivacyRequest(\n sombra: Got,\n { id: rawId, ...rest }: EnrichPrivacyRequest,\n enricherId: string,\n index?: number,\n): Promise<boolean> {\n if (!rawId) {\n // error\n const msg = `Request ID must be provided to enricher request.${\n index ? ` Found error in row: ${index}` : ''\n }`;\n logger.error(colors.red(msg));\n throw new Error(msg);\n }\n\n const id = rawId.toLowerCase();\n\n // Pull out the identifiers\n const enrichedIdentifiers = Object.entries(rest).reduce(\n (acc, [key, value]) => {\n const values = uniq(splitCsvToList(value));\n return values.length === 0\n ? acc\n : Object.assign(acc, {\n [key]: uniq(splitCsvToList(value)).map((val) => ({\n value: key === 'email' ? val.toLowerCase() : val,\n })),\n });\n },\n {} as Record<string, string[]>,\n );\n\n // Make the GraphQL request\n try {\n await sombra\n .post('v1/enrich-identifiers', {\n headers: {\n 'x-transcend-request-id': id,\n 'x-transcend-enricher-id': enricherId,\n },\n json: {\n enrichedIdentifiers,\n },\n })\n .json();\n\n logger.error(colors.green(`Successfully enriched request: ${ADMIN_URL}${id}`));\n return true;\n } catch (err) {\n // skip if already enriched\n if (\n typeof err.response.body === 'string' &&\n err.response.body.includes('Cannot update a resolved RequestEnricher')\n ) {\n logger.warn(\n colors.magenta(\n `Skipped enrichment for request: ${ADMIN_URL}${id}, request is no longer in the enriching phase.`,\n ),\n );\n return false;\n }\n\n // error\n logger.error(\n colors.red(\n `Failed to enricher identifiers for request with id: ${ADMIN_URL}${id} - ${err.message} - ${err.response.body}`,\n ),\n );\n throw err;\n }\n}\n","import {\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n makeGraphQLRequest,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { UPDATE_PRIVACY_REQUEST } from '../graphql/index.js';\nimport { readCsv } from '../requests/index.js';\nimport { enrichPrivacyRequest, EnrichPrivacyRequest } from './enrichPrivacyRequest.js';\n\n/**\n * Push a CSV of enriched requests back into Transcend\n *\n * @param options - Options\n * @returns Number of items processed\n */\nexport async function pushManualEnrichmentIdentifiersFromCsv({\n file,\n auth,\n sombraAuth,\n enricherId,\n markSilent,\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** ID of enricher being uploaded to */\n enricherId: string;\n /** Sombra API key authentication */\n sombraAuth?: string;\n /** Concurrency */\n concurrency?: number;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** Mark requests in silent mode before enriching */\n markSilent?: boolean;\n}): Promise<number> {\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, {\n logger,\n sombraApiKey: sombraAuth,\n sombraUrl: process.env.SOMBRA_URL,\n });\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read from CSV\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const activeResults = readCsv(file, EnrichPrivacyRequest);\n\n // Notify Transcend\n logger.info(colors.magenta(`Enriching \"${activeResults.length}\" privacy requests.`));\n\n let successCount = 0;\n let skippedCount = 0;\n let errorCount = 0;\n\n await map(\n activeResults,\n async (request, index) => {\n try {\n // Mark requests in silent mode before a certain date\n if (markSilent) {\n await makeGraphQLRequest(client, UPDATE_PRIVACY_REQUEST, {\n variables: {\n input: {\n id: request.id,\n isSilent: true,\n },\n },\n logger,\n });\n\n logger.info(colors.magenta(`Mark request as silent mode - ${request.id}`));\n }\n\n const result = await enrichPrivacyRequest(sombra, request, enricherId, index);\n if (result) {\n successCount += 1;\n } else {\n skippedCount += 1;\n }\n } catch {\n errorCount += 1;\n }\n },\n { concurrency },\n );\n\n logger.info(colors.green(`Successfully notified Transcend! \\n Success count: ${successCount}.`));\n\n if (skippedCount > 0) {\n logger.info(colors.magenta(`Skipped count: ${skippedCount}.`));\n }\n\n if (errorCount > 0) {\n logger.info(colors.red(`Error Count: ${errorCount}.`));\n throw new Error(`Failed to enrich: ${errorCount} requests.`);\n }\n\n return activeResults.length;\n}\n"],"mappings":"qaAQA,MAAM,EAAY,+DAIL,EAAuB,EAAE,OAAO,EAAE,OAAQ,EAAE,OAAO,CAchE,eAAsB,EACpB,EACA,CAAE,GAAI,EAAO,GAAG,GAChB,EACA,EACkB,CAClB,GAAI,CAAC,EAAO,CAEV,IAAM,EAAM,mDACV,EAAQ,wBAAwB,IAAU,KAG5C,MADA,EAAO,MAAM,EAAO,IAAI,EAAI,CAAC,CACnB,MAAM,EAAI,CAGtB,IAAM,EAAK,EAAM,aAAa,CAGxB,EAAsB,OAAO,QAAQ,EAAK,CAAC,QAC9C,EAAK,CAAC,EAAK,KACK,EAAK,EAAe,EAAM,CAC5B,CAAC,SAAW,EACrB,EACA,OAAO,OAAO,EAAK,EAChB,GAAM,EAAK,EAAe,EAAM,CAAC,CAAC,IAAK,IAAS,CAC/C,MAAO,IAAQ,QAAU,EAAI,aAAa,CAAG,EAC9C,EAAE,CACJ,CAAC,CAER,EAAE,CACH,CAGD,GAAI,CAcF,OAbA,MAAM,EACH,KAAK,wBAAyB,CAC7B,QAAS,CACP,yBAA0B,EAC1B,0BAA2B,EAC5B,CACD,KAAM,CACJ,sBACD,CACF,CAAC,CACD,MAAM,CAET,EAAO,MAAM,EAAO,MAAM,kCAAkC,IAAY,IAAK,CAAC,CACvE,SACA,EAAK,CAEZ,GACE,OAAO,EAAI,SAAS,MAAS,UAC7B,EAAI,SAAS,KAAK,SAAS,2CAA2C,CAOtE,OALA,EAAO,KACL,EAAO,QACL,mCAAmC,IAAY,EAAG,gDACnD,CACF,CACM,GAST,MALA,EAAO,MACL,EAAO,IACL,uDAAuD,IAAY,EAAG,KAAK,EAAI,QAAQ,KAAK,EAAI,SAAS,OAC1G,CACF,CACK,GC1EV,eAAsB,EAAuC,CAC3D,OACA,OACA,aACA,aACA,aACA,cAAc,IACd,eAAe,GAgBG,CAElB,IAAM,EAAS,MAAM,EAAwB,EAAc,EAAM,CAC/D,SACA,aAAc,EACd,UAAW,QAAQ,IAAI,WACxB,CAAC,CACI,EAAS,EAA4B,EAAc,EAAK,CAG9D,EAAO,KAAK,EAAO,QAAQ,YAAY,EAAK,aAAa,CAAC,CAC1D,IAAM,EAAgB,EAAQ,EAAM,EAAqB,CAGzD,EAAO,KAAK,EAAO,QAAQ,cAAc,EAAc,OAAO,qBAAqB,CAAC,CAEpF,IAAI,EAAe,EACf,EAAe,EACf,EAAa,EAwCjB,GAtCA,MAAM,EACJ,EACA,MAAO,EAAS,IAAU,CACxB,GAAI,CAEE,IACF,MAAM,EAAmB,EAAQ,EAAwB,CACvD,UAAW,CACT,MAAO,CACL,GAAI,EAAQ,GACZ,SAAU,GACX,CACF,CACD,SACD,CAAC,CAEF,EAAO,KAAK,EAAO,QAAQ,iCAAiC,EAAQ,KAAK,CAAC,EAIxE,MADiB,EAAqB,EAAQ,EAAS,EAAY,EAAM,CAE3E,GAAgB,EAEhB,GAAgB,OAEZ,CACN,GAAc,IAGlB,CAAE,cAAa,CAChB,CAED,EAAO,KAAK,EAAO,MAAM,sDAAsD,EAAa,GAAG,CAAC,CAE5F,EAAe,GACjB,EAAO,KAAK,EAAO,QAAQ,kBAAkB,EAAa,GAAG,CAAC,CAG5D,EAAa,EAEf,MADA,EAAO,KAAK,EAAO,IAAI,gBAAgB,EAAW,GAAG,CAAC,CAC5C,MAAM,qBAAqB,EAAW,YAAY,CAG9D,OAAO,EAAc"}
1
+ {"version":3,"file":"pushManualEnrichmentIdentifiersFromCsv-BTJGOmdU.mjs","names":[],"sources":["../src/lib/manual-enrichment/enrichPrivacyRequest.ts","../src/lib/manual-enrichment/pushManualEnrichmentIdentifiersFromCsv.ts"],"sourcesContent":["import { splitCsvToList } from '@transcend-io/utils';\nimport colors from 'colors';\nimport type { Got } from 'got';\nimport * as t from 'io-ts';\nimport { uniq } from 'lodash-es';\n\nimport { logger } from '../../logger.js';\n\nconst ADMIN_URL = 'https://app.transcend.io/privacy-requests/incoming-requests/';\n/**\n * Minimal set required to mark as completed\n */\nexport const EnrichPrivacyRequest = t.record(t.string, t.string);\n\n/** Type override */\nexport type EnrichPrivacyRequest = t.TypeOf<typeof EnrichPrivacyRequest>;\n\n/**\n * Upload identifiers to a privacy request or mark request as\n *\n * @param sombra - Sombra instance configured to make requests\n * @param request - Request to enricher\n * @param enricherId - The ID of the enricher being uploaded to\n * @param index - Index of request ID\n * @returns True if enriched successfully, false if skipped, throws error if failed\n */\nexport async function enrichPrivacyRequest(\n sombra: Got,\n { id: rawId, ...rest }: EnrichPrivacyRequest,\n enricherId: string,\n index?: number,\n): Promise<boolean> {\n if (!rawId) {\n // error\n const msg = `Request ID must be provided to enricher request.${\n index ? ` Found error in row: ${index}` : ''\n }`;\n logger.error(colors.red(msg));\n throw new Error(msg);\n }\n\n const id = rawId.toLowerCase();\n\n // Pull out the identifiers\n const enrichedIdentifiers = Object.entries(rest).reduce(\n (acc, [key, value]) => {\n const values = uniq(splitCsvToList(value));\n return values.length === 0\n ? acc\n : Object.assign(acc, {\n [key]: uniq(splitCsvToList(value)).map((val) => ({\n value: key === 'email' ? val.toLowerCase() : val,\n })),\n });\n },\n {} as Record<string, string[]>,\n );\n\n // Make the GraphQL request\n try {\n await sombra\n .post('v1/enrich-identifiers', {\n headers: {\n 'x-transcend-request-id': id,\n 'x-transcend-enricher-id': enricherId,\n },\n json: {\n enrichedIdentifiers,\n },\n })\n .json();\n\n logger.error(colors.green(`Successfully enriched request: ${ADMIN_URL}${id}`));\n return true;\n } catch (err) {\n // skip if already enriched\n if (\n typeof err.response.body === 'string' &&\n err.response.body.includes('Cannot update a resolved RequestEnricher')\n ) {\n logger.warn(\n colors.magenta(\n `Skipped enrichment for request: ${ADMIN_URL}${id}, request is no longer in the enriching phase.`,\n ),\n );\n return false;\n }\n\n // error\n logger.error(\n colors.red(\n `Failed to enricher identifiers for request with id: ${ADMIN_URL}${id} - ${err.message} - ${err.response.body}`,\n ),\n );\n throw err;\n }\n}\n","import {\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n makeGraphQLRequest,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { UPDATE_PRIVACY_REQUEST } from '../graphql/index.js';\nimport { readCsv } from '../requests/index.js';\nimport { enrichPrivacyRequest, EnrichPrivacyRequest } from './enrichPrivacyRequest.js';\n\n/**\n * Push a CSV of enriched requests back into Transcend\n *\n * @param options - Options\n * @returns Number of items processed\n */\nexport async function pushManualEnrichmentIdentifiersFromCsv({\n file,\n auth,\n sombraAuth,\n enricherId,\n markSilent,\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** ID of enricher being uploaded to */\n enricherId: string;\n /** Sombra API key authentication */\n sombraAuth?: string;\n /** Concurrency */\n concurrency?: number;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** Mark requests in silent mode before enriching */\n markSilent?: boolean;\n}): Promise<number> {\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, {\n logger,\n sombraApiKey: sombraAuth,\n sombraUrl: process.env.SOMBRA_URL,\n });\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read from CSV\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const activeResults = readCsv(file, EnrichPrivacyRequest);\n\n // Notify Transcend\n logger.info(colors.magenta(`Enriching \"${activeResults.length}\" privacy requests.`));\n\n let successCount = 0;\n let skippedCount = 0;\n let errorCount = 0;\n\n await map(\n activeResults,\n async (request, index) => {\n try {\n // Mark requests in silent mode before a certain date\n if (markSilent) {\n await makeGraphQLRequest(client, UPDATE_PRIVACY_REQUEST, {\n variables: {\n input: {\n id: request.id,\n isSilent: true,\n },\n },\n logger,\n });\n\n logger.info(colors.magenta(`Mark request as silent mode - ${request.id}`));\n }\n\n const result = await enrichPrivacyRequest(sombra, request, enricherId, index);\n if (result) {\n successCount += 1;\n } else {\n skippedCount += 1;\n }\n } catch {\n errorCount += 1;\n }\n },\n { concurrency },\n );\n\n logger.info(colors.green(`Successfully notified Transcend! \\n Success count: ${successCount}.`));\n\n if (skippedCount > 0) {\n logger.info(colors.magenta(`Skipped count: ${skippedCount}.`));\n }\n\n if (errorCount > 0) {\n logger.info(colors.red(`Error Count: ${errorCount}.`));\n throw new Error(`Failed to enrich: ${errorCount} requests.`);\n }\n\n return activeResults.length;\n}\n"],"mappings":"qaAQA,MAAM,EAAY,+DAIL,EAAuB,EAAE,OAAO,EAAE,OAAQ,EAAE,OAAO,CAchE,eAAsB,EACpB,EACA,CAAE,GAAI,EAAO,GAAG,GAChB,EACA,EACkB,CAClB,GAAI,CAAC,EAAO,CAEV,IAAM,EAAM,mDACV,EAAQ,wBAAwB,IAAU,KAG5C,MADA,EAAO,MAAM,EAAO,IAAI,EAAI,CAAC,CACnB,MAAM,EAAI,CAGtB,IAAM,EAAK,EAAM,aAAa,CAGxB,EAAsB,OAAO,QAAQ,EAAK,CAAC,QAC9C,EAAK,CAAC,EAAK,KACK,EAAK,EAAe,EAAM,CAC5B,CAAC,SAAW,EACrB,EACA,OAAO,OAAO,EAAK,EAChB,GAAM,EAAK,EAAe,EAAM,CAAC,CAAC,IAAK,IAAS,CAC/C,MAAO,IAAQ,QAAU,EAAI,aAAa,CAAG,EAC9C,EAAE,CACJ,CAAC,CAER,EAAE,CACH,CAGD,GAAI,CAcF,OAbA,MAAM,EACH,KAAK,wBAAyB,CAC7B,QAAS,CACP,yBAA0B,EAC1B,0BAA2B,EAC5B,CACD,KAAM,CACJ,sBACD,CACF,CAAC,CACD,MAAM,CAET,EAAO,MAAM,EAAO,MAAM,kCAAkC,IAAY,IAAK,CAAC,CACvE,SACA,EAAK,CAEZ,GACE,OAAO,EAAI,SAAS,MAAS,UAC7B,EAAI,SAAS,KAAK,SAAS,2CAA2C,CAOtE,OALA,EAAO,KACL,EAAO,QACL,mCAAmC,IAAY,EAAG,gDACnD,CACF,CACM,GAST,MALA,EAAO,MACL,EAAO,IACL,uDAAuD,IAAY,EAAG,KAAK,EAAI,QAAQ,KAAK,EAAI,SAAS,OAC1G,CACF,CACK,GC1EV,eAAsB,EAAuC,CAC3D,OACA,OACA,aACA,aACA,aACA,cAAc,IACd,eAAe,GAgBG,CAElB,IAAM,EAAS,MAAM,EAAwB,EAAc,EAAM,CAC/D,SACA,aAAc,EACd,UAAW,QAAQ,IAAI,WACxB,CAAC,CACI,EAAS,EAA4B,EAAc,EAAK,CAG9D,EAAO,KAAK,EAAO,QAAQ,YAAY,EAAK,aAAa,CAAC,CAC1D,IAAM,EAAgB,EAAQ,EAAM,EAAqB,CAGzD,EAAO,KAAK,EAAO,QAAQ,cAAc,EAAc,OAAO,qBAAqB,CAAC,CAEpF,IAAI,EAAe,EACf,EAAe,EACf,EAAa,EAwCjB,GAtCA,MAAM,EACJ,EACA,MAAO,EAAS,IAAU,CACxB,GAAI,CAEE,IACF,MAAM,EAAmB,EAAQ,EAAwB,CACvD,UAAW,CACT,MAAO,CACL,GAAI,EAAQ,GACZ,SAAU,GACX,CACF,CACD,SACD,CAAC,CAEF,EAAO,KAAK,EAAO,QAAQ,iCAAiC,EAAQ,KAAK,CAAC,EAIxE,MADiB,EAAqB,EAAQ,EAAS,EAAY,EAAM,CAE3E,GAAgB,EAEhB,GAAgB,OAEZ,CACN,GAAc,IAGlB,CAAE,cAAa,CAChB,CAED,EAAO,KAAK,EAAO,MAAM,sDAAsD,EAAa,GAAG,CAAC,CAE5F,EAAe,GACjB,EAAO,KAAK,EAAO,QAAQ,kBAAkB,EAAa,GAAG,CAAC,CAG5D,EAAa,EAEf,MADA,EAAO,KAAK,EAAO,IAAI,gBAAgB,EAAW,GAAG,CAAC,CAC5C,MAAM,qBAAqB,EAAW,YAAY,CAG9D,OAAO,EAAc"}
@@ -1,2 +1,2 @@
1
1
  import{readFileSync as e}from"node:fs";import{decodeCodec as t}from"@transcend-io/type-utils";import*as n from"io-ts";import{parse as r}from"csv-parse/sync";function i(e,i,a={columns:!0}){let o=r(e,a);return t(n.array(i),o).map(e=>Object.entries(e).reduce((e,[t,n])=>Object.assign(e,{[t.replace(/[^a-z_.+\-A-Z -~]/g,``)]:n}),{}))}function a(t,n,r={columns:!0}){return i(e(t,`utf-8`),n,r)}export{a as n,i as t};
2
- //# sourceMappingURL=readCsv-DLg8pwjd.mjs.map
2
+ //# sourceMappingURL=readCsv-DNcJ_UfU.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"readCsv-DLg8pwjd.mjs","names":[],"sources":["../src/lib/requests/readCsv.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\n\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport type { Options } from 'csv-parse';\nimport { parse } from 'csv-parse/sync';\nimport * as t from 'io-ts';\n\n/**\n * Parse CSV contents and validate their shape.\n *\n * @param contents - CSV contents.\n * @param codec - The codec to validate against. This is the codec for individual, non-header, rows\n * @param options - CSV parse options\n * @returns The JSON data\n */\nexport function parseCsv<T extends t.Any>(\n contents: string,\n codec: T,\n options: Options = { columns: true },\n): t.TypeOf<T>[] {\n const fileContent = parse(contents, options);\n\n // validate codec\n const data = decodeCodec(t.array(codec), fileContent);\n\n // remove any special characters from object keys\n const parsed = data.map((datum) =>\n Object.entries(datum).reduce(\n (acc, [key, value]) =>\n Object.assign(acc, {\n [key.replace(/[^a-z_.+\\-A-Z -~]/g, '')]: value,\n }),\n {} as T,\n ),\n );\n return parsed;\n}\n\n/**\n * Read in a CSV and validate its shape.\n *\n * @param pathToFile - Path to file.\n * @param codec - The codec to validate against. This is the codec for individual, non-header, rows.\n * @param options - CSV parse options.\n * @returns The JSON data.\n */\nexport function readCsv<T extends t.Any>(\n pathToFile: string,\n codec: T,\n options: Options = { columns: true },\n): t.TypeOf<T>[] {\n return parseCsv(readFileSync(pathToFile, 'utf-8'), codec, options);\n}\n"],"mappings":"6JAeA,SAAgB,EACd,EACA,EACA,EAAmB,CAAE,QAAS,GAAM,CACrB,CACf,IAAM,EAAc,EAAM,EAAU,EAAQ,CAe5C,OAZa,EAAY,EAAE,MAAM,EAAM,CAAE,EAGtB,CAAC,IAAK,GACvB,OAAO,QAAQ,EAAM,CAAC,QACnB,EAAK,CAAC,EAAK,KACV,OAAO,OAAO,EAAK,EAChB,EAAI,QAAQ,qBAAsB,GAAG,EAAG,EAC1C,CAAC,CACJ,EAAE,CACH,CAEU,CAWf,SAAgB,EACd,EACA,EACA,EAAmB,CAAE,QAAS,GAAM,CACrB,CACf,OAAO,EAAS,EAAa,EAAY,QAAQ,CAAE,EAAO,EAAQ"}
1
+ {"version":3,"file":"readCsv-DNcJ_UfU.mjs","names":[],"sources":["../src/lib/requests/readCsv.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\n\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport type { Options } from 'csv-parse';\nimport { parse } from 'csv-parse/sync';\nimport * as t from 'io-ts';\n\n/**\n * Parse CSV contents and validate their shape.\n *\n * @param contents - CSV contents.\n * @param codec - The codec to validate against. This is the codec for individual, non-header, rows\n * @param options - CSV parse options\n * @returns The JSON data\n */\nexport function parseCsv<T extends t.Any>(\n contents: string,\n codec: T,\n options: Options = { columns: true },\n): t.TypeOf<T>[] {\n const fileContent = parse(contents, options);\n\n // validate codec\n const data = decodeCodec(t.array(codec), fileContent);\n\n // remove any special characters from object keys\n const parsed = data.map((datum) =>\n Object.entries(datum).reduce(\n (acc, [key, value]) =>\n Object.assign(acc, {\n [key.replace(/[^a-z_.+\\-A-Z -~]/g, '')]: value,\n }),\n {} as T,\n ),\n );\n return parsed;\n}\n\n/**\n * Read in a CSV and validate its shape.\n *\n * @param pathToFile - Path to file.\n * @param codec - The codec to validate against. This is the codec for individual, non-header, rows.\n * @param options - CSV parse options.\n * @returns The JSON data.\n */\nexport function readCsv<T extends t.Any>(\n pathToFile: string,\n codec: T,\n options: Options = { columns: true },\n): t.TypeOf<T>[] {\n return parseCsv(readFileSync(pathToFile, 'utf-8'), codec, options);\n}\n"],"mappings":"6JAeA,SAAgB,EACd,EACA,EACA,EAAmB,CAAE,QAAS,GAAM,CACrB,CACf,IAAM,EAAc,EAAM,EAAU,EAAQ,CAe5C,OAZa,EAAY,EAAE,MAAM,EAAM,CAAE,EAGtB,CAAC,IAAK,GACvB,OAAO,QAAQ,EAAM,CAAC,QACnB,EAAK,CAAC,EAAK,KACV,OAAO,OAAO,EAAK,EAChB,EAAI,QAAQ,qBAAsB,GAAG,EAAG,EAC1C,CAAC,CACJ,EAAE,CACH,CAEU,CAWf,SAAgB,EACd,EACA,EACA,EAAmB,CAAE,QAAS,GAAM,CACrB,CACf,OAAO,EAAS,EAAa,EAAY,QAAQ,CAAE,EAAO,EAAQ"}
@@ -1,4 +1,4 @@
1
- import{ft as e,gt as t}from"./codecs-CTxFjCg4.mjs";import{readFileSync as n,writeFileSync as r}from"node:fs";import{decodeCodec as i}from"@transcend-io/type-utils";import a from"js-yaml";const o=/<<parameters\.(.+?)>>/,s=`parameters`;function c(e,t,n=``){let r=Object.entries(t).reduce((e,[t,n])=>e.split(`<<${s}.${t}>>`).join(n),e);if(o.test(r)){let[,e]=o.exec(r)||[];throw Error(`Found variable that was not set: ${e}.
1
+ import{ft as e,gt as t}from"./codecs-CfcaFoZR.mjs";import n from"js-yaml";import{readFileSync as r,writeFileSync as i}from"node:fs";import{decodeCodec as a}from"@transcend-io/type-utils";const o=/<<parameters\.(.+?)>>/,s=`parameters`;function c(e,t,n=``){let r=Object.entries(t).reduce((e,[t,n])=>e.split(`<<${s}.${t}>>`).join(n),e);if(o.test(r)){let[,e]=o.exec(r)||[];throw Error(`Found variable that was not set: ${e}.
2
2
  Make sure you are passing all variables through the --variables=${e}:value-for-variable flag.
3
- ${n}`)}return r}function l(n,r={},o){let s=c(n,r,o?`Also check that there are no extra variables defined in your yaml: ${o}`:``);return t(i(e,a.load(s)))}function u(n){return a.dump(i(e,t(n)))}function d(e,t={}){return l(n(e,`utf-8`),t,e)}function f(e,t){r(e,u(t))}export{c as a,d as i,o as n,u as o,l as r,f as s,s as t};
4
- //# sourceMappingURL=readTranscendYaml-BNn6-Ofi.mjs.map
3
+ ${n}`)}return r}function l(r,i={},o){let s=c(r,i,o?`Also check that there are no extra variables defined in your yaml: ${o}`:``);return t(a(e,n.load(s)))}function u(r){return n.dump(a(e,t(r)))}function d(e,t={}){return l(r(e,`utf-8`),t,e)}function f(e,t){i(e,u(t))}export{c as a,d as i,o as n,u as o,l as r,f as s,s as t};
4
+ //# sourceMappingURL=readTranscendYaml-BfqQbPiT.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"readTranscendYaml-BNn6-Ofi.mjs","names":[],"sources":["../src/lib/readTranscendYaml.ts"],"sourcesContent":["import { readFileSync, writeFileSync } from 'node:fs';\n\nimport { decodeCodec, ObjByString } from '@transcend-io/type-utils';\nimport yaml from 'js-yaml';\n\nimport { normalizeTranscendInput, TranscendInput } from '../codecs.js';\n\nexport const VARIABLE_PARAMETERS_REGEXP = /<<parameters\\.(.+?)>>/;\nexport const VARIABLE_PARAMETERS_NAME = 'parameters';\n\n/**\n * Function that replaces variables in a text file.\n * Throws error if there are variables that have not been replaced\n *\n * @param input - Input text\n * @param variables - Variables to replace\n * @param extraErrorMessage - Additional error message text\n * @returns Output text\n */\nexport function replaceVariablesInYaml(\n input: string,\n variables: ObjByString,\n extraErrorMessage = '',\n): string {\n const contents = Object.entries(variables).reduce(\n (replaced, [name, value]) =>\n replaced.split(`<<${VARIABLE_PARAMETERS_NAME}.${name}>>`).join(value),\n input,\n );\n\n // Throw error if unfilled parameters\n if (VARIABLE_PARAMETERS_REGEXP.test(contents)) {\n const [, name] = VARIABLE_PARAMETERS_REGEXP.exec(contents) || [];\n throw new Error(\n `Found variable that was not set: ${name}.\nMake sure you are passing all variables through the --variables=${name}:value-for-variable flag.\n${extraErrorMessage}`,\n );\n }\n\n return contents;\n}\n\n/**\n * Parse YAML contents and validate that their shape matches the codec API.\n *\n * @param contents - YAML contents.\n * @param variables - Variables to fill in\n * @param sourcePath - Optional source path included in parameter errors.\n * @returns The parsed contents, type-checked.\n */\nexport function parseTranscendYaml(\n contents: string,\n variables: ObjByString = {},\n sourcePath?: string,\n): TranscendInput {\n const replacedVariables = replaceVariablesInYaml(\n contents,\n variables,\n sourcePath\n ? `Also check that there are no extra variables defined in your yaml: ${sourcePath}`\n : '',\n );\n\n return normalizeTranscendInput(decodeCodec(TranscendInput, yaml.load(replacedVariables)));\n}\n\n/**\n * Serialize a validated Transcend configuration as YAML.\n *\n * @param input - The input to serialize.\n * @returns YAML contents.\n */\nexport function serializeTranscendYaml(input: TranscendInput): string {\n return yaml.dump(decodeCodec(TranscendInput, normalizeTranscendInput(input)));\n}\n\n/**\n * Read in the contents of a YAML file and validate that its shape matches the codec API.\n *\n * @param filePath - Path to YAML file.\n * @param variables - Variables to fill in.\n * @returns The parsed contents, type-checked.\n */\nexport function readTranscendYaml(filePath: string, variables: ObjByString = {}): TranscendInput {\n return parseTranscendYaml(readFileSync(filePath, 'utf-8'), variables, filePath);\n}\n\n/**\n * Write a Transcend configuration to disk.\n *\n * @param filePath - Path to YAML file.\n * @param input - The input to write out.\n */\nexport function writeTranscendYaml(filePath: string, input: TranscendInput): void {\n writeFileSync(filePath, serializeTranscendYaml(input));\n}\n"],"mappings":"2LAOA,MAAa,EAA6B,wBAC7B,EAA2B,aAWxC,SAAgB,EACd,EACA,EACA,EAAoB,GACZ,CACR,IAAM,EAAW,OAAO,QAAQ,EAAU,CAAC,QACxC,EAAU,CAAC,EAAM,KAChB,EAAS,MAAM,KAAK,EAAyB,GAAG,EAAK,IAAI,CAAC,KAAK,EAAM,CACvE,EACD,CAGD,GAAI,EAA2B,KAAK,EAAS,CAAE,CAC7C,GAAM,EAAG,GAAQ,EAA2B,KAAK,EAAS,EAAI,EAAE,CAChE,MAAU,MACR,oCAAoC,EAAK;kEACmB,EAAK;EACrE,IACG,CAGH,OAAO,EAWT,SAAgB,EACd,EACA,EAAyB,EAAE,CAC3B,EACgB,CAChB,IAAM,EAAoB,EACxB,EACA,EACA,EACI,sEAAsE,IACtE,GACL,CAED,OAAO,EAAwB,EAAY,EAAgB,EAAK,KAAK,EAAkB,CAAC,CAAC,CAS3F,SAAgB,EAAuB,EAA+B,CACpE,OAAO,EAAK,KAAK,EAAY,EAAgB,EAAwB,EAAM,CAAC,CAAC,CAU/E,SAAgB,EAAkB,EAAkB,EAAyB,EAAE,CAAkB,CAC/F,OAAO,EAAmB,EAAa,EAAU,QAAQ,CAAE,EAAW,EAAS,CASjF,SAAgB,EAAmB,EAAkB,EAA6B,CAChF,EAAc,EAAU,EAAuB,EAAM,CAAC"}
1
+ {"version":3,"file":"readTranscendYaml-BfqQbPiT.mjs","names":[],"sources":["../src/lib/readTranscendYaml.ts"],"sourcesContent":["import { readFileSync, writeFileSync } from 'node:fs';\n\nimport { decodeCodec, ObjByString } from '@transcend-io/type-utils';\nimport yaml from 'js-yaml';\n\nimport { normalizeTranscendInput, TranscendInput } from '../codecs.js';\n\nexport const VARIABLE_PARAMETERS_REGEXP = /<<parameters\\.(.+?)>>/;\nexport const VARIABLE_PARAMETERS_NAME = 'parameters';\n\n/**\n * Function that replaces variables in a text file.\n * Throws error if there are variables that have not been replaced\n *\n * @param input - Input text\n * @param variables - Variables to replace\n * @param extraErrorMessage - Additional error message text\n * @returns Output text\n */\nexport function replaceVariablesInYaml(\n input: string,\n variables: ObjByString,\n extraErrorMessage = '',\n): string {\n const contents = Object.entries(variables).reduce(\n (replaced, [name, value]) =>\n replaced.split(`<<${VARIABLE_PARAMETERS_NAME}.${name}>>`).join(value),\n input,\n );\n\n // Throw error if unfilled parameters\n if (VARIABLE_PARAMETERS_REGEXP.test(contents)) {\n const [, name] = VARIABLE_PARAMETERS_REGEXP.exec(contents) || [];\n throw new Error(\n `Found variable that was not set: ${name}.\nMake sure you are passing all variables through the --variables=${name}:value-for-variable flag.\n${extraErrorMessage}`,\n );\n }\n\n return contents;\n}\n\n/**\n * Parse YAML contents and validate that their shape matches the codec API.\n *\n * @param contents - YAML contents.\n * @param variables - Variables to fill in\n * @param sourcePath - Optional source path included in parameter errors.\n * @returns The parsed contents, type-checked.\n */\nexport function parseTranscendYaml(\n contents: string,\n variables: ObjByString = {},\n sourcePath?: string,\n): TranscendInput {\n const replacedVariables = replaceVariablesInYaml(\n contents,\n variables,\n sourcePath\n ? `Also check that there are no extra variables defined in your yaml: ${sourcePath}`\n : '',\n );\n\n return normalizeTranscendInput(decodeCodec(TranscendInput, yaml.load(replacedVariables)));\n}\n\n/**\n * Serialize a validated Transcend configuration as YAML.\n *\n * @param input - The input to serialize.\n * @returns YAML contents.\n */\nexport function serializeTranscendYaml(input: TranscendInput): string {\n return yaml.dump(decodeCodec(TranscendInput, normalizeTranscendInput(input)));\n}\n\n/**\n * Read in the contents of a YAML file and validate that its shape matches the codec API.\n *\n * @param filePath - Path to YAML file.\n * @param variables - Variables to fill in.\n * @returns The parsed contents, type-checked.\n */\nexport function readTranscendYaml(filePath: string, variables: ObjByString = {}): TranscendInput {\n return parseTranscendYaml(readFileSync(filePath, 'utf-8'), variables, filePath);\n}\n\n/**\n * Write a Transcend configuration to disk.\n *\n * @param filePath - Path to YAML file.\n * @param input - The input to write out.\n */\nexport function writeTranscendYaml(filePath: string, input: TranscendInput): void {\n writeFileSync(filePath, serializeTranscendYaml(input));\n}\n"],"mappings":"2LAOA,MAAa,EAA6B,wBAC7B,EAA2B,aAWxC,SAAgB,EACd,EACA,EACA,EAAoB,GACZ,CACR,IAAM,EAAW,OAAO,QAAQ,EAAU,CAAC,QACxC,EAAU,CAAC,EAAM,KAChB,EAAS,MAAM,KAAK,EAAyB,GAAG,EAAK,IAAI,CAAC,KAAK,EAAM,CACvE,EACD,CAGD,GAAI,EAA2B,KAAK,EAAS,CAAE,CAC7C,GAAM,EAAG,GAAQ,EAA2B,KAAK,EAAS,EAAI,EAAE,CAChE,MAAU,MACR,oCAAoC,EAAK;kEACmB,EAAK;EACrE,IACG,CAGH,OAAO,EAWT,SAAgB,EACd,EACA,EAAyB,EAAE,CAC3B,EACgB,CAChB,IAAM,EAAoB,EACxB,EACA,EACA,EACI,sEAAsE,IACtE,GACL,CAED,OAAO,EAAwB,EAAY,EAAgB,EAAK,KAAK,EAAkB,CAAC,CAAC,CAS3F,SAAgB,EAAuB,EAA+B,CACpE,OAAO,EAAK,KAAK,EAAY,EAAgB,EAAwB,EAAM,CAAC,CAAC,CAU/E,SAAgB,EAAkB,EAAkB,EAAyB,EAAE,CAAkB,CAC/F,OAAO,EAAmB,EAAa,EAAU,QAAQ,CAAE,EAAW,EAAS,CASjF,SAAgB,EAAmB,EAAkB,EAA6B,CAChF,EAAc,EAAU,EAAuB,EAAM,CAAC"}
@@ -1,2 +1,2 @@
1
- import{a as e}from"./constants-Upxn_rQF.mjs";import{t}from"./logger-zplFSeXU.mjs";import{r as n}from"./fetchAllRequests-2TZr-LfT.mjs";import{RequestStatus as r}from"@transcend-io/privacy-types";import i from"colors";import{REMOVE_REQUEST_IDENTIFIERS as a,buildTranscendGraphQLClient as o,fetchAllRequestIdentifierMetadata as s,makeGraphQLRequest as c}from"@transcend-io/sdk";import{map as l}from"@transcend-io/utils";import u from"cli-progress";async function d({requestActions:d,identifierNames:f,auth:p,concurrency:m=20,transcendUrl:h=e}){let g=o(h,p),_=new Date().getTime(),v=new u.SingleBar({},u.Presets.shades_classic),y=await n(g,{actions:d,statuses:[r.Enriching]});t.info(i.magenta(`Fetched requests in preflight/enriching state.`));let b=0,x=0;v.start(y.length,0),await l(y,async e=>{let n=(await s(g,{filterBy:{requestId:e.id},logger:t})).filter(({isVerifiedAtLeastOnce:e,name:t})=>e===!1&&f.includes(t)).map(({id:e})=>e);n.length>0&&(await c(g,a,{variables:{input:{requestId:e.id,requestIdentifierIds:n}},logger:t}),x+=n.length),b+=1,v.update(b)},{concurrency:m}),v.stop();let S=new Date().getTime()-_;return t.info(i.green(`Successfully cleared out unverified identifiers "${S/1e3}" seconds for ${b} requests, ${x} identifiers were cleared out!`)),y.length}export{d as t};
2
- //# sourceMappingURL=removeUnverifiedRequestIdentifiers-Do3Pus6m.mjs.map
1
+ import{a as e}from"./constants-BRsj50Nb.mjs";import{t}from"./logger-CPu6zbyQ.mjs";import{r as n}from"./fetchAllRequests-BI0tFl_a.mjs";import{RequestStatus as r}from"@transcend-io/privacy-types";import i from"colors";import{REMOVE_REQUEST_IDENTIFIERS as a,buildTranscendGraphQLClient as o,fetchAllRequestIdentifierMetadata as s,makeGraphQLRequest as c}from"@transcend-io/sdk";import{map as l}from"@transcend-io/utils";import u from"cli-progress";async function d({requestActions:d,identifierNames:f,auth:p,concurrency:m=20,transcendUrl:h=e}){let g=o(h,p),_=new Date().getTime(),v=new u.SingleBar({},u.Presets.shades_classic),y=await n(g,{actions:d,statuses:[r.Enriching]});t.info(i.magenta(`Fetched requests in preflight/enriching state.`));let b=0,x=0;v.start(y.length,0),await l(y,async e=>{let n=(await s(g,{filterBy:{requestId:e.id},logger:t})).filter(({isVerifiedAtLeastOnce:e,name:t})=>e===!1&&f.includes(t)).map(({id:e})=>e);n.length>0&&(await c(g,a,{variables:{input:{requestId:e.id,requestIdentifierIds:n}},logger:t}),x+=n.length),b+=1,v.update(b)},{concurrency:m}),v.stop();let S=new Date().getTime()-_;return t.info(i.green(`Successfully cleared out unverified identifiers "${S/1e3}" seconds for ${b} requests, ${x} identifiers were cleared out!`)),y.length}export{d as t};
2
+ //# sourceMappingURL=removeUnverifiedRequestIdentifiers-BkAcUZZN.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"removeUnverifiedRequestIdentifiers-Do3Pus6m.mjs","names":[],"sources":["../src/lib/requests/removeUnverifiedRequestIdentifiers.ts"],"sourcesContent":["import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n fetchAllRequestIdentifierMetadata,\n makeGraphQLRequest,\n REMOVE_REQUEST_IDENTIFIERS,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { fetchAllRequests } from '../graphql/index.js';\n\n/**\n * Remove a set of unverified request identifier\n *\n * @param options - Options\n * @returns Number of items marked as completed\n */\nexport async function removeUnverifiedRequestIdentifiers({\n requestActions,\n identifierNames,\n auth,\n concurrency = 20,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The request actions that should be restarted */\n requestActions: RequestAction[];\n /** Transcend API key authentication */\n auth: string;\n /** The set of identifier names to remove */\n identifierNames: string[];\n /** Concurrency to upload requests in parallel */\n concurrency?: number;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Pull in the requests\n const allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n statuses: [RequestStatus.Enriching],\n });\n\n // Notify Transcend\n logger.info(colors.magenta('Fetched requests in preflight/enriching state.'));\n\n let total = 0;\n let processed = 0;\n progressBar.start(allRequests.length, 0);\n await map(\n allRequests,\n async (requestToRestart) => {\n const requestIdentifiers = await fetchAllRequestIdentifierMetadata(client, {\n filterBy: { requestId: requestToRestart.id },\n logger,\n });\n const clearOut = requestIdentifiers\n .filter(\n ({ isVerifiedAtLeastOnce, name }) =>\n isVerifiedAtLeastOnce === false && identifierNames.includes(name),\n )\n .map(({ id }) => id);\n\n if (clearOut.length > 0) {\n await makeGraphQLRequest<{\n /** Whether we successfully uploaded the results */\n success: boolean;\n }>(client, REMOVE_REQUEST_IDENTIFIERS, {\n variables: {\n input: {\n requestId: requestToRestart.id,\n requestIdentifierIds: clearOut,\n },\n },\n logger,\n });\n processed += clearOut.length;\n }\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully cleared out unverified identifiers \"${\n totalTime / 1000\n }\" seconds for ${total} requests, ${processed} identifiers were cleared out!`,\n ),\n );\n return allRequests.length;\n}\n"],"mappings":"6bAqBA,eAAsB,EAAmC,CACvD,iBACA,kBACA,OACA,cAAc,GACd,eAAe,GAYG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAG/E,EAAc,MAAM,EAAiB,EAAQ,CACjD,QAAS,EACT,SAAU,CAAC,EAAc,UAAU,CACpC,CAAC,CAGF,EAAO,KAAK,EAAO,QAAQ,iDAAiD,CAAC,CAE7E,IAAI,EAAQ,EACR,EAAY,EAChB,EAAY,MAAM,EAAY,OAAQ,EAAE,CACxC,MAAM,EACJ,EACA,KAAO,IAAqB,CAK1B,IAAM,GAAW,MAJgB,EAAkC,EAAQ,CACzE,SAAU,CAAE,UAAW,EAAiB,GAAI,CAC5C,SACD,CAAC,EAEC,QACE,CAAE,wBAAuB,UACxB,IAA0B,IAAS,EAAgB,SAAS,EAAK,CACpE,CACA,KAAK,CAAE,QAAS,EAAG,CAElB,EAAS,OAAS,IACpB,MAAM,EAGH,EAAQ,EAA4B,CACrC,UAAW,CACT,MAAO,CACL,UAAW,EAAiB,GAC5B,qBAAsB,EACvB,CACF,CACD,SACD,CAAC,CACF,GAAa,EAAS,QAGxB,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EASvB,OAPA,EAAO,KACL,EAAO,MACL,oDACE,EAAY,IACb,gBAAgB,EAAM,aAAa,EAAU,gCAC/C,CACF,CACM,EAAY"}
1
+ {"version":3,"file":"removeUnverifiedRequestIdentifiers-BkAcUZZN.mjs","names":[],"sources":["../src/lib/requests/removeUnverifiedRequestIdentifiers.ts"],"sourcesContent":["import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n fetchAllRequestIdentifierMetadata,\n makeGraphQLRequest,\n REMOVE_REQUEST_IDENTIFIERS,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { fetchAllRequests } from '../graphql/index.js';\n\n/**\n * Remove a set of unverified request identifier\n *\n * @param options - Options\n * @returns Number of items marked as completed\n */\nexport async function removeUnverifiedRequestIdentifiers({\n requestActions,\n identifierNames,\n auth,\n concurrency = 20,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The request actions that should be restarted */\n requestActions: RequestAction[];\n /** Transcend API key authentication */\n auth: string;\n /** The set of identifier names to remove */\n identifierNames: string[];\n /** Concurrency to upload requests in parallel */\n concurrency?: number;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Pull in the requests\n const allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n statuses: [RequestStatus.Enriching],\n });\n\n // Notify Transcend\n logger.info(colors.magenta('Fetched requests in preflight/enriching state.'));\n\n let total = 0;\n let processed = 0;\n progressBar.start(allRequests.length, 0);\n await map(\n allRequests,\n async (requestToRestart) => {\n const requestIdentifiers = await fetchAllRequestIdentifierMetadata(client, {\n filterBy: { requestId: requestToRestart.id },\n logger,\n });\n const clearOut = requestIdentifiers\n .filter(\n ({ isVerifiedAtLeastOnce, name }) =>\n isVerifiedAtLeastOnce === false && identifierNames.includes(name),\n )\n .map(({ id }) => id);\n\n if (clearOut.length > 0) {\n await makeGraphQLRequest<{\n /** Whether we successfully uploaded the results */\n success: boolean;\n }>(client, REMOVE_REQUEST_IDENTIFIERS, {\n variables: {\n input: {\n requestId: requestToRestart.id,\n requestIdentifierIds: clearOut,\n },\n },\n logger,\n });\n processed += clearOut.length;\n }\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully cleared out unverified identifiers \"${\n totalTime / 1000\n }\" seconds for ${total} requests, ${processed} identifiers were cleared out!`,\n ),\n );\n return allRequests.length;\n}\n"],"mappings":"6bAqBA,eAAsB,EAAmC,CACvD,iBACA,kBACA,OACA,cAAc,GACd,eAAe,GAYG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAG/E,EAAc,MAAM,EAAiB,EAAQ,CACjD,QAAS,EACT,SAAU,CAAC,EAAc,UAAU,CACpC,CAAC,CAGF,EAAO,KAAK,EAAO,QAAQ,iDAAiD,CAAC,CAE7E,IAAI,EAAQ,EACR,EAAY,EAChB,EAAY,MAAM,EAAY,OAAQ,EAAE,CACxC,MAAM,EACJ,EACA,KAAO,IAAqB,CAK1B,IAAM,GAAW,MAJgB,EAAkC,EAAQ,CACzE,SAAU,CAAE,UAAW,EAAiB,GAAI,CAC5C,SACD,CAAC,EAEC,QACE,CAAE,wBAAuB,UACxB,IAA0B,IAAS,EAAgB,SAAS,EAAK,CACpE,CACA,KAAK,CAAE,QAAS,EAAG,CAElB,EAAS,OAAS,IACpB,MAAM,EAGH,EAAQ,EAA4B,CACrC,UAAW,CACT,MAAO,CACL,UAAW,EAAiB,GAC5B,qBAAsB,EACvB,CACF,CACD,SACD,CAAC,CACF,GAAa,EAAS,QAGxB,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EASvB,OAPA,EAAO,KACL,EAAO,MACL,oDACE,EAAY,IACb,gBAAgB,EAAM,aAAa,EAAU,gCAC/C,CACF,CACM,EAAY"}
@@ -1,3 +1,3 @@
1
1
  function e(e,t){let n=e.map((e,n)=>Math.max(e.length,...t.map(e=>(e[n]??``).length))),r=e=>e.map((e,t)=>e.padEnd(n[t]??e.length)).join(` `),i=n.map(e=>`-`.repeat(e)).join(` `);return[r(e),i,...t.map(e=>r(e))].join(`
2
2
  `)}export{e as t};
3
- //# sourceMappingURL=renderTable-D68QasPc.mjs.map
3
+ //# sourceMappingURL=renderTable-CZP2roD1.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderTable-D68QasPc.mjs","names":[],"sources":["../src/commands/policy/helpers/renderTable.ts"],"sourcesContent":["/**\n * Renders rows as a simple fixed-width text table.\n *\n * @param headers - Column headers\n * @param rows - Table rows\n * @returns Formatted table string\n */\nexport function renderTable(headers: string[], rows: string[][]): string {\n const widths = headers.map((header, index) =>\n Math.max(header.length, ...rows.map((row) => (row[index] ?? '').length)),\n );\n\n const formatRow = (cells: string[]): string =>\n cells.map((cell, index) => cell.padEnd(widths[index] ?? cell.length)).join(' ');\n\n const divider = widths.map((width) => '-'.repeat(width)).join(' ');\n return [formatRow(headers), divider, ...rows.map((row) => formatRow(row))].join('\\n');\n}\n"],"mappings":"AAOA,SAAgB,EAAY,EAAmB,EAA0B,CACvE,IAAM,EAAS,EAAQ,KAAK,EAAQ,IAClC,KAAK,IAAI,EAAO,OAAQ,GAAG,EAAK,IAAK,IAAS,EAAI,IAAU,IAAI,OAAO,CAAC,CACzE,CAEK,EAAa,GACjB,EAAM,KAAK,EAAM,IAAU,EAAK,OAAO,EAAO,IAAU,EAAK,OAAO,CAAC,CAAC,KAAK,KAAK,CAE5E,EAAU,EAAO,IAAK,GAAU,IAAI,OAAO,EAAM,CAAC,CAAC,KAAK,KAAK,CACnE,MAAO,CAAC,EAAU,EAAQ,CAAE,EAAS,GAAG,EAAK,IAAK,GAAQ,EAAU,EAAI,CAAC,CAAC,CAAC,KAAK;EAAK"}
1
+ {"version":3,"file":"renderTable-CZP2roD1.mjs","names":[],"sources":["../src/commands/policy/helpers/renderTable.ts"],"sourcesContent":["/**\n * Renders rows as a simple fixed-width text table.\n *\n * @param headers - Column headers\n * @param rows - Table rows\n * @returns Formatted table string\n */\nexport function renderTable(headers: string[], rows: string[][]): string {\n const widths = headers.map((header, index) =>\n Math.max(header.length, ...rows.map((row) => (row[index] ?? '').length)),\n );\n\n const formatRow = (cells: string[]): string =>\n cells.map((cell, index) => cell.padEnd(widths[index] ?? cell.length)).join(' ');\n\n const divider = widths.map((width) => '-'.repeat(width)).join(' ');\n return [formatRow(headers), divider, ...rows.map((row) => formatRow(row))].join('\\n');\n}\n"],"mappings":"AAOA,SAAgB,EAAY,EAAmB,EAA0B,CACvE,IAAM,EAAS,EAAQ,KAAK,EAAQ,IAClC,KAAK,IAAI,EAAO,OAAQ,GAAG,EAAK,IAAK,IAAS,EAAI,IAAU,IAAI,OAAO,CAAC,CACzE,CAEK,EAAa,GACjB,EAAM,KAAK,EAAM,IAAU,EAAK,OAAO,EAAO,IAAU,EAAK,OAAO,CAAC,CAAC,KAAK,KAAK,CAE5E,EAAU,EAAO,IAAK,GAAU,IAAI,OAAO,EAAM,CAAC,CAAC,KAAK,KAAK,CACnE,MAAO,CAAC,EAAU,EAAQ,CAAE,EAAS,GAAG,EAAK,IAAK,GAAQ,EAAU,EAAI,CAAC,CAAC,CAAC,KAAK;EAAK"}
@@ -114,4 +114,4 @@ import{gql as e}from"graphql-request";const t=e`
114
114
  }
115
115
  }
116
116
  `;export{t as a,n as i,i as n,a as o,o as r,r as t};
117
- //# sourceMappingURL=request-BiPv6jmP.mjs.map
117
+ //# sourceMappingURL=request-BpKyN9Xm.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"request-BiPv6jmP.mjs","names":[],"sources":["../src/lib/graphql/gqls/request.ts"],"sourcesContent":["import { gql } from 'graphql-request';\n\n// TODO: https://transcend.height.app/T-27909 - enable optimizations\n// isExportCsv: true\nexport const REQUESTS_COUNT = gql`\n query TranscendCliRequestsCount($filterBy: RequestFiltersInput!) {\n requests(filterBy: $filterBy, first: 0, useMaster: false) {\n totalCount\n }\n }\n`;\n\nexport const REQUESTS = gql`\n query TranscendCliRequests($first: Int!, $after: String, $filterBy: RequestFiltersInput!) {\n requests(\n filterBy: $filterBy\n first: $first\n after: $after\n orderBy: [{ field: createdAt, direction: ASC }, { field: id, direction: ASC }]\n useMaster: false\n ) {\n nodes {\n id\n createdAt\n email\n link\n status\n details\n isTest\n locale\n origin\n isSilent\n coreIdentifier\n daysRemaining\n successfullyCompletedAt\n type\n subjectType\n country\n countrySubDivision\n purpose {\n title\n name\n consent\n enrichedPreferences {\n topic\n selectValues {\n id\n name\n preferenceOption {\n id\n slug\n title {\n defaultMessage\n }\n }\n }\n selectValue {\n id\n name\n }\n selectValue {\n id\n name\n }\n preferenceTopic {\n title {\n defaultMessage\n }\n id\n slug\n }\n name\n id\n booleanValue\n }\n }\n attributeValues {\n id\n name\n attributeKey {\n id\n name\n }\n }\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n`;\n\nexport const APPROVE_PRIVACY_REQUEST = gql`\n mutation TranscendCliApprovePrivacyRequest($input: CommunicationInput!) {\n approveRequest(input: $input) {\n request {\n id\n }\n }\n }\n`;\nexport const CANCEL_PRIVACY_REQUEST = gql`\n mutation TranscendCliCancelPrivacyRequest($input: CommunicationInput!) {\n cancelRequest(input: $input) {\n request {\n id\n }\n }\n }\n`;\n\nexport const UPDATE_PRIVACY_REQUEST = gql`\n mutation TranscendCliUpdatePrivacyRequest($input: UpdateRequestInput!) {\n updateRequest(input: $input) {\n request {\n id\n }\n }\n }\n`;\n\nexport const NOTIFY_ADDITIONAL_TIME = gql`\n mutation TranscendCliNotifyAdditionalTime($input: AdditionalTimeInput!) {\n notifyAdditionalTime(input: $input) {\n clientMutationId\n }\n }\n`;\n"],"mappings":"sCAIA,MAAa,EAAiB,CAAG;;;;;;EAQpB,EAAW,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiFd,EAA0B,CAAG;;;;;;;;EAS7B,EAAyB,CAAG;;;;;;;;EAU5B,EAAyB,CAAG;;;;;;;;EAU5B,EAAyB,CAAG"}
1
+ {"version":3,"file":"request-BpKyN9Xm.mjs","names":[],"sources":["../src/lib/graphql/gqls/request.ts"],"sourcesContent":["import { gql } from 'graphql-request';\n\n// TODO: https://transcend.height.app/T-27909 - enable optimizations\n// isExportCsv: true\nexport const REQUESTS_COUNT = gql`\n query TranscendCliRequestsCount($filterBy: RequestFiltersInput!) {\n requests(filterBy: $filterBy, first: 0, useMaster: false) {\n totalCount\n }\n }\n`;\n\nexport const REQUESTS = gql`\n query TranscendCliRequests($first: Int!, $after: String, $filterBy: RequestFiltersInput!) {\n requests(\n filterBy: $filterBy\n first: $first\n after: $after\n orderBy: [{ field: createdAt, direction: ASC }, { field: id, direction: ASC }]\n useMaster: false\n ) {\n nodes {\n id\n createdAt\n email\n link\n status\n details\n isTest\n locale\n origin\n isSilent\n coreIdentifier\n daysRemaining\n successfullyCompletedAt\n type\n subjectType\n country\n countrySubDivision\n purpose {\n title\n name\n consent\n enrichedPreferences {\n topic\n selectValues {\n id\n name\n preferenceOption {\n id\n slug\n title {\n defaultMessage\n }\n }\n }\n selectValue {\n id\n name\n }\n selectValue {\n id\n name\n }\n preferenceTopic {\n title {\n defaultMessage\n }\n id\n slug\n }\n name\n id\n booleanValue\n }\n }\n attributeValues {\n id\n name\n attributeKey {\n id\n name\n }\n }\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n`;\n\nexport const APPROVE_PRIVACY_REQUEST = gql`\n mutation TranscendCliApprovePrivacyRequest($input: CommunicationInput!) {\n approveRequest(input: $input) {\n request {\n id\n }\n }\n }\n`;\nexport const CANCEL_PRIVACY_REQUEST = gql`\n mutation TranscendCliCancelPrivacyRequest($input: CommunicationInput!) {\n cancelRequest(input: $input) {\n request {\n id\n }\n }\n }\n`;\n\nexport const UPDATE_PRIVACY_REQUEST = gql`\n mutation TranscendCliUpdatePrivacyRequest($input: UpdateRequestInput!) {\n updateRequest(input: $input) {\n request {\n id\n }\n }\n }\n`;\n\nexport const NOTIFY_ADDITIONAL_TIME = gql`\n mutation TranscendCliNotifyAdditionalTime($input: AdditionalTimeInput!) {\n notifyAdditionalTime(input: $input) {\n clientMutationId\n }\n }\n`;\n"],"mappings":"sCAIA,MAAa,EAAiB,CAAG;;;;;;EAQpB,EAAW,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiFd,EAA0B,CAAG;;;;;;;;EAS7B,EAAyB,CAAG;;;;;;;;EAU5B,EAAyB,CAAG;;;;;;;;EAU5B,EAAyB,CAAG"}
@@ -1,2 +1,2 @@
1
- import{n as e}from"./printResult-CHe3nRN4.mjs";async function t(t,n){let r=0;for(;;){let i=await e(t.get(`v1/policy-engine/policy-bundles`,{searchParams:{limit:100,offset:r}}).json()),a=i.nodes.find(e=>e.bundleName===n);if(a)return a;if(r+=i.nodes.length,r>=i.totalCount||i.nodes.length===0)return}}async function n(e,n){return(await t(e,n))?.id}export{n,t};
2
- //# sourceMappingURL=resolveBundleIdByName-qXZBrUz_.mjs.map
1
+ import{n as e}from"./printResult-C2K9ODeE.mjs";async function t(t,n){let r=0;for(;;){let i=await e(t.get(`v1/policy-engine/policy-bundles`,{searchParams:{limit:100,offset:r}}).json()),a=i.nodes.find(e=>e.bundleName===n);if(a)return a;if(r+=i.nodes.length,r>=i.totalCount||i.nodes.length===0)return}}async function n(e,n){return(await t(e,n))?.id}export{n,t};
2
+ //# sourceMappingURL=resolveBundleIdByName-Dm_o5_bg.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveBundleIdByName-qXZBrUz_.mjs","names":[],"sources":["../src/commands/policy/helpers/resolveBundleIdByName.ts"],"sourcesContent":["import type { Got } from 'got';\n\nimport type { PolicyBundle, PolicyBundleListResponse } from '../types.js';\nimport { policyEngineRequest } from './formatPolicyEngineRequestError.js';\n\n/**\n * Resolves a bundle name to its parent record by scanning offset-paginated listings.\n *\n * @param client - Policy Engine REST client\n * @param bundleName - Bundle name to resolve\n * @returns Matching bundle when found\n */\nexport async function resolveBundleByName(\n client: Got,\n bundleName: string,\n): Promise<PolicyBundle | undefined> {\n const limit = 100;\n let offset = 0;\n\n while (true) {\n const body = await policyEngineRequest(\n client\n .get('v1/policy-engine/policy-bundles', {\n searchParams: { limit, offset },\n })\n .json<PolicyBundleListResponse>(),\n );\n\n const match = body.nodes.find((bundle) => bundle.bundleName === bundleName);\n if (match) {\n return match;\n }\n\n offset += body.nodes.length;\n if (offset >= body.totalCount || body.nodes.length === 0) {\n return undefined;\n }\n }\n}\n\n/**\n * Resolves a bundle name to its UUID by scanning offset-paginated bundle listings.\n *\n * @param client - Policy Engine REST client\n * @param bundleName - Bundle name to resolve\n * @returns Bundle UUID when found\n */\nexport async function resolveBundleIdByName(\n client: Got,\n bundleName: string,\n): Promise<string | undefined> {\n const bundle = await resolveBundleByName(client, bundleName);\n return bundle?.id;\n}\n"],"mappings":"+CAYA,eAAsB,EACpB,EACA,EACmC,CACnC,IACI,EAAS,EAEb,OAAa,CACX,IAAM,EAAO,MAAM,EACjB,EACG,IAAI,kCAAmC,CACtC,aAAc,CAAE,UAAO,SAAQ,CAChC,CAAC,CACD,MAAgC,CACpC,CAEK,EAAQ,EAAK,MAAM,KAAM,GAAW,EAAO,aAAe,EAAW,CAC3E,GAAI,EACF,OAAO,EAIT,GADA,GAAU,EAAK,MAAM,OACjB,GAAU,EAAK,YAAc,EAAK,MAAM,SAAW,EACrD,QAYN,eAAsB,EACpB,EACA,EAC6B,CAE7B,OAAO,MADc,EAAoB,EAAQ,EAAW,GAC7C"}
1
+ {"version":3,"file":"resolveBundleIdByName-Dm_o5_bg.mjs","names":[],"sources":["../src/commands/policy/helpers/resolveBundleIdByName.ts"],"sourcesContent":["import type { Got } from 'got';\n\nimport type { PolicyBundle, PolicyBundleListResponse } from '../types.js';\nimport { policyEngineRequest } from './formatPolicyEngineRequestError.js';\n\n/**\n * Resolves a bundle name to its parent record by scanning offset-paginated listings.\n *\n * @param client - Policy Engine REST client\n * @param bundleName - Bundle name to resolve\n * @returns Matching bundle when found\n */\nexport async function resolveBundleByName(\n client: Got,\n bundleName: string,\n): Promise<PolicyBundle | undefined> {\n const limit = 100;\n let offset = 0;\n\n while (true) {\n const body = await policyEngineRequest(\n client\n .get('v1/policy-engine/policy-bundles', {\n searchParams: { limit, offset },\n })\n .json<PolicyBundleListResponse>(),\n );\n\n const match = body.nodes.find((bundle) => bundle.bundleName === bundleName);\n if (match) {\n return match;\n }\n\n offset += body.nodes.length;\n if (offset >= body.totalCount || body.nodes.length === 0) {\n return undefined;\n }\n }\n}\n\n/**\n * Resolves a bundle name to its UUID by scanning offset-paginated bundle listings.\n *\n * @param client - Policy Engine REST client\n * @param bundleName - Bundle name to resolve\n * @returns Bundle UUID when found\n */\nexport async function resolveBundleIdByName(\n client: Got,\n bundleName: string,\n): Promise<string | undefined> {\n const bundle = await resolveBundleByName(client, bundleName);\n return bundle?.id;\n}\n"],"mappings":"+CAYA,eAAsB,EACpB,EACA,EACmC,CACnC,IACI,EAAS,EAEb,OAAa,CACX,IAAM,EAAO,MAAM,EACjB,EACG,IAAI,kCAAmC,CACtC,aAAc,CAAE,UAAO,SAAQ,CAChC,CAAC,CACD,MAAgC,CACpC,CAEK,EAAQ,EAAK,MAAM,KAAM,GAAW,EAAO,aAAe,EAAW,CAC3E,GAAI,EACF,OAAO,EAIT,GADA,GAAU,EAAK,MAAM,OACjB,GAAU,EAAK,YAAc,EAAK,MAAM,SAAW,EACrD,QAYN,eAAsB,EACpB,EACA,EAC6B,CAE7B,OAAO,MADc,EAAoB,EAAQ,EAAW,GAC7C"}
@@ -1,2 +1,2 @@
1
- import{n as e}from"./printResult-CHe3nRN4.mjs";async function t(t,n){let r=[],i;for(;;){let a={limit:100};i&&(a.after=i);let o=await e(t.get(`v1/policy-engine/policy-bundles/${n}/versions`,{searchParams:a}).json());if(r.push(...o.nodes),!o.pageInfo.hasNextPage||!o.pageInfo.endCursor)break;i=o.pageInfo.endCursor}return r}function n(e,t){return new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()}async function r(e,r,i){let a=await t(e,r);if(a.length===0)throw Error(`No versions found for this policy bundle.`);if(i.version){let e=a.find(e=>e.version===i.version);if(!e)throw Error(`Version "${i.version}" was not found for this policy bundle.`);return e}return a.sort(n)[0]}export{r as t};
2
- //# sourceMappingURL=resolvePolicyBundleVersion-BG7XqBBP.mjs.map
1
+ import{n as e}from"./printResult-C2K9ODeE.mjs";async function t(t,n){let r=[],i;for(;;){let a={limit:100};i&&(a.after=i);let o=await e(t.get(`v1/policy-engine/policy-bundles/${n}/versions`,{searchParams:a}).json());if(r.push(...o.nodes),!o.pageInfo.hasNextPage||!o.pageInfo.endCursor)break;i=o.pageInfo.endCursor}return r}function n(e,t){return new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()}async function r(e,r,i){let a=await t(e,r);if(a.length===0)throw Error(`No versions found for this policy bundle.`);if(i.version){let e=a.find(e=>e.version===i.version);if(!e)throw Error(`Version "${i.version}" was not found for this policy bundle.`);return e}return a.sort(n)[0]}export{r as t};
2
+ //# sourceMappingURL=resolvePolicyBundleVersion-DRUwe7fA.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolvePolicyBundleVersion-BG7XqBBP.mjs","names":[],"sources":["../src/commands/policy/helpers/resolvePolicyBundleVersion.ts"],"sourcesContent":["import type { Got } from 'got';\n\nimport type { PolicyBundleVersion, PolicyBundleVersionListResponse } from '../types.js';\nimport { policyEngineRequest } from './formatPolicyEngineRequestError.js';\n\n/** Options for resolving a policy bundle version. */\nexport interface ResolvePolicyBundleVersionOptions {\n /** Caller-supplied version label; omitted to pick the latest by createdAt */\n version?: string;\n}\n\n/**\n * Lists all versions for a bundle, following cursor pagination.\n *\n * @param client - Policy Engine REST client\n * @param bundleId - Parent bundle UUID\n * @returns All uploaded versions\n */\nasync function listAllPolicyBundleVersions(\n client: Got,\n bundleId: string,\n): Promise<PolicyBundleVersion[]> {\n const limit = 100;\n const versions: PolicyBundleVersion[] = [];\n let after: string | undefined;\n\n while (true) {\n const searchParams: Record<string, string | number> = { limit };\n if (after) {\n searchParams.after = after;\n }\n\n const body = await policyEngineRequest(\n client\n .get(`v1/policy-engine/policy-bundles/${bundleId}/versions`, {\n searchParams,\n })\n .json<PolicyBundleVersionListResponse>(),\n );\n\n versions.push(...body.nodes);\n\n if (!body.pageInfo.hasNextPage || !body.pageInfo.endCursor) {\n break;\n }\n after = body.pageInfo.endCursor;\n }\n\n return versions;\n}\n\n/**\n * Compares two version records by createdAt, newest first.\n *\n * @param left - First version\n * @param right - Second version\n * @returns Sort order for descending createdAt\n */\nfunction compareVersionsByCreatedAtDesc(\n left: PolicyBundleVersion,\n right: PolicyBundleVersion,\n): number {\n return new Date(right.createdAt).getTime() - new Date(left.createdAt).getTime();\n}\n\n/**\n * Resolves a version label to a version record, or picks the latest by createdAt.\n *\n * @param client - Policy Engine REST client\n * @param bundleId - Parent bundle UUID\n * @param options - Version lookup options\n * @returns Matching or latest version record\n */\nexport async function resolvePolicyBundleVersion(\n client: Got,\n bundleId: string,\n options: ResolvePolicyBundleVersionOptions,\n): Promise<PolicyBundleVersion> {\n const versions = await listAllPolicyBundleVersions(client, bundleId);\n\n if (versions.length === 0) {\n throw new Error('No versions found for this policy bundle.');\n }\n\n if (options.version) {\n const match = versions.find((entry) => entry.version === options.version);\n if (!match) {\n throw new Error(`Version \"${options.version}\" was not found for this policy bundle.`);\n }\n return match;\n }\n\n return versions.sort(compareVersionsByCreatedAtDesc)[0];\n}\n"],"mappings":"+CAkBA,eAAe,EACb,EACA,EACgC,CAChC,IACM,EAAkC,EAAE,CACtC,EAEJ,OAAa,CACX,IAAM,EAAgD,CAAE,UAAO,CAC3D,IACF,EAAa,MAAQ,GAGvB,IAAM,EAAO,MAAM,EACjB,EACG,IAAI,mCAAmC,EAAS,WAAY,CAC3D,eACD,CAAC,CACD,MAAuC,CAC3C,CAID,GAFA,EAAS,KAAK,GAAG,EAAK,MAAM,CAExB,CAAC,EAAK,SAAS,aAAe,CAAC,EAAK,SAAS,UAC/C,MAEF,EAAQ,EAAK,SAAS,UAGxB,OAAO,EAUT,SAAS,EACP,EACA,EACQ,CACR,OAAO,IAAI,KAAK,EAAM,UAAU,CAAC,SAAS,CAAG,IAAI,KAAK,EAAK,UAAU,CAAC,SAAS,CAWjF,eAAsB,EACpB,EACA,EACA,EAC8B,CAC9B,IAAM,EAAW,MAAM,EAA4B,EAAQ,EAAS,CAEpE,GAAI,EAAS,SAAW,EACtB,MAAU,MAAM,4CAA4C,CAG9D,GAAI,EAAQ,QAAS,CACnB,IAAM,EAAQ,EAAS,KAAM,GAAU,EAAM,UAAY,EAAQ,QAAQ,CACzE,GAAI,CAAC,EACH,MAAU,MAAM,YAAY,EAAQ,QAAQ,yCAAyC,CAEvF,OAAO,EAGT,OAAO,EAAS,KAAK,EAA+B,CAAC"}
1
+ {"version":3,"file":"resolvePolicyBundleVersion-DRUwe7fA.mjs","names":[],"sources":["../src/commands/policy/helpers/resolvePolicyBundleVersion.ts"],"sourcesContent":["import type { Got } from 'got';\n\nimport type { PolicyBundleVersion, PolicyBundleVersionListResponse } from '../types.js';\nimport { policyEngineRequest } from './formatPolicyEngineRequestError.js';\n\n/** Options for resolving a policy bundle version. */\nexport interface ResolvePolicyBundleVersionOptions {\n /** Caller-supplied version label; omitted to pick the latest by createdAt */\n version?: string;\n}\n\n/**\n * Lists all versions for a bundle, following cursor pagination.\n *\n * @param client - Policy Engine REST client\n * @param bundleId - Parent bundle UUID\n * @returns All uploaded versions\n */\nasync function listAllPolicyBundleVersions(\n client: Got,\n bundleId: string,\n): Promise<PolicyBundleVersion[]> {\n const limit = 100;\n const versions: PolicyBundleVersion[] = [];\n let after: string | undefined;\n\n while (true) {\n const searchParams: Record<string, string | number> = { limit };\n if (after) {\n searchParams.after = after;\n }\n\n const body = await policyEngineRequest(\n client\n .get(`v1/policy-engine/policy-bundles/${bundleId}/versions`, {\n searchParams,\n })\n .json<PolicyBundleVersionListResponse>(),\n );\n\n versions.push(...body.nodes);\n\n if (!body.pageInfo.hasNextPage || !body.pageInfo.endCursor) {\n break;\n }\n after = body.pageInfo.endCursor;\n }\n\n return versions;\n}\n\n/**\n * Compares two version records by createdAt, newest first.\n *\n * @param left - First version\n * @param right - Second version\n * @returns Sort order for descending createdAt\n */\nfunction compareVersionsByCreatedAtDesc(\n left: PolicyBundleVersion,\n right: PolicyBundleVersion,\n): number {\n return new Date(right.createdAt).getTime() - new Date(left.createdAt).getTime();\n}\n\n/**\n * Resolves a version label to a version record, or picks the latest by createdAt.\n *\n * @param client - Policy Engine REST client\n * @param bundleId - Parent bundle UUID\n * @param options - Version lookup options\n * @returns Matching or latest version record\n */\nexport async function resolvePolicyBundleVersion(\n client: Got,\n bundleId: string,\n options: ResolvePolicyBundleVersionOptions,\n): Promise<PolicyBundleVersion> {\n const versions = await listAllPolicyBundleVersions(client, bundleId);\n\n if (versions.length === 0) {\n throw new Error('No versions found for this policy bundle.');\n }\n\n if (options.version) {\n const match = versions.find((entry) => entry.version === options.version);\n if (!match) {\n throw new Error(`Version \"${options.version}\" was not found for this policy bundle.`);\n }\n return match;\n }\n\n return versions.sort(compareVersionsByCreatedAtDesc)[0];\n}\n"],"mappings":"+CAkBA,eAAe,EACb,EACA,EACgC,CAChC,IACM,EAAkC,EAAE,CACtC,EAEJ,OAAa,CACX,IAAM,EAAgD,CAAE,UAAO,CAC3D,IACF,EAAa,MAAQ,GAGvB,IAAM,EAAO,MAAM,EACjB,EACG,IAAI,mCAAmC,EAAS,WAAY,CAC3D,eACD,CAAC,CACD,MAAuC,CAC3C,CAID,GAFA,EAAS,KAAK,GAAG,EAAK,MAAM,CAExB,CAAC,EAAK,SAAS,aAAe,CAAC,EAAK,SAAS,UAC/C,MAEF,EAAQ,EAAK,SAAS,UAGxB,OAAO,EAUT,SAAS,EACP,EACA,EACQ,CACR,OAAO,IAAI,KAAK,EAAM,UAAU,CAAC,SAAS,CAAG,IAAI,KAAK,EAAK,UAAU,CAAC,SAAS,CAWjF,eAAsB,EACpB,EACA,EACA,EAC8B,CAC9B,IAAM,EAAW,MAAM,EAA4B,EAAQ,EAAS,CAEpE,GAAI,EAAS,SAAW,EACtB,MAAU,MAAM,4CAA4C,CAG9D,GAAI,EAAQ,QAAS,CACnB,IAAM,EAAQ,EAAS,KAAM,GAAU,EAAM,UAAY,EAAQ,QAAQ,CACzE,GAAI,CAAC,EACH,MAAU,MAAM,YAAY,EAAQ,QAAQ,yCAAyC,CAEvF,OAAO,EAGT,OAAO,EAAS,KAAK,EAA+B,CAAC"}
@@ -1,2 +1,2 @@
1
- import{a as e}from"./constants-Upxn_rQF.mjs";import{t}from"./logger-zplFSeXU.mjs";import{r as n}from"./fetchAllRequests-2TZr-LfT.mjs";import{RequestStatus as r}from"@transcend-io/privacy-types";import i from"colors";import{RETRY_REQUEST_DATA_SILO as a,buildTranscendGraphQLClient as o,fetchRequestDataSilo as s,makeGraphQLRequest as c}from"@transcend-io/sdk";import{map as l}from"@transcend-io/utils";import u from"cli-progress";async function d({requestActions:d,dataSiloId:f,auth:p,concurrency:m=20,transcendUrl:h=e}){let g=o(h,p),_=new Date().getTime(),v=new u.SingleBar({},u.Presets.shades_classic),y=await n(g,{actions:d,statuses:[r.Compiling,r.Approving]});t.info(i.magenta(`Retrying requests for Data Silo: "${f}", restarting "${y.length}" requests.`));let b=0,x=0;v.start(y.length,0),await l(y,async e=>{try{await c(g,a,{variables:{requestDataSiloId:(await s(g,{logger:t,filterBy:{requestId:e.id,dataSiloId:f}})).id},logger:t})}catch(e){if(!e.message.includes(`Failed to find RequestDataSilo`))throw e;x+=1}b+=1,v.update(b)},{concurrency:m}),v.stop();let S=new Date().getTime()-_;return t.info(i.green(`Successfully notified Transcend in "${S/1e3}" seconds for ${b} requests, ${x} requests were skipped because data silo was not attached to the request!`)),y.length}export{d as t};
2
- //# sourceMappingURL=retryRequestDataSilos-CEgUW6Fx.mjs.map
1
+ import{a as e}from"./constants-BRsj50Nb.mjs";import{t}from"./logger-CPu6zbyQ.mjs";import{r as n}from"./fetchAllRequests-BI0tFl_a.mjs";import{RequestStatus as r}from"@transcend-io/privacy-types";import i from"colors";import{RETRY_REQUEST_DATA_SILO as a,buildTranscendGraphQLClient as o,fetchRequestDataSilo as s,makeGraphQLRequest as c}from"@transcend-io/sdk";import{map as l}from"@transcend-io/utils";import u from"cli-progress";async function d({requestActions:d,dataSiloId:f,auth:p,concurrency:m=20,transcendUrl:h=e}){let g=o(h,p),_=new Date().getTime(),v=new u.SingleBar({},u.Presets.shades_classic),y=await n(g,{actions:d,statuses:[r.Compiling,r.Approving]});t.info(i.magenta(`Retrying requests for Data Silo: "${f}", restarting "${y.length}" requests.`));let b=0,x=0;v.start(y.length,0),await l(y,async e=>{try{await c(g,a,{variables:{requestDataSiloId:(await s(g,{logger:t,filterBy:{requestId:e.id,dataSiloId:f}})).id},logger:t})}catch(e){if(!e.message.includes(`Failed to find RequestDataSilo`))throw e;x+=1}b+=1,v.update(b)},{concurrency:m}),v.stop();let S=new Date().getTime()-_;return t.info(i.green(`Successfully notified Transcend in "${S/1e3}" seconds for ${b} requests, ${x} requests were skipped because data silo was not attached to the request!`)),y.length}export{d as t};
2
+ //# sourceMappingURL=retryRequestDataSilos-BoPmcB8-.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"retryRequestDataSilos-CEgUW6Fx.mjs","names":[],"sources":["../src/lib/requests/retryRequestDataSilos.ts"],"sourcesContent":["import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n makeGraphQLRequest,\n RETRY_REQUEST_DATA_SILO,\n fetchRequestDataSilo,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { fetchAllRequests } from '../graphql/index.js';\n\n/**\n * Retry a set of RequestDataSilos\n *\n * @param options - Options\n * @returns Number of items marked as completed\n */\nexport async function retryRequestDataSilos({\n requestActions,\n dataSiloId,\n auth,\n concurrency = 20,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The request actions that should be restarted */\n requestActions: RequestAction[];\n /** Transcend API key authentication */\n auth: string;\n /** Data Silo ID to pull down jobs for */\n dataSiloId: string;\n /** Concurrency to upload requests in parallel */\n concurrency?: number;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Pull in the requests\n const allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n statuses: [RequestStatus.Compiling, RequestStatus.Approving],\n });\n\n // Notify Transcend\n logger.info(\n colors.magenta(\n `Retrying requests for Data Silo: \"${dataSiloId}\", restarting \"${allRequests.length}\" requests.`,\n ),\n );\n\n let total = 0;\n let skipped = 0;\n progressBar.start(allRequests.length, 0);\n await map(\n allRequests,\n async (requestToRestart) => {\n try {\n const requestDataSilo = await fetchRequestDataSilo(client, {\n logger,\n filterBy: { requestId: requestToRestart.id, dataSiloId },\n });\n\n await makeGraphQLRequest<{\n /** Whether we successfully uploaded the results */\n success: boolean;\n }>(client, RETRY_REQUEST_DATA_SILO, {\n variables: { requestDataSiloId: requestDataSilo.id },\n logger,\n });\n } catch (err) {\n // some requests may not have this data silo connected\n if (!err.message.includes('Failed to find RequestDataSilo')) {\n throw err;\n }\n skipped += 1;\n }\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully notified Transcend in \"${\n totalTime / 1000\n }\" seconds for ${total} requests, ${skipped} requests were skipped because data silo was not attached to the request!`,\n ),\n );\n return allRequests.length;\n}\n"],"mappings":"6aAqBA,eAAsB,EAAsB,CAC1C,iBACA,aACA,OACA,cAAc,GACd,eAAe,GAYG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAG/E,EAAc,MAAM,EAAiB,EAAQ,CACjD,QAAS,EACT,SAAU,CAAC,EAAc,UAAW,EAAc,UAAU,CAC7D,CAAC,CAGF,EAAO,KACL,EAAO,QACL,qCAAqC,EAAW,iBAAiB,EAAY,OAAO,aACrF,CACF,CAED,IAAI,EAAQ,EACR,EAAU,EACd,EAAY,MAAM,EAAY,OAAQ,EAAE,CACxC,MAAM,EACJ,EACA,KAAO,IAAqB,CAC1B,GAAI,CAMF,MAAM,EAGH,EAAQ,EAAyB,CAClC,UAAW,CAAE,mBAAmB,MATJ,EAAqB,EAAQ,CACzD,SACA,SAAU,CAAE,UAAW,EAAiB,GAAI,aAAY,CACzD,CAAC,EAMgD,GAAI,CACpD,SACD,CAAC,OACK,EAAK,CAEZ,GAAI,CAAC,EAAI,QAAQ,SAAS,iCAAiC,CACzD,MAAM,EAER,GAAW,EAGb,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EASvB,OAPA,EAAO,KACL,EAAO,MACL,uCACE,EAAY,IACb,gBAAgB,EAAM,aAAa,EAAQ,2EAC7C,CACF,CACM,EAAY"}
1
+ {"version":3,"file":"retryRequestDataSilos-BoPmcB8-.mjs","names":[],"sources":["../src/lib/requests/retryRequestDataSilos.ts"],"sourcesContent":["import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n makeGraphQLRequest,\n RETRY_REQUEST_DATA_SILO,\n fetchRequestDataSilo,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { fetchAllRequests } from '../graphql/index.js';\n\n/**\n * Retry a set of RequestDataSilos\n *\n * @param options - Options\n * @returns Number of items marked as completed\n */\nexport async function retryRequestDataSilos({\n requestActions,\n dataSiloId,\n auth,\n concurrency = 20,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The request actions that should be restarted */\n requestActions: RequestAction[];\n /** Transcend API key authentication */\n auth: string;\n /** Data Silo ID to pull down jobs for */\n dataSiloId: string;\n /** Concurrency to upload requests in parallel */\n concurrency?: number;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Pull in the requests\n const allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n statuses: [RequestStatus.Compiling, RequestStatus.Approving],\n });\n\n // Notify Transcend\n logger.info(\n colors.magenta(\n `Retrying requests for Data Silo: \"${dataSiloId}\", restarting \"${allRequests.length}\" requests.`,\n ),\n );\n\n let total = 0;\n let skipped = 0;\n progressBar.start(allRequests.length, 0);\n await map(\n allRequests,\n async (requestToRestart) => {\n try {\n const requestDataSilo = await fetchRequestDataSilo(client, {\n logger,\n filterBy: { requestId: requestToRestart.id, dataSiloId },\n });\n\n await makeGraphQLRequest<{\n /** Whether we successfully uploaded the results */\n success: boolean;\n }>(client, RETRY_REQUEST_DATA_SILO, {\n variables: { requestDataSiloId: requestDataSilo.id },\n logger,\n });\n } catch (err) {\n // some requests may not have this data silo connected\n if (!err.message.includes('Failed to find RequestDataSilo')) {\n throw err;\n }\n skipped += 1;\n }\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully notified Transcend in \"${\n totalTime / 1000\n }\" seconds for ${total} requests, ${skipped} requests were skipped because data silo was not attached to the request!`,\n ),\n );\n return allRequests.length;\n}\n"],"mappings":"6aAqBA,eAAsB,EAAsB,CAC1C,iBACA,aACA,OACA,cAAc,GACd,eAAe,GAYG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAG/E,EAAc,MAAM,EAAiB,EAAQ,CACjD,QAAS,EACT,SAAU,CAAC,EAAc,UAAW,EAAc,UAAU,CAC7D,CAAC,CAGF,EAAO,KACL,EAAO,QACL,qCAAqC,EAAW,iBAAiB,EAAY,OAAO,aACrF,CACF,CAED,IAAI,EAAQ,EACR,EAAU,EACd,EAAY,MAAM,EAAY,OAAQ,EAAE,CACxC,MAAM,EACJ,EACA,KAAO,IAAqB,CAC1B,GAAI,CAMF,MAAM,EAGH,EAAQ,EAAyB,CAClC,UAAW,CAAE,mBAAmB,MATJ,EAAqB,EAAQ,CACzD,SACA,SAAU,CAAE,UAAW,EAAiB,GAAI,aAAY,CACzD,CAAC,EAMgD,GAAI,CACpD,SACD,CAAC,OACK,EAAK,CAEZ,GAAI,CAAC,EAAI,QAAQ,SAAS,iCAAiC,CACzD,MAAM,EAER,GAAW,EAGb,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EASvB,OAPA,EAAO,KACL,EAAO,MACL,uCACE,EAAY,IACb,gBAAgB,EAAM,aAAa,EAAQ,2EAC7C,CACF,CACM,EAAY"}
@@ -1,2 +1,2 @@
1
1
  import{spawn as e}from"node:child_process";import{Buffer as t}from"node:buffer";const n=(n,r,i,a)=>new Promise(o=>{let s=e(n,[...r],{cwd:i.cwd,env:{...i.env??a.process.env,PATH:a.process.env.PATH,NO_COLOR:`1`},stdio:`pipe`}),c=``,l=``,u=!1,d=!1,f=!1,p,m=!1,h,g=i.timeoutMs?setTimeout(()=>{f=!0,s.kill(`SIGTERM`),h=setTimeout(()=>s.kill(`SIGKILL`),1e3)},i.timeoutMs):void 0,_=e=>{m||(m=!0,g&&clearTimeout(g),h&&clearTimeout(h),o({...e,...f?{timedOut:!0}:{},...p?{inputError:p}:{},...u||d?{outputTruncated:!0}:{},...u?{stdoutTruncated:!0}:{},...d?{stderrTruncated:!0}:{}}))},v=(e,n,r)=>{if(!i.maxOutputBytes)return e+n;let a=i.maxOutputBytes-t.byteLength(e),o=t.from(n);if(a<=0)return r(),e;if(o.length>a){r();let t=a;for(;t>0&&(o[t]&192)==128;)--t;return e+o.subarray(0,t).toString(`utf8`)}return e+n};s.stdout.setEncoding(`utf8`),s.stderr.setEncoding(`utf8`),s.stdout.on(`data`,e=>{c=v(c,e,()=>{u=!0})}),s.stderr.on(`data`,e=>{l=v(l,e,()=>{d=!0})}),s.stdin.on(`error`,e=>{p=e}),s.once(`error`,e=>{_({code:1,stdout:c,stderr:l,error:e})}),s.once(`close`,(e,t)=>{_({code:f||p?1:e??1,stdout:c,stderr:l,...t?{signal:t}:{}})});try{i.input===void 0?s.stdin.end():s.stdin.end(i.input)}catch(e){p=e,s.kill(`SIGTERM`)}});export{n as t};
2
- //# sourceMappingURL=run-captured-process-BXwWXuTh.mjs.map
2
+ //# sourceMappingURL=run-captured-process-BjaSDWXG.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"run-captured-process-BXwWXuTh.mjs","names":[],"sources":["../src/lib/cli/run-captured-process.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\nimport { spawn } from 'node:child_process';\n\nimport type { LocalContext } from '../../context.js';\n\n/** Captured subprocess result. */\nexport interface CapturedProcessResult {\n /** Process exit code. */\n code: number;\n /** Captured standard output. */\n stdout: string;\n /** Captured standard error. */\n stderr: string;\n /** Signal that terminated the process, when present. */\n signal?: NodeJS.Signals;\n /** Whether the configured timeout elapsed. */\n timedOut?: boolean;\n /** Error encountered while writing standard input. */\n inputError?: NodeJS.ErrnoException;\n /** Whether stdout or stderr exceeded the configured capture limit. */\n outputTruncated?: boolean;\n /** Whether stdout exceeded the configured capture limit. */\n stdoutTruncated?: boolean;\n /** Whether stderr exceeded the configured capture limit. */\n stderrTruncated?: boolean;\n /** Spawn error, when the executable did not start. */\n error?: NodeJS.ErrnoException;\n}\n\n/** Captured subprocess runner. */\nexport type CapturedProcessRunner = (\n command: string,\n args: readonly string[],\n options: {\n /** Working directory. */\n cwd: string;\n /** Optional standard input. */\n input?: string;\n /** Child environment; PATH is retained so the executable can be resolved. */\n env?: NodeJS.ProcessEnv;\n /** Optional process timeout. */\n timeoutMs?: number;\n /** Maximum bytes retained from each output stream. */\n maxOutputBytes?: number;\n },\n context: LocalContext,\n) => Promise<CapturedProcessResult>;\n\n/**\n * Capture a subprocess without forwarding its output.\n *\n * @param command - Executable\n * @param args - Arguments\n * @param options - CWD and optional standard input\n * @param context - CLI context\n * @returns Captured result\n */\nexport const runCapturedProcess: CapturedProcessRunner = (command, args, options, context) =>\n new Promise((resolveResult) => {\n const child = spawn(command, [...args], {\n cwd: options.cwd,\n env: {\n ...(options.env ?? context.process.env),\n PATH: context.process.env.PATH,\n NO_COLOR: '1',\n },\n stdio: 'pipe',\n });\n let stdout = '';\n let stderr = '';\n let stdoutTruncated = false;\n let stderrTruncated = false;\n let timedOut = false;\n let inputError: NodeJS.ErrnoException | undefined;\n let settled = false;\n let forceKillTimer: NodeJS.Timeout | undefined;\n const timeoutTimer = options.timeoutMs\n ? setTimeout(() => {\n timedOut = true;\n child.kill('SIGTERM');\n forceKillTimer = setTimeout(() => child.kill('SIGKILL'), 1000);\n }, options.timeoutMs)\n : undefined;\n const finish = (result: CapturedProcessResult): void => {\n if (settled) {\n return;\n }\n settled = true;\n if (timeoutTimer) {\n clearTimeout(timeoutTimer);\n }\n if (forceKillTimer) {\n clearTimeout(forceKillTimer);\n }\n resolveResult({\n ...result,\n ...(timedOut ? { timedOut: true } : {}),\n ...(inputError ? { inputError } : {}),\n ...(stdoutTruncated || stderrTruncated ? { outputTruncated: true } : {}),\n ...(stdoutTruncated ? { stdoutTruncated: true } : {}),\n ...(stderrTruncated ? { stderrTruncated: true } : {}),\n });\n };\n const appendOutput = (output: string, chunk: string, markTruncated: () => void): string => {\n if (!options.maxOutputBytes) {\n return output + chunk;\n }\n const remaining = options.maxOutputBytes - Buffer.byteLength(output);\n const bytes = Buffer.from(chunk);\n if (remaining <= 0) {\n markTruncated();\n return output;\n }\n if (bytes.length > remaining) {\n markTruncated();\n let end = remaining;\n while (end > 0 && (bytes[end]! & 0b1100_0000) === 0b1000_0000) {\n end -= 1;\n }\n return output + bytes.subarray(0, end).toString('utf8');\n }\n return output + chunk;\n };\n child.stdout.setEncoding('utf8');\n child.stderr.setEncoding('utf8');\n child.stdout.on('data', (chunk: string) => {\n stdout = appendOutput(stdout, chunk, () => {\n stdoutTruncated = true;\n });\n });\n child.stderr.on('data', (chunk: string) => {\n stderr = appendOutput(stderr, chunk, () => {\n stderrTruncated = true;\n });\n });\n child.stdin.on('error', (error: NodeJS.ErrnoException) => {\n inputError = error;\n });\n child.once('error', (error: NodeJS.ErrnoException) => {\n finish({\n code: 1,\n stdout,\n stderr,\n error,\n });\n });\n child.once('close', (code, signal) => {\n finish({\n code: timedOut || inputError ? 1 : (code ?? 1),\n stdout,\n stderr,\n ...(signal ? { signal } : {}),\n });\n });\n try {\n if (options.input === undefined) {\n child.stdin.end();\n } else {\n child.stdin.end(options.input);\n }\n } catch (error) {\n inputError = error as NodeJS.ErrnoException;\n child.kill('SIGTERM');\n }\n });\n"],"mappings":"gFAyDA,MAAa,GAA6C,EAAS,EAAM,EAAS,IAChF,IAAI,QAAS,GAAkB,CAC7B,IAAM,EAAQ,EAAM,EAAS,CAAC,GAAG,EAAK,CAAE,CACtC,IAAK,EAAQ,IACb,IAAK,CACH,GAAI,EAAQ,KAAO,EAAQ,QAAQ,IACnC,KAAM,EAAQ,QAAQ,IAAI,KAC1B,SAAU,IACX,CACD,MAAO,OACR,CAAC,CACE,EAAS,GACT,EAAS,GACT,EAAkB,GAClB,EAAkB,GAClB,EAAW,GACX,EACA,EAAU,GACV,EACE,EAAe,EAAQ,UACzB,eAAiB,CACf,EAAW,GACX,EAAM,KAAK,UAAU,CACrB,EAAiB,eAAiB,EAAM,KAAK,UAAU,CAAE,IAAK,EAC7D,EAAQ,UAAU,CACrB,IAAA,GACE,EAAU,GAAwC,CAClD,IAGJ,EAAU,GACN,GACF,aAAa,EAAa,CAExB,GACF,aAAa,EAAe,CAE9B,EAAc,CACZ,GAAG,EACH,GAAI,EAAW,CAAE,SAAU,GAAM,CAAG,EAAE,CACtC,GAAI,EAAa,CAAE,aAAY,CAAG,EAAE,CACpC,GAAI,GAAmB,EAAkB,CAAE,gBAAiB,GAAM,CAAG,EAAE,CACvE,GAAI,EAAkB,CAAE,gBAAiB,GAAM,CAAG,EAAE,CACpD,GAAI,EAAkB,CAAE,gBAAiB,GAAM,CAAG,EAAE,CACrD,CAAC,GAEE,GAAgB,EAAgB,EAAe,IAAsC,CACzF,GAAI,CAAC,EAAQ,eACX,OAAO,EAAS,EAElB,IAAM,EAAY,EAAQ,eAAiB,EAAO,WAAW,EAAO,CAC9D,EAAQ,EAAO,KAAK,EAAM,CAChC,GAAI,GAAa,EAEf,OADA,GAAe,CACR,EAET,GAAI,EAAM,OAAS,EAAW,CAC5B,GAAe,CACf,IAAI,EAAM,EACV,KAAO,EAAM,IAAM,EAAM,GAAQ,MAAiB,KAChD,IAEF,OAAO,EAAS,EAAM,SAAS,EAAG,EAAI,CAAC,SAAS,OAAO,CAEzD,OAAO,EAAS,GAElB,EAAM,OAAO,YAAY,OAAO,CAChC,EAAM,OAAO,YAAY,OAAO,CAChC,EAAM,OAAO,GAAG,OAAS,GAAkB,CACzC,EAAS,EAAa,EAAQ,MAAa,CACzC,EAAkB,IAClB,EACF,CACF,EAAM,OAAO,GAAG,OAAS,GAAkB,CACzC,EAAS,EAAa,EAAQ,MAAa,CACzC,EAAkB,IAClB,EACF,CACF,EAAM,MAAM,GAAG,QAAU,GAAiC,CACxD,EAAa,GACb,CACF,EAAM,KAAK,QAAU,GAAiC,CACpD,EAAO,CACL,KAAM,EACN,SACA,SACA,QACD,CAAC,EACF,CACF,EAAM,KAAK,SAAU,EAAM,IAAW,CACpC,EAAO,CACL,KAAM,GAAY,EAAa,EAAK,GAAQ,EAC5C,SACA,SACA,GAAI,EAAS,CAAE,SAAQ,CAAG,EAAE,CAC7B,CAAC,EACF,CACF,GAAI,CACE,EAAQ,QAAU,IAAA,GACpB,EAAM,MAAM,KAAK,CAEjB,EAAM,MAAM,IAAI,EAAQ,MAAM,OAEzB,EAAO,CACd,EAAa,EACb,EAAM,KAAK,UAAU,GAEvB"}
1
+ {"version":3,"file":"run-captured-process-BjaSDWXG.mjs","names":[],"sources":["../src/lib/cli/run-captured-process.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\nimport { spawn } from 'node:child_process';\n\nimport type { LocalContext } from '../../context.js';\n\n/** Captured subprocess result. */\nexport interface CapturedProcessResult {\n /** Process exit code. */\n code: number;\n /** Captured standard output. */\n stdout: string;\n /** Captured standard error. */\n stderr: string;\n /** Signal that terminated the process, when present. */\n signal?: NodeJS.Signals;\n /** Whether the configured timeout elapsed. */\n timedOut?: boolean;\n /** Error encountered while writing standard input. */\n inputError?: NodeJS.ErrnoException;\n /** Whether stdout or stderr exceeded the configured capture limit. */\n outputTruncated?: boolean;\n /** Whether stdout exceeded the configured capture limit. */\n stdoutTruncated?: boolean;\n /** Whether stderr exceeded the configured capture limit. */\n stderrTruncated?: boolean;\n /** Spawn error, when the executable did not start. */\n error?: NodeJS.ErrnoException;\n}\n\n/** Captured subprocess runner. */\nexport type CapturedProcessRunner = (\n command: string,\n args: readonly string[],\n options: {\n /** Working directory. */\n cwd: string;\n /** Optional standard input. */\n input?: string;\n /** Child environment; PATH is retained so the executable can be resolved. */\n env?: NodeJS.ProcessEnv;\n /** Optional process timeout. */\n timeoutMs?: number;\n /** Maximum bytes retained from each output stream. */\n maxOutputBytes?: number;\n },\n context: LocalContext,\n) => Promise<CapturedProcessResult>;\n\n/**\n * Capture a subprocess without forwarding its output.\n *\n * @param command - Executable\n * @param args - Arguments\n * @param options - CWD and optional standard input\n * @param context - CLI context\n * @returns Captured result\n */\nexport const runCapturedProcess: CapturedProcessRunner = (command, args, options, context) =>\n new Promise((resolveResult) => {\n const child = spawn(command, [...args], {\n cwd: options.cwd,\n env: {\n ...(options.env ?? context.process.env),\n PATH: context.process.env.PATH,\n NO_COLOR: '1',\n },\n stdio: 'pipe',\n });\n let stdout = '';\n let stderr = '';\n let stdoutTruncated = false;\n let stderrTruncated = false;\n let timedOut = false;\n let inputError: NodeJS.ErrnoException | undefined;\n let settled = false;\n let forceKillTimer: NodeJS.Timeout | undefined;\n const timeoutTimer = options.timeoutMs\n ? setTimeout(() => {\n timedOut = true;\n child.kill('SIGTERM');\n forceKillTimer = setTimeout(() => child.kill('SIGKILL'), 1000);\n }, options.timeoutMs)\n : undefined;\n const finish = (result: CapturedProcessResult): void => {\n if (settled) {\n return;\n }\n settled = true;\n if (timeoutTimer) {\n clearTimeout(timeoutTimer);\n }\n if (forceKillTimer) {\n clearTimeout(forceKillTimer);\n }\n resolveResult({\n ...result,\n ...(timedOut ? { timedOut: true } : {}),\n ...(inputError ? { inputError } : {}),\n ...(stdoutTruncated || stderrTruncated ? { outputTruncated: true } : {}),\n ...(stdoutTruncated ? { stdoutTruncated: true } : {}),\n ...(stderrTruncated ? { stderrTruncated: true } : {}),\n });\n };\n const appendOutput = (output: string, chunk: string, markTruncated: () => void): string => {\n if (!options.maxOutputBytes) {\n return output + chunk;\n }\n const remaining = options.maxOutputBytes - Buffer.byteLength(output);\n const bytes = Buffer.from(chunk);\n if (remaining <= 0) {\n markTruncated();\n return output;\n }\n if (bytes.length > remaining) {\n markTruncated();\n let end = remaining;\n while (end > 0 && (bytes[end]! & 0b1100_0000) === 0b1000_0000) {\n end -= 1;\n }\n return output + bytes.subarray(0, end).toString('utf8');\n }\n return output + chunk;\n };\n child.stdout.setEncoding('utf8');\n child.stderr.setEncoding('utf8');\n child.stdout.on('data', (chunk: string) => {\n stdout = appendOutput(stdout, chunk, () => {\n stdoutTruncated = true;\n });\n });\n child.stderr.on('data', (chunk: string) => {\n stderr = appendOutput(stderr, chunk, () => {\n stderrTruncated = true;\n });\n });\n child.stdin.on('error', (error: NodeJS.ErrnoException) => {\n inputError = error;\n });\n child.once('error', (error: NodeJS.ErrnoException) => {\n finish({\n code: 1,\n stdout,\n stderr,\n error,\n });\n });\n child.once('close', (code, signal) => {\n finish({\n code: timedOut || inputError ? 1 : (code ?? 1),\n stdout,\n stderr,\n ...(signal ? { signal } : {}),\n });\n });\n try {\n if (options.input === undefined) {\n child.stdin.end();\n } else {\n child.stdin.end(options.input);\n }\n } catch (error) {\n inputError = error as NodeJS.ErrnoException;\n child.kill('SIGTERM');\n }\n });\n"],"mappings":"gFAyDA,MAAa,GAA6C,EAAS,EAAM,EAAS,IAChF,IAAI,QAAS,GAAkB,CAC7B,IAAM,EAAQ,EAAM,EAAS,CAAC,GAAG,EAAK,CAAE,CACtC,IAAK,EAAQ,IACb,IAAK,CACH,GAAI,EAAQ,KAAO,EAAQ,QAAQ,IACnC,KAAM,EAAQ,QAAQ,IAAI,KAC1B,SAAU,IACX,CACD,MAAO,OACR,CAAC,CACE,EAAS,GACT,EAAS,GACT,EAAkB,GAClB,EAAkB,GAClB,EAAW,GACX,EACA,EAAU,GACV,EACE,EAAe,EAAQ,UACzB,eAAiB,CACf,EAAW,GACX,EAAM,KAAK,UAAU,CACrB,EAAiB,eAAiB,EAAM,KAAK,UAAU,CAAE,IAAK,EAC7D,EAAQ,UAAU,CACrB,IAAA,GACE,EAAU,GAAwC,CAClD,IAGJ,EAAU,GACN,GACF,aAAa,EAAa,CAExB,GACF,aAAa,EAAe,CAE9B,EAAc,CACZ,GAAG,EACH,GAAI,EAAW,CAAE,SAAU,GAAM,CAAG,EAAE,CACtC,GAAI,EAAa,CAAE,aAAY,CAAG,EAAE,CACpC,GAAI,GAAmB,EAAkB,CAAE,gBAAiB,GAAM,CAAG,EAAE,CACvE,GAAI,EAAkB,CAAE,gBAAiB,GAAM,CAAG,EAAE,CACpD,GAAI,EAAkB,CAAE,gBAAiB,GAAM,CAAG,EAAE,CACrD,CAAC,GAEE,GAAgB,EAAgB,EAAe,IAAsC,CACzF,GAAI,CAAC,EAAQ,eACX,OAAO,EAAS,EAElB,IAAM,EAAY,EAAQ,eAAiB,EAAO,WAAW,EAAO,CAC9D,EAAQ,EAAO,KAAK,EAAM,CAChC,GAAI,GAAa,EAEf,OADA,GAAe,CACR,EAET,GAAI,EAAM,OAAS,EAAW,CAC5B,GAAe,CACf,IAAI,EAAM,EACV,KAAO,EAAM,IAAM,EAAM,GAAQ,MAAiB,KAChD,IAEF,OAAO,EAAS,EAAM,SAAS,EAAG,EAAI,CAAC,SAAS,OAAO,CAEzD,OAAO,EAAS,GAElB,EAAM,OAAO,YAAY,OAAO,CAChC,EAAM,OAAO,YAAY,OAAO,CAChC,EAAM,OAAO,GAAG,OAAS,GAAkB,CACzC,EAAS,EAAa,EAAQ,MAAa,CACzC,EAAkB,IAClB,EACF,CACF,EAAM,OAAO,GAAG,OAAS,GAAkB,CACzC,EAAS,EAAa,EAAQ,MAAa,CACzC,EAAkB,IAClB,EACF,CACF,EAAM,MAAM,GAAG,QAAU,GAAiC,CACxD,EAAa,GACb,CACF,EAAM,KAAK,QAAU,GAAiC,CACpD,EAAO,CACL,KAAM,EACN,SACA,SACA,QACD,CAAC,EACF,CACF,EAAM,KAAK,SAAU,EAAM,IAAW,CACpC,EAAO,CACL,KAAM,GAAY,EAAa,EAAK,GAAQ,EAC5C,SACA,SACA,GAAI,EAAS,CAAE,SAAQ,CAAG,EAAE,CAC7B,CAAC,EACF,CACF,GAAI,CACE,EAAQ,QAAU,IAAA,GACpB,EAAM,MAAM,KAAK,CAEjB,EAAM,MAAM,IAAI,EAAQ,MAAM,OAEzB,EAAO,CACd,EAAa,EACb,EAAM,KAAK,UAAU,GAEvB"}
@@ -1,2 +1,2 @@
1
- import{n as e}from"./policy-runtime-BMKa-Upy.mjs";import{spawn as t,spawnSync as n}from"node:child_process";function r(t=n){let r=t(`opa`,[`version`],{stdio:`ignore`});if(r.error||r.status!==0)throw Error(e)}function i(n,r={}){return new Promise((i,a)=>{let o=t(`opa`,n,{cwd:r.cwd,stdio:`inherit`});o.on(`error`,t=>{if(t.code===`ENOENT`){a(Error(e));return}a(t)}),o.on(`close`,e=>i(e??1))})}function a(n,r={}){return new Promise((i,a)=>{let o=t(`opa`,n,{cwd:r.cwd,stdio:[`ignore`,`pipe`,`pipe`]}),s=``,c=``;o.stdout?.on(`data`,e=>{s+=e.toString()}),o.stderr?.on(`data`,e=>{c+=e.toString()}),o.on(`error`,t=>{if(t.code===`ENOENT`){a(Error(e));return}a(t)}),o.on(`close`,e=>i({code:e??1,stdout:s,stderr:c}))})}export{i as n,r,a as t};
2
- //# sourceMappingURL=runOpa-CswzJxIs.mjs.map
1
+ import{n as e}from"./policy-runtime-6jmkXlBk.mjs";import{spawn as t,spawnSync as n}from"node:child_process";function r(t=n){let r=t(`opa`,[`version`],{stdio:`ignore`});if(r.error||r.status!==0)throw Error(e)}function i(n,r={}){return new Promise((i,a)=>{let o=t(`opa`,n,{cwd:r.cwd,stdio:`inherit`});o.on(`error`,t=>{if(t.code===`ENOENT`){a(Error(e));return}a(t)}),o.on(`close`,e=>i(e??1))})}function a(n,r={}){return new Promise((i,a)=>{let o=t(`opa`,n,{cwd:r.cwd,stdio:[`ignore`,`pipe`,`pipe`]}),s=``,c=``;o.stdout?.on(`data`,e=>{s+=e.toString()}),o.stderr?.on(`data`,e=>{c+=e.toString()}),o.on(`error`,t=>{if(t.code===`ENOENT`){a(Error(e));return}a(t)}),o.on(`close`,e=>i({code:e??1,stdout:s,stderr:c}))})}export{i as n,r,a as t};
2
+ //# sourceMappingURL=runOpa-ojIqU1tO.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"runOpa-CswzJxIs.mjs","names":[],"sources":["../src/commands/policy/helpers/assertOpaInstalled.ts","../src/commands/policy/helpers/runOpa.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\n\nimport { OPA_CLI_MISSING_MESSAGE } from '../../../lib/policy/policy-runtime.js';\n\n/** Options used to suppress output from the availability check. */\ninterface OpaSpawnOptions {\n /** Discard child process output. */\n stdio: 'ignore';\n}\n\n/** Synchronously invokes a command for availability checks. */\ntype SpawnSync = (\n command: string,\n args: string[],\n options: OpaSpawnOptions,\n) => Pick<ReturnType<typeof spawnSync>, 'error' | 'status'>;\n\n/**\n * Ensures the `opa` binary is available on PATH.\n *\n * @param runSpawnSync - Child process runner dependency\n * @throws Error when `opa` is not installed\n */\nexport function assertOpaInstalled(runSpawnSync: SpawnSync = spawnSync): void {\n const result = runSpawnSync('opa', ['version'], { stdio: 'ignore' });\n if (result.error || result.status !== 0) {\n throw new Error(OPA_CLI_MISSING_MESSAGE);\n }\n}\n","import { spawn } from 'node:child_process';\n\nimport { OPA_CLI_MISSING_MESSAGE } from '../../../lib/policy/policy-runtime.js';\n\n/** Result of an OPA CLI invocation with captured output. */\nexport interface RunOpaCaptureResult {\n /** Child process exit code */\n code: number;\n /** Captured stdout */\n stdout: string;\n /** Captured stderr */\n stderr: string;\n}\n\n/**\n * Runs an OPA CLI command and streams stdout/stderr to the current process.\n *\n * @param args - Arguments passed to the `opa` binary\n * @param options - Optional working directory\n * @returns The child process exit code\n */\nexport function runOpa(args: string[], options: { cwd?: string } = {}): Promise<number> {\n return new Promise<number>((resolve, reject) => {\n const child = spawn('opa', args, {\n cwd: options.cwd,\n stdio: 'inherit',\n });\n\n child.on('error', (err) => {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') {\n reject(new Error(OPA_CLI_MISSING_MESSAGE));\n return;\n }\n reject(err);\n });\n child.on('close', (code) => resolve(code ?? 1));\n });\n}\n\n/**\n * Runs an OPA CLI command and captures stdout/stderr.\n *\n * @param args - Arguments passed to the `opa` binary\n * @param options - Optional working directory\n * @returns Exit code and captured output\n */\nexport function runOPACapture(\n args: string[],\n options: { cwd?: string } = {},\n): Promise<RunOpaCaptureResult> {\n return new Promise<RunOpaCaptureResult>((resolve, reject) => {\n const child = spawn('opa', args, {\n cwd: options.cwd,\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n\n let stdout = '';\n let stderr = '';\n\n child.stdout?.on('data', (chunk: Buffer) => {\n stdout += chunk.toString();\n });\n child.stderr?.on('data', (chunk: Buffer) => {\n stderr += chunk.toString();\n });\n\n child.on('error', (err) => {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') {\n reject(new Error(OPA_CLI_MISSING_MESSAGE));\n return;\n }\n reject(err);\n });\n child.on('close', (code) => resolve({ code: code ?? 1, stdout, stderr }));\n });\n}\n"],"mappings":"4GAuBA,SAAgB,EAAmB,EAA0B,EAAiB,CAC5E,IAAM,EAAS,EAAa,MAAO,CAAC,UAAU,CAAE,CAAE,MAAO,SAAU,CAAC,CACpE,GAAI,EAAO,OAAS,EAAO,SAAW,EACpC,MAAU,MAAM,EAAwB,CCL5C,SAAgB,EAAO,EAAgB,EAA4B,EAAE,CAAmB,CACtF,OAAO,IAAI,SAAiB,EAAS,IAAW,CAC9C,IAAM,EAAQ,EAAM,MAAO,EAAM,CAC/B,IAAK,EAAQ,IACb,MAAO,UACR,CAAC,CAEF,EAAM,GAAG,QAAU,GAAQ,CACzB,GAAK,EAA8B,OAAS,SAAU,CACpD,EAAW,MAAM,EAAwB,CAAC,CAC1C,OAEF,EAAO,EAAI,EACX,CACF,EAAM,GAAG,QAAU,GAAS,EAAQ,GAAQ,EAAE,CAAC,EAC/C,CAUJ,SAAgB,EACd,EACA,EAA4B,EAAE,CACA,CAC9B,OAAO,IAAI,SAA8B,EAAS,IAAW,CAC3D,IAAM,EAAQ,EAAM,MAAO,EAAM,CAC/B,IAAK,EAAQ,IACb,MAAO,CAAC,SAAU,OAAQ,OAAO,CAClC,CAAC,CAEE,EAAS,GACT,EAAS,GAEb,EAAM,QAAQ,GAAG,OAAS,GAAkB,CAC1C,GAAU,EAAM,UAAU,EAC1B,CACF,EAAM,QAAQ,GAAG,OAAS,GAAkB,CAC1C,GAAU,EAAM,UAAU,EAC1B,CAEF,EAAM,GAAG,QAAU,GAAQ,CACzB,GAAK,EAA8B,OAAS,SAAU,CACpD,EAAW,MAAM,EAAwB,CAAC,CAC1C,OAEF,EAAO,EAAI,EACX,CACF,EAAM,GAAG,QAAU,GAAS,EAAQ,CAAE,KAAM,GAAQ,EAAG,SAAQ,SAAQ,CAAC,CAAC,EACzE"}
1
+ {"version":3,"file":"runOpa-ojIqU1tO.mjs","names":[],"sources":["../src/commands/policy/helpers/assertOpaInstalled.ts","../src/commands/policy/helpers/runOpa.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\n\nimport { OPA_CLI_MISSING_MESSAGE } from '../../../lib/policy/policy-runtime.js';\n\n/** Options used to suppress output from the availability check. */\ninterface OpaSpawnOptions {\n /** Discard child process output. */\n stdio: 'ignore';\n}\n\n/** Synchronously invokes a command for availability checks. */\ntype SpawnSync = (\n command: string,\n args: string[],\n options: OpaSpawnOptions,\n) => Pick<ReturnType<typeof spawnSync>, 'error' | 'status'>;\n\n/**\n * Ensures the `opa` binary is available on PATH.\n *\n * @param runSpawnSync - Child process runner dependency\n * @throws Error when `opa` is not installed\n */\nexport function assertOpaInstalled(runSpawnSync: SpawnSync = spawnSync): void {\n const result = runSpawnSync('opa', ['version'], { stdio: 'ignore' });\n if (result.error || result.status !== 0) {\n throw new Error(OPA_CLI_MISSING_MESSAGE);\n }\n}\n","import { spawn } from 'node:child_process';\n\nimport { OPA_CLI_MISSING_MESSAGE } from '../../../lib/policy/policy-runtime.js';\n\n/** Result of an OPA CLI invocation with captured output. */\nexport interface RunOpaCaptureResult {\n /** Child process exit code */\n code: number;\n /** Captured stdout */\n stdout: string;\n /** Captured stderr */\n stderr: string;\n}\n\n/**\n * Runs an OPA CLI command and streams stdout/stderr to the current process.\n *\n * @param args - Arguments passed to the `opa` binary\n * @param options - Optional working directory\n * @returns The child process exit code\n */\nexport function runOpa(args: string[], options: { cwd?: string } = {}): Promise<number> {\n return new Promise<number>((resolve, reject) => {\n const child = spawn('opa', args, {\n cwd: options.cwd,\n stdio: 'inherit',\n });\n\n child.on('error', (err) => {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') {\n reject(new Error(OPA_CLI_MISSING_MESSAGE));\n return;\n }\n reject(err);\n });\n child.on('close', (code) => resolve(code ?? 1));\n });\n}\n\n/**\n * Runs an OPA CLI command and captures stdout/stderr.\n *\n * @param args - Arguments passed to the `opa` binary\n * @param options - Optional working directory\n * @returns Exit code and captured output\n */\nexport function runOPACapture(\n args: string[],\n options: { cwd?: string } = {},\n): Promise<RunOpaCaptureResult> {\n return new Promise<RunOpaCaptureResult>((resolve, reject) => {\n const child = spawn('opa', args, {\n cwd: options.cwd,\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n\n let stdout = '';\n let stderr = '';\n\n child.stdout?.on('data', (chunk: Buffer) => {\n stdout += chunk.toString();\n });\n child.stderr?.on('data', (chunk: Buffer) => {\n stderr += chunk.toString();\n });\n\n child.on('error', (err) => {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') {\n reject(new Error(OPA_CLI_MISSING_MESSAGE));\n return;\n }\n reject(err);\n });\n child.on('close', (code) => resolve({ code: code ?? 1, stdout, stderr }));\n });\n}\n"],"mappings":"4GAuBA,SAAgB,EAAmB,EAA0B,EAAiB,CAC5E,IAAM,EAAS,EAAa,MAAO,CAAC,UAAU,CAAE,CAAE,MAAO,SAAU,CAAC,CACpE,GAAI,EAAO,OAAS,EAAO,SAAW,EACpC,MAAU,MAAM,EAAwB,CCL5C,SAAgB,EAAO,EAAgB,EAA4B,EAAE,CAAmB,CACtF,OAAO,IAAI,SAAiB,EAAS,IAAW,CAC9C,IAAM,EAAQ,EAAM,MAAO,EAAM,CAC/B,IAAK,EAAQ,IACb,MAAO,UACR,CAAC,CAEF,EAAM,GAAG,QAAU,GAAQ,CACzB,GAAK,EAA8B,OAAS,SAAU,CACpD,EAAW,MAAM,EAAwB,CAAC,CAC1C,OAEF,EAAO,EAAI,EACX,CACF,EAAM,GAAG,QAAU,GAAS,EAAQ,GAAQ,EAAE,CAAC,EAC/C,CAUJ,SAAgB,EACd,EACA,EAA4B,EAAE,CACA,CAC9B,OAAO,IAAI,SAA8B,EAAS,IAAW,CAC3D,IAAM,EAAQ,EAAM,MAAO,EAAM,CAC/B,IAAK,EAAQ,IACb,MAAO,CAAC,SAAU,OAAQ,OAAO,CAClC,CAAC,CAEE,EAAS,GACT,EAAS,GAEb,EAAM,QAAQ,GAAG,OAAS,GAAkB,CAC1C,GAAU,EAAM,UAAU,EAC1B,CACF,EAAM,QAAQ,GAAG,OAAS,GAAkB,CAC1C,GAAU,EAAM,UAAU,EAC1B,CAEF,EAAM,GAAG,QAAU,GAAQ,CACzB,GAAK,EAA8B,OAAS,SAAU,CACpD,EAAW,MAAM,EAAwB,CAAC,CAC1C,OAEF,EAAO,EAAI,EACX,CACF,EAAM,GAAG,QAAU,GAAS,EAAQ,CAAE,KAAM,GAAQ,EAAG,SAAQ,SAAQ,CAAC,CAAC,EACzE"}
@@ -1,2 +1,2 @@
1
1
  const e={Deno:`deno`,Editor:`editor`,Skill:`skill`,Ci:`ci`};export{e as t};
2
- //# sourceMappingURL=scaffold-model-BAbYTR0q.mjs.map
2
+ //# sourceMappingURL=scaffold-model-CUZER0BC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scaffold-model-CUZER0BC.mjs","names":[],"sources":["../src/lib/custom-functions/scaffold-model.ts"],"sourcesContent":["import type { ExistingProjectSkillDirectory } from '../scaffolding/agent-skill.js';\nimport type { ProjectPlan } from '../scaffolding/project-plan.js';\n\n/** Version of the stable Custom Function JSON result contracts. */\nexport const CUSTOM_FUNCTION_RESULT_VERSION = 1 as const;\n\n/** One repository setup capability. */\nexport const CustomFunctionSetupFeature = {\n /** Deno import map and strict compiler configuration. */\n Deno: 'deno',\n /** Target-scoped editor configuration. */\n Editor: 'editor',\n /** Coding-agent authoring skill. */\n Skill: 'skill',\n /** GitHub Actions validation workflow. */\n Ci: 'ci',\n} as const;\n\n/** One repository setup capability. */\nexport type CustomFunctionSetupFeature =\n (typeof CustomFunctionSetupFeature)[keyof typeof CustomFunctionSetupFeature];\n\n/** Repository and target state collected before planning. */\nexport interface CustomFunctionProjectState {\n /** Directory from which the CLI was invoked. */\n invocationDirectory: string;\n /** Absolute user-selected target directory. */\n targetDirectory: string;\n /** Root that owns repository-level editor and agent setup. */\n projectRoot: string;\n /** Directory relative to which manifest file references resolve. */\n manifestDirectory: string;\n /** Absolute manifest path. */\n manifestPath: string;\n /** Nearest repository root, when present. */\n repositoryRoot?: string;\n /** Existing Deno configuration path, or desired deno.json path. */\n denoConfigPath: string;\n /** Existing project-level skill directories; home state is deliberately ignored. */\n existingSkillDirectories: ExistingProjectSkillDirectory[];\n /** Whether the repository appears to use GitHub. */\n usesGithub: boolean;\n /** Case-preserving relative paths below the manifest directory. */\n relativePaths: string[];\n}\n\n/** A complete, validated scaffold plan. */\nexport interface CustomFunctionProjectPlan extends ProjectPlan {\n /** JSON contract version. */\n version: typeof CUSTOM_FUNCTION_RESULT_VERSION;\n /** Command that produced the plan. */\n command: 'init' | 'new';\n /** Absolute project target directory. */\n targetDirectory: string;\n /** Absolute manifest path. */\n manifestPath: string;\n /** Files inspected and deliberately left unchanged. */\n unchanged: string[];\n /** Non-fatal plan warnings. */\n warnings: string[];\n /** Commands shown after a successful apply. */\n nextSteps: string[];\n}\n"],"mappings":"AAOA,MAAa,EAA6B,CAExC,KAAM,OAEN,OAAQ,SAER,MAAO,QAEP,GAAI,KACL"}
@@ -1,4 +1,4 @@
1
- import{a as e}from"./scaffold-templates-DzDGTZie.mjs";import{c as t,f as n,g as r,l as i,m as a,p as o,u as s}from"./prompts-ClBXdELk.mjs";import{n as c,o as l,s as u}from"./deno-runtime-DV52X8-P.mjs";import{r as d,t as f}from"./manifest-BNIpO_zW.mjs";import{t as p}from"./scaffold-model-BAbYTR0q.mjs";import{n as m,r as h,t as g}from"./jsonc-D9dDWb1J.mjs";import{basename as _,isAbsolute as v,join as y,relative as b,resolve as x,sep as S}from"node:path";import{createHash as C}from"node:crypto";var w=`# Project setup and CI
1
+ import{i as e,n as t,t as n}from"./project-plan-output-BHHlkLxe.mjs";import{n as r,r as i}from"./paths-J5KScOaQ.mjs";import{a}from"./scaffold-templates-CUL82Zf8.mjs";import{c as o,f as s,l as c,u as l}from"./project-discovery-CWRjlFnC.mjs";import{a as u,r as d}from"./project-discovery-BkHpTXDx.mjs";import{n as f}from"./deno-runtime-CB2HBach.mjs";import{t as p}from"./scaffold-model-CUZER0BC.mjs";import{n as m,r as h,t as g}from"./jsonc-CdTubr53.mjs";import{basename as _,isAbsolute as v,join as y,relative as b,resolve as x,sep as S}from"node:path";import{createHash as C}from"node:crypto";var w=`# Project setup and CI
2
2
 
3
3
  ## Install the CLI
4
4
 
@@ -49,7 +49,7 @@ transcend custom-functions check "<custom-function-directory>" \\
49
49
  \`\`\`
50
50
 
51
51
  Do not add deployment credentials to validation-only jobs.
52
- `,T='# Writing Custom Functions\n\n## Add a function\n\nInitialize the project first, then scaffold a function:\n\n```sh\ntranscend custom-functions new\n```\n\nChoose the smallest matching template:\n\n- `general` for a General Custom Function\n- `dsr-datapoint` for the DSR data-point handler\n- `dsr-enricher` for the DSR request enricher\n- `dsr-both` when both DSR exports are required\n\nInspect the generated source, manifest entry, and payloads before implementing. Keep the generated export shape unless the manifest and fixtures change with it.\n\n## Type contracts\n\nImport `CustomFunction` as a type from `@transcend-io/custom-function-types`:\n\n- General functions default-export a handler using `CustomFunction.GeneralArgument`.\n- DSR data-point functions default-export a handler using `CustomFunction.Argument`.\n- DSR request enrichers export `enricher` using `CustomFunction.EnricherArgument`.\n\nHandlers receive `payload`, `environment`, `sdk`, and `kv`. Use:\n\n- `payload` for trigger data\n- `environment` for configured values\n- `sdk` for Transcend and external HTTP calls\n- `kv` for small persistent strings\n\nCheck `response.ok` for every `sdk.fetch` call. Include the response status and useful response details in failures without exposing secrets.\n\n## Manifest and fixtures\n\n- Use `<<parameters.ENV_NAME>>` placeholders for secret values, matching each placeholder name to its environment key.\n- Add every external network destination to `allowed-hosts`. Transcend SDK routes do not require an allowed-host entry.\n- Set `allow-third-party-imports` only when the implementation needs undeclared third-party modules.\n- Keep each function self-contained in its entry source file. Local runtime imports are not deployed; remote and `npm:` imports follow `allow-third-party-imports`.\n- Keep fixtures minimal but realistic, with at least one case for every implemented export.\n- Match DSR fixtures to `DATA_POINT` and `REQUEST_ENRICHER`. Do not hardcode values such as the data silo identity that the push workflow supplies.\n\n## Run locally\n\nExercise every configured fixture and show `console.log` output:\n\n```sh\ntranscend custom-functions run "<custom-function-directory>" \\\n --function="<function-name>" \\\n --variables=TRANSCEND_API_KEY:placeholder\n```\n\nThe local simulator mirrors Deno permissions, payload preparation, export selection, timeouts, environment isolation, and KV limits. It starts KV empty for each fixture and simulates `sdk.fetch` with a logged HTTP 200 response without making a request. Pass every `<<parameters.name>>` value through `--variables="name:value"`. Native network calls are denied unless the user explicitly passes `--allowNetwork`; those real requests can have side effects. Treat the simulator as a fast development loop, not proof of production behavior.\n\n## Validate and deploy\n\nRun:\n\n```sh\ntranscend custom-functions check "<custom-function-directory>" \\\n --variables=TRANSCEND_API_KEY:placeholder\ntranscend custom-functions push \\\n --file="<custom-function-directory>/transcend-functions.yml" \\\n --auth="$TRANSCEND_API_KEY" \\\n --variables="TRANSCEND_API_KEY:$TRANSCEND_API_KEY" \\\n --dryRun\n```\n\nRun, check, and push require every manifest variable. Placeholder values are sufficient for local validation; pass real secrets only when they are needed for authenticated push tests or deployment. Fix every check failure before pushing. Keep a revision as a draft with `--promote=false`. After the first successful push, use `--updateManifest` to record assigned IDs for stable future matching.\n',E=`---
52
+ `,T='# Writing Custom Functions\n\n## Add a function\n\nInitialize the project first, then scaffold a function:\n\n```sh\ntranscend custom-functions new\n```\n\nChoose the smallest matching template:\n\n- `general` for a General Custom Function\n- `dsr-datapoint` for the DSR data-point handler\n- `dsr-enricher` for the DSR request enricher\n- `dsr-both` when both DSR exports are required\n\nInspect the generated source, manifest entry, and payloads before implementing. Keep the generated export shape unless the manifest and fixtures change with it.\n\n## Type contracts\n\nImport `CustomFunction` as a type from `@transcend-io/custom-function-types`:\n\n- General functions default-export a handler using `CustomFunction.GeneralArgument`.\n- DSR data-point functions default-export a handler using `CustomFunction.Argument`.\n- DSR request enrichers export `enricher` using `CustomFunction.EnricherArgument`.\n\nHandlers receive `payload`, `environment`, `sdk`, and `kv`. Use:\n\n- `payload` for trigger data\n- `environment` for configured values\n- `sdk` for Transcend and external HTTP calls\n- `kv` for small persistent strings\n\nCheck `response.ok` for every `sdk.fetch` call. Include the response status and useful response details in failures without exposing secrets.\n\n## Manifest and fixtures\n\n- Use `<<parameters.ENV_NAME>>` placeholders for secret values, matching each placeholder name to its environment key.\n- Add every external network destination to `allowed-hosts`. Transcend SDK routes do not require an allowed-host entry.\n- Set `allow-third-party-imports` only when the implementation needs undeclared third-party modules.\n- Keep each function self-contained in its entry source file. Local runtime imports are not deployed; remote and `npm:` imports follow `allow-third-party-imports`.\n- Keep fixtures minimal but realistic, with at least one case for every implemented export.\n- Match DSR fixtures to `DATA_POINT` and `REQUEST_ENRICHER`. Do not hardcode values such as the data silo identity that the push workflow supplies.\n\n## Run locally\n\nExercise every configured fixture and show `console.log` output:\n\n```sh\ntranscend custom-functions run "<custom-function-directory>" \\\n --function="<function-name>" \\\n --variables=TRANSCEND_API_KEY:placeholder\n```\n\nThe local simulator mirrors Deno permissions, payload preparation, export selection, timeouts, environment isolation, and KV limits. It starts KV empty for each fixture and simulates `sdk.fetch` with a logged HTTP 200 response without making a request. Pass every `<<parameters.name>>` value through `--variables="name:value"`. Native network calls are denied unless the user explicitly passes `--allowNetwork`; those real requests can have side effects. Treat the simulator as a fast development loop, not proof of production behavior.\n\n## Validate and deploy\n\nRun:\n\n```sh\ntranscend custom-functions check "<custom-function-directory>" \\\n --variables=TRANSCEND_API_KEY:placeholder\ntranscend custom-functions push "<custom-function-directory>" \\\n --auth="$TRANSCEND_API_KEY" \\\n --variables="TRANSCEND_API_KEY:$TRANSCEND_API_KEY" \\\n --dryRun\n```\n\nRun, check, and push require every manifest variable. Placeholder values are sufficient for local validation; pass real secrets only when they are needed for authenticated push tests or deployment. Fix every check failure before pushing. Keep a revision as a draft with `--promote=false`. After the first successful push, use `--updateManifest` to record assigned IDs for stable future matching.\n',E=`---
53
53
  name: transcend-custom-functions
54
54
  description: Sets up, implements, validates, and deploys Transcend Custom Functions. Use when working with transcend-functions.yml, General or DSR handlers, test payloads, Deno configuration, Custom Function CI, or transcend custom-functions CLI commands.
55
55
  compatibility: Requires Deno 2.x (2.4.5 recommended) for local validation and the Transcend CLI.
@@ -79,7 +79,7 @@ Use the CLI for deterministic scaffolding and validation. Use this skill for the
79
79
  - Do not invent third-party API endpoints, authentication behavior, or field mappings. Inspect available documentation and existing code; ask for missing requirements.
80
80
  - Keep source and test-payload paths relative to the manifest.
81
81
  - Custom Functions run on Deno 2.4.5. Avoid Node-only APIs.
82
- `;const D=`transcend-custom-functions`,O=[{path:`SKILL.md`,contents:E},{path:`references/setup.md`,contents:w},{path:`references/writing-custom-functions.md`,contents:T}];function k(e){let t=e.hasSkill?`Use the \`${D}\` skill to`:`Ask your coding agent to`,n=`transcend custom-functions check ${l(e.targetDirectory,e.manifestPath)} --noInteractive`;return e.hasGithubWorkflow?`${t} review the Custom Function setup in \`${e.targetDirectory}\`, adapt the generated GitHub Actions workflow to this repository's conventions, and run \`${n}\`.`:`${t} review the Custom Function setup in \`${e.targetDirectory}\` and add equivalent CI for this repository: install Deno 2 and \`@transcend-io/cli@${e.cliVersion}\`, then run \`${n}\`.`}function A(e){let t=e.hasSkill?`Use the \`${D}\` skill to`:`Ask your coding agent to`,n=u(e.variableNames),r=`transcend custom-functions check ${l(e.targetDirectory,e.manifestPath)}${n}`,i=`transcend custom-functions run ${l(e.targetDirectory,e.manifestPath)} --function=${a(e.displayName)}${n}`;return`${t} implement \`${e.displayName}\` in \`${e.sourcePath}\`, replace the example fixtures with realistic cases, run \`${i}\` to exercise it locally, and finish with \`${r}\`.`}function j(e,t){return{version:e.version,command:e.command,applied:t.applied,dryRun:t.dryRun,targetDirectory:e.targetDirectory,manifestPath:e.manifestPath,changes:e.changes.map(e=>r(t.cwd,e)),warnings:e.warnings,nextSteps:e.nextSteps,aiHandoff:t.aiHandoff}}function M(e){return e.replace(/([!*?[\]\\])/gu,`\\$1`)}function N(e){let t=e.match(/# managed-by: @transcend-io\/cli; content-sha256: ([a-f0-9]{64})\s*$/u);if(!t||t.index===void 0)return!1;let n=e.slice(0,t.index).trimEnd();return C(`sha256`).update(n).digest(`hex`)===t[1]}function P(e){let{cliVersion:t,targetDirectory:n,manifestPath:r}=e,i=e.contentDirectory??n,a=i===`.`?``:`${M(i.replace(/\/+$/u,``))}/`,o=[`${a}functions/**`,`${a}test-payloads/**`,M(r),`${a}deno.json*`,...(e.watchedPaths??[]).map(M)].filter((e,t,n)=>n.indexOf(e)===t).map(e=>` - ${JSON.stringify(e)}`).join(`
82
+ `;const D=`transcend-custom-functions`,O=[{path:`SKILL.md`,contents:E},{path:`references/setup.md`,contents:w},{path:`references/writing-custom-functions.md`,contents:T}];function k(e){let t=e.hasSkill?`Use the \`${D}\` skill to`:`Ask your coding agent to`,n=`transcend custom-functions check ${r(e.targetDirectory,e.manifestPath)} --noInteractive`;return e.hasGithubWorkflow?`${t} review the Custom Function setup in \`${e.targetDirectory}\`, adapt the generated GitHub Actions workflow to this repository's conventions, and run \`${n}\`.`:`${t} review the Custom Function setup in \`${e.targetDirectory}\` and add equivalent CI for this repository: install Deno 2 and \`@transcend-io/cli@${e.cliVersion}\`, then run \`${n}\`.`}function A(e){let n=e.hasSkill?`Use the \`${D}\` skill to`:`Ask your coding agent to`,a=i(e.variableNames),o=`transcend custom-functions check ${r(e.targetDirectory,e.manifestPath)}${a}`,s=`transcend custom-functions run ${r(e.targetDirectory,e.manifestPath)} --function=${t(e.displayName)}${a}`;return`${n} implement \`${e.displayName}\` in \`${e.sourcePath}\`, replace the example fixtures with realistic cases, run \`${s}\` to exercise it locally, and finish with \`${o}\`.`}function j(t,n){return{version:t.version,command:t.command,applied:n.applied,dryRun:n.dryRun,targetDirectory:t.targetDirectory,manifestPath:t.manifestPath,changes:t.changes.map(t=>e(n.cwd,t)),warnings:t.warnings,nextSteps:t.nextSteps,aiHandoff:n.aiHandoff}}function M(e){return e.replace(/([!*?[\]\\])/gu,`\\$1`)}function N(e){let t=e.match(/# managed-by: @transcend-io\/cli; content-sha256: ([a-f0-9]{64})\s*$/u);if(!t||t.index===void 0)return!1;let n=e.slice(0,t.index).trimEnd();return C(`sha256`).update(n).digest(`hex`)===t[1]}function P(e){let{cliVersion:t,targetDirectory:n,manifestPath:r}=e,i=e.contentDirectory??n,a=i===`.`?``:`${M(i.replace(/\/+$/u,``))}/`,o=[`${a}functions/**`,`${a}test-payloads/**`,M(r),`${a}deno.json*`,...(e.watchedPaths??[]).map(M)].filter((e,t,n)=>n.indexOf(e)===t).map(e=>` - ${JSON.stringify(e)}`).join(`
83
83
  `),s=`# Generated by transcend custom-functions init.
84
84
  name: Transcend Custom Functions
85
85
 
@@ -101,7 +101,7 @@ jobs:
101
101
  - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
102
102
  - uses: denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed # v2.0.5
103
103
  with:
104
- deno-version: ${c}
104
+ deno-version: ${f}
105
105
  - name: Install the Transcend CLI
106
106
  run: npm install --global @transcend-io/cli@${t}
107
107
  - name: Validate Custom Functions
@@ -114,10 +114,10 @@ jobs:
114
114
  --variables=TRANSCEND_API_KEY:placeholder
115
115
  --noInteractive
116
116
  --json
117
- `,l=C(`sha256`).update(s.trimEnd()).digest(`hex`);return`${s.trimEnd()}\n\n# managed-by: @transcend-io/cli; content-sha256: ${l}\n`}function F(e,t,n=`transcend-functions.yml`,r={}){let i=h(e??`{}
118
- `,`Deno configuration`),a=i.compilerOptions&&typeof i.compilerOptions==`object`&&!Array.isArray(i.compilerOptions)?i.compilerOptions:{},o=i.lint&&typeof i.lint==`object`&&!Array.isArray(i.lint)?i.lint:{},s=i.fmt&&typeof i.fmt==`object`&&!Array.isArray(i.fmt)?i.fmt:{},c=i.tasks&&typeof i.tasks==`object`&&!Array.isArray(i.tasks)?i.tasks:{},u=`custom-functions:check`,d=`transcend custom-functions check ${l(`.`,n)} --noInteractive`,f=`transcend custom-functions check ${l(`.`,n)} --variables=TRANSCEND_API_KEY:placeholder --noInteractive`;if(c[u]!==void 0&&c[u]!==`deno check functions/**/*.ts && deno lint functions/ && deno fmt --check functions/ test-payloads/`&&c[u]!==d&&c[u]!==f)throw Error(`Deno task "${u}" already has a different command; apply the patch manually.`);return g(e,[{path:[`imports`,`@transcend-io/custom-function-types`],value:`npm:@transcend-io/custom-function-types@${t}`},{path:[`compilerOptions`,`strict`],value:!0},{path:[`compilerOptions`,`lib`],value:m(a.lib,[`deno.ns`,`dom`,`dom.iterable`,`esnext`])},{path:[`lint`,`include`],value:m(o.include,[`functions/`,...r.sources??[]])},{path:[`fmt`,`include`],value:m(s.include,[`functions/`,`test-payloads/`,n,...r.sources??[],...r.payloads??[]])},{path:[`fmt`,`singleQuote`],value:!0},{path:[`fmt`,`lineWidth`],value:100},{path:[`tasks`,u],value:f}],`Deno configuration`)}function I(e,t,n){let r=h(e??`{}
117
+ `,c=C(`sha256`).update(s.trimEnd()).digest(`hex`);return`${s.trimEnd()}\n\n# managed-by: @transcend-io/cli; content-sha256: ${c}\n`}function F(e,t,n=`transcend-functions.yml`,i={}){let a=h(e??`{}
118
+ `,`Deno configuration`),o=a.compilerOptions&&typeof a.compilerOptions==`object`&&!Array.isArray(a.compilerOptions)?a.compilerOptions:{},s=a.lint&&typeof a.lint==`object`&&!Array.isArray(a.lint)?a.lint:{},c=a.fmt&&typeof a.fmt==`object`&&!Array.isArray(a.fmt)?a.fmt:{},l=a.tasks&&typeof a.tasks==`object`&&!Array.isArray(a.tasks)?a.tasks:{},u=`custom-functions:check`,d=`transcend custom-functions check ${r(`.`,n)} --noInteractive`,f=`transcend custom-functions check ${r(`.`,n)} --variables=TRANSCEND_API_KEY:placeholder --noInteractive`;if(l[u]!==void 0&&l[u]!==`deno check functions/**/*.ts && deno lint functions/ && deno fmt --check functions/ test-payloads/`&&l[u]!==d&&l[u]!==f)throw Error(`Deno task "${u}" already has a different command; apply the patch manually.`);return g(e,[{path:[`imports`,`@transcend-io/custom-function-types`],value:`npm:@transcend-io/custom-function-types@${t}`},{path:[`compilerOptions`,`strict`],value:!0},{path:[`compilerOptions`,`lib`],value:m(o.lib,[`deno.ns`,`dom`,`dom.iterable`,`esnext`])},{path:[`lint`,`include`],value:m(s.include,[`functions/`,...i.sources??[]])},{path:[`fmt`,`include`],value:m(c.include,[`functions/`,`test-payloads/`,n,...i.sources??[],...i.payloads??[]])},{path:[`fmt`,`singleQuote`],value:!0},{path:[`fmt`,`lineWidth`],value:100},{path:[`tasks`,u],value:f}],`Deno configuration`)}function I(e,t,n){let r=h(e??`{}
119
119
  `,`editor settings`),i=b(t,n).split(S).join(`/`)||`.`;return g(e,[{path:[`deno.enable`],value:!0},{path:[`deno.enablePaths`],value:m(r[`deno.enablePaths`],[i])}],`editor settings`)}function L(e){return g(e,[{path:[`recommendations`],value:m(h(e??`{}
120
- `,`editor extension recommendations`).recommendations,[`denoland.vscode-deno`])}],`editor extension recommendations`)}const R={name:D,displayName:`Custom Function`,owner:`@transcend-io/cli`,files:O};function z(e){let t=JSON.stringify(e)??``;return[...new Set(Array.from(t.matchAll(/<<parameters\.([^>]+)>>/gu),e=>e[1]))]}function B(e){return e.projectRoot}function V(e,n){let r=B(e),i=new Set([e.manifestPath]),a=new Set(n.features);return a.has(p.Deno)&&i.add(e.denoConfigPath),a.has(p.Editor)&&(i.add(y(r,`.vscode`,`settings.json`)),i.add(y(r,`.vscode`,`extensions.json`))),a.has(p.Skill)&&t(r,e.existingSkillDirectories,R).forEach(e=>i.add(e)),a.has(p.Ci)&&i.add(y(r,`.github`,`workflows`,`transcend-custom-functions.yml`)),[...i].sort((e,t)=>e.localeCompare(t))}function H(e,t){return[e.manifestPath,y(e.manifestDirectory,t.sourceFile.path),...t.payloadFiles.map(t=>y(e.manifestDirectory,t.path))].sort((e,t)=>e.localeCompare(t))}function U(e,t){let n=b(e,t);if(n===`..`||n.startsWith(`..${S}`)||v(n))throw Error(`Refusing to modify path outside project root: ${t}`)}function W(e,t){let n=B(e);U(e.targetDirectory,e.manifestPath),t.forEach(e=>U(n,e));let r=new Map(e.relativePaths.map(e=>[e.toLocaleLowerCase(`en-US`),e]));t.forEach(t=>{let n=b(e.manifestDirectory,t).split(S).join(`/`);if(n.startsWith(`../`))return;let i=n.split(`/`);for(let e=1;e<=i.length;e+=1){let t=i.slice(0,e).join(`/`),n=r.get(t.toLocaleLowerCase(`en-US`));if(n&&n!==t)throw Error(`Case-insensitive path collision: "${t}" conflicts with "${n}".`)}})}function G(e,t,r){let i=n({snapshot:s(t.snapshots,r.path),after:r.contents,description:r.description,...r.createOnly===void 0?{}:{createOnly:r.createOnly}});i?e.changes.push(i):e.unchanged.push(r.path)}function K(e,t){let{state:n}=e,r=l(n.targetDirectory,n.manifestPath,n.invocationDirectory),a={version:1,command:`init`,rootDirectory:B(n),targetDirectory:n.targetDirectory,manifestPath:n.manifestPath,changes:[],unchanged:[],warnings:[],nextSteps:[`transcend custom-functions new ${r}`,`transcend custom-functions check ${r}`]},o=s(e.snapshots,n.manifestPath),c=o.contents===null?void 0:d(o.contents);o.contents===null?G(a,e,{path:n.manifestPath,contents:`# Custom Functions managed as code.
120
+ `,`editor extension recommendations`).recommendations,[`denoland.vscode-deno`])}],`editor extension recommendations`)}const R={name:D,displayName:`Custom Function`,owner:`@transcend-io/cli`,files:O};function z(e){let t=JSON.stringify(e)??``;return[...new Set(Array.from(t.matchAll(/<<parameters\.([^>]+)>>/gu),e=>e[1]))]}function B(e){return e.projectRoot}function V(e,t){let n=B(e),r=new Set([e.manifestPath]),i=new Set(t.features);return i.has(p.Deno)&&r.add(e.denoConfigPath),i.has(p.Editor)&&(r.add(y(n,`.vscode`,`settings.json`)),r.add(y(n,`.vscode`,`extensions.json`))),i.has(p.Skill)&&o(n,e.existingSkillDirectories,R).forEach(e=>r.add(e)),i.has(p.Ci)&&r.add(y(n,`.github`,`workflows`,`transcend-custom-functions.yml`)),[...r].sort((e,t)=>e.localeCompare(t))}function H(e,t){return[e.manifestPath,y(e.manifestDirectory,t.sourceFile.path),...t.payloadFiles.map(t=>y(e.manifestDirectory,t.path))].sort((e,t)=>e.localeCompare(t))}function U(e,t){let n=b(e,t);if(n===`..`||n.startsWith(`..${S}`)||v(n))throw Error(`Refusing to modify path outside project root: ${t}`)}function W(e,t){let n=B(e);U(e.targetDirectory,e.manifestPath),t.forEach(e=>U(n,e));let r=new Map(e.relativePaths.map(e=>[e.toLocaleLowerCase(`en-US`),e]));t.forEach(t=>{let n=b(e.manifestDirectory,t).split(S).join(`/`);if(n.startsWith(`../`))return;let i=n.split(`/`);for(let e=1;e<=i.length;e+=1){let t=i.slice(0,e).join(`/`),n=r.get(t.toLocaleLowerCase(`en-US`));if(n&&n!==t)throw Error(`Case-insensitive path collision: "${t}" conflicts with "${n}".`)}})}function G(e,t,n){let r=s({snapshot:l(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 K(e,t){let{state:n}=e,i=r(n.targetDirectory,n.manifestPath,n.invocationDirectory),a={version:1,command:`init`,rootDirectory:B(n),targetDirectory:n.targetDirectory,manifestPath:n.manifestPath,changes:[],unchanged:[],warnings:[],nextSteps:[`transcend custom-functions new ${i}`,`transcend custom-functions check ${i}`]},o=l(e.snapshots,n.manifestPath),s=o.contents===null?void 0:u(o.contents);o.contents===null?G(a,e,{path:n.manifestPath,contents:`# Custom Functions managed as code.
121
121
  functions: []
122
- `,description:`Create the Custom Function manifest`}):a.unchanged.push(n.manifestPath);let u=new Set(t.features);if(u.has(p.Deno)){let t=s(e.snapshots,n.denoConfigPath),r=(c?.functions??[]).map(({code:e})=>e).filter(e=>!e.includes(`<<parameters.`)),i=(c?.functions??[]).flatMap(e=>[...e[`test-payload`]?[e[`test-payload`]]:[],...(e[`test-payloads`]??[]).map(({payload:e})=>e)]).filter(e=>!e.includes(`<<parameters.`));G(a,e,{path:n.denoConfigPath,contents:F(t.contents,e.contractVersion,_(n.manifestPath),{sources:r,payloads:i}),description:`Merge strict target-scoped Deno authoring configuration`})}let f=B(n);if(u.has(p.Editor)){let t=y(f,`.vscode`,`settings.json`),r=y(f,`.vscode`,`extensions.json`),i=s(e.snapshots,t),o=s(e.snapshots,r);G(a,e,{path:t,contents:I(i.contents,f,n.targetDirectory),description:`Scope Deno language support to Custom Functions`}),G(a,e,{path:r,contents:L(o.contents),description:`Recommend the Deno editor extension`})}if(u.has(p.Skill)){let t=i({rootDirectory:f,existingDirectories:n.existingSkillDirectories,snapshots:e.snapshots,skill:R});a.changes.push(...t.changes),a.unchanged.push(...t.unchanged),a.warnings.push(...t.warnings)}if(u.has(p.Ci))if(!n.repositoryRoot||!n.usesGithub)a.warnings.push(`GitHub Actions setup was selected, but this target is not inside a detected GitHub repository.`);else{let t=y(n.repositoryRoot,`.github`,`workflows`,`transcend-custom-functions.yml`),r=b(n.repositoryRoot,n.targetDirectory).split(S).join(`/`)||`.`,i=b(n.repositoryRoot,n.manifestDirectory).split(S).join(`/`)||`.`,o=b(n.repositoryRoot,n.manifestPath).split(S).join(`/`),l=(c?.functions??[]).flatMap(e=>[e.code,...e[`test-payload`]?[e[`test-payload`]]:[],...(e[`test-payloads`]??[]).map(({payload:e})=>e)]).filter(e=>!e.includes(`<<parameters.`)).map(e=>b(n.repositoryRoot,x(n.manifestDirectory,e)).split(S).join(`/`)),u=P({cliVersion:e.cliVersion,targetDirectory:r,contentDirectory:i,manifestPath:o,watchedPaths:l}),d=s(e.snapshots,t);d.contents===null?G(a,e,{path:t,contents:u,description:`Add credential-free Custom Function checks`,createOnly:!0}):d.contents===u?a.unchanged.push(t):N(d.contents)?G(a,e,{path:t,contents:u,description:`Update managed Custom Function checks`}):(a.unchanged.push(t),a.warnings.push(`Existing GitHub Actions workflow was left unchanged: ${t}`))}return W(n,a.changes.map(({path:e})=>e)),a}function q(e,t){let{state:n}=e,r=s(e.snapshots,n.manifestPath).contents;if(r===null)throw Error(`Custom Function manifest does not exist: ${n.manifestPath}`);let i=t.generated.sourceFile.path.split(S).join(`/`),c=n.relativePaths.find(e=>e.toLocaleLowerCase(`en-US`)===i.toLocaleLowerCase(`en-US`));if(c)throw Error(`Custom Function name "${t.generated.displayName}" maps to ${i}, which conflicts with existing path ${c}. Choose another name.`);let p=d(r).functions.find(e=>x(n.manifestDirectory,e.code)===x(n.manifestDirectory,i));if(p)throw Error(`Custom Function name "${t.generated.displayName}" maps to source used by "${p.name}". Choose another name.`);let m={version:1,command:`new`,rootDirectory:n.manifestDirectory,targetDirectory:n.targetDirectory,manifestPath:n.manifestPath,changes:[],unchanged:[],warnings:[],nextSteps:[]},h=f(r,t.generated.manifestEntry);G(m,e,{path:n.manifestPath,contents:h,description:`Register ${t.generated.displayName} in the manifest`}),[t.generated.sourceFile,...t.generated.payloadFiles].forEach(r=>{G(m,e,{path:y(n.manifestDirectory,r.path),contents:r.contents,description:r===t.generated.sourceFile?`Create ${t.generated.displayName} source`:`Create ${t.generated.displayName} test payload`,createOnly:!0})});let g=y(n.manifestDirectory,t.generated.sourceFile.path),_=l(n.targetDirectory,n.manifestPath,n.invocationDirectory),v=z(t.generated.manifestEntry),b=u(v);return m.nextSteps=[`Edit ${a(o(n.invocationDirectory,g))}`,`transcend custom-functions run ${_} --function=${a(t.generated.displayName)}${b}`,`transcend custom-functions check ${_}${b}`,`transcend custom-functions push --file=${a(o(n.invocationDirectory,n.manifestPath))} --dryRun${b}`],v.length>0&&m.warnings.push(`Supply ${v.join(`, `)} through --variables when running or pushing; never commit secret values.`),W(n,m.changes.map(({path:e})=>e)),m}function J(t,n){return e(t,n)}export{z as a,k as c,V as i,A as l,K as n,J as o,H as r,j as s,q as t,D as u};
123
- //# sourceMappingURL=scaffold-planning-CNv83t_v.mjs.map
122
+ `,description:`Create the Custom Function manifest`}):a.unchanged.push(n.manifestPath);let d=new Set(t.features);if(d.has(p.Deno)){let t=l(e.snapshots,n.denoConfigPath),r=(s?.functions??[]).map(({code:e})=>e).filter(e=>!e.includes(`<<parameters.`)),i=(s?.functions??[]).flatMap(e=>[...e[`test-payload`]?[e[`test-payload`]]:[],...(e[`test-payloads`]??[]).map(({payload:e})=>e)]).filter(e=>!e.includes(`<<parameters.`));G(a,e,{path:n.denoConfigPath,contents:F(t.contents,e.contractVersion,_(n.manifestPath),{sources:r,payloads:i}),description:`Merge strict target-scoped Deno authoring configuration`})}let f=B(n);if(d.has(p.Editor)){let t=y(f,`.vscode`,`settings.json`),r=y(f,`.vscode`,`extensions.json`),i=l(e.snapshots,t),o=l(e.snapshots,r);G(a,e,{path:t,contents:I(i.contents,f,n.targetDirectory),description:`Scope Deno language support to Custom Functions`}),G(a,e,{path:r,contents:L(o.contents),description:`Recommend the Deno editor extension`})}if(d.has(p.Skill)){let t=c({rootDirectory:f,existingDirectories:n.existingSkillDirectories,snapshots:e.snapshots,skill:R});a.changes.push(...t.changes),a.unchanged.push(...t.unchanged),a.warnings.push(...t.warnings)}if(d.has(p.Ci))if(!n.repositoryRoot||!n.usesGithub)a.warnings.push(`GitHub Actions setup was selected, but this target is not inside a detected GitHub repository.`);else{let t=y(n.repositoryRoot,`.github`,`workflows`,`transcend-custom-functions.yml`),r=b(n.repositoryRoot,n.targetDirectory).split(S).join(`/`)||`.`,i=b(n.repositoryRoot,n.manifestDirectory).split(S).join(`/`)||`.`,o=b(n.repositoryRoot,n.manifestPath).split(S).join(`/`),c=(s?.functions??[]).flatMap(e=>[e.code,...e[`test-payload`]?[e[`test-payload`]]:[],...(e[`test-payloads`]??[]).map(({payload:e})=>e)]).filter(e=>!e.includes(`<<parameters.`)).map(e=>b(n.repositoryRoot,x(n.manifestDirectory,e)).split(S).join(`/`)),u=P({cliVersion:e.cliVersion,targetDirectory:r,contentDirectory:i,manifestPath:o,watchedPaths:c}),d=l(e.snapshots,t);d.contents===null?G(a,e,{path:t,contents:u,description:`Add credential-free Custom Function checks`,createOnly:!0}):d.contents===u?a.unchanged.push(t):N(d.contents)?G(a,e,{path:t,contents:u,description:`Update managed Custom Function checks`}):(a.unchanged.push(t),a.warnings.push(`Existing GitHub Actions workflow was left unchanged: ${t}`))}return W(n,a.changes.map(({path:e})=>e)),a}function q(e,a){let{state:o}=e,s=l(e.snapshots,o.manifestPath).contents;if(s===null)throw Error(`Custom Function manifest does not exist: ${o.manifestPath}`);let c=a.generated.sourceFile.path.split(S).join(`/`),f=o.relativePaths.find(e=>e.toLocaleLowerCase(`en-US`)===c.toLocaleLowerCase(`en-US`));if(f)throw Error(`Custom Function name "${a.generated.displayName}" maps to ${c}, which conflicts with existing path ${f}. Choose another name.`);let p=u(s).functions.find(e=>x(o.manifestDirectory,e.code)===x(o.manifestDirectory,c));if(p)throw Error(`Custom Function name "${a.generated.displayName}" maps to source used by "${p.name}". Choose another name.`);let m={version:1,command:`new`,rootDirectory:o.manifestDirectory,targetDirectory:o.targetDirectory,manifestPath:o.manifestPath,changes:[],unchanged:[],warnings:[],nextSteps:[]},h=d(s,a.generated.manifestEntry);G(m,e,{path:o.manifestPath,contents:h,description:`Register ${a.generated.displayName} in the manifest`}),[a.generated.sourceFile,...a.generated.payloadFiles].forEach(t=>{G(m,e,{path:y(o.manifestDirectory,t.path),contents:t.contents,description:t===a.generated.sourceFile?`Create ${a.generated.displayName} source`:`Create ${a.generated.displayName} test payload`,createOnly:!0})});let g=y(o.manifestDirectory,a.generated.sourceFile.path),_=r(o.targetDirectory,o.manifestPath,o.invocationDirectory),v=z(a.generated.manifestEntry),b=i(v);return m.nextSteps=[`Edit ${t(n(o.invocationDirectory,g))}`,`transcend custom-functions run ${_} --function=${t(a.generated.displayName)}${b}`,`transcend custom-functions check ${_}${b}`,`transcend custom-functions push ${_} --dryRun${b}`],v.length>0&&m.warnings.push(`Supply ${v.join(`, `)} through --variables when running or pushing; never commit secret values.`),W(o,m.changes.map(({path:e})=>e)),m}function J(e,t){return a(e,t)}export{z as a,k as c,V as i,A as l,K as n,J as o,H as r,j as s,q as t,D as u};
123
+ //# sourceMappingURL=scaffold-planning-CaetLfv8.mjs.map