@transcend-io/cli 10.28.0 → 10.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (338) hide show
  1. package/README.md +81 -15
  2. package/dist/{app-DCY8E776.mjs → app-C5baDSA2.mjs} +21 -21
  3. package/dist/app-C5baDSA2.mjs.map +1 -0
  4. package/dist/{approvePrivacyRequests-80SV_94y.mjs → approvePrivacyRequests-B8x7oxTn.mjs} +2 -2
  5. package/dist/{approvePrivacyRequests-80SV_94y.mjs.map → approvePrivacyRequests-B8x7oxTn.mjs.map} +1 -1
  6. package/dist/bin/bash-complete.mjs +1 -1
  7. package/dist/bin/cli.mjs +1 -1
  8. package/dist/bin/deprecated-command.mjs +1 -1
  9. package/dist/{buildExamples-2YDkSvtA.mjs → buildExamples-7KXBjl-b.mjs} +2 -2
  10. package/dist/{buildExamples-2YDkSvtA.mjs.map → buildExamples-7KXBjl-b.mjs.map} +1 -1
  11. package/dist/{buildXdiSyncEndpoint-B3zUrI16.mjs → buildXdiSyncEndpoint-DcrkZ2Gu.mjs} +2 -2
  12. package/dist/{buildXdiSyncEndpoint-B3zUrI16.mjs.map → buildXdiSyncEndpoint-DcrkZ2Gu.mjs.map} +1 -1
  13. package/dist/{bulkRestartRequests-BLb8OJmf.mjs → bulkRestartRequests-CysUfl98.mjs} +2 -2
  14. package/dist/{bulkRestartRequests-BLb8OJmf.mjs.map → bulkRestartRequests-CysUfl98.mjs.map} +1 -1
  15. package/dist/{bulkRetryEnrichers-BA9cboSe.mjs → bulkRetryEnrichers-DaLE67Ht.mjs} +2 -2
  16. package/dist/{bulkRetryEnrichers-BA9cboSe.mjs.map → bulkRetryEnrichers-DaLE67Ht.mjs.map} +1 -1
  17. package/dist/{cancelPrivacyRequests-BEyOBJ2r.mjs → cancelPrivacyRequests-D0zNUNdS.mjs} +2 -2
  18. package/dist/{cancelPrivacyRequests-BEyOBJ2r.mjs.map → cancelPrivacyRequests-D0zNUNdS.mjs.map} +1 -1
  19. package/dist/codecs-CTxFjCg4.mjs +2 -0
  20. package/dist/codecs-CTxFjCg4.mjs.map +1 -0
  21. package/dist/{collectCsvFilesOrExit-BqnmK63h.mjs → collectCsvFilesOrExit-B1VOVGWN.mjs} +1 -1
  22. package/dist/{collectCsvFilesOrExit-BqnmK63h.mjs.map → collectCsvFilesOrExit-B1VOVGWN.mjs.map} +1 -1
  23. package/dist/{collectParquetFilesOrExit-BiksFI-Q.mjs → collectParquetFilesOrExit-DVlv5ctt.mjs} +1 -1
  24. package/dist/{collectParquetFilesOrExit-BiksFI-Q.mjs.map → collectParquetFilesOrExit-DVlv5ctt.mjs.map} +1 -1
  25. package/dist/{command-eIenZMOx.mjs → command-CIv9yk86.mjs} +2 -2
  26. package/dist/{command-eIenZMOx.mjs.map → command-CIv9yk86.mjs.map} +1 -1
  27. package/dist/commands/admin/chunk-csv/worker.mjs +1 -1
  28. package/dist/commands/admin/parquet-to-csv/worker.mjs +1 -1
  29. package/dist/{consentManagersToBusinessEntities-O4KBox9u.mjs → consentManagersToBusinessEntities-CBJ81aGO.mjs} +1 -1
  30. package/dist/{consentManagersToBusinessEntities-O4KBox9u.mjs.map → consentManagersToBusinessEntities-CBJ81aGO.mjs.map} +1 -1
  31. package/dist/{constants-BpQ5awGp.mjs → constants-DXzsg2CQ.mjs} +2 -2
  32. package/dist/{constants-BpQ5awGp.mjs.map → constants-DXzsg2CQ.mjs.map} +1 -1
  33. package/dist/{constants-C1seVfCu.mjs → constants-D_HVDaOy.mjs} +1 -1
  34. package/dist/{constants-C1seVfCu.mjs.map → constants-D_HVDaOy.mjs.map} +1 -1
  35. package/dist/{constants-BG53Mbi9.mjs → constants-jjHIzHGm.mjs} +2 -2
  36. package/dist/{constants-BG53Mbi9.mjs.map → constants-jjHIzHGm.mjs.map} +1 -1
  37. package/dist/{context-CZYrQfAn.mjs → context-B33NT3ki.mjs} +1 -1
  38. package/dist/{context-CZYrQfAn.mjs.map → context-B33NT3ki.mjs.map} +1 -1
  39. package/dist/{createPoolingCommandUi-C39R_zo3.mjs → createPoolingCommandUi-uiDjLlqf.mjs} +2 -2
  40. package/dist/{createPoolingCommandUi-C39R_zo3.mjs.map → createPoolingCommandUi-uiDjLlqf.mjs.map} +1 -1
  41. package/dist/{dataFlowsToDataSilos-CLSHb1GA.mjs → dataFlowsToDataSilos-BF6fzWcm.mjs} +1 -1
  42. package/dist/{dataFlowsToDataSilos-CLSHb1GA.mjs.map → dataFlowsToDataSilos-BF6fzWcm.mjs.map} +1 -1
  43. package/dist/deno-runtime-DV52X8-P.mjs +2 -0
  44. package/dist/deno-runtime-DV52X8-P.mjs.map +1 -0
  45. package/dist/{done-input-validation-Cjk7a3jX.mjs → done-input-validation-BUz-aVC5.mjs} +1 -1
  46. package/dist/{done-input-validation-Cjk7a3jX.mjs.map → done-input-validation-BUz-aVC5.mjs.map} +1 -1
  47. package/dist/{downloadPrivacyRequestFiles-CLFgQItk.mjs → downloadPrivacyRequestFiles-B_BVxW5Z.mjs} +2 -2
  48. package/dist/{downloadPrivacyRequestFiles-CLFgQItk.mjs.map → downloadPrivacyRequestFiles-B_BVxW5Z.mjs.map} +1 -1
  49. package/dist/{extractClientError-C_6ly7Gw.mjs → extractClientError-HZ2U7yqV.mjs} +1 -1
  50. package/dist/{extractClientError-C_6ly7Gw.mjs.map → extractClientError-HZ2U7yqV.mjs.map} +1 -1
  51. package/dist/{fetchAllRequests-CEDKdq0c.mjs → fetchAllRequests-2TZr-LfT.mjs} +2 -2
  52. package/dist/{fetchAllRequests-CEDKdq0c.mjs.map → fetchAllRequests-2TZr-LfT.mjs.map} +1 -1
  53. package/dist/{formatPolicyBundleVersionSummary-CrFtcPwS.mjs → formatPolicyBundleVersionSummary-CJmMCLtJ.mjs} +1 -1
  54. package/dist/{formatPolicyBundleVersionSummary-CrFtcPwS.mjs.map → formatPolicyBundleVersionSummary-CJmMCLtJ.mjs.map} +1 -1
  55. package/dist/{fuzzyMatchColumns-OTsFJ21f.mjs → fuzzyMatchColumns-CQCzpjWC.mjs} +2 -2
  56. package/dist/{fuzzyMatchColumns-OTsFJ21f.mjs.map → fuzzyMatchColumns-CQCzpjWC.mjs.map} +1 -1
  57. package/dist/{generateCrossAccountApiKeys-D6O_Qm3Y.mjs → generateCrossAccountApiKeys-Bnqgmj-H.mjs} +2 -2
  58. package/dist/{generateCrossAccountApiKeys-D6O_Qm3Y.mjs.map → generateCrossAccountApiKeys-Bnqgmj-H.mjs.map} +1 -1
  59. package/dist/impl--JGnR3wp.mjs +3 -0
  60. package/dist/{impl-CzxvoiGW.mjs.map → impl--JGnR3wp.mjs.map} +1 -1
  61. package/dist/{impl-BqrSLoig.mjs → impl-2iVTxNn4.mjs} +2 -2
  62. package/dist/{impl-BqrSLoig.mjs.map → impl-2iVTxNn4.mjs.map} +1 -1
  63. package/dist/{impl-Drql0g72.mjs → impl-7UqkSO3x2.mjs} +2 -2
  64. package/dist/impl-7UqkSO3x2.mjs.map +1 -0
  65. package/dist/{impl-C50tdWlL2.mjs → impl-B-j5ACi02.mjs} +2 -2
  66. package/dist/{impl-C50tdWlL2.mjs.map → impl-B-j5ACi02.mjs.map} +1 -1
  67. package/dist/impl-B4BgGuF_.mjs +3 -0
  68. package/dist/impl-B4BgGuF_.mjs.map +1 -0
  69. package/dist/{impl-zZFaSmxd2.mjs → impl-BDrvzlpf2.mjs} +2 -2
  70. package/dist/{impl-zZFaSmxd2.mjs.map → impl-BDrvzlpf2.mjs.map} +1 -1
  71. package/dist/{impl-Dk6TZKrp2.mjs → impl-BH_A5rgL.mjs} +2 -2
  72. package/dist/impl-BH_A5rgL.mjs.map +1 -0
  73. package/dist/{impl-CHmjV-Pa.mjs → impl-BOawPhYE.mjs} +2 -2
  74. package/dist/{impl-CHmjV-Pa.mjs.map → impl-BOawPhYE.mjs.map} +1 -1
  75. package/dist/{impl-CXUJ1eRC.mjs → impl-BPoEH3Nf2.mjs} +2 -2
  76. package/dist/impl-BPoEH3Nf2.mjs.map +1 -0
  77. package/dist/{impl-CqF9xIIy.mjs → impl-BXUYpR27.mjs} +2 -2
  78. package/dist/{impl-CqF9xIIy.mjs.map → impl-BXUYpR27.mjs.map} +1 -1
  79. package/dist/{impl-DYf10-BD2.mjs → impl-Bc6p8A1l2.mjs} +2 -2
  80. package/dist/{impl-DYf10-BD2.mjs.map → impl-Bc6p8A1l2.mjs.map} +1 -1
  81. package/dist/{impl-M3Eu4QjS.mjs → impl-BqWQh9Ss.mjs} +2 -2
  82. package/dist/{impl-M3Eu4QjS.mjs.map → impl-BqWQh9Ss.mjs.map} +1 -1
  83. package/dist/impl-C6HtWd1t.mjs +2 -0
  84. package/dist/{impl-BcJ019T2.mjs.map → impl-C6HtWd1t.mjs.map} +1 -1
  85. package/dist/{impl-GHukPBnk.mjs → impl-CL29fOWM.mjs} +2 -2
  86. package/dist/{impl-GHukPBnk.mjs.map → impl-CL29fOWM.mjs.map} +1 -1
  87. package/dist/{impl-BvNZqLrT.mjs → impl-CO4ZqlLV.mjs} +2 -2
  88. package/dist/{impl-BvNZqLrT.mjs.map → impl-CO4ZqlLV.mjs.map} +1 -1
  89. package/dist/{impl-DJLlcqSg.mjs → impl-COujMWgp.mjs} +2 -2
  90. package/dist/{impl-DJLlcqSg.mjs.map → impl-COujMWgp.mjs.map} +1 -1
  91. package/dist/{impl-Bs-drNBf.mjs → impl-CPSEzCc9.mjs} +2 -2
  92. package/dist/{impl-Bs-drNBf.mjs.map → impl-CPSEzCc9.mjs.map} +1 -1
  93. package/dist/{impl-Dib6Fff12.mjs → impl-CQVy2k3o.mjs} +2 -2
  94. package/dist/impl-CQVy2k3o.mjs.map +1 -0
  95. package/dist/{impl-B3_hrFPX.mjs → impl-CUOVJsRg.mjs} +2 -2
  96. package/dist/{impl-B3_hrFPX.mjs.map → impl-CUOVJsRg.mjs.map} +1 -1
  97. package/dist/{impl-BySmbxEt.mjs → impl-CUiYbk6G.mjs} +2 -2
  98. package/dist/{impl-BySmbxEt.mjs.map → impl-CUiYbk6G.mjs.map} +1 -1
  99. package/dist/{impl-CWh9H7mL.mjs → impl-CXTBcYo6.mjs} +2 -2
  100. package/dist/{impl-CWh9H7mL.mjs.map → impl-CXTBcYo6.mjs.map} +1 -1
  101. package/dist/{impl-Cx3T0Iei.mjs → impl-CfvxD3RI.mjs} +2 -2
  102. package/dist/{impl-Cx3T0Iei.mjs.map → impl-CfvxD3RI.mjs.map} +1 -1
  103. package/dist/{impl-DHfYO9T52.mjs → impl-Cli2XRp02.mjs} +2 -2
  104. package/dist/{impl-DHfYO9T52.mjs.map → impl-Cli2XRp02.mjs.map} +1 -1
  105. package/dist/{impl-CDtUusmg.mjs → impl-CuDs6SsI.mjs} +2 -2
  106. package/dist/{impl-CDtUusmg.mjs.map → impl-CuDs6SsI.mjs.map} +1 -1
  107. package/dist/{impl-BYGNx-8W2.mjs → impl-CvLI_Jig.mjs} +2 -2
  108. package/dist/impl-CvLI_Jig.mjs.map +1 -0
  109. package/dist/{impl-BFJtKA2o2.mjs → impl-CwKYKBYb.mjs} +2 -2
  110. package/dist/impl-CwKYKBYb.mjs.map +1 -0
  111. package/dist/{impl-BewF8tB6.mjs → impl-CwXp3Tbr.mjs} +2 -2
  112. package/dist/{impl-BewF8tB6.mjs.map → impl-CwXp3Tbr.mjs.map} +1 -1
  113. package/dist/{impl-B--lr5RJ2.mjs → impl-CyQRmuM72.mjs} +2 -2
  114. package/dist/{impl-B--lr5RJ2.mjs.map → impl-CyQRmuM72.mjs.map} +1 -1
  115. package/dist/impl-DEJpYLPB.mjs +2 -0
  116. package/dist/impl-DEJpYLPB.mjs.map +1 -0
  117. package/dist/impl-DEhw1iNn.mjs +2 -0
  118. package/dist/impl-DEhw1iNn.mjs.map +1 -0
  119. package/dist/impl-DK7nSMle2.mjs +303 -0
  120. package/dist/impl-DK7nSMle2.mjs.map +1 -0
  121. package/dist/{impl-DOoR93T6.mjs → impl-DKepRc812.mjs} +2 -2
  122. package/dist/impl-DKepRc812.mjs.map +1 -0
  123. package/dist/{impl-CTIWliTx.mjs → impl-DLG0Egy6.mjs} +2 -2
  124. package/dist/{impl-CTIWliTx.mjs.map → impl-DLG0Egy6.mjs.map} +1 -1
  125. package/dist/impl-DMe_OqJx.mjs +2 -0
  126. package/dist/{impl-BsC1KVxS.mjs.map → impl-DMe_OqJx.mjs.map} +1 -1
  127. package/dist/{impl-BwRcpAno.mjs → impl-DNe-gRXe2.mjs} +2 -2
  128. package/dist/impl-DNe-gRXe2.mjs.map +1 -0
  129. package/dist/{impl-Dm-Fkr392.mjs → impl-DNzkRayg.mjs} +2 -2
  130. package/dist/impl-DNzkRayg.mjs.map +1 -0
  131. package/dist/{impl-DzNk41xd.mjs → impl-DPtx5iZO.mjs} +2 -2
  132. package/dist/{impl-DzNk41xd.mjs.map → impl-DPtx5iZO.mjs.map} +1 -1
  133. package/dist/{impl-syp5hclX.mjs → impl-DRpK-QLC.mjs} +2 -2
  134. package/dist/{impl-syp5hclX.mjs.map → impl-DRpK-QLC.mjs.map} +1 -1
  135. package/dist/{impl-Bq6g_xYv.mjs → impl-DVQmuZQY.mjs} +2 -2
  136. package/dist/{impl-Bq6g_xYv.mjs.map → impl-DVQmuZQY.mjs.map} +1 -1
  137. package/dist/{impl-DYwojWvN.mjs → impl-DVeGQCrr.mjs} +2 -2
  138. package/dist/{impl-DYwojWvN.mjs.map → impl-DVeGQCrr.mjs.map} +1 -1
  139. package/dist/{impl-DF8RGVlT.mjs → impl-DXRDWiB1.mjs} +2 -2
  140. package/dist/{impl-DF8RGVlT.mjs.map → impl-DXRDWiB1.mjs.map} +1 -1
  141. package/dist/{impl-CiYKuCHV.mjs → impl-DXowiNOz.mjs} +2 -2
  142. package/dist/{impl-CiYKuCHV.mjs.map → impl-DXowiNOz.mjs.map} +1 -1
  143. package/dist/{impl-DpuhHpuk.mjs → impl-DaH1_ZzK.mjs} +2 -2
  144. package/dist/{impl-DpuhHpuk.mjs.map → impl-DaH1_ZzK.mjs.map} +1 -1
  145. package/dist/{impl-DIPvFKiP.mjs → impl-DdIa0zla.mjs} +2 -2
  146. package/dist/{impl-DIPvFKiP.mjs.map → impl-DdIa0zla.mjs.map} +1 -1
  147. package/dist/{impl-DbZ1cYoR.mjs → impl-DqhZR11m.mjs} +2 -2
  148. package/dist/{impl-DbZ1cYoR.mjs.map → impl-DqhZR11m.mjs.map} +1 -1
  149. package/dist/{impl-VPBEqV0w2.mjs → impl-Dqqb0lVN.mjs} +2 -2
  150. package/dist/impl-Dqqb0lVN.mjs.map +1 -0
  151. package/dist/{impl-6m7GXUAe.mjs → impl-DryC3OJu.mjs} +2 -2
  152. package/dist/{impl-6m7GXUAe.mjs.map → impl-DryC3OJu.mjs.map} +1 -1
  153. package/dist/{impl-CQGeH47F.mjs → impl-DuZjI6p0.mjs} +2 -2
  154. package/dist/{impl-CQGeH47F.mjs.map → impl-DuZjI6p0.mjs.map} +1 -1
  155. package/dist/{impl-C5dzaDga2.mjs → impl-Dw8NYkzw.mjs} +2 -2
  156. package/dist/impl-Dw8NYkzw.mjs.map +1 -0
  157. package/dist/impl-Dx_TfvW1.mjs +2 -0
  158. package/dist/{impl-C8BmxFQ2.mjs.map → impl-Dx_TfvW1.mjs.map} +1 -1
  159. package/dist/{impl-DXNcD7CZ.mjs → impl-DypttZd6.mjs} +2 -2
  160. package/dist/{impl-DXNcD7CZ.mjs.map → impl-DypttZd6.mjs.map} +1 -1
  161. package/dist/{impl-CfPXYgT42.mjs → impl-DzUTmaID2.mjs} +2 -2
  162. package/dist/{impl-CfPXYgT42.mjs.map → impl-DzUTmaID2.mjs.map} +1 -1
  163. package/dist/{impl-BJlKQJdS2.mjs → impl-INhq_CiK.mjs} +2 -2
  164. package/dist/impl-INhq_CiK.mjs.map +1 -0
  165. package/dist/{impl-KKrDTraf.mjs → impl-KmCNH-yw.mjs} +2 -2
  166. package/dist/{impl-KKrDTraf.mjs.map → impl-KmCNH-yw.mjs.map} +1 -1
  167. package/dist/{impl-CE56-wQh.mjs → impl-RPG-BTmX.mjs} +2 -2
  168. package/dist/{impl-CE56-wQh.mjs.map → impl-RPG-BTmX.mjs.map} +1 -1
  169. package/dist/{impl-amV0wRWk.mjs → impl-XrTL-TDl.mjs} +2 -2
  170. package/dist/{impl-amV0wRWk.mjs.map → impl-XrTL-TDl.mjs.map} +1 -1
  171. package/dist/impl-Z8oWVENM.mjs +2 -0
  172. package/dist/impl-Z8oWVENM.mjs.map +1 -0
  173. package/dist/{impl-m3QXCc6n.mjs → impl-a_Y8bnSn.mjs} +4 -4
  174. package/dist/impl-a_Y8bnSn.mjs.map +1 -0
  175. package/dist/{impl-CEmXPEq22.mjs → impl-hwpT9u5o2.mjs} +2 -2
  176. package/dist/{impl-CEmXPEq22.mjs.map → impl-hwpT9u5o2.mjs.map} +1 -1
  177. package/dist/{impl-BWVe4VGF2.mjs → impl-xq89cSSz2.mjs} +2 -2
  178. package/dist/{impl-BWVe4VGF2.mjs.map → impl-xq89cSSz2.mjs.map} +1 -1
  179. package/dist/index.d.mts +12797 -1840
  180. package/dist/index.d.mts.map +1 -1
  181. package/dist/index.mjs +3 -3
  182. package/dist/index.mjs.map +1 -1
  183. package/dist/{initializeCliRuntime-802-P8MC.mjs → initializeCliRuntime-6wI_VIHV.mjs} +1 -1
  184. package/dist/{initializeCliRuntime-802-P8MC.mjs.map → initializeCliRuntime-6wI_VIHV.mjs.map} +1 -1
  185. package/dist/{inquirer-DkFTQU00.mjs → inquirer-BeaBetMO.mjs} +2 -2
  186. package/dist/{inquirer-DkFTQU00.mjs.map → inquirer-BeaBetMO.mjs.map} +1 -1
  187. package/dist/jsonc-D9dDWb1J.mjs +6 -0
  188. package/dist/jsonc-D9dDWb1J.mjs.map +1 -0
  189. package/dist/{listFiles-CWHAdKY-.mjs → listFiles-BdFUbX5x.mjs} +1 -1
  190. package/dist/{listFiles-CWHAdKY-.mjs.map → listFiles-BdFUbX5x.mjs.map} +1 -1
  191. package/dist/logger-zplFSeXU.mjs +2 -0
  192. package/dist/logger-zplFSeXU.mjs.map +1 -0
  193. package/dist/manifest-BNIpO_zW.mjs +2 -0
  194. package/dist/manifest-BNIpO_zW.mjs.map +1 -0
  195. package/dist/{mapConsentCsvRowsToInputs-MMPZwzrV.mjs → mapConsentCsvRowsToInputs-Dqb6WL4r.mjs} +1 -1
  196. package/dist/{mapConsentCsvRowsToInputs-MMPZwzrV.mjs.map → mapConsentCsvRowsToInputs-Dqb6WL4r.mjs.map} +1 -1
  197. package/dist/{markRequestDataSiloIdsCompleted-PKCcn5wQ.mjs → markRequestDataSiloIdsCompleted-B5N-cQWr.mjs} +2 -2
  198. package/dist/{markRequestDataSiloIdsCompleted-PKCcn5wQ.mjs.map → markRequestDataSiloIdsCompleted-B5N-cQWr.mjs.map} +1 -1
  199. package/dist/{markSilentPrivacyRequests-7l9I99pe.mjs → markSilentPrivacyRequests-BiaButWF.mjs} +2 -2
  200. package/dist/{markSilentPrivacyRequests-7l9I99pe.mjs.map → markSilentPrivacyRequests-BiaButWF.mjs.map} +1 -1
  201. package/dist/mergeTranscendInputs-DFQcbh8b.mjs +3 -0
  202. package/dist/mergeTranscendInputs-DFQcbh8b.mjs.map +1 -0
  203. package/dist/missing-manifest-DgcukXfg.mjs +2 -0
  204. package/dist/missing-manifest-DgcukXfg.mjs.map +1 -0
  205. package/dist/{module-graph-DBC7ZvyA.mjs → module-graph-Cb0g74Ft.mjs} +1 -1
  206. package/dist/{module-graph-DBC7ZvyA.mjs.map → module-graph-Cb0g74Ft.mjs.map} +1 -1
  207. package/dist/{notifyPrivacyRequestsAdditionalTime-BPIYuCov.mjs → notifyPrivacyRequestsAdditionalTime-D3Vtvg5G.mjs} +2 -2
  208. package/dist/{notifyPrivacyRequestsAdditionalTime-BPIYuCov.mjs.map → notifyPrivacyRequestsAdditionalTime-D3Vtvg5G.mjs.map} +1 -1
  209. package/dist/{parquetToCsvOneFile-CSVdrLvq.mjs → parquetToCsvOneFile-ChmPC6dL.mjs} +2 -2
  210. package/dist/{parquetToCsvOneFile-CSVdrLvq.mjs.map → parquetToCsvOneFile-ChmPC6dL.mjs.map} +1 -1
  211. package/dist/{parseAttributesFromString-C5-KGkPH.mjs → parseAttributesFromString-CO16oAlx.mjs} +2 -2
  212. package/dist/{parseAttributesFromString-C5-KGkPH.mjs.map → parseAttributesFromString-CO16oAlx.mjs.map} +1 -1
  213. package/dist/{parseVariablesFromString-Cr3x2uq3.mjs → parseVariablesFromString-BOSfQ4QF.mjs} +1 -1
  214. package/dist/{parseVariablesFromString-Cr3x2uq3.mjs.map → parseVariablesFromString-BOSfQ4QF.mjs.map} +1 -1
  215. package/dist/path-safety-D5Qwl40b.mjs +2 -0
  216. package/dist/path-safety-D5Qwl40b.mjs.map +1 -0
  217. package/dist/policy-bundle-manifest-D6dkbjNi.mjs +7 -0
  218. package/dist/policy-bundle-manifest-D6dkbjNi.mjs.map +1 -0
  219. package/dist/policy-runtime-BMKa-Upy.mjs +2 -0
  220. package/dist/policy-runtime-BMKa-Upy.mjs.map +1 -0
  221. package/dist/{printResult-esxW3HhT.mjs → printResult-CHe3nRN4.mjs} +5 -5
  222. package/dist/printResult-CHe3nRN4.mjs.map +1 -0
  223. package/dist/project-plan-apply-Dvndx455.mjs +3 -0
  224. package/dist/project-plan-apply-Dvndx455.mjs.map +1 -0
  225. package/dist/prompts-ClBXdELk.mjs +4 -0
  226. package/dist/prompts-ClBXdELk.mjs.map +1 -0
  227. package/dist/{pullAllDatapoints-H92qjLSx.mjs → pullAllDatapoints-uk5ggk6O.mjs} +2 -2
  228. package/dist/{pullAllDatapoints-H92qjLSx.mjs.map → pullAllDatapoints-uk5ggk6O.mjs.map} +1 -1
  229. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-BrDmPbvc.mjs → pullChunkedCustomSiloOutstandingIdentifiers-D85P1W_8.mjs} +2 -2
  230. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-BrDmPbvc.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-D85P1W_8.mjs.map} +1 -1
  231. package/dist/{pullConsentManagerMetrics-Cvex-gpd.mjs → pullConsentManagerMetrics-Dv5n1ZGp.mjs} +2 -2
  232. package/dist/{pullConsentManagerMetrics-Cvex-gpd.mjs.map → pullConsentManagerMetrics-Dv5n1ZGp.mjs.map} +1 -1
  233. package/dist/{pullManualEnrichmentIdentifiersToCsv-qjdNA75O.mjs → pullManualEnrichmentIdentifiersToCsv-DbNSrKEk.mjs} +2 -2
  234. package/dist/{pullManualEnrichmentIdentifiersToCsv-qjdNA75O.mjs.map → pullManualEnrichmentIdentifiersToCsv-DbNSrKEk.mjs.map} +1 -1
  235. package/dist/{pullTranscendConfiguration-CD7Frn8z.mjs → pullTranscendConfiguration-B63M3ild.mjs} +3 -3
  236. package/dist/{pullTranscendConfiguration-CD7Frn8z.mjs.map → pullTranscendConfiguration-B63M3ild.mjs.map} +1 -1
  237. package/dist/{pullUnstructuredSubDataPointRecommendations-Dmh_-r95.mjs → pullUnstructuredSubDataPointRecommendations-YTBzfkRZ.mjs} +2 -2
  238. package/dist/{pullUnstructuredSubDataPointRecommendations-Dmh_-r95.mjs.map → pullUnstructuredSubDataPointRecommendations-YTBzfkRZ.mjs.map} +1 -1
  239. package/dist/{pushCronIdentifiersFromCsv-DjeY7TtK.mjs → pushCronIdentifiersFromCsv-5ruUKHtL.mjs} +2 -2
  240. package/dist/{pushCronIdentifiersFromCsv-DjeY7TtK.mjs.map → pushCronIdentifiersFromCsv-5ruUKHtL.mjs.map} +1 -1
  241. package/dist/{pushManualEnrichmentIdentifiersFromCsv-BDtMo13j.mjs → pushManualEnrichmentIdentifiersFromCsv-B0i2239u.mjs} +2 -2
  242. package/dist/{pushManualEnrichmentIdentifiersFromCsv-BDtMo13j.mjs.map → pushManualEnrichmentIdentifiersFromCsv-B0i2239u.mjs.map} +1 -1
  243. package/dist/{readCsv-Cr_1t8F5.mjs → readCsv-DLg8pwjd.mjs} +1 -1
  244. package/dist/{readCsv-Cr_1t8F5.mjs.map → readCsv-DLg8pwjd.mjs.map} +1 -1
  245. package/dist/readTranscendYaml-BNn6-Ofi.mjs +4 -0
  246. package/dist/readTranscendYaml-BNn6-Ofi.mjs.map +1 -0
  247. package/dist/{removeUnverifiedRequestIdentifiers-B9uPApVR.mjs → removeUnverifiedRequestIdentifiers-QmeqrmxM.mjs} +2 -2
  248. package/dist/{removeUnverifiedRequestIdentifiers-B9uPApVR.mjs.map → removeUnverifiedRequestIdentifiers-QmeqrmxM.mjs.map} +1 -1
  249. package/dist/{renderTable-DKTZbMjY.mjs → renderTable-D68QasPc.mjs} +1 -1
  250. package/dist/{renderTable-DKTZbMjY.mjs.map → renderTable-D68QasPc.mjs.map} +1 -1
  251. package/dist/{request-B1yRTdG-.mjs → request-BiPv6jmP.mjs} +1 -1
  252. package/dist/{request-B1yRTdG-.mjs.map → request-BiPv6jmP.mjs.map} +1 -1
  253. package/dist/{resolveBundleIdByName-DuxWYrDF.mjs → resolveBundleIdByName-qXZBrUz_.mjs} +2 -2
  254. package/dist/{resolveBundleIdByName-DuxWYrDF.mjs.map → resolveBundleIdByName-qXZBrUz_.mjs.map} +1 -1
  255. package/dist/{resolvePolicyBundleVersion-DhXZKwb4.mjs → resolvePolicyBundleVersion-BG7XqBBP.mjs} +2 -2
  256. package/dist/{resolvePolicyBundleVersion-DhXZKwb4.mjs.map → resolvePolicyBundleVersion-BG7XqBBP.mjs.map} +1 -1
  257. package/dist/{retryRequestDataSilos-D9dBtbdl.mjs → retryRequestDataSilos-BfckLjOJ.mjs} +2 -2
  258. package/dist/{retryRequestDataSilos-D9dBtbdl.mjs.map → retryRequestDataSilos-BfckLjOJ.mjs.map} +1 -1
  259. package/dist/{run-captured-process-CpZBh0lG.mjs → run-captured-process-BXwWXuTh.mjs} +1 -1
  260. package/dist/{run-captured-process-CpZBh0lG.mjs.map → run-captured-process-BXwWXuTh.mjs.map} +1 -1
  261. package/dist/runOpa-CswzJxIs.mjs +2 -0
  262. package/dist/runOpa-CswzJxIs.mjs.map +1 -0
  263. package/dist/scaffold-model-BAbYTR0q.mjs +2 -0
  264. package/dist/scaffold-model-BAbYTR0q.mjs.map +1 -0
  265. package/dist/scaffold-planning-CNv83t_v.mjs +123 -0
  266. package/dist/scaffold-planning-CNv83t_v.mjs.map +1 -0
  267. package/dist/scaffold-templates-DzDGTZie.mjs +84 -0
  268. package/dist/scaffold-templates-DzDGTZie.mjs.map +1 -0
  269. package/dist/{skipPreflightJobs-Beia_iB6.mjs → skipPreflightJobs-Do_kwu3m.mjs} +2 -2
  270. package/dist/{skipPreflightJobs-Beia_iB6.mjs.map → skipPreflightJobs-Do_kwu3m.mjs.map} +1 -1
  271. package/dist/{skipRequestDataSilos-BSNLacnR.mjs → skipRequestDataSilos-BNDhdllD.mjs} +2 -2
  272. package/dist/{skipRequestDataSilos-BSNLacnR.mjs.map → skipRequestDataSilos-BNDhdllD.mjs.map} +1 -1
  273. package/dist/{streamPrivacyRequestsToCsv-Cksb9D49.mjs → streamPrivacyRequestsToCsv-CbJfhV6A.mjs} +2 -2
  274. package/dist/{streamPrivacyRequestsToCsv-Cksb9D49.mjs.map → streamPrivacyRequestsToCsv-CbJfhV6A.mjs.map} +1 -1
  275. package/dist/{syncCodePackages-DsC1tE8B.mjs → syncCodePackages-BHE2Tn1Q.mjs} +2 -2
  276. package/dist/{syncCodePackages-DsC1tE8B.mjs.map → syncCodePackages-BHE2Tn1Q.mjs.map} +1 -1
  277. package/dist/{updateConsentManagerVersionToLatest-CaEkTnlL.mjs → updateConsentManagerVersionToLatest-DEFwH4Se.mjs} +2 -2
  278. package/dist/{updateConsentManagerVersionToLatest-CaEkTnlL.mjs.map → updateConsentManagerVersionToLatest-DEFwH4Se.mjs.map} +1 -1
  279. package/dist/{uploadConsents-CNyuYx0o.mjs → uploadConsents-ChmFIw_j.mjs} +2 -2
  280. package/dist/{uploadConsents-CNyuYx0o.mjs.map → uploadConsents-ChmFIw_j.mjs.map} +1 -1
  281. package/dist/{uploadPrivacyRequestsFromCsv-BdTQOZnF.mjs → uploadPrivacyRequestsFromCsv-D3KSb1qH.mjs} +2 -2
  282. package/dist/{uploadPrivacyRequestsFromCsv-BdTQOZnF.mjs.map → uploadPrivacyRequestsFromCsv-D3KSb1qH.mjs.map} +1 -1
  283. package/dist/{validateTranscendAuth-CnHMn77m.mjs → validateTranscendAuth-D6Wr1cxY.mjs} +2 -2
  284. package/dist/{validateTranscendAuth-CnHMn77m.mjs.map → validateTranscendAuth-D6Wr1cxY.mjs.map} +1 -1
  285. package/dist/{writeCsv-D46aDkGf.mjs → writeCsv-D-2siSwE.mjs} +1 -1
  286. package/dist/{writeCsv-D46aDkGf.mjs.map → writeCsv-D-2siSwE.mjs.map} +1 -1
  287. package/package.json +8 -7
  288. package/dist/app-DCY8E776.mjs.map +0 -1
  289. package/dist/codecs-BsQFAFGT.mjs +0 -2
  290. package/dist/codecs-BsQFAFGT.mjs.map +0 -1
  291. package/dist/constants-BMAOvdcA.mjs +0 -2
  292. package/dist/constants-BMAOvdcA.mjs.map +0 -1
  293. package/dist/deno-runtime-QqwBDKXX.mjs +0 -2
  294. package/dist/deno-runtime-QqwBDKXX.mjs.map +0 -1
  295. package/dist/impl-BFJtKA2o2.mjs.map +0 -1
  296. package/dist/impl-BJlKQJdS2.mjs.map +0 -1
  297. package/dist/impl-BNPgYSBT.mjs +0 -3
  298. package/dist/impl-BNPgYSBT.mjs.map +0 -1
  299. package/dist/impl-BYGNx-8W2.mjs.map +0 -1
  300. package/dist/impl-BcJ019T2.mjs +0 -2
  301. package/dist/impl-BsC1KVxS.mjs +0 -2
  302. package/dist/impl-BwRcpAno.mjs.map +0 -1
  303. package/dist/impl-C5dzaDga2.mjs.map +0 -1
  304. package/dist/impl-C8BmxFQ2.mjs +0 -2
  305. package/dist/impl-CXUJ1eRC.mjs.map +0 -1
  306. package/dist/impl-CzxvoiGW.mjs +0 -3
  307. package/dist/impl-D-SQJc3t.mjs +0 -2
  308. package/dist/impl-D-SQJc3t.mjs.map +0 -1
  309. package/dist/impl-D23kJPAQ2.mjs +0 -3
  310. package/dist/impl-D23kJPAQ2.mjs.map +0 -1
  311. package/dist/impl-DOoR93T6.mjs.map +0 -1
  312. package/dist/impl-Dib6Fff12.mjs.map +0 -1
  313. package/dist/impl-Dk6TZKrp2.mjs.map +0 -1
  314. package/dist/impl-Dm-Fkr392.mjs.map +0 -1
  315. package/dist/impl-Drql0g72.mjs.map +0 -1
  316. package/dist/impl-FLj_mWLO.mjs +0 -2
  317. package/dist/impl-FLj_mWLO.mjs.map +0 -1
  318. package/dist/impl-VPBEqV0w2.mjs.map +0 -1
  319. package/dist/impl-m3QXCc6n.mjs.map +0 -1
  320. package/dist/logger-9T6vva73.mjs +0 -2
  321. package/dist/logger-9T6vva73.mjs.map +0 -1
  322. package/dist/manifest-DVuW_vvO.mjs +0 -2
  323. package/dist/manifest-DVuW_vvO.mjs.map +0 -1
  324. package/dist/mergeTranscendInputs-CWHXH0kF.mjs +0 -3
  325. package/dist/mergeTranscendInputs-CWHXH0kF.mjs.map +0 -1
  326. package/dist/missing-manifest-BKj1j-jg.mjs +0 -2
  327. package/dist/missing-manifest-BKj1j-jg.mjs.map +0 -1
  328. package/dist/printResult-esxW3HhT.mjs.map +0 -1
  329. package/dist/project-plan-apply-C2DfikVN.mjs +0 -3
  330. package/dist/project-plan-apply-C2DfikVN.mjs.map +0 -1
  331. package/dist/readTranscendYaml-STYnRzq-.mjs +0 -4
  332. package/dist/readTranscendYaml-STYnRzq-.mjs.map +0 -1
  333. package/dist/runOpa-CkKAwsvB.mjs +0 -2
  334. package/dist/runOpa-CkKAwsvB.mjs.map +0 -1
  335. package/dist/scaffold-planning-DMACXSnX.mjs +0 -121
  336. package/dist/scaffold-planning-DMACXSnX.mjs.map +0 -1
  337. package/dist/scaffold-templates-CsHM1y80.mjs +0 -84
  338. package/dist/scaffold-templates-CsHM1y80.mjs.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import{i as e,n as t,r as n,t as r}from"./enums-OiLcZ26O.mjs";import{a as i,c as a,d as o,f as s,g as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,u as y}from"./constants-BG53Mbi9.mjs";import{t as b}from"./logger-9T6vva73.mjs";import{$ as x,A as S,B as ee,C as te,D as C,E as ne,F as re,G as ie,H as ae,I as oe,J as se,K as ce,L as le,M as ue,N as w,O as de,P as fe,Q as T,R as E,S as D,T as O,U as k,V as A,W as j,X as M,Y as N,Z as P,_ as F,a as I,at as L,b as R,c as z,ct as B,d as V,dt as pe,et as me,f as he,ft as ge,g as _e,h as ve,i as ye,it as be,j as xe,k as Se,l as Ce,lt as we,m as Te,mt as Ee,n as De,nt as Oe,o as ke,ot as Ae,p as je,pt as Me,q as Ne,r as Pe,rt as Fe,s as Ie,st as Le,t as Re,tt as ze,u as Be,ut as Ve,v as He,w as Ue,x as We,y as Ge,z as Ke}from"./codecs-BsQFAFGT.mjs";import{a as qe,i as Je,n as Ye,o as Xe,r as Ze,s as Qe,t as $e}from"./readTranscendYaml-STYnRzq-.mjs";import{i as et,n as tt,r as nt,t as rt}from"./mergeTranscendInputs-CWHXH0kF.mjs";import{a as it,c as at,i as ot,l as st,n as ct,o as lt,r as ut,s as dt,t as ft,u as pt}from"./constants-C1seVfCu.mjs";import{n as mt,t as ht}from"./fuzzyMatchColumns-OTsFJ21f.mjs";import{a as gt,c as _t,d as vt,f as yt,i as bt,l as xt,n as St,o as Ct,r as wt,s as Tt,t as Et,u as Dt}from"./uploadPrivacyRequestsFromCsv-BdTQOZnF.mjs";import{n as Ot,t as kt}from"./parseAttributesFromString-C5-KGkPH.mjs";import{n as H,t as At}from"./readCsv-Cr_1t8F5.mjs";import{n as jt,t as Mt}from"./pullUnstructuredSubDataPointRecommendations-Dmh_-r95.mjs";import{a as Nt,i as Pt,n as Ft,o as It,r as Lt,t as Rt}from"./request-B1yRTdG-.mjs";import{i as zt,n as Bt,r as Vt,t as Ht}from"./pullTranscendConfiguration-CD7Frn8z.mjs";import{i as Ut,n as Wt,r as U,t as Gt}from"./fetchAllRequests-CEDKdq0c.mjs";import{a as Kt,i as qt,n as Jt,r as Yt,t as Xt}from"./pullChunkedCustomSiloOutstandingIdentifiers-BrDmPbvc.mjs";import{n as Zt,r as Qt,t as $t}from"./syncCodePackages-DsC1tE8B.mjs";import{t as en}from"./markSilentPrivacyRequests-7l9I99pe.mjs";import{a as tn,i as nn,n as rn,o as an,r as on,t as sn}from"./downloadPrivacyRequestFiles-CLFgQItk.mjs";import{n as cn,r as ln,t as un}from"./extractClientError-C_6ly7Gw.mjs";import{t as dn}from"./approvePrivacyRequests-80SV_94y.mjs";import{t as fn}from"./notifyPrivacyRequestsAdditionalTime-BPIYuCov.mjs";import{t as pn}from"./cancelPrivacyRequests-BEyOBJ2r.mjs";import{n as mn,t as hn}from"./bulkRestartRequests-BLb8OJmf.mjs";import{t as gn}from"./skipPreflightJobs-Beia_iB6.mjs";import{t as _n}from"./bulkRetryEnrichers-BA9cboSe.mjs";import{t as vn}from"./retryRequestDataSilos-D9dBtbdl.mjs";import{n as W,r as G,t as yn}from"./streamPrivacyRequestsToCsv-Cksb9D49.mjs";import{n as bn,r as xn,t as Sn}from"./inquirer-DkFTQU00.mjs";import{t as Cn}from"./parseVariablesFromString-Cr3x2uq3.mjs";import{t as wn}from"./collectParquetFilesOrExit-BiksFI-Q.mjs";import{t as Tn}from"./collectCsvFilesOrExit-BqnmK63h.mjs";import{t as En}from"./parquetToCsvOneFile-CSVdrLvq.mjs";import{a as Dn,i as On,n as kn,o as An,r as jn,s as Mn,t as Nn}from"./writeCsv-D46aDkGf.mjs";import{t as Pn}from"./skipRequestDataSilos-BSNLacnR.mjs";import{t as Fn}from"./removeUnverifiedRequestIdentifiers-B9uPApVR.mjs";import{t as In}from"./updateConsentManagerVersionToLatest-CaEkTnlL.mjs";import{n as K,t as q}from"./mapConsentCsvRowsToInputs-MMPZwzrV.mjs";import{t as Ln}from"./pullConsentManagerMetrics-Cvex-gpd.mjs";import{n as Rn,r as zn,t as Bn}from"./buildXdiSyncEndpoint-B3zUrI16.mjs";import{t as Vn}from"./consentManagersToBusinessEntities-O4KBox9u.mjs";import{i as Hn,n as Un,r as Wn,t as Gn}from"./uploadConsents-CNyuYx0o.mjs";import{n as Kn,r as qn,t as Jn}from"./pushCronIdentifiersFromCsv-DjeY7TtK.mjs";import{t as Yn}from"./markRequestDataSiloIdsCompleted-PKCcn5wQ.mjs";import{t as Xn}from"./generateCrossAccountApiKeys-D6O_Qm3Y.mjs";import{t as Zn}from"./validateTranscendAuth-CnHMn77m.mjs";import{n as Qn,t as $n}from"./listFiles-CWHAdKY-.mjs";import{t as er}from"./pullAllDatapoints-H92qjLSx.mjs";import{t as tr}from"./pullManualEnrichmentIdentifiersToCsv-qjdNA75O.mjs";import{n as nr,r as rr,t as ir}from"./pushManualEnrichmentIdentifiersFromCsv-BDtMo13j.mjs";import{chunk as ar,difference as or}from"lodash-es";import{readFileSync as sr,readdirSync as cr,statSync as lr}from"node:fs";import{join as ur}from"node:path";import dr from"fast-glob";import J from"colors";import{UPDATE_OR_CREATE_COOKIES as Y,buildTranscendGraphQLClient as X,createSombraGotInstance as fr,fetchAllRequestIdentifiers as pr,fetchConsentManagerId as mr,makeGraphQLRequest as hr,syncCookies as gr,syncDataFlows as _r,validateSombraVersion as vr}from"@transcend-io/sdk";import{map as Z,mapSeries as yr}from"@transcend-io/utils";import{execSync as Q}from"child_process";async function $(e,t){let n=await mr(e,{logger:b});await yr(ar(t,100),async t=>{await hr(e,Y,{variables:{airgapBundleId:n,cookies:t.map(e=>({name:e.name,trackingPurposes:e.trackingPurposes&&e.trackingPurposes.length>0?e.trackingPurposes:void 0,description:e.description,service:e.service,status:e.status,attributes:e.attributes,isRegex:e.isRegex}))},logger:b})})}async function br(e,t){let n=!1;b.info(J.magenta(`Syncing "${t.length}" cookies...`));let r=t.filter(e=>t.filter(t=>e.name===t.name&&e.isRegex===t.isRegex).length>1);if(r.length>0)throw Error(`Failed to upload cookies as there were non-unique entries found: ${r.map(({name:e})=>e).join(`,`)}`);try{b.info(J.magenta(`Upserting "${t.length}" new cookies...`)),await $(e,t),b.info(J.green(`Successfully synced ${t.length} cookies!`))}catch(e){n=!0,b.error(J.red(`Failed to create cookies! - ${e.message}`))}return!n}async function xr({auth:e,sombraAuth:t,actions:n=[],statuses:r=[],identifierSearch:a,pageLimit:o=100,concurrency:s=1,transcendUrl:c=i,createdAtBefore:l,skipRequestIdentifiers:u=!1,createdAtAfter:d,updatedAtBefore:f,updatedAtAfter:p,isTest:m}){let h=X(c,e),g=await fr(c,e,{logger:b,sombraApiKey:t,sombraUrl:process.env.SOMBRA_URL}),_=``;l&&(_+=` before ${l.toISOString()}`),d&&(_+=`${_?`, and`:``} after ${d.toISOString()}`),b.info(J.magenta(`${n.length>0?`Pulling requests of type "${n.join(`" , "`)}"`:`Pulling all requests`}${_}`));let v=s>1&&d&&l,y=v?W(d,l,s):[{createdAtAfter:d,createdAtBefore:l}];v&&b.info(J.magenta(`Splitting date range into ${s} parallel chunks`));let x=(await Z(y,e=>U(h,{actions:n,text:a,statuses:r,createdAtBefore:e.createdAtBefore,createdAtAfter:e.createdAtAfter,updatedAtBefore:f,updatedAtAfter:p,isTest:m}),{concurrency:v?s:1})).flat();u||await vr(h,{logger:b});let S=u?x.map(e=>({...e,requestIdentifiers:[]})):await Z(x,async e=>{let t=await pr(h,g,{filterBy:{requestId:e.id},skipSombraCheck:!0,logger:b});return{...e,requestIdentifiers:t}},{concurrency:o});return b.info(J.magenta(`Pulled ${S.length} requests`)),{requestsWithRequestIdentifiers:S,requestsFormattedForCsv:S.map(G)}}function Sr(e,t=sr){try{return e?t(e,`utf8`):``}catch{return``}}async function Cr({auth:e,trackerStatus:t,file:n,classifyService:r=!1,transcendUrl:a=i}){let o=X(a,e);b.info(J.magenta(`Reading "${n}" from disk`)),await _r(o,K(H(n,w),t),{classifyService:r,logger:b})||(b.error(J.red(`Encountered error(s) syncing data flows from CSV, see logs above for more info. `)),process.exit(1))}async function wr({auth:e,trackerStatus:t,file:n,transcendUrl:r=i}){let a=X(r,e);b.info(J.magenta(`Reading "${n}" from disk`)),await gr(a,q(H(n,C),t),{logger:b})||(b.error(J.red(`Encountered error(s) syncing cookies from CSV, see logs above for more info. `)),process.exit(1))}function Tr(e){return cr(e).filter(t=>lr(ur(e,t)).isDirectory())}function Er(e){return e.replace(/(https?:\/\/[^\s]+)/g,`<link-omitted>`)}function Dr(e){return Object.entries(e).reduce((e,[t,n])=>n!=null&&n!==``&&!(Array.isArray(n)&&n.length===0)&&!(typeof n==`object`&&Object.keys(n).length===0)?Object.assign(e,{[t]:n}):e,{})}function Or({baseBranch:e,rootDirectory:t,githubRepo:n,excludedGlob:r=[],fileBlockList:i=[]}){Q(`git fetch origin ${e}`);let a=Q(`git ls-remote ${n} "refs/heads/${e}" | cut -f 1`,{encoding:`utf-8`}).split(`
1
+ import{i as e,n as t,r as n,t as r}from"./enums-OiLcZ26O.mjs";import{a as i,c as a,d as o,f as s,g as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,u as y}from"./constants-jjHIzHGm.mjs";import{t as b}from"./logger-zplFSeXU.mjs";import{$ as x,A as S,B as ee,C as te,D as C,E as ne,F as re,G as ie,H as ae,I as oe,J as se,K as ce,L as le,M as ue,N as w,O as de,P as fe,Q as T,R as E,S as D,T as O,U as k,V as A,W as j,X as M,Y as N,Z as P,_ as F,a as I,at as L,b as R,c as z,ct as B,d as V,dt as pe,et as me,f as he,ft as ge,g as _e,gt as ve,h as ye,ht as be,i as xe,it as Se,j as Ce,k as we,l as Te,lt as Ee,m as De,mt as Oe,n as ke,nt as Ae,o as je,ot as Me,p as Ne,pt as Pe,q as Fe,r as Ie,rt as Le,s as Re,st as ze,t as Be,tt as Ve,u as He,ut as Ue,v as We,w as Ge,x as Ke,y as qe,z as Je}from"./codecs-CTxFjCg4.mjs";import{a as Ye,i as Xe,n as Ze,o as Qe,r as $e,s as et,t as tt}from"./readTranscendYaml-BNn6-Ofi.mjs";import{i as nt,n as rt,r as it,t as at}from"./mergeTranscendInputs-DFQcbh8b.mjs";import{a as ot,c as st,i as ct,l as lt,n as ut,o as dt,r as ft,s as pt,t as mt,u as ht}from"./constants-D_HVDaOy.mjs";import{n as gt,t as _t}from"./fuzzyMatchColumns-CQCzpjWC.mjs";import{a as vt,c as yt,d as bt,f as xt,i as St,l as Ct,n as wt,o as Tt,r as Et,s as Dt,t as Ot,u as kt}from"./uploadPrivacyRequestsFromCsv-D3KSb1qH.mjs";import{n as At,t as jt}from"./parseAttributesFromString-CO16oAlx.mjs";import{n as H,t as Mt}from"./readCsv-DLg8pwjd.mjs";import{n as Nt,t as Pt}from"./pullUnstructuredSubDataPointRecommendations-YTBzfkRZ.mjs";import{a as Ft,i as It,n as Lt,o as Rt,r as zt,t as Bt}from"./request-BiPv6jmP.mjs";import{i as Vt,n as Ht,r as Ut,t as Wt}from"./pullTranscendConfiguration-B63M3ild.mjs";import{i as Gt,n as Kt,r as U,t as qt}from"./fetchAllRequests-2TZr-LfT.mjs";import{a as Jt,i as Yt,n as Xt,r as Zt,t as Qt}from"./pullChunkedCustomSiloOutstandingIdentifiers-D85P1W_8.mjs";import{n as $t,r as en,t as tn}from"./syncCodePackages-BHE2Tn1Q.mjs";import{t as nn}from"./markSilentPrivacyRequests-BiaButWF.mjs";import{a as rn,i as an,n as on,o as sn,r as cn,t as ln}from"./downloadPrivacyRequestFiles-B_BVxW5Z.mjs";import{n as un,r as dn,t as fn}from"./extractClientError-HZ2U7yqV.mjs";import{t as pn}from"./approvePrivacyRequests-B8x7oxTn.mjs";import{t as mn}from"./notifyPrivacyRequestsAdditionalTime-D3Vtvg5G.mjs";import{t as hn}from"./cancelPrivacyRequests-D0zNUNdS.mjs";import{n as gn,t as _n}from"./bulkRestartRequests-CysUfl98.mjs";import{t as vn}from"./skipPreflightJobs-Do_kwu3m.mjs";import{t as yn}from"./bulkRetryEnrichers-DaLE67Ht.mjs";import{t as bn}from"./retryRequestDataSilos-BfckLjOJ.mjs";import{n as W,r as G,t as xn}from"./streamPrivacyRequestsToCsv-CbJfhV6A.mjs";import{n as Sn,r as Cn,t as wn}from"./inquirer-BeaBetMO.mjs";import{t as Tn}from"./parseVariablesFromString-BOSfQ4QF.mjs";import{t as En}from"./collectParquetFilesOrExit-DVlv5ctt.mjs";import{t as Dn}from"./collectCsvFilesOrExit-B1VOVGWN.mjs";import{t as On}from"./parquetToCsvOneFile-ChmPC6dL.mjs";import{a as kn,i as An,n as jn,o as Mn,r as Nn,s as Pn,t as Fn}from"./writeCsv-D-2siSwE.mjs";import{t as In}from"./skipRequestDataSilos-BNDhdllD.mjs";import{t as Ln}from"./removeUnverifiedRequestIdentifiers-QmeqrmxM.mjs";import{t as Rn}from"./updateConsentManagerVersionToLatest-DEFwH4Se.mjs";import{n as K,t as q}from"./mapConsentCsvRowsToInputs-Dqb6WL4r.mjs";import{t as zn}from"./pullConsentManagerMetrics-Dv5n1ZGp.mjs";import{n as Bn,r as Vn,t as Hn}from"./buildXdiSyncEndpoint-DcrkZ2Gu.mjs";import{t as Un}from"./consentManagersToBusinessEntities-CBJ81aGO.mjs";import{i as Wn,n as Gn,r as Kn,t as qn}from"./uploadConsents-ChmFIw_j.mjs";import{n as Jn,r as Yn,t as Xn}from"./pushCronIdentifiersFromCsv-5ruUKHtL.mjs";import{t as Zn}from"./markRequestDataSiloIdsCompleted-B5N-cQWr.mjs";import{t as Qn}from"./generateCrossAccountApiKeys-Bnqgmj-H.mjs";import{t as $n}from"./validateTranscendAuth-D6Wr1cxY.mjs";import{n as er,t as tr}from"./listFiles-BdFUbX5x.mjs";import{t as nr}from"./pullAllDatapoints-uk5ggk6O.mjs";import{t as rr}from"./pullManualEnrichmentIdentifiersToCsv-DbNSrKEk.mjs";import{n as ir,r as ar,t as or}from"./pushManualEnrichmentIdentifiersFromCsv-B0i2239u.mjs";import{chunk as sr,difference as cr}from"lodash-es";import{readFileSync as lr,readdirSync as ur,statSync as dr}from"node:fs";import{join as fr}from"node:path";import J from"fast-glob";import Y from"colors";import{UPDATE_OR_CREATE_COOKIES as pr,buildTranscendGraphQLClient as X,createSombraGotInstance as mr,fetchAllRequestIdentifiers as hr,fetchConsentManagerId as gr,makeGraphQLRequest as _r,syncCookies as vr,syncDataFlows as yr,validateSombraVersion as br}from"@transcend-io/sdk";import{map as Z,mapSeries as xr}from"@transcend-io/utils";import{execSync as Q}from"child_process";async function $(e,t){let n=await gr(e,{logger:b});await xr(sr(t,100),async t=>{await _r(e,pr,{variables:{airgapBundleId:n,cookies:t.map(e=>({name:e.name,trackingPurposes:e.trackingPurposes&&e.trackingPurposes.length>0?e.trackingPurposes:void 0,description:e.description,service:e.service,status:e.status,attributes:e.attributes,isRegex:e.isRegex}))},logger:b})})}async function Sr(e,t){let n=!1;b.info(Y.magenta(`Syncing "${t.length}" cookies...`));let r=t.filter(e=>t.filter(t=>e.name===t.name&&e.isRegex===t.isRegex).length>1);if(r.length>0)throw Error(`Failed to upload cookies as there were non-unique entries found: ${r.map(({name:e})=>e).join(`,`)}`);try{b.info(Y.magenta(`Upserting "${t.length}" new cookies...`)),await $(e,t),b.info(Y.green(`Successfully synced ${t.length} cookies!`))}catch(e){n=!0,b.error(Y.red(`Failed to create cookies! - ${e.message}`))}return!n}async function Cr({auth:e,sombraAuth:t,actions:n=[],statuses:r=[],identifierSearch:a,pageLimit:o=100,concurrency:s=1,transcendUrl:c=i,createdAtBefore:l,skipRequestIdentifiers:u=!1,createdAtAfter:d,updatedAtBefore:f,updatedAtAfter:p,isTest:m}){let h=X(c,e),g=await mr(c,e,{logger:b,sombraApiKey:t,sombraUrl:process.env.SOMBRA_URL}),_=``;l&&(_+=` before ${l.toISOString()}`),d&&(_+=`${_?`, and`:``} after ${d.toISOString()}`),b.info(Y.magenta(`${n.length>0?`Pulling requests of type "${n.join(`" , "`)}"`:`Pulling all requests`}${_}`));let v=s>1&&d&&l,y=v?W(d,l,s):[{createdAtAfter:d,createdAtBefore:l}];v&&b.info(Y.magenta(`Splitting date range into ${s} parallel chunks`));let x=(await Z(y,e=>U(h,{actions:n,text:a,statuses:r,createdAtBefore:e.createdAtBefore,createdAtAfter:e.createdAtAfter,updatedAtBefore:f,updatedAtAfter:p,isTest:m}),{concurrency:v?s:1})).flat();u||await br(h,{logger:b});let S=u?x.map(e=>({...e,requestIdentifiers:[]})):await Z(x,async e=>{let t=await hr(h,g,{filterBy:{requestId:e.id},skipSombraCheck:!0,logger:b});return{...e,requestIdentifiers:t}},{concurrency:o});return b.info(Y.magenta(`Pulled ${S.length} requests`)),{requestsWithRequestIdentifiers:S,requestsFormattedForCsv:S.map(G)}}function wr(e,t=lr){try{return e?t(e,`utf8`):``}catch{return``}}async function Tr({auth:e,trackerStatus:t,file:n,classifyService:r=!1,transcendUrl:a=i}){let o=X(a,e);b.info(Y.magenta(`Reading "${n}" from disk`)),await yr(o,K(H(n,w),t),{classifyService:r,logger:b})||(b.error(Y.red(`Encountered error(s) syncing data flows from CSV, see logs above for more info. `)),process.exit(1))}async function Er({auth:e,trackerStatus:t,file:n,transcendUrl:r=i}){let a=X(r,e);b.info(Y.magenta(`Reading "${n}" from disk`)),await vr(a,q(H(n,C),t),{logger:b})||(b.error(Y.red(`Encountered error(s) syncing cookies from CSV, see logs above for more info. `)),process.exit(1))}function Dr(e){return ur(e).filter(t=>dr(fr(e,t)).isDirectory())}function Or(e){return e.replace(/(https?:\/\/[^\s]+)/g,`<link-omitted>`)}function kr(e){return Object.entries(e).reduce((e,[t,n])=>n!=null&&n!==``&&!(Array.isArray(n)&&n.length===0)&&!(typeof n==`object`&&Object.keys(n).length===0)?Object.assign(e,{[t]:n}):e,{})}function Ar({baseBranch:e,rootDirectory:t,githubRepo:n,excludedGlob:r=[],fileBlockList:i=[]}){Q(`git fetch origin ${e}`);let a=Q(`git ls-remote ${n} "refs/heads/${e}" | cut -f 1`,{encoding:`utf-8`}).split(`
2
2
  `)[0],o=Q(`git rev-parse HEAD`,{encoding:`utf-8`}).split(`
3
- `)[0];if(!a||!o)throw Error(`FAILED TO FIND COMMIT RANGE`);let s=or(Q(`git fetch && git diff --name-only "${e||a}...${o}" -- ${t}`,{encoding:`utf-8`}).split(`
4
- `).filter(e=>e),i),c=r.length>0?dr.sync(s,{ignore:r}):s,l={};return c.forEach(e=>{l[e]=Q(`git show ${o}:${e}`,{encoding:`utf-8`})}),{changedFiles:s,fileDiffs:l,repoName:n.split(`/`).pop().split(`.`)[0],commit:o}}export{v as ADMIN_DASH,p as ADMIN_DASH_DATAPOINTS,g as ADMIN_DASH_INTEGRATIONS,Rt as APPROVE_PRIVACY_REQUEST,zt as ASSESSMENT_TEMPLATES,Re as ActionInput,De as ActionItemCollectionInput,Pe as ActionItemInput,ye as ApiKeyInput,I as AssessmentAnswerOptionInput,ke as AssessmentDisplayLogicInput,Ie as AssessmentInput,z as AssessmentNestedRuleInput,Ce as AssessmentResourceInput,Be as AssessmentRetentionScheduleInput,V as AssessmentRuleInput,he as AssessmentSectionInput,je as AssessmentSectionQuestionInput,Te as AssessmentTemplateInput,bt as AttestedExtraIdentifiers,ve as AttributeInput,_e as AttributePreview,F as AttributeValueInput,ft as BLANK,ct as BULK_APPLY,He as BusinessEntityInput,Ft as CANCEL_PRIVACY_REQUEST,ut as CAN_APPLY_IN_BULK,ot as CachedFileState,it as CachedRequestState,Ge as CodePackageInput,R as CodePackageSdk,lt as ColumnName,We as ConsentManageExperienceInput,D as ConsentManagerInput,te as ConsentManagerServiceMetadata,Ue as ConsentPreferenceTopic,O as ConsentPreferenceTopicOptionValue,ne as ConsentPurpose,C as CookieCsvInput,de as CookieInput,Jt as CronIdentifier,Kn as CronIdentifierPush,Yt as CronPartition,u as DEBUG,i as DEFAULT_TRANSCEND_API,m as DEFAULT_TRANSCEND_API_KEY,_ as DEFAULT_TRANSCEND_CONSENT_API,Ht as DEFAULT_TRANSCEND_PULL_RESOURCES,Se as DataCategoryGuessInput,S as DataCategoryInput,xe as DataCategoryPreviewInput,ue as DataCategoryRecommendationInput,w as DataFlowCsvInput,fe as DataFlowInput,re as DataSiloInput,oe as DataSubjectInput,le as DatapointInput,E as DeletionDependencies,Ke as DeletionDependency,ee as DeletionDependencyInput,A as DeletionDependencyReset,jt as ENTRY_COUNT,nr as EnrichPrivacyRequest,ae as EnricherInput,k as FieldInput,dt as IDENTIFIER_BLOCK_LIST,Bn as IP_ADDRESS_REGEX,at as IS_REQUIRED,j as IdentifierInput,ie as ImportOnetrustAssessmentsInput,on as IntlMessage,ce as IntlMessageInput,st as NONE,Lt as NOTIFY_ADDITIONAL_TIME,r as OneTrustFileFormat,t as OneTrustPullResource,n as OneTrustPullSource,kt as ParsedAttributeInput,Ne as PartitionInput,se as PolicyInput,N as PreferenceWorkflowConfigInput,M as PreferenceWorkflowConfigPurposeInput,P as PrivacyCenterInput,Gt as PrivacyRequest,gt as PrivacyRequestInput,cn as PrivacyRequestResponse,T as ProcessingActivityInput,x as ProcessingPurposeInput,me as ProcessingPurposePreviewInput,ze as PromptAVendorEmailSettings,Gn as PurposeMap,Pt as REQUESTS,Nt as REQUESTS_COUNT,a as RETRYABLE_BATCH_STATUSES,Oe as RegionInput,Fe as RepositoryInput,nn as RequestFileMetadata,tn as RequestFileMetadataResponse,Wt as RequestPurposeTrigger,be as RiskAssignmentInput,L as RiskLogicInput,d as SCOPES_BY_TITLE,y as SCOPE_TITLES,Ae as SiloDiscoveryResultInput,Le as SoftwareDevelopmentKitInput,B as StoredApiKey,pt as SuccessfulRequest,o as TR_PULL_RESOURCE_SCOPE_MAP,s as TR_PUSH_RESOURCE_SCOPE_MAP,h as TR_YML_RESOURCE_TO_FIELD_NAME,we as TeamInput,Ve as TemplateInput,pe as TranscendInput,e as TranscendPullResource,It as UPDATE_PRIVACY_REQUEST,Un as USP_STRING_REGEX,$e as VARIABLE_PARAMETERS_NAME,Ye as VARIABLE_PARAMETERS_REGEXP,ge as VendorInput,Me as WebhookHeader,Ee as WorkflowConfigInput,Nn as appendCsvRowsOrdered,kn as appendCsvSync,dn as approvePrivacyRequests,Rn as buildXdiSyncEndpoint,hn as bulkRestartRequests,_n as bulkRetryEnrichers,pn as cancelPrivacyRequests,Tn as collectCsvFilesOrExit,wn as collectParquetFilesOrExit,Vn as consentManagersToBusinessEntities,$t as createCodePackage,Hn as createConsentToken,l as description,zn as domainToHost,sn as downloadPrivacyRequestFiles,rr as enrichPrivacyRequest,et as ensureAllDataSubjectsExist,un as extractClientError,Vt as fetchAllAssessmentTemplates,U as fetchAllRequests,Kt as fetchRequestDataSiloActiveCount,Ut as fetchRequestsTotalCount,$n as filterFileNames,Dr as filterNullishValuesFromObject,Dt as filterRows,G as formatRequestForCsv,ht as fuzzyMatchColumns,mt as fuzzySearch,Xn as generateCrossAccountApiKeys,an as getFileMetadataForPrivacyRequests,Or as getGitFilesThatChanged,vt as getUniqueValuesForColumn,jn as initCsvFile,Sn as inquirerAutoComplete,bn as inquirerConfirmBoolean,xn as inquirerConfirmText,Tr as listDirectories,Qn as listFiles,St as mapColumnsToAttributes,wt as mapColumnsToIdentifiers,q as mapCookieCsvRowsToInputs,xt as mapCsvColumnsToApi,Ct as mapCsvRowsToRequestInputs,K as mapDataFlowCsvRowsToInputs,yt as mapEnumValues,_t as mapRequestEnumValues,qn as markCronIdentifierCompleted,Yn as markRequestDataSiloIdsCompleted,en as markSilentPrivacyRequests,rt as mergeTranscendInputs,f as name,Tt as normalizeIdentifierValue,fn as notifyPrivacyRequestsAdditionalTime,En as parquetToCsvOneFile,Ot as parseAttributesFromString,At as parseCsv,On as parseFilePath,Ze as parseTranscendYaml,Cn as parseVariablesFromString,er as pullAllDatapoints,Xt as pullChunkedCustomSiloOutstandingIdentifiers,Ln as pullConsentManagerMetrics,qt as pullCronPageOfIdentifiers,tr as pullManualEnrichmentIdentifiersToCsv,xr as pullPrivacyRequests,Bt as pullTranscendConfiguration,Mt as pullUnstructuredSubDataPointRecommendations,Jn as pushCronIdentifiersFromCsv,ir as pushManualEnrichmentIdentifiersFromCsv,H as readCsv,Sr as readSafe,Je as readTranscendYaml,Er as removeLinks,Fn as removeUnverifiedRequestIdentifiers,qe as replaceVariablesInYaml,mn as restartPrivacyRequest,vn as retryRequestDataSilos,Xe as serializeTranscendYaml,gn as skipPreflightJobs,Pn as skipRequestDataSilos,W as splitDateRange,rn as streamPrivacyRequestFiles,yn as streamPrivacyRequestsToCsv,ln as submitPrivacyRequest,Zt as syncCodePackages,tt as syncConfigurationToTranscend,br as syncCookies,nt as syncDataSilos,Qt as updateCodePackages,In as updateConsentManagerVersionToLatest,$ as updateOrCreateCookies,Wn as uploadConsents,wr as uploadCookiesFromCsv,Cr as uploadDataFlowsFromCsv,Et as uploadPrivacyRequestsFromCsv,Zn as validateTranscendAuth,c as version,Dn as writeCsv,An as writeCsvSync,Mn as writeLargeCsv,Qe as writeTranscendYaml};
3
+ `)[0];if(!a||!o)throw Error(`FAILED TO FIND COMMIT RANGE`);let s=cr(Q(`git fetch && git diff --name-only "${e||a}...${o}" -- ${t}`,{encoding:`utf-8`}).split(`
4
+ `).filter(e=>e),i),c=r.length>0?J.sync(s,{ignore:r}):s,l={};return c.forEach(e=>{l[e]=Q(`git show ${o}:${e}`,{encoding:`utf-8`})}),{changedFiles:s,fileDiffs:l,repoName:n.split(`/`).pop().split(`.`)[0],commit:o}}export{v as ADMIN_DASH,p as ADMIN_DASH_DATAPOINTS,g as ADMIN_DASH_INTEGRATIONS,Bt as APPROVE_PRIVACY_REQUEST,Vt as ASSESSMENT_TEMPLATES,Be as ActionInput,ke as ActionItemCollectionInput,Ie as ActionItemInput,xe as ApiKeyInput,I as AssessmentAnswerOptionInput,je as AssessmentDisplayLogicInput,Re as AssessmentInput,z as AssessmentNestedRuleInput,Te as AssessmentResourceInput,He as AssessmentRetentionScheduleInput,V as AssessmentRuleInput,he as AssessmentSectionInput,Ne as AssessmentSectionQuestionInput,De as AssessmentTemplateInput,St as AttestedExtraIdentifiers,ye as AttributeInput,_e as AttributePreview,F as AttributeValueInput,mt as BLANK,ut as BULK_APPLY,We as BusinessEntityInput,Lt as CANCEL_PRIVACY_REQUEST,ft as CAN_APPLY_IN_BULK,ct as CachedFileState,ot as CachedRequestState,qe as CodePackageInput,R as CodePackageSdk,dt as ColumnName,Ke as ConsentManageExperienceInput,D as ConsentManagerInput,te as ConsentManagerServiceMetadata,Ge as ConsentPreferenceTopic,O as ConsentPreferenceTopicOptionValue,ne as ConsentPurpose,C as CookieCsvInput,de as CookieInput,Xt as CronIdentifier,Jn as CronIdentifierPush,Zt as CronPartition,u as DEBUG,i as DEFAULT_TRANSCEND_API,m as DEFAULT_TRANSCEND_API_KEY,_ as DEFAULT_TRANSCEND_CONSENT_API,Wt as DEFAULT_TRANSCEND_PULL_RESOURCES,we as DataCategoryGuessInput,S as DataCategoryInput,Ce as DataCategoryPreviewInput,ue as DataCategoryRecommendationInput,w as DataFlowCsvInput,fe as DataFlowInput,re as DataSiloInput,oe as DataSubjectInput,le as DatapointInput,E as DeletionDependencies,Je as DeletionDependency,ee as DeletionDependencyInput,A as DeletionDependencyReset,Nt as ENTRY_COUNT,ir as EnrichPrivacyRequest,ae as EnricherInput,k as FieldInput,pt as IDENTIFIER_BLOCK_LIST,Hn as IP_ADDRESS_REGEX,st as IS_REQUIRED,j as IdentifierInput,ie as ImportOnetrustAssessmentsInput,cn as IntlMessage,ce as IntlMessageInput,lt as NONE,zt as NOTIFY_ADDITIONAL_TIME,r as OneTrustFileFormat,t as OneTrustPullResource,n as OneTrustPullSource,jt as ParsedAttributeInput,Fe as PartitionInput,se as PolicyInput,N as PreferenceWorkflowConfigInput,M as PreferenceWorkflowConfigPurposeInput,P as PreflightInput,T as PrivacyCenterInput,qt as PrivacyRequest,vt as PrivacyRequestInput,un as PrivacyRequestResponse,x as ProcessingActivityInput,me as ProcessingPurposeInput,Ve as ProcessingPurposePreviewInput,Ae as PromptAVendorEmailSettings,qn as PurposeMap,It as REQUESTS,Ft as REQUESTS_COUNT,a as RETRYABLE_BATCH_STATUSES,Le as RegionInput,Se as RepositoryInput,an as RequestFileMetadata,rn as RequestFileMetadataResponse,Kt as RequestPurposeTrigger,L as RiskAssignmentInput,Me as RiskLogicInput,d as SCOPES_BY_TITLE,y as SCOPE_TITLES,ze as SiloDiscoveryResultInput,B as SoftwareDevelopmentKitInput,Ee as StoredApiKey,ht as SuccessfulRequest,o as TR_PULL_RESOURCE_SCOPE_MAP,s as TR_PUSH_RESOURCE_SCOPE_MAP,h as TR_YML_RESOURCE_TO_FIELD_NAME,Ue as TeamInput,pe as TemplateInput,ge as TranscendInput,e as TranscendPullResource,Rt as UPDATE_PRIVACY_REQUEST,Gn as USP_STRING_REGEX,tt as VARIABLE_PARAMETERS_NAME,Ze as VARIABLE_PARAMETERS_REGEXP,Pe as VendorInput,Oe as WebhookHeader,be as WorkflowConfigInput,Fn as appendCsvRowsOrdered,jn as appendCsvSync,pn as approvePrivacyRequests,Bn as buildXdiSyncEndpoint,_n as bulkRestartRequests,yn as bulkRetryEnrichers,hn as cancelPrivacyRequests,Dn as collectCsvFilesOrExit,En as collectParquetFilesOrExit,Un as consentManagersToBusinessEntities,tn as createCodePackage,Wn as createConsentToken,l as description,Vn as domainToHost,ln as downloadPrivacyRequestFiles,ar as enrichPrivacyRequest,nt as ensureAllDataSubjectsExist,fn as extractClientError,Ut as fetchAllAssessmentTemplates,U as fetchAllRequests,Jt as fetchRequestDataSiloActiveCount,Gt as fetchRequestsTotalCount,tr as filterFileNames,kr as filterNullishValuesFromObject,kt as filterRows,G as formatRequestForCsv,_t as fuzzyMatchColumns,gt as fuzzySearch,Qn as generateCrossAccountApiKeys,sn as getFileMetadataForPrivacyRequests,Ar as getGitFilesThatChanged,bt as getUniqueValuesForColumn,Nn as initCsvFile,wn as inquirerAutoComplete,Sn as inquirerConfirmBoolean,Cn as inquirerConfirmText,Dr as listDirectories,er as listFiles,wt as mapColumnsToAttributes,Et as mapColumnsToIdentifiers,q as mapCookieCsvRowsToInputs,Ct as mapCsvColumnsToApi,Tt as mapCsvRowsToRequestInputs,K as mapDataFlowCsvRowsToInputs,xt as mapEnumValues,yt as mapRequestEnumValues,Yn as markCronIdentifierCompleted,Zn as markRequestDataSiloIdsCompleted,nn as markSilentPrivacyRequests,at as mergeTranscendInputs,f as name,Dt as normalizeIdentifierValue,ve as normalizeTranscendInput,mn as notifyPrivacyRequestsAdditionalTime,On as parquetToCsvOneFile,At as parseAttributesFromString,Mt as parseCsv,An as parseFilePath,$e as parseTranscendYaml,Tn as parseVariablesFromString,nr as pullAllDatapoints,Qt as pullChunkedCustomSiloOutstandingIdentifiers,zn as pullConsentManagerMetrics,Yt as pullCronPageOfIdentifiers,rr as pullManualEnrichmentIdentifiersToCsv,Cr as pullPrivacyRequests,Ht as pullTranscendConfiguration,Pt as pullUnstructuredSubDataPointRecommendations,Xn as pushCronIdentifiersFromCsv,or as pushManualEnrichmentIdentifiersFromCsv,H as readCsv,wr as readSafe,Xe as readTranscendYaml,Or as removeLinks,Ln as removeUnverifiedRequestIdentifiers,Ye as replaceVariablesInYaml,gn as restartPrivacyRequest,bn as retryRequestDataSilos,Qe as serializeTranscendYaml,vn as skipPreflightJobs,In as skipRequestDataSilos,W as splitDateRange,on as streamPrivacyRequestFiles,xn as streamPrivacyRequestsToCsv,dn as submitPrivacyRequest,$t as syncCodePackages,rt as syncConfigurationToTranscend,Sr as syncCookies,it as syncDataSilos,en as updateCodePackages,Rn as updateConsentManagerVersionToLatest,$ as updateOrCreateCookies,Kn as uploadConsents,Er as uploadCookiesFromCsv,Tr as uploadDataFlowsFromCsv,Ot as uploadPrivacyRequestsFromCsv,$n as validateTranscendAuth,c as version,kn as writeCsv,Mn as writeCsvSync,Pn as writeLargeCsv,et as writeTranscendYaml};
5
5
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["syncCookies"],"sources":["../src/lib/graphql/syncCookies.ts","../src/lib/requests/pullPrivacyRequests.ts","../src/lib/helpers/readSafe.ts","../src/lib/consent-manager/uploadDataFlowsFromCsv.ts","../src/lib/consent-manager/uploadCookiesFromCsv.ts","../src/lib/api-keys/listDirectories.ts","../src/lib/ai/removeLinks.ts","../src/lib/ai/filterNullishValuesFromObject.ts","../src/lib/ai/getGitFilesThatChanged.ts"],"sourcesContent":["// import { keyBy } from 'lodash-es';\nimport {\n fetchConsentManagerId,\n makeGraphQLRequest,\n UPDATE_OR_CREATE_COOKIES,\n} from '@transcend-io/sdk';\nimport { mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { chunk } from 'lodash-es';\n\nimport { CookieInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\n\nconst MAX_PAGE_SIZE = 100;\n\n/**\n * Update or create cookies that already existed\n *\n * @param client - GraphQL client\n * @param cookieInputs - List of cookie input\n */\nexport async function updateOrCreateCookies(\n client: GraphQLClient,\n cookieInputs: CookieInput[],\n): Promise<void> {\n const airgapBundleId = await fetchConsentManagerId(client, { logger });\n\n // TODO: https://transcend.height.app/T-19841 - add with custom purposes\n // const purposes = await fetchAllPurposes(client);\n // const purposeNameToId = keyBy(purposes, 'name');\n\n await mapSeries(chunk(cookieInputs, MAX_PAGE_SIZE), async (page) => {\n await makeGraphQLRequest(client, UPDATE_OR_CREATE_COOKIES, {\n variables: {\n airgapBundleId,\n cookies: page.map((cookie) => ({\n name: cookie.name,\n trackingPurposes:\n cookie.trackingPurposes && cookie.trackingPurposes.length > 0\n ? cookie.trackingPurposes\n : undefined,\n // TODO: https://transcend.height.app/T-19841 - add with custom purposes\n // purposeIds: cookie.trackingPurposes\n // ? cookie.trackingPurposes\n // .filter((purpose) => purpose !== 'Unknown')\n // .map((purpose) => purposeNameToId[purpose].id)\n // : undefined,\n description: cookie.description,\n service: cookie.service,\n status: cookie.status,\n attributes: cookie.attributes,\n isRegex: cookie.isRegex,\n // TODO: https://transcend.height.app/T-23718\n // owners,\n // teams,\n })),\n },\n logger,\n });\n });\n}\n\n/**\n * Sync the set of cookies from the YML interface into the product\n *\n * @param client - GraphQL client\n * @param cookies - Cookies to sync\n * @returns True upon success, false upon failure\n */\nexport async function syncCookies(client: GraphQLClient, cookies: CookieInput[]): Promise<boolean> {\n let encounteredError = false;\n logger.info(colors.magenta(`Syncing \"${cookies.length}\" cookies...`));\n\n // Ensure no duplicates are being uploaded\n const notUnique = cookies.filter(\n (cookie) =>\n cookies.filter((cook) => cookie.name === cook.name && cookie.isRegex === cook.isRegex)\n .length > 1,\n );\n if (notUnique.length > 0) {\n throw new Error(\n `Failed to upload cookies as there were non-unique entries found: ${notUnique\n .map(({ name }) => name)\n .join(',')}`,\n );\n }\n\n try {\n logger.info(colors.magenta(`Upserting \"${cookies.length}\" new cookies...`));\n await updateOrCreateCookies(client, cookies);\n logger.info(colors.green(`Successfully synced ${cookies.length} cookies!`));\n } catch (err) {\n encounteredError = true;\n logger.error(colors.red(`Failed to create cookies! - ${err.message}`));\n }\n\n return !encounteredError;\n}\n","import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n fetchAllRequestIdentifiers,\n validateSombraVersion,\n type RequestIdentifier,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { fetchAllRequests } from '../graphql/index.js';\nimport { formatRequestForCsv, CsvRow, ExportedPrivacyRequest } from './formatRequestForCsv.js';\nimport { splitDateRange } from './splitDateRange.js';\n\n/**\n * Pull down a list of privacy requests\n *\n * @param options - Options\n * @returns The requests with request identifiers and requests formatted for CSV\n */\nexport async function pullPrivacyRequests({\n auth,\n sombraAuth,\n actions = [],\n statuses = [],\n identifierSearch,\n pageLimit = 100,\n concurrency = 1,\n transcendUrl = DEFAULT_TRANSCEND_API,\n createdAtBefore,\n skipRequestIdentifiers = false,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isTest,\n}: {\n /** Transcend API key authentication */\n auth: string;\n /** Search for a specific identifier */\n identifierSearch?: string;\n /** Sombra API key authentication */\n sombraAuth?: string;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** Statuses to filter on */\n statuses?: RequestStatus[];\n /** The request action to fetch */\n actions?: RequestAction[];\n /** Page limit when fetching requests */\n pageLimit?: number;\n /** Number of parallel date-range chunks */\n concurrency?: number;\n /** Filter for requests created before this date */\n createdAtBefore?: Date;\n /** Filter for requests created after this date */\n createdAtAfter?: Date;\n /** Filter for requests updated before this date */\n updatedAtBefore?: Date;\n /** Filter for requests updated after this date */\n updatedAtAfter?: Date;\n /** Return test requests */\n isTest?: boolean;\n /** Skip fetching request identifier */\n skipRequestIdentifiers?: boolean;\n}): Promise<{\n /** All request information with attached identifiers */\n requestsWithRequestIdentifiers: ExportedPrivacyRequest[];\n /** Requests that are formatted for CSV */\n requestsFormattedForCsv: CsvRow[];\n}> {\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const sombra = await createSombraGotInstance(transcendUrl, auth, {\n logger,\n sombraApiKey: sombraAuth,\n sombraUrl: process.env.SOMBRA_URL,\n });\n\n // Log date range\n let dateRange = '';\n if (createdAtBefore) {\n dateRange += ` before ${createdAtBefore.toISOString()}`;\n }\n if (createdAtAfter) {\n dateRange += `${dateRange ? ', and' : ''} after ${createdAtAfter.toISOString()}`;\n }\n logger.info(\n colors.magenta(\n `${\n actions.length > 0\n ? `Pulling requests of type \"${actions.join('\" , \"')}\"`\n : 'Pulling all requests'\n }${dateRange}`,\n ),\n );\n\n // Split into parallel date-range chunks when possible\n const useChunks = concurrency > 1 && createdAtAfter && createdAtBefore;\n const chunks = useChunks\n ? splitDateRange(createdAtAfter, createdAtBefore, concurrency)\n : [{ createdAtAfter, createdAtBefore }];\n\n if (useChunks) {\n logger.info(colors.magenta(`Splitting date range into ${concurrency} parallel chunks`));\n }\n\n // Fetch requests across all chunks in parallel\n const chunkResults = await map(\n chunks,\n (chunk) =>\n fetchAllRequests(client, {\n actions,\n text: identifierSearch,\n statuses,\n createdAtBefore: chunk.createdAtBefore,\n createdAtAfter: chunk.createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isTest,\n }),\n { concurrency: useChunks ? concurrency : 1 },\n );\n const requests = chunkResults.flat();\n\n // Validate Sombra version once before bulk-fetching identifiers\n if (!skipRequestIdentifiers) {\n await validateSombraVersion(client, { logger });\n }\n\n // Fetch the request identifiers for those requests\n const requestsWithRequestIdentifiers = skipRequestIdentifiers\n ? requests.map((request) => ({\n ...request,\n requestIdentifiers: [] as RequestIdentifier[],\n }))\n : await map(\n requests,\n async (request) => {\n const requestIdentifiers = await fetchAllRequestIdentifiers(client, sombra, {\n filterBy: { requestId: request.id },\n skipSombraCheck: true,\n logger,\n });\n return {\n ...request,\n requestIdentifiers,\n };\n },\n {\n concurrency: pageLimit,\n },\n );\n\n logger.info(colors.magenta(`Pulled ${requestsWithRequestIdentifiers.length} requests`));\n\n const data = requestsWithRequestIdentifiers.map(formatRequestForCsv);\n\n return { requestsWithRequestIdentifiers, requestsFormattedForCsv: data };\n}\n","import { readFileSync } from 'node:fs';\n\n/** Reads a UTF-8 file from disk. */\ntype ReadUtf8File = (path: string, encoding: 'utf8') => string;\n\n/**\n * Safely reads the contents of a file as a UTF-8 string.\n * Returns an empty string if the path is not provided or if reading fails.\n *\n * @param p - The path to the file to read.\n * @param readFile - File reader dependency.\n * @returns The file contents as a string, or an empty string on error.\n */\nexport function readSafe(p?: string, readFile: ReadUtf8File = readFileSync): string {\n try {\n return p ? readFile(p, 'utf8') : '';\n } catch {\n return '';\n }\n}\n","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 { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { readCsv } from '../requests/readCsv.js';\nimport { mapDataFlowCsvRowsToInputs } from './mapConsentCsvRowsToInputs.js';\n\n/**\n * Upload a set of data flows from CSV\n *\n * @param options - Options\n */\nexport async function uploadDataFlowsFromCsv({\n auth,\n trackerStatus,\n file,\n classifyService = false,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** Sombra API key authentication */\n trackerStatus: ConsentTrackerStatus;\n /** classify data flow service if missing */\n classifyService?: boolean;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<void> {\n // Build a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read from CSV the set of data flow inputs\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const dataFlowInputs = readCsv(file, DataFlowCsvInput);\n\n const validatedDataFlowInputs = mapDataFlowCsvRowsToInputs(dataFlowInputs, trackerStatus);\n\n // Upload the data flows into Transcend dashboard\n const syncedDataFlows = await syncDataFlows(client, validatedDataFlowInputs, {\n classifyService,\n logger,\n });\n\n // Log errors\n if (!syncedDataFlows) {\n logger.error(\n colors.red(\n 'Encountered error(s) syncing data flows from CSV, see logs above for more info. ',\n ),\n );\n process.exit(1);\n }\n}\n","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 { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { readCsv } from '../requests/readCsv.js';\nimport { mapCookieCsvRowsToInputs } from './mapConsentCsvRowsToInputs.js';\n\n/**\n * Upload a set of cookies from CSV\n *\n * @param options - Options\n */\nexport async function uploadCookiesFromCsv({\n auth,\n trackerStatus,\n file,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** Sombra API key authentication */\n trackerStatus: ConsentTrackerStatus;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<void> {\n // Build a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read from CSV the set of cookie inputs\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const cookieInputs = readCsv(file, CookieCsvInput);\n\n const validatedCookieInputs = mapCookieCsvRowsToInputs(cookieInputs, trackerStatus);\n\n // Upload the cookies into Transcend dashboard\n const syncedCookies = await syncCookies(client, validatedCookieInputs, { logger });\n\n // Log errors\n if (!syncedCookies) {\n logger.error(\n colors.red('Encountered error(s) syncing cookies from CSV, see logs above for more info. '),\n );\n process.exit(1);\n }\n}\n","import { readdirSync, statSync } from 'node:fs';\nimport { join } from 'node:path';\n\n/**\n * List the folders in a directory\n *\n * @param startDir - The base directory to list from\n * @returns The list of folders in that directory\n */\nexport function listDirectories(startDir: string): string[] {\n return readdirSync(startDir).filter((entryName) =>\n statSync(join(startDir, entryName)).isDirectory(),\n );\n}\n","/**\n * Remove links from a string\n *\n * @param inputString - String\n * @returns String without links\n */\nexport function removeLinks(inputString: string): string {\n const regex = /(https?:\\/\\/[^\\s]+)/g;\n return inputString.replace(regex, '<link-omitted>');\n}\n","import { ObjByString } from '@transcend-io/type-utils';\n\n/**\n * Given an object, remove all keys that are null-ish\n *\n * @param obj - Object\n * @returns Object with null-ish values removed\n */\nexport function filterNullishValuesFromObject<T extends ObjByString>(obj: T): T {\n return Object.entries(obj).reduce(\n (acc, [k, v]) =>\n v !== null &&\n v !== undefined &&\n v !== '' &&\n !(Array.isArray(v) && v.length === 0) &&\n !(typeof v === 'object' && Object.keys(v).length === 0)\n ? Object.assign(acc, { [k]: v })\n : acc,\n {} as T,\n );\n}\n","import { execSync } from 'child_process';\n\nimport fastGlob from 'fast-glob';\nimport { difference } from 'lodash-es';\n\n/**\n * Function thats gets the git files that have changed\n * and returns the code\n *\n * @param options - Options\n * @returns Changes files and diffs\n */\nexport function getGitFilesThatChanged({\n baseBranch,\n rootDirectory,\n githubRepo,\n excludedGlob = [],\n fileBlockList = [],\n}: {\n /** Base branch */\n baseBranch: string;\n /** Github repo name */\n githubRepo: string;\n /** Root directory */\n rootDirectory: string;\n /** A glob that excludes files */\n excludedGlob?: string[];\n /** Block list of files to not process */\n fileBlockList?: string[];\n}): {\n /** The list of files that changed */\n changedFiles: string[];\n /** Github repo name */\n repoName: string;\n /** Current commit */\n commit: string;\n /** File diffs */\n fileDiffs: { [k in string]: string };\n} {\n // Pull base branch\n execSync(`git fetch origin ${baseBranch}`);\n\n // Latest commit on base branch. If we are on the base branch, we take the prior commit\n const latestBasedCommit = execSync(\n `git ls-remote ${githubRepo} \"refs/heads/${baseBranch}\" | cut -f 1`,\n { encoding: 'utf-8' },\n ).split('\\n')[0];\n\n // This commit\n const latestThisCommit = execSync('git rev-parse HEAD', {\n encoding: 'utf-8',\n }).split('\\n')[0];\n\n // Ensure commits are present\n if (!latestBasedCommit || !latestThisCommit) {\n throw new Error('FAILED TO FIND COMMIT RANGE');\n }\n\n // Get the diff between the given branch and base branch\n const diff = execSync(\n `git fetch && git diff --name-only \"${\n baseBranch || latestBasedCommit\n }...${latestThisCommit}\" -- ${rootDirectory}`,\n { encoding: 'utf-8' },\n );\n\n // Filter out block list\n const changedFiles = difference(\n diff.split('\\n').filter((f) => f),\n fileBlockList,\n );\n\n // Filter out globs\n const filteredChanges =\n excludedGlob.length > 0 ? fastGlob.sync(changedFiles, { ignore: excludedGlob }) : changedFiles;\n\n // Get the contents of only the changed files\n const fileDiffs: { [k in string]: string } = {};\n filteredChanges.forEach((file) => {\n const contents = execSync(`git show ${latestThisCommit}:${file}`, {\n encoding: 'utf-8',\n });\n fileDiffs[file] = contents;\n });\n\n // Pull the github repo name\n const repoName = githubRepo.split('/').pop()!.split('.')[0];\n\n return {\n changedFiles,\n fileDiffs,\n repoName,\n commit: latestThisCommit,\n };\n}\n"],"mappings":"wqJAsBA,eAAsB,EACpB,EACA,EACe,CACf,IAAM,EAAiB,MAAM,GAAsB,EAAQ,CAAE,SAAQ,CAAC,CAMtE,MAAM,GAAU,GAAM,EAAc,IAAc,CAAE,KAAO,IAAS,CAClE,MAAM,GAAmB,EAAQ,EAA0B,CACzD,UAAW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mB,EAAS,qBAAsB,CACtD,SAAU,QACX,CAAC,CAAC,MAAM;EAAK,CAAC,GAGf,GAAI,CAAC,GAAqB,CAAC,EACzB,MAAU,MAAM,8BAA8B,CAYhD,IAAM,EAAe,GARR,EACX,sCACE,GAAc,EACf,KAAK,EAAiB,OAAO,IAC9B,CAAE,SAAU,QAAS,CAKjB,CAAC,MAAM;EAAK,CAAC,OAAQ,GAAM,EAAE,CACjC,EACD,CAGK,EACJ,EAAa,OAAS,EAAI,GAAS,KAAK,EAAc,CAAE,OAAQ,EAAc,CAAC,CAAG,EAG9E,EAAuC,EAAE,CAW/C,OAVA,EAAgB,QAAS,GAAS,CAIhC,EAAU,GAHO,EAAS,YAAY,EAAiB,GAAG,IAAQ,CAChE,SAAU,QACX,CACyB,EAC1B,CAKK,CACL,eACA,YACA,SALe,EAAW,MAAM,IAAI,CAAC,KAAK,CAAE,MAAM,IAAI,CAAC,GAMvD,OAAQ,EACT"}
1
+ {"version":3,"file":"index.mjs","names":["syncCookies"],"sources":["../src/lib/graphql/syncCookies.ts","../src/lib/requests/pullPrivacyRequests.ts","../src/lib/helpers/readSafe.ts","../src/lib/consent-manager/uploadDataFlowsFromCsv.ts","../src/lib/consent-manager/uploadCookiesFromCsv.ts","../src/lib/api-keys/listDirectories.ts","../src/lib/ai/removeLinks.ts","../src/lib/ai/filterNullishValuesFromObject.ts","../src/lib/ai/getGitFilesThatChanged.ts"],"sourcesContent":["// import { keyBy } from 'lodash-es';\nimport {\n fetchConsentManagerId,\n makeGraphQLRequest,\n UPDATE_OR_CREATE_COOKIES,\n} from '@transcend-io/sdk';\nimport { mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { chunk } from 'lodash-es';\n\nimport { CookieInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\n\nconst MAX_PAGE_SIZE = 100;\n\n/**\n * Update or create cookies that already existed\n *\n * @param client - GraphQL client\n * @param cookieInputs - List of cookie input\n */\nexport async function updateOrCreateCookies(\n client: GraphQLClient,\n cookieInputs: CookieInput[],\n): Promise<void> {\n const airgapBundleId = await fetchConsentManagerId(client, { logger });\n\n // TODO: https://transcend.height.app/T-19841 - add with custom purposes\n // const purposes = await fetchAllPurposes(client);\n // const purposeNameToId = keyBy(purposes, 'name');\n\n await mapSeries(chunk(cookieInputs, MAX_PAGE_SIZE), async (page) => {\n await makeGraphQLRequest(client, UPDATE_OR_CREATE_COOKIES, {\n variables: {\n airgapBundleId,\n cookies: page.map((cookie) => ({\n name: cookie.name,\n trackingPurposes:\n cookie.trackingPurposes && cookie.trackingPurposes.length > 0\n ? cookie.trackingPurposes\n : undefined,\n // TODO: https://transcend.height.app/T-19841 - add with custom purposes\n // purposeIds: cookie.trackingPurposes\n // ? cookie.trackingPurposes\n // .filter((purpose) => purpose !== 'Unknown')\n // .map((purpose) => purposeNameToId[purpose].id)\n // : undefined,\n description: cookie.description,\n service: cookie.service,\n status: cookie.status,\n attributes: cookie.attributes,\n isRegex: cookie.isRegex,\n // TODO: https://transcend.height.app/T-23718\n // owners,\n // teams,\n })),\n },\n logger,\n });\n });\n}\n\n/**\n * Sync the set of cookies from the YML interface into the product\n *\n * @param client - GraphQL client\n * @param cookies - Cookies to sync\n * @returns True upon success, false upon failure\n */\nexport async function syncCookies(client: GraphQLClient, cookies: CookieInput[]): Promise<boolean> {\n let encounteredError = false;\n logger.info(colors.magenta(`Syncing \"${cookies.length}\" cookies...`));\n\n // Ensure no duplicates are being uploaded\n const notUnique = cookies.filter(\n (cookie) =>\n cookies.filter((cook) => cookie.name === cook.name && cookie.isRegex === cook.isRegex)\n .length > 1,\n );\n if (notUnique.length > 0) {\n throw new Error(\n `Failed to upload cookies as there were non-unique entries found: ${notUnique\n .map(({ name }) => name)\n .join(',')}`,\n );\n }\n\n try {\n logger.info(colors.magenta(`Upserting \"${cookies.length}\" new cookies...`));\n await updateOrCreateCookies(client, cookies);\n logger.info(colors.green(`Successfully synced ${cookies.length} cookies!`));\n } catch (err) {\n encounteredError = true;\n logger.error(colors.red(`Failed to create cookies! - ${err.message}`));\n }\n\n return !encounteredError;\n}\n","import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n fetchAllRequestIdentifiers,\n validateSombraVersion,\n type RequestIdentifier,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { fetchAllRequests } from '../graphql/index.js';\nimport { formatRequestForCsv, CsvRow, ExportedPrivacyRequest } from './formatRequestForCsv.js';\nimport { splitDateRange } from './splitDateRange.js';\n\n/**\n * Pull down a list of privacy requests\n *\n * @param options - Options\n * @returns The requests with request identifiers and requests formatted for CSV\n */\nexport async function pullPrivacyRequests({\n auth,\n sombraAuth,\n actions = [],\n statuses = [],\n identifierSearch,\n pageLimit = 100,\n concurrency = 1,\n transcendUrl = DEFAULT_TRANSCEND_API,\n createdAtBefore,\n skipRequestIdentifiers = false,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isTest,\n}: {\n /** Transcend API key authentication */\n auth: string;\n /** Search for a specific identifier */\n identifierSearch?: string;\n /** Sombra API key authentication */\n sombraAuth?: string;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** Statuses to filter on */\n statuses?: RequestStatus[];\n /** The request action to fetch */\n actions?: RequestAction[];\n /** Page limit when fetching requests */\n pageLimit?: number;\n /** Number of parallel date-range chunks */\n concurrency?: number;\n /** Filter for requests created before this date */\n createdAtBefore?: Date;\n /** Filter for requests created after this date */\n createdAtAfter?: Date;\n /** Filter for requests updated before this date */\n updatedAtBefore?: Date;\n /** Filter for requests updated after this date */\n updatedAtAfter?: Date;\n /** Return test requests */\n isTest?: boolean;\n /** Skip fetching request identifier */\n skipRequestIdentifiers?: boolean;\n}): Promise<{\n /** All request information with attached identifiers */\n requestsWithRequestIdentifiers: ExportedPrivacyRequest[];\n /** Requests that are formatted for CSV */\n requestsFormattedForCsv: CsvRow[];\n}> {\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const sombra = await createSombraGotInstance(transcendUrl, auth, {\n logger,\n sombraApiKey: sombraAuth,\n sombraUrl: process.env.SOMBRA_URL,\n });\n\n // Log date range\n let dateRange = '';\n if (createdAtBefore) {\n dateRange += ` before ${createdAtBefore.toISOString()}`;\n }\n if (createdAtAfter) {\n dateRange += `${dateRange ? ', and' : ''} after ${createdAtAfter.toISOString()}`;\n }\n logger.info(\n colors.magenta(\n `${\n actions.length > 0\n ? `Pulling requests of type \"${actions.join('\" , \"')}\"`\n : 'Pulling all requests'\n }${dateRange}`,\n ),\n );\n\n // Split into parallel date-range chunks when possible\n const useChunks = concurrency > 1 && createdAtAfter && createdAtBefore;\n const chunks = useChunks\n ? splitDateRange(createdAtAfter, createdAtBefore, concurrency)\n : [{ createdAtAfter, createdAtBefore }];\n\n if (useChunks) {\n logger.info(colors.magenta(`Splitting date range into ${concurrency} parallel chunks`));\n }\n\n // Fetch requests across all chunks in parallel\n const chunkResults = await map(\n chunks,\n (chunk) =>\n fetchAllRequests(client, {\n actions,\n text: identifierSearch,\n statuses,\n createdAtBefore: chunk.createdAtBefore,\n createdAtAfter: chunk.createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isTest,\n }),\n { concurrency: useChunks ? concurrency : 1 },\n );\n const requests = chunkResults.flat();\n\n // Validate Sombra version once before bulk-fetching identifiers\n if (!skipRequestIdentifiers) {\n await validateSombraVersion(client, { logger });\n }\n\n // Fetch the request identifiers for those requests\n const requestsWithRequestIdentifiers = skipRequestIdentifiers\n ? requests.map((request) => ({\n ...request,\n requestIdentifiers: [] as RequestIdentifier[],\n }))\n : await map(\n requests,\n async (request) => {\n const requestIdentifiers = await fetchAllRequestIdentifiers(client, sombra, {\n filterBy: { requestId: request.id },\n skipSombraCheck: true,\n logger,\n });\n return {\n ...request,\n requestIdentifiers,\n };\n },\n {\n concurrency: pageLimit,\n },\n );\n\n logger.info(colors.magenta(`Pulled ${requestsWithRequestIdentifiers.length} requests`));\n\n const data = requestsWithRequestIdentifiers.map(formatRequestForCsv);\n\n return { requestsWithRequestIdentifiers, requestsFormattedForCsv: data };\n}\n","import { readFileSync } from 'node:fs';\n\n/** Reads a UTF-8 file from disk. */\ntype ReadUtf8File = (path: string, encoding: 'utf8') => string;\n\n/**\n * Safely reads the contents of a file as a UTF-8 string.\n * Returns an empty string if the path is not provided or if reading fails.\n *\n * @param p - The path to the file to read.\n * @param readFile - File reader dependency.\n * @returns The file contents as a string, or an empty string on error.\n */\nexport function readSafe(p?: string, readFile: ReadUtf8File = readFileSync): string {\n try {\n return p ? readFile(p, 'utf8') : '';\n } catch {\n return '';\n }\n}\n","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 { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { readCsv } from '../requests/readCsv.js';\nimport { mapDataFlowCsvRowsToInputs } from './mapConsentCsvRowsToInputs.js';\n\n/**\n * Upload a set of data flows from CSV\n *\n * @param options - Options\n */\nexport async function uploadDataFlowsFromCsv({\n auth,\n trackerStatus,\n file,\n classifyService = false,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** Sombra API key authentication */\n trackerStatus: ConsentTrackerStatus;\n /** classify data flow service if missing */\n classifyService?: boolean;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<void> {\n // Build a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read from CSV the set of data flow inputs\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const dataFlowInputs = readCsv(file, DataFlowCsvInput);\n\n const validatedDataFlowInputs = mapDataFlowCsvRowsToInputs(dataFlowInputs, trackerStatus);\n\n // Upload the data flows into Transcend dashboard\n const syncedDataFlows = await syncDataFlows(client, validatedDataFlowInputs, {\n classifyService,\n logger,\n });\n\n // Log errors\n if (!syncedDataFlows) {\n logger.error(\n colors.red(\n 'Encountered error(s) syncing data flows from CSV, see logs above for more info. ',\n ),\n );\n process.exit(1);\n }\n}\n","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 { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { readCsv } from '../requests/readCsv.js';\nimport { mapCookieCsvRowsToInputs } from './mapConsentCsvRowsToInputs.js';\n\n/**\n * Upload a set of cookies from CSV\n *\n * @param options - Options\n */\nexport async function uploadCookiesFromCsv({\n auth,\n trackerStatus,\n file,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** Sombra API key authentication */\n trackerStatus: ConsentTrackerStatus;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<void> {\n // Build a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read from CSV the set of cookie inputs\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const cookieInputs = readCsv(file, CookieCsvInput);\n\n const validatedCookieInputs = mapCookieCsvRowsToInputs(cookieInputs, trackerStatus);\n\n // Upload the cookies into Transcend dashboard\n const syncedCookies = await syncCookies(client, validatedCookieInputs, { logger });\n\n // Log errors\n if (!syncedCookies) {\n logger.error(\n colors.red('Encountered error(s) syncing cookies from CSV, see logs above for more info. '),\n );\n process.exit(1);\n }\n}\n","import { readdirSync, statSync } from 'node:fs';\nimport { join } from 'node:path';\n\n/**\n * List the folders in a directory\n *\n * @param startDir - The base directory to list from\n * @returns The list of folders in that directory\n */\nexport function listDirectories(startDir: string): string[] {\n return readdirSync(startDir).filter((entryName) =>\n statSync(join(startDir, entryName)).isDirectory(),\n );\n}\n","/**\n * Remove links from a string\n *\n * @param inputString - String\n * @returns String without links\n */\nexport function removeLinks(inputString: string): string {\n const regex = /(https?:\\/\\/[^\\s]+)/g;\n return inputString.replace(regex, '<link-omitted>');\n}\n","import { ObjByString } from '@transcend-io/type-utils';\n\n/**\n * Given an object, remove all keys that are null-ish\n *\n * @param obj - Object\n * @returns Object with null-ish values removed\n */\nexport function filterNullishValuesFromObject<T extends ObjByString>(obj: T): T {\n return Object.entries(obj).reduce(\n (acc, [k, v]) =>\n v !== null &&\n v !== undefined &&\n v !== '' &&\n !(Array.isArray(v) && v.length === 0) &&\n !(typeof v === 'object' && Object.keys(v).length === 0)\n ? Object.assign(acc, { [k]: v })\n : acc,\n {} as T,\n );\n}\n","import { execSync } from 'child_process';\n\nimport fastGlob from 'fast-glob';\nimport { difference } from 'lodash-es';\n\n/**\n * Function thats gets the git files that have changed\n * and returns the code\n *\n * @param options - Options\n * @returns Changes files and diffs\n */\nexport function getGitFilesThatChanged({\n baseBranch,\n rootDirectory,\n githubRepo,\n excludedGlob = [],\n fileBlockList = [],\n}: {\n /** Base branch */\n baseBranch: string;\n /** Github repo name */\n githubRepo: string;\n /** Root directory */\n rootDirectory: string;\n /** A glob that excludes files */\n excludedGlob?: string[];\n /** Block list of files to not process */\n fileBlockList?: string[];\n}): {\n /** The list of files that changed */\n changedFiles: string[];\n /** Github repo name */\n repoName: string;\n /** Current commit */\n commit: string;\n /** File diffs */\n fileDiffs: { [k in string]: string };\n} {\n // Pull base branch\n execSync(`git fetch origin ${baseBranch}`);\n\n // Latest commit on base branch. If we are on the base branch, we take the prior commit\n const latestBasedCommit = execSync(\n `git ls-remote ${githubRepo} \"refs/heads/${baseBranch}\" | cut -f 1`,\n { encoding: 'utf-8' },\n ).split('\\n')[0];\n\n // This commit\n const latestThisCommit = execSync('git rev-parse HEAD', {\n encoding: 'utf-8',\n }).split('\\n')[0];\n\n // Ensure commits are present\n if (!latestBasedCommit || !latestThisCommit) {\n throw new Error('FAILED TO FIND COMMIT RANGE');\n }\n\n // Get the diff between the given branch and base branch\n const diff = execSync(\n `git fetch && git diff --name-only \"${\n baseBranch || latestBasedCommit\n }...${latestThisCommit}\" -- ${rootDirectory}`,\n { encoding: 'utf-8' },\n );\n\n // Filter out block list\n const changedFiles = difference(\n diff.split('\\n').filter((f) => f),\n fileBlockList,\n );\n\n // Filter out globs\n const filteredChanges =\n excludedGlob.length > 0 ? fastGlob.sync(changedFiles, { ignore: excludedGlob }) : changedFiles;\n\n // Get the contents of only the changed files\n const fileDiffs: { [k in string]: string } = {};\n filteredChanges.forEach((file) => {\n const contents = execSync(`git show ${latestThisCommit}:${file}`, {\n encoding: 'utf-8',\n });\n fileDiffs[file] = contents;\n });\n\n // Pull the github repo name\n const repoName = githubRepo.split('/').pop()!.split('.')[0];\n\n return {\n changedFiles,\n fileDiffs,\n repoName,\n commit: latestThisCommit,\n };\n}\n"],"mappings":"0rJAsBA,eAAsB,EACpB,EACA,EACe,CACf,IAAM,EAAiB,MAAM,GAAsB,EAAQ,CAAE,SAAQ,CAAC,CAMtE,MAAM,GAAU,GAAM,EAAc,IAAc,CAAE,KAAO,IAAS,CAClE,MAAM,GAAmB,EAAQ,GAA0B,CACzD,UAAW,CACT,iBACA,QAAS,EAAK,IAAK,IAAY,CAC7B,KAAM,EAAO,KACb,iBACE,EAAO,kBAAoB,EAAO,iBAAiB,OAAS,EACxD,EAAO,iBACP,IAAA,GAON,YAAa,EAAO,YACpB,QAAS,EAAO,QAChB,OAAQ,EAAO,OACf,WAAY,EAAO,WACnB,QAAS,EAAO,QAIjB,EAAE,CACJ,CACD,SACD,CAAC,EACF,CAUJ,eAAsB,GAAY,EAAuB,EAA0C,CACjG,IAAI,EAAmB,GACvB,EAAO,KAAK,EAAO,QAAQ,YAAY,EAAQ,OAAO,cAAc,CAAC,CAGrE,IAAM,EAAY,EAAQ,OACvB,GAC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,CAIhC,EAAU,GAHO,EAAS,YAAY,EAAiB,GAAG,IAAQ,CAChE,SAAU,QACX,CACyB,EAC1B,CAKK,CACL,eACA,YACA,SALe,EAAW,MAAM,IAAI,CAAC,KAAK,CAAE,MAAM,IAAI,CAAC,GAMvD,OAAQ,EACT"}
@@ -1,2 +1,2 @@
1
1
  import e from"colors";import{bootstrap as t}from"global-agent";import{ProxyAgent as n,setGlobalDispatcher as r}from"undici";import i from"yargs-parser";const a={bootstrap:t,createProxyAgent:e=>new n(e),logger:console,process,setGlobalDispatcher:r};function o(t=a){let{httpProxy:n=t.process.env.http_proxy}=i(t.process.argv.slice(2));n&&(t.logger.info(e.green(`Initializing proxy: ${n}`)),t.process.env.GLOBAL_AGENT_HTTP_PROXY=n,t.bootstrap(),t.setGlobalDispatcher(t.createProxyAgent(n)))}export{o as t};
