@transcend-io/cli 7.0.0-alpha.13 → 7.0.0-alpha.14

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 (272) hide show
  1. package/dist/bin/bash-complete.cjs +4 -0
  2. package/dist/bin/bash-complete.cjs.map +1 -0
  3. package/dist/bin/cli.cjs +3 -0
  4. package/dist/bin/cli.cjs.map +1 -0
  5. package/dist/bin/deprecated-command.cjs +7 -0
  6. package/dist/bin/deprecated-command.cjs.map +1 -0
  7. package/dist/chunk-2KP53GQ4.cjs +2 -0
  8. package/dist/chunk-2KP53GQ4.cjs.map +1 -0
  9. package/dist/chunk-2VOZMXOE.cjs +2 -0
  10. package/dist/chunk-2VOZMXOE.cjs.map +1 -0
  11. package/dist/chunk-7OIWW7TJ.cjs +3 -0
  12. package/dist/chunk-7OIWW7TJ.cjs.map +1 -0
  13. package/dist/chunk-7R7EIHBR.cjs +4 -0
  14. package/dist/chunk-7R7EIHBR.cjs.map +1 -0
  15. package/dist/chunk-BN4LSJ6U.cjs +75 -0
  16. package/dist/chunk-BN4LSJ6U.cjs.map +1 -0
  17. package/dist/chunk-BY7W4UQF.cjs +2 -0
  18. package/dist/chunk-BY7W4UQF.cjs.map +1 -0
  19. package/dist/chunk-EG4L6YAJ.cjs +2 -0
  20. package/dist/chunk-EG4L6YAJ.cjs.map +1 -0
  21. package/dist/chunk-IBTP5OXE.cjs +2 -0
  22. package/dist/chunk-IBTP5OXE.cjs.map +1 -0
  23. package/dist/chunk-KOV2SQO2.cjs +4 -0
  24. package/dist/chunk-KOV2SQO2.cjs.map +1 -0
  25. package/dist/chunk-KR377AJU.cjs +2 -0
  26. package/dist/chunk-KR377AJU.cjs.map +1 -0
  27. package/dist/chunk-LYJU4HTN.cjs +12 -0
  28. package/dist/chunk-LYJU4HTN.cjs.map +1 -0
  29. package/dist/chunk-M5CAIOD3.cjs +94 -0
  30. package/dist/chunk-M5CAIOD3.cjs.map +1 -0
  31. package/dist/chunk-OVMPZ75R.cjs +9 -0
  32. package/dist/chunk-OVMPZ75R.cjs.map +1 -0
  33. package/dist/chunk-S6XB2PPW.cjs +2 -0
  34. package/dist/chunk-S6XB2PPW.cjs.map +1 -0
  35. package/dist/chunk-SAEKBZGF.cjs +2 -0
  36. package/dist/chunk-SAEKBZGF.cjs.map +1 -0
  37. package/dist/chunk-SJFPYDA3.cjs +2844 -0
  38. package/dist/chunk-SJFPYDA3.cjs.map +1 -0
  39. package/dist/chunk-T462ONFX.cjs +2 -0
  40. package/dist/chunk-T462ONFX.cjs.map +1 -0
  41. package/dist/chunk-TD7ADMVO.cjs +2 -0
  42. package/dist/chunk-TD7ADMVO.cjs.map +1 -0
  43. package/dist/chunk-TEOKGAUX.cjs +2 -0
  44. package/dist/chunk-TEOKGAUX.cjs.map +1 -0
  45. package/dist/chunk-UEGX6GZ2.cjs +2 -0
  46. package/dist/chunk-UEGX6GZ2.cjs.map +1 -0
  47. package/dist/chunk-UJ3GGOXX.cjs +2 -0
  48. package/dist/chunk-UJ3GGOXX.cjs.map +1 -0
  49. package/dist/chunk-WJOUZOWG.cjs +2 -0
  50. package/dist/chunk-WJOUZOWG.cjs.map +1 -0
  51. package/dist/chunk-ZUNVPK23.cjs +2 -0
  52. package/dist/chunk-ZUNVPK23.cjs.map +1 -0
  53. package/dist/chunk-ZVK4HIDF.cjs +6 -0
  54. package/dist/chunk-ZVK4HIDF.cjs.map +1 -0
  55. package/dist/impl-2SN5YDRH.cjs +2 -0
  56. package/dist/impl-2SN5YDRH.cjs.map +1 -0
  57. package/dist/impl-3I4OWVXR.cjs +2 -0
  58. package/dist/impl-3I4OWVXR.cjs.map +1 -0
  59. package/dist/impl-3LMOJYBH.cjs +12 -0
  60. package/dist/impl-3LMOJYBH.cjs.map +1 -0
  61. package/dist/impl-3YHSKGUJ.cjs +2 -0
  62. package/dist/impl-3YHSKGUJ.cjs.map +1 -0
  63. package/dist/impl-52FGKXAZ.cjs +2 -0
  64. package/dist/impl-52FGKXAZ.cjs.map +1 -0
  65. package/dist/impl-5RR2U3JB.cjs +2 -0
  66. package/dist/impl-5RR2U3JB.cjs.map +1 -0
  67. package/dist/impl-5RZU3UFR.cjs +2 -0
  68. package/dist/impl-5RZU3UFR.cjs.map +1 -0
  69. package/dist/impl-D3QIM2F5.cjs +6 -0
  70. package/dist/impl-D3QIM2F5.cjs.map +1 -0
  71. package/dist/impl-EEJLOKOB.cjs +2 -0
  72. package/dist/impl-EEJLOKOB.cjs.map +1 -0
  73. package/dist/impl-F4GF3HZA.cjs +4 -0
  74. package/dist/impl-F4GF3HZA.cjs.map +1 -0
  75. package/dist/impl-G4YYMDLF.cjs +2 -0
  76. package/dist/impl-G4YYMDLF.cjs.map +1 -0
  77. package/dist/impl-HZ3GZ27V.cjs +2 -0
  78. package/dist/impl-HZ3GZ27V.cjs.map +1 -0
  79. package/dist/impl-IM6QUIT4.cjs +2 -0
  80. package/dist/impl-IM6QUIT4.cjs.map +1 -0
  81. package/dist/impl-IXWUVITA.cjs +2 -0
  82. package/dist/impl-IXWUVITA.cjs.map +1 -0
  83. package/dist/impl-K7GA5QKG.cjs +2 -0
  84. package/dist/impl-K7GA5QKG.cjs.map +1 -0
  85. package/dist/impl-KGQLSJUR.cjs +2 -0
  86. package/dist/impl-KGQLSJUR.cjs.map +1 -0
  87. package/dist/impl-L4HV2OLG.cjs +2 -0
  88. package/dist/impl-L4HV2OLG.cjs.map +1 -0
  89. package/dist/impl-LF3E7RUO.cjs +2 -0
  90. package/dist/impl-LF3E7RUO.cjs.map +1 -0
  91. package/dist/impl-LKSVKY5Q.cjs +2 -0
  92. package/dist/impl-LKSVKY5Q.cjs.map +1 -0
  93. package/dist/impl-MMOETZJ5.cjs +2 -0
  94. package/dist/impl-MMOETZJ5.cjs.map +1 -0
  95. package/dist/impl-NQUYS45J.cjs +2 -0
  96. package/dist/impl-NQUYS45J.cjs.map +1 -0
  97. package/dist/impl-OBKI4AA3.cjs +2 -0
  98. package/dist/impl-OBKI4AA3.cjs.map +1 -0
  99. package/dist/impl-OJB6DGP4.cjs +2 -0
  100. package/dist/impl-OJB6DGP4.cjs.map +1 -0
  101. package/dist/impl-OT54IN7O.cjs +7 -0
  102. package/dist/impl-OT54IN7O.cjs.map +1 -0
  103. package/dist/impl-OWHAFIWY.cjs +2 -0
  104. package/dist/impl-OWHAFIWY.cjs.map +1 -0
  105. package/dist/impl-P3MQ53VI.cjs +6 -0
  106. package/dist/{impl-CCUCFOCW.js.map → impl-P3MQ53VI.cjs.map} +1 -1
  107. package/dist/impl-P75VZVME.cjs +2 -0
  108. package/dist/impl-P75VZVME.cjs.map +1 -0
  109. package/dist/impl-PKVWUYYX.cjs +2 -0
  110. package/dist/impl-PKVWUYYX.cjs.map +1 -0
  111. package/dist/impl-QAAZKKZI.cjs +2 -0
  112. package/dist/impl-QAAZKKZI.cjs.map +1 -0
  113. package/dist/impl-RJ7D4TDU.cjs +2 -0
  114. package/dist/impl-RJ7D4TDU.cjs.map +1 -0
  115. package/dist/impl-RUSYHPJG.cjs +2 -0
  116. package/dist/impl-RUSYHPJG.cjs.map +1 -0
  117. package/dist/impl-WF5WVI2N.cjs +2 -0
  118. package/dist/impl-WF5WVI2N.cjs.map +1 -0
  119. package/dist/impl-XKTX4RSJ.cjs +2 -0
  120. package/dist/impl-XKTX4RSJ.cjs.map +1 -0
  121. package/dist/impl-XUC6HWEZ.cjs +2 -0
  122. package/dist/impl-XUC6HWEZ.cjs.map +1 -0
  123. package/dist/impl-Y2DSR6T2.cjs +2 -0
  124. package/dist/impl-Y2DSR6T2.cjs.map +1 -0
  125. package/dist/impl-YLHGBEOH.cjs +2 -0
  126. package/dist/impl-YLHGBEOH.cjs.map +1 -0
  127. package/dist/impl-YNXTKFTC.cjs +2 -0
  128. package/dist/impl-YNXTKFTC.cjs.map +1 -0
  129. package/dist/impl-Z5WKVIBW.cjs +6 -0
  130. package/dist/impl-Z5WKVIBW.cjs.map +1 -0
  131. package/dist/impl-ZKSARENR.cjs +9 -0
  132. package/dist/impl-ZKSARENR.cjs.map +1 -0
  133. package/dist/index.cjs +5 -0
  134. package/dist/index.cjs.map +1 -0
  135. package/dist/{index.d.ts → index.d.cts} +1 -1
  136. package/package.json +48 -45
  137. package/dist/bin/bash-complete.js +0 -4
  138. package/dist/bin/bash-complete.js.map +0 -1
  139. package/dist/bin/cli.js +0 -3
  140. package/dist/bin/cli.js.map +0 -1
  141. package/dist/bin/deprecated-command.js +0 -7
  142. package/dist/bin/deprecated-command.js.map +0 -1
  143. package/dist/chunk-24SSWBXM.js +0 -4
  144. package/dist/chunk-24SSWBXM.js.map +0 -1
  145. package/dist/chunk-347UQP43.js +0 -2
  146. package/dist/chunk-347UQP43.js.map +0 -1
  147. package/dist/chunk-43JWXG77.js +0 -2
  148. package/dist/chunk-43JWXG77.js.map +0 -1
  149. package/dist/chunk-4GLITB3Y.js +0 -2
  150. package/dist/chunk-4GLITB3Y.js.map +0 -1
  151. package/dist/chunk-6P4FW6XR.js +0 -3
  152. package/dist/chunk-6P4FW6XR.js.map +0 -1
  153. package/dist/chunk-72U6ETHG.js +0 -2
  154. package/dist/chunk-72U6ETHG.js.map +0 -1
  155. package/dist/chunk-7QHA6ZIV.js +0 -2
  156. package/dist/chunk-7QHA6ZIV.js.map +0 -1
  157. package/dist/chunk-ARVEJERC.js +0 -2
  158. package/dist/chunk-ARVEJERC.js.map +0 -1
  159. package/dist/chunk-CBAHSBSW.js +0 -2
  160. package/dist/chunk-CBAHSBSW.js.map +0 -1
  161. package/dist/chunk-HH2PQ3PQ.js +0 -2
  162. package/dist/chunk-HH2PQ3PQ.js.map +0 -1
  163. package/dist/chunk-INLBXSQE.js +0 -9
  164. package/dist/chunk-INLBXSQE.js.map +0 -1
  165. package/dist/chunk-KRN6Q433.js +0 -75
  166. package/dist/chunk-KRN6Q433.js.map +0 -1
  167. package/dist/chunk-L5ULN3IT.js +0 -2
  168. package/dist/chunk-L5ULN3IT.js.map +0 -1
  169. package/dist/chunk-L7ZIX4SU.js +0 -2
  170. package/dist/chunk-L7ZIX4SU.js.map +0 -1
  171. package/dist/chunk-LAYHULHH.js +0 -2
  172. package/dist/chunk-LAYHULHH.js.map +0 -1
  173. package/dist/chunk-MA4JWWRO.js +0 -6
  174. package/dist/chunk-MA4JWWRO.js.map +0 -1
  175. package/dist/chunk-MVDOKJ6J.js +0 -2
  176. package/dist/chunk-MVDOKJ6J.js.map +0 -1
  177. package/dist/chunk-OEB7WG3G.js +0 -4
  178. package/dist/chunk-OEB7WG3G.js.map +0 -1
  179. package/dist/chunk-SF46ZLPT.js +0 -2
  180. package/dist/chunk-SF46ZLPT.js.map +0 -1
  181. package/dist/chunk-TDBKATQK.js +0 -2831
  182. package/dist/chunk-TDBKATQK.js.map +0 -1
  183. package/dist/chunk-WSDWILYI.js +0 -2
  184. package/dist/chunk-WSDWILYI.js.map +0 -1
  185. package/dist/chunk-XNR74SBS.js +0 -12
  186. package/dist/chunk-XNR74SBS.js.map +0 -1
  187. package/dist/chunk-ZLRUIEVQ.js +0 -94
  188. package/dist/chunk-ZLRUIEVQ.js.map +0 -1
  189. package/dist/chunk-ZTD7APNF.js +0 -2
  190. package/dist/chunk-ZTD7APNF.js.map +0 -1
  191. package/dist/impl-25VWUB6L.js +0 -2
  192. package/dist/impl-25VWUB6L.js.map +0 -1
  193. package/dist/impl-3M5R6G5M.js +0 -6
  194. package/dist/impl-3M5R6G5M.js.map +0 -1
  195. package/dist/impl-5OEPVWPL.js +0 -2
  196. package/dist/impl-5OEPVWPL.js.map +0 -1
  197. package/dist/impl-5YV7K446.js +0 -2
  198. package/dist/impl-5YV7K446.js.map +0 -1
  199. package/dist/impl-AFRHPZGF.js +0 -2
  200. package/dist/impl-AFRHPZGF.js.map +0 -1
  201. package/dist/impl-CCUCFOCW.js +0 -6
  202. package/dist/impl-E36SWF4Z.js +0 -2
  203. package/dist/impl-E36SWF4Z.js.map +0 -1
  204. package/dist/impl-E5WXNV47.js +0 -2
  205. package/dist/impl-E5WXNV47.js.map +0 -1
  206. package/dist/impl-EVICJMI3.js +0 -2
  207. package/dist/impl-EVICJMI3.js.map +0 -1
  208. package/dist/impl-G5TGSB4H.js +0 -2
  209. package/dist/impl-G5TGSB4H.js.map +0 -1
  210. package/dist/impl-GNG2DOKG.js +0 -2
  211. package/dist/impl-GNG2DOKG.js.map +0 -1
  212. package/dist/impl-GNSHZ3OL.js +0 -2
  213. package/dist/impl-GNSHZ3OL.js.map +0 -1
  214. package/dist/impl-GPCURY4M.js +0 -7
  215. package/dist/impl-GPCURY4M.js.map +0 -1
  216. package/dist/impl-GZRQOFY6.js +0 -2
  217. package/dist/impl-GZRQOFY6.js.map +0 -1
  218. package/dist/impl-HEC3SVYP.js +0 -2
  219. package/dist/impl-HEC3SVYP.js.map +0 -1
  220. package/dist/impl-HH24GIMG.js +0 -2
  221. package/dist/impl-HH24GIMG.js.map +0 -1
  222. package/dist/impl-I24OLEN5.js +0 -2
  223. package/dist/impl-I24OLEN5.js.map +0 -1
  224. package/dist/impl-IAXNYDJT.js +0 -2
  225. package/dist/impl-IAXNYDJT.js.map +0 -1
  226. package/dist/impl-J33PI3PK.js +0 -2
  227. package/dist/impl-J33PI3PK.js.map +0 -1
  228. package/dist/impl-JZDUGI7W.js +0 -2
  229. package/dist/impl-JZDUGI7W.js.map +0 -1
  230. package/dist/impl-LZ3HI26W.js +0 -4
  231. package/dist/impl-LZ3HI26W.js.map +0 -1
  232. package/dist/impl-MEDPDKAE.js +0 -2
  233. package/dist/impl-MEDPDKAE.js.map +0 -1
  234. package/dist/impl-MLS6TI7N.js +0 -2
  235. package/dist/impl-MLS6TI7N.js.map +0 -1
  236. package/dist/impl-NI7KSBSS.js +0 -2
  237. package/dist/impl-NI7KSBSS.js.map +0 -1
  238. package/dist/impl-OM6EKANE.js +0 -9
  239. package/dist/impl-OM6EKANE.js.map +0 -1
  240. package/dist/impl-T4WDJSWZ.js +0 -2
  241. package/dist/impl-T4WDJSWZ.js.map +0 -1
  242. package/dist/impl-U37YTCPW.js +0 -2
  243. package/dist/impl-U37YTCPW.js.map +0 -1
  244. package/dist/impl-U5555HGJ.js +0 -12
  245. package/dist/impl-U5555HGJ.js.map +0 -1
  246. package/dist/impl-UHFSVVIS.js +0 -6
  247. package/dist/impl-UHFSVVIS.js.map +0 -1
  248. package/dist/impl-UIVTSO57.js +0 -2
  249. package/dist/impl-UIVTSO57.js.map +0 -1
  250. package/dist/impl-UQYL5PXR.js +0 -2
  251. package/dist/impl-UQYL5PXR.js.map +0 -1
  252. package/dist/impl-V5QTKTU4.js +0 -2
  253. package/dist/impl-V5QTKTU4.js.map +0 -1
  254. package/dist/impl-WDPWOOFV.js +0 -2
  255. package/dist/impl-WDPWOOFV.js.map +0 -1
  256. package/dist/impl-WZAF2LD3.js +0 -2
  257. package/dist/impl-WZAF2LD3.js.map +0 -1
  258. package/dist/impl-XF26H3HG.js +0 -2
  259. package/dist/impl-XF26H3HG.js.map +0 -1
  260. package/dist/impl-XQY2Q5R6.js +0 -2
  261. package/dist/impl-XQY2Q5R6.js.map +0 -1
  262. package/dist/impl-YB2LON7S.js +0 -2
  263. package/dist/impl-YB2LON7S.js.map +0 -1
  264. package/dist/impl-YNGQIWW7.js +0 -2
  265. package/dist/impl-YNGQIWW7.js.map +0 -1
  266. package/dist/impl-ZA3PKNQN.js +0 -2
  267. package/dist/impl-ZA3PKNQN.js.map +0 -1
  268. package/dist/index.js +0 -5
  269. package/dist/index.js.map +0 -1
  270. /package/dist/bin/{bash-complete.d.ts → bash-complete.d.cts} +0 -0
  271. /package/dist/bin/{cli.d.ts → cli.d.cts} +0 -0
  272. /package/dist/bin/{deprecated-command.d.ts → deprecated-command.d.cts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/impl-OT54IN7O.cjs","../src/commands/migration/sync-ot/impl.ts","../src/lib/oneTrust/createOneTrustGotInstance.ts","../src/lib/oneTrust/helpers/oneTrustAssessmentToJson.ts","../src/lib/oneTrust/endpoints/getListOfOneTrustAssessments.ts","../src/lib/oneTrust/helpers/syncOneTrustAssessmentToTranscend.ts","../src/lib/oneTrust/helpers/syncOneTrustAssessmentsFromOneTrust.ts"],"names":["createOneTrustGotInstance","hostname","auth","got","logger"],"mappings":"AAAA,y0BAAuF,wDAAoC,gCAA6B,wDAAyC,gFCE9K,oECFM,IAQZA,CAAAA,CAA4B,CAAC,CACxC,QAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CACF,CAAA,CAAA,EAMEC,aAAAA,CAAI,MAAA,CAAO,CACT,SAAA,CAAW,CAAA,QAAA,EAAWF,CAAQ,CAAA,CAAA;ACiBwB;AAIzC;ACrCR,CAAA;ACyEoF,mBAAA;ACArFG","file":"/Users/benbrook/transcend/cli/dist/impl-OT54IN7O.cjs","sourcesContent":[null,"import type { LocalContext } from '@/context';\nimport { logger } from '@/logger';\nimport colors from 'colors';\nimport { createOneTrustGotInstance } from '@/lib/oneTrust';\nimport {\n OneTrustFileFormat,\n OneTrustPullResource,\n OneTrustPullSource,\n} from '@/enums';\nimport { buildTranscendGraphQLClient } from '@/lib/graphql';\nimport {\n syncOneTrustAssessmentsFromFile,\n syncOneTrustAssessmentsFromOneTrust,\n} from '@/lib/oneTrust/helpers';\n\n// Command flag interface\ninterface SyncOtCommandFlags {\n hostname?: string;\n oneTrustAuth?: string;\n source: OneTrustPullSource;\n transcendAuth?: string;\n transcendUrl: string;\n file?: string;\n resource: OneTrustPullResource;\n dryRun: boolean;\n debug: boolean;\n}\n\n// Command implementation\nexport async function syncOt(\n this: LocalContext,\n {\n hostname,\n oneTrustAuth,\n source,\n transcendAuth,\n transcendUrl,\n resource,\n file,\n dryRun,\n debug,\n }: SyncOtCommandFlags,\n): Promise<void> {\n // Must be able to authenticate to transcend to sync resources to it\n if (!dryRun && !transcendAuth) {\n throw new Error(\n // eslint-disable-next-line no-template-curly-in-string\n 'Must specify a \"transcendAuth\" parameter to sync resources to Transcend. e.g. --transcendAuth=${TRANSCEND_API_KEY}',\n );\n }\n\n // If trying to sync to disk, must specify a file path\n if (dryRun && !file) {\n throw new Error(\n 'Must set a \"file\" parameter when \"dryRun\" is \"true\". e.g. --file=./oneTrustAssessments.json',\n );\n }\n\n if (file) {\n const splitFile = file.split('.');\n if (splitFile.length < 2) {\n throw new Error(\n 'The \"file\" parameter has an invalid format. Expected a path with extensions. e.g. --file=./pathToFile.json.',\n );\n }\n if (splitFile.at(-1) !== OneTrustFileFormat.Json) {\n throw new Error(\n `Expected the format of the \"file\" parameters '${file}' to be '${\n OneTrustFileFormat.Json\n }', but got '${splitFile.at(-1)}'.`,\n );\n }\n }\n\n // if reading assessments from a OneTrust\n if (source === OneTrustPullSource.OneTrust) {\n // must specify the OneTrust hostname\n if (!hostname) {\n throw new Error(\n 'Missing required parameter \"hostname\". e.g. --hostname=customer.my.onetrust.com',\n );\n }\n // must specify the OneTrust auth\n if (!oneTrustAuth) {\n throw new Error(\n 'Missing required parameter \"oneTrustAuth\". e.g. --oneTrustAuth=$ONE_TRUST_AUTH_TOKEN',\n );\n }\n } else {\n // if reading the assessments from a file, must specify a file to read from\n if (!file) {\n throw new Error(\n 'Must specify a \"file\" parameter to read the OneTrust assessments from. e.g. --source=./oneTrustAssessments.json',\n );\n }\n\n // Cannot try reading from file and save assessments to a file simultaneously\n if (dryRun) {\n throw new Error(\n 'Cannot read and write to a file simultaneously.' +\n ` Emit the \"source\" parameter or set it to ${OneTrustPullSource.OneTrust} if \"dryRun\" is enabled.`,\n );\n }\n }\n\n // instantiate a client to talk to OneTrust\n const oneTrust =\n hostname && oneTrustAuth\n ? createOneTrustGotInstance({\n hostname,\n auth: oneTrustAuth,\n })\n : undefined;\n\n // instantiate a client to talk to Transcend\n const transcend =\n transcendUrl && transcendAuth\n ? buildTranscendGraphQLClient(transcendUrl, transcendAuth)\n : undefined;\n\n try {\n if (resource === OneTrustPullResource.Assessments) {\n if (source === OneTrustPullSource.OneTrust && oneTrust) {\n await syncOneTrustAssessmentsFromOneTrust({\n oneTrust,\n file,\n dryRun,\n ...(transcend && { transcend }),\n });\n } else if (source === OneTrustPullSource.File && file && transcend) {\n await syncOneTrustAssessmentsFromFile({ file, transcend });\n }\n }\n } catch (err) {\n throw new Error(\n `An error occurred syncing the resource ${resource} from OneTrust: ${\n debug ? err.stack : err.message\n }`,\n );\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced OneTrust ${resource} to ${\n dryRun ? `disk at \"${file}\"` : 'Transcend'\n }!`,\n ),\n );\n}\n","import got, { Got } from 'got';\n\n/**\n * Instantiate an instance of got that is capable of making requests to OneTrust\n *\n * @param param - information about the OneTrust URL\n * @returns The instance of got that is capable of making requests to the customer ingress\n */\nexport const createOneTrustGotInstance = ({\n hostname,\n auth,\n}: {\n /** Hostname of the OneTrust API */\n hostname: string;\n /** The OAuth access token */\n auth: string;\n}): Got =>\n got.extend({\n prefixUrl: `https://${hostname}`,\n headers: {\n accept: 'application/json',\n 'content-type': 'application/json',\n authorization: `Bearer ${auth}`,\n },\n });\n","import { OneTrustEnrichedAssessment } from '@transcend-io/privacy-types';\n\n/**\n * Converts the assessment into a json entry.\n *\n * @param param - information about the assessment and amount of entries\n * @returns a stringified json entry ready to be appended to a file\n */\nexport const oneTrustAssessmentToJson = ({\n assessment,\n index,\n total,\n wrap = true,\n}: {\n /** The assessment to convert */\n assessment: OneTrustEnrichedAssessment;\n /** The position of the assessment in the final Json object */\n index: number;\n /** The total amount of the assessments in the final Json object */\n total?: number;\n /** Whether to wrap every entry in brackets */\n wrap?: boolean;\n}): string => {\n let jsonEntry = '';\n // start with an opening bracket\n if (index === 0 || wrap) {\n jsonEntry = '[\\n';\n }\n\n const stringifiedAssessment = JSON.stringify(assessment);\n\n // Add comma for all items except the last one\n const comma = total && index < total - 1 && !wrap ? ',' : '';\n\n // write to file\n jsonEntry = `${jsonEntry + stringifiedAssessment + comma}\\n`;\n\n // end with closing bracket\n if ((total && index === total - 1) || wrap) {\n jsonEntry += '\\n]';\n }\n\n return jsonEntry;\n};\n","import { Got } from 'got';\nimport { logger } from '../../../logger';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport {\n OneTrustAssessment,\n OneTrustGetListOfAssessmentsResponse,\n} from '@transcend-io/privacy-types';\n\n/**\n * Fetch a list of all assessments from the OneTrust client.\n * ref: https://developer.onetrust.com/onetrust/reference/getallassessmentbasicdetailsusingget\n *\n * @param param - the information about the OneTrust client\n * @returns a list of OneTrustAssessment\n */\nexport const getListOfOneTrustAssessments = async ({\n oneTrust,\n}: {\n /** The OneTrust client instance */\n oneTrust: Got;\n}): Promise<OneTrustAssessment[]> => {\n let currentPage = 0;\n let totalPages = 1;\n let totalElements = 0;\n\n const allAssessments: OneTrustAssessment[] = [];\n\n while (currentPage < totalPages) {\n const { body } = await oneTrust.get(\n `api/assessment/v2/assessments?page=${currentPage}&size=2000`,\n );\n\n const { page, content } = decodeCodec(\n OneTrustGetListOfAssessmentsResponse,\n body,\n );\n allAssessments.push(...(content ?? []));\n if (currentPage === 0) {\n totalPages = page?.totalPages ?? 0;\n totalElements = page?.totalElements ?? 0;\n }\n currentPage += 1;\n\n // log progress\n logger.info(\n `Fetched ${allAssessments.length} of ${totalElements} assessments.`,\n );\n }\n\n return allAssessments;\n};\n","import { logger } from '../../../logger';\nimport colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport {\n IMPORT_ONE_TRUST_ASSESSMENT_FORMS,\n makeGraphQLRequest,\n} from '../../graphql';\nimport { ImportOnetrustAssessmentsInput } from '../../../codecs';\nimport { OneTrustEnrichedAssessment } from '@transcend-io/privacy-types';\nimport { oneTrustAssessmentToJson } from './oneTrustAssessmentToJson';\n\nexport interface AssessmentForm {\n /** ID of Assessment Form */\n id: string;\n /** Title of Assessment Form */\n name: string;\n}\n\n/**\n * Write the assessment to a Transcend instance.\n *\n *\n * @param param - information about the assessment and Transcend instance to write to\n */\nexport const syncOneTrustAssessmentToTranscend = async ({\n transcend,\n assessment,\n total,\n index,\n}: {\n /** the Transcend client instance */\n transcend: GraphQLClient;\n /** the assessment to sync to Transcend */\n assessment: OneTrustEnrichedAssessment;\n /** The index of the assessment being written to the file */\n index: number;\n /** The total amount of assessments that we will write */\n total?: number;\n}): Promise<void> => {\n logger.info(\n colors.magenta(\n `Writing enriched assessment ${index + 1} ${\n total ? `of ${total} ` : ' '\n }to Transcend...`,\n ),\n );\n\n // convert the OneTrust assessment object into a json record\n const json = oneTrustAssessmentToJson({\n assessment,\n index,\n total,\n });\n\n // transform the json record into a valid input to the mutation\n const input: ImportOnetrustAssessmentsInput = {\n json,\n };\n\n try {\n await makeGraphQLRequest<{\n /** the importOneTrustAssessmentForms mutation */\n importOneTrustAssessmentForms: {\n /** Created Assessment Forms */\n assessmentForms: AssessmentForm[];\n };\n }>(transcend, IMPORT_ONE_TRUST_ASSESSMENT_FORMS, {\n input,\n });\n } catch (e) {\n logger.error(\n colors.red(\n `Failed to sync assessment ${index + 1} ${\n total ? `of ${total} ` : ' '\n }to Transcend.\\n` +\n `\\tAssessment Title: ${assessment.name}. Template Title: ${assessment.template.name}\\n`,\n ),\n );\n }\n};\n","import type { Got } from 'got';\nimport colors from 'colors';\nimport {\n getListOfOneTrustAssessments,\n getOneTrustAssessment,\n getOneTrustRisk,\n getOneTrustUser,\n} from '../endpoints';\nimport { mapSeries, map } from '@/lib/bluebird-replace';\nimport { logger } from '../../../logger';\nimport {\n OneTrustAssessmentQuestion,\n OneTrustAssessmentSection,\n OneTrustEnrichedAssessment,\n OneTrustGetRiskResponse,\n OneTrustGetUserResponse,\n} from '@transcend-io/privacy-types';\nimport { uniq } from 'lodash-es';\nimport { enrichOneTrustAssessment } from './enrichOneTrustAssessment';\nimport { syncOneTrustAssessmentToDisk } from './syncOneTrustAssessmentToDisk';\nimport { GraphQLClient } from 'graphql-request';\nimport { syncOneTrustAssessmentToTranscend } from './syncOneTrustAssessmentToTranscend';\n\nexport interface AssessmentForm {\n /** ID of Assessment Form */\n id: string;\n /** Title of Assessment Form */\n name: string;\n}\n\n/**\n * Reads all the assessments from a OneTrust instance and syncs them to Transcend or to Disk.\n *\n * @param param - the information about the assessment, its OneTrust source, and destination (disk or Transcend)\n */\nexport const syncOneTrustAssessmentsFromOneTrust = async ({\n oneTrust,\n file,\n dryRun,\n transcend,\n}: {\n /** the OneTrust client instance */\n oneTrust: Got;\n /** the Transcend client instance */\n transcend?: GraphQLClient;\n /** Whether to write to file instead of syncing to Transcend */\n dryRun: boolean;\n /** the path to the file in case dryRun is true */\n file?: string;\n}): Promise<void> => {\n // fetch the list of all assessments in the OneTrust organization\n logger.info('Getting list of all assessments from OneTrust...');\n const assessments = await getListOfOneTrustAssessments({ oneTrust });\n\n // a cache of OneTrust users so we avoid requesting already fetched users\n const oneTrustCachedUsers: Record<string, OneTrustGetUserResponse> = {};\n\n // split all assessments in batches, so we can process some of steps in parallel\n const BATCH_SIZE = 5;\n const assessmentBatches = Array.from(\n {\n length: Math.ceil(assessments.length / BATCH_SIZE),\n },\n (_, i) => assessments.slice(i * BATCH_SIZE, (i + 1) * BATCH_SIZE),\n );\n\n // process each batch and sync the batch right away so it's garbage collected and we don't run out of memory\n await mapSeries(assessmentBatches, async (assessmentBatch, batch) => {\n const batchEnrichedAssessments: OneTrustEnrichedAssessment[] = [];\n\n // fetch assessment details from OneTrust in parallel\n await map(\n assessmentBatch,\n async (assessment, index) => {\n const assessmentNumber = BATCH_SIZE * batch + index + 1;\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching details...`,\n );\n const { templateName, assessmentId } = assessment;\n const assessmentDetails = await getOneTrustAssessment({\n oneTrust,\n assessmentId,\n });\n // fetch assessment's creator information\n const creatorId = assessmentDetails.createdBy.id;\n let creator = oneTrustCachedUsers[creatorId];\n if (!creator) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching creator...`,\n );\n try {\n creator = await getOneTrustUser({\n oneTrust,\n userId: creatorId,\n });\n oneTrustCachedUsers[creatorId] = creator;\n } catch (e) {\n logger.warn(\n colors.yellow(\n `[assessment ${assessmentNumber} of ${assessments.length}]: failed to fetch form creator.` +\n `\\tcreatorId: ${creatorId}. Assessment Title: ${assessment.name}. Template Title: ${templateName}`,\n ),\n );\n }\n }\n\n // fetch assessment approvers information\n const { approvers } = assessmentDetails;\n let approversDetails: OneTrustGetUserResponse[][] = [];\n if (approvers.length > 0) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching approvers...`,\n );\n approversDetails = await map(\n approvers.map(({ id }) => id),\n async (userId) => {\n try {\n let approver = oneTrustCachedUsers[userId];\n if (!approver) {\n approver = await getOneTrustUser({ oneTrust, userId });\n oneTrustCachedUsers[userId] = approver;\n }\n return [approver];\n } catch (e) {\n logger.warn(\n colors.yellow(\n `[assessment ${assessmentNumber} of ${assessments.length}]: failed to fetch a form approver.` +\n `\\tapproverId: ${userId}. Assessment Title: ${assessment.name}. Template Title: ${templateName}`,\n ),\n );\n return [];\n }\n },\n { concurrency: 5 },\n );\n }\n\n // fetch assessment internal respondents information\n const { respondents } = assessmentDetails;\n // if a user is an internal respondents, their 'name' field can't be an email.\n const internalRespondents = respondents.filter(\n (r) => !r.name.includes('@'),\n );\n let respondentsDetails: OneTrustGetUserResponse[][] = [];\n if (internalRespondents.length > 0) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching respondents...`,\n );\n respondentsDetails = await map(\n internalRespondents.map(({ id }) => id),\n async (userId) => {\n try {\n let respondent = oneTrustCachedUsers[userId];\n if (!respondent) {\n respondent = await getOneTrustUser({ oneTrust, userId });\n oneTrustCachedUsers[userId] = respondent;\n }\n return [respondent];\n } catch (e) {\n logger.warn(\n colors.yellow(\n `[assessment ${assessmentNumber} of ${assessments.length}]: failed to fetch a respondent.` +\n `\\trespondentId: ${userId}. Assessment Title: ${assessment.name}. Template Title: ${templateName}`,\n ),\n );\n return [];\n }\n },\n { concurrency: 5 },\n );\n }\n\n // fetch assessment risk information\n let riskDetails: OneTrustGetRiskResponse[] = [];\n const riskIds = uniq(\n assessmentDetails.sections.flatMap((s: OneTrustAssessmentSection) =>\n s.questions.flatMap((q: OneTrustAssessmentQuestion) =>\n (q.risks ?? []).flatMap((r) => r.riskId),\n ),\n ),\n );\n if (riskIds.length > 0) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching risks...`,\n );\n riskDetails = await map(\n riskIds,\n (riskId) => getOneTrustRisk({ oneTrust, riskId: riskId as string }),\n {\n concurrency: 5,\n },\n );\n }\n\n // enrich the assessments with user and risk details\n const enrichedAssessment = enrichOneTrustAssessment({\n assessment,\n assessmentDetails,\n riskDetails,\n creatorDetails: creator,\n approversDetails: approversDetails.flat(),\n respondentsDetails: respondentsDetails.flat(),\n });\n\n batchEnrichedAssessments.push(enrichedAssessment);\n },\n { concurrency: BATCH_SIZE },\n );\n\n // sync assessments in series to avoid concurrency bugs\n await mapSeries(\n batchEnrichedAssessments,\n async (enrichedAssessment, index) => {\n // the assessment's global index takes its batch into consideration\n const globalIndex = batch * BATCH_SIZE + index;\n\n if (dryRun && file) {\n // sync to file\n syncOneTrustAssessmentToDisk({\n assessment: enrichedAssessment,\n index: globalIndex,\n total: assessments.length,\n file,\n });\n } else if (transcend) {\n // sync to transcend\n await syncOneTrustAssessmentToTranscend({\n assessment: enrichedAssessment,\n transcend,\n total: assessments.length,\n index: globalIndex,\n });\n }\n },\n );\n });\n};\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunk2VOZMXOEcjs = require('./chunk-2VOZMXOE.cjs');require('./chunk-ZVK4HIDF.cjs');var _chunkKR377AJUcjs = require('./chunk-KR377AJU.cjs');require('./chunk-SJFPYDA3.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');require('./chunk-EG4L6YAJ.cjs');require('./chunk-S6XB2PPW.cjs');require('./chunk-BY7W4UQF.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _iots = require('io-ts'); var t = _interopRequireWildcard(_iots);var p=t.type({"Request Id":t.string});async function R({auth:r,dataSiloId:i,file:e,transcendUrl:m}){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Reading "${e}" from disk`));let n=_chunkKR377AJUcjs.q.call(void 0, e,p);await _chunk2VOZMXOEcjs.f.call(void 0, {requestIds:n.map(d=>d["Request Id"]),transcendUrl:m,auth:r,dataSiloId:i})}exports.markRequestDataSilosCompleted = R;
2
+ //# sourceMappingURL=impl-OWHAFIWY.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/impl-OWHAFIWY.cjs","../src/commands/request/system/mark-request-data-silos-completed/impl.ts"],"names":["RequestIdRow","markRequestDataSilosCompleted","auth","dataSiloId","file","transcendUrl","logger","colors","activeResults","readCsv","markRequestDataSiloIdsCompleted","request"],"mappings":"AAAA,mfAAwC,gCAA6B,wDAAyC,gCAA6B,wDAAyC,gCAA6B,gCAA6B,gCAA6B,gFCCxP,qEACA,IAMbA,CAAAA,CAAiB,CAAA,CAAA,IAAA,CAAK,CAC1B,YAAA,CAAgB,CAAA,CAAA,MAClB,CAAC,CAAA,CASD,MAAA,SAAsBC,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CACfC,mBAAAA,CAAO,IAAA,CAAKC,gBAAAA,CAAO,OAAA,CAAQ,CAAA,SAAA,EAAYH,CAAI,CAAA,WAAA,CAAa,CAAC,CAAA,CACzD,IAAMI,CAAAA,CAAgBC,iCAAAA,CAAQL,CAAMJ,CAAY,CAAA,CAEhD,MAAMU,iCAAAA,CACJ,UAAA,CAAYF,CAAAA,CAAc,GAAA,CAAKG,CAAAA,EAAYA,CAAAA,CAAQ,YAAY,CAAC,CAAA,CAChE,YAAA,CAAAN,CAAAA,CACA,IAAA,CAAAH,CAAAA,CACA,UAAA,CAAAC,CACF,CAAC,CACH,CAAA,0CAAA","file":"/Users/benbrook/transcend/cli/dist/impl-OWHAFIWY.cjs","sourcesContent":[null,"import type { LocalContext } from '@/context';\nimport colors from 'colors';\nimport * as t from 'io-ts';\n\nimport { logger } from '@/logger';\nimport { markRequestDataSiloIdsCompleted } from '@/lib/cron';\nimport { readCsv } from '@/lib/requests';\n\nconst RequestIdRow = t.type({\n 'Request Id': t.string,\n});\n\ninterface MarkRequestDataSilosCompletedCommandFlags {\n auth: string;\n dataSiloId: string;\n file: string;\n transcendUrl: string;\n}\n\nexport async function markRequestDataSilosCompleted(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n file,\n transcendUrl,\n }: MarkRequestDataSilosCompletedCommandFlags,\n): Promise<void> {\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const activeResults = readCsv(file, RequestIdRow);\n\n await markRequestDataSiloIdsCompleted({\n requestIds: activeResults.map((request) => request['Request Id']),\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"]}
@@ -0,0 +1,6 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkUJ3GGOXXcjs = require('./chunk-UJ3GGOXX.cjs');require('./chunk-UEGX6GZ2.cjs');require('./chunk-SAEKBZGF.cjs');var _chunkSJFPYDA3cjs = require('./chunk-SJFPYDA3.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');require('./chunk-EG4L6YAJ.cjs');require('./chunk-S6XB2PPW.cjs');require('./chunk-BY7W4UQF.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _fs = require('fs');var _privacytypes = require('@transcend-io/privacy-types');var i=_chunkSJFPYDA3cjs.bc.call(void 0, Object.entries(_privacytypes.TRANSCEND_SCOPES).map(([t,o])=>({...o,name:t})),"title"),N=Object.keys(i);async function P({email:t,password:o,apiKeyTitle:c,file:m,scopes:l,deleteExistingApiKey:g,createNewApiKey:f,parentOrganizationId:y,transcendUrl:S}){let r=l.map(e=>e.trim()),s=r.filter(e=>!i[e]);s.length>0&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to parse scopes:"${s.join(",")}".
2
+ Expected one of:
3
+ ${N.join(`
4
+ `)}`)),process.exit(1));let d=r.map(e=>i[e].name),{errors:C,apiKeys:x}=await _chunkUJ3GGOXXcjs.a.call(void 0, {transcendUrl:S,password:o,email:t,parentOrganizationId:y,deleteExistingApiKey:g,createNewApiKey:f,apiKeyTitle:c,scopes:d});_fs.writeFileSync.call(void 0, m,`${JSON.stringify(x,null,2)}
5
+ `),C.length>0&&process.exit(1)}exports.generateApiKeys = P;
6
+ //# sourceMappingURL=impl-P3MQ53VI.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/commands/admin/generate-api-keys/impl.ts"],"sourcesContent":["import type { LocalContext } from '@/context';\nimport colors from 'colors';\nimport { writeFileSync } from 'fs';\n\nimport { ScopeName, TRANSCEND_SCOPES } from '@transcend-io/privacy-types';\n\nimport { logger } from '@/logger';\nimport { generateCrossAccountApiKeys } from '@/lib/api-keys';\nimport { keyBy } from 'lodash-es';\n\nconst SCOPES_BY_TITLE = keyBy(\n Object.entries(TRANSCEND_SCOPES).map(([name, value]) => ({\n ...value,\n name,\n })),\n 'title',\n);\nconst SCOPE_TITLES = Object.keys(SCOPES_BY_TITLE);\n\n// Command flag interface\ninterface 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 // Validate scopes\n const splitScopes = scopes.map((x) => x.trim());\n const invalidScopes = splitScopes.filter(\n (scopeTitle) => !SCOPES_BY_TITLE[scopeTitle],\n );\n if (invalidScopes.length > 0) {\n logger.error(\n colors.red(\n `Failed to parse scopes:\"${invalidScopes.join(',')}\".\\n` +\n `Expected one of: \\n${SCOPE_TITLES.join('\\n')}`,\n ),\n );\n process.exit(1);\n }\n\n const scopeNames = splitScopes.map(\n (scopeTitle) => SCOPES_BY_TITLE[scopeTitle].name as ScopeName,\n );\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 process.exit(1);\n }\n}\n"],"mappings":"mPACA,OAAOA,MAAY,SACnB,OAAS,iBAAAC,MAAqB,KAE9B,OAAoB,oBAAAC,MAAwB,8BAI5C,OAAS,SAAAC,MAAa,YAEtB,IAAMC,EAAkBD,EACtB,OAAO,QAAQE,CAAgB,EAAE,IAAI,CAAC,CAACC,EAAMC,CAAK,KAAO,CACvD,GAAGA,EACH,KAAAD,CACF,EAAE,EACF,OACF,EACME,EAAe,OAAO,KAAKJ,CAAe,EAgBhD,eAAsBK,EAEpB,CACE,MAAAC,EACA,SAAAC,EACA,YAAAC,EACA,KAAAC,EACA,OAAAC,EACA,qBAAAC,EACA,gBAAAC,EACA,qBAAAC,EACA,aAAAC,CACF,EACe,CAEf,IAAMC,EAAcL,EAAO,IAAKM,GAAMA,EAAE,KAAK,CAAC,EACxCC,EAAgBF,EAAY,OAC/BG,GAAe,CAAClB,EAAgBkB,CAAU,CAC7C,EACID,EAAc,OAAS,IACzBE,EAAO,MACLC,EAAO,IACL,2BAA2BH,EAAc,KAAK,GAAG,CAAC;AAAA;AAAA,EAC1Bb,EAAa,KAAK;AAAA,CAAI,CAAC,EACjD,CACF,EACA,QAAQ,KAAK,CAAC,GAGhB,IAAMiB,EAAaN,EAAY,IAC5BG,GAAelB,EAAgBkB,CAAU,EAAE,IAC9C,EAGM,CAAE,OAAAI,EAAQ,QAAAC,CAAQ,EAAI,MAAMC,EAA4B,CAC5D,aAAAV,EACA,SAAAP,EACA,MAAAD,EACA,qBAAAO,EACA,qBAAAF,EACA,gBAAAC,EACA,YAAAJ,EACA,OAAQa,CACV,CAAC,EAGDI,EAAchB,EAAM,GAAG,KAAK,UAAUc,EAAS,KAAM,CAAC,CAAC;AAAA,CAAI,EACvDD,EAAO,OAAS,GAClB,QAAQ,KAAK,CAAC,CAElB","names":["colors","writeFileSync","TRANSCEND_SCOPES","keyBy","SCOPES_BY_TITLE","TRANSCEND_SCOPES","name","value","SCOPE_TITLES","generateApiKeys","email","password","apiKeyTitle","file","scopes","deleteExistingApiKey","createNewApiKey","parentOrganizationId","transcendUrl","splitScopes","x","invalidScopes","scopeTitle","logger","colors","scopeNames","errors","apiKeys","generateCrossAccountApiKeys","writeFileSync"]}
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/impl-P3MQ53VI.cjs","../src/commands/admin/generate-api-keys/impl.ts"],"names":["SCOPES_BY_TITLE","keyBy_default","TRANSCEND_SCOPES","name","value","SCOPE_TITLES","generateApiKeys","email","password","apiKeyTitle","file","scopes","deleteExistingApiKey","createNewApiKey","parentOrganizationId","transcendUrl","splitScopes","x","invalidScopes","scopeTitle","logger","colors","errors"],"mappings":"AAAA,iOAAwC,gCAA6B,gCAA6B,wDAA0C,wDAAyC,gCAA6B,gCAA6B,gCAA6B,gFCCzP,wBACW,2DAEc,IAMtCA,CAAAA,CAAkBC,kCAAAA,MACtB,CAAO,OAAA,CAAQC,8BAAgB,CAAA,CAAE,GAAA,CAAI,CAAC,CAACC,CAAAA,CAAMC,CAAK,CAAA,CAAA,EAAA,CAAO,CACvD,GAAGA,CAAAA,CACH,IAAA,CAAAD,CACF,CAAA,CAAE,CAAA,CACF,OACF,CAAA,CACME,CAAAA,CAAe,MAAA,CAAO,IAAA,CAAKL,CAAe,CAAA,CAgBhD,MAAA,SAAsBM,CAAAA,CAEpB,CACE,KAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,oBAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,oBAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CAEf,IAAMC,CAAAA,CAAcL,CAAAA,CAAO,GAAA,CAAKM,CAAAA,EAAMA,CAAAA,CAAE,IAAA,CAAK,CAAC,CAAA,CACxCC,CAAAA,CAAgBF,CAAAA,CAAY,MAAA,CAC/BG,CAAAA,EAAe,CAACnB,CAAAA,CAAgBmB,CAAU,CAC7C,CAAA,CACID,CAAAA,CAAc,MAAA,CAAS,CAAA,EAAA,CACzBE,mBAAAA,CAAO,KAAA,CACLC,gBAAAA,CAAO,GAAA,CACL,CAAA,wBAAA,EAA2BH,CAAAA,CAAc,IAAA,CAAK,GAAG,CAAC,CAAA;AAAA;AAAA,EAC1Bb,CAAAA,CAAa,IAAA,CAAK,CAAA;AAAA,CAAI,CAAC,CAAA,CAAA;AAwBjDiB","file":"/Users/benbrook/transcend/cli/dist/impl-P3MQ53VI.cjs","sourcesContent":[null,"import type { LocalContext } from '@/context';\nimport colors from 'colors';\nimport { writeFileSync } from 'fs';\n\nimport { ScopeName, TRANSCEND_SCOPES } from '@transcend-io/privacy-types';\n\nimport { logger } from '@/logger';\nimport { generateCrossAccountApiKeys } from '@/lib/api-keys';\nimport { keyBy } from 'lodash-es';\n\nconst SCOPES_BY_TITLE = keyBy(\n Object.entries(TRANSCEND_SCOPES).map(([name, value]) => ({\n ...value,\n name,\n })),\n 'title',\n);\nconst SCOPE_TITLES = Object.keys(SCOPES_BY_TITLE);\n\n// Command flag interface\ninterface 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 // Validate scopes\n const splitScopes = scopes.map((x) => x.trim());\n const invalidScopes = splitScopes.filter(\n (scopeTitle) => !SCOPES_BY_TITLE[scopeTitle],\n );\n if (invalidScopes.length > 0) {\n logger.error(\n colors.red(\n `Failed to parse scopes:\"${invalidScopes.join(',')}\".\\n` +\n `Expected one of: \\n${SCOPE_TITLES.join('\\n')}`,\n ),\n );\n process.exit(1);\n }\n\n const scopeNames = splitScopes.map(\n (scopeTitle) => SCOPES_BY_TITLE[scopeTitle].name as ScopeName,\n );\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 process.exit(1);\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkKR377AJUcjs = require('./chunk-KR377AJU.cjs');require('./chunk-SJFPYDA3.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-EG4L6YAJ.cjs');require('./chunk-S6XB2PPW.cjs');require('./chunk-BY7W4UQF.cjs');async function y({auth:o,file:i,transcendUrl:n,cacheFilepath:a,requestReceiptFolder:r,sombraAuth:s,concurrency:l,attributes:c,isTest:d,isSilent:p,skipSendingReceipt:u,emailIsVerified:m,skipFilterStep:b,dryRun:g,debug:C,defaultPhoneCountryCode:f}){await _chunkKR377AJUcjs.O.call(void 0, {cacheFilepath:a,requestReceiptFolder:r,file:i,auth:o,sombraAuth:s,concurrency:l,transcendUrl:n,defaultPhoneCountryCode:f,attributes:_chunkKR377AJUcjs.n.call(void 0, c),debug:C,skipFilterStep:b,isSilent:p,skipSendingReceipt:u,emailIsVerified:m,isTest:d,dryRun:g})}exports.upload = y;
2
+ //# sourceMappingURL=impl-P75VZVME.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/impl-P75VZVME.cjs","../src/commands/request/upload/impl.ts"],"names":["upload","auth","file","transcendUrl","cacheFilepath","requestReceiptFolder","sombraAuth","concurrency","attributes","isTest","isSilent","skipSendingReceipt","emailIsVerified","skipFilterStep","dryRun","debug","defaultPhoneCountryCode","uploadPrivacyRequestsFromCsv","splitCsvToList"],"mappings":"AAAA,iIAA+C,gCAA6B,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCsBhM,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,oBAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,kBAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,KAAA,CAAAC,CAAAA,CACA,uBAAA,CAAAC,CACF,CAAA,CACe,CACf,MAAMC,iCAAAA,CACJ,aAAA,CAAAb,CAAAA,CACA,oBAAA,CAAAC,CAAAA,CACA,IAAA,CAAAH,CAAAA,CACA,IAAA,CAAAD,CAAAA,CACA,UAAA,CAAAK,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,YAAA,CAAAJ,CAAAA,CACA,uBAAA,CAAAa,CAAAA,CACA,UAAA,CAAYE,iCAAAA,CAAyB,CAAA,CACrC,KAAA,CAAAH,CAAAA,CACA,cAAA,CAAAF,CAAAA,CACA,QAAA,CAAAH,CAAAA,CACA,kBAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,MAAA,CAAAH,CAAAA,CACA,MAAA,CAAAK,CACF,CAAC,CACH,CAAA,mBAAA","file":"/Users/benbrook/transcend/cli/dist/impl-P75VZVME.cjs","sourcesContent":[null,"import type { LocalContext } from '@/context';\nimport { splitCsvToList, uploadPrivacyRequestsFromCsv } from '@/lib/requests';\n\ninterface UploadCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n cacheFilepath: string;\n requestReceiptFolder: string;\n sombraAuth?: string;\n concurrency: number;\n attributes: string;\n isTest: boolean;\n isSilent: boolean;\n skipSendingReceipt: boolean;\n emailIsVerified: boolean;\n skipFilterStep: boolean;\n dryRun: boolean;\n debug: boolean;\n defaultPhoneCountryCode: string;\n}\n\nexport async function upload(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n cacheFilepath,\n requestReceiptFolder,\n sombraAuth,\n concurrency,\n attributes,\n isTest,\n isSilent,\n skipSendingReceipt,\n emailIsVerified,\n skipFilterStep,\n dryRun,\n debug,\n defaultPhoneCountryCode,\n }: UploadCommandFlags,\n): Promise<void> {\n await uploadPrivacyRequestsFromCsv({\n cacheFilepath,\n requestReceiptFolder,\n file,\n auth,\n sombraAuth,\n concurrency,\n transcendUrl,\n defaultPhoneCountryCode,\n attributes: splitCsvToList(attributes),\n debug,\n skipFilterStep,\n isSilent,\n skipSendingReceipt,\n emailIsVerified,\n isTest,\n dryRun,\n });\n}\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkKOV2SQO2cjs = require('./chunk-KOV2SQO2.cjs');var _chunkUEGX6GZ2cjs = require('./chunk-UEGX6GZ2.cjs');require('./chunk-SAEKBZGF.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');require('./chunk-BY7W4UQF.cjs');var _iots = require('io-ts'); var p = _interopRequireWildcard(_iots);var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _fs = require('fs');var _typeutils = require('@transcend-io/type-utils');var _privacytypes = require('@transcend-io/privacy-types');function P({file:e,output:n}){_fs.existsSync.call(void 0, e)||(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`File does not exist: --file="${e}"`)),process.exit(1));let f=_typeutils.decodeCodec.call(void 0, p.array(_chunkUEGX6GZ2cjs.ia),_fs.readFileSync.call(void 0, e,"utf-8")),t=[],r=[];f.forEach(s=>{s.dataFlows.filter(({type:o})=>o!==_privacytypes.DataFlowScope.CSP).forEach(o=>{t.push({value:o.value,type:o.type,status:_privacytypes.ConsentTrackerStatus.Live,trackingPurposes:o.trackingPurposes})}),s.cookies.forEach(o=>{r.push({name:o.name,status:_privacytypes.ConsentTrackerStatus.Live,trackingPurposes:o.trackingPurposes})})}),_chunkKOV2SQO2cjs.e.call(void 0, n,{"data-flows":t,cookies:r}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully wrote ${t.length} data flows and ${r.length} cookies to file "${n}"`))}exports.consentManagerServiceJsonToYml = P;
2
+ //# sourceMappingURL=impl-PKVWUYYX.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/impl-PKVWUYYX.cjs","../src/commands/inventory/consent-manager-service-json-to-yml/impl.ts"],"names":["consentManagerServiceJsonToYml","file","output","existsSync","logger","colors","services","decodeCodec","ConsentManagerServiceMetadata","readFileSync","dataFlows","cookies","service","type","DataFlowScope","dataFlow","ConsentTrackerStatus","cookie","writeTranscendYaml"],"mappings":"AAAA,mfAAwC,wDAA0C,gCAA6B,wDAAoC,gCAA6B,qECC7J,gFAEA,wBAEsB,qDACb,2DASrB,SAOSA,CAAAA,CAEd,CAAE,IAAA,CAAAC,CAAAA,CAAM,MAAA,CAAAC,CAAO,CAAA,CACT,CAEDC,4BAAAA,CAAe,CAAA,EAAA,CAClBC,mBAAAA,CAAO,KAAA,CAAMC,gBAAAA,CAAO,GAAA,CAAI,CAAA,6BAAA,EAAgCJ,CAAI,CAAA,CAAA,CAAG,CAAC,CAAA,CAChE,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,CAAA,CAIhB,IAAMK,CAAAA,CAAWC,oCAAAA,CACb,CAAA,KAAA,CAAMC,oBAA6B,CAAA,CACrCC,8BAAAA,CAAaR,CAAM,OAAO,CAC5B,CAAA,CAGMS,CAAAA,CAA6B,CAAC,CAAA,CAC9BC,CAAAA,CAAyB,CAAC,CAAA,CAChCL,CAAAA,CAAS,OAAA,CAASM,CAAAA,EAAY,CAC5BA,CAAAA,CAAQ,SAAA,CACL,MAAA,CAAO,CAAC,CAAE,IAAA,CAAAC,CAAK,CAAA,CAAA,EAAMA,CAAAA,GAASC,2BAAAA,CAAc,GAAG,CAAA,CAC/C,OAAA,CAASC,CAAAA,EAAa,CACrBL,CAAAA,CAAU,IAAA,CAAK,CACb,KAAA,CAAOK,CAAAA,CAAS,KAAA,CAChB,IAAA,CAAMA,CAAAA,CAAS,IAAA,CACf,MAAA,CAAQC,kCAAAA,CAAqB,IAAA,CAC7B,gBAAA,CAAkBD,CAAAA,CAAS,gBAC7B,CAAC,CACH,CAAC,CAAA,CAEHH,CAAAA,CAAQ,OAAA,CAAQ,OAAA,CAASK,CAAAA,EAAW,CAClCN,CAAAA,CAAQ,IAAA,CAAK,CACX,IAAA,CAAMM,CAAAA,CAAO,IAAA,CACb,MAAA,CAAQD,kCAAAA,CAAqB,IAAA,CAC7B,gBAAA,CAAkBC,CAAAA,CAAO,gBAC3B,CAAC,CACH,CAAC,CACH,CAAC,CAAA,CAGDC,iCAAAA,CAAmBhB,CAAQ,CACzB,YAAA,CAAcQ,CAAAA,CACd,OAAA,CAAAC,CACF,CAAC,CAAA,CAEDP,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,KAAA,CACL,CAAA,mBAAA,EAAsBK,CAAAA,CAAU,MAAM,CAAA,gBAAA,EAAmBC,CAAAA,CAAQ,MAAM,CAAA,kBAAA,EAAqBT,CAAM,CAAA,CAAA,CACpG,CACF,CACF,CAAA,2CAAA","file":"/Users/benbrook/transcend/cli/dist/impl-PKVWUYYX.cjs","sourcesContent":[null,"import type { LocalContext } from '@/context';\nimport * as t from 'io-ts';\nimport { writeTranscendYaml } from '@/lib/readTranscendYaml';\nimport colors from 'colors';\nimport { logger } from '@/logger';\nimport { existsSync, readFileSync } from 'fs';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport {\n ConsentManagerServiceMetadata,\n CookieInput,\n DataFlowInput,\n} from '@/codecs';\nimport {\n ConsentTrackerStatus,\n DataFlowScope,\n} from '@transcend-io/privacy-types';\n\ninterface ConsentManagerServiceJsonToYmlCommandFlags {\n file: string;\n output: string;\n}\n\nexport function consentManagerServiceJsonToYml(\n this: LocalContext,\n { file, output }: ConsentManagerServiceJsonToYmlCommandFlags,\n): void {\n // Ensure files exist\n if (!existsSync(file)) {\n logger.error(colors.red(`File does not exist: --file=\"${file}\"`));\n process.exit(1);\n }\n\n // Read in each consent manager configuration\n const services = decodeCodec(\n t.array(ConsentManagerServiceMetadata),\n readFileSync(file, 'utf-8'),\n );\n\n // Create data flows and cookie configurations\n const dataFlows: DataFlowInput[] = [];\n const cookies: CookieInput[] = [];\n services.forEach((service) => {\n service.dataFlows\n .filter(({ type }) => type !== DataFlowScope.CSP)\n .forEach((dataFlow) => {\n dataFlows.push({\n value: dataFlow.value,\n type: dataFlow.type,\n status: ConsentTrackerStatus.Live,\n trackingPurposes: dataFlow.trackingPurposes,\n });\n });\n\n service.cookies.forEach((cookie) => {\n cookies.push({\n name: cookie.name,\n status: ConsentTrackerStatus.Live,\n trackingPurposes: cookie.trackingPurposes,\n });\n });\n });\n\n // write to disk\n writeTranscendYaml(output, {\n 'data-flows': dataFlows,\n cookies,\n });\n\n logger.info(\n colors.green(\n `Successfully wrote ${dataFlows.length} data flows and ${cookies.length} cookies to file \"${output}\"`,\n ),\n );\n}\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkKR377AJUcjs = require('./chunk-KR377AJU.cjs');require('./chunk-SJFPYDA3.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-EG4L6YAJ.cjs');require('./chunk-S6XB2PPW.cjs');require('./chunk-BY7W4UQF.cjs');async function n({auth:s,dataSiloId:a,status:e,statuses:i,transcendUrl:o}){await _chunkKR377AJUcjs.V.call(void 0, {transcendUrl:o,auth:s,status:e,dataSiloId:a,requestStatuses:i})}exports.skipRequestDataSilos = n;
2
+ //# sourceMappingURL=impl-QAAZKKZI.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/impl-QAAZKKZI.cjs","../src/commands/request/system/skip-request-data-silos/impl.ts"],"names":["skipRequestDataSilos","auth","dataSiloId","status","statuses","transcendUrl"],"mappings":"AAAA,iIAAwC,gCAA6B,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCYzL,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CACf,MAAML,iCAAAA,CACJ,YAAA,CAAAK,CAAAA,CACA,IAAA,CAAAJ,CAAAA,CACA,MAAA,CAAAE,CAAAA,CACA,UAAA,CAAAD,CAAAA,CACA,eAAA,CAAiBE,CACnB,CAAC,CACH,CAAA,iCAAA","file":"/Users/benbrook/transcend/cli/dist/impl-QAAZKKZI.cjs","sourcesContent":[null,"import type { LocalContext } from '@/context';\nimport type { RequestStatus } from '@transcend-io/privacy-types';\nimport { skipRequestDataSilos as skipRequestDataSilosHelper } from '@/lib/requests';\n\ninterface SkipRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n transcendUrl: string;\n statuses: RequestStatus[];\n status: 'SKIPPED' | 'RESOLVED';\n}\n\nexport async function skipRequestDataSilos(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n status,\n statuses,\n transcendUrl,\n }: SkipRequestDataSilosCommandFlags,\n): Promise<void> {\n await skipRequestDataSilosHelper({\n transcendUrl,\n auth,\n status,\n dataSiloId,\n requestStatuses: statuses,\n });\n}\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkKR377AJUcjs = require('./chunk-KR377AJU.cjs');require('./chunk-SJFPYDA3.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-EG4L6YAJ.cjs');require('./chunk-S6XB2PPW.cjs');require('./chunk-BY7W4UQF.cjs');async function A({auth:t,requestReceiptFolder:s,sombraAuth:r,actions:a,statuses:o,requestIds:i,createdAt:n,emailIsVerified:c,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:m,skipWaitingPeriod:l,createdAtBefore:p,createdAtAfter:f,concurrency:R,transcendUrl:q}){await _chunkKR377AJUcjs.Q.call(void 0, {requestReceiptFolder:s,auth:t,sombraAuth:r,requestActions:a,requestStatuses:o,requestIds:i,createdAt:n,emailIsVerified:c,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:m,skipWaitingPeriod:l,createdAtBefore:p,createdAtAfter:f,concurrency:R,transcendUrl:q})}exports.restart = A;
2
+ //# sourceMappingURL=impl-RJ7D4TDU.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/impl-RJ7D4TDU.cjs","../src/commands/request/restart/impl.ts"],"names":["restart","auth","requestReceiptFolder","sombraAuth","actions","statuses","requestIds","createdAt","emailIsVerified","silentModeBefore","sendEmailReceipt","copyIdentifiers","skipWaitingPeriod","createdAtBefore","createdAtAfter","concurrency","transcendUrl","bulkRestartRequests"],"mappings":"AAAA,iIAAwC,gCAA6B,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCuBzL,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,oBAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,iBAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CACf,MAAMC,iCAAAA,CACJ,oBAAA,CAAAf,CAAAA,CACA,IAAA,CAAAD,CAAAA,CACA,UAAA,CAAAE,CAAAA,CACA,cAAA,CAAgBC,CAAAA,CAChB,eAAA,CAAiBC,CAAAA,CACjB,UAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,iBAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAC,CACH,CAAA,oBAAA","file":"/Users/benbrook/transcend/cli/dist/impl-RJ7D4TDU.cjs","sourcesContent":[null,"import type { LocalContext } from '@/context';\nimport { bulkRestartRequests } from '@/lib/requests';\nimport type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\n\ninterface RestartCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses: RequestStatus[];\n transcendUrl: string;\n requestReceiptFolder: string;\n sombraAuth?: string;\n concurrency: number;\n requestIds?: string[];\n emailIsVerified: boolean;\n createdAt?: Date;\n silentModeBefore?: Date;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n sendEmailReceipt: boolean;\n copyIdentifiers: boolean;\n skipWaitingPeriod: boolean;\n}\n\nexport async function restart(\n this: LocalContext,\n {\n auth,\n requestReceiptFolder,\n sombraAuth,\n actions,\n statuses,\n requestIds,\n createdAt,\n emailIsVerified,\n silentModeBefore,\n sendEmailReceipt,\n copyIdentifiers,\n skipWaitingPeriod,\n createdAtBefore,\n createdAtAfter,\n concurrency,\n transcendUrl,\n }: RestartCommandFlags,\n): Promise<void> {\n await bulkRestartRequests({\n requestReceiptFolder,\n auth,\n sombraAuth,\n requestActions: actions,\n requestStatuses: statuses,\n requestIds,\n createdAt,\n emailIsVerified,\n silentModeBefore,\n sendEmailReceipt,\n copyIdentifiers,\n skipWaitingPeriod,\n createdAtBefore,\n createdAtAfter,\n concurrency,\n transcendUrl,\n });\n}\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkKR377AJUcjs = require('./chunk-KR377AJU.cjs');require('./chunk-SJFPYDA3.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-EG4L6YAJ.cjs');require('./chunk-S6XB2PPW.cjs');require('./chunk-BY7W4UQF.cjs');async function f({auth:e,transcendUrl:i,createdAtBefore:n,createdAtAfter:o,actions:r,daysLeft:a,days:s,requestIds:m,emailTemplate:c,concurrency:d}){await _chunkKR377AJUcjs.J.call(void 0, {transcendUrl:i,requestActions:r,auth:e,emailTemplate:c,days:s,daysLeft:a,requestIds:m,concurrency:d,createdAtBefore:n,createdAtAfter:o})}exports.notifyAdditionalTime = f;
2
+ //# sourceMappingURL=impl-RUSYHPJG.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/impl-RUSYHPJG.cjs","../src/commands/request/notify-additional-time/impl.ts"],"names":["notifyAdditionalTime","auth","transcendUrl","createdAtBefore","createdAtAfter","actions","daysLeft","days","requestIds","emailTemplate","concurrency","notifyPrivacyRequestsAdditionalTime"],"mappings":"AAAA,iIAAwC,gCAA6B,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCiBzL,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CACF,CAAA,CACe,CACf,MAAMC,iCAAAA,CACJ,YAAA,CAAAT,CAAAA,CACA,cAAA,CAAgBG,CAAAA,CAChB,IAAA,CAAAJ,CAAAA,CACA,aAAA,CAAAQ,CAAAA,CACA,IAAA,CAAAF,CAAAA,CACA,QAAA,CAAAD,CAAAA,CACA,UAAA,CAAAE,CAAAA,CACA,WAAA,CAAAE,CAAAA,CACA,eAAA,CAAAP,CAAAA,CACA,cAAA,CAAAC,CACF,CAAC,CACH,CAAA,iCAAA","file":"/Users/benbrook/transcend/cli/dist/impl-RUSYHPJG.cjs","sourcesContent":[null,"import type { LocalContext } from '@/context';\nimport { notifyPrivacyRequestsAdditionalTime } from '@/lib/requests';\nimport type { RequestAction } from '@transcend-io/privacy-types';\n\ninterface NotifyAdditionalTimeCommandFlags {\n auth: string;\n createdAtBefore: Date;\n createdAtAfter?: Date;\n actions?: RequestAction[];\n daysLeft: number;\n days: number;\n requestIds?: string[];\n emailTemplate: string;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function notifyAdditionalTime(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n createdAtBefore,\n createdAtAfter,\n actions,\n daysLeft,\n days,\n requestIds,\n emailTemplate,\n concurrency,\n }: NotifyAdditionalTimeCommandFlags,\n): Promise<void> {\n await notifyPrivacyRequestsAdditionalTime({\n transcendUrl,\n requestActions: actions,\n auth,\n emailTemplate,\n days,\n daysLeft,\n requestIds,\n concurrency,\n createdAtBefore,\n createdAtAfter,\n });\n}\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-2VOZMXOE.cjs');var _chunkZVK4HIDFcjs = require('./chunk-ZVK4HIDF.cjs');var _chunkLYJU4HTNcjs = require('./chunk-LYJU4HTN.cjs');require('./chunk-TEOKGAUX.cjs');require('./chunk-KR377AJU.cjs');require('./chunk-UEGX6GZ2.cjs');require('./chunk-SAEKBZGF.cjs');var _chunkSJFPYDA3cjs = require('./chunk-SJFPYDA3.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-EG4L6YAJ.cjs');require('./chunk-S6XB2PPW.cjs');require('./chunk-BY7W4UQF.cjs');async function h({auth:a,partition:m,sombraAuth:c,file:p,transcendUrl:f,timestampBefore:e,timestampAfter:r,identifiers:n=[],concurrency:l}){let g=await _chunkSJFPYDA3cjs.ye.call(void 0, f,a,c),u=await _chunkLYJU4HTNcjs.j.call(void 0, g,{partition:m,filterBy:{...e?{timestampBefore:e.toISOString()}:{},...r?{timestampAfter:r.toISOString()}:{},...n.length>0?{identifiers:n}:{}},limit:l});_chunkZVK4HIDFcjs.c.call(void 0, p,u.map(t=>({...t,purposes:JSON.stringify(t.purposes),...t.purposes})))}exports.pullConsentPreferences = h;
2
+ //# sourceMappingURL=impl-WF5WVI2N.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/impl-WF5WVI2N.cjs","../src/commands/consent/pull-consent-preferences/impl.ts"],"names":["pullConsentPreferences","auth","partition","sombraAuth","file","transcendUrl","timestampBefore","timestampAfter","identifiers","concurrency","sombra","createSombraGotInstance","preferences","fetchConsentPreferences","writeCsv","pref"],"mappings":"AAAA,yGAA4B,wDAAyC,wDAAyC,gCAA6B,gCAA6B,gCAA6B,gCAA6B,wDAA0C,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCkBhY,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CAAc,CAAC,CAAA,CACf,WAAA,CAAAC,CACF,CAAA,CACe,CAEf,IAAMC,CAAAA,CAAS,MAAMC,kCAAAA,CAAwBN,CAAcJ,CAAAA,CAAME,CAAU,CAAA,CAGrES,CAAAA,CAAc,MAAMC,iCAAAA,CAAwBH,CAAQ,CACxD,SAAA,CAAAR,CAAAA,CACA,QAAA,CAAU,CACR,GAAII,CAAAA,CACA,CAAE,eAAA,CAAiBA,CAAAA,CAAgB,WAAA,CAAY,CAAE,CAAA,CACjD,CAAC,CAAA,CACL,GAAIC,CAAAA,CACA,CAAE,cAAA,CAAgBA,CAAAA,CAAe,WAAA,CAAY,CAAE,CAAA,CAC/C,CAAC,CAAA,CACL,GAAIC,CAAAA,CAAY,MAAA,CAAS,CAAA,CAAI,CAAE,WAAA,CAAAA,CAAY,CAAA,CAAI,CAAC,CAClD,CAAA,CACA,KAAA,CAAOC,CACT,CAAC,CAAA,CAGDK,iCAAAA,CACEV,CACAQ,CAAAA,CAAY,GAAA,CAAKG,CAAAA,EAAAA,CAAU,CACzB,GAAGA,CAAAA,CACH,QAAA,CAAU,IAAA,CAAK,SAAA,CAAUA,CAAAA,CAAK,QAAQ,CAAA,CACtC,GAAGA,CAAAA,CAAK,QACV,CAAA,CAAE,CACJ,CACF,CAAA,mCAAA","file":"/Users/benbrook/transcend/cli/dist/impl-WF5WVI2N.cjs","sourcesContent":[null,"import type { LocalContext } from '@/context';\n\nimport { fetchConsentPreferences } from '@/lib/consent-manager';\nimport { writeCsv } from '@/lib/cron';\nimport { createSombraGotInstance } from '@/lib/graphql';\n\ninterface PullConsentPreferencesCommandFlags {\n auth: string;\n partition: string;\n sombraAuth?: string;\n file: string;\n transcendUrl: string;\n timestampBefore?: Date;\n timestampAfter?: Date;\n identifiers?: string[];\n concurrency: number;\n}\n\nexport async function pullConsentPreferences(\n this: LocalContext,\n {\n auth,\n partition,\n sombraAuth,\n file,\n transcendUrl,\n timestampBefore,\n timestampAfter,\n identifiers = [],\n concurrency,\n }: PullConsentPreferencesCommandFlags,\n): Promise<void> {\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, sombraAuth);\n\n // Fetch preferences\n const preferences = await fetchConsentPreferences(sombra, {\n partition,\n filterBy: {\n ...(timestampBefore\n ? { timestampBefore: timestampBefore.toISOString() }\n : {}),\n ...(timestampAfter\n ? { timestampAfter: timestampAfter.toISOString() }\n : {}),\n ...(identifiers.length > 0 ? { identifiers } : {}),\n },\n limit: concurrency,\n });\n\n // Write to disk\n writeCsv(\n file,\n preferences.map((pref) => ({\n ...pref,\n purposes: JSON.stringify(pref.purposes),\n ...pref.purposes,\n })),\n );\n}\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkBN4LSJ6Ucjs = require('./chunk-BN4LSJ6U.cjs');require('./chunk-2VOZMXOE.cjs');var _chunkZVK4HIDFcjs = require('./chunk-ZVK4HIDF.cjs');require('./chunk-KR377AJU.cjs');var _chunkSJFPYDA3cjs = require('./chunk-SJFPYDA3.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');require('./chunk-EG4L6YAJ.cjs');require('./chunk-S6XB2PPW.cjs');require('./chunk-BY7W4UQF.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);async function x({auth:m,file:s,transcendUrl:f,dataSiloIds:p,subCategories:g,status:C,includeEncryptedSnippets:a}){try{let o=_chunkSJFPYDA3cjs.xe.call(void 0, f,m),S=await _chunkBN4LSJ6Ucjs.b.call(void 0, o,{dataSiloIds:p,subCategories:g,status:C,includeEncryptedSnippets:a});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Writing unstructured discovery files to file "${s}"...`));let r=[],b=S.map(t=>{let n={"Entry ID":t.id,"Data Silo ID":t.dataSiloId,"Object Path ID":t.scannedObjectPathId,"Object ID":t.scannedObjectId,...a?{Entry:t.name,"Context Snippet":t.contextSnippet}:{},"Data Category":`${t.dataSubCategory.category}:${t.dataSubCategory.name}`,"Classification Status":t.status,"Confidence Score":t.confidence,"Classification Method":t.classificationMethod,"Classifier Version":t.classifierVersion};return r=_chunkSJFPYDA3cjs.fc.call(void 0, [...r,...Object.keys(n)]),n});_chunkZVK4HIDFcjs.c.call(void 0, s,b,r)}catch(o){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`An error occurred syncing the unstructured discovery files: ${o.message}`)),process.exit(1)}_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced unstructured discovery files to disk at ${s}!`))}exports.pullUnstructuredDiscoveryFiles = x;
2
+ //# sourceMappingURL=impl-XKTX4RSJ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/impl-XKTX4RSJ.cjs","../src/commands/inventory/pull-unstructured-discovery-files/impl.ts"],"names":["pullUnstructuredDiscoveryFiles","auth","file","transcendUrl","dataSiloIds","subCategories","status","includeEncryptedSnippets","client","buildTranscendGraphQLClient","entries","pullUnstructuredSubDataPointRecommendations","logger","colors","headers","inputs","entry","result"],"mappings":"AAAA,iOAAwC,gCAA6B,wDAAyC,gCAA6B,wDAAkD,wDAAyC,gCAA6B,gCAA6B,gCAA6B,gFCE1S,MAiBnB,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,wBAAA,CAAAC,CACF,CAAA,CACe,CACf,GAAI,CAEF,IAAMC,CAAAA,CAASC,kCAAAA,CAA4BN,CAAcF,CAAI,CAAA,CAEvDS,CAAAA,CAAU,MAAMC,iCAAAA,CAA4CH,CAAQ,CACxE,WAAA,CAAAJ,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,wBAAA,CAAAC,CACF,CAAC,CAAA,CAEDK,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,OAAA,CACL,CAAA,8CAAA,EAAiDX,CAAI,CAAA,IAAA,CACvD,CACF,CAAA,CACA,IAAIY,CAAAA,CAAoB,CAAC,CAAA,CACnBC,CAAAA,CAASL,CAAAA,CAAQ,GAAA,CAAKM,CAAAA,EAAU,CACpC,IAAMC,CAAAA,CAAS,CACb,UAAA,CAAYD,CAAAA,CAAM,EAAA,CAClB,cAAA,CAAgBA,CAAAA,CAAM,UAAA,CACtB,gBAAA,CAAkBA,CAAAA,CAAM,mBAAA,CACxB,WAAA,CAAaA,CAAAA,CAAM,eAAA,CACnB,GAAIT,CAAAA,CACA,CAAE,KAAA,CAAOS,CAAAA,CAAM,IAAA,CAAM,iBAAA,CAAmBA,CAAAA,CAAM,cAAe,CAAA,CAC7D,CAAC,CAAA,CACL,eAAA,CAAiB,CAAA,EAAA","file":"/Users/benbrook/transcend/cli/dist/impl-XKTX4RSJ.cjs","sourcesContent":[null,"import type { LocalContext } from '@/context';\nimport type { UnstructuredSubDataPointRecommendationStatus } from '@transcend-io/privacy-types';\nimport colors from 'colors';\nimport { uniq } from 'lodash-es';\nimport { writeCsv } from '@/lib/cron';\nimport { pullUnstructuredSubDataPointRecommendations } from '@/lib/data-inventory';\nimport { buildTranscendGraphQLClient } from '@/lib/graphql';\nimport { logger } from '@/logger';\n\ninterface PullUnstructuredDiscoveryFilesCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n subCategories?: string[];\n status?: UnstructuredSubDataPointRecommendationStatus[];\n includeEncryptedSnippets: boolean;\n}\n\nexport async function pullUnstructuredDiscoveryFiles(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n dataSiloIds,\n subCategories,\n status,\n includeEncryptedSnippets,\n }: PullUnstructuredDiscoveryFilesCommandFlags,\n): Promise<void> {\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const entries = await pullUnstructuredSubDataPointRecommendations(client, {\n dataSiloIds,\n subCategories, // TODO: https://transcend.height.app/T-40482 - do by name not ID\n status,\n includeEncryptedSnippets,\n });\n\n logger.info(\n colors.magenta(\n `Writing unstructured discovery files to file \"${file}\"...`,\n ),\n );\n let headers: string[] = [];\n const inputs = entries.map((entry) => {\n const result = {\n 'Entry ID': entry.id,\n 'Data Silo ID': entry.dataSiloId,\n 'Object Path ID': entry.scannedObjectPathId,\n 'Object ID': entry.scannedObjectId,\n ...(includeEncryptedSnippets\n ? { Entry: entry.name, 'Context Snippet': entry.contextSnippet }\n : {}),\n 'Data Category': `${entry.dataSubCategory.category}:${entry.dataSubCategory.name}`,\n 'Classification Status': entry.status,\n 'Confidence Score': entry.confidence,\n 'Classification Method': entry.classificationMethod,\n 'Classifier Version': entry.classifierVersion,\n };\n headers = uniq([...headers, ...Object.keys(result)]);\n return result;\n });\n writeCsv(file, inputs, headers);\n } catch (err) {\n logger.error(\n colors.red(\n `An error occurred syncing the unstructured discovery files: ${err.message}`,\n ),\n );\n process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced unstructured discovery files to disk at ${file}!`,\n ),\n );\n}\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7OIWW7TJcjs = require('./chunk-7OIWW7TJ.cjs');require('./chunk-ZVK4HIDF.cjs');require('./chunk-KR377AJU.cjs');require('./chunk-SJFPYDA3.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-EG4L6YAJ.cjs');require('./chunk-S6XB2PPW.cjs');require('./chunk-BY7W4UQF.cjs');async function c({auth:n,transcendUrl:e,file:i,concurrency:r,actions:o,sombraAuth:s}){await _chunk7OIWW7TJcjs.a.call(void 0, {file:i,transcendUrl:e,concurrency:r,requestActions:o,auth:n,sombraAuth:s})}exports.pullIdentifiers = c;
2
+ //# sourceMappingURL=impl-XUC6HWEZ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/impl-XUC6HWEZ.cjs","../src/commands/request/preflight/pull-identifiers/impl.ts"],"names":["pullIdentifiers","auth","transcendUrl","file","concurrency","actions","sombraAuth","pullManualEnrichmentIdentifiersToCsv"],"mappings":"AAAA,iIAAwC,gCAA6B,gCAA6B,gCAA6B,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCanP,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CACF,CAAA,CACe,CACf,MAAMC,iCAAAA,CACJ,IAAA,CAAAJ,CAAAA,CACA,YAAA,CAAAD,CAAAA,CACA,WAAA,CAAAE,CAAAA,CACA,cAAA,CAAgBC,CAAAA,CAChB,IAAA,CAAAJ,CAAAA,CACA,UAAA,CAAAK,CACF,CAAC,CACH,CAAA,4BAAA","file":"/Users/benbrook/transcend/cli/dist/impl-XUC6HWEZ.cjs","sourcesContent":[null,"import type { LocalContext } from '@/context';\nimport { pullManualEnrichmentIdentifiersToCsv } from '@/lib/manual-enrichment';\nimport type { RequestAction } from '@transcend-io/privacy-types';\n\ninterface PullIdentifiersCommandFlags {\n auth: string;\n sombraAuth?: string;\n transcendUrl: string;\n file: string;\n actions?: RequestAction[];\n concurrency: number;\n}\n\nexport async function pullIdentifiers(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n file,\n concurrency,\n actions,\n sombraAuth,\n }: PullIdentifiersCommandFlags,\n): Promise<void> {\n await pullManualEnrichmentIdentifiersToCsv({\n file,\n transcendUrl,\n concurrency,\n requestActions: actions,\n auth,\n sombraAuth,\n });\n}\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunk7R7EIHBRcjs = require('./chunk-7R7EIHBR.cjs');require('./chunk-UJ3GGOXX.cjs');require('./chunk-UEGX6GZ2.cjs');require('./chunk-SAEKBZGF.cjs');var _chunkSJFPYDA3cjs = require('./chunk-SJFPYDA3.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkEG4L6YAJcjs = require('./chunk-EG4L6YAJ.cjs');require('./chunk-S6XB2PPW.cjs');require('./chunk-BY7W4UQF.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _child_process = require('child_process');var l='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 S({auth:d,scanPath:o,ignoreDirs:f,repositoryName:u,transcendUrl:y}){let e=u;if(!e)try{let t=_child_process.execSync.call(void 0, `cd ${o} && git config --get remote.origin.url`).toString("utf-8").trim();[e]=t.includes("https:")?t.split("/").slice(3).join("/").split("."):(t.split(":").pop()||"").split("."),e||(_chunkZUNVPK23cjs.a.error(_colors2.default.red(l)),process.exit(1))}catch(a){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`${l} - Got error: ${a.message}`)),process.exit(1)}let h=_chunkSJFPYDA3cjs.xe.call(void 0, y,d),i=await _chunk7R7EIHBRcjs.b.call(void 0, {scanPath:o,ignoreDirs:f,repositoryName:e});await _chunkSJFPYDA3cjs.se.call(void 0, h,i);let s=new URL(_chunkEG4L6YAJcjs.b);s.pathname="/code-scanning/code-packages",_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Scan found ${i.length} packages at ${o}! View results at '${s.href}'`))}exports.scanPackages = S;
2
+ //# sourceMappingURL=impl-Y2DSR6T2.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/impl-Y2DSR6T2.cjs","../src/commands/inventory/scan-packages/impl.ts"],"names":["REPO_ERROR","scanPackages","auth","scanPath","ignoreDirs","repositoryName","transcendUrl","gitRepositoryName","url","execSync","logger","colors","err"],"mappings":"AAAA,iOAAwC,gCAA6B,gCAA6B,gCAA6B,wDAAkD,wDAAyC,wDAAyC,gCAA6B,gCAA6B,gFCE1S,8CAIM,IAEnBA,CAAAA,CACJ,0LAAA,CAYF,MAAA,SAAsBC,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CAEf,IAAIC,CAAAA,CAAoBF,CAAAA,CACxB,EAAA,CAAI,CAACE,CAAAA,CACH,GAAI,CAKF,IAAMC,CAAAA,CAJOC,qCAAAA,CACX,GAAA,EAAMN,CAAQ,CAAA,sCAAA,CAChB,CAAA,CAEiB,QAAA,CAAS,OAAO,CAAA,CAAE,IAAA,CAAK,CAAA,CACxC,CAACI,CAAiB,CAAA,CAAKC,CAAAA,CAAI,QAAA,CAAS,QAAQ,CAAA,CAExCA,CAAAA,CAAI,KAAA,CAAM,GAAG,CAAA,CAAE,KAAA,CAAM,CAAC,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA,CAAE,KAAA,CAAM,GAAG,CAAA,CAAA,CAD1CA,CAAAA,CAAI,KAAA,CAAM,GAAG,CAAA,CAAE,GAAA,CAAI,CAAA,EAAK,EAAA,CAAA,CAAI,KAAA,CAAM,GAAG,CAAA,CAErCD,CAAAA,EAAAA,CACHG,mBAAAA,CAAO,KAAA,CAAMC,gBAAAA,CAAO,GAAA,CAAIX,CAAU,CAAC,CAAA,CACnC,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,CAElB,CAAA,KAAA,CAASY,CAAAA,CAAK,CACZF,mBAAAA,CAAO,KAAA,CAAMC,gBAAAA,CAAO,GAAA,CAAI,CAAA,EAAA","file":"/Users/benbrook/transcend/cli/dist/impl-Y2DSR6T2.cjs","sourcesContent":[null,"import type { LocalContext } from '@/context';\nimport { logger } from '@/logger';\nimport colors from 'colors';\nimport { ADMIN_DASH } from '@/constants';\nimport { findCodePackagesInFolder } from '@/lib/code-scanning';\nimport { buildTranscendGraphQLClient, syncCodePackages } from '@/lib/graphql';\nimport { execSync } from 'child_process';\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\ninterface 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 {\n auth,\n scanPath,\n ignoreDirs,\n repositoryName,\n transcendUrl,\n }: ScanPackagesCommandFlags,\n): Promise<void> {\n // Ensure repository name is specified\n let gitRepositoryName = repositoryName;\n if (!gitRepositoryName) {\n try {\n const name = execSync(\n `cd ${scanPath} && git config --get remote.origin.url`,\n );\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 process.exit(1);\n }\n } catch (err) {\n logger.error(colors.red(`${REPO_ERROR} - Got error: ${err.message}`));\n 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}! ` +\n `View results at '${newUrl.href}'`,\n ),\n );\n}\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunk2KP53GQ4cjs = require('./chunk-2KP53GQ4.cjs');var _chunkKOV2SQO2cjs = require('./chunk-KOV2SQO2.cjs');var _chunkUJ3GGOXXcjs = require('./chunk-UJ3GGOXX.cjs');require('./chunk-UEGX6GZ2.cjs');require('./chunk-SAEKBZGF.cjs');var _chunkSJFPYDA3cjs = require('./chunk-SJFPYDA3.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');require('./chunk-EG4L6YAJ.cjs');require('./chunk-S6XB2PPW.cjs');require('./chunk-BY7W4UQF.cjs');var _path = require('path');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _fs = require('fs');async function Q({auth:F,dataFlowsYmlFolder:a,output:x,ignoreYmls:C=[],transcendUrl:k}){a||(_chunkZUNVPK23cjs.a.error(_colors2.default.red("Missing required arg: --dataFlowsYmlFolder=./working/data-flows/")),process.exit(1)),(!_fs.existsSync.call(void 0, a)||!_fs.lstatSync.call(void 0, a).isDirectory())&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Folder does not exist: "${a}"`)),process.exit(1));let N=C.map(t=>t.split(".")[0]),l=_chunkUJ3GGOXXcjs.c.call(void 0, a).map(t=>{let{"data-flows":o=[]}=_chunkKOV2SQO2cjs.d.call(void 0, _path.join.call(void 0, a,t)),{adTechDataSilos:m,siteTechDataSilos:r}=_chunk2KP53GQ4cjs.a.call(void 0, o,{serviceToSupportedIntegration:d,serviceToTitle:u});return{adTechDataSilos:m,siteTechDataSilos:r,organizationName:t.split(".")[0]}}),s={};l.forEach(({adTechDataSilos:t,siteTechDataSilos:o,organizationName:m})=>{[...t,...o].forEach(e=>{let n=e["outer-type"]||e.integrationName;s[n]||(s[n]=[]),s[n].push(m),s[n]=[...new Set(s[n])]})});let p=[...new Set(l.map(({adTechDataSilos:t})=>t.map(o=>o["outer-type"]||o.integrationName)).flat())],f=_chunkSJFPYDA3cjs.$b.call(void 0, [...new Set(l.map(({siteTechDataSilos:t})=>t.map(o=>o["outer-type"]||o.integrationName)).flat())],p),i={};l.forEach(({adTechDataSilos:t,siteTechDataSilos:o})=>{[...t,...o].forEach(r=>{let e=r["outer-type"]||r.integrationName,n=_optionalChain([r, 'access', _ => _.attributes, 'optionalAccess', _2 => _2.find, 'call', _3 => _3(E=>E.key==="Found On Domain")]);i[e]||(i[e]=[]),i[e].push(..._optionalChain([n, 'optionalAccess', _4 => _4.values])||[]),i[e]=[...new Set(i[e])]})});let A=_chunkSJFPYDA3cjs.xe.call(void 0, k,F),{serviceToTitle:u,serviceToSupportedIntegration:d}=await _chunkSJFPYDA3cjs.ve.call(void 0, A),D=[...p,...f].map(t=>({title:u[t],...d[t]?{integrationName:t}:{integrationName:"promptAPerson","outer-type":t},attributes:[{key:"Tech Type",values:["Ad Tech"]},{key:"Business Units",values:_chunkSJFPYDA3cjs.$b.call(void 0, s[t]||[],N)},{key:"Found On Domain",values:i[t]||[]}]}));_chunkZUNVPK23cjs.a.log(`Total Services: ${D.length}`),_chunkZUNVPK23cjs.a.log(`Ad Tech Services: ${p.length}`),_chunkZUNVPK23cjs.a.log(`Site Tech Services: ${f.length}`),_chunkKOV2SQO2cjs.e.call(void 0, x,{"data-silos":D})}exports.deriveDataSilosFromDataFlowsCrossInstance = Q;
2
+ //# sourceMappingURL=impl-YLHGBEOH.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/impl-YLHGBEOH.cjs","../src/commands/inventory/derive-data-silos-from-data-flows-cross-instance/impl.ts"],"names":["deriveDataSilosFromDataFlowsCrossInstance","auth","dataFlowsYmlFolder","output","ignoreYmls","transcendUrl","logger","colors","existsSync","lstatSync","instancesToIgnore","x","dataSiloInputs","listFiles","directory","dataFlows","readTranscendYaml","join","adTechDataSilos","siteTechDataSilos","dataFlowsToDataSilos","serviceToSupportedIntegration","serviceToTitle","serviceToInstance","organizationName","dataSilo","service","adTechIntegrations","silo","siteTechIntegrations","difference_default","serviceToFoundOnDomain","foundOnDomain","attr","client","buildTranscendGraphQLClient","fetchAndIndexCatalogs","dataSilos"],"mappings":"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","file":"/Users/benbrook/transcend/cli/dist/impl-YLHGBEOH.cjs","sourcesContent":[null,"import type { LocalContext } from '@/context';\nimport {\n fetchAndIndexCatalogs,\n buildTranscendGraphQLClient,\n} from '@/lib/graphql';\nimport { join } from 'path';\nimport { difference } from 'lodash-es';\nimport colors from 'colors';\nimport { logger } from '@/logger';\nimport { dataFlowsToDataSilos } from '@/lib/consent-manager/dataFlowsToDataSilos';\nimport { DataFlowInput } from '@/codecs';\nimport { existsSync, lstatSync } from 'fs';\nimport { listFiles } from '@/lib/api-keys';\nimport { readTranscendYaml, writeTranscendYaml } from '@/lib/readTranscendYaml';\n\ninterface DeriveDataSilosFromDataFlowsCrossInstanceCommandFlags {\n auth: string;\n dataFlowsYmlFolder: string;\n output: string;\n ignoreYmls?: string[];\n transcendUrl: string;\n}\n\nexport async function deriveDataSilosFromDataFlowsCrossInstance(\n this: LocalContext,\n {\n auth,\n dataFlowsYmlFolder,\n output,\n ignoreYmls = [],\n transcendUrl,\n }: DeriveDataSilosFromDataFlowsCrossInstanceCommandFlags,\n): Promise<void> {\n // Ensure folder is passed to dataFlowsYmlFolder\n if (!dataFlowsYmlFolder) {\n logger.error(\n colors.red(\n 'Missing required arg: --dataFlowsYmlFolder=./working/data-flows/',\n ),\n );\n process.exit(1);\n }\n\n // Ensure folder is passed\n if (\n !existsSync(dataFlowsYmlFolder) ||\n !lstatSync(dataFlowsYmlFolder).isDirectory()\n ) {\n logger.error(colors.red(`Folder does not exist: \"${dataFlowsYmlFolder}\"`));\n process.exit(1);\n }\n\n // Ignore the data flows in these yml files\n const instancesToIgnore = ignoreYmls.map((x) => x.split('.')[0]);\n\n // Map over each data flow yml file and convert to data silo configurations\n const dataSiloInputs = listFiles(dataFlowsYmlFolder).map((directory) => {\n // read in the data flows for a specific instance\n const { 'data-flows': dataFlows = [] } = readTranscendYaml(\n join(dataFlowsYmlFolder, directory),\n );\n\n // map the data flows to data silos\n const { adTechDataSilos, siteTechDataSilos } = dataFlowsToDataSilos(\n dataFlows as DataFlowInput[],\n {\n serviceToSupportedIntegration,\n serviceToTitle,\n },\n );\n\n return {\n adTechDataSilos,\n siteTechDataSilos,\n organizationName: directory.split('.')[0],\n };\n });\n\n // Mapping from service name to instances that have that service\n const serviceToInstance: { [k in string]: string[] } = {};\n dataSiloInputs.forEach(\n ({ adTechDataSilos, siteTechDataSilos, organizationName }) => {\n const allDataSilos = [...adTechDataSilos, ...siteTechDataSilos];\n allDataSilos.forEach((dataSilo) => {\n const service = dataSilo['outer-type'] || dataSilo.integrationName;\n // create mapping to instance\n if (!serviceToInstance[service]) {\n serviceToInstance[service] = [];\n }\n serviceToInstance[service]!.push(organizationName);\n serviceToInstance[service] = [...new Set(serviceToInstance[service])];\n });\n },\n );\n\n // List of ad tech integrations\n const adTechIntegrations = [\n ...new Set(\n dataSiloInputs\n .map(({ adTechDataSilos }) =>\n adTechDataSilos.map(\n (silo) => silo['outer-type'] || silo.integrationName,\n ),\n )\n .flat(),\n ),\n ];\n\n // List of site tech integrations\n const siteTechIntegrations = difference(\n [\n ...new Set(\n dataSiloInputs\n .map(({ siteTechDataSilos }) =>\n siteTechDataSilos.map(\n (silo) => silo['outer-type'] || silo.integrationName,\n ),\n )\n .flat(),\n ),\n ],\n adTechIntegrations,\n );\n\n // Mapping from service name to list of\n const serviceToFoundOnDomain: { [k in string]: string[] } = {};\n dataSiloInputs.forEach(({ adTechDataSilos, siteTechDataSilos }) => {\n const allDataSilos = [...adTechDataSilos, ...siteTechDataSilos];\n allDataSilos.forEach((dataSilo) => {\n const service = dataSilo['outer-type'] || dataSilo.integrationName;\n const foundOnDomain = dataSilo.attributes?.find(\n (attr) => attr.key === 'Found On Domain',\n );\n // create mapping to instance\n if (!serviceToFoundOnDomain[service]) {\n serviceToFoundOnDomain[service] = [];\n }\n serviceToFoundOnDomain[service]!.push(...(foundOnDomain?.values || []));\n serviceToFoundOnDomain[service] = [\n ...new Set(serviceToFoundOnDomain[service]),\n ];\n });\n });\n\n // Fetch all integrations in the catalog\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const { serviceToTitle, serviceToSupportedIntegration } =\n await fetchAndIndexCatalogs(client);\n\n // construct the aggregated data silo inputs\n const dataSilos = [...adTechIntegrations, ...siteTechIntegrations].map(\n (service) => ({\n title: serviceToTitle[service],\n ...(serviceToSupportedIntegration[service]\n ? { integrationName: service }\n : { integrationName: 'promptAPerson', 'outer-type': service }),\n attributes: [\n {\n key: 'Tech Type',\n values: ['Ad Tech'],\n },\n {\n key: 'Business Units',\n values: difference(\n serviceToInstance[service] || [],\n instancesToIgnore,\n ),\n },\n {\n key: 'Found On Domain',\n values: serviceToFoundOnDomain[service] || [],\n },\n ],\n }),\n );\n\n // Log output\n logger.log(`Total Services: ${dataSilos.length}`);\n logger.log(`Ad Tech Services: ${adTechIntegrations.length}`);\n logger.log(`Site Tech Services: ${siteTechIntegrations.length}`);\n\n // Write to yaml\n writeTranscendYaml(output, {\n 'data-silos': dataSilos,\n });\n}\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkUJ3GGOXXcjs = require('./chunk-UJ3GGOXX.cjs');var _chunkLYJU4HTNcjs = require('./chunk-LYJU4HTN.cjs');require('./chunk-TEOKGAUX.cjs');require('./chunk-KR377AJU.cjs');require('./chunk-UEGX6GZ2.cjs');require('./chunk-SAEKBZGF.cjs');var _chunkSJFPYDA3cjs = require('./chunk-SJFPYDA3.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');require('./chunk-EG4L6YAJ.cjs');require('./chunk-S6XB2PPW.cjs');require('./chunk-BY7W4UQF.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _privacytypes = require('@transcend-io/privacy-types');async function M({auth:f,bundleTypes:r=[_privacytypes.ConsentBundleType.Production,_privacytypes.ConsentBundleType.Test],deploy:i,transcendUrl:s}){let e=await _chunkUJ3GGOXXcjs.b.call(void 0, f);typeof e=="string"?(await _chunkLYJU4HTNcjs.a.call(void 0, {deploy:i,transcendUrl:s,auth:e,bundleTypes:r}),_chunkZUNVPK23cjs.a.info(_colors2.default.green("Successfully updated Consent Manager!"))):(await _chunkSJFPYDA3cjs.a.call(void 0, e,async o=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating Consent Manager for organization "${o.organizationName}"...`)),await _chunkLYJU4HTNcjs.a.call(void 0, {deploy:i,transcendUrl:s,auth:o.apiKey,bundleTypes:r}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated Consent Manager for organization "${o.organizationName}"!`))}),_chunkZUNVPK23cjs.a.info(_colors2.default.green("Successfully updated Consent Managers!")))}exports.updateConsentManager = M;
2
+ //# sourceMappingURL=impl-YNXTKFTC.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/impl-YNXTKFTC.cjs","../src/commands/consent/update-consent-manager/impl.ts"],"names":["updateConsentManager","auth","bundleTypes","ConsentBundleType","deploy","transcendUrl","apiKeyOrList","validateTranscendAuth","updateConsentManagerVersionToLatest","logger","colors","mapSeries","apiKey"],"mappings":"AAAA,iOAAwC,wDAAyC,gCAA6B,gCAA6B,gCAA6B,gCAA6B,wDAAyC,wDAAyC,gCAA6B,gCAA6B,gCAA6B,gFCC3V,2DACe,MAclC,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CAAc,CAACC,+BAAAA,CAAkB,UAAA,CAAYA,+BAAAA,CAAkB,IAAI,CAAA,CACnE,MAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CAEf,IAAMC,CAAAA,CAAe,MAAMC,iCAAAA,CAA0B,CAAA,CAGjD,OAAOD,CAAAA,EAAiB,QAAA,CAAA,CAE1B,MAAME,iCAAAA,CACJ,MAAA,CAAAJ,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,IAAA,CAAMC,CAAAA,CACN,WAAA,CAAAJ,CACF,CAAC,CAAA,CACDO,mBAAAA,CAAO,IAAA,CAAKC,gBAAAA,CAAO,KAAA,CAAM,uCAAuC,CAAC,CAAA,CAAA,CAAA,CAEjE,MAAMC,iCAAAA,CAAUL,CAAc,MAAOM,CAAAA,EAAW,CAC9CH,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,OAAA,CACL,CAAA,2CAAA,EAA8CE,CAAAA,CAAO,gBAAgB,CAAA,IAAA,CACvE,CACF,CAAA,CAEA,MAAMJ,iCAAAA,CACJ,MAAA,CAAAJ,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,IAAA,CAAMO,CAAAA,CAAO,MAAA,CACb,WAAA,CAAAV,CACF,CAAC,CAAA,CAEDO,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,KAAA,CACL,CAAA,uDAAA,EAA0DE,CAAAA,CAAO,gBAAgB,CAAA,EAAA,CACnF,CACF,CACF,CAAC,CAAA,CACDH,mBAAAA,CAAO,IAAA,CAAKC,gBAAAA,CAAO,KAAA,CAAM,wCAAwC,CAAC,CAAA,CAEtE,CAAA,iCAAA","file":"/Users/benbrook/transcend/cli/dist/impl-YNXTKFTC.cjs","sourcesContent":[null,"import type { LocalContext } from '@/context';\nimport colors from 'colors';\nimport { ConsentBundleType } from '@transcend-io/privacy-types';\nimport { mapSeries } from '@/lib/bluebird-replace';\n\nimport { logger } from '@/logger';\nimport { updateConsentManagerVersionToLatest } from '@/lib/consent-manager';\nimport { validateTranscendAuth } from '@/lib/api-keys';\n\ninterface 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 // 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(\n `Updating Consent Manager for organization \"${apiKey.organizationName}\"...`,\n ),\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"]}
@@ -0,0 +1,6 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkKOV2SQO2cjs = require('./chunk-KOV2SQO2.cjs');var _chunkOVMPZ75Rcjs = require('./chunk-OVMPZ75R.cjs');var _chunkUJ3GGOXXcjs = require('./chunk-UJ3GGOXX.cjs');require('./chunk-UEGX6GZ2.cjs');require('./chunk-SAEKBZGF.cjs');var _chunkSJFPYDA3cjs = require('./chunk-SJFPYDA3.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkEG4L6YAJcjs = require('./chunk-EG4L6YAJ.cjs');require('./chunk-S6XB2PPW.cjs');var _chunkBY7W4UQFcjs = require('./chunk-BY7W4UQF.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _path = require('path');var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);async function M({auth:x,resources:g=_chunkOVMPZ75Rcjs.h,file:t,transcendUrl:p,dataSiloIds:d=[],integrationNames:T=[],trackerStatuses:y=_chunkOVMPZ75Rcjs.i,pageSize:S,skipDatapoints:h,skipSubDatapoints:$,includeGuessedCategories:A,debug:a}){let i=await _chunkUJ3GGOXXcjs.b.call(void 0, x),C=g.includes("all")?Object.values(_chunkBY7W4UQFcjs.d):g;if(typeof i=="string"){try{let r=_chunkSJFPYDA3cjs.xe.call(void 0, p,i),e=await _chunkSJFPYDA3cjs.je.call(void 0, r,{dataSiloIds:d,integrationNames:T,resources:C,pageSize:S,debug:a,skipDatapoints:h,skipSubDatapoints:$,includeGuessedCategories:A,trackerStatuses:y});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Writing configuration to file "${t}"...`)),_chunkKOV2SQO2cjs.e.call(void 0, t,e)}catch(r){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`An error occurred syncing the schema: ${a?r.stack:r.message}`)),process.exit(1)}_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced yaml file to disk at ${t}! View at ${_chunkEG4L6YAJcjs.c}`))}else{if(!_fs2.default.lstatSync(t).isDirectory())throw new Error("File is expected to be a folder when passing in a list of API keys to pull from. e.g. --file=./working/");let r=[];await _chunkSJFPYDA3cjs.a.call(void 0, i,async(e,L)=>{let s=`[${L+1}/${i.length}][${e.organizationName}] `;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`~~~
2
+
3
+ ${s}Attempting to pull configuration...
4
+
5
+ ~~~`));let _=_chunkSJFPYDA3cjs.xe.call(void 0, p,e.apiKey);try{let c=await _chunkSJFPYDA3cjs.je.call(void 0, _,{dataSiloIds:d,integrationNames:T,resources:C,pageSize:S,debug:a,skipDatapoints:h,skipSubDatapoints:$,includeGuessedCategories:A,trackerStatuses:y}),w=_path.join.call(void 0, t,`${e.organizationName}.yml`);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Writing configuration to file "${w}"...`)),_chunkKOV2SQO2cjs.e.call(void 0, w,c),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`${s}Successfully pulled configuration!`))}catch(c){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`${s}Failed to sync configuration. - ${c.message}`)),r.push(e.organizationName)}}),r.length>0&&(_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Sync encountered errors for "${r.join(",")}". View output above for more information, or check out ${_chunkEG4L6YAJcjs.c}`)),process.exit(1))}}exports.pull = M;
6
+ //# sourceMappingURL=impl-Z5WKVIBW.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/impl-Z5WKVIBW.cjs","../src/commands/inventory/pull/impl.ts"],"names":["pull","auth","resources","DEFAULT_TRANSCEND_PULL_RESOURCES","file","transcendUrl","dataSiloIds","integrationNames","trackerStatuses","DEFAULT_CONSENT_TRACKER_STATUSES","pageSize","skipDatapoints","skipSubDatapoints","includeGuessedCategories","debug","apiKeyOrList","validateTranscendAuth","resourcesToPull","TranscendPullResource","client","buildTranscendGraphQLClient","configuration","pullTranscendConfiguration","logger","colors","writeTranscendYaml","err"],"mappings":"AAAA,iOAAwC,wDAAgD,wDAAyC,gCAA6B,gCAA6B,wDAAyD,wDAAyC,wDAAyC,gCAA6B,wDAAyC,gFCSzX,4BAEE,gEACN,MAyBf,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CAAYC,mBAAAA,CACZ,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CAAc,CAAC,CAAA,CACf,gBAAA,CAAAC,CAAAA,CAAmB,CAAC,CAAA,CACpB,eAAA,CAAAC,CAAAA,CAAkBC,mBAAAA,CAClB,QAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,iBAAA,CAAAC,CAAAA,CACA,wBAAA,CAAAC,CAAAA,CACA,KAAA,CAAAC,CACF,CAAA,CACe,CAEf,IAAMC,CAAAA,CAAe,MAAMC,iCAAAA,CAA0B,CAAA,CAE/CC,CAAAA,CAA2Cf,CAAAA,CAAU,QAAA,CAAS,KAAK,CAAA,CACrE,MAAA,CAAO,MAAA,CAAOgB,mBAAqB,CAAA,CAClChB,CAAAA,CAGL,EAAA,CAAI,OAAOa,CAAAA,EAAiB,QAAA,CAAU,CACpC,GAAI,CAEF,IAAMI,CAAAA,CAASC,kCAAAA,CAA4Bf,CAAcU,CAAY,CAAA,CAE/DM,CAAAA,CAAgB,MAAMC,kCAAAA,CAA2BH,CAAQ,CAC7D,WAAA,CAAAb,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,SAAA,CAAWU,CAAAA,CACX,QAAA,CAAAP,CAAAA,CACA,KAAA,CAAAI,CAAAA,CACA,cAAA,CAAAH,CAAAA,CACA,iBAAA,CAAAC,CAAAA,CACA,wBAAA,CAAAC,CAAAA,CACA,eAAA,CAAAL,CACF,CAAC,CAAA,CAEDe,mBAAAA,CAAO,IAAA,CAAKC,gBAAAA,CAAO,OAAA,CAAQ,CAAA,+BAAA,EAAkCpB,CAAI,CAAA,IAAA,CAAM,CAAC,CAAA,CACxEqB,iCAAAA,CAAmBrB,CAAMiB,CAAa,CACxC,CAAA,KAAA,CAASK,CAAAA,CAAK,CACZH,mBAAAA,CAAO,KAAA,CACLC,gBAAAA,CAAO,GAAA,CACL,CAAA,sCAAA,EACEV,CAAAA,CAAQY,CAAAA,CAAI,KAAA,CAAQA,CAAAA,CAAI,OAC1B,CAAA,CAAA;AA0BA;AAAgB;AAAA;AAiD1B,GAAA","file":"/Users/benbrook/transcend/cli/dist/impl-Z5WKVIBW.cjs","sourcesContent":[null,"import { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport type { LocalContext } from '@/context';\nimport { TranscendPullResource } from '@/enums';\nimport {\n DEFAULT_CONSENT_TRACKER_STATUSES,\n DEFAULT_TRANSCEND_PULL_RESOURCES,\n} from './command';\n\nimport { logger } from '@/logger';\nimport colors from 'colors';\nimport { mapSeries } from '@/lib/bluebird-replace';\nimport { join } from 'path';\nimport fs from 'fs';\nimport {\n buildTranscendGraphQLClient,\n pullTranscendConfiguration,\n} from '@/lib/graphql';\n\nimport { writeTranscendYaml } from '@/lib/readTranscendYaml';\nimport { ADMIN_DASH_INTEGRATIONS } from '@/constants';\nimport { validateTranscendAuth } from '@/lib/api-keys';\n\ninterface PullCommandFlags {\n auth: string;\n resources?: (TranscendPullResource | 'all')[];\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n integrationNames?: string[];\n trackerStatuses?: ConsentTrackerStatus[];\n pageSize: number;\n skipDatapoints: boolean;\n skipSubDatapoints: boolean;\n includeGuessedCategories: boolean;\n debug: boolean;\n}\n\nexport async function pull(\n this: LocalContext,\n {\n auth,\n resources = DEFAULT_TRANSCEND_PULL_RESOURCES,\n file,\n transcendUrl,\n dataSiloIds = [],\n integrationNames = [],\n trackerStatuses = DEFAULT_CONSENT_TRACKER_STATUSES,\n pageSize,\n skipDatapoints,\n skipSubDatapoints,\n includeGuessedCategories,\n debug,\n }: PullCommandFlags,\n): Promise<void> {\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n const resourcesToPull: TranscendPullResource[] = resources.includes('all')\n ? Object.values(TranscendPullResource)\n : (resources as TranscendPullResource[]);\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 const configuration = await pullTranscendConfiguration(client, {\n dataSiloIds,\n integrationNames,\n resources: resourcesToPull,\n pageSize,\n debug,\n skipDatapoints,\n skipSubDatapoints,\n includeGuessedCategories,\n trackerStatuses,\n });\n\n logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n writeTranscendYaml(file, configuration);\n } catch (err) {\n logger.error(\n colors.red(\n `An error occurred syncing the schema: ${\n debug ? err.stack : err.message\n }`,\n ),\n );\n process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced yaml file to disk at ${file}! View at ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n } else {\n if (!fs.lstatSync(file).isDirectory()) {\n throw new Error(\n 'File is expected to be a folder when passing in a list of API keys to pull from. e.g. --file=./working/',\n );\n }\n\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${\n apiKey.organizationName\n }] `;\n logger.info(\n colors.magenta(\n `~~~\\n\\n${prefix}Attempting to pull configuration...\\n\\n~~~`,\n ),\n );\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKey.apiKey);\n\n try {\n const configuration = await pullTranscendConfiguration(client, {\n dataSiloIds,\n integrationNames,\n resources: resourcesToPull,\n pageSize,\n debug,\n skipDatapoints,\n skipSubDatapoints,\n includeGuessedCategories,\n trackerStatuses,\n });\n\n const filePath = join(file, `${apiKey.organizationName}.yml`);\n logger.info(\n colors.magenta(`Writing configuration to file \"${filePath}\"...`),\n );\n writeTranscendYaml(filePath, configuration);\n\n logger.info(\n colors.green(`${prefix}Successfully pulled configuration!`),\n );\n } catch (err) {\n logger.error(\n colors.red(`${prefix}Failed to sync configuration. - ${err.message}`),\n );\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 process.exit(1);\n }\n }\n}\n"]}
@@ -0,0 +1,9 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkUJ3GGOXXcjs = require('./chunk-UJ3GGOXX.cjs');require('./chunk-2VOZMXOE.cjs');var _chunkZVK4HIDFcjs = require('./chunk-ZVK4HIDF.cjs');var _chunkLYJU4HTNcjs = require('./chunk-LYJU4HTN.cjs');require('./chunk-TEOKGAUX.cjs');require('./chunk-KR377AJU.cjs');require('./chunk-UEGX6GZ2.cjs');require('./chunk-SAEKBZGF.cjs');var _chunkSJFPYDA3cjs = require('./chunk-SJFPYDA3.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkEG4L6YAJcjs = require('./chunk-EG4L6YAJ.cjs');require('./chunk-S6XB2PPW.cjs');require('./chunk-BY7W4UQF.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _path = require('path');var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);async function q({auth:A,start:C,end:f,folder:r,bin:l,transcendUrl:N}){let m=await _chunkUJ3GGOXXcjs.b.call(void 0, A);_fs2.default.existsSync(r)&&!_fs2.default.lstatSync(r).isDirectory()&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red('The provided argument "folder" was passed a file. expected: folder="./consent-metrics/"')),process.exit(1));let g=l;Object.values(_chunkSJFPYDA3cjs.Ac).includes(g)||(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to parse argument "bin" with value "${l}"
2
+ Expected one of:
3
+ ${Object.values(_chunkSJFPYDA3cjs.Ac).join(`
4
+ `)}`)),process.exit(1));let i=new Date(C),o=f?new Date(f):new Date;if(Number.isNaN(i.getTime())&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Start date provided is invalid date. Got --start="${C}" expected --start="01/01/2023"`)),process.exit(1)),Number.isNaN(o.getTime())&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`End date provided is invalid date. Got --end="${f}" expected --end="01/01/2023"`)),process.exit(1)),i>o&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Got a start date "${i.toISOString()}" that was larger than the end date "${o.toISOString()}". Start date must be before end date.`)),process.exit(1)),_fs.existsSync.call(void 0, r)||_fs.mkdirSync.call(void 0, r),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Pulling consent metrics from start=${i.toString()} to end=${o.toISOString()} with bin size "${l}"`)),typeof m=="string"){try{let n=_chunkSJFPYDA3cjs.xe.call(void 0, N,m),s=await _chunkLYJU4HTNcjs.d.call(void 0, n,{bin:g,start:i,end:o});Object.entries(s).forEach(([p,c])=>{c.forEach(({points:u,name:d})=>{let a=_path.join.call(void 0, r,`${p}_${d}.csv`);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Writing configuration to file "${a}"...`)),_chunkZVK4HIDFcjs.c.call(void 0, a,u.map(({key:$,value:h})=>({timestamp:$,value:h})))})})}catch(n){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`An error occurred syncing the schema: ${n.message}`)),process.exit(1)}_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced consent metrics to disk in folder "${r}"! View at ${_chunkEG4L6YAJcjs.c}`))}else{let n=[];await _chunkSJFPYDA3cjs.a.call(void 0, m,async(s,p)=>{let c=`[${p+1}/${m.length}][${s.organizationName}] `;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`~~~
5
+
6
+ ${c}Attempting to pull consent metrics...
7
+
8
+ ~~~`));let u=_chunkSJFPYDA3cjs.xe.call(void 0, N,s.apiKey);try{let d=await _chunkLYJU4HTNcjs.d.call(void 0, u,{bin:g,start:i,end:o}),a=_path.join.call(void 0, r,s.organizationName);_fs.existsSync.call(void 0, a)||_fs.mkdirSync.call(void 0, a),Object.entries(d).forEach(([$,h])=>{h.forEach(({points:I,name:F})=>{let D=_path.join.call(void 0, a,`${$}_${F}.csv`);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Writing configuration to file "${D}"...`)),_chunkZVK4HIDFcjs.c.call(void 0, D,I.map(({key:G,value:z})=>({timestamp:G,value:z})))})}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`${c}Successfully pulled configuration!`))}catch (e2){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`${c}Failed to sync configuration.`)),n.push(s.organizationName)}}),n.length>0&&(_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Sync encountered errors for "${n.join(",")}". View output above for more information, or check out ${_chunkEG4L6YAJcjs.c}`)),process.exit(1))}}exports.pullConsentMetrics = q;
9
+ //# sourceMappingURL=impl-ZKSARENR.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/impl-ZKSARENR.cjs","../src/commands/consent/pull-consent-metrics/impl.ts"],"names":["pullConsentMetrics","auth","start","end","folder","bin","transcendUrl","apiKeyOrList","validateTranscendAuth","fs","logger","colors","parsedBin","ConsentManagerMetricBin"],"mappings":"AAAA,iOAAwC,gCAA6B,wDAAyC,wDAAyC,gCAA6B,gCAA6B,gCAA6B,gCAA6B,wDAAyD,wDAAyC,wDAAyC,gCAA6B,gCAA6B,gFCE7b,4BAEE,gEACqB,MAmB1C,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,KAAA,CAAAC,CAAAA,CACA,GAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,GAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CAEf,IAAMC,CAAAA,CAAe,MAAMC,iCAAAA,CAA0B,CAAA,CAGjDC,YAAAA,CAAG,UAAA,CAAWL,CAAM,CAAA,EAAK,CAACK,YAAAA,CAAG,SAAA,CAAUL,CAAM,CAAA,CAAE,WAAA,CAAY,CAAA,EAAA,CAC7DM,mBAAAA,CAAO,KAAA,CACLC,gBAAAA,CAAO,GAAA,CACL,yFACF,CACF,CAAA,CACA,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,CAAA,CAIhB,IAAMC,CAAAA,CAAYP,CAAAA,CACb,MAAA,CAAO,MAAA,CAAOQ,oBAAuB,CAAA,CAAE,QAAA,CAASD,CAAS,CAAA,EAAA,CAC5DF,mBAAAA,CAAO,KAAA,CACLC,gBAAAA,CAAO,GAAA,CACL,CAAA,2CAAA,EAA8CN,CAAG,CAAA;AAAA;AAAA,EACzB,MAAA,CAAO,MAAA,CAAOQ,oBAAuB,CAAA,CAAE,IAAA,CAC3D,CAAA;AAAA,CACF,CAAC,CAAA,CAAA;AAgGD;AAAgB;AAAA;AAAA,GAAA","file":"/Users/benbrook/transcend/cli/dist/impl-ZKSARENR.cjs","sourcesContent":[null,"import type { LocalContext } from '@/context';\nimport { logger } from '@/logger';\nimport colors from 'colors';\nimport { mapSeries } from '@/lib/bluebird-replace';\nimport { join } from 'path';\nimport fs, { existsSync, mkdirSync } from 'fs';\nimport {\n buildTranscendGraphQLClient,\n ConsentManagerMetricBin,\n} from '@/lib/graphql';\nimport { validateTranscendAuth } from '@/lib/api-keys';\nimport { ADMIN_DASH_INTEGRATIONS } from '@/constants';\nimport { pullConsentManagerMetrics } from '@/lib/consent-manager';\nimport { writeCsv } from '@/lib/cron';\n\ninterface 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 {\n auth,\n start,\n end,\n folder,\n bin,\n transcendUrl,\n }: PullConsentMetricsCommandFlags,\n): Promise<void> {\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 process.exit(1);\n }\n\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 ),\n );\n 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 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 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 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 Object.entries(configuration).forEach(([metricName, metrics]) => {\n metrics.forEach(({ points, name }) => {\n const file = join(folder, `${metricName}_${name}.csv`);\n logger.info(\n colors.magenta(`Writing configuration to file \"${file}\"...`),\n );\n writeCsv(\n file,\n points.map(({ key, value }) => ({\n timestamp: key,\n value,\n })),\n );\n });\n });\n } catch (err) {\n logger.error(\n colors.red(`An error occurred syncing the schema: ${err.message}`),\n );\n 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}][${\n apiKey.organizationName\n }] `;\n logger.info(\n colors.magenta(\n `~~~\\n\\n${prefix}Attempting to pull consent metrics...\\n\\n~~~`,\n ),\n );\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKey.apiKey);\n\n try {\n const configuration = await pullConsentManagerMetrics(client, {\n bin: parsedBin,\n start: startDate,\n end: endDate,\n });\n\n // ensure folder exists for that organization\n const subFolder = 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(\n colors.magenta(`Writing configuration to file \"${file}\"...`),\n );\n writeCsv(\n file,\n points.map(({ key, value }) => ({\n timestamp: key,\n value,\n })),\n );\n });\n });\n\n logger.info(\n colors.green(`${prefix}Successfully pulled configuration!`),\n );\n } catch (err) {\n logger.error(colors.red(`${prefix}Failed to sync configuration.`));\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 process.exit(1);\n }\n }\n}\n"]}
package/dist/index.cjs ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var _class;var _chunk7OIWW7TJcjs = require('./chunk-7OIWW7TJ.cjs');var _chunkBN4LSJ6Ucjs = require('./chunk-BN4LSJ6U.cjs');var _chunkIBTP5OXEcjs = require('./chunk-IBTP5OXE.cjs');var _chunkWJOUZOWGcjs = require('./chunk-WJOUZOWG.cjs');var _chunkTD7ADMVOcjs = require('./chunk-TD7ADMVO.cjs');var _chunkKOV2SQO2cjs = require('./chunk-KOV2SQO2.cjs');var _chunkUJ3GGOXXcjs = require('./chunk-UJ3GGOXX.cjs');var _chunk2VOZMXOEcjs = require('./chunk-2VOZMXOE.cjs');var _chunkZVK4HIDFcjs = require('./chunk-ZVK4HIDF.cjs');var _chunkLYJU4HTNcjs = require('./chunk-LYJU4HTN.cjs');var _chunkTEOKGAUXcjs = require('./chunk-TEOKGAUX.cjs');var _chunkKR377AJUcjs = require('./chunk-KR377AJU.cjs');var _chunkUEGX6GZ2cjs = require('./chunk-UEGX6GZ2.cjs');var _chunkSAEKBZGFcjs = require('./chunk-SAEKBZGF.cjs');var _chunkSJFPYDA3cjs = require('./chunk-SJFPYDA3.cjs');require('./chunk-ZUNVPK23.cjs');var _chunkEG4L6YAJcjs = require('./chunk-EG4L6YAJ.cjs');var _chunkS6XB2PPWcjs = require('./chunk-S6XB2PPW.cjs');var _chunkBY7W4UQFcjs = require('./chunk-BY7W4UQF.cjs');var _typeutils = require('@transcend-io/type-utils');var _handlebarsutils = require('@transcend-io/handlebars-utils');var _privacytypes = require('@transcend-io/privacy-types');var T=20;async function $(a){let e=[],r=0,t=!1;do{let{largeLanguageModels:{nodes:s}}=await _chunkSJFPYDA3cjs.gc.call(void 0, a,_chunkSJFPYDA3cjs.Gb,{first:T,offset:r});e.push(...s),r+=T,t=s.length===T}while(t);return e.sort((s,o)=>s.name.localeCompare(o.name))}function j(a){return new RegExp(`<${a}>([\\s\\S]+?)<\\/${a}>`)}function hm(a){return a}var H=a=>{try{return JSON.parse(a)}catch (e2){return a}},F= exports.TranscendPromptManager = (_class =class{__init() {this.largeLanguageModels=[]}__init2() {this.agentsByName={}}__init3() {this.agentsByAgentId={}}constructor({prompts:e,handlebarsOptions:r={},transcendUrl:t=_chunkEG4L6YAJcjs.e,transcendApiKey:s,requireApproval:o=!0,cacheDuration:i,defaultVariables:p={}}){;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);this.prompts=e,this.transcendUrl=t,this.transcendApiKey=s,this.variables=p,this.defaultVariables=p,this.graphQLClient=_chunkSJFPYDA3cjs.xe.call(void 0, t,typeof s=="object"?s.release():s),this.requireApproval=o,this.cacheDuration=i,this.handlebarsOptions=r,this.handlebars=_handlebarsutils.createHandlebarsWithHelpers.call(void 0, r)}async fetchPromptsAndMetadata(){let e=_typeutils.getValues.call(void 0, this.prompts),r=e.map(({id:n})=>n).filter(n=>!!n),t=e.map(({title:n})=>n).filter(n=>!!n),s=_chunkSJFPYDA3cjs.fc.call(void 0, e.map(({agentNames:n})=>n||[]).flat()),[o,i,p]=await Promise.all([_chunkSJFPYDA3cjs.Kc.call(void 0, this.graphQLClient,{promptIds:r,promptTitles:t}),$(this.graphQLClient),_chunkSJFPYDA3cjs.qd.call(void 0, this.graphQLClient,{names:s})]);this.agentsByName=_chunkSJFPYDA3cjs.bc.call(void 0, p,"name"),this.agentsByAgentId=_chunkSJFPYDA3cjs.bc.call(void 0, p,"agentId"),this.largeLanguageModels=i.filter(n=>n.isTranscendHosted===!1);let m=_chunkSJFPYDA3cjs.bc.call(void 0, o.prompts,"title"),c=_chunkSJFPYDA3cjs.bc.call(void 0, o.prompts,"id");return this.variables={...o.calculatedVariables.reduce((n,g)=>Object.assign(n,{[g.name]:g.data?JSON.parse(g.data):g.data}),{}),...this.defaultVariables},this.handlebars=_handlebarsutils.createHandlebarsWithHelpers.call(void 0, {...this.handlebarsOptions,templates:[...this.handlebarsOptions.templates||[],...o.promptPartials.map(n=>({name:n.slug,content:n.content}))]}),this.promptContentMap=_typeutils.apply.call(void 0, this.prompts,({id:n,title:g})=>{let d=n?c[n]:g?m[g]:void 0;if(!d)throw new Error(`Failed to find prompt with title: "${g}" and id: "${n}"`);return d}),this.lastUpdatedAt=new Date,o}async getAgentByName(e){let r=this.agentsByName[e];if(r)return r;let[t]=await _chunkSJFPYDA3cjs.qd.call(void 0, this.graphQLClient,{names:[e]});if(t)return this.agentsByName[t.name]=t,this.agentsByAgentId[t.agentId]=t,t}async getPromptThreadBySlackTs(e){let[r]=await _chunkSJFPYDA3cjs.Be.call(void 0, this.graphQLClient,{slackMessageTs:[e]});return r}async getAgentsByName(e){if(e.length<1)throw new Error("Expected at least one name to be provided");let{hasCache:r=[],missingCache:t=[]}=_chunkSJFPYDA3cjs.ac.call(void 0, e,p=>this.agentsByName[p]?"hasCache":"missingCache"),s=r.map(p=>this.agentsByName[p]);if(t.length===0)return s;let o=_chunkSJFPYDA3cjs._b.call(void 0, t,50),i=[];return await _chunkSJFPYDA3cjs.a.call(void 0, o,async p=>{let m=await _chunkSJFPYDA3cjs.qd.call(void 0, this.graphQLClient,{names:p});m.forEach(c=>{this.agentsByName[c.name]=c,this.agentsByAgentId[c.agentId]=c}),i.push(...m)}),[...s,...i]}getAgentFiles(e){return _chunkSJFPYDA3cjs.Fd.call(void 0, this.graphQLClient,e)}getLargeLanguageModel(e){let r=this.largeLanguageModels.find(t=>typeof e=="string"?t.id===e:t.name===e.name&&t.client===e.client);if(!r)throw new Error(`Failed to find model matching: ${typeof e=="string"?e:JSON.stringify(e)}`);return r}async getPromptDefinition(e){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let{promptContentMap:r}=this;if(!r)throw new Error("Expected this.promptContentMap to be defined");let t=r[e];if(!t)throw new Error(`Expected this.promptContentMap[${e}] to be defined`);return t}async compilePrompt(e,r){let t=await this.getPromptDefinition(e),s=this.prompts[e];if(!s)throw new Error(`Expected this.prompts[${e}] to be defined`);if(this.requireApproval&&t.status!==_privacytypes.PromptStatus.Approved)throw new Error(`Assessment "${t.title}" cannot be used because its in status: "${t.status}"`);if(t.status===_privacytypes.PromptStatus.Rejected)throw new Error(`Assessment "${t.title}" cannot be used because it's in status: "${t.status}"`);return _typeutils.decodeCodec.call(void 0, s.paramCodec,r),this.handlebars.compile(t.content)({currentDate:new Date().toISOString(),...this.variables,...r})}parseAiResponse(e,r){let t=this.prompts[e];if(!t)throw new Error(`Expected this.prompts[${e}] to be defined`);let s=t.extractFromTag&&(j(t.extractFromTag).exec(r)||[])[1]||r;return _typeutils.decodeCodec.call(void 0, t.outputCodec,H(s),!1)}async reportAndParsePromptRun(e,{largeLanguageModel:r,...t}){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let s=t.name||`@transcend-io/cli-prompt-run-${new Date().toISOString()}`;if(!this.promptContentMap)throw new Error("Expected this.promptContentMap to be defined");let o=this.promptContentMap[e];if(!o)throw new Error(`Expected this.prompts[${e}] to be defined`);if(t.promptRunMessages.length===0)throw new Error("promptRunMessages is expected to have length > 0");if(t.promptRunMessages[0].role!==_privacytypes.ChatCompletionRole.System)throw new Error(`promptRunMessages[0].role is expected to be = ${_privacytypes.ChatCompletionRole.System}`);if(t.promptRunMessages[t.promptRunMessages.length-1].role!==_privacytypes.ChatCompletionRole.Assistant)throw new Error(`promptRunMessages[${t.promptRunMessages.length-1}].role is expected to be = ${_privacytypes.ChatCompletionRole.Assistant}`);let i=t.promptRunMessages[t.promptRunMessages.length-1].content,p;try{p=this.parseAiResponse(e,i)}catch(c){throw await _chunkSJFPYDA3cjs.Ve.call(void 0, this.graphQLClient,{productArea:_privacytypes.PromptRunProductArea.PromptManager,...t,name:s,error:c.message,status:_privacytypes.QueueStatus.Error,...typeof r=="string"?{largeLanguageModelId:r}:{largeLanguageModelName:r.name,largeLanguageModelClient:r.client},promptId:o.id,promptRunMessages:t.promptRunMessages.map((n,g)=>({...n,...g===0?{template:o.content}:{}}))}),c}let m=await _chunkSJFPYDA3cjs.Ve.call(void 0, this.graphQLClient,{productArea:_privacytypes.PromptRunProductArea.PromptManager,...t,name:s,status:_privacytypes.QueueStatus.Resolved,...typeof r=="string"?{largeLanguageModelId:r}:{largeLanguageModelName:r.name,largeLanguageModelClient:r.client},promptId:o.id,promptRunMessages:t.promptRunMessages.map((c,n)=>({...c,...n===0?{template:o.content}:{}}))});return{result:p,promptRunId:m,promptRunUrl:`https://app.transcend.io/prompts/runs/${m}`}}async reportPromptRunError(e,{largeLanguageModel:r,...t}){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let s=t.name||`@transcend-io/cli-prompt-run-${new Date().toISOString()}`;if(!this.promptContentMap)throw new Error("Expected this.promptContentMap to be defined");let o=this.promptContentMap[e];if(!o)throw new Error(`Expected this.prompts[${e}] to be defined`);if(t.promptRunMessages.length===0)throw new Error("promptRunMessages is expected to have length > 0");if(t.promptRunMessages[0].role!==_privacytypes.ChatCompletionRole.System)throw new Error(`promptRunMessages[0].role is expected to be = ${_privacytypes.ChatCompletionRole.System}`);let i=await _chunkSJFPYDA3cjs.Ve.call(void 0, this.graphQLClient,{productArea:_privacytypes.PromptRunProductArea.PromptManager,...t,name:s,status:_privacytypes.QueueStatus.Error,...typeof r=="string"?{largeLanguageModelId:r}:{largeLanguageModelName:r.name,largeLanguageModelClient:r.client},promptId:o.id,promptRunMessages:t.promptRunMessages.map((p,m)=>({...p,...m===0?{template:o.content}:{}}))});return{promptRunId:i,promptRunUrl:`https://app.transcend.io/prompts/runs/${i}`}}}, _class);function Pm(a){let e=/(https?:\/\/[^\s]+)/g;return a.replace(e,"<link-omitted>")}function Am(a){return Object.entries(a).reduce((e,[r,t])=>t!=null&&t!==""&&!(Array.isArray(t)&&t.length===0)&&!(typeof t=="object"&&Object.keys(t).length===0)?Object.assign(e,{[r]:t}):e,{})}var _fastglob = require('fast-glob'); var _fastglob2 = _interopRequireDefault(_fastglob);var _child_process = require('child_process');function Rm({baseBranch:a,rootDirectory:e,githubRepo:r,excludedGlob:t=[],fileBlockList:s=[]}){_child_process.execSync.call(void 0, `git fetch origin ${a}`);let o=_child_process.execSync.call(void 0, `git ls-remote ${r} "refs/heads/${a}" | cut -f 1`,{encoding:"utf-8"}).split(`
2
+ `)[0],i=_child_process.execSync.call(void 0, "git rev-parse HEAD",{encoding:"utf-8"}).split(`
3
+ `)[0];if(!o||!i)throw new Error("FAILED TO FIND COMMIT RANGE");let p=_child_process.execSync.call(void 0, `git fetch && git diff --name-only "${a||o}...${i}" -- ${e}`,{encoding:"utf-8"}),m=_chunkSJFPYDA3cjs.$b.call(void 0, p.split(`
4
+ `).filter(d=>d),s),c=t.length>0?_fastglob2.default.sync(m,{ignore:t}):m,n={};c.forEach(d=>{let Q=_child_process.execSync.call(void 0, `git show ${i}:${d}`,{encoding:"utf-8"});n[d]=Q});let g=r.split("/").pop().split(".")[0];return{changedFiles:m,fileDiffs:n,repoName:g,commit:i}}exports.ACTIONS = _chunkSJFPYDA3cjs.ub; exports.ADD_MESSAGES_TO_PROMPT_RUN = _chunkSJFPYDA3cjs.Ha; exports.ADD_SILO_DISCOVERY_RESULTS = _chunkSJFPYDA3cjs.I; exports.ADMIN_DASH = _chunkEG4L6YAJcjs.b; exports.ADMIN_DASH_DATAPOINTS = _chunkEG4L6YAJcjs.d; exports.ADMIN_DASH_INTEGRATIONS = _chunkEG4L6YAJcjs.c; exports.AGENTS = _chunkSJFPYDA3cjs.Hb; exports.AGENT_FILES = _chunkSJFPYDA3cjs.Kb; exports.AGENT_FUNCTIONS = _chunkSJFPYDA3cjs.Nb; exports.API_KEYS = _chunkSJFPYDA3cjs.F; exports.APPROVE_PRIVACY_REQUEST = _chunkSJFPYDA3cjs.Y; exports.ASSESSMENTS = _chunkSJFPYDA3cjs.ga; exports.ASSESSMENT_SECTION_FIELDS = _chunkSJFPYDA3cjs.fa; exports.ASSESSMENT_TEMPLATES = _chunkSJFPYDA3cjs.ka; exports.ASSUME_ROLE = _chunkSJFPYDA3cjs.Fb; exports.ATTRIBUTES = _chunkSJFPYDA3cjs.La; exports.ATTRIBUTE_KEYS_REQUESTS = _chunkSJFPYDA3cjs.N; exports.ATTRIBUTE_VALUES = _chunkSJFPYDA3cjs.Pa; exports.ActionInput = _chunkUEGX6GZ2cjs.E; exports.ActionItemCollectionInput = _chunkUEGX6GZ2cjs.P; exports.ActionItemInput = _chunkUEGX6GZ2cjs.Q; exports.AgentFileInput = _chunkUEGX6GZ2cjs.o; exports.AgentFunctionInput = _chunkUEGX6GZ2cjs.n; exports.AgentInput = _chunkUEGX6GZ2cjs.m; exports.ApiKeyInput = _chunkUEGX6GZ2cjs.c; exports.AssessmentAction = _chunkSJFPYDA3cjs.ce; exports.AssessmentAnswerOptionInput = _chunkUEGX6GZ2cjs.W; exports.AssessmentDisplayLogicInput = _chunkUEGX6GZ2cjs.T; exports.AssessmentInput = _chunkUEGX6GZ2cjs.aa; exports.AssessmentNestedRule = _chunkSJFPYDA3cjs.be; exports.AssessmentNestedRuleInput = _chunkUEGX6GZ2cjs.S; exports.AssessmentResourceInput = _chunkUEGX6GZ2cjs.$; exports.AssessmentRetentionScheduleInput = _chunkUEGX6GZ2cjs.Z; exports.AssessmentRiskLogic = _chunkSJFPYDA3cjs.ee; exports.AssessmentRule = _chunkSJFPYDA3cjs.ae; exports.AssessmentRuleInput = _chunkUEGX6GZ2cjs.R; exports.AssessmentSectionInput = _chunkUEGX6GZ2cjs.Y; exports.AssessmentSectionQuestionInput = _chunkUEGX6GZ2cjs.X; exports.AssessmentTemplateInput = _chunkUEGX6GZ2cjs._; exports.AttestedExtraIdentifiers = _chunkKR377AJUcjs.w; exports.AttributeInput = _chunkUEGX6GZ2cjs.k; exports.AttributePreview = _chunkUEGX6GZ2cjs.l; exports.AttributeValueInput = _chunkUEGX6GZ2cjs.j; exports.BLANK = _chunkKR377AJUcjs.c; exports.BULK_APPLY = _chunkKR377AJUcjs.b; exports.BUSINESS_ENTITIES = _chunkSJFPYDA3cjs.rb; exports.BusinessEntityInput = _chunkUEGX6GZ2cjs.y; exports.CANCEL_PRIVACY_REQUEST = _chunkSJFPYDA3cjs.Z; exports.CAN_APPLY_IN_BULK = _chunkKR377AJUcjs.g; exports.CATALOGS = _chunkSJFPYDA3cjs.t; exports.CHANGE_REQUEST_DATA_SILO_STATUS = _chunkSJFPYDA3cjs.wa; exports.CODE_PACKAGES = _chunkSJFPYDA3cjs.R; exports.CONSENT_MANAGER_ANALYTICS_DATA = _chunkSJFPYDA3cjs.qb; exports.CONSENT_PARTITIONS = _chunkSJFPYDA3cjs.Ua; exports.COOKIES = _chunkSJFPYDA3cjs.Za; exports.CREATE_ACTION_ITEMS = _chunkSJFPYDA3cjs.yb; exports.CREATE_ACTION_ITEM_COLLECTION = _chunkSJFPYDA3cjs.Ja; exports.CREATE_AGENT = _chunkSJFPYDA3cjs.Ib; exports.CREATE_AGENT_FILE = _chunkSJFPYDA3cjs.Lb; exports.CREATE_AGENT_FUNCTION = _chunkSJFPYDA3cjs.Ob; exports.CREATE_API_KEY = _chunkSJFPYDA3cjs.G; exports.CREATE_ATTRIBUTE = _chunkSJFPYDA3cjs.Qa; exports.CREATE_ATTRIBUTE_VALUES = _chunkSJFPYDA3cjs.Ma; exports.CREATE_BUSINESS_ENTITY = _chunkSJFPYDA3cjs.sb; exports.CREATE_CODE_PACKAGE = _chunkSJFPYDA3cjs.T; exports.CREATE_CONSENT_EXPERIENCE = _chunkSJFPYDA3cjs.ob; exports.CREATE_CONSENT_MANAGER = _chunkSJFPYDA3cjs.bb; exports.CREATE_CONSENT_PARTITION = _chunkSJFPYDA3cjs.pb; exports.CREATE_DATA_FLOWS = _chunkSJFPYDA3cjs.Va; exports.CREATE_DATA_SILOS = _chunkSJFPYDA3cjs.o; exports.CREATE_DATA_SUBJECT = _chunkSJFPYDA3cjs.z; exports.CREATE_DATA_SUB_CATEGORY = _chunkSJFPYDA3cjs.Ub; exports.CREATE_ENRICHER = _chunkSJFPYDA3cjs.r; exports.CREATE_IDENTIFIER = _chunkSJFPYDA3cjs.w; exports.CREATE_PROCESSING_PURPOSE_SUB_CATEGORY = _chunkSJFPYDA3cjs.Xb; exports.CREATE_PROMPT = _chunkSJFPYDA3cjs.qa; exports.CREATE_PROMPT_GROUP = _chunkSJFPYDA3cjs.ua; exports.CREATE_PROMPT_PARTIAL = _chunkSJFPYDA3cjs.sa; exports.CREATE_REPOSITORY = _chunkSJFPYDA3cjs.E; exports.CREATE_SOFTWARE_DEVELOPMENT_KIT = _chunkSJFPYDA3cjs.Q; exports.CREATE_TEAM = _chunkSJFPYDA3cjs.Aa; exports.CREATE_TEMPLATE = _chunkSJFPYDA3cjs.L; exports.CREATE_VENDOR = _chunkSJFPYDA3cjs.Rb; exports.CachedFileState = _chunkKR377AJUcjs.h; exports.CachedRequestState = _chunkKR377AJUcjs.j; exports.CodePackageInput = _chunkUEGX6GZ2cjs.B; exports.CodePackageSdk = _chunkUEGX6GZ2cjs.A; exports.ColumnName = _chunkKR377AJUcjs.e; exports.ConsentManageExperienceInput = _chunkUEGX6GZ2cjs.I; exports.ConsentManagerInput = _chunkUEGX6GZ2cjs.K; exports.ConsentManagerMetricBin = _chunkSJFPYDA3cjs.Ac; exports.ConsentManagerServiceMetadata = _chunkUEGX6GZ2cjs.ia; exports.ConsentPreferenceResponse = _chunkLYJU4HTNcjs.i; exports.ConsentPreferenceTopic = _chunkUEGX6GZ2cjs.ca; exports.ConsentPreferenceTopicOptionValue = _chunkUEGX6GZ2cjs.ba; exports.ConsentPurpose = _chunkUEGX6GZ2cjs.da; exports.CookieCsvInput = _chunkUEGX6GZ2cjs.ha; exports.CookieInput = _chunkUEGX6GZ2cjs.H; exports.CronIdentifier = _chunk2VOZMXOEcjs.a; exports.CronIdentifierPush = _chunk2VOZMXOEcjs.c; exports.DATAPOINT_EXPORT = _chunkSJFPYDA3cjs.i; exports.DATA_FLOWS = _chunkSJFPYDA3cjs.Ya; exports.DATA_POINTS = _chunkSJFPYDA3cjs.c; exports.DATA_POINT_COUNT = _chunkSJFPYDA3cjs.d; exports.DATA_SILOS = _chunkSJFPYDA3cjs.k; exports.DATA_SILOS_ENRICHED = _chunkSJFPYDA3cjs.m; exports.DATA_SILO_EXPORT = _chunkSJFPYDA3cjs.l; exports.DATA_SUBJECTS = _chunkSJFPYDA3cjs.y; exports.DATA_SUB_CATEGORIES = _chunkSJFPYDA3cjs.Tb; exports.DEFAULT_TRANSCEND_API = _chunkEG4L6YAJcjs.e; exports.DEFAULT_TRANSCEND_CONSENT_API = _chunkEG4L6YAJcjs.f; exports.DEFAULT_TRANSCEND_PULL_RESOURCES = _chunkSJFPYDA3cjs.ie; exports.DELETE_API_KEY = _chunkSJFPYDA3cjs.H; exports.DELETE_ATTRIBUTE_VALUE = _chunkSJFPYDA3cjs.Oa; exports.DEPLOYED_PRIVACY_CENTER_URL = _chunkSJFPYDA3cjs.Ab; exports.DEPLOY_CONSENT_MANAGER = _chunkSJFPYDA3cjs.eb; exports.DETERMINE_LOGIN_METHOD = _chunkSJFPYDA3cjs.Db; exports.DataCategoryGuessInput = _chunkUEGX6GZ2cjs.h; exports.DataCategoryInput = _chunkUEGX6GZ2cjs.q; exports.DataCategoryPreviewInput = _chunkUEGX6GZ2cjs.g; exports.DataCategoryRecommendationInput = _chunkUEGX6GZ2cjs.i; exports.DataFlowCsvInput = _chunkUEGX6GZ2cjs.ga; exports.DataFlowInput = _chunkUEGX6GZ2cjs.G; exports.DataSiloInput = _chunkUEGX6GZ2cjs.O; exports.DataSubjectInput = _chunkUEGX6GZ2cjs.D; exports.DatapointInput = _chunkUEGX6GZ2cjs.w; exports.ENABLED_PLUGINS = _chunkSJFPYDA3cjs.J; exports.ENRICHERS = _chunkSJFPYDA3cjs.p; exports.ENTRY_COUNT = _chunkSJFPYDA3cjs.j; exports.EXPERIENCES = _chunkSJFPYDA3cjs.Ta; exports.EnrichPrivacyRequest = _chunk7OIWW7TJcjs.b; exports.EnricherInput = _chunkUEGX6GZ2cjs.e; exports.FETCH_CONSENT_MANAGER = _chunkSJFPYDA3cjs.$a; exports.FETCH_CONSENT_MANAGER_ID = _chunkSJFPYDA3cjs._a; exports.FETCH_CONSENT_MANAGER_THEME = _chunkSJFPYDA3cjs.ab; exports.FETCH_PRIVACY_CENTER_ID = _chunkSJFPYDA3cjs.zb; exports.FieldInput = _chunkUEGX6GZ2cjs.v; exports.GLOBAL_ACTION_ITEMS = _chunkSJFPYDA3cjs.wb; exports.GLOBAL_ACTION_ITEM_COLLECTIONS = _chunkSJFPYDA3cjs.Ia; exports.IDENTIFIERS = _chunkSJFPYDA3cjs.u; exports.IDENTIFIER_BLOCK_LIST = _chunkKR377AJUcjs.d; exports.IMPORT_ONE_TRUST_ASSESSMENT_FORMS = _chunkSJFPYDA3cjs.ha; exports.INITIALIZER = _chunkSJFPYDA3cjs.q; exports.IP_ADDRESS_REGEX = _chunkLYJU4HTNcjs.f; exports.IS_REQUIRED = _chunkKR377AJUcjs.f; exports.IdentifierInput = _chunkUEGX6GZ2cjs.F; exports.ImportOnetrustAssessmentsInput = _chunkUEGX6GZ2cjs.pa; exports.IntlMessage = _chunkKR377AJUcjs.A; exports.IntlMessageInput = _chunkUEGX6GZ2cjs.N; exports.LARGE_LANGUAGE_MODELS = _chunkSJFPYDA3cjs.Gb; exports.LOGIN = _chunkSJFPYDA3cjs.Eb; exports.MESSAGES = _chunkSJFPYDA3cjs.aa; exports.NEW_IDENTIFIER_TYPES = _chunkSJFPYDA3cjs.v; exports.NONE = _chunkKR377AJUcjs.a; exports.NOTIFY_ADDITIONAL_TIME = _chunkSJFPYDA3cjs.$; exports.ORGANIZATION = _chunkSJFPYDA3cjs.M; exports.OneTrustFileFormat = _chunkBY7W4UQFcjs.a; exports.OneTrustPullResource = _chunkBY7W4UQFcjs.b; exports.OneTrustPullSource = _chunkBY7W4UQFcjs.c; exports.OpenAIEnabledRoute = _chunkUEGX6GZ2cjs.ka; exports.OpenAIEnabledRoutes = _chunkUEGX6GZ2cjs.la; exports.OpenAIIntegration = _chunkUEGX6GZ2cjs.ma; exports.OpenAIRouteName = _chunkBY7W4UQFcjs.f; exports.POLICIES = _chunkSJFPYDA3cjs.V; exports.PREFERENCE_TOPICS = _chunkSJFPYDA3cjs.ja; exports.PRIVACY_CENTER = _chunkSJFPYDA3cjs.Bb; exports.PROCESSING_PURPOSE_SUB_CATEGORIES = _chunkSJFPYDA3cjs.Wb; exports.PROMPTS = _chunkSJFPYDA3cjs.la; exports.PROMPTS_WITH_VARIABLES = _chunkSJFPYDA3cjs.oa; exports.PROMPT_GROUPS = _chunkSJFPYDA3cjs.na; exports.PROMPT_PARTIALS = _chunkSJFPYDA3cjs.ma; exports.PROMPT_THREADS = _chunkSJFPYDA3cjs.U; exports.PURPOSES = _chunkSJFPYDA3cjs.ia; exports.ParsedAttributeInput = _chunkKR377AJUcjs.o; exports.PartitionInput = _chunkUEGX6GZ2cjs.J; exports.PathfinderPolicy = _chunkUEGX6GZ2cjs.na; exports.PathfinderPolicyName = _chunkBY7W4UQFcjs.e; exports.PathfinderPolicyNameC = _chunkUEGX6GZ2cjs.ja; exports.PathfinderPromptRunMetadata = _chunkUEGX6GZ2cjs.oa; exports.PolicyInput = _chunkUEGX6GZ2cjs.M; exports.PrivacyCenterInput = _chunkUEGX6GZ2cjs.L; exports.PrivacyRequest = _chunkSJFPYDA3cjs.Fe; exports.PrivacyRequestInput = _chunkKR377AJUcjs.x; exports.PrivacyRequestResponse = _chunkKR377AJUcjs.G; exports.ProcessingPurposeInput = _chunkUEGX6GZ2cjs.r; exports.ProcessingPurposePreviewInput = _chunkUEGX6GZ2cjs.f; exports.PromptAVendorEmailSettings = _chunkUEGX6GZ2cjs.x; exports.PromptGroupInput = _chunkUEGX6GZ2cjs.u; exports.PromptInput = _chunkUEGX6GZ2cjs.s; exports.PromptPartialInput = _chunkUEGX6GZ2cjs.t; exports.PurposeMap = _chunkTEOKGAUXcjs.e; exports.REDUCED_REQUESTS_FOR_DATA_SILO_COUNT = _chunkSJFPYDA3cjs.ya; exports.REMOVE_REQUEST_IDENTIFIERS = _chunkSJFPYDA3cjs.Ca; exports.REPORT_PROMPT_RUN = _chunkSJFPYDA3cjs.Ga; exports.REPOSITORIES = _chunkSJFPYDA3cjs.C; exports.REQUESTS = _chunkSJFPYDA3cjs.X; exports.REQUEST_DATA_SILOS = _chunkSJFPYDA3cjs.va; exports.REQUEST_ENRICHERS = _chunkSJFPYDA3cjs.ca; exports.REQUEST_FILES = _chunkSJFPYDA3cjs.Fa; exports.REQUEST_IDENTIFIERS = _chunkSJFPYDA3cjs.Da; exports.RETRY_REQUEST_DATA_SILO = _chunkSJFPYDA3cjs.xa; exports.RETRY_REQUEST_ENRICHER = _chunkSJFPYDA3cjs.da; exports.RepositoryInput = _chunkUEGX6GZ2cjs.C; exports.RequestFileMetadata = _chunkKR377AJUcjs.B; exports.RequestFileMetadataResponse = _chunkKR377AJUcjs.C; exports.RequestIdentifiersResponse = _chunkSJFPYDA3cjs.He; exports.RiskAssignmentInput = _chunkUEGX6GZ2cjs.U; exports.RiskLogicInput = _chunkUEGX6GZ2cjs.V; exports.SET_RESOURCE_ATTRIBUTES = _chunkSJFPYDA3cjs.Sa; exports.SKIP_REQUEST_ENRICHER = _chunkSJFPYDA3cjs.ea; exports.SOFTWARE_DEVELOPMENT_KITS = _chunkSJFPYDA3cjs.O; exports.SOMBRA_VERSION = _chunkSJFPYDA3cjs.Zb; exports.SUB_DATA_POINTS = _chunkSJFPYDA3cjs.e; exports.SUB_DATA_POINTS_COUNT = _chunkSJFPYDA3cjs.f; exports.SUB_DATA_POINTS_WITH_GUESSES = _chunkSJFPYDA3cjs.g; exports.SYNC_ATTRIBUTE_TYPES = _chunkSJFPYDA3cjs.ad; exports.SoftwareDevelopmentKitInput = _chunkUEGX6GZ2cjs.z; exports.StoredApiKey = _chunkUEGX6GZ2cjs.fa; exports.SuccessfulRequest = _chunkKR377AJUcjs.i; exports.TEAMS = _chunkSJFPYDA3cjs.za; exports.TEMPLATES = _chunkSJFPYDA3cjs.K; exports.TOGGLE_CONSENT_PRECEDENCE = _chunkSJFPYDA3cjs.lb; exports.TOGGLE_DATA_SUBJECT = _chunkSJFPYDA3cjs.B; exports.TOGGLE_TELEMETRY_PARTITION_STRATEGY = _chunkSJFPYDA3cjs.kb; exports.TOGGLE_UNKNOWN_COOKIE_POLICY = _chunkSJFPYDA3cjs.jb; exports.TOGGLE_UNKNOWN_REQUEST_POLICY = _chunkSJFPYDA3cjs.ib; exports.TR_PULL_RESOURCE_SCOPE_MAP = _chunkEG4L6YAJcjs.h; exports.TR_PUSH_RESOURCE_SCOPE_MAP = _chunkEG4L6YAJcjs.g; exports.TR_YML_RESOURCE_TO_FIELD_NAME = _chunkEG4L6YAJcjs.i; exports.TeamInput = _chunkUEGX6GZ2cjs.d; exports.TemplateInput = _chunkUEGX6GZ2cjs.a; exports.TranscendInput = _chunkUEGX6GZ2cjs.ea; exports.TranscendPromptManager = F; exports.TranscendPullResource = _chunkBY7W4UQFcjs.d; exports.UPDATE_ACTION = _chunkSJFPYDA3cjs.vb; exports.UPDATE_ACTION_ITEMS = _chunkSJFPYDA3cjs.xb; exports.UPDATE_ACTION_ITEM_COLLECTION = _chunkSJFPYDA3cjs.Ka; exports.UPDATE_AGENTS = _chunkSJFPYDA3cjs.Jb; exports.UPDATE_AGENT_FILES = _chunkSJFPYDA3cjs.Mb; exports.UPDATE_AGENT_FUNCTIONS = _chunkSJFPYDA3cjs.Pb; exports.UPDATE_ATTRIBUTE = _chunkSJFPYDA3cjs.Ra; exports.UPDATE_ATTRIBUTE_VALUES = _chunkSJFPYDA3cjs.Na; exports.UPDATE_BUSINESS_ENTITIES = _chunkSJFPYDA3cjs.tb; exports.UPDATE_CODE_PACKAGES = _chunkSJFPYDA3cjs.S; exports.UPDATE_CONSENT_EXPERIENCE = _chunkSJFPYDA3cjs.nb; exports.UPDATE_CONSENT_MANAGER_DOMAINS = _chunkSJFPYDA3cjs.fb; exports.UPDATE_CONSENT_MANAGER_PARTITION = _chunkSJFPYDA3cjs.gb; exports.UPDATE_CONSENT_MANAGER_THEME = _chunkSJFPYDA3cjs.mb; exports.UPDATE_CONSENT_MANAGER_TO_LATEST = _chunkSJFPYDA3cjs.db; exports.UPDATE_CONSENT_MANAGER_VERSION = _chunkSJFPYDA3cjs.cb; exports.UPDATE_DATA_FLOWS = _chunkSJFPYDA3cjs.Wa; exports.UPDATE_DATA_SILOS = _chunkSJFPYDA3cjs.n; exports.UPDATE_DATA_SUBJECT = _chunkSJFPYDA3cjs.A; exports.UPDATE_DATA_SUB_CATEGORIES = _chunkSJFPYDA3cjs.Vb; exports.UPDATE_ENRICHER = _chunkSJFPYDA3cjs.s; exports.UPDATE_IDENTIFIER = _chunkSJFPYDA3cjs.x; exports.UPDATE_INTL_MESSAGES = _chunkSJFPYDA3cjs.ba; exports.UPDATE_OR_CREATE_COOKIES = _chunkSJFPYDA3cjs.Xa; exports.UPDATE_OR_CREATE_DATA_POINT = _chunkSJFPYDA3cjs.h; exports.UPDATE_POLICIES = _chunkSJFPYDA3cjs.W; exports.UPDATE_PRIVACY_CENTER = _chunkSJFPYDA3cjs.Cb; exports.UPDATE_PRIVACY_REQUEST = _chunkSJFPYDA3cjs._; exports.UPDATE_PROCESSING_PURPOSE_SUB_CATEGORIES = _chunkSJFPYDA3cjs.Yb; exports.UPDATE_PROMPTS = _chunkSJFPYDA3cjs.pa; exports.UPDATE_PROMPT_GROUPS = _chunkSJFPYDA3cjs.ta; exports.UPDATE_PROMPT_PARTIALS = _chunkSJFPYDA3cjs.ra; exports.UPDATE_REPOSITORIES = _chunkSJFPYDA3cjs.D; exports.UPDATE_SOFTWARE_DEVELOPMENT_KITS = _chunkSJFPYDA3cjs.P; exports.UPDATE_TEAM = _chunkSJFPYDA3cjs.Ba; exports.UPDATE_TOGGLE_USP_API = _chunkSJFPYDA3cjs.hb; exports.UPDATE_VENDORS = _chunkSJFPYDA3cjs.Sb; exports.USERS = _chunkSJFPYDA3cjs.Ea; exports.USP_STRING_REGEX = _chunkTEOKGAUXcjs.d; exports.VARIABLE_PARAMETERS_NAME = _chunkKOV2SQO2cjs.b; exports.VARIABLE_PARAMETERS_REGEXP = _chunkKOV2SQO2cjs.a; exports.VENDORS = _chunkSJFPYDA3cjs.Qb; exports.VendorInput = _chunkUEGX6GZ2cjs.p; exports.WebhookHeader = _chunkUEGX6GZ2cjs.b; exports.addMessagesToPromptRun = _chunkSJFPYDA3cjs.We; exports.appendCsvSync = _chunkZVK4HIDFcjs.b; exports.approvePrivacyRequests = _chunkKR377AJUcjs.I; exports.assumeRole = _chunkSJFPYDA3cjs.Oe; exports.buildAIIntegrationType = _chunkSAEKBZGFcjs.b; exports.buildEnabledRouteType = _chunkSAEKBZGFcjs.a; exports.buildTranscendGraphQLClient = _chunkSJFPYDA3cjs.xe; exports.buildTranscendGraphQLClientGeneric = _chunkSJFPYDA3cjs.we; exports.buildXdiSyncEndpoint = _chunkLYJU4HTNcjs.g; exports.bulkRestartRequests = _chunkKR377AJUcjs.Q; exports.bulkRetryEnrichers = _chunkKR377AJUcjs.S; exports.cancelPrivacyRequests = _chunkKR377AJUcjs.L; exports.consentManagersToBusinessEntities = _chunkLYJU4HTNcjs.h; exports.convertToDataSubjectAllowlist = _chunkSJFPYDA3cjs.qc; exports.convertToDataSubjectBlockList = _chunkSJFPYDA3cjs.pc; exports.createActionItemCollection = _chunkSJFPYDA3cjs.ud; exports.createActionItems = _chunkSJFPYDA3cjs.yd; exports.createAgent = _chunkSJFPYDA3cjs.rd; exports.createAgentFile = _chunkSJFPYDA3cjs.Gd; exports.createAgentFunction = _chunkSJFPYDA3cjs.Cd; exports.createApiKey = _chunkSJFPYDA3cjs.Qe; exports.createBusinessEntity = _chunkSJFPYDA3cjs.dd; exports.createCodePackage = _chunkSJFPYDA3cjs.qe; exports.createConsentToken = _chunkTEOKGAUXcjs.a; exports.createDataCategory = _chunkSJFPYDA3cjs.Od; exports.createDataFlows = _chunkSJFPYDA3cjs.id; exports.createProcessingPurpose = _chunkSJFPYDA3cjs.Sd; exports.createPrompt = _chunkSJFPYDA3cjs.Lc; exports.createRegexForTag = j; exports.createRepository = _chunkSJFPYDA3cjs.ne; exports.createSoftwareDevelopmentKit = _chunkSJFPYDA3cjs.ke; exports.createSombraGotInstance = _chunkSJFPYDA3cjs.ye; exports.createTranscendConsentGotInstance = _chunkSJFPYDA3cjs.Me; exports.createVendor = _chunkSJFPYDA3cjs.Kd; exports.defineTranscendPrompts = hm; exports.deleteApiKey = _chunkSJFPYDA3cjs.Re; exports.deployConsentManager = _chunkSJFPYDA3cjs.Te; exports.description = _chunkS6XB2PPWcjs.a; exports.domainToHost = _chunkLYJU4HTNcjs.e; exports.downloadPrivacyRequestFiles = _chunkKR377AJUcjs.F; exports.enrichPrivacyRequest = _chunk7OIWW7TJcjs.c; exports.ensureAllDataSubjectsExist = _chunkSJFPYDA3cjs.oc; exports.extractClientError = _chunkKR377AJUcjs.N; exports.fetchActiveSiloDiscoPlugin = _chunkSJFPYDA3cjs.Wd; exports.fetchAllActionItems = _chunkSJFPYDA3cjs.xd; exports.fetchAllActions = _chunkSJFPYDA3cjs.nd; exports.fetchAllAgentFiles = _chunkSJFPYDA3cjs.Fd; exports.fetchAllAgentFunctions = _chunkSJFPYDA3cjs.Bd; exports.fetchAllAgents = _chunkSJFPYDA3cjs.qd; exports.fetchAllApiKeys = _chunkSJFPYDA3cjs.Hc; exports.fetchAllAssessmentTemplates = _chunkSJFPYDA3cjs.$d; exports.fetchAllAssessments = _chunkSJFPYDA3cjs._d; exports.fetchAllAttributeValues = _chunkSJFPYDA3cjs.$c; exports.fetchAllAttributes = _chunkSJFPYDA3cjs.bd; exports.fetchAllBusinessEntities = _chunkSJFPYDA3cjs.cd; exports.fetchAllCatalogs = _chunkSJFPYDA3cjs.ue; exports.fetchAllCookies = _chunkSJFPYDA3cjs.Zd; exports.fetchAllDataCategories = _chunkSJFPYDA3cjs.Nd; exports.fetchAllDataFlows = _chunkSJFPYDA3cjs.gd; exports.fetchAllDataPoints = _chunkSJFPYDA3cjs.tc; exports.fetchAllDataSilos = _chunkSJFPYDA3cjs.rc; exports.fetchAllDataSubjects = _chunkSJFPYDA3cjs.nc; exports.fetchAllEnrichers = _chunkSJFPYDA3cjs.kc; exports.fetchAllIdentifiers = _chunkSJFPYDA3cjs.hc; exports.fetchAllMessages = _chunkSJFPYDA3cjs.Yd; exports.fetchAllPolicies = _chunkSJFPYDA3cjs.Qc; exports.fetchAllPreferenceTopics = _chunkSJFPYDA3cjs.ge; exports.fetchAllPrivacyCenters = _chunkSJFPYDA3cjs.Xd; exports.fetchAllProcessingPurposes = _chunkSJFPYDA3cjs.Rd; exports.fetchAllPromptGroups = _chunkSJFPYDA3cjs.pd; exports.fetchAllPromptPartials = _chunkSJFPYDA3cjs.od; exports.fetchAllPromptThreads = _chunkSJFPYDA3cjs.Be; exports.fetchAllPrompts = _chunkSJFPYDA3cjs.Jc; exports.fetchAllPurposes = _chunkSJFPYDA3cjs.Yc; exports.fetchAllPurposesAndPreferences = _chunkSJFPYDA3cjs.he; exports.fetchAllRequestAttributeKeys = _chunkSJFPYDA3cjs.Ee; exports.fetchAllRequestEnrichers = _chunkSJFPYDA3cjs.Je; exports.fetchAllRequestIdentifierMetadata = _chunkSJFPYDA3cjs.Ce; exports.fetchAllRequestIdentifiers = _chunkSJFPYDA3cjs.Ie; exports.fetchAllRequests = _chunkSJFPYDA3cjs.Ge; exports.fetchAllSubDataPoints = _chunkSJFPYDA3cjs.sc; exports.fetchAllTeams = _chunkSJFPYDA3cjs.Fc; exports.fetchAllTemplates = _chunkSJFPYDA3cjs.ld; exports.fetchAllUsers = _chunkSJFPYDA3cjs.Pe; exports.fetchAllVendors = _chunkSJFPYDA3cjs.Jd; exports.fetchAndIndexCatalogs = _chunkSJFPYDA3cjs.ve; exports.fetchApiKeys = _chunkSJFPYDA3cjs.Ic; exports.fetchConsentManager = _chunkSJFPYDA3cjs.xc; exports.fetchConsentManagerAnalyticsData = _chunkSJFPYDA3cjs.Bc; exports.fetchConsentManagerExperiences = _chunkSJFPYDA3cjs.zc; exports.fetchConsentManagerId = _chunkSJFPYDA3cjs.yc; exports.fetchConsentManagerTheme = _chunkSJFPYDA3cjs.Cc; exports.fetchConsentPreferences = _chunkLYJU4HTNcjs.j; exports.fetchEnrichedDataSilos = _chunkSJFPYDA3cjs.uc; exports.fetchIdentifiersAndCreateMissing = _chunkSJFPYDA3cjs.ic; exports.fetchPartitions = _chunkSJFPYDA3cjs.Wc; exports.fetchPrivacyCenterId = _chunkSJFPYDA3cjs.Pc; exports.fetchPrivacyCenterUrl = _chunkSJFPYDA3cjs.Oc; exports.fetchPromptsWithVariables = _chunkSJFPYDA3cjs.Kc; exports.fetchRequestDataSilo = _chunkSJFPYDA3cjs.Le; exports.fetchRequestDataSiloActiveCount = _chunkSJFPYDA3cjs.De; exports.fetchRequestDataSilos = _chunkSJFPYDA3cjs.Ke; exports.fetchRequestFilesForRequest = _chunkSJFPYDA3cjs.Se; exports.filterNullishValuesFromObject = Am; exports.filterRows = _chunkKR377AJUcjs.s; exports.fuzzyMatchColumns = _chunkKR377AJUcjs.l; exports.fuzzySearch = _chunkKR377AJUcjs.k; exports.generateCrossAccountApiKeys = _chunkUJ3GGOXXcjs.a; exports.getFileMetadataForPrivacyRequests = _chunkKR377AJUcjs.D; exports.getGitFilesThatChanged = Rm; exports.getUniqueValuesForColumn = _chunkKR377AJUcjs.r; exports.inquirerAutoComplete = _chunkWJOUZOWGcjs.c; exports.inquirerConfirmBoolean = _chunkWJOUZOWGcjs.a; exports.inquirerConfirmText = _chunkWJOUZOWGcjs.b; exports.listDirectories = _chunkUJ3GGOXXcjs.d; exports.listFiles = _chunkUJ3GGOXXcjs.c; exports.loginUser = _chunkSJFPYDA3cjs.Ne; exports.makeGraphQLRequest = _chunkSJFPYDA3cjs.gc; exports.mapColumnsToAttributes = _chunkKR377AJUcjs.M; exports.mapColumnsToIdentifiers = _chunkKR377AJUcjs.K; exports.mapCsvColumnsToApi = _chunkKR377AJUcjs.u; exports.mapCsvRowsToRequestInputs = _chunkKR377AJUcjs.z; exports.mapEnumValues = _chunkKR377AJUcjs.m; exports.mapRequestEnumValues = _chunkKR377AJUcjs.v; exports.markCronIdentifierCompleted = _chunk2VOZMXOEcjs.d; exports.markRequestDataSiloIdsCompleted = _chunk2VOZMXOEcjs.f; exports.markSilentPrivacyRequests = _chunkKR377AJUcjs.t; exports.mergeTranscendInputs = _chunkIBTP5OXEcjs.a; exports.name = _chunkEG4L6YAJcjs.a; exports.normalizeIdentifierValue = _chunkKR377AJUcjs.y; exports.notifyPrivacyRequestsAdditionalTime = _chunkKR377AJUcjs.J; exports.parseAssessmentDisplayLogic = _chunkSJFPYDA3cjs.de; exports.parseAssessmentRiskLogic = _chunkSJFPYDA3cjs.fe; exports.parseAttributesFromString = _chunkKR377AJUcjs.p; exports.parseFilePath = _chunkZVK4HIDFcjs.d; exports.parseVariablesFromString = _chunkTD7ADMVOcjs.a; exports.pullAllDatapoints = _chunkBN4LSJ6Ucjs.a; exports.pullChunkedCustomSiloOutstandingIdentifiers = _chunk2VOZMXOEcjs.g; exports.pullConsentManagerMetrics = _chunkLYJU4HTNcjs.d; exports.pullCronPageOfIdentifiers = _chunk2VOZMXOEcjs.b; exports.pullManualEnrichmentIdentifiersToCsv = _chunk7OIWW7TJcjs.a; exports.pullPrivacyRequests = _chunkKR377AJUcjs.U; exports.pullTranscendConfiguration = _chunkSJFPYDA3cjs.je; exports.pullUnstructuredSubDataPointRecommendations = _chunkBN4LSJ6Ucjs.b; exports.pushCronIdentifiersFromCsv = _chunk2VOZMXOEcjs.e; exports.pushManualEnrichmentIdentifiersFromCsv = _chunk7OIWW7TJcjs.d; exports.readCsv = _chunkKR377AJUcjs.q; exports.readTranscendYaml = _chunkKOV2SQO2cjs.d; exports.removeLinks = Pm; exports.removeUnverifiedRequestIdentifiers = _chunkKR377AJUcjs.W; exports.replaceVariablesInYaml = _chunkKOV2SQO2cjs.c; exports.reportPromptRun = _chunkSJFPYDA3cjs.Ve; exports.restartPrivacyRequest = _chunkKR377AJUcjs.P; exports.retryRequestDataSilos = _chunkKR377AJUcjs.T; exports.retryRequestEnricher = _chunkSJFPYDA3cjs.Ae; exports.setResourceAttributes = _chunkSJFPYDA3cjs.ze; exports.skipPreflightJobs = _chunkKR377AJUcjs.R; exports.skipRequestDataSilos = _chunkKR377AJUcjs.V; exports.splitCsvToList = _chunkKR377AJUcjs.n; exports.streamPrivacyRequestFiles = _chunkKR377AJUcjs.E; exports.submitPrivacyRequest = _chunkKR377AJUcjs.H; exports.syncAction = _chunkSJFPYDA3cjs.kd; exports.syncActionItemCollections = _chunkSJFPYDA3cjs.wd; exports.syncActionItems = _chunkSJFPYDA3cjs.Ad; exports.syncAgentFiles = _chunkSJFPYDA3cjs.Id; exports.syncAgentFunctions = _chunkSJFPYDA3cjs.Ed; exports.syncAgents = _chunkSJFPYDA3cjs.td; exports.syncAttribute = _chunkSJFPYDA3cjs.mc; exports.syncBusinessEntities = _chunkSJFPYDA3cjs.fd; exports.syncCodePackages = _chunkSJFPYDA3cjs.se; exports.syncConfigurationToTranscend = _chunkSJFPYDA3cjs.Vd; exports.syncConsentManager = _chunkSJFPYDA3cjs._c; exports.syncConsentManagerExperiences = _chunkSJFPYDA3cjs.Zc; exports.syncCookies = _chunkSJFPYDA3cjs.Ec; exports.syncDataCategories = _chunkSJFPYDA3cjs.Qd; exports.syncDataFlows = _chunkSJFPYDA3cjs.jd; exports.syncDataSiloDependencies = _chunkSJFPYDA3cjs.wc; exports.syncDataSilos = _chunkSJFPYDA3cjs.vc; exports.syncDataSubject = _chunkSJFPYDA3cjs.Gc; exports.syncEnricher = _chunkSJFPYDA3cjs.lc; exports.syncIdentifier = _chunkSJFPYDA3cjs.jc; exports.syncIntlMessages = _chunkSJFPYDA3cjs.Uc; exports.syncPartitions = _chunkSJFPYDA3cjs.Xc; exports.syncPolicies = _chunkSJFPYDA3cjs.Sc; exports.syncPrivacyCenter = _chunkSJFPYDA3cjs.Vc; exports.syncProcessingPurposes = _chunkSJFPYDA3cjs.Ud; exports.syncPrompts = _chunkSJFPYDA3cjs.Nc; exports.syncRepositories = _chunkSJFPYDA3cjs.pe; exports.syncSoftwareDevelopmentKits = _chunkSJFPYDA3cjs.me; exports.syncTemplate = _chunkSJFPYDA3cjs.md; exports.syncVendors = _chunkSJFPYDA3cjs.Md; exports.updateActionItem = _chunkSJFPYDA3cjs.zd; exports.updateActionItemCollection = _chunkSJFPYDA3cjs.vd; exports.updateAgentFiles = _chunkSJFPYDA3cjs.Hd; exports.updateAgentFunctions = _chunkSJFPYDA3cjs.Dd; exports.updateAgents = _chunkSJFPYDA3cjs.sd; exports.updateBusinessEntities = _chunkSJFPYDA3cjs.ed; exports.updateCodePackages = _chunkSJFPYDA3cjs.re; exports.updateConsentManagerToLatest = _chunkSJFPYDA3cjs.Ue; exports.updateConsentManagerVersionToLatest = _chunkLYJU4HTNcjs.a; exports.updateDataCategories = _chunkSJFPYDA3cjs.Pd; exports.updateDataFlows = _chunkSJFPYDA3cjs.hd; exports.updateIntlMessages = _chunkSJFPYDA3cjs.Tc; exports.updateOrCreateCookies = _chunkSJFPYDA3cjs.Dc; exports.updatePolicies = _chunkSJFPYDA3cjs.Rc; exports.updateProcessingPurposes = _chunkSJFPYDA3cjs.Td; exports.updatePrompts = _chunkSJFPYDA3cjs.Mc; exports.updateRepositories = _chunkSJFPYDA3cjs.oe; exports.updateSoftwareDevelopmentKits = _chunkSJFPYDA3cjs.le; exports.updateVendors = _chunkSJFPYDA3cjs.Ld; exports.uploadConsents = _chunkTEOKGAUXcjs.f; exports.uploadCookiesFromCsv = _chunkLYJU4HTNcjs.c; exports.uploadDataFlowsFromCsv = _chunkLYJU4HTNcjs.b; exports.uploadPrivacyRequestsFromCsv = _chunkKR377AJUcjs.O; exports.uploadSiloDiscoveryResults = _chunkSJFPYDA3cjs.te; exports.validateTranscendAuth = _chunkUJ3GGOXXcjs.b; exports.version = _chunkS6XB2PPWcjs.b; exports.writeCsv = _chunkZVK4HIDFcjs.c; exports.writeCsvSync = _chunkZVK4HIDFcjs.a; exports.writeLargeCsv = _chunkZVK4HIDFcjs.e; exports.writeTranscendYaml = _chunkKOV2SQO2cjs.e;
5
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/index.cjs","../src/lib/ai/TranscendPromptManager.ts","../src/lib/graphql/fetchLargeLanguageModels.ts","../src/lib/ai/getGitFilesThatChanged.ts"],"names":["PAGE_SIZE","fetchAllLargeLanguageModels","client","largeLanguageModels","offset","shouldContinue","nodes","makeGraphQLRequest","LARGE_LANGUAGE_MODELS","a","b","createRegexForTag","tagName","defineTranscendPrompts","prompts","jsonParseSafe","obj","TranscendPromptManager","handlebarsOptions","transcendUrl","DEFAULT_TRANSCEND_API","transcendApiKey","requireApproval","cacheDuration","defaultVariables","buildTranscendGraphQLClient","createHandlebarsWithHelpers","promptDefinitions","getValues","promptIds","id","x","promptTitles","title","agentNames","uniq_default","response","agents","fetchPromptsWithVariables","fetchAllAgents","keyBy_default","model","promptByTitle","promptById","acc","v","partial","apply","result","name","agent","remoteAgent","ts","thread","fetchAllPromptThreads","names","hasCache","missingCache","groupBy_default","cachedAgents","chunkedNames","chunk_default","remoteAgents","mapSeries","chunkedName","pageOfAgents","filterBy","fetchAllAgentFiles","largeLanguageModel","matching"],"mappings":"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","file":"/Users/benbrook/transcend/cli/dist/index.cjs","sourcesContent":[null,"/* eslint-disable max-lines */\nimport {\n Optionalize,\n Requirize,\n apply,\n decodeCodec,\n getValues,\n} from '@transcend-io/type-utils';\nimport type { Handlebars } from '@transcend-io/handlebars-utils';\nimport { Secret } from '@transcend-io/secret-value';\nimport * as t from 'io-ts';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\nimport {\n Agent,\n AgentFile,\n AgentFileFilterBy,\n ReportPromptRunInput,\n buildTranscendGraphQLClient,\n fetchAllAgentFiles,\n fetchAllAgents,\n reportPromptRun,\n} from '../graphql';\nimport {\n HandlebarsInput,\n createHandlebarsWithHelpers,\n} from '@transcend-io/handlebars-utils';\nimport {\n TranscendPromptTemplated,\n TranscendPromptsAndVariables,\n fetchPromptsWithVariables,\n} from '../graphql/fetchPrompts';\nimport { GraphQLClient } from 'graphql-request';\nimport {\n PromptStatus,\n ChatCompletionRole,\n PromptRunProductArea,\n QueueStatus,\n LargeLanguageModelClient,\n} from '@transcend-io/privacy-types';\nimport {\n LargeLanguageModel,\n fetchAllLargeLanguageModels,\n} from '../graphql/fetchLargeLanguageModels';\nimport { groupBy, keyBy, uniq, chunk } from 'lodash-es';\nimport { mapSeries } from '@/lib/bluebird-replace';\nimport {\n PromptThread,\n fetchAllPromptThreads,\n} from '../graphql/fetchPromptThreads';\n\n/**\n * An LLM Prompt definition\n */\nexport type TranscendPrompt<\n TInputParams extends t.Any,\n TOutputCodec extends t.Any,\n> = (\n | {\n /** ID of the prompt */\n id: string;\n /** Title of the prompt */\n title?: string;\n }\n | {\n /** ID of the prompt */\n id?: string;\n /** Title of the prompt */\n title: string;\n }\n) & {\n /** The names of the agents that should be loaded along with the prompt */\n agentNames?: string[];\n /** Codec to validate runtime input shape */\n paramCodec: TInputParams;\n /** Codec to validate output response */\n outputCodec: TOutputCodec;\n /**\n * If the output that needs to be parsed is returned within a tag\n * e.g. <tag> or <json> - this is the name of the tag\n */\n extractFromTag?: string;\n};\n\nexport interface PromptRunResult {\n /** The ID of the prompt run created on Transcend */\n promptRunId: string;\n /** The URL of the prompt run on Transcend */\n promptRunUrl: string;\n}\n\n/**\n * Create a regex to extract data from a tag\n *\n * Input:\n * \"here is some data <tag>Data</tag>...\"\n *\n * @param tagName - Name of tag\n * @returns Data within the tag\n */\nexport function createRegexForTag(tagName: string): RegExp {\n return new RegExp(`<${tagName}>([\\\\s\\\\S]+?)<\\\\/${tagName}>`);\n}\n\n/**\n * Helper function to declare prompts\n *\n * @param prompts - Prompt config\n * @returns Prompts as identity function - but type enforced\n */\nexport function defineTranscendPrompts<\n TPromptNames extends string,\n TPrompts extends { [k in TPromptNames]: TranscendPrompt<t.Any, t.Any> },\n>(prompts: TPrompts): TPrompts {\n return prompts;\n}\n\n/**\n * Helper to get the type of the parameter for a given prompt\n */\nexport type GetPromptParamType<\n TPromptName extends keyof TPrompts,\n TPrompts extends { [k in TPromptName]: TranscendPrompt<t.Any, t.Any> },\n> = t.TypeOf<TPrompts[TPromptName]['paramCodec']>;\n\n/**\n * Helper to get the type of the parameter for a given prompt\n */\nexport type GetPromptResponseType<\n TPromptName extends keyof TPrompts,\n TPrompts extends { [k in TPromptName]: TranscendPrompt<t.Any, t.Any> },\n> = t.TypeOf<TPrompts[TPromptName]['outputCodec']>;\n\n/**\n * Input for reporting a prompt run\n */\nexport interface ReportPromptRunOptions\n extends Optionalize<\n Omit<ReportPromptRunInput, 'status' | 'promptId' | 'largeLanguageModelId'>,\n 'name' | 'productArea'\n > {\n /** The large language model being run. Either the ID of the LLM or the client/name pairing */\n largeLanguageModel:\n | string\n | {\n /** Name of client */\n client: LargeLanguageModelClient;\n /** Name of the model */\n name: string;\n };\n}\n\nconst jsonParseSafe = (obj: string): unknown => {\n try {\n return JSON.parse(obj);\n } catch (e) {\n return obj;\n }\n};\n\n/**\n * A class that is capable of loading and insert variables into prompts from\n * Transcend's Prompt Manager\n */\nexport class TranscendPromptManager<\n TPromptNames extends string,\n TPrompts extends { [k in TPromptNames]: TranscendPrompt<t.Any, t.Any> },\n> {\n /** Prompt definitions */\n public prompts: TPrompts;\n\n /** Options for configuring handlebars */\n public handlebarsOptions!: HandlebarsInput;\n\n /** Prompt name -> content map, populated by call to Transcend API */\n public promptContentMap?: { [k in TPromptNames]: TranscendPromptTemplated };\n\n /** The large language models that are registered to this organization for reporting */\n public largeLanguageModels: LargeLanguageModel[] = [];\n\n /** The agent definitions registered to this organization */\n private agentsByName: { [name in string]: Agent } = {};\n\n /** The agent definitions registered to this organization */\n private agentsByAgentId: { [id in string]: Agent } = {};\n\n /** The GraphQL client that can be used to call Transcend */\n public graphQLClient: GraphQLClient;\n\n /** The set of variables to expose in handlebars context specified at class initiation */\n public defaultVariables: { [k in string]: unknown };\n\n /**\n * The set of variables to expose in handlebars context,\n * merges defaults with calculated variables from the inventory\n */\n public variables: { [k in string]: unknown };\n\n /** Handlebars compiler */\n public handlebars: typeof Handlebars;\n\n /** The Transcend API key */\n public transcendApiKey: string | Secret<string>;\n\n /** API of Transcend to call */\n public transcendUrl: string;\n\n /** When true, throw an error if the prompt is not approved */\n public requireApproval: boolean;\n\n /**\n * The cache duration in ms for how long prompts and associated metadata should be cached\n * When undefined - prompts are cached indefinitely unless explicitly re-requested\n * When 0, prompts and metadata are fetched every time (not recommended)\n * Setting this to be an hour is a good rate that optimizes for performance and keeping up to date\n */\n public cacheDuration?: number;\n\n /**\n * The last time the metadata was fetched\n */\n public lastUpdatedAt?: Date;\n\n /**\n * Constructor\n *\n * @param options - Options\n */\n constructor({\n prompts,\n handlebarsOptions = {},\n transcendUrl = DEFAULT_TRANSCEND_API,\n transcendApiKey,\n requireApproval = true,\n cacheDuration,\n defaultVariables = {},\n }: {\n /** Prompt definitions to load */\n prompts: TPrompts;\n /** Options for configuring handlebars */\n handlebarsOptions?: HandlebarsInput;\n /** The Transcend API key */\n transcendApiKey: string | Secret<string>;\n /** API of Transcend to call */\n transcendUrl?: string;\n /** When true, throw an error if the prompt is not approved */\n requireApproval?: boolean;\n /** The set of variables to expose in handlebars context specified at class initiation */\n defaultVariables?: { [k in string]: unknown };\n /**\n * The cache duration in ms for how long prompts and associated metadata should be cached\n * When undefined - prompts are cached indefinitely unless explicitly re-requested\n * When 0, prompts and metadata are fetched every time (not recommended)\n * Setting this to be an hour is a good rate that optimizes for performance and keeping up to date\n */\n cacheDuration?: number;\n }) {\n this.prompts = prompts;\n this.transcendUrl = transcendUrl;\n this.transcendApiKey = transcendApiKey;\n this.variables = defaultVariables;\n this.defaultVariables = defaultVariables;\n this.graphQLClient = buildTranscendGraphQLClient(\n transcendUrl,\n typeof transcendApiKey === 'object'\n ? transcendApiKey.release()\n : transcendApiKey,\n );\n this.requireApproval = requireApproval;\n this.cacheDuration = cacheDuration;\n this.handlebarsOptions = handlebarsOptions;\n this.handlebars = createHandlebarsWithHelpers(handlebarsOptions);\n }\n\n /**\n * Fetch prompt metadata from Transcend and cache to the class definition\n *\n * @returns A function that can be used to call the prompt\n */\n async fetchPromptsAndMetadata(): Promise<TranscendPromptsAndVariables> {\n // Determine what to fetch\n const promptDefinitions = getValues(this.prompts) as TranscendPrompt<\n t.Any,\n t.Any\n >[];\n const promptIds = promptDefinitions\n .map(({ id }) => id)\n .filter((x): x is string => !!x);\n const promptTitles = promptDefinitions\n .map(({ title }) => title)\n .filter((x): x is string => !!x);\n const agentNames = uniq(\n promptDefinitions.map(({ agentNames }) => agentNames || []).flat(),\n );\n\n // Fetch prompts and data\n const [response, largeLanguageModels, agents] = await Promise.all([\n fetchPromptsWithVariables(this.graphQLClient, {\n promptIds,\n promptTitles,\n }),\n fetchAllLargeLanguageModels(this.graphQLClient),\n fetchAllAgents(this.graphQLClient, { names: agentNames }),\n ]);\n this.agentsByName = keyBy(agents, 'name');\n this.agentsByAgentId = keyBy(agents, 'agentId');\n this.largeLanguageModels = largeLanguageModels.filter(\n (model) => model.isTranscendHosted === false,\n );\n\n // Lookup prompts by id/title\n const promptByTitle = keyBy(response.prompts, 'title');\n const promptById = keyBy(response.prompts, 'id');\n\n // Update variables\n this.variables = {\n ...response.calculatedVariables.reduce(\n (acc, v) =>\n Object.assign(acc, {\n [v.name]: v.data ? JSON.parse(v.data) : v.data,\n }),\n {},\n ),\n ...this.defaultVariables,\n };\n\n // Update partials\n this.handlebars = createHandlebarsWithHelpers({\n ...this.handlebarsOptions,\n templates: [\n ...(this.handlebarsOptions.templates || []),\n ...response.promptPartials.map((partial) => ({\n name: partial.slug,\n content: partial.content,\n })),\n ],\n });\n\n // Create mapping from prompt to content\n this.promptContentMap = apply(this.prompts, ({ id, title }) => {\n const result = id\n ? promptById[id]\n : title\n ? promptByTitle[title]\n : undefined;\n if (!result) {\n throw new Error(\n `Failed to find prompt with title: \"${title}\" and id: \"${id}\"`,\n );\n }\n return result;\n });\n\n // For cache\n this.lastUpdatedAt = new Date();\n\n return response;\n }\n\n /**\n * Get an agent definition by name\n *\n * @param name - Name of the agent to grab\n * @returns Large language model configuration\n */\n async getAgentByName(name: string): Promise<Agent | undefined> {\n const agent = this.agentsByName[name];\n if (agent) {\n return agent;\n }\n const [remoteAgent] = await fetchAllAgents(this.graphQLClient, {\n names: [name],\n });\n if (!remoteAgent) {\n return undefined;\n }\n this.agentsByName[remoteAgent.name] = remoteAgent;\n this.agentsByAgentId[remoteAgent.agentId] = remoteAgent;\n return remoteAgent;\n }\n\n /**\n * Get a prompt thread by ts\n *\n * @param ts - the slack message timestamp to look up thread for\n * @returns Large language model configuration\n */\n async getPromptThreadBySlackTs(\n ts: string,\n ): Promise<PromptThread | undefined> {\n const [thread] = await fetchAllPromptThreads(this.graphQLClient, {\n slackMessageTs: [ts],\n });\n return thread;\n }\n\n /**\n * Get a list of agent definitions by name.\n * Pulls from cache and may return less agents\n * than requested if some are not found\n *\n * @param names - Names of agents to fetch\n * @returns The agents that were found matching the names\n */\n async getAgentsByName(names: string[]): Promise<Agent[]> {\n if (names.length < 1) {\n throw new Error('Expected at least one name to be provided');\n }\n const { hasCache = [], missingCache = [] } = groupBy(names, (name) =>\n this.agentsByName[name] ? 'hasCache' : 'missingCache',\n );\n const cachedAgents = hasCache.map((name) => this.agentsByName[name]);\n if (missingCache.length === 0) {\n return cachedAgents;\n }\n const chunkedNames = chunk(missingCache, 50);\n const remoteAgents: Agent[] = [];\n await mapSeries(chunkedNames, async (chunkedName) => {\n const pageOfAgents = await fetchAllAgents(this.graphQLClient, {\n names: chunkedName,\n });\n pageOfAgents.forEach((agent) => {\n this.agentsByName[agent.name] = agent;\n this.agentsByAgentId[agent.agentId] = agent;\n });\n remoteAgents.push(...pageOfAgents);\n });\n return [...cachedAgents, ...remoteAgents];\n }\n\n /**\n * Fetch metadata on agent files\n *\n * @param filterBy - Filter by parameters\n * @returns The files found matching the filter\n */\n getAgentFiles(filterBy: AgentFileFilterBy): Promise<AgentFile[]> {\n return fetchAllAgentFiles(this.graphQLClient, filterBy);\n }\n\n /**\n * Look up the large language model to report on\n *\n * @param largeLanguageModel - Input\n * @returns Large language model configuration\n */\n getLargeLanguageModel(\n largeLanguageModel: ReportPromptRunOptions['largeLanguageModel'],\n ): LargeLanguageModel {\n const matching = this.largeLanguageModels.find((model) =>\n typeof largeLanguageModel === 'string'\n ? model.id === largeLanguageModel\n : model.name === largeLanguageModel.name &&\n model.client === largeLanguageModel.client,\n );\n if (!matching) {\n throw new Error(\n `Failed to find model matching: ${\n typeof largeLanguageModel === 'string'\n ? largeLanguageModel\n : JSON.stringify(largeLanguageModel)\n }`,\n );\n }\n return matching;\n }\n\n /**\n * Get a prompt definition by name\n *\n * @param promptName - Prompt to compile\n * @returns Parsed content\n */\n async getPromptDefinition<TPromptName extends TPromptNames>(\n promptName: TPromptName,\n ): Promise<TranscendPromptTemplated> {\n // Determine if prompts need to be fetched\n if (\n // never been fetched\n !this.lastUpdatedAt ||\n // fetch every run\n this.cacheDuration === 0 ||\n // If cache duration met\n (this.cacheDuration &&\n Date.now() - this.lastUpdatedAt.getTime() > this.cacheDuration)\n ) {\n await this.fetchPromptsAndMetadata();\n }\n\n // Lookup prompt\n const { promptContentMap } = this;\n if (!promptContentMap) {\n throw new Error('Expected this.promptContentMap to be defined');\n }\n const promptTemplate = promptContentMap[promptName];\n if (!promptTemplate) {\n throw new Error(\n `Expected this.promptContentMap[${promptName}] to be defined`,\n );\n }\n return promptTemplate;\n }\n\n /**\n * Validate the shape of the response from AI\n *\n * @param promptName - Prompt to compile\n * @param params - Runtime parameters\n * @returns Parsed content\n */\n async compilePrompt<TPromptName extends TPromptNames>(\n promptName: TPromptName,\n params: t.TypeOf<TPrompts[TPromptName]['paramCodec']>,\n ): Promise<string> {\n // Grab the prompt\n const promptTemplate = await this.getPromptDefinition(promptName);\n const promptInput = this.prompts[promptName];\n if (!promptInput) {\n throw new Error(`Expected this.prompts[${promptName}] to be defined`);\n }\n\n // Ensure prompt is approved\n if (\n this.requireApproval &&\n promptTemplate.status !== PromptStatus.Approved\n ) {\n throw new Error(\n `Assessment \"${promptTemplate.title}\" cannot be used because its in status: \"${promptTemplate.status}\"`,\n );\n }\n\n // If prompt is rejected, throw error\n if (promptTemplate.status === PromptStatus.Rejected) {\n throw new Error(\n `Assessment \"${promptTemplate.title}\" cannot be used because it's in status: \"${promptTemplate.status}\"`,\n );\n }\n\n // Validate params\n decodeCodec(promptInput.paramCodec, params);\n\n // Compile prompt and template\n return this.handlebars.compile(promptTemplate.content)({\n // template in currentDate by default\n currentDate: new Date().toISOString(),\n ...this.variables,\n ...params,\n });\n }\n\n /**\n * Validate the shape of the response from AI\n *\n * @param promptName - Prompt to parse\n * @param response - AI response as string\n * @returns Parsed content\n */\n parseAiResponse<TPromptName extends TPromptNames>(\n promptName: TPromptName,\n response: string,\n ): t.TypeOf<TPrompts[TPromptName]['outputCodec']> {\n // Look up prompt info\n const promptInput = this.prompts[promptName];\n if (!promptInput) {\n throw new Error(`Expected this.prompts[${promptName}] to be defined`);\n }\n\n // Extract from tag if needed\n const extracted = promptInput.extractFromTag\n ? (createRegexForTag(promptInput.extractFromTag).exec(response) ||\n [])[1] || response\n : response;\n\n // Parse via codec\n return decodeCodec(\n promptInput.outputCodec,\n jsonParseSafe(extracted),\n false,\n );\n }\n\n /**\n * Parse the AI response and report back to Transcend\n *\n * @param promptName - Prompt to parse\n * @param options - Options for reporting\n * @returns Parsed content\n */\n async reportAndParsePromptRun<TPromptName extends TPromptNames>(\n promptName: TPromptName,\n { largeLanguageModel, ...options }: ReportPromptRunOptions,\n ): Promise<\n PromptRunResult & {\n /** Resulting prompt run */\n result: t.TypeOf<TPrompts[TPromptName]['outputCodec']>;\n }\n > {\n // Determine if prompts need to be fetched\n if (\n // never been fetched\n !this.lastUpdatedAt ||\n // fetch every run\n this.cacheDuration === 0 ||\n // If cache duration met\n (this.cacheDuration &&\n Date.now() - this.lastUpdatedAt.getTime() > this.cacheDuration)\n ) {\n await this.fetchPromptsAndMetadata();\n }\n\n const name =\n options.name ||\n `@transcend-io/cli-prompt-run-${new Date().toISOString()}`;\n\n if (!this.promptContentMap) {\n throw new Error('Expected this.promptContentMap to be defined');\n }\n // Look up prompt info\n const promptInput = this.promptContentMap[promptName];\n if (!promptInput) {\n throw new Error(`Expected this.prompts[${promptName}] to be defined`);\n }\n\n // Ensure the first message in `promptRunMessages` is of type=system\n if (options.promptRunMessages.length === 0) {\n throw new Error('promptRunMessages is expected to have length > 0');\n }\n if (options.promptRunMessages[0].role !== ChatCompletionRole.System) {\n throw new Error(\n `promptRunMessages[0].role is expected to be = ${ChatCompletionRole.System}`,\n );\n }\n if (\n options.promptRunMessages[options.promptRunMessages.length - 1].role !==\n ChatCompletionRole.Assistant\n ) {\n throw new Error(\n `promptRunMessages[${\n options.promptRunMessages.length - 1\n }].role is expected to be = ${ChatCompletionRole.Assistant}`,\n );\n }\n const response =\n options.promptRunMessages[options.promptRunMessages.length - 1].content;\n\n let parsed: t.TypeOf<TPrompts[TPromptName]['outputCodec']>;\n try {\n // Parse the response\n parsed = this.parseAiResponse(promptName, response);\n } catch (err) {\n await reportPromptRun(this.graphQLClient, {\n productArea: PromptRunProductArea.PromptManager,\n ...options,\n name,\n error: err.message,\n status: QueueStatus.Error,\n ...(typeof largeLanguageModel === 'string'\n ? { largeLanguageModelId: largeLanguageModel }\n : {\n largeLanguageModelName: largeLanguageModel.name,\n largeLanguageModelClient: largeLanguageModel.client,\n }),\n promptId: promptInput.id,\n promptRunMessages: options.promptRunMessages.map((message, ind) => ({\n ...message,\n ...(ind === 0 ? { template: promptInput.content } : {}),\n })),\n });\n throw err;\n }\n\n // report successful run\n const promptRunId = await reportPromptRun(this.graphQLClient, {\n productArea: PromptRunProductArea.PromptManager,\n ...options,\n name,\n status: QueueStatus.Resolved,\n ...(typeof largeLanguageModel === 'string'\n ? { largeLanguageModelId: largeLanguageModel }\n : {\n largeLanguageModelName: largeLanguageModel.name,\n largeLanguageModelClient: largeLanguageModel.client,\n }),\n promptId: promptInput.id,\n promptRunMessages: options.promptRunMessages.map((message, ind) => ({\n ...message,\n ...(ind === 0 ? { template: promptInput.content } : {}),\n })),\n });\n\n return {\n result: parsed,\n promptRunId,\n promptRunUrl: `https://app.transcend.io/prompts/runs/${promptRunId}`,\n };\n }\n\n /**\n * Report an error for a particular prompt\n *\n * @param promptName - Prompt to parse\n * @param options - Options for reporting\n * @returns Parsed content\n */\n async reportPromptRunError<TPromptName extends TPromptNames>(\n promptName: TPromptName,\n {\n largeLanguageModel,\n ...options\n }: Requirize<ReportPromptRunOptions, 'error'>,\n ): Promise<PromptRunResult> {\n // Determine if prompts need to be fetched\n if (\n // never been fetched\n !this.lastUpdatedAt ||\n // fetch every run\n this.cacheDuration === 0 ||\n // If cache duration met\n (this.cacheDuration &&\n Date.now() - this.lastUpdatedAt.getTime() > this.cacheDuration)\n ) {\n await this.fetchPromptsAndMetadata();\n }\n\n const name =\n options.name ||\n `@transcend-io/cli-prompt-run-${new Date().toISOString()}`;\n\n if (!this.promptContentMap) {\n throw new Error('Expected this.promptContentMap to be defined');\n }\n // Look up prompt info\n const promptInput = this.promptContentMap[promptName];\n if (!promptInput) {\n throw new Error(`Expected this.prompts[${promptName}] to be defined`);\n }\n\n // Ensure the first message in `promptRunMessages` is of type=system\n if (options.promptRunMessages.length === 0) {\n throw new Error('promptRunMessages is expected to have length > 0');\n }\n if (options.promptRunMessages[0].role !== ChatCompletionRole.System) {\n throw new Error(\n `promptRunMessages[0].role is expected to be = ${ChatCompletionRole.System}`,\n );\n }\n\n const promptRunId = await reportPromptRun(this.graphQLClient, {\n productArea: PromptRunProductArea.PromptManager,\n ...options,\n name,\n status: QueueStatus.Error,\n ...(typeof largeLanguageModel === 'string'\n ? { largeLanguageModelId: largeLanguageModel }\n : {\n largeLanguageModelName: largeLanguageModel.name,\n largeLanguageModelClient: largeLanguageModel.client,\n }),\n promptId: promptInput.id,\n promptRunMessages: options.promptRunMessages.map((message, ind) => ({\n ...message,\n ...(ind === 0 ? { template: promptInput.content } : {}),\n })),\n });\n\n return {\n promptRunId,\n promptRunUrl: `https://app.transcend.io/prompts/runs/${promptRunId}`,\n };\n }\n}\n/* eslint-enable max-lines */\n","import { GraphQLClient } from 'graphql-request';\nimport { LargeLanguageModelClient } from '@transcend-io/privacy-types';\nimport { LARGE_LANGUAGE_MODELS } from './gqls';\nimport { makeGraphQLRequest } from './makeGraphQLRequest';\n\nexport interface LargeLanguageModel {\n /** ID of prompts */\n id: string;\n /** The name of the large language model. */\n name: string;\n /** The content of the prompt template. */\n client: LargeLanguageModelClient;\n /** Whether hosted by Transcend or not */\n isTranscendHosted: boolean;\n}\n\nconst PAGE_SIZE = 20;\n\n/**\n * Fetch all LargeLanguageModels in the organization\n *\n * @param client - GraphQL client\n * @returns All LargeLanguageModels in the organization\n */\nexport async function fetchAllLargeLanguageModels(\n client: GraphQLClient,\n): Promise<LargeLanguageModel[]> {\n const largeLanguageModels: LargeLanguageModel[] = [];\n let offset = 0;\n\n // Whether to continue looping\n let shouldContinue = false;\n do {\n const {\n largeLanguageModels: { nodes },\n } = await makeGraphQLRequest<{\n /** LargeLanguageModels */\n largeLanguageModels: {\n /** List */\n nodes: LargeLanguageModel[];\n };\n }>(client, LARGE_LANGUAGE_MODELS, {\n first: PAGE_SIZE,\n offset,\n });\n largeLanguageModels.push(...nodes);\n offset += PAGE_SIZE;\n shouldContinue = nodes.length === PAGE_SIZE;\n } while (shouldContinue);\n\n return largeLanguageModels.sort((a, b) => a.name.localeCompare(b.name));\n}\n","import { difference } from 'lodash-es';\nimport fastGlob from 'fast-glob';\nimport { execSync } from 'child_process';\n\n/**\n * Function thats gets the git files that have changed\n * and returns the code\n *\n * @param options - Options\n * @returns Changes files and diffs\n */\nexport function getGitFilesThatChanged({\n baseBranch,\n rootDirectory,\n githubRepo,\n excludedGlob = [],\n fileBlockList = [],\n}: {\n /** Base branch */\n baseBranch: string;\n /** Github repo name */\n githubRepo: string;\n /** Root directory */\n rootDirectory: string;\n /** A glob that excludes files */\n excludedGlob?: string[];\n /** Block list of files to not process */\n fileBlockList?: string[];\n}): {\n /** The list of files that changed */\n changedFiles: string[];\n /** Github repo name */\n repoName: string;\n /** Current commit */\n commit: string;\n /** File diffs */\n fileDiffs: { [k in string]: string };\n} {\n // Pull base branch\n execSync(`git fetch origin ${baseBranch}`);\n\n // Latest commit on base branch. If we are on the base branch, we take the prior commit\n const latestBasedCommit = execSync(\n `git ls-remote ${githubRepo} \"refs/heads/${baseBranch}\" | cut -f 1`,\n { encoding: 'utf-8' },\n ).split('\\n')[0];\n\n // This commit\n const latestThisCommit = execSync('git rev-parse HEAD', {\n encoding: 'utf-8',\n }).split('\\n')[0];\n\n // Ensure commits are present\n if (!latestBasedCommit || !latestThisCommit) {\n throw new Error('FAILED TO FIND COMMIT RANGE');\n }\n\n // Get the diff between the given branch and base branch\n const diff = execSync(\n `git fetch && git diff --name-only \"${\n baseBranch || latestBasedCommit\n }...${latestThisCommit}\" -- ${rootDirectory}`,\n { encoding: 'utf-8' },\n );\n\n // Filter out block list\n const changedFiles = difference(\n diff.split('\\n').filter((f) => f),\n fileBlockList,\n );\n\n // Filter out globs\n const filteredChanges =\n excludedGlob.length > 0\n ? fastGlob.sync(changedFiles, { ignore: excludedGlob })\n : changedFiles;\n\n // Get the contents of only the changed files\n const fileDiffs: { [k in string]: string } = {};\n filteredChanges.forEach((file) => {\n const contents = execSync(`git show ${latestThisCommit}:${file}`, {\n encoding: 'utf-8',\n });\n fileDiffs[file] = contents;\n });\n\n // Pull the github repo name\n const repoName = githubRepo.split('/').pop()!.split('.')[0];\n\n return {\n changedFiles,\n fileDiffs,\n repoName,\n commit: latestThisCommit,\n };\n}\n"]}