@transcend-io/cli 7.0.0 → 8.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/bash-complete.js +4 -0
- package/dist/bin/bash-complete.js.map +1 -0
- package/dist/bin/cli.js +3 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/bin/deprecated-command.js +7 -0
- package/dist/bin/deprecated-command.js.map +1 -0
- package/dist/chunk-26T4RUOI.js +12 -0
- package/dist/chunk-26T4RUOI.js.map +1 -0
- package/dist/chunk-2LCGZ77N.js +2 -0
- package/dist/chunk-2LCGZ77N.js.map +1 -0
- package/dist/chunk-2V6ABZRI.js +2 -0
- package/dist/chunk-2V6ABZRI.js.map +1 -0
- package/dist/chunk-347UQP43.js +2 -0
- package/dist/chunk-347UQP43.js.map +1 -0
- package/dist/chunk-43JWXG77.js +2 -0
- package/dist/chunk-43JWXG77.js.map +1 -0
- package/dist/chunk-4GLITB3Y.js +2 -0
- package/dist/chunk-4GLITB3Y.js.map +1 -0
- package/dist/chunk-65I2PF73.js +2 -0
- package/dist/chunk-65I2PF73.js.map +1 -0
- package/dist/chunk-72U6ETHG.js +2 -0
- package/dist/chunk-72U6ETHG.js.map +1 -0
- package/dist/chunk-ARVEJERC.js +2 -0
- package/dist/chunk-ARVEJERC.js.map +1 -0
- package/dist/chunk-CBAHSBSW.js +2 -0
- package/dist/{chunk-UBUNHRCG.cjs.map → chunk-CBAHSBSW.js.map} +1 -1
- package/dist/chunk-EZHASXA5.js +2 -0
- package/dist/chunk-EZHASXA5.js.map +1 -0
- package/dist/chunk-FHZRITAV.js +2 -0
- package/dist/chunk-FHZRITAV.js.map +1 -0
- package/dist/chunk-HJULYIHF.js +3 -0
- package/dist/chunk-HJULYIHF.js.map +1 -0
- package/dist/chunk-HOZXN2EM.js +94 -0
- package/dist/chunk-HOZXN2EM.js.map +1 -0
- package/dist/chunk-L5ULN3IT.js +2 -0
- package/dist/chunk-L5ULN3IT.js.map +1 -0
- package/dist/chunk-L7ZIX4SU.js +2 -0
- package/dist/chunk-L7ZIX4SU.js.map +1 -0
- package/dist/chunk-LAYHULHH.js +2 -0
- package/dist/chunk-LAYHULHH.js.map +1 -0
- package/dist/chunk-MA4JWWRO.js +6 -0
- package/dist/chunk-MA4JWWRO.js.map +1 -0
- package/dist/chunk-MK5T6DBK.js +2831 -0
- package/dist/chunk-MK5T6DBK.js.map +1 -0
- package/dist/chunk-N6JZHL5U.js +2 -0
- package/dist/chunk-N6JZHL5U.js.map +1 -0
- package/dist/chunk-NZZKRVAI.js +4 -0
- package/dist/chunk-NZZKRVAI.js.map +1 -0
- package/dist/chunk-OEB7WG3G.js +4 -0
- package/dist/chunk-OEB7WG3G.js.map +1 -0
- package/dist/chunk-SRLEEKKQ.js +9 -0
- package/dist/chunk-SRLEEKKQ.js.map +1 -0
- package/dist/chunk-WO5MQBXP.js +75 -0
- package/dist/chunk-WO5MQBXP.js.map +1 -0
- package/dist/impl-24IS3GIF.js +2 -0
- package/dist/impl-24IS3GIF.js.map +1 -0
- package/dist/impl-3YESYKVQ.js +2 -0
- package/dist/impl-3YESYKVQ.js.map +1 -0
- package/dist/impl-6MGNPY7O.js +2 -0
- package/dist/impl-6MGNPY7O.js.map +1 -0
- package/dist/impl-6SYXV3YI.js +2 -0
- package/dist/impl-6SYXV3YI.js.map +1 -0
- package/dist/impl-BVOF3W2V.js +4 -0
- package/dist/impl-BVOF3W2V.js.map +1 -0
- package/dist/impl-D4AEXEMN.js +12 -0
- package/dist/impl-D4AEXEMN.js.map +1 -0
- package/dist/impl-EAY4M3OY.js +2 -0
- package/dist/impl-EAY4M3OY.js.map +1 -0
- package/dist/impl-F4IQEKTF.js +9 -0
- package/dist/impl-F4IQEKTF.js.map +1 -0
- package/dist/impl-G4JGSVWD.js +2 -0
- package/dist/impl-G4JGSVWD.js.map +1 -0
- package/dist/impl-HFXHM3PH.js +2 -0
- package/dist/impl-HFXHM3PH.js.map +1 -0
- package/dist/impl-HMHOYOZZ.js +2 -0
- package/dist/impl-HMHOYOZZ.js.map +1 -0
- package/dist/impl-IU4EANSX.js +7 -0
- package/dist/impl-IU4EANSX.js.map +1 -0
- package/dist/impl-IWDHKBWZ.js +2 -0
- package/dist/impl-IWDHKBWZ.js.map +1 -0
- package/dist/impl-JFD2JMP6.js +2 -0
- package/dist/impl-JFD2JMP6.js.map +1 -0
- package/dist/impl-JH4VBMNT.js +2 -0
- package/dist/impl-JH4VBMNT.js.map +1 -0
- package/dist/impl-LSP4V37Z.js +6 -0
- package/dist/impl-LSP4V37Z.js.map +1 -0
- package/dist/impl-MIJFNSLS.js +2 -0
- package/dist/impl-MIJFNSLS.js.map +1 -0
- package/dist/impl-NL32KFH4.js +2 -0
- package/dist/impl-NL32KFH4.js.map +1 -0
- package/dist/impl-NLCPSIYZ.js +2 -0
- package/dist/impl-NLCPSIYZ.js.map +1 -0
- package/dist/impl-NXRQU2U5.js +6 -0
- package/dist/impl-NXRQU2U5.js.map +1 -0
- package/dist/impl-QEOVZIM5.js +2 -0
- package/dist/impl-QEOVZIM5.js.map +1 -0
- package/dist/impl-QRK4B3FD.js +2 -0
- package/dist/impl-QRK4B3FD.js.map +1 -0
- package/dist/impl-QZBKOJBQ.js +2 -0
- package/dist/impl-QZBKOJBQ.js.map +1 -0
- package/dist/impl-RFRQUKQY.js +2 -0
- package/dist/impl-RFRQUKQY.js.map +1 -0
- package/dist/impl-RIVVHWBR.js +2 -0
- package/dist/impl-RIVVHWBR.js.map +1 -0
- package/dist/impl-SJHU5PR7.js +2 -0
- package/dist/impl-SJHU5PR7.js.map +1 -0
- package/dist/impl-SYC5TORT.js +2 -0
- package/dist/impl-SYC5TORT.js.map +1 -0
- package/dist/impl-TP4QITXR.js +2 -0
- package/dist/impl-TP4QITXR.js.map +1 -0
- package/dist/impl-UOB7PV4W.js +2 -0
- package/dist/impl-UOB7PV4W.js.map +1 -0
- package/dist/impl-UUQ2BEZR.js +2 -0
- package/dist/impl-UUQ2BEZR.js.map +1 -0
- package/dist/impl-WH2I2JB7.js +2 -0
- package/dist/impl-WH2I2JB7.js.map +1 -0
- package/dist/impl-X6N6NFUV.js +6 -0
- package/dist/impl-X6N6NFUV.js.map +1 -0
- package/dist/impl-XF3OTAQZ.js +2 -0
- package/dist/impl-XF3OTAQZ.js.map +1 -0
- package/dist/impl-XH3KTZRN.js +2 -0
- package/dist/{impl-EJT3AX73.cjs.map → impl-XH3KTZRN.js.map} +1 -1
- package/dist/impl-XQBTTRCU.js +2 -0
- package/dist/impl-XQBTTRCU.js.map +1 -0
- package/dist/impl-YA2HU57Y.js +2 -0
- package/dist/impl-YA2HU57Y.js.map +1 -0
- package/dist/impl-YEGS4G24.js +2 -0
- package/dist/impl-YEGS4G24.js.map +1 -0
- package/dist/impl-YNBHGQJK.js +2 -0
- package/dist/impl-YNBHGQJK.js.map +1 -0
- package/dist/impl-ZJL2YE7A.js +2 -0
- package/dist/impl-ZJL2YE7A.js.map +1 -0
- package/dist/{index.d.cts → index.d.ts} +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/package.json +45 -48
- package/dist/bin/bash-complete.cjs +0 -4
- package/dist/bin/bash-complete.cjs.map +0 -1
- package/dist/bin/cli.cjs +0 -3
- package/dist/bin/cli.cjs.map +0 -1
- package/dist/bin/deprecated-command.cjs +0 -7
- package/dist/bin/deprecated-command.cjs.map +0 -1
- package/dist/chunk-ANCIGXE5.cjs +0 -4
- package/dist/chunk-ANCIGXE5.cjs.map +0 -1
- package/dist/chunk-AW6I4V4F.cjs +0 -3
- package/dist/chunk-AW6I4V4F.cjs.map +0 -1
- package/dist/chunk-BY7W4UQF.cjs +0 -2
- package/dist/chunk-BY7W4UQF.cjs.map +0 -1
- package/dist/chunk-CHTWXNEA.cjs +0 -2
- package/dist/chunk-CHTWXNEA.cjs.map +0 -1
- package/dist/chunk-DS6VH676.cjs +0 -2
- package/dist/chunk-DS6VH676.cjs.map +0 -1
- package/dist/chunk-EG4L6YAJ.cjs +0 -2
- package/dist/chunk-EG4L6YAJ.cjs.map +0 -1
- package/dist/chunk-ETNRSKUM.cjs +0 -2
- package/dist/chunk-ETNRSKUM.cjs.map +0 -1
- package/dist/chunk-GM2EDRKN.cjs +0 -12
- package/dist/chunk-GM2EDRKN.cjs.map +0 -1
- package/dist/chunk-IBTP5OXE.cjs +0 -2
- package/dist/chunk-IBTP5OXE.cjs.map +0 -1
- package/dist/chunk-KOV2SQO2.cjs +0 -4
- package/dist/chunk-KOV2SQO2.cjs.map +0 -1
- package/dist/chunk-LBDIZJ23.cjs +0 -2844
- package/dist/chunk-LBDIZJ23.cjs.map +0 -1
- package/dist/chunk-LZYEIVWM.cjs +0 -94
- package/dist/chunk-LZYEIVWM.cjs.map +0 -1
- package/dist/chunk-MPJABCSW.cjs +0 -75
- package/dist/chunk-MPJABCSW.cjs.map +0 -1
- package/dist/chunk-R5N2S5UU.cjs +0 -2
- package/dist/chunk-R5N2S5UU.cjs.map +0 -1
- package/dist/chunk-RW5GSSAA.cjs +0 -2
- package/dist/chunk-RW5GSSAA.cjs.map +0 -1
- package/dist/chunk-RZWMOCW3.cjs +0 -2
- package/dist/chunk-RZWMOCW3.cjs.map +0 -1
- package/dist/chunk-SAEKBZGF.cjs +0 -2
- package/dist/chunk-SAEKBZGF.cjs.map +0 -1
- package/dist/chunk-T462ONFX.cjs +0 -2
- package/dist/chunk-T462ONFX.cjs.map +0 -1
- package/dist/chunk-TD7ADMVO.cjs +0 -2
- package/dist/chunk-TD7ADMVO.cjs.map +0 -1
- package/dist/chunk-UBUNHRCG.cjs +0 -2
- package/dist/chunk-UEGX6GZ2.cjs +0 -2
- package/dist/chunk-UEGX6GZ2.cjs.map +0 -1
- package/dist/chunk-VCWGXJ2H.cjs +0 -9
- package/dist/chunk-VCWGXJ2H.cjs.map +0 -1
- package/dist/chunk-ZUNVPK23.cjs +0 -2
- package/dist/chunk-ZUNVPK23.cjs.map +0 -1
- package/dist/chunk-ZVK4HIDF.cjs +0 -6
- package/dist/chunk-ZVK4HIDF.cjs.map +0 -1
- package/dist/impl-2GU6CYMY.cjs +0 -2
- package/dist/impl-2GU6CYMY.cjs.map +0 -1
- package/dist/impl-2OEHQTIR.cjs +0 -2
- package/dist/impl-2OEHQTIR.cjs.map +0 -1
- package/dist/impl-2QXJ3WST.cjs +0 -9
- package/dist/impl-2QXJ3WST.cjs.map +0 -1
- package/dist/impl-442H4ODN.cjs +0 -7
- package/dist/impl-442H4ODN.cjs.map +0 -1
- package/dist/impl-44QRPPUX.cjs +0 -6
- package/dist/impl-44QRPPUX.cjs.map +0 -1
- package/dist/impl-4DOGSDPC.cjs +0 -2
- package/dist/impl-4DOGSDPC.cjs.map +0 -1
- package/dist/impl-5J3MG42D.cjs +0 -2
- package/dist/impl-5J3MG42D.cjs.map +0 -1
- package/dist/impl-5YMSNFJU.cjs +0 -2
- package/dist/impl-5YMSNFJU.cjs.map +0 -1
- package/dist/impl-6TBKGA4Y.cjs +0 -2
- package/dist/impl-6TBKGA4Y.cjs.map +0 -1
- package/dist/impl-7VYQSZVO.cjs +0 -2
- package/dist/impl-7VYQSZVO.cjs.map +0 -1
- package/dist/impl-BB24LU3N.cjs +0 -2
- package/dist/impl-BB24LU3N.cjs.map +0 -1
- package/dist/impl-CWZ26FTN.cjs +0 -2
- package/dist/impl-CWZ26FTN.cjs.map +0 -1
- package/dist/impl-EFTKRWUA.cjs +0 -2
- package/dist/impl-EFTKRWUA.cjs.map +0 -1
- package/dist/impl-EJT3AX73.cjs +0 -2
- package/dist/impl-EKQ6ZNN3.cjs +0 -2
- package/dist/impl-EKQ6ZNN3.cjs.map +0 -1
- package/dist/impl-EV6T5UOK.cjs +0 -6
- package/dist/impl-EV6T5UOK.cjs.map +0 -1
- package/dist/impl-FPFUAY4Q.cjs +0 -2
- package/dist/impl-FPFUAY4Q.cjs.map +0 -1
- package/dist/impl-GDKUHX2J.cjs +0 -2
- package/dist/impl-GDKUHX2J.cjs.map +0 -1
- package/dist/impl-GXDABG5X.cjs +0 -2
- package/dist/impl-GXDABG5X.cjs.map +0 -1
- package/dist/impl-IG7QEF6D.cjs +0 -2
- package/dist/impl-IG7QEF6D.cjs.map +0 -1
- package/dist/impl-JQLYJA5L.cjs +0 -2
- package/dist/impl-JQLYJA5L.cjs.map +0 -1
- package/dist/impl-LPI3M7L3.cjs +0 -6
- package/dist/impl-LPI3M7L3.cjs.map +0 -1
- package/dist/impl-M7WMSIK4.cjs +0 -4
- package/dist/impl-M7WMSIK4.cjs.map +0 -1
- package/dist/impl-MRGZ5OLO.cjs +0 -2
- package/dist/impl-MRGZ5OLO.cjs.map +0 -1
- package/dist/impl-OI4UWRAU.cjs +0 -12
- package/dist/impl-OI4UWRAU.cjs.map +0 -1
- package/dist/impl-OX24YDRR.cjs +0 -2
- package/dist/impl-OX24YDRR.cjs.map +0 -1
- package/dist/impl-PFQKPCUL.cjs +0 -2
- package/dist/impl-PFQKPCUL.cjs.map +0 -1
- package/dist/impl-PXJZK6BV.cjs +0 -2
- package/dist/impl-PXJZK6BV.cjs.map +0 -1
- package/dist/impl-QOGUUIE6.cjs +0 -2
- package/dist/impl-QOGUUIE6.cjs.map +0 -1
- package/dist/impl-QR3LLBZL.cjs +0 -2
- package/dist/impl-QR3LLBZL.cjs.map +0 -1
- package/dist/impl-RODUB22E.cjs +0 -2
- package/dist/impl-RODUB22E.cjs.map +0 -1
- package/dist/impl-S56PHXGG.cjs +0 -2
- package/dist/impl-S56PHXGG.cjs.map +0 -1
- package/dist/impl-SDGCTSWN.cjs +0 -2
- package/dist/impl-SDGCTSWN.cjs.map +0 -1
- package/dist/impl-VEMQEG27.cjs +0 -2
- package/dist/impl-VEMQEG27.cjs.map +0 -1
- package/dist/impl-VFWBSWT5.cjs +0 -2
- package/dist/impl-VFWBSWT5.cjs.map +0 -1
- package/dist/impl-XRRNIJUK.cjs +0 -2
- package/dist/impl-XRRNIJUK.cjs.map +0 -1
- package/dist/impl-YA7HWMYB.cjs +0 -2
- package/dist/impl-YA7HWMYB.cjs.map +0 -1
- package/dist/impl-YOWRUVYG.cjs +0 -2
- package/dist/impl-YOWRUVYG.cjs.map +0 -1
- package/dist/impl-ZHZOMOST.cjs +0 -2
- package/dist/impl-ZHZOMOST.cjs.map +0 -1
- package/dist/index.cjs +0 -5
- package/dist/index.cjs.map +0 -1
- /package/dist/bin/{bash-complete.d.cts → bash-complete.d.ts} +0 -0
- /package/dist/bin/{cli.d.cts → cli.d.ts} +0 -0
- /package/dist/bin/{deprecated-command.d.cts → deprecated-command.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/inventory/pull/impl.ts"],"sourcesContent":["import { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport type { LocalContext } from '../../../context';\nimport { TranscendPullResource } from '../../../enums';\nimport {\n DEFAULT_CONSENT_TRACKER_STATUSES,\n DEFAULT_TRANSCEND_PULL_RESOURCES,\n} from './command';\n\nimport { logger } from '../../../logger';\nimport colors from 'colors';\nimport { mapSeries } from '../../../lib/bluebird-replace';\nimport { join } from 'path';\nimport fs from 'fs';\nimport {\n buildTranscendGraphQLClient,\n pullTranscendConfiguration,\n} from '../../../lib/graphql';\n\nimport { writeTranscendYaml } from '../../../lib/readTranscendYaml';\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants';\nimport { validateTranscendAuth } from '../../../lib/api-keys';\n\ninterface PullCommandFlags {\n auth: string;\n resources?: (TranscendPullResource | 'all')[];\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n integrationNames?: string[];\n trackerStatuses?: ConsentTrackerStatus[];\n pageSize: number;\n skipDatapoints: boolean;\n skipSubDatapoints: boolean;\n includeGuessedCategories: boolean;\n debug: boolean;\n}\n\nexport async function pull(\n this: LocalContext,\n {\n auth,\n resources = DEFAULT_TRANSCEND_PULL_RESOURCES,\n file,\n transcendUrl,\n dataSiloIds = [],\n integrationNames = [],\n trackerStatuses = DEFAULT_CONSENT_TRACKER_STATUSES,\n pageSize,\n skipDatapoints,\n skipSubDatapoints,\n includeGuessedCategories,\n debug,\n }: PullCommandFlags,\n): Promise<void> {\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n const resourcesToPull: TranscendPullResource[] = resources.includes('all')\n ? Object.values(TranscendPullResource)\n : (resources as TranscendPullResource[]);\n\n // Sync to Disk\n if (typeof apiKeyOrList === 'string') {\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKeyOrList);\n\n const configuration = await pullTranscendConfiguration(client, {\n dataSiloIds,\n integrationNames,\n resources: resourcesToPull,\n pageSize,\n debug,\n skipDatapoints,\n skipSubDatapoints,\n includeGuessedCategories,\n trackerStatuses,\n });\n\n logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n writeTranscendYaml(file, configuration);\n } catch (err) {\n logger.error(\n colors.red(\n `An error occurred syncing the schema: ${\n debug ? err.stack : err.message\n }`,\n ),\n );\n process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced yaml file to disk at ${file}! View at ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n } else {\n if (!fs.lstatSync(file).isDirectory()) {\n throw new Error(\n 'File is expected to be a folder when passing in a list of API keys to pull from. e.g. --file=./working/',\n );\n }\n\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${\n apiKey.organizationName\n }] `;\n logger.info(\n colors.magenta(\n `~~~\\n\\n${prefix}Attempting to pull configuration...\\n\\n~~~`,\n ),\n );\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKey.apiKey);\n\n try {\n const configuration = await pullTranscendConfiguration(client, {\n dataSiloIds,\n integrationNames,\n resources: resourcesToPull,\n pageSize,\n debug,\n skipDatapoints,\n skipSubDatapoints,\n includeGuessedCategories,\n trackerStatuses,\n });\n\n const filePath = join(file, `${apiKey.organizationName}.yml`);\n logger.info(\n colors.magenta(`Writing configuration to file \"${filePath}\"...`),\n );\n writeTranscendYaml(filePath, configuration);\n\n logger.info(\n colors.green(`${prefix}Successfully pulled configuration!`),\n );\n } catch (err) {\n logger.error(\n colors.red(`${prefix}Failed to sync configuration. - ${err.message}`),\n );\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n logger.info(\n colors.red(\n `Sync encountered errors for \"${encounteredErrors.join(\n ',',\n )}\". View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n process.exit(1);\n }\n }\n}\n"],"mappings":"mYASA,OAAOA,MAAY,SAEnB,OAAS,QAAAC,MAAY,OACrB,OAAOC,MAAQ,KAyBf,eAAsBC,EAEpB,CACE,KAAAC,EACA,UAAAC,EAAYC,EACZ,KAAAC,EACA,aAAAC,EACA,YAAAC,EAAc,CAAC,EACf,iBAAAC,EAAmB,CAAC,EACpB,gBAAAC,EAAkBC,EAClB,SAAAC,EACA,eAAAC,EACA,kBAAAC,EACA,yBAAAC,EACA,MAAAC,CACF,EACe,CAEf,IAAMC,EAAe,MAAMC,EAAsBf,CAAI,EAE/CgB,EAA2Cf,EAAU,SAAS,KAAK,EACrE,OAAO,OAAOgB,CAAqB,EAClChB,EAGL,GAAI,OAAOa,GAAiB,SAAU,CACpC,GAAI,CAEF,IAAMI,EAASC,EAA4Bf,EAAcU,CAAY,EAE/DM,EAAgB,MAAMC,EAA2BH,EAAQ,CAC7D,YAAAb,EACA,iBAAAC,EACA,UAAWU,EACX,SAAAP,EACA,MAAAI,EACA,eAAAH,EACA,kBAAAC,EACA,yBAAAC,EACA,gBAAAL,CACF,CAAC,EAEDe,EAAO,KAAKC,EAAO,QAAQ,kCAAkCpB,CAAI,MAAM,CAAC,EACxEqB,EAAmBrB,EAAMiB,CAAa,CACxC,OAASK,EAAK,CACZH,EAAO,MACLC,EAAO,IACL,yCACEV,EAAQY,EAAI,MAAQA,EAAI,OAC1B,EACF,CACF,EACA,QAAQ,KAAK,CAAC,CAChB,CAGAH,EAAO,KACLC,EAAO,MACL,4CAA4CpB,CAAI,aAAauB,CAAuB,EACtF,CACF,CACF,KAAO,CACL,GAAI,CAACC,EAAG,UAAUxB,CAAI,EAAE,YAAY,EAClC,MAAM,IAAI,MACR,yGACF,EAGF,IAAMyB,EAA8B,CAAC,EACrC,MAAMC,EAAUf,EAAc,MAAOgB,EAAQC,IAAQ,CACnD,IAAMC,EAAS,IAAID,EAAM,CAAC,IAAIjB,EAAa,MAAM,KAC/CgB,EAAO,gBACT,KACAR,EAAO,KACLC,EAAO,QACL;AAAA;AAAA,EAAUS,CAAM;AAAA;AAAA,IAClB,CACF,EAGA,IAAMd,EAASC,EAA4Bf,EAAc0B,EAAO,MAAM,EAEtE,GAAI,CACF,IAAMV,EAAgB,MAAMC,EAA2BH,EAAQ,CAC7D,YAAAb,EACA,iBAAAC,EACA,UAAWU,EACX,SAAAP,EACA,MAAAI,EACA,eAAAH,EACA,kBAAAC,EACA,yBAAAC,EACA,gBAAAL,CACF,CAAC,EAEK0B,EAAWC,EAAK/B,EAAM,GAAG2B,EAAO,gBAAgB,MAAM,EAC5DR,EAAO,KACLC,EAAO,QAAQ,kCAAkCU,CAAQ,MAAM,CACjE,EACAT,EAAmBS,EAAUb,CAAa,EAE1CE,EAAO,KACLC,EAAO,MAAM,GAAGS,CAAM,oCAAoC,CAC5D,CACF,OAASP,EAAK,CACZH,EAAO,MACLC,EAAO,IAAI,GAAGS,CAAM,mCAAmCP,EAAI,OAAO,EAAE,CACtE,EACAG,EAAkB,KAAKE,EAAO,gBAAgB,CAChD,CACF,CAAC,EAEGF,EAAkB,OAAS,IAC7BN,EAAO,KACLC,EAAO,IACL,gCAAgCK,EAAkB,KAChD,GACF,CAAC,2DAA2DF,CAAuB,EACrF,CACF,EAEA,QAAQ,KAAK,CAAC,EAElB,CACF","names":["colors","join","fs","pull","auth","resources","DEFAULT_TRANSCEND_PULL_RESOURCES","file","transcendUrl","dataSiloIds","integrationNames","trackerStatuses","DEFAULT_CONSENT_TRACKER_STATUSES","pageSize","skipDatapoints","skipSubDatapoints","includeGuessedCategories","debug","apiKeyOrList","validateTranscendAuth","resourcesToPull","TranscendPullResource","client","buildTranscendGraphQLClient","configuration","pullTranscendConfiguration","logger","colors","writeTranscendYaml","err","ADMIN_DASH_INTEGRATIONS","fs","encounteredErrors","mapSeries","apiKey","ind","prefix","filePath","join"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as p}from"./chunk-CBAHSBSW.js";import{d as c,e as l}from"./chunk-OEB7WG3G.js";import{c as d}from"./chunk-65I2PF73.js";import"./chunk-LAYHULHH.js";import"./chunk-347UQP43.js";import{ne as m,pe as g}from"./chunk-MK5T6DBK.js";import{a as o}from"./chunk-43JWXG77.js";import"./chunk-L5ULN3IT.js";import"./chunk-EZHASXA5.js";import"./chunk-ARVEJERC.js";import{join as f}from"path";import e from"colors";import{existsSync as D,lstatSync as h}from"fs";async function M({auth:x,dataFlowsYmlFolder:r,dataSilosYmlFolder:t,ignoreYmls:S=[],transcendUrl:T}){r||(o.error(e.red("Missing required arg: --dataFlowsYmlFolder=./working/data-flows/")),process.exit(1)),(!D(r)||!h(r).isDirectory())&&(o.error(e.red(`Folder does not exist: "${r}"`)),process.exit(1)),t||(o.error(e.red("Missing required arg: --dataSilosYmlFolder=./working/data-silos/")),process.exit(1)),(!D(t)||!h(t).isDirectory())&&(o.error(e.red(`Folder does not exist: "${t}"`)),process.exit(1));let w=g(T,x),{serviceToTitle:u,serviceToSupportedIntegration:v}=await m(w);d(r).forEach(i=>{let{"data-flows":F=[]}=c(f(r,i)),{adTechDataSilos:s,siteTechDataSilos:a}=p(F,{serviceToSupportedIntegration:v,serviceToTitle:u}),n=[...s,...a];o.log(`Total Services: ${n.length}`),o.log(`Ad Tech Services: ${s.length}`),o.log(`Site Tech Services: ${a.length}`),l(f(t,i),{"data-silos":S.includes(i)?[]:n})})}export{M as deriveDataSilosFromDataFlows};
|
|
2
|
+
//# sourceMappingURL=impl-QEOVZIM5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/inventory/derive-data-silos-from-data-flows/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport {\n fetchAndIndexCatalogs,\n buildTranscendGraphQLClient,\n} from '../../../lib/graphql';\nimport { join } from 'path';\nimport colors from 'colors';\nimport { logger } from '../../../logger';\nimport { dataFlowsToDataSilos } from '../../../lib/consent-manager/dataFlowsToDataSilos';\nimport { DataFlowInput } from '../../../codecs';\nimport { existsSync, lstatSync } from 'fs';\nimport { listFiles } from '../../../lib/api-keys';\nimport {\n readTranscendYaml,\n writeTranscendYaml,\n} from '../../../lib/readTranscendYaml';\n\ninterface DeriveDataSilosFromDataFlowsCommandFlags {\n auth: string;\n dataFlowsYmlFolder: string;\n dataSilosYmlFolder: string;\n ignoreYmls?: string[];\n transcendUrl: string;\n}\n\nexport async function deriveDataSilosFromDataFlows(\n this: LocalContext,\n {\n auth,\n dataFlowsYmlFolder,\n dataSilosYmlFolder,\n ignoreYmls = [],\n transcendUrl,\n }: DeriveDataSilosFromDataFlowsCommandFlags,\n): Promise<void> {\n // Ensure folder is passed to dataFlowsYmlFolder\n if (!dataFlowsYmlFolder) {\n logger.error(\n colors.red(\n 'Missing required arg: --dataFlowsYmlFolder=./working/data-flows/',\n ),\n );\n process.exit(1);\n }\n\n // Ensure folder is passed\n if (\n !existsSync(dataFlowsYmlFolder) ||\n !lstatSync(dataFlowsYmlFolder).isDirectory()\n ) {\n logger.error(colors.red(`Folder does not exist: \"${dataFlowsYmlFolder}\"`));\n process.exit(1);\n }\n\n // Ensure folder is passed to dataSilosYmlFolder\n if (!dataSilosYmlFolder) {\n logger.error(\n colors.red(\n 'Missing required arg: --dataSilosYmlFolder=./working/data-silos/',\n ),\n );\n process.exit(1);\n }\n\n // Ensure folder is passed\n if (\n !existsSync(dataSilosYmlFolder) ||\n !lstatSync(dataSilosYmlFolder).isDirectory()\n ) {\n logger.error(colors.red(`Folder does not exist: \"${dataSilosYmlFolder}\"`));\n process.exit(1);\n }\n\n // Fetch all integrations in the catalog\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const { serviceToTitle, serviceToSupportedIntegration } =\n await fetchAndIndexCatalogs(client);\n\n // List of each data flow yml file\n listFiles(dataFlowsYmlFolder).forEach((directory) => {\n // read in the data flows for a specific instance\n const { 'data-flows': dataFlows = [] } = readTranscendYaml(\n join(dataFlowsYmlFolder, directory),\n );\n\n // map the data flows to data silos\n const { adTechDataSilos, siteTechDataSilos } = dataFlowsToDataSilos(\n dataFlows as DataFlowInput[],\n {\n serviceToSupportedIntegration,\n serviceToTitle,\n },\n );\n\n // combine and write to yml file\n const dataSilos = [...adTechDataSilos, ...siteTechDataSilos];\n logger.log(`Total Services: ${dataSilos.length}`);\n logger.log(`Ad Tech Services: ${adTechDataSilos.length}`);\n logger.log(`Site Tech Services: ${siteTechDataSilos.length}`);\n writeTranscendYaml(join(dataSilosYmlFolder, directory), {\n 'data-silos': ignoreYmls.includes(directory) ? [] : dataSilos,\n });\n });\n}\n"],"mappings":"oWAKA,OAAS,QAAAA,MAAY,OACrB,OAAOC,MAAY,SAInB,OAAS,cAAAC,EAAY,aAAAC,MAAiB,KAetC,eAAsBC,EAEpB,CACE,KAAAC,EACA,mBAAAC,EACA,mBAAAC,EACA,WAAAC,EAAa,CAAC,EACd,aAAAC,CACF,EACe,CAEVH,IACHI,EAAO,MACLC,EAAO,IACL,kEACF,CACF,EACA,QAAQ,KAAK,CAAC,IAKd,CAACC,EAAWN,CAAkB,GAC9B,CAACO,EAAUP,CAAkB,EAAE,YAAY,KAE3CI,EAAO,MAAMC,EAAO,IAAI,2BAA2BL,CAAkB,GAAG,CAAC,EACzE,QAAQ,KAAK,CAAC,GAIXC,IACHG,EAAO,MACLC,EAAO,IACL,kEACF,CACF,EACA,QAAQ,KAAK,CAAC,IAKd,CAACC,EAAWL,CAAkB,GAC9B,CAACM,EAAUN,CAAkB,EAAE,YAAY,KAE3CG,EAAO,MAAMC,EAAO,IAAI,2BAA2BJ,CAAkB,GAAG,CAAC,EACzE,QAAQ,KAAK,CAAC,GAIhB,IAAMO,EAASC,EAA4BN,EAAcJ,CAAI,EACvD,CAAE,eAAAW,EAAgB,8BAAAC,CAA8B,EACpD,MAAMC,EAAsBJ,CAAM,EAGpCK,EAAUb,CAAkB,EAAE,QAASc,GAAc,CAEnD,GAAM,CAAE,aAAcC,EAAY,CAAC,CAAE,EAAIC,EACvCC,EAAKjB,EAAoBc,CAAS,CACpC,EAGM,CAAE,gBAAAI,EAAiB,kBAAAC,CAAkB,EAAIC,EAC7CL,EACA,CACE,8BAAAJ,EACA,eAAAD,CACF,CACF,EAGMW,EAAY,CAAC,GAAGH,EAAiB,GAAGC,CAAiB,EAC3Df,EAAO,IAAI,mBAAmBiB,EAAU,MAAM,EAAE,EAChDjB,EAAO,IAAI,qBAAqBc,EAAgB,MAAM,EAAE,EACxDd,EAAO,IAAI,uBAAuBe,EAAkB,MAAM,EAAE,EAC5DG,EAAmBL,EAAKhB,EAAoBa,CAAS,EAAG,CACtD,aAAcZ,EAAW,SAASY,CAAS,EAAI,CAAC,EAAIO,CACtD,CAAC,CACH,CAAC,CACH","names":["join","colors","existsSync","lstatSync","deriveDataSilosFromDataFlows","auth","dataFlowsYmlFolder","dataSilosYmlFolder","ignoreYmls","transcendUrl","logger","colors","existsSync","lstatSync","client","buildTranscendGraphQLClient","serviceToTitle","serviceToSupportedIntegration","fetchAndIndexCatalogs","listFiles","directory","dataFlows","readTranscendYaml","join","adTechDataSilos","siteTechDataSilos","dataFlowsToDataSilos","dataSilos","writeTranscendYaml"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{L as a}from"./chunk-N6JZHL5U.js";import"./chunk-MK5T6DBK.js";import"./chunk-43JWXG77.js";import"./chunk-L5ULN3IT.js";import"./chunk-EZHASXA5.js";import"./chunk-ARVEJERC.js";async function m({auth:s,actions:o,statuses:r=[],requestIds:c,silentModeBefore:e,createdAtBefore:t,createdAtAfter:n,cancellationTitle:i,transcendUrl:u,concurrency:d}){await a({transcendUrl:u,requestActions:o,auth:s,cancellationTitle:i,requestIds:c,statuses:r,concurrency:d,silentModeBefore:e?new Date(e):void 0,createdAtBefore:t?new Date(t):void 0,createdAtAfter:n?new Date(n):void 0})}export{m as cancel};
|
|
2
|
+
//# sourceMappingURL=impl-QRK4B3FD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/request/cancel/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { cancelPrivacyRequests } from '../../../lib/requests';\n\ninterface CancelCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses?: RequestStatus[];\n requestIds?: string[];\n silentModeBefore?: Date;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n cancellationTitle: string;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function cancel(\n this: LocalContext,\n {\n auth,\n actions,\n statuses = [],\n requestIds,\n silentModeBefore,\n createdAtBefore,\n createdAtAfter,\n cancellationTitle,\n transcendUrl,\n concurrency,\n }: CancelCommandFlags,\n): Promise<void> {\n await cancelPrivacyRequests({\n transcendUrl,\n requestActions: actions,\n auth,\n cancellationTitle,\n requestIds,\n statuses,\n concurrency,\n silentModeBefore: silentModeBefore ? new Date(silentModeBefore) : undefined,\n createdAtBefore: createdAtBefore ? new Date(createdAtBefore) : undefined,\n createdAtAfter: createdAtAfter ? new Date(createdAtAfter) : undefined,\n });\n}\n"],"mappings":"oLAiBA,eAAsBA,EAEpB,CACE,KAAAC,EACA,QAAAC,EACA,SAAAC,EAAW,CAAC,EACZ,WAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,kBAAAC,EACA,aAAAC,EACA,YAAAC,CACF,EACe,CACf,MAAMC,EAAsB,CAC1B,aAAAF,EACA,eAAgBP,EAChB,KAAAD,EACA,kBAAAO,EACA,WAAAJ,EACA,SAAAD,EACA,YAAAO,EACA,iBAAkBL,EAAmB,IAAI,KAAKA,CAAgB,EAAI,OAClE,gBAAiBC,EAAkB,IAAI,KAAKA,CAAe,EAAI,OAC/D,eAAgBC,EAAiB,IAAI,KAAKA,CAAc,EAAI,MAC9D,CAAC,CACH","names":["cancel","auth","actions","statuses","requestIds","silentModeBefore","createdAtBefore","createdAtAfter","cancellationTitle","transcendUrl","concurrency","cancelPrivacyRequests"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{f as s}from"./chunk-2LCGZ77N.js";import"./chunk-MA4JWWRO.js";import{q as a}from"./chunk-N6JZHL5U.js";import"./chunk-MK5T6DBK.js";import{a as o}from"./chunk-43JWXG77.js";import"./chunk-L5ULN3IT.js";import"./chunk-EZHASXA5.js";import"./chunk-ARVEJERC.js";import l from"colors";import*as t from"io-ts";var p=t.type({"Request Id":t.string});async function R({auth:r,dataSiloId:i,file:e,transcendUrl:m}){o.info(l.magenta(`Reading "${e}" from disk`));let n=a(e,p);await s({requestIds:n.map(d=>d["Request Id"]),transcendUrl:m,auth:r,dataSiloId:i})}export{R as markRequestDataSilosCompleted};
|
|
2
|
+
//# sourceMappingURL=impl-QZBKOJBQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/request/system/mark-request-data-silos-completed/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context';\nimport colors from 'colors';\nimport * as t from 'io-ts';\n\nimport { logger } from '../../../../logger';\nimport { markRequestDataSiloIdsCompleted } from '../../../../lib/cron';\nimport { readCsv } from '../../../../lib/requests';\n\nconst RequestIdRow = t.type({\n 'Request Id': t.string,\n});\n\ninterface MarkRequestDataSilosCompletedCommandFlags {\n auth: string;\n dataSiloId: string;\n file: string;\n transcendUrl: string;\n}\n\nexport async function markRequestDataSilosCompleted(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n file,\n transcendUrl,\n }: MarkRequestDataSilosCompletedCommandFlags,\n): Promise<void> {\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const activeResults = readCsv(file, RequestIdRow);\n\n await markRequestDataSiloIdsCompleted({\n requestIds: activeResults.map((request) => request['Request Id']),\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"],"mappings":"oQACA,OAAOA,MAAY,SACnB,UAAY,MAAO,QAMnB,IAAMC,EAAiB,OAAK,CAC1B,aAAgB,QAClB,CAAC,EASD,eAAsBC,EAEpB,CACE,KAAAC,EACA,WAAAC,EACA,KAAAC,EACA,aAAAC,CACF,EACe,CACfC,EAAO,KAAKC,EAAO,QAAQ,YAAYH,CAAI,aAAa,CAAC,EACzD,IAAMI,EAAgBC,EAAQL,EAAMJ,CAAY,EAEhD,MAAMU,EAAgC,CACpC,WAAYF,EAAc,IAAKG,GAAYA,EAAQ,YAAY,CAAC,EAChE,aAAAN,EACA,KAAAH,EACA,WAAAC,CACF,CAAC,CACH","names":["colors","RequestIdRow","markRequestDataSilosCompleted","auth","dataSiloId","file","transcendUrl","logger","colors","activeResults","readCsv","markRequestDataSiloIdsCompleted","request"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as l}from"./chunk-WO5MQBXP.js";import"./chunk-2LCGZ77N.js";import{c as m}from"./chunk-MA4JWWRO.js";import"./chunk-N6JZHL5U.js";import{pe as c}from"./chunk-MK5T6DBK.js";import{a as r}from"./chunk-43JWXG77.js";import{d as g}from"./chunk-L5ULN3IT.js";import"./chunk-EZHASXA5.js";import"./chunk-ARVEJERC.js";import{uniq as A,groupBy as G}from"lodash-es";import n from"colors";async function k({auth:p,file:a,transcendUrl:d,dataSiloIds:u,includeAttributes:y,includeGuessedCategories:C,parentCategories:f,subCategories:D=[]}){try{let o=c(d,p),P=await l(o,{dataSiloIds:u,includeGuessedCategories:C,parentCategories:f,includeAttributes:y,subCategories:D});r.info(n.magenta(`Writing datapoints to file "${a}"...`));let s=[],b=P.map(e=>{let i={"Property ID":e.id,"Data Silo":e.dataSilo.title,Object:e.dataPoint.name,"Object Path":e.dataPoint.path.join("."),Property:e.name,"Property Description":e.description,"Data Categories":e.categories.map(t=>`${t.category}:${t.name}`).join(", "),"Guessed Category":e.pendingCategoryGuesses?.[0]?`${e.pendingCategoryGuesses[0].category.category}:${e.pendingCategoryGuesses[0].category.name}`:"","Processing Purposes":e.purposes.map(t=>`${t.purpose}:${t.name}`).join(", "),...Object.entries(G(e.attributeValues||[],({attributeKey:t})=>t.name)).reduce((t,[$,h])=>(t[$]=h.map(j=>j.name).join(","),t),{})};return s=A([...s,...Object.keys(i)]),i});m(a,b,s)}catch(o){r.error(n.red(`An error occurred syncing the datapoints: ${o.message}`)),process.exit(1)}r.info(n.green(`Successfully synced datapoints to disk at ${a}! View at ${g}`))}export{k as pullDatapoints};
|
|
2
|
+
//# sourceMappingURL=impl-RFRQUKQY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/inventory/pull-datapoints/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { uniq, groupBy } from 'lodash-es';\n\nimport { logger } from '../../../logger';\nimport colors from 'colors';\nimport { buildTranscendGraphQLClient } from '../../../lib/graphql';\nimport { ADMIN_DASH_DATAPOINTS } from '../../../constants';\nimport { pullAllDatapoints } from '../../../lib/data-inventory';\nimport { writeCsv } from '../../../lib/cron';\nimport { DataCategoryType } from '@transcend-io/privacy-types';\n\ninterface PullDatapointsCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n includeAttributes: boolean;\n includeGuessedCategories: boolean;\n parentCategories?: DataCategoryType[];\n subCategories?: string[];\n}\n\nexport async function pullDatapoints(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n dataSiloIds,\n includeAttributes,\n includeGuessedCategories,\n parentCategories,\n subCategories = [],\n }: PullDatapointsCommandFlags,\n): Promise<void> {\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const dataPoints = await pullAllDatapoints(client, {\n dataSiloIds,\n includeGuessedCategories,\n parentCategories,\n includeAttributes,\n subCategories, // TODO: https://transcend.height.app/T-40482 - do by name not ID\n });\n\n logger.info(colors.magenta(`Writing datapoints to file \"${file}\"...`));\n let headers: string[] = [];\n const inputs = dataPoints.map((point) => {\n const result = {\n 'Property ID': point.id,\n 'Data Silo': point.dataSilo.title,\n Object: point.dataPoint.name,\n 'Object Path': point.dataPoint.path.join('.'),\n Property: point.name,\n 'Property Description': point.description,\n 'Data Categories': point.categories\n .map((category) => `${category.category}:${category.name}`)\n .join(', '),\n 'Guessed Category': point.pendingCategoryGuesses?.[0]\n ? `${point.pendingCategoryGuesses![0]!.category.category}:${\n point.pendingCategoryGuesses![0]!.category.name\n }`\n : '',\n 'Processing Purposes': point.purposes\n .map((purpose) => `${purpose.purpose}:${purpose.name}`)\n .join(', '),\n ...Object.entries(\n groupBy(\n point.attributeValues || [],\n ({ attributeKey }) => attributeKey.name,\n ),\n ).reduce((acc, [key, values]) => {\n acc[key] = values.map((value) => value.name).join(',');\n return acc;\n }, {} as Record<string, string>),\n };\n headers = uniq([...headers, ...Object.keys(result)]);\n return result;\n });\n writeCsv(file, inputs, headers);\n } catch (err) {\n logger.error(\n colors.red(`An error occurred syncing the datapoints: ${err.message}`),\n );\n process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced datapoints to disk at ${file}! View at ${ADMIN_DASH_DATAPOINTS}`,\n ),\n );\n}\n"],"mappings":"yTACA,OAAS,QAAAA,EAAM,WAAAC,MAAe,YAG9B,OAAOC,MAAY,SAkBnB,eAAsBC,EAEpB,CACE,KAAAC,EACA,KAAAC,EACA,aAAAC,EACA,YAAAC,EACA,kBAAAC,EACA,yBAAAC,EACA,iBAAAC,EACA,cAAAC,EAAgB,CAAC,CACnB,EACe,CACf,GAAI,CAEF,IAAMC,EAASC,EAA4BP,EAAcF,CAAI,EAEvDU,EAAa,M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ACA,QAAQ,KAAK,CAAC,CAChB,CAGAhB,EAAO,KACLC,EAAO,MACL,6CAA6CZ,CAAI,aAAa4B,CAAqB,EACrF,CACF,CACF","names":["uniq","groupBy","colors","pullDatapoints","auth","file","transcendUrl","dataSiloIds","includeAttributes","includeGuessedCategories","parentCategories","subCategories","client","buildTranscendGraphQLClient","dataPoints","pullAllDatapoints","logger","colors","headers","inputs","point","result","category","purpose","groupBy","attributeKey","acc","key","values","value","uniq","writeCsv","err","ADMIN_DASH_DATAPOINTS"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as m}from"./chunk-65I2PF73.js";import{a as t}from"./chunk-26T4RUOI.js";import"./chunk-2V6ABZRI.js";import"./chunk-N6JZHL5U.js";import"./chunk-LAYHULHH.js";import"./chunk-347UQP43.js";import{a as g}from"./chunk-MK5T6DBK.js";import{a as n}from"./chunk-43JWXG77.js";import"./chunk-L5ULN3IT.js";import"./chunk-EZHASXA5.js";import"./chunk-ARVEJERC.js";import a from"colors";import{ConsentBundleType as p}from"@transcend-io/privacy-types";async function M({auth:f,bundleTypes:r=[p.Production,p.Test],deploy:i,transcendUrl:s}){let e=await m(f);typeof e=="string"?(await t({deploy:i,transcendUrl:s,auth:e,bundleTypes:r}),n.info(a.green("Successfully updated Consent Manager!"))):(await g(e,async o=>{n.info(a.magenta(`Updating Consent Manager for organization "${o.organizationName}"...`)),await t({deploy:i,transcendUrl:s,auth:o.apiKey,bundleTypes:r}),n.info(a.green(`Successfully updated Consent Manager for organization "${o.organizationName}"!`))}),n.info(a.green("Successfully updated Consent Managers!")))}export{M as updateConsentManager};
|
|
2
|
+
//# sourceMappingURL=impl-RIVVHWBR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/consent/update-consent-manager/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport colors from 'colors';\nimport { ConsentBundleType } from '@transcend-io/privacy-types';\nimport { mapSeries } from '../../../lib/bluebird-replace';\n\nimport { logger } from '../../../logger';\nimport { updateConsentManagerVersionToLatest } from '../../../lib/consent-manager';\nimport { validateTranscendAuth } from '../../../lib/api-keys';\n\ninterface UpdateConsentManagerCommandFlags {\n auth: string;\n bundleTypes: ConsentBundleType[];\n deploy: boolean;\n transcendUrl: string;\n}\n\nexport async function updateConsentManager(\n this: LocalContext,\n {\n auth,\n bundleTypes = [ConsentBundleType.Production, ConsentBundleType.Test],\n deploy,\n transcendUrl,\n }: UpdateConsentManagerCommandFlags,\n): Promise<void> {\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Handle single update\n if (typeof apiKeyOrList === 'string') {\n // Update consent manager\n await updateConsentManagerVersionToLatest({\n deploy,\n transcendUrl,\n auth: apiKeyOrList,\n bundleTypes,\n });\n logger.info(colors.green('Successfully updated Consent Manager!'));\n } else {\n await mapSeries(apiKeyOrList, async (apiKey) => {\n logger.info(\n colors.magenta(\n `Updating Consent Manager for organization \"${apiKey.organizationName}\"...`,\n ),\n );\n\n await updateConsentManagerVersionToLatest({\n deploy,\n transcendUrl,\n auth: apiKey.apiKey,\n bundleTypes,\n });\n\n logger.info(\n colors.green(\n `Successfully updated Consent Manager for organization \"${apiKey.organizationName}\"!`,\n ),\n );\n });\n logger.info(colors.green('Successfully updated Consent Managers!'));\n }\n}\n"],"mappings":"oWACA,OAAOA,MAAY,SACnB,OAAS,qBAAAC,MAAyB,8BAclC,eAAsBC,EAEpB,CACE,KAAAC,EACA,YAAAC,EAAc,CAACC,EAAkB,WAAYA,EAAkB,IAAI,EACnE,OAAAC,EACA,aAAAC,CACF,EACe,CAEf,IAAMC,EAAe,MAAMC,EAAsBN,CAAI,EAGjD,OAAOK,GAAiB,UAE1B,MAAME,EAAoC,CACxC,OAAAJ,EACA,aAAAC,EACA,KAAMC,EACN,YAAAJ,CACF,CAAC,EACDO,EAAO,KAAKC,EAAO,MAAM,uCAAuC,CAAC,IAEjE,MAAMC,EAAUL,EAAc,MAAOM,GAAW,CAC9CH,EAAO,KACLC,EAAO,QACL,8CAA8CE,EAAO,gBAAgB,MACvE,CACF,EAEA,MAAMJ,EAAoC,CACxC,OAAAJ,EACA,aAAAC,EACA,KAAMO,EAAO,OACb,YAAAV,CACF,CAAC,EAEDO,EAAO,KACLC,EAAO,MACL,0DAA0DE,EAAO,gBAAgB,IACnF,CACF,CACF,CAAC,EACDH,EAAO,KAAKC,EAAO,MAAM,wCAAwC,CAAC,EAEtE","names":["colors","ConsentBundleType","updateConsentManager","auth","bundleTypes","ConsentBundleType","deploy","transcendUrl","apiKeyOrList","validateTranscendAuth","updateConsentManagerVersionToLatest","logger","colors","mapSeries","apiKey"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as w}from"./chunk-CBAHSBSW.js";import{d as D,e as h}from"./chunk-OEB7WG3G.js";import{c as y}from"./chunk-65I2PF73.js";import"./chunk-LAYHULHH.js";import"./chunk-347UQP43.js";import{ne as S,pe as T}from"./chunk-MK5T6DBK.js";import{a as c}from"./chunk-43JWXG77.js";import"./chunk-L5ULN3IT.js";import"./chunk-EZHASXA5.js";import"./chunk-ARVEJERC.js";import{join as O}from"path";import{difference as v}from"lodash-es";import I from"colors";import{existsSync as $,lstatSync as b}from"fs";async function Q({auth:F,dataFlowsYmlFolder:a,output:x,ignoreYmls:C=[],transcendUrl:k}){a||(c.error(I.red("Missing required arg: --dataFlowsYmlFolder=./working/data-flows/")),process.exit(1)),(!$(a)||!b(a).isDirectory())&&(c.error(I.red(`Folder does not exist: "${a}"`)),process.exit(1));let N=C.map(t=>t.split(".")[0]),l=y(a).map(t=>{let{"data-flows":o=[]}=D(O(a,t)),{adTechDataSilos:m,siteTechDataSilos:r}=w(o,{serviceToSupportedIntegration:u,serviceToTitle:f});return{adTechDataSilos:m,siteTechDataSilos:r,organizationName:t.split(".")[0]}}),s={};l.forEach(({adTechDataSilos:t,siteTechDataSilos:o,organizationName:m})=>{[...t,...o].forEach(e=>{let n=e["outer-type"]||e.integrationName;s[n]||(s[n]=[]),s[n].push(m),s[n]=[...new Set(s[n])]})});let p=[...new Set(l.map(({adTechDataSilos:t})=>t.map(o=>o["outer-type"]||o.integrationName)).flat())],g=v([...new Set(l.map(({siteTechDataSilos:t})=>t.map(o=>o["outer-type"]||o.integrationName)).flat())],p),i={};l.forEach(({adTechDataSilos:t,siteTechDataSilos:o})=>{[...t,...o].forEach(r=>{let e=r["outer-type"]||r.integrationName,n=r.attributes?.find(E=>E.key==="Found On Domain");i[e]||(i[e]=[]),i[e].push(...n?.values||[]),i[e]=[...new Set(i[e])]})});let A=T(k,F),{serviceToTitle:f,serviceToSupportedIntegration:u}=await S(A),d=[...p,...g].map(t=>({title:f[t],...u[t]?{integrationName:t}:{integrationName:"promptAPerson","outer-type":t},attributes:[{key:"Tech Type",values:["Ad Tech"]},{key:"Business Units",values:v(s[t]||[],N)},{key:"Found On Domain",values:i[t]||[]}]}));c.log(`Total Services: ${d.length}`),c.log(`Ad Tech Services: ${p.length}`),c.log(`Site Tech Services: ${g.length}`),h(x,{"data-silos":d})}export{Q as deriveDataSilosFromDataFlowsCrossInstance};
|
|
2
|
+
//# sourceMappingURL=impl-SJHU5PR7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/inventory/derive-data-silos-from-data-flows-cross-instance/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport {\n fetchAndIndexCatalogs,\n buildTranscendGraphQLClient,\n} from '../../../lib/graphql';\nimport { join } from 'path';\nimport { difference } from 'lodash-es';\nimport colors from 'colors';\nimport { logger } from '../../../logger';\nimport { dataFlowsToDataSilos } from '../../../lib/consent-manager/dataFlowsToDataSilos';\nimport { DataFlowInput } from '../../../codecs';\nimport { existsSync, lstatSync } from 'fs';\nimport { listFiles } from '../../../lib/api-keys';\nimport {\n readTranscendYaml,\n writeTranscendYaml,\n} from '../../../lib/readTranscendYaml';\n\ninterface DeriveDataSilosFromDataFlowsCrossInstanceCommandFlags {\n auth: string;\n dataFlowsYmlFolder: string;\n output: string;\n ignoreYmls?: string[];\n transcendUrl: string;\n}\n\nexport async function deriveDataSilosFromDataFlowsCrossInstance(\n this: LocalContext,\n {\n auth,\n dataFlowsYmlFolder,\n output,\n ignoreYmls = [],\n transcendUrl,\n }: DeriveDataSilosFromDataFlowsCrossInstanceCommandFlags,\n): Promise<void> {\n // Ensure folder is passed to dataFlowsYmlFolder\n if (!dataFlowsYmlFolder) {\n logger.error(\n colors.red(\n 'Missing required arg: --dataFlowsYmlFolder=./working/data-flows/',\n ),\n );\n process.exit(1);\n }\n\n // Ensure folder is passed\n if (\n !existsSync(dataFlowsYmlFolder) ||\n !lstatSync(dataFlowsYmlFolder).isDirectory()\n ) {\n logger.error(colors.red(`Folder does not exist: \"${dataFlowsYmlFolder}\"`));\n process.exit(1);\n }\n\n // Ignore the data flows in these yml files\n const instancesToIgnore = ignoreYmls.map((x) => x.split('.')[0]);\n\n // Map over each data flow yml file and convert to data silo configurations\n const dataSiloInputs = listFiles(dataFlowsYmlFolder).map((directory) => {\n // read in the data flows for a specific instance\n const { 'data-flows': dataFlows = [] } = readTranscendYaml(\n join(dataFlowsYmlFolder, directory),\n );\n\n // map the data flows to data silos\n const { adTechDataSilos, siteTechDataSilos } = dataFlowsToDataSilos(\n dataFlows as DataFlowInput[],\n {\n serviceToSupportedIntegration,\n serviceToTitle,\n },\n );\n\n return {\n adTechDataSilos,\n siteTechDataSilos,\n organizationName: directory.split('.')[0],\n };\n });\n\n // Mapping from service name to instances that have that service\n const serviceToInstance: { [k in string]: string[] } = {};\n dataSiloInputs.forEach(\n ({ adTechDataSilos, siteTechDataSilos, organizationName }) => {\n const allDataSilos = [...adTechDataSilos, ...siteTechDataSilos];\n allDataSilos.forEach((dataSilo) => {\n const service = dataSilo['outer-type'] || dataSilo.integrationName;\n // create mapping to instance\n if (!serviceToInstance[service]) {\n serviceToInstance[service] = [];\n }\n serviceToInstance[service]!.push(organizationName);\n serviceToInstance[service] = [...new Set(serviceToInstance[service])];\n });\n },\n );\n\n // List of ad tech integrations\n const adTechIntegrations = [\n ...new Set(\n dataSiloInputs\n .map(({ adTechDataSilos }) =>\n adTechDataSilos.map(\n (silo) => silo['outer-type'] || silo.integrationName,\n ),\n )\n .flat(),\n ),\n ];\n\n // List of site tech integrations\n const siteTechIntegrations = difference(\n [\n ...new Set(\n dataSiloInputs\n .map(({ siteTechDataSilos }) =>\n siteTechDataSilos.map(\n (silo) => silo['outer-type'] || silo.integrationName,\n ),\n )\n .flat(),\n ),\n ],\n adTechIntegrations,\n );\n\n // Mapping from service name to list of\n const serviceToFoundOnDomain: { [k in string]: string[] } = {};\n dataSiloInputs.forEach(({ adTechDataSilos, siteTechDataSilos }) => {\n const allDataSilos = [...adTechDataSilos, ...siteTechDataSilos];\n allDataSilos.forEach((dataSilo) => {\n const service = dataSilo['outer-type'] || dataSilo.integrationName;\n const foundOnDomain = dataSilo.attributes?.find(\n (attr) => attr.key === 'Found On Domain',\n );\n // create mapping to instance\n if (!serviceToFoundOnDomain[service]) {\n serviceToFoundOnDomain[service] = [];\n }\n serviceToFoundOnDomain[service]!.push(...(foundOnDomain?.values || []));\n serviceToFoundOnDomain[service] = [\n ...new Set(serviceToFoundOnDomain[service]),\n ];\n });\n });\n\n // Fetch all integrations in the catalog\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const { serviceToTitle, serviceToSupportedIntegration } =\n await fetchAndIndexCatalogs(client);\n\n // construct the aggregated data silo inputs\n const dataSilos = [...adTechIntegrations, ...siteTechIntegrations].map(\n (service) => ({\n title: serviceToTitle[service],\n ...(serviceToSupportedIntegration[service]\n ? { integrationName: service }\n : { integrationName: 'promptAPerson', 'outer-type': service }),\n attributes: [\n {\n key: 'Tech Type',\n values: ['Ad Tech'],\n },\n {\n key: 'Business Units',\n values: difference(\n serviceToInstance[service] || [],\n instancesToIgnore,\n ),\n },\n {\n key: 'Found On Domain',\n values: serviceToFoundOnDomain[service] || [],\n },\n ],\n }),\n );\n\n // Log output\n logger.log(`Total Services: ${dataSilos.length}`);\n logger.log(`Ad Tech Services: ${adTechIntegrations.length}`);\n logger.log(`Site Tech Services: ${siteTechIntegrations.length}`);\n\n // Write to yaml\n writeTranscendYaml(output, {\n 'data-silos': dataSilos,\n });\n}\n"],"mappings":"oWAKA,OAAS,QAAAA,MAAY,OACrB,OAAS,cAAAC,MAAkB,YAC3B,OAAOC,MAAY,SAInB,OAAS,cAAAC,EAAY,aAAAC,MAAiB,KAetC,eAAsBC,EAEpB,CACE,KAAAC,EACA,mBAAAC,EACA,OAAAC,EACA,WAAAC,EAAa,CAAC,EACd,aAAAC,CACF,EACe,CAEVH,IACHI,EAAO,MACLC,EAAO,IACL,kEACF,CACF,EACA,QAAQ,KAAK,CAAC,IAKd,CAACC,EAAWN,CAAkB,GAC9B,CAACO,EAAUP,CAAkB,EAAE,YAAY,KAE3CI,EAAO,MAAMC,EAAO,IAAI,2BAA2BL,CAAkB,GAAG,CAAC,EACzE,QAAQ,KAAK,CAAC,GAIhB,IAAMQ,EAAoBN,EAAW,IAAKO,GAAMA,EAAE,MAAM,GAAG,EAAE,CAAC,CAAC,EAGzDC,EAAiBC,EAAUX,CAAkB,EAAE,IAAKY,GAAc,CAEtE,GAAM,CAAE,aAAcC,EAAY,CAAC,CAAE,EAAIC,EACvCC,EAAKf,EAAoBY,CAAS,CACpC,EAGM,CAAE,gBAAAI,EAAiB,kBAAAC,CAAkB,EAAIC,EAC7CL,EACA,CACE,8BAAAM,EACA,eAAAC,CACF,CACF,EAEA,MAAO,CACL,gBAAAJ,EACA,kBAAAC,EACA,iBAAkBL,EAAU,MAAM,GAAG,EAAE,CAAC,CAC1C,CACF,CAAC,EAGKS,EAAiD,CAAC,EACxDX,EAAe,QACb,CAAC,CAAE,gBAAAM,EAAiB,kBAAAC,EAAmB,iBAAAK,CAAiB,IAAM,CACvC,CAAC,GAAGN,EAAiB,GAAGC,CAAiB,EACjD,QAASM,GAAa,CACjC,IAAMC,EAAUD,EA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H,IAAa,CACZ,MAAOJ,EAAeI,CAAO,EAC7B,GAAIL,EAA8BK,CAAO,EACrC,CAAE,gBAAiBA,CAAQ,EAC3B,CAAE,gBAAiB,gBAAiB,aAAcA,CAAQ,EAC9D,WAAY,CACV,CACE,IAAK,YACL,OAAQ,CAAC,SAAS,CACpB,EACA,CACE,IAAK,iBACL,OAAQI,EACNP,EAAkBG,CAAO,GAAK,CAAC,EAC/BhB,CACF,CACF,EACA,CACE,IAAK,kBACL,OAAQqB,EAAuBL,CAAO,GAAK,CAAC,CAC9C,CACF,CACF,EACF,EAGApB,EAAO,IAAI,mBAAmB+B,EAAU,MAAM,EAAE,EAChD/B,EAAO,IAAI,qBAAqBqB,EAAmB,MAAM,EAAE,EAC3DrB,EAAO,IAAI,uBAAuBuB,EAAqB,MAAM,EAAE,EAG/DS,EAAmBnC,EAAQ,CACzB,aAAckC,CAChB,CAAC,CACH","names":["join","difference","colors","existsSync","lstatSync","deriveDataSilosFromDataFlowsCrossInstance","auth","dataFlowsYmlFolder","output","ignoreYmls","transcendUrl","logger","colors","existsSync","lstatSync","instancesToIgnore","x","dataSiloInputs","listFiles","directory","dataFlows","readTranscendYaml","join","adTechDataSilos","siteTechDataSilos","dataFlowsToDataSilos","serviceToSupportedIntegration","serviceToTitle","serviceToInstance","organizationName","dataSilo","service","adTechIntegrations","silo","siteTechIntegrations","difference","serviceToFoundOnDomain","foundOnDomain","attr","client","buildTranscendGraphQLClient","fetchAndIndexCatalogs","dataSilos","writeTranscendYaml"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{d as o,e as r}from"./chunk-OEB7WG3G.js";import{c as m}from"./chunk-65I2PF73.js";import{h as a}from"./chunk-26T4RUOI.js";import"./chunk-2V6ABZRI.js";import"./chunk-N6JZHL5U.js";import"./chunk-LAYHULHH.js";import"./chunk-347UQP43.js";import"./chunk-MK5T6DBK.js";import{a as t}from"./chunk-43JWXG77.js";import"./chunk-L5ULN3IT.js";import"./chunk-EZHASXA5.js";import"./chunk-ARVEJERC.js";import{join as u}from"path";import c from"colors";import{existsSync as g,lstatSync as l}from"fs";function b({consentManagerYmlFolder:s,output:n}){(!g(s)||!l(s).isDirectory())&&(t.error(c.red(`Folder does not exist: "${s}"`)),process.exit(1));let p=m(s).map(i=>{let{"consent-manager":f}=o(u(s,i));return{name:i,input:f}}),e=a(p);r(n,{"business-entities":e}),t.info(c.green(`Successfully wrote ${e.length} business entities to file "${n}"`))}export{b as consentManagersToBusinessEntities};
|
|
2
|
+
//# sourceMappingURL=impl-SYC5TORT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/inventory/consent-managers-to-business-entities/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { listFiles } from '../../../lib/api-keys';\nimport { consentManagersToBusinessEntities as consentManagersToBusinessEntitiesHelper } from '../../../lib/consent-manager';\nimport {\n readTranscendYaml,\n writeTranscendYaml,\n} from '../../../lib/readTranscendYaml';\nimport { join } from 'path';\n\nimport colors from 'colors';\nimport { logger } from '../../../logger';\nimport { existsSync, lstatSync } from 'fs';\n\ninterface ConsentManagersToBusinessEntitiesCommandFlags {\n consentManagerYmlFolder: string;\n output: string;\n}\n\nexport function consentManagersToBusinessEntities(\n this: LocalContext,\n {\n consentManagerYmlFolder,\n output,\n }: ConsentManagersToBusinessEntitiesCommandFlags,\n): void {\n // Ensure folder is passed\n if (\n !existsSync(consentManagerYmlFolder) ||\n !lstatSync(consentManagerYmlFolder).isDirectory()\n ) {\n logger.error(\n colors.red(`Folder does not exist: \"${consentManagerYmlFolder}\"`),\n );\n process.exit(1);\n }\n\n // Read in each consent manager configuration\n const inputs = listFiles(consentManagerYmlFolder).map((directory) => {\n const { 'consent-manager': consentManager } = readTranscendYaml(\n join(consentManagerYmlFolder, directory),\n );\n return { name: directory, input: consentManager };\n });\n\n // Convert to business entities\n const businessEntities = consentManagersToBusinessEntitiesHelper(inputs);\n\n // write to disk\n writeTranscendYaml(output, {\n 'business-entities': businessEntities,\n });\n\n logger.info(\n colors.green(\n `Successfully wrote ${businessEntities.length} business entities to file \"${output}\"`,\n ),\n );\n}\n"],"mappings":"uYAOA,OAAS,QAAAA,MAAY,OAErB,OAAOC,MAAY,SAEnB,OAAS,cAAAC,EAAY,aAAAC,MAAiB,KAO/B,SAASC,EAEd,CACE,wBAAAC,EACA,OAAAC,CACF,EACM,EAGJ,CAACJ,EAAWG,CAAuB,GACnC,CAACF,EAAUE,CAAuB,EAAE,YAAY,KAEhDE,EAAO,MACLC,EAAO,IAAI,2BAA2BH,CAAuB,GAAG,CAClE,EACA,QAAQ,KAAK,CAAC,GAIhB,IAAMI,EAASC,EAAUL,CAAuB,EAAE,IAAKM,GAAc,CACnE,GAAM,CAAE,kBAAmBC,CAAe,EAAIC,EAC5CC,EAAKT,EAAyBM,CAAS,CACzC,EACA,MAAO,CAAE,KAAMA,EAAW,MAAOC,CAAe,CAClD,CAAC,EAGKG,EAAmBX,EAAwCK,CAAM,EAGvEO,EAAmBV,EAAQ,CACzB,oBAAqBS,CACvB,CAAC,EAEDR,EAAO,KACLC,EAAO,MACL,sBAAsBO,EAAiB,MAAM,+BAA+BT,CAAM,GACpF,CACF,CACF","names":["join","colors","existsSync","lstatSync","consentManagersToBusinessEntities","consentManagerYmlFolder","output","logger","colors","inputs","listFiles","directory","consentManager","readTranscendYaml","join","businessEntities","writeTranscendYaml"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{W as e}from"./chunk-N6JZHL5U.js";import"./chunk-MK5T6DBK.js";import"./chunk-43JWXG77.js";import"./chunk-L5ULN3IT.js";import"./chunk-EZHASXA5.js";import"./chunk-ARVEJERC.js";async function s({auth:t,transcendUrl:i,identifierNames:n,actions:r=[]}){await e({requestActions:r,transcendUrl:i,auth:t,identifierNames:n})}export{s as rejectUnverifiedIdentifiers};
|
|
2
|
+
//# sourceMappingURL=impl-TP4QITXR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/request/reject-unverified-identifiers/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { removeUnverifiedRequestIdentifiers } from '../../../lib/requests';\nimport type { RequestAction } from '@transcend-io/privacy-types';\n\ninterface RejectUnverifiedIdentifiersCommandFlags {\n auth: string;\n identifierNames: string[];\n actions?: RequestAction[];\n transcendUrl: string;\n}\n\nexport async function rejectUnverifiedIdentifiers(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n identifierNames,\n actions = [],\n }: RejectUnverifiedIdentifiersCommandFlags,\n): Promise<void> {\n await removeUnverifiedRequestIdentifiers({\n requestActions: actions,\n transcendUrl,\n auth,\n identifierNames,\n });\n}\n"],"mappings":"oLAWA,eAAsBA,EAEpB,CACE,KAAAC,EACA,aAAAC,EACA,gBAAAC,EACA,QAAAC,EAAU,CAAC,CACb,EACe,CACf,MAAMC,EAAmC,CACvC,eAAgBD,EAChB,aAAAF,EACA,KAAAD,EACA,gBAAAE,CACF,CAAC,CACH","names":["rejectUnverifiedIdentifiers","auth","transcendUrl","identifierNames","actions","removeUnverifiedRequestIdentifiers"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as d}from"./chunk-WO5MQBXP.js";import"./chunk-2LCGZ77N.js";import{c as u}from"./chunk-MA4JWWRO.js";import"./chunk-N6JZHL5U.js";import{pe as c}from"./chunk-MK5T6DBK.js";import{a as e}from"./chunk-43JWXG77.js";import"./chunk-L5ULN3IT.js";import"./chunk-EZHASXA5.js";import"./chunk-ARVEJERC.js";import i from"colors";import{uniq as b}from"lodash-es";async function x({auth:l,file:s,transcendUrl:m,dataSiloIds:f,subCategories:p,status:g,includeEncryptedSnippets:a}){try{let o=c(m,l),C=await d(o,{dataSiloIds:f,subCategories:p,status:g,includeEncryptedSnippets:a});e.info(i.magenta(`Writing unstructured discovery files to file "${s}"...`));let r=[],S=C.map(t=>{let n={"Entry ID":t.id,"Data Silo ID":t.dataSiloId,"Object Path ID":t.scannedObjectPathId,"Object ID":t.scannedObjectId,...a?{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 r=b([...r,...Object.keys(n)]),n});u(s,S,r)}catch(o){e.error(i.red(`An error occurred syncing the unstructured discovery files: ${o.message}`)),process.exit(1)}e.info(i.green(`Successfully synced unstructured discovery files to disk at ${s}!`))}export{x as pullUnstructuredDiscoveryFiles};
|
|
2
|
+
//# sourceMappingURL=impl-UOB7PV4W.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/inventory/pull-unstructured-discovery-files/impl.ts"],"sourcesContent":["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';\n\ninterface 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 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 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"],"mappings":"6SAEA,OAAOA,MAAY,SACnB,OAAS,QAAAC,MAAY,YAgBrB,eAAsBC,EAEpB,CACE,KAAAC,EACA,KAAAC,EACA,aAAAC,EACA,YAAAC,EACA,cAAAC,EACA,OAAAC,EACA,yBAAAC,CACF,EACe,CACf,GAAI,CAEF,IAAMC,EAASC,EAA4BN,EAAcF,CAAI,EAEvDS,EAAU,MAAMC,EAA4CH,EAAQ,CACxE,YAAAJ,EACA,cAAAC,EACA,OAAAC,EACA,yBAAAC,CACF,CAAC,EAEDK,EAAO,KACLC,EAAO,QACL,iDAAiDX,CAAI,MACvD,CACF,EACA,IAAIY,EAAoB,CAAC,EACnBC,EAASL,EAAQ,IAAKM,GAAU,CACpC,IAAMC,EAAS,CACb,WAAYD,EAAM,GAClB,eAAgBA,EAAM,WACtB,iBAAkBA,EAAM,oBACxB,YAAaA,EAAM,gBACnB,GAAIT,EACA,CAAE,MAAOS,EAAM,KAAM,kBAAmBA,EAAM,cAAe,EAC7D,CAAC,EACL,gBAAiB,GAAGA,EAAM,gBAAgB,QAAQ,IAAIA,EAAM,gBAAgB,IAAI,GAChF,wBAAyBA,EAAM,OAC/B,mBAAoBA,EAAM,WAC1B,wBAAyBA,EAAM,qBAC/B,qBAAsBA,EAAM,iBAC9B,EACA,OAAAF,EAAUI,EAAK,CAAC,GAAGJ,EAAS,GAAG,OAAO,KAAKG,CAAM,CAAC,CAAC,EAC5CA,CACT,CAAC,EACDE,EAASjB,EAAMa,EAAQD,CAAO,CAChC,OAASM,EAAK,CACZR,EAAO,MACLC,EAAO,IACL,+DAA+DO,EAAI,OAAO,EAC5E,CACF,EACA,QAAQ,KAAK,CAAC,CAChB,CAGAR,EAAO,KACLC,EAAO,MACL,+DAA+DX,CAAI,GACrE,CACF,CACF","names":["colors","uniq","pullUnstructuredDiscoveryFiles","auth","file","transcendUrl","dataSiloIds","subCategories","status","includeEncryptedSnippets","client","buildTranscendGraphQLClient","entries","pullUnstructuredSubDataPointRecommendations","logger","colors","headers","inputs","entry","result","uniq","writeCsv","err"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e as t}from"./chunk-2LCGZ77N.js";import"./chunk-MA4JWWRO.js";import"./chunk-N6JZHL5U.js";import"./chunk-MK5T6DBK.js";import"./chunk-43JWXG77.js";import"./chunk-L5ULN3IT.js";import"./chunk-EZHASXA5.js";import"./chunk-ARVEJERC.js";async function s({file:e,transcendUrl:r,auth:i,sombraAuth:o,dataSiloId:n}){await t({file:e,transcendUrl:r,auth:i,sombraAuth:o,dataSiloId:n})}export{s as markIdentifiersCompleted};
|
|
2
|
+
//# sourceMappingURL=impl-UUQ2BEZR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/request/cron/mark-identifiers-completed/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context';\nimport { pushCronIdentifiersFromCsv } from '../../../../lib/cron';\n\ninterface MarkIdentifiersCompletedCommandFlags {\n file: string;\n transcendUrl: string;\n auth: string;\n sombraAuth?: string;\n dataSiloId: string;\n}\n\nexport async function markIdentifiersCompleted(\n this: LocalContext,\n {\n file,\n transcendUrl,\n auth,\n sombraAuth,\n dataSiloId,\n }: MarkIdentifiersCompletedCommandFlags,\n): Promise<void> {\n await pushCronIdentifiersFromCsv({\n file,\n transcendUrl,\n auth,\n sombraAuth,\n dataSiloId,\n });\n}\n"],"mappings":"4OAWA,eAAsBA,EAEpB,CACE,KAAAC,EACA,aAAAC,EACA,KAAAC,EACA,WAAAC,EACA,WAAAC,CACF,EACe,CACf,MAAMC,EAA2B,CAC/B,KAAAL,EACA,aAAAC,EACA,KAAAC,EACA,WAAAC,EACA,WAAAC,CACF,CAAC,CACH","names":["markIdentifiersCompleted","file","transcendUrl","auth","sombraAuth","dataSiloId","pushCronIdentifiersFromCsv"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{d as n}from"./chunk-HJULYIHF.js";import"./chunk-MA4JWWRO.js";import"./chunk-N6JZHL5U.js";import"./chunk-MK5T6DBK.js";import"./chunk-43JWXG77.js";import"./chunk-L5ULN3IT.js";import"./chunk-EZHASXA5.js";import"./chunk-ARVEJERC.js";async function c({auth:t,transcendUrl:r,file:e,enricherId:i,concurrency:s,markSilent:o,sombraAuth:a}){await n({file:e,transcendUrl:r,enricherId:i,concurrency:s,markSilent:o,auth:t,sombraAuth:a})}export{c as pushIdentifiers};
|
|
2
|
+
//# sourceMappingURL=impl-WH2I2JB7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/request/preflight/push-identifiers/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context';\nimport { pushManualEnrichmentIdentifiersFromCsv } from '../../../../lib/manual-enrichment';\n\ninterface PushIdentifiersCommandFlags {\n auth: string;\n enricherId: string;\n sombraAuth?: string;\n transcendUrl: string;\n file: string;\n markSilent: boolean;\n concurrency: number;\n}\n\nexport async function pushIdentifiers(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n file,\n enricherId,\n concurrency,\n markSilent,\n sombraAuth,\n }: PushIdentifiersCommandFlags,\n): Promise<void> {\n await pushManualEnrichmentIdentifiersFromCsv({\n file,\n transcendUrl,\n enricherId,\n concurrency,\n markSilent,\n auth,\n sombraAuth,\n });\n}\n"],"mappings":"4OAaA,eAAsBA,EAEpB,CACE,KAAAC,EACA,aAAAC,EACA,KAAAC,EACA,WAAAC,EACA,YAAAC,EACA,WAAAC,EACA,WAAAC,CACF,EACe,CACf,MAAMC,EAAuC,CAC3C,KAAAL,EACA,aAAAD,EACA,WAAAE,EACA,YAAAC,EACA,WAAAC,EACA,KAAAL,EACA,WAAAM,CACF,CAAC,CACH","names":["pushIdentifiers","auth","transcendUrl","file","enricherId","concurrency","markSilent","sombraAuth","pushManualEnrichmentIdentifiersFromCsv"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{a as S}from"./chunk-L7ZIX4SU.js";import{a as A}from"./chunk-4GLITB3Y.js";import{d as b}from"./chunk-OEB7WG3G.js";import{b as v,c as C}from"./chunk-65I2PF73.js";import"./chunk-LAYHULHH.js";import"./chunk-347UQP43.js";import{Nd as x,a as w,pe as T}from"./chunk-MK5T6DBK.js";import{a as n}from"./chunk-43JWXG77.js";import{c as d}from"./chunk-L5ULN3IT.js";import"./chunk-EZHASXA5.js";import"./chunk-ARVEJERC.js";import{existsSync as z,lstatSync as F}from"fs";import{join as L}from"path";import o from"colors";async function I({transcendUrl:i,auth:c,pageSize:h,publishToPrivacyCenter:y,contents:l,deleteExtraAttributeValues:m=!1,classifyService:f=!1}){let u=T(i,c);try{return!await x(l,u,{pageSize:h,publishToPrivacyCenter:y,classifyService:f,deleteExtraAttributeValues:m})}catch(t){return n.error(o.red(`An unexpected error occurred syncing the schema: ${t.message}`)),!1}}async function H({file:i="./transcend.yml",transcendUrl:c,auth:h,variables:y,pageSize:l,publishToPrivacyCenter:m,classifyService:f,deleteExtraAttributeValues:u}){let t=await v(h),N=A(y),p;if(Array.isArray(t)&&F(i).isDirectory()?p=C(i).map(e=>L(i,e)):p=i.split(","),p.length<1)throw new Error("No file specified!");let s=p.map(e=>{z(e)?n.info(o.magenta(`Reading file "${e}"...`)):(n.error(o.red(`The file path does not exist on disk: ${e}. You can specify the filepath using --file=./examples/transcend.yml`)),process.exit(1));try{let r=b(e,N);return n.info(o.green(`Successfully read in "${e}"`)),{content:r,name:e.split("/").pop().replace(".yml","")}}catch(r){n.error(o.red(`The shape of your yaml file is invalid with the following errors: ${r.message}`)),process.exit(1)}});if(typeof t=="string"){let[e,...r]=s.map(({content:g})=>g),$=S(e,...r);await I({transcendUrl:c,auth:t,contents:$,publishToPrivacyCenter:m,deleteExtraAttributeValues:u,pageSize:l,classifyService:!!f})||(n.info(o.red(`Sync encountered errors. View output above for more information, or check out ${d}`)),process.exit(1))}else{if(s.length!==1&&s.length!==t.length)throw new Error(`Expected list of yml files to be equal to the list of API keys.Got ${s.length} YML file${s.length===1?"":"s"} and ${t.length} API key${t.length===1?"":"s"}`);let e=[];await w(t,async(r,$)=>{let a=`[${$+1}/${t.length}][${r.organizationName}] `;n.info(o.magenta(`~~~
|
|
2
|
+
|
|
3
|
+
${a}Attempting to push configuration...
|
|
4
|
+
|
|
5
|
+
~~~`));let g=s.length===1?s[0].content:s.find(E=>E.name===r.organizationName)?.content;if(!g){n.error(o.red(`${a}Failed to find transcend.yml file for organization: "${r.organizationName}".`)),e.push(r.organizationName);return}await I({transcendUrl:c,auth:r.apiKey,contents:g,pageSize:l,publishToPrivacyCenter:m,deleteExtraAttributeValues:u,classifyService:f})?n.info(o.green(`${a}Successfully pushed configuration!`)):(n.error(o.red(`${a}Failed to sync configuration.`)),e.push(r.organizationName))}),e.length>0&&(n.info(o.red(`Sync encountered errors for "${e.join(",")}". View output above for more information, or check out ${d}`)),process.exit(1))}n.info(o.green(`Successfully synced yaml file to Transcend! View at ${d}`))}export{H as push};
|
|
6
|
+
//# sourceMappingURL=impl-X6N6NFUV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/inventory/push/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\n\nimport { logger } from '../../../logger';\nimport { mapSeries } from '../../../lib/bluebird-replace';\nimport { existsSync, lstatSync } from 'fs';\nimport { join } from 'path';\nimport { readTranscendYaml } from '../../../lib/readTranscendYaml';\nimport colors from 'colors';\nimport {\n buildTranscendGraphQLClient,\n syncConfigurationToTranscend,\n} from '../../../lib/graphql';\n\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants';\nimport { TranscendInput } from '../../../codecs';\nimport { validateTranscendAuth, listFiles } from '../../../lib/api-keys';\nimport { mergeTranscendInputs } from '../../../lib/mergeTranscendInputs';\nimport { parseVariablesFromString } from '../../../lib/helpers/parseVariablesFromString';\n\n/**\n * Sync configuration to Transcend\n *\n * @param options - Options\n * @returns True if synced successfully, false if error occurs\n */\nasync function syncConfiguration({\n transcendUrl,\n auth,\n pageSize,\n publishToPrivacyCenter,\n contents,\n deleteExtraAttributeValues = false,\n classifyService = false,\n}: {\n /** Transcend YAML */\n contents: TranscendInput;\n /** Transcend URL */\n transcendUrl: string;\n /** API key */\n auth: string;\n /** Page size */\n pageSize: number;\n /** Skip privacy center publish step */\n publishToPrivacyCenter: boolean;\n /** classify data flow service if missing */\n classifyService?: boolean;\n /** Delete attributes when syncing */\n deleteExtraAttributeValues?: boolean;\n}): Promise<boolean> {\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Sync to Transcend\n try {\n const encounteredError = await syncConfigurationToTranscend(\n contents,\n client,\n {\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n },\n );\n return !encounteredError;\n } catch (err) {\n logger.error(\n colors.red(\n `An unexpected error occurred syncing the schema: ${err.message}`,\n ),\n );\n return false;\n }\n}\n\ninterface PushCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n pageSize: number;\n variables: string;\n publishToPrivacyCenter: boolean;\n classifyService: boolean;\n deleteExtraAttributeValues: boolean;\n}\n\nexport async function push(\n this: LocalContext,\n {\n file = './transcend.yml',\n transcendUrl,\n auth,\n variables,\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n }: PushCommandFlags,\n): Promise<void> {\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Parse out the variables\n const vars = parseVariablesFromString(variables);\n\n // check if we are being passed a list of API keys and a list of files\n let fileList: string[];\n if (Array.isArray(apiKeyOrList) && lstatSync(file).isDirectory()) {\n fileList = listFiles(file).map((filePath) => join(file, filePath));\n } else {\n fileList = file.split(',');\n }\n\n // Ensure at least one file is parsed\n if (fileList.length < 1) {\n throw new Error('No file specified!');\n }\n\n // eslint-disable-next-line array-callback-return,consistent-return\n const transcendInputs = fileList.map((filePath) => {\n // Ensure yaml file exists on disk\n if (!existsSync(filePath)) {\n logger.error(\n colors.red(\n `The file path does not exist on disk: ${filePath}. You can specify the filepath using --file=./examples/transcend.yml`,\n ),\n );\n process.exit(1);\n } else {\n logger.info(colors.magenta(`Reading file \"${filePath}\"...`));\n }\n\n try {\n // Read in the yaml file and validate it's shape\n const newContents = readTranscendYaml(filePath, vars);\n logger.info(colors.green(`Successfully read in \"${filePath}\"`));\n return {\n content: newContents,\n name: filePath.split('/').pop()!.replace('.yml', ''),\n };\n } catch (err) {\n logger.error(\n colors.red(\n `The shape of your yaml file is invalid with the following errors: ${err.message}`,\n ),\n );\n process.exit(1);\n }\n });\n\n // process a single API key\n if (typeof apiKeyOrList === 'string') {\n // if passed multiple inputs, merge them together\n const [base, ...rest] = transcendInputs.map(({ content }) => content);\n const contents = mergeTranscendInputs(base, ...rest);\n\n // sync the configuration\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKeyOrList,\n contents,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n pageSize,\n classifyService: !!classifyService,\n });\n\n // exist with error code\n if (!success) {\n logger.info(\n colors.red(\n `Sync encountered errors. View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n process.exit(1);\n }\n } else {\n // if passed multiple inputs, expect them to be one per instance\n if (\n transcendInputs.length !== 1 &&\n transcendInputs.length !== apiKeyOrList.length\n ) {\n throw new Error(\n 'Expected list of yml files to be equal to the list of API keys.' +\n `Got ${transcendInputs.length} YML file${\n transcendInputs.length === 1 ? '' : 's'\n } and ${apiKeyOrList.length} API key${\n apiKeyOrList.length === 1 ? '' : 's'\n }`,\n );\n }\n\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${\n apiKey.organizationName\n }] `;\n logger.info(\n colors.magenta(\n `~~~\\n\\n${prefix}Attempting to push configuration...\\n\\n~~~`,\n ),\n );\n\n // use the merged contents if 1 yml passed, else use the contents that map to that organization\n const useContents =\n transcendInputs.length === 1\n ? transcendInputs[0].content\n : transcendInputs.find(\n (input) => input.name === apiKey.organizationName,\n )?.content;\n\n // Throw error if cannot find a yml file matching that organization name\n if (!useContents) {\n logger.error(\n colors.red(\n `${prefix}Failed to find transcend.yml file for organization: \"${apiKey.organizationName}\".`,\n ),\n );\n encounteredErrors.push(apiKey.organizationName);\n return;\n }\n\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKey.apiKey,\n contents: useContents,\n pageSize,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n classifyService,\n });\n\n if (success) {\n logger.info(\n colors.green(`${prefix}Successfully pushed configuration!`),\n );\n } else {\n logger.error(colors.red(`${prefix}Failed to sync configuration.`));\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n logger.info(\n colors.red(\n `Sync encountered errors for \"${encounteredErrors.join(\n ',',\n )}\". View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n process.exit(1);\n }\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced yaml file to Transcend! View at ${ADMIN_DASH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A,EAAM,OAASJ,EAAO,gBACnC,GAAG,QAGT,GAAI,CAACG,EAAa,CAChB5B,EAAO,MACLC,EAAO,IACL,GAAG0B,CAAM,wDAAwDF,EAAO,gBAAgB,IAC1F,CACF,EACAF,EAAkB,KAAKE,EAAO,gBAAgB,EAC9C,MACF,CAEgB,MAAMrC,EAAkB,CACtC,aAAAC,EACA,KAAMoC,EAAO,OACb,SAAUG,EACV,SAAArC,EACA,uBAAAC,EACA,2BAAAE,EACA,gBAAAC,CACF,CAAC,EAGCK,EAAO,KACLC,EAAO,MAAM,GAAG0B,CAAM,oCAAoC,CAC5D,GAEA3B,EAAO,MAAMC,EAAO,IAAI,GAAG0B,CAAM,+BAA+B,CAAC,EACjEJ,EAAkB,KAAKE,EAAO,gBAAgB,EAElD,CAAC,EAEGF,EAAkB,OAAS,IAC7BvB,EAAO,KACLC,EAAO,IACL,gCAAgCsB,EAAkB,KAChD,GACF,CAAC,2DAA2DD,CAAuB,EACrF,CACF,EAEA,QAAQ,KAAK,CAAC,EAElB,CAGAtB,EAAO,KACLC,EAAO,MACL,uDAAuDqB,CAAuB,EAChF,CACF,CACF","names":["existsSync","lstatSync","join","colors","syncConfiguration","transcendUrl","auth","pageSize","publishToPrivacyCenter","contents","deleteExtraAttributeValues","classifyService","client","buildTranscendGraphQLClient","syncConfigurationToTranscend","err","logger","colors","push","file","variables","apiKeyOrList","validateTranscendAuth","vars","parseVariablesFromString","fileList","lstatSync","listFiles","filePath","join","transcendInputs","existsSync","newContents","readTranscendYaml","base","rest","content","mergeTranscendInputs","ADMIN_DASH_INTEGRATIONS","encounteredErrors","mapSeries","apiKey","ind","prefix","useContents","input"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{T as t}from"./chunk-N6JZHL5U.js";import"./chunk-MK5T6DBK.js";import"./chunk-43JWXG77.js";import"./chunk-L5ULN3IT.js";import"./chunk-EZHASXA5.js";import"./chunk-ARVEJERC.js";async function i({auth:e,dataSiloId:a,actions:o,transcendUrl:s}){await t({requestActions:o,transcendUrl:s,auth:e,dataSiloId:a})}export{i as retryRequestDataSilos};
|
|
2
|
+
//# sourceMappingURL=impl-XF3OTAQZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/request/system/retry-request-data-silos/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context';\nimport type { RequestAction } from '@transcend-io/privacy-types';\nimport { retryRequestDataSilos as retryRequestDataSilosHelper } from '../../../../lib/requests';\n\ninterface RetryRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n actions: RequestAction[];\n transcendUrl: string;\n}\n\nexport async function retryRequestDataSilos(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n actions,\n transcendUrl,\n }: RetryRequestDataSilosCommandFlags,\n): Promise<void> {\n await retryRequestDataSilosHelper({\n requestActions: actions,\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"],"mappings":"oLAWA,eAAsBA,EAEpB,CACE,KAAAC,EACA,WAAAC,EACA,QAAAC,EACA,aAAAC,CACF,EACe,CACf,MAAMJ,EAA4B,CAChC,eAAgBG,EAChB,aAAAC,EACA,KAAAH,EACA,WAAAC,CACF,CAAC,CACH","names":["retryRequestDataSilos","auth","dataSiloId","actions","transcendUrl"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as n,f as r}from"./chunk-2V6ABZRI.js";import{q as e}from"./chunk-N6JZHL5U.js";import"./chunk-MK5T6DBK.js";import"./chunk-43JWXG77.js";import"./chunk-L5ULN3IT.js";import"./chunk-EZHASXA5.js";import"./chunk-ARVEJERC.js";async function d({base64EncryptionKey:o,base64SigningKey:t,partition:s,file:i,consentUrl:a,concurrency:c}){let m=e(i,n);await r({base64EncryptionKey:o,base64SigningKey:t,preferences:m,partition:s,concurrency:c,transcendUrl:a})}export{d as uploadConsentPreferences};
|
|
2
|
+
//# sourceMappingURL=impl-XH3KTZRN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../src/commands/consent/upload-consent-preferences/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\n\nimport { uploadConsents } from '../../../lib/consent-manager/uploadConsents';\nimport { ConsentPreferenceUpload } from '../../../lib/consent-manager/types';\nimport { readCsv } from '../../../lib/requests';\n\ninterface UploadConsentPreferencesCommandFlags {\n base64EncryptionKey: string;\n base64SigningKey: string;\n partition: string;\n file: string;\n consentUrl: string;\n concurrency: number;\n}\n\nexport async function uploadConsentPreferences(\n this: LocalContext,\n {\n base64EncryptionKey,\n base64SigningKey,\n partition,\n file,\n consentUrl,\n concurrency,\n }: UploadConsentPreferencesCommandFlags,\n): Promise<void> {\n // Load in preferences from csv\n const preferences = readCsv(file, ConsentPreferenceUpload);\n\n // Upload cookies\n await uploadConsents({\n base64EncryptionKey,\n base64SigningKey,\n preferences,\n partition,\n concurrency,\n transcendUrl: consentUrl,\n });\n}\n"],"mappings":"mOAeA,eAAsBA,EAEpB,CACE,oBAAAC,EACA,iBAAAC,EACA,UAAAC,EACA,KAAAC,EACA,WAAAC,EACA,YAAAC,CACF,EACe,CAEf,IAAMC,EAAcC,EAAQJ,EAAMK,CAAuB,EAGzD,MAAMC,EAAe,CACnB,oBAAAT,EACA,iBAAAC,EACA,YAAAK,EACA,UAAAJ,EACA,YAAAG,EACA,aAAcD,CAChB,CAAC,CACH","names":["uploadConsentPreferences","base64EncryptionKey","base64SigningKey","partition","file","consentUrl","concurrency","preferences","readCsv","ConsentPreferenceUpload","uploadConsents"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{O as t,n as e}from"./chunk-N6JZHL5U.js";import"./chunk-MK5T6DBK.js";import"./chunk-43JWXG77.js";import"./chunk-L5ULN3IT.js";import"./chunk-EZHASXA5.js";import"./chunk-ARVEJERC.js";async function y({auth:o,file:i,transcendUrl:n,cacheFilepath:a,requestReceiptFolder:r,sombraAuth:s,concurrency:l,attributes:c,isTest:d,isSilent:p,skipSendingReceipt:u,emailIsVerified:m,skipFilterStep:b,dryRun:g,debug:C,defaultPhoneCountryCode:f}){await t({cacheFilepath:a,requestReceiptFolder:r,file:i,auth:o,sombraAuth:s,concurrency:l,transcendUrl:n,defaultPhoneCountryCode:f,attributes:e(c),debug:C,skipFilterStep:b,isSilent:p,skipSendingReceipt:u,emailIsVerified:m,isTest:d,dryRun:g})}export{y as upload};
|
|
2
|
+
//# sourceMappingURL=impl-XQBTTRCU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/request/upload/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport {\n splitCsvToList,\n uploadPrivacyRequestsFromCsv,\n} from '../../../lib/requests';\n\ninterface UploadCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n cacheFilepath: string;\n requestReceiptFolder: string;\n sombraAuth?: string;\n concurrency: number;\n attributes: string;\n isTest: boolean;\n isSilent: boolean;\n skipSendingReceipt: boolean;\n emailIsVerified: boolean;\n skipFilterStep: boolean;\n dryRun: boolean;\n debug: boolean;\n defaultPhoneCountryCode: string;\n}\n\nexport async function upload(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n cacheFilepath,\n requestReceiptFolder,\n sombraAuth,\n concurrency,\n attributes,\n isTest,\n isSilent,\n skipSendingReceipt,\n emailIsVerified,\n skipFilterStep,\n dryRun,\n debug,\n defaultPhoneCountryCode,\n }: UploadCommandFlags,\n): Promise<void> {\n await uploadPrivacyRequestsFromCsv({\n cacheFilepath,\n requestReceiptFolder,\n file,\n auth,\n sombraAuth,\n concurrency,\n transcendUrl,\n defaultPhoneCountryCode,\n attributes: splitCsvToList(attributes),\n debug,\n skipFilterStep,\n isSilent,\n skipSendingReceipt,\n emailIsVerified,\n isTest,\n dryRun,\n });\n}\n"],"mappings":"2LAyBA,eAAsBA,EAEpB,CACE,KAAAC,EACA,KAAAC,EACA,aAAAC,EACA,cAAAC,EACA,qBAAAC,EACA,WAAAC,EACA,YAAAC,EACA,WAAAC,EACA,OAAAC,EACA,SAAAC,EACA,mBAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,OAAAC,EACA,MAAAC,EACA,wBAAAC,CACF,EACe,CACf,MAAMC,EAA6B,CACjC,cAAAb,EACA,qBAAAC,EACA,KAAAH,EACA,KAAAD,EACA,WAAAK,EACA,YAAAC,EACA,aAAAJ,EACA,wBAAAa,EACA,WAAYE,EAAeV,CAAU,EACrC,MAAAO,EACA,eAAAF,EACA,SAAAH,EACA,mBAAAC,EACA,gBAAAC,EACA,OAAAH,EACA,OAAAK,CACF,CAAC,CACH","names":["upload","auth","file","transcendUrl","cacheFilepath","requestReceiptFolder","sombraAuth","concurrency","attributes","isTest","isSilent","skipSendingReceipt","emailIsVerified","skipFilterStep","dryRun","debug","defaultPhoneCountryCode","uploadPrivacyRequestsFromCsv","splitCsvToList"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{g as w}from"./chunk-2LCGZ77N.js";import{c as d,d as c}from"./chunk-MA4JWWRO.js";import"./chunk-N6JZHL5U.js";import{Ke as v,b as h,pe as q}from"./chunk-MK5T6DBK.js";import{a as t}from"./chunk-43JWXG77.js";import"./chunk-L5ULN3IT.js";import"./chunk-EZHASXA5.js";import"./chunk-ARVEJERC.js";import i from"colors";import{uniq as u}from"lodash-es";async function W({file:n,fileTarget:a,transcendUrl:m,auth:p,sombraAuth:P,cronDataSiloId:S,targetDataSiloId:F,actions:x,skipRequestCount:g,pageLimit:l,chunkSize:s}){g&&t.info(i.yellow("Skipping request count as requested. This may help speed up the call.")),(Number.isNaN(s)||s<=0||s%l!==0)&&(t.error(i.red(`Invalid chunk size: "${s}". Must be a positive integer that is a multiple of ${l}.`)),process.exit(1));let N=q(m,p),{baseName:R,extension:T}=c(n),{baseName:j,extension:O}=c(a),$=0,b=0,f=0;await w({dataSiloId:S,auth:p,sombraAuth:P,actions:x,apiPageSize:l,savePageSize:s,onSave:async o=>{$+=o.length;let A=o.map(e=>e.requestId),D=u(A),y=await h(D,async e=>(await v(N,{requestId:e,dataSiloId:F})).map(({fileName:C,remoteId:I})=>{if(!I)throw new Error(`Failed to find remoteId for ${C} request: ${e}`);return{RecordId:I,Object:C.replace(".json","").split("/").pop()?.replace(" Information",""),Comment:"Customer data deletion request submitted via transcend.io"}}),{concurrency:10});b+=y.flat().length;let L=u(o.map(e=>Object.keys(e)).flat()),E=`${R}-${f}${T}`,G=`${j}-${f}${O}`;d(E,o,L),t.info(i.green(`Successfully wrote ${o.length} identifiers to file "${n}"`));let r=y.flat(),M=u(r.map(e=>Object.keys(e)).flat());d(G,r,M),t.info(i.green(`Successfully wrote ${r.length} identifiers to file "${a}"`)),t.info(i.blue(`Processed chunk of ${o.length} identifiers, found ${r.length} target identifiers`)),f+=1},transcendUrl:m,skipRequestCount:g}),t.info(i.green(`Successfully wrote ${$} identifiers to file "${n}"`)),t.info(i.green(`Successfully wrote ${b} identifiers to file "${a}"`))}export{W as pullProfiles};
|
|
2
|
+
//# sourceMappingURL=impl-YA2HU57Y.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/request/cron/pull-profiles/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\nimport { logger } from '../../../../logger';\nimport colors from 'colors';\nimport { uniq } from 'lodash-es';\nimport { map } from '../../../../lib/bluebird-replace';\nimport {\n buildTranscendGraphQLClient,\n fetchRequestFilesForRequest,\n} from '../../../../lib/graphql';\nimport type { LocalContext } from '../../../../context';\nimport {\n parseFilePath,\n pullChunkedCustomSiloOutstandingIdentifiers,\n writeCsv,\n type CsvFormattedIdentifier,\n} from '../../../../lib/cron';\n\ninterface PullProfilesCommandFlags {\n file: string;\n fileTarget: string;\n transcendUrl: string;\n auth: string;\n sombraAuth?: string;\n cronDataSiloId: string;\n targetDataSiloId: string;\n actions: RequestAction[];\n skipRequestCount: boolean;\n pageLimit: number;\n chunkSize: number;\n}\n\nexport async function pullProfiles(\n this: LocalContext,\n {\n file,\n fileTarget,\n transcendUrl,\n auth,\n sombraAuth,\n cronDataSiloId,\n targetDataSiloId,\n actions,\n skipRequestCount,\n pageLimit,\n chunkSize,\n }: PullProfilesCommandFlags,\n): Promise<void> {\n if (skipRequestCount) {\n logger.info(\n colors.yellow(\n 'Skipping request count as requested. This may help speed up the call.',\n ),\n );\n }\n\n if (\n Number.isNaN(chunkSize) ||\n chunkSize <= 0 ||\n chunkSize % pageLimit !== 0\n ) {\n logger.error(\n colors.red(\n `Invalid chunk size: \"${chunkSize}\". Must be a positive integer that is a multiple of ${pageLimit}.`,\n ),\n );\n process.exit(1);\n }\n\n // Create GraphQL client to connect to Transcend backend\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const { baseName, extension } = parseFilePath(file);\n const { baseName: baseNameTarget, extension: extensionTarget } =\n parseFilePath(fileTarget);\n\n let allIdentifiersCount = 0;\n let allTargetIdentifiersCount = 0;\n let fileCount = 0;\n // Create onSave callback to handle chunked processing\n const onSave = async (chunk: CsvFormattedIdentifier[]): Promise<void> => {\n // Add to all identifiers\n allIdentifiersCount += chunk.length;\n\n // Get unique request IDs from this chunk\n const requestIds = chunk.map((d) => d.requestId as string);\n const uniqueRequestIds = uniq(requestIds);\n\n // Pull down target identifiers for this chunk\n const results = await map(\n uniqueRequestIds,\n async (requestId) => {\n const results = await fetchRequestFilesForRequest(client, {\n requestId,\n dataSiloId: targetDataSiloId,\n });\n return results.map(({ fileName, remoteId }) => {\n if (!remoteId) {\n throw new Error(\n `Failed to find remoteId for ${fileName} request: ${requestId}`,\n );\n }\n return {\n RecordId: remoteId,\n Object: fileName\n .replace('.json', '')\n .split('/')\n .pop()\n ?.replace(' Information', ''),\n Comment:\n 'Customer data deletion request submitted via transcend.io',\n };\n });\n },\n {\n concurrency: 10,\n },\n );\n\n allTargetIdentifiersCount += results.flat().length;\n\n // Write the identifiers and target identifiers to CSV\n const headers = uniq(chunk.map((d) => Object.keys(d)).flat());\n const numberedFileName = `${baseName}-${fileCount}${extension}`;\n const numberedFileNameTarget = `${baseNameTarget}-${fileCount}${extensionTarget}`;\n writeCsv(numberedFileName, chunk, headers);\n logger.info(\n colors.green(\n `Successfully wrote ${chunk.length} identifiers to file \"${file}\"`,\n ),\n );\n\n const targetIdentifiers = results.flat();\n const headers2 = uniq(targetIdentifiers.map((d) => Object.keys(d)).flat());\n writeCsv(numberedFileNameTarget, targetIdentifiers, headers2);\n logger.info(\n colors.green(\n `Successfully wrote ${targetIdentifiers.length} identifiers to file \"${fileTarget}\"`,\n ),\n );\n\n logger.info(\n colors.blue(\n `Processed chunk of ${chunk.length} identifiers, found ${targetIdentifiers.length} target identifiers`,\n ),\n );\n fileCount += 1;\n };\n\n // Pull down outstanding identifiers using the new chunked function\n await pullChunkedCustomSiloOutstandingIdentifiers({\n dataSiloId: cronDataSiloId,\n auth,\n sombraAuth,\n actions,\n apiPageSize: pageLimit,\n savePageSize: chunkSize,\n onSave,\n transcendUrl,\n skipRequestCount,\n });\n\n logger.info(\n colors.green(\n `Successfully wrote ${allIdentifiersCount} identifiers to file \"${file}\"`,\n ),\n );\n logger.info(\n colors.green(\n `Successfully wrote ${allTargetIdentifiersCount} identifiers to file \"${fileTarget}\"`,\n ),\n );\n}\n"],"mappings":"uSAEA,OAAOA,MAAY,SACnB,OAAS,QAAAC,MAAY,YA4BrB,eAAsBC,EAEpB,CACE,KAAAC,EACA,WAAAC,EACA,aAAAC,EACA,KAAAC,EACA,WAAAC,EACA,eAAAC,EACA,iBAAAC,EACA,QAAAC,EACA,iBAAAC,EACA,UAAAC,EACA,UAAAC,CACF,EACe,CACXF,GACFG,EAAO,KACLC,EAAO,OACL,uEACF,CACF,GAIA,OAAO,MAAMF,CAAS,GACtBA,GAAa,GACbA,EAAYD,IAAc,KAE1BE,EAAO,MACLC,EAAO,IACL,wBAAwBF,CAAS,uDAAuDD,CAAS,GACnG,CACF,EACA,QAAQ,KAAK,CAAC,GAIhB,IAAMI,EAASC,EAA4BZ,EAA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,EAAWZ,EAAKW,EAAkB,IAAKb,GAAM,OAAO,KAAKA,CAAC,CAAC,EAAE,KAAK,CAAC,EACzEY,EAASD,EAAwBE,EAAmBC,CAAQ,EAC5D7B,EAAO,KACLC,EAAO,MACL,sBAAsB2B,EAAkB,MAAM,yBAAyBtC,CAAU,GACnF,CACF,EAEAU,EAAO,KACLC,EAAO,KACL,sBAAsBY,EAAM,MAAM,uBAAuBe,EAAkB,MAAM,qBACnF,CACF,EACAjB,GAAa,CACf,EAWE,aAAApB,EACA,iBAAAM,CACF,CAAC,EAEDG,EAAO,KACLC,EAAO,MACL,sBAAsBQ,CAAmB,yBAAyBpB,CAAI,GACxE,CACF,EACAW,EAAO,KACLC,EAAO,MACL,sBAAsBS,CAAyB,yBAAyBpB,CAAU,GACpF,CACF,CACF","names":["colors","uniq","pullProfiles","file","fileTarget","transcendUrl","auth","sombraAuth","cronDataSiloId","targetDataSiloId","actions","skipRequestCount","pageLimit","chunkSize","logger","colors","client","buildTranscendGraphQLClient","baseName","extension","parseFilePath","baseNameTarget","extensionTarget","allIdentifiersCount","allTargetIdentifiersCount","fileCount","pullChunkedCustomSiloOutstandingIdentifiers","chunk","requestIds","d","uniqueRequestIds","uniq","results","map","requestId","fetchRequestFilesForRequest","fileName","remoteId","headers","numberedFileName","numberedFileNameTarget","writeCsv","targetIdentifiers","headers2"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as a}from"./chunk-26T4RUOI.js";import"./chunk-2V6ABZRI.js";import"./chunk-N6JZHL5U.js";import"./chunk-LAYHULHH.js";import"./chunk-347UQP43.js";import"./chunk-MK5T6DBK.js";import"./chunk-43JWXG77.js";import"./chunk-L5ULN3IT.js";import"./chunk-EZHASXA5.js";import"./chunk-ARVEJERC.js";async function n({auth:o,trackerStatus:t,file:r,classifyService:s,transcendUrl:e}){await a({auth:o,trackerStatus:t,file:r,classifyService:s,transcendUrl:e})}export{n as uploadDataFlowsFromCsv};
|
|
2
|
+
//# sourceMappingURL=impl-YEGS4G24.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/consent/upload-data-flows-from-csv/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { uploadDataFlowsFromCsv as uploadDataFlowsFromCsvHelper } from '../../../lib/consent-manager';\nimport { ConsentTrackerStatus } from '@transcend-io/privacy-types';\n\ninterface UploadDataFlowsFromCsvCommandFlags {\n auth: string;\n trackerStatus: ConsentTrackerStatus;\n file: string;\n classifyService: boolean;\n transcendUrl: string;\n}\n\nexport async function uploadDataFlowsFromCsv(\n this: LocalContext,\n {\n auth,\n trackerStatus,\n file,\n classifyService,\n transcendUrl,\n }: UploadDataFlowsFromCsvCommandFlags,\n): Promise<void> {\n await uploadDataFlowsFromCsvHelper({\n auth,\n trackerStatus,\n file,\n classifyService,\n transcendUrl,\n });\n}\n"],"mappings":"oSAYA,eAAsBA,EAEpB,CACE,KAAAC,EACA,cAAAC,EACA,KAAAC,EACA,gBAAAC,EACA,aAAAC,CACF,EACe,CACf,MAAML,EAA6B,CACjC,KAAAC,EACA,cAAAC,EACA,KAAAC,EACA,gBAAAC,EACA,aAAAC,CACF,CAAC,CACH","names":["uploadDataFlowsFromCsv","auth","trackerStatus","file","classifyService","transcendUrl"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Q as e}from"./chunk-N6JZHL5U.js";import"./chunk-MK5T6DBK.js";import"./chunk-43JWXG77.js";import"./chunk-L5ULN3IT.js";import"./chunk-EZHASXA5.js";import"./chunk-ARVEJERC.js";async function A({auth:t,requestReceiptFolder:s,sombraAuth:r,actions:a,statuses:o,requestIds:i,createdAt:n,emailIsVerified:c,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:m,skipWaitingPeriod:l,createdAtBefore:p,createdAtAfter:f,concurrency:R,transcendUrl:q}){await e({requestReceiptFolder:s,auth:t,sombraAuth:r,requestActions:a,requestStatuses:o,requestIds:i,createdAt:n,emailIsVerified:c,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:m,skipWaitingPeriod:l,createdAtBefore:p,createdAtAfter:f,concurrency:R,transcendUrl:q})}export{A as restart};
|
|
2
|
+
//# sourceMappingURL=impl-YNBHGQJK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/request/restart/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { bulkRestartRequests } from '../../../lib/requests';\nimport type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\n\ninterface RestartCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses: RequestStatus[];\n transcendUrl: string;\n requestReceiptFolder: string;\n sombraAuth?: string;\n concurrency: number;\n requestIds?: string[];\n emailIsVerified: boolean;\n createdAt?: Date;\n silentModeBefore?: Date;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n sendEmailReceipt: boolean;\n copyIdentifiers: boolean;\n skipWaitingPeriod: boolean;\n}\n\nexport async function restart(\n this: LocalContext,\n {\n auth,\n requestReceiptFolder,\n sombraAuth,\n actions,\n statuses,\n requestIds,\n createdAt,\n emailIsVerified,\n silentModeBefore,\n sendEmailReceipt,\n copyIdentifiers,\n skipWaitingPeriod,\n createdAtBefore,\n createdAtAfter,\n concurrency,\n transcendUrl,\n }: RestartCommandFlags,\n): Promise<void> {\n await bulkRestartRequests({\n requestReceiptFolder,\n auth,\n sombraAuth,\n requestActions: actions,\n requestStatuses: statuses,\n requestIds,\n createdAt,\n emailIsVerified,\n silentModeBefore,\n sendEmailReceipt,\n copyIdentifiers,\n skipWaitingPeriod,\n createdAtBefore,\n createdAtAfter,\n concurrency,\n transcendUrl,\n });\n}\n"],"mappings":"oLAuBA,eAAsBA,EAEpB,CACE,KAAAC,EACA,qBAAAC,EACA,WAAAC,EACA,QAAAC,EACA,SAAAC,EACA,WAAAC,EACA,UAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,YAAAC,EACA,aAAAC,CACF,EACe,CACf,MAAMC,EAAoB,CACxB,qBAAAf,EACA,KAAAD,EACA,WAAAE,EACA,eAAgBC,EAChB,gBAAiBC,EACjB,WAAAC,EACA,UAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,YAAAC,EACA,aAAAC,CACF,CAAC,CACH","names":["restart","auth","requestReceiptFolder","sombraAuth","actions","statuses","requestIds","createdAt","emailIsVerified","silentModeBefore","sendEmailReceipt","copyIdentifiers","skipWaitingPeriod","createdAtBefore","createdAtAfter","concurrency","transcendUrl","bulkRestartRequests"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e as c}from"./chunk-OEB7WG3G.js";import{ia as i}from"./chunk-LAYHULHH.js";import"./chunk-347UQP43.js";import{a}from"./chunk-43JWXG77.js";import"./chunk-ARVEJERC.js";import*as p from"io-ts";import m from"colors";import{existsSync as u,readFileSync as g}from"fs";import{decodeCodec as d}from"@transcend-io/type-utils";import{ConsentTrackerStatus as l,DataFlowScope as C}from"@transcend-io/privacy-types";function P({file:e,output:n}){u(e)||(a.error(m.red(`File does not exist: --file="${e}"`)),process.exit(1));let f=d(p.array(i),g(e,"utf-8")),t=[],r=[];f.forEach(s=>{s.dataFlows.filter(({type:o})=>o!==C.CSP).forEach(o=>{t.push({value:o.value,type:o.type,status:l.Live,trackingPurposes:o.trackingPurposes})}),s.cookies.forEach(o=>{r.push({name:o.name,status:l.Live,trackingPurposes:o.trackingPurposes})})}),c(n,{"data-flows":t,cookies:r}),a.info(m.green(`Successfully wrote ${t.length} data flows and ${r.length} cookies to file "${n}"`))}export{P as consentManagerServiceJsonToYml};
|
|
2
|
+
//# sourceMappingURL=impl-ZJL2YE7A.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/inventory/consent-manager-service-json-to-yml/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport * as t from 'io-ts';\nimport { writeTranscendYaml } from '../../../lib/readTranscendYaml';\nimport colors from 'colors';\nimport { logger } from '../../../logger';\nimport { existsSync, readFileSync } from 'fs';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport {\n ConsentManagerServiceMetadata,\n CookieInput,\n DataFlowInput,\n} from '../../../codecs';\nimport {\n ConsentTrackerStatus,\n DataFlowScope,\n} from '@transcend-io/privacy-types';\n\ninterface ConsentManagerServiceJsonToYmlCommandFlags {\n file: string;\n output: string;\n}\n\nexport function consentManagerServiceJsonToYml(\n this: LocalContext,\n { file, output }: ConsentManagerServiceJsonToYmlCommandFlags,\n): void {\n // Ensure files exist\n if (!existsSync(file)) {\n logger.error(colors.red(`File does not exist: --file=\"${file}\"`));\n process.exit(1);\n }\n\n // Read in each consent manager configuration\n const services = decodeCodec(\n t.array(ConsentManagerServiceMetadata),\n readFileSync(file, 'utf-8'),\n );\n\n // Create data flows and cookie configurations\n const dataFlows: DataFlowInput[] = [];\n const cookies: CookieInput[] = [];\n services.forEach((service) => {\n service.dataFlows\n .filter(({ type }) => type !== DataFlowScope.CSP)\n .forEach((dataFlow) => {\n dataFlows.push({\n value: dataFlow.value,\n type: dataFlow.type,\n status: ConsentTrackerStatus.Live,\n trackingPurposes: dataFlow.trackingPurposes,\n });\n });\n\n service.cookies.forEach((cookie) => {\n cookies.push({\n name: cookie.name,\n status: ConsentTrackerStatus.Live,\n trackingPurposes: cookie.trackingPurposes,\n });\n });\n });\n\n // write to disk\n writeTranscendYaml(output, {\n 'data-flows': dataFlows,\n cookies,\n });\n\n logger.info(\n colors.green(\n `Successfully wrote ${dataFlows.length} data flows and ${cookies.length} cookies to file \"${output}\"`,\n ),\n );\n}\n"],"mappings":"4KACA,UAAYA,MAAO,QAEnB,OAAOC,MAAY,SAEnB,OAAS,cAAAC,EAAY,gBAAAC,MAAoB,KACzC,OAAS,eAAAC,MAAmB,2BAM5B,OACE,wBAAAC,EACA,iBAAAC,MACK,8BAOA,SAASC,EAEd,CAAE,KAAAC,EAAM,OAAAC,CAAO,EACT,CAEDC,EAAWF,CAAI,IAClBG,EAAO,MAAMC,EAAO,IAAI,gCAAgCJ,CAAI,GAAG,CAAC,EAChE,QAAQ,KAAK,CAAC,GAIhB,IAAMK,EAAWC,EACb,QAAMC,CAA6B,EACrCC,EAAaR,EAAM,OAAO,CAC5B,EAGMS,EAA6B,CAAC,EAC9BC,EAAyB,CAAC,EAChCL,EAAS,QAASM,GAAY,CAC5BA,EAAQ,UACL,OAAO,CAAC,CAAE,KAAAC,CAAK,IAAMA,IAASd,EAAc,GAAG,EAC/C,QAASe,GAAa,CACrBJ,EAAU,KAAK,CACb,MAAOI,EAAS,MAChB,KAAMA,EAAS,KACf,OAAQhB,EAAqB,KAC7B,iBAAkBgB,EAAS,gBAC7B,CAAC,CACH,CAAC,EAEHF,EAAQ,QAAQ,QAASG,GAAW,CAClCJ,EAAQ,KAAK,CACX,KAAMI,EAAO,KACb,OAAQjB,EAAqB,KAC7B,iBAAkBiB,EAAO,gBAC3B,CAAC,CACH,CAAC,CACH,CAAC,EAGDC,EAAmBd,EAAQ,CACzB,aAAcQ,EACd,QAAAC,CACF,CAAC,EAEDP,EAAO,KACLC,EAAO,MACL,sBAAsBK,EAAU,MAAM,mBAAmBC,EAAQ,MAAM,qBAAqBT,CAAM,GACpG,CACF,CACF","names":["t","colors","existsSync","readFileSync","decodeCodec","ConsentTrackerStatus","DataFlowScope","consentManagerServiceJsonToYml","file","output","existsSync","logger","colors","services","decodeCodec","ConsentManagerServiceMetadata","readFileSync","dataFlows","cookies","service","type","dataFlow","cookie","writeTranscendYaml"]}
|
|
@@ -116506,7 +116506,7 @@ declare function removeUnverifiedRequestIdentifiers({ requestActions, identifier
|
|
|
116506
116506
|
}): Promise<number>;
|
|
116507
116507
|
|
|
116508
116508
|
var description = "A command line interface for programmatic operations across Transcend.";
|
|
116509
|
-
var version = "
|
|
116509
|
+
var version = "8.0.0-alpha.1";
|
|
116510
116510
|
|
|
116511
116511
|
declare const name = "transcend";
|
|
116512
116512
|
declare const ADMIN_DASH = "https://app.transcend.io";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as Ui,b as ji,c as Hi,d as Vi}from"./chunk-HJULYIHF.js";import{a as Qi,b as Gi}from"./chunk-WO5MQBXP.js";import{a as ta}from"./chunk-L7ZIX4SU.js";import{a as Ti,b as Ai,c as yi}from"./chunk-FHZRITAV.js";import{a as xi}from"./chunk-4GLITB3Y.js";import{a as ue,b as he,c as fe,d as Pe,e as Te}from"./chunk-OEB7WG3G.js";import{a as Si,b as ki,c as Bi,d as Fi}from"./chunk-65I2PF73.js";import{a as bi,b as wi,c as Ei,d as Ii,e as Oi,f as Di,g as $i}from"./chunk-2LCGZ77N.js";import{a as Ri,b as Ci,c as Mi,d as Li,e as Ni}from"./chunk-MA4JWWRO.js";import{a as si,b as oi,c as ai,d as pi,e as ii,f as mi,g as ci,h as gi,i as li,j as ui}from"./chunk-26T4RUOI.js";import{a as di,d as hi,e as fi,f as Pi}from"./chunk-2V6ABZRI.js";import{A as kp,B as Bp,C as Fp,D as Qp,E as Gp,F as Up,G as jp,H as Hp,I as Vp,J as qp,K as vp,L as _p,M as zp,N as Jp,O as Wp,P as Zp,Q as Kp,R as Xp,S as Yp,T as ti,U as ei,V as ri,W as ni,a as ea,b as ra,c as na,d as sa,e as oa,f as aa,g as pa,h as ia,i as ma,j as ca,k as ga,l as da,m as la,n as ua,o as ha,p as fa,q as Pa,r as Ta,s as Aa,t as Np,u as Ep,v as Ip,w as Op,x as Dp,y as $p,z as Sp}from"./chunk-N6JZHL5U.js";import{$ as Kt,A as Rt,B as Ct,C as Mt,D as Lt,E as Nt,F as Et,G as It,H as Ot,I as Dt,J as $t,K as St,L as kt,M as Bt,N as Ft,O as Qt,P as Gt,Q as Ut,R as jt,S as Ht,T as Vt,U as qt,V as vt,W as _t,X as zt,Y as Jt,Z as Wt,_ as Zt,a as X,aa as Xt,b as Y,ba as Yt,c as tt,ca as te,d as et,da as ee,e as rt,ea as re,f as nt,fa as ne,g as st,ga as se,h as ot,ha as oe,i as at,ia as ae,j as pt,ja as pe,k as it,ka as ie,l as mt,la as me,m as ct,ma as ce,n as gt,na as ge,o as dt,oa as de,p as lt,pa as le,q as ut,r as ht,s as ft,t as Pt,u as Tt,v as At,w as yt,x as xt,y as bt,z as wt}from"./chunk-LAYHULHH.js";import{a as Z,b as K}from"./chunk-347UQP43.js";import{$ as fr,$a as Pn,$b as hs,$c as ho,$d as $a,A as Ve,Aa as Vr,Ab as qn,Ac as Hs,Ad as Uo,Ae as ap,B as qe,Ba as qr,Bb as vn,Bc as Vs,Bd as jo,Be as pp,C as ve,Ca as vr,Cb as _n,Cc as R,Cd as Ho,Ce as ip,D as _e,Da as _r,Db as zn,Dc as qs,Dd as Vo,De as mp,E as ze,Ea as zr,Eb as Jn,Ec as vs,Ed as qo,Ee as cp,F as Je,Fa as Jr,Fb as Wn,Fc as _s,Fd as vo,Fe as gp,G as We,Ga as Wr,Gb as b,Gc as zs,Gd as _o,Ge as dp,H as Ze,Ha as Zr,Hb as Zn,Hc as Js,Hd as zo,He as lp,I as Ke,Ia as Kr,Ib as Kn,Ic as Ws,Id as Jo,Ie as up,J as Xe,Ja as Xr,Jb as Xn,Jc as Zs,Jd as Wo,Je as hp,K as Ye,Ka as Yr,Kb as Yn,Kc as Ks,Kd as Zo,Ke as fp,L as tr,La as tn,Lb as ts,Lc as Xs,Ld as Ko,Le as Pp,M as er,Ma as en,Mb as es,Mc as Ys,Md as Xo,Me as Tp,N as rr,Na as rn,Nb as rs,Nc as to,Nd as Yo,Ne as f,O as nr,Oa as nn,Ob as ns,Oc as eo,Od as ya,Oe as Ap,P as sr,Pa as sn,Pb as ss,Pc as ro,Pd as xa,Q as or,Qa as on,Qb as os,Qc as no,Qd as ba,R as ar,Ra as an,Rb as as,Rc as so,Rd as wa,S as pr,Sa as pn,Sb as ps,Sc as oo,Sd as Ra,T as ir,Ta as mn,Tb as is,Tc as ao,Td as Ca,U as mr,Ua as cn,Ub as ms,Uc as po,Ud as Ma,V as cr,Va as gn,Vb as cs,Vc as io,Vd as La,W as gr,Wa as dn,Wb as gs,Wc as mo,Wd as Na,X as dr,Xa as ln,Xb as ds,Xc as co,Xd as Ea,Y as lr,Ya as un,Yb as ls,Yc as go,Yd as Ia,Z as ur,Za as hn,Zb as us,Zc as lo,Zd as Oa,_ as hr,_a as fn,_b as w,_c as uo,_d as Da,a as x,aa as Pr,ab as Tn,ac as fs,ad as fo,ae as Sa,ba as Tr,bb as An,bc as Ps,bd as Po,be as ka,c as Ae,ca as Ar,cb as yn,cc as Ts,cd as To,ce as Ba,d as ye,da as yr,db as xn,dc as As,dd as Ao,de as Fa,e as xe,ea as xr,eb as bn,ec as ys,ed as yo,ee as Qa,f as be,fa as br,fb as wn,fc as xs,fd as xo,fe as Ga,g as we,ga as wr,gb as Rn,gc as bs,gd as bo,ge as Ua,h as Re,ha as Rr,hb as Cn,hc as ws,hd as wo,he as ja,i as Ce,ia as Cr,ib as Mn,ic as Rs,id as h,ie as Ha,j as Me,ja as Mr,jb as Ln,jc as Cs,jd as Ro,je as Va,k as Le,ka as Lr,kb as Nn,kc as Ms,kd as Co,ke as qa,l as Ne,la as Nr,lb as En,lc as Ls,ld as Mo,le as va,m as Ee,ma as Er,mb as In,mc as Ns,md as Lo,me as _a,n as Ie,na as Ir,nb as On,nc as Es,nd as No,ne as za,o as Oe,oa as Or,ob as Dn,oc as Is,od as Eo,oe as Za,p as De,pa as Dr,pb as $n,pc as Os,pd as Io,pe as M,q as $e,qa as $r,qb as Sn,qc as Ds,qd as Oo,qe as Ka,r as Se,ra as Sr,rb as kn,rc as $s,rd as Do,re as Xa,s as ke,sa as kr,sb as Bn,sc as Ss,sd as $o,se as Ya,t as Be,ta as Br,tb as Fn,tc as ks,td as So,te as L,u as Fe,ua as Fr,ub as Qn,uc as Bs,ud as ko,ue as tp,v as Qe,va as Qr,vb as Gn,vc as Fs,vd as Bo,ve as ep,w as Ge,wa as Gr,wb as Un,wc as Qs,wd as Fo,we as rp,x as Ue,xa as Ur,xb as jn,xc as Gs,xd as C,xe as np,y as je,ya as jr,yb as Hn,yc as Us,yd as Qo,ye as sp,z as He,za as Hr,zb as Vn,zc as js,zd as Go,ze as op}from"./chunk-MK5T6DBK.js";import"./chunk-43JWXG77.js";import{a as yp,b as xp,c as bp,d as wp,e as N,f as Rp,g as Cp,h as Mp,i as Lp}from"./chunk-L5ULN3IT.js";import{a as Ja,b as Wa}from"./chunk-EZHASXA5.js";import{a as q,b as v,c as _,d as z,e as J,f as W}from"./chunk-ARVEJERC.js";import{apply as k,decodeCodec as I,getValues as B}from"@transcend-io/type-utils";import{createHandlebarsWithHelpers as O}from"@transcend-io/handlebars-utils";import{PromptStatus as D,ChatCompletionRole as l,PromptRunProductArea as A,QueueStatus as y}from"@transcend-io/privacy-types";var T=20;async function E(a){let e=[],r=0,t=!1;do{let{largeLanguageModels:{nodes:s}}=await w(a,b,{first:T,offset:r});e.push(...s),r+=T,t=s.length===T}while(t);return e.sort((s,o)=>s.name.localeCompare(o.name))}import{groupBy as F,keyBy as P,uniq as Q,chunk as G}from"lodash-es";function U(a){return new RegExp(`<${a}>([\\s\\S]+?)<\\/${a}>`)}function hm(a){return a}var j=a=>{try{return JSON.parse(a)}catch{return a}},$=class{prompts;handlebarsOptions;promptContentMap;largeLanguageModels=[];agentsByName={};agentsByAgentId={};graphQLClient;defaultVariables;variables;handlebars;transcendApiKey;transcendUrl;requireApproval;cacheDuration;lastUpdatedAt;constructor({prompts:e,handlebarsOptions:r={},transcendUrl:t=N,transcendApiKey:s,requireApproval:o=!0,cacheDuration:i,defaultVariables:p={}}){this.prompts=e,this.transcendUrl=t,this.transcendApiKey=s,this.variables=p,this.defaultVariables=p,this.graphQLClient=M(t,typeof s=="object"?s.release():s),this.requireApproval=o,this.cacheDuration=i,this.handlebarsOptions=r,this.handlebars=O(r)}async fetchPromptsAndMetadata(){let e=B(this.prompts),r=e.map(({id:n})=>n).filter(n=>!!n),t=e.map(({title:n})=>n).filter(n=>!!n),s=Q(e.map(({agentNames:n})=>n||[]).flat()),[o,i,p]=await Promise.all([R(this.graphQLClient,{promptIds:r,promptTitles:t}),E(this.graphQLClient),h(this.graphQLClient,{names:s})]);this.agentsByName=P(p,"name"),this.agentsByAgentId=P(p,"agentId"),this.largeLanguageModels=i.filter(n=>n.isTranscendHosted===!1);let m=P(o.prompts,"title"),c=P(o.prompts,"id");return this.variables={...o.calculatedVariables.reduce((n,g)=>Object.assign(n,{[g.name]:g.data?JSON.parse(g.data):g.data}),{}),...this.defaultVariables},this.handlebars=O({...this.handlebarsOptions,templates:[...this.handlebarsOptions.templates||[],...o.promptPartials.map(n=>({name:n.slug,content:n.content}))]}),this.promptContentMap=k(this.prompts,({id:n,title:g})=>{let d=n?c[n]:g?m[g]:void 0;if(!d)throw new Error(`Failed to find prompt with title: "${g}" and id: "${n}"`);return d}),this.lastUpdatedAt=new Date,o}async getAgentByName(e){let r=this.agentsByName[e];if(r)return r;let[t]=await h(this.graphQLClient,{names:[e]});if(t)return this.agentsByName[t.name]=t,this.agentsByAgentId[t.agentId]=t,t}async getPromptThreadBySlackTs(e){let[r]=await L(this.graphQLClient,{slackMessageTs:[e]});return r}async getAgentsByName(e){if(e.length<1)throw new Error("Expected at least one name to be provided");let{hasCache:r=[],missingCache:t=[]}=F(e,p=>this.agentsByName[p]?"hasCache":"missingCache"),s=r.map(p=>this.agentsByName[p]);if(t.length===0)return s;let o=G(t,50),i=[];return await x(o,async p=>{let m=await h(this.graphQLClient,{names:p});m.forEach(c=>{this.agentsByName[c.name]=c,this.agentsByAgentId[c.agentId]=c}),i.push(...m)}),[...s,...i]}getAgentFiles(e){return C(this.graphQLClient,e)}getLargeLanguageModel(e){let r=this.largeLanguageModels.find(t=>typeof e=="string"?t.id===e:t.name===e.name&&t.client===e.client);if(!r)throw new Error(`Failed to find model matching: ${typeof e=="string"?e:JSON.stringify(e)}`);return r}async getPromptDefinition(e){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let{promptContentMap:r}=this;if(!r)throw new Error("Expected this.promptContentMap to be defined");let t=r[e];if(!t)throw new Error(`Expected this.promptContentMap[${e}] to be defined`);return t}async compilePrompt(e,r){let t=await this.getPromptDefinition(e),s=this.prompts[e];if(!s)throw new Error(`Expected this.prompts[${e}] to be defined`);if(this.requireApproval&&t.status!==D.Approved)throw new Error(`Assessment "${t.title}" cannot be used because its in status: "${t.status}"`);if(t.status===D.Rejected)throw new Error(`Assessment "${t.title}" cannot be used because it's in status: "${t.status}"`);return I(s.paramCodec,r),this.handlebars.compile(t.content)({currentDate:new Date().toISOString(),...this.variables,...r})}parseAiResponse(e,r){let t=this.prompts[e];if(!t)throw new Error(`Expected this.prompts[${e}] to be defined`);let s=t.extractFromTag&&(U(t.extractFromTag).exec(r)||[])[1]||r;return I(t.outputCodec,j(s),!1)}async reportAndParsePromptRun(e,{largeLanguageModel:r,...t}){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let s=t.name||`@transcend-io/cli-prompt-run-${new Date().toISOString()}`;if(!this.promptContentMap)throw new Error("Expected this.promptContentMap to be defined");let o=this.promptContentMap[e];if(!o)throw new Error(`Expected this.prompts[${e}] to be defined`);if(t.promptRunMessages.length===0)throw new Error("promptRunMessages is expected to have length > 0");if(t.promptRunMessages[0].role!==l.System)throw new Error(`promptRunMessages[0].role is expected to be = ${l.System}`);if(t.promptRunMessages[t.promptRunMessages.length-1].role!==l.Assistant)throw new Error(`promptRunMessages[${t.promptRunMessages.length-1}].role is expected to be = ${l.Assistant}`);let i=t.promptRunMessages[t.promptRunMessages.length-1].content,p;try{p=this.parseAiResponse(e,i)}catch(c){throw await f(this.graphQLClient,{productArea:A.PromptManager,...t,name:s,error:c.message,status:y.Error,...typeof r=="string"?{largeLanguageModelId:r}:{largeLanguageModelName:r.name,largeLanguageModelClient:r.client},promptId:o.id,promptRunMessages:t.promptRunMessages.map((n,g)=>({...n,...g===0?{template:o.content}:{}}))}),c}let m=await f(this.graphQLClient,{productArea:A.PromptManager,...t,name:s,status:y.Resolved,...typeof r=="string"?{largeLanguageModelId:r}:{largeLanguageModelName:r.name,largeLanguageModelClient:r.client},promptId:o.id,promptRunMessages:t.promptRunMessages.map((c,n)=>({...c,...n===0?{template:o.content}:{}}))});return{result:p,promptRunId:m,promptRunUrl:`https://app.transcend.io/prompts/runs/${m}`}}async reportPromptRunError(e,{largeLanguageModel:r,...t}){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let s=t.name||`@transcend-io/cli-prompt-run-${new Date().toISOString()}`;if(!this.promptContentMap)throw new Error("Expected this.promptContentMap to be defined");let o=this.promptContentMap[e];if(!o)throw new Error(`Expected this.prompts[${e}] to be defined`);if(t.promptRunMessages.length===0)throw new Error("promptRunMessages is expected to have length > 0");if(t.promptRunMessages[0].role!==l.System)throw new Error(`promptRunMessages[0].role is expected to be = ${l.System}`);let i=await f(this.graphQLClient,{productArea:A.PromptManager,...t,name:s,status:y.Error,...typeof r=="string"?{largeLanguageModelId:r}:{largeLanguageModelName:r.name,largeLanguageModelClient:r.client},promptId:o.id,promptRunMessages:t.promptRunMessages.map((p,m)=>({...p,...m===0?{template:o.content}:{}}))});return{promptRunId:i,promptRunUrl:`https://app.transcend.io/prompts/runs/${i}`}}};function Pm(a){let e=/(https?:\/\/[^\s]+)/g;return a.replace(e,"<link-omitted>")}function Am(a){return Object.entries(a).reduce((e,[r,t])=>t!=null&&t!==""&&!(Array.isArray(t)&&t.length===0)&&!(typeof t=="object"&&Object.keys(t).length===0)?Object.assign(e,{[r]:t}):e,{})}import{difference as H}from"lodash-es";import V from"fast-glob";import{execSync as u}from"child_process";function Rm({baseBranch:a,rootDirectory:e,githubRepo:r,excludedGlob:t=[],fileBlockList:s=[]}){u(`git fetch origin ${a}`);let o=u(`git ls-remote ${r} "refs/heads/${a}" | cut -f 1`,{encoding:"utf-8"}).split(`
|
|
2
|
+
`)[0],i=u("git rev-parse HEAD",{encoding:"utf-8"}).split(`
|
|
3
|
+
`)[0];if(!o||!i)throw new Error("FAILED TO FIND COMMIT RANGE");let p=u(`git fetch && git diff --name-only "${a||o}...${i}" -- ${e}`,{encoding:"utf-8"}),m=H(p.split(`
|
|
4
|
+
`).filter(d=>d),s),c=t.length>0?V.sync(m,{ignore:t}):m,n={};c.forEach(d=>{let S=u(`git show ${i}:${d}`,{encoding:"utf-8"});n[d]=S});let g=r.split("/").pop().split(".")[0];return{changedFiles:m,fileDiffs:n,repoName:g,commit:i}}export{Qn as ACTIONS,Zr as ADD_MESSAGES_TO_PROMPT_RUN,Ke as ADD_SILO_DISCOVERY_RESULTS,xp as ADMIN_DASH,wp as ADMIN_DASH_DATAPOINTS,bp as ADMIN_DASH_INTEGRATIONS,Zn as AGENTS,Yn as AGENT_FILES,rs as AGENT_FUNCTIONS,Je as API_KEYS,lr as APPROVE_PRIVACY_REQUEST,wr as ASSESSMENTS,br as ASSESSMENT_SECTION_FIELDS,Lr as ASSESSMENT_TEMPLATES,Wn as ASSUME_ROLE,tn as ATTRIBUTES,rr as ATTRIBUTE_KEYS_REQUESTS,sn as ATTRIBUTE_VALUES,Nt as ActionInput,Gt as ActionItemCollectionInput,Ut as ActionItemInput,dt as AgentFileInput,gt as AgentFunctionInput,ct as AgentInput,tt as ApiKeyInput,Na as AssessmentAction,_t as AssessmentAnswerOptionInput,Vt as AssessmentDisplayLogicInput,Xt as AssessmentInput,La as AssessmentNestedRule,Ht as AssessmentNestedRuleInput,Kt as AssessmentResourceInput,Wt as AssessmentRetentionScheduleInput,Ia as AssessmentRiskLogic,Ma as AssessmentRule,jt as AssessmentRuleInput,Jt as AssessmentSectionInput,zt as AssessmentSectionQuestionInput,Zt as AssessmentTemplateInput,Op as AttestedExtraIdentifiers,it as AttributeInput,mt as AttributePreview,pt as AttributeValueInput,na as BLANK,ra as BULK_APPLY,kn as BUSINESS_ENTITIES,bt as BusinessEntityInput,ur as CANCEL_PRIVACY_REQUEST,pa as CAN_APPLY_IN_BULK,Be as CATALOGS,Gr as CHANGE_REQUEST_DATA_SILO_STATUS,ar as CODE_PACKAGES,Sn as CONSENT_MANAGER_ANALYTICS_DATA,cn as CONSENT_PARTITIONS,hn as COOKIES,Hn as CREATE_ACTION_ITEMS,Xr as CREATE_ACTION_ITEM_COLLECTION,Kn as CREATE_AGENT,ts as CREATE_AGENT_FILE,ns as CREATE_AGENT_FUNCTION,We as CREATE_API_KEY,on as CREATE_ATTRIBUTE,en as CREATE_ATTRIBUTE_VALUES,Bn as CREATE_BUSINESS_ENTITY,ir as CREATE_CODE_PACKAGE,Dn as CREATE_CONSENT_EXPERIENCE,An as CREATE_CONSENT_MANAGER,$n as CREATE_CONSENT_PARTITION,gn as CREATE_DATA_FLOWS,Oe as CREATE_DATA_SILOS,He as CREATE_DATA_SUBJECT,ms as CREATE_DATA_SUB_CATEGORY,Se as CREATE_ENRICHER,Ge as CREATE_IDENTIFIER,ds as CREATE_PROCESSING_PURPOSE_SUB_CATEGORY,$r as CREATE_PROMPT,Fr as CREATE_PROMPT_GROUP,kr as CREATE_PROMPT_PARTIAL,ze as CREATE_REPOSITORY,or as CREATE_SOFTWARE_DEVELOPMENT_KIT,Vr as CREATE_TEAM,tr as CREATE_TEMPLATE,as as CREATE_VENDOR,ia as CachedFileState,ca as CachedRequestState,Ct as CodePackageInput,Rt as CodePackageSdk,oa as ColumnName,Dt as ConsentManageExperienceInput,St as ConsentManagerInput,Ss as ConsentManagerMetricBin,ae as ConsentManagerServiceMetadata,li as ConsentPreferenceResponse,te as ConsentPreferenceTopic,Yt as ConsentPreferenceTopicOptionValue,ee as ConsentPurpose,oe as CookieCsvInput,Ot as CookieInput,bi as CronIdentifier,Ei as CronIdentifierPush,Ce as DATAPOINT_EXPORT,un as DATA_FLOWS,Ae as DATA_POINTS,ye as DATA_POINT_COUNT,Le as DATA_SILOS,Ee as DATA_SILOS_ENRICHED,Ne as DATA_SILO_EXPORT,je as DATA_SUBJECTS,is as DATA_SUB_CATEGORIES,N as DEFAULT_TRANSCEND_API,Rp as DEFAULT_TRANSCEND_CONSENT_API,Sa as DEFAULT_TRANSCEND_PULL_RESOURCES,Ze as DELETE_API_KEY,nn as DELETE_ATTRIBUTE_VALUE,qn as DEPLOYED_PRIVACY_CENTER_URL,bn as DEPLOY_CONSENT_MANAGER,zn as DETERMINE_LOGIN_METHOD,ot as DataCategoryGuessInput,ut as DataCategoryInput,st as DataCategoryPreviewInput,at as DataCategoryRecommendationInput,se as DataFlowCsvInput,It as DataFlowInput,Qt as DataSiloInput,Lt as DataSubjectInput,yt as DatapointInput,Xe as ENABLED_PLUGINS,De as ENRICHERS,Me as ENTRY_COUNT,mn as EXPERIENCES,ji as EnrichPrivacyRequest,rt as EnricherInput,Pn as FETCH_CONSENT_MANAGER,fn as FETCH_CONSENT_MANAGER_ID,Tn as FETCH_CONSENT_MANAGER_THEME,Vn as FETCH_PRIVACY_CENTER_ID,At as FieldInput,Un as GLOBAL_ACTION_ITEMS,Kr as GLOBAL_ACTION_ITEM_COLLECTIONS,Fe as IDENTIFIERS,sa as IDENTIFIER_BLOCK_LIST,Rr as IMPORT_ONE_TRUST_ASSESSMENT_FORMS,$e as INITIALIZER,mi as IP_ADDRESS_REGEX,aa as IS_REQUIRED,Et as IdentifierInput,le as ImportOnetrustAssessmentsInput,kp as IntlMessage,Ft as IntlMessageInput,b as LARGE_LANGUAGE_MODELS,Jn as LOGIN,Pr as MESSAGES,Qe as NEW_IDENTIFIER_TYPES,ea as NONE,fr as NOTIFY_ADDITIONAL_TIME,er as ORGANIZATION,q as OneTrustFileFormat,v as OneTrustPullResource,_ as OneTrustPullSource,ie as OpenAIEnabledRoute,me as OpenAIEnabledRoutes,ce as OpenAIIntegration,W as OpenAIRouteName,cr as POLICIES,Mr as PREFERENCE_TOPICS,vn as PRIVACY_CENTER,gs as PROCESSING_PURPOSE_SUB_CATEGORIES,Nr as PROMPTS,Or as PROMPTS_WITH_VARIABLES,Ir as PROMPT_GROUPS,Er as PROMPT_PARTIALS,mr as PROMPT_THREADS,Cr as PURPOSES,ha as ParsedAttributeInput,$t as PartitionInput,ge as PathfinderPolicy,J as PathfinderPolicyName,pe as PathfinderPolicyNameC,de as PathfinderPromptRunMetadata,Bt as PolicyInput,kt as PrivacyCenterInput,np as PrivacyRequest,Dp as PrivacyRequestInput,jp as PrivacyRequestResponse,ht as ProcessingPurposeInput,nt as ProcessingPurposePreviewInput,xt as PromptAVendorEmailSettings,Tt as PromptGroupInput,ft as PromptInput,Pt as PromptPartialInput,fi as PurposeMap,jr as REDUCED_REQUESTS_FOR_DATA_SILO_COUNT,vr as REMOVE_REQUEST_IDENTIFIERS,Wr as REPORT_PROMPT_RUN,ve as REPOSITORIES,dr as REQUESTS,Qr as REQUEST_DATA_SILOS,Ar as REQUEST_ENRICHERS,Jr as REQUEST_FILES,_r as REQUEST_IDENTIFIERS,Ur as RETRY_REQUEST_DATA_SILO,yr as RETRY_REQUEST_ENRICHER,Mt as RepositoryInput,Bp as RequestFileMetadata,Fp as RequestFileMetadataResponse,op as RequestIdentifiersResponse,qt as RiskAssignmentInput,vt as RiskLogicInput,pn as SET_RESOURCE_ATTRIBUTES,xr as SKIP_REQUEST_ENRICHER,nr as SOFTWARE_DEVELOPMENT_KITS,us as SOMBRA_VERSION,xe as SUB_DATA_POINTS,be as SUB_DATA_POINTS_COUNT,we as SUB_DATA_POINTS_WITH_GUESSES,po as SYNC_ATTRIBUTE_TYPES,wt as SoftwareDevelopmentKitInput,ne as StoredApiKey,ma as SuccessfulRequest,Hr as TEAMS,Ye as TEMPLATES,En as TOGGLE_CONSENT_PRECEDENCE,qe as TOGGLE_DATA_SUBJECT,Nn as TOGGLE_TELEMETRY_PARTITION_STRATEGY,Ln as TOGGLE_UNKNOWN_COOKIE_POLICY,Mn as TOGGLE_UNKNOWN_REQUEST_POLICY,Mp as TR_PULL_RESOURCE_SCOPE_MAP,Cp as TR_PUSH_RESOURCE_SCOPE_MAP,Lp as TR_YML_RESOURCE_TO_FIELD_NAME,et as TeamInput,X as TemplateInput,re as TranscendInput,$ as TranscendPromptManager,z as TranscendPullResource,Gn as UPDATE_ACTION,jn as UPDATE_ACTION_ITEMS,Yr as UPDATE_ACTION_ITEM_COLLECTION,Xn as UPDATE_AGENTS,es as UPDATE_AGENT_FILES,ss as UPDATE_AGENT_FUNCTIONS,an as UPDATE_ATTRIBUTE,rn as UPDATE_ATTRIBUTE_VALUES,Fn as UPDATE_BUSINESS_ENTITIES,pr as UPDATE_CODE_PACKAGES,On as UPDATE_CONSENT_EXPERIENCE,wn as UPDATE_CONSENT_MANAGER_DOMAINS,Rn as UPDATE_CONSENT_MANAGER_PARTITION,In as UPDATE_CONSENT_MANAGER_THEME,xn as UPDATE_CONSENT_MANAGER_TO_LATEST,yn as UPDATE_CONSENT_MANAGER_VERSION,dn as UPDATE_DATA_FLOWS,Ie as UPDATE_DATA_SILOS,Ve as UPDATE_DATA_SUBJECT,cs as UPDATE_DATA_SUB_CATEGORIES,ke as UPDATE_ENRICHER,Ue as UPDATE_IDENTIFIER,Tr as UPDATE_INTL_MESSAGES,ln as UPDATE_OR_CREATE_COOKIES,Re as UPDATE_OR_CREATE_DATA_POINT,gr as UPDATE_POLICIES,_n as UPDATE_PRIVACY_CENTER,hr as UPDATE_PRIVACY_REQUEST,ls as UPDATE_PROCESSING_PURPOSE_SUB_CATEGORIES,Dr as UPDATE_PROMPTS,Br as UPDATE_PROMPT_GROUPS,Sr as UPDATE_PROMPT_PARTIALS,_e as UPDATE_REPOSITORIES,sr as UPDATE_SOFTWARE_DEVELOPMENT_KITS,qr as UPDATE_TEAM,Cn as UPDATE_TOGGLE_USP_API,ps as UPDATE_VENDORS,zr as USERS,hi as USP_STRING_REGEX,he as VARIABLE_PARAMETERS_NAME,ue as VARIABLE_PARAMETERS_REGEXP,os as VENDORS,lt as VendorInput,Y as WebhookHeader,Ap as addMessagesToPromptRun,Ci as appendCsvSync,Vp as approvePrivacyRequests,dp as assumeRole,K as buildAIIntegrationType,Z as buildEnabledRouteType,M as buildTranscendGraphQLClient,Za as buildTranscendGraphQLClientGeneric,ci as buildXdiSyncEndpoint,Kp as bulkRestartRequests,Yp as bulkRetryEnrichers,_p as cancelPrivacyRequests,gi as consentManagersToBusinessEntities,Rs as convertToDataSubjectAllowlist,ws as convertToDataSubjectBlockList,Lo as createActionItemCollection,Oo as createActionItems,Ro as createAgent,Qo as createAgentFile,ko as createAgentFunction,up as createApiKey,co as createBusinessEntity,Ha as createCodePackage,di as createConsentToken,_o as createDataCategory,fo as createDataFlows,Zo as createProcessingPurpose,qs as createPrompt,U as createRegexForTag,Ga as createRepository,Ba as createSoftwareDevelopmentKit,Ka as createSombraGotInstance,cp as createTranscendConsentGotInstance,Ho as createVendor,hm as defineTranscendPrompts,hp as deleteApiKey,Pp as deployConsentManager,Ja as description,ii as domainToHost,Up as downloadPrivacyRequestFiles,Hi as enrichPrivacyRequest,bs as ensureAllDataSubjectsExist,Jp as extractClientError,ya as fetchActiveSiloDiscoPlugin,Io as fetchAllActionItems,xo as fetchAllActions,C as fetchAllAgentFiles,So as fetchAllAgentFunctions,h as fetchAllAgents,js as fetchAllApiKeys,Ca as fetchAllAssessmentTemplates,Ra as fetchAllAssessments,ao as fetchAllAttributeValues,io as fetchAllAttributes,mo as fetchAllBusinessEntities,_a as fetchAllCatalogs,wa as fetchAllCookies,vo as fetchAllDataCategories,uo as fetchAllDataFlows,Ls as fetchAllDataPoints,Cs as fetchAllDataSilos,xs as fetchAllDataSubjects,Ts as fetchAllEnrichers,hs as fetchAllIdentifiers,ba as fetchAllMessages,Ws as fetchAllPolicies,Da as fetchAllPreferenceTopics,xa as fetchAllPrivacyCenters,Wo as fetchAllProcessingPurposes,wo as fetchAllPromptGroups,bo as fetchAllPromptPartials,L as fetchAllPromptThreads,Vs as fetchAllPrompts,no as fetchAllPurposes,$a as fetchAllPurposesAndPreferences,rp as fetchAllRequestAttributeKeys,pp as fetchAllRequestEnrichers,tp as fetchAllRequestIdentifierMetadata,ap as fetchAllRequestIdentifiers,sp as fetchAllRequests,Ms as fetchAllSubDataPoints,Gs as fetchAllTeams,Ao as fetchAllTemplates,lp as fetchAllUsers,jo as fetchAllVendors,za as fetchAndIndexCatalogs,Hs as fetchApiKeys,Os as fetchConsentManager,ks as fetchConsentManagerAnalyticsData,$s as fetchConsentManagerExperiences,Ds as fetchConsentManagerId,Bs as fetchConsentManagerTheme,ui as fetchConsentPreferences,Ns as fetchEnrichedDataSilos,fs as fetchIdentifiersAndCreateMissing,eo as fetchPartitions,Js as fetchPrivacyCenterId,zs as fetchPrivacyCenterUrl,R as fetchPromptsWithVariables,mp as fetchRequestDataSilo,ep as fetchRequestDataSiloActiveCount,ip as fetchRequestDataSilos,fp as fetchRequestFilesForRequest,Am as filterNullishValuesFromObject,Aa as filterRows,da as fuzzyMatchColumns,ga as fuzzySearch,Si as generateCrossAccountApiKeys,Qp as getFileMetadataForPrivacyRequests,Rm as getGitFilesThatChanged,Ta as getUniqueValuesForColumn,yi as inquirerAutoComplete,Ti as inquirerConfirmBoolean,Ai as inquirerConfirmText,Fi as listDirectories,Bi as listFiles,gp as loginUser,w as makeGraphQLRequest,zp as mapColumnsToAttributes,vp as mapColumnsToIdentifiers,Ep as mapCsvColumnsToApi,Sp as mapCsvRowsToRequestInputs,la as mapEnumValues,Ip as mapRequestEnumValues,Ii as markCronIdentifierCompleted,Di as markRequestDataSiloIdsCompleted,Np as markSilentPrivacyRequests,ta as mergeTranscendInputs,yp as name,$p as normalizeIdentifierValue,qp as notifyPrivacyRequestsAdditionalTime,Ea as parseAssessmentDisplayLogic,Oa as parseAssessmentRiskLogic,fa as parseAttributesFromString,Li as parseFilePath,xi as parseVariablesFromString,Qi as pullAllDatapoints,$i as pullChunkedCustomSiloOutstandingIdentifiers,pi as pullConsentManagerMetrics,wi as pullCronPageOfIdentifiers,Ui as pullManualEnrichmentIdentifiersToCsv,ei as pullPrivacyRequests,ka as pullTranscendConfiguration,Gi as pullUnstructuredSubDataPointRecommendations,Oi as pushCronIdentifiersFromCsv,Vi as pushManualEnrichmentIdentifiersFromCsv,Pa as readCsv,Pe as readTranscendYaml,Pm as removeLinks,ni as removeUnverifiedRequestIdentifiers,fe as replaceVariablesInYaml,f as reportPromptRun,Zp as restartPrivacyRequest,ti as retryRequestDataSilos,Ya as retryRequestEnricher,Xa as setResourceAttributes,Xp as skipPreflightJobs,ri as skipRequestDataSilos,ua as splitCsvToList,Gp as streamPrivacyRequestFiles,Hp as submitPrivacyRequest,To as syncAction,Eo as syncActionItemCollections,$o as syncActionItems,Uo as syncAgentFiles,Fo as syncAgentFunctions,Mo as syncAgents,ys as syncAttribute,lo as syncBusinessEntities,qa as syncCodePackages,Yo as syncConfigurationToTranscend,oo as syncConsentManager,so as syncConsentManagerExperiences,Qs as syncCookies,Jo as syncDataCategories,Po as syncDataFlows,Is as syncDataSiloDependencies,Es as syncDataSilos,Us as syncDataSubject,As as syncEnricher,Ps as syncIdentifier,Ys as syncIntlMessages,ro as syncPartitions,Ks as syncPolicies,to as syncPrivacyCenter,Xo as syncProcessingPurposes,_s as syncPrompts,ja as syncRepositories,Qa as syncSoftwareDevelopmentKits,yo as syncTemplate,qo as syncVendors,Do as updateActionItem,No as updateActionItemCollection,Go as updateAgentFiles,Bo as updateAgentFunctions,Co as updateAgents,go as updateBusinessEntities,Va as updateCodePackages,Tp as updateConsentManagerToLatest,si as updateConsentManagerVersionToLatest,zo as updateDataCategories,ho as updateDataFlows,Xs as updateIntlMessages,Fs as updateOrCreateCookies,Zs as updatePolicies,Ko as updateProcessingPurposes,vs as updatePrompts,Ua as updateRepositories,Fa as updateSoftwareDevelopmentKits,Vo as updateVendors,Pi as uploadConsents,ai as uploadCookiesFromCsv,oi as uploadDataFlowsFromCsv,Wp as uploadPrivacyRequestsFromCsv,va as uploadSiloDiscoveryResults,ki as validateTranscendAuth,Wa as version,Mi as writeCsv,Ri as writeCsvSync,Ni as writeLargeCsv,Te as writeTranscendYaml};
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/ai/TranscendPromptManager.ts","../src/lib/graphql/fetchLargeLanguageModels.ts","../src/lib/ai/removeLinks.ts","../src/lib/ai/filterNullishValuesFromObject.ts","../src/lib/ai/getGitFilesThatChanged.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport {\n Optionalize,\n Requirize,\n apply,\n decodeCodec,\n getValues,\n} from '@transcend-io/type-utils';\nimport type { Handlebars } from '@transcend-io/handlebars-utils';\nimport { Secret } from '@transcend-io/secret-value';\nimport * as t from 'io-ts';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\nimport {\n Agent,\n AgentFile,\n AgentFileFilterBy,\n ReportPromptRunInput,\n buildTranscendGraphQLClient,\n fetchAllAgentFiles,\n fetchAllAgents,\n reportPromptRun,\n} from '../graphql';\nimport {\n HandlebarsInput,\n createHandlebarsWithHelpers,\n} from '@transcend-io/handlebars-utils';\nimport {\n TranscendPromptTemplated,\n TranscendPromptsAndVariables,\n fetchPromptsWithVariables,\n} from '../graphql/fetchPrompts';\nimport { GraphQLClient } from 'graphql-request';\nimport {\n PromptStatus,\n ChatCompletionRole,\n PromptRunProductArea,\n QueueStatus,\n LargeLanguageModelClient,\n} from '@transcend-io/privacy-types';\nimport {\n LargeLanguageModel,\n fetchAllLargeLanguageModels,\n} from '../graphql/fetchLargeLanguageModels';\nimport { groupBy, keyBy, uniq, chunk } from 'lodash-es';\nimport { mapSeries } from '../bluebird-replace';\nimport {\n PromptThread,\n fetchAllPromptThreads,\n} from '../graphql/fetchPromptThreads';\n\n/**\n * An LLM Prompt definition\n */\nexport type TranscendPrompt<\n TInputParams extends t.Any,\n TOutputCodec extends t.Any,\n> = (\n | {\n /** ID of the prompt */\n id: string;\n /** Title of the prompt */\n title?: string;\n }\n | {\n /** ID of the prompt */\n id?: string;\n /** Title of the prompt */\n title: string;\n }\n) & {\n /** The names of the agents that should be loaded along with the prompt */\n agentNames?: string[];\n /** Codec to validate runtime input shape */\n paramCodec: TInputParams;\n /** Codec to validate output response */\n outputCodec: TOutputCodec;\n /**\n * If the output that needs to be parsed is returned within a tag\n * e.g. <tag> or <json> - this is the name of the tag\n */\n extractFromTag?: string;\n};\n\nexport interface PromptRunResult {\n /** The ID of the prompt run created on Transcend */\n promptRunId: string;\n /** The URL of the prompt run on Transcend */\n promptRunUrl: string;\n}\n\n/**\n * Create a regex to extract data from a tag\n *\n * Input:\n * \"here is some data <tag>Data</tag>...\"\n *\n * @param tagName - Name of tag\n * @returns Data within the tag\n */\nexport function createRegexForTag(tagName: string): RegExp {\n return new RegExp(`<${tagName}>([\\\\s\\\\S]+?)<\\\\/${tagName}>`);\n}\n\n/**\n * Helper function to declare prompts\n *\n * @param prompts - Prompt config\n * @returns Prompts as identity function - but type enforced\n */\nexport function defineTranscendPrompts<\n TPromptNames extends string,\n TPrompts extends { [k in TPromptNames]: TranscendPrompt<t.Any, t.Any> },\n>(prompts: TPrompts): TPrompts {\n return prompts;\n}\n\n/**\n * Helper to get the type of the parameter for a given prompt\n */\nexport type GetPromptParamType<\n TPromptName extends keyof TPrompts,\n TPrompts extends { [k in TPromptName]: TranscendPrompt<t.Any, t.Any> },\n> = t.TypeOf<TPrompts[TPromptName]['paramCodec']>;\n\n/**\n * Helper to get the type of the parameter for a given prompt\n */\nexport type GetPromptResponseType<\n TPromptName extends keyof TPrompts,\n TPrompts extends { [k in TPromptName]: TranscendPrompt<t.Any, t.Any> },\n> = t.TypeOf<TPrompts[TPromptName]['outputCodec']>;\n\n/**\n * Input for reporting a prompt run\n */\nexport interface ReportPromptRunOptions\n extends Optionalize<\n Omit<ReportPromptRunInput, 'status' | 'promptId' | 'largeLanguageModelId'>,\n 'name' | 'productArea'\n > {\n /** The large language model being run. Either the ID of the LLM or the client/name pairing */\n largeLanguageModel:\n | string\n | {\n /** Name of client */\n client: LargeLanguageModelClient;\n /** Name of the model */\n name: string;\n };\n}\n\nconst jsonParseSafe = (obj: string): unknown => {\n try {\n return JSON.parse(obj);\n } catch (e) {\n return obj;\n }\n};\n\n/**\n * A class that is capable of loading and insert variables into prompts from\n * Transcend's Prompt Manager\n */\nexport class TranscendPromptManager<\n TPromptNames extends string,\n TPrompts extends { [k in TPromptNames]: TranscendPrompt<t.Any, t.Any> },\n> {\n /** Prompt definitions */\n public prompts: TPrompts;\n\n /** Options for configuring handlebars */\n public handlebarsOptions!: HandlebarsInput;\n\n /** Prompt name -> content map, populated by call to Transcend API */\n public promptContentMap?: { [k in TPromptNames]: TranscendPromptTemplated };\n\n /** The large language models that are registered to this organization for reporting */\n public largeLanguageModels: LargeLanguageModel[] = [];\n\n /** The agent definitions registered to this organization */\n private agentsByName: { [name in string]: Agent } = {};\n\n /** The agent definitions registered to this organization */\n private agentsByAgentId: { [id in string]: Agent } = {};\n\n /** The GraphQL client that can be used to call Transcend */\n public graphQLClient: GraphQLClient;\n\n /** The set of variables to expose in handlebars context specified at class initiation */\n public defaultVariables: { [k in string]: unknown };\n\n /**\n * The set of variables to expose in handlebars context,\n * merges defaults with calculated variables from the inventory\n */\n public variables: { [k in string]: unknown };\n\n /** Handlebars compiler */\n public handlebars: typeof Handlebars;\n\n /** The Transcend API key */\n public transcendApiKey: string | Secret<string>;\n\n /** API of Transcend to call */\n public transcendUrl: string;\n\n /** When true, throw an error if the prompt is not approved */\n public requireApproval: boolean;\n\n /**\n * The cache duration in ms for how long prompts and associated metadata should be cached\n * When undefined - prompts are cached indefinitely unless explicitly re-requested\n * When 0, prompts and metadata are fetched every time (not recommended)\n * Setting this to be an hour is a good rate that optimizes for performance and keeping up to date\n */\n public cacheDuration?: number;\n\n /**\n * The last time the metadata was fetched\n */\n public lastUpdatedAt?: Date;\n\n /**\n * Constructor\n *\n * @param options - Options\n */\n constructor({\n prompts,\n handlebarsOptions = {},\n transcendUrl = DEFAULT_TRANSCEND_API,\n transcendApiKey,\n requireApproval = true,\n cacheDuration,\n defaultVariables = {},\n }: {\n /** Prompt definitions to load */\n prompts: TPrompts;\n /** Options for configuring handlebars */\n handlebarsOptions?: HandlebarsInput;\n /** The Transcend API key */\n transcendApiKey: string | Secret<string>;\n /** API of Transcend to call */\n transcendUrl?: string;\n /** When true, throw an error if the prompt is not approved */\n requireApproval?: boolean;\n /** The set of variables to expose in handlebars context specified at class initiation */\n defaultVariables?: { [k in string]: unknown };\n /**\n * The cache duration in ms for how long prompts and associated metadata should be cached\n * When undefined - prompts are cached indefinitely unless explicitly re-requested\n * When 0, prompts and metadata are fetched every time (not recommended)\n * Setting this to be an hour is a good rate that optimizes for performance and keeping up to date\n */\n cacheDuration?: number;\n }) {\n this.prompts = prompts;\n this.transcendUrl = transcendUrl;\n this.transcendApiKey = transcendApiKey;\n this.variables = defaultVariables;\n this.defaultVariables = defaultVariables;\n this.graphQLClient = buildTranscendGraphQLClient(\n transcendUrl,\n typeof transcendApiKey === 'object'\n ? transcendApiKey.release()\n : transcendApiKey,\n );\n this.requireApproval = requireApproval;\n this.cacheDuration = cacheDuration;\n this.handlebarsOptions = handlebarsOptions;\n this.handlebars = createHandlebarsWithHelpers(handlebarsOptions);\n }\n\n /**\n * Fetch prompt metadata from Transcend and cache to the class definition\n *\n * @returns A function that can be used to call the prompt\n */\n async fetchPromptsAndMetadata(): Promise<TranscendPromptsAndVariables> {\n // Determine what to fetch\n const promptDefinitions = getValues(this.prompts) as TranscendPrompt<\n t.Any,\n t.Any\n >[];\n const promptIds = promptDefinitions\n .map(({ id }) => id)\n .filter((x): x is string => !!x);\n const promptTitles = promptDefinitions\n .map(({ title }) => title)\n .filter((x): x is string => !!x);\n const agentNames = uniq(\n promptDefinitions.map(({ agentNames }) => agentNames || []).flat(),\n );\n\n // Fetch prompts and data\n const [response, largeLanguageModels, agents] = await Promise.all([\n fetchPromptsWithVariables(this.graphQLClient, {\n promptIds,\n promptTitles,\n }),\n fetchAllLargeLanguageModels(this.graphQLClient),\n fetchAllAgents(this.graphQLClient, { names: agentNames }),\n ]);\n this.agentsByName = keyBy(agents, 'name');\n this.agentsByAgentId = keyBy(agents, 'agentId');\n this.largeLanguageModels = largeLanguageModels.filter(\n (model) => model.isTranscendHosted === false,\n );\n\n // Lookup prompts by id/title\n const promptByTitle = keyBy(response.prompts, 'title');\n const promptById = keyBy(response.prompts, 'id');\n\n // Update variables\n this.variables = {\n ...response.calculatedVariables.reduce(\n (acc, v) =>\n Object.assign(acc, {\n [v.name]: v.data ? JSON.parse(v.data) : v.data,\n }),\n {},\n ),\n ...this.defaultVariables,\n };\n\n // Update partials\n this.handlebars = createHandlebarsWithHelpers({\n ...this.handlebarsOptions,\n templates: [\n ...(this.handlebarsOptions.templates || []),\n ...response.promptPartials.map((partial) => ({\n name: partial.slug,\n content: partial.content,\n })),\n ],\n });\n\n // Create mapping from prompt to content\n this.promptContentMap = apply(this.prompts, ({ id, title }) => {\n const result = id\n ? promptById[id]\n : title\n ? promptByTitle[title]\n : undefined;\n if (!result) {\n throw new Error(\n `Failed to find prompt with title: \"${title}\" and id: \"${id}\"`,\n );\n }\n return result;\n });\n\n // For cache\n this.lastUpdatedAt = new Date();\n\n return response;\n }\n\n /**\n * Get an agent definition by name\n *\n * @param name - Name of the agent to grab\n * @returns Large language model configuration\n */\n async getAgentByName(name: string): Promise<Agent | undefined> {\n const agent = this.agentsByName[name];\n if (agent) {\n return agent;\n }\n const [remoteAgent] = await fetchAllAgents(this.graphQLClient, {\n names: [name],\n });\n if (!remoteAgent) {\n return undefined;\n }\n this.agentsByName[remoteAgent.name] = remoteAgent;\n this.agentsByAgentId[remoteAgent.agentId] = remoteAgent;\n return remoteAgent;\n }\n\n /**\n * Get a prompt thread by ts\n *\n * @param ts - the slack message timestamp to look up thread for\n * @returns Large language model configuration\n */\n async getPromptThreadBySlackTs(\n ts: string,\n ): Promise<PromptThread | undefined> {\n const [thread] = await fetchAllPromptThreads(this.graphQLClient, {\n slackMessageTs: [ts],\n });\n return thread;\n }\n\n /**\n * Get a list of agent definitions by name.\n * Pulls from cache and may return less agents\n * than requested if some are not found\n *\n * @param names - Names of agents to fetch\n * @returns The agents that were found matching the names\n */\n async getAgentsByName(names: string[]): Promise<Agent[]> {\n if (names.length < 1) {\n throw new Error('Expected at least one name to be provided');\n }\n const { hasCache = [], missingCache = [] } = groupBy(names, (name) =>\n this.agentsByName[name] ? 'hasCache' : 'missingCache',\n );\n const cachedAgents = hasCache.map((name) => this.agentsByName[name]);\n if (missingCache.length === 0) {\n return cachedAgents;\n }\n const chunkedNames = chunk(missingCache, 50);\n const remoteAgents: Agent[] = [];\n await mapSeries(chunkedNames, async (chunkedName) => {\n const pageOfAgents = await fetchAllAgents(this.graphQLClient, {\n names: chunkedName,\n });\n pageOfAgents.forEach((agent) => {\n this.agentsByName[agent.name] = agent;\n this.agentsByAgentId[agent.agentId] = agent;\n });\n remoteAgents.push(...pageOfAgents);\n });\n return [...cachedAgents, ...remoteAgents];\n }\n\n /**\n * Fetch metadata on agent files\n *\n * @param filterBy - Filter by parameters\n * @returns The files found matching the filter\n */\n getAgentFiles(filterBy: AgentFileFilterBy): Promise<AgentFile[]> {\n return fetchAllAgentFiles(this.graphQLClient, filterBy);\n }\n\n /**\n * Look up the large language model to report on\n *\n * @param largeLanguageModel - Input\n * @returns Large language model configuration\n */\n getLargeLanguageModel(\n largeLanguageModel: ReportPromptRunOptions['largeLanguageModel'],\n ): LargeLanguageModel {\n const matching = this.largeLanguageModels.find((model) =>\n typeof largeLanguageModel === 'string'\n ? model.id === largeLanguageModel\n : model.name === largeLanguageModel.name &&\n model.client === largeLanguageModel.client,\n );\n if (!matching) {\n throw new Error(\n `Failed to find model matching: ${\n typeof largeLanguageModel === 'string'\n ? largeLanguageModel\n : JSON.stringify(largeLanguageModel)\n }`,\n );\n }\n return matching;\n }\n\n /**\n * Get a prompt definition by name\n *\n * @param promptName - Prompt to compile\n * @returns Parsed content\n */\n async getPromptDefinition<TPromptName extends TPromptNames>(\n promptName: TPromptName,\n ): Promise<TranscendPromptTemplated> {\n // Determine if prompts need to be fetched\n if (\n // never been fetched\n !this.lastUpdatedAt ||\n // fetch every run\n this.cacheDuration === 0 ||\n // If cache duration met\n (this.cacheDuration &&\n Date.now() - this.lastUpdatedAt.getTime() > this.cacheDuration)\n ) {\n await this.fetchPromptsAndMetadata();\n }\n\n // Lookup prompt\n const { promptContentMap } = this;\n if (!promptContentMap) {\n throw new Error('Expected this.promptContentMap to be defined');\n }\n const promptTemplate = promptContentMap[promptName];\n if (!promptTemplate) {\n throw new Error(\n `Expected this.promptContentMap[${promptName}] to be defined`,\n );\n }\n return promptTemplate;\n }\n\n /**\n * Validate the shape of the response from AI\n *\n * @param promptName - Prompt to compile\n * @param params - Runtime parameters\n * @returns Parsed content\n */\n async compilePrompt<TPromptName extends TPromptNames>(\n promptName: TPromptName,\n params: t.TypeOf<TPrompts[TPromptName]['paramCodec']>,\n ): Promise<string> {\n // Grab the prompt\n const promptTemplate = await this.getPromptDefinition(promptName);\n const promptInput = this.prompts[promptName];\n if (!promptInput) {\n throw new Error(`Expected this.prompts[${promptName}] to be defined`);\n }\n\n // Ensure prompt is approved\n if (\n this.requireApproval &&\n promptTemplate.status !== PromptStatus.Approved\n ) {\n throw new Error(\n `Assessment \"${promptTemplate.title}\" cannot be used because its in status: \"${promptTemplate.status}\"`,\n );\n }\n\n // If prompt is rejected, throw error\n if (promptTemplate.status === PromptStatus.Rejected) {\n throw new Error(\n `Assessment \"${promptTemplate.title}\" cannot be used because it's in status: \"${promptTemplate.status}\"`,\n );\n }\n\n // Validate params\n decodeCodec(promptInput.paramCodec, params);\n\n // Compile prompt and template\n return this.handlebars.compile(promptTemplate.content)({\n // template in currentDate by default\n currentDate: new Date().toISOString(),\n ...this.variables,\n ...params,\n });\n }\n\n /**\n * Validate the shape of the response from AI\n *\n * @param promptName - Prompt to parse\n * @param response - AI response as string\n * @returns Parsed content\n */\n parseAiResponse<TPromptName extends TPromptNames>(\n promptName: TPromptName,\n response: string,\n ): t.TypeOf<TPrompts[TPromptName]['outputCodec']> {\n // Look up prompt info\n const promptInput = this.prompts[promptName];\n if (!promptInput) {\n throw new Error(`Expected this.prompts[${promptName}] to be defined`);\n }\n\n // Extract from tag if needed\n const extracted = promptInput.extractFromTag\n ? (createRegexForTag(promptInput.extractFromTag).exec(response) ||\n [])[1] || response\n : response;\n\n // Parse via codec\n return decodeCodec(\n promptInput.outputCodec,\n jsonParseSafe(extracted),\n false,\n );\n }\n\n /**\n * Parse the AI response and report back to Transcend\n *\n * @param promptName - Prompt to parse\n * @param options - Options for reporting\n * @returns Parsed content\n */\n async reportAndParsePromptRun<TPromptName extends TPromptNames>(\n promptName: TPromptName,\n { largeLanguageModel, ...options }: ReportPromptRunOptions,\n ): Promise<\n PromptRunResult & {\n /** Resulting prompt run */\n result: t.TypeOf<TPrompts[TPromptName]['outputCodec']>;\n }\n > {\n // Determine if prompts need to be fetched\n if (\n // never been fetched\n !this.lastUpdatedAt ||\n // fetch every run\n this.cacheDuration === 0 ||\n // If cache duration met\n (this.cacheDuration &&\n Date.now() - this.lastUpdatedAt.getTime() > this.cacheDuration)\n ) {\n await this.fetchPromptsAndMetadata();\n }\n\n const name =\n options.name ||\n `@transcend-io/cli-prompt-run-${new Date().toISOString()}`;\n\n if (!this.promptContentMap) {\n throw new Error('Expected this.promptContentMap to be defined');\n }\n // Look up prompt info\n const promptInput = this.promptContentMap[promptName];\n if (!promptInput) {\n throw new Error(`Expected this.prompts[${promptName}] to be defined`);\n }\n\n // Ensure the first message in `promptRunMessages` is of type=system\n if (options.promptRunMessages.length === 0) {\n throw new Error('promptRunMessages is expected to have length > 0');\n }\n if (options.promptRunMessages[0].role !== ChatCompletionRole.System) {\n throw new Error(\n `promptRunMessages[0].role is expected to be = ${ChatCompletionRole.System}`,\n );\n }\n if (\n options.promptRunMessages[options.promptRunMessages.length - 1].role !==\n ChatCompletionRole.Assistant\n ) {\n throw new Error(\n `promptRunMessages[${\n options.promptRunMessages.length - 1\n }].role is expected to be = ${ChatCompletionRole.Assistant}`,\n );\n }\n const response =\n options.promptRunMessages[options.promptRunMessages.length - 1].content;\n\n let parsed: t.TypeOf<TPrompts[TPromptName]['outputCodec']>;\n try {\n // Parse the response\n parsed = this.parseAiResponse(promptName, response);\n } catch (err) {\n await reportPromptRun(this.graphQLClient, {\n productArea: PromptRunProductArea.PromptManager,\n ...options,\n name,\n error: err.message,\n status: QueueStatus.Error,\n ...(typeof largeLanguageModel === 'string'\n ? { largeLanguageModelId: largeLanguageModel }\n : {\n largeLanguageModelName: largeLanguageModel.name,\n largeLanguageModelClient: largeLanguageModel.client,\n }),\n promptId: promptInput.id,\n promptRunMessages: options.promptRunMessages.map((message, ind) => ({\n ...message,\n ...(ind === 0 ? { template: promptInput.content } : {}),\n })),\n });\n throw err;\n }\n\n // report successful run\n const promptRunId = await reportPromptRun(this.graphQLClient, {\n productArea: PromptRunProductArea.PromptManager,\n ...options,\n name,\n status: QueueStatus.Resolved,\n ...(typeof largeLanguageModel === 'string'\n ? { largeLanguageModelId: largeLanguageModel }\n : {\n largeLanguageModelName: largeLanguageModel.name,\n largeLanguageModelClient: largeLanguageModel.client,\n }),\n promptId: promptInput.id,\n promptRunMessages: options.promptRunMessages.map((message, ind) => ({\n ...message,\n ...(ind === 0 ? { template: promptInput.content } : {}),\n })),\n });\n\n return {\n result: parsed,\n promptRunId,\n promptRunUrl: `https://app.transcend.io/prompts/runs/${promptRunId}`,\n };\n }\n\n /**\n * Report an error for a particular prompt\n *\n * @param promptName - Prompt to parse\n * @param options - Options for reporting\n * @returns Parsed content\n */\n async reportPromptRunError<TPromptName extends TPromptNames>(\n promptName: TPromptName,\n {\n largeLanguageModel,\n ...options\n }: Requirize<ReportPromptRunOptions, 'error'>,\n ): Promise<PromptRunResult> {\n // Determine if prompts need to be fetched\n if (\n // never been fetched\n !this.lastUpdatedAt ||\n // fetch every run\n this.cacheDuration === 0 ||\n // If cache duration met\n (this.cacheDuration &&\n Date.now() - this.lastUpdatedAt.getTime() > this.cacheDuration)\n ) {\n await this.fetchPromptsAndMetadata();\n }\n\n const name =\n options.name ||\n `@transcend-io/cli-prompt-run-${new Date().toISOString()}`;\n\n if (!this.promptContentMap) {\n throw new Error('Expected this.promptContentMap to be defined');\n }\n // Look up prompt info\n const promptInput = this.promptContentMap[promptName];\n if (!promptInput) {\n throw new Error(`Expected this.prompts[${promptName}] to be defined`);\n }\n\n // Ensure the first message in `promptRunMessages` is of type=system\n if (options.promptRunMessages.length === 0) {\n throw new Error('promptRunMessages is expected to have length > 0');\n }\n if (options.promptRunMessages[0].role !== ChatCompletionRole.System) {\n throw new Error(\n `promptRunMessages[0].role is expected to be = ${ChatCompletionRole.System}`,\n );\n }\n\n const promptRunId = await reportPromptRun(this.graphQLClient, {\n productArea: PromptRunProductArea.PromptManager,\n ...options,\n name,\n status: QueueStatus.Error,\n ...(typeof largeLanguageModel === 'string'\n ? { largeLanguageModelId: largeLanguageModel }\n : {\n largeLanguageModelName: largeLanguageModel.name,\n largeLanguageModelClient: largeLanguageModel.client,\n }),\n promptId: promptInput.id,\n promptRunMessages: options.promptRunMessages.map((message, ind) => ({\n ...message,\n ...(ind === 0 ? { template: promptInput.content } : {}),\n })),\n });\n\n return {\n promptRunId,\n promptRunUrl: `https://app.transcend.io/prompts/runs/${promptRunId}`,\n };\n }\n}\n/* eslint-enable max-lines */\n","import { GraphQLClient } from 'graphql-request';\nimport { LargeLanguageModelClient } from '@transcend-io/privacy-types';\nimport { LARGE_LANGUAGE_MODELS } from './gqls';\nimport { makeGraphQLRequest } from './makeGraphQLRequest';\n\nexport interface LargeLanguageModel {\n /** ID of prompts */\n id: string;\n /** The name of the large language model. */\n name: string;\n /** The content of the prompt template. */\n client: LargeLanguageModelClient;\n /** Whether hosted by Transcend or not */\n isTranscendHosted: boolean;\n}\n\nconst PAGE_SIZE = 20;\n\n/**\n * Fetch all LargeLanguageModels in the organization\n *\n * @param client - GraphQL client\n * @returns All LargeLanguageModels in the organization\n */\nexport async function fetchAllLargeLanguageModels(\n client: GraphQLClient,\n): Promise<LargeLanguageModel[]> {\n const largeLanguageModels: LargeLanguageModel[] = [];\n let offset = 0;\n\n // Whether to continue looping\n let shouldContinue = false;\n do {\n const {\n largeLanguageModels: { nodes },\n } = await makeGraphQLRequest<{\n /** LargeLanguageModels */\n largeLanguageModels: {\n /** List */\n nodes: LargeLanguageModel[];\n };\n }>(client, LARGE_LANGUAGE_MODELS, {\n first: PAGE_SIZE,\n offset,\n });\n largeLanguageModels.push(...nodes);\n offset += PAGE_SIZE;\n shouldContinue = nodes.length === PAGE_SIZE;\n } while (shouldContinue);\n\n return largeLanguageModels.sort((a, b) => a.name.localeCompare(b.name));\n}\n","/**\n * Remove links from a string\n *\n * @param inputString - String\n * @returns String without links\n */\nexport function removeLinks(inputString: string): string {\n const regex = /(https?:\\/\\/[^\\s]+)/g;\n return inputString.replace(regex, '<link-omitted>');\n}\n","import { ObjByString } from '@transcend-io/type-utils';\n\n/**\n * Given an object, remove all keys that are null-ish\n *\n * @param obj - Object\n * @returns Object with null-ish values removed\n */\nexport function filterNullishValuesFromObject<T extends ObjByString>(\n obj: T,\n): T {\n return Object.entries(obj).reduce(\n (acc, [k, v]) =>\n v !== null &&\n v !== undefined &&\n v !== '' &&\n !(Array.isArray(v) && v.length === 0) &&\n !(typeof v === 'object' && Object.keys(v).length === 0)\n ? Object.assign(acc, { [k]: v })\n : acc,\n {} as T,\n );\n}\n","import { difference } from 'lodash-es';\nimport fastGlob from 'fast-glob';\nimport { execSync } from 'child_process';\n\n/**\n * Function thats gets the git files that have changed\n * and returns the code\n *\n * @param options - Options\n * @returns Changes files and diffs\n */\nexport function getGitFilesThatChanged({\n baseBranch,\n rootDirectory,\n githubRepo,\n excludedGlob = [],\n fileBlockList = [],\n}: {\n /** Base branch */\n baseBranch: string;\n /** Github repo name */\n githubRepo: string;\n /** Root directory */\n rootDirectory: string;\n /** A glob that excludes files */\n excludedGlob?: string[];\n /** Block list of files to not process */\n fileBlockList?: string[];\n}): {\n /** The list of files that changed */\n changedFiles: string[];\n /** Github repo name */\n repoName: string;\n /** Current commit */\n commit: string;\n /** File diffs */\n fileDiffs: { [k in string]: string };\n} {\n // Pull base branch\n execSync(`git fetch origin ${baseBranch}`);\n\n // Latest commit on base branch. If we are on the base branch, we take the prior commit\n const latestBasedCommit = execSync(\n `git ls-remote ${githubRepo} \"refs/heads/${baseBranch}\" | cut -f 1`,\n { encoding: 'utf-8' },\n ).split('\\n')[0];\n\n // This commit\n const latestThisCommit = execSync('git rev-parse HEAD', {\n encoding: 'utf-8',\n }).split('\\n')[0];\n\n // Ensure commits are present\n if (!latestBasedCommit || !latestThisCommit) {\n throw new Error('FAILED TO FIND COMMIT RANGE');\n }\n\n // Get the diff between the given branch and base branch\n const diff = execSync(\n `git fetch && git diff --name-only \"${\n baseBranch || latestBasedCommit\n }...${latestThisCommit}\" -- ${rootDirectory}`,\n { encoding: 'utf-8' },\n );\n\n // Filter out block list\n const changedFiles = difference(\n diff.split('\\n').filter((f) => f),\n fileBlockList,\n );\n\n // Filter out globs\n const filteredChanges =\n excludedGlob.length > 0\n ? fastGlob.sync(changedFiles, { ignore: excludedGlob })\n : changedFiles;\n\n // Get the contents of only the changed files\n const fileDiffs: { [k in string]: string } = {};\n filteredChanges.forEach((file) => {\n const contents = execSync(`git show ${latestThisCommit}:${file}`, {\n encoding: 'utf-8',\n });\n fileDiffs[file] = contents;\n });\n\n // Pull the github repo name\n const repoName = githubRepo.split('/').pop()!.split('.')[0];\n\n return {\n changedFiles,\n fileDiffs,\n repoName,\n commit: latestThisCommit,\n };\n}\n"],"mappings":"2tJACA,OAGE,SAAAA,EACA,eAAAC,EACA,aAAAC,MACK,2BAeP,OAEE,+BAAAC,MACK,iCAOP,OACE,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EAAgB,QAASE,GAAS,CAChC,IAAMC,EAAWf,EAAS,YAAYQ,CAAgB,IAAIM,CAAI,GAAI,CAChE,SAAU,OACZ,CAAC,EACDD,EAAUC,CAAI,EAAIC,CACpB,CAAC,EAGD,IAAMC,EAAWZ,EAAW,MAAM,GAAG,EAAE,IAAI,EAAG,MAAM,GAAG,EAAE,CAAC,EAE1D,MAAO,CACL,aAAAM,EACA,UAAAG,EACA,SAAAG,EACA,OAAQR,CACV,CACF","names":["apply","decodeCodec","getValues","createHandlebarsWithHelpers","PromptStatus","ChatCompletionRole","PromptRunProductArea","QueueStatus","PAGE_SIZE","fetchAllLargeLanguageModels","client","largeLanguageModels","offset","shouldContinue","nodes","makeGraphQLRequest","LARGE_LANGUAGE_MODELS","a","b","groupBy","keyBy","uniq","chunk","createRegexForTag","tagName","defineTranscendPrompts","prompts","jsonParseSafe","obj","TranscendPromptManager","handlebarsOptions","transcendUrl","DEFAULT_TRANSCEND_API","transcendApiKey","requireApproval","cacheDuration","defaultVariables","buildTranscendGraphQLClient","createHandlebarsWithHelpers","promptDefinitions","getValues","promptIds","id","x","promptTitles","title","agentNames","uniq","response","largeLanguageModels","agents","fetchPromptsWithVariables","fetchAllLargeLanguageModels","fetchAllAgents","keyBy","model","promptByTitle","promptById","acc","v","partial","apply","result","name","agent","remoteAgent","ts","thread","fetchAllPromptThreads","names","hasCache","missingCache","groupBy","cachedAgents","chunkedNames","chunk","remoteAgents","mapSeries","chunkedName","pageOfAgents","filterBy","fetchAllAgentFiles","largeLanguageModel","matching","promptName","promptContentMap","promptTemplate","params","promptInput","PromptStatus","decodeCodec","extracted","options","ChatCompletionRole","parsed","err","reportPromptRun","PromptRunProductArea","QueueStatus","message","ind","promptRunId","removeLinks","inputString","regex","filterNullishValuesFromObject","obj","acc","k","v","difference","fastGlob","execSync","getGitFilesThatChanged","baseBranch","rootDirectory","githubRepo","excludedGlob","fileBlockList","latestBasedCommit","latestThisCommit","diff","changedFiles","f","filteredChanges","fileDiffs","file","contents","repoName"]}
|