@transcend-io/cli 8.34.0 → 8.34.1

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 (121) hide show
  1. package/dist/{api-keys-CDp8NUhN.cjs → api-keys-CQHYfnKg.cjs} +2 -2
  2. package/dist/{api-keys-CDp8NUhN.cjs.map → api-keys-CQHYfnKg.cjs.map} +1 -1
  3. package/dist/{app-rVGy2Ks-.cjs → app-DMYdPEeE.cjs} +18 -18
  4. package/dist/{app-rVGy2Ks-.cjs.map → app-DMYdPEeE.cjs.map} +1 -1
  5. package/dist/bin/bash-complete.cjs +1 -1
  6. package/dist/bin/cli.cjs +1 -1
  7. package/dist/bin/deprecated-command.cjs +1 -1
  8. package/dist/{code-scanning-BwfVNIHr.cjs → code-scanning-DjzRqe2Q.cjs} +2 -2
  9. package/dist/{code-scanning-BwfVNIHr.cjs.map → code-scanning-DjzRqe2Q.cjs.map} +1 -1
  10. package/dist/{command-3fhEz5PC.cjs → command-CQS4sg_3.cjs} +2 -2
  11. package/dist/{command-3fhEz5PC.cjs.map → command-CQS4sg_3.cjs.map} +1 -1
  12. package/dist/{consent-manager-DXWjvCtI.cjs → consent-manager-BplE7hDG.cjs} +2 -2
  13. package/dist/{consent-manager-DXWjvCtI.cjs.map → consent-manager-BplE7hDG.cjs.map} +1 -1
  14. package/dist/{constants-B-TmLA0w.cjs → constants-C2Ve1XaG.cjs} +2 -2
  15. package/dist/{constants-B-TmLA0w.cjs.map → constants-C2Ve1XaG.cjs.map} +1 -1
  16. package/dist/{cron-DQHN57v7.cjs → cron-BU5K5zwR.cjs} +2 -2
  17. package/dist/{cron-DQHN57v7.cjs.map → cron-BU5K5zwR.cjs.map} +1 -1
  18. package/dist/{data-inventory-flXV6qPl.cjs → data-inventory-CoAdyyxS.cjs} +2 -2
  19. package/dist/{data-inventory-flXV6qPl.cjs.map → data-inventory-CoAdyyxS.cjs.map} +1 -1
  20. package/dist/{dataFlowsToDataSilos-Lk7WQ39V.cjs → dataFlowsToDataSilos-DNzVrcGl.cjs} +2 -2
  21. package/dist/{dataFlowsToDataSilos-Lk7WQ39V.cjs.map → dataFlowsToDataSilos-DNzVrcGl.cjs.map} +1 -1
  22. package/dist/{impl-80GXtjmz.cjs → impl-7ZiJ8tQR.cjs} +2 -2
  23. package/dist/{impl-80GXtjmz.cjs.map → impl-7ZiJ8tQR.cjs.map} +1 -1
  24. package/dist/{impl-E1vzeNmp.cjs → impl-B36KTjnJ.cjs} +2 -2
  25. package/dist/{impl-E1vzeNmp.cjs.map → impl-B36KTjnJ.cjs.map} +1 -1
  26. package/dist/{impl-DoP4FUJI.cjs → impl-B4z6A2Aa.cjs} +2 -2
  27. package/dist/{impl-DoP4FUJI.cjs.map → impl-B4z6A2Aa.cjs.map} +1 -1
  28. package/dist/{impl-t_fZSUcj.cjs → impl-BBntVWRD.cjs} +2 -2
  29. package/dist/{impl-t_fZSUcj.cjs.map → impl-BBntVWRD.cjs.map} +1 -1
  30. package/dist/{impl-BjsBvvGF.cjs → impl-BIlbiOgY.cjs} +2 -2
  31. package/dist/{impl-BjsBvvGF.cjs.map → impl-BIlbiOgY.cjs.map} +1 -1
  32. package/dist/{impl-Cw7Jxx0V.cjs → impl-BKkiE384.cjs} +2 -2
  33. package/dist/{impl-Cw7Jxx0V.cjs.map → impl-BKkiE384.cjs.map} +1 -1
  34. package/dist/{impl-CZmlwib3.cjs → impl-BOaq2MA8.cjs} +2 -2
  35. package/dist/{impl-CZmlwib3.cjs.map → impl-BOaq2MA8.cjs.map} +1 -1
  36. package/dist/{impl-8PlQ3Cvy.cjs → impl-BWunvHHR.cjs} +2 -2
  37. package/dist/{impl-8PlQ3Cvy.cjs.map → impl-BWunvHHR.cjs.map} +1 -1
  38. package/dist/{impl-CCeEUy6z.cjs → impl-BYr3VngT.cjs} +2 -2
  39. package/dist/{impl-CCeEUy6z.cjs.map → impl-BYr3VngT.cjs.map} +1 -1
  40. package/dist/{impl-CaSO2LPb.cjs → impl-Bbzjk8q9.cjs} +2 -2
  41. package/dist/{impl-CaSO2LPb.cjs.map → impl-Bbzjk8q9.cjs.map} +1 -1
  42. package/dist/{impl-B4iI3rcF.cjs → impl-BcviCK8B.cjs} +2 -2
  43. package/dist/{impl-B4iI3rcF.cjs.map → impl-BcviCK8B.cjs.map} +1 -1
  44. package/dist/{impl-TQVXJemY.cjs → impl-BiiO-h6Y.cjs} +2 -2
  45. package/dist/{impl-TQVXJemY.cjs.map → impl-BiiO-h6Y.cjs.map} +1 -1
  46. package/dist/{impl-DX7gLoTo.cjs → impl-BosASPXe.cjs} +2 -2
  47. package/dist/{impl-DX7gLoTo.cjs.map → impl-BosASPXe.cjs.map} +1 -1
  48. package/dist/{impl-B6qG10UZ.cjs → impl-C4ss2ucp.cjs} +2 -2
  49. package/dist/{impl-B6qG10UZ.cjs.map → impl-C4ss2ucp.cjs.map} +1 -1
  50. package/dist/{impl-EEKe6HmF.cjs → impl-C9s0TQEw.cjs} +2 -2
  51. package/dist/{impl-EEKe6HmF.cjs.map → impl-C9s0TQEw.cjs.map} +1 -1
  52. package/dist/{impl-CtMVi5m1.cjs → impl-CA0qacrn.cjs} +2 -2
  53. package/dist/{impl-CtMVi5m1.cjs.map → impl-CA0qacrn.cjs.map} +1 -1
  54. package/dist/{impl-DrNWIvMG.cjs → impl-CCk0wXqs.cjs} +2 -2
  55. package/dist/{impl-DrNWIvMG.cjs.map → impl-CCk0wXqs.cjs.map} +1 -1
  56. package/dist/{impl-CrsHy3BZ.cjs → impl-CH3uHqRx.cjs} +2 -2
  57. package/dist/{impl-CrsHy3BZ.cjs.map → impl-CH3uHqRx.cjs.map} +1 -1
  58. package/dist/{impl-CaUSDPuW.cjs → impl-CIlOM3O6.cjs} +2 -2
  59. package/dist/{impl-CaUSDPuW.cjs.map → impl-CIlOM3O6.cjs.map} +1 -1
  60. package/dist/{impl-2u3q0rji.cjs → impl-CSMb-dkf.cjs} +2 -2
  61. package/dist/{impl-2u3q0rji.cjs.map → impl-CSMb-dkf.cjs.map} +1 -1
  62. package/dist/{impl-D0r4dSxM.cjs → impl-CXeNJIcH.cjs} +2 -2
  63. package/dist/{impl-D0r4dSxM.cjs.map → impl-CXeNJIcH.cjs.map} +1 -1
  64. package/dist/{impl-BJ8i_gqQ.cjs → impl-CXuqOTan.cjs} +2 -2
  65. package/dist/{impl-BJ8i_gqQ.cjs.map → impl-CXuqOTan.cjs.map} +1 -1
  66. package/dist/impl-CYLFESAX.cjs +2 -0
  67. package/dist/impl-CYLFESAX.cjs.map +1 -0
  68. package/dist/{impl-CzO7dqsL.cjs → impl-Cb8Eeujp.cjs} +2 -2
  69. package/dist/{impl-CzO7dqsL.cjs.map → impl-Cb8Eeujp.cjs.map} +1 -1
  70. package/dist/{impl-3ih-x09b.cjs → impl-CeV8WYuh.cjs} +2 -2
  71. package/dist/{impl-3ih-x09b.cjs.map → impl-CeV8WYuh.cjs.map} +1 -1
  72. package/dist/{impl-DjTjLgew.cjs → impl-CkmSG5-u.cjs} +2 -2
  73. package/dist/{impl-DjTjLgew.cjs.map → impl-CkmSG5-u.cjs.map} +1 -1
  74. package/dist/{impl-CwPRkBc0.cjs → impl-CpL-FXaD.cjs} +2 -2
  75. package/dist/{impl-CwPRkBc0.cjs.map → impl-CpL-FXaD.cjs.map} +1 -1
  76. package/dist/{impl-CpoSlP1o.cjs → impl-CuXmpSTK.cjs} +2 -2
  77. package/dist/{impl-CpoSlP1o.cjs.map → impl-CuXmpSTK.cjs.map} +1 -1
  78. package/dist/{impl-BZc5cmdE.cjs → impl-CudBe_Op.cjs} +2 -2
  79. package/dist/{impl-BZc5cmdE.cjs.map → impl-CudBe_Op.cjs.map} +1 -1
  80. package/dist/{impl-BqyO4vYa.cjs → impl-Cvpx0VQw.cjs} +2 -2
  81. package/dist/{impl-BqyO4vYa.cjs.map → impl-Cvpx0VQw.cjs.map} +1 -1
  82. package/dist/{impl-C2_oQebA.cjs → impl-D28UvIJR.cjs} +2 -2
  83. package/dist/{impl-C2_oQebA.cjs.map → impl-D28UvIJR.cjs.map} +1 -1
  84. package/dist/{impl-BuJNWbOW.cjs → impl-D3PocYdg.cjs} +2 -2
  85. package/dist/{impl-BuJNWbOW.cjs.map → impl-D3PocYdg.cjs.map} +1 -1
  86. package/dist/{impl-B1p9GNrM.cjs → impl-DHHbDwM6.cjs} +2 -2
  87. package/dist/{impl-B1p9GNrM.cjs.map → impl-DHHbDwM6.cjs.map} +1 -1
  88. package/dist/{impl-Bc9DMV-V.cjs → impl-DLUb2c_k.cjs} +2 -2
  89. package/dist/{impl-Bc9DMV-V.cjs.map → impl-DLUb2c_k.cjs.map} +1 -1
  90. package/dist/{impl-DcQ_HfDZ.cjs → impl-DZPUKAOh.cjs} +2 -2
  91. package/dist/{impl-DcQ_HfDZ.cjs.map → impl-DZPUKAOh.cjs.map} +1 -1
  92. package/dist/{impl-DOmKR8yz.cjs → impl-Dbvahnag.cjs} +2 -2
  93. package/dist/{impl-DOmKR8yz.cjs.map → impl-Dbvahnag.cjs.map} +1 -1
  94. package/dist/{impl-CUkxcZrf.cjs → impl-DyUn0CY0.cjs} +2 -2
  95. package/dist/{impl-CUkxcZrf.cjs.map → impl-DyUn0CY0.cjs.map} +1 -1
  96. package/dist/{impl-DvlAq8xf.cjs → impl-HxQkbH-v.cjs} +2 -2
  97. package/dist/{impl-DvlAq8xf.cjs.map → impl-HxQkbH-v.cjs.map} +1 -1
  98. package/dist/{impl-Bsqlw8_g.cjs → impl-XGErHk8S.cjs} +2 -2
  99. package/dist/{impl-Bsqlw8_g.cjs.map → impl-XGErHk8S.cjs.map} +1 -1
  100. package/dist/{impl-DBnRvkUi.cjs → impl-gZA9IzRe.cjs} +2 -2
  101. package/dist/{impl-DBnRvkUi.cjs.map → impl-gZA9IzRe.cjs.map} +1 -1
  102. package/dist/{impl-b6KwZ74o.cjs → impl-l4-zrJDk.cjs} +2 -2
  103. package/dist/{impl-b6KwZ74o.cjs.map → impl-l4-zrJDk.cjs.map} +1 -1
  104. package/dist/{impl-Cc-Lfiig.cjs → impl-mn91PHXE.cjs} +2 -2
  105. package/dist/{impl-Cc-Lfiig.cjs.map → impl-mn91PHXE.cjs.map} +1 -1
  106. package/dist/index.cjs +1 -1
  107. package/dist/index.d.cts +12 -10
  108. package/dist/{manual-enrichment-Y_BQaSZQ.cjs → manual-enrichment-NFVrfdss.cjs} +2 -2
  109. package/dist/{manual-enrichment-Y_BQaSZQ.cjs.map → manual-enrichment-NFVrfdss.cjs.map} +1 -1
  110. package/dist/{pooling-Ct83vfEh.cjs → pooling-EYc9IiSf.cjs} +2 -2
  111. package/dist/{pooling-Ct83vfEh.cjs.map → pooling-EYc9IiSf.cjs.map} +1 -1
  112. package/dist/{preference-management-5uJDKuMK.cjs → preference-management-BvvoySGZ.cjs} +2 -2
  113. package/dist/{preference-management-5uJDKuMK.cjs.map → preference-management-BvvoySGZ.cjs.map} +1 -1
  114. package/dist/{syncConfigurationToTranscend-Bpge5AcC.cjs → syncConfigurationToTranscend-CpoC4raI.cjs} +176 -176
  115. package/dist/syncConfigurationToTranscend-CpoC4raI.cjs.map +1 -0
  116. package/dist/{uploadConsents-CJc_6Qwd.cjs → uploadConsents-BVjLnCTQ.cjs} +2 -2
  117. package/dist/{uploadConsents-CJc_6Qwd.cjs.map → uploadConsents-BVjLnCTQ.cjs.map} +1 -1
  118. package/package.json +1 -1
  119. package/dist/impl-NdV_MRsm.cjs +0 -2
  120. package/dist/impl-NdV_MRsm.cjs.map +0 -1
  121. package/dist/syncConfigurationToTranscend-Bpge5AcC.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DcQ_HfDZ.cjs","names":["fastcsv","Parser","Transform","extractErrorMessage","makeHeader","makeWorkerRows","computePoolSize","runPool","CHILD_FLAG","dashboardPlugin","createExtraKeyHandler"],"sources":["../src/lib/helpers/collectCsvFilesOrExit.ts","../src/lib/helpers/chunkOneCsvFile.ts","../src/commands/admin/chunk-csv/worker.ts","../src/commands/admin/chunk-csv/ui/plugin.ts","../src/commands/admin/chunk-csv/impl.ts"],"sourcesContent":["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","import { createReadStream, createWriteStream } from 'node:fs';\nimport { mkdir, readdir, unlink, stat } from 'node:fs/promises';\nimport { pipeline } from 'node:stream/promises';\nimport { Transform } from 'node:stream';\nimport { once } from 'node:events';\nimport { Parser } from 'csv-parse';\nimport { basename, dirname, join } from 'node:path';\nimport colors from 'colors';\nimport * as fastcsv from 'fast-csv';\nimport { logger } from '../../logger';\n\n/**\n * Options for chunking a single CSV file\n */\nexport type ChunkOpts = {\n /** Path to the CSV file to chunk */\n filePath: string;\n /** Output directory for chunk files; defaults to the same directory as the input file */\n outputDir?: string;\n /** Clear output directory before starting */\n clearOutputDir: boolean;\n /** Chunk size in MB */\n chunkSizeMB: number;\n /** Optional report interval in milliseconds for progress updates */\n reportEveryMs?: number;\n /** Callback for progress updates */\n onProgress: (processed: number, total?: number) => void;\n};\n\n/**\n * Create a CSV writer (fast-csv formatter piped to a write stream) that writes\n * a header line first, and then accepts object rows. Returns a tiny API to\n * write rows with backpressure handling and to close the file cleanly.\n *\n * @param filePath - The path to the output CSV file\n * @param headers - The headers for the CSV file\n * @returns An object with `write` and `end` methods\n */\nfunction createCsvChunkWriter(\n filePath: string,\n headers: string[],\n): {\n /** Write a row object to the CSV file */\n write: (row: Record<string, unknown>) => Promise<void>;\n /** Close the CSV file, ensuring all data is flushed */\n end: () => Promise<void>;\n} {\n const ws = createWriteStream(filePath);\n const csv = fastcsv.format({ headers, writeHeaders: true, objectMode: true });\n // Pipe csv → file stream\n csv.pipe(ws);\n\n return {\n /**\n * Write a row object to the CSV file.\n *\n * @param row - The row data as an object\n */\n async write(row) {\n // Respect backpressure from fast-csv formatter\n const ok = csv.write(row);\n if (!ok) {\n await once(csv, 'drain');\n }\n },\n /**\n * Close the CSV file, ensuring all data is flushed.\n */\n async end() {\n // End formatter; wait for underlying file stream to finish flush/close\n const finished = Promise.all([once(ws, 'finish')]);\n csv.end();\n await finished;\n },\n };\n}\n\n/**\n * Zero-pad chunk numbers to four digits (e.g., 1 → \"0001\").\n *\n * @param n - The chunk number to pad\n * @returns The padded chunk number as a string\n */\nfunction pad4(n: number): string {\n return String(n).padStart(4, '0');\n}\n\n/**\n * Approximate row size in bytes using comma-joined field values.\n *\n * @param obj - The row object to estimate size for\n * @returns Approximate byte size of the row when serialized as CSV\n */\nfunction approxRowBytes(obj: Record<string, unknown>): number {\n // naive but fast; adequate for chunk rollover thresholding\n return Buffer.byteLength(\n Object.values(obj)\n .map((v) => (v == null ? '' : String(v)))\n .join(','),\n 'utf8',\n );\n}\n\n/**\n * Stream a single CSV file and write chunk files of roughly chunkSizeMB.\n * - Writes header to each chunk.\n * - Logs periodic progress via onProgress.\n *\n * @param opts - Options for chunking the file\n * @returns Promise that resolves when done\n */\nexport async function chunkOneCsvFile(opts: ChunkOpts): Promise<void> {\n const {\n filePath,\n outputDir,\n clearOutputDir,\n chunkSizeMB,\n onProgress,\n reportEveryMs = 500,\n } = opts;\n const { size: fileBytes } = await stat(filePath); // total bytes on disk\n let lastTick = 0;\n\n logger.info(\n colors.magenta(`Chunking ${filePath} into ~${chunkSizeMB}MB files...`),\n );\n\n const chunkSizeBytes = Math.floor(chunkSizeMB * 1024 * 1024);\n const baseName = basename(filePath, '.csv');\n const outDir = outputDir || dirname(filePath);\n logger.info(colors.magenta(`Output directory: ${outDir}`));\n await mkdir(outDir, { recursive: true });\n\n // Clear previous chunk files for this base\n if (clearOutputDir) {\n logger.warn(colors.yellow(`Clearing output directory: ${outDir}`));\n const files = await readdir(outDir);\n await Promise.all(\n files\n .filter((f) => f.startsWith(`${baseName}_chunk_`) && f.endsWith('.csv'))\n .map((f) => unlink(join(outDir, f))),\n );\n }\n\n let headerRow: string[] | null = null;\n let expectedCols: number | null = null;\n let totalLines = 0;\n let currentChunk = 1;\n let currentSize = 0;\n\n const parser = new Parser({\n columns: false,\n skip_empty_lines: true,\n });\n\n // running sample to estimate avg row bytes\n let sampleBytes = 0;\n let sampleRows = 0;\n\n const emit = (): void => {\n const avg = sampleRows > 0 ? sampleBytes / sampleRows : 0;\n const estTotal =\n avg > 0 ? Math.max(totalLines, Math.ceil(fileBytes / avg)) : undefined;\n onProgress(totalLines, estTotal); // <-- now has total\n lastTick = Date.now();\n };\n\n // seed an initial 0/N as soon as we start\n emit();\n\n // Current active chunk writer; created after we know headers\n let writer: {\n /** Write a row object to the current chunk file */\n write: (row: Record<string, unknown>) => Promise<void>;\n /** Close the current chunk file */\n end: () => Promise<void>;\n } | null = null;\n\n // Returns current chunk file path — chunk number is always 4-digit padded\n const currentChunkPath = (): string =>\n join(outDir, `${baseName}_chunk_${pad4(currentChunk)}.csv`);\n\n const t = new Transform({\n objectMode: true,\n /**\n * Transform each row of the CSV file into a chunk.\n *\n * @param row - The current row being processed\n * @param _enc - Encoding (not used)\n * @param cb - Callback to signal completion or error\n */\n async transform(row: string[], _enc, cb) {\n try {\n // First row is the header\n if (!headerRow) {\n headerRow = row.slice(0);\n expectedCols = headerRow.length;\n\n // Open first chunk with header asynchronously\n writer = createCsvChunkWriter(currentChunkPath(), headerRow);\n cb();\n return;\n }\n\n // sanity check rows (non-fatal)\n if (expectedCols !== null && row.length !== expectedCols) {\n // optionally log a warning or collect metrics\n logger.warn(\n colors.yellow(\n `Row has ${row.length} cols; expected ${expectedCols}`,\n ),\n );\n }\n\n totalLines += 1;\n if (totalLines % 250_000 === 0) {\n onProgress(totalLines);\n }\n\n // Build row object using the original header\n const obj = Object.fromEntries(headerRow!.map((h, i) => [h, row[i]]));\n\n // Determine the row size up-front\n const rowBytes = approxRowBytes(obj);\n sampleBytes += rowBytes;\n sampleRows += 1;\n\n // time-based throttle for UI updates\n if (Date.now() - lastTick >= reportEveryMs) emit();\n\n // If adding this row would exceed the threshold, roll first,\n // so this row becomes the first row in the next chunk.\n if (\n writer &&\n currentSize > 0 &&\n currentSize + rowBytes > chunkSizeBytes\n ) {\n await writer.end();\n currentChunk += 1;\n currentSize = 0;\n logger.info(\n colors.green(\n `Rolling to chunk ${currentChunk} after ${totalLines.toLocaleString()} rows.`,\n ),\n );\n writer = createCsvChunkWriter(currentChunkPath(), headerRow!);\n }\n\n // Ensure writer exists (should after header)\n if (!writer) {\n writer = createCsvChunkWriter(currentChunkPath(), headerRow!);\n }\n\n // Write row and update approximate size\n await writer.write(obj);\n currentSize += rowBytes;\n\n cb();\n } catch (e) {\n cb(e as Error);\n }\n },\n\n // Ensure final file is closed\n /**\n * Flush is called when the readable has ended; we close any open writer.\n *\n * @param cb - Callback to signal completion or error\n */\n async flush(cb) {\n try {\n if (writer) {\n await writer.end();\n writer = null;\n }\n emit(); // Final progress tick\n cb();\n } catch (e) {\n cb(e as Error);\n }\n },\n });\n\n const rs = createReadStream(filePath);\n await pipeline(rs, parser, t);\n\n // Final progress tick\n onProgress(totalLines);\n logger.info(\n colors.green(\n `Chunked ${filePath} into ${currentChunk} file(s); processed ${totalLines.toLocaleString()} rows.`,\n ),\n );\n}\n","import { extractErrorMessage } from '../../../lib/helpers';\nimport { chunkOneCsvFile } from '../../../lib/helpers/chunkOneCsvFile';\nimport type { ToWorker } from '../../../lib/pooling';\nimport { logger } from '../../../logger';\n\n/**\n * A unit of work: instructs a worker to chunk a single CSV file.\n */\nexport type ChunkTask = {\n /** Absolute path of the CSV file to chunk. */\n filePath: string;\n /** Options controlling output and chunk size. */\n options: {\n /** Optional directory where chunked output files should be written. */\n outputDir?: string;\n /** Whether to clear any pre-existing output chunks before writing new ones. */\n clearOutputDir: boolean;\n /** Approximate target chunk size in MB (well under Node’s string size limits). */\n chunkSizeMB: number;\n };\n};\n\n/**\n * Per-worker progress snapshot for the chunk-csv command.\n */\nexport type ChunkProgress = {\n /** File being processed by the worker. */\n filePath: string;\n /** Number of rows processed so far. */\n processed: number;\n /** Optional total rows in the file (not always known). */\n total?: number;\n};\n\n/**\n * Worker result message once a file has finished processing.\n */\nexport type ChunkResult = {\n /** Whether the file completed successfully. */\n ok: boolean;\n /** File path for which this result applies. */\n filePath: string;\n /** Optional error message if the file failed to chunk. */\n error?: string;\n};\n\n/**\n * Worker entrypoint.\n *\n * Lifecycle:\n * 1) Announce readiness to the parent via `{ type: 'ready' }`.\n * 2) Wait for `{ type: 'task' }` messages; for each, call `chunkOneCsvFile(...)`.\n * - While chunking, forward progress to the parent via `{ type: 'progress' }`.\n * - On completion, send `{ type: 'result', ok: true }`.\n * - On error, send `{ type: 'result', ok: false, error }` and exit(1).\n * 3) On `{ type: 'shutdown' }`, exit(0) gracefully.\n *\n * Notes:\n * - This process is typically spawned by a pool manager that assigns file paths to workers.\n * - The long-lived promise at the end keeps the worker alive between tasks until the parent\n * sends an explicit shutdown.\n */\nexport async function runChild(): Promise<void> {\n const workerId = Number(process.env.WORKER_ID || '0');\n logger.info(`[w${workerId}] ready pid=${process.pid}`);\n\n // Notify the parent that the worker is ready to receive tasks.\n process.send?.({ type: 'ready' });\n\n // Main message loop: receive tasks and shutdown requests from the parent.\n process.on('message', async (msg: ToWorker<ChunkTask>) => {\n if (!msg || typeof msg !== 'object') return;\n\n // Graceful shutdown: let the parent control lifecycle.\n if (msg.type === 'shutdown') {\n process.exit(0);\n }\n\n // Only handle task messages here.\n if (msg.type !== 'task') return;\n\n const { filePath, options } = msg.payload;\n const { outputDir, clearOutputDir, chunkSizeMB } = options;\n\n try {\n // Stream the input CSV and write chunk files asynchronously.\n await chunkOneCsvFile({\n filePath,\n outputDir,\n clearOutputDir,\n chunkSizeMB,\n // Propagate incremental progress to the parent.\n onProgress: (processed, total) =>\n process.send?.({\n type: 'progress',\n payload: { filePath, processed, total },\n }),\n });\n\n // Report success to the parent.\n process.send?.({\n type: 'result',\n payload: { ok: true, filePath },\n });\n } catch (err) {\n // Log locally and report failure upstream; exit the worker with error code.\n const message = extractErrorMessage(err);\n logger.error(`[w${workerId}] ERROR ${filePath}: ${message}`);\n process.send?.({\n type: 'result',\n payload: { ok: false, filePath, error: message },\n });\n }\n });\n\n // keep alive\n await new Promise<never>(() => {\n // This promise never resolves, keeping the worker alive indefinitely\n // until the parent process instructs shutdown.\n });\n}\n","import {\n makeHeader,\n makeWorkerRows,\n type ChunkSlotProgress,\n type CommonCtx,\n type DashboardPlugin,\n} from '../../../../lib/pooling';\n\n/**\n * Header for chunk-csv (no extra totals block).\n *\n * @param ctx - Dashboard context.\n * @returns Header lines.\n */\nfunction renderHeader<TTotals>(\n ctx: CommonCtx<TTotals, ChunkSlotProgress>,\n): string[] {\n // no extra lines — reuse the shared header as-is\n return makeHeader(ctx);\n}\n\n/**\n * Worker rows for chunk-csv — share the generic row renderer.\n *\n * @param ctx - Dashboard context.\n * @returns Array of strings, each representing one worker row.\n */\nfunction renderWorkers<TTotals>(\n ctx: CommonCtx<TTotals, ChunkSlotProgress>,\n): string[] {\n return makeWorkerRows(ctx);\n}\n\nexport const chunkCsvPlugin: DashboardPlugin<unknown, ChunkSlotProgress> = {\n renderHeader,\n renderWorkers,\n // no extras\n};\n","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"],"mappings":"wjBAcA,SAAgB,EACd,EACA,EACU,CACL,IACH,EAAA,EAAO,MAAM,EAAA,QAAO,IAAI,kCAAkC,CAAC,CAC3D,EAAa,QAAQ,KAAK,EAAE,EAG9B,IAAI,EAAkB,EAAE,CAC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AM,CACJ,YACA,YACA,iBACA,cACA,cACA,cACE,EAGE,EAAQ,EAAsB,EAAW,KAAK,CAG9C,CAAE,WAAU,YAAaC,EAAAA,EAAgB,EAAa,EAAM,OAAO,CAEzE,EAAA,EAAO,KACL,EAAA,QAAO,MACL,YAAY,EAAM,OAAO,8BAA8B,EAAS,QAAQ,EAAS,GAClF,CACF,CAGD,IAAM,EAAQ,EAAM,IAAgB,IAAc,CAChD,WACA,QAAS,CAAE,YAAW,iBAAgB,cAAa,CACpD,EAAE,CAiBH,MAAMC,EAAAA,EAAQ,CACZ,MAAO,eAAe,IACtB,QAAS,GAAa,GAAa,QAAQ,KAAK,CAChD,UAAWC,EAAAA,EACX,gBAAiB,GAAsB,CACvC,WACA,WACA,WAAY,EAAM,OAClB,MAtBsE,CACtE,aAAgB,EAAM,OAAO,CAC7B,UAAY,GAAM,EAAE,SACpB,gBAAmB,EAAE,EACrB,qBAAwB,IAAA,GACxB,WAAa,GAAW,EACxB,UAAW,EAAQ,KAAS,CAAE,SAAQ,GAAI,CAAC,CAAC,EAAI,GAAI,EAEpD,YAAa,SAAY,GAG1B,CAYC,aACA,OAAS,GAAUC,EAAAA,EAAgB,EAAO,EAAgB,EAAW,CACrE,iBAAkB,CAAE,aAAY,UAAS,eACvCC,EAAAA,EAAsB,CACpB,aACA,UACA,YACD,CAAC,CACL,CAAC,CAMA,QAAQ,KAAK,SAASF,EAAAA,EAAW,EACnC,GAAU,CAAC,MAAO,GAAQ,CACxB,EAAA,EAAO,MAAM,EAAI,CACjB,QAAQ,KAAK,EAAE,EACf"}
1
+ {"version":3,"file":"impl-DZPUKAOh.cjs","names":["fastcsv","Parser","Transform","extractErrorMessage","makeHeader","makeWorkerRows","computePoolSize","runPool","CHILD_FLAG","dashboardPlugin","createExtraKeyHandler"],"sources":["../src/lib/helpers/collectCsvFilesOrExit.ts","../src/lib/helpers/chunkOneCsvFile.ts","../src/commands/admin/chunk-csv/worker.ts","../src/commands/admin/chunk-csv/ui/plugin.ts","../src/commands/admin/chunk-csv/impl.ts"],"sourcesContent":["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","import { createReadStream, createWriteStream } from 'node:fs';\nimport { mkdir, readdir, unlink, stat } from 'node:fs/promises';\nimport { pipeline } from 'node:stream/promises';\nimport { Transform } from 'node:stream';\nimport { once } from 'node:events';\nimport { Parser } from 'csv-parse';\nimport { basename, dirname, join } from 'node:path';\nimport colors from 'colors';\nimport * as fastcsv from 'fast-csv';\nimport { logger } from '../../logger';\n\n/**\n * Options for chunking a single CSV file\n */\nexport type ChunkOpts = {\n /** Path to the CSV file to chunk */\n filePath: string;\n /** Output directory for chunk files; defaults to the same directory as the input file */\n outputDir?: string;\n /** Clear output directory before starting */\n clearOutputDir: boolean;\n /** Chunk size in MB */\n chunkSizeMB: number;\n /** Optional report interval in milliseconds for progress updates */\n reportEveryMs?: number;\n /** Callback for progress updates */\n onProgress: (processed: number, total?: number) => void;\n};\n\n/**\n * Create a CSV writer (fast-csv formatter piped to a write stream) that writes\n * a header line first, and then accepts object rows. Returns a tiny API to\n * write rows with backpressure handling and to close the file cleanly.\n *\n * @param filePath - The path to the output CSV file\n * @param headers - The headers for the CSV file\n * @returns An object with `write` and `end` methods\n */\nfunction createCsvChunkWriter(\n filePath: string,\n headers: string[],\n): {\n /** Write a row object to the CSV file */\n write: (row: Record<string, unknown>) => Promise<void>;\n /** Close the CSV file, ensuring all data is flushed */\n end: () => Promise<void>;\n} {\n const ws = createWriteStream(filePath);\n const csv = fastcsv.format({ headers, writeHeaders: true, objectMode: true });\n // Pipe csv → file stream\n csv.pipe(ws);\n\n return {\n /**\n * Write a row object to the CSV file.\n *\n * @param row - The row data as an object\n */\n async write(row) {\n // Respect backpressure from fast-csv formatter\n const ok = csv.write(row);\n if (!ok) {\n await once(csv, 'drain');\n }\n },\n /**\n * Close the CSV file, ensuring all data is flushed.\n */\n async end() {\n // End formatter; wait for underlying file stream to finish flush/close\n const finished = Promise.all([once(ws, 'finish')]);\n csv.end();\n await finished;\n },\n };\n}\n\n/**\n * Zero-pad chunk numbers to four digits (e.g., 1 → \"0001\").\n *\n * @param n - The chunk number to pad\n * @returns The padded chunk number as a string\n */\nfunction pad4(n: number): string {\n return String(n).padStart(4, '0');\n}\n\n/**\n * Approximate row size in bytes using comma-joined field values.\n *\n * @param obj - The row object to estimate size for\n * @returns Approximate byte size of the row when serialized as CSV\n */\nfunction approxRowBytes(obj: Record<string, unknown>): number {\n // naive but fast; adequate for chunk rollover thresholding\n return Buffer.byteLength(\n Object.values(obj)\n .map((v) => (v == null ? '' : String(v)))\n .join(','),\n 'utf8',\n );\n}\n\n/**\n * Stream a single CSV file and write chunk files of roughly chunkSizeMB.\n * - Writes header to each chunk.\n * - Logs periodic progress via onProgress.\n *\n * @param opts - Options for chunking the file\n * @returns Promise that resolves when done\n */\nexport async function chunkOneCsvFile(opts: ChunkOpts): Promise<void> {\n const {\n filePath,\n outputDir,\n clearOutputDir,\n chunkSizeMB,\n onProgress,\n reportEveryMs = 500,\n } = opts;\n const { size: fileBytes } = await stat(filePath); // total bytes on disk\n let lastTick = 0;\n\n logger.info(\n colors.magenta(`Chunking ${filePath} into ~${chunkSizeMB}MB files...`),\n );\n\n const chunkSizeBytes = Math.floor(chunkSizeMB * 1024 * 1024);\n const baseName = basename(filePath, '.csv');\n const outDir = outputDir || dirname(filePath);\n logger.info(colors.magenta(`Output directory: ${outDir}`));\n await mkdir(outDir, { recursive: true });\n\n // Clear previous chunk files for this base\n if (clearOutputDir) {\n logger.warn(colors.yellow(`Clearing output directory: ${outDir}`));\n const files = await readdir(outDir);\n await Promise.all(\n files\n .filter((f) => f.startsWith(`${baseName}_chunk_`) && f.endsWith('.csv'))\n .map((f) => unlink(join(outDir, f))),\n );\n }\n\n let headerRow: string[] | null = null;\n let expectedCols: number | null = null;\n let totalLines = 0;\n let currentChunk = 1;\n let currentSize = 0;\n\n const parser = new Parser({\n columns: false,\n skip_empty_lines: true,\n });\n\n // running sample to estimate avg row bytes\n let sampleBytes = 0;\n let sampleRows = 0;\n\n const emit = (): void => {\n const avg = sampleRows > 0 ? sampleBytes / sampleRows : 0;\n const estTotal =\n avg > 0 ? Math.max(totalLines, Math.ceil(fileBytes / avg)) : undefined;\n onProgress(totalLines, estTotal); // <-- now has total\n lastTick = Date.now();\n };\n\n // seed an initial 0/N as soon as we start\n emit();\n\n // Current active chunk writer; created after we know headers\n let writer: {\n /** Write a row object to the current chunk file */\n write: (row: Record<string, unknown>) => Promise<void>;\n /** Close the current chunk file */\n end: () => Promise<void>;\n } | null = null;\n\n // Returns current chunk file path — chunk number is always 4-digit padded\n const currentChunkPath = (): string =>\n join(outDir, `${baseName}_chunk_${pad4(currentChunk)}.csv`);\n\n const t = new Transform({\n objectMode: true,\n /**\n * Transform each row of the CSV file into a chunk.\n *\n * @param row - The current row being processed\n * @param _enc - Encoding (not used)\n * @param cb - Callback to signal completion or error\n */\n async transform(row: string[], _enc, cb) {\n try {\n // First row is the header\n if (!headerRow) {\n headerRow = row.slice(0);\n expectedCols = headerRow.length;\n\n // Open first chunk with header asynchronously\n writer = createCsvChunkWriter(currentChunkPath(), headerRow);\n cb();\n return;\n }\n\n // sanity check rows (non-fatal)\n if (expectedCols !== null && row.length !== expectedCols) {\n // optionally log a warning or collect metrics\n logger.warn(\n colors.yellow(\n `Row has ${row.length} cols; expected ${expectedCols}`,\n ),\n );\n }\n\n totalLines += 1;\n if (totalLines % 250_000 === 0) {\n onProgress(totalLines);\n }\n\n // Build row object using the original header\n const obj = Object.fromEntries(headerRow!.map((h, i) => [h, row[i]]));\n\n // Determine the row size up-front\n const rowBytes = approxRowBytes(obj);\n sampleBytes += rowBytes;\n sampleRows += 1;\n\n // time-based throttle for UI updates\n if (Date.now() - lastTick >= reportEveryMs) emit();\n\n // If adding this row would exceed the threshold, roll first,\n // so this row becomes the first row in the next chunk.\n if (\n writer &&\n currentSize > 0 &&\n currentSize + rowBytes > chunkSizeBytes\n ) {\n await writer.end();\n currentChunk += 1;\n currentSize = 0;\n logger.info(\n colors.green(\n `Rolling to chunk ${currentChunk} after ${totalLines.toLocaleString()} rows.`,\n ),\n );\n writer = createCsvChunkWriter(currentChunkPath(), headerRow!);\n }\n\n // Ensure writer exists (should after header)\n if (!writer) {\n writer = createCsvChunkWriter(currentChunkPath(), headerRow!);\n }\n\n // Write row and update approximate size\n await writer.write(obj);\n currentSize += rowBytes;\n\n cb();\n } catch (e) {\n cb(e as Error);\n }\n },\n\n // Ensure final file is closed\n /**\n * Flush is called when the readable has ended; we close any open writer.\n *\n * @param cb - Callback to signal completion or error\n */\n async flush(cb) {\n try {\n if (writer) {\n await writer.end();\n writer = null;\n }\n emit(); // Final progress tick\n cb();\n } catch (e) {\n cb(e as Error);\n }\n },\n });\n\n const rs = createReadStream(filePath);\n await pipeline(rs, parser, t);\n\n // Final progress tick\n onProgress(totalLines);\n logger.info(\n colors.green(\n `Chunked ${filePath} into ${currentChunk} file(s); processed ${totalLines.toLocaleString()} rows.`,\n ),\n );\n}\n","import { extractErrorMessage } from '../../../lib/helpers';\nimport { chunkOneCsvFile } from '../../../lib/helpers/chunkOneCsvFile';\nimport type { ToWorker } from '../../../lib/pooling';\nimport { logger } from '../../../logger';\n\n/**\n * A unit of work: instructs a worker to chunk a single CSV file.\n */\nexport type ChunkTask = {\n /** Absolute path of the CSV file to chunk. */\n filePath: string;\n /** Options controlling output and chunk size. */\n options: {\n /** Optional directory where chunked output files should be written. */\n outputDir?: string;\n /** Whether to clear any pre-existing output chunks before writing new ones. */\n clearOutputDir: boolean;\n /** Approximate target chunk size in MB (well under Node’s string size limits). */\n chunkSizeMB: number;\n };\n};\n\n/**\n * Per-worker progress snapshot for the chunk-csv command.\n */\nexport type ChunkProgress = {\n /** File being processed by the worker. */\n filePath: string;\n /** Number of rows processed so far. */\n processed: number;\n /** Optional total rows in the file (not always known). */\n total?: number;\n};\n\n/**\n * Worker result message once a file has finished processing.\n */\nexport type ChunkResult = {\n /** Whether the file completed successfully. */\n ok: boolean;\n /** File path for which this result applies. */\n filePath: string;\n /** Optional error message if the file failed to chunk. */\n error?: string;\n};\n\n/**\n * Worker entrypoint.\n *\n * Lifecycle:\n * 1) Announce readiness to the parent via `{ type: 'ready' }`.\n * 2) Wait for `{ type: 'task' }` messages; for each, call `chunkOneCsvFile(...)`.\n * - While chunking, forward progress to the parent via `{ type: 'progress' }`.\n * - On completion, send `{ type: 'result', ok: true }`.\n * - On error, send `{ type: 'result', ok: false, error }` and exit(1).\n * 3) On `{ type: 'shutdown' }`, exit(0) gracefully.\n *\n * Notes:\n * - This process is typically spawned by a pool manager that assigns file paths to workers.\n * - The long-lived promise at the end keeps the worker alive between tasks until the parent\n * sends an explicit shutdown.\n */\nexport async function runChild(): Promise<void> {\n const workerId = Number(process.env.WORKER_ID || '0');\n logger.info(`[w${workerId}] ready pid=${process.pid}`);\n\n // Notify the parent that the worker is ready to receive tasks.\n process.send?.({ type: 'ready' });\n\n // Main message loop: receive tasks and shutdown requests from the parent.\n process.on('message', async (msg: ToWorker<ChunkTask>) => {\n if (!msg || typeof msg !== 'object') return;\n\n // Graceful shutdown: let the parent control lifecycle.\n if (msg.type === 'shutdown') {\n process.exit(0);\n }\n\n // Only handle task messages here.\n if (msg.type !== 'task') return;\n\n const { filePath, options } = msg.payload;\n const { outputDir, clearOutputDir, chunkSizeMB } = options;\n\n try {\n // Stream the input CSV and write chunk files asynchronously.\n await chunkOneCsvFile({\n filePath,\n outputDir,\n clearOutputDir,\n chunkSizeMB,\n // Propagate incremental progress to the parent.\n onProgress: (processed, total) =>\n process.send?.({\n type: 'progress',\n payload: { filePath, processed, total },\n }),\n });\n\n // Report success to the parent.\n process.send?.({\n type: 'result',\n payload: { ok: true, filePath },\n });\n } catch (err) {\n // Log locally and report failure upstream; exit the worker with error code.\n const message = extractErrorMessage(err);\n logger.error(`[w${workerId}] ERROR ${filePath}: ${message}`);\n process.send?.({\n type: 'result',\n payload: { ok: false, filePath, error: message },\n });\n }\n });\n\n // keep alive\n await new Promise<never>(() => {\n // This promise never resolves, keeping the worker alive indefinitely\n // until the parent process instructs shutdown.\n });\n}\n","import {\n makeHeader,\n makeWorkerRows,\n type ChunkSlotProgress,\n type CommonCtx,\n type DashboardPlugin,\n} from '../../../../lib/pooling';\n\n/**\n * Header for chunk-csv (no extra totals block).\n *\n * @param ctx - Dashboard context.\n * @returns Header lines.\n */\nfunction renderHeader<TTotals>(\n ctx: CommonCtx<TTotals, ChunkSlotProgress>,\n): string[] {\n // no extra lines — reuse the shared header as-is\n return makeHeader(ctx);\n}\n\n/**\n * Worker rows for chunk-csv — share the generic row renderer.\n *\n * @param ctx - Dashboard context.\n * @returns Array of strings, each representing one worker row.\n */\nfunction renderWorkers<TTotals>(\n ctx: CommonCtx<TTotals, ChunkSlotProgress>,\n): string[] {\n return makeWorkerRows(ctx);\n}\n\nexport const chunkCsvPlugin: DashboardPlugin<unknown, ChunkSlotProgress> = {\n renderHeader,\n renderWorkers,\n // no extras\n};\n","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"],"mappings":"wjBAcA,SAAgB,EACd,EACA,EACU,CACL,IACH,EAAA,EAAO,MAAM,EAAA,QAAO,IAAI,kCAAkC,CAAC,CAC3D,EAAa,QAAQ,KAAK,EAAE,EAG9B,IAAI,EAAkB,EAA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C,GAAM,CACJ,YACA,YACA,iBACA,cACA,cACA,cACE,EAGE,EAAQ,EAAsB,EAAW,KAAK,CAG9C,CAAE,WAAU,YAAaC,EAAAA,EAAgB,EAAa,EAAM,OAAO,CAEzE,EAAA,EAAO,KACL,EAAA,QAAO,MACL,YAAY,EAAM,OAAO,8BAA8B,EAAS,QAAQ,EAAS,GAClF,CACF,CAGD,IAAM,EAAQ,EAAM,IAAgB,IAAc,CAChD,WACA,QAAS,CAAE,YAAW,iBAAgB,cAAa,CACpD,EAAE,CAiBH,MAAMC,EAAAA,EAAQ,CACZ,MAAO,eAAe,IACtB,QAAS,GAAa,GAAa,QAAQ,KAAK,CAChD,UAAWC,EAAAA,EACX,gBAAiB,GAAsB,CACvC,WACA,WACA,WAAY,EAAM,OAClB,MAtBsE,CACtE,aAAgB,EAAM,OAAO,CAC7B,UAAY,GAAM,EAAE,SACpB,gBAAmB,EAAE,EACrB,qBAAwB,IAAA,GACxB,WAAa,GAAW,EACxB,UAAW,EAAQ,KAAS,CAAE,SAAQ,GAAI,CAAC,CAAC,EAAI,GAAI,EAEpD,YAAa,SAAY,GAG1B,CAYC,aACA,OAAS,GAAUC,EAAAA,EAAgB,EAAO,EAAgB,EAAW,CACrE,iBAAkB,CAAE,aAAY,UAAS,eACvCC,EAAAA,EAAsB,CACpB,aACA,UACA,YACD,CAAC,CACL,CAAC,CAMA,QAAQ,KAAK,SAASF,EAAAA,EAAW,EACnC,GAAU,CAAC,MAAO,GAAQ,CACxB,EAAA,EAAO,MAAM,EAAI,CACjB,QAAQ,KAAK,EAAE,EACf"}
@@ -1,2 +1,2 @@
1
- require(`./enums-CBXlBJii.cjs`),require(`./constants-B-TmLA0w.cjs`);const e=require(`./syncConfigurationToTranscend-Bpge5AcC.cjs`);require(`./logger-BaHHbWVd.cjs`),require(`./buildAIIntegrationType-n_Qlv8wG.cjs`);const t=require(`./done-input-validation-Cgk5kNBs.cjs`);async function n({auth:n,dataSiloId:r,actions:i,transcendUrl:a}){t.t(this.process.exit),await e.L({requestActions:i,transcendUrl:a,auth:n,dataSiloId:r})}exports.retryRequestDataSilos=n;
2
- //# sourceMappingURL=impl-DOmKR8yz.cjs.map
1
+ require(`./enums-CBXlBJii.cjs`),require(`./constants-C2Ve1XaG.cjs`);const e=require(`./syncConfigurationToTranscend-CpoC4raI.cjs`);require(`./logger-BaHHbWVd.cjs`),require(`./buildAIIntegrationType-n_Qlv8wG.cjs`);const t=require(`./done-input-validation-Cgk5kNBs.cjs`);async function n({auth:n,dataSiloId:r,actions:i,transcendUrl:a}){t.t(this.process.exit),await e.L({requestActions:i,transcendUrl:a,auth:n,dataSiloId:r})}exports.retryRequestDataSilos=n;
2
+ //# sourceMappingURL=impl-Dbvahnag.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DOmKR8yz.cjs","names":["retryRequestDataSilosHelper"],"sources":["../src/commands/request/system/retry-request-data-silos/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context';\nimport type { RequestAction } from '@transcend-io/privacy-types';\nimport { retryRequestDataSilos as retryRequestDataSilosHelper } from '../../../../lib/requests';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nexport interface RetryRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n actions: RequestAction[];\n transcendUrl: string;\n}\n\nexport async function retryRequestDataSilos(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n actions,\n transcendUrl,\n }: RetryRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await retryRequestDataSilosHelper({\n requestActions: actions,\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"],"mappings":"6QAYA,eAAsB,EAEpB,CACE,OACA,aACA,UACA,gBAEa,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAAAA,EAA4B,CAChC,eAAgB,EAChB,eACA,OACA,aACD,CAAC"}
1
+ {"version":3,"file":"impl-Dbvahnag.cjs","names":["retryRequestDataSilosHelper"],"sources":["../src/commands/request/system/retry-request-data-silos/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context';\nimport type { RequestAction } from '@transcend-io/privacy-types';\nimport { retryRequestDataSilos as retryRequestDataSilosHelper } from '../../../../lib/requests';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nexport interface RetryRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n actions: RequestAction[];\n transcendUrl: string;\n}\n\nexport async function retryRequestDataSilos(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n actions,\n transcendUrl,\n }: RetryRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await retryRequestDataSilosHelper({\n requestActions: actions,\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"],"mappings":"6QAYA,eAAsB,EAEpB,CACE,OACA,aACA,UACA,gBAEa,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAAAA,EAA4B,CAChC,eAAgB,EAChB,eACA,OACA,aACD,CAAC"}
@@ -1,2 +1,2 @@
1
- const e=require(`./enums-CBXlBJii.cjs`);require(`./constants-B-TmLA0w.cjs`);const t=require(`./syncConfigurationToTranscend-Bpge5AcC.cjs`),n=require(`./logger-BaHHbWVd.cjs`);require(`./buildAIIntegrationType-n_Qlv8wG.cjs`);const r=require(`./done-input-validation-Cgk5kNBs.cjs`),i=require(`./preference-management-5uJDKuMK.cjs`);let a=require(`colors`);a=e.s(a);const o=[`userId`,`timestamp`,`partition`,`decryptionStatus`,`updatedAt`,`usp`,`gpp`,`tcf`,`airgapVersion`,`metadata`,`metadataTimestamp`];async function s({auth:e,partition:s,sombraAuth:c,file:l,transcendUrl:u,timestampBefore:d,timestampAfter:f,updatedBefore:p,updatedAfter:m,identifiers:h=[],concurrency:g,shouldChunk:_,windowConcurrency:v,maxChunks:y,exportIdentifiersWithDelimiter:b,maxLookbackDays:x}){r.t(this.process.exit);let S=await t.ei(u,e,c),C=t.ti(u,e),w=h.map(e=>{if(!e.includes(`:`))return{name:`email`,value:e};let[t,n]=e.split(`:`);return{name:t,value:n}}),T={...d?{timestampBefore:d.toISOString()}:{},...f?{timestampAfter:f.toISOString()}:{},...m||p?{system:{...p?{updatedBefore:p.toISOString()}:{},...m?{updatedAfter:m.toISOString()}:{}}}:{},...w.length>0?{identifiers:w}:{}};n.t.info(`Fetching consent preferences from partition ${s}, using mode=${_?`chunked-stream`:`paged-stream`}...`),n.t.info(a.default.magenta(`Preparing CSV at: ${l}`));let[E,D]=await Promise.all([t._r(C),t.n(C)]),O=D.map(e=>e.name),k=Array.from(new Set(E.flatMap(e=>e.topics?.map(t=>`${e.trackingType}_${t.slug}`)??[]))).sort((e,t)=>e.localeCompare(t)),A=Array.from(new Set(E.map(e=>e.trackingType))).sort((e,t)=>e.localeCompare(t)),j=[...o,...O,...A,...k],M=null,N=!1,P=e=>{if(!e||e.length===0)return;let n=e.map(e=>i.i(e,b));if(!N){let e=Object.keys(n[0]??{}),r=new Set;M=[...j,...e].filter(e=>e===void 0||r.has(e)?!1:(r.add(e),!0)),t.s(l,M),N=!0}t.a(l,n,M)};if(_){await i.r(S,{partition:s,filterBy:T,limit:g,windowConcurrency:v,maxChunks:y,maxLookbackDays:x,onItems:e=>P(e)}),n.t.info(a.default.green(`Finished writing CSV to ${l}`));return}await i.n(S,{partition:s,filterBy:T,limit:g,onItems:e=>P(e)}),n.t.info(a.default.green(`Finished writing CSV to ${l}`))}exports.pullConsentPreferences=s;
2
- //# sourceMappingURL=impl-CUkxcZrf.cjs.map
1
+ const e=require(`./enums-CBXlBJii.cjs`);require(`./constants-C2Ve1XaG.cjs`);const t=require(`./syncConfigurationToTranscend-CpoC4raI.cjs`),n=require(`./logger-BaHHbWVd.cjs`);require(`./buildAIIntegrationType-n_Qlv8wG.cjs`);const r=require(`./done-input-validation-Cgk5kNBs.cjs`),i=require(`./preference-management-BvvoySGZ.cjs`);let a=require(`colors`);a=e.s(a);const o=[`userId`,`timestamp`,`partition`,`decryptionStatus`,`updatedAt`,`usp`,`gpp`,`tcf`,`airgapVersion`,`metadata`,`metadataTimestamp`];async function s({auth:e,partition:s,sombraAuth:c,file:l,transcendUrl:u,timestampBefore:d,timestampAfter:f,updatedBefore:p,updatedAfter:m,identifiers:h=[],concurrency:g,shouldChunk:_,windowConcurrency:v,maxChunks:y,exportIdentifiersWithDelimiter:b,maxLookbackDays:x}){r.t(this.process.exit);let S=await t.ei(u,e,c),C=t.ti(u,e),w=h.map(e=>{if(!e.includes(`:`))return{name:`email`,value:e};let[t,n]=e.split(`:`);return{name:t,value:n}}),T={...d?{timestampBefore:d.toISOString()}:{},...f?{timestampAfter:f.toISOString()}:{},...m||p?{system:{...p?{updatedBefore:p.toISOString()}:{},...m?{updatedAfter:m.toISOString()}:{}}}:{},...w.length>0?{identifiers:w}:{}};n.t.info(`Fetching consent preferences from partition ${s}, using mode=${_?`chunked-stream`:`paged-stream`}...`),n.t.info(a.default.magenta(`Preparing CSV at: ${l}`));let[E,D]=await Promise.all([t._r(C),t.n(C)]),O=D.map(e=>e.name),k=Array.from(new Set(E.flatMap(e=>e.topics?.map(t=>`${e.trackingType}_${t.slug}`)??[]))).sort((e,t)=>e.localeCompare(t)),A=Array.from(new Set(E.map(e=>e.trackingType))).sort((e,t)=>e.localeCompare(t)),j=[...o,...O,...A,...k],M=null,N=!1,P=e=>{if(!e||e.length===0)return;let n=e.map(e=>i.i(e,b));if(!N){let e=Object.keys(n[0]??{}),r=new Set;M=[...j,...e].filter(e=>e===void 0||r.has(e)?!1:(r.add(e),!0)),t.s(l,M),N=!0}t.a(l,n,M)};if(_){await i.r(S,{partition:s,filterBy:T,limit:g,windowConcurrency:v,maxChunks:y,maxLookbackDays:x,onItems:e=>P(e)}),n.t.info(a.default.green(`Finished writing CSV to ${l}`));return}await i.n(S,{partition:s,filterBy:T,limit:g,onItems:e=>P(e)}),n.t.info(a.default.green(`Finished writing CSV to ${l}`))}exports.pullConsentPreferences=s;
2
+ //# sourceMappingURL=impl-DyUn0CY0.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-CUkxcZrf.cjs","names":["createSombraGotInstance","buildTranscendGraphQLClient","fetchAllPurposesAndPreferences","fetchAllIdentifiers","transformPreferenceRecordToCsv","fetchConsentPreferencesChunked","fetchConsentPreferences"],"sources":["../src/commands/consent/pull-consent-preferences/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport colors from 'colors';\n\nimport {\n fetchConsentPreferences,\n fetchConsentPreferencesChunked,\n transformPreferenceRecordToCsv,\n type PreferenceIdentifier,\n} from '../../../lib/preference-management';\nimport {\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n fetchAllIdentifiers,\n fetchAllPurposesAndPreferences,\n} from '../../../lib/graphql';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\nimport { logger } from '../../../logger';\nimport { initCsvFile, appendCsvRowsOrdered } from '../../../lib/helpers';\nimport type { PreferenceQueryResponseItem } from '@transcend-io/privacy-types';\n\n// Known “core” columns your transformer usually produces up front.\n// Leave this list conservative; we’ll still union with transformer keys.\nconst CORE_COLS = [\n 'userId',\n 'timestamp',\n 'partition',\n 'decryptionStatus',\n 'updatedAt',\n 'usp',\n 'gpp',\n 'tcf',\n 'airgapVersion',\n 'metadata',\n 'metadataTimestamp',\n];\n\nexport interface PullConsentPreferencesCommandFlags {\n auth: string;\n partition: string;\n sombraAuth?: string;\n file: string;\n transcendUrl: string;\n timestampBefore?: Date;\n exportIdentifiersWithDelimiter: string;\n timestampAfter?: Date;\n updatedBefore?: Date;\n updatedAfter?: Date;\n identifiers?: string[];\n concurrency: number;\n shouldChunk: boolean;\n windowConcurrency: number;\n maxChunks: number;\n maxLookbackDays: number;\n}\n\nexport async function pullConsentPreferences(\n this: LocalContext,\n {\n auth,\n partition,\n sombraAuth,\n file,\n transcendUrl,\n timestampBefore,\n timestampAfter,\n updatedBefore,\n updatedAfter,\n identifiers = [],\n concurrency,\n shouldChunk,\n windowConcurrency,\n maxChunks,\n exportIdentifiersWithDelimiter,\n maxLookbackDays,\n }: PullConsentPreferencesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, sombraAuth);\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Identifiers are key:value, parse to PreferenceIdentifier[]\n const parsedIdentifiers = identifiers.map(\n (identifier): PreferenceIdentifier => {\n if (!identifier.includes(':')) {\n return {\n name: 'email',\n value: identifier,\n };\n }\n const [name, value] = identifier.split(':');\n return { name, value };\n },\n );\n\n // Build filter\n const filterBy = {\n ...(timestampBefore\n ? { timestampBefore: timestampBefore.toISOString() }\n : {}),\n ...(timestampAfter ? { timestampAfter: timestampAfter.toISOString() } : {}),\n ...(updatedAfter || updatedBefore\n ? {\n system: {\n ...(updatedBefore\n ? { updatedBefore: updatedBefore.toISOString() }\n : {}),\n ...(updatedAfter\n ? { updatedAfter: updatedAfter.toISOString() }\n : {}),\n },\n }\n : {}),\n ...(parsedIdentifiers.length > 0 ? { identifiers: parsedIdentifiers } : {}),\n };\n\n logger.info(\n `Fetching consent preferences from partition ${partition}, using mode=${\n shouldChunk ? 'chunked-stream' : 'paged-stream'\n }...`,\n );\n\n logger.info(colors.magenta(`Preparing CSV at: ${file}`));\n\n // Fetch full sets (purposes+topics, identifiers) to ensure header completeness\n const [purposesWithTopics, allIdentifiers] = await Promise.all([\n fetchAllPurposesAndPreferences(client),\n fetchAllIdentifiers(client),\n ]);\n\n // Identifier columns: exactly the identifier names\n const identifierCols = allIdentifiers.map((i) => i.name);\n\n // Preference topic columns: topic names (de-duped)\n const topicCols = Array.from(\n new Set(\n purposesWithTopics.flatMap(\n (p) => p.topics?.map((t) => `${p.trackingType}_${t.slug}`) ?? [],\n ),\n ),\n ).sort((a, b) => a.localeCompare(b));\n\n // Some setups also want a per-purpose boolean column (e.g., “Email”, “Sms”).\n // If your transformer includes those, list them here, derived from purposes:\n const purposeCols = Array.from(\n new Set(purposesWithTopics.map((p) => p.trackingType)),\n ).sort((a, b) => a.localeCompare(b));\n\n // Build the complete header skeleton.\n // We’ll still union with the first transformed row’s keys to be safe.\n const completeHeadersList = [\n ...CORE_COLS,\n ...identifierCols,\n ...purposeCols,\n ...topicCols,\n ];\n\n // Lazily initialize CSV header order from the first transformed row.\n let headerOrder: string[] | null = null;\n let wroteHeader = false;\n const writeRows = (items: PreferenceQueryResponseItem[]): void => {\n if (!items || items.length === 0) return;\n const rows = items.map((row) =>\n transformPreferenceRecordToCsv(row, exportIdentifiersWithDelimiter),\n );\n if (!wroteHeader) {\n const firstKeys = Object.keys(rows[0] ?? {});\n const seen = new Set<string>();\n headerOrder = [...completeHeadersList, ...firstKeys].filter((k) => {\n if (k === undefined) return false;\n if (seen.has(k)) return false;\n seen.add(k);\n return true;\n });\n initCsvFile(file, headerOrder);\n wroteHeader = true;\n }\n appendCsvRowsOrdered(file, rows, headerOrder!);\n };\n\n if (shouldChunk) {\n // Stream via chunked fetcher with page callback\n await fetchConsentPreferencesChunked(sombra, {\n partition,\n filterBy,\n limit: concurrency,\n windowConcurrency,\n maxChunks,\n maxLookbackDays,\n onItems: (items) => writeRows(items),\n });\n\n logger.info(colors.green(`Finished writing CSV to ${file}`));\n return;\n }\n\n // Non-chunked path: still stream page-by-page via onItems (no in-memory accumulation)\n await fetchConsentPreferences(sombra, {\n partition,\n filterBy,\n limit: concurrency, // page size (API max 50 enforced internally)\n onItems: (items) => writeRows(items),\n });\n\n logger.info(colors.green(`Finished writing CSV to ${file}`));\n}\n"],"mappings":"0WAsBA,MAAM,EAAY,CAChB,SACA,YACA,YACA,mBACA,YACA,MACA,MACA,MACA,gBACA,WACA,oBACD,CAqBD,eAAsB,EAEpB,CACE,OACA,YACA,aACA,OACA,eACA,kBACA,iBACA,gBACA,eACA,cAAc,EAAE,CAChB,cACA,cACA,oBACA,YACA,iCACA,mBAEa,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAS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AAM,EAAG,IAAM,EAAE,cAAc,EAAE,CAAC,CAI9B,EAAsB,CAC1B,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACJ,CAGG,EAA+B,KAC/B,EAAc,GACZ,EAAa,GAA+C,CAChE,GAAI,CAAC,GAAS,EAAM,SAAW,EAAG,OAClC,IAAM,EAAO,EAAM,IAAK,GACtBC,EAAAA,EAA+B,EAAK,EAA+B,CACpE,CACD,GAAI,CAAC,EAAa,CAChB,IAAM,EAAY,OAAO,KAAK,EAAK,IAAM,EAAE,CAAC,CACtC,EAAO,IAAI,IACjB,EAAc,CAAC,GAAG,EAAqB,GAAG,EAAU,CAAC,OAAQ,GACvD,IAAM,IAAA,IACN,EAAK,IAAI,EAAE,CAAS,IACxB,EAAK,IAAI,EAAE,CACJ,IACP,CACF,EAAA,EAAY,EAAM,EAAY,CAC9B,EAAc,GAEhB,EAAA,EAAqB,EAAM,EAAM,EAAa,EAGhD,GAAI,EAAa,CAEf,MAAMC,EAAAA,EAA+B,EAAQ,CAC3C,YACA,WACA,MAAO,EACP,oBACA,YACA,kBACA,QAAU,GAAU,EAAU,EAAM,CACrC,CAAC,CAEF,EAAA,EAAO,KAAK,EAAA,QAAO,MAAM,2BAA2B,IAAO,CAAC,CAC5D,OAIF,MAAMC,EAAAA,EAAwB,EAAQ,CACpC,YACA,WACA,MAAO,EACP,QAAU,GAAU,EAAU,EAAM,CACrC,CAAC,CAEF,EAAA,EAAO,KAAK,EAAA,QAAO,MAAM,2BAA2B,IAAO,CAAC"}
1
+ {"version":3,"file":"impl-DyUn0CY0.cjs","names":["createSombraGotInstance","buildTranscendGraphQLClient","fetchAllPurposesAndPreferences","fetchAllIdentifiers","transformPreferenceRecordToCsv","fetchConsentPreferencesChunked","fetchConsentPreferences"],"sources":["../src/commands/consent/pull-consent-preferences/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport colors from 'colors';\n\nimport {\n fetchConsentPreferences,\n fetchConsentPreferencesChunked,\n transformPreferenceRecordToCsv,\n type PreferenceIdentifier,\n} from '../../../lib/preference-management';\nimport {\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n fetchAllIdentifiers,\n fetchAllPurposesAndPreferences,\n} from '../../../lib/graphql';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\nimport { logger } from '../../../logger';\nimport { initCsvFile, appendCsvRowsOrdered } from '../../../lib/helpers';\nimport type { PreferenceQueryResponseItem } from '@transcend-io/privacy-types';\n\n// Known “core” columns your transformer usually produces up front.\n// Leave this list conservative; we’ll still union with transformer keys.\nconst CORE_COLS = [\n 'userId',\n 'timestamp',\n 'partition',\n 'decryptionStatus',\n 'updatedAt',\n 'usp',\n 'gpp',\n 'tcf',\n 'airgapVersion',\n 'metadata',\n 'metadataTimestamp',\n];\n\nexport interface PullConsentPreferencesCommandFlags {\n auth: string;\n partition: string;\n sombraAuth?: string;\n file: string;\n transcendUrl: string;\n timestampBefore?: Date;\n exportIdentifiersWithDelimiter: string;\n timestampAfter?: Date;\n updatedBefore?: Date;\n updatedAfter?: Date;\n identifiers?: string[];\n concurrency: number;\n shouldChunk: boolean;\n windowConcurrency: number;\n maxChunks: number;\n maxLookbackDays: number;\n}\n\nexport async function pullConsentPreferences(\n this: LocalContext,\n {\n auth,\n partition,\n sombraAuth,\n file,\n transcendUrl,\n timestampBefore,\n timestampAfter,\n updatedBefore,\n updatedAfter,\n identifiers = [],\n concurrency,\n shouldChunk,\n windowConcurrency,\n maxChunks,\n exportIdentifiersWithDelimiter,\n maxLookbackDays,\n }: PullConsentPreferencesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, sombraAuth);\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Identifiers are key:value, parse to PreferenceIdentifier[]\n const parsedIdentifiers = identifiers.map(\n (identifier): PreferenceIdentifier => {\n if (!identifier.includes(':')) {\n return {\n name: 'email',\n value: identifier,\n };\n }\n const [name, value] = identifier.split(':');\n return { name, value };\n },\n );\n\n // Build filter\n const filterBy = {\n ...(timestampBefore\n ? { timestampBefore: timestampBefore.toISOString() }\n : {}),\n ...(timestampAfter ? { timestampAfter: timestampAfter.toISOString() } : {}),\n ...(updatedAfter || updatedBefore\n ? {\n system: {\n ...(updatedBefore\n ? { updatedBefore: updatedBefore.toISOString() }\n : {}),\n ...(updatedAfter\n ? { updatedAfter: updatedAfter.toISOString() }\n : {}),\n },\n }\n : {}),\n ...(parsedIdentifiers.length > 0 ? { identifiers: parsedIdentifiers } : {}),\n };\n\n logger.info(\n `Fetching consent preferences from partition ${partition}, using mode=${\n shouldChunk ? 'chunked-stream' : 'paged-stream'\n }...`,\n );\n\n logger.info(colors.magenta(`Preparing CSV at: ${file}`));\n\n // Fetch full sets (purposes+topics, identifiers) to ensure header completeness\n const [purposesWithTopics, allIdentifiers] = await Promise.all([\n fetchAllPurposesAndPreferences(client),\n fetchAllIdentifiers(client),\n ]);\n\n // Identifier columns: exactly the identifier names\n const identifierCols = allIdentifiers.map((i) => i.name);\n\n // Preference topic columns: topic names (de-duped)\n const topicCols = Array.from(\n new Set(\n purposesWithTopics.flatMap(\n (p) => p.topics?.map((t) => `${p.trackingType}_${t.slug}`) ?? [],\n ),\n ),\n ).sort((a, b) => a.localeCompare(b));\n\n // Some setups also want a per-purpose boolean column (e.g., “Email”, “Sms”).\n // If your transformer includes those, list them here, derived from purposes:\n const purposeCols = Array.from(\n new Set(purposesWithTopics.map((p) => p.trackingType)),\n ).sort((a, b) => a.localeCompare(b));\n\n // Build the complete header skeleton.\n // We’ll still union with the first transformed row’s keys to be safe.\n const completeHeadersList = [\n ...CORE_COLS,\n ...identifierCols,\n ...purposeCols,\n ...topicCols,\n ];\n\n // Lazily initialize CSV header order from the first transformed row.\n let headerOrder: string[] | null = null;\n let wroteHeader = false;\n const writeRows = (items: PreferenceQueryResponseItem[]): void => {\n if (!items || items.length === 0) return;\n const rows = items.map((row) =>\n transformPreferenceRecordToCsv(row, exportIdentifiersWithDelimiter),\n );\n if (!wroteHeader) {\n const firstKeys = Object.keys(rows[0] ?? {});\n const seen = new Set<string>();\n headerOrder = [...completeHeadersList, ...firstKeys].filter((k) => {\n if (k === undefined) return false;\n if (seen.has(k)) return false;\n seen.add(k);\n return true;\n });\n initCsvFile(file, headerOrder);\n wroteHeader = true;\n }\n appendCsvRowsOrdered(file, rows, headerOrder!);\n };\n\n if (shouldChunk) {\n // Stream via chunked fetcher with page callback\n await fetchConsentPreferencesChunked(sombra, {\n partition,\n filterBy,\n limit: concurrency,\n windowConcurrency,\n maxChunks,\n maxLookbackDays,\n onItems: (items) => writeRows(items),\n });\n\n logger.info(colors.green(`Finished writing CSV to ${file}`));\n return;\n }\n\n // Non-chunked path: still stream page-by-page via onItems (no in-memory accumulation)\n await fetchConsentPreferences(sombra, {\n partition,\n filterBy,\n limit: concurrency, // page size (API max 50 enforced internally)\n onItems: (items) => writeRows(items),\n });\n\n logger.info(colors.green(`Finished writing CSV to ${file}`));\n}\n"],"mappings":"0WAsBA,MAAM,EAAY,CAChB,SACA,YACA,YACA,mBACA,YACA,MACA,MACA,MACA,gBACA,WACA,oBACD,CAqBD,eAAsB,EAEpB,CACE,OACA,YACA,aACA,OACA,eACA,kBACA,iBACA,gBACA,eACA,cAAc,EAAE,CAChB,cACA,cACA,oBACA,YACA,iCACA,mBAEa,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAS,MAAMA,EAAAA,GAAwB,EAAc,EAAM,EAAW,CACtE,EAASC,EAAAA,GAA4B,EAAc,EAAK,CAGxD,EAAoB,EAAY,IACnC,GAAqC,CACpC,GAAI,CAAC,EAAW,SAAS,IAAI,CAC3B,MAAO,CACL,KAAM,QACN,MAAO,EACR,CAEH,GAAM,CAAC,EAAM,GAAS,EAAW,MAAM,IAAI,CAC3C,MAAO,CAAE,OAAM,QAAO,EAEzB,CAGK,EAAW,CACf,GAAI,EACA,CAAE,gBAAiB,EA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AAK,IAAM,EAAE,CAAC,CACtC,EAAO,IAAI,IACjB,EAAc,CAAC,GAAG,EAAqB,GAAG,EAAU,CAAC,OAAQ,GACvD,IAAM,IAAA,IACN,EAAK,IAAI,EAAE,CAAS,IACxB,EAAK,IAAI,EAAE,CACJ,IACP,CACF,EAAA,EAAY,EAAM,EAAY,CAC9B,EAAc,GAEhB,EAAA,EAAqB,EAAM,EAAM,EAAa,EAGhD,GAAI,EAAa,CAEf,MAAMC,EAAAA,EAA+B,EAAQ,CAC3C,YACA,WACA,MAAO,EACP,oBACA,YACA,kBACA,QAAU,GAAU,EAAU,EAAM,CACrC,CAAC,CAEF,EAAA,EAAO,KAAK,EAAA,QAAO,MAAM,2BAA2B,IAAO,CAAC,CAC5D,OAIF,MAAMC,EAAAA,EAAwB,EAAQ,CACpC,YACA,WACA,MAAO,EACP,QAAU,GAAU,EAAU,EAAM,CACrC,CAAC,CAEF,EAAA,EAAO,KAAK,EAAA,QAAO,MAAM,2BAA2B,IAAO,CAAC"}
@@ -1,2 +1,2 @@
1
- const e=require(`./enums-CBXlBJii.cjs`),t=require(`./constants-B-TmLA0w.cjs`),n=require(`./syncConfigurationToTranscend-Bpge5AcC.cjs`),r=require(`./logger-BaHHbWVd.cjs`);require(`./buildAIIntegrationType-n_Qlv8wG.cjs`);const i=require(`./data-inventory-flXV6qPl.cjs`),a=require(`./done-input-validation-Cgk5kNBs.cjs`);let o=require(`colors`);o=e.s(o);async function s({auth:e,file:s,transcendUrl:c,dataSiloIds:l,includeAttributes:u,includeGuessedCategories:d,parentCategories:f,subCategories:p=[]}){a.t(this.process.exit);try{let t=await i.n(n.ti(c,e),{dataSiloIds:l,includeGuessedCategories:d,parentCategories:f,includeAttributes:u,subCategories:p});r.t.info(o.default.magenta(`Writing datapoints to file "${s}"...`));let a=[];await n.d(s,t.map(e=>{let t={"Property ID":e.id,"Data Silo":e.dataSilo.title,Object:e.dataPoint.name,"Object Path":e.dataPoint.path.join(`.`),Property:e.name,"Property Description":e.description,"Data Categories":e.categories.map(e=>`${e.category}:${e.name}`).join(`, `),"Guessed Category":e.pendingCategoryGuesses?.[0]?`${e.pendingCategoryGuesses[0].category.category}:${e.pendingCategoryGuesses[0].category.name}`:``,"Processing Purposes":e.purposes.map(e=>`${e.purpose}:${e.name}`).join(`, `),...Object.entries(n.As(e.attributeValues||[],({attributeKey:e})=>e.name)).reduce((e,[t,n])=>(e[t]=n.map(e=>e.name).join(`,`),e),{})};return a=n.Ds([...a,...Object.keys(t)]),t}),a)}catch(e){r.t.error(o.default.red(`An error occurred syncing the datapoints: ${e.message}`)),this.process.exit(1)}r.t.info(o.default.green(`Successfully synced datapoints to disk at ${s}! View at ${t.n}`))}exports.pullDatapoints=s;
2
- //# sourceMappingURL=impl-DvlAq8xf.cjs.map
1
+ const e=require(`./enums-CBXlBJii.cjs`),t=require(`./constants-C2Ve1XaG.cjs`),n=require(`./syncConfigurationToTranscend-CpoC4raI.cjs`),r=require(`./logger-BaHHbWVd.cjs`);require(`./buildAIIntegrationType-n_Qlv8wG.cjs`);const i=require(`./data-inventory-CoAdyyxS.cjs`),a=require(`./done-input-validation-Cgk5kNBs.cjs`);let o=require(`colors`);o=e.s(o);async function s({auth:e,file:s,transcendUrl:c,dataSiloIds:l,includeAttributes:u,includeGuessedCategories:d,parentCategories:f,subCategories:p=[]}){a.t(this.process.exit);try{let t=await i.n(n.ti(c,e),{dataSiloIds:l,includeGuessedCategories:d,parentCategories:f,includeAttributes:u,subCategories:p});r.t.info(o.default.magenta(`Writing datapoints to file "${s}"...`));let a=[];await n.d(s,t.map(e=>{let t={"Property ID":e.id,"Data Silo":e.dataSilo.title,Object:e.dataPoint.name,"Object Path":e.dataPoint.path.join(`.`),Property:e.name,"Property Description":e.description,"Data Categories":e.categories.map(e=>`${e.category}:${e.name}`).join(`, `),"Guessed Category":e.pendingCategoryGuesses?.[0]?`${e.pendingCategoryGuesses[0].category.category}:${e.pendingCategoryGuesses[0].category.name}`:``,"Processing Purposes":e.purposes.map(e=>`${e.purpose}:${e.name}`).join(`, `),...Object.entries(n.As(e.attributeValues||[],({attributeKey:e})=>e.name)).reduce((e,[t,n])=>(e[t]=n.map(e=>e.name).join(`,`),e),{})};return a=n.Ds([...a,...Object.keys(t)]),t}),a)}catch(e){r.t.error(o.default.red(`An error occurred syncing the datapoints: ${e.message}`)),this.process.exit(1)}r.t.info(o.default.green(`Successfully synced datapoints to disk at ${s}! View at ${t.n}`))}exports.pullDatapoints=s;
2
+ //# sourceMappingURL=impl-HxQkbH-v.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DvlAq8xf.cjs","names":["pullAllDatapoints","buildTranscendGraphQLClient","writeLargeCsv","groupBy","uniq","ADMIN_DASH_DATAPOINTS"],"sources":["../src/commands/inventory/pull-datapoints/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { uniq, groupBy } from 'lodash-es';\n\nimport { logger } from '../../../logger';\nimport colors from 'colors';\nimport { buildTranscendGraphQLClient } from '../../../lib/graphql';\nimport { ADMIN_DASH_DATAPOINTS } from '../../../constants';\nimport { pullAllDatapoints } from '../../../lib/data-inventory';\nimport { DataCategoryType } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\nimport { writeLargeCsv } from '../../../lib/helpers';\n\nexport interface PullDatapointsCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n includeAttributes: boolean;\n includeGuessedCategories: boolean;\n parentCategories?: DataCategoryType[];\n subCategories?: string[];\n}\n\nexport async function pullDatapoints(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n dataSiloIds,\n includeAttributes,\n includeGuessedCategories,\n parentCategories,\n subCategories = [],\n }: PullDatapointsCommandFlags,\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 dataPoints = await pullAllDatapoints(client, {\n dataSiloIds,\n includeGuessedCategories,\n parentCategories,\n includeAttributes,\n subCategories, // TODO: https://transcend.height.app/T-40482 - do by name not ID\n });\n\n logger.info(colors.magenta(`Writing datapoints to file \"${file}\"...`));\n let headers: string[] = [];\n const inputs = dataPoints.map((point) => {\n const result = {\n 'Property ID': point.id,\n 'Data Silo': point.dataSilo.title,\n Object: point.dataPoint.name,\n 'Object Path': point.dataPoint.path.join('.'),\n Property: point.name,\n 'Property Description': point.description,\n 'Data Categories': point.categories\n .map((category) => `${category.category}:${category.name}`)\n .join(', '),\n 'Guessed Category': point.pendingCategoryGuesses?.[0]\n ? `${point.pendingCategoryGuesses![0]!.category.category}:${\n point.pendingCategoryGuesses![0]!.category.name\n }`\n : '',\n 'Processing Purposes': point.purposes\n .map((purpose) => `${purpose.purpose}:${purpose.name}`)\n .join(', '),\n ...Object.entries(\n groupBy(\n point.attributeValues || [],\n ({ attributeKey }) => attributeKey.name,\n ),\n ).reduce((acc, [key, values]) => {\n acc[key] = values.map((value) => value.name).join(',');\n return acc;\n }, {} as Record<string, string>),\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(`An error occurred syncing the datapoints: ${err.message}`),\n );\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced datapoints to disk at ${file}! View at ${ADMIN_DASH_DATAPOINTS}`,\n ),\n );\n}\n"],"mappings":"+VAuBA,eAAsB,EAEpB,CACE,OACA,OACA,eACA,cACA,oBACA,2BACA,mBACA,gBAAgB,EAAE,EAEL,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAI,CAIF,IAAM,EAAa,MAAMA,EAAAA,EAFVC,EAAAA,GAA4B,EAAc,EAAK,CAEX,CACjD,cACA,2BACA,mBACA,oBACA,gBACD,CAAC,CAEF,EAAA,EAAO,KAAK,EAAA,QAAO,QAAQ,+BAA+B,EAAK,MAAM,CAAC,CACtE,IAAI,EAAoB,EAAE,CAiC1B,MAAMC,EAAAA,EAAc,EAhCL,EAAW,IAAK,GAAU,CACvC,IAAM,EAAS,CACb,cAAe,EAAM,GACrB,YAAa,EAAM,SAAS,MAC5B,OAAQ,EAAM,UAAU,KACxB,cAAe,EAAM,UAAU,KAAK,KAAK,IAAI,CAC7C,SAAU,EAAM,KAChB,uBAAwB,EAAM,YAC9B,kBAAmB,EAAM,WACtB,IAAK,GAAa,GAAG,EAAS,SAAS,GAAG,EAAS,OAAO,CAC1D,KAAK,KAAK,CACb,mBAAoB,EAAM,yBAAyB,GAC/C,GAAG,EAAM,uBAAwB,GAAI,SAAS,SAAS,GACrD,EAAM,uBAAwB,GAAI,SAAS,OAE7C,GACJ,sBAAuB,EAAM,SAC1B,IAAK,GAAY,GAAG,EAAQ,QAAQ,GAAG,EAAQ,OAAO,CACtD,KAAK,KAAK,CACb,GAAG,OAAO,QACRC,EAAAA,GACE,EAAM,iBAAmB,EAAE,EAC1B,CAAE,kBAAmB,EAAa,KACpC,CACF,CAAC,QAAQ,EAAK,CAAC,EAAK,MACnB,EAAI,GAAO,EAAO,IAAK,GAAU,EAAM,KAAK,CAAC,KAAK,IAAI,CAC/C,GACN,EAAE,CAA2B,CACjC,CAED,MADA,GAAUC,EAAAA,GAAK,CAAC,GAAG,EAAS,GAAG,OAAO,KAAK,EAAO,CAAC,CAAC,CAC7C,GACP,CACgC,EAAQ,OACnC,EAAK,CACZ,EAAA,EAAO,MACL,EAAA,QAAO,IAAI,6CAA6C,EAAI,UAAU,CACvE,CACD,KAAK,QAAQ,KAAK,EAAE,CAItB,EAAA,EAAO,KACL,EAAA,QAAO,MACL,6CAA6C,EAAK,YAAYC,EAAAA,IAC/D,CACF"}
1
+ {"version":3,"file":"impl-HxQkbH-v.cjs","names":["pullAllDatapoints","buildTranscendGraphQLClient","writeLargeCsv","groupBy","uniq","ADMIN_DASH_DATAPOINTS"],"sources":["../src/commands/inventory/pull-datapoints/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { uniq, groupBy } from 'lodash-es';\n\nimport { logger } from '../../../logger';\nimport colors from 'colors';\nimport { buildTranscendGraphQLClient } from '../../../lib/graphql';\nimport { ADMIN_DASH_DATAPOINTS } from '../../../constants';\nimport { pullAllDatapoints } from '../../../lib/data-inventory';\nimport { DataCategoryType } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\nimport { writeLargeCsv } from '../../../lib/helpers';\n\nexport interface PullDatapointsCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n includeAttributes: boolean;\n includeGuessedCategories: boolean;\n parentCategories?: DataCategoryType[];\n subCategories?: string[];\n}\n\nexport async function pullDatapoints(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n dataSiloIds,\n includeAttributes,\n includeGuessedCategories,\n parentCategories,\n subCategories = [],\n }: PullDatapointsCommandFlags,\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 dataPoints = await pullAllDatapoints(client, {\n dataSiloIds,\n includeGuessedCategories,\n parentCategories,\n includeAttributes,\n subCategories, // TODO: https://transcend.height.app/T-40482 - do by name not ID\n });\n\n logger.info(colors.magenta(`Writing datapoints to file \"${file}\"...`));\n let headers: string[] = [];\n const inputs = dataPoints.map((point) => {\n const result = {\n 'Property ID': point.id,\n 'Data Silo': point.dataSilo.title,\n Object: point.dataPoint.name,\n 'Object Path': point.dataPoint.path.join('.'),\n Property: point.name,\n 'Property Description': point.description,\n 'Data Categories': point.categories\n .map((category) => `${category.category}:${category.name}`)\n .join(', '),\n 'Guessed Category': point.pendingCategoryGuesses?.[0]\n ? `${point.pendingCategoryGuesses![0]!.category.category}:${\n point.pendingCategoryGuesses![0]!.category.name\n }`\n : '',\n 'Processing Purposes': point.purposes\n .map((purpose) => `${purpose.purpose}:${purpose.name}`)\n .join(', '),\n ...Object.entries(\n groupBy(\n point.attributeValues || [],\n ({ attributeKey }) => attributeKey.name,\n ),\n ).reduce((acc, [key, values]) => {\n acc[key] = values.map((value) => value.name).join(',');\n return acc;\n }, {} as Record<string, string>),\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(`An error occurred syncing the datapoints: ${err.message}`),\n );\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced datapoints to disk at ${file}! View at ${ADMIN_DASH_DATAPOINTS}`,\n ),\n );\n}\n"],"mappings":"+VAuBA,eAAsB,EAEpB,CACE,OACA,OACA,eACA,cACA,oBACA,2BACA,mBACA,gBAAgB,EAAE,EAEL,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAI,CAIF,IAAM,EAAa,MAAMA,EAAAA,EAFVC,EAAAA,GAA4B,EAAc,EAAK,CAEX,CACjD,cACA,2BACA,mBACA,oBACA,gBACD,CAAC,CAEF,EAAA,EAAO,KAAK,EAAA,QAAO,QAAQ,+BAA+B,EAAK,MAAM,CAAC,CACtE,IAAI,EAAoB,EAAE,CAiC1B,MAAMC,EAAAA,EAAc,EAhCL,EAAW,IAAK,GAAU,CACvC,IAAM,EAAS,CACb,cAAe,EAAM,GACrB,YAAa,EAAM,SAAS,MAC5B,OAAQ,EAAM,UAAU,KACxB,cAAe,EAAM,UAAU,KAAK,KAAK,IAAI,CAC7C,SAAU,EAAM,KAChB,uBAAwB,EAAM,YAC9B,kBAAmB,EAAM,WACtB,IAAK,GAAa,GAAG,EAAS,SAAS,GAAG,EAAS,OAAO,CAC1D,KAAK,KAAK,CACb,mBAAoB,EAAM,yBAAyB,GAC/C,GAAG,EAAM,uBAAwB,GAAI,SAAS,SAAS,GACrD,EAAM,uBAAwB,GAAI,SAAS,OAE7C,GACJ,sBAAuB,EAAM,SAC1B,IAAK,GAAY,GAAG,EAAQ,QAAQ,GAAG,EAAQ,OAAO,CACtD,KAAK,KAAK,CACb,GAAG,OAAO,QACRC,EAAAA,GACE,EAAM,iBAAmB,EAAE,EAC1B,CAAE,kBAAmB,EAAa,KACpC,CACF,CAAC,QAAQ,EAAK,CAAC,EAAK,MACnB,EAAI,GAAO,EAAO,IAAK,GAAU,EAAM,KAAK,CAAC,KAAK,IAAI,CAC/C,GACN,EAAE,CAA2B,CACjC,CAED,MADA,GAAUC,EAAAA,GAAK,CAAC,GAAG,EAAS,GAAG,OAAO,KAAK,EAAO,CAAC,CAAC,CAC7C,GACP,CACgC,EAAQ,OACnC,EAAK,CACZ,EAAA,EAAO,MACL,EAAA,QAAO,IAAI,6CAA6C,EAAI,UAAU,CACvE,CACD,KAAK,QAAQ,KAAK,EAAE,CAItB,EAAA,EAAO,KACL,EAAA,QAAO,MACL,6CAA6C,EAAK,YAAYC,EAAAA,IAC/D,CACF"}
@@ -1,2 +1,2 @@
1
- require(`./enums-CBXlBJii.cjs`),require(`./constants-B-TmLA0w.cjs`);const e=require(`./syncConfigurationToTranscend-Bpge5AcC.cjs`);require(`./logger-BaHHbWVd.cjs`),require(`./buildAIIntegrationType-n_Qlv8wG.cjs`);const t=require(`./done-input-validation-Cgk5kNBs.cjs`);async function n({auth:n,requestReceiptFolder:r,sombraAuth:i,actions:a,statuses:o,requestIds:s,createdAt:c,emailIsVerified:l,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:f,skipWaitingPeriod:p,createdAtBefore:m,createdAtAfter:h,concurrency:g,transcendUrl:_}){t.t(this.process.exit),await e.B({requestReceiptFolder:r,auth:n,sombraAuth:i,requestActions:a,requestStatuses:o,requestIds:s,createdAt:c,emailIsVerified:l,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:f,skipWaitingPeriod:p,createdAtBefore:m,createdAtAfter:h,concurrency:g,transcendUrl:_})}exports.restart=n;
2
- //# sourceMappingURL=impl-Bsqlw8_g.cjs.map
1
+ require(`./enums-CBXlBJii.cjs`),require(`./constants-C2Ve1XaG.cjs`);const e=require(`./syncConfigurationToTranscend-CpoC4raI.cjs`);require(`./logger-BaHHbWVd.cjs`),require(`./buildAIIntegrationType-n_Qlv8wG.cjs`);const t=require(`./done-input-validation-Cgk5kNBs.cjs`);async function n({auth:n,requestReceiptFolder:r,sombraAuth:i,actions:a,statuses:o,requestIds:s,createdAt:c,emailIsVerified:l,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:f,skipWaitingPeriod:p,createdAtBefore:m,createdAtAfter:h,concurrency:g,transcendUrl:_}){t.t(this.process.exit),await e.B({requestReceiptFolder:r,auth:n,sombraAuth:i,requestActions:a,requestStatuses:o,requestIds:s,createdAt:c,emailIsVerified:l,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:f,skipWaitingPeriod:p,createdAtBefore:m,createdAtAfter:h,concurrency:g,transcendUrl:_})}exports.restart=n;
2
+ //# sourceMappingURL=impl-XGErHk8S.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-Bsqlw8_g.cjs","names":["bulkRestartRequests"],"sources":["../src/commands/request/restart/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { bulkRestartRequests } from '../../../lib/requests';\nimport type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface RestartCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses: RequestStatus[];\n transcendUrl: string;\n requestReceiptFolder: string;\n sombraAuth?: string;\n concurrency: number;\n requestIds?: string[];\n emailIsVerified: boolean;\n createdAt?: Date;\n silentModeBefore?: Date;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n sendEmailReceipt: boolean;\n copyIdentifiers: boolean;\n skipWaitingPeriod: boolean;\n}\n\nexport async function restart(\n this: LocalContext,\n {\n auth,\n requestReceiptFolder,\n sombraAuth,\n actions,\n statuses,\n requestIds,\n createdAt,\n emailIsVerified,\n silentModeBefore,\n sendEmailReceipt,\n copyIdentifiers,\n skipWaitingPeriod,\n createdAtBefore,\n createdAtAfter,\n concurrency,\n transcendUrl,\n }: RestartCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await bulkRestartRequests({\n requestReceiptFolder,\n auth,\n sombraAuth,\n requestActions: actions,\n requestStatuses: statuses,\n requestIds,\n createdAt,\n emailIsVerified,\n silentModeBefore,\n sendEmailReceipt,\n copyIdentifiers,\n skipWaitingPeriod,\n createdAtBefore,\n createdAtAfter,\n concurrency,\n transcendUrl,\n });\n}\n"],"mappings":"6QAwBA,eAAsB,EAEpB,CACE,OACA,uBACA,aACA,UACA,WACA,aACA,YACA,kBACA,mBACA,mBACA,kBACA,oBACA,kBACA,iBACA,cACA,gBAEa,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAAAA,EAAoB,CACxB,uBACA,OACA,aACA,eAAgB,EAChB,gBAAiB,EACjB,aACA,YACA,kBACA,mBACA,mBACA,kBACA,oBACA,kBACA,iBACA,cACA,eACD,CAAC"}
1
+ {"version":3,"file":"impl-XGErHk8S.cjs","names":["bulkRestartRequests"],"sources":["../src/commands/request/restart/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { bulkRestartRequests } from '../../../lib/requests';\nimport type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface RestartCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses: RequestStatus[];\n transcendUrl: string;\n requestReceiptFolder: string;\n sombraAuth?: string;\n concurrency: number;\n requestIds?: string[];\n emailIsVerified: boolean;\n createdAt?: Date;\n silentModeBefore?: Date;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n sendEmailReceipt: boolean;\n copyIdentifiers: boolean;\n skipWaitingPeriod: boolean;\n}\n\nexport async function restart(\n this: LocalContext,\n {\n auth,\n requestReceiptFolder,\n sombraAuth,\n actions,\n statuses,\n requestIds,\n createdAt,\n emailIsVerified,\n silentModeBefore,\n sendEmailReceipt,\n copyIdentifiers,\n skipWaitingPeriod,\n createdAtBefore,\n createdAtAfter,\n concurrency,\n transcendUrl,\n }: RestartCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await bulkRestartRequests({\n requestReceiptFolder,\n auth,\n sombraAuth,\n requestActions: actions,\n requestStatuses: statuses,\n requestIds,\n createdAt,\n emailIsVerified,\n silentModeBefore,\n sendEmailReceipt,\n copyIdentifiers,\n skipWaitingPeriod,\n createdAtBefore,\n createdAtAfter,\n concurrency,\n transcendUrl,\n });\n}\n"],"mappings":"6QAwBA,eAAsB,EAEpB,CACE,OACA,uBACA,aACA,UACA,WACA,aACA,YACA,kBACA,mBACA,mBACA,kBACA,oBACA,kBACA,iBACA,cACA,gBAEa,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAAAA,EAAoB,CACxB,uBACA,OACA,aACA,eAAgB,EAChB,gBAAiB,EACjB,aACA,YACA,kBACA,mBACA,mBACA,kBACA,oBACA,kBACA,iBACA,cACA,eACD,CAAC"}
@@ -1,2 +1,2 @@
1
- const e=require(`./enums-CBXlBJii.cjs`),t=require(`./constants-B-TmLA0w.cjs`),n=require(`./syncConfigurationToTranscend-Bpge5AcC.cjs`),r=require(`./logger-BaHHbWVd.cjs`);require(`./buildAIIntegrationType-n_Qlv8wG.cjs`),require(`./codecs-JSDJgtyL.cjs`);const i=require(`./readTranscendYaml-CL9nujUr.cjs`),a=require(`./mergeTranscendInputs-PPpGbYgG.cjs`),o=require(`./api-keys-CDp8NUhN.cjs`),s=require(`./done-input-validation-Cgk5kNBs.cjs`);let c=require(`node:fs`),l=require(`node:path`),u=require(`colors`);u=e.s(u);async function d({transcendUrl:e,auth:t,pageSize:i,publishToPrivacyCenter:a,contents:o,deleteExtraAttributeValues:s=!1,classifyService:c=!1}){let l=n.ti(e,t);try{return!await n.t(o,l,{pageSize:i,publishToPrivacyCenter:a,classifyService:c,deleteExtraAttributeValues:s})}catch(e){return r.t.error(u.default.red(`An unexpected error occurred syncing the schema: ${e.message}`)),!1}}async function f({file:e=`./transcend.yml`,transcendUrl:f,auth:p,variables:m,pageSize:h,publishToPrivacyCenter:g,classifyService:_,deleteExtraAttributeValues:v}){s.t(this.process.exit);let y=await o.r(p),b=n.A(m),x;if(x=Array.isArray(y)&&(0,c.lstatSync)(e).isDirectory()?o.n(e).map(t=>(0,l.join)(e,t)):e.split(`,`),x.length<1)throw Error(`No file specified!`);let S=x.map(e=>{(0,c.existsSync)(e)?r.t.info(u.default.magenta(`Reading file "${e}"...`)):(r.t.error(u.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 t=i.r(e,b);return r.t.info(u.default.green(`Successfully read in "${e}"`)),{content:t,name:e.split(`/`).pop().replace(`.yml`,``)}}catch(e){r.t.error(u.default.red(`The shape of your yaml file is invalid with the following errors: ${e.message}`)),this.process.exit(1)}});if(typeof y==`string`){let[e,...n]=S.map(({content:e})=>e);await d({transcendUrl:f,auth:y,contents:a.t(e,...n),publishToPrivacyCenter:g,deleteExtraAttributeValues:v,pageSize:h,classifyService:!!_})||(r.t.info(u.default.red(`Sync encountered errors. View output above for more information, or check out ${t.r}`)),this.process.exit(1))}else{if(S.length!==1&&S.length!==y.length)throw 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 ${y.length} API key${y.length===1?``:`s`}`);let e=[];await n.Es(y,async(t,n)=>{let i=`[${n+1}/${y.length}][${t.organizationName}] `;r.t.info(u.default.magenta(`~~~\n\n${i}Attempting to push configuration...\n\n~~~`));let a=S.length===1?S[0].content:S.find(e=>e.name===t.organizationName)?.content;if(!a){r.t.error(u.default.red(`${i}Failed to find transcend.yml file for organization: "${t.organizationName}".`)),e.push(t.organizationName);return}await d({transcendUrl:f,auth:t.apiKey,contents:a,pageSize:h,publishToPrivacyCenter:g,deleteExtraAttributeValues:v,classifyService:_})?r.t.info(u.default.green(`${i}Successfully pushed configuration!`)):(r.t.error(u.default.red(`${i}Failed to sync configuration.`)),e.push(t.organizationName))}),e.length>0&&(r.t.info(u.default.red(`Sync encountered errors for "${e.join(`,`)}". View output above for more information, or check out ${t.r}`)),this.process.exit(1))}r.t.info(u.default.green(`Successfully synced yaml file to Transcend! View at ${t.r}`))}exports.push=f;
2
- //# sourceMappingURL=impl-DBnRvkUi.cjs.map
1
+ const e=require(`./enums-CBXlBJii.cjs`),t=require(`./constants-C2Ve1XaG.cjs`),n=require(`./syncConfigurationToTranscend-CpoC4raI.cjs`),r=require(`./logger-BaHHbWVd.cjs`);require(`./buildAIIntegrationType-n_Qlv8wG.cjs`),require(`./codecs-JSDJgtyL.cjs`);const i=require(`./readTranscendYaml-CL9nujUr.cjs`),a=require(`./mergeTranscendInputs-PPpGbYgG.cjs`),o=require(`./api-keys-CQHYfnKg.cjs`),s=require(`./done-input-validation-Cgk5kNBs.cjs`);let c=require(`node:fs`),l=require(`node:path`),u=require(`colors`);u=e.s(u);async function d({transcendUrl:e,auth:t,pageSize:i,publishToPrivacyCenter:a,contents:o,deleteExtraAttributeValues:s=!1,classifyService:c=!1}){let l=n.ti(e,t);try{return!await n.t(o,l,{pageSize:i,publishToPrivacyCenter:a,classifyService:c,deleteExtraAttributeValues:s})}catch(e){return r.t.error(u.default.red(`An unexpected error occurred syncing the schema: ${e.message}`)),!1}}async function f({file:e=`./transcend.yml`,transcendUrl:f,auth:p,variables:m,pageSize:h,publishToPrivacyCenter:g,classifyService:_,deleteExtraAttributeValues:v}){s.t(this.process.exit);let y=await o.r(p),b=n.A(m),x;if(x=Array.isArray(y)&&(0,c.lstatSync)(e).isDirectory()?o.n(e).map(t=>(0,l.join)(e,t)):e.split(`,`),x.length<1)throw Error(`No file specified!`);let S=x.map(e=>{(0,c.existsSync)(e)?r.t.info(u.default.magenta(`Reading file "${e}"...`)):(r.t.error(u.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 t=i.r(e,b);return r.t.info(u.default.green(`Successfully read in "${e}"`)),{content:t,name:e.split(`/`).pop().replace(`.yml`,``)}}catch(e){r.t.error(u.default.red(`The shape of your yaml file is invalid with the following errors: ${e.message}`)),this.process.exit(1)}});if(typeof y==`string`){let[e,...n]=S.map(({content:e})=>e);await d({transcendUrl:f,auth:y,contents:a.t(e,...n),publishToPrivacyCenter:g,deleteExtraAttributeValues:v,pageSize:h,classifyService:!!_})||(r.t.info(u.default.red(`Sync encountered errors. View output above for more information, or check out ${t.r}`)),this.process.exit(1))}else{if(S.length!==1&&S.length!==y.length)throw 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 ${y.length} API key${y.length===1?``:`s`}`);let e=[];await n.Es(y,async(t,n)=>{let i=`[${n+1}/${y.length}][${t.organizationName}] `;r.t.info(u.default.magenta(`~~~\n\n${i}Attempting to push configuration...\n\n~~~`));let a=S.length===1?S[0].content:S.find(e=>e.name===t.organizationName)?.content;if(!a){r.t.error(u.default.red(`${i}Failed to find transcend.yml file for organization: "${t.organizationName}".`)),e.push(t.organizationName);return}await d({transcendUrl:f,auth:t.apiKey,contents:a,pageSize:h,publishToPrivacyCenter:g,deleteExtraAttributeValues:v,classifyService:_})?r.t.info(u.default.green(`${i}Successfully pushed configuration!`)):(r.t.error(u.default.red(`${i}Failed to sync configuration.`)),e.push(t.organizationName))}),e.length>0&&(r.t.info(u.default.red(`Sync encountered errors for "${e.join(`,`)}". View output above for more information, or check out ${t.r}`)),this.process.exit(1))}r.t.info(u.default.green(`Successfully synced yaml file to Transcend! View at ${t.r}`))}exports.push=f;
2
+ //# sourceMappingURL=impl-gZA9IzRe.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DBnRvkUi.cjs","names":["buildTranscendGraphQLClient","syncConfigurationToTranscend","validateTranscendAuth","parseVariablesFromString","listFiles","readTranscendYaml","mergeTranscendInputs","ADMIN_DASH_INTEGRATIONS","mapSeries"],"sources":["../src/commands/inventory/push/impl.ts"],"sourcesContent":["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 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,CAGA,EAAA,EAAO,KACL,EAAA,QAAO,MAAM,GAAG,EAAO,oCAAoC,CAC5D,EAED,EAAA,EAAO,MAAM,EAAA,QAAO,IAAI,GAAG,EAAO,+BAA+B,CAAC,CAClE,EAAkB,KAAK,EAAO,iBAAiB,GAEjD,CAEE,EAAkB,OAAS,IAC7B,EAAA,EAAO,KACL,EAAA,QAAO,IACL,gCAAgC,EAAkB,KAChD,IACD,CAAC,0DAA0DD,EAAAA,IAC7D,CACF,CAED,KAAK,QAAQ,KAAK,EAAE,EAKxB,EAAA,EAAO,KACL,EAAA,QAAO,MACL,uDAAuDA,EAAAA,IACxD,CACF"}
1
+ {"version":3,"file":"impl-gZA9IzRe.cjs","names":["buildTranscendGraphQLClient","syncConfigurationToTranscend","validateTranscendAuth","parseVariablesFromString","listFiles","readTranscendYaml","mergeTranscendInputs","ADMIN_DASH_INTEGRATIONS","mapSeries"],"sources":["../src/commands/inventory/push/impl.ts"],"sourcesContent":["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"],"mappings":"qgBA0BA,eAAe,EAAkB,CAC/B,eACA,OACA,WACA,yBACA,WACA,6BAA6B,GAC7B,kBAAkB,IAgBC,CACnB,IAAM,EAASA,EAAAA,GAA4B,EAAc,EAAK,CAG9D,GAAI,CAWF,MAAO,CAVkB,MAAMC,EAAAA,EAC7B,EACA,EACA,CACE,WACA,yBACA,kBACA,6BACD,CACF,OAEM,EAAK,CAMZ,OALA,EAAA,EAAO,MACL,EAAA,QAAO,IACL,oDAAoD,EAAI,UACzD,CACF,CACM,IAeX,eAAsB,EAEpB,CACE,OAAO,kBACP,eACA,OACA,YACA,WACA,yBACA,kBACA,8BAEa,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAe,MAAMC,EAAAA,EAAsB,EAAK,CAGhD,EAAOC,EAAAA,EAAyB,EAAU,CAG5C,EAQJ,GAPA,AAGE,EAHE,MAAM,QAAQ,EAAa,GAAA,EAAA,EA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AAa,OAAO,UAC1B,EAAa,SAAW,EAAI,GAAK,MAEtC,CAGH,IAAM,EAA8B,EAAE,CACtC,MAAMC,EAAAA,GAAU,EAAc,MAAO,EAAQ,IAAQ,CACnD,IAAM,EAAS,IAAI,EAAM,EAAE,GAAG,EAAa,OAAO,IAChD,EAAO,iBACR,IACD,EAAA,EAAO,KACL,EAAA,QAAO,QACL,UAAU,EAAO,4CAClB,CACF,CAGD,IAAM,EACJ,EAAgB,SAAW,EACvB,EAAgB,GAAG,QACnB,EAAgB,KACb,GAAU,EAAM,OAAS,EAAO,iBAClC,EAAE,QAGT,GAAI,CAAC,EAAa,CAChB,EAAA,EAAO,MACL,EAAA,QAAO,IACL,GAAG,EAAO,uDAAuD,EAAO,iBAAiB,IAC1F,CACF,CACD,EAAkB,KAAK,EAAO,iBAAiB,CAC/C,OAGc,MAAM,EAAkB,CACtC,eACA,KAAM,EAAO,OACb,SAAU,EACV,WACA,yBACA,6BACA,kBACD,CAAC,CAGA,EAAA,EAAO,KACL,EAAA,QAAO,MAAM,GAAG,EAAO,oCAAoC,CAC5D,EAED,EAAA,EAAO,MAAM,EAAA,QAAO,IAAI,GAAG,EAAO,+BAA+B,CAAC,CAClE,EAAkB,KAAK,EAAO,iBAAiB,GAEjD,CAEE,EAAkB,OAAS,IAC7B,EAAA,EAAO,KACL,EAAA,QAAO,IACL,gCAAgC,EAAkB,KAChD,IACD,CAAC,0DAA0DD,EAAAA,IAC7D,CACF,CAED,KAAK,QAAQ,KAAK,EAAE,EAKxB,EAAA,EAAO,KACL,EAAA,QAAO,MACL,uDAAuDA,EAAAA,IACxD,CACF"}
@@ -1,2 +1,2 @@
1
- require(`./enums-CBXlBJii.cjs`),require(`./constants-B-TmLA0w.cjs`);const e=require(`./syncConfigurationToTranscend-Bpge5AcC.cjs`);require(`./logger-BaHHbWVd.cjs`),require(`./buildAIIntegrationType-n_Qlv8wG.cjs`);const t=require(`./done-input-validation-Cgk5kNBs.cjs`);async function n({auth:n,dataSiloId:r,status:i,statuses:a,transcendUrl:o}){t.t(this.process.exit),await e.F({transcendUrl:o,auth:n,status:i,dataSiloId:r,requestStatuses:a})}exports.skipRequestDataSilos=n;
2
- //# sourceMappingURL=impl-b6KwZ74o.cjs.map
1
+ require(`./enums-CBXlBJii.cjs`),require(`./constants-C2Ve1XaG.cjs`);const e=require(`./syncConfigurationToTranscend-CpoC4raI.cjs`);require(`./logger-BaHHbWVd.cjs`),require(`./buildAIIntegrationType-n_Qlv8wG.cjs`);const t=require(`./done-input-validation-Cgk5kNBs.cjs`);async function n({auth:n,dataSiloId:r,status:i,statuses:a,transcendUrl:o}){t.t(this.process.exit),await e.F({transcendUrl:o,auth:n,status:i,dataSiloId:r,requestStatuses:a})}exports.skipRequestDataSilos=n;
2
+ //# sourceMappingURL=impl-l4-zrJDk.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-b6KwZ74o.cjs","names":["skipRequestDataSilosHelper"],"sources":["../src/commands/request/system/skip-request-data-silos/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context';\nimport type {\n RequestDataSiloStatus,\n RequestStatus,\n} from '@transcend-io/privacy-types';\nimport { skipRequestDataSilos as skipRequestDataSilosHelper } from '../../../../lib/requests';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nexport interface SkipRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n transcendUrl: string;\n statuses: RequestStatus[];\n status:\n | (typeof RequestDataSiloStatus)['Skipped']\n | (typeof RequestDataSiloStatus)['Resolved'];\n}\n\nexport async function skipRequestDataSilos(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n status,\n statuses,\n transcendUrl,\n }: SkipRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await skipRequestDataSilosHelper({\n transcendUrl,\n auth,\n status,\n dataSiloId,\n requestStatuses: statuses,\n });\n}\n"],"mappings":"6QAkBA,eAAsB,EAEpB,CACE,OACA,aACA,SACA,WACA,gBAEa,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAAAA,EAA2B,CAC/B,eACA,OACA,SACA,aACA,gBAAiB,EAClB,CAAC"}
1
+ {"version":3,"file":"impl-l4-zrJDk.cjs","names":["skipRequestDataSilosHelper"],"sources":["../src/commands/request/system/skip-request-data-silos/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context';\nimport type {\n RequestDataSiloStatus,\n RequestStatus,\n} from '@transcend-io/privacy-types';\nimport { skipRequestDataSilos as skipRequestDataSilosHelper } from '../../../../lib/requests';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nexport interface SkipRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n transcendUrl: string;\n statuses: RequestStatus[];\n status:\n | (typeof RequestDataSiloStatus)['Skipped']\n | (typeof RequestDataSiloStatus)['Resolved'];\n}\n\nexport async function skipRequestDataSilos(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n status,\n statuses,\n transcendUrl,\n }: SkipRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await skipRequestDataSilosHelper({\n transcendUrl,\n auth,\n status,\n dataSiloId,\n requestStatuses: statuses,\n });\n}\n"],"mappings":"6QAkBA,eAAsB,EAEpB,CACE,OACA,aACA,SACA,WACA,gBAEa,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAAAA,EAA2B,CAC/B,eACA,OACA,SACA,aACA,gBAAiB,EAClB,CAAC"}
@@ -1,2 +1,2 @@
1
- const e=require(`./enums-CBXlBJii.cjs`),t=require(`./command-3fhEz5PC.cjs`),n=require(`./constants-B-TmLA0w.cjs`),r=require(`./syncConfigurationToTranscend-Bpge5AcC.cjs`),i=require(`./logger-BaHHbWVd.cjs`);require(`./buildAIIntegrationType-n_Qlv8wG.cjs`),require(`./codecs-JSDJgtyL.cjs`);const a=require(`./readTranscendYaml-CL9nujUr.cjs`),o=require(`./api-keys-CDp8NUhN.cjs`),s=require(`./done-input-validation-Cgk5kNBs.cjs`);let c=require(`node:fs`);c=e.s(c);let l=require(`node:path`),u=require(`colors`);u=e.s(u);async function d({auth:d,resources:f=t.n,file:p,transcendUrl:m,dataSiloIds:h=[],integrationNames:g=[],trackerStatuses:_=t.t,pageSize:v,skipDatapoints:y,skipSubDatapoints:b,includeGuessedCategories:x,debug:S}){s.t(this.process.exit);let C=await o.r(d),w=f.includes(`all`)?Object.values(e.o):f;if(typeof C==`string`){try{let e=await r._n(r.ti(m,C),{dataSiloIds:h,integrationNames:g,resources:w,pageSize:v,debug:S,skipDatapoints:y,skipSubDatapoints:b,includeGuessedCategories:x,trackerStatuses:_});i.t.info(u.default.magenta(`Writing configuration to file "${p}"...`)),a.a(p,e)}catch(e){i.t.error(u.default.red(`An error occurred syncing the schema: ${S?e.stack:e.message}`)),this.process.exit(1)}i.t.info(u.default.green(`Successfully synced yaml file to disk at ${p}! View at ${n.r}`))}else{if(!c.default.lstatSync(p).isDirectory())throw Error(`File is expected to be a folder when passing in a list of API keys to pull from. e.g. --file=./working/`);let e=[];await r.Es(C,async(t,n)=>{let o=`[${n+1}/${C.length}][${t.organizationName}] `;i.t.info(u.default.magenta(`~~~\n\n${o}Attempting to pull configuration...\n\n~~~`));let s=r.ti(m,t.apiKey);try{let e=await r._n(s,{dataSiloIds:h,integrationNames:g,resources:w,pageSize:v,debug:S,skipDatapoints:y,skipSubDatapoints:b,includeGuessedCategories:x,trackerStatuses:_}),n=(0,l.join)(p,`${t.organizationName}.yml`);i.t.info(u.default.magenta(`Writing configuration to file "${n}"...`)),a.a(n,e),i.t.info(u.default.green(`${o}Successfully pulled configuration!`))}catch(n){i.t.error(u.default.red(`${o}Failed to sync configuration. - ${n.message}`)),e.push(t.organizationName)}}),e.length>0&&(i.t.info(u.default.red(`Sync encountered errors for "${e.join(`,`)}". View output above for more information, or check out ${n.r}`)),this.process.exit(1))}}exports.pull=d;
2
- //# sourceMappingURL=impl-Cc-Lfiig.cjs.map
1
+ const e=require(`./enums-CBXlBJii.cjs`),t=require(`./command-CQS4sg_3.cjs`),n=require(`./constants-C2Ve1XaG.cjs`),r=require(`./syncConfigurationToTranscend-CpoC4raI.cjs`),i=require(`./logger-BaHHbWVd.cjs`);require(`./buildAIIntegrationType-n_Qlv8wG.cjs`),require(`./codecs-JSDJgtyL.cjs`);const a=require(`./readTranscendYaml-CL9nujUr.cjs`),o=require(`./api-keys-CQHYfnKg.cjs`),s=require(`./done-input-validation-Cgk5kNBs.cjs`);let c=require(`node:fs`);c=e.s(c);let l=require(`node:path`),u=require(`colors`);u=e.s(u);async function d({auth:d,resources:f=t.n,file:p,transcendUrl:m,dataSiloIds:h=[],integrationNames:g=[],trackerStatuses:_=t.t,pageSize:v,skipDatapoints:y,skipSubDatapoints:b,includeGuessedCategories:x,debug:S}){s.t(this.process.exit);let C=await o.r(d),w=f.includes(`all`)?Object.values(e.o):f;if(typeof C==`string`){try{let e=await r._n(r.ti(m,C),{dataSiloIds:h,integrationNames:g,resources:w,pageSize:v,debug:S,skipDatapoints:y,skipSubDatapoints:b,includeGuessedCategories:x,trackerStatuses:_});i.t.info(u.default.magenta(`Writing configuration to file "${p}"...`)),a.a(p,e)}catch(e){i.t.error(u.default.red(`An error occurred syncing the schema: ${S?e.stack:e.message}`)),this.process.exit(1)}i.t.info(u.default.green(`Successfully synced yaml file to disk at ${p}! View at ${n.r}`))}else{if(!c.default.lstatSync(p).isDirectory())throw Error(`File is expected to be a folder when passing in a list of API keys to pull from. e.g. --file=./working/`);let e=[];await r.Es(C,async(t,n)=>{let o=`[${n+1}/${C.length}][${t.organizationName}] `;i.t.info(u.default.magenta(`~~~\n\n${o}Attempting to pull configuration...\n\n~~~`));let s=r.ti(m,t.apiKey);try{let e=await r._n(s,{dataSiloIds:h,integrationNames:g,resources:w,pageSize:v,debug:S,skipDatapoints:y,skipSubDatapoints:b,includeGuessedCategories:x,trackerStatuses:_}),n=(0,l.join)(p,`${t.organizationName}.yml`);i.t.info(u.default.magenta(`Writing configuration to file "${n}"...`)),a.a(n,e),i.t.info(u.default.green(`${o}Successfully pulled configuration!`))}catch(n){i.t.error(u.default.red(`${o}Failed to sync configuration. - ${n.message}`)),e.push(t.organizationName)}}),e.length>0&&(i.t.info(u.default.red(`Sync encountered errors for "${e.join(`,`)}". View output above for more information, or check out ${n.r}`)),this.process.exit(1))}}exports.pull=d;
2
+ //# sourceMappingURL=impl-mn91PHXE.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-Cc-Lfiig.cjs","names":["DEFAULT_TRANSCEND_PULL_RESOURCES","DEFAULT_CONSENT_TRACKER_STATUSES","validateTranscendAuth","TranscendPullResource","pullTranscendConfiguration","buildTranscendGraphQLClient","ADMIN_DASH_INTEGRATIONS","fs","mapSeries"],"sources":["../src/commands/inventory/pull/impl.ts"],"sourcesContent":["import { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport type { LocalContext } from '../../../context';\nimport { TranscendPullResource } from '../../../enums';\nimport {\n DEFAULT_CONSENT_TRACKER_STATUSES,\n DEFAULT_TRANSCEND_PULL_RESOURCES,\n} from './command';\n\nimport { logger } from '../../../logger';\nimport colors from 'colors';\nimport { mapSeries } from '../../../lib/bluebird';\nimport { join } from 'node:path';\nimport fs from 'node:fs';\nimport {\n buildTranscendGraphQLClient,\n pullTranscendConfiguration,\n} from '../../../lib/graphql';\n\nimport { writeTranscendYaml } from '../../../lib/readTranscendYaml';\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants';\nimport { validateTranscendAuth } from '../../../lib/api-keys';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface PullCommandFlags {\n auth: string;\n resources?: (TranscendPullResource | 'all')[];\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n integrationNames?: string[];\n trackerStatuses?: ConsentTrackerStatus[];\n pageSize: number;\n skipDatapoints: boolean;\n skipSubDatapoints: boolean;\n includeGuessedCategories: boolean;\n debug: boolean;\n}\n\nexport async function pull(\n this: LocalContext,\n {\n auth,\n resources = DEFAULT_TRANSCEND_PULL_RESOURCES,\n file,\n transcendUrl,\n dataSiloIds = [],\n integrationNames = [],\n trackerStatuses = DEFAULT_CONSENT_TRACKER_STATUSES,\n pageSize,\n skipDatapoints,\n skipSubDatapoints,\n includeGuessedCategories,\n debug,\n }: PullCommandFlags,\n): Promise<void> {\n 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 const resourcesToPull: TranscendPullResource[] = resources.includes('all')\n ? Object.values(TranscendPullResource)\n : (resources as TranscendPullResource[]);\n\n // Sync to Disk\n if (typeof apiKeyOrList === 'string') {\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKeyOrList);\n\n const configuration = await pullTranscendConfiguration(client, {\n dataSiloIds,\n integrationNames,\n resources: resourcesToPull,\n pageSize,\n debug,\n skipDatapoints,\n skipSubDatapoints,\n includeGuessedCategories,\n trackerStatuses,\n });\n\n logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n writeTranscendYaml(file, configuration);\n } catch (err) {\n logger.error(\n colors.red(\n `An error occurred syncing the schema: ${\n debug ? err.stack : err.message\n }`,\n ),\n );\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced yaml file to disk at ${file}! View at ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n } else {\n if (!fs.lstatSync(file).isDirectory()) {\n throw new Error(\n 'File is expected to be a folder when passing in a list of API keys to pull from. e.g. --file=./working/',\n );\n }\n\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${\n apiKey.organizationName\n }] `;\n logger.info(\n colors.magenta(\n `~~~\\n\\n${prefix}Attempting to pull configuration...\\n\\n~~~`,\n ),\n );\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKey.apiKey);\n\n try {\n const configuration = await pullTranscendConfiguration(client, {\n dataSiloIds,\n integrationNames,\n resources: resourcesToPull,\n pageSize,\n debug,\n skipDatapoints,\n skipSubDatapoints,\n includeGuessedCategories,\n trackerStatuses,\n });\n\n const filePath = join(file, `${apiKey.organizationName}.yml`);\n logger.info(\n colors.magenta(`Writing configuration to file \"${filePath}\"...`),\n );\n writeTranscendYaml(filePath, configuration);\n\n logger.info(\n colors.green(`${prefix}Successfully pulled configuration!`),\n );\n } catch (err) {\n logger.error(\n colors.red(`${prefix}Failed to sync configuration. - ${err.message}`),\n );\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n logger.info(\n colors.red(\n `Sync encountered errors for \"${encounteredErrors.join(\n ',',\n )}\". View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n }\n}\n"],"mappings":"qgBAsCA,eAAsB,EAEpB,CACE,OACA,YAAYA,EAAAA,EACZ,OACA,eACA,cAAc,EAAE,CAChB,mBAAmB,EAAE,CACrB,kBAAkBC,EAAAA,EAClB,WACA,iBACA,oBACA,2BACA,SAEa,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAe,MAAMC,EAAAA,EAAsB,EAAK,CAEhD,EAA2C,EAAU,SAAS,MAAM,CACtE,OAAO,OAAOC,EAAAA,EAAsB,CACnC,EAGL,GAAI,OAAO,GAAiB,SAAU,CACpC,GAAI,CAIF,IAAM,EAAgB,MAAMC,EAAAA,GAFbC,EAAAA,GAA4B,EAAc,EAAa,CAEP,CAC7D,cACA,mBACA,UAAW,EACX,WACA,QACA,iBACA,oBACA,2BACA,kBACD,CAAC,CAEF,EAAA,EAAO,KAAK,EAAA,QAAO,QAAQ,kCAAkC,EAAK,MAAM,CAAC,CACzE,EAAA,EAAmB,EAAM,EAAc,OAChC,EAAK,CACZ,EAAA,EAAO,MACL,EAAA,QAAO,IACL,yCACE,EAAQ,EAAI,MAAQ,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TranscendPullResource","pullTranscendConfiguration","buildTranscendGraphQLClient","ADMIN_DASH_INTEGRATIONS","fs","mapSeries"],"sources":["../src/commands/inventory/pull/impl.ts"],"sourcesContent":["import { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport type { LocalContext } from '../../../context';\nimport { TranscendPullResource } from '../../../enums';\nimport {\n DEFAULT_CONSENT_TRACKER_STATUSES,\n DEFAULT_TRANSCEND_PULL_RESOURCES,\n} from './command';\n\nimport { logger } from '../../../logger';\nimport colors from 'colors';\nimport { mapSeries } from '../../../lib/bluebird';\nimport { join } from 'node:path';\nimport fs from 'node:fs';\nimport {\n buildTranscendGraphQLClient,\n pullTranscendConfiguration,\n} from '../../../lib/graphql';\n\nimport { writeTranscendYaml } from '../../../lib/readTranscendYaml';\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants';\nimport { validateTranscendAuth } from '../../../lib/api-keys';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface PullCommandFlags {\n auth: string;\n resources?: (TranscendPullResource | 'all')[];\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n integrationNames?: string[];\n trackerStatuses?: ConsentTrackerStatus[];\n pageSize: number;\n skipDatapoints: boolean;\n skipSubDatapoints: boolean;\n includeGuessedCategories: boolean;\n debug: boolean;\n}\n\nexport async function pull(\n this: LocalContext,\n {\n auth,\n resources = DEFAULT_TRANSCEND_PULL_RESOURCES,\n file,\n transcendUrl,\n dataSiloIds = [],\n integrationNames = [],\n trackerStatuses = DEFAULT_CONSENT_TRACKER_STATUSES,\n pageSize,\n skipDatapoints,\n skipSubDatapoints,\n includeGuessedCategories,\n debug,\n }: PullCommandFlags,\n): Promise<void> {\n 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 const resourcesToPull: TranscendPullResource[] = resources.includes('all')\n ? Object.values(TranscendPullResource)\n : (resources as TranscendPullResource[]);\n\n // Sync to Disk\n if (typeof apiKeyOrList === 'string') {\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKeyOrList);\n\n const configuration = await pullTranscendConfiguration(client, {\n dataSiloIds,\n integrationNames,\n resources: resourcesToPull,\n pageSize,\n debug,\n skipDatapoints,\n skipSubDatapoints,\n includeGuessedCategories,\n trackerStatuses,\n });\n\n logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n writeTranscendYaml(file, configuration);\n } catch (err) {\n logger.error(\n colors.red(\n `An error occurred syncing the schema: ${\n debug ? err.stack : err.message\n }`,\n ),\n );\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced yaml file to disk at ${file}! View at ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n } else {\n if (!fs.lstatSync(file).isDirectory()) {\n throw new Error(\n 'File is expected to be a folder when passing in a list of API keys to pull from. e.g. --file=./working/',\n );\n }\n\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${\n apiKey.organizationName\n }] `;\n logger.info(\n colors.magenta(\n `~~~\\n\\n${prefix}Attempting to pull configuration...\\n\\n~~~`,\n ),\n );\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKey.apiKey);\n\n try {\n const configuration = await pullTranscendConfiguration(client, {\n dataSiloIds,\n integrationNames,\n resources: resourcesToPull,\n pageSize,\n debug,\n skipDatapoints,\n skipSubDatapoints,\n includeGuessedCategories,\n trackerStatuses,\n });\n\n const filePath = join(file, `${apiKey.organizationName}.yml`);\n logger.info(\n colors.magenta(`Writing configuration to file \"${filePath}\"...`),\n );\n writeTranscendYaml(filePath, configuration);\n\n logger.info(\n colors.green(`${prefix}Successfully pulled configuration!`),\n );\n } catch (err) {\n logger.error(\n colors.red(`${prefix}Failed to sync configuration. - ${err.message}`),\n );\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n logger.info(\n colors.red(\n `Sync encountered errors for \"${encounteredErrors.join(\n ',',\n )}\". View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n }\n}\n"],"mappings":"qgBAsCA,eAAsB,EAEpB,CACE,OACA,YAAYA,EAAAA,EACZ,OACA,eACA,cAAc,EAAE,CAChB,mBAAmB,EAAE,CACrB,kBAAkBC,EAAAA,EAClB,WACA,iBACA,oBACA,2BACA,SAEa,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAe,MAAMC,EAAAA,EAAsB,EAAK,CAEhD,EAA2C,EAAU,SAAS,MAAM,CACtE,OAAO,OAAOC,EAAAA,EAAsB,CACnC,EAGL,GAAI,OAAO,GAAiB,SAAU,CACpC,GAAI,CAIF,IAAM,EAAgB,MAAMC,EAAAA,GAFbC,EAAAA,GAA4B,EAAc,EAAa,CAEP,CAC7D,cACA,mBACA,UAAW,EACX,WACA,QACA,iBACA,oBACA,2BACA,kBACD,CAAC,CAEF,EAAA,EAAO,KAAK,EAAA,QAAO,QAAQ,kCAAkC,EAAK,MAAM,CAAC,CACzE,EAAA,EAAmB,EAAM,EAAc,OAChC,EAAK,CACZ,EAAA,EAAO,MACL,EAAA,QAAO,IACL,yCACE,EAAQ,EAAI,MAAQ,EAAI,UAE3B,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,CAItB,EAAA,EAAO,KACL,EAAA,QAAO,MACL,4CAA4C,EAAK,YAAYC,EAAAA,IAC9D,CACF,KACI,CACL,GAAI,CAACC,EAAAA,QAAG,UAAU,EAAK,CAAC,aAAa,CACnC,MAAU,MACR,0GACD,CAGH,IAAM,EAA8B,EAAE,CACtC,MAAMC,EAAAA,GAAU,EAAc,MAAO,EAAQ,IAAQ,CACnD,IAAM,EAAS,IAAI,EAAM,EAAE,GAAG,EAAa,OAAO,IAChD,EAAO,iBACR,IACD,EAAA,EAAO,KACL,EAAA,QAAO,QACL,UAAU,EAAO,4CAClB,CACF,CAGD,IAAM,EAASH,EAAAA,GAA4B,EAAc,EAAO,OAAO,CAEvE,GAAI,CACF,IAAM,EAAgB,MAAMD,EAAAA,GAA2B,EAAQ,CAC7D,cACA,mBACA,UAAW,EACX,WACA,QACA,iBACA,oBACA,2BACA,kBACD,CAAC,CAEI,GAAA,EAAA,EAAA,MAAgB,EAAM,GAAG,EAAO,iBAAiB,MAAM,CAC7D,EAAA,EAAO,KACL,EAAA,QAAO,QAAQ,kCAAkC,EAAS,MAAM,CACjE,CACD,EAAA,EAAmB,EAAU,EAAc,CAE3C,EAAA,EAAO,KACL,EAAA,QAAO,MAAM,GAAG,EAAO,oCAAoC,CAC5D,OACM,EAAK,CACZ,EAAA,EAAO,MACL,EAAA,QAAO,IAAI,GAAG,EAAO,kCAAkC,EAAI,UAAU,CACtE,CACD,EAAkB,KAAK,EAAO,iBAAiB,GAEjD,CAEE,EAAkB,OAAS,IAC7B,EAAA,EAAO,KACL,EAAA,QAAO,IACL,gCAAgC,EAAkB,KAChD,IACD,CAAC,0DAA0DE,EAAAA,IAC7D,CACF,CAED,KAAK,QAAQ,KAAK,EAAE"}
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const e=require(`./enums-CBXlBJii.cjs`),t=require(`./constants-B-TmLA0w.cjs`),n=require(`./syncConfigurationToTranscend-Bpge5AcC.cjs`);require(`./logger-BaHHbWVd.cjs`);const r=require(`./buildAIIntegrationType-n_Qlv8wG.cjs`),i=require(`./codecs-JSDJgtyL.cjs`),a=require(`./readTranscendYaml-CL9nujUr.cjs`),o=require(`./mergeTranscendInputs-PPpGbYgG.cjs`),s=require(`./consent-manager-DXWjvCtI.cjs`),c=require(`./uploadConsents-CJc_6Qwd.cjs`),l=require(`./cron-DQHN57v7.cjs`),u=require(`./api-keys-CDp8NUhN.cjs`),d=require(`./data-inventory-flXV6qPl.cjs`),f=require(`./manual-enrichment-Y_BQaSZQ.cjs`);let p=require(`@transcend-io/privacy-types`),m=require(`@transcend-io/type-utils`),h=require(`@transcend-io/handlebars-utils`),g=require(`fast-glob`);g=e.s(g);let _=require(`child_process`);const v=20;async function y(e){let t=[],r=0,i=!1;do{let{largeLanguageModels:{nodes:a}}=await n.i(e,n.Ki,{first:20,offset:r});t.push(...a),r+=20,i=a.length===20}while(i);return t.sort((e,t)=>e.name.localeCompare(t.name))}function b(e){return RegExp(`<${e}>([\\s\\S]+?)<\\/${e}>`)}function x(e){return e}const S=e=>{try{return JSON.parse(e)}catch{return e}};var C=class{prompts;handlebarsOptions;promptContentMap;largeLanguageModels=[];agentsByName={};agentsByAgentId={};graphQLClient;defaultVariables;variables;handlebars;transcendApiKey;transcendUrl;requireApproval;cacheDuration;lastUpdatedAt;constructor({prompts:e,handlebarsOptions:r={},transcendUrl:i=t.a,transcendApiKey:a,requireApproval:o=!0,cacheDuration:s,defaultVariables:c={}}){this.prompts=e,this.transcendUrl=i,this.transcendApiKey=a,this.variables=c,this.defaultVariables=c,this.graphQLClient=n.ti(i,typeof a==`object`?a.release():a),this.requireApproval=o,this.cacheDuration=s,this.handlebarsOptions=r,this.handlebars=(0,h.createHandlebarsWithHelpers)(r)}async fetchPromptsAndMetadata(){let e=(0,m.getValues)(this.prompts),r=e.map(({id:e})=>e).filter(e=>!!e),i=e.map(({title:e})=>e).filter(e=>!!e),a=n.Ds(e.map(({agentNames:e})=>e||[]).flat()),[o,s,c]=await Promise.all([n.Xn(this.graphQLClient,{promptIds:r,promptTitles:i}),y(this.graphQLClient),n.Gr(this.graphQLClient,{names:a})]);this.agentsByName=t.g(c,`name`),this.agentsByAgentId=t.g(c,`agentId`),this.largeLanguageModels=s.filter(e=>e.isTranscendHosted===!1);let l=t.g(o.prompts,`title`),u=t.g(o.prompts,`id`);return this.variables={...o.calculatedVariables.reduce((e,t)=>Object.assign(e,{[t.name]:t.data?JSON.parse(t.data):t.data}),{}),...this.defaultVariables},this.handlebars=(0,h.createHandlebarsWithHelpers)({...this.handlebarsOptions,templates:[...this.handlebarsOptions.templates||[],...o.promptPartials.map(e=>({name:e.slug,content:e.content}))]}),this.promptContentMap=(0,m.apply)(this.prompts,({id:e,title:t})=>{let n=e?u[e]:t?l[t]:void 0;if(!n)throw Error(`Failed to find prompt with title: "${t}" and id: "${e}"`);return n}),this.lastUpdatedAt=new Date,o}async getAgentByName(e){let t=this.agentsByName[e];if(t)return t;let[r]=await n.Gr(this.graphQLClient,{names:[e]});if(r)return this.agentsByName[r.name]=r,this.agentsByAgentId[r.agentId]=r,r}async getPromptThreadBySlackTs(e){let[t]=await n.Jn(this.graphQLClient,{slackMessageTs:[e]});return t}async getAgentsByName(e){if(e.length<1)throw Error(`Expected at least one name to be provided`);let{hasCache:t=[],missingCache:r=[]}=n.As(e,e=>this.agentsByName[e]?`hasCache`:`missingCache`),i=t.map(e=>this.agentsByName[e]);if(r.length===0)return i;let a=n.Ns(r,50),o=[];return await n.Es(a,async e=>{let t=await n.Gr(this.graphQLClient,{names:e});t.forEach(e=>{this.agentsByName[e.name]=e,this.agentsByAgentId[e.agentId]=e}),o.push(...t)}),[...i,...o]}getAgentFiles(e){return n.qr(this.graphQLClient,e)}getLargeLanguageModel(e){let t=this.largeLanguageModels.find(t=>typeof e==`string`?t.id===e:t.name===e.name&&t.client===e.client);if(!t)throw Error(`Failed to find model matching: ${typeof e==`string`?e:JSON.stringify(e)}`);return t}async getPromptDefinition(e){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let{promptContentMap:t}=this;if(!t)throw Error(`Expected this.promptContentMap to be defined`);let n=t[e];if(!n)throw Error(`Expected this.promptContentMap[${e}] to be defined`);return n}async compilePrompt(e,t){let n=await this.getPromptDefinition(e),r=this.prompts[e];if(!r)throw Error(`Expected this.prompts[${e}] to be defined`);if(this.requireApproval&&n.status!==p.PromptStatus.Approved)throw Error(`Assessment "${n.title}" cannot be used because its in status: "${n.status}"`);if(n.status===p.PromptStatus.Rejected)throw Error(`Assessment "${n.title}" cannot be used because it's in status: "${n.status}"`);return(0,m.decodeCodec)(r.paramCodec,t),this.handlebars.compile(n.content)({currentDate:new Date().toISOString(),...this.variables,...t})}parseAiResponse(e,t){let n=this.prompts[e];if(!n)throw Error(`Expected this.prompts[${e}] to be defined`);let r=n.extractFromTag&&(b(n.extractFromTag).exec(t)||[])[1]||t;return(0,m.decodeCodec)(n.outputCodec,S(r),!1)}async reportAndParsePromptRun(e,{largeLanguageModel:t,...r}){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let i=r.name||`@transcend-io/cli-prompt-run-${new Date().toISOString()}`;if(!this.promptContentMap)throw Error(`Expected this.promptContentMap to be defined`);let a=this.promptContentMap[e];if(!a)throw Error(`Expected this.prompts[${e}] to be defined`);if(r.promptRunMessages.length===0)throw Error(`promptRunMessages is expected to have length > 0`);if(r.promptRunMessages[0].role!==p.ChatCompletionRole.System)throw Error(`promptRunMessages[0].role is expected to be = ${p.ChatCompletionRole.System}`);if(r.promptRunMessages[r.promptRunMessages.length-1].role!==p.ChatCompletionRole.Assistant)throw Error(`promptRunMessages[${r.promptRunMessages.length-1}].role is expected to be = ${p.ChatCompletionRole.Assistant}`);let o=r.promptRunMessages[r.promptRunMessages.length-1].content,s;try{s=this.parseAiResponse(e,o)}catch(e){throw await n.hn(this.graphQLClient,{productArea:p.PromptRunProductArea.PromptManager,...r,name:i,error:e.message,status:p.QueueStatus.Error,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:a.id,promptRunMessages:r.promptRunMessages.map((e,t)=>({...e,...t===0?{template:a.content}:{}}))}),e}let c=await n.hn(this.graphQLClient,{productArea:p.PromptRunProductArea.PromptManager,...r,name:i,status:p.QueueStatus.Resolved,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:a.id,promptRunMessages:r.promptRunMessages.map((e,t)=>({...e,...t===0?{template:a.content}:{}}))});return{result:s,promptRunId:c,promptRunUrl:`https://app.transcend.io/prompts/runs/${c}`}}async reportPromptRunError(e,{largeLanguageModel:t,...r}){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let i=r.name||`@transcend-io/cli-prompt-run-${new Date().toISOString()}`;if(!this.promptContentMap)throw Error(`Expected this.promptContentMap to be defined`);let a=this.promptContentMap[e];if(!a)throw Error(`Expected this.prompts[${e}] to be defined`);if(r.promptRunMessages.length===0)throw Error(`promptRunMessages is expected to have length > 0`);if(r.promptRunMessages[0].role!==p.ChatCompletionRole.System)throw Error(`promptRunMessages[0].role is expected to be = ${p.ChatCompletionRole.System}`);let o=await n.hn(this.graphQLClient,{productArea:p.PromptRunProductArea.PromptManager,...r,name:i,status:p.QueueStatus.Error,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:a.id,promptRunMessages:r.promptRunMessages.map((e,t)=>({...e,...t===0?{template:a.content}:{}}))});return{promptRunId:o,promptRunUrl:`https://app.transcend.io/prompts/runs/${o}`}}};function w(e){return e.replace(/(https?:\/\/[^\s]+)/g,`<link-omitted>`)}function T(e){return Object.entries(e).reduce((e,[t,n])=>n!=null&&n!==``&&!(Array.isArray(n)&&n.length===0)&&!(typeof n==`object`&&Object.keys(n).length===0)?Object.assign(e,{[t]:n}):e,{})}function E({baseBranch:e,rootDirectory:t,githubRepo:r,excludedGlob:i=[],fileBlockList:a=[]}){(0,_.execSync)(`git fetch origin ${e}`);let o=(0,_.execSync)(`git ls-remote ${r} "refs/heads/${e}" | cut -f 1`,{encoding:`utf-8`}).split(`
1
+ const e=require(`./enums-CBXlBJii.cjs`),t=require(`./constants-C2Ve1XaG.cjs`),n=require(`./syncConfigurationToTranscend-CpoC4raI.cjs`);require(`./logger-BaHHbWVd.cjs`);const r=require(`./buildAIIntegrationType-n_Qlv8wG.cjs`),i=require(`./codecs-JSDJgtyL.cjs`),a=require(`./readTranscendYaml-CL9nujUr.cjs`),o=require(`./mergeTranscendInputs-PPpGbYgG.cjs`),s=require(`./consent-manager-BplE7hDG.cjs`),c=require(`./uploadConsents-BVjLnCTQ.cjs`),l=require(`./cron-BU5K5zwR.cjs`),u=require(`./api-keys-CQHYfnKg.cjs`),d=require(`./data-inventory-CoAdyyxS.cjs`),f=require(`./manual-enrichment-NFVrfdss.cjs`);let p=require(`@transcend-io/privacy-types`),m=require(`@transcend-io/type-utils`),h=require(`@transcend-io/handlebars-utils`),g=require(`fast-glob`);g=e.s(g);let _=require(`child_process`);const v=20;async function y(e){let t=[],r=0,i=!1;do{let{largeLanguageModels:{nodes:a}}=await n.i(e,n.Ki,{first:20,offset:r});t.push(...a),r+=20,i=a.length===20}while(i);return t.sort((e,t)=>e.name.localeCompare(t.name))}function b(e){return RegExp(`<${e}>([\\s\\S]+?)<\\/${e}>`)}function x(e){return e}const S=e=>{try{return JSON.parse(e)}catch{return e}};var C=class{prompts;handlebarsOptions;promptContentMap;largeLanguageModels=[];agentsByName={};agentsByAgentId={};graphQLClient;defaultVariables;variables;handlebars;transcendApiKey;transcendUrl;requireApproval;cacheDuration;lastUpdatedAt;constructor({prompts:e,handlebarsOptions:r={},transcendUrl:i=t.a,transcendApiKey:a,requireApproval:o=!0,cacheDuration:s,defaultVariables:c={}}){this.prompts=e,this.transcendUrl=i,this.transcendApiKey=a,this.variables=c,this.defaultVariables=c,this.graphQLClient=n.ti(i,typeof a==`object`?a.release():a),this.requireApproval=o,this.cacheDuration=s,this.handlebarsOptions=r,this.handlebars=(0,h.createHandlebarsWithHelpers)(r)}async fetchPromptsAndMetadata(){let e=(0,m.getValues)(this.prompts),r=e.map(({id:e})=>e).filter(e=>!!e),i=e.map(({title:e})=>e).filter(e=>!!e),a=n.Ds(e.map(({agentNames:e})=>e||[]).flat()),[o,s,c]=await Promise.all([n.Xn(this.graphQLClient,{promptIds:r,promptTitles:i}),y(this.graphQLClient),n.Gr(this.graphQLClient,{names:a})]);this.agentsByName=t.g(c,`name`),this.agentsByAgentId=t.g(c,`agentId`),this.largeLanguageModels=s.filter(e=>e.isTranscendHosted===!1);let l=t.g(o.prompts,`title`),u=t.g(o.prompts,`id`);return this.variables={...o.calculatedVariables.reduce((e,t)=>Object.assign(e,{[t.name]:t.data?JSON.parse(t.data):t.data}),{}),...this.defaultVariables},this.handlebars=(0,h.createHandlebarsWithHelpers)({...this.handlebarsOptions,templates:[...this.handlebarsOptions.templates||[],...o.promptPartials.map(e=>({name:e.slug,content:e.content}))]}),this.promptContentMap=(0,m.apply)(this.prompts,({id:e,title:t})=>{let n=e?u[e]:t?l[t]:void 0;if(!n)throw Error(`Failed to find prompt with title: "${t}" and id: "${e}"`);return n}),this.lastUpdatedAt=new Date,o}async getAgentByName(e){let t=this.agentsByName[e];if(t)return t;let[r]=await n.Gr(this.graphQLClient,{names:[e]});if(r)return this.agentsByName[r.name]=r,this.agentsByAgentId[r.agentId]=r,r}async getPromptThreadBySlackTs(e){let[t]=await n.Jn(this.graphQLClient,{slackMessageTs:[e]});return t}async getAgentsByName(e){if(e.length<1)throw Error(`Expected at least one name to be provided`);let{hasCache:t=[],missingCache:r=[]}=n.As(e,e=>this.agentsByName[e]?`hasCache`:`missingCache`),i=t.map(e=>this.agentsByName[e]);if(r.length===0)return i;let a=n.Ns(r,50),o=[];return await n.Es(a,async e=>{let t=await n.Gr(this.graphQLClient,{names:e});t.forEach(e=>{this.agentsByName[e.name]=e,this.agentsByAgentId[e.agentId]=e}),o.push(...t)}),[...i,...o]}getAgentFiles(e){return n.qr(this.graphQLClient,e)}getLargeLanguageModel(e){let t=this.largeLanguageModels.find(t=>typeof e==`string`?t.id===e:t.name===e.name&&t.client===e.client);if(!t)throw Error(`Failed to find model matching: ${typeof e==`string`?e:JSON.stringify(e)}`);return t}async getPromptDefinition(e){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let{promptContentMap:t}=this;if(!t)throw Error(`Expected this.promptContentMap to be defined`);let n=t[e];if(!n)throw Error(`Expected this.promptContentMap[${e}] to be defined`);return n}async compilePrompt(e,t){let n=await this.getPromptDefinition(e),r=this.prompts[e];if(!r)throw Error(`Expected this.prompts[${e}] to be defined`);if(this.requireApproval&&n.status!==p.PromptStatus.Approved)throw Error(`Assessment "${n.title}" cannot be used because its in status: "${n.status}"`);if(n.status===p.PromptStatus.Rejected)throw Error(`Assessment "${n.title}" cannot be used because it's in status: "${n.status}"`);return(0,m.decodeCodec)(r.paramCodec,t),this.handlebars.compile(n.content)({currentDate:new Date().toISOString(),...this.variables,...t})}parseAiResponse(e,t){let n=this.prompts[e];if(!n)throw Error(`Expected this.prompts[${e}] to be defined`);let r=n.extractFromTag&&(b(n.extractFromTag).exec(t)||[])[1]||t;return(0,m.decodeCodec)(n.outputCodec,S(r),!1)}async reportAndParsePromptRun(e,{largeLanguageModel:t,...r}){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let i=r.name||`@transcend-io/cli-prompt-run-${new Date().toISOString()}`;if(!this.promptContentMap)throw Error(`Expected this.promptContentMap to be defined`);let a=this.promptContentMap[e];if(!a)throw Error(`Expected this.prompts[${e}] to be defined`);if(r.promptRunMessages.length===0)throw Error(`promptRunMessages is expected to have length > 0`);if(r.promptRunMessages[0].role!==p.ChatCompletionRole.System)throw Error(`promptRunMessages[0].role is expected to be = ${p.ChatCompletionRole.System}`);if(r.promptRunMessages[r.promptRunMessages.length-1].role!==p.ChatCompletionRole.Assistant)throw Error(`promptRunMessages[${r.promptRunMessages.length-1}].role is expected to be = ${p.ChatCompletionRole.Assistant}`);let o=r.promptRunMessages[r.promptRunMessages.length-1].content,s;try{s=this.parseAiResponse(e,o)}catch(e){throw await n.hn(this.graphQLClient,{productArea:p.PromptRunProductArea.PromptManager,...r,name:i,error:e.message,status:p.QueueStatus.Error,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:a.id,promptRunMessages:r.promptRunMessages.map((e,t)=>({...e,...t===0?{template:a.content}:{}}))}),e}let c=await n.hn(this.graphQLClient,{productArea:p.PromptRunProductArea.PromptManager,...r,name:i,status:p.QueueStatus.Resolved,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:a.id,promptRunMessages:r.promptRunMessages.map((e,t)=>({...e,...t===0?{template:a.content}:{}}))});return{result:s,promptRunId:c,promptRunUrl:`https://app.transcend.io/prompts/runs/${c}`}}async reportPromptRunError(e,{largeLanguageModel:t,...r}){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let i=r.name||`@transcend-io/cli-prompt-run-${new Date().toISOString()}`;if(!this.promptContentMap)throw Error(`Expected this.promptContentMap to be defined`);let a=this.promptContentMap[e];if(!a)throw Error(`Expected this.prompts[${e}] to be defined`);if(r.promptRunMessages.length===0)throw Error(`promptRunMessages is expected to have length > 0`);if(r.promptRunMessages[0].role!==p.ChatCompletionRole.System)throw Error(`promptRunMessages[0].role is expected to be = ${p.ChatCompletionRole.System}`);let o=await n.hn(this.graphQLClient,{productArea:p.PromptRunProductArea.PromptManager,...r,name:i,status:p.QueueStatus.Error,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:a.id,promptRunMessages:r.promptRunMessages.map((e,t)=>({...e,...t===0?{template:a.content}:{}}))});return{promptRunId:o,promptRunUrl:`https://app.transcend.io/prompts/runs/${o}`}}};function w(e){return e.replace(/(https?:\/\/[^\s]+)/g,`<link-omitted>`)}function T(e){return Object.entries(e).reduce((e,[t,n])=>n!=null&&n!==``&&!(Array.isArray(n)&&n.length===0)&&!(typeof n==`object`&&Object.keys(n).length===0)?Object.assign(e,{[t]:n}):e,{})}function E({baseBranch:e,rootDirectory:t,githubRepo:r,excludedGlob:i=[],fileBlockList:a=[]}){(0,_.execSync)(`git fetch origin ${e}`);let o=(0,_.execSync)(`git ls-remote ${r} "refs/heads/${e}" | cut -f 1`,{encoding:`utf-8`}).split(`
2
2
  `)[0],s=(0,_.execSync)(`git rev-parse HEAD`,{encoding:`utf-8`}).split(`
3
3
  `)[0];if(!o||!s)throw Error(`FAILED TO FIND COMMIT RANGE`);let c=n.js((0,_.execSync)(`git fetch && git diff --name-only "${e||o}...${s}" -- ${t}`,{encoding:`utf-8`}).split(`
4
4
  `).filter(e=>e),a),l=i.length>0?g.default.sync(c,{ignore:i}):c,u={};return l.forEach(e=>{u[e]=(0,_.execSync)(`git show ${s}:${e}`,{encoding:`utf-8`})}),{changedFiles:c,fileDiffs:u,repoName:r.split(`/`).pop().split(`.`)[0],commit:s}}exports.ACTIONS=n.ra,exports.ADD_MESSAGES_TO_PROMPT_RUN=n.Ga,exports.ADD_SILO_DISCOVERY_RESULTS=n.Wo,exports.ADMIN_DASH=t.t,exports.ADMIN_DASH_DATAPOINTS=t.n,exports.ADMIN_DASH_INTEGRATIONS=t.r,exports.AGENTS=n.Ui,exports.AGENT_FILES=n.Bi,exports.AGENT_FUNCTIONS=n.Li,exports.API_KEYS=n.qo,exports.APPROVE_PRIVACY_REQUEST=n.Eo,exports.ASSESSMENTS=n.vo,exports.ASSESSMENT_SECTION_FIELDS=n.yo,exports.ASSESSMENT_TEMPLATES=n.ho,exports.ASSUME_ROLE=n.qi,exports.ATTRIBUTES=n.Pa,exports.ATTRIBUTE_KEYS_REQUESTS=n.Bo,exports.ATTRIBUTE_VALUES=n.Fa,exports.ActionInput=i.t,exports.ActionItemCollectionInput=i.n,exports.ActionItemInput=i.r,exports.AgentFileInput=i.i,exports.AgentFunctionInput=i.a,exports.AgentInput=i.o,exports.ApiKeyInput=i.s,exports.AssessmentAction=n.Nn,exports.AssessmentAnswerOptionInput=i.c,exports.AssessmentDisplayLogicInput=i.l,exports.AssessmentInput=i.u,exports.AssessmentNestedRule=n.Pn,exports.AssessmentNestedRuleInput=i.d,exports.AssessmentResourceInput=i.f,exports.AssessmentRetentionScheduleInput=i.p,exports.AssessmentRiskLogic=n.jn,exports.AssessmentRule=n.Fn,exports.AssessmentRuleInput=i.m,exports.AssessmentRuleWithOperands=n.In,exports.AssessmentRuleWithoutOperands=n.Ln,exports.AssessmentSectionInput=i.h,exports.AssessmentSectionQuestionInput=i.g,exports.AssessmentTemplateInput=i._,exports.AttestedExtraIdentifiers=n.rt,exports.AttributeInput=i.v,exports.AttributePreview=i.y,exports.AttributeValueInput=i.b,exports.BLANK=n.pi,exports.BULK_APPLY=n.mi,exports.BULK_REQUEST_FILES=n.qa,exports.BUSINESS_ENTITIES=n.aa,exports.BusinessEntityInput=i.x,exports.CANCEL_PRIVACY_REQUEST=n.Do,exports.CAN_APPLY_IN_BULK=n.hi,exports.CATALOGS=n.ss,exports.CHANGE_REQUEST_DATA_SILO_STATUS=n.to,exports.CODE_PACKAGES=n.Po,exports.CONSENT_MANAGER_ANALYTICS_DATA=n.ca,exports.CONSENT_PARTITIONS=n.la,exports.COOKIES=n.ua,exports.CREATE_ACTION_ITEMS=n.ea,exports.CREATE_ACTION_ITEM_COLLECTION=n.Ha,exports.CREATE_AGENT=n.Wi,exports.CREATE_AGENT_FILE=n.Vi,exports.CREATE_AGENT_FUNCTION=n.Ri,exports.CREATE_API_KEY=n.Jo,exports.CREATE_ATTRIBUTE=n.Ia,exports.CREATE_ATTRIBUTE_VALUES=n.La,exports.CREATE_BUSINESS_ENTITY=n.oa,exports.CREATE_CODE_PACKAGE=n.Fo,exports.CREATE_CONSENT_EXPERIENCE=n.da,exports.CREATE_CONSENT_MANAGER=n.fa,exports.CREATE_CONSENT_PARTITION=n.pa,exports.CREATE_DATA_FLOWS=n.ma,exports.CREATE_DATA_SILOS=n.fs,exports.CREATE_DATA_SUBJECT=n.$o,exports.CREATE_DATA_SUB_CATEGORY=n.ji,exports.CREATE_ENRICHER=n.cs,exports.CREATE_IDENTIFIER=n.rs,exports.CREATE_PREFERENCE_ACCESS_TOKENS=n.Ko,exports.CREATE_PROCESSING_ACTIVITY=n.Ti,exports.CREATE_PROCESSING_PURPOSE_SUB_CATEGORY=n.Oi,exports.CREATE_PROMPT=n.ao,exports.CREATE_PROMPT_GROUP=n.oo,exports.CREATE_PROMPT_PARTIAL=n.so,exports.CREATE_REPOSITORY=n.Xo,exports.CREATE_SOFTWARE_DEVELOPMENT_KIT=n.Lo,exports.CREATE_TEAM=n.Qa,exports.CREATE_TEMPLATE=n.Ho,exports.CREATE_VENDOR=n.Pi,exports.CachedFileState=n.gi,exports.CachedRequestState=n._i,exports.CodePackageInput=i.S,exports.CodePackageSdk=i.C,exports.ColumnName=n.vi,exports.ConsentManageExperienceInput=i.w,exports.ConsentManagerInput=i.T,exports.ConsentManagerMetricBin=n.jr,exports.ConsentManagerServiceMetadata=i.E,exports.ConsentPreferenceTopic=i.D,exports.ConsentPreferenceTopicOptionValue=i.O,exports.ConsentPurpose=i.k,exports.CookieCsvInput=i.A,exports.CookieInput=i.j,exports.CronIdentifier=l.o,exports.CronIdentifierPush=l.i,exports.DATAPOINT_EXPORT=n.vs,exports.DATA_FLOWS=n.ha,exports.DATA_POINTS=n.ys,exports.DATA_POINT_COUNT=n.bs,exports.DATA_SILOS=n.ps,exports.DATA_SILOS_ENRICHED=n.ms,exports.DATA_SILO_EXPORT=n.hs,exports.DATA_SUBJECTS=n.es,exports.DATA_SUB_CATEGORIES=n.Mi,exports.DAY_MS=n.f,exports.DEBUG=t.i,exports.DEFAULT_TRANSCEND_API=t.a,exports.DEFAULT_TRANSCEND_CONSENT_API=t.o,exports.DEFAULT_TRANSCEND_PULL_RESOURCES=n.gn,exports.DELETE_API_KEY=n.Yo,exports.DELETE_ATTRIBUTE_VALUE=n.Ra,exports.DEPLOYED_PRIVACY_CENTER_URL=n.Xi,exports.DEPLOY_CONSENT_MANAGER=n.ga,exports.DETERMINE_LOGIN_METHOD=n.Ji,exports.DataCategoryGuessInput=i.M,exports.DataCategoryInput=i.N,exports.DataCategoryPreviewInput=i.P,exports.DataCategoryRecommendationInput=i.F,exports.DataFlowCsvInput=i.I,exports.DataFlowInput=i.L,exports.DataSiloInput=i.R,exports.DataSubjectInput=i.z,exports.DatapointInput=i.B,exports.ENABLED_PLUGINS=n.Go,exports.ENRICHERS=n.ls,exports.ENTRY_COUNT=n._s,exports.EXPERIENCES=n._a,exports.EnrichPrivacyRequest=f.n,exports.EnricherInput=i.V,exports.FETCH_CONSENT_MANAGER=n.va,exports.FETCH_CONSENT_MANAGER_ID=n.ya,exports.FETCH_CONSENT_MANAGER_THEME=n.ba,exports.FETCH_PRIVACY_CENTER_ID=n.Zi,exports.FIVE_MIN_MS=n.p,exports.FieldInput=i.H,exports.GLOBAL_ACTION_ITEMS=n.ta,exports.GLOBAL_ACTION_ITEM_COLLECTIONS=n.Ua,exports.HOUR_MS=n.m,exports.IDENTIFIERS=n.is,exports.IDENTIFIER_BLOCK_LIST=n.yi,exports.IMPORT_ONE_TRUST_ASSESSMENT_FORMS=n.bo,exports.INITIALIZER=n.us,exports.IP_ADDRESS_REGEX=s.n,exports.IS_REQUIRED=n.bi,exports.IdentifierInput=i.U,exports.ImportOnetrustAssessmentsInput=i.W,exports.IntlMessage=n.$,exports.IntlMessageInput=i.G,exports.LARGE_LANGUAGE_MODELS=n.Ki,exports.LOGIN=n.Yi,exports.MESSAGES=n.wo,exports.NEW_IDENTIFIER_TYPES=n.as,exports.NONE=n.xi,exports.NOTIFY_ADDITIONAL_TIME=n.Oo,exports.ORGANIZATION=n.Vo,exports.OneTrustFileFormat=e.t,exports.OneTrustPullResource=e.n,exports.OneTrustPullSource=e.r,exports.OpenAIEnabledRoute=i.K,exports.OpenAIEnabledRoutes=i.q,exports.OpenAIIntegration=i.J,exports.OpenAIRouteName=e.i,exports.POLICIES=n.jo,exports.PREFERENCE_TOPICS=n.go,exports.PRIVACY_CENTER=n.Qi,exports.PROCESSING_ACTIVITIES=n.Ei,exports.PROCESSING_PURPOSE_SUB_CATEGORIES=n.ki,exports.PROMPTS=n.co,exports.PROMPTS_WITH_VARIABLES=n.lo,exports.PROMPT_GROUPS=n.uo,exports.PROMPT_PARTIALS=n.do,exports.PROMPT_THREADS=n.No,exports.PURPOSES=n._o,exports.ParsedAttributeInput=n.si,exports.PartitionInput=i.Y,exports.PathfinderPolicy=i.X,exports.PathfinderPolicyName=e.a,exports.PathfinderPolicyNameC=i.Z,exports.PathfinderPromptRunMetadata=i.Q,exports.PolicyInput=i.$,exports.PrivacyCenterInput=i.et,exports.PrivacyRequest=n.ur,exports.PrivacyRequestInput=n.it,exports.PrivacyRequestResponse=n.Y,exports.ProcessingActivityInput=i.tt,exports.ProcessingPurposeInput=i.nt,exports.ProcessingPurposePreviewInput=i.rt,exports.PromptAVendorEmailSettings=i.it,exports.PromptGroupInput=i.at,exports.PromptInput=i.ot,exports.PromptPartialInput=i.st,exports.PurposeMap=c.t,exports.REDUCED_REQUESTS_FOR_DATA_SILO_COUNT=n.no,exports.REMOVE_REQUEST_IDENTIFIERS=n.Xa,exports.REPORT_PROMPT_RUN=n.Ka,exports.REPOSITORIES=n.Zo,exports.REQUESTS=n.ko,exports.REQUEST_DATA_SILOS=n.ro,exports.REQUEST_ENRICHERS=n.xo,exports.REQUEST_FILES=n.Ja,exports.REQUEST_IDENTIFIERS=n.Za,exports.RETRYABLE_BATCH_STATUSES=t.s,exports.RETRY_REQUEST_DATA_SILO=n.io,exports.RETRY_REQUEST_ENRICHER=n.So,exports.RateCounter=n.C,exports.RegionInput=i.ct,exports.RepositoryInput=i.lt,exports.RequestFileMetadata=n.et,exports.RequestFileMetadataResponse=n.tt,exports.RequestIdentifiersResponse=n.pr,exports.RequestPurposeTrigger=n.dr,exports.RiskAssignmentInput=i.ut,exports.RiskLogicInput=i.dt,exports.SCOPES_BY_TITLE=t.c,exports.SCOPE_TITLES=t.l,exports.SET_RESOURCE_ATTRIBUTES=n.za,exports.SILO_DISCOVERY_RESULTS=n.Ci,exports.SKIP_REQUEST_ENRICHER=n.Co,exports.SOFTWARE_DEVELOPMENT_KITS=n.Ro,exports.SOMBRA_VERSION=n.wi,exports.SUB_DATA_POINTS=n.xs,exports.SUB_DATA_POINTS_COUNT=n.Ss,exports.SUB_DATA_POINTS_WITH_GUESSES=n.Cs,exports.SYNC_ATTRIBUTE_TYPES=n.Rr,exports.SiloDiscoveryResultInput=i.ft,exports.SoftwareDevelopmentKitInput=i.pt,exports.StoredApiKey=i.mt,exports.SuccessfulRequest=n.Si,exports.TEAMS=n.$a,exports.TEMPLATES=n.Uo,exports.TOGGLE_CONSENT_PRECEDENCE=n.xa,exports.TOGGLE_DATA_SUBJECT=n.ts,exports.TOGGLE_TELEMETRY_PARTITION_STRATEGY=n.Sa,exports.TOGGLE_UNKNOWN_COOKIE_POLICY=n.Ca,exports.TOGGLE_UNKNOWN_REQUEST_POLICY=n.wa,exports.TR_PULL_RESOURCE_SCOPE_MAP=t.u,exports.TR_PUSH_RESOURCE_SCOPE_MAP=t.d,exports.TR_YML_RESOURCE_TO_FIELD_NAME=t.f,exports.TeamInput=i.ht,exports.TemplateInput=i.gt,exports.TranscendInput=i._t,exports.TranscendPromptManager=C,exports.TranscendPullResource=e.o,exports.UPDATE_ACTION=n.ia,exports.UPDATE_ACTION_ITEMS=n.na,exports.UPDATE_ACTION_ITEM_COLLECTION=n.Wa,exports.UPDATE_AGENTS=n.Gi,exports.UPDATE_AGENT_FILES=n.Hi,exports.UPDATE_AGENT_FUNCTIONS=n.zi,exports.UPDATE_ATTRIBUTE=n.Ba,exports.UPDATE_ATTRIBUTE_VALUES=n.Va,exports.UPDATE_BUSINESS_ENTITIES=n.sa,exports.UPDATE_CODE_PACKAGES=n.Io,exports.UPDATE_CONSENT_EXPERIENCE=n.Ta,exports.UPDATE_CONSENT_MANAGER_DOMAINS=n.Ea,exports.UPDATE_CONSENT_MANAGER_PARTITION=n.Da,exports.UPDATE_CONSENT_MANAGER_THEME=n.Oa,exports.UPDATE_CONSENT_MANAGER_TO_LATEST=n.ka,exports.UPDATE_CONSENT_MANAGER_VERSION=n.Aa,exports.UPDATE_DATA_FLOWS=n.ja,exports.UPDATE_DATA_SILOS=n.gs,exports.UPDATE_DATA_SUBJECT=n.ns,exports.UPDATE_DATA_SUB_CATEGORIES=n.Ni,exports.UPDATE_ENRICHER=n.ds,exports.UPDATE_IDENTIFIER=n.os,exports.UPDATE_INTL_MESSAGES=n.To,exports.UPDATE_LOAD_OPTIONS=n.Ma,exports.UPDATE_OR_CREATE_COOKIES=n.Na,exports.UPDATE_OR_CREATE_DATA_POINT=n.ws,exports.UPDATE_POLICIES=n.Mo,exports.UPDATE_PRIVACY_CENTER=n.$i,exports.UPDATE_PRIVACY_REQUEST=n.Ao,exports.UPDATE_PROCESSING_ACTIVITIES=n.Di,exports.UPDATE_PROCESSING_PURPOSE_SUB_CATEGORIES=n.Ai,exports.UPDATE_PROMPTS=n.fo,exports.UPDATE_PROMPT_GROUPS=n.po,exports.UPDATE_PROMPT_PARTIALS=n.mo,exports.UPDATE_REPOSITORIES=n.Qo,exports.UPDATE_SOFTWARE_DEVELOPMENT_KITS=n.zo,exports.UPDATE_TEAM=n.eo,exports.UPDATE_VENDORS=n.Fi,exports.USERS=n.Ya,exports.USP_STRING_REGEX=c.n,exports.VARIABLE_PARAMETERS_NAME=a.t,exports.VARIABLE_PARAMETERS_REGEXP=a.n,exports.VENDORS=n.Ii,exports.VendorInput=i.vt,exports.WebhookHeader=i.yt,exports.addDaysUtc=n.h,exports.addMessagesToPromptRun=n.ri,exports.addMs=n.g,exports.appendCsvRowsOrdered=n.a,exports.appendCsvSync=n.o,exports.approvePrivacyRequests=n.J,exports.assumeRole=n.Vn,exports.buildAIIntegrationType=r.t,exports.buildEnabledRouteType=r.n,exports.buildTranscendGraphQLClient=n.ti,exports.buildTranscendGraphQLClientGeneric=n.ni,exports.buildXdiSyncEndpoint=s.r,exports.bulkRestartRequests=n.B,exports.bulkRetryEnrichers=n.R,exports.cancelPrivacyRequests=n.G,exports.clampPageSize=n._,exports.collectParquetFilesOrExit=n.x,exports.consentManagersToBusinessEntities=s.t,exports.convertToDataSubjectAllowlist=n.$n,exports.convertToDataSubjectBlockList=n.er,exports.createActionItemCollection=n.ln,exports.createActionItems=n.on,exports.createAgent=n.Zt,exports.createAgentFile=n.rn,exports.createAgentFunction=n.en,exports.createApiKey=n.zn,exports.createBusinessEntity=n.qt,exports.createCodePackage=n.Rt,exports.createConsentToken=c.i,exports.createDataCategory=n.jt,exports.createDataFlows=n.Ot,exports.createPreferenceAccessTokens=n.Hr,exports.createProcessingPurpose=n._t,exports.createPrompt=n.mt,exports.createRegexForTag=b,exports.createRepository=n.Vt,exports.createSoftwareDevelopmentKit=n.Wt,exports.createSombraGotInstance=n.ei,exports.createTranscendConsentGotInstance=n.$r,exports.createVendor=n.dt,exports.defineTranscendPrompts=x,exports.deleteApiKey=n.Bn,exports.deployConsentManager=n.Zr,Object.defineProperty(exports,`description`,{enumerable:!0,get:function(){return t.m}}),exports.domainToHost=s.i,exports.downloadPrivacyRequestFiles=n.Z,exports.enrichPrivacyRequest=f.r,exports.ensureAllDataSubjectsExist=n.tr,exports.extractClientError=n.U,exports.extractErrorMessage=n.O,exports.fetchActiveSiloDiscoPlugin=n.Xr,exports.fetchAllActionItems=n.Yr,exports.fetchAllActions=n.Jr,exports.fetchAllAgentFiles=n.qr,exports.fetchAllAgentFunctions=n.Kr,exports.fetchAllAgents=n.Gr,exports.fetchAllApiKeys=n.ar,exports.fetchAllAssessmentTemplates=n.Ur,exports.fetchAllAssessments=n.Wr,exports.fetchAllAttributeValues=n.zr,exports.fetchAllAttributes=n.Br,exports.fetchAllBusinessEntities=n.Lr,exports.fetchAllCatalogs=n.rr,exports.fetchAllCookies=n.Ar,exports.fetchAllDataCategories=n.kr,exports.fetchAllDataFlows=n.Or,exports.fetchAllDataPoints=n.Tn,exports.fetchAllDataSilos=n.En,exports.fetchAllDataSubjects=n.nr,exports.fetchAllEnrichers=n.Cn,exports.fetchAllIdentifiers=n.n,exports.fetchAllMessages=n.Dr,exports.fetchAllPolicies=n.wr,exports.fetchAllPreferenceTopics=n.Sr,exports.fetchAllPrivacyCenters=n.xr,exports.fetchAllProcessingActivities=n.br,exports.fetchAllProcessingPurposes=n.yr,exports.fetchAllPromptGroups=n.Qn,exports.fetchAllPromptPartials=n.Zn,exports.fetchAllPromptThreads=n.Jn,exports.fetchAllPrompts=n.Yn,exports.fetchAllPurposes=n.vr,exports.fetchAllPurposesAndPreferences=n._r,exports.fetchAllRequestAttributeKeys=n.Vr,exports.fetchAllRequestEnrichers=n.gr,exports.fetchAllRequestIdentifierMetadata=n.hr,exports.fetchAllRequestIdentifiers=n.mr,exports.fetchAllRequests=n.fr,exports.fetchAllSiloDiscoveryResults=n.vn,exports.fetchAllSubDataPoints=n.Dn,exports.fetchAllTeams=n.lr,exports.fetchAllTemplates=n.xn,exports.fetchAllUsers=n.cr,exports.fetchAllVendors=n.sr,exports.fetchAndIndexCatalogs=n.ir,exports.fetchApiKeys=n.or,exports.fetchConsentManager=n.Mr,exports.fetchConsentManagerAnalyticsData=n.Nr,exports.fetchConsentManagerExperiences=n.Pr,exports.fetchConsentManagerId=n.Fr,exports.fetchConsentManagerTheme=n.Ir,exports.fetchEnrichedDataSilos=n.On,exports.fetchIdentifiersAndCreateMissing=n.r,exports.fetchPartitions=n.yn,exports.fetchPrivacyCenterId=n.Tr,exports.fetchPrivacyCenterUrl=n.Er,exports.fetchPromptsWithVariables=n.Xn,exports.fetchRequestDataSilo=n.Gn,exports.fetchRequestDataSiloActiveCount=n.Wn,exports.fetchRequestDataSilos=n.Kn,exports.fetchRequestDataSilosCount=n.qn,exports.fetchRequestFilesForRequest=n.Un,exports.filterNullishValuesFromObject=T,exports.filterRows=n.ii,exports.formatAttributeValues=n.Cr,exports.fuzzyMatchColumns=n.di,exports.fuzzySearch=n.fi,exports.generateCrossAccountApiKeys=u.i,exports.getErrorStatus=n.k,exports.getFileMetadataForPrivacyRequests=n.nt,exports.getGitFilesThatChanged=E,exports.getUniqueValuesForColumn=n.ai,exports.initCsvFile=n.s,exports.inquirerAutoComplete=n.j,exports.inquirerConfirmBoolean=n.M,exports.inquirerConfirmText=n.N,exports.limitRecords=n.w,exports.listDirectories=u.t,exports.listFiles=u.n,exports.loginUser=n.Hn,exports.makeGraphQLRequest=n.i,exports.mapColumnsToAttributes=n.W,exports.mapColumnsToIdentifiers=n.K,exports.mapCsvColumnsToApi=n.ct,exports.mapCsvRowsToRequestInputs=n.at,exports.mapEnumValues=n.ui,exports.mapRequestEnumValues=n.st,exports.markCronIdentifierCompleted=l.a,exports.markRequestDataSiloIdsCompleted=l.n,exports.markSilentPrivacyRequests=n.lt,exports.mergeTranscendInputs=o.t,exports.name=t.p,exports.normalizeIdentifierValue=n.ot,exports.notifyPrivacyRequestsAdditionalTime=n.q,exports.parquetToCsvOneFile=n.b,exports.parseAssessmentDisplayLogic=n.Rn,exports.parseAssessmentRiskLogic=n.Mn,exports.parseAttributesFromString=n.ci,exports.parseFilePath=n.c,exports.parseVariablesFromString=n.A,exports.pullAllDatapoints=d.n,exports.pullChunkedCustomSiloOutstandingIdentifiers=l.t,exports.pullConsentManagerMetrics=s.a,exports.pullCronPageOfIdentifiers=l.s,exports.pullManualEnrichmentIdentifiersToCsv=f.i,exports.pullPrivacyRequests=n.I,exports.pullTranscendConfiguration=n._n,exports.pullUnstructuredSubDataPointRecommendations=d.t,exports.pushCronIdentifiersFromCsv=l.r,exports.pushManualEnrichmentIdentifiersFromCsv=f.t,exports.readCsv=n.oi,exports.readSafe=n.S,exports.readTranscendYaml=a.r,exports.removeLinks=w,exports.removeUnverifiedRequestIdentifiers=n.P,exports.replaceVariablesInYaml=a.i,exports.reportPromptRun=n.hn,exports.restartPrivacyRequest=n.V,exports.retryRequestDataSilos=n.L,exports.retryRequestEnricher=n.mn,exports.retrySamePromise=n.T,exports.setResourceAttributes=n.pn,exports.skipPreflightJobs=n.z,exports.skipRequestDataSilos=n.F,exports.sleepPromise=n.D,exports.splitCsvToList=n.li,exports.splitInHalf=n.E,exports.startOfHour=n.v,exports.startOfUtcDay=n.y,exports.streamPrivacyRequestFiles=n.Q,exports.submitPrivacyRequest=n.X,exports.syncAction=n.fn,exports.syncActionItemCollections=n.un,exports.syncActionItems=n.sn,exports.syncAgentFiles=n.in,exports.syncAgentFunctions=n.tn,exports.syncAgents=n.Qt,exports.syncAttribute=n.Xt,exports.syncBusinessEntities=n.Jt,exports.syncCodePackages=n.zt,exports.syncConfigurationToTranscend=n.t,exports.syncConsentManager=n.It,exports.syncConsentManagerExperiences=n.Lt,exports.syncCookies=n.Pt,exports.syncDataCategories=n.Mt,exports.syncDataFlows=n.kt,exports.syncDataSiloDependencies=n.kn,exports.syncDataSilos=n.An,exports.syncDataSubject=n.Dt,exports.syncEnricher=n.wn,exports.syncIdentifier=n.Et,exports.syncIntlMessages=n.wt,exports.syncPartitions=n.bn,exports.syncPolicies=n.St,exports.syncPrivacyCenter=n.xt,exports.syncProcessingActivities=n.bt,exports.syncProcessingPurposes=n.vt,exports.syncPrompts=n.ht,exports.syncRepositories=n.Ht,exports.syncSoftwareDevelopmentKits=n.Gt,exports.syncTemplate=n.Sn,exports.syncVendors=n.ft,exports.updateActionItem=n.cn,exports.updateActionItemCollection=n.dn,exports.updateAgentFiles=n.an,exports.updateAgentFunctions=n.nn,exports.updateAgents=n.$t,exports.updateBusinessEntities=n.Yt,exports.updateCodePackages=n.Bt,exports.updateConsentManagerToLatest=n.Qr,exports.updateConsentManagerVersionToLatest=s.c,exports.updateDataCategories=n.Nt,exports.updateDataFlows=n.At,exports.updateIntlMessages=n.Tt,exports.updateOrCreateCookies=n.Ft,exports.updatePolicies=n.Ct,exports.updateProcessingPurposes=n.yt,exports.updatePrompts=n.gt,exports.updateRepositories=n.Ut,exports.updateSoftwareDevelopmentKits=n.Kt,exports.updateVendors=n.pt,exports.uploadConsents=c.r,exports.uploadCookiesFromCsv=s.o,exports.uploadDataFlowsFromCsv=s.s,exports.uploadPrivacyRequestsFromCsv=n.H,exports.uploadSiloDiscoveryResults=n.ut,exports.validateTranscendAuth=u.r,Object.defineProperty(exports,`version`,{enumerable:!0,get:function(){return t.h}}),exports.writeCsv=n.l,exports.writeCsvSync=n.u,exports.writeLargeCsv=n.d,exports.writeTranscendYaml=a.a;