@transcend-io/cli 10.14.0 → 10.16.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 (173) hide show
  1. package/README.md +98 -47
  2. package/dist/app-COX_n1FP.mjs +131 -0
  3. package/dist/app-COX_n1FP.mjs.map +1 -0
  4. package/dist/{approvePrivacyRequests-BmjMLA3C.mjs → approvePrivacyRequests-DJItn7R6.mjs} +2 -2
  5. package/dist/{approvePrivacyRequests-BmjMLA3C.mjs.map → approvePrivacyRequests-DJItn7R6.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-tZJof83F.mjs → buildExamples-CZ8kcEqO.mjs} +2 -2
  10. package/dist/{buildExamples-tZJof83F.mjs.map → buildExamples-CZ8kcEqO.mjs.map} +1 -1
  11. package/dist/{buildXdiSyncEndpoint-DsxFqz9E.mjs → buildXdiSyncEndpoint-CSGwr2H5.mjs} +2 -2
  12. package/dist/{buildXdiSyncEndpoint-DsxFqz9E.mjs.map → buildXdiSyncEndpoint-CSGwr2H5.mjs.map} +1 -1
  13. package/dist/bulkRestartRequests-D-t58SeM.mjs +2 -0
  14. package/dist/bulkRestartRequests-D-t58SeM.mjs.map +1 -0
  15. package/dist/{bulkRetryEnrichers-nBG87Q8B.mjs → bulkRetryEnrichers-BmwRLF2w.mjs} +2 -2
  16. package/dist/{bulkRetryEnrichers-nBG87Q8B.mjs.map → bulkRetryEnrichers-BmwRLF2w.mjs.map} +1 -1
  17. package/dist/{cancelPrivacyRequests-DBjBnX2p.mjs → cancelPrivacyRequests-CFCULeSv.mjs} +2 -2
  18. package/dist/{cancelPrivacyRequests-DBjBnX2p.mjs.map → cancelPrivacyRequests-CFCULeSv.mjs.map} +1 -1
  19. package/dist/{command-BDVLuBwL.mjs → command-8AnltUOG.mjs} +2 -2
  20. package/dist/{command-BDVLuBwL.mjs.map → command-8AnltUOG.mjs.map} +1 -1
  21. package/dist/{constants-Co8rkELu.mjs → constants-B7bW_WN2.mjs} +2 -2
  22. package/dist/{constants-Co8rkELu.mjs.map → constants-B7bW_WN2.mjs.map} +1 -1
  23. package/dist/{createExtraKeyHandler-CC-YNn6m.mjs → createExtraKeyHandler-DqiD609a.mjs} +2 -2
  24. package/dist/{createExtraKeyHandler-CC-YNn6m.mjs.map → createExtraKeyHandler-DqiD609a.mjs.map} +1 -1
  25. package/dist/{downloadPrivacyRequestFiles-C_60XBVX.mjs → downloadPrivacyRequestFiles-B7HNc-Y1.mjs} +2 -2
  26. package/dist/{downloadPrivacyRequestFiles-C_60XBVX.mjs.map → downloadPrivacyRequestFiles-B7HNc-Y1.mjs.map} +1 -1
  27. package/dist/formatPolicyEngineRequestError-C8g0v7nh.mjs +2 -0
  28. package/dist/formatPolicyEngineRequestError-C8g0v7nh.mjs.map +1 -0
  29. package/dist/{generateCrossAccountApiKeys-JvTpNM7h.mjs → generateCrossAccountApiKeys-kqzneWII.mjs} +2 -2
  30. package/dist/{generateCrossAccountApiKeys-JvTpNM7h.mjs.map → generateCrossAccountApiKeys-kqzneWII.mjs.map} +1 -1
  31. package/dist/impl--eayIBq5.mjs +2 -0
  32. package/dist/impl--eayIBq5.mjs.map +1 -0
  33. package/dist/{impl-TnRighiD.mjs → impl-0C9N9md8.mjs} +2 -2
  34. package/dist/{impl-TnRighiD.mjs.map → impl-0C9N9md8.mjs.map} +1 -1
  35. package/dist/{impl-CQ94Ys6i.mjs → impl-6rvA_yyd.mjs} +2 -2
  36. package/dist/{impl-CQ94Ys6i.mjs.map → impl-6rvA_yyd.mjs.map} +1 -1
  37. package/dist/{impl-pGIOCyRI.mjs → impl-B3u38Ct_.mjs} +1 -1
  38. package/dist/{impl-pGIOCyRI.mjs.map → impl-B3u38Ct_.mjs.map} +1 -1
  39. package/dist/{impl-CPZSFIEn2.mjs → impl-B9AtL5ta2.mjs} +2 -2
  40. package/dist/{impl-CPZSFIEn2.mjs.map → impl-B9AtL5ta2.mjs.map} +1 -1
  41. package/dist/{impl-BWt2WOj4.mjs → impl-BDc4D9nA.mjs} +2 -2
  42. package/dist/{impl-BWt2WOj4.mjs.map → impl-BDc4D9nA.mjs.map} +1 -1
  43. package/dist/{impl-bzESF0CN.mjs → impl-BJldWkkC.mjs} +1 -1
  44. package/dist/{impl-bzESF0CN.mjs.map → impl-BJldWkkC.mjs.map} +1 -1
  45. package/dist/{impl-Bf_Wy1-i.mjs → impl-BOXnkx44.mjs} +2 -2
  46. package/dist/{impl-Bf_Wy1-i.mjs.map → impl-BOXnkx44.mjs.map} +1 -1
  47. package/dist/{impl-CHA9Ioez2.mjs → impl-BUF6G3P32.mjs} +2 -2
  48. package/dist/{impl-CHA9Ioez2.mjs.map → impl-BUF6G3P32.mjs.map} +1 -1
  49. package/dist/{impl-DctqoksW2.mjs → impl-BVcXWJyI2.mjs} +2 -2
  50. package/dist/{impl-DctqoksW2.mjs.map → impl-BVcXWJyI2.mjs.map} +1 -1
  51. package/dist/impl-BbfuEhKu.mjs +2 -0
  52. package/dist/impl-BbfuEhKu.mjs.map +1 -0
  53. package/dist/{impl-DtjphdYd2.mjs → impl-BcIZos3y.mjs} +2 -2
  54. package/dist/impl-BcIZos3y.mjs.map +1 -0
  55. package/dist/{impl-8i-k9wal2.mjs → impl-Bkdu-3yo.mjs} +2 -2
  56. package/dist/impl-Bkdu-3yo.mjs.map +1 -0
  57. package/dist/{impl-CnfqPqKR.mjs → impl-Bq-tabdZ2.mjs} +2 -2
  58. package/dist/impl-Bq-tabdZ2.mjs.map +1 -0
  59. package/dist/{impl-BxJcoWPI.mjs → impl-Bul8gUqq.mjs} +2 -2
  60. package/dist/{impl-BxJcoWPI.mjs.map → impl-Bul8gUqq.mjs.map} +1 -1
  61. package/dist/{impl-kyicyfTy.mjs → impl-BuqBEZCk.mjs} +2 -2
  62. package/dist/{impl-kyicyfTy.mjs.map → impl-BuqBEZCk.mjs.map} +1 -1
  63. package/dist/{impl-DOp0z0s3.mjs → impl-BvOLkTWD.mjs} +2 -2
  64. package/dist/{impl-DOp0z0s3.mjs.map → impl-BvOLkTWD.mjs.map} +1 -1
  65. package/dist/{impl-DasdQVVL.mjs → impl-Bvkhu8fB.mjs} +2 -2
  66. package/dist/{impl-DasdQVVL.mjs.map → impl-Bvkhu8fB.mjs.map} +1 -1
  67. package/dist/{impl-CQcfrcc42.mjs → impl-CCSb7Pyd.mjs} +2 -2
  68. package/dist/impl-CCSb7Pyd.mjs.map +1 -0
  69. package/dist/{impl-BcP6NXxv.mjs → impl-CDNTdi62.mjs} +2 -2
  70. package/dist/{impl-BcP6NXxv.mjs.map → impl-CDNTdi62.mjs.map} +1 -1
  71. package/dist/{impl-0WH9Y-7n2.mjs → impl-CLrF-Xhp2.mjs} +2 -2
  72. package/dist/{impl-0WH9Y-7n2.mjs.map → impl-CLrF-Xhp2.mjs.map} +1 -1
  73. package/dist/impl-CX1J2iHE.mjs +2 -0
  74. package/dist/impl-CX1J2iHE.mjs.map +1 -0
  75. package/dist/{impl-vLFKOFp6.mjs → impl-C_K23xoc.mjs} +2 -2
  76. package/dist/{impl-vLFKOFp6.mjs.map → impl-C_K23xoc.mjs.map} +1 -1
  77. package/dist/{impl-DmsEZEkY2.mjs → impl-CeqMxdZm2.mjs} +2 -2
  78. package/dist/{impl-DmsEZEkY2.mjs.map → impl-CeqMxdZm2.mjs.map} +1 -1
  79. package/dist/{impl-BmB5DH95.mjs → impl-ChDwTQ3Z2.mjs} +2 -2
  80. package/dist/impl-ChDwTQ3Z2.mjs.map +1 -0
  81. package/dist/{impl-BQizHx-b.mjs → impl-CkFqqhQ-.mjs} +2 -2
  82. package/dist/{impl-BQizHx-b.mjs.map → impl-CkFqqhQ-.mjs.map} +1 -1
  83. package/dist/{impl-C9RGUYAT.mjs → impl-CkU-WD3b.mjs} +2 -2
  84. package/dist/{impl-C9RGUYAT.mjs.map → impl-CkU-WD3b.mjs.map} +1 -1
  85. package/dist/{impl-COWe0KAi.mjs → impl-Cx5U2XsV.mjs} +2 -2
  86. package/dist/{impl-COWe0KAi.mjs.map → impl-Cx5U2XsV.mjs.map} +1 -1
  87. package/dist/impl-DGm5NVUi.mjs +3 -0
  88. package/dist/impl-DGm5NVUi.mjs.map +1 -0
  89. package/dist/{impl-BcirxaFO.mjs → impl-DMbgck0i.mjs} +2 -2
  90. package/dist/{impl-BcirxaFO.mjs.map → impl-DMbgck0i.mjs.map} +1 -1
  91. package/dist/{impl-BM0EEvkt.mjs → impl-DQH1CGup.mjs} +2 -2
  92. package/dist/{impl-BM0EEvkt.mjs.map → impl-DQH1CGup.mjs.map} +1 -1
  93. package/dist/{impl-5pww5SHw.mjs → impl-DTDnN3Hn.mjs} +2 -2
  94. package/dist/{impl-5pww5SHw.mjs.map → impl-DTDnN3Hn.mjs.map} +1 -1
  95. package/dist/{impl-Cih-nyPz.mjs → impl-DYsJKLfp.mjs} +2 -2
  96. package/dist/{impl-Cih-nyPz.mjs.map → impl-DYsJKLfp.mjs.map} +1 -1
  97. package/dist/impl-DiRx33sh.mjs +2 -0
  98. package/dist/impl-DiRx33sh.mjs.map +1 -0
  99. package/dist/{impl-Cp_cXJgT2.mjs → impl-DiysQB762.mjs} +2 -2
  100. package/dist/{impl-Cp_cXJgT2.mjs.map → impl-DiysQB762.mjs.map} +1 -1
  101. package/dist/{impl-DQdzYE12.mjs → impl-DqcpxYHF.mjs} +1 -1
  102. package/dist/{impl-DQdzYE12.mjs.map → impl-DqcpxYHF.mjs.map} +1 -1
  103. package/dist/{impl-DtVfOZhs.mjs → impl-DqyYxDti.mjs} +2 -2
  104. package/dist/{impl-DtVfOZhs.mjs.map → impl-DqyYxDti.mjs.map} +1 -1
  105. package/dist/{impl-DpU2s1HR.mjs → impl-RqwgNa2O.mjs} +2 -2
  106. package/dist/{impl-DpU2s1HR.mjs.map → impl-RqwgNa2O.mjs.map} +1 -1
  107. package/dist/{impl-cro4x_eG.mjs → impl-TTeKThep2.mjs} +2 -2
  108. package/dist/impl-TTeKThep2.mjs.map +1 -0
  109. package/dist/{impl-CJIfMPOK.mjs → impl-X13pzYJN2.mjs} +2 -2
  110. package/dist/impl-X13pzYJN2.mjs.map +1 -0
  111. package/dist/{impl-B4mrbkzO.mjs → impl-e-_DWiv4.mjs} +2 -2
  112. package/dist/{impl-B4mrbkzO.mjs.map → impl-e-_DWiv4.mjs.map} +1 -1
  113. package/dist/index.d.mts +17 -13
  114. package/dist/index.d.mts.map +1 -1
  115. package/dist/index.mjs +1 -1
  116. package/dist/{markRequestDataSiloIdsCompleted-DYsj2ONd.mjs → markRequestDataSiloIdsCompleted-nAV0VLEA.mjs} +2 -2
  117. package/dist/{markRequestDataSiloIdsCompleted-DYsj2ONd.mjs.map → markRequestDataSiloIdsCompleted-nAV0VLEA.mjs.map} +1 -1
  118. package/dist/{markSilentPrivacyRequests-DQYDLnBX.mjs → markSilentPrivacyRequests-BhF4r8n9.mjs} +2 -2
  119. package/dist/{markSilentPrivacyRequests-DQYDLnBX.mjs.map → markSilentPrivacyRequests-BhF4r8n9.mjs.map} +1 -1
  120. package/dist/{notifyPrivacyRequestsAdditionalTime-BYpsssGt.mjs → notifyPrivacyRequestsAdditionalTime-B6e9SfP7.mjs} +2 -2
  121. package/dist/{notifyPrivacyRequestsAdditionalTime-BYpsssGt.mjs.map → notifyPrivacyRequestsAdditionalTime-B6e9SfP7.mjs.map} +1 -1
  122. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-aBPmYMAU.mjs → pullChunkedCustomSiloOutstandingIdentifiers-DiZTo2K_.mjs} +2 -2
  123. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-aBPmYMAU.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-DiZTo2K_.mjs.map} +1 -1
  124. package/dist/{pullManualEnrichmentIdentifiersToCsv-DGdMOzd_.mjs → pullManualEnrichmentIdentifiersToCsv--dw03arC.mjs} +2 -2
  125. package/dist/{pullManualEnrichmentIdentifiersToCsv-DGdMOzd_.mjs.map → pullManualEnrichmentIdentifiersToCsv--dw03arC.mjs.map} +1 -1
  126. package/dist/{pushCronIdentifiersFromCsv-mMGYEnWE.mjs → pushCronIdentifiersFromCsv-DdcsnXf5.mjs} +2 -2
  127. package/dist/{pushCronIdentifiersFromCsv-mMGYEnWE.mjs.map → pushCronIdentifiersFromCsv-DdcsnXf5.mjs.map} +1 -1
  128. package/dist/{pushManualEnrichmentIdentifiersFromCsv-BJtIFf35.mjs → pushManualEnrichmentIdentifiersFromCsv-BYJCQOI-.mjs} +2 -2
  129. package/dist/{pushManualEnrichmentIdentifiersFromCsv-BJtIFf35.mjs.map → pushManualEnrichmentIdentifiersFromCsv-BYJCQOI-.mjs.map} +1 -1
  130. package/dist/{removeUnverifiedRequestIdentifiers-GM1MhbRO.mjs → removeUnverifiedRequestIdentifiers-CC471vSR.mjs} +2 -2
  131. package/dist/{removeUnverifiedRequestIdentifiers-GM1MhbRO.mjs.map → removeUnverifiedRequestIdentifiers-CC471vSR.mjs.map} +1 -1
  132. package/dist/{renderTable-BgjVr6ch.mjs → renderTable-BzIh5FoT.mjs} +1 -1
  133. package/dist/{renderTable-BgjVr6ch.mjs.map → renderTable-BzIh5FoT.mjs.map} +1 -1
  134. package/dist/{resolveBundleIdByName-DdemhmTX.mjs → resolveBundleIdByName-Bxoxa8CK.mjs} +1 -1
  135. package/dist/{resolveBundleIdByName-DdemhmTX.mjs.map → resolveBundleIdByName-Bxoxa8CK.mjs.map} +1 -1
  136. package/dist/{retryRequestDataSilos-DkCW5Dap.mjs → retryRequestDataSilos-DlkJmEjH.mjs} +2 -2
  137. package/dist/{retryRequestDataSilos-DkCW5Dap.mjs.map → retryRequestDataSilos-DlkJmEjH.mjs.map} +1 -1
  138. package/dist/{skipPreflightJobs-BBfI9gnC.mjs → skipPreflightJobs-xVBZC-iI.mjs} +2 -2
  139. package/dist/{skipPreflightJobs-BBfI9gnC.mjs.map → skipPreflightJobs-xVBZC-iI.mjs.map} +1 -1
  140. package/dist/{skipRequestDataSilos-CjaWLHRh.mjs → skipRequestDataSilos-BriqhLT3.mjs} +2 -2
  141. package/dist/{skipRequestDataSilos-CjaWLHRh.mjs.map → skipRequestDataSilos-BriqhLT3.mjs.map} +1 -1
  142. package/dist/{streamPrivacyRequestsToCsv-DeBjRAo6.mjs → streamPrivacyRequestsToCsv-D8b097c1.mjs} +2 -2
  143. package/dist/{streamPrivacyRequestsToCsv-DeBjRAo6.mjs.map → streamPrivacyRequestsToCsv-D8b097c1.mjs.map} +1 -1
  144. package/dist/{updateConsentManagerVersionToLatest-2SBywtZH.mjs → updateConsentManagerVersionToLatest-w_ftOmxi.mjs} +2 -2
  145. package/dist/{updateConsentManagerVersionToLatest-2SBywtZH.mjs.map → updateConsentManagerVersionToLatest-w_ftOmxi.mjs.map} +1 -1
  146. package/dist/{uploadConsents-K3cGrF3M.mjs → uploadConsents-D8IJDaTN.mjs} +2 -2
  147. package/dist/{uploadConsents-K3cGrF3M.mjs.map → uploadConsents-D8IJDaTN.mjs.map} +1 -1
  148. package/dist/{uploadCookiesFromCsv-Cf4q-K4o.mjs → uploadCookiesFromCsv-8hq-Of_p.mjs} +2 -2
  149. package/dist/{uploadCookiesFromCsv-Cf4q-K4o.mjs.map → uploadCookiesFromCsv-8hq-Of_p.mjs.map} +1 -1
  150. package/dist/{uploadDataFlowsFromCsv-CrC_UGCw.mjs → uploadDataFlowsFromCsv-B854o0O5.mjs} +2 -2
  151. package/dist/{uploadDataFlowsFromCsv-CrC_UGCw.mjs.map → uploadDataFlowsFromCsv-B854o0O5.mjs.map} +1 -1
  152. package/dist/{uploadPrivacyRequestsFromCsv-CtLCdggr.mjs → uploadPrivacyRequestsFromCsv-D-RTgJsx.mjs} +2 -2
  153. package/dist/{uploadPrivacyRequestsFromCsv-CtLCdggr.mjs.map → uploadPrivacyRequestsFromCsv-D-RTgJsx.mjs.map} +1 -1
  154. package/package.json +2 -2
  155. package/dist/app-jtpjVOh5.mjs +0 -131
  156. package/dist/app-jtpjVOh5.mjs.map +0 -1
  157. package/dist/bulkRestartRequests-Cg0_c6sr.mjs +0 -2
  158. package/dist/bulkRestartRequests-Cg0_c6sr.mjs.map +0 -1
  159. package/dist/impl-8i-k9wal2.mjs.map +0 -1
  160. package/dist/impl-BmB5DH95.mjs.map +0 -1
  161. package/dist/impl-CJIfMPOK.mjs.map +0 -1
  162. package/dist/impl-CQcfrcc42.mjs.map +0 -1
  163. package/dist/impl-CnfqPqKR.mjs.map +0 -1
  164. package/dist/impl-DZ2ESN0W.mjs +0 -2
  165. package/dist/impl-DZ2ESN0W.mjs.map +0 -1
  166. package/dist/impl-DtjphdYd2.mjs.map +0 -1
  167. package/dist/impl-DxziWqbj.mjs +0 -2
  168. package/dist/impl-DxziWqbj.mjs.map +0 -1
  169. package/dist/impl-QhkS8iHU.mjs +0 -2
  170. package/dist/impl-QhkS8iHU.mjs.map +0 -1
  171. package/dist/impl-WYYi6kC-.mjs +0 -2
  172. package/dist/impl-WYYi6kC-.mjs.map +0 -1
  173. package/dist/impl-cro4x_eG.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"impl-kyicyfTy.mjs","names":["uploadDataFlowsFromCsvHelper"],"sources":["../src/commands/consent/upload-data-flows-from-csv/impl.ts"],"sourcesContent":["import { ConsentTrackerStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { uploadDataFlowsFromCsv as uploadDataFlowsFromCsvHelper } from '../../../lib/consent-manager/index.js';\n\nexport interface UploadDataFlowsFromCsvCommandFlags {\n auth: string;\n trackerStatus: ConsentTrackerStatus;\n file: string;\n classifyService: boolean;\n transcendUrl: string;\n}\n\nexport async function uploadDataFlowsFromCsv(\n this: LocalContext,\n { auth, trackerStatus, file, classifyService, transcendUrl }: UploadDataFlowsFromCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await uploadDataFlowsFromCsvHelper({\n auth,\n trackerStatus,\n file,\n classifyService,\n transcendUrl,\n });\n}\n"],"mappings":"8GAcA,eAAsB,EAEpB,CAAE,OAAM,gBAAe,OAAM,kBAAiB,gBAC/B,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAA6B,CACjC,OACA,gBACA,OACA,kBACA,eACD,CAAC"}
