@transcend-io/cli 10.14.0 → 10.16.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 +98 -47
- package/dist/app-COX_n1FP.mjs +131 -0
- package/dist/app-COX_n1FP.mjs.map +1 -0
- package/dist/{approvePrivacyRequests-BmjMLA3C.mjs → approvePrivacyRequests-DJItn7R6.mjs} +2 -2
- package/dist/{approvePrivacyRequests-BmjMLA3C.mjs.map → approvePrivacyRequests-DJItn7R6.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/{buildExamples-tZJof83F.mjs → buildExamples-CZ8kcEqO.mjs} +2 -2
- package/dist/{buildExamples-tZJof83F.mjs.map → buildExamples-CZ8kcEqO.mjs.map} +1 -1
- package/dist/{buildXdiSyncEndpoint-DsxFqz9E.mjs → buildXdiSyncEndpoint-CSGwr2H5.mjs} +2 -2
- package/dist/{buildXdiSyncEndpoint-DsxFqz9E.mjs.map → buildXdiSyncEndpoint-CSGwr2H5.mjs.map} +1 -1
- package/dist/bulkRestartRequests-D-t58SeM.mjs +2 -0
- package/dist/bulkRestartRequests-D-t58SeM.mjs.map +1 -0
- package/dist/{bulkRetryEnrichers-nBG87Q8B.mjs → bulkRetryEnrichers-BmwRLF2w.mjs} +2 -2
- package/dist/{bulkRetryEnrichers-nBG87Q8B.mjs.map → bulkRetryEnrichers-BmwRLF2w.mjs.map} +1 -1
- package/dist/{cancelPrivacyRequests-DBjBnX2p.mjs → cancelPrivacyRequests-CFCULeSv.mjs} +2 -2
- package/dist/{cancelPrivacyRequests-DBjBnX2p.mjs.map → cancelPrivacyRequests-CFCULeSv.mjs.map} +1 -1
- package/dist/{command-BDVLuBwL.mjs → command-8AnltUOG.mjs} +2 -2
- package/dist/{command-BDVLuBwL.mjs.map → command-8AnltUOG.mjs.map} +1 -1
- package/dist/{constants-Co8rkELu.mjs → constants-B7bW_WN2.mjs} +2 -2
- package/dist/{constants-Co8rkELu.mjs.map → constants-B7bW_WN2.mjs.map} +1 -1
- package/dist/{createExtraKeyHandler-CC-YNn6m.mjs → createExtraKeyHandler-DqiD609a.mjs} +2 -2
- package/dist/{createExtraKeyHandler-CC-YNn6m.mjs.map → createExtraKeyHandler-DqiD609a.mjs.map} +1 -1
- package/dist/{downloadPrivacyRequestFiles-C_60XBVX.mjs → downloadPrivacyRequestFiles-B7HNc-Y1.mjs} +2 -2
- package/dist/{downloadPrivacyRequestFiles-C_60XBVX.mjs.map → downloadPrivacyRequestFiles-B7HNc-Y1.mjs.map} +1 -1
- package/dist/formatPolicyEngineRequestError-C8g0v7nh.mjs +2 -0
- package/dist/formatPolicyEngineRequestError-C8g0v7nh.mjs.map +1 -0
- package/dist/{generateCrossAccountApiKeys-JvTpNM7h.mjs → generateCrossAccountApiKeys-kqzneWII.mjs} +2 -2
- package/dist/{generateCrossAccountApiKeys-JvTpNM7h.mjs.map → generateCrossAccountApiKeys-kqzneWII.mjs.map} +1 -1
- package/dist/impl--eayIBq5.mjs +2 -0
- package/dist/impl--eayIBq5.mjs.map +1 -0
- package/dist/{impl-TnRighiD.mjs → impl-0C9N9md8.mjs} +2 -2
- package/dist/{impl-TnRighiD.mjs.map → impl-0C9N9md8.mjs.map} +1 -1
- package/dist/{impl-CQ94Ys6i.mjs → impl-6rvA_yyd.mjs} +2 -2
- package/dist/{impl-CQ94Ys6i.mjs.map → impl-6rvA_yyd.mjs.map} +1 -1
- package/dist/{impl-pGIOCyRI.mjs → impl-B3u38Ct_.mjs} +1 -1
- package/dist/{impl-pGIOCyRI.mjs.map → impl-B3u38Ct_.mjs.map} +1 -1
- package/dist/{impl-CPZSFIEn2.mjs → impl-B9AtL5ta2.mjs} +2 -2
- package/dist/{impl-CPZSFIEn2.mjs.map → impl-B9AtL5ta2.mjs.map} +1 -1
- package/dist/{impl-BWt2WOj4.mjs → impl-BDc4D9nA.mjs} +2 -2
- package/dist/{impl-BWt2WOj4.mjs.map → impl-BDc4D9nA.mjs.map} +1 -1
- package/dist/{impl-bzESF0CN.mjs → impl-BJldWkkC.mjs} +1 -1
- package/dist/{impl-bzESF0CN.mjs.map → impl-BJldWkkC.mjs.map} +1 -1
- package/dist/{impl-Bf_Wy1-i.mjs → impl-BOXnkx44.mjs} +2 -2
- package/dist/{impl-Bf_Wy1-i.mjs.map → impl-BOXnkx44.mjs.map} +1 -1
- package/dist/{impl-CHA9Ioez2.mjs → impl-BUF6G3P32.mjs} +2 -2
- package/dist/{impl-CHA9Ioez2.mjs.map → impl-BUF6G3P32.mjs.map} +1 -1
- package/dist/{impl-DctqoksW2.mjs → impl-BVcXWJyI2.mjs} +2 -2
- package/dist/{impl-DctqoksW2.mjs.map → impl-BVcXWJyI2.mjs.map} +1 -1
- package/dist/impl-BbfuEhKu.mjs +2 -0
- package/dist/impl-BbfuEhKu.mjs.map +1 -0
- package/dist/{impl-DtjphdYd2.mjs → impl-BcIZos3y.mjs} +2 -2
- package/dist/impl-BcIZos3y.mjs.map +1 -0
- package/dist/{impl-8i-k9wal2.mjs → impl-Bkdu-3yo.mjs} +2 -2
- package/dist/impl-Bkdu-3yo.mjs.map +1 -0
- package/dist/{impl-CnfqPqKR.mjs → impl-Bq-tabdZ2.mjs} +2 -2
- package/dist/impl-Bq-tabdZ2.mjs.map +1 -0
- package/dist/{impl-BxJcoWPI.mjs → impl-Bul8gUqq.mjs} +2 -2
- package/dist/{impl-BxJcoWPI.mjs.map → impl-Bul8gUqq.mjs.map} +1 -1
- package/dist/{impl-kyicyfTy.mjs → impl-BuqBEZCk.mjs} +2 -2
- package/dist/{impl-kyicyfTy.mjs.map → impl-BuqBEZCk.mjs.map} +1 -1
- package/dist/{impl-DOp0z0s3.mjs → impl-BvOLkTWD.mjs} +2 -2
- package/dist/{impl-DOp0z0s3.mjs.map → impl-BvOLkTWD.mjs.map} +1 -1
- package/dist/{impl-DasdQVVL.mjs → impl-Bvkhu8fB.mjs} +2 -2
- package/dist/{impl-DasdQVVL.mjs.map → impl-Bvkhu8fB.mjs.map} +1 -1
- package/dist/{impl-CQcfrcc42.mjs → impl-CCSb7Pyd.mjs} +2 -2
- package/dist/impl-CCSb7Pyd.mjs.map +1 -0
- package/dist/{impl-BcP6NXxv.mjs → impl-CDNTdi62.mjs} +2 -2
- package/dist/{impl-BcP6NXxv.mjs.map → impl-CDNTdi62.mjs.map} +1 -1
- package/dist/{impl-0WH9Y-7n2.mjs → impl-CLrF-Xhp2.mjs} +2 -2
- package/dist/{impl-0WH9Y-7n2.mjs.map → impl-CLrF-Xhp2.mjs.map} +1 -1
- package/dist/impl-CX1J2iHE.mjs +2 -0
- package/dist/impl-CX1J2iHE.mjs.map +1 -0
- package/dist/{impl-vLFKOFp6.mjs → impl-C_K23xoc.mjs} +2 -2
- package/dist/{impl-vLFKOFp6.mjs.map → impl-C_K23xoc.mjs.map} +1 -1
- package/dist/{impl-DmsEZEkY2.mjs → impl-CeqMxdZm2.mjs} +2 -2
- package/dist/{impl-DmsEZEkY2.mjs.map → impl-CeqMxdZm2.mjs.map} +1 -1
- package/dist/{impl-BmB5DH95.mjs → impl-ChDwTQ3Z2.mjs} +2 -2
- package/dist/impl-ChDwTQ3Z2.mjs.map +1 -0
- package/dist/{impl-BQizHx-b.mjs → impl-CkFqqhQ-.mjs} +2 -2
- package/dist/{impl-BQizHx-b.mjs.map → impl-CkFqqhQ-.mjs.map} +1 -1
- package/dist/{impl-C9RGUYAT.mjs → impl-CkU-WD3b.mjs} +2 -2
- package/dist/{impl-C9RGUYAT.mjs.map → impl-CkU-WD3b.mjs.map} +1 -1
- package/dist/{impl-COWe0KAi.mjs → impl-Cx5U2XsV.mjs} +2 -2
- package/dist/{impl-COWe0KAi.mjs.map → impl-Cx5U2XsV.mjs.map} +1 -1
- package/dist/impl-DGm5NVUi.mjs +3 -0
- package/dist/impl-DGm5NVUi.mjs.map +1 -0
- package/dist/{impl-BcirxaFO.mjs → impl-DMbgck0i.mjs} +2 -2
- package/dist/{impl-BcirxaFO.mjs.map → impl-DMbgck0i.mjs.map} +1 -1
- package/dist/{impl-BM0EEvkt.mjs → impl-DQH1CGup.mjs} +2 -2
- package/dist/{impl-BM0EEvkt.mjs.map → impl-DQH1CGup.mjs.map} +1 -1
- package/dist/{impl-5pww5SHw.mjs → impl-DTDnN3Hn.mjs} +2 -2
- package/dist/{impl-5pww5SHw.mjs.map → impl-DTDnN3Hn.mjs.map} +1 -1
- package/dist/{impl-Cih-nyPz.mjs → impl-DYsJKLfp.mjs} +2 -2
- package/dist/{impl-Cih-nyPz.mjs.map → impl-DYsJKLfp.mjs.map} +1 -1
- package/dist/impl-DiRx33sh.mjs +2 -0
- package/dist/impl-DiRx33sh.mjs.map +1 -0
- package/dist/{impl-Cp_cXJgT2.mjs → impl-DiysQB762.mjs} +2 -2
- package/dist/{impl-Cp_cXJgT2.mjs.map → impl-DiysQB762.mjs.map} +1 -1
- package/dist/{impl-DQdzYE12.mjs → impl-DqcpxYHF.mjs} +1 -1
- package/dist/{impl-DQdzYE12.mjs.map → impl-DqcpxYHF.mjs.map} +1 -1
- package/dist/{impl-DtVfOZhs.mjs → impl-DqyYxDti.mjs} +2 -2
- package/dist/{impl-DtVfOZhs.mjs.map → impl-DqyYxDti.mjs.map} +1 -1
- package/dist/{impl-DpU2s1HR.mjs → impl-RqwgNa2O.mjs} +2 -2
- package/dist/{impl-DpU2s1HR.mjs.map → impl-RqwgNa2O.mjs.map} +1 -1
- package/dist/{impl-cro4x_eG.mjs → impl-TTeKThep2.mjs} +2 -2
- package/dist/impl-TTeKThep2.mjs.map +1 -0
- package/dist/{impl-CJIfMPOK.mjs → impl-X13pzYJN2.mjs} +2 -2
- package/dist/impl-X13pzYJN2.mjs.map +1 -0
- package/dist/{impl-B4mrbkzO.mjs → impl-e-_DWiv4.mjs} +2 -2
- package/dist/{impl-B4mrbkzO.mjs.map → impl-e-_DWiv4.mjs.map} +1 -1
- package/dist/index.d.mts +17 -13
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{markRequestDataSiloIdsCompleted-DYsj2ONd.mjs → markRequestDataSiloIdsCompleted-nAV0VLEA.mjs} +2 -2
- package/dist/{markRequestDataSiloIdsCompleted-DYsj2ONd.mjs.map → markRequestDataSiloIdsCompleted-nAV0VLEA.mjs.map} +1 -1
- package/dist/{markSilentPrivacyRequests-DQYDLnBX.mjs → markSilentPrivacyRequests-BhF4r8n9.mjs} +2 -2
- package/dist/{markSilentPrivacyRequests-DQYDLnBX.mjs.map → markSilentPrivacyRequests-BhF4r8n9.mjs.map} +1 -1
- package/dist/{notifyPrivacyRequestsAdditionalTime-BYpsssGt.mjs → notifyPrivacyRequestsAdditionalTime-B6e9SfP7.mjs} +2 -2
- package/dist/{notifyPrivacyRequestsAdditionalTime-BYpsssGt.mjs.map → notifyPrivacyRequestsAdditionalTime-B6e9SfP7.mjs.map} +1 -1
- package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-aBPmYMAU.mjs → pullChunkedCustomSiloOutstandingIdentifiers-DiZTo2K_.mjs} +2 -2
- package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-aBPmYMAU.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-DiZTo2K_.mjs.map} +1 -1
- package/dist/{pullManualEnrichmentIdentifiersToCsv-DGdMOzd_.mjs → pullManualEnrichmentIdentifiersToCsv--dw03arC.mjs} +2 -2
- package/dist/{pullManualEnrichmentIdentifiersToCsv-DGdMOzd_.mjs.map → pullManualEnrichmentIdentifiersToCsv--dw03arC.mjs.map} +1 -1
- package/dist/{pushCronIdentifiersFromCsv-mMGYEnWE.mjs → pushCronIdentifiersFromCsv-DdcsnXf5.mjs} +2 -2
- package/dist/{pushCronIdentifiersFromCsv-mMGYEnWE.mjs.map → pushCronIdentifiersFromCsv-DdcsnXf5.mjs.map} +1 -1
- package/dist/{pushManualEnrichmentIdentifiersFromCsv-BJtIFf35.mjs → pushManualEnrichmentIdentifiersFromCsv-BYJCQOI-.mjs} +2 -2
- package/dist/{pushManualEnrichmentIdentifiersFromCsv-BJtIFf35.mjs.map → pushManualEnrichmentIdentifiersFromCsv-BYJCQOI-.mjs.map} +1 -1
- package/dist/{removeUnverifiedRequestIdentifiers-GM1MhbRO.mjs → removeUnverifiedRequestIdentifiers-CC471vSR.mjs} +2 -2
- package/dist/{removeUnverifiedRequestIdentifiers-GM1MhbRO.mjs.map → removeUnverifiedRequestIdentifiers-CC471vSR.mjs.map} +1 -1
- package/dist/{renderTable-BgjVr6ch.mjs → renderTable-BzIh5FoT.mjs} +1 -1
- package/dist/{renderTable-BgjVr6ch.mjs.map → renderTable-BzIh5FoT.mjs.map} +1 -1
- package/dist/{resolveBundleIdByName-DdemhmTX.mjs → resolveBundleIdByName-Bxoxa8CK.mjs} +1 -1
- package/dist/{resolveBundleIdByName-DdemhmTX.mjs.map → resolveBundleIdByName-Bxoxa8CK.mjs.map} +1 -1
- package/dist/{retryRequestDataSilos-DkCW5Dap.mjs → retryRequestDataSilos-DlkJmEjH.mjs} +2 -2
- package/dist/{retryRequestDataSilos-DkCW5Dap.mjs.map → retryRequestDataSilos-DlkJmEjH.mjs.map} +1 -1
- package/dist/{skipPreflightJobs-BBfI9gnC.mjs → skipPreflightJobs-xVBZC-iI.mjs} +2 -2
- package/dist/{skipPreflightJobs-BBfI9gnC.mjs.map → skipPreflightJobs-xVBZC-iI.mjs.map} +1 -1
- package/dist/{skipRequestDataSilos-CjaWLHRh.mjs → skipRequestDataSilos-BriqhLT3.mjs} +2 -2
- package/dist/{skipRequestDataSilos-CjaWLHRh.mjs.map → skipRequestDataSilos-BriqhLT3.mjs.map} +1 -1
- package/dist/{streamPrivacyRequestsToCsv-DeBjRAo6.mjs → streamPrivacyRequestsToCsv-D8b097c1.mjs} +2 -2
- package/dist/{streamPrivacyRequestsToCsv-DeBjRAo6.mjs.map → streamPrivacyRequestsToCsv-D8b097c1.mjs.map} +1 -1
- package/dist/{updateConsentManagerVersionToLatest-2SBywtZH.mjs → updateConsentManagerVersionToLatest-w_ftOmxi.mjs} +2 -2
- package/dist/{updateConsentManagerVersionToLatest-2SBywtZH.mjs.map → updateConsentManagerVersionToLatest-w_ftOmxi.mjs.map} +1 -1
- package/dist/{uploadConsents-K3cGrF3M.mjs → uploadConsents-D8IJDaTN.mjs} +2 -2
- package/dist/{uploadConsents-K3cGrF3M.mjs.map → uploadConsents-D8IJDaTN.mjs.map} +1 -1
- package/dist/{uploadCookiesFromCsv-Cf4q-K4o.mjs → uploadCookiesFromCsv-8hq-Of_p.mjs} +2 -2
- package/dist/{uploadCookiesFromCsv-Cf4q-K4o.mjs.map → uploadCookiesFromCsv-8hq-Of_p.mjs.map} +1 -1
- package/dist/{uploadDataFlowsFromCsv-CrC_UGCw.mjs → uploadDataFlowsFromCsv-B854o0O5.mjs} +2 -2
- package/dist/{uploadDataFlowsFromCsv-CrC_UGCw.mjs.map → uploadDataFlowsFromCsv-B854o0O5.mjs.map} +1 -1
- package/dist/{uploadPrivacyRequestsFromCsv-CtLCdggr.mjs → uploadPrivacyRequestsFromCsv-D-RTgJsx.mjs} +2 -2
- package/dist/{uploadPrivacyRequestsFromCsv-CtLCdggr.mjs.map → uploadPrivacyRequestsFromCsv-D-RTgJsx.mjs.map} +1 -1
- package/package.json +2 -2
- package/dist/app-jtpjVOh5.mjs +0 -131
- package/dist/app-jtpjVOh5.mjs.map +0 -1
- package/dist/bulkRestartRequests-Cg0_c6sr.mjs +0 -2
- package/dist/bulkRestartRequests-Cg0_c6sr.mjs.map +0 -1
- package/dist/impl-8i-k9wal2.mjs.map +0 -1
- package/dist/impl-BmB5DH95.mjs.map +0 -1
- package/dist/impl-CJIfMPOK.mjs.map +0 -1
- package/dist/impl-CQcfrcc42.mjs.map +0 -1
- package/dist/impl-CnfqPqKR.mjs.map +0 -1
- package/dist/impl-DZ2ESN0W.mjs +0 -2
- package/dist/impl-DZ2ESN0W.mjs.map +0 -1
- package/dist/impl-DtjphdYd2.mjs.map +0 -1
- package/dist/impl-DxziWqbj.mjs +0 -2
- package/dist/impl-DxziWqbj.mjs.map +0 -1
- package/dist/impl-QhkS8iHU.mjs +0 -2
- package/dist/impl-QhkS8iHU.mjs.map +0 -1
- package/dist/impl-WYYi6kC-.mjs +0 -2
- package/dist/impl-WYYi6kC-.mjs.map +0 -1
- package/dist/impl-cro4x_eG.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadPrivacyRequestsFromCsv-CtLCdggr.mjs","names":[],"sources":["../src/lib/requests/mapEnumValues.ts","../src/lib/requests/getUniqueValuesForColumn.ts","../src/lib/requests/filterRows.ts","../src/lib/requests/mapCsvColumnsToApi.ts","../src/lib/requests/mapRequestEnumValues.ts","../src/lib/requests/mapCsvRowsToRequestInputs.ts","../src/lib/requests/mapColumnsToIdentifiers.ts","../src/lib/requests/mapColumnsToAttributes.ts","../src/lib/requests/uploadPrivacyRequestsFromCsv.ts"],"sourcesContent":["import { apply, ObjByString } from '@transcend-io/type-utils';\nimport inquirer from 'inquirer';\nimport autoCompletePrompt from 'inquirer-autocomplete-prompt';\n\nimport { fuzzySearch } from './fuzzyMatchColumns.js';\n\n/**\n * Map a set of inputs to a set of outputs\n *\n * @param csvInputs - Input list\n * @param expectedOutputs - Output list\n * @param cache - Cache\n * @returns Mapping from row to enum value\n */\nexport async function mapEnumValues<TValue extends string>(\n csvInputs: string[],\n expectedOutputs: TValue[],\n cache: { [k in string]: TValue },\n): Promise<{ [k in string]: TValue }> {\n inquirer.registerPrompt('autocomplete', autoCompletePrompt);\n\n const inputs = csvInputs.map((item) => item || '<blank>').filter((value) => !cache[value]);\n if (inputs.length === 0) {\n return cache;\n }\n const result = await inquirer.prompt<{ [k in string]: TValue }>(\n inputs.map((value) => ({\n name: value,\n message: `Map value of: ${value}`,\n type: 'autocomplete',\n default: expectedOutputs.find((x) => fuzzySearch(value, x)),\n source: (answersSoFar: ObjByString, input: string) =>\n !input\n ? expectedOutputs\n : expectedOutputs.filter((x) => typeof x === 'string' && fuzzySearch(input, x)),\n })),\n );\n return {\n ...cache,\n ...apply(result, (r) =>\n typeof r === 'string' ? (r as TValue) : (Object.values(r)[0] as TValue),\n ),\n };\n}\n","import { ObjByString } from '@transcend-io/type-utils';\nimport { uniq } from 'lodash-es';\n\n/**\n * Return the unique set of values for a column in a CSV\n *\n * @param rows - Rows to look up\n * @param columnName - Name of column to grab values for\n * @returns Unique set of values in that column\n */\nexport function getUniqueValuesForColumn(rows: ObjByString[], columnName: string): string[] {\n return uniq(rows.map((row) => row[columnName] || '').flat());\n}\n","import { ObjByString } from '@transcend-io/type-utils';\nimport colors from 'colors';\nimport inquirer from 'inquirer';\nimport { uniq } from 'lodash-es';\n\nimport { logger } from '../../logger.js';\nimport { NONE } from './constants.js';\nimport { getUniqueValuesForColumn } from './getUniqueValuesForColumn.js';\n\n/**\n * Filter a list of CSV rows by column values\n * Choose columns that contain metadata to filter the requests\n *\n * @param rows - Rows to filter\n * @returns Filtered rows\n */\nexport async function filterRows(rows: ObjByString[]): Promise<ObjByString[]> {\n // Determine set of column names\n const columnNames = uniq(rows.map((x) => Object.keys(x)).flat());\n\n // update these variables recursively\n let filteredRows = rows;\n let keepFiltering = true;\n\n // loop over\n while (keepFiltering) {\n // Prompt user for column to filter on\n\n const { filterColumnName } = await inquirer.prompt<{\n /** Name of column to filter on */\n filterColumnName: string;\n }>([\n {\n name: 'filterColumnName',\n // eslint-disable-next-line max-len\n message: `If you need to filter the list of requests to import, choose the column to filter on. Currently ${filteredRows.length} rows.`,\n type: 'list',\n default: columnNames,\n choices: [NONE, ...columnNames],\n },\n ]);\n\n // Determine if filtering should continue, or loop should be exited\n keepFiltering = NONE !== filterColumnName;\n if (keepFiltering) {\n const options = getUniqueValuesForColumn(filteredRows, filterColumnName);\n\n const { valuesToKeep } = await inquirer.prompt<{\n /** Values to keep */\n valuesToKeep: string[];\n }>([\n {\n name: 'valuesToKeep',\n message: 'Keep rows matching this value',\n type: 'checkbox',\n default: columnNames,\n choices: options,\n },\n ]);\n\n filteredRows = filteredRows.filter((request) =>\n valuesToKeep.includes(request[filterColumnName]),\n );\n }\n }\n\n logger.info(colors.magenta(`Importing ${filteredRows.length} requests`));\n return filteredRows;\n}\n","import type { PersistedState } from '@transcend-io/persisted-state';\nimport { getValues, getEntries } from '@transcend-io/type-utils';\nimport inquirer from 'inquirer';\nimport { startCase } from 'lodash-es';\n\nimport { ColumnName, CachedFileState, IS_REQUIRED, CAN_APPLY_IN_BULK } from './constants.js';\nimport { fuzzyMatchColumns } from './fuzzyMatchColumns.js';\n\n/**\n * Mapping from column name to request input parameter\n */\nexport type ColumnNameMap = {\n [k in ColumnName]?: string;\n};\n\n/**\n * Determine the mapping between columns in CSV\n *\n * @param columnNames - The set of column names\n * @param state - The cached file state used to map DSR inputs\n * @returns The column name mapping\n */\nexport async function mapCsvColumnsToApi(\n columnNames: string[],\n state: PersistedState<typeof CachedFileState>,\n): Promise<ColumnNameMap> {\n // Determine the columns that should be mapped\n const columnQuestions = getValues(ColumnName).filter(\n (name) => !state.getValue('columnNames', name),\n );\n\n // Skip mapping when everything is mapped\n const columnNameMap =\n columnQuestions.length === 0\n ? {}\n : // prompt questions to map columns\n await inquirer.prompt<{\n [k in ColumnName]?: string;\n }>(\n columnQuestions.map((name) => {\n const field = startCase(name.replace('ColumnName', ''));\n const matches = fuzzyMatchColumns(\n columnNames,\n field,\n IS_REQUIRED[name],\n !!CAN_APPLY_IN_BULK[name],\n );\n return {\n name,\n message: `Choose the column that will be used to map in the field: ${field}`,\n type: 'list',\n default: matches[0],\n choices: matches,\n };\n }),\n );\n\n await Promise.all(getEntries(columnNameMap).map(([k, v]) => state.setValue(v, 'columnNames', k)));\n return columnNameMap;\n}\n","import { LOCALE_KEY, type LocaleValue } from '@transcend-io/internationalization';\nimport type { PersistedState } from '@transcend-io/persisted-state';\nimport {\n CompletedRequestStatus,\n RequestAction,\n IsoCountryCode,\n IsoCountrySubdivisionCode,\n} from '@transcend-io/privacy-types';\nimport { makeGraphQLRequest, DATA_SUBJECTS, type DataSubject } from '@transcend-io/sdk';\nimport { ObjByString } from '@transcend-io/type-utils';\nimport colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\n\nimport { logger } from '../../logger.js';\nimport { CachedFileState, NONE, ColumnName } from './constants.js';\nimport { getUniqueValuesForColumn } from './getUniqueValuesForColumn.js';\nimport { ColumnNameMap } from './mapCsvColumnsToApi.js';\nimport { mapEnumValues } from './mapEnumValues.js';\n\n/**\n * Map the values in a CSV to the enum values in Transcend\n *\n * @param client - GraphQL client\n * @param requests - Set of privacy requests\n * @param options - Options\n */\nexport async function mapRequestEnumValues(\n client: GraphQLClient,\n requests: ObjByString[],\n {\n state,\n columnNameMap,\n }: {\n /** State value to write cache to */\n state: PersistedState<typeof CachedFileState>;\n /** Mapping of column names */\n columnNameMap: ColumnNameMap;\n },\n): Promise<void> {\n // Get mapped value\n const getMappedName = (attribute: ColumnName): string =>\n state.getValue('columnNames', attribute) || columnNameMap[attribute]!;\n\n // Fetch all data subjects in the organization\n const { internalSubjects } = await makeGraphQLRequest<{\n /** Query response */\n internalSubjects: DataSubject[];\n }>(client, DATA_SUBJECTS, { logger });\n\n // Map RequestAction\n logger.info(colors.magenta('Determining mapping of columns for request action'));\n const requestTypeToRequestAction: { [k in string]: RequestAction } = await mapEnumValues(\n getUniqueValuesForColumn(requests, getMappedName(ColumnName.RequestType)),\n Object.values(RequestAction),\n state.getValue('requestTypeToRequestAction'),\n );\n await state.setValue(requestTypeToRequestAction, 'requestTypeToRequestAction');\n\n // Map data subject type\n logger.info(colors.magenta('Determining mapping of columns for subject'));\n const subjectTypeToSubjectName: { [k in string]: string } = await mapEnumValues(\n getUniqueValuesForColumn(requests, getMappedName(ColumnName.SubjectType)),\n internalSubjects.map(({ type }) => type),\n state.getValue('subjectTypeToSubjectName'),\n );\n await state.setValue(subjectTypeToSubjectName, 'subjectTypeToSubjectName');\n\n // Map locale\n logger.info(colors.magenta('Determining mapping of columns for locale'));\n const languageToLocale: { [k in string]: LocaleValue } = await mapEnumValues(\n getUniqueValuesForColumn(requests, getMappedName(ColumnName.Locale)),\n Object.values(LOCALE_KEY),\n state.getValue('languageToLocale'),\n );\n await state.setValue(languageToLocale, 'languageToLocale');\n logger.info(colors.magenta('Determining mapping of columns for request status'));\n\n // Map request status\n logger.info(colors.magenta('Determining mapping of columns for request status'));\n const requestStatusColumn = getMappedName(ColumnName.RequestStatus);\n const statusToRequestStatus: {\n [k in string]: CompletedRequestStatus | typeof NONE;\n } =\n requestStatusColumn === NONE\n ? {}\n : await mapEnumValues(\n getUniqueValuesForColumn(requests, requestStatusColumn),\n [...Object.values(CompletedRequestStatus), NONE],\n state.getValue('statusToRequestStatus'),\n );\n await state.setValue(statusToRequestStatus, 'statusToRequestStatus');\n\n // Map country\n logger.info(colors.magenta('Determining mapping of columns for country'));\n const countryColumn = getMappedName(ColumnName.Country);\n const regionToCountry: {\n [k in string]: IsoCountryCode | typeof NONE;\n } =\n countryColumn === NONE\n ? {}\n : await mapEnumValues(\n getUniqueValuesForColumn(requests, countryColumn),\n [...Object.values(IsoCountryCode), NONE],\n state.getValue('regionToCountry'),\n );\n await state.setValue(regionToCountry, 'regionToCountry');\n\n // Map country sub division\n logger.info(colors.magenta('Determining mapping of columns for country sub division'));\n const countrySubDivisionColumn = getMappedName(ColumnName.CountrySubDivision);\n const regionToCountrySubDivision: {\n [k in string]: IsoCountrySubdivisionCode | typeof NONE;\n } =\n countrySubDivisionColumn === NONE\n ? {}\n : await mapEnumValues(\n getUniqueValuesForColumn(requests, countrySubDivisionColumn),\n [...Object.values(IsoCountrySubdivisionCode), NONE],\n state.getValue('regionToCountrySubDivision'),\n );\n await state.setValue(regionToCountrySubDivision, 'regionToCountrySubDivision');\n}\n","import { LOCALE_KEY } from '@transcend-io/internationalization';\nimport type { PersistedState } from '@transcend-io/persisted-state';\nimport {\n NORMALIZE_PHONE_NUMBER,\n CompletedRequestStatus,\n RequestAction,\n IdentifierType,\n IsoCountryCode,\n IsoCountrySubdivisionCode,\n} from '@transcend-io/privacy-types';\nimport type { AttributeKey } from '@transcend-io/sdk';\nimport { ObjByString, valuesOf } from '@transcend-io/type-utils';\nimport { splitCsvToList } from '@transcend-io/utils';\nimport * as t from 'io-ts';\nimport { DateFromISOString } from 'io-ts-types';\n\nimport { CachedFileState, BLANK, BULK_APPLY, ColumnName, NONE } from './constants.js';\nimport { AttributeNameMap } from './mapColumnsToAttributes.js';\nimport { IdentifierNameMap } from './mapColumnsToIdentifiers.js';\nimport { ColumnNameMap } from './mapCsvColumnsToApi.js';\nimport { ParsedAttributeInput } from './parseAttributesFromString.js';\n\n/**\n * Shape of additional identifiers\n *\n * key of object is IdentifierType\n */\nexport const AttestedExtraIdentifiers = t.record(\n t.string,\n t.array(\n t.intersection([\n t.type({\n /** Value of identifier */\n value: t.string,\n }),\n t.partial({\n /** Name of identifier - option for non-custom identifier types */\n name: t.string,\n }),\n ]),\n ),\n);\n\n/** Type override */\nexport type AttestedExtraIdentifiers = t.TypeOf<typeof AttestedExtraIdentifiers>;\n\nexport const PrivacyRequestInput = t.intersection([\n t.type({\n /** Email of user */\n email: t.string,\n /** Extra identifiers */\n attestedExtraIdentifiers: AttestedExtraIdentifiers,\n /** Core identifier for user */\n coreIdentifier: t.string,\n /** Action type being submitted */\n requestType: valuesOf(RequestAction),\n /** Type of data subject */\n subjectType: t.string,\n }),\n t.partial({\n /** Country */\n country: valuesOf(IsoCountryCode),\n /** Country sub division */\n countrySubDivision: valuesOf(IsoCountrySubdivisionCode),\n /** Attribute inputs */\n attributes: t.array(ParsedAttributeInput),\n /** The status that the request should be created as */\n status: valuesOf(CompletedRequestStatus),\n /** The time that the request was created */\n createdAt: DateFromISOString,\n /** Data silo IDs to submit for */\n dataSiloIds: t.array(t.string),\n /** Language key to map to */\n locale: valuesOf(LOCALE_KEY),\n }),\n]);\n\n/** Type override */\nexport type PrivacyRequestInput = t.TypeOf<typeof PrivacyRequestInput>;\n\n/**\n * Transform the identifier value based on type\n *\n * @param identifierValue - Value of identifier\n * @param identifierType - Type of identifier\n * @param defaultPhoneCountryCode - Default country code for phone numbers\n * @returns Post-processed identifier\n */\nexport function normalizeIdentifierValue(\n identifierValue: string,\n identifierType: IdentifierType,\n defaultPhoneCountryCode: string,\n): string {\n // Lowercase email\n if (identifierType === IdentifierType.Email) {\n return identifierValue.toLowerCase();\n }\n\n // Normalize phone number\n if (identifierType === IdentifierType.Phone) {\n const normalized = identifierValue\n .replace(NORMALIZE_PHONE_NUMBER, '')\n .replace(/[()]/g, '')\n .replace(/[–]/g, '')\n .replace(/[:]/g, '')\n .replace(/[]/g, '')\n .replace(/[A-Za-z]/g, '');\n return !normalized\n ? ''\n : normalized.startsWith('+')\n ? normalized\n : `+${defaultPhoneCountryCode}${normalized}`;\n }\n return identifierValue;\n}\n\n/**\n * Take the raw rows in a CSV upload, and map those rows to the request\n * input shape that can be passed to the Transcend API to submit a privacy\n * request.\n *\n * @param requestInputs - CSV of requests to be uploaded\n * @param state - The cached set of mapping values\n * @param options - Options\n * @returns [raw input, request input] list\n */\nexport function mapCsvRowsToRequestInputs(\n requestInputs: ObjByString[],\n state: PersistedState<typeof CachedFileState>,\n {\n columnNameMap,\n identifierNameMap,\n attributeNameMap,\n requestAttributeKeys,\n defaultPhoneCountryCode = '1', // US\n }: {\n /** Default country code */\n defaultPhoneCountryCode?: string;\n /** Mapping of column names */\n columnNameMap: ColumnNameMap;\n /** Mapping of identifier names */\n identifierNameMap: IdentifierNameMap;\n /** Mapping of attribute names */\n attributeNameMap: AttributeNameMap;\n /** Request attribute keys */\n requestAttributeKeys: AttributeKey[];\n },\n): [Record<string, string>, PrivacyRequestInput][] {\n // map the CSV to request input\n const getMappedName = (attribute: ColumnName): string =>\n state.getValue('columnNames', attribute) || columnNameMap[attribute]!;\n return requestInputs.map((input): [Record<string, string>, PrivacyRequestInput] => {\n // The extra identifiers to upload for this request\n const attestedExtraIdentifiers: AttestedExtraIdentifiers = {};\n Object.entries(identifierNameMap)\n // filter out skipped identifiers\n .filter(([, columnName]) => columnName !== NONE)\n .forEach(([identifierName, columnName]) => {\n // Determine the identifier type being specified\n const identifierType = Object.values(IdentifierType).includes(\n identifierName as any, // eslint-disable-line @typescript-eslint/no-explicit-any\n )\n ? (identifierName as IdentifierType)\n : IdentifierType.Custom;\n\n // Only add the identifier if the value exists\n const identifierValue = input[columnName];\n if (identifierValue) {\n const normalized = normalizeIdentifierValue(\n identifierValue,\n identifierType,\n defaultPhoneCountryCode,\n );\n if (normalized) {\n // Initialize\n if (!attestedExtraIdentifiers[identifierType]) {\n attestedExtraIdentifiers[identifierType] = [];\n }\n\n // Add the identifier\n attestedExtraIdentifiers[identifierType]!.push({\n value: normalized,\n name: identifierName,\n });\n }\n }\n });\n\n // The extra attributes to upload for this request\n const attributes: ParsedAttributeInput[] = [];\n Object.entries(attributeNameMap)\n // filter out skipped attributes\n .filter(([, columnName]) => columnName !== NONE)\n .forEach(([attributeName, columnName]) => {\n // Only add the identifier if the value exists\n const attributeValueString = input[columnName];\n if (attributeValueString) {\n // Add the attribute\n const isMulti =\n requestAttributeKeys.find((attr) => attr.name === attributeName)?.type ===\n 'MULTI_SELECT';\n attributes.push({\n values: isMulti ? splitCsvToList(attributeValueString) : attributeValueString,\n key: attributeName,\n });\n }\n });\n\n const requestTypeColumn = getMappedName(ColumnName.RequestType);\n const dataSubjectTypeColumn = getMappedName(ColumnName.SubjectType);\n return [\n input,\n {\n email: input[getMappedName(ColumnName.Email)],\n attestedExtraIdentifiers,\n attributes,\n coreIdentifier: input[getMappedName(ColumnName.CoreIdentifier)],\n requestType:\n requestTypeColumn === BULK_APPLY\n ? state.getValue('requestTypeToRequestAction', BLANK)\n : state.getValue('requestTypeToRequestAction', input[requestTypeColumn]),\n subjectType:\n dataSubjectTypeColumn === BULK_APPLY\n ? state.getValue('subjectTypeToSubjectName', BLANK)\n : state.getValue('subjectTypeToSubjectName', input[dataSubjectTypeColumn]),\n ...(getMappedName(ColumnName.Locale) !== NONE && input[getMappedName(ColumnName.Locale)]\n ? {\n locale: state.getValue('languageToLocale', input[getMappedName(ColumnName.Locale)]),\n }\n : {}),\n ...(getMappedName(ColumnName.Country) !== NONE && input[getMappedName(ColumnName.Country)]\n ? {\n country: state.getValue(\n 'regionToCountry',\n input[getMappedName(ColumnName.Country)],\n ) as IsoCountryCode,\n }\n : {}),\n ...(getMappedName(ColumnName.CountrySubDivision) !== NONE &&\n input[getMappedName(ColumnName.CountrySubDivision)]\n ? {\n countrySubDivision: state.getValue(\n 'regionToCountrySubDivision',\n input[getMappedName(ColumnName.CountrySubDivision)],\n ) as IsoCountrySubdivisionCode,\n }\n : {}),\n ...(getMappedName(ColumnName.RequestStatus) !== NONE &&\n state.getValue('statusToRequestStatus', input[getMappedName(ColumnName.RequestStatus)]) !==\n NONE &&\n input[getMappedName(ColumnName.RequestStatus)]\n ? {\n status: state.getValue(\n 'statusToRequestStatus',\n input[getMappedName(ColumnName.RequestStatus)],\n ) as CompletedRequestStatus,\n }\n : {}),\n ...(getMappedName(ColumnName.CreatedAt) !== NONE &&\n input[getMappedName(ColumnName.CreatedAt)]\n ? {\n createdAt: new Date(input[getMappedName(ColumnName.CreatedAt)]),\n }\n : {}),\n ...(getMappedName(ColumnName.DataSiloIds) !== NONE &&\n input[getMappedName(ColumnName.DataSiloIds)]\n ? {\n dataSiloIds: splitCsvToList(input[getMappedName(ColumnName.DataSiloIds)]),\n }\n : {}),\n },\n ];\n });\n}\n","import type { PersistedState } from '@transcend-io/persisted-state';\nimport { INITIALIZER, type Initializer, makeGraphQLRequest } from '@transcend-io/sdk';\nimport type { GraphQLClient } from 'graphql-request';\nimport inquirer from 'inquirer';\n\nimport { logger } from '../../logger.js';\nimport { CachedFileState, IDENTIFIER_BLOCK_LIST } from './constants.js';\nimport { fuzzyMatchColumns } from './fuzzyMatchColumns.js';\n\n/**\n * Mapping from identifier name to request input parameter\n */\nexport type IdentifierNameMap = {\n [k in string]: string;\n};\n\n/**\n * Create a mapping from the identifier names that can be included\n * at request submission, to the names of the columns that map to those\n * identifiers.\n *\n * @param client - GraphQL client\n * @param columnNames - The set of all column names\n * @param state - Cached state of this mapping\n * @returns Mapping from identifier name to column name\n */\nexport async function mapColumnsToIdentifiers(\n client: GraphQLClient,\n columnNames: string[],\n state: PersistedState<typeof CachedFileState>,\n): Promise<IdentifierNameMap> {\n // Grab the initializer\n const { initializer } = await makeGraphQLRequest<{\n /** Query response */\n initializer: Initializer;\n }>(client, INITIALIZER, { logger });\n\n // Determine the columns that should be mapped\n const columnQuestions = initializer.identifiers.filter(\n ({ name }) => !state.getValue('identifierNames', name) && !IDENTIFIER_BLOCK_LIST.includes(name),\n );\n\n // Skip mapping when everything is mapped\n const identifierNameMap =\n columnQuestions.length === 0\n ? {}\n : // prompt questions to map columns\n await inquirer.prompt<{\n [k in string]: string;\n }>(\n columnQuestions.map(({ name }) => {\n const matches = fuzzyMatchColumns(columnNames, name, false);\n return {\n name,\n message: `Choose the column that will be used to map in the identifier: ${name}`,\n type: 'list',\n default: matches[0],\n choices: matches,\n };\n }),\n );\n await Promise.all(\n Object.entries(identifierNameMap).map(([k, v]) => state.setValue(v, 'identifierNames', k)),\n );\n\n return {\n ...state.getValue('identifierNames'),\n ...identifierNameMap,\n };\n}\n","import type { PersistedState } from '@transcend-io/persisted-state';\nimport type { AttributeKey } from '@transcend-io/sdk';\nimport type { GraphQLClient } from 'graphql-request';\nimport inquirer from 'inquirer';\n\nimport { CachedFileState } from './constants.js';\nimport { fuzzyMatchColumns } from './fuzzyMatchColumns.js';\n\n/**\n * Mapping from attribute name to request input parameter\n */\nexport type AttributeNameMap = {\n [k in string]: string;\n};\n\n/**\n * Create a mapping from the attributes names that can be included\n * at request submission, to the names of the columns that map to those\n * attributes.\n *\n * @param client - GraphQL client\n * @param columnNames - The set of all column names\n * @param state - Cached state of this mapping\n * @param requestAttributeKeys - Attribute keys to map\n * @returns Mapping from attributes name to column name\n */\nexport async function mapColumnsToAttributes(\n client: GraphQLClient,\n columnNames: string[],\n state: PersistedState<typeof CachedFileState>,\n requestAttributeKeys: AttributeKey[],\n): Promise<AttributeNameMap> {\n // Determine the columns that should be mapped\n const columnQuestions = requestAttributeKeys.filter(\n ({ name }) => !state.getValue('attributeNames', name),\n );\n\n // Skip mapping when everything is mapped\n const attributeNameMap =\n columnQuestions.length === 0\n ? {}\n : // prompt questions to map columns\n await inquirer.prompt<{\n [k in string]: string;\n }>(\n columnQuestions.map(({ name }) => {\n const matches = fuzzyMatchColumns(columnNames, name, false);\n return {\n name,\n message: `Choose the column that will be used to map in the attribute: ${name}`,\n type: 'list',\n default: matches[0],\n choices: matches,\n };\n }),\n );\n await Promise.all(\n Object.entries(attributeNameMap).map(([k, v]) => state.setValue(v, 'attributeNames', k)),\n );\n\n return {\n ...state.getValue('attributeNames'),\n ...attributeNameMap,\n };\n}\n","import { join } from 'node:path';\n\nimport { PersistedState } from '@transcend-io/persisted-state';\nimport {\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n fetchAllRequestAttributeKeys,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\n/* eslint-disable max-lines */\nimport colors from 'colors';\nimport * as t from 'io-ts';\nimport { uniq } from 'lodash-es';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { CachedRequestState, CachedFileState } from './constants.js';\nimport { extractClientError } from './extractClientError.js';\nimport { filterRows } from './filterRows.js';\nimport { mapColumnsToAttributes } from './mapColumnsToAttributes.js';\nimport { mapColumnsToIdentifiers } from './mapColumnsToIdentifiers.js';\nimport { mapCsvColumnsToApi } from './mapCsvColumnsToApi.js';\nimport { mapCsvRowsToRequestInputs } from './mapCsvRowsToRequestInputs.js';\nimport { mapRequestEnumValues } from './mapRequestEnumValues.js';\nimport { parseAttributesFromString } from './parseAttributesFromString.js';\nimport { readCsv } from './readCsv.js';\nimport { submitPrivacyRequest } from './submitPrivacyRequest.js';\n\n/**\n * Upload a set of privacy requests from CSV\n *\n * @param options - Options\n */\nexport async function uploadPrivacyRequestsFromCsv({\n cacheFilepath,\n requestReceiptFolder,\n file,\n auth,\n sombraAuth,\n concurrency = 100,\n defaultPhoneCountryCode = '1', // USA\n transcendUrl = DEFAULT_TRANSCEND_API,\n attributes = [],\n emailIsVerified = true,\n skipFilterStep = false,\n skipSendingReceipt = true,\n isTest = false,\n isSilent = true,\n debug = false,\n dryRun = false,\n}: {\n /** File to cache metadata about mapping of CSV shape to script */\n cacheFilepath: string;\n /** File where request receipts are stored */\n requestReceiptFolder: string;\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** Default country code for phone numbers */\n defaultPhoneCountryCode?: string;\n /** Concurrency to upload in */\n concurrency?: number;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** Sombra API key authentication */\n sombraAuth?: string;\n /** Include debug logs */\n debug?: boolean;\n /** Skip the step where requests are filtered */\n skipFilterStep?: boolean;\n /** Whether test requests are being uploaded */\n isTest?: boolean;\n /** Whether requests are uploaded in silent mode */\n isSilent?: boolean;\n /** Whether to send the email receipt */\n skipSendingReceipt?: boolean;\n /** Whether the email was verified up front */\n emailIsVerified?: boolean;\n /** Attributes string pre-parse */\n attributes?: string[];\n /** Whether a dry run is happening */\n dryRun?: boolean;\n}): Promise<void> {\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 // Parse out the extra attributes to apply to all requests uploaded\n const parsedAttributes = parseAttributesFromString(attributes);\n\n // Create a new state to persist the metadata that\n // maps the request inputs to the Transcend API shape\n const state = new PersistedState(cacheFilepath, CachedFileState, {\n columnNames: {},\n requestTypeToRequestAction: {},\n subjectTypeToSubjectName: {},\n languageToLocale: {},\n statusToRequestStatus: {},\n identifierNames: {},\n attributeNames: {},\n regionToCountrySubDivision: {},\n regionToCountry: {},\n });\n\n // Create a new state file to store the requests from this run\n const requestCacheFile = join(\n requestReceiptFolder,\n `tr-request-upload-${new Date().toISOString()}-${file.split('/').pop()}`.replace(\n '.csv',\n '.json',\n ),\n );\n const requestState = new PersistedState(requestCacheFile, CachedRequestState, {\n successfulRequests: [],\n duplicateRequests: [],\n failingRequests: [],\n });\n\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, {\n logger,\n sombraApiKey: sombraAuth,\n sombraUrl: process.env.SOMBRA_URL,\n });\n\n // Read in the list of integration requests\n const requestsList = readCsv(file, t.record(t.string, t.string));\n const columnNames = uniq(requestsList.map((x) => Object.keys(x)).flat());\n\n // Log out an example request\n if (requestsList.length === 0) {\n throw new Error(\n 'No Requests found in list! Ensure the first row of the CSV is a header and the rest are requests.',\n );\n }\n if (debug) {\n const firstRequest = requestsList[0];\n logger.info(colors.magenta(`First request: ${JSON.stringify(firstRequest, null, 2)}`));\n }\n // Determine what rows in the CSV should be imported\n // Choose columns that contain metadata to filter the requests\n const filteredRequestList = skipFilterStep ? requestsList : await filterRows(requestsList);\n\n // Build a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n // Grab the request attributes\n const requestAttributeKeys = await fetchAllRequestAttributeKeys(client, { logger });\n // Determine the columns that should be mapped\n const columnNameMap = await mapCsvColumnsToApi(columnNames, state);\n const identifierNameMap = await mapColumnsToIdentifiers(client, columnNames, state);\n const attributeNameMap = await mapColumnsToAttributes(\n client,\n columnNames,\n state,\n requestAttributeKeys,\n );\n await mapRequestEnumValues(client, filteredRequestList, {\n state,\n columnNameMap,\n });\n\n // map the CSV to request input\n const requestInputs = mapCsvRowsToRequestInputs(filteredRequestList, state, {\n defaultPhoneCountryCode,\n columnNameMap,\n identifierNameMap,\n attributeNameMap,\n requestAttributeKeys,\n });\n\n // start the progress bar with a total value of 200 and start value of 0\n if (!debug) {\n progressBar.start(requestInputs.length, 0);\n }\n let total = 0;\n // Submit each request\n await map(\n requestInputs,\n async ([rawRow, requestInput], ind) => {\n // The identifier to log, only include personal data if debug mode is on\n const requestLogId = debug\n ? `email:${requestInput.email} | coreIdentifier:${requestInput.coreIdentifier}`\n : `row:${ind.toString()}`;\n\n if (debug) {\n logger.info(\n colors.magenta(\n `[${ind + 1}/${requestInputs.length}] Importing: ${JSON.stringify(\n requestInput,\n null,\n 2,\n )}`,\n ),\n );\n }\n\n // Skip on dry run\n if (dryRun) {\n logger.info(colors.magenta('Bailing out on dry run because dryRun is set'));\n return;\n }\n\n try {\n // Make the GraphQL request to submit the privacy request\n const requestResponse = await submitPrivacyRequest(sombra, requestInput, {\n details: `Uploaded by Transcend Cli: \"tr-request-upload\" : ${JSON.stringify(\n rawRow,\n null,\n 2,\n )}`,\n isTest,\n emailIsVerified,\n skipSendingReceipt,\n isSilent,\n additionalAttributes: parsedAttributes,\n });\n\n // Log success\n if (debug) {\n logger.info(\n colors.green(\n `[${ind + 1}/${\n requestInputs.length\n }] Successfully submitted the test data subject request: \"${requestLogId}\"`,\n ),\n );\n logger.info(\n colors.green(\n `[${ind + 1}/${requestInputs.length}] View it at: \"${requestResponse.link}\"`,\n ),\n );\n }\n\n // Cache successful upload\n const successfulRequests = requestState.getValue('successfulRequests');\n successfulRequests.push({\n id: requestResponse.id,\n link: requestResponse.link,\n rowIndex: ind,\n coreIdentifier: requestResponse.coreIdentifier,\n attemptedAt: new Date().toISOString(),\n });\n await requestState.setValue(successfulRequests, 'successfulRequests');\n } catch (err) {\n const msg = `${err.message} - ${JSON.stringify(err.response?.body, null, 2)}`;\n const clientError = extractClientError(msg);\n\n if (clientError === 'Client error: You have already made this request.') {\n if (debug) {\n logger.info(\n colors.yellow(\n `[${ind + 1}/${requestInputs.length}] Skipping request as it is a duplicate`,\n ),\n );\n }\n const duplicateRequests = requestState.getValue('duplicateRequests');\n duplicateRequests.push({\n coreIdentifier: requestInput.coreIdentifier,\n rowIndex: ind,\n attemptedAt: new Date().toISOString(),\n });\n await requestState.setValue(duplicateRequests, 'duplicateRequests');\n } else {\n const failingRequests = requestState.getValue('failingRequests');\n failingRequests.push({\n ...requestInput,\n rowIndex: ind,\n error: clientError || msg,\n attemptedAt: new Date().toISOString(),\n });\n await requestState.setValue(failingRequests, 'failingRequests');\n if (debug) {\n logger.error(colors.red(clientError || msg));\n logger.error(\n colors.red(\n `[${ind + 1}/${\n requestInputs.length\n }] Failed to submit request for: \"${requestLogId}\"`,\n ),\n );\n }\n }\n }\n\n total += 1;\n if (!debug) {\n progressBar.update(total);\n }\n },\n {\n concurrency,\n },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n // Log completion time\n logger.info(colors.green(`Completed upload in \"${totalTime / 1000}\" seconds.`));\n\n // Log duplicates\n if (requestState.getValue('duplicateRequests').length > 0) {\n logger.info(\n colors.yellow(\n `Encountered \"${requestState.getValue('duplicateRequests').length}\" duplicate requests. ` +\n `See \"${requestCacheFile}\" to review the core identifiers for these requests.`,\n ),\n );\n }\n\n // Log errors\n if (requestState.getValue('failingRequests').length > 0) {\n logger.error(\n colors.red(\n `Encountered \"${requestState.getValue('failingRequests').length}\" errors. ` +\n `See \"${requestCacheFile}\" to review the error messages and inputs.`,\n ),\n );\n process.exit(1);\n }\n}\n/* eslint-enable max-lines */\n"],"mappings":"kzCAcA,eAAsB,EACpB,EACA,EACA,EACoC,CACpC,EAAS,eAAe,eAAgB,EAAmB,CAE3D,IAAM,EAAS,EAAU,IAAK,GAAS,GAAQ,UAAU,CAAC,OAAQ,GAAU,CAAC,EAAM,GAAO,CAC1F,GAAI,EAAO,SAAW,EACpB,OAAO,EAET,IAAM,EAAS,MAAM,EAAS,OAC5B,EAAO,IAAK,IAAW,CACrB,KAAM,EACN,QAAS,iBAAiB,IAC1B,KAAM,eACN,QAAS,EAAgB,KAAM,GAAM,EAAY,EAAO,EAAE,CAAC,CAC3D,QAAS,EAA2B,IACjC,EAEG,EAAgB,OAAQ,GAAM,OAAO,GAAM,UAAY,EAAY,EAAO,EAAE,CAAC,CAD7E,EAEP,EAAE,CACJ,CACD,MAAO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RTgJsx.mjs","names":[],"sources":["../src/lib/requests/mapEnumValues.ts","../src/lib/requests/getUniqueValuesForColumn.ts","../src/lib/requests/filterRows.ts","../src/lib/requests/mapCsvColumnsToApi.ts","../src/lib/requests/mapRequestEnumValues.ts","../src/lib/requests/mapCsvRowsToRequestInputs.ts","../src/lib/requests/mapColumnsToIdentifiers.ts","../src/lib/requests/mapColumnsToAttributes.ts","../src/lib/requests/uploadPrivacyRequestsFromCsv.ts"],"sourcesContent":["import { apply, ObjByString } from '@transcend-io/type-utils';\nimport inquirer from 'inquirer';\nimport autoCompletePrompt from 'inquirer-autocomplete-prompt';\n\nimport { fuzzySearch } from './fuzzyMatchColumns.js';\n\n/**\n * Map a set of inputs to a set of outputs\n *\n * @param csvInputs - Input list\n * @param expectedOutputs - Output list\n * @param cache - Cache\n * @returns Mapping from row to enum value\n */\nexport async function mapEnumValues<TValue extends string>(\n csvInputs: string[],\n expectedOutputs: TValue[],\n cache: { [k in string]: TValue },\n): Promise<{ [k in string]: TValue }> {\n inquirer.registerPrompt('autocomplete', autoCompletePrompt);\n\n const inputs = csvInputs.map((item) => item || '<blank>').filter((value) => !cache[value]);\n if (inputs.length === 0) {\n return cache;\n }\n const result = await inquirer.prompt<{ [k in string]: TValue }>(\n inputs.map((value) => ({\n name: value,\n message: `Map value of: ${value}`,\n type: 'autocomplete',\n default: expectedOutputs.find((x) => fuzzySearch(value, x)),\n source: (answersSoFar: ObjByString, input: string) =>\n !input\n ? expectedOutputs\n : expectedOutputs.filter((x) => typeof x === 'string' && fuzzySearch(input, x)),\n })),\n );\n return {\n ...cache,\n ...apply(result, (r) =>\n typeof r === 'string' ? (r as TValue) : (Object.values(r)[0] as TValue),\n ),\n };\n}\n","import { ObjByString } from '@transcend-io/type-utils';\nimport { uniq } from 'lodash-es';\n\n/**\n * Return the unique set of values for a column in a CSV\n *\n * @param rows - Rows to look up\n * @param columnName - Name of column to grab values for\n * @returns Unique set of values in that column\n */\nexport function getUniqueValuesForColumn(rows: ObjByString[], columnName: string): string[] {\n return uniq(rows.map((row) => row[columnName] || '').flat());\n}\n","import { ObjByString } from '@transcend-io/type-utils';\nimport colors from 'colors';\nimport inquirer from 'inquirer';\nimport { uniq } from 'lodash-es';\n\nimport { logger } from '../../logger.js';\nimport { NONE } from './constants.js';\nimport { getUniqueValuesForColumn } from './getUniqueValuesForColumn.js';\n\n/**\n * Filter a list of CSV rows by column values\n * Choose columns that contain metadata to filter the requests\n *\n * @param rows - Rows to filter\n * @returns Filtered rows\n */\nexport async function filterRows(rows: ObjByString[]): Promise<ObjByString[]> {\n // Determine set of column names\n const columnNames = uniq(rows.map((x) => Object.keys(x)).flat());\n\n // update these variables recursively\n let filteredRows = rows;\n let keepFiltering = true;\n\n // loop over\n while (keepFiltering) {\n // Prompt user for column to filter on\n\n const { filterColumnName } = await inquirer.prompt<{\n /** Name of column to filter on */\n filterColumnName: string;\n }>([\n {\n name: 'filterColumnName',\n // eslint-disable-next-line max-len\n message: `If you need to filter the list of requests to import, choose the column to filter on. Currently ${filteredRows.length} rows.`,\n type: 'list',\n default: columnNames,\n choices: [NONE, ...columnNames],\n },\n ]);\n\n // Determine if filtering should continue, or loop should be exited\n keepFiltering = NONE !== filterColumnName;\n if (keepFiltering) {\n const options = getUniqueValuesForColumn(filteredRows, filterColumnName);\n\n const { valuesToKeep } = await inquirer.prompt<{\n /** Values to keep */\n valuesToKeep: string[];\n }>([\n {\n name: 'valuesToKeep',\n message: 'Keep rows matching this value',\n type: 'checkbox',\n default: columnNames,\n choices: options,\n },\n ]);\n\n filteredRows = filteredRows.filter((request) =>\n valuesToKeep.includes(request[filterColumnName]),\n );\n }\n }\n\n logger.info(colors.magenta(`Importing ${filteredRows.length} requests`));\n return filteredRows;\n}\n","import type { PersistedState } from '@transcend-io/persisted-state';\nimport { getValues, getEntries } from '@transcend-io/type-utils';\nimport inquirer from 'inquirer';\nimport { startCase } from 'lodash-es';\n\nimport { ColumnName, CachedFileState, IS_REQUIRED, CAN_APPLY_IN_BULK } from './constants.js';\nimport { fuzzyMatchColumns } from './fuzzyMatchColumns.js';\n\n/**\n * Mapping from column name to request input parameter\n */\nexport type ColumnNameMap = {\n [k in ColumnName]?: string;\n};\n\n/**\n * Determine the mapping between columns in CSV\n *\n * @param columnNames - The set of column names\n * @param state - The cached file state used to map DSR inputs\n * @returns The column name mapping\n */\nexport async function mapCsvColumnsToApi(\n columnNames: string[],\n state: PersistedState<typeof CachedFileState>,\n): Promise<ColumnNameMap> {\n // Determine the columns that should be mapped\n const columnQuestions = getValues(ColumnName).filter(\n (name) => !state.getValue('columnNames', name),\n );\n\n // Skip mapping when everything is mapped\n const columnNameMap =\n columnQuestions.length === 0\n ? {}\n : // prompt questions to map columns\n await inquirer.prompt<{\n [k in ColumnName]?: string;\n }>(\n columnQuestions.map((name) => {\n const field = startCase(name.replace('ColumnName', ''));\n const matches = fuzzyMatchColumns(\n columnNames,\n field,\n IS_REQUIRED[name],\n !!CAN_APPLY_IN_BULK[name],\n );\n return {\n name,\n message: `Choose the column that will be used to map in the field: ${field}`,\n type: 'list',\n default: matches[0],\n choices: matches,\n };\n }),\n );\n\n await Promise.all(getEntries(columnNameMap).map(([k, v]) => state.setValue(v, 'columnNames', k)));\n return columnNameMap;\n}\n","import { LOCALE_KEY, type LocaleValue } from '@transcend-io/internationalization';\nimport type { PersistedState } from '@transcend-io/persisted-state';\nimport {\n CompletedRequestStatus,\n RequestAction,\n IsoCountryCode,\n IsoCountrySubdivisionCode,\n} from '@transcend-io/privacy-types';\nimport { makeGraphQLRequest, DATA_SUBJECTS, type DataSubject } from '@transcend-io/sdk';\nimport { ObjByString } from '@transcend-io/type-utils';\nimport colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\n\nimport { logger } from '../../logger.js';\nimport { CachedFileState, NONE, ColumnName } from './constants.js';\nimport { getUniqueValuesForColumn } from './getUniqueValuesForColumn.js';\nimport { ColumnNameMap } from './mapCsvColumnsToApi.js';\nimport { mapEnumValues } from './mapEnumValues.js';\n\n/**\n * Map the values in a CSV to the enum values in Transcend\n *\n * @param client - GraphQL client\n * @param requests - Set of privacy requests\n * @param options - Options\n */\nexport async function mapRequestEnumValues(\n client: GraphQLClient,\n requests: ObjByString[],\n {\n state,\n columnNameMap,\n }: {\n /** State value to write cache to */\n state: PersistedState<typeof CachedFileState>;\n /** Mapping of column names */\n columnNameMap: ColumnNameMap;\n },\n): Promise<void> {\n // Get mapped value\n const getMappedName = (attribute: ColumnName): string =>\n state.getValue('columnNames', attribute) || columnNameMap[attribute]!;\n\n // Fetch all data subjects in the organization\n const { internalSubjects } = await makeGraphQLRequest<{\n /** Query response */\n internalSubjects: DataSubject[];\n }>(client, DATA_SUBJECTS, { logger });\n\n // Map RequestAction\n logger.info(colors.magenta('Determining mapping of columns for request action'));\n const requestTypeToRequestAction: { [k in string]: RequestAction } = await mapEnumValues(\n getUniqueValuesForColumn(requests, getMappedName(ColumnName.RequestType)),\n Object.values(RequestAction),\n state.getValue('requestTypeToRequestAction'),\n );\n await state.setValue(requestTypeToRequestAction, 'requestTypeToRequestAction');\n\n // Map data subject type\n logger.info(colors.magenta('Determining mapping of columns for subject'));\n const subjectTypeToSubjectName: { [k in string]: string } = await mapEnumValues(\n getUniqueValuesForColumn(requests, getMappedName(ColumnName.SubjectType)),\n internalSubjects.map(({ type }) => type),\n state.getValue('subjectTypeToSubjectName'),\n );\n await state.setValue(subjectTypeToSubjectName, 'subjectTypeToSubjectName');\n\n // Map locale\n logger.info(colors.magenta('Determining mapping of columns for locale'));\n const languageToLocale: { [k in string]: LocaleValue } = await mapEnumValues(\n getUniqueValuesForColumn(requests, getMappedName(ColumnName.Locale)),\n Object.values(LOCALE_KEY),\n state.getValue('languageToLocale'),\n );\n await state.setValue(languageToLocale, 'languageToLocale');\n logger.info(colors.magenta('Determining mapping of columns for request status'));\n\n // Map request status\n logger.info(colors.magenta('Determining mapping of columns for request status'));\n const requestStatusColumn = getMappedName(ColumnName.RequestStatus);\n const statusToRequestStatus: {\n [k in string]: CompletedRequestStatus | typeof NONE;\n } =\n requestStatusColumn === NONE\n ? {}\n : await mapEnumValues(\n getUniqueValuesForColumn(requests, requestStatusColumn),\n [...Object.values(CompletedRequestStatus), NONE],\n state.getValue('statusToRequestStatus'),\n );\n await state.setValue(statusToRequestStatus, 'statusToRequestStatus');\n\n // Map country\n logger.info(colors.magenta('Determining mapping of columns for country'));\n const countryColumn = getMappedName(ColumnName.Country);\n const regionToCountry: {\n [k in string]: IsoCountryCode | typeof NONE;\n } =\n countryColumn === NONE\n ? {}\n : await mapEnumValues(\n getUniqueValuesForColumn(requests, countryColumn),\n [...Object.values(IsoCountryCode), NONE],\n state.getValue('regionToCountry'),\n );\n await state.setValue(regionToCountry, 'regionToCountry');\n\n // Map country sub division\n logger.info(colors.magenta('Determining mapping of columns for country sub division'));\n const countrySubDivisionColumn = getMappedName(ColumnName.CountrySubDivision);\n const regionToCountrySubDivision: {\n [k in string]: IsoCountrySubdivisionCode | typeof NONE;\n } =\n countrySubDivisionColumn === NONE\n ? {}\n : await mapEnumValues(\n getUniqueValuesForColumn(requests, countrySubDivisionColumn),\n [...Object.values(IsoCountrySubdivisionCode), NONE],\n state.getValue('regionToCountrySubDivision'),\n );\n await state.setValue(regionToCountrySubDivision, 'regionToCountrySubDivision');\n}\n","import { LOCALE_KEY } from '@transcend-io/internationalization';\nimport type { PersistedState } from '@transcend-io/persisted-state';\nimport {\n NORMALIZE_PHONE_NUMBER,\n CompletedRequestStatus,\n RequestAction,\n IdentifierType,\n IsoCountryCode,\n IsoCountrySubdivisionCode,\n} from '@transcend-io/privacy-types';\nimport type { AttributeKey } from '@transcend-io/sdk';\nimport { ObjByString, valuesOf } from '@transcend-io/type-utils';\nimport { splitCsvToList } from '@transcend-io/utils';\nimport * as t from 'io-ts';\nimport { DateFromISOString } from 'io-ts-types';\n\nimport { CachedFileState, BLANK, BULK_APPLY, ColumnName, NONE } from './constants.js';\nimport { AttributeNameMap } from './mapColumnsToAttributes.js';\nimport { IdentifierNameMap } from './mapColumnsToIdentifiers.js';\nimport { ColumnNameMap } from './mapCsvColumnsToApi.js';\nimport { ParsedAttributeInput } from './parseAttributesFromString.js';\n\n/**\n * Shape of additional identifiers\n *\n * key of object is IdentifierType\n */\nexport const AttestedExtraIdentifiers = t.record(\n t.string,\n t.array(\n t.intersection([\n t.type({\n /** Value of identifier */\n value: t.string,\n }),\n t.partial({\n /** Name of identifier - option for non-custom identifier types */\n name: t.string,\n }),\n ]),\n ),\n);\n\n/** Type override */\nexport type AttestedExtraIdentifiers = t.TypeOf<typeof AttestedExtraIdentifiers>;\n\nexport const PrivacyRequestInput = t.intersection([\n t.type({\n /** Email of user */\n email: t.string,\n /** Extra identifiers */\n attestedExtraIdentifiers: AttestedExtraIdentifiers,\n /** Core identifier for user */\n coreIdentifier: t.string,\n /** Action type being submitted */\n requestType: valuesOf(RequestAction),\n /** Type of data subject */\n subjectType: t.string,\n }),\n t.partial({\n /** Country */\n country: valuesOf(IsoCountryCode),\n /** Country sub division */\n countrySubDivision: valuesOf(IsoCountrySubdivisionCode),\n /** Attribute inputs */\n attributes: t.array(ParsedAttributeInput),\n /** The status that the request should be created as */\n status: valuesOf(CompletedRequestStatus),\n /** The time that the request was created */\n createdAt: DateFromISOString,\n /** Data silo IDs to submit for */\n dataSiloIds: t.array(t.string),\n /** Language key to map to */\n locale: valuesOf(LOCALE_KEY),\n }),\n]);\n\n/** Type override */\nexport type PrivacyRequestInput = t.TypeOf<typeof PrivacyRequestInput>;\n\n/**\n * Transform the identifier value based on type\n *\n * @param identifierValue - Value of identifier\n * @param identifierType - Type of identifier\n * @param defaultPhoneCountryCode - Default country code for phone numbers\n * @returns Post-processed identifier\n */\nexport function normalizeIdentifierValue(\n identifierValue: string,\n identifierType: IdentifierType,\n defaultPhoneCountryCode: string,\n): string {\n // Lowercase email\n if (identifierType === IdentifierType.Email) {\n return identifierValue.toLowerCase();\n }\n\n // Normalize phone number\n if (identifierType === IdentifierType.Phone) {\n const normalized = identifierValue\n .replace(NORMALIZE_PHONE_NUMBER, '')\n .replace(/[()]/g, '')\n .replace(/[–]/g, '')\n .replace(/[:]/g, '')\n .replace(/[]/g, '')\n .replace(/[A-Za-z]/g, '');\n return !normalized\n ? ''\n : normalized.startsWith('+')\n ? normalized\n : `+${defaultPhoneCountryCode}${normalized}`;\n }\n return identifierValue;\n}\n\n/**\n * Take the raw rows in a CSV upload, and map those rows to the request\n * input shape that can be passed to the Transcend API to submit a privacy\n * request.\n *\n * @param requestInputs - CSV of requests to be uploaded\n * @param state - The cached set of mapping values\n * @param options - Options\n * @returns [raw input, request input] list\n */\nexport function mapCsvRowsToRequestInputs(\n requestInputs: ObjByString[],\n state: PersistedState<typeof CachedFileState>,\n {\n columnNameMap,\n identifierNameMap,\n attributeNameMap,\n requestAttributeKeys,\n defaultPhoneCountryCode = '1', // US\n }: {\n /** Default country code */\n defaultPhoneCountryCode?: string;\n /** Mapping of column names */\n columnNameMap: ColumnNameMap;\n /** Mapping of identifier names */\n identifierNameMap: IdentifierNameMap;\n /** Mapping of attribute names */\n attributeNameMap: AttributeNameMap;\n /** Request attribute keys */\n requestAttributeKeys: AttributeKey[];\n },\n): [Record<string, string>, PrivacyRequestInput][] {\n // map the CSV to request input\n const getMappedName = (attribute: ColumnName): string =>\n state.getValue('columnNames', attribute) || columnNameMap[attribute]!;\n return requestInputs.map((input): [Record<string, string>, PrivacyRequestInput] => {\n // The extra identifiers to upload for this request\n const attestedExtraIdentifiers: AttestedExtraIdentifiers = {};\n Object.entries(identifierNameMap)\n // filter out skipped identifiers\n .filter(([, columnName]) => columnName !== NONE)\n .forEach(([identifierName, columnName]) => {\n // Determine the identifier type being specified\n const identifierType = Object.values(IdentifierType).includes(\n identifierName as any, // eslint-disable-line @typescript-eslint/no-explicit-any\n )\n ? (identifierName as IdentifierType)\n : IdentifierType.Custom;\n\n // Only add the identifier if the value exists\n const identifierValue = input[columnName];\n if (identifierValue) {\n const normalized = normalizeIdentifierValue(\n identifierValue,\n identifierType,\n defaultPhoneCountryCode,\n );\n if (normalized) {\n // Initialize\n if (!attestedExtraIdentifiers[identifierType]) {\n attestedExtraIdentifiers[identifierType] = [];\n }\n\n // Add the identifier\n attestedExtraIdentifiers[identifierType]!.push({\n value: normalized,\n name: identifierName,\n });\n }\n }\n });\n\n // The extra attributes to upload for this request\n const attributes: ParsedAttributeInput[] = [];\n Object.entries(attributeNameMap)\n // filter out skipped attributes\n .filter(([, columnName]) => columnName !== NONE)\n .forEach(([attributeName, columnName]) => {\n // Only add the identifier if the value exists\n const attributeValueString = input[columnName];\n if (attributeValueString) {\n // Add the attribute\n const isMulti =\n requestAttributeKeys.find((attr) => attr.name === attributeName)?.type ===\n 'MULTI_SELECT';\n attributes.push({\n values: isMulti ? splitCsvToList(attributeValueString) : attributeValueString,\n key: attributeName,\n });\n }\n });\n\n const requestTypeColumn = getMappedName(ColumnName.RequestType);\n const dataSubjectTypeColumn = getMappedName(ColumnName.SubjectType);\n return [\n input,\n {\n email: input[getMappedName(ColumnName.Email)],\n attestedExtraIdentifiers,\n attributes,\n coreIdentifier: input[getMappedName(ColumnName.CoreIdentifier)],\n requestType:\n requestTypeColumn === BULK_APPLY\n ? state.getValue('requestTypeToRequestAction', BLANK)\n : state.getValue('requestTypeToRequestAction', input[requestTypeColumn]),\n subjectType:\n dataSubjectTypeColumn === BULK_APPLY\n ? state.getValue('subjectTypeToSubjectName', BLANK)\n : state.getValue('subjectTypeToSubjectName', input[dataSubjectTypeColumn]),\n ...(getMappedName(ColumnName.Locale) !== NONE && input[getMappedName(ColumnName.Locale)]\n ? {\n locale: state.getValue('languageToLocale', input[getMappedName(ColumnName.Locale)]),\n }\n : {}),\n ...(getMappedName(ColumnName.Country) !== NONE && input[getMappedName(ColumnName.Country)]\n ? {\n country: state.getValue(\n 'regionToCountry',\n input[getMappedName(ColumnName.Country)],\n ) as IsoCountryCode,\n }\n : {}),\n ...(getMappedName(ColumnName.CountrySubDivision) !== NONE &&\n input[getMappedName(ColumnName.CountrySubDivision)]\n ? {\n countrySubDivision: state.getValue(\n 'regionToCountrySubDivision',\n input[getMappedName(ColumnName.CountrySubDivision)],\n ) as IsoCountrySubdivisionCode,\n }\n : {}),\n ...(getMappedName(ColumnName.RequestStatus) !== NONE &&\n state.getValue('statusToRequestStatus', input[getMappedName(ColumnName.RequestStatus)]) !==\n NONE &&\n input[getMappedName(ColumnName.RequestStatus)]\n ? {\n status: state.getValue(\n 'statusToRequestStatus',\n input[getMappedName(ColumnName.RequestStatus)],\n ) as CompletedRequestStatus,\n }\n : {}),\n ...(getMappedName(ColumnName.CreatedAt) !== NONE &&\n input[getMappedName(ColumnName.CreatedAt)]\n ? {\n createdAt: new Date(input[getMappedName(ColumnName.CreatedAt)]),\n }\n : {}),\n ...(getMappedName(ColumnName.DataSiloIds) !== NONE &&\n input[getMappedName(ColumnName.DataSiloIds)]\n ? {\n dataSiloIds: splitCsvToList(input[getMappedName(ColumnName.DataSiloIds)]),\n }\n : {}),\n },\n ];\n });\n}\n","import type { PersistedState } from '@transcend-io/persisted-state';\nimport { INITIALIZER, type Initializer, makeGraphQLRequest } from '@transcend-io/sdk';\nimport type { GraphQLClient } from 'graphql-request';\nimport inquirer from 'inquirer';\n\nimport { logger } from '../../logger.js';\nimport { CachedFileState, IDENTIFIER_BLOCK_LIST } from './constants.js';\nimport { fuzzyMatchColumns } from './fuzzyMatchColumns.js';\n\n/**\n * Mapping from identifier name to request input parameter\n */\nexport type IdentifierNameMap = {\n [k in string]: string;\n};\n\n/**\n * Create a mapping from the identifier names that can be included\n * at request submission, to the names of the columns that map to those\n * identifiers.\n *\n * @param client - GraphQL client\n * @param columnNames - The set of all column names\n * @param state - Cached state of this mapping\n * @returns Mapping from identifier name to column name\n */\nexport async function mapColumnsToIdentifiers(\n client: GraphQLClient,\n columnNames: string[],\n state: PersistedState<typeof CachedFileState>,\n): Promise<IdentifierNameMap> {\n // Grab the initializer\n const { initializer } = await makeGraphQLRequest<{\n /** Query response */\n initializer: Initializer;\n }>(client, INITIALIZER, { logger });\n\n // Determine the columns that should be mapped\n const columnQuestions = initializer.identifiers.filter(\n ({ name }) => !state.getValue('identifierNames', name) && !IDENTIFIER_BLOCK_LIST.includes(name),\n );\n\n // Skip mapping when everything is mapped\n const identifierNameMap =\n columnQuestions.length === 0\n ? {}\n : // prompt questions to map columns\n await inquirer.prompt<{\n [k in string]: string;\n }>(\n columnQuestions.map(({ name }) => {\n const matches = fuzzyMatchColumns(columnNames, name, false);\n return {\n name,\n message: `Choose the column that will be used to map in the identifier: ${name}`,\n type: 'list',\n default: matches[0],\n choices: matches,\n };\n }),\n );\n await Promise.all(\n Object.entries(identifierNameMap).map(([k, v]) => state.setValue(v, 'identifierNames', k)),\n );\n\n return {\n ...state.getValue('identifierNames'),\n ...identifierNameMap,\n };\n}\n","import type { PersistedState } from '@transcend-io/persisted-state';\nimport type { AttributeKey } from '@transcend-io/sdk';\nimport type { GraphQLClient } from 'graphql-request';\nimport inquirer from 'inquirer';\n\nimport { CachedFileState } from './constants.js';\nimport { fuzzyMatchColumns } from './fuzzyMatchColumns.js';\n\n/**\n * Mapping from attribute name to request input parameter\n */\nexport type AttributeNameMap = {\n [k in string]: string;\n};\n\n/**\n * Create a mapping from the attributes names that can be included\n * at request submission, to the names of the columns that map to those\n * attributes.\n *\n * @param client - GraphQL client\n * @param columnNames - The set of all column names\n * @param state - Cached state of this mapping\n * @param requestAttributeKeys - Attribute keys to map\n * @returns Mapping from attributes name to column name\n */\nexport async function mapColumnsToAttributes(\n client: GraphQLClient,\n columnNames: string[],\n state: PersistedState<typeof CachedFileState>,\n requestAttributeKeys: AttributeKey[],\n): Promise<AttributeNameMap> {\n // Determine the columns that should be mapped\n const columnQuestions = requestAttributeKeys.filter(\n ({ name }) => !state.getValue('attributeNames', name),\n );\n\n // Skip mapping when everything is mapped\n const attributeNameMap =\n columnQuestions.length === 0\n ? {}\n : // prompt questions to map columns\n await inquirer.prompt<{\n [k in string]: string;\n }>(\n columnQuestions.map(({ name }) => {\n const matches = fuzzyMatchColumns(columnNames, name, false);\n return {\n name,\n message: `Choose the column that will be used to map in the attribute: ${name}`,\n type: 'list',\n default: matches[0],\n choices: matches,\n };\n }),\n );\n await Promise.all(\n Object.entries(attributeNameMap).map(([k, v]) => state.setValue(v, 'attributeNames', k)),\n );\n\n return {\n ...state.getValue('attributeNames'),\n ...attributeNameMap,\n };\n}\n","import { join } from 'node:path';\n\nimport { PersistedState } from '@transcend-io/persisted-state';\nimport {\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n fetchAllRequestAttributeKeys,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\n/* eslint-disable max-lines */\nimport colors from 'colors';\nimport * as t from 'io-ts';\nimport { uniq } from 'lodash-es';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { CachedRequestState, CachedFileState } from './constants.js';\nimport { extractClientError } from './extractClientError.js';\nimport { filterRows } from './filterRows.js';\nimport { mapColumnsToAttributes } from './mapColumnsToAttributes.js';\nimport { mapColumnsToIdentifiers } from './mapColumnsToIdentifiers.js';\nimport { mapCsvColumnsToApi } from './mapCsvColumnsToApi.js';\nimport { mapCsvRowsToRequestInputs } from './mapCsvRowsToRequestInputs.js';\nimport { mapRequestEnumValues } from './mapRequestEnumValues.js';\nimport { parseAttributesFromString } from './parseAttributesFromString.js';\nimport { readCsv } from './readCsv.js';\nimport { submitPrivacyRequest } from './submitPrivacyRequest.js';\n\n/**\n * Upload a set of privacy requests from CSV\n *\n * @param options - Options\n */\nexport async function uploadPrivacyRequestsFromCsv({\n cacheFilepath,\n requestReceiptFolder,\n file,\n auth,\n sombraAuth,\n concurrency = 100,\n defaultPhoneCountryCode = '1', // USA\n transcendUrl = DEFAULT_TRANSCEND_API,\n attributes = [],\n emailIsVerified = true,\n skipFilterStep = false,\n skipSendingReceipt = true,\n isTest = false,\n isSilent = true,\n debug = false,\n dryRun = false,\n}: {\n /** File to cache metadata about mapping of CSV shape to script */\n cacheFilepath: string;\n /** File where request receipts are stored */\n requestReceiptFolder: string;\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** Default country code for phone numbers */\n defaultPhoneCountryCode?: string;\n /** Concurrency to upload in */\n concurrency?: number;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** Sombra API key authentication */\n sombraAuth?: string;\n /** Include debug logs */\n debug?: boolean;\n /** Skip the step where requests are filtered */\n skipFilterStep?: boolean;\n /** Whether test requests are being uploaded */\n isTest?: boolean;\n /** Whether requests are uploaded in silent mode */\n isSilent?: boolean;\n /** Whether to send the email receipt */\n skipSendingReceipt?: boolean;\n /** Whether the email was verified up front */\n emailIsVerified?: boolean;\n /** Attributes string pre-parse */\n attributes?: string[];\n /** Whether a dry run is happening */\n dryRun?: boolean;\n}): Promise<void> {\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 // Parse out the extra attributes to apply to all requests uploaded\n const parsedAttributes = parseAttributesFromString(attributes);\n\n // Create a new state to persist the metadata that\n // maps the request inputs to the Transcend API shape\n const state = new PersistedState(cacheFilepath, CachedFileState, {\n columnNames: {},\n requestTypeToRequestAction: {},\n subjectTypeToSubjectName: {},\n languageToLocale: {},\n statusToRequestStatus: {},\n identifierNames: {},\n attributeNames: {},\n regionToCountrySubDivision: {},\n regionToCountry: {},\n });\n\n // Create a new state file to store the requests from this run.\n // `toISOString()` contains colons (e.g. 2026-07-06T04:33:12.345Z) which are\n // illegal characters in Windows filenames, so strip them out to keep the\n // auto-generated receipt filename cross-platform.\n const requestCacheFile = join(\n requestReceiptFolder,\n `tr-request-upload-${new Date()\n .toISOString()\n .replace(/:/g, '-')}-${file.split('/').pop()}`.replace('.csv', '.json'),\n );\n const requestState = new PersistedState(requestCacheFile, CachedRequestState, {\n successfulRequests: [],\n duplicateRequests: [],\n failingRequests: [],\n });\n\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, {\n logger,\n sombraApiKey: sombraAuth,\n sombraUrl: process.env.SOMBRA_URL,\n });\n\n // Read in the list of integration requests\n const requestsList = readCsv(file, t.record(t.string, t.string));\n const columnNames = uniq(requestsList.map((x) => Object.keys(x)).flat());\n\n // Log out an example request\n if (requestsList.length === 0) {\n throw new Error(\n 'No Requests found in list! Ensure the first row of the CSV is a header and the rest are requests.',\n );\n }\n if (debug) {\n const firstRequest = requestsList[0];\n logger.info(colors.magenta(`First request: ${JSON.stringify(firstRequest, null, 2)}`));\n }\n // Determine what rows in the CSV should be imported\n // Choose columns that contain metadata to filter the requests\n const filteredRequestList = skipFilterStep ? requestsList : await filterRows(requestsList);\n\n // Build a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n // Grab the request attributes\n const requestAttributeKeys = await fetchAllRequestAttributeKeys(client, { logger });\n // Determine the columns that should be mapped\n const columnNameMap = await mapCsvColumnsToApi(columnNames, state);\n const identifierNameMap = await mapColumnsToIdentifiers(client, columnNames, state);\n const attributeNameMap = await mapColumnsToAttributes(\n client,\n columnNames,\n state,\n requestAttributeKeys,\n );\n await mapRequestEnumValues(client, filteredRequestList, {\n state,\n columnNameMap,\n });\n\n // map the CSV to request input\n const requestInputs = mapCsvRowsToRequestInputs(filteredRequestList, state, {\n defaultPhoneCountryCode,\n columnNameMap,\n identifierNameMap,\n attributeNameMap,\n requestAttributeKeys,\n });\n\n // start the progress bar with a total value of 200 and start value of 0\n if (!debug) {\n progressBar.start(requestInputs.length, 0);\n }\n let total = 0;\n // Submit each request\n await map(\n requestInputs,\n async ([rawRow, requestInput], ind) => {\n // The identifier to log, only include personal data if debug mode is on\n const requestLogId = debug\n ? `email:${requestInput.email} | coreIdentifier:${requestInput.coreIdentifier}`\n : `row:${ind.toString()}`;\n\n if (debug) {\n logger.info(\n colors.magenta(\n `[${ind + 1}/${requestInputs.length}] Importing: ${JSON.stringify(\n requestInput,\n null,\n 2,\n )}`,\n ),\n );\n }\n\n // Skip on dry run\n if (dryRun) {\n logger.info(colors.magenta('Bailing out on dry run because dryRun is set'));\n return;\n }\n\n try {\n // Make the GraphQL request to submit the privacy request\n const requestResponse = await submitPrivacyRequest(sombra, requestInput, {\n details: `Uploaded by Transcend Cli: \"tr-request-upload\" : ${JSON.stringify(\n rawRow,\n null,\n 2,\n )}`,\n isTest,\n emailIsVerified,\n skipSendingReceipt,\n isSilent,\n additionalAttributes: parsedAttributes,\n });\n\n // Log success\n if (debug) {\n logger.info(\n colors.green(\n `[${ind + 1}/${\n requestInputs.length\n }] Successfully submitted the test data subject request: \"${requestLogId}\"`,\n ),\n );\n logger.info(\n colors.green(\n `[${ind + 1}/${requestInputs.length}] View it at: \"${requestResponse.link}\"`,\n ),\n );\n }\n\n // Cache successful upload\n const successfulRequests = requestState.getValue('successfulRequests');\n successfulRequests.push({\n id: requestResponse.id,\n link: requestResponse.link,\n rowIndex: ind,\n coreIdentifier: requestResponse.coreIdentifier,\n attemptedAt: new Date().toISOString(),\n });\n await requestState.setValue(successfulRequests, 'successfulRequests');\n } catch (err) {\n const msg = `${err.message} - ${JSON.stringify(err.response?.body, null, 2)}`;\n const clientError = extractClientError(msg);\n\n if (clientError === 'Client error: You have already made this request.') {\n if (debug) {\n logger.info(\n colors.yellow(\n `[${ind + 1}/${requestInputs.length}] Skipping request as it is a duplicate`,\n ),\n );\n }\n const duplicateRequests = requestState.getValue('duplicateRequests');\n duplicateRequests.push({\n coreIdentifier: requestInput.coreIdentifier,\n rowIndex: ind,\n attemptedAt: new Date().toISOString(),\n });\n await requestState.setValue(duplicateRequests, 'duplicateRequests');\n } else {\n const failingRequests = requestState.getValue('failingRequests');\n failingRequests.push({\n ...requestInput,\n rowIndex: ind,\n error: clientError || msg,\n attemptedAt: new Date().toISOString(),\n });\n await requestState.setValue(failingRequests, 'failingRequests');\n if (debug) {\n logger.error(colors.red(clientError || msg));\n logger.error(\n colors.red(\n `[${ind + 1}/${\n requestInputs.length\n }] Failed to submit request for: \"${requestLogId}\"`,\n ),\n );\n }\n }\n }\n\n total += 1;\n if (!debug) {\n progressBar.update(total);\n }\n },\n {\n concurrency,\n },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n // Log completion time\n logger.info(colors.green(`Completed upload in \"${totalTime / 1000}\" seconds.`));\n\n // Log duplicates\n if (requestState.getValue('duplicateRequests').length > 0) {\n logger.info(\n colors.yellow(\n `Encountered \"${requestState.getValue('duplicateRequests').length}\" duplicate requests. ` +\n `See \"${requestCacheFile}\" to review the core identifiers for these requests.`,\n ),\n );\n }\n\n // Log errors\n if (requestState.getValue('failingRequests').length > 0) {\n logger.error(\n colors.red(\n `Encountered \"${requestState.getValue('failingRequests').length}\" errors. ` +\n `See \"${requestCacheFile}\" to review the error messages and inputs.`,\n ),\n );\n process.exit(1);\n }\n}\n/* eslint-enable max-lines */\n"],"mappings":"kzCAcA,eAAsB,EACpB,EACA,EACA,EACoC,CACpC,EAAS,eAAe,eAAgB,EAAmB,CAE3D,IAAM,EAAS,EAAU,IAAK,GAAS,GAAQ,UAAU,CAAC,OAAQ,GAAU,CAAC,EAAM,GAAO,CAC1F,GAAI,EAAO,SAAW,EACpB,OAAO,EAET,IAAM,EAAS,MAAM,EAAS,OAC5B,EAAO,IAAK,IAAW,CACrB,KAAM,EACN,QAAS,iBAAiB,IAC1B,KAAM,eACN,QAAS,EAAgB,KAAM,GAAM,EAAY,EAAO,EAAE,CAAC,CAC3D,QAAS,EAA2B,IACjC,EAEG,EAAgB,OAAQ,GAAM,OAAO,GAAM,UAAY,EAAY,EAAO,EAAE,CAAC,CAD7E,EAEP,EAAE,CACJ,CACD,MAAO,CACL,GAAG,EACH,GAAG,EAAM,EAAS,GAChB,OAAO,GAAM,SAAY,EAAgB,OAAO,OAAO,EAAE,CAAC,GAC3D,CACF,CChCH,SAAgB,EAAyB,EAAqB,EAA8B,CAC1F,OAAO,EAAK,EAAK,IAAK,GAAQ,EAAI,IA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,EAAE,GAAG,EAAc,OAAO,yCACrC,CACF,CAEH,IAAM,EAAoB,EAAa,SAAS,oBAAoB,CACpE,EAAkB,KAAK,CACrB,eAAgB,EAAa,eAC7B,SAAU,EACV,YAAa,IAAI,MAAM,CAAC,aAAa,CACtC,CAAC,CACF,MAAM,EAAa,SAAS,EAAmB,oBAAoB,KAC9D,CACL,IAAM,EAAkB,EAAa,SAAS,kBAAkB,CAChE,EAAgB,KAAK,CACnB,GAAG,EACH,SAAU,EACV,MAAO,GAAe,EACtB,YAAa,IAAI,MAAM,CAAC,aAAa,CACtC,CAAC,CACF,MAAM,EAAa,SAAS,EAAiB,kBAAkB,CAC3D,IACF,EAAO,MAAM,EAAO,IAAI,GAAe,EAAI,CAAC,CAC5C,EAAO,MACL,EAAO,IACL,IAAI,EAAM,EAAE,GACV,EAAc,OACf,mCAAmC,EAAa,GAClD,CACF,GAKP,GAAS,EACJ,GACH,EAAY,OAAO,EAAM,EAG7B,CACE,cACD,CACF,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAGvB,EAAO,KAAK,EAAO,MAAM,wBAAwB,EAAY,IAAK,YAAY,CAAC,CAG3E,EAAa,SAAS,oBAAoB,CAAC,OAAS,GACtD,EAAO,KACL,EAAO,OACL,gBAAgB,EAAa,SAAS,oBAAoB,CAAC,OAAO,6BACxD,EAAiB,sDAC5B,CACF,CAIC,EAAa,SAAS,kBAAkB,CAAC,OAAS,IACpD,EAAO,MACL,EAAO,IACL,gBAAgB,EAAa,SAAS,kBAAkB,CAAC,OAAO,iBACtD,EAAiB,4CAC5B,CACF,CACD,QAAQ,KAAK,EAAE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transcend-io/cli",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.16.0",
|
|
4
4
|
"description": "A command line interface for programmatic operations across Transcend.",
|
|
5
5
|
"homepage": "https://github.com/transcend-io/tools/tree/main/packages/cli",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -105,9 +105,9 @@
|
|
|
105
105
|
"yargs-parser": "^21.1.1",
|
|
106
106
|
"@transcend-io/airgap.js-types": "14.2.13",
|
|
107
107
|
"@transcend-io/internationalization": "4.1.1",
|
|
108
|
+
"@transcend-io/privacy-types": "5.4.0",
|
|
108
109
|
"@transcend-io/sdk": "1.2.11",
|
|
109
110
|
"@transcend-io/type-utils": "3.0.1",
|
|
110
|
-
"@transcend-io/privacy-types": "5.4.0",
|
|
111
111
|
"@transcend-io/utils": "0.1.3"
|
|
112
112
|
},
|
|
113
113
|
"devDependencies": {
|
package/dist/app-jtpjVOh5.mjs
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./enums-CyFTrzXY.mjs";import{g as n,h as r,m as i,u as a}from"./constants-Co8rkELu.mjs";import{a as o,n as s,r as c,t as l}from"./parsers-Bl90Wjbz.mjs";import{a as u,i as d,o as f,r as p,s as m}from"./command-BDVLuBwL.mjs";import{t as h}from"./buildExamples-tZJof83F.mjs";import{buildApplication as g,buildCommand as _,buildRouteMap as v,numberParser as y}from"@stricli/core";import{buildInstallCommand as b,buildUninstallCommand as x}from"@stricli/auto-complete";import{ConsentBundleType as S,ConsentTrackerStatus as C,DataCategoryType as w,RequestAction as T,RequestDataSiloStatus as E,RequestEnricherStatus as D,RequestOrigin as O,RequestStatus as k,ScopeName as A,UnstructuredSubDataPointRecommendationStatus as j}from"@transcend-io/privacy-types";const M=_({loader:async()=>{let{chunkCsv:e}=await import(`./impl-BWt2WOj4.mjs`);return e},parameters:{flags:{directory:{kind:`parsed`,parse:String,brief:`Directory containing CSV files to split (required)`},outputDir:{kind:`parsed`,parse:String,brief:`Directory to write chunk files (defaults to each input file's directory)`,optional:!0},clearOutputDir:{kind:`boolean`,brief:`Clear the output directory before writing chunks`,default:!0},chunkSizeMB:{kind:`parsed`,parse:e=>{let t=Number(e);if(!Number.isFinite(t)||t<=0)throw Error(`chunkSizeMB must be a positive number`);return t},brief:`Approximate chunk size in megabytes. Keep well under JS string size limits`,default:`10`},concurrency:{kind:`parsed`,parse:e=>Math.max(1,Number(e)||0),brief:`Max number of worker processes (defaults based on CPU and file count)`,optional:!0},viewerMode:{kind:`boolean`,brief:`Run in non-interactive viewer mode (no attach UI, auto-artifacts)`,default:!1}}},docs:{brief:`Chunk all CSVs in a directory into smaller CSV files`,fullDescription:`Streams every CSV in --directory and writes chunked files of approximately N MB each.
|
|
2
|
-
- Runs files in parallel across worker processes (configurable via --concurrency).
|
|
3
|
-
- Validates row-length consistency against the header row; logs periodic progress and memory usage.`}}),N=_({loader:async()=>{let{findTextInFolder:e}=await import(`./impl-Df_SZy5X.mjs`);return e},parameters:{flags:{needle:{kind:`parsed`,parse:String,brief:`The text string to search for (case-insensitive)`},root:{kind:`parsed`,parse:String,brief:`Root directory to search`,default:`.`},exts:{kind:`parsed`,parse:String,brief:`Comma-separated file extensions to search (without leading dots)`,default:`csv,json,txt,ndjson,log`},noParquet:{kind:`boolean`,brief:`Skip parquet file scanning (requires duckdb on PATH)`,default:!1},concurrency:{kind:`parsed`,parse:e=>{let t=Number(e);if(!Number.isFinite(t)||t<=0)throw Error(`concurrency must be a positive number`);return t},brief:`Max number of files to scan concurrently`,default:`16`},maxBytes:{kind:`parsed`,parse:e=>{let t=Number(e);if(!Number.isFinite(t)||t<=0)throw Error(`maxBytes must be a positive number`);return t},brief:`Stop scanning each file after this many bytes (useful for huge files)`,optional:!0}}},docs:{brief:`Find a needle in a haystack — search many large files in a folder for a text match`,fullDescription:`Searches a folder of files for a given text string (case-insensitive).
|
|
4
|
-
|
|
5
|
-
Useful for finding a needle in a haystack when you have many large files
|
|
6
|
-
(e.g. multi-GB CSV exports, JSON dumps, log archives) and need to know
|
|
7
|
-
which ones contain a specific value like an email address, ID, or keyword.
|
|
8
|
-
|
|
9
|
-
Files are streamed so memory stays flat even for very large inputs.
|
|
10
|
-
Concurrency is configurable and files are scanned in parallel.
|
|
11
|
-
|
|
12
|
-
Supported file types:
|
|
13
|
-
- Text-based files (csv, json, txt, ndjson, log, etc.) are scanned via streaming byte comparison.
|
|
14
|
-
- Parquet files are scanned via DuckDB (must be on PATH unless --noParquet is set).
|
|
15
|
-
|
|
16
|
-
Outputs one matching file path per line to stdout as hits are found.`}}),P=v({routes:{"generate-api-keys":_({loader:async()=>{let{generateApiKeys:e}=await import(`./impl-Cih-nyPz.mjs`);return e},parameters:{flags:{email:{kind:`parsed`,parse:String,brief:`The email address that you use to log into Transcend`},password:{kind:`parsed`,parse:String,brief:`The password for your account login`},apiKeyTitle:{kind:`parsed`,parse:String,brief:`The title of the API key being generated or destroyed`},file:{kind:`parsed`,parse:String,brief:`The file where API keys should be written to`},scopes:{kind:`enum`,values:a,variadic:`,`,brief:`The list of scopes that should be given to the API key`},deleteExistingApiKey:{kind:`boolean`,brief:`When true, if an API key exists with the specified apiKeyTitle, the existing API key is deleted`,default:!0},createNewApiKey:{kind:`boolean`,brief:`When true, new API keys will be created. Set to false if you simply want to delete all API keys with a title`,default:!0},parentOrganizationId:{kind:`parsed`,parse:o,brief:`Filter for only a specific organization by ID, returning all child accounts associated with that organization`,optional:!0},transcendUrl:m()}},docs:{brief:`Generate API keys`,fullDescription:`This command allows for creating API keys across multiple Transcend instances. This is useful for customers that are managing many Transcend instances and need to regularly create, cycle or delete API keys across all of their instances.
|
|
17
|
-
|
|
18
|
-
Unlike the other commands that rely on API key authentication, this command relies upon username/password authentication. This command will spit out the API keys into a JSON file, and that JSON file can be used in subsequent CLI commands.
|
|
19
|
-
|
|
20
|
-
Authentication requires your email and password for the Transcend account. This command will only generate API keys for Transcend instances where you have the permission to "Manage API Keys".`}}),"chunk-csv":M,"find-text-in-folder":N,"parquet-to-csv":_({loader:async()=>{let{parquetToCsv:e}=await import(`./impl-BxJcoWPI.mjs`);return e},parameters:{flags:{directory:{kind:`parsed`,parse:String,brief:`Directory containing Parquet files to convert (required)`},outputDir:{kind:`parsed`,parse:String,brief:`Directory to write CSV files (defaults to each input file's directory)`,optional:!0},clearOutputDir:{kind:`boolean`,brief:`Clear the output directory before writing CSVs`,default:!0},concurrency:{kind:`parsed`,parse:e=>Math.max(1,Number(e)||0),brief:`Max number of worker processes (defaults based on CPU and file count)`,optional:!0},viewerMode:{kind:`boolean`,brief:`Run in non-interactive viewer mode (no attach UI, auto-artifacts)`,default:!1}}},docs:{brief:`Convert all Parquet files in a directory to CSV`,fullDescription:`Streams every .parquet in --directory and writes CSV output files
|
|
21
|
-
- Runs files in parallel across worker processes (configurable via --concurrency).
|
|
22
|
-
- Validates row consistency; logs periodic progress and memory usage.
|
|
23
|
-
|
|
24
|
-
This is a useful administrative tool for converting Parquet exports to CSV for the purposes
|
|
25
|
-
of uploading DSRs or Consent Preferences. e.g. transcend consent upload-preferences ...`}})},docs:{brief:`Admin commands`}}),F=_({loader:async()=>{let{buildXdiSyncEndpoint:e}=await import(`./impl-DasdQVVL.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ViewConsentManager]}),xdiLocation:{kind:`parsed`,parse:String,brief:`The location of the XDI that will be loaded by the generated sync endpoint`},file:{kind:`parsed`,parse:String,brief:`The HTML file path where the sync endpoint should be written`,default:`./sync-endpoint.html`},removeIpAddresses:{kind:`boolean`,brief:`When true, remove IP addresses from the domain list`,default:!0},domainBlockList:{kind:`parsed`,parse:l,brief:`The set of domains that should be excluded from the sync endpoint. Comma-separated list.`,default:`localhost`},xdiAllowedCommands:{kind:`parsed`,parse:String,brief:`The allowed set of XDI commands`,default:`ConsentManager:Sync`},transcendUrl:m()}},docs:{brief:`Build XDI sync endpoint`,fullDescription:`This command allows for building of the XDI Sync Endpoint across a set of Transcend accounts.`}}),I=_({loader:async()=>{let{deletePreferenceRecords:e}=await import(`./impl-B5TsrlQT.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ManageStoredPreferences]}),sombraAuth:f(),partition:{kind:`parsed`,parse:String,brief:`Partition ID to used to delete preference records from`},timestamp:{kind:`parsed`,parse:s,brief:`The timestamp when the deletion operation is made. Used for logging purposes.`},file:{kind:`parsed`,parse:String,optional:!0,brief:`Path to the CSV file used to identify preference records to delete`},directory:{kind:`parsed`,parse:String,brief:`Path to the directory of CSV files to load preferences from`,optional:!0},transcendUrl:m(),maxItemsInChunk:{kind:`parsed`,parse:y,brief:`When chunking, how many items to delete in a single chunk (higher = faster, but more load).`,default:`10`},maxConcurrency:{kind:`parsed`,parse:y,brief:`Number of concurrent requests to make when deleting preference records. (Higher = faster, but more load and rate limiting errors).`,default:`10`},fileConcurrency:{kind:`parsed`,parse:y,brief:`Number of files to process concurrently when deleting preference records from multiple files.`,default:`5`},receiptDirectory:{kind:`parsed`,parse:String,brief:`Directory to write receipts of failed deletions to.`,default:`./receipts`}}},docs:{brief:`Delete consent preference records in bulk from Preference Store`,fullDescription:`Uses POST /v1/preferences/{partition}/delete route on sombra to delete consent preference records in bulk from Preference Store based on a CSV file input. Refer to examples/cli-upload-preferences-example.csv for the expected format of the CSV file. The CSV expects the following headers: "name" and "value". The "name" field corresponds to the identifier name as defined on https://app.transcend.io/privacy-requests/identifiers The "value" refers to the actual identifier value for the user whose preference record is being deleted. For Large scale deletions, consider chunking the input CSV into smaller files and using the --directory option to process them concurrently.`}}),ee=v({routes:{"build-xdi-sync-endpoint":F,"generate-access-tokens":_({loader:async()=>{let{generateAccessTokens:e}=await import(`./impl-vHEzhNyX.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.GeneratePreferenceAccessTokens]}),file:{kind:`parsed`,parse:String,brief:`Path to the CSV file containing user identifiers to generate access tokens for`},subjectType:{kind:`parsed`,parse:String,brief:`Slug for the data subject that the user will be logged in as on the Privacy Center. e.g. "customer" or "employee"`},emailColumnName:{kind:`parsed`,parse:String,brief:`Name of the column in the CSV that contains user email addresses`,default:`email`},coreIdentifierColumnName:{kind:`parsed`,parse:String,optional:!0,brief:`Name of the column in the CSV that contains user core identifiers`},duration:{kind:`parsed`,parse:c,brief:'How long the access tokens should be valid. Accepts human-friendly values like "2 days", "10h", "90 minutes". A bare number is interpreted as seconds (e.g., "300" = 5 minutes). Powered by the `ms` library: https://github.com/vercel/ms',default:`1y`},transcendUrl:m()}},docs:{brief:`Generate access tokens`,fullDescription:`This command allows for the generation of access tokens for users specified in a CSV file.`}}),"pull-consent-metrics":_({loader:async()=>{let{pullConsentMetrics:e}=await import(`./impl-BcP6NXxv.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ViewConsentManager]}),start:{kind:`parsed`,parse:s,brief:`The start date to pull metrics from`},end:{kind:`parsed`,parse:s,brief:`The end date to pull metrics until`,optional:!0},folder:{kind:`parsed`,parse:String,brief:`The folder to save metrics to`,default:`./consent-metrics/`},bin:{kind:`parsed`,parse:String,brief:`The bin metric when pulling data (1h or 1d)`,default:`1d`},transcendUrl:m()}},docs:{brief:`Pull consent metrics`,fullDescription:"This command allows for pulling consent manager metrics for a Transcend account, or a set of Transcend accounts.\n\nBy default, the consent metrics will be written to a folder named `consent-metrics` within the directory where you run the command. You can override the location that these CSVs are written to using the flag `--folder=./my-folder/`. This folder will contain a set of CSV files:\n\n- `CONSENT_CHANGES_TIMESERIES_optIn.csv` -> this is a feed containing the number of explicit opt in events that happen - these are calls to `airgap.setConsent(event, { SaleOfInfo: true });`\n- `CONSENT_CHANGES_TIMESERIES_optOut.csv` -> this is a feed containing the number of explicit opt out events that happen - these are calls to `airgap.setConsent(event, { SaleOfInfo: false });`\n- `CONSENT_SESSIONS_BY_REGIME_Default.csv` -> this contains the number of sessions detected for the bin period\n- `PRIVACY_SIGNAL_TIMESERIES_DNT.csv` -> the number of DNT signals detected.\n- `PRIVACY_SIGNAL_TIMESERIES_GPC.csv` -> the number of GPC signals detected."}}),"pull-consent-preferences":_({loader:async()=>{let{pullConsentPreferences:e}=await import(`./impl-COmkhA32.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ViewManagedConsentDatabaseAdminApi,A.ViewRequestIdentitySettings,A.ViewPreferenceStoreSettings]}),partition:{kind:`parsed`,parse:String,brief:`Partition ID to query in the Preference Store`},sombraAuth:f(),file:{kind:`parsed`,parse:String,brief:`Path to CSV output file`,default:`./preferences.csv`},transcendUrl:m(),timestampBefore:{kind:`parsed`,parse:s,brief:`Filter: preferences collected before this time (timestampBefore)`,optional:!0},timestampAfter:{kind:`parsed`,parse:s,brief:`Filter: preferences collected after this time (timestampAfter)`,optional:!0},updatedBefore:{kind:`parsed`,parse:s,brief:`Filter: preferences updated before this time (system.updatedAt)`,optional:!0},updatedAfter:{kind:`parsed`,parse:s,brief:`Filter: preferences updated after this time (system.updatedAt)`,optional:!0},identifiers:{kind:`parsed`,parse:String,variadic:`,`,brief:`Filter specific users by identifier(s) as "name:value". If name is omitted, defaults to "email". Multiple values separated by commas.`,optional:!0},concurrency:{kind:`parsed`,parse:y,brief:`Page size / concurrency used when downloading (1–50 per API). Higher = fewer pages.`,default:`50`},shouldChunk:{kind:`boolean`,brief:`Whether to download requests in timestamp window chunks.`,default:!0},exportIdentifiersWithDelimiter:{kind:`parsed`,parse:String,brief:`Delimiter to use when combining multiple identifiers into a single column in the output CSV.`,default:`,`},windowConcurrency:{kind:`parsed`,parse:y,brief:`When chunking, how many windows to download in parallel (higher = faster, but more load).`,default:`80`},maxChunks:{kind:`parsed`,parse:y,brief:`Maximum number of chunks to download (higher = more data, but more load).`,default:`20000`},maxLookbackDays:{kind:`parsed`,parse:y,brief:`Maximum lookback period in days for fetching consent preferences.`,default:`3650`}}},docs:{brief:`Pull consent preferences from the Managed Consent Database`,fullDescription:`Uses POST /v1/preferences/{partition}/query with cursor-based pagination. Supports filtering by identifiers, collection timestamps, and system.updatedAt.`}}),"update-consent-manager":_({loader:async()=>{let{updateConsentManager:e}=await import(`./impl-DOp0z0s3.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ManageConsentManagerDeveloperSettings]}),bundleTypes:{kind:`enum`,values:Object.values(S),brief:`The bundle types to deploy. Defaults to PRODUCTION,TEST.`,variadic:`,`},deploy:{kind:`boolean`,brief:`When true, deploy the Consent Manager after updating the version`,default:!1},transcendUrl:m()}},docs:{brief:`Update consent manager`,fullDescription:`This command allows for updating Consent Manager to latest version. The Consent Manager bundle can also be deployed using this command.`}}),"upload-consent-preferences":_({loader:async()=>{let{uploadConsentPreferences:e}=await import(`./impl-BcirxaFO.mjs`);return e},parameters:{flags:{base64EncryptionKey:{kind:`parsed`,parse:String,brief:`The encryption key used to encrypt the userId`},base64SigningKey:{kind:`parsed`,parse:String,brief:`The signing key used to prove authentication of consent request`},partition:{kind:`parsed`,parse:String,brief:`The partition key to download consent preferences to`},file:{kind:`parsed`,parse:String,brief:`The file to pull consent preferences from`,default:`./preferences.csv`},consentUrl:u(),concurrency:{kind:`parsed`,parse:y,brief:`The concurrency to use when uploading requests in parallel`,default:`100`}}},docs:{brief:`Upload consent preferences to the Managed Consent Database`,fullDescription:`This command allows for updating of consent preferences to the Managed Consent Database.`}}),"upload-cookies-from-csv":_({loader:async()=>{let{uploadCookiesFromCsv:e}=await import(`./impl-DtVfOZhs.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ManageDataFlow]}),trackerStatus:{kind:`enum`,values:Object.values(C),brief:`The status of the cookies you will upload.`},file:{kind:`parsed`,parse:String,brief:`Path to the CSV file to upload`,default:`./cookies.csv`},transcendUrl:m()}},docs:{brief:`Upload cookies from CSV`,fullDescription:`Upload cookies from CSV. This command allows for uploading of cookies from CSV.
|
|
26
|
-
|
|
27
|
-
Step 1) Download the CSV of cookies that you want to edit from the Admin Dashboard under [Consent Management -> Cookies](https://app.transcend.io/consent-manager/cookies). You can download cookies from both the "Triage" and "Approved" tabs.
|
|
28
|
-
|
|
29
|
-
Step 2) You can edit the contents of the CSV file as needed. You may adjust the "Purpose" column, adjust the "Notes" column, add "Owners" and "Teams" or even add custom columns with additional metadata.
|
|
30
|
-
|
|
31
|
-
Step 3) Upload the modified CSV file back into the dashboard with this command.`}}),"upload-data-flows-from-csv":_({loader:async()=>{let{uploadDataFlowsFromCsv:e}=await import(`./impl-kyicyfTy.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ManageDataFlow]}),trackerStatus:{kind:`enum`,values:Object.values(C),brief:`The status of the data flows you will upload.`},file:{kind:`parsed`,parse:String,brief:`Path to the CSV file to upload`,default:`./data-flows.csv`},classifyService:{kind:`boolean`,brief:`When true, automatically assign the service for a data flow based on the domain that is specified`,default:!1},transcendUrl:m()}},docs:{brief:`Upload data flows from CSV`,fullDescription:`Upload data flows from CSV. This command allows for uploading of data flows from CSV.
|
|
32
|
-
|
|
33
|
-
Step 1) Download the CSV of data flows that you want to edit from the Admin Dashboard under [Consent Management -> Data Flows](https://app.transcend.io/consent-manager/data-flows). You can download data flows from both the "Triage" and "Approved" tabs.
|
|
34
|
-
|
|
35
|
-
Step 2) You can edit the contents of the CSV file as needed. You may adjust the "Purpose" column, adjust the "Notes" column, add "Owners" and "Teams" or even add custom columns with additional metadata.
|
|
36
|
-
|
|
37
|
-
Step 3) Upload the modified CSV file back into the dashboard with this command.`}}),"upload-preferences":_({loader:async()=>{let{uploadPreferences:e}=await import(`./impl-B0k-lsLh.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ManageStoredPreferences,A.ViewManagedConsentDatabaseAdminApi,A.ViewPreferenceStoreSettings]}),partition:{kind:`parsed`,parse:String,brief:`The partition key to download consent preferences to`},sombraAuth:f(),transcendUrl:m(),file:{kind:`parsed`,parse:String,brief:`Path to the CSV file to load preferences from`,optional:!0},directory:{kind:`parsed`,parse:String,brief:`Path to the directory of CSV files to load preferences from`,optional:!0},dryRun:{kind:`boolean`,brief:`Whether to do a dry run only - will write results to receiptFilepath without updating Transcend`,default:!1},skipExistingRecordCheck:{kind:`boolean`,brief:`Whether to skip the check for existing records. SHOULD ONLY BE USED FOR INITIAL UPLOAD`,default:!1},receiptFileDir:{kind:`parsed`,parse:String,brief:`Directory path where the response receipts should be saved`,default:`./receipts`},skipWorkflowTriggers:{kind:`boolean`,brief:`Whether to skip workflow triggers when uploading to preference store`,default:!1},forceTriggerWorkflows:{kind:`boolean`,brief:`Whether to force trigger workflows for existing consent records`,default:!1},skipConflictUpdates:{kind:`boolean`,brief:`Whether to skip uploading of any records where the preference store and file have a hard conflict`,default:!1},isSilent:{kind:`boolean`,brief:`Whether to skip sending emails in workflows`,default:!0},attributes:{kind:`parsed`,parse:String,brief:`Attributes to add to any DSR request if created. Comma-separated list of key:value pairs.`,default:`Tags:transcend-cli,Source:transcend-cli`},receiptFilepath:{kind:`parsed`,parse:String,brief:`Store resulting, continuing where left off`,default:`./preference-management-upload-receipts.json`},concurrency:{kind:`parsed`,parse:y,brief:`The concurrency to use when uploading in parallel`,default:`10`}}},docs:{brief:`Upload preference management data to your Preference Store`,fullDescription:`Upload preference management data to your Preference Store.
|
|
38
|
-
|
|
39
|
-
This command prompts you to map the shape of the CSV to the shape of the Transcend API. There is no requirement for the shape of the incoming CSV, as the script will handle the mapping process.
|
|
40
|
-
|
|
41
|
-
The script will also produce a JSON cache file that allows for the mappings to be preserved between runs.`}}),"delete-preference-records":I},docs:{brief:`Consent commands`}}),L=_({loader:async()=>{let{consentManagerServiceJsonToYml:e}=await import(`./impl-Dl-XNXfK.mjs`);return e},parameters:{flags:{file:{kind:`parsed`,parse:String,brief:`Path to the services.json file, output of await airgap.getMetadata()`,default:`./services.json`},output:{kind:`parsed`,parse:String,brief:`Path to the output transcend.yml to write to`,default:`./transcend.yml`}}},docs:{brief:`Convert consent manager services to transcend.yml`,fullDescription:`Import the services from an airgap.js file into a Transcend instance.
|
|
42
|
-
|
|
43
|
-
1. Run \`await airgap.getMetadata()\` on a site with airgap
|
|
44
|
-
2. Right click on the printed object, and click \`Copy object\`
|
|
45
|
-
3. Place output of file in a file named \`services.json\`
|
|
46
|
-
4. Run:
|
|
47
|
-
|
|
48
|
-
${h([`inventory`,`consent-manager-service-json-to-yml`],{file:`./services.json`,output:`./transcend.yml`},{argsIndent:5})}
|
|
49
|
-
|
|
50
|
-
5. Run:
|
|
51
|
-
|
|
52
|
-
${h([`inventory`,`push`],{auth:`$TRANSCEND_API_KEY`,file:`./transcend.yml`,classifyService:!0},{argsIndent:5})}`}}),R=_({loader:async()=>{let{consentManagersToBusinessEntities:e}=await import(`./impl-C0I8JaaR.mjs`);return e},parameters:{flags:{consentManagerYmlFolder:{kind:`parsed`,parse:String,brief:`Path to the folder of Consent Manager transcend.yml files to combine`},output:{kind:`parsed`,parse:String,brief:`Path to the output transcend.yml with business entity configuration`,default:`./combined-business-entities.yml`}}},docs:{brief:`Convert consent managers to business entities`,fullDescription:`This command allows for converting a folder or Consent Manager transcend.yml files into a single transcend.yml file where each consent manager configuration is a Business Entity in the data inventory.`}}),z=_({loader:async()=>{let{deriveDataSilosFromDataFlowsCrossInstance:e}=await import(`./impl-DK2Rai3F.mjs`);return e},parameters:{flags:{auth:d({scopes:[]}),dataFlowsYmlFolder:{kind:`parsed`,parse:String,brief:`The folder that contains data flow yml files`},output:{kind:`parsed`,parse:String,brief:`The output transcend.yml file containing the data silo configurations`,default:`./transcend.yml`},ignoreYmls:{kind:`parsed`,parse:String,variadic:`,`,brief:`The set of yml files that should be skipped when uploading`,optional:!0},transcendUrl:m()}},docs:{brief:`Derive data silos from data flows cross instance`,fullDescription:`Given a folder of data flow transcend.yml configurations, convert those configurations to a single transcend.yml configurations of all related data silos.`}}),B=_({loader:async()=>{let{deriveDataSilosFromDataFlows:e}=await import(`./impl-CsHfqKxU.mjs`);return e},parameters:{flags:{auth:d({scopes:[]}),dataFlowsYmlFolder:{kind:`parsed`,parse:String,brief:`The folder that contains data flow yml files`},dataSilosYmlFolder:{kind:`parsed`,parse:String,brief:`The folder that contains data silo yml files`},ignoreYmls:{kind:`parsed`,parse:String,variadic:`,`,brief:`The set of yml files that should be skipped when uploading`,optional:!0},transcendUrl:m()}},docs:{brief:`Derive data silos from data flows`,fullDescription:`Given a folder of data flow transcend.yml configurations, convert those configurations to set of data silo transcend.yml configurations.`}}),V=_({loader:async()=>{let{discoverSilos:e}=await import(`./impl-BQizHx-b.mjs`);return e},parameters:{flags:{scanPath:{kind:`parsed`,parse:String,brief:`File path in the project to scan`},dataSiloId:{kind:`parsed`,parse:o,brief:`The UUID of the corresponding data silo`},auth:d({scopes:[A.ManageAssignedDataInventory],requiresSiloScope:!0}),fileGlobs:{kind:`parsed`,parse:String,brief:`You can pass a glob syntax pattern(s) to specify additional file paths to scan. Comma-separated list of globs.`,default:``},ignoreDirs:{kind:`parsed`,parse:String,brief:`Comma-separated list of directories to ignore.`,default:``},transcendUrl:m()}},docs:{brief:`Scan dependency management files to discover new data silos.`,fullDescription:`We support scanning for new data silos in JavaScript, Python, Gradle, and CocoaPods projects.
|
|
53
|
-
|
|
54
|
-
To get started, add a data silo for the corresponding project type with the "silo discovery" plugin enabled. For example, if you want to scan a JavaScript project, add a package.json data silo. Then, specify the data silo ID in the "--dataSiloId" parameter.`}}),H=_({loader:async()=>{let{pullDatapoints:e}=await import(`./impl-TnRighiD.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ViewDataInventory]}),file:{kind:`parsed`,parse:String,brief:`The file to save datapoints to`,default:`./datapoints.csv`},transcendUrl:m(),dataSiloIds:{kind:`parsed`,parse:String,variadic:`,`,brief:`List of data silo IDs to filter by`,optional:!0},includeAttributes:{kind:`boolean`,brief:`Whether to include attributes in the output`,default:!1},includeGuessedCategories:{kind:`boolean`,brief:`Whether to include guessed categories in the output`,default:!1},parentCategories:{kind:`enum`,values:Object.values(w),brief:`List of parent categories to filter by`,variadic:`,`,optional:!0},subCategories:{kind:`parsed`,parse:String,brief:`List of subcategories to filter by`,variadic:`,`,optional:!0}}},docs:{brief:`Export the datapoints from your Data Inventory into a CSV.`}}),U=_({loader:async()=>{let{pullUnstructuredDiscoveryFiles:e}=await import(`./impl-B4GlGvLI.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ViewDataInventory]}),file:{kind:`parsed`,parse:String,brief:`The file to save datapoints to`,default:`./unstructured-discovery-files.csv`},transcendUrl:m(),dataSiloIds:{kind:`parsed`,parse:String,brief:`List of data silo IDs to filter by`,variadic:`,`,optional:!0},subCategories:{kind:`parsed`,parse:String,brief:`List of data categories to filter by`,variadic:`,`,optional:!0},status:{kind:`enum`,values:Object.values(j),brief:`List of classification statuses to filter by`,variadic:`,`,optional:!0},includeEncryptedSnippets:{kind:`boolean`,brief:`Whether to include encrypted snippets of the entries classified`,default:!1}}},docs:{brief:`Pull unstructured discovery files`,fullDescription:`This command allows for pulling Unstructured Discovery into a CSV.`}}),W=v({routes:{pull:p,push:_({loader:async()=>{let{push:e}=await import(`./impl-B4mrbkzO.mjs`);return e},parameters:{flags:{auth:d({scopes:`Varies`}),file:{kind:`parsed`,parse:String,brief:`Path to the YAML file to push from`,default:`./transcend.yml`},transcendUrl:m(),pageSize:{kind:`parsed`,parse:y,brief:`The page size to use when paginating over the API`,default:`50`},variables:{kind:`parsed`,parse:String,brief:`The variables to template into the YAML file when pushing configuration. Comma-separated list of key:value pairs.`,default:``},publishToPrivacyCenter:{kind:`boolean`,brief:`When true, publish the configuration to the Privacy Center`,default:!1},classifyService:{kind:`boolean`,brief:`When true, automatically assign the service for a data flow based on the domain that is specified`,default:!1},deleteExtraAttributeValues:{kind:`boolean`,brief:`When true and syncing attributes, delete any extra attributes instead of just upserting`,default:!1}}},docs:{brief:`Push metadata from transcend.yml to Transcend`,fullDescription:`Given a transcend.yml file, sync the contents up to your Transcend instance.`}}),"scan-packages":_({loader:async()=>{let{scanPackages:e}=await import(`./impl-C9RGUYAT.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ManageCodeScanning]}),scanPath:{kind:`parsed`,parse:String,brief:`File path in the project to scan`,default:`./`},ignoreDirs:{kind:`parsed`,parse:String,variadic:`,`,brief:`List of directories to ignore in scan`,optional:!0},repositoryName:{kind:`parsed`,parse:String,brief:`Name of the git repository that the package should be tied to`,optional:!0},transcendUrl:m()}},docs:{brief:`Scan dependency management files to inventory code dependencies.`,fullDescription:`Transcend scans packages and dependencies for the following frameworks:
|
|
55
|
-
|
|
56
|
-
- package.json
|
|
57
|
-
- requirements.txt & setup.py
|
|
58
|
-
- Podfile
|
|
59
|
-
- Package.resolved
|
|
60
|
-
- build.gradle
|
|
61
|
-
- pubspec.yaml
|
|
62
|
-
- Gemfile & .gemspec
|
|
63
|
-
- composer.json
|
|
64
|
-
|
|
65
|
-
This command will scan the folder you point at to look for any of these files. Once found, the build file will be parsed in search of dependencies. Those code packages and dependencies will be uploaded to Transcend. The information uploaded to Transcend is:
|
|
66
|
-
|
|
67
|
-
- repository name
|
|
68
|
-
- package names
|
|
69
|
-
- dependency names and versions
|
|
70
|
-
- package descriptions`}}),"discover-silos":V,"pull-datapoints":H,"pull-unstructured-discovery-files":U,"derive-data-silos-from-data-flows":B,"derive-data-silos-from-data-flows-cross-instance":z,"consent-manager-service-json-to-yml":L,"consent-managers-to-business-entities":R},docs:{brief:`Inventory commands`}}),G=v({routes:{"sync-ot":_({loader:async()=>{let{syncOt:e}=await import(`./impl-CRSNjo07.mjs`);return e},parameters:{flags:{hostname:{kind:`parsed`,parse:String,brief:`The domain of the OneTrust environment from which to pull the resource`,optional:!0},oneTrustAuth:{kind:`parsed`,parse:String,brief:`The OAuth access token with the scopes necessary to access the OneTrust Public APIs`,optional:!0},source:{kind:`enum`,values:Object.values(t),brief:`Whether to read the assessments from OneTrust or from a file`,default:`oneTrust`},transcendAuth:{...d({scopes:[A.ManageAssessments]}),optional:!0},transcendUrl:m(),file:{kind:`parsed`,parse:String,brief:`Path to the file to pull the resource into. Must be a json file!`,optional:!0},resource:{kind:`enum`,values:Object.values(e),brief:`The resource to pull from OneTrust. For now, only assessments is supported`,default:`assessments`},dryRun:{kind:`boolean`,brief:`Whether to export the resource to a file rather than sync to Transcend`,default:!1},debug:{kind:`boolean`,brief:`Whether to print detailed logs in case of error`,default:!1}}},docs:{brief:`Sync OneTrust data`,fullDescription:`Pulls resources from a OneTrust and syncs them to a Transcend instance. For now, it only supports retrieving OneTrust Assessments.
|
|
71
|
-
|
|
72
|
-
This command can be helpful if you are looking to:
|
|
73
|
-
- Pull resources from your OneTrust account.
|
|
74
|
-
- Migrate your resources from your OneTrust account to Transcend.
|
|
75
|
-
|
|
76
|
-
OneTrust authentication requires an OAuth Token with scope for accessing the assessment endpoints.
|
|
77
|
-
If syncing the resources to Transcend, you will also need to generate an API key on the Transcend Admin Dashboard.`}})},docs:{brief:`Migration commands`}}),K=v({routes:{activate:_({loader:async()=>{let{activate:e}=await import(`./impl-COWe0KAi.mjs`);return e},parameters:{flags:{version:{kind:`parsed`,parse:String,brief:`Caller-supplied version label to activate; defaults to the latest uploaded version by createdAt`,optional:!0},policyBundleId:{kind:`parsed`,parse:o,brief:`Parent policy bundle UUID`,optional:!0},bundleName:{kind:`parsed`,parse:String,brief:`Parent bundle name (used when policyBundleId is omitted)`,optional:!0},auth:d({scopes:[A.ActivatePolicyEngineBundles]}),transcendUrl:m(),dryRun:{kind:`boolean`,brief:`Validate activation without flipping the active version`,default:!1},json:{kind:`boolean`,brief:`Print the raw JSON API response`,default:!1}}},docs:{brief:`Activate an uploaded policy bundle version`,fullDescription:`Calls the Policy Engine activate endpoint to make an uploaded version live. Requires the parent bundle UUID or bundle name. When --version is omitted, activates the latest uploaded version by createdAt. Requires a Transcend API key with Activate Policy scope.`}}),eval:_({loader:async()=>{let{_eval:e}=await import(`./impl-DQdzYE12.mjs`);return e},parameters:{flags:{pkg:{kind:`parsed`,parse:String,brief:`OPA package or query to evaluate (e.g. data.transcend.decision)`},input:{kind:`parsed`,parse:String,brief:`Path to a JSON envelope input file`},bundle:{kind:`parsed`,parse:String,brief:`Optional local policy bundle directory`,optional:!0}}},docs:{brief:`Evaluate one envelope against a local policy bundle`,fullDescription:"Wraps `opa eval` for local policy debugging. Requires the `opa` CLI on PATH. No Transcend API key is needed."}}),lint:_({loader:async()=>{let{lint:e}=await import(`./impl-bzESF0CN.mjs`);return e},parameters:{flags:{dir:{kind:`parsed`,parse:String,brief:`Directory containing Rego policy files`}}},docs:{brief:`Lint and optionally format a local policy bundle`,fullDescription:"Runs `opa check --strict` for Rego validation and `opa fmt` for formatting. When files are not formatted, lists the affected paths, prints a diff, and prompts to format them in place. Requires the `opa` CLI on PATH. No Transcend API key is needed."}}),list:_({loader:async()=>{let{list:e}=await import(`./impl-WYYi6kC-.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ViewPolicyEngineBundles]}),transcendUrl:m(),limit:{kind:`parsed`,parse:e=>{let t=Number(e);if(!Number.isFinite(t)||t<=0)throw Error(`limit must be a positive number`);return t},brief:`Maximum number of bundles to return`,default:`50`},offset:{kind:`parsed`,parse:e=>{let t=Number(e);if(!Number.isFinite(t)||t<0)throw Error(`offset must be a non-negative number`);return t},brief:`Number of records to skip before returning results`,default:`0`},json:{kind:`boolean`,brief:`Print the raw JSON API response`,default:!1}}},docs:{brief:`List policy bundles for the current organization`,fullDescription:`Lists policy bundles registered for the authenticated organization. Requires a Transcend API key with View Policy scope.`}}),publish:_({loader:async()=>{let{publish:e}=await import(`./impl-DZ2ESN0W.mjs`);return e},parameters:{flags:{dir:{kind:`parsed`,parse:String,brief:`Directory containing manifest.json and Rego policy files`},bundleName:{kind:`parsed`,parse:String,brief:`Tenant-unique policy bundle name`},auth:d({scopes:[A.ManagePolicyEngineBundles]}),transcendUrl:m(),version:{kind:`parsed`,parse:String,brief:`Version label (defaults to {bundleName}-yyyy-mm-dd-hh-mm-ss)`,optional:!0},description:{kind:`parsed`,parse:String,brief:`Optional description for the uploaded version`,optional:!0},json:{kind:`boolean`,brief:`Print the raw JSON API response`,default:!1}}},docs:{brief:`Build and upload a new policy bundle version`,fullDescription:"Packages manifest.json and .rego policy files from a local directory into a tarball and uploads it to Transcend. Creates the bundle on first upload, then appends immutable versions. Requires the `opa` CLI on PATH (for `opa check` and `opa build` validation) and a Transcend API key with Manage Policy scope."}}),test:_({loader:async()=>{let{test:e}=await import(`./impl-pGIOCyRI.mjs`);return e},parameters:{flags:{dir:{kind:`parsed`,parse:String,brief:`Directory containing Rego policy files and tests`}}},docs:{brief:`Run OPA tests against a local policy bundle`,fullDescription:"Wraps `opa test` for a local policy directory. Requires the `opa` CLI on PATH. No Transcend API key is needed."}}),versions:_({loader:async()=>{let{versions:e}=await import(`./impl-QhkS8iHU.mjs`);return e},parameters:{flags:{bundleName:{kind:`parsed`,parse:String,brief:`Tenant-unique policy bundle name`},auth:d({scopes:[A.ViewPolicyEngineBundles]}),transcendUrl:m(),limit:{kind:`parsed`,parse:e=>{let t=Number(e);if(!Number.isFinite(t)||t<=0)throw Error(`limit must be a positive number`);return t},brief:`Maximum number of versions to return`,default:`50`},after:{kind:`parsed`,parse:String,brief:`Opaque cursor from a previous response pageInfo.endCursor`,optional:!0},json:{kind:`boolean`,brief:`Print the raw JSON API response`,default:!1}}},docs:{brief:`List versions for a policy bundle`,fullDescription:`Resolves a bundle name to its UUID and lists uploaded versions. Requires a Transcend API key with View Policy scope.`}})},docs:{brief:`Policy Engine commands`}}),q=_({loader:async()=>{let{approve:e}=await import(`./impl-CQ94Ys6i.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.RequestApproval,A.ViewRequests,A.ManageRequestCompilation]}),actions:{kind:`enum`,values:Object.values(T),variadic:`,`,brief:`The request actions to approve`},origins:{kind:`enum`,values:Object.values(O),variadic:`,`,brief:`The request origins to approve`,optional:!0},silentModeBefore:{kind:`parsed`,parse:s,brief:`Any requests made before this date should be marked as silent mode`,optional:!0},createdAtBefore:{kind:`parsed`,parse:s,brief:`Approve requests that were submitted before this time`,optional:!0},createdAtAfter:{kind:`parsed`,parse:s,brief:`Approve requests that were submitted after this time`,optional:!0},updatedAtBefore:{kind:`parsed`,parse:s,brief:`Approve requests that were last updated before this time`,optional:!0},updatedAtAfter:{kind:`parsed`,parse:s,brief:`Approve requests that were last updated after this time`,optional:!0},transcendUrl:m(),concurrency:{kind:`parsed`,parse:y,brief:`The concurrency to use when uploading requests in parallel`,default:`50`}}},docs:{brief:`Bulk approve a set of privacy requests`,fullDescription:`Bulk approve a set of privacy requests from the DSR Automation -> Incoming Requests tab.`}}),J=_({loader:async()=>{let{cancel:e}=await import(`./impl-cro4x_eG.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ViewRequests,A.RequestApproval]}),actions:{kind:`enum`,values:Object.values(T),variadic:`,`,brief:`The request actions to cancel`},statuses:{kind:`enum`,values:Object.values(k),variadic:`,`,brief:`The request statuses to cancel. Comma-separated list.`,optional:!0},requestIds:{kind:`parsed`,parse:String,variadic:`,`,brief:`Specify the specific request IDs to cancel`,optional:!0},silentModeBefore:{kind:`parsed`,parse:s,brief:`Any requests made before this date should be marked as silent mode for canceling to skip email sending`,optional:!0},createdAtBefore:{kind:`parsed`,parse:s,brief:`Cancel requests that were submitted before this time`,optional:!0},createdAtAfter:{kind:`parsed`,parse:s,brief:`Cancel requests that were submitted after this time`,optional:!0},updatedAtBefore:{kind:`parsed`,parse:s,brief:`Cancel requests that were last updated before this time`,optional:!0},updatedAtAfter:{kind:`parsed`,parse:s,brief:`Cancel requests that were last updated after this time`,optional:!0},cancellationTitle:{kind:`parsed`,parse:String,brief:`The title of the email template that should be sent to the requests upon cancelation`,default:`Request Canceled`},transcendUrl:m(),concurrency:{kind:`parsed`,parse:y,brief:`The concurrency to use when uploading requests in parallel`,default:`50`}}},docs:{brief:`Bulk cancel a set of privacy requests`,fullDescription:`Bulk cancel a set of privacy requests from the DSR Automation -> Incoming Requests tab.`}}),Y=_({loader:async()=>{let{markIdentifiersCompleted:e}=await import(`./impl-BmB5DH95.mjs`);return e},parameters:{flags:{auth:d({scopes:[],requiresSiloScope:!0}),dataSiloId:{kind:`parsed`,parse:o,brief:`The ID of the data silo to pull in`},file:{kind:`parsed`,parse:String,brief:`Path to the CSV file where identifiers will be written to`,default:`./cron-identifiers.csv`},transcendUrl:m(),sombraAuth:f()}},docs:{brief:`Mark identifiers as completed after processing.`,fullDescription:`This command takes the output of "${h([`request`,`cron`,`pull-identifiers`],{})}" and notifies Transcend that all of the requests in the CSV have been processed.
|
|
78
|
-
This is used in the workflow like:
|
|
79
|
-
|
|
80
|
-
1. Pull identifiers to CSV:
|
|
81
|
-
|
|
82
|
-
${h([`request`,`cron`,`pull-identifiers`],{auth:`$TRANSCEND_API_KEY`,dataSiloId:`70810f2e-cf90-43f6-9776-901a5950599f`,actions:[T.Erasure],file:`./outstanding-requests.csv`},{argsIndent:5})}
|
|
83
|
-
|
|
84
|
-
2. Run your process to operate on that CSV of requests.
|
|
85
|
-
|
|
86
|
-
3. Notify Transcend of completion
|
|
87
|
-
|
|
88
|
-
${h([`request`,`cron`,`mark-identifiers-completed`],{auth:`$TRANSCEND_API_KEY`,dataSiloId:`70810f2e-cf90-43f6-9776-901a5950599f`,file:`./outstanding-requests.csv`},{argsIndent:5})}
|
|
89
|
-
|
|
90
|
-
Read more at https://docs.transcend.io/docs/integrations/cron-job-integration.`}}),X=v({routes:{"pull-identifiers":_({loader:async()=>{let{pullIdentifiers:e}=await import(`./impl-DtjphdYd2.mjs`);return e},parameters:{flags:{auth:d({scopes:[],requiresSiloScope:!0}),dataSiloId:{kind:`parsed`,parse:o,brief:`The ID of the data silo to pull in`},actions:{kind:`enum`,values:Object.values(T),variadic:`,`,brief:`The request actions to restart`},file:{kind:`parsed`,parse:String,brief:`Path to the CSV file where identifiers will be written to`,default:`./cron-identifiers.csv`},transcendUrl:m(),sombraAuth:f(),pageLimit:{kind:`parsed`,parse:y,brief:`The page limit to use when pulling in pages of identifiers`,default:`100`},skipRequestCount:{kind:`boolean`,brief:`Whether to skip the count of all outstanding requests. This is required to render the progress bar, but can take a long time to run if you have a large number of outstanding requests to process. In that case, we recommend setting skipRequestCount=true so that you can still proceed with fetching the identifiers`,default:!1},chunkSize:{kind:`parsed`,parse:y,brief:`Maximum number of rows per CSV file. For large datasets, the output will be automatically split into multiple files to avoid file system size limits. Each file will contain at most this many rows`,default:`10000`}}},docs:{brief:`Pull identifiers of outstanding requests for a data silo to a CSV.`,fullDescription:`If you are using the cron job integration, you can run this command to pull the outstanding identifiers for the data silo to a CSV.
|
|
91
|
-
|
|
92
|
-
For large datasets, the output will be automatically split into multiple CSV files to avoid file system size limits. Use the --chunkSize parameter to control the maximum number of rows per file.
|
|
93
|
-
|
|
94
|
-
Read more at https://docs.transcend.io/docs/integrations/cron-job-integration.`}}),"pull-profiles":_({loader:async()=>{let{pullProfiles:e}=await import(`./impl-Cp_cXJgT2.mjs`);return e},parameters:{flags:{auth:d({scopes:[],requiresSiloScope:!0}),cronDataSiloId:{kind:`parsed`,parse:o,brief:`The ID of the cron data silo to pull in`},targetDataSiloId:{kind:`parsed`,parse:o,brief:`The ID of the target data silo to pull in`},actions:{kind:`enum`,values:Object.values(T),variadic:`,`,brief:`The request actions to restart`},file:{kind:`parsed`,parse:String,brief:`Path to the CSV file where identifiers will be written to`,default:`./cron-identifiers.csv`},fileTarget:{kind:`parsed`,parse:String,brief:`Path to the CSV file where identifiers will be written to`,default:`./cron-identifiers-target.csv`},transcendUrl:m(),sombraAuth:f(),pageLimit:{kind:`parsed`,parse:y,brief:`The page limit to use when pulling in pages of identifiers`,default:`100`},skipRequestCount:{kind:`boolean`,brief:`Whether to skip the count of all outstanding requests. This is required to render the progress bar, but can take a long time to run if you have a large number of outstanding requests to process. In that case, we recommend setting skipRequestCount=true so that you can still proceed with fetching the identifiers`,default:!1},chunkSize:{kind:`parsed`,parse:y,brief:`Maximum number of rows per CSV file. For large datasets, the output will be automatically split into multiple files to avoid file system size limits. Each file will contain at most this many rows`,default:`10000`}}},docs:{brief:`Pull profiles of outstanding requests for a data silo to a CSV.`,fullDescription:`If you are using the cron job integration, you can run this command to pull the outstanding profiles for the data silo to a CSV.
|
|
95
|
-
|
|
96
|
-
For large datasets, the output will be automatically split into multiple CSV files to avoid file system size limits. Use the --chunkSize parameter to control the maximum number of rows per file.
|
|
97
|
-
|
|
98
|
-
Read more at https://docs.transcend.io/docs/integrations/cron-job-integration.`}}),"mark-identifiers-completed":Y},docs:{brief:`Cron commands`,hideRoute:{"pull-profiles":!0}}}),Z=_({loader:async()=>{let{downloadFiles:e}=await import(`./impl-CnfqPqKR.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ViewRequestCompilation,A.ViewRequests,A.RequestApproval]}),sombraAuth:f(),concurrency:{kind:`parsed`,parse:y,brief:`The concurrency to use when downloading requests in parallel`,default:`10`},requestIds:{kind:`parsed`,parse:String,variadic:`,`,brief:`Specify the specific request IDs to download`,optional:!0},statuses:{kind:`enum`,values:Object.values(k),variadic:`,`,brief:`The request statuses to download. Comma-separated list. Defaults to APPROVING,DOWNLOADABLE.`,optional:!0},folderPath:{kind:`parsed`,parse:String,brief:`The folder to download files to`,default:`./dsr-files`},createdAtBefore:{kind:`parsed`,parse:s,brief:`Download requests that were submitted before this time`,optional:!0},createdAtAfter:{kind:`parsed`,parse:s,brief:`Download requests that were submitted after this time`,optional:!0},updatedAtBefore:{kind:`parsed`,parse:s,brief:`Download requests that were last updated before this time`,optional:!0},updatedAtAfter:{kind:`parsed`,parse:s,brief:`Download requests that were last updated after this time`,optional:!0},approveAfterDownload:{kind:`boolean`,brief:`If the request is in status=APPROVING, approve the request after its downloaded`,default:!1},transcendUrl:m()}},docs:{brief:`Download the files associated with a Data Subject Access Request (DSAR)`,fullDescription:`Download the files associated with a Data Subject Access Request (DSAR) from DSR Automation -> Incoming Requests tab.`}}),Q=_({loader:async()=>{let{enricherRestart:e}=await import(`./impl-DmsEZEkY2.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ManageRequestCompilation]}),enricherId:{kind:`parsed`,parse:String,brief:`The ID of the enricher to restart`},actions:{kind:`enum`,values:Object.values(T),variadic:`,`,brief:`The request action to restart`,optional:!0},requestEnricherStatuses:{kind:`enum`,values:Object.values(D),variadic:`,`,brief:`The request enricher statuses to restart`,optional:!0},transcendUrl:m(),concurrency:{kind:`parsed`,parse:y,brief:`The concurrency to use when uploading requests in parallel`,default:`15`},requestIds:{kind:`parsed`,parse:String,variadic:`,`,brief:`Specify the specific request IDs to restart`,optional:!0},createdAtBefore:{kind:`parsed`,parse:s,brief:`Restart requests that were submitted before this time`,optional:!0},createdAtAfter:{kind:`parsed`,parse:s,brief:`Restart requests that were submitted after this time`,optional:!0},updatedAtBefore:{kind:`parsed`,parse:s,brief:`Restart requests that were last updated before this time`,optional:!0},updatedAtAfter:{kind:`parsed`,parse:s,brief:`Restart requests that were last updated after this time`,optional:!0}}},docs:{brief:`Bulk restart a particular enricher across a series of DSRs`,fullDescription:`Bulk restart a particular enricher across a series of DSRs.
|
|
99
|
-
|
|
100
|
-
The API key needs the following scopes:
|
|
101
|
-
- Manage Request Compilation`}}),$=_({loader:async()=>{let{_export:e}=await import(`./impl-0WH9Y-7n2.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ViewRequests,A.ViewRequestCompilation]}),sombraAuth:f(),actions:{kind:`enum`,values:Object.values(T),variadic:`,`,brief:`The request actions to export`,optional:!0},statuses:{kind:`enum`,values:Object.values(k),variadic:`,`,brief:`The request statuses to export`,optional:!0},transcendUrl:m(),file:{kind:`parsed`,parse:String,brief:`Path to the CSV file where identifiers will be written to`,default:`./transcend-request-export.csv`},concurrency:{kind:`parsed`,parse:y,brief:`Number of parallel date-range chunks to split the query into. Requires both --createdAtAfter and --createdAtBefore to be set.`,default:`1`},skipRequestIdentifiers:{kind:`boolean`,brief:`Skip exporting request identifiers`,optional:!0},createdAtBefore:{kind:`parsed`,parse:s,brief:`Pull requests that were submitted before this time`,optional:!0},createdAtAfter:{kind:`parsed`,parse:s,brief:`Pull requests that were submitted after this time`,optional:!0},updatedAtBefore:{kind:`parsed`,parse:s,brief:`Pull requests that were last updated before this time`,optional:!0},updatedAtAfter:{kind:`parsed`,parse:s,brief:`Pull requests that were last updated after this time`,optional:!0},showTests:{kind:`boolean`,brief:`Filter for test requests or production requests - when not provided, pulls both`,optional:!0},pageLimit:{kind:`parsed`,parse:y,brief:`The page limit to use when pulling in pages of requests`,default:`100`}}},docs:{brief:`Export privacy requests and request identifiers to a CSV file`,fullDescription:`Export privacy requests and request identifiers to a CSV file.`}}),te=_({loader:async()=>{let{markSilent:e}=await import(`./impl-CPZSFIEn2.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ManageRequestCompilation]}),actions:{kind:`enum`,values:Object.values(T),variadic:`,`,brief:`The request actions to mark silent`},statuses:{kind:`enum`,values:Object.values(k),variadic:`,`,brief:`The request statuses to mark silent. Comma-separated list. Defaults to REQUEST_MADE,WAITING,ENRICHING,COMPILING,DELAYED,APPROVING,SECONDARY,SECONDARY_APPROVING.`,optional:!0},requestIds:{kind:`parsed`,parse:String,variadic:`,`,brief:`Specify the specific request IDs to mark silent`,optional:!0},createdAtBefore:{kind:`parsed`,parse:s,brief:`Mark silent requests that were submitted before this time`,optional:!0},createdAtAfter:{kind:`parsed`,parse:s,brief:`Mark silent requests that were submitted after this time`,optional:!0},updatedAtBefore:{kind:`parsed`,parse:s,brief:`Mark silent requests that were last updated before this time`,optional:!0},updatedAtAfter:{kind:`parsed`,parse:s,brief:`Mark silent requests that were last updated after this time`,optional:!0},transcendUrl:m(),concurrency:{kind:`parsed`,parse:y,brief:`The concurrency to use when uploading requests in parallel`,default:`50`}}},docs:{brief:`Bulk update a set of privacy requests to be in silent mode`,fullDescription:`Bulk update a set of privacy requests from the DSR Automation -> Incoming Requests tab to be in silent mode.`}}),ne=_({loader:async()=>{let{notifyAdditionalTime:e}=await import(`./impl-DctqoksW2.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ViewRequests,A.RequestApproval]}),createdAtBefore:{kind:`parsed`,parse:s,brief:`Notify requests that are open but submitted before this time`},createdAtAfter:{kind:`parsed`,parse:s,brief:`Notify requests that are open but submitted after this time`,optional:!0},updatedAtBefore:{kind:`parsed`,parse:s,brief:`Notify requests that were last updated before this time`,optional:!0},updatedAtAfter:{kind:`parsed`,parse:s,brief:`Notify requests that were last updated after this time`,optional:!0},actions:{kind:`enum`,values:Object.values(T),variadic:`,`,brief:`The request actions to notify`,optional:!0},daysLeft:{kind:`parsed`,parse:y,brief:`Only notify requests that have less than this number of days until they are considered expired`,default:`10`},days:{kind:`parsed`,parse:y,brief:`The number of days to adjust the expiration of the request to`,default:`45`},requestIds:{kind:`parsed`,parse:String,variadic:`,`,brief:`Specify the specific request IDs to notify`,optional:!0},emailTemplate:{kind:`parsed`,parse:String,brief:`The title of the email template that should be sent to the requests`,default:`Additional Time Needed`},transcendUrl:m(),concurrency:{kind:`parsed`,parse:y,brief:`The concurrency to use when uploading requests in parallel`,default:`50`}}},docs:{brief:`Bulk notify a set of privacy requests that more time is needed`,fullDescription:`Bulk notify a set of privacy requests from the DSR Automation -> Incoming Requests tab that more time is needed to complete the request. Note any request in silent mode will not be emailed.`}}),re=v({routes:{"pull-identifiers":_({loader:async()=>{let{pullIdentifiers:e}=await import(`./impl-CHA9Ioez2.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ViewRequests,A.ViewRequestCompilation]}),sombraAuth:f(),transcendUrl:m(),file:{kind:`parsed`,parse:String,brief:`Path to the CSV file where requests will be written to`,default:`./manual-enrichment-identifiers.csv`},actions:{kind:`enum`,values:Object.values(T),variadic:`,`,brief:`The request actions to pull for`,optional:!0},concurrency:{kind:`parsed`,parse:y,brief:`The concurrency to use when uploading requests in parallel`,default:`100`}}},docs:{brief:`Pull identifiers for manual enrichment`,fullDescription:`This command pulls down the set of privacy requests that are currently pending manual enrichment.
|
|
102
|
-
|
|
103
|
-
This is useful for the following workflow:
|
|
104
|
-
|
|
105
|
-
1. Pull identifiers to CSV:
|
|
106
|
-
|
|
107
|
-
${h([`request`,`preflight`,`pull-identifiers`],{file:`./enrichment-requests.csv`},{argsIndent:5})}
|
|
108
|
-
|
|
109
|
-
2. Fill out the CSV with additional identifiers
|
|
110
|
-
|
|
111
|
-
3. Push updated back to Transcend:
|
|
112
|
-
|
|
113
|
-
${h([`request`,`preflight`,`push-identifiers`],{file:`./enrichment-requests.csv`},{argsIndent:5})}`}}),"push-identifiers":_({loader:async()=>{let{pushIdentifiers:e}=await import(`./impl-8i-k9wal2.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ManageRequestIdentities,A.ManageRequestCompilation]}),enricherId:{kind:`parsed`,parse:o,brief:`The ID of the Request Enricher to upload to`},sombraAuth:f(),transcendUrl:m(),file:{kind:`parsed`,parse:String,brief:`Path to the CSV file where requests will be written to`,default:`./manual-enrichment-identifiers.csv`},markSilent:{kind:`boolean`,brief:`When true, set requests into silent mode before enriching`,default:!1},concurrency:{kind:`parsed`,parse:y,brief:`The concurrency to use when uploading requests in parallel`,default:`100`}}},docs:{brief:`Push identifiers for manual enrichment`,fullDescription:`This command push up a set of identifiers for a set of requests pending manual enrichment.
|
|
114
|
-
|
|
115
|
-
This is useful for the following workflow:
|
|
116
|
-
|
|
117
|
-
1. Pull identifiers to CSV:
|
|
118
|
-
|
|
119
|
-
${h([`request`,`preflight`,`pull-identifiers`],{file:`./enrichment-requests.csv`},{argsIndent:5})}
|
|
120
|
-
|
|
121
|
-
2. Fill out the CSV with additional identifiers
|
|
122
|
-
|
|
123
|
-
3. Push updated back to Transcend:
|
|
124
|
-
|
|
125
|
-
${h([`request`,`preflight`,`push-identifiers`],{file:`./enrichment-requests.csv`},{argsIndent:5})}`}})},docs:{brief:`Preflight commands`}}),ie=_({loader:async()=>{let{rejectUnverifiedIdentifiers:e}=await import(`./impl-CQcfrcc42.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ManageRequestCompilation]}),identifierNames:{kind:`parsed`,parse:String,variadic:`,`,brief:`The names of identifiers to clear out`},actions:{kind:`enum`,values:Object.values(T),variadic:`,`,brief:`The request action to restart`,optional:!0},transcendUrl:m()}},docs:{brief:`Bulk clear out any request identifiers that are unverified`,fullDescription:`Bulk clear out any request identifiers that are unverified.`}}),ae=_({loader:async()=>{let{restart:e}=await import(`./impl-DxziWqbj.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.MakeDataSubjectRequest,A.ViewRequestCompilation]}),actions:{kind:`enum`,values:Object.values(T),variadic:`,`,brief:`The request actions to restart`},statuses:{kind:`enum`,values:Object.values(k),variadic:`,`,brief:`The request statuses to restart`},transcendUrl:m(),requestReceiptFolder:{kind:`parsed`,parse:String,brief:`The path to the folder where receipts of each upload are stored`,default:`./privacy-request-upload-receipts`},sombraAuth:f(),concurrency:{kind:`parsed`,parse:y,brief:`The concurrency to use when uploading requests in parallel`,default:`15`},requestIds:{kind:`parsed`,parse:String,variadic:`,`,brief:`Specify the specific request IDs to restart`,optional:!0},emailIsVerified:{kind:`boolean`,brief:`Indicate whether the primary email address is verified. Set to false to send a verification email`,default:!0},createdAt:{kind:`parsed`,parse:s,brief:`Restart requests that were submitted before a specific date`,optional:!0},silentModeBefore:{kind:`parsed`,parse:s,brief:`Requests older than this date should be marked as silent mode`,optional:!0},createdAtBefore:{kind:`parsed`,parse:s,brief:`Restart requests that were submitted before this time`,optional:!0},createdAtAfter:{kind:`parsed`,parse:s,brief:`Restart requests that were submitted after this time`,optional:!0},updatedAtBefore:{kind:`parsed`,parse:s,brief:`Restart requests that were last updated before this time`,optional:!0},updatedAtAfter:{kind:`parsed`,parse:s,brief:`Restart requests that were last updated after this time`,optional:!0},sendEmailReceipt:{kind:`boolean`,brief:`Send email receipts to the restarted requests`,default:!1},copyIdentifiers:{kind:`boolean`,brief:`Copy over all enriched identifiers from the initial request`,default:!1},skipWaitingPeriod:{kind:`boolean`,brief:`Skip queued state of request and go straight to compiling`,default:!1}}},docs:{brief:`Bulk update a set of privacy requests based on a set of request filters`,fullDescription:`Bulk update a set of privacy requests based on a set of request filters.`}}),oe=_({loader:async()=>{let{skipPreflightJobs:e}=await import(`./impl-5pww5SHw.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ManageRequestCompilation]}),enricherIds:{kind:`parsed`,parse:String,variadic:`,`,brief:`The ID of the enrichers to skip privacy request jobs for`},transcendUrl:m()}},docs:{brief:`Skip preflight jobs`,fullDescription:`This command allows for bulk skipping preflight checks.`}}),se=v({routes:{"mark-request-data-silos-completed":_({loader:async()=>{let{markRequestDataSilosCompleted:e}=await import(`./impl-DpU2s1HR.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ManageRequestCompilation]}),dataSiloId:{kind:`parsed`,parse:o,brief:`The ID of the data silo to pull in`},file:{kind:`parsed`,parse:String,brief:`Path to the CSV file where identifiers will be written to. The CSV is expected to have 1 column named "Request Id".`,default:`./request-identifiers.csv`},transcendUrl:m()}},docs:{brief:`Mark request data silos as completed`,fullDescription:`This command takes in a CSV of Request IDs as well as a Data Silo ID and marks all associated privacy request jobs as completed.
|
|
126
|
-
This command is useful with the "Bulk Response" UI. The CSV is expected to have 1 column named "Request Id".`}}),"retry-request-data-silos":_({loader:async()=>{let{retryRequestDataSilos:e}=await import(`./impl-vLFKOFp6.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ManageRequestCompilation]}),dataSiloId:{kind:`parsed`,parse:o,brief:`The ID of the data silo to pull in`},actions:{kind:`enum`,values:Object.values(T),variadic:`,`,brief:`The request actions to restart`},transcendUrl:m()}},docs:{brief:`Retry request data silos`,fullDescription:`This command allows for bulk restarting a set of data silos jobs for open privacy requests. This is equivalent to clicking the "Wipe and Retry" button for a particular data silo across a set of privacy requests.`}}),"skip-request-data-silos":_({loader:async()=>{let{skipRequestDataSilos:e}=await import(`./impl-BM0EEvkt.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.ManageRequestCompilation]}),dataSiloId:{kind:`parsed`,parse:o,brief:`The ID of the data silo to skip privacy request jobs for`},transcendUrl:m(),statuses:{kind:`enum`,values:Object.values(k),variadic:`,`,brief:`The request statuses to skip`},status:{kind:`enum`,values:[E.Skipped,E.Resolved],brief:`The status to set the request data silo job to`,default:E.Skipped},actionTypes:{kind:`enum`,values:Object.values(T),variadic:`,`,brief:`Filter by request action types (e.g. ACCESS,ERASURE). Only request data silo jobs for these action types will be skipped.`,optional:!0}}},docs:{brief:`Skip request data silos`,fullDescription:`This command allows for bulk skipping all open privacy request jobs for a particular data silo. This command is useful if you want to disable a data silo and then clear out any active privacy requests that are still queued up for that data silo. Use --actionTypes to target specific data actions (e.g. only ERASURE jobs).`}})},docs:{brief:`System commands`}}),ce=g(v({routes:{request:v({routes:{approve:q,upload:_({loader:async()=>{let{upload:e}=await import(`./impl-CJIfMPOK.mjs`);return e},parameters:{flags:{auth:d({scopes:[A.MakeDataSubjectRequest,A.ViewRequestIdentitySettings,A.ViewGlobalAttributes]}),file:{kind:`parsed`,parse:String,brief:`Path to the CSV file of requests to upload`,default:`./requests.csv`},transcendUrl:m(),cacheFilepath:{kind:`parsed`,parse:String,brief:`The path to the JSON file encoding the metadata used to map the CSV shape to Transcend API`,default:`./transcend-privacy-requests-cache.json`},requestReceiptFolder:{kind:`parsed`,parse:String,brief:`The path to the folder where receipts of each upload are stored`,default:`./privacy-request-upload-receipts`},sombraAuth:f(),concurrency:{kind:`parsed`,parse:y,brief:`The concurrency to use when uploading requests in parallel`,default:`50`},attributes:{kind:`parsed`,parse:String,brief:`Tag all of the requests with the following attributes. Format: key1:value1;value2,key2:value3;value4`,default:`Tags:transcend-cli`},isTest:{kind:`boolean`,brief:`Flag whether the requests being uploaded are test requests or regular requests`,default:!1},isSilent:{kind:`boolean`,brief:`Flag whether the requests being uploaded should be submitted in silent mode`,default:!0},skipSendingReceipt:{kind:`boolean`,brief:`Flag whether to skip sending of the receipt email`,default:!1},emailIsVerified:{kind:`boolean`,brief:`Indicate whether the email address being uploaded is pre-verified. Set to false to send a verification email`,default:!0},skipFilterStep:{kind:`boolean`,brief:`When true, skip the interactive step to filter down the CSV`,default:!1},dryRun:{kind:`boolean`,brief:`When true, perform a dry run of the upload instead of calling the API to submit the requests`,default:!1},debug:{kind:`boolean`,brief:`Debug logging`,default:!1},defaultPhoneCountryCode:{kind:`parsed`,parse:String,brief:`When uploading phone numbers, if the phone number is missing a country code, assume this country code`,default:`1`}}},docs:{brief:`Upload a set of requests from a CSV`,fullDescription:`Upload a set of requests from a CSV.
|
|
127
|
-
|
|
128
|
-
This command prompts you to map the shape of the CSV to the shape of the Transcend API. There is no requirement for the shape of the incoming CSV, as the script will handle the mapping process.
|
|
129
|
-
|
|
130
|
-
The script will also produce a JSON cache file that allows for the mappings to be preserved between runs.`}}),"download-files":Z,cancel:J,restart:ae,"notify-additional-time":ne,"mark-silent":te,"enricher-restart":Q,"reject-unverified-identifiers":ie,export:$,"skip-preflight-jobs":oe,system:se,preflight:re,cron:X},docs:{brief:`All commands related to DSR requests`}}),consent:ee,inventory:W,admin:P,migration:G,policy:K,install:b(`@transcend-io/transcend`,{bash:`__@transcend-io/cli_bash_complete`}),uninstall:x(`@transcend-io/transcend`,{bash:!0})},docs:{brief:r,hideRoute:{install:!0,uninstall:!0}}}),{name:i,versionInfo:{currentVersion:n}});export{ce as t};
|
|
131
|
-
//# sourceMappingURL=app-jtpjVOh5.mjs.map
|