@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,4 @@
1
+ #!/usr/bin/env node
2
+ "use strict"; 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 _chunkT462ONFXcjs = require('../chunk-T462ONFX.cjs');var _chunkM5CAIOD3cjs = require('../chunk-M5CAIOD3.cjs');require('../chunk-OVMPZ75R.cjs');require('../chunk-EG4L6YAJ.cjs');require('../chunk-S6XB2PPW.cjs');require('../chunk-BY7W4UQF.cjs');var _core = require('@stricli/core');async function e(){let o=process.argv.slice(3);_optionalChain([process, 'access', _ => _.env, 'access', _2 => _2.COMP_LINE, 'optionalAccess', _3 => _3.endsWith, 'call', _4 => _4(" ")])&&o.push(""),await _core.proposeCompletions.call(void 0, _chunkM5CAIOD3cjs.a,o,_chunkT462ONFXcjs.a.call(void 0, process));try{for(let{completion:r}of await _core.proposeCompletions.call(void 0, _chunkM5CAIOD3cjs.a,o,_chunkT462ONFXcjs.a.call(void 0, process)))process.stdout.write(`${r}
3
+ `)}catch (e2){}}e();
4
+ //# sourceMappingURL=bash-complete.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/bin/bash-complete.cjs","../../src/bin/bash-complete.ts"],"names":["main","inputs","proposeCompletions","app","buildContext","completion"],"mappings":"AAAA;AACA,0kBAAyC,yDAA0C,iCAA8B,iCAA8B,iCAA8B,iCAA8B,qCCAxK,MAOnC,SAAeA,CAAAA,CAAAA,CAAsB,CACnC,IAAMC,CAAAA,CAAS,OAAA,CAAQ,IAAA,CAAK,KAAA,CAAM,CAAC,CAAA,iBAC/B,OAAA,mBAAQ,GAAA,qBAAI,SAAA,6BAAW,QAAA,mBAAS,GAAG,GAAA,EACrCA,CAAAA,CAAO,IAAA,CAAK,EAAE,CAAA,CAEhB,MAAMC,sCAAAA,mBAAmBC,CAAKF,CAAAA,CAAQG,iCAAAA,OAAoB,CAAC,CAAA,CAC3D,GAAI,CACF,GAAA,CAAA,GAAW,CAAE,UAAA,CAAAC,CAAW,CAAA,GAAK,MAAMH,sCAAAA,mBACjCC,CACAF,CAAAA,CACAG,iCAAAA,OAAoB,CACtB,CAAA,CACE,OAAA,CAAQ,MAAA,CAAO,KAAA,CAAM,CAAA,EAAA;AAOtB","file":"/Users/benbrook/transcend/cli/dist/bin/bash-complete.cjs","sourcesContent":[null,"#!/usr/bin/env node\nimport { proposeCompletions } from '@stricli/core';\nimport { app } from '../app';\nimport { buildContext } from '../context';\n\n/**\n * Install bash complete\n */\nasync function main(): Promise<void> {\n const inputs = process.argv.slice(3);\n if (process.env.COMP_LINE?.endsWith(' ')) {\n inputs.push('');\n }\n await proposeCompletions(app, inputs, buildContext(process));\n try {\n for (const { completion } of await proposeCompletions(\n app,\n inputs,\n buildContext(process),\n )) {\n process.stdout.write(`${completion}\\n`);\n }\n } catch {\n // ignore\n }\n}\n\nmain();\n"]}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ "use strict";var _chunkT462ONFXcjs = require('../chunk-T462ONFX.cjs');var _chunkM5CAIOD3cjs = require('../chunk-M5CAIOD3.cjs');require('../chunk-OVMPZ75R.cjs');require('../chunk-EG4L6YAJ.cjs');require('../chunk-S6XB2PPW.cjs');require('../chunk-BY7W4UQF.cjs');var _core = require('@stricli/core');async function n(){await _core.run.call(void 0, _chunkM5CAIOD3cjs.a,process.argv.slice(2),_chunkT462ONFXcjs.a.call(void 0, process))}n();
3
+ //# sourceMappingURL=cli.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/bin/cli.cjs","../../src/bin/cli.ts"],"names":["main","run","app","buildContext"],"mappings":"AAAA;AACA,sEAAyC,yDAA0C,iCAA8B,iCAA8B,iCAA8B,iCAA8B,qCCAvL,MAOpB,SAAeA,CAAAA,CAAAA,CAAsB,CACnC,MAAMC,uBAAAA,mBAAIC,CAAK,OAAA,CAAQ,IAAA,CAAK,KAAA,CAAM,CAAC,CAAA,CAAGC,iCAAAA,OAAoB,CAAC,CAC7D,CAEAH,CAAAA,CAAK,CAAA","file":"/Users/benbrook/transcend/cli/dist/bin/cli.cjs","sourcesContent":[null,"#!/usr/bin/env node\nimport { run } from '@stricli/core';\nimport { app } from '../app';\nimport { buildContext } from '../context';\n\n/**\n * Entrypoint for `transcend` CLI\n */\nasync function main(): Promise<void> {\n await run(app, process.argv.slice(2), buildContext(process));\n}\n\nmain();\n"]}
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ "use strict"; 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 _chunkM5CAIOD3cjs = require('../chunk-M5CAIOD3.cjs');require('../chunk-OVMPZ75R.cjs');var _chunkZUNVPK23cjs = require('../chunk-ZUNVPK23.cjs');require('../chunk-EG4L6YAJ.cjs');require('../chunk-S6XB2PPW.cjs');require('../chunk-BY7W4UQF.cjs');var _core = require('@stricli/core');var s={"tr-build-xdi-sync-endpoint":["consent","build-xdi-sync-endpoint"],"tr-consent-manager-service-json-to-yml":["inventory","consent-manager-service-json-to-yml"],"tr-consent-managers-to-business-entities":["inventory","consent-managers-to-business-entities"],"tr-cron-mark-identifiers-completed":["request","cron","mark-identifiers-completed"],"tr-cron-pull-identifiers":["request","cron","pull-identifiers"],"tr-derive-data-silos-from-data-flows":["inventory","derive-data-silos-from-data-flows"],"tr-derive-data-silos-from-data-flows-cross-instance":["inventory","derive-data-silos-from-data-flows-cross-instance"],"tr-discover-silos":["inventory","discover-silos"],"tr-generate-api-keys":["admin","generate-api-keys"],"tr-manual-enrichment-pull-identifiers":["request","preflight","pull-identifiers"],"tr-manual-enrichment-push-identifiers":["request","preflight","push-identifiers"],"tr-mark-request-data-silos-completed":["request","system","mark-request-data-silos-completed"],"tr-pull":["inventory","pull"],"tr-pull-consent-metrics":["consent","pull-consent-metrics"],"tr-pull-consent-preferences":["consent","pull-consent-preferences"],"tr-pull-datapoints":["inventory","pull-datapoints"],"tr-pull-pull-unstructured-discovery-files":["inventory","pull-unstructured-discovery-files"],"tr-push":["inventory","push"],"tr-request-approve":["request","approve"],"tr-request-cancel":["request","cancel"],"tr-request-download-files":["request","download-files"],"tr-request-enricher-restart":["request","enricher-restart"],"tr-request-export":["request","export"],"tr-request-mark-silent":["request","mark-silent"],"tr-request-notify-additional-time":["request","notify-additional-time"],"tr-request-reject-unverified-identifiers":["request","reject-unverified-identifiers"],"tr-request-restart":["request","restart"],"tr-request-upload":["request","upload"],"tr-retry-request-data-silos":["request","system","retry-request-data-silos"],"tr-scan-packages":["inventory","scan-packages"],"tr-skip-preflight-jobs":["request","skip-preflight-jobs"],"tr-skip-request-data-silos":["request","system","skip-request-data-silos"],"tr-sync-ot":["migration","sync-ot"],"tr-update-consent-manager":["consent","update-consent-manager"],"tr-upload-consent-preferences":["consent","upload-consent-preferences"],"tr-upload-cookies-from-csv":["consent","upload-cookies-from-csv"],"tr-upload-data-flows-from-csv":["consent","upload-data-flows-from-csv"],"tr-upload-preferences":["consent","upload-preferences"]};function m(t){return _optionalChain([_core.generateHelpTextForAllCommands.call(void 0, _chunkM5CAIOD3cjs.a), 'access', _ => _.find, 'call', _2 => _2(o=>o[0]===`${_chunkM5CAIOD3cjs.a.config.name} ${t.join(" ")}`), 'optionalAccess', _3 => _3[1]])}function i(t){_chunkZUNVPK23cjs.a.log("[DEPRECATION NOTICE]");let e=s[t];if(!e){let a=Object.entries(s).map(([d,l])=>`\`${d}\` -> \`${_chunkM5CAIOD3cjs.a.config.name} ${l.join(" ")}\``).join(`
3
+ `);_chunkZUNVPK23cjs.a.log(`This command is deprecated as of v7.0.0. Here is a list of new commands, mapped to their legacy command names:
4
+ ${a}`);return}_chunkZUNVPK23cjs.a.log(`\`${t}\` is deprecated as of v7.0.0.
5
+ Use \`${_chunkM5CAIOD3cjs.a.config.name} ${e.join(" ")}\` instead.
6
+ `);let o=m(e);if(!o)throw new Error(`Failed to get help text for command: \`${e.join(" ")}\``);_chunkZUNVPK23cjs.a.log(o)}function p(){let e=_optionalChain([process, 'access', _4 => _4.argv, 'access', _5 => _5.at, 'call', _6 => _6(-1), 'optionalAccess', _7 => _7.split, 'call', _8 => _8("/"), 'access', _9 => _9.pop, 'call', _10 => _10(), 'optionalAccess', _11 => _11.trim, 'call', _12 => _12()]);if(e)i(e);else throw new Error("Deprecated command");process.exit(1)}p();
7
+ //# sourceMappingURL=deprecated-command.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/bin/deprecated-command.cjs","../../src/cli/legacy-commands.ts","../../src/bin/deprecated-command.ts"],"names":["legacyCommandToModernCommandMap","getHelpTextForCommand","command","generateHelpTextForAllCommands","x"],"mappings":"AAAA;AACA,0kBAAyC,iCAA8B,yDAA0C,iCAA8B,iCAA8B,iCAA8B,qCCGpM,IAKMA,CAAAA,CAA4D,CACvE,4BAAA,CAA8B,CAAC,SAAA,CAAW,yBAAyB,CAAA,CACnE,wCAAA,CAA0C,CACxC,WAAA,CACA,qCACF,CAAA,CACA,0CAAA,CAA4C,CAC1C,WAAA,CACA,uCACF,CAAA,CACA,oCAAA,CAAsC,CACpC,SAAA,CACA,MAAA,CACA,4BACF,CAAA,CACA,0BAAA,CAA4B,CAAC,SAAA,CAAW,MAAA,CAAQ,kBAAkB,CAAA,CAClE,sCAAA,CAAwC,CACtC,WAAA,CACA,mCACF,CAAA,CACA,qDAAA,CAAuD,CACrD,WAAA,CACA,kDACF,CAAA,CACA,mBAAA,CAAqB,CAAC,WAAA,CAAa,gBAAgB,CAAA,CACnD,sBAAA,CAAwB,CAAC,OAAA,CAAS,mBAAmB,CAAA,CACrD,uCAAA,CAAyC,CACvC,SAAA,CACA,WAAA,CACA,kBACF,CAAA,CACA,uCAAA,CAAyC,CACvC,SAAA,CACA,WAAA,CACA,kBACF,CAAA,CACA,sCAAA,CAAwC,CACtC,SAAA,CACA,QAAA,CACA,mCACF,CAAA,CACA,SAAA,CAAW,CAAC,WAAA,CAAa,MAAM,CAAA,CAC/B,yBAAA,CAA2B,CAAC,SAAA,CAAW,sBAAsB,CAAA,CAC7D,6BAAA,CAA+B,CAAC,SAAA,CAAW,0BAA0B,CAAA,CACrE,oBAAA,CAAsB,CAAC,WAAA,CAAa,iBAAiB,CAAA,CACrD,2CAAA,CAA6C,CAC3C,WAAA,CACA,mCACF,CAAA,CACA,SAAA,CAAW,CAAC,WAAA,CAAa,MAAM,CAAA,CAC/B,oBAAA,CAAsB,CAAC,SAAA,CAAW,SAAS,CAAA,CAC3C,mBAAA,CAAqB,CAAC,SAAA,CAAW,QAAQ,CAAA,CACzC,2BAAA,CAA6B,CAAC,SAAA,CAAW,gBAAgB,CAAA,CACzD,6BAAA,CAA+B,CAAC,SAAA,CAAW,kBAAkB,CAAA,CAC7D,mBAAA,CAAqB,CAAC,SAAA,CAAW,QAAQ,CAAA,CACzC,wBAAA,CAA0B,CAAC,SAAA,CAAW,aAAa,CAAA,CACnD,mCAAA,CAAqC,CAAC,SAAA,CAAW,wBAAwB,CAAA,CACzE,0CAAA,CAA4C,CAC1C,SAAA,CACA,+BACF,CAAA,CACA,oBAAA,CAAsB,CAAC,SAAA,CAAW,SAAS,CAAA,CAC3C,mBAAA,CAAqB,CAAC,SAAA,CAAW,QAAQ,CAAA,CACzC,6BAAA,CAA+B,CAC7B,SAAA,CACA,QAAA,CACA,0BACF,CAAA,CACA,kBAAA,CAAoB,CAAC,WAAA,CAAa,eAAe,CAAA,CACjD,wBAAA,CAA0B,CAAC,SAAA,CAAW,qBAAqB,CAAA,CAC3D,4BAAA,CAA8B,CAC5B,SAAA,CACA,QAAA,CACA,yBACF,CAAA,CACA,YAAA,CAAc,CAAC,WAAA,CAAa,SAAS,CAAA,CACrC,2BAAA,CAA6B,CAAC,SAAA,CAAW,wBAAwB,CAAA,CACjE,+BAAA,CAAiC,CAAC,SAAA,CAAW,4BAA4B,CAAA,CACzE,4BAAA,CAA8B,CAAC,SAAA,CAAW,yBAAyB,CAAA,CACnE,+BAAA,CAAiC,CAAC,SAAA,CAAW,4BAA4B,CAAA,CACzE,uBAAA,CAAyB,CAAC,SAAA,CAAW,oBAAoB,CAC3D,CAAA,CAUO,SAASC,CAAAA,CAAsBC,CAAAA,CAAuC,CAK3E,uBAJ+BC,kDAAAA,mBAE/B,CAAA,mBAE8B,IAAA,mBAC3BC,CAAAA,EAAMA,CAAAA,CAAE,CAAC,CAAA,GAAM,CAAA,EAAA;AA2Bd;AAQgB;AAES,MAAA;AC7H1B","file":"/Users/benbrook/transcend/cli/dist/bin/deprecated-command.cjs","sourcesContent":[null,"import {\n generateHelpTextForAllCommands,\n type Application,\n type CommandContext,\n} from '@stricli/core';\nimport { app } from '../app';\nimport { logger } from '@/logger';\n\n// Maps legacy (<7.0.0) command names to their modern command structure\nexport const legacyCommandToModernCommandMap: Record<string, string[]> = {\n 'tr-build-xdi-sync-endpoint': ['consent', 'build-xdi-sync-endpoint'],\n 'tr-consent-manager-service-json-to-yml': [\n 'inventory',\n 'consent-manager-service-json-to-yml',\n ],\n 'tr-consent-managers-to-business-entities': [\n 'inventory',\n 'consent-managers-to-business-entities',\n ],\n 'tr-cron-mark-identifiers-completed': [\n 'request',\n 'cron',\n 'mark-identifiers-completed',\n ],\n 'tr-cron-pull-identifiers': ['request', 'cron', 'pull-identifiers'],\n 'tr-derive-data-silos-from-data-flows': [\n 'inventory',\n 'derive-data-silos-from-data-flows',\n ],\n 'tr-derive-data-silos-from-data-flows-cross-instance': [\n 'inventory',\n 'derive-data-silos-from-data-flows-cross-instance',\n ],\n 'tr-discover-silos': ['inventory', 'discover-silos'],\n 'tr-generate-api-keys': ['admin', 'generate-api-keys'],\n 'tr-manual-enrichment-pull-identifiers': [\n 'request',\n 'preflight',\n 'pull-identifiers',\n ],\n 'tr-manual-enrichment-push-identifiers': [\n 'request',\n 'preflight',\n 'push-identifiers',\n ],\n 'tr-mark-request-data-silos-completed': [\n 'request',\n 'system',\n 'mark-request-data-silos-completed',\n ],\n 'tr-pull': ['inventory', 'pull'],\n 'tr-pull-consent-metrics': ['consent', 'pull-consent-metrics'],\n 'tr-pull-consent-preferences': ['consent', 'pull-consent-preferences'],\n 'tr-pull-datapoints': ['inventory', 'pull-datapoints'],\n 'tr-pull-pull-unstructured-discovery-files': [\n 'inventory',\n 'pull-unstructured-discovery-files',\n ],\n 'tr-push': ['inventory', 'push'],\n 'tr-request-approve': ['request', 'approve'],\n 'tr-request-cancel': ['request', 'cancel'],\n 'tr-request-download-files': ['request', 'download-files'],\n 'tr-request-enricher-restart': ['request', 'enricher-restart'],\n 'tr-request-export': ['request', 'export'],\n 'tr-request-mark-silent': ['request', 'mark-silent'],\n 'tr-request-notify-additional-time': ['request', 'notify-additional-time'],\n 'tr-request-reject-unverified-identifiers': [\n 'request',\n 'reject-unverified-identifiers',\n ],\n 'tr-request-restart': ['request', 'restart'],\n 'tr-request-upload': ['request', 'upload'],\n 'tr-retry-request-data-silos': [\n 'request',\n 'system',\n 'retry-request-data-silos',\n ],\n 'tr-scan-packages': ['inventory', 'scan-packages'],\n 'tr-skip-preflight-jobs': ['request', 'skip-preflight-jobs'],\n 'tr-skip-request-data-silos': [\n 'request',\n 'system',\n 'skip-request-data-silos',\n ],\n 'tr-sync-ot': ['migration', 'sync-ot'],\n 'tr-update-consent-manager': ['consent', 'update-consent-manager'],\n 'tr-upload-consent-preferences': ['consent', 'upload-consent-preferences'],\n 'tr-upload-cookies-from-csv': ['consent', 'upload-cookies-from-csv'],\n 'tr-upload-data-flows-from-csv': ['consent', 'upload-data-flows-from-csv'],\n 'tr-upload-preferences': ['consent', 'upload-preferences'],\n};\n\n// All commands have been migrated to the modern command structure\n\n/**\n * Gets the help text for a command\n *\n * @param command - The command to get help text for\n * @returns The help text for the command\n */\nexport function getHelpTextForCommand(command: string[]): string | undefined {\n const helpTextForAllCommands = generateHelpTextForAllCommands(\n app as Application<CommandContext>,\n );\n\n return helpTextForAllCommands.find(\n (x) => x[0] === `${app.config.name} ${command.join(' ')}`,\n )?.[1];\n}\n\n/**\n * Logs a modern command recommendation for a legacy command\n *\n * @param legacyCommand - The legacy command to log a modern command recommendation for\n * @example\n * logModernCommandRecommendation('tr-cron-mark-identifiers-completed');\n */\nexport function logModernCommandRecommendation(\n legacyCommand: keyof typeof legacyCommandToModernCommandMap,\n): void {\n logger.log('[DEPRECATION NOTICE]');\n\n const modernCommand = legacyCommandToModernCommandMap[legacyCommand];\n if (!modernCommand) {\n const modernCommandString = Object.entries(legacyCommandToModernCommandMap)\n .map(\n ([legacyCommand, modernCommand]) =>\n `\\`${legacyCommand}\\` -> \\`${app.config.name} ${modernCommand.join(\n ' ',\n )}\\``,\n )\n .join('\\n');\n logger.log(\n 'This command is deprecated as of v7.0.0.' +\n ` Here is a list of new commands, mapped to their legacy command names:\n${modernCommandString}`,\n );\n return;\n }\n\n logger.log(\n `\\`${legacyCommand}\\` is deprecated as of v7.0.0.\\nUse \\`${\n app.config.name\n } ${modernCommand.join(' ')}\\` instead.\\n`,\n );\n\n const helpText = getHelpTextForCommand(modernCommand);\n if (!helpText) {\n throw new Error(\n `Failed to get help text for command: \\`${modernCommand.join(' ')}\\``,\n );\n }\n\n logger.log(helpText);\n}\n","#!/usr/bin/env node\nimport { logModernCommandRecommendation } from '../cli/legacy-commands';\n\n/**\n * Runs when a deprecated command is called.\n */\nfunction main(): void {\n const command = process.argv.at(-1);\n const legacyCommand = command?.split('/').pop()?.trim();\n if (legacyCommand) {\n logModernCommandRecommendation(legacyCommand);\n } else {\n throw new Error('Deprecated command');\n }\n\n process.exit(1);\n}\n\nmain();\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkSJFPYDA3cjs = require('./chunk-SJFPYDA3.cjs');function f(p,{adTechPurposes:m=["SaleOfInfo"],serviceToTitle:s,serviceToSupportedIntegration:r}){let e=[],i=[],n={};p.forEach(t=>{let{service:a,attributes:c=[]}=t;if(!a||a==="internalService")return;let u=c.find(o=>o.key==="Found on Domain");u&&(n[a]||(n[a]=[]),n[a].push(...u.values.map(o=>o.replace("https://","").replace("http://",""))),n[a]=[...new Set(n[a])]),_chunkSJFPYDA3cjs.ec.call(void 0, t.trackingPurposes,m).length>0?(i.push(a),e.includes(a)&&(e=e.filter(o=>o!==a))):i.includes(a)||e.push(a)});let h=[...new Set(i)].map(t=>({title:s[t],...r[t]?{integrationName:t}:{integrationName:"promptAPerson","outer-type":t},attributes:[{key:"Tech Type",values:["Ad Tech"]},{key:"Found On Domain",values:n[t]||[]}]}));return{siteTechDataSilos:[...new Set(e)].map(t=>({title:s[t],...r[t]?{integrationName:t}:{integrationName:"promptAPerson",outerType:t},attributes:[{key:"Tech Type",values:["Site Tech"]},{key:"Found On Domain",values:n[t]||[]}]})),adTechDataSilos:h}}exports.a = f;
2
+ //# sourceMappingURL=chunk-2KP53GQ4.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/chunk-2KP53GQ4.cjs","../src/lib/consent-manager/dataFlowsToDataSilos.ts"],"names":["dataFlowsToDataSilos","inputs","adTechPurposes","serviceToTitle","serviceToSupportedIntegration","siteTechIntegrations","adTechIntegrations","serviceToFoundOnDomain","flow","service","attributes","foundOnDomain","attr","v","union_default","s","adTechDataSilos"],"mappings":"AAAA,iIAAyC,SCWzBA,CAAAA,CACdC,CAAAA,CACA,CACE,cAAA,CAAAC,CAAAA,CAAiB,CAAC,YAAY,CAAA,CAC9B,cAAA,CAAAC,CAAAA,CACA,6BAAA,CAAAC,CACF,CAAA,CASA,CAEA,IAAIC,CAAAA,CAAiC,CAAC,CAAA,CAGhCC,CAAAA,CAA+B,CAAC,CAAA,CAGhCC,CAAAA,CAAsD,CAAC,CAAA,CAG7DN,CAAAA,CAAO,OAAA,CAASO,CAAAA,EAAS,CAEvB,GAAM,CAAE,OAAA,CAAAC,CAAAA,CAAS,UAAA,CAAAC,CAAAA,CAAa,CAAC,CAAE,CAAA,CAAIF,CAAAA,CACrC,EAAA,CAAI,CAACC,CAAAA,EAAWA,CAAAA,GAAY,iBAAA,CAC1B,MAAA,CAIF,IAAME,CAAAA,CAAgBD,CAAAA,CAAW,IAAA,CAC9BE,CAAAA,EAASA,CAAAA,CAAK,GAAA,GAAQ,iBACzB,CAAA,CAGID,CAAAA,EAAAA,CACGJ,CAAAA,CAAuBE,CAAO,CAAA,EAAA,CACjCF,CAAAA,CAAuBE,CAAO,CAAA,CAAI,CAAC,CAAA,CAAA,CAErCF,CAAAA,CAAuBE,CAAO,CAAA,CAAG,IAAA,CAC/B,GAAGE,CAAAA,CAAc,MAAA,CAAO,GAAA,CAAKE,CAAAA,EAC3BA,CAAAA,CAAE,OAAA,CAAQ,UAAA,CAAY,EAAE,CAAA,CAAE,OAAA,CAAQ,SAAA,CAAW,EAAE,CACjD,CACF,CAAA,CACAN,CAAAA,CAAuBE,CAAO,CAAA,CAAI,CAChC,GAAG,IAAI,GAAA,CAAIF,CAAAA,CAAuBE,CAAO,CAAC,CAC5C,CAAA,CAAA,CAIEK,kCAAAA,CAAMN,CAAK,gBAAA,CAAkBN,CAAc,CAAA,CAAE,MAAA,CAAS,CAAA,CAAA,CAExDI,CAAAA,CAAmB,IAAA,CAAKG,CAAO,CAAA,CAG3BJ,CAAAA,CAAqB,QAAA,CAASI,CAAO,CAAA,EAAA,CACvCJ,CAAAA,CAAuBA,CAAAA,CAAqB,MAAA,CACzCU,CAAAA,EAAMA,CAAAA,GAAMN,CACf,CAAA,CAAA,CAAA,CAEQH,CAAAA,CAAmB,QAAA,CAASG,CAAO,CAAA,EAE7CJ,CAAAA,CAAqB,IAAA,CAAKI,CAAO,CAErC,CAAC,CAAA,CAGD,IAAMO,CAAAA,CAAkB,CAAC,GAAG,IAAI,GAAA,CAAIV,CAAkB,CAAC,CAAA,CAAE,GAAA,CAAKG,CAAAA,EAAAA,CAAa,CACzE,KAAA,CAAON,CAAAA,CAAeM,CAAO,CAAA,CAC7B,GAAIL,CAAAA,CAA8BK,CAAO,CAAA,CACrC,CAAE,eAAA,CAAiBA,CAAQ,CAAA,CAC3B,CAAE,eAAA,CAAiB,eAAA,CAAiB,YAAA,CAAcA,CAAQ,CAAA,CAC9D,UAAA,CAAY,CACV,CACE,GAAA,CAAK,WAAA,CACL,MAAA,CAAQ,CAAC,SAAS,CACpB,CAAA,CACA,CACE,GAAA,CAAK,iBAAA,CACL,MAAA,CAAQF,CAAAA,CAAuBE,CAAO,CAAA,EAAK,CAAC,CAC9C,CACF,CACF,CAAA,CAAE,CAAA,CAsBF,MAAO,CACL,iBAAA,CApBwB,CAAC,GAAG,IAAI,GAAA,CAAIJ,CAAoB,CAAC,CAAA,CAAE,GAAA,CAC1DI,CAAAA,EAAAA,CAAa,CACZ,KAAA,CAAON,CAAAA,CAAeM,CAAO,CAAA,CAC7B,GAAIL,CAAAA,CAA8BK,CAAO,CAAA,CACrC,CAAE,eAAA,CAAiBA,CAAQ,CAAA,CAC3B,CAAE,eAAA,CAAiB,eAAA,CAAiB,SAAA,CAAWA,CAAQ,CAAA,CAC3D,UAAA,CAAY,CACV,CACE,GAAA,CAAK,WAAA,CACL,MAAA,CAAQ,CAAC,WAAW,CACtB,CAAA,CACA,CACE,GAAA,CAAK,iBAAA,CACL,MAAA,CAAQF,CAAAA,CAAuBE,CAAO,CAAA,EAAK,CAAC,CAC9C,CACF,CACF,CAAA,CACF,CAAA,CAIE,eAAA,CAAAO,CACF,CACF,CAAA,cAAA","file":"/Users/benbrook/transcend/cli/dist/chunk-2KP53GQ4.cjs","sourcesContent":[null,"import { DataFlowInput, DataSiloInput } from '../../codecs';\nimport { union } from 'lodash-es';\nimport { IndexedCatalogs } from '../graphql';\n\n/**\n * Convert data flow configurations into a set of data silo configurations\n *\n * @param inputs - Data flow input to convert to data silos\n * @param options - Additional options\n * @returns Business entity configuration input\n */\nexport function dataFlowsToDataSilos(\n inputs: DataFlowInput[],\n {\n adTechPurposes = ['SaleOfInfo'],\n serviceToTitle,\n serviceToSupportedIntegration,\n }: IndexedCatalogs & {\n /** List of purposes that are considered \"Ad Tech\" */\n adTechPurposes?: string[];\n },\n): {\n /** List of data silo configurations for site-tech services */\n siteTechDataSilos: DataSiloInput[];\n /** List of data silo configurations for ad-tech services */\n adTechDataSilos: DataSiloInput[];\n} {\n // List of site tech integrations\n let siteTechIntegrations: string[] = [];\n\n // List of ad tech integrations\n const adTechIntegrations: string[] = [];\n\n // Mapping from service name to list of\n const serviceToFoundOnDomain: { [k in string]: string[] } = {};\n\n // iterate over each flow\n inputs.forEach((flow) => {\n // process data flows with services\n const { service, attributes = [] } = flow;\n if (!service || service === 'internalService') {\n return;\n }\n\n // create mapping to found on domain\n const foundOnDomain = attributes.find(\n (attr) => attr.key === 'Found on Domain',\n );\n\n // Create a list of all domains where the data flow was found\n if (foundOnDomain) {\n if (!serviceToFoundOnDomain[service]) {\n serviceToFoundOnDomain[service] = [];\n }\n serviceToFoundOnDomain[service]!.push(\n ...foundOnDomain.values.map((v) =>\n v.replace('https://', '').replace('http://', ''),\n ),\n );\n serviceToFoundOnDomain[service] = [\n ...new Set(serviceToFoundOnDomain[service]),\n ];\n }\n\n // Keep track of ad tech\n if (union(flow.trackingPurposes, adTechPurposes).length > 0) {\n // add service to ad tech list\n adTechIntegrations.push(service);\n\n // remove from site tech list\n if (siteTechIntegrations.includes(service)) {\n siteTechIntegrations = siteTechIntegrations.filter(\n (s) => s !== service,\n );\n }\n } else if (!adTechIntegrations.includes(service)) {\n // add to site tech list\n siteTechIntegrations.push(service);\n }\n });\n\n // create the list of ad tech integrations\n const adTechDataSilos = [...new Set(adTechIntegrations)].map((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: 'Found On Domain',\n values: serviceToFoundOnDomain[service] || [],\n },\n ],\n }));\n\n // create the list of site tech integrations\n const siteTechDataSilos = [...new Set(siteTechIntegrations)].map(\n (service) => ({\n title: serviceToTitle[service],\n ...(serviceToSupportedIntegration[service]\n ? { integrationName: service }\n : { integrationName: 'promptAPerson', outerType: service }),\n attributes: [\n {\n key: 'Tech Type',\n values: ['Site Tech'],\n },\n {\n key: 'Found On Domain',\n values: serviceToFoundOnDomain[service] || [],\n },\n ],\n }),\n );\n\n return {\n siteTechDataSilos,\n adTechDataSilos,\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 }; } 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 _chunkKR377AJUcjs = require('./chunk-KR377AJU.cjs');var _chunkSJFPYDA3cjs = require('./chunk-SJFPYDA3.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkEG4L6YAJcjs = require('./chunk-EG4L6YAJ.cjs');var _iots = require('io-ts'); var e = _interopRequireWildcard(_iots); var S = _interopRequireWildcard(_iots);var _typeutils = require('@transcend-io/type-utils');var Z=e.type({identifier:e.string,type:e.string,coreIdentifier:e.string,dataSiloId:e.string,requestId:e.string,nonce:e.string,requestCreatedAt:e.string,daysUntilOverdue:e.number,attributes:e.array(e.type({key:e.string,values:e.array(e.string)}))});async function B(r,{dataSiloId:s,limit:c=100,offset:n=0,requestType:a}){try{let i=await r.get(`v1/data-silo/${s}/pending-requests/${a}`,{searchParams:{offset:n,limit:c}}).json(),{items:f}=_typeutils.decodeCodec.call(void 0, e.type({items:e.array(Z)}),i);return f}catch(i){throw new Error(`Received an error from server: ${_optionalChain([i, 'optionalAccess', _2 => _2.response, 'optionalAccess', _3 => _3.body])||_optionalChain([i, 'optionalAccess', _4 => _4.message])}`)}}var j=S.type({nonce:S.string,identifier:S.string});async function W(r,{nonce:s,identifier:c}){try{return await r.put("v1/data-silo",{headers:{"x-transcend-nonce":s},json:{profiles:[{profileId:c}]}}),!0}catch(n){if(_optionalChain([n, 'access', _5 => _5.response, 'optionalAccess', _6 => _6.statusCode])===409)return!1;throw new Error(`Received an error from server: ${_optionalChain([n, 'optionalAccess', _7 => _7.response, 'optionalAccess', _8 => _8.body])||_optionalChain([n, 'optionalAccess', _9 => _9.message])}`)}}var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _cliprogress = require('cli-progress'); var _cliprogress2 = _interopRequireDefault(_cliprogress);async function ue({file:r,dataSiloId:s,auth:c,sombraAuth:n,concurrency:a=100,transcendUrl:i=_chunkEG4L6YAJcjs.e,sleepSeconds:f=10}){let y=await _chunkSJFPYDA3cjs.ye.call(void 0, i,c,n);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Reading "${r}" from disk`));let o=_chunkKR377AJUcjs.q.call(void 0, r,j);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Notifying Transcend for data silo "${s}" marking "${o.length}" identifiers as completed.`));let C=new Date().getTime(),w=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),d=0,u=0,l=0;w.start(o.length,0);let m=_chunkSJFPYDA3cjs._b.call(void 0, o,a),I=m.length;await _chunkSJFPYDA3cjs.a.call(void 0, m,async($,P)=>{_chunkZUNVPK23cjs.a.info(_colors2.default.blue(`Processing chunk ${P+1}/${I} (${_chunkSJFPYDA3cjs._b.length} items)`)),await _chunkSJFPYDA3cjs.b.call(void 0, $,async h=>{try{await W(y,h)?d+=1:u+=1}catch(b){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Error notifying Transcend for identifier "${h.identifier}" - ${_optionalChain([b, 'optionalAccess', _10 => _10.message])}`)),l+=1}w.update(d+u)}),f>0&&P<I-1&&(_chunkZUNVPK23cjs.a.info(_colors2.default.yellow(`Sleeping for ${f}s before next chunk...`)),await new Promise(h=>{setTimeout(h,f*1e3)}))}),w.stop();let x=new Date().getTime()-C;if(_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully notified Transcend for ${d} identifiers in "${x/1e3}" seconds!`)),u&&_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`There were ${u} identifiers that were not in a state to be updated.They likely have already been resolved.`)),l)throw _chunkZUNVPK23cjs.a.error(_colors2.default.red(`There were ${l} identifiers that failed to be updated. Please review the logs for more information.`)),new Error("Failed to update all identifiers");return o.length}var _privacytypes = require('@transcend-io/privacy-types');async function Te({requestIds:r,dataSiloId:s,auth:c,concurrency:n=100,status:a=_privacytypes.RequestDataSiloStatus.Resolved,transcendUrl:i=_chunkEG4L6YAJcjs.e}){let f=_chunkSJFPYDA3cjs.xe.call(void 0, i,c),y=new Date().getTime(),o=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Notifying Transcend for data silo "${s}" marking "${r.length}" requests as completed.`));let C=0;o.start(r.length,0),await _chunkSJFPYDA3cjs.b.call(void 0, r,async u=>{let l=await _chunkSJFPYDA3cjs.Le.call(void 0, f,{requestId:u,dataSiloId:s});try{await _chunkSJFPYDA3cjs.gc.call(void 0, f,_chunkSJFPYDA3cjs.wa,{requestDataSiloId:l.id,status:a})}catch(m){if(!m.message.includes("Client error: Request must be active:"))throw m}C+=1,o.update(C)},{concurrency:n}),o.stop();let d=new Date().getTime()-y;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully notified Transcend in "${d/1e3}" seconds!`)),r.length}async function ke({dataSiloId:r,auth:s,sombraAuth:c,actions:n,apiPageSize:a=100,savePageSize:i=1e3,onSave:f,transcendUrl:y=_chunkEG4L6YAJcjs.e,skipRequestCount:o=!1}){if(i%a!==0)throw new Error(`savePageSize must be a multiple of apiPageSize. savePageSize: ${i}, apiPageSize: ${a}`);let C=await _chunkSJFPYDA3cjs.ye.call(void 0, y,s,c),w=_chunkSJFPYDA3cjs.xe.call(void 0, y,s),d=0;o||(d=await _chunkSJFPYDA3cjs.De.call(void 0, w,{dataSiloId:r})),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Pulling ${o?"all":d} outstanding request identifiers for data silo: "${r}" for requests of types "${n.join('", "')}"`));let u=new Date().getTime(),l=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),m=new Set,I=[],g=[];o||l.start(d,0),await _chunkSJFPYDA3cjs.a.call(void 0, n,async $=>{let P=0,h=!0;for(;h;){let b=await B(C,{dataSiloId:r,limit:a,offset:P,requestType:$}),_=b.map(A=>(m.add(A.requestId),{...A,action:$})),M=_.map(({attributes:A,...V})=>({...V,...A.reduce((X,G)=>Object.assign(X,{[G.key]:G.values.join(",")}),{})}));I.push(..._),g.push(...M),g.length>=i&&(await f(g),g=[]),h=b.length===a,P+=a,o?_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Pulled ${b.length} outstanding identifiers for ${m.size} requests`)):l.update(m.size)}}),g.length>0&&await f(g),o||l.stop();let x=new Date().getTime()-u;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully pulled ${I.length} outstanding identifiers from ${m.size} requests in "${x/1e3}" seconds!`)),{identifiers:I}}exports.a = Z; exports.b = B; exports.c = j; exports.d = W; exports.e = ue; exports.f = Te; exports.g = ke;
2
+ //# sourceMappingURL=chunk-2VOZMXOE.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/chunk-2VOZMXOE.cjs","../src/lib/cron/pullCronPageOfIdentifiers.ts"],"names":["CronIdentifier","pullCronPageOfIdentifiers","sombra","dataSiloId","limit","offset","requestType","response"],"mappings":"AAAA,u/BAAwC,wDAAwG,wDAAyC,wDAAyC,6GCA/M,qDACS,IAIfA,CAAAA,CAAmB,CAAA,CAAA,IAAA,CAAK,CAEnC,UAAA,CAAc,CAAA,CAAA,MAAA,CAEd,IAAA,CAAQ,CAAA,CAAA,MAAA,CAER,cAAA,CAAkB,CAAA,CAAA,MAAA,CAElB,UAAA,CAAc,CAAA,CAAA,MAAA,CAEd,SAAA,CAAa,CAAA,CAAA,MAAA,CAEb,KAAA,CAAS,CAAA,CAAA,MAAA,CAET,gBAAA,CAAoB,CAAA,CAAA,MAAA,CAEpB,gBAAA,CAAoB,CAAA,CAAA,MAAA,CAEpB,UAAA,CAAc,CAAA,CAAA,KAAA,CACV,CAAA,CAAA,IAAA,CAAK,CACL,GAAA,CAAO,CAAA,CAAA,MAAA,CACP,MAAA,CAAU,CAAA,CAAA,KAAA,CAAQ,CAAA,CAAA,MAAM,CAC1B,CAAC,CACH,CACF,CAAC,CAAA,CAaD,MAAA,SAAsBC,CAAAA,CACpBC,CAAAA,CACA,CACE,UAAA,CAAAC,CAAAA,CACA,KAAA,CAAAC,CAAAA,CAAQ,GAAA,CACR,MAAA,CAAAC,CAAAA,CAAS,CAAA,CACT,WAAA,CAAAC,CACF,CAAA,CAU2B,CAC3B,GAAI,CAEF,IAAMC,CAAAA,CAAW,MAAML,CAAAA,CACpB,GAAA,CAAI,CAAA,aAAA,EAAgBC,CAAU,CAAA,kBAAA,EAAqBG,CAAW,CAAA,CAAA","file":"/Users/benbrook/transcend/cli/dist/chunk-2VOZMXOE.cjs","sourcesContent":[null,"import * as t from 'io-ts';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport { RequestAction } from '@transcend-io/privacy-types';\nimport type { Got } from 'got';\n\nexport const CronIdentifier = t.type({\n /** The identifier value */\n identifier: t.string,\n /** The type of identifier */\n type: t.string,\n /** The core identifier of the request */\n coreIdentifier: t.string,\n /** The ID of the underlying data silo */\n dataSiloId: t.string,\n /** The ID of the underlying request */\n requestId: t.string,\n /** The request nonce */\n nonce: t.string,\n /** The time the request was created */\n requestCreatedAt: t.string,\n /** The number of days until the request is overdue */\n daysUntilOverdue: t.number,\n /** Request attributes */\n attributes: t.array(\n t.type({\n key: t.string,\n values: t.array(t.string),\n }),\n ),\n});\n\n/** Type override */\nexport type CronIdentifier = t.TypeOf<typeof CronIdentifier>;\n\n/**\n * Pull a offset of identifiers for a cron job\n *\n * @see https://docs.transcend.io/docs/api-reference/GET/v1/data-silo/(id)/pending-requests/(type)\n * @param sombra - Sombra instance configured to make requests\n * @param options - Additional options\n * @returns Successfully submitted request\n */\nexport async function pullCronPageOfIdentifiers(\n sombra: Got,\n {\n dataSiloId,\n limit = 100,\n offset = 0,\n requestType,\n }: {\n /** Data Silo ID */\n dataSiloId: string;\n /** Type of request */\n requestType: RequestAction;\n /** Number of identifiers to pull in */\n limit?: number;\n /** Page to pull in */\n offset?: number;\n },\n): Promise<CronIdentifier[]> {\n try {\n // Make the GraphQL request\n const response = await sombra\n .get(`v1/data-silo/${dataSiloId}/pending-requests/${requestType}`, {\n searchParams: {\n offset,\n limit,\n },\n })\n .json();\n\n const { items } = decodeCodec(\n t.type({\n items: t.array(CronIdentifier),\n }),\n response,\n );\n return items;\n } catch (err) {\n throw new Error(\n `Received an error from server: ${err?.response?.body || err?.message}`,\n );\n }\n}\n"]}
@@ -0,0 +1,3 @@
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 _chunkZVK4HIDFcjs = require('./chunk-ZVK4HIDF.cjs');var _chunkKR377AJUcjs = require('./chunk-KR377AJU.cjs');var _chunkSJFPYDA3cjs = require('./chunk-SJFPYDA3.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkEG4L6YAJcjs = require('./chunk-EG4L6YAJ.cjs');var _privacytypes = require('@transcend-io/privacy-types');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);async function re({file:u,auth:s,sombraAuth:g,requestActions:f=[],concurrency:p=100,transcendUrl:n=_chunkEG4L6YAJcjs.e}){let o=_chunkSJFPYDA3cjs.xe.call(void 0, n,s),e=await _chunkSJFPYDA3cjs.ye.call(void 0, n,s,g);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Pulling manual enrichment requests, filtered for actions: ${f.join(",")}`));let d=await _chunkSJFPYDA3cjs.Ge.call(void 0, o,{actions:f,statuses:[_privacytypes.RequestStatus.Enriching]}),i=[];await _chunkSJFPYDA3cjs.b.call(void 0, d,async t=>{let c=await _chunkSJFPYDA3cjs.Je.call(void 0, o,{requestId:t.id});if(c.filter(({status:m})=>m==="ACTION_REQUIRED")){let m=await _chunkSJFPYDA3cjs.Ie.call(void 0, o,e,{requestId:t.id});i.push({...t,requestIdentifiers:m,requestEnrichers:c})}},{concurrency:p});let l=i.map(({attributeValues:t,requestIdentifiers:c,requestEnrichers:w,...m})=>({...m,...Object.entries(_chunkSJFPYDA3cjs.ac.call(void 0, c,"name")).reduce((P,[$,C])=>Object.assign(P,{[$]:C.map(({value:A})=>A).join(",")}),{}),...Object.entries(_chunkSJFPYDA3cjs.ac.call(void 0, t,"attributeKey.name")).reduce((P,[$,C])=>Object.assign(P,{[$]:C.map(({name:A})=>A).join(",")}),{})})),a=_chunkSJFPYDA3cjs.fc.call(void 0, l.map(t=>Object.keys(t)).flat());return _chunkZVK4HIDFcjs.c.call(void 0, u,l,a),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully wrote ${i.length} requests to file "${u}"`)),i}var _iots = require('io-ts'); var R = _interopRequireWildcard(_iots);var j="https://app.transcend.io/privacy-requests/incoming-requests/",M= exports.b =R.record(R.string,R.string);async function N(u,{id:s,...g},f,p){if(!s){let e=`Request ID must be provided to enricher request.${p?` Found error in row: ${p}`:""}`;throw _chunkZUNVPK23cjs.a.error(_colors2.default.red(e)),new Error(e)}let n=s.toLowerCase(),o=Object.entries(g).reduce((e,[d,i])=>_chunkSJFPYDA3cjs.fc.call(void 0, _chunkKR377AJUcjs.n.call(void 0, i)).length===0?e:Object.assign(e,{[d]:_chunkSJFPYDA3cjs.fc.call(void 0, _chunkKR377AJUcjs.n.call(void 0, i)).map(a=>({value:d==="email"?a.toLowerCase():a}))}),{});try{return await u.post("v1/enrich-identifiers",{headers:{"x-transcend-request-id":n,"x-transcend-enricher-id":f},json:{enrichedIdentifiers:o}}).json(),_chunkZUNVPK23cjs.a.error(_colors2.default.green(`Successfully enriched request: ${j}${n}`)),!0}catch(e){if(typeof e.response.body=="string"&&e.response.body.includes("Cannot update a resolved RequestEnricher"))return _chunkZUNVPK23cjs.a.warn(_colors2.default.magenta(`Skipped enrichment for request: ${j}${n}, request is no longer in the enriching phase.`)),!1;throw _chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to enricher identifiers for request with id: ${j}${n} - ${e.message} - ${e.response.body}`)),e}}async function he({file:u,auth:s,sombraAuth:g,enricherId:f,markSilent:p,concurrency:n=100,transcendUrl:o=_chunkEG4L6YAJcjs.e}){let e=await _chunkSJFPYDA3cjs.ye.call(void 0, o,s,g),d=_chunkSJFPYDA3cjs.xe.call(void 0, o,s);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Reading "${u}" from disk`));let i=_chunkKR377AJUcjs.q.call(void 0, u,M);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Enriching "${i.length}" privacy requests.`));let l=0,a=0,t=0;if(await _chunkSJFPYDA3cjs.b.call(void 0, i,async(c,w)=>{try{p&&(await _chunkSJFPYDA3cjs.gc.call(void 0, d,_chunkSJFPYDA3cjs._,{input:{id:c.id,isSilent:!0}}),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Mark request as silent mode - ${c.id}`))),await N(e,c,f,w)?l+=1:a+=1}catch (e2){t+=1}},{concurrency:n}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully notified Transcend!
2
+ Success count: ${l}.`)),a>0&&_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Skipped count: ${a}.`)),t>0)throw _chunkZUNVPK23cjs.a.info(_colors2.default.red(`Error Count: ${t}.`)),new Error(`Failed to enrich: ${t} requests.`);return i.length}exports.a = re; exports.b = M; exports.c = N; exports.d = he;
3
+ //# sourceMappingURL=chunk-7OIWW7TJ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/chunk-7OIWW7TJ.cjs","../src/lib/manual-enrichment/pullManualEnrichmentIdentifiersToCsv.ts","../src/lib/manual-enrichment/pushManualEnrichmentIdentifiersFromCsv.ts"],"names":["pullManualEnrichmentIdentifiersToCsv","file","auth","sombraAuth","requestActions","concurrency","transcendUrl","DEFAULT_TRANSCEND_API","client","buildTranscendGraphQLClient","sombra","createSombraGotInstance","logger","colors"],"mappings":"AAAA,mfAAwC,wDAAgD,wDAAgH,wDAAyC,wDAAyC,2DCA7O,gFAE1B,MA6BnB,SAAsBA,EAAAA,CAAqC,CACzD,IAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CAAiB,CAAC,CAAA,CAClB,WAAA,CAAAC,CAAAA,CAAc,GAAA,CACd,YAAA,CAAAC,CAAAA,CAAeC,mBACjB,CAAA,CAa6C,CAE3C,IAAMC,CAAAA,CAASC,kCAAAA,CAA4BH,CAAcJ,CAAI,CAAA,CACvDQ,CAAAA,CAAS,MAAMC,kCAAAA,CAAwBL,CAAcJ,CAAAA,CAAMC,CAAU,CAAA,CAE3ES,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,OAAA,CACL,CAAA,0DAAA,EAA6DT,CAAAA,CAAe,IAAA,CAC1E,GACF,CAAC,CAAA,CAAA;ACuDP,gBAAA","file":"/Users/benbrook/transcend/cli/dist/chunk-7OIWW7TJ.cjs","sourcesContent":[null,"import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { map } from '@/lib/bluebird-replace';\nimport colors from 'colors';\nimport { groupBy, uniq } from 'lodash-es';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\nimport { writeCsv } from '../cron/writeCsv';\nimport {\n PrivacyRequest,\n RequestEnricher,\n RequestIdentifier,\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n fetchAllRequestEnrichers,\n fetchAllRequestIdentifiers,\n fetchAllRequests,\n} from '../graphql';\nimport { logger } from '../../logger';\n\nexport interface PrivacyRequestWithIdentifiers extends PrivacyRequest {\n /** Request Enrichers */\n requestEnrichers: RequestEnricher[];\n /** Request Identifiers */\n requestIdentifiers: RequestIdentifier[];\n}\n\n/**\n * Pull the set of manual enrichment jobs to CSV\n *\n * @param options - Options\n * @returns List of requests with identifiers\n */\nexport async function pullManualEnrichmentIdentifiersToCsv({\n file,\n auth,\n sombraAuth,\n requestActions = [],\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** Sombra API key */\n sombraAuth?: string;\n /** Concurrency */\n concurrency?: number;\n /** The request actions to fetch */\n requestActions?: RequestAction[];\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<PrivacyRequestWithIdentifiers[]> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const sombra = await createSombraGotInstance(transcendUrl, auth, sombraAuth);\n\n logger.info(\n colors.magenta(\n `Pulling manual enrichment requests, filtered for actions: ${requestActions.join(\n ',',\n )}`,\n ),\n );\n\n // Pull all privacy requests\n const allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n statuses: [RequestStatus.Enriching],\n });\n\n // Requests to save\n const savedRequests: PrivacyRequestWithIdentifiers[] = [];\n\n // Filter down requests to what is needed\n await map(\n allRequests,\n async (request) => {\n // Fetch enrichers\n const requestEnrichers = await fetchAllRequestEnrichers(client, {\n requestId: request.id,\n });\n\n // Check if manual enrichment exists for that request\n const hasManualEnrichment = requestEnrichers.filter(\n ({ status }) => status === 'ACTION_REQUIRED',\n );\n\n // Save request to queue\n if (hasManualEnrichment) {\n const requestIdentifiers = await fetchAllRequestIdentifiers(\n client,\n sombra,\n {\n requestId: request.id,\n },\n );\n savedRequests.push({\n ...request,\n requestIdentifiers,\n requestEnrichers,\n });\n }\n },\n {\n concurrency,\n },\n );\n\n const data = savedRequests.map(\n ({\n attributeValues,\n requestIdentifiers,\n requestEnrichers, // eslint-disable-line @typescript-eslint/no-unused-vars\n ...request\n }) => ({\n ...request,\n // flatten identifiers\n ...Object.entries(groupBy(requestIdentifiers, 'name')).reduce(\n (acc, [key, values]) =>\n Object.assign(acc, {\n [key]: values.map(({ value }) => value).join(','),\n }),\n {},\n ),\n // flatten attributes\n ...Object.entries(groupBy(attributeValues, 'attributeKey.name')).reduce(\n (acc, [key, values]) =>\n Object.assign(acc, {\n [key]: values.map(({ name }) => name).join(','),\n }),\n {},\n ),\n }),\n );\n\n // Write out to CSV\n const headers = uniq(data.map((d) => Object.keys(d)).flat());\n writeCsv(file, data, headers);\n\n logger.info(\n colors.green(\n `Successfully wrote ${savedRequests.length} requests to file \"${file}\"`,\n ),\n );\n\n return savedRequests;\n}\n","import colors from 'colors';\nimport { map } from '@/lib/bluebird-replace';\nimport { logger } from '../../logger';\nimport {\n UPDATE_PRIVACY_REQUEST,\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n makeGraphQLRequest,\n} from '../graphql';\nimport {\n enrichPrivacyRequest,\n EnrichPrivacyRequest,\n} from './enrichPrivacyRequest';\nimport { readCsv } from '../requests';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\n\n/**\n * Push a CSV of enriched requests back into Transcend\n *\n * @param options - Options\n * @returns Number of items processed\n */\nexport async function pushManualEnrichmentIdentifiersFromCsv({\n file,\n auth,\n sombraAuth,\n enricherId,\n markSilent,\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** ID of enricher being uploaded to */\n enricherId: string;\n /** Sombra API key authentication */\n sombraAuth?: string;\n /** Concurrency */\n concurrency?: number;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** Mark requests in silent mode before enriching */\n markSilent?: boolean;\n}): Promise<number> {\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, sombraAuth);\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read from CSV\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const activeResults = readCsv(file, EnrichPrivacyRequest);\n\n // Notify Transcend\n logger.info(\n colors.magenta(`Enriching \"${activeResults.length}\" privacy requests.`),\n );\n\n let successCount = 0;\n let skippedCount = 0;\n let errorCount = 0;\n\n await map(\n activeResults,\n async (request, index) => {\n try {\n // Mark requests in silent mode before a certain date\n if (markSilent) {\n await makeGraphQLRequest(client, UPDATE_PRIVACY_REQUEST, {\n input: {\n id: request.id,\n isSilent: true,\n },\n });\n\n logger.info(\n colors.magenta(`Mark request as silent mode - ${request.id}`),\n );\n }\n\n const result = await enrichPrivacyRequest(\n sombra,\n request,\n enricherId,\n index,\n );\n if (result) {\n successCount += 1;\n } else {\n skippedCount += 1;\n }\n } catch (err) {\n errorCount += 1;\n }\n },\n { concurrency },\n );\n\n logger.info(\n colors.green(\n `Successfully notified Transcend! \\n Success count: ${successCount}.`,\n ),\n );\n\n if (skippedCount > 0) {\n logger.info(colors.magenta(`Skipped count: ${skippedCount}.`));\n }\n\n if (errorCount > 0) {\n logger.info(colors.red(`Error Count: ${errorCount}.`));\n throw new Error(`Failed to enrich: ${errorCount} requests.`);\n }\n\n return activeResults.length;\n}\n"]}
@@ -0,0 +1,4 @@
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 }; } 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 _chunkUJ3GGOXXcjs = require('./chunk-UJ3GGOXX.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _fs = require('fs');var _typeutils = require('@transcend-io/type-utils');var _privacytypes = require('@transcend-io/privacy-types');var N=/target ('|")(.*?)('|")/,O=/pod ('|")(.*?)('|")(, ('|")~> (.+?)('|")|)/,y={supportedFiles:["Podfile"],ignoreDirs:["Pods"],scanFunction:e=>{let n=_fs.readFileSync.call(void 0, e,"utf-8"),o=_typeutils.findAllWithRegex.call(void 0, {value:new RegExp(N,"g"),matches:["quote1","name","quote2"]},n),c=_typeutils.findAllWithRegex.call(void 0, {value:new RegExp(O,"g"),matches:["quote1","name","quote2","extra","quote3","version","quote4"]},n);return o.map((t,p)=>({name:t.name,type:_privacytypes.CodePackageType.CocoaPods,softwareDevelopmentKits:c.filter(r=>r.matchIndex>t.matchIndex&&(!o[p+1]||r.matchIndex<o[p+1].matchIndex)).map(r=>({name:r.name,version:r.version}))}))}};var _path = require('path');var K=/implementation( *)('|")(.+?):(.+?):(.+?|)('|")/,M=/apply plugin: *('|")(.+?)(:(.+?)|)('|")/,j=/implementation group:( *)('|")(.+?)('|"),( *)name:( *)('|")(.+?)('|"),( *)version:( *)('|")(.+?)('|")/,L=/applicationId( *)"(.+?)"/,S={supportedFiles:["build.gradle**"],ignoreDirs:["gradle-app.setting","gradle-wrapper.jar","gradle-wrapper.properties"],scanFunction:e=>{let n=_fs.readFileSync.call(void 0, e,"utf-8"),o=_path.dirname.call(void 0, e),c=_typeutils.findAllWithRegex.call(void 0, {value:new RegExp(K,"g"),matches:["space","quote1","name","path","version","quote2"]},n),a=_typeutils.findAllWithRegex.call(void 0, {value:new RegExp(M,"g"),matches:["quote1","name","group","version","quote2"]},n),t=_typeutils.findAllWithRegex.call(void 0, {value:new RegExp(j,"g"),matches:["space1","quote1","group","quote2","space2","space3","quote3","name","quote4","space4","space5","quote5","version","quote6"]},n),p=_typeutils.findAllWithRegex.call(void 0, {value:new RegExp(L,"g"),matches:["space","name"]},n);if(p.length>1)throw new Error(`Expected only one applicationId per file: ${e}`);return[{name:_optionalChain([p, 'access', _2 => _2[0], 'optionalAccess', _3 => _3.name])||o.split("/").pop(),softwareDevelopmentKits:[...c,...t,...a].map(r=>({name:r.name,version:r.version||void 0}))}]}};var x={supportedFiles:["package.json"],ignoreDirs:["node_modules","serverless-build","lambda-build"],scanFunction:e=>{let n=_fs.readFileSync.call(void 0, e,"utf-8"),o=_path.dirname.call(void 0, e),c=JSON.parse(n),{name:a,description:t,dependencies:p={},devDependencies:r={},optionalDependencies:i={}}=c;return[{name:a||o.split("/").pop(),description:t,softwareDevelopmentKits:[...Object.entries(p).map(([s,m])=>({name:s,version:typeof m=="string"?m:void 0})),...Object.entries(r).map(([s,m])=>({name:s,version:typeof m=="string"?m:void 0,isDevDependency:!0})),...Object.entries(i).map(([s,m])=>({name:s,version:typeof m=="string"?m:void 0}))]}]}};var V=/(.+?)(=+)(.+)/,H=/name *= *('|")(.+?)('|")/,Q=/description *= *('|")(.+?)('|")/,P={supportedFiles:["requirements.txt"],ignoreDirs:["build","lib","lib64"],scanFunction:e=>{let n=_fs.readFileSync.call(void 0, e,"utf-8"),o=_path.dirname.call(void 0, e),a=_chunkUJ3GGOXXcjs.c.call(void 0, o).find(s=>s==="setup.py"),t=a?_fs.readFileSync.call(void 0, _path.join.call(void 0, o,a),"utf-8"):void 0,p=t?(H.exec(t)||[])[2]:void 0,r=t?(Q.exec(t)||[])[2]:void 0,i=_typeutils.findAllWithRegex.call(void 0, {value:new RegExp(V,"g"),matches:["name","equals","version"]},n);return[{name:p||o.split("/").pop(),description:r||void 0,type:_privacytypes.CodePackageType.RequirementsTxt,softwareDevelopmentKits:i.map(s=>({name:s.name,version:s.version}))}]}};var ee=/gem *('|")(.+?)('|")(, *('|")(.+?)('|")|)/,ne=/spec\.name *= *('|")(.+?)('|")/,oe=/spec\.description *= *('|")(.+?)('|")/,te=/spec\.summary *= *('|")(.+?)('|")/,k={supportedFiles:["Gemfile"],ignoreDirs:["bin"],scanFunction:e=>{let n=_fs.readFileSync.call(void 0, e,"utf-8"),o=_path.dirname.call(void 0, e),a=_chunkUJ3GGOXXcjs.c.call(void 0, o).find(s=>s===".gemspec"),t=a?_fs.readFileSync.call(void 0, a,"utf-8"):void 0,p=t?(ne.exec(t)||[])[2]:void 0,r=t?(oe.exec(t)||te.exec(t)||[])[1]:void 0,i=_typeutils.findAllWithRegex.call(void 0, {value:new RegExp(ee,"g"),matches:["quote1","name","quote2","hasVersion","quote3","version","quote4"]},n);return[{name:p||o.split("/").pop(),description:r||void 0,type:_privacytypes.CodePackageType.RequirementsTxt,softwareDevelopmentKits:i.map(s=>({name:s.name,version:s.version}))}]}};var _jsyaml = require('js-yaml'); var _jsyaml2 = _interopRequireDefault(_jsyaml);function pe(e){return e.split(`
2
+ `).map(n=>{let o=n.indexOf("#");return o>-1&&!n.substring(0,o).includes('"')&&!n.substring(0,o).includes("'")?n.substring(0,o).trim():n}).filter(n=>n.length>0).join(`
3
+ `)}var v={supportedFiles:["pubspec.yml"],ignoreDirs:["build"],scanFunction:e=>{let n=_path.dirname.call(void 0, e),o=_fs.readFileSync.call(void 0, e,"utf-8"),{name:c,description:a,dev_dependencies:t={},dependencies:p={}}=_jsyaml2.default.load(pe(o));return[{name:c||n.split("/").pop(),description:a,type:_privacytypes.CodePackageType.RequirementsTxt,softwareDevelopmentKits:[...Object.entries(p).map(([r,i])=>({name:r,version:typeof i=="string"?i:typeof i=="number"?i.toString():_optionalChain([i, 'optionalAccess', _4 => _4.sdk])})),...Object.entries(t).map(([r,i])=>({name:r,version:typeof i=="string"?i:typeof i=="number"?i.toString():_optionalChain([i, 'optionalAccess', _5 => _5.sdk]),isDevDependency:!0}))]}]}};var I={supportedFiles:["composer.json"],ignoreDirs:["vendor","node_modules","cache","build","dist"],scanFunction:e=>{let n=_fs.readFileSync.call(void 0, e,"utf-8"),o=_path.dirname.call(void 0, e),c=JSON.parse(n),{name:a,description:t,require:p={},"require-dev":r={}}=c;return[{name:a||o.split("/").pop(),description:t,softwareDevelopmentKits:[...Object.entries(p).map(([i,s])=>({name:i,version:typeof s=="string"?s:void 0})),...Object.entries(r).map(([i,s])=>({name:i,version:typeof s=="string"?s:void 0,isDevDependency:!0}))]}]}};var _iots = require('io-ts'); var d = _interopRequireWildcard(_iots);var le=d.type({pins:d.array(d.type({identity:d.string,kind:d.string,location:d.string,state:d.type({revision:d.string,version:d.string})})),version:d.number}),D={supportedFiles:["Package.resolved"],ignoreDirs:[],scanFunction:e=>{let n=_fs.readFileSync.call(void 0, e,"utf-8"),o=_typeutils.decodeCodec.call(void 0, le,n);return[{name:_path.dirname.call(void 0, e).split("/").pop()||"",type:_privacytypes.CodePackageType.CocoaPods,softwareDevelopmentKits:o.pins.map(c=>({name:c.identity,version:c.state.version}))}]}};var gn={cocoaPods:y,gradle:S,javascriptPackageJson:x,pythonRequirementsTxt:P,gemfile:k,pubspec:v,swift:D},_={[_privacytypes.CodePackageType.CocoaPods]:y,[_privacytypes.CodePackageType.Gradle]:S,[_privacytypes.CodePackageType.PackageJson]:x,[_privacytypes.CodePackageType.RequirementsTxt]:P,[_privacytypes.CodePackageType.Gemfile]:k,[_privacytypes.CodePackageType.Pubspec]:v,[_privacytypes.CodePackageType.ComposerJson]:I,[_privacytypes.CodePackageType.Swift]:D};var _fastglob = require('fast-glob'); var _fastglob2 = _interopRequireDefault(_fastglob);var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);async function Sn({scanPath:e,ignoreDirs:n=[],repositoryName:o}){return(await Promise.all(_typeutils.getEntries.call(void 0, _).map(async([a,t])=>{let{ignoreDirs:p,supportedFiles:r,scanFunction:i}=t,s=[...n,...p].filter(m=>m.length>0);try{let m=await _fastglob2.default.call(void 0, `${e}/**/${r.join("|")}`,{ignore:s.map(g=>`${e}/**/${g}`),unique:!0,onlyFiles:!0});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Scanning: ${m.length} files of type ${a}`));let C=m.map(g=>i(g).map(q=>({...q,relativePath:g.replace(`${e}/`,"")}))).flat();return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Found: ${C.length} packages and ${C.map(({softwareDevelopmentKits:g=[]})=>g).flat().length} sdks`)),C.map(g=>({...g,type:a,repositoryName:o}))}catch(m){throw new Error(`Error scanning globs ${r} with error: ${m}`)}}))).flat()}exports.a = gn; exports.b = Sn;
4
+ //# sourceMappingURL=chunk-7R7EIHBR.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/chunk-7R7EIHBR.cjs","../src/lib/code-scanning/integrations/cocoaPods.ts","../src/lib/code-scanning/integrations/gradle.ts","../src/lib/code-scanning/integrations/pubspec.ts","../src/lib/code-scanning/constants.ts"],"names":["POD_TARGET_REGEX","POD_PACKAGE_REGEX","cocoaPods","filePath","fileContents","readFileSync","targets","findAllWithRegex","packages","target","ind","CodePackageType","pkg","GRADLE_IMPLEMENTATION_REGEX","GRADLE_PLUGIN_REGEX","GRADLE_IMPLEMENTATION_GROUP_REGEX","GRADLE_APPLICATION_NAME_REGEX","gradle","directory","dirname","targetPlugins","targetGroups","applications"],"mappings":"AAAA,u/BAAwC,wDAAyC,wBCApD,qDAGI,2DACD,IAE1BA,CAAAA,CAAmB,wBAAA,CACnBC,CAAAA,CAAoB,4CAAA,CAEbC,CAAAA,CAAgC,CAC3C,cAAA,CAAgB,CAAC,SAAS,CAAA,CAC1B,UAAA,CAAY,CAAC,MAAM,CAAA,CACnB,YAAA,CAAeC,CAAAA,EAAa,CAC1B,IAAMC,CAAAA,CAAeC,8BAAAA,CAAaF,CAAU,OAAO,CAAA,CAE7CG,CAAAA,CAAUC,yCAAAA,CAEZ,KAAA,CAAO,IAAI,MAAA,CAAOP,CAAAA,CAAkB,GAAG,CAAA,CACvC,OAAA,CAAS,CAAC,QAAA,CAAU,MAAA,CAAQ,QAAQ,CACtC,CAAA,CACAI,CACF,CAAA,CACMI,CAAAA,CAAWD,yCAAAA,CAEb,KAAA,CAAO,IAAI,MAAA,CAAON,CAAAA,CAAmB,GAAG,CAAA,CACxC,OAAA,CAAS,CACP,QAAA,CACA,MAAA,CACA,QAAA,CACA,OAAA,CACA,QAAA,CACA,SAAA,CACA,QACF,CACF,CAAA,CACAG,CACF,CAAA,CAiBA,OAf+BE,CAAAA,CAAQ,GAAA,CAAI,CAACG,CAAAA,CAAQC,CAAAA,CAAAA,EAAAA,CAAS,CAC3D,IAAA,CAAMD,CAAAA,CAAO,IAAA,CACb,IAAA,CAAME,6BAAAA,CAAgB,SAAA,CACtB,uBAAA,CAAyBH,CAAAA,CACtB,MAAA,CACEI,CAAAA,EACCA,CAAAA,CAAI,UAAA,CAAaH,CAAAA,CAAO,UAAA,EAAA,CACvB,CAACH,CAAAA,CAAQI,CAAAA,CAAM,CAAC,CAAA,EAAKE,CAAAA,CAAI,UAAA,CAAaN,CAAAA,CAAQI,CAAAA,CAAM,CAAC,CAAA,CAAE,UAAA,CAC5D,CAAA,CACC,GAAA,CAAKE,CAAAA,EAAAA,CAAS,CACb,IAAA,CAAMA,CAAAA,CAAI,IAAA,CACV,OAAA,CAASA,CAAAA,CAAI,OACf,CAAA,CAAE,CACN,CAAA,CAAE,CAGJ,CACF,CAAA,CCvDA,4BAGwB,IAElBC,CAAAA,CACJ,gDAAA,CACIC,CAAAA,CAAsB,yCAAA,CACtBC,CAAAA,CACJ,uGAAA,CACIC,CAAAA,CAAgC,0BAAA,CAYzBC,CAAAA,CAA6B,CACxC,cAAA,CAAgB,CAAC,gBAAgB,CAAA,CACjC,UAAA,CAAY,CACV,oBAAA,CACA,oBAAA,CACA,2BACF,CAAA,CACA,YAAA,CAAed,CAAAA,EAAa,CAC1B,IAAMC,CAAAA,CAAeC,8BAAAA,CAAaF,CAAU,OAAO,CAAA,CAC7Ce,CAAAA,CAAYC,2BAAAA,CAAgB,CAAA,CAE5Bb,CAAAA,CAAUC,yCAAAA,CAEZ,KAAA,CAAO,IAAI,MAAA,CAAOM,CAAAA,CAA6B,GAAG,CAAA,CAClD,OAAA,CAAS,CAAC,OAAA,CAAS,QAAA,CAAU,MAAA,CAAQ,MAAA,CAAQ,SAAA,CAAW,QAAQ,CAClE,CAAA,CACAT,CACF,CAAA,CACMgB,CAAAA,CAAgBb,yCAAAA,CAElB,KAAA,CAAO,IAAI,MAAA,CAAOO,CAAAA,CAAqB,GAAG,CAAA,CAC1C,OAAA,CAAS,CAAC,QAAA,CAAU,MAAA,CAAQ,OAAA,CAAS,SAAA,CAAW,QAAQ,CAC1D,CAAA,CACAV,CACF,CAAA,CACMiB,CAAAA,CAAed,yCAAAA,CAEjB,KAAA,CAAO,IAAI,MAAA,CAAOQ,CAAAA,CAAmC,GAAG,CAAA,CACxD,OAAA,CAAS,CACP,QAAA,CACA,QAAA,CACA,OAAA,CACA,QAAA,CACA,QAAA,CACA,QAAA,CACA,QAAA,CACA,MAAA,CACA,QAAA,CACA,QAAA,CACA,QAAA,CACA,QAAA,CACA,SAAA,CACA,QACF,CACF,CAAA,CACAX,CACF,CAAA,CACMkB,CAAAA,CAAef,yCAAAA,CAEjB,KAAA,CAAO,IAAI,MAAA,CAAOS,CAAAA,CAA+B,GAAG,CAAA,CACpD,OAAA,CAAS,CAAC,OAAA,CAAS,MAAM,CAC3B,CAAA,CACAZ,CACF,CAAA,CACA,EAAA,CAAIkB,CAAAA,CAAa,MAAA,CAAS,CAAA,CACxB,MAAM,IAAI,KAAA,CAAM,CAAA,0CAAA,EAA6CnB,CAAQ,CAAA,CAAA;AC/CjE;ACVR","file":"/Users/benbrook/transcend/cli/dist/chunk-7R7EIHBR.cjs","sourcesContent":[null,"import { readFileSync } from 'fs';\nimport { CodeScanningConfig } from '../types';\nimport { CodePackageSdk } from '../../../codecs';\nimport { findAllWithRegex } from '@transcend-io/type-utils';\nimport { CodePackageType } from '@transcend-io/privacy-types';\n\nconst POD_TARGET_REGEX = /target ('|\")(.*?)('|\")/;\nconst POD_PACKAGE_REGEX = /pod ('|\")(.*?)('|\")(, ('|\")~> (.+?)('|\")|)/;\n\nexport const cocoaPods: CodeScanningConfig = {\n supportedFiles: ['Podfile'],\n ignoreDirs: ['Pods'],\n scanFunction: (filePath) => {\n const fileContents = readFileSync(filePath, 'utf-8');\n\n const targets = findAllWithRegex(\n {\n value: new RegExp(POD_TARGET_REGEX, 'g'),\n matches: ['quote1', 'name', 'quote2'],\n },\n fileContents,\n );\n const packages = findAllWithRegex(\n {\n value: new RegExp(POD_PACKAGE_REGEX, 'g'),\n matches: [\n 'quote1',\n 'name',\n 'quote2',\n 'extra',\n 'quote3',\n 'version',\n 'quote4',\n ],\n },\n fileContents,\n );\n\n const deps: CodePackageSdk[] = targets.map((target, ind) => ({\n name: target.name,\n type: CodePackageType.CocoaPods,\n softwareDevelopmentKits: packages\n .filter(\n (pkg) =>\n pkg.matchIndex > target.matchIndex &&\n (!targets[ind + 1] || pkg.matchIndex < targets[ind + 1].matchIndex),\n )\n .map((pkg) => ({\n name: pkg.name,\n version: pkg.version,\n })),\n }));\n\n return deps;\n },\n};\n","import { readFileSync } from 'fs';\nimport { CodeScanningConfig } from '../types';\nimport { findAllWithRegex } from '@transcend-io/type-utils';\nimport { dirname } from 'path';\n\nconst GRADLE_IMPLEMENTATION_REGEX =\n /implementation( *)('|\")(.+?):(.+?):(.+?|)('|\")/;\nconst GRADLE_PLUGIN_REGEX = /apply plugin: *('|\")(.+?)(:(.+?)|)('|\")/;\nconst GRADLE_IMPLEMENTATION_GROUP_REGEX =\n /implementation group:( *)('|\")(.+?)('|\"),( *)name:( *)('|\")(.+?)('|\"),( *)version:( *)('|\")(.+?)('|\")/;\nconst GRADLE_APPLICATION_NAME_REGEX = /applicationId( *)\"(.+?)\"/;\n\n/**\n * So far, there are three ways of defining dependencies that is supported\n * implementation group: 'org.eclipse.jdt', name: 'org.eclipse.jdt.core', version: '3.28.0'\n * or\n * implementation 'com.google.firebase:firebase-analytics:18.0.0'\n * or\n * apply plugin: 'com.google.gms.google-services'\n *\n * single and double quotes are both recognized\n */\nexport const gradle: CodeScanningConfig = {\n supportedFiles: ['build.gradle**'],\n ignoreDirs: [\n 'gradle-app.setting',\n 'gradle-wrapper.jar',\n 'gradle-wrapper.properties',\n ],\n scanFunction: (filePath) => {\n const fileContents = readFileSync(filePath, 'utf-8');\n const directory = dirname(filePath);\n\n const targets = findAllWithRegex(\n {\n value: new RegExp(GRADLE_IMPLEMENTATION_REGEX, 'g'),\n matches: ['space', 'quote1', 'name', 'path', 'version', 'quote2'],\n },\n fileContents,\n );\n const targetPlugins = findAllWithRegex(\n {\n value: new RegExp(GRADLE_PLUGIN_REGEX, 'g'),\n matches: ['quote1', 'name', 'group', 'version', 'quote2'],\n },\n fileContents,\n );\n const targetGroups = findAllWithRegex(\n {\n value: new RegExp(GRADLE_IMPLEMENTATION_GROUP_REGEX, 'g'),\n matches: [\n 'space1',\n 'quote1',\n 'group',\n 'quote2',\n 'space2',\n 'space3',\n 'quote3',\n 'name',\n 'quote4',\n 'space4',\n 'space5',\n 'quote5',\n 'version',\n 'quote6',\n ],\n },\n fileContents,\n );\n const applications = findAllWithRegex(\n {\n value: new RegExp(GRADLE_APPLICATION_NAME_REGEX, 'g'),\n matches: ['space', 'name'],\n },\n fileContents,\n );\n if (applications.length > 1) {\n throw new Error(`Expected only one applicationId per file: ${filePath}`);\n }\n\n return [\n {\n name: applications[0]?.name || directory.split('/').pop()!,\n softwareDevelopmentKits: [\n ...targets,\n ...targetGroups,\n ...targetPlugins,\n ].map((target) => ({\n name: target.name,\n version: target.version || undefined,\n })),\n },\n ];\n },\n};\n","import { readFileSync } from 'fs';\nimport { CodeScanningConfig } from '../types';\nimport { CodePackageType } from '@transcend-io/privacy-types';\nimport yaml from 'js-yaml';\nimport { dirname } from 'path';\n\n/**\n * Remove YAML comments from a string\n *\n * @param yamlString - YAML string\n * @returns String without comments\n */\nfunction removeYAMLComments(yamlString: string): string {\n return yamlString\n .split('\\n')\n .map((line) => {\n // Remove inline comments\n const commentIndex = line.indexOf('#');\n if (commentIndex > -1) {\n // Check if '#' is not inside a string\n if (\n !line.substring(0, commentIndex).includes('\"') &&\n !line.substring(0, commentIndex).includes(\"'\")\n ) {\n return line.substring(0, commentIndex).trim();\n }\n }\n return line;\n })\n .filter((line) => line.length > 0)\n .join('\\n');\n}\n\nexport const pubspec: CodeScanningConfig = {\n supportedFiles: ['pubspec.yml'],\n ignoreDirs: ['build'],\n scanFunction: (filePath) => {\n const directory = dirname(filePath);\n const fileContents = readFileSync(filePath, 'utf-8');\n const {\n name,\n description,\n dev_dependencies = {},\n dependencies = {},\n } = yaml.load(removeYAMLComments(fileContents)) as {\n /** Name */\n name?: string;\n /** Description */\n description?: string;\n /** Dev dependencies */\n dev_dependencies?: { [k in string]: number | Record<string, string> };\n /** Dependencies */\n dependencies?: { [k in string]: number | Record<string, string> };\n };\n return [\n {\n name: name || directory.split('/').pop()!,\n description,\n type: CodePackageType.RequirementsTxt,\n softwareDevelopmentKits: [\n ...Object.entries(dependencies).map(([name, version]) => ({\n name,\n version:\n typeof version === 'string'\n ? version\n : typeof version === 'number'\n ? version.toString()\n : version?.sdk,\n })),\n ...Object.entries(dev_dependencies).map(([name, version]) => ({\n name,\n version:\n typeof version === 'string'\n ? version\n : typeof version === 'number'\n ? version.toString()\n : version?.sdk,\n isDevDependency: true,\n })),\n ],\n },\n ];\n },\n};\n","import { CodeScanningConfig } from './types';\nimport {\n cocoaPods,\n gradle,\n javascriptPackageJson,\n gemfile,\n composerJson,\n pubspec,\n swift,\n pythonRequirementsTxt,\n} from './integrations';\nimport { CodePackageType } from '@transcend-io/privacy-types';\n\n/**\n * @deprecated TODO: https://transcend.height.app/T-32325 - use code scanning instead\n */\nexport const SILO_DISCOVERY_CONFIGS: {\n [k in string]: CodeScanningConfig;\n} = {\n cocoaPods,\n gradle,\n javascriptPackageJson,\n pythonRequirementsTxt,\n gemfile,\n pubspec,\n swift,\n};\n\nexport const CODE_SCANNING_CONFIGS: {\n [k in CodePackageType]: CodeScanningConfig;\n} = {\n [CodePackageType.CocoaPods]: cocoaPods,\n [CodePackageType.Gradle]: gradle,\n [CodePackageType.PackageJson]: javascriptPackageJson,\n [CodePackageType.RequirementsTxt]: pythonRequirementsTxt,\n [CodePackageType.Gemfile]: gemfile,\n [CodePackageType.Pubspec]: pubspec,\n [CodePackageType.ComposerJson]: composerJson,\n [CodePackageType.Swift]: swift,\n};\n"]}
@@ -0,0 +1,75 @@
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 _chunkSJFPYDA3cjs = require('./chunk-SJFPYDA3.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _privacytypes = require('@transcend-io/privacy-types');var _cliprogress = require('cli-progress'); var _cliprogress2 = _interopRequireDefault(_cliprogress);var _graphqlrequest = require('graphql-request');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);async function q(u,{dataSiloIds:e=[],includeGuessedCategories:l,includeAttributes:a,parentCategories:c=[],subCategories:t=[],pageSize:p=1e3}={}){let n=[],m=new Date().getTime(),d=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),s={...c.length>0?{category:c}:{},...t.length>0?{subCategoryIds:t}:{},...c.length+t.length>0&&!l?{status:_privacytypes.SubDataPointDataSubCategoryGuessStatus.Approved}:{},...e.length>0?{dataSilos:e}:{}},{subDataPoints:{totalCount:o}}=await _chunkSJFPYDA3cjs.gc.call(void 0, u,_chunkSJFPYDA3cjs.f,{filterBy:s});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("[Step 1/3] Pulling in all subdatapoints")),d.start(o,0);let y=0,D=!1,r,b=0;do try{let{subDataPoints:{nodes:P}}=await _chunkSJFPYDA3cjs.gc.call(void 0, u,_graphqlrequest.gql`
2
+ query TranscendCliSubDataPointCsvExport(
3
+ $filterBy: SubDataPointFiltersInput
4
+ $first: Int!
5
+ $offset: Int!
6
+ ) {
7
+ subDataPoints(
8
+ filterBy: $filterBy
9
+ first: $first
10
+ offset: $offset
11
+ useMaster: false
12
+ ) {
13
+ nodes {
14
+ id
15
+ name
16
+ description
17
+ dataPointId
18
+ dataSiloId
19
+ purposes {
20
+ name
21
+ purpose
22
+ }
23
+ categories {
24
+ name
25
+ category
26
+ }
27
+ ${l?`pendingCategoryGuesses {
28
+ category {
29
+ name
30
+ category
31
+ }
32
+ status
33
+ classifierVersion
34
+ }`:""}
35
+ ${a?`attributeValues {
36
+ attributeKey {
37
+ name
38
+ }
39
+ name
40
+ }`:""}
41
+ }
42
+ }
43
+ }
44
+ `,{first:p,offset:b,filterBy:{...s}});r=_optionalChain([P, 'access', _2 => _2[P.length-1], 'optionalAccess', _3 => _3.id]),n.push(...P),D=P.length===p,y+=P.length,b+=P.length,d.update(y)}catch(P){throw _chunkZUNVPK23cjs.a.error(_colors2.default.red(`An error fetching subdatapoints for cursor ${r} and offset ${b}`)),P}while(D);d.stop();let C=new Date().getTime()-m,g=_chunkSJFPYDA3cjs.cc.call(void 0, n,"name");return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully pulled in ${g.length} subdatapoints in ${C/1e3} seconds!`)),g}async function F(u,{dataPointIds:e=[],pageSize:l=100}){let a=[],c=new Date().getTime(),t=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`[Step 2/3] Fetching metadata for ${e.length} datapoints`));let p=_chunkSJFPYDA3cjs._b.call(void 0, e,l);t.start(e.length,0);let n=0;await _chunkSJFPYDA3cjs.a.call(void 0, p,async s=>{try{let{dataPoints:{nodes:o}}=await _chunkSJFPYDA3cjs.gc.call(void 0, u,_chunkSJFPYDA3cjs.i,{first:l,filterBy:{ids:s}});a.push(...o),n+=s.length,t.update(n)}catch(o){throw _chunkZUNVPK23cjs.a.error(_colors2.default.red(`An error fetching subdatapoints for IDs ${s.join(", ")}`)),o}}),t.stop();let d=new Date().getTime()-c;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully pulled in ${a.length} dataPoints in ${d/1e3} seconds!`)),a}async function Q(u,{dataSiloIds:e=[],pageSize:l=100}){let a=[],c=new Date().getTime(),t=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`[Step 3/3] Fetching metadata for ${e.length} data silos`));let p=_chunkSJFPYDA3cjs._b.call(void 0, e,l);t.start(e.length,0);let n=0;await _chunkSJFPYDA3cjs.a.call(void 0, p,async s=>{try{let{dataSilos:{nodes:o}}=await _chunkSJFPYDA3cjs.gc.call(void 0, u,_chunkSJFPYDA3cjs.l,{first:l,filterBy:{ids:s}});a.push(...o),n+=s.length,t.update(n)}catch(o){throw _chunkZUNVPK23cjs.a.error(_colors2.default.red(`An error fetching data silos for IDs ${s.join(", ")}`)),o}}),t.stop();let d=new Date().getTime()-c;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully pulled in ${a.length} data silos in ${d/1e3} seconds!`)),a}async function Y(u,{dataSiloIds:e=[],includeGuessedCategories:l,includeAttributes:a,parentCategories:c=[],subCategories:t=[],pageSize:p=1e3}={}){let n=await q(u,{dataSiloIds:e,includeGuessedCategories:l,includeAttributes:a,parentCategories:c,subCategories:t,pageSize:p}),m=_chunkSJFPYDA3cjs.fc.call(void 0, n.map(r=>r.dataPointId)),d=await F(u,{dataPointIds:m}),s=_chunkSJFPYDA3cjs.bc.call(void 0, d,"id"),o=_chunkSJFPYDA3cjs.fc.call(void 0, n.map(r=>r.dataSiloId)),y=await Q(u,{dataSiloIds:o}),D=_chunkSJFPYDA3cjs.bc.call(void 0, y,"id");return n.map(r=>({...r,dataPoint:s[r.dataPointId],dataSilo:D[r.dataSiloId]}))}async function nt(u,{dataSiloIds:e=[],status:l,subCategories:a=[],includeEncryptedSnippets:c,pageSize:t=100}={}){let p=[],n=new Date().getTime(),m=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),d={...a.length>0?{subCategoryIds:a}:{},...l?{status:l}:{},...e.length>0?{dataSilos:e}:{}},{unstructuredSubDataPointRecommendations:{totalCount:s}}=await _chunkSJFPYDA3cjs.gc.call(void 0, u,_chunkSJFPYDA3cjs.j,{filterBy:d});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("[Step 1/3] Pulling in all subdatapoints")),m.start(s,0);let o=0,y=!1,D,r=0;do try{let{unstructuredSubDataPointRecommendations:{nodes:g}}=await _chunkSJFPYDA3cjs.gc.call(void 0, u,_graphqlrequest.gql`
45
+ query TranscendCliUnstructuredSubDataPointRecommendationCsvExport(
46
+ $filterBy: UnstructuredSubDataPointRecommendationsFilterInput
47
+ $first: Int!
48
+ $offset: Int!
49
+ ) {
50
+ unstructuredSubDataPointRecommendations(
51
+ filterBy: $filterBy
52
+ first: $first
53
+ offset: $offset
54
+ useMaster: false
55
+ ) {
56
+ nodes {
57
+ id
58
+ dataSiloId
59
+ scannedObjectPathId
60
+ scannedObjectId
61
+ ${c?"name":""}
62
+ ${c?"contextSnippet":""}
63
+ dataSubCategory {
64
+ name
65
+ category
66
+ }
67
+ status
68
+ confidence
69
+ classificationMethod
70
+ classifierVersion
71
+ }
72
+ }
73
+ }
74
+ `,{first:t,offset:r,filterBy:{...d}});D=_optionalChain([g, 'access', _4 => _4[g.length-1], 'optionalAccess', _5 => _5.id]),p.push(...g),y=g.length===t,o+=g.length,r+=g.length,m.update(o)}catch(g){throw _chunkZUNVPK23cjs.a.error(_colors2.default.red(`An error fetching subdatapoints for cursor ${D} and offset ${r}`)),g}while(y);m.stop();let R=new Date().getTime()-n,C=_chunkSJFPYDA3cjs.cc.call(void 0, p,"name");return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully pulled in ${C.length} subdatapoints in ${R/1e3} seconds!`)),C}exports.a = Y; exports.b = nt;
75
+ //# sourceMappingURL=chunk-BN4LSJ6U.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/chunk-BN4LSJ6U.cjs","../src/lib/data-inventory/pullAllDatapoints.ts","../src/lib/data-inventory/pullUnstructuredSubDataPointRecommendations.ts"],"names":["pullSubDatapoints","client","dataSiloIds","includeGuessedCategories","includeAttributes","parentCategories","subCategories","pageSize","subDataPoints","t0","progressBar","cliProgress","filterBy","SubDataPointDataSubCategoryGuessStatus","totalCount","makeGraphQLRequest","SUB_DATA_POINTS_COUNT","logger","colors","total","shouldContinue","cursor","offset","nodes","gql","err"],"mappings":"AAAA,quBAA4G,wDAAyC,2DCK9I,qGACiB,iDACJ,gFACD,MAkFnB,SAAeA,CAAAA,CACbC,CAAAA,CACA,CACE,WAAA,CAAAC,CAAAA,CAAc,CAAC,CAAA,CACf,wBAAA,CAAAC,CAAAA,CACA,iBAAA,CAAAC,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CAAmB,CAAC,CAAA,CACpB,aAAA,CAAAC,CAAAA,CAAgB,CAAC,CAAA,CACjB,QAAA,CAAAC,CAAAA,CAAW,GACb,CAAA,CAGI,CAAC,CAAA,CAC8B,CACnC,IAAMC,CAAAA,CAA0C,CAAC,CAAA,CAG3CC,CAAAA,CAAK,IAAI,IAAA,CAAK,CAAA,CAAE,OAAA,CAAQ,CAAA,CAGxBC,CAAAA,CAAc,IAAIC,qBAAAA,CAAY,SAAA,CAClC,CAAC,CAAA,CACDA,qBAAAA,CAAY,OAAA,CAAQ,cACtB,CAAA,CAGMC,CAAAA,CAAW,CACf,GAAIP,CAAAA,CAAiB,MAAA,CAAS,CAAA,CAAI,CAAE,QAAA,CAAUA,CAAiB,CAAA,CAAI,CAAC,CAAA,CACpE,GAAIC,CAAAA,CAAc,MAAA,CAAS,CAAA,CAAI,CAAE,cAAA,CAAgBA,CAAc,CAAA,CAAI,CAAC,CAAA,CAEpE,GAAID,CAAAA,CAAiB,MAAA,CAASC,CAAAA,CAAc,MAAA,CAAS,CAAA,EACrD,CAACH,CAAAA,CAEG,CAAE,MAAA,CAAQU,oDAAAA,CAAuC,QAAS,CAAA,CAC1D,CAAC,CAAA,CACL,GAAIX,CAAAA,CAAY,MAAA,CAAS,CAAA,CAAI,CAAE,SAAA,CAAWA,CAAY,CAAA,CAAI,CAAC,CAC7D,CAAA,CAGM,CACJ,aAAA,CAAe,CAAE,UAAA,CAAAY,CAAW,CAC9B,CAAA,CAAI,MAAMC,kCAAAA,CAMPd,CAAQe,mBAAAA,CAAuB,CAChC,QAAA,CAAAJ,CACF,CAAC,CAAA,CAEDK,mBAAAA,CAAO,IAAA,CAAKC,gBAAAA,CAAO,OAAA,CAAQ,yCAAyC,CAAC,CAAA,CAErER,CAAAA,CAAY,KAAA,CAAMI,CAAAA,CAAY,CAAC,CAAA,CAC/B,IAAIK,CAAAA,CAAQ,CAAA,CACRC,CAAAA,CAAiB,CAAA,CAAA,CACjBC,CAAAA,CACAC,CAAAA,CAAS,CAAA,CACb,GACE,GAAI,CACF,GAAM,CACJ,aAAA,CAAe,CAAE,KAAA,CAAAC,CAAM,CACzB,CAAA,CAAI,MAAMR,kCAAAA,CAORd,CACAuB,mBAAAA,CAAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAA,EA2BUrB,CAAAA,CACI,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAA,CAAA,CAQA,EACN,CAAA;AAAA,gBAAA,EAEEC,CAAAA,CACI,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAA,CAAA,CAMA,EACN,CAAA;AAAA;AAAA;AAAA;AAAA,QAAA,CAAA,CAKR,CACE,KAAA,CAAOG,CAAAA,CACP,MAAA,CAAAe,CAAAA,CACA,QAAA,CAAU,CACR,GAAGV,CAGL,CACF,CACF,CAAA,CAEAS,CAAAA,iBAASE,CAAAA,qBAAMA,CAAAA,CAAM,MAAA,CAAS,CAAC,CAAA,6BAAG,IAAA,CAClCf,CAAAA,CAAc,IAAA,CAAK,GAAGe,CAAK,CAAA,CAC3BH,CAAAA,CAAiBG,CAAAA,CAAM,MAAA,GAAWhB,CAAAA,CAClCY,CAAAA,EAASI,CAAAA,CAAM,MAAA,CACfD,CAAAA,EAAUC,CAAAA,CAAM,MAAA,CAChBb,CAAAA,CAAY,MAAA,CAAOS,CAAK,CAC1B,CAAA,KAAA,CAASM,CAAAA,CAAK,CACZ,MAAAR,mBAAAA,CAAO,KAAA,CACLC,gBAAAA,CAAO,GAAA,CACL,CAAA,2CAAA,EAA8CG,CAAM,CAAA,YAAA,EAAeC,CAAM,CAAA,CAAA;AC7G3E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBgD,gBAAA;AACU,gBAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+BiB,QAAA","file":"/Users/benbrook/transcend/cli/dist/chunk-BN4LSJ6U.cjs","sourcesContent":[null,"/* eslint-disable max-lines */\nimport { keyBy, uniq, chunk, sortBy } from 'lodash-es';\nimport {\n type DataCategoryType,\n SubDataPointDataSubCategoryGuessStatus,\n} from '@transcend-io/privacy-types';\nimport cliProgress from 'cli-progress';\nimport { gql } from 'graphql-request';\nimport colors from 'colors';\nimport type { GraphQLClient } from 'graphql-request';\nimport {\n DATAPOINT_EXPORT,\n DATA_SILO_EXPORT,\n type DataSiloAttributeValue,\n SUB_DATA_POINTS_COUNT,\n makeGraphQLRequest,\n} from '../graphql';\nimport { logger } from '../../logger';\nimport type { DataCategoryInput, ProcessingPurposeInput } from '../../codecs';\nimport { mapSeries } from '@/lib/bluebird-replace';\n\nexport interface DataSiloCsvPreview {\n /** ID of dataSilo */\n id: string;\n /** Name of dataSilo */\n title: string;\n}\n\nexport interface DataPointCsvPreview {\n /** ID of dataPoint */\n id: string;\n /** The path to this data point */\n path: string[];\n /** Description */\n description: {\n /** Default message */\n defaultMessage: string;\n };\n /** Name */\n name: string;\n}\n\nexport interface SubDataPointCsvPreview {\n /** ID of subDatapoint */\n id: string;\n /** Name (or key) of the subdatapoint */\n name: string;\n /** The description */\n description?: string;\n /** Personal data category */\n categories: DataCategoryInput[];\n /** Data point ID */\n dataPointId: string;\n /** The data silo ID */\n dataSiloId: string;\n /** The processing purpose for this sub datapoint */\n purposes: ProcessingPurposeInput[];\n /** Attribute attached to subdatapoint */\n attributeValues?: DataSiloAttributeValue[];\n /** Data category guesses that are output by the classifier */\n pendingCategoryGuesses?: {\n /** Data category being guessed */\n category: DataCategoryInput;\n /** Status of guess */\n status: SubDataPointDataSubCategoryGuessStatus;\n /** classifier version that produced the guess */\n classifierVersion: number;\n }[];\n}\n\nexport interface DatapointFilterOptions {\n /** IDs of data silos to filter down */\n dataSiloIds?: string[];\n /** Whether to include guessed categories, defaults to only approved categories */\n includeGuessedCategories?: boolean;\n /** Whether or not to include attributes */\n includeAttributes?: boolean;\n /** Parent categories to filter down for */\n parentCategories?: DataCategoryType[];\n /** Sub categories to filter down for */\n subCategories?: string[]; // TODO: https://transcend.height.app/T-40482 - do by name not ID\n}\n\n/**\n * Pull subdatapoint information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The subdatapoints\n */\nasync function pullSubDatapoints(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n includeGuessedCategories,\n includeAttributes,\n parentCategories = [],\n subCategories = [],\n pageSize = 1000,\n }: DatapointFilterOptions & {\n /** Page size to pull in */\n pageSize?: number;\n } = {},\n): Promise<SubDataPointCsvPreview[]> {\n const subDataPoints: SubDataPointCsvPreview[] = [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n // Filters\n const filterBy = {\n ...(parentCategories.length > 0 ? { category: parentCategories } : {}),\n ...(subCategories.length > 0 ? { subCategoryIds: subCategories } : {}),\n // if parentCategories or subCategories and not includeGuessedCategories\n ...(parentCategories.length + subCategories.length > 0 &&\n !includeGuessedCategories\n ? // then only show data points with approved data categories\n { status: SubDataPointDataSubCategoryGuessStatus.Approved }\n : {}),\n ...(dataSiloIds.length > 0 ? { dataSilos: dataSiloIds } : {}),\n };\n\n // Build a GraphQL client\n const {\n subDataPoints: { totalCount },\n } = await makeGraphQLRequest<{\n /** Query response */\n subDataPoints: {\n /** Count */\n totalCount: number;\n };\n }>(client, SUB_DATA_POINTS_COUNT, {\n filterBy,\n });\n\n logger.info(colors.magenta('[Step 1/3] Pulling in all subdatapoints'));\n\n progressBar.start(totalCount, 0);\n let total = 0;\n let shouldContinue = false;\n let cursor: string | undefined;\n let offset = 0;\n do {\n try {\n const {\n subDataPoints: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n subDataPoints: {\n /** List of matches */\n nodes: SubDataPointCsvPreview[];\n };\n }>(\n client,\n gql`\n query TranscendCliSubDataPointCsvExport(\n $filterBy: SubDataPointFiltersInput\n $first: Int!\n $offset: Int!\n ) {\n subDataPoints(\n filterBy: $filterBy\n first: $first\n offset: $offset\n useMaster: false\n ) {\n nodes {\n id\n name\n description\n dataPointId\n dataSiloId\n purposes {\n name\n purpose\n }\n categories {\n name\n category\n }\n ${\n includeGuessedCategories\n ? `pendingCategoryGuesses {\n category {\n name\n category\n }\n status\n classifierVersion\n }`\n : ''\n }\n ${\n includeAttributes\n ? `attributeValues {\n attributeKey {\n name\n }\n name\n }`\n : ''\n }\n }\n }\n }\n `,\n {\n first: pageSize,\n offset,\n filterBy: {\n ...filterBy,\n // TODO: https://transcend.height.app/T-40484 - add cursor support\n // ...(cursor ? { cursor: { id: cursor } } : {}),\n },\n },\n );\n\n cursor = nodes[nodes.length - 1]?.id as string;\n subDataPoints.push(...nodes);\n shouldContinue = nodes.length === pageSize;\n total += nodes.length;\n offset += nodes.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(\n `An error fetching subdatapoints for cursor ${cursor} and offset ${offset}`,\n ),\n );\n throw err;\n }\n } while (shouldContinue);\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n const sorted = sortBy(subDataPoints, 'name');\n\n logger.info(\n colors.green(\n `Successfully pulled in ${sorted.length} subdatapoints in ${\n totalTime / 1000\n } seconds!`,\n ),\n );\n return sorted;\n}\n\n/**\n * Pull datapoint information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The datapoints\n */\nasync function pullDatapoints(\n client: GraphQLClient,\n {\n dataPointIds = [],\n pageSize = 100,\n }: {\n /** IDs of data points to filter down */\n dataPointIds: string[];\n /** Page size to pull in */\n pageSize?: number;\n },\n): Promise<DataPointCsvPreview[]> {\n const dataPoints: DataPointCsvPreview[] = [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n logger.info(\n colors.magenta(\n `[Step 2/3] Fetching metadata for ${dataPointIds.length} datapoints`,\n ),\n );\n\n // Group by 100\n const dataPointsGrouped = chunk(dataPointIds, pageSize);\n\n progressBar.start(dataPointIds.length, 0);\n let total = 0;\n await mapSeries(dataPointsGrouped, async (dataPointIdsGroup) => {\n try {\n const {\n dataPoints: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n dataPoints: {\n /** List of matches */\n nodes: DataPointCsvPreview[];\n };\n }>(client, DATAPOINT_EXPORT, {\n first: pageSize,\n filterBy: {\n ids: dataPointIdsGroup,\n },\n });\n\n dataPoints.push(...nodes);\n total += dataPointIdsGroup.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(\n `An error fetching subdatapoints for IDs ${dataPointIdsGroup.join(\n ', ',\n )}`,\n ),\n );\n throw err;\n }\n });\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully pulled in ${dataPoints.length} dataPoints in ${\n totalTime / 1000\n } seconds!`,\n ),\n );\n return dataPoints;\n}\n\n/**\n * Pull data silo information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The data silos\n */\nasync function pullDataSilos(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n pageSize = 100,\n }: {\n /** IDs of data silos to filter down */\n dataSiloIds: string[];\n /** Page size to pull in */\n pageSize?: number;\n },\n): Promise<DataSiloCsvPreview[]> {\n const dataSilos: DataSiloCsvPreview[] = [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n logger.info(\n colors.magenta(\n `[Step 3/3] Fetching metadata for ${dataSiloIds.length} data silos`,\n ),\n );\n\n // Group by 100\n const dataSilosGrouped = chunk(dataSiloIds, pageSize);\n\n progressBar.start(dataSiloIds.length, 0);\n let total = 0;\n await mapSeries(dataSilosGrouped, async (dataSiloIdsGroup) => {\n try {\n const {\n dataSilos: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n dataSilos: {\n /** List of matches */\n nodes: DataSiloCsvPreview[];\n };\n }>(client, DATA_SILO_EXPORT, {\n first: pageSize,\n filterBy: {\n ids: dataSiloIdsGroup,\n },\n });\n\n dataSilos.push(...nodes);\n total += dataSiloIdsGroup.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(\n `An error fetching data silos for IDs ${dataSiloIdsGroup.join(', ')}`,\n ),\n );\n throw err;\n }\n });\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully pulled in ${dataSilos.length} data silos in ${\n totalTime / 1000\n } seconds!`,\n ),\n );\n return dataSilos;\n}\n\n/**\n * Pull all datapoints from the data inventory.\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The datapoints and data silos\n */\nexport async function pullAllDatapoints(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n includeGuessedCategories,\n includeAttributes,\n parentCategories = [],\n subCategories = [],\n pageSize = 1000,\n }: DatapointFilterOptions & {\n /** Page size to pull in */\n pageSize?: number;\n } = {},\n): Promise<\n (SubDataPointCsvPreview & {\n /** Data point information */\n dataPoint: DataPointCsvPreview;\n /** Data silo information */\n dataSilo: DataSiloCsvPreview;\n })[]\n> {\n // Subdatapoint information\n const subDatapoints = await pullSubDatapoints(client, {\n dataSiloIds,\n includeGuessedCategories,\n includeAttributes,\n parentCategories,\n subCategories,\n pageSize,\n });\n\n // The datapoint ids to grab\n const dataPointIds = uniq(subDatapoints.map((point) => point.dataPointId));\n const dataPoints = await pullDatapoints(client, {\n dataPointIds,\n });\n const dataPointById = keyBy(dataPoints, 'id');\n\n // The data silo IDs to grab\n const allDataSiloIds = uniq(subDatapoints.map((point) => point.dataSiloId));\n const dataSilos = await pullDataSilos(client, {\n dataSiloIds: allDataSiloIds,\n });\n const dataSiloById = keyBy(dataSilos, 'id');\n\n return subDatapoints.map((subDataPoint) => ({\n ...subDataPoint,\n dataPoint: dataPointById[subDataPoint.dataPointId],\n dataSilo: dataSiloById[subDataPoint.dataSiloId],\n }));\n}\n/* eslint-enable max-lines */\n","import type { UnstructuredSubDataPointRecommendationStatus } from '@transcend-io/privacy-types';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\nimport { gql, type GraphQLClient } from 'graphql-request';\nimport { sortBy } from 'lodash-es';\nimport type { DataCategoryInput } from '../../codecs';\nimport { ENTRY_COUNT, makeGraphQLRequest } from '../graphql';\nimport { logger } from '../../logger';\n\ninterface UnstructuredSubDataPointRecommendationCsvPreview {\n /** ID of subDatapoint */\n id: string;\n /** Entry or Named Entity recognized by the classifier */\n name: string;\n /** Context snippet including entry */\n contextSnippet: string;\n /** Scanned object ID */\n scannedObjectId: string;\n /** Scanned object path ID */\n scannedObjectPathId: string;\n /** The data silo ID */\n dataSiloId: string;\n /** Personal data category */\n dataSubCategory: DataCategoryInput;\n /** Classification Status */\n status: UnstructuredSubDataPointRecommendationStatus;\n /** Confidence */\n confidence: number;\n /** Classification method */\n classificationMethod: string;\n /** Classifier version */\n classifierVersion: string;\n}\n\ninterface EntryFilterOptions {\n /** IDs of data silos to filter down */\n dataSiloIds?: string[];\n /** Parent categories to filter down for */\n status?: UnstructuredSubDataPointRecommendationStatus[];\n /** Sub categories to filter down for */\n subCategories?: string[]; // TODO: https://transcend.height.app/T-40482 - do by name not ID\n /** Include entry and snippet */\n includeEncryptedSnippets?: boolean;\n /** Include encryptedSamplesS3Key */\n includeEncryptedSamplesS3Key?: boolean;\n}\n/**\n * Pull unstructured subdatapoint information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @param options.dataSiloIds - IDs of data silos to filter down\n * @param options.status - Parent categories to filter down for\n * @param options.subCategories - Sub categories to filter down for\n * @param options.includeEncryptedSnippets - Include entry and snippet\n * @param options.includeEncryptedSamplesS3Key - Include encryptedSamplesS3Key\n * @param options.pageSize - Page size to pull in\n * @returns A promise that resolves to an array of unstructured subdatapoint recommendations\n */\nexport async function pullUnstructuredSubDataPointRecommendations(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n status,\n subCategories = [],\n includeEncryptedSnippets,\n pageSize = 100,\n }: EntryFilterOptions & {\n /** Page size to pull in */\n pageSize?: number;\n } = {},\n): Promise<UnstructuredSubDataPointRecommendationCsvPreview[]> {\n const unstructuredSubDataPointRecommendations: UnstructuredSubDataPointRecommendationCsvPreview[] =\n [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n // Filters\n const filterBy = {\n ...(subCategories.length > 0 ? { subCategoryIds: subCategories } : {}),\n ...(status ? { status } : {}),\n ...(dataSiloIds.length > 0 ? { dataSilos: dataSiloIds } : {}),\n };\n\n // Build a GraphQL client\n const {\n unstructuredSubDataPointRecommendations: { totalCount },\n } = await makeGraphQLRequest<{\n /** Query response */\n unstructuredSubDataPointRecommendations: {\n /** Count */\n totalCount: number;\n };\n }>(client, ENTRY_COUNT, {\n filterBy,\n });\n\n logger.info(colors.magenta('[Step 1/3] Pulling in all subdatapoints'));\n\n progressBar.start(totalCount, 0);\n let total = 0;\n let shouldContinue = false;\n let cursor: string | undefined;\n let offset = 0;\n do {\n try {\n const {\n unstructuredSubDataPointRecommendations: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n unstructuredSubDataPointRecommendations: {\n /** List of matches */\n nodes: UnstructuredSubDataPointRecommendationCsvPreview[];\n };\n }>(\n client,\n gql`\n query TranscendCliUnstructuredSubDataPointRecommendationCsvExport(\n $filterBy: UnstructuredSubDataPointRecommendationsFilterInput\n $first: Int!\n $offset: Int!\n ) {\n unstructuredSubDataPointRecommendations(\n filterBy: $filterBy\n first: $first\n offset: $offset\n useMaster: false\n ) {\n nodes {\n id\n dataSiloId\n scannedObjectPathId\n scannedObjectId\n ${includeEncryptedSnippets ? 'name' : ''}\n ${includeEncryptedSnippets ? 'contextSnippet' : ''}\n dataSubCategory {\n name\n category\n }\n status\n confidence\n classificationMethod\n classifierVersion\n }\n }\n }\n `,\n {\n first: pageSize,\n offset,\n filterBy: {\n ...filterBy,\n },\n },\n );\n\n cursor = nodes[nodes.length - 1]?.id as string;\n unstructuredSubDataPointRecommendations.push(...nodes);\n shouldContinue = nodes.length === pageSize;\n total += nodes.length;\n offset += nodes.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(\n `An error fetching subdatapoints for cursor ${cursor} and offset ${offset}`,\n ),\n );\n throw err;\n }\n } while (shouldContinue);\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n const sorted = sortBy(unstructuredSubDataPointRecommendations, 'name');\n\n logger.info(\n colors.green(\n `Successfully pulled in ${sorted.length} subdatapoints in ${\n totalTime / 1000\n } seconds!`,\n ),\n );\n return sorted;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _typeutils = require('@transcend-io/type-utils');var a=(s=>(s.Json="json",s))(a||{}),o= exports.b =(s=>(s.Assessments="assessments",s))(o||{}),p= exports.c =(i=>(i.OneTrust="oneTrust",i.File="file",i))(p||{}),m= exports.d =(t=>(t.ApiKeys="apiKeys",t.Attributes="customFields",t.Templates="templates",t.DataSilos="dataSilos",t.Enrichers="enrichers",t.DataFlows="dataFlows",t.BusinessEntities="businessEntities",t.Actions="actions",t.DataSubjects="dataSubjects",t.Identifiers="identifiers",t.Cookies="cookies",t.ConsentManager="consentManager",t.Partitions="partitions",t.Prompts="prompts",t.PromptPartials="promptPartials",t.PromptGroups="promptGroups",t.Agents="agents",t.AgentFunctions="agentFunctions",t.AgentFiles="agentFiles",t.Vendors="vendors",t.DataCategories="dataCategories",t.ProcessingPurposes="processingPurposes",t.ActionItems="actionItems",t.ActionItemCollections="actionItemCollections",t.Teams="teams",t.PrivacyCenters="privacyCenters",t.Policies="policies",t.Messages="messages",t.Assessments="assessments",t.AssessmentTemplates="assessmentTemplates",t.Purposes="purposes",t))(m||{}),n= exports.e =_typeutils.makeEnum.call(void 0, {RedactEmail:"redactEmail",Log:"log",LogToTranscend:"logToTranscend",ApplyTranscendPolicies:"applyTranscendPolicies"}),h= exports.f =_typeutils.makeEnum.call(void 0, {ChatCompletion:"/v1/chat/completions",Embeddings:"/v1/embeddings",Completions:"/v1/completions",Agents:"/v1/assistants",Agent:"/v1/assistants/:assistantId",Threads:"/v1/threads",Thread:"/v1/threads/:threadId",Messages:"/v1/threads/:threadId/messages",Message:"/v1/threads/:threadId/messages/:messageId",Runs:"/v1/threads/:threadId/runs",Run:"/v1/threads/:threadId/runs/:runId",Files:"/v1/files",File:"/v1/files/:fileId"});exports.a = a; exports.b = o; exports.c = p; exports.d = m; exports.e = n; exports.f = h;
2
+ //# sourceMappingURL=chunk-BY7W4UQF.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/enums.ts"],"names":["OneTrustFileFormat","OneTrustPullResource","OneTrustPullSource","TranscendPullResource","PathfinderPolicyName","makeEnum","OpenAIRouteName"],"mappings":"AAAA,8HAAyB,IAGbA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CACVA,CAAAA,CAAA,IAAA,CAAO,MAAA,CADGA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAA,CAAA,CAAA,CAAA,CAOAC,CAAAA,aAAAA,CAAAA,CAAAA,EAAAA,CACVA,CAAAA,CAAA,WAAA,CAAc,aAAA,CADJA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAA,CAAA,CAAA,CAAA,CAOAC,CAAAA,aAAAA,CAAAA,CAAAA,EAAAA,CACVA,CAAAA,CAAA,QAAA,CAAW,UAAA,CACXA,CAAAA,CAAA,IAAA,CAAO,MAAA,CAFGA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAA,CAAA,CAAA,CAAA,CAQAC,CAAAA,aAAAA,CAAAA,CAAAA,EAAAA,CACVA,CAAAA,CAAA,OAAA,CAAU,SAAA,CACVA,CAAAA,CAAA,UAAA,CAAa,cAAA,CACbA,CAAAA,CAAA,SAAA,CAAY,WAAA,CACZA,CAAAA,CAAA,SAAA,CAAY,WAAA,CACZA,CAAAA,CAAA,SAAA,CAAY,WAAA,CACZA,CAAAA,CAAA,SAAA,CAAY,WAAA,CACZA,CAAAA,CAAA,gBAAA,CAAmB,kBAAA,CACnBA,CAAAA,CAAA,OAAA,CAAU,SAAA,CACVA,CAAAA,CAAA,YAAA,CAAe,cAAA,CACfA,CAAAA,CAAA,WAAA,CAAc,aAAA,CACdA,CAAAA,CAAA,OAAA,CAAU,SAAA,CACVA,CAAAA,CAAA,cAAA,CAAiB,gBAAA,CACjBA,CAAAA,CAAA,UAAA,CAAa,YAAA,CACbA,CAAAA,CAAA,OAAA,CAAU,SAAA,CACVA,CAAAA,CAAA,cAAA,CAAiB,gBAAA,CACjBA,CAAAA,CAAA,YAAA,CAAe,cAAA,CACfA,CAAAA,CAAA,MAAA,CAAS,QAAA,CACTA,CAAAA,CAAA,cAAA,CAAiB,gBAAA,CACjBA,CAAAA,CAAA,UAAA,CAAa,YAAA,CACbA,CAAAA,CAAA,OAAA,CAAU,SAAA,CACVA,CAAAA,CAAA,cAAA,CAAiB,gBAAA,CACjBA,CAAAA,CAAA,kBAAA,CAAqB,oBAAA,CACrBA,CAAAA,CAAA,WAAA,CAAc,aAAA,CACdA,CAAAA,CAAA,qBAAA,CAAwB,uBAAA,CACxBA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CACRA,CAAAA,CAAA,cAAA,CAAiB,gBAAA,CACjBA,CAAAA,CAAA,QAAA,CAAW,UAAA,CACXA,CAAAA,CAAA,QAAA,CAAW,UAAA,CACXA,CAAAA,CAAA,WAAA,CAAc,aAAA,CACdA,CAAAA,CAAA,mBAAA,CAAsB,qBAAA,CACtBA,CAAAA,CAAA,QAAA,CAAW,UAAA,CA/BDA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAA,CAAA,CAAA,CAAA,CAqCCC,CAAAA,aAAuBC,iCAAAA,CAClC,WAAA,CAAa,aAAA,CACb,GAAA,CAAK,KAAA,CACL,cAAA,CAAgB,gBAAA,CAChB,sBAAA,CAAwB,wBAC1B,CAAC,CAAA,CAYYC,CAAAA,aAAkBD,iCAAAA,CAC7B,cAAA,CAAgB,sBAAA,CAChB,UAAA,CAAY,gBAAA,CACZ,WAAA,CAAa,iBAAA,CACb,MAAA,CAAQ,gBAAA,CACR,KAAA,CAAO,6BAAA,CACP,OAAA,CAAS,aAAA,CACT,MAAA,CAAQ,uBAAA,CACR,QAAA,CAAU,gCAAA,CACV,OAAA,CAAS,2CAAA,CACT,IAAA,CAAM,4BAAA,CACN,GAAA,CAAK,mCAAA,CACL,KAAA,CAAO,WAAA,CACP,IAAA,CAAM,mBACR,CAAC,CAAA,CAAA,yFAAA","file":"/Users/benbrook/transcend/cli/dist/chunk-BY7W4UQF.cjs","sourcesContent":["import { makeEnum } from '@transcend-io/type-utils';\n\n/** Accepted file formats for exporting resources from OneTrust */\nexport enum OneTrustFileFormat {\n Json = 'json',\n}\n\n/**\n * Resources that can be pulled in from OneTrust\n */\nexport enum OneTrustPullResource {\n Assessments = 'assessments',\n}\n\n/**\n * Where to read OneTrust resources from\n */\nexport enum OneTrustPullSource {\n OneTrust = 'oneTrust',\n File = 'file',\n}\n\n/**\n * Resources that can be pulled in\n */\nexport enum TranscendPullResource {\n ApiKeys = 'apiKeys',\n Attributes = 'customFields',\n Templates = 'templates',\n DataSilos = 'dataSilos',\n Enrichers = 'enrichers',\n DataFlows = 'dataFlows',\n BusinessEntities = 'businessEntities',\n Actions = 'actions',\n DataSubjects = 'dataSubjects',\n Identifiers = 'identifiers',\n Cookies = 'cookies',\n ConsentManager = 'consentManager',\n Partitions = 'partitions',\n Prompts = 'prompts',\n PromptPartials = 'promptPartials',\n PromptGroups = 'promptGroups',\n Agents = 'agents',\n AgentFunctions = 'agentFunctions',\n AgentFiles = 'agentFiles',\n Vendors = 'vendors',\n DataCategories = 'dataCategories',\n ProcessingPurposes = 'processingPurposes',\n ActionItems = 'actionItems',\n ActionItemCollections = 'actionItemCollections',\n Teams = 'teams',\n PrivacyCenters = 'privacyCenters',\n Policies = 'policies',\n Messages = 'messages',\n Assessments = 'assessments',\n AssessmentTemplates = 'assessmentTemplates',\n Purposes = 'purposes',\n}\n\n/**\n * Names of built in policies for pathfinder\n */\nexport const PathfinderPolicyName = makeEnum({\n RedactEmail: 'redactEmail',\n Log: 'log',\n LogToTranscend: 'logToTranscend',\n ApplyTranscendPolicies: 'applyTranscendPolicies',\n});\n\n/**\n * Type override\n */\nexport type PathfinderPolicyName =\n (typeof PathfinderPolicyName)[keyof typeof PathfinderPolicyName];\n\n/**\n * The names of the OpenAI routes that we support setting policies for\n * reference: https://platform.openai.com/docs/api-reference/introduction\n */\nexport const OpenAIRouteName = makeEnum({\n ChatCompletion: '/v1/chat/completions',\n Embeddings: '/v1/embeddings',\n Completions: '/v1/completions',\n Agents: '/v1/assistants',\n Agent: '/v1/assistants/:assistantId',\n Threads: '/v1/threads',\n Thread: '/v1/threads/:threadId',\n Messages: '/v1/threads/:threadId/messages',\n Message: '/v1/threads/:threadId/messages/:messageId',\n Runs: '/v1/threads/:threadId/runs',\n Run: '/v1/threads/:threadId/runs/:runId',\n Files: '/v1/files',\n File: '/v1/files/:fileId',\n});\n\n/**\n * Type override\n */\nexport type OpenAIRouteName =\n (typeof OpenAIRouteName)[keyof typeof OpenAIRouteName];\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _privacytypes = require('@transcend-io/privacy-types');var r="transcend",s= exports.b ="https://app.transcend.io",c= exports.c =`${s}/infrastructure/integrations`,p= exports.d =`${s}/data-map/data-inventory/data-points`,g= exports.e =process.env.TRANSCEND_API_URL||"https://api.transcend.io",l= exports.f =process.env.TRANSCEND_CONSENT_API_URL||"https://consent.transcend.io",m= exports.g ={apiKeys:[_privacytypes.ScopeName.ViewApiKeys],templates:[_privacytypes.ScopeName.ManageEmailTemplates],dataSilos:[_privacytypes.ScopeName.ManageDataMap,_privacytypes.ScopeName.ConnectDataSilos],enrichers:[_privacytypes.ScopeName.ManageRequestIdentities],businessEntities:[_privacytypes.ScopeName.ManageDataInventory],identifiers:[_privacytypes.ScopeName.ManageRequestIdentities],customFields:[_privacytypes.ScopeName.ManageGlobalAttributes],dataFlows:[_privacytypes.ScopeName.ManageDataFlow],cookies:[_privacytypes.ScopeName.ManageDataFlow],consentManager:[_privacytypes.ScopeName.ManageConsentManagerDeveloperSettings],partitions:[_privacytypes.ScopeName.ManageConsentManagerDeveloperSettings],actions:[_privacytypes.ScopeName.ManageDataSubjectRequestSettings],dataSubjects:[_privacytypes.ScopeName.ManageDataSubjectRequestSettings],prompts:[_privacytypes.ScopeName.ManagePrompts],promptPartials:[_privacytypes.ScopeName.ManagePrompts],promptGroups:[_privacytypes.ScopeName.ManagePrompts],agents:[_privacytypes.ScopeName.ManagePathfinder],agentFunctions:[_privacytypes.ScopeName.ManagePathfinder],agentFiles:[_privacytypes.ScopeName.ManagePathfinder],vendors:[_privacytypes.ScopeName.ManageDataInventory],dataCategories:[_privacytypes.ScopeName.ManageDataInventory],processingPurposes:[_privacytypes.ScopeName.ManageDataInventory],actionItems:[_privacytypes.ScopeName.ManageAllActionItems,_privacytypes.ScopeName.ViewGlobalAttributes],actionItemCollections:[_privacytypes.ScopeName.ManageActionItemCollections],teams:[_privacytypes.ScopeName.ManageAccessControl],messages:[_privacytypes.ScopeName.ManageIntlMessages],privacyCenters:[_privacytypes.ScopeName.ManagePrivacyCenter],policies:[_privacytypes.ScopeName.ManagePolicies],assessments:[_privacytypes.ScopeName.ManageAssessments],assessmentTemplates:[_privacytypes.ScopeName.ManageAssessments],purposes:[_privacytypes.ScopeName.ManageConsentManager,_privacytypes.ScopeName.ManagePreferenceStoreSettings]},A= exports.h ={apiKeys:[_privacytypes.ScopeName.ViewApiKeys],templates:[_privacytypes.ScopeName.ViewEmailTemplates],dataSilos:[_privacytypes.ScopeName.ViewDataMap,_privacytypes.ScopeName.ViewDataSubjectRequestSettings],enrichers:[_privacytypes.ScopeName.ViewRequestIdentitySettings],businessEntities:[_privacytypes.ScopeName.ViewDataInventory],identifiers:[_privacytypes.ScopeName.ViewRequestIdentitySettings],customFields:[_privacytypes.ScopeName.ViewGlobalAttributes],dataFlows:[_privacytypes.ScopeName.ViewDataFlow],cookies:[_privacytypes.ScopeName.ViewDataFlow],consentManager:[_privacytypes.ScopeName.ViewConsentManager],partitions:[_privacytypes.ScopeName.ViewConsentManager],actions:[_privacytypes.ScopeName.ViewDataSubjectRequestSettings],dataSubjects:[_privacytypes.ScopeName.ViewDataSubjectRequestSettings],prompts:[_privacytypes.ScopeName.ViewPrompts],promptPartials:[_privacytypes.ScopeName.ViewPrompts],promptGroups:[_privacytypes.ScopeName.ViewPrompts],agents:[_privacytypes.ScopeName.ViewPathfinder],agentFunctions:[_privacytypes.ScopeName.ViewPathfinder],agentFiles:[_privacytypes.ScopeName.ViewPathfinder],vendors:[_privacytypes.ScopeName.ViewDataInventory],dataCategories:[_privacytypes.ScopeName.ViewDataInventory],processingPurposes:[_privacytypes.ScopeName.ViewDataInventory],actionItemCollections:[_privacytypes.ScopeName.ViewAllActionItems],actionItems:[_privacytypes.ScopeName.ViewAllActionItems],teams:[_privacytypes.ScopeName.ViewScopes],messages:[_privacytypes.ScopeName.ViewIntlMessages],privacyCenters:[_privacytypes.ScopeName.ViewPrivacyCenter],policies:[_privacytypes.ScopeName.ViewPolicies],assessments:[_privacytypes.ScopeName.ViewAssessments],assessmentTemplates:[_privacytypes.ScopeName.ViewAssessments],purposes:[_privacytypes.ScopeName.ViewConsentManager,_privacytypes.ScopeName.ViewPreferenceStoreSettings]},P= exports.i ={apiKeys:"api-keys",customFields:"attributes",dataFlows:"data-flows",cookies:"cookies",consentManager:"consent-manager",partitions:"partitions",actions:"actions",dataSubjects:"data-subjects",businessEntities:"business-entities",identifiers:"identifiers",enrichers:"enrichers",dataSilos:"data-silos",templates:"templates",prompts:"prompts",promptPartials:"prompt-partials",promptGroups:"prompt-groups",agents:"agents",agentFunctions:"agent-functions",agentFiles:"agent-files",vendors:"vendors",dataCategories:"data-categories",processingPurposes:"processing-purposes",actionItems:"action-items",actionItemCollections:"action-item-collections",teams:"teams",messages:"messages",privacyCenters:"privacy-center",policies:"policies",assessments:"assessments",assessmentTemplates:"assessment-templates",purposes:"purposes"};exports.a = r; exports.b = s; exports.c = c; exports.d = p; exports.e = g; exports.f = l; exports.g = m; exports.h = A; exports.i = P;
2
+ //# sourceMappingURL=chunk-EG4L6YAJ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/constants.ts"],"names":["name","ADMIN_DASH","ADMIN_DASH_INTEGRATIONS"],"mappings":"AAAA,oIAA0B,IAKbA,CAAAA,CAAO,WAAA,CAEPC,CAAAA,aAAa,0BAAA,CAEbC,CAAAA,aAA0B,CAAA,EAAA","file":"/Users/benbrook/transcend/cli/dist/chunk-EG4L6YAJ.cjs","sourcesContent":["import { ScopeName } from '@transcend-io/privacy-types';\nimport { TranscendPullResource } from './enums';\nimport { TranscendInput } from './codecs';\n\nexport { description, version } from '../package.json';\nexport const name = 'transcend';\n\nexport const ADMIN_DASH = 'https://app.transcend.io';\n\nexport const ADMIN_DASH_INTEGRATIONS = `${ADMIN_DASH}/infrastructure/integrations`;\nexport const ADMIN_DASH_DATAPOINTS = `${ADMIN_DASH}/data-map/data-inventory/data-points`;\n\n/**\n * Override default transcend API url using\n * TRANSCEND_API_URL=https://api.us.transcend.io transcend ...\n */\nexport const DEFAULT_TRANSCEND_API =\n process.env.TRANSCEND_API_URL || 'https://api.transcend.io';\n\n/**\n * Override default transcend API url using\n * TRANSCEND_CONSENT_API_URL=https://consent.us.transcend.io transcend ...\n */\nexport const DEFAULT_TRANSCEND_CONSENT_API =\n process.env.TRANSCEND_CONSENT_API_URL || 'https://consent.transcend.io';\n\n/**\n * Mapping between resource type and scopes required for cli\n */\nexport const TR_PUSH_RESOURCE_SCOPE_MAP: {\n [k in TranscendPullResource]: ScopeName[];\n} = {\n [TranscendPullResource.ApiKeys]: [ScopeName.ViewApiKeys],\n [TranscendPullResource.Templates]: [ScopeName.ManageEmailTemplates],\n [TranscendPullResource.DataSilos]: [\n ScopeName.ManageDataMap,\n ScopeName.ConnectDataSilos,\n ],\n [TranscendPullResource.Enrichers]: [ScopeName.ManageRequestIdentities],\n [TranscendPullResource.BusinessEntities]: [ScopeName.ManageDataInventory],\n [TranscendPullResource.Identifiers]: [ScopeName.ManageRequestIdentities],\n [TranscendPullResource.Attributes]: [ScopeName.ManageGlobalAttributes],\n [TranscendPullResource.DataFlows]: [ScopeName.ManageDataFlow],\n [TranscendPullResource.Cookies]: [ScopeName.ManageDataFlow],\n [TranscendPullResource.ConsentManager]: [\n ScopeName.ManageConsentManagerDeveloperSettings,\n ],\n [TranscendPullResource.Partitions]: [\n ScopeName.ManageConsentManagerDeveloperSettings,\n ],\n [TranscendPullResource.Actions]: [ScopeName.ManageDataSubjectRequestSettings],\n [TranscendPullResource.DataSubjects]: [\n ScopeName.ManageDataSubjectRequestSettings,\n ],\n [TranscendPullResource.Prompts]: [ScopeName.ManagePrompts],\n [TranscendPullResource.PromptPartials]: [ScopeName.ManagePrompts],\n [TranscendPullResource.PromptGroups]: [ScopeName.ManagePrompts],\n [TranscendPullResource.Agents]: [ScopeName.ManagePathfinder],\n [TranscendPullResource.AgentFunctions]: [ScopeName.ManagePathfinder],\n [TranscendPullResource.AgentFiles]: [ScopeName.ManagePathfinder],\n [TranscendPullResource.Vendors]: [ScopeName.ManageDataInventory],\n [TranscendPullResource.DataCategories]: [ScopeName.ManageDataInventory],\n [TranscendPullResource.ProcessingPurposes]: [ScopeName.ManageDataInventory],\n [TranscendPullResource.ActionItems]: [\n ScopeName.ManageAllActionItems,\n ScopeName.ViewGlobalAttributes,\n ],\n [TranscendPullResource.ActionItemCollections]: [\n ScopeName.ManageActionItemCollections,\n ],\n [TranscendPullResource.Teams]: [ScopeName.ManageAccessControl],\n [TranscendPullResource.Messages]: [ScopeName.ManageIntlMessages],\n [TranscendPullResource.PrivacyCenters]: [ScopeName.ManagePrivacyCenter],\n [TranscendPullResource.Policies]: [ScopeName.ManagePolicies],\n [TranscendPullResource.Assessments]: [ScopeName.ManageAssessments],\n [TranscendPullResource.AssessmentTemplates]: [ScopeName.ManageAssessments],\n [TranscendPullResource.Purposes]: [\n ScopeName.ManageConsentManager,\n ScopeName.ManagePreferenceStoreSettings,\n ],\n};\n\n/**\n * Mapping between resource type and scopes required for cli\n */\nexport const TR_PULL_RESOURCE_SCOPE_MAP: {\n [k in TranscendPullResource]: ScopeName[];\n} = {\n [TranscendPullResource.ApiKeys]: [ScopeName.ViewApiKeys],\n [TranscendPullResource.Templates]: [ScopeName.ViewEmailTemplates],\n [TranscendPullResource.DataSilos]: [\n ScopeName.ViewDataMap,\n ScopeName.ViewDataSubjectRequestSettings,\n ],\n [TranscendPullResource.Enrichers]: [ScopeName.ViewRequestIdentitySettings],\n [TranscendPullResource.BusinessEntities]: [ScopeName.ViewDataInventory],\n [TranscendPullResource.Identifiers]: [ScopeName.ViewRequestIdentitySettings],\n [TranscendPullResource.Attributes]: [ScopeName.ViewGlobalAttributes],\n [TranscendPullResource.DataFlows]: [ScopeName.ViewDataFlow],\n [TranscendPullResource.Cookies]: [ScopeName.ViewDataFlow],\n [TranscendPullResource.ConsentManager]: [ScopeName.ViewConsentManager],\n [TranscendPullResource.Partitions]: [ScopeName.ViewConsentManager],\n [TranscendPullResource.Actions]: [ScopeName.ViewDataSubjectRequestSettings],\n [TranscendPullResource.DataSubjects]: [\n ScopeName.ViewDataSubjectRequestSettings,\n ],\n [TranscendPullResource.Prompts]: [ScopeName.ViewPrompts],\n [TranscendPullResource.PromptPartials]: [ScopeName.ViewPrompts],\n [TranscendPullResource.PromptGroups]: [ScopeName.ViewPrompts],\n [TranscendPullResource.Agents]: [ScopeName.ViewPathfinder],\n [TranscendPullResource.AgentFunctions]: [ScopeName.ViewPathfinder],\n [TranscendPullResource.AgentFiles]: [ScopeName.ViewPathfinder],\n [TranscendPullResource.Vendors]: [ScopeName.ViewDataInventory],\n [TranscendPullResource.DataCategories]: [ScopeName.ViewDataInventory],\n [TranscendPullResource.ProcessingPurposes]: [ScopeName.ViewDataInventory],\n [TranscendPullResource.ActionItemCollections]: [ScopeName.ViewAllActionItems],\n [TranscendPullResource.ActionItems]: [ScopeName.ViewAllActionItems],\n [TranscendPullResource.Teams]: [ScopeName.ViewScopes],\n [TranscendPullResource.Messages]: [ScopeName.ViewIntlMessages],\n [TranscendPullResource.PrivacyCenters]: [ScopeName.ViewPrivacyCenter],\n [TranscendPullResource.Policies]: [ScopeName.ViewPolicies],\n [TranscendPullResource.Assessments]: [ScopeName.ViewAssessments],\n [TranscendPullResource.AssessmentTemplates]: [ScopeName.ViewAssessments],\n [TranscendPullResource.Purposes]: [\n ScopeName.ViewConsentManager,\n ScopeName.ViewPreferenceStoreSettings,\n ],\n};\n\nexport const TR_YML_RESOURCE_TO_FIELD_NAME: Record<\n TranscendPullResource,\n keyof TranscendInput\n> = {\n [TranscendPullResource.ApiKeys]: 'api-keys',\n [TranscendPullResource.Attributes]: 'attributes',\n [TranscendPullResource.DataFlows]: 'data-flows',\n [TranscendPullResource.Cookies]: 'cookies',\n [TranscendPullResource.ConsentManager]: 'consent-manager',\n [TranscendPullResource.Partitions]: 'partitions',\n [TranscendPullResource.Actions]: 'actions',\n [TranscendPullResource.DataSubjects]: 'data-subjects',\n [TranscendPullResource.BusinessEntities]: 'business-entities',\n [TranscendPullResource.Identifiers]: 'identifiers',\n [TranscendPullResource.Enrichers]: 'enrichers',\n [TranscendPullResource.DataSilos]: 'data-silos',\n [TranscendPullResource.Templates]: 'templates',\n [TranscendPullResource.Prompts]: 'prompts',\n [TranscendPullResource.PromptPartials]: 'prompt-partials',\n [TranscendPullResource.PromptGroups]: 'prompt-groups',\n [TranscendPullResource.Agents]: 'agents',\n [TranscendPullResource.AgentFunctions]: 'agent-functions',\n [TranscendPullResource.AgentFiles]: 'agent-files',\n [TranscendPullResource.Vendors]: 'vendors',\n [TranscendPullResource.DataCategories]: 'data-categories',\n [TranscendPullResource.ProcessingPurposes]: 'processing-purposes',\n [TranscendPullResource.ActionItems]: 'action-items',\n [TranscendPullResource.ActionItemCollections]: 'action-item-collections',\n [TranscendPullResource.Teams]: 'teams',\n [TranscendPullResource.Messages]: 'messages',\n [TranscendPullResource.PrivacyCenters]: 'privacy-center',\n [TranscendPullResource.Policies]: 'policies',\n [TranscendPullResource.Assessments]: 'assessments',\n [TranscendPullResource.AssessmentTemplates]: 'assessment-templates',\n [TranscendPullResource.Purposes]: 'purposes',\n};\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _typeutils = require('@transcend-io/type-utils');function o(s,...e){let n=JSON.parse(JSON.stringify(s));return e.forEach(a=>{_typeutils.getEntries.call(void 0, a).forEach(([r,t])=>{n[r]===void 0?n[r]=t:Array.isArray(t)?n[r]=[...n[r],...t]:n[r]=t})}),n}exports.a = o;
2
+ //# sourceMappingURL=chunk-IBTP5OXE.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/mergeTranscendInputs.ts"],"names":["mergeTranscendInputs","base","inputs","cloned","input","getEntries","key","value"],"mappings":"AACA,8HAA2B,SASXA,CAAAA,CACdC,CAAAA,CAAAA,GACGC,CAAAA,CACa,CAEhB,IAAMC,CAAAA,CAAc,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,SAAA,CAAUF,CAAI,CAAC,CAAA,CACnD,OAAAC,CAAAA,CAAO,OAAA,CAASE,CAAAA,EAAU,CAExBC,mCAAAA,CAAgB,CAAA,CAAE,OAAA,CAAQ,CAAC,CAACC,CAAAA,CAAKC,CAAK,CAAA,CAAA,EAAkB,CAClDJ,CAAAA,CAAOG,CAAG,CAAA,GAAM,KAAA,CAAA,CAClBH,CAAAA,CAAOG,CAAG,CAAA,CAAIC,CAAAA,CACL,KAAA,CAAM,OAAA,CAAQA,CAAK,CAAA,CAC5BJ,CAAAA,CAAOG,CAAG,CAAA,CAAI,CAAC,GAAGH,CAAAA,CAAOG,CAAG,CAAA,CAAG,GAAGC,CAAK,CAAA,CAEvCJ,CAAAA,CAAOG,CAAG,CAAA,CAAIC,CAElB,CAAC,CACH,CAAC,CAAA,CACMJ,CACT,CAAA,cAAA","file":"/Users/benbrook/transcend/cli/dist/chunk-IBTP5OXE.cjs","sourcesContent":["import { TranscendInput } from '../codecs';\nimport { getEntries } from '@transcend-io/type-utils';\n\n/**\n * Combine a set of TranscendInput yaml files into a single yaml\n *\n * @param base - Base input\n * @param inputs - The list of inputs\n * @returns Merged input\n */\nexport function mergeTranscendInputs(\n base: TranscendInput,\n ...inputs: TranscendInput[]\n): TranscendInput {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const cloned: any = JSON.parse(JSON.stringify(base));\n inputs.forEach((input) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getEntries(input).forEach(([key, value]: [any, any]) => {\n if (cloned[key] === undefined) {\n cloned[key] = value;\n } else if (Array.isArray(value)) {\n cloned[key] = [...cloned[key], ...value];\n } else {\n cloned[key] = value;\n }\n });\n });\n return cloned;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkUEGX6GZ2cjs = require('./chunk-UEGX6GZ2.cjs');var _typeutils = require('@transcend-io/type-utils');var _jsyaml = require('js-yaml'); var _jsyaml2 = _interopRequireDefault(_jsyaml);var _fs = require('fs');var s=/<<parameters\.(.+?)>>/,i= exports.b ="parameters";function u(e,t,a=""){let r=e;if(Object.entries(t).forEach(([n,p])=>{r=r.split(`<<${i}.${n}>>`).join(p)}),s.test(r)){let[,n]=s.exec(r)||[];throw new Error(`Found variable that was not set: ${n}.
2
+ Make sure you are passing all parameters through the --${i}=${n}:value-for-param flag.
3
+ ${a}`)}return r}function b(e,t={}){let a=_fs.readFileSync.call(void 0, e,"utf-8"),r=u(a,t,`Also check that there are no extra variables defined in your yaml: ${e}`);return _typeutils.decodeCodec.call(void 0, _chunkUEGX6GZ2cjs.ea,_jsyaml2.default.load(r))}function h(e,t){_fs.writeFileSync.call(void 0, e,_jsyaml2.default.dump(_typeutils.decodeCodec.call(void 0, _chunkUEGX6GZ2cjs.ea,t)))}exports.a = s; exports.b = i; exports.c = u; exports.d = b; exports.e = h;
4
+ //# sourceMappingURL=chunk-KOV2SQO2.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/benbrook/transcend/cli/dist/chunk-KOV2SQO2.cjs","../src/lib/readTranscendYaml.ts"],"names":["VARIABLE_PARAMETERS_REGEXP","VARIABLE_PARAMETERS_NAME","replaceVariablesInYaml","input","variables","extraErrorMessage","contents","name","value"],"mappings":"AAAA,iOAAyC,qDCAA,iFACxB,wBAC2B,IAG/BA,CAAAA,CAA6B,uBAAA,CAC7BC,CAAAA,aAA2B,YAAA,CAWjC,SAASC,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CAAoB,EAAA,CACZ,CACR,IAAIC,CAAAA,CAAWH,CAAAA,CASf,EAAA,CAPA,MAAA,CAAO,OAAA,CAAQC,CAAS,CAAA,CAAE,OAAA,CAAQ,CAAC,CAACG,CAAAA,CAAMC,CAAK,CAAA,CAAA,EAAM,CACnDF,CAAAA,CAAWA,CAAAA,CACR,KAAA,CAAM,CAAA,EAAA,EAAKL,CAAwB,CAAA,CAAA,EAAIM,CAAI,CAAA,EAAA,CAAI,CAAA,CAC/C,IAAA,CAAKC,CAAK,CACf,CAAC,CAAA,CAGGR,CAAAA,CAA2B,IAAA,CAAKM,CAAQ,CAAA,CAAG,CAC7C,GAAM,CAAC,CAAEC,CAAI,CAAA,CAAIP,CAAAA,CAA2B,IAAA,CAAKM,CAAQ,CAAA,EAAK,CAAC,CAAA,CAC/D,MAAM,IAAI,KAAA,CACR,CAAA,iCAAA,EAAoCC,CAAI,CAAA;AAAA,uDAAA,EACWN,CAAwB,CAAA,CAAA,EAAIM,CAAI,CAAA;AAAA,EACvFF,CAAiB,CAAA,CAAA","file":"/Users/benbrook/transcend/cli/dist/chunk-KOV2SQO2.cjs","sourcesContent":[null,"import { decodeCodec, ObjByString } from '@transcend-io/type-utils';\nimport yaml from 'js-yaml';\nimport { readFileSync, writeFileSync } from 'fs';\nimport { TranscendInput } from '../codecs';\n\nexport const VARIABLE_PARAMETERS_REGEXP = /<<parameters\\.(.+?)>>/;\nexport const VARIABLE_PARAMETERS_NAME = 'parameters';\n\n/**\n * Function that replaces variables in a text file.\n * Throws error if there are variables that have not been replaced\n *\n * @param input - Input text\n * @param variables - Variables to replace\n * @param extraErrorMessage - Additional error message text\n * @returns Output text\n */\nexport function replaceVariablesInYaml(\n input: string,\n variables: ObjByString,\n extraErrorMessage = '',\n): string {\n let contents = input;\n // Replace variables\n Object.entries(variables).forEach(([name, value]) => {\n contents = contents\n .split(`<<${VARIABLE_PARAMETERS_NAME}.${name}>>`)\n .join(value);\n });\n\n // Throw error if unfilled variables\n if (VARIABLE_PARAMETERS_REGEXP.test(contents)) {\n const [, name] = VARIABLE_PARAMETERS_REGEXP.exec(contents) || [];\n throw new Error(\n `Found variable that was not set: ${name}.\nMake sure you are passing all parameters through the --${VARIABLE_PARAMETERS_NAME}=${name}:value-for-param flag.\n${extraErrorMessage}`,\n );\n }\n\n return contents;\n}\n\n/**\n * Read in the contents of a yaml file and validate that the shape\n * of the yaml file matches the codec API\n *\n * @param filePath - Path to yaml file\n * @param variables - Variables to fill in\n * @returns The contents of the yaml file, type-checked\n */\nexport function readTranscendYaml(\n filePath: string,\n variables: ObjByString = {},\n): TranscendInput {\n // Read in contents\n const fileContents = readFileSync(filePath, 'utf-8');\n\n // Replace variables\n const replacedVariables = replaceVariablesInYaml(\n fileContents,\n variables,\n `Also check that there are no extra variables defined in your yaml: ${filePath}`,\n );\n\n // Validate shape\n return decodeCodec(TranscendInput, yaml.load(replacedVariables));\n}\n\n/**\n * Write a Transcend configuration to disk\n *\n * @param filePath - Path to yaml file\n * @param input - The input to write out\n */\nexport function writeTranscendYaml(\n filePath: string,\n input: TranscendInput,\n): void {\n writeFileSync(filePath, yaml.dump(decodeCodec(TranscendInput, input)));\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 }; } 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 _chunkSJFPYDA3cjs = require('./chunk-SJFPYDA3.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkEG4L6YAJcjs = require('./chunk-EG4L6YAJ.cjs');var _typeutils = require('@transcend-io/type-utils');var _internationalization = require('@transcend-io/internationalization');var _privacytypes = require('@transcend-io/privacy-types');var _iots = require('io-ts'); var R = _interopRequireWildcard(_iots); var re = _interopRequireWildcard(_iots); var lt = _interopRequireWildcard(_iots); var D = _interopRequireWildcard(_iots); var q = _interopRequireWildcard(_iots); var I = _interopRequireWildcard(_iots); var de = _interopRequireWildcard(_iots); var Ft = _interopRequireWildcard(_iots); var M = _interopRequireWildcard(_iots);var A="[NONE]",pe= exports.b ="[APPLY VALUE TO ALL ROWS]",De= exports.c ="<blank>",be= exports.d =["email","coreIdentifier"],ne= exports.e =(c=>(c.Email="email",c.CoreIdentifier="coreIdentifier",c.RequestType="requestType",c.SubjectType="subjectType",c.Locale="locale",c.Country="country",c.CountrySubDivision="countrySubDivision",c.RequestStatus="requestStatus",c.CreatedAt="createdAt",c.DataSiloIds="dataSiloIds",c))(ne||{}),et= exports.f ={email:!1,coreIdentifier:!0,requestType:!0,subjectType:!0,requestStatus:!1,createdAt:!1,dataSiloIds:!1,locale:!1,country:!1,countrySubDivision:!1},tt= exports.g ={requestType:!0,subjectType:!0},rt= exports.h =R.type({columnNames:R.partial(_typeutils.applyEnum.call(void 0, ne,()=>R.string)),identifierNames:R.record(R.string,R.string),attributeNames:R.record(R.string,R.string),requestTypeToRequestAction:R.record(R.string,_typeutils.valuesOf.call(void 0, _privacytypes.RequestAction)),subjectTypeToSubjectName:R.record(R.string,R.string),languageToLocale:R.record(R.string,_typeutils.valuesOf.call(void 0, _internationalization.LanguageKey)),regionToCountry:R.record(R.string,_typeutils.valuesOf.call(void 0, {..._privacytypes.IsoCountryCode,[A]:A})),regionToCountrySubDivision:R.record(R.string,_typeutils.valuesOf.call(void 0, {..._privacytypes.IsoCountrySubdivisionCode,[A]:A})),statusToRequestStatus:R.record(R.string,_typeutils.valuesOf.call(void 0, {..._privacytypes.CompletedRequestStatus,[A]:A}))}),Te= exports.i =R.type({id:R.string,link:R.string,rowIndex:R.number,coreIdentifier:R.string,attemptedAt:R.string}),st= exports.j =R.type({failingRequests:R.array(R.record(R.string,R.any)),successfulRequests:R.array(Te),duplicateRequests:R.array(R.type({rowIndex:R.number,coreIdentifier:R.string,attemptedAt:R.string}))});var _inquirer = require('inquirer'); var _inquirer2 = _interopRequireDefault(_inquirer);var _fuzzysearch = require('fuzzysearch'); var _fuzzysearch2 = _interopRequireDefault(_fuzzysearch);function Ae(n,e){return _fuzzysearch2.default.call(void 0, n.toLowerCase(),e.toLowerCase())||_fuzzysearch2.default.call(void 0, e.toLowerCase(),n.toLowerCase())}function ae(n,e,s,l){let a=n.filter(o=>Ae(e.toLowerCase(),o.toLowerCase()));return[...a,new _inquirer2.default.Separator,...s?[]:[A],...l?[pe]:[],...n.filter(o=>!a.includes(o))]}var _inquirerautocompleteprompt = require('inquirer-autocomplete-prompt'); var _inquirerautocompleteprompt2 = _interopRequireDefault(_inquirerautocompleteprompt);async function te(n,e,s){_inquirer2.default.registerPrompt("autocomplete",_inquirerautocompleteprompt2.default);let l=n.map(o=>o||"<blank>").filter(o=>!s[o]);if(l.length===0)return s;let a=await _inquirer2.default.prompt(l.map(o=>({name:o,message:`Map value of: ${o}`,type:"autocomplete",default:e.find(i=>Ae(o,i)),source:(i,r)=>r?e.filter(t=>typeof t=="string"&&Ae(r,t)):e})));return{...s,..._typeutils.apply.call(void 0, a,o=>typeof o=="string"?o:Object.values(o)[0])}}function Ee(n){return n.split(",").map(e=>e.trim()).filter(e=>e)}var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var at=re.type({key:re.string,values:re.array(re.string)});function ut(n){let e=n.map(s=>{let[l,a]=s.trim().split(":");if(!a)throw new Error("Expected attributes in key:value1;value2,key2:value3;value4");let o=a.split(";");return{key:l,values:o}});return _chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Attributes to apply to all requests:")),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(JSON.stringify(e,null,2))),e}var _sync = require('csv-parse/sync');var _fs = require('fs');function ct(n,e,s={columns:!0}){let l=_sync.parse.call(void 0, _fs.readFileSync.call(void 0, n,"utf-8"),s);return _typeutils.decodeCodec.call(void 0, lt.array(e),l).map(i=>Object.entries(i).reduce((r,[t,y])=>Object.assign(r,{[t.replace(/[^a-z_.+\-A-Z -~]/g,"")]:y}),{}))}function G(n,e){return _chunkSJFPYDA3cjs.fc.call(void 0, n.map(s=>s[e]||"").flat())}async function pt(n){let e=_chunkSJFPYDA3cjs.fc.call(void 0, n.map(a=>Object.keys(a)).flat()),s=n,l=!0;for(;l;){let{filterColumnName:a}=await _inquirer2.default.prompt([{name:"filterColumnName",message:`If you need to filter the list of requests to import, choose the column to filter on. Currently ${s.length} rows.`,type:"list",default:e,choices:[A,...e]}]);if(l=A!==a,l){let o=G(s,a),{valuesToKeep:i}=await _inquirer2.default.prompt([{name:"valuesToKeep",message:"Keep rows matching this value",type:"checkbox",default:e,choices:o}]);s=s.filter(r=>i.includes(r[a]))}}return _chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Importing ${s.length} requests`)),s}var _cliprogress = require('cli-progress'); var _cliprogress2 = _interopRequireDefault(_cliprogress);async function Us({requestActions:n,auth:e,requestIds:s,statuses:l=[_privacytypes.RequestStatus.Compiling,_privacytypes.RequestStatus.RequestMade,_privacytypes.RequestStatus.Delayed,_privacytypes.RequestStatus.Approving,_privacytypes.RequestStatus.Secondary,_privacytypes.RequestStatus.Enriching,_privacytypes.RequestStatus.Waiting,_privacytypes.RequestStatus.SecondaryApproving],createdAtAfter:a,createdAtBefore:o,concurrency:i=100,transcendUrl:r=_chunkEG4L6YAJcjs.e}){let t=_chunkSJFPYDA3cjs.xe.call(void 0, r,e),y=new Date().getTime(),c=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),g=await _chunkSJFPYDA3cjs.Ge.call(void 0, t,{actions:n,statuses:l,createdAtBefore:o,createdAtAfter:a,isSilent:!1,requestIds:s});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Marking "${g.length}" as silent mode.`));let m=0;c.start(g.length,0),await _chunkSJFPYDA3cjs.b.call(void 0, g,async f=>{await _chunkSJFPYDA3cjs.gc.call(void 0, t,_chunkSJFPYDA3cjs._,{input:{id:f.id,isSilent:!0}}),m+=1,c.update(m)},{concurrency:i}),c.stop();let p=new Date().getTime()-y;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully marked ${m} requests as silent mode in "${p/1e3}" seconds!`)),g.length}async function gt(n,e){let s=_typeutils.getValues.call(void 0, ne).filter(a=>!e.getValue("columnNames",a)),l=s.length===0?{}:await _inquirer2.default.prompt(s.map(a=>{let o=_chunkSJFPYDA3cjs.dc.call(void 0, a.replace("ColumnName","")),i=ae(n,o,et[a],!!tt[a]);return{name:a,message:`Choose the column that will be used to map in the field: ${o}`,type:"list",default:i[0],choices:i}}));return await Promise.all(_typeutils.getEntries.call(void 0, l).map(([a,o])=>e.setValue(o,"columnNames",a))),l}async function yt(n,e,{state:s,columnNameMap:l}){let a=f=>s.getValue("columnNames",f)||l[f],{internalSubjects:o}=await _chunkSJFPYDA3cjs.gc.call(void 0, n,_chunkSJFPYDA3cjs.y);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Determining mapping of columns for request action"));let i=await te(G(e,a("requestType")),Object.values(_privacytypes.RequestAction),s.getValue("requestTypeToRequestAction"));await s.setValue(i,"requestTypeToRequestAction"),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Determining mapping of columns for subject"));let r=await te(G(e,a("subjectType")),o.map(({type:f})=>f),s.getValue("subjectTypeToSubjectName"));await s.setValue(r,"subjectTypeToSubjectName"),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Determining mapping of columns for locale"));let t=await te(G(e,a("locale")),Object.values(_internationalization.LanguageKey),s.getValue("languageToLocale"));await s.setValue(t,"languageToLocale"),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Determining mapping of columns for request status")),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Determining mapping of columns for request status"));let y=a("requestStatus"),c=y===A?{}:await te(G(e,y),[...Object.values(_privacytypes.CompletedRequestStatus),A],s.getValue("statusToRequestStatus"));await s.setValue(c,"statusToRequestStatus"),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Determining mapping of columns for country"));let g=a("country"),m=g===A?{}:await te(G(e,g),[...Object.values(_privacytypes.IsoCountryCode),A],s.getValue("regionToCountry"));await s.setValue(m,"regionToCountry"),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Determining mapping of columns for country sub division"));let d=a("countrySubDivision"),p=d===A?{}:await te(G(e,d),[...Object.values(_privacytypes.IsoCountrySubdivisionCode),A],s.getValue("regionToCountrySubDivision"));await s.setValue(p,"regionToCountrySubDivision")}var _iotstypes = require('io-ts-types');var Pr=D.record(D.string,D.array(D.intersection([D.type({value:D.string}),D.partial({name:D.string})]))),ho= exports.x =D.intersection([D.type({email:D.string,attestedExtraIdentifiers:Pr,coreIdentifier:D.string,requestType:_typeutils.valuesOf.call(void 0, _privacytypes.RequestAction),subjectType:D.string}),D.partial({country:_typeutils.valuesOf.call(void 0, _privacytypes.IsoCountryCode),countrySubDivision:_typeutils.valuesOf.call(void 0, _privacytypes.IsoCountrySubdivisionCode),attributes:D.array(at),status:_typeutils.valuesOf.call(void 0, _privacytypes.CompletedRequestStatus),createdAt:_iotstypes.DateFromISOString,dataSiloIds:D.array(D.string),locale:_typeutils.valuesOf.call(void 0, _internationalization.LanguageKey)})]);function Dr(n,e,s){if(e===_privacytypes.IdentifierType.Email)return n.toLowerCase();if(e===_privacytypes.IdentifierType.Phone){let l=n.replace(_privacytypes.NORMALIZE_PHONE_NUMBER,"").replace(/[()]/g,"").replace(/[–]/g,"").replace(/[:]/g,"").replace(/[‭‬]/g,"").replace(/[A-Za-z]/g,"");return l?l.startsWith("+")?l:`+${s}${l}`:""}return n}function qt(n,e,{columnNameMap:s,identifierNameMap:l,attributeNameMap:a,requestAttributeKeys:o,defaultPhoneCountryCode:i="1"}){let r=t=>e.getValue("columnNames",t)||s[t];return n.map(t=>{let y={};Object.entries(l).filter(([,d])=>d!==A).forEach(([d,p])=>{let f=Object.values(_privacytypes.IdentifierType).includes(d)?d:_privacytypes.IdentifierType.Custom,h=t[p];if(h){let S=Dr(h,f,i);S&&(y[f]||(y[f]=[]),y[f].push({value:S,name:d}))}});let c=[];Object.entries(a).filter(([,d])=>d!==A).forEach(([d,p])=>{let f=t[p];if(f){let h=_optionalChain([o, 'access', _2 => _2.find, 'call', _3 => _3(S=>S.name===d), 'optionalAccess', _4 => _4.type])==="MULTI_SELECT";c.push({values:h?Ee(f):f,key:d})}});let g=r("requestType"),m=r("subjectType");return[t,{email:t[r("email")],attestedExtraIdentifiers:y,attributes:c,coreIdentifier:t[r("coreIdentifier")],requestType:g===pe?e.getValue("requestTypeToRequestAction",De):e.getValue("requestTypeToRequestAction",t[g]),subjectType:m===pe?e.getValue("subjectTypeToSubjectName",De):e.getValue("subjectTypeToSubjectName",t[m]),...r("locale")!==A&&t[r("locale")]?{locale:e.getValue("languageToLocale",t[r("locale")])}:{},...r("country")!==A&&t[r("country")]?{country:e.getValue("regionToCountry",t[r("country")])}:{},...r("countrySubDivision")!==A&&t[r("countrySubDivision")]?{countrySubDivision:e.getValue("regionToCountrySubDivision",t[r("countrySubDivision")])}:{},...r("requestStatus")!==A&&e.getValue("statusToRequestStatus",t[r("requestStatus")])!==A&&t[r("requestStatus")]?{status:e.getValue("statusToRequestStatus",t[r("requestStatus")])}:{},...r("createdAt")!==A&&t[r("createdAt")]?{createdAt:new Date(t[r("createdAt")])}:{},...r("dataSiloIds")!==A&&t[r("dataSiloIds")]?{dataSiloIds:Ee(t[r("dataSiloIds")])}:{}}]})}var St=q.type({defaultMessage:q.string,id:q.string}),xr= exports.B =q.type({downloadKey:q.string,error:q.union([q.null,q.string]),mimetype:q.string,size:q.string,fileName:q.string,dataPoint:q.type({id:q.string,title:q.union([St,q.null]),description:q.union([St,q.null]),name:q.string,slug:q.string,encryption:q.union([_typeutils.valuesOf.call(void 0, _privacytypes.TableEncryptionType),q.null]),dataSilo:q.type({id:q.string,title:q.string,description:q.string,type:q.string,outerType:q.union([q.string,q.null])}),path:q.array(q.string)})}),Lr= exports.C =q.type({nodes:q.array(xr),totalCount:q.number,_links:q.partial({next:q.union([q.string,q.null]),previous:q.union([q.string,q.null])})});async function bt(n,{sombra:e,concurrency:s=5,limit:l=100}){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Pulling file metadata for ${n.length} requests`));let a=new Date().getTime(),o=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),i=0;o.start(n.length,0);let r=await _chunkSJFPYDA3cjs.b.call(void 0, n,async c=>{let g=[],m=!0,d=0;for(;m;){let p;try{let f=await e.get(`v1/data-subject-request/${c.id}/download-keys`,{searchParams:{limit:l,offset:d}}).json();p=_typeutils.decodeCodec.call(void 0, Lr,f),g.push(...p.nodes),d+=l,m=!!p._links.next&&p.nodes.length===l}catch(f){throw new Error(`Received an error from server: ${_optionalChain([f, 'optionalAccess', _5 => _5.response, 'optionalAccess', _6 => _6.body])||_optionalChain([f, 'optionalAccess', _7 => _7.message])}`)}}return i+=1,o.update(i),[c,g]},{concurrency:s});o.stop();let y=new Date().getTime()-a;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully downloaded file metadata ${n.length} requests in "${y/1e3}" seconds!`)),r}async function Tt(n,{requestId:e,sombra:s,onFileDownloaded:l,concurrency:a=20}){await _chunkSJFPYDA3cjs.b.call(void 0, n,async o=>{try{await s.get("v1/files",{searchParams:{downloadKey:o.downloadKey}}).buffer().then(i=>l(o,i))}catch(i){if(_optionalChain([i, 'optionalAccess', _8 => _8.response, 'optionalAccess', _9 => _9.body, 'optionalAccess', _10 => _10.includes, 'call', _11 => _11("fileMetadata#verify")])){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to pull file for: ${o.fileName} (request:${e}) - JWT expired. This likely means that the file is no longer available. Try restarting the request from scratch in Transcend Admin Dashboard. Skipping the download of this file.`));return}throw new Error(`Received an error from server: ${_optionalChain([i, 'optionalAccess', _12 => _12.response, 'optionalAccess', _13 => _13.body])||_optionalChain([i, 'optionalAccess', _14 => _14.message])}`)}},{concurrency:a})}var _path = require('path');async function Uo({auth:n,folderPath:e,requestIds:s,createdAtBefore:l,sombraAuth:a,createdAtAfter:o,statuses:i=[_privacytypes.RequestStatus.Approving,_privacytypes.RequestStatus.Downloadable],concurrency:r=5,transcendUrl:t=_chunkEG4L6YAJcjs.e,approveAfterDownload:y=!1}){let c=_chunkSJFPYDA3cjs.xe.call(void 0, t,n),g=await _chunkSJFPYDA3cjs.ye.call(void 0, t,n,a);_fs.existsSync.call(void 0, e)||_fs.mkdirSync.call(void 0, e);let m=await _chunkSJFPYDA3cjs.Ge.call(void 0, c,{actions:[_privacytypes.RequestAction.Access],createdAtBefore:l,createdAtAfter:o,statuses:i,requestIds:s}),d=await bt(m,{sombra:g,concurrency:r}),p=new Date().getTime(),f=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),h=0,S=0;f.start(m.length,0),await _chunkSJFPYDA3cjs.b.call(void 0, d,async([v,x])=>{let K=_path.join.call(void 0, e,v.id);_fs.existsSync.call(void 0, K)||_fs.mkdirSync.call(void 0, K),await Tt(x,{sombra:g,requestId:v.id,onFileDownloaded:($,_)=>{let z=_path.join.call(void 0, K,$.fileName),j=_path.dirname.call(void 0, z);_fs.existsSync.call(void 0, j)||_fs.mkdirSync.call(void 0, j,{recursive:!0}),_fs.writeFileSync.call(void 0, z,_)}}),y&&v.status===_privacytypes.RequestStatus.Approving&&(await _chunkSJFPYDA3cjs.gc.call(void 0, c,_chunkSJFPYDA3cjs.Y,{input:{requestId:v.id}}),S+=1),h+=1,f.update(h)},{concurrency:r}),f.stop();let T=new Date().getTime()-p;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully downloaded ${h} requests in "${T/1e3}" seconds!`)),S>0&&_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Approved ${S} requests in Transcend.`)),m.length}var Le=I.type({id:I.string,link:I.string,status:_typeutils.valuesOf.call(void 0, _privacytypes.RequestStatus),type:_typeutils.valuesOf.call(void 0, _privacytypes.RequestAction),subjectType:I.string,email:I.union([I.null,I.string]),coreIdentifier:I.string,isSilent:I.boolean,isTest:I.boolean,country:I.union([I.null,_typeutils.valuesOf.call(void 0, _privacytypes.IsoCountryCode)]),countrySubDivision:I.union([I.null,_typeutils.valuesOf.call(void 0, _privacytypes.IsoCountrySubdivisionCode)]),attributeValues:I.array(I.type({attributeKey:I.type({name:I.string}),name:I.string}))});async function It(n,e,{details:s="",isTest:l=!1,emailIsVerified:a=!0,skipSendingReceipt:o=!1,isSilent:i=!0,additionalAttributes:r=[]}={}){let t=[...r];(e.attributes||[]).forEach(g=>{let m=t.find(d=>d.key===g.key);m?(m.values.push(...g.values),m.values=_chunkSJFPYDA3cjs.fc.call(void 0, m.values)):t.push(g)});let y;try{y=await n.post("v1/data-subject-request",{json:{type:e.requestType,subject:{coreIdentifier:e.coreIdentifier,email:e.email,emailIsVerified:a,attestedExtraIdentifiers:e.attestedExtraIdentifiers},subjectType:e.subjectType,isSilent:i,isTest:l,skipSendingReceipt:o,...e.locale?{locale:e.locale}:{},details:s,attributes:t,...e.country||e.countrySubDivision?{region:{...e.country?{country:e.country}:e.countrySubDivision?{country:e.countrySubDivision.split("-")[0]}:{},...e.countrySubDivision?{countrySubDivision:e.countrySubDivision}:{}}}:{},...e.createdAt?{createdAt:e.createdAt}:{},...e.dataSiloIds?{dataSiloIds:e.dataSiloIds}:{},...e.status?{completedRequestStatus:e.status}:{}}}).json()}catch(g){throw new Error(`Received an error from server: ${_optionalChain([g, 'optionalAccess', _15 => _15.response, 'optionalAccess', _16 => _16.body])||_optionalChain([g, 'optionalAccess', _17 => _17.message])}`)}let{request:c}=_typeutils.decodeCodec.call(void 0, I.type({request:Le}),y);return c}async function oi({requestActions:n,requestOrigins:e,auth:s,silentModeBefore:l,createdAtAfter:a,createdAtBefore:o,concurrency:i=50,transcendUrl:r=_chunkEG4L6YAJcjs.e}){let t=_chunkSJFPYDA3cjs.xe.call(void 0, r,s),y=new Date().getTime(),c=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),g=await _chunkSJFPYDA3cjs.Ge.call(void 0, t,{actions:n,statuses:[_privacytypes.RequestStatus.Approving],createdAtAfter:a,origins:e,createdAtBefore:o});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Approving "${g.length}" requests.`));let m=0,d=0;c.start(g.length,0),await _chunkSJFPYDA3cjs.b.call(void 0, g,async h=>{l&&new Date(l)>new Date(h.createdAt)&&await _chunkSJFPYDA3cjs.gc.call(void 0, t,_chunkSJFPYDA3cjs._,{input:{id:h.id,isSilent:!0}});try{await _chunkSJFPYDA3cjs.gc.call(void 0, t,_chunkSJFPYDA3cjs.Y,{input:{requestId:h.id}})}catch(S){S.message.includes("Request must be in an approving state,")&&(d+=1)}m+=1,c.update(m)},{concurrency:i}),c.stop();let f=new Date().getTime()-y;return d>0&&_chunkZUNVPK23cjs.a.info(_colors2.default.yellow(`${d} requests were skipped.`)),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully approved ${m} requests in "${f/1e3}" seconds!`)),g.length}async function fi({requestActions:n=Object.values(_privacytypes.RequestAction),auth:e,requestIds:s,createdAtBefore:l,days:a=45,daysLeft:o=10,createdAtAfter:i,emailTemplate:r="Additional Time Needed",concurrency:t=100,transcendUrl:y=_chunkEG4L6YAJcjs.e}){let c=_chunkSJFPYDA3cjs.xe.call(void 0, y,e),g=new Date().getTime(),m=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),p=(await _chunkSJFPYDA3cjs.ld.call(void 0, c,r)).find(T=>T.title===r);if(!p)throw new Error(`Failed to find a template with title: "${r}"`);let f=await _chunkSJFPYDA3cjs.Ge.call(void 0, c,{actions:n,createdAtBefore:l,createdAtAfter:i,isSilent:!1,isClosed:!1,requestIds:s});f=f.filter(T=>typeof T.daysRemaining=="number"&&T.daysRemaining<o),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Notifying "${f.length}" that more time is needed.`));let h=0;m.start(f.length,0),await _chunkSJFPYDA3cjs.b.call(void 0, f,async T=>{await _chunkSJFPYDA3cjs.gc.call(void 0, c,_chunkSJFPYDA3cjs.$,{input:{requestId:T.id,template:p.template.defaultMessage,subject:p.subject.defaultMessage,additionalTime:a}}),h+=1,m.update(h)},{concurrency:t}),m.stop();let N=new Date().getTime()-g;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully marked ${h} requests as silent mode in "${N/1e3}" seconds!`)),f.length}async function vt(n,e,s){let{initializer:l}=await _chunkSJFPYDA3cjs.gc.call(void 0, n,_chunkSJFPYDA3cjs.q),a=l.identifiers.filter(({name:i})=>!s.getValue("identifierNames",i)&&!be.includes(i)),o=a.length===0?{}:await _inquirer2.default.prompt(a.map(({name:i})=>{let r=ae(e,i,!1);return{name:i,message:`Choose the column that will be used to map in the identifier: ${i}`,type:"list",default:r[0],choices:r}}));return await Promise.all(Object.entries(o).map(([i,r])=>s.setValue(r,"identifierNames",i))),{...s.getValue("identifierNames"),...o}}async function Ni({requestActions:n,cancellationTitle:e,auth:s,requestIds:l,silentModeBefore:a,createdAtBefore:o,createdAtAfter:i,statuses:r=[_privacytypes.RequestStatus.Compiling,_privacytypes.RequestStatus.RequestMade,_privacytypes.RequestStatus.Delayed,_privacytypes.RequestStatus.Approving,_privacytypes.RequestStatus.Secondary,_privacytypes.RequestStatus.Enriching,_privacytypes.RequestStatus.Waiting,_privacytypes.RequestStatus.SecondaryApproving],concurrency:t=50,transcendUrl:y=_chunkEG4L6YAJcjs.e}){let c=_chunkSJFPYDA3cjs.xe.call(void 0, y,s),g=new Date().getTime(),m=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),d;if(e){let T=(await _chunkSJFPYDA3cjs.ld.call(void 0, c,e)).find(v=>v.title===e);if(!T)throw new Error(`Failed to find a template with title: "${e}"`);d=T}let p=await _chunkSJFPYDA3cjs.Ge.call(void 0, c,{actions:n,createdAtBefore:o,createdAtAfter:i,statuses:r,requestIds:l});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Canceling "${p.length}" requests${d?` Using template: ${d.title}`:""}.`));let f=0;m.start(p.length,0),await _chunkSJFPYDA3cjs.b.call(void 0, p,async N=>{a&&new Date(a)>new Date(N.createdAt)&&await _chunkSJFPYDA3cjs.gc.call(void 0, c,_chunkSJFPYDA3cjs._,{input:{id:N.id,isSilent:!0}}),await _chunkSJFPYDA3cjs.gc.call(void 0, c,_chunkSJFPYDA3cjs.Z,{input:{requestId:N.id,...d?{subject:`Re: ${d.subject.defaultMessage}`,template:d.template.defaultMessage}:{}}}),f+=1,m.update(f)},{concurrency:t}),m.stop();let S=new Date().getTime()-g;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully canceled ${f} requests in "${S/1e3}" seconds!`)),p.length}async function Lt(n,e,s,l){let a=l.filter(({name:i})=>!s.getValue("attributeNames",i)),o=a.length===0?{}:await _inquirer2.default.prompt(a.map(({name:i})=>{let r=ae(e,i,!1);return{name:i,message:`Choose the column that will be used to map in the attribute: ${i}`,type:"list",default:r[0],choices:r}}));return await Promise.all(Object.entries(o).map(([i,r])=>s.setValue(r,"attributeNames",i))),{...s.getValue("attributeNames"),...o}}var $t=/{\\"message\\":\\"(.+?)\\",/;function Ie(n){return $t.test(n)?$t.exec(n)[1]:null}var _persistedstate = require('@transcend-io/persisted-state');async function sn({cacheFilepath:n,requestReceiptFolder:e,file:s,auth:l,sombraAuth:a,concurrency:o=100,defaultPhoneCountryCode:i="1",transcendUrl:r=_chunkEG4L6YAJcjs.e,attributes:t=[],emailIsVerified:y=!0,skipFilterStep:c=!1,skipSendingReceipt:g=!0,isTest:m=!1,isSilent:d=!0,debug:p=!1,dryRun:f=!1}){let h=new Date().getTime(),S=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),N=ut(t),T=new (0, _persistedstate.PersistedState)(n,rt,{columnNames:{},requestTypeToRequestAction:{},subjectTypeToSubjectName:{},languageToLocale:{},statusToRequestStatus:{},identifierNames:{},attributeNames:{},regionToCountrySubDivision:{},regionToCountry:{}}),v=_path.join.call(void 0, e,`tr-request-upload-${new Date().toISOString()}-${s.split("/").pop()}`.replace(".csv",".json")),x=new (0, _persistedstate.PersistedState)(v,st,{successfulRequests:[],duplicateRequests:[],failingRequests:[]}),K=await _chunkSJFPYDA3cjs.ye.call(void 0, r,l,a),$=ct(s,de.record(de.string,de.string)),_=_chunkSJFPYDA3cjs.fc.call(void 0, $.map(U=>Object.keys(U)).flat());if($.length===0)throw new Error("No Requests found in list! Ensure the first row of the CSV is a header and the rest are requests.");if(p){let U=$[0];_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`First request: ${JSON.stringify(U,null,2)}`))}let z=c?$:await pt($),j=_chunkSJFPYDA3cjs.xe.call(void 0, r,l),L=await _chunkSJFPYDA3cjs.Ee.call(void 0, j),B=await gt(_,T),Y=await vt(j,_,T),k=await Lt(j,_,T,L);await yt(j,z,{state:T,columnNameMap:B});let O=qt(z,T,{defaultPhoneCountryCode:i,columnNameMap:B,identifierNameMap:Y,attributeNameMap:k,requestAttributeKeys:L});p||S.start(O.length,0);let X=0;await _chunkSJFPYDA3cjs.b.call(void 0, O,async([U,V],Q)=>{let _e=p?`email:${V.email} | coreIdentifier:${V.coreIdentifier}`:`row:${Q.toString()}`;if(p&&_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`[${Q+1}/${O.length}] Importing: ${JSON.stringify(V,null,2)}`)),f){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Bailing out on dry run because dryRun is set"));return}try{let ee=await It(K,V,{details:`Uploaded by Transcend Cli: "tr-request-upload" : ${JSON.stringify(U,null,2)}`,isTest:m,emailIsVerified:y,skipSendingReceipt:g,isSilent:d,additionalAttributes:N});p&&(_chunkZUNVPK23cjs.a.info(_colors2.default.green(`[${Q+1}/${O.length}] Successfully submitted the test data subject request: "${_e}"`)),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`[${Q+1}/${O.length}] View it at: "${ee.link}"`)));let oe=x.getValue("successfulRequests");oe.push({id:ee.id,link:ee.link,rowIndex:Q,coreIdentifier:ee.coreIdentifier,attemptedAt:new Date().toISOString()}),await x.setValue(oe,"successfulRequests")}catch(ee){let oe=`${ee.message} - ${JSON.stringify(_optionalChain([ee, 'access', _18 => _18.response, 'optionalAccess', _19 => _19.body]),null,2)}`,Pe=Ie(oe);if(Pe==="Client error: You have already made this request."){p&&_chunkZUNVPK23cjs.a.info(_colors2.default.yellow(`[${Q+1}/${O.length}] Skipping request as it is a duplicate`));let le=x.getValue("duplicateRequests");le.push({coreIdentifier:V.coreIdentifier,rowIndex:Q,attemptedAt:new Date().toISOString()}),await x.setValue(le,"duplicateRequests")}else{let le=x.getValue("failingRequests");le.push({...V,rowIndex:Q,error:Pe||oe,attemptedAt:new Date().toISOString()}),await x.setValue(le,"failingRequests"),p&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(Pe||oe)),_chunkZUNVPK23cjs.a.error(_colors2.default.red(`[${Q+1}/${O.length}] Failed to submit request for: "${_e}"`)))}}X+=1,p||S.update(X)},{concurrency:o}),S.stop();let ue=new Date().getTime()-h;_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Completed upload in "${ue/1e3}" seconds.`)),x.getValue("duplicateRequests").length>0&&_chunkZUNVPK23cjs.a.info(_colors2.default.yellow(`Encountered "${x.getValue("duplicateRequests").length}" duplicate requests. See "${v}" to review the core identifiers for these requests.`)),x.getValue("failingRequests").length>0&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Encountered "${x.getValue("failingRequests").length}" errors. See "${v}" to review the error messages and inputs.`)),process.exit(1))}async function _t(n,e,{sendEmailReceipt:s=!1,skipWaitingPeriod:l=!1,emailIsVerified:a=!0,requestIdentifiers:o=[]}={}){let i=await n.post("v1/data-subject-request",{json:{type:e.type,subject:{coreIdentifier:e.coreIdentifier,email:e.email,emailIsVerified:a,...o.length>0?{attestedExtraIdentifiers:_typeutils.apply.call(void 0, _chunkSJFPYDA3cjs.ac.call(void 0, o.filter(t=>!(t.name==="email"&&t.value===e.email)&&!be.includes(t.name)).map(t=>({...t,type:Object.values(_privacytypes.IdentifierType).includes(t.name)?t.name:_privacytypes.IdentifierType.Custom})),"type"),(t,y)=>t.map(({name:c,value:g})=>({...y===_privacytypes.IdentifierType.Custom?{name:c}:{},value:g})))}:{}},requestId:e.id,subjectType:e.subjectType,isSilent:e.isSilent,isTest:e.isTest,locale:e.locale,skipWaitingPeriod:l,createdAt:e.createdAt,details:`Restarted by Transcend cli: "tr-request-restart" - ${e.details}`,skipSendingReceipt:!s}}).json(),{request:r}=_typeutils.decodeCodec.call(void 0, Ft.type({request:Le}),i);return r}var Hr=M.intersection([Te,M.type({error:M.string})]),Xr=M.type({restartedRequests:M.array(Te),failingRequests:M.array(Hr)});async function wn({requestReceiptFolder:n,auth:e,sombraAuth:s,requestActions:l,requestStatuses:a,createdAtBefore:o,createdAtAfter:i,transcendUrl:r=_chunkEG4L6YAJcjs.e,requestIds:t=[],createdAt:y=new Date,silentModeBefore:c,sendEmailReceipt:g=!1,emailIsVerified:m=!0,copyIdentifiers:d=!1,skipWaitingPeriod:p=!1,concurrency:f=20}){let h=new Date().getTime(),S=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),N=_path.join.call(void 0, n,`tr-request-restart-${new Date().toISOString()}`),T=new (0, _persistedstate.PersistedState)(N,Xr,{restartedRequests:[],failingRequests:[]}),v=await _chunkSJFPYDA3cjs.ye.call(void 0, r,e,s),x=_chunkSJFPYDA3cjs.xe.call(void 0, r,e),$=(await _chunkSJFPYDA3cjs.Ge.call(void 0, x,{actions:l,statuses:a,createdAtBefore:o,createdAtAfter:i})).filter(L=>new Date(L.createdAt)<y);if(_chunkZUNVPK23cjs.a.info(`Found ${$.length} requests to process`),d&&_chunkZUNVPK23cjs.a.info("copyIdentifiers detected - All Identifiers will be copied."),g&&_chunkZUNVPK23cjs.a.info("sendEmailReceipt detected - Email receipts will be sent."),p&&_chunkZUNVPK23cjs.a.info("skipWaitingPeriod detected - Waiting period will be skipped."),t.length>0&&t.length!==$.length){let L=_chunkSJFPYDA3cjs.$b.call(void 0, t,$.map(({id:B})=>B));L.length>0&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to find the following requests by ID: ${L.join(",")}.`)),process.exit(1))}let _=0;S.start($.length,0),await _chunkSJFPYDA3cjs.b.call(void 0, $,async(L,B)=>{try{let Y=d?await _chunkSJFPYDA3cjs.Ie.call(void 0, x,v,{requestId:L.id}):[],k=await _t(v,{...L,isSilent:c&&new Date(L.createdAt)<c?!0:L.isSilent},{requestIdentifiers:Y,skipWaitingPeriod:p,sendEmailReceipt:g,emailIsVerified:m}),O=T.getValue("restartedRequests");O.push({id:k.id,link:k.link,rowIndex:B,coreIdentifier:k.coreIdentifier,attemptedAt:new Date().toISOString()}),await T.setValue(O,"restartedRequests")}catch(Y){let k=`${Y.message} - ${JSON.stringify(_optionalChain([Y, 'access', _20 => _20.response, 'optionalAccess', _21 => _21.body]),null,2)}`,O=Ie(k),X=T.getValue("failingRequests");X.push({id:L.id,link:L.link,rowIndex:B,coreIdentifier:L.coreIdentifier,attemptedAt:new Date().toISOString(),error:O||k}),await T.setValue(X,"failingRequests")}_+=1,S.update(_)},{concurrency:f}),S.stop();let j=new Date().getTime()-h;_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Completed restarting of requests in "${j/1e3}" seconds.`)),T.getValue("failingRequests").length>0&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Encountered "${T.getValue("failingRequests").length}" errors. See "${N}" to review the error messages and inputs.`)),process.exit(1))}async function Ln({enricherIds:n,auth:e,concurrency:s=100,transcendUrl:l=_chunkEG4L6YAJcjs.e}){let a=_chunkSJFPYDA3cjs.xe.call(void 0, l,e),o=new Date().getTime(),i=await _chunkSJFPYDA3cjs.Ge.call(void 0, a,{statuses:[_privacytypes.RequestStatus.Enriching]});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Processing enricher: "${n.join(",")}" fetched "${i.length}" in enriching status.`));let r=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),t=0;r.start(i.length,0);let y=0;await _chunkSJFPYDA3cjs.b.call(void 0, i,async m=>{let p=(await _chunkSJFPYDA3cjs.Je.call(void 0, a,{requestId:m.id})).filter(f=>n.includes(f.enricher.id)&&![_privacytypes.RequestEnricherStatus.Resolved,_privacytypes.RequestEnricherStatus.Skipped].includes(f.status));p.length>0&&await _chunkSJFPYDA3cjs.a.call(void 0, p,async f=>{try{await _chunkSJFPYDA3cjs.gc.call(void 0, a,_chunkSJFPYDA3cjs.ea,{requestEnricherId:f.id}),y+=1}catch(h){if(!h.message.includes("Client error: Cannot skip Request enricher because it has already completed"))throw h}}),t+=1,r.update(t)},{concurrency:s}),r.stop();let g=new Date().getTime()-o;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully skipped "${y}" for "${i.length}" requests in "${g/1e3}" seconds!`)),i.length}async function Qn({auth:n,requestActions:e=[],createdAtBefore:s,createdAtAfter:l,transcendUrl:a=_chunkEG4L6YAJcjs.e,requestEnricherStatuses:o=Object.values(_privacytypes.RequestEnricherStatus),requestIds:i=[],enricherId:r,concurrency:t=20}){let y=new Date().getTime(),c=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),g=_chunkSJFPYDA3cjs.xe.call(void 0, a,n);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Fetching requests to restart..."));let m=await _chunkSJFPYDA3cjs.Ge.call(void 0, g,{actions:e,statuses:[_privacytypes.RequestStatus.Enriching],createdAtBefore:s,createdAtAfter:l,requestIds:i}),d=0;if(i.length>0&&i.length!==m.length){let S=_chunkSJFPYDA3cjs.$b.call(void 0, i,m.map(({id:N})=>N));S.length>0&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to find the following requests by ID: ${S.join(",")}.`)),process.exit(1))}let p=0;c.start(m.length,0),await _chunkSJFPYDA3cjs.b.call(void 0, m,async S=>{let T=(await _chunkSJFPYDA3cjs.Je.call(void 0, g,{requestId:S.id})).filter(v=>v.enricher.id===r&&o.includes(v.status));await _chunkSJFPYDA3cjs.b.call(void 0, T,async v=>{await _chunkSJFPYDA3cjs.Ae.call(void 0, g,v.id),d+=1}),p+=1,c.update(p)},{concurrency:t}),c.stop();let h=new Date().getTime()-y;_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Completed restarting of ${m.length} requests and ${d} enrichers in "${h/1e3}" seconds.`))}async function ea({requestActions:n,dataSiloId:e,auth:s,concurrency:l=20,transcendUrl:a=_chunkEG4L6YAJcjs.e}){let o=_chunkSJFPYDA3cjs.xe.call(void 0, a,s),i=new Date().getTime(),r=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),t=await _chunkSJFPYDA3cjs.Ge.call(void 0, o,{actions:n,statuses:[_privacytypes.RequestStatus.Compiling,_privacytypes.RequestStatus.Approving]});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Retrying requests for Data Silo: "${e}", restarting "${t.length}" requests.`));let y=0,c=0;r.start(t.length,0),await _chunkSJFPYDA3cjs.b.call(void 0, t,async d=>{try{let p=await _chunkSJFPYDA3cjs.Le.call(void 0, o,{requestId:d.id,dataSiloId:e});await _chunkSJFPYDA3cjs.gc.call(void 0, o,_chunkSJFPYDA3cjs.xa,{requestDataSiloId:p.id})}catch(p){if(!p.message.includes("Failed to find RequestDataSilo"))throw p;c+=1}y+=1,r.update(y)},{concurrency:l}),r.stop();let m=new Date().getTime()-i;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully notified Transcend in "${m/1e3}" seconds for ${y} requests, ${c} requests were skipped because data silo was not attached to the request!`)),t.length}async function ca({auth:n,sombraAuth:e,actions:s=[],statuses:l=[],identifierSearch:a,pageLimit:o=100,transcendUrl:i=_chunkEG4L6YAJcjs.e,createdAtBefore:r,createdAtAfter:t,isTest:y}){let c=_chunkSJFPYDA3cjs.xe.call(void 0, i,n),g=await _chunkSJFPYDA3cjs.ye.call(void 0, i,n,e),m="";r&&(m+=` before ${r.toISOString()}`),t&&(m+=`${m?", and":""} after ${t.toISOString()}`),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`${s.length>0?`Pulling requests of type "${s.join('" , "')}"`:"Pulling all requests"}${m}`));let d=await _chunkSJFPYDA3cjs.Ge.call(void 0, c,{actions:s,text:a,statuses:l,createdAtBefore:r,createdAtAfter:t,isTest:y}),p=await _chunkSJFPYDA3cjs.b.call(void 0, d,async h=>{let S=await _chunkSJFPYDA3cjs.Ie.call(void 0, c,g,{requestId:h.id});return{...h,requestIdentifiers:S}},{concurrency:o});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Pulled ${p.length} requests`));let f=p.map(({attributeValues:h,requestIdentifiers:S,id:N,email:T,type:v,status:x,subjectType:K,details:$,createdAt:_,country:z,locale:j,origin:L,countrySubDivision:B,isSilent:Y,isTest:k,coreIdentifier:O,...X})=>({"Request ID":N,"Created At":_,Email:T,"Core Identifier":O,"Request Type":v,"Data Subject Type":K,Status:x,Country:z,"Country Sub Division":B,Details:$,Origin:L,"Silent Mode":Y,"Is Test Request":k,Language:j,...X,...Object.entries(_chunkSJFPYDA3cjs.ac.call(void 0, h,"attributeKey.name")).reduce((ge,[ue,U])=>Object.assign(ge,{[ue]:U.map(({name:V})=>V).join(",")}),{}),...Object.entries(_chunkSJFPYDA3cjs.ac.call(void 0, S,"name")).reduce((ge,[ue,U])=>Object.assign(ge,{[ue]:U.map(({value:V})=>V).join(",")}),{})}));return{requestsWithRequestIdentifiers:p,requestsFormattedForCsv:f}}async function ha({dataSiloId:n,auth:e,concurrency:s=100,status:l="SKIPPED",transcendUrl:a=_chunkEG4L6YAJcjs.e,requestStatuses:o=[_privacytypes.RequestStatus.Compiling,_privacytypes.RequestStatus.Secondary]}){let i=_chunkSJFPYDA3cjs.xe.call(void 0, a,e),r=new Date().getTime(),t=await _chunkSJFPYDA3cjs.Ke.call(void 0, i,{dataSiloId:n,requestStatuses:o});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Processing data silo: "${n}" marking "${t.length}" requests as skipped.`));let y=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),c=0;y.start(t.length,0),await _chunkSJFPYDA3cjs.b.call(void 0, t,async d=>{try{await _chunkSJFPYDA3cjs.gc.call(void 0, i,_chunkSJFPYDA3cjs.wa,{requestDataSiloId:d.id,status:l})}catch(p){if(!p.message.includes("Client error: Request must be active:"))throw p}c+=1,y.update(c)},{concurrency:s}),y.stop();let m=new Date().getTime()-r;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully skipped "${t.length}" requests in "${m/1e3}" seconds!`)),t.length}async function Ea({requestActions:n,identifierNames:e,auth:s,concurrency:l=20,transcendUrl:a=_chunkEG4L6YAJcjs.e}){let o=_chunkSJFPYDA3cjs.xe.call(void 0, a,s),i=new Date().getTime(),r=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),t=await _chunkSJFPYDA3cjs.Ge.call(void 0, o,{actions:n,statuses:[_privacytypes.RequestStatus.Enriching]});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Fetched requests in preflight/enriching state."));let y=0,c=0;r.start(t.length,0),await _chunkSJFPYDA3cjs.b.call(void 0, t,async d=>{let f=(await _chunkSJFPYDA3cjs.Ce.call(void 0, o,{requestId:d.id})).filter(({isVerifiedAtLeastOnce:h,name:S})=>h===!1&&e.includes(S)).map(({id:h})=>h);f.length>0&&(await _chunkSJFPYDA3cjs.gc.call(void 0, o,_chunkSJFPYDA3cjs.Ca,{input:{requestId:d.id,requestIdentifierIds:f}}),c+=f.length),y+=1,r.update(y)},{concurrency:l}),r.stop();let m=new Date().getTime()-i;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully cleared out unverified identifiers "${m/1e3}" seconds for ${y} requests, ${c} identifiers were cleared out!`)),t.length}exports.a = A; exports.b = pe; exports.c = De; exports.d = be; exports.e = ne; exports.f = et; exports.g = tt; exports.h = rt; exports.i = Te; exports.j = st; exports.k = Ae; exports.l = ae; exports.m = te; exports.n = Ee; exports.o = at; exports.p = ut; exports.q = ct; exports.r = G; exports.s = pt; exports.t = Us; exports.u = gt; exports.v = yt; exports.w = Pr; exports.x = ho; exports.y = Dr; exports.z = qt; exports.A = St; exports.B = xr; exports.C = Lr; exports.D = bt; exports.E = Tt; exports.F = Uo; exports.G = Le; exports.H = It; exports.I = oi; exports.J = fi; exports.K = vt; exports.L = Ni; exports.M = Lt; exports.N = Ie; exports.O = sn; exports.P = _t; exports.Q = wn; exports.R = Ln; exports.S = Qn; exports.T = ea; exports.U = ca; exports.V = ha; exports.W = Ea;
2
+ //# sourceMappingURL=chunk-KR377AJU.cjs.map