@transcend-io/cli 8.38.1 → 9.0.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/dist/api-keys-C7JLTDUZ.mjs +2 -0
- package/dist/api-keys-C7JLTDUZ.mjs.map +1 -0
- package/dist/app-Dti3qTxV.mjs +131 -0
- package/dist/app-Dti3qTxV.mjs.map +1 -0
- package/dist/bin/bash-complete.mjs +3 -0
- package/dist/bin/bash-complete.mjs.map +1 -0
- package/dist/bin/cli.mjs +3 -0
- package/dist/bin/cli.mjs.map +1 -0
- package/dist/bin/deprecated-command.mjs +5 -0
- package/dist/bin/deprecated-command.mjs.map +1 -0
- package/dist/buildAIIntegrationType-Bk0EbFKV.mjs +2 -0
- package/dist/buildAIIntegrationType-Bk0EbFKV.mjs.map +1 -0
- package/dist/code-scanning-3tLsE1W5.mjs +4 -0
- package/dist/code-scanning-3tLsE1W5.mjs.map +1 -0
- package/dist/codecs-TR6p48v3.mjs +2 -0
- package/dist/codecs-TR6p48v3.mjs.map +1 -0
- package/dist/command-BlHM1nCd.mjs +9 -0
- package/dist/command-BlHM1nCd.mjs.map +1 -0
- package/dist/consent-manager-BoaaMjRQ.mjs +12 -0
- package/dist/consent-manager-BoaaMjRQ.mjs.map +1 -0
- package/dist/constants-DdeeX81W.mjs +2 -0
- package/dist/constants-DdeeX81W.mjs.map +1 -0
- package/dist/context-bkKpii_t.mjs +2 -0
- package/dist/{context-_8xfl0dt.cjs.map → context-bkKpii_t.mjs.map} +1 -1
- package/dist/cron-DOicA1l8.mjs +2 -0
- package/dist/cron-DOicA1l8.mjs.map +1 -0
- package/dist/data-inventory-OeEcogPl.mjs +75 -0
- package/dist/data-inventory-OeEcogPl.mjs.map +1 -0
- package/dist/dataFlowsToDataSilos-RAhfPV0l.mjs +2 -0
- package/dist/dataFlowsToDataSilos-RAhfPV0l.mjs.map +1 -0
- package/dist/done-input-validation-CcZtaz03.mjs +2 -0
- package/dist/{done-input-validation-DGckEJ5a.cjs.map → done-input-validation-CcZtaz03.mjs.map} +1 -1
- package/dist/enums-CyFTrzXY.mjs +2 -0
- package/dist/{enums-BZulhPFa.cjs.map → enums-CyFTrzXY.mjs.map} +1 -1
- package/dist/impl--Ov8Om49.mjs +2 -0
- package/dist/impl--Ov8Om49.mjs.map +1 -0
- package/dist/impl-4BP7gY61.mjs +2 -0
- package/dist/impl-4BP7gY61.mjs.map +1 -0
- package/dist/impl-B0d5M861.mjs +2 -0
- package/dist/impl-B0d5M861.mjs.map +1 -0
- package/dist/impl-B40z0Aoz2.mjs +2 -0
- package/dist/impl-B40z0Aoz2.mjs.map +1 -0
- package/dist/impl-B8CoAX4t.mjs +2 -0
- package/dist/impl-B8CoAX4t.mjs.map +1 -0
- package/dist/impl-BDKBhSiG2.mjs +2 -0
- package/dist/impl-BDKBhSiG2.mjs.map +1 -0
- package/dist/impl-BEzyqD_12.mjs +2 -0
- package/dist/impl-BEzyqD_12.mjs.map +1 -0
- package/dist/impl-BI4zCNs0.mjs +2 -0
- package/dist/impl-BI4zCNs0.mjs.map +1 -0
- package/dist/impl-BJ9Ge6Wf2.mjs +2 -0
- package/dist/impl-BJ9Ge6Wf2.mjs.map +1 -0
- package/dist/impl-BPz3SpXo2.mjs +2 -0
- package/dist/impl-BPz3SpXo2.mjs.map +1 -0
- package/dist/impl-BYBNi68b.mjs +5 -0
- package/dist/impl-BYBNi68b.mjs.map +1 -0
- package/dist/impl-Bh04BLeU2.mjs +2 -0
- package/dist/impl-Bh04BLeU2.mjs.map +1 -0
- package/dist/impl-BhMd6_J22.mjs +2 -0
- package/dist/impl-BhMd6_J22.mjs.map +1 -0
- package/dist/impl-BiWrlucD.mjs +2 -0
- package/dist/impl-BiWrlucD.mjs.map +1 -0
- package/dist/impl-BpMKYqSR.mjs +2 -0
- package/dist/{impl-B8rg6CMv.cjs.map → impl-BpMKYqSR.mjs.map} +1 -1
- package/dist/impl-BraVBCrF2.mjs +4 -0
- package/dist/impl-BraVBCrF2.mjs.map +1 -0
- package/dist/impl-BvTvjK72.mjs +2 -0
- package/dist/impl-BvTvjK72.mjs.map +1 -0
- package/dist/impl-BvZai1Pf2.mjs +2 -0
- package/dist/impl-BvZai1Pf2.mjs.map +1 -0
- package/dist/impl-C73Uh2Ze.mjs +2 -0
- package/dist/impl-C73Uh2Ze.mjs.map +1 -0
- package/dist/impl-CIJ6P1GD.mjs +3 -0
- package/dist/impl-CIJ6P1GD.mjs.map +1 -0
- package/dist/impl-CNiEzL3_2.mjs +2 -0
- package/dist/impl-CNiEzL3_2.mjs.map +1 -0
- package/dist/impl-CTPHR7O62.mjs +2 -0
- package/dist/impl-CTPHR7O62.mjs.map +1 -0
- package/dist/impl-CU29SrJb2.mjs +2 -0
- package/dist/impl-CU29SrJb2.mjs.map +1 -0
- package/dist/impl-CaTnsoDi.mjs +2 -0
- package/dist/{impl-BIjDq-3S.cjs.map → impl-CaTnsoDi.mjs.map} +1 -1
- package/dist/impl-CiQeM677.mjs +2 -0
- package/dist/impl-CiQeM677.mjs.map +1 -0
- package/dist/impl-CkY0wfCz.mjs +2 -0
- package/dist/impl-CkY0wfCz.mjs.map +1 -0
- package/dist/impl-CoZhgLjC.mjs +12 -0
- package/dist/impl-CoZhgLjC.mjs.map +1 -0
- package/dist/impl-CvxsioT4.mjs +2 -0
- package/dist/impl-CvxsioT4.mjs.map +1 -0
- package/dist/impl-D2HalFgB2.mjs +2 -0
- package/dist/impl-D2HalFgB2.mjs.map +1 -0
- package/dist/impl-DFNq8PBe.mjs +2 -0
- package/dist/impl-DFNq8PBe.mjs.map +1 -0
- package/dist/impl-DOgLpdLw.mjs +2 -0
- package/dist/impl-DOgLpdLw.mjs.map +1 -0
- package/dist/impl-DP757pBT.mjs +2 -0
- package/dist/impl-DP757pBT.mjs.map +1 -0
- package/dist/impl-DVDN007x.mjs +2 -0
- package/dist/impl-DVDN007x.mjs.map +1 -0
- package/dist/impl-DfKI4fmI.mjs +2 -0
- package/dist/impl-DfKI4fmI.mjs.map +1 -0
- package/dist/impl-DgsWGnhH.mjs +2 -0
- package/dist/impl-DgsWGnhH.mjs.map +1 -0
- package/dist/impl-DzSmriDw.mjs +2 -0
- package/dist/impl-DzSmriDw.mjs.map +1 -0
- package/dist/impl-EhTHDCC1.mjs +2 -0
- package/dist/{impl-JgMjiEBD.cjs.map → impl-EhTHDCC1.mjs.map} +1 -1
- package/dist/impl-J-dQqTZJ2.mjs +2 -0
- package/dist/impl-J-dQqTZJ2.mjs.map +1 -0
- package/dist/impl-SxwaNC4m2.mjs +2 -0
- package/dist/impl-SxwaNC4m2.mjs.map +1 -0
- package/dist/impl-fESuqAH1.mjs +2 -0
- package/dist/{impl-ChHjX-p0.cjs.map → impl-fESuqAH1.mjs.map} +1 -1
- package/dist/impl-gYrR3kIh.mjs +4 -0
- package/dist/impl-gYrR3kIh.mjs.map +1 -0
- package/dist/impl-iwjvzA7a.mjs +2 -0
- package/dist/impl-iwjvzA7a.mjs.map +1 -0
- package/dist/impl-nKY3m-Vx.mjs +2 -0
- package/dist/impl-nKY3m-Vx.mjs.map +1 -0
- package/dist/impl-qiK6VF4F2.mjs +2 -0
- package/dist/impl-qiK6VF4F2.mjs.map +1 -0
- package/dist/{index.d.cts → index.d.mts} +1760 -3516
- package/dist/index.mjs +5 -0
- package/dist/index.mjs.map +1 -0
- package/dist/logger-Bj782ZYD.mjs +2 -0
- package/dist/logger-Bj782ZYD.mjs.map +1 -0
- package/dist/manual-enrichment-CYoZNBjO.mjs +2 -0
- package/dist/manual-enrichment-CYoZNBjO.mjs.map +1 -0
- package/dist/mergeTranscendInputs-Coj_e2N3.mjs +2 -0
- package/dist/{mergeTranscendInputs-BIBCYbug.cjs.map → mergeTranscendInputs-Coj_e2N3.mjs.map} +1 -1
- package/dist/pooling-BkZAO1Zs.mjs +23 -0
- package/dist/pooling-BkZAO1Zs.mjs.map +1 -0
- package/dist/preference-management-BHj26bmE.mjs +7 -0
- package/dist/preference-management-BHj26bmE.mjs.map +1 -0
- package/dist/readTranscendYaml-DhKG1ViI.mjs +4 -0
- package/dist/readTranscendYaml-DhKG1ViI.mjs.map +1 -0
- package/dist/syncConfigurationToTranscend-wWSbGVrI.mjs +3010 -0
- package/dist/syncConfigurationToTranscend-wWSbGVrI.mjs.map +1 -0
- package/dist/uploadConsents-nsjKy1I4.mjs +2 -0
- package/dist/uploadConsents-nsjKy1I4.mjs.map +1 -0
- package/package.json +46 -49
- package/dist/api-keys-y8Txn6tT.cjs +0 -2
- package/dist/api-keys-y8Txn6tT.cjs.map +0 -1
- package/dist/app-_ZoYl64o.cjs +0 -131
- package/dist/app-_ZoYl64o.cjs.map +0 -1
- package/dist/bin/bash-complete.cjs +0 -3
- package/dist/bin/bash-complete.cjs.map +0 -1
- package/dist/bin/cli.cjs +0 -3
- package/dist/bin/cli.cjs.map +0 -1
- package/dist/bin/deprecated-command.cjs +0 -5
- package/dist/bin/deprecated-command.cjs.map +0 -1
- package/dist/buildAIIntegrationType-BwuCYR-o.cjs +0 -2
- package/dist/buildAIIntegrationType-BwuCYR-o.cjs.map +0 -1
- package/dist/chunk-Bmb41Sf3.cjs +0 -1
- package/dist/code-scanning-ByZQgqip.cjs +0 -4
- package/dist/code-scanning-ByZQgqip.cjs.map +0 -1
- package/dist/codecs-Bvmb8o9R.cjs +0 -2
- package/dist/codecs-Bvmb8o9R.cjs.map +0 -1
- package/dist/command-CLULRNcd.cjs +0 -9
- package/dist/command-CLULRNcd.cjs.map +0 -1
- package/dist/consent-manager-CJZ5GTmv.cjs +0 -12
- package/dist/consent-manager-CJZ5GTmv.cjs.map +0 -1
- package/dist/constants-CzmvL6Mw.cjs +0 -2
- package/dist/constants-CzmvL6Mw.cjs.map +0 -1
- package/dist/context-_8xfl0dt.cjs +0 -2
- package/dist/cron-Ts7kHP6_.cjs +0 -2
- package/dist/cron-Ts7kHP6_.cjs.map +0 -1
- package/dist/data-inventory-D0Tt_vAm.cjs +0 -75
- package/dist/data-inventory-D0Tt_vAm.cjs.map +0 -1
- package/dist/dataFlowsToDataSilos-B7nTxawV.cjs +0 -2
- package/dist/dataFlowsToDataSilos-B7nTxawV.cjs.map +0 -1
- package/dist/done-input-validation-DGckEJ5a.cjs +0 -2
- package/dist/enums-BZulhPFa.cjs +0 -2
- package/dist/impl-1qwMfsU4.cjs +0 -2
- package/dist/impl-1qwMfsU4.cjs.map +0 -1
- package/dist/impl-73q3K0b_.cjs +0 -2
- package/dist/impl-73q3K0b_.cjs.map +0 -1
- package/dist/impl-8HXqFDdD.cjs +0 -2
- package/dist/impl-8HXqFDdD.cjs.map +0 -1
- package/dist/impl-AZPWCkCp.cjs +0 -2
- package/dist/impl-AZPWCkCp.cjs.map +0 -1
- package/dist/impl-B61wd2KQ.cjs +0 -2
- package/dist/impl-B61wd2KQ.cjs.map +0 -1
- package/dist/impl-B8rg6CMv.cjs +0 -2
- package/dist/impl-BIjDq-3S.cjs +0 -2
- package/dist/impl-BPxZw3LN.cjs +0 -2
- package/dist/impl-BPxZw3LN.cjs.map +0 -1
- package/dist/impl-BczOEWXK.cjs +0 -2
- package/dist/impl-BczOEWXK.cjs.map +0 -1
- package/dist/impl-BeUsmMIp.cjs +0 -2
- package/dist/impl-BeUsmMIp.cjs.map +0 -1
- package/dist/impl-Bhv353rp.cjs +0 -2
- package/dist/impl-Bhv353rp.cjs.map +0 -1
- package/dist/impl-BiPKUZQ2.cjs +0 -2
- package/dist/impl-BiPKUZQ2.cjs.map +0 -1
- package/dist/impl-BvrbCovf.cjs +0 -12
- package/dist/impl-BvrbCovf.cjs.map +0 -1
- package/dist/impl-BxKSXO7j.cjs +0 -2
- package/dist/impl-BxKSXO7j.cjs.map +0 -1
- package/dist/impl-ByavdlGX.cjs +0 -2
- package/dist/impl-ByavdlGX.cjs.map +0 -1
- package/dist/impl-C6Vv_fyU.cjs +0 -2
- package/dist/impl-C6Vv_fyU.cjs.map +0 -1
- package/dist/impl-CGSBsFc7.cjs +0 -2
- package/dist/impl-CGSBsFc7.cjs.map +0 -1
- package/dist/impl-ChHjX-p0.cjs +0 -2
- package/dist/impl-ChqwjO34.cjs +0 -2
- package/dist/impl-ChqwjO34.cjs.map +0 -1
- package/dist/impl-CrieEyzk.cjs +0 -2
- package/dist/impl-CrieEyzk.cjs.map +0 -1
- package/dist/impl-Cru4riTc.cjs +0 -5
- package/dist/impl-Cru4riTc.cjs.map +0 -1
- package/dist/impl-CujcX7vE.cjs +0 -2
- package/dist/impl-CujcX7vE.cjs.map +0 -1
- package/dist/impl-D9OOb2JE.cjs +0 -2
- package/dist/impl-D9OOb2JE.cjs.map +0 -1
- package/dist/impl-DCKUxoWY.cjs +0 -2
- package/dist/impl-DCKUxoWY.cjs.map +0 -1
- package/dist/impl-DG_MFWMU.cjs +0 -2
- package/dist/impl-DG_MFWMU.cjs.map +0 -1
- package/dist/impl-DHIiB7cV.cjs +0 -2
- package/dist/impl-DHIiB7cV.cjs.map +0 -1
- package/dist/impl-DYHQz-Wu.cjs +0 -2
- package/dist/impl-DYHQz-Wu.cjs.map +0 -1
- package/dist/impl-D_4LdDL9.cjs +0 -2
- package/dist/impl-D_4LdDL9.cjs.map +0 -1
- package/dist/impl-D_tCWU8I.cjs +0 -2
- package/dist/impl-D_tCWU8I.cjs.map +0 -1
- package/dist/impl-DhKyE3ja.cjs +0 -2
- package/dist/impl-DhKyE3ja.cjs.map +0 -1
- package/dist/impl-DkyT66jZ.cjs +0 -2
- package/dist/impl-DkyT66jZ.cjs.map +0 -1
- package/dist/impl-DpkTAuVd.cjs +0 -2
- package/dist/impl-DpkTAuVd.cjs.map +0 -1
- package/dist/impl-DvFcMtV7.cjs +0 -4
- package/dist/impl-DvFcMtV7.cjs.map +0 -1
- package/dist/impl-Dzi2-R-5.cjs +0 -3
- package/dist/impl-Dzi2-R-5.cjs.map +0 -1
- package/dist/impl-Dzyo_6if.cjs +0 -2
- package/dist/impl-Dzyo_6if.cjs.map +0 -1
- package/dist/impl-HogBsNBk.cjs +0 -2
- package/dist/impl-HogBsNBk.cjs.map +0 -1
- package/dist/impl-JgMjiEBD.cjs +0 -2
- package/dist/impl-JkHt--m4.cjs +0 -4
- package/dist/impl-JkHt--m4.cjs.map +0 -1
- package/dist/impl-_wktLwfn.cjs +0 -2
- package/dist/impl-_wktLwfn.cjs.map +0 -1
- package/dist/impl-afJ-fKK4.cjs +0 -2
- package/dist/impl-afJ-fKK4.cjs.map +0 -1
- package/dist/impl-brt-L_kS.cjs +0 -2
- package/dist/impl-brt-L_kS.cjs.map +0 -1
- package/dist/impl-iuvcsdad.cjs +0 -2
- package/dist/impl-iuvcsdad.cjs.map +0 -1
- package/dist/impl-kmDIC1No.cjs +0 -2
- package/dist/impl-kmDIC1No.cjs.map +0 -1
- package/dist/impl-zSp6Nypz.cjs +0 -2
- package/dist/impl-zSp6Nypz.cjs.map +0 -1
- package/dist/index.cjs +0 -5
- package/dist/index.cjs.map +0 -1
- package/dist/logger-DQwEYtSS.cjs +0 -2
- package/dist/logger-DQwEYtSS.cjs.map +0 -1
- package/dist/manual-enrichment-CW8iihdb.cjs +0 -2
- package/dist/manual-enrichment-CW8iihdb.cjs.map +0 -1
- package/dist/mergeTranscendInputs-BIBCYbug.cjs +0 -2
- package/dist/pooling-Dw0a42I_.cjs +0 -23
- package/dist/pooling-Dw0a42I_.cjs.map +0 -1
- package/dist/preference-management-CkmW6Z91.cjs +0 -7
- package/dist/preference-management-CkmW6Z91.cjs.map +0 -1
- package/dist/readTranscendYaml-Cycz6RxW.cjs +0 -4
- package/dist/readTranscendYaml-Cycz6RxW.cjs.map +0 -1
- package/dist/syncConfigurationToTranscend-DkeLrq-I.cjs +0 -3009
- package/dist/syncConfigurationToTranscend-DkeLrq-I.cjs.map +0 -1
- package/dist/uploadConsents-zr1Hg-JE.cjs +0 -2
- package/dist/uploadConsents-zr1Hg-JE.cjs.map +0 -1
- /package/dist/bin/{bash-complete.d.cts → bash-complete.d.mts} +0 -0
- /package/dist/bin/{cli.d.cts → cli.d.mts} +0 -0
- /package/dist/bin/{deprecated-command.d.cts → deprecated-command.d.mts} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data-inventory-D0Tt_vAm.cjs","names":["cliProgress","SubDataPointDataSubCategoryGuessStatus","makeGraphQLRequest","SUB_DATA_POINTS_COUNT","sortBy","chunk","mapSeries","DATAPOINT_EXPORT","DATA_SILO_EXPORT","keyBy","uniq","cliProgress","makeGraphQLRequest","ENTRY_COUNT","sortBy"],"sources":["../src/lib/data-inventory/pullAllDatapoints.ts","../src/lib/data-inventory/pullUnstructuredSubDataPointRecommendations.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport { keyBy, uniq, chunk, sortBy } from 'lodash-es';\nimport {\n type DataCategoryType,\n SubDataPointDataSubCategoryGuessStatus,\n} from '@transcend-io/privacy-types';\nimport cliProgress from 'cli-progress';\nimport { gql } from 'graphql-request';\nimport colors from 'colors';\nimport type { GraphQLClient } from 'graphql-request';\nimport {\n DATAPOINT_EXPORT,\n DATA_SILO_EXPORT,\n type DataSiloAttributeValue,\n SUB_DATA_POINTS_COUNT,\n makeGraphQLRequest,\n} from '../graphql';\nimport { logger } from '../../logger';\nimport type { DataCategoryInput, ProcessingPurposeInput } from '../../codecs';\nimport { mapSeries } from '../bluebird';\n\nexport interface DataSiloCsvPreview {\n /** ID of dataSilo */\n id: string;\n /** Name of dataSilo */\n title: string;\n}\n\nexport interface DataPointCsvPreview {\n /** ID of dataPoint */\n id: string;\n /** The path to this data point */\n path: string[];\n /** Description */\n description: {\n /** Default message */\n defaultMessage: string;\n };\n /** Name */\n name: string;\n}\n\nexport interface SubDataPointCsvPreview {\n /** ID of subDatapoint */\n id: string;\n /** Name (or key) of the subdatapoint */\n name: string;\n /** The description */\n description?: string;\n /** Personal data category */\n categories: DataCategoryInput[];\n /** Data point ID */\n dataPointId: string;\n /** The data silo ID */\n dataSiloId: string;\n /** The processing purpose for this sub datapoint */\n purposes: ProcessingPurposeInput[];\n /** Attribute attached to subdatapoint */\n attributeValues?: DataSiloAttributeValue[];\n /** Data category guesses that are output by the classifier */\n pendingCategoryGuesses?: {\n /** Data category being guessed */\n category: DataCategoryInput;\n /** Status of guess */\n status: SubDataPointDataSubCategoryGuessStatus;\n /** classifier version that produced the guess */\n classifierVersion: number;\n }[];\n}\n\nexport interface DatapointFilterOptions {\n /** IDs of data silos to filter down */\n dataSiloIds?: string[];\n /** Whether to include guessed categories, defaults to only approved categories */\n includeGuessedCategories?: boolean;\n /** Whether or not to include attributes */\n includeAttributes?: boolean;\n /** Parent categories to filter down for */\n parentCategories?: DataCategoryType[];\n /** Sub categories to filter down for */\n subCategories?: string[]; // TODO: https://transcend.height.app/T-40482 - do by name not ID\n}\n\n/**\n * Pull subdatapoint information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The subdatapoints\n */\nasync function pullSubDatapoints(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n includeGuessedCategories,\n includeAttributes,\n parentCategories = [],\n subCategories = [],\n pageSize = 1000,\n }: DatapointFilterOptions & {\n /** Page size to pull in */\n pageSize?: number;\n } = {},\n): Promise<SubDataPointCsvPreview[]> {\n const subDataPoints: SubDataPointCsvPreview[] = [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n // Filters\n const filterBy = {\n ...(parentCategories.length > 0 ? { category: parentCategories } : {}),\n ...(subCategories.length > 0 ? { subCategoryIds: subCategories } : {}),\n // if parentCategories or subCategories and not includeGuessedCategories\n ...(parentCategories.length + subCategories.length > 0 &&\n !includeGuessedCategories\n ? // then only show data points with approved data categories\n { status: SubDataPointDataSubCategoryGuessStatus.Approved }\n : {}),\n ...(dataSiloIds.length > 0 ? { dataSilos: dataSiloIds } : {}),\n };\n\n // Build a GraphQL client\n const {\n subDataPoints: { totalCount },\n } = await makeGraphQLRequest<{\n /** Query response */\n subDataPoints: {\n /** Count */\n totalCount: number;\n };\n }>(client, SUB_DATA_POINTS_COUNT, {\n filterBy,\n });\n\n logger.info(colors.magenta('[Step 1/3] Pulling in all subdatapoints'));\n\n progressBar.start(totalCount, 0);\n let total = 0;\n let shouldContinue = false;\n let cursor: string | undefined;\n let offset = 0;\n do {\n try {\n const {\n subDataPoints: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n subDataPoints: {\n /** List of matches */\n nodes: SubDataPointCsvPreview[];\n };\n }>(\n client,\n gql`\n query TranscendCliSubDataPointCsvExport(\n $filterBy: SubDataPointFiltersInput\n $first: Int!\n $offset: Int!\n ) {\n subDataPoints(\n filterBy: $filterBy\n first: $first\n offset: $offset\n useMaster: false\n ) {\n nodes {\n id\n name\n description\n dataPointId\n dataSiloId\n purposes {\n name\n purpose\n }\n categories {\n name\n category\n }\n ${\n includeGuessedCategories\n ? `pendingCategoryGuesses {\n category {\n name\n category\n }\n status\n classifierVersion\n }`\n : ''\n }\n ${\n includeAttributes\n ? `attributeValues {\n attributeKey {\n name\n }\n name\n }`\n : ''\n }\n }\n }\n }\n `,\n {\n first: pageSize,\n offset,\n filterBy: {\n ...filterBy,\n // TODO: https://transcend.height.app/T-40484 - add cursor support\n // ...(cursor ? { cursor: { id: cursor } } : {}),\n },\n },\n );\n\n cursor = nodes[nodes.length - 1]?.id as string;\n subDataPoints.push(...nodes);\n shouldContinue = nodes.length === pageSize;\n total += nodes.length;\n offset += nodes.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(\n `An error fetching subdatapoints for cursor ${cursor} and offset ${offset}`,\n ),\n );\n throw err;\n }\n } while (shouldContinue);\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n const sorted = sortBy(subDataPoints, 'name');\n\n logger.info(\n colors.green(\n `Successfully pulled in ${sorted.length} subdatapoints in ${\n totalTime / 1000\n } seconds!`,\n ),\n );\n return sorted;\n}\n\n/**\n * Pull datapoint information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The datapoints\n */\nasync function pullDatapoints(\n client: GraphQLClient,\n {\n dataPointIds = [],\n pageSize = 100,\n }: {\n /** IDs of data points to filter down */\n dataPointIds: string[];\n /** Page size to pull in */\n pageSize?: number;\n },\n): Promise<DataPointCsvPreview[]> {\n const dataPoints: DataPointCsvPreview[] = [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n logger.info(\n colors.magenta(\n `[Step 2/3] Fetching metadata for ${dataPointIds.length} datapoints`,\n ),\n );\n\n // Group by 100\n const dataPointsGrouped = chunk(dataPointIds, pageSize);\n\n progressBar.start(dataPointIds.length, 0);\n let total = 0;\n await mapSeries(dataPointsGrouped, async (dataPointIdsGroup) => {\n try {\n const {\n dataPoints: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n dataPoints: {\n /** List of matches */\n nodes: DataPointCsvPreview[];\n };\n }>(client, DATAPOINT_EXPORT, {\n first: pageSize,\n filterBy: {\n ids: dataPointIdsGroup,\n },\n });\n\n dataPoints.push(...nodes);\n total += dataPointIdsGroup.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(\n `An error fetching subdatapoints for IDs ${dataPointIdsGroup.join(\n ', ',\n )}`,\n ),\n );\n throw err;\n }\n });\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully pulled in ${dataPoints.length} dataPoints in ${\n totalTime / 1000\n } seconds!`,\n ),\n );\n return dataPoints;\n}\n\n/**\n * Pull data silo information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The data silos\n */\nasync function pullDataSilos(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n pageSize = 100,\n }: {\n /** IDs of data silos to filter down */\n dataSiloIds: string[];\n /** Page size to pull in */\n pageSize?: number;\n },\n): Promise<DataSiloCsvPreview[]> {\n const dataSilos: DataSiloCsvPreview[] = [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n logger.info(\n colors.magenta(\n `[Step 3/3] Fetching metadata for ${dataSiloIds.length} data silos`,\n ),\n );\n\n // Group by 100\n const dataSilosGrouped = chunk(dataSiloIds, pageSize);\n\n progressBar.start(dataSiloIds.length, 0);\n let total = 0;\n await mapSeries(dataSilosGrouped, async (dataSiloIdsGroup) => {\n try {\n const {\n dataSilos: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n dataSilos: {\n /** List of matches */\n nodes: DataSiloCsvPreview[];\n };\n }>(client, DATA_SILO_EXPORT, {\n first: pageSize,\n filterBy: {\n ids: dataSiloIdsGroup,\n },\n });\n\n dataSilos.push(...nodes);\n total += dataSiloIdsGroup.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(\n `An error fetching data silos for IDs ${dataSiloIdsGroup.join(', ')}`,\n ),\n );\n throw err;\n }\n });\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully pulled in ${dataSilos.length} data silos in ${\n totalTime / 1000\n } seconds!`,\n ),\n );\n return dataSilos;\n}\n\n/**\n * Pull all datapoints from the data inventory.\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The datapoints and data silos\n */\nexport async function pullAllDatapoints(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n includeGuessedCategories,\n includeAttributes,\n parentCategories = [],\n subCategories = [],\n pageSize = 1000,\n }: DatapointFilterOptions & {\n /** Page size to pull in */\n pageSize?: number;\n } = {},\n): Promise<\n (SubDataPointCsvPreview & {\n /** Data point information */\n dataPoint: DataPointCsvPreview;\n /** Data silo information */\n dataSilo: DataSiloCsvPreview;\n })[]\n> {\n // Subdatapoint information\n const subDatapoints = await pullSubDatapoints(client, {\n dataSiloIds,\n includeGuessedCategories,\n includeAttributes,\n parentCategories,\n subCategories,\n pageSize,\n });\n\n // The datapoint ids to grab\n const dataPointIds = uniq(subDatapoints.map((point) => point.dataPointId));\n const dataPoints = await pullDatapoints(client, {\n dataPointIds,\n });\n const dataPointById = keyBy(dataPoints, 'id');\n\n // The data silo IDs to grab\n const allDataSiloIds = uniq(subDatapoints.map((point) => point.dataSiloId));\n const dataSilos = await pullDataSilos(client, {\n dataSiloIds: allDataSiloIds,\n });\n const dataSiloById = keyBy(dataSilos, 'id');\n\n return subDatapoints.map((subDataPoint) => ({\n ...subDataPoint,\n dataPoint: dataPointById[subDataPoint.dataPointId],\n dataSilo: dataSiloById[subDataPoint.dataSiloId],\n }));\n}\n/* eslint-enable max-lines */\n","import type { UnstructuredSubDataPointRecommendationStatus } from '@transcend-io/privacy-types';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\nimport { gql, type GraphQLClient } from 'graphql-request';\nimport { sortBy } from 'lodash-es';\nimport type { DataCategoryInput } from '../../codecs';\nimport { ENTRY_COUNT, makeGraphQLRequest } from '../graphql';\nimport { logger } from '../../logger';\n\ninterface UnstructuredSubDataPointRecommendationCsvPreview {\n /** ID of subDatapoint */\n id: string;\n /** Entry or Named Entity recognized by the classifier */\n name: string;\n /** Context snippet including entry */\n contextSnippet: string;\n /** Scanned object ID */\n scannedObjectId: string;\n /** Scanned object path ID */\n scannedObjectPathId: string;\n /** The data silo ID */\n dataSiloId: string;\n /** Personal data category */\n dataSubCategory: DataCategoryInput;\n /** Classification Status */\n status: UnstructuredSubDataPointRecommendationStatus;\n /** Confidence */\n confidence: number;\n /** Classification method */\n classificationMethod: string;\n /** Classifier version */\n classifierVersion: string;\n}\n\ninterface EntryFilterOptions {\n /** IDs of data silos to filter down */\n dataSiloIds?: string[];\n /** Parent categories to filter down for */\n status?: UnstructuredSubDataPointRecommendationStatus[];\n /** Sub categories to filter down for */\n subCategories?: string[]; // TODO: https://transcend.height.app/T-40482 - do by name not ID\n /** Include entry and snippet */\n includeEncryptedSnippets?: boolean;\n /** Include encryptedSamplesS3Key */\n includeEncryptedSamplesS3Key?: boolean;\n}\n/**\n * Pull unstructured subdatapoint information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @param options.dataSiloIds - IDs of data silos to filter down\n * @param options.status - Parent categories to filter down for\n * @param options.subCategories - Sub categories to filter down for\n * @param options.includeEncryptedSnippets - Include entry and snippet\n * @param options.includeEncryptedSamplesS3Key - Include encryptedSamplesS3Key\n * @param options.pageSize - Page size to pull in\n * @returns A promise that resolves to an array of unstructured subdatapoint recommendations\n */\nexport async function pullUnstructuredSubDataPointRecommendations(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n status,\n subCategories = [],\n includeEncryptedSnippets,\n pageSize = 100,\n }: EntryFilterOptions & {\n /** Page size to pull in */\n pageSize?: number;\n } = {},\n): Promise<UnstructuredSubDataPointRecommendationCsvPreview[]> {\n const unstructuredSubDataPointRecommendations: UnstructuredSubDataPointRecommendationCsvPreview[] =\n [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n // Filters\n const filterBy = {\n ...(subCategories.length > 0 ? { subCategoryIds: subCategories } : {}),\n ...(status ? { status } : {}),\n ...(dataSiloIds.length > 0 ? { dataSilos: dataSiloIds } : {}),\n };\n\n // Build a GraphQL client\n const {\n unstructuredSubDataPointRecommendations: { totalCount },\n } = await makeGraphQLRequest<{\n /** Query response */\n unstructuredSubDataPointRecommendations: {\n /** Count */\n totalCount: number;\n };\n }>(client, ENTRY_COUNT, {\n filterBy,\n });\n\n logger.info(colors.magenta('[Step 1/3] Pulling in all subdatapoints'));\n\n progressBar.start(totalCount, 0);\n let total = 0;\n let shouldContinue = false;\n let cursor: string | undefined;\n let offset = 0;\n do {\n try {\n const {\n unstructuredSubDataPointRecommendations: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n unstructuredSubDataPointRecommendations: {\n /** List of matches */\n nodes: UnstructuredSubDataPointRecommendationCsvPreview[];\n };\n }>(\n client,\n gql`\n query TranscendCliUnstructuredSubDataPointRecommendationCsvExport(\n $filterBy: UnstructuredSubDataPointRecommendationsFilterInput\n $first: Int!\n $offset: Int!\n ) {\n unstructuredSubDataPointRecommendations(\n filterBy: $filterBy\n first: $first\n offset: $offset\n useMaster: false\n ) {\n nodes {\n id\n dataSiloId\n scannedObjectPathId\n scannedObjectId\n ${includeEncryptedSnippets ? 'name' : ''}\n ${includeEncryptedSnippets ? 'contextSnippet' : ''}\n dataSubCategory {\n name\n category\n }\n status\n confidence\n classificationMethod\n classifierVersion\n }\n }\n }\n `,\n {\n first: pageSize,\n offset,\n filterBy: {\n ...filterBy,\n },\n },\n );\n\n cursor = nodes[nodes.length - 1]?.id as string;\n unstructuredSubDataPointRecommendations.push(...nodes);\n shouldContinue = nodes.length === pageSize;\n total += nodes.length;\n offset += nodes.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(\n `An error fetching subdatapoints for cursor ${cursor} and offset ${offset}`,\n ),\n );\n throw err;\n }\n } while (shouldContinue);\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n const sorted = sortBy(unstructuredSubDataPointRecommendations, 'name');\n\n logger.info(\n colors.green(\n `Successfully pulled in ${sorted.length} subdatapoints in ${\n totalTime / 1000\n } seconds!`,\n ),\n );\n return sorted;\n}\n"],"mappings":"wTA0FA,eAAe,EACb,EACA,CACE,cAAc,EAAE,CAChB,2BACA,oBACA,mBAAmB,EAAE,CACrB,gBAAgB,EAAE,CAClB,WAAW,KAIT,EAAE,CAC6B,CACnC,IAAM,EAA0C,EAAE,CAG5C,EAAK,IAAI,MAAM,CAAC,SAAS,CAGzB,EAAc,IAAIA,EAAAA,QAAY,UAClC,EAAE,CACFA,EAAAA,QAAY,QAAQ,eACrB,CAGK,EAAW,CACf,GAAI,EAAiB,OAAS,EAAI,CAAE,SAAU,EAAkB,CAAG,EAAE,CACrE,GAAI,EAAc,OAAS,EAAI,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rq-I.cjs`);var t=e.Bs(function(t){return e.Ns(e.zs(t,1,e.Ls,!0))}),n=t;function r(e,{adTechPurposes:t=[`SaleOfInfo`],serviceToTitle:r,serviceToSupportedIntegration:i}){let a=[],o=[],s={};e.forEach(e=>{let{service:r,attributes:i=[]}=e;if(!r||r===`internalService`)return;let c=i.find(e=>e.key===`Found on Domain`);c&&(s[r]||(s[r]=[]),s[r].push(...c.values.map(e=>e.replace(`https://`,``).replace(`http://`,``))),s[r]=[...new Set(s[r])]),n(e.trackingPurposes,t).length>0?(o.push(r),a.includes(r)&&(a=a.filter(e=>e!==r))):o.includes(r)||a.push(r)});let c=[...new Set(o)].map(e=>({title:r[e],...i[e]?{integrationName:e}:{integrationName:`promptAPerson`,"outer-type":e},attributes:[{key:`Tech Type`,values:[`Ad Tech`]},{key:`Found On Domain`,values:s[e]||[]}]}));return{siteTechDataSilos:[...new Set(a)].map(e=>({title:r[e],...i[e]?{integrationName:e}:{integrationName:`promptAPerson`,outerType:e},attributes:[{key:`Tech Type`,values:[`Site Tech`]},{key:`Found On Domain`,values:s[e]||[]}]})),adTechDataSilos:c}}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return r}});
|
|
2
|
-
//# sourceMappingURL=dataFlowsToDataSilos-B7nTxawV.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dataFlowsToDataSilos-B7nTxawV.cjs","names":["baseRest","baseUniq","baseFlatten","isArrayLikeObject","union"],"sources":["../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/union.js","../src/lib/consent-manager/dataFlowsToDataSilos.ts"],"sourcesContent":["import baseFlatten from './_baseFlatten.js';\nimport baseRest from './_baseRest.js';\nimport baseUniq from './_baseUniq.js';\nimport isArrayLikeObject from './isArrayLikeObject.js';\n\n/**\n * Creates an array of unique values, in order, from all given arrays using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * _.union([2], [1, 2]);\n * // => [2, 1]\n */\nvar union = baseRest(function(arrays) {\n return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));\n});\n\nexport default union;\n","import { DataFlowInput, DataSiloInput } from '../../codecs';\nimport { union } from 'lodash-es';\nimport { IndexedCatalogs } from '../graphql';\n\n/**\n * Convert data flow configurations into a set of data silo configurations\n *\n * @param inputs - Data flow input to convert to data silos\n * @param options - Additional options\n * @returns Business entity configuration input\n */\nexport function dataFlowsToDataSilos(\n inputs: DataFlowInput[],\n {\n adTechPurposes = ['SaleOfInfo'],\n serviceToTitle,\n serviceToSupportedIntegration,\n }: IndexedCatalogs & {\n /** List of purposes that are considered \"Ad Tech\" */\n adTechPurposes?: string[];\n },\n): {\n /** List of data silo configurations for site-tech services */\n siteTechDataSilos: DataSiloInput[];\n /** List of data silo configurations for ad-tech services */\n adTechDataSilos: DataSiloInput[];\n} {\n // List of site tech integrations\n let siteTechIntegrations: string[] = [];\n\n // List of ad tech integrations\n const adTechIntegrations: string[] = [];\n\n // Mapping from service name to list of\n const serviceToFoundOnDomain: { [k in string]: string[] } = {};\n\n // iterate over each flow\n inputs.forEach((flow) => {\n // process data flows with services\n const { service, attributes = [] } = flow;\n if (!service || service === 'internalService') {\n return;\n }\n\n // create mapping to found on domain\n const foundOnDomain = attributes.find(\n (attr) => attr.key === 'Found on Domain',\n );\n\n // Create a list of all domains where the data flow was found\n if (foundOnDomain) {\n if (!serviceToFoundOnDomain[service]) {\n serviceToFoundOnDomain[service] = [];\n }\n serviceToFoundOnDomain[service]!.push(\n ...foundOnDomain.values.map((v) =>\n v.replace('https://', '').replace('http://', ''),\n ),\n );\n serviceToFoundOnDomain[service] = [\n ...new Set(serviceToFoundOnDomain[service]),\n ];\n }\n\n // Keep track of ad tech\n if (union(flow.trackingPurposes, adTechPurposes).length > 0) {\n // add service to ad tech list\n adTechIntegrations.push(service);\n\n // remove from site tech list\n if (siteTechIntegrations.includes(service)) {\n siteTechIntegrations = siteTechIntegrations.filter(\n (s) => s !== service,\n );\n }\n } else if (!adTechIntegrations.includes(service)) {\n // add to site tech list\n siteTechIntegrations.push(service);\n }\n });\n\n // create the list of ad tech integrations\n const adTechDataSilos = [...new Set(adTechIntegrations)].map((service) => ({\n title: serviceToTitle[service],\n ...(serviceToSupportedIntegration[service]\n ? { integrationName: service }\n : { integrationName: 'promptAPerson', 'outer-type': service }),\n attributes: [\n {\n key: 'Tech Type',\n values: ['Ad Tech'],\n },\n {\n key: 'Found On Domain',\n values: serviceToFoundOnDomain[service] || [],\n },\n ],\n }));\n\n // create the list of site tech integrations\n const siteTechDataSilos = [...new Set(siteTechIntegrations)].map(\n (service) => ({\n title: serviceToTitle[service],\n ...(serviceToSupportedIntegration[service]\n ? { integrationName: service }\n : { integrationName: 'promptAPerson', outerType: service }),\n attributes: [\n {\n key: 'Tech Type',\n values: ['Site Tech'],\n },\n {\n key: 'Found On Domain',\n values: serviceToFoundOnDomain[service] || [],\n },\n ],\n }),\n );\n\n return {\n siteTechDataSilos,\n adTechDataSilos,\n };\n}\n"],"x_google_ignoreList":[0],"mappings":"+DAqBA,IAAI,EAAQA,EAAAA,GAAS,SAAS,EAAQ,CACpC,OAAOC,EAAAA,GAASC,EAAAA,GAAY,EAAQ,EAAGC,EAAAA,GAAmB,GAAK,CAAC,EAChE,CAEF,EAAe,ECdf,SAAgB,EACd,EACA,CACE,iBAAiB,CAAC,aAAa,CAC/B,iBACA,iCAUF,CAEA,IAAI,EAAiC,EAAE,CAGjC,EAA+B,EAAE,CAGjC,EAAsD,EAAE,CAG9D,EAAO,QAAS,GAAS,CAEvB,GAAM,CAAE,UAAS,aAAa,EAAE,EAAK,EACrC,GAAI,CAAC,GAAW,IAAY,kBAC1B,OAIF,IAAM,EAAgB,EAAW,KAC9B,GAAS,EAAK,MAAQ,kBACxB,CAGG,IACG,EAAuB,KAC1B,EAAuB,GAAW,EAAE,EAEtC,EAAuB,GAAU,KAC/B,GAAG,EAAc,OAAO,IAAK,GAC3B,EAAE,QAAQ,WAAY,GAAG,CAAC,QAAQ,UAAW,GAAG,CACjD,CACF,CACD,EAAuB,GAAW,CAChC,GAAG,IAAI,IAAI,EAAuB,GAAS,CAC5C,EAICC,EAAM,EAAK,iBAAkB,EAAe,CAAC,OAAS,GAExD,EAAmB,KAAK,EAAQ,CAG5B,EAAqB,SAAS,EAAQ,GACxC,EAAuB,EAAqB,OACzC,GAAM,IAAM,EACd,GAEO,EAAmB,SAAS,EAAQ,EAE9C,EAAqB,KAAK,EAAQ,EAEpC,CAGF,IAAM,EAAkB,CAAC,GAAG,IAAI,IAAI,EAAmB,CAAC,CAAC,IAAK,IAAa,CACzE,MAAO,EAAe,GACtB,GAAI,EAA8B,GAC9B,CAAE,gBAAiB,EAAS,CAC5B,CAAE,gBAAiB,gBAAiB,aAAc,EAAS,CAC/D,WAAY,CACV,CACE,IAAK,YACL,OAAQ,CAAC,UAAU,CACpB,CACD,CACE,IAAK,kBACL,OAAQ,EAAuB,IAAY,EAAE,CAC9C,CACF,CACF,EAAE,CAsBH,MAAO,CACL,kBApBwB,CAAC,GAAG,IAAI,IAAI,EAAqB,CAAC,CAAC,IAC1D,IAAa,CACZ,MAAO,EAAe,GACtB,GAAI,EAA8B,GAC9B,CAAE,gBAAiB,EAAS,CAC5B,CAAE,gBAAiB,gBAAiB,UAAW,EAAS,CAC5D,WAAY,CACV,CACE,IAAK,YACL,OAAQ,CAAC,YAAY,CACtB,CACD,CACE,IAAK,kBACL,OAAQ,EAAuB,IAAY,EAAE,CAC9C,CACF,CACF,EACF,CAIC,kBACD"}
|
package/dist/enums-BZulhPFa.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`);let t=require(`@transcend-io/type-utils`),n=function(e){return e.Json=`json`,e}({}),r=function(e){return e.Assessments=`assessments`,e}({}),i=function(e){return e.OneTrust=`oneTrust`,e.File=`file`,e}({}),a=function(e){return e.ApiKeys=`apiKeys`,e.Attributes=`customFields`,e.Templates=`templates`,e.DataSilos=`dataSilos`,e.Enrichers=`enrichers`,e.DataFlows=`dataFlows`,e.BusinessEntities=`businessEntities`,e.ProcessingActivities=`processingActivities`,e.Actions=`actions`,e.DataSubjects=`dataSubjects`,e.Identifiers=`identifiers`,e.Cookies=`cookies`,e.ConsentManager=`consentManager`,e.Partitions=`partitions`,e.Prompts=`prompts`,e.PromptPartials=`promptPartials`,e.PromptGroups=`promptGroups`,e.Agents=`agents`,e.AgentFunctions=`agentFunctions`,e.AgentFiles=`agentFiles`,e.Vendors=`vendors`,e.DataCategories=`dataCategories`,e.ProcessingPurposes=`processingPurposes`,e.ActionItems=`actionItems`,e.ActionItemCollections=`actionItemCollections`,e.Teams=`teams`,e.PrivacyCenters=`privacyCenters`,e.Policies=`policies`,e.Messages=`messages`,e.Assessments=`assessments`,e.AssessmentTemplates=`assessmentTemplates`,e.Purposes=`purposes`,e.SystemDiscovery=`systemDiscovery`,e}({});const o=(0,t.makeEnum)({RedactEmail:`redactEmail`,Log:`log`,LogToTranscend:`logToTranscend`,ApplyTranscendPolicies:`applyTranscendPolicies`}),s=(0,t.makeEnum)({ChatCompletion:`/v1/chat/completions`,Embeddings:`/v1/embeddings`,Completions:`/v1/completions`,Agents:`/v1/assistants`,Agent:`/v1/assistants/:assistantId`,Threads:`/v1/threads`,Thread:`/v1/threads/:threadId`,Messages:`/v1/threads/:threadId/messages`,Message:`/v1/threads/:threadId/messages/:messageId`,Runs:`/v1/threads/:threadId/runs`,Run:`/v1/threads/:threadId/runs/:runId`,Files:`/v1/files`,File:`/v1/files/:fileId`});Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return n}});
|
|
2
|
-
//# sourceMappingURL=enums-BZulhPFa.cjs.map
|
package/dist/impl-1qwMfsU4.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
require(`./constants-CzmvL6Mw.cjs`);const e=require(`./syncConfigurationToTranscend-DkeLrq-I.cjs`);require(`./enums-BZulhPFa.cjs`),require(`./logger-DQwEYtSS.cjs`),require(`./buildAIIntegrationType-BwuCYR-o.cjs`);const t=require(`./done-input-validation-DGckEJ5a.cjs`);async function n({auth:n,actions:r,statuses:i=[],requestIds:a,silentModeBefore:o,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u,cancellationTitle:d,transcendUrl:f,concurrency:p}){t.t(this.process.exit),await e.q({transcendUrl:f,requestActions:r,auth:n,cancellationTitle:d,requestIds:a,statuses:i,concurrency:p,silentModeBefore:o?new Date(o):void 0,createdAtBefore:s?new Date(s):void 0,createdAtAfter:c?new Date(c):void 0,updatedAtBefore:l?new Date(l):void 0,updatedAtAfter:u?new Date(u):void 0})}exports.cancel=n;
|
|
2
|
-
//# sourceMappingURL=impl-1qwMfsU4.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-1qwMfsU4.cjs","names":["cancelPrivacyRequests"],"sources":["../src/commands/request/cancel/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { cancelPrivacyRequests } from '../../../lib/requests';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface CancelCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses?: RequestStatus[];\n requestIds?: string[];\n silentModeBefore?: Date;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n cancellationTitle: string;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function cancel(\n this: LocalContext,\n {\n auth,\n actions,\n statuses = [],\n requestIds,\n silentModeBefore,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n cancellationTitle,\n transcendUrl,\n concurrency,\n }: CancelCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await cancelPrivacyRequests({\n transcendUrl,\n requestActions: actions,\n auth,\n cancellationTitle,\n requestIds,\n statuses,\n concurrency,\n silentModeBefore: silentModeBefore ? new Date(silentModeBefore) : undefined,\n createdAtBefore: createdAtBefore ? new Date(createdAtBefore) : undefined,\n createdAtAfter: createdAtAfter ? new Date(createdAtAfter) : undefined,\n updatedAtBefore: updatedAtBefore ? new Date(updatedAtBefore) : undefined,\n updatedAtAfter: updatedAtAfter ? new Date(updatedAtAfter) : undefined,\n });\n}\n"],"mappings":"6QAoBA,eAAsB,EAEpB,CACE,OACA,UACA,WAAW,EAAE,CACb,aACA,mBACA,kBACA,iBACA,kBACA,iBACA,oBACA,eACA,eAEa,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAAAA,EAAsB,CAC1B,eACA,eAAgB,EAChB,OACA,oBACA,aACA,WACA,cACA,iBAAkB,EAAmB,IAAI,KAAK,EAAiB,CAAG,IAAA,GAClE,gBAAiB,EAAkB,IAAI,KAAK,EAAgB,CAAG,IAAA,GAC/D,eAAgB,EAAiB,IAAI,KAAK,EAAe,CAAG,IAAA,GAC5D,gBAAiB,EAAkB,IAAI,KAAK,EAAgB,CAAG,IAAA,GAC/D,eAAgB,EAAiB,IAAI,KAAK,EAAe,CAAG,IAAA,GAC7D,CAAC"}
|
package/dist/impl-73q3K0b_.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`);require(`./enums-BZulhPFa.cjs`);const t=require(`./logger-DQwEYtSS.cjs`);require(`./buildAIIntegrationType-BwuCYR-o.cjs`);const n=require(`./codecs-Bvmb8o9R.cjs`),r=require(`./readTranscendYaml-Cycz6RxW.cjs`),i=require(`./done-input-validation-DGckEJ5a.cjs`);let a=require(`@transcend-io/privacy-types`),o=require(`@transcend-io/type-utils`),s=require(`node:fs`),c=require(`colors`);c=e.t(c);let l=require(`io-ts`);l=e.t(l);function u({file:e,output:u}){i.t(this.process.exit),(0,s.existsSync)(e)||(t.t.error(c.default.red(`File does not exist: --file="${e}"`)),this.process.exit(1));let d=(0,o.decodeCodec)(l.array(n.E),(0,s.readFileSync)(e,`utf-8`)),f=[],p=[];d.forEach(e=>{e.dataFlows.filter(({type:e})=>e!==a.DataFlowScope.CSP).forEach(e=>{f.push({value:e.value,type:e.type,status:a.ConsentTrackerStatus.Live,trackingPurposes:e.trackingPurposes})}),e.cookies.forEach(e=>{p.push({name:e.name,status:a.ConsentTrackerStatus.Live,trackingPurposes:e.trackingPurposes})})}),r.a(u,{"data-flows":f,cookies:p}),t.t.info(c.default.green(`Successfully wrote ${f.length} data flows and ${p.length} cookies to file "${u}"`))}exports.consentManagerServiceJsonToYml=u;
|
|
2
|
-
//# sourceMappingURL=impl-73q3K0b_.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-73q3K0b_.cjs","names":["t","ConsentManagerServiceMetadata","DataFlowScope","ConsentTrackerStatus"],"sources":["../src/commands/inventory/consent-manager-service-json-to-yml/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport * as t from 'io-ts';\nimport { writeTranscendYaml } from '../../../lib/readTranscendYaml';\nimport colors from 'colors';\nimport { logger } from '../../../logger';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport {\n ConsentManagerServiceMetadata,\n CookieInput,\n DataFlowInput,\n} from '../../../codecs';\nimport {\n ConsentTrackerStatus,\n DataFlowScope,\n} from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface ConsentManagerServiceJsonToYmlCommandFlags {\n file: string;\n output: string;\n}\n\nexport function consentManagerServiceJsonToYml(\n this: LocalContext,\n { file, output }: ConsentManagerServiceJsonToYmlCommandFlags,\n): void {\n doneInputValidation(this.process.exit);\n\n // Ensure files exist\n if (!existsSync(file)) {\n logger.error(colors.red(`File does not exist: --file=\"${file}\"`));\n this.process.exit(1);\n }\n\n // Read in each consent manager configuration\n const services = decodeCodec(\n t.array(ConsentManagerServiceMetadata),\n readFileSync(file, 'utf-8'),\n );\n\n // Create data flows and cookie configurations\n const dataFlows: DataFlowInput[] = [];\n const cookies: CookieInput[] = [];\n services.forEach((service) => {\n service.dataFlows\n .filter(({ type }) => type !== DataFlowScope.CSP)\n .forEach((dataFlow) => {\n dataFlows.push({\n value: dataFlow.value,\n type: dataFlow.type,\n status: ConsentTrackerStatus.Live,\n trackingPurposes: dataFlow.trackingPurposes,\n });\n });\n\n service.cookies.forEach((cookie) => {\n cookies.push({\n name: cookie.name,\n status: ConsentTrackerStatus.Live,\n trackingPurposes: cookie.trackingPurposes,\n });\n });\n });\n\n // write to disk\n writeTranscendYaml(output, {\n 'data-flows': dataFlows,\n cookies,\n });\n\n logger.info(\n colors.green(\n `Successfully wrote ${dataFlows.length} data flows and ${cookies.length} cookies to file \"${output}\"`,\n ),\n );\n}\n"],"mappings":"gdAuBA,SAAgB,EAEd,CAAE,OAAM,UACF,CACN,EAAA,EAAoB,KAAK,QAAQ,KAAK,EAGlC,EAAA,EAAA,YAAY,EAAK,GACnB,EAAA,EAAO,MAAM,EAAA,QAAO,IAAI,gCAAgC,EAAK,GAAG,CAAC,CACjE,KAAK,QAAQ,KAAK,EAAE,EAItB,IAAM,GAAA,EAAA,EAAA,aACJA,EAAE,MAAMC,EAAAA,EAA8B,EAAA,EAAA,EAAA,cACzB,EAAM,QAAQ,CAC5B,CAGK,EAA6B,EAAE,CAC/B,EAAyB,EAAE,CACjC,EAAS,QAAS,GAAY,CAC5B,EAAQ,UACL,QAAQ,CAAE,UAAW,IAASC,EAAAA,cAAc,IAAI,CAChD,QAAS,GAAa,CACrB,EAAU,KAAK,CACb,MAAO,EAAS,MAChB,KAAM,EAAS,KACf,OAAQC,EAAAA,qBAAqB,KAC7B,iBAAkB,EAAS,iBAC5B,CAAC,EACF,CAEJ,EAAQ,QAAQ,QAAS,GAAW,CAClC,EAAQ,KAAK,CACX,KAAM,EAAO,KACb,OAAQA,EAAAA,qBAAqB,KAC7B,iBAAkB,EAAO,iBAC1B,CAAC,EACF,EACF,CAGF,EAAA,EAAmB,EAAQ,CACzB,aAAc,EACd,UACD,CAAC,CAEF,EAAA,EAAO,KACL,EAAA,QAAO,MACL,sBAAsB,EAAU,OAAO,kBAAkB,EAAQ,OAAO,oBAAoB,EAAO,GACpG,CACF"}
|
package/dist/impl-8HXqFDdD.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`);require(`./constants-CzmvL6Mw.cjs`);const t=require(`./syncConfigurationToTranscend-DkeLrq-I.cjs`);require(`./enums-BZulhPFa.cjs`);const n=require(`./logger-DQwEYtSS.cjs`);require(`./buildAIIntegrationType-BwuCYR-o.cjs`),require(`./codecs-Bvmb8o9R.cjs`);const r=require(`./consent-manager-CJZ5GTmv.cjs`);require(`./uploadConsents-zr1Hg-JE.cjs`);const i=require(`./api-keys-y8Txn6tT.cjs`),a=require(`./done-input-validation-DGckEJ5a.cjs`);let o=require(`@transcend-io/privacy-types`),s=require(`colors`);s=e.t(s);async function c({auth:e,bundleTypes:c=[o.ConsentBundleType.Production,o.ConsentBundleType.Test],deploy:l,transcendUrl:u}){a.t(this.process.exit);let d=await i.r(e);typeof d==`string`?(await r.c({deploy:l,transcendUrl:u,auth:d,bundleTypes:c}),n.t.info(s.default.green(`Successfully updated Consent Manager!`))):(await t.js(d,async e=>{n.t.info(s.default.magenta(`Updating Consent Manager for organization "${e.organizationName}"...`)),await r.c({deploy:l,transcendUrl:u,auth:e.apiKey,bundleTypes:c}),n.t.info(s.default.green(`Successfully updated Consent Manager for organization "${e.organizationName}"!`))}),n.t.info(s.default.green(`Successfully updated Consent Managers!`)))}exports.updateConsentManager=c;
|
|
2
|
-
//# sourceMappingURL=impl-8HXqFDdD.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-8HXqFDdD.cjs","names":["ConsentBundleType","validateTranscendAuth","updateConsentManagerVersionToLatest","mapSeries"],"sources":["../src/commands/consent/update-consent-manager/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport colors from 'colors';\nimport { ConsentBundleType } from '@transcend-io/privacy-types';\nimport { mapSeries } from '../../../lib/bluebird';\n\nimport { logger } from '../../../logger';\nimport { updateConsentManagerVersionToLatest } from '../../../lib/consent-manager';\nimport { validateTranscendAuth } from '../../../lib/api-keys';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface UpdateConsentManagerCommandFlags {\n auth: string;\n bundleTypes: ConsentBundleType[];\n deploy: boolean;\n transcendUrl: string;\n}\n\nexport async function updateConsentManager(\n this: LocalContext,\n {\n auth,\n bundleTypes = [ConsentBundleType.Production, ConsentBundleType.Test],\n deploy,\n transcendUrl,\n }: UpdateConsentManagerCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Handle single update\n if (typeof apiKeyOrList === 'string') {\n // Update consent manager\n await updateConsentManagerVersionToLatest({\n deploy,\n transcendUrl,\n auth: apiKeyOrList,\n bundleTypes,\n });\n logger.info(colors.green('Successfully updated Consent Manager!'));\n } else {\n await mapSeries(apiKeyOrList, async (apiKey) => {\n logger.info(\n colors.magenta(\n `Updating Consent Manager for organization \"${apiKey.organizationName}\"...`,\n ),\n );\n\n await updateConsentManagerVersionToLatest({\n deploy,\n transcendUrl,\n auth: apiKey.apiKey,\n bundleTypes,\n });\n\n logger.info(\n colors.green(\n `Successfully updated Consent Manager for organization \"${apiKey.organizationName}\"!`,\n ),\n );\n });\n logger.info(colors.green('Successfully updated Consent Managers!'));\n }\n}\n"],"mappings":"wiBAiBA,eAAsB,EAEpB,CACE,OACA,cAAc,CAACA,EAAAA,kBAAkB,WAAYA,EAAAA,kBAAkB,KAAK,CACpE,SACA,gBAEa,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAe,MAAMC,EAAAA,EAAsB,EAAK,CAGlD,OAAO,GAAiB,UAE1B,MAAMC,EAAAA,EAAoC,CACxC,SACA,eACA,KAAM,EACN,cACD,CAAC,CACF,EAAA,EAAO,KAAK,EAAA,QAAO,MAAM,wCAAwC,CAAC,GAElE,MAAMC,EAAAA,GAAU,EAAc,KAAO,IAAW,CAC9C,EAAA,EAAO,KACL,EAAA,QAAO,QACL,8CAA8C,EAAO,iBAAiB,MACvE,CACF,CAED,MAAMD,EAAAA,EAAoC,CACxC,SACA,eACA,KAAM,EAAO,OACb,cACD,CAAC,CAEF,EAAA,EAAO,KACL,EAAA,QAAO,MACL,0DAA0D,EAAO,iBAAiB,IACnF,CACF,EACD,CACF,EAAA,EAAO,KAAK,EAAA,QAAO,MAAM,yCAAyC,CAAC"}
|
package/dist/impl-AZPWCkCp.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`);require(`./constants-CzmvL6Mw.cjs`);const t=require(`./syncConfigurationToTranscend-DkeLrq-I.cjs`);require(`./enums-BZulhPFa.cjs`);const n=require(`./logger-DQwEYtSS.cjs`);require(`./buildAIIntegrationType-BwuCYR-o.cjs`);const r=require(`./cron-Ts7kHP6_.cjs`),i=require(`./done-input-validation-DGckEJ5a.cjs`);let a=require(`colors`);a=e.t(a);async function o({file:e,fileTarget:o,transcendUrl:s,auth:c,sombraAuth:l,cronDataSiloId:u,targetDataSiloId:d,actions:f,skipRequestCount:p,pageLimit:m,chunkSize:h}){p&&n.t.info(a.default.yellow(`Skipping request count as requested. This may help speed up the call.`)),(Number.isNaN(h)||h<=0||h%m!==0)&&(n.t.error(a.default.red(`Invalid chunk size: "${h}". Must be a positive integer that is a multiple of ${m}.`)),this.process.exit(1)),i.t(this.process.exit);let g=t.ai(s,c),{baseName:_,extension:v}=t.c(e),{baseName:y,extension:b}=t.c(o),x=0,S=0,C=0;await r.t({dataSiloId:u,auth:c,sombraAuth:l,actions:f,apiPageSize:m,savePageSize:h,onSave:async r=>{x+=r.length;let i=await t.As(t.Rs(t.Ms(r.map(e=>e.requestId)),m),async e=>(n.t.info(a.default.magenta(`Fetching target identifiers for ${e.length} requests`)),(await t.Gn(g,m*2,{requestIds:e,dataSiloIds:[d]})).map(({fileName:e,remoteId:t})=>{if(!t)throw Error(`Failed to find remoteId for ${e}`);return{RecordId:t,Object:e.replace(`.json`,``).split(`/`).pop()?.replace(` Information`,``),Comment:`Customer data deletion request submitted via transcend.io`}})),{concurrency:1});S+=i.flat().length;let s=t.Ms(r.map(e=>Object.keys(e)).flat()),c=`${_}-${C}${v}`,l=`${y}-${C}${b}`;await t.d(c,r,s),n.t.info(a.default.green(`Successfully wrote ${r.length} identifiers to file "${e}"`));let u=i.flat();await t.d(l,u,t.Ms(u.map(e=>Object.keys(e)).flat())),n.t.info(a.default.green(`Successfully wrote ${u.length} identifiers to file "${o}"`)),n.t.info(a.default.blue(`Processed chunk of ${t.Rs.length} identifiers, found ${u.length} target identifiers`)),C+=1},transcendUrl:s,skipRequestCount:p}),n.t.info(a.default.green(`Successfully wrote ${x} identifiers to file "${e}"`)),n.t.info(a.default.green(`Successfully wrote ${S} identifiers to file "${o}"`))}exports.pullProfiles=o;
|
|
2
|
-
//# sourceMappingURL=impl-AZPWCkCp.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-AZPWCkCp.cjs","names":["buildTranscendGraphQLClient","parseFilePath","map","chunk","uniq","fetchRequestFilesForRequest","writeLargeCsv","pullChunkedCustomSiloOutstandingIdentifiers"],"sources":["../src/commands/request/cron/pull-profiles/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\nimport { logger } from '../../../../logger';\nimport colors from 'colors';\nimport { uniq, chunk } from 'lodash-es';\nimport { map } from '../../../../lib/bluebird';\nimport {\n buildTranscendGraphQLClient,\n fetchRequestFilesForRequest,\n} from '../../../../lib/graphql';\nimport type { LocalContext } from '../../../../context';\nimport {\n pullChunkedCustomSiloOutstandingIdentifiers,\n type CsvFormattedIdentifier,\n} from '../../../../lib/cron';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\nimport { parseFilePath, writeLargeCsv } from '../../../../lib/helpers';\n\nexport interface PullProfilesCommandFlags {\n file: string;\n fileTarget: string;\n transcendUrl: string;\n auth: string;\n sombraAuth?: string;\n cronDataSiloId: string;\n targetDataSiloId: string;\n actions: RequestAction[];\n skipRequestCount: boolean;\n pageLimit: number;\n chunkSize: number;\n}\n\nexport async function pullProfiles(\n this: LocalContext,\n {\n file,\n fileTarget,\n transcendUrl,\n auth,\n sombraAuth,\n cronDataSiloId,\n targetDataSiloId,\n actions,\n skipRequestCount,\n pageLimit,\n chunkSize,\n }: PullProfilesCommandFlags,\n): Promise<void> {\n if (skipRequestCount) {\n logger.info(\n colors.yellow(\n 'Skipping request count as requested. This may help speed up the call.',\n ),\n );\n }\n\n if (\n Number.isNaN(chunkSize) ||\n chunkSize <= 0 ||\n chunkSize % pageLimit !== 0\n ) {\n logger.error(\n colors.red(\n `Invalid chunk size: \"${chunkSize}\". Must be a positive integer that is a multiple of ${pageLimit}.`,\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process.exit);\n\n // Create GraphQL client to connect to Transcend backend\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const { baseName, extension } = parseFilePath(file);\n const { baseName: baseNameTarget, extension: extensionTarget } =\n parseFilePath(fileTarget);\n\n let allIdentifiersCount = 0;\n let allTargetIdentifiersCount = 0;\n let fileCount = 0;\n // Create onSave callback to handle chunked processing\n const onSave = async (\n chunkToSave: CsvFormattedIdentifier[],\n ): Promise<void> => {\n // Add to all identifiers\n allIdentifiersCount += chunkToSave.length;\n\n // Get unique request IDs from this chunk\n const requestIds = chunkToSave.map((d) => d.requestId as string);\n const uniqueRequestIds = uniq(requestIds);\n\n // Pull down target identifiers for this chunk\n const chunkedRequestIds = chunk(uniqueRequestIds, pageLimit);\n const results = await map(\n chunkedRequestIds,\n async (requestIds) => {\n logger.info(\n colors.magenta(\n `Fetching target identifiers for ${requestIds.length} requests`,\n ),\n );\n const results = await fetchRequestFilesForRequest(\n client,\n pageLimit * 2,\n {\n requestIds,\n dataSiloIds: [targetDataSiloId],\n },\n );\n return results.map(({ fileName, remoteId }) => {\n if (!remoteId) {\n throw new Error(`Failed to find remoteId for ${fileName}`);\n }\n return {\n RecordId: remoteId,\n Object: fileName\n .replace('.json', '')\n .split('/')\n .pop()\n ?.replace(' Information', ''),\n Comment:\n 'Customer data deletion request submitted via transcend.io',\n };\n });\n },\n // We are grabbing all the request files for the 'pageLimit' # of requests at a time\n {\n concurrency: 1,\n },\n );\n\n allTargetIdentifiersCount += results.flat().length;\n\n // Write the identifiers and target identifiers to CSV\n const headers = uniq(chunkToSave.map((d) => Object.keys(d)).flat());\n const numberedFileName = `${baseName}-${fileCount}${extension}`;\n const numberedFileNameTarget = `${baseNameTarget}-${fileCount}${extensionTarget}`;\n await writeLargeCsv(numberedFileName, chunkToSave, headers);\n logger.info(\n colors.green(\n `Successfully wrote ${chunkToSave.length} identifiers to file \"${file}\"`,\n ),\n );\n\n const targetIdentifiers = results.flat();\n const headers2 = uniq(targetIdentifiers.map((d) => Object.keys(d)).flat());\n await writeLargeCsv(numberedFileNameTarget, targetIdentifiers, headers2);\n logger.info(\n colors.green(\n `Successfully wrote ${targetIdentifiers.length} identifiers to file \"${fileTarget}\"`,\n ),\n );\n\n logger.info(\n colors.blue(\n `Processed chunk of ${chunk.length} identifiers, found ${targetIdentifiers.length} target identifiers`,\n ),\n );\n fileCount += 1;\n };\n\n // Pull down outstanding identifiers using the new chunked function\n await pullChunkedCustomSiloOutstandingIdentifiers({\n dataSiloId: cronDataSiloId,\n auth,\n sombraAuth,\n actions,\n apiPageSize: pageLimit,\n savePageSize: chunkSize,\n onSave,\n transcendUrl,\n skipRequestCount,\n });\n\n logger.info(\n colors.green(\n `Successfully wrote ${allIdentifiersCount} identifiers to file \"${file}\"`,\n ),\n );\n logger.info(\n colors.green(\n `Successfully wrote ${allTargetIdentifiersCount} identifiers to file \"${fileTarget}\"`,\n ),\n );\n}\n"],"mappings":"+XA+BA,eAAsB,EAEpB,CACE,OACA,aACA,eACA,OACA,aACA,iBACA,mBACA,UACA,mBACA,YACA,aAEa,CACX,GACF,EAAA,EAAO,KACL,EAAA,QAAO,OACL,wEACD,CACF,EAID,OAAO,MAAM,EAAU,EACvB,GAAa,GACb,EAAY,IAAc,KAE1B,EAAA,EAAO,MACL,EAAA,QAAO,IACL,wBAAwB,EAAU,sDAAsD,EAAU,GACnG,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAASA,EAAAA,GAA4B,EAAc,EAAK,CACxD,CAAE,WAAU,aAAcC,EAAAA,EAAc,EAAK,CAC7C,CAAE,SAAU,EAAgB,UAAW,GAC3CA,EAAAA,EAAc,EAAW,CAEvB,EAAsB,EACtB,EAA4B,EAC5B,EAAY,EAmFhB,MAAMM,EAAAA,EAA4C,CAChD,WAAY,EACZ,OACA,aACA,UACA,YAAa,EACb,aAAc,EACd,OAxFa,KACb,IACkB,CAElB,GAAuB,EAAY,OAQnC,IAAM,EAAU,MAAML,EAAAA,GADIC,EAAAA,GAHDC,EAAAA,GADN,EAAY,IAAK,GAAM,EAAE,UAAoB,CACvB,CAGS,EAAU,CAG1D,KAAO,KACL,EAAA,EAAO,KACL,EAAA,QAAO,QACL,mCAAmC,EAAW,OAAO,WACtD,CACF,EACe,MAAMC,EAAAA,GACpB,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
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`);require(`./constants-CzmvL6Mw.cjs`),require(`./syncConfigurationToTranscend-DkeLrq-I.cjs`),require(`./enums-BZulhPFa.cjs`);const t=require(`./logger-DQwEYtSS.cjs`);require(`./buildAIIntegrationType-BwuCYR-o.cjs`),require(`./codecs-Bvmb8o9R.cjs`);const n=require(`./readTranscendYaml-Cycz6RxW.cjs`),r=require(`./consent-manager-CJZ5GTmv.cjs`);require(`./uploadConsents-zr1Hg-JE.cjs`);const i=require(`./api-keys-y8Txn6tT.cjs`),a=require(`./done-input-validation-DGckEJ5a.cjs`);let o=require(`node:fs`),s=require(`node:path`),c=require(`colors`);c=e.t(c);function l({consentManagerYmlFolder:e,output:l}){a.t(this.process.exit),(!(0,o.existsSync)(e)||!(0,o.lstatSync)(e).isDirectory())&&(t.t.error(c.default.red(`Folder does not exist: "${e}"`)),this.process.exit(1));let u=r.t(i.n(e).map(t=>{let{"consent-manager":r}=n.r((0,s.join)(e,t));return{name:t,input:r}}));n.a(l,{"business-entities":u}),t.t.info(c.default.green(`Successfully wrote ${u.length} business entities to file "${l}"`))}exports.consentManagersToBusinessEntities=l;
|
|
2
|
-
//# sourceMappingURL=impl-B61wd2KQ.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-B61wd2KQ.cjs","names":["consentManagersToBusinessEntitiesHelper","listFiles","readTranscendYaml"],"sources":["../src/commands/inventory/consent-managers-to-business-entities/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { listFiles } from '../../../lib/api-keys';\nimport { consentManagersToBusinessEntities as consentManagersToBusinessEntitiesHelper } from '../../../lib/consent-manager';\nimport {\n readTranscendYaml,\n writeTranscendYaml,\n} from '../../../lib/readTranscendYaml';\nimport { join } from 'node:path';\n\nimport colors from 'colors';\nimport { logger } from '../../../logger';\nimport { existsSync, lstatSync } from 'node:fs';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface ConsentManagersToBusinessEntitiesCommandFlags {\n consentManagerYmlFolder: string;\n output: string;\n}\n\nexport function consentManagersToBusinessEntities(\n this: LocalContext,\n {\n consentManagerYmlFolder,\n output,\n }: ConsentManagersToBusinessEntitiesCommandFlags,\n): void {\n doneInputValidation(this.process.exit);\n\n // Ensure folder is passed\n if (\n !existsSync(consentManagerYmlFolder) ||\n !lstatSync(consentManagerYmlFolder).isDirectory()\n ) {\n logger.error(\n colors.red(`Folder does not exist: \"${consentManagerYmlFolder}\"`),\n );\n this.process.exit(1);\n }\n\n // Read in each consent manager configuration\n const inputs = listFiles(consentManagerYmlFolder).map((directory) => {\n const { 'consent-manager': consentManager } = readTranscendYaml(\n join(consentManagerYmlFolder, directory),\n );\n return { name: directory, input: consentManager };\n });\n\n // Convert to business entities\n const businessEntities = consentManagersToBusinessEntitiesHelper(inputs);\n\n // write to disk\n writeTranscendYaml(output, {\n 'business-entities': businessEntities,\n });\n\n logger.info(\n colors.green(\n `Successfully wrote ${businessEntities.length} business entities to file \"${output}\"`,\n ),\n );\n}\n"],"mappings":"ilBAmBA,SAAgB,EAEd,CACE,0BACA,UAEI,CACN,EAAA,EAAoB,KAAK,QAAQ,KAAK,EAIpC,EAAA,EAAA,EAAA,YAAY,EAAwB,EACpC,EAAA,EAAA,EAAA,WAAW,EAAwB,CAAC,aAAa,IAEjD,EAAA,EAAO,MACL,EAAA,QAAO,IAAI,2BAA2B,EAAwB,GAAG,CAClE,CACD,KAAK,QAAQ,KAAK,EAAE,EAYtB,IAAM,EAAmBA,EAAAA,EARVC,EAAAA,EAAU,EAAwB,CAAC,IAAK,GAAc,CACnE,GAAM,CAAE,kBAAmB,GAAmBC,EAAAA,GAAAA,EAAAA,EAAAA,MACvC,EAAyB,EAAU,CACzC,CACD,MAAO,CAAE,KAAM,EAAW,MAAO,EAAgB,EACjD,CAGsE,CAGxE,EAAA,EAAmB,EAAQ,CACzB,oBAAqB,EACtB,CAAC,CAEF,EAAA,EAAO,KACL,EAAA,QAAO,MACL,sBAAsB,EAAiB,OAAO,8BAA8B,EAAO,GACpF,CACF"}
|
package/dist/impl-B8rg6CMv.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
require(`./constants-CzmvL6Mw.cjs`);const e=require(`./syncConfigurationToTranscend-DkeLrq-I.cjs`);require(`./enums-BZulhPFa.cjs`),require(`./logger-DQwEYtSS.cjs`),require(`./buildAIIntegrationType-BwuCYR-o.cjs`);const t=require(`./done-input-validation-DGckEJ5a.cjs`);async function n({auth:n,dataSiloId:r,status:i,statuses:a,transcendUrl:o}){t.t(this.process.exit),await e.F({transcendUrl:o,auth:n,status:i,dataSiloId:r,requestStatuses:a})}exports.skipRequestDataSilos=n;
|
|
2
|
-
//# sourceMappingURL=impl-B8rg6CMv.cjs.map
|
package/dist/impl-BIjDq-3S.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
require(`./constants-CzmvL6Mw.cjs`),require(`./syncConfigurationToTranscend-DkeLrq-I.cjs`),require(`./enums-BZulhPFa.cjs`),require(`./logger-DQwEYtSS.cjs`),require(`./buildAIIntegrationType-BwuCYR-o.cjs`),require(`./codecs-Bvmb8o9R.cjs`);const e=require(`./consent-manager-CJZ5GTmv.cjs`);require(`./uploadConsents-zr1Hg-JE.cjs`);const t=require(`./done-input-validation-DGckEJ5a.cjs`);async function n({auth:n,trackerStatus:r,file:i,classifyService:a,transcendUrl:o}){t.t(this.process.exit),await e.s({auth:n,trackerStatus:r,file:i,classifyService:a,transcendUrl:o})}exports.uploadDataFlowsFromCsv=n;
|
|
2
|
-
//# sourceMappingURL=impl-BIjDq-3S.cjs.map
|
package/dist/impl-BPxZw3LN.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`);require(`./constants-CzmvL6Mw.cjs`);const t=require(`./syncConfigurationToTranscend-DkeLrq-I.cjs`);require(`./enums-BZulhPFa.cjs`);const n=require(`./logger-DQwEYtSS.cjs`);require(`./buildAIIntegrationType-BwuCYR-o.cjs`);const r=require(`./pooling-Dw0a42I_.cjs`),i=require(`./done-input-validation-DGckEJ5a.cjs`);let a=require(`colors`);a=e.t(a);async function o(){let e=Number(process.env.WORKER_ID||`0`);n.t.info(`[w${e}] ready pid=${process.pid}`),process.send?.({type:`ready`}),process.on(`message`,async r=>{if(!r||typeof r!=`object`||(r.type===`shutdown`&&process.exit(0),r.type!==`task`))return;let{filePath:i,options:a}=r.payload,{outputDir:o,clearOutputDir:s}=a;try{n.t.info(`[w${e}] processing ${i}`);let{DuckDBInstance:r}=await import(`@duckdb/node-api`);await t.b({filePath:i,outputDir:o,clearOutputDir:s,onProgress:(e,t)=>process.send?.({type:`progress`,payload:{filePath:i,processed:e,total:t}})},r),process.send?.({type:`result`,payload:{ok:!0,filePath:i}})}catch(r){let a=t.O(r);n.t.error(`[w${e}] ERROR ${i}: ${r.stack||a}`),process.send?.({type:`result`,payload:{ok:!1,filePath:i,error:a}})}}),await new Promise(()=>{})}function s(e){return r.r(e)}function c(e){return r.i(e)}const l={renderHeader:s,renderWorkers:c};function u(){return typeof __filename<`u`?__filename:process.argv[1]}async function d(e){i.t(this.process.exit);let{directory:o,outputDir:s,clearOutputDir:c,concurrency:d,viewerMode:f}=e,p=t.x(o,this),{poolSize:m,cpuCount:h}=r.s(d,p.length);n.t.info(a.default.green(`Converting ${p.length} Parquet file(s) → CSV with pool size ${m} (CPU=${h})`));let g=p.map(e=>({filePath:e,options:{outputDir:s,clearOutputDir:c}}));await r.n({title:`Parquet → CSV - ${o}`,baseDir:o||s||process.cwd(),childFlag:r.o,childModulePath:u(),poolSize:m,cpuCount:h,filesTotal:p.length,hooks:{nextTask:()=>g.shift(),taskLabel:e=>e.filePath,initTotals:()=>({}),initSlotProgress:()=>void 0,onProgress:e=>e,onResult:(e,t)=>({totals:e,ok:!!t.ok}),postProcess:async()=>{}},viewerMode:f,render:e=>r.a(e,l,f),extraKeyHandler:({logsBySlot:e,repaint:t,setPaused:n})=>r.t({logsBySlot:e,repaint:t,setPaused:n})})}process.argv.includes(r.o)&&o().catch(e=>{n.t.error(e),process.exit(1)}),exports.parquetToCsv=d;
|
|
2
|
-
//# sourceMappingURL=impl-BPxZw3LN.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-BPxZw3LN.cjs","names":["parquetToCsvOneFile","extractErrorMessage","makeHeader","makeWorkerRows","collectParquetFilesOrExit","computePoolSize","runPool","CHILD_FLAG","dashboardPlugin","createExtraKeyHandler"],"sources":["../src/commands/admin/parquet-to-csv/worker.ts","../src/commands/admin/parquet-to-csv/ui/plugin.ts","../src/commands/admin/parquet-to-csv/impl.ts"],"sourcesContent":["import { parquetToCsvOneFile, extractErrorMessage } from '../../../lib/helpers';\nimport type { ToWorker } from '../../../lib/pooling';\nimport { logger } from '../../../logger';\n\nexport type ParquetTask = {\n /** Absolute path of the Parquet file to convert. */\n filePath: string;\n options: {\n /** Optional directory where CSV output files should be written. */\n outputDir?: string;\n /** Whether to clear any pre-existing output before writing new ones. */\n clearOutputDir: boolean;\n };\n};\n\nexport type ParquetProgress = {\n /** File being processed by the worker. */\n filePath: string;\n /** Rows processed so far. */\n processed: number;\n /** Optional known total rows (not always available). */\n total?: number;\n};\n\nexport type ParquetResult = {\n ok: boolean;\n filePath: string;\n error?: string;\n};\n\n/**\n * Worker loop: convert a single Parquet file to one or more CSV files.\n */\nexport async function runChild(): Promise<void> {\n const workerId = Number(process.env.WORKER_ID || '0');\n logger.info(`[w${workerId}] ready pid=${process.pid}`);\n process.send?.({ type: 'ready' });\n\n process.on('message', async (msg: ToWorker<ParquetTask>) => {\n if (!msg || typeof msg !== 'object') return;\n\n if (msg.type === 'shutdown') {\n process.exit(0);\n }\n if (msg.type !== 'task') return;\n\n const { filePath, options } = msg.payload;\n const { outputDir, clearOutputDir } = options;\n\n try {\n logger.info(`[w${workerId}] processing ${filePath}`);\n const { DuckDBInstance } = await import('@duckdb/node-api');\n await parquetToCsvOneFile(\n {\n filePath,\n outputDir,\n clearOutputDir,\n onProgress: (processed, total) =>\n process.send?.({\n type: 'progress',\n payload: { filePath, processed, total },\n }),\n },\n DuckDBInstance,\n );\n\n process.send?.({\n type: 'result',\n payload: { ok: true, filePath },\n });\n } catch (err) {\n const message = extractErrorMessage(err);\n logger.error(`[w${workerId}] ERROR ${filePath}: ${err.stack || message}`);\n process.send?.({\n type: 'result',\n payload: { ok: false, filePath, error: message },\n });\n }\n });\n\n // keep alive until shutdown\n await new Promise<never>(() => {\n // Do nothing\n });\n}\n","import {\n makeHeader,\n makeWorkerRows,\n type ChunkSlotProgress,\n type CommonCtx,\n type DashboardPlugin,\n} from '../../../../lib/pooling';\n\n/**\n * Header for parquet-to-csv (no extra totals block).\n *\n * @param ctx - Dashboard context.\n * @returns Header lines.\n */\nfunction renderHeader<TTotals>(\n ctx: CommonCtx<TTotals, ChunkSlotProgress>,\n): string[] {\n // no extra lines — reuse the shared header as-is\n return makeHeader(ctx);\n}\n\n/**\n * Worker rows for parquet-to-csv — share the generic row renderer.\n *\n * @param ctx - Dashboard context.\n * @returns Array of strings, each representing one worker row.\n */\nfunction renderWorkers<TTotals>(\n ctx: CommonCtx<TTotals, ChunkSlotProgress>,\n): string[] {\n return makeWorkerRows(ctx);\n}\n\nexport const parquetToCsvPlugin: DashboardPlugin<unknown, ChunkSlotProgress> = {\n renderHeader,\n renderWorkers,\n // no extras\n};\n","import type { LocalContext } from '../../../context';\nimport colors from 'colors';\nimport { logger } from '../../../logger';\nimport { collectParquetFilesOrExit } from '../../../lib/helpers';\nimport {\n computePoolSize,\n createExtraKeyHandler,\n CHILD_FLAG,\n type PoolHooks,\n runPool,\n dashboardPlugin,\n} from '../../../lib/pooling';\nimport {\n runChild,\n type ParquetProgress,\n type ParquetResult,\n type ParquetTask,\n} from './worker';\nimport { parquetToCsvPlugin } from './ui';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\n/**\n * Returns the current module's path so the worker pool knows what file to re-exec.\n * In Node ESM, __filename is undefined, so we fall back to argv[1].\n *\n * @returns The current module's path.\n */\nfunction getCurrentModulePath(): string {\n if (typeof __filename !== 'undefined') {\n return __filename as unknown as string;\n }\n return process.argv[1];\n}\n\n/** No custom totals for the header; the runner’s built-ins suffice. */\ntype Totals = Record<string, never>;\n\nexport type ParquetToCsvCommandFlags = {\n directory: string;\n outputDir?: string;\n clearOutputDir: boolean;\n concurrency?: number;\n viewerMode: boolean;\n};\n\n/**\n * Convert all Parquet files in a directory to CSV, in parallel.\n *\n * @param flags - The command flags.\n */\nexport async function parquetToCsv(\n this: LocalContext,\n flags: ParquetToCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const { directory, outputDir, clearOutputDir, concurrency, viewerMode } =\n flags;\n\n /* 1) Discover .parquet inputs */\n const files = collectParquetFilesOrExit(directory, this);\n\n /* 2) Size the pool */\n const { poolSize, cpuCount } = computePoolSize(concurrency, files.length);\n\n logger.info(\n colors.green(\n `Converting ${files.length} Parquet file(s) → CSV with pool size ${poolSize} (CPU=${cpuCount})`,\n ),\n );\n\n /* 3) Build FIFO queue of tasks (one per file) */\n const queue = files.map<ParquetTask>((filePath) => ({\n filePath,\n options: { outputDir, clearOutputDir },\n }));\n\n /* 4) Pool hooks */\n const hooks: PoolHooks<ParquetTask, ParquetProgress, ParquetResult, Totals> =\n {\n nextTask: () => queue.shift(),\n taskLabel: (t) => t.filePath,\n initTotals: () => ({} as Totals),\n initSlotProgress: () => undefined,\n onProgress: (totals) => totals,\n onResult: (totals, res) => ({ totals, ok: !!res.ok }),\n postProcess: async () => {\n // nothing special post-run\n },\n };\n\n /* 5) Launch the pool runner with custom dashboard plugin */\n await runPool({\n title: `Parquet → CSV - ${directory}`,\n baseDir: directory || outputDir || process.cwd(),\n childFlag: CHILD_FLAG,\n childModulePath: getCurrentModulePath(),\n poolSize,\n cpuCount,\n filesTotal: files.length,\n hooks,\n viewerMode,\n render: (input) => dashboardPlugin(input, parquetToCsvPlugin, viewerMode),\n extraKeyHandler: ({ logsBySlot, repaint, setPaused }) =>\n createExtraKeyHandler({ logsBySlot, repaint, setPaused }),\n });\n}\n\n/* -------------------------------------------------------------------------------------------------\n * If invoked directly as a child process, enter worker loop\n * ------------------------------------------------------------------------------------------------- */\nif (process.argv.includes(CHILD_FLAG)) {\n runChild().catch((err) => {\n logger.error(err);\n process.exit(1);\n });\n}\n"],"mappings":"kYAiCA,eAAsB,GAA0B,CAC9C,IAAM,EAAW,OAAO,QAAQ,IAAI,WAAa,IAAI,CACrD,EAAA,EAAO,KAAK,KAAK,EAAS,cAAc,QAAQ,MAAM,CACtD,QAAQ,OAAO,CAAE,KAAM,QAAS,CAAC,CAEjC,QAAQ,GAAG,UAAW,KAAO,IAA+B,CAM1D,GALI,CAAC,GAAO,OAAO,GAAQ,WAEvB,EAAI,OAAS,YACf,QAAQ,KAAK,EAAE,CAEb,EAAI,OAAS,QAAQ,OAEzB,GAAM,CAAE,WAAU,WAAY,EAAI,QAC5B,CAAE,YAAW,kBAAmB,EAEtC,GAAI,CACF,EAAA,EAAO,KAAK,KAAK,EAAS,eAAe,IAAW,CACpD,GAAM,CAAE,kBAAmB,MAAM,OAAO,oBACxC,MAAMA,EAAAA,EACJ,CACE,WACA,YACA,iBACA,YAAa,EAAW,IACtB,QAAQ,OAAO,CACb,KAAM,WACN,QAAS,CAAE,WAAU,YAAW,QAAO,CACxC,CAAC,CACL,CACD,EACD,CAED,QAAQ,OAAO,CACb,KAAM,SACN,QAAS,CAAE,GAAI,GAAM,WAAU,CAChC,CAAC,OACK,EAAK,CACZ,IAAM,EAAUC,EAAAA,EAAoB,EAAI,CACxC,EAAA,EAAO,MAAM,KAAK,EAAS,UAAU,EAAS,IAAI,EAAI,OAAS,IAAU,CACzE,QAAQ,OAAO,CACb,KAAM,SACN,QAAS,CAAE,GAAI,GAAO,WAAU,MAAO,EAAS,CACjD,CAAC,GAEJ,CAGF,MAAM,IAAI,YAAqB,GAE7B,CCrEJ,SA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,CACjB,QAAQ,KAAK,EAAE,EACf"}
|
package/dist/impl-BczOEWXK.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`);require(`./constants-CzmvL6Mw.cjs`);const t=require(`./syncConfigurationToTranscend-DkeLrq-I.cjs`),n=require(`./dataFlowsToDataSilos-B7nTxawV.cjs`);require(`./enums-BZulhPFa.cjs`);const r=require(`./logger-DQwEYtSS.cjs`);require(`./buildAIIntegrationType-BwuCYR-o.cjs`),require(`./codecs-Bvmb8o9R.cjs`);const i=require(`./readTranscendYaml-Cycz6RxW.cjs`),a=require(`./api-keys-y8Txn6tT.cjs`),o=require(`./done-input-validation-DGckEJ5a.cjs`);let s=require(`node:fs`),c=require(`node:path`),l=require(`colors`);l=e.t(l);async function u({auth:e,dataFlowsYmlFolder:u,output:d,ignoreYmls:f=[],transcendUrl:p}){o.t(this.process.exit),(!(0,s.existsSync)(u)||!(0,s.lstatSync)(u).isDirectory())&&(r.t.error(l.default.red(`Folder does not exist: "${u}"`)),this.process.exit(1));let m=f.map(e=>e.split(`.`)[0]),h=a.n(u).map(e=>{let{"data-flows":t=[]}=i.r((0,c.join)(u,e)),{adTechDataSilos:r,siteTechDataSilos:a}=n.t(t,{serviceToSupportedIntegration:x,serviceToTitle:b});return{adTechDataSilos:r,siteTechDataSilos:a,organizationName:e.split(`.`)[0]}}),g={};h.forEach(({adTechDataSilos:e,siteTechDataSilos:t,organizationName:n})=>{[...e,...t].forEach(e=>{let t=e[`outer-type`]||e.integrationName;g[t]||(g[t]=[]),g[t].push(n),g[t]=[...new Set(g[t])]})});let _=[...new Set(h.map(({adTechDataSilos:e})=>e.map(e=>e[`outer-type`]||e.integrationName)).flat())],v=t.Is([...new Set(h.map(({siteTechDataSilos:e})=>e.map(e=>e[`outer-type`]||e.integrationName)).flat())],_),y={};h.forEach(({adTechDataSilos:e,siteTechDataSilos:t})=>{[...e,...t].forEach(e=>{let t=e[`outer-type`]||e.integrationName,n=e.attributes?.find(e=>e.key===`Found On Domain`);y[t]||(y[t]=[]),y[t].push(...n?.values||[]),y[t]=[...new Set(y[t])]})});let{serviceToTitle:b,serviceToSupportedIntegration:x}=await t.or(t.ai(p,e)),S=[..._,...v].map(e=>({title:b[e],...x[e]?{integrationName:e}:{integrationName:`promptAPerson`,"outer-type":e},attributes:[{key:`Tech Type`,values:[`Ad Tech`]},{key:`Business Units`,values:t.Is(g[e]||[],m)},{key:`Found On Domain`,values:y[e]||[]}]}));r.t.log(`Total Services: ${S.length}`),r.t.log(`Ad Tech Services: ${_.length}`),r.t.log(`Site Tech Services: ${v.length}`),i.a(d,{"data-silos":S})}exports.deriveDataSilosFromDataFlowsCrossInstance=u;
|
|
2
|
-
//# sourceMappingURL=impl-BczOEWXK.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-BczOEWXK.cjs","names":["listFiles","readTranscendYaml","dataFlowsToDataSilos","difference","fetchAndIndexCatalogs","buildTranscendGraphQLClient"],"sources":["../src/commands/inventory/derive-data-silos-from-data-flows-cross-instance/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport {\n fetchAndIndexCatalogs,\n buildTranscendGraphQLClient,\n} from '../../../lib/graphql';\nimport { join } from 'node:path';\nimport { difference } from 'lodash-es';\nimport colors from 'colors';\nimport { logger } from '../../../logger';\nimport { dataFlowsToDataSilos } from '../../../lib/consent-manager/dataFlowsToDataSilos';\nimport { DataFlowInput } from '../../../codecs';\nimport { existsSync, lstatSync } from 'node:fs';\nimport { listFiles } from '../../../lib/api-keys';\nimport {\n readTranscendYaml,\n writeTranscendYaml,\n} from '../../../lib/readTranscendYaml';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface DeriveDataSilosFromDataFlowsCrossInstanceCommandFlags {\n auth: string;\n dataFlowsYmlFolder: string;\n output: string;\n ignoreYmls?: string[];\n transcendUrl: string;\n}\n\nexport async function deriveDataSilosFromDataFlowsCrossInstance(\n this: LocalContext,\n {\n auth,\n dataFlowsYmlFolder,\n output,\n ignoreYmls = [],\n transcendUrl,\n }: DeriveDataSilosFromDataFlowsCrossInstanceCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Ensure folder is passed\n if (\n !existsSync(dataFlowsYmlFolder) ||\n !lstatSync(dataFlowsYmlFolder).isDirectory()\n ) {\n logger.error(colors.red(`Folder does not exist: \"${dataFlowsYmlFolder}\"`));\n this.process.exit(1);\n }\n\n // Ignore the data flows in these yml files\n const instancesToIgnore = ignoreYmls.map((x) => x.split('.')[0]);\n\n // Map over each data flow yml file and convert to data silo configurations\n const dataSiloInputs = listFiles(dataFlowsYmlFolder).map((directory) => {\n // read in the data flows for a specific instance\n const { 'data-flows': dataFlows = [] } = readTranscendYaml(\n join(dataFlowsYmlFolder, directory),\n );\n\n // map the data flows to data silos\n const { adTechDataSilos, siteTechDataSilos } = dataFlowsToDataSilos(\n dataFlows as DataFlowInput[],\n {\n serviceToSupportedIntegration,\n serviceToTitle,\n },\n );\n\n return {\n adTechDataSilos,\n siteTechDataSilos,\n organizationName: directory.split('.')[0],\n };\n });\n\n // Mapping from service name to instances that have that service\n const serviceToInstance: { [k in string]: string[] } = {};\n dataSiloInputs.forEach(\n ({ adTechDataSilos, siteTechDataSilos, organizationName }) => {\n const allDataSilos = [...adTechDataSilos, ...siteTechDataSilos];\n allDataSilos.forEach((dataSilo) => {\n const service = dataSilo['outer-type'] || dataSilo.integrationName;\n // create mapping to instance\n if (!serviceToInstance[service]) {\n serviceToInstance[service] = [];\n }\n serviceToInstance[service]!.push(organizationName);\n serviceToInstance[service] = [...new Set(serviceToInstance[service])];\n });\n },\n );\n\n // List of ad tech integrations\n const adTechIntegrations = [\n ...new Set(\n dataSiloInputs\n .map(({ adTechDataSilos }) =>\n adTechDataSilos.map(\n (silo) => silo['outer-type'] || silo.integrationName,\n ),\n )\n .flat(),\n ),\n ];\n\n // List of site tech integrations\n const siteTechIntegrations = difference(\n [\n ...new Set(\n dataSiloInputs\n .map(({ siteTechDataSilos }) =>\n siteTechDataSilos.map(\n (silo) => silo['outer-type'] || silo.integrationName,\n ),\n )\n .flat(),\n ),\n ],\n adTechIntegrations,\n );\n\n // Mapping from service name to list of\n const serviceToFoundOnDomain: { [k in string]: string[] } = {};\n dataSiloInputs.forEach(({ adTechDataSilos, siteTechDataSilos }) => {\n const allDataSilos = [...adTechDataSilos, ...siteTechDataSilos];\n allDataSilos.forEach((dataSilo) => {\n const service = dataSilo['outer-type'] || dataSilo.integrationName;\n const foundOnDomain = dataSilo.attributes?.find(\n (attr) => attr.key === 'Found On Domain',\n );\n // create mapping to instance\n if (!serviceToFoundOnDomain[service]) {\n serviceToFoundOnDomain[service] = [];\n }\n serviceToFoundOnDomain[service]!.push(...(foundOnDomain?.values || []));\n serviceToFoundOnDomain[service] = [\n ...new Set(serviceToFoundOnDomain[service]),\n ];\n });\n });\n\n // Fetch all integrations in the catalog\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const { serviceToTitle, serviceToSupportedIntegration } =\n await fetchAndIndexCatalogs(client);\n\n // construct the aggregated data silo inputs\n const dataSilos = [...adTechIntegrations, ...siteTechIntegrations].map(\n (service) => ({\n title: serviceToTitle[service],\n ...(serviceToSupportedIntegration[service]\n ? { integrationName: service }\n : { integrationName: 'promptAPerson', 'outer-type': service }),\n attributes: [\n {\n key: 'Tech Type',\n values: ['Ad Tech'],\n },\n {\n key: 'Business Units',\n values: difference(\n serviceToInstance[service] || [],\n instancesToIgnore,\n ),\n },\n {\n key: 'Found On Domain',\n values: serviceToFoundOnDomain[service] || [],\n },\n ],\n }),\n );\n\n // Log output\n logger.log(`Total Services: ${dataSilos.length}`);\n logger.log(`Ad Tech Services: ${adTechIntegrations.length}`);\n logger.log(`Site Tech Services: ${siteTechIntegrations.length}`);\n\n // Write to yaml\n writeTranscendYaml(output, {\n 'data-silos': dataSilos,\n });\n}\n"],"mappings":"+iBA2BA,eAAsB,EAEpB,CACE,O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GK,EAAsD,EAAE,CAC9D,EAAe,SAAS,CAAE,kBAAiB,uBAAwB,CAC5C,CAAC,GAAG,EAAiB,GAAG,EAAkB,CAClD,QAAS,GAAa,CACjC,IAAM,EAAU,EAAS,eAAiB,EAAS,gBAC7C,EAAgB,EAAS,YAAY,KACxC,GAAS,EAAK,MAAQ,kBACxB,CAEI,EAAuB,KAC1B,EAAuB,GAAW,EAAE,EAEtC,EAAuB,GAAU,KAAK,GAAI,GAAe,QAAU,EAAE,CAAE,CACvE,EAAuB,GAAW,CAChC,GAAG,IAAI,IAAI,EAAuB,GAAS,CAC5C,EACD,EACF,CAIF,GAAM,CAAE,iBAAgB,iCACtB,MAAMC,EAAAA,GAFOC,EAAAA,GAA4B,EAAc,EAAK,CAEzB,CAG/B,EAAY,CAAC,GAAG,EAAoB,GAAG,EAAqB,CAAC,IAChE,IAAa,CACZ,MAAO,EAAe,GACtB,GAAI,EAA8B,GAC9B,CAAE,gBAAiB,EAAS,CAC5B,CAAE,gBAAiB,gBAAiB,aAAc,EAAS,CAC/D,WAAY,CACV,CACE,IAAK,YACL,OAAQ,CAAC,UAAU,CACpB,CACD,CACE,IAAK,iBACL,OAAQF,EAAAA,GACN,EAAkB,IAAY,EAAE,CAChC,EACD,CACF,CACD,CACE,IAAK,kBACL,OAAQ,EAAuB,IAAY,EAAE,CAC9C,CACF,CACF,EACF,CAGD,EAAA,EAAO,IAAI,mBAAmB,EAAU,SAAS,CACjD,EAAA,EAAO,IAAI,qBAAqB,EAAmB,SAAS,CAC5D,EAAA,EAAO,IAAI,uBAAuB,EAAqB,SAAS,CAGhE,EAAA,EAAmB,EAAQ,CACzB,aAAc,EACf,CAAC"}
|
package/dist/impl-BeUsmMIp.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
require(`./constants-CzmvL6Mw.cjs`);const e=require(`./syncConfigurationToTranscend-DkeLrq-I.cjs`);require(`./enums-BZulhPFa.cjs`),require(`./logger-DQwEYtSS.cjs`),require(`./buildAIIntegrationType-BwuCYR-o.cjs`);const t=require(`./done-input-validation-DGckEJ5a.cjs`);async function n({auth:n,requestReceiptFolder:r,sombraAuth:i,actions:a,statuses:o,requestIds:s,createdAt:c,emailIsVerified:l,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:f,skipWaitingPeriod:p,createdAtBefore:m,createdAtAfter:h,updatedAtBefore:g,updatedAtAfter:_,concurrency:v,transcendUrl:y}){t.t(this.process.exit),await e.H({requestReceiptFolder:r,auth:n,sombraAuth:i,requestActions:a,requestStatuses:o,requestIds:s,createdAt:c,emailIsVerified:l,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:f,skipWaitingPeriod:p,createdAtBefore:m,createdAtAfter:h,updatedAtBefore:g,updatedAtAfter:_,concurrency:v,transcendUrl:y})}exports.restart=n;
|
|
2
|
-
//# sourceMappingURL=impl-BeUsmMIp.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-BeUsmMIp.cjs","names":["bulkRestartRequests"],"sources":["../src/commands/request/restart/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { bulkRestartRequests } from '../../../lib/requests';\nimport type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface RestartCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses: RequestStatus[];\n transcendUrl: string;\n requestReceiptFolder: string;\n sombraAuth?: string;\n concurrency: number;\n requestIds?: string[];\n emailIsVerified: boolean;\n createdAt?: Date;\n silentModeBefore?: Date;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n sendEmailReceipt: boolean;\n copyIdentifiers: boolean;\n skipWaitingPeriod: boolean;\n}\n\nexport async function restart(\n this: LocalContext,\n {\n auth,\n requestReceiptFolder,\n sombraAuth,\n actions,\n statuses,\n requestIds,\n createdAt,\n emailIsVerified,\n silentModeBefore,\n sendEmailReceipt,\n copyIdentifiers,\n skipWaitingPeriod,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n transcendUrl,\n }: RestartCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await bulkRestartRequests({\n requestReceiptFolder,\n auth,\n sombraAuth,\n requestActions: actions,\n requestStatuses: statuses,\n requestIds,\n createdAt,\n emailIsVerified,\n silentModeBefore,\n sendEmailReceipt,\n copyIdentifiers,\n skipWaitingPeriod,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n transcendUrl,\n });\n}\n"],"mappings":"6QA0BA,eAAsB,EAEpB,CACE,OACA,uBACA,aACA,UACA,WACA,aACA,YACA,kBACA,mBACA,mBACA,kBACA,oBACA,kBACA,iBACA,kBACA,iBACA,cACA,gBAEa,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAAAA,EAAoB,CACxB,uBACA,OACA,aACA,eAAgB,EAChB,gBAAiB,EACjB,aACA,YACA,kBACA,mBACA,mBACA,kBACA,oBACA,kBACA,iBACA,kBACA,iBACA,cACA,eACD,CAAC"}
|
package/dist/impl-Bhv353rp.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./constants-CzmvL6Mw.cjs`),n=require(`./syncConfigurationToTranscend-DkeLrq-I.cjs`);require(`./enums-BZulhPFa.cjs`);const r=require(`./logger-DQwEYtSS.cjs`);require(`./buildAIIntegrationType-BwuCYR-o.cjs`);const i=require(`./data-inventory-D0Tt_vAm.cjs`),a=require(`./done-input-validation-DGckEJ5a.cjs`);let o=require(`colors`);o=e.t(o);async function s({auth:e,file:s,transcendUrl:c,dataSiloIds:l,includeAttributes:u,includeGuessedCategories:d,parentCategories:f,subCategories:p=[]}){a.t(this.process.exit);try{let t=await i.n(n.ai(c,e),{dataSiloIds:l,includeGuessedCategories:d,parentCategories:f,includeAttributes:u,subCategories:p});r.t.info(o.default.magenta(`Writing datapoints to file "${s}"...`));let a=[];await n.d(s,t.map(e=>{let t={"Property ID":e.id,"Data Silo":e.dataSilo.title,Object:e.dataPoint.name,"Object Path":e.dataPoint.path.join(`.`),Property:e.name,"Property Description":e.description,"Data Categories":e.categories.map(e=>`${e.category}:${e.name}`).join(`, `),"Guessed Category":e.pendingCategoryGuesses?.[0]?`${e.pendingCategoryGuesses[0].category.category}:${e.pendingCategoryGuesses[0].category.name}`:``,"Processing Purposes":e.purposes.map(e=>`${e.purpose}:${e.name}`).join(`, `),...Object.entries(n.Fs(e.attributeValues||[],({attributeKey:e})=>e.name)).reduce((e,[t,n])=>(e[t]=n.map(e=>e.name).join(`,`),e),{})};return a=n.Ms([...a,...Object.keys(t)]),t}),a)}catch(e){r.t.error(o.default.red(`An error occurred syncing the datapoints: ${e.message}`)),this.process.exit(1)}r.t.info(o.default.green(`Successfully synced datapoints to disk at ${s}! View at ${t.n}`))}exports.pullDatapoints=s;
|
|
2
|
-
//# sourceMappingURL=impl-Bhv353rp.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-Bhv353rp.cjs","names":["pullAllDatapoints","buildTranscendGraphQLClient","writeLargeCsv","groupBy","uniq","ADMIN_DASH_DATAPOINTS"],"sources":["../src/commands/inventory/pull-datapoints/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { uniq, groupBy } from 'lodash-es';\n\nimport { logger } from '../../../logger';\nimport colors from 'colors';\nimport { buildTranscendGraphQLClient } from '../../../lib/graphql';\nimport { ADMIN_DASH_DATAPOINTS } from '../../../constants';\nimport { pullAllDatapoints } from '../../../lib/data-inventory';\nimport { DataCategoryType } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\nimport { writeLargeCsv } from '../../../lib/helpers';\n\nexport interface PullDatapointsCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n includeAttributes: boolean;\n includeGuessedCategories: boolean;\n parentCategories?: DataCategoryType[];\n subCategories?: string[];\n}\n\nexport async function pullDatapoints(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n dataSiloIds,\n includeAttributes,\n includeGuessedCategories,\n parentCategories,\n subCategories = [],\n }: PullDatapointsCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const dataPoints = await pullAllDatapoints(client, {\n dataSiloIds,\n includeGuessedCategories,\n parentCategories,\n includeAttributes,\n subCategories, // TODO: https://transcend.height.app/T-40482 - do by name not ID\n });\n\n logger.info(colors.magenta(`Writing datapoints to file \"${file}\"...`));\n let headers: string[] = [];\n const inputs = dataPoints.map((point) => {\n const result = {\n 'Property ID': point.id,\n 'Data Silo': point.dataSilo.title,\n Object: point.dataPoint.name,\n 'Object Path': point.dataPoint.path.join('.'),\n Property: point.name,\n 'Property Description': point.description,\n 'Data Categories': point.categories\n .map((category) => `${category.category}:${category.name}`)\n .join(', '),\n 'Guessed Category': point.pendingCategoryGuesses?.[0]\n ? `${point.pendingCategoryGuesses![0]!.category.category}:${\n point.pendingCategoryGuesses![0]!.category.name\n }`\n : '',\n 'Processing Purposes': point.purposes\n .map((purpose) => `${purpose.purpose}:${purpose.name}`)\n .join(', '),\n ...Object.entries(\n groupBy(\n point.attributeValues || [],\n ({ attributeKey }) => attributeKey.name,\n ),\n ).reduce((acc, [key, values]) => {\n acc[key] = values.map((value) => value.name).join(',');\n return acc;\n }, {} as Record<string, string>),\n };\n headers = uniq([...headers, ...Object.keys(result)]);\n return result;\n });\n await writeLargeCsv(file, inputs, headers);\n } catch (err) {\n logger.error(\n colors.red(`An error occurred syncing the datapoints: ${err.message}`),\n );\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced datapoints to disk at ${file}! View at ${ADMIN_DASH_DATAPOINTS}`,\n ),\n );\n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,EAAA,EAAO,MACL,EAAA,QAAO,IAAI,6CAA6C,EAAI,UAAU,CACvE,CACD,KAAK,QAAQ,KAAK,EAAE,CAItB,EAAA,EAAO,KACL,EAAA,QAAO,MACL,6CAA6C,EAAK,YAAYC,EAAAA,IAC/D,CACF"}
|
package/dist/impl-BiPKUZQ2.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
require(`./constants-CzmvL6Mw.cjs`),require(`./syncConfigurationToTranscend-DkeLrq-I.cjs`),require(`./enums-BZulhPFa.cjs`),require(`./logger-DQwEYtSS.cjs`),require(`./buildAIIntegrationType-BwuCYR-o.cjs`);const e=require(`./manual-enrichment-CW8iihdb.cjs`),t=require(`./done-input-validation-DGckEJ5a.cjs`);async function n({auth:n,transcendUrl:r,file:i,concurrency:a,actions:o,sombraAuth:s}){t.t(this.process.exit),await e.i({file:i,transcendUrl:r,concurrency:a,requestActions:o,auth:n,sombraAuth:s})}exports.pullIdentifiers=n;
|
|
2
|
-
//# sourceMappingURL=impl-BiPKUZQ2.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-BiPKUZQ2.cjs","names":["pullManualEnrichmentIdentifiersToCsv"],"sources":["../src/commands/request/preflight/pull-identifiers/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context';\nimport { pullManualEnrichmentIdentifiersToCsv } from '../../../../lib/manual-enrichment';\nimport type { RequestAction } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nexport interface PullIdentifiersCommandFlags {\n auth: string;\n sombraAuth?: string;\n transcendUrl: string;\n file: string;\n actions?: RequestAction[];\n concurrency: number;\n}\n\nexport async function pullIdentifiers(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n file,\n concurrency,\n actions,\n sombraAuth,\n }: PullIdentifiersCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await pullManualEnrichmentIdentifiersToCsv({\n file,\n transcendUrl,\n concurrency,\n requestActions: actions,\n auth,\n sombraAuth,\n });\n}\n"],"mappings":"mTAcA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,cACA,UACA,cAEa,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAAAA,EAAqC,CACzC,OACA,eACA,cACA,eAAgB,EAChB,OACA,aACD,CAAC"}
|
package/dist/impl-BvrbCovf.cjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`);require(`./constants-CzmvL6Mw.cjs`);const t=require(`./syncConfigurationToTranscend-DkeLrq-I.cjs`);require(`./enums-BZulhPFa.cjs`);const n=require(`./logger-DQwEYtSS.cjs`);require(`./buildAIIntegrationType-BwuCYR-o.cjs`);const r=require(`./done-input-validation-DGckEJ5a.cjs`),i=require(`./preference-management-CkmW6Z91.cjs`);let a=require(`node:fs`),o=require(`node:path`),s=require(`colors`);s=e.t(s);let c=require(`cli-progress`);c=e.t(c);async function l({auth:e,partition:l,sombraAuth:u,file:d=``,directory:f,transcendUrl:p,timestamp:m,maxConcurrency:h,maxItemsInChunk:g,receiptDirectory:_,fileConcurrency:v}){f&&d&&(n.t.error(s.default.red(`Cannot provide both a directory and a file. Please provide only one.`)),this.process.exit(1)),!d&&!f&&(n.t.error(s.default.red(`A file or directory must be provided. Please provide one using --file=./preferences.csv or --directory=./preferences`)),this.process.exit(1)),r.t(this.process.exit);let y=[];if(f)try{let e=(0,a.readdirSync)(f).filter(e=>e.endsWith(`.csv`));e.length===0&&(n.t.error(s.default.red(`No CSV files found in directory: ${f}`)),this.process.exit(1)),y.push(...e.map(e=>(0,o.join)(f,e)))}catch(e){n.t.error(s.default.red(`Failed to read directory: ${f}`)),n.t.error(s.default.red(e.message)),this.process.exit(1)}else try{d.endsWith(`.csv`)||(n.t.error(s.default.red(`File must be a CSV file`)),this.process.exit(1)),y.push(d)}catch(e){n.t.error(s.default.red(`Failed to access file: ${d}`)),n.t.error(s.default.red(e.message)),this.process.exit(1)}n.t.debug(s.default.green(`Processing ${y.length} consent preferences files for partition: ${l}`)),n.t.debug(`\nFiles to process: ${y.join(`, `)}\n`);let b=await t.ii(p,e,u),x=new c.default.SingleBar({format:`Deletion Progress |${s.default.cyan(`[{bar}]`)}| Duration: ${s.default.red(`{duration_formatted}`)} | {value}/{total} Files Processed `},c.default.Presets.shades_classic);x.start(y.length,0);let S=await t.As(y,async e=>{let t=await i.t(b,{partition:l,filePath:e,timestamp:m,maxItemsInChunk:g,maxConcurrency:h});return x.increment(),t},{concurrency:v});x.stop();let C=S.flat(),w=``;C.length>0&&(w=(0,o.join)(_,`deletion-failures-${Date.now()}.csv`),t.l(w,C,!0)),n.t.info(s.default.green(`
|
|
2
|
-
|
|
3
|
-
==================================
|
|
4
|
-
|
|
5
|
-
`)),n.t.info(s.default.green(`
|
|
6
|
-
#### Deletion Summary Report #####
|
|
7
|
-
`)),n.t.info(s.default.green(`📁 Total Files Processed: ${y.length} \n❌ Errors: ${C.length} \n📝 Receipt Path: ${w||`N/A`}`)),n.t.info(s.default.green(`
|
|
8
|
-
|
|
9
|
-
==================================
|
|
10
|
-
|
|
11
|
-
`))}exports.deletePreferenceRecords=l;
|
|
12
|
-
//# sourceMappingURL=impl-BvrbCovf.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-BvrbCovf.cjs","names":["file","createSombraGotInstance","cliProgress","map","bulkDeletePreferenceRecords"],"sources":["../src/commands/consent/delete-preference-records/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport colors from 'colors';\n\nimport { createSombraGotInstance } from '../../../lib/graphql';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\nimport { logger } from '../../../logger';\nimport { readdirSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { map } from '../../../lib/bluebird';\nimport { bulkDeletePreferenceRecords } from '../../../lib/preference-management';\nimport cliProgress from 'cli-progress';\nimport { writeCsv } from '../../../lib/helpers';\n\nexport interface DeletePreferenceRecordsCommandFlags {\n /** Transcend API key for authentication */\n auth: string;\n /** Partition ID to delete preference records from */\n partition: string;\n /** Optional Sombra internal key for self-hosted instances */\n sombraAuth?: string;\n /** Path to the CSV file used to identify preference records to delete */\n file?: string;\n /** Path to the directory of CSV files to load preferences from */\n directory?: string;\n /** Base URL for the Transcend API */\n transcendUrl: string;\n /** The timestamp when the deletion operation is made. Used for logging purposes. */\n timestamp: Date;\n /** Maximum items to include in each deletion chunk */\n maxItemsInChunk: number;\n /** Maximum concurrency for deletion requests */\n maxConcurrency: number;\n /** Directory to write receipts of failed deletions to */\n receiptDirectory: string;\n /** Number of files to process concurrently when deleting preference records from multiple files */\n fileConcurrency: number;\n}\n\nexport async function deletePreferenceRecords(\n this: LocalContext,\n {\n auth,\n partition,\n sombraAuth,\n file = '',\n directory,\n transcendUrl,\n timestamp,\n maxConcurrency,\n maxItemsInChunk,\n receiptDirectory,\n fileConcurrency,\n }: DeletePreferenceRecordsCommandFlags,\n): Promise<void> {\n if (!!directory && !!file) {\n logger.error(\n colors.red(\n 'Cannot provide both a directory and a file. Please provide only one.',\n ),\n );\n this.process.exit(1);\n }\n\n if (!file && !directory) {\n logger.error(\n colors.red(\n 'A file or directory must be provided. Please provide one using --file=./preferences.csv or --directory=./preferences',\n ),\n );\n this.process.exit(1);\n }\n doneInputValidation(this.process.exit);\n\n const files: string[] = [];\n\n if (directory) {\n try {\n const filesInDirectory = readdirSync(directory);\n const csvFiles = filesInDirectory.filter((file) => file.endsWith('.csv'));\n\n if (csvFiles.length === 0) {\n logger.error(\n colors.red(`No CSV files found in directory: ${directory}`),\n );\n this.process.exit(1);\n }\n\n // Add full paths for each CSV file\n files.push(...csvFiles.map((file) => join(directory, file)));\n } catch (err) {\n logger.error(colors.red(`Failed to read directory: ${directory}`));\n logger.error(colors.red((err as Error).message));\n this.process.exit(1);\n }\n } else {\n try {\n // Verify file exists and is a CSV\n if (!file.endsWith('.csv')) {\n logger.error(colors.red('File must be a CSV file'));\n this.process.exit(1);\n }\n files.push(file);\n } catch (err) {\n logger.error(colors.red(`Failed to access file: ${file}`));\n logger.error(colors.red((err as Error).message));\n this.process.exit(1);\n }\n }\n\n logger.debug(\n colors.green(\n `Processing ${files.length} consent preferences files for partition: ${partition}`,\n ),\n );\n logger.debug(`\\nFiles to process: ${files.join(', ')}\\n`);\n\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, sombraAuth);\n const globalProgressBar = new cliProgress.SingleBar(\n {\n format: `Deletion Progress |${colors.cyan(\n '[{bar}]',\n )}| Duration: ${colors.red(\n '{duration_formatted}',\n )} | {value}/{total} Files Processed `,\n },\n cliProgress.Presets.shades_classic,\n );\n globalProgressBar.start(files.length, 0);\n\n // Process batch of files with concurrency\n const failedResultsArrays = await map(\n files,\n async (filePath) => {\n const result = await bulkDeletePreferenceRecords(sombra, {\n partition,\n filePath,\n timestamp,\n maxItemsInChunk,\n maxConcurrency,\n });\n globalProgressBar.increment();\n return result;\n },\n { concurrency: fileConcurrency },\n );\n globalProgressBar.stop();\n const failedResults = failedResultsArrays.flat();\n\n // Check for failed results and write receipt if any\n let receiptPath = '';\n if (failedResults.length > 0) {\n receiptPath = join(receiptDirectory, `deletion-failures-${Date.now()}.csv`);\n writeCsv(receiptPath, failedResults, true);\n }\n\n logger.info(colors.green('\\n\\n ================================== \\n\\n'));\n logger.info(colors.green('\\n#### Deletion Summary Report #####\\n'));\n logger.info(\n colors.green(\n `📁 Total Files Processed: ${files.length} \\n` +\n `❌ Errors: ${failedResults.length} \\n` +\n `📝 Receipt Path: ${receiptPath || 'N/A'}`,\n ),\n );\n logger.info(colors.green('\\n\\n==================================\\n\\n'));\n}\n"],"mappings":"meAsCA,eAAsB,EAEpB,CACE,OACA,YACA,aACA,OAAO,GACP,YACA,eACA,YACA,iBACA,kBACA,mBACA,mBAEa,CACT,GAAe,IACnB,EAAA,EAAO,MACL,EAAA,QAAO,IACL,uEACD,CACF,CACD,KAAK,Q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sBAAsB,EAAA,QAAO,KACnC,UACD,CAAC,cAAc,EAAA,QAAO,IACrB,uBACD,CAAC,qCACH,CACDA,EAAAA,QAAY,QAAQ,eACrB,CACD,EAAkB,MAAM,EAAM,OAAQ,EAAE,CAGxC,IAAM,EAAsB,MAAMC,EAAAA,GAChC,EACA,KAAO,IAAa,CAClB,IAAM,EAAS,MAAMC,EAAAA,EAA4B,EAAQ,CACvD,YACA,WACA,YACA,kBACA,iBACD,CAAC,CAEF,OADA,EAAkB,WAAW,CACtB,GAET,CAAE,YAAa,EAAiB,CACjC,CACD,EAAkB,MAAM,CACxB,IAAM,EAAgB,EAAoB,MAAM,CAG5C,EAAc,GACd,EAAc,OAAS,IACzB,GAAA,EAAA,EAAA,MAAmB,EAAkB,qBAAqB,KAAK,KAAK,CAAC,MAAM,CAC3E,EAAA,EAAS,EAAa,EAAe,GAAK,EAG5C,EAAA,EAAO,KAAK,EAAA,QAAO,MAAM;;;;EAA+C,CAAC,CACzE,EAAA,EAAO,KAAK,EAAA,QAAO,MAAM;;EAAyC,CAAC,CACnE,EAAA,EAAO,KACL,EAAA,QAAO,MACL,6BAA6B,EAAM,OAAO,eAC3B,EAAc,OAAO,sBACd,GAAe,QACtC,CACF,CACD,EAAA,EAAO,KAAK,EAAA,QAAO,MAAM;;;;EAA6C,CAAC"}
|
package/dist/impl-BxKSXO7j.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
require(`./constants-CzmvL6Mw.cjs`);const e=require(`./syncConfigurationToTranscend-DkeLrq-I.cjs`);require(`./enums-BZulhPFa.cjs`),require(`./logger-DQwEYtSS.cjs`),require(`./buildAIIntegrationType-BwuCYR-o.cjs`);const t=require(`./done-input-validation-DGckEJ5a.cjs`);async function n({auth:n,transcendUrl:r,identifierNames:i,actions:a=[]}){t.t(this.process.exit),await e.P({requestActions:a,transcendUrl:r,auth:n,identifierNames:i})}exports.rejectUnverifiedIdentifiers=n;
|
|
2
|
-
//# sourceMappingURL=impl-BxKSXO7j.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-BxKSXO7j.cjs","names":["removeUnverifiedRequestIdentifiers"],"sources":["../src/commands/request/reject-unverified-identifiers/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { removeUnverifiedRequestIdentifiers } from '../../../lib/requests';\nimport type { RequestAction } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface RejectUnverifiedIdentifiersCommandFlags {\n auth: string;\n identifierNames: string[];\n actions?: RequestAction[];\n transcendUrl: string;\n}\n\nexport async function rejectUnverifiedIdentifiers(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n identifierNames,\n actions = [],\n }: RejectUnverifiedIdentifiersCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await removeUnverifiedRequestIdentifiers({\n requestActions: actions,\n transcendUrl,\n auth,\n identifierNames,\n });\n}\n"],"mappings":"6QAYA,eAAsB,EAEpB,CACE,OACA,eACA,kBACA,UAAU,EAAE,EAEC,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAAAA,EAAmC,CACvC,eAAgB,EAChB,eACA,OACA,kBACD,CAAC"}
|
package/dist/impl-ByavdlGX.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`);require(`./constants-CzmvL6Mw.cjs`);const t=require(`./syncConfigurationToTranscend-DkeLrq-I.cjs`);require(`./enums-BZulhPFa.cjs`);const n=require(`./logger-DQwEYtSS.cjs`);require(`./buildAIIntegrationType-BwuCYR-o.cjs`);const r=require(`./done-input-validation-DGckEJ5a.cjs`),i=require(`./preference-management-CkmW6Z91.cjs`);let a=require(`node:fs`),o=require(`node:path`),s=require(`colors`);s=e.t(s);async function c({auth:e,partition:c,sombraAuth:l,transcendUrl:u,file:d=``,directory:f,dryRun:p,skipExistingRecordCheck:m,receiptFileDir:h,skipWorkflowTriggers:g,forceTriggerWorkflows:_,skipConflictUpdates:v,isSilent:y,attributes:b,concurrency:x}){f&&d&&(n.t.error(s.default.red(`Cannot provide both a directory and a file. Please provide only one.`)),this.process.exit(1)),!d&&!f&&(n.t.error(s.default.red(`A file or directory must be provided. Please provide one using --file=./preferences.csv or --directory=./preferences`)),this.process.exit(1)),r.t(this.process.exit);let S=[];if(f)try{let e=(0,a.readdirSync)(f).filter(e=>e.endsWith(`.csv`));e.length===0&&(n.t.error(s.default.red(`No CSV files found in directory: ${f}`)),this.process.exit(1)),S.push(...e.map(e=>(0,o.join)(f,e)))}catch(e){n.t.error(s.default.red(`Failed to read directory: ${f}`)),n.t.error(s.default.red(e.message)),this.process.exit(1)}else try{d.endsWith(`.csv`)||(n.t.error(s.default.red(`File must be a CSV file`)),this.process.exit(1)),S.push(d)}catch(e){n.t.error(s.default.red(`Failed to access file: ${d}`)),n.t.error(s.default.red(e.message)),this.process.exit(1)}n.t.info(s.default.green(`Processing ${S.length} consent preferences files for partition: ${c}`)),n.t.debug(`Files to process: ${S.join(`, `)}`),m&&n.t.info(s.default.bgYellow(`Skipping existing record check: ${m}`)),await t.As(S,async n=>{await i.a({receiptFilepath:(0,o.join)(h,`${(0,o.basename)(n).replace(`.csv`,``)}-receipts.json`),auth:e,sombraAuth:l,file:n,partition:c,transcendUrl:u,skipConflictUpdates:v,skipWorkflowTriggers:g,skipExistingRecordCheck:m,isSilent:y,dryRun:p,attributes:t.pi(b),forceTriggerWorkflows:_})},{concurrency:x})}exports.uploadPreferences=c;
|
|
2
|
-
//# sourceMappingURL=impl-ByavdlGX.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-ByavdlGX.cjs","names":["file","map","uploadPreferenceManagementPreferencesInteractive","splitCsvToList"],"sources":["../src/commands/consent/upload-preferences/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport colors from 'colors';\n\nimport { logger } from '../../../logger';\nimport { uploadPreferenceManagementPreferencesInteractive } from '../../../lib/preference-management';\nimport { splitCsvToList } from '../../../lib/requests';\nimport { readdirSync } from 'node:fs';\nimport { map } from '../../../lib/bluebird';\nimport { basename, join } from 'node:path';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface UploadPreferencesCommandFlags {\n auth: string;\n partition: string;\n sombraAuth?: string;\n transcendUrl: string;\n file?: string;\n directory?: string;\n dryRun: boolean;\n skipExistingRecordCheck: boolean;\n receiptFileDir: string;\n skipWorkflowTriggers: boolean;\n forceTriggerWorkflows: boolean;\n skipConflictUpdates: boolean;\n isSilent: boolean;\n attributes: string;\n receiptFilepath: string;\n concurrency: number;\n}\n\nexport async function uploadPreferences(\n this: LocalContext,\n {\n auth,\n partition,\n sombraAuth,\n transcendUrl,\n file = '',\n directory,\n dryRun,\n skipExistingRecordCheck,\n receiptFileDir,\n skipWorkflowTriggers,\n forceTriggerWorkflows,\n skipConflictUpdates,\n isSilent,\n attributes,\n concurrency,\n }: UploadPreferencesCommandFlags,\n): Promise<void> {\n if (!!directory && !!file) {\n logger.error(\n colors.red(\n 'Cannot provide both a directory and a file. Please provide only one.',\n ),\n );\n this.process.exit(1);\n }\n\n if (!file && !directory) {\n logger.error(\n colors.red(\n 'A file or directory must be provided. Please provide one using --file=./preferences.csv or --directory=./preferences',\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process.exit);\n\n const files: string[] = [];\n\n if (directory) {\n try {\n const filesInDirectory = readdirSync(directory);\n const csvFiles = filesInDirectory.filter((file) => file.endsWith('.csv'));\n\n if (csvFiles.length === 0) {\n logger.error(\n colors.red(`No CSV files found in directory: ${directory}`),\n );\n this.process.exit(1);\n }\n\n // Add full paths for each CSV file\n files.push(...csvFiles.map((file) => join(directory, file)));\n } catch (err) {\n logger.error(colors.red(`Failed to read directory: ${directory}`));\n logger.error(colors.red((err as Error).message));\n this.process.exit(1);\n }\n } else {\n try {\n // Verify file exists and is a CSV\n if (!file.endsWith('.csv')) {\n logger.error(colors.red('File must be a CSV file'));\n this.process.exit(1);\n }\n files.push(file);\n } catch (err) {\n logger.error(colors.red(`Failed to access file: ${file}`));\n logger.error(colors.red((err as Error).message));\n this.process.exit(1);\n }\n }\n\n logger.info(\n colors.green(\n `Processing ${files.length} consent preferences files for partition: ${partition}`,\n ),\n );\n logger.debug(`Files to process: ${files.join(', ')}`);\n\n if (skipExistingRecordCheck) {\n logger.info(\n colors.bgYellow(\n `Skipping existing record check: ${skipExistingRecordCheck}`,\n ),\n );\n }\n\n await map(\n files,\n async (filePath) => {\n const fileName = basename(filePath).replace('.csv', '');\n await uploadPreferenceManagementPreferencesInteractive({\n receiptFilepath: join(receiptFileDir, `${fileName}-receipts.json`),\n auth,\n sombraAuth,\n file: filePath,\n partition,\n transcendUrl,\n skipConflictUpdates,\n skipWorkflowTriggers,\n skipExistingRecordCheck,\n isSilent,\n dryRun,\n attributes: splitCsvToList(attributes),\n forceTriggerWorkflows,\n });\n },\n { concurrency },\n );\n}\n"],"mappings":"4bA8BA,eAAsB,EAEpB,CACE,OACA,YACA,aACA,eACA,OAAO,GACP,YACA,SACA,0BACA,iBACA,uBACA,wBACA,sBACA,WACA,aACA,eAEa,CACT,GAAe,IACnB,EAAA,EAAO,MACL,EAAA,QAAO,IACL,uEACD,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGlB,CAAC,GAAQ,CAAC,IACZ,EAAA,EAAO,MACL,EAAA,QAAO,IACL,uHACD,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAEtC,IAAM,EAAkB,EAAE,CAE1B,GAAI,EACF,GAAI,CAEF,IAAM,GAAA,EAAA,EAAA,aAD+B,EAAU,CACb,OAAQ,GAASA,EAAK,SAAS,OAAO,CAAC,CAErE,EAAS,SAAW,IACtB,EAAA,EAAO,MACL,EAAA,QAAO,IAAI,oCAAoC,IAAY,CAC5D,CACD,KAAK,QAAQ,KAAK,EAAE,EAItB,EA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eLrq-I.cjs`),require(`./enums-BZulhPFa.cjs`),require(`./logger-DQwEYtSS.cjs`),require(`./buildAIIntegrationType-BwuCYR-o.cjs`),require(`./codecs-Bvmb8o9R.cjs`);const n=require(`./api-keys-y8Txn6tT.cjs`),r=require(`./done-input-validation-DGckEJ5a.cjs`);let i=require(`node:fs`);async function a({email:e,password:a,apiKeyTitle:o,file:s,scopes:c,deleteExistingApiKey:l,createNewApiKey:u,parentOrganizationId:d,transcendUrl:f}){r.t(this.process.exit);let{errors:p,apiKeys:m}=await n.i({transcendUrl:f,password:a,email:e,parentOrganizationId:d,deleteExistingApiKey:l,createNewApiKey:u,apiKeyTitle:o,scopes:c.map(e=>t.c[e].name)});(0,i.writeFileSync)(s,`${JSON.stringify(m,null,2)}\n`),p.length>0&&this.process.exit(1)}exports.generateApiKeys=a;
|
|
2
|
-
//# sourceMappingURL=impl-C6Vv_fyU.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-C6Vv_fyU.cjs","names":["generateCrossAccountApiKeys","SCOPES_BY_TITLE"],"sources":["../src/commands/admin/generate-api-keys/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { writeFileSync } from 'node:fs';\n\nimport { ScopeName } from '@transcend-io/privacy-types';\n\nimport { generateCrossAccountApiKeys } from '../../../lib/api-keys';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\nimport { SCOPES_BY_TITLE } from '../../../constants';\n\n// Command flag interface\nexport interface GenerateApiKeysCommandFlags {\n email: string;\n password: string;\n apiKeyTitle: string;\n file: string;\n scopes: string[];\n deleteExistingApiKey: boolean;\n createNewApiKey: boolean;\n parentOrganizationId?: string;\n transcendUrl: string;\n}\n\n// Command implementation\nexport async function generateApiKeys(\n this: LocalContext,\n {\n email,\n password,\n apiKeyTitle,\n file,\n scopes,\n deleteExistingApiKey,\n createNewApiKey,\n parentOrganizationId,\n transcendUrl,\n }: GenerateApiKeysCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const scopeNames = scopes.map(\n (scopeTitle) => SCOPES_BY_TITLE[scopeTitle].name as ScopeName,\n );\n\n // Upload privacy requests\n const { errors, apiKeys } = await generateCrossAccountApiKeys({\n transcendUrl,\n password,\n email,\n parentOrganizationId,\n deleteExistingApiKey,\n createNewApiKey,\n apiKeyTitle,\n scopes: scopeNames,\n });\n\n // Write to disk\n writeFileSync(file, `${JSON.stringify(apiKeys, null, 2)}\\n`);\n if (errors.length > 0) {\n this.process.exit(1);\n }\n}\n"],"mappings":"8YAuBA,eAAsB,EAEpB,CACE,QACA,WACA,cACA,OACA,SACA,uBACA,kBACA,uBACA,gBAEa,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAOtC,GAAM,CAAE,SAAQ,WAAY,MAAMA,EAAAA,EAA4B,CAC5D,eACA,WACA,QACA,uBACA,uBACA,kBACA,cACA,OAbiB,EAAO,IACvB,GAAeC,EAAAA,EAAgB,GAAY,KAC7C,CAYA,CAAC,EAGF,EAAA,EAAA,eAAc,EAAM,GAAG,KAAK,UAAU,EAAS,KAAM,EAAE,CAAC,IAAI,CACxD,EAAO,OAAS,GAClB,KAAK,QAAQ,KAAK,EAAE"}
|
package/dist/impl-CGSBsFc7.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`);require(`./constants-CzmvL6Mw.cjs`);const t=require(`./syncConfigurationToTranscend-DkeLrq-I.cjs`);require(`./enums-BZulhPFa.cjs`);const n=require(`./logger-DQwEYtSS.cjs`);require(`./buildAIIntegrationType-BwuCYR-o.cjs`);const r=require(`./done-input-validation-DGckEJ5a.cjs`),i=require(`./preference-management-CkmW6Z91.cjs`);let a=require(`colors`);a=e.t(a);const o=[`userId`,`timestamp`,`partition`,`decryptionStatus`,`updatedAt`,`usp`,`gpp`,`tcf`,`airgapVersion`,`metadata`,`metadataTimestamp`];async function s({auth:e,partition:s,sombraAuth:c,file:l,transcendUrl:u,timestampBefore:d,timestampAfter:f,updatedBefore:p,updatedAfter:m,identifiers:h=[],concurrency:g,shouldChunk:_,windowConcurrency:v,maxChunks:y,exportIdentifiersWithDelimiter:b,maxLookbackDays:x}){r.t(this.process.exit);let S=await t.ii(u,e,c),C=t.ai(u,e),w=h.map(e=>{if(!e.includes(`:`))return{name:`email`,value:e};let[t,n]=e.split(`:`);return{name:t,value:n}}),T={...d?{timestampBefore:d.toISOString()}:{},...f?{timestampAfter:f.toISOString()}:{},...m||p?{system:{...p?{updatedBefore:p.toISOString()}:{},...m?{updatedAfter:m.toISOString()}:{}}}:{},...w.length>0?{identifiers:w}:{}};n.t.info(`Fetching consent preferences from partition ${s}, using mode=${_?`chunked-stream`:`paged-stream`}...`),n.t.info(a.default.magenta(`Preparing CSV at: ${l}`));let[E,D]=await Promise.all([t.xr(C),t.n(C)]),O=D.map(e=>e.name),k=Array.from(new Set(E.flatMap(e=>e.topics?.map(t=>`${e.trackingType}_${t.slug}`)??[]))).sort((e,t)=>e.localeCompare(t)),A=Array.from(new Set(E.map(e=>e.trackingType))).sort((e,t)=>e.localeCompare(t)),j=[...o,...O,...A,...k],M=null,N=!1,P=e=>{if(!e||e.length===0)return;let n=e.map(e=>i.i(e,b));if(!N){let e=Object.keys(n[0]??{}),r=new Set;M=[...j,...e].filter(e=>e===void 0||r.has(e)?!1:(r.add(e),!0)),t.s(l,M),N=!0}t.a(l,n,M)};if(_){await i.r(S,{partition:s,filterBy:T,limit:g,windowConcurrency:v,maxChunks:y,maxLookbackDays:x,onItems:e=>P(e)}),n.t.info(a.default.green(`Finished writing CSV to ${l}`));return}await i.n(S,{partition:s,filterBy:T,limit:g,onItems:e=>P(e)}),n.t.info(a.default.green(`Finished writing CSV to ${l}`))}exports.pullConsentPreferences=s;
|
|
2
|
-
//# sourceMappingURL=impl-CGSBsFc7.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-CGSBsFc7.cjs","names":["createSombraGotInstance","buildTranscendGraphQLClient","fetchAllPurposesAndPreferences","fetchAllIdentifiers","transformPreferenceRecordToCsv","fetchConsentPreferencesChunked","fetchConsentPreferences"],"sources":["../src/commands/consent/pull-consent-preferences/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport colors from 'colors';\n\nimport {\n fetchConsentPreferences,\n fetchConsentPreferencesChunked,\n transformPreferenceRecordToCsv,\n type PreferenceIdentifier,\n} from '../../../lib/preference-management';\nimport {\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n fetchAllIdentifiers,\n fetchAllPurposesAndPreferences,\n} from '../../../lib/graphql';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\nimport { logger } from '../../../logger';\nimport { initCsvFile, appendCsvRowsOrdered } from '../../../lib/helpers';\nimport type { PreferenceQueryResponseItem } from '@transcend-io/privacy-types';\n\n// Known “core” columns your transformer usually produces up front.\n// Leave this list conservative; we’ll still union with transformer keys.\nconst CORE_COLS = [\n 'userId',\n 'timestamp',\n 'partition',\n 'decryptionStatus',\n 'updatedAt',\n 'usp',\n 'gpp',\n 'tcf',\n 'airgapVersion',\n 'metadata',\n 'metadataTimestamp',\n];\n\nexport interface PullConsentPreferencesCommandFlags {\n auth: string;\n partition: string;\n sombraAuth?: string;\n file: string;\n transcendUrl: string;\n timestampBefore?: Date;\n exportIdentifiersWithDelimiter: string;\n timestampAfter?: Date;\n updatedBefore?: Date;\n updatedAfter?: Date;\n identifiers?: string[];\n concurrency: number;\n shouldChunk: boolean;\n windowConcurrency: number;\n maxChunks: number;\n maxLookbackDays: number;\n}\n\nexport async function pullConsentPreferences(\n this: LocalContext,\n {\n auth,\n partition,\n sombraAuth,\n file,\n transcendUrl,\n timestampBefore,\n timestampAfter,\n updatedBefore,\n updatedAfter,\n identifiers = [],\n concurrency,\n shouldChunk,\n windowConcurrency,\n maxChunks,\n exportIdentifiersWithDelimiter,\n maxLookbackDays,\n }: PullConsentPreferencesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, sombraAuth);\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Identifiers are key:value, parse to PreferenceIdentifier[]\n const parsedIdentifiers = identifiers.map(\n (identifier): PreferenceIdentifier => {\n if (!identifier.includes(':')) {\n return {\n name: 'email',\n value: identifier,\n };\n }\n const [name, value] = identifier.split(':');\n return { name, value };\n },\n );\n\n // Build filter\n const filterBy = {\n ...(timestampBefore\n ? { timestampBefore: timestampBefore.toISOString() }\n : {}),\n ...(timestampAfter ? { timestampAfter: timestampAfter.toISOString() } : {}),\n ...(updatedAfter || updatedBefore\n ? {\n system: {\n ...(updatedBefore\n ? { updatedBefore: updatedBefore.toISOString() }\n : {}),\n ...(updatedAfter\n ? { updatedAfter: updatedAfter.toISOString() }\n : {}),\n },\n }\n : {}),\n ...(parsedIdentifiers.length > 0 ? { identifiers: parsedIdentifiers } : {}),\n };\n\n logger.info(\n `Fetching consent preferences from partition ${partition}, using mode=${\n shouldChunk ? 'chunked-stream' : 'paged-stream'\n }...`,\n );\n\n logger.info(colors.magenta(`Preparing CSV at: ${file}`));\n\n // Fetch full sets (purposes+topics, identifiers) to ensure header completeness\n const [purposesWithTopics, allIdentifiers] = await Promise.all([\n fetchAllPurposesAndPreferences(client),\n fetchAllIdentifiers(client),\n ]);\n\n // Identifier columns: exactly the identifier names\n const identifierCols = allIdentifiers.map((i) => i.name);\n\n // Preference topic columns: topic names (de-duped)\n const topicCols = Array.from(\n new Set(\n purposesWithTopics.flatMap(\n (p) => p.topics?.map((t) => `${p.trackingType}_${t.slug}`) ?? [],\n ),\n ),\n ).sort((a, b) => a.localeCompare(b));\n\n // Some setups also want a per-purpose boolean column (e.g., “Email”, “Sms”).\n // If your transformer includes those, list them here, derived from purposes:\n const purposeCols = Array.from(\n new Set(purposesWithTopics.map((p) => p.trackingType)),\n ).sort((a, b) => a.localeCompare(b));\n\n // Build the complete header skeleton.\n // We’ll still union with the first transformed row’s keys to be safe.\n const completeHeadersList = [\n ...CORE_COLS,\n ...identifierCols,\n ...purposeCols,\n ...topicCols,\n ];\n\n // Lazily initialize CSV header order from the first transformed row.\n let headerOrder: string[] | null = null;\n let wroteHeader = false;\n const writeRows = (items: PreferenceQueryResponseItem[]): void => {\n if (!items || items.length === 0) return;\n const rows = items.map((row) =>\n transformPreferenceRecordToCsv(row, exportIdentifiersWithDelimiter),\n );\n if (!wroteHeader) {\n const firstKeys = Object.keys(rows[0] ?? {});\n const seen = new Set<string>();\n headerOrder = [...completeHeadersList, ...firstKeys].filter((k) => {\n if (k === undefined) return false;\n if (seen.has(k)) return false;\n seen.add(k);\n return true;\n });\n initCsvFile(file, headerOrder);\n wroteHeader = true;\n }\n appendCsvRowsOrdered(file, rows, headerOrder!);\n };\n\n if (shouldChunk) {\n // Stream via chunked fetcher with page callback\n await fetchConsentPreferencesChunked(sombra, {\n partition,\n filterBy,\n limit: concurrency,\n windowConcurrency,\n maxChunks,\n maxLookbackDays,\n onItems: (items) => writeRows(items),\n });\n\n logger.info(colors.green(`Finished writing CSV to ${file}`));\n return;\n }\n\n // Non-chunked path: still stream page-by-page via onItems (no in-memory accumulation)\n await fetchConsentPreferences(sombra, {\n partition,\n filterBy,\n limit: concurrency, // page size (API max 50 enforced internally)\n onItems: (items) => writeRows(items),\n });\n\n logger.info(colors.green(`Finished writing CSV to ${file}`));\n}\n"],"mappings":"gZAsBA,MAAM,EAAY,CAChB,SACA,YACA,YACA,mBACA,YACA,MACA,MACA,MACA,gBACA,WACA,oBACD,CAqBD,eAAsB,EAEpB,CACE,OACA,YACA,aACA,OACA,eACA,kBACA,iBACA,gBACA,eACA,cAAc,EAAE,CAChB,cACA,cACA,oBACA,YACA,iCACA,mBAEa,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAS,MAAMA,EAAAA,GAAwB,EAAc,EAAM,EAAW,CACtE,EAASC,EAAAA,GAA4B,EAAc,EAAK,CAGxD,EAA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EACH,GAAG,EACJ,CAGG,EAA+B,KAC/B,EAAc,GACZ,EAAa,GAA+C,CAChE,GAAI,CAAC,GAAS,EAAM,SAAW,EAAG,OAClC,IAAM,EAAO,EAAM,IAAK,GACtBC,EAAAA,EAA+B,EAAK,EAA+B,CACpE,CACD,GAAI,CAAC,EAAa,CAChB,IAAM,EAAY,OAAO,KAAK,EAAK,IAAM,EAAE,CAAC,CACtC,EAAO,IAAI,IACjB,EAAc,CAAC,GAAG,EAAqB,GAAG,EAAU,CAAC,OAAQ,GACvD,IAAM,IAAA,IACN,EAAK,IAAI,EAAE,CAAS,IACxB,EAAK,IAAI,EAAE,CACJ,IACP,CACF,EAAA,EAAY,EAAM,EAAY,CAC9B,EAAc,GAEhB,EAAA,EAAqB,EAAM,EAAM,EAAa,EAGhD,GAAI,EAAa,CAEf,MAAMC,EAAAA,EAA+B,EAAQ,CAC3C,YACA,WACA,MAAO,EACP,oBACA,YACA,kBACA,QAAU,GAAU,EAAU,EAAM,CACrC,CAAC,CAEF,EAAA,EAAO,KAAK,EAAA,QAAO,MAAM,2BAA2B,IAAO,CAAC,CAC5D,OAIF,MAAMC,EAAAA,EAAwB,EAAQ,CACpC,YACA,WACA,MAAO,EACP,QAAU,GAAU,EAAU,EAAM,CACrC,CAAC,CAEF,EAAA,EAAO,KAAK,EAAA,QAAO,MAAM,2BAA2B,IAAO,CAAC"}
|
package/dist/impl-ChHjX-p0.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
require(`./constants-CzmvL6Mw.cjs`),require(`./syncConfigurationToTranscend-DkeLrq-I.cjs`),require(`./enums-BZulhPFa.cjs`),require(`./logger-DQwEYtSS.cjs`),require(`./buildAIIntegrationType-BwuCYR-o.cjs`),require(`./codecs-Bvmb8o9R.cjs`);const e=require(`./consent-manager-CJZ5GTmv.cjs`);require(`./uploadConsents-zr1Hg-JE.cjs`);const t=require(`./done-input-validation-DGckEJ5a.cjs`);async function n({auth:n,trackerStatus:r,file:i,transcendUrl:a}){t.t(this.process.exit),await e.o({auth:n,trackerStatus:r,file:i,transcendUrl:a})}exports.uploadCookiesFromCsv=n;
|
|
2
|
-
//# sourceMappingURL=impl-ChHjX-p0.cjs.map
|
package/dist/impl-ChqwjO34.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`);require(`./constants-CzmvL6Mw.cjs`);const t=require(`./syncConfigurationToTranscend-DkeLrq-I.cjs`);require(`./enums-BZulhPFa.cjs`);const n=require(`./logger-DQwEYtSS.cjs`);require(`./buildAIIntegrationType-BwuCYR-o.cjs`);const r=require(`./cron-Ts7kHP6_.cjs`),i=require(`./done-input-validation-DGckEJ5a.cjs`);let a=require(`colors`);a=e.t(a);let o=require(`io-ts`);o=e.t(o);const s=o.type({"Request Id":o.string});async function c({auth:e,dataSiloId:o,file:c,transcendUrl:l}){i.t(this.process.exit),n.t.info(a.default.magenta(`Reading "${c}" from disk`)),await r.n({requestIds:t.ui(c,s).map(e=>e[`Request Id`]),transcendUrl:l,auth:e,dataSiloId:o})}exports.markRequestDataSilosCompleted=c;
|
|
2
|
-
//# sourceMappingURL=impl-ChqwjO34.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-ChqwjO34.cjs","names":["t","markRequestDataSiloIdsCompleted","readCsv"],"sources":["../src/commands/request/system/mark-request-data-silos-completed/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context';\nimport colors from 'colors';\nimport * as t from 'io-ts';\n\nimport { logger } from '../../../../logger';\nimport { markRequestDataSiloIdsCompleted } from '../../../../lib/cron';\nimport { readCsv } from '../../../../lib/requests';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nconst RequestIdRow = t.type({\n 'Request Id': t.string,\n});\n\nexport interface MarkRequestDataSilosCompletedCommandFlags {\n auth: string;\n dataSiloId: string;\n file: string;\n transcendUrl: string;\n}\n\nexport async function markRequestDataSilosCompleted(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n file,\n transcendUrl,\n }: MarkRequestDataSilosCompletedCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const activeResults = readCsv(file, RequestIdRow);\n\n await markRequestDataSiloIdsCompleted({\n requestIds: activeResults.map((request) => request['Request Id']),\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"],"mappings":"+ZASA,MAAM,EAAeA,EAAE,KAAK,CAC1B,aAAcA,EAAE,OACjB,CAAC,CASF,eAAsB,EAEpB,CACE,OACA,aACA,OACA,gBAEa,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAEtC,EAAA,EAAO,KAAK,EAAA,QAAO,QAAQ,YAAY,EAAK,aAAa,CAAC,CAG1D,MAAMC,EAAAA,EAAgC,CACpC,WAHoBC,EAAAA,GAAQ,EAAM,EAAa,CAGrB,IAAK,GAAY,EAAQ,cAAc,CACjE,eACA,OACA,aACD,CAAC"}
|
package/dist/impl-CrieEyzk.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
require(`./constants-CzmvL6Mw.cjs`);const e=require(`./syncConfigurationToTranscend-DkeLrq-I.cjs`);require(`./enums-BZulhPFa.cjs`),require(`./logger-DQwEYtSS.cjs`),require(`./buildAIIntegrationType-BwuCYR-o.cjs`);const t=require(`./done-input-validation-DGckEJ5a.cjs`);async function n({auth:n,file:r,transcendUrl:i,cacheFilepath:a,requestReceiptFolder:o,sombraAuth:s,concurrency:c,attributes:l,isTest:u,isSilent:d,skipSendingReceipt:f,emailIsVerified:p,skipFilterStep:m,dryRun:h,debug:g,defaultPhoneCountryCode:_}){t.t(this.process.exit),await e.W({cacheFilepath:a,requestReceiptFolder:o,file:r,auth:n,sombraAuth:s,concurrency:c,transcendUrl:i,defaultPhoneCountryCode:_,attributes:e.pi(l),debug:g,skipFilterStep:m,isSilent:d,skipSendingReceipt:f,emailIsVerified:p,isTest:u,dryRun:h})}exports.upload=n;
|
|
2
|
-
//# sourceMappingURL=impl-CrieEyzk.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-CrieEyzk.cjs","names":["uploadPrivacyRequestsFromCsv","splitCsvToList"],"sources":["../src/commands/request/upload/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport {\n splitCsvToList,\n uploadPrivacyRequestsFromCsv,\n} from '../../../lib/requests';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface UploadCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n cacheFilepath: string;\n requestReceiptFolder: string;\n sombraAuth?: string;\n concurrency: number;\n attributes: string;\n isTest: boolean;\n isSilent: boolean;\n skipSendingReceipt: boolean;\n emailIsVerified: boolean;\n skipFilterStep: boolean;\n dryRun: boolean;\n debug: boolean;\n defaultPhoneCountryCode: string;\n}\n\nexport async function upload(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n cacheFilepath,\n requestReceiptFolder,\n sombraAuth,\n concurrency,\n attributes,\n isTest,\n isSilent,\n skipSendingReceipt,\n emailIsVerified,\n skipFilterStep,\n dryRun,\n debug,\n defaultPhoneCountryCode,\n }: UploadCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await uploadPrivacyRequestsFromCsv({\n cacheFilepath,\n requestReceiptFolder,\n file,\n auth,\n sombraAuth,\n concurrency,\n transcendUrl,\n defaultPhoneCountryCode,\n attributes: splitCsvToList(attributes),\n debug,\n skipFilterStep,\n isSilent,\n skipSendingReceipt,\n emailIsVerified,\n isTest,\n dryRun,\n });\n}\n"],"mappings":"6QA0BA,eAAsB,EAEpB,CACE,OACA,OACA,eACA,gBACA,uBACA,aACA,cACA,aACA,SACA,WACA,qBACA,kBACA,iBACA,SACA,QACA,2BAEa,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAAAA,EAA6B,CACjC,gBACA,uBACA,OACA,OACA,aACA,cACA,eACA,0BACA,WAAYC,EAAAA,GAAe,EAAW,CACtC,QACA,iBACA,WACA,qBACA,kBACA,SACA,SACD,CAAC"}
|
package/dist/impl-Cru4riTc.cjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./logger-DQwEYtSS.cjs`),n=require(`./done-input-validation-DGckEJ5a.cjs`);let r=require(`node:fs`);r=e.t(r);let i=require(`node:path`);i=e.t(i);let a=require(`colors`);a=e.t(a);let o=require(`fast-glob`);o=e.t(o);let s=require(`node:child_process`);function c(e,t,n){return new Promise((i,a)=>{let o=r.default.createReadStream(e),s=Buffer.alloc(0),c=t.length,l=0;o.on(`data`,e=>{let r=e;if(n){let e=n-l;if(e<=0){o.destroy(),i(!1);return}r.length>e&&(r=r.subarray(0,e)),l+=r.length}let a=s.length?Buffer.concat([s,r]):r;if(a.toString(`utf8`).toLowerCase().includes(t.toString(`utf8`))){o.destroy(),i(!0);return}s=c>1?Buffer.from(a.subarray(Math.max(0,a.length-(c-1)))):Buffer.alloc(0)}),o.on(`error`,a),o.on(`close`,()=>i(!1)),o.on(`end`,()=>i(!1))})}async function l(e,t,n){let r=0,i=Array.from({length:Math.min(t,e.length)},async()=>{for(;;){let t=r;if(r+=1,t>=e.length)return;await n(e[t])}});await Promise.all(i)}function u(e,t){return new Promise((n,r)=>{let i=(0,s.spawn)(e,[`-noheader`,`-batch`,`-cmd`,t],{stdio:[`ignore`,`pipe`,`pipe`]}),a=``,o=``;i.stdout.on(`data`,e=>{a+=String(e)}),i.stderr.on(`data`,e=>{o+=String(e)}),i.on(`error`,r),i.on(`close`,e=>{e===0?n(a):r(Error(`duckdb exited ${e}: ${o}`))})})}async function d(e,t){return(await u(e,[`SELECT column_name`,`FROM parquet_schema('${t.replace(/'/g,`''`)}')`,`WHERE lower(column_type) LIKE '%varchar%'`,` OR lower(column_type) LIKE '%string%';`].join(`
|
|
2
|
-
`))).split(`
|
|
3
|
-
`).map(e=>e.trim()).filter(Boolean)}async function f(e,t,n){let r=await d(e,t);if(r.length===0)return!1;let i=t.replace(/'/g,`''`),a=r.map(e=>`"${e.replace(/"/g,`""`)}" = '${n.replace(/'/g,`''`)}'`).join(` OR `);return(await u(e,[`SELECT 1 AS hit FROM read_parquet('${i}')`,`WHERE ${a}`,`LIMIT 1;`].join(`
|
|
4
|
-
`))).trim().length>0}async function p(e){n.t(this.process.exit);let{needle:r,root:s,exts:u,noParquet:d,concurrency:p,maxBytes:m}=e,h=i.default.resolve(s),g=new Set(u.split(`,`).map(e=>e.trim().replace(/^\./,``).toLowerCase()).filter(Boolean)),_=Array.from(g).map(e=>`**/*.${e}`);t.t.info(a.default.green(`Searching for "${r}" in ${h} (exts: ${[...g].join(`, `)})`));let v=await(0,o.default)(_,{cwd:h,absolute:!0,onlyFiles:!0,followSymbolicLinks:!1,suppressErrors:!0}),y=Buffer.from(r.toLowerCase(),`utf8`),b=[];if(await l(v,p,async e=>{try{await c(e,y,m)&&(b.push(e),this.process.stdout.write(`${e}\n`))}catch{}}),!d){let e=await(0,o.default)([`**/*.parquet`],{cwd:h,absolute:!0,onlyFiles:!0,followSymbolicLinks:!1,suppressErrors:!0});e.length>0&&(t.t.info(a.default.green(`Scanning ${e.length} parquet file(s) via DuckDB...`)),await l(e,Math.max(2,Math.floor(p/4)),async e=>{try{await f(`duckdb`,e,r)&&(b.push(e),this.process.stdout.write(`${e}\n`))}catch{}}))}t.t.info(a.default.green(`Done. Found ${b.length} matching file(s).`))}exports.findTextInFolder=p;
|
|
5
|
-
//# sourceMappingURL=impl-Cru4riTc.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-Cru4riTc.cjs","names":["fs","path"],"sources":["../src/commands/admin/find-text-in-folder/impl.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { spawn } from 'node:child_process';\nimport fg from 'fast-glob';\nimport colors from 'colors';\nimport type { LocalContext } from '../../../context';\nimport { logger } from '../../../logger';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\n/** CLI flags accepted by the `find-text-in-folder` command. */\nexport type FindTextInFolderCommandFlags = {\n /** The text string to search for */\n needle: string;\n /** Root directory to search */\n root: string;\n /** Comma-separated file extensions */\n exts: string;\n /** Skip parquet file scanning */\n noParquet: boolean;\n /** Max concurrent file scans */\n concurrency: number;\n /** Stop scanning each file after N bytes */\n maxBytes?: number;\n};\n\n/**\n * Streams through a file checking if it contains the needle (case-insensitive).\n *\n * @param filePath - Absolute path to the file to scan\n * @param needle - Lowercased needle as a Buffer\n * @param maxBytes - Optional byte limit per file\n * @returns Whether the file contains the needle\n */\nexport function fileContainsExactBytes(\n filePath: string,\n needle: Buffer,\n maxBytes?: number,\n): Promise<boolean> {\n return new Promise<boolean>((resolve, reject) => {\n const stream = fs.createReadStream(filePath);\n let carry = Buffer.alloc(0);\n const n = needle.length;\n let seen = 0;\n\n stream.on('data', (raw: Buffer) => {\n let chunk = raw;\n\n if (maxBytes) {\n const remaining = maxBytes - seen;\n if (remaining <= 0) {\n stream.destroy();\n resolve(false);\n return;\n }\n if (chunk.length > remaining) {\n chunk = chunk.subarray(0, remaining);\n }\n seen += chunk.length;\n }\n\n const buf = carry.length ? Buffer.concat([carry, chunk]) : chunk;\n const haystack = buf.toString('utf8').toLowerCase();\n if (haystack.includes(needle.toString('utf8'))) {\n stream.destroy();\n resolve(true);\n return;\n }\n\n // Keep last n-1 bytes to catch boundary matches\n if (n > 1) {\n carry = Buffer.from(buf.subarray(Math.max(0, buf.length - (n - 1))));\n } else {\n carry = Buffer.alloc(0);\n }\n });\n\n stream.on('error', reject);\n stream.on('close', () => resolve(false));\n stream.on('end', () => resolve(false));\n });\n}\n\n/**\n * Run async workers over items with bounded concurrency.\n *\n * @param items - Array of items to process\n * @param limit - Maximum concurrent workers\n * @param worker - Async function to run per item\n * @returns Resolves when all items are processed\n */\nasync function runWithConcurrency<T>(\n items: T[],\n limit: number,\n worker: (item: T) => Promise<void>,\n): Promise<void> {\n let idx = 0;\n const runners = Array.from(\n { length: Math.min(limit, items.length) },\n async () => {\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const current = idx;\n idx += 1;\n if (current >= items.length) return;\n await worker(items[current]);\n }\n },\n );\n await Promise.all(runners);\n}\n\n/**\n * Execute a DuckDB query and return stdout.\n *\n * @param duckdbPath - Path to the duckdb binary\n * @param sql - SQL query to execute\n * @returns The stdout output from duckdb\n */\nfunction duckdbQuery(duckdbPath: string, sql: string): Promise<string> {\n return new Promise<string>((resolve, reject) => {\n const child = spawn(duckdbPath, ['-noheader', '-batch', '-cmd', sql], {\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n\n let stdout = '';\n let stderr = '';\n child.stdout.on('data', (d) => {\n stdout += String(d);\n });\n child.stderr.on('data', (d) => {\n stderr += String(d);\n });\n\n child.on('error', reject);\n child.on('close', (code) => {\n if (code === 0) resolve(stdout);\n else reject(new Error(`duckdb exited ${code}: ${stderr}`));\n });\n });\n}\n\n/**\n * Get all VARCHAR/STRING column names from a parquet file.\n *\n * @param duckdbPath - Path to the duckdb binary\n * @param filePath - Absolute path to the parquet file\n * @returns Array of string column names\n */\nasync function duckdbGetParquetStringColumns(\n duckdbPath: string,\n filePath: string,\n): Promise<string[]> {\n const escaped = filePath.replace(/'/g, \"''\");\n const sql = [\n 'SELECT column_name',\n `FROM parquet_schema('${escaped}')`,\n \"WHERE lower(column_type) LIKE '%varchar%'\",\n \" OR lower(column_type) LIKE '%string%';\",\n ].join('\\n');\n\n const out = await duckdbQuery(duckdbPath, sql);\n return out\n .split('\\n')\n .map((l) => l.trim())\n .filter(Boolean);\n}\n\n/**\n * Check if any string column in a parquet file contains the needle value.\n *\n * @param duckdbPath - Path to the duckdb binary\n * @param filePath - Absolute path to the parquet file\n * @param needle - The string to search for (exact equality per column)\n * @returns Whether any row/column matches\n */\nasync function parquetFileHasExactString(\n duckdbPath: string,\n filePath: string,\n needle: string,\n): Promise<boolean> {\n const cols = await duckdbGetParquetStringColumns(duckdbPath, filePath);\n if (cols.length === 0) return false;\n\n const escaped = filePath.replace(/'/g, \"''\");\n const orChain = cols\n .map((c) => `\"${c.replace(/\"/g, '\"\"')}\" = '${needle.replace(/'/g, \"''\")}'`)\n .join(' OR ');\n\n const sql = [\n `SELECT 1 AS hit FROM read_parquet('${escaped}')`,\n `WHERE ${orChain}`,\n 'LIMIT 1;',\n ].join('\\n');\n\n const out = await duckdbQuery(duckdbPath, sql);\n return out.trim().length > 0;\n}\n\n/**\n * Entrypoint for the `admin find-text-in-folder` command.\n *\n * Searches a folder of files for a given text string. Useful for finding\n * a needle in a haystack across many large files (multi-GB CSVs, JSON\n * dumps, log archives). Files are streamed so memory stays flat.\n *\n * @param this - Bound CLI context\n * @param flags - CLI flags for the run\n */\nexport async function findTextInFolder(\n this: LocalContext,\n flags: FindTextInFolderCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const { needle, root, exts, noParquet, concurrency, maxBytes } = flags;\n const rootAbs = path.resolve(root);\n\n const extSet = new Set(\n exts\n .split(',')\n .map((x) => x.trim().replace(/^\\./, '').toLowerCase())\n .filter(Boolean),\n );\n const patterns = Array.from(extSet).map((e) => `**/*.${e}`);\n\n logger.info(\n colors.green(\n `Searching for \"${needle}\" in ${rootAbs} (exts: ${[...extSet].join(\n ', ',\n )})`,\n ),\n );\n\n const normalFiles = await fg(patterns, {\n cwd: rootAbs,\n absolute: true,\n onlyFiles: true,\n followSymbolicLinks: false,\n suppressErrors: true,\n });\n\n const needleBuf = Buffer.from(needle.toLowerCase(), 'utf8');\n const hits: string[] = [];\n\n await runWithConcurrency(normalFiles, concurrency, async (file) => {\n try {\n const ok = await fileContainsExactBytes(file, needleBuf, maxBytes);\n if (ok) {\n hits.push(file);\n this.process.stdout.write(`${file}\\n`);\n }\n } catch {\n // ignore unreadable files\n }\n });\n\n if (!noParquet) {\n const parquetFiles = await fg(['**/*.parquet'], {\n cwd: rootAbs,\n absolute: true,\n onlyFiles: true,\n followSymbolicLinks: false,\n suppressErrors: true,\n });\n\n if (parquetFiles.length > 0) {\n logger.info(\n colors.green(\n `Scanning ${parquetFiles.length} parquet file(s) via DuckDB...`,\n ),\n );\n\n await runWithConcurrency(\n parquetFiles,\n Math.max(2, Math.floor(concurrency / 4)),\n async (file) => {\n try {\n const ok = await parquetFileHasExactString('duckdb', file, needle);\n if (ok) {\n hits.push(file);\n this.process.stdout.write(`${file}\\n`);\n }\n } catch {\n // ignore parquet read issues\n }\n },\n );\n }\n }\n\n logger.info(colors.green(`Done. Found ${hits.length} matching file(s).`));\n}\n"],"mappings":"4SAiCA,SAAgB,EACd,EACA,EACA,EACkB,CAClB,OAAO,IAAI,SAAkB,EAAS,IAAW,CAC/C,IAAM,EAASA,EAAAA,QAAG,iBAAiB,EAAS,CACxC,EAAQ,OAAO,MAAM,EAAE,CACrB,EAAI,EAAO,OACb,EAAO,EAEX,EAAO,GAAG,OAAS,GAAgB,CACjC,IAAI,EAAQ,EAEZ,GAAI,EAAU,CACZ,IAAM,EAAY,EAAW,EAC7B,GAAI,GAAa,EAAG,CAClB,EAAO,SAAS,CAChB,EAAQ,GAAM,CACd,OAEE,EAAM,OAAS,IACjB,EAAQ,EAAM,SAAS,EAAG,EAAU,EAEtC,GAAQ,EAAM,OAGhB,IAAM,EAAM,EAAM,OAAS,OAAO,OAAO,CAAC,EAAO,EAAM,CAAC,CAAG,EAE3D,GADiB,EAAI,SAAS,OAAO,CAAC,aAAa,CACtC,SAAS,EAAO,SAAS,OAAO,CAAC,CAAE,CAC9C,EAAO,SAAS,CAChB,EAAQ,GAAK,CACb,OAIF,AAGE,EAHE,EAAI,EACE,OAAO,KAAK,EAAI,SAAS,KAAK,IAAI,EAAG,EAAI,QAAU,EAAI,GAAG,CAAC,CAAC,CAE5D,OAAO,MAAM,EAAE,EAEzB,CAEF,EAAO,GAAG,QAAS,EAAO,CAC1B,EAAO,GAAG,YAAe,EAAQ,GAAM,CAAC,CACxC,EAAO,GAAG,U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AAa,OAAS,IACxB,EAAA,EAAO,KACL,EAAA,QAAO,MACL,YAAY,EAAa,OAAO,gCACjC,CACF,CAED,MAAM,EACJ,EACA,KAAK,IAAI,EAAG,KAAK,MAAM,EAAc,EAAE,CAAC,CACxC,KAAO,IAAS,CACd,GAAI,CACS,MAAM,EAA0B,SAAU,EAAM,EAAO,GAEhE,EAAK,KAAK,EAAK,CACf,KAAK,QAAQ,OAAO,MAAM,GAAG,EAAK,IAAI,OAElC,IAIX,EAIL,EAAA,EAAO,KAAK,EAAA,QAAO,MAAM,eAAe,EAAK,OAAO,oBAAoB,CAAC"}
|
package/dist/impl-CujcX7vE.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
require(`./constants-CzmvL6Mw.cjs`),require(`./syncConfigurationToTranscend-DkeLrq-I.cjs`),require(`./enums-BZulhPFa.cjs`),require(`./logger-DQwEYtSS.cjs`),require(`./buildAIIntegrationType-BwuCYR-o.cjs`);const e=require(`./manual-enrichment-CW8iihdb.cjs`),t=require(`./done-input-validation-DGckEJ5a.cjs`);async function n({auth:n,transcendUrl:r,file:i,enricherId:a,concurrency:o,markSilent:s,sombraAuth:c}){t.t(this.process.exit),await e.t({file:i,transcendUrl:r,enricherId:a,concurrency:o,markSilent:s,auth:n,sombraAuth:c})}exports.pushIdentifiers=n;
|
|
2
|
-
//# sourceMappingURL=impl-CujcX7vE.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-CujcX7vE.cjs","names":["pushManualEnrichmentIdentifiersFromCsv"],"sources":["../src/commands/request/preflight/push-identifiers/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context';\nimport { pushManualEnrichmentIdentifiersFromCsv } from '../../../../lib/manual-enrichment';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nexport interface PushIdentifiersCommandFlags {\n auth: string;\n enricherId: string;\n sombraAuth?: string;\n transcendUrl: string;\n file: string;\n markSilent: boolean;\n concurrency: number;\n}\n\nexport async function pushIdentifiers(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n file,\n enricherId,\n concurrency,\n markSilent,\n sombraAuth,\n }: PushIdentifiersCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await pushManualEnrichmentIdentifiersFromCsv({\n file,\n transcendUrl,\n enricherId,\n concurrency,\n markSilent,\n auth,\n sombraAuth,\n });\n}\n"],"mappings":"mTAcA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,aACA,cACA,aACA,cAEa,CACf,EAAA,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAAAA,EAAuC,CAC3C,OACA,eACA,aACA,cACA,aACA,OACA,aACD,CAAC"}
|
package/dist/impl-D9OOb2JE.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`);require(`./constants-CzmvL6Mw.cjs`);const t=require(`./syncConfigurationToTranscend-DkeLrq-I.cjs`);require(`./enums-BZulhPFa.cjs`);const n=require(`./logger-DQwEYtSS.cjs`);require(`./buildAIIntegrationType-BwuCYR-o.cjs`);const r=require(`./pooling-Dw0a42I_.cjs`),i=require(`./done-input-validation-DGckEJ5a.cjs`);let a=require(`node:fs`),o=require(`node:path`),s=require(`colors`);s=e.t(s);let c=require(`fast-csv`);c=e.t(c);let l=require(`node:events`),u=require(`node:fs/promises`),d=require(`node:stream/promises`),f=require(`node:stream`),p=require(`csv-parse`);function m(e,t){e||(n.t.error(s.default.red(`A --directory must be provided.`)),t.process.exit(1));let r=[];try{r=(0,a.readdirSync)(e).filter(e=>e.endsWith(`.csv`)).map(t=>(0,o.join)(e,t)).filter(e=>{try{return(0,a.statSync)(e).isFile()}catch{return!1}})}catch(r){n.t.error(s.default.red(`Failed to read directory: ${e}`)),n.t.error(s.default.red(r.message)),t.process.exit(1)}return r.length===0&&(n.t.error(s.default.red(`No CSV files found in directory: ${e}`)),t.process.exit(1)),n.t.info(s.default.green(`Found: ${r.join(`, `)} CSV files`)),r}function h(e,t){let n=(0,a.createWriteStream)(e),r=c.format({headers:t,writeHeaders:!0,objectMode:!0});return r.pipe(n),{async write(e){r.write(e)||await(0,l.once)(r,`drain`)},async end(){let e=Promise.all([(0,l.once)(n,`finish`)]);r.end(),await e}}}function g(e){return String(e).padStart(4,`0`)}function _(e){return Buffer.byteLength(Object.values(e).map(e=>e==null?``:String(e)).join(`,`),`utf8`)}async function v(e){let{filePath:t,outputDir:r,clearOutputDir:i,chunkSizeMB:c,onProgress:l,reportEveryMs:m=500}=e,{size:v}=await(0,u.stat)(t),y=0;n.t.info(s.default.magenta(`Chunking ${t} into ~${c}MB files...`));let b=Math.floor(c*1024*1024),x=(0,o.basename)(t,`.csv`),S=r||(0,o.dirname)(t);if(n.t.info(s.default.magenta(`Output directory: ${S}`)),await(0,u.mkdir)(S,{recursive:!0}),i){n.t.warn(s.default.yellow(`Clearing output directory: ${S}`));let e=await(0,u.readdir)(S);await Promise.all(e.filter(e=>e.startsWith(`${x}_chunk_`)&&e.endsWith(`.csv`)).map(e=>(0,u.unlink)((0,o.join)(S,e))))}let C=null,w=null,T=0,E=1,D=0,O=new p.Parser({columns:!1,skip_empty_lines:!0}),k=0,A=0,j=()=>{let e=A>0?k/A:0,t=e>0?Math.max(T,Math.ceil(v/e)):void 0;l(T,t),y=Date.now()};j();let M=null,N=()=>(0,o.join)(S,`${x}_chunk_${g(E)}.csv`),P=new f.Transform({objectMode:!0,async transform(e,t,r){try{if(!C){C=e.slice(0),w=C.length,M=h(N(),C),r();return}w!==null&&e.length!==w&&n.t.warn(s.default.yellow(`Row has ${e.length} cols; expected ${w}`)),T+=1,T%25e4==0&&l(T);let t=Object.fromEntries(C.map((t,n)=>[t,e[n]])),i=_(t);k+=i,A+=1,Date.now()-y>=m&&j(),M&&D>0&&D+i>b&&(await M.end(),E+=1,D=0,n.t.info(s.default.green(`Rolling to chunk ${E} after ${T.toLocaleString()} rows.`)),M=h(N(),C)),M||=h(N(),C),await M.write(t),D+=i,r()}catch(e){r(e)}},async flush(e){try{M&&=(await M.end(),null),j(),e()}catch(t){e(t)}}});await(0,d.pipeline)((0,a.createReadStream)(t),O,P),l(T),n.t.info(s.default.green(`Chunked ${t} into ${E} file(s); processed ${T.toLocaleString()} rows.`))}async function y(){let e=Number(process.env.WORKER_ID||`0`);n.t.info(`[w${e}] ready pid=${process.pid}`),process.send?.({type:`ready`}),process.on(`message`,async r=>{if(!r||typeof r!=`object`||(r.type===`shutdown`&&process.exit(0),r.type!==`task`))return;let{filePath:i,options:a}=r.payload,{outputDir:o,clearOutputDir:s,chunkSizeMB:c}=a;try{await v({filePath:i,outputDir:o,clearOutputDir:s,chunkSizeMB:c,onProgress:(e,t)=>process.send?.({type:`progress`,payload:{filePath:i,processed:e,total:t}})}),process.send?.({type:`result`,payload:{ok:!0,filePath:i}})}catch(r){let a=t.O(r);n.t.error(`[w${e}] ERROR ${i}: ${a}`),process.send?.({type:`result`,payload:{ok:!1,filePath:i,error:a}})}}),await new Promise(()=>{})}function b(e){return r.r(e)}function x(e){return r.i(e)}const S={renderHeader:b,renderWorkers:x};function C(){return typeof __filename<`u`?__filename:process.argv[1]}async function w(e){i.t(this.process.exit);let{directory:t,outputDir:a,clearOutputDir:o,chunkSizeMB:c,concurrency:l,viewerMode:u}=e,d=m(t,this),{poolSize:f,cpuCount:p}=r.s(l,d.length);n.t.info(s.default.green(`Chunking ${d.length} CSV file(s) with pool size ${f} (CPU=${p})`));let h=d.map(e=>({filePath:e,options:{outputDir:a,clearOutputDir:o,chunkSizeMB:c}}));await r.n({title:`Chunk CSV - ${t}`,baseDir:t||a||process.cwd(),childFlag:r.o,childModulePath:C(),poolSize:f,cpuCount:p,filesTotal:d.length,hooks:{nextTask:()=>h.shift(),taskLabel:e=>e.filePath,initTotals:()=>({}),initSlotProgress:()=>void 0,onProgress:e=>e,onResult:(e,t)=>({totals:e,ok:!!t.ok}),postProcess:async()=>{}},viewerMode:u,render:e=>r.a(e,S,u),extraKeyHandler:({logsBySlot:e,repaint:t,setPaused:n})=>r.t({logsBySlot:e,repaint:t,setPaused:n})})}process.argv.includes(r.o)&&y().catch(e=>{n.t.error(e),process.exit(1)}),exports.chunkCsv=w;
|
|
2
|
-
//# sourceMappingURL=impl-D9OOb2JE.cjs.map
|