1
+ {"version":3,"file":"impl-BuqBEZCk.mjs","names":["uploadDataFlowsFromCsvHelper"],"sources":["../src/commands/consent/upload-data-flows-from-csv/impl.ts"],"sourcesContent":["import { ConsentTrackerStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { uploadDataFlowsFromCsv as uploadDataFlowsFromCsvHelper } from '../../../lib/consent-manager/index.js';\n\nexport interface UploadDataFlowsFromCsvCommandFlags {\n auth: string;\n trackerStatus: ConsentTrackerStatus;\n file: string;\n classifyService: boolean;\n transcendUrl: string;\n}\n\nexport async function uploadDataFlowsFromCsv(\n this: LocalContext,\n { auth, trackerStatus, file, classifyService, transcendUrl }: UploadDataFlowsFromCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await uploadDataFlowsFromCsvHelper({\n auth,\n trackerStatus,\n file,\n classifyService,\n transcendUrl,\n });\n}\n"],"mappings":"8GAcA,eAAsB,EAEpB,CAAE,OAAM,gBAAe,OAAM,kBAAiB,gBAC/B,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAA6B,CACjC,OACA,gBACA,OACA,kBACA,eACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./logger-D1tXVwJj.mjs";import{t}from"./updateConsentManagerVersionToLatest-2SBywtZH.mjs";import{t as n}from"./validateTranscendAuth-CToEUu1U.mjs";import{t as r}from"./done-input-validation-D25TzrxG.mjs";import{ConsentBundleType as i}from"@transcend-io/privacy-types";import a from"colors";import{mapSeries as o}from"@transcend-io/utils";async function s({auth:s,bundleTypes:c=[i.Production,i.Test],deploy:l,transcendUrl:u}){r(this.process.exit);let d=await n(s);typeof d==`string`?(await t({deploy:l,transcendUrl:u,auth:d,bundleTypes:c}),e.info(a.green(`Successfully updated Consent Manager!`))):(await o(d,async n=>{e.info(a.magenta(`Updating Consent Manager for organization "${n.organizationName}"...`)),await t({deploy:l,transcendUrl:u,auth:n.apiKey,bundleTypes:c}),e.info(a.green(`Successfully updated Consent Manager for organization "${n.organizationName}"!`))}),e.info(a.green(`Successfully updated Consent Managers!`)))}export{s as updateConsentManager};
2
- //# sourceMappingURL=impl-DOp0z0s3.mjs.map
1
+ import{t as e}from"./logger-D1tXVwJj.mjs";import{t}from"./updateConsentManagerVersionToLatest-w_ftOmxi.mjs";import{t as n}from"./validateTranscendAuth-CToEUu1U.mjs";import{t as r}from"./done-input-validation-D25TzrxG.mjs";import{ConsentBundleType as i}from"@transcend-io/privacy-types";import a from"colors";import{mapSeries as o}from"@transcend-io/utils";async function s({auth:s,bundleTypes:c=[i.Production,i.Test],deploy:l,transcendUrl:u}){r(this.process.exit);let d=await n(s);typeof d==`string`?(await t({deploy:l,transcendUrl:u,auth:d,bundleTypes:c}),e.info(a.green(`Successfully updated Consent Manager!`))):(await o(d,async n=>{e.info(a.magenta(`Updating Consent Manager for organization "${n.organizationName}"...`)),await t({deploy:l,transcendUrl:u,auth:n.apiKey,bundleTypes:c}),e.info(a.green(`Successfully updated Consent Manager for organization "${n.organizationName}"!`))}),e.info(a.green(`Successfully updated Consent Managers!`)))}export{s as updateConsentManager};
2
+ //# sourceMappingURL=impl-BvOLkTWD.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DOp0z0s3.mjs","names":[],"sources":["../src/commands/consent/update-consent-manager/impl.ts"],"sourcesContent":["import { ConsentBundleType } from '@transcend-io/privacy-types';\nimport { mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { updateConsentManagerVersionToLatest } from '../../../lib/consent-manager/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface UpdateConsentManagerCommandFlags {\n auth: string;\n bundleTypes: ConsentBundleType[];\n deploy: boolean;\n transcendUrl: string;\n}\n\nexport async function updateConsentManager(\n this: LocalContext,\n {\n auth,\n bundleTypes = [ConsentBundleType.Production, ConsentBundleType.Test],\n deploy,\n transcendUrl,\n }: UpdateConsentManagerCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Handle single update\n if (typeof apiKeyOrList === 'string') {\n // Update consent manager\n await updateConsentManagerVersionToLatest({\n deploy,\n transcendUrl,\n auth: apiKeyOrList,\n bundleTypes,\n });\n logger.info(colors.green('Successfully updated Consent Manager!'));\n } else {\n await mapSeries(apiKeyOrList, async (apiKey) => {\n logger.info(\n colors.magenta(`Updating Consent Manager for organization \"${apiKey.organizationName}\"...`),\n );\n\n await updateConsentManagerVersionToLatest({\n deploy,\n transcendUrl,\n auth: apiKey.apiKey,\n bundleTypes,\n });\n\n logger.info(\n colors.green(\n `Successfully updated Consent Manager for organization \"${apiKey.organizationName}\"!`,\n ),\n );\n });\n logger.info(colors.green('Successfully updated Consent Managers!'));\n }\n}\n"],"mappings":"oWAiBA,eAAsB,EAEpB,CACE,OACA,cAAc,CAAC,EAAkB,WAAY,EAAkB,KAAK,CACpE,SACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAe,MAAM,EAAsB,EAAK,CAGlD,OAAO,GAAiB,UAE1B,MAAM,EAAoC,CACxC,SACA,eACA,KAAM,EACN,cACD,CAAC,CACF,EAAO,KAAK,EAAO,MAAM,wCAAwC,CAAC,GAElE,MAAM,EAAU,EAAc,KAAO,IAAW,CAC9C,EAAO,KACL,EAAO,QAAQ,8CAA8C,EAAO,iBAAiB,MAAM,CAC5F,CAED,MAAM,EAAoC,CACxC,SACA,eACA,KAAM,EAAO,OACb,cACD,CAAC,CAEF,EAAO,KACL,EAAO,MACL,0DAA0D,EAAO,iBAAiB,IACnF,CACF,EACD,CACF,EAAO,KAAK,EAAO,MAAM,yCAAyC,CAAC"}
1
+ {"version":3,"file":"impl-BvOLkTWD.mjs","names":[],"sources":["../src/commands/consent/update-consent-manager/impl.ts"],"sourcesContent":["import { ConsentBundleType } from '@transcend-io/privacy-types';\nimport { mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { updateConsentManagerVersionToLatest } from '../../../lib/consent-manager/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface UpdateConsentManagerCommandFlags {\n auth: string;\n bundleTypes: ConsentBundleType[];\n deploy: boolean;\n transcendUrl: string;\n}\n\nexport async function updateConsentManager(\n this: LocalContext,\n {\n auth,\n bundleTypes = [ConsentBundleType.Production, ConsentBundleType.Test],\n deploy,\n transcendUrl,\n }: UpdateConsentManagerCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Handle single update\n if (typeof apiKeyOrList === 'string') {\n // Update consent manager\n await updateConsentManagerVersionToLatest({\n deploy,\n transcendUrl,\n auth: apiKeyOrList,\n bundleTypes,\n });\n logger.info(colors.green('Successfully updated Consent Manager!'));\n } else {\n await mapSeries(apiKeyOrList, async (apiKey) => {\n logger.info(\n colors.magenta(`Updating Consent Manager for organization \"${apiKey.organizationName}\"...`),\n );\n\n await updateConsentManagerVersionToLatest({\n deploy,\n transcendUrl,\n auth: apiKey.apiKey,\n bundleTypes,\n });\n\n logger.info(\n colors.green(\n `Successfully updated Consent Manager for organization \"${apiKey.organizationName}\"!`,\n ),\n );\n });\n logger.info(colors.green('Successfully updated Consent Managers!'));\n }\n}\n"],"mappings":"oWAiBA,eAAsB,EAEpB,CACE,OACA,cAAc,CAAC,EAAkB,WAAY,EAAkB,KAAK,CACpE,SACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAe,MAAM,EAAsB,EAAK,CAGlD,OAAO,GAAiB,UAE1B,MAAM,EAAoC,CACxC,SACA,eACA,KAAM,EACN,cACD,CAAC,CACF,EAAO,KAAK,EAAO,MAAM,wCAAwC,CAAC,GAElE,MAAM,EAAU,EAAc,KAAO,IAAW,CAC9C,EAAO,KACL,EAAO,QAAQ,8CAA8C,EAAO,iBAAiB,MAAM,CAC5F,CAED,MAAM,EAAoC,CACxC,SACA,eACA,KAAM,EAAO,OACb,cACD,CAAC,CAEF,EAAO,KACL,EAAO,MACL,0DAA0D,EAAO,iBAAiB,IACnF,CACF,EACD,CACF,EAAO,KAAK,EAAO,MAAM,yCAAyC,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./logger-D1tXVwJj.mjs";import{n as t}from"./buildXdiSyncEndpoint-DsxFqz9E.mjs";import{t as n}from"./validateTranscendAuth-CToEUu1U.mjs";import{t as r}from"./done-input-validation-D25TzrxG.mjs";import{writeFileSync as i}from"node:fs";import a from"colors";async function o({auth:o,xdiLocation:s,file:c,removeIpAddresses:l,domainBlockList:u,xdiAllowedCommands:d,transcendUrl:f}){r(this.process.exit);let{syncGroups:p,html:m}=await t(await n(o),{xdiLocation:s,transcendUrl:f,removeIpAddresses:l,domainBlockList:u.length>0?u:void 0,xdiAllowedCommands:d});e.info(a.green(`Successfully constructed sync endpoint for sync groups: ${JSON.stringify(p,null,2)}`)),i(c,m),e.info(a.green(`Wrote configuration to file "${c}"!`))}export{o as buildXdiSyncEndpoint};
2
- //# sourceMappingURL=impl-DasdQVVL.mjs.map
1
+ import{t as e}from"./logger-D1tXVwJj.mjs";import{n as t}from"./buildXdiSyncEndpoint-CSGwr2H5.mjs";import{t as n}from"./validateTranscendAuth-CToEUu1U.mjs";import{t as r}from"./done-input-validation-D25TzrxG.mjs";import{writeFileSync as i}from"node:fs";import a from"colors";async function o({auth:o,xdiLocation:s,file:c,removeIpAddresses:l,domainBlockList:u,xdiAllowedCommands:d,transcendUrl:f}){r(this.process.exit);let{syncGroups:p,html:m}=await t(await n(o),{xdiLocation:s,transcendUrl:f,removeIpAddresses:l,domainBlockList:u.length>0?u:void 0,xdiAllowedCommands:d});e.info(a.green(`Successfully constructed sync endpoint for sync groups: ${JSON.stringify(p,null,2)}`)),i(c,m),e.info(a.green(`Wrote configuration to file "${c}"!`))}export{o as buildXdiSyncEndpoint};
2
+ //# sourceMappingURL=impl-Bvkhu8fB.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DasdQVVL.mjs","names":["buildXdiSyncEndpointHelper"],"sources":["../src/commands/consent/build-xdi-sync-endpoint/impl.ts"],"sourcesContent":["import { writeFileSync } from 'node:fs';\n\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { buildXdiSyncEndpoint as buildXdiSyncEndpointHelper } from '../../../lib/consent-manager/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface BuildXdiSyncEndpointCommandFlags {\n auth: string;\n xdiLocation: string;\n file: string;\n removeIpAddresses: boolean;\n domainBlockList: string[];\n xdiAllowedCommands: string;\n transcendUrl: string;\n}\n\nexport async function buildXdiSyncEndpoint(\n this: LocalContext,\n {\n auth,\n xdiLocation,\n file,\n removeIpAddresses,\n domainBlockList,\n xdiAllowedCommands,\n transcendUrl,\n }: BuildXdiSyncEndpointCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Build the sync endpoint\n const { syncGroups, html } = await buildXdiSyncEndpointHelper(apiKeyOrList, {\n xdiLocation,\n transcendUrl,\n removeIpAddresses,\n domainBlockList: domainBlockList.length > 0 ? domainBlockList : undefined,\n xdiAllowedCommands,\n });\n\n // Log success\n logger.info(\n colors.green(\n `Successfully constructed sync endpoint for sync groups: ${JSON.stringify(\n syncGroups,\n null,\n 2,\n )}`,\n ),\n );\n\n // Write to disk\n writeFileSync(file, html);\n logger.info(colors.green(`Wrote configuration to file \"${file}\"!`));\n}\n"],"mappings":"kRAoBA,eAAsB,EAEpB,CACE,OACA,cACA,OACA,oBACA,kBACA,qBACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAMtC,GAAM,CAAE,aAAY,QAAS,MAAMA,EAA2B,MAHnC,EAAsB,EAAK,CAGsB,CAC1E,cACA,eACA,oBACA,gBAAiB,EAAgB,OAAS,EAAI,EAAkB,IAAA,GAChE,qBACD,CAAC,CAGF,EAAO,KACL,EAAO,MACL,2DAA2D,KAAK,UAC9D,EACA,KACA,EACD,GACF,CACF,CAGD,EAAc,EAAM,EAAK,CACzB,EAAO,KAAK,EAAO,MAAM,gCAAgC,EAAK,IAAI,CAAC"}
1
+ {"version":3,"file":"impl-Bvkhu8fB.mjs","names":["buildXdiSyncEndpointHelper"],"sources":["../src/commands/consent/build-xdi-sync-endpoint/impl.ts"],"sourcesContent":["import { writeFileSync } from 'node:fs';\n\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { buildXdiSyncEndpoint as buildXdiSyncEndpointHelper } from '../../../lib/consent-manager/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface BuildXdiSyncEndpointCommandFlags {\n auth: string;\n xdiLocation: string;\n file: string;\n removeIpAddresses: boolean;\n domainBlockList: string[];\n xdiAllowedCommands: string;\n transcendUrl: string;\n}\n\nexport async function buildXdiSyncEndpoint(\n this: LocalContext,\n {\n auth,\n xdiLocation,\n file,\n removeIpAddresses,\n domainBlockList,\n xdiAllowedCommands,\n transcendUrl,\n }: BuildXdiSyncEndpointCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Build the sync endpoint\n const { syncGroups, html } = await buildXdiSyncEndpointHelper(apiKeyOrList, {\n xdiLocation,\n transcendUrl,\n removeIpAddresses,\n domainBlockList: domainBlockList.length > 0 ? domainBlockList : undefined,\n xdiAllowedCommands,\n });\n\n // Log success\n logger.info(\n colors.green(\n `Successfully constructed sync endpoint for sync groups: ${JSON.stringify(\n syncGroups,\n null,\n 2,\n )}`,\n ),\n );\n\n // Write to disk\n writeFileSync(file, html);\n logger.info(colors.green(`Wrote configuration to file \"${file}\"!`));\n}\n"],"mappings":"kRAoBA,eAAsB,EAEpB,CACE,OACA,cACA,OACA,oBACA,kBACA,qBACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAMtC,GAAM,CAAE,aAAY,QAAS,MAAMA,EAA2B,MAHnC,EAAsB,EAAK,CAGsB,CAC1E,cACA,eACA,oBACA,gBAAiB,EAAgB,OAAS,EAAI,EAAkB,IAAA,GAChE,qBACD,CAAC,CAGF,EAAO,KACL,EAAO,MACL,2DAA2D,KAAK,UAC9D,EACA,KACA,EACD,GACF,CACF,CAGD,EAAc,EAAM,EAAK,CACzB,EAAO,KAAK,EAAO,MAAM,gCAAgC,EAAK,IAAI,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./removeUnverifiedRequestIdentifiers-GM1MhbRO.mjs";import{t}from"./done-input-validation-D25TzrxG.mjs";async function n({auth:n,transcendUrl:r,identifierNames:i,actions:a=[]}){t(this.process.exit),await e({requestActions:a,transcendUrl:r,auth:n,identifierNames:i})}export{n as rejectUnverifiedIdentifiers};
2
- //# sourceMappingURL=impl-CQcfrcc42.mjs.map
1
+ import{t as e}from"./removeUnverifiedRequestIdentifiers-CC471vSR.mjs";import{t}from"./done-input-validation-D25TzrxG.mjs";async function n({auth:n,transcendUrl:r,identifierNames:i,actions:a=[]}){t(this.process.exit),await e({requestActions:a,transcendUrl:r,auth:n,identifierNames:i})}export{n as rejectUnverifiedIdentifiers};
2
+ //# sourceMappingURL=impl-CCSb7Pyd.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl-CCSb7Pyd.mjs","names":[],"sources":["../src/commands/request/reject-unverified-identifiers/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { removeUnverifiedRequestIdentifiers } from '../../../lib/requests/index.js';\n\nexport interface RejectUnverifiedIdentifiersCommandFlags {\n auth: string;\n identifierNames: string[];\n actions?: RequestAction[];\n transcendUrl: string;\n}\n\nexport async function rejectUnverifiedIdentifiers(\n this: LocalContext,\n { auth, transcendUrl, identifierNames, actions = [] }: RejectUnverifiedIdentifiersCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await removeUnverifiedRequestIdentifiers({\n requestActions: actions,\n transcendUrl,\n auth,\n identifierNames,\n });\n}\n"],"mappings":"0HAaA,eAAsB,EAEpB,CAAE,OAAM,eAAc,kBAAiB,UAAU,EAAE,EACpC,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAAmC,CACvC,eAAgB,EAChB,eACA,OACA,kBACD,CAAC"}
@@ -1,3 +1,3 @@
1
- import{r as e}from"./constants-Co8rkELu.mjs";import{t}from"./logger-D1tXVwJj.mjs";import{a as n}from"./writeCsv-Dg4Wuj5V.mjs";import{t as r}from"./pullConsentManagerMetrics-C0gYmy2K.mjs";import{t as i}from"./validateTranscendAuth-CToEUu1U.mjs";import{t as a}from"./done-input-validation-D25TzrxG.mjs";import{ConsentManagerMetricBin as o}from"@transcend-io/privacy-types";import s,{existsSync as c,mkdirSync as l}from"node:fs";import{join as u}from"node:path";import d from"colors";import{buildTranscendGraphQLClient as f}from"@transcend-io/sdk";import{map as p,mapSeries as m}from"@transcend-io/utils";async function h({auth:h,start:g,end:_,folder:v,bin:y,transcendUrl:b}){let x=y;Object.values(o).includes(x)||(t.error(d.red(`Failed to parse argument "bin" with value "${y}"\nExpected one of: \n${Object.values(o).join(`
1
+ import{r as e}from"./constants-B7bW_WN2.mjs";import{t}from"./logger-D1tXVwJj.mjs";import{a as n}from"./writeCsv-Dg4Wuj5V.mjs";import{t as r}from"./pullConsentManagerMetrics-C0gYmy2K.mjs";import{t as i}from"./validateTranscendAuth-CToEUu1U.mjs";import{t as a}from"./done-input-validation-D25TzrxG.mjs";import{ConsentManagerMetricBin as o}from"@transcend-io/privacy-types";import s,{existsSync as c,mkdirSync as l}from"node:fs";import{join as u}from"node:path";import d from"colors";import{buildTranscendGraphQLClient as f}from"@transcend-io/sdk";import{map as p,mapSeries as m}from"@transcend-io/utils";async function h({auth:h,start:g,end:_,folder:v,bin:y,transcendUrl:b}){let x=y;Object.values(o).includes(x)||(t.error(d.red(`Failed to parse argument "bin" with value "${y}"\nExpected one of: \n${Object.values(o).join(`
2
2
  `)}`)),this.process.exit(1));let S=new Date(g),C=_?new Date(_):new Date;Number.isNaN(S.getTime())&&(t.error(d.red(`Start date provided is invalid date. Got --start="${g}" expected --start="01/01/2023"`)),this.process.exit(1)),Number.isNaN(C.getTime())&&(t.error(d.red(`End date provided is invalid date. Got --end="${_}" expected --end="01/01/2023"`)),this.process.exit(1)),S>C&&(t.error(d.red(`Got a start date "${S.toISOString()}" that was larger than the end date "${C.toISOString()}". Start date must be before end date.`)),this.process.exit(1)),a(this.process.exit);let w=await i(h);if(s.existsSync(v)&&!s.lstatSync(v).isDirectory()&&(t.error(d.red(`The provided argument "folder" was passed a file. expected: folder="./consent-metrics/"`)),this.process.exit(1)),c(v)||l(v),t.info(d.magenta(`Pulling consent metrics from start=${S.toString()} to end=${C.toISOString()} with bin size "${y}"`)),typeof w==`string`){try{let e=await r(f(b,w),{bin:x,start:S,end:C});await p(Object.entries(e),async([e,r])=>{await p(r,async({points:r,name:i})=>{let a=u(v,`${e}_${i}.csv`);t.info(d.magenta(`Writing configuration to file "${a}"...`)),await n(a,r.map(({key:e,value:t})=>({timestamp:e,value:t})))},{concurrency:5})},{concurrency:5})}catch(e){t.error(d.red(`An error occurred syncing the schema: ${e.message}`)),this.process.exit(1)}t.info(d.green(`Successfully synced consent metrics to disk in folder "${v}"! View at ${e}`))}else{let i=[];await m(w,async(e,a)=>{let o=`[${a+1}/${w.length}][${e.organizationName}] `;t.info(d.magenta(`~~~\n\n${o}Attempting to pull consent metrics...\n\n~~~`));let s=f(b,e.apiKey);try{let i=await r(s,{bin:x,start:S,end:C}),a=u(v,e.organizationName);c(a)||l(a),Object.entries(i).forEach(([e,r])=>{r.forEach(({points:r,name:i})=>{let o=u(a,`${e}_${i}.csv`);t.info(d.magenta(`Writing configuration to file "${o}"...`)),n(o,r.map(({key:e,value:t})=>({timestamp:e,value:t})))})}),t.info(d.green(`${o}Successfully pulled configuration!`))}catch(n){t.error(d.red(`${o}Failed to sync configuration.`),n),i.push(e.organizationName)}}),i.length>0&&(t.info(d.red(`Sync encountered errors for "${i.join(`,`)}". View output above for more information, or check out ${e}`)),this.process.exit(1))}}export{h as pullConsentMetrics};
3
- //# sourceMappingURL=impl-BcP6NXxv.mjs.map
3
+ //# sourceMappingURL=impl-CDNTdi62.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-BcP6NXxv.mjs","names":[],"sources":["../src/commands/consent/pull-consent-metrics/impl.ts"],"sourcesContent":["import fs, { existsSync, mkdirSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { ConsentManagerMetricBin } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport { map, mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { pullConsentManagerMetrics } from '../../../lib/consent-manager/index.js';\nimport { writeCsv } from '../../../lib/helpers/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface PullConsentMetricsCommandFlags {\n auth: string;\n start: Date;\n end?: Date;\n folder: string;\n bin: string;\n transcendUrl: string;\n}\n\nexport async function pullConsentMetrics(\n this: LocalContext,\n { auth, start, end, folder, bin, transcendUrl }: PullConsentMetricsCommandFlags,\n): Promise<void> {\n // Validate bin\n const parsedBin = bin as ConsentManagerMetricBin;\n if (!Object.values(ConsentManagerMetricBin).includes(parsedBin)) {\n logger.error(\n colors.red(\n `Failed to parse argument \"bin\" with value \"${bin}\"\\n` +\n `Expected one of: \\n${Object.values(ConsentManagerMetricBin).join('\\n')}`,\n ),\n );\n this.process.exit(1);\n }\n\n // Parse the dates\n const startDate = new Date(start);\n const endDate = end ? new Date(end) : new Date();\n if (Number.isNaN(startDate.getTime())) {\n logger.error(\n colors.red(\n `Start date provided is invalid date. Got --start=\"${start}\" expected --start=\"01/01/2023\"`,\n ),\n );\n this.process.exit(1);\n }\n if (Number.isNaN(endDate.getTime())) {\n logger.error(\n colors.red(\n `End date provided is invalid date. Got --end=\"${end}\" expected --end=\"01/01/2023\"`,\n ),\n );\n this.process.exit(1);\n }\n if (startDate > endDate) {\n logger.error(\n colors.red(\n `Got a start date \"${startDate.toISOString()}\" that was larger than the end date \"${endDate.toISOString()}\". ` +\n 'Start date must be before end date.',\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Ensure folder either does not exist or is not a file\n if (fs.existsSync(folder) && !fs.lstatSync(folder).isDirectory()) {\n logger.error(\n colors.red(\n 'The provided argument \"folder\" was passed a file. expected: folder=\"./consent-metrics/\"',\n ),\n );\n this.process.exit(1);\n }\n\n // Create the folder if it does not exist\n if (!existsSync(folder)) {\n mkdirSync(folder);\n }\n\n logger.info(\n colors.magenta(\n `Pulling consent metrics from start=${startDate.toString()} to end=${endDate.toISOString()} with bin size \"${bin}\"`,\n ),\n );\n\n // Sync to Disk\n if (typeof apiKeyOrList === 'string') {\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKeyOrList);\n\n // Pull the metrics\n const configuration = await pullConsentManagerMetrics(client, {\n bin: parsedBin,\n start: startDate,\n end: endDate,\n });\n\n // Write to file\n await map(\n Object.entries(configuration),\n async ([metricName, metrics]) => {\n await map(\n metrics,\n async ({ points, name }) => {\n const file = join(folder, `${metricName}_${name}.csv`);\n logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n await writeCsv(\n file,\n points.map(({ key, value }: { key: string; value: string }) => ({\n timestamp: key,\n value,\n })),\n );\n },\n {\n concurrency: 5,\n },\n );\n },\n { concurrency: 5 },\n );\n } catch (err) {\n logger.error(colors.red(`An error occurred syncing the schema: ${err.message}`));\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced consent metrics to disk in folder \"${folder}\"! View at ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n } else {\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${apiKey.organizationName}] `;\n logger.info(colors.magenta(`~~~\\n\\n${prefix}Attempting to pull consent metrics...\\n\\n~~~`));\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKey.apiKey);\n\n try {\n const configuration = await pullConsentManagerMetrics(client, {\n bin: parsedBin,\n start: startDate,\n end: endDate,\n });\n\n // ensure folder exists for that organization\n const subFolder = join(folder, apiKey.organizationName);\n if (!existsSync(subFolder)) {\n mkdirSync(subFolder);\n }\n\n // Write to file\n Object.entries(configuration).forEach(([metricName, metrics]) => {\n metrics.forEach(({ points, name }) => {\n const file = join(subFolder, `${metricName}_${name}.csv`);\n logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n writeCsv(\n file,\n points.map(({ key, value }: { key: string; value: string }) => ({\n timestamp: key,\n value,\n })),\n );\n });\n });\n\n logger.info(colors.green(`${prefix}Successfully pulled configuration!`));\n } catch (err) {\n logger.error(colors.red(`${prefix}Failed to sync configuration.`), err);\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n logger.info(\n colors.red(\n `Sync encountered errors for \"${encounteredErrors.join(\n ',',\n )}\". View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n }\n}\n"],"mappings":"0lBAyBA,eAAsB,EAEpB,CAAE,OAAM,QAAO,MAAK,SAAQ,MAAK,gBAClB,CAEf,IAAM,EAAY,EACb,OAAO,OAAO,EAAwB,CAAC,SAAS,EAAU,GAC7D,EAAO,MACL,EAAO,IACL,8CAA8C,EAAI,wBAC1B,OAAO,OAAO,EAAwB,CAAC,KAAK;EAAK,GAC1E,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAItB,IAAM,EAAY,IAAI,KAAK,EAAM,CAC3B,EAAU,EAAM,IAAI,KAAK,EAAI,CAAG,IAAI,KACtC,OAAO,MAAM,EAAU,SAAS,CAAC,GACnC,EAAO,MACL,EAAO,IACL,qDAAqD,EAAM,iCAC5D,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAElB,OAAO,MAAM,EAAQ,SAAS,CAAC,GACjC,EAAO,MACL,EAAO,IACL,iDAAiD,EAAI,+BACtD,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAElB,EAAY,IACd,EAAO,MACL,EAAO,IACL,qBAAqB,EAAU,aAAa,CAAC,uCAAuC,EAAQ,aAAa,CAAC,wCAE3G,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAe,MAAM,EAAsB,EAAK,CAwBtD,GArBI,EAAG,WAAW,EAAO,EAAI,CAAC,EAAG,UAAU,EAAO,CAAC,aAAa,GAC9D,EAAO,MACL,EAAO,IACL,0FACD,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAIjB,EAAW,EAAO,EACrB,EAAU,EAAO,CAGnB,EAAO,KACL,EAAO,QACL,sCAAsC,EAAU,UAAU,CAAC,UAAU,EAAQ,aAAa,CAAC,kBAAkB,EAAI,GAClH,CACF,CAGG,OAAO,GAAiB,SAAU,CACpC,GAAI,CAKF,IAAM,EAAgB,MAAM,EAHb,EAA4B,EAAc,EAGG,CAAE,CAC5D,IAAK,EACL,MAAO,EACP,IAAK,EACN,CAAC,CAGF,MAAM,EACJ,OAAO,QAAQ,EAAc,CAC7B,MAAO,CAAC,EAAY,KAAa,CAC/B,MAAM,EACJ,EACA,MAAO,CAAE,SAAQ,UAAW,CAC1B,IAAM,EAAO,EAAK,EAAQ,GAAG,EAAW,GAAG,EAAK,MAAM,CACtD,EAAO,KAAK,EAAO,QAAQ,kCAAkC,EAAK,MAAM,CAAC,CACzE,MAAM,EACJ,EACA,EAAO,KAAK,CAAE,MAAK,YAA6C,CAC9D,UAAW,EACX,QACD,EAAE,CACJ,EAEH,CACE,YAAa,EACd,CACF,EAEH,CAAE,YAAa,EAAG,CACnB,OACM,EAAK,CACZ,EAAO,MAAM,EAAO,IAAI,yCAAyC,EAAI,UAAU,CAAC,CAChF,KAAK,QAAQ,KAAK,EAAE,CAItB,EAAO,KACL,EAAO,MACL,0DAA0D,EAAO,aAAa,IAC/E,CACF,KACI,CACL,IAAM,EAA8B,EAAE,CACtC,MAAM,EAAU,EAAc,MAAO,EAAQ,IAAQ,CACnD,IAAM,EAAS,IAAI,EAAM,EAAE,GAAG,EAAa,OAAO,IAAI,EAAO,iBAAiB,IAC9E,EAAO,KAAK,EAAO,QAAQ,UAAU,EAAO,8CAA8C,CAAC,CAG3F,IAAM,EAAS,EAA4B,EAAc,EAAO,OAAO,CAEvE,GAAI,CACF,IAAM,EAAgB,MAAM,EAA0B,EAAQ,CAC5D,IAAK,EACL,MAAO,EACP,IAAK,EACN,CAAC,CAGI,EAAY,EAAK,EAAQ,EAAO,iBAAiB,CAClD,EAAW,EAAU,EACxB,EAAU,EAAU,CAItB,OAAO,QAAQ,EAAc,CAAC,SAAS,CAAC,EAAY,KAAa,CAC/D,EAAQ,SAAS,CAAE,SAAQ,UAAW,CACpC,IAAM,EAAO,EAAK,EAAW,GAAG,EAAW,GAAG,EAAK,MAAM,CACzD,EAAO,KAAK,EAAO,QAAQ,kCAAkC,EAAK,MAAM,CAAC,CACzE,EACE,EACA,EAAO,KAAK,CAAE,MAAK,YAA6C,CAC9D,UAAW,EACX,QACD,EAAE,CACJ,EACD,EACF,CAEF,EAAO,KAAK,EAAO,MAAM,GAAG,EAAO,oCAAoC,CAAC,OACjE,EAAK,CACZ,EAAO,MAAM,EAAO,IAAI,GAAG,EAAO,+BAA+B,CAAE,EAAI,CACvE,EAAkB,KAAK,EAAO,iBAAiB,GAEjD,CAEE,EAAkB,OAAS,IAC7B,EAAO,KACL,EAAO,IACL,gCAAgC,EAAkB,KAChD,IACD,CAAC,0DAA0D,IAC7D,CACF,CAED,KAAK,QAAQ,KAAK,EAAE"}
1
+ {"version":3,"file":"impl-CDNTdi62.mjs","names":[],"sources":["../src/commands/consent/pull-consent-metrics/impl.ts"],"sourcesContent":["import fs, { existsSync, mkdirSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { ConsentManagerMetricBin } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport { map, mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { pullConsentManagerMetrics } from '../../../lib/consent-manager/index.js';\nimport { writeCsv } from '../../../lib/helpers/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface PullConsentMetricsCommandFlags {\n auth: string;\n start: Date;\n end?: Date;\n folder: string;\n bin: string;\n transcendUrl: string;\n}\n\nexport async function pullConsentMetrics(\n this: LocalContext,\n { auth, start, end, folder, bin, transcendUrl }: PullConsentMetricsCommandFlags,\n): Promise<void> {\n // Validate bin\n const parsedBin = bin as ConsentManagerMetricBin;\n if (!Object.values(ConsentManagerMetricBin).includes(parsedBin)) {\n logger.error(\n colors.red(\n `Failed to parse argument \"bin\" with value \"${bin}\"\\n` +\n `Expected one of: \\n${Object.values(ConsentManagerMetricBin).join('\\n')}`,\n ),\n );\n this.process.exit(1);\n }\n\n // Parse the dates\n const startDate = new Date(start);\n const endDate = end ? new Date(end) : new Date();\n if (Number.isNaN(startDate.getTime())) {\n logger.error(\n colors.red(\n `Start date provided is invalid date. Got --start=\"${start}\" expected --start=\"01/01/2023\"`,\n ),\n );\n this.process.exit(1);\n }\n if (Number.isNaN(endDate.getTime())) {\n logger.error(\n colors.red(\n `End date provided is invalid date. Got --end=\"${end}\" expected --end=\"01/01/2023\"`,\n ),\n );\n this.process.exit(1);\n }\n if (startDate > endDate) {\n logger.error(\n colors.red(\n `Got a start date \"${startDate.toISOString()}\" that was larger than the end date \"${endDate.toISOString()}\". ` +\n 'Start date must be before end date.',\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Ensure folder either does not exist or is not a file\n if (fs.existsSync(folder) && !fs.lstatSync(folder).isDirectory()) {\n logger.error(\n colors.red(\n 'The provided argument \"folder\" was passed a file. expected: folder=\"./consent-metrics/\"',\n ),\n );\n this.process.exit(1);\n }\n\n // Create the folder if it does not exist\n if (!existsSync(folder)) {\n mkdirSync(folder);\n }\n\n logger.info(\n colors.magenta(\n `Pulling consent metrics from start=${startDate.toString()} to end=${endDate.toISOString()} with bin size \"${bin}\"`,\n ),\n );\n\n // Sync to Disk\n if (typeof apiKeyOrList === 'string') {\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKeyOrList);\n\n // Pull the metrics\n const configuration = await pullConsentManagerMetrics(client, {\n bin: parsedBin,\n start: startDate,\n end: endDate,\n });\n\n // Write to file\n await map(\n Object.entries(configuration),\n async ([metricName, metrics]) => {\n await map(\n metrics,\n async ({ points, name }) => {\n const file = join(folder, `${metricName}_${name}.csv`);\n logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n await writeCsv(\n file,\n points.map(({ key, value }: { key: string; value: string }) => ({\n timestamp: key,\n value,\n })),\n );\n },\n {\n concurrency: 5,\n },\n );\n },\n { concurrency: 5 },\n );\n } catch (err) {\n logger.error(colors.red(`An error occurred syncing the schema: ${err.message}`));\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced consent metrics to disk in folder \"${folder}\"! View at ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n } else {\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${apiKey.organizationName}] `;\n logger.info(colors.magenta(`~~~\\n\\n${prefix}Attempting to pull consent metrics...\\n\\n~~~`));\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKey.apiKey);\n\n try {\n const configuration = await pullConsentManagerMetrics(client, {\n bin: parsedBin,\n start: startDate,\n end: endDate,\n });\n\n // ensure folder exists for that organization\n const subFolder = join(folder, apiKey.organizationName);\n if (!existsSync(subFolder)) {\n mkdirSync(subFolder);\n }\n\n // Write to file\n Object.entries(configuration).forEach(([metricName, metrics]) => {\n metrics.forEach(({ points, name }) => {\n const file = join(subFolder, `${metricName}_${name}.csv`);\n logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n writeCsv(\n file,\n points.map(({ key, value }: { key: string; value: string }) => ({\n timestamp: key,\n value,\n })),\n );\n });\n });\n\n logger.info(colors.green(`${prefix}Successfully pulled configuration!`));\n } catch (err) {\n logger.error(colors.red(`${prefix}Failed to sync configuration.`), err);\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n logger.info(\n colors.red(\n `Sync encountered errors for \"${encounteredErrors.join(\n ',',\n )}\". View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n }\n}\n"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./logger-D1tXVwJj.mjs";import{t}from"./streamPrivacyRequestsToCsv-DeBjRAo6.mjs";import{t as n}from"./done-input-validation-D25TzrxG.mjs";import r from"colors";async function i({auth:i,transcendUrl:a,file:o,pageLimit:s,concurrency:c,actions:l,sombraAuth:u,skipRequestIdentifiers:d,statuses:f,createdAtBefore:p,createdAtAfter:m,updatedAtBefore:h,updatedAtAfter:g,showTests:_}){n(this.process.exit);let{filePaths:v,totalCount:y}=await t({transcendUrl:a,concurrency:c,pageLimit:s,actions:l,statuses:f,auth:i,sombraAuth:u,skipRequestIdentifiers:d,createdAtBefore:p,createdAtAfter:m,updatedAtBefore:h,updatedAtAfter:g,isTest:_,file:o});e.info(r.green(`Successfully wrote ${y} requests to ${v.length} file(s): ${v.join(`, `)}`))}export{i as _export};
2
- //# sourceMappingURL=impl-0WH9Y-7n2.mjs.map
1
+ import{t as e}from"./logger-D1tXVwJj.mjs";import{t}from"./streamPrivacyRequestsToCsv-D8b097c1.mjs";import{t as n}from"./done-input-validation-D25TzrxG.mjs";import r from"colors";async function i({auth:i,transcendUrl:a,file:o,pageLimit:s,concurrency:c,actions:l,sombraAuth:u,skipRequestIdentifiers:d,statuses:f,createdAtBefore:p,createdAtAfter:m,updatedAtBefore:h,updatedAtAfter:g,showTests:_}){n(this.process.exit);let{filePaths:v,totalCount:y}=await t({transcendUrl:a,concurrency:c,pageLimit:s,actions:l,statuses:f,auth:i,sombraAuth:u,skipRequestIdentifiers:d,createdAtBefore:p,createdAtAfter:m,updatedAtBefore:h,updatedAtAfter:g,isTest:_,file:o});e.info(r.green(`Successfully wrote ${y} requests to ${v.length} file(s): ${v.join(`, `)}`))}export{i as _export};
2
+ //# sourceMappingURL=impl-CLrF-Xhp2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-0WH9Y-7n2.mjs","names":[],"sources":["../src/commands/request/export/impl.ts"],"sourcesContent":["import type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { streamPrivacyRequestsToCsv } from '../../../lib/requests/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface ExportCommandFlags {\n auth: string;\n sombraAuth?: string;\n actions?: RequestAction[];\n statuses?: RequestStatus[];\n transcendUrl: string;\n file: string;\n concurrency: number;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n showTests?: boolean;\n skipRequestIdentifiers?: boolean;\n pageLimit: number;\n}\n\n// `export` is a reserved keyword, so we need to prefix it with an underscore\n// eslint-disable-next-line no-underscore-dangle\nexport async function _export(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n file,\n pageLimit,\n concurrency,\n actions,\n sombraAuth,\n skipRequestIdentifiers,\n statuses,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n showTests,\n }: ExportCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const { filePaths, totalCount } = await streamPrivacyRequestsToCsv({\n transcendUrl,\n concurrency,\n pageLimit,\n actions,\n statuses,\n auth,\n sombraAuth,\n skipRequestIdentifiers,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isTest: showTests,\n file,\n });\n\n logger.info(\n colors.green(\n `Successfully wrote ${totalCount} requests to ` +\n `${filePaths.length} file(s): ${filePaths.join(', ')}`,\n ),\n );\n}\n"],"mappings":"kLA2BA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,YACA,cACA,UACA,aACA,yBACA,WACA,kBACA,iBACA,kBACA,iBACA,aAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAM,CAAE,YAAW,cAAe,MAAM,EAA2B,CACjE,eACA,cACA,YACA,UACA,WACA,OACA,aACA,yBACA,kBACA,iBACA,kBACA,iBACA,OAAQ,EACR,OACD,CAAC,CAEF,EAAO,KACL,EAAO,MACL,sBAAsB,EAAW,eAC5B,EAAU,OAAO,YAAY,EAAU,KAAK,KAAK,GACvD,CACF"}
1
+ {"version":3,"file":"impl-CLrF-Xhp2.mjs","names":[],"sources":["../src/commands/request/export/impl.ts"],"sourcesContent":["import type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { streamPrivacyRequestsToCsv } from '../../../lib/requests/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface ExportCommandFlags {\n auth: string;\n sombraAuth?: string;\n actions?: RequestAction[];\n statuses?: RequestStatus[];\n transcendUrl: string;\n file: string;\n concurrency: number;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n showTests?: boolean;\n skipRequestIdentifiers?: boolean;\n pageLimit: number;\n}\n\n// `export` is a reserved keyword, so we need to prefix it with an underscore\n// eslint-disable-next-line no-underscore-dangle\nexport async function _export(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n file,\n pageLimit,\n concurrency,\n actions,\n sombraAuth,\n skipRequestIdentifiers,\n statuses,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n showTests,\n }: ExportCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const { filePaths, totalCount } = await streamPrivacyRequestsToCsv({\n transcendUrl,\n concurrency,\n pageLimit,\n actions,\n statuses,\n auth,\n sombraAuth,\n skipRequestIdentifiers,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isTest: showTests,\n file,\n });\n\n logger.info(\n colors.green(\n `Successfully wrote ${totalCount} requests to ` +\n `${filePaths.length} file(s): ${filePaths.join(', ')}`,\n ),\n );\n}\n"],"mappings":"kLA2BA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,YACA,cACA,UACA,aACA,yBACA,WACA,kBACA,iBACA,kBACA,iBACA,aAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAM,CAAE,YAAW,cAAe,MAAM,EAA2B,CACjE,eACA,cACA,YACA,UACA,WACA,OACA,aACA,yBACA,kBACA,iBACA,kBACA,iBACA,OAAQ,EACR,OACD,CAAC,CAEF,EAAO,KACL,EAAO,MACL,sBAAsB,EAAW,eAC5B,EAAU,OAAO,YAAY,EAAU,KAAK,KAAK,GACvD,CACF"}
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./buildExamples-CZ8kcEqO.mjs";import{t}from"./logger-D1tXVwJj.mjs";import{t as n}from"./done-input-validation-D25TzrxG.mjs";import{n as r,t as i}from"./constants-Opbj9jaF.mjs";import{r as a,t as o}from"./runOpa-NnuspgN0.mjs";import{n as s,t as c}from"./printResult-BE0CcmNZ.mjs";import{t as l}from"./formatPolicyBundleVersionSummary-BJgl5Q3D.mjs";import{t as u}from"./formatPolicyEngineRequestError-C8g0v7nh.mjs";import{t as d}from"./resolveBundleIdByName-Bxoxa8CK.mjs";import f from"node:fs";import p from"node:os";import m from"node:path";import h from"colors";import g from"fast-glob";import{spawnSync as _}from"node:child_process";import{gunzipSync as v}from"node:zlib";function y(e){return e.endsWith(`.rego`)&&!e.endsWith(`_test.rego`)}function b(e){let t=m.join(e,`manifest.json`);if(!f.existsSync(t))throw Error(`Policy bundle directory must contain a manifest.json file.`);let n=g.sync(`**/*.rego`,{cwd:e,onlyFiles:!0,dot:!1}).filter(y);if(n.length===0)throw Error(`Policy bundle directory must contain at least one .rego policy file.`);return[`manifest.json`,...n.sort()]}async function x(e){let t=m.join(p.tmpdir(),`transcend-policy-bundle-build-${Date.now()}-${Math.random().toString(36).slice(2)}.tar.gz`);try{let{code:n,stderr:r}=await o([`build`,`--v0-compatible`,`--ignore`,`*_test.rego`,`-o`,t,`.`],{cwd:e});if(n!==0)throw Error(r.trim()||`opa build failed with exit code ${n}`)}finally{f.existsSync(t)&&f.unlinkSync(t)}}async function S(e){a();let t=m.resolve(e);if(!f.existsSync(t)||!f.statSync(t).isDirectory())throw Error(`Policy directory does not exist or is not a directory: ${t}`);let{code:n,stderr:s}=await o([`check`,`--strict`,`--v0-compatible`,t]);if(n!==0)throw Error(s.trim()||`opa check failed with exit code ${n}`);await x(t);let c=b(t),l=m.join(p.tmpdir(),`transcend-policy-bundle-${Date.now()}-${Math.random().toString(36).slice(2)}.tar.gz`),u=_(`tar`,[`-czf`,l,`-C`,t,...c],{env:{...process.env,COPYFILE_DISABLE:`1`},encoding:`utf8`});if(u.status!==0)throw Error(`Failed to create policy bundle archive: ${u.stderr.trim()||`tar failed`}`);let d=f.readFileSync(l);if(d.byteLength>5120)throw f.unlinkSync(l),Error(`Policy bundle exceeds the ${i} byte compressed upload limit (${d.byteLength} bytes). The server also rejects decompressed bundles larger than ${r} bytes.`);let h=v(d);if(h.byteLength>51200)throw f.unlinkSync(l),Error(`Policy bundle exceeds the ${r} byte decompressed upload limit (${h.byteLength} bytes).`);return l}function C(e){let t=f.readFileSync(e.bundlePath),n=new FormData;return n.append(`bundle`,new Blob([t],{type:`application/gzip`}),m.basename(e.bundlePath)),n.append(`version`,e.version),e.description&&n.append(`description`,e.description),e.bundleName&&n.append(`bundleName`,e.bundleName),n}function w(e){return e.toISOString().slice(0,19).replace(/[T:]/g,`-`)}function T(e,t=new Date){return`${e}-${w(t)}`}async function E({dir:r,"bundle-name":i,auth:a,"transcend-url":o,version:p,description:g,json:_}){n(this.process.exit);let v=m.resolve(r),y=p??T(i),b=s(o,a),x;try{t.info(h.green(`Building policy bundle from ${v}...`)),x=await S(v);let n=await d(b,i),r;if(n){t.info(h.green(`Uploading new version for bundle "${i}"...`));let e=C({bundlePath:x,version:y,description:g});try{r=await b.post(`v1/policy-engine/policy-bundles/${n}/versions`,{body:e}).json()}catch(e){throw Error(u(e),{cause:e})}}else{t.info(h.green(`Creating bundle "${i}" and uploading first version...`));let e=C({bundlePath:x,version:y,description:g,bundleName:i});try{r=await b.post(`v1/policy-engine/policy-bundles`,{body:e}).json()}catch(e){throw Error(u(e),{cause:e})}}c(this.process.stdout,{json:_,data:r,renderTable:()=>l(r.version)}),t.info(h.green(`Policy bundle version uploaded successfully.`));let a=e([`policy`,`activate`],{version:r.version.version,"bundle-name":i});t.info(h.yellow(`Publishing a policy does not activate it. To activate this version, run:\n ${a}`))}finally{x&&f.existsSync(x)&&f.unlinkSync(x)}}export{E as publish};
2
+ //# sourceMappingURL=impl-CX1J2iHE.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl-CX1J2iHE.mjs","names":["fg"],"sources":["../src/commands/policy/helpers/buildOpaBundleTarball.ts","../src/commands/policy/helpers/buildPolicyBundleFormData.ts","../src/commands/policy/helpers/defaultPolicyVersionLabel.ts","../src/commands/policy/publish/impl.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { gunzipSync } from 'node:zlib';\n\nimport fg from 'fast-glob';\n\nimport { MAX_BUNDLE_COMPRESSED_BYTES, MAX_BUNDLE_DECOMPRESSED_BYTES } from '../constants.js';\nimport { assertOpaInstalled } from './assertOpaInstalled.js';\nimport { runOPACapture } from './runOpa.js';\n\n/**\n * Returns whether a relative path is a publishable Rego policy file.\n *\n * OPA test files (`*_test.rego`) are excluded because they are for local\n * validation only and are not part of the upload contract.\n *\n * @param relativePath - Path relative to the bundle directory\n * @returns Whether the file should be included in the upload archive\n */\nfunction isPublishableRegoFile(relativePath: string): boolean {\n return relativePath.endsWith('.rego') && !relativePath.endsWith('_test.rego');\n}\n\n/**\n * Collects `manifest.json` and publishable `.rego` files from a policy directory.\n *\n * @param dir - Absolute path to the policy bundle directory\n * @returns Relative paths to include in the upload tarball\n */\nfunction collectPolicyBundleArchiveEntries(dir: string): string[] {\n const manifestPath = path.join(dir, 'manifest.json');\n if (!fs.existsSync(manifestPath)) {\n throw new Error('Policy bundle directory must contain a manifest.json file.');\n }\n\n const regoFiles = fg\n .sync('**/*.rego', {\n cwd: dir,\n onlyFiles: true,\n dot: false,\n })\n .filter(isPublishableRegoFile);\n\n if (regoFiles.length === 0) {\n throw new Error('Policy bundle directory must contain at least one .rego policy file.');\n }\n\n return ['manifest.json', ...regoFiles.sort()];\n}\n\n/**\n * Verifies that a policy directory compiles end-to-end with `opa build`.\n *\n * The compiled output is discarded — the server receives the `manifest.json` +\n * `.rego` archive produced by {@link buildOpaBundleTarball}, not the OPA bundle\n * — but a successful build guarantees the policies compile and link, surfacing\n * errors (syntax, missing imports, undefined references, etc.) before upload.\n *\n * @param dir - Absolute path to the policy bundle directory\n */\nasync function assertBundleCompiles(dir: string): Promise<void> {\n const buildOutputPath = path.join(\n os.tmpdir(),\n `transcend-policy-bundle-build-${Date.now()}-${Math.random().toString(36).slice(2)}.tar.gz`,\n );\n try {\n // Run with `cwd` set to the bundle directory and pass `.` so `opa build`\n // resolves the bundle root correctly. `*_test.rego` files are local-only.\n const { code, stderr } = await runOPACapture(\n ['build', '--v0-compatible', '--ignore', '*_test.rego', '-o', buildOutputPath, '.'],\n { cwd: dir },\n );\n if (code !== 0) {\n throw new Error(stderr.trim() || `opa build failed with exit code ${code}`);\n }\n } finally {\n if (fs.existsSync(buildOutputPath)) {\n fs.unlinkSync(buildOutputPath);\n }\n }\n}\n\n/**\n * Builds a gzip-compressed policy bundle tarball for upload to Transcend.\n *\n * The Policy Engine API expects a plain archive containing `manifest.json` and\n * one or more `.rego` files. This differs from `opa build` output, which embeds\n * `.manifest`, `data.json`, and other OPA bundle metadata that the server\n * rejects. Before packaging, the bundle is validated with `opa check` (strict\n * Rego linting) and `opa build` (full compilation) so compile failures surface\n * client-side rather than after upload.\n *\n * @param dir - Directory containing `manifest.json` and `.rego` policy files\n * @returns Absolute path to the generated `.tar.gz` bundle\n */\nexport async function buildOpaBundleTarball(dir: string): Promise<string> {\n assertOpaInstalled();\n\n const resolvedDir = path.resolve(dir);\n if (!fs.existsSync(resolvedDir) || !fs.statSync(resolvedDir).isDirectory()) {\n throw new Error(`Policy directory does not exist or is not a directory: ${resolvedDir}`);\n }\n\n // Match the Rego v1 validation the Policy Engine API runs on upload.\n const { code: checkCode, stderr: checkStderr } = await runOPACapture([\n 'check',\n '--strict',\n '--v0-compatible',\n resolvedDir,\n ]);\n if (checkCode !== 0) {\n throw new Error(checkStderr.trim() || `opa check failed with exit code ${checkCode}`);\n }\n\n // Ensure the bundle compiles end-to-end before packaging for upload.\n await assertBundleCompiles(resolvedDir);\n\n const archiveEntries = collectPolicyBundleArchiveEntries(resolvedDir);\n const outputPath = path.join(\n os.tmpdir(),\n `transcend-policy-bundle-${Date.now()}-${Math.random().toString(36).slice(2)}.tar.gz`,\n );\n\n const tarResult = spawnSync('tar', ['-czf', outputPath, '-C', resolvedDir, ...archiveEntries], {\n env: { ...process.env, COPYFILE_DISABLE: '1' },\n encoding: 'utf8',\n });\n if (tarResult.status !== 0) {\n throw new Error(\n `Failed to create policy bundle archive: ${tarResult.stderr.trim() || 'tar failed'}`,\n );\n }\n\n const compressedBytes = fs.readFileSync(outputPath);\n if (compressedBytes.byteLength > MAX_BUNDLE_COMPRESSED_BYTES) {\n fs.unlinkSync(outputPath);\n throw new Error(\n `Policy bundle exceeds the ${MAX_BUNDLE_COMPRESSED_BYTES} byte compressed upload limit (${compressedBytes.byteLength} bytes). ` +\n `The server also rejects decompressed bundles larger than ${MAX_BUNDLE_DECOMPRESSED_BYTES} bytes.`,\n );\n }\n\n const decompressedBytes = gunzipSync(compressedBytes);\n if (decompressedBytes.byteLength > MAX_BUNDLE_DECOMPRESSED_BYTES) {\n fs.unlinkSync(outputPath);\n throw new Error(\n `Policy bundle exceeds the ${MAX_BUNDLE_DECOMPRESSED_BYTES} byte decompressed upload limit (${decompressedBytes.byteLength} bytes).`,\n );\n }\n\n return outputPath;\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\n/** Fields for building a policy bundle upload form. */\nexport interface BuildPolicyBundleFormDataOptions {\n /** Absolute path to the bundle tarball */\n bundlePath: string;\n /** Version label */\n version: string;\n /** Optional description */\n description?: string;\n /** Bundle name (only for create) */\n bundleName?: string;\n}\n\n/**\n * Builds multipart form data for a policy bundle upload.\n *\n * @param options - Upload fields\n * @returns FormData ready for POST\n */\nexport function buildPolicyBundleFormData(options: BuildPolicyBundleFormDataOptions): FormData {\n const bundleBytes = fs.readFileSync(options.bundlePath);\n const form = new FormData();\n form.append(\n 'bundle',\n new Blob([bundleBytes], { type: 'application/gzip' }),\n path.basename(options.bundlePath),\n );\n form.append('version', options.version);\n if (options.description) {\n form.append('description', options.description);\n }\n if (options.bundleName) {\n form.append('bundleName', options.bundleName);\n }\n return form;\n}\n","/**\n * Formats a date as `yyyy-mm-dd-hh-mm-ss` in UTC.\n *\n * @param date - Date to format\n * @returns Timestamp label\n */\nfunction formatPolicyVersionTimestamp(date: Date): string {\n return date.toISOString().slice(0, 19).replace(/[T:]/g, '-');\n}\n\n/**\n * Returns a default version label from the bundle name and current UTC timestamp.\n *\n * @param bundleName - Tenant-unique policy bundle name\n * @param now - Current time (for testing)\n * @returns Version label in `{bundleName}-yyyy-mm-dd-hh-mm-ss` form\n */\nexport function defaultPolicyVersionLabel(bundleName: string, now: Date = new Date()): string {\n return `${bundleName}-${formatPolicyVersionTimestamp(now)}`;\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { buildExampleCommand } from '../../../lib/docgen/buildExamples.js';\nimport { logger } from '../../../logger.js';\nimport type { ActivateCommandFlags } from '../activate/impl.js';\nimport {\n buildPolicyBundleFormData,\n buildPolicyEngineClient,\n buildOpaBundleTarball,\n defaultPolicyVersionLabel,\n formatPolicyBundleVersionSummary,\n formatPolicyEngineRequestError,\n printResult,\n resolveBundleIdByName,\n} from '../helpers/index.js';\nimport type { CreatePolicyBundleResponse, CreatePolicyBundleVersionResponse } from '../types.js';\n\n/** CLI flags for `transcend policy publish`. */\nexport interface PublishCommandFlags {\n /** Directory containing Rego policy files */\n dir: string;\n /** Tenant-unique bundle name */\n 'bundle-name': string;\n /** Transcend API key */\n auth: string;\n /** Transcend API URL */\n 'transcend-url': string;\n /** Version label (defaults to `{bundleName}-yyyy-mm-dd-hh-mm-ss`) */\n version?: string;\n /** Optional version description */\n description?: string;\n /** Print raw JSON response */\n json: boolean;\n}\n\n/**\n * Build and upload a new immutable policy bundle version.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function publish(\n this: LocalContext,\n {\n dir,\n 'bundle-name': bundleName,\n auth,\n 'transcend-url': transcendUrl,\n version,\n description,\n json,\n }: PublishCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const resolvedDir = path.resolve(dir);\n const versionLabel = version ?? defaultPolicyVersionLabel(bundleName);\n const client = buildPolicyEngineClient(transcendUrl, auth);\n\n let bundlePath: string | undefined;\n try {\n logger.info(colors.green(`Building policy bundle from ${resolvedDir}...`));\n bundlePath = await buildOpaBundleTarball(resolvedDir);\n\n const existingBundleId = await resolveBundleIdByName(client, bundleName);\n\n let responseBody: CreatePolicyBundleResponse | CreatePolicyBundleVersionResponse;\n\n if (existingBundleId) {\n logger.info(colors.green(`Uploading new version for bundle \"${bundleName}\"...`));\n const form = buildPolicyBundleFormData({\n bundlePath,\n version: versionLabel,\n description,\n });\n try {\n responseBody = await client\n .post(`v1/policy-engine/policy-bundles/${existingBundleId}/versions`, { body: form })\n .json<CreatePolicyBundleVersionResponse>();\n } catch (err) {\n throw new Error(formatPolicyEngineRequestError(err), { cause: err });\n }\n } else {\n logger.info(colors.green(`Creating bundle \"${bundleName}\" and uploading first version...`));\n const createForm = buildPolicyBundleFormData({\n bundlePath,\n version: versionLabel,\n description,\n bundleName,\n });\n try {\n responseBody = await client\n .post('v1/policy-engine/policy-bundles', {\n body: createForm,\n })\n .json<CreatePolicyBundleResponse>();\n } catch (err) {\n throw new Error(formatPolicyEngineRequestError(err), { cause: err });\n }\n }\n\n printResult(this.process.stdout, {\n json,\n data: responseBody,\n renderTable: () => formatPolicyBundleVersionSummary(responseBody.version),\n });\n\n logger.info(colors.green('Policy bundle version uploaded successfully.'));\n\n const activateCommand = buildExampleCommand<ActivateCommandFlags>(['policy', 'activate'], {\n version: responseBody.version.version,\n 'bundle-name': bundleName,\n });\n logger.info(\n colors.yellow(\n `Publishing a policy does not activate it. To activate this version, run:\\n ${activateCommand}`,\n ),\n );\n } finally {\n if (bundlePath && fs.existsSync(bundlePath)) {\n fs.unlinkSync(bundlePath);\n }\n }\n}\n"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./retryRequestDataSilos-DkCW5Dap.mjs";import{t}from"./done-input-validation-D25TzrxG.mjs";async function n({auth:n,dataSiloId:r,actions:i,transcendUrl:a}){t(this.process.exit),await e({requestActions:i,transcendUrl:a,auth:n,dataSiloId:r})}export{n as retryRequestDataSilos};
2
- //# sourceMappingURL=impl-vLFKOFp6.mjs.map
1
+ import{t as e}from"./retryRequestDataSilos-DlkJmEjH.mjs";import{t}from"./done-input-validation-D25TzrxG.mjs";async function n({auth:n,dataSiloId:r,actions:i,transcendUrl:a}){t(this.process.exit),await e({requestActions:i,transcendUrl:a,auth:n,dataSiloId:r})}export{n as retryRequestDataSilos};
2
+ //# sourceMappingURL=impl-C_K23xoc.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-vLFKOFp6.mjs","names":["retryRequestDataSilosHelper"],"sources":["../src/commands/request/system/retry-request-data-silos/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { retryRequestDataSilos as retryRequestDataSilosHelper } from '../../../../lib/requests/index.js';\n\nexport interface RetryRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n actions: RequestAction[];\n transcendUrl: string;\n}\n\nexport async function retryRequestDataSilos(\n this: LocalContext,\n { auth, dataSiloId, actions, transcendUrl }: RetryRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await retryRequestDataSilosHelper({\n requestActions: actions,\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"],"mappings":"6GAaA,eAAsB,EAEpB,CAAE,OAAM,aAAY,UAAS,gBACd,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAA4B,CAChC,eAAgB,EAChB,eACA,OACA,aACD,CAAC"}
1
+ {"version":3,"file":"impl-C_K23xoc.mjs","names":["retryRequestDataSilosHelper"],"sources":["../src/commands/request/system/retry-request-data-silos/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { retryRequestDataSilos as retryRequestDataSilosHelper } from '../../../../lib/requests/index.js';\n\nexport interface RetryRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n actions: RequestAction[];\n transcendUrl: string;\n}\n\nexport async function retryRequestDataSilos(\n this: LocalContext,\n { auth, dataSiloId, actions, transcendUrl }: RetryRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await retryRequestDataSilosHelper({\n requestActions: actions,\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"],"mappings":"6GAaA,eAAsB,EAEpB,CAAE,OAAM,aAAY,UAAS,gBACd,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAA4B,CAChC,eAAgB,EAChB,eACA,OACA,aACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./bulkRetryEnrichers-nBG87Q8B.mjs";import{t}from"./done-input-validation-D25TzrxG.mjs";async function n({auth:n,enricherId:r,actions:i,requestEnricherStatuses:a,requestIds:o,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u,concurrency:d,transcendUrl:f}){t(this.process.exit),await e({auth:n,enricherId:r,requestActions:i,requestEnricherStatuses:a,requestIds:o,createdAtBefore:s?new Date(s):void 0,createdAtAfter:c?new Date(c):void 0,updatedAtBefore:l?new Date(l):void 0,updatedAtAfter:u?new Date(u):void 0,concurrency:d,transcendUrl:f})}export{n as enricherRestart};
2
- //# sourceMappingURL=impl-DmsEZEkY2.mjs.map
1
+ import{t as e}from"./bulkRetryEnrichers-BmwRLF2w.mjs";import{t}from"./done-input-validation-D25TzrxG.mjs";async function n({auth:n,enricherId:r,actions:i,requestEnricherStatuses:a,requestIds:o,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u,concurrency:d,transcendUrl:f}){t(this.process.exit),await e({auth:n,enricherId:r,requestActions:i,requestEnricherStatuses:a,requestIds:o,createdAtBefore:s?new Date(s):void 0,createdAtAfter:c?new Date(c):void 0,updatedAtBefore:l?new Date(l):void 0,updatedAtAfter:u?new Date(u):void 0,concurrency:d,transcendUrl:f})}export{n as enricherRestart};
2
+ //# sourceMappingURL=impl-CeqMxdZm2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DmsEZEkY2.mjs","names":[],"sources":["../src/commands/request/enricher-restart/impl.ts"],"sourcesContent":["import type { RequestAction, RequestEnricherStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { bulkRetryEnrichers } from '../../../lib/requests/index.js';\n\nexport interface EnricherRestartCommandFlags {\n auth: string;\n enricherId: string;\n actions?: RequestAction[];\n requestEnricherStatuses?: RequestEnricherStatus[];\n transcendUrl: string;\n concurrency: number;\n requestIds?: string[];\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n}\n\nexport async function enricherRestart(\n this: LocalContext,\n {\n auth,\n enricherId,\n actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n transcendUrl,\n }: EnricherRestartCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await bulkRetryEnrichers({\n auth,\n enricherId,\n requestActions: actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore: createdAtBefore ? new Date(createdAtBefore) : undefined,\n createdAtAfter: createdAtAfter ? new Date(createdAtAfter) : undefined,\n updatedAtBefore: updatedAtBefore ? new Date(updatedAtBefore) : undefined,\n updatedAtAfter: updatedAtAfter ? new Date(updatedAtAfter) : undefined,\n concurrency,\n transcendUrl,\n });\n}\n"],"mappings":"0GAoBA,eAAsB,EAEpB,CACE,OACA,aACA,UACA,0BACA,aACA,kBACA,iBACA,kBACA,iBACA,cACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAAmB,CACvB,OACA,aACA,eAAgB,EAChB,0BACA,aACA,gBAAiB,EAAkB,IAAI,KAAK,EAAgB,CAAG,IAAA,GAC/D,eAAgB,EAAiB,IAAI,KAAK,EAAe,CAAG,IAAA,GAC5D,gBAAiB,EAAkB,IAAI,KAAK,EAAgB,CAAG,IAAA,GAC/D,eAAgB,EAAiB,IAAI,KAAK,EAAe,CAAG,IAAA,GAC5D,cACA,eACD,CAAC"}
1
+ {"version":3,"file":"impl-CeqMxdZm2.mjs","names":[],"sources":["../src/commands/request/enricher-restart/impl.ts"],"sourcesContent":["import type { RequestAction, RequestEnricherStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { bulkRetryEnrichers } from '../../../lib/requests/index.js';\n\nexport interface EnricherRestartCommandFlags {\n auth: string;\n enricherId: string;\n actions?: RequestAction[];\n requestEnricherStatuses?: RequestEnricherStatus[];\n transcendUrl: string;\n concurrency: number;\n requestIds?: string[];\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n}\n\nexport async function enricherRestart(\n this: LocalContext,\n {\n auth,\n enricherId,\n actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n transcendUrl,\n }: EnricherRestartCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await bulkRetryEnrichers({\n auth,\n enricherId,\n requestActions: actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore: createdAtBefore ? new Date(createdAtBefore) : undefined,\n createdAtAfter: createdAtAfter ? new Date(createdAtAfter) : undefined,\n updatedAtBefore: updatedAtBefore ? new Date(updatedAtBefore) : undefined,\n updatedAtAfter: updatedAtAfter ? new Date(updatedAtAfter) : undefined,\n concurrency,\n transcendUrl,\n });\n}\n"],"mappings":"0GAoBA,eAAsB,EAEpB,CACE,OACA,aACA,UACA,0BACA,aACA,kBACA,iBACA,kBACA,iBACA,cACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAAmB,CACvB,OACA,aACA,eAAgB,EAChB,0BACA,aACA,gBAAiB,EAAkB,IAAI,KAAK,EAAgB,CAAG,IAAA,GAC/D,eAAgB,EAAiB,IAAI,KAAK,EAAe,CAAG,IAAA,GAC5D,gBAAiB,EAAkB,IAAI,KAAK,EAAgB,CAAG,IAAA,GAC/D,eAAgB,EAAiB,IAAI,KAAK,EAAe,CAAG,IAAA,GAC5D,cACA,eACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./pushCronIdentifiersFromCsv-mMGYEnWE.mjs";import{t}from"./done-input-validation-D25TzrxG.mjs";async function n({file:n,transcendUrl:r,auth:i,sombraAuth:a,dataSiloId:o}){t(this.process.exit),await e({file:n,transcendUrl:r,auth:i,sombraAuth:a,dataSiloId:o})}export{n as markIdentifiersCompleted};
2
- //# sourceMappingURL=impl-BmB5DH95.mjs.map
1
+ import{t as e}from"./pushCronIdentifiersFromCsv-DdcsnXf5.mjs";import{t}from"./done-input-validation-D25TzrxG.mjs";async function n({file:n,transcendUrl:r,auth:i,sombraAuth:a,dataSiloId:o}){t(this.process.exit),await e({file:n,transcendUrl:r,auth:i,sombraAuth:a,dataSiloId:o})}export{n as markIdentifiersCompleted};
2
+ //# sourceMappingURL=impl-ChDwTQ3Z2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl-ChDwTQ3Z2.mjs","names":[],"sources":["../src/commands/request/cron/mark-identifiers-completed/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { pushCronIdentifiersFromCsv } from '../../../../lib/cron/index.js';\n\nexport interface MarkIdentifiersCompletedCommandFlags {\n file: string;\n transcendUrl: string;\n auth: string;\n sombraAuth?: string;\n dataSiloId: string;\n}\n\nexport async function markIdentifiersCompleted(\n this: LocalContext,\n { file, transcendUrl, auth, sombraAuth, dataSiloId }: MarkIdentifiersCompletedCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await pushCronIdentifiersFromCsv({\n file,\n transcendUrl,\n auth,\n sombraAuth,\n dataSiloId,\n });\n}\n"],"mappings":"kHAYA,eAAsB,EAEpB,CAAE,OAAM,eAAc,OAAM,aAAY,cACzB,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAA2B,CAC/B,OACA,eACA,OACA,aACA,aACD,CAAC"}
@@ -1,4 +1,4 @@
1
- import{t as e}from"./constants-Co8rkELu.mjs";import{t}from"./logger-D1tXVwJj.mjs";import{t as n}from"./done-input-validation-D25TzrxG.mjs";import{n as r}from"./constants-2MiVdjAH.mjs";import i from"colors";import{buildTranscendGraphQLClient as a,fetchActiveSiloDiscoPlugin as o,uploadSiloDiscoveryResults as s}from"@transcend-io/sdk";import c from"fast-glob";import{stringify as l}from"query-string";async function u({scanPath:e,fileGlobs:n,ignoreDirs:r,config:i}){let{ignoreDirs:a,supportedFiles:o,scanFunction:s}=i,l=n===``?o:o.concat(n.split(`,`)),d=[...r.split(`,`),...a].filter(e=>e.length>0);try{let n=await c(`${e}/**/${l.join(`|`)}`,{ignore:d.map(t=>`${e}/**/${t}`),unique:!0,onlyFiles:!0});t.info(`Scanning: ${n.length} files`);let r=n.map(e=>s(e)).flat().map(e=>e.softwareDevelopmentKits||[]).flat(),i=[...new Set(r.map(e=>e.name))];return t.info(`Found: ${i.length} unique dependencies`),i.map(t=>({name:t,resourceId:`${e}/**/${t}`,useStrictClassifier:!0}))}catch(e){throw Error(`Error scanning globs ${u} with error: ${e}`)}}async function d({scanPath:c,dataSiloId:d,auth:f,fileGlobs:p,ignoreDirs:m,transcendUrl:h}){n(this.process.exit);let g=a(h,f),_=await o(g,{logger:t,filterBy:{dataSiloId:d}}),v=r[_.dataSilo.type];v||(t.error(i.red(`This plugin "${_.dataSilo.type}" is not supported for offline silo discovery.`)),this.process.exit(1));let y=await u({scanPath:c,fileGlobs:p,ignoreDirs:m,config:v});await s(g,{pluginId:_.id,results:y,logger:t});let b=new URL(e);b.pathname=`/data-map/data-inventory/silo-discovery/triage`,b.search=l({filters:JSON.stringify({pluginIds:[_.id]})}),t.info(i.green(`Scan found ${y.length} potential data silos at ${c}! View at '${b.href}'
1
+ import{t as e}from"./constants-B7bW_WN2.mjs";import{t}from"./logger-D1tXVwJj.mjs";import{t as n}from"./done-input-validation-D25TzrxG.mjs";import{n as r}from"./constants-2MiVdjAH.mjs";import i from"colors";import{buildTranscendGraphQLClient as a,fetchActiveSiloDiscoPlugin as o,uploadSiloDiscoveryResults as s}from"@transcend-io/sdk";import c from"fast-glob";import{stringify as l}from"query-string";async function u({scanPath:e,fileGlobs:n,ignoreDirs:r,config:i}){let{ignoreDirs:a,supportedFiles:o,scanFunction:s}=i,l=n===``?o:o.concat(n.split(`,`)),d=[...r.split(`,`),...a].filter(e=>e.length>0);try{let n=await c(`${e}/**/${l.join(`|`)}`,{ignore:d.map(t=>`${e}/**/${t}`),unique:!0,onlyFiles:!0});t.info(`Scanning: ${n.length} files`);let r=n.map(e=>s(e)).flat().map(e=>e.softwareDevelopmentKits||[]).flat(),i=[...new Set(r.map(e=>e.name))];return t.info(`Found: ${i.length} unique dependencies`),i.map(t=>({name:t,resourceId:`${e}/**/${t}`,useStrictClassifier:!0}))}catch(e){throw Error(`Error scanning globs ${u} with error: ${e}`)}}async function d({scanPath:c,dataSiloId:d,auth:f,fileGlobs:p,ignoreDirs:m,transcendUrl:h}){n(this.process.exit);let g=a(h,f),_=await o(g,{logger:t,filterBy:{dataSiloId:d}}),v=r[_.dataSilo.type];v||(t.error(i.red(`This plugin "${_.dataSilo.type}" is not supported for offline silo discovery.`)),this.process.exit(1));let y=await u({scanPath:c,fileGlobs:p,ignoreDirs:m,config:v});await s(g,{pluginId:_.id,results:y,logger:t});let b=new URL(e);b.pathname=`/data-map/data-inventory/silo-discovery/triage`,b.search=l({filters:JSON.stringify({pluginIds:[_.id]})}),t.info(i.green(`Scan found ${y.length} potential data silos at ${c}! View at '${b.href}'
2
2
 
3
3
  NOTE: it may take 2-3 minutes for scan results to appear in the UI.`))}export{d as discoverSilos};
4
- //# sourceMappingURL=impl-BQizHx-b.mjs.map
4
+ //# sourceMappingURL=impl-CkFqqhQ-.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-BQizHx-b.mjs","names":[],"sources":["../src/lib/code-scanning/findFilesToScan.ts","../src/commands/inventory/discover-silos/impl.ts"],"sourcesContent":["import fastGlob from 'fast-glob';\n\nimport { logger } from '../../logger.js';\nimport { CodeScanningConfig } from './types.js';\n\nexport interface SiloDiscoveryRawResults {\n /** The name of the potential data silo entry */\n name: string;\n /** A unique UUID (represents the same resource across different silo discovery runs) */\n resourceId: string;\n /** Any hosts associated with the entry */\n host?: string;\n /** Type of data silo */\n type?: string | undefined;\n}\n\n/**\n * Helper to scan for data silos in all package.json files that it can find in a directory\n *\n * @deprecated TODO: https://transcend.height.app/T-32325 - use code scanning instead\n * @param options - Options\n * @returns the list of integrations\n */\nexport async function findFilesToScan({\n scanPath,\n fileGlobs,\n ignoreDirs,\n config,\n}: {\n /** Where to look for package.json files */\n scanPath: string;\n /** Globs to look for */\n fileGlobs: string;\n /** The directories to ignore (excludes node_modules and serverless-build) */\n ignoreDirs: string;\n /** Silo Discovery configuration */\n config: CodeScanningConfig;\n}): Promise<SiloDiscoveryRawResults[]> {\n const { ignoreDirs: IGNORE_DIRS, supportedFiles, scanFunction } = config;\n const globsToSupport =\n fileGlobs === '' ? supportedFiles : supportedFiles.concat(fileGlobs.split(','));\n const dirsToIgnore = [...ignoreDirs.split(','), ...IGNORE_DIRS].filter((dir) => dir.length > 0);\n try {\n const filesToScan: string[] = await fastGlob(`${scanPath}/**/${globsToSupport.join('|')}`, {\n ignore: dirsToIgnore.map((dir: string) => `${scanPath}/**/${dir}`),\n unique: true,\n onlyFiles: true,\n });\n logger.info(`Scanning: ${filesToScan.length} files`);\n const allPackages = filesToScan.map((filePath: string) => scanFunction(filePath)).flat();\n const allSdks = allPackages\n .map((appPackage) => appPackage.softwareDevelopmentKits || [])\n .flat();\n const uniqueDeps = new Set(allSdks.map((sdk) => sdk.name));\n const deps = [...uniqueDeps];\n logger.info(`Found: ${deps.length} unique dependencies`);\n return deps.map((dep) => ({\n name: dep,\n resourceId: `${scanPath}/**/${dep}`,\n useStrictClassifier: true,\n }));\n } catch (error) {\n throw new Error(`Error scanning globs ${findFilesToScan} with error: ${error}`);\n }\n}\n","import {\n buildTranscendGraphQLClient,\n fetchActiveSiloDiscoPlugin,\n uploadSiloDiscoveryResults,\n} from '@transcend-io/sdk';\nimport colors from 'colors';\nimport { stringify } from 'query-string';\n\nimport { ADMIN_DASH } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { findFilesToScan } from '../../../lib/code-scanning/findFilesToScan.js';\nimport { SILO_DISCOVERY_CONFIGS } from '../../../lib/code-scanning/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface DiscoverSilosCommandFlags {\n scanPath: string;\n dataSiloId: string;\n auth: string;\n fileGlobs: string;\n ignoreDirs: string;\n transcendUrl: string;\n}\n\nexport async function discoverSilos(\n this: LocalContext,\n { scanPath, dataSiloId, auth, fileGlobs, ignoreDirs, transcendUrl }: DiscoverSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const plugin = await fetchActiveSiloDiscoPlugin(client, {\n logger,\n filterBy: { dataSiloId },\n });\n\n const config = SILO_DISCOVERY_CONFIGS[plugin.dataSilo.type];\n if (!config) {\n logger.error(\n colors.red(\n `This plugin \"${plugin.dataSilo.type}\" is not supported for offline silo discovery.`,\n ),\n );\n this.process.exit(1);\n }\n\n const results = await findFilesToScan({\n scanPath,\n fileGlobs,\n ignoreDirs,\n config,\n });\n\n await uploadSiloDiscoveryResults(client, {\n pluginId: plugin.id,\n results,\n logger,\n });\n\n const newUrl = new URL(ADMIN_DASH);\n newUrl.pathname = '/data-map/data-inventory/silo-discovery/triage';\n newUrl.search = stringify({\n filters: JSON.stringify({ pluginIds: [plugin.id] }),\n });\n\n // Indicate success\n logger.info(\n colors.green(\n `Scan found ${results.length} potential data silos at ${scanPath}! ` +\n `View at '${newUrl.href}' ` +\n '\\n\\n NOTE: it may take 2-3 minutes for scan results to appear in the UI.',\n ),\n );\n}\n"],"mappings":"gZAuBA,eAAsB,EAAgB,CACpC,WACA,YACA,aACA,UAUqC,CACrC,GAAM,CAAE,WAAY,EAAa,iBAAgB,gBAAiB,EAC5D,EACJ,IAAc,GAAK,EAAiB,EAAe,OAAO,EAAU,MAAM,IAAI,CAAC,CAC3E,EAAe,CAAC,GAAG,EAAW,MAAM,IAAI,CAAE,GAAG,EAAY,CAAC,OAAQ,GAAQ,EAAI,OAAS,EAAE,CAC/F,GAAI,CACF,IAAM,EAAwB,MAAM,EAAS,GAAG,EAAS,MAAM,EAAe,KAAK,IAAI,GAAI,CACzF,OAAQ,EAAa,IAAK,GAAgB,GAAG,EAAS,MAAM,IAAM,CAClE,OAAQ,GACR,UAAW,GACZ,CAAC,CACF,EAAO,KAAK,aAAa,EAAY,OAAO,QAAQ,CAEpD,IAAM,EADc,EAAY,IAAK,GAAqB,EAAa,EAAS,CAAC,CAAC,MACvD,CACxB,IAAK,GAAe,EAAW,yBAA2B,EAAE,CAAC,CAC7D,MAAM,CAEH,EAAO,CAAC,GAAG,IADM,IAAI,EAAQ,IAAK,GAAQ,EAAI,KAAK,CAC9B,CAAC,CAE5B,OADA,EAAO,KAAK,UAAU,EAAK,OAAO,sBAAsB,CACjD,EAAK,IAAK,IAAS,CACxB,KAAM,EACN,WAAY,GAAG,EAAS,MAAM,IAC9B,oBAAqB,GACtB,EAAE,OACI,EAAO,CACd,MAAU,MAAM,wBAAwB,EAAgB,eAAe,IAAQ,ECtCnF,eAAsB,EAEpB,CAAE,WAAU,aAAY,OAAM,YAAW,aAAY,gBACtC,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAS,EAA4B,EAAc,EAAK,CAExD,EAAS,MAAM,EAA2B,EAAQ,CACtD,SACA,SAAU,CAAE,aAAY,CACzB,CAAC,CAEI,EAAS,EAAuB,EAAO,SAAS,MACjD,IACH,EAAO,MACL,EAAO,IACL,gBAAgB,EAAO,SAAS,KAAK,gDACtC,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,IAAM,EAAU,MAAM,EAAgB,CACpC,WACA,YACA,aACA,SACD,CAAC,CAEF,MAAM,EAA2B,EAAQ,CACvC,SAAU,EAAO,GACjB,UACA,SACD,CAAC,CAEF,IAAM,EAAS,IAAI,IAAI,EAAW,CAClC,EAAO,SAAW,iDAClB,EAAO,OAAS,EAAU,CACxB,QAAS,KAAK,UAAU,CAAE,UAAW,CAAC,EAAO,GAAG,CAAE,CAAC,CACpD,CAAC,CAGF,EAAO,KACL,EAAO,MACL,cAAc,EAAQ,OAAO,2BAA2B,EAAS,aACnD,EAAO,KAAK;;sEAE3B,CACF"}
1
+ {"version":3,"file":"impl-CkFqqhQ-.mjs","names":[],"sources":["../src/lib/code-scanning/findFilesToScan.ts","../src/commands/inventory/discover-silos/impl.ts"],"sourcesContent":["import fastGlob from 'fast-glob';\n\nimport { logger } from '../../logger.js';\nimport { CodeScanningConfig } from './types.js';\n\nexport interface SiloDiscoveryRawResults {\n /** The name of the potential data silo entry */\n name: string;\n /** A unique UUID (represents the same resource across different silo discovery runs) */\n resourceId: string;\n /** Any hosts associated with the entry */\n host?: string;\n /** Type of data silo */\n type?: string | undefined;\n}\n\n/**\n * Helper to scan for data silos in all package.json files that it can find in a directory\n *\n * @deprecated TODO: https://transcend.height.app/T-32325 - use code scanning instead\n * @param options - Options\n * @returns the list of integrations\n */\nexport async function findFilesToScan({\n scanPath,\n fileGlobs,\n ignoreDirs,\n config,\n}: {\n /** Where to look for package.json files */\n scanPath: string;\n /** Globs to look for */\n fileGlobs: string;\n /** The directories to ignore (excludes node_modules and serverless-build) */\n ignoreDirs: string;\n /** Silo Discovery configuration */\n config: CodeScanningConfig;\n}): Promise<SiloDiscoveryRawResults[]> {\n const { ignoreDirs: IGNORE_DIRS, supportedFiles, scanFunction } = config;\n const globsToSupport =\n fileGlobs === '' ? supportedFiles : supportedFiles.concat(fileGlobs.split(','));\n const dirsToIgnore = [...ignoreDirs.split(','), ...IGNORE_DIRS].filter((dir) => dir.length > 0);\n try {\n const filesToScan: string[] = await fastGlob(`${scanPath}/**/${globsToSupport.join('|')}`, {\n ignore: dirsToIgnore.map((dir: string) => `${scanPath}/**/${dir}`),\n unique: true,\n onlyFiles: true,\n });\n logger.info(`Scanning: ${filesToScan.length} files`);\n const allPackages = filesToScan.map((filePath: string) => scanFunction(filePath)).flat();\n const allSdks = allPackages\n .map((appPackage) => appPackage.softwareDevelopmentKits || [])\n .flat();\n const uniqueDeps = new Set(allSdks.map((sdk) => sdk.name));\n const deps = [...uniqueDeps];\n logger.info(`Found: ${deps.length} unique dependencies`);\n return deps.map((dep) => ({\n name: dep,\n resourceId: `${scanPath}/**/${dep}`,\n useStrictClassifier: true,\n }));\n } catch (error) {\n throw new Error(`Error scanning globs ${findFilesToScan} with error: ${error}`);\n }\n}\n","import {\n buildTranscendGraphQLClient,\n fetchActiveSiloDiscoPlugin,\n uploadSiloDiscoveryResults,\n} from '@transcend-io/sdk';\nimport colors from 'colors';\nimport { stringify } from 'query-string';\n\nimport { ADMIN_DASH } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { findFilesToScan } from '../../../lib/code-scanning/findFilesToScan.js';\nimport { SILO_DISCOVERY_CONFIGS } from '../../../lib/code-scanning/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface DiscoverSilosCommandFlags {\n scanPath: string;\n dataSiloId: string;\n auth: string;\n fileGlobs: string;\n ignoreDirs: string;\n transcendUrl: string;\n}\n\nexport async function discoverSilos(\n this: LocalContext,\n { scanPath, dataSiloId, auth, fileGlobs, ignoreDirs, transcendUrl }: DiscoverSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const plugin = await fetchActiveSiloDiscoPlugin(client, {\n logger,\n filterBy: { dataSiloId },\n });\n\n const config = SILO_DISCOVERY_CONFIGS[plugin.dataSilo.type];\n if (!config) {\n logger.error(\n colors.red(\n `This plugin \"${plugin.dataSilo.type}\" is not supported for offline silo discovery.`,\n ),\n );\n this.process.exit(1);\n }\n\n const results = await findFilesToScan({\n scanPath,\n fileGlobs,\n ignoreDirs,\n config,\n });\n\n await uploadSiloDiscoveryResults(client, {\n pluginId: plugin.id,\n results,\n logger,\n });\n\n const newUrl = new URL(ADMIN_DASH);\n newUrl.pathname = '/data-map/data-inventory/silo-discovery/triage';\n newUrl.search = stringify({\n filters: JSON.stringify({ pluginIds: [plugin.id] }),\n });\n\n // Indicate success\n logger.info(\n colors.green(\n `Scan found ${results.length} potential data silos at ${scanPath}! ` +\n `View at '${newUrl.href}' ` +\n '\\n\\n NOTE: it may take 2-3 minutes for scan results to appear in the UI.',\n ),\n );\n}\n"],"mappings":"gZAuBA,eAAsB,EAAgB,CACpC,WACA,YACA,aACA,UAUqC,CACrC,GAAM,CAAE,WAAY,EAAa,iBAAgB,gBAAiB,EAC5D,EACJ,IAAc,GAAK,EAAiB,EAAe,OAAO,EAAU,MAAM,IAAI,CAAC,CAC3E,EAAe,CAAC,GAAG,EAAW,MAAM,IAAI,CAAE,GAAG,EAAY,CAAC,OAAQ,GAAQ,EAAI,OAAS,EAAE,CAC/F,GAAI,CACF,IAAM,EAAwB,MAAM,EAAS,GAAG,EAAS,MAAM,EAAe,KAAK,IAAI,GAAI,CACzF,OAAQ,EAAa,IAAK,GAAgB,GAAG,EAAS,MAAM,IAAM,CAClE,OAAQ,GACR,UAAW,GACZ,CAAC,CACF,EAAO,KAAK,aAAa,EAAY,OAAO,QAAQ,CAEpD,IAAM,EADc,EAAY,IAAK,GAAqB,EAAa,EAAS,CAAC,CAAC,MACvD,CACxB,IAAK,GAAe,EAAW,yBAA2B,EAAE,CAAC,CAC7D,MAAM,CAEH,EAAO,CAAC,GAAG,IADM,IAAI,EAAQ,IAAK,GAAQ,EAAI,KAAK,CAC9B,CAAC,CAE5B,OADA,EAAO,KAAK,UAAU,EAAK,OAAO,sBAAsB,CACjD,EAAK,IAAK,IAAS,CACxB,KAAM,EACN,WAAY,GAAG,EAAS,MAAM,IAC9B,oBAAqB,GACtB,EAAE,OACI,EAAO,CACd,MAAU,MAAM,wBAAwB,EAAgB,eAAe,IAAQ,ECtCnF,eAAsB,EAEpB,CAAE,WAAU,aAAY,OAAM,YAAW,aAAY,gBACtC,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAS,EAA4B,EAAc,EAAK,CAExD,EAAS,MAAM,EAA2B,EAAQ,CACtD,SACA,SAAU,CAAE,aAAY,CACzB,CAAC,CAEI,EAAS,EAAuB,EAAO,SAAS,MACjD,IACH,EAAO,MACL,EAAO,IACL,gBAAgB,EAAO,SAAS,KAAK,gDACtC,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,IAAM,EAAU,MAAM,EAAgB,CACpC,WACA,YACA,aACA,SACD,CAAC,CAEF,MAAM,EAA2B,EAAQ,CACvC,SAAU,EAAO,GACjB,UACA,SACD,CAAC,CAEF,IAAM,EAAS,IAAI,IAAI,EAAW,CAClC,EAAO,SAAW,iDAClB,EAAO,OAAS,EAAU,CACxB,QAAS,KAAK,UAAU,CAAE,UAAW,CAAC,EAAO,GAAG,CAAE,CAAC,CACpD,CAAC,CAGF,EAAO,KACL,EAAO,MACL,cAAc,EAAQ,OAAO,2BAA2B,EAAS,aACnD,EAAO,KAAK;;sEAE3B,CACF"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./constants-Co8rkELu.mjs";import{t}from"./logger-D1tXVwJj.mjs";import{n}from"./syncCodePackages-kQRUAGvl.mjs";import{t as r}from"./done-input-validation-D25TzrxG.mjs";import{t as i}from"./constants-2MiVdjAH.mjs";import{getEntries as a}from"@transcend-io/type-utils";import o from"colors";import{buildTranscendGraphQLClient as s}from"@transcend-io/sdk";import{execSync as c}from"child_process";import l from"fast-glob";async function u({scanPath:e,ignoreDirs:n=[],repositoryName:r}){return(await Promise.all(a(i).map(async([i,a])=>{let{ignoreDirs:s,supportedFiles:c,scanFunction:u}=a,d=[...n,...s].filter(e=>e.length>0);try{let n=await l(`${e}/**/${c.join(`|`)}`,{ignore:d.map(t=>`${e}/**/${t}`),unique:!0,onlyFiles:!0});t.info(o.magenta(`Scanning: ${n.length} files of type ${i}`));let a=n.map(t=>u(t).map(n=>({...n,relativePath:t.replace(`${e}/`,``)}))).flat();return t.info(o.green(`Found: ${a.length} packages and ${a.map(({softwareDevelopmentKits:e=[]})=>e).flat().length} sdks`)),a.map(e=>({...e,type:i,repositoryName:r}))}catch(e){throw Error(`Error scanning globs ${c} with error: ${e}`)}}))).flat()}const d=`A repository name must be provided. You can specify using --repositoryName=$REPO_NAME or by ensuring the command "git config --get remote.origin.url" returns the name of the repository`;async function f({auth:i,scanPath:a,ignoreDirs:l,repositoryName:f,transcendUrl:p}){r(this.process.exit);let m=f;if(!m)try{let e=c(`cd ${a} && git config --get remote.origin.url`).toString(`utf-8`).trim();[m]=e.includes(`https:`)?e.split(`/`).slice(3).join(`/`).split(`.`):(e.split(`:`).pop()||``).split(`.`),m||(t.error(o.red(d)),this.process.exit(1))}catch(e){t.error(o.red(`${d} - Got error: ${e.message}`)),this.process.exit(1)}let h=s(p,i),g=await u({scanPath:a,ignoreDirs:l,repositoryName:m});await n(h,g);let _=new URL(e);_.pathname=`/code-scanning/code-packages`,t.info(o.green(`Scan found ${g.length} packages at ${a}! View results at '${_.href}'`))}export{f as scanPackages};
2
- //# sourceMappingURL=impl-C9RGUYAT.mjs.map
1
+ import{t as e}from"./constants-B7bW_WN2.mjs";import{t}from"./logger-D1tXVwJj.mjs";import{n}from"./syncCodePackages-kQRUAGvl.mjs";import{t as r}from"./done-input-validation-D25TzrxG.mjs";import{t as i}from"./constants-2MiVdjAH.mjs";import{getEntries as a}from"@transcend-io/type-utils";import o from"colors";import{buildTranscendGraphQLClient as s}from"@transcend-io/sdk";import{execSync as c}from"child_process";import l from"fast-glob";async function u({scanPath:e,ignoreDirs:n=[],repositoryName:r}){return(await Promise.all(a(i).map(async([i,a])=>{let{ignoreDirs:s,supportedFiles:c,scanFunction:u}=a,d=[...n,...s].filter(e=>e.length>0);try{let n=await l(`${e}/**/${c.join(`|`)}`,{ignore:d.map(t=>`${e}/**/${t}`),unique:!0,onlyFiles:!0});t.info(o.magenta(`Scanning: ${n.length} files of type ${i}`));let a=n.map(t=>u(t).map(n=>({...n,relativePath:t.replace(`${e}/`,``)}))).flat();return t.info(o.green(`Found: ${a.length} packages and ${a.map(({softwareDevelopmentKits:e=[]})=>e).flat().length} sdks`)),a.map(e=>({...e,type:i,repositoryName:r}))}catch(e){throw Error(`Error scanning globs ${c} with error: ${e}`)}}))).flat()}const d=`A repository name must be provided. You can specify using --repositoryName=$REPO_NAME or by ensuring the command "git config --get remote.origin.url" returns the name of the repository`;async function f({auth:i,scanPath:a,ignoreDirs:l,repositoryName:f,transcendUrl:p}){r(this.process.exit);let m=f;if(!m)try{let e=c(`cd ${a} && git config --get remote.origin.url`).toString(`utf-8`).trim();[m]=e.includes(`https:`)?e.split(`/`).slice(3).join(`/`).split(`.`):(e.split(`:`).pop()||``).split(`.`),m||(t.error(o.red(d)),this.process.exit(1))}catch(e){t.error(o.red(`${d} - Got error: ${e.message}`)),this.process.exit(1)}let h=s(p,i),g=await u({scanPath:a,ignoreDirs:l,repositoryName:m});await n(h,g);let _=new URL(e);_.pathname=`/code-scanning/code-packages`,t.info(o.green(`Scan found ${g.length} packages at ${a}! View results at '${_.href}'`))}export{f as scanPackages};
2
+ //# sourceMappingURL=impl-CkU-WD3b.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-C9RGUYAT.mjs","names":[],"sources":["../src/lib/code-scanning/findCodePackagesInFolder.ts","../src/commands/inventory/scan-packages/impl.ts"],"sourcesContent":["import { getEntries } from '@transcend-io/type-utils';\nimport colors from 'colors';\nimport fastGlob from 'fast-glob';\n\nimport { CodePackageInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { CODE_SCANNING_CONFIGS } from './constants.js';\n\n/**\n * Helper to scan and discovery all of the code packages within a folder\n *\n * @param options - Options\n * @returns the list of integrations\n */\nexport async function findCodePackagesInFolder({\n scanPath,\n ignoreDirs = [],\n repositoryName,\n}: {\n /** The name of the github repository reporting packages for */\n repositoryName: string;\n /** Where to look for package.json files */\n scanPath: string;\n /** The directories to ignore (excludes node_modules and serverless-build) */\n ignoreDirs?: string[];\n}): Promise<CodePackageInput[]> {\n const allCodePackages = await Promise.all(\n getEntries(CODE_SCANNING_CONFIGS).map(async ([codePackageType, config]) => {\n const { ignoreDirs: configIgnoreDirs, supportedFiles, scanFunction } = config;\n const dirsToIgnore = [...ignoreDirs, ...configIgnoreDirs].filter((dir) => dir.length > 0);\n try {\n const filesToScan: string[] = await fastGlob(`${scanPath}/**/${supportedFiles.join('|')}`, {\n ignore: dirsToIgnore.map((dir: string) => `${scanPath}/**/${dir}`),\n unique: true,\n onlyFiles: true,\n });\n logger.info(\n colors.magenta(`Scanning: ${filesToScan.length} files of type ${codePackageType}`),\n );\n const allPackages = filesToScan\n .map((filePath) =>\n scanFunction(filePath).map((result) => ({\n ...result,\n relativePath: filePath.replace(`${scanPath}/`, ''),\n })),\n )\n .flat();\n logger.info(\n colors.green(\n `Found: ${allPackages.length} packages and ${\n allPackages.map(({ softwareDevelopmentKits = [] }) => softwareDevelopmentKits).flat()\n .length\n } sdks`,\n ),\n );\n\n return allPackages.map(\n (pkg): CodePackageInput => ({\n ...pkg,\n type: codePackageType,\n repositoryName,\n }),\n );\n } catch (error) {\n throw new Error(`Error scanning globs ${supportedFiles} with error: ${error}`);\n }\n }),\n );\n\n return allCodePackages.flat();\n}\n","import { execSync } from 'child_process';\n\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport colors from 'colors';\n\nimport { ADMIN_DASH } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { findCodePackagesInFolder } from '../../../lib/code-scanning/index.js';\nimport { syncCodePackages } from '../../../lib/graphql/index.js';\nimport { logger } from '../../../logger.js';\n\nconst REPO_ERROR =\n 'A repository name must be provided. ' +\n 'You can specify using --repositoryName=$REPO_NAME or by ensuring the ' +\n 'command \"git config --get remote.origin.url\" returns the name of the repository';\n\nexport interface ScanPackagesCommandFlags {\n auth: string;\n scanPath: string;\n ignoreDirs?: string[];\n repositoryName?: string;\n transcendUrl: string;\n}\n\nexport async function scanPackages(\n this: LocalContext,\n { auth, scanPath, ignoreDirs, repositoryName, transcendUrl }: ScanPackagesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Ensure repository name is specified\n let gitRepositoryName = repositoryName;\n if (!gitRepositoryName) {\n try {\n const name = execSync(`cd ${scanPath} && git config --get remote.origin.url`);\n // Trim and parse the URL\n const url = name.toString('utf-8').trim();\n [gitRepositoryName] = !url.includes('https:')\n ? (url.split(':').pop() || '').split('.')\n : url.split('/').slice(3).join('/').split('.');\n if (!gitRepositoryName) {\n logger.error(colors.red(REPO_ERROR));\n this.process.exit(1);\n }\n } catch (err) {\n logger.error(colors.red(`${REPO_ERROR} - Got error: ${err.message}`));\n this.process.exit(1);\n }\n }\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Scan the codebase to discovery packages\n const results = await findCodePackagesInFolder({\n scanPath,\n ignoreDirs,\n repositoryName: gitRepositoryName,\n });\n\n // Report scan to Transcend\n await syncCodePackages(client, results);\n\n const newUrl = new URL(ADMIN_DASH);\n newUrl.pathname = '/code-scanning/code-packages';\n\n // Indicate success\n logger.info(\n colors.green(\n `Scan found ${results.length} packages at ${scanPath}! ` + `View results at '${newUrl.href}'`,\n ),\n );\n}\n"],"mappings":"qbAcA,eAAsB,EAAyB,CAC7C,WACA,aAAa,EAAE,CACf,kBAQ8B,CA4C9B,OAAO,MA3CuB,QAAQ,IACpC,EAAW,EAAsB,CAAC,IAAI,MAAO,CAAC,EAAiB,KAAY,CACzE,GAAM,CAAE,WAAY,EAAkB,iBAAgB,gBAAiB,EACjE,EAAe,CAAC,GAAG,EAAY,GAAG,EAAiB,CAAC,OAAQ,GAAQ,EAAI,OAAS,EAAE,CACzF,GAAI,CACF,IAAM,EAAwB,MAAM,EAAS,GAAG,EAAS,MAAM,EAAe,KAAK,IAAI,GAAI,CACzF,OAAQ,EAAa,IAAK,GAAgB,GAAG,EAAS,MAAM,IAAM,CAClE,OAAQ,GACR,UAAW,GACZ,CAAC,CACF,EAAO,KACL,EAAO,QAAQ,aAAa,EAAY,OAAO,iBAAiB,IAAkB,CACnF,CACD,IAAM,EAAc,EACjB,IAAK,GACJ,EAAa,EAAS,CAAC,IAAK,IAAY,CACtC,GAAG,EACH,aAAc,EAAS,QAAQ,GAAG,EAAS,GAAI,GAAG,CACnD,EAAE,CACJ,CACA,MAAM,CAUT,OATA,EAAO,KACL,EAAO,MACL,UAAU,EAAY,OAAO,gBAC3B,EAAY,KAAK,CAAE,0BAA0B,EAAE,IAAO,EAAwB,CAAC,MAAM,CAClF,OACJ,OACF,CACF,CAEM,EAAY,IAChB,IAA2B,CAC1B,GAAG,EACH,KAAM,EACN,iBACD,EACF,OACM,EAAO,CACd,MAAU,MAAM,wBAAwB,EAAe,eAAe,IAAQ,GAEhF,CACH,EAEsB,MAAM,CCzD/B,MAAM,EACJ,2LAYF,eAAsB,EAEpB,CAAE,OAAM,WAAU,aAAY,iBAAgB,gBAC/B,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAI,EAAoB,EACxB,GAAI,CAAC,EACH,GAAI,CAGF,IAAM,EAFO,EAAS,MAAM,EAAS,wCAErB,CAAC,SAAS,QAAQ,CAAC,MAAM,CACzC,CAAC,GAAsB,EAAI,SAAS,SAAS,CAEzC,EAAI,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC,MAAM,IAAI,EAD3C,EAAI,MAAM,IAAI,CAAC,KAAK,EAAI,IAAI,MAAM,IAAI,CAEtC,IACH,EAAO,MAAM,EAAO,IAAI,EAAW,CAAC,CACpC,KAAK,QAAQ,KAAK,EAAE,QAEf,EAAK,CACZ,EAAO,MAAM,EAAO,IAAI,GAAG,EAAW,gBAAgB,EAAI,UAAU,CAAC,CACrE,KAAK,QAAQ,KAAK,EAAE,CAKxB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAU,MAAM,EAAyB,CAC7C,WACA,aACA,eAAgB,EACjB,CAAC,CAGF,MAAM,EAAiB,EAAQ,EAAQ,CAEvC,IAAM,EAAS,IAAI,IAAI,EAAW,CAClC,EAAO,SAAW,+BAGlB,EAAO,KACL,EAAO,MACL,cAAc,EAAQ,OAAO,eAAe,EAAS,qBAA0B,EAAO,KAAK,GAC5F,CACF"}
1
+ {"version":3,"file":"impl-CkU-WD3b.mjs","names":[],"sources":["../src/lib/code-scanning/findCodePackagesInFolder.ts","../src/commands/inventory/scan-packages/impl.ts"],"sourcesContent":["import { getEntries } from '@transcend-io/type-utils';\nimport colors from 'colors';\nimport fastGlob from 'fast-glob';\n\nimport { CodePackageInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { CODE_SCANNING_CONFIGS } from './constants.js';\n\n/**\n * Helper to scan and discovery all of the code packages within a folder\n *\n * @param options - Options\n * @returns the list of integrations\n */\nexport async function findCodePackagesInFolder({\n scanPath,\n ignoreDirs = [],\n repositoryName,\n}: {\n /** The name of the github repository reporting packages for */\n repositoryName: string;\n /** Where to look for package.json files */\n scanPath: string;\n /** The directories to ignore (excludes node_modules and serverless-build) */\n ignoreDirs?: string[];\n}): Promise<CodePackageInput[]> {\n const allCodePackages = await Promise.all(\n getEntries(CODE_SCANNING_CONFIGS).map(async ([codePackageType, config]) => {\n const { ignoreDirs: configIgnoreDirs, supportedFiles, scanFunction } = config;\n const dirsToIgnore = [...ignoreDirs, ...configIgnoreDirs].filter((dir) => dir.length > 0);\n try {\n const filesToScan: string[] = await fastGlob(`${scanPath}/**/${supportedFiles.join('|')}`, {\n ignore: dirsToIgnore.map((dir: string) => `${scanPath}/**/${dir}`),\n unique: true,\n onlyFiles: true,\n });\n logger.info(\n colors.magenta(`Scanning: ${filesToScan.length} files of type ${codePackageType}`),\n );\n const allPackages = filesToScan\n .map((filePath) =>\n scanFunction(filePath).map((result) => ({\n ...result,\n relativePath: filePath.replace(`${scanPath}/`, ''),\n })),\n )\n .flat();\n logger.info(\n colors.green(\n `Found: ${allPackages.length} packages and ${\n allPackages.map(({ softwareDevelopmentKits = [] }) => softwareDevelopmentKits).flat()\n .length\n } sdks`,\n ),\n );\n\n return allPackages.map(\n (pkg): CodePackageInput => ({\n ...pkg,\n type: codePackageType,\n repositoryName,\n }),\n );\n } catch (error) {\n throw new Error(`Error scanning globs ${supportedFiles} with error: ${error}`);\n }\n }),\n );\n\n return allCodePackages.flat();\n}\n","import { execSync } from 'child_process';\n\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport colors from 'colors';\n\nimport { ADMIN_DASH } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { findCodePackagesInFolder } from '../../../lib/code-scanning/index.js';\nimport { syncCodePackages } from '../../../lib/graphql/index.js';\nimport { logger } from '../../../logger.js';\n\nconst REPO_ERROR =\n 'A repository name must be provided. ' +\n 'You can specify using --repositoryName=$REPO_NAME or by ensuring the ' +\n 'command \"git config --get remote.origin.url\" returns the name of the repository';\n\nexport interface ScanPackagesCommandFlags {\n auth: string;\n scanPath: string;\n ignoreDirs?: string[];\n repositoryName?: string;\n transcendUrl: string;\n}\n\nexport async function scanPackages(\n this: LocalContext,\n { auth, scanPath, ignoreDirs, repositoryName, transcendUrl }: ScanPackagesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Ensure repository name is specified\n let gitRepositoryName = repositoryName;\n if (!gitRepositoryName) {\n try {\n const name = execSync(`cd ${scanPath} && git config --get remote.origin.url`);\n // Trim and parse the URL\n const url = name.toString('utf-8').trim();\n [gitRepositoryName] = !url.includes('https:')\n ? (url.split(':').pop() || '').split('.')\n : url.split('/').slice(3).join('/').split('.');\n if (!gitRepositoryName) {\n logger.error(colors.red(REPO_ERROR));\n this.process.exit(1);\n }\n } catch (err) {\n logger.error(colors.red(`${REPO_ERROR} - Got error: ${err.message}`));\n this.process.exit(1);\n }\n }\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Scan the codebase to discovery packages\n const results = await findCodePackagesInFolder({\n scanPath,\n ignoreDirs,\n repositoryName: gitRepositoryName,\n });\n\n // Report scan to Transcend\n await syncCodePackages(client, results);\n\n const newUrl = new URL(ADMIN_DASH);\n newUrl.pathname = '/code-scanning/code-packages';\n\n // Indicate success\n logger.info(\n colors.green(\n `Scan found ${results.length} packages at ${scanPath}! ` + `View results at '${newUrl.href}'`,\n ),\n );\n}\n"],"mappings":"qbAcA,eAAsB,EAAyB,CAC7C,WACA,aAAa,EAAE,CACf,kBAQ8B,CA4C9B,OAAO,MA3CuB,QAAQ,IACpC,EAAW,EAAsB,CAAC,IAAI,MAAO,CAAC,EAAiB,KAAY,CACzE,GAAM,CAAE,WAAY,EAAkB,iBAAgB,gBAAiB,EACjE,EAAe,CAAC,GAAG,EAAY,GAAG,EAAiB,CAAC,OAAQ,GAAQ,EAAI,OAAS,EAAE,CACzF,GAAI,CACF,IAAM,EAAwB,MAAM,EAAS,GAAG,EAAS,MAAM,EAAe,KAAK,IAAI,GAAI,CACzF,OAAQ,EAAa,IAAK,GAAgB,GAAG,EAAS,MAAM,IAAM,CAClE,OAAQ,GACR,UAAW,GACZ,CAAC,CACF,EAAO,KACL,EAAO,QAAQ,aAAa,EAAY,OAAO,iBAAiB,IAAkB,CACnF,CACD,IAAM,EAAc,EACjB,IAAK,GACJ,EAAa,EAAS,CAAC,IAAK,IAAY,CACtC,GAAG,EACH,aAAc,EAAS,QAAQ,GAAG,EAAS,GAAI,GAAG,CACnD,EAAE,CACJ,CACA,MAAM,CAUT,OATA,EAAO,KACL,EAAO,MACL,UAAU,EAAY,OAAO,gBAC3B,EAAY,KAAK,CAAE,0BAA0B,EAAE,IAAO,EAAwB,CAAC,MAAM,CAClF,OACJ,OACF,CACF,CAEM,EAAY,IAChB,IAA2B,CAC1B,GAAG,EACH,KAAM,EACN,iBACD,EACF,OACM,EAAO,CACd,MAAU,MAAM,wBAAwB,EAAe,eAAe,IAAQ,GAEhF,CACH,EAEsB,MAAM,CCzD/B,MAAM,EACJ,2LAYF,eAAsB,EAEpB,CAAE,OAAM,WAAU,aAAY,iBAAgB,gBAC/B,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAI,EAAoB,EACxB,GAAI,CAAC,EACH,GAAI,CAGF,IAAM,EAFO,EAAS,MAAM,EAAS,wCAErB,CAAC,SAAS,QAAQ,CAAC,MAAM,CACzC,CAAC,GAAsB,EAAI,SAAS,SAAS,CAEzC,EAAI,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC,MAAM,IAAI,EAD3C,EAAI,MAAM,IAAI,CAAC,KAAK,EAAI,IAAI,MAAM,IAAI,CAEtC,IACH,EAAO,MAAM,EAAO,IAAI,EAAW,CAAC,CACpC,KAAK,QAAQ,KAAK,EAAE,QAEf,EAAK,CACZ,EAAO,MAAM,EAAO,IAAI,GAAG,EAAW,gBAAgB,EAAI,UAAU,CAAC,CACrE,KAAK,QAAQ,KAAK,EAAE,CAKxB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAU,MAAM,EAAyB,CAC7C,WACA,aACA,eAAgB,EACjB,CAAC,CAGF,MAAM,EAAiB,EAAQ,EAAQ,CAEvC,IAAM,EAAS,IAAI,IAAI,EAAW,CAClC,EAAO,SAAW,+BAGlB,EAAO,KACL,EAAO,MACL,cAAc,EAAQ,OAAO,eAAe,EAAS,qBAA0B,EAAO,KAAK,GAC5F,CACF"}
@@ -1,3 +1,3 @@
1
- import{a as e}from"./parsers-Bl90Wjbz.mjs";import{t}from"./logger-D1tXVwJj.mjs";import{t as n}from"./done-input-validation-D25TzrxG.mjs";import{n as r,t as i}from"./printResult-BE0CcmNZ.mjs";import{t as a}from"./formatPolicyBundleVersionSummary-BJgl5Q3D.mjs";import{t as o}from"./resolveBundleIdByName-DdemhmTX.mjs";import s from"colors";async function c(e,t){if(t.policyBundleId)return t.policyBundleId;if(t.bundleName){let n=await o(e,t.bundleName);if(n)return n;throw Error(`Policy bundle "${t.bundleName}" was not found for this organization.`)}throw Error(`Must specify --policyBundleId or --bundleName.`)}async function l(e,t){let n=[],r;for(;;){let i={limit:100};r&&(i.after=r);let a=await e.get(`v1/policy-engine/policy-bundles/${t}/versions`,{searchParams:i}).json();if(n.push(...a.nodes),!a.pageInfo.hasNextPage||!a.pageInfo.endCursor)break;r=a.pageInfo.endCursor}return n}function u(e,t){return new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()}async function d(e,t,n){let r=await l(e,t);if(r.length===0)throw Error(`No versions found for this policy bundle.`);if(n.version){let e=r.find(e=>e.version===n.version);if(!e)throw Error(`Version "${n.version}" was not found for this policy bundle.`);return e}return r.sort(u)[0]}async function f({version:o,policyBundleId:l,bundleName:u,auth:f,transcendUrl:p,dryRun:m,json:h}){n(this.process.exit);let g=r(p,f),_=await c(g,{policyBundleId:l?e(l):void 0,bundleName:u}),v=await d(g,_,{version:o});t.info(s.green(m?`Validating activation for version "${v.version}"...`:`Activating version "${v.version}"...`));let y=await g.post(`v1/policy-engine/policy-bundles/${_}/versions/${v.id}/activate`,{json:m?{dryRun:!0}:{}}).json();i(this.process.stdout,{json:h,data:y,renderTable:()=>[`bundleId ${y.bundle.id}`,`bundleName ${y.bundle.bundleName}`,a(y.version)].join(`
1
+ import{a as e}from"./parsers-Bl90Wjbz.mjs";import{t}from"./logger-D1tXVwJj.mjs";import{t as n}from"./done-input-validation-D25TzrxG.mjs";import{n as r,t as i}from"./printResult-BE0CcmNZ.mjs";import{t as a}from"./formatPolicyBundleVersionSummary-BJgl5Q3D.mjs";import{t as o}from"./resolveBundleIdByName-Bxoxa8CK.mjs";import s from"colors";async function c(e,t){if(t.policyBundleId)return t.policyBundleId;if(t.bundleName){let n=await o(e,t.bundleName);if(n)return n;throw Error(`Policy bundle "${t.bundleName}" was not found for this organization.`)}throw Error(`Must specify --policyBundleId or --bundleName.`)}async function l(e,t){let n=[],r;for(;;){let i={limit:100};r&&(i.after=r);let a=await e.get(`v1/policy-engine/policy-bundles/${t}/versions`,{searchParams:i}).json();if(n.push(...a.nodes),!a.pageInfo.hasNextPage||!a.pageInfo.endCursor)break;r=a.pageInfo.endCursor}return n}function u(e,t){return new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()}async function d(e,t,n){let r=await l(e,t);if(r.length===0)throw Error(`No versions found for this policy bundle.`);if(n.version){let e=r.find(e=>e.version===n.version);if(!e)throw Error(`Version "${n.version}" was not found for this policy bundle.`);return e}return r.sort(u)[0]}async function f({version:o,"policy-bundle-id":l,"bundle-name":u,auth:f,"transcend-url":p,"dry-run":m,json:h}){n(this.process.exit);let g=r(p,f),_=await c(g,{policyBundleId:l?e(l):void 0,bundleName:u}),v=await d(g,_,{version:o});t.info(s.green(m?`Validating activation for version "${v.version}"...`:`Activating version "${v.version}"...`));let y=await g.post(`v1/policy-engine/policy-bundles/${_}/versions/${v.id}/activate`,{json:m?{dryRun:!0}:{}}).json();i(this.process.stdout,{json:h,data:y,renderTable:()=>[`bundleId ${y.bundle.id}`,`bundleName ${y.bundle.bundleName}`,a(y.version)].join(`
2
2
  `)}),t.info(s.green(m?`Activation validation succeeded.`:`Policy bundle version activated.`))}export{f as activate};
3
- //# sourceMappingURL=impl-COWe0KAi.mjs.map
3
+ //# sourceMappingURL=impl-Cx5U2XsV.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-COWe0KAi.mjs","names":[],"sources":["../src/commands/policy/helpers/resolvePolicyBundleId.ts","../src/commands/policy/helpers/resolvePolicyBundleVersion.ts","../src/commands/policy/activate/impl.ts"],"sourcesContent":["import type { Got } from 'got';\n\nimport { resolveBundleIdByName } from './resolveBundleIdByName.js';\n\n/** Options for resolving a policy bundle identifier. */\nexport interface ResolvePolicyBundleIdOptions {\n /** Explicit bundle UUID */\n policyBundleId?: string;\n /** Bundle name to resolve */\n bundleName?: string;\n}\n\n/**\n * Resolves a bundle identifier from an explicit UUID or bundle name.\n *\n * @param client - Policy Engine REST client\n * @param options - Bundle lookup options\n * @returns Bundle UUID\n */\nexport async function resolvePolicyBundleId(\n client: Got,\n options: ResolvePolicyBundleIdOptions,\n): Promise<string> {\n if (options.policyBundleId) {\n return options.policyBundleId;\n }\n\n if (options.bundleName) {\n const bundleId = await resolveBundleIdByName(client, options.bundleName);\n if (bundleId) {\n return bundleId;\n }\n throw new Error(`Policy bundle \"${options.bundleName}\" was not found for this organization.`);\n }\n\n throw new Error('Must specify --policyBundleId or --bundleName.');\n}\n","import type { Got } from 'got';\n\nimport type { PolicyBundleVersion, PolicyBundleVersionListResponse } from '../types.js';\n\n/** Options for resolving a policy bundle version. */\nexport interface ResolvePolicyBundleVersionOptions {\n /** Caller-supplied version label; omitted to pick the latest by createdAt */\n version?: string;\n}\n\n/**\n * Lists all versions for a bundle, following cursor pagination.\n *\n * @param client - Policy Engine REST client\n * @param bundleId - Parent bundle UUID\n * @returns All uploaded versions\n */\nasync function listAllPolicyBundleVersions(\n client: Got,\n bundleId: string,\n): Promise<PolicyBundleVersion[]> {\n const limit = 100;\n const versions: PolicyBundleVersion[] = [];\n let after: string | undefined;\n\n while (true) {\n const searchParams: Record<string, string | number> = { limit };\n if (after) {\n searchParams.after = after;\n }\n\n const body = await client\n .get(`v1/policy-engine/policy-bundles/${bundleId}/versions`, {\n searchParams,\n })\n .json<PolicyBundleVersionListResponse>();\n\n versions.push(...body.nodes);\n\n if (!body.pageInfo.hasNextPage || !body.pageInfo.endCursor) {\n break;\n }\n after = body.pageInfo.endCursor;\n }\n\n return versions;\n}\n\n/**\n * Compares two version records by createdAt, newest first.\n *\n * @param left - First version\n * @param right - Second version\n * @returns Sort order for descending createdAt\n */\nfunction compareVersionsByCreatedAtDesc(\n left: PolicyBundleVersion,\n right: PolicyBundleVersion,\n): number {\n return new Date(right.createdAt).getTime() - new Date(left.createdAt).getTime();\n}\n\n/**\n * Resolves a version label to a version record, or picks the latest by createdAt.\n *\n * @param client - Policy Engine REST client\n * @param bundleId - Parent bundle UUID\n * @param options - Version lookup options\n * @returns Matching or latest version record\n */\nexport async function resolvePolicyBundleVersion(\n client: Got,\n bundleId: string,\n options: ResolvePolicyBundleVersionOptions,\n): Promise<PolicyBundleVersion> {\n const versions = await listAllPolicyBundleVersions(client, bundleId);\n\n if (versions.length === 0) {\n throw new Error('No versions found for this policy bundle.');\n }\n\n if (options.version) {\n const match = versions.find((entry) => entry.version === options.version);\n if (!match) {\n throw new Error(`Version \"${options.version}\" was not found for this policy bundle.`);\n }\n return match;\n }\n\n return versions.sort(compareVersionsByCreatedAtDesc)[0];\n}\n","import colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { uuidParser } from '../../../lib/cli/parsers.js';\nimport { logger } from '../../../logger.js';\nimport {\n buildPolicyEngineClient,\n formatPolicyBundleVersionSummary,\n printResult,\n resolvePolicyBundleId,\n resolvePolicyBundleVersion,\n} from '../helpers/index.js';\nimport type { ActivatePolicyBundleVersionResponse } from '../types.js';\n\n/** CLI flags for `transcend policy activate`. */\nexport interface ActivateCommandFlags {\n /** Caller-supplied version label to activate */\n version?: string;\n /** Parent bundle UUID */\n policyBundleId?: string;\n /** Parent bundle name (resolved when policyBundleId is omitted) */\n bundleName?: string;\n /** Transcend API key */\n auth: string;\n /** Transcend API URL */\n transcendUrl: string;\n /** Validate activation without flipping */\n dryRun: boolean;\n /** Print raw JSON response */\n json: boolean;\n}\n\n/**\n * Activate an uploaded policy bundle version.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function activate(\n this: LocalContext,\n { version, policyBundleId, bundleName, auth, transcendUrl, dryRun, json }: ActivateCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const client = buildPolicyEngineClient(transcendUrl, auth);\n const resolvedBundleId = await resolvePolicyBundleId(client, {\n policyBundleId: policyBundleId ? uuidParser(policyBundleId) : undefined,\n bundleName,\n });\n const resolvedVersion = await resolvePolicyBundleVersion(client, resolvedBundleId, { version });\n\n logger.info(\n colors.green(\n dryRun\n ? `Validating activation for version \"${resolvedVersion.version}\"...`\n : `Activating version \"${resolvedVersion.version}\"...`,\n ),\n );\n\n const body = await client\n .post(\n `v1/policy-engine/policy-bundles/${resolvedBundleId}/versions/${resolvedVersion.id}/activate`,\n {\n json: dryRun ? { dryRun: true } : {},\n },\n )\n .json<ActivatePolicyBundleVersionResponse>();\n\n printResult(this.process.stdout, {\n json,\n data: body,\n renderTable: () =>\n [\n `bundleId ${body.bundle.id}`,\n `bundleName ${body.bundle.bundleName}`,\n formatPolicyBundleVersionSummary(body.version),\n ].join('\\n'),\n });\n\n logger.info(\n colors.green(dryRun ? 'Activation validation succeeded.' : 'Policy bundle version activated.'),\n );\n}\n"],"mappings":"kVAmBA,eAAsB,EACpB,EACA,EACiB,CACjB,GAAI,EAAQ,eACV,OAAO,EAAQ,eAGjB,GAAI,EAAQ,WAAY,CACtB,IAAM,EAAW,MAAM,EAAsB,EAAQ,EAAQ,WAAW,CACxE,GAAI,EACF,OAAO,EAET,MAAU,MAAM,kBAAkB,EAAQ,WAAW,wCAAwC,CAG/F,MAAU,MAAM,iDAAiD,CClBnE,eAAe,EACb,EACA,EACgC,CAChC,IACM,EAAkC,EAAE,CACtC,EAEJ,OAAa,CACX,IAAM,EAAgD,CAAE,UAAO,CAC3D,IACF,EAAa,MAAQ,GAGvB,IAAM,EAAO,MAAM,EAChB,IAAI,mCAAmC,EAAS,WAAY,CAC3D,eACD,CAAC,CACD,MAAuC,CAI1C,GAFA,EAAS,KAAK,GAAG,EAAK,MAAM,CAExB,CAAC,EAAK,SAAS,aAAe,CAAC,EAAK,SAAS,UAC/C,MAEF,EAAQ,EAAK,SAAS,UAGxB,OAAO,EAUT,SAAS,EACP,EACA,EACQ,CACR,OAAO,IAAI,KAAK,EAAM,UAAU,CAAC,SAAS,CAAG,IAAI,KAAK,EAAK,UAAU,CAAC,SAAS,CAWjF,eAAsB,EACpB,EACA,EACA,EAC8B,CAC9B,IAAM,EAAW,MAAM,EAA4B,EAAQ,EAAS,CAEpE,GAAI,EAAS,SAAW,EACtB,MAAU,MAAM,4CAA4C,CAG9D,GAAI,EAAQ,QAAS,CACnB,IAAM,EAAQ,EAAS,KAAM,GAAU,EAAM,UAAY,EAAQ,QAAQ,CACzE,GAAI,CAAC,EACH,MAAU,MAAM,YAAY,EAAQ,QAAQ,yCAAyC,CAEvF,OAAO,EAGT,OAAO,EAAS,KAAK,EAA+B,CAAC,GClDvD,eAAsB,EAEpB,CAAE,UAAS,iBAAgB,aAAY,OAAM,eAAc,SAAQ,QACpD,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,IAAM,EAAS,EAAwB,EAAc,EAAK,CACpD,EAAmB,MAAM,EAAsB,EAAQ,CAC3D,eAAgB,EAAiB,EAAW,EAAe,CAAG,IAAA,GAC9D,aACD,CAAC,CACI,EAAkB,MAAM,EAA2B,EAAQ,EAAkB,CAAE,UAAS,CAAC,CAE/F,EAAO,KACL,EAAO,MACL,EACI,sCAAsC,EAAgB,QAAQ,MAC9D,uBAAuB,EAAgB,QAAQ,MACpD,CACF,CAED,IAAM,EAAO,MAAM,EAChB,KACC,mCAAmC,EAAiB,YAAY,EAAgB,GAAG,WACnF,CACE,KAAM,EAAS,CAAE,OAAQ,GAAM,CAAG,EAAE,CACrC,CACF,CACA,MAA2C,CAE9C,EAAY,KAAK,QAAQ,OAAQ,CAC/B,OACA,KAAM,EACN,gBACE,CACE,eAAe,EAAK,OAAO,KAC3B,eAAe,EAAK,OAAO,aAC3B,EAAiC,EAAK,QAAQ,CAC/C,CAAC,KAAK;EAAK,CACf,CAAC,CAEF,EAAO,KACL,EAAO,MAAM,EAAS,mCAAqC,mCAAmC,CAC/F"}
1
+ {"version":3,"file":"impl-Cx5U2XsV.mjs","names":[],"sources":["../src/commands/policy/helpers/resolvePolicyBundleId.ts","../src/commands/policy/helpers/resolvePolicyBundleVersion.ts","../src/commands/policy/activate/impl.ts"],"sourcesContent":["import type { Got } from 'got';\n\nimport { resolveBundleIdByName } from './resolveBundleIdByName.js';\n\n/** Options for resolving a policy bundle identifier. */\nexport interface ResolvePolicyBundleIdOptions {\n /** Explicit bundle UUID */\n policyBundleId?: string;\n /** Bundle name to resolve */\n bundleName?: string;\n}\n\n/**\n * Resolves a bundle identifier from an explicit UUID or bundle name.\n *\n * @param client - Policy Engine REST client\n * @param options - Bundle lookup options\n * @returns Bundle UUID\n */\nexport async function resolvePolicyBundleId(\n client: Got,\n options: ResolvePolicyBundleIdOptions,\n): Promise<string> {\n if (options.policyBundleId) {\n return options.policyBundleId;\n }\n\n if (options.bundleName) {\n const bundleId = await resolveBundleIdByName(client, options.bundleName);\n if (bundleId) {\n return bundleId;\n }\n throw new Error(`Policy bundle \"${options.bundleName}\" was not found for this organization.`);\n }\n\n throw new Error('Must specify --policyBundleId or --bundleName.');\n}\n","import type { Got } from 'got';\n\nimport type { PolicyBundleVersion, PolicyBundleVersionListResponse } from '../types.js';\n\n/** Options for resolving a policy bundle version. */\nexport interface ResolvePolicyBundleVersionOptions {\n /** Caller-supplied version label; omitted to pick the latest by createdAt */\n version?: string;\n}\n\n/**\n * Lists all versions for a bundle, following cursor pagination.\n *\n * @param client - Policy Engine REST client\n * @param bundleId - Parent bundle UUID\n * @returns All uploaded versions\n */\nasync function listAllPolicyBundleVersions(\n client: Got,\n bundleId: string,\n): Promise<PolicyBundleVersion[]> {\n const limit = 100;\n const versions: PolicyBundleVersion[] = [];\n let after: string | undefined;\n\n while (true) {\n const searchParams: Record<string, string | number> = { limit };\n if (after) {\n searchParams.after = after;\n }\n\n const body = await client\n .get(`v1/policy-engine/policy-bundles/${bundleId}/versions`, {\n searchParams,\n })\n .json<PolicyBundleVersionListResponse>();\n\n versions.push(...body.nodes);\n\n if (!body.pageInfo.hasNextPage || !body.pageInfo.endCursor) {\n break;\n }\n after = body.pageInfo.endCursor;\n }\n\n return versions;\n}\n\n/**\n * Compares two version records by createdAt, newest first.\n *\n * @param left - First version\n * @param right - Second version\n * @returns Sort order for descending createdAt\n */\nfunction compareVersionsByCreatedAtDesc(\n left: PolicyBundleVersion,\n right: PolicyBundleVersion,\n): number {\n return new Date(right.createdAt).getTime() - new Date(left.createdAt).getTime();\n}\n\n/**\n * Resolves a version label to a version record, or picks the latest by createdAt.\n *\n * @param client - Policy Engine REST client\n * @param bundleId - Parent bundle UUID\n * @param options - Version lookup options\n * @returns Matching or latest version record\n */\nexport async function resolvePolicyBundleVersion(\n client: Got,\n bundleId: string,\n options: ResolvePolicyBundleVersionOptions,\n): Promise<PolicyBundleVersion> {\n const versions = await listAllPolicyBundleVersions(client, bundleId);\n\n if (versions.length === 0) {\n throw new Error('No versions found for this policy bundle.');\n }\n\n if (options.version) {\n const match = versions.find((entry) => entry.version === options.version);\n if (!match) {\n throw new Error(`Version \"${options.version}\" was not found for this policy bundle.`);\n }\n return match;\n }\n\n return versions.sort(compareVersionsByCreatedAtDesc)[0];\n}\n","import colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { uuidParser } from '../../../lib/cli/parsers.js';\nimport { logger } from '../../../logger.js';\nimport {\n buildPolicyEngineClient,\n formatPolicyBundleVersionSummary,\n printResult,\n resolvePolicyBundleId,\n resolvePolicyBundleVersion,\n} from '../helpers/index.js';\nimport type { ActivatePolicyBundleVersionResponse } from '../types.js';\n\n/** CLI flags for `transcend policy activate`. */\nexport interface ActivateCommandFlags {\n /** Caller-supplied version label to activate */\n version?: string;\n /** Parent bundle UUID */\n 'policy-bundle-id'?: string;\n /** Parent bundle name (resolved when --policy-bundle-id is omitted) */\n 'bundle-name'?: string;\n /** Transcend API key */\n auth: string;\n /** Transcend API URL */\n 'transcend-url': string;\n /** Validate activation without flipping */\n 'dry-run': boolean;\n /** Print raw JSON response */\n json: boolean;\n}\n\n/**\n * Activate an uploaded policy bundle version.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function activate(\n this: LocalContext,\n {\n version,\n 'policy-bundle-id': policyBundleId,\n 'bundle-name': bundleName,\n auth,\n 'transcend-url': transcendUrl,\n 'dry-run': dryRun,\n json,\n }: ActivateCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const client = buildPolicyEngineClient(transcendUrl, auth);\n const resolvedBundleId = await resolvePolicyBundleId(client, {\n policyBundleId: policyBundleId ? uuidParser(policyBundleId) : undefined,\n bundleName,\n });\n const resolvedVersion = await resolvePolicyBundleVersion(client, resolvedBundleId, { version });\n\n logger.info(\n colors.green(\n dryRun\n ? `Validating activation for version \"${resolvedVersion.version}\"...`\n : `Activating version \"${resolvedVersion.version}\"...`,\n ),\n );\n\n const body = await client\n .post(\n `v1/policy-engine/policy-bundles/${resolvedBundleId}/versions/${resolvedVersion.id}/activate`,\n {\n json: dryRun ? { dryRun: true } : {},\n },\n )\n .json<ActivatePolicyBundleVersionResponse>();\n\n printResult(this.process.stdout, {\n json,\n data: body,\n renderTable: () =>\n [\n `bundleId ${body.bundle.id}`,\n `bundleName ${body.bundle.bundleName}`,\n formatPolicyBundleVersionSummary(body.version),\n ].join('\\n'),\n });\n\n logger.info(\n colors.green(dryRun ? 'Activation validation succeeded.' : 'Policy bundle version activated.'),\n );\n}\n"],"mappings":"kVAmBA,eAAsB,EACpB,EACA,EACiB,CACjB,GAAI,EAAQ,eACV,OAAO,EAAQ,eAGjB,GAAI,EAAQ,WAAY,CACtB,IAAM,EAAW,MAAM,EAAsB,EAAQ,EAAQ,WAAW,CACxE,GAAI,EACF,OAAO,EAET,MAAU,MAAM,kBAAkB,EAAQ,WAAW,wCAAwC,CAG/F,MAAU,MAAM,iDAAiD,CClBnE,eAAe,EACb,EACA,EACgC,CAChC,IACM,EAAkC,EAAE,CACtC,EAEJ,OAAa,CACX,IAAM,EAAgD,CAAE,UAAO,CAC3D,IACF,EAAa,MAAQ,GAGvB,IAAM,EAAO,MAAM,EAChB,IAAI,mCAAmC,EAAS,WAAY,CAC3D,eACD,CAAC,CACD,MAAuC,CAI1C,GAFA,EAAS,KAAK,GAAG,EAAK,MAAM,CAExB,CAAC,EAAK,SAAS,aAAe,CAAC,EAAK,SAAS,UAC/C,MAEF,EAAQ,EAAK,SAAS,UAGxB,OAAO,EAUT,SAAS,EACP,EACA,EACQ,CACR,OAAO,IAAI,KAAK,EAAM,UAAU,CAAC,SAAS,CAAG,IAAI,KAAK,EAAK,UAAU,CAAC,SAAS,CAWjF,eAAsB,EACpB,EACA,EACA,EAC8B,CAC9B,IAAM,EAAW,MAAM,EAA4B,EAAQ,EAAS,CAEpE,GAAI,EAAS,SAAW,EACtB,MAAU,MAAM,4CAA4C,CAG9D,GAAI,EAAQ,QAAS,CACnB,IAAM,EAAQ,EAAS,KAAM,GAAU,EAAM,UAAY,EAAQ,QAAQ,CACzE,GAAI,CAAC,EACH,MAAU,MAAM,YAAY,EAAQ,QAAQ,yCAAyC,CAEvF,OAAO,EAGT,OAAO,EAAS,KAAK,EAA+B,CAAC,GClDvD,eAAsB,EAEpB,CACE,UACA,mBAAoB,EACpB,cAAe,EACf,OACA,gBAAiB,EACjB,UAAW,EACX,QAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,IAAM,EAAS,EAAwB,EAAc,EAAK,CACpD,EAAmB,MAAM,EAAsB,EAAQ,CAC3D,eAAgB,EAAiB,EAAW,EAAe,CAAG,IAAA,GAC9D,aACD,CAAC,CACI,EAAkB,MAAM,EAA2B,EAAQ,EAAkB,CAAE,UAAS,CAAC,CAE/F,EAAO,KACL,EAAO,MACL,EACI,sCAAsC,EAAgB,QAAQ,MAC9D,uBAAuB,EAAgB,QAAQ,MACpD,CACF,CAED,IAAM,EAAO,MAAM,EAChB,KACC,mCAAmC,EAAiB,YAAY,EAAgB,GAAG,WACnF,CACE,KAAM,EAAS,CAAE,OAAQ,GAAM,CAAG,EAAE,CACrC,CACF,CACA,MAA2C,CAE9C,EAAY,KAAK,QAAQ,OAAQ,CAC/B,OACA,KAAM,EACN,gBACE,CACE,eAAe,EAAK,OAAO,KAC3B,eAAe,EAAK,OAAO,aAC3B,EAAiC,EAAK,QAAQ,CAC/C,CAAC,KAAK;EAAK,CACf,CAAC,CAEF,EAAO,KACL,EAAO,MAAM,EAAS,mCAAqC,mCAAmC,CAC/F"}
@@ -0,0 +1,3 @@
1
+ import{t as e}from"./logger-D1tXVwJj.mjs";import{t}from"./done-input-validation-D25TzrxG.mjs";import{n,t as r}from"./printResult-BE0CcmNZ.mjs";import{t as i}from"./formatPolicyBundleVersionSummary-BJgl5Q3D.mjs";import{t as a}from"./formatPolicyEngineRequestError-C8g0v7nh.mjs";import{t as o}from"./resolveBundleIdByName-Bxoxa8CK.mjs";import s from"colors";async function c({"bundle-name":c,auth:l,"transcend-url":u,json:d}){t(this.process.exit);let f=n(u,l),p=await o(f,c);if(!p)throw Error(`Policy bundle "${c}" was not found for this organization.`);e.info(s.green(`Deactivating active version for bundle "${c}"...`));let m;try{m=await f.post(`v1/policy-engine/policy-bundles/${p}/deactivate`).json()}catch(e){throw e?.response?.statusCode===409?Error(`Policy bundle "${c}" has no active version.`,{cause:e}):Error(a(e),{cause:e})}r(this.process.stdout,{json:d,data:m,renderTable:()=>[`bundleId ${m.bundle.id}`,`bundleName ${m.bundle.bundleName}`,i(m.version)].join(`
2
+ `)}),e.info(s.green(`Policy bundle version deactivated.`))}export{c as deactivate};
3
+ //# sourceMappingURL=impl-DGm5NVUi.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl-DGm5NVUi.mjs","names":[],"sources":["../src/commands/policy/deactivate/impl.ts"],"sourcesContent":["import colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { logger } from '../../../logger.js';\nimport {\n buildPolicyEngineClient,\n formatPolicyBundleVersionSummary,\n formatPolicyEngineRequestError,\n printResult,\n resolveBundleIdByName,\n} from '../helpers/index.js';\nimport type { DeactivatePolicyBundleResponse } from '../types.js';\n\n/** CLI flags for `transcend policy deactivate`. */\nexport interface DeactivateCommandFlags {\n /** Logical bundle name to deactivate */\n 'bundle-name': string;\n /** Transcend API key */\n auth: string;\n /** Transcend API URL */\n 'transcend-url': string;\n /** Print raw JSON response */\n json: boolean;\n}\n\n/**\n * Deactivate the currently active version of a policy bundle.\n *\n * Resolves `--bundle-name` to the parent bundle UUID internally, then calls the\n * Policy Engine deactivate endpoint. The bundle is addressed by name only -- the\n * UUID is never exposed to the operator.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function deactivate(\n this: LocalContext,\n { 'bundle-name': bundleName, auth, 'transcend-url': transcendUrl, json }: DeactivateCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const client = buildPolicyEngineClient(transcendUrl, auth);\n\n const resolvedBundleId = await resolveBundleIdByName(client, bundleName);\n if (!resolvedBundleId) {\n throw new Error(`Policy bundle \"${bundleName}\" was not found for this organization.`);\n }\n\n logger.info(colors.green(`Deactivating active version for bundle \"${bundleName}\"...`));\n\n let body: DeactivatePolicyBundleResponse;\n try {\n body = await client\n .post(`v1/policy-engine/policy-bundles/${resolvedBundleId}/deactivate`)\n .json<DeactivatePolicyBundleResponse>();\n } catch (err) {\n // The monolith 409 references the internal bundle UUID; rewrite it to the\n // user-supplied bundle name so the error is actionable.\n const statusCode = (err as { response?: { statusCode?: number } })?.response?.statusCode;\n if (statusCode === 409) {\n throw new Error(`Policy bundle \"${bundleName}\" has no active version.`, { cause: err });\n }\n throw new Error(formatPolicyEngineRequestError(err), { cause: err });\n }\n\n printResult(this.process.stdout, {\n json,\n data: body,\n renderTable: () =>\n [\n `bundleId ${body.bundle.id}`,\n `bundleName ${body.bundle.bundleName}`,\n formatPolicyBundleVersionSummary(body.version),\n ].join('\\n'),\n });\n\n logger.info(colors.green('Policy bundle version deactivated.'));\n}\n"],"mappings":"oWAoCA,eAAsB,EAEpB,CAAE,cAAe,EAAY,OAAM,gBAAiB,EAAc,QACnD,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,IAAM,EAAS,EAAwB,EAAc,EAAK,CAEpD,EAAmB,MAAM,EAAsB,EAAQ,EAAW,CACxE,GAAI,CAAC,EACH,MAAU,MAAM,kBAAkB,EAAW,wCAAwC,CAGvF,EAAO,KAAK,EAAO,MAAM,2CAA2C,EAAW,MAAM,CAAC,CAEtF,IAAI,EACJ,GAAI,CACF,EAAO,MAAM,EACV,KAAK,mCAAmC,EAAiB,aAAa,CACtE,MAAsC,OAClC,EAAK,CAOZ,MAJoB,GAAgD,UAAU,aAC3D,IACP,MAAM,kBAAkB,EAAW,0BAA2B,CAAE,MAAO,EAAK,CAAC,CAE/E,MAAM,EAA+B,EAAI,CAAE,CAAE,MAAO,EAAK,CAAC,CAGtE,EAAY,KAAK,QAAQ,OAAQ,CAC/B,OACA,KAAM,EACN,gBACE,CACE,eAAe,EAAK,OAAO,KAC3B,eAAe,EAAK,OAAO,aAC3B,EAAiC,EAAK,QAAQ,CAC/C,CAAC,KAAK;EAAK,CACf,CAAC,CAEF,EAAO,KAAK,EAAO,MAAM,qCAAqC,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./readCsv-ddmavI86.mjs";import{r as t}from"./uploadConsents-K3cGrF3M.mjs";import{t as n}from"./done-input-validation-D25TzrxG.mjs";import*as r from"io-ts";const i=r.intersection([r.type({userId:r.string,timestamp:r.string}),r.partial({confirmed:r.union([r.literal(`true`),r.literal(`false`)]),updated:r.union([r.literal(`true`),r.literal(`false`)]),prompted:r.union([r.literal(`true`),r.literal(`false`)]),metadata:r.string,usp:r.union([r.string,r.null]),gpp:r.union([r.string,r.null]),purposes:r.string})]);async function a({base64EncryptionKey:r,base64SigningKey:a,partition:o,file:s,consentUrl:c,concurrency:l}){n(this.process.exit),await t({base64EncryptionKey:r,base64SigningKey:a,preferences:e(s,i),partition:o,concurrency:l,transcendUrl:c})}export{a as uploadConsentPreferences};
2
- //# sourceMappingURL=impl-BcirxaFO.mjs.map
1
+ import{t as e}from"./readCsv-ddmavI86.mjs";import{r as t}from"./uploadConsents-D8IJDaTN.mjs";import{t as n}from"./done-input-validation-D25TzrxG.mjs";import*as r from"io-ts";const i=r.intersection([r.type({userId:r.string,timestamp:r.string}),r.partial({confirmed:r.union([r.literal(`true`),r.literal(`false`)]),updated:r.union([r.literal(`true`),r.literal(`false`)]),prompted:r.union([r.literal(`true`),r.literal(`false`)]),metadata:r.string,usp:r.union([r.string,r.null]),gpp:r.union([r.string,r.null]),purposes:r.string})]);async function a({base64EncryptionKey:r,base64SigningKey:a,partition:o,file:s,consentUrl:c,concurrency:l}){n(this.process.exit),await t({base64EncryptionKey:r,base64SigningKey:a,preferences:e(s,i),partition:o,concurrency:l,transcendUrl:c})}export{a as uploadConsentPreferences};
2
+ //# sourceMappingURL=impl-DMbgck0i.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-BcirxaFO.mjs","names":[],"sources":["../src/lib/consent-manager/types.ts","../src/commands/consent/upload-consent-preferences/impl.ts"],"sourcesContent":["import * as t from 'io-ts';\n\nexport const ConsentPreferenceUpload = t.intersection([\n t.type({\n /** User ID */\n userId: t.string,\n /** Has the consent been updated (including no-change confirmation) since default resolution */\n timestamp: t.string,\n }),\n t.partial({\n /** Was tracking consent confirmed by the user? If this is false, the consent was resolved from defaults & is not yet confirmed */\n confirmed: t.union([t.literal('true'), t.literal('false')]),\n /**\n * Has the consent been updated (including no-change confirmation) since default resolution\n */\n updated: t.union([t.literal('true'), t.literal('false')]),\n /**\n * Whether or not the UI has been shown to the end-user (undefined in older versions of airgap.js)\n */\n prompted: t.union([t.literal('true'), t.literal('false')]),\n /** Consent metadata */\n metadata: t.string,\n /** US Privacy (USP) String */\n usp: t.union([t.string, t.null]),\n /** IAB GPP String */\n gpp: t.union([t.string, t.null]),\n /**\n * Purpose map\n * This is a stringified JSON object with keys as purpose names and values as booleans or 'Auto'\n */\n purposes: t.string,\n }),\n]);\n\n/** Type override */\nexport type ConsentPreferenceUpload = t.TypeOf<typeof ConsentPreferenceUpload>;\n","import type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { ConsentPreferenceUpload } from '../../../lib/consent-manager/types.js';\nimport { uploadConsents } from '../../../lib/consent-manager/uploadConsents.js';\nimport { readCsv } from '../../../lib/requests/index.js';\n\nexport interface UploadConsentPreferencesCommandFlags {\n base64EncryptionKey: string;\n base64SigningKey: string;\n partition: string;\n file: string;\n consentUrl: string;\n concurrency: number;\n}\n\nexport async function uploadConsentPreferences(\n this: LocalContext,\n {\n base64EncryptionKey,\n base64SigningKey,\n partition,\n file,\n consentUrl,\n concurrency,\n }: UploadConsentPreferencesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Load in preferences from csv\n const preferences = readCsv(file, ConsentPreferenceUpload);\n\n // Upload cookies\n await uploadConsents({\n base64EncryptionKey,\n base64SigningKey,\n preferences,\n partition,\n concurrency,\n transcendUrl: consentUrl,\n });\n}\n"],"mappings":"8KAEA,MAAa,EAA0B,EAAE,aAAa,CACpD,EAAE,KAAK,CAEL,OAAQ,EAAE,OAEV,UAAW,EAAE,OACd,CAAC,CACF,EAAE,QAAQ,CAER,UAAW,EAAE,MAAM,CAAC,EAAE,QAAQ,OAAO,CAAE,EAAE,QAAQ,QAAQ,CAAC,CAAC,CAI3D,QAAS,EAAE,MAAM,CAAC,EAAE,QAAQ,OAAO,CAAE,EAAE,QAAQ,QAAQ,CAAC,CAAC,CAIzD,SAAU,EAAE,MAAM,CAAC,EAAE,QAAQ,OAAO,CAAE,EAAE,QAAQ,QAAQ,CAAC,CAAC,CAE1D,SAAU,EAAE,OAEZ,IAAK,EAAE,MAAM,CAAC,EAAE,OAAQ,EAAE,KAAK,CAAC,CAEhC,IAAK,EAAE,MAAM,CAAC,EAAE,OAAQ,EAAE,KAAK,CAAC,CAKhC,SAAU,EAAE,OACb,CAAC,CACH,CAAC,CCjBF,eAAsB,EAEpB,CACE,sBACA,mBACA,YACA,OACA,aACA,eAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAMtC,MAAM,EAAe,CACnB,sBACA,mBACA,YANkB,EAAQ,EAAM,EAMrB,CACX,YACA,cACA,aAAc,EACf,CAAC"}
1
+ {"version":3,"file":"impl-DMbgck0i.mjs","names":[],"sources":["../src/lib/consent-manager/types.ts","../src/commands/consent/upload-consent-preferences/impl.ts"],"sourcesContent":["import * as t from 'io-ts';\n\nexport const ConsentPreferenceUpload = t.intersection([\n t.type({\n /** User ID */\n userId: t.string,\n /** Has the consent been updated (including no-change confirmation) since default resolution */\n timestamp: t.string,\n }),\n t.partial({\n /** Was tracking consent confirmed by the user? If this is false, the consent was resolved from defaults & is not yet confirmed */\n confirmed: t.union([t.literal('true'), t.literal('false')]),\n /**\n * Has the consent been updated (including no-change confirmation) since default resolution\n */\n updated: t.union([t.literal('true'), t.literal('false')]),\n /**\n * Whether or not the UI has been shown to the end-user (undefined in older versions of airgap.js)\n */\n prompted: t.union([t.literal('true'), t.literal('false')]),\n /** Consent metadata */\n metadata: t.string,\n /** US Privacy (USP) String */\n usp: t.union([t.string, t.null]),\n /** IAB GPP String */\n gpp: t.union([t.string, t.null]),\n /**\n * Purpose map\n * This is a stringified JSON object with keys as purpose names and values as booleans or 'Auto'\n */\n purposes: t.string,\n }),\n]);\n\n/** Type override */\nexport type ConsentPreferenceUpload = t.TypeOf<typeof ConsentPreferenceUpload>;\n","import type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { ConsentPreferenceUpload } from '../../../lib/consent-manager/types.js';\nimport { uploadConsents } from '../../../lib/consent-manager/uploadConsents.js';\nimport { readCsv } from '../../../lib/requests/index.js';\n\nexport interface UploadConsentPreferencesCommandFlags {\n base64EncryptionKey: string;\n base64SigningKey: string;\n partition: string;\n file: string;\n consentUrl: string;\n concurrency: number;\n}\n\nexport async function uploadConsentPreferences(\n this: LocalContext,\n {\n base64EncryptionKey,\n base64SigningKey,\n partition,\n file,\n consentUrl,\n concurrency,\n }: UploadConsentPreferencesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Load in preferences from csv\n const preferences = readCsv(file, ConsentPreferenceUpload);\n\n // Upload cookies\n await uploadConsents({\n base64EncryptionKey,\n base64SigningKey,\n preferences,\n partition,\n concurrency,\n transcendUrl: consentUrl,\n });\n}\n"],"mappings":"8KAEA,MAAa,EAA0B,EAAE,aAAa,CACpD,EAAE,KAAK,CAEL,OAAQ,EAAE,OAEV,UAAW,EAAE,OACd,CAAC,CACF,EAAE,QAAQ,CAER,UAAW,EAAE,MAAM,CAAC,EAAE,QAAQ,OAAO,CAAE,EAAE,QAAQ,QAAQ,CAAC,CAAC,CAI3D,QAAS,EAAE,MAAM,CAAC,EAAE,QAAQ,OAAO,CAAE,EAAE,QAAQ,QAAQ,CAAC,CAAC,CAIzD,SAAU,EAAE,MAAM,CAAC,EAAE,QAAQ,OAAO,CAAE,EAAE,QAAQ,QAAQ,CAAC,CAAC,CAE1D,SAAU,EAAE,OAEZ,IAAK,EAAE,MAAM,CAAC,EAAE,OAAQ,EAAE,KAAK,CAAC,CAEhC,IAAK,EAAE,MAAM,CAAC,EAAE,OAAQ,EAAE,KAAK,CAAC,CAKhC,SAAU,EAAE,OACb,CAAC,CACH,CAAC,CCjBF,eAAsB,EAEpB,CACE,sBACA,mBACA,YACA,OACA,aACA,eAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAMtC,MAAM,EAAe,CACnB,sBACA,mBACA,YANkB,EAAQ,EAAM,EAMrB,CACX,YACA,cACA,aAAc,EACf,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./skipRequestDataSilos-CjaWLHRh.mjs";import{t}from"./done-input-validation-D25TzrxG.mjs";async function n({auth:n,dataSiloId:r,status:i,statuses:a,transcendUrl:o,actionTypes:s}){t(this.process.exit),await e({transcendUrl:o,auth:n,status:i,dataSiloId:r,requestStatuses:a,actionTypes:s})}export{n as skipRequestDataSilos};
2
- //# sourceMappingURL=impl-BM0EEvkt.mjs.map
1
+ import{t as e}from"./skipRequestDataSilos-BriqhLT3.mjs";import{t}from"./done-input-validation-D25TzrxG.mjs";async function n({auth:n,dataSiloId:r,status:i,statuses:a,transcendUrl:o,actionTypes:s}){t(this.process.exit),await e({transcendUrl:o,auth:n,status:i,dataSiloId:r,requestStatuses:a,actionTypes:s})}export{n as skipRequestDataSilos};
2
+ //# sourceMappingURL=impl-DQH1CGup.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-BM0EEvkt.mjs","names":["skipRequestDataSilosHelper"],"sources":["../src/commands/request/system/skip-request-data-silos/impl.ts"],"sourcesContent":["import type {\n RequestAction,\n RequestDataSiloStatus,\n RequestStatus,\n} from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { skipRequestDataSilos as skipRequestDataSilosHelper } from '../../../../lib/requests/index.js';\n\nexport interface SkipRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n transcendUrl: string;\n statuses: RequestStatus[];\n status: (typeof RequestDataSiloStatus)['Skipped'] | (typeof RequestDataSiloStatus)['Resolved'];\n actionTypes?: RequestAction[];\n}\n\nexport async function skipRequestDataSilos(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n status,\n statuses,\n transcendUrl,\n actionTypes,\n }: SkipRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await skipRequestDataSilosHelper({\n transcendUrl,\n auth,\n status,\n dataSiloId,\n requestStatuses: statuses,\n actionTypes,\n });\n}\n"],"mappings":"4GAmBA,eAAsB,EAEpB,CACE,OACA,aACA,SACA,WACA,eACA,eAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAA2B,CAC/B,eACA,OACA,SACA,aACA,gBAAiB,EACjB,cACD,CAAC"}
1
+ {"version":3,"file":"impl-DQH1CGup.mjs","names":["skipRequestDataSilosHelper"],"sources":["../src/commands/request/system/skip-request-data-silos/impl.ts"],"sourcesContent":["import type {\n RequestAction,\n RequestDataSiloStatus,\n RequestStatus,\n} from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { skipRequestDataSilos as skipRequestDataSilosHelper } from '../../../../lib/requests/index.js';\n\nexport interface SkipRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n transcendUrl: string;\n statuses: RequestStatus[];\n status: (typeof RequestDataSiloStatus)['Skipped'] | (typeof RequestDataSiloStatus)['Resolved'];\n actionTypes?: RequestAction[];\n}\n\nexport async function skipRequestDataSilos(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n status,\n statuses,\n transcendUrl,\n actionTypes,\n }: SkipRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await skipRequestDataSilosHelper({\n transcendUrl,\n auth,\n status,\n dataSiloId,\n requestStatuses: statuses,\n actionTypes,\n });\n}\n"],"mappings":"4GAmBA,eAAsB,EAEpB,CACE,OACA,aACA,SACA,WACA,eACA,eAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAA2B,CAC/B,eACA,OACA,SACA,aACA,gBAAiB,EACjB,cACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./skipPreflightJobs-BBfI9gnC.mjs";import{t}from"./done-input-validation-D25TzrxG.mjs";async function n({auth:n,transcendUrl:r,enricherIds:i}){t(this.process.exit),await e({transcendUrl:r,auth:n,enricherIds:i})}export{n as skipPreflightJobs};
2
- //# sourceMappingURL=impl-5pww5SHw.mjs.map
1
+ import{t as e}from"./skipPreflightJobs-xVBZC-iI.mjs";import{t}from"./done-input-validation-D25TzrxG.mjs";async function n({auth:n,transcendUrl:r,enricherIds:i}){t(this.process.exit),await e({transcendUrl:r,auth:n,enricherIds:i})}export{n as skipPreflightJobs};
2
+ //# sourceMappingURL=impl-DTDnN3Hn.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-5pww5SHw.mjs","names":["skipPreflightJobsHelper"],"sources":["../src/commands/request/skip-preflight-jobs/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { skipPreflightJobs as skipPreflightJobsHelper } from '../../../lib/requests/index.js';\n\nexport interface SkipPreflightJobsCommandFlags {\n auth: string;\n enricherIds: string[];\n transcendUrl: string;\n}\n\nexport async function skipPreflightJobs(\n this: LocalContext,\n { auth, transcendUrl, enricherIds }: SkipPreflightJobsCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await skipPreflightJobsHelper({\n transcendUrl,\n auth,\n enricherIds,\n });\n}\n"],"mappings":"yGAUA,eAAsB,EAEpB,CAAE,OAAM,eAAc,eACP,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAAwB,CAC5B,eACA,OACA,cACD,CAAC"}
1
+ {"version":3,"file":"impl-DTDnN3Hn.mjs","names":["skipPreflightJobsHelper"],"sources":["../src/commands/request/skip-preflight-jobs/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { skipPreflightJobs as skipPreflightJobsHelper } from '../../../lib/requests/index.js';\n\nexport interface SkipPreflightJobsCommandFlags {\n auth: string;\n enricherIds: string[];\n transcendUrl: string;\n}\n\nexport async function skipPreflightJobs(\n this: LocalContext,\n { auth, transcendUrl, enricherIds }: SkipPreflightJobsCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await skipPreflightJobsHelper({\n transcendUrl,\n auth,\n enricherIds,\n });\n}\n"],"mappings":"yGAUA,eAAsB,EAEpB,CAAE,OAAM,eAAc,eACP,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAAwB,CAC5B,eACA,OACA,cACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{l as e}from"./constants-Co8rkELu.mjs";import{t}from"./generateCrossAccountApiKeys-JvTpNM7h.mjs";import{t as n}from"./done-input-validation-D25TzrxG.mjs";import{writeFileSync as r}from"node:fs";async function i({email:i,password:a,apiKeyTitle:o,file:s,scopes:c,deleteExistingApiKey:l,createNewApiKey:u,parentOrganizationId:d,transcendUrl:f}){n(this.process.exit);let{errors:p,apiKeys:m}=await t({transcendUrl:f,password:a,email:i,parentOrganizationId:d,deleteExistingApiKey:l,createNewApiKey:u,apiKeyTitle:o,scopes:c.map(t=>e[t].name)});r(s,`${JSON.stringify(m,null,2)}\n`),p.length>0&&this.process.exit(1)}export{i as generateApiKeys};
2
- //# sourceMappingURL=impl-Cih-nyPz.mjs.map
1
+ import{l as e}from"./constants-B7bW_WN2.mjs";import{t}from"./generateCrossAccountApiKeys-kqzneWII.mjs";import{t as n}from"./done-input-validation-D25TzrxG.mjs";import{writeFileSync as r}from"node:fs";async function i({email:i,password:a,apiKeyTitle:o,file:s,scopes:c,deleteExistingApiKey:l,createNewApiKey:u,parentOrganizationId:d,transcendUrl:f}){n(this.process.exit);let{errors:p,apiKeys:m}=await t({transcendUrl:f,password:a,email:i,parentOrganizationId:d,deleteExistingApiKey:l,createNewApiKey:u,apiKeyTitle:o,scopes:c.map(t=>e[t].name)});r(s,`${JSON.stringify(m,null,2)}\n`),p.length>0&&this.process.exit(1)}export{i as generateApiKeys};
2
+ //# sourceMappingURL=impl-DYsJKLfp.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-Cih-nyPz.mjs","names":[],"sources":["../src/commands/admin/generate-api-keys/impl.ts"],"sourcesContent":["import { writeFileSync } from 'node:fs';\n\nimport { ScopeName } from '@transcend-io/privacy-types';\n\nimport { SCOPES_BY_TITLE } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { generateCrossAccountApiKeys } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\n\n// Command flag interface\nexport interface GenerateApiKeysCommandFlags {\n email: string;\n password: string;\n apiKeyTitle: string;\n file: string;\n scopes: string[];\n deleteExistingApiKey: boolean;\n createNewApiKey: boolean;\n parentOrganizationId?: string;\n transcendUrl: string;\n}\n\n// Command implementation\nexport async function generateApiKeys(\n this: LocalContext,\n {\n email,\n password,\n apiKeyTitle,\n file,\n scopes,\n deleteExistingApiKey,\n createNewApiKey,\n parentOrganizationId,\n transcendUrl,\n }: GenerateApiKeysCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const scopeNames = scopes.map((scopeTitle) => SCOPES_BY_TITLE[scopeTitle].name as ScopeName);\n\n // Upload privacy requests\n const { errors, apiKeys } = await generateCrossAccountApiKeys({\n transcendUrl,\n password,\n email,\n parentOrganizationId,\n deleteExistingApiKey,\n createNewApiKey,\n apiKeyTitle,\n scopes: scopeNames,\n });\n\n // Write to disk\n writeFileSync(file, `${JSON.stringify(apiKeys, null, 2)}\\n`);\n if (errors.length > 0) {\n this.process.exit(1);\n }\n}\n"],"mappings":"wMAuBA,eAAsB,EAEpB,CACE,QACA,WACA,cACA,OACA,SACA,uBACA,kBACA,uBACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAKtC,GAAM,CAAE,SAAQ,WAAY,MAAM,EAA4B,CAC5D,eACA,WACA,QACA,uBACA,uBACA,kBACA,cACA,OAXiB,EAAO,IAAK,GAAe,EAAgB,GAAY,KAWtD,CACnB,CAAC,CAGF,EAAc,EAAM,GAAG,KAAK,UAAU,EAAS,KAAM,EAAE,CAAC,IAAI,CACxD,EAAO,OAAS,GAClB,KAAK,QAAQ,KAAK,EAAE"}
1
+ {"version":3,"file":"impl-DYsJKLfp.mjs","names":[],"sources":["../src/commands/admin/generate-api-keys/impl.ts"],"sourcesContent":["import { writeFileSync } from 'node:fs';\n\nimport { ScopeName } from '@transcend-io/privacy-types';\n\nimport { SCOPES_BY_TITLE } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { generateCrossAccountApiKeys } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\n\n// Command flag interface\nexport interface GenerateApiKeysCommandFlags {\n email: string;\n password: string;\n apiKeyTitle: string;\n file: string;\n scopes: string[];\n deleteExistingApiKey: boolean;\n createNewApiKey: boolean;\n parentOrganizationId?: string;\n transcendUrl: string;\n}\n\n// Command implementation\nexport async function generateApiKeys(\n this: LocalContext,\n {\n email,\n password,\n apiKeyTitle,\n file,\n scopes,\n deleteExistingApiKey,\n createNewApiKey,\n parentOrganizationId,\n transcendUrl,\n }: GenerateApiKeysCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const scopeNames = scopes.map((scopeTitle) => SCOPES_BY_TITLE[scopeTitle].name as ScopeName);\n\n // Upload privacy requests\n const { errors, apiKeys } = await generateCrossAccountApiKeys({\n transcendUrl,\n password,\n email,\n parentOrganizationId,\n deleteExistingApiKey,\n createNewApiKey,\n apiKeyTitle,\n scopes: scopeNames,\n });\n\n // Write to disk\n writeFileSync(file, `${JSON.stringify(apiKeys, null, 2)}\\n`);\n if (errors.length > 0) {\n this.process.exit(1);\n }\n}\n"],"mappings":"wMAuBA,eAAsB,EAEpB,CACE,QACA,WACA,cACA,OACA,SACA,uBACA,kBACA,uBACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAKtC,GAAM,CAAE,SAAQ,WAAY,MAAM,EAA4B,CAC5D,eACA,WACA,QACA,uBACA,uBACA,kBACA,cACA,OAXiB,EAAO,IAAK,GAAe,EAAgB,GAAY,KAWtD,CACnB,CAAC,CAGF,EAAc,EAAM,GAAG,KAAK,UAAU,EAAS,KAAM,EAAE,CAAC,IAAI,CACxD,EAAO,OAAS,GAClB,KAAK,QAAQ,KAAK,EAAE"}
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./logger-D1tXVwJj.mjs";import{t}from"./done-input-validation-D25TzrxG.mjs";import{n,t as r}from"./printResult-BE0CcmNZ.mjs";import{t as i}from"./renderTable-BzIh5FoT.mjs";import{t as a}from"./resolveBundleIdByName-Bxoxa8CK.mjs";import o from"colors";async function s({"bundle-name":s,auth:c,"transcend-url":l,limit:u,after:d,json:f}){t(this.process.exit);let p=n(l,c),m=await a(p,s);if(!m)throw Error(`Policy bundle "${s}" was not found for this organization.`);e.info(o.green(`Listing versions for bundle "${s}"...`));let h={limit:u};d&&(h.after=d);let g=await p.get(`v1/policy-engine/policy-bundles/${m}/versions`,{searchParams:h}).json();r(this.process.stdout,{json:f,data:g,renderTable:()=>{if(g.nodes.length===0)return`No versions found for bundle "${s}".`;let e=i([`id`,`version`,`createdAt`,`activatedAt`,`deactivatedAt`],g.nodes.map(e=>[e.id,e.version,e.createdAt,e.activatedAt??`-`,e.deactivatedAt??`-`]));return g.pageInfo.endCursor&&(e+=`\n\nafter: ${g.pageInfo.endCursor}`),e}})}export{s as versions};
2
+ //# sourceMappingURL=impl-DiRx33sh.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl-DiRx33sh.mjs","names":[],"sources":["../src/commands/policy/versions/impl.ts"],"sourcesContent":["import colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { logger } from '../../../logger.js';\nimport { EMPTY_CELL } from '../constants.js';\nimport {\n buildPolicyEngineClient,\n printResult,\n renderTable,\n resolveBundleIdByName,\n} from '../helpers/index.js';\nimport type { PolicyBundleVersionListResponse } from '../types.js';\n\n/** CLI flags for `transcend policy versions`. */\nexport interface VersionsCommandFlags {\n /** Tenant-unique bundle name */\n 'bundle-name': string;\n /** Transcend API key */\n auth: string;\n /** Transcend API URL */\n 'transcend-url': string;\n /** Page size */\n limit: number;\n /** Cursor from a previous page's pageInfo.endCursor */\n after?: string;\n /** Print raw JSON response */\n json: boolean;\n}\n\n/**\n * List versions for a policy bundle.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function versions(\n this: LocalContext,\n {\n 'bundle-name': bundleName,\n auth,\n 'transcend-url': transcendUrl,\n limit,\n after,\n json,\n }: VersionsCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const client = buildPolicyEngineClient(transcendUrl, auth);\n const bundleId = await resolveBundleIdByName(client, bundleName);\n\n if (!bundleId) {\n throw new Error(`Policy bundle \"${bundleName}\" was not found for this organization.`);\n }\n\n logger.info(colors.green(`Listing versions for bundle \"${bundleName}\"...`));\n\n const searchParams: Record<string, string | number> = { limit };\n if (after) {\n searchParams.after = after;\n }\n\n const body = await client\n .get(`v1/policy-engine/policy-bundles/${bundleId}/versions`, {\n searchParams,\n })\n .json<PolicyBundleVersionListResponse>();\n\n printResult(this.process.stdout, {\n json,\n data: body,\n renderTable: () => {\n if (body.nodes.length === 0) {\n return `No versions found for bundle \"${bundleName}\".`;\n }\n\n const rows = body.nodes.map((version) => [\n version.id,\n version.version,\n version.createdAt,\n version.activatedAt ?? EMPTY_CELL,\n version.deactivatedAt ?? EMPTY_CELL,\n ]);\n\n let table = renderTable(['id', 'version', 'createdAt', 'activatedAt', 'deactivatedAt'], rows);\n if (body.pageInfo.endCursor) {\n table += `\\n\\nafter: ${body.pageInfo.endCursor}`;\n }\n return table;\n },\n });\n}\n"],"mappings":"6QAoCA,eAAsB,EAEpB,CACE,cAAe,EACf,OACA,gBAAiB,EACjB,QACA,QACA,QAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,IAAM,EAAS,EAAwB,EAAc,EAAK,CACpD,EAAW,MAAM,EAAsB,EAAQ,EAAW,CAEhE,GAAI,CAAC,EACH,MAAU,MAAM,kBAAkB,EAAW,wCAAwC,CAGvF,EAAO,KAAK,EAAO,MAAM,gCAAgC,EAAW,MAAM,CAAC,CAE3E,IAAM,EAAgD,CAAE,QAAO,CAC3D,IACF,EAAa,MAAQ,GAGvB,IAAM,EAAO,MAAM,EAChB,IAAI,mCAAmC,EAAS,WAAY,CAC3D,eACD,CAAC,CACD,MAAuC,CAE1C,EAAY,KAAK,QAAQ,OAAQ,CAC/B,OACA,KAAM,EACN,gBAAmB,CACjB,GAAI,EAAK,MAAM,SAAW,EACxB,MAAO,iCAAiC,EAAW,IAWrD,IAAI,EAAQ,EAAY,CAAC,KAAM,UAAW,YAAa,cAAe,gBAAgB,CARzE,EAAK,MAAM,IAAK,GAAY,CACvC,EAAQ,GACR,EAAQ,QACR,EAAQ,UACR,EAAQ,aAAA,IACR,EAAQ,eAAA,IACT,CAE2F,CAAC,CAI7F,OAHI,EAAK,SAAS,YAChB,GAAS,cAAc,EAAK,SAAS,aAEhC,GAEV,CAAC"}