@transcend-io/cli 12.1.5 → 13.0.1

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 (215) hide show
  1. package/README.md +64 -14
  2. package/dist/{app-BMLQABJX.mjs → app-Bms-wwFP.mjs} +19 -19
  3. package/dist/app-Bms-wwFP.mjs.map +1 -0
  4. package/dist/{approvePrivacyRequests-CY6rQT4J.mjs → approvePrivacyRequests-DyLb38gV.mjs} +2 -2
  5. package/dist/{approvePrivacyRequests-CY6rQT4J.mjs.map → approvePrivacyRequests-DyLb38gV.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-BNGtj-DW.mjs → buildExamples-Ck7gzWSG.mjs} +2 -2
  10. package/dist/{buildExamples-BNGtj-DW.mjs.map → buildExamples-Ck7gzWSG.mjs.map} +1 -1
  11. package/dist/{buildXdiSyncEndpoint-BNCfOc-g.mjs → buildXdiSyncEndpoint-etqb_c38.mjs} +2 -2
  12. package/dist/{buildXdiSyncEndpoint-BNCfOc-g.mjs.map → buildXdiSyncEndpoint-etqb_c38.mjs.map} +1 -1
  13. package/dist/{bulkRestartRequests-CGvODu3r.mjs → bulkRestartRequests-DWJ8N0fa.mjs} +2 -2
  14. package/dist/{bulkRestartRequests-CGvODu3r.mjs.map → bulkRestartRequests-DWJ8N0fa.mjs.map} +1 -1
  15. package/dist/{bulkRetryEnrichers-BgDd4GWH.mjs → bulkRetryEnrichers-J8CHMy_1.mjs} +2 -2
  16. package/dist/{bulkRetryEnrichers-BgDd4GWH.mjs.map → bulkRetryEnrichers-J8CHMy_1.mjs.map} +1 -1
  17. package/dist/{cancelPrivacyRequests-Ccsiwrnu.mjs → cancelPrivacyRequests-C9nFdfgW.mjs} +2 -2
  18. package/dist/{cancelPrivacyRequests-Ccsiwrnu.mjs.map → cancelPrivacyRequests-C9nFdfgW.mjs.map} +1 -1
  19. package/dist/codecs-8T8Jhxsr.mjs +2 -0
  20. package/dist/codecs-8T8Jhxsr.mjs.map +1 -0
  21. package/dist/{command-BjzdoKgJ.mjs → command-C-wEPTO5.mjs} +2 -2
  22. package/dist/{command-BjzdoKgJ.mjs.map → command-C-wEPTO5.mjs.map} +1 -1
  23. package/dist/constants-D6y_AX3P.mjs +2 -0
  24. package/dist/constants-D6y_AX3P.mjs.map +1 -0
  25. package/dist/{constants-FDjw7bPS.mjs → constants-I694qbRg.mjs} +2 -2
  26. package/dist/{constants-FDjw7bPS.mjs.map → constants-I694qbRg.mjs.map} +1 -1
  27. package/dist/{createPoolingCommandUi-BdtnLBBM.mjs → createPoolingCommandUi-BZr2HSiZ.mjs} +2 -2
  28. package/dist/{createPoolingCommandUi-BdtnLBBM.mjs.map → createPoolingCommandUi-BZr2HSiZ.mjs.map} +1 -1
  29. package/dist/{downloadPrivacyRequestFiles-C9-xSCpt.mjs → downloadPrivacyRequestFiles-CF_QjkR9.mjs} +2 -2
  30. package/dist/{downloadPrivacyRequestFiles-C9-xSCpt.mjs.map → downloadPrivacyRequestFiles-CF_QjkR9.mjs.map} +1 -1
  31. package/dist/fetchAllRequests-BV9K0wXv.mjs +2 -0
  32. package/dist/fetchAllRequests-BV9K0wXv.mjs.map +1 -0
  33. package/dist/{fuzzyMatchColumns-D18n9Beu.mjs → fuzzyMatchColumns-Djl3a7lV.mjs} +2 -2
  34. package/dist/{fuzzyMatchColumns-D18n9Beu.mjs.map → fuzzyMatchColumns-Djl3a7lV.mjs.map} +1 -1
  35. package/dist/{generateCrossAccountApiKeys-FtWwlf_L.mjs → generateCrossAccountApiKeys-BxW6xU40.mjs} +2 -2
  36. package/dist/{generateCrossAccountApiKeys-FtWwlf_L.mjs.map → generateCrossAccountApiKeys-BxW6xU40.mjs.map} +1 -1
  37. package/dist/{impl-SOebshza.mjs → impl-3VziEzJI.mjs} +2 -2
  38. package/dist/{impl-SOebshza.mjs.map → impl-3VziEzJI.mjs.map} +1 -1
  39. package/dist/{impl-DnDM9zcu.mjs → impl-7NFxUzSa.mjs} +2 -2
  40. package/dist/{impl-DnDM9zcu.mjs.map → impl-7NFxUzSa.mjs.map} +1 -1
  41. package/dist/{impl-Dg7XSQdO2.mjs → impl-7qTKg-YP2.mjs} +2 -2
  42. package/dist/{impl-Dg7XSQdO2.mjs.map → impl-7qTKg-YP2.mjs.map} +1 -1
  43. package/dist/{impl-zZd6fuXS.mjs → impl-AWYAfZ2C.mjs} +2 -2
  44. package/dist/{impl-zZd6fuXS.mjs.map → impl-AWYAfZ2C.mjs.map} +1 -1
  45. package/dist/{impl-B94dMG4x2.mjs → impl-B-BkGfqq2.mjs} +2 -2
  46. package/dist/{impl-B94dMG4x2.mjs.map → impl-B-BkGfqq2.mjs.map} +1 -1
  47. package/dist/{impl-Dd39KsYO.mjs → impl-B0NqrNcJ2.mjs} +2 -2
  48. package/dist/impl-B0NqrNcJ2.mjs.map +1 -0
  49. package/dist/{impl-C3vTm9zQ.mjs → impl-B5fkF8m2.mjs} +2 -2
  50. package/dist/{impl-C3vTm9zQ.mjs.map → impl-B5fkF8m2.mjs.map} +1 -1
  51. package/dist/{impl-xVmMN-Vt.mjs → impl-B9vbcV8J.mjs} +2 -2
  52. package/dist/{impl-xVmMN-Vt.mjs.map → impl-B9vbcV8J.mjs.map} +1 -1
  53. package/dist/{impl-CSnBFv5P.mjs → impl-BCTVuvlD.mjs} +2 -2
  54. package/dist/{impl-CSnBFv5P.mjs.map → impl-BCTVuvlD.mjs.map} +1 -1
  55. package/dist/impl-BfS6LtNo2.mjs +2 -0
  56. package/dist/impl-BfS6LtNo2.mjs.map +1 -0
  57. package/dist/{impl-qNF5eqX-.mjs → impl-BfU0GFmW.mjs} +1 -1
  58. package/dist/{impl-qNF5eqX-.mjs.map → impl-BfU0GFmW.mjs.map} +1 -1
  59. package/dist/{impl-BXGpJz21.mjs → impl-Bhmoagby.mjs} +2 -2
  60. package/dist/{impl-BXGpJz21.mjs.map → impl-Bhmoagby.mjs.map} +1 -1
  61. package/dist/{impl-COqlYiiw.mjs → impl-Bpiggf8H.mjs} +2 -2
  62. package/dist/{impl-COqlYiiw.mjs.map → impl-Bpiggf8H.mjs.map} +1 -1
  63. package/dist/{impl-D6frX-PK.mjs → impl-BsxD7toO.mjs} +2 -2
  64. package/dist/{impl-D6frX-PK.mjs.map → impl-BsxD7toO.mjs.map} +1 -1
  65. package/dist/{impl-Bs2pNgMK.mjs → impl-BvL9wElZ.mjs} +2 -2
  66. package/dist/{impl-Bs2pNgMK.mjs.map → impl-BvL9wElZ.mjs.map} +1 -1
  67. package/dist/{impl-DUYRVzMo.mjs → impl-BzzkiK_b.mjs} +1 -1
  68. package/dist/{impl-DUYRVzMo.mjs.map → impl-BzzkiK_b.mjs.map} +1 -1
  69. package/dist/{impl-DZoTWLfw2.mjs → impl-C-hBO0Wa2.mjs} +2 -2
  70. package/dist/{impl-DZoTWLfw2.mjs.map → impl-C-hBO0Wa2.mjs.map} +1 -1
  71. package/dist/{impl-bl6NF3Lr.mjs → impl-C6tbQV8G.mjs} +2 -2
  72. package/dist/{impl-bl6NF3Lr.mjs.map → impl-C6tbQV8G.mjs.map} +1 -1
  73. package/dist/{impl-BEiCEzl_2.mjs → impl-CHoglMch.mjs} +1 -1
  74. package/dist/impl-CHoglMch.mjs.map +1 -0
  75. package/dist/{impl-ClT3G845.mjs → impl-CQ3NctWn.mjs} +2 -2
  76. package/dist/{impl-ClT3G845.mjs.map → impl-CQ3NctWn.mjs.map} +1 -1
  77. package/dist/{impl-DhXzxQDN2.mjs → impl-CRif3TpB2.mjs} +2 -2
  78. package/dist/{impl-DhXzxQDN2.mjs.map → impl-CRif3TpB2.mjs.map} +1 -1
  79. package/dist/{impl-Cvyc-iTI2.mjs → impl-CWINXCFq2.mjs} +2 -2
  80. package/dist/{impl-Cvyc-iTI2.mjs.map → impl-CWINXCFq2.mjs.map} +1 -1
  81. package/dist/{impl-BLtOfbtk.mjs → impl-CaErz960.mjs} +2 -2
  82. package/dist/{impl-BLtOfbtk.mjs.map → impl-CaErz960.mjs.map} +1 -1
  83. package/dist/{impl-D6rMLiNB2.mjs → impl-CjOkPJJx.mjs} +2 -2
  84. package/dist/impl-CjOkPJJx.mjs.map +1 -0
  85. package/dist/{impl-yIVxAhCG2.mjs → impl-CpJIikeg2.mjs} +2 -2
  86. package/dist/{impl-yIVxAhCG2.mjs.map → impl-CpJIikeg2.mjs.map} +1 -1
  87. package/dist/{impl-XxYQHKO5.mjs → impl-CujcaHKR.mjs} +2 -2
  88. package/dist/{impl-XxYQHKO5.mjs.map → impl-CujcaHKR.mjs.map} +1 -1
  89. package/dist/{impl-BLOhoP-b2.mjs → impl-CzFfjx8n2.mjs} +2 -2
  90. package/dist/{impl-BLOhoP-b2.mjs.map → impl-CzFfjx8n2.mjs.map} +1 -1
  91. package/dist/{impl-QD3_9HTk.mjs → impl-CzgNvB64.mjs} +2 -2
  92. package/dist/{impl-QD3_9HTk.mjs.map → impl-CzgNvB64.mjs.map} +1 -1
  93. package/dist/{impl-B_N_fOq0.mjs → impl-D5BItJzQ.mjs} +2 -2
  94. package/dist/{impl-B_N_fOq0.mjs.map → impl-D5BItJzQ.mjs.map} +1 -1
  95. package/dist/{impl-DeCRXfAh2.mjs → impl-DEF-meSg2.mjs} +2 -2
  96. package/dist/{impl-DeCRXfAh2.mjs.map → impl-DEF-meSg2.mjs.map} +1 -1
  97. package/dist/{impl-CTOgxZFi.mjs → impl-DIz7yqDc.mjs} +2 -2
  98. package/dist/{impl-CTOgxZFi.mjs.map → impl-DIz7yqDc.mjs.map} +1 -1
  99. package/dist/{impl-DDVhG8Gf.mjs → impl-DLnVDCjy.mjs} +2 -2
  100. package/dist/{impl-DDVhG8Gf.mjs.map → impl-DLnVDCjy.mjs.map} +1 -1
  101. package/dist/{impl-DGtCNANL.mjs → impl-DMoMMAMW.mjs} +2 -2
  102. package/dist/{impl-DGtCNANL.mjs.map → impl-DMoMMAMW.mjs.map} +1 -1
  103. package/dist/{impl-ChQAmyBN.mjs → impl-DMwjar-u.mjs} +2 -2
  104. package/dist/{impl-ChQAmyBN.mjs.map → impl-DMwjar-u.mjs.map} +1 -1
  105. package/dist/{impl-Bz1wZxa-.mjs → impl-DUWlKcy6.mjs} +2 -2
  106. package/dist/{impl-Bz1wZxa-.mjs.map → impl-DUWlKcy6.mjs.map} +1 -1
  107. package/dist/{impl-D58JUOdA.mjs → impl-DY_TNWaO.mjs} +2 -2
  108. package/dist/{impl-D58JUOdA.mjs.map → impl-DY_TNWaO.mjs.map} +1 -1
  109. package/dist/{impl-Cp5o0Q2g.mjs → impl-D_8KoR4w.mjs} +2 -2
  110. package/dist/{impl-Cp5o0Q2g.mjs.map → impl-D_8KoR4w.mjs.map} +1 -1
  111. package/dist/{impl-VSo8bO-J.mjs → impl-DdL7paBD.mjs} +2 -2
  112. package/dist/{impl-VSo8bO-J.mjs.map → impl-DdL7paBD.mjs.map} +1 -1
  113. package/dist/{impl-0-_oxvck.mjs → impl-DioQW8jR.mjs} +2 -2
  114. package/dist/{impl-0-_oxvck.mjs.map → impl-DioQW8jR.mjs.map} +1 -1
  115. package/dist/{impl-EDwngLc7.mjs → impl-Dj4IYEXg.mjs} +2 -2
  116. package/dist/{impl-EDwngLc7.mjs.map → impl-Dj4IYEXg.mjs.map} +1 -1
  117. package/dist/{impl-BvwRiPSG.mjs → impl-DpW_rDzv.mjs} +2 -2
  118. package/dist/{impl-BvwRiPSG.mjs.map → impl-DpW_rDzv.mjs.map} +1 -1
  119. package/dist/{impl-Cb-7C1Ml2.mjs → impl-Dr1qLfh1.mjs} +12 -105
  120. package/dist/impl-Dr1qLfh1.mjs.map +1 -0
  121. package/dist/{impl-agm4lpyq.mjs → impl-HsRwcfRu.mjs} +2 -2
  122. package/dist/{impl-agm4lpyq.mjs.map → impl-HsRwcfRu.mjs.map} +1 -1
  123. package/dist/{impl-BHEAKFX02.mjs → impl-LT1FBKID2.mjs} +2 -2
  124. package/dist/{impl-BHEAKFX02.mjs.map → impl-LT1FBKID2.mjs.map} +1 -1
  125. package/dist/impl-Q2ZDQO_y2.mjs +2 -0
  126. package/dist/impl-Q2ZDQO_y2.mjs.map +1 -0
  127. package/dist/{impl-DFnWzZyY.mjs → impl-UtanPzK1.mjs} +2 -2
  128. package/dist/{impl-DFnWzZyY.mjs.map → impl-UtanPzK1.mjs.map} +1 -1
  129. package/dist/{impl-Ar7VAh0Z.mjs → impl-ZFp_SwYr.mjs} +2 -2
  130. package/dist/{impl-Ar7VAh0Z.mjs.map → impl-ZFp_SwYr.mjs.map} +1 -1
  131. package/dist/{impl-Hj5CgbWd.mjs → impl-eWsR0UvV.mjs} +2 -2
  132. package/dist/{impl-Hj5CgbWd.mjs.map → impl-eWsR0UvV.mjs.map} +1 -1
  133. package/dist/{impl-Ay6JeH-7.mjs → impl-kuuX5KaC.mjs} +2 -2
  134. package/dist/{impl-Ay6JeH-7.mjs.map → impl-kuuX5KaC.mjs.map} +1 -1
  135. package/dist/{impl-xY_5o78i.mjs → impl-mBJWy3lg.mjs} +2 -2
  136. package/dist/{impl-xY_5o78i.mjs.map → impl-mBJWy3lg.mjs.map} +1 -1
  137. package/dist/{impl-ojAnhhbi.mjs → impl-nWslO7Lu.mjs} +2 -2
  138. package/dist/{impl-ojAnhhbi.mjs.map → impl-nWslO7Lu.mjs.map} +1 -1
  139. package/dist/{impl-ApZGIx6l.mjs → impl-o66EB2o7.mjs} +2 -2
  140. package/dist/{impl-ApZGIx6l.mjs.map → impl-o66EB2o7.mjs.map} +1 -1
  141. package/dist/{impl-BCKUj-ko.mjs → impl-pqCx3OlD.mjs} +2 -2
  142. package/dist/{impl-BCKUj-ko.mjs.map → impl-pqCx3OlD.mjs.map} +1 -1
  143. package/dist/{impl-BpVe6fMe.mjs → impl-yxR3rwGm.mjs} +2 -2
  144. package/dist/{impl-BpVe6fMe.mjs.map → impl-yxR3rwGm.mjs.map} +1 -1
  145. package/dist/index.d.mts +36 -26
  146. package/dist/index.d.mts.map +1 -1
  147. package/dist/index.mjs +1 -1
  148. package/dist/{inquirer-jzIQWAvq.mjs → inquirer-DK1JbPA0.mjs} +2 -2
  149. package/dist/{inquirer-jzIQWAvq.mjs.map → inquirer-DK1JbPA0.mjs.map} +1 -1
  150. package/dist/{markRequestDataSiloIdsCompleted-JGJf33yp.mjs → markRequestDataSiloIdsCompleted-CRLlmf-g.mjs} +2 -2
  151. package/dist/{markRequestDataSiloIdsCompleted-JGJf33yp.mjs.map → markRequestDataSiloIdsCompleted-CRLlmf-g.mjs.map} +1 -1
  152. package/dist/{markSilentPrivacyRequests-BTI3rH-V.mjs → markSilentPrivacyRequests-CZIAGpw2.mjs} +2 -2
  153. package/dist/{markSilentPrivacyRequests-BTI3rH-V.mjs.map → markSilentPrivacyRequests-CZIAGpw2.mjs.map} +1 -1
  154. package/dist/{mergeTranscendInputs-B7WjxYMN.mjs → mergeTranscendInputs-9kQ3t5VY.mjs} +2 -2
  155. package/dist/{mergeTranscendInputs-B7WjxYMN.mjs.map → mergeTranscendInputs-9kQ3t5VY.mjs.map} +1 -1
  156. package/dist/{notifyPrivacyRequestsAdditionalTime-n5fvOJaA.mjs → notifyPrivacyRequestsAdditionalTime-KiF9dkuk.mjs} +2 -2
  157. package/dist/{notifyPrivacyRequestsAdditionalTime-n5fvOJaA.mjs.map → notifyPrivacyRequestsAdditionalTime-KiF9dkuk.mjs.map} +1 -1
  158. package/dist/{policy-bundle-manifest-DbbTXe0u.mjs → policy-bundle-manifest-DW1kUjMf.mjs} +2 -2
  159. package/dist/{policy-bundle-manifest-DbbTXe0u.mjs.map → policy-bundle-manifest-DW1kUjMf.mjs.map} +1 -1
  160. package/dist/{policy-project-discovery-DTSl0Gfl.mjs → policy-project-discovery-BSQ2Cow0.mjs} +4 -4
  161. package/dist/policy-project-discovery-BSQ2Cow0.mjs.map +1 -0
  162. package/dist/{policy-scaffold-config-RpxwwZ2H.mjs → policy-scaffold-config-B_Xbfv7q.mjs} +8 -8
  163. package/dist/policy-scaffold-config-B_Xbfv7q.mjs.map +1 -0
  164. package/dist/{project-discovery-BkHpTXDx.mjs → project-discovery-g29vd44a.mjs} +2 -2
  165. package/dist/{project-discovery-BkHpTXDx.mjs.map → project-discovery-g29vd44a.mjs.map} +1 -1
  166. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-DbybCU2T.mjs → pullChunkedCustomSiloOutstandingIdentifiers-ekuEZlzq.mjs} +2 -2
  167. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-DbybCU2T.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-ekuEZlzq.mjs.map} +1 -1
  168. package/dist/{pullManualEnrichmentIdentifiersToCsv-CxTPUfpV.mjs → pullManualEnrichmentIdentifiersToCsv-D710M8kt.mjs} +2 -2
  169. package/dist/{pullManualEnrichmentIdentifiersToCsv-CxTPUfpV.mjs.map → pullManualEnrichmentIdentifiersToCsv-D710M8kt.mjs.map} +1 -1
  170. package/dist/{pushCronIdentifiersFromCsv-CeRVlbFE.mjs → pushCronIdentifiersFromCsv-f8FSSFhM.mjs} +2 -2
  171. package/dist/{pushCronIdentifiersFromCsv-CeRVlbFE.mjs.map → pushCronIdentifiersFromCsv-f8FSSFhM.mjs.map} +1 -1
  172. package/dist/{pushManualEnrichmentIdentifiersFromCsv--4dYCvyv.mjs → pushManualEnrichmentIdentifiersFromCsv-6xOUhOpJ.mjs} +2 -2
  173. package/dist/{pushManualEnrichmentIdentifiersFromCsv--4dYCvyv.mjs.map → pushManualEnrichmentIdentifiersFromCsv-6xOUhOpJ.mjs.map} +1 -1
  174. package/dist/{readTranscendYaml-BfqQbPiT.mjs → readTranscendYaml-D576bvzR.mjs} +2 -2
  175. package/dist/{readTranscendYaml-BfqQbPiT.mjs.map → readTranscendYaml-D576bvzR.mjs.map} +1 -1
  176. package/dist/{removeUnverifiedRequestIdentifiers-CV6JGgt_.mjs → removeUnverifiedRequestIdentifiers-B8iIreP4.mjs} +2 -2
  177. package/dist/{removeUnverifiedRequestIdentifiers-CV6JGgt_.mjs.map → removeUnverifiedRequestIdentifiers-B8iIreP4.mjs.map} +1 -1
  178. package/dist/{retryRequestDataSilos-_OThvVwU.mjs → retryRequestDataSilos-BQuxZd4C.mjs} +2 -2
  179. package/dist/{retryRequestDataSilos-_OThvVwU.mjs.map → retryRequestDataSilos-BQuxZd4C.mjs.map} +1 -1
  180. package/dist/runRegalLintStep-DPaMm7Gg.mjs +3 -0
  181. package/dist/runRegalLintStep-DPaMm7Gg.mjs.map +1 -0
  182. package/dist/{scaffold-planning-BrX-pcz6.mjs → scaffold-planning-Bp_yqZWx.mjs} +2 -2
  183. package/dist/{scaffold-planning-BrX-pcz6.mjs.map → scaffold-planning-Bp_yqZWx.mjs.map} +1 -1
  184. package/dist/{skipPreflightJobs-D8og5pKe.mjs → skipPreflightJobs-BkTH4QOf.mjs} +2 -2
  185. package/dist/{skipPreflightJobs-D8og5pKe.mjs.map → skipPreflightJobs-BkTH4QOf.mjs.map} +1 -1
  186. package/dist/{skipRequestDataSilos-DUQ6AD_O.mjs → skipRequestDataSilos-sdfJ0gPn.mjs} +2 -2
  187. package/dist/{skipRequestDataSilos-DUQ6AD_O.mjs.map → skipRequestDataSilos-sdfJ0gPn.mjs.map} +1 -1
  188. package/dist/{streamPrivacyRequestsToCsv-BApu4dvI.mjs → streamPrivacyRequestsToCsv-D0PK8mjN.mjs} +2 -2
  189. package/dist/{streamPrivacyRequestsToCsv-BApu4dvI.mjs.map → streamPrivacyRequestsToCsv-D0PK8mjN.mjs.map} +1 -1
  190. package/dist/{updateConsentManagerVersionToLatest-BrgPZ5hX.mjs → updateConsentManagerVersionToLatest-EJaexjTY.mjs} +2 -2
  191. package/dist/{updateConsentManagerVersionToLatest-BrgPZ5hX.mjs.map → updateConsentManagerVersionToLatest-EJaexjTY.mjs.map} +1 -1
  192. package/dist/{uploadConsents-DRlDHQak.mjs → uploadConsents-DjvQVsIl.mjs} +2 -2
  193. package/dist/{uploadConsents-DRlDHQak.mjs.map → uploadConsents-DjvQVsIl.mjs.map} +1 -1
  194. package/dist/uploadPrivacyRequestsFromCsv-FvSx9zis.mjs +2 -0
  195. package/dist/uploadPrivacyRequestsFromCsv-FvSx9zis.mjs.map +1 -0
  196. package/dist/{validateTranscendAuth-D-dDINof.mjs → validateTranscendAuth-BrVGfq6X.mjs} +2 -2
  197. package/dist/{validateTranscendAuth-D-dDINof.mjs.map → validateTranscendAuth-BrVGfq6X.mjs.map} +1 -1
  198. package/package.json +6 -6
  199. package/dist/app-BMLQABJX.mjs.map +0 -1
  200. package/dist/codecs-CfcaFoZR.mjs +0 -2
  201. package/dist/codecs-CfcaFoZR.mjs.map +0 -1
  202. package/dist/constants-DlH2vWm_.mjs +0 -2
  203. package/dist/constants-DlH2vWm_.mjs.map +0 -1
  204. package/dist/fetchAllRequests-BI0tFl_a.mjs +0 -2
  205. package/dist/fetchAllRequests-BI0tFl_a.mjs.map +0 -1
  206. package/dist/impl-BEiCEzl_2.mjs.map +0 -1
  207. package/dist/impl-Cb-7C1Ml2.mjs.map +0 -1
  208. package/dist/impl-D6rMLiNB2.mjs.map +0 -1
  209. package/dist/impl-DNOgBcsu.mjs +0 -3
  210. package/dist/impl-DNOgBcsu.mjs.map +0 -1
  211. package/dist/impl-Dd39KsYO.mjs.map +0 -1
  212. package/dist/policy-project-discovery-DTSl0Gfl.mjs.map +0 -1
  213. package/dist/policy-scaffold-config-RpxwwZ2H.mjs.map +0 -1
  214. package/dist/uploadPrivacyRequestsFromCsv-FAGllBdd.mjs +0 -2
  215. package/dist/uploadPrivacyRequestsFromCsv-FAGllBdd.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"impl-BHEAKFX02.mjs","names":[],"sources":["../src/commands/custom-functions/new/impl.ts"],"sourcesContent":["import { join } from 'node:path';\n\nimport { CustomFunctionType } from '@transcend-io/privacy-types';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { buildNewFunctionAiHandoff } from '../../../lib/custom-functions/ai-handoff.js';\nimport { CUSTOM_FUNCTION_SKILL_NAME } from '../../../lib/custom-functions/custom-function-skill.js';\nimport { formatMissingManifestMessage } from '../../../lib/custom-functions/missing-manifest.js';\nimport { buildCustomFunctionProjectArguments } from '../../../lib/custom-functions/paths.js';\nimport {\n discoverCustomFunctionManifests,\n discoverCustomFunctionProject,\n} from '../../../lib/custom-functions/project-discovery.js';\nimport { buildPlanResult } from '../../../lib/custom-functions/scaffold-output.js';\nimport {\n buildAddFunctionPlan,\n getAddFunctionPlanningCandidatePaths,\n parameterNamesInManifestValue,\n prepareGeneratedCustomFunction,\n} from '../../../lib/custom-functions/scaffold-planning.js';\nimport {\n CUSTOM_FUNCTION_TEMPLATE_NAMES,\n CUSTOM_FUNCTION_TEMPLATE_PROMPT_LABELS,\n CUSTOM_FUNCTION_TYPE_PROMPT_LABELS,\n TEMPLATES_FOR_CUSTOM_FUNCTION_TYPE,\n type CustomFunctionTemplateName,\n validateCustomFunctionDisplayName,\n} from '../../../lib/custom-functions/scaffold-templates.js';\nimport { collectPlanningSnapshots } from '../../../lib/scaffolding/project-discovery.js';\nimport { applyProjectPlan } from '../../../lib/scaffolding/project-plan-apply.js';\nimport {\n displayProjectPath,\n renderProjectPlan,\n} from '../../../lib/scaffolding/project-plan-output.js';\nimport {\n isInteractivePromptInvocation,\n PromptCancelledError,\n ScaffoldPrompts,\n} from '../../../lib/scaffolding/prompts.js';\n\n/** Flags for `custom-functions new`. */\nexport interface CustomFunctionNewFlags {\n /** Explicit existing manifest path. */\n manifest?: string;\n /** Custom Function display name. */\n name?: string;\n /** Starter handler shape. */\n template?: CustomFunctionTemplateName;\n /** Disable prompts. */\n noInteractive: boolean;\n /** Render but do not apply. */\n dryRun: boolean;\n /** Approve the final displayed plan. */\n yes: boolean;\n /** Emit one stable JSON result on stdout. */\n json: boolean;\n}\n\n/**\n * Ask for the product-level function type, then its available starter template.\n *\n * General currently has one template, so selecting it completes the choice immediately.\n *\n * @param prompts - Context-bound prompt adapter\n * @returns Selected starter template\n */\nexport async function selectInteractiveTemplate(\n prompts: Pick<ScaffoldPrompts, 'select'>,\n): Promise<CustomFunctionTemplateName> {\n const functionType = await prompts.select<CustomFunctionType>(\n 'Custom Function type:',\n [\n {\n name: CUSTOM_FUNCTION_TYPE_PROMPT_LABELS[CustomFunctionType.General],\n value: CustomFunctionType.General,\n },\n {\n name: CUSTOM_FUNCTION_TYPE_PROMPT_LABELS[CustomFunctionType.Dsr],\n value: CustomFunctionType.Dsr,\n },\n ],\n CustomFunctionType.General,\n );\n const templates = TEMPLATES_FOR_CUSTOM_FUNCTION_TYPE[functionType];\n if (templates.length < 2) {\n const [onlyTemplate] = templates;\n if (onlyTemplate === undefined) {\n throw new Error(`No Custom Function templates are defined for type ${functionType}.`);\n }\n return onlyTemplate;\n }\n return prompts.select<CustomFunctionTemplateName>(\n 'Template:',\n templates.map((value) => ({\n name: CUSTOM_FUNCTION_TEMPLATE_PROMPT_LABELS[value],\n value,\n })),\n templates[0],\n );\n}\n\n/**\n * Scaffold one deterministic local Custom Function.\n *\n * @param this - CLI context\n * @param flags - Template and interaction flags\n * @param directory - Optional target directory\n */\nexport async function _new(\n this: LocalContext,\n flags: CustomFunctionNewFlags,\n directory?: string,\n): Promise<void> {\n doneInputValidation(this.process);\n try {\n const state = discoverCustomFunctionProject(this, {\n ...(directory ? { directory } : {}),\n ...(flags.manifest ? { manifest: flags.manifest } : {}),\n });\n if (!this.fs.existsSync(state.manifestPath)) {\n const cwd = this.process.cwd();\n throw new Error(\n formatMissingManifestMessage({\n cwd,\n manifestPath: state.manifestPath,\n discoveredManifestPaths: discoverCustomFunctionManifests(this, cwd),\n command: 'new',\n }),\n );\n }\n const prompts = new ScaffoldPrompts(this);\n const interactive = isInteractivePromptInvocation(\n flags,\n this.process.stdin.isTTY,\n this.process.stderr.isTTY,\n );\n const name =\n flags.name ??\n (interactive\n ? await prompts.text('Custom Function display name:', undefined, (value) => {\n try {\n validateCustomFunctionDisplayName(value);\n return true;\n } catch (error) {\n return error instanceof Error ? error.message : String(error);\n }\n })\n : undefined);\n if (!name) {\n throw new Error('Missing Custom Function name. Pass --name in a non-interactive invocation.');\n }\n const template =\n flags.template ?? (interactive ? await selectInteractiveTemplate(prompts) : undefined);\n if (!template || !CUSTOM_FUNCTION_TEMPLATE_NAMES.includes(template)) {\n throw new Error(\n 'Missing Custom Function template. Pass --template=general, --template=dsr-datapoint, --template=dsr-enricher, or --template=dsr-both.',\n );\n }\n const generated = prepareGeneratedCustomFunction(name, template);\n const snapshots = collectPlanningSnapshots(\n this,\n state.manifestDirectory,\n getAddFunctionPlanningCandidatePaths(state, generated),\n );\n const plan = buildAddFunctionPlan(\n {\n state,\n snapshots,\n },\n { generated },\n );\n if (!this.fs.existsSync(state.denoConfigPath)) {\n plan.warnings.push(\n `No Deno configuration was found. Run ` +\n `transcend custom-functions init ${buildCustomFunctionProjectArguments(\n state.targetDirectory,\n state.manifestPath,\n this.process.cwd(),\n )} --deno --noInteractive.`,\n );\n }\n if (!flags.json) {\n this.logger.info(\n renderProjectPlan(plan, {\n cwd: this.process.cwd(),\n title: 'Custom Function plan',\n details: [\n { label: 'Target', path: plan.targetDirectory },\n { label: 'Manifest', path: plan.manifestPath },\n ],\n }),\n );\n }\n\n let approved = plan.changes.length === 0 || flags.dryRun;\n if (plan.changes.length > 0 && !flags.dryRun) {\n if (flags.yes) {\n approved = true;\n } else if (interactive) {\n approved = await prompts.confirm('Apply this complete plan?', true);\n } else {\n throw new Error(\n 'The plan requires approval in a non-interactive invocation. Review with --dryRun, then pass --yes.',\n );\n }\n }\n\n if (approved && !flags.dryRun && plan.changes.length > 0) {\n await applyProjectPlan(this, plan);\n }\n const applied = approved && !flags.dryRun && plan.changes.length > 0;\n const hasSkill = state.existingSkillDirectories.some(({ path }) =>\n this.fs.existsSync(join(state.projectRoot, path, CUSTOM_FUNCTION_SKILL_NAME, 'SKILL.md')),\n );\n const aiHandoff = buildNewFunctionAiHandoff({\n displayName: generated.displayName,\n sourcePath: displayProjectPath(\n this.process.cwd(),\n join(state.manifestDirectory, generated.sourceFile.path),\n ),\n targetDirectory: displayProjectPath(this.process.cwd(), state.targetDirectory),\n manifestPath: displayProjectPath(this.process.cwd(), state.manifestPath),\n hasSkill,\n variableNames: parameterNamesInManifestValue(generated.manifestEntry),\n });\n const result = buildPlanResult(plan, {\n applied,\n dryRun: flags.dryRun,\n cwd: this.process.cwd(),\n aiHandoff,\n });\n if (flags.json) {\n this.process.stdout.write(`${JSON.stringify(result)}\\n`);\n return;\n }\n if (flags.dryRun) {\n this.logger.info(colors.yellow('Dry run complete. No changes were written.'));\n return;\n }\n if (!approved) {\n this.logger.info(colors.yellow('No changes applied.'));\n return;\n }\n this.logger.info(colors.green('Custom Function added.'));\n if (plan.nextSteps.length > 0) {\n this.logger.info(`\\n${colors.bold('Next steps')}`);\n plan.nextSteps.forEach((step) => this.logger.info(step));\n }\n this.logger.info(`\\n${colors.bold('AI handoff — paste into your coding agent')}`);\n this.logger.info(aiHandoff);\n } catch (error) {\n if (error instanceof PromptCancelledError) {\n this.process.exit(130);\n }\n throw error;\n }\n}\n\nexport { _new as newCustomFunction };\n"],"mappings":"mtBAoEA,eAAsB,EACpB,EACqC,CACrC,IAAM,EAAe,MAAM,EAAQ,OACjC,wBACA,CACE,CACE,KAAM,EAAmC,EAAmB,SAC5D,MAAO,EAAmB,QAC3B,CACD,CACE,KAAM,EAAmC,EAAmB,KAC5D,MAAO,EAAmB,IAC3B,CACF,CACD,EAAmB,QACpB,CACK,EAAY,EAAmC,GACrD,GAAI,EAAU,OAAS,EAAG,CACxB,GAAM,CAAC,GAAgB,EACvB,GAAI,IAAiB,IAAA,GACnB,MAAU,MAAM,qDAAqD,EAAa,GAAG,CAEvF,OAAO,EAET,OAAO,EAAQ,OACb,YACA,EAAU,IAAK,IAAW,CACxB,KAAM,EAAuC,GAC7C,QACD,EAAE,CACH,EAAU,GACX,CAUH,eAAsB,EAEpB,EACA,EACe,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,OAEF,KAAK,OAAO,KAAK,EAAO,MAAM,yBAAyB,CAAC,CACpD,EAAK,UAAU,OAAS,IAC1B,KAAK,OAAO,KAAK,KAAK,EAAO,KAAK,aAAa,GAAG,CAClD,EAAK,UAAU,QAAS,GAAS,KAAK,OAAO,KAAK,EAAK,CAAC,EAE1D,KAAK,OAAO,KAAK,KAAK,EAAO,KAAK,4CAA4C,GAAG,CACjF,KAAK,OAAO,KAAK,EAAU,OACpB,EAAO,CAId,MAHI,aAAiB,GACnB,KAAK,QAAQ,KAAK,IAAI,CAElB"}
