@transcend-io/cli 8.31.1 → 8.32.4

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 (152) hide show
  1. package/README.md +121 -0
  2. package/dist/bin/bash-complete.cjs +1 -1
  3. package/dist/bin/cli.cjs +1 -1
  4. package/dist/bin/deprecated-command.cjs +2 -2
  5. package/dist/{chunk-M7OVJJGB.cjs → chunk-22KX2NM4.cjs} +4 -4
  6. package/dist/{chunk-M7OVJJGB.cjs.map → chunk-22KX2NM4.cjs.map} +1 -1
  7. package/dist/chunk-56QKBG2R.cjs +3001 -0
  8. package/dist/chunk-56QKBG2R.cjs.map +1 -0
  9. package/dist/chunk-6TKTYQIF.cjs +3 -0
  10. package/dist/chunk-6TKTYQIF.cjs.map +1 -0
  11. package/dist/{chunk-DIB7IOEX.cjs → chunk-BPOXNSPY.cjs} +2 -2
  12. package/dist/{chunk-DIB7IOEX.cjs.map → chunk-BPOXNSPY.cjs.map} +1 -1
  13. package/dist/chunk-CM7VJEOY.cjs +4 -0
  14. package/dist/{chunk-SKOTYI3A.cjs.map → chunk-CM7VJEOY.cjs.map} +1 -1
  15. package/dist/chunk-D3VRD5F5.cjs +2 -0
  16. package/dist/chunk-D3VRD5F5.cjs.map +1 -0
  17. package/dist/{chunk-XXFLFF7Q.cjs → chunk-DQCPGPXG.cjs} +2 -2
  18. package/dist/{chunk-XXFLFF7Q.cjs.map → chunk-DQCPGPXG.cjs.map} +1 -1
  19. package/dist/{chunk-MXT7N555.cjs → chunk-DYBVUGHH.cjs} +22 -22
  20. package/dist/chunk-DYBVUGHH.cjs.map +1 -0
  21. package/dist/chunk-IHUCIK5T.cjs +2 -0
  22. package/dist/{chunk-Q2RJZGYW.cjs.map → chunk-IHUCIK5T.cjs.map} +1 -1
  23. package/dist/{chunk-7H4ALAHC.cjs → chunk-LQUVB4MI.cjs} +4 -4
  24. package/dist/chunk-LQUVB4MI.cjs.map +1 -0
  25. package/dist/chunk-P5GD5LAK.cjs +2 -0
  26. package/dist/chunk-P5GD5LAK.cjs.map +1 -0
  27. package/dist/chunk-PGO2YKRX.cjs +12 -0
  28. package/dist/chunk-PGO2YKRX.cjs.map +1 -0
  29. package/dist/{chunk-ALOB5SWZ.cjs → chunk-VCPZG4FJ.cjs} +2 -2
  30. package/dist/{chunk-ALOB5SWZ.cjs.map → chunk-VCPZG4FJ.cjs.map} +1 -1
  31. package/dist/chunk-VUQAH7YK.cjs +12 -0
  32. package/dist/chunk-VUQAH7YK.cjs.map +1 -0
  33. package/dist/{impl-VXOHC45F.cjs → impl-2JA6BPE7.cjs} +2 -2
  34. package/dist/{impl-VXOHC45F.cjs.map → impl-2JA6BPE7.cjs.map} +1 -1
  35. package/dist/{impl-PKWSORXX.cjs → impl-4AI7T6RD.cjs} +2 -2
  36. package/dist/{impl-PKWSORXX.cjs.map → impl-4AI7T6RD.cjs.map} +1 -1
  37. package/dist/impl-4LAJNPQ4.cjs +16 -0
  38. package/dist/impl-4LAJNPQ4.cjs.map +1 -0
  39. package/dist/{impl-4CWCLU5Z.cjs → impl-4YFJOKCA.cjs} +2 -2
  40. package/dist/{impl-4CWCLU5Z.cjs.map → impl-4YFJOKCA.cjs.map} +1 -1
  41. package/dist/{impl-WMI46UXI.cjs → impl-5RX3NB6C.cjs} +2 -2
  42. package/dist/{impl-WMI46UXI.cjs.map → impl-5RX3NB6C.cjs.map} +1 -1
  43. package/dist/{impl-VUAC7AYF.cjs → impl-66CDS7IN.cjs} +2 -2
  44. package/dist/{impl-VUAC7AYF.cjs.map → impl-66CDS7IN.cjs.map} +1 -1
  45. package/dist/{impl-542SIWQ2.cjs → impl-ADPBEB3N.cjs} +2 -2
  46. package/dist/{impl-542SIWQ2.cjs.map → impl-ADPBEB3N.cjs.map} +1 -1
  47. package/dist/{impl-REKQO7ZI.cjs → impl-B6DTQRYV.cjs} +2 -2
  48. package/dist/{impl-REKQO7ZI.cjs.map → impl-B6DTQRYV.cjs.map} +1 -1
  49. package/dist/impl-BHA2L6BP.cjs +2 -0
  50. package/dist/{impl-V3MXFXZF.cjs.map → impl-BHA2L6BP.cjs.map} +1 -1
  51. package/dist/impl-BLGX7DMN.cjs +6 -0
  52. package/dist/impl-BLGX7DMN.cjs.map +1 -0
  53. package/dist/{impl-XJBUIDZP.cjs → impl-DA7AASRR.cjs} +2 -2
  54. package/dist/{impl-XJBUIDZP.cjs.map → impl-DA7AASRR.cjs.map} +1 -1
  55. package/dist/{impl-OQAP7YDW.cjs → impl-EXHOBCQW.cjs} +2 -2
  56. package/dist/{impl-OQAP7YDW.cjs.map → impl-EXHOBCQW.cjs.map} +1 -1
  57. package/dist/{impl-D2HENZNO.cjs → impl-FRWZLZ2V.cjs} +2 -2
  58. package/dist/{impl-D2HENZNO.cjs.map → impl-FRWZLZ2V.cjs.map} +1 -1
  59. package/dist/impl-GA6T4SCB.cjs +2 -0
  60. package/dist/impl-GA6T4SCB.cjs.map +1 -0
  61. package/dist/{impl-RD5UOJY6.cjs → impl-GG3S2VBT.cjs} +2 -2
  62. package/dist/{impl-RD5UOJY6.cjs.map → impl-GG3S2VBT.cjs.map} +1 -1
  63. package/dist/impl-GZNNNSYW.cjs +7 -0
  64. package/dist/{impl-BQNXMBQ4.cjs.map → impl-GZNNNSYW.cjs.map} +1 -1
  65. package/dist/{impl-5VMEZB7F.cjs → impl-IOS3QLTX.cjs} +2 -2
  66. package/dist/{impl-5VMEZB7F.cjs.map → impl-IOS3QLTX.cjs.map} +1 -1
  67. package/dist/{impl-PHBUSAGS.cjs → impl-IQGUF37H.cjs} +2 -2
  68. package/dist/{impl-PHBUSAGS.cjs.map → impl-IQGUF37H.cjs.map} +1 -1
  69. package/dist/impl-IZIXOMMN.cjs +2 -0
  70. package/dist/impl-IZIXOMMN.cjs.map +1 -0
  71. package/dist/{impl-VT3C6SP4.cjs → impl-J5PWNHKL.cjs} +2 -2
  72. package/dist/{impl-VT3C6SP4.cjs.map → impl-J5PWNHKL.cjs.map} +1 -1
  73. package/dist/impl-JI6COVDW.cjs +2 -0
  74. package/dist/{impl-SRI65ZIC.cjs.map → impl-JI6COVDW.cjs.map} +1 -1
  75. package/dist/{impl-XLL66FXK.cjs → impl-JY7YM3QH.cjs} +2 -2
  76. package/dist/{impl-XLL66FXK.cjs.map → impl-JY7YM3QH.cjs.map} +1 -1
  77. package/dist/{impl-YGVW4RTA.cjs → impl-LKX6OLE2.cjs} +2 -2
  78. package/dist/{impl-YGVW4RTA.cjs.map → impl-LKX6OLE2.cjs.map} +1 -1
  79. package/dist/impl-MRC5UI22.cjs +2 -0
  80. package/dist/impl-MRC5UI22.cjs.map +1 -0
  81. package/dist/{impl-KQYINEBI.cjs → impl-NW57RBBR.cjs} +2 -2
  82. package/dist/{impl-KQYINEBI.cjs.map → impl-NW57RBBR.cjs.map} +1 -1
  83. package/dist/impl-QOCEM2K5.cjs +2 -0
  84. package/dist/{impl-JSXYZHX4.cjs.map → impl-QOCEM2K5.cjs.map} +1 -1
  85. package/dist/{impl-K2D3GTZG.cjs → impl-QPLTL2SO.cjs} +2 -2
  86. package/dist/{impl-K2D3GTZG.cjs.map → impl-QPLTL2SO.cjs.map} +1 -1
  87. package/dist/impl-R35FW4U7.cjs +9 -0
  88. package/dist/impl-R35FW4U7.cjs.map +1 -0
  89. package/dist/{impl-6ANYWCOV.cjs → impl-RMPDHVAH.cjs} +2 -2
  90. package/dist/{impl-6ANYWCOV.cjs.map → impl-RMPDHVAH.cjs.map} +1 -1
  91. package/dist/{impl-JQVCW52V.cjs → impl-S64WVKSC.cjs} +2 -2
  92. package/dist/{impl-JQVCW52V.cjs.map → impl-S64WVKSC.cjs.map} +1 -1
  93. package/dist/{impl-55GTRVMZ.cjs → impl-SE32ARTN.cjs} +2 -2
  94. package/dist/{impl-55GTRVMZ.cjs.map → impl-SE32ARTN.cjs.map} +1 -1
  95. package/dist/{impl-PWYKAVK4.cjs → impl-SSBP4ONX.cjs} +2 -2
  96. package/dist/{impl-PWYKAVK4.cjs.map → impl-SSBP4ONX.cjs.map} +1 -1
  97. package/dist/{impl-T67PUM7X.cjs → impl-UA7V6YEM.cjs} +2 -2
  98. package/dist/{impl-T67PUM7X.cjs.map → impl-UA7V6YEM.cjs.map} +1 -1
  99. package/dist/{impl-NK42TN4C.cjs → impl-WTGAAEUZ.cjs} +2 -2
  100. package/dist/{impl-NK42TN4C.cjs.map → impl-WTGAAEUZ.cjs.map} +1 -1
  101. package/dist/{impl-Q3P6DGHG.cjs → impl-WVOFYJLG.cjs} +2 -2
  102. package/dist/{impl-Q3P6DGHG.cjs.map → impl-WVOFYJLG.cjs.map} +1 -1
  103. package/dist/{impl-TCR3Y3J2.cjs → impl-X23VUODX.cjs} +2 -2
  104. package/dist/{impl-TCR3Y3J2.cjs.map → impl-X23VUODX.cjs.map} +1 -1
  105. package/dist/{impl-KRJNBGJ6.cjs → impl-XU54KM62.cjs} +2 -2
  106. package/dist/{impl-KRJNBGJ6.cjs.map → impl-XU54KM62.cjs.map} +1 -1
  107. package/dist/{impl-A7XL5O4W.cjs → impl-XYHIS7X5.cjs} +2 -2
  108. package/dist/{impl-A7XL5O4W.cjs.map → impl-XYHIS7X5.cjs.map} +1 -1
  109. package/dist/{impl-VL3CJ2OT.cjs → impl-Y3MY5EKD.cjs} +2 -2
  110. package/dist/{impl-VL3CJ2OT.cjs.map → impl-Y3MY5EKD.cjs.map} +1 -1
  111. package/dist/impl-YIPC6MAR.cjs +6 -0
  112. package/dist/impl-YIPC6MAR.cjs.map +1 -0
  113. package/dist/{impl-JFYHXSOV.cjs → impl-Z54SB7SM.cjs} +2 -2
  114. package/dist/{impl-JFYHXSOV.cjs.map → impl-Z54SB7SM.cjs.map} +1 -1
  115. package/dist/{impl-GEEPG7OH.cjs → impl-ZTEP5CYM.cjs} +2 -2
  116. package/dist/{impl-GEEPG7OH.cjs.map → impl-ZTEP5CYM.cjs.map} +1 -1
  117. package/dist/index.cjs +3 -3
  118. package/dist/index.cjs.map +1 -1
  119. package/dist/index.d.cts +1 -1
  120. package/package.json +2 -2
  121. package/dist/chunk-52MA7ZLS.cjs +0 -12
  122. package/dist/chunk-52MA7ZLS.cjs.map +0 -1
  123. package/dist/chunk-55B57ZAY.cjs +0 -3001
  124. package/dist/chunk-55B57ZAY.cjs.map +0 -1
  125. package/dist/chunk-7H4ALAHC.cjs.map +0 -1
  126. package/dist/chunk-G522ZIHS.cjs +0 -3
  127. package/dist/chunk-G522ZIHS.cjs.map +0 -1
  128. package/dist/chunk-HCEZRZHV.cjs +0 -12
  129. package/dist/chunk-HCEZRZHV.cjs.map +0 -1
  130. package/dist/chunk-M3Y6JH6I.cjs +0 -2
  131. package/dist/chunk-M3Y6JH6I.cjs.map +0 -1
  132. package/dist/chunk-MXT7N555.cjs.map +0 -1
  133. package/dist/chunk-NC6VWOMN.cjs +0 -2
  134. package/dist/chunk-NC6VWOMN.cjs.map +0 -1
  135. package/dist/chunk-Q2RJZGYW.cjs +0 -2
  136. package/dist/chunk-SKOTYI3A.cjs +0 -4
  137. package/dist/impl-BQNXMBQ4.cjs +0 -7
  138. package/dist/impl-CFYRFABZ.cjs +0 -9
  139. package/dist/impl-CFYRFABZ.cjs.map +0 -1
  140. package/dist/impl-JSXYZHX4.cjs +0 -2
  141. package/dist/impl-RI3WQFOE.cjs +0 -6
  142. package/dist/impl-RI3WQFOE.cjs.map +0 -1
  143. package/dist/impl-SRI65ZIC.cjs +0 -2
  144. package/dist/impl-U46BMUFL.cjs +0 -2
  145. package/dist/impl-U46BMUFL.cjs.map +0 -1
  146. package/dist/impl-UVQJ7HSK.cjs +0 -6
  147. package/dist/impl-UVQJ7HSK.cjs.map +0 -1
  148. package/dist/impl-V3MXFXZF.cjs +0 -2
  149. package/dist/impl-ZAKPYQ32.cjs +0 -2
  150. package/dist/impl-ZAKPYQ32.cjs.map +0 -1
  151. package/dist/impl-ZTYQ3IB5.cjs +0 -2
  152. package/dist/impl-ZTYQ3IB5.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-V3MXFXZF.cjs","../src/commands/admin/chunk-csv/impl.ts","../src/lib/helpers/collectCsvFilesOrExit.ts"],"names":["collectCsvFilesOrExit","directory","localContext","logger","colors","files","readdirSync","f","join","p","statSync","err"],"mappings":"AAAA,u/BAAkF,wDAAyC,wDAA0C,gCAA6B,wDAAyC,gCAA6B,gCAA6B,gFCClR,4BCDE,wBACiB,SAatBA,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACU,CACLD,CAAAA,EAAAA,CACHE,mBAAAA,CAAO,KAAA,CAAMC,gBAAAA,CAAO,GAAA,CAAI,iCAAiC,CAAC,CAAA,CAC1DF,CAAAA,CAAa,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,CAAA,CAG7B,IAAIG,CAAAA,CAAkB,CAAC,CAAA,CACvB,GAAI,CAEFA,CAAAA,CADgBC,6BAAAA,CAAqB,CAAA,CAElC,MAAA,CAAQC,CAAAA,EAAMA,CAAAA,CAAE,QAAA,CAAS,MAAM,CAAC,CAAA,CAChC,GAAA,CAAKA,CAAAA,EAAMC,wBAAAA,CAAKP,CAAWM,CAAC,CAAC,CAAA,CAC7B,MAAA,CAAQE,CAAAA,EAAM,CACb,GAAI,CACF,OAAOC,0BAAAA,CAAU,CAAA,CAAE,MAAA,CAAO,CAC5B,CAAA,UAAQ,CACN,MAAO,CAAA,CACT,CACF,CAAC,CACL,CAAA,KAAA,CAASC,CAAAA,CAAK,CACZR,mBAAAA,CAAO,KAAA,CAAMC,gBAAAA,CAAO,GAAA,CAAI,CAAA,0BAAA,EAA6BH,CAAS,CAAA,CAAA","file":"/home/runner/work/cli/cli/dist/impl-V3MXFXZF.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport colors from 'colors';\nimport { logger } from '../../../logger';\nimport { collectCsvFilesOrExit } from '../../../lib/helpers/collectCsvFilesOrExit';\nimport {\n computePoolSize,\n createExtraKeyHandler,\n CHILD_FLAG,\n type PoolHooks,\n runPool,\n dashboardPlugin,\n} from '../../../lib/pooling';\nimport {\n runChild,\n type ChunkProgress,\n type ChunkResult,\n type ChunkTask,\n} from './worker';\nimport { chunkCsvPlugin } from './ui';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\n/**\n * Returns the current module's path so the worker pool knows what file to re-exec.\n * In Node ESM, __filename is undefined, so we fall back to argv[1].\n *\n * @returns The current module's path as a string\n */\nfunction getCurrentModulePath(): string {\n if (typeof __filename !== 'undefined') {\n return __filename as unknown as string;\n }\n return process.argv[1];\n}\n\n/**\n * Totals aggregate for this command.\n * We don’t need custom counters since the runner already tracks\n * completed/failed counts in its header — so we just use an empty record.\n */\ntype Totals = Record<string, never>;\n\n/**\n * CLI flags accepted by the `chunk-csv` command.\n *\n * These are passed down from the CLI parser into the parent process.\n */\nexport type ChunkCsvCommandFlags = {\n directory: string;\n outputDir?: string;\n clearOutputDir: boolean;\n chunkSizeMB: number;\n concurrency?: number;\n viewerMode: boolean;\n};\n\n/**\n * Parent entrypoint for chunking many CSVs in parallel using the worker pool runner.\n *\n * Lifecycle:\n * 1) Discover CSV inputs (exit if none).\n * 2) Compute pool size (CPU-count heuristic or --concurrency).\n * 3) Build a FIFO queue of `ChunkTask`s.\n * 4) Define pool hooks to drive task assignment, progress, and result handling.\n * 5) Launch the pool with `runPool`, rendering via the `chunkCsvPlugin`.\n *\n * @param this - Bound CLI context (provides process exit + logging).\n * @param flags - CLI options for the run.\n */\nexport async function chunkCsv(\n this: LocalContext,\n flags: ChunkCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const {\n directory,\n outputDir,\n clearOutputDir,\n chunkSizeMB,\n concurrency,\n viewerMode,\n } = flags;\n\n /* 1) Discover CSV inputs */\n const files = collectCsvFilesOrExit(directory, this);\n\n /* 2) Size the pool */\n const { poolSize, cpuCount } = computePoolSize(concurrency, files.length);\n\n logger.info(\n colors.green(\n `Chunking ${files.length} CSV file(s) with pool size ${poolSize} (CPU=${cpuCount})`,\n ),\n );\n\n /* 3) Prepare a simple FIFO queue of tasks (one per file). */\n const queue = files.map<ChunkTask>((filePath) => ({\n filePath,\n options: { outputDir, clearOutputDir, chunkSizeMB },\n }));\n\n /* 4) Define pool hooks to adapt runner to this command. */\n const hooks: PoolHooks<ChunkTask, ChunkProgress, ChunkResult, Totals> = {\n nextTask: () => queue.shift(),\n taskLabel: (t) => t.filePath,\n initTotals: () => ({} as Totals),\n initSlotProgress: () => undefined,\n onProgress: (totals) => totals,\n onResult: (totals, res) => ({ totals, ok: !!res.ok }),\n // postProcess receives log context when viewerMode=true — we don’t need it here.\n postProcess: async () => {\n // nothing extra for chunk-csv\n },\n };\n\n /* 5) Launch the pool runner with our hooks and custom dashboard plugin. */\n await runPool({\n title: `Chunk CSV - ${directory}`,\n baseDir: directory || outputDir || process.cwd(),\n childFlag: CHILD_FLAG,\n childModulePath: getCurrentModulePath(),\n poolSize,\n cpuCount,\n filesTotal: files.length,\n hooks,\n viewerMode,\n render: (input) => dashboardPlugin(input, chunkCsvPlugin, viewerMode),\n extraKeyHandler: ({ logsBySlot, repaint, setPaused }) =>\n createExtraKeyHandler({\n logsBySlot,\n repaint,\n setPaused,\n }),\n });\n}\n\n/* -------------------------------------------------------------------------------------------------\n * If invoked directly as a child process, enter worker loop\n * ------------------------------------------------------------------------------------------------- */\nif (process.argv.includes(CHILD_FLAG)) {\n runChild().catch((err) => {\n logger.error(err);\n process.exit(1);\n });\n}\n","import { join } from 'node:path';\nimport { readdirSync, statSync } from 'node:fs';\nimport colors from 'colors';\nimport { logger } from '../../logger';\nimport type { LocalContext } from '../../context';\n\n/**\n * Validate flags and collect CSV file paths from a directory.\n * On validation error, the provided `exit` function is called.\n *\n * @param directory - the directory containing CSV files\n * @param localContext - the context of the command, used for logging and exit\n * @returns an array of valid CSV file paths\n */\nexport function collectCsvFilesOrExit(\n directory: string | undefined,\n localContext: LocalContext,\n): string[] {\n if (!directory) {\n logger.error(colors.red('A --directory must be provided.'));\n localContext.process.exit(1);\n }\n\n let files: string[] = [];\n try {\n const entries = readdirSync(directory);\n files = entries\n .filter((f) => f.endsWith('.csv'))\n .map((f) => join(directory, f))\n .filter((p) => {\n try {\n return statSync(p).isFile();\n } catch {\n return false;\n }\n });\n } catch (err) {\n logger.error(colors.red(`Failed to read directory: ${directory}`));\n logger.error(colors.red((err as Error).message));\n localContext.process.exit(1);\n }\n\n if (files.length === 0) {\n logger.error(colors.red(`No CSV files found in directory: ${directory}`));\n localContext.process.exit(1);\n }\n\n return files;\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-BHA2L6BP.cjs","../src/commands/admin/chunk-csv/impl.ts","../src/lib/helpers/collectCsvFilesOrExit.ts"],"names":["collectCsvFilesOrExit","directory","localContext","logger","colors","files","readdirSync","f","join","p","statSync","err"],"mappings":"AAAA,u/BAAkF,wDAAyC,wDAA0C,gCAA6B,wDAAyC,gCAA6B,gCAA6B,gFCClR,4BCDE,wBACiB,SAatBA,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACU,CACLD,CAAAA,EAAAA,CACHE,mBAAAA,CAAO,KAAA,CAAMC,gBAAAA,CAAO,GAAA,CAAI,iCAAiC,CAAC,CAAA,CAC1DF,CAAAA,CAAa,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,CAAA,CAG7B,IAAIG,CAAAA,CAAkB,CAAC,CAAA,CACvB,GAAI,CAEFA,CAAAA,CADgBC,6BAAAA,CAAqB,CAAA,CAElC,MAAA,CAAQC,CAAAA,EAAMA,CAAAA,CAAE,QAAA,CAAS,MAAM,CAAC,CAAA,CAChC,GAAA,CAAKA,CAAAA,EAAMC,wBAAAA,CAAKP,CAAWM,CAAC,CAAC,CAAA,CAC7B,MAAA,CAAQE,CAAAA,EAAM,CACb,GAAI,CACF,OAAOC,0BAAAA,CAAU,CAAA,CAAE,MAAA,CAAO,CAC5B,CAAA,UAAQ,CACN,MAAO,CAAA,CACT,CACF,CAAC,CACL,CAAA,KAAA,CAASC,CAAAA,CAAK,CACZR,mBAAAA,CAAO,KAAA,CAAMC,gBAAAA,CAAO,GAAA,CAAI,CAAA,0BAAA,EAA6BH,CAAS,CAAA,CAAA","file":"/home/runner/work/cli/cli/dist/impl-BHA2L6BP.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport colors from 'colors';\nimport { logger } from '../../../logger';\nimport { collectCsvFilesOrExit } from '../../../lib/helpers/collectCsvFilesOrExit';\nimport {\n computePoolSize,\n createExtraKeyHandler,\n CHILD_FLAG,\n type PoolHooks,\n runPool,\n dashboardPlugin,\n} from '../../../lib/pooling';\nimport {\n runChild,\n type ChunkProgress,\n type ChunkResult,\n type ChunkTask,\n} from './worker';\nimport { chunkCsvPlugin } from './ui';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\n/**\n * Returns the current module's path so the worker pool knows what file to re-exec.\n * In Node ESM, __filename is undefined, so we fall back to argv[1].\n *\n * @returns The current module's path as a string\n */\nfunction getCurrentModulePath(): string {\n if (typeof __filename !== 'undefined') {\n return __filename as unknown as string;\n }\n return process.argv[1];\n}\n\n/**\n * Totals aggregate for this command.\n * We don’t need custom counters since the runner already tracks\n * completed/failed counts in its header — so we just use an empty record.\n */\ntype Totals = Record<string, never>;\n\n/**\n * CLI flags accepted by the `chunk-csv` command.\n *\n * These are passed down from the CLI parser into the parent process.\n */\nexport type ChunkCsvCommandFlags = {\n directory: string;\n outputDir?: string;\n clearOutputDir: boolean;\n chunkSizeMB: number;\n concurrency?: number;\n viewerMode: boolean;\n};\n\n/**\n * Parent entrypoint for chunking many CSVs in parallel using the worker pool runner.\n *\n * Lifecycle:\n * 1) Discover CSV inputs (exit if none).\n * 2) Compute pool size (CPU-count heuristic or --concurrency).\n * 3) Build a FIFO queue of `ChunkTask`s.\n * 4) Define pool hooks to drive task assignment, progress, and result handling.\n * 5) Launch the pool with `runPool`, rendering via the `chunkCsvPlugin`.\n *\n * @param this - Bound CLI context (provides process exit + logging).\n * @param flags - CLI options for the run.\n */\nexport async function chunkCsv(\n this: LocalContext,\n flags: ChunkCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const {\n directory,\n outputDir,\n clearOutputDir,\n chunkSizeMB,\n concurrency,\n viewerMode,\n } = flags;\n\n /* 1) Discover CSV inputs */\n const files = collectCsvFilesOrExit(directory, this);\n\n /* 2) Size the pool */\n const { poolSize, cpuCount } = computePoolSize(concurrency, files.length);\n\n logger.info(\n colors.green(\n `Chunking ${files.length} CSV file(s) with pool size ${poolSize} (CPU=${cpuCount})`,\n ),\n );\n\n /* 3) Prepare a simple FIFO queue of tasks (one per file). */\n const queue = files.map<ChunkTask>((filePath) => ({\n filePath,\n options: { outputDir, clearOutputDir, chunkSizeMB },\n }));\n\n /* 4) Define pool hooks to adapt runner to this command. */\n const hooks: PoolHooks<ChunkTask, ChunkProgress, ChunkResult, Totals> = {\n nextTask: () => queue.shift(),\n taskLabel: (t) => t.filePath,\n initTotals: () => ({} as Totals),\n initSlotProgress: () => undefined,\n onProgress: (totals) => totals,\n onResult: (totals, res) => ({ totals, ok: !!res.ok }),\n // postProcess receives log context when viewerMode=true — we don’t need it here.\n postProcess: async () => {\n // nothing extra for chunk-csv\n },\n };\n\n /* 5) Launch the pool runner with our hooks and custom dashboard plugin. */\n await runPool({\n title: `Chunk CSV - ${directory}`,\n baseDir: directory || outputDir || process.cwd(),\n childFlag: CHILD_FLAG,\n childModulePath: getCurrentModulePath(),\n poolSize,\n cpuCount,\n filesTotal: files.length,\n hooks,\n viewerMode,\n render: (input) => dashboardPlugin(input, chunkCsvPlugin, viewerMode),\n extraKeyHandler: ({ logsBySlot, repaint, setPaused }) =>\n createExtraKeyHandler({\n logsBySlot,\n repaint,\n setPaused,\n }),\n });\n}\n\n/* -------------------------------------------------------------------------------------------------\n * If invoked directly as a child process, enter worker loop\n * ------------------------------------------------------------------------------------------------- */\nif (process.argv.includes(CHILD_FLAG)) {\n runChild().catch((err) => {\n logger.error(err);\n process.exit(1);\n });\n}\n","import { join } from 'node:path';\nimport { readdirSync, statSync } from 'node:fs';\nimport colors from 'colors';\nimport { logger } from '../../logger';\nimport type { LocalContext } from '../../context';\n\n/**\n * Validate flags and collect CSV file paths from a directory.\n * On validation error, the provided `exit` function is called.\n *\n * @param directory - the directory containing CSV files\n * @param localContext - the context of the command, used for logging and exit\n * @returns an array of valid CSV file paths\n */\nexport function collectCsvFilesOrExit(\n directory: string | undefined,\n localContext: LocalContext,\n): string[] {\n if (!directory) {\n logger.error(colors.red('A --directory must be provided.'));\n localContext.process.exit(1);\n }\n\n let files: string[] = [];\n try {\n const entries = readdirSync(directory);\n files = entries\n .filter((f) => f.endsWith('.csv'))\n .map((f) => join(directory, f))\n .filter((p) => {\n try {\n return statSync(p).isFile();\n } catch {\n return false;\n }\n });\n } catch (err) {\n logger.error(colors.red(`Failed to read directory: ${directory}`));\n logger.error(colors.red((err as Error).message));\n localContext.process.exit(1);\n }\n\n if (files.length === 0) {\n logger.error(colors.red(`No CSV files found in directory: ${directory}`));\n localContext.process.exit(1);\n }\n logger.info(colors.green(`Found: ${files.join(', ')} CSV files`));\n return files;\n}\n"]}
@@ -0,0 +1,6 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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 _chunkIBTP5OXEcjs = require('./chunk-IBTP5OXE.cjs');var _chunkJH5HRI6Dcjs = require('./chunk-JH5HRI6D.cjs');var _chunkP5GD5LAKcjs = require('./chunk-P5GD5LAK.cjs');require('./chunk-ABKDAPPR.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk56QKBG2Rcjs = require('./chunk-56QKBG2R.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkDQCPGPXGcjs = require('./chunk-DQCPGPXG.cjs');require('./chunk-7PB6LVSE.cjs');var _fs = require('fs');var _path = require('path');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);async function N({transcendUrl:i,auth:c,pageSize:h,publishToPrivacyCenter:y,contents:l,deleteExtraAttributeValues:m=!1,classifyService:f=!1}){let u=_chunk56QKBG2Rcjs.zc.call(void 0, i,c);try{return!await _chunk56QKBG2Rcjs.zg.call(void 0, l,u,{pageSize:h,publishToPrivacyCenter:y,classifyService:f,deleteExtraAttributeValues:m})}catch(o){return _chunkZUNVPK23cjs.a.error(_colors2.default.red(`An unexpected error occurred syncing the schema: ${o.message}`)),!1}}async function U({file:i="./transcend.yml",transcendUrl:c,auth:h,variables:y,pageSize:l,publishToPrivacyCenter:m,classifyService:f,deleteExtraAttributeValues:u}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);let o=await _chunkP5GD5LAKcjs.b.call(void 0, h),E=_chunk56QKBG2Rcjs.Yf.call(void 0, y),p;if(Array.isArray(o)&&_fs.lstatSync.call(void 0, i).isDirectory()?p=_chunkP5GD5LAKcjs.c.call(void 0, i).map(e=>_path.join.call(void 0, i,e)):p=i.split(","),p.length<1)throw new Error("No file specified!");let s=p.map(e=>{_fs.existsSync.call(void 0, e)?_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Reading file "${e}"...`)):(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`The file path does not exist on disk: ${e}. You can specify the filepath using --file=./examples/transcend.yml`)),this.process.exit(1));try{let r=_chunkJH5HRI6Dcjs.d.call(void 0, e,E);return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully read in "${e}"`)),{content:r,name:e.split("/").pop().replace(".yml","")}}catch(r){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`The shape of your yaml file is invalid with the following errors: ${r.message}`)),this.process.exit(1)}});if(typeof o=="string"){let[e,...r]=s.map(({content:d})=>d),$=_chunkIBTP5OXEcjs.a.call(void 0, e,...r);await N({transcendUrl:c,auth:o,contents:$,publishToPrivacyCenter:m,deleteExtraAttributeValues:u,pageSize:l,classifyService:!!f})||(_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Sync encountered errors. View output above for more information, or check out ${_chunkDQCPGPXGcjs.p}`)),this.process.exit(1))}else{if(s.length!==1&&s.length!==o.length)throw new Error(`Expected list of yml files to be equal to the list of API keys.Got ${s.length} YML file${s.length===1?"":"s"} and ${o.length} API key${o.length===1?"":"s"}`);let e=[];await _chunk56QKBG2Rcjs.b.call(void 0, o,async(r,$)=>{let a=`[${$+1}/${o.length}][${r.organizationName}] `;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`~~~
2
+
3
+ ${a}Attempting to push configuration...
4
+
5
+ ~~~`));let d=s.length===1?s[0].content:_optionalChain([s, 'access', _ => _.find, 'call', _2 => _2(z=>z.name===r.organizationName), 'optionalAccess', _3 => _3.content]);if(!d){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`${a}Failed to find transcend.yml file for organization: "${r.organizationName}".`)),e.push(r.organizationName);return}await N({transcendUrl:c,auth:r.apiKey,contents:d,pageSize:l,publishToPrivacyCenter:m,deleteExtraAttributeValues:u,classifyService:f})?_chunkZUNVPK23cjs.a.info(_colors2.default.green(`${a}Successfully pushed configuration!`)):(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`${a}Failed to sync configuration.`)),e.push(r.organizationName))}),e.length>0&&(_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Sync encountered errors for "${e.join(",")}". View output above for more information, or check out ${_chunkDQCPGPXGcjs.p}`)),this.process.exit(1))}_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced yaml file to Transcend! View at ${_chunkDQCPGPXGcjs.p}`))}exports.push = U;
6
+ //# sourceMappingURL=impl-BLGX7DMN.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-BLGX7DMN.cjs","../src/commands/inventory/push/impl.ts"],"names":["syncConfiguration","transcendUrl","auth","pageSize","publishToPrivacyCenter","contents","deleteExtraAttributeValues","classifyService","client","buildTranscendGraphQLClient","syncConfigurationToTranscend","err","logger","colors"],"mappings":"AAAA,quBAAwC,wDAAyC,wDAAgD,gCAA6B,wDAAyC,wDAAiE,gCAA6B,wDAAyC,wDAAyC,gCAA6B,wBCI9W,4BACjB,gFAEF,MAmBnB,SAAeA,CAAAA,CAAkB,CAC/B,YAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,sBAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,0BAAA,CAAAC,CAAAA,CAA6B,CAAA,CAAA,CAC7B,eAAA,CAAAC,CAAAA,CAAkB,CAAA,CACpB,CAAA,CAeqB,CACnB,IAAMC,CAAAA,CAASC,kCAAAA,CAA4BR,CAAcC,CAAI,CAAA,CAG7D,GAAI,CAWF,MAAO,CAVkB,MAAMQ,kCAAAA,CAC7BL,CACAG,CAAAA,CACA,CACE,QAAA,CAAAL,CAAAA,CACA,sBAAA,CAAAC,CAAAA,CACA,eAAA,CAAAG,CAAAA,CACA,0BAAA,CAAAD,CACF,CACF,CAEF,CAAA,KAAA,CAASK,CAAAA,CAAK,CACZ,OAAAC,mBAAAA,CAAO,KAAA,CACLC,gBAAAA,CAAO,GAAA,CACL,CAAA,iDAAA,EAAoDF,CAAAA,CAAI,OAAO,CAAA,CAAA;AAsI7D;AAAgB;AAAA;AA8D1B,GAAA","file":"/home/runner/work/cli/cli/dist/impl-BLGX7DMN.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\n\nimport { logger } from '../../../logger';\nimport { mapSeries } from '../../../lib/bluebird';\nimport { existsSync, lstatSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { readTranscendYaml } from '../../../lib/readTranscendYaml';\nimport colors from 'colors';\nimport {\n buildTranscendGraphQLClient,\n syncConfigurationToTranscend,\n} from '../../../lib/graphql';\n\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants';\nimport { TranscendInput } from '../../../codecs';\nimport { validateTranscendAuth, listFiles } from '../../../lib/api-keys';\nimport { mergeTranscendInputs } from '../../../lib/mergeTranscendInputs';\nimport { parseVariablesFromString } from '../../../lib/helpers/parseVariablesFromString';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\n/**\n * Sync configuration to Transcend\n *\n * @param options - Options\n * @returns True if synced successfully, false if error occurs\n */\nasync function syncConfiguration({\n transcendUrl,\n auth,\n pageSize,\n publishToPrivacyCenter,\n contents,\n deleteExtraAttributeValues = false,\n classifyService = false,\n}: {\n /** Transcend YAML */\n contents: TranscendInput;\n /** Transcend URL */\n transcendUrl: string;\n /** API key */\n auth: string;\n /** Page size */\n pageSize: number;\n /** Skip privacy center publish step */\n publishToPrivacyCenter: boolean;\n /** classify data flow service if missing */\n classifyService?: boolean;\n /** Delete attributes when syncing */\n deleteExtraAttributeValues?: boolean;\n}): Promise<boolean> {\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Sync to Transcend\n try {\n const encounteredError = await syncConfigurationToTranscend(\n contents,\n client,\n {\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n },\n );\n return !encounteredError;\n } catch (err) {\n logger.error(\n colors.red(\n `An unexpected error occurred syncing the schema: ${err.message}`,\n ),\n );\n return false;\n }\n}\n\nexport interface PushCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n pageSize: number;\n variables: string;\n publishToPrivacyCenter: boolean;\n classifyService: boolean;\n deleteExtraAttributeValues: boolean;\n}\n\nexport async function push(\n this: LocalContext,\n {\n file = './transcend.yml',\n transcendUrl,\n auth,\n variables,\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n }: PushCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Parse out the variables\n const vars = parseVariablesFromString(variables);\n\n // check if we are being passed a list of API keys and a list of files\n let fileList: string[];\n if (Array.isArray(apiKeyOrList) && lstatSync(file).isDirectory()) {\n fileList = listFiles(file).map((filePath) => join(file, filePath));\n } else {\n fileList = file.split(',');\n }\n\n // Ensure at least one file is parsed\n if (fileList.length < 1) {\n throw new Error('No file specified!');\n }\n\n // eslint-disable-next-line array-callback-return,consistent-return\n const transcendInputs = fileList.map((filePath) => {\n // Ensure yaml file exists on disk\n if (!existsSync(filePath)) {\n logger.error(\n colors.red(\n `The file path does not exist on disk: ${filePath}. You can specify the filepath using --file=./examples/transcend.yml`,\n ),\n );\n this.process.exit(1);\n } else {\n logger.info(colors.magenta(`Reading file \"${filePath}\"...`));\n }\n\n try {\n // Read in the yaml file and validate it's shape\n const newContents = readTranscendYaml(filePath, vars);\n logger.info(colors.green(`Successfully read in \"${filePath}\"`));\n return {\n content: newContents,\n name: filePath.split('/').pop()!.replace('.yml', ''),\n };\n } catch (err) {\n logger.error(\n colors.red(\n `The shape of your yaml file is invalid with the following errors: ${err.message}`,\n ),\n );\n this.process.exit(1);\n }\n });\n\n // process a single API key\n if (typeof apiKeyOrList === 'string') {\n // if passed multiple inputs, merge them together\n const [base, ...rest] = transcendInputs.map(({ content }) => content);\n const contents = mergeTranscendInputs(base, ...rest);\n\n // sync the configuration\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKeyOrList,\n contents,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n pageSize,\n classifyService: !!classifyService,\n });\n\n // exist with error code\n if (!success) {\n logger.info(\n colors.red(\n `Sync encountered errors. View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n } else {\n // if passed multiple inputs, expect them to be one per instance\n if (\n transcendInputs.length !== 1 &&\n transcendInputs.length !== apiKeyOrList.length\n ) {\n throw new Error(\n 'Expected list of yml files to be equal to the list of API keys.' +\n `Got ${transcendInputs.length} YML file${\n transcendInputs.length === 1 ? '' : 's'\n } and ${apiKeyOrList.length} API key${\n apiKeyOrList.length === 1 ? '' : 's'\n }`,\n );\n }\n\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${\n apiKey.organizationName\n }] `;\n logger.info(\n colors.magenta(\n `~~~\\n\\n${prefix}Attempting to push configuration...\\n\\n~~~`,\n ),\n );\n\n // use the merged contents if 1 yml passed, else use the contents that map to that organization\n const useContents =\n transcendInputs.length === 1\n ? transcendInputs[0].content\n : transcendInputs.find(\n (input) => input.name === apiKey.organizationName,\n )?.content;\n\n // Throw error if cannot find a yml file matching that organization name\n if (!useContents) {\n logger.error(\n colors.red(\n `${prefix}Failed to find transcend.yml file for organization: \"${apiKey.organizationName}\".`,\n ),\n );\n encounteredErrors.push(apiKey.organizationName);\n return;\n }\n\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKey.apiKey,\n contents: useContents,\n pageSize,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n classifyService,\n });\n\n if (success) {\n logger.info(\n colors.green(`${prefix}Successfully pushed configuration!`),\n );\n } else {\n logger.error(colors.red(`${prefix}Failed to sync configuration.`));\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n logger.info(\n colors.red(\n `Sync encountered errors for \"${encounteredErrors.join(\n ',',\n )}\". View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced yaml file to Transcend! View at ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n}\n"]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk55B57ZAYcjs = require('./chunk-55B57ZAY.cjs');require('./chunk-TSJTXXLZ.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-XXFLFF7Q.cjs');require('./chunk-7PB6LVSE.cjs');async function F({auth:i,file:n,transcendUrl:r,cacheFilepath:a,requestReceiptFolder:s,sombraAuth:l,concurrency:p,attributes:d,isTest:c,isSilent:u,skipSendingReceipt:m,emailIsVerified:b,skipFilterStep:g,dryRun:f,debug:C,defaultPhoneCountryCode:h}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),await _chunk55B57ZAYcjs.Kf.call(void 0, {cacheFilepath:a,requestReceiptFolder:s,file:n,auth:i,sombraAuth:l,concurrency:p,transcendUrl:r,defaultPhoneCountryCode:h,attributes:_chunk55B57ZAYcjs.pc.call(void 0, d),debug:C,skipFilterStep:g,isSilent:u,skipSendingReceipt:m,emailIsVerified:b,isTest:c,dryRun:f})}exports.upload = F;
2
- //# sourceMappingURL=impl-XJBUIDZP.cjs.map
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk56QKBG2Rcjs = require('./chunk-56QKBG2R.cjs');require('./chunk-TSJTXXLZ.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-DQCPGPXG.cjs');require('./chunk-7PB6LVSE.cjs');async function F({auth:i,file:n,transcendUrl:r,cacheFilepath:a,requestReceiptFolder:s,sombraAuth:l,concurrency:p,attributes:d,isTest:c,isSilent:u,skipSendingReceipt:m,emailIsVerified:b,skipFilterStep:g,dryRun:f,debug:C,defaultPhoneCountryCode:h}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),await _chunk56QKBG2Rcjs.Mf.call(void 0, {cacheFilepath:a,requestReceiptFolder:s,file:n,auth:i,sombraAuth:l,concurrency:p,transcendUrl:r,defaultPhoneCountryCode:h,attributes:_chunk56QKBG2Rcjs.rc.call(void 0, d),debug:C,skipFilterStep:g,isSilent:u,skipSendingReceipt:m,emailIsVerified:b,isTest:c,dryRun:f})}exports.upload = F;
2
+ //# sourceMappingURL=impl-DA7AASRR.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-XJBUIDZP.cjs","../src/commands/request/upload/impl.ts"],"names":["upload","auth","file","transcendUrl","cacheFilepath","requestReceiptFolder","sombraAuth","concurrency","attributes","isTest","isSilent","skipSendingReceipt","emailIsVerified","skipFilterStep","dryRun","debug","defaultPhoneCountryCode","doneInputValidation","uploadPrivacyRequestsFromCsv","splitCsvToList"],"mappings":"AAAA,iIAAwC,wDAAkD,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MC0B9M,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,oBAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,kBAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,KAAA,CAAAC,CAAAA,CACA,uBAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,MAAMC,kCAAAA,CACJ,aAAA,CAAAd,CAAAA,CACA,oBAAA,CAAAC,CAAAA,CACA,IAAA,CAAAH,CAAAA,CACA,IAAA,CAAAD,CAAAA,CACA,UAAA,CAAAK,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,YAAA,CAAAJ,CAAAA,CACA,uBAAA,CAAAa,CAAAA,CACA,UAAA,CAAYG,kCAAAA,CAAyB,CAAA,CACrC,KAAA,CAAAJ,CAAAA,CACA,cAAA,CAAAF,CAAAA,CACA,QAAA,CAAAH,CAAAA,CACA,kBAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,MAAA,CAAAH,CAAAA,CACA,MAAA,CAAAK,CACF,CAAC,CACH,CAAA,mBAAA","file":"/home/runner/work/cli/cli/dist/impl-XJBUIDZP.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport {\n splitCsvToList,\n uploadPrivacyRequestsFromCsv,\n} from '../../../lib/requests';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface UploadCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n cacheFilepath: string;\n requestReceiptFolder: string;\n sombraAuth?: string;\n concurrency: number;\n attributes: string;\n isTest: boolean;\n isSilent: boolean;\n skipSendingReceipt: boolean;\n emailIsVerified: boolean;\n skipFilterStep: boolean;\n dryRun: boolean;\n debug: boolean;\n defaultPhoneCountryCode: string;\n}\n\nexport async function upload(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n cacheFilepath,\n requestReceiptFolder,\n sombraAuth,\n concurrency,\n attributes,\n isTest,\n isSilent,\n skipSendingReceipt,\n emailIsVerified,\n skipFilterStep,\n dryRun,\n debug,\n defaultPhoneCountryCode,\n }: UploadCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await uploadPrivacyRequestsFromCsv({\n cacheFilepath,\n requestReceiptFolder,\n file,\n auth,\n sombraAuth,\n concurrency,\n transcendUrl,\n defaultPhoneCountryCode,\n attributes: splitCsvToList(attributes),\n debug,\n skipFilterStep,\n isSilent,\n skipSendingReceipt,\n emailIsVerified,\n isTest,\n dryRun,\n });\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-DA7AASRR.cjs","../src/commands/request/upload/impl.ts"],"names":["upload","auth","file","transcendUrl","cacheFilepath","requestReceiptFolder","sombraAuth","concurrency","attributes","isTest","isSilent","skipSendingReceipt","emailIsVerified","skipFilterStep","dryRun","debug","defaultPhoneCountryCode","doneInputValidation","uploadPrivacyRequestsFromCsv","splitCsvToList"],"mappings":"AAAA,iIAAwC,wDAAkD,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MC0B9M,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,oBAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,kBAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,KAAA,CAAAC,CAAAA,CACA,uBAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,MAAMC,kCAAAA,CACJ,aAAA,CAAAd,CAAAA,CACA,oBAAA,CAAAC,CAAAA,CACA,IAAA,CAAAH,CAAAA,CACA,IAAA,CAAAD,CAAAA,CACA,UAAA,CAAAK,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,YAAA,CAAAJ,CAAAA,CACA,uBAAA,CAAAa,CAAAA,CACA,UAAA,CAAYG,kCAAAA,CAAyB,CAAA,CACrC,KAAA,CAAAJ,CAAAA,CACA,cAAA,CAAAF,CAAAA,CACA,QAAA,CAAAH,CAAAA,CACA,kBAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,MAAA,CAAAH,CAAAA,CACA,MAAA,CAAAK,CACF,CAAC,CACH,CAAA,mBAAA","file":"/home/runner/work/cli/cli/dist/impl-DA7AASRR.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport {\n splitCsvToList,\n uploadPrivacyRequestsFromCsv,\n} from '../../../lib/requests';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface UploadCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n cacheFilepath: string;\n requestReceiptFolder: string;\n sombraAuth?: string;\n concurrency: number;\n attributes: string;\n isTest: boolean;\n isSilent: boolean;\n skipSendingReceipt: boolean;\n emailIsVerified: boolean;\n skipFilterStep: boolean;\n dryRun: boolean;\n debug: boolean;\n defaultPhoneCountryCode: string;\n}\n\nexport async function upload(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n cacheFilepath,\n requestReceiptFolder,\n sombraAuth,\n concurrency,\n attributes,\n isTest,\n isSilent,\n skipSendingReceipt,\n emailIsVerified,\n skipFilterStep,\n dryRun,\n debug,\n defaultPhoneCountryCode,\n }: UploadCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await uploadPrivacyRequestsFromCsv({\n cacheFilepath,\n requestReceiptFolder,\n file,\n auth,\n sombraAuth,\n concurrency,\n transcendUrl,\n defaultPhoneCountryCode,\n attributes: splitCsvToList(attributes),\n debug,\n skipFilterStep,\n isSilent,\n skipSendingReceipt,\n emailIsVerified,\n isTest,\n dryRun,\n });\n}\n"]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkQ2RJZGYWcjs = require('./chunk-Q2RJZGYW.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk55B57ZAYcjs = require('./chunk-55B57ZAY.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');require('./chunk-XXFLFF7Q.cjs');require('./chunk-7PB6LVSE.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _iots = require('io-ts'); var t = _interopRequireWildcard(_iots);var c=t.type({"Request Id":t.string});async function q({auth:i,dataSiloId:m,file:o,transcendUrl:n}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Reading "${o}" from disk`));let d=_chunk55B57ZAYcjs.sc.call(void 0, o,c);await _chunkQ2RJZGYWcjs.f.call(void 0, {requestIds:d.map(l=>l["Request Id"]),transcendUrl:n,auth:i,dataSiloId:m})}exports.markRequestDataSilosCompleted = q;
2
- //# sourceMappingURL=impl-OQAP7YDW.cjs.map
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 _chunkIHUCIK5Tcjs = require('./chunk-IHUCIK5T.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk56QKBG2Rcjs = require('./chunk-56QKBG2R.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');require('./chunk-DQCPGPXG.cjs');require('./chunk-7PB6LVSE.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _iots = require('io-ts'); var t = _interopRequireWildcard(_iots);var c=t.type({"Request Id":t.string});async function q({auth:i,dataSiloId:m,file:o,transcendUrl:n}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Reading "${o}" from disk`));let d=_chunk56QKBG2Rcjs.uc.call(void 0, o,c);await _chunkIHUCIK5Tcjs.f.call(void 0, {requestIds:d.map(l=>l["Request Id"]),transcendUrl:n,auth:i,dataSiloId:m})}exports.markRequestDataSilosCompleted = q;
2
+ //# sourceMappingURL=impl-EXHOBCQW.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-OQAP7YDW.cjs","../src/commands/request/system/mark-request-data-silos-completed/impl.ts"],"names":["RequestIdRow","markRequestDataSilosCompleted","auth","dataSiloId","file","transcendUrl","doneInputValidation","logger","colors","activeResults","readCsv","markRequestDataSiloIdsCompleted","request"],"mappings":"AAAA,mfAAwC,wDAAyC,wDAA0C,gCAA6B,wDAAyC,gCAA6B,gCAA6B,gFCCxO,qEACA,IAObA,CAAAA,CAAiB,CAAA,CAAA,IAAA,CAAK,CAC1B,YAAA,CAAgB,CAAA,CAAA,MAClB,CAAC,CAAA,CASD,MAAA,SAAsBC,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErCC,mBAAAA,CAAO,IAAA,CAAKC,gBAAAA,CAAO,OAAA,CAAQ,CAAA,SAAA,EAAYJ,CAAI,CAAA,WAAA,CAAa,CAAC,CAAA,CACzD,IAAMK,CAAAA,CAAgBC,kCAAAA,CAAQN,CAAMJ,CAAY,CAAA,CAEhD,MAAMW,iCAAAA,CACJ,UAAA,CAAYF,CAAAA,CAAc,GAAA,CAAKG,CAAAA,EAAYA,CAAAA,CAAQ,YAAY,CAAC,CAAA,CAChE,YAAA,CAAAP,CAAAA,CACA,IAAA,CAAAH,CAAAA,CACA,UAAA,CAAAC,CACF,CAAC,CACH,CAAA,0CAAA","file":"/home/runner/work/cli/cli/dist/impl-OQAP7YDW.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../../context';\nimport colors from 'colors';\nimport * as t from 'io-ts';\n\nimport { logger } from '../../../../logger';\nimport { markRequestDataSiloIdsCompleted } from '../../../../lib/cron';\nimport { readCsv } from '../../../../lib/requests';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nconst RequestIdRow = t.type({\n 'Request Id': t.string,\n});\n\nexport interface MarkRequestDataSilosCompletedCommandFlags {\n auth: string;\n dataSiloId: string;\n file: string;\n transcendUrl: string;\n}\n\nexport async function markRequestDataSilosCompleted(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n file,\n transcendUrl,\n }: MarkRequestDataSilosCompletedCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const activeResults = readCsv(file, RequestIdRow);\n\n await markRequestDataSiloIdsCompleted({\n requestIds: activeResults.map((request) => request['Request Id']),\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-EXHOBCQW.cjs","../src/commands/request/system/mark-request-data-silos-completed/impl.ts"],"names":["RequestIdRow","markRequestDataSilosCompleted","auth","dataSiloId","file","transcendUrl","doneInputValidation","logger","colors","activeResults","readCsv","markRequestDataSiloIdsCompleted","request"],"mappings":"AAAA,mfAAwC,wDAAyC,wDAA0C,gCAA6B,wDAAyC,gCAA6B,gCAA6B,gFCCxO,qEACA,IAObA,CAAAA,CAAiB,CAAA,CAAA,IAAA,CAAK,CAC1B,YAAA,CAAgB,CAAA,CAAA,MAClB,CAAC,CAAA,CASD,MAAA,SAAsBC,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErCC,mBAAAA,CAAO,IAAA,CAAKC,gBAAAA,CAAO,OAAA,CAAQ,CAAA,SAAA,EAAYJ,CAAI,CAAA,WAAA,CAAa,CAAC,CAAA,CACzD,IAAMK,CAAAA,CAAgBC,kCAAAA,CAAQN,CAAMJ,CAAY,CAAA,CAEhD,MAAMW,iCAAAA,CACJ,UAAA,CAAYF,CAAAA,CAAc,GAAA,CAAKG,CAAAA,EAAYA,CAAAA,CAAQ,YAAY,CAAC,CAAA,CAChE,YAAA,CAAAP,CAAAA,CACA,IAAA,CAAAH,CAAAA,CACA,UAAA,CAAAC,CACF,CAAC,CACH,CAAA,0CAAA","file":"/home/runner/work/cli/cli/dist/impl-EXHOBCQW.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../../context';\nimport colors from 'colors';\nimport * as t from 'io-ts';\n\nimport { logger } from '../../../../logger';\nimport { markRequestDataSiloIdsCompleted } from '../../../../lib/cron';\nimport { readCsv } from '../../../../lib/requests';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nconst RequestIdRow = t.type({\n 'Request Id': t.string,\n});\n\nexport interface MarkRequestDataSilosCompletedCommandFlags {\n auth: string;\n dataSiloId: string;\n file: string;\n transcendUrl: string;\n}\n\nexport async function markRequestDataSilosCompleted(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n file,\n transcendUrl,\n }: MarkRequestDataSilosCompletedCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const activeResults = readCsv(file, RequestIdRow);\n\n await markRequestDataSiloIdsCompleted({\n requestIds: activeResults.map((request) => request['Request Id']),\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkQ2RJZGYWcjs = require('./chunk-Q2RJZGYW.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk55B57ZAYcjs = require('./chunk-55B57ZAY.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkXXFLFF7Qcjs = require('./chunk-XXFLFF7Q.cjs');require('./chunk-7PB6LVSE.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);async function L({file:u,transcendUrl:c,auth:g,sombraAuth:v,dataSiloId:b,actions:C,pageLimit:r,skipRequestCount:n,chunkSize:e}){n&&_chunkZUNVPK23cjs.a.info(_colors2.default.yellow("Skipping request count as requested. This may help speed up the call.")),(Number.isNaN(e)||e<=0||e%r!==0)&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Invalid chunk size: "${e}". Must be a positive integer that is a multiple of ${r}.`)),this.process.exit(1)),_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);let{baseName:h,extension:I}=_chunk55B57ZAYcjs.sg.call(void 0, u),a=0;await _chunkQ2RJZGYWcjs.g.call(void 0, {transcendUrl:c,apiPageSize:r,savePageSize:e,onSave:async i=>{let s=`${h}-${a}${I}`;_chunkZUNVPK23cjs.a.info(_colors2.default.blue(`Saving ${i.length} identifiers to file "${s}"`));let $=_chunkXXFLFF7Qcjs.j.call(void 0, i.map(x=>Object.keys(x)).flat());return await _chunk55B57ZAYcjs.tg.call(void 0, s,i,$),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully wrote ${i.length} identifiers to file "${s}"`)),a+=1,Promise.resolve()},actions:C,auth:g,sombraAuth:v,dataSiloId:b,skipRequestCount:n})}exports.pullIdentifiers = L;
2
- //# sourceMappingURL=impl-D2HENZNO.cjs.map
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkIHUCIK5Tcjs = require('./chunk-IHUCIK5T.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk56QKBG2Rcjs = require('./chunk-56QKBG2R.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkDQCPGPXGcjs = require('./chunk-DQCPGPXG.cjs');require('./chunk-7PB6LVSE.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);async function L({file:u,transcendUrl:c,auth:g,sombraAuth:v,dataSiloId:b,actions:C,pageLimit:r,skipRequestCount:n,chunkSize:e}){n&&_chunkZUNVPK23cjs.a.info(_colors2.default.yellow("Skipping request count as requested. This may help speed up the call.")),(Number.isNaN(e)||e<=0||e%r!==0)&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Invalid chunk size: "${e}". Must be a positive integer that is a multiple of ${r}.`)),this.process.exit(1)),_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);let{baseName:h,extension:I}=_chunk56QKBG2Rcjs.ug.call(void 0, u),a=0;await _chunkIHUCIK5Tcjs.g.call(void 0, {transcendUrl:c,apiPageSize:r,savePageSize:e,onSave:async i=>{let s=`${h}-${a}${I}`;_chunkZUNVPK23cjs.a.info(_colors2.default.blue(`Saving ${i.length} identifiers to file "${s}"`));let $=_chunkDQCPGPXGcjs.j.call(void 0, i.map(x=>Object.keys(x)).flat());return await _chunk56QKBG2Rcjs.vg.call(void 0, s,i,$),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully wrote ${i.length} identifiers to file "${s}"`)),a+=1,Promise.resolve()},actions:C,auth:g,sombraAuth:v,dataSiloId:b,skipRequestCount:n})}exports.pullIdentifiers = L;
2
+ //# sourceMappingURL=impl-FRWZLZ2V.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-D2HENZNO.cjs","../src/commands/request/cron/pull-identifiers/impl.ts"],"names":["pullIdentifiers","file","transcendUrl","auth","sombraAuth","dataSiloId","actions","pageLimit","skipRequestCount","chunkSize","logger","colors","doneInputValidation","baseName","extension","parseFilePath","fileCount","pullChunkedCustomSiloOutstandingIdentifiers","chunk","numberedFileName"],"mappings":"AAAA,iOAAwC,wDAAyC,wDAAkD,gCAA6B,wDAAyC,wDAAyC,gCAA6B,gFCC5P,MAwBnB,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CACF,CAAA,CACe,CACXD,CAAAA,EACFE,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,MAAA,CACL,uEACF,CACF,CAAA,CAAA,CAIA,MAAA,CAAO,KAAA,CAAMF,CAAS,CAAA,EACtBA,CAAAA,EAAa,CAAA,EACbA,CAAAA,CAAYF,CAAAA,GAAc,CAAA,CAAA,EAAA,CAE1BG,mBAAAA,CAAO,KAAA,CACLC,gBAAAA,CAAO,GAAA,CACL,CAAA,qBAAA,EAAwBF,CAAS,CAAA,oDAAA,EAAuDF,CAAS,CAAA,CAAA,CACnG,CACF,CAAA,CACA,IAAA,CAAK,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,CAAA,CAGrBK,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,GAAM,CAAE,QAAA,CAAAC,CAAAA,CAAU,SAAA,CAAAC,CAAU,CAAA,CAAIC,kCAAAA,CAAkB,CAAA,CAC9CC,CAAAA,CAAY,CAAA,CAsBhB,MAAMC,iCAAAA,CACJ,YAAA,CAAAf,CAAAA,CACA,WAAA,CAAaK,CAAAA,CACb,YAAA,CAAcE,CAAAA,CACd,MAAA,CAxBa,MAAOS,CAAAA,EAAmD,CACvE,IAAMC,CAAAA,CAAmB,CAAA,EAAA","file":"/home/runner/work/cli/cli/dist/impl-D2HENZNO.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../../context';\nimport colors from 'colors';\n\nimport { logger } from '../../../../logger';\nimport { uniq } from 'lodash-es';\nimport {\n CsvFormattedIdentifier,\n pullChunkedCustomSiloOutstandingIdentifiers,\n} from '../../../../lib/cron';\nimport { RequestAction } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\nimport { parseFilePath, writeLargeCsv } from '../../../../lib/helpers';\n\nexport interface PullIdentifiersCommandFlags {\n file: string;\n transcendUrl: string;\n auth: string;\n sombraAuth?: string;\n dataSiloId: string;\n actions: RequestAction[];\n pageLimit: number;\n skipRequestCount: boolean;\n chunkSize: number;\n}\n\nexport async function pullIdentifiers(\n this: LocalContext,\n {\n file,\n transcendUrl,\n auth,\n sombraAuth,\n dataSiloId,\n actions,\n pageLimit,\n skipRequestCount,\n chunkSize,\n }: PullIdentifiersCommandFlags,\n): Promise<void> {\n if (skipRequestCount) {\n logger.info(\n colors.yellow(\n 'Skipping request count as requested. This may help speed up the call.',\n ),\n );\n }\n\n if (\n Number.isNaN(chunkSize) ||\n chunkSize <= 0 ||\n chunkSize % pageLimit !== 0\n ) {\n logger.error(\n colors.red(\n `Invalid chunk size: \"${chunkSize}\". Must be a positive integer that is a multiple of ${pageLimit}.`,\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process.exit);\n\n const { baseName, extension } = parseFilePath(file);\n let fileCount = 0;\n\n const onSave = async (chunk: CsvFormattedIdentifier[]): Promise<void> => {\n const numberedFileName = `${baseName}-${fileCount}${extension}`;\n logger.info(\n colors.blue(\n `Saving ${chunk.length} identifiers to file \"${numberedFileName}\"`,\n ),\n );\n\n const headers = uniq(chunk.map((d) => Object.keys(d)).flat());\n await writeLargeCsv(numberedFileName, chunk, headers);\n logger.info(\n colors.green(\n `Successfully wrote ${chunk.length} identifiers to file \"${numberedFileName}\"`,\n ),\n );\n fileCount += 1;\n return Promise.resolve();\n };\n\n // Pull down outstanding identifiers\n await pullChunkedCustomSiloOutstandingIdentifiers({\n transcendUrl,\n apiPageSize: pageLimit,\n savePageSize: chunkSize,\n onSave,\n actions,\n auth,\n sombraAuth,\n dataSiloId,\n skipRequestCount,\n });\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-FRWZLZ2V.cjs","../src/commands/request/cron/pull-identifiers/impl.ts"],"names":["pullIdentifiers","file","transcendUrl","auth","sombraAuth","dataSiloId","actions","pageLimit","skipRequestCount","chunkSize","logger","colors","doneInputValidation","baseName","extension","parseFilePath","fileCount","pullChunkedCustomSiloOutstandingIdentifiers","chunk","numberedFileName"],"mappings":"AAAA,iOAAwC,wDAAyC,wDAAkD,gCAA6B,wDAAyC,wDAAyC,gCAA6B,gFCC5P,MAwBnB,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CACF,CAAA,CACe,CACXD,CAAAA,EACFE,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,MAAA,CACL,uEACF,CACF,CAAA,CAAA,CAIA,MAAA,CAAO,KAAA,CAAMF,CAAS,CAAA,EACtBA,CAAAA,EAAa,CAAA,EACbA,CAAAA,CAAYF,CAAAA,GAAc,CAAA,CAAA,EAAA,CAE1BG,mBAAAA,CAAO,KAAA,CACLC,gBAAAA,CAAO,GAAA,CACL,CAAA,qBAAA,EAAwBF,CAAS,CAAA,oDAAA,EAAuDF,CAAS,CAAA,CAAA,CACnG,CACF,CAAA,CACA,IAAA,CAAK,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,CAAA,CAGrBK,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,GAAM,CAAE,QAAA,CAAAC,CAAAA,CAAU,SAAA,CAAAC,CAAU,CAAA,CAAIC,kCAAAA,CAAkB,CAAA,CAC9CC,CAAAA,CAAY,CAAA,CAsBhB,MAAMC,iCAAAA,CACJ,YAAA,CAAAf,CAAAA,CACA,WAAA,CAAaK,CAAAA,CACb,YAAA,CAAcE,CAAAA,CACd,MAAA,CAxBa,MAAOS,CAAAA,EAAmD,CACvE,IAAMC,CAAAA,CAAmB,CAAA,EAAA","file":"/home/runner/work/cli/cli/dist/impl-FRWZLZ2V.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../../context';\nimport colors from 'colors';\n\nimport { logger } from '../../../../logger';\nimport { uniq } from 'lodash-es';\nimport {\n CsvFormattedIdentifier,\n pullChunkedCustomSiloOutstandingIdentifiers,\n} from '../../../../lib/cron';\nimport { RequestAction } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\nimport { parseFilePath, writeLargeCsv } from '../../../../lib/helpers';\n\nexport interface PullIdentifiersCommandFlags {\n file: string;\n transcendUrl: string;\n auth: string;\n sombraAuth?: string;\n dataSiloId: string;\n actions: RequestAction[];\n pageLimit: number;\n skipRequestCount: boolean;\n chunkSize: number;\n}\n\nexport async function pullIdentifiers(\n this: LocalContext,\n {\n file,\n transcendUrl,\n auth,\n sombraAuth,\n dataSiloId,\n actions,\n pageLimit,\n skipRequestCount,\n chunkSize,\n }: PullIdentifiersCommandFlags,\n): Promise<void> {\n if (skipRequestCount) {\n logger.info(\n colors.yellow(\n 'Skipping request count as requested. This may help speed up the call.',\n ),\n );\n }\n\n if (\n Number.isNaN(chunkSize) ||\n chunkSize <= 0 ||\n chunkSize % pageLimit !== 0\n ) {\n logger.error(\n colors.red(\n `Invalid chunk size: \"${chunkSize}\". Must be a positive integer that is a multiple of ${pageLimit}.`,\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process.exit);\n\n const { baseName, extension } = parseFilePath(file);\n let fileCount = 0;\n\n const onSave = async (chunk: CsvFormattedIdentifier[]): Promise<void> => {\n const numberedFileName = `${baseName}-${fileCount}${extension}`;\n logger.info(\n colors.blue(\n `Saving ${chunk.length} identifiers to file \"${numberedFileName}\"`,\n ),\n );\n\n const headers = uniq(chunk.map((d) => Object.keys(d)).flat());\n await writeLargeCsv(numberedFileName, chunk, headers);\n logger.info(\n colors.green(\n `Successfully wrote ${chunk.length} identifiers to file \"${numberedFileName}\"`,\n ),\n );\n fileCount += 1;\n return Promise.resolve();\n };\n\n // Pull down outstanding identifiers\n await pullChunkedCustomSiloOutstandingIdentifiers({\n transcendUrl,\n apiPageSize: pageLimit,\n savePageSize: chunkSize,\n onSave,\n actions,\n auth,\n sombraAuth,\n dataSiloId,\n skipRequestCount,\n });\n}\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkIHUCIK5Tcjs = require('./chunk-IHUCIK5T.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk56QKBG2Rcjs = require('./chunk-56QKBG2R.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkDQCPGPXGcjs = require('./chunk-DQCPGPXG.cjs');require('./chunk-7PB6LVSE.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);async function _({file:l,fileTarget:f,transcendUrl:p,auth:g,sombraAuth:v,cronDataSiloId:N,targetDataSiloId:R,actions:S,skipRequestCount:h,pageLimit:r,chunkSize:s}){h&&_chunkZUNVPK23cjs.a.info(_colors2.default.yellow("Skipping request count as requested. This may help speed up the call.")),(Number.isNaN(s)||s<=0||s%r!==0)&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Invalid chunk size: "${s}". Must be a positive integer that is a multiple of ${r}.`)),this.process.exit(1)),_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);let j=_chunk56QKBG2Rcjs.zc.call(void 0, p,g),{baseName:O,extension:A}=_chunk56QKBG2Rcjs.ug.call(void 0, l),{baseName:D,extension:k}=_chunk56QKBG2Rcjs.ug.call(void 0, f),$=0,b=0,d=0;await _chunkIHUCIK5Tcjs.g.call(void 0, {dataSiloId:N,auth:g,sombraAuth:v,actions:S,apiPageSize:r,savePageSize:s,onSave:async o=>{$+=o.length;let E=o.map(t=>t.requestId),G=_chunkDQCPGPXGcjs.j.call(void 0, E),L=_chunkDQCPGPXGcjs.b.call(void 0, G,r),y=await _chunk56QKBG2Rcjs.a.call(void 0, L,async t=>(_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Fetching target identifiers for ${t.length} requests`)),(await _chunk56QKBG2Rcjs.Ld.call(void 0, j,r*2,{requestIds:t,dataSiloIds:[R]})).map(({fileName:I,remoteId:C})=>{if(!C)throw new Error(`Failed to find remoteId for ${I}`);return{RecordId:C,Object:_optionalChain([I, 'access', _2 => _2.replace, 'call', _3 => _3(".json",""), 'access', _4 => _4.split, 'call', _5 => _5("/"), 'access', _6 => _6.pop, 'call', _7 => _7(), 'optionalAccess', _8 => _8.replace, 'call', _9 => _9(" Information","")]),Comment:"Customer data deletion request submitted via transcend.io"}})),{concurrency:1});b+=y.flat().length;let M=_chunkDQCPGPXGcjs.j.call(void 0, o.map(t=>Object.keys(t)).flat()),Q=`${O}-${d}${A}`,T=`${D}-${d}${k}`;await _chunk56QKBG2Rcjs.vg.call(void 0, Q,o,M),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully wrote ${o.length} identifiers to file "${l}"`));let n=y.flat(),V=_chunkDQCPGPXGcjs.j.call(void 0, n.map(t=>Object.keys(t)).flat());await _chunk56QKBG2Rcjs.vg.call(void 0, T,n,V),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully wrote ${n.length} identifiers to file "${f}"`)),_chunkZUNVPK23cjs.a.info(_colors2.default.blue(`Processed chunk of ${_chunkDQCPGPXGcjs.b.length} identifiers, found ${n.length} target identifiers`)),d+=1},transcendUrl:p,skipRequestCount:h}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully wrote ${$} identifiers to file "${l}"`)),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully wrote ${b} identifiers to file "${f}"`))}exports.pullProfiles = _;
2
+ //# sourceMappingURL=impl-GA6T4SCB.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-GA6T4SCB.cjs","../src/commands/request/cron/pull-profiles/impl.ts"],"names":["pullProfiles","file","fileTarget","transcendUrl","auth","sombraAuth","cronDataSiloId","targetDataSiloId","actions","skipRequestCount","pageLimit","chunkSize","logger","colors","doneInputValidation","client","buildTranscendGraphQLClient","baseName","extension","parseFilePath","baseNameTarget","extensionTarget","allIdentifiersCount","allTargetIdentifiersCount","fileCount","pullChunkedCustomSiloOutstandingIdentifiers","chunkToSave","requestIds","d","uniqueRequestIds","uniq_default","chunkedRequestIds","chunk_default","results","map","fetchRequestFilesForRequest","fileName","remoteId"],"mappings":"AAAA,quBAAwC,wDAAyC,wDAAyE,gCAA6B,wDAAyC,wDAAgD,gCAA6B,gFCE1R,MA6BnB,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CACF,CAAA,CACe,CACXF,CAAAA,EACFG,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,MAAA,CACL,uEACF,CACF,CAAA,CAAA,CAIA,MAAA,CAAO,KAAA,CAAMF,CAAS,CAAA,EACtBA,CAAAA,EAAa,CAAA,EACbA,CAAAA,CAAYD,CAAAA,GAAc,CAAA,CAAA,EAAA,CAE1BE,mBAAAA,CAAO,KAAA,CACLC,gBAAAA,CAAO,GAAA,CACL,CAAA,qBAAA,EAAwBF,CAAS,CAAA,oDAAA,EAAuDD,CAAS,CAAA,CAAA,CACnG,CACF,CAAA,CACA,IAAA,CAAK,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,CAAA,CAGrBI,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAGrC,IAAMC,CAAAA,CAASC,kCAAAA,CAA4Bb,CAAcC,CAAI,CAAA,CACvD,CAAE,QAAA,CAAAa,CAAAA,CAAU,SAAA,CAAAC,CAAU,CAAA,CAAIC,kCAAAA,CAAkB,CAAA,CAC5C,CAAE,QAAA,CAAUC,CAAAA,CAAgB,SAAA,CAAWC,CAAgB,CAAA,CAC3DF,kCAAAA,CAAwB,CAAA,CAEtBG,CAAAA,CAAsB,CAAA,CACtBC,CAAAA,CAA4B,CAAA,CAC5BC,CAAAA,CAAY,CAAA,CAmFhB,MAAMC,iCAAAA,CACJ,UAAA,CAAYnB,CAAAA,CACZ,IAAA,CAAAF,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,OAAA,CAAAG,CAAAA,CACA,WAAA,CAAaE,CAAAA,CACb,YAAA,CAAcC,CAAAA,CACd,MAAA,CAxFa,MACbe,CAAAA,EACkB,CAElBJ,CAAAA,EAAuBI,CAAAA,CAAY,MAAA,CAGnC,IAAMC,CAAAA,CAAaD,CAAAA,CAAY,GAAA,CAAKE,CAAAA,EAAMA,CAAAA,CAAE,SAAmB,CAAA,CACzDC,CAAAA,CAAmBC,iCAAAA,CAAe,CAAA,CAGlCC,CAAAA,CAAoBC,iCAAAA,CAAMH,CAAkBnB,CAAS,CAAA,CACrDuB,CAAAA,CAAU,MAAMC,iCAAAA,CACpBH,CACA,MAAOJ,CAAAA,EAAAA,CACLf,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,OAAA,CACL,CAAA,gCAAA,EAAmCc,CAAAA,CAAW,MAAM,CAAA,SAAA,CACtD,CACF,CAAA,CAAA,CACgB,MAAMQ,kCAAAA,CACpBpB,CACAL,CAAAA,CAAY,CAAA,CACZ,CACE,UAAA,CAAAiB,CAAAA,CACA,WAAA,CAAa,CAACpB,CAAgB,CAChC,CACF,CAAA,CAAA,CACe,GAAA,CAAI,CAAC,CAAE,QAAA,CAAA6B,CAAAA,CAAU,QAAA,CAAAC,CAAS,CAAA,CAAA,EAAM,CAC7C,EAAA,CAAI,CAACA,CAAAA,CACH,MAAM,IAAI,KAAA,CAAM,CAAA,4BAAA,EAA+BD,CAAQ,CAAA,CAAA","file":"/home/runner/work/cli/cli/dist/impl-GA6T4SCB.cjs","sourcesContent":[null,"import type { RequestAction } from '@transcend-io/privacy-types';\nimport { logger } from '../../../../logger';\nimport colors from 'colors';\nimport { uniq, chunk } from 'lodash-es';\nimport { map } from '../../../../lib/bluebird';\nimport {\n buildTranscendGraphQLClient,\n fetchRequestFilesForRequest,\n} from '../../../../lib/graphql';\nimport type { LocalContext } from '../../../../context';\nimport {\n pullChunkedCustomSiloOutstandingIdentifiers,\n type CsvFormattedIdentifier,\n} from '../../../../lib/cron';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\nimport { parseFilePath, writeLargeCsv } from '../../../../lib/helpers';\n\nexport interface PullProfilesCommandFlags {\n file: string;\n fileTarget: string;\n transcendUrl: string;\n auth: string;\n sombraAuth?: string;\n cronDataSiloId: string;\n targetDataSiloId: string;\n actions: RequestAction[];\n skipRequestCount: boolean;\n pageLimit: number;\n chunkSize: number;\n}\n\nexport async function pullProfiles(\n this: LocalContext,\n {\n file,\n fileTarget,\n transcendUrl,\n auth,\n sombraAuth,\n cronDataSiloId,\n targetDataSiloId,\n actions,\n skipRequestCount,\n pageLimit,\n chunkSize,\n }: PullProfilesCommandFlags,\n): Promise<void> {\n if (skipRequestCount) {\n logger.info(\n colors.yellow(\n 'Skipping request count as requested. This may help speed up the call.',\n ),\n );\n }\n\n if (\n Number.isNaN(chunkSize) ||\n chunkSize <= 0 ||\n chunkSize % pageLimit !== 0\n ) {\n logger.error(\n colors.red(\n `Invalid chunk size: \"${chunkSize}\". Must be a positive integer that is a multiple of ${pageLimit}.`,\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process.exit);\n\n // Create GraphQL client to connect to Transcend backend\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const { baseName, extension } = parseFilePath(file);\n const { baseName: baseNameTarget, extension: extensionTarget } =\n parseFilePath(fileTarget);\n\n let allIdentifiersCount = 0;\n let allTargetIdentifiersCount = 0;\n let fileCount = 0;\n // Create onSave callback to handle chunked processing\n const onSave = async (\n chunkToSave: CsvFormattedIdentifier[],\n ): Promise<void> => {\n // Add to all identifiers\n allIdentifiersCount += chunkToSave.length;\n\n // Get unique request IDs from this chunk\n const requestIds = chunkToSave.map((d) => d.requestId as string);\n const uniqueRequestIds = uniq(requestIds);\n\n // Pull down target identifiers for this chunk\n const chunkedRequestIds = chunk(uniqueRequestIds, pageLimit);\n const results = await map(\n chunkedRequestIds,\n async (requestIds) => {\n logger.info(\n colors.magenta(\n `Fetching target identifiers for ${requestIds.length} requests`,\n ),\n );\n const results = await fetchRequestFilesForRequest(\n client,\n pageLimit * 2,\n {\n requestIds,\n dataSiloIds: [targetDataSiloId],\n },\n );\n return results.map(({ fileName, remoteId }) => {\n if (!remoteId) {\n throw new Error(`Failed to find remoteId for ${fileName}`);\n }\n return {\n RecordId: remoteId,\n Object: fileName\n .replace('.json', '')\n .split('/')\n .pop()\n ?.replace(' Information', ''),\n Comment:\n 'Customer data deletion request submitted via transcend.io',\n };\n });\n },\n // We are grabbing all the request files for the 'pageLimit' # of requests at a time\n {\n concurrency: 1,\n },\n );\n\n allTargetIdentifiersCount += results.flat().length;\n\n // Write the identifiers and target identifiers to CSV\n const headers = uniq(chunkToSave.map((d) => Object.keys(d)).flat());\n const numberedFileName = `${baseName}-${fileCount}${extension}`;\n const numberedFileNameTarget = `${baseNameTarget}-${fileCount}${extensionTarget}`;\n await writeLargeCsv(numberedFileName, chunkToSave, headers);\n logger.info(\n colors.green(\n `Successfully wrote ${chunkToSave.length} identifiers to file \"${file}\"`,\n ),\n );\n\n const targetIdentifiers = results.flat();\n const headers2 = uniq(targetIdentifiers.map((d) => Object.keys(d)).flat());\n await writeLargeCsv(numberedFileNameTarget, targetIdentifiers, headers2);\n logger.info(\n colors.green(\n `Successfully wrote ${targetIdentifiers.length} identifiers to file \"${fileTarget}\"`,\n ),\n );\n\n logger.info(\n colors.blue(\n `Processed chunk of ${chunk.length} identifiers, found ${targetIdentifiers.length} target identifiers`,\n ),\n );\n fileCount += 1;\n };\n\n // Pull down outstanding identifiers using the new chunked function\n await pullChunkedCustomSiloOutstandingIdentifiers({\n dataSiloId: cronDataSiloId,\n auth,\n sombraAuth,\n actions,\n apiPageSize: pageLimit,\n savePageSize: chunkSize,\n onSave,\n transcendUrl,\n skipRequestCount,\n });\n\n logger.info(\n colors.green(\n `Successfully wrote ${allIdentifiersCount} identifiers to file \"${file}\"`,\n ),\n );\n logger.info(\n colors.green(\n `Successfully wrote ${allTargetIdentifiersCount} identifiers to file \"${fileTarget}\"`,\n ),\n );\n}\n"]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk55B57ZAYcjs = require('./chunk-55B57ZAY.cjs');require('./chunk-TSJTXXLZ.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-XXFLFF7Q.cjs');require('./chunk-7PB6LVSE.cjs');async function h({auth:i,enricherId:s,actions:o,requestEnricherStatuses:a,requestIds:c,createdAtBefore:e,createdAtAfter:t,concurrency:u,transcendUrl:d}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),await _chunk55B57ZAYcjs.Of.call(void 0, {auth:i,enricherId:s,requestActions:o,requestEnricherStatuses:a,requestIds:c,createdAtBefore:e?new Date(e):void 0,createdAtAfter:t?new Date(t):void 0,concurrency:u,transcendUrl:d})}exports.enricherRestart = h;
2
- //# sourceMappingURL=impl-RD5UOJY6.cjs.map
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk56QKBG2Rcjs = require('./chunk-56QKBG2R.cjs');require('./chunk-TSJTXXLZ.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-DQCPGPXG.cjs');require('./chunk-7PB6LVSE.cjs');async function h({auth:i,enricherId:s,actions:o,requestEnricherStatuses:a,requestIds:c,createdAtBefore:e,createdAtAfter:t,concurrency:u,transcendUrl:d}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),await _chunk56QKBG2Rcjs.Qf.call(void 0, {auth:i,enricherId:s,requestActions:o,requestEnricherStatuses:a,requestIds:c,createdAtBefore:e?new Date(e):void 0,createdAtAfter:t?new Date(t):void 0,concurrency:u,transcendUrl:d})}exports.enricherRestart = h;
2
+ //# sourceMappingURL=impl-GG3S2VBT.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-RD5UOJY6.cjs","../src/commands/request/enricher-restart/impl.ts"],"names":["enricherRestart","auth","enricherId","actions","requestEnricherStatuses","requestIds","createdAtBefore","createdAtAfter","concurrency","transcendUrl","doneInputValidation","bulkRetryEnrichers"],"mappings":"AAAA,iIAAwC,wDAA0C,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCoBtM,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,uBAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,MAAMC,kCAAAA,CACJ,IAAA,CAAAV,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,cAAA,CAAgBC,CAAAA,CAChB,uBAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,eAAA,CAAiBC,CAAAA,CAAkB,IAAI,IAAA,CAAKA,CAAe,CAAA,CAAI,KAAA,CAAA,CAC/D,cAAA,CAAgBC,CAAAA,CAAiB,IAAI,IAAA,CAAKA,CAAc,CAAA,CAAI,KAAA,CAAA,CAC5D,WAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAC,CACH,CAAA,4BAAA","file":"/home/runner/work/cli/cli/dist/impl-RD5UOJY6.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { bulkRetryEnrichers } from '../../../lib/requests';\nimport type {\n RequestAction,\n RequestEnricherStatus,\n} from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface EnricherRestartCommandFlags {\n auth: string;\n enricherId: string;\n actions?: RequestAction[];\n requestEnricherStatuses?: RequestEnricherStatus[];\n transcendUrl: string;\n concurrency: number;\n requestIds?: string[];\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n}\n\nexport async function enricherRestart(\n this: LocalContext,\n {\n auth,\n enricherId,\n actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore,\n createdAtAfter,\n concurrency,\n transcendUrl,\n }: EnricherRestartCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await bulkRetryEnrichers({\n auth,\n enricherId,\n requestActions: actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore: createdAtBefore ? new Date(createdAtBefore) : undefined,\n createdAtAfter: createdAtAfter ? new Date(createdAtAfter) : undefined,\n concurrency,\n transcendUrl,\n });\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-GG3S2VBT.cjs","../src/commands/request/enricher-restart/impl.ts"],"names":["enricherRestart","auth","enricherId","actions","requestEnricherStatuses","requestIds","createdAtBefore","createdAtAfter","concurrency","transcendUrl","doneInputValidation","bulkRetryEnrichers"],"mappings":"AAAA,iIAAwC,wDAA0C,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCoBtM,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,uBAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,MAAMC,kCAAAA,CACJ,IAAA,CAAAV,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,cAAA,CAAgBC,CAAAA,CAChB,uBAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,eAAA,CAAiBC,CAAAA,CAAkB,IAAI,IAAA,CAAKA,CAAe,CAAA,CAAI,KAAA,CAAA,CAC/D,cAAA,CAAgBC,CAAAA,CAAiB,IAAI,IAAA,CAAKA,CAAc,CAAA,CAAI,KAAA,CAAA,CAC5D,WAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAC,CACH,CAAA,4BAAA","file":"/home/runner/work/cli/cli/dist/impl-GG3S2VBT.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { bulkRetryEnrichers } from '../../../lib/requests';\nimport type {\n RequestAction,\n RequestEnricherStatus,\n} from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface EnricherRestartCommandFlags {\n auth: string;\n enricherId: string;\n actions?: RequestAction[];\n requestEnricherStatuses?: RequestEnricherStatus[];\n transcendUrl: string;\n concurrency: number;\n requestIds?: string[];\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n}\n\nexport async function enricherRestart(\n this: LocalContext,\n {\n auth,\n enricherId,\n actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore,\n createdAtAfter,\n concurrency,\n transcendUrl,\n }: EnricherRestartCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await bulkRetryEnrichers({\n auth,\n enricherId,\n requestActions: actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore: createdAtBefore ? new Date(createdAtBefore) : undefined,\n createdAtAfter: createdAtAfter ? new Date(createdAtAfter) : undefined,\n concurrency,\n transcendUrl,\n });\n}\n"]}
@@ -0,0 +1,7 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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 _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk56QKBG2Rcjs = require('./chunk-56QKBG2R.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkDQCPGPXGcjs = require('./chunk-DQCPGPXG.cjs');var _chunk7PB6LVSEcjs = require('./chunk-7PB6LVSE.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _got = require('got'); var _got2 = _interopRequireDefault(_got);var B=({hostname:t,auth:e})=>_got2.default.extend({prefixUrl:`https://${t}`,headers:{accept:"application/json","content-type":"application/json",authorization:`Bearer ${e}`}});var _yargsparser = require('yargs-parser'); var _yargsparser2 = _interopRequireDefault(_yargsparser);var ve=Object.values(_chunk7PB6LVSEcjs.b);var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);var w=({assessment:t,index:e,total:s,wrap:r=!0})=>{let n="";(e===0||r)&&(n=`[
2
+ `);let m=JSON.stringify(t),o=s&&e<s-1&&!r?",":"";return n=`${n+m+o}
3
+ `,(s&&e===s-1||r)&&(n+=`
4
+ ]`),n};var J=({file:t,assessment:e,index:s,total:r})=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Writing enriched assessment ${s+1} of ${r} to file "${t}"...`)),s===0?_fs2.default.writeFileSync(t,w({assessment:e,index:s,total:r,wrap:!1})):_fs2.default.appendFileSync(t,w({assessment:e,index:s,total:r,wrap:!1}))};var _typeutils = require('@transcend-io/type-utils');var _privacytypes = require('@transcend-io/privacy-types');var K=async({oneTrust:t})=>{let e=0,s=1,r=0,n=[];for(;e<s;){let{body:m}=await t.get(`api/assessment/v2/assessments?page=${e}&size=2000`),{page:o,content:u}=_typeutils.decodeCodec.call(void 0, _privacytypes.OneTrustGetListOfAssessmentsResponse,m);n.push(..._nullishCoalesce(u, () => ([]))),e===0&&(s=_nullishCoalesce(_optionalChain([o, 'optionalAccess', _2 => _2.totalPages]), () => (0)),r=_nullishCoalesce(_optionalChain([o, 'optionalAccess', _3 => _3.totalElements]), () => (0))),e+=1,_chunkZUNVPK23cjs.a.info(`Fetched ${n.length} of ${r} assessments.`)}return n};var W=async({oneTrust:t,assessmentId:e})=>{let{body:s}=await t.get(`api/assessment/v2/assessments/${e}/export?ExcludeSkippedQuestions=false`);return _typeutils.decodeCodec.call(void 0, _privacytypes.OneTrustGetAssessmentResponse,s)};var H=async({oneTrust:t,riskId:e})=>{let{body:s}=await t.get(`api/risk/v2/risks/${e}`);return _typeutils.decodeCodec.call(void 0, _privacytypes.OneTrustGetRiskResponse,s)};var k=async({oneTrust:t,userId:e})=>{let{body:s}=await t.get(`api/scim/v2/Users/${e}`);return _typeutils.decodeCodec.call(void 0, _privacytypes.OneTrustGetUserResponse,s)};var z=({assessment:t,assessmentDetails:e,riskDetails:s,creatorDetails:r,approversDetails:n,respondentsDetails:m})=>{let o=_chunkDQCPGPXGcjs.e.call(void 0, s,"id"),{sections:u,createdBy:h,...g}=e,O=u.map(i=>{let{questions:A,...$}=i,x=A.map(E=>{let{risks:U,...G}=E,v=(_nullishCoalesce(U, () => ([]))).map(y=>{let S=o[y.riskId];return{...y,...S,level:y.level,impactLevel:_nullishCoalesce(y.impactLevel, () => (0))}});return{...G,risks:v}});return{...$,questions:x}}),p={...h,active:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _4 => _4.active]), () => (!1)),userType:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _5 => _5.userType]), () => ("Internal")),emails:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _6 => _6.emails]), () => ([])),title:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _7 => _7.title]), () => (null)),givenName:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _8 => _8.name, 'access', _9 => _9.givenName]), () => (null)),familyName:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _10 => _10.name, 'access', _11 => _11.familyName]), () => (null))},d=_chunkDQCPGPXGcjs.e.call(void 0, n,"id"),l=e.approvers.flatMap(i=>d[i.id]?[{...i,approver:{...i.approver,active:d[i.id].active,userType:d[i.id].userType,emails:d[i.id].emails,title:d[i.id].title,givenName:_nullishCoalesce(d[i.id].name.givenName, () => (null)),familyName:_nullishCoalesce(d[i.id].name.familyName, () => (null))}}]:[]),T=_chunkDQCPGPXGcjs.e.call(void 0, m,"id"),C=e.respondents.filter(i=>!i.name.includes("@")).flatMap(i=>T[i.id]?[{...i,active:T[i.id].active,userType:T[i.id].userType,emails:T[i.id].emails,title:T[i.id].title,givenName:_nullishCoalesce(T[i.id].name.givenName, () => (null)),familyName:_nullishCoalesce(T[i.id].name.familyName, () => (null))}]:[]);return{...t,...g,approvers:l,respondents:C,createdBy:p,sections:O}};var F=async({transcend:t,assessment:e,total:s,index:r})=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Writing enriched assessment ${r+1} ${s?`of ${s} `:" "}to Transcend...`));let m={json:w({assessment:e,index:r,total:s})};try{await _chunk56QKBG2Rcjs.wg.call(void 0, t,_chunk56QKBG2Rcjs.ia,{input:m})}catch (e2){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to sync assessment ${r+1} ${s?`of ${s} `:" "}to Transcend.
5
+ Assessment Title: ${e.name}. Template Title: ${e.template.name}
6
+ `))}};var Y=async({oneTrust:t,file:e,dryRun:s,transcend:r})=>{_chunkZUNVPK23cjs.a.info("Getting list of all assessments from OneTrust...");let n=await K({oneTrust:t}),m={},o=5,u=Array.from({length:Math.ceil(n.length/o)},(h,g)=>n.slice(g*o,(g+1)*o));await _chunk56QKBG2Rcjs.b.call(void 0, u,async(h,g)=>{let O=[];await _chunk56QKBG2Rcjs.a.call(void 0, h,async(p,d)=>{let l=o*g+d+1;_chunkZUNVPK23cjs.a.info(`[assessment ${l} of ${n.length}]: fetching details...`);let{templateName:T,assessmentId:C}=p,i=await W({oneTrust:t,assessmentId:C}),A=i.createdBy.id,$=m[A];if(!$){_chunkZUNVPK23cjs.a.info(`[assessment ${l} of ${n.length}]: fetching creator...`);try{$=await k({oneTrust:t,userId:A}),m[A]=$}catch (e3){_chunkZUNVPK23cjs.a.warn(_colors2.default.yellow(`[assessment ${l} of ${n.length}]: failed to fetch form creator. creatorId: ${A}. Assessment Title: ${p.name}. Template Title: ${T}`))}}let{approvers:x}=i,E=[];x.length>0&&(_chunkZUNVPK23cjs.a.info(`[assessment ${l} of ${n.length}]: fetching approvers...`),E=await _chunk56QKBG2Rcjs.a.call(void 0, x.map(({id:c})=>c),async c=>{try{let f=m[c];return f||(f=await k({oneTrust:t,userId:c}),m[c]=f),[f]}catch (e4){return _chunkZUNVPK23cjs.a.warn(_colors2.default.yellow(`[assessment ${l} of ${n.length}]: failed to fetch a form approver. approverId: ${c}. Assessment Title: ${p.name}. Template Title: ${T}`)),[]}},{concurrency:5}));let{respondents:U}=i,G=U.filter(c=>!c.name.includes("@")),v=[];G.length>0&&(_chunkZUNVPK23cjs.a.info(`[assessment ${l} of ${n.length}]: fetching respondents...`),v=await _chunk56QKBG2Rcjs.a.call(void 0, G.map(({id:c})=>c),async c=>{try{let f=m[c];return f||(f=await k({oneTrust:t,userId:c}),m[c]=f),[f]}catch (e5){return _chunkZUNVPK23cjs.a.warn(_colors2.default.yellow(`[assessment ${l} of ${n.length}]: failed to fetch a respondent. respondentId: ${c}. Assessment Title: ${p.name}. Template Title: ${T}`)),[]}},{concurrency:5}));let y=[],S=_chunkDQCPGPXGcjs.j.call(void 0, i.sections.flatMap(c=>c.questions.flatMap(f=>(_nullishCoalesce(f.risks, () => ([]))).flatMap(ee=>ee.riskId))));S.length>0&&(_chunkZUNVPK23cjs.a.info(`[assessment ${l} of ${n.length}]: fetching risks...`),y=await _chunk56QKBG2Rcjs.a.call(void 0, S,c=>H({oneTrust:t,riskId:c}),{concurrency:5}));let X=z({assessment:p,assessmentDetails:i,riskDetails:y,creatorDetails:$,approversDetails:E.flat(),respondentsDetails:v.flat()});O.push(X)},{concurrency:o}),await _chunk56QKBG2Rcjs.b.call(void 0, O,async(p,d)=>{let l=g*o+d;s&&e?J({assessment:p,index:l,total:n.length,file:e}):r&&await F({assessment:p,transcend:r,total:n.length,index:l})})})};var _JSONStream = require('JSONStream'); var _JSONStream2 = _interopRequireDefault(_JSONStream);var Z=({transcend:t,file:e})=>(_chunkZUNVPK23cjs.a.info(`Getting list of all assessments from file ${e}...`),new Promise((s,r)=>{let n=_fs.createReadStream.call(void 0, e,{encoding:"utf-8",highWaterMark:65536}),m=_JSONStream2.default.parse("*"),o=0;n.pipe(m),m.on("data",async u=>{try{m.pause();let h=_typeutils.decodeCodec.call(void 0, _privacytypes.OneTrustEnrichedAssessment,u);await F({assessment:h,transcend:t,index:o}),o+=1,m.resume()}catch(h){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to parse the assessment ${o} from file '${e}': ${h.message}.`))}}),m.on("end",()=>{_chunkZUNVPK23cjs.a.info(`Finished processing ${o} assessments from file ${e}`),s()}),m.on("error",u=>{_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Error parsing file '${e}': ${u.message}`)),r(u)}),n.on("error",u=>{_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Error reading file '${e}': ${u.message}`)),r(u)})}));async function Ds({hostname:t,oneTrustAuth:e,source:s,transcendAuth:r,transcendUrl:n,resource:m,file:o,dryRun:u,debug:h}){if(!u&&!r)throw new Error('Must specify a "transcendAuth" parameter to sync resources to Transcend. e.g. --transcendAuth=${TRANSCEND_API_KEY}');if(u&&!o)throw new Error('Must set a "file" parameter when "dryRun" is "true". e.g. --file=./oneTrustAssessments.json');if(o){let p=o.split(".");if(p.length<2)throw new Error('The "file" parameter has an invalid format. Expected a path with extensions. e.g. --file=./pathToFile.json.');if(p.at(-1)!=="json")throw new Error(`Expected the format of the "file" parameters '${o}' to be 'json', but got '${p.at(-1)}'.`)}if(s==="oneTrust"){if(!t)throw new Error('Missing required parameter "hostname". e.g. --hostname=customer.my.onetrust.com');if(!e)throw new Error('Missing required parameter "oneTrustAuth". e.g. --oneTrustAuth=$ONE_TRUST_AUTH_TOKEN')}else{if(!o)throw new Error('Must specify a "file" parameter to read the OneTrust assessments from. e.g. --source=./oneTrustAssessments.json');if(u)throw new Error('Cannot read and write to a file simultaneously. Emit the "source" parameter or set it to oneTrust if "dryRun" is enabled.')}_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);let g=t&&e?B({hostname:t,auth:e}):void 0,O=n&&r?_chunk56QKBG2Rcjs.zc.call(void 0, n,r):void 0;try{m==="assessments"&&(s==="oneTrust"&&g?await Y({oneTrust:g,file:o,dryRun:u,...O&&{transcend:O}}):s==="file"&&o&&O&&await Z({file:o,transcend:O}))}catch(p){throw new Error(`An error occurred syncing the resource ${m} from OneTrust: ${h?p.stack:p.message}`)}_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced OneTrust ${m} to ${u?`disk at "${o}"`:"Transcend"}!`))}exports.syncOt = Ds;
7
+ //# sourceMappingURL=impl-GZNNNSYW.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-BQNXMBQ4.cjs","../src/commands/migration/sync-ot/impl.ts","../src/lib/oneTrust/createOneTrustGotInstance.ts","../src/lib/oneTrust/helpers/oneTrustAssessmentToJson.ts","../src/lib/oneTrust/endpoints/getListOfOneTrustAssessments.ts","../src/lib/oneTrust/helpers/syncOneTrustAssessmentToTranscend.ts","../src/lib/oneTrust/helpers/syncOneTrustAssessmentsFromOneTrust.ts"],"names":["createOneTrustGotInstance","hostname","auth","got"],"mappings":"AAAA,y0BAAwC,wDAA0D,gCAA6B,wDAAoC,wDAAgD,wDAAyC,gFCEzO,oECFM,IAQZA,CAAAA,CAA4B,CAAC,CACxC,QAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CACF,CAAA,CAAA,EAMEC,aAAAA,CAAI,MAAA,CAAO,CACT,SAAA,CAAW,CAAA,QAAA,EAAWF,CAAQ,CAAA,CAAA;ACiBwB;AAIzC;AClCf,CAAA;ACsE2F,mBAAA;ACC3B","file":"/home/runner/work/cli/cli/dist/impl-BQNXMBQ4.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { logger } from '../../../logger';\nimport colors from 'colors';\nimport { createOneTrustGotInstance } from '../../../lib/oneTrust';\nimport {\n OneTrustFileFormat,\n OneTrustPullResource,\n OneTrustPullSource,\n} from '../../../enums';\nimport { buildTranscendGraphQLClient } from '../../../lib/graphql';\nimport {\n syncOneTrustAssessmentsFromFile,\n syncOneTrustAssessmentsFromOneTrust,\n} from '../../../lib/oneTrust/helpers';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\n// Command flag interface\nexport interface SyncOtCommandFlags {\n hostname?: string;\n oneTrustAuth?: string;\n source: OneTrustPullSource;\n transcendAuth?: string;\n transcendUrl: string;\n file?: string;\n resource: OneTrustPullResource;\n dryRun: boolean;\n debug: boolean;\n}\n\n// Command implementation\nexport async function syncOt(\n this: LocalContext,\n {\n hostname,\n oneTrustAuth,\n source,\n transcendAuth,\n transcendUrl,\n resource,\n file,\n dryRun,\n debug,\n }: SyncOtCommandFlags,\n): Promise<void> {\n // Must be able to authenticate to transcend to sync resources to it\n if (!dryRun && !transcendAuth) {\n throw new Error(\n // eslint-disable-next-line no-template-curly-in-string\n 'Must specify a \"transcendAuth\" parameter to sync resources to Transcend. e.g. --transcendAuth=${TRANSCEND_API_KEY}',\n );\n }\n\n // If trying to sync to disk, must specify a file path\n if (dryRun && !file) {\n throw new Error(\n 'Must set a \"file\" parameter when \"dryRun\" is \"true\". e.g. --file=./oneTrustAssessments.json',\n );\n }\n\n if (file) {\n const splitFile = file.split('.');\n if (splitFile.length < 2) {\n throw new Error(\n 'The \"file\" parameter has an invalid format. Expected a path with extensions. e.g. --file=./pathToFile.json.',\n );\n }\n if (splitFile.at(-1) !== OneTrustFileFormat.Json) {\n throw new Error(\n `Expected the format of the \"file\" parameters '${file}' to be '${\n OneTrustFileFormat.Json\n }', but got '${splitFile.at(-1)}'.`,\n );\n }\n }\n\n // if reading assessments from a OneTrust\n if (source === OneTrustPullSource.OneTrust) {\n // must specify the OneTrust hostname\n if (!hostname) {\n throw new Error(\n 'Missing required parameter \"hostname\". e.g. --hostname=customer.my.onetrust.com',\n );\n }\n // must specify the OneTrust auth\n if (!oneTrustAuth) {\n throw new Error(\n 'Missing required parameter \"oneTrustAuth\". e.g. --oneTrustAuth=$ONE_TRUST_AUTH_TOKEN',\n );\n }\n } else {\n // if reading the assessments from a file, must specify a file to read from\n if (!file) {\n throw new Error(\n 'Must specify a \"file\" parameter to read the OneTrust assessments from. e.g. --source=./oneTrustAssessments.json',\n );\n }\n\n // Cannot try reading from file and save assessments to a file simultaneously\n if (dryRun) {\n throw new Error(\n 'Cannot read and write to a file simultaneously.' +\n ` Emit the \"source\" parameter or set it to ${OneTrustPullSource.OneTrust} if \"dryRun\" is enabled.`,\n );\n }\n }\n\n doneInputValidation(this.process.exit);\n\n // instantiate a client to talk to OneTrust\n const oneTrust =\n hostname && oneTrustAuth\n ? createOneTrustGotInstance({\n hostname,\n auth: oneTrustAuth,\n })\n : undefined;\n\n // instantiate a client to talk to Transcend\n const transcend =\n transcendUrl && transcendAuth\n ? buildTranscendGraphQLClient(transcendUrl, transcendAuth)\n : undefined;\n\n try {\n if (resource === OneTrustPullResource.Assessments) {\n if (source === OneTrustPullSource.OneTrust && oneTrust) {\n await syncOneTrustAssessmentsFromOneTrust({\n oneTrust,\n file,\n dryRun,\n ...(transcend && { transcend }),\n });\n } else if (source === OneTrustPullSource.File && file && transcend) {\n await syncOneTrustAssessmentsFromFile({ file, transcend });\n }\n }\n } catch (err) {\n throw new Error(\n `An error occurred syncing the resource ${resource} from OneTrust: ${\n debug ? err.stack : err.message\n }`,\n );\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced OneTrust ${resource} to ${\n dryRun ? `disk at \"${file}\"` : 'Transcend'\n }!`,\n ),\n );\n}\n","import got, { Got } from 'got';\n\n/**\n * Instantiate an instance of got that is capable of making requests to OneTrust\n *\n * @param param - information about the OneTrust URL\n * @returns The instance of got that is capable of making requests to the customer ingress\n */\nexport const createOneTrustGotInstance = ({\n hostname,\n auth,\n}: {\n /** Hostname of the OneTrust API */\n hostname: string;\n /** The OAuth access token */\n auth: string;\n}): Got =>\n got.extend({\n prefixUrl: `https://${hostname}`,\n headers: {\n accept: 'application/json',\n 'content-type': 'application/json',\n authorization: `Bearer ${auth}`,\n },\n });\n","import { OneTrustEnrichedAssessment } from '@transcend-io/privacy-types';\n\n/**\n * Converts the assessment into a json entry.\n *\n * @param param - information about the assessment and amount of entries\n * @returns a stringified json entry ready to be appended to a file\n */\nexport const oneTrustAssessmentToJson = ({\n assessment,\n index,\n total,\n wrap = true,\n}: {\n /** The assessment to convert */\n assessment: OneTrustEnrichedAssessment;\n /** The position of the assessment in the final Json object */\n index: number;\n /** The total amount of the assessments in the final Json object */\n total?: number;\n /** Whether to wrap every entry in brackets */\n wrap?: boolean;\n}): string => {\n let jsonEntry = '';\n // start with an opening bracket\n if (index === 0 || wrap) {\n jsonEntry = '[\\n';\n }\n\n const stringifiedAssessment = JSON.stringify(assessment);\n\n // Add comma for all items except the last one\n const comma = total && index < total - 1 && !wrap ? ',' : '';\n\n // write to file\n jsonEntry = `${jsonEntry + stringifiedAssessment + comma}\\n`;\n\n // end with closing bracket\n if ((total && index === total - 1) || wrap) {\n jsonEntry += '\\n]';\n }\n\n return jsonEntry;\n};\n","import { Got } from 'got';\nimport { logger } from '../../../logger';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport {\n OneTrustAssessment,\n OneTrustGetListOfAssessmentsResponse,\n} from '@transcend-io/privacy-types';\n\n/**\n * Fetch a list of all assessments from the OneTrust client.\n * ref: https://developer.onetrust.com/onetrust/reference/getallassessmentbasicdetailsusingget\n *\n * @param param - the information about the OneTrust client\n * @returns a list of OneTrustAssessment\n */\nexport const getListOfOneTrustAssessments = async ({\n oneTrust,\n}: {\n /** The OneTrust client instance */\n oneTrust: Got;\n}): Promise<OneTrustAssessment[]> => {\n let currentPage = 0;\n let totalPages = 1;\n let totalElements = 0;\n\n const allAssessments: OneTrustAssessment[] = [];\n\n while (currentPage < totalPages) {\n const { body } = await oneTrust.get(\n `api/assessment/v2/assessments?page=${currentPage}&size=2000`,\n );\n\n const { page, content } = decodeCodec(\n OneTrustGetListOfAssessmentsResponse,\n body,\n );\n allAssessments.push(...(content ?? []));\n if (currentPage === 0) {\n totalPages = page?.totalPages ?? 0;\n totalElements = page?.totalElements ?? 0;\n }\n currentPage += 1;\n\n // log progress\n logger.info(\n `Fetched ${allAssessments.length} of ${totalElements} assessments.`,\n );\n }\n\n return allAssessments;\n};\n","import { logger } from '../../../logger';\nimport colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport {\n IMPORT_ONE_TRUST_ASSESSMENT_FORMS,\n makeGraphQLRequest,\n} from '../../graphql';\nimport { ImportOnetrustAssessmentsInput } from '../../../codecs';\nimport { OneTrustEnrichedAssessment } from '@transcend-io/privacy-types';\nimport { oneTrustAssessmentToJson } from './oneTrustAssessmentToJson';\n\nexport interface AssessmentForm {\n /** ID of Assessment Form */\n id: string;\n /** Title of Assessment Form */\n name: string;\n}\n\n/**\n * Write the assessment to a Transcend instance.\n *\n *\n * @param param - information about the assessment and Transcend instance to write to\n */\nexport const syncOneTrustAssessmentToTranscend = async ({\n transcend,\n assessment,\n total,\n index,\n}: {\n /** the Transcend client instance */\n transcend: GraphQLClient;\n /** the assessment to sync to Transcend */\n assessment: OneTrustEnrichedAssessment;\n /** The index of the assessment being written to the file */\n index: number;\n /** The total amount of assessments that we will write */\n total?: number;\n}): Promise<void> => {\n logger.info(\n colors.magenta(\n `Writing enriched assessment ${index + 1} ${\n total ? `of ${total} ` : ' '\n }to Transcend...`,\n ),\n );\n\n // convert the OneTrust assessment object into a json record\n const json = oneTrustAssessmentToJson({\n assessment,\n index,\n total,\n });\n\n // transform the json record into a valid input to the mutation\n const input: ImportOnetrustAssessmentsInput = {\n json,\n };\n\n try {\n await makeGraphQLRequest<{\n /** the importOneTrustAssessmentForms mutation */\n importOneTrustAssessmentForms: {\n /** Created Assessment Forms */\n assessmentForms: AssessmentForm[];\n };\n }>(transcend, IMPORT_ONE_TRUST_ASSESSMENT_FORMS, {\n input,\n });\n } catch (e) {\n logger.error(\n colors.red(\n `Failed to sync assessment ${index + 1} ${\n total ? `of ${total} ` : ' '\n }to Transcend.\\n` +\n `\\tAssessment Title: ${assessment.name}. Template Title: ${assessment.template.name}\\n`,\n ),\n );\n }\n};\n","import type { Got } from 'got';\nimport colors from 'colors';\nimport {\n getListOfOneTrustAssessments,\n getOneTrustAssessment,\n getOneTrustRisk,\n getOneTrustUser,\n} from '../endpoints';\nimport { mapSeries, map } from 'bluebird';\nimport { logger } from '../../../logger';\nimport {\n OneTrustAssessmentQuestion,\n OneTrustAssessmentSection,\n OneTrustEnrichedAssessment,\n OneTrustGetRiskResponse,\n OneTrustGetUserResponse,\n} from '@transcend-io/privacy-types';\nimport { uniq } from 'lodash-es';\nimport { enrichOneTrustAssessment } from './enrichOneTrustAssessment';\nimport { syncOneTrustAssessmentToDisk } from './syncOneTrustAssessmentToDisk';\nimport { GraphQLClient } from 'graphql-request';\nimport { syncOneTrustAssessmentToTranscend } from './syncOneTrustAssessmentToTranscend';\n\nexport interface AssessmentForm {\n /** ID of Assessment Form */\n id: string;\n /** Title of Assessment Form */\n name: string;\n}\n\n/**\n * Reads all the assessments from a OneTrust instance and syncs them to Transcend or to Disk.\n *\n * @param param - the information about the assessment, its OneTrust source, and destination (disk or Transcend)\n */\nexport const syncOneTrustAssessmentsFromOneTrust = async ({\n oneTrust,\n file,\n dryRun,\n transcend,\n}: {\n /** the OneTrust client instance */\n oneTrust: Got;\n /** the Transcend client instance */\n transcend?: GraphQLClient;\n /** Whether to write to file instead of syncing to Transcend */\n dryRun: boolean;\n /** the path to the file in case dryRun is true */\n file?: string;\n}): Promise<void> => {\n // fetch the list of all assessments in the OneTrust organization\n logger.info('Getting list of all assessments from OneTrust...');\n const assessments = await getListOfOneTrustAssessments({ oneTrust });\n\n // a cache of OneTrust users so we avoid requesting already fetched users\n const oneTrustCachedUsers: Record<string, OneTrustGetUserResponse> = {};\n\n // split all assessments in batches, so we can process some of steps in parallel\n const BATCH_SIZE = 5;\n const assessmentBatches = Array.from(\n {\n length: Math.ceil(assessments.length / BATCH_SIZE),\n },\n (_, i) => assessments.slice(i * BATCH_SIZE, (i + 1) * BATCH_SIZE),\n );\n\n // process each batch and sync the batch right away so it's garbage collected and we don't run out of memory\n await mapSeries(assessmentBatches, async (assessmentBatch, batch) => {\n const batchEnrichedAssessments: OneTrustEnrichedAssessment[] = [];\n\n // fetch assessment details from OneTrust in parallel\n await map(\n assessmentBatch,\n async (assessment, index) => {\n const assessmentNumber = BATCH_SIZE * batch + index + 1;\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching details...`,\n );\n const { templateName, assessmentId } = assessment;\n const assessmentDetails = await getOneTrustAssessment({\n oneTrust,\n assessmentId,\n });\n // fetch assessment's creator information\n const creatorId = assessmentDetails.createdBy.id;\n let creator = oneTrustCachedUsers[creatorId];\n if (!creator) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching creator...`,\n );\n try {\n creator = await getOneTrustUser({\n oneTrust,\n userId: creatorId,\n });\n oneTrustCachedUsers[creatorId] = creator;\n } catch (e) {\n logger.warn(\n colors.yellow(\n `[assessment ${assessmentNumber} of ${assessments.length}]: failed to fetch form creator.` +\n `\\tcreatorId: ${creatorId}. Assessment Title: ${assessment.name}. Template Title: ${templateName}`,\n ),\n );\n }\n }\n\n // fetch assessment approvers information\n const { approvers } = assessmentDetails;\n let approversDetails: OneTrustGetUserResponse[][] = [];\n if (approvers.length > 0) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching approvers...`,\n );\n approversDetails = await map(\n approvers.map(({ id }) => id),\n async (userId) => {\n try {\n let approver = oneTrustCachedUsers[userId];\n if (!approver) {\n approver = await getOneTrustUser({ oneTrust, userId });\n oneTrustCachedUsers[userId] = approver;\n }\n return [approver];\n } catch (e) {\n logger.warn(\n colors.yellow(\n `[assessment ${assessmentNumber} of ${assessments.length}]: failed to fetch a form approver.` +\n `\\tapproverId: ${userId}. Assessment Title: ${assessment.name}. Template Title: ${templateName}`,\n ),\n );\n return [];\n }\n },\n { concurrency: 5 },\n );\n }\n\n // fetch assessment internal respondents information\n const { respondents } = assessmentDetails;\n // if a user is an internal respondents, their 'name' field can't be an email.\n const internalRespondents = respondents.filter(\n (r) => !r.name.includes('@'),\n );\n let respondentsDetails: OneTrustGetUserResponse[][] = [];\n if (internalRespondents.length > 0) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching respondents...`,\n );\n respondentsDetails = await map(\n internalRespondents.map(({ id }) => id),\n async (userId) => {\n try {\n let respondent = oneTrustCachedUsers[userId];\n if (!respondent) {\n respondent = await getOneTrustUser({ oneTrust, userId });\n oneTrustCachedUsers[userId] = respondent;\n }\n return [respondent];\n } catch (e) {\n logger.warn(\n colors.yellow(\n `[assessment ${assessmentNumber} of ${assessments.length}]: failed to fetch a respondent.` +\n `\\trespondentId: ${userId}. Assessment Title: ${assessment.name}. Template Title: ${templateName}`,\n ),\n );\n return [];\n }\n },\n { concurrency: 5 },\n );\n }\n\n // fetch assessment risk information\n let riskDetails: OneTrustGetRiskResponse[] = [];\n const riskIds = uniq(\n assessmentDetails.sections.flatMap((s: OneTrustAssessmentSection) =>\n s.questions.flatMap((q: OneTrustAssessmentQuestion) =>\n (q.risks ?? []).flatMap((r) => r.riskId),\n ),\n ),\n );\n if (riskIds.length > 0) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching risks...`,\n );\n riskDetails = await map(\n riskIds,\n (riskId) => getOneTrustRisk({ oneTrust, riskId: riskId as string }),\n {\n concurrency: 5,\n },\n );\n }\n\n // enrich the assessments with user and risk details\n const enrichedAssessment = enrichOneTrustAssessment({\n assessment,\n assessmentDetails,\n riskDetails,\n creatorDetails: creator,\n approversDetails: approversDetails.flat(),\n respondentsDetails: respondentsDetails.flat(),\n });\n\n batchEnrichedAssessments.push(enrichedAssessment);\n },\n { concurrency: BATCH_SIZE },\n );\n\n // sync assessments in series to avoid concurrency bugs\n await mapSeries(\n batchEnrichedAssessments,\n async (enrichedAssessment, index) => {\n // the assessment's global index takes its batch into consideration\n const globalIndex = batch * BATCH_SIZE + index;\n\n if (dryRun && file) {\n // sync to file\n syncOneTrustAssessmentToDisk({\n assessment: enrichedAssessment,\n index: globalIndex,\n total: assessments.length,\n file,\n });\n } else if (transcend) {\n // sync to transcend\n await syncOneTrustAssessmentToTranscend({\n assessment: enrichedAssessment,\n transcend,\n total: assessments.length,\n index: globalIndex,\n });\n }\n },\n );\n });\n};\n"]}
1
+ {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-GZNNNSYW.cjs","../src/commands/migration/sync-ot/impl.ts","../src/lib/oneTrust/createOneTrustGotInstance.ts","../src/lib/oneTrust/helpers/oneTrustAssessmentToJson.ts","../src/lib/oneTrust/endpoints/getListOfOneTrustAssessments.ts","../src/lib/oneTrust/helpers/syncOneTrustAssessmentToTranscend.ts","../src/lib/oneTrust/helpers/syncOneTrustAssessmentsFromOneTrust.ts"],"names":["createOneTrustGotInstance","hostname","auth","got"],"mappings":"AAAA,y0BAAwC,wDAAwE,gCAA6B,wDAAoC,wDAAgD,wDAAyC,gFCEvP,oECFM,IAQZA,CAAAA,CAA4B,CAAC,CACxC,QAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CACF,CAAA,CAAA,EAMEC,aAAAA,CAAI,MAAA,CAAO,CACT,SAAA,CAAW,CAAA,QAAA,EAAWF,CAAQ,CAAA,CAAA;ACiBwB;AAIzC;AClCf,CAAA;ACsE2F,mBAAA;ACG7E","file":"/home/runner/work/cli/cli/dist/impl-GZNNNSYW.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { logger } from '../../../logger';\nimport colors from 'colors';\nimport { createOneTrustGotInstance } from '../../../lib/oneTrust';\nimport {\n OneTrustFileFormat,\n OneTrustPullResource,\n OneTrustPullSource,\n} from '../../../enums';\nimport { buildTranscendGraphQLClient } from '../../../lib/graphql';\nimport {\n syncOneTrustAssessmentsFromFile,\n syncOneTrustAssessmentsFromOneTrust,\n} from '../../../lib/oneTrust/helpers';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\n// Command flag interface\nexport interface SyncOtCommandFlags {\n hostname?: string;\n oneTrustAuth?: string;\n source: OneTrustPullSource;\n transcendAuth?: string;\n transcendUrl: string;\n file?: string;\n resource: OneTrustPullResource;\n dryRun: boolean;\n debug: boolean;\n}\n\n// Command implementation\nexport async function syncOt(\n this: LocalContext,\n {\n hostname,\n oneTrustAuth,\n source,\n transcendAuth,\n transcendUrl,\n resource,\n file,\n dryRun,\n debug,\n }: SyncOtCommandFlags,\n): Promise<void> {\n // Must be able to authenticate to transcend to sync resources to it\n if (!dryRun && !transcendAuth) {\n throw new Error(\n // eslint-disable-next-line no-template-curly-in-string\n 'Must specify a \"transcendAuth\" parameter to sync resources to Transcend. e.g. --transcendAuth=${TRANSCEND_API_KEY}',\n );\n }\n\n // If trying to sync to disk, must specify a file path\n if (dryRun && !file) {\n throw new Error(\n 'Must set a \"file\" parameter when \"dryRun\" is \"true\". e.g. --file=./oneTrustAssessments.json',\n );\n }\n\n if (file) {\n const splitFile = file.split('.');\n if (splitFile.length < 2) {\n throw new Error(\n 'The \"file\" parameter has an invalid format. Expected a path with extensions. e.g. --file=./pathToFile.json.',\n );\n }\n if (splitFile.at(-1) !== OneTrustFileFormat.Json) {\n throw new Error(\n `Expected the format of the \"file\" parameters '${file}' to be '${\n OneTrustFileFormat.Json\n }', but got '${splitFile.at(-1)}'.`,\n );\n }\n }\n\n // if reading assessments from a OneTrust\n if (source === OneTrustPullSource.OneTrust) {\n // must specify the OneTrust hostname\n if (!hostname) {\n throw new Error(\n 'Missing required parameter \"hostname\". e.g. --hostname=customer.my.onetrust.com',\n );\n }\n // must specify the OneTrust auth\n if (!oneTrustAuth) {\n throw new Error(\n 'Missing required parameter \"oneTrustAuth\". e.g. --oneTrustAuth=$ONE_TRUST_AUTH_TOKEN',\n );\n }\n } else {\n // if reading the assessments from a file, must specify a file to read from\n if (!file) {\n throw new Error(\n 'Must specify a \"file\" parameter to read the OneTrust assessments from. e.g. --source=./oneTrustAssessments.json',\n );\n }\n\n // Cannot try reading from file and save assessments to a file simultaneously\n if (dryRun) {\n throw new Error(\n 'Cannot read and write to a file simultaneously.' +\n ` Emit the \"source\" parameter or set it to ${OneTrustPullSource.OneTrust} if \"dryRun\" is enabled.`,\n );\n }\n }\n\n doneInputValidation(this.process.exit);\n\n // instantiate a client to talk to OneTrust\n const oneTrust =\n hostname && oneTrustAuth\n ? createOneTrustGotInstance({\n hostname,\n auth: oneTrustAuth,\n })\n : undefined;\n\n // instantiate a client to talk to Transcend\n const transcend =\n transcendUrl && transcendAuth\n ? buildTranscendGraphQLClient(transcendUrl, transcendAuth)\n : undefined;\n\n try {\n if (resource === OneTrustPullResource.Assessments) {\n if (source === OneTrustPullSource.OneTrust && oneTrust) {\n await syncOneTrustAssessmentsFromOneTrust({\n oneTrust,\n file,\n dryRun,\n ...(transcend && { transcend }),\n });\n } else if (source === OneTrustPullSource.File && file && transcend) {\n await syncOneTrustAssessmentsFromFile({ file, transcend });\n }\n }\n } catch (err) {\n throw new Error(\n `An error occurred syncing the resource ${resource} from OneTrust: ${\n debug ? err.stack : err.message\n }`,\n );\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced OneTrust ${resource} to ${\n dryRun ? `disk at \"${file}\"` : 'Transcend'\n }!`,\n ),\n );\n}\n","import got, { Got } from 'got';\n\n/**\n * Instantiate an instance of got that is capable of making requests to OneTrust\n *\n * @param param - information about the OneTrust URL\n * @returns The instance of got that is capable of making requests to the customer ingress\n */\nexport const createOneTrustGotInstance = ({\n hostname,\n auth,\n}: {\n /** Hostname of the OneTrust API */\n hostname: string;\n /** The OAuth access token */\n auth: string;\n}): Got =>\n got.extend({\n prefixUrl: `https://${hostname}`,\n headers: {\n accept: 'application/json',\n 'content-type': 'application/json',\n authorization: `Bearer ${auth}`,\n },\n });\n","import { OneTrustEnrichedAssessment } from '@transcend-io/privacy-types';\n\n/**\n * Converts the assessment into a json entry.\n *\n * @param param - information about the assessment and amount of entries\n * @returns a stringified json entry ready to be appended to a file\n */\nexport const oneTrustAssessmentToJson = ({\n assessment,\n index,\n total,\n wrap = true,\n}: {\n /** The assessment to convert */\n assessment: OneTrustEnrichedAssessment;\n /** The position of the assessment in the final Json object */\n index: number;\n /** The total amount of the assessments in the final Json object */\n total?: number;\n /** Whether to wrap every entry in brackets */\n wrap?: boolean;\n}): string => {\n let jsonEntry = '';\n // start with an opening bracket\n if (index === 0 || wrap) {\n jsonEntry = '[\\n';\n }\n\n const stringifiedAssessment = JSON.stringify(assessment);\n\n // Add comma for all items except the last one\n const comma = total && index < total - 1 && !wrap ? ',' : '';\n\n // write to file\n jsonEntry = `${jsonEntry + stringifiedAssessment + comma}\\n`;\n\n // end with closing bracket\n if ((total && index === total - 1) || wrap) {\n jsonEntry += '\\n]';\n }\n\n return jsonEntry;\n};\n","import { Got } from 'got';\nimport { logger } from '../../../logger';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport {\n OneTrustAssessment,\n OneTrustGetListOfAssessmentsResponse,\n} from '@transcend-io/privacy-types';\n\n/**\n * Fetch a list of all assessments from the OneTrust client.\n * ref: https://developer.onetrust.com/onetrust/reference/getallassessmentbasicdetailsusingget\n *\n * @param param - the information about the OneTrust client\n * @returns a list of OneTrustAssessment\n */\nexport const getListOfOneTrustAssessments = async ({\n oneTrust,\n}: {\n /** The OneTrust client instance */\n oneTrust: Got;\n}): Promise<OneTrustAssessment[]> => {\n let currentPage = 0;\n let totalPages = 1;\n let totalElements = 0;\n\n const allAssessments: OneTrustAssessment[] = [];\n\n while (currentPage < totalPages) {\n const { body } = await oneTrust.get(\n `api/assessment/v2/assessments?page=${currentPage}&size=2000`,\n );\n\n const { page, content } = decodeCodec(\n OneTrustGetListOfAssessmentsResponse,\n body,\n );\n allAssessments.push(...(content ?? []));\n if (currentPage === 0) {\n totalPages = page?.totalPages ?? 0;\n totalElements = page?.totalElements ?? 0;\n }\n currentPage += 1;\n\n // log progress\n logger.info(\n `Fetched ${allAssessments.length} of ${totalElements} assessments.`,\n );\n }\n\n return allAssessments;\n};\n","import { logger } from '../../../logger';\nimport colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport {\n IMPORT_ONE_TRUST_ASSESSMENT_FORMS,\n makeGraphQLRequest,\n} from '../../graphql';\nimport { ImportOnetrustAssessmentsInput } from '../../../codecs';\nimport { OneTrustEnrichedAssessment } from '@transcend-io/privacy-types';\nimport { oneTrustAssessmentToJson } from './oneTrustAssessmentToJson';\n\nexport interface AssessmentForm {\n /** ID of Assessment Form */\n id: string;\n /** Title of Assessment Form */\n name: string;\n}\n\n/**\n * Write the assessment to a Transcend instance.\n *\n *\n * @param param - information about the assessment and Transcend instance to write to\n */\nexport const syncOneTrustAssessmentToTranscend = async ({\n transcend,\n assessment,\n total,\n index,\n}: {\n /** the Transcend client instance */\n transcend: GraphQLClient;\n /** the assessment to sync to Transcend */\n assessment: OneTrustEnrichedAssessment;\n /** The index of the assessment being written to the file */\n index: number;\n /** The total amount of assessments that we will write */\n total?: number;\n}): Promise<void> => {\n logger.info(\n colors.magenta(\n `Writing enriched assessment ${index + 1} ${\n total ? `of ${total} ` : ' '\n }to Transcend...`,\n ),\n );\n\n // convert the OneTrust assessment object into a json record\n const json = oneTrustAssessmentToJson({\n assessment,\n index,\n total,\n });\n\n // transform the json record into a valid input to the mutation\n const input: ImportOnetrustAssessmentsInput = {\n json,\n };\n\n try {\n await makeGraphQLRequest<{\n /** the importOneTrustAssessmentForms mutation */\n importOneTrustAssessmentForms: {\n /** Created Assessment Forms */\n assessmentForms: AssessmentForm[];\n };\n }>(transcend, IMPORT_ONE_TRUST_ASSESSMENT_FORMS, {\n input,\n });\n } catch (e) {\n logger.error(\n colors.red(\n `Failed to sync assessment ${index + 1} ${\n total ? `of ${total} ` : ' '\n }to Transcend.\\n` +\n `\\tAssessment Title: ${assessment.name}. Template Title: ${assessment.template.name}\\n`,\n ),\n );\n }\n};\n","import type { Got } from 'got';\nimport colors from 'colors';\nimport {\n getListOfOneTrustAssessments,\n getOneTrustAssessment,\n getOneTrustRisk,\n getOneTrustUser,\n} from '../endpoints';\nimport { mapSeries, map } from '../../bluebird';\nimport { logger } from '../../../logger';\nimport {\n OneTrustAssessmentQuestion,\n OneTrustAssessmentSection,\n OneTrustEnrichedAssessment,\n OneTrustGetRiskResponse,\n OneTrustGetUserResponse,\n} from '@transcend-io/privacy-types';\nimport { uniq } from 'lodash-es';\nimport { enrichOneTrustAssessment } from './enrichOneTrustAssessment';\nimport { syncOneTrustAssessmentToDisk } from './syncOneTrustAssessmentToDisk';\nimport { GraphQLClient } from 'graphql-request';\nimport { syncOneTrustAssessmentToTranscend } from './syncOneTrustAssessmentToTranscend';\n\nexport interface AssessmentForm {\n /** ID of Assessment Form */\n id: string;\n /** Title of Assessment Form */\n name: string;\n}\n\n/**\n * Reads all the assessments from a OneTrust instance and syncs them to Transcend or to Disk.\n *\n * @param param - the information about the assessment, its OneTrust source, and destination (disk or Transcend)\n */\nexport const syncOneTrustAssessmentsFromOneTrust = async ({\n oneTrust,\n file,\n dryRun,\n transcend,\n}: {\n /** the OneTrust client instance */\n oneTrust: Got;\n /** the Transcend client instance */\n transcend?: GraphQLClient;\n /** Whether to write to file instead of syncing to Transcend */\n dryRun: boolean;\n /** the path to the file in case dryRun is true */\n file?: string;\n}): Promise<void> => {\n // fetch the list of all assessments in the OneTrust organization\n logger.info('Getting list of all assessments from OneTrust...');\n const assessments = await getListOfOneTrustAssessments({ oneTrust });\n\n // a cache of OneTrust users so we avoid requesting already fetched users\n const oneTrustCachedUsers: Record<string, OneTrustGetUserResponse> = {};\n\n // split all assessments in batches, so we can process some of steps in parallel\n const BATCH_SIZE = 5;\n const assessmentBatches = Array.from(\n {\n length: Math.ceil(assessments.length / BATCH_SIZE),\n },\n (_, i) => assessments.slice(i * BATCH_SIZE, (i + 1) * BATCH_SIZE),\n );\n\n // process each batch and sync the batch right away so it's garbage collected and we don't run out of memory\n await mapSeries(assessmentBatches, async (assessmentBatch, batch) => {\n const batchEnrichedAssessments: OneTrustEnrichedAssessment[] = [];\n\n // fetch assessment details from OneTrust in parallel\n await map(\n assessmentBatch,\n async (assessment, index) => {\n const assessmentNumber = BATCH_SIZE * batch + index + 1;\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching details...`,\n );\n const { templateName, assessmentId } = assessment;\n const assessmentDetails = await getOneTrustAssessment({\n oneTrust,\n assessmentId,\n });\n // fetch assessment's creator information\n const creatorId = assessmentDetails.createdBy.id;\n let creator = oneTrustCachedUsers[creatorId];\n if (!creator) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching creator...`,\n );\n try {\n creator = await getOneTrustUser({\n oneTrust,\n userId: creatorId,\n });\n oneTrustCachedUsers[creatorId] = creator;\n } catch (e) {\n logger.warn(\n colors.yellow(\n `[assessment ${assessmentNumber} of ${assessments.length}]: failed to fetch form creator.` +\n `\\tcreatorId: ${creatorId}. Assessment Title: ${assessment.name}. Template Title: ${templateName}`,\n ),\n );\n }\n }\n\n // fetch assessment approvers information\n const { approvers } = assessmentDetails;\n let approversDetails: OneTrustGetUserResponse[][] = [];\n if (approvers.length > 0) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching approvers...`,\n );\n approversDetails = await map(\n approvers.map(({ id }) => id),\n async (userId) => {\n try {\n let approver = oneTrustCachedUsers[userId];\n if (!approver) {\n approver = await getOneTrustUser({ oneTrust, userId });\n oneTrustCachedUsers[userId] = approver;\n }\n return [approver];\n } catch (e) {\n logger.warn(\n colors.yellow(\n `[assessment ${assessmentNumber} of ${assessments.length}]: failed to fetch a form approver.` +\n `\\tapproverId: ${userId}. Assessment Title: ${assessment.name}. Template Title: ${templateName}`,\n ),\n );\n return [];\n }\n },\n { concurrency: 5 },\n );\n }\n\n // fetch assessment internal respondents information\n const { respondents } = assessmentDetails;\n // if a user is an internal respondents, their 'name' field can't be an email.\n const internalRespondents = respondents.filter(\n (r) => !r.name.includes('@'),\n );\n let respondentsDetails: OneTrustGetUserResponse[][] = [];\n if (internalRespondents.length > 0) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching respondents...`,\n );\n respondentsDetails = await map(\n internalRespondents.map(({ id }) => id),\n async (userId) => {\n try {\n let respondent = oneTrustCachedUsers[userId];\n if (!respondent) {\n respondent = await getOneTrustUser({ oneTrust, userId });\n oneTrustCachedUsers[userId] = respondent;\n }\n return [respondent];\n } catch (e) {\n logger.warn(\n colors.yellow(\n `[assessment ${assessmentNumber} of ${assessments.length}]: failed to fetch a respondent.` +\n `\\trespondentId: ${userId}. Assessment Title: ${assessment.name}. Template Title: ${templateName}`,\n ),\n );\n return [];\n }\n },\n { concurrency: 5 },\n );\n }\n\n // fetch assessment risk information\n let riskDetails: OneTrustGetRiskResponse[] = [];\n const riskIds = uniq(\n assessmentDetails.sections.flatMap((s: OneTrustAssessmentSection) =>\n s.questions.flatMap((q: OneTrustAssessmentQuestion) =>\n (q.risks ?? []).flatMap((r) => r.riskId),\n ),\n ),\n );\n if (riskIds.length > 0) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching risks...`,\n );\n riskDetails = await map(\n riskIds,\n (riskId) => getOneTrustRisk({ oneTrust, riskId: riskId as string }),\n {\n concurrency: 5,\n },\n );\n }\n\n // enrich the assessments with user and risk details\n const enrichedAssessment = enrichOneTrustAssessment({\n assessment,\n assessmentDetails,\n riskDetails,\n creatorDetails: creator,\n approversDetails: approversDetails.flat(),\n respondentsDetails: respondentsDetails.flat(),\n });\n\n batchEnrichedAssessments.push(enrichedAssessment);\n },\n { concurrency: BATCH_SIZE },\n );\n\n // sync assessments in series to avoid concurrency bugs\n await mapSeries(\n batchEnrichedAssessments,\n async (enrichedAssessment, index) => {\n // the assessment's global index takes its batch into consideration\n const globalIndex = batch * BATCH_SIZE + index;\n\n if (dryRun && file) {\n // sync to file\n syncOneTrustAssessmentToDisk({\n assessment: enrichedAssessment,\n index: globalIndex,\n total: assessments.length,\n file,\n });\n } else if (transcend) {\n // sync to transcend\n await syncOneTrustAssessmentToTranscend({\n assessment: enrichedAssessment,\n transcend,\n total: assessments.length,\n index: globalIndex,\n });\n }\n },\n );\n });\n};\n"]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunk7H4ALAHCcjs = require('./chunk-7H4ALAHC.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk55B57ZAYcjs = require('./chunk-55B57ZAY.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkXXFLFF7Qcjs = require('./chunk-XXFLFF7Q.cjs');require('./chunk-7PB6LVSE.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);async function j({auth:p,file:o,transcendUrl:f,dataSiloIds:g,subCategories:C,status:S,includeEncryptedSnippets:a}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);try{let i=_chunk55B57ZAYcjs.xc.call(void 0, f,p),b=await _chunk7H4ALAHCcjs.b.call(void 0, i,{dataSiloIds:g,subCategories:C,status:S,includeEncryptedSnippets:a});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Writing unstructured discovery files to file "${o}"...`));let s=[],h=b.map(t=>{let n={"Entry ID":t.id,"Data Silo ID":t.dataSiloId,"Object Path ID":t.scannedObjectPathId,"Object ID":t.scannedObjectId,...a?{Entry:t.name,"Context Snippet":t.contextSnippet}:{},"Data Category":`${t.dataSubCategory.category}:${t.dataSubCategory.name}`,"Classification Status":t.status,"Confidence Score":t.confidence,"Classification Method":t.classificationMethod,"Classifier Version":t.classifierVersion};return s=_chunkXXFLFF7Qcjs.j.call(void 0, [...s,...Object.keys(n)]),n});await _chunk55B57ZAYcjs.tg.call(void 0, o,h,s)}catch(i){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`An error occurred syncing the unstructured discovery files: ${i.message}`)),this.process.exit(1)}_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced unstructured discovery files to disk at ${o}!`))}exports.pullUnstructuredDiscoveryFiles = j;
2
- //# sourceMappingURL=impl-5VMEZB7F.cjs.map
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkLQUVB4MIcjs = require('./chunk-LQUVB4MI.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk56QKBG2Rcjs = require('./chunk-56QKBG2R.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkDQCPGPXGcjs = require('./chunk-DQCPGPXG.cjs');require('./chunk-7PB6LVSE.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);async function j({auth:p,file:o,transcendUrl:f,dataSiloIds:g,subCategories:C,status:S,includeEncryptedSnippets:a}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);try{let i=_chunk56QKBG2Rcjs.zc.call(void 0, f,p),b=await _chunkLQUVB4MIcjs.b.call(void 0, i,{dataSiloIds:g,subCategories:C,status:S,includeEncryptedSnippets:a});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Writing unstructured discovery files to file "${o}"...`));let s=[],h=b.map(t=>{let n={"Entry ID":t.id,"Data Silo ID":t.dataSiloId,"Object Path ID":t.scannedObjectPathId,"Object ID":t.scannedObjectId,...a?{Entry:t.name,"Context Snippet":t.contextSnippet}:{},"Data Category":`${t.dataSubCategory.category}:${t.dataSubCategory.name}`,"Classification Status":t.status,"Confidence Score":t.confidence,"Classification Method":t.classificationMethod,"Classifier Version":t.classifierVersion};return s=_chunkDQCPGPXGcjs.j.call(void 0, [...s,...Object.keys(n)]),n});await _chunk56QKBG2Rcjs.vg.call(void 0, o,h,s)}catch(i){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`An error occurred syncing the unstructured discovery files: ${i.message}`)),this.process.exit(1)}_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced unstructured discovery files to disk at ${o}!`))}exports.pullUnstructuredDiscoveryFiles = j;
2
+ //# sourceMappingURL=impl-IOS3QLTX.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-5VMEZB7F.cjs","../src/commands/inventory/pull-unstructured-discovery-files/impl.ts"],"names":["pullUnstructuredDiscoveryFiles","auth","file","transcendUrl","dataSiloIds","subCategories","status","includeEncryptedSnippets","doneInputValidation","client","buildTranscendGraphQLClient","entries","pullUnstructuredSubDataPointRecommendations","logger","colors","headers","inputs","entry","result"],"mappings":"AAAA,iOAAwC,wDAAyC,wDAAkD,gCAA6B,wDAAyC,wDAAyC,gCAA6B,gFCE5P,MAkBnB,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,wBAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,GAAI,CAEF,IAAMC,CAAAA,CAASC,kCAAAA,CAA4BP,CAAcF,CAAI,CAAA,CAEvDU,CAAAA,CAAU,MAAMC,iCAAAA,CAA4CH,CAAQ,CACxE,WAAA,CAAAL,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,wBAAA,CAAAC,CACF,CAAC,CAAA,CAEDM,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,OAAA,CACL,CAAA,8CAAA,EAAiDZ,CAAI,CAAA,IAAA,CACvD,CACF,CAAA,CACA,IAAIa,CAAAA,CAAoB,CAAC,CAAA,CACnBC,CAAAA,CAASL,CAAAA,CAAQ,GAAA,CAAKM,CAAAA,EAAU,CACpC,IAAMC,CAAAA,CAAS,CACb,UAAA,CAAYD,CAAAA,CAAM,EAAA,CAClB,cAAA,CAAgBA,CAAAA,CAAM,UAAA,CACtB,gBAAA,CAAkBA,CAAAA,CAAM,mBAAA,CACxB,WAAA,CAAaA,CAAAA,CAAM,eAAA,CACnB,GAAIV,CAAAA,CACA,CAAE,KAAA,CAAOU,CAAAA,CAAM,IAAA,CAAM,iBAAA,CAAmBA,CAAAA,CAAM,cAAe,CAAA,CAC7D,CAAC,CAAA,CACL,eAAA,CAAiB,CAAA,EAAA","file":"/home/runner/work/cli/cli/dist/impl-5VMEZB7F.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport type { UnstructuredSubDataPointRecommendationStatus } from '@transcend-io/privacy-types';\nimport colors from 'colors';\nimport { uniq } from 'lodash-es';\nimport { pullUnstructuredSubDataPointRecommendations } from '../../../lib/data-inventory';\nimport { buildTranscendGraphQLClient } from '../../../lib/graphql';\nimport { logger } from '../../../logger';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\nimport { writeLargeCsv } from '../../../lib/helpers';\n\nexport interface PullUnstructuredDiscoveryFilesCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n subCategories?: string[];\n status?: UnstructuredSubDataPointRecommendationStatus[];\n includeEncryptedSnippets: boolean;\n}\n\nexport async function pullUnstructuredDiscoveryFiles(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n dataSiloIds,\n subCategories,\n status,\n includeEncryptedSnippets,\n }: PullUnstructuredDiscoveryFilesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const entries = await pullUnstructuredSubDataPointRecommendations(client, {\n dataSiloIds,\n subCategories, // TODO: https://transcend.height.app/T-40482 - do by name not ID\n status,\n includeEncryptedSnippets,\n });\n\n logger.info(\n colors.magenta(\n `Writing unstructured discovery files to file \"${file}\"...`,\n ),\n );\n let headers: string[] = [];\n const inputs = entries.map((entry) => {\n const result = {\n 'Entry ID': entry.id,\n 'Data Silo ID': entry.dataSiloId,\n 'Object Path ID': entry.scannedObjectPathId,\n 'Object ID': entry.scannedObjectId,\n ...(includeEncryptedSnippets\n ? { Entry: entry.name, 'Context Snippet': entry.contextSnippet }\n : {}),\n 'Data Category': `${entry.dataSubCategory.category}:${entry.dataSubCategory.name}`,\n 'Classification Status': entry.status,\n 'Confidence Score': entry.confidence,\n 'Classification Method': entry.classificationMethod,\n 'Classifier Version': entry.classifierVersion,\n };\n headers = uniq([...headers, ...Object.keys(result)]);\n return result;\n });\n await writeLargeCsv(file, inputs, headers);\n } catch (err) {\n logger.error(\n colors.red(\n `An error occurred syncing the unstructured discovery files: ${err.message}`,\n ),\n );\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced unstructured discovery files to disk at ${file}!`,\n ),\n );\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-IOS3QLTX.cjs","../src/commands/inventory/pull-unstructured-discovery-files/impl.ts"],"names":["pullUnstructuredDiscoveryFiles","auth","file","transcendUrl","dataSiloIds","subCategories","status","includeEncryptedSnippets","doneInputValidation","client","buildTranscendGraphQLClient","entries","pullUnstructuredSubDataPointRecommendations","logger","colors","headers","inputs","entry","result"],"mappings":"AAAA,iOAAwC,wDAAyC,wDAAkD,gCAA6B,wDAAyC,wDAAyC,gCAA6B,gFCE5P,MAkBnB,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,wBAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,GAAI,CAEF,IAAMC,CAAAA,CAASC,kCAAAA,CAA4BP,CAAcF,CAAI,CAAA,CAEvDU,CAAAA,CAAU,MAAMC,iCAAAA,CAA4CH,CAAQ,CACxE,WAAA,CAAAL,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,wBAAA,CAAAC,CACF,CAAC,CAAA,CAEDM,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,OAAA,CACL,CAAA,8CAAA,EAAiDZ,CAAI,CAAA,IAAA,CACvD,CACF,CAAA,CACA,IAAIa,CAAAA,CAAoB,CAAC,CAAA,CACnBC,CAAAA,CAASL,CAAAA,CAAQ,GAAA,CAAKM,CAAAA,EAAU,CACpC,IAAMC,CAAAA,CAAS,CACb,UAAA,CAAYD,CAAAA,CAAM,EAAA,CAClB,cAAA,CAAgBA,CAAAA,CAAM,UAAA,CACtB,gBAAA,CAAkBA,CAAAA,CAAM,mBAAA,CACxB,WAAA,CAAaA,CAAAA,CAAM,eAAA,CACnB,GAAIV,CAAAA,CACA,CAAE,KAAA,CAAOU,CAAAA,CAAM,IAAA,CAAM,iBAAA,CAAmBA,CAAAA,CAAM,cAAe,CAAA,CAC7D,CAAC,CAAA,CACL,eAAA,CAAiB,CAAA,EAAA","file":"/home/runner/work/cli/cli/dist/impl-IOS3QLTX.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport type { UnstructuredSubDataPointRecommendationStatus } from '@transcend-io/privacy-types';\nimport colors from 'colors';\nimport { uniq } from 'lodash-es';\nimport { pullUnstructuredSubDataPointRecommendations } from '../../../lib/data-inventory';\nimport { buildTranscendGraphQLClient } from '../../../lib/graphql';\nimport { logger } from '../../../logger';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\nimport { writeLargeCsv } from '../../../lib/helpers';\n\nexport interface PullUnstructuredDiscoveryFilesCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n subCategories?: string[];\n status?: UnstructuredSubDataPointRecommendationStatus[];\n includeEncryptedSnippets: boolean;\n}\n\nexport async function pullUnstructuredDiscoveryFiles(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n dataSiloIds,\n subCategories,\n status,\n includeEncryptedSnippets,\n }: PullUnstructuredDiscoveryFilesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const entries = await pullUnstructuredSubDataPointRecommendations(client, {\n dataSiloIds,\n subCategories, // TODO: https://transcend.height.app/T-40482 - do by name not ID\n status,\n includeEncryptedSnippets,\n });\n\n logger.info(\n colors.magenta(\n `Writing unstructured discovery files to file \"${file}\"...`,\n ),\n );\n let headers: string[] = [];\n const inputs = entries.map((entry) => {\n const result = {\n 'Entry ID': entry.id,\n 'Data Silo ID': entry.dataSiloId,\n 'Object Path ID': entry.scannedObjectPathId,\n 'Object ID': entry.scannedObjectId,\n ...(includeEncryptedSnippets\n ? { Entry: entry.name, 'Context Snippet': entry.contextSnippet }\n : {}),\n 'Data Category': `${entry.dataSubCategory.category}:${entry.dataSubCategory.name}`,\n 'Classification Status': entry.status,\n 'Confidence Score': entry.confidence,\n 'Classification Method': entry.classificationMethod,\n 'Classifier Version': entry.classifierVersion,\n };\n headers = uniq([...headers, ...Object.keys(result)]);\n return result;\n });\n await writeLargeCsv(file, inputs, headers);\n } catch (err) {\n logger.error(\n colors.red(\n `An error occurred syncing the unstructured discovery files: ${err.message}`,\n ),\n );\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced unstructured discovery files to disk at ${file}!`,\n ),\n );\n}\n"]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkALOB5SWZcjs = require('./chunk-ALOB5SWZ.cjs');var _chunkJH5HRI6Dcjs = require('./chunk-JH5HRI6D.cjs');var _chunkNC6VWOMNcjs = require('./chunk-NC6VWOMN.cjs');require('./chunk-ABKDAPPR.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk55B57ZAYcjs = require('./chunk-55B57ZAY.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkXXFLFF7Qcjs = require('./chunk-XXFLFF7Q.cjs');require('./chunk-7PB6LVSE.cjs');var _path = require('path');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _fs = require('fs');async function J({auth:F,dataFlowsYmlFolder:r,output:x,ignoreYmls:C=[],transcendUrl:N}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),(!_fs.existsSync.call(void 0, r)||!_fs.lstatSync.call(void 0, r).isDirectory())&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Folder does not exist: "${r}"`)),this.process.exit(1));let k=C.map(t=>t.split(".")[0]),l=_chunkNC6VWOMNcjs.c.call(void 0, r).map(t=>{let{"data-flows":o=[]}=_chunkJH5HRI6Dcjs.d.call(void 0, _path.join.call(void 0, r,t)),{adTechDataSilos:m,siteTechDataSilos:i}=_chunkALOB5SWZcjs.a.call(void 0, o,{serviceToSupportedIntegration:d,serviceToTitle:u});return{adTechDataSilos:m,siteTechDataSilos:i,organizationName:t.split(".")[0]}}),a={};l.forEach(({adTechDataSilos:t,siteTechDataSilos:o,organizationName:m})=>{[...t,...o].forEach(e=>{let n=e["outer-type"]||e.integrationName;a[n]||(a[n]=[]),a[n].push(m),a[n]=[...new Set(a[n])]})});let p=[...new Set(l.map(({adTechDataSilos:t})=>t.map(o=>o["outer-type"]||o.integrationName)).flat())],f=_chunkXXFLFF7Qcjs.c.call(void 0, [...new Set(l.map(({siteTechDataSilos:t})=>t.map(o=>o["outer-type"]||o.integrationName)).flat())],p),s={};l.forEach(({adTechDataSilos:t,siteTechDataSilos:o})=>{[...t,...o].forEach(i=>{let e=i["outer-type"]||i.integrationName,n=_optionalChain([i, 'access', _ => _.attributes, 'optionalAccess', _2 => _2.find, 'call', _3 => _3(E=>E.key==="Found On Domain")]);s[e]||(s[e]=[]),s[e].push(..._optionalChain([n, 'optionalAccess', _4 => _4.values])||[]),s[e]=[...new Set(s[e])]})});let A=_chunk55B57ZAYcjs.xc.call(void 0, N,F),{serviceToTitle:u,serviceToSupportedIntegration:d}=await _chunk55B57ZAYcjs.vd.call(void 0, A),h=[...p,...f].map(t=>({title:u[t],...d[t]?{integrationName:t}:{integrationName:"promptAPerson","outer-type":t},attributes:[{key:"Tech Type",values:["Ad Tech"]},{key:"Business Units",values:_chunkXXFLFF7Qcjs.c.call(void 0, a[t]||[],k)},{key:"Found On Domain",values:s[t]||[]}]}));_chunkZUNVPK23cjs.a.log(`Total Services: ${h.length}`),_chunkZUNVPK23cjs.a.log(`Ad Tech Services: ${p.length}`),_chunkZUNVPK23cjs.a.log(`Site Tech Services: ${f.length}`),_chunkJH5HRI6Dcjs.e.call(void 0, x,{"data-silos":h})}exports.deriveDataSilosFromDataFlowsCrossInstance = J;
2
- //# sourceMappingURL=impl-PHBUSAGS.cjs.map
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 _chunkVCPZG4FJcjs = require('./chunk-VCPZG4FJ.cjs');var _chunkJH5HRI6Dcjs = require('./chunk-JH5HRI6D.cjs');var _chunkP5GD5LAKcjs = require('./chunk-P5GD5LAK.cjs');require('./chunk-ABKDAPPR.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk56QKBG2Rcjs = require('./chunk-56QKBG2R.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkDQCPGPXGcjs = require('./chunk-DQCPGPXG.cjs');require('./chunk-7PB6LVSE.cjs');var _path = require('path');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _fs = require('fs');async function J({auth:F,dataFlowsYmlFolder:r,output:x,ignoreYmls:C=[],transcendUrl:N}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),(!_fs.existsSync.call(void 0, r)||!_fs.lstatSync.call(void 0, r).isDirectory())&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Folder does not exist: "${r}"`)),this.process.exit(1));let k=C.map(t=>t.split(".")[0]),l=_chunkP5GD5LAKcjs.c.call(void 0, r).map(t=>{let{"data-flows":o=[]}=_chunkJH5HRI6Dcjs.d.call(void 0, _path.join.call(void 0, r,t)),{adTechDataSilos:m,siteTechDataSilos:i}=_chunkVCPZG4FJcjs.a.call(void 0, o,{serviceToSupportedIntegration:d,serviceToTitle:u});return{adTechDataSilos:m,siteTechDataSilos:i,organizationName:t.split(".")[0]}}),a={};l.forEach(({adTechDataSilos:t,siteTechDataSilos:o,organizationName:m})=>{[...t,...o].forEach(e=>{let n=e["outer-type"]||e.integrationName;a[n]||(a[n]=[]),a[n].push(m),a[n]=[...new Set(a[n])]})});let p=[...new Set(l.map(({adTechDataSilos:t})=>t.map(o=>o["outer-type"]||o.integrationName)).flat())],f=_chunkDQCPGPXGcjs.c.call(void 0, [...new Set(l.map(({siteTechDataSilos:t})=>t.map(o=>o["outer-type"]||o.integrationName)).flat())],p),s={};l.forEach(({adTechDataSilos:t,siteTechDataSilos:o})=>{[...t,...o].forEach(i=>{let e=i["outer-type"]||i.integrationName,n=_optionalChain([i, 'access', _ => _.attributes, 'optionalAccess', _2 => _2.find, 'call', _3 => _3(E=>E.key==="Found On Domain")]);s[e]||(s[e]=[]),s[e].push(..._optionalChain([n, 'optionalAccess', _4 => _4.values])||[]),s[e]=[...new Set(s[e])]})});let A=_chunk56QKBG2Rcjs.zc.call(void 0, N,F),{serviceToTitle:u,serviceToSupportedIntegration:d}=await _chunk56QKBG2Rcjs.xd.call(void 0, A),h=[...p,...f].map(t=>({title:u[t],...d[t]?{integrationName:t}:{integrationName:"promptAPerson","outer-type":t},attributes:[{key:"Tech Type",values:["Ad Tech"]},{key:"Business Units",values:_chunkDQCPGPXGcjs.c.call(void 0, a[t]||[],k)},{key:"Found On Domain",values:s[t]||[]}]}));_chunkZUNVPK23cjs.a.log(`Total Services: ${h.length}`),_chunkZUNVPK23cjs.a.log(`Ad Tech Services: ${p.length}`),_chunkZUNVPK23cjs.a.log(`Site Tech Services: ${f.length}`),_chunkJH5HRI6Dcjs.e.call(void 0, x,{"data-silos":h})}exports.deriveDataSilosFromDataFlowsCrossInstance = J;
2
+ //# sourceMappingURL=impl-IQGUF37H.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-PHBUSAGS.cjs","../src/commands/inventory/derive-data-silos-from-data-flows-cross-instance/impl.ts"],"names":["deriveDataSilosFromDataFlowsCrossInstance","auth","dataFlowsYmlFolder","output","ignoreYmls","transcendUrl","doneInputValidation","existsSync","lstatSync","logger","colors","instancesToIgnore","x","dataSiloInputs","listFiles","directory","dataFlows","readTranscendYaml","join","adTechDataSilos","siteTechDataSilos","dataFlowsToDataSilos","serviceToSupportedIntegration","serviceToTitle","serviceToInstance","organizationName","dataSilo","service","adTechIntegrations","silo","siteTechIntegrations","difference_default","serviceToFoundOnDomain","foundOnDomain","attr","client","buildTranscendGraphQLClient","fetchAndIndexCatalogs","dataSilos"],"mappings":"AAAA,quBAAwC,wDAAgD,wDAAyC,gCAA6B,wDAAyC,wDAAkD,gCAA6B,wDAAyC,wDAAyC,gCAA6B,4BCKhX,gFAEF,wBAImB,MAgBtC,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,kBAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CAAa,CAAC,CAAA,CACd,YAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAAA,CAInC,CAACC,4BAAAA,CAA6B,CAAA,EAC9B,CAACC,2BAAAA,CAA4B,CAAA,CAAE,WAAA,CAAY,CAAA,CAAA,EAAA,CAE3CC,mBAAAA,CAAO,KAAA,CAAMC,gBAAAA,CAAO,GAAA,CAAI,CAAA,wBAAA,EAA2BR,CAAkB,CAAA,CAAA,CAAG,CAAC,CAAA,CACzE,IAAA,CAAK,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,CAAA,CAIrB,IAAMS,CAAAA,CAAoBP,CAAAA,CAAW,GAAA,CAAKQ,CAAAA,EAAMA,CAAAA,CAAE,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAC,CAAA,CAGzDC,CAAAA,CAAiBC,iCAAAA,CAA4B,CAAA,CAAE,GAAA,CAAKC,CAAAA,EAAc,CAEtE,GAAM,CAAE,YAAA,CAAcC,CAAAA,CAAY,CAAC,CAAE,CAAA,CAAIC,iCAAAA,wBACvCC,CAAKhB,CAAoBa,CAAS,CACpC,CAAA,CAGM,CAAE,eAAA,CAAAI,CAAAA,CAAiB,iBAAA,CAAAC,CAAkB,CAAA,CAAIC,iCAAAA,CAC7CL,CACA,CACE,6BAAA,CAAAM,CAAAA,CACA,cAAA,CAAAC,CACF,CACF,CAAA,CAEA,MAAO,CACL,eAAA,CAAAJ,CAAAA,CACA,iBAAA,CAAAC,CAAAA,CACA,gBAAA,CAAkBL,CAAAA,CAAU,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAC1C,CACF,CAAC,CAAA,CAGKS,CAAAA,CAAiD,CAAC,CAAA,CACxDX,CAAAA,CAAe,OAAA,CACb,CAAC,CAAE,eAAA,CAAAM,CAAAA,CAAiB,iBAAA,CAAAC,CAAAA,CAAmB,gBAAA,CAAAK,CAAiB,CAAA,CAAA,EAAM,CACvC,CAAC,GAAGN,CAAAA,CAAiB,GAAGC,CAAiB,CAAA,CACjD,OAAA,CAASM,CAAAA,EAAa,CACjC,IAAMC,CAAAA,CAAUD,CAAAA,CAAS,YAAY,CAAA,EAAKA,CAAAA,CAAS,eAAA,CAE9CF,CAAAA,CAAkBG,CAAO,CAAA,EAAA,CAC5BH,CAAAA,CAAkBG,CAAO,CAAA,CAAI,CAAC,CAAA,CAAA,CAEhCH,CAAAA,CAAkBG,CAAO,CAAA,CAAG,IAAA,CAAKF,CAAgB,CAAA,CACjDD,CAAAA,CAAkBG,CAAO,CAAA,CAAI,CAAC,GAAG,IAAI,GAAA,CAAIH,CAAAA,CAAkBG,CAAO,CAAC,CAAC,CACtE,CAAC,CACH,CACF,CAAA,CAGA,IAAMC,CAAAA,CAAqB,CACzB,GAAG,IAAI,GAAA,CACLf,CAAAA,CACG,GAAA,CAAI,CAAC,CAAE,eAAA,CAAAM,CAAgB,CAAA,CAAA,EACtBA,CAAAA,CAAgB,GAAA,CACbU,CAAAA,EAASA,CAAAA,CAAK,YAAY,CAAA,EAAKA,CAAAA,CAAK,eACvC,CACF,CAAA,CACC,IAAA,CAAK,CACV,CACF,CAAA,CAGMC,CAAAA,CAAuBC,iCAAAA,CAEzB,GAAG,IAAI,GAAA,CACLlB,CAAAA,CACG,GAAA,CAAI,CAAC,CAAE,iBAAA,CAAAO,CAAkB,CAAA,CAAA,EACxBA,CAAAA,CAAkB,GAAA,CACfS,CAAAA,EAASA,CAAAA,CAAK,YAAY,CAAA,EAAKA,CAAAA,CAAK,eACvC,CACF,CAAA,CACC,IAAA,CAAK,CACV,CACF,CAAA,CACAD,CACF,CAAA,CAGMI,CAAAA,CAAsD,CAAC,CAAA,CAC7DnB,CAAAA,CAAe,OAAA,CAAQ,CAAC,CAAE,eAAA,CAAAM,CAAAA,CAAiB,iBAAA,CAAAC,CAAkB,CAAA,CAAA,EAAM,CAC5C,CAAC,GAAGD,CAAAA,CAAiB,GAAGC,CAAiB,CAAA,CACjD,OAAA,CAASM,CAAAA,EAAa,CACjC,IAAMC,CAAAA,CAAUD,CAAAA,CAAS,YAAY,CAAA,EAAKA,CAAAA,CAAS,eAAA,CAC7CO,CAAAA,iBAAgBP,CAAAA,mBAAS,UAAA,6BAAY,IAAA,mBACxCQ,CAAAA,EAASA,CAAAA,CAAK,GAAA,GAAQ,iBACzB,GAAA,CAEKF,CAAAA,CAAuBL,CAAO,CAAA,EAAA,CACjCK,CAAAA,CAAuBL,CAAO,CAAA,CAAI,CAAC,CAAA,CAAA,CAErCK,CAAAA,CAAuBL,CAAO,CAAA,CAAG,IAAA,CAAK,mBAAIM,CAAAA,6BAAe,QAAA,EAAU,CAAC,CAAE,CAAA,CACtED,CAAAA,CAAuBL,CAAO,CAAA,CAAI,CAChC,GAAG,IAAI,GAAA,CAAIK,CAAAA,CAAuBL,CAAO,CAAC,CAC5C,CACF,CAAC,CACH,CAAC,CAAA,CAGD,IAAMQ,CAAAA,CAASC,kCAAAA,CAA4B/B,CAAcJ,CAAI,CAAA,CACvD,CAAE,cAAA,CAAAsB,CAAAA,CAAgB,6BAAA,CAAAD,CAA8B,CAAA,CACpD,MAAMe,kCAAAA,CAA4B,CAAA,CAG9BC,CAAAA,CAAY,CAAC,GAAGV,CAAAA,CAAoB,GAAGE,CAAoB,CAAA,CAAE,GAAA,CAChEH,CAAAA,EAAAA,CAAa,CACZ,KAAA,CAAOJ,CAAAA,CAAeI,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,gBAAA,CACL,MAAA,CAAQI,iCAAAA,CACNP,CAAkBG,CAAO,CAAA,EAAK,CAAC,CAAA,CAC/BhB,CACF,CACF,CAAA,CACA,CACE,GAAA,CAAK,iBAAA,CACL,MAAA,CAAQqB,CAAAA,CAAuBL,CAAO,CAAA,EAAK,CAAC,CAC9C,CACF,CACF,CAAA,CACF,CAAA,CAGAlB,mBAAAA,CAAO,GAAA,CAAI,CAAA,gBAAA,EAAmB6B,CAAAA,CAAU,MAAM,CAAA,CAAA","file":"/home/runner/work/cli/cli/dist/impl-PHBUSAGS.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport {\n fetchAndIndexCatalogs,\n buildTranscendGraphQLClient,\n} from '../../../lib/graphql';\nimport { join } from 'node:path';\nimport { difference } from 'lodash-es';\nimport colors from 'colors';\nimport { logger } from '../../../logger';\nimport { dataFlowsToDataSilos } from '../../../lib/consent-manager/dataFlowsToDataSilos';\nimport { DataFlowInput } from '../../../codecs';\nimport { existsSync, lstatSync } from 'node:fs';\nimport { listFiles } from '../../../lib/api-keys';\nimport {\n readTranscendYaml,\n writeTranscendYaml,\n} from '../../../lib/readTranscendYaml';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface DeriveDataSilosFromDataFlowsCrossInstanceCommandFlags {\n auth: string;\n dataFlowsYmlFolder: string;\n output: string;\n ignoreYmls?: string[];\n transcendUrl: string;\n}\n\nexport async function deriveDataSilosFromDataFlowsCrossInstance(\n this: LocalContext,\n {\n auth,\n dataFlowsYmlFolder,\n output,\n ignoreYmls = [],\n transcendUrl,\n }: DeriveDataSilosFromDataFlowsCrossInstanceCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Ensure folder is passed\n if (\n !existsSync(dataFlowsYmlFolder) ||\n !lstatSync(dataFlowsYmlFolder).isDirectory()\n ) {\n logger.error(colors.red(`Folder does not exist: \"${dataFlowsYmlFolder}\"`));\n this.process.exit(1);\n }\n\n // Ignore the data flows in these yml files\n const instancesToIgnore = ignoreYmls.map((x) => x.split('.')[0]);\n\n // Map over each data flow yml file and convert to data silo configurations\n const dataSiloInputs = listFiles(dataFlowsYmlFolder).map((directory) => {\n // read in the data flows for a specific instance\n const { 'data-flows': dataFlows = [] } = readTranscendYaml(\n join(dataFlowsYmlFolder, directory),\n );\n\n // map the data flows to data silos\n const { adTechDataSilos, siteTechDataSilos } = dataFlowsToDataSilos(\n dataFlows as DataFlowInput[],\n {\n serviceToSupportedIntegration,\n serviceToTitle,\n },\n );\n\n return {\n adTechDataSilos,\n siteTechDataSilos,\n organizationName: directory.split('.')[0],\n };\n });\n\n // Mapping from service name to instances that have that service\n const serviceToInstance: { [k in string]: string[] } = {};\n dataSiloInputs.forEach(\n ({ adTechDataSilos, siteTechDataSilos, organizationName }) => {\n const allDataSilos = [...adTechDataSilos, ...siteTechDataSilos];\n allDataSilos.forEach((dataSilo) => {\n const service = dataSilo['outer-type'] || dataSilo.integrationName;\n // create mapping to instance\n if (!serviceToInstance[service]) {\n serviceToInstance[service] = [];\n }\n serviceToInstance[service]!.push(organizationName);\n serviceToInstance[service] = [...new Set(serviceToInstance[service])];\n });\n },\n );\n\n // List of ad tech integrations\n const adTechIntegrations = [\n ...new Set(\n dataSiloInputs\n .map(({ adTechDataSilos }) =>\n adTechDataSilos.map(\n (silo) => silo['outer-type'] || silo.integrationName,\n ),\n )\n .flat(),\n ),\n ];\n\n // List of site tech integrations\n const siteTechIntegrations = difference(\n [\n ...new Set(\n dataSiloInputs\n .map(({ siteTechDataSilos }) =>\n siteTechDataSilos.map(\n (silo) => silo['outer-type'] || silo.integrationName,\n ),\n )\n .flat(),\n ),\n ],\n adTechIntegrations,\n );\n\n // Mapping from service name to list of\n const serviceToFoundOnDomain: { [k in string]: string[] } = {};\n dataSiloInputs.forEach(({ adTechDataSilos, siteTechDataSilos }) => {\n const allDataSilos = [...adTechDataSilos, ...siteTechDataSilos];\n allDataSilos.forEach((dataSilo) => {\n const service = dataSilo['outer-type'] || dataSilo.integrationName;\n const foundOnDomain = dataSilo.attributes?.find(\n (attr) => attr.key === 'Found On Domain',\n );\n // create mapping to instance\n if (!serviceToFoundOnDomain[service]) {\n serviceToFoundOnDomain[service] = [];\n }\n serviceToFoundOnDomain[service]!.push(...(foundOnDomain?.values || []));\n serviceToFoundOnDomain[service] = [\n ...new Set(serviceToFoundOnDomain[service]),\n ];\n });\n });\n\n // Fetch all integrations in the catalog\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const { serviceToTitle, serviceToSupportedIntegration } =\n await fetchAndIndexCatalogs(client);\n\n // construct the aggregated data silo inputs\n const dataSilos = [...adTechIntegrations, ...siteTechIntegrations].map(\n (service) => ({\n title: serviceToTitle[service],\n ...(serviceToSupportedIntegration[service]\n ? { integrationName: service }\n : { integrationName: 'promptAPerson', 'outer-type': service }),\n attributes: [\n {\n key: 'Tech Type',\n values: ['Ad Tech'],\n },\n {\n key: 'Business Units',\n values: difference(\n serviceToInstance[service] || [],\n instancesToIgnore,\n ),\n },\n {\n key: 'Found On Domain',\n values: serviceToFoundOnDomain[service] || [],\n },\n ],\n }),\n );\n\n // Log output\n logger.log(`Total Services: ${dataSilos.length}`);\n logger.log(`Ad Tech Services: ${adTechIntegrations.length}`);\n logger.log(`Site Tech Services: ${siteTechIntegrations.length}`);\n\n // Write to yaml\n writeTranscendYaml(output, {\n 'data-silos': dataSilos,\n });\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-IQGUF37H.cjs","../src/commands/inventory/derive-data-silos-from-data-flows-cross-instance/impl.ts"],"names":["deriveDataSilosFromDataFlowsCrossInstance","auth","dataFlowsYmlFolder","output","ignoreYmls","transcendUrl","doneInputValidation","existsSync","lstatSync","logger","colors","instancesToIgnore","x","dataSiloInputs","listFiles","directory","dataFlows","readTranscendYaml","join","adTechDataSilos","siteTechDataSilos","dataFlowsToDataSilos","serviceToSupportedIntegration","serviceToTitle","serviceToInstance","organizationName","dataSilo","service","adTechIntegrations","silo","siteTechIntegrations","difference_default","serviceToFoundOnDomain","foundOnDomain","attr","client","buildTranscendGraphQLClient","fetchAndIndexCatalogs","dataSilos"],"mappings":"AAAA,quBAAwC,wDAAgD,wDAAyC,gCAA6B,wDAAyC,wDAAkD,gCAA6B,wDAAyC,wDAAyC,gCAA6B,4BCKhX,gFAEF,wBAImB,MAgBtC,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,kBAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CAAa,CAAC,CAAA,CACd,YAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAAA,CAInC,CAACC,4BAAAA,CAA6B,CAAA,EAC9B,CAACC,2BAAAA,CAA4B,CAAA,CAAE,WAAA,CAAY,CAAA,CAAA,EAAA,CAE3CC,mBAAAA,CAAO,KAAA,CAAMC,gBAAAA,CAAO,GAAA,CAAI,CAAA,wBAAA,EAA2BR,CAAkB,CAAA,CAAA,CAAG,CAAC,CAAA,CACzE,IAAA,CAAK,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,CAAA,CAIrB,IAAMS,CAAAA,CAAoBP,CAAAA,CAAW,GAAA,CAAKQ,CAAAA,EAAMA,CAAAA,CAAE,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAC,CAAA,CAGzDC,CAAAA,CAAiBC,iCAAAA,CAA4B,CAAA,CAAE,GAAA,CAAKC,CAAAA,EAAc,CAEtE,GAAM,CAAE,YAAA,CAAcC,CAAAA,CAAY,CAAC,CAAE,CAAA,CAAIC,iCAAAA,wBACvCC,CAAKhB,CAAoBa,CAAS,CACpC,CAAA,CAGM,CAAE,eAAA,CAAAI,CAAAA,CAAiB,iBAAA,CAAAC,CAAkB,CAAA,CAAIC,iCAAAA,CAC7CL,CACA,CACE,6BAAA,CAAAM,CAAAA,CACA,cAAA,CAAAC,CACF,CACF,CAAA,CAEA,MAAO,CACL,eAAA,CAAAJ,CAAAA,CACA,iBAAA,CAAAC,CAAAA,CACA,gBAAA,CAAkBL,CAAAA,CAAU,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAC1C,CACF,CAAC,CAAA,CAGKS,CAAAA,CAAiD,CAAC,CAAA,CACxDX,CAAAA,CAAe,OAAA,CACb,CAAC,CAAE,eAAA,CAAAM,CAAAA,CAAiB,iBAAA,CAAAC,CAAAA,CAAmB,gBAAA,CAAAK,CAAiB,CAAA,CAAA,EAAM,CACvC,CAAC,GAAGN,CAAAA,CAAiB,GAAGC,CAAiB,CAAA,CACjD,OAAA,CAASM,CAAAA,EAAa,CACjC,IAAMC,CAAAA,CAAUD,CAAAA,CAAS,YAAY,CAAA,EAAKA,CAAAA,CAAS,eAAA,CAE9CF,CAAAA,CAAkBG,CAAO,CAAA,EAAA,CAC5BH,CAAAA,CAAkBG,CAAO,CAAA,CAAI,CAAC,CAAA,CAAA,CAEhCH,CAAAA,CAAkBG,CAAO,CAAA,CAAG,IAAA,CAAKF,CAAgB,CAAA,CACjDD,CAAAA,CAAkBG,CAAO,CAAA,CAAI,CAAC,GAAG,IAAI,GAAA,CAAIH,CAAAA,CAAkBG,CAAO,CAAC,CAAC,CACtE,CAAC,CACH,CACF,CAAA,CAGA,IAAMC,CAAAA,CAAqB,CACzB,GAAG,IAAI,GAAA,CACLf,CAAAA,CACG,GAAA,CAAI,CAAC,CAAE,eAAA,CAAAM,CAAgB,CAAA,CAAA,EACtBA,CAAAA,CAAgB,GAAA,CACbU,CAAAA,EAASA,CAAAA,CAAK,YAAY,CAAA,EAAKA,CAAAA,CAAK,eACvC,CACF,CAAA,CACC,IAAA,CAAK,CACV,CACF,CAAA,CAGMC,CAAAA,CAAuBC,iCAAAA,CAEzB,GAAG,IAAI,GAAA,CACLlB,CAAAA,CACG,GAAA,CAAI,CAAC,CAAE,iBAAA,CAAAO,CAAkB,CAAA,CAAA,EACxBA,CAAAA,CAAkB,GAAA,CACfS,CAAAA,EAASA,CAAAA,CAAK,YAAY,CAAA,EAAKA,CAAAA,CAAK,eACvC,CACF,CAAA,CACC,IAAA,CAAK,CACV,CACF,CAAA,CACAD,CACF,CAAA,CAGMI,CAAAA,CAAsD,CAAC,CAAA,CAC7DnB,CAAAA,CAAe,OAAA,CAAQ,CAAC,CAAE,eAAA,CAAAM,CAAAA,CAAiB,iBAAA,CAAAC,CAAkB,CAAA,CAAA,EAAM,CAC5C,CAAC,GAAGD,CAAAA,CAAiB,GAAGC,CAAiB,CAAA,CACjD,OAAA,CAASM,CAAAA,EAAa,CACjC,IAAMC,CAAAA,CAAUD,CAAAA,CAAS,YAAY,CAAA,EAAKA,CAAAA,CAAS,eAAA,CAC7CO,CAAAA,iBAAgBP,CAAAA,mBAAS,UAAA,6BAAY,IAAA,mBACxCQ,CAAAA,EAASA,CAAAA,CAAK,GAAA,GAAQ,iBACzB,GAAA,CAEKF,CAAAA,CAAuBL,CAAO,CAAA,EAAA,CACjCK,CAAAA,CAAuBL,CAAO,CAAA,CAAI,CAAC,CAAA,CAAA,CAErCK,CAAAA,CAAuBL,CAAO,CAAA,CAAG,IAAA,CAAK,mBAAIM,CAAAA,6BAAe,QAAA,EAAU,CAAC,CAAE,CAAA,CACtED,CAAAA,CAAuBL,CAAO,CAAA,CAAI,CAChC,GAAG,IAAI,GAAA,CAAIK,CAAAA,CAAuBL,CAAO,CAAC,CAC5C,CACF,CAAC,CACH,CAAC,CAAA,CAGD,IAAMQ,CAAAA,CAASC,kCAAAA,CAA4B/B,CAAcJ,CAAI,CAAA,CACvD,CAAE,cAAA,CAAAsB,CAAAA,CAAgB,6BAAA,CAAAD,CAA8B,CAAA,CACpD,MAAMe,kCAAAA,CAA4B,CAAA,CAG9BC,CAAAA,CAAY,CAAC,GAAGV,CAAAA,CAAoB,GAAGE,CAAoB,CAAA,CAAE,GAAA,CAChEH,CAAAA,EAAAA,CAAa,CACZ,KAAA,CAAOJ,CAAAA,CAAeI,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,gBAAA,CACL,MAAA,CAAQI,iCAAAA,CACNP,CAAkBG,CAAO,CAAA,EAAK,CAAC,CAAA,CAC/BhB,CACF,CACF,CAAA,CACA,CACE,GAAA,CAAK,iBAAA,CACL,MAAA,CAAQqB,CAAAA,CAAuBL,CAAO,CAAA,EAAK,CAAC,CAC9C,CACF,CACF,CAAA,CACF,CAAA,CAGAlB,mBAAAA,CAAO,GAAA,CAAI,CAAA,gBAAA,EAAmB6B,CAAAA,CAAU,MAAM,CAAA,CAAA","file":"/home/runner/work/cli/cli/dist/impl-IQGUF37H.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport {\n fetchAndIndexCatalogs,\n buildTranscendGraphQLClient,\n} from '../../../lib/graphql';\nimport { join } from 'node:path';\nimport { difference } from 'lodash-es';\nimport colors from 'colors';\nimport { logger } from '../../../logger';\nimport { dataFlowsToDataSilos } from '../../../lib/consent-manager/dataFlowsToDataSilos';\nimport { DataFlowInput } from '../../../codecs';\nimport { existsSync, lstatSync } from 'node:fs';\nimport { listFiles } from '../../../lib/api-keys';\nimport {\n readTranscendYaml,\n writeTranscendYaml,\n} from '../../../lib/readTranscendYaml';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface DeriveDataSilosFromDataFlowsCrossInstanceCommandFlags {\n auth: string;\n dataFlowsYmlFolder: string;\n output: string;\n ignoreYmls?: string[];\n transcendUrl: string;\n}\n\nexport async function deriveDataSilosFromDataFlowsCrossInstance(\n this: LocalContext,\n {\n auth,\n dataFlowsYmlFolder,\n output,\n ignoreYmls = [],\n transcendUrl,\n }: DeriveDataSilosFromDataFlowsCrossInstanceCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Ensure folder is passed\n if (\n !existsSync(dataFlowsYmlFolder) ||\n !lstatSync(dataFlowsYmlFolder).isDirectory()\n ) {\n logger.error(colors.red(`Folder does not exist: \"${dataFlowsYmlFolder}\"`));\n this.process.exit(1);\n }\n\n // Ignore the data flows in these yml files\n const instancesToIgnore = ignoreYmls.map((x) => x.split('.')[0]);\n\n // Map over each data flow yml file and convert to data silo configurations\n const dataSiloInputs = listFiles(dataFlowsYmlFolder).map((directory) => {\n // read in the data flows for a specific instance\n const { 'data-flows': dataFlows = [] } = readTranscendYaml(\n join(dataFlowsYmlFolder, directory),\n );\n\n // map the data flows to data silos\n const { adTechDataSilos, siteTechDataSilos } = dataFlowsToDataSilos(\n dataFlows as DataFlowInput[],\n {\n serviceToSupportedIntegration,\n serviceToTitle,\n },\n );\n\n return {\n adTechDataSilos,\n siteTechDataSilos,\n organizationName: directory.split('.')[0],\n };\n });\n\n // Mapping from service name to instances that have that service\n const serviceToInstance: { [k in string]: string[] } = {};\n dataSiloInputs.forEach(\n ({ adTechDataSilos, siteTechDataSilos, organizationName }) => {\n const allDataSilos = [...adTechDataSilos, ...siteTechDataSilos];\n allDataSilos.forEach((dataSilo) => {\n const service = dataSilo['outer-type'] || dataSilo.integrationName;\n // create mapping to instance\n if (!serviceToInstance[service]) {\n serviceToInstance[service] = [];\n }\n serviceToInstance[service]!.push(organizationName);\n serviceToInstance[service] = [...new Set(serviceToInstance[service])];\n });\n },\n );\n\n // List of ad tech integrations\n const adTechIntegrations = [\n ...new Set(\n dataSiloInputs\n .map(({ adTechDataSilos }) =>\n adTechDataSilos.map(\n (silo) => silo['outer-type'] || silo.integrationName,\n ),\n )\n .flat(),\n ),\n ];\n\n // List of site tech integrations\n const siteTechIntegrations = difference(\n [\n ...new Set(\n dataSiloInputs\n .map(({ siteTechDataSilos }) =>\n siteTechDataSilos.map(\n (silo) => silo['outer-type'] || silo.integrationName,\n ),\n )\n .flat(),\n ),\n ],\n adTechIntegrations,\n );\n\n // Mapping from service name to list of\n const serviceToFoundOnDomain: { [k in string]: string[] } = {};\n dataSiloInputs.forEach(({ adTechDataSilos, siteTechDataSilos }) => {\n const allDataSilos = [...adTechDataSilos, ...siteTechDataSilos];\n allDataSilos.forEach((dataSilo) => {\n const service = dataSilo['outer-type'] || dataSilo.integrationName;\n const foundOnDomain = dataSilo.attributes?.find(\n (attr) => attr.key === 'Found On Domain',\n );\n // create mapping to instance\n if (!serviceToFoundOnDomain[service]) {\n serviceToFoundOnDomain[service] = [];\n }\n serviceToFoundOnDomain[service]!.push(...(foundOnDomain?.values || []));\n serviceToFoundOnDomain[service] = [\n ...new Set(serviceToFoundOnDomain[service]),\n ];\n });\n });\n\n // Fetch all integrations in the catalog\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const { serviceToTitle, serviceToSupportedIntegration } =\n await fetchAndIndexCatalogs(client);\n\n // construct the aggregated data silo inputs\n const dataSilos = [...adTechIntegrations, ...siteTechIntegrations].map(\n (service) => ({\n title: serviceToTitle[service],\n ...(serviceToSupportedIntegration[service]\n ? { integrationName: service }\n : { integrationName: 'promptAPerson', 'outer-type': service }),\n attributes: [\n {\n key: 'Tech Type',\n values: ['Ad Tech'],\n },\n {\n key: 'Business Units',\n values: difference(\n serviceToInstance[service] || [],\n instancesToIgnore,\n ),\n },\n {\n key: 'Found On Domain',\n values: serviceToFoundOnDomain[service] || [],\n },\n ],\n }),\n );\n\n // Log output\n logger.log(`Total Services: ${dataSilos.length}`);\n logger.log(`Ad Tech Services: ${adTechIntegrations.length}`);\n logger.log(`Site Tech Services: ${siteTechIntegrations.length}`);\n\n // Write to yaml\n writeTranscendYaml(output, {\n 'data-silos': dataSilos,\n });\n}\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkPGO2YKRXcjs = require('./chunk-PGO2YKRX.cjs');require('./chunk-D3VRD5F5.cjs');var _chunkP5GD5LAKcjs = require('./chunk-P5GD5LAK.cjs');require('./chunk-ABKDAPPR.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk56QKBG2Rcjs = require('./chunk-56QKBG2R.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');require('./chunk-DQCPGPXG.cjs');require('./chunk-7PB6LVSE.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _privacytypes = require('@transcend-io/privacy-types');async function x({auth:f,bundleTypes:r=[_privacytypes.ConsentBundleType.Production,_privacytypes.ConsentBundleType.Test],deploy:i,transcendUrl:s}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);let t=await _chunkP5GD5LAKcjs.b.call(void 0, f);typeof t=="string"?(await _chunkPGO2YKRXcjs.a.call(void 0, {deploy:i,transcendUrl:s,auth:t,bundleTypes:r}),_chunkZUNVPK23cjs.a.info(_colors2.default.green("Successfully updated Consent Manager!"))):(await _chunk56QKBG2Rcjs.b.call(void 0, t,async e=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating Consent Manager for organization "${e.organizationName}"...`)),await _chunkPGO2YKRXcjs.a.call(void 0, {deploy:i,transcendUrl:s,auth:e.apiKey,bundleTypes:r}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated Consent Manager for organization "${e.organizationName}"!`))}),_chunkZUNVPK23cjs.a.info(_colors2.default.green("Successfully updated Consent Managers!")))}exports.updateConsentManager = x;
2
+ //# sourceMappingURL=impl-IZIXOMMN.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-IZIXOMMN.cjs","../src/commands/consent/update-consent-manager/impl.ts"],"names":["updateConsentManager","auth","bundleTypes","ConsentBundleType","deploy","transcendUrl","doneInputValidation","apiKeyOrList","validateTranscendAuth","updateConsentManagerVersionToLatest","logger","colors","mapSeries","apiKey"],"mappings":"AAAA,iOAAmC,gCAA6B,wDAAyC,gCAA6B,wDAAyC,wDAAyC,gCAA6B,wDAAyC,gCAA6B,gCAA6B,gFCCrU,2DACe,MAelC,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CAAc,CAACC,+BAAAA,CAAkB,UAAA,CAAYA,+BAAAA,CAAkB,IAAI,CAAA,CACnE,MAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAGrC,IAAMC,CAAAA,CAAe,MAAMC,iCAAAA,CAA0B,CAAA,CAGjD,OAAOD,CAAAA,EAAiB,QAAA,CAAA,CAE1B,MAAME,iCAAAA,CACJ,MAAA,CAAAL,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,IAAA,CAAME,CAAAA,CACN,WAAA,CAAAL,CACF,CAAC,CAAA,CACDQ,mBAAAA,CAAO,IAAA,CAAKC,gBAAAA,CAAO,KAAA,CAAM,uCAAuC,CAAC,CAAA,CAAA,CAAA,CAEjE,MAAMC,iCAAAA,CAAUL,CAAc,MAAOM,CAAAA,EAAW,CAC9CH,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,OAAA,CACL,CAAA,2CAAA,EAA8CE,CAAAA,CAAO,gBAAgB,CAAA,IAAA,CACvE,CACF,CAAA,CAEA,MAAMJ,iCAAAA,CACJ,MAAA,CAAAL,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,IAAA,CAAMQ,CAAAA,CAAO,MAAA,CACb,WAAA,CAAAX,CACF,CAAC,CAAA,CAEDQ,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,KAAA,CACL,CAAA,uDAAA,EAA0DE,CAAAA,CAAO,gBAAgB,CAAA,EAAA,CACnF,CACF,CACF,CAAC,CAAA,CACDH,mBAAAA,CAAO,IAAA,CAAKC,gBAAAA,CAAO,KAAA,CAAM,wCAAwC,CAAC,CAAA,CAEtE,CAAA,iCAAA","file":"/home/runner/work/cli/cli/dist/impl-IZIXOMMN.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport colors from 'colors';\nimport { ConsentBundleType } from '@transcend-io/privacy-types';\nimport { mapSeries } from '../../../lib/bluebird';\n\nimport { logger } from '../../../logger';\nimport { updateConsentManagerVersionToLatest } from '../../../lib/consent-manager';\nimport { validateTranscendAuth } from '../../../lib/api-keys';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface UpdateConsentManagerCommandFlags {\n auth: string;\n bundleTypes: ConsentBundleType[];\n deploy: boolean;\n transcendUrl: string;\n}\n\nexport async function updateConsentManager(\n this: LocalContext,\n {\n auth,\n bundleTypes = [ConsentBundleType.Production, ConsentBundleType.Test],\n deploy,\n transcendUrl,\n }: UpdateConsentManagerCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Handle single update\n if (typeof apiKeyOrList === 'string') {\n // Update consent manager\n await updateConsentManagerVersionToLatest({\n deploy,\n transcendUrl,\n auth: apiKeyOrList,\n bundleTypes,\n });\n logger.info(colors.green('Successfully updated Consent Manager!'));\n } else {\n await mapSeries(apiKeyOrList, async (apiKey) => {\n logger.info(\n colors.magenta(\n `Updating Consent Manager for organization \"${apiKey.organizationName}\"...`,\n ),\n );\n\n await updateConsentManagerVersionToLatest({\n deploy,\n transcendUrl,\n auth: apiKey.apiKey,\n bundleTypes,\n });\n\n logger.info(\n colors.green(\n `Successfully updated Consent Manager for organization \"${apiKey.organizationName}\"!`,\n ),\n );\n });\n logger.info(colors.green('Successfully updated Consent Managers!'));\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk55B57ZAYcjs = require('./chunk-55B57ZAY.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkXXFLFF7Qcjs = require('./chunk-XXFLFF7Q.cjs');require('./chunk-7PB6LVSE.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);async function F({auth:n,transcendUrl:m,file:e,pageLimit:c,actions:p,sombraAuth:u,skipRequestIdentifiers:f,statuses:l,createdAtBefore:d,createdAtAfter:g,showTests:q}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);let{requestsFormattedForCsv:t}=await _chunk55B57ZAYcjs.Qf.call(void 0, {transcendUrl:m,pageLimit:c,actions:p,skipRequestIdentifiers:f,statuses:l,auth:n,sombraAuth:u,createdAtBefore:d,createdAtAfter:g,isTest:q}),x=_chunkXXFLFF7Qcjs.j.call(void 0, t.map(y=>Object.keys(y)).flat());await _chunk55B57ZAYcjs.tg.call(void 0, e,t,x),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully wrote ${t.length} requests to file "${e}"`))}exports._export = F;
2
- //# sourceMappingURL=impl-VT3C6SP4.cjs.map
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk56QKBG2Rcjs = require('./chunk-56QKBG2R.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkDQCPGPXGcjs = require('./chunk-DQCPGPXG.cjs');require('./chunk-7PB6LVSE.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);async function F({auth:n,transcendUrl:m,file:e,pageLimit:c,actions:p,sombraAuth:u,skipRequestIdentifiers:f,statuses:l,createdAtBefore:d,createdAtAfter:g,showTests:q}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);let{requestsFormattedForCsv:t}=await _chunk56QKBG2Rcjs.Sf.call(void 0, {transcendUrl:m,pageLimit:c,actions:p,skipRequestIdentifiers:f,statuses:l,auth:n,sombraAuth:u,createdAtBefore:d,createdAtAfter:g,isTest:q}),x=_chunkDQCPGPXGcjs.j.call(void 0, t.map(y=>Object.keys(y)).flat());await _chunk56QKBG2Rcjs.vg.call(void 0, e,t,x),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully wrote ${t.length} requests to file "${e}"`))}exports._export = F;
2
+ //# sourceMappingURL=impl-J5PWNHKL.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-VT3C6SP4.cjs","../src/commands/request/export/impl.ts"],"names":["_export","auth","transcendUrl","file","pageLimit","actions","sombraAuth","skipRequestIdentifiers","statuses","createdAtBefore","createdAtAfter","showTests","doneInputValidation","requestsFormattedForCsv","pullPrivacyRequests","headers","uniq_default","d","writeLargeCsv","logger","colors"],"mappings":"AAAA,iOAAmC,wDAAkD,gCAA6B,wDAAyC,wDAAyC,gCAA6B,gFCC9M,MA0BnB,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,sBAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,GAAM,CAAE,uBAAA,CAAAC,CAAwB,CAAA,CAAI,MAAMC,kCAAAA,CACxC,YAAA,CAAAZ,CAAAA,CACA,SAAA,CAAAE,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,sBAAA,CAAAE,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,IAAA,CAAAP,CAAAA,CACA,UAAA,CAAAK,CAAAA,CACA,eAAA,CAAAG,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,MAAA,CAAQC,CACV,CAAC,CAAA,CAGKI,CAAAA,CAAUC,iCAAAA,CACdH,CAAwB,GAAA,CAAKI,CAAAA,EAAM,MAAA,CAAO,IAAA,CAAKA,CAAC,CAAC,CAAA,CAAE,IAAA,CAAK,CAC1D,CAAA,CACA,MAAMC,kCAAAA,CAAcf,CAAMU,CAAAA,CAAyBE,CAAO,CAAA,CAC1DI,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,KAAA,CACL,CAAA,mBAAA,EAAsBP,CAAAA,CAAwB,MAAM,CAAA,mBAAA,EAAsBV,CAAI,CAAA,CAAA,CAChF,CACF,CACF,CAAA,oBAAA","file":"/home/runner/work/cli/cli/dist/impl-VT3C6SP4.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport colors from 'colors';\n\nimport { logger } from '../../../logger';\nimport { uniq } from 'lodash-es';\nimport { pullPrivacyRequests } from '../../../lib/requests';\nimport { writeLargeCsv } from '../../../lib/helpers';\nimport type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface ExportCommandFlags {\n auth: string;\n sombraAuth?: string;\n actions?: RequestAction[];\n statuses?: RequestStatus[];\n transcendUrl: string;\n file: string;\n concurrency: number;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n showTests?: boolean;\n skipRequestIdentifiers?: boolean;\n pageLimit: number;\n}\n\n// `export` is a reserved keyword, so we need to prefix it with an underscore\n// eslint-disable-next-line no-underscore-dangle\nexport async function _export(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n file,\n pageLimit,\n actions,\n sombraAuth,\n skipRequestIdentifiers,\n statuses,\n createdAtBefore,\n createdAtAfter,\n showTests,\n }: ExportCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const { requestsFormattedForCsv } = await pullPrivacyRequests({\n transcendUrl,\n pageLimit,\n actions,\n skipRequestIdentifiers,\n statuses,\n auth,\n sombraAuth,\n createdAtBefore,\n createdAtAfter,\n isTest: showTests,\n });\n\n // Write to CSV\n const headers = uniq(\n requestsFormattedForCsv.map((d) => Object.keys(d)).flat(),\n );\n await writeLargeCsv(file, requestsFormattedForCsv, headers);\n logger.info(\n colors.green(\n `Successfully wrote ${requestsFormattedForCsv.length} requests to file \"${file}\"`,\n ),\n );\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-J5PWNHKL.cjs","../src/commands/request/export/impl.ts"],"names":["_export","auth","transcendUrl","file","pageLimit","actions","sombraAuth","skipRequestIdentifiers","statuses","createdAtBefore","createdAtAfter","showTests","doneInputValidation","requestsFormattedForCsv","pullPrivacyRequests","headers","uniq_default","d","writeLargeCsv","logger","colors"],"mappings":"AAAA,iOAAmC,wDAAkD,gCAA6B,wDAAyC,wDAAyC,gCAA6B,gFCC9M,MA0BnB,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,sBAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,GAAM,CAAE,uBAAA,CAAAC,CAAwB,CAAA,CAAI,MAAMC,kCAAAA,CACxC,YAAA,CAAAZ,CAAAA,CACA,SAAA,CAAAE,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,sBAAA,CAAAE,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,IAAA,CAAAP,CAAAA,CACA,UAAA,CAAAK,CAAAA,CACA,eAAA,CAAAG,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,MAAA,CAAQC,CACV,CAAC,CAAA,CAGKI,CAAAA,CAAUC,iCAAAA,CACdH,CAAwB,GAAA,CAAKI,CAAAA,EAAM,MAAA,CAAO,IAAA,CAAKA,CAAC,CAAC,CAAA,CAAE,IAAA,CAAK,CAC1D,CAAA,CACA,MAAMC,kCAAAA,CAAcf,CAAMU,CAAAA,CAAyBE,CAAO,CAAA,CAC1DI,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,KAAA,CACL,CAAA,mBAAA,EAAsBP,CAAAA,CAAwB,MAAM,CAAA,mBAAA,EAAsBV,CAAI,CAAA,CAAA,CAChF,CACF,CACF,CAAA,oBAAA","file":"/home/runner/work/cli/cli/dist/impl-J5PWNHKL.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport colors from 'colors';\n\nimport { logger } from '../../../logger';\nimport { uniq } from 'lodash-es';\nimport { pullPrivacyRequests } from '../../../lib/requests';\nimport { writeLargeCsv } from '../../../lib/helpers';\nimport type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface ExportCommandFlags {\n auth: string;\n sombraAuth?: string;\n actions?: RequestAction[];\n statuses?: RequestStatus[];\n transcendUrl: string;\n file: string;\n concurrency: number;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n showTests?: boolean;\n skipRequestIdentifiers?: boolean;\n pageLimit: number;\n}\n\n// `export` is a reserved keyword, so we need to prefix it with an underscore\n// eslint-disable-next-line no-underscore-dangle\nexport async function _export(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n file,\n pageLimit,\n actions,\n sombraAuth,\n skipRequestIdentifiers,\n statuses,\n createdAtBefore,\n createdAtAfter,\n showTests,\n }: ExportCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const { requestsFormattedForCsv } = await pullPrivacyRequests({\n transcendUrl,\n pageLimit,\n actions,\n skipRequestIdentifiers,\n statuses,\n auth,\n sombraAuth,\n createdAtBefore,\n createdAtAfter,\n isTest: showTests,\n });\n\n // Write to CSV\n const headers = uniq(\n requestsFormattedForCsv.map((d) => Object.keys(d)).flat(),\n );\n await writeLargeCsv(file, requestsFormattedForCsv, headers);\n logger.info(\n colors.green(\n `Successfully wrote ${requestsFormattedForCsv.length} requests to file \"${file}\"`,\n ),\n );\n}\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk6TKTYQIFcjs = require('./chunk-6TKTYQIF.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');require('./chunk-56QKBG2R.cjs');require('./chunk-TSJTXXLZ.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-DQCPGPXG.cjs');require('./chunk-7PB6LVSE.cjs');async function u({auth:r,transcendUrl:i,file:e,enricherId:o,concurrency:s,markSilent:a,sombraAuth:m}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),await _chunk6TKTYQIFcjs.d.call(void 0, {file:e,transcendUrl:i,enricherId:o,concurrency:s,markSilent:a,auth:r,sombraAuth:m})}exports.pushIdentifiers = u;
2
+ //# sourceMappingURL=impl-JI6COVDW.cjs.map