2
- //# sourceMappingURL=initializeCliRuntime-802-P8MC.mjs.map
2
+ //# sourceMappingURL=initializeCliRuntime-6wI_VIHV.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"initializeCliRuntime-802-P8MC.mjs","names":[],"sources":["../src/lib/cli/initializeCliRuntime.ts"],"sourcesContent":["import colors from 'colors';\nimport { bootstrap } from 'global-agent';\nimport { ProxyAgent, type Dispatcher, setGlobalDispatcher } from 'undici';\nimport yargs from 'yargs-parser';\n\nimport type { CliLogger } from '../../context.js';\n\n/** Runtime dependencies used to initialize CLI proxy support. */\nexport interface InitializeCliRuntimeDependencies {\n /** Bootstrap proxy support for Node.js request clients. */\n readonly bootstrap: () => void;\n /** Create a dispatcher that routes fetch requests through a proxy. */\n readonly createProxyAgent: (httpProxy: string) => Dispatcher;\n /** Logger used to report proxy initialization. */\n readonly logger: Pick<CliLogger, 'info'>;\n /** Process arguments and environment used to resolve proxy configuration. */\n readonly process: Pick<NodeJS.Process, 'argv' | 'env'>;\n /** Set the dispatcher used by Node.js fetch. */\n readonly setGlobalDispatcher: (dispatcher: Dispatcher) => void;\n}\n\nconst defaultDependencies: InitializeCliRuntimeDependencies = {\n bootstrap,\n createProxyAgent: (httpProxy) => new ProxyAgent(httpProxy),\n logger: console,\n process,\n setGlobalDispatcher,\n};\n\n/**\n * Initialize process-wide proxy support for an executable CLI invocation.\n *\n * @param dependencies - Runtime operations used to configure proxy support.\n */\nexport function initializeCliRuntime(\n dependencies: InitializeCliRuntimeDependencies = defaultDependencies,\n): void {\n const { httpProxy = dependencies.process.env.http_proxy } = yargs(\n dependencies.process.argv.slice(2),\n );\n if (!httpProxy) {\n return;\n }\n\n dependencies.logger.info(colors.green(`Initializing proxy: ${httpProxy}`));\n\n // Use global-agent, which overrides `request` based requests.\n dependencies.process.env.GLOBAL_AGENT_HTTP_PROXY = httpProxy;\n dependencies.bootstrap();\n\n // Use undici, which overrides `fetch` based requests.\n dependencies.setGlobalDispatcher(dependencies.createProxyAgent(httpProxy));\n}\n"],"mappings":"wJAqBA,MAAM,EAAwD,CAC5D,YACA,iBAAmB,GAAc,IAAI,EAAW,EAAU,CAC1D,OAAQ,QACR,QACA,sBACD,CAOD,SAAgB,EACd,EAAiD,EAC3C,CACN,GAAM,CAAE,YAAY,EAAa,QAAQ,IAAI,YAAe,EAC1D,EAAa,QAAQ,KAAK,MAAM,EAAE,CACnC,CACI,IAIL,EAAa,OAAO,KAAK,EAAO,MAAM,uBAAuB,IAAY,CAAC,CAG1E,EAAa,QAAQ,IAAI,wBAA0B,EACnD,EAAa,WAAW,CAGxB,EAAa,oBAAoB,EAAa,iBAAiB,EAAU,CAAC"}
1
+ {"version":3,"file":"initializeCliRuntime-6wI_VIHV.mjs","names":[],"sources":["../src/lib/cli/initializeCliRuntime.ts"],"sourcesContent":["import colors from 'colors';\nimport { bootstrap } from 'global-agent';\nimport { ProxyAgent, type Dispatcher, setGlobalDispatcher } from 'undici';\nimport yargs from 'yargs-parser';\n\nimport type { CliLogger } from '../../context.js';\n\n/** Runtime dependencies used to initialize CLI proxy support. */\nexport interface InitializeCliRuntimeDependencies {\n /** Bootstrap proxy support for Node.js request clients. */\n readonly bootstrap: () => void;\n /** Create a dispatcher that routes fetch requests through a proxy. */\n readonly createProxyAgent: (httpProxy: string) => Dispatcher;\n /** Logger used to report proxy initialization. */\n readonly logger: Pick<CliLogger, 'info'>;\n /** Process arguments and environment used to resolve proxy configuration. */\n readonly process: Pick<NodeJS.Process, 'argv' | 'env'>;\n /** Set the dispatcher used by Node.js fetch. */\n readonly setGlobalDispatcher: (dispatcher: Dispatcher) => void;\n}\n\nconst defaultDependencies: InitializeCliRuntimeDependencies = {\n bootstrap,\n createProxyAgent: (httpProxy) => new ProxyAgent(httpProxy),\n logger: console,\n process,\n setGlobalDispatcher,\n};\n\n/**\n * Initialize process-wide proxy support for an executable CLI invocation.\n *\n * @param dependencies - Runtime operations used to configure proxy support.\n */\nexport function initializeCliRuntime(\n dependencies: InitializeCliRuntimeDependencies = defaultDependencies,\n): void {\n const { httpProxy = dependencies.process.env.http_proxy } = yargs(\n dependencies.process.argv.slice(2),\n );\n if (!httpProxy) {\n return;\n }\n\n dependencies.logger.info(colors.green(`Initializing proxy: ${httpProxy}`));\n\n // Use global-agent, which overrides `request` based requests.\n dependencies.process.env.GLOBAL_AGENT_HTTP_PROXY = httpProxy;\n dependencies.bootstrap();\n\n // Use undici, which overrides `fetch` based requests.\n dependencies.setGlobalDispatcher(dependencies.createProxyAgent(httpProxy));\n}\n"],"mappings":"wJAqBA,MAAM,EAAwD,CAC5D,YACA,iBAAmB,GAAc,IAAI,EAAW,EAAU,CAC1D,OAAQ,QACR,QACA,sBACD,CAOD,SAAgB,EACd,EAAiD,EAC3C,CACN,GAAM,CAAE,YAAY,EAAa,QAAQ,IAAI,YAAe,EAC1D,EAAa,QAAQ,KAAK,MAAM,EAAE,CACnC,CACI,IAIL,EAAa,OAAO,KAAK,EAAO,MAAM,uBAAuB,IAAY,CAAC,CAG1E,EAAa,QAAQ,IAAI,wBAA0B,EACnD,EAAa,WAAW,CAGxB,EAAa,oBAAoB,EAAa,iBAAiB,EAAU,CAAC"}
@@ -1,2 +1,2 @@
1
- import{n as e}from"./fuzzyMatchColumns-OTsFJ21f.mjs";import t from"inquirer";import n from"inquirer-autocomplete-prompt";async function r({message:e}){let{response:n}=await t.prompt([{name:`response`,message:e,type:`confirm`}]);return n}async function i({message:e}){let{response:n}=await t.prompt([{name:`response`,message:e,type:`text`,validate:e=>e.trim().length>0}]);return n}async function a({defaultValue:r,values:i,message:a}){t.registerPrompt(`autocomplete`,n);let{response:o}=await t.prompt([{name:`response`,message:a,type:`autocomplete`,default:r,source:(t,n)=>n?i.filter(t=>typeof t==`string`&&e(n,t)):i}]);return o}export{r as n,i as r,a as t};
2
- //# sourceMappingURL=inquirer-DkFTQU00.mjs.map
1
+ import{n as e}from"./fuzzyMatchColumns-CQCzpjWC.mjs";import t from"inquirer";import n from"inquirer-autocomplete-prompt";async function r({message:e}){let{response:n}=await t.prompt([{name:`response`,message:e,type:`confirm`}]);return n}async function i({message:e}){let{response:n}=await t.prompt([{name:`response`,message:e,type:`text`,validate:e=>e.trim().length>0}]);return n}async function a({defaultValue:r,values:i,message:a}){t.registerPrompt(`autocomplete`,n);let{response:o}=await t.prompt([{name:`response`,message:a,type:`autocomplete`,default:r,source:(t,n)=>n?i.filter(t=>typeof t==`string`&&e(n,t)):i}]);return o}export{r as n,i as r,a as t};
2
+ //# sourceMappingURL=inquirer-BeaBetMO.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"inquirer-DkFTQU00.mjs","names":[],"sources":["../src/lib/helpers/inquirer.ts"],"sourcesContent":["import { ObjByString } from '@transcend-io/type-utils';\nimport inquirer from 'inquirer';\nimport autoCompletePrompt from 'inquirer-autocomplete-prompt';\n\nimport { fuzzySearch } from '../requests/index.js';\n\n/**\n * Inquirer confirm text\n *\n * @param options - Options\n * @returns The response\n */\nexport async function inquirerConfirmBoolean({\n message,\n}: {\n /** Message */\n message: string;\n}): Promise<boolean> {\n const { response } = await inquirer.prompt<{\n /** confirmation */\n response: boolean;\n }>([\n {\n name: 'response',\n message,\n type: 'confirm',\n },\n ]);\n return response;\n}\n\n/**\n * Inquirer confirm text\n *\n * @param options - Options\n * @returns The response\n */\nexport async function inquirerConfirmText({\n message,\n}: {\n /** Message */\n message: string;\n}): Promise<string> {\n const { response } = await inquirer.prompt<{\n /** confirmation */\n response: string;\n }>([\n {\n name: 'response',\n message,\n type: 'text',\n validate: (x) => x.trim().length > 0,\n },\n ]);\n return response;\n}\n\n/**\n * Inquirer auto complete\n *\n * @param options - Options\n * @returns The response\n */\nexport async function inquirerAutoComplete({\n defaultValue,\n values,\n message,\n}: {\n /** Default value */\n defaultValue?: string;\n /** Message */\n message: string;\n /** Values to select */\n values: string[];\n}): Promise<string> {\n inquirer.registerPrompt('autocomplete', autoCompletePrompt);\n const { response } = await inquirer.prompt<{\n /** confirmation */\n response: string;\n }>([\n {\n name: 'response',\n message,\n type: 'autocomplete',\n default: defaultValue,\n source: (answersSoFar: ObjByString, input: string) =>\n !input ? values : values.filter((x) => typeof x === 'string' && fuzzySearch(input, x)),\n },\n ]);\n return response;\n}\n"],"mappings":"yHAYA,eAAsB,EAAuB,CAC3C,WAImB,CACnB,GAAM,CAAE,YAAa,MAAM,EAAS,OAGjC,CACD,CACE,KAAM,WACN,UACA,KAAM,UACP,CACF,CAAC,CACF,OAAO,EAST,eAAsB,EAAoB,CACxC,WAIkB,CAClB,GAAM,CAAE,YAAa,MAAM,EAAS,OAGjC,CACD,CACE,KAAM,WACN,UACA,KAAM,OACN,SAAW,GAAM,EAAE,MAAM,CAAC,OAAS,EACpC,CACF,CAAC,CACF,OAAO,EAST,eAAsB,EAAqB,CACzC,eACA,SACA,WAQkB,CAClB,EAAS,eAAe,eAAgB,EAAmB,CAC3D,GAAM,CAAE,YAAa,MAAM,EAAS,OAGjC,CACD,CACE,KAAM,WACN,UACA,KAAM,eACN,QAAS,EACT,QAAS,EAA2B,IACjC,EAAiB,EAAO,OAAQ,GAAM,OAAO,GAAM,UAAY,EAAY,EAAO,EAAE,CAAC,CAA7E,EACZ,CACF,CAAC,CACF,OAAO"}
1
+ {"version":3,"file":"inquirer-BeaBetMO.mjs","names":[],"sources":["../src/lib/helpers/inquirer.ts"],"sourcesContent":["import { ObjByString } from '@transcend-io/type-utils';\nimport inquirer from 'inquirer';\nimport autoCompletePrompt from 'inquirer-autocomplete-prompt';\n\nimport { fuzzySearch } from '../requests/index.js';\n\n/**\n * Inquirer confirm text\n *\n * @param options - Options\n * @returns The response\n */\nexport async function inquirerConfirmBoolean({\n message,\n}: {\n /** Message */\n message: string;\n}): Promise<boolean> {\n const { response } = await inquirer.prompt<{\n /** confirmation */\n response: boolean;\n }>([\n {\n name: 'response',\n message,\n type: 'confirm',\n },\n ]);\n return response;\n}\n\n/**\n * Inquirer confirm text\n *\n * @param options - Options\n * @returns The response\n */\nexport async function inquirerConfirmText({\n message,\n}: {\n /** Message */\n message: string;\n}): Promise<string> {\n const { response } = await inquirer.prompt<{\n /** confirmation */\n response: string;\n }>([\n {\n name: 'response',\n message,\n type: 'text',\n validate: (x) => x.trim().length > 0,\n },\n ]);\n return response;\n}\n\n/**\n * Inquirer auto complete\n *\n * @param options - Options\n * @returns The response\n */\nexport async function inquirerAutoComplete({\n defaultValue,\n values,\n message,\n}: {\n /** Default value */\n defaultValue?: string;\n /** Message */\n message: string;\n /** Values to select */\n values: string[];\n}): Promise<string> {\n inquirer.registerPrompt('autocomplete', autoCompletePrompt);\n const { response } = await inquirer.prompt<{\n /** confirmation */\n response: string;\n }>([\n {\n name: 'response',\n message,\n type: 'autocomplete',\n default: defaultValue,\n source: (answersSoFar: ObjByString, input: string) =>\n !input ? values : values.filter((x) => typeof x === 'string' && fuzzySearch(input, x)),\n },\n ]);\n return response;\n}\n"],"mappings":"yHAYA,eAAsB,EAAuB,CAC3C,WAImB,CACnB,GAAM,CAAE,YAAa,MAAM,EAAS,OAGjC,CACD,CACE,KAAM,WACN,UACA,KAAM,UACP,CACF,CAAC,CACF,OAAO,EAST,eAAsB,EAAoB,CACxC,WAIkB,CAClB,GAAM,CAAE,YAAa,MAAM,EAAS,OAGjC,CACD,CACE,KAAM,WACN,UACA,KAAM,OACN,SAAW,GAAM,EAAE,MAAM,CAAC,OAAS,EACpC,CACF,CAAC,CACF,OAAO,EAST,eAAsB,EAAqB,CACzC,eACA,SACA,WAQkB,CAClB,EAAS,eAAe,eAAgB,EAAmB,CAC3D,GAAM,CAAE,YAAa,MAAM,EAAS,OAGjC,CACD,CACE,KAAM,WACN,UACA,KAAM,eACN,QAAS,EACT,QAAS,EAA2B,IACjC,EAAiB,EAAO,OAAQ,GAAM,OAAO,GAAM,UAAY,EAAY,EAAO,EAAE,CAAC,CAA7E,EACZ,CACF,CAAC,CACF,OAAO"}
@@ -0,0 +1,6 @@
1
+ import{applyEdits as e,createScanner as t,modify as n,parse as r}from"jsonc-parser";const i={CloseBraceToken:2,CloseBracketToken:4,LineCommentTrivia:12,BlockCommentTrivia:13,LineBreakTrivia:14,Trivia:15,EOF:17};function a(e,t){let n=[],i=r(e,n,{allowTrailingComma:!0,disallowComments:!1});if(n.length>0||typeof i!=`object`||!i||Array.isArray(i))throw Error(`Cannot safely merge ${t}; fix its JSONC syntax or apply the patch manually.`);return i}function o(e){let t=e.match(/\n([ \t]+)"/)?.[1]??` `;return{tabSize:t.includes(` `)?1:t.length,insertSpaces:!t.includes(` `),eol:e.includes(`\r
2
+ `)?`\r
3
+ `:`
4
+ `}}function s(e){let n=t(e,!1),r=[],a=n.scan();for(;a!==i.EOF;)(a===i.LineCommentTrivia||a===i.BlockCommentTrivia)&&r.push(e.slice(n.getTokenOffset(),n.getTokenOffset()+n.getTokenLength())),a=n.scan();return r}function c(e){let n=t(e,!1),r=-1,a=n.scan();for(;a!==i.EOF;){if(a===i.LineCommentTrivia){let e=r===n.getTokenStartLine(),t=n.scan();for(;t===i.Trivia||t===i.LineBreakTrivia||t===i.LineCommentTrivia||t===i.BlockCommentTrivia;)t=n.scan();if(e&&(t===i.CloseBraceToken||t===i.CloseBracketToken))return!0;a=t;continue}a!==i.Trivia&&a!==i.LineBreakTrivia&&a!==i.BlockCommentTrivia&&(r=n.getTokenStartLine()),a=n.scan()}return!1}function l(t,r,i){let l=t??`{}
5
+ `;if(a(l,i),t!==null&&c(t))throw Error(`Cannot prove comment-preserving edits for ${i}; apply the displayed patch manually.`);let u=s(l),d=o(l);r.forEach(({path:t,value:r})=>{l=e(l,n(l,t,r,{formattingOptions:{...d,insertFinalNewline:!0,keepLines:!0}}))});let f=s(l);if(u.length!==f.length||u.some((e,t)=>f[t]!==e))throw Error(`A comment would move or disappear in ${i}; apply the patch manually.`);return a(l,i),l.endsWith(d.eol)?l:`${l}${d.eol}`}function u(e,t){let n=Array.isArray(e)?e.filter(e=>typeof e==`string`):[];return[...n,...t.filter(e=>!n.includes(e))]}export{u as n,a as r,l as t};
6
+ //# sourceMappingURL=jsonc-D9dDWb1J.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonc-D9dDWb1J.mjs","names":[],"sources":["../src/lib/scaffolding/jsonc.ts"],"sourcesContent":["import { applyEdits, createScanner, modify, parse, type ParseError } from 'jsonc-parser';\n\n/**\n * Runtime values of jsonc-parser's ambient const enum, repeated locally\n * because isolated modules cannot access that enum directly.\n */\nconst JSONC_SYNTAX_KIND = {\n /** Closing object delimiter. */\n CloseBraceToken: 2,\n /** Closing array delimiter. */\n CloseBracketToken: 4,\n /** Single-line comment. */\n LineCommentTrivia: 12,\n /** Block comment. */\n BlockCommentTrivia: 13,\n /** Line break. */\n LineBreakTrivia: 14,\n /** Whitespace. */\n Trivia: 15,\n /** End of input. */\n EOF: 17,\n} as const;\n\n/** One JSONC path update. */\nexport interface JsoncUpdate {\n /** Object path. */\n path: (string | number)[];\n /** Desired value. */\n value: unknown;\n}\n\n/**\n * Parse a JSONC object and fail with a manual-patch-oriented error.\n *\n * @param contents - JSON or JSONC text\n * @param label - Configuration label\n * @returns Parsed object\n */\nexport function parseJsoncObject(contents: string, label: string): Record<string, unknown> {\n const errors: ParseError[] = [];\n const value = parse(contents, errors, {\n allowTrailingComma: true,\n disallowComments: false,\n }) as unknown;\n if (errors.length > 0 || value === null || typeof value !== 'object' || Array.isArray(value)) {\n throw new Error(\n `Cannot safely merge ${label}; fix its JSONC syntax or apply the patch manually.`,\n );\n }\n return value as Record<string, unknown>;\n}\n\n/**\n * Infer formatting without reformatting existing content.\n *\n * @param contents - Existing JSONC\n * @returns Formatting settings\n */\nfunction inferFormatting(contents: string): {\n /** Number of spaces per indent. */\n tabSize: number;\n /** Whether indentation uses spaces. */\n insertSpaces: boolean;\n /** Existing line ending. */\n eol: string;\n} {\n const indent = contents.match(/\\n([ \\t]+)\"/)?.[1] ?? ' ';\n return {\n tabSize: indent.includes('\\t') ? 1 : indent.length,\n insertSpaces: !indent.includes('\\t'),\n eol: contents.includes('\\r\\n') ? '\\r\\n' : '\\n',\n };\n}\n\n/**\n * Capture comment text in order.\n *\n * @param contents - JSONC text\n * @returns Comments\n */\nfunction extractComments(contents: string): string[] {\n const scanner = createScanner(contents, false);\n const comments: string[] = [];\n let token = scanner.scan();\n while (token !== JSONC_SYNTAX_KIND.EOF) {\n if (\n token === JSONC_SYNTAX_KIND.LineCommentTrivia ||\n token === JSONC_SYNTAX_KIND.BlockCommentTrivia\n ) {\n comments.push(\n contents.slice(\n scanner.getTokenOffset(),\n scanner.getTokenOffset() + scanner.getTokenLength(),\n ),\n );\n }\n token = scanner.scan();\n }\n return comments;\n}\n\n/**\n * Detect the jsonc-parser insertion edge case that can reattach an inline\n * comment from the previous final property.\n *\n * @param contents - Existing JSONC text\n * @returns Whether a guarded manual patch is required\n */\nfunction hasTrailingPropertyComment(contents: string): boolean {\n const scanner = createScanner(contents, false);\n let previousSignificantLine = -1;\n let token = scanner.scan();\n while (token !== JSONC_SYNTAX_KIND.EOF) {\n if (token === JSONC_SYNTAX_KIND.LineCommentTrivia) {\n const hasInlineValue = previousSignificantLine === scanner.getTokenStartLine();\n let next = scanner.scan();\n while (\n next === JSONC_SYNTAX_KIND.Trivia ||\n next === JSONC_SYNTAX_KIND.LineBreakTrivia ||\n next === JSONC_SYNTAX_KIND.LineCommentTrivia ||\n next === JSONC_SYNTAX_KIND.BlockCommentTrivia\n ) {\n next = scanner.scan();\n }\n if (\n hasInlineValue &&\n (next === JSONC_SYNTAX_KIND.CloseBraceToken || next === JSONC_SYNTAX_KIND.CloseBracketToken)\n ) {\n return true;\n }\n token = next;\n continue;\n }\n if (\n token !== JSONC_SYNTAX_KIND.Trivia &&\n token !== JSONC_SYNTAX_KIND.LineBreakTrivia &&\n token !== JSONC_SYNTAX_KIND.BlockCommentTrivia\n ) {\n previousSignificantLine = scanner.getTokenStartLine();\n }\n token = scanner.scan();\n }\n return false;\n}\n\n/**\n * Apply surgical JSONC updates while retaining every existing comment.\n *\n * @param contents - Existing contents, or null for a new file\n * @param updates - Ordered updates\n * @param label - Configuration label\n * @returns Updated contents\n */\nexport function mergeJsonc(\n contents: string | null,\n updates: readonly JsoncUpdate[],\n label: string,\n): string {\n let next = contents ?? '{}\\n';\n parseJsoncObject(next, label);\n if (contents !== null && hasTrailingPropertyComment(contents)) {\n throw new Error(\n `Cannot prove comment-preserving edits for ${label}; apply the displayed patch manually.`,\n );\n }\n const originalComments = extractComments(next);\n const formattingOptions = inferFormatting(next);\n updates.forEach(({ path, value }) => {\n next = applyEdits(\n next,\n modify(next, path, value, {\n formattingOptions: {\n ...formattingOptions,\n insertFinalNewline: true,\n keepLines: true,\n },\n }),\n );\n });\n const finalComments = extractComments(next);\n if (\n originalComments.length !== finalComments.length ||\n originalComments.some((comment, index) => finalComments[index] !== comment)\n ) {\n throw new Error(`A comment would move or disappear in ${label}; apply the patch manually.`);\n }\n parseJsoncObject(next, label);\n return next.endsWith(formattingOptions.eol) ? next : `${next}${formattingOptions.eol}`;\n}\n\n/**\n * Merge unique string values without reordering existing entries.\n *\n * @param current - Existing value\n * @param additions - Values to append\n * @returns Merged strings\n */\nexport function mergeStringArray(current: unknown, additions: readonly string[]): string[] {\n const values = Array.isArray(current)\n ? current.filter((value): value is string => typeof value === 'string')\n : [];\n return [...values, ...additions.filter((value) => !values.includes(value))];\n}\n"],"mappings":"oFAMA,MAAM,EAAoB,CAExB,gBAAiB,EAEjB,kBAAmB,EAEnB,kBAAmB,GAEnB,mBAAoB,GAEpB,gBAAiB,GAEjB,OAAQ,GAER,IAAK,GACN,CAiBD,SAAgB,EAAiB,EAAkB,EAAwC,CACzF,IAAM,EAAuB,EAAE,CACzB,EAAQ,EAAM,EAAU,EAAQ,CACpC,mBAAoB,GACpB,iBAAkB,GACnB,CAAC,CACF,GAAI,EAAO,OAAS,GAAuB,OAAO,GAAU,WAAnC,GAA+C,MAAM,QAAQ,EAAM,CAC1F,MAAU,MACR,uBAAuB,EAAM,qDAC9B,CAEH,OAAO,EAST,SAAS,EAAgB,EAOvB,CACA,IAAM,EAAS,EAAS,MAAM,cAAc,GAAG,IAAM,KACrD,MAAO,CACL,QAAS,EAAO,SAAS,IAAK,CAAG,EAAI,EAAO,OAC5C,aAAc,CAAC,EAAO,SAAS,IAAK,CACpC,IAAK,EAAS,SAAS;EAAO,CAAG;EAAS;EAC3C,CASH,SAAS,EAAgB,EAA4B,CACnD,IAAM,EAAU,EAAc,EAAU,GAAM,CACxC,EAAqB,EAAE,CACzB,EAAQ,EAAQ,MAAM,CAC1B,KAAO,IAAU,EAAkB,MAE/B,IAAU,EAAkB,mBAC5B,IAAU,EAAkB,qBAE5B,EAAS,KACP,EAAS,MACP,EAAQ,gBAAgB,CACxB,EAAQ,gBAAgB,CAAG,EAAQ,gBAAgB,CACpD,CACF,CAEH,EAAQ,EAAQ,MAAM,CAExB,OAAO,EAUT,SAAS,EAA2B,EAA2B,CAC7D,IAAM,EAAU,EAAc,EAAU,GAAM,CAC1C,EAA0B,GAC1B,EAAQ,EAAQ,MAAM,CAC1B,KAAO,IAAU,EAAkB,KAAK,CACtC,GAAI,IAAU,EAAkB,kBAAmB,CACjD,IAAM,EAAiB,IAA4B,EAAQ,mBAAmB,CAC1E,EAAO,EA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as e,readdirSync as t}from"node:fs";function n(e,t,n=!1){let r=e.filter(e=>t?t.some(t=>e.endsWith(t)):!0).filter(e=>e.indexOf(`.`)>0);return n?r.map(e=>e.replace(/\.[^/.]+$/,``)):r}function r(r,i,a=!1){return e(r)?n(t(r),i,a):[]}export{r as n,n as t};
2
- //# sourceMappingURL=listFiles-CWHAdKY-.mjs.map
2
+ //# sourceMappingURL=listFiles-BdFUbX5x.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"listFiles-CWHAdKY-.mjs","names":[],"sources":["../src/lib/api-keys/listFiles.ts"],"sourcesContent":["import { existsSync, readdirSync } from 'node:fs';\n\n/**\n * Filter directory entry names to files recognized by the CLI.\n *\n * @param entries - Directory entry names.\n * @param validExtensions - The list of valid extensions.\n * @param removeExtensions - When true, remove extensions from returned names.\n * @returns Filtered file names.\n */\nexport function filterFileNames(\n entries: string[],\n validExtensions?: string[],\n removeExtensions = false,\n): string[] {\n const files = entries\n .filter((file) =>\n validExtensions ? validExtensions.some((extension) => file.endsWith(extension)) : true,\n )\n .filter((file) => file.indexOf('.') > 0);\n\n return removeExtensions ? files.map((file) => file.replace(/\\.[^/.]+$/, '')) : files;\n}\n\n/**\n * List the files in a directory\n *\n * ```typescript\n * // The directory to search\n * const directory = '/User/test/transcend/my-app/app/containers';\n * // Returns ['test.js']\n * listFiles(directory);\n * ```\n *\n * @param directory - The directory to search\n * @param validExtensions - The list of valid extensions\n * @param removeExtensions - When true, remove the extensions from the listed files\n * @returns The list of files in the directory\n */\nexport function listFiles(\n directory: string,\n validExtensions?: string[],\n removeExtensions = false,\n): string[] {\n if (!existsSync(directory)) {\n return [];\n }\n\n return filterFileNames(readdirSync(directory), validExtensions, removeExtensions);\n}\n"],"mappings":"sDAUA,SAAgB,EACd,EACA,EACA,EAAmB,GACT,CACV,IAAM,EAAQ,EACX,OAAQ,GACP,EAAkB,EAAgB,KAAM,GAAc,EAAK,SAAS,EAAU,CAAC,CAAG,GACnF,CACA,OAAQ,GAAS,EAAK,QAAQ,IAAI,CAAG,EAAE,CAE1C,OAAO,EAAmB,EAAM,IAAK,GAAS,EAAK,QAAQ,YAAa,GAAG,CAAC,CAAG,EAkBjF,SAAgB,EACd,EACA,EACA,EAAmB,GACT,CAKV,OAJK,EAAW,EAAU,CAInB,EAAgB,EAAY,EAAU,CAAE,EAAiB,EAAiB,CAHxE,EAAE"}
1
+ {"version":3,"file":"listFiles-BdFUbX5x.mjs","names":[],"sources":["../src/lib/api-keys/listFiles.ts"],"sourcesContent":["import { existsSync, readdirSync } from 'node:fs';\n\n/**\n * Filter directory entry names to files recognized by the CLI.\n *\n * @param entries - Directory entry names.\n * @param validExtensions - The list of valid extensions.\n * @param removeExtensions - When true, remove extensions from returned names.\n * @returns Filtered file names.\n */\nexport function filterFileNames(\n entries: string[],\n validExtensions?: string[],\n removeExtensions = false,\n): string[] {\n const files = entries\n .filter((file) =>\n validExtensions ? validExtensions.some((extension) => file.endsWith(extension)) : true,\n )\n .filter((file) => file.indexOf('.') > 0);\n\n return removeExtensions ? files.map((file) => file.replace(/\\.[^/.]+$/, '')) : files;\n}\n\n/**\n * List the files in a directory\n *\n * ```typescript\n * // The directory to search\n * const directory = '/User/test/transcend/my-app/app/containers';\n * // Returns ['test.js']\n * listFiles(directory);\n * ```\n *\n * @param directory - The directory to search\n * @param validExtensions - The list of valid extensions\n * @param removeExtensions - When true, remove the extensions from the listed files\n * @returns The list of files in the directory\n */\nexport function listFiles(\n directory: string,\n validExtensions?: string[],\n removeExtensions = false,\n): string[] {\n if (!existsSync(directory)) {\n return [];\n }\n\n return filterFileNames(readdirSync(directory), validExtensions, removeExtensions);\n}\n"],"mappings":"sDAUA,SAAgB,EACd,EACA,EACA,EAAmB,GACT,CACV,IAAM,EAAQ,EACX,OAAQ,GACP,EAAkB,EAAgB,KAAM,GAAc,EAAK,SAAS,EAAU,CAAC,CAAG,GACnF,CACA,OAAQ,GAAS,EAAK,QAAQ,IAAI,CAAG,EAAE,CAE1C,OAAO,EAAmB,EAAM,IAAK,GAAS,EAAK,QAAQ,YAAa,GAAG,CAAC,CAAG,EAkBjF,SAAgB,EACd,EACA,EACA,EAAmB,GACT,CAKV,OAJK,EAAW,EAAU,CAInB,EAAgB,EAAY,EAAU,CAAE,EAAiB,EAAiB,CAHxE,EAAE"}
@@ -0,0 +1,2 @@
1
+ const e=console;export{e as t};
2
+ //# sourceMappingURL=logger-zplFSeXU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger-zplFSeXU.mjs","names":[],"sources":["../src/logger.ts"],"sourcesContent":["export const logger = console;\n"],"mappings":"AAAA,MAAa,EAAS"}
@@ -0,0 +1,2 @@
1
+ import{a as e}from"./readTranscendYaml-BNn6-Ofi.mjs";import{CustomFunctionPayloadType as t,CustomFunctionType as n}from"@transcend-io/privacy-types";import{existsSync as r,readFileSync as i,writeFileSync as a}from"node:fs";import{dirname as o,isAbsolute as s,relative as c,resolve as l,sep as u}from"node:path";import{decodeCodec as d}from"@transcend-io/type-utils";import*as f from"io-ts";import p from"js-yaml";import{isMap as m,isScalar as h,isSeq as g,parseDocument as _}from"yaml";import{Buffer as v}from"node:buffer";import{isIP as y}from"node:net";const b=64*1024,x=new Set([`DENO_CERT`,`DENO_DIR`,`DENO_TLS_CA_STORE`,`HTTP_PROXY`,`HTTPS_PROXY`,`NODE_EXTRA_CA_CERTS`,`NO_COLOR`,`NO_PROXY`,`NPM_CONFIG_REGISTRY`]);function S(e){let t=/^\[([^\]]+)\](?::(\d+))?$/u.exec(e);if(t){let e=t[2];return y(t[1])===6&&(!e||Number(e)>0&&Number(e)<=65535)}if(y(e)>0)return!0;let n=/^([^:]+):(\d+)$/u.exec(e),r=n?.[1]??e,i=n?.[2];return(!i||Number(i)>0&&Number(i)<=65535)&&r.length<=253&&r.split(`.`).every(e=>e.length>0&&e.length<=63&&/^[A-Za-z\d](?:[A-Za-z\d-]*[A-Za-z\d])?$/u.test(e))}function C(e){let t=e.env??{},n=Object.keys(t),r=n.filter(e=>!/^[A-Za-z][A-Za-z\d_]*$/u.test(e)),i=n.filter(e=>x.has(e)||e.startsWith(`DENO_`));if(r.length>0||i.length>0)throw Error([r.length>0?`Invalid environment variable names: ${r.join(`, `)}`:void 0,i.length>0?`Reserved environment variable names: ${i.join(`, `)}`:void 0].filter(Boolean).join(`. `));let a=n.filter(e=>v.byteLength(t[e])>b);if(a.length>0)throw Error(`Environment values exceed ${b} bytes: ${a.join(`, `)}`);let o=e.allowedHosts??[];if(o.length>1&&o.includes(`*`))throw Error(`allowed-hosts cannot combine "*" with specific hosts.`);let s=o.filter(e=>e!==`*`&&!S(e));if(s.length>0)throw Error(`Invalid allowed-hosts: ${s.join(`, `)}`)}const w=f.intersection([f.type({name:f.string,code:f.string}),f.partial({id:f.string,description:f.string,type:f.union([f.literal(n.Dsr),f.literal(n.General)]),"data-silo-id":f.string,"sombra-id":f.string,"sombra-auth-env":f.string,"allowed-hosts":f.array(f.string),"timeout-ms":f.number,"allow-third-party-imports":f.boolean,env:f.record(f.string,f.string),"test-payload":f.string,"test-payload-type":f.union([f.literal(t.DataPoint),f.literal(t.RequestEnricher)]),"test-payloads":f.array(f.intersection([f.type({payload:f.string}),f.partial({"payload-type":f.union([f.literal(t.DataPoint),f.literal(t.RequestEnricher)])})]))})]),T=f.type({functions:f.array(w)});function E(e){let t=l(`/`,`__custom-function-manifest__`),n=c(t,l(t,e));return n!==`..`&&!n.startsWith(`..${u}`)&&!s(n)}function D(e,t={}){let r=e.functions.map(({id:e})=>e).filter((e,t,n)=>e!==void 0&&n.indexOf(e)!==t);if(r.length>0)throw Error(`Duplicate custom function ids in manifest: ${[...new Set(r)].join(`, `)}`);let i=e.functions.map(({name:e})=>e),a=e.functions.filter(({id:e,name:t})=>e===void 0&&i.filter(e=>e===t).length>1).map(({name:e})=>e);if(a.length>0)throw Error(`Duplicate custom function names in manifest without ids: ${[...new Set(a)].join(`, `)}. Add an \`id\` field to each duplicated entry to disambiguate.`);e.functions.forEach(e=>{if(e[`test-payload`]!==void 0&&e[`test-payloads`]!==void 0)throw Error(`Custom function "${e.name}" sets both test-payload and test-payloads — use test-payloads alone to define multiple payloads.`);if(e[`test-payload-type`]!==void 0&&e[`test-payload`]===void 0)throw Error(`Custom function "${e.name}" sets test-payload-type without test-payload — set payload-type per item in test-payloads instead.`);if(e.type!==n.Dsr&&(e[`test-payload-type`]!==void 0||e[`test-payloads`]?.some(({"payload-type":e})=>e!==void 0)))throw Error(`Custom function "${e.name}" sets a DSR payload type but is not type DSR.`);[{field:`code`,path:e.code},...e[`test-payload`]===void 0?[]:[{field:`test-payload`,path:e[`test-payload`]}],...(e[`test-payloads`]??[]).map(({payload:e},t)=>({field:`test-payloads[${t}].payload`,path:e}))].forEach(({field:n,path:r})=>{if(!t.skipPathValidation&&!E(r))throw Error(`Custom function "${e.name}" has a ${n} path outside the manifest directory: ${r}`)})})}function O(e,t={}){let n=d(T,p.load(e));return D(n,t),n}function k(e,t,n){let a=o(l(e)),s=(e,t)=>{let o=l(a,t);if(n?.(o),!r(o))throw Error(`Test payload file for custom function "${e}" does not exist: ${o}`);let s=i(o,`utf-8`);try{return JSON.parse(s)}catch(t){throw Error(`Test payload file for custom function "${e}" is not valid JSON (${o}): ${t.message}`)}};return t.functions.map(e=>{C({...e.env?{env:e.env}:{},...e[`allowed-hosts`]?{allowedHosts:e[`allowed-hosts`]}:{}});let t=l(a,e.code);if(n?.(t),!r(t))throw Error(`Code file for custom function "${e.name}" does not exist: ${t}`);let o;return e[`test-payload`]===void 0?e[`test-payloads`]!==void 0&&e[`test-payloads`].length>0&&(o=e[`test-payloads`].map(t=>({payload:s(e.name,t.payload),...t[`payload-type`]===void 0?{}:{payloadType:t[`payload-type`]}}))):o=[{payload:s(e.name,e[`test-payload`]),...e[`test-payload-type`]===void 0?{}:{payloadType:e[`test-payload-type`]}}],{name:e.name,code:i(t,`utf-8`),...e.id===void 0?{}:{id:e.id},...e.description===void 0?{}:{description:e.description},...e.type===void 0?{}:{type:e.type},...e[`data-silo-id`]===void 0?{}:{dataSiloId:e[`data-silo-id`]},...e[`sombra-id`]===void 0?{}:{sombraId:e[`sombra-id`]},...e[`sombra-auth-env`]===void 0?{}:{sombraAuthEnv:e[`sombra-auth-env`]},...e[`allowed-hosts`]===void 0?{}:{allowedHosts:e[`allowed-hosts`]},...e[`timeout-ms`]===void 0?{}:{timeoutMs:e[`timeout-ms`]},...e[`allow-third-party-imports`]===void 0?{}:{allowThirdPartyImports:e[`allow-third-party-imports`]},...e.env===void 0?{}:{env:e.env},...o===void 0?{}:{testPayloads:o}}})}function A(t,n={},r){return k(t,O(e(i(t,`utf-8`),n,`Also check that there are no extra variables defined in your manifest: ${t}`)),r)}function j(t,n,r={},i){let a=O(e(p.dump({functions:[n]}),r,`Also check that there are no extra variables defined for "${n.name}" in: ${t}`)),s=a.functions[0],c=l(o(l(t)),s.code);return{config:k(t,a,i)[0],sourcePath:c}}function M(e,t){let n=_(e);if(n.errors.length>0)throw n.errors[0];let r=n.get(`functions`);if(!g(r))throw Error("Expected a `functions` list in custom function manifest");r.items.length===0&&(r.flow=!1),r.add(n.createNode(t));let i=n.toString();return O(i),i}function N(e,t){let n=_(i(e,`utf-8`)),r=n.get(`functions`);if(!g(r))throw Error(`Expected a \`functions\` list in manifest: ${e}`);let o=0;return r.items.forEach((e,r)=>{let i=t[r];if(!i||!m(e))return;let a=!1;if(i.id&&!e.has(`id`)&&(e.items.unshift(n.createPair(`id`,i.id)),a=!0),i.dataSiloId&&!e.has(`data-silo-id`)){let t=e.items.findIndex(e=>h(e.key)&&e.key.value===`id`);e.items.splice(t+1,0,n.createPair(`data-silo-id`,i.dataSiloId)),a=!0}a&&(o+=1)}),o>0&&a(e,n.toString()),o}export{A as a,j as i,E as n,N as o,O as r,C as s,M as t};
2
+ //# sourceMappingURL=manifest-BNIpO_zW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest-BNIpO_zW.mjs","names":[],"sources":["../src/lib/custom-functions/execution-context.ts","../src/lib/custom-functions/manifest.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\nimport { isIP } from 'node:net';\n\n/** Maximum environment value size supported by the local process. */\nexport const CUSTOM_FUNCTION_MAX_ENV_VALUE_BYTES = 64 * 1024;\n\nconst RESERVED_ENV_NAMES = new Set([\n 'DENO_CERT',\n 'DENO_DIR',\n 'DENO_TLS_CA_STORE',\n 'HTTP_PROXY',\n 'HTTPS_PROXY',\n 'NODE_EXTRA_CA_CERTS',\n 'NO_COLOR',\n 'NO_PROXY',\n 'NPM_CONFIG_REGISTRY',\n]);\n\n/**\n * Check whether a value matches Sombra's hostname/IP contract.\n *\n * @param host - Manifest allowed-host value\n * @returns Whether the host is valid\n */\nfunction isValidAllowedHost(host: string): boolean {\n const bracketedIp = /^\\[([^\\]]+)\\](?::(\\d+))?$/u.exec(host);\n if (bracketedIp) {\n const port = bracketedIp[2];\n return isIP(bracketedIp[1]!) === 6 && (!port || (Number(port) > 0 && Number(port) <= 65_535));\n }\n if (isIP(host) > 0) {\n return true;\n }\n const hostWithPort = /^([^:]+):(\\d+)$/u.exec(host);\n const hostname = hostWithPort?.[1] ?? host;\n const port = hostWithPort?.[2];\n return (\n (!port || (Number(port) > 0 && Number(port) <= 65_535)) &&\n hostname.length <= 253 &&\n hostname\n .split('.')\n .every(\n (label) =>\n label.length > 0 &&\n label.length <= 63 &&\n /^[A-Za-z\\d](?:[A-Za-z\\d-]*[A-Za-z\\d])?$/u.test(label),\n )\n );\n}\n\n/**\n * Validate execution settings shared by check, push, and local simulation.\n *\n * @param config - Environment and network settings\n */\nexport function validateCustomFunctionExecutionContext(config: {\n /** User-defined environment variables. */\n env?: Record<string, string>;\n /** Native network destinations. */\n allowedHosts?: string[];\n}): void {\n const environment = config.env ?? {};\n const envNames = Object.keys(environment);\n const malformedEnvNames = envNames.filter((name) => !/^[A-Za-z][A-Za-z\\d_]*$/u.test(name));\n const reservedEnvNames = envNames.filter(\n (name) => RESERVED_ENV_NAMES.has(name) || name.startsWith('DENO_'),\n );\n if (malformedEnvNames.length > 0 || reservedEnvNames.length > 0) {\n throw new Error(\n [\n malformedEnvNames.length > 0\n ? `Invalid environment variable names: ${malformedEnvNames.join(', ')}`\n : undefined,\n reservedEnvNames.length > 0\n ? `Reserved environment variable names: ${reservedEnvNames.join(', ')}`\n : undefined,\n ]\n .filter(Boolean)\n .join('. '),\n );\n }\n const oversizedEnvNames = envNames.filter(\n (name) => Buffer.byteLength(environment[name]!) > CUSTOM_FUNCTION_MAX_ENV_VALUE_BYTES,\n );\n if (oversizedEnvNames.length > 0) {\n throw new Error(\n `Environment values exceed ${CUSTOM_FUNCTION_MAX_ENV_VALUE_BYTES} bytes: ${oversizedEnvNames.join(', ')}`,\n );\n }\n const allowedHosts = config.allowedHosts ?? [];\n if (allowedHosts.length > 1 && allowedHosts.includes('*')) {\n throw new Error('allowed-hosts cannot combine \"*\" with specific hosts.');\n }\n const invalidHosts = allowedHosts.filter((host) => host !== '*' && !isValidAllowedHost(host));\n if (invalidHosts.length > 0) {\n throw new Error(`Invalid allowed-hosts: ${invalidHosts.join(', ')}`);\n }\n}\n","import { existsSync, readFileSync, writeFileSync } from 'node:fs';\nimport { dirname, isAbsolute, relative, resolve, sep } from 'node:path';\n\nimport { CustomFunctionPayloadType, CustomFunctionType } from '@transcend-io/privacy-types';\nimport type { CustomFunctionConfigInput } from '@transcend-io/sdk';\nimport { decodeCodec, type ObjByString } from '@transcend-io/type-utils';\nimport * as t from 'io-ts';\nimport yaml from 'js-yaml';\nimport { isMap, isScalar, isSeq, parseDocument } from 'yaml';\n\nimport { replaceVariablesInYaml } from '../readTranscendYaml.js';\nimport { validateCustomFunctionExecutionContext } from './execution-context.js';\n\nexport const CustomFunctionManifestEntry = t.intersection([\n t.type({\n /** Display name of the custom function — used as the sync key when no `id` is set */\n name: t.string,\n /** Path to the TypeScript source file, relative to the manifest */\n code: t.string,\n }),\n t.partial({\n /**\n * Custom function ID. Optional, but required to disambiguate when multiple\n * custom functions share a name. Written back by `push --updateManifest`.\n */\n id: t.string,\n /** Description shown in the Transcend dashboard */\n description: t.string,\n /** Custom function type. Defaults to GENERAL */\n type: t.union([t.literal(CustomFunctionType.Dsr), t.literal(CustomFunctionType.General)]),\n /** Data silo ID to attach to (required for DSR functions) */\n 'data-silo-id': t.string,\n /** The Sombra gateway the function belongs to */\n 'sombra-id': t.string,\n /**\n * Name of the environment variable holding the internal key of the\n * function's Sombra gateway. The key itself never lives in the manifest —\n * it is read from the CLI's process environment at push time. Overrides\n * `--sombraAuth` for this entry.\n */\n 'sombra-auth-env': t.string,\n /** Hosts the function may make network requests to */\n 'allowed-hosts': t.array(t.string),\n /** Execution timeout in milliseconds */\n 'timeout-ms': t.number,\n /** Whether the function may import third party modules */\n 'allow-third-party-imports': t.boolean,\n /** Environment variables to expose to the function */\n env: t.record(t.string, t.string),\n /**\n * Path to a JSON file (relative to the manifest) holding the test payload\n * to run the function with before pushing. When set, the function is\n * test-run after signing and only pushed/promoted when the test passes.\n * Shorthand for a single-item `test-payloads` list.\n */\n 'test-payload': t.string,\n /**\n * Which export to invoke when test-running a DSR function:\n * `DATA_POINT` invokes the default export, `REQUEST_ENRICHER` invokes the\n * `enricher` export. Defaults to DATA_POINT. Ignored for GENERAL functions.\n * Only valid alongside `test-payload`.\n */\n 'test-payload-type': t.union([\n t.literal(CustomFunctionPayloadType.DataPoint),\n t.literal(CustomFunctionPayloadType.RequestEnricher),\n ]),\n /**\n * Test payloads to run the function with before pushing. Every payload\n * runs and all must pass for the function to be pushed/promoted. DSR\n * functions should list one payload per export they implement\n * (`DATA_POINT` for the default export, `REQUEST_ENRICHER` for the\n * `enricher` export). Mutually exclusive with `test-payload`.\n */\n 'test-payloads': t.array(\n t.intersection([\n t.type({\n /** Path to the JSON payload file, relative to the manifest */\n payload: t.string,\n }),\n t.partial({\n /** Which export the payload invokes (DSR only). Defaults to DATA_POINT */\n 'payload-type': t.union([\n t.literal(CustomFunctionPayloadType.DataPoint),\n t.literal(CustomFunctionPayloadType.RequestEnricher),\n ]),\n }),\n ]),\n ),\n }),\n]);\n\n/** Override type */\nexport type CustomFunctionManifestEntry = t.TypeOf<typeof CustomFunctionManifestEntry>;\n\nexport const CustomFunctionsManifest = t.type({\n /** The custom functions to sync */\n functions: t.array(CustomFunctionManifestEntry),\n});\n\n/** Override type */\nexport type CustomFunctionsManifest = t.TypeOf<typeof CustomFunctionsManifest>;\n\n/**\n * Determine whether a relative manifest path stays inside the manifest's\n * directory after normalization.\n *\n * @param filePath - Path from a custom function manifest entry\n * @returns Whether the normalized path is contained by the manifest directory\n */\nexport function isCustomFunctionManifestPathContained(filePath: string): boolean {\n const manifestDirectory = resolve('/', '__custom-function-manifest__');\n const relativePath = relative(manifestDirectory, resolve(manifestDirectory, filePath));\n return relativePath !== '..' && !relativePath.startsWith(`..${sep}`) && !isAbsolute(relativePath);\n}\n\n/**\n * Validate semantic constraints shared by manifest readers and editors.\n *\n * @param manifest - Shape-validated custom function manifest\n * @param options - Validation behavior\n */\nexport function validateCustomFunctionsManifest(\n manifest: CustomFunctionsManifest,\n options: {\n /** Skip path validation while identifying candidate manifest files. */\n skipPathValidation?: boolean;\n } = {},\n): void {\n // IDs must be unique — two entries cannot target the same function\n const duplicateIds = manifest.functions\n .map(({ id }) => id)\n .filter((id, index, ids) => id !== undefined && ids.indexOf(id) !== index);\n if (duplicateIds.length > 0) {\n throw new Error(\n `Duplicate custom function ids in manifest: ${[...new Set(duplicateIds)].join(', ')}`,\n );\n }\n\n // Names may repeat only when every entry sharing the name carries an `id`\n // to disambiguate; an id-less entry syncs by name and would be ambiguous.\n const allNames = manifest.functions.map(({ name }) => name);\n const ambiguousNames = manifest.functions\n .filter(({ id, name }) => id === undefined && allNames.filter((n) => n === name).length > 1)\n .map(({ name }) => name);\n if (ambiguousNames.length > 0) {\n throw new Error(\n `Duplicate custom function names in manifest without ids: ${[...new Set(ambiguousNames)].join(', ')}. ` +\n 'Add an `id` field to each duplicated entry to disambiguate.',\n );\n }\n\n manifest.functions.forEach((entry) => {\n if (entry['test-payload'] !== undefined && entry['test-payloads'] !== undefined) {\n throw new Error(\n `Custom function \"${entry.name}\" sets both test-payload and test-payloads — ` +\n 'use test-payloads alone to define multiple payloads.',\n );\n }\n if (entry['test-payload-type'] !== undefined && entry['test-payload'] === undefined) {\n throw new Error(\n `Custom function \"${entry.name}\" sets test-payload-type without test-payload — ` +\n 'set payload-type per item in test-payloads instead.',\n );\n }\n if (\n entry.type !== CustomFunctionType.Dsr &&\n (entry['test-payload-type'] !== undefined ||\n entry['test-payloads']?.some(\n ({ ['payload-type']: payloadType }) => payloadType !== undefined,\n ))\n ) {\n throw new Error(\n `Custom function \"${entry.name}\" sets a DSR payload type but is not type DSR.`,\n );\n }\n\n const referencedPaths = [\n { field: 'code', path: entry.code },\n ...(entry['test-payload'] === undefined\n ? []\n : [{ field: 'test-payload', path: entry['test-payload'] }]),\n ...(entry['test-payloads'] ?? []).map(({ payload }, index) => ({\n field: `test-payloads[${index}].payload`,\n path: payload,\n })),\n ];\n referencedPaths.forEach(({ field, path }) => {\n if (!options.skipPathValidation && !isCustomFunctionManifestPathContained(path)) {\n throw new Error(\n `Custom function \"${entry.name}\" has a ${field} path outside the manifest directory: ${path}`,\n );\n }\n });\n });\n}\n\n/**\n * Parse and validate a custom functions manifest without resolving variables\n * or reading any referenced files.\n *\n * Unresolved `<<parameters.*>>` values remain plain strings in the returned\n * manifest.\n *\n * @param contents - Custom function manifest YAML\n * @param options - Validation behavior\n * @returns The parsed, shape-validated, and semantically valid manifest\n */\nexport function parseCustomFunctionsManifest(\n contents: string,\n options: {\n /** Skip path validation while identifying candidate manifest files. */\n skipPathValidation?: boolean;\n } = {},\n): CustomFunctionsManifest {\n const manifest = decodeCodec(CustomFunctionsManifest, yaml.load(contents));\n validateCustomFunctionsManifest(manifest, options);\n return manifest;\n}\n\n/**\n * A custom function config from the manifest, plus CLI-level settings that\n * are not part of the SDK sync input.\n */\nexport type CustomFunctionManifestConfig = CustomFunctionConfigInput & {\n /** Env variable name holding the internal key of the function's Sombra gateway */\n sombraAuthEnv?: string;\n /** Parsed JSON test payloads to run the function with before pushing */\n testPayloads?: {\n /** The parsed JSON payload */\n payload: object;\n /** Which export the payload invokes when test-running a DSR function */\n payloadType?: Exclude<CustomFunctionPayloadType, typeof CustomFunctionPayloadType.Maestro>;\n }[];\n};\n\n/**\n * Hydrate parsed manifest entries from their referenced files.\n *\n * @param filePath - Path to the manifest YAML file\n * @param manifest - Parsed manifest\n * @param assertPath - Optional safety check applied before referenced files are read\n * @returns Custom Function configs with code and payloads loaded\n */\nfunction hydrateCustomFunctionsManifest(\n filePath: string,\n manifest: CustomFunctionsManifest,\n assertPath?: (path: string) => void,\n): CustomFunctionManifestConfig[] {\n const manifestDir = dirname(resolve(filePath));\n\n /**\n * Load and parse a JSON test payload file.\n *\n * @param entryName - The manifest entry name, for error messages\n * @param payloadFile - The payload file path, relative to the manifest\n * @returns The parsed payload object\n */\n const loadTestPayload = (entryName: string, payloadFile: string): object => {\n const testPayloadPath = resolve(manifestDir, payloadFile);\n assertPath?.(testPayloadPath);\n if (!existsSync(testPayloadPath)) {\n throw new Error(\n `Test payload file for custom function \"${entryName}\" does not exist: ${testPayloadPath}`,\n );\n }\n const rawPayload = readFileSync(testPayloadPath, 'utf-8');\n try {\n return JSON.parse(rawPayload);\n } catch (err) {\n throw new Error(\n `Test payload file for custom function \"${entryName}\" is not valid JSON ` +\n `(${testPayloadPath}): ${(err as Error).message}`,\n );\n }\n };\n\n return manifest.functions.map((entry) => {\n validateCustomFunctionExecutionContext({\n ...(entry.env ? { env: entry.env } : {}),\n ...(entry['allowed-hosts'] ? { allowedHosts: entry['allowed-hosts'] } : {}),\n });\n const codePath = resolve(manifestDir, entry.code);\n assertPath?.(codePath);\n if (!existsSync(codePath)) {\n throw new Error(`Code file for custom function \"${entry.name}\" does not exist: ${codePath}`);\n }\n\n // `test-payload` is shorthand for a single-item `test-payloads` list\n let testPayloads: CustomFunctionManifestConfig['testPayloads'];\n if (entry['test-payload'] !== undefined) {\n testPayloads = [\n {\n payload: loadTestPayload(entry.name, entry['test-payload']),\n ...(entry['test-payload-type'] !== undefined\n ? { payloadType: entry['test-payload-type'] }\n : {}),\n },\n ];\n } else if (entry['test-payloads'] !== undefined && entry['test-payloads'].length > 0) {\n testPayloads = entry['test-payloads'].map((item) => ({\n payload: loadTestPayload(entry.name, item.payload),\n ...(item['payload-type'] !== undefined ? { payloadType: item['payload-type'] } : {}),\n }));\n }\n\n return {\n name: entry.name,\n code: readFileSync(codePath, 'utf-8'),\n ...(entry.id !== undefined ? { id: entry.id } : {}),\n ...(entry.description !== undefined ? { description: entry.description } : {}),\n ...(entry.type !== undefined ? { type: entry.type } : {}),\n ...(entry['data-silo-id'] !== undefined ? { dataSiloId: entry['data-silo-id'] } : {}),\n ...(entry['sombra-id'] !== undefined ? { sombraId: entry['sombra-id'] } : {}),\n ...(entry['sombra-auth-env'] !== undefined\n ? { sombraAuthEnv: entry['sombra-auth-env'] }\n : {}),\n ...(entry['allowed-hosts'] !== undefined ? { allowedHosts: entry['allowed-hosts'] } : {}),\n ...(entry['timeout-ms'] !== undefined ? { timeoutMs: entry['timeout-ms'] } : {}),\n ...(entry['allow-third-party-imports'] !== undefined\n ? { allowThirdPartyImports: entry['allow-third-party-imports'] }\n : {}),\n ...(entry.env !== undefined ? { env: entry.env } : {}),\n ...(testPayloads !== undefined ? { testPayloads } : {}),\n };\n });\n}\n\n/**\n * Read a custom functions manifest from disk, apply variable substitution,\n * validate it, and hydrate its referenced code and payload files.\n *\n * Variable substitution deliberately happens before parsing and hydration to\n * preserve push behavior.\n *\n * @param filePath - Path to the manifest YAML file\n * @param variables - Variables to fill into `<<parameters.x>>` placeholders\n * @param assertPath - Optional safety check applied before referenced files are read\n * @returns The custom function configs, with code loaded from disk\n */\nexport function readCustomFunctionsManifest(\n filePath: string,\n variables: ObjByString = {},\n assertPath?: (path: string) => void,\n): CustomFunctionManifestConfig[] {\n const fileContents = readFileSync(filePath, 'utf-8');\n const replacedVariables = replaceVariablesInYaml(\n fileContents,\n variables,\n `Also check that there are no extra variables defined in your manifest: ${filePath}`,\n );\n const manifest = parseCustomFunctionsManifest(replacedVariables);\n return hydrateCustomFunctionsManifest(filePath, manifest, assertPath);\n}\n\n/**\n * Resolve and hydrate one selected manifest entry.\n *\n * This lets local execution ignore unrelated entries whose files or\n * variables are currently incomplete.\n *\n * @param filePath - Path to the containing manifest\n * @param entry - Selected raw manifest entry\n * @param variables - Variables to fill into `<<parameters.x>>` placeholders\n * @param assertPath - Optional safety check applied before referenced files are read\n * @returns Hydrated selected configuration and its source path\n */\nexport function readCustomFunctionManifestEntry(\n filePath: string,\n entry: CustomFunctionManifestEntry,\n variables: ObjByString = {},\n assertPath?: (path: string) => void,\n): { config: CustomFunctionManifestConfig; sourcePath: string } {\n const entryContents = yaml.dump({ functions: [entry] });\n const replacedVariables = replaceVariablesInYaml(\n entryContents,\n variables,\n `Also check that there are no extra variables defined for \"${entry.name}\" in: ${filePath}`,\n );\n const manifest = parseCustomFunctionsManifest(replacedVariables);\n const resolvedEntry = manifest.functions[0]!;\n const manifestDirectory = dirname(resolve(filePath));\n const sourcePath = resolve(manifestDirectory, resolvedEntry.code);\n return {\n config: hydrateCustomFunctionsManifest(filePath, manifest, assertPath)[0]!,\n sourcePath,\n };\n}\n\n/**\n * Append an entry to a manifest YAML document while preserving the existing\n * document's comments, ordering, scalar styles, and unresolved placeholders.\n *\n * The complete result is parsed and validated with the same codec and\n * semantic rules used by {@link readCustomFunctionsManifest}.\n *\n * @param contents - Existing custom function manifest YAML\n * @param entry - Manifest entry to append\n * @returns Updated manifest YAML\n */\nexport function insertCustomFunctionManifestEntry(\n contents: string,\n entry: CustomFunctionManifestEntry,\n): string {\n const document = parseDocument(contents);\n if (document.errors.length > 0) {\n throw document.errors[0];\n }\n\n const functions = document.get('functions');\n if (!isSeq(functions)) {\n throw new Error('Expected a `functions` list in custom function manifest');\n }\n\n if (functions.items.length === 0) {\n functions.flow = false;\n }\n functions.add(document.createNode(entry));\n const updatedContents = document.toString();\n parseCustomFunctionsManifest(updatedContents);\n return updatedContents;\n}\n\n/**\n * The IDs assigned to a manifest entry during a push, to write back into the\n * manifest file.\n */\nexport interface CustomFunctionManifestIds {\n /** Custom function ID */\n id?: string;\n /** Data silo (DSR integration) ID, for DSR functions */\n dataSiloId?: string;\n}\n\n/**\n * Write custom function and data silo IDs back into a manifest file, so\n * future pushes match by ID instead of by (potentially non-unique) name and\n * DSR entries keep pointing at their integration.\n *\n * The raw file text is edited via a comment- and formatting-preserving YAML\n * document, so comments and un-substituted `<<parameters.x>>` placeholders\n * survive untouched. Only entries that are missing the respective key are\n * modified.\n *\n * @param filePath - Path to the manifest YAML file\n * @param idsByIndex - IDs for each manifest entry, by array index (undefined\n * entries are left unchanged)\n * @returns The number of entries that were updated\n */\nexport function writeCustomFunctionIdsToManifest(\n filePath: string,\n idsByIndex: (CustomFunctionManifestIds | undefined)[],\n): number {\n const document = parseDocument(readFileSync(filePath, 'utf-8'));\n const functions = document.get('functions');\n if (!isSeq(functions)) {\n throw new Error(`Expected a \\`functions\\` list in manifest: ${filePath}`);\n }\n\n let updated = 0;\n functions.items.forEach((item, index) => {\n const ids = idsByIndex[index];\n if (!ids || !isMap(item)) {\n return;\n }\n let changed = false;\n if (ids.id && !item.has('id')) {\n // Place `id` first so it reads as the entry's key\n item.items.unshift(document.createPair('id', ids.id));\n changed = true;\n }\n if (ids.dataSiloId && !item.has('data-silo-id')) {\n // Place `data-silo-id` right after `id` (or first when there is no id)\n const idIndex = item.items.findIndex((pair) => isScalar(pair.key) && pair.key.value === 'id');\n item.items.splice(idIndex + 1, 0, document.createPair('data-silo-id', ids.dataSiloId));\n changed = true;\n }\n if (changed) {\n updated += 1;\n }\n });\n\n if (updated > 0) {\n writeFileSync(filePath, document.toString());\n }\n return updated;\n}\n"],"mappings":"2iBAIA,MAAa,EAAsC,GAAK,KAElD,EAAqB,IAAI,IAAI,CACjC,YACA,WACA,oBACA,aACA,cACA,sBACA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AAK,GAE3B,EAAK,MAAM,QAAQ,EAAS,WAAW,KAAM,EAAI,GAAG,CAAC,CACrD,EAAU,IAER,EAAI,YAAc,CAAC,EAAK,IAAI,eAAe,CAAE,CAE/C,IAAM,EAAU,EAAK,MAAM,UAAW,GAAS,EAAS,EAAK,IAAI,EAAI,EAAK,IAAI,QAAU,KAAK,CAC7F,EAAK,MAAM,OAAO,EAAU,EAAG,EAAG,EAAS,WAAW,eAAgB,EAAI,WAAW,CAAC,CACtF,EAAU,GAER,IACF,GAAW,IAEb,CAEE,EAAU,GACZ,EAAc,EAAU,EAAS,UAAU,CAAC,CAEvC"}
@@ -1,2 +1,2 @@
1
1
  import{splitCsvToList as e}from"@transcend-io/utils";const t=new Set([`ID`,`Activity`,`Encounters`,`Last Seen At`,`Has Native Do Not Sell/Share Support`,`IAB USP API Support`,`Service`,`Service Description`,`Website URL`,`Categories of Recipients`]);function n(n){return Object.entries(n).filter(e=>e[1]!==void 0&&!t.has(e[0])).map(([t,n])=>({key:t,values:e(n)}))}function r(t,r){return t.map(({"Is Regex?":t,Notes:i,Purpose:a,Status:o,Owners:s,Teams:c,Name:l,...u})=>({...typeof t==`string`?{isRegex:t.toLowerCase()===`true`}:{},name:l,description:i,trackingPurposes:e(a),status:o||r,owners:s?e(s):void 0,teams:c?e(c):void 0,attributes:n(u)}))}function i(t,r){return t.map(({Type:t,Notes:i,Purpose:a,Status:o,Owners:s,Teams:c,"Connections Made To":l,...u})=>({value:l,type:t,description:i,trackingPurposes:e(a),status:o||r,owners:s?e(s):void 0,teams:c?e(c):void 0,attributes:n(u)}))}export{i as n,r as t};
2
- //# sourceMappingURL=mapConsentCsvRowsToInputs-MMPZwzrV.mjs.map
2
+ //# sourceMappingURL=mapConsentCsvRowsToInputs-Dqb6WL4r.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"mapConsentCsvRowsToInputs-MMPZwzrV.mjs","names":[],"sources":["../src/lib/consent-manager/mapConsentCsvRowsToInputs.ts"],"sourcesContent":["import { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport { splitCsvToList } from '@transcend-io/utils';\n\nimport type { CookieCsvInput, CookieInput, DataFlowCsvInput, DataFlowInput } from '../../codecs.js';\n\nconst OMITTED_CONSENT_CSV_COLUMNS = new Set([\n 'ID',\n 'Activity',\n 'Encounters',\n 'Last Seen At',\n 'Has Native Do Not Sell/Share Support',\n 'IAB USP API Support',\n 'Service',\n 'Service Description',\n 'Website URL',\n 'Categories of Recipients',\n]);\n\n/**\n * Convert remaining CSV columns into custom attributes.\n *\n * @param columns - Columns not consumed by the native input fields.\n * @returns Custom attribute inputs.\n */\nfunction mapCustomAttributes(\n columns: Record<string, string | undefined>,\n): Array<{ key: string; values: string[] }> {\n return Object.entries(columns)\n .filter(\n (entry): entry is [string, string] =>\n entry[1] !== undefined && !OMITTED_CONSENT_CSV_COLUMNS.has(entry[0]),\n )\n .map(([key, value]) => ({\n key,\n values: splitCsvToList(value),\n }));\n}\n\n/**\n * Convert decoded cookie CSV rows into API inputs.\n *\n * @param rows - Decoded cookie CSV rows.\n * @param trackerStatus - Default status for rows without a status.\n * @returns Cookie API inputs.\n */\nexport function mapCookieCsvRowsToInputs(\n rows: CookieCsvInput[],\n trackerStatus: ConsentTrackerStatus,\n): CookieInput[] {\n return rows.map(\n ({\n 'Is Regex?': isRegex,\n Notes,\n Purpose,\n Status,\n Owners,\n Teams,\n Name,\n ...rest\n }): CookieInput => ({\n ...(typeof isRegex === 'string' ? { isRegex: isRegex.toLowerCase() === 'true' } : {}),\n name: Name,\n description: Notes,\n trackingPurposes: splitCsvToList(Purpose),\n status: Status || trackerStatus,\n owners: Owners ? splitCsvToList(Owners) : undefined,\n teams: Teams ? splitCsvToList(Teams) : undefined,\n attributes: mapCustomAttributes(rest),\n }),\n );\n}\n\n/**\n * Convert decoded data flow CSV rows into API inputs.\n *\n * @param rows - Decoded data flow CSV rows.\n * @param trackerStatus - Default status for rows without a status.\n * @returns Data flow API inputs.\n */\nexport function mapDataFlowCsvRowsToInputs(\n rows: DataFlowCsvInput[],\n trackerStatus: ConsentTrackerStatus,\n): DataFlowInput[] {\n return rows.map(\n ({\n Type,\n Notes,\n Purpose,\n Status,\n Owners,\n Teams,\n 'Connections Made To': value,\n ...rest\n }): DataFlowInput => ({\n value,\n type: Type,\n description: Notes,\n trackingPurposes: splitCsvToList(Purpose),\n status: Status || trackerStatus,\n owners: Owners ? splitCsvToList(Owners) : undefined,\n teams: Teams ? splitCsvToList(Teams) : undefined,\n attributes: mapCustomAttributes(rest),\n }),\n );\n}\n"],"mappings":"qDAKA,MAAM,EAA8B,IAAI,IAAI,CAC1C,KACA,WACA,aACA,eACA,uCACA,sBACA,UACA,sBACA,cACA,2BACD,CAAC,CAQF,SAAS,EACP,EAC0C,CAC1C,OAAO,OAAO,QAAQ,EAAQ,CAC3B,OACE,GACC,EAAM,KAAO,IAAA,IAAa,CAAC,EAA4B,IAAI,EAAM,GAAG,CACvE,CACA,KAAK,CAAC,EAAK,MAAY,CACtB,MACA,OAAQ,EAAe,EAAM,CAC9B,EAAE,CAUP,SAAgB,EACd,EACA,EACe,CACf,OAAO,EAAK,KACT,CACC,YAAa,EACb,QACA,UACA,SACA,SACA,QACA,OACA,GAAG,MACe,CAClB,GAAI,OAAO,GAAY,SAAW,CAAE,QAAS,EAAQ,aAAa,GAAK,OAAQ,CAAG,EAAE,CACpF,KAAM,EACN,YAAa,EACb,iBAAkB,EAAe,EAAQ,CACzC,OAAQ,GAAU,EAClB,OAAQ,EAAS,EAAe,EAAO,CAAG,IAAA,GAC1C,MAAO,EAAQ,EAAe,EAAM,CAAG,IAAA,GACvC,WAAY,EAAoB,EAAK,CACtC,EACF,CAUH,SAAgB,EACd,EACA,EACiB,CACjB,OAAO,EAAK,KACT,CACC,OACA,QACA,UACA,SACA,SACA,QACA,sBAAuB,EACvB,GAAG,MACiB,CACpB,QACA,KAAM,EACN,YAAa,EACb,iBAAkB,EAAe,EAAQ,CACzC,OAAQ,GAAU,EAClB,OAAQ,EAAS,EAAe,EAAO,CAAG,IAAA,GAC1C,MAAO,EAAQ,EAAe,EAAM,CAAG,IAAA,GACvC,WAAY,EAAoB,EAAK,CACtC,EACF"}
1
+ {"version":3,"file":"mapConsentCsvRowsToInputs-Dqb6WL4r.mjs","names":[],"sources":["../src/lib/consent-manager/mapConsentCsvRowsToInputs.ts"],"sourcesContent":["import { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport { splitCsvToList } from '@transcend-io/utils';\n\nimport type { CookieCsvInput, CookieInput, DataFlowCsvInput, DataFlowInput } from '../../codecs.js';\n\nconst OMITTED_CONSENT_CSV_COLUMNS = new Set([\n 'ID',\n 'Activity',\n 'Encounters',\n 'Last Seen At',\n 'Has Native Do Not Sell/Share Support',\n 'IAB USP API Support',\n 'Service',\n 'Service Description',\n 'Website URL',\n 'Categories of Recipients',\n]);\n\n/**\n * Convert remaining CSV columns into custom attributes.\n *\n * @param columns - Columns not consumed by the native input fields.\n * @returns Custom attribute inputs.\n */\nfunction mapCustomAttributes(\n columns: Record<string, string | undefined>,\n): Array<{ key: string; values: string[] }> {\n return Object.entries(columns)\n .filter(\n (entry): entry is [string, string] =>\n entry[1] !== undefined && !OMITTED_CONSENT_CSV_COLUMNS.has(entry[0]),\n )\n .map(([key, value]) => ({\n key,\n values: splitCsvToList(value),\n }));\n}\n\n/**\n * Convert decoded cookie CSV rows into API inputs.\n *\n * @param rows - Decoded cookie CSV rows.\n * @param trackerStatus - Default status for rows without a status.\n * @returns Cookie API inputs.\n */\nexport function mapCookieCsvRowsToInputs(\n rows: CookieCsvInput[],\n trackerStatus: ConsentTrackerStatus,\n): CookieInput[] {\n return rows.map(\n ({\n 'Is Regex?': isRegex,\n Notes,\n Purpose,\n Status,\n Owners,\n Teams,\n Name,\n ...rest\n }): CookieInput => ({\n ...(typeof isRegex === 'string' ? { isRegex: isRegex.toLowerCase() === 'true' } : {}),\n name: Name,\n description: Notes,\n trackingPurposes: splitCsvToList(Purpose),\n status: Status || trackerStatus,\n owners: Owners ? splitCsvToList(Owners) : undefined,\n teams: Teams ? splitCsvToList(Teams) : undefined,\n attributes: mapCustomAttributes(rest),\n }),\n );\n}\n\n/**\n * Convert decoded data flow CSV rows into API inputs.\n *\n * @param rows - Decoded data flow CSV rows.\n * @param trackerStatus - Default status for rows without a status.\n * @returns Data flow API inputs.\n */\nexport function mapDataFlowCsvRowsToInputs(\n rows: DataFlowCsvInput[],\n trackerStatus: ConsentTrackerStatus,\n): DataFlowInput[] {\n return rows.map(\n ({\n Type,\n Notes,\n Purpose,\n Status,\n Owners,\n Teams,\n 'Connections Made To': value,\n ...rest\n }): DataFlowInput => ({\n value,\n type: Type,\n description: Notes,\n trackingPurposes: splitCsvToList(Purpose),\n status: Status || trackerStatus,\n owners: Owners ? splitCsvToList(Owners) : undefined,\n teams: Teams ? splitCsvToList(Teams) : undefined,\n attributes: mapCustomAttributes(rest),\n }),\n );\n}\n"],"mappings":"qDAKA,MAAM,EAA8B,IAAI,IAAI,CAC1C,KACA,WACA,aACA,eACA,uCACA,sBACA,UACA,sBACA,cACA,2BACD,CAAC,CAQF,SAAS,EACP,EAC0C,CAC1C,OAAO,OAAO,QAAQ,EAAQ,CAC3B,OACE,GACC,EAAM,KAAO,IAAA,IAAa,CAAC,EAA4B,IAAI,EAAM,GAAG,CACvE,CACA,KAAK,CAAC,EAAK,MAAY,CACtB,MACA,OAAQ,EAAe,EAAM,CAC9B,EAAE,CAUP,SAAgB,EACd,EACA,EACe,CACf,OAAO,EAAK,KACT,CACC,YAAa,EACb,QACA,UACA,SACA,SACA,QACA,OACA,GAAG,MACe,CAClB,GAAI,OAAO,GAAY,SAAW,CAAE,QAAS,EAAQ,aAAa,GAAK,OAAQ,CAAG,EAAE,CACpF,KAAM,EACN,YAAa,EACb,iBAAkB,EAAe,EAAQ,CACzC,OAAQ,GAAU,EAClB,OAAQ,EAAS,EAAe,EAAO,CAAG,IAAA,GAC1C,MAAO,EAAQ,EAAe,EAAM,CAAG,IAAA,GACvC,WAAY,EAAoB,EAAK,CACtC,EACF,CAUH,SAAgB,EACd,EACA,EACiB,CACjB,OAAO,EAAK,KACT,CACC,OACA,QACA,UACA,SACA,SACA,QACA,sBAAuB,EACvB,GAAG,MACiB,CACpB,QACA,KAAM,EACN,YAAa,EACb,iBAAkB,EAAe,EAAQ,CACzC,OAAQ,GAAU,EAClB,OAAQ,EAAS,EAAe,EAAO,CAAG,IAAA,GAC1C,MAAO,EAAQ,EAAe,EAAM,CAAG,IAAA,GACvC,WAAY,EAAoB,EAAK,CACtC,EACF"}
@@ -1,2 +1,2 @@
1
- import{a as e}from"./constants-BG53Mbi9.mjs";import{t}from"./logger-9T6vva73.mjs";import{RequestDataSiloStatus as n}from"@transcend-io/privacy-types";import r from"colors";import{CHANGE_REQUEST_DATA_SILO_STATUS as i,buildTranscendGraphQLClient as a,fetchRequestDataSilo as o,makeGraphQLRequest as s}from"@transcend-io/sdk";import{map as c}from"@transcend-io/utils";import l from"cli-progress";async function u({requestIds:u,dataSiloId:d,auth:f,concurrency:p=100,status:m=n.Resolved,transcendUrl:h=e}){let g=a(h,f),_=new Date().getTime(),v=new l.SingleBar({},l.Presets.shades_classic);t.info(r.magenta(`Notifying Transcend for data silo "${d}" marking "${u.length}" requests as completed.`));let y=0;v.start(u.length,0),await c(u,async e=>{let n=await o(g,{logger:t,filterBy:{requestId:e,dataSiloId:d}});try{await s(g,i,{variables:{requestDataSiloId:n.id,status:m},logger:t})}catch(e){if(!e.message.includes(`Client error: Request must be active:`)&&!e.message.includes(`Failed to find RequestDataSilo`))throw e}y+=1,v.update(y)},{concurrency:p}),v.stop();let b=new Date().getTime()-_;return t.info(r.green(`Successfully notified Transcend in "${b/1e3}" seconds!`)),u.length}export{u as t};
2
- //# sourceMappingURL=markRequestDataSiloIdsCompleted-PKCcn5wQ.mjs.map
1
+ import{a as e}from"./constants-jjHIzHGm.mjs";import{t}from"./logger-zplFSeXU.mjs";import{RequestDataSiloStatus as n}from"@transcend-io/privacy-types";import r from"colors";import{CHANGE_REQUEST_DATA_SILO_STATUS as i,buildTranscendGraphQLClient as a,fetchRequestDataSilo as o,makeGraphQLRequest as s}from"@transcend-io/sdk";import{map as c}from"@transcend-io/utils";import l from"cli-progress";async function u({requestIds:u,dataSiloId:d,auth:f,concurrency:p=100,status:m=n.Resolved,transcendUrl:h=e}){let g=a(h,f),_=new Date().getTime(),v=new l.SingleBar({},l.Presets.shades_classic);t.info(r.magenta(`Notifying Transcend for data silo "${d}" marking "${u.length}" requests as completed.`));let y=0;v.start(u.length,0),await c(u,async e=>{let n=await o(g,{logger:t,filterBy:{requestId:e,dataSiloId:d}});try{await s(g,i,{variables:{requestDataSiloId:n.id,status:m},logger:t})}catch(e){if(!e.message.includes(`Client error: Request must be active:`)&&!e.message.includes(`Failed to find RequestDataSilo`))throw e}y+=1,v.update(y)},{concurrency:p}),v.stop();let b=new Date().getTime()-_;return t.info(r.green(`Successfully notified Transcend in "${b/1e3}" seconds!`)),u.length}export{u as t};
2
+ //# sourceMappingURL=markRequestDataSiloIdsCompleted-B5N-cQWr.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"markRequestDataSiloIdsCompleted-PKCcn5wQ.mjs","names":[],"sources":["../src/lib/cron/markRequestDataSiloIdsCompleted.ts"],"sourcesContent":["import { RequestDataSiloStatus } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n makeGraphQLRequest,\n CHANGE_REQUEST_DATA_SILO_STATUS,\n fetchRequestDataSilo,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\n\n/**\n * Given a CSV of Request IDs, mark associated RequestDataSilos as completed\n *\n * @param options - Options\n * @returns Number of items marked as completed\n */\nexport async function markRequestDataSiloIdsCompleted({\n requestIds,\n dataSiloId,\n auth,\n concurrency = 100,\n status = RequestDataSiloStatus.Resolved,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The list of request ids to mark as completed */\n requestIds: string[];\n /** Transcend API key authentication */\n auth: string;\n /** Data Silo ID to pull down jobs for */\n dataSiloId: string;\n /** Status to update requests to */\n status?: RequestDataSiloStatus;\n /** Upload concurrency */\n concurrency?: number;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Notify Transcend\n logger.info(\n colors.magenta(\n `Notifying Transcend for data silo \"${dataSiloId}\" marking \"${requestIds.length}\" requests as completed.`,\n ),\n );\n\n let total = 0;\n progressBar.start(requestIds.length, 0);\n await map(\n requestIds,\n async (requestId) => {\n const requestDataSilo = await fetchRequestDataSilo(client, {\n logger,\n filterBy: { requestId, dataSiloId },\n });\n\n try {\n await makeGraphQLRequest<{\n /** Whether we successfully uploaded the results */\n success: boolean;\n }>(client, CHANGE_REQUEST_DATA_SILO_STATUS, {\n variables: {\n requestDataSiloId: requestDataSilo.id,\n status,\n },\n logger,\n });\n } catch (err) {\n if (\n !err.message.includes('Client error: Request must be active:') &&\n !err.message.includes('Failed to find RequestDataSilo')\n ) {\n throw err;\n }\n }\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(colors.green(`Successfully notified Transcend in \"${totalTime / 1000}\" seconds!`));\n return requestIds.length;\n}\n"],"mappings":"yYAoBA,eAAsB,EAAgC,CACpD,aACA,aACA,OACA,cAAc,IACd,SAAS,EAAsB,SAC/B,eAAe,GAcG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAGrF,EAAO,KACL,EAAO,QACL,sCAAsC,EAAW,aAAa,EAAW,OAAO,0BACjF,CACF,CAED,IAAI,EAAQ,EACZ,EAAY,MAAM,EAAW,OAAQ,EAAE,CACvC,MAAM,EACJ,EACA,KAAO,IAAc,CACnB,IAAM,EAAkB,MAAM,EAAqB,EAAQ,CACzD,SACA,SAAU,CAAE,YAAW,aAAY,CACpC,CAAC,CAEF,GAAI,CACF,MAAM,EAGH,EAAQ,EAAiC,CAC1C,UAAW,CACT,kBAAmB,EAAgB,GACnC,SACD,CACD,SACD,CAAC,OACK,EAAK,CACZ,GACE,CAAC,EAAI,QAAQ,SAAS,wCAAwC,EAC9D,CAAC,EAAI,QAAQ,SAAS,iCAAiC,CAEvD,MAAM,EAIV,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAGvB,OADA,EAAO,KAAK,EAAO,MAAM,uCAAuC,EAAY,IAAK,YAAY,CAAC,CACvF,EAAW"}
1
+ {"version":3,"file":"markRequestDataSiloIdsCompleted-B5N-cQWr.mjs","names":[],"sources":["../src/lib/cron/markRequestDataSiloIdsCompleted.ts"],"sourcesContent":["import { RequestDataSiloStatus } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n makeGraphQLRequest,\n CHANGE_REQUEST_DATA_SILO_STATUS,\n fetchRequestDataSilo,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\n\n/**\n * Given a CSV of Request IDs, mark associated RequestDataSilos as completed\n *\n * @param options - Options\n * @returns Number of items marked as completed\n */\nexport async function markRequestDataSiloIdsCompleted({\n requestIds,\n dataSiloId,\n auth,\n concurrency = 100,\n status = RequestDataSiloStatus.Resolved,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The list of request ids to mark as completed */\n requestIds: string[];\n /** Transcend API key authentication */\n auth: string;\n /** Data Silo ID to pull down jobs for */\n dataSiloId: string;\n /** Status to update requests to */\n status?: RequestDataSiloStatus;\n /** Upload concurrency */\n concurrency?: number;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Notify Transcend\n logger.info(\n colors.magenta(\n `Notifying Transcend for data silo \"${dataSiloId}\" marking \"${requestIds.length}\" requests as completed.`,\n ),\n );\n\n let total = 0;\n progressBar.start(requestIds.length, 0);\n await map(\n requestIds,\n async (requestId) => {\n const requestDataSilo = await fetchRequestDataSilo(client, {\n logger,\n filterBy: { requestId, dataSiloId },\n });\n\n try {\n await makeGraphQLRequest<{\n /** Whether we successfully uploaded the results */\n success: boolean;\n }>(client, CHANGE_REQUEST_DATA_SILO_STATUS, {\n variables: {\n requestDataSiloId: requestDataSilo.id,\n status,\n },\n logger,\n });\n } catch (err) {\n if (\n !err.message.includes('Client error: Request must be active:') &&\n !err.message.includes('Failed to find RequestDataSilo')\n ) {\n throw err;\n }\n }\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(colors.green(`Successfully notified Transcend in \"${totalTime / 1000}\" seconds!`));\n return requestIds.length;\n}\n"],"mappings":"yYAoBA,eAAsB,EAAgC,CACpD,aACA,aACA,OACA,cAAc,IACd,SAAS,EAAsB,SAC/B,eAAe,GAcG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAGrF,EAAO,KACL,EAAO,QACL,sCAAsC,EAAW,aAAa,EAAW,OAAO,0BACjF,CACF,CAED,IAAI,EAAQ,EACZ,EAAY,MAAM,EAAW,OAAQ,EAAE,CACvC,MAAM,EACJ,EACA,KAAO,IAAc,CACnB,IAAM,EAAkB,MAAM,EAAqB,EAAQ,CACzD,SACA,SAAU,CAAE,YAAW,aAAY,CACpC,CAAC,CAEF,GAAI,CACF,MAAM,EAGH,EAAQ,EAAiC,CAC1C,UAAW,CACT,kBAAmB,EAAgB,GACnC,SACD,CACD,SACD,CAAC,OACK,EAAK,CACZ,GACE,CAAC,EAAI,QAAQ,SAAS,wCAAwC,EAC9D,CAAC,EAAI,QAAQ,SAAS,iCAAiC,CAEvD,MAAM,EAIV,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAGvB,OADA,EAAO,KAAK,EAAO,MAAM,uCAAuC,EAAY,IAAK,YAAY,CAAC,CACvF,EAAW"}
@@ -1,2 +1,2 @@
1
- import{a as e}from"./constants-BG53Mbi9.mjs";import{t}from"./logger-9T6vva73.mjs";import{o as n}from"./request-B1yRTdG-.mjs";import{r}from"./fetchAllRequests-CEDKdq0c.mjs";import{RequestStatus as i}from"@transcend-io/privacy-types";import a from"colors";import{buildTranscendGraphQLClient as o,makeGraphQLRequest as s}from"@transcend-io/sdk";import{map as c}from"@transcend-io/utils";import l from"cli-progress";async function u({requestActions:u,auth:d,requestIds:f,statuses:p=[i.Compiling,i.RequestMade,i.Delayed,i.Approving,i.Secondary,i.Enriching,i.Waiting,i.SecondaryApproving],createdAtAfter:m,createdAtBefore:h,updatedAtBefore:g,updatedAtAfter:_,concurrency:v=100,transcendUrl:y=e}){let b=o(y,d),x=new Date().getTime(),S=new l.SingleBar({},l.Presets.shades_classic),C=await r(b,{actions:u,statuses:p,createdAtBefore:h,createdAtAfter:m,updatedAtBefore:g,updatedAtAfter:_,isSilent:!1,requestIds:f});t.info(a.magenta(`Marking "${C.length}" as silent mode.`));let w=0;S.start(C.length,0),await c(C,async e=>{await s(b,n,{variables:{input:{id:e.id,isSilent:!0}},logger:t}),w+=1,S.update(w)},{concurrency:v}),S.stop();let T=new Date().getTime()-x;return t.info(a.green(`Successfully marked ${w} requests as silent mode in "${T/1e3}" seconds!`)),C.length}export{u as t};
2
- //# sourceMappingURL=markSilentPrivacyRequests-7l9I99pe.mjs.map
1
+ import{a as e}from"./constants-jjHIzHGm.mjs";import{t}from"./logger-zplFSeXU.mjs";import{o as n}from"./request-BiPv6jmP.mjs";import{r}from"./fetchAllRequests-2TZr-LfT.mjs";import{RequestStatus as i}from"@transcend-io/privacy-types";import a from"colors";import{buildTranscendGraphQLClient as o,makeGraphQLRequest as s}from"@transcend-io/sdk";import{map as c}from"@transcend-io/utils";import l from"cli-progress";async function u({requestActions:u,auth:d,requestIds:f,statuses:p=[i.Compiling,i.RequestMade,i.Delayed,i.Approving,i.Secondary,i.Enriching,i.Waiting,i.SecondaryApproving],createdAtAfter:m,createdAtBefore:h,updatedAtBefore:g,updatedAtAfter:_,concurrency:v=100,transcendUrl:y=e}){let b=o(y,d),x=new Date().getTime(),S=new l.SingleBar({},l.Presets.shades_classic),C=await r(b,{actions:u,statuses:p,createdAtBefore:h,createdAtAfter:m,updatedAtBefore:g,updatedAtAfter:_,isSilent:!1,requestIds:f});t.info(a.magenta(`Marking "${C.length}" as silent mode.`));let w=0;S.start(C.length,0),await c(C,async e=>{await s(b,n,{variables:{input:{id:e.id,isSilent:!0}},logger:t}),w+=1,S.update(w)},{concurrency:v}),S.stop();let T=new Date().getTime()-x;return t.info(a.green(`Successfully marked ${w} requests as silent mode in "${T/1e3}" seconds!`)),C.length}export{u as t};
2
+ //# sourceMappingURL=markSilentPrivacyRequests-BiaButWF.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"markSilentPrivacyRequests-7l9I99pe.mjs","names":[],"sources":["../src/lib/requests/markSilentPrivacyRequests.ts"],"sourcesContent":["import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, makeGraphQLRequest } from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { UPDATE_PRIVACY_REQUEST, fetchAllRequests } from '../graphql/index.js';\n\n/**\n * Mark a set of privacy requests to be in silent mode\n *\n * @param options - Options\n * @returns The number of requests marked silent\n */\nexport async function markSilentPrivacyRequests({\n requestActions,\n auth,\n requestIds,\n statuses = [\n RequestStatus.Compiling,\n RequestStatus.RequestMade,\n RequestStatus.Delayed,\n RequestStatus.Approving,\n RequestStatus.Secondary,\n RequestStatus.Enriching,\n RequestStatus.Waiting,\n RequestStatus.SecondaryApproving,\n ],\n createdAtAfter,\n createdAtBefore,\n updatedAtBefore,\n updatedAtAfter,\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The request actions that should be restarted */\n requestActions: RequestAction[];\n /** Transcend API key authentication */\n auth: string;\n /** Concurrency limit for approving */\n concurrency?: number;\n /** The request statuses to mark silent */\n statuses?: RequestStatus[];\n /** The set of privacy requests to mark silent */\n requestIds?: string[];\n /** Filter for requests created before this date */\n createdAtBefore?: Date;\n /** Filter for requests created after this date */\n createdAtAfter?: Date;\n /** Filter for requests updated before this date */\n updatedAtBefore?: Date;\n /** Filter for requests updated after this date */\n updatedAtAfter?: Date;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Pull in the requests\n const allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n statuses,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isSilent: false,\n requestIds,\n });\n\n // Notify Transcend\n logger.info(colors.magenta(`Marking \"${allRequests.length}\" as silent mode.`));\n\n let total = 0;\n progressBar.start(allRequests.length, 0);\n await map(\n allRequests,\n async (requestToMarkSilent) => {\n await makeGraphQLRequest(client, UPDATE_PRIVACY_REQUEST, {\n variables: {\n input: {\n id: requestToMarkSilent.id,\n isSilent: true,\n },\n },\n logger,\n });\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully marked ${total} requests as silent mode in \"${totalTime / 1000}\" seconds!`,\n ),\n );\n return allRequests.length;\n}\n"],"mappings":"4ZAgBA,eAAsB,EAA0B,CAC9C,iBACA,OACA,aACA,WAAW,CACT,EAAc,UACd,EAAc,YACd,EAAc,QACd,EAAc,UACd,EAAc,UACd,EAAc,UACd,EAAc,QACd,EAAc,mBACf,CACD,iBACA,kBACA,kBACA,iBACA,cAAc,IACd,eAAe,GAsBG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAG/E,EAAc,MAAM,EAAiB,EAAQ,CACjD,QAAS,EACT,WACA,kBACA,iBACA,kBACA,iBACA,SAAU,GACV,aACD,CAAC,CAGF,EAAO,KAAK,EAAO,QAAQ,YAAY,EAAY,OAAO,mBAAmB,CAAC,CAE9E,IAAI,EAAQ,EACZ,EAAY,MAAM,EAAY,OAAQ,EAAE,CACxC,MAAM,EACJ,EACA,KAAO,IAAwB,CAC7B,MAAM,EAAmB,EAAQ,EAAwB,CACvD,UAAW,CACT,MAAO,CACL,GAAI,EAAoB,GACxB,SAAU,GACX,CACF,CACD,SACD,CAAC,CAEF,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAOvB,OALA,EAAO,KACL,EAAO,MACL,uBAAuB,EAAM,+BAA+B,EAAY,IAAK,YAC9E,CACF,CACM,EAAY"}
1
+ {"version":3,"file":"markSilentPrivacyRequests-BiaButWF.mjs","names":[],"sources":["../src/lib/requests/markSilentPrivacyRequests.ts"],"sourcesContent":["import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, makeGraphQLRequest } from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { UPDATE_PRIVACY_REQUEST, fetchAllRequests } from '../graphql/index.js';\n\n/**\n * Mark a set of privacy requests to be in silent mode\n *\n * @param options - Options\n * @returns The number of requests marked silent\n */\nexport async function markSilentPrivacyRequests({\n requestActions,\n auth,\n requestIds,\n statuses = [\n RequestStatus.Compiling,\n RequestStatus.RequestMade,\n RequestStatus.Delayed,\n RequestStatus.Approving,\n RequestStatus.Secondary,\n RequestStatus.Enriching,\n RequestStatus.Waiting,\n RequestStatus.SecondaryApproving,\n ],\n createdAtAfter,\n createdAtBefore,\n updatedAtBefore,\n updatedAtAfter,\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The request actions that should be restarted */\n requestActions: RequestAction[];\n /** Transcend API key authentication */\n auth: string;\n /** Concurrency limit for approving */\n concurrency?: number;\n /** The request statuses to mark silent */\n statuses?: RequestStatus[];\n /** The set of privacy requests to mark silent */\n requestIds?: string[];\n /** Filter for requests created before this date */\n createdAtBefore?: Date;\n /** Filter for requests created after this date */\n createdAtAfter?: Date;\n /** Filter for requests updated before this date */\n updatedAtBefore?: Date;\n /** Filter for requests updated after this date */\n updatedAtAfter?: Date;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Pull in the requests\n const allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n statuses,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isSilent: false,\n requestIds,\n });\n\n // Notify Transcend\n logger.info(colors.magenta(`Marking \"${allRequests.length}\" as silent mode.`));\n\n let total = 0;\n progressBar.start(allRequests.length, 0);\n await map(\n allRequests,\n async (requestToMarkSilent) => {\n await makeGraphQLRequest(client, UPDATE_PRIVACY_REQUEST, {\n variables: {\n input: {\n id: requestToMarkSilent.id,\n isSilent: true,\n },\n },\n logger,\n });\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully marked ${total} requests as silent mode in \"${totalTime / 1000}\" seconds!`,\n ),\n );\n return allRequests.length;\n}\n"],"mappings":"4ZAgBA,eAAsB,EAA0B,CAC9C,iBACA,OACA,aACA,WAAW,CACT,EAAc,UACd,EAAc,YACd,EAAc,QACd,EAAc,UACd,EAAc,UACd,EAAc,UACd,EAAc,QACd,EAAc,mBACf,CACD,iBACA,kBACA,kBACA,iBACA,cAAc,IACd,eAAe,GAsBG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAG/E,EAAc,MAAM,EAAiB,EAAQ,CACjD,QAAS,EACT,WACA,kBACA,iBACA,kBACA,iBACA,SAAU,GACV,aACD,CAAC,CAGF,EAAO,KAAK,EAAO,QAAQ,YAAY,EAAY,OAAO,mBAAmB,CAAC,CAE9E,IAAI,EAAQ,EACZ,EAAY,MAAM,EAAY,OAAQ,EAAE,CACxC,MAAM,EACJ,EACA,KAAO,IAAwB,CAC7B,MAAM,EAAmB,EAAQ,EAAwB,CACvD,UAAW,CACT,MAAO,CACL,GAAI,EAAoB,GACxB,SAAU,GACX,CACF,CACD,SACD,CAAC,CAEF,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAOvB,OALA,EAAO,KACL,EAAO,MACL,uBAAuB,EAAM,+BAA+B,EAAY,IAAK,YAC9E,CACF,CACM,EAAY"}
@@ -0,0 +1,3 @@
1
+ import{t as e}from"./logger-zplFSeXU.mjs";import{gt as t}from"./codecs-CTxFjCg4.mjs";import{chunk as n,difference as r,flatten as i,keyBy as a,uniq as o}from"lodash-es";import s from"colors";import{apply as c,getEntries as l}from"@transcend-io/type-utils";import{CREATE_DATA_SILOS as u,UPDATE_DATA_SILOS as d,UPDATE_OR_CREATE_DATA_POINT as f,convertToDataSubjectBlockList as p,createDataSubject as m,fetchAllActions as h,fetchAllAttributes as g,fetchAllDataSilos as _,fetchAllDataSubjects as v,fetchApiKeys as y,fetchIdentifiersAndCreateMissing as b,makeGraphQLRequest as x,syncAction as S,syncActionItemCollections as C,syncActionItems as w,syncAttribute as T,syncBusinessEntities as ee,syncConsentManager as te,syncConsentWorkflowTriggers as ne,syncCookies as re,syncDataCategories as ie,syncDataFlows as ae,syncDataSiloDependencies as oe,syncDataSubject as se,syncEnricher as ce,syncIdentifier as le,syncIntlMessages as ue,syncPartitions as de,syncPolicies as fe,syncPreferenceOptionValues as pe,syncPreferenceTopics as me,syncPrivacyCenter as he,syncProcessingActivities as ge,syncProcessingPurposes as _e,syncPurposes as ve,syncTeams as ye,syncTemplate as be,syncVendors as xe,syncWorkflowConfigs as Se}from"@transcend-io/sdk";import{map as E,mapSeries as D}from"@transcend-io/utils";import O from"cli-progress";const k=/^[A-Za-z]+$/;function Ce(e){let t=[],n=(e,n)=>{k.test(e)||t.push(`${n}: slug "${e}" is invalid — slugs must contain only alphabetical letters (A-Z, a-z). Topic slugs are normalized to PascalCase server-side, so YAML slugs should already be PascalCase or matching will break on subsequent pulls.`)};for(let t of e[`preference-options`]??[])n(t.slug,`preference-options`);for(let t of e.purposes??[])for(let e of t[`preference-topics`]??[]){n(e.slug,`purposes (topic "${e.title}")`);for(let t of e.options??[])n(t.slug,`purposes (topic "${e.title}" option "${t.title}")`)}return t}async function A({"data-silos":t=[],"data-subjects":n=[],"processing-activities":c=[],preflights:l=[]},u,d=!1){let f=o([...i(t.map(e=>e[`data-subjects`]||[])||[]),...i(c.map(({dataSubjectTypes:e})=>e??[])??[]),...i(l.map(e=>e[`data-subjects`]||[])||[]),...n.map(e=>e.type)]);if(f.length===0&&!d)return{};let p=await v(u,{logger:e}),h=a(p,`type`),g=r(f,p.map(({type:e})=>e));if(g.length>0){e.info(s.magenta(`Creating ${g.length} new data subjects...`));for(let t of g){e.info(s.magenta(`Creating data subject ${t}...`));let n=await m(u,{input:t,logger:e});e.info(s.green(`Created data subject ${t}!`)),h[t]=n}}return h}function we(e,t){if(e.length===0)return[];if(typeof e[0]==`string`)return[{titles:o(e)}];let n,r=[],i=new Set,a=(e,n)=>{if(i.has(e))throw Error(`Data silo "${t}" has multiple deletion-dependencies entries for workflow "${e}". Combine them into a single entry.`);i.add(e),r.push({workflowConfigInternalName:e,...n})};return e.forEach(e=>{if(`reset-to-global`in e&&`titles`in e)throw Error(`Data silo "${t}" has a deletion-dependencies entry for workflow "${e.workflow}" that sets both "reset-to-global" and "titles". Use "titles: []" to override the global configuration with no dependencies, or "reset-to-global: true" to fall back to the global configuration.`);if(`reset-to-global`in e){a(e.workflow,{resetToGlobal:!0});return}if(e.workflow){a(e.workflow,{titles:e.titles});return}if(n!==void 0)throw Error(`Data silo "${t}" has multiple global deletion-dependencies entries. Combine them into a single \`{ titles: [...] }\` entry.`);n=e.titles}),[...n===void 0?[]:[{titles:o(n)}],...r]}async function j(t,r,{pageSize:i,dataSubjectsByName:o,apiKeysByTitle:l}){let m=!1,h=new Date().getTime();e.info(s.magenta(`Syncing "${t.length}" data silos...`));let g=a(await _(r,{titles:t.map(({title:e})=>e),pageSize:i,logger:e}),`title`),v=t.filter(({title:e})=>!g[e]);v.length>0&&(e.info(s.magenta(`Creating "${v.length}" data silos that did not exist...`)),await D(n(v,20),async t=>{let{createDataSilos:{dataSilos:n}}=await x(r,u,{variables:{input:t.map(e=>({name:e[`outer-type`]||e.integrationName,title:e.title,country:e.country,countrySubDivision:e.countrySubDivision,sombraId:e[`sombra-id`]}))},logger:e});n.forEach(e=>{g[e.title]=e})}),e.info(s.green(`Successfully created "${v.length}" data silos!`)));let y=n(t,20);await D(y,async(t,n)=>{e.info(s.magenta(`[Batch ${n+1}/${y.length}] Syncing "${t.length}" data silos`)),await x(r,d,{variables:{input:{dataSilos:t.map(e=>({id:g[e.title].id,country:e.country,countrySubDivision:e.countrySubDivision,url:e.url,headers:e.headers,description:e.description,identifiers:e[`identity-keys`],isLive:!e.disabled,ownerEmails:e.owners,teamNames:e.teams,dependedOnDataSilos:e[`deletion-dependencies`]?void 0:[{titles:[]}],apiKeyId:e[`api-key-title`]?l[e[`api-key-title`]].id:void 0,dataSubjectBlockListIds:e[`data-subjects`]?p(e[`data-subjects`],o):void 0,attributes:e.attributes,businessEntityTitles:e.businessEntityTitles,sombraId:e[`sombra-id`],notifyEmailAddress:e[`email-settings`]?.[`notify-email-address`],promptAVendorEmailSendFrequency:e[`email-settings`]?.[`send-frequency`],promptAVendorEmailSendType:e[`email-settings`]?.[`send-type`],promptAVendorEmailIncludeIdentifiersAttachment:e[`email-settings`]?.[`include-identifiers-attachment`],promptAVendorEmailCompletionLinkType:e[`email-settings`]?.[`completion-link-type`],manualWorkRetryFrequency:e[`email-settings`]?.[`manual-work-retry-frequency`]}))}},logger:e}),e.info(s.green(`[Batch ${n+1}/${y.length}] Synced "${t.length}" data silos!`))});let b=new O.SingleBar({},O.Presets.shades_classic),S=t.filter(({datapoints:e=[]})=>e.length>0),C=t.map(({datapoints:e=[]})=>e.length).reduce((e,t)=>e+t,0);e.info(s.magenta(`Syncing "${C}" datapoints from "${S.length}" data silos...`)),b.start(C,0);let w=0;await E(S,async({datapoints:t,title:n})=>{t&&await D(t,async t=>{let i=t.fields?t.fields.map(({key:e,description:t,categories:n,purposes:r,attributes:i,...a})=>({name:e,description:t,categories:n?n.map(e=>({...e,name:e.name||`Other`})):void 0,purposes:r?r.map(e=>({...e,name:e.name||`Other`})):void 0,attributes:i,accessRequestVisibilityEnabled:a[`access-request-visibility-enabled`],erasureRequestRedactionEnabled:a[`erasure-request-redaction-enabled`]})):void 0,a={dataSiloId:g[n].id,path:t.path,name:t.key,title:t.title,description:t.description,...t.owners?{ownerEmails:t.owners}:{},...t.teams?{teamNames:t.teams}:{},...t[`data-collection-tag`]?{dataCollectionTag:t[`data-collection-tag`]}:{},querySuggestions:t[`privacy-action-queries`]?Object.entries(t[`privacy-action-queries`]).map(([e,t])=>({requestType:e,suggestedQuery:t})):void 0,enabledActions:t[`privacy-actions`]||[],subDataPoints:i},o=(a.subDataPoints||[]).map(({name:e})=>e),c=o.filter((e,t)=>o.indexOf(e)!==t);if(c.length>0)e.info(s.red(`\nCannot update datapoint "${t.key}" as it has duplicate sub-datapoints with the same name: \n${c.join(`
2
+ `)}`)),m=!0;else try{await x(r,f,{variables:a,logger:e})}catch(r){e.info(s.red(`\nFailed to update datapoint "${t.key}" for data silo "${n}"! - \n${r.message}`)),m=!0}w+=1,b.update(w)})},{concurrency:10}),b.stop();let T=new Date().getTime()-h;return e.info(s.green(`Synced "${t.length}" data silos and "${C}" datapoints in "${T/1e3}" seconds!`)),{success:!m,dataSiloTitleToId:c(g,({id:e})=>e)}}async function M(n,r,{pageSize:i=50,publishToPrivacyCenter:a=!0,classifyService:o=!1,deleteExtraAttributeValues:c=!1,logger:l,warnings:u=[]}){let d=t(n),f=l??e,p=[],m=!1,_=(e,t,n)=>{p.push({resource:e,item:n,message:t}),m=!0};f.info(s.magenta(`Fetching data with page size ${i}...`));let{templates:x,attributes:D,actions:O,identifiers:k,"data-subjects":M,"business-entities":N,preflights:P,cookies:F,"consent-manager":I,"data-silos":L,"data-flows":R,vendors:z,"data-categories":B,"processing-activities":V,"processing-purposes":H,"action-items":U,"action-item-collections":W,teams:G,"privacy-center":K,messages:q,policies:J,partitions:Y,"preference-workflow-configs":Te,"workflow-configs":Ee}=d,De=d[`preference-options`],X=d.purposes,Oe=Ce(d);if(Oe.length>0){for(let e of Oe)_(`preference-slugs`,e);return{success:!1,errors:p,warnings:u.length>0?u:void 0}}let[Z,Q,ke]=await Promise.all([P||k?b(r,{input:d,skipPublish:!a,logger:e}):{},L||M||P||V?A(d,r):{},L&&L.map(e=>e[`api-key-title`]||[]).reduce((e,t)=>e+t.length,0)>0?y(r,{apiKeyInputs:d,logger:e}):{}]);if(Te?.length&&(await ne(r,Te,{logger:f,pageSize:i})||_(`preference-workflow-configs`,`Failed to sync preference workflow configs`)),Ee?.length&&(await Se(r,Ee,{logger:f})||_(`workflow-configs`,`Failed to sync workflow configs`)),De?.length&&(await pe(r,De,{logger:f})||_(`preference-options`,`Failed to sync preference option values`)),X?.length){let{success:e,purposeIdByTrackingType:t}=await ve(r,X,{logger:f});e||_(`purposes`,`Failed to sync one or more purposes`);let n=X.flatMap(e=>(e[`preference-topics`]??[]).map(t=>({...t,"tracking-type":e.trackingType})));n.length>0&&(await me(r,n,{logger:f,purposeIdByTrackingType:t})||_(`preference-topics`,`Failed to sync one or more preference topics`))}if(I){f.info(s.magenta(`Syncing consent manager...`));try{await te(r,I,{logger:f}),f.info(s.green(`Successfully synced consent manager!`))}catch(e){_(`consent-manager`,e.message),f.error(s.red(`Failed to sync consent manager! - ${e.message}`))}}if(G){let t=await ye(r,G,{logger:e});m||=!t}if(x&&(e.info(s.magenta(`Syncing "${x.length}" email templates...`)),await E(x,async t=>{e.info(s.magenta(`Syncing template "${t.title}"...`));try{await be(r,t,{logger:e}),e.info(s.green(`Successfully synced template "${t.title}"!`))}catch(n){m=!0,e.error(s.red(`Failed to sync template "${t.title}"! - ${n.message}`))}},{concurrency:10}),e.info(s.green(`Synced "${x.length}" email templates!`))),N){let t=await ee(r,N,{logger:e});m||=!t}if(z){let t=await xe(r,z,{logger:e});m||=!t}if(B){let t=await ie(r,B,{logger:e});m||=!t}if(H){let t=await _e(r,H,{logger:e});m||=!t}if(Y){let t=await de(r,Y,{logger:e});m||=!t}if(F){let t=await re(r,F,{logger:e});m||=!t}if(W){let t=await C(r,W,{logger:e});m||=!t}if(D){e.info(s.magenta(`Syncing "${D.length}" attributes...`));let t=await g(r,{logger:e});await E(D,async n=>{let i=t.find(e=>e.name===n.name);e.info(s.magenta(`Syncing attribute "${n.name}"...`));try{await T(r,n,{existingAttribute:i,deleteExtraAttributeValues:c,logger:e}),e.info(s.green(`Successfully synced attribute "${n.name}"!`))}catch(t){m=!0,e.error(s.red(`Failed to sync attribute "${n.name}"! - ${t.message}`))}},{concurrency:10}),e.info(s.green(`Synced "${D.length}" attributes!`))}if(U){let t=await w(r,U,{logger:e});m||=!t}if(P&&(e.info(s.magenta(`Syncing "${P.length}" preflight checks...`)),await E(P,async t=>{e.info(s.magenta(`Syncing preflight check "${t.title}"...`));try{await ce(r,{input:t,identifierByName:Z,dataSubjectsByName:Q,logger:e}),e.info(s.green(`Successfully synced preflight check "${t.title}"!`))}catch(n){m=!0,e.error(s.red(`Failed to sync preflight check "${t.title}"! - ${n.message}`))}},{concurrency:10}),e.info(s.green(`Synced "${P.length}" preflight checks!`))),k&&(e.info(s.magenta(`Syncing "${k.length}" identifiers...`)),await E(k,async t=>{let n=Z[t.name];if(!n)throw Error(`Failed to find identifier with name: ${t.type}. Should have been auto-created by cli.`);e.info(s.magenta(`Syncing identifier "${t.type}"...`));try{await le(r,{input:t,dataSubjectsByName:Q,identifierId:n.id,skipPublish:!a,logger:e}),e.info(s.green(`Successfully synced identifier "${t.type}"!`))}catch(n){m=!0,e.info(s.red(`Failed to sync identifier "${t.type}"! - ${n.message}`))}},{concurrency:10}),e.info(s.green(`Synced "${k.length}" identifiers!`))),O){e.info(s.magenta(`Syncing "${O.length}" actions...`));let t=await h(r,{logger:e});await E(O,async n=>{let i=t.find(e=>e.type===n.type);if(!i)throw Error(`Failed to find action with type: ${n.type}. Should have already existing in the organization.`);e.info(s.magenta(`Syncing action "${n.type}"...`));try{await S(r,{action:n,actionId:i.id,skipPublish:!a},{logger:e}),e.info(s.green(`Successfully synced action "${n.type}"!`))}catch(t){m=!0,e.error(s.red(`Failed to sync action "${n.type}"! - ${t.message}`))}},{concurrency:10}),e.info(s.green(`Synced "${O.length}" actions!`))}if(M){e.info(s.magenta(`Syncing "${M.length}" data subjects...`));let t=await v(r,{logger:e});await E(M,async n=>{let i=t.find(e=>e.type===n.type);if(!i)throw Error(`Failed to find data subject with type: ${n.type}. Should have already existing in the organization.`);e.info(s.magenta(`Syncing data subject "${n.type}"...`));try{await se(r,{input:n,dataSubjectId:i.id,skipPublish:!a,logger:e}),e.info(s.green(`Successfully synced data subject "${n.type}"!`))}catch(t){m=!0;let r=n.supportsAuthorizedAgent!==void 0&&/authorized.agent/i.test(t.message)?` (enable the Authorized Agents feature for this organization before setting "supportsAuthorizedAgent")`:``;e.info(s.red(`Failed to sync data subject "${n.type}"! - ${t.message}${r}`))}},{concurrency:10}),e.info(s.green(`Synced "${M.length}" data subjects!`))}if(R){let t=await ae(r,R,{classifyService:o,logger:e});m||=!t}if(K)try{await he(r,K,{logger:e,skipPublish:!a})||_(`privacy-center`,`Failed to sync privacy center`)}catch(e){_(`privacy-center`,e.message)}if(q){let t=await ue(r,q,{logger:e});m||=!t}if(J){let t=await fe(r,J,{logger:e});m||=!t}let $=[];if(L){let{success:e,dataSiloTitleToId:t}=await j(L,r,{dataSubjectsByName:Q,apiKeysByTitle:ke,pageSize:i});L?.forEach(e=>{let n=e[`deletion-dependencies`];if(n)try{$.push([t[e.title],we(n,e.title)])}catch(t){_(`data-silos`,t.message,e.title),f.error(s.red(t.message))}}),m||=!e}if($.length>0){let t=await oe(r,{input:$,logger:e});m||=!t}if(V){let t=await ge(r,V,{logger:e});m||=!t}return{success:!m,errors:p,warnings:u.length>0?u:void 0}}function N(e,...n){let r=JSON.parse(JSON.stringify(e));return n.forEach(e=>{l(e).forEach(([e,t])=>{r[e]===void 0?r[e]=t:Array.isArray(t)?r[e]=[...r[e],...t]:r[e]=t})}),t(r)}export{A as i,M as n,j as r,N as t};
3
+ //# sourceMappingURL=mergeTranscendInputs-DFQcbh8b.mjs.map