1
+ {"version":3,"file":"impl-LT1FBKID2.mjs","names":[],"sources":["../src/commands/custom-functions/new/impl.ts"],"sourcesContent":["import { join } from 'node:path';\n\nimport { CustomFunctionType } from '@transcend-io/privacy-types';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { buildNewFunctionAiHandoff } from '../../../lib/custom-functions/ai-handoff.js';\nimport { CUSTOM_FUNCTION_SKILL_NAME } from '../../../lib/custom-functions/custom-function-skill.js';\nimport { formatMissingManifestMessage } from '../../../lib/custom-functions/missing-manifest.js';\nimport { buildCustomFunctionProjectArguments } from '../../../lib/custom-functions/paths.js';\nimport {\n discoverCustomFunctionManifests,\n discoverCustomFunctionProject,\n} from '../../../lib/custom-functions/project-discovery.js';\nimport { buildPlanResult } from '../../../lib/custom-functions/scaffold-output.js';\nimport {\n buildAddFunctionPlan,\n getAddFunctionPlanningCandidatePaths,\n parameterNamesInManifestValue,\n prepareGeneratedCustomFunction,\n} from '../../../lib/custom-functions/scaffold-planning.js';\nimport {\n CUSTOM_FUNCTION_TEMPLATE_NAMES,\n CUSTOM_FUNCTION_TEMPLATE_PROMPT_LABELS,\n CUSTOM_FUNCTION_TYPE_PROMPT_LABELS,\n TEMPLATES_FOR_CUSTOM_FUNCTION_TYPE,\n type CustomFunctionTemplateName,\n validateCustomFunctionDisplayName,\n} from '../../../lib/custom-functions/scaffold-templates.js';\nimport { collectPlanningSnapshots } from '../../../lib/scaffolding/project-discovery.js';\nimport { applyProjectPlan } from '../../../lib/scaffolding/project-plan-apply.js';\nimport {\n displayProjectPath,\n renderProjectPlan,\n} from '../../../lib/scaffolding/project-plan-output.js';\nimport {\n isInteractivePromptInvocation,\n PromptCancelledError,\n ScaffoldPrompts,\n} from '../../../lib/scaffolding/prompts.js';\n\n/** Flags for `custom-functions new`. */\nexport interface CustomFunctionNewFlags {\n /** Explicit existing manifest path. */\n manifest?: string;\n /** Custom Function display name. */\n name?: string;\n /** Starter handler shape. */\n template?: CustomFunctionTemplateName;\n /** Disable prompts. */\n noInteractive: boolean;\n /** Render but do not apply. */\n dryRun: boolean;\n /** Approve the final displayed plan. */\n yes: boolean;\n /** Emit one stable JSON result on stdout. */\n json: boolean;\n}\n\n/**\n * Ask for the product-level function type, then its available starter template.\n *\n * General currently has one template, so selecting it completes the choice immediately.\n *\n * @param prompts - Context-bound prompt adapter\n * @returns Selected starter template\n */\nexport async function selectInteractiveTemplate(\n prompts: Pick<ScaffoldPrompts, 'select'>,\n): Promise<CustomFunctionTemplateName> {\n const functionType = await prompts.select<CustomFunctionType>(\n 'Custom Function type:',\n [\n {\n name: CUSTOM_FUNCTION_TYPE_PROMPT_LABELS[CustomFunctionType.General],\n value: CustomFunctionType.General,\n },\n {\n name: CUSTOM_FUNCTION_TYPE_PROMPT_LABELS[CustomFunctionType.Dsr],\n value: CustomFunctionType.Dsr,\n },\n ],\n CustomFunctionType.General,\n );\n const templates = TEMPLATES_FOR_CUSTOM_FUNCTION_TYPE[functionType];\n if (templates.length < 2) {\n const [onlyTemplate] = templates;\n if (onlyTemplate === undefined) {\n throw new Error(`No Custom Function templates are defined for type ${functionType}.`);\n }\n return onlyTemplate;\n }\n return prompts.select<CustomFunctionTemplateName>(\n 'Template:',\n templates.map((value) => ({\n name: CUSTOM_FUNCTION_TEMPLATE_PROMPT_LABELS[value],\n value,\n })),\n templates[0],\n );\n}\n\n/**\n * Scaffold one deterministic local Custom Function.\n *\n * @param this - CLI context\n * @param flags - Template and interaction flags\n * @param directory - Optional target directory\n */\nexport async function _new(\n this: LocalContext,\n flags: CustomFunctionNewFlags,\n directory?: string,\n): Promise<void> {\n doneInputValidation(this.process);\n try {\n const state = discoverCustomFunctionProject(this, {\n ...(directory ? { directory } : {}),\n ...(flags.manifest ? { manifest: flags.manifest } : {}),\n });\n if (!this.fs.existsSync(state.manifestPath)) {\n const cwd = this.process.cwd();\n throw new Error(\n formatMissingManifestMessage({\n cwd,\n manifestPath: state.manifestPath,\n discoveredManifestPaths: discoverCustomFunctionManifests(this, cwd),\n command: 'new',\n }),\n );\n }\n const prompts = new ScaffoldPrompts(this);\n const interactive = isInteractivePromptInvocation(\n flags,\n this.process.stdin.isTTY,\n this.process.stderr.isTTY,\n );\n const name =\n flags.name ??\n (interactive\n ? await prompts.text('Custom Function display name:', undefined, (value) => {\n try {\n validateCustomFunctionDisplayName(value);\n return true;\n } catch (error) {\n return error instanceof Error ? error.message : String(error);\n }\n })\n : undefined);\n if (!name) {\n throw new Error('Missing Custom Function name. Pass --name in a non-interactive invocation.');\n }\n const template =\n flags.template ?? (interactive ? await selectInteractiveTemplate(prompts) : undefined);\n if (!template || !CUSTOM_FUNCTION_TEMPLATE_NAMES.includes(template)) {\n throw new Error(\n 'Missing Custom Function template. Pass --template=general, --template=dsr-datapoint, --template=dsr-enricher, or --template=dsr-both.',\n );\n }\n const generated = prepareGeneratedCustomFunction(name, template);\n const snapshots = collectPlanningSnapshots(\n this,\n state.manifestDirectory,\n getAddFunctionPlanningCandidatePaths(state, generated),\n );\n const plan = buildAddFunctionPlan(\n {\n state,\n snapshots,\n },\n { generated },\n );\n if (!this.fs.existsSync(state.denoConfigPath)) {\n plan.warnings.push(\n `No Deno configuration was found. Run ` +\n `transcend custom-functions init ${buildCustomFunctionProjectArguments(\n state.targetDirectory,\n state.manifestPath,\n this.process.cwd(),\n )} --deno --noInteractive.`,\n );\n }\n if (!flags.json) {\n this.logger.info(\n renderProjectPlan(plan, {\n cwd: this.process.cwd(),\n title: 'Custom Function plan',\n details: [\n { label: 'Target', path: plan.targetDirectory },\n { label: 'Manifest', path: plan.manifestPath },\n ],\n }),\n );\n }\n\n let approved = plan.changes.length === 0 || flags.dryRun;\n if (plan.changes.length > 0 && !flags.dryRun) {\n if (flags.yes) {\n approved = true;\n } else if (interactive) {\n approved = await prompts.confirm('Apply this complete plan?', true);\n } else {\n throw new Error(\n 'The plan requires approval in a non-interactive invocation. Review with --dryRun, then pass --yes.',\n );\n }\n }\n\n if (approved && !flags.dryRun && plan.changes.length > 0) {\n await applyProjectPlan(this, plan);\n }\n const applied = approved && !flags.dryRun && plan.changes.length > 0;\n const hasSkill = state.existingSkillDirectories.some(({ path }) =>\n this.fs.existsSync(join(state.projectRoot, path, CUSTOM_FUNCTION_SKILL_NAME, 'SKILL.md')),\n );\n const aiHandoff = buildNewFunctionAiHandoff({\n displayName: generated.displayName,\n sourcePath: displayProjectPath(\n this.process.cwd(),\n join(state.manifestDirectory, generated.sourceFile.path),\n ),\n targetDirectory: displayProjectPath(this.process.cwd(), state.targetDirectory),\n manifestPath: displayProjectPath(this.process.cwd(), state.manifestPath),\n hasSkill,\n variableNames: parameterNamesInManifestValue(generated.manifestEntry),\n });\n const result = buildPlanResult(plan, {\n applied,\n dryRun: flags.dryRun,\n cwd: this.process.cwd(),\n aiHandoff,\n });\n if (flags.json) {\n this.process.stdout.write(`${JSON.stringify(result)}\\n`);\n return;\n }\n if (flags.dryRun) {\n this.logger.info(colors.yellow('Dry run complete. No changes were written.'));\n return;\n }\n if (!approved) {\n this.logger.info(colors.yellow('No changes applied.'));\n return;\n }\n this.logger.info(colors.green('Custom Function added.'));\n if (plan.nextSteps.length > 0) {\n this.logger.info(`\\n${colors.bold('Next steps')}`);\n plan.nextSteps.forEach((step) => this.logger.info(step));\n }\n this.logger.info(`\\n${colors.bold('AI handoff — paste into your coding agent')}`);\n this.logger.info(aiHandoff);\n } catch (error) {\n if (error instanceof PromptCancelledError) {\n this.process.exit(130);\n }\n throw error;\n }\n}\n\nexport { _new as newCustomFunction };\n"],"mappings":"mtBAoEA,eAAsB,EACpB,EACqC,CACrC,IAAM,EAAe,MAAM,EAAQ,OACjC,wBACA,CACE,CACE,KAAM,EAAmC,EAAmB,SAC5D,MAAO,EAAmB,QAC3B,CACD,CACE,KAAM,EAAmC,EAAmB,KAC5D,MAAO,EAAmB,IAC3B,CACF,CACD,EAAmB,QACpB,CACK,EAAY,EAAmC,GACrD,GAAI,EAAU,OAAS,EAAG,CACxB,GAAM,CAAC,GAAgB,EACvB,GAAI,IAAiB,IAAA,GACnB,MAAU,MAAM,qDAAqD,EAAa,GAAG,CAEvF,OAAO,EAET,OAAO,EAAQ,OACb,YACA,EAAU,IAAK,IAAW,CACxB,KAAM,EAAuC,GAC7C,QACD,EAAE,CACH,EAAU,GACX,CAUH,eAAsB,EAEpB,EACA,EACe,CACf,EAAoB,KAAK,QAAQ,CACjC,GAAI,CACF,IAAM,EAAQ,EAA8B,KAAM,CAChD,GAAI,EAAY,CAAE,YAAW,CAAG,EAAE,CAClC,GAAI,EAAM,SAAW,CAAE,SAAU,EAAM,SAAU,CAAG,EAAE,CACvD,CAAC,CACF,GAAI,CAAC,KAAK,GAAG,WAAW,EAAM,aAAa,CAAE,CAC3C,IAAM,EAAM,KAAK,QAAQ,KAAK,CAC9B,MAAU,MACR,EAA6B,CAC3B,MACA,aAAc,EAAM,aACpB,wBAAyB,EAAgC,KAAM,EAAI,CACnE,QAAS,MACV,CAAC,CACH,CAEH,IAAM,EAAU,IAAI,EAAgB,KAAK,CACnC,EAAc,EAClB,EACA,KAAK,QAAQ,MAAM,MACnB,KAAK,QAAQ,OAAO,MACrB,CACK,EACJ,EAAM,OACL,EACG,MAAM,EAAQ,KAAK,gCAAiC,IAAA,GAAY,GAAU,CACxE,GAAI,CAEF,OADA,EAAkC,EAAM,CACjC,SACA,EAAO,CACd,OAAO,aAAiB,MAAQ,EAAM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QAAQ,KAAK,CAClB,EAAK,EAAM,kBAAmB,EAAU,WAAW,KAAK,CACzD,CACD,gBAAiB,EAAmB,KAAK,QAAQ,KAAK,CAAE,EAAM,gBAAgB,CAC9E,aAAc,EAAmB,KAAK,QAAQ,KAAK,CAAE,EAAM,aAAa,CACxE,WACA,cAAe,EAA8B,EAAU,cAAc,CACtE,CAAC,CACI,EAAS,EAAgB,EAAM,CACnC,UACA,OAAQ,EAAM,OACd,IAAK,KAAK,QAAQ,KAAK,CACvB,YACD,CAAC,CACF,GAAI,EAAM,KAAM,CACd,KAAK,QAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,EAAO,CAAC,IAAI,CACxD,OAEF,GAAI,EAAM,OAAQ,CAChB,KAAK,OAAO,KAAK,EAAO,OAAO,6CAA6C,CAAC,CAC7E,OAEF,GAAI,CAAC,EAAU,CACb,KAAK,OAAO,KAAK,EAAO,OAAO,sBAAsB,CAAC,CACtD,OAEF,KAAK,OAAO,KAAK,EAAO,MAAM,yBAAyB,CAAC,CACpD,EAAK,UAAU,OAAS,IAC1B,KAAK,OAAO,KAAK,KAAK,EAAO,KAAK,aAAa,GAAG,CAClD,EAAK,UAAU,QAAS,GAAS,KAAK,OAAO,KAAK,EAAK,CAAC,EAE1D,KAAK,OAAO,KAAK,KAAK,EAAO,KAAK,4CAA4C,GAAG,CACjF,KAAK,OAAO,KAAK,EAAU,OACpB,EAAO,CAId,MAHI,aAAiB,GACnB,KAAK,QAAQ,KAAK,IAAI,CAElB"}
@@ -0,0 +1,2 @@
1
+ import{i as e,n as t,t as n}from"./policy-project-discovery-BSQ2Cow0.mjs";import{t as r}from"./done-input-validation-LiTaCEzF.mjs";import{t as i}from"./run-captured-process-BjaSDWXG.mjs";import{n as a,r as o,t as s}from"./runRegalLintStep-DPaMm7Gg.mjs";import c from"node:path";import l from"colors";const u=[`opa-version`,`regal-version`,`format`,`regal-lint`],d={"opa-version":`OPA 1.x`,"regal-version":`Regal`,format:`OPA formatting`,"regal-lint":`Regal lint`};function f(e,t,n){n?e.logger.info(`${l.bold(n)}\n`):e.logger.info(`${l.bold(`Policy lint`)}\n`),t.checks.forEach(({name:n,status:r})=>{let i=r===`passed`?`PASS`:r===`failed`?`FAIL`:`SKIP`,a=r===`passed`?l.green(i):r===`failed`?l.red(i):l.yellow(i),o=n===`opa-version`&&t.tools.opa?` (${t.tools.opa})`:n===`regal-version`&&t.tools.regal?` (${t.tools.regal})`:``;e.logger.info(`${a} ${d[n]}${o}`)}),t.diagnostics.length>0&&e.logger.error(``),t.diagnostics.forEach(t=>{let n=t.path?`${t.path}: `:``;e.logger.error(l.red(`error [${t.code}]: ${n}${t.message}`))}),t.status===`passed`?(e.logger.info(``),e.logger.info(l.green(`Policy lint passed.`))):(e.logger.error(``),e.logger.error(l.red(`Policy lint failed.`)))}async function p({fix:e,noInteractive:t,json:n},r,i){let l=u.map(e=>({name:e,status:`skipped`})),d=[],f={version:1,status:`passed`,directory:r,fix:e,tools:{opa:null,regal:null},checks:l,unformattedFiles:[],fixedFiles:[],diagnostics:d},p=(e,t)=>{l.find(t=>t.name===e).status=t},m=(e,t,n)=>{d.push({code:e,severity:`error`,message:t,...n?{path:n}:{}})};if(!this.fs.existsSync(r)||!this.fs.statSync(r).isDirectory())return p(`opa-version`,`failed`),m(`project.directory`,`Policy directory does not exist or is not a directory: ${r}`,c.relative(this.process.cwd(),r)),f.status=`failed`,f;let h=await o.call(this,r,i);if(f.tools={opa:h.opa,regal:h.regal},p(`opa-version`,h.opaStatus),p(`regal-version`,h.regalStatus),h.diagnostics.forEach(e=>{m(e.code,e.message)}),f.tools.opa){let o=await a.call(this,{resolvedDir:r,fix:e,noInteractive:t,json:n,fixCommandHint:`transcend policy lint --fix`,runner:i});f.unformattedFiles=o.unformattedFiles,f.fixedFiles=o.fixedFiles,p(`format`,o.status),o.diagnostics.forEach(e=>{m(e.code,e.message)})}if(f.tools.regal){let e=await s.call(this,{resolvedDir:r,runner:i});p(`regal-lint`,e.status),e.diagnostics.forEach(e=>{m(e.code,e.message)})}return f.status=l.some(({status:e})=>e===`failed`)?`failed`:`passed`,f}async function m(a,o=n,s=i){r(this.process);let{fix:l=!1,noInteractive:d=!1,json:m=!1}=a,h=e(this.process.cwd(),o);if(!this.fs.existsSync(h)||!this.fs.statSync(h).isDirectory()){let e={version:1,status:`failed`,directory:h,fix:l,tools:{opa:null,regal:null},checks:u.map(e=>({name:e,status:e===`opa-version`?`failed`:`skipped`})),unformattedFiles:[],fixedFiles:[],diagnostics:[{code:`project.directory`,severity:`error`,message:`Policy directory does not exist or is not a directory: ${h}`,path:c.relative(this.process.cwd(),h)}]};m?this.process.stdout.write(`${JSON.stringify(e)}\n`):f(this,e),this.process.exitCode=1;return}let g=t(this,h);if(g.length===0){let e={version:1,status:`failed`,directory:h,fix:l,tools:{opa:null,regal:null},checks:u.map(e=>({name:e,status:e===`opa-version`?`failed`:`skipped`})),unformattedFiles:[],fixedFiles:[],diagnostics:[{code:`project.bundles`,severity:`error`,message:"No publishable policy bundles found. Add one with `transcend policy new`, or pass a directory that contains a `.manifest`.",path:c.relative(this.process.cwd(),h)||`.`}]};m?this.process.stdout.write(`${JSON.stringify(e)}\n`):f(this,e),this.process.exitCode=1;return}let _=[];for(let e of g)_.push(await p.call(this,{fix:l,noInteractive:d,json:m},e,s));let v=_.some(e=>e.status===`failed`);if(m)if(_.length===1)this.process.stdout.write(`${JSON.stringify(_[0])}\n`);else{let e={version:1,status:v?`failed`:`passed`,directory:h,fix:l,results:_};this.process.stdout.write(`${JSON.stringify(e)}\n`)}else _.length===1?f(this,_[0]):_.forEach((e,t)=>{t>0&&this.logger.info(``);let n=c.relative(this.process.cwd(),e.directory)||e.directory;f(this,e,`Policy lint — ${n}`)});v&&(this.process.exitCode=1)}export{m as lint};
2
+ //# sourceMappingURL=impl-Q2ZDQO_y2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl-Q2ZDQO_y2.mjs","names":[],"sources":["../src/lib/policy/policy-lint-model.ts","../src/commands/policy/lint/impl.ts"],"sourcesContent":["/** Stable policy lint result schema version. */\nexport const POLICY_LINT_RESULT_VERSION = 1;\n\n/** Stable multi-bundle lint result schema version. */\nexport const POLICY_LINT_MULTI_RESULT_VERSION = 1;\n\n/** Status of the lint gate or an individual step. */\nexport type PolicyLintStatus = 'passed' | 'failed' | 'skipped';\n\n/** One named policy lint step. */\nexport interface PolicyLintStep {\n /** Stable step name. */\n name: 'opa-version' | 'regal-version' | 'format' | 'regal-lint';\n /** Step outcome. */\n status: PolicyLintStatus;\n}\n\n/** Stable lint step execution order. */\nexport const POLICY_LINT_STEP_NAMES: PolicyLintStep['name'][] = [\n 'opa-version',\n 'regal-version',\n 'format',\n 'regal-lint',\n];\n\n/** User-facing lint step labels. */\nexport const POLICY_LINT_STEP_LABELS: Readonly<Record<PolicyLintStep['name'], string>> = {\n 'opa-version': 'OPA 1.x',\n 'regal-version': 'Regal',\n format: 'OPA formatting',\n 'regal-lint': 'Regal lint',\n};\n\n/** One machine-readable policy lint diagnostic. */\nexport interface PolicyLintDiagnostic {\n /** Stable diagnostic identifier. */\n code: string;\n /** Diagnostic severity. */\n severity: 'error';\n /** Human-readable detail, including captured tool output when available. */\n message: string;\n /** Optional path relative to the invocation directory. */\n path?: string;\n}\n\n/** Detected local policy tool versions. */\nexport interface PolicyLintTools {\n /** Detected OPA version, or null when missing or unsupported. */\n opa: string | null;\n /** Detected Regal version, or null when missing or unsupported. */\n regal: string | null;\n}\n\n/** Stable result emitted by `transcend policy lint --json` for one bundle. */\nexport interface PolicyLintResult {\n /** Result schema version. */\n version: typeof POLICY_LINT_RESULT_VERSION;\n /** Overall lint outcome. */\n status: Exclude<PolicyLintStatus, 'skipped'>;\n /** Absolute policy bundle directory. */\n directory: string;\n /** Whether formatting repair was explicitly requested. */\n fix: boolean;\n /** Detected supported tool versions. */\n tools: PolicyLintTools;\n /** Lint step outcomes in stable execution order. */\n checks: PolicyLintStep[];\n /** Files found to need OPA formatting, relative to the policy directory. */\n unformattedFiles: string[];\n /** Files repaired with OPA formatting, relative to the policy directory. */\n fixedFiles: string[];\n /** Ordered lint diagnostics. */\n diagnostics: PolicyLintDiagnostic[];\n}\n\n/**\n * Stable result when `transcend policy lint --json` lints multiple bundles.\n *\n * Emitted only when the selected path is a workspace with more than one\n * publishable `*-bundle/` directory.\n */\nexport interface PolicyLintMultiResult {\n /** Result schema version. */\n version: typeof POLICY_LINT_MULTI_RESULT_VERSION;\n /** Overall lint outcome across all bundles. */\n status: Exclude<PolicyLintStatus, 'skipped'>;\n /** Absolute policy workspace directory that was searched. */\n directory: string;\n /** Whether formatting repair was explicitly requested. */\n fix: boolean;\n /** Per-bundle results in discovery order. */\n results: PolicyLintResult[];\n}\n","import path from 'node:path';\n\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport {\n runCapturedProcess,\n type CapturedProcessRunner,\n} from '../../../lib/cli/run-captured-process.js';\nimport {\n type PolicyLintDiagnostic,\n type PolicyLintMultiResult,\n type PolicyLintResult,\n type PolicyLintStep,\n POLICY_LINT_MULTI_RESULT_VERSION,\n POLICY_LINT_RESULT_VERSION,\n POLICY_LINT_STEP_LABELS,\n POLICY_LINT_STEP_NAMES,\n} from '../../../lib/policy/policy-lint-model.js';\nimport {\n DEFAULT_POLICY_PROJECT_DIRECTORY,\n discoverPolicyBundleDirectories,\n resolvePolicyProjectDirectory,\n} from '../../../lib/policy/policy-project-discovery.js';\nimport { probePolicyToolVersions } from '../helpers/probePolicyToolVersions.js';\nimport { runOpaFormatStep } from '../helpers/runOpaFormatStep.js';\nimport { runRegalLintStep } from '../helpers/runRegalLintStep.js';\n\n/** CLI flags for `transcend policy lint`. */\nexport interface LintCommandFlags {\n /** Apply OPA formatting. */\n fix: boolean;\n /** Disable the optional formatting confirmation. */\n noInteractive: boolean;\n /** Emit one stable JSON result on stdout. */\n json: boolean;\n}\n\n/**\n * Render the terminal summary for a policy lint result.\n *\n * @param context - CLI context\n * @param result - Completed lint result\n * @param heading - Optional section heading when linting multiple bundles\n */\nfunction renderResult(context: LocalContext, result: PolicyLintResult, heading?: string): void {\n if (heading) {\n context.logger.info(`${colors.bold(heading)}\\n`);\n } else {\n context.logger.info(`${colors.bold('Policy lint')}\\n`);\n }\n result.checks.forEach(({ name, status }) => {\n const label = status === 'passed' ? 'PASS' : status === 'failed' ? 'FAIL' : 'SKIP';\n const styledLabel =\n status === 'passed'\n ? colors.green(label)\n : status === 'failed'\n ? colors.red(label)\n : colors.yellow(label);\n const version =\n name === 'opa-version' && result.tools.opa\n ? ` (${result.tools.opa})`\n : name === 'regal-version' && result.tools.regal\n ? ` (${result.tools.regal})`\n : '';\n context.logger.info(`${styledLabel} ${POLICY_LINT_STEP_LABELS[name]}${version}`);\n });\n if (result.diagnostics.length > 0) {\n context.logger.error('');\n }\n result.diagnostics.forEach((diagnostic) => {\n const location = diagnostic.path ? `${diagnostic.path}: ` : '';\n context.logger.error(\n colors.red(`error [${diagnostic.code}]: ${location}${diagnostic.message}`),\n );\n });\n if (result.status === 'passed') {\n context.logger.info('');\n context.logger.info(colors.green('Policy lint passed.'));\n } else {\n context.logger.error('');\n context.logger.error(colors.red('Policy lint failed.'));\n }\n}\n\n/**\n * Lint one publishable policy bundle directory (format + Regal).\n *\n * @param this - CLI context\n * @param flags - Command flags\n * @param resolvedDir - Absolute bundle directory\n * @param runner - Captured subprocess runner\n * @returns Completed lint result\n */\nasync function lintBundle(\n this: LocalContext,\n { fix, noInteractive, json }: LintCommandFlags,\n resolvedDir: string,\n runner: CapturedProcessRunner,\n): Promise<PolicyLintResult> {\n const checks: PolicyLintStep[] = POLICY_LINT_STEP_NAMES.map((name) => ({\n name,\n status: 'skipped',\n }));\n const diagnostics: PolicyLintDiagnostic[] = [];\n const result: PolicyLintResult = {\n version: POLICY_LINT_RESULT_VERSION,\n status: 'passed',\n directory: resolvedDir,\n fix,\n tools: { opa: null, regal: null },\n checks,\n unformattedFiles: [],\n fixedFiles: [],\n diagnostics,\n };\n const setStatus = (name: PolicyLintStep['name'], status: PolicyLintStep['status']): void => {\n checks.find((check) => check.name === name)!.status = status;\n };\n const addError = (code: string, message: string, diagnosticPath?: string): void => {\n diagnostics.push({\n code,\n severity: 'error',\n message,\n ...(diagnosticPath ? { path: diagnosticPath } : {}),\n });\n };\n\n if (!this.fs.existsSync(resolvedDir) || !this.fs.statSync(resolvedDir).isDirectory()) {\n setStatus('opa-version', 'failed');\n addError(\n 'project.directory',\n `Policy directory does not exist or is not a directory: ${resolvedDir}`,\n path.relative(this.process.cwd(), resolvedDir),\n );\n result.status = 'failed';\n return result;\n }\n\n const toolVersions = await probePolicyToolVersions.call(this, resolvedDir, runner);\n result.tools = { opa: toolVersions.opa, regal: toolVersions.regal };\n setStatus('opa-version', toolVersions.opaStatus);\n setStatus('regal-version', toolVersions.regalStatus);\n toolVersions.diagnostics.forEach((diagnostic) => {\n addError(diagnostic.code, diagnostic.message);\n });\n\n if (result.tools.opa) {\n const formatStep = await runOpaFormatStep.call(this, {\n resolvedDir,\n fix,\n noInteractive,\n json,\n fixCommandHint: 'transcend policy lint --fix',\n runner,\n });\n result.unformattedFiles = formatStep.unformattedFiles;\n result.fixedFiles = formatStep.fixedFiles;\n setStatus('format', formatStep.status);\n formatStep.diagnostics.forEach((diagnostic) => {\n addError(diagnostic.code, diagnostic.message);\n });\n }\n\n if (result.tools.regal) {\n const regalStep = await runRegalLintStep.call(this, { resolvedDir, runner });\n setStatus('regal-lint', regalStep.status);\n regalStep.diagnostics.forEach((diagnostic) => {\n addError(diagnostic.code, diagnostic.message);\n });\n }\n\n result.status = checks.some(({ status }) => status === 'failed') ? 'failed' : 'passed';\n return result;\n}\n\n/**\n * Lint local policy bundles with OPA formatting and Regal.\n *\n * With no directory (or the default workspace path), discovers every immediate\n * child that contains a `.manifest` and lints each. Pass one bundle path to\n * lint a single publishable unit.\n *\n * @param this - CLI context\n * @param flags - Command flags\n * @param directory - Policy workspace or bundle directory\n * @param runner - Captured subprocess runner\n */\nexport async function lint(\n this: LocalContext,\n flags: LintCommandFlags,\n directory: string = DEFAULT_POLICY_PROJECT_DIRECTORY,\n runner: CapturedProcessRunner = runCapturedProcess,\n): Promise<void> {\n doneInputValidation(this.process);\n\n const { fix = false, noInteractive = false, json = false } = flags;\n const resolvedDir = resolvePolicyProjectDirectory(this.process.cwd(), directory);\n\n if (!this.fs.existsSync(resolvedDir) || !this.fs.statSync(resolvedDir).isDirectory()) {\n const missing: PolicyLintResult = {\n version: POLICY_LINT_RESULT_VERSION,\n status: 'failed',\n directory: resolvedDir,\n fix,\n tools: { opa: null, regal: null },\n checks: POLICY_LINT_STEP_NAMES.map((name) => ({\n name,\n status: name === 'opa-version' ? 'failed' : 'skipped',\n })),\n unformattedFiles: [],\n fixedFiles: [],\n diagnostics: [\n {\n code: 'project.directory',\n severity: 'error',\n message: `Policy directory does not exist or is not a directory: ${resolvedDir}`,\n path: path.relative(this.process.cwd(), resolvedDir),\n },\n ],\n };\n if (json) {\n this.process.stdout.write(`${JSON.stringify(missing)}\\n`);\n } else {\n renderResult(this, missing);\n }\n this.process.exitCode = 1;\n return;\n }\n\n const bundleDirectories = discoverPolicyBundleDirectories(this, resolvedDir);\n if (bundleDirectories.length === 0) {\n const empty: PolicyLintResult = {\n version: POLICY_LINT_RESULT_VERSION,\n status: 'failed',\n directory: resolvedDir,\n fix,\n tools: { opa: null, regal: null },\n checks: POLICY_LINT_STEP_NAMES.map((name) => ({\n name,\n status: name === 'opa-version' ? 'failed' : 'skipped',\n })),\n unformattedFiles: [],\n fixedFiles: [],\n diagnostics: [\n {\n code: 'project.bundles',\n severity: 'error',\n message:\n 'No publishable policy bundles found. Add one with `transcend policy new`, ' +\n 'or pass a directory that contains a `.manifest`.',\n path: path.relative(this.process.cwd(), resolvedDir) || '.',\n },\n ],\n };\n if (json) {\n this.process.stdout.write(`${JSON.stringify(empty)}\\n`);\n } else {\n renderResult(this, empty);\n }\n this.process.exitCode = 1;\n return;\n }\n\n const results: PolicyLintResult[] = [];\n for (const bundleDirectory of bundleDirectories) {\n results.push(\n await lintBundle.call(this, { fix, noInteractive, json }, bundleDirectory, runner),\n );\n }\n\n const failed = results.some((result) => result.status === 'failed');\n if (json) {\n if (results.length === 1) {\n this.process.stdout.write(`${JSON.stringify(results[0])}\\n`);\n } else {\n const multi: PolicyLintMultiResult = {\n version: POLICY_LINT_MULTI_RESULT_VERSION,\n status: failed ? 'failed' : 'passed',\n directory: resolvedDir,\n fix,\n results,\n };\n this.process.stdout.write(`${JSON.stringify(multi)}\\n`);\n }\n } else if (results.length === 1) {\n renderResult(this, results[0]!);\n } else {\n results.forEach((result, index) => {\n if (index > 0) {\n this.logger.info('');\n }\n const relative = path.relative(this.process.cwd(), result.directory) || result.directory;\n renderResult(this, result, `Policy lint — ${relative}`);\n });\n }\n\n if (failed) {\n this.process.exitCode = 1;\n }\n}\n"],"mappings":"4SAkBA,MAAa,EAAmD,CAC9D,cACA,gBACA,SACA,aACD,CAGY,EAA4E,CACvF,cAAe,UACf,gBAAiB,QACjB,OAAQ,iBACR,aAAc,aACf,CCeD,SAAS,EAAa,EAAuB,EAA0B,EAAwB,CACzF,EACF,EAAQ,OAAO,KAAK,GAAG,EAAO,KAAK,EAAQ,CAAC,IAAI,CAEhD,EAAQ,OAAO,KAAK,GAAG,EAAO,KAAK,cAAc,CAAC,IAAI,CAExD,EAAO,OAAO,SAAS,CAAE,OAAM,YAAa,CAC1C,IAAM,EAAQ,IAAW,SAAW,OAAS,IAAW,SAAW,OAAS,OACtE,EACJ,IAAW,SACP,EAAO,MAAM,EAAM,CACnB,IAAW,SACT,EAAO,IAAI,EAAM,CACjB,EAAO,OAAO,EAAM,CACtB,EACJ,IAAS,eAAiB,EAAO,MAAM,IACnC,KAAK,EAAO,MAAM,IAAI,GACtB,IAAS,iBAAmB,EAAO,MAAM,MACvC,KAAK,EAAO,MAAM,MAAM,GACxB,GACR,EAAQ,OAAO,KAAK,GAAG,EAAY,GAAG,EAAwB,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UACD,CACD,KAAK,QAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,EAAM,CAAC,IAAI,MAEhD,EAAQ,SAAW,EAC5B,EAAa,KAAM,EAAQ,GAAI,CAE/B,EAAQ,SAAS,EAAQ,IAAU,CAC7B,EAAQ,GACV,KAAK,OAAO,KAAK,GAAG,CAEtB,IAAM,EAAW,EAAK,SAAS,KAAK,QAAQ,KAAK,CAAE,EAAO,UAAU,EAAI,EAAO,UAC/E,EAAa,KAAM,EAAQ,iBAAiB,IAAW,EACvD,CAGA,IACF,KAAK,QAAQ,SAAW"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./streamPrivacyRequestsToCsv-BApu4dvI.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";import n from"colors";async function r({auth:r,transcendUrl:i,file:a,pageLimit:o,concurrency:s,actions:c,sombraAuth:l,skipRequestIdentifiers:u,statuses:d,createdAtBefore:f,createdAtAfter:p,updatedAtBefore:m,updatedAtAfter:h,showTests:g}){t(this.process);let{filePaths:_,totalCount:v}=await e({transcendUrl:i,concurrency:s,pageLimit:o,actions:c,statuses:d,auth:r,sombraAuth:l,skipRequestIdentifiers:u,createdAtBefore:f,createdAtAfter:p,updatedAtBefore:m,updatedAtAfter:h,isTest:g,file:a});this.logger.info(n.green(`Successfully wrote ${v} requests to ${_.length} file(s): ${_.join(`, `)}`))}export{r as _export};
2
- //# sourceMappingURL=impl-DFnWzZyY.mjs.map
1
+ import{t as e}from"./streamPrivacyRequestsToCsv-D0PK8mjN.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";import n from"colors";async function r({auth:r,transcendUrl:i,file:a,pageLimit:o,concurrency:s,actions:c,sombraAuth:l,skipRequestIdentifiers:u,statuses:d,createdAtBefore:f,createdAtAfter:p,updatedAtBefore:m,updatedAtAfter:h,showTests:g}){t(this.process);let{filePaths:_,totalCount:v}=await e({transcendUrl:i,concurrency:s,pageLimit:o,actions:c,statuses:d,auth:r,sombraAuth:l,skipRequestIdentifiers:u,createdAtBefore:f,createdAtAfter:p,updatedAtBefore:m,updatedAtAfter:h,isTest:g,file:a});this.logger.info(n.green(`Successfully wrote ${v} requests to ${_.length} file(s): ${_.join(`, `)}`))}export{r as _export};
2
+ //# sourceMappingURL=impl-UtanPzK1.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DFnWzZyY.mjs","names":[],"sources":["../src/commands/request/export/impl.ts"],"sourcesContent":["import type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { streamPrivacyRequestsToCsv } from '../../../lib/requests/index.js';\n\nexport interface ExportCommandFlags {\n auth: string;\n sombraAuth?: string;\n actions?: RequestAction[];\n statuses?: RequestStatus[];\n transcendUrl: string;\n file: string;\n concurrency: number;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n showTests?: boolean;\n skipRequestIdentifiers?: boolean;\n pageLimit: number;\n}\n\n// `export` is a reserved keyword, so we need to prefix it with an underscore\n// eslint-disable-next-line no-underscore-dangle\nexport async function _export(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n file,\n pageLimit,\n concurrency,\n actions,\n sombraAuth,\n skipRequestIdentifiers,\n statuses,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n showTests,\n }: ExportCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n const { filePaths, totalCount } = await streamPrivacyRequestsToCsv({\n transcendUrl,\n concurrency,\n pageLimit,\n actions,\n statuses,\n auth,\n sombraAuth,\n skipRequestIdentifiers,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isTest: showTests,\n file,\n });\n\n this.logger.info(\n colors.green(\n `Successfully wrote ${totalCount} requests to ` +\n `${filePaths.length} file(s): ${filePaths.join(', ')}`,\n ),\n );\n}\n"],"mappings":"wIA0BA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,YACA,cACA,UACA,aACA,yBACA,WACA,kBACA,iBACA,kBACA,iBACA,aAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,GAAM,CAAE,YAAW,cAAe,MAAM,EAA2B,CACjE,eACA,cACA,YACA,UACA,WACA,OACA,aACA,yBACA,kBACA,iBACA,kBACA,iBACA,OAAQ,EACR,OACD,CAAC,CAEF,KAAK,OAAO,KACV,EAAO,MACL,sBAAsB,EAAW,eAC5B,EAAU,OAAO,YAAY,EAAU,KAAK,KAAK,GACvD,CACF"}
1
+ {"version":3,"file":"impl-UtanPzK1.mjs","names":[],"sources":["../src/commands/request/export/impl.ts"],"sourcesContent":["import type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { streamPrivacyRequestsToCsv } from '../../../lib/requests/index.js';\n\nexport interface ExportCommandFlags {\n auth: string;\n sombraAuth?: string;\n actions?: RequestAction[];\n statuses?: RequestStatus[];\n transcendUrl: string;\n file: string;\n concurrency: number;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n showTests?: boolean;\n skipRequestIdentifiers?: boolean;\n pageLimit: number;\n}\n\n// `export` is a reserved keyword, so we need to prefix it with an underscore\n// eslint-disable-next-line no-underscore-dangle\nexport async function _export(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n file,\n pageLimit,\n concurrency,\n actions,\n sombraAuth,\n skipRequestIdentifiers,\n statuses,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n showTests,\n }: ExportCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n const { filePaths, totalCount } = await streamPrivacyRequestsToCsv({\n transcendUrl,\n concurrency,\n pageLimit,\n actions,\n statuses,\n auth,\n sombraAuth,\n skipRequestIdentifiers,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isTest: showTests,\n file,\n });\n\n this.logger.info(\n colors.green(\n `Successfully wrote ${totalCount} requests to ` +\n `${filePaths.length} file(s): ${filePaths.join(', ')}`,\n ),\n );\n}\n"],"mappings":"wIA0BA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,YACA,cACA,UACA,aACA,yBACA,WACA,kBACA,iBACA,kBACA,iBACA,aAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,GAAM,CAAE,YAAW,cAAe,MAAM,EAA2B,CACjE,eACA,cACA,YACA,UACA,WACA,OACA,aACA,yBACA,kBACA,iBACA,kBACA,iBACA,OAAQ,EACR,OACD,CAAC,CAEF,KAAK,OAAO,KACV,EAAO,MACL,sBAAsB,EAAW,eAC5B,EAAU,OAAO,YAAY,EAAU,KAAK,KAAK,GACvD,CACF"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./skipRequestDataSilos-DUQ6AD_O.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";async function n({auth:n,dataSiloId:r,status:i,statuses:a,transcendUrl:o,actionTypes:s}){t(this.process),await e({transcendUrl:o,auth:n,status:i,dataSiloId:r,requestStatuses:a,actionTypes:s})}export{n as skipRequestDataSilos};
2
- //# sourceMappingURL=impl-Ar7VAh0Z.mjs.map
1
+ import{t as e}from"./skipRequestDataSilos-sdfJ0gPn.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";async function n({auth:n,dataSiloId:r,status:i,statuses:a,transcendUrl:o,actionTypes:s}){t(this.process),await e({transcendUrl:o,auth:n,status:i,dataSiloId:r,requestStatuses:a,actionTypes:s})}export{n as skipRequestDataSilos};
2
+ //# sourceMappingURL=impl-ZFp_SwYr.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-Ar7VAh0Z.mjs","names":["skipRequestDataSilosHelper"],"sources":["../src/commands/request/system/skip-request-data-silos/impl.ts"],"sourcesContent":["import type {\n RequestAction,\n RequestDataSiloStatus,\n RequestStatus,\n} from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { skipRequestDataSilos as skipRequestDataSilosHelper } from '../../../../lib/requests/index.js';\n\nexport interface SkipRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n transcendUrl: string;\n statuses: RequestStatus[];\n status: (typeof RequestDataSiloStatus)['Skipped'] | (typeof RequestDataSiloStatus)['Resolved'];\n actionTypes?: RequestAction[];\n}\n\nexport async function skipRequestDataSilos(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n status,\n statuses,\n transcendUrl,\n actionTypes,\n }: SkipRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await skipRequestDataSilosHelper({\n transcendUrl,\n auth,\n status,\n dataSiloId,\n requestStatuses: statuses,\n actionTypes,\n });\n}\n"],"mappings":"4GAmBA,eAAsB,EAEpB,CACE,OACA,aACA,SACA,WACA,eACA,eAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAMA,EAA2B,CAC/B,eACA,OACA,SACA,aACA,gBAAiB,EACjB,cACD,CAAC"}
1
+ {"version":3,"file":"impl-ZFp_SwYr.mjs","names":["skipRequestDataSilosHelper"],"sources":["../src/commands/request/system/skip-request-data-silos/impl.ts"],"sourcesContent":["import type {\n RequestAction,\n RequestDataSiloStatus,\n RequestStatus,\n} from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { skipRequestDataSilos as skipRequestDataSilosHelper } from '../../../../lib/requests/index.js';\n\nexport interface SkipRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n transcendUrl: string;\n statuses: RequestStatus[];\n status: (typeof RequestDataSiloStatus)['Skipped'] | (typeof RequestDataSiloStatus)['Resolved'];\n actionTypes?: RequestAction[];\n}\n\nexport async function skipRequestDataSilos(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n status,\n statuses,\n transcendUrl,\n actionTypes,\n }: SkipRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await skipRequestDataSilosHelper({\n transcendUrl,\n auth,\n status,\n dataSiloId,\n requestStatuses: statuses,\n actionTypes,\n });\n}\n"],"mappings":"4GAmBA,eAAsB,EAEpB,CACE,OACA,aACA,SACA,WACA,eACA,eAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAMA,EAA2B,CAC/B,eACA,OACA,SACA,aACA,gBAAiB,EACjB,cACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./bulkRestartRequests-CGvODu3r.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";async function n({auth:n,requestReceiptFolder:r,sombraAuth:i,actions:a,statuses:o,requestIds:s,createdAt:c,emailIsVerified:l,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:f,restartIdentifierStrategy:p,skipWaitingPeriod:m,createdAtBefore:h,createdAtAfter:g,updatedAtBefore:_,updatedAtAfter:v,concurrency:y,transcendUrl:b}){t(this.process),await e({requestReceiptFolder:r,auth:n,sombraAuth:i,requestActions:a,requestStatuses:o,requestIds:s,createdAt:c,emailIsVerified:l,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:f,restartIdentifierStrategy:p,skipWaitingPeriod:m,createdAtBefore:h,createdAtAfter:g,updatedAtBefore:_,updatedAtAfter:v,concurrency:y,transcendUrl:b})}export{n as restart};
2
- //# sourceMappingURL=impl-Hj5CgbWd.mjs.map
1
+ import{t as e}from"./bulkRestartRequests-DWJ8N0fa.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";async function n({auth:n,requestReceiptFolder:r,sombraAuth:i,actions:a,statuses:o,requestIds:s,createdAt:c,emailIsVerified:l,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:f,restartIdentifierStrategy:p,skipWaitingPeriod:m,createdAtBefore:h,createdAtAfter:g,updatedAtBefore:_,updatedAtAfter:v,concurrency:y,transcendUrl:b}){t(this.process),await e({requestReceiptFolder:r,auth:n,sombraAuth:i,requestActions:a,requestStatuses:o,requestIds:s,createdAt:c,emailIsVerified:l,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:f,restartIdentifierStrategy:p,skipWaitingPeriod:m,createdAtBefore:h,createdAtAfter:g,updatedAtBefore:_,updatedAtAfter:v,concurrency:y,transcendUrl:b})}export{n as restart};
2
+ //# sourceMappingURL=impl-eWsR0UvV.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-Hj5CgbWd.mjs","names":[],"sources":["../src/commands/request/restart/impl.ts"],"sourcesContent":["import type {\n RequestAction,\n RequestStatus,\n RestartIdentifierStrategy,\n} from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { bulkRestartRequests } from '../../../lib/requests/index.js';\n\nexport interface RestartCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses: RequestStatus[];\n transcendUrl: string;\n requestReceiptFolder: string;\n sombraAuth?: string;\n concurrency: number;\n requestIds?: string[];\n emailIsVerified: boolean;\n createdAt?: Date;\n silentModeBefore?: Date;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n sendEmailReceipt: boolean;\n copyIdentifiers: boolean;\n restartIdentifierStrategy?: RestartIdentifierStrategy;\n skipWaitingPeriod: boolean;\n}\n\nexport async function restart(\n this: LocalContext,\n {\n auth,\n requestReceiptFolder,\n sombraAuth,\n actions,\n statuses,\n requestIds,\n createdAt,\n emailIsVerified,\n silentModeBefore,\n sendEmailReceipt,\n copyIdentifiers,\n restartIdentifierStrategy,\n skipWaitingPeriod,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n transcendUrl,\n }: RestartCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await bulkRestartRequests({\n requestReceiptFolder,\n auth,\n sombraAuth,\n requestActions: actions,\n requestStatuses: statuses,\n requestIds,\n createdAt,\n emailIsVerified,\n silentModeBefore,\n sendEmailReceipt,\n copyIdentifiers,\n restartIdentifierStrategy,\n skipWaitingPeriod,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n transcendUrl,\n });\n}\n"],"mappings":"2GAgCA,eAAsB,EAEpB,CACE,OACA,uBACA,aACA,UACA,WACA,aACA,YACA,kBACA,mBACA,mBACA,kBACA,4BACA,oBACA,kBACA,iBACA,kBACA,iBACA,cACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAoB,CACxB,uBACA,OACA,aACA,eAAgB,EAChB,gBAAiB,EACjB,aACA,YACA,kBACA,mBACA,mBACA,kBACA,4BACA,oBACA,kBACA,iBACA,kBACA,iBACA,cACA,eACD,CAAC"}
1
+ {"version":3,"file":"impl-eWsR0UvV.mjs","names":[],"sources":["../src/commands/request/restart/impl.ts"],"sourcesContent":["import type {\n RequestAction,\n RequestStatus,\n RestartIdentifierStrategy,\n} from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { bulkRestartRequests } from '../../../lib/requests/index.js';\n\nexport interface RestartCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses: RequestStatus[];\n transcendUrl: string;\n requestReceiptFolder: string;\n sombraAuth?: string;\n concurrency: number;\n requestIds?: string[];\n emailIsVerified: boolean;\n createdAt?: Date;\n silentModeBefore?: Date;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n sendEmailReceipt: boolean;\n copyIdentifiers: boolean;\n restartIdentifierStrategy?: RestartIdentifierStrategy;\n skipWaitingPeriod: boolean;\n}\n\nexport async function restart(\n this: LocalContext,\n {\n auth,\n requestReceiptFolder,\n sombraAuth,\n actions,\n statuses,\n requestIds,\n createdAt,\n emailIsVerified,\n silentModeBefore,\n sendEmailReceipt,\n copyIdentifiers,\n restartIdentifierStrategy,\n skipWaitingPeriod,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n transcendUrl,\n }: RestartCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await bulkRestartRequests({\n requestReceiptFolder,\n auth,\n sombraAuth,\n requestActions: actions,\n requestStatuses: statuses,\n requestIds,\n createdAt,\n emailIsVerified,\n silentModeBefore,\n sendEmailReceipt,\n copyIdentifiers,\n restartIdentifierStrategy,\n skipWaitingPeriod,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n transcendUrl,\n });\n}\n"],"mappings":"2GAgCA,eAAsB,EAEpB,CACE,OACA,uBACA,aACA,UACA,WACA,aACA,YACA,kBACA,mBACA,mBACA,kBACA,4BACA,oBACA,kBACA,iBACA,kBACA,iBACA,cACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAoB,CACxB,uBACA,OACA,aACA,eAAgB,EAChB,gBAAiB,EACjB,aACA,YACA,kBACA,mBACA,mBACA,kBACA,4BACA,oBACA,kBACA,iBACA,kBACA,iBACA,cACA,eACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{N as e}from"./codecs-CfcaFoZR.mjs";import{t}from"./readCsv-DNcJ_UfU.mjs";import{n}from"./mapConsentCsvRowsToInputs-CkLfxaIf.mjs";import{t as r}from"./done-input-validation-LiTaCEzF.mjs";import i from"colors";import{buildTranscendGraphQLClient as a,syncDataFlows as o}from"@transcend-io/sdk";async function s({auth:s,trackerStatus:c,file:l,classifyService:u,transcendUrl:d}){r(this.process),this.logger.info(i.magenta(`Reading "${l}" from disk`));let f=n(t(this.fs.readFileSync(l,`utf8`),e),c);await o(a(d,s),f,{classifyService:u,logger:this.logger})||(this.logger.error(i.red(`Encountered error(s) syncing data flows from CSV, see logs above for more info. `)),this.process.exit(1))}export{s as uploadDataFlowsFromCsv};
2
- //# sourceMappingURL=impl-Ay6JeH-7.mjs.map
1
+ import{N as e}from"./codecs-8T8Jhxsr.mjs";import{t}from"./readCsv-DNcJ_UfU.mjs";import{n}from"./mapConsentCsvRowsToInputs-CkLfxaIf.mjs";import{t as r}from"./done-input-validation-LiTaCEzF.mjs";import i from"colors";import{buildTranscendGraphQLClient as a,syncDataFlows as o}from"@transcend-io/sdk";async function s({auth:s,trackerStatus:c,file:l,classifyService:u,transcendUrl:d}){r(this.process),this.logger.info(i.magenta(`Reading "${l}" from disk`));let f=n(t(this.fs.readFileSync(l,`utf8`),e),c);await o(a(d,s),f,{classifyService:u,logger:this.logger})||(this.logger.error(i.red(`Encountered error(s) syncing data flows from CSV, see logs above for more info. `)),this.process.exit(1))}export{s as uploadDataFlowsFromCsv};
2
+ //# sourceMappingURL=impl-kuuX5KaC.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-Ay6JeH-7.mjs","names":[],"sources":["../src/commands/consent/upload-data-flows-from-csv/impl.ts"],"sourcesContent":["import { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, syncDataFlows } from '@transcend-io/sdk';\nimport colors from 'colors';\n\nimport { DataFlowCsvInput } from '../../../codecs.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { mapDataFlowCsvRowsToInputs } from '../../../lib/consent-manager/mapConsentCsvRowsToInputs.js';\nimport { parseCsv } from '../../../lib/requests/readCsv.js';\n\nexport interface UploadDataFlowsFromCsvCommandFlags {\n auth: string;\n trackerStatus: ConsentTrackerStatus;\n file: string;\n classifyService: boolean;\n transcendUrl: string;\n}\n\nexport async function uploadDataFlowsFromCsv(\n this: LocalContext,\n { auth, trackerStatus, file, classifyService, transcendUrl }: UploadDataFlowsFromCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n this.logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const dataFlowRows = parseCsv(this.fs.readFileSync(file, 'utf8'), DataFlowCsvInput);\n const dataFlowInputs = mapDataFlowCsvRowsToInputs(dataFlowRows, trackerStatus);\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const syncedDataFlows = await syncDataFlows(client, dataFlowInputs, {\n classifyService,\n logger: this.logger,\n });\n\n if (!syncedDataFlows) {\n this.logger.error(\n colors.red(\n 'Encountered error(s) syncing data flows from CSV, see logs above for more info. ',\n ),\n );\n this.process.exit(1);\n }\n}\n"],"mappings":"0SAkBA,eAAsB,EAEpB,CAAE,OAAM,gBAAe,OAAM,kBAAiB,gBAC/B,CACf,EAAoB,KAAK,QAAQ,CAEjC,KAAK,OAAO,KAAK,EAAO,QAAQ,YAAY,EAAK,aAAa,CAAC,CAE/D,IAAM,EAAiB,EADF,EAAS,KAAK,GAAG,aAAa,EAAM,OAAO,CAAE,EACJ,CAAE,EAAc,CAOzE,MALyB,EADf,EAA4B,EAAc,EACP,CAAE,EAAgB,CAClE,kBACA,OAAQ,KAAK,OACd,CAAC,GAGA,KAAK,OAAO,MACV,EAAO,IACL,mFACD,CACF,CACD,KAAK,QAAQ,KAAK,EAAE"}
1
+ {"version":3,"file":"impl-kuuX5KaC.mjs","names":[],"sources":["../src/commands/consent/upload-data-flows-from-csv/impl.ts"],"sourcesContent":["import { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, syncDataFlows } from '@transcend-io/sdk';\nimport colors from 'colors';\n\nimport { DataFlowCsvInput } from '../../../codecs.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { mapDataFlowCsvRowsToInputs } from '../../../lib/consent-manager/mapConsentCsvRowsToInputs.js';\nimport { parseCsv } from '../../../lib/requests/readCsv.js';\n\nexport interface UploadDataFlowsFromCsvCommandFlags {\n auth: string;\n trackerStatus: ConsentTrackerStatus;\n file: string;\n classifyService: boolean;\n transcendUrl: string;\n}\n\nexport async function uploadDataFlowsFromCsv(\n this: LocalContext,\n { auth, trackerStatus, file, classifyService, transcendUrl }: UploadDataFlowsFromCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n this.logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const dataFlowRows = parseCsv(this.fs.readFileSync(file, 'utf8'), DataFlowCsvInput);\n const dataFlowInputs = mapDataFlowCsvRowsToInputs(dataFlowRows, trackerStatus);\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const syncedDataFlows = await syncDataFlows(client, dataFlowInputs, {\n classifyService,\n logger: this.logger,\n });\n\n if (!syncedDataFlows) {\n this.logger.error(\n colors.red(\n 'Encountered error(s) syncing data flows from CSV, see logs above for more info. ',\n ),\n );\n this.process.exit(1);\n }\n}\n"],"mappings":"0SAkBA,eAAsB,EAEpB,CAAE,OAAM,gBAAe,OAAM,kBAAiB,gBAC/B,CACf,EAAoB,KAAK,QAAQ,CAEjC,KAAK,OAAO,KAAK,EAAO,QAAQ,YAAY,EAAK,aAAa,CAAC,CAE/D,IAAM,EAAiB,EADF,EAAS,KAAK,GAAG,aAAa,EAAM,OAAO,CAAE,EACJ,CAAE,EAAc,CAOzE,MALyB,EADf,EAA4B,EAAc,EACP,CAAE,EAAgB,CAClE,kBACA,OAAQ,KAAK,OACd,CAAC,GAGA,KAAK,OAAO,MACV,EAAO,IACL,mFACD,CACF,CACD,KAAK,QAAQ,KAAK,EAAE"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./bulkRetryEnrichers-BgDd4GWH.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";async function n({auth:n,enricherId:r,actions:i,requestEnricherStatuses:a,requestIds:o,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u,concurrency:d,transcendUrl:f}){t(this.process),await e({auth:n,enricherId:r,requestActions:i,requestEnricherStatuses:a,requestIds:o,createdAtBefore:s?new Date(s):void 0,createdAtAfter:c?new Date(c):void 0,updatedAtBefore:l?new Date(l):void 0,updatedAtAfter:u?new Date(u):void 0,concurrency:d,transcendUrl:f})}export{n as enricherRestart};
2
- //# sourceMappingURL=impl-xY_5o78i.mjs.map
1
+ import{t as e}from"./bulkRetryEnrichers-J8CHMy_1.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";async function n({auth:n,enricherId:r,actions:i,requestEnricherStatuses:a,requestIds:o,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u,concurrency:d,transcendUrl:f}){t(this.process),await e({auth:n,enricherId:r,requestActions:i,requestEnricherStatuses:a,requestIds:o,createdAtBefore:s?new Date(s):void 0,createdAtAfter:c?new Date(c):void 0,updatedAtBefore:l?new Date(l):void 0,updatedAtAfter:u?new Date(u):void 0,concurrency:d,transcendUrl:f})}export{n as enricherRestart};
2
+ //# sourceMappingURL=impl-mBJWy3lg.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-xY_5o78i.mjs","names":[],"sources":["../src/commands/request/enricher-restart/impl.ts"],"sourcesContent":["import type { RequestAction, RequestEnricherStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { bulkRetryEnrichers } from '../../../lib/requests/index.js';\n\nexport interface EnricherRestartCommandFlags {\n auth: string;\n enricherId: string;\n actions?: RequestAction[];\n requestEnricherStatuses?: RequestEnricherStatus[];\n transcendUrl: string;\n concurrency: number;\n requestIds?: string[];\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n}\n\nexport async function enricherRestart(\n this: LocalContext,\n {\n auth,\n enricherId,\n actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n transcendUrl,\n }: EnricherRestartCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await bulkRetryEnrichers({\n auth,\n enricherId,\n requestActions: actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore: createdAtBefore ? new Date(createdAtBefore) : undefined,\n createdAtAfter: createdAtAfter ? new Date(createdAtAfter) : undefined,\n updatedAtBefore: updatedAtBefore ? new Date(updatedAtBefore) : undefined,\n updatedAtAfter: updatedAtAfter ? new Date(updatedAtAfter) : undefined,\n concurrency,\n transcendUrl,\n });\n}\n"],"mappings":"0GAoBA,eAAsB,EAEpB,CACE,OACA,aACA,UACA,0BACA,aACA,kBACA,iBACA,kBACA,iBACA,cACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAmB,CACvB,OACA,aACA,eAAgB,EAChB,0BACA,aACA,gBAAiB,EAAkB,IAAI,KAAK,EAAgB,CAAG,IAAA,GAC/D,eAAgB,EAAiB,IAAI,KAAK,EAAe,CAAG,IAAA,GAC5D,gBAAiB,EAAkB,IAAI,KAAK,EAAgB,CAAG,IAAA,GAC/D,eAAgB,EAAiB,IAAI,KAAK,EAAe,CAAG,IAAA,GAC5D,cACA,eACD,CAAC"}
1
+ {"version":3,"file":"impl-mBJWy3lg.mjs","names":[],"sources":["../src/commands/request/enricher-restart/impl.ts"],"sourcesContent":["import type { RequestAction, RequestEnricherStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { bulkRetryEnrichers } from '../../../lib/requests/index.js';\n\nexport interface EnricherRestartCommandFlags {\n auth: string;\n enricherId: string;\n actions?: RequestAction[];\n requestEnricherStatuses?: RequestEnricherStatus[];\n transcendUrl: string;\n concurrency: number;\n requestIds?: string[];\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n}\n\nexport async function enricherRestart(\n this: LocalContext,\n {\n auth,\n enricherId,\n actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n transcendUrl,\n }: EnricherRestartCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await bulkRetryEnrichers({\n auth,\n enricherId,\n requestActions: actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore: createdAtBefore ? new Date(createdAtBefore) : undefined,\n createdAtAfter: createdAtAfter ? new Date(createdAtAfter) : undefined,\n updatedAtBefore: updatedAtBefore ? new Date(updatedAtBefore) : undefined,\n updatedAtAfter: updatedAtAfter ? new Date(updatedAtAfter) : undefined,\n concurrency,\n transcendUrl,\n });\n}\n"],"mappings":"0GAoBA,eAAsB,EAEpB,CACE,OACA,aACA,UACA,0BACA,aACA,kBACA,iBACA,kBACA,iBACA,cACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAmB,CACvB,OACA,aACA,eAAgB,EAChB,0BACA,aACA,gBAAiB,EAAkB,IAAI,KAAK,EAAgB,CAAG,IAAA,GAC/D,eAAgB,EAAiB,IAAI,KAAK,EAAe,CAAG,IAAA,GAC5D,gBAAiB,EAAkB,IAAI,KAAK,EAAgB,CAAG,IAAA,GAC/D,eAAgB,EAAiB,IAAI,KAAK,EAAe,CAAG,IAAA,GAC5D,cACA,eACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./downloadPrivacyRequestFiles-C9-xSCpt.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";import{RequestStatus as n}from"@transcend-io/privacy-types";async function r({auth:r,transcendUrl:i,folderPath:a,requestIds:o,statuses:s=[n.Approving,n.Downloadable],concurrency:c,createdAtBefore:l,createdAtAfter:u,updatedAtBefore:d,updatedAtAfter:f,approveAfterDownload:p}){t(this.process),await e({transcendUrl:i,auth:r,folderPath:a,requestIds:o,statuses:s,concurrency:c,createdAtBefore:l,createdAtAfter:u,updatedAtBefore:d,updatedAtAfter:f,approveAfterDownload:p})}export{r as downloadFiles};
2
- //# sourceMappingURL=impl-ojAnhhbi.mjs.map
1
+ import{t as e}from"./downloadPrivacyRequestFiles-CF_QjkR9.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";import{RequestStatus as n}from"@transcend-io/privacy-types";async function r({auth:r,transcendUrl:i,folderPath:a,requestIds:o,statuses:s=[n.Approving,n.Downloadable],concurrency:c,createdAtBefore:l,createdAtAfter:u,updatedAtBefore:d,updatedAtAfter:f,approveAfterDownload:p}){t(this.process),await e({transcendUrl:i,auth:r,folderPath:a,requestIds:o,statuses:s,concurrency:c,createdAtBefore:l,createdAtAfter:u,updatedAtBefore:d,updatedAtAfter:f,approveAfterDownload:p})}export{r as downloadFiles};
2
+ //# sourceMappingURL=impl-nWslO7Lu.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-ojAnhhbi.mjs","names":[],"sources":["../src/commands/request/download-files/impl.ts"],"sourcesContent":["import { RequestStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { downloadPrivacyRequestFiles } from '../../../lib/requests/index.js';\n\nexport interface DownloadFilesCommandFlags {\n auth: string;\n sombraAuth?: string;\n concurrency: number;\n requestIds?: string[];\n statuses?: RequestStatus[];\n folderPath: string;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n approveAfterDownload: boolean;\n transcendUrl: string;\n}\n\nexport async function downloadFiles(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n folderPath,\n requestIds,\n statuses = [RequestStatus.Approving, RequestStatus.Downloadable],\n concurrency,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n approveAfterDownload,\n }: DownloadFilesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await downloadPrivacyRequestFiles({\n transcendUrl,\n auth,\n folderPath,\n requestIds,\n statuses,\n concurrency,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n approveAfterDownload,\n });\n}\n"],"mappings":"+KAqBA,eAAsB,EAEpB,CACE,OACA,eACA,aACA,aACA,WAAW,CAAC,EAAc,UAAW,EAAc,aAAa,CAChE,cACA,kBACA,iBACA,kBACA,iBACA,wBAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAA4B,CAChC,eACA,OACA,aACA,aACA,WACA,cACA,kBACA,iBACA,kBACA,iBACA,uBACD,CAAC"}
1
+ {"version":3,"file":"impl-nWslO7Lu.mjs","names":[],"sources":["../src/commands/request/download-files/impl.ts"],"sourcesContent":["import { RequestStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { downloadPrivacyRequestFiles } from '../../../lib/requests/index.js';\n\nexport interface DownloadFilesCommandFlags {\n auth: string;\n sombraAuth?: string;\n concurrency: number;\n requestIds?: string[];\n statuses?: RequestStatus[];\n folderPath: string;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n approveAfterDownload: boolean;\n transcendUrl: string;\n}\n\nexport async function downloadFiles(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n folderPath,\n requestIds,\n statuses = [RequestStatus.Approving, RequestStatus.Downloadable],\n concurrency,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n approveAfterDownload,\n }: DownloadFilesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await downloadPrivacyRequestFiles({\n transcendUrl,\n auth,\n folderPath,\n requestIds,\n statuses,\n concurrency,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n approveAfterDownload,\n });\n}\n"],"mappings":"+KAqBA,eAAsB,EAEpB,CACE,OACA,eACA,aACA,aACA,WAAW,CAAC,EAAc,UAAW,EAAc,aAAa,CAChE,cACA,kBACA,iBACA,kBACA,iBACA,wBAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAA4B,CAChC,eACA,OACA,aACA,aACA,WACA,cACA,kBACA,iBACA,kBACA,iBACA,uBACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{D as e}from"./codecs-CfcaFoZR.mjs";import{t}from"./readCsv-DNcJ_UfU.mjs";import{t as n}from"./mapConsentCsvRowsToInputs-CkLfxaIf.mjs";import{t as r}from"./done-input-validation-LiTaCEzF.mjs";import i from"colors";import{buildTranscendGraphQLClient as a,syncCookies as o}from"@transcend-io/sdk";async function s({auth:s,trackerStatus:c,file:l,transcendUrl:u}){r(this.process),this.logger.info(i.magenta(`Reading "${l}" from disk`));let d=n(t(this.fs.readFileSync(l,`utf8`),e),c);await o(a(u,s),d,{logger:this.logger})||(this.logger.error(i.red(`Encountered error(s) syncing cookies from CSV, see logs above for more info. `)),this.process.exit(1))}export{s as uploadCookiesFromCsv};
2
- //# sourceMappingURL=impl-ApZGIx6l.mjs.map
1
+ import{D as e}from"./codecs-8T8Jhxsr.mjs";import{t}from"./readCsv-DNcJ_UfU.mjs";import{t as n}from"./mapConsentCsvRowsToInputs-CkLfxaIf.mjs";import{t as r}from"./done-input-validation-LiTaCEzF.mjs";import i from"colors";import{buildTranscendGraphQLClient as a,syncCookies as o}from"@transcend-io/sdk";async function s({auth:s,trackerStatus:c,file:l,transcendUrl:u}){r(this.process),this.logger.info(i.magenta(`Reading "${l}" from disk`));let d=n(t(this.fs.readFileSync(l,`utf8`),e),c);await o(a(u,s),d,{logger:this.logger})||(this.logger.error(i.red(`Encountered error(s) syncing cookies from CSV, see logs above for more info. `)),this.process.exit(1))}export{s as uploadCookiesFromCsv};
2
+ //# sourceMappingURL=impl-o66EB2o7.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-ApZGIx6l.mjs","names":[],"sources":["../src/commands/consent/upload-cookies-from-csv/impl.ts"],"sourcesContent":["import { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, syncCookies } from '@transcend-io/sdk';\nimport colors from 'colors';\n\nimport { CookieCsvInput } from '../../../codecs.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { mapCookieCsvRowsToInputs } from '../../../lib/consent-manager/mapConsentCsvRowsToInputs.js';\nimport { parseCsv } from '../../../lib/requests/readCsv.js';\n\nexport interface UploadCookiesFromCsvCommandFlags {\n auth: string;\n trackerStatus: ConsentTrackerStatus;\n file: string;\n transcendUrl: string;\n}\n\nexport async function uploadCookiesFromCsv(\n this: LocalContext,\n { auth, trackerStatus, file, transcendUrl }: UploadCookiesFromCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n this.logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const cookieRows = parseCsv(this.fs.readFileSync(file, 'utf8'), CookieCsvInput);\n const cookieInputs = mapCookieCsvRowsToInputs(cookieRows, trackerStatus);\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const syncedCookies = await syncCookies(client, cookieInputs, { logger: this.logger });\n\n if (!syncedCookies) {\n this.logger.error(\n colors.red('Encountered error(s) syncing cookies from CSV, see logs above for more info. '),\n );\n this.process.exit(1);\n }\n}\n"],"mappings":"6SAiBA,eAAsB,EAEpB,CAAE,OAAM,gBAAe,OAAM,gBACd,CACf,EAAoB,KAAK,QAAQ,CAEjC,KAAK,OAAO,KAAK,EAAO,QAAQ,YAAY,EAAK,aAAa,CAAC,CAE/D,IAAM,EAAe,EADF,EAAS,KAAK,GAAG,aAAa,EAAM,OAAO,CAAE,EACR,CAAE,EAAc,CAInE,MAFuB,EADb,EAA4B,EAAc,EACX,CAAE,EAAc,CAAE,OAAQ,KAAK,OAAQ,CAAC,GAGpF,KAAK,OAAO,MACV,EAAO,IAAI,gFAAgF,CAC5F,CACD,KAAK,QAAQ,KAAK,EAAE"}
1
+ {"version":3,"file":"impl-o66EB2o7.mjs","names":[],"sources":["../src/commands/consent/upload-cookies-from-csv/impl.ts"],"sourcesContent":["import { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, syncCookies } from '@transcend-io/sdk';\nimport colors from 'colors';\n\nimport { CookieCsvInput } from '../../../codecs.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { mapCookieCsvRowsToInputs } from '../../../lib/consent-manager/mapConsentCsvRowsToInputs.js';\nimport { parseCsv } from '../../../lib/requests/readCsv.js';\n\nexport interface UploadCookiesFromCsvCommandFlags {\n auth: string;\n trackerStatus: ConsentTrackerStatus;\n file: string;\n transcendUrl: string;\n}\n\nexport async function uploadCookiesFromCsv(\n this: LocalContext,\n { auth, trackerStatus, file, transcendUrl }: UploadCookiesFromCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n this.logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const cookieRows = parseCsv(this.fs.readFileSync(file, 'utf8'), CookieCsvInput);\n const cookieInputs = mapCookieCsvRowsToInputs(cookieRows, trackerStatus);\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const syncedCookies = await syncCookies(client, cookieInputs, { logger: this.logger });\n\n if (!syncedCookies) {\n this.logger.error(\n colors.red('Encountered error(s) syncing cookies from CSV, see logs above for more info. '),\n );\n this.process.exit(1);\n }\n}\n"],"mappings":"6SAiBA,eAAsB,EAEpB,CAAE,OAAM,gBAAe,OAAM,gBACd,CACf,EAAoB,KAAK,QAAQ,CAEjC,KAAK,OAAO,KAAK,EAAO,QAAQ,YAAY,EAAK,aAAa,CAAC,CAE/D,IAAM,EAAe,EADF,EAAS,KAAK,GAAG,aAAa,EAAM,OAAO,CAAE,EACR,CAAE,EAAc,CAInE,MAFuB,EADb,EAA4B,EAAc,EACX,CAAE,EAAc,CAAE,OAAQ,KAAK,OAAQ,CAAC,GAGpF,KAAK,OAAO,MACV,EAAO,IAAI,gFAAgF,CAC5F,CACD,KAAK,QAAQ,KAAK,EAAE"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./approvePrivacyRequests-CY6rQT4J.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";async function n({auth:n,actions:r,origins:i,silentModeBefore:a,createdAtBefore:o,createdAtAfter:s,updatedAtBefore:c,updatedAtAfter:l,transcendUrl:u,concurrency:d}){t(this.process),await e({transcendUrl:u,requestActions:r,auth:n,requestOrigins:i,concurrency:d,silentModeBefore:a,createdAtBefore:o,createdAtAfter:s,updatedAtBefore:c,updatedAtAfter:l})}export{n as approve};
2
- //# sourceMappingURL=impl-BCKUj-ko.mjs.map
1
+ import{t as e}from"./approvePrivacyRequests-DyLb38gV.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";async function n({auth:n,actions:r,origins:i,silentModeBefore:a,createdAtBefore:o,createdAtAfter:s,updatedAtBefore:c,updatedAtAfter:l,transcendUrl:u,concurrency:d}){t(this.process),await e({transcendUrl:u,requestActions:r,auth:n,requestOrigins:i,concurrency:d,silentModeBefore:a,createdAtBefore:o,createdAtAfter:s,updatedAtBefore:c,updatedAtAfter:l})}export{n as approve};
2
+ //# sourceMappingURL=impl-pqCx3OlD.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-BCKUj-ko.mjs","names":[],"sources":["../src/commands/request/approve/impl.ts"],"sourcesContent":["import { RequestAction, RequestOrigin } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { approvePrivacyRequests } from '../../../lib/requests/index.js';\n\nexport interface ApproveCommandFlags {\n auth: string;\n actions: RequestAction[];\n origins?: RequestOrigin[];\n silentModeBefore?: Date;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function approve(\n this: LocalContext,\n {\n auth,\n actions,\n origins,\n silentModeBefore,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n transcendUrl,\n concurrency,\n }: ApproveCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await approvePrivacyRequests({\n transcendUrl,\n requestActions: actions,\n auth,\n requestOrigins: origins,\n concurrency,\n silentModeBefore,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n });\n}\n"],"mappings":"8GAmBA,eAAsB,EAEpB,CACE,OACA,UACA,UACA,mBACA,kBACA,iBACA,kBACA,iBACA,eACA,eAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAuB,CAC3B,eACA,eAAgB,EAChB,OACA,eAAgB,EAChB,cACA,mBACA,kBACA,iBACA,kBACA,iBACD,CAAC"}
1
+ {"version":3,"file":"impl-pqCx3OlD.mjs","names":[],"sources":["../src/commands/request/approve/impl.ts"],"sourcesContent":["import { RequestAction, RequestOrigin } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { approvePrivacyRequests } from '../../../lib/requests/index.js';\n\nexport interface ApproveCommandFlags {\n auth: string;\n actions: RequestAction[];\n origins?: RequestOrigin[];\n silentModeBefore?: Date;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function approve(\n this: LocalContext,\n {\n auth,\n actions,\n origins,\n silentModeBefore,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n transcendUrl,\n concurrency,\n }: ApproveCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await approvePrivacyRequests({\n transcendUrl,\n requestActions: actions,\n auth,\n requestOrigins: origins,\n concurrency,\n silentModeBefore,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n });\n}\n"],"mappings":"8GAmBA,eAAsB,EAEpB,CACE,OACA,UACA,UACA,mBACA,kBACA,iBACA,kBACA,iBACA,eACA,eAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAuB,CAC3B,eACA,eAAgB,EAChB,OACA,eAAgB,EAChB,cACA,mBACA,kBACA,iBACA,kBACA,iBACD,CAAC"}
@@ -1,3 +1,3 @@
1
- import{i as e}from"./paths-J5KScOaQ.mjs";import{o as t,s as n}from"./project-discovery-CWRjlFnC.mjs";import{a as r}from"./readTranscendYaml-BfqQbPiT.mjs";import{t as i}from"./parseVariablesFromString-6TYW65LF.mjs";import{t as a}from"./done-input-validation-LiTaCEzF.mjs";import{t as o}from"./missing-manifest-D8y1VL4p.mjs";import{a as s,i as c,l,t as u}from"./project-discovery-BkHpTXDx.mjs";import{n as d,r as f,t as p}from"./prompts-BhXfYD6g.mjs";import{t as m}from"./run-captured-process-BjaSDWXG.mjs";import{r as h,t as g}from"./deno-runtime-CB2HBach.mjs";import{t as _}from"./module-graph-CAT8_JCG.mjs";import{t as v}from"./project-plan-apply-Bg_1eMX9.mjs";import{dirname as y,extname as b,join as x,relative as S,resolve as C,sep as w}from"node:path";import T from"colors";import{createTwoFilesPatch as E}from"diff";import{DSR_DATAPOINT_CUSTOM_FUNCTION_PAYLOAD_SCHEMA as D,DSR_REQUEST_ENRICHER_CUSTOM_FUNCTION_PAYLOAD_SCHEMA as O,GENERAL_CUSTOM_FUNCTION_PAYLOAD_SCHEMA as k}from"@transcend-io/custom-function-types";import A from"ajv";import{parse as j}from"jsonc-parser";function M(e,t){e.push({severity:`error`,...t})}function N(e,t){return S(e,t).split(w).join(`/`)||`.`}function P(e){let t=t=>e.type===`DSR`?t===`REQUEST_ENRICHER`?`dsr-enricher`:`dsr-datapoint`:`general`;return e[`test-payload`]?[{entry:e,path:e[`test-payload`],type:t(e[`test-payload-type`])}]:(e[`test-payloads`]??[]).map(n=>({entry:e,path:n.payload,type:t(n[`payload-type`])}))}function F(e,t){let n=P(e).map(({type:e})=>e),r=e.type===`DSR`&&n.length===0;return{entry:e,path:C(t,e.code),needsDefault:e.type!==`DSR`||n.includes(`dsr-datapoint`),needsEnricher:n.includes(`dsr-enricher`),needsAnyDsrExport:r}}function I(){let e=new A({allErrors:!0,strict:!1});return{general:e.compile(k),"dsr-datapoint":e.compile(D),"dsr-enricher":e.compile(O)}}function L(e){return`${e.instancePath||`/`} ${e.message??`is invalid`}`}function R(e,t,r,i){let a=I(),o=[],s=[];return r.forEach(r=>{if(/<<parameters\.[^>]+>>/u.test(r.code))M(i,{code:`manifest.unresolved-code-path`,message:`Code paths cannot contain unresolved parameter placeholders.`,path:r.code,functionName:r.name});else if(c(r.code)){let a=F(r,t);e.fs.existsSync(a.path)?n(e,t,a.path)?e.fs.statSync(a.path).isFile()?o.push(a):M(i,{code:`source.not-file`,message:`Referenced source path is not a regular file.`,path:r.code,functionName:r.name}):M(i,{code:`source.outside-project`,message:`Referenced source resolves outside the manifest directory through a symlink.`,path:r.code,functionName:r.name}):M(i,{code:`source.missing`,message:`Referenced source file does not exist.`,path:r.code,functionName:r.name})}P(r).forEach(o=>{if(/<<parameters\.[^>]+>>/u.test(o.path)){M(i,{code:`manifest.unresolved-payload-path`,message:`Payload paths cannot contain unresolved parameter placeholders.`,path:o.path,functionName:r.name});return}let c=C(t,o.path);if(!e.fs.existsSync(c)){M(i,{code:`payload.missing`,message:`Referenced test payload does not exist.`,path:o.path,functionName:r.name});return}if(!n(e,t,c)){M(i,{code:`payload.outside-project`,message:`Referenced test payload resolves outside the manifest directory through a symlink.`,path:o.path,functionName:r.name});return}if(!e.fs.statSync(c).isFile()){M(i,{code:`payload.not-file`,message:`Referenced test payload is not a regular file.`,path:o.path,functionName:r.name});return}s.push(c);let l;try{l=JSON.parse(e.fs.readFileSync(c,`utf8`))}catch(e){M(i,{code:`payload.invalid-json`,message:`Invalid JSON: ${e.message}`,path:o.path,functionName:r.name});return}let u=a[o.type];u(l)||(u.errors??[]).forEach(e=>M(i,{code:`payload.schema`,message:L(e),path:o.path,functionName:r.name}))})}),{sources:o,payloadPaths:[...new Set(s)]}}function z(e){try{let t=JSON.parse(e),n=Array.isArray(t)?t:t&&typeof t==`object`&&Array.isArray(t.nodes)?t.nodes:void 0;return n?new Set(n.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e.name;return typeof t==`string`?[t]:[]})):new Set}catch{return new Set}}function B(e){switch(b(e)){case`.ts`:case`.tsx`:return`ts`;case`.json`:case`.jsonc`:return`json`;case`.yaml`:case`.yml`:return`yaml`;default:return`ts`}}function V(e,n,r){if(!r)return;let i=j(e.fs.readFileSync(r,`utf8`));if(typeof i?.importMap==`string`){if(/^[a-z][a-z\d+.-]*:/iu.test(i.importMap))return i.importMap;let a=C(y(r),i.importMap);return t(e,n,a),a}let a={};if(i.imports!==void 0&&(a.imports=i.imports),i.scopes!==void 0&&(a.scopes=i.scopes),Object.keys(a).length!==0)return`data:application/json,${encodeURIComponent(JSON.stringify(a))}`}async function H(e,n,r,i,a){let o=[],s=[];for(let c of a){t(e,r,c);let a=e.fs.readFileSync(c,`utf8`),l=await n(`deno`,[`fmt`,...i,`--ext=${B(c)}`,`-`],{cwd:r,input:a},e);if(l.code!==0)throw Error(`Deno could not preview formatting for ${N(r,c)}.${l.stderr.trim()?`\n${l.stderr.trim()}`:``}`);if(l.stdout!==a){let t=N(r,c);o.push(E(t,t,a,l.stdout,``,``,{context:3})),s.push({kind:`file`,path:c,before:a,after:l.stdout,description:`Format ${t}`,mode:e.fs.statSync(c).mode})}}return{patch:o.join(`
1
+ import{i as e}from"./paths-J5KScOaQ.mjs";import{o as t,s as n}from"./project-discovery-CWRjlFnC.mjs";import{a as r}from"./readTranscendYaml-D576bvzR.mjs";import{t as i}from"./parseVariablesFromString-6TYW65LF.mjs";import{t as a}from"./done-input-validation-LiTaCEzF.mjs";import{t as o}from"./missing-manifest-D8y1VL4p.mjs";import{a as s,i as c,l,t as u}from"./project-discovery-g29vd44a.mjs";import{n as d,r as f,t as p}from"./prompts-BhXfYD6g.mjs";import{t as m}from"./run-captured-process-BjaSDWXG.mjs";import{r as h,t as g}from"./deno-runtime-CB2HBach.mjs";import{t as _}from"./module-graph-CAT8_JCG.mjs";import{t as v}from"./project-plan-apply-Bg_1eMX9.mjs";import{dirname as y,extname as b,join as x,relative as S,resolve as C,sep as w}from"node:path";import T from"colors";import{createTwoFilesPatch as E}from"diff";import{DSR_DATAPOINT_CUSTOM_FUNCTION_PAYLOAD_SCHEMA as D,DSR_REQUEST_ENRICHER_CUSTOM_FUNCTION_PAYLOAD_SCHEMA as O,GENERAL_CUSTOM_FUNCTION_PAYLOAD_SCHEMA as k}from"@transcend-io/custom-function-types";import A from"ajv";import{parse as j}from"jsonc-parser";function M(e,t){e.push({severity:`error`,...t})}function N(e,t){return S(e,t).split(w).join(`/`)||`.`}function P(e){let t=t=>e.type===`DSR`?t===`REQUEST_ENRICHER`?`dsr-enricher`:`dsr-datapoint`:`general`;return e[`test-payload`]?[{entry:e,path:e[`test-payload`],type:t(e[`test-payload-type`])}]:(e[`test-payloads`]??[]).map(n=>({entry:e,path:n.payload,type:t(n[`payload-type`])}))}function F(e,t){let n=P(e).map(({type:e})=>e),r=e.type===`DSR`&&n.length===0;return{entry:e,path:C(t,e.code),needsDefault:e.type!==`DSR`||n.includes(`dsr-datapoint`),needsEnricher:n.includes(`dsr-enricher`),needsAnyDsrExport:r}}function I(){let e=new A({allErrors:!0,strict:!1});return{general:e.compile(k),"dsr-datapoint":e.compile(D),"dsr-enricher":e.compile(O)}}function L(e){return`${e.instancePath||`/`} ${e.message??`is invalid`}`}function R(e,t,r,i){let a=I(),o=[],s=[];return r.forEach(r=>{if(/<<parameters\.[^>]+>>/u.test(r.code))M(i,{code:`manifest.unresolved-code-path`,message:`Code paths cannot contain unresolved parameter placeholders.`,path:r.code,functionName:r.name});else if(c(r.code)){let a=F(r,t);e.fs.existsSync(a.path)?n(e,t,a.path)?e.fs.statSync(a.path).isFile()?o.push(a):M(i,{code:`source.not-file`,message:`Referenced source path is not a regular file.`,path:r.code,functionName:r.name}):M(i,{code:`source.outside-project`,message:`Referenced source resolves outside the manifest directory through a symlink.`,path:r.code,functionName:r.name}):M(i,{code:`source.missing`,message:`Referenced source file does not exist.`,path:r.code,functionName:r.name})}P(r).forEach(o=>{if(/<<parameters\.[^>]+>>/u.test(o.path)){M(i,{code:`manifest.unresolved-payload-path`,message:`Payload paths cannot contain unresolved parameter placeholders.`,path:o.path,functionName:r.name});return}let c=C(t,o.path);if(!e.fs.existsSync(c)){M(i,{code:`payload.missing`,message:`Referenced test payload does not exist.`,path:o.path,functionName:r.name});return}if(!n(e,t,c)){M(i,{code:`payload.outside-project`,message:`Referenced test payload resolves outside the manifest directory through a symlink.`,path:o.path,functionName:r.name});return}if(!e.fs.statSync(c).isFile()){M(i,{code:`payload.not-file`,message:`Referenced test payload is not a regular file.`,path:o.path,functionName:r.name});return}s.push(c);let l;try{l=JSON.parse(e.fs.readFileSync(c,`utf8`))}catch(e){M(i,{code:`payload.invalid-json`,message:`Invalid JSON: ${e.message}`,path:o.path,functionName:r.name});return}let u=a[o.type];u(l)||(u.errors??[]).forEach(e=>M(i,{code:`payload.schema`,message:L(e),path:o.path,functionName:r.name}))})}),{sources:o,payloadPaths:[...new Set(s)]}}function z(e){try{let t=JSON.parse(e),n=Array.isArray(t)?t:t&&typeof t==`object`&&Array.isArray(t.nodes)?t.nodes:void 0;return n?new Set(n.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e.name;return typeof t==`string`?[t]:[]})):new Set}catch{return new Set}}function B(e){switch(b(e)){case`.ts`:case`.tsx`:return`ts`;case`.json`:case`.jsonc`:return`json`;case`.yaml`:case`.yml`:return`yaml`;default:return`ts`}}function V(e,n,r){if(!r)return;let i=j(e.fs.readFileSync(r,`utf8`));if(typeof i?.importMap==`string`){if(/^[a-z][a-z\d+.-]*:/iu.test(i.importMap))return i.importMap;let a=C(y(r),i.importMap);return t(e,n,a),a}let a={};if(i.imports!==void 0&&(a.imports=i.imports),i.scopes!==void 0&&(a.scopes=i.scopes),Object.keys(a).length!==0)return`data:application/json,${encodeURIComponent(JSON.stringify(a))}`}async function H(e,n,r,i,a){let o=[],s=[];for(let c of a){t(e,r,c);let a=e.fs.readFileSync(c,`utf8`),l=await n(`deno`,[`fmt`,...i,`--ext=${B(c)}`,`-`],{cwd:r,input:a},e);if(l.code!==0)throw Error(`Deno could not preview formatting for ${N(r,c)}.${l.stderr.trim()?`\n${l.stderr.trim()}`:``}`);if(l.stdout!==a){let t=N(r,c);o.push(E(t,t,a,l.stdout,``,``,{context:3})),s.push({kind:`file`,path:c,before:a,after:l.stdout,description:`Format ${t}`,mode:e.fs.statSync(c).mode})}}return{patch:o.join(`
2
2
  `),changes:s}}function U(e,t,n,r){M(e,{code:t,message:`${n}${r.stderr.trim()?`\n${r.stderr.trim()}`:``}`})}async function W(e,i,a=m){let o=C(i.manifestPath),c=y(o),u=[],d=new Map([[`manifest`,`passed`],[`files`,`passed`],[`payloads`,`passed`],[`runtime`,`passed`],[`exports`,`passed`],[`typecheck`,`passed`],[`lint`,`passed`],[`format`,`passed`]]),f=()=>({version:1,status:u.some(({severity:e})=>e===`error`)?`failed`:`passed`,manifestPath:o,checks:[...d].map(([e,t])=>({name:e,status:t})),diagnostics:u});if(!e.fs.existsSync(o))return M(u,{code:`manifest.missing`,message:`Custom Function manifest does not exist.`,path:N(e.process.cwd(),o)}),d.set(`manifest`,`failed`),[`files`,`payloads`,`runtime`,`exports`,`typecheck`,`lint`,`format`].forEach(e=>d.set(e,`skipped`)),f();let p=[];try{p=s(r(e.fs.readFileSync(o,`utf8`),i.variables??{})).functions}catch(e){return M(u,{code:`manifest.invalid`,message:e.message,path:N(c,o)}),d.set(`manifest`,`failed`),[`files`,`payloads`,`runtime`,`exports`,`typecheck`,`lint`,`format`].forEach(e=>d.set(e,`skipped`)),f()}p.forEach(e=>{try{l({...e.env?{env:e.env}:{},...e[`allowed-hosts`]?{allowedHosts:e[`allowed-hosts`]}:{}})}catch(t){d.set(`manifest`,`failed`),M(u,{code:`manifest.execution-context`,message:t.message,path:N(c,o),functionName:e.name})}});let{sources:b,payloadPaths:S}=R(e,c,p,u);u.some(({code:e})=>[`source.`,`manifest.unresolved-code-path`].some(t=>e.startsWith(t)))&&(d.set(`files`,`failed`),[`exports`,`typecheck`,`lint`].forEach(e=>d.set(e,`failed`))),u.some(({code:e})=>[`payload.`,`manifest.unresolved-payload-path`].some(t=>e.startsWith(t)))&&d.set(`payloads`,`failed`);let w=x(c,`deno.jsonc`),T=x(c,`deno.json`),E=e.fs.existsSync(w)?w:e.fs.existsSync(T)?T:void 0,D=E!==void 0&&!n(e,c,E),O=D,k;if(D)M(u,{code:`deno.config-outside-project`,message:`Deno configuration resolves outside the manifest directory through a symlink.`,path:N(c,E)}),[`exports`,`typecheck`,`lint`,`format`].forEach(e=>d.set(e,`failed`));else try{k=V(e,c,E)}catch(e){O=!0,M(u,{code:`deno.import-map-outside-project`,message:e.message}),[`exports`,`typecheck`,`lint`,`format`].forEach(e=>d.set(e,`failed`))}let A=E&&!O?[`--config=${E}`]:[`--no-config`],j=()=>{[`exports`,`typecheck`,`lint`,`format`].forEach(e=>{d.get(e)!==`failed`&&d.set(e,`skipped`)})},P=await a(`deno`,[`--version`],{cwd:c},e),F=P.code===0?h(P.stdout):void 0;if(F?.level===`warning`&&u.push({code:`deno.version-mismatch`,severity:`warning`,message:F.message}),P.error?.code===`ENOENT`)d.set(`runtime`,`failed`),j(),M(u,{code:`deno.missing`,message:`Deno 2.x is required for export, type, lint, and format checks. Install it from ${g}`});else if(P.code!==0)d.set(`runtime`,`failed`),j(),U(u,`deno.unavailable`,`Deno could not be started.`,P);else if(F?.level===`error`)d.set(`runtime`,`failed`),j(),M(u,{code:`deno.unsupported-version`,message:F.message});else if(!O){for(let t of b){let n=await a(`deno`,[`info`,`--json`,...A,t.path],{cwd:c},e);if(n.code!==0)d.set(`files`,`failed`),U(u,`source.module-graph`,`Could not inspect runtime imports for ${N(c,t.path)}.`,n);else try{let e=_(n.stdout);e.length>0&&(d.set(`files`,`failed`),M(u,{code:`source.local-runtime-import`,message:`Custom Functions must be self-contained. Local or import-map runtime dependencies are not deployed: `+e.join(`, `),path:N(c,t.path),functionName:t.entry.name}))}catch(e){d.set(`files`,`failed`),M(u,{code:`source.module-graph`,message:e.message,path:N(c,t.path),functionName:t.entry.name})}let r=await a(`deno`,[`doc`,`--json`,...k?[`--import-map`,k]:[],t.path],{cwd:c},e);if(r.code!==0){d.set(`exports`,`failed`),U(u,`exports.inspect`,`Could not inspect exports for ${N(c,t.path)}.`,r);continue}let i=z(r.stdout);t.needsDefault&&!i.has(`default`)&&(d.set(`exports`,`failed`),M(u,{code:`exports.default-missing`,message:`The manifest fixtures require a default export.`,path:N(c,t.path),functionName:t.entry.name})),t.needsEnricher&&!i.has(`enricher`)&&(d.set(`exports`,`failed`),M(u,{code:`exports.enricher-missing`,message:"A REQUEST_ENRICHER fixture requires an `enricher` export.",path:N(c,t.path),functionName:t.entry.name})),t.needsAnyDsrExport&&!i.has(`default`)&&!i.has(`enricher`)&&(d.set(`exports`,`failed`),M(u,{code:`exports.dsr-missing`,message:"A DSR Custom Function requires a `default` or `enricher` export.",path:N(c,t.path),functionName:t.entry.name}))}let n=[...new Set(b.map(({path:e})=>e))];if(n.length>0){let t=await a(`deno`,[`check`,...A,...n],{cwd:c},e);t.code!==0&&(d.set(`typecheck`,`failed`),U(u,`deno.typecheck`,`Deno type checking failed.`,t));let r=await a(`deno`,[`lint`,...A,...n],{cwd:c},e);r.code!==0&&(d.set(`lint`,`failed`),U(u,`deno.lint`,`Deno linting failed.`,r))}let r=[...n,...S,o,...E?[E]:[],...k&&k!==E&&!/^[a-z][a-z\d+.-]*:/iu.test(k)?[k]:[]];r.forEach(n=>t(e,c,n));let s=await a(`deno`,[`fmt`,`--check`,...A,...r],{cwd:c},e);if(s.code!==0){let t;try{t=await H(e,a,c,A,r)}catch(e){return d.set(`format`,`failed`),M(u,{code:`deno.format-preview`,message:e.message}),f()}if(t.changes.length===0)return d.set(`format`,`failed`),U(u,`deno.format`,`Deno reported a formatting failure but did not produce a repair.`,s),f();if(i.fix||i.confirmFormat&&await i.confirmFormat(t.patch))try{await v(e,{rootDirectory:c,changes:t.changes})}catch(e){d.set(`format`,`failed`),M(u,{code:`deno.format-fix`,message:`Could not apply formatting transaction: ${e.message}`})}else d.set(`format`,`failed`),t.changes.forEach((e,n)=>{M(u,{code:`deno.format`,message:`Referenced file is not formatted.`+(n===0&&i.includeFormatPatchInDiagnostics&&t.patch?`\n${t.patch}`:``),path:N(c,e.path)})})}}return f()}async function G(t,n){a(this.process);let{manifestPath:r}=e(this.process.cwd(),{...n?{directory:n}:{},...t.manifest?{manifest:t.manifest}:{}}),s=this.fs.existsSync(r)?void 0:o({cwd:this.process.cwd(),manifestPath:r,discoveredManifestPaths:u(this,this.process.cwd()),command:`check`}),c=f(t,this.process.stdin.isTTY,this.process.stderr.isTTY),l=new d(this);try{let e=await W(this,{manifestPath:r,variables:i(t.variables),fix:t.fix,includeFormatPatchInDiagnostics:!t.json,...c&&!t.fix?{confirmFormat:async e=>(e&&this.logger.error(e),l.confirm(`Format the files shown above?`,!0))}:{}});s&&e.diagnostics.forEach(e=>{e.code===`manifest.missing`&&(e.message=s)}),t.json?this.process.stdout.write(`${JSON.stringify(e)}\n`):(this.logger.info(`${T.bold(`Custom Function checks`)}\n`),e.checks.forEach(({name:e,status:t})=>{let n=t===`passed`?`PASS`:t===`failed`?`FAIL`:`SKIP`,r=t===`passed`?T.green(n):t===`failed`?T.red(n):T.yellow(n);this.logger.info(`${r} ${e[0].toUpperCase()}${e.slice(1)}`)}),e.diagnostics.length>0&&this.logger.error(``),e.diagnostics.forEach(e=>{let t=e.path?`${e.path}: `:``,n=e.functionName?`[${e.functionName}] `:``,r=`${e.severity}: ${t}${n}${e.message}`;e.severity===`warning`?this.logger.warn(T.yellow(r)):this.logger.error(T.red(r))}),e.status===`passed`?(this.logger.info(``),this.logger.info(T.green(`Custom Function checks passed.`))):(this.logger.error(``),this.logger.error(T.red(`Custom Function checks failed.`)))),e.status===`failed`&&(this.process.exitCode=1)}catch(e){throw e instanceof p&&this.process.exit(130),e}}export{G as check};
3
- //# sourceMappingURL=impl-BpVe6fMe.mjs.map
3
+ //# sourceMappingURL=impl-yxR3rwGm.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-BpVe6fMe.mjs","names":["parseJsonc"],"sources":["../src/commands/custom-functions/check/helpers.ts","../src/commands/custom-functions/check/impl.ts"],"sourcesContent":["import { dirname, extname, join, relative, resolve, sep } from 'node:path';\n\nimport {\n DSR_DATAPOINT_CUSTOM_FUNCTION_PAYLOAD_SCHEMA,\n DSR_REQUEST_ENRICHER_CUSTOM_FUNCTION_PAYLOAD_SCHEMA,\n GENERAL_CUSTOM_FUNCTION_PAYLOAD_SCHEMA,\n} from '@transcend-io/custom-function-types';\nimport Ajv, { type ErrorObject, type ValidateFunction } from 'ajv';\nimport { createTwoFilesPatch } from 'diff';\nimport { parse as parseJsonc } from 'jsonc-parser';\n\nimport type { LocalContext } from '../../../context.js';\nimport {\n runCapturedProcess,\n type CapturedProcessResult,\n type CapturedProcessRunner,\n} from '../../../lib/cli/run-captured-process.js';\nimport {\n type CustomFunctionCheckResult,\n type CustomFunctionCheckStatus,\n type CustomFunctionDiagnostic,\n} from '../../../lib/custom-functions/check-model.js';\nimport {\n DENO_INSTALL_URL,\n getDenoRuntimeCompatibility,\n SUPPORTED_DENO_MAJOR_VERSION,\n} from '../../../lib/custom-functions/deno-runtime.js';\nimport { validateCustomFunctionExecutionContext } from '../../../lib/custom-functions/execution-context.js';\nimport {\n isCustomFunctionManifestPathContained,\n parseCustomFunctionsManifest,\n type CustomFunctionManifestEntry,\n} from '../../../lib/custom-functions/manifest.js';\nimport { findNonSelfContainedRuntimeImports } from '../../../lib/custom-functions/module-graph.js';\nimport { CUSTOM_FUNCTION_RESULT_VERSION } from '../../../lib/custom-functions/scaffold-model.js';\nimport { replaceVariablesInYaml } from '../../../lib/readTranscendYaml.js';\nimport {\n assertPathPhysicallyContained,\n isPathPhysicallyContained,\n} from '../../../lib/scaffolding/path-safety.js';\nimport { applyProjectPlan } from '../../../lib/scaffolding/project-plan-apply.js';\nimport type { PlannedFileChange } from '../../../lib/scaffolding/project-plan.js';\n\n/** Payload file plus its validation contract. */\ninterface PayloadReference {\n /** Manifest entry. */\n entry: CustomFunctionManifestEntry;\n /** Manifest-relative payload path. */\n path: string;\n /** Schema variant. */\n type: 'general' | 'dsr-datapoint' | 'dsr-enricher';\n}\n\n/** Source file plus exports required by fixtures. */\ninterface SourceReference {\n /** Manifest entry. */\n entry: CustomFunctionManifestEntry;\n /** Absolute source path. */\n path: string;\n /** Whether a default export is required. */\n needsDefault: boolean;\n /** Whether an enricher export is required. */\n needsEnricher: boolean;\n /** Whether either DSR export is acceptable when no fixtures identify one. */\n needsAnyDsrExport: boolean;\n}\n\n/** Options for local validation. */\nexport interface RunCustomFunctionChecksOptions {\n /** Absolute manifest path. */\n manifestPath: string;\n /** Variables used to resolve manifest placeholders. */\n variables?: Record<string, string>;\n /** Apply Deno formatting. */\n fix: boolean;\n /** Ask for an interactive formatting repair after receiving a patch. */\n confirmFormat?: (patch: string) => Promise<boolean>;\n /** Include a unified format patch in human-oriented diagnostics. */\n includeFormatPatchInDiagnostics?: boolean;\n}\n\n/**\n * Add one diagnostic.\n *\n * @param diagnostics - Result collection\n * @param diagnostic - Diagnostic without severity\n */\nfunction addError(\n diagnostics: CustomFunctionDiagnostic[],\n diagnostic: Omit<CustomFunctionDiagnostic, 'severity'>,\n): void {\n diagnostics.push({ severity: 'error', ...diagnostic });\n}\n\n/**\n * Normalize an absolute path relative to the manifest.\n *\n * @param manifestDirectory - Manifest directory\n * @param path - Absolute path\n * @returns Portable display path\n */\nfunction relativePath(manifestDirectory: string, path: string): string {\n const value = relative(manifestDirectory, path).split(sep).join('/');\n return value || '.';\n}\n\n/**\n * Select all payload files and schema variants.\n *\n * @param entry - Manifest entry\n * @returns Payload references\n */\nfunction payloadReferences(entry: CustomFunctionManifestEntry): PayloadReference[] {\n const variant = (\n payloadType: 'DATA_POINT' | 'REQUEST_ENRICHER' | undefined,\n ): PayloadReference['type'] => {\n if (entry.type !== 'DSR') {\n return 'general';\n }\n return payloadType === 'REQUEST_ENRICHER' ? 'dsr-enricher' : 'dsr-datapoint';\n };\n if (entry['test-payload']) {\n return [\n {\n entry,\n path: entry['test-payload'],\n type: variant(entry['test-payload-type']),\n },\n ];\n }\n return (entry['test-payloads'] ?? []).map((item) => ({\n entry,\n path: item.payload,\n type: variant(item['payload-type']),\n }));\n}\n\n/**\n * Select export expectations from the registered fixtures.\n *\n * @param entry - Manifest entry\n * @param manifestDirectory - Manifest directory\n * @returns Source reference\n */\nfunction sourceReference(\n entry: CustomFunctionManifestEntry,\n manifestDirectory: string,\n): SourceReference {\n const payloadTypes = payloadReferences(entry).map(({ type }) => type);\n const dsrWithoutPayloads = entry.type === 'DSR' && payloadTypes.length === 0;\n return {\n entry,\n path: resolve(manifestDirectory, entry.code),\n needsDefault: entry.type !== 'DSR' || payloadTypes.includes('dsr-datapoint'),\n needsEnricher: payloadTypes.includes('dsr-enricher'),\n needsAnyDsrExport: dsrWithoutPayloads,\n };\n}\n\n/**\n * Compile published payload schemas.\n *\n * @returns Validators by local variant\n */\nfunction buildPayloadValidators(): Record<PayloadReference['type'], ValidateFunction> {\n const ajv = new Ajv({ allErrors: true, strict: false });\n return {\n general: ajv.compile(GENERAL_CUSTOM_FUNCTION_PAYLOAD_SCHEMA),\n 'dsr-datapoint': ajv.compile(DSR_DATAPOINT_CUSTOM_FUNCTION_PAYLOAD_SCHEMA),\n 'dsr-enricher': ajv.compile(DSR_REQUEST_ENRICHER_CUSTOM_FUNCTION_PAYLOAD_SCHEMA),\n };\n}\n\n/**\n * Format one Ajv failure.\n *\n * @param error - Ajv error\n * @returns Concise path and message\n */\nfunction formatSchemaError(error: ErrorObject): string {\n return `${error.instancePath || '/'} ${error.message ?? 'is invalid'}`;\n}\n\n/**\n * Validate referenced source and payload files without invoking Deno.\n *\n * @param context - CLI context\n * @param manifestDirectory - Manifest directory\n * @param entries - Parsed manifest entries\n * @param diagnostics - Result collection\n * @returns Existing source and format paths\n */\nfunction validateReferencedFiles(\n context: LocalContext,\n manifestDirectory: string,\n entries: readonly CustomFunctionManifestEntry[],\n diagnostics: CustomFunctionDiagnostic[],\n): {\n /** Existing source references. */\n sources: SourceReference[];\n /** Existing payload paths. */\n payloadPaths: string[];\n} {\n const validators = buildPayloadValidators();\n const sources: SourceReference[] = [];\n const payloadPaths: string[] = [];\n entries.forEach((entry) => {\n if (/<<parameters\\.[^>]+>>/u.test(entry.code)) {\n addError(diagnostics, {\n code: 'manifest.unresolved-code-path',\n message: 'Code paths cannot contain unresolved parameter placeholders.',\n path: entry.code,\n functionName: entry.name,\n });\n } else if (isCustomFunctionManifestPathContained(entry.code)) {\n const source = sourceReference(entry, manifestDirectory);\n if (!context.fs.existsSync(source.path)) {\n addError(diagnostics, {\n code: 'source.missing',\n message: 'Referenced source file does not exist.',\n path: entry.code,\n functionName: entry.name,\n });\n } else if (!isPathPhysicallyContained(context, manifestDirectory, source.path)) {\n addError(diagnostics, {\n code: 'source.outside-project',\n message: 'Referenced source resolves outside the manifest directory through a symlink.',\n path: entry.code,\n functionName: entry.name,\n });\n } else if (!context.fs.statSync(source.path).isFile()) {\n addError(diagnostics, {\n code: 'source.not-file',\n message: 'Referenced source path is not a regular file.',\n path: entry.code,\n functionName: entry.name,\n });\n } else {\n sources.push(source);\n }\n }\n\n payloadReferences(entry).forEach((reference) => {\n if (/<<parameters\\.[^>]+>>/u.test(reference.path)) {\n addError(diagnostics, {\n code: 'manifest.unresolved-payload-path',\n message: 'Payload paths cannot contain unresolved parameter placeholders.',\n path: reference.path,\n functionName: entry.name,\n });\n return;\n }\n const payloadPath = resolve(manifestDirectory, reference.path);\n if (!context.fs.existsSync(payloadPath)) {\n addError(diagnostics, {\n code: 'payload.missing',\n message: 'Referenced test payload does not exist.',\n path: reference.path,\n functionName: entry.name,\n });\n return;\n }\n if (!isPathPhysicallyContained(context, manifestDirectory, payloadPath)) {\n addError(diagnostics, {\n code: 'payload.outside-project',\n message:\n 'Referenced test payload resolves outside the manifest directory through a symlink.',\n path: reference.path,\n functionName: entry.name,\n });\n return;\n }\n if (!context.fs.statSync(payloadPath).isFile()) {\n addError(diagnostics, {\n code: 'payload.not-file',\n message: 'Referenced test payload is not a regular file.',\n path: reference.path,\n functionName: entry.name,\n });\n return;\n }\n payloadPaths.push(payloadPath);\n let payload: unknown;\n try {\n payload = JSON.parse(context.fs.readFileSync(payloadPath, 'utf8'));\n } catch (error) {\n addError(diagnostics, {\n code: 'payload.invalid-json',\n message: `Invalid JSON: ${(error as Error).message}`,\n path: reference.path,\n functionName: entry.name,\n });\n return;\n }\n const validate = validators[reference.type];\n if (!validate(payload)) {\n (validate.errors ?? []).forEach((error) =>\n addError(diagnostics, {\n code: 'payload.schema',\n message: formatSchemaError(error),\n path: reference.path,\n functionName: entry.name,\n }),\n );\n }\n });\n });\n return {\n sources,\n payloadPaths: [...new Set(payloadPaths)],\n };\n}\n\n/**\n * Read Deno's JSON documentation output for exported names.\n *\n * @param output - `deno doc --json` output\n * @returns Exported names\n */\nfunction exportedNames(output: string): Set<string> {\n try {\n const document = JSON.parse(output) as unknown;\n const nodes = Array.isArray(document)\n ? document\n : document &&\n typeof document === 'object' &&\n Array.isArray((document as Record<string, unknown>).nodes)\n ? ((document as Record<string, unknown>).nodes as unknown[])\n : undefined;\n if (!nodes) {\n return new Set();\n }\n return new Set(\n nodes.flatMap((node) => {\n if (!node || typeof node !== 'object') {\n return [];\n }\n const name = (node as Record<string, unknown>).name;\n return typeof name === 'string' ? [name] : [];\n }),\n );\n } catch {\n return new Set();\n }\n}\n\n/**\n * Choose the Deno formatter extension for stdin.\n *\n * @param path - Source path\n * @returns Deno extension\n */\nfunction denoExtension(path: string): string {\n switch (extname(path)) {\n case '.ts':\n case '.tsx':\n return 'ts';\n case '.json':\n case '.jsonc':\n return 'json';\n case '.yaml':\n case '.yml':\n return 'yaml';\n default:\n return 'ts';\n }\n}\n\n/**\n * Resolve the import-map input supported by `deno doc`.\n *\n * Deno 2.4 does not expose `--config` for `doc`. A full `deno.json` is not a\n * valid import map when it also has `tasks`, `lint`, `fmt`, or\n * `compilerOptions`, so inline `imports` / `scopes` are passed as a data URL.\n * An `importMap` reference is followed explicitly.\n *\n * @param context - CLI context\n * @param manifestDirectory - Approved project root\n * @param configPath - Selected Deno config\n * @returns Import map path or URL\n */\nfunction resolveDocImportMap(\n context: LocalContext,\n manifestDirectory: string,\n configPath: string | undefined,\n): string | undefined {\n if (!configPath) {\n return undefined;\n }\n const config = parseJsonc(context.fs.readFileSync(configPath, 'utf8')) as {\n /** Optional separate import map. */\n importMap?: unknown;\n /** Inline import map entries. */\n imports?: unknown;\n /** Inline import map scopes. */\n scopes?: unknown;\n };\n if (typeof config?.importMap === 'string') {\n if (/^[a-z][a-z\\d+.-]*:/iu.test(config.importMap)) {\n return config.importMap;\n }\n const importMapPath = resolve(dirname(configPath), config.importMap);\n assertPathPhysicallyContained(context, manifestDirectory, importMapPath);\n return importMapPath;\n }\n const importMap: {\n /** Bare-specifier remappings. */\n imports?: unknown;\n /** Scoped remappings. */\n scopes?: unknown;\n } = {};\n if (config.imports !== undefined) {\n importMap.imports = config.imports;\n }\n if (config.scopes !== undefined) {\n importMap.scopes = config.scopes;\n }\n if (Object.keys(importMap).length === 0) {\n return undefined;\n }\n return `data:application/json,${encodeURIComponent(JSON.stringify(importMap))}`;\n}\n\n/**\n * Render deterministic formatter patches without changing files.\n *\n * @param context - CLI context\n * @param runner - Process runner\n * @param manifestDirectory - Working directory\n * @param configArgs - Deno config arguments\n * @param paths - Target files\n * @returns Unified patches and transactional file changes\n */\nasync function buildFormatPlan(\n context: LocalContext,\n runner: CapturedProcessRunner,\n manifestDirectory: string,\n configArgs: readonly string[],\n paths: readonly string[],\n): Promise<{ patch: string; changes: PlannedFileChange[] }> {\n const patches: string[] = [];\n const changes: PlannedFileChange[] = [];\n for (const path of paths) {\n assertPathPhysicallyContained(context, manifestDirectory, path);\n const before = context.fs.readFileSync(path, 'utf8');\n const result = await runner(\n 'deno',\n ['fmt', ...configArgs, `--ext=${denoExtension(path)}`, '-'],\n { cwd: manifestDirectory, input: before },\n context,\n );\n if (result.code !== 0) {\n throw new Error(\n `Deno could not preview formatting for ${relativePath(manifestDirectory, path)}.${\n result.stderr.trim() ? `\\n${result.stderr.trim()}` : ''\n }`,\n );\n }\n if (result.stdout !== before) {\n const display = relativePath(manifestDirectory, path);\n patches.push(\n createTwoFilesPatch(display, display, before, result.stdout, '', '', { context: 3 }),\n );\n changes.push({\n kind: 'file',\n path,\n before,\n after: result.stdout,\n description: `Format ${display}`,\n mode: context.fs.statSync(path).mode,\n });\n }\n }\n return { patch: patches.join('\\n'), changes };\n}\n\n/**\n * Record one Deno command failure.\n *\n * @param diagnostics - Result collection\n * @param code - Stable code\n * @param message - Summary\n * @param result - Captured process result\n */\nfunction recordDenoFailure(\n diagnostics: CustomFunctionDiagnostic[],\n code: string,\n message: string,\n result: CapturedProcessResult,\n): void {\n addError(diagnostics, {\n code,\n message: `${message}${result.stderr.trim() ? `\\n${result.stderr.trim()}` : ''}`,\n });\n}\n\n/**\n * Run credential-free local validation without executing user modules.\n *\n * @param context - CLI context\n * @param options - Manifest and format behavior\n * @param runner - Captured process runner\n * @returns Stable check result\n */\nexport async function runCustomFunctionChecks(\n context: LocalContext,\n options: RunCustomFunctionChecksOptions,\n runner: CapturedProcessRunner = runCapturedProcess,\n): Promise<CustomFunctionCheckResult> {\n const manifestPath = resolve(options.manifestPath);\n const manifestDirectory = dirname(manifestPath);\n const diagnostics: CustomFunctionDiagnostic[] = [];\n const statuses = new Map<string, CustomFunctionCheckStatus>([\n ['manifest', 'passed'],\n ['files', 'passed'],\n ['payloads', 'passed'],\n ['runtime', 'passed'],\n ['exports', 'passed'],\n ['typecheck', 'passed'],\n ['lint', 'passed'],\n ['format', 'passed'],\n ]);\n const buildResult = (): CustomFunctionCheckResult => ({\n version: CUSTOM_FUNCTION_RESULT_VERSION,\n status: diagnostics.some(({ severity }) => severity === 'error') ? 'failed' : 'passed',\n manifestPath,\n checks: [...statuses].map(([name, status]) => ({ name, status })),\n diagnostics,\n });\n if (!context.fs.existsSync(manifestPath)) {\n addError(diagnostics, {\n code: 'manifest.missing',\n message: 'Custom Function manifest does not exist.',\n path: relativePath(context.process.cwd(), manifestPath),\n });\n statuses.set('manifest', 'failed');\n ['files', 'payloads', 'runtime', 'exports', 'typecheck', 'lint', 'format'].forEach((name) =>\n statuses.set(name, 'skipped'),\n );\n return buildResult();\n }\n\n let entries: readonly CustomFunctionManifestEntry[] = [];\n try {\n const manifestContents = replaceVariablesInYaml(\n context.fs.readFileSync(manifestPath, 'utf8'),\n options.variables ?? {},\n );\n entries = parseCustomFunctionsManifest(manifestContents).functions;\n } catch (error) {\n addError(diagnostics, {\n code: 'manifest.invalid',\n message: (error as Error).message,\n path: relativePath(manifestDirectory, manifestPath),\n });\n statuses.set('manifest', 'failed');\n ['files', 'payloads', 'runtime', 'exports', 'typecheck', 'lint', 'format'].forEach((name) =>\n statuses.set(name, 'skipped'),\n );\n return buildResult();\n }\n entries.forEach((entry) => {\n try {\n validateCustomFunctionExecutionContext({\n ...(entry.env ? { env: entry.env } : {}),\n ...(entry['allowed-hosts'] ? { allowedHosts: entry['allowed-hosts'] } : {}),\n });\n } catch (error) {\n statuses.set('manifest', 'failed');\n addError(diagnostics, {\n code: 'manifest.execution-context',\n message: (error as Error).message,\n path: relativePath(manifestDirectory, manifestPath),\n functionName: entry.name,\n });\n }\n });\n\n const { sources, payloadPaths } = validateReferencedFiles(\n context,\n manifestDirectory,\n entries,\n diagnostics,\n );\n if (\n diagnostics.some(({ code }) =>\n ['source.', 'manifest.unresolved-code-path'].some((prefix) => code.startsWith(prefix)),\n )\n ) {\n statuses.set('files', 'failed');\n ['exports', 'typecheck', 'lint'].forEach((name) => statuses.set(name, 'failed'));\n }\n if (\n diagnostics.some(({ code }) =>\n ['payload.', 'manifest.unresolved-payload-path'].some((prefix) => code.startsWith(prefix)),\n )\n ) {\n statuses.set('payloads', 'failed');\n }\n\n const denoJsonc = join(manifestDirectory, 'deno.jsonc');\n const denoJson = join(manifestDirectory, 'deno.json');\n const configPath = context.fs.existsSync(denoJsonc)\n ? denoJsonc\n : context.fs.existsSync(denoJson)\n ? denoJson\n : undefined;\n const unsafeConfig =\n configPath !== undefined && !isPathPhysicallyContained(context, manifestDirectory, configPath);\n let unsafeConfiguration = unsafeConfig;\n let docImportMap: string | undefined;\n if (unsafeConfig) {\n addError(diagnostics, {\n code: 'deno.config-outside-project',\n message: 'Deno configuration resolves outside the manifest directory through a symlink.',\n path: relativePath(manifestDirectory, configPath),\n });\n ['exports', 'typecheck', 'lint', 'format'].forEach((name) => statuses.set(name, 'failed'));\n } else {\n try {\n docImportMap = resolveDocImportMap(context, manifestDirectory, configPath);\n } catch (error) {\n unsafeConfiguration = true;\n addError(diagnostics, {\n code: 'deno.import-map-outside-project',\n message: (error as Error).message,\n });\n ['exports', 'typecheck', 'lint', 'format'].forEach((name) => statuses.set(name, 'failed'));\n }\n }\n const configArgs =\n configPath && !unsafeConfiguration ? [`--config=${configPath}`] : ['--no-config'];\n const skipPendingDenoChecks = (): void => {\n ['exports', 'typecheck', 'lint', 'format'].forEach((name) => {\n if (statuses.get(name) !== 'failed') {\n statuses.set(name, 'skipped');\n }\n });\n };\n const denoVersion = await runner('deno', ['--version'], { cwd: manifestDirectory }, context);\n const compatibility =\n denoVersion.code === 0 ? getDenoRuntimeCompatibility(denoVersion.stdout) : undefined;\n if (compatibility?.level === 'warning') {\n diagnostics.push({\n code: 'deno.version-mismatch',\n severity: 'warning',\n message: compatibility.message,\n });\n }\n if (denoVersion.error?.code === 'ENOENT') {\n statuses.set('runtime', 'failed');\n skipPendingDenoChecks();\n addError(diagnostics, {\n code: 'deno.missing',\n message: `Deno ${SUPPORTED_DENO_MAJOR_VERSION}.x is required for export, type, lint, and format checks. Install it from ${DENO_INSTALL_URL}`,\n });\n } else if (denoVersion.code !== 0) {\n statuses.set('runtime', 'failed');\n skipPendingDenoChecks();\n recordDenoFailure(diagnostics, 'deno.unavailable', 'Deno could not be started.', denoVersion);\n } else if (compatibility?.level === 'error') {\n statuses.set('runtime', 'failed');\n skipPendingDenoChecks();\n addError(diagnostics, {\n code: 'deno.unsupported-version',\n message: compatibility.message,\n });\n } else if (!unsafeConfiguration) {\n for (const source of sources) {\n const moduleGraph = await runner(\n 'deno',\n ['info', '--json', ...configArgs, source.path],\n { cwd: manifestDirectory },\n context,\n );\n if (moduleGraph.code !== 0) {\n statuses.set('files', 'failed');\n recordDenoFailure(\n diagnostics,\n 'source.module-graph',\n `Could not inspect runtime imports for ${relativePath(manifestDirectory, source.path)}.`,\n moduleGraph,\n );\n } else {\n try {\n const unsupportedImports = findNonSelfContainedRuntimeImports(moduleGraph.stdout);\n if (unsupportedImports.length > 0) {\n statuses.set('files', 'failed');\n addError(diagnostics, {\n code: 'source.local-runtime-import',\n message:\n 'Custom Functions must be self-contained. Local or import-map runtime dependencies are not deployed: ' +\n unsupportedImports.join(', '),\n path: relativePath(manifestDirectory, source.path),\n functionName: source.entry.name,\n });\n }\n } catch (error) {\n statuses.set('files', 'failed');\n addError(diagnostics, {\n code: 'source.module-graph',\n message: (error as Error).message,\n path: relativePath(manifestDirectory, source.path),\n functionName: source.entry.name,\n });\n }\n }\n const result = await runner(\n 'deno',\n ['doc', '--json', ...(docImportMap ? ['--import-map', docImportMap] : []), source.path],\n { cwd: manifestDirectory },\n context,\n );\n if (result.code !== 0) {\n statuses.set('exports', 'failed');\n recordDenoFailure(\n diagnostics,\n 'exports.inspect',\n `Could not inspect exports for ${relativePath(manifestDirectory, source.path)}.`,\n result,\n );\n continue;\n }\n const names = exportedNames(result.stdout);\n if (source.needsDefault && !names.has('default')) {\n statuses.set('exports', 'failed');\n addError(diagnostics, {\n code: 'exports.default-missing',\n message: 'The manifest fixtures require a default export.',\n path: relativePath(manifestDirectory, source.path),\n functionName: source.entry.name,\n });\n }\n if (source.needsEnricher && !names.has('enricher')) {\n statuses.set('exports', 'failed');\n addError(diagnostics, {\n code: 'exports.enricher-missing',\n message: 'A REQUEST_ENRICHER fixture requires an `enricher` export.',\n path: relativePath(manifestDirectory, source.path),\n functionName: source.entry.name,\n });\n }\n if (source.needsAnyDsrExport && !names.has('default') && !names.has('enricher')) {\n statuses.set('exports', 'failed');\n addError(diagnostics, {\n code: 'exports.dsr-missing',\n message: 'A DSR Custom Function requires a `default` or `enricher` export.',\n path: relativePath(manifestDirectory, source.path),\n functionName: source.entry.name,\n });\n }\n }\n\n const sourcePaths = [...new Set(sources.map(({ path }) => path))];\n if (sourcePaths.length > 0) {\n const typecheck = await runner(\n 'deno',\n ['check', ...configArgs, ...sourcePaths],\n { cwd: manifestDirectory },\n context,\n );\n if (typecheck.code !== 0) {\n statuses.set('typecheck', 'failed');\n recordDenoFailure(diagnostics, 'deno.typecheck', 'Deno type checking failed.', typecheck);\n }\n const lint = await runner(\n 'deno',\n ['lint', ...configArgs, ...sourcePaths],\n { cwd: manifestDirectory },\n context,\n );\n if (lint.code !== 0) {\n statuses.set('lint', 'failed');\n recordDenoFailure(diagnostics, 'deno.lint', 'Deno linting failed.', lint);\n }\n }\n\n const formatPaths = [\n ...sourcePaths,\n ...payloadPaths,\n manifestPath,\n ...(configPath ? [configPath] : []),\n ...(docImportMap && docImportMap !== configPath && !/^[a-z][a-z\\d+.-]*:/iu.test(docImportMap)\n ? [docImportMap]\n : []),\n ];\n formatPaths.forEach((path) => assertPathPhysicallyContained(context, manifestDirectory, path));\n const format = await runner(\n 'deno',\n ['fmt', '--check', ...configArgs, ...formatPaths],\n { cwd: manifestDirectory },\n context,\n );\n if (format.code !== 0) {\n let formatPlan: Awaited<ReturnType<typeof buildFormatPlan>>;\n try {\n formatPlan = await buildFormatPlan(\n context,\n runner,\n manifestDirectory,\n configArgs,\n formatPaths,\n );\n } catch (error) {\n statuses.set('format', 'failed');\n addError(diagnostics, {\n code: 'deno.format-preview',\n message: (error as Error).message,\n });\n return buildResult();\n }\n if (formatPlan.changes.length === 0) {\n statuses.set('format', 'failed');\n recordDenoFailure(\n diagnostics,\n 'deno.format',\n 'Deno reported a formatting failure but did not produce a repair.',\n format,\n );\n return buildResult();\n }\n const shouldFix =\n options.fix ||\n (options.confirmFormat ? await options.confirmFormat(formatPlan.patch) : false);\n if (shouldFix) {\n try {\n await applyProjectPlan(context, {\n rootDirectory: manifestDirectory,\n changes: formatPlan.changes,\n });\n } catch (error) {\n statuses.set('format', 'failed');\n addError(diagnostics, {\n code: 'deno.format-fix',\n message: `Could not apply formatting transaction: ${(error as Error).message}`,\n });\n }\n } else {\n statuses.set('format', 'failed');\n formatPlan.changes.forEach((change, index) => {\n addError(diagnostics, {\n code: 'deno.format',\n message:\n 'Referenced file is not formatted.' +\n (index === 0 && options.includeFormatPatchInDiagnostics && formatPlan.patch\n ? `\\n${formatPlan.patch}`\n : ''),\n path: relativePath(manifestDirectory, change.path),\n });\n });\n }\n }\n }\n\n return buildResult();\n}\n","import colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { formatMissingManifestMessage } from '../../../lib/custom-functions/missing-manifest.js';\nimport { resolveCustomFunctionProjectPaths } from '../../../lib/custom-functions/paths.js';\nimport { discoverCustomFunctionManifests } from '../../../lib/custom-functions/project-discovery.js';\nimport { parseVariablesFromString } from '../../../lib/helpers/parseVariablesFromString.js';\nimport {\n isInteractivePromptInvocation,\n PromptCancelledError,\n ScaffoldPrompts,\n} from '../../../lib/scaffolding/prompts.js';\nimport { runCustomFunctionChecks } from './helpers.js';\n\n/** CLI flags for `transcend custom-functions check`. */\nexport interface CustomFunctionsCheckFlags {\n /** Explicit manifest path. */\n manifest?: string;\n /** Manifest variable substitutions. */\n variables: string;\n /** Apply Deno formatting. */\n fix: boolean;\n /** Disable prompts. */\n noInteractive: boolean;\n /** Emit JSON on stdout. */\n json: boolean;\n}\n\n/**\n * Validate a local Custom Function project without credentials.\n *\n * @param this - CLI context\n * @param flags - Check and interaction flags\n * @param directory - Optional target directory\n */\nexport async function check(\n this: LocalContext,\n flags: CustomFunctionsCheckFlags,\n directory?: string,\n): Promise<void> {\n doneInputValidation(this.process);\n const { manifestPath } = resolveCustomFunctionProjectPaths(this.process.cwd(), {\n ...(directory ? { directory } : {}),\n ...(flags.manifest ? { manifest: flags.manifest } : {}),\n });\n const missingMessage = this.fs.existsSync(manifestPath)\n ? undefined\n : formatMissingManifestMessage({\n cwd: this.process.cwd(),\n manifestPath,\n discoveredManifestPaths: discoverCustomFunctionManifests(this, this.process.cwd()),\n command: 'check',\n });\n const interactive = isInteractivePromptInvocation(\n flags,\n this.process.stdin.isTTY,\n this.process.stderr.isTTY,\n );\n const prompts = new ScaffoldPrompts(this);\n try {\n const result = await runCustomFunctionChecks(this, {\n manifestPath,\n variables: parseVariablesFromString(flags.variables),\n fix: flags.fix,\n includeFormatPatchInDiagnostics: !flags.json,\n ...(interactive && !flags.fix\n ? {\n confirmFormat: async (patch: string): Promise<boolean> => {\n if (patch) {\n this.logger.error(patch);\n }\n return prompts.confirm('Format the files shown above?', true);\n },\n }\n : {}),\n });\n if (missingMessage) {\n result.diagnostics.forEach((diagnostic) => {\n if (diagnostic.code === 'manifest.missing') {\n diagnostic.message = missingMessage;\n }\n });\n }\n if (flags.json) {\n this.process.stdout.write(`${JSON.stringify(result)}\\n`);\n } else {\n this.logger.info(`${colors.bold('Custom Function checks')}\\n`);\n result.checks.forEach(({ name, status }) => {\n const label = status === 'passed' ? 'PASS' : status === 'failed' ? 'FAIL' : 'SKIP';\n const styledLabel =\n status === 'passed'\n ? colors.green(label)\n : status === 'failed'\n ? colors.red(label)\n : colors.yellow(label);\n this.logger.info(`${styledLabel} ${name[0]!.toUpperCase()}${name.slice(1)}`);\n });\n if (result.diagnostics.length > 0) {\n this.logger.error('');\n }\n result.diagnostics.forEach((diagnostic) => {\n const location = diagnostic.path ? `${diagnostic.path}: ` : '';\n const owner = diagnostic.functionName ? `[${diagnostic.functionName}] ` : '';\n const message = `${diagnostic.severity}: ${location}${owner}${diagnostic.message}`;\n if (diagnostic.severity === 'warning') {\n this.logger.warn(colors.yellow(message));\n } else {\n this.logger.error(colors.red(message));\n }\n });\n if (result.status === 'passed') {\n this.logger.info('');\n this.logger.info(colors.green('Custom Function checks passed.'));\n } else {\n this.logger.error('');\n this.logger.error(colors.red('Custom Function checks failed.'));\n }\n }\n if (result.status === 'failed') {\n this.process.exitCode = 1;\n }\n } catch (error) {\n if (error instanceof PromptCancelledError) {\n this.process.exit(130);\n }\n throw error;\n }\n}\n"],"mappings":"sjCAuFA,SAAS,EACP,EACA,EACM,CACN,EAAY,KAAK,CAAE,SAAU,QAAS,GAAG,EAAY,CAAC,CAUxD,SAAS,EAAa,EAA2B,EAAsB,CAErE,OADc,EAAS,EAAmB,EAAK,CAAC,MAAM,EAAI,CAAC,KAAK,IACpD,EAAI,IASlB,SAAS,EAAkB,EAAwD,CACjF,IAAM,EACJ,GAEI,EAAM,OAAS,MAGZ,IAAgB,mBAAqB,eAAiB,gBAFpD,UAaX,OATI,EAAM,gBACD,CACL,CACE,QACA,KAAM,EAAM,gBACZ,KAAM,EAAQ,EAAM,qBAAqB,CAC1C,CACF,EAEK,EAAM,kBAAoB,EAAE,EAAE,IAAK,IAAU,CACnD,QACA,KAAM,EAAK,QACX,KAAM,EAAQ,EAAK,gBAAgB,CACpC,EAAE,CAUL,SAAS,EACP,EACA,EACiB,CACjB,IAAM,EAAe,EAAkB,EAAM,CAAC,KAAK,CAAE,UAAW,EAAK,CAC/D,EAAqB,EAAM,OAAS,OAAS,EAAa,SAAW,EAC3E,MAAO,CACL,QACA,KAAM,EAAQ,EAAmB,EAAM,KAAK,CAC5C,aAAc,EAAM,OAAS,OAAS,EAAa,SAAS,gBAAgB,CAC5E,cAAe,EAAa,SAAS,eAAe,CACpD,kBAAmB,EACpB,CAQH,SAAS,GAA6E,CACpF,IAAM,EAAM,IAAI,EAAI,CAAE,UAAW,GAAM,OAAQ,GAAO,CAAC,CACvD,MAAO,CACL,QAAS,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AY,OAAS,GAC9B,KAAK,OAAO,MAAM,GAAG,CAEvB,EAAO,YAAY,QAAS,GAAe,CACzC,IAAM,EAAW,EAAW,KAAO,GAAG,EAAW,KAAK,IAAM,GACtD,EAAQ,EAAW,aAAe,IAAI,EAAW,aAAa,IAAM,GACpE,EAAU,GAAG,EAAW,SAAS,IAAI,IAAW,IAAQ,EAAW,UACrE,EAAW,WAAa,UAC1B,KAAK,OAAO,KAAK,EAAO,OAAO,EAAQ,CAAC,CAExC,KAAK,OAAO,MAAM,EAAO,IAAI,EAAQ,CAAC,EAExC,CACE,EAAO,SAAW,UACpB,KAAK,OAAO,KAAK,GAAG,CACpB,KAAK,OAAO,KAAK,EAAO,MAAM,iCAAiC,CAAC,GAEhE,KAAK,OAAO,MAAM,GAAG,CACrB,KAAK,OAAO,MAAM,EAAO,IAAI,iCAAiC,CAAC,GAG/D,EAAO,SAAW,WACpB,KAAK,QAAQ,SAAW,SAEnB,EAAO,CAId,MAHI,aAAiB,GACnB,KAAK,QAAQ,KAAK,IAAI,CAElB"}
1
+ {"version":3,"file":"impl-yxR3rwGm.mjs","names":["parseJsonc"],"sources":["../src/commands/custom-functions/check/helpers.ts","../src/commands/custom-functions/check/impl.ts"],"sourcesContent":["import { dirname, extname, join, relative, resolve, sep } from 'node:path';\n\nimport {\n DSR_DATAPOINT_CUSTOM_FUNCTION_PAYLOAD_SCHEMA,\n DSR_REQUEST_ENRICHER_CUSTOM_FUNCTION_PAYLOAD_SCHEMA,\n GENERAL_CUSTOM_FUNCTION_PAYLOAD_SCHEMA,\n} from '@transcend-io/custom-function-types';\nimport Ajv, { type ErrorObject, type ValidateFunction } from 'ajv';\nimport { createTwoFilesPatch } from 'diff';\nimport { parse as parseJsonc } from 'jsonc-parser';\n\nimport type { LocalContext } from '../../../context.js';\nimport {\n runCapturedProcess,\n type CapturedProcessResult,\n type CapturedProcessRunner,\n} from '../../../lib/cli/run-captured-process.js';\nimport {\n type CustomFunctionCheckResult,\n type CustomFunctionCheckStatus,\n type CustomFunctionDiagnostic,\n} from '../../../lib/custom-functions/check-model.js';\nimport {\n DENO_INSTALL_URL,\n getDenoRuntimeCompatibility,\n SUPPORTED_DENO_MAJOR_VERSION,\n} from '../../../lib/custom-functions/deno-runtime.js';\nimport { validateCustomFunctionExecutionContext } from '../../../lib/custom-functions/execution-context.js';\nimport {\n isCustomFunctionManifestPathContained,\n parseCustomFunctionsManifest,\n type CustomFunctionManifestEntry,\n} from '../../../lib/custom-functions/manifest.js';\nimport { findNonSelfContainedRuntimeImports } from '../../../lib/custom-functions/module-graph.js';\nimport { CUSTOM_FUNCTION_RESULT_VERSION } from '../../../lib/custom-functions/scaffold-model.js';\nimport { replaceVariablesInYaml } from '../../../lib/readTranscendYaml.js';\nimport {\n assertPathPhysicallyContained,\n isPathPhysicallyContained,\n} from '../../../lib/scaffolding/path-safety.js';\nimport { applyProjectPlan } from '../../../lib/scaffolding/project-plan-apply.js';\nimport type { PlannedFileChange } from '../../../lib/scaffolding/project-plan.js';\n\n/** Payload file plus its validation contract. */\ninterface PayloadReference {\n /** Manifest entry. */\n entry: CustomFunctionManifestEntry;\n /** Manifest-relative payload path. */\n path: string;\n /** Schema variant. */\n type: 'general' | 'dsr-datapoint' | 'dsr-enricher';\n}\n\n/** Source file plus exports required by fixtures. */\ninterface SourceReference {\n /** Manifest entry. */\n entry: CustomFunctionManifestEntry;\n /** Absolute source path. */\n path: string;\n /** Whether a default export is required. */\n needsDefault: boolean;\n /** Whether an enricher export is required. */\n needsEnricher: boolean;\n /** Whether either DSR export is acceptable when no fixtures identify one. */\n needsAnyDsrExport: boolean;\n}\n\n/** Options for local validation. */\nexport interface RunCustomFunctionChecksOptions {\n /** Absolute manifest path. */\n manifestPath: string;\n /** Variables used to resolve manifest placeholders. */\n variables?: Record<string, string>;\n /** Apply Deno formatting. */\n fix: boolean;\n /** Ask for an interactive formatting repair after receiving a patch. */\n confirmFormat?: (patch: string) => Promise<boolean>;\n /** Include a unified format patch in human-oriented diagnostics. */\n includeFormatPatchInDiagnostics?: boolean;\n}\n\n/**\n * Add one diagnostic.\n *\n * @param diagnostics - Result collection\n * @param diagnostic - Diagnostic without severity\n */\nfunction addError(\n diagnostics: CustomFunctionDiagnostic[],\n diagnostic: Omit<CustomFunctionDiagnostic, 'severity'>,\n): void {\n diagnostics.push({ severity: 'error', ...diagnostic });\n}\n\n/**\n * Normalize an absolute path relative to the manifest.\n *\n * @param manifestDirectory - Manifest directory\n * @param path - Absolute path\n * @returns Portable display path\n */\nfunction relativePath(manifestDirectory: string, path: string): string {\n const value = relative(manifestDirectory, path).split(sep).join('/');\n return value || '.';\n}\n\n/**\n * Select all payload files and schema variants.\n *\n * @param entry - Manifest entry\n * @returns Payload references\n */\nfunction payloadReferences(entry: CustomFunctionManifestEntry): PayloadReference[] {\n const variant = (\n payloadType: 'DATA_POINT' | 'REQUEST_ENRICHER' | undefined,\n ): PayloadReference['type'] => {\n if (entry.type !== 'DSR') {\n return 'general';\n }\n return payloadType === 'REQUEST_ENRICHER' ? 'dsr-enricher' : 'dsr-datapoint';\n };\n if (entry['test-payload']) {\n return [\n {\n entry,\n path: entry['test-payload'],\n type: variant(entry['test-payload-type']),\n },\n ];\n }\n return (entry['test-payloads'] ?? []).map((item) => ({\n entry,\n path: item.payload,\n type: variant(item['payload-type']),\n }));\n}\n\n/**\n * Select export expectations from the registered fixtures.\n *\n * @param entry - Manifest entry\n * @param manifestDirectory - Manifest directory\n * @returns Source reference\n */\nfunction sourceReference(\n entry: CustomFunctionManifestEntry,\n manifestDirectory: string,\n): SourceReference {\n const payloadTypes = payloadReferences(entry).map(({ type }) => type);\n const dsrWithoutPayloads = entry.type === 'DSR' && payloadTypes.length === 0;\n return {\n entry,\n path: resolve(manifestDirectory, entry.code),\n needsDefault: entry.type !== 'DSR' || payloadTypes.includes('dsr-datapoint'),\n needsEnricher: payloadTypes.includes('dsr-enricher'),\n needsAnyDsrExport: dsrWithoutPayloads,\n };\n}\n\n/**\n * Compile published payload schemas.\n *\n * @returns Validators by local variant\n */\nfunction buildPayloadValidators(): Record<PayloadReference['type'], ValidateFunction> {\n const ajv = new Ajv({ allErrors: true, strict: false });\n return {\n general: ajv.compile(GENERAL_CUSTOM_FUNCTION_PAYLOAD_SCHEMA),\n 'dsr-datapoint': ajv.compile(DSR_DATAPOINT_CUSTOM_FUNCTION_PAYLOAD_SCHEMA),\n 'dsr-enricher': ajv.compile(DSR_REQUEST_ENRICHER_CUSTOM_FUNCTION_PAYLOAD_SCHEMA),\n };\n}\n\n/**\n * Format one Ajv failure.\n *\n * @param error - Ajv error\n * @returns Concise path and message\n */\nfunction formatSchemaError(error: ErrorObject): string {\n return `${error.instancePath || '/'} ${error.message ?? 'is invalid'}`;\n}\n\n/**\n * Validate referenced source and payload files without invoking Deno.\n *\n * @param context - CLI context\n * @param manifestDirectory - Manifest directory\n * @param entries - Parsed manifest entries\n * @param diagnostics - Result collection\n * @returns Existing source and format paths\n */\nfunction validateReferencedFiles(\n context: LocalContext,\n manifestDirectory: string,\n entries: readonly CustomFunctionManifestEntry[],\n diagnostics: CustomFunctionDiagnostic[],\n): {\n /** Existing source references. */\n sources: SourceReference[];\n /** Existing payload paths. */\n payloadPaths: string[];\n} {\n const validators = buildPayloadValidators();\n const sources: SourceReference[] = [];\n const payloadPaths: string[] = [];\n entries.forEach((entry) => {\n if (/<<parameters\\.[^>]+>>/u.test(entry.code)) {\n addError(diagnostics, {\n code: 'manifest.unresolved-code-path',\n message: 'Code paths cannot contain unresolved parameter placeholders.',\n path: entry.code,\n functionName: entry.name,\n });\n } else if (isCustomFunctionManifestPathContained(entry.code)) {\n const source = sourceReference(entry, manifestDirectory);\n if (!context.fs.existsSync(source.path)) {\n addError(diagnostics, {\n code: 'source.missing',\n message: 'Referenced source file does not exist.',\n path: entry.code,\n functionName: entry.name,\n });\n } else if (!isPathPhysicallyContained(context, manifestDirectory, source.path)) {\n addError(diagnostics, {\n code: 'source.outside-project',\n message: 'Referenced source resolves outside the manifest directory through a symlink.',\n path: entry.code,\n functionName: entry.name,\n });\n } else if (!context.fs.statSync(source.path).isFile()) {\n addError(diagnostics, {\n code: 'source.not-file',\n message: 'Referenced source path is not a regular file.',\n path: entry.code,\n functionName: entry.name,\n });\n } else {\n sources.push(source);\n }\n }\n\n payloadReferences(entry).forEach((reference) => {\n if (/<<parameters\\.[^>]+>>/u.test(reference.path)) {\n addError(diagnostics, {\n code: 'manifest.unresolved-payload-path',\n message: 'Payload paths cannot contain unresolved parameter placeholders.',\n path: reference.path,\n functionName: entry.name,\n });\n return;\n }\n const payloadPath = resolve(manifestDirectory, reference.path);\n if (!context.fs.existsSync(payloadPath)) {\n addError(diagnostics, {\n code: 'payload.missing',\n message: 'Referenced test payload does not exist.',\n path: reference.path,\n functionName: entry.name,\n });\n return;\n }\n if (!isPathPhysicallyContained(context, manifestDirectory, payloadPath)) {\n addError(diagnostics, {\n code: 'payload.outside-project',\n message:\n 'Referenced test payload resolves outside the manifest directory through a symlink.',\n path: reference.path,\n functionName: entry.name,\n });\n return;\n }\n if (!context.fs.statSync(payloadPath).isFile()) {\n addError(diagnostics, {\n code: 'payload.not-file',\n message: 'Referenced test payload is not a regular file.',\n path: reference.path,\n functionName: entry.name,\n });\n return;\n }\n payloadPaths.push(payloadPath);\n let payload: unknown;\n try {\n payload = JSON.parse(context.fs.readFileSync(payloadPath, 'utf8'));\n } catch (error) {\n addError(diagnostics, {\n code: 'payload.invalid-json',\n message: `Invalid JSON: ${(error as Error).message}`,\n path: reference.path,\n functionName: entry.name,\n });\n return;\n }\n const validate = validators[reference.type];\n if (!validate(payload)) {\n (validate.errors ?? []).forEach((error) =>\n addError(diagnostics, {\n code: 'payload.schema',\n message: formatSchemaError(error),\n path: reference.path,\n functionName: entry.name,\n }),\n );\n }\n });\n });\n return {\n sources,\n payloadPaths: [...new Set(payloadPaths)],\n };\n}\n\n/**\n * Read Deno's JSON documentation output for exported names.\n *\n * @param output - `deno doc --json` output\n * @returns Exported names\n */\nfunction exportedNames(output: string): Set<string> {\n try {\n const document = JSON.parse(output) as unknown;\n const nodes = Array.isArray(document)\n ? document\n : document &&\n typeof document === 'object' &&\n Array.isArray((document as Record<string, unknown>).nodes)\n ? ((document as Record<string, unknown>).nodes as unknown[])\n : undefined;\n if (!nodes) {\n return new Set();\n }\n return new Set(\n nodes.flatMap((node) => {\n if (!node || typeof node !== 'object') {\n return [];\n }\n const name = (node as Record<string, unknown>).name;\n return typeof name === 'string' ? [name] : [];\n }),\n );\n } catch {\n return new Set();\n }\n}\n\n/**\n * Choose the Deno formatter extension for stdin.\n *\n * @param path - Source path\n * @returns Deno extension\n */\nfunction denoExtension(path: string): string {\n switch (extname(path)) {\n case '.ts':\n case '.tsx':\n return 'ts';\n case '.json':\n case '.jsonc':\n return 'json';\n case '.yaml':\n case '.yml':\n return 'yaml';\n default:\n return 'ts';\n }\n}\n\n/**\n * Resolve the import-map input supported by `deno doc`.\n *\n * Deno 2.4 does not expose `--config` for `doc`. A full `deno.json` is not a\n * valid import map when it also has `tasks`, `lint`, `fmt`, or\n * `compilerOptions`, so inline `imports` / `scopes` are passed as a data URL.\n * An `importMap` reference is followed explicitly.\n *\n * @param context - CLI context\n * @param manifestDirectory - Approved project root\n * @param configPath - Selected Deno config\n * @returns Import map path or URL\n */\nfunction resolveDocImportMap(\n context: LocalContext,\n manifestDirectory: string,\n configPath: string | undefined,\n): string | undefined {\n if (!configPath) {\n return undefined;\n }\n const config = parseJsonc(context.fs.readFileSync(configPath, 'utf8')) as {\n /** Optional separate import map. */\n importMap?: unknown;\n /** Inline import map entries. */\n imports?: unknown;\n /** Inline import map scopes. */\n scopes?: unknown;\n };\n if (typeof config?.importMap === 'string') {\n if (/^[a-z][a-z\\d+.-]*:/iu.test(config.importMap)) {\n return config.importMap;\n }\n const importMapPath = resolve(dirname(configPath), config.importMap);\n assertPathPhysicallyContained(context, manifestDirectory, importMapPath);\n return importMapPath;\n }\n const importMap: {\n /** Bare-specifier remappings. */\n imports?: unknown;\n /** Scoped remappings. */\n scopes?: unknown;\n } = {};\n if (config.imports !== undefined) {\n importMap.imports = config.imports;\n }\n if (config.scopes !== undefined) {\n importMap.scopes = config.scopes;\n }\n if (Object.keys(importMap).length === 0) {\n return undefined;\n }\n return `data:application/json,${encodeURIComponent(JSON.stringify(importMap))}`;\n}\n\n/**\n * Render deterministic formatter patches without changing files.\n *\n * @param context - CLI context\n * @param runner - Process runner\n * @param manifestDirectory - Working directory\n * @param configArgs - Deno config arguments\n * @param paths - Target files\n * @returns Unified patches and transactional file changes\n */\nasync function buildFormatPlan(\n context: LocalContext,\n runner: CapturedProcessRunner,\n manifestDirectory: string,\n configArgs: readonly string[],\n paths: readonly string[],\n): Promise<{ patch: string; changes: PlannedFileChange[] }> {\n const patches: string[] = [];\n const changes: PlannedFileChange[] = [];\n for (const path of paths) {\n assertPathPhysicallyContained(context, manifestDirectory, path);\n const before = context.fs.readFileSync(path, 'utf8');\n const result = await runner(\n 'deno',\n ['fmt', ...configArgs, `--ext=${denoExtension(path)}`, '-'],\n { cwd: manifestDirectory, input: before },\n context,\n );\n if (result.code !== 0) {\n throw new Error(\n `Deno could not preview formatting for ${relativePath(manifestDirectory, path)}.${\n result.stderr.trim() ? `\\n${result.stderr.trim()}` : ''\n }`,\n );\n }\n if (result.stdout !== before) {\n const display = relativePath(manifestDirectory, path);\n patches.push(\n createTwoFilesPatch(display, display, before, result.stdout, '', '', { context: 3 }),\n );\n changes.push({\n kind: 'file',\n path,\n before,\n after: result.stdout,\n description: `Format ${display}`,\n mode: context.fs.statSync(path).mode,\n });\n }\n }\n return { patch: patches.join('\\n'), changes };\n}\n\n/**\n * Record one Deno command failure.\n *\n * @param diagnostics - Result collection\n * @param code - Stable code\n * @param message - Summary\n * @param result - Captured process result\n */\nfunction recordDenoFailure(\n diagnostics: CustomFunctionDiagnostic[],\n code: string,\n message: string,\n result: CapturedProcessResult,\n): void {\n addError(diagnostics, {\n code,\n message: `${message}${result.stderr.trim() ? `\\n${result.stderr.trim()}` : ''}`,\n });\n}\n\n/**\n * Run credential-free local validation without executing user modules.\n *\n * @param context - CLI context\n * @param options - Manifest and format behavior\n * @param runner - Captured process runner\n * @returns Stable check result\n */\nexport async function runCustomFunctionChecks(\n context: LocalContext,\n options: RunCustomFunctionChecksOptions,\n runner: CapturedProcessRunner = runCapturedProcess,\n): Promise<CustomFunctionCheckResult> {\n const manifestPath = resolve(options.manifestPath);\n const manifestDirectory = dirname(manifestPath);\n const diagnostics: CustomFunctionDiagnostic[] = [];\n const statuses = new Map<string, CustomFunctionCheckStatus>([\n ['manifest', 'passed'],\n ['files', 'passed'],\n ['payloads', 'passed'],\n ['runtime', 'passed'],\n ['exports', 'passed'],\n ['typecheck', 'passed'],\n ['lint', 'passed'],\n ['format', 'passed'],\n ]);\n const buildResult = (): CustomFunctionCheckResult => ({\n version: CUSTOM_FUNCTION_RESULT_VERSION,\n status: diagnostics.some(({ severity }) => severity === 'error') ? 'failed' : 'passed',\n manifestPath,\n checks: [...statuses].map(([name, status]) => ({ name, status })),\n diagnostics,\n });\n if (!context.fs.existsSync(manifestPath)) {\n addError(diagnostics, {\n code: 'manifest.missing',\n message: 'Custom Function manifest does not exist.',\n path: relativePath(context.process.cwd(), manifestPath),\n });\n statuses.set('manifest', 'failed');\n ['files', 'payloads', 'runtime', 'exports', 'typecheck', 'lint', 'format'].forEach((name) =>\n statuses.set(name, 'skipped'),\n );\n return buildResult();\n }\n\n let entries: readonly CustomFunctionManifestEntry[] = [];\n try {\n const manifestContents = replaceVariablesInYaml(\n context.fs.readFileSync(manifestPath, 'utf8'),\n options.variables ?? {},\n );\n entries = parseCustomFunctionsManifest(manifestContents).functions;\n } catch (error) {\n addError(diagnostics, {\n code: 'manifest.invalid',\n message: (error as Error).message,\n path: relativePath(manifestDirectory, manifestPath),\n });\n statuses.set('manifest', 'failed');\n ['files', 'payloads', 'runtime', 'exports', 'typecheck', 'lint', 'format'].forEach((name) =>\n statuses.set(name, 'skipped'),\n );\n return buildResult();\n }\n entries.forEach((entry) => {\n try {\n validateCustomFunctionExecutionContext({\n ...(entry.env ? { env: entry.env } : {}),\n ...(entry['allowed-hosts'] ? { allowedHosts: entry['allowed-hosts'] } : {}),\n });\n } catch (error) {\n statuses.set('manifest', 'failed');\n addError(diagnostics, {\n code: 'manifest.execution-context',\n message: (error as Error).message,\n path: relativePath(manifestDirectory, manifestPath),\n functionName: entry.name,\n });\n }\n });\n\n const { sources, payloadPaths } = validateReferencedFiles(\n context,\n manifestDirectory,\n entries,\n diagnostics,\n );\n if (\n diagnostics.some(({ code }) =>\n ['source.', 'manifest.unresolved-code-path'].some((prefix) => code.startsWith(prefix)),\n )\n ) {\n statuses.set('files', 'failed');\n ['exports', 'typecheck', 'lint'].forEach((name) => statuses.set(name, 'failed'));\n }\n if (\n diagnostics.some(({ code }) =>\n ['payload.', 'manifest.unresolved-payload-path'].some((prefix) => code.startsWith(prefix)),\n )\n ) {\n statuses.set('payloads', 'failed');\n }\n\n const denoJsonc = join(manifestDirectory, 'deno.jsonc');\n const denoJson = join(manifestDirectory, 'deno.json');\n const configPath = context.fs.existsSync(denoJsonc)\n ? denoJsonc\n : context.fs.existsSync(denoJson)\n ? denoJson\n : undefined;\n const unsafeConfig =\n configPath !== undefined && !isPathPhysicallyContained(context, manifestDirectory, configPath);\n let unsafeConfiguration = unsafeConfig;\n let docImportMap: string | undefined;\n if (unsafeConfig) {\n addError(diagnostics, {\n code: 'deno.config-outside-project',\n message: 'Deno configuration resolves outside the manifest directory through a symlink.',\n path: relativePath(manifestDirectory, configPath),\n });\n ['exports', 'typecheck', 'lint', 'format'].forEach((name) => statuses.set(name, 'failed'));\n } else {\n try {\n docImportMap = resolveDocImportMap(context, manifestDirectory, configPath);\n } catch (error) {\n unsafeConfiguration = true;\n addError(diagnostics, {\n code: 'deno.import-map-outside-project',\n message: (error as Error).message,\n });\n ['exports', 'typecheck', 'lint', 'format'].forEach((name) => statuses.set(name, 'failed'));\n }\n }\n const configArgs =\n configPath && !unsafeConfiguration ? [`--config=${configPath}`] : ['--no-config'];\n const skipPendingDenoChecks = (): void => {\n ['exports', 'typecheck', 'lint', 'format'].forEach((name) => {\n if (statuses.get(name) !== 'failed') {\n statuses.set(name, 'skipped');\n }\n });\n };\n const denoVersion = await runner('deno', ['--version'], { cwd: manifestDirectory }, context);\n const compatibility =\n denoVersion.code === 0 ? getDenoRuntimeCompatibility(denoVersion.stdout) : undefined;\n if (compatibility?.level === 'warning') {\n diagnostics.push({\n code: 'deno.version-mismatch',\n severity: 'warning',\n message: compatibility.message,\n });\n }\n if (denoVersion.error?.code === 'ENOENT') {\n statuses.set('runtime', 'failed');\n skipPendingDenoChecks();\n addError(diagnostics, {\n code: 'deno.missing',\n message: `Deno ${SUPPORTED_DENO_MAJOR_VERSION}.x is required for export, type, lint, and format checks. Install it from ${DENO_INSTALL_URL}`,\n });\n } else if (denoVersion.code !== 0) {\n statuses.set('runtime', 'failed');\n skipPendingDenoChecks();\n recordDenoFailure(diagnostics, 'deno.unavailable', 'Deno could not be started.', denoVersion);\n } else if (compatibility?.level === 'error') {\n statuses.set('runtime', 'failed');\n skipPendingDenoChecks();\n addError(diagnostics, {\n code: 'deno.unsupported-version',\n message: compatibility.message,\n });\n } else if (!unsafeConfiguration) {\n for (const source of sources) {\n const moduleGraph = await runner(\n 'deno',\n ['info', '--json', ...configArgs, source.path],\n { cwd: manifestDirectory },\n context,\n );\n if (moduleGraph.code !== 0) {\n statuses.set('files', 'failed');\n recordDenoFailure(\n diagnostics,\n 'source.module-graph',\n `Could not inspect runtime imports for ${relativePath(manifestDirectory, source.path)}.`,\n moduleGraph,\n );\n } else {\n try {\n const unsupportedImports = findNonSelfContainedRuntimeImports(moduleGraph.stdout);\n if (unsupportedImports.length > 0) {\n statuses.set('files', 'failed');\n addError(diagnostics, {\n code: 'source.local-runtime-import',\n message:\n 'Custom Functions must be self-contained. Local or import-map runtime dependencies are not deployed: ' +\n unsupportedImports.join(', '),\n path: relativePath(manifestDirectory, source.path),\n functionName: source.entry.name,\n });\n }\n } catch (error) {\n statuses.set('files', 'failed');\n addError(diagnostics, {\n code: 'source.module-graph',\n message: (error as Error).message,\n path: relativePath(manifestDirectory, source.path),\n functionName: source.entry.name,\n });\n }\n }\n const result = await runner(\n 'deno',\n ['doc', '--json', ...(docImportMap ? ['--import-map', docImportMap] : []), source.path],\n { cwd: manifestDirectory },\n context,\n );\n if (result.code !== 0) {\n statuses.set('exports', 'failed');\n recordDenoFailure(\n diagnostics,\n 'exports.inspect',\n `Could not inspect exports for ${relativePath(manifestDirectory, source.path)}.`,\n result,\n );\n continue;\n }\n const names = exportedNames(result.stdout);\n if (source.needsDefault && !names.has('default')) {\n statuses.set('exports', 'failed');\n addError(diagnostics, {\n code: 'exports.default-missing',\n message: 'The manifest fixtures require a default export.',\n path: relativePath(manifestDirectory, source.path),\n functionName: source.entry.name,\n });\n }\n if (source.needsEnricher && !names.has('enricher')) {\n statuses.set('exports', 'failed');\n addError(diagnostics, {\n code: 'exports.enricher-missing',\n message: 'A REQUEST_ENRICHER fixture requires an `enricher` export.',\n path: relativePath(manifestDirectory, source.path),\n functionName: source.entry.name,\n });\n }\n if (source.needsAnyDsrExport && !names.has('default') && !names.has('enricher')) {\n statuses.set('exports', 'failed');\n addError(diagnostics, {\n code: 'exports.dsr-missing',\n message: 'A DSR Custom Function requires a `default` or `enricher` export.',\n path: relativePath(manifestDirectory, source.path),\n functionName: source.entry.name,\n });\n }\n }\n\n const sourcePaths = [...new Set(sources.map(({ path }) => path))];\n if (sourcePaths.length > 0) {\n const typecheck = await runner(\n 'deno',\n ['check', ...configArgs, ...sourcePaths],\n { cwd: manifestDirectory },\n context,\n );\n if (typecheck.code !== 0) {\n statuses.set('typecheck', 'failed');\n recordDenoFailure(diagnostics, 'deno.typecheck', 'Deno type checking failed.', typecheck);\n }\n const lint = await runner(\n 'deno',\n ['lint', ...configArgs, ...sourcePaths],\n { cwd: manifestDirectory },\n context,\n );\n if (lint.code !== 0) {\n statuses.set('lint', 'failed');\n recordDenoFailure(diagnostics, 'deno.lint', 'Deno linting failed.', lint);\n }\n }\n\n const formatPaths = [\n ...sourcePaths,\n ...payloadPaths,\n manifestPath,\n ...(configPath ? [configPath] : []),\n ...(docImportMap && docImportMap !== configPath && !/^[a-z][a-z\\d+.-]*:/iu.test(docImportMap)\n ? [docImportMap]\n : []),\n ];\n formatPaths.forEach((path) => assertPathPhysicallyContained(context, manifestDirectory, path));\n const format = await runner(\n 'deno',\n ['fmt', '--check', ...configArgs, ...formatPaths],\n { cwd: manifestDirectory },\n context,\n );\n if (format.code !== 0) {\n let formatPlan: Awaited<ReturnType<typeof buildFormatPlan>>;\n try {\n formatPlan = await buildFormatPlan(\n context,\n runner,\n manifestDirectory,\n configArgs,\n formatPaths,\n );\n } catch (error) {\n statuses.set('format', 'failed');\n addError(diagnostics, {\n code: 'deno.format-preview',\n message: (error as Error).message,\n });\n return buildResult();\n }\n if (formatPlan.changes.length === 0) {\n statuses.set('format', 'failed');\n recordDenoFailure(\n diagnostics,\n 'deno.format',\n 'Deno reported a formatting failure but did not produce a repair.',\n format,\n );\n return buildResult();\n }\n const shouldFix =\n options.fix ||\n (options.confirmFormat ? await options.confirmFormat(formatPlan.patch) : false);\n if (shouldFix) {\n try {\n await applyProjectPlan(context, {\n rootDirectory: manifestDirectory,\n changes: formatPlan.changes,\n });\n } catch (error) {\n statuses.set('format', 'failed');\n addError(diagnostics, {\n code: 'deno.format-fix',\n message: `Could not apply formatting transaction: ${(error as Error).message}`,\n });\n }\n } else {\n statuses.set('format', 'failed');\n formatPlan.changes.forEach((change, index) => {\n addError(diagnostics, {\n code: 'deno.format',\n message:\n 'Referenced file is not formatted.' +\n (index === 0 && options.includeFormatPatchInDiagnostics && formatPlan.patch\n ? `\\n${formatPlan.patch}`\n : ''),\n path: relativePath(manifestDirectory, change.path),\n });\n });\n }\n }\n }\n\n return buildResult();\n}\n","import colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { formatMissingManifestMessage } from '../../../lib/custom-functions/missing-manifest.js';\nimport { resolveCustomFunctionProjectPaths } from '../../../lib/custom-functions/paths.js';\nimport { discoverCustomFunctionManifests } from '../../../lib/custom-functions/project-discovery.js';\nimport { parseVariablesFromString } from '../../../lib/helpers/parseVariablesFromString.js';\nimport {\n isInteractivePromptInvocation,\n PromptCancelledError,\n ScaffoldPrompts,\n} from '../../../lib/scaffolding/prompts.js';\nimport { runCustomFunctionChecks } from './helpers.js';\n\n/** CLI flags for `transcend custom-functions check`. */\nexport interface CustomFunctionsCheckFlags {\n /** Explicit manifest path. */\n manifest?: string;\n /** Manifest variable substitutions. */\n variables: string;\n /** Apply Deno formatting. */\n fix: boolean;\n /** Disable prompts. */\n noInteractive: boolean;\n /** Emit JSON on stdout. */\n json: boolean;\n}\n\n/**\n * Validate a local Custom Function project without credentials.\n *\n * @param this - CLI context\n * @param flags - Check and interaction flags\n * @param directory - Optional target directory\n */\nexport async function check(\n this: LocalContext,\n flags: CustomFunctionsCheckFlags,\n directory?: string,\n): Promise<void> {\n doneInputValidation(this.process);\n const { manifestPath } = resolveCustomFunctionProjectPaths(this.process.cwd(), {\n ...(directory ? { directory } : {}),\n ...(flags.manifest ? { manifest: flags.manifest } : {}),\n });\n const missingMessage = this.fs.existsSync(manifestPath)\n ? undefined\n : formatMissingManifestMessage({\n cwd: this.process.cwd(),\n manifestPath,\n discoveredManifestPaths: discoverCustomFunctionManifests(this, this.process.cwd()),\n command: 'check',\n });\n const interactive = isInteractivePromptInvocation(\n flags,\n this.process.stdin.isTTY,\n this.process.stderr.isTTY,\n );\n const prompts = new ScaffoldPrompts(this);\n try {\n const result = await runCustomFunctionChecks(this, {\n manifestPath,\n variables: parseVariablesFromString(flags.variables),\n fix: flags.fix,\n includeFormatPatchInDiagnostics: !flags.json,\n ...(interactive && !flags.fix\n ? {\n confirmFormat: async (patch: string): Promise<boolean> => {\n if (patch) {\n this.logger.error(patch);\n }\n return prompts.confirm('Format the files shown above?', true);\n },\n }\n : {}),\n });\n if (missingMessage) {\n result.diagnostics.forEach((diagnostic) => {\n if (diagnostic.code === 'manifest.missing') {\n diagnostic.message = missingMessage;\n }\n });\n }\n if (flags.json) {\n this.process.stdout.write(`${JSON.stringify(result)}\\n`);\n } else {\n this.logger.info(`${colors.bold('Custom Function checks')}\\n`);\n result.checks.forEach(({ name, status }) => {\n const label = status === 'passed' ? 'PASS' : status === 'failed' ? 'FAIL' : 'SKIP';\n const styledLabel =\n status === 'passed'\n ? colors.green(label)\n : status === 'failed'\n ? colors.red(label)\n : colors.yellow(label);\n this.logger.info(`${styledLabel} ${name[0]!.toUpperCase()}${name.slice(1)}`);\n });\n if (result.diagnostics.length > 0) {\n this.logger.error('');\n }\n result.diagnostics.forEach((diagnostic) => {\n const location = diagnostic.path ? `${diagnostic.path}: ` : '';\n const owner = diagnostic.functionName ? `[${diagnostic.functionName}] ` : '';\n const message = `${diagnostic.severity}: ${location}${owner}${diagnostic.message}`;\n if (diagnostic.severity === 'warning') {\n this.logger.warn(colors.yellow(message));\n } else {\n this.logger.error(colors.red(message));\n }\n });\n if (result.status === 'passed') {\n this.logger.info('');\n this.logger.info(colors.green('Custom Function checks passed.'));\n } else {\n this.logger.error('');\n this.logger.error(colors.red('Custom Function checks failed.'));\n }\n }\n if (result.status === 'failed') {\n this.process.exitCode = 1;\n }\n } catch (error) {\n if (error instanceof PromptCancelledError) {\n this.process.exit(130);\n }\n throw error;\n }\n}\n"],"mappings":"sjCAuFA,SAAS,EACP,EACA,EACM,CACN,EAAY,KAAK,CAAE,SAAU,QAAS,GAAG,EAAY,CAAC,CAUxD,SAAS,EAAa,EAA2B,EAAsB,CAErE,OADc,EAAS,EAAmB,EAAK,CAAC,MAAM,EAAI,CAAC,KAAK,IACpD,EAAI,IASlB,SAAS,EAAkB,EAAwD,CACjF,IAAM,EACJ,GAEI,EAAM,OAAS,MAGZ,IAAgB,mBAAqB,eAAiB,gBAFpD,UAaX,OATI,EAAM,gBACD,CACL,CACE,QACA,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