@transcend-io/cli 8.1.2 → 8.1.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.
Files changed (111) hide show
  1. package/dist/bin/bash-complete.cjs +1 -1
  2. package/dist/bin/cli.cjs +1 -1
  3. package/dist/bin/deprecated-command.cjs +2 -2
  4. package/dist/{chunk-FIPM3WX2.cjs → chunk-3BZWG5GJ.cjs} +2 -2
  5. package/dist/{chunk-FIPM3WX2.cjs.map → chunk-3BZWG5GJ.cjs.map} +1 -1
  6. package/dist/{chunk-E3HBS2DS.cjs → chunk-5CDEM565.cjs} +2 -2
  7. package/dist/{chunk-E3HBS2DS.cjs.map → chunk-5CDEM565.cjs.map} +1 -1
  8. package/dist/{chunk-DQ4R65RB.cjs → chunk-GVK66NZA.cjs} +2 -2
  9. package/dist/{chunk-DQ4R65RB.cjs.map → chunk-GVK66NZA.cjs.map} +1 -1
  10. package/dist/{chunk-CUTZDENX.cjs → chunk-J5D25IXA.cjs} +20 -20
  11. package/dist/{chunk-CUTZDENX.cjs.map → chunk-J5D25IXA.cjs.map} +1 -1
  12. package/dist/chunk-JEH3FW7J.cjs +2920 -0
  13. package/dist/{chunk-EMB64AC3.cjs.map → chunk-JEH3FW7J.cjs.map} +1 -1
  14. package/dist/{chunk-BZI5QRMD.cjs → chunk-OAG7DICW.cjs} +2 -2
  15. package/dist/{chunk-BZI5QRMD.cjs.map → chunk-OAG7DICW.cjs.map} +1 -1
  16. package/dist/{chunk-4U57O4PS.cjs → chunk-OFZ7ZSEV.cjs} +2 -2
  17. package/dist/{chunk-4U57O4PS.cjs.map → chunk-OFZ7ZSEV.cjs.map} +1 -1
  18. package/dist/{chunk-KUOWI5XE.cjs → chunk-SADDDAXF.cjs} +2 -2
  19. package/dist/{chunk-KUOWI5XE.cjs.map → chunk-SADDDAXF.cjs.map} +1 -1
  20. package/dist/{chunk-YYYG72XH.cjs → chunk-UW2YF6JM.cjs} +4 -4
  21. package/dist/{chunk-YYYG72XH.cjs.map → chunk-UW2YF6JM.cjs.map} +1 -1
  22. package/dist/{chunk-CVQWA6RN.cjs → chunk-VGTGGUCM.cjs} +2 -2
  23. package/dist/{chunk-CVQWA6RN.cjs.map → chunk-VGTGGUCM.cjs.map} +1 -1
  24. package/dist/{chunk-LOWUINKF.cjs → chunk-VKNIPZ42.cjs} +2 -2
  25. package/dist/{chunk-LOWUINKF.cjs.map → chunk-VKNIPZ42.cjs.map} +1 -1
  26. package/dist/{chunk-V4GIAIGU.cjs → chunk-VXJ3QION.cjs} +3 -3
  27. package/dist/{chunk-V4GIAIGU.cjs.map → chunk-VXJ3QION.cjs.map} +1 -1
  28. package/dist/{impl-CW4P3FBU.cjs → impl-3THXGCQP.cjs} +2 -2
  29. package/dist/{impl-CW4P3FBU.cjs.map → impl-3THXGCQP.cjs.map} +1 -1
  30. package/dist/{impl-L5IP2CI4.cjs → impl-43UGCXOQ.cjs} +2 -2
  31. package/dist/{impl-L5IP2CI4.cjs.map → impl-43UGCXOQ.cjs.map} +1 -1
  32. package/dist/{impl-FNQYLHQP.cjs → impl-4OHRVXEI.cjs} +2 -2
  33. package/dist/{impl-FNQYLHQP.cjs.map → impl-4OHRVXEI.cjs.map} +1 -1
  34. package/dist/{impl-VNONBZAR.cjs → impl-4TH3KKOU.cjs} +2 -2
  35. package/dist/{impl-VNONBZAR.cjs.map → impl-4TH3KKOU.cjs.map} +1 -1
  36. package/dist/impl-534MCRL5.cjs +2 -0
  37. package/dist/{impl-KFCSSBYU.cjs.map → impl-534MCRL5.cjs.map} +1 -1
  38. package/dist/{impl-3M5H66QQ.cjs → impl-67VIE5PB.cjs} +2 -2
  39. package/dist/{impl-3M5H66QQ.cjs.map → impl-67VIE5PB.cjs.map} +1 -1
  40. package/dist/{impl-A6YXWSI5.cjs → impl-6A3ARA2O.cjs} +6 -6
  41. package/dist/{impl-A6YXWSI5.cjs.map → impl-6A3ARA2O.cjs.map} +1 -1
  42. package/dist/{impl-ABCJ37Z7.cjs → impl-7RHWAGHN.cjs} +2 -2
  43. package/dist/{impl-ABCJ37Z7.cjs.map → impl-7RHWAGHN.cjs.map} +1 -1
  44. package/dist/{impl-2REOS3PC.cjs → impl-7RXJTTTG.cjs} +2 -2
  45. package/dist/{impl-2REOS3PC.cjs.map → impl-7RXJTTTG.cjs.map} +1 -1
  46. package/dist/{impl-Y6UD6TEX.cjs → impl-DRCKNEM2.cjs} +2 -2
  47. package/dist/{impl-Y6UD6TEX.cjs.map → impl-DRCKNEM2.cjs.map} +1 -1
  48. package/dist/{impl-M6QIFDQJ.cjs → impl-DSHX3YJG.cjs} +2 -2
  49. package/dist/{impl-M6QIFDQJ.cjs.map → impl-DSHX3YJG.cjs.map} +1 -1
  50. package/dist/{impl-ES6WNRK2.cjs → impl-DSNVVZRC.cjs} +2 -2
  51. package/dist/{impl-ES6WNRK2.cjs.map → impl-DSNVVZRC.cjs.map} +1 -1
  52. package/dist/{impl-KBO3FFYP.cjs → impl-E3URUIOG.cjs} +2 -2
  53. package/dist/{impl-KBO3FFYP.cjs.map → impl-E3URUIOG.cjs.map} +1 -1
  54. package/dist/{impl-GVGOIIHI.cjs → impl-FFNYFUNL.cjs} +2 -2
  55. package/dist/{impl-GVGOIIHI.cjs.map → impl-FFNYFUNL.cjs.map} +1 -1
  56. package/dist/{impl-ANMYZBXH.cjs → impl-FUTK5GS3.cjs} +2 -2
  57. package/dist/{impl-ANMYZBXH.cjs.map → impl-FUTK5GS3.cjs.map} +1 -1
  58. package/dist/{impl-PERSC7WX.cjs → impl-FXW73S5T.cjs} +2 -2
  59. package/dist/{impl-PERSC7WX.cjs.map → impl-FXW73S5T.cjs.map} +1 -1
  60. package/dist/{impl-KL5OOY5U.cjs → impl-H3AZBUG5.cjs} +2 -2
  61. package/dist/{impl-KL5OOY5U.cjs.map → impl-H3AZBUG5.cjs.map} +1 -1
  62. package/dist/{impl-QR72P4GY.cjs → impl-H7O5YVYG.cjs} +3 -3
  63. package/dist/{impl-QR72P4GY.cjs.map → impl-H7O5YVYG.cjs.map} +1 -1
  64. package/dist/{impl-U5EBZCIQ.cjs → impl-IASTUGV6.cjs} +4 -4
  65. package/dist/{impl-U5EBZCIQ.cjs.map → impl-IASTUGV6.cjs.map} +1 -1
  66. package/dist/{impl-LRWZARHM.cjs → impl-IJTQXS6O.cjs} +2 -2
  67. package/dist/{impl-LRWZARHM.cjs.map → impl-IJTQXS6O.cjs.map} +1 -1
  68. package/dist/{impl-6H2SEINI.cjs → impl-JQTEIK2F.cjs} +2 -2
  69. package/dist/{impl-6H2SEINI.cjs.map → impl-JQTEIK2F.cjs.map} +1 -1
  70. package/dist/{impl-ABEIAAXG.cjs → impl-KULLM3ES.cjs} +5 -5
  71. package/dist/{impl-ABEIAAXG.cjs.map → impl-KULLM3ES.cjs.map} +1 -1
  72. package/dist/{impl-VQHQ7BUI.cjs → impl-N3T5JJN3.cjs} +2 -2
  73. package/dist/{impl-VQHQ7BUI.cjs.map → impl-N3T5JJN3.cjs.map} +1 -1
  74. package/dist/{impl-2FDYPU4D.cjs → impl-N7G3LUCY.cjs} +2 -2
  75. package/dist/{impl-2FDYPU4D.cjs.map → impl-N7G3LUCY.cjs.map} +1 -1
  76. package/dist/{impl-E2HT5BNA.cjs → impl-P4SXH5YA.cjs} +2 -2
  77. package/dist/{impl-E2HT5BNA.cjs.map → impl-P4SXH5YA.cjs.map} +1 -1
  78. package/dist/{impl-GXF6DOD3.cjs → impl-PPDM46JD.cjs} +2 -2
  79. package/dist/{impl-GXF6DOD3.cjs.map → impl-PPDM46JD.cjs.map} +1 -1
  80. package/dist/{impl-DN2UQJ3S.cjs → impl-Q3KJJPJO.cjs} +2 -2
  81. package/dist/{impl-DN2UQJ3S.cjs.map → impl-Q3KJJPJO.cjs.map} +1 -1
  82. package/dist/{impl-DUTLZXI4.cjs → impl-S5RVN46S.cjs} +5 -5
  83. package/dist/{impl-DUTLZXI4.cjs.map → impl-S5RVN46S.cjs.map} +1 -1
  84. package/dist/{impl-IFO7BHTL.cjs → impl-TDSXUSMZ.cjs} +2 -2
  85. package/dist/{impl-IFO7BHTL.cjs.map → impl-TDSXUSMZ.cjs.map} +1 -1
  86. package/dist/{impl-5MZPCJWM.cjs → impl-TP5ZB4AS.cjs} +2 -2
  87. package/dist/{impl-5MZPCJWM.cjs.map → impl-TP5ZB4AS.cjs.map} +1 -1
  88. package/dist/{impl-QS3G7FDW.cjs → impl-UANPW425.cjs} +2 -2
  89. package/dist/{impl-QS3G7FDW.cjs.map → impl-UANPW425.cjs.map} +1 -1
  90. package/dist/{impl-WP4DZVLN.cjs → impl-UOHFNQMH.cjs} +2 -2
  91. package/dist/{impl-WP4DZVLN.cjs.map → impl-UOHFNQMH.cjs.map} +1 -1
  92. package/dist/{impl-3VIMVUBA.cjs → impl-V5BNNVFJ.cjs} +2 -2
  93. package/dist/{impl-3VIMVUBA.cjs.map → impl-V5BNNVFJ.cjs.map} +1 -1
  94. package/dist/{impl-Q2YWAZ5V.cjs → impl-WDHTHO7S.cjs} +3 -3
  95. package/dist/{impl-Q2YWAZ5V.cjs.map → impl-WDHTHO7S.cjs.map} +1 -1
  96. package/dist/{impl-DOQM27FH.cjs → impl-WQY2NAQM.cjs} +2 -2
  97. package/dist/{impl-DOQM27FH.cjs.map → impl-WQY2NAQM.cjs.map} +1 -1
  98. package/dist/{impl-OKUMBOKA.cjs → impl-Y2QTEYJ5.cjs} +2 -2
  99. package/dist/{impl-OKUMBOKA.cjs.map → impl-Y2QTEYJ5.cjs.map} +1 -1
  100. package/dist/{impl-UVWK5LEC.cjs → impl-YENS4XKY.cjs} +2 -2
  101. package/dist/{impl-UVWK5LEC.cjs.map → impl-YENS4XKY.cjs.map} +1 -1
  102. package/dist/{impl-JDTKIRQY.cjs → impl-YLZABO2C.cjs} +2 -2
  103. package/dist/{impl-JDTKIRQY.cjs.map → impl-YLZABO2C.cjs.map} +1 -1
  104. package/dist/{impl-PF2UNMEM.cjs → impl-Z3VKOYUT.cjs} +2 -2
  105. package/dist/{impl-PF2UNMEM.cjs.map → impl-Z3VKOYUT.cjs.map} +1 -1
  106. package/dist/index.cjs +3 -3
  107. package/dist/index.cjs.map +1 -1
  108. package/dist/index.d.cts +53 -27
  109. package/package.json +1 -1
  110. package/dist/chunk-EMB64AC3.cjs +0 -2920
  111. package/dist/impl-KFCSSBYU.cjs +0 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/cli/cli/dist/chunk-V4GIAIGU.cjs","../src/lib/consent-manager/updateConsentManagerVersionToLatest.ts","../src/lib/consent-manager/uploadDataFlowsFromCsv.ts","../src/lib/consent-manager/uploadCookiesFromCsv.ts","../src/lib/consent-manager/pullConsentManagerMetrics.ts","../src/lib/consent-manager/domainToHost.ts","../src/lib/consent-manager/buildXdiSyncEndpoint.ts","../src/lib/consent-manager/consentManagersToBusinessEntities.ts","../src/lib/consent-manager/fetchConsentPreferences.ts"],"names":["updateConsentManagerVersionToLatest","auth","deploy","transcendUrl","DEFAULT_TRANSCEND_API","bundleTypes","ConsentBundleType","client","buildTranscendGraphQLClient","consentManagerId","fetchConsentManagerId","mapSeries","bundleType","logger","colors","updateConsentManagerToLatest","deployConsentManager","OMIT_COLUMNS","uploadDataFlowsFromCsv","trackerStatus","file","classifyService","validatedDataFlowInputs","readCsv","DataFlowCsvInput","Type","Notes","Service","Purpose","Status","Owners","Teams","value","rest","splitCsvToList","key","syncDataFlows","uploadCookiesFromCsv","validatedCookieInputs","CookieCsvInput","isRegex","Name","syncCookies","ONE_SECOND","ONE_MINUTE","ONE_HOUR","ONE_DAY","ONE_WEEK","pullConsentManagerMetrics","bin","start","end","airgapBundleId","startTime","endTime","startDate","endDate","privacySignalData","consentChangesData","consentSessionsByRegimeData","fetchConsentManagerAnalyticsData","domainToHost","domain"],"mappings":"AAAA,u/BAAwC,wDAAkD,wDAAkH,wDAAyC,wDAAgD,2DCAnQ,oCACR,gFAOP,MAUnB,SAAsBA,EAAAA,CAAoC,CACxD,IAAA,CAAAC,CAAAA,CACA,MAAA,C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AaH,CAAAA,CACb,gBAAA,CAAkB,CAAA,CACpB,CAAC,CAAA,CACDW,kCAAAA,CAAiCrD,CAAQ,CACvC,UAAA,CAAY,4BAAA,CACZ,SAAA,CAAAgD,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,YAAA,CAAc,CAAA,CAAA,CACd,cAAA,CAAAJ,CAAAA,CACA,WAAA,CAAaH,CAAAA,CACb,gBAAA,CAAkB,CAAA,CACpB,CAAC,CACH,CAAC,CAAA,CAEH,MAAO,CACL,yBAAA,CAA2BQ,CAAAA,CAC3B,0BAAA,CAA4BC,CAAAA,CAC5B,0BAAA,CAA4BC,CAC9B,CACF,CChGO,IAAME,CAAAA,CAAgBC,CAAAA,EAC3B,IAAI,GAAA,CAAI,CAAA,QAAA,EAAWA,CAAM,CAAA,CAAA;ACiHA;AAAA;AAGT,KAAA;AACqC,kBAAA;AAChB,mBAAA;AAAA;AC5DzB;AAAA;AAAA;ACmBd,uBAAA","file":"/home/runner/work/cli/cli/dist/chunk-V4GIAIGU.cjs","sourcesContent":[null,"import { ConsentBundleType } from '@transcend-io/privacy-types';\nimport { mapSeries } from 'bluebird';\nimport {\n updateConsentManagerToLatest,\n buildTranscendGraphQLClient,\n fetchConsentManagerId,\n deployConsentManager,\n} from '../graphql';\nimport colors from 'colors';\n\nimport { logger } from '../../logger';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\n\n/**\n * Update the consent manager to latest version\n *\n * @param options - Options\n */\nexport async function updateConsentManagerVersionToLatest({\n auth,\n deploy = false,\n transcendUrl = DEFAULT_TRANSCEND_API,\n bundleTypes = Object.values(ConsentBundleType),\n}: {\n /** Transcend API key authentication */\n auth: string;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** Deploy consent manager with this update */\n deploy?: boolean;\n /** The bundle types to update and deploy */\n bundleTypes?: ConsentBundleType[];\n}): Promise<void> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Grab Consent Manager ID\n const consentManagerId = await fetchConsentManagerId(client);\n\n // Update each bundle type to latest version\n await mapSeries(bundleTypes, async (bundleType) => {\n logger.info(\n colors.magenta(\n `Update Consent Manager bundle with ID \"${consentManagerId}\" and type \"${bundleType}\" to latest version...`,\n ),\n );\n await updateConsentManagerToLatest(client, {\n id: consentManagerId,\n bundleType,\n });\n logger.info(\n colors.green(\n `Updated Consent Manager bundle with ID \"${consentManagerId}\" and type \"${bundleType}\" to latest version!`,\n ),\n );\n });\n\n // deploy Consent Managers\n if (deploy) {\n // Update each bundle type to latest version\n await mapSeries(bundleTypes, async (bundleType) => {\n logger.info(\n colors.magenta(\n `Deploying Consent Manager bundle with ID \"${consentManagerId}\" and type \"${bundleType}\"...`,\n ),\n );\n await deployConsentManager(client, {\n id: consentManagerId,\n bundleType,\n });\n logger.info(\n colors.green(\n `Deployed Consent Manager bundle with ID \"${consentManagerId}\" and type \"${bundleType}\"!`,\n ),\n );\n });\n }\n}\n","import colors from 'colors';\nimport { logger } from '../../logger';\nimport { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, syncDataFlows } from '../graphql';\nimport { readCsv } from '../requests/readCsv';\nimport { DataFlowInput, DataFlowCsvInput } from '../../codecs';\nimport { splitCsvToList } from '../requests';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\n\nconst OMIT_COLUMNS = [\n 'ID',\n 'Activity',\n 'Encounters',\n 'Last Seen At',\n 'Has Native Do Not Sell/Share Support',\n 'IAB USP API Support',\n 'Service Description',\n 'Website URL',\n 'Categories of Recipients',\n];\n\n/**\n * Upload a set of data flows from CSV\n *\n * @param options - Options\n */\nexport async function uploadDataFlowsFromCsv({\n auth,\n trackerStatus,\n file,\n classifyService = false,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** Sombra API key authentication */\n trackerStatus: ConsentTrackerStatus;\n /** classify data flow service if missing */\n classifyService?: boolean;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<void> {\n // Build a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read from CSV the set of data flow inputs\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const dataFlowInputs = readCsv(file, DataFlowCsvInput);\n\n // Convert these data flow inputs into a format that the other function can use\n const validatedDataFlowInputs = dataFlowInputs.map(\n ({\n Type,\n Notes,\n // TODO: https://transcend.height.app/T-26391 - export in CSV\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n Service,\n Purpose,\n Status,\n Owners,\n Teams,\n 'Connections Made To': value,\n ...rest\n }): DataFlowInput => ({\n value,\n type: Type,\n description: Notes,\n trackingPurposes: splitCsvToList(Purpose),\n // TODO: https://transcend.height.app/T-26391\n // service: Service,\n // Apply the trackerStatus to all values in the CSV -> allows for customer to define tracker status\n // on a row by row basis if needed\n status: Status || trackerStatus,\n owners: Owners ? splitCsvToList(Owners) : undefined,\n teams: Teams ? splitCsvToList(Teams) : undefined,\n // all remaining options are attribute\n attributes: Object.entries(rest)\n // filter out native columns that are exported from the admin dashboard\n // but not custom attributes\n .filter(([key]) => !OMIT_COLUMNS.includes(key))\n .map(([key, value]) => ({\n key,\n values: splitCsvToList(value),\n })),\n }),\n );\n\n // Upload the data flows into Transcend dashboard\n const syncedDataFlows = await syncDataFlows(\n client,\n validatedDataFlowInputs,\n classifyService,\n );\n\n // Log errors\n if (!syncedDataFlows) {\n logger.error(\n colors.red(\n 'Encountered error(s) syncing data flows from CSV, see logs above for more info. ',\n ),\n );\n process.exit(1);\n }\n}\n","import colors from 'colors';\nimport { logger } from '../../logger';\nimport { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, syncCookies } from '../graphql';\nimport { readCsv } from '../requests/readCsv';\nimport { CookieInput, CookieCsvInput } from '../../codecs';\nimport { splitCsvToList } from '../requests';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\n\nconst OMIT_COLUMNS = [\n 'ID',\n 'Activity',\n 'Encounters',\n 'Last Seen At',\n 'Has Native Do Not Sell/Share Support',\n 'IAB USP API Support',\n 'Service Description',\n 'Website URL',\n 'Categories of Recipients',\n];\n\n/**\n * Upload a set of cookies from CSV\n *\n * @param options - Options\n */\nexport async function uploadCookiesFromCsv({\n auth,\n trackerStatus,\n file,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** Sombra API key authentication */\n trackerStatus: ConsentTrackerStatus;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<void> {\n // Build a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read from CSV the set of cookie inputs\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const cookieInputs = readCsv(file, CookieCsvInput);\n\n // Convert these inputs into a format that the other function can use\n const validatedCookieInputs = cookieInputs.map(\n ({\n 'Is Regex?': isRegex,\n Notes,\n // TODO: https://transcend.height.app/T-26391 - export in CSV\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n Service,\n Purpose,\n Status,\n Owners,\n Teams,\n Name,\n ...rest\n }): CookieInput => ({\n ...(typeof isRegex === 'string'\n ? { isRegex: isRegex.toLowerCase() === 'true' }\n : {}),\n name: Name,\n description: Notes,\n trackingPurposes: splitCsvToList(Purpose),\n // TODO: https://transcend.height.app/T-26391\n // service: Service,\n // Apply the trackerStatus to all values in the CSV -> allows for customer to define tracker status\n // on a row by row basis if needed\n status: Status || trackerStatus,\n owners: Owners ? splitCsvToList(Owners) : undefined,\n teams: Teams ? splitCsvToList(Teams) : undefined,\n // all remaining options are attribute\n attributes: Object.entries(rest)\n // filter out native columns that are exported from the admin dashboard\n // but not custom attributes\n .filter(([key]) => !OMIT_COLUMNS.includes(key))\n .map(([key, value]) => ({\n key,\n values: splitCsvToList(value),\n })),\n }),\n );\n\n // Upload the cookies into Transcend dashboard\n const syncedCookies = await syncCookies(client, validatedCookieInputs);\n\n // Log errors\n if (!syncedCookies) {\n logger.error(\n colors.red(\n 'Encountered error(s) syncing cookies from CSV, see logs above for more info. ',\n ),\n );\n process.exit(1);\n }\n}\n","import type { GraphQLClient } from 'graphql-request';\nimport {\n ConsentManagerMetric,\n ConsentManagerMetricBin,\n fetchConsentManagerAnalyticsData,\n fetchConsentManagerId,\n} from '../graphql';\n\n/**\n * One second of time in ms\n */\nconst ONE_SECOND = 1000;\nconst ONE_MINUTE = 60 * ONE_SECOND;\nconst ONE_HOUR = 60 * ONE_MINUTE;\nconst ONE_DAY = 24 * ONE_HOUR;\nconst ONE_WEEK = 7 * ONE_DAY;\n\n/**\n * Pull consent manager metrics in an organization\n *\n * @param client - GraphQL client\n * @param options - Options\n * @returns The consent manager metrics\n */\nexport async function pullConsentManagerMetrics(\n client: GraphQLClient,\n {\n bin,\n start,\n end = new Date(),\n }: {\n /** Start date to pull metrics from */\n start: Date;\n /** End date to pull metrics from (assumes now) */\n end?: Date;\n /** Bin size to pull metrics */\n bin: ConsentManagerMetricBin;\n },\n): Promise<{\n /** Privacy signal data */\n PRIVACY_SIGNAL_TIMESERIES: ConsentManagerMetric[];\n /** Consent changes data */\n CONSENT_CHANGES_TIMESERIES: ConsentManagerMetric[];\n /** Consent sessions by regime */\n CONSENT_SESSIONS_BY_REGIME: ConsentManagerMetric[];\n}> {\n // Grab the bundleId associated with this API key\n const airgapBundleId = await fetchConsentManagerId(client);\n\n // convert start and end to times\n const startTime = Math.floor(start.getTime() / 1000);\n const endTime = Math.floor(end.getTime() / 1000);\n if (startTime > endTime) {\n throw new Error('Received \"end\" date that happened before \"start\" date');\n }\n\n // do not allow hourly bins greater than 2 weeks\n if (bin === '1h' && end.getTime() - start.getTime() > ONE_WEEK * 2) {\n throw new Error(\n 'When using bin=1h, start and end time can be no more than 2 weeks apart',\n );\n }\n\n // Pull in the metrics\n const startDate = start.toISOString();\n const endDate = end.toISOString();\n const [privacySignalData, consentChangesData, consentSessionsByRegimeData] =\n await Promise.all([\n fetchConsentManagerAnalyticsData(client, {\n dataSource: 'PRIVACY_SIGNAL_TIMESERIES',\n startDate,\n endDate,\n forceRefetch: true,\n airgapBundleId,\n binInterval: bin,\n smoothTimeseries: false,\n }),\n fetchConsentManagerAnalyticsData(client, {\n dataSource: 'CONSENT_CHANGES_TIMESERIES',\n startDate,\n endDate,\n forceRefetch: true,\n airgapBundleId,\n binInterval: bin,\n smoothTimeseries: false,\n }),\n fetchConsentManagerAnalyticsData(client, {\n dataSource: 'CONSENT_SESSIONS_BY_REGIME',\n startDate,\n endDate,\n forceRefetch: true,\n airgapBundleId,\n binInterval: bin,\n smoothTimeseries: false,\n }),\n ]);\n\n return {\n PRIVACY_SIGNAL_TIMESERIES: privacySignalData,\n CONSENT_CHANGES_TIMESERIES: consentChangesData,\n CONSENT_SESSIONS_BY_REGIME: consentSessionsByRegimeData,\n };\n}\n","/**\n * Convert a domain to host\n *\n * @param domain - e.g. test.acme.com\n * @returns Host acme.com\n */\nexport const domainToHost = (domain: string): string =>\n new URL(`https://${domain}`).hostname.split('.').slice(-2).join('.');\n","import colors from 'colors';\n\nimport { buildTranscendGraphQLClient, fetchConsentManager } from '../graphql';\nimport { difference } from 'lodash-es';\nimport { map } from 'bluebird';\nimport { StoredApiKey } from '../../codecs';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\nimport { logger } from '../../logger';\nimport { domainToHost } from './domainToHost';\n\n/**\n * Sync group configuration mapping\n * e.g.\n * {\n * \"abdb5e78-0d69-4554-a3bd-84b72ca3b3d9\": [\n * \"test.com\"\n * ],\n * \"f6b3ba87-c9df-444f-b420-6fac49e35910\": [\n * \"blue.com\"\n * ]\n * }\n */\nexport type XdiSyncGroups = { [k in string]: string[] };\n\n/** Regular expression for IP addresses - remove these from sync endpoint */\nexport const IP_ADDRESS_REGEX =\n // eslint-disable-next-line max-len\n /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;\n\n/**\n * Build the sync endpoint definition for a set of Transcend accounts\n *\n * @param apiKeys - The API keys that will be used to pull down configurations for\n * @param options - Options\n * @returns The XDI configuration\n */\nexport async function buildXdiSyncEndpoint(\n apiKeys: string | StoredApiKey[],\n {\n xdiLocation,\n transcendUrl = DEFAULT_TRANSCEND_API,\n removeIpAddresses = true,\n domainBlockList = ['localhost'],\n xdiAllowedCommands = 'ConsentManager:Sync',\n }: {\n /** The file location where the XDI file is hosted */\n xdiLocation: string;\n /** URL of Transcend API */\n transcendUrl?: string;\n /** When true, remove IP addresses (defaults to true) */\n removeIpAddresses?: boolean;\n /** Block list of domains to omit from sync endpoint - includes `localhost` by default */\n domainBlockList?: string[];\n /** Allows XDI commands */\n xdiAllowedCommands?: string;\n },\n): Promise<{\n /** Sync group configurations */\n syncGroups: XdiSyncGroups;\n /** The HTML string */\n html: string;\n}> {\n // Convert API keys to list\n const apiKeysAsList = Array.isArray(apiKeys)\n ? apiKeys\n : [{ apiKey: apiKeys, organizationId: '', organizationName: '' }];\n\n // Fetch configuration for each account\n const consentManagers = await map(\n apiKeysAsList,\n async (apiKey) => {\n logger.info(\n colors.magenta(\n `Pulling consent metadata for organization - ${apiKey.organizationName}`,\n ),\n );\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKey.apiKey);\n\n // Grab consent manager\n const consentManager = await fetchConsentManager(client);\n return consentManager;\n },\n { concurrency: 5 },\n );\n\n // construct the sync groups\n const syncGroups: XdiSyncGroups = {};\n consentManagers.forEach((consentManager) => {\n // grab the partition key\n const partitionKey =\n // take explicit key first\n consentManager.partition?.partition ||\n // fallback to bundle ID\n consentManager.bundleURL.split('/').reverse()[1];\n\n // Ensure that partition exists in the sync groups\n if (!syncGroups[partitionKey]) {\n syncGroups[partitionKey] = [];\n }\n\n // Map domain list to a host list\n const hosts = difference(\n consentManager.configuration.domains\n .filter(\n // ignore IP addresses\n (domain) => !removeIpAddresses || !IP_ADDRESS_REGEX.test(domain),\n )\n .map((domain) => domainToHost(domain)),\n // ignore block list\n domainBlockList,\n );\n // merge existing sync group with hosts for this consent manager\n syncGroups[partitionKey] = [\n ...new Set([...(syncGroups[partitionKey] || []), ...hosts]),\n ];\n });\n\n // Construct the HTML\n const syncEndpointHtml = `\n<!DOCTYPE html>\n<script\nsrc=\"${xdiLocation}\"\ndata-sync-groups='${JSON.stringify(syncGroups, null, 2)}'\ndata-xdi-commands=\"${xdiAllowedCommands}\"\n></script>\n`;\n\n return {\n html: syncEndpointHtml,\n syncGroups,\n };\n}\n","import { BusinessEntityInput, ConsentManagerInput } from '../../codecs';\nimport { logger } from '../../logger';\n\n/**\n * Combine multiple consent manager configurations into a list of business entity configurations\n *\n * @param inputs - Consent manager configurations to combine\n * @returns Business entity configuration input\n */\nexport function consentManagersToBusinessEntities(\n inputs: {\n /** Name of business entity */\n name: string;\n /** Consent manager input */\n input?: ConsentManagerInput;\n }[],\n): BusinessEntityInput[] {\n // Construct the business entities YAML definition\n const businessEntities = inputs.map(\n ({ name, input }): BusinessEntityInput => ({\n // Title of Transcend Instance\n title: name.replace('.yml', ''),\n attributes: [\n // Sync domain list\n ...(input?.domains\n ? [\n {\n key: 'Transcend Domain List',\n values: [...new Set(input.domains)],\n },\n ]\n : []),\n // Sync bundle URLs\n ...(input?.bundleUrls\n ? [\n {\n key: 'Airgap Production URL',\n values: [input.bundleUrls.PRODUCTION],\n },\n {\n key: 'Airgap Test URL',\n values: [input.bundleUrls.TEST],\n },\n {\n key: 'Airgap XDI URL',\n values: [\n input.bundleUrls.PRODUCTION.replace('airgap.js', 'xdi.js'),\n ],\n },\n ]\n : []),\n // Sync partition keys\n ...(input?.partition\n ? [\n {\n key: 'Consent Partition Key',\n values: [input.partition],\n },\n ]\n : []),\n ],\n }),\n );\n\n // Log out info on airgap scripts to host\n logger.info('\\n\\n~~~~~~~~~~~\\nAirgap scripts to host:');\n businessEntities.forEach(({ attributes, title }, ind) => {\n attributes\n ?.find((attr) => attr.key === 'Airgap Production URL')\n ?.values?.forEach((url) => {\n logger.info(`${ind}) ${title} - ${url}`);\n });\n });\n\n return businessEntities;\n}\n","import * as t from 'io-ts';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport type { Got } from 'got';\nimport { ConsentPreferenceFetch } from './types';\n\nexport const ConsentPreferenceResponse = t.intersection([\n t.type({\n nodes: t.array(ConsentPreferenceFetch),\n }),\n t.partial({\n lastKey: t.partial({\n userId: t.string,\n partition: t.string,\n timestamp: t.string,\n }),\n }),\n]);\n\n/** Type override */\nexport type ConsentPreferenceResponse = t.TypeOf<\n typeof ConsentPreferenceResponse\n>;\n\n/**\n * Fetch consent preferences for the managed consent database\n *\n * @param sombra - Sombra instance configured to make requests\n * @param options - Additional options\n * @returns The consent preferences\n */\nexport async function fetchConsentPreferences(\n sombra: Got,\n {\n partition,\n filterBy = {},\n limit = 50,\n }: {\n /** Partition key to fetch */\n partition: string;\n /** Filter consent preferences */\n filterBy?: {\n /** Fetch specific identifiers */\n identifiers?: string[];\n /** Filter before timestamp */\n timestampBefore?: string;\n /** Filter after timestamp */\n timestampAfter?: string;\n };\n /** Number of items to pull back at once */\n limit?: number;\n },\n): Promise<ConsentPreferenceFetch[]> {\n let currentLastKey: ConsentPreferenceResponse['lastKey'];\n const data: ConsentPreferenceFetch[] = [];\n let shouldContinue = true;\n\n while (shouldContinue) {\n const response = await sombra\n .post('v1/consent-preferences', {\n json: {\n partition,\n ...filterBy,\n // using lastKey to paginate if it exists (will not for first iteration)\n startKey: currentLastKey || undefined,\n limit,\n },\n })\n .json();\n const { nodes, lastKey } = decodeCodec(ConsentPreferenceResponse, response);\n\n if (!nodes || nodes.length === 0) {\n break;\n }\n\n // Process the data received from the API call\n // For example, push the new data into an array\n data.push(...nodes);\n\n // Extract the lastKey from the API response\n currentLastKey = lastKey;\n shouldContinue = !!lastKey && Object.keys(lastKey).length > 0;\n }\n\n return data;\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/cli/cli/dist/chunk-VXJ3QION.cjs","../src/lib/consent-manager/updateConsentManagerVersionToLatest.ts","../src/lib/consent-manager/uploadDataFlowsFromCsv.ts","../src/lib/consent-manager/uploadCookiesFromCsv.ts","../src/lib/consent-manager/pullConsentManagerMetrics.ts","../src/lib/consent-manager/domainToHost.ts","../src/lib/consent-manager/buildXdiSyncEndpoint.ts","../src/lib/consent-manager/consentManagersToBusinessEntities.ts","../src/lib/consent-manager/fetchConsentPreferences.ts"],"names":["updateConsentManagerVersionToLatest","auth","deploy","transcendUrl","DEFAULT_TRANSCEND_API","bundleTypes","ConsentBundleType","client","buildTranscendGraphQLClient","consentManagerId","fetchConsentManagerId","mapSeries","bundleType","logger","colors","updateConsentManagerToLatest","deployConsentManager","OMIT_COLUMNS","uploadDataFlowsFromCsv","trackerStatus","file","classifyService","validatedDataFlowInputs","readCsv","DataFlowCsvInput","Type","Notes","Service","Purpose","Status","Owners","Teams","value","rest","splitCsvToList","key","syncDataFlows","uploadCookiesFromCsv","validatedCookieInputs","CookieCsvInput","isRegex","Name","syncCookies","ONE_SECOND","ONE_MINUTE","ONE_HOUR","ONE_DAY","ONE_WEEK","pullConsentManagerMetrics","bin","start","end","airgapBundleId","startTime","endTime","startDate","endDate","privacySignalData","consentChangesData","consentSessionsByRegimeData","fetchConsentManagerAnalyticsData","domainToHost","domain"],"mappings":"AAAA,u/BAAwC,wDAAkD,wDAAkH,wDAAyC,wDAAgD,2DCAnQ,oCACR,gFAOP,MAUnB,SAAsBA,EAAAA,CAAoC,CACxD,IAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CAAS,CAAA,CAAA,CACT,YAAA,CAAAC,CAAAA,CAAeC,mBAAAA,CACf,WAAA,CAAAC,CAAAA,CAAc,MAAA,CAAO,MAAA,CAAOC,+BAAiB,CAC/C,CAAA,CASkB,CAEhB,IAAMC,CAAA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CAAc,CAAA,CAAA,CACd,cAAA,CAAAJ,CAAAA,CACA,WAAA,CAAaH,CAAAA,CACb,gBAAA,CAAkB,CAAA,CACpB,CAAC,CACH,CAAC,CAAA,CAEH,MAAO,CACL,yBAAA,CAA2BQ,CAAAA,CAC3B,0BAAA,CAA4BC,CAAAA,CAC5B,0BAAA,CAA4BC,CAC9B,CACF,CChGO,IAAME,CAAAA,CAAgBC,CAAAA,EAC3B,IAAI,GAAA,CAAI,CAAA,QAAA,EAAWA,CAAM,CAAA,CAAA;ACiHA;AAAA;AAGT,KAAA;AACqC,kBAAA;AAChB,mBAAA;AAAA;AC5DzB;AAAA;AAAA;ACmBd,uBAAA","file":"/home/runner/work/cli/cli/dist/chunk-VXJ3QION.cjs","sourcesContent":[null,"import { ConsentBundleType } from '@transcend-io/privacy-types';\nimport { mapSeries } from 'bluebird';\nimport {\n updateConsentManagerToLatest,\n buildTranscendGraphQLClient,\n fetchConsentManagerId,\n deployConsentManager,\n} from '../graphql';\nimport colors from 'colors';\n\nimport { logger } from '../../logger';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\n\n/**\n * Update the consent manager to latest version\n *\n * @param options - Options\n */\nexport async function updateConsentManagerVersionToLatest({\n auth,\n deploy = false,\n transcendUrl = DEFAULT_TRANSCEND_API,\n bundleTypes = Object.values(ConsentBundleType),\n}: {\n /** Transcend API key authentication */\n auth: string;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** Deploy consent manager with this update */\n deploy?: boolean;\n /** The bundle types to update and deploy */\n bundleTypes?: ConsentBundleType[];\n}): Promise<void> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Grab Consent Manager ID\n const consentManagerId = await fetchConsentManagerId(client);\n\n // Update each bundle type to latest version\n await mapSeries(bundleTypes, async (bundleType) => {\n logger.info(\n colors.magenta(\n `Update Consent Manager bundle with ID \"${consentManagerId}\" and type \"${bundleType}\" to latest version...`,\n ),\n );\n await updateConsentManagerToLatest(client, {\n id: consentManagerId,\n bundleType,\n });\n logger.info(\n colors.green(\n `Updated Consent Manager bundle with ID \"${consentManagerId}\" and type \"${bundleType}\" to latest version!`,\n ),\n );\n });\n\n // deploy Consent Managers\n if (deploy) {\n // Update each bundle type to latest version\n await mapSeries(bundleTypes, async (bundleType) => {\n logger.info(\n colors.magenta(\n `Deploying Consent Manager bundle with ID \"${consentManagerId}\" and type \"${bundleType}\"...`,\n ),\n );\n await deployConsentManager(client, {\n id: consentManagerId,\n bundleType,\n });\n logger.info(\n colors.green(\n `Deployed Consent Manager bundle with ID \"${consentManagerId}\" and type \"${bundleType}\"!`,\n ),\n );\n });\n }\n}\n","import colors from 'colors';\nimport { logger } from '../../logger';\nimport { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, syncDataFlows } from '../graphql';\nimport { readCsv } from '../requests/readCsv';\nimport { DataFlowInput, DataFlowCsvInput } from '../../codecs';\nimport { splitCsvToList } from '../requests';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\n\nconst OMIT_COLUMNS = [\n 'ID',\n 'Activity',\n 'Encounters',\n 'Last Seen At',\n 'Has Native Do Not Sell/Share Support',\n 'IAB USP API Support',\n 'Service Description',\n 'Website URL',\n 'Categories of Recipients',\n];\n\n/**\n * Upload a set of data flows from CSV\n *\n * @param options - Options\n */\nexport async function uploadDataFlowsFromCsv({\n auth,\n trackerStatus,\n file,\n classifyService = false,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** Sombra API key authentication */\n trackerStatus: ConsentTrackerStatus;\n /** classify data flow service if missing */\n classifyService?: boolean;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<void> {\n // Build a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read from CSV the set of data flow inputs\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const dataFlowInputs = readCsv(file, DataFlowCsvInput);\n\n // Convert these data flow inputs into a format that the other function can use\n const validatedDataFlowInputs = dataFlowInputs.map(\n ({\n Type,\n Notes,\n // TODO: https://transcend.height.app/T-26391 - export in CSV\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n Service,\n Purpose,\n Status,\n Owners,\n Teams,\n 'Connections Made To': value,\n ...rest\n }): DataFlowInput => ({\n value,\n type: Type,\n description: Notes,\n trackingPurposes: splitCsvToList(Purpose),\n // TODO: https://transcend.height.app/T-26391\n // service: Service,\n // Apply the trackerStatus to all values in the CSV -> allows for customer to define tracker status\n // on a row by row basis if needed\n status: Status || trackerStatus,\n owners: Owners ? splitCsvToList(Owners) : undefined,\n teams: Teams ? splitCsvToList(Teams) : undefined,\n // all remaining options are attribute\n attributes: Object.entries(rest)\n // filter out native columns that are exported from the admin dashboard\n // but not custom attributes\n .filter(([key]) => !OMIT_COLUMNS.includes(key))\n .map(([key, value]) => ({\n key,\n values: splitCsvToList(value),\n })),\n }),\n );\n\n // Upload the data flows into Transcend dashboard\n const syncedDataFlows = await syncDataFlows(\n client,\n validatedDataFlowInputs,\n classifyService,\n );\n\n // Log errors\n if (!syncedDataFlows) {\n logger.error(\n colors.red(\n 'Encountered error(s) syncing data flows from CSV, see logs above for more info. ',\n ),\n );\n process.exit(1);\n }\n}\n","import colors from 'colors';\nimport { logger } from '../../logger';\nimport { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, syncCookies } from '../graphql';\nimport { readCsv } from '../requests/readCsv';\nimport { CookieInput, CookieCsvInput } from '../../codecs';\nimport { splitCsvToList } from '../requests';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\n\nconst OMIT_COLUMNS = [\n 'ID',\n 'Activity',\n 'Encounters',\n 'Last Seen At',\n 'Has Native Do Not Sell/Share Support',\n 'IAB USP API Support',\n 'Service Description',\n 'Website URL',\n 'Categories of Recipients',\n];\n\n/**\n * Upload a set of cookies from CSV\n *\n * @param options - Options\n */\nexport async function uploadCookiesFromCsv({\n auth,\n trackerStatus,\n file,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** Sombra API key authentication */\n trackerStatus: ConsentTrackerStatus;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<void> {\n // Build a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read from CSV the set of cookie inputs\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const cookieInputs = readCsv(file, CookieCsvInput);\n\n // Convert these inputs into a format that the other function can use\n const validatedCookieInputs = cookieInputs.map(\n ({\n 'Is Regex?': isRegex,\n Notes,\n // TODO: https://transcend.height.app/T-26391 - export in CSV\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n Service,\n Purpose,\n Status,\n Owners,\n Teams,\n Name,\n ...rest\n }): CookieInput => ({\n ...(typeof isRegex === 'string'\n ? { isRegex: isRegex.toLowerCase() === 'true' }\n : {}),\n name: Name,\n description: Notes,\n trackingPurposes: splitCsvToList(Purpose),\n // TODO: https://transcend.height.app/T-26391\n // service: Service,\n // Apply the trackerStatus to all values in the CSV -> allows for customer to define tracker status\n // on a row by row basis if needed\n status: Status || trackerStatus,\n owners: Owners ? splitCsvToList(Owners) : undefined,\n teams: Teams ? splitCsvToList(Teams) : undefined,\n // all remaining options are attribute\n attributes: Object.entries(rest)\n // filter out native columns that are exported from the admin dashboard\n // but not custom attributes\n .filter(([key]) => !OMIT_COLUMNS.includes(key))\n .map(([key, value]) => ({\n key,\n values: splitCsvToList(value),\n })),\n }),\n );\n\n // Upload the cookies into Transcend dashboard\n const syncedCookies = await syncCookies(client, validatedCookieInputs);\n\n // Log errors\n if (!syncedCookies) {\n logger.error(\n colors.red(\n 'Encountered error(s) syncing cookies from CSV, see logs above for more info. ',\n ),\n );\n process.exit(1);\n }\n}\n","import type { GraphQLClient } from 'graphql-request';\nimport {\n ConsentManagerMetric,\n ConsentManagerMetricBin,\n fetchConsentManagerAnalyticsData,\n fetchConsentManagerId,\n} from '../graphql';\n\n/**\n * One second of time in ms\n */\nconst ONE_SECOND = 1000;\nconst ONE_MINUTE = 60 * ONE_SECOND;\nconst ONE_HOUR = 60 * ONE_MINUTE;\nconst ONE_DAY = 24 * ONE_HOUR;\nconst ONE_WEEK = 7 * ONE_DAY;\n\n/**\n * Pull consent manager metrics in an organization\n *\n * @param client - GraphQL client\n * @param options - Options\n * @returns The consent manager metrics\n */\nexport async function pullConsentManagerMetrics(\n client: GraphQLClient,\n {\n bin,\n start,\n end = new Date(),\n }: {\n /** Start date to pull metrics from */\n start: Date;\n /** End date to pull metrics from (assumes now) */\n end?: Date;\n /** Bin size to pull metrics */\n bin: ConsentManagerMetricBin;\n },\n): Promise<{\n /** Privacy signal data */\n PRIVACY_SIGNAL_TIMESERIES: ConsentManagerMetric[];\n /** Consent changes data */\n CONSENT_CHANGES_TIMESERIES: ConsentManagerMetric[];\n /** Consent sessions by regime */\n CONSENT_SESSIONS_BY_REGIME: ConsentManagerMetric[];\n}> {\n // Grab the bundleId associated with this API key\n const airgapBundleId = await fetchConsentManagerId(client);\n\n // convert start and end to times\n const startTime = Math.floor(start.getTime() / 1000);\n const endTime = Math.floor(end.getTime() / 1000);\n if (startTime > endTime) {\n throw new Error('Received \"end\" date that happened before \"start\" date');\n }\n\n // do not allow hourly bins greater than 2 weeks\n if (bin === '1h' && end.getTime() - start.getTime() > ONE_WEEK * 2) {\n throw new Error(\n 'When using bin=1h, start and end time can be no more than 2 weeks apart',\n );\n }\n\n // Pull in the metrics\n const startDate = start.toISOString();\n const endDate = end.toISOString();\n const [privacySignalData, consentChangesData, consentSessionsByRegimeData] =\n await Promise.all([\n fetchConsentManagerAnalyticsData(client, {\n dataSource: 'PRIVACY_SIGNAL_TIMESERIES',\n startDate,\n endDate,\n forceRefetch: true,\n airgapBundleId,\n binInterval: bin,\n smoothTimeseries: false,\n }),\n fetchConsentManagerAnalyticsData(client, {\n dataSource: 'CONSENT_CHANGES_TIMESERIES',\n startDate,\n endDate,\n forceRefetch: true,\n airgapBundleId,\n binInterval: bin,\n smoothTimeseries: false,\n }),\n fetchConsentManagerAnalyticsData(client, {\n dataSource: 'CONSENT_SESSIONS_BY_REGIME',\n startDate,\n endDate,\n forceRefetch: true,\n airgapBundleId,\n binInterval: bin,\n smoothTimeseries: false,\n }),\n ]);\n\n return {\n PRIVACY_SIGNAL_TIMESERIES: privacySignalData,\n CONSENT_CHANGES_TIMESERIES: consentChangesData,\n CONSENT_SESSIONS_BY_REGIME: consentSessionsByRegimeData,\n };\n}\n","/**\n * Convert a domain to host\n *\n * @param domain - e.g. test.acme.com\n * @returns Host acme.com\n */\nexport const domainToHost = (domain: string): string =>\n new URL(`https://${domain}`).hostname.split('.').slice(-2).join('.');\n","import colors from 'colors';\n\nimport { buildTranscendGraphQLClient, fetchConsentManager } from '../graphql';\nimport { difference } from 'lodash-es';\nimport { map } from 'bluebird';\nimport { StoredApiKey } from '../../codecs';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\nimport { logger } from '../../logger';\nimport { domainToHost } from './domainToHost';\n\n/**\n * Sync group configuration mapping\n * e.g.\n * {\n * \"abdb5e78-0d69-4554-a3bd-84b72ca3b3d9\": [\n * \"test.com\"\n * ],\n * \"f6b3ba87-c9df-444f-b420-6fac49e35910\": [\n * \"blue.com\"\n * ]\n * }\n */\nexport type XdiSyncGroups = { [k in string]: string[] };\n\n/** Regular expression for IP addresses - remove these from sync endpoint */\nexport const IP_ADDRESS_REGEX =\n // eslint-disable-next-line max-len\n /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;\n\n/**\n * Build the sync endpoint definition for a set of Transcend accounts\n *\n * @param apiKeys - The API keys that will be used to pull down configurations for\n * @param options - Options\n * @returns The XDI configuration\n */\nexport async function buildXdiSyncEndpoint(\n apiKeys: string | StoredApiKey[],\n {\n xdiLocation,\n transcendUrl = DEFAULT_TRANSCEND_API,\n removeIpAddresses = true,\n domainBlockList = ['localhost'],\n xdiAllowedCommands = 'ConsentManager:Sync',\n }: {\n /** The file location where the XDI file is hosted */\n xdiLocation: string;\n /** URL of Transcend API */\n transcendUrl?: string;\n /** When true, remove IP addresses (defaults to true) */\n removeIpAddresses?: boolean;\n /** Block list of domains to omit from sync endpoint - includes `localhost` by default */\n domainBlockList?: string[];\n /** Allows XDI commands */\n xdiAllowedCommands?: string;\n },\n): Promise<{\n /** Sync group configurations */\n syncGroups: XdiSyncGroups;\n /** The HTML string */\n html: string;\n}> {\n // Convert API keys to list\n const apiKeysAsList = Array.isArray(apiKeys)\n ? apiKeys\n : [{ apiKey: apiKeys, organizationId: '', organizationName: '' }];\n\n // Fetch configuration for each account\n const consentManagers = await map(\n apiKeysAsList,\n async (apiKey) => {\n logger.info(\n colors.magenta(\n `Pulling consent metadata for organization - ${apiKey.organizationName}`,\n ),\n );\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKey.apiKey);\n\n // Grab consent manager\n const consentManager = await fetchConsentManager(client);\n return consentManager;\n },\n { concurrency: 5 },\n );\n\n // construct the sync groups\n const syncGroups: XdiSyncGroups = {};\n consentManagers.forEach((consentManager) => {\n // grab the partition key\n const partitionKey =\n // take explicit key first\n consentManager.partition?.partition ||\n // fallback to bundle ID\n consentManager.bundleURL.split('/').reverse()[1];\n\n // Ensure that partition exists in the sync groups\n if (!syncGroups[partitionKey]) {\n syncGroups[partitionKey] = [];\n }\n\n // Map domain list to a host list\n const hosts = difference(\n consentManager.configuration.domains\n .filter(\n // ignore IP addresses\n (domain) => !removeIpAddresses || !IP_ADDRESS_REGEX.test(domain),\n )\n .map((domain) => domainToHost(domain)),\n // ignore block list\n domainBlockList,\n );\n // merge existing sync group with hosts for this consent manager\n syncGroups[partitionKey] = [\n ...new Set([...(syncGroups[partitionKey] || []), ...hosts]),\n ];\n });\n\n // Construct the HTML\n const syncEndpointHtml = `\n<!DOCTYPE html>\n<script\nsrc=\"${xdiLocation}\"\ndata-sync-groups='${JSON.stringify(syncGroups, null, 2)}'\ndata-xdi-commands=\"${xdiAllowedCommands}\"\n></script>\n`;\n\n return {\n html: syncEndpointHtml,\n syncGroups,\n };\n}\n","import { BusinessEntityInput, ConsentManagerInput } from '../../codecs';\nimport { logger } from '../../logger';\n\n/**\n * Combine multiple consent manager configurations into a list of business entity configurations\n *\n * @param inputs - Consent manager configurations to combine\n * @returns Business entity configuration input\n */\nexport function consentManagersToBusinessEntities(\n inputs: {\n /** Name of business entity */\n name: string;\n /** Consent manager input */\n input?: ConsentManagerInput;\n }[],\n): BusinessEntityInput[] {\n // Construct the business entities YAML definition\n const businessEntities = inputs.map(\n ({ name, input }): BusinessEntityInput => ({\n // Title of Transcend Instance\n title: name.replace('.yml', ''),\n attributes: [\n // Sync domain list\n ...(input?.domains\n ? [\n {\n key: 'Transcend Domain List',\n values: [...new Set(input.domains)],\n },\n ]\n : []),\n // Sync bundle URLs\n ...(input?.bundleUrls\n ? [\n {\n key: 'Airgap Production URL',\n values: [input.bundleUrls.PRODUCTION],\n },\n {\n key: 'Airgap Test URL',\n values: [input.bundleUrls.TEST],\n },\n {\n key: 'Airgap XDI URL',\n values: [\n input.bundleUrls.PRODUCTION.replace('airgap.js', 'xdi.js'),\n ],\n },\n ]\n : []),\n // Sync partition keys\n ...(input?.partition\n ? [\n {\n key: 'Consent Partition Key',\n values: [input.partition],\n },\n ]\n : []),\n ],\n }),\n );\n\n // Log out info on airgap scripts to host\n logger.info('\\n\\n~~~~~~~~~~~\\nAirgap scripts to host:');\n businessEntities.forEach(({ attributes, title }, ind) => {\n attributes\n ?.find((attr) => attr.key === 'Airgap Production URL')\n ?.values?.forEach((url) => {\n logger.info(`${ind}) ${title} - ${url}`);\n });\n });\n\n return businessEntities;\n}\n","import * as t from 'io-ts';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport type { Got } from 'got';\nimport { ConsentPreferenceFetch } from './types';\n\nexport const ConsentPreferenceResponse = t.intersection([\n t.type({\n nodes: t.array(ConsentPreferenceFetch),\n }),\n t.partial({\n lastKey: t.partial({\n userId: t.string,\n partition: t.string,\n timestamp: t.string,\n }),\n }),\n]);\n\n/** Type override */\nexport type ConsentPreferenceResponse = t.TypeOf<\n typeof ConsentPreferenceResponse\n>;\n\n/**\n * Fetch consent preferences for the managed consent database\n *\n * @param sombra - Sombra instance configured to make requests\n * @param options - Additional options\n * @returns The consent preferences\n */\nexport async function fetchConsentPreferences(\n sombra: Got,\n {\n partition,\n filterBy = {},\n limit = 50,\n }: {\n /** Partition key to fetch */\n partition: string;\n /** Filter consent preferences */\n filterBy?: {\n /** Fetch specific identifiers */\n identifiers?: string[];\n /** Filter before timestamp */\n timestampBefore?: string;\n /** Filter after timestamp */\n timestampAfter?: string;\n };\n /** Number of items to pull back at once */\n limit?: number;\n },\n): Promise<ConsentPreferenceFetch[]> {\n let currentLastKey: ConsentPreferenceResponse['lastKey'];\n const data: ConsentPreferenceFetch[] = [];\n let shouldContinue = true;\n\n while (shouldContinue) {\n const response = await sombra\n .post('v1/consent-preferences', {\n json: {\n partition,\n ...filterBy,\n // using lastKey to paginate if it exists (will not for first iteration)\n startKey: currentLastKey || undefined,\n limit,\n },\n })\n .json();\n const { nodes, lastKey } = decodeCodec(ConsentPreferenceResponse, response);\n\n if (!nodes || nodes.length === 0) {\n break;\n }\n\n // Process the data received from the API call\n // For example, push the new data into an array\n data.push(...nodes);\n\n // Extract the lastKey from the API response\n currentLastKey = lastKey;\n shouldContinue = !!lastKey && Object.keys(lastKey).length > 0;\n }\n\n return data;\n}\n"]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkYYYG72XHcjs = require('./chunk-YYYG72XH.cjs');require('./chunk-E3HBS2DS.cjs');var _chunkLR3CPNDMcjs = require('./chunk-LR3CPNDM.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunkEMB64AC3cjs = require('./chunk-EMB64AC3.cjs');require('./chunk-LCDYXJN6.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunk4U57O4PScjs = require('./chunk-4U57O4PS.cjs');require('./chunk-Q7I37FJV.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);async function j({auth:p,file:o,transcendUrl:f,dataSiloIds:g,subCategories:C,status:S,includeEncryptedSnippets:n}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);try{let s=_chunkEMB64AC3cjs.vc.call(void 0, f,p),b=await _chunkYYYG72XHcjs.b.call(void 0, s,{dataSiloIds:g,subCategories:C,status:S,includeEncryptedSnippets:n});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Writing unstructured discovery files to file "${o}"...`));let i=[],h=b.map(t=>{let a={"Entry ID":t.id,"Data Silo ID":t.dataSiloId,"Object Path ID":t.scannedObjectPathId,"Object ID":t.scannedObjectId,...n?{Entry:t.name,"Context Snippet":t.contextSnippet}:{},"Data Category":`${t.dataSubCategory.category}:${t.dataSubCategory.name}`,"Classification Status":t.status,"Confidence Score":t.confidence,"Classification Method":t.classificationMethod,"Classifier Version":t.classifierVersion};return i=_chunk4U57O4PScjs.j.call(void 0, [...i,...Object.keys(a)]),a});_chunkLR3CPNDMcjs.c.call(void 0, o,h,i)}catch(s){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`An error occurred syncing the unstructured discovery files: ${s.message}`)),this.process.exit(1)}_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced unstructured discovery files to disk at ${o}!`))}exports.pullUnstructuredDiscoveryFiles = j;
