@transcend-io/cli 8.21.0 → 8.22.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/bin/bash-complete.cjs +1 -1
- package/dist/bin/cli.cjs +1 -1
- package/dist/bin/deprecated-command.cjs +2 -2
- package/dist/{chunk-7DVT7N4B.cjs → chunk-2FX6UYVO.cjs} +2 -2
- package/dist/{chunk-7DVT7N4B.cjs.map → chunk-2FX6UYVO.cjs.map} +1 -1
- package/dist/{chunk-P5CMBVDI.cjs → chunk-2NPTXG4Q.cjs} +20 -20
- package/dist/{chunk-P5CMBVDI.cjs.map → chunk-2NPTXG4Q.cjs.map} +1 -1
- package/dist/{chunk-JAES2L52.cjs → chunk-2PSFXDKU.cjs} +2 -2
- package/dist/{chunk-JAES2L52.cjs.map → chunk-2PSFXDKU.cjs.map} +1 -1
- package/dist/{chunk-7LLT4L6V.cjs → chunk-3VLAP7X6.cjs} +2 -2
- package/dist/{chunk-7LLT4L6V.cjs.map → chunk-3VLAP7X6.cjs.map} +1 -1
- package/dist/{chunk-QEM6S2W7.cjs → chunk-5UBGZNDC.cjs} +2 -2
- package/dist/chunk-5UBGZNDC.cjs.map +1 -0
- package/dist/{chunk-P2EZO5QL.cjs → chunk-B4SOWGXW.cjs} +2 -2
- package/dist/{chunk-P2EZO5QL.cjs.map → chunk-B4SOWGXW.cjs.map} +1 -1
- package/dist/{chunk-XIEU2CZ4.cjs → chunk-C5NJNKVT.cjs} +2 -2
- package/dist/{chunk-XIEU2CZ4.cjs.map → chunk-C5NJNKVT.cjs.map} +1 -1
- package/dist/{chunk-XTMOZCR3.cjs → chunk-FUYFDEYI.cjs} +4 -4
- package/dist/{chunk-XTMOZCR3.cjs.map → chunk-FUYFDEYI.cjs.map} +1 -1
- package/dist/{chunk-GZDXMF6D.cjs → chunk-KYDVTWBL.cjs} +4 -4
- package/dist/{chunk-GZDXMF6D.cjs.map → chunk-KYDVTWBL.cjs.map} +1 -1
- package/dist/{chunk-FT5RBVY5.cjs → chunk-NOWRZX7L.cjs} +2 -2
- package/dist/{chunk-FT5RBVY5.cjs.map → chunk-NOWRZX7L.cjs.map} +1 -1
- package/dist/{chunk-OCA7O2EK.cjs → chunk-OTIT6UGG.cjs} +2 -2
- package/dist/{chunk-OCA7O2EK.cjs.map → chunk-OTIT6UGG.cjs.map} +1 -1
- package/dist/{chunk-OQSWDQAO.cjs → chunk-PEGEJINF.cjs} +3 -3
- package/dist/{chunk-OQSWDQAO.cjs.map → chunk-PEGEJINF.cjs.map} +1 -1
- package/dist/{chunk-SW5CIF5D.cjs → chunk-RE5YALEO.cjs} +3 -3
- package/dist/{chunk-SW5CIF5D.cjs.map → chunk-RE5YALEO.cjs.map} +1 -1
- package/dist/{chunk-77MIGBJA.cjs → chunk-VD7RHIZE.cjs} +2 -2
- package/dist/{chunk-77MIGBJA.cjs.map → chunk-VD7RHIZE.cjs.map} +1 -1
- package/dist/{impl-HJAFEHCW.cjs → impl-2BWD4YFV.cjs} +2 -2
- package/dist/{impl-HJAFEHCW.cjs.map → impl-2BWD4YFV.cjs.map} +1 -1
- package/dist/{impl-CZDZVPUT.cjs → impl-2L3QQZXF.cjs} +2 -2
- package/dist/{impl-CZDZVPUT.cjs.map → impl-2L3QQZXF.cjs.map} +1 -1
- package/dist/{impl-NJI3UPTO.cjs → impl-2TXAFNME.cjs} +2 -2
- package/dist/{impl-NJI3UPTO.cjs.map → impl-2TXAFNME.cjs.map} +1 -1
- package/dist/{impl-6PTNVHDA.cjs → impl-2UX5JCKQ.cjs} +6 -6
- package/dist/{impl-6PTNVHDA.cjs.map → impl-2UX5JCKQ.cjs.map} +1 -1
- package/dist/{impl-6V53EAWG.cjs → impl-3ZVLFX4Q.cjs} +2 -2
- package/dist/{impl-6V53EAWG.cjs.map → impl-3ZVLFX4Q.cjs.map} +1 -1
- package/dist/{impl-NDNUAGKI.cjs → impl-5V23OWYE.cjs} +3 -3
- package/dist/{impl-NDNUAGKI.cjs.map → impl-5V23OWYE.cjs.map} +1 -1
- package/dist/{impl-HZITX7TF.cjs → impl-74SRCY2G.cjs} +2 -2
- package/dist/{impl-HZITX7TF.cjs.map → impl-74SRCY2G.cjs.map} +1 -1
- package/dist/{impl-TD5RZZIK.cjs → impl-75UGTFO7.cjs} +2 -2
- package/dist/{impl-TD5RZZIK.cjs.map → impl-75UGTFO7.cjs.map} +1 -1
- package/dist/{impl-WUQMSMIY.cjs → impl-7SWDIF6R.cjs} +2 -2
- package/dist/{impl-WUQMSMIY.cjs.map → impl-7SWDIF6R.cjs.map} +1 -1
- package/dist/{impl-WSSCSX7X.cjs → impl-BIG2D6IR.cjs} +2 -2
- package/dist/{impl-WSSCSX7X.cjs.map → impl-BIG2D6IR.cjs.map} +1 -1
- package/dist/{impl-ZWDLY7RI.cjs → impl-CEJFEMFU.cjs} +2 -2
- package/dist/{impl-ZWDLY7RI.cjs.map → impl-CEJFEMFU.cjs.map} +1 -1
- package/dist/{impl-54D7BBDP.cjs → impl-CKK4FPQU.cjs} +2 -2
- package/dist/{impl-54D7BBDP.cjs.map → impl-CKK4FPQU.cjs.map} +1 -1
- package/dist/{impl-QNNXXIQB.cjs → impl-CORCBVSB.cjs} +2 -2
- package/dist/{impl-QNNXXIQB.cjs.map → impl-CORCBVSB.cjs.map} +1 -1
- package/dist/{impl-VESANF77.cjs → impl-DMVYONWP.cjs} +2 -2
- package/dist/{impl-VESANF77.cjs.map → impl-DMVYONWP.cjs.map} +1 -1
- package/dist/{impl-N4ST7DYV.cjs → impl-E3FJ2YBV.cjs} +3 -3
- package/dist/{impl-N4ST7DYV.cjs.map → impl-E3FJ2YBV.cjs.map} +1 -1
- package/dist/impl-EQV67XCQ.cjs +2 -0
- package/dist/{impl-HYVKHMSO.cjs.map → impl-EQV67XCQ.cjs.map} +1 -1
- package/dist/{impl-KPYSR5L7.cjs → impl-FNZT2TMA.cjs} +2 -2
- package/dist/{impl-KPYSR5L7.cjs.map → impl-FNZT2TMA.cjs.map} +1 -1
- package/dist/{impl-ZKQTB32N.cjs → impl-GNNYZPIO.cjs} +2 -2
- package/dist/{impl-ZKQTB32N.cjs.map → impl-GNNYZPIO.cjs.map} +1 -1
- package/dist/{impl-SDOMG35J.cjs → impl-HD5KMFQF.cjs} +2 -2
- package/dist/{impl-SDOMG35J.cjs.map → impl-HD5KMFQF.cjs.map} +1 -1
- package/dist/{impl-F3ROCA6U.cjs → impl-HFJOEEOI.cjs} +5 -5
- package/dist/{impl-F3ROCA6U.cjs.map → impl-HFJOEEOI.cjs.map} +1 -1
- package/dist/{impl-7A2Y7SMZ.cjs → impl-I3JIDHDO.cjs} +2 -2
- package/dist/{impl-7A2Y7SMZ.cjs.map → impl-I3JIDHDO.cjs.map} +1 -1
- package/dist/{impl-6GHUIZPP.cjs → impl-K6EY75SW.cjs} +2 -2
- package/dist/{impl-6GHUIZPP.cjs.map → impl-K6EY75SW.cjs.map} +1 -1
- package/dist/{impl-PFKMAZ5V.cjs → impl-L375M254.cjs} +2 -2
- package/dist/{impl-PFKMAZ5V.cjs.map → impl-L375M254.cjs.map} +1 -1
- package/dist/{impl-ZOX3OTJM.cjs → impl-MCC55AYP.cjs} +2 -2
- package/dist/{impl-ZOX3OTJM.cjs.map → impl-MCC55AYP.cjs.map} +1 -1
- package/dist/{impl-I7A2ORWC.cjs → impl-MJASP74U.cjs} +2 -2
- package/dist/{impl-I7A2ORWC.cjs.map → impl-MJASP74U.cjs.map} +1 -1
- package/dist/{impl-UUQT7P2I.cjs → impl-N3YTKGTI.cjs} +2 -2
- package/dist/{impl-UUQT7P2I.cjs.map → impl-N3YTKGTI.cjs.map} +1 -1
- package/dist/{impl-UVJV2R3P.cjs → impl-NNILSKEN.cjs} +2 -2
- package/dist/{impl-UVJV2R3P.cjs.map → impl-NNILSKEN.cjs.map} +1 -1
- package/dist/{impl-TJBDNI2X.cjs → impl-ODFDFL7V.cjs} +2 -2
- package/dist/{impl-TJBDNI2X.cjs.map → impl-ODFDFL7V.cjs.map} +1 -1
- package/dist/{impl-DWNR77ZE.cjs → impl-PFXTUJB5.cjs} +5 -5
- package/dist/{impl-DWNR77ZE.cjs.map → impl-PFXTUJB5.cjs.map} +1 -1
- package/dist/{impl-SOX5KLMX.cjs → impl-PGTIDK6M.cjs} +2 -2
- package/dist/{impl-SOX5KLMX.cjs.map → impl-PGTIDK6M.cjs.map} +1 -1
- package/dist/{impl-QUUOPXYQ.cjs → impl-PL43BXBL.cjs} +2 -2
- package/dist/{impl-QUUOPXYQ.cjs.map → impl-PL43BXBL.cjs.map} +1 -1
- package/dist/{impl-GR7KAF42.cjs → impl-PT2CPB3V.cjs} +2 -2
- package/dist/{impl-GR7KAF42.cjs.map → impl-PT2CPB3V.cjs.map} +1 -1
- package/dist/{impl-GKICMDKL.cjs → impl-QHD2MO76.cjs} +2 -2
- package/dist/{impl-GKICMDKL.cjs.map → impl-QHD2MO76.cjs.map} +1 -1
- package/dist/{impl-Z6ICILDH.cjs → impl-RZMPDQSO.cjs} +2 -2
- package/dist/{impl-Z6ICILDH.cjs.map → impl-RZMPDQSO.cjs.map} +1 -1
- package/dist/{impl-IZONRZK5.cjs → impl-SJM642T5.cjs} +2 -2
- package/dist/{impl-IZONRZK5.cjs.map → impl-SJM642T5.cjs.map} +1 -1
- package/dist/{impl-JYEGA6DK.cjs → impl-UBQSBBQ2.cjs} +2 -2
- package/dist/{impl-JYEGA6DK.cjs.map → impl-UBQSBBQ2.cjs.map} +1 -1
- package/dist/{impl-GJSRZC4N.cjs → impl-W2ATNS5R.cjs} +2 -2
- package/dist/{impl-GJSRZC4N.cjs.map → impl-W2ATNS5R.cjs.map} +1 -1
- package/dist/{impl-OK6NKAWI.cjs → impl-XW4UTUBW.cjs} +2 -2
- package/dist/{impl-OK6NKAWI.cjs.map → impl-XW4UTUBW.cjs.map} +1 -1
- package/dist/{impl-DSSOHMGA.cjs → impl-YTZMHOQ5.cjs} +4 -4
- package/dist/{impl-DSSOHMGA.cjs.map → impl-YTZMHOQ5.cjs.map} +1 -1
- package/dist/impl-ZFQ6LKZE.cjs +2 -0
- package/dist/{impl-7ZGKDZKD.cjs.map → impl-ZFQ6LKZE.cjs.map} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +1799 -448
- package/package.json +5 -5
- package/dist/chunk-QEM6S2W7.cjs.map +0 -1
- package/dist/impl-7ZGKDZKD.cjs +0 -2
- package/dist/impl-HYVKHMSO.cjs +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/cli/cli/dist/chunk-OQSWDQAO.cjs","../src/lib/consent-manager/updateConsentManagerVersionToLatest.ts","../src/lib/consent-manager/uploadDataFlowsFromCsv.ts","../src/lib/consent-manager/uploadCookiesFromCsv.ts","../src/lib/consent-manager/pullConsentManagerMetrics.ts","../src/lib/consent-manager/domainToHost.ts","../src/lib/consent-manager/buildXdiSyncEndpoint.ts","../src/lib/consent-manager/consentManagersToBusinessEntities.ts","../src/lib/consent-manager/fetchConsentPreferences.ts"],"names":["updateConsentManagerVersionToLatest","auth","deploy","transcendUrl","DEFAULT_TRANSCEND_API","bundleTypes","ConsentBundleType","client","buildTranscendGraphQLClient","consentManagerId","fetchConsentManagerId","mapSeries","bundleType","logger","colors","updateConsentManagerToLatest","deployConsentManager","OMIT_COLUMNS","uploadDataFlowsFromCsv","trackerStatus","file","classifyService","validatedDataFlowInputs","readCsv","DataFlowCsvInput","Type","Notes","Service","Purpose","Status","Owners","Teams","value","rest","splitCsvToList","key","syncDataFlows","uploadCookiesFromCsv","validatedCookieInputs","CookieCsvInput","isRegex","Name","syncCookies","ONE_SECOND","ONE_MINUTE","ONE_HOUR","ONE_DAY","ONE_WEEK","pullConsentManagerMetrics","bin","start","end","airgapBundleId","startTime","endTime","startDate","endDate","privacySignalData","consentChangesData","consentSessionsByRegimeData","fetchConsentManagerAnalyticsData","domainToHost","domain"],"mappings":"AAAA,u/BAAwC,wDAAkD,wDAAkH,wDAAyC,wDAAgD,2DCAnQ,oCACR,gFAOP,MA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A,YAAA,CAAc,CAAA,CAAA,CACd,cAAA,CAAAJ,CAAAA,CACA,WAAA,CAAaH,CAAAA,CACb,gBAAA,CAAkB,CAAA,CACpB,CAAC,CAAA,CACDW,kCAAAA,CAAiCrD,CAAQ,CACvC,UAAA,CAAY,4BAAA,CACZ,SAAA,CAAAgD,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,YAAA,CAAc,CAAA,CAAA,CACd,cAAA,CAAAJ,CAAAA,CACA,WAAA,CAAaH,CAAAA,CACb,gBAAA,CAAkB,CAAA,CACpB,CAAC,CACH,CAAC,CAAA,CAEH,MAAO,CACL,yBAAA,CAA2BQ,CAAAA,CAC3B,0BAAA,CAA4BC,CAAAA,CAC5B,0BAAA,CAA4BC,CAC9B,CACF,CChGO,IAAME,CAAAA,CAAgBC,CAAAA,EAC3B,IAAI,GAAA,CAAI,CAAA,QAAA,EAAWA,CAAM,CAAA,CAAA;ACiHA;AAAA;AAGT,KAAA;AACqC,kBAAA;AAChB,mBAAA;AAAA;AC5DzB;AAAA;AAAA;ACmBd,uBAAA","file":"/home/runner/work/cli/cli/dist/chunk-OQSWDQAO.cjs","sourcesContent":[null,"import { ConsentBundleType } from '@transcend-io/privacy-types';\nimport { mapSeries } from 'bluebird';\nimport {\n updateConsentManagerToLatest,\n buildTranscendGraphQLClient,\n fetchConsentManagerId,\n deployConsentManager,\n} from '../graphql';\nimport colors from 'colors';\n\nimport { logger } from '../../logger';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\n\n/**\n * Update the consent manager to latest version\n *\n * @param options - Options\n */\nexport async function updateConsentManagerVersionToLatest({\n auth,\n deploy = false,\n transcendUrl = DEFAULT_TRANSCEND_API,\n bundleTypes = Object.values(ConsentBundleType),\n}: {\n /** Transcend API key authentication */\n auth: string;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** Deploy consent manager with this update */\n deploy?: boolean;\n /** The bundle types to update and deploy */\n bundleTypes?: ConsentBundleType[];\n}): Promise<void> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Grab Consent Manager ID\n const consentManagerId = await fetchConsentManagerId(client);\n\n // Update each bundle type to latest version\n await mapSeries(bundleTypes, async (bundleType) => {\n logger.info(\n colors.magenta(\n `Update Consent Manager bundle with ID \"${consentManagerId}\" and type \"${bundleType}\" to latest version...`,\n ),\n );\n await updateConsentManagerToLatest(client, {\n id: consentManagerId,\n bundleType,\n });\n logger.info(\n colors.green(\n `Updated Consent Manager bundle with ID \"${consentManagerId}\" and type \"${bundleType}\" to latest version!`,\n ),\n );\n });\n\n // deploy Consent Managers\n if (deploy) {\n // Update each bundle type to latest version\n await mapSeries(bundleTypes, async (bundleType) => {\n logger.info(\n colors.magenta(\n `Deploying Consent Manager bundle with ID \"${consentManagerId}\" and type \"${bundleType}\"...`,\n ),\n );\n await deployConsentManager(client, {\n id: consentManagerId,\n bundleType,\n });\n logger.info(\n colors.green(\n `Deployed Consent Manager bundle with ID \"${consentManagerId}\" and type \"${bundleType}\"!`,\n ),\n );\n });\n }\n}\n","import colors from 'colors';\nimport { logger } from '../../logger';\nimport { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, syncDataFlows } from '../graphql';\nimport { readCsv } from '../requests/readCsv';\nimport { DataFlowInput, DataFlowCsvInput } from '../../codecs';\nimport { splitCsvToList } from '../requests';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\n\nconst OMIT_COLUMNS = [\n 'ID',\n 'Activity',\n 'Encounters',\n 'Last Seen At',\n 'Has Native Do Not Sell/Share Support',\n 'IAB USP API Support',\n 'Service Description',\n 'Website URL',\n 'Categories of Recipients',\n];\n\n/**\n * Upload a set of data flows from CSV\n *\n * @param options - Options\n */\nexport async function uploadDataFlowsFromCsv({\n auth,\n trackerStatus,\n file,\n classifyService = false,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** Sombra API key authentication */\n trackerStatus: ConsentTrackerStatus;\n /** classify data flow service if missing */\n classifyService?: boolean;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<void> {\n // Build a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read from CSV the set of data flow inputs\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const dataFlowInputs = readCsv(file, DataFlowCsvInput);\n\n // Convert these data flow inputs into a format that the other function can use\n const validatedDataFlowInputs = dataFlowInputs.map(\n ({\n Type,\n Notes,\n // TODO: https://transcend.height.app/T-26391 - export in CSV\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n Service,\n Purpose,\n Status,\n Owners,\n Teams,\n 'Connections Made To': value,\n ...rest\n }): DataFlowInput => ({\n value,\n type: Type,\n description: Notes,\n trackingPurposes: splitCsvToList(Purpose),\n // TODO: https://transcend.height.app/T-26391\n // service: Service,\n // Apply the trackerStatus to all values in the CSV -> allows for customer to define tracker status\n // on a row by row basis if needed\n status: Status || trackerStatus,\n owners: Owners ? splitCsvToList(Owners) : undefined,\n teams: Teams ? splitCsvToList(Teams) : undefined,\n // all remaining options are attribute\n attributes: Object.entries(rest)\n // filter out native columns that are exported from the admin dashboard\n // but not custom attributes\n .filter(([key]) => !OMIT_COLUMNS.includes(key))\n .map(([key, value]) => ({\n key,\n values: splitCsvToList(value),\n })),\n }),\n );\n\n // Upload the data flows into Transcend dashboard\n const syncedDataFlows = await syncDataFlows(\n client,\n validatedDataFlowInputs,\n classifyService,\n );\n\n // Log errors\n if (!syncedDataFlows) {\n logger.error(\n colors.red(\n 'Encountered error(s) syncing data flows from CSV, see logs above for more info. ',\n ),\n );\n process.exit(1);\n }\n}\n","import colors from 'colors';\nimport { logger } from '../../logger';\nimport { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, syncCookies } from '../graphql';\nimport { readCsv } from '../requests/readCsv';\nimport { CookieInput, CookieCsvInput } from '../../codecs';\nimport { splitCsvToList } from '../requests';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\n\nconst OMIT_COLUMNS = [\n 'ID',\n 'Activity',\n 'Encounters',\n 'Last Seen At',\n 'Has Native Do Not Sell/Share Support',\n 'IAB USP API Support',\n 'Service Description',\n 'Website URL',\n 'Categories of Recipients',\n];\n\n/**\n * Upload a set of cookies from CSV\n *\n * @param options - Options\n */\nexport async function uploadCookiesFromCsv({\n auth,\n trackerStatus,\n file,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** Sombra API key authentication */\n trackerStatus: ConsentTrackerStatus;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<void> {\n // Build a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read from CSV the set of cookie inputs\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const cookieInputs = readCsv(file, CookieCsvInput);\n\n // Convert these inputs into a format that the other function can use\n const validatedCookieInputs = cookieInputs.map(\n ({\n 'Is Regex?': isRegex,\n Notes,\n // TODO: https://transcend.height.app/T-26391 - export in CSV\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n Service,\n Purpose,\n Status,\n Owners,\n Teams,\n Name,\n ...rest\n }): CookieInput => ({\n ...(typeof isRegex === 'string'\n ? { isRegex: isRegex.toLowerCase() === 'true' }\n : {}),\n name: Name,\n description: Notes,\n trackingPurposes: splitCsvToList(Purpose),\n // TODO: https://transcend.height.app/T-26391\n // service: Service,\n // Apply the trackerStatus to all values in the CSV -> allows for customer to define tracker status\n // on a row by row basis if needed\n status: Status || trackerStatus,\n owners: Owners ? splitCsvToList(Owners) : undefined,\n teams: Teams ? splitCsvToList(Teams) : undefined,\n // all remaining options are attribute\n attributes: Object.entries(rest)\n // filter out native columns that are exported from the admin dashboard\n // but not custom attributes\n .filter(([key]) => !OMIT_COLUMNS.includes(key))\n .map(([key, value]) => ({\n key,\n values: splitCsvToList(value),\n })),\n }),\n );\n\n // Upload the cookies into Transcend dashboard\n const syncedCookies = await syncCookies(client, validatedCookieInputs);\n\n // Log errors\n if (!syncedCookies) {\n logger.error(\n colors.red(\n 'Encountered error(s) syncing cookies from CSV, see logs above for more info. ',\n ),\n );\n process.exit(1);\n }\n}\n","import type { GraphQLClient } from 'graphql-request';\nimport {\n ConsentManagerMetric,\n ConsentManagerMetricBin,\n fetchConsentManagerAnalyticsData,\n fetchConsentManagerId,\n} from '../graphql';\n\n/**\n * One second of time in ms\n */\nconst ONE_SECOND = 1000;\nconst ONE_MINUTE = 60 * ONE_SECOND;\nconst ONE_HOUR = 60 * ONE_MINUTE;\nconst ONE_DAY = 24 * ONE_HOUR;\nconst ONE_WEEK = 7 * ONE_DAY;\n\n/**\n * Pull consent manager metrics in an organization\n *\n * @param client - GraphQL client\n * @param options - Options\n * @returns The consent manager metrics\n */\nexport async function pullConsentManagerMetrics(\n client: GraphQLClient,\n {\n bin,\n start,\n end = new Date(),\n }: {\n /** Start date to pull metrics from */\n start: Date;\n /** End date to pull metrics from (assumes now) */\n end?: Date;\n /** Bin size to pull metrics */\n bin: ConsentManagerMetricBin;\n },\n): Promise<{\n /** Privacy signal data */\n PRIVACY_SIGNAL_TIMESERIES: ConsentManagerMetric[];\n /** Consent changes data */\n CONSENT_CHANGES_TIMESERIES: ConsentManagerMetric[];\n /** Consent sessions by regime */\n CONSENT_SESSIONS_BY_REGIME: ConsentManagerMetric[];\n}> {\n // Grab the bundleId associated with this API key\n const airgapBundleId = await fetchConsentManagerId(client);\n\n // convert start and end to times\n const startTime = Math.floor(start.getTime() / 1000);\n const endTime = Math.floor(end.getTime() / 1000);\n if (startTime > endTime) {\n throw new Error('Received \"end\" date that happened before \"start\" date');\n }\n\n // do not allow hourly bins greater than 2 weeks\n if (bin === '1h' && end.getTime() - start.getTime() > ONE_WEEK * 2) {\n throw new Error(\n 'When using bin=1h, start and end time can be no more than 2 weeks apart',\n );\n }\n\n // Pull in the metrics\n const startDate = start.toISOString();\n const endDate = end.toISOString();\n const [privacySignalData, consentChangesData, consentSessionsByRegimeData] =\n await Promise.all([\n fetchConsentManagerAnalyticsData(client, {\n dataSource: 'PRIVACY_SIGNAL_TIMESERIES',\n startDate,\n endDate,\n forceRefetch: true,\n airgapBundleId,\n binInterval: bin,\n smoothTimeseries: false,\n }),\n fetchConsentManagerAnalyticsData(client, {\n dataSource: 'CONSENT_CHANGES_TIMESERIES',\n startDate,\n endDate,\n forceRefetch: true,\n airgapBundleId,\n binInterval: bin,\n smoothTimeseries: false,\n }),\n fetchConsentManagerAnalyticsData(client, {\n dataSource: 'CONSENT_SESSIONS_BY_REGIME',\n startDate,\n endDate,\n forceRefetch: true,\n airgapBundleId,\n binInterval: bin,\n smoothTimeseries: false,\n }),\n ]);\n\n return {\n PRIVACY_SIGNAL_TIMESERIES: privacySignalData,\n CONSENT_CHANGES_TIMESERIES: consentChangesData,\n CONSENT_SESSIONS_BY_REGIME: consentSessionsByRegimeData,\n };\n}\n","/**\n * Convert a domain to host\n *\n * @param domain - e.g. test.acme.com\n * @returns Host acme.com\n */\nexport const domainToHost = (domain: string): string =>\n new URL(`https://${domain}`).hostname.split('.').slice(-2).join('.');\n","import colors from 'colors';\n\nimport { buildTranscendGraphQLClient, fetchConsentManager } from '../graphql';\nimport { difference } from 'lodash-es';\nimport { map } from 'bluebird';\nimport { StoredApiKey } from '../../codecs';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\nimport { logger } from '../../logger';\nimport { domainToHost } from './domainToHost';\n\n/**\n * Sync group configuration mapping\n * e.g.\n * {\n * \"abdb5e78-0d69-4554-a3bd-84b72ca3b3d9\": [\n * \"test.com\"\n * ],\n * \"f6b3ba87-c9df-444f-b420-6fac49e35910\": [\n * \"blue.com\"\n * ]\n * }\n */\nexport type XdiSyncGroups = { [k in string]: string[] };\n\n/** Regular expression for IP addresses - remove these from sync endpoint */\nexport const IP_ADDRESS_REGEX =\n // eslint-disable-next-line max-len\n /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;\n\n/**\n * Build the sync endpoint definition for a set of Transcend accounts\n *\n * @param apiKeys - The API keys that will be used to pull down configurations for\n * @param options - Options\n * @returns The XDI configuration\n */\nexport async function buildXdiSyncEndpoint(\n apiKeys: string | StoredApiKey[],\n {\n xdiLocation,\n transcendUrl = DEFAULT_TRANSCEND_API,\n removeIpAddresses = true,\n domainBlockList = ['localhost'],\n xdiAllowedCommands = 'ConsentManager:Sync',\n }: {\n /** The file location where the XDI file is hosted */\n xdiLocation: string;\n /** URL of Transcend API */\n transcendUrl?: string;\n /** When true, remove IP addresses (defaults to true) */\n removeIpAddresses?: boolean;\n /** Block list of domains to omit from sync endpoint - includes `localhost` by default */\n domainBlockList?: string[];\n /** Allows XDI commands */\n xdiAllowedCommands?: string;\n },\n): Promise<{\n /** Sync group configurations */\n syncGroups: XdiSyncGroups;\n /** The HTML string */\n html: string;\n}> {\n // Convert API keys to list\n const apiKeysAsList = Array.isArray(apiKeys)\n ? apiKeys\n : [{ apiKey: apiKeys, organizationId: '', organizationName: '' }];\n\n // Fetch configuration for each account\n const consentManagers = await map(\n apiKeysAsList,\n async (apiKey) => {\n logger.info(\n colors.magenta(\n `Pulling consent metadata for organization - ${apiKey.organizationName}`,\n ),\n );\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKey.apiKey);\n\n // Grab consent manager\n const consentManager = await fetchConsentManager(client);\n return consentManager;\n },\n { concurrency: 5 },\n );\n\n // construct the sync groups\n const syncGroups: XdiSyncGroups = {};\n consentManagers.forEach((consentManager) => {\n // grab the partition key\n const partitionKey =\n // take explicit key first\n consentManager.partition?.partition ||\n // fallback to bundle ID\n consentManager.bundleURL.split('/').reverse()[1];\n\n // Ensure that partition exists in the sync groups\n if (!syncGroups[partitionKey]) {\n syncGroups[partitionKey] = [];\n }\n\n // Map domain list to a host list\n const hosts = difference(\n consentManager.configuration.domains\n .filter(\n // ignore IP addresses\n (domain) => !removeIpAddresses || !IP_ADDRESS_REGEX.test(domain),\n )\n .map((domain) => domainToHost(domain)),\n // ignore block list\n domainBlockList,\n );\n // merge existing sync group with hosts for this consent manager\n syncGroups[partitionKey] = [\n ...new Set([...(syncGroups[partitionKey] || []), ...hosts]),\n ];\n });\n\n // Construct the HTML\n const syncEndpointHtml = `\n<!DOCTYPE html>\n<script\nsrc=\"${xdiLocation}\"\ndata-sync-groups='${JSON.stringify(syncGroups, null, 2)}'\ndata-xdi-commands=\"${xdiAllowedCommands}\"\n></script>\n`;\n\n return {\n html: syncEndpointHtml,\n syncGroups,\n };\n}\n","import { BusinessEntityInput, ConsentManagerInput } from '../../codecs';\nimport { logger } from '../../logger';\n\n/**\n * Combine multiple consent manager configurations into a list of business entity configurations\n *\n * @param inputs - Consent manager configurations to combine\n * @returns Business entity configuration input\n */\nexport function consentManagersToBusinessEntities(\n inputs: {\n /** Name of business entity */\n name: string;\n /** Consent manager input */\n input?: ConsentManagerInput;\n }[],\n): BusinessEntityInput[] {\n // Construct the business entities YAML definition\n const businessEntities = inputs.map(\n ({ name, input }): BusinessEntityInput => ({\n // Title of Transcend Instance\n title: name.replace('.yml', ''),\n attributes: [\n // Sync domain list\n ...(input?.domains\n ? [\n {\n key: 'Transcend Domain List',\n values: [...new Set(input.domains)],\n },\n ]\n : []),\n // Sync bundle URLs\n ...(input?.bundleUrls\n ? [\n {\n key: 'Airgap Production URL',\n values: [input.bundleUrls.PRODUCTION],\n },\n {\n key: 'Airgap Test URL',\n values: [input.bundleUrls.TEST],\n },\n {\n key: 'Airgap XDI URL',\n values: [\n input.bundleUrls.PRODUCTION.replace('airgap.js', 'xdi.js'),\n ],\n },\n ]\n : []),\n // Sync partition keys\n ...(input?.partition\n ? [\n {\n key: 'Consent Partition Key',\n values: [input.partition],\n },\n ]\n : []),\n ],\n }),\n );\n\n // Log out info on airgap scripts to host\n logger.info('\\n\\n~~~~~~~~~~~\\nAirgap scripts to host:');\n businessEntities.forEach(({ attributes, title }, ind) => {\n attributes\n ?.find((attr) => attr.key === 'Airgap Production URL')\n ?.values?.forEach((url) => {\n logger.info(`${ind}) ${title} - ${url}`);\n });\n });\n\n return businessEntities;\n}\n","import * as t from 'io-ts';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport type { Got } from 'got';\nimport { ConsentPreferenceFetch } from './types';\n\nexport const ConsentPreferenceResponse = t.intersection([\n t.type({\n nodes: t.array(ConsentPreferenceFetch),\n }),\n t.partial({\n lastKey: t.partial({\n userId: t.string,\n partition: t.string,\n timestamp: t.string,\n }),\n }),\n]);\n\n/** Type override */\nexport type ConsentPreferenceResponse = t.TypeOf<\n typeof ConsentPreferenceResponse\n>;\n\n/**\n * Fetch consent preferences for the managed consent database\n *\n * @param sombra - Sombra instance configured to make requests\n * @param options - Additional options\n * @returns The consent preferences\n */\nexport async function fetchConsentPreferences(\n sombra: Got,\n {\n partition,\n filterBy = {},\n limit = 50,\n }: {\n /** Partition key to fetch */\n partition: string;\n /** Filter consent preferences */\n filterBy?: {\n /** Fetch specific identifiers */\n identifiers?: string[];\n /** Filter before timestamp */\n timestampBefore?: string;\n /** Filter after timestamp */\n timestampAfter?: string;\n };\n /** Number of items to pull back at once */\n limit?: number;\n },\n): Promise<ConsentPreferenceFetch[]> {\n let currentLastKey: ConsentPreferenceResponse['lastKey'];\n const data: ConsentPreferenceFetch[] = [];\n let shouldContinue = true;\n\n while (shouldContinue) {\n const response = await sombra\n .post('v1/consent-preferences', {\n json: {\n partition,\n ...filterBy,\n // using lastKey to paginate if it exists (will not for first iteration)\n startKey: currentLastKey || undefined,\n limit,\n },\n })\n .json();\n const { nodes, lastKey } = decodeCodec(ConsentPreferenceResponse, response);\n\n if (!nodes || nodes.length === 0) {\n break;\n }\n\n // Process the data received from the API call\n // For example, push the new data into an array\n data.push(...nodes);\n\n // Extract the lastKey from the API response\n currentLastKey = lastKey;\n shouldContinue = !!lastKey && Object.keys(lastKey).length > 0;\n }\n\n return data;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/cli/cli/dist/chunk-PEGEJINF.cjs","../src/lib/consent-manager/updateConsentManagerVersionToLatest.ts","../src/lib/consent-manager/uploadDataFlowsFromCsv.ts","../src/lib/consent-manager/uploadCookiesFromCsv.ts","../src/lib/consent-manager/pullConsentManagerMetrics.ts","../src/lib/consent-manager/domainToHost.ts","../src/lib/consent-manager/buildXdiSyncEndpoint.ts","../src/lib/consent-manager/consentManagersToBusinessEntities.ts","../src/lib/consent-manager/fetchConsentPreferences.ts"],"names":["updateConsentManagerVersionToLatest","auth","deploy","transcendUrl","DEFAULT_TRANSCEND_API","bundleTypes","ConsentBundleType","client","buildTranscendGraphQLClient","consentManagerId","fetchConsentManagerId","mapSeries","bundleType","logger","colors","updateConsentManagerToLatest","deployConsentManager","OMIT_COLUMNS","uploadDataFlowsFromCsv","trackerStatus","file","classifyService","validatedDataFlowInputs","readCsv","DataFlowCsvInput","Type","Notes","Service","Purpose","Status","Owners","Teams","value","rest","splitCsvToList","key","syncDataFlows","uploadCookiesFromCsv","validatedCookieInputs","CookieCsvInput","isRegex","Name","syncCookies","ONE_SECOND","ONE_MINUTE","ONE_HOUR","ONE_DAY","ONE_WEEK","pullConsentManagerMetrics","bin","start","end","airgapBundleId","startTime","endTime","startDate","endDate","privacySignalData","consentChangesData","consentSessionsByRegimeData","fetchConsentManagerAnalyticsData","domainToHost","domain"],"mappings":"AAAA,u/BAAwC,wDAAkD,wDAAkH,wDAAyC,wDAAgD,2DCAnQ,oCACR,gFAOP,MAUnB,SAAsBA,EAAAA,CAAoC,CACxD,IAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CAAS,CAAA,CAAA,CACT,YAAA,CAAAC,CAAAA,CAAeC,mBAAAA,CACf,WAAA,CAAAC,CAAAA,CAAc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Y,4BAAA,CACZ,SAAA,CAAAgD,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,YAAA,CAAc,CAAA,CAAA,CACd,cAAA,CAAAJ,CAAAA,CACA,WAAA,CAAaH,CAAAA,CACb,gBAAA,CAAkB,CAAA,CACpB,CAAC,CACH,CAAC,CAAA,CAEH,MAAO,CACL,yBAAA,CAA2BQ,CAAAA,CAC3B,0BAAA,CAA4BC,CAAAA,CAC5B,0BAAA,CAA4BC,CAC9B,CACF,CChGO,IAAME,CAAAA,CAAgBC,CAAAA,EAC3B,IAAI,GAAA,CAAI,CAAA,QAAA,EAAWA,CAAM,CAAA,CAAA;ACiHA;AAAA;AAGT,KAAA;AACqC,kBAAA;AAChB,mBAAA;AAAA;AC5DzB;AAAA;AAAA;ACmBd,uBAAA","file":"/home/runner/work/cli/cli/dist/chunk-PEGEJINF.cjs","sourcesContent":[null,"import { ConsentBundleType } from '@transcend-io/privacy-types';\nimport { mapSeries } from 'bluebird';\nimport {\n updateConsentManagerToLatest,\n buildTranscendGraphQLClient,\n fetchConsentManagerId,\n deployConsentManager,\n} from '../graphql';\nimport colors from 'colors';\n\nimport { logger } from '../../logger';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\n\n/**\n * Update the consent manager to latest version\n *\n * @param options - Options\n */\nexport async function updateConsentManagerVersionToLatest({\n auth,\n deploy = false,\n transcendUrl = DEFAULT_TRANSCEND_API,\n bundleTypes = Object.values(ConsentBundleType),\n}: {\n /** Transcend API key authentication */\n auth: string;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** Deploy consent manager with this update */\n deploy?: boolean;\n /** The bundle types to update and deploy */\n bundleTypes?: ConsentBundleType[];\n}): Promise<void> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Grab Consent Manager ID\n const consentManagerId = await fetchConsentManagerId(client);\n\n // Update each bundle type to latest version\n await mapSeries(bundleTypes, async (bundleType) => {\n logger.info(\n colors.magenta(\n `Update Consent Manager bundle with ID \"${consentManagerId}\" and type \"${bundleType}\" to latest version...`,\n ),\n );\n await updateConsentManagerToLatest(client, {\n id: consentManagerId,\n bundleType,\n });\n logger.info(\n colors.green(\n `Updated Consent Manager bundle with ID \"${consentManagerId}\" and type \"${bundleType}\" to latest version!`,\n ),\n );\n });\n\n // deploy Consent Managers\n if (deploy) {\n // Update each bundle type to latest version\n await mapSeries(bundleTypes, async (bundleType) => {\n logger.info(\n colors.magenta(\n `Deploying Consent Manager bundle with ID \"${consentManagerId}\" and type \"${bundleType}\"...`,\n ),\n );\n await deployConsentManager(client, {\n id: consentManagerId,\n bundleType,\n });\n logger.info(\n colors.green(\n `Deployed Consent Manager bundle with ID \"${consentManagerId}\" and type \"${bundleType}\"!`,\n ),\n );\n });\n }\n}\n","import colors from 'colors';\nimport { logger } from '../../logger';\nimport { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, syncDataFlows } from '../graphql';\nimport { readCsv } from '../requests/readCsv';\nimport { DataFlowInput, DataFlowCsvInput } from '../../codecs';\nimport { splitCsvToList } from '../requests';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\n\nconst OMIT_COLUMNS = [\n 'ID',\n 'Activity',\n 'Encounters',\n 'Last Seen At',\n 'Has Native Do Not Sell/Share Support',\n 'IAB USP API Support',\n 'Service Description',\n 'Website URL',\n 'Categories of Recipients',\n];\n\n/**\n * Upload a set of data flows from CSV\n *\n * @param options - Options\n */\nexport async function uploadDataFlowsFromCsv({\n auth,\n trackerStatus,\n file,\n classifyService = false,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** Sombra API key authentication */\n trackerStatus: ConsentTrackerStatus;\n /** classify data flow service if missing */\n classifyService?: boolean;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<void> {\n // Build a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read from CSV the set of data flow inputs\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const dataFlowInputs = readCsv(file, DataFlowCsvInput);\n\n // Convert these data flow inputs into a format that the other function can use\n const validatedDataFlowInputs = dataFlowInputs.map(\n ({\n Type,\n Notes,\n // TODO: https://transcend.height.app/T-26391 - export in CSV\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n Service,\n Purpose,\n Status,\n Owners,\n Teams,\n 'Connections Made To': value,\n ...rest\n }): DataFlowInput => ({\n value,\n type: Type,\n description: Notes,\n trackingPurposes: splitCsvToList(Purpose),\n // TODO: https://transcend.height.app/T-26391\n // service: Service,\n // Apply the trackerStatus to all values in the CSV -> allows for customer to define tracker status\n // on a row by row basis if needed\n status: Status || trackerStatus,\n owners: Owners ? splitCsvToList(Owners) : undefined,\n teams: Teams ? splitCsvToList(Teams) : undefined,\n // all remaining options are attribute\n attributes: Object.entries(rest)\n // filter out native columns that are exported from the admin dashboard\n // but not custom attributes\n .filter(([key]) => !OMIT_COLUMNS.includes(key))\n .map(([key, value]) => ({\n key,\n values: splitCsvToList(value),\n })),\n }),\n );\n\n // Upload the data flows into Transcend dashboard\n const syncedDataFlows = await syncDataFlows(\n client,\n validatedDataFlowInputs,\n classifyService,\n );\n\n // Log errors\n if (!syncedDataFlows) {\n logger.error(\n colors.red(\n 'Encountered error(s) syncing data flows from CSV, see logs above for more info. ',\n ),\n );\n process.exit(1);\n }\n}\n","import colors from 'colors';\nimport { logger } from '../../logger';\nimport { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, syncCookies } from '../graphql';\nimport { readCsv } from '../requests/readCsv';\nimport { CookieInput, CookieCsvInput } from '../../codecs';\nimport { splitCsvToList } from '../requests';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\n\nconst OMIT_COLUMNS = [\n 'ID',\n 'Activity',\n 'Encounters',\n 'Last Seen At',\n 'Has Native Do Not Sell/Share Support',\n 'IAB USP API Support',\n 'Service Description',\n 'Website URL',\n 'Categories of Recipients',\n];\n\n/**\n * Upload a set of cookies from CSV\n *\n * @param options - Options\n */\nexport async function uploadCookiesFromCsv({\n auth,\n trackerStatus,\n file,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** Sombra API key authentication */\n trackerStatus: ConsentTrackerStatus;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<void> {\n // Build a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read from CSV the set of cookie inputs\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const cookieInputs = readCsv(file, CookieCsvInput);\n\n // Convert these inputs into a format that the other function can use\n const validatedCookieInputs = cookieInputs.map(\n ({\n 'Is Regex?': isRegex,\n Notes,\n // TODO: https://transcend.height.app/T-26391 - export in CSV\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n Service,\n Purpose,\n Status,\n Owners,\n Teams,\n Name,\n ...rest\n }): CookieInput => ({\n ...(typeof isRegex === 'string'\n ? { isRegex: isRegex.toLowerCase() === 'true' }\n : {}),\n name: Name,\n description: Notes,\n trackingPurposes: splitCsvToList(Purpose),\n // TODO: https://transcend.height.app/T-26391\n // service: Service,\n // Apply the trackerStatus to all values in the CSV -> allows for customer to define tracker status\n // on a row by row basis if needed\n status: Status || trackerStatus,\n owners: Owners ? splitCsvToList(Owners) : undefined,\n teams: Teams ? splitCsvToList(Teams) : undefined,\n // all remaining options are attribute\n attributes: Object.entries(rest)\n // filter out native columns that are exported from the admin dashboard\n // but not custom attributes\n .filter(([key]) => !OMIT_COLUMNS.includes(key))\n .map(([key, value]) => ({\n key,\n values: splitCsvToList(value),\n })),\n }),\n );\n\n // Upload the cookies into Transcend dashboard\n const syncedCookies = await syncCookies(client, validatedCookieInputs);\n\n // Log errors\n if (!syncedCookies) {\n logger.error(\n colors.red(\n 'Encountered error(s) syncing cookies from CSV, see logs above for more info. ',\n ),\n );\n process.exit(1);\n }\n}\n","import type { GraphQLClient } from 'graphql-request';\nimport {\n ConsentManagerMetric,\n ConsentManagerMetricBin,\n fetchConsentManagerAnalyticsData,\n fetchConsentManagerId,\n} from '../graphql';\n\n/**\n * One second of time in ms\n */\nconst ONE_SECOND = 1000;\nconst ONE_MINUTE = 60 * ONE_SECOND;\nconst ONE_HOUR = 60 * ONE_MINUTE;\nconst ONE_DAY = 24 * ONE_HOUR;\nconst ONE_WEEK = 7 * ONE_DAY;\n\n/**\n * Pull consent manager metrics in an organization\n *\n * @param client - GraphQL client\n * @param options - Options\n * @returns The consent manager metrics\n */\nexport async function pullConsentManagerMetrics(\n client: GraphQLClient,\n {\n bin,\n start,\n end = new Date(),\n }: {\n /** Start date to pull metrics from */\n start: Date;\n /** End date to pull metrics from (assumes now) */\n end?: Date;\n /** Bin size to pull metrics */\n bin: ConsentManagerMetricBin;\n },\n): Promise<{\n /** Privacy signal data */\n PRIVACY_SIGNAL_TIMESERIES: ConsentManagerMetric[];\n /** Consent changes data */\n CONSENT_CHANGES_TIMESERIES: ConsentManagerMetric[];\n /** Consent sessions by regime */\n CONSENT_SESSIONS_BY_REGIME: ConsentManagerMetric[];\n}> {\n // Grab the bundleId associated with this API key\n const airgapBundleId = await fetchConsentManagerId(client);\n\n // convert start and end to times\n const startTime = Math.floor(start.getTime() / 1000);\n const endTime = Math.floor(end.getTime() / 1000);\n if (startTime > endTime) {\n throw new Error('Received \"end\" date that happened before \"start\" date');\n }\n\n // do not allow hourly bins greater than 2 weeks\n if (bin === '1h' && end.getTime() - start.getTime() > ONE_WEEK * 2) {\n throw new Error(\n 'When using bin=1h, start and end time can be no more than 2 weeks apart',\n );\n }\n\n // Pull in the metrics\n const startDate = start.toISOString();\n const endDate = end.toISOString();\n const [privacySignalData, consentChangesData, consentSessionsByRegimeData] =\n await Promise.all([\n fetchConsentManagerAnalyticsData(client, {\n dataSource: 'PRIVACY_SIGNAL_TIMESERIES',\n startDate,\n endDate,\n forceRefetch: true,\n airgapBundleId,\n binInterval: bin,\n smoothTimeseries: false,\n }),\n fetchConsentManagerAnalyticsData(client, {\n dataSource: 'CONSENT_CHANGES_TIMESERIES',\n startDate,\n endDate,\n forceRefetch: true,\n airgapBundleId,\n binInterval: bin,\n smoothTimeseries: false,\n }),\n fetchConsentManagerAnalyticsData(client, {\n dataSource: 'CONSENT_SESSIONS_BY_REGIME',\n startDate,\n endDate,\n forceRefetch: true,\n airgapBundleId,\n binInterval: bin,\n smoothTimeseries: false,\n }),\n ]);\n\n return {\n PRIVACY_SIGNAL_TIMESERIES: privacySignalData,\n CONSENT_CHANGES_TIMESERIES: consentChangesData,\n CONSENT_SESSIONS_BY_REGIME: consentSessionsByRegimeData,\n };\n}\n","/**\n * Convert a domain to host\n *\n * @param domain - e.g. test.acme.com\n * @returns Host acme.com\n */\nexport const domainToHost = (domain: string): string =>\n new URL(`https://${domain}`).hostname.split('.').slice(-2).join('.');\n","import colors from 'colors';\n\nimport { buildTranscendGraphQLClient, fetchConsentManager } from '../graphql';\nimport { difference } from 'lodash-es';\nimport { map } from 'bluebird';\nimport { StoredApiKey } from '../../codecs';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\nimport { logger } from '../../logger';\nimport { domainToHost } from './domainToHost';\n\n/**\n * Sync group configuration mapping\n * e.g.\n * {\n * \"abdb5e78-0d69-4554-a3bd-84b72ca3b3d9\": [\n * \"test.com\"\n * ],\n * \"f6b3ba87-c9df-444f-b420-6fac49e35910\": [\n * \"blue.com\"\n * ]\n * }\n */\nexport type XdiSyncGroups = { [k in string]: string[] };\n\n/** Regular expression for IP addresses - remove these from sync endpoint */\nexport const IP_ADDRESS_REGEX =\n // eslint-disable-next-line max-len\n /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;\n\n/**\n * Build the sync endpoint definition for a set of Transcend accounts\n *\n * @param apiKeys - The API keys that will be used to pull down configurations for\n * @param options - Options\n * @returns The XDI configuration\n */\nexport async function buildXdiSyncEndpoint(\n apiKeys: string | StoredApiKey[],\n {\n xdiLocation,\n transcendUrl = DEFAULT_TRANSCEND_API,\n removeIpAddresses = true,\n domainBlockList = ['localhost'],\n xdiAllowedCommands = 'ConsentManager:Sync',\n }: {\n /** The file location where the XDI file is hosted */\n xdiLocation: string;\n /** URL of Transcend API */\n transcendUrl?: string;\n /** When true, remove IP addresses (defaults to true) */\n removeIpAddresses?: boolean;\n /** Block list of domains to omit from sync endpoint - includes `localhost` by default */\n domainBlockList?: string[];\n /** Allows XDI commands */\n xdiAllowedCommands?: string;\n },\n): Promise<{\n /** Sync group configurations */\n syncGroups: XdiSyncGroups;\n /** The HTML string */\n html: string;\n}> {\n // Convert API keys to list\n const apiKeysAsList = Array.isArray(apiKeys)\n ? apiKeys\n : [{ apiKey: apiKeys, organizationId: '', organizationName: '' }];\n\n // Fetch configuration for each account\n const consentManagers = await map(\n apiKeysAsList,\n async (apiKey) => {\n logger.info(\n colors.magenta(\n `Pulling consent metadata for organization - ${apiKey.organizationName}`,\n ),\n );\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKey.apiKey);\n\n // Grab consent manager\n const consentManager = await fetchConsentManager(client);\n return consentManager;\n },\n { concurrency: 5 },\n );\n\n // construct the sync groups\n const syncGroups: XdiSyncGroups = {};\n consentManagers.forEach((consentManager) => {\n // grab the partition key\n const partitionKey =\n // take explicit key first\n consentManager.partition?.partition ||\n // fallback to bundle ID\n consentManager.bundleURL.split('/').reverse()[1];\n\n // Ensure that partition exists in the sync groups\n if (!syncGroups[partitionKey]) {\n syncGroups[partitionKey] = [];\n }\n\n // Map domain list to a host list\n const hosts = difference(\n consentManager.configuration.domains\n .filter(\n // ignore IP addresses\n (domain) => !removeIpAddresses || !IP_ADDRESS_REGEX.test(domain),\n )\n .map((domain) => domainToHost(domain)),\n // ignore block list\n domainBlockList,\n );\n // merge existing sync group with hosts for this consent manager\n syncGroups[partitionKey] = [\n ...new Set([...(syncGroups[partitionKey] || []), ...hosts]),\n ];\n });\n\n // Construct the HTML\n const syncEndpointHtml = `\n<!DOCTYPE html>\n<script\nsrc=\"${xdiLocation}\"\ndata-sync-groups='${JSON.stringify(syncGroups, null, 2)}'\ndata-xdi-commands=\"${xdiAllowedCommands}\"\n></script>\n`;\n\n return {\n html: syncEndpointHtml,\n syncGroups,\n };\n}\n","import { BusinessEntityInput, ConsentManagerInput } from '../../codecs';\nimport { logger } from '../../logger';\n\n/**\n * Combine multiple consent manager configurations into a list of business entity configurations\n *\n * @param inputs - Consent manager configurations to combine\n * @returns Business entity configuration input\n */\nexport function consentManagersToBusinessEntities(\n inputs: {\n /** Name of business entity */\n name: string;\n /** Consent manager input */\n input?: ConsentManagerInput;\n }[],\n): BusinessEntityInput[] {\n // Construct the business entities YAML definition\n const businessEntities = inputs.map(\n ({ name, input }): BusinessEntityInput => ({\n // Title of Transcend Instance\n title: name.replace('.yml', ''),\n attributes: [\n // Sync domain list\n ...(input?.domains\n ? [\n {\n key: 'Transcend Domain List',\n values: [...new Set(input.domains)],\n },\n ]\n : []),\n // Sync bundle URLs\n ...(input?.bundleUrls\n ? [\n {\n key: 'Airgap Production URL',\n values: [input.bundleUrls.PRODUCTION],\n },\n {\n key: 'Airgap Test URL',\n values: [input.bundleUrls.TEST],\n },\n {\n key: 'Airgap XDI URL',\n values: [\n input.bundleUrls.PRODUCTION.replace('airgap.js', 'xdi.js'),\n ],\n },\n ]\n : []),\n // Sync partition keys\n ...(input?.partition\n ? [\n {\n key: 'Consent Partition Key',\n values: [input.partition],\n },\n ]\n : []),\n ],\n }),\n );\n\n // Log out info on airgap scripts to host\n logger.info('\\n\\n~~~~~~~~~~~\\nAirgap scripts to host:');\n businessEntities.forEach(({ attributes, title }, ind) => {\n attributes\n ?.find((attr) => attr.key === 'Airgap Production URL')\n ?.values?.forEach((url) => {\n logger.info(`${ind}) ${title} - ${url}`);\n });\n });\n\n return businessEntities;\n}\n","import * as t from 'io-ts';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport type { Got } from 'got';\nimport { ConsentPreferenceFetch } from './types';\n\nexport const ConsentPreferenceResponse = t.intersection([\n t.type({\n nodes: t.array(ConsentPreferenceFetch),\n }),\n t.partial({\n lastKey: t.partial({\n userId: t.string,\n partition: t.string,\n timestamp: t.string,\n }),\n }),\n]);\n\n/** Type override */\nexport type ConsentPreferenceResponse = t.TypeOf<\n typeof ConsentPreferenceResponse\n>;\n\n/**\n * Fetch consent preferences for the managed consent database\n *\n * @param sombra - Sombra instance configured to make requests\n * @param options - Additional options\n * @returns The consent preferences\n */\nexport async function fetchConsentPreferences(\n sombra: Got,\n {\n partition,\n filterBy = {},\n limit = 50,\n }: {\n /** Partition key to fetch */\n partition: string;\n /** Filter consent preferences */\n filterBy?: {\n /** Fetch specific identifiers */\n identifiers?: string[];\n /** Filter before timestamp */\n timestampBefore?: string;\n /** Filter after timestamp */\n timestampAfter?: string;\n };\n /** Number of items to pull back at once */\n limit?: number;\n },\n): Promise<ConsentPreferenceFetch[]> {\n let currentLastKey: ConsentPreferenceResponse['lastKey'];\n const data: ConsentPreferenceFetch[] = [];\n let shouldContinue = true;\n\n while (shouldContinue) {\n const response = await sombra\n .post('v1/consent-preferences', {\n json: {\n partition,\n ...filterBy,\n // using lastKey to paginate if it exists (will not for first iteration)\n startKey: currentLastKey || undefined,\n limit,\n },\n })\n .json();\n const { nodes, lastKey } = decodeCodec(ConsentPreferenceResponse, response);\n\n if (!nodes || nodes.length === 0) {\n break;\n }\n\n // Process the data received from the API call\n // For example, push the new data into an array\n data.push(...nodes);\n\n // Extract the lastKey from the API response\n currentLastKey = lastKey;\n shouldContinue = !!lastKey && Object.keys(lastKey).length > 0;\n }\n\n return data;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunk5UBGZNDCcjs = require('./chunk-5UBGZNDC.cjs');var _typeutils = require('@transcend-io/type-utils');var _jsyaml = require('js-yaml'); var _jsyaml2 = _interopRequireDefault(_jsyaml);var _fs = require('fs');var s=/<<parameters\.(.+?)>>/,i= exports.b ="parameters";function u(e,t,a=""){let r=e;if(Object.entries(t).forEach(([n,p])=>{r=r.split(`<<${i}.${n}>>`).join(p)}),s.test(r)){let[,n]=s.exec(r)||[];throw new Error(`Found variable that was not set: ${n}.
|
|
2
2
|
Make sure you are passing all parameters through the --${i}=${n}:value-for-param flag.
|
|
3
|
-
${a}`)}return r}function b(e,t={}){let a=_fs.readFileSync.call(void 0, e,"utf-8"),r=u(a,t,`Also check that there are no extra variables defined in your yaml: ${e}`);return _typeutils.decodeCodec.call(void 0,
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
${a}`)}return r}function b(e,t={}){let a=_fs.readFileSync.call(void 0, e,"utf-8"),r=u(a,t,`Also check that there are no extra variables defined in your yaml: ${e}`);return _typeutils.decodeCodec.call(void 0, _chunk5UBGZNDCcjs.ga,_jsyaml2.default.load(r))}function h(e,t){_fs.writeFileSync.call(void 0, e,_jsyaml2.default.dump(_typeutils.decodeCodec.call(void 0, _chunk5UBGZNDCcjs.ga,t)))}exports.a = s; exports.b = i; exports.c = u; exports.d = b; exports.e = h;
|
|
4
|
+
//# sourceMappingURL=chunk-RE5YALEO.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/cli/cli/dist/chunk-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/cli/cli/dist/chunk-RE5YALEO.cjs","../src/lib/readTranscendYaml.ts"],"names":["VARIABLE_PARAMETERS_REGEXP","VARIABLE_PARAMETERS_NAME","replaceVariablesInYaml","input","variables","extraErrorMessage","contents","name","value"],"mappings":"AAAA,iOAAyC,qDCAA,iFACxB,wBAC2B,IAG/BA,CAAAA,CAA6B,uBAAA,CAC7BC,CAAAA,aAA2B,YAAA,CAWjC,SAASC,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CAAoB,EAAA,CACZ,CACR,IAAIC,CAAAA,CAAWH,CAAAA,CASf,EAAA,CAPA,MAAA,CAAO,OAAA,CAAQC,CAAS,CAAA,CAAE,OAAA,CAAQ,CAAC,CAACG,CAAAA,CAAMC,CAAK,CAAA,CAAA,EAAM,CACnDF,CAAAA,CAAWA,CAAAA,CACR,KAAA,CAAM,CAAA,EAAA,EAAKL,CAAwB,CAAA,CAAA,EAAIM,CAAI,CAAA,EAAA,CAAI,CAAA,CAC/C,IAAA,CAAKC,CAAK,CACf,CAAC,CAAA,CAGGR,CAAAA,CAA2B,IAAA,CAAKM,CAAQ,CAAA,CAAG,CAC7C,GAAM,CAAC,CAAEC,CAAI,CAAA,CAAIP,CAAAA,CAA2B,IAAA,CAAKM,CAAQ,CAAA,EAAK,CAAC,CAAA,CAC/D,MAAM,IAAI,KAAA,CACR,CAAA,iCAAA,EAAoCC,CAAI,CAAA;AAAA,uDAAA,EACWN,CAAwB,CAAA,CAAA,EAAIM,CAAI,CAAA;AAAA,EACvFF,CAAiB,CAAA,CAAA","file":"/home/runner/work/cli/cli/dist/chunk-RE5YALEO.cjs","sourcesContent":[null,"import { decodeCodec, ObjByString } from '@transcend-io/type-utils';\nimport yaml from 'js-yaml';\nimport { readFileSync, writeFileSync } from 'node:fs';\nimport { TranscendInput } from '../codecs';\n\nexport const VARIABLE_PARAMETERS_REGEXP = /<<parameters\\.(.+?)>>/;\nexport const VARIABLE_PARAMETERS_NAME = 'parameters';\n\n/**\n * Function that replaces variables in a text file.\n * Throws error if there are variables that have not been replaced\n *\n * @param input - Input text\n * @param variables - Variables to replace\n * @param extraErrorMessage - Additional error message text\n * @returns Output text\n */\nexport function replaceVariablesInYaml(\n input: string,\n variables: ObjByString,\n extraErrorMessage = '',\n): string {\n let contents = input;\n // Replace variables\n Object.entries(variables).forEach(([name, value]) => {\n contents = contents\n .split(`<<${VARIABLE_PARAMETERS_NAME}.${name}>>`)\n .join(value);\n });\n\n // Throw error if unfilled variables\n if (VARIABLE_PARAMETERS_REGEXP.test(contents)) {\n const [, name] = VARIABLE_PARAMETERS_REGEXP.exec(contents) || [];\n throw new Error(\n `Found variable that was not set: ${name}.\nMake sure you are passing all parameters through the --${VARIABLE_PARAMETERS_NAME}=${name}:value-for-param flag.\n${extraErrorMessage}`,\n );\n }\n\n return contents;\n}\n\n/**\n * Read in the contents of a yaml file and validate that the shape\n * of the yaml file matches the codec API\n *\n * @param filePath - Path to yaml file\n * @param variables - Variables to fill in\n * @returns The contents of the yaml file, type-checked\n */\nexport function readTranscendYaml(\n filePath: string,\n variables: ObjByString = {},\n): TranscendInput {\n // Read in contents\n const fileContents = readFileSync(filePath, 'utf-8');\n\n // Replace variables\n const replacedVariables = replaceVariablesInYaml(\n fileContents,\n variables,\n `Also check that there are no extra variables defined in your yaml: ${filePath}`,\n );\n\n // Validate shape\n return decodeCodec(TranscendInput, yaml.load(replacedVariables));\n}\n\n/**\n * Write a Transcend configuration to disk\n *\n * @param filePath - Path to yaml file\n * @param input - The input to write out\n */\nexport function writeTranscendYaml(\n filePath: string,\n input: TranscendInput,\n): void {\n writeFileSync(filePath, yaml.dump(decodeCodec(TranscendInput, input)));\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkFUYFDEYIcjs = require('./chunk-FUYFDEYI.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunk2FX6UYVOcjs = require('./chunk-2FX6UYVO.cjs');var _iots = require('io-ts'); var e = _interopRequireWildcard(_iots); var P = _interopRequireWildcard(_iots);var _typeutils = require('@transcend-io/type-utils');var X=e.type({identifier:e.string,type:e.string,coreIdentifier:e.string,dataSiloId:e.string,requestId:e.string,nonce:e.string,requestCreatedAt:e.string,daysUntilOverdue:e.number,attributes:e.array(e.type({key:e.string,values:e.array(e.string)}))});async function U(r,{dataSiloId:s,limit:c=100,offset:n=0,requestType:a}){try{let i=await r.get(`v1/data-silo/${s}/pending-requests/${a}`,{searchParams:{offset:n,limit:c}}).json(),{items:f}=_typeutils.decodeCodec.call(void 0, e.type({items:e.array(X)}),i);return f}catch(i){throw new Error(`Received an error from server: ${_optionalChain([i, 'optionalAccess', _2 => _2.response, 'optionalAccess', _3 => _3.body])||_optionalChain([i, 'optionalAccess', _4 => _4.message])}`)}}var L=P.type({nonce:P.string,identifier:P.string});async function B(r,{nonce:s,identifier:c}){try{return await r.put("v1/data-silo",{headers:{"x-transcend-nonce":s},json:{profiles:[{profileId:c}]}}),!0}catch(n){if(_optionalChain([n, 'access', _5 => _5.response, 'optionalAccess', _6 => _6.statusCode])===409)return!1;throw new Error(`Received an error from server: ${_optionalChain([n, 'optionalAccess', _7 => _7.response, 'optionalAccess', _8 => _8.body])||_optionalChain([n, 'optionalAccess', _9 => _9.message])}`)}}var _bluebird = require('bluebird');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _cliprogress = require('cli-progress'); var _cliprogress2 = _interopRequireDefault(_cliprogress);async function ge({file:r,dataSiloId:s,auth:c,sombraAuth:n,concurrency:a=100,transcendUrl:i=_chunk2FX6UYVOcjs.r,sleepSeconds:f=10}){let y=await _chunkFUYFDEYIcjs.wc.call(void 0, i,c,n);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Reading "${r}" from disk`));let o=_chunkFUYFDEYIcjs.qc.call(void 0, r,L);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Notifying Transcend for data silo "${s}" marking "${o.length}" identifiers as completed.`));let C=new Date().getTime(),w=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),d=0,u=0,l=0;w.start(o.length,0);let m=_chunk2FX6UYVOcjs.b.call(void 0, o,a),I=m.length;await _bluebird.mapSeries.call(void 0, m,async($,S)=>{_chunkZUNVPK23cjs.a.info(_colors2.default.blue(`Processing chunk ${S+1}/${I} (${_chunk2FX6UYVOcjs.b.length} items)`)),await _bluebird.map.call(void 0, $,async h=>{try{await B(y,h)?d+=1:u+=1}catch(b){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Error notifying Transcend for identifier "${h.identifier}" - ${_optionalChain([b, 'optionalAccess', _10 => _10.message])}`)),l+=1}w.update(d+u)}),f>0&&S<I-1&&(_chunkZUNVPK23cjs.a.info(_colors2.default.yellow(`Sleeping for ${f}s before next chunk...`)),await new Promise(h=>{setTimeout(h,f*1e3)}))}),w.stop();let D=new Date().getTime()-C;if(_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully notified Transcend for ${d} identifiers in "${D/1e3}" seconds!`)),u&&_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`There were ${u} identifiers that were not in a state to be updated.They likely have already been resolved.`)),l)throw _chunkZUNVPK23cjs.a.error(_colors2.default.red(`There were ${l} identifiers that failed to be updated. Please review the logs for more information.`)),new Error("Failed to update all identifiers");return o.length}var _privacytypes = require('@transcend-io/privacy-types');async function Pe({requestIds:r,dataSiloId:s,auth:c,concurrency:n=100,status:a=_privacytypes.RequestDataSiloStatus.Resolved,transcendUrl:i=_chunk2FX6UYVOcjs.r}){let f=_chunkFUYFDEYIcjs.vc.call(void 0, i,c),y=new Date().getTime(),o=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Notifying Transcend for data silo "${s}" marking "${r.length}" requests as completed.`));let C=0;o.start(r.length,0),await _bluebird.map.call(void 0, r,async u=>{let l=await _chunkFUYFDEYIcjs.Ed.call(void 0, f,{requestId:u,dataSiloId:s});try{await _chunkFUYFDEYIcjs.$f.call(void 0, f,_chunkFUYFDEYIcjs.ua,{requestDataSiloId:l.id,status:a})}catch(m){if(!m.message.includes("Client error: Request must be active:")&&!m.message.includes("Failed to find RequestDataSilo"))throw m}C+=1,o.update(C)},{concurrency:n}),o.stop();let d=new Date().getTime()-y;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully notified Transcend in "${d/1e3}" seconds!`)),r.length}async function _e({dataSiloId:r,auth:s,sombraAuth:c,actions:n,apiPageSize:a=100,savePageSize:i=1e3,onSave:f,transcendUrl:y=_chunk2FX6UYVOcjs.r,skipRequestCount:o=!1}){if(i%a!==0)throw new Error(`savePageSize must be a multiple of apiPageSize. savePageSize: ${i}, apiPageSize: ${a}`);let C=await _chunkFUYFDEYIcjs.wc.call(void 0, y,s,c),w=_chunkFUYFDEYIcjs.vc.call(void 0, y,s),d=0;o||(d=await _chunkFUYFDEYIcjs.Fd.call(void 0, w,{dataSiloId:r})),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Pulling ${o?"all":d} outstanding request identifiers for data silo: "${r}" for requests of types "${n.join('", "')}"`));let u=new Date().getTime(),l=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),m=new Set,I=[],g=[];o||l.start(d,0),await _bluebird.mapSeries.call(void 0, n,async $=>{let S=0,h=!0;for(;h;){let b=await U(C,{dataSiloId:r,limit:a,offset:S,requestType:$}),k=b.map(A=>(m.add(A.requestId),{...A,action:$})),J=k.map(({attributes:A,...K})=>({...K,...A.reduce((M,E)=>Object.assign(M,{[E.key]:E.values.join(",")}),{})}));I.push(...k),g.push(...J),g.length>=i&&(await f(g),g=[]),h=b.length===a,S+=a,o?_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Pulled ${b.length} outstanding identifiers for ${m.size} requests`)):l.update(m.size)}}),g.length>0&&await f(g),o||l.stop();let D=new Date().getTime()-u;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully pulled ${I.length} outstanding identifiers from ${m.size} requests in "${D/1e3}" seconds!`)),{identifiers:I}}exports.a = X; exports.b = U; exports.c = L; exports.d = B; exports.e = ge; exports.f = Pe; exports.g = _e;
|
|
2
|
+
//# sourceMappingURL=chunk-VD7RHIZE.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/cli/cli/dist/chunk-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/cli/cli/dist/chunk-VD7RHIZE.cjs","../src/lib/cron/pullCronPageOfIdentifiers.ts"],"names":["CronIdentifier","pullCronPageOfIdentifiers","sombra","dataSiloId","limit","offset","requestType","response"],"mappings":"AAAA,u/BAAyF,wDAAyC,wDAAgD,6GCA/J,qDACS,IAIfA,CAAAA,CAAmB,CAAA,CAAA,IAAA,CAAK,CAEnC,UAAA,CAAc,CAAA,CAAA,MAAA,CAEd,IAAA,CAAQ,CAAA,CAAA,MAAA,CAER,cAAA,CAAkB,CAAA,CAAA,MAAA,CAElB,UAAA,CAAc,CAAA,CAAA,MAAA,CAEd,SAAA,CAAa,CAAA,CAAA,MAAA,CAEb,KAAA,CAAS,CAAA,CAAA,MAAA,CAET,gBAAA,CAAoB,CAAA,CAAA,MAAA,CAEpB,gBAAA,CAAoB,CAAA,CAAA,MAAA,CAEpB,UAAA,CAAc,CAAA,CAAA,KAAA,CACV,CAAA,CAAA,IAAA,CAAK,CACL,GAAA,CAAO,CAAA,CAAA,MAAA,CACP,MAAA,CAAU,CAAA,CAAA,KAAA,CAAQ,CAAA,CAAA,MAAM,CAC1B,CAAC,CACH,CACF,CAAC,CAAA,CAaD,MAAA,SAAsBC,CAAAA,CACpBC,CAAAA,CACA,CACE,UAAA,CAAAC,CAAAA,CACA,KAAA,CAAAC,CAAAA,CAAQ,GAAA,CACR,MAAA,CAAAC,CAAAA,CAAS,CAAA,CACT,WAAA,CAAAC,CACF,CAAA,CAU2B,CAC3B,GAAI,CAEF,IAAMC,CAAAA,CAAW,MAAML,CAAAA,CACpB,GAAA,CAAI,CAAA,aAAA,EAAgBC,CAAU,CAAA,kBAAA,EAAqBG,CAAW,CAAA,CAAA","file":"/home/runner/work/cli/cli/dist/chunk-VD7RHIZE.cjs","sourcesContent":[null,"import * as t from 'io-ts';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport { RequestAction } from '@transcend-io/privacy-types';\nimport type { Got } from 'got';\n\nexport const CronIdentifier = t.type({\n /** The identifier value */\n identifier: t.string,\n /** The type of identifier */\n type: t.string,\n /** The core identifier of the request */\n coreIdentifier: t.string,\n /** The ID of the underlying data silo */\n dataSiloId: t.string,\n /** The ID of the underlying request */\n requestId: t.string,\n /** The request nonce */\n nonce: t.string,\n /** The time the request was created */\n requestCreatedAt: t.string,\n /** The number of days until the request is overdue */\n daysUntilOverdue: t.number,\n /** Request attributes */\n attributes: t.array(\n t.type({\n key: t.string,\n values: t.array(t.string),\n }),\n ),\n});\n\n/** Type override */\nexport type CronIdentifier = t.TypeOf<typeof CronIdentifier>;\n\n/**\n * Pull a offset of identifiers for a cron job\n *\n * @see https://docs.transcend.io/docs/api-reference/GET/v1/data-silo/(id)/pending-requests/(type)\n * @param sombra - Sombra instance configured to make requests\n * @param options - Additional options\n * @returns Successfully submitted request\n */\nexport async function pullCronPageOfIdentifiers(\n sombra: Got,\n {\n dataSiloId,\n limit = 100,\n offset = 0,\n requestType,\n }: {\n /** Data Silo ID */\n dataSiloId: string;\n /** Type of request */\n requestType: RequestAction;\n /** Number of identifiers to pull in */\n limit?: number;\n /** Page to pull in */\n offset?: number;\n },\n): Promise<CronIdentifier[]> {\n try {\n // Make the GraphQL request\n const response = await sombra\n .get(`v1/data-silo/${dataSiloId}/pending-requests/${requestType}`, {\n searchParams: {\n offset,\n limit,\n },\n })\n .json();\n\n const { items } = decodeCodec(\n t.type({\n items: t.array(CronIdentifier),\n }),\n response,\n );\n return items;\n } catch (err) {\n throw new Error(\n `Received an error from server: ${err?.response?.body || err?.message}`,\n );\n }\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunkFUYFDEYIcjs = require('./chunk-FUYFDEYI.cjs');require('./chunk-LCDYXJN6.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-2FX6UYVO.cjs');require('./chunk-Q7I37FJV.cjs');async function c({auth:i,transcendUrl:n,identifierNames:r,actions:o=[]}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),await _chunkFUYFDEYIcjs.Of.call(void 0, {requestActions:o,transcendUrl:n,auth:i,identifierNames:r})}exports.rejectUnverifiedIdentifiers = c;
|
|
2
|
+
//# sourceMappingURL=impl-2BWD4YFV.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-2BWD4YFV.cjs","../src/commands/request/reject-unverified-identifiers/impl.ts"],"names":["rejectUnverifiedIdentifiers","auth","transcendUrl","identifierNames","actions","doneInputValidation","removeUnverifiedRequestIdentifiers"],"mappings":"AAAA,iIAAwC,wDAA0C,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCYtM,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CAAU,CAAC,CACb,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,MAAMC,kCAAAA,CACJ,cAAA,CAAgBF,CAAAA,CAChB,YAAA,CAAAF,CAAAA,CACA,IAAA,CAAAD,CAAAA,CACA,eAAA,CAAAE,CACF,CAAC,CACH,CAAA,wCAAA","file":"/home/runner/work/cli/cli/dist/impl-2BWD4YFV.cjs","sourcesContent":[null,"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"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk2PSFXDKUcjs = require('./chunk-2PSFXDKU.cjs');require('./chunk-LR3CPNDM.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');require('./chunk-FUYFDEYI.cjs');require('./chunk-LCDYXJN6.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-2FX6UYVO.cjs');require('./chunk-Q7I37FJV.cjs');async function m({auth:i,transcendUrl:n,file:o,concurrency:r,actions:s,sombraAuth:a}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),await _chunk2PSFXDKUcjs.a.call(void 0, {file:o,transcendUrl:n,concurrency:r,requestActions:s,auth:i,sombraAuth:a})}exports.pullIdentifiers = m;
|
|
2
|
+
//# sourceMappingURL=impl-2L3QQZXF.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-2L3QQZXF.cjs","../src/commands/request/preflight/pull-identifiers/impl.ts"],"names":["pullIdentifiers","auth","transcendUrl","file","concurrency","actions","sombraAuth","doneInputValidation","pullManualEnrichmentIdentifiersToCsv"],"mappings":"AAAA,iIAAwC,gCAA6B,wDAAyC,gCAA6B,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCc/P,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,MAAMC,iCAAAA,CACJ,IAAA,CAAAL,CAAAA,CACA,YAAA,CAAAD,CAAAA,CACA,WAAA,CAAAE,CAAAA,CACA,cAAA,CAAgBC,CAAAA,CAChB,IAAA,CAAAJ,CAAAA,CACA,UAAA,CAAAK,CACF,CAAC,CACH,CAAA,4BAAA","file":"/home/runner/work/cli/cli/dist/impl-2L3QQZXF.cjs","sourcesContent":[null,"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"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunkFUYFDEYIcjs = require('./chunk-FUYFDEYI.cjs');require('./chunk-LCDYXJN6.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-2FX6UYVO.cjs');require('./chunk-Q7I37FJV.cjs');async function d({auth:r,transcendUrl:n,actions:o,statuses:s,requestIds:a,createdAtBefore:i,createdAtAfter:c,concurrency:m}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),await _chunkFUYFDEYIcjs.lf.call(void 0, {transcendUrl:n,requestActions:o,auth:r,requestIds:a,statuses:s,concurrency:m,createdAtBefore:i,createdAtAfter:c})}exports.markSilent = d;
|
|
2
|
+
//# sourceMappingURL=impl-2TXAFNME.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-2TXAFNME.cjs","../src/commands/request/mark-silent/impl.ts"],"names":["markSilent","auth","transcendUrl","actions","statuses","requestIds","createdAtBefore","createdAtAfter","concurrency","doneInputValidation","markSilentPrivacyRequests"],"mappings":"AAAA,iIAAwC,wDAA0C,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCgBtM,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,MAAMC,kCAAAA,CACJ,YAAA,CAAAR,CAAAA,CACA,cAAA,CAAgBC,CAAAA,CAChB,IAAA,CAAAF,CAAAA,CACA,UAAA,CAAAI,CAAAA,CACA,QAAA,CAAAD,CAAAA,CACA,WAAA,CAAAI,CAAAA,CACA,eAAA,CAAAF,CAAAA,CACA,cAAA,CAAAC,CACF,CAAC,CACH,CAAA,uBAAA","file":"/home/runner/work/cli/cli/dist/impl-2TXAFNME.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { markSilentPrivacyRequests } from '../../../lib/requests';\nimport type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface MarkSilentCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses?: RequestStatus[];\n requestIds?: string[];\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function markSilent(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n actions,\n statuses,\n requestIds,\n createdAtBefore,\n createdAtAfter,\n concurrency,\n }: MarkSilentCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await markSilentPrivacyRequests({\n transcendUrl,\n requestActions: actions,\n auth,\n requestIds,\n statuses,\n concurrency,\n createdAtBefore,\n createdAtAfter,\n });\n}\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var
|
|
2
|
-
`)}`);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`The timestamp column "${i.timestampColum}" is present for all row`))}return i}async function ue(c,i){let h=
|
|
3
|
-
`)}`;if(_chunkZUNVPK23cjs.a.warn(_colors2.default.yellow(o)),!await
|
|
4
|
-
When 'forceTriggerWorkflows' is set all the user identifiers should contain a consent record`);if(v&&we({currentConsentRecord:v,pendingUpdates:S,preferenceTopics:d})&&!l){t.skippedUpdates[b]=y;return}if(v&&he({currentConsentRecord:v,pendingUpdates:S,preferenceTopics:d})){t.pendingConflictUpdates[b]={row:y,record:v};return}t.pendingSafeUpdates[b]=y}),s[c]=t,await o.setValue(s,"fileMetadata");let P=new Date().getTime();_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully pre-processed file: "${c}" in ${(P-f)/1e3}s`))}var be=e.type({purpose:e.string,preference:e.union([e.string,e.null]),valueMapping:e.record(e.string,e.union([e.string,e.boolean,e.null,e.undefined]))}),Kt=e.record(e.string,be),Ae=e.type({name:e.string,isUniqueOnPreferenceStore:e.boolean}),Yt=e.record(e.string,Ae),De=e.intersection([e.type({columnToPurposeName:e.record(e.string,be),lastFetchedAt:e.string,pendingSafeUpdates:e.record(e.string,e.record(e.string,e.string)),pendingConflictUpdates:e.record(e.string,e.type({record:_privacytypes.PreferenceQueryResponseItem,row:e.record(e.string,e.string)})),skippedUpdates:e.record(e.string,e.record(e.string,e.string))}),e.partial({identifierColumn:e.string,timestampColum:e.string})]),Jt=e.record(e.string,e.union([e.boolean,_privacytypes.PreferenceUpdateItem])),zt=e.record(e.string,e.union([e.boolean,e.record(e.string,e.string)])),Ht=e.record(e.string,e.type({uploadedAt:e.string,error:e.string,update:_privacytypes.PreferenceUpdateItem})),Xt=e.record(e.string,e.type({record:_privacytypes.PreferenceQueryResponseItem,row:e.record(e.string,e.string)})),Zt=e.record(e.string,e.record(e.string,e.string)),Ce=e.type({fileMetadata:e.record(e.string,De),failingUpdates:e.record(e.string,e.type({uploadedAt:e.string,error:e.string,update:_privacytypes.PreferenceUpdateItem})),pendingUpdates:e.record(e.string,_privacytypes.PreferenceUpdateItem)});async function Ue({auth:c,sombraAuth:i,receiptFilepath:h,file:d,partition:a,isSilent:u=!0,dryRun:l=!1,skipWorkflowTriggers:o=!1,skipConflictUpdates:f=!1,skipExistingRecordCheck:s=!1,attributes:r=[],transcendUrl:t,forceTriggerWorkflows:n=!1}){let g=
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunkFUYFDEYIcjs = require('./chunk-FUYFDEYI.cjs');require('./chunk-LCDYXJN6.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunk2FX6UYVOcjs = require('./chunk-2FX6UYVO.cjs');require('./chunk-Q7I37FJV.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _bluebird = require('bluebird');var _cliprogress = require('cli-progress'); var _cliprogress2 = _interopRequireDefault(_cliprogress);var _persistedstate = require('@transcend-io/persisted-state');var _iots = require('io-ts'); var j = _interopRequireWildcard(_iots); var T = _interopRequireWildcard(_iots); var e = _interopRequireWildcard(_iots);var _privacytypes = require('@transcend-io/privacy-types');var _typeutils = require('@transcend-io/type-utils');var Ee=T.intersection([T.type({nodes:T.array(_privacytypes.PreferenceQueryResponseItem)}),T.partial({cursor:T.string})]),Oe=["ENOTFOUND","ETIMEDOUT","504 Gateway Time-out","Task timed out after"];async function ce(c,{identifiers:i,partitionKey:h,skipLogging:d=!1}){let a=[],u=_chunk2FX6UYVOcjs.b.call(void 0, i,100),l=new Date().getTime(),o=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic);d||o.start(i.length,0);let f=0;await _bluebird.map.call(void 0, u,async t=>{let n=0,g=3;for(;n<g;)try{let m=await c.post(`v1/preferences/${h}/query`,{json:{filter:{identifiers:t},limit:t.length}}).json(),w=_typeutils.decodeCodec.call(void 0, Ee,m);a.push(...w.nodes),f+=t.length,o.update(f);break}catch(m){n+=1;let w=_optionalChain([m, 'optionalAccess', _2 => _2.response, 'optionalAccess', _3 => _3.body])||_optionalChain([m, 'optionalAccess', _4 => _4.message])||"";if(n>=g||!Oe.some(P=>w.includes(P)))throw new Error(`Received an error from server after ${n} attempts: ${w}`);_chunkZUNVPK23cjs.a.warn(_colors2.default.yellow(`[RETRYING FAILED REQUEST - Attempt ${n}] Failed to fetch ${t.length} user preferences from partition ${h}: ${w}`))}},{concurrency:40}),o.stop();let r=new Date().getTime()-l;return d||_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Completed download in "${r/1e3}" seconds.`)),a}function q({row:c,columnToPurposeName:i,purposeSlugs:h,preferenceTopics:d}){let a={};return Object.entries(i).forEach(([u,{purpose:l,preference:o,valueMapping:f}])=>{if(!h.includes(l))throw new Error(`Invalid purpose slug: ${l}, expected: ${h.join(", ")}`);let s=c[u];if(o){let r=d.find(t=>t.slug===o&&t.purpose.trackingType===l);if(!r){let t=d.filter(n=>n.purpose.trackingType===l).map(n=>n.slug);throw new Error(`Invalid preference slug: ${o} for purpose: ${l}. Allowed preference slugs for purpose are: ${t.join(",")}`)}switch(a[l]||(a[l]={preferences:[]}),a[l].preferences||(a[l].preferences=[]),r.type){case _privacytypes.PreferenceTopicType.Boolean:{let t=f[s];if(t===void 0&&s!=="")throw new Error(`No preference mapping found for value "${s}" in column "${u}" (purpose=${l}, preference=${o})`);if(t==null)return;if(typeof t!="boolean")throw new Error(`Invalid value for boolean preference: ${o}, expected boolean, got: ${s}`);a[l].preferences.push({topic:o,choice:{booleanValue:t}});break}case _privacytypes.PreferenceTopicType.Select:{let t=f[s];if(t===void 0&&s!=="")throw new Error(`No preference mapping found for value "${s}" in column "${u}" (purpose=${l}, preference=${o})`);if(t==null)return;if(typeof t!="string")throw new Error(`Invalid value for select preference: ${o}, expected string, got: ${s}`);let n=t.trim()||null;if(n&&!r.preferenceOptionValues.map(({slug:g})=>g).includes(n))throw new Error(`Invalid value for select preference: ${o}, expected one of: ${r.preferenceOptionValues.map(({slug:g})=>g).join(", ")}, got: ${s}`);a[l].preferences.push({topic:o,choice:{selectValue:n}});break}case _privacytypes.PreferenceTopicType.MultiSelect:{if(typeof s!="string")throw new Error(`Invalid value for multi select preference: ${o}, expected string, got: ${s}`);let t=_chunkFUYFDEYIcjs.nc.call(void 0, s).map(n=>{let g=f[n];if(g===void 0&&s!=="")throw new Error(`No preference mapping found for multi select token "${s}" in column "${u}" (purpose=${l}, preference=${o})`);if(g==null)return null;if(typeof g!="string")throw new Error(`Invalid value for multi select preference: ${o}, expected one of: ${r.preferenceOptionValues.map(({slug:m})=>m).join(", ")}, got: ${n}`);return g}).filter(n=>n!==null).sort((n,g)=>n.localeCompare(g));t.length>0&&a[l].preferences.push({topic:o,choice:{selectValues:t}});break}default:throw new Error(`Unknown preference type: ${r.type}`)}}else{let r=f[s];if(r===void 0&&s!=="")throw new Error(`No preference mapping found for value "${s}" in column "${u}" (purpose=${l}, preference=\u2205)`);if(r===null)return;a[l]?a[l].enabled=r===!0:a[l]={enabled:r===!0}}}),_typeutils.apply.call(void 0, a,(u,l)=>{if(typeof u.enabled!="boolean")throw new Error(`No mapping provided for purpose.enabled=true/false value: ${l}`);return{...u,enabled:u.enabled}})}var _inquirer = require('inquirer'); var _inquirer2 = _interopRequireDefault(_inquirer);var B="[NONE]";async function de(c,i){let h=_chunk2FX6UYVOcjs.j.call(void 0, c.map(a=>Object.keys(a)).flat()),d=_chunk2FX6UYVOcjs.c.call(void 0, h,[...i.identifierColumn?[i.identifierColumn]:[],...Object.keys(i.columnToPurposeName)]);if(!i.timestampColum){let{timestampName:a}=await _inquirer2.default.prompt([{name:"timestampName",message:"Choose the column that will be used as the timestamp of last preference update",type:"list",default:d.find(u=>u.toLowerCase().includes("date"))||d.find(u=>u.toLowerCase().includes("time"))||d[0],choices:[...d,B]}]);i.timestampColum=a}if(_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Using timestamp column "${i.timestampColum}"`)),i.timestampColum!==B){let a=c.map((u,l)=>u[i.timestampColum]?null:[l]).filter(u=>!!u).flat();if(a.length>0)throw new Error(`The timestamp column "${i.timestampColum}" is missing a value for the following rows: ${a.join(`
|
|
2
|
+
`)}`);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`The timestamp column "${i.timestampColum}" is present for all row`))}return i}async function ue(c,i){let h=_chunk2FX6UYVOcjs.j.call(void 0, c.map(o=>Object.keys(o)).flat()),d=_chunk2FX6UYVOcjs.c.call(void 0, h,[...i.identifierColumn?[i.identifierColumn]:[],...Object.keys(i.columnToPurposeName)]);if(!i.identifierColumn){let{identifierName:o}=await _inquirer2.default.prompt([{name:"identifierName",message:"Choose the column that will be used as the identifier to upload consent preferences by",type:"list",default:d.find(f=>f.toLowerCase().includes("email"))||d[0],choices:d}]);i.identifierColumn=o}_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Using identifier column "${i.identifierColumn}"`));let a=c.map((o,f)=>o[i.identifierColumn]?null:[f]).filter(o=>!!o).flat();if(a.length>0){let o=`The identifier column "${i.identifierColumn}" is missing a value for the following rows: ${a.join(", ")}`;if(_chunkZUNVPK23cjs.a.warn(_colors2.default.yellow(o)),!await _chunkFUYFDEYIcjs.Pf.call(void 0, {message:"Would you like to skip rows missing an identifier?"}))throw new Error(o);let s=c.length;c=c.filter(r=>r[i.identifierColumn]),_chunkZUNVPK23cjs.a.info(_colors2.default.yellow(`Skipped ${s-c.length} rows missing an identifier`))}_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`The identifier column "${i.identifierColumn}" is present for all rows`));let u=_chunk2FX6UYVOcjs.d.call(void 0, c,i.identifierColumn),l=Object.entries(u).filter(([,o])=>o.length>1);if(l.length>0){let o=`The identifier column "${i.identifierColumn}" has duplicate values for the following rows: ${l.slice(0,10).map(([s,r])=>`${s} (${r.length})`).join(`
|
|
3
|
+
`)}`;if(_chunkZUNVPK23cjs.a.warn(_colors2.default.yellow(o)),!await _chunkFUYFDEYIcjs.Pf.call(void 0, {message:"Would you like to automatically take the latest update?"}))throw new Error(o);c=Object.entries(u).map(([,s])=>s.sort((t,n)=>new Date(n[i.timestampColum]).getTime()-new Date(t[i.timestampColum]).getTime())[0]).filter(s=>s)}return{currentState:i,preferences:c}}async function ge(c,i,{purposeSlugs:h,preferenceTopics:d,forceTriggerWorkflows:a}){let u=_chunk2FX6UYVOcjs.j.call(void 0, c.map(f=>Object.keys(f)).flat()),l=_chunk2FX6UYVOcjs.c.call(void 0, u,[...i.identifierColumn?[i.identifierColumn]:[],...i.timestampColum?[i.timestampColum]:[]]);if(l.length===0){if(a)return i;throw new Error("No other columns to process")}let o=[...h,...d.map(f=>`${f.purpose.trackingType}->${f.slug}`)];return await _bluebird.mapSeries.call(void 0, l,async f=>{let s=_chunk2FX6UYVOcjs.j.call(void 0, c.map(t=>t[f])),r=i.columnToPurposeName[f];if(r)_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Column "${f}" is associated with purpose "${r.purpose}"`));else{let{purposeName:t}=await _inquirer2.default.prompt([{name:"purposeName",message:`Choose the purpose that column ${f} is associated with`,type:"list",default:o.find(m=>m.startsWith(h[0])),choices:o}]),[n,g]=t.split("->");r={purpose:n,preference:g||null,valueMapping:{}}}await _bluebird.mapSeries.call(void 0, s,async t=>{if(r.valueMapping[t]!==void 0){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Value "${t}" is associated with purpose value "${r.valueMapping[t]}"`));return}if(r.preference===null){let{purposeValue:n}=await _inquirer2.default.prompt([{name:"purposeValue",message:`Choose the purpose value for value "${t}" associated with purpose "${r.purpose}"`,type:"confirm",default:t!=="false"}]);r.valueMapping[t]=n}if(r.preference!==null){let n=d.find(m=>m.slug===r.preference);if(!n){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Preference topic "${r.preference}" not found`));return}let g=n.preferenceOptionValues.map(({slug:m})=>m);if(n.type===_privacytypes.PreferenceTopicType.Boolean){let{preferenceValue:m}=await _inquirer2.default.prompt([{name:"preferenceValue",message:`Choose the preference value for "${n.slug}" value "${t}" associated with purpose "${r.purpose}"`,type:"confirm",default:t!=="false"}]);r.valueMapping[t]=m;return}if(n.type===_privacytypes.PreferenceTopicType.Select){let{preferenceValue:m}=await _inquirer2.default.prompt([{name:"preferenceValue",message:`Choose the preference value for "${n.slug}" value "${t}" associated with purpose "${r.purpose}"`,type:"list",choices:g,default:g.find(w=>w===t)}]);r.valueMapping[t]=m;return}if(n.type===_privacytypes.PreferenceTopicType.MultiSelect){let m=_chunkFUYFDEYIcjs.nc.call(void 0, t);await _bluebird.mapSeries.call(void 0, m,async w=>{if(r.valueMapping[w]!==void 0)return;let{preferenceValue:P}=await _inquirer2.default.prompt([{name:"preferenceValue",message:`Choose the preference value for "${n.slug}" value "${w}" associated with purpose "${r.purpose}"`,type:"list",choices:g,default:g.find(y=>y===w)}]);r.valueMapping[w]=P});return}throw new Error(`Unknown preference topic type: ${n.type}`)}}),i.columnToPurposeName[f]=r}),i}function we({currentConsentRecord:c,pendingUpdates:i,preferenceTopics:h}){return Object.entries(i).every(([d,{preferences:a=[],enabled:u}])=>{let l=c.purposes.find(f=>f.purpose===d);return!!l&&l.enabled===u?a.every(({topic:f,choice:s})=>l.preferences&&l.preferences.find(r=>{if(r.topic!==f)return!1;let t=h.find(n=>n.slug===f&&n.purpose.trackingType===d);if(!t)throw new Error(`Could not find preference topic for ${f}`);switch(t.type){case _privacytypes.PreferenceTopicType.Boolean:return r.choice.booleanValue===s.booleanValue;case _privacytypes.PreferenceTopicType.Select:return r.choice.selectValue===s.selectValue;case _privacytypes.PreferenceTopicType.MultiSelect:let n=(r.choice.selectValues||[]).sort(),g=(s.selectValues||[]).sort();return n.length===g.length&&n.every((m,w)=>m===g[w]);default:throw new Error(`Unknown preference topic type: ${t.type}`)}})):!1})}function he({currentConsentRecord:c,pendingUpdates:i,preferenceTopics:h,log:d}){return!!Object.entries(i).find(([a,{preferences:u=[],enabled:l}])=>{let o=c.purposes.find(f=>f.purpose===a);return o?o.enabled!==l?(d&&_chunkZUNVPK23cjs.a.warn(`Purpose ${a} enabled value conflict for user ${c.userId}. Pending Value: ${l}, Current Value: ${o.enabled}`),!0):!!u.find(({topic:f,choice:s})=>{let r=(o.preferences||[]).find(m=>m.topic===f);if(!r)return d&&_chunkZUNVPK23cjs.a.warn(`No existing preference found for topic ${f} in purpose ${a} for user ${c.userId}.`),!1;let t=h.find(m=>m.slug===f&&m.purpose.trackingType===a);if(!t)throw new Error(`Could not find preference topic for ${f}`);let n,g;switch(t.type){case _privacytypes.PreferenceTopicType.Boolean:return n=r.choice.booleanValue!==s.booleanValue,d&&_chunkZUNVPK23cjs.a.warn(`Preference topic ${f} boolean value conflict for user ${c.userId}. Expected: ${s.booleanValue}, Found: ${r.choice.booleanValue}`),n;case _privacytypes.PreferenceTopicType.Select:return g=r.choice.selectValue!==s.selectValue,d&&_chunkZUNVPK23cjs.a.warn(`Preference topic ${f} select value conflict for user ${c.userId}. Expected: ${s.selectValue}, Found: ${r.choice.selectValue}`),g;case _privacytypes.PreferenceTopicType.MultiSelect:let m=(r.choice.selectValues||[]).sort(),w=(s.selectValues||[]).sort();return g=m.length!==w.length||!m.every((P,y)=>P===w[y]),d&&_chunkZUNVPK23cjs.a.warn(`Preference topic ${f} multi-select value conflict for user ${c.userId}. Expected: ${w.join(", ")}, Found: ${m.join(", ")}`),g;default:throw new Error(`Unknown preference topic type: ${t.type}`)}}):(d&&_chunkZUNVPK23cjs.a.warn(`No existing purpose found for ${a} in consent record for ${c.userId}.`),!1)})}async function Pe({file:c,sombra:i,purposeSlugs:h,preferenceTopics:d,partitionKey:a,skipExistingRecordCheck:u,forceTriggerWorkflows:l},o){let f=new Date().getTime(),s=o.getValue("fileMetadata");_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Reading in file: "${c}"`));let r=_chunkFUYFDEYIcjs.qc.call(void 0, c,j.record(j.string,j.string)),t={columnToPurposeName:{},pendingSafeUpdates:{},pendingConflictUpdates:{},skippedUpdates:{},...s[c]||{},lastFetchedAt:new Date().toISOString()};t=await de(r,t),s[c]=t,await o.setValue(s,"fileMetadata");let n=await ue(r,t);t=n.currentState,r=n.preferences,s[c]=t,await o.setValue(s,"fileMetadata"),t=await ge(r,t,{preferenceTopics:d,purposeSlugs:h,forceTriggerWorkflows:l}),s[c]=t,await o.setValue(s,"fileMetadata");let g=r.map(y=>y[t.identifierColumn]),m=u?[]:await ce(i,{identifiers:g.map(y=>({value:y})),partitionKey:a}),w=_chunk2FX6UYVOcjs.e.call(void 0, m,"userId");t.pendingConflictUpdates={},t.pendingSafeUpdates={},t.skippedUpdates={},r.forEach(y=>{let b=y[t.identifierColumn],S=q({row:y,columnToPurposeName:t.columnToPurposeName,preferenceTopics:d,purposeSlugs:h}),v=w[b];if(l&&!v)throw new Error(`No existing consent record found for user with id: ${b}.
|
|
4
|
+
When 'forceTriggerWorkflows' is set all the user identifiers should contain a consent record`);if(v&&we({currentConsentRecord:v,pendingUpdates:S,preferenceTopics:d})&&!l){t.skippedUpdates[b]=y;return}if(v&&he({currentConsentRecord:v,pendingUpdates:S,preferenceTopics:d})){t.pendingConflictUpdates[b]={row:y,record:v};return}t.pendingSafeUpdates[b]=y}),s[c]=t,await o.setValue(s,"fileMetadata");let P=new Date().getTime();_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully pre-processed file: "${c}" in ${(P-f)/1e3}s`))}var be=e.type({purpose:e.string,preference:e.union([e.string,e.null]),valueMapping:e.record(e.string,e.union([e.string,e.boolean,e.null,e.undefined]))}),Kt=e.record(e.string,be),Ae=e.type({name:e.string,isUniqueOnPreferenceStore:e.boolean}),Yt=e.record(e.string,Ae),De=e.intersection([e.type({columnToPurposeName:e.record(e.string,be),lastFetchedAt:e.string,pendingSafeUpdates:e.record(e.string,e.record(e.string,e.string)),pendingConflictUpdates:e.record(e.string,e.type({record:_privacytypes.PreferenceQueryResponseItem,row:e.record(e.string,e.string)})),skippedUpdates:e.record(e.string,e.record(e.string,e.string))}),e.partial({identifierColumn:e.string,timestampColum:e.string})]),Jt=e.record(e.string,e.union([e.boolean,_privacytypes.PreferenceUpdateItem])),zt=e.record(e.string,e.union([e.boolean,e.record(e.string,e.string)])),Ht=e.record(e.string,e.type({uploadedAt:e.string,error:e.string,update:_privacytypes.PreferenceUpdateItem})),Xt=e.record(e.string,e.type({record:_privacytypes.PreferenceQueryResponseItem,row:e.record(e.string,e.string)})),Zt=e.record(e.string,e.record(e.string,e.string)),Ce=e.type({fileMetadata:e.record(e.string,De),failingUpdates:e.record(e.string,e.type({uploadedAt:e.string,error:e.string,update:_privacytypes.PreferenceUpdateItem})),pendingUpdates:e.record(e.string,_privacytypes.PreferenceUpdateItem)});async function Ue({auth:c,sombraAuth:i,receiptFilepath:h,file:d,partition:a,isSilent:u=!0,dryRun:l=!1,skipWorkflowTriggers:o=!1,skipConflictUpdates:f=!1,skipExistingRecordCheck:s=!1,attributes:r=[],transcendUrl:t,forceTriggerWorkflows:n=!1}){let g=_chunkFUYFDEYIcjs.pc.call(void 0, r),m=new (0, _persistedstate.PersistedState)(h,Ce,{fileMetadata:{},failingUpdates:{},pendingUpdates:{}}),w=m.getValue("failingUpdates"),P=m.getValue("pendingUpdates"),y=m.getValue("fileMetadata");_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Restored cache, there are:
|
|
5
5
|
${Object.values(w).length} failing requests to be retried
|
|
6
6
|
${Object.values(P).length} pending requests to be processed
|
|
7
7
|
The following files are stored in cache and will be used:
|
|
8
8
|
${Object.keys(y).map($=>$).join(`
|
|
9
9
|
`)}
|
|
10
10
|
The following file will be processed: ${d}
|
|
11
|
-
`));let b=
|
|
12
|
-
//# sourceMappingURL=impl-
|
|
11
|
+
`));let b=_chunkFUYFDEYIcjs.vc.call(void 0, t,c),[S,v,X]=await Promise.all([_chunkFUYFDEYIcjs.wc.call(void 0, t,c,i),n?Promise.resolve([]):_chunkFUYFDEYIcjs.dd.call(void 0, b),n?Promise.resolve([]):_chunkFUYFDEYIcjs.$c.call(void 0, b)]);await Pe({file:d,purposeSlugs:v.map($=>$.trackingType),preferenceTopics:X,sombra:S,partitionKey:a,skipExistingRecordCheck:s,forceTriggerWorkflows:n},m);let E={};y=m.getValue("fileMetadata");let x=y[d];if(_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Found ${Object.entries(x.pendingSafeUpdates).length} safe updates in ${d}`)),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Found ${Object.entries(x.pendingConflictUpdates).length} conflict updates in ${d}`)),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Found ${Object.entries(x.skippedUpdates).length} skipped updates in ${d}`)),Object.entries({...x.pendingSafeUpdates,...f?{}:_typeutils.apply.call(void 0, x.pendingConflictUpdates,({row:$})=>$)}).forEach(([$,C])=>{let A=x.timestampColum===B?new Date:new Date(C[x.timestampColum]),V=q({row:C,columnToPurposeName:x.columnToPurposeName,preferenceTopics:X,purposeSlugs:v.map(O=>O.trackingType)});E[$]={userId:$,partition:a,timestamp:A.toISOString(),purposes:Object.entries(V).map(([O,Ie])=>({...Ie,purpose:O,workflowSettings:{attributes:g,isSilent:u,skipWorkflowTrigger:o}}))}}),await m.setValue(E,"pendingUpdates"),await m.setValue({},"failingUpdates"),l){_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Dry run complete, exiting. ${Object.values(E).length} pending updates. Check file: ${h}`));return}_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Uploading ${Object.values(E).length} preferences to partition: ${a}`));let Me=new Date().getTime(),Q=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),Z=0,L=Object.entries(E),xe=_chunk2FX6UYVOcjs.b.call(void 0, L,o?100:10);Q.start(L.length,0),await _bluebird.map.call(void 0, xe,async $=>{try{await S.put("v1/preferences",{json:{records:$.map(([,C])=>C),skipWorkflowTriggers:o,forceTriggerWorkflows:n}}).json()}catch(C){try{let V=JSON.parse(_optionalChain([C, 'optionalAccess', _5 => _5.response, 'optionalAccess', _6 => _6.body])||"{}");V.error&&_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Error: ${V.error}`))}catch (e2){}_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to upload ${$.length} user preferences to partition ${a}: ${_optionalChain([C, 'optionalAccess', _7 => _7.response, 'optionalAccess', _8 => _8.body])||_optionalChain([C, 'optionalAccess', _9 => _9.message])}`));let A=m.getValue("failingUpdates");$.forEach(([V,O])=>{A[V]={uploadedAt:new Date().toISOString(),update:O,error:_optionalChain([C, 'optionalAccess', _10 => _10.response, 'optionalAccess', _11 => _11.body])||_optionalChain([C, 'optionalAccess', _12 => _12.message])||"Unknown error"}}),await m.setValue(A,"failingUpdates")}Z+=$.length,Q.update(Z)},{concurrency:40}),Q.stop();let Ve=new Date().getTime()-Me;_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully uploaded ${L.length} user preferences to partition ${a} in "${Ve/1e3}" seconds!`))}var _fs = require('fs');var _path = require('path');async function jr({auth:c,partition:i,sombraAuth:h,transcendUrl:d,file:a="",directory:u,dryRun:l,skipExistingRecordCheck:o,receiptFileDir:f,skipWorkflowTriggers:s,forceTriggerWorkflows:r,skipConflictUpdates:t,isSilent:n,attributes:g,concurrency:m}){u&&a&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red("Cannot provide both a directory and a file. Please provide only one.")),this.process.exit(1)),!a&&!u&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red("A file or directory must be provided. Please provide one using --file=./preferences.csv or --directory=./preferences")),this.process.exit(1)),_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);let w=[];if(u)try{let y=_fs.readdirSync.call(void 0, u).filter(b=>b.endsWith(".csv"));y.length===0&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`No CSV files found in directory: ${u}`)),this.process.exit(1)),w.push(...y.map(b=>_path.join.call(void 0, u,b)))}catch(P){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to read directory: ${u}`)),_chunkZUNVPK23cjs.a.error(_colors2.default.red(P.message)),this.process.exit(1)}else try{a.endsWith(".csv")||(_chunkZUNVPK23cjs.a.error(_colors2.default.red("File must be a CSV file")),this.process.exit(1)),w.push(a)}catch(P){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to access file: ${a}`)),_chunkZUNVPK23cjs.a.error(_colors2.default.red(P.message)),this.process.exit(1)}_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Processing ${w.length} consent preferences files for partition: ${i}`)),_chunkZUNVPK23cjs.a.debug(`Files to process: ${w.join(", ")}`),o&&_chunkZUNVPK23cjs.a.info(_colors2.default.bgYellow(`Skipping existing record check: ${o}`)),await _bluebird.map.call(void 0, w,async P=>{let y=_path.basename.call(void 0, P).replace(".csv","");await Ue({receiptFilepath:_path.join.call(void 0, f,`${y}-receipts.json`),auth:c,sombraAuth:h,file:P,partition:i,transcendUrl:d,skipConflictUpdates:t,skipWorkflowTriggers:s,skipExistingRecordCheck:o,isSilent:n,dryRun:l,attributes:_chunkFUYFDEYIcjs.nc.call(void 0, g),forceTriggerWorkflows:r})},{concurrency:m})}exports.uploadPreferences = jr;
|
|
12
|
+
//# sourceMappingURL=impl-2UX5JCKQ.cjs.map
|