@transcend-io/cli 10.10.0 → 10.11.0
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/README.md +35 -0
- package/dist/{app-C5WMPpiF.mjs → app-SZjGrYwT.mjs} +16 -16
- package/dist/app-SZjGrYwT.mjs.map +1 -0
- package/dist/{approvePrivacyRequests-DpXfRCtG.mjs → approvePrivacyRequests-BQBKfJjz.mjs} +2 -2
- package/dist/{approvePrivacyRequests-DpXfRCtG.mjs.map → approvePrivacyRequests-BQBKfJjz.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/{buildXdiSyncEndpoint-CpADEY6i.mjs → buildXdiSyncEndpoint-CyXZIwZY.mjs} +2 -2
- package/dist/{buildXdiSyncEndpoint-CpADEY6i.mjs.map → buildXdiSyncEndpoint-CyXZIwZY.mjs.map} +1 -1
- package/dist/{bulkRestartRequests-BUkavWWX.mjs → bulkRestartRequests-DhJ-tAul.mjs} +2 -2
- package/dist/{bulkRestartRequests-BUkavWWX.mjs.map → bulkRestartRequests-DhJ-tAul.mjs.map} +1 -1
- package/dist/{bulkRetryEnrichers-Br27FAbD.mjs → bulkRetryEnrichers-CINDJT29.mjs} +2 -2
- package/dist/{bulkRetryEnrichers-Br27FAbD.mjs.map → bulkRetryEnrichers-CINDJT29.mjs.map} +1 -1
- package/dist/{cancelPrivacyRequests-BEUOjF_G.mjs → cancelPrivacyRequests-h0Jjzwz1.mjs} +2 -2
- package/dist/{cancelPrivacyRequests-BEUOjF_G.mjs.map → cancelPrivacyRequests-h0Jjzwz1.mjs.map} +1 -1
- package/dist/{command-BZbmwdxB.mjs → command-Bwz-_CRM.mjs} +2 -2
- package/dist/{command-BZbmwdxB.mjs.map → command-Bwz-_CRM.mjs.map} +1 -1
- package/dist/{constants-FP8lxFg5.mjs → constants-DrkNQLIO.mjs} +2 -2
- package/dist/{constants-FP8lxFg5.mjs.map → constants-DrkNQLIO.mjs.map} +1 -1
- package/dist/{createExtraKeyHandler-D-M6PDok.mjs → createExtraKeyHandler-WI5OVh5Q.mjs} +2 -2
- package/dist/{createExtraKeyHandler-D-M6PDok.mjs.map → createExtraKeyHandler-WI5OVh5Q.mjs.map} +1 -1
- package/dist/{downloadPrivacyRequestFiles-BY_6MMoZ.mjs → downloadPrivacyRequestFiles-DqiA-mse.mjs} +2 -2
- package/dist/{downloadPrivacyRequestFiles-BY_6MMoZ.mjs.map → downloadPrivacyRequestFiles-DqiA-mse.mjs.map} +1 -1
- package/dist/{generateCrossAccountApiKeys-BkLSweFo.mjs → generateCrossAccountApiKeys-CpaKhWfU.mjs} +2 -2
- package/dist/{generateCrossAccountApiKeys-BkLSweFo.mjs.map → generateCrossAccountApiKeys-CpaKhWfU.mjs.map} +1 -1
- package/dist/{impl-D4SNAWH12.mjs → impl-B-vUfLBu2.mjs} +2 -2
- package/dist/{impl-D4SNAWH12.mjs.map → impl-B-vUfLBu2.mjs.map} +1 -1
- package/dist/impl-B7XAhrKf.mjs +3 -0
- package/dist/impl-B7XAhrKf.mjs.map +1 -0
- package/dist/{impl-D3uvvB70.mjs → impl-BAD_b0xz.mjs} +2 -2
- package/dist/{impl-D3uvvB70.mjs.map → impl-BAD_b0xz.mjs.map} +1 -1
- package/dist/{impl-CG882Vct.mjs → impl-BAehUgNy.mjs} +2 -2
- package/dist/{impl-CG882Vct.mjs.map → impl-BAehUgNy.mjs.map} +1 -1
- package/dist/{impl-CUZkpK1I2.mjs → impl-BOGIveaY2.mjs} +2 -2
- package/dist/{impl-CUZkpK1I2.mjs.map → impl-BOGIveaY2.mjs.map} +1 -1
- package/dist/{impl-DQdsAf-6.mjs → impl-BPspZqwr.mjs} +2 -2
- package/dist/{impl-DQdsAf-6.mjs.map → impl-BPspZqwr.mjs.map} +1 -1
- package/dist/{impl-Cn0BtYye.mjs → impl-BhnRLkLg.mjs} +2 -2
- package/dist/{impl-Cn0BtYye.mjs.map → impl-BhnRLkLg.mjs.map} +1 -1
- package/dist/{impl-B9Q9CnIK.mjs → impl-Bhvaczzz.mjs} +2 -2
- package/dist/{impl-B9Q9CnIK.mjs.map → impl-Bhvaczzz.mjs.map} +1 -1
- package/dist/{impl-B-fy3iVm.mjs → impl-BjG5fxYp.mjs} +2 -2
- package/dist/{impl-B-fy3iVm.mjs.map → impl-BjG5fxYp.mjs.map} +1 -1
- package/dist/{impl-BJoZpj1a.mjs → impl-Bjgy30tR.mjs} +1 -1
- package/dist/{impl-BJoZpj1a.mjs.map → impl-Bjgy30tR.mjs.map} +1 -1
- package/dist/{impl-g4gvqD93.mjs → impl-C0LTzcKG.mjs} +2 -2
- package/dist/{impl-g4gvqD93.mjs.map → impl-C0LTzcKG.mjs.map} +1 -1
- package/dist/{impl-DfxHCJfb.mjs → impl-C7-YJhT-.mjs} +1 -1
- package/dist/{impl-DfxHCJfb.mjs.map → impl-C7-YJhT-.mjs.map} +1 -1
- package/dist/{impl-BD2Rqu17.mjs → impl-CBPe28r4.mjs} +2 -2
- package/dist/{impl-BD2Rqu17.mjs.map → impl-CBPe28r4.mjs.map} +1 -1
- package/dist/{impl-CWpfY0TU.mjs → impl-CReDJGod.mjs} +2 -2
- package/dist/{impl-CWpfY0TU.mjs.map → impl-CReDJGod.mjs.map} +1 -1
- package/dist/{impl-CDISKj8u.mjs → impl-CUyHx1rE2.mjs} +2 -2
- package/dist/impl-CUyHx1rE2.mjs.map +1 -0
- package/dist/{impl-CQe-MaZ_.mjs → impl-CVqQYu7W.mjs} +2 -2
- package/dist/{impl-CQe-MaZ_.mjs.map → impl-CVqQYu7W.mjs.map} +1 -1
- package/dist/{impl-BM0Ir6_d2.mjs → impl-CYAYg5CX2.mjs} +2 -2
- package/dist/{impl-BM0Ir6_d2.mjs.map → impl-CYAYg5CX2.mjs.map} +1 -1
- package/dist/{impl-GjQ_LTsa.mjs → impl-CcitjJS-.mjs} +2 -2
- package/dist/{impl-GjQ_LTsa.mjs.map → impl-CcitjJS-.mjs.map} +1 -1
- package/dist/{impl-DI3mf99H.mjs → impl-CelvG8_p.mjs} +2 -2
- package/dist/{impl-DI3mf99H.mjs.map → impl-CelvG8_p.mjs.map} +1 -1
- package/dist/{impl-lHNw_K3v.mjs → impl-D1vQsy5J.mjs} +2 -2
- package/dist/{impl-lHNw_K3v.mjs.map → impl-D1vQsy5J.mjs.map} +1 -1
- package/dist/{impl-CfBhfUVL2.mjs → impl-D5uV31yx.mjs} +2 -2
- package/dist/impl-D5uV31yx.mjs.map +1 -0
- package/dist/{impl-hE7w_dha.mjs → impl-DEDU3xQB.mjs} +2 -2
- package/dist/{impl-hE7w_dha.mjs.map → impl-DEDU3xQB.mjs.map} +1 -1
- package/dist/{impl-DWWx9PXJ.mjs → impl-DGEhn7xe.mjs} +2 -2
- package/dist/{impl-DWWx9PXJ.mjs.map → impl-DGEhn7xe.mjs.map} +1 -1
- package/dist/{impl-BcIarr1b.mjs → impl-DdoOAvjJ.mjs} +1 -1
- package/dist/{impl-BcIarr1b.mjs.map → impl-DdoOAvjJ.mjs.map} +1 -1
- package/dist/{impl-xiJwue6x.mjs → impl-DeE60yI-.mjs} +2 -2
- package/dist/{impl-xiJwue6x.mjs.map → impl-DeE60yI-.mjs.map} +1 -1
- package/dist/{impl-C7BHhHii2.mjs → impl-DfUg1xpp.mjs} +2 -2
- package/dist/impl-DfUg1xpp.mjs.map +1 -0
- package/dist/{impl-C8EH5IWl2.mjs → impl-DiKtPpJg2.mjs} +2 -2
- package/dist/{impl-C8EH5IWl2.mjs.map → impl-DiKtPpJg2.mjs.map} +1 -1
- package/dist/{impl-mW3c3HNU.mjs → impl-DxEAabYI.mjs} +2 -2
- package/dist/{impl-mW3c3HNU.mjs.map → impl-DxEAabYI.mjs.map} +1 -1
- package/dist/{impl-mxcFaXMI.mjs → impl-Gb7HxrtC2.mjs} +2 -2
- package/dist/impl-Gb7HxrtC2.mjs.map +1 -0
- package/dist/{impl-IgBneuQ8.mjs → impl-H0dOy3D9.mjs} +2 -2
- package/dist/{impl-IgBneuQ8.mjs.map → impl-H0dOy3D9.mjs.map} +1 -1
- package/dist/impl-PGlAUyrI.mjs +2 -0
- package/dist/{impl-D4JiKANv.mjs.map → impl-PGlAUyrI.mjs.map} +1 -1
- package/dist/impl-VaOJJuto.mjs +3 -0
- package/dist/{impl--ee0ekVf.mjs.map → impl-VaOJJuto.mjs.map} +1 -1
- package/dist/{impl-D0FfuS4u2.mjs → impl-XmiHSCMj2.mjs} +2 -2
- package/dist/{impl-D0FfuS4u2.mjs.map → impl-XmiHSCMj2.mjs.map} +1 -1
- package/dist/{impl-Bw74_1W6.mjs → impl-_X1a20u1.mjs} +2 -2
- package/dist/{impl-Bw74_1W6.mjs.map → impl-_X1a20u1.mjs.map} +1 -1
- package/dist/{impl-C_KFt7Y8.mjs → impl-bz9v5xdV.mjs} +2 -2
- package/dist/{impl-C_KFt7Y8.mjs.map → impl-bz9v5xdV.mjs.map} +1 -1
- package/dist/{impl-BvYc_ZAH.mjs → impl-mDlXBAeB.mjs} +2 -2
- package/dist/{impl-BvYc_ZAH.mjs.map → impl-mDlXBAeB.mjs.map} +1 -1
- package/dist/{impl-O5gKrwRH.mjs → impl-n3VF1th4.mjs} +2 -2
- package/dist/{impl-O5gKrwRH.mjs.map → impl-n3VF1th4.mjs.map} +1 -1
- package/dist/{impl-CMAmsDt9.mjs → impl-saIKgNF6.mjs} +2 -2
- package/dist/{impl-CMAmsDt9.mjs.map → impl-saIKgNF6.mjs.map} +1 -1
- package/dist/{impl-C-Ky12n4.mjs → impl-x41b0Zix.mjs} +2 -2
- package/dist/{impl-C-Ky12n4.mjs.map → impl-x41b0Zix.mjs.map} +1 -1
- package/dist/index.d.mts +9 -9
- package/dist/index.mjs +1 -1
- package/dist/{markRequestDataSiloIdsCompleted-Cg5Hfs4-.mjs → markRequestDataSiloIdsCompleted-CY2wuSvF.mjs} +2 -2
- package/dist/{markRequestDataSiloIdsCompleted-Cg5Hfs4-.mjs.map → markRequestDataSiloIdsCompleted-CY2wuSvF.mjs.map} +1 -1
- package/dist/{markSilentPrivacyRequests-1spmn5h3.mjs → markSilentPrivacyRequests-DSeSY-Ii.mjs} +2 -2
- package/dist/{markSilentPrivacyRequests-1spmn5h3.mjs.map → markSilentPrivacyRequests-DSeSY-Ii.mjs.map} +1 -1
- package/dist/{notifyPrivacyRequestsAdditionalTime-DIY4ofMV.mjs → notifyPrivacyRequestsAdditionalTime-CBxM2ycO.mjs} +2 -2
- package/dist/{notifyPrivacyRequestsAdditionalTime-DIY4ofMV.mjs.map → notifyPrivacyRequestsAdditionalTime-CBxM2ycO.mjs.map} +1 -1
- package/dist/printResult-DyCE6B_m.mjs +2 -0
- package/dist/printResult-DyCE6B_m.mjs.map +1 -0
- package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-Caiw44KV.mjs → pullChunkedCustomSiloOutstandingIdentifiers-C5uhtMJZ.mjs} +2 -2
- package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-Caiw44KV.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-C5uhtMJZ.mjs.map} +1 -1
- package/dist/{pullManualEnrichmentIdentifiersToCsv-Et8K20SJ.mjs → pullManualEnrichmentIdentifiersToCsv-DAjzpJrD.mjs} +2 -2
- package/dist/{pullManualEnrichmentIdentifiersToCsv-Et8K20SJ.mjs.map → pullManualEnrichmentIdentifiersToCsv-DAjzpJrD.mjs.map} +1 -1
- package/dist/{pushCronIdentifiersFromCsv-DqOtCwY5.mjs → pushCronIdentifiersFromCsv-5rPEhGSa.mjs} +2 -2
- package/dist/{pushCronIdentifiersFromCsv-DqOtCwY5.mjs.map → pushCronIdentifiersFromCsv-5rPEhGSa.mjs.map} +1 -1
- package/dist/{pushManualEnrichmentIdentifiersFromCsv-LWKOrJTN.mjs → pushManualEnrichmentIdentifiersFromCsv-BWn9vFTr.mjs} +2 -2
- package/dist/{pushManualEnrichmentIdentifiersFromCsv-LWKOrJTN.mjs.map → pushManualEnrichmentIdentifiersFromCsv-BWn9vFTr.mjs.map} +1 -1
- package/dist/{removeUnverifiedRequestIdentifiers-C8aAV99N.mjs → removeUnverifiedRequestIdentifiers-q0ZyY9AM.mjs} +2 -2
- package/dist/{removeUnverifiedRequestIdentifiers-C8aAV99N.mjs.map → removeUnverifiedRequestIdentifiers-q0ZyY9AM.mjs.map} +1 -1
- package/dist/resolveBundleIdByName-CwOnHS6D.mjs +3 -0
- package/dist/resolveBundleIdByName-CwOnHS6D.mjs.map +1 -0
- package/dist/{retryRequestDataSilos-CYvolpVQ.mjs → retryRequestDataSilos-OfPZjwRt.mjs} +2 -2
- package/dist/{retryRequestDataSilos-CYvolpVQ.mjs.map → retryRequestDataSilos-OfPZjwRt.mjs.map} +1 -1
- package/dist/{skipPreflightJobs-CsAbVlmo.mjs → skipPreflightJobs-_y0gfjsz.mjs} +2 -2
- package/dist/{skipPreflightJobs-CsAbVlmo.mjs.map → skipPreflightJobs-_y0gfjsz.mjs.map} +1 -1
- package/dist/{skipRequestDataSilos-BAO67gHg.mjs → skipRequestDataSilos-1DJUOU5A.mjs} +2 -2
- package/dist/{skipRequestDataSilos-BAO67gHg.mjs.map → skipRequestDataSilos-1DJUOU5A.mjs.map} +1 -1
- package/dist/{streamPrivacyRequestsToCsv-B2yq8AGa.mjs → streamPrivacyRequestsToCsv-DlQbNdTN.mjs} +2 -2
- package/dist/{streamPrivacyRequestsToCsv-B2yq8AGa.mjs.map → streamPrivacyRequestsToCsv-DlQbNdTN.mjs.map} +1 -1
- package/dist/{updateConsentManagerVersionToLatest-Dd0GfGAj.mjs → updateConsentManagerVersionToLatest-D0-vKrkk.mjs} +2 -2
- package/dist/{updateConsentManagerVersionToLatest-Dd0GfGAj.mjs.map → updateConsentManagerVersionToLatest-D0-vKrkk.mjs.map} +1 -1
- package/dist/{uploadConsents-DgkSQj5-.mjs → uploadConsents-Rp0YJNA4.mjs} +2 -2
- package/dist/{uploadConsents-DgkSQj5-.mjs.map → uploadConsents-Rp0YJNA4.mjs.map} +1 -1
- package/dist/{uploadCookiesFromCsv-C2lTYrbc.mjs → uploadCookiesFromCsv-d-1JGI8B.mjs} +2 -2
- package/dist/{uploadCookiesFromCsv-C2lTYrbc.mjs.map → uploadCookiesFromCsv-d-1JGI8B.mjs.map} +1 -1
- package/dist/{uploadDataFlowsFromCsv-BkrAh4SY.mjs → uploadDataFlowsFromCsv-BJ4eSmI4.mjs} +2 -2
- package/dist/{uploadDataFlowsFromCsv-BkrAh4SY.mjs.map → uploadDataFlowsFromCsv-BJ4eSmI4.mjs.map} +1 -1
- package/dist/{uploadPrivacyRequestsFromCsv-i46OEhw-.mjs → uploadPrivacyRequestsFromCsv-Dz3Q-YJZ.mjs} +2 -2
- package/dist/{uploadPrivacyRequestsFromCsv-i46OEhw-.mjs.map → uploadPrivacyRequestsFromCsv-Dz3Q-YJZ.mjs.map} +1 -1
- package/package.json +2 -2
- package/dist/app-C5WMPpiF.mjs.map +0 -1
- package/dist/impl--ee0ekVf.mjs +0 -3
- package/dist/impl-C7BHhHii2.mjs.map +0 -1
- package/dist/impl-CDISKj8u.mjs.map +0 -1
- package/dist/impl-CfBhfUVL2.mjs.map +0 -1
- package/dist/impl-D4JiKANv.mjs +0 -2
- package/dist/impl-mxcFaXMI.mjs.map +0 -1
- package/dist/resolveBundleIdByName-C6GQuO2d.mjs +0 -3
- package/dist/resolveBundleIdByName-C6GQuO2d.mjs.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./skipPreflightJobs-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import{t as e}from"./skipPreflightJobs-_y0gfjsz.mjs";import{t}from"./done-input-validation-9r-9VL6r.mjs";async function n({auth:n,transcendUrl:r,enricherIds:i}){t(this.process.exit),await e({transcendUrl:r,auth:n,enricherIds:i})}export{n as skipPreflightJobs};
|
|
2
|
+
//# sourceMappingURL=impl-XmiHSCMj2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-XmiHSCMj2.mjs","names":["skipPreflightJobsHelper"],"sources":["../src/commands/request/skip-preflight-jobs/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { skipPreflightJobs as skipPreflightJobsHelper } from '../../../lib/requests/index.js';\n\nexport interface SkipPreflightJobsCommandFlags {\n auth: string;\n enricherIds: string[];\n transcendUrl: string;\n}\n\nexport async function skipPreflightJobs(\n this: LocalContext,\n { auth, transcendUrl, enricherIds }: SkipPreflightJobsCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await skipPreflightJobsHelper({\n transcendUrl,\n auth,\n enricherIds,\n });\n}\n"],"mappings":"yGAUA,eAAsB,EAEpB,CAAE,OAAM,eAAc,eACP,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAAwB,CAC5B,eACA,OACA,cACD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./logger-B-LXIf3U.mjs";import{t}from"./pullChunkedCustomSiloOutstandingIdentifiers-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import{t as e}from"./logger-B-LXIf3U.mjs";import{t}from"./pullChunkedCustomSiloOutstandingIdentifiers-C5uhtMJZ.mjs";import{i as n,s as r}from"./writeCsv-CbT4a0uj.mjs";import{t as i}from"./done-input-validation-9r-9VL6r.mjs";import{uniq as a}from"lodash-es";import o from"colors";async function s({file:s,transcendUrl:c,auth:l,sombraAuth:u,dataSiloId:d,actions:f,pageLimit:p,skipRequestCount:m,chunkSize:h}){m&&e.info(o.yellow(`Skipping request count as requested. This may help speed up the call.`)),(Number.isNaN(h)||h<=0||h%p!==0)&&(e.error(o.red(`Invalid chunk size: "${h}". Must be a positive integer that is a multiple of ${p}.`)),this.process.exit(1)),i(this.process.exit);let{baseName:g,extension:_}=n(s),v=0;await t({transcendUrl:c,apiPageSize:p,savePageSize:h,onSave:async t=>{let n=`${g}-${v}${_}`;return e.info(o.blue(`Saving ${t.length} identifiers to file "${n}"`)),await r(n,t,a(t.map(e=>Object.keys(e)).flat())),e.info(o.green(`Successfully wrote ${t.length} identifiers to file "${n}"`)),v+=1,Promise.resolve()},actions:f,auth:l,sombraAuth:u,dataSiloId:d,skipRequestCount:m})}export{s as pullIdentifiers};
|
|
2
|
+
//# sourceMappingURL=impl-_X1a20u1.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-_X1a20u1.mjs","names":[],"sources":["../src/commands/request/cron/pull-identifiers/impl.ts"],"sourcesContent":["import { RequestAction } from '@transcend-io/privacy-types';\nimport colors from 'colors';\nimport { uniq } from 'lodash-es';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport {\n CsvFormattedIdentifier,\n pullChunkedCustomSiloOutstandingIdentifiers,\n} from '../../../../lib/cron/index.js';\nimport { parseFilePath, writeLargeCsv } from '../../../../lib/helpers/index.js';\nimport { logger } from '../../../../logger.js';\n\nexport interface PullIdentifiersCommandFlags {\n file: string;\n transcendUrl: string;\n auth: string;\n sombraAuth?: string;\n dataSiloId: string;\n actions: RequestAction[];\n pageLimit: number;\n skipRequestCount: boolean;\n chunkSize: number;\n}\n\nexport async function pullIdentifiers(\n this: LocalContext,\n {\n file,\n transcendUrl,\n auth,\n sombraAuth,\n dataSiloId,\n actions,\n pageLimit,\n skipRequestCount,\n chunkSize,\n }: PullIdentifiersCommandFlags,\n): Promise<void> {\n if (skipRequestCount) {\n logger.info(\n colors.yellow('Skipping request count as requested. This may help speed up the call.'),\n );\n }\n\n if (Number.isNaN(chunkSize) || chunkSize <= 0 || chunkSize % pageLimit !== 0) {\n logger.error(\n colors.red(\n `Invalid chunk size: \"${chunkSize}\". Must be a positive integer that is a multiple of ${pageLimit}.`,\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process.exit);\n\n const { baseName, extension } = parseFilePath(file);\n let fileCount = 0;\n\n const onSave = async (chunk: CsvFormattedIdentifier[]): Promise<void> => {\n const numberedFileName = `${baseName}-${fileCount}${extension}`;\n logger.info(colors.blue(`Saving ${chunk.length} identifiers to file \"${numberedFileName}\"`));\n\n const headers = uniq(chunk.map((d) => Object.keys(d)).flat());\n await writeLargeCsv(numberedFileName, chunk, headers);\n logger.info(\n colors.green(`Successfully wrote ${chunk.length} identifiers to file \"${numberedFileName}\"`),\n );\n fileCount += 1;\n return Promise.resolve();\n };\n\n // Pull down outstanding identifiers\n await pullChunkedCustomSiloOutstandingIdentifiers({\n transcendUrl,\n apiPageSize: pageLimit,\n savePageSize: chunkSize,\n onSave,\n actions,\n auth,\n sombraAuth,\n dataSiloId,\n skipRequestCount,\n });\n}\n"],"mappings":"uRAyBA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,aACA,aACA,UACA,YACA,mBACA,aAEa,CACX,GACF,EAAO,KACL,EAAO,OAAO,wEAAwE,CACvF,EAGC,OAAO,MAAM,EAAU,EAAI,GAAa,GAAK,EAAY,IAAc,KACzE,EAAO,MACL,EAAO,IACL,wBAAwB,EAAU,sDAAsD,EAAU,GACnG,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAM,CAAE,WAAU,aAAc,EAAc,EAAK,CAC/C,EAAY,EAgBhB,MAAM,EAA4C,CAChD,eACA,YAAa,EACb,aAAc,EACd,YAlBoB,IAAmD,CACvE,IAAM,EAAmB,GAAG,EAAS,GAAG,IAAY,IASpD,OARA,EAAO,KAAK,EAAO,KAAK,UAAU,EAAM,OAAO,wBAAwB,EAAiB,GAAG,CAAC,CAG5F,MAAM,EAAc,EAAkB,EADtB,EAAK,EAAM,IAAK,GAAM,OAAO,KAAK,EAAE,CAAC,CAAC,MAAM,CACR,CAAC,CACrD,EAAO,KACL,EAAO,MAAM,sBAAsB,EAAM,OAAO,wBAAwB,EAAiB,GAAG,CAC7F,CACD,GAAa,EACN,QAAQ,SAAS,EASxB,UACA,OACA,aACA,aACA,mBACD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./logger-B-LXIf3U.mjs";import{t}from"./collectCsvFilesOrExit-ChKkrsVz.mjs";import{t as n}from"./done-input-validation-9r-9VL6r.mjs";import{a as r,i,n as a,r as o,t as s}from"./createExtraKeyHandler-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import{t as e}from"./logger-B-LXIf3U.mjs";import{t}from"./collectCsvFilesOrExit-ChKkrsVz.mjs";import{t as n}from"./done-input-validation-9r-9VL6r.mjs";import{a as r,i,n as a,r as o,t as s}from"./createExtraKeyHandler-WI5OVh5Q.mjs";import c from"colors";import{CHILD_FLAG as l,PoolCancelledError as u,computePoolSize as d,resolveWorkerPath as f,runPool as p}from"@transcend-io/utils";function m(e){return a(e)}function h(e){return o(e)}const g={renderHeader:m,renderWorkers:h};async function _(a){n(this.process.exit);let{directory:o,outputDir:m,clearOutputDir:h,chunkSizeMB:_,concurrency:v,viewerMode:y}=a,b=t(o,this),{poolSize:x,cpuCount:S}=d(v,b.length);e.info(c.green(`Chunking ${b.length} CSV file(s) with pool size ${x} (CPU=${S})`));let C=b.map(e=>({filePath:e,options:{outputDir:m,clearOutputDir:h,chunkSizeMB:_}}));await p({title:`Chunk CSV - ${o}`,baseDir:o||m||process.cwd(),childFlag:l,childModulePath:f(import.meta.url,`commands/admin/chunk-csv/worker.mjs`),poolSize:x,cpuCount:S,filesTotal:b.length,hooks:{nextTask:()=>C.shift(),taskLabel:e=>e.filePath,initTotals:()=>({}),initSlotProgress:()=>void 0,onProgress:e=>e,onResult:(e,t)=>({totals:e,ok:!!t.ok}),postProcess:async()=>{}},viewerMode:y,render:e=>i(e,g,y),installInteractiveSwitcher:y?void 0:({workers:e,onCtrlC:t,getLogPaths:n,replayBytes:i,replayWhich:a,setPaused:o,repaint:s})=>r({workers:e,onCtrlC:t,getLogPaths:n,replayBytes:i,replayWhich:a,onAttach:()=>o(!0),onDetach:()=>{o(!1),s()},onEnterAttachScreen:e=>{o(!0),process.stdout.write(`\x1B[2J\x1B[H`),process.stdout.write(`Attached to worker ${e}. (Esc/Ctrl+] detach \u2022 Ctrl+D EOF \u2022 Ctrl+C SIGINT)\n`)}}),extraKeyHandler:({logsBySlot:e,repaint:t,setPaused:n})=>s({logsBySlot:e,repaint:t,setPaused:n})}).catch(e=>{throw e instanceof u&&process.exit(130),e})}export{_ as chunkCsv};
|
|
2
|
+
//# sourceMappingURL=impl-bz9v5xdV.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-bz9v5xdV.mjs","names":[],"sources":["../src/commands/admin/chunk-csv/ui/plugin.ts","../src/commands/admin/chunk-csv/impl.ts"],"sourcesContent":["import {\n makeHeader,\n makeWorkerRows,\n type ChunkSlotProgress,\n type CommonCtx,\n type DashboardPlugin,\n} from '../../../../lib/pooling/index.js';\n\n/**\n * Header for chunk-csv (no extra totals block).\n *\n * @param ctx - Dashboard context.\n * @returns Header lines.\n */\nfunction renderHeader<TTotals>(ctx: CommonCtx<TTotals, ChunkSlotProgress>): string[] {\n // no extra lines — reuse the shared header as-is\n return makeHeader(ctx);\n}\n\n/**\n * Worker rows for chunk-csv — share the generic row renderer.\n *\n * @param ctx - Dashboard context.\n * @returns Array of strings, each representing one worker row.\n */\nfunction renderWorkers<TTotals>(ctx: CommonCtx<TTotals, ChunkSlotProgress>): string[] {\n return makeWorkerRows(ctx);\n}\n\nexport const chunkCsvPlugin: DashboardPlugin<unknown, ChunkSlotProgress> = {\n renderHeader,\n renderWorkers,\n // no extras\n};\n","import {\n CHILD_FLAG,\n type PoolHooks,\n runPool,\n computePoolSize,\n PoolCancelledError,\n resolveWorkerPath,\n} from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { collectCsvFilesOrExit } from '../../../lib/helpers/collectCsvFilesOrExit.js';\nimport {\n createExtraKeyHandler,\n dashboardPlugin,\n installInteractiveSwitcher,\n} from '../../../lib/pooling/index.js';\nimport { logger } from '../../../logger.js';\nimport { chunkCsvPlugin } from './ui/index.js';\nimport type { ChunkProgress, ChunkResult, ChunkTask } from './worker.js';\n\n/**\n * Totals aggregate for this command.\n * We don’t need custom counters since the runner already tracks\n * completed/failed counts in its header — so we just use an empty record.\n */\ntype Totals = Record<string, never>;\n\n/**\n * CLI flags accepted by the `chunk-csv` command.\n *\n * These are passed down from the CLI parser into the parent process.\n */\nexport type ChunkCsvCommandFlags = {\n directory: string;\n outputDir?: string;\n clearOutputDir: boolean;\n chunkSizeMB: number;\n concurrency?: number;\n viewerMode: boolean;\n};\n\n/**\n * Parent entrypoint for chunking many CSVs in parallel using the worker pool runner.\n *\n * Lifecycle:\n * 1) Discover CSV inputs (exit if none).\n * 2) Compute pool size (CPU-count heuristic or --concurrency).\n * 3) Build a FIFO queue of `ChunkTask`s.\n * 4) Define pool hooks to drive task assignment, progress, and result handling.\n * 5) Launch the pool with `runPool`, rendering via the `chunkCsvPlugin`.\n *\n * @param this - Bound CLI context (provides process exit + logging).\n * @param flags - CLI options for the run.\n */\nexport async function chunkCsv(this: LocalContext, flags: ChunkCsvCommandFlags): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const { directory, outputDir, clearOutputDir, chunkSizeMB, concurrency, viewerMode } = flags;\n\n /* 1) Discover CSV inputs */\n const files = collectCsvFilesOrExit(directory, this);\n\n /* 2) Size the pool */\n const { poolSize, cpuCount } = computePoolSize(concurrency, files.length);\n\n logger.info(\n colors.green(\n `Chunking ${files.length} CSV file(s) with pool size ${poolSize} (CPU=${cpuCount})`,\n ),\n );\n\n /* 3) Prepare a simple FIFO queue of tasks (one per file). */\n const queue = files.map<ChunkTask>((filePath) => ({\n filePath,\n options: { outputDir, clearOutputDir, chunkSizeMB },\n }));\n\n /* 4) Define pool hooks to adapt runner to this command. */\n const hooks: PoolHooks<ChunkTask, ChunkProgress, ChunkResult, Totals> = {\n nextTask: () => queue.shift(),\n taskLabel: (t) => t.filePath,\n initTotals: () => ({}) as Totals,\n initSlotProgress: () => undefined,\n onProgress: (totals) => totals,\n onResult: (totals, res) => ({ totals, ok: !!res.ok }),\n // postProcess receives log context when viewerMode=true — we don’t need it here.\n postProcess: async () => {\n // nothing extra for chunk-csv\n },\n };\n\n /* 5) Launch the pool runner with our hooks and custom dashboard plugin. */\n await runPool({\n title: `Chunk CSV - ${directory}`,\n baseDir: directory || outputDir || process.cwd(),\n childFlag: CHILD_FLAG,\n childModulePath: resolveWorkerPath(import.meta.url, 'commands/admin/chunk-csv/worker.mjs'),\n poolSize,\n cpuCount,\n filesTotal: files.length,\n hooks,\n viewerMode,\n render: (input) => dashboardPlugin(input, chunkCsvPlugin, viewerMode),\n installInteractiveSwitcher: viewerMode\n ? undefined\n : ({\n workers,\n onCtrlC,\n getLogPaths,\n replayBytes: rb,\n replayWhich: rw,\n setPaused,\n repaint: rp,\n }) =>\n installInteractiveSwitcher({\n workers,\n onCtrlC,\n getLogPaths,\n replayBytes: rb,\n replayWhich: rw,\n onAttach: () => setPaused(true),\n onDetach: () => {\n setPaused(false);\n rp();\n },\n onEnterAttachScreen: (id) => {\n setPaused(true);\n process.stdout.write('\\x1b[2J\\x1b[H');\n process.stdout.write(\n `Attached to worker ${id}. (Esc/Ctrl+] detach \\u2022 Ctrl+D EOF \\u2022 Ctrl+C SIGINT)\\n`,\n );\n },\n }),\n extraKeyHandler: ({ logsBySlot, repaint, setPaused }) =>\n createExtraKeyHandler({\n logsBySlot,\n repaint,\n setPaused,\n }),\n }).catch((err) => {\n if (err instanceof PoolCancelledError) {\n process.exit(130);\n }\n throw err;\n });\n}\n"],"mappings":"+XAcA,SAAS,EAAsB,EAAsD,CAEnF,OAAO,EAAW,EAAI,CASxB,SAAS,EAAuB,EAAsD,CACpF,OAAO,EAAe,EAAI,CAG5B,MAAa,EAA8D,CACzE,eACA,gBAED,CCuBD,eAAsB,EAA6B,EAA4C,CAC7F,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAM,CAAE,YAAW,YAAW,iBAAgB,cAAa,cAAa,cAAe,EAGjF,EAAQ,EAAsB,EAAW,KAAK,CAG9C,CAAE,WAAU,YAAa,EAAgB,EAAa,EAAM,OAAO,CAEzE,EAAO,KACL,EAAO,MACL,YAAY,EAAM,OAAO,8BAA8B,EAAS,QAAQ,EAAS,GAClF,CACF,CAGD,IAAM,EAAQ,EAAM,IAAgB,IAAc,CAChD,WACA,QAAS,CAAE,YAAW,iBAAgB,cAAa,CACpD,EAAE,CAiBH,MAAM,EAAQ,CACZ,MAAO,eAAe,IACtB,QAAS,GAAa,GAAa,QAAQ,KAAK,CAChD,UAAW,EACX,gBAAiB,EAAkB,OAAO,KAAK,IAAK,sCAAsC,CAC1F,WACA,WACA,WAAY,EAAM,OAClB,MAAA,CArBA,aAAgB,EAAM,OAAO,CAC7B,UAAY,GAAM,EAAE,SACpB,gBAAmB,EAAE,EACrB,qBAAwB,IAAA,GACxB,WAAa,GAAW,EACxB,UAAW,EAAQ,KAAS,CAAE,SAAQ,GAAI,CAAC,CAAC,EAAI,GAAI,EAEpD,YAAa,SAAY,GAcpB,CACL,aACA,OAAS,GAAU,EAAgB,EAAO,EAAgB,EAAW,CACrE,2BAA4B,EACxB,IAAA,IACC,CACC,UACA,UACA,cACA,YAAa,EACb,YAAa,EACb,YACA,QAAS,KAET,EAA2B,CACzB,UACA,UACA,cACA,YAAa,EACb,YAAa,EACb,aAAgB,EAAU,GAAK,CAC/B,aAAgB,CACd,EAAU,GAAM,CAChB,GAAI,EAEN,oBAAsB,GAAO,CAC3B,EAAU,GAAK,CACf,QAAQ,OAAO,MAAM,gBAAgB,CACrC,QAAQ,OAAO,MACb,sBAAsB,EAAG,gEAC1B,EAEJ,CAAC,CACR,iBAAkB,CAAE,aAAY,UAAS,eACvC,EAAsB,CACpB,aACA,UACA,YACD,CAAC,CACL,CAAC,CAAC,MAAO,GAAQ,CAIhB,MAHI,aAAe,GACjB,QAAQ,KAAK,IAAI,CAEb,GACN"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./logger-B-LXIf3U.mjs";import{t}from"./streamPrivacyRequestsToCsv-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import{t as e}from"./logger-B-LXIf3U.mjs";import{t}from"./streamPrivacyRequestsToCsv-DlQbNdTN.mjs";import{t as n}from"./done-input-validation-9r-9VL6r.mjs";import r from"colors";async function i({auth:i,transcendUrl:a,file:o,pageLimit:s,concurrency:c,actions:l,sombraAuth:u,skipRequestIdentifiers:d,statuses:f,createdAtBefore:p,createdAtAfter:m,updatedAtBefore:h,updatedAtAfter:g,showTests:_}){n(this.process.exit);let{filePaths:v,totalCount:y}=await t({transcendUrl:a,concurrency:c,pageLimit:s,actions:l,statuses:f,auth:i,sombraAuth:u,skipRequestIdentifiers:d,createdAtBefore:p,createdAtAfter:m,updatedAtBefore:h,updatedAtAfter:g,isTest:_,file:o});e.info(r.green(`Successfully wrote ${y} requests to ${v.length} file(s): ${v.join(`, `)}`))}export{i as _export};
|
|
2
|
+
//# sourceMappingURL=impl-mDlXBAeB.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-mDlXBAeB.mjs","names":[],"sources":["../src/commands/request/export/impl.ts"],"sourcesContent":["import type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { streamPrivacyRequestsToCsv } from '../../../lib/requests/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface ExportCommandFlags {\n auth: string;\n sombraAuth?: string;\n actions?: RequestAction[];\n statuses?: RequestStatus[];\n transcendUrl: string;\n file: string;\n concurrency: number;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n showTests?: boolean;\n skipRequestIdentifiers?: boolean;\n pageLimit: number;\n}\n\n// `export` is a reserved keyword, so we need to prefix it with an underscore\n// eslint-disable-next-line no-underscore-dangle\nexport async function _export(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n file,\n pageLimit,\n concurrency,\n actions,\n sombraAuth,\n skipRequestIdentifiers,\n statuses,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n showTests,\n }: ExportCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const { filePaths, totalCount } = await streamPrivacyRequestsToCsv({\n transcendUrl,\n concurrency,\n pageLimit,\n actions,\n statuses,\n auth,\n sombraAuth,\n skipRequestIdentifiers,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isTest: showTests,\n file,\n });\n\n logger.info(\n colors.green(\n `Successfully wrote ${totalCount} requests to ` +\n `${filePaths.length} file(s): ${filePaths.join(', ')}`,\n ),\n );\n}\n"],"mappings":"kLA2BA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,YACA,cACA,UACA,aACA,yBACA,WACA,kBACA,iBACA,kBACA,iBACA,aAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAM,CAAE,YAAW,cAAe,MAAM,EAA2B,CACjE,eACA,cACA,YACA,UACA,WACA,OACA,aACA,yBACA,kBACA,iBACA,kBACA,iBACA,OAAQ,EACR,OACD,CAAC,CAEF,EAAO,KACL,EAAO,MACL,sBAAsB,EAAW,eAC5B,EAAU,OAAO,YAAY,EAAU,KAAK,KAAK,GACvD,CACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./constants-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import{n as e}from"./constants-DrkNQLIO.mjs";import{t}from"./logger-B-LXIf3U.mjs";import{s as n}from"./writeCsv-CbT4a0uj.mjs";import{t as r}from"./pullAllDatapoints-49ZSGNFN.mjs";import{t as i}from"./done-input-validation-9r-9VL6r.mjs";import{groupBy as a,uniq as o}from"lodash-es";import s from"colors";import{buildTranscendGraphQLClient as c}from"@transcend-io/sdk";async function l({auth:l,file:u,transcendUrl:d,dataSiloIds:f,includeAttributes:p,includeGuessedCategories:m,parentCategories:h,subCategories:g=[]}){i(this.process.exit);try{let e=await r(c(d,l),{dataSiloIds:f,includeGuessedCategories:m,parentCategories:h,includeAttributes:p,subCategories:g});t.info(s.magenta(`Writing datapoints to file "${u}"...`));let i=[];await n(u,e.map(e=>{let t={"Property ID":e.id,"Data Silo":e.dataSilo.title,Object:e.dataPoint.name,"Object Path":e.dataPoint.path.join(`.`),Property:e.name,"Property Description":e.description,"Data Categories":e.categories.map(e=>`${e.category}:${e.name}`).join(`, `),"Guessed Category":e.pendingCategoryGuesses?.[0]?`${e.pendingCategoryGuesses[0].category.category}:${e.pendingCategoryGuesses[0].category.name}`:``,"Processing Purposes":e.purposes.map(e=>`${e.purpose}:${e.name}`).join(`, `),...Object.entries(a(e.attributeValues||[],({attributeKey:e})=>e.name)).reduce((e,[t,n])=>(e[t]=n.map(e=>e.name).join(`,`),e),{})};return i=o([...i,...Object.keys(t)]),t}),i)}catch(e){t.error(s.red(`An error occurred syncing the datapoints: ${e.message}`)),this.process.exit(1)}t.info(s.green(`Successfully synced datapoints to disk at ${u}! View at ${e}`))}export{l as pullDatapoints};
|
|
2
|
+
//# sourceMappingURL=impl-n3VF1th4.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-n3VF1th4.mjs","names":[],"sources":["../src/commands/inventory/pull-datapoints/impl.ts"],"sourcesContent":["import { DataCategoryType } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport colors from 'colors';\nimport { uniq, groupBy } from 'lodash-es';\n\nimport { ADMIN_DASH_DATAPOINTS } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { pullAllDatapoints } from '../../../lib/data-inventory/index.js';\nimport { writeLargeCsv } from '../../../lib/helpers/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface PullDatapointsCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n includeAttributes: boolean;\n includeGuessedCategories: boolean;\n parentCategories?: DataCategoryType[];\n subCategories?: string[];\n}\n\nexport async function pullDatapoints(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n dataSiloIds,\n includeAttributes,\n includeGuessedCategories,\n parentCategories,\n subCategories = [],\n }: PullDatapointsCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const dataPoints = await pullAllDatapoints(client, {\n dataSiloIds,\n includeGuessedCategories,\n parentCategories,\n includeAttributes,\n subCategories, // TODO: https://transcend.height.app/T-40482 - do by name not ID\n });\n\n logger.info(colors.magenta(`Writing datapoints to file \"${file}\"...`));\n let headers: string[] = [];\n const inputs = dataPoints.map((point) => {\n const result = {\n 'Property ID': point.id,\n 'Data Silo': point.dataSilo.title,\n Object: point.dataPoint.name,\n 'Object Path': point.dataPoint.path.join('.'),\n Property: point.name,\n 'Property Description': point.description,\n 'Data Categories': point.categories\n .map((category) => `${category.category}:${category.name}`)\n .join(', '),\n 'Guessed Category': point.pendingCategoryGuesses?.[0]\n ? `${point.pendingCategoryGuesses![0]!.category.category}:${\n point.pendingCategoryGuesses![0]!.category.name\n }`\n : '',\n 'Processing Purposes': point.purposes\n .map((purpose) => `${purpose.purpose}:${purpose.name}`)\n .join(', '),\n ...Object.entries(\n groupBy(point.attributeValues || [], ({ attributeKey }) => attributeKey.name),\n ).reduce(\n (acc, [key, values]) => {\n acc[key] = values.map((value) => value.name).join(',');\n return acc;\n },\n {} as Record<string, string>,\n ),\n };\n headers = uniq([...headers, ...Object.keys(result)]);\n return result;\n });\n await writeLargeCsv(file, inputs, headers);\n } catch (err) {\n logger.error(colors.red(`An error occurred syncing the datapoints: ${err.message}`));\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced datapoints to disk at ${file}! View at ${ADMIN_DASH_DATAPOINTS}`,\n ),\n );\n}\n"],"mappings":"gXAuBA,eAAsB,EAEpB,CACE,OACA,OACA,eACA,cACA,oBACA,2BACA,mBACA,gBAAgB,EAAE,EAEL,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAI,CAIF,IAAM,EAAa,MAAM,EAFV,EAA4B,EAAc,EAER,CAAE,CACjD,cACA,2BACA,mBACA,oBACA,gBACD,CAAC,CAEF,EAAO,KAAK,EAAO,QAAQ,+BAA+B,EAAK,MAAM,CAAC,CACtE,IAAI,EAAoB,EAAE,CAiC1B,MAAM,EAAc,EAhCL,EAAW,IAAK,GAAU,CACvC,IAAM,EAAS,CACb,cAAe,EAAM,GACrB,YAAa,EAAM,SAAS,MAC5B,OAAQ,EAAM,UAAU,KACxB,cAAe,EAAM,UAAU,KAAK,KAAK,IAAI,CAC7C,SAAU,EAAM,KAChB,uBAAwB,EAAM,YAC9B,kBAAmB,EAAM,WACtB,IAAK,GAAa,GAAG,EAAS,SAAS,GAAG,EAAS,OAAO,CAC1D,KAAK,KAAK,CACb,mBAAoB,EAAM,yBAAyB,GAC/C,GAAG,EAAM,uBAAwB,GAAI,SAAS,SAAS,GACrD,EAAM,uBAAwB,GAAI,SAAS,OAE7C,GACJ,sBAAuB,EAAM,SAC1B,IAAK,GAAY,GAAG,EAAQ,QAAQ,GAAG,EAAQ,OAAO,CACtD,KAAK,KAAK,CACb,GAAG,OAAO,QACR,EAAQ,EAAM,iBAAmB,EAAE,EAAG,CAAE,kBAAmB,EAAa,KAAK,CAC9E,CAAC,QACC,EAAK,CAAC,EAAK,MACV,EAAI,GAAO,EAAO,IAAK,GAAU,EAAM,KAAK,CAAC,KAAK,IAAI,CAC/C,GAET,EAAE,CACH,CACF,CAED,MADA,GAAU,EAAK,CAAC,GAAG,EAAS,GAAG,OAAO,KAAK,EAAO,CAAC,CAAC,CAC7C,GAEuB,CAAE,EAAQ,OACnC,EAAK,CACZ,EAAO,MAAM,EAAO,IAAI,6CAA6C,EAAI,UAAU,CAAC,CACpF,KAAK,QAAQ,KAAK,EAAE,CAItB,EAAO,KACL,EAAO,MACL,6CAA6C,EAAK,YAAY,IAC/D,CACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./logger-B-LXIf3U.mjs";import{n as t}from"./buildXdiSyncEndpoint-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import{t as e}from"./logger-B-LXIf3U.mjs";import{n as t}from"./buildXdiSyncEndpoint-CyXZIwZY.mjs";import{t as n}from"./validateTranscendAuth-RgQkJacW.mjs";import{t as r}from"./done-input-validation-9r-9VL6r.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-saIKgNF6.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-saIKgNF6.mjs","names":["buildXdiSyncEndpointHelper"],"sources":["../src/commands/consent/build-xdi-sync-endpoint/impl.ts"],"sourcesContent":["import { writeFileSync } from 'node:fs';\n\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { buildXdiSyncEndpoint as buildXdiSyncEndpointHelper } from '../../../lib/consent-manager/index.js';\nimport { logger } from '../../../logger.js';\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":"kRAoBA,eAAsB,EAEpB,CACE,OACA,cACA,OACA,oBACA,kBACA,qBACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAMtC,GAAM,CAAE,aAAY,QAAS,MAAMA,EAA2B,MAHnC,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{t as e}from"./approvePrivacyRequests-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import{t as e}from"./approvePrivacyRequests-BQBKfJjz.mjs";import{t}from"./done-input-validation-9r-9VL6r.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-x41b0Zix.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-x41b0Zix.mjs","names":[],"sources":["../src/commands/request/approve/impl.ts"],"sourcesContent":["import { RequestAction, RequestOrigin } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { approvePrivacyRequests } from '../../../lib/requests/index.js';\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":"8GAmBA,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"}
|
package/dist/index.d.mts
CHANGED
|
@@ -134198,11 +134198,11 @@ declare const CachedFileState: t.TypeC<{
|
|
|
134198
134198
|
}>>; /** Mapping between request status in import to Transcend request status */
|
|
134199
134199
|
statusToRequestStatus: t.RecordC<t.StringC, t.KeyofC<{
|
|
134200
134200
|
CANCELED: unknown;
|
|
134201
|
-
"[NONE]": unknown;
|
|
134202
134201
|
FAILED_VERIFICATION: unknown;
|
|
134203
134202
|
COMPLETED: unknown;
|
|
134204
134203
|
SECONDARY_COMPLETED: unknown;
|
|
134205
134204
|
REVOKED: unknown;
|
|
134205
|
+
"[NONE]": unknown;
|
|
134206
134206
|
}>>;
|
|
134207
134207
|
}>;
|
|
134208
134208
|
/** Type override */
|
|
@@ -140109,20 +140109,20 @@ declare const PrivacyRequestResponse: t.TypeC<{
|
|
|
140109
140109
|
status: t.KeyofC<{
|
|
140110
140110
|
CANCELED: unknown;
|
|
140111
140111
|
ON_HOLD: unknown;
|
|
140112
|
-
FAILED_VERIFICATION: unknown;
|
|
140113
|
-
COMPLETED: unknown;
|
|
140114
|
-
SECONDARY_COMPLETED: unknown;
|
|
140115
|
-
REVOKED: unknown;
|
|
140116
140112
|
REQUEST_MADE: unknown;
|
|
140113
|
+
FAILED_VERIFICATION: unknown;
|
|
140117
140114
|
ENRICHING: unknown;
|
|
140118
140115
|
WAITING: unknown;
|
|
140119
140116
|
COMPILING: unknown;
|
|
140120
140117
|
APPROVING: unknown;
|
|
140121
140118
|
DELAYED: unknown;
|
|
140119
|
+
COMPLETED: unknown;
|
|
140122
140120
|
DOWNLOADABLE: unknown;
|
|
140123
140121
|
VIEW_CATEGORIES: unknown;
|
|
140124
140122
|
SECONDARY: unknown;
|
|
140123
|
+
SECONDARY_COMPLETED: unknown;
|
|
140125
140124
|
SECONDARY_APPROVING: unknown;
|
|
140125
|
+
REVOKED: unknown;
|
|
140126
140126
|
}>;
|
|
140127
140127
|
type: t.KeyofC<{
|
|
140128
140128
|
AUTOMATED_DECISION_MAKING_OPT_OUT: unknown;
|
|
@@ -146007,20 +146007,20 @@ declare const PrivacyRequest: t.IntersectionC<[t.TypeC<{
|
|
|
146007
146007
|
status: t.KeyofC<{
|
|
146008
146008
|
CANCELED: unknown;
|
|
146009
146009
|
ON_HOLD: unknown;
|
|
146010
|
-
FAILED_VERIFICATION: unknown;
|
|
146011
|
-
COMPLETED: unknown;
|
|
146012
|
-
SECONDARY_COMPLETED: unknown;
|
|
146013
|
-
REVOKED: unknown;
|
|
146014
146010
|
REQUEST_MADE: unknown;
|
|
146011
|
+
FAILED_VERIFICATION: unknown;
|
|
146015
146012
|
ENRICHING: unknown;
|
|
146016
146013
|
WAITING: unknown;
|
|
146017
146014
|
COMPILING: unknown;
|
|
146018
146015
|
APPROVING: unknown;
|
|
146019
146016
|
DELAYED: unknown;
|
|
146017
|
+
COMPLETED: unknown;
|
|
146020
146018
|
DOWNLOADABLE: unknown;
|
|
146021
146019
|
VIEW_CATEGORIES: unknown;
|
|
146022
146020
|
SECONDARY: unknown;
|
|
146021
|
+
SECONDARY_COMPLETED: unknown;
|
|
146023
146022
|
SECONDARY_APPROVING: unknown;
|
|
146023
|
+
REVOKED: unknown;
|
|
146024
146024
|
}>; /** Type of data subject */
|
|
146025
146025
|
subjectType: t.StringC; /** Country of request */
|
|
146026
146026
|
country: t.UnionC<[t.NullC, t.KeyofC<{
|
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 u,i as d,l as f,m as p,n as m,o as h,p as g,r as _,s as v,t as y,u as b}from"./constants-FP8lxFg5.mjs";import{t as x}from"./logger-B-LXIf3U.mjs";import{$ as S,A as ee,B as te,C as ne,D as re,E as ie,F as ae,G as oe,H as se,I as ce,J as le,K as ue,L as de,M as fe,N as pe,O as me,P as he,Q as ge,R as _e,S as ve,T as ye,U as be,V as xe,W as C,X as w,Y as T,Z as E,_ as D,_t as O,a as k,at as A,b as j,bt as M,c as Se,ct as Ce,d as we,dt as Te,et as Ee,f as De,ft as Oe,g as ke,gt as Ae,h as je,ht as Me,i as Ne,it as Pe,j as Fe,k as Ie,l as Le,lt as Re,m as ze,mt as Be,n as Ve,nt as He,o as Ue,ot as We,p as Ge,pt as Ke,q as qe,r as Je,rt as Ye,s as Xe,st as Ze,t as Qe,tt as $e,u as et,ut as tt,v as nt,vt as rt,w as it,x as at,xt as ot,y as st,yt as ct,z as lt}from"./codecs-BOAm14sp.mjs";import{a as ut,i as dt,n as ft,r as pt,t as mt}from"./readTranscendYaml-DnvxeV7w.mjs";import{a as ht,i as gt,n as _t,r as vt,t as yt}from"./parseVariablesFromString-C3CPWxqY.mjs";import{a as bt,c as xt,i as St,l as Ct,n as wt,o as Tt,r as Et,s as Dt,t as Ot,u as kt}from"./constants-KYaYveEQ.mjs";import{i as At,n as jt,r as Mt,t as Nt}from"./parseAttributesFromString-tbxM3lmh.mjs";import{a as Pt,c as Ft,d as It,f as Lt,i as Rt,l as zt,n as Bt,o as Vt,r as Ht,s as Ut,t as Wt,u as Gt}from"./uploadPrivacyRequestsFromCsv-i46OEhw-.mjs";import{t as Kt}from"./readCsv-C-5HBa7w.mjs";import{n as qt,t as Jt}from"./pullUnstructuredSubDataPointRecommendations-C8VuWR7j.mjs";import{a as Yt,i as Xt,n as Zt,o as Qt,r as $t,t as en}from"./request-CikRkOJR.mjs";import{i as tn,n as nn,r as rn,t as an}from"./pullTranscendConfiguration-ChFN8Wp4.mjs";import{i as on,n as sn,r as N,t as cn}from"./fetchAllRequests-B2qEAfDh.mjs";import{a as ln,i as un,n as dn,r as fn,t as pn}from"./pullChunkedCustomSiloOutstandingIdentifiers-Caiw44KV.mjs";import{n as mn,r as hn,t as gn}from"./syncCodePackages-Du1OqJvL.mjs";import{t as _n}from"./markSilentPrivacyRequests-1spmn5h3.mjs";import{a as vn,i as yn,n as bn,o as xn,r as Sn,t as Cn}from"./downloadPrivacyRequestFiles-BY_6MMoZ.mjs";import{n as wn,r as Tn,t as En}from"./extractClientError-ZFI8f5OR.mjs";import{t as Dn}from"./approvePrivacyRequests-DpXfRCtG.mjs";import{t as On}from"./notifyPrivacyRequestsAdditionalTime-DIY4ofMV.mjs";import{t as kn}from"./cancelPrivacyRequests-BEUOjF_G.mjs";import{n as An,t as jn}from"./bulkRestartRequests-BUkavWWX.mjs";import{t as Mn}from"./skipPreflightJobs-CsAbVlmo.mjs";import{t as Nn}from"./bulkRetryEnrichers-Br27FAbD.mjs";import{t as Pn}from"./retryRequestDataSilos-CYvolpVQ.mjs";import{n as P,r as F,t as Fn}from"./streamPrivacyRequestsToCsv-B2yq8AGa.mjs";import{n as In,r as Ln,t as Rn}from"./inquirer-C-TI9k_N.mjs";import{t as zn}from"./collectParquetFilesOrExit-4EqbLDaB.mjs";import{t as Bn}from"./collectCsvFilesOrExit-ChKkrsVz.mjs";import{t as Vn}from"./parquetToCsvOneFile-Bry79xw-.mjs";import{a as Hn,i as Un,n as Wn,o as Gn,r as Kn,s as qn,t as Jn}from"./writeCsv-CbT4a0uj.mjs";import{t as Yn}from"./skipRequestDataSilos-BAO67gHg.mjs";import{t as Xn}from"./removeUnverifiedRequestIdentifiers-C8aAV99N.mjs";import{t as Zn}from"./updateConsentManagerVersionToLatest-Dd0GfGAj.mjs";import{t as Qn}from"./uploadDataFlowsFromCsv-BkrAh4SY.mjs";import{t as $n}from"./uploadCookiesFromCsv-C2lTYrbc.mjs";import{t as er}from"./pullConsentManagerMetrics-CcBfEEzz.mjs";import{n as tr,r as nr,t as rr}from"./buildXdiSyncEndpoint-CpADEY6i.mjs";import{t as ir}from"./consentManagersToBusinessEntities-C95GQMxK.mjs";import{i as ar,n as or,r as sr,t as cr}from"./uploadConsents-DgkSQj5-.mjs";import{n as lr,r as ur,t as dr}from"./pushCronIdentifiersFromCsv-DqOtCwY5.mjs";import{t as fr}from"./markRequestDataSiloIdsCompleted-Cg5Hfs4-.mjs";import{t as pr}from"./generateCrossAccountApiKeys-BkLSweFo.mjs";import{t as mr}from"./validateTranscendAuth-RgQkJacW.mjs";import{t as hr}from"./listFiles-oqwR2oZ4.mjs";import{t as gr}from"./pullAllDatapoints-49ZSGNFN.mjs";import{t as _r}from"./pullManualEnrichmentIdentifiersToCsv-Et8K20SJ.mjs";import{n as vr,r as yr,t as br}from"./pushManualEnrichmentIdentifiersFromCsv-LWKOrJTN.mjs";import{ChatCompletionRole as I,PromptRunProductArea as L,PromptStatus as R,QueueStatus as z}from"@transcend-io/privacy-types";import{chunk as B,difference as xr,groupBy as Sr,keyBy as V,uniq as Cr}from"lodash-es";import{apply as wr,decodeCodec as H,getValues as Tr}from"@transcend-io/type-utils";import{readFileSync as Er,readdirSync as Dr,statSync as Or}from"node:fs";import{join as kr}from"node:path";import U from"colors";import{UPDATE_OR_CREATE_COOKIES as Ar,buildTranscendGraphQLClient as W,createSombraGotInstance as jr,fetchAllAgentFiles as Mr,fetchAllAgents as G,fetchAllLargeLanguageModels as Nr,fetchAllPromptThreads as Pr,fetchAllRequestIdentifiers as Fr,fetchConsentManagerId as Ir,fetchPromptsWithVariables as Lr,makeGraphQLRequest as Rr,reportPromptRun as K,validateSombraVersion as q}from"@transcend-io/sdk";import{map as J,mapSeries as Y}from"@transcend-io/utils";import{createHandlebarsWithHelpers as X}from"@transcend-io/handlebars-utils";import{execSync as Z}from"child_process";import zr from"fast-glob";async function Q(e,t){let n=await Ir(e,{logger:x});await Y(B(t,100),async t=>{await Rr(e,Ar,{variables:{airgapBundleId:n,cookies:t.map(e=>({name:e.name,trackingPurposes:e.trackingPurposes&&e.trackingPurposes.length>0?e.trackingPurposes:void 0,description:e.description,service:e.service,status:e.status,attributes:e.attributes,isRegex:e.isRegex}))},logger:x})})}async function Br(e,t){let n=!1;x.info(U.magenta(`Syncing "${t.length}" cookies...`));let r=t.filter(e=>t.filter(t=>e.name===t.name&&e.isRegex===t.isRegex).length>1);if(r.length>0)throw Error(`Failed to upload cookies as there were non-unique entries found: ${r.map(({name:e})=>e).join(`,`)}`);try{x.info(U.magenta(`Upserting "${t.length}" new cookies...`)),await Q(e,t),x.info(U.green(`Successfully synced ${t.length} cookies!`))}catch(e){n=!0,x.error(U.red(`Failed to create cookies! - ${e.message}`))}return!n}async function Vr({auth:e,sombraAuth:t,actions:n=[],statuses:r=[],identifierSearch:i,pageLimit:a=100,concurrency:s=1,transcendUrl:c=o,createdAtBefore:l,skipRequestIdentifiers:u=!1,createdAtAfter:d,updatedAtBefore:f,updatedAtAfter:p,isTest:m}){let h=W(c,e),g=await jr(c,e,{logger:x,sombraApiKey:t,sombraUrl:process.env.SOMBRA_URL}),_=``;l&&(_+=` before ${l.toISOString()}`),d&&(_+=`${_?`, and`:``} after ${d.toISOString()}`),x.info(U.magenta(`${n.length>0?`Pulling requests of type "${n.join(`" , "`)}"`:`Pulling all requests`}${_}`));let v=s>1&&d&&l,y=v?P(d,l,s):[{createdAtAfter:d,createdAtBefore:l}];v&&x.info(U.magenta(`Splitting date range into ${s} parallel chunks`));let b=(await J(y,e=>N(h,{actions:n,text:i,statuses:r,createdAtBefore:e.createdAtBefore,createdAtAfter:e.createdAtAfter,updatedAtBefore:f,updatedAtAfter:p,isTest:m}),{concurrency:v?s:1})).flat();u||await q(h,{logger:x});let S=u?b.map(e=>({...e,requestIdentifiers:[]})):await J(b,async e=>{let t=await Fr(h,g,{filterBy:{requestId:e.id},skipSombraCheck:!0,logger:x});return{...e,requestIdentifiers:t}},{concurrency:a});return x.info(U.magenta(`Pulled ${S.length} requests`)),{requestsWithRequestIdentifiers:S,requestsFormattedForCsv:S.map(F)}}function Hr(e){try{return e?Er(e,`utf8`):``}catch{return``}}function Ur(e){return Dr(e).filter(t=>Or(kr(e,t)).isDirectory())}function $(e){return RegExp(`<${e}>([\\s\\S]+?)<\\/${e}>`)}function Wr(e){return e}const Gr=e=>{try{return JSON.parse(e)}catch{return e}};var Kr=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=W(n,typeof r==`object`?r.release():r),this.requireApproval=i,this.cacheDuration=a,this.handlebarsOptions=t,this.handlebars=X(t)}async fetchPromptsAndMetadata(){let e=Tr(this.prompts),t=e.map(({id:e})=>e).filter(e=>!!e),n=e.map(({title:e})=>e).filter(e=>!!e),r=Cr(e.map(({agentNames:e})=>e||[]).flat()),[i,a,o]=await Promise.all([Lr(this.graphQLClient,{logger:x,filterBy:{ids:t,titles:n}}),Nr(this.graphQLClient,{logger:x}),G(this.graphQLClient,{logger:x,filterBy:{names:r}})]);this.agentsByName=V(o,`name`),this.agentsByAgentId=V(o,`agentId`),this.largeLanguageModels=a.filter(e=>e.isTranscendHosted===!1);let s=V(i.prompts,`title`),c=V(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=X({...this.handlebarsOptions,templates:[...this.handlebarsOptions.templates||[],...i.promptPartials.map(e=>({name:e.slug,content:e.content}))]}),this.promptContentMap=wr(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 G(this.graphQLClient,{logger:x,filterBy:{names:[e]}});if(n)return this.agentsByName[n.name]=n,this.agentsByAgentId[n.agentId]=n,n}async getPromptThreadBySlackTs(e){let[t]=await Pr(this.graphQLClient,{logger:x,filterBy:{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=[]}=Sr(e,e=>this.agentsByName[e]?`hasCache`:`missingCache`),r=t.map(e=>this.agentsByName[e]);if(n.length===0)return r;let i=B(n,50),a=[];return await Y(i,async e=>{let t=await G(this.graphQLClient,{logger:x,filterBy:{names:e}});t.forEach(e=>{this.agentsByName[e.name]=e,this.agentsByAgentId[e.agentId]=e}),a.push(...t)}),[...r,...a]}getAgentFiles(e){return Mr(this.graphQLClient,{logger:x,filterBy: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!==R.Approved)throw Error(`Assessment "${n.title}" cannot be used because its in status: "${n.status}"`);if(n.status===R.Rejected)throw Error(`Assessment "${n.title}" cannot be used because it's in status: "${n.status}"`);return H(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 H(n.outputCodec,Gr(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!==I.System)throw Error(`promptRunMessages[0].role is expected to be = ${I.System}`);if(n.promptRunMessages[n.promptRunMessages.length-1].role!==I.Assistant)throw Error(`promptRunMessages[${n.promptRunMessages.length-1}].role is expected to be = ${I.Assistant}`);let a=n.promptRunMessages[n.promptRunMessages.length-1].content,o;try{o=this.parseAiResponse(e,a)}catch(e){throw await K(this.graphQLClient,{productArea:L.PromptManager,...n,name:r,error:e.message,status:z.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}:{}}))},{logger:x}),e}let s=await K(this.graphQLClient,{productArea:L.PromptManager,...n,name:r,status:z.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}:{}}))},{logger:x});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!==I.System)throw Error(`promptRunMessages[0].role is expected to be = ${I.System}`);let a=await K(this.graphQLClient,{productArea:L.PromptManager,...n,name:r,status:z.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}:{}}))},{logger:x});return{promptRunId:a,promptRunUrl:`https://app.transcend.io/prompts/runs/${a}`}}};function qr(e){return e.replace(/(https?:\/\/[^\s]+)/g,`<link-omitted>`)}function Jr(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 Yr({baseBranch:e,rootDirectory:t,githubRepo:n,excludedGlob:r=[],fileBlockList:i=[]}){Z(`git fetch origin ${e}`);let a=Z(`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 u,i as d,l as f,m as p,n as m,o as h,p as g,r as _,s as v,t as y,u as b}from"./constants-DrkNQLIO.mjs";import{t as x}from"./logger-B-LXIf3U.mjs";import{$ as S,A as ee,B as te,C as ne,D as re,E as ie,F as ae,G as oe,H as se,I as ce,J as le,K as ue,L as de,M as fe,N as pe,O as me,P as he,Q as ge,R as _e,S as ve,T as ye,U as be,V as xe,W as C,X as w,Y as T,Z as E,_ as D,_t as O,a as k,at as A,b as j,bt as M,c as Se,ct as Ce,d as we,dt as Te,et as Ee,f as De,ft as Oe,g as ke,gt as Ae,h as je,ht as Me,i as Ne,it as Pe,j as Fe,k as Ie,l as Le,lt as Re,m as ze,mt as Be,n as Ve,nt as He,o as Ue,ot as We,p as Ge,pt as Ke,q as qe,r as Je,rt as Ye,s as Xe,st as Ze,t as Qe,tt as $e,u as et,ut as tt,v as nt,vt as rt,w as it,x as at,xt as ot,y as st,yt as ct,z as lt}from"./codecs-BOAm14sp.mjs";import{a as ut,i as dt,n as ft,r as pt,t as mt}from"./readTranscendYaml-DnvxeV7w.mjs";import{a as ht,i as gt,n as _t,r as vt,t as yt}from"./parseVariablesFromString-C3CPWxqY.mjs";import{a as bt,c as xt,i as St,l as Ct,n as wt,o as Tt,r as Et,s as Dt,t as Ot,u as kt}from"./constants-KYaYveEQ.mjs";import{i as At,n as jt,r as Mt,t as Nt}from"./parseAttributesFromString-tbxM3lmh.mjs";import{a as Pt,c as Ft,d as It,f as Lt,i as Rt,l as zt,n as Bt,o as Vt,r as Ht,s as Ut,t as Wt,u as Gt}from"./uploadPrivacyRequestsFromCsv-Dz3Q-YJZ.mjs";import{t as Kt}from"./readCsv-C-5HBa7w.mjs";import{n as qt,t as Jt}from"./pullUnstructuredSubDataPointRecommendations-C8VuWR7j.mjs";import{a as Yt,i as Xt,n as Zt,o as Qt,r as $t,t as en}from"./request-CikRkOJR.mjs";import{i as tn,n as nn,r as rn,t as an}from"./pullTranscendConfiguration-ChFN8Wp4.mjs";import{i as on,n as sn,r as N,t as cn}from"./fetchAllRequests-B2qEAfDh.mjs";import{a as ln,i as un,n as dn,r as fn,t as pn}from"./pullChunkedCustomSiloOutstandingIdentifiers-C5uhtMJZ.mjs";import{n as mn,r as hn,t as gn}from"./syncCodePackages-Du1OqJvL.mjs";import{t as _n}from"./markSilentPrivacyRequests-DSeSY-Ii.mjs";import{a as vn,i as yn,n as bn,o as xn,r as Sn,t as Cn}from"./downloadPrivacyRequestFiles-DqiA-mse.mjs";import{n as wn,r as Tn,t as En}from"./extractClientError-ZFI8f5OR.mjs";import{t as Dn}from"./approvePrivacyRequests-BQBKfJjz.mjs";import{t as On}from"./notifyPrivacyRequestsAdditionalTime-CBxM2ycO.mjs";import{t as kn}from"./cancelPrivacyRequests-h0Jjzwz1.mjs";import{n as An,t as jn}from"./bulkRestartRequests-DhJ-tAul.mjs";import{t as Mn}from"./skipPreflightJobs-_y0gfjsz.mjs";import{t as Nn}from"./bulkRetryEnrichers-CINDJT29.mjs";import{t as Pn}from"./retryRequestDataSilos-OfPZjwRt.mjs";import{n as P,r as F,t as Fn}from"./streamPrivacyRequestsToCsv-DlQbNdTN.mjs";import{n as In,r as Ln,t as Rn}from"./inquirer-C-TI9k_N.mjs";import{t as zn}from"./collectParquetFilesOrExit-4EqbLDaB.mjs";import{t as Bn}from"./collectCsvFilesOrExit-ChKkrsVz.mjs";import{t as Vn}from"./parquetToCsvOneFile-Bry79xw-.mjs";import{a as Hn,i as Un,n as Wn,o as Gn,r as Kn,s as qn,t as Jn}from"./writeCsv-CbT4a0uj.mjs";import{t as Yn}from"./skipRequestDataSilos-1DJUOU5A.mjs";import{t as Xn}from"./removeUnverifiedRequestIdentifiers-q0ZyY9AM.mjs";import{t as Zn}from"./updateConsentManagerVersionToLatest-D0-vKrkk.mjs";import{t as Qn}from"./uploadDataFlowsFromCsv-BJ4eSmI4.mjs";import{t as $n}from"./uploadCookiesFromCsv-d-1JGI8B.mjs";import{t as er}from"./pullConsentManagerMetrics-CcBfEEzz.mjs";import{n as tr,r as nr,t as rr}from"./buildXdiSyncEndpoint-CyXZIwZY.mjs";import{t as ir}from"./consentManagersToBusinessEntities-C95GQMxK.mjs";import{i as ar,n as or,r as sr,t as cr}from"./uploadConsents-Rp0YJNA4.mjs";import{n as lr,r as ur,t as dr}from"./pushCronIdentifiersFromCsv-5rPEhGSa.mjs";import{t as fr}from"./markRequestDataSiloIdsCompleted-CY2wuSvF.mjs";import{t as pr}from"./generateCrossAccountApiKeys-CpaKhWfU.mjs";import{t as mr}from"./validateTranscendAuth-RgQkJacW.mjs";import{t as hr}from"./listFiles-oqwR2oZ4.mjs";import{t as gr}from"./pullAllDatapoints-49ZSGNFN.mjs";import{t as _r}from"./pullManualEnrichmentIdentifiersToCsv-DAjzpJrD.mjs";import{n as vr,r as yr,t as br}from"./pushManualEnrichmentIdentifiersFromCsv-BWn9vFTr.mjs";import{ChatCompletionRole as I,PromptRunProductArea as L,PromptStatus as R,QueueStatus as z}from"@transcend-io/privacy-types";import{chunk as B,difference as xr,groupBy as Sr,keyBy as V,uniq as Cr}from"lodash-es";import{apply as wr,decodeCodec as H,getValues as Tr}from"@transcend-io/type-utils";import{readFileSync as Er,readdirSync as Dr,statSync as Or}from"node:fs";import{join as kr}from"node:path";import U from"colors";import{UPDATE_OR_CREATE_COOKIES as Ar,buildTranscendGraphQLClient as W,createSombraGotInstance as jr,fetchAllAgentFiles as Mr,fetchAllAgents as G,fetchAllLargeLanguageModels as Nr,fetchAllPromptThreads as Pr,fetchAllRequestIdentifiers as Fr,fetchConsentManagerId as Ir,fetchPromptsWithVariables as Lr,makeGraphQLRequest as Rr,reportPromptRun as K,validateSombraVersion as q}from"@transcend-io/sdk";import{map as J,mapSeries as Y}from"@transcend-io/utils";import{createHandlebarsWithHelpers as X}from"@transcend-io/handlebars-utils";import{execSync as Z}from"child_process";import zr from"fast-glob";async function Q(e,t){let n=await Ir(e,{logger:x});await Y(B(t,100),async t=>{await Rr(e,Ar,{variables:{airgapBundleId:n,cookies:t.map(e=>({name:e.name,trackingPurposes:e.trackingPurposes&&e.trackingPurposes.length>0?e.trackingPurposes:void 0,description:e.description,service:e.service,status:e.status,attributes:e.attributes,isRegex:e.isRegex}))},logger:x})})}async function Br(e,t){let n=!1;x.info(U.magenta(`Syncing "${t.length}" cookies...`));let r=t.filter(e=>t.filter(t=>e.name===t.name&&e.isRegex===t.isRegex).length>1);if(r.length>0)throw Error(`Failed to upload cookies as there were non-unique entries found: ${r.map(({name:e})=>e).join(`,`)}`);try{x.info(U.magenta(`Upserting "${t.length}" new cookies...`)),await Q(e,t),x.info(U.green(`Successfully synced ${t.length} cookies!`))}catch(e){n=!0,x.error(U.red(`Failed to create cookies! - ${e.message}`))}return!n}async function Vr({auth:e,sombraAuth:t,actions:n=[],statuses:r=[],identifierSearch:i,pageLimit:a=100,concurrency:s=1,transcendUrl:c=o,createdAtBefore:l,skipRequestIdentifiers:u=!1,createdAtAfter:d,updatedAtBefore:f,updatedAtAfter:p,isTest:m}){let h=W(c,e),g=await jr(c,e,{logger:x,sombraApiKey:t,sombraUrl:process.env.SOMBRA_URL}),_=``;l&&(_+=` before ${l.toISOString()}`),d&&(_+=`${_?`, and`:``} after ${d.toISOString()}`),x.info(U.magenta(`${n.length>0?`Pulling requests of type "${n.join(`" , "`)}"`:`Pulling all requests`}${_}`));let v=s>1&&d&&l,y=v?P(d,l,s):[{createdAtAfter:d,createdAtBefore:l}];v&&x.info(U.magenta(`Splitting date range into ${s} parallel chunks`));let b=(await J(y,e=>N(h,{actions:n,text:i,statuses:r,createdAtBefore:e.createdAtBefore,createdAtAfter:e.createdAtAfter,updatedAtBefore:f,updatedAtAfter:p,isTest:m}),{concurrency:v?s:1})).flat();u||await q(h,{logger:x});let S=u?b.map(e=>({...e,requestIdentifiers:[]})):await J(b,async e=>{let t=await Fr(h,g,{filterBy:{requestId:e.id},skipSombraCheck:!0,logger:x});return{...e,requestIdentifiers:t}},{concurrency:a});return x.info(U.magenta(`Pulled ${S.length} requests`)),{requestsWithRequestIdentifiers:S,requestsFormattedForCsv:S.map(F)}}function Hr(e){try{return e?Er(e,`utf8`):``}catch{return``}}function Ur(e){return Dr(e).filter(t=>Or(kr(e,t)).isDirectory())}function $(e){return RegExp(`<${e}>([\\s\\S]+?)<\\/${e}>`)}function Wr(e){return e}const Gr=e=>{try{return JSON.parse(e)}catch{return e}};var Kr=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=W(n,typeof r==`object`?r.release():r),this.requireApproval=i,this.cacheDuration=a,this.handlebarsOptions=t,this.handlebars=X(t)}async fetchPromptsAndMetadata(){let e=Tr(this.prompts),t=e.map(({id:e})=>e).filter(e=>!!e),n=e.map(({title:e})=>e).filter(e=>!!e),r=Cr(e.map(({agentNames:e})=>e||[]).flat()),[i,a,o]=await Promise.all([Lr(this.graphQLClient,{logger:x,filterBy:{ids:t,titles:n}}),Nr(this.graphQLClient,{logger:x}),G(this.graphQLClient,{logger:x,filterBy:{names:r}})]);this.agentsByName=V(o,`name`),this.agentsByAgentId=V(o,`agentId`),this.largeLanguageModels=a.filter(e=>e.isTranscendHosted===!1);let s=V(i.prompts,`title`),c=V(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=X({...this.handlebarsOptions,templates:[...this.handlebarsOptions.templates||[],...i.promptPartials.map(e=>({name:e.slug,content:e.content}))]}),this.promptContentMap=wr(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 G(this.graphQLClient,{logger:x,filterBy:{names:[e]}});if(n)return this.agentsByName[n.name]=n,this.agentsByAgentId[n.agentId]=n,n}async getPromptThreadBySlackTs(e){let[t]=await Pr(this.graphQLClient,{logger:x,filterBy:{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=[]}=Sr(e,e=>this.agentsByName[e]?`hasCache`:`missingCache`),r=t.map(e=>this.agentsByName[e]);if(n.length===0)return r;let i=B(n,50),a=[];return await Y(i,async e=>{let t=await G(this.graphQLClient,{logger:x,filterBy:{names:e}});t.forEach(e=>{this.agentsByName[e.name]=e,this.agentsByAgentId[e.agentId]=e}),a.push(...t)}),[...r,...a]}getAgentFiles(e){return Mr(this.graphQLClient,{logger:x,filterBy: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!==R.Approved)throw Error(`Assessment "${n.title}" cannot be used because its in status: "${n.status}"`);if(n.status===R.Rejected)throw Error(`Assessment "${n.title}" cannot be used because it's in status: "${n.status}"`);return H(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 H(n.outputCodec,Gr(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!==I.System)throw Error(`promptRunMessages[0].role is expected to be = ${I.System}`);if(n.promptRunMessages[n.promptRunMessages.length-1].role!==I.Assistant)throw Error(`promptRunMessages[${n.promptRunMessages.length-1}].role is expected to be = ${I.Assistant}`);let a=n.promptRunMessages[n.promptRunMessages.length-1].content,o;try{o=this.parseAiResponse(e,a)}catch(e){throw await K(this.graphQLClient,{productArea:L.PromptManager,...n,name:r,error:e.message,status:z.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}:{}}))},{logger:x}),e}let s=await K(this.graphQLClient,{productArea:L.PromptManager,...n,name:r,status:z.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}:{}}))},{logger:x});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!==I.System)throw Error(`promptRunMessages[0].role is expected to be = ${I.System}`);let a=await K(this.graphQLClient,{productArea:L.PromptManager,...n,name:r,status:z.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}:{}}))},{logger:x});return{promptRunId:a,promptRunUrl:`https://app.transcend.io/prompts/runs/${a}`}}};function qr(e){return e.replace(/(https?:\/\/[^\s]+)/g,`<link-omitted>`)}function Jr(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 Yr({baseBranch:e,rootDirectory:t,githubRepo:n,excludedGlob:r=[],fileBlockList:i=[]}){Z(`git fetch origin ${e}`);let a=Z(`git ls-remote ${n} "refs/heads/${e}" | cut -f 1`,{encoding:`utf-8`}).split(`
|
|
2
2
|
`)[0],o=Z(`git rev-parse HEAD`,{encoding:`utf-8`}).split(`
|
|
3
3
|
`)[0];if(!a||!o)throw Error(`FAILED TO FIND COMMIT RANGE`);let s=xr(Z(`git fetch && git diff --name-only "${e||a}...${o}" -- ${t}`,{encoding:`utf-8`}).split(`
|
|
4
4
|
`).filter(e=>e),i),c=r.length>0?zr.sync(s,{ignore:r}):s,l={};return c.forEach(e=>{l[e]=Z(`git show ${o}:${e}`,{encoding:`utf-8`})}),{changedFiles:s,fileDiffs:l,repoName:n.split(`/`).pop().split(`.`)[0],commit:o}}export{y as ADMIN_DASH,m as ADMIN_DASH_DATAPOINTS,_ as ADMIN_DASH_INTEGRATIONS,en as APPROVE_PRIVACY_REQUEST,tn as ASSESSMENT_TEMPLATES,Qe as ActionInput,Ve as ActionItemCollectionInput,Je as ActionItemInput,Ne as AgentFileInput,k as AgentFunctionInput,Ue as AgentInput,Xe as ApiKeyInput,Se as AssessmentAnswerOptionInput,Le as AssessmentDisplayLogicInput,et as AssessmentInput,we as AssessmentNestedRuleInput,De as AssessmentResourceInput,Ge as AssessmentRetentionScheduleInput,ze as AssessmentRuleInput,je as AssessmentSectionInput,ke as AssessmentSectionQuestionInput,D as AssessmentTemplateInput,Rt as AttestedExtraIdentifiers,nt as AttributeInput,st as AttributePreview,j as AttributeValueInput,Ot as BLANK,wt as BULK_APPLY,at as BusinessEntityInput,Zt as CANCEL_PRIVACY_REQUEST,Et as CAN_APPLY_IN_BULK,St as CachedFileState,bt as CachedRequestState,ve as CodePackageInput,ne as CodePackageSdk,Tt as ColumnName,it as ConsentManageExperienceInput,ye as ConsentManagerInput,ie as ConsentManagerServiceMetadata,re as ConsentPreferenceTopic,me as ConsentPreferenceTopicOptionValue,Ie as ConsentPurpose,ee as CookieCsvInput,Fe as CookieInput,dn as CronIdentifier,lr as CronIdentifierPush,fn as CronPartition,d as DEBUG,o as DEFAULT_TRANSCEND_API,h as DEFAULT_TRANSCEND_CONSENT_API,an as DEFAULT_TRANSCEND_PULL_RESOURCES,fe as DataCategoryGuessInput,pe as DataCategoryInput,he as DataCategoryPreviewInput,ae as DataCategoryRecommendationInput,ce as DataFlowCsvInput,de as DataFlowInput,_e as DataSiloInput,lt as DataSubjectInput,te as DatapointInput,qt as ENTRY_COUNT,vr as EnrichPrivacyRequest,xe as EnricherInput,se as FieldInput,Dt as IDENTIFIER_BLOCK_LIST,rr as IP_ADDRESS_REGEX,xt as IS_REQUIRED,be as IdentifierInput,C as ImportOnetrustAssessmentsInput,Sn as IntlMessage,oe as IntlMessageInput,Ct as NONE,$t as NOTIFY_ADDITIONAL_TIME,a as OneTrustFileFormat,n as OneTrustPullResource,i as OneTrustPullSource,ue as OpenAIEnabledRoute,qe as OpenAIEnabledRoutes,le as OpenAIIntegration,t as OpenAIRouteName,Nt as ParsedAttributeInput,T as PartitionInput,w as PathfinderPolicy,e as PathfinderPolicyName,E as PathfinderPolicyNameC,ge as PathfinderPromptRunMetadata,S as PolicyInput,Ee as PrivacyCenterInput,cn as PrivacyRequest,Pt as PrivacyRequestInput,wn as PrivacyRequestResponse,$e as ProcessingActivityInput,He as ProcessingPurposeInput,Ye as ProcessingPurposePreviewInput,Pe as PromptAVendorEmailSettings,A as PromptGroupInput,We as PromptInput,Ze as PromptPartialInput,cr as PurposeMap,Xt as REQUESTS,Yt as REQUESTS_COUNT,v as RETRYABLE_BATCH_STATUSES,Ce as RegionInput,Re as RepositoryInput,yn as RequestFileMetadata,vn as RequestFileMetadataResponse,sn as RequestPurposeTrigger,tt as RiskAssignmentInput,Te as RiskLogicInput,s as SCOPES_BY_TITLE,f as SCOPE_TITLES,Oe as SiloDiscoveryResultInput,Ke as SoftwareDevelopmentKitInput,Be as StoredApiKey,kt as SuccessfulRequest,b as TR_PULL_RESOURCE_SCOPE_MAP,c as TR_PUSH_RESOURCE_SCOPE_MAP,l as TR_YML_RESOURCE_TO_FIELD_NAME,Me as TeamInput,Ae as TemplateInput,O as TranscendInput,Kr as TranscendPromptManager,r as TranscendPullResource,Qt as UPDATE_PRIVACY_REQUEST,or as USP_STRING_REGEX,mt as VARIABLE_PARAMETERS_NAME,ft as VARIABLE_PARAMETERS_REGEXP,rt as VendorInput,ct as WebhookHeader,Jn as appendCsvRowsOrdered,Wn as appendCsvSync,Dn as approvePrivacyRequests,ot as buildAIIntegrationType,M as buildEnabledRouteType,tr as buildXdiSyncEndpoint,jn as bulkRestartRequests,Nn as bulkRetryEnrichers,kn as cancelPrivacyRequests,Bn as collectCsvFilesOrExit,zn as collectParquetFilesOrExit,ir as consentManagersToBusinessEntities,gn as createCodePackage,ar as createConsentToken,$ as createRegexForTag,Wr as defineTranscendPrompts,p as description,nr as domainToHost,Cn as downloadPrivacyRequestFiles,yr as enrichPrivacyRequest,ht as ensureAllDataSubjectsExist,En as extractClientError,rn as fetchAllAssessmentTemplates,N as fetchAllRequests,ln as fetchRequestDataSiloActiveCount,on as fetchRequestsTotalCount,Jr as filterNullishValuesFromObject,Gt as filterRows,F as formatRequestForCsv,Mt as fuzzyMatchColumns,At as fuzzySearch,pr as generateCrossAccountApiKeys,xn as getFileMetadataForPrivacyRequests,Yr as getGitFilesThatChanged,It as getUniqueValuesForColumn,Kn as initCsvFile,Rn as inquirerAutoComplete,In as inquirerConfirmBoolean,Ln as inquirerConfirmText,Ur as listDirectories,hr as listFiles,Bt as mapColumnsToAttributes,Ht as mapColumnsToIdentifiers,zt as mapCsvColumnsToApi,Vt as mapCsvRowsToRequestInputs,Lt as mapEnumValues,Ft as mapRequestEnumValues,ur as markCronIdentifierCompleted,fr as markRequestDataSiloIdsCompleted,_n as markSilentPrivacyRequests,_t as mergeTranscendInputs,g as name,Ut as normalizeIdentifierValue,On as notifyPrivacyRequestsAdditionalTime,Vn as parquetToCsvOneFile,jt as parseAttributesFromString,Un as parseFilePath,yt as parseVariablesFromString,gr as pullAllDatapoints,pn as pullChunkedCustomSiloOutstandingIdentifiers,er as pullConsentManagerMetrics,un as pullCronPageOfIdentifiers,_r as pullManualEnrichmentIdentifiersToCsv,Vr as pullPrivacyRequests,nn as pullTranscendConfiguration,Jt as pullUnstructuredSubDataPointRecommendations,dr as pushCronIdentifiersFromCsv,br as pushManualEnrichmentIdentifiersFromCsv,Kt as readCsv,Hr as readSafe,pt as readTranscendYaml,qr as removeLinks,Xn as removeUnverifiedRequestIdentifiers,dt as replaceVariablesInYaml,An as restartPrivacyRequest,Pn as retryRequestDataSilos,Mn as skipPreflightJobs,Yn as skipRequestDataSilos,P as splitDateRange,bn as streamPrivacyRequestFiles,Fn as streamPrivacyRequestsToCsv,Tn as submitPrivacyRequest,mn as syncCodePackages,vt as syncConfigurationToTranscend,Br as syncCookies,gt as syncDataSilos,hn as updateCodePackages,Zn as updateConsentManagerVersionToLatest,Q as updateOrCreateCookies,sr as uploadConsents,$n as uploadCookiesFromCsv,Qn as uploadDataFlowsFromCsv,Wt as uploadPrivacyRequestsFromCsv,mr as validateTranscendAuth,u as version,Hn as writeCsv,Gn as writeCsvSync,qn as writeLargeCsv,ut as writeTranscendYaml};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./constants-
|
|
2
|
-
//# sourceMappingURL=markRequestDataSiloIdsCompleted-
|
|
1
|
+
import{a as e}from"./constants-DrkNQLIO.mjs";import{t}from"./logger-B-LXIf3U.mjs";import{RequestDataSiloStatus as n}from"@transcend-io/privacy-types";import r from"colors";import{CHANGE_REQUEST_DATA_SILO_STATUS as i,buildTranscendGraphQLClient as a,fetchRequestDataSilo as o,makeGraphQLRequest as s}from"@transcend-io/sdk";import{map as c}from"@transcend-io/utils";import l from"cli-progress";async function u({requestIds:u,dataSiloId:d,auth:f,concurrency:p=100,status:m=n.Resolved,transcendUrl:h=e}){let g=a(h,f),_=new Date().getTime(),v=new l.SingleBar({},l.Presets.shades_classic);t.info(r.magenta(`Notifying Transcend for data silo "${d}" marking "${u.length}" requests as completed.`));let y=0;v.start(u.length,0),await c(u,async e=>{let n=await o(g,{logger:t,filterBy:{requestId:e,dataSiloId:d}});try{await s(g,i,{variables:{requestDataSiloId:n.id,status:m},logger:t})}catch(e){if(!e.message.includes(`Client error: Request must be active:`)&&!e.message.includes(`Failed to find RequestDataSilo`))throw e}y+=1,v.update(y)},{concurrency:p}),v.stop();let b=new Date().getTime()-_;return t.info(r.green(`Successfully notified Transcend in "${b/1e3}" seconds!`)),u.length}export{u as t};
|
|
2
|
+
//# sourceMappingURL=markRequestDataSiloIdsCompleted-CY2wuSvF.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markRequestDataSiloIdsCompleted-
|
|
1
|
+
{"version":3,"file":"markRequestDataSiloIdsCompleted-CY2wuSvF.mjs","names":[],"sources":["../src/lib/cron/markRequestDataSiloIdsCompleted.ts"],"sourcesContent":["import { RequestDataSiloStatus } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n makeGraphQLRequest,\n CHANGE_REQUEST_DATA_SILO_STATUS,\n fetchRequestDataSilo,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\n\n/**\n * Given a CSV of Request IDs, mark associated RequestDataSilos as completed\n *\n * @param options - Options\n * @returns Number of items marked as completed\n */\nexport async function markRequestDataSiloIdsCompleted({\n requestIds,\n dataSiloId,\n auth,\n concurrency = 100,\n status = RequestDataSiloStatus.Resolved,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The list of request ids to mark as completed */\n requestIds: string[];\n /** Transcend API key authentication */\n auth: string;\n /** Data Silo ID to pull down jobs for */\n dataSiloId: string;\n /** Status to update requests to */\n status?: RequestDataSiloStatus;\n /** Upload concurrency */\n concurrency?: number;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Notify Transcend\n logger.info(\n colors.magenta(\n `Notifying Transcend for data silo \"${dataSiloId}\" marking \"${requestIds.length}\" requests as completed.`,\n ),\n );\n\n let total = 0;\n progressBar.start(requestIds.length, 0);\n await map(\n requestIds,\n async (requestId) => {\n const requestDataSilo = await fetchRequestDataSilo(client, {\n logger,\n filterBy: { requestId, dataSiloId },\n });\n\n try {\n await makeGraphQLRequest<{\n /** Whether we successfully uploaded the results */\n success: boolean;\n }>(client, CHANGE_REQUEST_DATA_SILO_STATUS, {\n variables: {\n requestDataSiloId: requestDataSilo.id,\n status,\n },\n logger,\n });\n } catch (err) {\n if (\n !err.message.includes('Client error: Request must be active:') &&\n !err.message.includes('Failed to find RequestDataSilo')\n ) {\n throw err;\n }\n }\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(colors.green(`Successfully notified Transcend in \"${totalTime / 1000}\" seconds!`));\n return requestIds.length;\n}\n"],"mappings":"yYAoBA,eAAsB,EAAgC,CACpD,aACA,aACA,OACA,cAAc,IACd,SAAS,EAAsB,SAC/B,eAAe,GAcG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAGrF,EAAO,KACL,EAAO,QACL,sCAAsC,EAAW,aAAa,EAAW,OAAO,0BACjF,CACF,CAED,IAAI,EAAQ,EACZ,EAAY,MAAM,EAAW,OAAQ,EAAE,CACvC,MAAM,EACJ,EACA,KAAO,IAAc,CACnB,IAAM,EAAkB,MAAM,EAAqB,EAAQ,CACzD,SACA,SAAU,CAAE,YAAW,aAAY,CACpC,CAAC,CAEF,GAAI,CACF,MAAM,EAGH,EAAQ,EAAiC,CAC1C,UAAW,CACT,kBAAmB,EAAgB,GACnC,SACD,CACD,SACD,CAAC,OACK,EAAK,CACZ,GACE,CAAC,EAAI,QAAQ,SAAS,wCAAwC,EAC9D,CAAC,EAAI,QAAQ,SAAS,iCAAiC,CAEvD,MAAM,EAIV,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAGvB,OADA,EAAO,KAAK,EAAO,MAAM,uCAAuC,EAAY,IAAK,YAAY,CAAC,CACvF,EAAW"}
|
package/dist/{markSilentPrivacyRequests-1spmn5h3.mjs → markSilentPrivacyRequests-DSeSY-Ii.mjs}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./constants-
|
|
2
|
-
//# sourceMappingURL=markSilentPrivacyRequests-
|
|
1
|
+
import{a as e}from"./constants-DrkNQLIO.mjs";import{t}from"./logger-B-LXIf3U.mjs";import{o as n}from"./request-CikRkOJR.mjs";import{r}from"./fetchAllRequests-B2qEAfDh.mjs";import{RequestStatus as i}from"@transcend-io/privacy-types";import a from"colors";import{buildTranscendGraphQLClient as o,makeGraphQLRequest as s}from"@transcend-io/sdk";import{map as c}from"@transcend-io/utils";import l from"cli-progress";async function u({requestActions:u,auth:d,requestIds:f,statuses:p=[i.Compiling,i.RequestMade,i.Delayed,i.Approving,i.Secondary,i.Enriching,i.Waiting,i.SecondaryApproving],createdAtAfter:m,createdAtBefore:h,updatedAtBefore:g,updatedAtAfter:_,concurrency:v=100,transcendUrl:y=e}){let b=o(y,d),x=new Date().getTime(),S=new l.SingleBar({},l.Presets.shades_classic),C=await r(b,{actions:u,statuses:p,createdAtBefore:h,createdAtAfter:m,updatedAtBefore:g,updatedAtAfter:_,isSilent:!1,requestIds:f});t.info(a.magenta(`Marking "${C.length}" as silent mode.`));let w=0;S.start(C.length,0),await c(C,async e=>{await s(b,n,{variables:{input:{id:e.id,isSilent:!0}},logger:t}),w+=1,S.update(w)},{concurrency:v}),S.stop();let T=new Date().getTime()-x;return t.info(a.green(`Successfully marked ${w} requests as silent mode in "${T/1e3}" seconds!`)),C.length}export{u as t};
|
|
2
|
+
//# sourceMappingURL=markSilentPrivacyRequests-DSeSY-Ii.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markSilentPrivacyRequests-
|
|
1
|
+
{"version":3,"file":"markSilentPrivacyRequests-DSeSY-Ii.mjs","names":[],"sources":["../src/lib/requests/markSilentPrivacyRequests.ts"],"sourcesContent":["import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, makeGraphQLRequest } from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { UPDATE_PRIVACY_REQUEST, fetchAllRequests } from '../graphql/index.js';\n\n/**\n * Mark a set of privacy requests to be in silent mode\n *\n * @param options - Options\n * @returns The number of requests marked silent\n */\nexport async function markSilentPrivacyRequests({\n requestActions,\n auth,\n requestIds,\n statuses = [\n RequestStatus.Compiling,\n RequestStatus.RequestMade,\n RequestStatus.Delayed,\n RequestStatus.Approving,\n RequestStatus.Secondary,\n RequestStatus.Enriching,\n RequestStatus.Waiting,\n RequestStatus.SecondaryApproving,\n ],\n createdAtAfter,\n createdAtBefore,\n updatedAtBefore,\n updatedAtAfter,\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The request actions that should be restarted */\n requestActions: RequestAction[];\n /** Transcend API key authentication */\n auth: string;\n /** Concurrency limit for approving */\n concurrency?: number;\n /** The request statuses to mark silent */\n statuses?: RequestStatus[];\n /** The set of privacy requests to mark silent */\n requestIds?: string[];\n /** Filter for requests created before this date */\n createdAtBefore?: Date;\n /** Filter for requests created after this date */\n createdAtAfter?: Date;\n /** Filter for requests updated before this date */\n updatedAtBefore?: Date;\n /** Filter for requests updated after this date */\n updatedAtAfter?: Date;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Pull in the requests\n const allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n statuses,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isSilent: false,\n requestIds,\n });\n\n // Notify Transcend\n logger.info(colors.magenta(`Marking \"${allRequests.length}\" as silent mode.`));\n\n let total = 0;\n progressBar.start(allRequests.length, 0);\n await map(\n allRequests,\n async (requestToMarkSilent) => {\n await makeGraphQLRequest(client, UPDATE_PRIVACY_REQUEST, {\n variables: {\n input: {\n id: requestToMarkSilent.id,\n isSilent: true,\n },\n },\n logger,\n });\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully marked ${total} requests as silent mode in \"${totalTime / 1000}\" seconds!`,\n ),\n );\n return allRequests.length;\n}\n"],"mappings":"4ZAgBA,eAAsB,EAA0B,CAC9C,iBACA,OACA,aACA,WAAW,CACT,EAAc,UACd,EAAc,YACd,EAAc,QACd,EAAc,UACd,EAAc,UACd,EAAc,UACd,EAAc,QACd,EAAc,mBACf,CACD,iBACA,kBACA,kBACA,iBACA,cAAc,IACd,eAAe,GAsBG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAG/E,EAAc,MAAM,EAAiB,EAAQ,CACjD,QAAS,EACT,WACA,kBACA,iBACA,kBACA,iBACA,SAAU,GACV,aACD,CAAC,CAGF,EAAO,KAAK,EAAO,QAAQ,YAAY,EAAY,OAAO,mBAAmB,CAAC,CAE9E,IAAI,EAAQ,EACZ,EAAY,MAAM,EAAY,OAAQ,EAAE,CACxC,MAAM,EACJ,EACA,KAAO,IAAwB,CAC7B,MAAM,EAAmB,EAAQ,EAAwB,CACvD,UAAW,CACT,MAAO,CACL,GAAI,EAAoB,GACxB,SAAU,GACX,CACF,CACD,SACD,CAAC,CAEF,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAOvB,OALA,EAAO,KACL,EAAO,MACL,uBAAuB,EAAM,+BAA+B,EAAY,IAAK,YAC9E,CACF,CACM,EAAY"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./constants-
|
|
2
|
-
//# sourceMappingURL=notifyPrivacyRequestsAdditionalTime-
|
|
1
|
+
import{a as e}from"./constants-DrkNQLIO.mjs";import{t}from"./logger-B-LXIf3U.mjs";import{r as n}from"./request-CikRkOJR.mjs";import{r}from"./fetchAllRequests-B2qEAfDh.mjs";import{RequestAction as i}from"@transcend-io/privacy-types";import a from"colors";import{buildTranscendGraphQLClient as o,fetchAllTemplates as s,makeGraphQLRequest as c}from"@transcend-io/sdk";import{map as l}from"@transcend-io/utils";import u from"cli-progress";async function d({requestActions:d=Object.values(i),auth:f,requestIds:p,createdAtBefore:m,days:h=45,daysLeft:g=10,createdAtAfter:_,updatedAtBefore:v,updatedAtAfter:y,emailTemplate:b=`Additional Time Needed`,concurrency:x=100,transcendUrl:S=e}){let C=o(S,f),w=new Date().getTime(),T=new u.SingleBar({},u.Presets.shades_classic),E=(await s(C,{logger:t,filterBy:{title:b}})).find(e=>e.title===b);if(!E)throw Error(`Failed to find a template with title: "${b}"`);let D=await r(C,{actions:d,createdAtBefore:m,createdAtAfter:_,updatedAtBefore:v,updatedAtAfter:y,isSilent:!1,isClosed:!1,requestIds:p});D=D.filter(e=>typeof e.daysRemaining==`number`&&e.daysRemaining<g),t.info(a.magenta(`Notifying "${D.length}" that more time is needed.`));let O=0;T.start(D.length,0),await l(D,async e=>{await c(C,n,{variables:{input:{requestId:e.id,template:E.template.defaultMessage,subject:E.subject.defaultMessage,additionalTime:h}},logger:t}),O+=1,T.update(O)},{concurrency:x}),T.stop();let k=new Date().getTime()-w;return t.info(a.green(`Successfully marked ${O} requests as silent mode in "${k/1e3}" seconds!`)),D.length}export{d as t};
|
|
2
|
+
//# sourceMappingURL=notifyPrivacyRequestsAdditionalTime-CBxM2ycO.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifyPrivacyRequestsAdditionalTime-
|
|
1
|
+
{"version":3,"file":"notifyPrivacyRequestsAdditionalTime-CBxM2ycO.mjs","names":[],"sources":["../src/lib/requests/notifyPrivacyRequestsAdditionalTime.ts"],"sourcesContent":["import { RequestAction } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n fetchAllTemplates,\n makeGraphQLRequest,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { NOTIFY_ADDITIONAL_TIME, fetchAllRequests } from '../graphql/index.js';\n\n/**\n * Mark a set of privacy requests to be in silent mode.\n * Note requests in silent mode are ignored\n *\n * @param options - Options\n * @returns The number of requests marked silent\n */\nexport async function notifyPrivacyRequestsAdditionalTime({\n requestActions = Object.values(RequestAction),\n auth,\n requestIds,\n createdAtBefore,\n days = 45,\n daysLeft = 10,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n emailTemplate = 'Additional Time Needed',\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The request actions that should be restarted */\n requestActions?: RequestAction[];\n /** Filter for requests created before this date */\n createdAtBefore: Date;\n /** Filter for requests created after this date */\n createdAtAfter?: Date;\n /** Filter for requests updated before this date */\n updatedAtBefore?: Date;\n /** Filter for requests updated after this date */\n updatedAtAfter?: Date;\n /** Email template */\n emailTemplate?: string;\n /** Transcend API key authentication */\n auth: string;\n /** Number of days to extend request by */\n days?: number;\n /**\n * Only notify requests that have less than this number of days until they are considered expired.\n * This allows for re-running the command without notifying the same users multiple times\n */\n daysLeft?: number;\n /** Concurrency limit for approving */\n concurrency?: number;\n /** The set of privacy requests to notify */\n requestIds?: string[];\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Grab the template with that title\n const matchingTemplates = await fetchAllTemplates(client, {\n logger,\n filterBy: { title: emailTemplate },\n });\n const exactTemplateMatch = matchingTemplates.find((template) => template.title === emailTemplate);\n if (!exactTemplateMatch) {\n throw new Error(`Failed to find a template with title: \"${emailTemplate}\"`);\n }\n\n // Pull in the requests\n let allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isSilent: false,\n isClosed: false,\n requestIds,\n });\n\n // Filter requests by daysLeft\n allRequests = allRequests.filter(\n (request) => typeof request.daysRemaining === 'number' && request.daysRemaining < daysLeft,\n );\n\n // Notify Transcend\n logger.info(colors.magenta(`Notifying \"${allRequests.length}\" that more time is needed.`));\n\n let total = 0;\n progressBar.start(allRequests.length, 0);\n await map(\n allRequests,\n async (requestToNotify) => {\n await makeGraphQLRequest(client, NOTIFY_ADDITIONAL_TIME, {\n variables: {\n input: {\n requestId: requestToNotify.id,\n template: exactTemplateMatch.template.defaultMessage,\n subject: exactTemplateMatch.subject.defaultMessage,\n additionalTime: days,\n },\n },\n logger,\n });\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully marked ${total} requests as silent mode in \"${totalTime / 1000}\" seconds!`,\n ),\n );\n return allRequests.length;\n}\n"],"mappings":"mbAqBA,eAAsB,EAAoC,CACxD,iBAAiB,OAAO,OAAO,EAAc,CAC7C,OACA,aACA,kBACA,OAAO,GACP,WAAW,GACX,iBACA,kBACA,iBACA,gBAAgB,yBAChB,cAAc,IACd,eAAe,GA6BG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAO/E,GAAqB,MAJK,EAAkB,EAAQ,CACxD,SACA,SAAU,CAAE,MAAO,EAAe,CACnC,CAAC,EAC2C,KAAM,GAAa,EAAS,QAAU,EAAc,CACjG,GAAI,CAAC,EACH,MAAU,MAAM,0CAA0C,EAAc,GAAG,CAI7E,IAAI,EAAc,MAAM,EAAiB,EAAQ,CAC/C,QAAS,EACT,kBACA,iBACA,kBACA,iBACA,SAAU,GACV,SAAU,GACV,aACD,CAAC,CAGF,EAAc,EAAY,OACvB,GAAY,OAAO,EAAQ,eAAkB,UAAY,EAAQ,cAAgB,EACnF,CAGD,EAAO,KAAK,EAAO,QAAQ,cAAc,EAAY,OAAO,6BAA6B,CAAC,CAE1F,IAAI,EAAQ,EACZ,EAAY,MAAM,EAAY,OAAQ,EAAE,CACxC,MAAM,EACJ,EACA,KAAO,IAAoB,CACzB,MAAM,EAAmB,EAAQ,EAAwB,CACvD,UAAW,CACT,MAAO,CACL,UAAW,EAAgB,GAC3B,SAAU,EAAmB,SAAS,eACtC,QAAS,EAAmB,QAAQ,eACpC,eAAgB,EACjB,CACF,CACD,SACD,CAAC,CAEF,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAOvB,OALA,EAAO,KACL,EAAO,MACL,uBAAuB,EAAM,+BAA+B,EAAY,IAAK,YAC9E,CACF,CACM,EAAY"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e from"got";function t(t,n){return e.extend({prefixUrl:t.replace(/\/$/,``),headers:{Authorization:`Bearer ${n}`,accept:`application/json`}})}function n(e,t){if(t.json){e.write(`${JSON.stringify(t.data,null,2)}\n`);return}t.renderTable&&e.write(`${t.renderTable()}\n`)}export{t as n,n as t};
|
|
2
|
+
//# sourceMappingURL=printResult-DyCE6B_m.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printResult-DyCE6B_m.mjs","names":[],"sources":["../src/commands/policy/helpers/buildPolicyEngineClient.ts","../src/commands/policy/helpers/printResult.ts"],"sourcesContent":["import got, { type Got } from 'got';\n\n/**\n * Creates a got client for Policy Engine REST endpoints on the monolith.\n *\n * @param transcendUrl - Transcend API base URL\n * @param auth - Transcend API key\n * @returns Configured got instance\n */\nexport function buildPolicyEngineClient(transcendUrl: string, auth: string): Got {\n return got.extend({\n prefixUrl: transcendUrl.replace(/\\/$/, ''),\n headers: {\n Authorization: `Bearer ${auth}`,\n accept: 'application/json',\n },\n });\n}\n","/** Options for printing CLI command output. */\nexport interface PrintResultOptions {\n /** When true, print raw JSON */\n json: boolean;\n /** JSON-serializable payload */\n data: unknown;\n /** Table renderer used when json is false */\n renderTable?: () => string;\n}\n\n/**\n * Prints JSON or a human-readable table to stdout.\n *\n * @param stdout - Process stdout stream\n * @param options - Output options\n */\nexport function printResult(stdout: NodeJS.WriteStream, options: PrintResultOptions): void {\n if (options.json) {\n stdout.write(`${JSON.stringify(options.data, null, 2)}\\n`);\n return;\n }\n\n if (options.renderTable) {\n stdout.write(`${options.renderTable()}\\n`);\n }\n}\n"],"mappings":"mBASA,SAAgB,EAAwB,EAAsB,EAAmB,CAC/E,OAAO,EAAI,OAAO,CAChB,UAAW,EAAa,QAAQ,MAAO,GAAG,CAC1C,QAAS,CACP,cAAe,UAAU,IACzB,OAAQ,mBACT,CACF,CAAC,CCAJ,SAAgB,EAAY,EAA4B,EAAmC,CACzF,GAAI,EAAQ,KAAM,CAChB,EAAO,MAAM,GAAG,KAAK,UAAU,EAAQ,KAAM,KAAM,EAAE,CAAC,IAAI,CAC1D,OAGE,EAAQ,aACV,EAAO,MAAM,GAAG,EAAQ,aAAa,CAAC,IAAI"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./constants-
|
|
2
|
-
//# sourceMappingURL=pullChunkedCustomSiloOutstandingIdentifiers-
|
|
1
|
+
import{a as e}from"./constants-DrkNQLIO.mjs";import{t}from"./logger-B-LXIf3U.mjs";import{decodeCodec as n}from"@transcend-io/type-utils";import r from"colors";import*as i from"io-ts";import{REDUCED_REQUESTS_FOR_DATA_SILO_COUNT as a,buildTranscendGraphQLClient as o,createSombraGotInstance as s,makeGraphQLRequest as c,withTransientRetry as l}from"@transcend-io/sdk";import{mapSeries as u}from"@transcend-io/utils";import d from"cli-progress";async function f(e,{dataSiloId:n}){let{listReducedRequestsForDataSilo:{totalCount:r}}=await c(e,a,{variables:{input:{dataSiloId:n,isResolved:!1}},logger:t});return r}const p=i.type({id:i.string,name:i.string,partition:i.string}),m=i.intersection([i.type({identifier:i.string,type:i.string,coreIdentifier:i.string,dataSiloId:i.string,requestId:i.string,nonce:i.string,requestCreatedAt:i.string,daysUntilOverdue:i.number,attributes:i.array(i.type({key:i.string,values:i.array(i.string)}))}),i.partial({partition:i.union([p,i.null])})]);async function h(e,{dataSiloId:r,limit:a=100,offset:o=0,requestType:s}){try{let c=await l(`pullCronPageOfIdentifiers`,()=>e.get(`v1/data-silo/${r}/pending-requests/${s}`,{searchParams:{offset:o,limit:a}}).json(),{logger:t,maxAttempts:6,baseDelayMs:500}),{items:u}=n(i.type({items:i.array(m)}),c);return u}catch(e){throw Error(`Received an error from server: ${e?.response?.body||e?.message}`)}}async function g({dataSiloId:n,auth:i,sombraAuth:a,actions:c,apiPageSize:l=100,savePageSize:p=1e3,onSave:m,transcendUrl:g=e,skipRequestCount:_=!1}){if(p%l!==0)throw Error(`savePageSize must be a multiple of apiPageSize. savePageSize: ${p}, apiPageSize: ${l}`);let v=await s(g,i,{logger:t,sombraApiKey:a,sombraUrl:process.env.SOMBRA_URL}),y=o(g,i),b=0;_||(b=await f(y,{dataSiloId:n})),t.info(r.magenta(`Pulling ${_?`all`:b} outstanding request identifiers for data silo: "${n}" for requests of types "${c.join(`", "`)}"`));let x=new Date().getTime(),S=new d.SingleBar({},d.Presets.shades_classic),C=new Set,w=[],T=[];_||S.start(b,0),await u(c,async e=>{let i=0,a=!0;for(;a;){let o=await h(v,{dataSiloId:n,limit:l,offset:i,requestType:e}),s=o.map(t=>(C.add(t.requestId),{...t,action:e})),c=s.map(({attributes:e,partition:t,...n})=>({...n,...t?{partitionId:t.id,partitionName:t.name,partitionKey:t.partition}:{},...e.reduce((e,t)=>Object.assign(e,{[t.key]:t.values.join(`,`)}),{})}));w.push(...s),T.push(...c),T.length>=p&&(await m(T),T=[]),a=o.length===l,i+=l,_?t.info(r.magenta(`Pulled ${o.length} outstanding identifiers for ${C.size} requests`)):S.update(C.size)}}),T.length>0&&await m(T),_||S.stop();let E=new Date().getTime()-x;return t.info(r.green(`Successfully pulled ${w.length} outstanding identifiers from ${C.size} requests in "${E/1e3}" seconds!`)),{identifiers:w}}export{f as a,h as i,m as n,p as r,g as t};
|
|
2
|
+
//# sourceMappingURL=pullChunkedCustomSiloOutstandingIdentifiers-C5uhtMJZ.mjs.map
|