2
- //# sourceMappingURL=impl-CW4P3FBU.cjs.map
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkUW2YF6JMcjs = require('./chunk-UW2YF6JM.cjs');require('./chunk-5CDEM565.cjs');var _chunkLR3CPNDMcjs = require('./chunk-LR3CPNDM.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunkJEH3FW7Jcjs = require('./chunk-JEH3FW7J.cjs');require('./chunk-LCDYXJN6.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkOFZ7ZSEVcjs = require('./chunk-OFZ7ZSEV.cjs');require('./chunk-Q7I37FJV.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);async function j({auth:p,file:o,transcendUrl:f,dataSiloIds:g,subCategories:C,status:S,includeEncryptedSnippets:n}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);try{let s=_chunkJEH3FW7Jcjs.vc.call(void 0, f,p),b=await _chunkUW2YF6JMcjs.b.call(void 0, s,{dataSiloIds:g,subCategories:C,status:S,includeEncryptedSnippets:n});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Writing unstructured discovery files to file "${o}"...`));let i=[],h=b.map(t=>{let a={"Entry ID":t.id,"Data Silo ID":t.dataSiloId,"Object Path ID":t.scannedObjectPathId,"Object ID":t.scannedObjectId,...n?{Entry:t.name,"Context Snippet":t.contextSnippet}:{},"Data Category":`${t.dataSubCategory.category}:${t.dataSubCategory.name}`,"Classification Status":t.status,"Confidence Score":t.confidence,"Classification Method":t.classificationMethod,"Classifier Version":t.classifierVersion};return i=_chunkOFZ7ZSEVcjs.j.call(void 0, [...i,...Object.keys(a)]),a});_chunkLR3CPNDMcjs.c.call(void 0, o,h,i)}catch(s){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`An error occurred syncing the unstructured discovery files: ${s.message}`)),this.process.exit(1)}_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced unstructured discovery files to disk at ${o}!`))}exports.pullUnstructuredDiscoveryFiles = j;
2
+ //# sourceMappingURL=impl-3THXGCQP.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-CW4P3FBU.cjs","../src/commands/inventory/pull-unstructured-discovery-files/impl.ts"],"names":["pullUnstructuredDiscoveryFiles","auth","file","transcendUrl","dataSiloIds","subCategories","status","includeEncryptedSnippets","doneInputValidation","client","buildTranscendGraphQLClient","entries","pullUnstructuredSubDataPointRecommendations","logger","colors","headers","inputs","entry","result"],"mappings":"AAAA,iOAAwC,gCAA6B,wDAAyC,wDAAyC,wDAA0C,gCAA6B,wDAAyC,wDAAyC,gCAA6B,gFCE1T,MAkBnB,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,wBAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,GAAI,CAEF,IAAMC,CAAAA,CAASC,kCAAAA,CAA4BP,CAAcF,CAAI,CAAA,CAEvDU,CAAAA,CAAU,MAAMC,iCAAAA,CAA4CH,CAAQ,CACxE,WAAA,CAAAL,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,wBAAA,CAAAC,CACF,CAAC,CAAA,CAEDM,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,OAAA,CACL,CAAA,8CAAA,EAAiDZ,CAAI,CAAA,IAAA,CACvD,CACF,CAAA,CACA,IAAIa,CAAAA,CAAoB,CAAC,CAAA,CACnBC,CAAAA,CAASL,CAAAA,CAAQ,GAAA,CAAKM,CAAAA,EAAU,CACpC,IAAMC,CAAAA,CAAS,CACb,UAAA,CAAYD,CAAAA,CAAM,EAAA,CAClB,cAAA,CAAgBA,CAAAA,CAAM,UAAA,CACtB,gBAAA,CAAkBA,CAAAA,CAAM,mBAAA,CACxB,WAAA,CAAaA,CAAAA,CAAM,eAAA,CACnB,GAAIV,CAAAA,CACA,CAAE,KAAA,CAAOU,CAAAA,CAAM,IAAA,CAAM,iBAAA,CAAmBA,CAAAA,CAAM,cAAe,CAAA,CAC7D,CAAC,CAAA,CACL,eAAA,CAAiB,CAAA,EAAA","file":"/home/runner/work/cli/cli/dist/impl-CW4P3FBU.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport type { UnstructuredSubDataPointRecommendationStatus } from '@transcend-io/privacy-types';\nimport colors from 'colors';\nimport { uniq } from 'lodash-es';\nimport { writeCsv } from '../../../lib/cron';\nimport { pullUnstructuredSubDataPointRecommendations } from '../../../lib/data-inventory';\nimport { buildTranscendGraphQLClient } from '../../../lib/graphql';\nimport { logger } from '../../../logger';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface PullUnstructuredDiscoveryFilesCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n subCategories?: string[];\n status?: UnstructuredSubDataPointRecommendationStatus[];\n includeEncryptedSnippets: boolean;\n}\n\nexport async function pullUnstructuredDiscoveryFiles(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n dataSiloIds,\n subCategories,\n status,\n includeEncryptedSnippets,\n }: PullUnstructuredDiscoveryFilesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const entries = await pullUnstructuredSubDataPointRecommendations(client, {\n dataSiloIds,\n subCategories, // TODO: https://transcend.height.app/T-40482 - do by name not ID\n status,\n includeEncryptedSnippets,\n });\n\n logger.info(\n colors.magenta(\n `Writing unstructured discovery files to file \"${file}\"...`,\n ),\n );\n let headers: string[] = [];\n const inputs = entries.map((entry) => {\n const result = {\n 'Entry ID': entry.id,\n 'Data Silo ID': entry.dataSiloId,\n 'Object Path ID': entry.scannedObjectPathId,\n 'Object ID': entry.scannedObjectId,\n ...(includeEncryptedSnippets\n ? { Entry: entry.name, 'Context Snippet': entry.contextSnippet }\n : {}),\n 'Data Category': `${entry.dataSubCategory.category}:${entry.dataSubCategory.name}`,\n 'Classification Status': entry.status,\n 'Confidence Score': entry.confidence,\n 'Classification Method': entry.classificationMethod,\n 'Classifier Version': entry.classifierVersion,\n };\n headers = uniq([...headers, ...Object.keys(result)]);\n return result;\n });\n writeCsv(file, inputs, headers);\n } catch (err) {\n logger.error(\n colors.red(\n `An error occurred syncing the unstructured discovery files: ${err.message}`,\n ),\n );\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced unstructured discovery files to disk at ${file}!`,\n ),\n );\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-3THXGCQP.cjs","../src/commands/inventory/pull-unstructured-discovery-files/impl.ts"],"names":["pullUnstructuredDiscoveryFiles","auth","file","transcendUrl","dataSiloIds","subCategories","status","includeEncryptedSnippets","doneInputValidation","client","buildTranscendGraphQLClient","entries","pullUnstructuredSubDataPointRecommendations","logger","colors","headers","inputs","entry","result"],"mappings":"AAAA,iOAAwC,gCAA6B,wDAAyC,wDAAyC,wDAA0C,gCAA6B,wDAAyC,wDAAyC,gCAA6B,gFCE1T,MAkBnB,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,wBAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,GAAI,CAEF,IAAMC,CAAAA,CAASC,kCAAAA,CAA4BP,CAAcF,CAAI,CAAA,CAEvDU,CAAAA,CAAU,MAAMC,iCAAAA,CAA4CH,CAAQ,CACxE,WAAA,CAAAL,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,wBAAA,CAAAC,CACF,CAAC,CAAA,CAEDM,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,OAAA,CACL,CAAA,8CAAA,EAAiDZ,CAAI,CAAA,IAAA,CACvD,CACF,CAAA,CACA,IAAIa,CAAAA,CAAoB,CAAC,CAAA,CACnBC,CAAAA,CAASL,CAAAA,CAAQ,GAAA,CAAKM,CAAAA,EAAU,CACpC,IAAMC,CAAAA,CAAS,CACb,UAAA,CAAYD,CAAAA,CAAM,EAAA,CAClB,cAAA,CAAgBA,CAAAA,CAAM,UAAA,CACtB,gBAAA,CAAkBA,CAAAA,CAAM,mBAAA,CACxB,WAAA,CAAaA,CAAAA,CAAM,eAAA,CACnB,GAAIV,CAAAA,CACA,CAAE,KAAA,CAAOU,CAAAA,CAAM,IAAA,CAAM,iBAAA,CAAmBA,CAAAA,CAAM,cAAe,CAAA,CAC7D,CAAC,CAAA,CACL,eAAA,CAAiB,CAAA,EAAA","file":"/home/runner/work/cli/cli/dist/impl-3THXGCQP.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport type { UnstructuredSubDataPointRecommendationStatus } from '@transcend-io/privacy-types';\nimport colors from 'colors';\nimport { uniq } from 'lodash-es';\nimport { writeCsv } from '../../../lib/cron';\nimport { pullUnstructuredSubDataPointRecommendations } from '../../../lib/data-inventory';\nimport { buildTranscendGraphQLClient } from '../../../lib/graphql';\nimport { logger } from '../../../logger';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface PullUnstructuredDiscoveryFilesCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n subCategories?: string[];\n status?: UnstructuredSubDataPointRecommendationStatus[];\n includeEncryptedSnippets: boolean;\n}\n\nexport async function pullUnstructuredDiscoveryFiles(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n dataSiloIds,\n subCategories,\n status,\n includeEncryptedSnippets,\n }: PullUnstructuredDiscoveryFilesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const entries = await pullUnstructuredSubDataPointRecommendations(client, {\n dataSiloIds,\n subCategories, // TODO: https://transcend.height.app/T-40482 - do by name not ID\n status,\n includeEncryptedSnippets,\n });\n\n logger.info(\n colors.magenta(\n `Writing unstructured discovery files to file \"${file}\"...`,\n ),\n );\n let headers: string[] = [];\n const inputs = entries.map((entry) => {\n const result = {\n 'Entry ID': entry.id,\n 'Data Silo ID': entry.dataSiloId,\n 'Object Path ID': entry.scannedObjectPathId,\n 'Object ID': entry.scannedObjectId,\n ...(includeEncryptedSnippets\n ? { Entry: entry.name, 'Context Snippet': entry.contextSnippet }\n : {}),\n 'Data Category': `${entry.dataSubCategory.category}:${entry.dataSubCategory.name}`,\n 'Classification Status': entry.status,\n 'Confidence Score': entry.confidence,\n 'Classification Method': entry.classificationMethod,\n 'Classifier Version': entry.classifierVersion,\n };\n headers = uniq([...headers, ...Object.keys(result)]);\n return result;\n });\n writeCsv(file, inputs, headers);\n } catch (err) {\n logger.error(\n colors.red(\n `An error occurred syncing the unstructured discovery files: ${err.message}`,\n ),\n );\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced unstructured discovery files to disk at ${file}!`,\n ),\n );\n}\n"]}
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkCVQWA6RNcjs = require('./chunk-CVQWA6RN.cjs');require('./chunk-DQ4R65RB.cjs');require('./chunk-QEM6S2W7.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunkEMB64AC3cjs = require('./chunk-EMB64AC3.cjs');require('./chunk-LCDYXJN6.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunk4U57O4PScjs = require('./chunk-4U57O4PS.cjs');require('./chunk-Q7I37FJV.cjs');var _querystring = require('query-string');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _fastglob = require('fast-glob'); var _fastglob2 = _interopRequireDefault(_fastglob);async function m({scanPath:t,fileGlobs:e,ignoreDirs:g,config:p}){let{ignoreDirs:f,supportedFiles:s,scanFunction:a}=p,n=e===""?s:s.concat(e.split(",")),l=[...g.split(","),...f].filter(o=>o.length>0);try{let o=await _fastglob2.default.call(void 0, `${t}/**/${n.join("|")}`,{ignore:l.map(i=>`${t}/**/${i}`),unique:!0,onlyFiles:!0});_chunkZUNVPK23cjs.a.info(`Scanning: ${o.length} files`);let I=o.map(i=>a(i)).flat().map(i=>i.softwareDevelopmentKits||[]).flat(),d=[...new Set(I.map(i=>i.name))];return _chunkZUNVPK23cjs.a.info(`Found: ${d.length} unique dependencies`),d.map(i=>({name:i,resourceId:`${t}/**/${i}`,useStrictClassifier:!0}))}catch(o){throw new Error(`Error scanning globs ${m} with error: ${o}`)}}async function P({scanPath:t,dataSiloId:e,auth:g,fileGlobs:p,ignoreDirs:f,transcendUrl:s}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);let a=_chunkEMB64AC3cjs.vc.call(void 0, s,g),n=await _chunkEMB64AC3cjs.Ac.call(void 0, a,e),l=_chunkCVQWA6RNcjs.a[n.dataSilo.type];l||(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`This plugin "${n.dataSilo.type}" is not supported for offline silo discovery.`)),this.process.exit(1));let o=await m({scanPath:t,fileGlobs:p,ignoreDirs:f,config:l});await _chunkEMB64AC3cjs.gf.call(void 0, a,n.id,o);let c=new URL(_chunk4U57O4PScjs.o);c.pathname="/data-map/data-inventory/silo-discovery/triage",c.search=_querystring.stringify.call(void 0, {filters:JSON.stringify({pluginIds:[n.id]})}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Scan found ${o.length} potential data silos at ${t}! View at '${c.href}'
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkVGTGGUCMcjs = require('./chunk-VGTGGUCM.cjs');require('./chunk-GVK66NZA.cjs');require('./chunk-QEM6S2W7.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunkJEH3FW7Jcjs = require('./chunk-JEH3FW7J.cjs');require('./chunk-LCDYXJN6.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkOFZ7ZSEVcjs = require('./chunk-OFZ7ZSEV.cjs');require('./chunk-Q7I37FJV.cjs');var _querystring = require('query-string');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _fastglob = require('fast-glob'); var _fastglob2 = _interopRequireDefault(_fastglob);async function m({scanPath:t,fileGlobs:e,ignoreDirs:g,config:p}){let{ignoreDirs:f,supportedFiles:s,scanFunction:a}=p,n=e===""?s:s.concat(e.split(",")),l=[...g.split(","),...f].filter(o=>o.length>0);try{let o=await _fastglob2.default.call(void 0, `${t}/**/${n.join("|")}`,{ignore:l.map(i=>`${t}/**/${i}`),unique:!0,onlyFiles:!0});_chunkZUNVPK23cjs.a.info(`Scanning: ${o.length} files`);let I=o.map(i=>a(i)).flat().map(i=>i.softwareDevelopmentKits||[]).flat(),d=[...new Set(I.map(i=>i.name))];return _chunkZUNVPK23cjs.a.info(`Found: ${d.length} unique dependencies`),d.map(i=>({name:i,resourceId:`${t}/**/${i}`,useStrictClassifier:!0}))}catch(o){throw new Error(`Error scanning globs ${m} with error: ${o}`)}}async function P({scanPath:t,dataSiloId:e,auth:g,fileGlobs:p,ignoreDirs:f,transcendUrl:s}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);let a=_chunkJEH3FW7Jcjs.vc.call(void 0, s,g),n=await _chunkJEH3FW7Jcjs.Ac.call(void 0, a,e),l=_chunkVGTGGUCMcjs.a[n.dataSilo.type];l||(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`This plugin "${n.dataSilo.type}" is not supported for offline silo discovery.`)),this.process.exit(1));let o=await m({scanPath:t,fileGlobs:p,ignoreDirs:f,config:l});await _chunkJEH3FW7Jcjs.jf.call(void 0, a,n.id,o);let c=new URL(_chunkOFZ7ZSEVcjs.o);c.pathname="/data-map/data-inventory/silo-discovery/triage",c.search=_querystring.stringify.call(void 0, {filters:JSON.stringify({pluginIds:[n.id]})}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Scan found ${o.length} potential data silos at ${t}! View at '${c.href}'
2
2
 
3
3
  NOTE: it may take 2-3 minutes for scan results to appear in the UI.`))}exports.discoverSilos = P;
4
- //# sourceMappingURL=impl-L5IP2CI4.cjs.map
4
+ //# sourceMappingURL=impl-43UGCXOQ.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-L5IP2CI4.cjs","../src/commands/inventory/discover-silos/impl.ts","../src/lib/code-scanning/findFilesToScan.ts"],"names":["findFilesToScan","scanPath","fileGlobs","ignoreDirs","config","IGNORE_DIRS","supportedFiles","scanFunction","globsToSupport","dirsToIgnore","dir","filesToScan","fastGlob"],"mappings":"AAAA,iOAAwC,gCAA6B,gCAA6B,wDAAyC,wDAA0D,gCAA6B,wDAAyC,wDAAyC,gCAA6B,2CCCvT,gFAEP,yFCHE,MAsBrB,SAAsBA,CAAAA,CAAgB,CACpC,QAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CACF,CAAA,CASuC,CACrC,GAAM,CAAE,UAAA,CAAYC,CAAAA,CAAa,cAAA,CAAAC,CAAAA,CAAgB,YAAA,CAAAC,CAAa,CAAA,CAAIH,CAAAA,CAC5DI,CAAAA,CACJN,CAAAA,GAAc,EAAA,CACVI,CAAAA,CACAA,CAAAA,CAAe,MAAA,CAAOJ,CAAAA,CAAU,KAAA,CAAM,GAAG,CAAC,CAAA,CAC1CO,CAAAA,CAAe,CAAC,GAAGN,CAAAA,CAAW,KAAA,CAAM,GAAG,CAAA,CAAG,GAAGE,CAAW,CAAA,CAAE,MAAA,CAC7DK,CAAAA,EAAQA,CAAAA,CAAI,MAAA,CAAS,CACxB,CAAA,CACA,GAAI,CACF,IAAMC,CAAAA,CAAwB,MAAMC,gCAAAA,CAClC,EAAA;ADuByB;AAI/B,oEAAA","file":"/home/runner/work/cli/cli/dist/impl-L5IP2CI4.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { stringify } from 'query-string';\nimport { logger } from '../../../logger';\nimport colors from 'colors';\nimport { ADMIN_DASH } from '../../../constants';\nimport {\n fetchActiveSiloDiscoPlugin,\n buildTranscendGraphQLClient,\n uploadSiloDiscoveryResults,\n} from '../../../lib/graphql';\nimport { findFilesToScan } from '../../../lib/code-scanning/findFilesToScan';\nimport { SILO_DISCOVERY_CONFIGS } from '../../../lib/code-scanning';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface DiscoverSilosCommandFlags {\n scanPath: string;\n dataSiloId: string;\n auth: string;\n fileGlobs: string;\n ignoreDirs: string;\n transcendUrl: string;\n}\n\nexport async function discoverSilos(\n this: LocalContext,\n {\n scanPath,\n dataSiloId,\n auth,\n fileGlobs,\n ignoreDirs,\n transcendUrl,\n }: DiscoverSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const plugin = await fetchActiveSiloDiscoPlugin(client, dataSiloId);\n\n const config = SILO_DISCOVERY_CONFIGS[plugin.dataSilo.type];\n if (!config) {\n logger.error(\n colors.red(\n `This plugin \"${plugin.dataSilo.type}\" is not supported for offline silo discovery.`,\n ),\n );\n this.process.exit(1);\n }\n\n const results = await findFilesToScan({\n scanPath,\n fileGlobs,\n ignoreDirs,\n config,\n });\n\n await uploadSiloDiscoveryResults(client, plugin.id, results);\n\n const newUrl = new URL(ADMIN_DASH);\n newUrl.pathname = '/data-map/data-inventory/silo-discovery/triage';\n newUrl.search = stringify({\n filters: JSON.stringify({ pluginIds: [plugin.id] }),\n });\n\n // Indicate success\n logger.info(\n colors.green(\n `Scan found ${results.length} potential data silos at ${scanPath}! ` +\n `View at '${newUrl.href}' ` +\n '\\n\\n NOTE: it may take 2-3 minutes for scan results to appear in the UI.',\n ),\n );\n}\n","import fastGlob from 'fast-glob';\nimport { logger } from '../../logger';\nimport { CodeScanningConfig } from './types';\n\nexport interface SiloDiscoveryRawResults {\n /** The name of the potential data silo entry */\n name: string;\n /** A unique UUID (represents the same resource across different silo discovery runs) */\n resourceId: string;\n /** Any hosts associated with the entry */\n host?: string;\n /** Type of data silo */\n type?: string | undefined;\n}\n\n/**\n * Helper to scan for data silos in all package.json files that it can find in a directory\n *\n * @deprecated TODO: https://transcend.height.app/T-32325 - use code scanning instead\n * @param options - Options\n * @returns the list of integrations\n */\nexport async function findFilesToScan({\n scanPath,\n fileGlobs,\n ignoreDirs,\n config,\n}: {\n /** Where to look for package.json files */\n scanPath: string;\n /** Globs to look for */\n fileGlobs: string;\n /** The directories to ignore (excludes node_modules and serverless-build) */\n ignoreDirs: string;\n /** Silo Discovery configuration */\n config: CodeScanningConfig;\n}): Promise<SiloDiscoveryRawResults[]> {\n const { ignoreDirs: IGNORE_DIRS, supportedFiles, scanFunction } = config;\n const globsToSupport =\n fileGlobs === ''\n ? supportedFiles\n : supportedFiles.concat(fileGlobs.split(','));\n const dirsToIgnore = [...ignoreDirs.split(','), ...IGNORE_DIRS].filter(\n (dir) => dir.length > 0,\n );\n try {\n const filesToScan: string[] = await fastGlob(\n `${scanPath}/**/${globsToSupport.join('|')}`,\n {\n ignore: dirsToIgnore.map((dir: string) => `${scanPath}/**/${dir}`),\n unique: true,\n onlyFiles: true,\n },\n );\n logger.info(`Scanning: ${filesToScan.length} files`);\n const allPackages = filesToScan\n .map((filePath: string) => scanFunction(filePath))\n .flat();\n const allSdks = allPackages\n .map((appPackage) => appPackage.softwareDevelopmentKits || [])\n .flat();\n const uniqueDeps = new Set(allSdks.map((sdk) => sdk.name));\n const deps = [...uniqueDeps];\n logger.info(`Found: ${deps.length} unique dependencies`);\n return deps.map((dep) => ({\n name: dep,\n resourceId: `${scanPath}/**/${dep}`,\n useStrictClassifier: true,\n }));\n } catch (error) {\n throw new Error(\n `Error scanning globs ${findFilesToScan} with error: ${error}`,\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-43UGCXOQ.cjs","../src/commands/inventory/discover-silos/impl.ts","../src/lib/code-scanning/findFilesToScan.ts"],"names":["findFilesToScan","scanPath","fileGlobs","ignoreDirs","config","IGNORE_DIRS","supportedFiles","scanFunction","globsToSupport","dirsToIgnore","dir","filesToScan","fastGlob"],"mappings":"AAAA,iOAAwC,gCAA6B,gCAA6B,wDAAyC,wDAA0D,gCAA6B,wDAAyC,wDAAyC,gCAA6B,2CCCvT,gFAEP,yFCHE,MAsBrB,SAAsBA,CAAAA,CAAgB,CACpC,QAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CACF,CAAA,CASuC,CACrC,GAAM,CAAE,UAAA,CAAYC,CAAAA,CAAa,cAAA,CAAAC,CAAAA,CAAgB,YAAA,CAAAC,CAAa,CAAA,CAAIH,CAAAA,CAC5DI,CAAAA,CACJN,CAAAA,GAAc,EAAA,CACVI,CAAAA,CACAA,CAAAA,CAAe,MAAA,CAAOJ,CAAAA,CAAU,KAAA,CAAM,GAAG,CAAC,CAAA,CAC1CO,CAAAA,CAAe,CAAC,GAAGN,CAAAA,CAAW,KAAA,CAAM,GAAG,CAAA,CAAG,GAAGE,CAAW,CAAA,CAAE,MAAA,CAC7DK,CAAAA,EAAQA,CAAAA,CAAI,MAAA,CAAS,CACxB,CAAA,CACA,GAAI,CACF,IAAMC,CAAAA,CAAwB,MAAMC,gCAAAA,CAClC,EAAA;ADuByB;AAI/B,oEAAA","file":"/home/runner/work/cli/cli/dist/impl-43UGCXOQ.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { stringify } from 'query-string';\nimport { logger } from '../../../logger';\nimport colors from 'colors';\nimport { ADMIN_DASH } from '../../../constants';\nimport {\n fetchActiveSiloDiscoPlugin,\n buildTranscendGraphQLClient,\n uploadSiloDiscoveryResults,\n} from '../../../lib/graphql';\nimport { findFilesToScan } from '../../../lib/code-scanning/findFilesToScan';\nimport { SILO_DISCOVERY_CONFIGS } from '../../../lib/code-scanning';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface DiscoverSilosCommandFlags {\n scanPath: string;\n dataSiloId: string;\n auth: string;\n fileGlobs: string;\n ignoreDirs: string;\n transcendUrl: string;\n}\n\nexport async function discoverSilos(\n this: LocalContext,\n {\n scanPath,\n dataSiloId,\n auth,\n fileGlobs,\n ignoreDirs,\n transcendUrl,\n }: DiscoverSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const plugin = await fetchActiveSiloDiscoPlugin(client, dataSiloId);\n\n const config = SILO_DISCOVERY_CONFIGS[plugin.dataSilo.type];\n if (!config) {\n logger.error(\n colors.red(\n `This plugin \"${plugin.dataSilo.type}\" is not supported for offline silo discovery.`,\n ),\n );\n this.process.exit(1);\n }\n\n const results = await findFilesToScan({\n scanPath,\n fileGlobs,\n ignoreDirs,\n config,\n });\n\n await uploadSiloDiscoveryResults(client, plugin.id, results);\n\n const newUrl = new URL(ADMIN_DASH);\n newUrl.pathname = '/data-map/data-inventory/silo-discovery/triage';\n newUrl.search = stringify({\n filters: JSON.stringify({ pluginIds: [plugin.id] }),\n });\n\n // Indicate success\n logger.info(\n colors.green(\n `Scan found ${results.length} potential data silos at ${scanPath}! ` +\n `View at '${newUrl.href}' ` +\n '\\n\\n NOTE: it may take 2-3 minutes for scan results to appear in the UI.',\n ),\n );\n}\n","import fastGlob from 'fast-glob';\nimport { logger } from '../../logger';\nimport { CodeScanningConfig } from './types';\n\nexport interface SiloDiscoveryRawResults {\n /** The name of the potential data silo entry */\n name: string;\n /** A unique UUID (represents the same resource across different silo discovery runs) */\n resourceId: string;\n /** Any hosts associated with the entry */\n host?: string;\n /** Type of data silo */\n type?: string | undefined;\n}\n\n/**\n * Helper to scan for data silos in all package.json files that it can find in a directory\n *\n * @deprecated TODO: https://transcend.height.app/T-32325 - use code scanning instead\n * @param options - Options\n * @returns the list of integrations\n */\nexport async function findFilesToScan({\n scanPath,\n fileGlobs,\n ignoreDirs,\n config,\n}: {\n /** Where to look for package.json files */\n scanPath: string;\n /** Globs to look for */\n fileGlobs: string;\n /** The directories to ignore (excludes node_modules and serverless-build) */\n ignoreDirs: string;\n /** Silo Discovery configuration */\n config: CodeScanningConfig;\n}): Promise<SiloDiscoveryRawResults[]> {\n const { ignoreDirs: IGNORE_DIRS, supportedFiles, scanFunction } = config;\n const globsToSupport =\n fileGlobs === ''\n ? supportedFiles\n : supportedFiles.concat(fileGlobs.split(','));\n const dirsToIgnore = [...ignoreDirs.split(','), ...IGNORE_DIRS].filter(\n (dir) => dir.length > 0,\n );\n try {\n const filesToScan: string[] = await fastGlob(\n `${scanPath}/**/${globsToSupport.join('|')}`,\n {\n ignore: dirsToIgnore.map((dir: string) => `${scanPath}/**/${dir}`),\n unique: true,\n onlyFiles: true,\n },\n );\n logger.info(`Scanning: ${filesToScan.length} files`);\n const allPackages = filesToScan\n .map((filePath: string) => scanFunction(filePath))\n .flat();\n const allSdks = allPackages\n .map((appPackage) => appPackage.softwareDevelopmentKits || [])\n .flat();\n const uniqueDeps = new Set(allSdks.map((sdk) => sdk.name));\n const deps = [...uniqueDeps];\n logger.info(`Found: ${deps.length} unique dependencies`);\n return deps.map((dep) => ({\n name: dep,\n resourceId: `${scanPath}/**/${dep}`,\n useStrictClassifier: true,\n }));\n } catch (error) {\n throw new Error(\n `Error scanning globs ${findFilesToScan} with error: ${error}`,\n );\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunkEMB64AC3cjs = require('./chunk-EMB64AC3.cjs');require('./chunk-LCDYXJN6.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-4U57O4PS.cjs');require('./chunk-Q7I37FJV.cjs');async function n({auth:s,dataSiloId:a,status:o,statuses:i,transcendUrl:p}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),await _chunkEMB64AC3cjs.Jf.call(void 0, {transcendUrl:p,auth:s,status:o,dataSiloId:a,requestStatuses:i})}exports.skipRequestDataSilos = n;
2
- //# sourceMappingURL=impl-FNQYLHQP.cjs.map
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunkJEH3FW7Jcjs = require('./chunk-JEH3FW7J.cjs');require('./chunk-LCDYXJN6.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-OFZ7ZSEV.cjs');require('./chunk-Q7I37FJV.cjs');async function n({auth:s,dataSiloId:a,status:o,statuses:i,transcendUrl:p}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),await _chunkJEH3FW7Jcjs.Mf.call(void 0, {transcendUrl:p,auth:s,status:o,dataSiloId:a,requestStatuses:i})}exports.skipRequestDataSilos = n;
2
+ //# sourceMappingURL=impl-4OHRVXEI.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-FNQYLHQP.cjs","../src/commands/request/system/skip-request-data-silos/impl.ts"],"names":["skipRequestDataSilos","auth","dataSiloId","status","statuses","transcendUrl","doneInputValidation"],"mappings":"AAAA,iIAAwC,wDAA0C,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCkBtM,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,MAAMN,kCAAAA,CACJ,YAAA,CAAAK,CAAAA,CACA,IAAA,CAAAJ,CAAAA,CACA,MAAA,CAAAE,CAAAA,CACA,UAAA,CAAAD,CAAAA,CACA,eAAA,CAAiBE,CACnB,CAAC,CACH,CAAA,iCAAA","file":"/home/runner/work/cli/cli/dist/impl-FNQYLHQP.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../../context';\nimport type {\n RequestDataSiloStatus,\n RequestStatus,\n} from '@transcend-io/privacy-types';\nimport { skipRequestDataSilos as skipRequestDataSilosHelper } from '../../../../lib/requests';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nexport interface SkipRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n transcendUrl: string;\n statuses: RequestStatus[];\n status:\n | (typeof RequestDataSiloStatus)['Skipped']\n | (typeof RequestDataSiloStatus)['Resolved'];\n}\n\nexport async function skipRequestDataSilos(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n status,\n statuses,\n transcendUrl,\n }: SkipRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await skipRequestDataSilosHelper({\n transcendUrl,\n auth,\n status,\n dataSiloId,\n requestStatuses: statuses,\n });\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-4OHRVXEI.cjs","../src/commands/request/system/skip-request-data-silos/impl.ts"],"names":["skipRequestDataSilos","auth","dataSiloId","status","statuses","transcendUrl","doneInputValidation"],"mappings":"AAAA,iIAAwC,wDAA0C,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCkBtM,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,MAAMN,kCAAAA,CACJ,YAAA,CAAAK,CAAAA,CACA,IAAA,CAAAJ,CAAAA,CACA,MAAA,CAAAE,CAAAA,CACA,UAAA,CAAAD,CAAAA,CACA,eAAA,CAAiBE,CACnB,CAAC,CACH,CAAA,iCAAA","file":"/home/runner/work/cli/cli/dist/impl-4OHRVXEI.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../../context';\nimport type {\n RequestDataSiloStatus,\n RequestStatus,\n} from '@transcend-io/privacy-types';\nimport { skipRequestDataSilos as skipRequestDataSilosHelper } from '../../../../lib/requests';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nexport interface SkipRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n transcendUrl: string;\n statuses: RequestStatus[];\n status:\n | (typeof RequestDataSiloStatus)['Skipped']\n | (typeof RequestDataSiloStatus)['Resolved'];\n}\n\nexport async function skipRequestDataSilos(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n status,\n statuses,\n transcendUrl,\n }: SkipRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await skipRequestDataSilosHelper({\n transcendUrl,\n auth,\n status,\n dataSiloId,\n requestStatuses: statuses,\n });\n}\n"]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunkEMB64AC3cjs = require('./chunk-EMB64AC3.cjs');require('./chunk-LCDYXJN6.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-4U57O4PS.cjs');require('./chunk-Q7I37FJV.cjs');async function h({auth:i,enricherId:s,actions:o,requestEnricherStatuses:a,requestIds:c,createdAtBefore:e,createdAtAfter:t,concurrency:u,transcendUrl:d}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),await _chunkEMB64AC3cjs.Gf.call(void 0, {auth:i,enricherId:s,requestActions:o,requestEnricherStatuses:a,requestIds:c,createdAtBefore:e?new Date(e):void 0,createdAtAfter:t?new Date(t):void 0,concurrency:u,transcendUrl:d})}exports.enricherRestart = h;
2
- //# sourceMappingURL=impl-VNONBZAR.cjs.map
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunkJEH3FW7Jcjs = require('./chunk-JEH3FW7J.cjs');require('./chunk-LCDYXJN6.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-OFZ7ZSEV.cjs');require('./chunk-Q7I37FJV.cjs');async function h({auth:i,enricherId:s,actions:o,requestEnricherStatuses:a,requestIds:c,createdAtBefore:e,createdAtAfter:t,concurrency:u,transcendUrl:d}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),await _chunkJEH3FW7Jcjs.Jf.call(void 0, {auth:i,enricherId:s,requestActions:o,requestEnricherStatuses:a,requestIds:c,createdAtBefore:e?new Date(e):void 0,createdAtAfter:t?new Date(t):void 0,concurrency:u,transcendUrl:d})}exports.enricherRestart = h;
2
+ //# sourceMappingURL=impl-4TH3KKOU.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-VNONBZAR.cjs","../src/commands/request/enricher-restart/impl.ts"],"names":["enricherRestart","auth","enricherId","actions","requestEnricherStatuses","requestIds","createdAtBefore","createdAtAfter","concurrency","transcendUrl","doneInputValidation","bulkRetryEnrichers"],"mappings":"AAAA,iIAAwC,wDAA0C,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCoBtM,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,uBAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,MAAMC,kCAAAA,CACJ,IAAA,CAAAV,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,cAAA,CAAgBC,CAAAA,CAChB,uBAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,eAAA,CAAiBC,CAAAA,CAAkB,IAAI,IAAA,CAAKA,CAAe,CAAA,CAAI,KAAA,CAAA,CAC/D,cAAA,CAAgBC,CAAAA,CAAiB,IAAI,IAAA,CAAKA,CAAc,CAAA,CAAI,KAAA,CAAA,CAC5D,WAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAC,CACH,CAAA,4BAAA","file":"/home/runner/work/cli/cli/dist/impl-VNONBZAR.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { bulkRetryEnrichers } from '../../../lib/requests';\nimport type {\n RequestAction,\n RequestEnricherStatus,\n} from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface EnricherRestartCommandFlags {\n auth: string;\n enricherId: string;\n actions?: RequestAction[];\n requestEnricherStatuses?: RequestEnricherStatus[];\n transcendUrl: string;\n concurrency: number;\n requestIds?: string[];\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n}\n\nexport async function enricherRestart(\n this: LocalContext,\n {\n auth,\n enricherId,\n actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore,\n createdAtAfter,\n concurrency,\n transcendUrl,\n }: EnricherRestartCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await bulkRetryEnrichers({\n auth,\n enricherId,\n requestActions: actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore: createdAtBefore ? new Date(createdAtBefore) : undefined,\n createdAtAfter: createdAtAfter ? new Date(createdAtAfter) : undefined,\n concurrency,\n transcendUrl,\n });\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-4TH3KKOU.cjs","../src/commands/request/enricher-restart/impl.ts"],"names":["enricherRestart","auth","enricherId","actions","requestEnricherStatuses","requestIds","createdAtBefore","createdAtAfter","concurrency","transcendUrl","doneInputValidation","bulkRetryEnrichers"],"mappings":"AAAA,iIAAwC,wDAA0C,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCoBtM,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,uBAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,MAAMC,kCAAAA,CACJ,IAAA,CAAAV,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,cAAA,CAAgBC,CAAAA,CAChB,uBAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,eAAA,CAAiBC,CAAAA,CAAkB,IAAI,IAAA,CAAKA,CAAe,CAAA,CAAI,KAAA,CAAA,CAC/D,cAAA,CAAgBC,CAAAA,CAAiB,IAAI,IAAA,CAAKA,CAAc,CAAA,CAAI,KAAA,CAAA,CAC5D,WAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAC,CACH,CAAA,4BAAA","file":"/home/runner/work/cli/cli/dist/impl-4TH3KKOU.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { bulkRetryEnrichers } from '../../../lib/requests';\nimport type {\n RequestAction,\n RequestEnricherStatus,\n} from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface EnricherRestartCommandFlags {\n auth: string;\n enricherId: string;\n actions?: RequestAction[];\n requestEnricherStatuses?: RequestEnricherStatus[];\n transcendUrl: string;\n concurrency: number;\n requestIds?: string[];\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n}\n\nexport async function enricherRestart(\n this: LocalContext,\n {\n auth,\n enricherId,\n actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore,\n createdAtAfter,\n concurrency,\n transcendUrl,\n }: EnricherRestartCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await bulkRetryEnrichers({\n auth,\n enricherId,\n requestActions: actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore: createdAtBefore ? new Date(createdAtBefore) : undefined,\n createdAtAfter: createdAtAfter ? new Date(createdAtAfter) : undefined,\n concurrency,\n transcendUrl,\n });\n}\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVXJ3QIONcjs = require('./chunk-VXJ3QION.cjs');require('./chunk-OAG7DICW.cjs');require('./chunk-QEM6S2W7.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');require('./chunk-JEH3FW7J.cjs');require('./chunk-LCDYXJN6.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-OFZ7ZSEV.cjs');require('./chunk-Q7I37FJV.cjs');async function m({auth:r,trackerStatus:s,file:a,transcendUrl:e}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),await _chunkVXJ3QIONcjs.c.call(void 0, {auth:r,trackerStatus:s,file:a,transcendUrl:e})}exports.uploadCookiesFromCsv = m;
2
+ //# sourceMappingURL=impl-534MCRL5.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-KFCSSBYU.cjs","../src/commands/consent/upload-cookies-from-csv/impl.ts"],"names":["uploadCookiesFromCsv","auth","trackerStatus","file","transcendUrl","doneInputValidation"],"mappings":"AAAA,iIAAwC,gCAA6B,gCAA6B,wDAAyC,gCAA6B,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCY5R,SAAsBA,CAAAA,CAEpB,CAAE,IAAA,CAAAC,CAAAA,CAAM,aAAA,CAAAC,CAAAA,CAAe,IAAA,CAAAC,CAAAA,CAAM,YAAA,CAAAC,CAAa,CAAA,CAC3B,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAGrC,MAAML,iCAAAA,CACJ,IAAA,CAAAC,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAC,CACH,CAAA,iCAAA","file":"/home/runner/work/cli/cli/dist/impl-KFCSSBYU.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { uploadCookiesFromCsv as uploadCookiesFromCsvHelper } from '../../../lib/consent-manager';\nimport { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface UploadCookiesFromCsvCommandFlags {\n auth: string;\n trackerStatus: ConsentTrackerStatus;\n file: string;\n transcendUrl: string;\n}\n\nexport async function uploadCookiesFromCsv(\n this: LocalContext,\n { auth, trackerStatus, file, transcendUrl }: UploadCookiesFromCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Upload cookies\n await uploadCookiesFromCsvHelper({\n auth,\n trackerStatus,\n file,\n transcendUrl,\n });\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-534MCRL5.cjs","../src/commands/consent/upload-cookies-from-csv/impl.ts"],"names":["uploadCookiesFromCsv","auth","trackerStatus","file","transcendUrl","doneInputValidation"],"mappings":"AAAA,iIAAwC,gCAA6B,gCAA6B,wDAAyC,gCAA6B,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCY5R,SAAsBA,CAAAA,CAEpB,CAAE,IAAA,CAAAC,CAAAA,CAAM,aAAA,CAAAC,CAAAA,CAAe,IAAA,CAAAC,CAAAA,CAAM,YAAA,CAAAC,CAAa,CAAA,CAC3B,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAGrC,MAAML,iCAAAA,CACJ,IAAA,CAAAC,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAC,CACH,CAAA,iCAAA","file":"/home/runner/work/cli/cli/dist/impl-534MCRL5.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { uploadCookiesFromCsv as uploadCookiesFromCsvHelper } from '../../../lib/consent-manager';\nimport { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface UploadCookiesFromCsvCommandFlags {\n auth: string;\n trackerStatus: ConsentTrackerStatus;\n file: string;\n transcendUrl: string;\n}\n\nexport async function uploadCookiesFromCsv(\n this: LocalContext,\n { auth, trackerStatus, file, transcendUrl }: UploadCookiesFromCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Upload cookies\n await uploadCookiesFromCsvHelper({\n auth,\n trackerStatus,\n file,\n transcendUrl,\n });\n}\n"]}
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkDQ4R65RBcjs = require('./chunk-DQ4R65RB.cjs');require('./chunk-QEM6S2W7.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');require('./chunk-EMB64AC3.cjs');require('./chunk-LCDYXJN6.cjs');require('./chunk-ZUNVPK23.cjs');var _chunk4U57O4PScjs = require('./chunk-4U57O4PS.cjs');require('./chunk-Q7I37FJV.cjs');var _fs = require('fs');async function N({email:o,password:r,apiKeyTitle:n,file:s,scopes:a,deleteExistingApiKey:p,createNewApiKey:m,parentOrganizationId:c,transcendUrl:l}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);let g=a.map(d=>_chunk4U57O4PScjs.w[d].name),{errors:y,apiKeys:f}=await _chunkDQ4R65RBcjs.a.call(void 0, {transcendUrl:l,password:r,email:o,parentOrganizationId:c,deleteExistingApiKey:p,createNewApiKey:m,apiKeyTitle:n,scopes:g});_fs.writeFileSync.call(void 0, s,`${JSON.stringify(f,null,2)}
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGVK66NZAcjs = require('./chunk-GVK66NZA.cjs');require('./chunk-QEM6S2W7.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');require('./chunk-JEH3FW7J.cjs');require('./chunk-LCDYXJN6.cjs');require('./chunk-ZUNVPK23.cjs');var _chunkOFZ7ZSEVcjs = require('./chunk-OFZ7ZSEV.cjs');require('./chunk-Q7I37FJV.cjs');var _fs = require('fs');async function N({email:o,password:r,apiKeyTitle:n,file:s,scopes:a,deleteExistingApiKey:p,createNewApiKey:m,parentOrganizationId:c,transcendUrl:l}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);let g=a.map(d=>_chunkOFZ7ZSEVcjs.w[d].name),{errors:y,apiKeys:f}=await _chunkGVK66NZAcjs.a.call(void 0, {transcendUrl:l,password:r,email:o,parentOrganizationId:c,deleteExistingApiKey:p,createNewApiKey:m,apiKeyTitle:n,scopes:g});_fs.writeFileSync.call(void 0, s,`${JSON.stringify(f,null,2)}
2
2
  `),y.length>0&&this.process.exit(1)}exports.generateApiKeys = N;
3
- //# sourceMappingURL=impl-3M5H66QQ.cjs.map
3
+ //# sourceMappingURL=impl-67VIE5PB.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-3M5H66QQ.cjs","../src/commands/admin/generate-api-keys/impl.ts"],"names":["generateApiKeys","email","password","apiKeyTitle","file","scopes","deleteExistingApiKey","createNewApiKey","parentOrganizationId","transcendUrl","doneInputValidation","scopeNames","scopeTitle","SCOPES_BY_TITLE","errors","apiKeys","generateCrossAccountApiKeys","writeFileSync"],"mappings":"AAAA,iIAAwC,gCAA6B,wDAAyC,gCAA6B,gCAA6B,gCAA6B,wDAAyC,gCAA6B,wBCC7O,MAsB9B,SAAsBA,CAAAA,CAEpB,CACE,KAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,oBAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,oBAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,IAAMC,CAAAA,CAAaN,CAAAA,CAAO,GAAA,CACvBO,CAAAA,EAAeC,mBAAAA,CAAgBD,CAAU,CAAA,CAAE,IAC9C,CAAA,CAGM,CAAE,MAAA,CAAAE,CAAAA,CAAQ,OAAA,CAAAC,CAAQ,CAAA,CAAI,MAAMC,iCAAAA,CAChC,YAAA,CAAAP,CAAAA,CACA,QAAA,CAAAP,CAAAA,CACA,KAAA,CAAAD,CAAAA,CACA,oBAAA,CAAAO,CAAAA,CACA,oBAAA,CAAAF,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,WAAA,CAAAJ,CAAAA,CACA,MAAA,CAAQQ,CACV,CAAC,CAAA,CAGDM,+BAAAA,CAAcb,CAAM,CAAA,EAAA;AAItB","file":"/home/runner/work/cli/cli/dist/impl-3M5H66QQ.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { writeFileSync } from 'node:fs';\n\nimport { ScopeName } from '@transcend-io/privacy-types';\n\nimport { generateCrossAccountApiKeys } from '../../../lib/api-keys';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\nimport { SCOPES_BY_TITLE } from '../../../constants';\n\n// Command flag interface\nexport interface GenerateApiKeysCommandFlags {\n email: string;\n password: string;\n apiKeyTitle: string;\n file: string;\n scopes: string[];\n deleteExistingApiKey: boolean;\n createNewApiKey: boolean;\n parentOrganizationId?: string;\n transcendUrl: string;\n}\n\n// Command implementation\nexport async function generateApiKeys(\n this: LocalContext,\n {\n email,\n password,\n apiKeyTitle,\n file,\n scopes,\n deleteExistingApiKey,\n createNewApiKey,\n parentOrganizationId,\n transcendUrl,\n }: GenerateApiKeysCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const scopeNames = scopes.map(\n (scopeTitle) => SCOPES_BY_TITLE[scopeTitle].name as ScopeName,\n );\n\n // Upload privacy requests\n const { errors, apiKeys } = await generateCrossAccountApiKeys({\n transcendUrl,\n password,\n email,\n parentOrganizationId,\n deleteExistingApiKey,\n createNewApiKey,\n apiKeyTitle,\n scopes: scopeNames,\n });\n\n // Write to disk\n writeFileSync(file, `${JSON.stringify(apiKeys, null, 2)}\\n`);\n if (errors.length > 0) {\n this.process.exit(1);\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-67VIE5PB.cjs","../src/commands/admin/generate-api-keys/impl.ts"],"names":["generateApiKeys","email","password","apiKeyTitle","file","scopes","deleteExistingApiKey","createNewApiKey","parentOrganizationId","transcendUrl","doneInputValidation","scopeNames","scopeTitle","SCOPES_BY_TITLE","errors","apiKeys","generateCrossAccountApiKeys","writeFileSync"],"mappings":"AAAA,iIAAwC,gCAA6B,wDAAyC,gCAA6B,gCAA6B,gCAA6B,wDAAyC,gCAA6B,wBCC7O,MAsB9B,SAAsBA,CAAAA,CAEpB,CACE,KAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,oBAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,oBAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,IAAMC,CAAAA,CAAaN,CAAAA,CAAO,GAAA,CACvBO,CAAAA,EAAeC,mBAAAA,CAAgBD,CAAU,CAAA,CAAE,IAC9C,CAAA,CAGM,CAAE,MAAA,CAAAE,CAAAA,CAAQ,OAAA,CAAAC,CAAQ,CAAA,CAAI,MAAMC,iCAAAA,CAChC,YAAA,CAAAP,CAAAA,CACA,QAAA,CAAAP,CAAAA,CACA,KAAA,CAAAD,CAAAA,CACA,oBAAA,CAAAO,CAAAA,CACA,oBAAA,CAAAF,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,WAAA,CAAAJ,CAAAA,CACA,MAAA,CAAQQ,CACV,CAAC,CAAA,CAGDM,+BAAAA,CAAcb,CAAM,CAAA,EAAA;AAItB","file":"/home/runner/work/cli/cli/dist/impl-67VIE5PB.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { writeFileSync } from 'node:fs';\n\nimport { ScopeName } from '@transcend-io/privacy-types';\n\nimport { generateCrossAccountApiKeys } from '../../../lib/api-keys';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\nimport { SCOPES_BY_TITLE } from '../../../constants';\n\n// Command flag interface\nexport interface GenerateApiKeysCommandFlags {\n email: string;\n password: string;\n apiKeyTitle: string;\n file: string;\n scopes: string[];\n deleteExistingApiKey: boolean;\n createNewApiKey: boolean;\n parentOrganizationId?: string;\n transcendUrl: string;\n}\n\n// Command implementation\nexport async function generateApiKeys(\n this: LocalContext,\n {\n email,\n password,\n apiKeyTitle,\n file,\n scopes,\n deleteExistingApiKey,\n createNewApiKey,\n parentOrganizationId,\n transcendUrl,\n }: GenerateApiKeysCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const scopeNames = scopes.map(\n (scopeTitle) => SCOPES_BY_TITLE[scopeTitle].name as ScopeName,\n );\n\n // Upload privacy requests\n const { errors, apiKeys } = await generateCrossAccountApiKeys({\n transcendUrl,\n password,\n email,\n parentOrganizationId,\n deleteExistingApiKey,\n createNewApiKey,\n apiKeyTitle,\n scopes: scopeNames,\n });\n\n // Write to disk\n writeFileSync(file, `${JSON.stringify(apiKeys, null, 2)}\\n`);\n if (errors.length > 0) {\n this.process.exit(1);\n }\n}\n"]}
@@ -1,12 +1,12 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunkEMB64AC3cjs = require('./chunk-EMB64AC3.cjs');require('./chunk-LCDYXJN6.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunk4U57O4PScjs = require('./chunk-4U57O4PS.cjs');require('./chunk-Q7I37FJV.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _bluebird = require('bluebird');var _cliprogress = require('cli-progress'); var _cliprogress2 = _interopRequireDefault(_cliprogress);var _persistedstate = require('@transcend-io/persisted-state');var _iots = require('io-ts'); var j = _interopRequireWildcard(_iots); var T = _interopRequireWildcard(_iots); var e = _interopRequireWildcard(_iots);var _privacytypes = require('@transcend-io/privacy-types');var _typeutils = require('@transcend-io/type-utils');var Ee=T.intersection([T.type({nodes:T.array(_privacytypes.PreferenceQueryResponseItem)}),T.partial({cursor:T.string})]),Oe=["ENOTFOUND","ETIMEDOUT","504 Gateway Time-out","Task timed out after"];async function ce(c,{identifiers:i,partitionKey:h,skipLogging:d=!1}){let a=[],u=_chunk4U57O4PScjs.b.call(void 0, i,100),l=new Date().getTime(),o=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic);d||o.start(i.length,0);let f=0;await _bluebird.map.call(void 0, u,async t=>{let n=0,g=3;for(;n<g;)try{let m=await c.post(`v1/preferences/${h}/query`,{json:{filter:{identifiers:t},limit:t.length}}).json(),w=_typeutils.decodeCodec.call(void 0, Ee,m);a.push(...w.nodes),f+=t.length,o.update(f);break}catch(m){n+=1;let w=_optionalChain([m, 'optionalAccess', _2 => _2.response, 'optionalAccess', _3 => _3.body])||_optionalChain([m, 'optionalAccess', _4 => _4.message])||"";if(n>=g||!Oe.some(P=>w.includes(P)))throw new Error(`Received an error from server after ${n} attempts: ${w}`);_chunkZUNVPK23cjs.a.warn(_colors2.default.yellow(`[RETRYING FAILED REQUEST - Attempt ${n}] Failed to fetch ${t.length} user preferences from partition ${h}: ${w}`))}},{concurrency:40}),o.stop();let r=new Date().getTime()-l;return d||_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Completed download in "${r/1e3}" seconds.`)),a}function q({row:c,columnToPurposeName:i,purposeSlugs:h,preferenceTopics:d}){let a={};return Object.entries(i).forEach(([u,{purpose:l,preference:o,valueMapping:f}])=>{if(!h.includes(l))throw new Error(`Invalid purpose slug: ${l}, expected: ${h.join(", ")}`);let s=c[u];if(o){let r=d.find(t=>t.slug===o&&t.purpose.trackingType===l);if(!r){let t=d.filter(n=>n.purpose.trackingType===l).map(n=>n.slug);throw new Error(`Invalid preference slug: ${o} for purpose: ${l}. Allowed preference slugs for purpose are: ${t.join(",")}`)}switch(a[l]||(a[l]={preferences:[]}),a[l].preferences||(a[l].preferences=[]),r.type){case _privacytypes.PreferenceTopicType.Boolean:{let t=f[s];if(t===void 0&&s!=="")throw new Error(`No preference mapping found for value "${s}" in column "${u}" (purpose=${l}, preference=${o})`);if(t==null)return;if(typeof t!="boolean")throw new Error(`Invalid value for boolean preference: ${o}, expected boolean, got: ${s}`);a[l].preferences.push({topic:o,choice:{booleanValue:t}});break}case _privacytypes.PreferenceTopicType.Select:{let t=f[s];if(t===void 0&&s!=="")throw new Error(`No preference mapping found for value "${s}" in column "${u}" (purpose=${l}, preference=${o})`);if(t==null)return;if(typeof t!="string")throw new Error(`Invalid value for select preference: ${o}, expected string, got: ${s}`);let n=t.trim()||null;if(n&&!r.preferenceOptionValues.map(({slug:g})=>g).includes(n))throw new Error(`Invalid value for select preference: ${o}, expected one of: ${r.preferenceOptionValues.map(({slug:g})=>g).join(", ")}, got: ${s}`);a[l].preferences.push({topic:o,choice:{selectValue:n}});break}case _privacytypes.PreferenceTopicType.MultiSelect:{if(typeof s!="string")throw new Error(`Invalid value for multi select preference: ${o}, expected string, got: ${s}`);let t=_chunkEMB64AC3cjs.nc.call(void 0, s).map(n=>{let g=f[n];if(g===void 0&&s!=="")throw new Error(`No preference mapping found for multi select token "${s}" in column "${u}" (purpose=${l}, preference=${o})`);if(g==null)return null;if(typeof g!="string")throw new Error(`Invalid value for multi select preference: ${o}, expected one of: ${r.preferenceOptionValues.map(({slug:m})=>m).join(", ")}, got: ${n}`);return g}).filter(n=>n!==null).sort((n,g)=>n.localeCompare(g));t.length>0&&a[l].preferences.push({topic:o,choice:{selectValues:t}});break}default:throw new Error(`Unknown preference type: ${r.type}`)}}else{let r=f[s];if(r===void 0&&s!=="")throw new Error(`No preference mapping found for value "${s}" in column "${u}" (purpose=${l}, preference=\u2205)`);if(r===null)return;a[l]?a[l].enabled=r===!0:a[l]={enabled:r===!0}}}),_typeutils.apply.call(void 0, a,(u,l)=>{if(typeof u.enabled!="boolean")throw new Error(`No mapping provided for purpose.enabled=true/false value: ${l}`);return{...u,enabled:u.enabled}})}var _inquirer = require('inquirer'); var _inquirer2 = _interopRequireDefault(_inquirer);var B="[NONE]";async function de(c,i){let h=_chunk4U57O4PScjs.j.call(void 0, c.map(a=>Object.keys(a)).flat()),d=_chunk4U57O4PScjs.c.call(void 0, h,[...i.identifierColumn?[i.identifierColumn]:[],...Object.keys(i.columnToPurposeName)]);if(!i.timestampColum){let{timestampName:a}=await _inquirer2.default.prompt([{name:"timestampName",message:"Choose the column that will be used as the timestamp of last preference update",type:"list",default:d.find(u=>u.toLowerCase().includes("date"))||d.find(u=>u.toLowerCase().includes("time"))||d[0],choices:[...d,B]}]);i.timestampColum=a}if(_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Using timestamp column "${i.timestampColum}"`)),i.timestampColum!==B){let a=c.map((u,l)=>u[i.timestampColum]?null:[l]).filter(u=>!!u).flat();if(a.length>0)throw new Error(`The timestamp column "${i.timestampColum}" is missing a value for the following rows: ${a.join(`
2
- `)}`);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`The timestamp column "${i.timestampColum}" is present for all row`))}return i}async function ue(c,i){let h=_chunk4U57O4PScjs.j.call(void 0, c.map(o=>Object.keys(o)).flat()),d=_chunk4U57O4PScjs.c.call(void 0, h,[...i.identifierColumn?[i.identifierColumn]:[],...Object.keys(i.columnToPurposeName)]);if(!i.identifierColumn){let{identifierName:o}=await _inquirer2.default.prompt([{name:"identifierName",message:"Choose the column that will be used as the identifier to upload consent preferences by",type:"list",default:d.find(f=>f.toLowerCase().includes("email"))||d[0],choices:d}]);i.identifierColumn=o}_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Using identifier column "${i.identifierColumn}"`));let a=c.map((o,f)=>o[i.identifierColumn]?null:[f]).filter(o=>!!o).flat();if(a.length>0){let o=`The identifier column "${i.identifierColumn}" is missing a value for the following rows: ${a.join(", ")}`;if(_chunkZUNVPK23cjs.a.warn(_colors2.default.yellow(o)),!await _chunkEMB64AC3cjs.Lf.call(void 0, {message:"Would you like to skip rows missing an identifier?"}))throw new Error(o);let s=c.length;c=c.filter(r=>r[i.identifierColumn]),_chunkZUNVPK23cjs.a.info(_colors2.default.yellow(`Skipped ${s-c.length} rows missing an identifier`))}_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`The identifier column "${i.identifierColumn}" is present for all rows`));let u=_chunk4U57O4PScjs.d.call(void 0, c,i.identifierColumn),l=Object.entries(u).filter(([,o])=>o.length>1);if(l.length>0){let o=`The identifier column "${i.identifierColumn}" has duplicate values for the following rows: ${l.slice(0,10).map(([s,r])=>`${s} (${r.length})`).join(`
3
- `)}`;if(_chunkZUNVPK23cjs.a.warn(_colors2.default.yellow(o)),!await _chunkEMB64AC3cjs.Lf.call(void 0, {message:"Would you like to automatically take the latest update?"}))throw new Error(o);c=Object.entries(u).map(([,s])=>s.sort((t,n)=>new Date(n[i.timestampColum]).getTime()-new Date(t[i.timestampColum]).getTime())[0]).filter(s=>s)}return{currentState:i,preferences:c}}async function ge(c,i,{purposeSlugs:h,preferenceTopics:d,forceTriggerWorkflows:a}){let u=_chunk4U57O4PScjs.j.call(void 0, c.map(f=>Object.keys(f)).flat()),l=_chunk4U57O4PScjs.c.call(void 0, u,[...i.identifierColumn?[i.identifierColumn]:[],...i.timestampColum?[i.timestampColum]:[]]);if(l.length===0){if(a)return i;throw new Error("No other columns to process")}let o=[...h,...d.map(f=>`${f.purpose.trackingType}->${f.slug}`)];return await _bluebird.mapSeries.call(void 0, l,async f=>{let s=_chunk4U57O4PScjs.j.call(void 0, c.map(t=>t[f])),r=i.columnToPurposeName[f];if(r)_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Column "${f}" is associated with purpose "${r.purpose}"`));else{let{purposeName:t}=await _inquirer2.default.prompt([{name:"purposeName",message:`Choose the purpose that column ${f} is associated with`,type:"list",default:o.find(m=>m.startsWith(h[0])),choices:o}]),[n,g]=t.split("->");r={purpose:n,preference:g||null,valueMapping:{}}}await _bluebird.mapSeries.call(void 0, s,async t=>{if(r.valueMapping[t]!==void 0){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Value "${t}" is associated with purpose value "${r.valueMapping[t]}"`));return}if(r.preference===null){let{purposeValue:n}=await _inquirer2.default.prompt([{name:"purposeValue",message:`Choose the purpose value for value "${t}" associated with purpose "${r.purpose}"`,type:"confirm",default:t!=="false"}]);r.valueMapping[t]=n}if(r.preference!==null){let n=d.find(m=>m.slug===r.preference);if(!n){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Preference topic "${r.preference}" not found`));return}let g=n.preferenceOptionValues.map(({slug:m})=>m);if(n.type===_privacytypes.PreferenceTopicType.Boolean){let{preferenceValue:m}=await _inquirer2.default.prompt([{name:"preferenceValue",message:`Choose the preference value for "${n.slug}" value "${t}" associated with purpose "${r.purpose}"`,type:"confirm",default:t!=="false"}]);r.valueMapping[t]=m;return}if(n.type===_privacytypes.PreferenceTopicType.Select){let{preferenceValue:m}=await _inquirer2.default.prompt([{name:"preferenceValue",message:`Choose the preference value for "${n.slug}" value "${t}" associated with purpose "${r.purpose}"`,type:"list",choices:g,default:g.find(w=>w===t)}]);r.valueMapping[t]=m;return}if(n.type===_privacytypes.PreferenceTopicType.MultiSelect){let m=_chunkEMB64AC3cjs.nc.call(void 0, t);await _bluebird.mapSeries.call(void 0, m,async w=>{if(r.valueMapping[w]!==void 0)return;let{preferenceValue:P}=await _inquirer2.default.prompt([{name:"preferenceValue",message:`Choose the preference value for "${n.slug}" value "${w}" associated with purpose "${r.purpose}"`,type:"list",choices:g,default:g.find(y=>y===w)}]);r.valueMapping[w]=P});return}throw new Error(`Unknown preference topic type: ${n.type}`)}}),i.columnToPurposeName[f]=r}),i}function we({currentConsentRecord:c,pendingUpdates:i,preferenceTopics:h}){return Object.entries(i).every(([d,{preferences:a=[],enabled:u}])=>{let l=c.purposes.find(f=>f.purpose===d);return!!l&&l.enabled===u?a.every(({topic:f,choice:s})=>l.preferences&&l.preferences.find(r=>{if(r.topic!==f)return!1;let t=h.find(n=>n.slug===f&&n.purpose.trackingType===d);if(!t)throw new Error(`Could not find preference topic for ${f}`);switch(t.type){case _privacytypes.PreferenceTopicType.Boolean:return r.choice.booleanValue===s.booleanValue;case _privacytypes.PreferenceTopicType.Select:return r.choice.selectValue===s.selectValue;case _privacytypes.PreferenceTopicType.MultiSelect:let n=(r.choice.selectValues||[]).sort(),g=(s.selectValues||[]).sort();return n.length===g.length&&n.every((m,w)=>m===g[w]);default:throw new Error(`Unknown preference topic type: ${t.type}`)}})):!1})}function he({currentConsentRecord:c,pendingUpdates:i,preferenceTopics:h,log:d}){return!!Object.entries(i).find(([a,{preferences:u=[],enabled:l}])=>{let o=c.purposes.find(f=>f.purpose===a);return o?o.enabled!==l?(d&&_chunkZUNVPK23cjs.a.warn(`Purpose ${a} enabled value conflict for user ${c.userId}. Pending Value: ${l}, Current Value: ${o.enabled}`),!0):!!u.find(({topic:f,choice:s})=>{let r=(o.preferences||[]).find(m=>m.topic===f);if(!r)return d&&_chunkZUNVPK23cjs.a.warn(`No existing preference found for topic ${f} in purpose ${a} for user ${c.userId}.`),!1;let t=h.find(m=>m.slug===f&&m.purpose.trackingType===a);if(!t)throw new Error(`Could not find preference topic for ${f}`);let n,g;switch(t.type){case _privacytypes.PreferenceTopicType.Boolean:return n=r.choice.booleanValue!==s.booleanValue,d&&_chunkZUNVPK23cjs.a.warn(`Preference topic ${f} boolean value conflict for user ${c.userId}. Expected: ${s.booleanValue}, Found: ${r.choice.booleanValue}`),n;case _privacytypes.PreferenceTopicType.Select:return g=r.choice.selectValue!==s.selectValue,d&&_chunkZUNVPK23cjs.a.warn(`Preference topic ${f} select value conflict for user ${c.userId}. Expected: ${s.selectValue}, Found: ${r.choice.selectValue}`),g;case _privacytypes.PreferenceTopicType.MultiSelect:let m=(r.choice.selectValues||[]).sort(),w=(s.selectValues||[]).sort();return g=m.length!==w.length||!m.every((P,y)=>P===w[y]),d&&_chunkZUNVPK23cjs.a.warn(`Preference topic ${f} multi-select value conflict for user ${c.userId}. Expected: ${w.join(", ")}, Found: ${m.join(", ")}`),g;default:throw new Error(`Unknown preference topic type: ${t.type}`)}}):(d&&_chunkZUNVPK23cjs.a.warn(`No existing purpose found for ${a} in consent record for ${c.userId}.`),!1)})}async function Pe({file:c,sombra:i,purposeSlugs:h,preferenceTopics:d,partitionKey:a,skipExistingRecordCheck:u,forceTriggerWorkflows:l},o){let f=new Date().getTime(),s=o.getValue("fileMetadata");_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Reading in file: "${c}"`));let r=_chunkEMB64AC3cjs.qc.call(void 0, c,j.record(j.string,j.string)),t={columnToPurposeName:{},pendingSafeUpdates:{},pendingConflictUpdates:{},skippedUpdates:{},...s[c]||{},lastFetchedAt:new Date().toISOString()};t=await de(r,t),s[c]=t,await o.setValue(s,"fileMetadata");let n=await ue(r,t);t=n.currentState,r=n.preferences,s[c]=t,await o.setValue(s,"fileMetadata"),t=await ge(r,t,{preferenceTopics:d,purposeSlugs:h,forceTriggerWorkflows:l}),s[c]=t,await o.setValue(s,"fileMetadata");let g=r.map(y=>y[t.identifierColumn]),m=u?[]:await ce(i,{identifiers:g.map(y=>({value:y})),partitionKey:a}),w=_chunk4U57O4PScjs.e.call(void 0, m,"userId");t.pendingConflictUpdates={},t.pendingSafeUpdates={},t.skippedUpdates={},r.forEach(y=>{let b=y[t.identifierColumn],S=q({row:y,columnToPurposeName:t.columnToPurposeName,preferenceTopics:d,purposeSlugs:h}),v=w[b];if(l&&!v)throw new Error(`No existing consent record found for user with id: ${b}.
4
- When 'forceTriggerWorkflows' is set all the user identifiers should contain a consent record`);if(v&&we({currentConsentRecord:v,pendingUpdates:S,preferenceTopics:d})&&!l){t.skippedUpdates[b]=y;return}if(v&&he({currentConsentRecord:v,pendingUpdates:S,preferenceTopics:d})){t.pendingConflictUpdates[b]={row:y,record:v};return}t.pendingSafeUpdates[b]=y}),s[c]=t,await o.setValue(s,"fileMetadata");let P=new Date().getTime();_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully pre-processed file: "${c}" in ${(P-f)/1e3}s`))}var be=e.type({purpose:e.string,preference:e.union([e.string,e.null]),valueMapping:e.record(e.string,e.union([e.string,e.boolean,e.null,e.undefined]))}),Kt=e.record(e.string,be),Ae=e.type({name:e.string,isUniqueOnPreferenceStore:e.boolean}),Yt=e.record(e.string,Ae),De=e.intersection([e.type({columnToPurposeName:e.record(e.string,be),lastFetchedAt:e.string,pendingSafeUpdates:e.record(e.string,e.record(e.string,e.string)),pendingConflictUpdates:e.record(e.string,e.type({record:_privacytypes.PreferenceQueryResponseItem,row:e.record(e.string,e.string)})),skippedUpdates:e.record(e.string,e.record(e.string,e.string))}),e.partial({identifierColumn:e.string,timestampColum:e.string})]),Jt=e.record(e.string,e.union([e.boolean,_privacytypes.PreferenceUpdateItem])),zt=e.record(e.string,e.union([e.boolean,e.record(e.string,e.string)])),Ht=e.record(e.string,e.type({uploadedAt:e.string,error:e.string,update:_privacytypes.PreferenceUpdateItem})),Xt=e.record(e.string,e.type({record:_privacytypes.PreferenceQueryResponseItem,row:e.record(e.string,e.string)})),Zt=e.record(e.string,e.record(e.string,e.string)),Ce=e.type({fileMetadata:e.record(e.string,De),failingUpdates:e.record(e.string,e.type({uploadedAt:e.string,error:e.string,update:_privacytypes.PreferenceUpdateItem})),pendingUpdates:e.record(e.string,_privacytypes.PreferenceUpdateItem)});async function Ue({auth:c,sombraAuth:i,receiptFilepath:h,file:d,partition:a,isSilent:u=!0,dryRun:l=!1,skipWorkflowTriggers:o=!1,skipConflictUpdates:f=!1,skipExistingRecordCheck:s=!1,attributes:r=[],transcendUrl:t,forceTriggerWorkflows:n=!1}){let g=_chunkEMB64AC3cjs.pc.call(void 0, r),m=new (0, _persistedstate.PersistedState)(h,Ce,{fileMetadata:{},failingUpdates:{},pendingUpdates:{}}),w=m.getValue("failingUpdates"),P=m.getValue("pendingUpdates"),y=m.getValue("fileMetadata");_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Restored cache, there are:
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunkJEH3FW7Jcjs = require('./chunk-JEH3FW7J.cjs');require('./chunk-LCDYXJN6.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkOFZ7ZSEVcjs = require('./chunk-OFZ7ZSEV.cjs');require('./chunk-Q7I37FJV.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _bluebird = require('bluebird');var _cliprogress = require('cli-progress'); var _cliprogress2 = _interopRequireDefault(_cliprogress);var _persistedstate = require('@transcend-io/persisted-state');var _iots = require('io-ts'); var j = _interopRequireWildcard(_iots); var T = _interopRequireWildcard(_iots); var e = _interopRequireWildcard(_iots);var _privacytypes = require('@transcend-io/privacy-types');var _typeutils = require('@transcend-io/type-utils');var Ee=T.intersection([T.type({nodes:T.array(_privacytypes.PreferenceQueryResponseItem)}),T.partial({cursor:T.string})]),Oe=["ENOTFOUND","ETIMEDOUT","504 Gateway Time-out","Task timed out after"];async function ce(c,{identifiers:i,partitionKey:h,skipLogging:d=!1}){let a=[],u=_chunkOFZ7ZSEVcjs.b.call(void 0, i,100),l=new Date().getTime(),o=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic);d||o.start(i.length,0);let f=0;await _bluebird.map.call(void 0, u,async t=>{let n=0,g=3;for(;n<g;)try{let m=await c.post(`v1/preferences/${h}/query`,{json:{filter:{identifiers:t},limit:t.length}}).json(),w=_typeutils.decodeCodec.call(void 0, Ee,m);a.push(...w.nodes),f+=t.length,o.update(f);break}catch(m){n+=1;let w=_optionalChain([m, 'optionalAccess', _2 => _2.response, 'optionalAccess', _3 => _3.body])||_optionalChain([m, 'optionalAccess', _4 => _4.message])||"";if(n>=g||!Oe.some(P=>w.includes(P)))throw new Error(`Received an error from server after ${n} attempts: ${w}`);_chunkZUNVPK23cjs.a.warn(_colors2.default.yellow(`[RETRYING FAILED REQUEST - Attempt ${n}] Failed to fetch ${t.length} user preferences from partition ${h}: ${w}`))}},{concurrency:40}),o.stop();let r=new Date().getTime()-l;return d||_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Completed download in "${r/1e3}" seconds.`)),a}function q({row:c,columnToPurposeName:i,purposeSlugs:h,preferenceTopics:d}){let a={};return Object.entries(i).forEach(([u,{purpose:l,preference:o,valueMapping:f}])=>{if(!h.includes(l))throw new Error(`Invalid purpose slug: ${l}, expected: ${h.join(", ")}`);let s=c[u];if(o){let r=d.find(t=>t.slug===o&&t.purpose.trackingType===l);if(!r){let t=d.filter(n=>n.purpose.trackingType===l).map(n=>n.slug);throw new Error(`Invalid preference slug: ${o} for purpose: ${l}. Allowed preference slugs for purpose are: ${t.join(",")}`)}switch(a[l]||(a[l]={preferences:[]}),a[l].preferences||(a[l].preferences=[]),r.type){case _privacytypes.PreferenceTopicType.Boolean:{let t=f[s];if(t===void 0&&s!=="")throw new Error(`No preference mapping found for value "${s}" in column "${u}" (purpose=${l}, preference=${o})`);if(t==null)return;if(typeof t!="boolean")throw new Error(`Invalid value for boolean preference: ${o}, expected boolean, got: ${s}`);a[l].preferences.push({topic:o,choice:{booleanValue:t}});break}case _privacytypes.PreferenceTopicType.Select:{let t=f[s];if(t===void 0&&s!=="")throw new Error(`No preference mapping found for value "${s}" in column "${u}" (purpose=${l}, preference=${o})`);if(t==null)return;if(typeof t!="string")throw new Error(`Invalid value for select preference: ${o}, expected string, got: ${s}`);let n=t.trim()||null;if(n&&!r.preferenceOptionValues.map(({slug:g})=>g).includes(n))throw new Error(`Invalid value for select preference: ${o}, expected one of: ${r.preferenceOptionValues.map(({slug:g})=>g).join(", ")}, got: ${s}`);a[l].preferences.push({topic:o,choice:{selectValue:n}});break}case _privacytypes.PreferenceTopicType.MultiSelect:{if(typeof s!="string")throw new Error(`Invalid value for multi select preference: ${o}, expected string, got: ${s}`);let t=_chunkJEH3FW7Jcjs.nc.call(void 0, s).map(n=>{let g=f[n];if(g===void 0&&s!=="")throw new Error(`No preference mapping found for multi select token "${s}" in column "${u}" (purpose=${l}, preference=${o})`);if(g==null)return null;if(typeof g!="string")throw new Error(`Invalid value for multi select preference: ${o}, expected one of: ${r.preferenceOptionValues.map(({slug:m})=>m).join(", ")}, got: ${n}`);return g}).filter(n=>n!==null).sort((n,g)=>n.localeCompare(g));t.length>0&&a[l].preferences.push({topic:o,choice:{selectValues:t}});break}default:throw new Error(`Unknown preference type: ${r.type}`)}}else{let r=f[s];if(r===void 0&&s!=="")throw new Error(`No preference mapping found for value "${s}" in column "${u}" (purpose=${l}, preference=\u2205)`);if(r===null)return;a[l]?a[l].enabled=r===!0:a[l]={enabled:r===!0}}}),_typeutils.apply.call(void 0, a,(u,l)=>{if(typeof u.enabled!="boolean")throw new Error(`No mapping provided for purpose.enabled=true/false value: ${l}`);return{...u,enabled:u.enabled}})}var _inquirer = require('inquirer'); var _inquirer2 = _interopRequireDefault(_inquirer);var B="[NONE]";async function de(c,i){let h=_chunkOFZ7ZSEVcjs.j.call(void 0, c.map(a=>Object.keys(a)).flat()),d=_chunkOFZ7ZSEVcjs.c.call(void 0, h,[...i.identifierColumn?[i.identifierColumn]:[],...Object.keys(i.columnToPurposeName)]);if(!i.timestampColum){let{timestampName:a}=await _inquirer2.default.prompt([{name:"timestampName",message:"Choose the column that will be used as the timestamp of last preference update",type:"list",default:d.find(u=>u.toLowerCase().includes("date"))||d.find(u=>u.toLowerCase().includes("time"))||d[0],choices:[...d,B]}]);i.timestampColum=a}if(_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Using timestamp column "${i.timestampColum}"`)),i.timestampColum!==B){let a=c.map((u,l)=>u[i.timestampColum]?null:[l]).filter(u=>!!u).flat();if(a.length>0)throw new Error(`The timestamp column "${i.timestampColum}" is missing a value for the following rows: ${a.join(`
2
+ `)}`);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`The timestamp column "${i.timestampColum}" is present for all row`))}return i}async function ue(c,i){let h=_chunkOFZ7ZSEVcjs.j.call(void 0, c.map(o=>Object.keys(o)).flat()),d=_chunkOFZ7ZSEVcjs.c.call(void 0, h,[...i.identifierColumn?[i.identifierColumn]:[],...Object.keys(i.columnToPurposeName)]);if(!i.identifierColumn){let{identifierName:o}=await _inquirer2.default.prompt([{name:"identifierName",message:"Choose the column that will be used as the identifier to upload consent preferences by",type:"list",default:d.find(f=>f.toLowerCase().includes("email"))||d[0],choices:d}]);i.identifierColumn=o}_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Using identifier column "${i.identifierColumn}"`));let a=c.map((o,f)=>o[i.identifierColumn]?null:[f]).filter(o=>!!o).flat();if(a.length>0){let o=`The identifier column "${i.identifierColumn}" is missing a value for the following rows: ${a.join(", ")}`;if(_chunkZUNVPK23cjs.a.warn(_colors2.default.yellow(o)),!await _chunkJEH3FW7Jcjs.Of.call(void 0, {message:"Would you like to skip rows missing an identifier?"}))throw new Error(o);let s=c.length;c=c.filter(r=>r[i.identifierColumn]),_chunkZUNVPK23cjs.a.info(_colors2.default.yellow(`Skipped ${s-c.length} rows missing an identifier`))}_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`The identifier column "${i.identifierColumn}" is present for all rows`));let u=_chunkOFZ7ZSEVcjs.d.call(void 0, c,i.identifierColumn),l=Object.entries(u).filter(([,o])=>o.length>1);if(l.length>0){let o=`The identifier column "${i.identifierColumn}" has duplicate values for the following rows: ${l.slice(0,10).map(([s,r])=>`${s} (${r.length})`).join(`
3
+ `)}`;if(_chunkZUNVPK23cjs.a.warn(_colors2.default.yellow(o)),!await _chunkJEH3FW7Jcjs.Of.call(void 0, {message:"Would you like to automatically take the latest update?"}))throw new Error(o);c=Object.entries(u).map(([,s])=>s.sort((t,n)=>new Date(n[i.timestampColum]).getTime()-new Date(t[i.timestampColum]).getTime())[0]).filter(s=>s)}return{currentState:i,preferences:c}}async function ge(c,i,{purposeSlugs:h,preferenceTopics:d,forceTriggerWorkflows:a}){let u=_chunkOFZ7ZSEVcjs.j.call(void 0, c.map(f=>Object.keys(f)).flat()),l=_chunkOFZ7ZSEVcjs.c.call(void 0, u,[...i.identifierColumn?[i.identifierColumn]:[],...i.timestampColum?[i.timestampColum]:[]]);if(l.length===0){if(a)return i;throw new Error("No other columns to process")}let o=[...h,...d.map(f=>`${f.purpose.trackingType}->${f.slug}`)];return await _bluebird.mapSeries.call(void 0, l,async f=>{let s=_chunkOFZ7ZSEVcjs.j.call(void 0, c.map(t=>t[f])),r=i.columnToPurposeName[f];if(r)_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Column "${f}" is associated with purpose "${r.purpose}"`));else{let{purposeName:t}=await _inquirer2.default.prompt([{name:"purposeName",message:`Choose the purpose that column ${f} is associated with`,type:"list",default:o.find(m=>m.startsWith(h[0])),choices:o}]),[n,g]=t.split("->");r={purpose:n,preference:g||null,valueMapping:{}}}await _bluebird.mapSeries.call(void 0, s,async t=>{if(r.valueMapping[t]!==void 0){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Value "${t}" is associated with purpose value "${r.valueMapping[t]}"`));return}if(r.preference===null){let{purposeValue:n}=await _inquirer2.default.prompt([{name:"purposeValue",message:`Choose the purpose value for value "${t}" associated with purpose "${r.purpose}"`,type:"confirm",default:t!=="false"}]);r.valueMapping[t]=n}if(r.preference!==null){let n=d.find(m=>m.slug===r.preference);if(!n){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Preference topic "${r.preference}" not found`));return}let g=n.preferenceOptionValues.map(({slug:m})=>m);if(n.type===_privacytypes.PreferenceTopicType.Boolean){let{preferenceValue:m}=await _inquirer2.default.prompt([{name:"preferenceValue",message:`Choose the preference value for "${n.slug}" value "${t}" associated with purpose "${r.purpose}"`,type:"confirm",default:t!=="false"}]);r.valueMapping[t]=m;return}if(n.type===_privacytypes.PreferenceTopicType.Select){let{preferenceValue:m}=await _inquirer2.default.prompt([{name:"preferenceValue",message:`Choose the preference value for "${n.slug}" value "${t}" associated with purpose "${r.purpose}"`,type:"list",choices:g,default:g.find(w=>w===t)}]);r.valueMapping[t]=m;return}if(n.type===_privacytypes.PreferenceTopicType.MultiSelect){let m=_chunkJEH3FW7Jcjs.nc.call(void 0, t);await _bluebird.mapSeries.call(void 0, m,async w=>{if(r.valueMapping[w]!==void 0)return;let{preferenceValue:P}=await _inquirer2.default.prompt([{name:"preferenceValue",message:`Choose the preference value for "${n.slug}" value "${w}" associated with purpose "${r.purpose}"`,type:"list",choices:g,default:g.find(y=>y===w)}]);r.valueMapping[w]=P});return}throw new Error(`Unknown preference topic type: ${n.type}`)}}),i.columnToPurposeName[f]=r}),i}function we({currentConsentRecord:c,pendingUpdates:i,preferenceTopics:h}){return Object.entries(i).every(([d,{preferences:a=[],enabled:u}])=>{let l=c.purposes.find(f=>f.purpose===d);return!!l&&l.enabled===u?a.every(({topic:f,choice:s})=>l.preferences&&l.preferences.find(r=>{if(r.topic!==f)return!1;let t=h.find(n=>n.slug===f&&n.purpose.trackingType===d);if(!t)throw new Error(`Could not find preference topic for ${f}`);switch(t.type){case _privacytypes.PreferenceTopicType.Boolean:return r.choice.booleanValue===s.booleanValue;case _privacytypes.PreferenceTopicType.Select:return r.choice.selectValue===s.selectValue;case _privacytypes.PreferenceTopicType.MultiSelect:let n=(r.choice.selectValues||[]).sort(),g=(s.selectValues||[]).sort();return n.length===g.length&&n.every((m,w)=>m===g[w]);default:throw new Error(`Unknown preference topic type: ${t.type}`)}})):!1})}function he({currentConsentRecord:c,pendingUpdates:i,preferenceTopics:h,log:d}){return!!Object.entries(i).find(([a,{preferences:u=[],enabled:l}])=>{let o=c.purposes.find(f=>f.purpose===a);return o?o.enabled!==l?(d&&_chunkZUNVPK23cjs.a.warn(`Purpose ${a} enabled value conflict for user ${c.userId}. Pending Value: ${l}, Current Value: ${o.enabled}`),!0):!!u.find(({topic:f,choice:s})=>{let r=(o.preferences||[]).find(m=>m.topic===f);if(!r)return d&&_chunkZUNVPK23cjs.a.warn(`No existing preference found for topic ${f} in purpose ${a} for user ${c.userId}.`),!1;let t=h.find(m=>m.slug===f&&m.purpose.trackingType===a);if(!t)throw new Error(`Could not find preference topic for ${f}`);let n,g;switch(t.type){case _privacytypes.PreferenceTopicType.Boolean:return n=r.choice.booleanValue!==s.booleanValue,d&&_chunkZUNVPK23cjs.a.warn(`Preference topic ${f} boolean value conflict for user ${c.userId}. Expected: ${s.booleanValue}, Found: ${r.choice.booleanValue}`),n;case _privacytypes.PreferenceTopicType.Select:return g=r.choice.selectValue!==s.selectValue,d&&_chunkZUNVPK23cjs.a.warn(`Preference topic ${f} select value conflict for user ${c.userId}. Expected: ${s.selectValue}, Found: ${r.choice.selectValue}`),g;case _privacytypes.PreferenceTopicType.MultiSelect:let m=(r.choice.selectValues||[]).sort(),w=(s.selectValues||[]).sort();return g=m.length!==w.length||!m.every((P,y)=>P===w[y]),d&&_chunkZUNVPK23cjs.a.warn(`Preference topic ${f} multi-select value conflict for user ${c.userId}. Expected: ${w.join(", ")}, Found: ${m.join(", ")}`),g;default:throw new Error(`Unknown preference topic type: ${t.type}`)}}):(d&&_chunkZUNVPK23cjs.a.warn(`No existing purpose found for ${a} in consent record for ${c.userId}.`),!1)})}async function Pe({file:c,sombra:i,purposeSlugs:h,preferenceTopics:d,partitionKey:a,skipExistingRecordCheck:u,forceTriggerWorkflows:l},o){let f=new Date().getTime(),s=o.getValue("fileMetadata");_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Reading in file: "${c}"`));let r=_chunkJEH3FW7Jcjs.qc.call(void 0, c,j.record(j.string,j.string)),t={columnToPurposeName:{},pendingSafeUpdates:{},pendingConflictUpdates:{},skippedUpdates:{},...s[c]||{},lastFetchedAt:new Date().toISOString()};t=await de(r,t),s[c]=t,await o.setValue(s,"fileMetadata");let n=await ue(r,t);t=n.currentState,r=n.preferences,s[c]=t,await o.setValue(s,"fileMetadata"),t=await ge(r,t,{preferenceTopics:d,purposeSlugs:h,forceTriggerWorkflows:l}),s[c]=t,await o.setValue(s,"fileMetadata");let g=r.map(y=>y[t.identifierColumn]),m=u?[]:await ce(i,{identifiers:g.map(y=>({value:y})),partitionKey:a}),w=_chunkOFZ7ZSEVcjs.e.call(void 0, m,"userId");t.pendingConflictUpdates={},t.pendingSafeUpdates={},t.skippedUpdates={},r.forEach(y=>{let b=y[t.identifierColumn],S=q({row:y,columnToPurposeName:t.columnToPurposeName,preferenceTopics:d,purposeSlugs:h}),v=w[b];if(l&&!v)throw new Error(`No existing consent record found for user with id: ${b}.
4
+ When 'forceTriggerWorkflows' is set all the user identifiers should contain a consent record`);if(v&&we({currentConsentRecord:v,pendingUpdates:S,preferenceTopics:d})&&!l){t.skippedUpdates[b]=y;return}if(v&&he({currentConsentRecord:v,pendingUpdates:S,preferenceTopics:d})){t.pendingConflictUpdates[b]={row:y,record:v};return}t.pendingSafeUpdates[b]=y}),s[c]=t,await o.setValue(s,"fileMetadata");let P=new Date().getTime();_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully pre-processed file: "${c}" in ${(P-f)/1e3}s`))}var be=e.type({purpose:e.string,preference:e.union([e.string,e.null]),valueMapping:e.record(e.string,e.union([e.string,e.boolean,e.null,e.undefined]))}),Kt=e.record(e.string,be),Ae=e.type({name:e.string,isUniqueOnPreferenceStore:e.boolean}),Yt=e.record(e.string,Ae),De=e.intersection([e.type({columnToPurposeName:e.record(e.string,be),lastFetchedAt:e.string,pendingSafeUpdates:e.record(e.string,e.record(e.string,e.string)),pendingConflictUpdates:e.record(e.string,e.type({record:_privacytypes.PreferenceQueryResponseItem,row:e.record(e.string,e.string)})),skippedUpdates:e.record(e.string,e.record(e.string,e.string))}),e.partial({identifierColumn:e.string,timestampColum:e.string})]),Jt=e.record(e.string,e.union([e.boolean,_privacytypes.PreferenceUpdateItem])),zt=e.record(e.string,e.union([e.boolean,e.record(e.string,e.string)])),Ht=e.record(e.string,e.type({uploadedAt:e.string,error:e.string,update:_privacytypes.PreferenceUpdateItem})),Xt=e.record(e.string,e.type({record:_privacytypes.PreferenceQueryResponseItem,row:e.record(e.string,e.string)})),Zt=e.record(e.string,e.record(e.string,e.string)),Ce=e.type({fileMetadata:e.record(e.string,De),failingUpdates:e.record(e.string,e.type({uploadedAt:e.string,error:e.string,update:_privacytypes.PreferenceUpdateItem})),pendingUpdates:e.record(e.string,_privacytypes.PreferenceUpdateItem)});async function Ue({auth:c,sombraAuth:i,receiptFilepath:h,file:d,partition:a,isSilent:u=!0,dryRun:l=!1,skipWorkflowTriggers:o=!1,skipConflictUpdates:f=!1,skipExistingRecordCheck:s=!1,attributes:r=[],transcendUrl:t,forceTriggerWorkflows:n=!1}){let g=_chunkJEH3FW7Jcjs.pc.call(void 0, r),m=new (0, _persistedstate.PersistedState)(h,Ce,{fileMetadata:{},failingUpdates:{},pendingUpdates:{}}),w=m.getValue("failingUpdates"),P=m.getValue("pendingUpdates"),y=m.getValue("fileMetadata");_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Restored cache, there are:
5
5
  ${Object.values(w).length} failing requests to be retried
6
6
  ${Object.values(P).length} pending requests to be processed
7
7
  The following files are stored in cache and will be used:
8
8
  ${Object.keys(y).map($=>$).join(`
