@transcend-io/cli 8.32.4 → 8.32.6
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-P5GD5LAK.cjs → chunk-5UWKWV3X.cjs} +2 -2
- package/dist/{chunk-P5GD5LAK.cjs.map → chunk-5UWKWV3X.cjs.map} +1 -1
- package/dist/{chunk-IHUCIK5T.cjs → chunk-CDX243U3.cjs} +2 -2
- package/dist/{chunk-IHUCIK5T.cjs.map → chunk-CDX243U3.cjs.map} +1 -1
- package/dist/{chunk-DQCPGPXG.cjs → chunk-GJ6V5BHG.cjs} +2 -2
- package/dist/{chunk-DQCPGPXG.cjs.map → chunk-GJ6V5BHG.cjs.map} +1 -1
- package/dist/{chunk-VCPZG4FJ.cjs → chunk-I6GMLKI6.cjs} +2 -2
- package/dist/{chunk-VCPZG4FJ.cjs.map → chunk-I6GMLKI6.cjs.map} +1 -1
- package/dist/{chunk-VUQAH7YK.cjs → chunk-LE6FS55Q.cjs} +6 -6
- package/dist/{chunk-VUQAH7YK.cjs.map → chunk-LE6FS55Q.cjs.map} +1 -1
- package/dist/{chunk-PGO2YKRX.cjs → chunk-MLH6KKUK.cjs} +2 -2
- package/dist/{chunk-PGO2YKRX.cjs.map → chunk-MLH6KKUK.cjs.map} +1 -1
- package/dist/{chunk-D3VRD5F5.cjs → chunk-NZEATKWL.cjs} +2 -2
- package/dist/{chunk-D3VRD5F5.cjs.map → chunk-NZEATKWL.cjs.map} +1 -1
- package/dist/{chunk-6TKTYQIF.cjs → chunk-O7SJYOEK.cjs} +2 -2
- package/dist/{chunk-6TKTYQIF.cjs.map → chunk-O7SJYOEK.cjs.map} +1 -1
- package/dist/{chunk-22KX2NM4.cjs → chunk-PCK2N4IA.cjs} +4 -4
- package/dist/{chunk-22KX2NM4.cjs.map → chunk-PCK2N4IA.cjs.map} +1 -1
- package/dist/{chunk-LQUVB4MI.cjs → chunk-SFPZ6GEN.cjs} +4 -4
- package/dist/{chunk-LQUVB4MI.cjs.map → chunk-SFPZ6GEN.cjs.map} +1 -1
- package/dist/{chunk-CM7VJEOY.cjs → chunk-SZ7K447J.cjs} +2 -2
- package/dist/{chunk-CM7VJEOY.cjs.map → chunk-SZ7K447J.cjs.map} +1 -1
- package/dist/{chunk-56QKBG2R.cjs → chunk-VWN5MN3U.cjs} +4 -4
- package/dist/{chunk-56QKBG2R.cjs.map → chunk-VWN5MN3U.cjs.map} +1 -1
- package/dist/{chunk-BPOXNSPY.cjs → chunk-WJ3RFUZV.cjs} +2 -2
- package/dist/{chunk-BPOXNSPY.cjs.map → chunk-WJ3RFUZV.cjs.map} +1 -1
- package/dist/{chunk-DYBVUGHH.cjs → chunk-X2P2BWT7.cjs} +21 -21
- package/dist/{chunk-DYBVUGHH.cjs.map → chunk-X2P2BWT7.cjs.map} +1 -1
- package/dist/{impl-YIPC6MAR.cjs → impl-56QEHP2B.cjs} +3 -3
- package/dist/{impl-YIPC6MAR.cjs.map → impl-56QEHP2B.cjs.map} +1 -1
- package/dist/{impl-S64WVKSC.cjs → impl-575YOEHZ.cjs} +2 -2
- package/dist/{impl-S64WVKSC.cjs.map → impl-575YOEHZ.cjs.map} +1 -1
- package/dist/{impl-IQGUF37H.cjs → impl-5LMTXEQA.cjs} +2 -2
- package/dist/{impl-IQGUF37H.cjs.map → impl-5LMTXEQA.cjs.map} +1 -1
- package/dist/{impl-BLGX7DMN.cjs → impl-7DIFXY6N.cjs} +3 -3
- package/dist/{impl-BLGX7DMN.cjs.map → impl-7DIFXY6N.cjs.map} +1 -1
- package/dist/{impl-5RX3NB6C.cjs → impl-C6TDBSVQ.cjs} +2 -2
- package/dist/{impl-5RX3NB6C.cjs.map → impl-C6TDBSVQ.cjs.map} +1 -1
- package/dist/{impl-GA6T4SCB.cjs → impl-CL5OTH3R.cjs} +2 -2
- package/dist/{impl-GA6T4SCB.cjs.map → impl-CL5OTH3R.cjs.map} +1 -1
- package/dist/{impl-2JA6BPE7.cjs → impl-CV6MBTAL.cjs} +2 -2
- package/dist/{impl-2JA6BPE7.cjs.map → impl-CV6MBTAL.cjs.map} +1 -1
- package/dist/{impl-WVOFYJLG.cjs → impl-D7RH4J5E.cjs} +2 -2
- package/dist/{impl-WVOFYJLG.cjs.map → impl-D7RH4J5E.cjs.map} +1 -1
- package/dist/{impl-WTGAAEUZ.cjs → impl-DGZB5IDM.cjs} +2 -2
- package/dist/{impl-WTGAAEUZ.cjs.map → impl-DGZB5IDM.cjs.map} +1 -1
- package/dist/impl-DNVWNGPJ.cjs +2 -0
- package/dist/{impl-JI6COVDW.cjs.map → impl-DNVWNGPJ.cjs.map} +1 -1
- package/dist/{impl-LKX6OLE2.cjs → impl-DVIXGQJR.cjs} +2 -2
- package/dist/{impl-LKX6OLE2.cjs.map → impl-DVIXGQJR.cjs.map} +1 -1
- package/dist/{impl-GZNNNSYW.cjs → impl-EAI3VXKU.cjs} +4 -4
- package/dist/{impl-GZNNNSYW.cjs.map → impl-EAI3VXKU.cjs.map} +1 -1
- package/dist/{impl-4LAJNPQ4.cjs → impl-G422JWSA.cjs} +3 -3
- package/dist/{impl-4LAJNPQ4.cjs.map → impl-G422JWSA.cjs.map} +1 -1
- package/dist/{impl-J5PWNHKL.cjs → impl-G7YD5U53.cjs} +2 -2
- package/dist/{impl-J5PWNHKL.cjs.map → impl-G7YD5U53.cjs.map} +1 -1
- package/dist/{impl-MRC5UI22.cjs → impl-IC4KAL33.cjs} +2 -2
- package/dist/{impl-MRC5UI22.cjs.map → impl-IC4KAL33.cjs.map} +1 -1
- package/dist/{impl-IZIXOMMN.cjs → impl-JT7MI4YS.cjs} +2 -2
- package/dist/{impl-IZIXOMMN.cjs.map → impl-JT7MI4YS.cjs.map} +1 -1
- package/dist/{impl-ADPBEB3N.cjs → impl-LJBAH4YS.cjs} +2 -2
- package/dist/{impl-ADPBEB3N.cjs.map → impl-LJBAH4YS.cjs.map} +1 -1
- package/dist/{impl-ZTEP5CYM.cjs → impl-M2JWCIOX.cjs} +2 -2
- package/dist/{impl-ZTEP5CYM.cjs.map → impl-M2JWCIOX.cjs.map} +1 -1
- package/dist/{impl-BHA2L6BP.cjs → impl-MCIWWT2M.cjs} +2 -2
- package/dist/{impl-BHA2L6BP.cjs.map → impl-MCIWWT2M.cjs.map} +1 -1
- package/dist/{impl-RMPDHVAH.cjs → impl-MO2EAW2B.cjs} +2 -2
- package/dist/{impl-RMPDHVAH.cjs.map → impl-MO2EAW2B.cjs.map} +1 -1
- package/dist/{impl-IOS3QLTX.cjs → impl-PHHRQWTE.cjs} +2 -2
- package/dist/{impl-IOS3QLTX.cjs.map → impl-PHHRQWTE.cjs.map} +1 -1
- package/dist/{impl-NW57RBBR.cjs → impl-PHXT2QG7.cjs} +2 -2
- package/dist/{impl-NW57RBBR.cjs.map → impl-PHXT2QG7.cjs.map} +1 -1
- package/dist/{impl-UA7V6YEM.cjs → impl-QMDXFUAO.cjs} +2 -2
- package/dist/{impl-UA7V6YEM.cjs.map → impl-QMDXFUAO.cjs.map} +1 -1
- package/dist/{impl-R35FW4U7.cjs → impl-R5PX6MIE.cjs} +5 -5
- package/dist/{impl-R35FW4U7.cjs.map → impl-R5PX6MIE.cjs.map} +1 -1
- package/dist/{impl-4AI7T6RD.cjs → impl-RAZVKALS.cjs} +2 -2
- package/dist/{impl-4AI7T6RD.cjs.map → impl-RAZVKALS.cjs.map} +1 -1
- package/dist/{impl-JY7YM3QH.cjs → impl-RZSXBVAC.cjs} +2 -2
- package/dist/{impl-JY7YM3QH.cjs.map → impl-RZSXBVAC.cjs.map} +1 -1
- package/dist/{impl-66CDS7IN.cjs → impl-SA4YQJID.cjs} +2 -2
- package/dist/{impl-66CDS7IN.cjs.map → impl-SA4YQJID.cjs.map} +1 -1
- package/dist/{impl-SE32ARTN.cjs → impl-SUS5VKKB.cjs} +2 -2
- package/dist/{impl-SE32ARTN.cjs.map → impl-SUS5VKKB.cjs.map} +1 -1
- package/dist/{impl-QPLTL2SO.cjs → impl-T3KGRFUR.cjs} +2 -2
- package/dist/{impl-QPLTL2SO.cjs.map → impl-T3KGRFUR.cjs.map} +1 -1
- package/dist/{impl-4YFJOKCA.cjs → impl-T6FTWSLY.cjs} +2 -2
- package/dist/{impl-4YFJOKCA.cjs.map → impl-T6FTWSLY.cjs.map} +1 -1
- package/dist/{impl-Z54SB7SM.cjs → impl-TXBSRO6N.cjs} +2 -2
- package/dist/{impl-Z54SB7SM.cjs.map → impl-TXBSRO6N.cjs.map} +1 -1
- package/dist/{impl-SSBP4ONX.cjs → impl-UKTKLJSZ.cjs} +2 -2
- package/dist/{impl-SSBP4ONX.cjs.map → impl-UKTKLJSZ.cjs.map} +1 -1
- package/dist/{impl-XYHIS7X5.cjs → impl-UU5CW4E4.cjs} +2 -2
- package/dist/{impl-XYHIS7X5.cjs.map → impl-UU5CW4E4.cjs.map} +1 -1
- package/dist/{impl-B6DTQRYV.cjs → impl-UYKI3NKQ.cjs} +2 -2
- package/dist/{impl-B6DTQRYV.cjs.map → impl-UYKI3NKQ.cjs.map} +1 -1
- package/dist/{impl-GG3S2VBT.cjs → impl-VVICNSEP.cjs} +2 -2
- package/dist/{impl-GG3S2VBT.cjs.map → impl-VVICNSEP.cjs.map} +1 -1
- package/dist/impl-WY3A5X7O.cjs +2 -0
- package/dist/{impl-QOCEM2K5.cjs.map → impl-WY3A5X7O.cjs.map} +1 -1
- package/dist/{impl-EXHOBCQW.cjs → impl-XOHK7EPT.cjs} +2 -2
- package/dist/{impl-EXHOBCQW.cjs.map → impl-XOHK7EPT.cjs.map} +1 -1
- package/dist/{impl-DA7AASRR.cjs → impl-XT4Q54W2.cjs} +2 -2
- package/dist/{impl-DA7AASRR.cjs.map → impl-XT4Q54W2.cjs.map} +1 -1
- package/dist/{impl-FRWZLZ2V.cjs → impl-Y6ENZCUI.cjs} +2 -2
- package/dist/{impl-FRWZLZ2V.cjs.map → impl-Y6ENZCUI.cjs.map} +1 -1
- package/dist/{impl-XU54KM62.cjs → impl-YQXGFOOO.cjs} +2 -2
- package/dist/{impl-XU54KM62.cjs.map → impl-YQXGFOOO.cjs.map} +1 -1
- package/dist/{impl-X23VUODX.cjs → impl-ZUAB2R6X.cjs} +2 -2
- package/dist/{impl-X23VUODX.cjs.map → impl-ZUAB2R6X.cjs.map} +1 -1
- package/dist/{impl-Y3MY5EKD.cjs → impl-ZV7OZ5BN.cjs} +2 -2
- package/dist/{impl-Y3MY5EKD.cjs.map → impl-ZV7OZ5BN.cjs.map} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +1 -1
- package/package.json +1 -1
- package/dist/impl-JI6COVDW.cjs +0 -2
- package/dist/impl-QOCEM2K5.cjs +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/cli/cli/dist/chunk-PGO2YKRX.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"],"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,quBAAiD,wDAAgI,wDAAyC,wDAAgD,2DCAxO,gFAQf,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,MAAA,CAAO,MAAA,CAAOC,+BAAiB,CAC/C,CAAA,CASkB,CAEhB,IAAMC,CAAAA,CAASC,kCAAAA,CAA4BL,CAAcF,CAAI,CAAA,CAGvDQ,CAAAA,CAAmB,MAAMC,kCAAAA,CAA4B,CAAA,CAG3D,MAAMC,iCAAAA,CAAUN,CAAa,MAAOO,CAAAA,EAAe,CACjDC,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,OAAA,CACL,CAAA,uCAAA,EAA0CL,CAAgB,CAAA,YAAA,EAAeG,CAAU,CAAA,sBAAA,CACrF,CACF,CAAA,CACA,MAAMG,kCAAAA,CAA6BR,CAAQ,CACzC,EAAA,CAAIE,CAAAA,CACJ,UAAA,CAAAG,CACF,CAAC,CAAA,CACDC,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,KAAA,CACL,CAAA,wCAAA,EAA2CL,CAAgB,CAAA,YAAA,EAAeG,CAAU,CAAA,oBAAA,CACtF,CACF,CACF,CAAC,CAAA,CAGGV,CAAAA,EAEF,MAAMS,iCAAAA,CAAUN,CAAa,MAAOO,CAAAA,EAAe,CACjDC,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,OAAA,CACL,CAAA,0CAAA,EAA6CL,CAAgB,CAAA,YAAA,EAAeG,CAAU,CAAA,IAAA,CACxF,CACF,CAAA,CACA,MAAMI,kCAAAA,CAAqBT,CAAQ,CACjC,EAAA,C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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,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;AAUd,uBAAA","file":"/home/runner/work/cli/cli/dist/chunk-PGO2YKRX.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"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/cli/cli/dist/chunk-MLH6KKUK.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"],"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","consentSessionsByRegime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A,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,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;AAUd,uBAAA","file":"/home/runner/work/cli/cli/dist/chunk-MLH6KKUK.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"]}
|
|
@@ -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 _chunkVWN5MN3Ucjs = require('./chunk-VWN5MN3U.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkGJ6V5BHGcjs = require('./chunk-GJ6V5BHG.cjs');var _crypto = require('crypto'); var $ = _interopRequireWildcard(_crypto);var _jsonwebtoken = require('jsonwebtoken'); var A = _interopRequireWildcard(_jsonwebtoken);function B(c,p,t){let n=Buffer.from(t,"base64"),u=Buffer.from(p,"base64"),f="id-aes256-wrap-pad",l=Buffer.from("A65959A6","hex"),o=$.createCipheriv(f,u,l),s={encryptedIdentifier:Buffer.concat([o.update(c),o.final()]).toString("base64")};return A.sign(s,n,{algorithm:"HS384"})}var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _iots = require('io-ts'); var r = _interopRequireWildcard(_iots);var _cliprogress = require('cli-progress'); var _cliprogress2 = _interopRequireDefault(_cliprogress);var _typeutils = require('@transcend-io/type-utils');var I=/^[0-9][Y|N]([Y|N])[Y|N]$/,R= exports.c =r.record(r.string,r.union([r.boolean,r.literal("Auto")]));async function q({base64EncryptionKey:c,base64SigningKey:p,preferences:t,partition:n,concurrency:u=100,transcendUrl:f=_chunkGJ6V5BHGcjs.s}){let l=_chunkVWN5MN3Ucjs.Bc.call(void 0, f),o=t.filter(e=>e.usp&&!I.test(e.usp));if(o.length>0)throw new Error(`Received invalid usp strings: ${JSON.stringify(o,null,2)}`);let d=t.map((e,g)=>[e,g]).filter(([e])=>{if(!e.purposes)return!1;try{return _typeutils.decodeCodec.call(void 0, R,e.purposes),!1}catch (e2){return!0}});if(d.length>0)throw new Error(`Received invalid purpose maps: ${JSON.stringify(d,null,2)}`);let s=t.filter(e=>!e.usp&&!e.purposes);if(s.length>0)throw new Error(`Received invalid inputs, expected either purposes or usp to be defined: ${JSON.stringify(s,null,2)}`);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Uploading ${t.length} user preferences to partition ${n}`));let S=new Date().getTime(),m=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),v=0;m.start(t.length,0),await _chunkVWN5MN3Ucjs.a.call(void 0, t,async({userId:e,confirmed:g="true",updated:C,prompted:P,purposes:N,...i})=>{let _=B(e,c,p),[,j]=i.usp?I.exec(i.usp)||[]:[],k={token:_,partition:n,consent:{confirmed:g==="true",purposes:N?_typeutils.decodeCodec.call(void 0, R,N):i.usp?{SaleOfInfo:j==="Y"}:{},...C?{updated:C==="true"}:{},...P?{prompted:P==="true"}:{},...i}};try{await l.post("sync",{json:k}).json()}catch(y){try{let h=JSON.parse(_optionalChain([y, 'optionalAccess', _2 => _2.response, 'optionalAccess', _3 => _3.body])||"{}");h.error&&_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Error: ${h.error}`))}catch (e3){}throw new Error(`Received an error from server: ${_optionalChain([y, 'optionalAccess', _4 => _4.response, 'optionalAccess', _5 => _5.body])||_optionalChain([y, 'optionalAccess', _6 => _6.message])}`)}v+=1,m.update(v)},{concurrency:u}),m.stop();let O=new Date().getTime()-S;_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully uploaded ${t.length} user preferences to partition ${n} in "${O/1e3}" seconds!`))}exports.a = B; exports.b = I; exports.c = R; exports.d = q;
|
|
2
|
+
//# sourceMappingURL=chunk-NZEATKWL.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-NZEATKWL.cjs","../src/lib/consent-manager/createConsentToken.ts","../src/lib/consent-manager/uploadConsents.ts"],"names":["createConsentToken","userId","base64EncryptionKey","base64SigningKey","signingKey","encryptionKey","encryptionAlgorithm","iv","cipher","jwtPayload","USP_STRING_REGEX","PurposeMap","uploadConsents","preferences","partition","concurrency","transcendUrl","DEFAULT_TRANSCEND_CONSENT_API","transcendConsentApi","createTranscendConsentGotInstance","invalidUspStrings","pref"],"mappings":"AAAA,u/BAAgD,wDAAoC,wDAAyC,0ECArG,4FACH,SAWLA,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACQ,CAER,IAAMC,CAAAA,CAAa,MAAA,CAAO,IAAA,CAAKD,CAAAA,CAAkB,QAAQ,CAAA,CACnDE,CAAAA,CAAgB,MAAA,CAAO,IAAA,CAAKH,CAAAA,CAAqB,QAAQ,CAAA,CAGzDI,CAAAA,CAAsB,oBAAA,CAEtBC,CAAAA,CAAK,MAAA,CAAO,IAAA,CAAK,UAAA,CAAY,KAAK,CAAA,CAElCC,CAAAA,CAAgB,CAAA,CAAA,cAAA,CAAeF,CAAAA,CAAqBD,CAAAA,CAAeE,CAAE,CAAA,CAYrEE,CAAAA,CAAa,CACjB,mBAAA,CAV0B,MAAA,CAAO,MAAA,CAAO,CACxCD,CAAAA,CAAO,MAAA,CAAOP,CAAM,CAAA,CACpBO,CAAAA,CAAO,KAAA,CAAM,CACf,CAAC,CAAA,CAAE,QAAA,CAAS,QAAQ,CAQpB,CAAA,CAOA,OAJyB,CAAA,CAAA,IAAA,CAAKC,CAAAA,CAAYL,CAAAA,CAAY,CACpD,SAAA,CAAW,OACb,CAAC,CAGH,CC/CA,gFAAmB,qEACA,qGAKK,qDACI,IAIfM,CAAAA,CAAmB,0BAAA,CAEnBC,CAAAA,aAAe,CAAA,CAAA,MAAA,CACxB,CAAA,CAAA,MAAA,CACA,CAAA,CAAA,KAAA,CAAM,CAAG,CAAA,CAAA,OAAA,CAAW,CAAA,CAAA,OAAA,CAAQ,MAAM,CAAC,CAAC,CACxC,CAAA,CAOA,MAAA,SAAsBC,CAAAA,CAAe,CACnC,mBAAA,CAAAV,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,WAAA,CAAAU,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CAAc,GAAA,CACd,YAAA,CAAAC,CAAAA,CAAeC,mBACjB,CAAA,CAakB,CAEhB,IAAMC,CAAAA,CAAsBC,kCAAAA,CAA8C,CAAA,CAGpEC,CAAAA,CAAoBP,CAAAA,CAAY,MAAA,CACnCQ,CAAAA,EAASA,CAAAA,CAAK,GAAA,EAAO,CAACX,CAAAA,CAAiB,IAAA,CAAKW,CAAAA,CAAK,GAAG,CACvD,CAAA,CACA,EAAA,CAAID,CAAAA,CAAkB,MAAA,CAAS,CAAA,CAC7B,MAAM,IAAI,KAAA,CACR,CAAA,8BAAA,EAAiC,IAAA,CAAK,SAAA,CACpCA,CAAAA,CACA,IAAA,CACA,CACF,CAAC,CAAA,CAAA","file":"/home/runner/work/cli/cli/dist/chunk-NZEATKWL.cjs","sourcesContent":[null,"import * as crypto from 'crypto';\nimport * as jwt from 'jsonwebtoken';\n\n/**\n * Function to create a consent manager token\n *\n * @see https://docs.transcend.io/docs/consent/reference/managed-consent-database\n * @param userId - User ID\n * @param base64EncryptionKey - Encryption key\n * @param base64SigningKey - Signing key\n * @returns Token\n */\nexport function createConsentToken(\n userId: string,\n base64EncryptionKey: string,\n base64SigningKey: string,\n): string {\n // Read on for where to find these keys\n const signingKey = Buffer.from(base64SigningKey, 'base64');\n const encryptionKey = Buffer.from(base64EncryptionKey, 'base64');\n\n // NIST's AES-KWP implementation { aes 48 } - see https://tools.ietf.org/html/rfc5649\n const encryptionAlgorithm = 'id-aes256-wrap-pad';\n // Initial Value for AES-KWP integrity check - see https://tools.ietf.org/html/rfc5649#section-3\n const iv = Buffer.from('A65959A6', 'hex');\n // Set up encryption algorithm\n const cipher = crypto.createCipheriv(encryptionAlgorithm, encryptionKey, iv);\n\n // Encrypt the userId and base64-encode the result\n const encryptedIdentifier = Buffer.concat([\n cipher.update(userId),\n cipher.final(),\n ]).toString('base64');\n\n // Create the JWT content - jwt.sign will add a 'iat' (issued at) field to the payload\n // If you wanted to add something manually, consider\n // const issued: Date = new Date();\n // const isoDate = issued.toISOString();\n const jwtPayload = {\n encryptedIdentifier,\n };\n\n // Create a JSON web token and HMAC it with SHA-384\n const consentToken = jwt.sign(jwtPayload, signingKey, {\n algorithm: 'HS384',\n });\n\n return consentToken;\n}\n","import { createTranscendConsentGotInstance } from '../graphql';\nimport colors from 'colors';\nimport * as t from 'io-ts';\nimport { DEFAULT_TRANSCEND_CONSENT_API } from '../../constants';\nimport { map } from '../bluebird';\nimport { createConsentToken } from './createConsentToken';\nimport { logger } from '../../logger';\nimport cliProgress from 'cli-progress';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport type { ConsentPreferenceUpload } from './types';\nimport { ConsentPreferencesBody } from '@transcend-io/airgap.js-types';\n\nexport const USP_STRING_REGEX = /^[0-9][Y|N]([Y|N])[Y|N]$/;\n\nexport const PurposeMap = t.record(\n t.string,\n t.union([t.boolean, t.literal('Auto')]),\n);\n\n/**\n * Upload a set of consent preferences\n *\n * @param options - Options\n */\nexport async function uploadConsents({\n base64EncryptionKey,\n base64SigningKey,\n preferences,\n partition,\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_CONSENT_API,\n}: {\n /** base64 encryption key */\n base64EncryptionKey: string;\n /** base64 signing key */\n base64SigningKey: string;\n /** Partition key */\n partition: string;\n /** Sombra API key authentication */\n preferences: ConsentPreferenceUpload[];\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** Concurrency limit for approving */\n concurrency?: number;\n}): Promise<void> {\n // Create connection to API\n const transcendConsentApi = createTranscendConsentGotInstance(transcendUrl);\n\n // Ensure usp strings are valid\n const invalidUspStrings = preferences.filter(\n (pref) => pref.usp && !USP_STRING_REGEX.test(pref.usp),\n );\n if (invalidUspStrings.length > 0) {\n throw new Error(\n `Received invalid usp strings: ${JSON.stringify(\n invalidUspStrings,\n null,\n 2,\n )}`,\n );\n }\n\n // Ensure purpose maps are valid\n const invalidPurposeMaps = preferences\n .map((pref, ind) => [pref, ind] as [ConsentPreferenceUpload, number])\n .filter(([pref]) => {\n if (!pref.purposes) {\n return false;\n }\n try {\n decodeCodec(PurposeMap, pref.purposes);\n return false;\n } catch {\n return true;\n }\n });\n if (invalidPurposeMaps.length > 0) {\n throw new Error(\n `Received invalid purpose maps: ${JSON.stringify(\n invalidPurposeMaps,\n null,\n 2,\n )}`,\n );\n }\n\n // Ensure usp or preferences are provided\n const invalidInputs = preferences.filter(\n (pref) => !pref.usp && !pref.purposes,\n );\n if (invalidInputs.length > 0) {\n throw new Error(\n `Received invalid inputs, expected either purposes or usp to be defined: ${JSON.stringify(\n invalidInputs,\n null,\n 2,\n )}`,\n );\n }\n\n logger.info(\n colors.magenta(\n `Uploading ${preferences.length} user preferences to partition ${partition}`,\n ),\n );\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n // Build a GraphQL client\n let total = 0;\n progressBar.start(preferences.length, 0);\n await map(\n preferences,\n async ({\n userId,\n confirmed = 'true',\n updated,\n prompted,\n purposes,\n ...consent\n }) => {\n const token = createConsentToken(\n userId,\n base64EncryptionKey,\n base64SigningKey,\n );\n\n // parse usp string\n const [, saleStatus] = consent.usp\n ? USP_STRING_REGEX.exec(consent.usp) || []\n : [];\n\n const input = {\n token,\n partition,\n consent: {\n confirmed: confirmed === 'true',\n purposes: purposes\n ? decodeCodec(PurposeMap, purposes)\n : consent.usp\n ? { SaleOfInfo: saleStatus === 'Y' }\n : {},\n ...(updated ? { updated: updated === 'true' } : {}),\n ...(prompted ? { prompted: prompted === 'true' } : {}),\n ...consent,\n },\n } as ConsentPreferencesBody;\n\n // Make the request\n try {\n await transcendConsentApi\n .post('sync', {\n json: input,\n })\n .json();\n } catch (err) {\n try {\n const parsed = JSON.parse(err?.response?.body || '{}');\n if (parsed.error) {\n logger.error(colors.red(`Error: ${parsed.error}`));\n }\n } catch (e) {\n // continue\n }\n throw new Error(\n `Received an error from server: ${\n err?.response?.body || err?.message\n }`,\n );\n }\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully uploaded ${\n preferences.length\n } user preferences to partition ${partition} in \"${\n totalTime / 1000\n }\" seconds!`,\n ),\n );\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
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 }; }var
|
|
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 }; }var _chunkVWN5MN3Ucjs = require('./chunk-VWN5MN3U.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkGJ6V5BHGcjs = require('./chunk-GJ6V5BHG.cjs');var _privacytypes = require('@transcend-io/privacy-types');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);async function re({file:u,auth:s,sombraAuth:g,requestActions:f=[],concurrency:p=100,transcendUrl:n=_chunkGJ6V5BHGcjs.r}){let o=_chunkVWN5MN3Ucjs.zc.call(void 0, n,s),e=await _chunkVWN5MN3Ucjs.Ac.call(void 0, n,s,g);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Pulling manual enrichment requests, filtered for actions: ${f.join(",")}`));let d=await _chunkVWN5MN3Ucjs.qd.call(void 0, o,{actions:f,statuses:[_privacytypes.RequestStatus.Enriching]}),i=[];await _chunkVWN5MN3Ucjs.a.call(void 0, d,async t=>{let c=await _chunkVWN5MN3Ucjs.kd.call(void 0, o,{requestId:t.id});if(c.filter(({status:m})=>m==="ACTION_REQUIRED")){let m=await _chunkVWN5MN3Ucjs.nd.call(void 0, o,e,{requestId:t.id});i.push({...t,requestIdentifiers:m,requestEnrichers:c})}},{concurrency:p});let l=i.map(({attributeValues:t,requestIdentifiers:c,requestEnrichers:I,...m})=>({...m,...Object.entries(_chunkGJ6V5BHGcjs.d.call(void 0, c,"name")).reduce((P,[$,C])=>Object.assign(P,{[$]:C.map(({value:A})=>A).join(",")}),{}),...Object.entries(_chunkGJ6V5BHGcjs.d.call(void 0, t,"attributeKey.name")).reduce((P,[$,C])=>Object.assign(P,{[$]:C.map(({name:A})=>A).join(",")}),{})})),a=_chunkGJ6V5BHGcjs.j.call(void 0, l.map(t=>Object.keys(t)).flat());return await _chunkVWN5MN3Ucjs.tg.call(void 0, u,l,a),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully wrote ${i.length} requests to file "${u}"`)),i}var _iots = require('io-ts'); var R = _interopRequireWildcard(_iots);var j="https://app.transcend.io/privacy-requests/incoming-requests/",M= exports.b =R.record(R.string,R.string);async function N(u,{id:s,...g},f,p){if(!s){let e=`Request ID must be provided to enricher request.${p?` Found error in row: ${p}`:""}`;throw _chunkZUNVPK23cjs.a.error(_colors2.default.red(e)),new Error(e)}let n=s.toLowerCase(),o=Object.entries(g).reduce((e,[d,i])=>_chunkGJ6V5BHGcjs.j.call(void 0, _chunkVWN5MN3Ucjs.rc.call(void 0, i)).length===0?e:Object.assign(e,{[d]:_chunkGJ6V5BHGcjs.j.call(void 0, _chunkVWN5MN3Ucjs.rc.call(void 0, i)).map(a=>({value:d==="email"?a.toLowerCase():a}))}),{});try{return await u.post("v1/enrich-identifiers",{headers:{"x-transcend-request-id":n,"x-transcend-enricher-id":f},json:{enrichedIdentifiers:o}}).json(),_chunkZUNVPK23cjs.a.error(_colors2.default.green(`Successfully enriched request: ${j}${n}`)),!0}catch(e){if(typeof e.response.body=="string"&&e.response.body.includes("Cannot update a resolved RequestEnricher"))return _chunkZUNVPK23cjs.a.warn(_colors2.default.magenta(`Skipped enrichment for request: ${j}${n}, request is no longer in the enriching phase.`)),!1;throw _chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to enricher identifiers for request with id: ${j}${n} - ${e.message} - ${e.response.body}`)),e}}async function he({file:u,auth:s,sombraAuth:g,enricherId:f,markSilent:p,concurrency:n=100,transcendUrl:o=_chunkGJ6V5BHGcjs.r}){let e=await _chunkVWN5MN3Ucjs.Ac.call(void 0, o,s,g),d=_chunkVWN5MN3Ucjs.zc.call(void 0, o,s);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Reading "${u}" from disk`));let i=_chunkVWN5MN3Ucjs.uc.call(void 0, u,M);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Enriching "${i.length}" privacy requests.`));let l=0,a=0,t=0;if(await _chunkVWN5MN3Ucjs.a.call(void 0, i,async(c,I)=>{try{p&&(await _chunkVWN5MN3Ucjs.wg.call(void 0, d,_chunkVWN5MN3Ucjs.$,{input:{id:c.id,isSilent:!0}}),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Mark request as silent mode - ${c.id}`))),await N(e,c,f,I)?l+=1:a+=1}catch (e2){t+=1}},{concurrency:n}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully notified Transcend!
|
|
2
2
|
Success count: ${l}.`)),a>0&&_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Skipped count: ${a}.`)),t>0)throw _chunkZUNVPK23cjs.a.info(_colors2.default.red(`Error Count: ${t}.`)),new Error(`Failed to enrich: ${t} requests.`);return i.length}exports.a = re; exports.b = M; exports.c = N; exports.d = he;
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-O7SJYOEK.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-O7SJYOEK.cjs","../src/lib/manual-enrichment/pullManualEnrichmentIdentifiersToCsv.ts","../src/lib/manual-enrichment/pushManualEnrichmentIdentifiersFromCsv.ts"],"names":["pullManualEnrichmentIdentifiersToCsv","file","auth","sombraAuth","requestActions","concurrency","transcendUrl","DEFAULT_TRANSCEND_API","client","buildTranscendGraphQLClient","sombra","createSombraGotInstance","logger","colors"],"mappings":"AAAA,mfAAuH,wDAAyC,wDAAuD,2DCA1K,gFAE1B,MA6BnB,SAAsBA,EAAAA,CAAqC,CACzD,IAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CAAiB,CAAC,CAAA,CAClB,WAAA,CAAAC,CAAAA,CAAc,GAAA,CACd,YAAA,CAAAC,CAAAA,CAAeC,mBACjB,CAAA,CAa6C,CAE3C,IAAMC,CAAAA,CAASC,kCAAAA,CAA4BH,CAAcJ,CAAI,CAAA,CACvDQ,CAAAA,CAAS,MAAMC,kCAAAA,CAAwBL,CAAcJ,CAAAA,CAAMC,CAAU,CAAA,CAE3ES,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,OAAA,CACL,CAAA,0DAAA,EAA6DT,CAAAA,CAAe,IAAA,CAC1E,GACF,CAAC,CAAA,CAAA;ACuDP,gBAAA","file":"/home/runner/work/cli/cli/dist/chunk-O7SJYOEK.cjs","sourcesContent":[null,"import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { map } from '../bluebird';\nimport colors from 'colors';\nimport { groupBy, uniq } from 'lodash-es';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\nimport { writeCsv } from '../helpers/writeCsv';\nimport {\n PrivacyRequest,\n RequestEnricher,\n RequestIdentifier,\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n fetchAllRequestEnrichers,\n fetchAllRequestIdentifiers,\n fetchAllRequests,\n} from '../graphql';\nimport { logger } from '../../logger';\n\nexport interface PrivacyRequestWithIdentifiers extends PrivacyRequest {\n /** Request Enrichers */\n requestEnrichers: RequestEnricher[];\n /** Request Identifiers */\n requestIdentifiers: RequestIdentifier[];\n}\n\n/**\n * Pull the set of manual enrichment jobs to CSV\n *\n * @param options - Options\n * @returns List of requests with identifiers\n */\nexport async function pullManualEnrichmentIdentifiersToCsv({\n file,\n auth,\n sombraAuth,\n requestActions = [],\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** Sombra API key */\n sombraAuth?: string;\n /** Concurrency */\n concurrency?: number;\n /** The request actions to fetch */\n requestActions?: RequestAction[];\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<PrivacyRequestWithIdentifiers[]> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const sombra = await createSombraGotInstance(transcendUrl, auth, sombraAuth);\n\n logger.info(\n colors.magenta(\n `Pulling manual enrichment requests, filtered for actions: ${requestActions.join(\n ',',\n )}`,\n ),\n );\n\n // Pull all privacy requests\n const allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n statuses: [RequestStatus.Enriching],\n });\n\n // Requests to save\n const savedRequests: PrivacyRequestWithIdentifiers[] = [];\n\n // Filter down requests to what is needed\n await map(\n allRequests,\n async (request) => {\n // Fetch enrichers\n const requestEnrichers = await fetchAllRequestEnrichers(client, {\n requestId: request.id,\n });\n\n // Check if manual enrichment exists for that request\n const hasManualEnrichment = requestEnrichers.filter(\n ({ status }) => status === 'ACTION_REQUIRED',\n );\n\n // Save request to queue\n if (hasManualEnrichment) {\n const requestIdentifiers = await fetchAllRequestIdentifiers(\n client,\n sombra,\n {\n requestId: request.id,\n },\n );\n savedRequests.push({\n ...request,\n requestIdentifiers,\n requestEnrichers,\n });\n }\n },\n {\n concurrency,\n },\n );\n\n const data = savedRequests.map(\n ({\n attributeValues,\n requestIdentifiers,\n requestEnrichers, // eslint-disable-line @typescript-eslint/no-unused-vars\n ...request\n }) => ({\n ...request,\n // flatten identifiers\n ...Object.entries(groupBy(requestIdentifiers, 'name')).reduce(\n (acc, [key, values]) =>\n Object.assign(acc, {\n [key]: values.map(({ value }) => value).join(','),\n }),\n {},\n ),\n // flatten attributes\n ...Object.entries(groupBy(attributeValues, 'attributeKey.name')).reduce(\n (acc, [key, values]) =>\n Object.assign(acc, {\n [key]: values.map(({ name }) => name).join(','),\n }),\n {},\n ),\n }),\n );\n\n // Write out to CSV\n const headers = uniq(data.map((d) => Object.keys(d)).flat());\n await writeCsv(file, data, headers);\n\n logger.info(\n colors.green(\n `Successfully wrote ${savedRequests.length} requests to file \"${file}\"`,\n ),\n );\n\n return savedRequests;\n}\n","import colors from 'colors';\nimport { map } from '../bluebird';\nimport { logger } from '../../logger';\nimport {\n UPDATE_PRIVACY_REQUEST,\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n makeGraphQLRequest,\n} from '../graphql';\nimport {\n enrichPrivacyRequest,\n EnrichPrivacyRequest,\n} from './enrichPrivacyRequest';\nimport { readCsv } from '../requests';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\n\n/**\n * Push a CSV of enriched requests back into Transcend\n *\n * @param options - Options\n * @returns Number of items processed\n */\nexport async function pushManualEnrichmentIdentifiersFromCsv({\n file,\n auth,\n sombraAuth,\n enricherId,\n markSilent,\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** ID of enricher being uploaded to */\n enricherId: string;\n /** Sombra API key authentication */\n sombraAuth?: string;\n /** Concurrency */\n concurrency?: number;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** Mark requests in silent mode before enriching */\n markSilent?: boolean;\n}): Promise<number> {\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, sombraAuth);\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read from CSV\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const activeResults = readCsv(file, EnrichPrivacyRequest);\n\n // Notify Transcend\n logger.info(\n colors.magenta(`Enriching \"${activeResults.length}\" privacy requests.`),\n );\n\n let successCount = 0;\n let skippedCount = 0;\n let errorCount = 0;\n\n await map(\n activeResults,\n async (request, index) => {\n try {\n // Mark requests in silent mode before a certain date\n if (markSilent) {\n await makeGraphQLRequest(client, UPDATE_PRIVACY_REQUEST, {\n input: {\n id: request.id,\n isSilent: true,\n },\n });\n\n logger.info(\n colors.magenta(`Mark request as silent mode - ${request.id}`),\n );\n }\n\n const result = await enrichPrivacyRequest(\n sombra,\n request,\n enricherId,\n index,\n );\n if (result) {\n successCount += 1;\n } else {\n skippedCount += 1;\n }\n } catch (err) {\n errorCount += 1;\n }\n },\n { concurrency },\n );\n\n logger.info(\n colors.green(\n `Successfully notified Transcend! \\n Success count: ${successCount}.`,\n ),\n );\n\n if (skippedCount > 0) {\n logger.info(colors.magenta(`Skipped count: ${skippedCount}.`));\n }\n\n if (errorCount > 0) {\n logger.info(colors.red(`Error Count: ${errorCount}.`));\n throw new Error(`Failed to enrich: ${errorCount} requests.`);\n }\n\n return activeResults.length;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
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 _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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
|
|
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 _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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 _chunkVWN5MN3Ucjs = require('./chunk-VWN5MN3U.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkGJ6V5BHGcjs = require('./chunk-GJ6V5BHG.cjs');var _os = require('os');function Kt(e,t){let o=Math.max(1,_nullishCoalesce(_optionalChain([_os.availableParallelism, 'optionalCall', _2 => _2()]), () => (1)));return{poolSize:typeof e=="number"&&e>0?Math.min(e,t):Math.min(o,t),cpuCount:o}}var _child_process = require('child_process');var _path = require('path');var _fs = require('fs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);function rt(e){return`'${String(e).replace(/'/g,"'\\''")}'`}function ot(e,t,o=!1){if(o)return;let r=_os.platform.call(void 0, );try{if(r==="darwin"){let l=e.map(rt).join(" -f "),s=`
|
|
2
2
|
tell application "Terminal"
|
|
3
3
|
activate
|
|
4
4
|
do script "printf '\\e]0;${t}\\a'; tail -n +1 -f ${l}"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
`):L.write(`${k}
|
|
12
12
|
`)}catch (e6){}});i.stderr.on("data",x)}return i[at]={structuredPath:a,outPath:f,errPath:m,infoPath:c,warnPath:d,errorPath:g},n&&ot([a,f,m,c,d,g],`worker-${t}`,l),p.on("error",()=>{}),h.on("error",()=>{}),T.on("error",()=>{}),L.on("error",()=>{}),$.on("error",()=>{}),i}var _readline = require('readline'); var q = _interopRequireWildcard(_readline); var gt = _interopRequireWildcard(_readline);var ut="",Ft=(e,t)=>{let o=Math.min(e-1,9),r=e<=1?"0":`0-${o}`,n=e>10?" (Tab/Shift+Tab for \u226510)":"";return t?_colors2.default.dim("Run complete \u2014 digits to view logs \u2022 Tab/Shift+Tab cycle \u2022 Esc/Ctrl+] detach \u2022 q to quit"):_colors2.default.dim(`Hotkeys: [${r}] attach${n} \u2022 e=errors \u2022 w=warnings \u2022 i=info \u2022 l=logs \u2022 Tab/Shift+Tab \u2022 Esc/Ctrl+] detach \u2022 Ctrl+C exit`)};function ue(e,t,o=!1){let r=[...t.renderHeader(e),"",...t.renderWorkers(e),...o?[]:["",Ft(e.poolSize,e.final)],...t.renderExtras?[""].concat(t.renderExtras(e)):[]].join(`
|
|
13
13
|
`);!e.final&&r===ut||(ut=r,e.final?process.stdout.write("\x1B[?25h"):(process.stdout.write("\x1B[?25l"),q.cursorTo(process.stdout,0,0),q.clearScreenDown(process.stdout)),process.stdout.write(`${r}
|
|
14
|
-
`))}function J(e,t,o){let r=t.get(e);if(O(r))try{let n=K(r);if(n!=null)return n}catch (e7){}return o.get(e)}async function dt(e,t,o){await new Promise(r=>{try{let n=_fs.statSync.call(void 0, e),l=Math.max(0,n.size-t),s=_fs.createReadStream.call(void 0, e,{start:l,encoding:"utf8"});s.on("data",a=>o(a)),s.on("end",r),s.on("error",r)}catch (e8){r(void 0)}})}function pt(e,t,o){if(t.ctrl&&t.name==="c")return{type:"CTRL_C"};if(o==="dashboard")return t.name&&/^[0-9]$/.test(t.name)?{type:"ATTACH",id:Number(t.name)}:t.name==="tab"&&!t.shift?{type:"CYCLE",delta:1}:t.name==="tab"&&t.shift?{type:"CYCLE",delta:-1}:t.name==="q"?{type:"QUIT"}:null;if(t.name==="escape"||t.ctrl&&t.name==="]")return{type:"DETACH"};if(t.ctrl&&t.name==="d")return{type:"CTRL_D"};let r=_nullishCoalesce(_nullishCoalesce(t.sequence, () => (e)), () => (""));return r?{type:"FORWARD",sequence:r}:null}function ft(e){return[...e.keys()].sort((t,o)=>t-o)}function mt(e,t,o){if(!e.length)return null;let r=_nullishCoalesce(t, () => (e[0])),n=e.indexOf(r);return n===-1&&(n=0),n=(n+o+e.length)%e.length,e[n]}function ht(e){let{workers:t,onAttach:o,onDetach:r,onCtrlC:n,getLogPaths:l,replayBytes:s=200*1024,replayWhich:a=["out","err"],onEnterAttachScreen:f,ports:m}=e,c=_nullishCoalesce(_optionalChain([m, 'optionalAccess', _17 => _17.stdin]), () => (process.stdin)),d=_nullishCoalesce(_optionalChain([m, 'optionalAccess', _18 => _18.stdout]), () => (process.stdout)),g=_nullishCoalesce(_optionalChain([m, 'optionalAccess', _19 => _19.stderr]), () => (process.stderr)),i=(...b)=>{if(
|
|
14
|
+
`))}function J(e,t,o){let r=t.get(e);if(O(r))try{let n=K(r);if(n!=null)return n}catch (e7){}return o.get(e)}async function dt(e,t,o){await new Promise(r=>{try{let n=_fs.statSync.call(void 0, e),l=Math.max(0,n.size-t),s=_fs.createReadStream.call(void 0, e,{start:l,encoding:"utf8"});s.on("data",a=>o(a)),s.on("end",r),s.on("error",r)}catch (e8){r(void 0)}})}function pt(e,t,o){if(t.ctrl&&t.name==="c")return{type:"CTRL_C"};if(o==="dashboard")return t.name&&/^[0-9]$/.test(t.name)?{type:"ATTACH",id:Number(t.name)}:t.name==="tab"&&!t.shift?{type:"CYCLE",delta:1}:t.name==="tab"&&t.shift?{type:"CYCLE",delta:-1}:t.name==="q"?{type:"QUIT"}:null;if(t.name==="escape"||t.ctrl&&t.name==="]")return{type:"DETACH"};if(t.ctrl&&t.name==="d")return{type:"CTRL_D"};let r=_nullishCoalesce(_nullishCoalesce(t.sequence, () => (e)), () => (""));return r?{type:"FORWARD",sequence:r}:null}function ft(e){return[...e.keys()].sort((t,o)=>t-o)}function mt(e,t,o){if(!e.length)return null;let r=_nullishCoalesce(t, () => (e[0])),n=e.indexOf(r);return n===-1&&(n=0),n=(n+o+e.length)%e.length,e[n]}function ht(e){let{workers:t,onAttach:o,onDetach:r,onCtrlC:n,getLogPaths:l,replayBytes:s=200*1024,replayWhich:a=["out","err"],onEnterAttachScreen:f,ports:m}=e,c=_nullishCoalesce(_optionalChain([m, 'optionalAccess', _17 => _17.stdin]), () => (process.stdin)),d=_nullishCoalesce(_optionalChain([m, 'optionalAccess', _18 => _18.stdout]), () => (process.stdout)),g=_nullishCoalesce(_optionalChain([m, 'optionalAccess', _19 => _19.stderr]), () => (process.stderr)),i=(...b)=>{if(_chunkGJ6V5BHGcjs.z)try{(_nullishCoalesce(_optionalChain([m, 'optionalAccess', _20 => _20.stderr]), () => (process.stderr))).write(`[keys] ${b.map(String).join(" ")}
|
|
15
15
|
`)}catch (e9){}};if(!c.isTTY)return()=>{};gt.emitKeypressEvents(c),_optionalChain([c, 'access', _21 => _21.setRawMode, 'optionalCall', _22 => _22(!0)]);let p="dashboard",h=null,T=null,L=null;async function $(b){if(!l)return;let y=l(b);if(!y)return;let S=[];for(let w of a)w==="out"&&S.push(y.outPath),w==="err"&&S.push(y.errPath),w==="structured"&&S.push(y.structuredPath);if(S.length){d.write(`
|
|
16
16
|
------------ replay ------------
|
|
17
17
|
`);for(let w of S)d.write(`
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
`),await dt(w,s,R=>d.write(R));d.write(`
|
|
20
20
|
--------------------------------
|
|
21
21
|
|
|
22
|
-
`)}}let E=async b=>{i("attach()",`id=${b}`);let y=t.get(b);if(!y)return;p==="attached"&&x(),p="attached",h=b,_optionalChain([f, 'optionalCall', _23 => _23(b)]),_optionalChain([o, 'optionalCall', _24 => _24(b)]),await $(b),T=w=>d.write(w),L=w=>g.write(w),_optionalChain([y, 'access', _25 => _25.stdout, 'optionalAccess', _26 => _26.on, 'call', _27 => _27("data",T)]),_optionalChain([y, 'access', _28 => _28.stderr, 'optionalAccess', _29 => _29.on, 'call', _30 => _30("data",L)]);let S=()=>{h===b&&x()};y.once("exit",S)},x=()=>{if(i("detach()",`id=${h}`),h==null)return;let b=h,y=t.get(b);y&&(T&&_optionalChain([y, 'access', _31 => _31.stdout, 'optionalAccess', _32 => _32.off, 'call', _33 => _33("data",T)]),L&&_optionalChain([y, 'access', _34 => _34.stderr, 'optionalAccess', _35 => _35.off, 'call', _36 => _36("data",L)])),T=null,L=null,h=null,p="dashboard",_optionalChain([r, 'optionalCall', _37 => _37()])},k=(b,y)=>{i("keypress",JSON.stringify({str:b,name:y.name,seq:y.sequence,ctrl:y.ctrl,meta:y.meta,shift:y.shift,mode:p}));let S=pt(b,y,p);if(i("mapped",JSON.stringify(S)),!!S)switch(S.type){case"CTRL_C":{if(i("CTRL_C"),p==="attached"&&h!=null){let w=t.get(h);try{_optionalChain([w, 'optionalAccess', _38 => _38.kill, 'call', _39 => _39("SIGINT")])}catch (e10){}x();return}_optionalChain([n, 'optionalCall', _40 => _40()]);return}case"ATTACH":{if(i("ATTACH",`id=${S.id}`,`has=${t.has(S.id)}`),p!=="dashboard")return;t.has(S.id)&&E(S.id);return}case"CYCLE":{if(i("CYCLE",`delta=${S.delta}`),p!=="dashboard")return;let w=mt(ft(t),h,S.delta);w!=null&&E(w);return}case"QUIT":{if(p!=="dashboard")return;_optionalChain([n, 'optionalCall', _41 => _41()]);return}case"DETACH":{i("DETACH"),p==="attached"&&x();return}case"CTRL_D":{if(p==="attached"&&h!=null){let w=t.get(h);try{_optionalChain([w, 'optionalAccess', _42 => _42.stdin, 'optionalAccess', _43 => _43.end, 'call', _44 => _44()])}catch (e11){}}return}case"FORWARD":if(p==="attached"&&h!=null){let w=t.get(h);try{_optionalChain([w, 'optionalAccess', _45 => _45.stdin, 'optionalAccess', _46 => _46.write, 'call', _47 => _47(S.sequence)])}catch (e12){}}}},A=b=>{if(p==="attached"&&h!=null){let y=t.get(h);try{_optionalChain([y, 'optionalAccess', _48 => _48.stdin, 'optionalAccess', _49 => _49.write, 'call', _50 => _50(b)])}catch (e13){}}},j=()=>{c.off("keypress",k),c.off("data",A),_optionalChain([c, 'access', _51 => _51.setRawMode, 'optionalCall', _52 => _52(!1)]),d.write("\x1B[?25h")};return c.on("keypress",k),c.on("data",A),j}async function Re(e){let{title:t,baseDir:o,poolSize:r,cpuCount:n,render:l,childModulePath:s,hooks:a,filesTotal:f,childFlag:m,viewerMode:c=!1}=e,d=_nullishCoalesce(e.openLogWindows, () => (!c)),g=_nullishCoalesce(e.isSilent, () => (!0)),i=Date.now(),p=it(o),h=new Map,T=new Map,L=new Map,$=new
|
|
22
|
+
`)}}let E=async b=>{i("attach()",`id=${b}`);let y=t.get(b);if(!y)return;p==="attached"&&x(),p="attached",h=b,_optionalChain([f, 'optionalCall', _23 => _23(b)]),_optionalChain([o, 'optionalCall', _24 => _24(b)]),await $(b),T=w=>d.write(w),L=w=>g.write(w),_optionalChain([y, 'access', _25 => _25.stdout, 'optionalAccess', _26 => _26.on, 'call', _27 => _27("data",T)]),_optionalChain([y, 'access', _28 => _28.stderr, 'optionalAccess', _29 => _29.on, 'call', _30 => _30("data",L)]);let S=()=>{h===b&&x()};y.once("exit",S)},x=()=>{if(i("detach()",`id=${h}`),h==null)return;let b=h,y=t.get(b);y&&(T&&_optionalChain([y, 'access', _31 => _31.stdout, 'optionalAccess', _32 => _32.off, 'call', _33 => _33("data",T)]),L&&_optionalChain([y, 'access', _34 => _34.stderr, 'optionalAccess', _35 => _35.off, 'call', _36 => _36("data",L)])),T=null,L=null,h=null,p="dashboard",_optionalChain([r, 'optionalCall', _37 => _37()])},k=(b,y)=>{i("keypress",JSON.stringify({str:b,name:y.name,seq:y.sequence,ctrl:y.ctrl,meta:y.meta,shift:y.shift,mode:p}));let S=pt(b,y,p);if(i("mapped",JSON.stringify(S)),!!S)switch(S.type){case"CTRL_C":{if(i("CTRL_C"),p==="attached"&&h!=null){let w=t.get(h);try{_optionalChain([w, 'optionalAccess', _38 => _38.kill, 'call', _39 => _39("SIGINT")])}catch (e10){}x();return}_optionalChain([n, 'optionalCall', _40 => _40()]);return}case"ATTACH":{if(i("ATTACH",`id=${S.id}`,`has=${t.has(S.id)}`),p!=="dashboard")return;t.has(S.id)&&E(S.id);return}case"CYCLE":{if(i("CYCLE",`delta=${S.delta}`),p!=="dashboard")return;let w=mt(ft(t),h,S.delta);w!=null&&E(w);return}case"QUIT":{if(p!=="dashboard")return;_optionalChain([n, 'optionalCall', _41 => _41()]);return}case"DETACH":{i("DETACH"),p==="attached"&&x();return}case"CTRL_D":{if(p==="attached"&&h!=null){let w=t.get(h);try{_optionalChain([w, 'optionalAccess', _42 => _42.stdin, 'optionalAccess', _43 => _43.end, 'call', _44 => _44()])}catch (e11){}}return}case"FORWARD":if(p==="attached"&&h!=null){let w=t.get(h);try{_optionalChain([w, 'optionalAccess', _45 => _45.stdin, 'optionalAccess', _46 => _46.write, 'call', _47 => _47(S.sequence)])}catch (e12){}}}},A=b=>{if(p==="attached"&&h!=null){let y=t.get(h);try{_optionalChain([y, 'optionalAccess', _48 => _48.stdin, 'optionalAccess', _49 => _49.write, 'call', _50 => _50(b)])}catch (e13){}}},j=()=>{c.off("keypress",k),c.off("data",A),_optionalChain([c, 'access', _51 => _51.setRawMode, 'optionalCall', _52 => _52(!1)]),d.write("\x1B[?25h")};return c.on("keypress",k),c.on("data",A),j}async function Re(e){let{title:t,baseDir:o,poolSize:r,cpuCount:n,render:l,childModulePath:s,hooks:a,filesTotal:f,childFlag:m,viewerMode:c=!1}=e,d=_nullishCoalesce(e.openLogWindows, () => (!c)),g=_nullishCoalesce(e.isSilent, () => (!0)),i=Date.now(),p=it(o),h=new Map,T=new Map,L=new Map,$=new _chunkVWN5MN3Ucjs.dg,x=_nullishCoalesce(_optionalChain([a, 'access', _53 => _53.initTotals, 'optionalCall', _54 => _54()]), () => ({})),k=0,A=0,j=0,b=null,y=!1,S=!1,w=null,R=(u=!1)=>{S||l({title:t,poolSize:r,cpuCount:n,filesTotal:f,filesCompleted:A,filesFailed:j,workerState:T,totals:x,final:u,exportStatus:_optionalChain([a, 'access', _55 => _55.exportStatus, 'optionalCall', _56 => _56()]),throughput:{successSoFar:A,r10s:$.rate(1e4),r60s:$.rate(6e4)}})},U=u=>{let v=a.nextTask();if(!v)return!1;let F=h.get(u),P=a.taskLabel(v),W=_optionalChain([a, 'access', _57 => _57.initSlotProgress, 'optionalCall', _58 => _58(v)]);return T.set(u,{busy:!0,file:P,startedAt:Date.now(),lastLevel:"ok",progress:W}),G(F,{type:"task",payload:v}),R(),!0};for(let u=0;u<r;u+=1){let v=lt({id:u,modulePath:s,logDir:p,openLogWindows:d,isSilent:g,childFlag:m});h.set(u,v),T.set(u,{busy:!1,file:null,startedAt:null,lastLevel:"ok"}),L.set(u,K(v)),k+=1;let F=I(P=>{let W=_(P);if(!W)return;let H=T.get(u);H.lastLevel!==W&&(T.set(u,{...H,lastLevel:W}),R())});_optionalChain([v, 'access', _59 => _59.stderr, 'optionalAccess', _60 => _60.on, 'call', _61 => _61("data",F)]),v.on("message",P=>{if(!(!P||typeof P!="object")){if(P.type==="ready"){y||(y=!0,b=setInterval(()=>R(!1),350)),U(u);return}if(P.type==="progress"){x=a.onProgress(x,P.payload);let W=T.get(u);T.set(u,{...W,progress:P.payload}),R();return}if(P.type==="result"){let W=T.get(u),{totals:H,ok:X}=a.onResult(x,P.payload);x=H,X?(A+=1,$.add(1)):j+=1,T.set(u,{...W,busy:!1,file:null,progress:void 0,lastLevel:X?"ok":"error"}),!U(u)&&O(v)&&G(v,{type:"shutdown"}),R()}}}),v.on("exit",()=>{k-=1,k===0&&(b&&clearInterval(b),R(!0))})}let z=()=>{},Y=()=>{try{_optionalChain([process, 'access', _62 => _62.stdin, 'access', _63 => _63.setRawMode, 'optionalCall', _64 => _64(!1)])}catch (e14){}try{process.stdin.pause()}catch (e15){}},Q=()=>{if(b&&clearInterval(b),_optionalChain([z, 'optionalCall', _65 => _65()]),w)try{process.stdin.off("data",w)}catch (e16){}Y(),process.stdout.write(`
|
|
23
23
|
Stopping workers...
|
|
24
24
|
`);for(let[,u]of h){O(u)&&G(u,{type:"shutdown"});try{_optionalChain([u, 'optionalAccess', _66 => _66.kill, 'call', _67 => _67("SIGTERM")])}catch (e17){}}process.exit(130)},V=u=>{S=!0,process.stdout.write("\x1B[2J\x1B[H"),process.stdout.write(`Attached to worker ${u}. (Esc/Ctrl+] detach \u2022 Ctrl+D EOF \u2022 Ctrl+C SIGINT)
|
|
25
25
|
`)},St=()=>{S=!1,R()};if(process.once("SIGINT",Q),!c){if(process.stdin.isTTY){try{process.stdin.setRawMode(!0)}catch (e18){process.stdout.write(_colors2.default.yellow(`Warning: Unable to enable raw mode for interactive key handling.
|
|
@@ -35,4 +35,4 @@ Press Esc/Ctrl+] to return to dashboard.
|
|
|
35
35
|
`),(async()=>{try{await wt(t,g,i)}catch (e21){m=!1,r(!1),o()}})())},d=(g,i)=>{if(n)try{let p=n.exportCombinedLogs(t,g);a(`
|
|
36
36
|
Wrote combined ${i} logs to: ${p}`),f(g,p)}catch (e22){a(`
|
|
37
37
|
Failed to write combined ${i} logs`)}};return g=>{let i=g.toString("utf8");if(i==="e"){c(["err"],"error");return}if(i==="w"){c(["warn","err"],"warn");return}if(i==="i"){c(["info"],"all");return}if(i==="l"){c(["out","err","structured"],"all");return}if(i==="E"){d("error","error");return}if(i==="W"){d("warn","warn");return}if(i==="I"){d("info","info");return}if(i==="A"){d("all","ALL");return}let p=_optionalChain([s, 'optionalAccess', _78 => _78[i]]);if(p){p({noteExport:f,say:a});return}(i==="\x1B"||i==="")&&(m=!1,r(!1),o())}}var _events = require('events');var _url = require('url');function B(e){return typeof e=="number"?e.toLocaleString():"0"}function yt(e,t=40){let o=Math.max(0,Math.min(100,Math.floor(e))),r=Math.floor(o/100*t);return"\u2588".repeat(r)+"\u2591".repeat(t-r)}function Nt(e){let t=[...e.workerState.values()].filter(n=>n.busy).length,o=e.filesCompleted+e.filesFailed,r=e.filesTotal===0?100:Math.floor(o/Math.max(1,e.filesTotal)*100);return{done:o,inProgress:t,pct:r}}function or(e,t=[]){let{title:o,poolSize:r,cpuCount:n,filesTotal:l,filesCompleted:s,filesFailed:a,throughput:f}=e,{inProgress:m,pct:c}=Nt(e),d=[`${_colors2.default.bold(o)} \u2014 ${r} workers ${_colors2.default.dim(`(CPU avail: ${n})`)}`,`${_colors2.default.dim("Files")} ${B(l)} ${_colors2.default.dim("Completed")} ${B(s)} ${_colors2.default.dim("Failed")} ${a?_colors2.default.red(B(a)):B(a)} ${_colors2.default.dim("In-flight")} ${B(m)}`,`[${yt(c)}] ${c}%`];if(f){let g=Math.round(f.r10s*3600).toLocaleString(),i=Math.round(f.r60s*3600).toLocaleString(),p=_optionalChain([e, 'access', _79 => _79.throughput, 'optionalAccess', _80 => _80.successSoFar])!=null?` Newly uploaded: ${B(e.throughput.successSoFar)}`:"";d.push(_colors2.default.cyan(`Throughput: ${g}/hr (1h: ${i}/hr)${p}`))}return t.length?d.concat(t):d}function nr(e,t=o=>o?_path.basename.call(void 0, o):"-"){return[...e.workerState.entries()].map(([r,n])=>{let l=n.lastLevel==="error"?_colors2.default.red("ERROR "):n.lastLevel==="warn"?_colors2.default.yellow("WARN "):n.busy?_colors2.default.green("WORKING"):_colors2.default.dim("IDLE "),s=t(n.file),a=n.startedAt?`${Math.floor((Date.now()-n.startedAt)/1e3)}s`:"-",f=_nullishCoalesce(_optionalChain([n, 'access', _81 => _81.progress, 'optionalAccess', _82 => _82.processed]), () => (0)),m=_nullishCoalesce(_optionalChain([n, 'access', _83 => _83.progress, 'optionalAccess', _84 => _84.total]), () => (0)),c=m>0?Math.floor(f/m*100):0,d=m>0?yt(c,18):" ".repeat(18),g=m>0?`${f.toLocaleString()}/${m.toLocaleString()} (${c}%)`:_colors2.default.dim("\u2014");return` [w${r}] ${l} | ${s} | ${a} | [${d}] ${g}`})}exports.a = Kt; exports.b = Bt; exports.c = ue; exports.d = or; exports.e = nr; exports.f = Re; exports.g = Oe;
|
|
38
|
-
//# sourceMappingURL=chunk-
|
|
38
|
+
//# sourceMappingURL=chunk-PCK2N4IA.cjs.map
|