@transcend-io/cli 9.0.0 → 9.0.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.
- package/dist/{api-keys-C7JLTDUZ.mjs → api-keys-CxvKdj2v.mjs} +2 -2
- package/dist/{api-keys-C7JLTDUZ.mjs.map → api-keys-CxvKdj2v.mjs.map} +1 -1
- package/dist/{app-Dti3qTxV.mjs → app-BKMxG7RO.mjs} +18 -18
- package/dist/{app-Dti3qTxV.mjs.map → app-BKMxG7RO.mjs.map} +1 -1
- package/dist/bin/bash-complete.mjs +1 -1
- package/dist/bin/cli.mjs +1 -1
- package/dist/bin/deprecated-command.mjs +1 -1
- package/dist/{code-scanning-3tLsE1W5.mjs → code-scanning-Cx1kpssH.mjs} +2 -2
- package/dist/{code-scanning-3tLsE1W5.mjs.map → code-scanning-Cx1kpssH.mjs.map} +1 -1
- package/dist/{command-BlHM1nCd.mjs → command-Bzyj3M2G.mjs} +2 -2
- package/dist/{command-BlHM1nCd.mjs.map → command-Bzyj3M2G.mjs.map} +1 -1
- package/dist/{consent-manager-BoaaMjRQ.mjs → consent-manager-c4bgQF1N.mjs} +2 -2
- package/dist/{consent-manager-BoaaMjRQ.mjs.map → consent-manager-c4bgQF1N.mjs.map} +1 -1
- package/dist/{constants-DdeeX81W.mjs → constants-CnLQtIBn.mjs} +2 -2
- package/dist/{constants-DdeeX81W.mjs.map → constants-CnLQtIBn.mjs.map} +1 -1
- package/dist/{cron-DOicA1l8.mjs → cron-BvxWyvDu.mjs} +2 -2
- package/dist/{cron-DOicA1l8.mjs.map → cron-BvxWyvDu.mjs.map} +1 -1
- package/dist/{data-inventory-OeEcogPl.mjs → data-inventory-CkS_kmus.mjs} +2 -2
- package/dist/{data-inventory-OeEcogPl.mjs.map → data-inventory-CkS_kmus.mjs.map} +1 -1
- package/dist/{impl-fESuqAH1.mjs → impl-8dOatHnF.mjs} +2 -2
- package/dist/{impl-fESuqAH1.mjs.map → impl-8dOatHnF.mjs.map} +1 -1
- package/dist/{impl-DzSmriDw.mjs → impl-Ah-1lwzr.mjs} +2 -2
- package/dist/{impl-DzSmriDw.mjs.map → impl-Ah-1lwzr.mjs.map} +1 -1
- package/dist/{impl-BI4zCNs0.mjs → impl-B5lTeRbn.mjs} +2 -2
- package/dist/{impl-BI4zCNs0.mjs.map → impl-B5lTeRbn.mjs.map} +1 -1
- package/dist/{impl-D2HalFgB2.mjs → impl-B6UhzQcY2.mjs} +2 -2
- package/dist/{impl-D2HalFgB2.mjs.map → impl-B6UhzQcY2.mjs.map} +1 -1
- package/dist/{impl-BvZai1Pf2.mjs → impl-BFf_CotE2.mjs} +2 -2
- package/dist/{impl-BvZai1Pf2.mjs.map → impl-BFf_CotE2.mjs.map} +1 -1
- package/dist/{impl-iwjvzA7a.mjs → impl-BGQ0EGS0.mjs} +2 -2
- package/dist/{impl-iwjvzA7a.mjs.map → impl-BGQ0EGS0.mjs.map} +1 -1
- package/dist/{impl-B8CoAX4t.mjs → impl-B__p3_wC.mjs} +2 -2
- package/dist/{impl-B8CoAX4t.mjs.map → impl-B__p3_wC.mjs.map} +1 -1
- package/dist/{impl-CaTnsoDi.mjs → impl-BcayRe6a.mjs} +2 -2
- package/dist/{impl-CaTnsoDi.mjs.map → impl-BcayRe6a.mjs.map} +1 -1
- package/dist/{impl-CTPHR7O62.mjs → impl-BkYKsEVG2.mjs} +2 -2
- package/dist/{impl-CTPHR7O62.mjs.map → impl-BkYKsEVG2.mjs.map} +1 -1
- package/dist/{impl-gYrR3kIh.mjs → impl-Bl2yVgh0.mjs} +2 -2
- package/dist/{impl-gYrR3kIh.mjs.map → impl-Bl2yVgh0.mjs.map} +1 -1
- package/dist/{impl-CoZhgLjC.mjs → impl-BmAMgEEM.mjs} +2 -2
- package/dist/{impl-CoZhgLjC.mjs.map → impl-BmAMgEEM.mjs.map} +1 -1
- package/dist/{impl-Bh04BLeU2.mjs → impl-BsttzxTN2.mjs} +2 -2
- package/dist/{impl-Bh04BLeU2.mjs.map → impl-BsttzxTN2.mjs.map} +1 -1
- package/dist/{impl--Ov8Om49.mjs → impl-BtnySmbi.mjs} +2 -2
- package/dist/{impl--Ov8Om49.mjs.map → impl-BtnySmbi.mjs.map} +1 -1
- package/dist/{impl-BraVBCrF2.mjs → impl-BwX-evfW2.mjs} +2 -2
- package/dist/{impl-BraVBCrF2.mjs.map → impl-BwX-evfW2.mjs.map} +1 -1
- package/dist/impl-C-wzeAib2.mjs +2 -0
- package/dist/{impl-BEzyqD_12.mjs.map → impl-C-wzeAib2.mjs.map} +1 -1
- package/dist/{impl-B40z0Aoz2.mjs → impl-C61PYfk12.mjs} +2 -2
- package/dist/{impl-B40z0Aoz2.mjs.map → impl-C61PYfk12.mjs.map} +1 -1
- package/dist/impl-CAuNpuF2.mjs +2 -0
- package/dist/impl-CAuNpuF2.mjs.map +1 -0
- package/dist/{impl-CvxsioT4.mjs → impl-CSKrBIuV.mjs} +2 -2
- package/dist/{impl-CvxsioT4.mjs.map → impl-CSKrBIuV.mjs.map} +1 -1
- package/dist/{impl-CIJ6P1GD.mjs → impl-CZP2l3Ds.mjs} +2 -2
- package/dist/{impl-CIJ6P1GD.mjs.map → impl-CZP2l3Ds.mjs.map} +1 -1
- package/dist/{impl-J-dQqTZJ2.mjs → impl-CiJ8hE5W2.mjs} +2 -2
- package/dist/{impl-J-dQqTZJ2.mjs.map → impl-CiJ8hE5W2.mjs.map} +1 -1
- package/dist/{impl-DP757pBT.mjs → impl-Cj3H-m2Z.mjs} +2 -2
- package/dist/{impl-DP757pBT.mjs.map → impl-Cj3H-m2Z.mjs.map} +1 -1
- package/dist/{impl-qiK6VF4F2.mjs → impl-Cm8pUfBU2.mjs} +2 -2
- package/dist/{impl-qiK6VF4F2.mjs.map → impl-Cm8pUfBU2.mjs.map} +1 -1
- package/dist/{impl-CNiEzL3_2.mjs → impl-CpzS9LVu2.mjs} +2 -2
- package/dist/{impl-CNiEzL3_2.mjs.map → impl-CpzS9LVu2.mjs.map} +1 -1
- package/dist/{impl-BpMKYqSR.mjs → impl-CwfamZ1c.mjs} +2 -2
- package/dist/{impl-BpMKYqSR.mjs.map → impl-CwfamZ1c.mjs.map} +1 -1
- package/dist/{impl-BDKBhSiG2.mjs → impl-D81et1Yb2.mjs} +2 -2
- package/dist/{impl-BDKBhSiG2.mjs.map → impl-D81et1Yb2.mjs.map} +1 -1
- package/dist/{impl-DgsWGnhH.mjs → impl-D92PTNk3.mjs} +2 -2
- package/dist/{impl-DgsWGnhH.mjs.map → impl-D92PTNk3.mjs.map} +1 -1
- package/dist/{impl-DVDN007x.mjs → impl-DTXDVeo6.mjs} +2 -2
- package/dist/{impl-DVDN007x.mjs.map → impl-DTXDVeo6.mjs.map} +1 -1
- package/dist/{impl-B0d5M861.mjs → impl-DWoysXup.mjs} +2 -2
- package/dist/{impl-B0d5M861.mjs.map → impl-DWoysXup.mjs.map} +1 -1
- package/dist/{impl-BhMd6_J22.mjs → impl-DX3JHZ4v2.mjs} +2 -2
- package/dist/{impl-BhMd6_J22.mjs.map → impl-DX3JHZ4v2.mjs.map} +1 -1
- package/dist/{impl-DfKI4fmI.mjs → impl-DhuUrzxQ.mjs} +2 -2
- package/dist/{impl-DfKI4fmI.mjs.map → impl-DhuUrzxQ.mjs.map} +1 -1
- package/dist/{impl-CiQeM677.mjs → impl-DqMYLKjU.mjs} +2 -2
- package/dist/{impl-CiQeM677.mjs.map → impl-DqMYLKjU.mjs.map} +1 -1
- package/dist/{impl-BiWrlucD.mjs → impl-DqQ6CIj0.mjs} +2 -2
- package/dist/{impl-BiWrlucD.mjs.map → impl-DqQ6CIj0.mjs.map} +1 -1
- package/dist/{impl-BJ9Ge6Wf2.mjs → impl-Duaq6iWI2.mjs} +2 -2
- package/dist/{impl-BJ9Ge6Wf2.mjs.map → impl-Duaq6iWI2.mjs.map} +1 -1
- package/dist/{impl-DOgLpdLw.mjs → impl-O5gz8qcm.mjs} +2 -2
- package/dist/{impl-DOgLpdLw.mjs.map → impl-O5gz8qcm.mjs.map} +1 -1
- package/dist/{impl-C73Uh2Ze.mjs → impl-PH0AoC7i.mjs} +2 -2
- package/dist/{impl-C73Uh2Ze.mjs.map → impl-PH0AoC7i.mjs.map} +1 -1
- package/dist/{impl-CU29SrJb2.mjs → impl-S8p6toVb2.mjs} +2 -2
- package/dist/{impl-CU29SrJb2.mjs.map → impl-S8p6toVb2.mjs.map} +1 -1
- package/dist/{impl-4BP7gY61.mjs → impl-X2MSb8Ij.mjs} +2 -2
- package/dist/{impl-4BP7gY61.mjs.map → impl-X2MSb8Ij.mjs.map} +1 -1
- package/dist/{impl-SxwaNC4m2.mjs → impl-bo95wZIU2.mjs} +2 -2
- package/dist/{impl-SxwaNC4m2.mjs.map → impl-bo95wZIU2.mjs.map} +1 -1
- package/dist/{impl-DFNq8PBe.mjs → impl-cfdCesro.mjs} +2 -2
- package/dist/{impl-DFNq8PBe.mjs.map → impl-cfdCesro.mjs.map} +1 -1
- package/dist/{impl-EhTHDCC1.mjs → impl-iZoXu4nV.mjs} +2 -2
- package/dist/{impl-EhTHDCC1.mjs.map → impl-iZoXu4nV.mjs.map} +1 -1
- package/dist/{impl-BPz3SpXo2.mjs → impl-lebl6Zek2.mjs} +2 -2
- package/dist/{impl-BPz3SpXo2.mjs.map → impl-lebl6Zek2.mjs.map} +1 -1
- package/dist/{impl-BvTvjK72.mjs → impl-p0YN9e2e.mjs} +2 -2
- package/dist/{impl-BvTvjK72.mjs.map → impl-p0YN9e2e.mjs.map} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{manual-enrichment-CYoZNBjO.mjs → manual-enrichment-B6lW5kAX.mjs} +2 -2
- package/dist/{manual-enrichment-CYoZNBjO.mjs.map → manual-enrichment-B6lW5kAX.mjs.map} +1 -1
- package/dist/{pooling-BkZAO1Zs.mjs → pooling-CazydwlD.mjs} +2 -2
- package/dist/{pooling-BkZAO1Zs.mjs.map → pooling-CazydwlD.mjs.map} +1 -1
- package/dist/{preference-management-BHj26bmE.mjs → preference-management-8gj7aSJB.mjs} +2 -2
- package/dist/{preference-management-BHj26bmE.mjs.map → preference-management-8gj7aSJB.mjs.map} +1 -1
- package/dist/{syncConfigurationToTranscend-wWSbGVrI.mjs → syncConfigurationToTranscend-VJd0PnaZ.mjs} +2 -2
- package/dist/{syncConfigurationToTranscend-wWSbGVrI.mjs.map → syncConfigurationToTranscend-VJd0PnaZ.mjs.map} +1 -1
- package/dist/{uploadConsents-nsjKy1I4.mjs → uploadConsents-C1S-BNzw.mjs} +2 -2
- package/dist/{uploadConsents-nsjKy1I4.mjs.map → uploadConsents-C1S-BNzw.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/impl-BEzyqD_12.mjs +0 -2
- package/dist/impl-nKY3m-Vx.mjs +0 -2
- package/dist/impl-nKY3m-Vx.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-Duaq6iWI2.mjs","names":[],"sources":["../src/commands/request/cron/mark-identifiers-completed/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context';\nimport { pushCronIdentifiersFromCsv } from '../../../../lib/cron';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nexport interface MarkIdentifiersCompletedCommandFlags {\n file: string;\n transcendUrl: string;\n auth: string;\n sombraAuth?: string;\n dataSiloId: string;\n}\n\nexport async function markIdentifiersCompleted(\n this: LocalContext,\n {\n file,\n transcendUrl,\n auth,\n sombraAuth,\n dataSiloId,\n }: MarkIdentifiersCompletedCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await pushCronIdentifiersFromCsv({\n file,\n transcendUrl,\n auth,\n sombraAuth,\n dataSiloId,\n });\n}\n"],"mappings":"0RAYA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,aACA,cAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAA2B,CAC/B,OACA,eACA,OACA,aACA,aACD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import{t as e}from"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{As as t,pi as n}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{t as r}from"./done-input-validation-CcZtaz03.mjs";import{a as i}from"./preference-management-8gj7aSJB.mjs";import{readdirSync as a}from"node:fs";import{basename as o,join as s}from"node:path";import c from"colors";async function l({auth:l,partition:u,sombraAuth:d,transcendUrl:f,file:p=``,directory:m,dryRun:h,skipExistingRecordCheck:g,receiptFileDir:_,skipWorkflowTriggers:v,forceTriggerWorkflows:y,skipConflictUpdates:b,isSilent:x,attributes:S,concurrency:C}){m&&p&&(e.error(c.red(`Cannot provide both a directory and a file. Please provide only one.`)),this.process.exit(1)),!p&&!m&&(e.error(c.red(`A file or directory must be provided. Please provide one using --file=./preferences.csv or --directory=./preferences`)),this.process.exit(1)),r(this.process.exit);let w=[];if(m)try{let t=a(m).filter(e=>e.endsWith(`.csv`));t.length===0&&(e.error(c.red(`No CSV files found in directory: ${m}`)),this.process.exit(1)),w.push(...t.map(e=>s(m,e)))}catch(t){e.error(c.red(`Failed to read directory: ${m}`)),e.error(c.red(t.message)),this.process.exit(1)}else try{p.endsWith(`.csv`)||(e.error(c.red(`File must be a CSV file`)),this.process.exit(1)),w.push(p)}catch(t){e.error(c.red(`Failed to access file: ${p}`)),e.error(c.red(t.message)),this.process.exit(1)}e.info(c.green(`Processing ${w.length} consent preferences files for partition: ${u}`)),e.debug(`Files to process: ${w.join(`, `)}`),g&&e.info(c.bgYellow(`Skipping existing record check: ${g}`)),await t(w,async e=>{await i({receiptFilepath:s(_,`${o(e).replace(`.csv`,``)}-receipts.json`),auth:l,sombraAuth:d,file:e,partition:u,transcendUrl:f,skipConflictUpdates:b,skipWorkflowTriggers:v,skipExistingRecordCheck:g,isSilent:x,dryRun:h,attributes:n(S),forceTriggerWorkflows:y})},{concurrency:C})}export{l as uploadPreferences};
|
|
2
|
+
//# sourceMappingURL=impl-O5gz8qcm.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-O5gz8qcm.mjs","names":[],"sources":["../src/commands/consent/upload-preferences/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport colors from 'colors';\n\nimport { logger } from '../../../logger';\nimport { uploadPreferenceManagementPreferencesInteractive } from '../../../lib/preference-management';\nimport { splitCsvToList } from '../../../lib/requests';\nimport { readdirSync } from 'node:fs';\nimport { map } from '../../../lib/bluebird';\nimport { basename, join } from 'node:path';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface UploadPreferencesCommandFlags {\n auth: string;\n partition: string;\n sombraAuth?: string;\n transcendUrl: string;\n file?: string;\n directory?: string;\n dryRun: boolean;\n skipExistingRecordCheck: boolean;\n receiptFileDir: string;\n skipWorkflowTriggers: boolean;\n forceTriggerWorkflows: boolean;\n skipConflictUpdates: boolean;\n isSilent: boolean;\n attributes: string;\n receiptFilepath: string;\n concurrency: number;\n}\n\nexport async function uploadPreferences(\n this: LocalContext,\n {\n auth,\n partition,\n sombraAuth,\n transcendUrl,\n file = '',\n directory,\n dryRun,\n skipExistingRecordCheck,\n receiptFileDir,\n skipWorkflowTriggers,\n forceTriggerWorkflows,\n skipConflictUpdates,\n isSilent,\n attributes,\n concurrency,\n }: UploadPreferencesCommandFlags,\n): Promise<void> {\n if (!!directory && !!file) {\n logger.error(\n colors.red(\n 'Cannot provide both a directory and a file. Please provide only one.',\n ),\n );\n this.process.exit(1);\n }\n\n if (!file && !directory) {\n logger.error(\n colors.red(\n 'A file or directory must be provided. Please provide one using --file=./preferences.csv or --directory=./preferences',\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process.exit);\n\n const files: string[] = [];\n\n if (directory) {\n try {\n const filesInDirectory = readdirSync(directory);\n const csvFiles = filesInDirectory.filter((file) => file.endsWith('.csv'));\n\n if (csvFiles.length === 0) {\n logger.error(\n colors.red(`No CSV files found in directory: ${directory}`),\n );\n this.process.exit(1);\n }\n\n // Add full paths for each CSV file\n files.push(...csvFiles.map((file) => join(directory, file)));\n } catch (err) {\n logger.error(colors.red(`Failed to read directory: ${directory}`));\n logger.error(colors.red((err as Error).message));\n this.process.exit(1);\n }\n } else {\n try {\n // Verify file exists and is a CSV\n if (!file.endsWith('.csv')) {\n logger.error(colors.red('File must be a CSV file'));\n this.process.exit(1);\n }\n files.push(file);\n } catch (err) {\n logger.error(colors.red(`Failed to access file: ${file}`));\n logger.error(colors.red((err as Error).message));\n this.process.exit(1);\n }\n }\n\n logger.info(\n colors.green(\n `Processing ${files.length} consent preferences files for partition: ${partition}`,\n ),\n );\n logger.debug(`Files to process: ${files.join(', ')}`);\n\n if (skipExistingRecordCheck) {\n logger.info(\n colors.bgYellow(\n `Skipping existing record check: ${skipExistingRecordCheck}`,\n ),\n );\n }\n\n await map(\n files,\n async (filePath) => {\n const fileName = basename(filePath).replace('.csv', '');\n await uploadPreferenceManagementPreferencesInteractive({\n receiptFilepath: join(receiptFileDir, `${fileName}-receipts.json`),\n auth,\n sombraAuth,\n file: filePath,\n partition,\n transcendUrl,\n skipConflictUpdates,\n skipWorkflowTriggers,\n skipExistingRecordCheck,\n isSilent,\n dryRun,\n attributes: splitCsvToList(attributes),\n forceTriggerWorkflows,\n });\n },\n { concurrency },\n );\n}\n"],"mappings":"4bA8BA,eAAsB,EAEpB,CACE,OACA,YACA,aACA,eACA,OAAO,GACP,YACA,SACA,0BACA,iBACA,uBACA,wBACA,sBACA,WACA,aACA,eAEa,CACT,GAAe,IACnB,EAAO,MACL,EAAO,IACL,uEACD,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGlB,CAAC,GAAQ,CAAC,IACZ,EAAO,MACL,EAAO,IACL,uHACD,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,EAAoB,KAAK,QAAQ,KAAK,CAEtC,IAAM,EAAkB,EAAE,CAE1B,GAAI,EACF,GAAI,CAEF,IAAM,EADmB,EAAY,EAAU,CACb,OAAQ,GAAS,EAAK,SAAS,OAAO,CAAC,CAErE,EAAS,SAAW,IACtB,EAAO,MACL,EAAO,IAAI,oCAAoC,IAAY,CAC5D,CACD,KAAK,QAAQ,KAAK,EAAE,EAItB,EAAM,KAAK,GAAG,EAAS,IAAK,GAAS,EAAK,EAAW,EAAK,CAAC,CAAC,OACrD,EAAK,CACZ,EAAO,MAAM,EAAO,IAAI,6BAA6B,IAAY,CAAC,CAClE,EAAO,MAAM,EAAO,IAAK,EAAc,QAAQ,CAAC,CAChD,KAAK,QAAQ,KAAK,EAAE,MAGtB,GAAI,CAEG,EAAK,SAAS,OAAO,GACxB,EAAO,MAAM,EAAO,IAAI,0BAA0B,CAAC,CACnD,KAAK,QAAQ,KAAK,EAAE,EAEtB,EAAM,KAAK,EAAK,OACT,EAAK,CACZ,EAAO,MAAM,EAAO,IAAI,0BAA0B,IAAO,CAAC,CAC1D,EAAO,MAAM,EAAO,IAAK,EAAc,QAAQ,CAAC,CAChD,KAAK,QAAQ,KAAK,EAAE,CAIxB,EAAO,KACL,EAAO,MACL,cAAc,EAAM,OAAO,4CAA4C,IACxE,CACF,CACD,EAAO,MAAM,qBAAqB,EAAM,KAAK,KAAK,GAAG,CAEjD,GACF,EAAO,KACL,EAAO,SACL,mCAAmC,IACpC,CACF,CAGH,MAAM,EACJ,EACA,KAAO,IAAa,CAElB,MAAM,EAAiD,CACrD,gBAAiB,EAAK,EAAgB,GAFvB,EAAS,EAAS,CAAC,QAAQ,OAAQ,GAAG,CAEH,gBAAgB,CAClE,OACA,aACA,KAAM,EACN,YACA,eACA,sBACA,uBACA,0BACA,WACA,SACA,WAAY,EAAe,EAAW,CACtC,wBACD,CAAC,EAEJ,CAAE,cAAa,CAChB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import{t as e}from"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import"./codecs-TR6p48v3.mjs";import"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{r as t}from"./consent-manager-c4bgQF1N.mjs";import"./uploadConsents-C1S-BNzw.mjs";import{r as n}from"./api-keys-CxvKdj2v.mjs";import{t as r}from"./done-input-validation-CcZtaz03.mjs";import{writeFileSync as i}from"node:fs";import a from"colors";async function o({auth:o,xdiLocation:s,file:c,removeIpAddresses:l,domainBlockList:u,xdiAllowedCommands:d,transcendUrl:f}){r(this.process.exit);let{syncGroups:p,html:m}=await t(await n(o),{xdiLocation:s,transcendUrl:f,removeIpAddresses:l,domainBlockList:u.length>0?u:void 0,xdiAllowedCommands:d});e.info(a.green(`Successfully constructed sync endpoint for sync groups: ${JSON.stringify(p,null,2)}`)),i(c,m),e.info(a.green(`Wrote configuration to file "${c}"!`))}export{o as buildXdiSyncEndpoint};
|
|
2
|
+
//# sourceMappingURL=impl-PH0AoC7i.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-PH0AoC7i.mjs","names":["buildXdiSyncEndpointHelper"],"sources":["../src/commands/consent/build-xdi-sync-endpoint/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { logger } from '../../../logger';\nimport colors from 'colors';\nimport { writeFileSync } from 'node:fs';\nimport { validateTranscendAuth } from '../../../lib/api-keys';\nimport { buildXdiSyncEndpoint as buildXdiSyncEndpointHelper } from '../../../lib/consent-manager';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface BuildXdiSyncEndpointCommandFlags {\n auth: string;\n xdiLocation: string;\n file: string;\n removeIpAddresses: boolean;\n domainBlockList: string[];\n xdiAllowedCommands: string;\n transcendUrl: string;\n}\n\nexport async function buildXdiSyncEndpoint(\n this: LocalContext,\n {\n auth,\n xdiLocation,\n file,\n removeIpAddresses,\n domainBlockList,\n xdiAllowedCommands,\n transcendUrl,\n }: BuildXdiSyncEndpointCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Build the sync endpoint\n const { syncGroups, html } = await buildXdiSyncEndpointHelper(apiKeyOrList, {\n xdiLocation,\n transcendUrl,\n removeIpAddresses,\n domainBlockList: domainBlockList.length > 0 ? domainBlockList : undefined,\n xdiAllowedCommands,\n });\n\n // Log success\n logger.info(\n colors.green(\n `Successfully constructed sync endpoint for sync groups: ${JSON.stringify(\n syncGroups,\n null,\n 2,\n )}`,\n ),\n );\n\n // Write to disk\n writeFileSync(file, html);\n logger.info(colors.green(`Wrote configuration to file \"${file}\"!`));\n}\n"],"mappings":"oeAkBA,eAAsB,EAEpB,CACE,OACA,cACA,OACA,oBACA,kBACA,qBACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAMtC,GAAM,CAAE,aAAY,QAAS,MAAMA,EAHd,MAAM,EAAsB,EAAK,CAGsB,CAC1E,cACA,eACA,oBACA,gBAAiB,EAAgB,OAAS,EAAI,EAAkB,IAAA,GAChE,qBACD,CAAC,CAGF,EAAO,KACL,EAAO,MACL,2DAA2D,KAAK,UAC9D,EACA,KACA,EACD,GACF,CACF,CAGD,EAAc,EAAM,EAAK,CACzB,EAAO,KAAK,EAAO,MAAM,gCAAgC,EAAK,IAAI,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{X as e}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{t}from"./done-input-validation-CcZtaz03.mjs";async function n({auth:n,actions:r,origins:i,silentModeBefore:a,createdAtBefore:o,createdAtAfter:s,updatedAtBefore:c,updatedAtAfter:l,transcendUrl:u,concurrency:d}){t(this.process.exit),await e({transcendUrl:u,requestActions:r,auth:n,requestOrigins:i,concurrency:d,silentModeBefore:a,createdAtBefore:o,createdAtAfter:s,updatedAtBefore:c,updatedAtAfter:l})}export{n as approve};
|
|
2
|
+
//# sourceMappingURL=impl-S8p6toVb2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-S8p6toVb2.mjs","names":[],"sources":["../src/commands/request/approve/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\n\nimport { RequestAction, RequestOrigin } from '@transcend-io/privacy-types';\nimport { approvePrivacyRequests } from '../../../lib/requests';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface ApproveCommandFlags {\n auth: string;\n actions: RequestAction[];\n origins?: RequestOrigin[];\n silentModeBefore?: Date;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function approve(\n this: LocalContext,\n {\n auth,\n actions,\n origins,\n silentModeBefore,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n transcendUrl,\n concurrency,\n }: ApproveCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await approvePrivacyRequests({\n transcendUrl,\n requestActions: actions,\n auth,\n requestOrigins: origins,\n concurrency,\n silentModeBefore,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n });\n}\n"],"mappings":"8PAmBA,eAAsB,EAEpB,CACE,OACA,UACA,UACA,mBACA,kBACA,iBACA,kBACA,iBACA,eACA,eAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAAuB,CAC3B,eACA,eAAgB,EAChB,OACA,eAAgB,EAChB,cACA,mBACA,kBACA,iBACA,kBACA,iBACD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import{c as e}from"./constants-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import{c as e}from"./constants-CnLQtIBn.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import"./codecs-TR6p48v3.mjs";import"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{i as t}from"./api-keys-CxvKdj2v.mjs";import{t as n}from"./done-input-validation-CcZtaz03.mjs";import{writeFileSync as r}from"node:fs";async function i({email:i,password:a,apiKeyTitle:o,file:s,scopes:c,deleteExistingApiKey:l,createNewApiKey:u,parentOrganizationId:d,transcendUrl:f}){n(this.process.exit);let{errors:p,apiKeys:m}=await t({transcendUrl:f,password:a,email:i,parentOrganizationId:d,deleteExistingApiKey:l,createNewApiKey:u,apiKeyTitle:o,scopes:c.map(t=>e[t].name)});r(s,`${JSON.stringify(m,null,2)}\n`),p.length>0&&this.process.exit(1)}export{i as generateApiKeys};
|
|
2
|
+
//# sourceMappingURL=impl-X2MSb8Ij.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-X2MSb8Ij.mjs","names":[],"sources":["../src/commands/admin/generate-api-keys/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { writeFileSync } from 'node:fs';\n\nimport { ScopeName } from '@transcend-io/privacy-types';\n\nimport { generateCrossAccountApiKeys } from '../../../lib/api-keys';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\nimport { SCOPES_BY_TITLE } from '../../../constants';\n\n// Command flag interface\nexport interface GenerateApiKeysCommandFlags {\n email: string;\n password: string;\n apiKeyTitle: string;\n file: string;\n scopes: string[];\n deleteExistingApiKey: boolean;\n createNewApiKey: boolean;\n parentOrganizationId?: string;\n transcendUrl: string;\n}\n\n// Command implementation\nexport async function generateApiKeys(\n this: LocalContext,\n {\n email,\n password,\n apiKeyTitle,\n file,\n scopes,\n deleteExistingApiKey,\n createNewApiKey,\n parentOrganizationId,\n transcendUrl,\n }: GenerateApiKeysCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const scopeNames = scopes.map(\n (scopeTitle) => SCOPES_BY_TITLE[scopeTitle].name as ScopeName,\n );\n\n // Upload privacy requests\n const { errors, apiKeys } = await generateCrossAccountApiKeys({\n transcendUrl,\n password,\n email,\n parentOrganizationId,\n deleteExistingApiKey,\n createNewApiKey,\n apiKeyTitle,\n scopes: scopeNames,\n });\n\n // Write to disk\n writeFileSync(file, `${JSON.stringify(apiKeys, null, 2)}\\n`);\n if (errors.length > 0) {\n this.process.exit(1);\n }\n}\n"],"mappings":"qXAuBA,eAAsB,EAEpB,CACE,QACA,WACA,cACA,OACA,SACA,uBACA,kBACA,uBACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAOtC,GAAM,CAAE,SAAQ,WAAY,MAAM,EAA4B,CAC5D,eACA,WACA,QACA,uBACA,uBACA,kBACA,cACA,OAbiB,EAAO,IACvB,GAAe,EAAgB,GAAY,KAC7C,CAYA,CAAC,CAGF,EAAc,EAAM,GAAG,KAAK,UAAU,EAAS,KAAM,EAAE,CAAC,IAAI,CACxD,EAAO,OAAS,GAClB,KAAK,QAAQ,KAAK,EAAE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{i as e}from"./manual-enrichment-B6lW5kAX.mjs";import{t}from"./done-input-validation-CcZtaz03.mjs";async function n({auth:n,transcendUrl:r,file:i,concurrency:a,actions:o,sombraAuth:s}){t(this.process.exit),await e({file:i,transcendUrl:r,concurrency:a,requestActions:o,auth:n,sombraAuth:s})}export{n as pullIdentifiers};
|
|
2
|
+
//# sourceMappingURL=impl-bo95wZIU2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-bo95wZIU2.mjs","names":[],"sources":["../src/commands/request/preflight/pull-identifiers/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context';\nimport { pullManualEnrichmentIdentifiersToCsv } from '../../../../lib/manual-enrichment';\nimport type { RequestAction } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nexport interface PullIdentifiersCommandFlags {\n auth: string;\n sombraAuth?: string;\n transcendUrl: string;\n file: string;\n actions?: RequestAction[];\n concurrency: number;\n}\n\nexport async function pullIdentifiers(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n file,\n concurrency,\n actions,\n sombraAuth,\n }: PullIdentifiersCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await pullManualEnrichmentIdentifiersToCsv({\n file,\n transcendUrl,\n concurrency,\n requestActions: actions,\n auth,\n sombraAuth,\n });\n}\n"],"mappings":"uSAcA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,cACA,UACA,cAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAAqC,CACzC,OACA,eACA,cACA,eAAgB,EAChB,OACA,aACD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import{t as e}from"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{a as t,ai as n,ii as r,n as i,s as a,xr as o}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{t as s}from"./done-input-validation-CcZtaz03.mjs";import{i as c,n as l,r as u}from"./preference-management-8gj7aSJB.mjs";import d from"colors";const f=[`userId`,`timestamp`,`partition`,`decryptionStatus`,`updatedAt`,`usp`,`gpp`,`tcf`,`airgapVersion`,`metadata`,`metadataTimestamp`];async function p({auth:p,partition:m,sombraAuth:h,file:g,transcendUrl:_,timestampBefore:v,timestampAfter:y,updatedBefore:b,updatedAfter:x,identifiers:S=[],concurrency:C,shouldChunk:w,windowConcurrency:T,maxChunks:E,exportIdentifiersWithDelimiter:D,maxLookbackDays:O}){s(this.process.exit);let k=await r(_,p,h),A=n(_,p),j=S.map(e=>{if(!e.includes(`:`))return{name:`email`,value:e};let[t,n]=e.split(`:`);return{name:t,value:n}}),M={...v?{timestampBefore:v.toISOString()}:{},...y?{timestampAfter:y.toISOString()}:{},...x||b?{system:{...b?{updatedBefore:b.toISOString()}:{},...x?{updatedAfter:x.toISOString()}:{}}}:{},...j.length>0?{identifiers:j}:{}};e.info(`Fetching consent preferences from partition ${m}, using mode=${w?`chunked-stream`:`paged-stream`}...`),e.info(d.magenta(`Preparing CSV at: ${g}`));let[N,P]=await Promise.all([o(A),i(A)]),F=P.map(e=>e.name),I=Array.from(new Set(N.flatMap(e=>e.topics?.map(t=>`${e.trackingType}_${t.slug}`)??[]))).sort((e,t)=>e.localeCompare(t)),L=Array.from(new Set(N.map(e=>e.trackingType))).sort((e,t)=>e.localeCompare(t)),R=[...f,...F,...L,...I],z=null,B=!1,V=e=>{if(!e||e.length===0)return;let n=e.map(e=>c(e,D));if(!B){let e=Object.keys(n[0]??{}),t=new Set;z=[...R,...e].filter(e=>e===void 0||t.has(e)?!1:(t.add(e),!0)),a(g,z),B=!0}t(g,n,z)};if(w){await u(k,{partition:m,filterBy:M,limit:C,windowConcurrency:T,maxChunks:E,maxLookbackDays:O,onItems:e=>V(e)}),e.info(d.green(`Finished writing CSV to ${g}`));return}await l(k,{partition:m,filterBy:M,limit:C,onItems:e=>V(e)}),e.info(d.green(`Finished writing CSV to ${g}`))}export{p as pullConsentPreferences};
|
|
2
|
+
//# sourceMappingURL=impl-cfdCesro.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-cfdCesro.mjs","names":[],"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":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{z as e}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{t}from"./done-input-validation-CcZtaz03.mjs";async function n({auth:n,dataSiloId:r,actions:i,transcendUrl:a}){t(this.process.exit),await e({requestActions:i,transcendUrl:a,auth:n,dataSiloId:r})}export{n as retryRequestDataSilos};
|
|
2
|
+
//# sourceMappingURL=impl-iZoXu4nV.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-iZoXu4nV.mjs","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":"8PAYA,eAAsB,EAEpB,CACE,OACA,aACA,UACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAA4B,CAChC,eAAgB,EAChB,eACA,OACA,aACD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{dt as e}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{t}from"./done-input-validation-CcZtaz03.mjs";async function n({auth:n,transcendUrl:r,actions:i,statuses:a,requestIds:o,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u,concurrency:d}){t(this.process.exit),await e({transcendUrl:r,requestActions:i,auth:n,requestIds:o,statuses:a,concurrency:d,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u})}export{n as markSilent};
|
|
2
|
+
//# sourceMappingURL=impl-lebl6Zek2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-lebl6Zek2.mjs","names":[],"sources":["../src/commands/request/mark-silent/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { markSilentPrivacyRequests } from '../../../lib/requests';\nimport type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface MarkSilentCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses?: RequestStatus[];\n requestIds?: string[];\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function markSilent(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n actions,\n statuses,\n requestIds,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n }: MarkSilentCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await markSilentPrivacyRequests({\n transcendUrl,\n requestActions: actions,\n auth,\n requestIds,\n statuses,\n concurrency,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n });\n}\n"],"mappings":"+PAkBA,eAAsB,EAEpB,CACE,OACA,eACA,UACA,WACA,aACA,kBACA,iBACA,kBACA,iBACA,eAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAA0B,CAC9B,eACA,eAAgB,EAChB,OACA,aACA,WACA,cACA,kBACA,iBACA,kBACA,iBACD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import{t as e}from"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{O as t,b as n,x as r}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{a as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./pooling-CazydwlD.mjs";import{t as d}from"./done-input-validation-CcZtaz03.mjs";import f from"colors";async function p(){let r=Number(process.env.WORKER_ID||`0`);e.info(`[w${r}] ready pid=${process.pid}`),process.send?.({type:`ready`}),process.on(`message`,async i=>{if(!i||typeof i!=`object`||(i.type===`shutdown`&&process.exit(0),i.type!==`task`))return;let{filePath:a,options:o}=i.payload,{outputDir:s,clearOutputDir:c}=o;try{e.info(`[w${r}] processing ${a}`);let{DuckDBInstance:t}=await import(`@duckdb/node-api`);await n({filePath:a,outputDir:s,clearOutputDir:c,onProgress:(e,t)=>process.send?.({type:`progress`,payload:{filePath:a,processed:e,total:t}})},t),process.send?.({type:`result`,payload:{ok:!0,filePath:a}})}catch(n){let i=t(n);e.error(`[w${r}] ERROR ${a}: ${n.stack||i}`),process.send?.({type:`result`,payload:{ok:!1,filePath:a,error:i}})}}),await new Promise(()=>{})}function m(e){return c(e)}function h(e){return a(e)}const g={renderHeader:m,renderWorkers:h};function _(){return typeof __filename<`u`?__filename:process.argv[1]}async function v(t){d(this.process.exit);let{directory:n,outputDir:a,clearOutputDir:c,concurrency:p,viewerMode:m}=t,h=r(n,this),{poolSize:v,cpuCount:y}=l(p,h.length);e.info(f.green(`Converting ${h.length} Parquet file(s) → CSV with pool size ${v} (CPU=${y})`));let b=h.map(e=>({filePath:e,options:{outputDir:a,clearOutputDir:c}}));await o({title:`Parquet → CSV - ${n}`,baseDir:n||a||process.cwd(),childFlag:s,childModulePath:_(),poolSize:v,cpuCount:y,filesTotal:h.length,hooks:{nextTask:()=>b.shift(),taskLabel:e=>e.filePath,initTotals:()=>({}),initSlotProgress:()=>void 0,onProgress:e=>e,onResult:(e,t)=>({totals:e,ok:!!t.ok}),postProcess:async()=>{}},viewerMode:m,render:e=>i(e,g,m),extraKeyHandler:({logsBySlot:e,repaint:t,setPaused:n})=>u({logsBySlot:e,repaint:t,setPaused:n})})}process.argv.includes(`--as-child`)&&p().catch(t=>{e.error(t),process.exit(1)});export{v as parquetToCsv};
|
|
2
|
+
//# sourceMappingURL=impl-p0YN9e2e.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-p0YN9e2e.mjs","names":[],"sources":["../src/commands/admin/parquet-to-csv/worker.ts","../src/commands/admin/parquet-to-csv/ui/plugin.ts","../src/commands/admin/parquet-to-csv/impl.ts"],"sourcesContent":["import { parquetToCsvOneFile, extractErrorMessage } from '../../../lib/helpers';\nimport type { ToWorker } from '../../../lib/pooling';\nimport { logger } from '../../../logger';\n\nexport type ParquetTask = {\n /** Absolute path of the Parquet file to convert. */\n filePath: string;\n options: {\n /** Optional directory where CSV output files should be written. */\n outputDir?: string;\n /** Whether to clear any pre-existing output before writing new ones. */\n clearOutputDir: boolean;\n };\n};\n\nexport type ParquetProgress = {\n /** File being processed by the worker. */\n filePath: string;\n /** Rows processed so far. */\n processed: number;\n /** Optional known total rows (not always available). */\n total?: number;\n};\n\nexport type ParquetResult = {\n ok: boolean;\n filePath: string;\n error?: string;\n};\n\n/**\n * Worker loop: convert a single Parquet file to one or more CSV files.\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 process.send?.({ type: 'ready' });\n\n process.on('message', async (msg: ToWorker<ParquetTask>) => {\n if (!msg || typeof msg !== 'object') return;\n\n if (msg.type === 'shutdown') {\n process.exit(0);\n }\n if (msg.type !== 'task') return;\n\n const { filePath, options } = msg.payload;\n const { outputDir, clearOutputDir } = options;\n\n try {\n logger.info(`[w${workerId}] processing ${filePath}`);\n const { DuckDBInstance } = await import('@duckdb/node-api');\n await parquetToCsvOneFile(\n {\n filePath,\n outputDir,\n clearOutputDir,\n onProgress: (processed, total) =>\n process.send?.({\n type: 'progress',\n payload: { filePath, processed, total },\n }),\n },\n DuckDBInstance,\n );\n\n process.send?.({\n type: 'result',\n payload: { ok: true, filePath },\n });\n } catch (err) {\n const message = extractErrorMessage(err);\n logger.error(`[w${workerId}] ERROR ${filePath}: ${err.stack || message}`);\n process.send?.({\n type: 'result',\n payload: { ok: false, filePath, error: message },\n });\n }\n });\n\n // keep alive until shutdown\n await new Promise<never>(() => {\n // Do nothing\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 parquet-to-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 parquet-to-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 parquetToCsvPlugin: 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 { collectParquetFilesOrExit } from '../../../lib/helpers';\nimport {\n computePoolSize,\n createExtraKeyHandler,\n CHILD_FLAG,\n type PoolHooks,\n runPool,\n dashboardPlugin,\n} from '../../../lib/pooling';\nimport {\n runChild,\n type ParquetProgress,\n type ParquetResult,\n type ParquetTask,\n} from './worker';\nimport { parquetToCsvPlugin } 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.\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/** No custom totals for the header; the runner’s built-ins suffice. */\ntype Totals = Record<string, never>;\n\nexport type ParquetToCsvCommandFlags = {\n directory: string;\n outputDir?: string;\n clearOutputDir: boolean;\n concurrency?: number;\n viewerMode: boolean;\n};\n\n/**\n * Convert all Parquet files in a directory to CSV, in parallel.\n *\n * @param flags - The command flags.\n */\nexport async function parquetToCsv(\n this: LocalContext,\n flags: ParquetToCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const { directory, outputDir, clearOutputDir, concurrency, viewerMode } =\n flags;\n\n /* 1) Discover .parquet inputs */\n const files = collectParquetFilesOrExit(directory, this);\n\n /* 2) Size the pool */\n const { poolSize, cpuCount } = computePoolSize(concurrency, files.length);\n\n logger.info(\n colors.green(\n `Converting ${files.length} Parquet file(s) → CSV with pool size ${poolSize} (CPU=${cpuCount})`,\n ),\n );\n\n /* 3) Build FIFO queue of tasks (one per file) */\n const queue = files.map<ParquetTask>((filePath) => ({\n filePath,\n options: { outputDir, clearOutputDir },\n }));\n\n /* 4) Pool hooks */\n const hooks: PoolHooks<ParquetTask, ParquetProgress, ParquetResult, Totals> =\n {\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: async () => {\n // nothing special post-run\n },\n };\n\n /* 5) Launch the pool runner with custom dashboard plugin */\n await runPool({\n title: `Parquet → 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, parquetToCsvPlugin, viewerMode),\n extraKeyHandler: ({ logsBySlot, repaint, setPaused }) =>\n createExtraKeyHandler({ logsBySlot, repaint, setPaused }),\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":"wYAiCA,eAAsB,GAA0B,CAC9C,IAAM,EAAW,OAAO,QAAQ,IAAI,WAAa,IAAI,CACrD,EAAO,KAAK,KAAK,EAAS,cAAc,QAAQ,MAAM,CACtD,QAAQ,OAAO,CAAE,KAAM,QAAS,CAAC,CAEjC,QAAQ,GAAG,UAAW,KAAO,IAA+B,CAM1D,GALI,CAAC,GAAO,OAAO,GAAQ,WAEvB,EAAI,OAAS,YACf,QAAQ,KAAK,EAAE,CAEb,EAAI,OAAS,QAAQ,OAEzB,GAAM,CAAE,WAAU,WAAY,EAAI,QAC5B,CAAE,YAAW,kBAAmB,EAEtC,GAAI,CACF,EAAO,KAAK,KAAK,EAAS,eAAe,IAAW,CACpD,GAAM,CAAE,kBAAmB,MAAM,OAAO,oBACxC,MAAM,EACJ,CACE,WACA,YACA,iBACA,YAAa,EAAW,IACtB,QAAQ,OAAO,CACb,KAAM,WACN,QAAS,CAAE,WAAU,YAAW,QAAO,CACxC,CAAC,CACL,CACD,EACD,CAED,QAAQ,OAAO,CACb,KAAM,SACN,QAAS,CAAE,GAAI,GAAM,WAAU,CAChC,CAAC,OACK,EAAK,CACZ,IAAM,EAAU,EAAoB,EAAI,CACxC,EAAO,MAAM,KAAK,EAAS,UAAU,EAAS,IAAI,EAAI,OAAS,IAAU,CACzE,QAAQ,OAAO,CACb,KAAM,SACN,QAAS,CAAE,GAAI,GAAO,WAAU,MAAO,EAAS,CACjD,CAAC,GAEJ,CAGF,MAAM,IAAI,YAAqB,GAE7B,CCrEJ,SAAS,EACP,EACU,CAEV,OAAO,EAAW,EAAI,CASxB,SAAS,EACP,EACU,CACV,OAAO,EAAe,EAAI,CAG5B,MAAa,EAAkE,CAC7E,eACA,gBAED,CCVD,SAAS,GAA+B,CAItC,OAHI,OAAO,WAAe,IACjB,WAEF,QAAQ,KAAK,GAmBtB,eAAsB,EAEpB,EACe,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAM,CAAE,YAAW,YAAW,iBAAgB,cAAa,cACzD,EAGI,EAAQ,EAA0B,EAAW,KAAK,CAGlD,CAAE,WAAU,YAAa,EAAgB,EAAa,EAAM,OAAO,CAEzE,EAAO,KACL,EAAO,MACL,cAAc,EAAM,OAAO,wCAAwC,EAAS,QAAQ,EAAS,GAC9F,CACF,CAGD,IAAM,EAAQ,EAAM,IAAkB,IAAc,CAClD,WACA,QAAS,CAAE,YAAW,iBAAgB,CACvC,EAAE,CAiBH,MAAM,EAAQ,CACZ,MAAO,mBAAmB,IAC1B,QAAS,GAAa,GAAa,QAAQ,KAAK,CAChD,UAAW,EACX,gBAAiB,GAAsB,CACvC,WACA,WACA,WAAY,EAAM,OAClB,MArBA,CACE,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,EACpD,YAAa,SAAY,GAG1B,CAYD,aACA,OAAS,GAAU,EAAgB,EAAO,EAAoB,EAAW,CACzE,iBAAkB,CAAE,aAAY,UAAS,eACvC,EAAsB,CAAE,aAAY,UAAS,YAAW,CAAC,CAC5D,CAAC,CAMA,QAAQ,KAAK,SAAA,aAAoB,EACnC,GAAU,CAAC,MAAO,GAAQ,CACxB,EAAO,MAAM,EAAI,CACjB,QAAQ,KAAK,EAAE,EACf"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,i as t,n,o as r,r as i,t as a}from"./enums-CyFTrzXY.mjs";import{a as o,c as s,d as c,f as l,h as ee,i as te,l as ne,m as re,n as ie,o as ae,p as oe,r as se,s as ce,t as le,u as ue}from"./constants-DdeeX81W.mjs";import"./logger-Bj782ZYD.mjs";import{n as de,t as fe}from"./buildAIIntegrationType-Bk0EbFKV.mjs";import{$ as pe,A as me,B as he,C as ge,D as _e,E as ve,F as u,G as d,H as f,I as p,J as m,K as h,L as g,M as _,N as v,O as y,P as b,Q as x,R as S,S as C,T as w,U as T,V as E,W as D,X as O,Y as k,Z as A,_ as j,_t as M,a as N,at as P,b as F,c as ye,ct as be,d as xe,dt as Se,et as Ce,f as we,ft as Te,g as Ee,gt as De,h as Oe,ht as ke,i as Ae,it as je,j as Me,k as Ne,l as Pe,lt as Fe,m as Ie,mt as Le,n as Re,nt as ze,o as Be,ot as Ve,p as He,pt as Ue,q as We,r as Ge,rt as Ke,s as qe,st as Je,t as Ye,tt as Xe,u as Ze,ut as Qe,v as $e,vt as et,w as tt,x as nt,y as rt,yt as it,z as at}from"./codecs-TR6p48v3.mjs";import{a as ot,i as st,n as ct,r as lt,t as ut}from"./readTranscendYaml-DhKG1ViI.mjs";import{$ as dt,$a as ft,$i as pt,$n as mt,$o as ht,$r as gt,$t as _t,A as vt,Aa as yt,Ai as bt,An as xt,Ao as St,Ar as Ct,At as wt,B as Tt,Ba as Et,Bi as Dt,Bn as Ot,Bo as kt,Br as At,Bt as jt,C as Mt,Ca as Nt,Ci as Pt,Cn as Ft,Co as It,Cr as Lt,Cs as Rt,Ct as zt,D as Bt,Da as Vt,Di as Ht,Dn as Ut,Do as Wt,Dr as Gt,Ds as Kt,Dt as qt,E as Jt,Ea as Yt,Ei as Xt,En as Zt,Eo as Qt,Er as $t,Es as en,Et as tn,F as nn,Fa as rn,Fi as an,Fn as on,Fo as sn,Fr as cn,Ft as ln,G as un,Ga as dn,Gi as fn,Gn as pn,Go as mn,Gr as hn,Gt as gn,H as _n,Ha as vn,Hi as yn,Hn as bn,Ho as xn,Hr as Sn,Ht as Cn,I as wn,Ia as Tn,Ii as En,In as Dn,Io as On,Ir as kn,It as An,J as jn,Ja as Mn,Ji as Nn,Jn as Pn,Jo as Fn,Jr as In,Jt as Ln,K as Rn,Ka as zn,Ki as Bn,Kn as Vn,Ko as Hn,Kr as Un,Kt as Wn,L as Gn,La as Kn,Li as qn,Ln as Jn,Lo as Yn,Lr as Xn,Lt as Zn,M as Qn,Ma as $n,Mi as er,Mn as tr,Mo as nr,Mr as rr,Mt as ir,N as ar,Na as or,Ni as sr,Nn as cr,No as lr,Nr as ur,Nt as dr,O as fr,Oa as pr,Oi as mr,On as hr,Oo as gr,Or as _r,Os as vr,Ot as yr,P as br,Pa as xr,Pi as Sr,Pn as Cr,Po as wr,Pr as Tr,Pt as Er,Q as Dr,Qa as Or,Qi as kr,Qn as I,Qo as Ar,Qr as jr,Qt as Mr,R as Nr,Ra as Pr,Ri as Fr,Rn as Ir,Ro as Lr,Rr,Rt as zr,S as Br,Sa as Vr,Si as Hr,Sn as Ur,So as Wr,Sr as Gr,Ss as Kr,St as qr,T as Jr,Ta as Yr,Ti as Xr,Tn as Zr,To as Qr,Tr as $r,Ts as ei,Tt as ti,U as ni,Ua as ri,Ui as ii,Un as ai,Uo as oi,Ur as si,Ut as ci,V as li,Va as ui,Vi as di,Vn as fi,Vo as pi,Vr as mi,Vt as hi,W as gi,Wa as _i,Wi as vi,Wn as yi,Wo as bi,Wr as xi,Wt as Si,X as Ci,Xa as wi,Xi as L,Xn as R,Xo as Ti,Xr as Ei,Xt as Di,Y as Oi,Ya as ki,Yi as Ai,Yn as ji,Yo as Mi,Yr as z,Yt as Ni,Z as Pi,Za as Fi,Zi as Ii,Zn as Li,Zo as Ri,Zr as B,Zt as zi,_ as Bi,_a as Vi,_i as Hi,_n as V,_o as Ui,_r as Wi,_s as Gi,_t as Ki,a as qi,aa as Ji,ai as H,an as Yi,ao as Xi,ar as Zi,as as Qi,at as $i,b as ea,ba as ta,bi as na,bn as ra,bo as U,br as ia,bs as aa,bt as oa,c as sa,ca,ci as la,cn as ua,co as da,cr as fa,cs as pa,ct as ma,d as ha,da as ga,di as _a,dn as va,do as ya,dr as ba,ds as xa,dt as Sa,ea as Ca,ei as wa,en as Ta,eo as Ea,er as Da,es as Oa,et as ka,f as Aa,fa as ja,fi as Ma,fn as Na,fo as Pa,fr as Fa,fs as Ia,ft as La,g as Ra,ga as za,gi as Ba,gn as Va,go as Ha,gr as Ua,gs as Wa,gt as Ga,h as Ka,ha as qa,hi as Ja,hn as Ya,ho as Xa,hr as Za,hs as Qa,ht as $a,i as W,ia as eo,ii as to,in as no,io as ro,ir as io,is as ao,it as oo,j as so,ja as co,ji as lo,jn as uo,jo as fo,jr as po,js as mo,jt as ho,k as go,ka as _o,ki as vo,kn as yo,ko as bo,kr as xo,ks as So,kt as Co,l as wo,la as To,li as Eo,ln as Do,lo as Oo,lr as ko,ls as Ao,lt as jo,m as Mo,ma as No,mi as Po,mn as Fo,mo as Io,mr as Lo,ms as Ro,mt as zo,n as Bo,na as Vo,ni as Ho,nn as Uo,no as Wo,nr as Go,ns as Ko,nt as qo,o as Jo,oa as Yo,oi as Xo,on as Zo,oo as Qo,or as $o,os as es,ot as ts,p as ns,pa as rs,pi as is,pn as as,po as os,pr as ss,ps as cs,pt as ls,q as us,qa as ds,qi as fs,qn as ps,qo as ms,qr as hs,qt as gs,r as _s,ra as vs,ri as ys,rn as bs,ro as xs,rr as Ss,rs as Cs,rt as ws,s as Ts,sa as Es,si as Ds,sn as Os,so as ks,sr as As,ss as js,st as Ms,t as Ns,ta as Ps,ti as Fs,tn as Is,to as Ls,tr as Rs,ts as zs,tt as Bs,u as Vs,ua as Hs,ui as Us,un as Ws,uo as Gs,ur as Ks,us as qs,ut as Js,v as Ys,va as Xs,vi as Zs,vn as Qs,vo as $s,vr as ec,vs as tc,vt as nc,w as rc,wa as ic,wi as ac,wn as oc,wo as sc,wr as cc,ws as lc,wt as uc,x as dc,xa as fc,xi as pc,xn as mc,xo as hc,xr as gc,xs as _c,xt as vc,y as yc,ya as bc,yi as xc,yn as Sc,yo as Cc,yr as wc,ys as Tc,yt as Ec,z as Dc,za as Oc,zi as kc,zn as Ac,zo as jc,zr as Mc,zt as Nc}from"./syncConfigurationToTranscend-wWSbGVrI.mjs";import{t as Pc}from"./mergeTranscendInputs-Coj_e2N3.mjs";import{a as Fc,c as Ic,i as Lc,n as Rc,o as zc,r as Bc,s as Vc,t as Hc}from"./consent-manager-BoaaMjRQ.mjs";import{i as Uc,n as Wc,r as Gc,t as Kc}from"./uploadConsents-nsjKy1I4.mjs";import{a as qc,i as Jc,n as Yc,o as Xc,r as Zc,s as Qc,t as $c}from"./cron-DOicA1l8.mjs";import{i as el,n as tl,r as nl,t as rl}from"./api-keys-C7JLTDUZ.mjs";import{n as il,t as al}from"./data-inventory-OeEcogPl.mjs";import{i as ol,n as sl,r as cl,t as ll}from"./manual-enrichment-CYoZNBjO.mjs";import{ChatCompletionRole as G,PromptRunProductArea as K,PromptStatus as q,QueueStatus as J}from"@transcend-io/privacy-types";import{chunk as ul,difference as dl,groupBy as fl,keyBy as Y,uniq as pl}from"lodash-es";import{apply as ml,decodeCodec as X,getValues as hl}from"@transcend-io/type-utils";import{createHandlebarsWithHelpers as Z}from"@transcend-io/handlebars-utils";import gl from"fast-glob";import{execSync as Q}from"child_process";async function _l(e){let t=[],n=0,r=!1;do{let{largeLanguageModels:{nodes:i}}=await W(e,L,{first:20,offset:n});t.push(...i),n+=20,r=i.length===20}while(r);return t.sort((e,t)=>e.name.localeCompare(t.name))}function $(e){return RegExp(`<${e}>([\\s\\S]+?)<\\/${e}>`)}function vl(e){return e}const yl=e=>{try{return JSON.parse(e)}catch{return e}};var bl=class{prompts;handlebarsOptions;promptContentMap;largeLanguageModels=[];agentsByName={};agentsByAgentId={};graphQLClient;defaultVariables;variables;handlebars;transcendApiKey;transcendUrl;requireApproval;cacheDuration;lastUpdatedAt;constructor({prompts:e,handlebarsOptions:t={},transcendUrl:n=o,transcendApiKey:r,requireApproval:i=!0,cacheDuration:a,defaultVariables:s={}}){this.prompts=e,this.transcendUrl=n,this.transcendApiKey=r,this.variables=s,this.defaultVariables=s,this.graphQLClient=H(n,typeof r==`object`?r.release():r),this.requireApproval=i,this.cacheDuration=a,this.handlebarsOptions=t,this.handlebars=Z(t)}async fetchPromptsAndMetadata(){let e=hl(this.prompts),t=e.map(({id:e})=>e).filter(e=>!!e),n=e.map(({title:e})=>e).filter(e=>!!e),r=pl(e.map(({agentNames:e})=>e||[]).flat()),[i,a,o]=await Promise.all([I(this.graphQLClient,{promptIds:t,promptTitles:n}),_l(this.graphQLClient),z(this.graphQLClient,{names:r})]);this.agentsByName=Y(o,`name`),this.agentsByAgentId=Y(o,`agentId`),this.largeLanguageModels=a.filter(e=>e.isTranscendHosted===!1);let s=Y(i.prompts,`title`),c=Y(i.prompts,`id`);return this.variables={...i.calculatedVariables.reduce((e,t)=>Object.assign(e,{[t.name]:t.data?JSON.parse(t.data):t.data}),{}),...this.defaultVariables},this.handlebars=Z({...this.handlebarsOptions,templates:[...this.handlebarsOptions.templates||[],...i.promptPartials.map(e=>({name:e.slug,content:e.content}))]}),this.promptContentMap=ml(this.prompts,({id:e,title:t})=>{let n=e?c[e]:t?s[t]:void 0;if(!n)throw Error(`Failed to find prompt with title: "${t}" and id: "${e}"`);return n}),this.lastUpdatedAt=new Date,i}async getAgentByName(e){let t=this.agentsByName[e];if(t)return t;let[n]=await z(this.graphQLClient,{names:[e]});if(n)return this.agentsByName[n.name]=n,this.agentsByAgentId[n.agentId]=n,n}async getPromptThreadBySlackTs(e){let[t]=await R(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:n=[]}=fl(e,e=>this.agentsByName[e]?`hasCache`:`missingCache`),r=t.map(e=>this.agentsByName[e]);if(n.length===0)return r;let i=ul(n,50),a=[];return await mo(i,async e=>{let t=await z(this.graphQLClient,{names:e});t.forEach(e=>{this.agentsByName[e.name]=e,this.agentsByAgentId[e.agentId]=e}),a.push(...t)}),[...r,...a]}getAgentFiles(e){return B(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!==q.Approved)throw Error(`Assessment "${n.title}" cannot be used because its in status: "${n.status}"`);if(n.status===q.Rejected)throw Error(`Assessment "${n.title}" cannot be used because it's in status: "${n.status}"`);return X(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&&($(n.extractFromTag).exec(t)||[])[1]||t;return X(n.outputCodec,yl(r),!1)}async reportAndParsePromptRun(e,{largeLanguageModel:t,...n}){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let r=n.name||`@transcend-io/cli-prompt-run-${new Date().toISOString()}`;if(!this.promptContentMap)throw Error(`Expected this.promptContentMap to be defined`);let i=this.promptContentMap[e];if(!i)throw Error(`Expected this.prompts[${e}] to be defined`);if(n.promptRunMessages.length===0)throw Error(`promptRunMessages is expected to have length > 0`);if(n.promptRunMessages[0].role!==G.System)throw Error(`promptRunMessages[0].role is expected to be = ${G.System}`);if(n.promptRunMessages[n.promptRunMessages.length-1].role!==G.Assistant)throw Error(`promptRunMessages[${n.promptRunMessages.length-1}].role is expected to be = ${G.Assistant}`);let a=n.promptRunMessages[n.promptRunMessages.length-1].content,o;try{o=this.parseAiResponse(e,a)}catch(e){throw await V(this.graphQLClient,{productArea:K.PromptManager,...n,name:r,error:e.message,status:J.Error,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:i.id,promptRunMessages:n.promptRunMessages.map((e,t)=>({...e,...t===0?{template:i.content}:{}}))}),e}let s=await V(this.graphQLClient,{productArea:K.PromptManager,...n,name:r,status:J.Resolved,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:i.id,promptRunMessages:n.promptRunMessages.map((e,t)=>({...e,...t===0?{template:i.content}:{}}))});return{result:o,promptRunId:s,promptRunUrl:`https://app.transcend.io/prompts/runs/${s}`}}async reportPromptRunError(e,{largeLanguageModel:t,...n}){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let r=n.name||`@transcend-io/cli-prompt-run-${new Date().toISOString()}`;if(!this.promptContentMap)throw Error(`Expected this.promptContentMap to be defined`);let i=this.promptContentMap[e];if(!i)throw Error(`Expected this.prompts[${e}] to be defined`);if(n.promptRunMessages.length===0)throw Error(`promptRunMessages is expected to have length > 0`);if(n.promptRunMessages[0].role!==G.System)throw Error(`promptRunMessages[0].role is expected to be = ${G.System}`);let a=await V(this.graphQLClient,{productArea:K.PromptManager,...n,name:r,status:J.Error,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:i.id,promptRunMessages:n.promptRunMessages.map((e,t)=>({...e,...t===0?{template:i.content}:{}}))});return{promptRunId:a,promptRunUrl:`https://app.transcend.io/prompts/runs/${a}`}}};function xl(e){return e.replace(/(https?:\/\/[^\s]+)/g,`<link-omitted>`)}function Sl(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 Cl({baseBranch:e,rootDirectory:t,githubRepo:n,excludedGlob:r=[],fileBlockList:i=[]}){Q(`git fetch origin ${e}`);let a=Q(`git ls-remote ${n} "refs/heads/${e}" | cut -f 1`,{encoding:`utf-8`}).split(`
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,t as a}from"./enums-CyFTrzXY.mjs";import{a as o,c as s,d as c,f as l,h as ee,i as te,l as ne,m as re,n as ie,o as ae,p as oe,r as se,s as ce,t as le,u as ue}from"./constants-CnLQtIBn.mjs";import"./logger-Bj782ZYD.mjs";import{n as de,t as fe}from"./buildAIIntegrationType-Bk0EbFKV.mjs";import{$ as pe,A as me,B as he,C as ge,D as _e,E as ve,F as u,G as d,H as f,I as p,J as m,K as h,L as g,M as _,N as v,O as y,P as b,Q as x,R as S,S as C,T as w,U as T,V as E,W as D,X as O,Y as k,Z as A,_ as j,_t as M,a as N,at as P,b as F,c as ye,ct as be,d as xe,dt as Se,et as Ce,f as we,ft as Te,g as Ee,gt as De,h as Oe,ht as ke,i as Ae,it as je,j as Me,k as Ne,l as Pe,lt as Fe,m as Ie,mt as Le,n as Re,nt as ze,o as Be,ot as Ve,p as He,pt as Ue,q as We,r as Ge,rt as Ke,s as qe,st as Je,t as Ye,tt as Xe,u as Ze,ut as Qe,v as $e,vt as et,w as tt,x as nt,y as rt,yt as it,z as at}from"./codecs-TR6p48v3.mjs";import{a as ot,i as st,n as ct,r as lt,t as ut}from"./readTranscendYaml-DhKG1ViI.mjs";import{$ as dt,$a as ft,$i as pt,$n as mt,$o as ht,$r as gt,$t as _t,A as vt,Aa as yt,Ai as bt,An as xt,Ao as St,Ar as Ct,At as wt,B as Tt,Ba as Et,Bi as Dt,Bn as Ot,Bo as kt,Br as At,Bt as jt,C as Mt,Ca as Nt,Ci as Pt,Cn as Ft,Co as It,Cr as Lt,Cs as Rt,Ct as zt,D as Bt,Da as Vt,Di as Ht,Dn as Ut,Do as Wt,Dr as Gt,Ds as Kt,Dt as qt,E as Jt,Ea as Yt,Ei as Xt,En as Zt,Eo as Qt,Er as $t,Es as en,Et as tn,F as nn,Fa as rn,Fi as an,Fn as on,Fo as sn,Fr as cn,Ft as ln,G as un,Ga as dn,Gi as fn,Gn as pn,Go as mn,Gr as hn,Gt as gn,H as _n,Ha as vn,Hi as yn,Hn as bn,Ho as xn,Hr as Sn,Ht as Cn,I as wn,Ia as Tn,Ii as En,In as Dn,Io as On,Ir as kn,It as An,J as jn,Ja as Mn,Ji as Nn,Jn as Pn,Jo as Fn,Jr as In,Jt as Ln,K as Rn,Ka as zn,Ki as Bn,Kn as Vn,Ko as Hn,Kr as Un,Kt as Wn,L as Gn,La as Kn,Li as qn,Ln as Jn,Lo as Yn,Lr as Xn,Lt as Zn,M as Qn,Ma as $n,Mi as er,Mn as tr,Mo as nr,Mr as rr,Mt as ir,N as ar,Na as or,Ni as sr,Nn as cr,No as lr,Nr as ur,Nt as dr,O as fr,Oa as pr,Oi as mr,On as hr,Oo as gr,Or as _r,Os as vr,Ot as yr,P as br,Pa as xr,Pi as Sr,Pn as Cr,Po as wr,Pr as Tr,Pt as Er,Q as Dr,Qa as Or,Qi as kr,Qn as I,Qo as Ar,Qr as jr,Qt as Mr,R as Nr,Ra as Pr,Ri as Fr,Rn as Ir,Ro as Lr,Rr,Rt as zr,S as Br,Sa as Vr,Si as Hr,Sn as Ur,So as Wr,Sr as Gr,Ss as Kr,St as qr,T as Jr,Ta as Yr,Ti as Xr,Tn as Zr,To as Qr,Tr as $r,Ts as ei,Tt as ti,U as ni,Ua as ri,Ui as ii,Un as ai,Uo as oi,Ur as si,Ut as ci,V as li,Va as ui,Vi as di,Vn as fi,Vo as pi,Vr as mi,Vt as hi,W as gi,Wa as _i,Wi as vi,Wn as yi,Wo as bi,Wr as xi,Wt as Si,X as Ci,Xa as wi,Xi as L,Xn as R,Xo as Ti,Xr as Ei,Xt as Di,Y as Oi,Ya as ki,Yi as Ai,Yn as ji,Yo as Mi,Yr as z,Yt as Ni,Z as Pi,Za as Fi,Zi as Ii,Zn as Li,Zo as Ri,Zr as B,Zt as zi,_ as Bi,_a as Vi,_i as Hi,_n as V,_o as Ui,_r as Wi,_s as Gi,_t as Ki,a as qi,aa as Ji,ai as H,an as Yi,ao as Xi,ar as Zi,as as Qi,at as $i,b as ea,ba as ta,bi as na,bn as ra,bo as U,br as ia,bs as aa,bt as oa,c as sa,ca,ci as la,cn as ua,co as da,cr as fa,cs as pa,ct as ma,d as ha,da as ga,di as _a,dn as va,do as ya,dr as ba,ds as xa,dt as Sa,ea as Ca,ei as wa,en as Ta,eo as Ea,er as Da,es as Oa,et as ka,f as Aa,fa as ja,fi as Ma,fn as Na,fo as Pa,fr as Fa,fs as Ia,ft as La,g as Ra,ga as za,gi as Ba,gn as Va,go as Ha,gr as Ua,gs as Wa,gt as Ga,h as Ka,ha as qa,hi as Ja,hn as Ya,ho as Xa,hr as Za,hs as Qa,ht as $a,i as W,ia as eo,ii as to,in as no,io as ro,ir as io,is as ao,it as oo,j as so,ja as co,ji as lo,jn as uo,jo as fo,jr as po,js as mo,jt as ho,k as go,ka as _o,ki as vo,kn as yo,ko as bo,kr as xo,ks as So,kt as Co,l as wo,la as To,li as Eo,ln as Do,lo as Oo,lr as ko,ls as Ao,lt as jo,m as Mo,ma as No,mi as Po,mn as Fo,mo as Io,mr as Lo,ms as Ro,mt as zo,n as Bo,na as Vo,ni as Ho,nn as Uo,no as Wo,nr as Go,ns as Ko,nt as qo,o as Jo,oa as Yo,oi as Xo,on as Zo,oo as Qo,or as $o,os as es,ot as ts,p as ns,pa as rs,pi as is,pn as as,po as os,pr as ss,ps as cs,pt as ls,q as us,qa as ds,qi as fs,qn as ps,qo as ms,qr as hs,qt as gs,r as _s,ra as vs,ri as ys,rn as bs,ro as xs,rr as Ss,rs as Cs,rt as ws,s as Ts,sa as Es,si as Ds,sn as Os,so as ks,sr as As,ss as js,st as Ms,t as Ns,ta as Ps,ti as Fs,tn as Is,to as Ls,tr as Rs,ts as zs,tt as Bs,u as Vs,ua as Hs,ui as Us,un as Ws,uo as Gs,ur as Ks,us as qs,ut as Js,v as Ys,va as Xs,vi as Zs,vn as Qs,vo as $s,vr as ec,vs as tc,vt as nc,w as rc,wa as ic,wi as ac,wn as oc,wo as sc,wr as cc,ws as lc,wt as uc,x as dc,xa as fc,xi as pc,xn as mc,xo as hc,xr as gc,xs as _c,xt as vc,y as yc,ya as bc,yi as xc,yn as Sc,yo as Cc,yr as wc,ys as Tc,yt as Ec,z as Dc,za as Oc,zi as kc,zn as Ac,zo as jc,zr as Mc,zt as Nc}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{t as Pc}from"./mergeTranscendInputs-Coj_e2N3.mjs";import{a as Fc,c as Ic,i as Lc,n as Rc,o as zc,r as Bc,s as Vc,t as Hc}from"./consent-manager-c4bgQF1N.mjs";import{i as Uc,n as Wc,r as Gc,t as Kc}from"./uploadConsents-C1S-BNzw.mjs";import{a as qc,i as Jc,n as Yc,o as Xc,r as Zc,s as Qc,t as $c}from"./cron-BvxWyvDu.mjs";import{i as el,n as tl,r as nl,t as rl}from"./api-keys-CxvKdj2v.mjs";import{n as il,t as al}from"./data-inventory-CkS_kmus.mjs";import{i as ol,n as sl,r as cl,t as ll}from"./manual-enrichment-B6lW5kAX.mjs";import{ChatCompletionRole as G,PromptRunProductArea as K,PromptStatus as q,QueueStatus as J}from"@transcend-io/privacy-types";import{chunk as ul,difference as dl,groupBy as fl,keyBy as Y,uniq as pl}from"lodash-es";import{apply as ml,decodeCodec as X,getValues as hl}from"@transcend-io/type-utils";import{createHandlebarsWithHelpers as Z}from"@transcend-io/handlebars-utils";import gl from"fast-glob";import{execSync as Q}from"child_process";async function _l(e){let t=[],n=0,r=!1;do{let{largeLanguageModels:{nodes:i}}=await W(e,L,{first:20,offset:n});t.push(...i),n+=20,r=i.length===20}while(r);return t.sort((e,t)=>e.name.localeCompare(t.name))}function $(e){return RegExp(`<${e}>([\\s\\S]+?)<\\/${e}>`)}function vl(e){return e}const yl=e=>{try{return JSON.parse(e)}catch{return e}};var bl=class{prompts;handlebarsOptions;promptContentMap;largeLanguageModels=[];agentsByName={};agentsByAgentId={};graphQLClient;defaultVariables;variables;handlebars;transcendApiKey;transcendUrl;requireApproval;cacheDuration;lastUpdatedAt;constructor({prompts:e,handlebarsOptions:t={},transcendUrl:n=o,transcendApiKey:r,requireApproval:i=!0,cacheDuration:a,defaultVariables:s={}}){this.prompts=e,this.transcendUrl=n,this.transcendApiKey=r,this.variables=s,this.defaultVariables=s,this.graphQLClient=H(n,typeof r==`object`?r.release():r),this.requireApproval=i,this.cacheDuration=a,this.handlebarsOptions=t,this.handlebars=Z(t)}async fetchPromptsAndMetadata(){let e=hl(this.prompts),t=e.map(({id:e})=>e).filter(e=>!!e),n=e.map(({title:e})=>e).filter(e=>!!e),r=pl(e.map(({agentNames:e})=>e||[]).flat()),[i,a,o]=await Promise.all([I(this.graphQLClient,{promptIds:t,promptTitles:n}),_l(this.graphQLClient),z(this.graphQLClient,{names:r})]);this.agentsByName=Y(o,`name`),this.agentsByAgentId=Y(o,`agentId`),this.largeLanguageModels=a.filter(e=>e.isTranscendHosted===!1);let s=Y(i.prompts,`title`),c=Y(i.prompts,`id`);return this.variables={...i.calculatedVariables.reduce((e,t)=>Object.assign(e,{[t.name]:t.data?JSON.parse(t.data):t.data}),{}),...this.defaultVariables},this.handlebars=Z({...this.handlebarsOptions,templates:[...this.handlebarsOptions.templates||[],...i.promptPartials.map(e=>({name:e.slug,content:e.content}))]}),this.promptContentMap=ml(this.prompts,({id:e,title:t})=>{let n=e?c[e]:t?s[t]:void 0;if(!n)throw Error(`Failed to find prompt with title: "${t}" and id: "${e}"`);return n}),this.lastUpdatedAt=new Date,i}async getAgentByName(e){let t=this.agentsByName[e];if(t)return t;let[n]=await z(this.graphQLClient,{names:[e]});if(n)return this.agentsByName[n.name]=n,this.agentsByAgentId[n.agentId]=n,n}async getPromptThreadBySlackTs(e){let[t]=await R(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:n=[]}=fl(e,e=>this.agentsByName[e]?`hasCache`:`missingCache`),r=t.map(e=>this.agentsByName[e]);if(n.length===0)return r;let i=ul(n,50),a=[];return await mo(i,async e=>{let t=await z(this.graphQLClient,{names:e});t.forEach(e=>{this.agentsByName[e.name]=e,this.agentsByAgentId[e.agentId]=e}),a.push(...t)}),[...r,...a]}getAgentFiles(e){return B(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!==q.Approved)throw Error(`Assessment "${n.title}" cannot be used because its in status: "${n.status}"`);if(n.status===q.Rejected)throw Error(`Assessment "${n.title}" cannot be used because it's in status: "${n.status}"`);return X(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&&($(n.extractFromTag).exec(t)||[])[1]||t;return X(n.outputCodec,yl(r),!1)}async reportAndParsePromptRun(e,{largeLanguageModel:t,...n}){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let r=n.name||`@transcend-io/cli-prompt-run-${new Date().toISOString()}`;if(!this.promptContentMap)throw Error(`Expected this.promptContentMap to be defined`);let i=this.promptContentMap[e];if(!i)throw Error(`Expected this.prompts[${e}] to be defined`);if(n.promptRunMessages.length===0)throw Error(`promptRunMessages is expected to have length > 0`);if(n.promptRunMessages[0].role!==G.System)throw Error(`promptRunMessages[0].role is expected to be = ${G.System}`);if(n.promptRunMessages[n.promptRunMessages.length-1].role!==G.Assistant)throw Error(`promptRunMessages[${n.promptRunMessages.length-1}].role is expected to be = ${G.Assistant}`);let a=n.promptRunMessages[n.promptRunMessages.length-1].content,o;try{o=this.parseAiResponse(e,a)}catch(e){throw await V(this.graphQLClient,{productArea:K.PromptManager,...n,name:r,error:e.message,status:J.Error,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:i.id,promptRunMessages:n.promptRunMessages.map((e,t)=>({...e,...t===0?{template:i.content}:{}}))}),e}let s=await V(this.graphQLClient,{productArea:K.PromptManager,...n,name:r,status:J.Resolved,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:i.id,promptRunMessages:n.promptRunMessages.map((e,t)=>({...e,...t===0?{template:i.content}:{}}))});return{result:o,promptRunId:s,promptRunUrl:`https://app.transcend.io/prompts/runs/${s}`}}async reportPromptRunError(e,{largeLanguageModel:t,...n}){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let r=n.name||`@transcend-io/cli-prompt-run-${new Date().toISOString()}`;if(!this.promptContentMap)throw Error(`Expected this.promptContentMap to be defined`);let i=this.promptContentMap[e];if(!i)throw Error(`Expected this.prompts[${e}] to be defined`);if(n.promptRunMessages.length===0)throw Error(`promptRunMessages is expected to have length > 0`);if(n.promptRunMessages[0].role!==G.System)throw Error(`promptRunMessages[0].role is expected to be = ${G.System}`);let a=await V(this.graphQLClient,{productArea:K.PromptManager,...n,name:r,status:J.Error,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:i.id,promptRunMessages:n.promptRunMessages.map((e,t)=>({...e,...t===0?{template:i.content}:{}}))});return{promptRunId:a,promptRunUrl:`https://app.transcend.io/prompts/runs/${a}`}}};function xl(e){return e.replace(/(https?:\/\/[^\s]+)/g,`<link-omitted>`)}function Sl(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 Cl({baseBranch:e,rootDirectory:t,githubRepo:n,excludedGlob:r=[],fileBlockList:i=[]}){Q(`git fetch origin ${e}`);let a=Q(`git ls-remote ${n} "refs/heads/${e}" | cut -f 1`,{encoding:`utf-8`}).split(`
|
|
2
2
|
`)[0],o=Q(`git rev-parse HEAD`,{encoding:`utf-8`}).split(`
|
|
3
3
|
`)[0];if(!a||!o)throw Error(`FAILED TO FIND COMMIT RANGE`);let s=dl(Q(`git fetch && git diff --name-only "${e||a}...${o}" -- ${t}`,{encoding:`utf-8`}).split(`
|
|
4
4
|
`).filter(e=>e),i),c=r.length>0?gl.sync(s,{ignore:r}):s,l={};return c.forEach(e=>{l[e]=Q(`git show ${o}:${e}`,{encoding:`utf-8`})}),{changedFiles:s,fileDiffs:l,repoName:n.split(`/`).pop().split(`.`)[0],commit:o}}export{Es as ACTIONS,ki as ADD_MESSAGES_TO_PROMPT_RUN,Mi as ADD_SILO_DISCOVERY_RESULTS,le as ADMIN_DASH,ie as ADMIN_DASH_DATAPOINTS,se as ADMIN_DASH_INTEGRATIONS,fs as AGENTS,vi as AGENT_FILES,di as AGENT_FUNCTIONS,Ar as API_KEYS,St as APPROVE_PRIVACY_REQUEST,Wr as ASSESSMENTS,It as ASSESSMENT_SECTION_FIELDS,Cc as ASSESSMENT_TEMPLATES,Ii as ASSUME_ROLE,Pr as ATTRIBUTES,mn as ATTRIBUTE_KEYS_REQUESTS,Oc as ATTRIBUTE_VALUES,Ye as ActionInput,Re as ActionItemCollectionInput,Ge as ActionItemInput,Ae as AgentFileInput,N as AgentFunctionInput,Be as AgentInput,qe as ApiKeyInput,on as AssessmentAction,ye as AssessmentAnswerOptionInput,Pe as AssessmentDisplayLogicInput,Ze as AssessmentInput,Dn as AssessmentNestedRule,xe as AssessmentNestedRuleInput,we as AssessmentResourceInput,He as AssessmentRetentionScheduleInput,cr as AssessmentRiskLogic,Jn as AssessmentRule,Ie as AssessmentRuleInput,Ir as AssessmentRuleWithOperands,Ac as AssessmentRuleWithoutOperands,Oe as AssessmentSectionInput,Ee as AssessmentSectionQuestionInput,j as AssessmentTemplateInput,$i as AttestedExtraIdentifiers,$e as AttributeInput,rt as AttributePreview,F as AttributeValueInput,Hi as BLANK,Zs as BULK_APPLY,Fi as BULK_REQUEST_FILES,To as BUSINESS_ENTITIES,nt as BusinessEntityInput,fo as CANCEL_PRIVACY_REQUEST,xc as CAN_APPLY_IN_BULK,Ia as CATALOGS,Xi as CHANGE_REQUEST_DATA_SILO_STATUS,jc as CODE_PACKAGES,ja as CONSENT_MANAGER_ANALYTICS_DATA,rs as CONSENT_PARTITIONS,No as COOKIES,eo as CREATE_ACTION_ITEMS,zn as CREATE_ACTION_ITEM_COLLECTION,Nn as CREATE_AGENT,fn as CREATE_AGENT_FILE,yn as CREATE_AGENT_FUNCTION,ht as CREATE_API_KEY,Et as CREATE_ATTRIBUTE,ui as CREATE_ATTRIBUTE_VALUES,Hs as CREATE_BUSINESS_ENTITY,kt as CREATE_CODE_PACKAGE,qa as CREATE_CONSENT_EXPERIENCE,za as CREATE_CONSENT_MANAGER,Vi as CREATE_CONSENT_PARTITION,Xs as CREATE_DATA_FLOWS,Gi as CREATE_DATA_SILOS,ao as CREATE_DATA_SUBJECT,an as CREATE_DATA_SUB_CATEGORY,cs as CREATE_ENRICHER,pa as CREATE_IDENTIFIER,Ri as CREATE_PREFERENCE_ACCESS_TOKENS,vo as CREATE_PROCESSING_ACTIVITY,er as CREATE_PROCESSING_PURPOSE_SUB_CATEGORY,Oo as CREATE_PROMPT,Gs as CREATE_PROMPT_GROUP,ya as CREATE_PROMPT_PARTIAL,zs as CREATE_REPOSITORY,xn as CREATE_SOFTWARE_DEVELOPMENT_KIT,Wo as CREATE_TEAM,ms as CREATE_TEMPLATE,Fr as CREATE_VENDOR,na as CachedFileState,pc as CachedRequestState,C as CodePackageInput,ge as CodePackageSdk,Hr as ColumnName,tt as ConsentManageExperienceInput,w as ConsentManagerInput,cn as ConsentManagerMetricBin,ve as ConsentManagerServiceMetadata,_e as ConsentPreferenceTopic,y as ConsentPreferenceTopicOptionValue,Ne as ConsentPurpose,me as CookieCsvInput,Me as CookieInput,Xc as CronIdentifier,Jc as CronIdentifierPush,Rt as DATAPOINT_EXPORT,bc as DATA_FLOWS,lc as DATA_POINTS,ei as DATA_POINT_COUNT,tc as DATA_SILOS,Tc as DATA_SILOS_ENRICHED,aa as DATA_SILO_EXPORT,Qi as DATA_SUBJECTS,En as DATA_SUB_CATEGORIES,Aa as DAY_MS,te as DEBUG,o as DEFAULT_TRANSCEND_API,ae as DEFAULT_TRANSCEND_CONSENT_API,Qs as DEFAULT_TRANSCEND_PULL_RESOURCES,Oa as DELETE_API_KEY,vn as DELETE_ATTRIBUTE_VALUE,Ca as DEPLOYED_PRIVACY_CENTER_URL,ta as DEPLOY_CONSENT_MANAGER,kr as DETERMINE_LOGIN_METHOD,_ as DataCategoryGuessInput,v as DataCategoryInput,b as DataCategoryPreviewInput,u as DataCategoryRecommendationInput,p as DataFlowCsvInput,g as DataFlowInput,S as DataSiloInput,at as DataSubjectInput,he as DatapointInput,Ti as ENABLED_PLUGINS,Ro as ENRICHERS,Kr as ENTRY_COUNT,fc as EXPERIENCES,sl as EnrichPrivacyRequest,E as EnricherInput,Vr as FETCH_CONSENT_MANAGER,Nt as FETCH_CONSENT_MANAGER_ID,ic as FETCH_CONSENT_MANAGER_THEME,Ps as FETCH_PRIVACY_CENTER_ID,ns as FIVE_MIN_MS,f as FieldInput,Ji as GLOBAL_ACTION_ITEMS,ds as GLOBAL_ACTION_ITEM_COLLECTIONS,Mo as HOUR_MS,Ao as IDENTIFIERS,Pt as IDENTIFIER_BLOCK_LIST,sc as IMPORT_ONE_TRUST_ASSESSMENT_FORMS,Qa as INITIALIZER,Rc as IP_ADDRESS_REGEX,ac as IS_REQUIRED,T as IdentifierInput,D as ImportOnetrustAssessmentsInput,Bs as IntlMessage,d as IntlMessageInput,L as LARGE_LANGUAGE_MODELS,pt as LOGIN,gr as MESSAGES,qs as NEW_IDENTIFIER_TYPES,Xr as NONE,nr as NOTIFY_ADDITIONAL_TIME,Hn as ORGANIZATION,a as OneTrustFileFormat,n as OneTrustPullResource,i as OneTrustPullSource,h as OpenAIEnabledRoute,We as OpenAIEnabledRoutes,m as OpenAIIntegration,t as OpenAIRouteName,On as POLICIES,U as PREFERENCE_TOPICS,Vo as PRIVACY_CENTER,bt as PROCESSING_ACTIVITIES,sr as PROCESSING_PURPOSE_SUB_CATEGORIES,Pa as PROMPTS,os as PROMPTS_WITH_VARIABLES,Io as PROMPT_GROUPS,Xa as PROMPT_PARTIALS,Lr as PROMPT_THREADS,hc as PURPOSES,_a as ParsedAttributeInput,k as PartitionInput,O as PathfinderPolicy,e as PathfinderPolicyName,A as PathfinderPolicyNameC,x as PathfinderPromptRunMetadata,pe as PolicyInput,Ce as PrivacyCenterInput,Fa as PrivacyRequest,ts as PrivacyRequestInput,Pi as PrivacyRequestResponse,Xe as ProcessingActivityInput,ze as ProcessingPurposeInput,Ke as ProcessingPurposePreviewInput,je as PromptAVendorEmailSettings,P as PromptGroupInput,Ve as PromptInput,Je as PromptPartialInput,Kc as PurposeMap,Qo as REDUCED_REQUESTS_FOR_DATA_SILO_COUNT,Ea as REMOVE_REQUEST_IDENTIFIERS,wi as REPORT_PROMPT_RUN,Ko as REPOSITORIES,lr as REQUESTS,wr as REQUESTS_COUNT,ks as REQUEST_DATA_SILOS,Qr as REQUEST_ENRICHERS,Or as REQUEST_FILES,Ls as REQUEST_IDENTIFIERS,ce as RETRYABLE_BATCH_STATUSES,da as RETRY_REQUEST_DATA_SILO,Qt as RETRY_REQUEST_ENRICHER,Mt as RateCounter,be as RegionInput,Fe as RepositoryInput,qo as RequestFileMetadata,ws as RequestFileMetadataResponse,Ua as RequestIdentifiersResponse,ss as RequestPurposeTrigger,Qe as RiskAssignmentInput,Se as RiskLogicInput,s as SCOPES_BY_TITLE,ne as SCOPE_TITLES,ri as SET_RESOURCE_ATTRIBUTES,Ht as SILO_DISCOVERY_RESULTS,Wt as SKIP_REQUEST_ENRICHER,oi as SOFTWARE_DEVELOPMENT_KITS,mr as SOMBRA_VERSION,en as SUB_DATA_POINTS,Kt as SUB_DATA_POINTS_COUNT,vr as SUB_DATA_POINTS_WITH_GUESSES,Sn as SYNC_ATTRIBUTE_TYPES,Te as SiloDiscoveryResultInput,Ue as SoftwareDevelopmentKitInput,Le as StoredApiKey,Xt as SuccessfulRequest,xs as TEAMS,Fn as TEMPLATES,Yr as TOGGLE_CONSENT_PRECEDENCE,es as TOGGLE_DATA_SUBJECT,Yt as TOGGLE_TELEMETRY_PARTITION_STRATEGY,Vt as TOGGLE_UNKNOWN_COOKIE_POLICY,pr as TOGGLE_UNKNOWN_REQUEST_POLICY,ue as TR_PULL_RESOURCE_SCOPE_MAP,c as TR_PUSH_RESOURCE_SCOPE_MAP,l as TR_YML_RESOURCE_TO_FIELD_NAME,ke as TeamInput,De as TemplateInput,M as TranscendInput,bl as TranscendPromptManager,r as TranscendPullResource,ca as UPDATE_ACTION,Yo as UPDATE_ACTION_ITEMS,Mn as UPDATE_ACTION_ITEM_COLLECTION,Ai as UPDATE_AGENTS,Bn as UPDATE_AGENT_FILES,ii as UPDATE_AGENT_FUNCTIONS,_i as UPDATE_ATTRIBUTE,dn as UPDATE_ATTRIBUTE_VALUES,ga as UPDATE_BUSINESS_ENTITIES,pi as UPDATE_CODE_PACKAGES,_o as UPDATE_CONSENT_EXPERIENCE,yt as UPDATE_CONSENT_MANAGER_DOMAINS,co as UPDATE_CONSENT_MANAGER_PARTITION,$n as UPDATE_CONSENT_MANAGER_THEME,or as UPDATE_CONSENT_MANAGER_TO_LATEST,xr as UPDATE_CONSENT_MANAGER_VERSION,rn as UPDATE_DATA_FLOWS,_c as UPDATE_DATA_SILOS,js as UPDATE_DATA_SUBJECT,qn as UPDATE_DATA_SUB_CATEGORIES,Wa as UPDATE_ENRICHER,xa as UPDATE_IDENTIFIER,bo as UPDATE_INTL_MESSAGES,Tn as UPDATE_LOAD_OPTIONS,Kn as UPDATE_OR_CREATE_COOKIES,So as UPDATE_OR_CREATE_DATA_POINT,Yn as UPDATE_POLICIES,vs as UPDATE_PRIVACY_CENTER,sn as UPDATE_PRIVACY_REQUEST,lo as UPDATE_PROCESSING_ACTIVITIES,Sr as UPDATE_PROCESSING_PURPOSE_SUB_CATEGORIES,Ha as UPDATE_PROMPTS,Ui as UPDATE_PROMPT_GROUPS,$s as UPDATE_PROMPT_PARTIALS,Cs as UPDATE_REPOSITORIES,bi as UPDATE_SOFTWARE_DEVELOPMENT_KITS,ro as UPDATE_TEAM,kc as UPDATE_VENDORS,ft as USERS,Wc as USP_STRING_REGEX,ut as VARIABLE_PARAMETERS_NAME,ct as VARIABLE_PARAMETERS_REGEXP,Dt as VENDORS,et as VendorInput,it as WebhookHeader,Ka as addDaysUtc,Ds as addMessagesToPromptRun,Ra as addMs,qi as appendCsvRowsOrdered,Jo as appendCsvSync,Ci as approvePrivacyRequests,ai as assumeRole,fe as buildAIIntegrationType,de as buildEnabledRouteType,H as buildTranscendGraphQLClient,Xo as buildTranscendGraphQLClientGeneric,Bc as buildXdiSyncEndpoint,_n as bulkRestartRequests,Tt as bulkRetryEnrichers,us as cancelPrivacyRequests,Bi as clampPageSize,dc as collectParquetFilesOrExit,Hc as consentManagersToBusinessEntities,Rs as convertToDataSubjectAllowlist,Go as convertToDataSubjectBlockList,va as createActionItemCollection,ua as createActionItems,_t as createAgent,Yi as createAgentFile,Uo as createAgentFunction,fi as createApiKey,Ni as createBusinessEntity,jt as createCodePackage,Uc as createConsentToken,dr as createDataCategory,wt as createDataFlows,Un as createPreferenceAccessTokens,Ec as createProcessingPurpose,Ga as createPrompt,$ as createRegexForTag,ci as createRepository,Wn as createSoftwareDevelopmentKit,to as createSombraGotInstance,ys as createTranscendConsentGotInstance,ls as createVendor,vl as defineTranscendPrompts,bn as deleteApiKey,Fs as deployConsentManager,re as description,Lc as domainToHost,dt as downloadPrivacyRequestFiles,cl as enrichPrivacyRequest,Ss as ensureAllDataSubjectsExist,un as extractClientError,fr as extractErrorMessage,wa as fetchActiveSiloDiscoPlugin,gt as fetchAllActionItems,jr as fetchAllActions,B as fetchAllAgentFiles,Ei as fetchAllAgentFunctions,z as fetchAllAgents,As as fetchAllApiKeys,hs as fetchAllAssessmentTemplates,In as fetchAllAssessments,si as fetchAllAttributeValues,xi as fetchAllAttributes,mi as fetchAllBusinessEntities,Zi as fetchAllCatalogs,Tr as fetchAllCookies,ur as fetchAllDataCategories,rr as fetchAllDataFlows,Ut as fetchAllDataPoints,hr as fetchAllDataSilos,io as fetchAllDataSubjects,Zr as fetchAllEnrichers,Bo as fetchAllIdentifiers,po as fetchAllMessages,_r as fetchAllPolicies,$t as fetchAllPreferenceTopics,$r as fetchAllPrivacyCenters,cc as fetchAllProcessingActivities,Lt as fetchAllProcessingPurposes,Da as fetchAllPromptGroups,mt as fetchAllPromptPartials,R as fetchAllPromptThreads,Li as fetchAllPrompts,Gr as fetchAllPurposes,gc as fetchAllPurposesAndPreferences,hn as fetchAllRequestAttributeKeys,ia as fetchAllRequestEnrichers,wc as fetchAllRequestIdentifierMetadata,Wi as fetchAllRequestIdentifiers,Lo as fetchAllRequests,ra as fetchAllSiloDiscoveryResults,yo as fetchAllSubDataPoints,ba as fetchAllTeams,Ft as fetchAllTemplates,Ks as fetchAllUsers,ko as fetchAllVendors,$o as fetchAndIndexCatalogs,fa as fetchApiKeys,kn as fetchConsentManager,Xn as fetchConsentManagerAnalyticsData,Rr as fetchConsentManagerExperiences,Mc as fetchConsentManagerId,At as fetchConsentManagerTheme,xt as fetchEnrichedDataSilos,_s as fetchIdentifiersAndCreateMissing,mc as fetchPartitions,xo as fetchPrivacyCenterId,Ct as fetchPrivacyCenterUrl,I as fetchPromptsWithVariables,ps as fetchRequestDataSilo,Vn as fetchRequestDataSiloActiveCount,Pn as fetchRequestDataSilos,ji as fetchRequestDataSilosCount,pn as fetchRequestFilesForRequest,Za as fetchRequestsTotalCount,Sl as filterNullishValuesFromObject,la as filterRows,Gt as formatAttributeValues,Nr as formatRequestForCsv,Ja as fuzzyMatchColumns,Ba as fuzzySearch,el as generateCrossAccountApiKeys,go as getErrorStatus,oo as getFileMetadataForPrivacyRequests,Cl as getGitFilesThatChanged,Eo as getUniqueValuesForColumn,Ts as initCsvFile,so as inquirerAutoComplete,Qn as inquirerConfirmBoolean,ar as inquirerConfirmText,rc as limitRecords,rl as listDirectories,tl as listFiles,yi as loginUser,W as makeGraphQLRequest,Rn as mapColumnsToAttributes,jn as mapColumnsToIdentifiers,Js as mapCsvColumnsToApi,Ms as mapCsvRowsToRequestInputs,Po as mapEnumValues,jo as mapRequestEnumValues,qc as markCronIdentifierCompleted,Yc as markRequestDataSiloIdsCompleted,Sa as markSilentPrivacyRequests,Pc as mergeTranscendInputs,oe as name,ma as normalizeIdentifierValue,Oi as notifyPrivacyRequestsAdditionalTime,ea as parquetToCsvOneFile,Ot as parseAssessmentDisplayLogic,Cr as parseAssessmentRiskLogic,Ma as parseAttributesFromString,sa as parseFilePath,vt as parseVariablesFromString,il as pullAllDatapoints,$c as pullChunkedCustomSiloOutstandingIdentifiers,Fc as pullConsentManagerMetrics,Qc as pullCronPageOfIdentifiers,ol as pullManualEnrichmentIdentifiersToCsv,Gn as pullPrivacyRequests,Sc as pullTranscendConfiguration,al as pullUnstructuredSubDataPointRecommendations,Zc as pushCronIdentifiersFromCsv,ll as pushManualEnrichmentIdentifiersFromCsv,Us as readCsv,Br as readSafe,lt as readTranscendYaml,xl as removeLinks,br as removeUnverifiedRequestIdentifiers,st as replaceVariablesInYaml,V as reportPromptRun,ni as restartPrivacyRequest,Dc as retryRequestDataSilos,Va as retryRequestEnricher,Jr as retrySamePromise,Ya as setResourceAttributes,li as skipPreflightJobs,nn as skipRequestDataSilos,Bt as sleepPromise,is as splitCsvToList,Jt as splitInHalf,Ys as startOfHour,yc as startOfUtcDay,ka as streamPrivacyRequestFiles,wn as streamPrivacyRequestsToCsv,Dr as submitPrivacyRequest,Fo as syncAction,Na as syncActionItemCollections,Do as syncActionItems,Zo as syncAgentFiles,bs as syncAgentFunctions,Ta as syncAgents,Mr as syncAttribute,Di as syncBusinessEntities,hi as syncCodePackages,Ns as syncConfigurationToTranscend,zr as syncConsentManager,Nc as syncConsentManagerExperiences,An as syncCookies,Er as syncDataCategories,ho as syncDataFlows,uo as syncDataSiloDependencies,tr as syncDataSilos,Co as syncDataSubject,Zt as syncEnricher,yr as syncIdentifier,tn as syncIntlMessages,Ur as syncPartitions,uc as syncPolicies,zt as syncPrivacyCenter,qr as syncProcessingActivities,oa as syncProcessingPurposes,Ki as syncPrompts,Si as syncRepositories,gs as syncSoftwareDevelopmentKits,oc as syncTemplate,zo as syncVendors,Ws as updateActionItem,as as updateActionItemCollection,Os as updateAgentFiles,no as updateAgentFunctions,Is as updateAgents,zi as updateBusinessEntities,Cn as updateCodePackages,Ho as updateConsentManagerToLatest,Ic as updateConsentManagerVersionToLatest,ln as updateDataCategories,ir as updateDataFlows,qt as updateIntlMessages,Zn as updateOrCreateCookies,ti as updatePolicies,vc as updateProcessingPurposes,nc as updatePrompts,gn as updateRepositories,Ln as updateSoftwareDevelopmentKits,$a as updateVendors,Gc as uploadConsents,zc as uploadCookiesFromCsv,Vc as uploadDataFlowsFromCsv,gi as uploadPrivacyRequestsFromCsv,La as uploadSiloDiscoveryResults,ec as validateSombraVersion,nl as validateTranscendAuth,ee as version,wo as writeCsv,Vs as writeCsvSync,ha as writeLargeCsv,ot as writeTranscendYaml};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./constants-
|
|
2
|
-
//# sourceMappingURL=manual-enrichment-
|
|
1
|
+
import{a as e}from"./constants-CnLQtIBn.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{As as n,Fo as r,_r as i,ai as a,br as o,i as s,ii as c,l,mr as u,pi as d,ui as f,vr as p}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{RequestStatus as m}from"@transcend-io/privacy-types";import{groupBy as h,uniq as g}from"lodash-es";import _ from"colors";import*as v from"io-ts";async function y({file:r,auth:s,sombraAuth:d,requestActions:f=[],concurrency:v=100,transcendUrl:y=e}){let b=a(y,s),x=await c(y,s,d);t.info(_.magenta(`Pulling manual enrichment requests, filtered for actions: ${f.join(`,`)}`));let S=await u(b,{actions:f,statuses:[m.Enriching]});await p(b);let C=[];await n(S,async e=>{let t=await o(b,{requestId:e.id});if(t.filter(({status:e})=>e===`ACTION_REQUIRED`)){let n=await i(b,x,{requestId:e.id,skipSombraCheck:!0});C.push({...e,requestIdentifiers:n,requestEnrichers:t})}},{concurrency:v});let w=C.map(({attributeValues:e,requestIdentifiers:t,requestEnrichers:n,...r})=>({...r,...Object.entries(h(t,`name`)).reduce((e,[t,n])=>Object.assign(e,{[t]:n.map(({value:e})=>e).join(`,`)}),{}),...Object.entries(h(e,`attributeKey.name`)).reduce((e,[t,n])=>Object.assign(e,{[t]:n.map(({name:e})=>e).join(`,`)}),{})}));return await l(r,w,g(w.map(e=>Object.keys(e)).flat())),t.info(_.green(`Successfully wrote ${C.length} requests to file "${r}"`)),C}const b=`https://app.transcend.io/privacy-requests/incoming-requests/`,x=v.record(v.string,v.string);async function S(e,{id:n,...r},i,a){if(!n){let e=`Request ID must be provided to enricher request.${a?` Found error in row: ${a}`:``}`;throw t.error(_.red(e)),Error(e)}let o=n.toLowerCase(),s=Object.entries(r).reduce((e,[t,n])=>g(d(n)).length===0?e:Object.assign(e,{[t]:g(d(n)).map(e=>({value:t===`email`?e.toLowerCase():e}))}),{});try{return await e.post(`v1/enrich-identifiers`,{headers:{"x-transcend-request-id":o,"x-transcend-enricher-id":i},json:{enrichedIdentifiers:s}}).json(),t.error(_.green(`Successfully enriched request: ${b}${o}`)),!0}catch(e){if(typeof e.response.body==`string`&&e.response.body.includes(`Cannot update a resolved RequestEnricher`))return t.warn(_.magenta(`Skipped enrichment for request: ${b}${o}, request is no longer in the enriching phase.`)),!1;throw t.error(_.red(`Failed to enricher identifiers for request with id: ${b}${o} - ${e.message} - ${e.response.body}`)),e}}async function C({file:i,auth:o,sombraAuth:l,enricherId:u,markSilent:d,concurrency:p=100,transcendUrl:m=e}){let h=await c(m,o,l),g=a(m,o);t.info(_.magenta(`Reading "${i}" from disk`));let v=f(i,x);t.info(_.magenta(`Enriching "${v.length}" privacy requests.`));let y=0,b=0,C=0;if(await n(v,async(e,n)=>{try{d&&(await s(g,r,{input:{id:e.id,isSilent:!0}}),t.info(_.magenta(`Mark request as silent mode - ${e.id}`))),await S(h,e,u,n)?y+=1:b+=1}catch{C+=1}},{concurrency:p}),t.info(_.green(`Successfully notified Transcend! \n Success count: ${y}.`)),b>0&&t.info(_.magenta(`Skipped count: ${b}.`)),C>0)throw t.info(_.red(`Error Count: ${C}.`)),Error(`Failed to enrich: ${C} requests.`);return v.length}export{y as i,x as n,S as r,C as t};
|
|
2
|
+
//# sourceMappingURL=manual-enrichment-B6lW5kAX.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manual-enrichment-CYoZNBjO.mjs","names":[],"sources":["../src/lib/manual-enrichment/pullManualEnrichmentIdentifiersToCsv.ts","../src/lib/manual-enrichment/enrichPrivacyRequest.ts","../src/lib/manual-enrichment/pushManualEnrichmentIdentifiersFromCsv.ts"],"sourcesContent":["import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { map } from '../bluebird';\nimport colors from 'colors';\nimport { groupBy, uniq } from 'lodash-es';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\nimport { writeCsv } from '../helpers/writeCsv';\nimport {\n PrivacyRequest,\n RequestEnricher,\n RequestIdentifier,\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n fetchAllRequestEnrichers,\n fetchAllRequestIdentifiers,\n fetchAllRequests,\n validateSombraVersion,\n} from '../graphql';\nimport { logger } from '../../logger';\n\nexport interface PrivacyRequestWithIdentifiers extends PrivacyRequest {\n /** Request Enrichers */\n requestEnrichers: RequestEnricher[];\n /** Request Identifiers */\n requestIdentifiers: RequestIdentifier[];\n}\n\n/**\n * Pull the set of manual enrichment jobs to CSV\n *\n * @param options - Options\n * @returns List of requests with identifiers\n */\nexport async function pullManualEnrichmentIdentifiersToCsv({\n file,\n auth,\n sombraAuth,\n requestActions = [],\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** Sombra API key */\n sombraAuth?: string;\n /** Concurrency */\n concurrency?: number;\n /** The request actions to fetch */\n requestActions?: RequestAction[];\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<PrivacyRequestWithIdentifiers[]> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const sombra = await createSombraGotInstance(transcendUrl, auth, sombraAuth);\n\n logger.info(\n colors.magenta(\n `Pulling manual enrichment requests, filtered for actions: ${requestActions.join(\n ',',\n )}`,\n ),\n );\n\n // Pull all privacy requests\n const allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n statuses: [RequestStatus.Enriching],\n });\n\n await validateSombraVersion(client);\n\n // Requests to save\n const savedRequests: PrivacyRequestWithIdentifiers[] = [];\n\n // Filter down requests to what is needed\n await map(\n allRequests,\n async (request) => {\n // Fetch enrichers\n const requestEnrichers = await fetchAllRequestEnrichers(client, {\n requestId: request.id,\n });\n\n // Check if manual enrichment exists for that request\n const hasManualEnrichment = requestEnrichers.filter(\n ({ status }) => status === 'ACTION_REQUIRED',\n );\n\n // Save request to queue\n if (hasManualEnrichment) {\n const requestIdentifiers = await fetchAllRequestIdentifiers(\n client,\n sombra,\n {\n requestId: request.id,\n skipSombraCheck: true,\n },\n );\n savedRequests.push({\n ...request,\n requestIdentifiers,\n requestEnrichers,\n });\n }\n },\n {\n concurrency,\n },\n );\n\n const data = savedRequests.map(\n ({\n attributeValues,\n requestIdentifiers,\n requestEnrichers, // eslint-disable-line @typescript-eslint/no-unused-vars\n ...request\n }) => ({\n ...request,\n // flatten identifiers\n ...Object.entries(groupBy(requestIdentifiers, 'name')).reduce(\n (acc, [key, values]) =>\n Object.assign(acc, {\n [key]: values.map(({ value }) => value).join(','),\n }),\n {},\n ),\n // flatten attributes\n ...Object.entries(groupBy(attributeValues, 'attributeKey.name')).reduce(\n (acc, [key, values]) =>\n Object.assign(acc, {\n [key]: values.map(({ name }) => name).join(','),\n }),\n {},\n ),\n }),\n );\n\n // Write out to CSV\n const headers = uniq(data.map((d) => Object.keys(d)).flat());\n await writeCsv(file, data, headers);\n\n logger.info(\n colors.green(\n `Successfully wrote ${savedRequests.length} requests to file \"${file}\"`,\n ),\n );\n\n return savedRequests;\n}\n","import type { Got } from 'got';\nimport * as t from 'io-ts';\nimport { logger } from '../../logger';\nimport { uniq } from 'lodash-es';\nimport colors from 'colors';\nimport { splitCsvToList } from '../requests/splitCsvToList';\n\nconst ADMIN_URL =\n 'https://app.transcend.io/privacy-requests/incoming-requests/';\n/**\n * Minimal set required to mark as completed\n */\nexport const EnrichPrivacyRequest = t.record(t.string, t.string);\n\n/** Type override */\nexport type EnrichPrivacyRequest = t.TypeOf<typeof EnrichPrivacyRequest>;\n\n/**\n * Upload identifiers to a privacy request or mark request as\n *\n * @param sombra - Sombra instance configured to make requests\n * @param request - Request to enricher\n * @param enricherId - The ID of the enricher being uploaded to\n * @param index - Index of request ID\n * @returns True if enriched successfully, false if skipped, throws error if failed\n */\nexport async function enrichPrivacyRequest(\n sombra: Got,\n { id: rawId, ...rest }: EnrichPrivacyRequest,\n enricherId: string,\n index?: number,\n): Promise<boolean> {\n if (!rawId) {\n // error\n const msg = `Request ID must be provided to enricher request.${\n index ? ` Found error in row: ${index}` : ''\n }`;\n logger.error(colors.red(msg));\n throw new Error(msg);\n }\n\n const id = rawId.toLowerCase();\n\n // Pull out the identifiers\n const enrichedIdentifiers = Object.entries(rest).reduce(\n (acc, [key, value]) => {\n const values = uniq(splitCsvToList(value));\n return values.length === 0\n ? acc\n : Object.assign(acc, {\n [key]: uniq(splitCsvToList(value)).map((val) => ({\n value: key === 'email' ? val.toLowerCase() : val,\n })),\n });\n },\n {} as Record<string, string[]>,\n );\n\n // Make the GraphQL request\n try {\n await sombra\n .post('v1/enrich-identifiers', {\n headers: {\n 'x-transcend-request-id': id,\n 'x-transcend-enricher-id': enricherId,\n },\n json: {\n enrichedIdentifiers,\n },\n })\n .json();\n\n logger.error(\n colors.green(`Successfully enriched request: ${ADMIN_URL}${id}`),\n );\n return true;\n } catch (err) {\n // skip if already enriched\n if (\n typeof err.response.body === 'string' &&\n err.response.body.includes('Cannot update a resolved RequestEnricher')\n ) {\n logger.warn(\n colors.magenta(\n `Skipped enrichment for request: ${ADMIN_URL}${id}, request is no longer in the enriching phase.`,\n ),\n );\n return false;\n }\n\n // error\n logger.error(\n colors.red(\n `Failed to enricher identifiers for request with id: ${ADMIN_URL}${id} - ${err.message} - ${err.response.body}`,\n ),\n );\n throw err;\n }\n}\n","import colors from 'colors';\nimport { map } from '../bluebird';\nimport { logger } from '../../logger';\nimport {\n UPDATE_PRIVACY_REQUEST,\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n makeGraphQLRequest,\n} from '../graphql';\nimport {\n enrichPrivacyRequest,\n EnrichPrivacyRequest,\n} from './enrichPrivacyRequest';\nimport { readCsv } from '../requests';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\n\n/**\n * Push a CSV of enriched requests back into Transcend\n *\n * @param options - Options\n * @returns Number of items processed\n */\nexport async function pushManualEnrichmentIdentifiersFromCsv({\n file,\n auth,\n sombraAuth,\n enricherId,\n markSilent,\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** ID of enricher being uploaded to */\n enricherId: string;\n /** Sombra API key authentication */\n sombraAuth?: string;\n /** Concurrency */\n concurrency?: number;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** Mark requests in silent mode before enriching */\n markSilent?: boolean;\n}): Promise<number> {\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, sombraAuth);\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read from CSV\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const activeResults = readCsv(file, EnrichPrivacyRequest);\n\n // Notify Transcend\n logger.info(\n colors.magenta(`Enriching \"${activeResults.length}\" privacy requests.`),\n );\n\n let successCount = 0;\n let skippedCount = 0;\n let errorCount = 0;\n\n await map(\n activeResults,\n async (request, index) => {\n try {\n // Mark requests in silent mode before a certain date\n if (markSilent) {\n await makeGraphQLRequest(client, UPDATE_PRIVACY_REQUEST, {\n input: {\n id: request.id,\n isSilent: true,\n },\n });\n\n logger.info(\n colors.magenta(`Mark request as silent mode - ${request.id}`),\n );\n }\n\n const result = await enrichPrivacyRequest(\n sombra,\n request,\n enricherId,\n index,\n );\n if (result) {\n successCount += 1;\n } else {\n skippedCount += 1;\n }\n } catch (err) {\n errorCount += 1;\n }\n },\n { concurrency },\n );\n\n logger.info(\n colors.green(\n `Successfully notified Transcend! \\n Success count: ${successCount}.`,\n ),\n );\n\n if (skippedCount > 0) {\n logger.info(colors.magenta(`Skipped count: ${skippedCount}.`));\n }\n\n if (errorCount > 0) {\n logger.info(colors.red(`Error Count: ${errorCount}.`));\n throw new Error(`Failed to enrich: ${errorCount} requests.`);\n }\n\n return activeResults.length;\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"manual-enrichment-B6lW5kAX.mjs","names":[],"sources":["../src/lib/manual-enrichment/pullManualEnrichmentIdentifiersToCsv.ts","../src/lib/manual-enrichment/enrichPrivacyRequest.ts","../src/lib/manual-enrichment/pushManualEnrichmentIdentifiersFromCsv.ts"],"sourcesContent":["import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { map } from '../bluebird';\nimport colors from 'colors';\nimport { groupBy, uniq } from 'lodash-es';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\nimport { writeCsv } from '../helpers/writeCsv';\nimport {\n PrivacyRequest,\n RequestEnricher,\n RequestIdentifier,\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n fetchAllRequestEnrichers,\n fetchAllRequestIdentifiers,\n fetchAllRequests,\n validateSombraVersion,\n} from '../graphql';\nimport { logger } from '../../logger';\n\nexport interface PrivacyRequestWithIdentifiers extends PrivacyRequest {\n /** Request Enrichers */\n requestEnrichers: RequestEnricher[];\n /** Request Identifiers */\n requestIdentifiers: RequestIdentifier[];\n}\n\n/**\n * Pull the set of manual enrichment jobs to CSV\n *\n * @param options - Options\n * @returns List of requests with identifiers\n */\nexport async function pullManualEnrichmentIdentifiersToCsv({\n file,\n auth,\n sombraAuth,\n requestActions = [],\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** Sombra API key */\n sombraAuth?: string;\n /** Concurrency */\n concurrency?: number;\n /** The request actions to fetch */\n requestActions?: RequestAction[];\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<PrivacyRequestWithIdentifiers[]> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const sombra = await createSombraGotInstance(transcendUrl, auth, sombraAuth);\n\n logger.info(\n colors.magenta(\n `Pulling manual enrichment requests, filtered for actions: ${requestActions.join(\n ',',\n )}`,\n ),\n );\n\n // Pull all privacy requests\n const allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n statuses: [RequestStatus.Enriching],\n });\n\n await validateSombraVersion(client);\n\n // Requests to save\n const savedRequests: PrivacyRequestWithIdentifiers[] = [];\n\n // Filter down requests to what is needed\n await map(\n allRequests,\n async (request) => {\n // Fetch enrichers\n const requestEnrichers = await fetchAllRequestEnrichers(client, {\n requestId: request.id,\n });\n\n // Check if manual enrichment exists for that request\n const hasManualEnrichment = requestEnrichers.filter(\n ({ status }) => status === 'ACTION_REQUIRED',\n );\n\n // Save request to queue\n if (hasManualEnrichment) {\n const requestIdentifiers = await fetchAllRequestIdentifiers(\n client,\n sombra,\n {\n requestId: request.id,\n skipSombraCheck: true,\n },\n );\n savedRequests.push({\n ...request,\n requestIdentifiers,\n requestEnrichers,\n });\n }\n },\n {\n concurrency,\n },\n );\n\n const data = savedRequests.map(\n ({\n attributeValues,\n requestIdentifiers,\n requestEnrichers, // eslint-disable-line @typescript-eslint/no-unused-vars\n ...request\n }) => ({\n ...request,\n // flatten identifiers\n ...Object.entries(groupBy(requestIdentifiers, 'name')).reduce(\n (acc, [key, values]) =>\n Object.assign(acc, {\n [key]: values.map(({ value }) => value).join(','),\n }),\n {},\n ),\n // flatten attributes\n ...Object.entries(groupBy(attributeValues, 'attributeKey.name')).reduce(\n (acc, [key, values]) =>\n Object.assign(acc, {\n [key]: values.map(({ name }) => name).join(','),\n }),\n {},\n ),\n }),\n );\n\n // Write out to CSV\n const headers = uniq(data.map((d) => Object.keys(d)).flat());\n await writeCsv(file, data, headers);\n\n logger.info(\n colors.green(\n `Successfully wrote ${savedRequests.length} requests to file \"${file}\"`,\n ),\n );\n\n return savedRequests;\n}\n","import type { Got } from 'got';\nimport * as t from 'io-ts';\nimport { logger } from '../../logger';\nimport { uniq } from 'lodash-es';\nimport colors from 'colors';\nimport { splitCsvToList } from '../requests/splitCsvToList';\n\nconst ADMIN_URL =\n 'https://app.transcend.io/privacy-requests/incoming-requests/';\n/**\n * Minimal set required to mark as completed\n */\nexport const EnrichPrivacyRequest = t.record(t.string, t.string);\n\n/** Type override */\nexport type EnrichPrivacyRequest = t.TypeOf<typeof EnrichPrivacyRequest>;\n\n/**\n * Upload identifiers to a privacy request or mark request as\n *\n * @param sombra - Sombra instance configured to make requests\n * @param request - Request to enricher\n * @param enricherId - The ID of the enricher being uploaded to\n * @param index - Index of request ID\n * @returns True if enriched successfully, false if skipped, throws error if failed\n */\nexport async function enrichPrivacyRequest(\n sombra: Got,\n { id: rawId, ...rest }: EnrichPrivacyRequest,\n enricherId: string,\n index?: number,\n): Promise<boolean> {\n if (!rawId) {\n // error\n const msg = `Request ID must be provided to enricher request.${\n index ? ` Found error in row: ${index}` : ''\n }`;\n logger.error(colors.red(msg));\n throw new Error(msg);\n }\n\n const id = rawId.toLowerCase();\n\n // Pull out the identifiers\n const enrichedIdentifiers = Object.entries(rest).reduce(\n (acc, [key, value]) => {\n const values = uniq(splitCsvToList(value));\n return values.length === 0\n ? acc\n : Object.assign(acc, {\n [key]: uniq(splitCsvToList(value)).map((val) => ({\n value: key === 'email' ? val.toLowerCase() : val,\n })),\n });\n },\n {} as Record<string, string[]>,\n );\n\n // Make the GraphQL request\n try {\n await sombra\n .post('v1/enrich-identifiers', {\n headers: {\n 'x-transcend-request-id': id,\n 'x-transcend-enricher-id': enricherId,\n },\n json: {\n enrichedIdentifiers,\n },\n })\n .json();\n\n logger.error(\n colors.green(`Successfully enriched request: ${ADMIN_URL}${id}`),\n );\n return true;\n } catch (err) {\n // skip if already enriched\n if (\n typeof err.response.body === 'string' &&\n err.response.body.includes('Cannot update a resolved RequestEnricher')\n ) {\n logger.warn(\n colors.magenta(\n `Skipped enrichment for request: ${ADMIN_URL}${id}, request is no longer in the enriching phase.`,\n ),\n );\n return false;\n }\n\n // error\n logger.error(\n colors.red(\n `Failed to enricher identifiers for request with id: ${ADMIN_URL}${id} - ${err.message} - ${err.response.body}`,\n ),\n );\n throw err;\n }\n}\n","import colors from 'colors';\nimport { map } from '../bluebird';\nimport { logger } from '../../logger';\nimport {\n UPDATE_PRIVACY_REQUEST,\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n makeGraphQLRequest,\n} from '../graphql';\nimport {\n enrichPrivacyRequest,\n EnrichPrivacyRequest,\n} from './enrichPrivacyRequest';\nimport { readCsv } from '../requests';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\n\n/**\n * Push a CSV of enriched requests back into Transcend\n *\n * @param options - Options\n * @returns Number of items processed\n */\nexport async function pushManualEnrichmentIdentifiersFromCsv({\n file,\n auth,\n sombraAuth,\n enricherId,\n markSilent,\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** ID of enricher being uploaded to */\n enricherId: string;\n /** Sombra API key authentication */\n sombraAuth?: string;\n /** Concurrency */\n concurrency?: number;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** Mark requests in silent mode before enriching */\n markSilent?: boolean;\n}): Promise<number> {\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, sombraAuth);\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read from CSV\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const activeResults = readCsv(file, EnrichPrivacyRequest);\n\n // Notify Transcend\n logger.info(\n colors.magenta(`Enriching \"${activeResults.length}\" privacy requests.`),\n );\n\n let successCount = 0;\n let skippedCount = 0;\n let errorCount = 0;\n\n await map(\n activeResults,\n async (request, index) => {\n try {\n // Mark requests in silent mode before a certain date\n if (markSilent) {\n await makeGraphQLRequest(client, UPDATE_PRIVACY_REQUEST, {\n input: {\n id: request.id,\n isSilent: true,\n },\n });\n\n logger.info(\n colors.magenta(`Mark request as silent mode - ${request.id}`),\n );\n }\n\n const result = await enrichPrivacyRequest(\n sombra,\n request,\n enricherId,\n index,\n );\n if (result) {\n successCount += 1;\n } else {\n skippedCount += 1;\n }\n } catch (err) {\n errorCount += 1;\n }\n },\n { concurrency },\n );\n\n logger.info(\n colors.green(\n `Successfully notified Transcend! \\n Success count: ${successCount}.`,\n ),\n );\n\n if (skippedCount > 0) {\n logger.info(colors.magenta(`Skipped count: ${skippedCount}.`));\n }\n\n if (errorCount > 0) {\n logger.info(colors.red(`Error Count: ${errorCount}.`));\n throw new Error(`Failed to enrich: ${errorCount} requests.`);\n }\n\n return activeResults.length;\n}\n"],"mappings":"4XAgCA,eAAsB,EAAqC,CACzD,OACA,OACA,aACA,iBAAiB,EAAE,CACnB,cAAc,IACd,eAAe,GAc4B,CAE3C,IAAM,EAAS,EAA4B,EAAc,EAAK,CACxD,EAAS,MAAM,EAAwB,EAAc,EAAM,EAAW,CAE5E,EAAO,KACL,EAAO,QACL,6DAA6D,EAAe,KAC1E,IACD,GACF,CACF,CAGD,IAAM,EAAc,MAAM,EAAiB,EAAQ,CACjD,QAAS,EACT,SAAU,CAAC,EAAc,UAAU,CACpC,CAAC,CAEF,MAAM,EAAsB,EAAO,CAGnC,IAAM,EAAiD,EAAE,CAGzD,MAAM,EACJ,EACA,KAAO,IAAY,CAEjB,IAAM,EAAmB,MAAM,EAAyB,EAAQ,CAC9D,UAAW,EAAQ,GACpB,CAAC,CAQF,GAL4B,EAAiB,QAC1C,CAAE,YAAa,IAAW,kBAC5B,CAGwB,CACvB,IAAM,EAAqB,MAAM,EAC/B,EACA,EACA,CACE,UAAW,EAAQ,GACnB,gBAAiB,GAClB,CACF,CACD,EAAc,KAAK,CACjB,GAAG,EACH,qBACA,mBACD,CAAC,GAGN,CACE,cACD,CACF,CAED,IAAM,EAAO,EAAc,KACxB,CACC,kBACA,qBACA,mBACA,GAAG,MACE,CACL,GAAG,EAEH,GAAG,OAAO,QAAQ,EAAQ,EAAoB,OAAO,CAAC,CAAC,QACpD,EAAK,CAAC,EAAK,KACV,OAAO,OAAO,EAAK,EAChB,GAAM,EAAO,KAAK,CAAE,WAAY,EAAM,CAAC,KAAK,IAAI,CAClD,CAAC,CACJ,EAAE,CACH,CAED,GAAG,OAAO,QAAQ,EAAQ,EAAiB,oBAAoB,CAAC,CAAC,QAC9D,EAAK,CAAC,EAAK,KACV,OAAO,OAAO,EAAK,EAChB,GAAM,EAAO,KAAK,CAAE,UAAW,EAAK,CAAC,KAAK,IAAI,CAChD,CAAC,CACJ,EAAE,CACH,CACF,EACF,CAYD,OARA,MAAM,EAAS,EAAM,EADL,EAAK,EAAK,IAAK,GAAM,OAAO,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CACzB,CAEnC,EAAO,KACL,EAAO,MACL,sBAAsB,EAAc,OAAO,qBAAqB,EAAK,GACtE,CACF,CAEM,EC9IT,MAAM,EACJ,+DAIW,EAAuB,EAAE,OAAO,EAAE,OAAQ,EAAE,OAAO,CAchE,eAAsB,EACpB,EACA,CAAE,GAAI,EAAO,GAAG,GAChB,EACA,EACkB,CAClB,GAAI,CAAC,EAAO,CAEV,IAAM,EAAM,mDACV,EAAQ,wBAAwB,IAAU,KAG5C,MADA,EAAO,MAAM,EAAO,IAAI,EAAI,CAAC,CACnB,MAAM,EAAI,CAGtB,IAAM,EAAK,EAAM,aAAa,CAGxB,EAAsB,OAAO,QAAQ,EAAK,CAAC,QAC9C,EAAK,CAAC,EAAK,KACK,EAAK,EAAe,EAAM,CAAC,CAC5B,SAAW,EACrB,EACA,OAAO,OAAO,EAAK,EAChB,GAAM,EAAK,EAAe,EAAM,CAAC,CAAC,IAAK,IAAS,CAC/C,MAAO,IAAQ,QAAU,EAAI,aAAa,CAAG,EAC9C,EAAE,CACJ,CAAC,CAER,EAAE,CACH,CAGD,GAAI,CAgBF,OAfA,MAAM,EACH,KAAK,wBAAyB,CAC7B,QAAS,CACP,yBAA0B,EAC1B,0BAA2B,EAC5B,CACD,KAAM,CACJ,sBACD,CACF,CAAC,CACD,MAAM,CAET,EAAO,MACL,EAAO,MAAM,kCAAkC,IAAY,IAAK,CACjE,CACM,SACA,EAAK,CAEZ,GACE,OAAO,EAAI,SAAS,MAAS,UAC7B,EAAI,SAAS,KAAK,SAAS,2CAA2C,CAOtE,OALA,EAAO,KACL,EAAO,QACL,mCAAmC,IAAY,EAAG,gDACnD,CACF,CACM,GAST,MALA,EAAO,MACL,EAAO,IACL,uDAAuD,IAAY,EAAG,KAAK,EAAI,QAAQ,KAAK,EAAI,SAAS,OAC1G,CACF,CACK,GC1EV,eAAsB,EAAuC,CAC3D,OACA,OACA,aACA,aACA,aACA,cAAc,IACd,eAAe,GAgBG,CAElB,IAAM,EAAS,MAAM,EAAwB,EAAc,EAAM,EAAW,CACtE,EAAS,EAA4B,EAAc,EAAK,CAG9D,EAAO,KAAK,EAAO,QAAQ,YAAY,EAAK,aAAa,CAAC,CAC1D,IAAM,EAAgB,EAAQ,EAAM,EAAqB,CAGzD,EAAO,KACL,EAAO,QAAQ,cAAc,EAAc,OAAO,qBAAqB,CACxE,CAED,IAAI,EAAe,EACf,EAAe,EACf,EAAa,EAgDjB,GA9CA,MAAM,EACJ,EACA,MAAO,EAAS,IAAU,CACxB,GAAI,CAEE,IACF,MAAM,EAAmB,EAAQ,EAAwB,CACvD,MAAO,CACL,GAAI,EAAQ,GACZ,SAAU,GACX,CACF,CAAC,CAEF,EAAO,KACL,EAAO,QAAQ,iCAAiC,EAAQ,KAAK,CAC9D,EAGY,MAAM,EACnB,EACA,EACA,EACA,EACD,CAEC,GAAgB,EAEhB,GAAgB,OAEN,CACZ,GAAc,IAGlB,CAAE,cAAa,CAChB,CAED,EAAO,KACL,EAAO,MACL,sDAAsD,EAAa,GACpE,CACF,CAEG,EAAe,GACjB,EAAO,KAAK,EAAO,QAAQ,kBAAkB,EAAa,GAAG,CAAC,CAG5D,EAAa,EAEf,MADA,EAAO,KAAK,EAAO,IAAI,gBAAgB,EAAW,GAAG,CAAC,CAC5C,MAAM,qBAAqB,EAAW,YAAY,CAG9D,OAAO,EAAc"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./constants-
|
|
1
|
+
import{i as e}from"./constants-CnLQtIBn.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{C as n}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{closeSync as r,createReadStream as i,createWriteStream as a,existsSync as o,mkdirSync as s,openSync as c,readFileSync as l,readdirSync as u,statSync as d,unlinkSync as f,writeFileSync as p}from"node:fs";import{availableParallelism as m,platform as h}from"node:os";import{basename as g,join as _}from"node:path";import v from"colors";import{fork as y,spawn as b}from"node:child_process";import*as x from"node:readline";function S(e,t){let n=Math.max(1,m?.()??1);return{poolSize:typeof e==`number`&&e>0?Math.min(e,t):Math.min(n,t),cpuCount:n}}function C(e){return`'${String(e).replace(/'/g,`'\\''`)}'`}function w(e,n,r=!1){if(r)return;let i=h();try{if(i===`darwin`){b(`osascript`,[`-e`,`
|
|
2
2
|
tell application "Terminal"
|
|
3
3
|
activate
|
|
4
4
|
do script "printf '\\e]0;${n}\\a'; tail -n +1 -f ${e.map(C).join(` -f `)}"
|
|
@@ -20,4 +20,4 @@ Stopping workers...
|
|
|
20
20
|
`))}process.stdin.resume()}B=V({workers:g,onAttach:W,onDetach:K,onCtrlC:U,getLogPaths:e=>G(e,g,y),replayBytes:200*1024,replayWhich:[`out`,`err`],onEnterAttachScreen:W}),e.extraKeyHandler&&(L=e.extraKeyHandler({logsBySlot:y,repaint:()=>R(),setPaused:e=>{I=e}}),process.stdin.on(`data`,L))}await new Promise(e=>{let t=setInterval(async()=>{if(w===0){if(clearInterval(t),A&&clearInterval(A),B(),L)try{process.stdin.off(`data`,L)}catch{}H();let n=Date.now();try{await c.postProcess?.({slots:_,totals:C,logDir:h,logsBySlot:y,startedAt:m,finishedAt:n,viewerMode:d,getLogPathsForSlot:e=>G(e,g,y)})}catch(e){let t=e?.stack??String(e);process.stdout.write(v.red(`postProcess error: ${t}\n`))}e()}},300)})}function Q(e){let{logsBySlot:t,repaint:n,setPaused:r,exportMgr:i,exportStatus:a,custom:o}=e,s=e=>{process.stdout.write(`${e}\n`)},c=(e,t)=>{let r=Date.now(),i=a?.[e]??{path:t};a&&(a[e]={path:t||i.path,savedAt:r,exported:!0},n())},l=!1,u=(e,i)=>{l||(l=!0,r(!0),process.stdout.write(`\x1B[2J\x1B[H`),process.stdout.write(`Combined logs viewer (press Esc or Ctrl+] to return)
|
|
21
21
|
|
|
22
22
|
`),(async()=>{try{await I(t,e,i)}catch{l=!1,r(!1),n()}})())},d=(e,n)=>{if(i)try{let r=i.exportCombinedLogs(t,e);s(`\nWrote combined ${n} logs to: ${r}`),c(e,r)}catch{s(`\nFailed to write combined ${n} logs`)}};return e=>{let t=e.toString(`utf8`);if(t===`e`){u([`err`],`error`);return}if(t===`w`){u([`warn`,`err`],`warn`);return}if(t===`i`){u([`info`],`all`);return}if(t===`l`){u([`out`,`err`,`structured`],`all`);return}if(t===`E`){d(`error`,`error`);return}if(t===`W`){d(`warn`,`warn`);return}if(t===`I`){d(`info`,`info`);return}if(t===`A`){d(`all`,`ALL`);return}let i=o?.[t];if(i){i({noteExport:c,say:s});return}(t===`\x1B`||t===``)&&(l=!1,r(!1),n())}}export{W as a,X as i,Z as n,A as o,Y as r,S as s,Q as t};
|
|
23
|
-
//# sourceMappingURL=pooling-
|
|
23
|
+
//# sourceMappingURL=pooling-CazydwlD.mjs.map
|