9
9
  `)}
10
10
  The following file will be processed: ${d}
11
- `));let b=_chunkEMB64AC3cjs.vc.call(void 0, t,c),[S,v,X]=await Promise.all([_chunkEMB64AC3cjs.wc.call(void 0, t,c,i),n?Promise.resolve([]):_chunkEMB64AC3cjs.dd.call(void 0, b),n?Promise.resolve([]):_chunkEMB64AC3cjs.$c.call(void 0, b)]);await Pe({file:d,purposeSlugs:v.map($=>$.trackingType),preferenceTopics:X,sombra:S,partitionKey:a,skipExistingRecordCheck:s,forceTriggerWorkflows:n},m);let E={};y=m.getValue("fileMetadata");let x=y[d];if(_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Found ${Object.entries(x.pendingSafeUpdates).length} safe updates in ${d}`)),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Found ${Object.entries(x.pendingConflictUpdates).length} conflict updates in ${d}`)),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Found ${Object.entries(x.skippedUpdates).length} skipped updates in ${d}`)),Object.entries({...x.pendingSafeUpdates,...f?{}:_typeutils.apply.call(void 0, x.pendingConflictUpdates,({row:$})=>$)}).forEach(([$,C])=>{let A=x.timestampColum===B?new Date:new Date(C[x.timestampColum]),V=q({row:C,columnToPurposeName:x.columnToPurposeName,preferenceTopics:X,purposeSlugs:v.map(O=>O.trackingType)});E[$]={userId:$,partition:a,timestamp:A.toISOString(),purposes:Object.entries(V).map(([O,Ie])=>({...Ie,purpose:O,workflowSettings:{attributes:g,isSilent:u,skipWorkflowTrigger:o}}))}}),await m.setValue(E,"pendingUpdates"),await m.setValue({},"failingUpdates"),l){_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Dry run complete, exiting. ${Object.values(E).length} pending updates. Check file: ${h}`));return}_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Uploading ${Object.values(E).length} preferences to partition: ${a}`));let Me=new Date().getTime(),Q=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),Z=0,L=Object.entries(E),xe=_chunk4U57O4PScjs.b.call(void 0, L,o?100:10);Q.start(L.length,0),await _bluebird.map.call(void 0, xe,async $=>{try{await S.put("v1/preferences",{json:{records:$.map(([,C])=>C),skipWorkflowTriggers:o,forceTriggerWorkflows:n}}).json()}catch(C){try{let V=JSON.parse(_optionalChain([C, 'optionalAccess', _5 => _5.response, 'optionalAccess', _6 => _6.body])||"{}");V.error&&_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Error: ${V.error}`))}catch (e2){}_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to upload ${$.length} user preferences to partition ${a}: ${_optionalChain([C, 'optionalAccess', _7 => _7.response, 'optionalAccess', _8 => _8.body])||_optionalChain([C, 'optionalAccess', _9 => _9.message])}`));let A=m.getValue("failingUpdates");$.forEach(([V,O])=>{A[V]={uploadedAt:new Date().toISOString(),update:O,error:_optionalChain([C, 'optionalAccess', _10 => _10.response, 'optionalAccess', _11 => _11.body])||_optionalChain([C, 'optionalAccess', _12 => _12.message])||"Unknown error"}}),await m.setValue(A,"failingUpdates")}Z+=$.length,Q.update(Z)},{concurrency:40}),Q.stop();let Ve=new Date().getTime()-Me;_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully uploaded ${L.length} user preferences to partition ${a} in "${Ve/1e3}" seconds!`))}var _fs = require('fs');var _path = require('path');async function jr({auth:c,partition:i,sombraAuth:h,transcendUrl:d,file:a="",directory:u,dryRun:l,skipExistingRecordCheck:o,receiptFileDir:f,skipWorkflowTriggers:s,forceTriggerWorkflows:r,skipConflictUpdates:t,isSilent:n,attributes:g,concurrency:m}){u&&a&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red("Cannot provide both a directory and a file. Please provide only one.")),this.process.exit(1)),!a&&!u&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red("A file or directory must be provided. Please provide one using --file=./preferences.csv or --directory=./preferences")),this.process.exit(1)),_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);let w=[];if(u)try{let y=_fs.readdirSync.call(void 0, u).filter(b=>b.endsWith(".csv"));y.length===0&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`No CSV files found in directory: ${u}`)),this.process.exit(1)),w.push(...y.map(b=>_path.join.call(void 0, u,b)))}catch(P){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to read directory: ${u}`)),_chunkZUNVPK23cjs.a.error(_colors2.default.red(P.message)),this.process.exit(1)}else try{a.endsWith(".csv")||(_chunkZUNVPK23cjs.a.error(_colors2.default.red("File must be a CSV file")),this.process.exit(1)),w.push(a)}catch(P){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to access file: ${a}`)),_chunkZUNVPK23cjs.a.error(_colors2.default.red(P.message)),this.process.exit(1)}_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Processing ${w.length} consent preferences files for partition: ${i}`)),_chunkZUNVPK23cjs.a.debug(`Files to process: ${w.join(", ")}`),o&&_chunkZUNVPK23cjs.a.info(_colors2.default.bgYellow(`Skipping existing record check: ${o}`)),await _bluebird.map.call(void 0, w,async P=>{let y=_path.basename.call(void 0, P).replace(".csv","");await Ue({receiptFilepath:_path.join.call(void 0, f,`${y}-receipts.json`),auth:c,sombraAuth:h,file:P,partition:i,transcendUrl:d,skipConflictUpdates:t,skipWorkflowTriggers:s,skipExistingRecordCheck:o,isSilent:n,dryRun:l,attributes:_chunkEMB64AC3cjs.nc.call(void 0, g),forceTriggerWorkflows:r})},{concurrency:m})}exports.uploadPreferences = jr;
12
- //# sourceMappingURL=impl-A6YXWSI5.cjs.map
11
+ `));let b=_chunkJEH3FW7Jcjs.vc.call(void 0, t,c),[S,v,X]=await Promise.all([_chunkJEH3FW7Jcjs.wc.call(void 0, t,c,i),n?Promise.resolve([]):_chunkJEH3FW7Jcjs.dd.call(void 0, b),n?Promise.resolve([]):_chunkJEH3FW7Jcjs.$c.call(void 0, b)]);await Pe({file:d,purposeSlugs:v.map($=>$.trackingType),preferenceTopics:X,sombra:S,partitionKey:a,skipExistingRecordCheck:s,forceTriggerWorkflows:n},m);let E={};y=m.getValue("fileMetadata");let x=y[d];if(_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Found ${Object.entries(x.pendingSafeUpdates).length} safe updates in ${d}`)),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Found ${Object.entries(x.pendingConflictUpdates).length} conflict updates in ${d}`)),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Found ${Object.entries(x.skippedUpdates).length} skipped updates in ${d}`)),Object.entries({...x.pendingSafeUpdates,...f?{}:_typeutils.apply.call(void 0, x.pendingConflictUpdates,({row:$})=>$)}).forEach(([$,C])=>{let A=x.timestampColum===B?new Date:new Date(C[x.timestampColum]),V=q({row:C,columnToPurposeName:x.columnToPurposeName,preferenceTopics:X,purposeSlugs:v.map(O=>O.trackingType)});E[$]={userId:$,partition:a,timestamp:A.toISOString(),purposes:Object.entries(V).map(([O,Ie])=>({...Ie,purpose:O,workflowSettings:{attributes:g,isSilent:u,skipWorkflowTrigger:o}}))}}),await m.setValue(E,"pendingUpdates"),await m.setValue({},"failingUpdates"),l){_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Dry run complete, exiting. ${Object.values(E).length} pending updates. Check file: ${h}`));return}_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Uploading ${Object.values(E).length} preferences to partition: ${a}`));let Me=new Date().getTime(),Q=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),Z=0,L=Object.entries(E),xe=_chunkOFZ7ZSEVcjs.b.call(void 0, L,o?100:10);Q.start(L.length,0),await _bluebird.map.call(void 0, xe,async $=>{try{await S.put("v1/preferences",{json:{records:$.map(([,C])=>C),skipWorkflowTriggers:o,forceTriggerWorkflows:n}}).json()}catch(C){try{let V=JSON.parse(_optionalChain([C, 'optionalAccess', _5 => _5.response, 'optionalAccess', _6 => _6.body])||"{}");V.error&&_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Error: ${V.error}`))}catch (e2){}_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to upload ${$.length} user preferences to partition ${a}: ${_optionalChain([C, 'optionalAccess', _7 => _7.response, 'optionalAccess', _8 => _8.body])||_optionalChain([C, 'optionalAccess', _9 => _9.message])}`));let A=m.getValue("failingUpdates");$.forEach(([V,O])=>{A[V]={uploadedAt:new Date().toISOString(),update:O,error:_optionalChain([C, 'optionalAccess', _10 => _10.response, 'optionalAccess', _11 => _11.body])||_optionalChain([C, 'optionalAccess', _12 => _12.message])||"Unknown error"}}),await m.setValue(A,"failingUpdates")}Z+=$.length,Q.update(Z)},{concurrency:40}),Q.stop();let Ve=new Date().getTime()-Me;_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully uploaded ${L.length} user preferences to partition ${a} in "${Ve/1e3}" seconds!`))}var _fs = require('fs');var _path = require('path');async function jr({auth:c,partition:i,sombraAuth:h,transcendUrl:d,file:a="",directory:u,dryRun:l,skipExistingRecordCheck:o,receiptFileDir:f,skipWorkflowTriggers:s,forceTriggerWorkflows:r,skipConflictUpdates:t,isSilent:n,attributes:g,concurrency:m}){u&&a&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red("Cannot provide both a directory and a file. Please provide only one.")),this.process.exit(1)),!a&&!u&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red("A file or directory must be provided. Please provide one using --file=./preferences.csv or --directory=./preferences")),this.process.exit(1)),_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);let w=[];if(u)try{let y=_fs.readdirSync.call(void 0, u).filter(b=>b.endsWith(".csv"));y.length===0&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`No CSV files found in directory: ${u}`)),this.process.exit(1)),w.push(...y.map(b=>_path.join.call(void 0, u,b)))}catch(P){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to read directory: ${u}`)),_chunkZUNVPK23cjs.a.error(_colors2.default.red(P.message)),this.process.exit(1)}else try{a.endsWith(".csv")||(_chunkZUNVPK23cjs.a.error(_colors2.default.red("File must be a CSV file")),this.process.exit(1)),w.push(a)}catch(P){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to access file: ${a}`)),_chunkZUNVPK23cjs.a.error(_colors2.default.red(P.message)),this.process.exit(1)}_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Processing ${w.length} consent preferences files for partition: ${i}`)),_chunkZUNVPK23cjs.a.debug(`Files to process: ${w.join(", ")}`),o&&_chunkZUNVPK23cjs.a.info(_colors2.default.bgYellow(`Skipping existing record check: ${o}`)),await _bluebird.map.call(void 0, w,async P=>{let y=_path.basename.call(void 0, P).replace(".csv","");await Ue({receiptFilepath:_path.join.call(void 0, f,`${y}-receipts.json`),auth:c,sombraAuth:h,file:P,partition:i,transcendUrl:d,skipConflictUpdates:t,skipWorkflowTriggers:s,skipExistingRecordCheck:o,isSilent:n,dryRun:l,attributes:_chunkJEH3FW7Jcjs.nc.call(void 0, g),forceTriggerWorkflows:r})},{concurrency:m})}exports.uploadPreferences = jr;
12
+ //# sourceMappingURL=impl-6A3ARA2O.cjs.map