@transcend-io/cli 8.30.1 → 8.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/bin/bash-complete.cjs +1 -1
- package/dist/bin/cli.cjs +1 -1
- package/dist/bin/deprecated-command.cjs +2 -2
- package/dist/{chunk-LRADV5OI.cjs → chunk-5SEDJJAH.cjs} +2 -2
- package/dist/{chunk-LRADV5OI.cjs.map → chunk-5SEDJJAH.cjs.map} +1 -1
- package/dist/{chunk-T3BBQIRY.cjs → chunk-7PB6LVSE.cjs} +2 -2
- package/dist/chunk-7PB6LVSE.cjs.map +1 -0
- package/dist/{chunk-LU3DKRNK.cjs → chunk-ABKDAPPR.cjs} +2 -2
- package/dist/{chunk-LU3DKRNK.cjs.map → chunk-ABKDAPPR.cjs.map} +1 -1
- package/dist/{chunk-XEXS6R45.cjs → chunk-CBBHRSKJ.cjs} +2 -2
- package/dist/{chunk-XEXS6R45.cjs.map → chunk-CBBHRSKJ.cjs.map} +1 -1
- package/dist/{chunk-SPN6SWMF.cjs → chunk-CLJATLM4.cjs} +2 -2
- package/dist/{chunk-SPN6SWMF.cjs.map → chunk-CLJATLM4.cjs.map} +1 -1
- package/dist/{chunk-6KRRRMY2.cjs → chunk-EA6WCT7X.cjs} +21 -21
- package/dist/{chunk-6KRRRMY2.cjs.map → chunk-EA6WCT7X.cjs.map} +1 -1
- package/dist/{chunk-Z2DYKPKM.cjs → chunk-FMFQTG5Q.cjs} +2 -2
- package/dist/{chunk-Z2DYKPKM.cjs.map → chunk-FMFQTG5Q.cjs.map} +1 -1
- package/dist/{chunk-OMVVROKB.cjs → chunk-FZTNEEMW.cjs} +2 -2
- package/dist/{chunk-OMVVROKB.cjs.map → chunk-FZTNEEMW.cjs.map} +1 -1
- package/dist/{chunk-LZA5Y4SB.cjs → chunk-HAAVY3FG.cjs} +4 -4
- package/dist/{chunk-LZA5Y4SB.cjs.map → chunk-HAAVY3FG.cjs.map} +1 -1
- package/dist/{chunk-WURUFVEG.cjs → chunk-HUZESENZ.cjs} +2 -2
- package/dist/{chunk-WURUFVEG.cjs.map → chunk-HUZESENZ.cjs.map} +1 -1
- package/dist/{chunk-RAA5VWQS.cjs → chunk-J7BM4Z6U.cjs} +2 -2
- package/dist/{chunk-RAA5VWQS.cjs.map → chunk-J7BM4Z6U.cjs.map} +1 -1
- package/dist/{chunk-BQSBPO63.cjs → chunk-JH5HRI6D.cjs} +3 -3
- package/dist/{chunk-BQSBPO63.cjs.map → chunk-JH5HRI6D.cjs.map} +1 -1
- package/dist/{chunk-FIJLHU4Q.cjs → chunk-JSVWGZUF.cjs} +4 -4
- package/dist/{chunk-FIJLHU4Q.cjs.map → chunk-JSVWGZUF.cjs.map} +1 -1
- package/dist/{chunk-FHUHBSLE.cjs → chunk-TSJTXXLZ.cjs} +2 -2
- package/dist/{chunk-FHUHBSLE.cjs.map → chunk-TSJTXXLZ.cjs.map} +1 -1
- package/dist/{chunk-YYDWSYMF.cjs → chunk-UHERPTMC.cjs} +2 -2
- package/dist/{chunk-YYDWSYMF.cjs.map → chunk-UHERPTMC.cjs.map} +1 -1
- package/dist/{chunk-HTS7K7QD.cjs → chunk-VWGA62SG.cjs} +4 -4
- package/dist/{chunk-HTS7K7QD.cjs.map → chunk-VWGA62SG.cjs.map} +1 -1
- package/dist/{chunk-3FIDP42N.cjs → chunk-WAWECZTF.cjs} +2 -2
- package/dist/{chunk-3FIDP42N.cjs.map → chunk-WAWECZTF.cjs.map} +1 -1
- package/dist/{chunk-UXFL56TL.cjs → chunk-ZZPMCMEB.cjs} +6 -6
- package/dist/{chunk-UXFL56TL.cjs.map → chunk-ZZPMCMEB.cjs.map} +1 -1
- package/dist/{impl-5GGFGRTD.cjs → impl-2F2MAY5Q.cjs} +2 -2
- package/dist/{impl-5GGFGRTD.cjs.map → impl-2F2MAY5Q.cjs.map} +1 -1
- package/dist/{impl-BSIFPZLW.cjs → impl-3NPILIEL.cjs} +2 -2
- package/dist/{impl-BSIFPZLW.cjs.map → impl-3NPILIEL.cjs.map} +1 -1
- package/dist/impl-3X74MLJH.cjs +2 -0
- package/dist/{impl-J62VZXDY.cjs.map → impl-3X74MLJH.cjs.map} +1 -1
- package/dist/{impl-XAZ6YY3R.cjs → impl-4TYC4KRL.cjs} +2 -2
- package/dist/{impl-XAZ6YY3R.cjs.map → impl-4TYC4KRL.cjs.map} +1 -1
- package/dist/{impl-U76PZBUK.cjs → impl-5BYWLODX.cjs} +2 -2
- package/dist/{impl-U76PZBUK.cjs.map → impl-5BYWLODX.cjs.map} +1 -1
- package/dist/{impl-Z3EAXTJV.cjs → impl-64R4NW2W.cjs} +2 -2
- package/dist/{impl-Z3EAXTJV.cjs.map → impl-64R4NW2W.cjs.map} +1 -1
- package/dist/impl-7XQ333J3.cjs +2 -0
- package/dist/{impl-X6TORGVF.cjs.map → impl-7XQ333J3.cjs.map} +1 -1
- package/dist/{impl-COZ7ADUO.cjs → impl-AS634NMX.cjs} +4 -4
- package/dist/{impl-COZ7ADUO.cjs.map → impl-AS634NMX.cjs.map} +1 -1
- package/dist/{impl-OFB5I4S6.cjs → impl-B4H2FDZW.cjs} +2 -2
- package/dist/{impl-OFB5I4S6.cjs.map → impl-B4H2FDZW.cjs.map} +1 -1
- package/dist/{impl-BLIELFUK.cjs → impl-BBDBG5OZ.cjs} +3 -3
- package/dist/{impl-BLIELFUK.cjs.map → impl-BBDBG5OZ.cjs.map} +1 -1
- package/dist/{impl-4CA7VK4U.cjs → impl-BRV53IYV.cjs} +2 -2
- package/dist/{impl-4CA7VK4U.cjs.map → impl-BRV53IYV.cjs.map} +1 -1
- package/dist/impl-C52MFDKN.cjs +2 -0
- package/dist/{impl-IBOGAUVL.cjs.map → impl-C52MFDKN.cjs.map} +1 -1
- package/dist/{impl-VBE4QUJN.cjs → impl-CDNCBR7T.cjs} +2 -2
- package/dist/{impl-VBE4QUJN.cjs.map → impl-CDNCBR7T.cjs.map} +1 -1
- package/dist/{impl-FTSCECOZ.cjs → impl-DLES54N2.cjs} +2 -2
- package/dist/{impl-FTSCECOZ.cjs.map → impl-DLES54N2.cjs.map} +1 -1
- package/dist/impl-E6HLH54N.cjs +2 -0
- package/dist/{impl-RTZTJWMX.cjs.map → impl-E6HLH54N.cjs.map} +1 -1
- package/dist/impl-EUBXVGYE.cjs +2 -0
- package/dist/{impl-FKXR7U4X.cjs.map → impl-EUBXVGYE.cjs.map} +1 -1
- package/dist/{impl-BSI3RBQ2.cjs → impl-FCNDIDLG.cjs} +2 -2
- package/dist/{impl-BSI3RBQ2.cjs.map → impl-FCNDIDLG.cjs.map} +1 -1
- package/dist/{impl-VPUALIUR.cjs → impl-FORZFZ2Q.cjs} +2 -2
- package/dist/{impl-VPUALIUR.cjs.map → impl-FORZFZ2Q.cjs.map} +1 -1
- package/dist/{impl-ZJ2L727T.cjs → impl-FOWYFCLQ.cjs} +2 -2
- package/dist/{impl-ZJ2L727T.cjs.map → impl-FOWYFCLQ.cjs.map} +1 -1
- package/dist/{impl-3BTFEGV4.cjs → impl-GISNUHI6.cjs} +5 -5
- package/dist/{impl-3BTFEGV4.cjs.map → impl-GISNUHI6.cjs.map} +1 -1
- package/dist/{impl-2X2FNMJR.cjs → impl-GRFZUIPA.cjs} +2 -2
- package/dist/{impl-2X2FNMJR.cjs.map → impl-GRFZUIPA.cjs.map} +1 -1
- package/dist/{impl-EE3BM53W.cjs → impl-GRGWQUU7.cjs} +2 -2
- package/dist/{impl-EE3BM53W.cjs.map → impl-GRGWQUU7.cjs.map} +1 -1
- package/dist/{impl-76E4DKAE.cjs → impl-HRQUBR2Y.cjs} +2 -2
- package/dist/{impl-76E4DKAE.cjs.map → impl-HRQUBR2Y.cjs.map} +1 -1
- package/dist/{impl-IM22LNW5.cjs → impl-KM3U7E44.cjs} +3 -3
- package/dist/{impl-IM22LNW5.cjs.map → impl-KM3U7E44.cjs.map} +1 -1
- package/dist/{impl-5WHENVVS.cjs → impl-L5CDLEYL.cjs} +2 -2
- package/dist/{impl-5WHENVVS.cjs.map → impl-L5CDLEYL.cjs.map} +1 -1
- package/dist/{impl-IFHM4YOL.cjs → impl-MDV6LYET.cjs} +2 -2
- package/dist/{impl-IFHM4YOL.cjs.map → impl-MDV6LYET.cjs.map} +1 -1
- package/dist/{impl-T5V56TM5.cjs → impl-MEYQSNWH.cjs} +2 -2
- package/dist/{impl-T5V56TM5.cjs.map → impl-MEYQSNWH.cjs.map} +1 -1
- package/dist/{impl-NEV6KDPU.cjs → impl-NRPKPOKV.cjs} +2 -2
- package/dist/{impl-NEV6KDPU.cjs.map → impl-NRPKPOKV.cjs.map} +1 -1
- package/dist/impl-OTMLF2EA.cjs +3 -0
- package/dist/{impl-LMKJ6UBT.cjs.map → impl-OTMLF2EA.cjs.map} +1 -1
- package/dist/{impl-UPDFANVR.cjs → impl-P2KE5XGI.cjs} +2 -2
- package/dist/{impl-UPDFANVR.cjs.map → impl-P2KE5XGI.cjs.map} +1 -1
- package/dist/{impl-GJMVAL3N.cjs → impl-QOFK7XCV.cjs} +2 -2
- package/dist/{impl-GJMVAL3N.cjs.map → impl-QOFK7XCV.cjs.map} +1 -1
- package/dist/{impl-YEXEFJS7.cjs → impl-T3YCRT7O.cjs} +2 -2
- package/dist/{impl-YEXEFJS7.cjs.map → impl-T3YCRT7O.cjs.map} +1 -1
- package/dist/{impl-Z5HT5JQU.cjs → impl-TU75DDAK.cjs} +2 -2
- package/dist/{impl-Z5HT5JQU.cjs.map → impl-TU75DDAK.cjs.map} +1 -1
- package/dist/{impl-Q5WCETP4.cjs → impl-U2HXJYMF.cjs} +2 -2
- package/dist/{impl-Q5WCETP4.cjs.map → impl-U2HXJYMF.cjs.map} +1 -1
- package/dist/impl-VWVHHW42.cjs +2 -0
- package/dist/{impl-VHY4ALCB.cjs.map → impl-VWVHHW42.cjs.map} +1 -1
- package/dist/impl-WJUSRANT.cjs +2 -0
- package/dist/{impl-7BAUUGZT.cjs.map → impl-WJUSRANT.cjs.map} +1 -1
- package/dist/{impl-AWWB3TEU.cjs → impl-YDV6YOOI.cjs} +2 -2
- package/dist/{impl-AWWB3TEU.cjs.map → impl-YDV6YOOI.cjs.map} +1 -1
- package/dist/{impl-KBVYLYIZ.cjs → impl-YGWOUGKU.cjs} +2 -2
- package/dist/{impl-KBVYLYIZ.cjs.map → impl-YGWOUGKU.cjs.map} +1 -1
- package/dist/{impl-T7EOUHYL.cjs → impl-YL4BEMVB.cjs} +2 -2
- package/dist/{impl-T7EOUHYL.cjs.map → impl-YL4BEMVB.cjs.map} +1 -1
- package/dist/{impl-DS73OYLE.cjs → impl-ZHTH3L2C.cjs} +2 -2
- package/dist/{impl-DS73OYLE.cjs.map → impl-ZHTH3L2C.cjs.map} +1 -1
- package/dist/{impl-463J7BYV.cjs → impl-ZNEHRZSH.cjs} +2 -2
- package/dist/{impl-463J7BYV.cjs.map → impl-ZNEHRZSH.cjs.map} +1 -1
- package/dist/{impl-UMVE7IPO.cjs → impl-ZVMSDS7K.cjs} +2 -2
- package/dist/{impl-UMVE7IPO.cjs.map → impl-ZVMSDS7K.cjs.map} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +3 -3
- package/package.json +1 -1
- package/dist/chunk-T3BBQIRY.cjs.map +0 -1
- package/dist/impl-7BAUUGZT.cjs +0 -2
- package/dist/impl-FKXR7U4X.cjs +0 -2
- package/dist/impl-IBOGAUVL.cjs +0 -2
- package/dist/impl-J62VZXDY.cjs +0 -2
- package/dist/impl-LMKJ6UBT.cjs +0 -3
- package/dist/impl-RTZTJWMX.cjs +0 -2
- package/dist/impl-VHY4ALCB.cjs +0 -2
- package/dist/impl-X6TORGVF.cjs +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-3X74MLJH.cjs","../src/commands/request/system/retry-request-data-silos/impl.ts"],"names":["retryRequestDataSilos","auth","dataSiloId","actions","transcendUrl","doneInputValidation"],"mappings":"AAAA,iIAAwC,wDAA0C,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCYtM,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,MAAML,kCAAAA,CACJ,cAAA,CAAgBG,CAAAA,CAChB,YAAA,CAAAC,CAAAA,CACA,IAAA,CAAAH,CAAAA,CACA,UAAA,CAAAC,CACF,CAAC,CACH,CAAA,kCAAA","file":"/home/runner/work/cli/cli/dist/impl-3X74MLJH.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../../context';\nimport type { RequestAction } from '@transcend-io/privacy-types';\nimport { retryRequestDataSilos as retryRequestDataSilosHelper } from '../../../../lib/requests';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nexport interface 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 doneInputValidation(this.process.exit);\n\n await retryRequestDataSilosHelper({\n requestActions: actions,\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkWAWECZTFcjs = require('./chunk-WAWECZTF.cjs');require('./chunk-UHERPTMC.cjs');require('./chunk-ABKDAPPR.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunkVWGA62SGcjs = require('./chunk-VWGA62SG.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkFZTNEEMWcjs = require('./chunk-FZTNEEMW.cjs');require('./chunk-7PB6LVSE.cjs');var _querystring = require('query-string');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _fastglob = require('fast-glob'); var _fastglob2 = _interopRequireDefault(_fastglob);async function m({scanPath:t,fileGlobs:e,ignoreDirs:g,config:p}){let{ignoreDirs:f,supportedFiles:s,scanFunction:a}=p,n=e===""?s:s.concat(e.split(",")),l=[...g.split(","),...f].filter(o=>o.length>0);try{let o=await _fastglob2.default.call(void 0, `${t}/**/${n.join("|")}`,{ignore:l.map(i=>`${t}/**/${i}`),unique:!0,onlyFiles:!0});_chunkZUNVPK23cjs.a.info(`Scanning: ${o.length} files`);let I=o.map(i=>a(i)).flat().map(i=>i.softwareDevelopmentKits||[]).flat(),d=[...new Set(I.map(i=>i.name))];return _chunkZUNVPK23cjs.a.info(`Found: ${d.length} unique dependencies`),d.map(i=>({name:i,resourceId:`${t}/**/${i}`,useStrictClassifier:!0}))}catch(o){throw new Error(`Error scanning globs ${m} with error: ${o}`)}}async function P({scanPath:t,dataSiloId:e,auth:g,fileGlobs:p,ignoreDirs:f,transcendUrl:s}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);let a=_chunkVWGA62SGcjs.xc.call(void 0, s,g),n=await _chunkVWGA62SGcjs.Cc.call(void 0, a,e),l=_chunkWAWECZTFcjs.a[n.dataSilo.type];l||(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`This plugin "${n.dataSilo.type}" is not supported for offline silo discovery.`)),this.process.exit(1));let o=await m({scanPath:t,fileGlobs:p,ignoreDirs:f,config:l});await _chunkVWGA62SGcjs.of.call(void 0, a,n.id,o);let c=new URL(_chunkFZTNEEMWcjs.o);c.pathname="/data-map/data-inventory/silo-discovery/triage",c.search=_querystring.stringify.call(void 0, {filters:JSON.stringify({pluginIds:[n.id]})}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Scan found ${o.length} potential data silos at ${t}! View at '${c.href}'
|
|
2
2
|
|
|
3
3
|
NOTE: it may take 2-3 minutes for scan results to appear in the UI.`))}exports.discoverSilos = P;
|
|
4
|
-
//# sourceMappingURL=impl-
|
|
4
|
+
//# sourceMappingURL=impl-4TYC4KRL.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-4TYC4KRL.cjs","../src/commands/inventory/discover-silos/impl.ts","../src/lib/code-scanning/findFilesToScan.ts"],"names":["findFilesToScan","scanPath","fileGlobs","ignoreDirs","config","IGNORE_DIRS","supportedFiles","scanFunction","globsToSupport","dirsToIgnore","dir","filesToScan","fastGlob"],"mappings":"AAAA,iOAAwC,gCAA6B,gCAA6B,wDAAyC,wDAA0D,gCAA6B,wDAAyC,wDAAyC,gCAA6B,2CCCvT,gFAEP,yFCHE,MAsBrB,SAAsBA,CAAAA,CAAgB,CACpC,QAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CACF,CAAA,CASuC,CACrC,GAAM,CAAE,UAAA,CAAYC,CAAAA,CAAa,cAAA,CAAAC,CAAAA,CAAgB,YAAA,CAAAC,CAAa,CAAA,CAAIH,CAAAA,CAC5DI,CAAAA,CACJN,CAAAA,GAAc,EAAA,CACVI,CAAAA,CACAA,CAAAA,CAAe,MAAA,CAAOJ,CAAAA,CAAU,KAAA,CAAM,GAAG,CAAC,CAAA,CAC1CO,CAAAA,CAAe,CAAC,GAAGN,CAAAA,CAAW,KAAA,CAAM,GAAG,CAAA,CAAG,GAAGE,CAAW,CAAA,CAAE,MAAA,CAC7DK,CAAAA,EAAQA,CAAAA,CAAI,MAAA,CAAS,CACxB,CAAA,CACA,GAAI,CACF,IAAMC,CAAAA,CAAwB,MAAMC,gCAAAA,CAClC,EAAA;ADuByB;AAI/B,oEAAA","file":"/home/runner/work/cli/cli/dist/impl-4TYC4KRL.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { stringify } from 'query-string';\nimport { logger } from '../../../logger';\nimport colors from 'colors';\nimport { ADMIN_DASH } from '../../../constants';\nimport {\n fetchActiveSiloDiscoPlugin,\n buildTranscendGraphQLClient,\n uploadSiloDiscoveryResults,\n} from '../../../lib/graphql';\nimport { findFilesToScan } from '../../../lib/code-scanning/findFilesToScan';\nimport { SILO_DISCOVERY_CONFIGS } from '../../../lib/code-scanning';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface DiscoverSilosCommandFlags {\n scanPath: string;\n dataSiloId: string;\n auth: string;\n fileGlobs: string;\n ignoreDirs: string;\n transcendUrl: string;\n}\n\nexport async function discoverSilos(\n this: LocalContext,\n {\n scanPath,\n dataSiloId,\n auth,\n fileGlobs,\n ignoreDirs,\n transcendUrl,\n }: DiscoverSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const plugin = await fetchActiveSiloDiscoPlugin(client, dataSiloId);\n\n const config = SILO_DISCOVERY_CONFIGS[plugin.dataSilo.type];\n if (!config) {\n logger.error(\n colors.red(\n `This plugin \"${plugin.dataSilo.type}\" is not supported for offline silo discovery.`,\n ),\n );\n this.process.exit(1);\n }\n\n const results = await findFilesToScan({\n scanPath,\n fileGlobs,\n ignoreDirs,\n config,\n });\n\n await uploadSiloDiscoveryResults(client, plugin.id, results);\n\n const newUrl = new URL(ADMIN_DASH);\n newUrl.pathname = '/data-map/data-inventory/silo-discovery/triage';\n newUrl.search = stringify({\n filters: JSON.stringify({ pluginIds: [plugin.id] }),\n });\n\n // Indicate success\n logger.info(\n colors.green(\n `Scan found ${results.length} potential data silos at ${scanPath}! ` +\n `View at '${newUrl.href}' ` +\n '\\n\\n NOTE: it may take 2-3 minutes for scan results to appear in the UI.',\n ),\n );\n}\n","import fastGlob from 'fast-glob';\nimport { logger } from '../../logger';\nimport { CodeScanningConfig } from './types';\n\nexport interface SiloDiscoveryRawResults {\n /** The name of the potential data silo entry */\n name: string;\n /** A unique UUID (represents the same resource across different silo discovery runs) */\n resourceId: string;\n /** Any hosts associated with the entry */\n host?: string;\n /** Type of data silo */\n type?: string | undefined;\n}\n\n/**\n * Helper to scan for data silos in all package.json files that it can find in a directory\n *\n * @deprecated TODO: https://transcend.height.app/T-32325 - use code scanning instead\n * @param options - Options\n * @returns the list of integrations\n */\nexport async function findFilesToScan({\n scanPath,\n fileGlobs,\n ignoreDirs,\n config,\n}: {\n /** Where to look for package.json files */\n scanPath: string;\n /** Globs to look for */\n fileGlobs: string;\n /** The directories to ignore (excludes node_modules and serverless-build) */\n ignoreDirs: string;\n /** Silo Discovery configuration */\n config: CodeScanningConfig;\n}): Promise<SiloDiscoveryRawResults[]> {\n const { ignoreDirs: IGNORE_DIRS, supportedFiles, scanFunction } = config;\n const globsToSupport =\n fileGlobs === ''\n ? supportedFiles\n : supportedFiles.concat(fileGlobs.split(','));\n const dirsToIgnore = [...ignoreDirs.split(','), ...IGNORE_DIRS].filter(\n (dir) => dir.length > 0,\n );\n try {\n const filesToScan: string[] = await fastGlob(\n `${scanPath}/**/${globsToSupport.join('|')}`,\n {\n ignore: dirsToIgnore.map((dir: string) => `${scanPath}/**/${dir}`),\n unique: true,\n onlyFiles: true,\n },\n );\n logger.info(`Scanning: ${filesToScan.length} files`);\n const allPackages = filesToScan\n .map((filePath: string) => scanFunction(filePath))\n .flat();\n const allSdks = allPackages\n .map((appPackage) => appPackage.softwareDevelopmentKits || [])\n .flat();\n const uniqueDeps = new Set(allSdks.map((sdk) => sdk.name));\n const deps = [...uniqueDeps];\n logger.info(`Found: ${deps.length} unique dependencies`);\n return deps.map((dep) => ({\n name: dep,\n resourceId: `${scanPath}/**/${dep}`,\n useStrictClassifier: true,\n }));\n } catch (error) {\n throw new Error(\n `Error scanning globs ${findFilesToScan} with error: ${error}`,\n );\n }\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunkVWGA62SGcjs = require('./chunk-VWGA62SG.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');require('./chunk-FZTNEEMW.cjs');require('./chunk-7PB6LVSE.cjs');var _iots = require('io-ts'); var c = _interopRequireWildcard(_iots);var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _fs = require('fs');var _cliprogress = require('cli-progress'); var _cliprogress2 = _interopRequireDefault(_cliprogress);var _privacytypes = require('@transcend-io/privacy-types');async function U({auth:k,file:s,transcendUrl:$,duration:A,subjectType:P,emailColumnName:a,coreIdentifierColumnName:r}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),_fs.existsSync.call(void 0, s)||(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`File does not exist: "${s}". Please provide a valid path to a CSV file.`)),this.process.exit(1));try{let p=_chunkVWGA62SGcjs.xc.call(void 0, $,k),b=c.type({[a]:c.string,...r?{[r]:c.string}:{}}),n=_chunkVWGA62SGcjs.sc.call(void 0, s,b);if(!n.length)throw new Error("Input CSV is empty.");let h=n.map((e,t)=>[e,t]).filter(([e])=>!_optionalChain([e, 'access', _ => _[a], 'optionalAccess', _2 => _2.trim, 'call', _3 => _3()]));if(h.length){let e=h.map(([,t])=>t+2).join(", ");throw new Error(`The following rows are missing the required "${a}" column: ${e}`)}if(r){let e=n.map((t,o)=>[t,o]).filter(([t])=>!_optionalChain([t, 'access', _4 => _4[r], 'optionalAccess', _5 => _5.trim, 'call', _6 => _6()]));if(e.length){let t=e.map(([,o])=>o+2).join(", ");throw new Error(`The following rows are missing the required "${r}" column: ${t}`)}}let I=Math.max(1,Math.floor(A/1e3)),d=n.map((e,t)=>{let o=e[a].trim(),f=r?_optionalChain([e, 'access', _7 => _7[r], 'optionalAccess', _8 => _8.trim, 'call', _9 => _9()]):void 0,j=[_privacytypes.SombraStandardScope.PreferenceManagement];return{subjectType:P,scopes:j,expiresIn:I,email:o,...f?{coreIdentifier:f}:{},index:t}}),m=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic);m.start(d.length,0);let v=Date.now(),l=await _chunkVWGA62SGcjs.Kc.call(void 0, p,d,e=>{m.update(e)});m.update(d.length),m.stop();let E=l.map(({accessToken:e,input:t})=>{if(typeof t.index!="number")throw new Error("Internal error: missing input index.");return{...n[t.index],token:e}});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Writing access tokens to file "${s}"...`)),await _chunkVWGA62SGcjs.rg.call(void 0, s,E,!0);let M=Math.round((Date.now()-v)/1e3);_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully generated ${l.length} access tokens to "${s}" in ${M}s!`))}catch(p){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`An error occurred while generating access tokens: ${_optionalChain([p, 'optionalAccess', _10 => _10.message])||String(p)}`)),this.process.exit(1)}}exports.generateAccessTokens = U;
|
|
2
|
+
//# sourceMappingURL=impl-5BYWLODX.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-5BYWLODX.cjs","../src/commands/consent/generate-access-tokens/impl.ts"],"names":["generateAccessTokens","auth","file","transcendUrl","duration","subjectType","emailColumnName","coreIdentifierColumnName","doneInputValidation","existsSync","logger","colors","client","buildTranscendGraphQLClient","codec","rows","readCsv","missingEmail","r","i","rowNumbers"],"mappings":"AAAA,u/BAAwC,wDAAkE,gCAA6B,wDAAyC,gCAA6B,gCAA6B,qECCvN,gFACA,wBAGQ,qGACH,2DAOY,MA4BpC,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,wBAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAChCC,4BAAAA,CAAe,CAAA,EAAA,CAClBC,mBAAAA,CAAO,KAAA,CACLC,gBAAAA,CAAO,GAAA,CACL,CAAA,sBAAA,EAAyBT,CAAI,CAAA,6CAAA,CAC/B,CACF,CAAA,CACA,IAAA,CAAK,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,CAAA,CAGrB,GAAI,CAEF,IAAMU,CAAAA,CAASC,kCAAAA,CAA4BV,CAAcF,CAAI,CAAA,CAGvDa,CAAAA,CAAU,CAAA,CAAA,IAAA,CAAK,CACnB,CAACR,CAAe,CAAA,CAAK,CAAA,CAAA,MAAA,CACrB,GAAIC,CAAAA,CACA,CAAE,CAACA,CAAwB,CAAA,CAAK,CAAA,CAAA,MAAO,CAAA,CACvC,CAAC,CACP,CAAC,CAAA,CACKQ,CAAAA,CAAsCC,kCAAAA,CAAQd,CAAMY,CAAK,CAAA,CAC/D,EAAA,CAAI,CAACC,CAAAA,CAAK,MAAA,CACR,MAAM,IAAI,KAAA,CAAM,qBAAqB,CAAA,CAIvC,IAAME,CAAAA,CAAeF,CAAAA,CAClB,GAAA,CAAI,CAACG,CAAAA,CAAGC,CAAAA,CAAAA,EAAM,CAACD,CAAAA,CAAGC,CAAC,CAAU,CAAA,CAC7B,MAAA,CAAO,CAAC,CAACD,CAAC,CAAA,CAAA,EAAM,iBAACA,CAAAA,mBAAEZ,CAAe,CAAA,6BAAG,IAAA,mBAAK,GAAC,CAAA,CAC9C,EAAA,CAAIW,CAAAA,CAAa,MAAA,CAAQ,CACvB,IAAMG,CAAAA,CAAaH,CAAAA,CAChB,GAAA,CAAI,CAAC,CAAC,CAAEE,CAAC,CAAA,CAAA,EAAMA,CAAAA,CAAI,CAAC,CAAA,CACpB,IAAA,CAAK,IAAI,CAAA,CACZ,MAAM,IAAI,KAAA,CACR,CAAA,6CAAA,EAAgDb,CAAe,CAAA,UAAA,EAAac,CAAU,CAAA,CAAA","file":"/home/runner/work/cli/cli/dist/impl-5BYWLODX.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport * as t from 'io-ts';\nimport colors from 'colors';\nimport { logger } from '../../../logger';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\nimport { existsSync } from 'node:fs';\nimport cliProgress from 'cli-progress';\nimport {\n buildTranscendGraphQLClient,\n createPreferenceAccessTokens,\n type PreferenceAccessTokenInputWithIndex,\n} from '../../../lib/graphql';\nimport { readCsv } from '../../../lib/requests';\nimport { SombraStandardScope } from '@transcend-io/privacy-types';\nimport { writeCsv } from '../../../lib/helpers';\n\n/**\n * CLI flags accepted by the `generate-access-tokens` command.\n *\n * These are passed down from the CLI parser into the parent process.\n */\nexport type GenerateAccessTokenCommandFlags = {\n auth: string;\n file: string;\n duration: number;\n transcendUrl: string;\n subjectType: string;\n emailColumnName: string;\n coreIdentifierColumnName?: string;\n};\n\n/**\n * Take in a CSV of user identifiers and generate access tokens for each user.\n *\n * Expected CSV columns:\n * - [emailColumnName] (required)\n * - [coreIdentifierColumnName] (optional)\n *\n * @param this - Bound CLI context (provides process exit + logging).\n * @param flags - CLI options for the run.\n */\nexport async function generateAccessTokens(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n duration,\n subjectType,\n emailColumnName,\n coreIdentifierColumnName,\n }: GenerateAccessTokenCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n if (!existsSync(file)) {\n logger.error(\n colors.red(\n `File does not exist: \"${file}\". Please provide a valid path to a CSV file.`,\n ),\n );\n this.process.exit(1);\n }\n\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read + parse CSV\n const codec = t.type({\n [emailColumnName]: t.string,\n ...(coreIdentifierColumnName\n ? { [coreIdentifierColumnName]: t.string }\n : {}),\n });\n const rows: Array<Record<string, string>> = readCsv(file, codec);\n if (!rows.length) {\n throw new Error('Input CSV is empty.');\n }\n\n // Ensure emails and core identifiers exist\n const missingEmail = rows\n .map((r, i) => [r, i] as const)\n .filter(([r]) => !r[emailColumnName]?.trim());\n if (missingEmail.length) {\n const rowNumbers = missingEmail\n .map(([, i]) => i + 2) // +2 to account for header row and 0-indexing\n .join(', ');\n throw new Error(\n `The following rows are missing the required \"${emailColumnName}\" column: ${rowNumbers}`,\n );\n }\n if (coreIdentifierColumnName) {\n const missingCoreId = rows\n .map((r, i) => [r, i] as const)\n .filter(([r]) => !r[coreIdentifierColumnName]?.trim());\n if (missingCoreId.length) {\n const rowNumbers = missingCoreId\n .map(([, i]) => i + 2) // +2 to account for header row and 0-indexing\n .join(', ');\n throw new Error(\n `The following rows are missing the required \"${coreIdentifierColumnName}\" column: ${rowNumbers}`,\n );\n }\n }\n\n // Duration provided by CLI is in ms; GraphQL expects seconds\n const expiresInSeconds = Math.max(1, Math.floor(duration / 1000));\n\n // Build inputs for GraphQL\n const inputs = rows.map((r, index): PreferenceAccessTokenInputWithIndex => {\n const email = r[emailColumnName].trim();\n const coreIdentifier = coreIdentifierColumnName\n ? r[coreIdentifierColumnName]?.trim()\n : undefined;\n const scopes = [SombraStandardScope.PreferenceManagement];\n return {\n subjectType,\n scopes,\n expiresIn: expiresInSeconds,\n email,\n ...(coreIdentifier ? { coreIdentifier } : {}),\n index,\n };\n });\n\n // Progress bar\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n progressBar.start(inputs.length, 0);\n\n // Kick off token creation (batched internally)\n const t0 = Date.now();\n const results = await createPreferenceAccessTokens(\n client,\n inputs,\n (progress) => {\n progressBar.update(progress);\n },\n );\n progressBar.update(inputs.length);\n progressBar.stop();\n\n // Prepare output CSV rows\n const outputRows = results.map(({ accessToken, input }) => {\n if (typeof input.index !== 'number') {\n throw new Error('Internal error: missing input index.');\n }\n return {\n ...rows[input.index],\n token: accessToken,\n };\n });\n\n logger.info(colors.magenta(`Writing access tokens to file \"${file}\"...`));\n await writeCsv(file, outputRows, true);\n\n const totalTimeSec = Math.round((Date.now() - t0) / 1000);\n logger.info(\n colors.green(\n `Successfully generated ${results.length} access tokens to \"${file}\" in ${totalTimeSec}s!`,\n ),\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (err: any) {\n logger.error(\n colors.red(\n `An error occurred while generating access tokens: ${\n err?.message || String(err)\n }`,\n ),\n );\n this.process.exit(1);\n }\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunk5SEDJJAHcjs = require('./chunk-5SEDJJAH.cjs');require('./chunk-HUZESENZ.cjs');var _chunkUHERPTMCcjs = require('./chunk-UHERPTMC.cjs');require('./chunk-ABKDAPPR.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');require('./chunk-VWGA62SG.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');require('./chunk-FZTNEEMW.cjs');require('./chunk-7PB6LVSE.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _fs = require('fs');async function L({auth:d,xdiLocation:c,file:o,removeIpAddresses:l,domainBlockList:i,xdiAllowedCommands:a,transcendUrl:m}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);let p=await _chunkUHERPTMCcjs.b.call(void 0, d),{syncGroups:f,html:u}=await _chunk5SEDJJAHcjs.g.call(void 0, p,{xdiLocation:c,transcendUrl:m,removeIpAddresses:l,domainBlockList:i.length>0?i:void 0,xdiAllowedCommands:a});_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully constructed sync endpoint for sync groups: ${JSON.stringify(f,null,2)}`)),_fs.writeFileSync.call(void 0, o,u),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Wrote configuration to file "${o}"!`))}exports.buildXdiSyncEndpoint = L;
|
|
2
|
+
//# sourceMappingURL=impl-64R4NW2W.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-64R4NW2W.cjs","../src/commands/consent/build-xdi-sync-endpoint/impl.ts"],"names":["buildXdiSyncEndpoint","auth","xdiLocation","file","removeIpAddresses","domainBlockList","xdiAllowedCommands","transcendUrl","doneInputValidation","apiKeyOrList","validateTranscendAuth","syncGroups","html","logger","colors"],"mappings":"AAAA,iOAAwC,gCAA6B,wDAAyC,gCAA6B,wDAAyC,gCAA6B,gCAA6B,wDAAyC,gCAA6B,gCAA6B,gFCE9T,wBACW,MAe9B,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,iBAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,kBAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAGrC,IAAMC,CAAAA,CAAe,MAAMC,iCAAAA,CAA0B,CAAA,CAG/C,CAAE,UAAA,CAAAC,CAAAA,CAAY,IAAA,CAAAC,CAAK,CAAA,CAAI,MAAMZ,iCAAAA,CAA2BS,CAAc,CAC1E,WAAA,CAAAP,CAAAA,CACA,YAAA,CAAAK,CAAAA,CACA,iBAAA,CAAAH,CAAAA,CACA,eAAA,CAAiBC,CAAAA,CAAgB,MAAA,CAAS,CAAA,CAAIA,CAAAA,CAAkB,KAAA,CAAA,CAChE,kBAAA,CAAAC,CACF,CAAC,CAAA,CAGDO,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,KAAA,CACL,CAAA,wDAAA,EAA2D,IAAA,CAAK,SAAA,CAC9DH,CAAAA,CACA,IAAA,CACA,CACF,CAAC,CAAA,CAAA","file":"/home/runner/work/cli/cli/dist/impl-64R4NW2W.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { logger } from '../../../logger';\nimport colors from 'colors';\nimport { writeFileSync } from 'node:fs';\nimport { validateTranscendAuth } from '../../../lib/api-keys';\nimport { buildXdiSyncEndpoint as buildXdiSyncEndpointHelper } from '../../../lib/consent-manager';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface BuildXdiSyncEndpointCommandFlags {\n auth: string;\n xdiLocation: string;\n file: string;\n removeIpAddresses: boolean;\n domainBlockList: string[];\n xdiAllowedCommands: string;\n transcendUrl: string;\n}\n\nexport async function buildXdiSyncEndpoint(\n this: LocalContext,\n {\n auth,\n xdiLocation,\n file,\n removeIpAddresses,\n domainBlockList,\n xdiAllowedCommands,\n transcendUrl,\n }: BuildXdiSyncEndpointCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Build the sync endpoint\n const { syncGroups, html } = await buildXdiSyncEndpointHelper(apiKeyOrList, {\n xdiLocation,\n transcendUrl,\n removeIpAddresses,\n domainBlockList: domainBlockList.length > 0 ? domainBlockList : undefined,\n xdiAllowedCommands,\n });\n\n // Log success\n logger.info(\n colors.green(\n `Successfully constructed sync endpoint for sync groups: ${JSON.stringify(\n syncGroups,\n null,\n 2,\n )}`,\n ),\n );\n\n // Write to disk\n writeFileSync(file, html);\n logger.info(colors.green(`Wrote configuration to file \"${file}\"!`));\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5SEDJJAHcjs = require('./chunk-5SEDJJAH.cjs');require('./chunk-HUZESENZ.cjs');require('./chunk-ABKDAPPR.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');require('./chunk-VWGA62SG.cjs');require('./chunk-TSJTXXLZ.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-FZTNEEMW.cjs');require('./chunk-7PB6LVSE.cjs');async function m({auth:a,trackerStatus:r,file:s,classifyService:e,transcendUrl:n}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),await _chunk5SEDJJAHcjs.b.call(void 0, {auth:a,trackerStatus:r,file:s,classifyService:e,transcendUrl:n})}exports.uploadDataFlowsFromCsv = m;
|
|
2
|
+
//# sourceMappingURL=impl-7XQ333J3.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-7XQ333J3.cjs","../src/commands/consent/upload-data-flows-from-csv/impl.ts"],"names":["uploadDataFlowsFromCsv","auth","trackerStatus","file","classifyService","transcendUrl","doneInputValidation"],"mappings":"AAAA,iIAAwC,gCAA6B,gCAA6B,wDAAyC,gCAA6B,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCa5R,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,MAAMN,iCAAAA,CACJ,IAAA,CAAAC,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAC,CACH,CAAA,mCAAA","file":"/home/runner/work/cli/cli/dist/impl-7XQ333J3.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { uploadDataFlowsFromCsv as uploadDataFlowsFromCsvHelper } from '../../../lib/consent-manager';\nimport { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface 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 doneInputValidation(this.process.exit);\n\n await uploadDataFlowsFromCsvHelper({\n auth,\n trackerStatus,\n file,\n classifyService,\n transcendUrl,\n });\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunkVWGA62SGcjs = require('./chunk-VWGA62SG.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkFZTNEEMWcjs = require('./chunk-FZTNEEMW.cjs');var _chunk7PB6LVSEcjs = require('./chunk-7PB6LVSE.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _got = require('got'); var _got2 = _interopRequireDefault(_got);var j=({hostname:t,auth:e})=>_got2.default.extend({prefixUrl:`https://${t}`,headers:{accept:"application/json","content-type":"application/json",authorization:`Bearer ${e}`}});var _yargsparser = require('yargs-parser'); var _yargsparser2 = _interopRequireDefault(_yargsparser);var ve=Object.values(_chunk7PB6LVSEcjs.b);var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);var R=({assessment:t,index:e,total:s,wrap:r=!0})=>{let n="";(e===0||r)&&(n=`[
|
|
2
2
|
`);let m=JSON.stringify(t),o=s&&e<s-1&&!r?",":"";return n=`${n+m+o}
|
|
3
3
|
`,(s&&e===s-1||r)&&(n+=`
|
|
4
|
-
]`),n};var q=({file:t,assessment:e,index:s,total:r})=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Writing enriched assessment ${s+1} of ${r} to file "${t}"...`)),s===0?_fs2.default.writeFileSync(t,R({assessment:e,index:s,total:r,wrap:!1})):_fs2.default.appendFileSync(t,R({assessment:e,index:s,total:r,wrap:!1}))};var _typeutils = require('@transcend-io/type-utils');var _privacytypes = require('@transcend-io/privacy-types');var J=async({oneTrust:t})=>{let e=0,s=1,r=0,n=[];for(;e<s;){let{body:m}=await t.get(`api/assessment/v2/assessments?page=${e}&size=2000`),{page:o,content:u}=_typeutils.decodeCodec.call(void 0, _privacytypes.OneTrustGetListOfAssessmentsResponse,m);n.push(..._nullishCoalesce(u, () => ([]))),e===0&&(s=_nullishCoalesce(_optionalChain([o, 'optionalAccess', _2 => _2.totalPages]), () => (0)),r=_nullishCoalesce(_optionalChain([o, 'optionalAccess', _3 => _3.totalElements]), () => (0))),e+=1,_chunkZUNVPK23cjs.a.info(`Fetched ${n.length} of ${r} assessments.`)}return n};var K=async({oneTrust:t,assessmentId:e})=>{let{body:s}=await t.get(`api/assessment/v2/assessments/${e}/export?ExcludeSkippedQuestions=false`);return _typeutils.decodeCodec.call(void 0, _privacytypes.OneTrustGetAssessmentResponse,s)};var W=async({oneTrust:t,riskId:e})=>{let{body:s}=await t.get(`api/risk/v2/risks/${e}`);return _typeutils.decodeCodec.call(void 0, _privacytypes.OneTrustGetRiskResponse,s)};var b=async({oneTrust:t,userId:e})=>{let{body:s}=await t.get(`api/scim/v2/Users/${e}`);return _typeutils.decodeCodec.call(void 0, _privacytypes.OneTrustGetUserResponse,s)};var _bluebird = require('bluebird');var H=({assessment:t,assessmentDetails:e,riskDetails:s,creatorDetails:r,approversDetails:n,respondentsDetails:m})=>{let o=
|
|
4
|
+
]`),n};var q=({file:t,assessment:e,index:s,total:r})=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Writing enriched assessment ${s+1} of ${r} to file "${t}"...`)),s===0?_fs2.default.writeFileSync(t,R({assessment:e,index:s,total:r,wrap:!1})):_fs2.default.appendFileSync(t,R({assessment:e,index:s,total:r,wrap:!1}))};var _typeutils = require('@transcend-io/type-utils');var _privacytypes = require('@transcend-io/privacy-types');var J=async({oneTrust:t})=>{let e=0,s=1,r=0,n=[];for(;e<s;){let{body:m}=await t.get(`api/assessment/v2/assessments?page=${e}&size=2000`),{page:o,content:u}=_typeutils.decodeCodec.call(void 0, _privacytypes.OneTrustGetListOfAssessmentsResponse,m);n.push(..._nullishCoalesce(u, () => ([]))),e===0&&(s=_nullishCoalesce(_optionalChain([o, 'optionalAccess', _2 => _2.totalPages]), () => (0)),r=_nullishCoalesce(_optionalChain([o, 'optionalAccess', _3 => _3.totalElements]), () => (0))),e+=1,_chunkZUNVPK23cjs.a.info(`Fetched ${n.length} of ${r} assessments.`)}return n};var K=async({oneTrust:t,assessmentId:e})=>{let{body:s}=await t.get(`api/assessment/v2/assessments/${e}/export?ExcludeSkippedQuestions=false`);return _typeutils.decodeCodec.call(void 0, _privacytypes.OneTrustGetAssessmentResponse,s)};var W=async({oneTrust:t,riskId:e})=>{let{body:s}=await t.get(`api/risk/v2/risks/${e}`);return _typeutils.decodeCodec.call(void 0, _privacytypes.OneTrustGetRiskResponse,s)};var b=async({oneTrust:t,userId:e})=>{let{body:s}=await t.get(`api/scim/v2/Users/${e}`);return _typeutils.decodeCodec.call(void 0, _privacytypes.OneTrustGetUserResponse,s)};var _bluebird = require('bluebird');var H=({assessment:t,assessmentDetails:e,riskDetails:s,creatorDetails:r,approversDetails:n,respondentsDetails:m})=>{let o=_chunkFZTNEEMWcjs.e.call(void 0, s,"id"),{sections:u,createdBy:h,...g}=e,O=u.map(i=>{let{questions:A,...$}=i,w=A.map(x=>{let{risks:U,...E}=x,G=(_nullishCoalesce(U, () => ([]))).map(y=>{let v=o[y.riskId];return{...y,...v,level:y.level,impactLevel:_nullishCoalesce(y.impactLevel, () => (0))}});return{...E,risks:G}});return{...$,questions:w}}),p={...h,active:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _4 => _4.active]), () => (!1)),userType:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _5 => _5.userType]), () => ("Internal")),emails:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _6 => _6.emails]), () => ([])),title:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _7 => _7.title]), () => (null)),givenName:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _8 => _8.name, 'access', _9 => _9.givenName]), () => (null)),familyName:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _10 => _10.name, 'access', _11 => _11.familyName]), () => (null))},d=_chunkFZTNEEMWcjs.e.call(void 0, n,"id"),l=e.approvers.flatMap(i=>d[i.id]?[{...i,approver:{...i.approver,active:d[i.id].active,userType:d[i.id].userType,emails:d[i.id].emails,title:d[i.id].title,givenName:_nullishCoalesce(d[i.id].name.givenName, () => (null)),familyName:_nullishCoalesce(d[i.id].name.familyName, () => (null))}}]:[]),T=_chunkFZTNEEMWcjs.e.call(void 0, m,"id"),C=e.respondents.filter(i=>!i.name.includes("@")).flatMap(i=>T[i.id]?[{...i,active:T[i.id].active,userType:T[i.id].userType,emails:T[i.id].emails,title:T[i.id].title,givenName:_nullishCoalesce(T[i.id].name.givenName, () => (null)),familyName:_nullishCoalesce(T[i.id].name.familyName, () => (null))}]:[]);return{...t,...g,approvers:l,respondents:C,createdBy:p,sections:O}};var k=async({transcend:t,assessment:e,total:s,index:r})=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Writing enriched assessment ${r+1} ${s?`of ${s} `:" "}to Transcend...`));let m={json:R({assessment:e,index:r,total:s})};try{await _chunkVWGA62SGcjs.ug.call(void 0, t,_chunkVWGA62SGcjs.ga,{input:m})}catch (e2){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to sync assessment ${r+1} ${s?`of ${s} `:" "}to Transcend.
|
|
5
5
|
Assessment Title: ${e.name}. Template Title: ${e.template.name}
|
|
6
|
-
`))}};var Y=async({oneTrust:t,file:e,dryRun:s,transcend:r})=>{_chunkZUNVPK23cjs.a.info("Getting list of all assessments from OneTrust...");let n=await J({oneTrust:t}),m={},o=5,u=Array.from({length:Math.ceil(n.length/o)},(h,g)=>n.slice(g*o,(g+1)*o));await _bluebird.mapSeries.call(void 0, u,async(h,g)=>{let O=[];await _bluebird.map.call(void 0, h,async(p,d)=>{let l=o*g+d+1;_chunkZUNVPK23cjs.a.info(`[assessment ${l} of ${n.length}]: fetching details...`);let{templateName:T,assessmentId:C}=p,i=await K({oneTrust:t,assessmentId:C}),A=i.createdBy.id,$=m[A];if(!$){_chunkZUNVPK23cjs.a.info(`[assessment ${l} of ${n.length}]: fetching creator...`);try{$=await b({oneTrust:t,userId:A}),m[A]=$}catch (e3){_chunkZUNVPK23cjs.a.warn(_colors2.default.yellow(`[assessment ${l} of ${n.length}]: failed to fetch form creator. creatorId: ${A}. Assessment Title: ${p.name}. Template Title: ${T}`))}}let{approvers:w}=i,x=[];w.length>0&&(_chunkZUNVPK23cjs.a.info(`[assessment ${l} of ${n.length}]: fetching approvers...`),x=await _bluebird.map.call(void 0, w.map(({id:c})=>c),async c=>{try{let f=m[c];return f||(f=await b({oneTrust:t,userId:c}),m[c]=f),[f]}catch (e4){return _chunkZUNVPK23cjs.a.warn(_colors2.default.yellow(`[assessment ${l} of ${n.length}]: failed to fetch a form approver. approverId: ${c}. Assessment Title: ${p.name}. Template Title: ${T}`)),[]}},{concurrency:5}));let{respondents:U}=i,E=U.filter(c=>!c.name.includes("@")),G=[];E.length>0&&(_chunkZUNVPK23cjs.a.info(`[assessment ${l} of ${n.length}]: fetching respondents...`),G=await _bluebird.map.call(void 0, E.map(({id:c})=>c),async c=>{try{let f=m[c];return f||(f=await b({oneTrust:t,userId:c}),m[c]=f),[f]}catch (e5){return _chunkZUNVPK23cjs.a.warn(_colors2.default.yellow(`[assessment ${l} of ${n.length}]: failed to fetch a respondent. respondentId: ${c}. Assessment Title: ${p.name}. Template Title: ${T}`)),[]}},{concurrency:5}));let y=[],v=
|
|
7
|
-
//# sourceMappingURL=impl-
|
|
6
|
+
`))}};var Y=async({oneTrust:t,file:e,dryRun:s,transcend:r})=>{_chunkZUNVPK23cjs.a.info("Getting list of all assessments from OneTrust...");let n=await J({oneTrust:t}),m={},o=5,u=Array.from({length:Math.ceil(n.length/o)},(h,g)=>n.slice(g*o,(g+1)*o));await _bluebird.mapSeries.call(void 0, u,async(h,g)=>{let O=[];await _bluebird.map.call(void 0, h,async(p,d)=>{let l=o*g+d+1;_chunkZUNVPK23cjs.a.info(`[assessment ${l} of ${n.length}]: fetching details...`);let{templateName:T,assessmentId:C}=p,i=await K({oneTrust:t,assessmentId:C}),A=i.createdBy.id,$=m[A];if(!$){_chunkZUNVPK23cjs.a.info(`[assessment ${l} of ${n.length}]: fetching creator...`);try{$=await b({oneTrust:t,userId:A}),m[A]=$}catch (e3){_chunkZUNVPK23cjs.a.warn(_colors2.default.yellow(`[assessment ${l} of ${n.length}]: failed to fetch form creator. creatorId: ${A}. Assessment Title: ${p.name}. Template Title: ${T}`))}}let{approvers:w}=i,x=[];w.length>0&&(_chunkZUNVPK23cjs.a.info(`[assessment ${l} of ${n.length}]: fetching approvers...`),x=await _bluebird.map.call(void 0, w.map(({id:c})=>c),async c=>{try{let f=m[c];return f||(f=await b({oneTrust:t,userId:c}),m[c]=f),[f]}catch (e4){return _chunkZUNVPK23cjs.a.warn(_colors2.default.yellow(`[assessment ${l} of ${n.length}]: failed to fetch a form approver. approverId: ${c}. Assessment Title: ${p.name}. Template Title: ${T}`)),[]}},{concurrency:5}));let{respondents:U}=i,E=U.filter(c=>!c.name.includes("@")),G=[];E.length>0&&(_chunkZUNVPK23cjs.a.info(`[assessment ${l} of ${n.length}]: fetching respondents...`),G=await _bluebird.map.call(void 0, E.map(({id:c})=>c),async c=>{try{let f=m[c];return f||(f=await b({oneTrust:t,userId:c}),m[c]=f),[f]}catch (e5){return _chunkZUNVPK23cjs.a.warn(_colors2.default.yellow(`[assessment ${l} of ${n.length}]: failed to fetch a respondent. respondentId: ${c}. Assessment Title: ${p.name}. Template Title: ${T}`)),[]}},{concurrency:5}));let y=[],v=_chunkFZTNEEMWcjs.j.call(void 0, i.sections.flatMap(c=>c.questions.flatMap(f=>(_nullishCoalesce(f.risks, () => ([]))).flatMap(ee=>ee.riskId))));v.length>0&&(_chunkZUNVPK23cjs.a.info(`[assessment ${l} of ${n.length}]: fetching risks...`),y=await _bluebird.map.call(void 0, v,c=>W({oneTrust:t,riskId:c}),{concurrency:5}));let X=H({assessment:p,assessmentDetails:i,riskDetails:y,creatorDetails:$,approversDetails:x.flat(),respondentsDetails:G.flat()});O.push(X)},{concurrency:o}),await _bluebird.mapSeries.call(void 0, O,async(p,d)=>{let l=g*o+d;s&&e?q({assessment:p,index:l,total:n.length,file:e}):r&&await k({assessment:p,transcend:r,total:n.length,index:l})})})};var _JSONStream = require('JSONStream'); var _JSONStream2 = _interopRequireDefault(_JSONStream);var Z=({transcend:t,file:e})=>(_chunkZUNVPK23cjs.a.info(`Getting list of all assessments from file ${e}...`),new Promise((s,r)=>{let n=_fs.createReadStream.call(void 0, e,{encoding:"utf-8",highWaterMark:65536}),m=_JSONStream2.default.parse("*"),o=0;n.pipe(m),m.on("data",async u=>{try{m.pause();let h=_typeutils.decodeCodec.call(void 0, _privacytypes.OneTrustEnrichedAssessment,u);await k({assessment:h,transcend:t,index:o}),o+=1,m.resume()}catch(h){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to parse the assessment ${o} from file '${e}': ${h.message}.`))}}),m.on("end",()=>{_chunkZUNVPK23cjs.a.info(`Finished processing ${o} assessments from file ${e}`),s()}),m.on("error",u=>{_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Error parsing file '${e}': ${u.message}`)),r(u)}),n.on("error",u=>{_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Error reading file '${e}': ${u.message}`)),r(u)})}));async function Ds({hostname:t,oneTrustAuth:e,source:s,transcendAuth:r,transcendUrl:n,resource:m,file:o,dryRun:u,debug:h}){if(!u&&!r)throw new Error('Must specify a "transcendAuth" parameter to sync resources to Transcend. e.g. --transcendAuth=${TRANSCEND_API_KEY}');if(u&&!o)throw new Error('Must set a "file" parameter when "dryRun" is "true". e.g. --file=./oneTrustAssessments.json');if(o){let p=o.split(".");if(p.length<2)throw new Error('The "file" parameter has an invalid format. Expected a path with extensions. e.g. --file=./pathToFile.json.');if(p.at(-1)!=="json")throw new Error(`Expected the format of the "file" parameters '${o}' to be 'json', but got '${p.at(-1)}'.`)}if(s==="oneTrust"){if(!t)throw new Error('Missing required parameter "hostname". e.g. --hostname=customer.my.onetrust.com');if(!e)throw new Error('Missing required parameter "oneTrustAuth". e.g. --oneTrustAuth=$ONE_TRUST_AUTH_TOKEN')}else{if(!o)throw new Error('Must specify a "file" parameter to read the OneTrust assessments from. e.g. --source=./oneTrustAssessments.json');if(u)throw new Error('Cannot read and write to a file simultaneously. Emit the "source" parameter or set it to oneTrust if "dryRun" is enabled.')}_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);let g=t&&e?j({hostname:t,auth:e}):void 0,O=n&&r?_chunkVWGA62SGcjs.xc.call(void 0, n,r):void 0;try{m==="assessments"&&(s==="oneTrust"&&g?await Y({oneTrust:g,file:o,dryRun:u,...O&&{transcend:O}}):s==="file"&&o&&O&&await Z({file:o,transcend:O}))}catch(p){throw new Error(`An error occurred syncing the resource ${m} from OneTrust: ${h?p.stack:p.message}`)}_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced OneTrust ${m} to ${u?`disk at "${o}"`:"Transcend"}!`))}exports.syncOt = Ds;
|
|
7
|
+
//# sourceMappingURL=impl-AS634NMX.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-COZ7ADUO.cjs","../src/commands/migration/sync-ot/impl.ts","../src/lib/oneTrust/createOneTrustGotInstance.ts","../src/lib/oneTrust/helpers/oneTrustAssessmentToJson.ts","../src/lib/oneTrust/endpoints/getListOfOneTrustAssessments.ts","../src/lib/oneTrust/helpers/syncOneTrustAssessmentToTranscend.ts","../src/lib/oneTrust/helpers/syncOneTrustAssessmentsFromOneTrust.ts"],"names":["createOneTrustGotInstance","hostname","auth","got"],"mappings":"AAAA,y0BAAwC,wDAA0D,gCAA6B,wDAAoC,wDAAgD,wDAAyC,gFCEzO,oECFM,IAQZA,CAAAA,CAA4B,CAAC,CACxC,QAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CACF,CAAA,CAAA,EAMEC,aAAAA,CAAI,MAAA,CAAO,CACT,SAAA,CAAW,CAAA,QAAA,EAAWF,CAAQ,CAAA,CAAA;ACiBwB;AAIzC;AClCf,CAAA;ACsE2F,mBAAA;ACC3B","file":"/home/runner/work/cli/cli/dist/impl-COZ7ADUO.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { logger } from '../../../logger';\nimport colors from 'colors';\nimport { createOneTrustGotInstance } from '../../../lib/oneTrust';\nimport {\n OneTrustFileFormat,\n OneTrustPullResource,\n OneTrustPullSource,\n} from '../../../enums';\nimport { buildTranscendGraphQLClient } from '../../../lib/graphql';\nimport {\n syncOneTrustAssessmentsFromFile,\n syncOneTrustAssessmentsFromOneTrust,\n} from '../../../lib/oneTrust/helpers';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\n// Command flag interface\nexport interface SyncOtCommandFlags {\n hostname?: string;\n oneTrustAuth?: string;\n source: OneTrustPullSource;\n transcendAuth?: string;\n transcendUrl: string;\n file?: string;\n resource: OneTrustPullResource;\n dryRun: boolean;\n debug: boolean;\n}\n\n// Command implementation\nexport async function syncOt(\n this: LocalContext,\n {\n hostname,\n oneTrustAuth,\n source,\n transcendAuth,\n transcendUrl,\n resource,\n file,\n dryRun,\n debug,\n }: SyncOtCommandFlags,\n): Promise<void> {\n // Must be able to authenticate to transcend to sync resources to it\n if (!dryRun && !transcendAuth) {\n throw new Error(\n // eslint-disable-next-line no-template-curly-in-string\n 'Must specify a \"transcendAuth\" parameter to sync resources to Transcend. e.g. --transcendAuth=${TRANSCEND_API_KEY}',\n );\n }\n\n // If trying to sync to disk, must specify a file path\n if (dryRun && !file) {\n throw new Error(\n 'Must set a \"file\" parameter when \"dryRun\" is \"true\". e.g. --file=./oneTrustAssessments.json',\n );\n }\n\n if (file) {\n const splitFile = file.split('.');\n if (splitFile.length < 2) {\n throw new Error(\n 'The \"file\" parameter has an invalid format. Expected a path with extensions. e.g. --file=./pathToFile.json.',\n );\n }\n if (splitFile.at(-1) !== OneTrustFileFormat.Json) {\n throw new Error(\n `Expected the format of the \"file\" parameters '${file}' to be '${\n OneTrustFileFormat.Json\n }', but got '${splitFile.at(-1)}'.`,\n );\n }\n }\n\n // if reading assessments from a OneTrust\n if (source === OneTrustPullSource.OneTrust) {\n // must specify the OneTrust hostname\n if (!hostname) {\n throw new Error(\n 'Missing required parameter \"hostname\". e.g. --hostname=customer.my.onetrust.com',\n );\n }\n // must specify the OneTrust auth\n if (!oneTrustAuth) {\n throw new Error(\n 'Missing required parameter \"oneTrustAuth\". e.g. --oneTrustAuth=$ONE_TRUST_AUTH_TOKEN',\n );\n }\n } else {\n // if reading the assessments from a file, must specify a file to read from\n if (!file) {\n throw new Error(\n 'Must specify a \"file\" parameter to read the OneTrust assessments from. e.g. --source=./oneTrustAssessments.json',\n );\n }\n\n // Cannot try reading from file and save assessments to a file simultaneously\n if (dryRun) {\n throw new Error(\n 'Cannot read and write to a file simultaneously.' +\n ` Emit the \"source\" parameter or set it to ${OneTrustPullSource.OneTrust} if \"dryRun\" is enabled.`,\n );\n }\n }\n\n doneInputValidation(this.process.exit);\n\n // instantiate a client to talk to OneTrust\n const oneTrust =\n hostname && oneTrustAuth\n ? createOneTrustGotInstance({\n hostname,\n auth: oneTrustAuth,\n })\n : undefined;\n\n // instantiate a client to talk to Transcend\n const transcend =\n transcendUrl && transcendAuth\n ? buildTranscendGraphQLClient(transcendUrl, transcendAuth)\n : undefined;\n\n try {\n if (resource === OneTrustPullResource.Assessments) {\n if (source === OneTrustPullSource.OneTrust && oneTrust) {\n await syncOneTrustAssessmentsFromOneTrust({\n oneTrust,\n file,\n dryRun,\n ...(transcend && { transcend }),\n });\n } else if (source === OneTrustPullSource.File && file && transcend) {\n await syncOneTrustAssessmentsFromFile({ file, transcend });\n }\n }\n } catch (err) {\n throw new Error(\n `An error occurred syncing the resource ${resource} from OneTrust: ${\n debug ? err.stack : err.message\n }`,\n );\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced OneTrust ${resource} to ${\n dryRun ? `disk at \"${file}\"` : 'Transcend'\n }!`,\n ),\n );\n}\n","import got, { Got } from 'got';\n\n/**\n * Instantiate an instance of got that is capable of making requests to OneTrust\n *\n * @param param - information about the OneTrust URL\n * @returns The instance of got that is capable of making requests to the customer ingress\n */\nexport const createOneTrustGotInstance = ({\n hostname,\n auth,\n}: {\n /** Hostname of the OneTrust API */\n hostname: string;\n /** The OAuth access token */\n auth: string;\n}): Got =>\n got.extend({\n prefixUrl: `https://${hostname}`,\n headers: {\n accept: 'application/json',\n 'content-type': 'application/json',\n authorization: `Bearer ${auth}`,\n },\n });\n","import { OneTrustEnrichedAssessment } from '@transcend-io/privacy-types';\n\n/**\n * Converts the assessment into a json entry.\n *\n * @param param - information about the assessment and amount of entries\n * @returns a stringified json entry ready to be appended to a file\n */\nexport const oneTrustAssessmentToJson = ({\n assessment,\n index,\n total,\n wrap = true,\n}: {\n /** The assessment to convert */\n assessment: OneTrustEnrichedAssessment;\n /** The position of the assessment in the final Json object */\n index: number;\n /** The total amount of the assessments in the final Json object */\n total?: number;\n /** Whether to wrap every entry in brackets */\n wrap?: boolean;\n}): string => {\n let jsonEntry = '';\n // start with an opening bracket\n if (index === 0 || wrap) {\n jsonEntry = '[\\n';\n }\n\n const stringifiedAssessment = JSON.stringify(assessment);\n\n // Add comma for all items except the last one\n const comma = total && index < total - 1 && !wrap ? ',' : '';\n\n // write to file\n jsonEntry = `${jsonEntry + stringifiedAssessment + comma}\\n`;\n\n // end with closing bracket\n if ((total && index === total - 1) || wrap) {\n jsonEntry += '\\n]';\n }\n\n return jsonEntry;\n};\n","import { Got } from 'got';\nimport { logger } from '../../../logger';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport {\n OneTrustAssessment,\n OneTrustGetListOfAssessmentsResponse,\n} from '@transcend-io/privacy-types';\n\n/**\n * Fetch a list of all assessments from the OneTrust client.\n * ref: https://developer.onetrust.com/onetrust/reference/getallassessmentbasicdetailsusingget\n *\n * @param param - the information about the OneTrust client\n * @returns a list of OneTrustAssessment\n */\nexport const getListOfOneTrustAssessments = async ({\n oneTrust,\n}: {\n /** The OneTrust client instance */\n oneTrust: Got;\n}): Promise<OneTrustAssessment[]> => {\n let currentPage = 0;\n let totalPages = 1;\n let totalElements = 0;\n\n const allAssessments: OneTrustAssessment[] = [];\n\n while (currentPage < totalPages) {\n const { body } = await oneTrust.get(\n `api/assessment/v2/assessments?page=${currentPage}&size=2000`,\n );\n\n const { page, content } = decodeCodec(\n OneTrustGetListOfAssessmentsResponse,\n body,\n );\n allAssessments.push(...(content ?? []));\n if (currentPage === 0) {\n totalPages = page?.totalPages ?? 0;\n totalElements = page?.totalElements ?? 0;\n }\n currentPage += 1;\n\n // log progress\n logger.info(\n `Fetched ${allAssessments.length} of ${totalElements} assessments.`,\n );\n }\n\n return allAssessments;\n};\n","import { logger } from '../../../logger';\nimport colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport {\n IMPORT_ONE_TRUST_ASSESSMENT_FORMS,\n makeGraphQLRequest,\n} from '../../graphql';\nimport { ImportOnetrustAssessmentsInput } from '../../../codecs';\nimport { OneTrustEnrichedAssessment } from '@transcend-io/privacy-types';\nimport { oneTrustAssessmentToJson } from './oneTrustAssessmentToJson';\n\nexport interface AssessmentForm {\n /** ID of Assessment Form */\n id: string;\n /** Title of Assessment Form */\n name: string;\n}\n\n/**\n * Write the assessment to a Transcend instance.\n *\n *\n * @param param - information about the assessment and Transcend instance to write to\n */\nexport const syncOneTrustAssessmentToTranscend = async ({\n transcend,\n assessment,\n total,\n index,\n}: {\n /** the Transcend client instance */\n transcend: GraphQLClient;\n /** the assessment to sync to Transcend */\n assessment: OneTrustEnrichedAssessment;\n /** The index of the assessment being written to the file */\n index: number;\n /** The total amount of assessments that we will write */\n total?: number;\n}): Promise<void> => {\n logger.info(\n colors.magenta(\n `Writing enriched assessment ${index + 1} ${\n total ? `of ${total} ` : ' '\n }to Transcend...`,\n ),\n );\n\n // convert the OneTrust assessment object into a json record\n const json = oneTrustAssessmentToJson({\n assessment,\n index,\n total,\n });\n\n // transform the json record into a valid input to the mutation\n const input: ImportOnetrustAssessmentsInput = {\n json,\n };\n\n try {\n await makeGraphQLRequest<{\n /** the importOneTrustAssessmentForms mutation */\n importOneTrustAssessmentForms: {\n /** Created Assessment Forms */\n assessmentForms: AssessmentForm[];\n };\n }>(transcend, IMPORT_ONE_TRUST_ASSESSMENT_FORMS, {\n input,\n });\n } catch (e) {\n logger.error(\n colors.red(\n `Failed to sync assessment ${index + 1} ${\n total ? `of ${total} ` : ' '\n }to Transcend.\\n` +\n `\\tAssessment Title: ${assessment.name}. Template Title: ${assessment.template.name}\\n`,\n ),\n );\n }\n};\n","import type { Got } from 'got';\nimport colors from 'colors';\nimport {\n getListOfOneTrustAssessments,\n getOneTrustAssessment,\n getOneTrustRisk,\n getOneTrustUser,\n} from '../endpoints';\nimport { mapSeries, map } from 'bluebird';\nimport { logger } from '../../../logger';\nimport {\n OneTrustAssessmentQuestion,\n OneTrustAssessmentSection,\n OneTrustEnrichedAssessment,\n OneTrustGetRiskResponse,\n OneTrustGetUserResponse,\n} from '@transcend-io/privacy-types';\nimport { uniq } from 'lodash-es';\nimport { enrichOneTrustAssessment } from './enrichOneTrustAssessment';\nimport { syncOneTrustAssessmentToDisk } from './syncOneTrustAssessmentToDisk';\nimport { GraphQLClient } from 'graphql-request';\nimport { syncOneTrustAssessmentToTranscend } from './syncOneTrustAssessmentToTranscend';\n\nexport interface AssessmentForm {\n /** ID of Assessment Form */\n id: string;\n /** Title of Assessment Form */\n name: string;\n}\n\n/**\n * Reads all the assessments from a OneTrust instance and syncs them to Transcend or to Disk.\n *\n * @param param - the information about the assessment, its OneTrust source, and destination (disk or Transcend)\n */\nexport const syncOneTrustAssessmentsFromOneTrust = async ({\n oneTrust,\n file,\n dryRun,\n transcend,\n}: {\n /** the OneTrust client instance */\n oneTrust: Got;\n /** the Transcend client instance */\n transcend?: GraphQLClient;\n /** Whether to write to file instead of syncing to Transcend */\n dryRun: boolean;\n /** the path to the file in case dryRun is true */\n file?: string;\n}): Promise<void> => {\n // fetch the list of all assessments in the OneTrust organization\n logger.info('Getting list of all assessments from OneTrust...');\n const assessments = await getListOfOneTrustAssessments({ oneTrust });\n\n // a cache of OneTrust users so we avoid requesting already fetched users\n const oneTrustCachedUsers: Record<string, OneTrustGetUserResponse> = {};\n\n // split all assessments in batches, so we can process some of steps in parallel\n const BATCH_SIZE = 5;\n const assessmentBatches = Array.from(\n {\n length: Math.ceil(assessments.length / BATCH_SIZE),\n },\n (_, i) => assessments.slice(i * BATCH_SIZE, (i + 1) * BATCH_SIZE),\n );\n\n // process each batch and sync the batch right away so it's garbage collected and we don't run out of memory\n await mapSeries(assessmentBatches, async (assessmentBatch, batch) => {\n const batchEnrichedAssessments: OneTrustEnrichedAssessment[] = [];\n\n // fetch assessment details from OneTrust in parallel\n await map(\n assessmentBatch,\n async (assessment, index) => {\n const assessmentNumber = BATCH_SIZE * batch + index + 1;\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching details...`,\n );\n const { templateName, assessmentId } = assessment;\n const assessmentDetails = await getOneTrustAssessment({\n oneTrust,\n assessmentId,\n });\n // fetch assessment's creator information\n const creatorId = assessmentDetails.createdBy.id;\n let creator = oneTrustCachedUsers[creatorId];\n if (!creator) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching creator...`,\n );\n try {\n creator = await getOneTrustUser({\n oneTrust,\n userId: creatorId,\n });\n oneTrustCachedUsers[creatorId] = creator;\n } catch (e) {\n logger.warn(\n colors.yellow(\n `[assessment ${assessmentNumber} of ${assessments.length}]: failed to fetch form creator.` +\n `\\tcreatorId: ${creatorId}. Assessment Title: ${assessment.name}. Template Title: ${templateName}`,\n ),\n );\n }\n }\n\n // fetch assessment approvers information\n const { approvers } = assessmentDetails;\n let approversDetails: OneTrustGetUserResponse[][] = [];\n if (approvers.length > 0) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching approvers...`,\n );\n approversDetails = await map(\n approvers.map(({ id }) => id),\n async (userId) => {\n try {\n let approver = oneTrustCachedUsers[userId];\n if (!approver) {\n approver = await getOneTrustUser({ oneTrust, userId });\n oneTrustCachedUsers[userId] = approver;\n }\n return [approver];\n } catch (e) {\n logger.warn(\n colors.yellow(\n `[assessment ${assessmentNumber} of ${assessments.length}]: failed to fetch a form approver.` +\n `\\tapproverId: ${userId}. Assessment Title: ${assessment.name}. Template Title: ${templateName}`,\n ),\n );\n return [];\n }\n },\n { concurrency: 5 },\n );\n }\n\n // fetch assessment internal respondents information\n const { respondents } = assessmentDetails;\n // if a user is an internal respondents, their 'name' field can't be an email.\n const internalRespondents = respondents.filter(\n (r) => !r.name.includes('@'),\n );\n let respondentsDetails: OneTrustGetUserResponse[][] = [];\n if (internalRespondents.length > 0) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching respondents...`,\n );\n respondentsDetails = await map(\n internalRespondents.map(({ id }) => id),\n async (userId) => {\n try {\n let respondent = oneTrustCachedUsers[userId];\n if (!respondent) {\n respondent = await getOneTrustUser({ oneTrust, userId });\n oneTrustCachedUsers[userId] = respondent;\n }\n return [respondent];\n } catch (e) {\n logger.warn(\n colors.yellow(\n `[assessment ${assessmentNumber} of ${assessments.length}]: failed to fetch a respondent.` +\n `\\trespondentId: ${userId}. Assessment Title: ${assessment.name}. Template Title: ${templateName}`,\n ),\n );\n return [];\n }\n },\n { concurrency: 5 },\n );\n }\n\n // fetch assessment risk information\n let riskDetails: OneTrustGetRiskResponse[] = [];\n const riskIds = uniq(\n assessmentDetails.sections.flatMap((s: OneTrustAssessmentSection) =>\n s.questions.flatMap((q: OneTrustAssessmentQuestion) =>\n (q.risks ?? []).flatMap((r) => r.riskId),\n ),\n ),\n );\n if (riskIds.length > 0) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching risks...`,\n );\n riskDetails = await map(\n riskIds,\n (riskId) => getOneTrustRisk({ oneTrust, riskId: riskId as string }),\n {\n concurrency: 5,\n },\n );\n }\n\n // enrich the assessments with user and risk details\n const enrichedAssessment = enrichOneTrustAssessment({\n assessment,\n assessmentDetails,\n riskDetails,\n creatorDetails: creator,\n approversDetails: approversDetails.flat(),\n respondentsDetails: respondentsDetails.flat(),\n });\n\n batchEnrichedAssessments.push(enrichedAssessment);\n },\n { concurrency: BATCH_SIZE },\n );\n\n // sync assessments in series to avoid concurrency bugs\n await mapSeries(\n batchEnrichedAssessments,\n async (enrichedAssessment, index) => {\n // the assessment's global index takes its batch into consideration\n const globalIndex = batch * BATCH_SIZE + index;\n\n if (dryRun && file) {\n // sync to file\n syncOneTrustAssessmentToDisk({\n assessment: enrichedAssessment,\n index: globalIndex,\n total: assessments.length,\n file,\n });\n } else if (transcend) {\n // sync to transcend\n await syncOneTrustAssessmentToTranscend({\n assessment: enrichedAssessment,\n transcend,\n total: assessments.length,\n index: globalIndex,\n });\n }\n },\n );\n });\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-AS634NMX.cjs","../src/commands/migration/sync-ot/impl.ts","../src/lib/oneTrust/createOneTrustGotInstance.ts","../src/lib/oneTrust/helpers/oneTrustAssessmentToJson.ts","../src/lib/oneTrust/endpoints/getListOfOneTrustAssessments.ts","../src/lib/oneTrust/helpers/syncOneTrustAssessmentToTranscend.ts","../src/lib/oneTrust/helpers/syncOneTrustAssessmentsFromOneTrust.ts"],"names":["createOneTrustGotInstance","hostname","auth","got"],"mappings":"AAAA,y0BAAwC,wDAA0D,gCAA6B,wDAAoC,wDAAgD,wDAAyC,gFCEzO,oECFM,IAQZA,CAAAA,CAA4B,CAAC,CACxC,QAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CACF,CAAA,CAAA,EAMEC,aAAAA,CAAI,MAAA,CAAO,CACT,SAAA,CAAW,CAAA,QAAA,EAAWF,CAAQ,CAAA,CAAA;ACiBwB;AAIzC;AClCf,CAAA;ACsE2F,mBAAA;ACC3B","file":"/home/runner/work/cli/cli/dist/impl-AS634NMX.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { logger } from '../../../logger';\nimport colors from 'colors';\nimport { createOneTrustGotInstance } from '../../../lib/oneTrust';\nimport {\n OneTrustFileFormat,\n OneTrustPullResource,\n OneTrustPullSource,\n} from '../../../enums';\nimport { buildTranscendGraphQLClient } from '../../../lib/graphql';\nimport {\n syncOneTrustAssessmentsFromFile,\n syncOneTrustAssessmentsFromOneTrust,\n} from '../../../lib/oneTrust/helpers';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\n// Command flag interface\nexport interface SyncOtCommandFlags {\n hostname?: string;\n oneTrustAuth?: string;\n source: OneTrustPullSource;\n transcendAuth?: string;\n transcendUrl: string;\n file?: string;\n resource: OneTrustPullResource;\n dryRun: boolean;\n debug: boolean;\n}\n\n// Command implementation\nexport async function syncOt(\n this: LocalContext,\n {\n hostname,\n oneTrustAuth,\n source,\n transcendAuth,\n transcendUrl,\n resource,\n file,\n dryRun,\n debug,\n }: SyncOtCommandFlags,\n): Promise<void> {\n // Must be able to authenticate to transcend to sync resources to it\n if (!dryRun && !transcendAuth) {\n throw new Error(\n // eslint-disable-next-line no-template-curly-in-string\n 'Must specify a \"transcendAuth\" parameter to sync resources to Transcend. e.g. --transcendAuth=${TRANSCEND_API_KEY}',\n );\n }\n\n // If trying to sync to disk, must specify a file path\n if (dryRun && !file) {\n throw new Error(\n 'Must set a \"file\" parameter when \"dryRun\" is \"true\". e.g. --file=./oneTrustAssessments.json',\n );\n }\n\n if (file) {\n const splitFile = file.split('.');\n if (splitFile.length < 2) {\n throw new Error(\n 'The \"file\" parameter has an invalid format. Expected a path with extensions. e.g. --file=./pathToFile.json.',\n );\n }\n if (splitFile.at(-1) !== OneTrustFileFormat.Json) {\n throw new Error(\n `Expected the format of the \"file\" parameters '${file}' to be '${\n OneTrustFileFormat.Json\n }', but got '${splitFile.at(-1)}'.`,\n );\n }\n }\n\n // if reading assessments from a OneTrust\n if (source === OneTrustPullSource.OneTrust) {\n // must specify the OneTrust hostname\n if (!hostname) {\n throw new Error(\n 'Missing required parameter \"hostname\". e.g. --hostname=customer.my.onetrust.com',\n );\n }\n // must specify the OneTrust auth\n if (!oneTrustAuth) {\n throw new Error(\n 'Missing required parameter \"oneTrustAuth\". e.g. --oneTrustAuth=$ONE_TRUST_AUTH_TOKEN',\n );\n }\n } else {\n // if reading the assessments from a file, must specify a file to read from\n if (!file) {\n throw new Error(\n 'Must specify a \"file\" parameter to read the OneTrust assessments from. e.g. --source=./oneTrustAssessments.json',\n );\n }\n\n // Cannot try reading from file and save assessments to a file simultaneously\n if (dryRun) {\n throw new Error(\n 'Cannot read and write to a file simultaneously.' +\n ` Emit the \"source\" parameter or set it to ${OneTrustPullSource.OneTrust} if \"dryRun\" is enabled.`,\n );\n }\n }\n\n doneInputValidation(this.process.exit);\n\n // instantiate a client to talk to OneTrust\n const oneTrust =\n hostname && oneTrustAuth\n ? createOneTrustGotInstance({\n hostname,\n auth: oneTrustAuth,\n })\n : undefined;\n\n // instantiate a client to talk to Transcend\n const transcend =\n transcendUrl && transcendAuth\n ? buildTranscendGraphQLClient(transcendUrl, transcendAuth)\n : undefined;\n\n try {\n if (resource === OneTrustPullResource.Assessments) {\n if (source === OneTrustPullSource.OneTrust && oneTrust) {\n await syncOneTrustAssessmentsFromOneTrust({\n oneTrust,\n file,\n dryRun,\n ...(transcend && { transcend }),\n });\n } else if (source === OneTrustPullSource.File && file && transcend) {\n await syncOneTrustAssessmentsFromFile({ file, transcend });\n }\n }\n } catch (err) {\n throw new Error(\n `An error occurred syncing the resource ${resource} from OneTrust: ${\n debug ? err.stack : err.message\n }`,\n );\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced OneTrust ${resource} to ${\n dryRun ? `disk at \"${file}\"` : 'Transcend'\n }!`,\n ),\n );\n}\n","import got, { Got } from 'got';\n\n/**\n * Instantiate an instance of got that is capable of making requests to OneTrust\n *\n * @param param - information about the OneTrust URL\n * @returns The instance of got that is capable of making requests to the customer ingress\n */\nexport const createOneTrustGotInstance = ({\n hostname,\n auth,\n}: {\n /** Hostname of the OneTrust API */\n hostname: string;\n /** The OAuth access token */\n auth: string;\n}): Got =>\n got.extend({\n prefixUrl: `https://${hostname}`,\n headers: {\n accept: 'application/json',\n 'content-type': 'application/json',\n authorization: `Bearer ${auth}`,\n },\n });\n","import { OneTrustEnrichedAssessment } from '@transcend-io/privacy-types';\n\n/**\n * Converts the assessment into a json entry.\n *\n * @param param - information about the assessment and amount of entries\n * @returns a stringified json entry ready to be appended to a file\n */\nexport const oneTrustAssessmentToJson = ({\n assessment,\n index,\n total,\n wrap = true,\n}: {\n /** The assessment to convert */\n assessment: OneTrustEnrichedAssessment;\n /** The position of the assessment in the final Json object */\n index: number;\n /** The total amount of the assessments in the final Json object */\n total?: number;\n /** Whether to wrap every entry in brackets */\n wrap?: boolean;\n}): string => {\n let jsonEntry = '';\n // start with an opening bracket\n if (index === 0 || wrap) {\n jsonEntry = '[\\n';\n }\n\n const stringifiedAssessment = JSON.stringify(assessment);\n\n // Add comma for all items except the last one\n const comma = total && index < total - 1 && !wrap ? ',' : '';\n\n // write to file\n jsonEntry = `${jsonEntry + stringifiedAssessment + comma}\\n`;\n\n // end with closing bracket\n if ((total && index === total - 1) || wrap) {\n jsonEntry += '\\n]';\n }\n\n return jsonEntry;\n};\n","import { Got } from 'got';\nimport { logger } from '../../../logger';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport {\n OneTrustAssessment,\n OneTrustGetListOfAssessmentsResponse,\n} from '@transcend-io/privacy-types';\n\n/**\n * Fetch a list of all assessments from the OneTrust client.\n * ref: https://developer.onetrust.com/onetrust/reference/getallassessmentbasicdetailsusingget\n *\n * @param param - the information about the OneTrust client\n * @returns a list of OneTrustAssessment\n */\nexport const getListOfOneTrustAssessments = async ({\n oneTrust,\n}: {\n /** The OneTrust client instance */\n oneTrust: Got;\n}): Promise<OneTrustAssessment[]> => {\n let currentPage = 0;\n let totalPages = 1;\n let totalElements = 0;\n\n const allAssessments: OneTrustAssessment[] = [];\n\n while (currentPage < totalPages) {\n const { body } = await oneTrust.get(\n `api/assessment/v2/assessments?page=${currentPage}&size=2000`,\n );\n\n const { page, content } = decodeCodec(\n OneTrustGetListOfAssessmentsResponse,\n body,\n );\n allAssessments.push(...(content ?? []));\n if (currentPage === 0) {\n totalPages = page?.totalPages ?? 0;\n totalElements = page?.totalElements ?? 0;\n }\n currentPage += 1;\n\n // log progress\n logger.info(\n `Fetched ${allAssessments.length} of ${totalElements} assessments.`,\n );\n }\n\n return allAssessments;\n};\n","import { logger } from '../../../logger';\nimport colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport {\n IMPORT_ONE_TRUST_ASSESSMENT_FORMS,\n makeGraphQLRequest,\n} from '../../graphql';\nimport { ImportOnetrustAssessmentsInput } from '../../../codecs';\nimport { OneTrustEnrichedAssessment } from '@transcend-io/privacy-types';\nimport { oneTrustAssessmentToJson } from './oneTrustAssessmentToJson';\n\nexport interface AssessmentForm {\n /** ID of Assessment Form */\n id: string;\n /** Title of Assessment Form */\n name: string;\n}\n\n/**\n * Write the assessment to a Transcend instance.\n *\n *\n * @param param - information about the assessment and Transcend instance to write to\n */\nexport const syncOneTrustAssessmentToTranscend = async ({\n transcend,\n assessment,\n total,\n index,\n}: {\n /** the Transcend client instance */\n transcend: GraphQLClient;\n /** the assessment to sync to Transcend */\n assessment: OneTrustEnrichedAssessment;\n /** The index of the assessment being written to the file */\n index: number;\n /** The total amount of assessments that we will write */\n total?: number;\n}): Promise<void> => {\n logger.info(\n colors.magenta(\n `Writing enriched assessment ${index + 1} ${\n total ? `of ${total} ` : ' '\n }to Transcend...`,\n ),\n );\n\n // convert the OneTrust assessment object into a json record\n const json = oneTrustAssessmentToJson({\n assessment,\n index,\n total,\n });\n\n // transform the json record into a valid input to the mutation\n const input: ImportOnetrustAssessmentsInput = {\n json,\n };\n\n try {\n await makeGraphQLRequest<{\n /** the importOneTrustAssessmentForms mutation */\n importOneTrustAssessmentForms: {\n /** Created Assessment Forms */\n assessmentForms: AssessmentForm[];\n };\n }>(transcend, IMPORT_ONE_TRUST_ASSESSMENT_FORMS, {\n input,\n });\n } catch (e) {\n logger.error(\n colors.red(\n `Failed to sync assessment ${index + 1} ${\n total ? `of ${total} ` : ' '\n }to Transcend.\\n` +\n `\\tAssessment Title: ${assessment.name}. Template Title: ${assessment.template.name}\\n`,\n ),\n );\n }\n};\n","import type { Got } from 'got';\nimport colors from 'colors';\nimport {\n getListOfOneTrustAssessments,\n getOneTrustAssessment,\n getOneTrustRisk,\n getOneTrustUser,\n} from '../endpoints';\nimport { mapSeries, map } from 'bluebird';\nimport { logger } from '../../../logger';\nimport {\n OneTrustAssessmentQuestion,\n OneTrustAssessmentSection,\n OneTrustEnrichedAssessment,\n OneTrustGetRiskResponse,\n OneTrustGetUserResponse,\n} from '@transcend-io/privacy-types';\nimport { uniq } from 'lodash-es';\nimport { enrichOneTrustAssessment } from './enrichOneTrustAssessment';\nimport { syncOneTrustAssessmentToDisk } from './syncOneTrustAssessmentToDisk';\nimport { GraphQLClient } from 'graphql-request';\nimport { syncOneTrustAssessmentToTranscend } from './syncOneTrustAssessmentToTranscend';\n\nexport interface AssessmentForm {\n /** ID of Assessment Form */\n id: string;\n /** Title of Assessment Form */\n name: string;\n}\n\n/**\n * Reads all the assessments from a OneTrust instance and syncs them to Transcend or to Disk.\n *\n * @param param - the information about the assessment, its OneTrust source, and destination (disk or Transcend)\n */\nexport const syncOneTrustAssessmentsFromOneTrust = async ({\n oneTrust,\n file,\n dryRun,\n transcend,\n}: {\n /** the OneTrust client instance */\n oneTrust: Got;\n /** the Transcend client instance */\n transcend?: GraphQLClient;\n /** Whether to write to file instead of syncing to Transcend */\n dryRun: boolean;\n /** the path to the file in case dryRun is true */\n file?: string;\n}): Promise<void> => {\n // fetch the list of all assessments in the OneTrust organization\n logger.info('Getting list of all assessments from OneTrust...');\n const assessments = await getListOfOneTrustAssessments({ oneTrust });\n\n // a cache of OneTrust users so we avoid requesting already fetched users\n const oneTrustCachedUsers: Record<string, OneTrustGetUserResponse> = {};\n\n // split all assessments in batches, so we can process some of steps in parallel\n const BATCH_SIZE = 5;\n const assessmentBatches = Array.from(\n {\n length: Math.ceil(assessments.length / BATCH_SIZE),\n },\n (_, i) => assessments.slice(i * BATCH_SIZE, (i + 1) * BATCH_SIZE),\n );\n\n // process each batch and sync the batch right away so it's garbage collected and we don't run out of memory\n await mapSeries(assessmentBatches, async (assessmentBatch, batch) => {\n const batchEnrichedAssessments: OneTrustEnrichedAssessment[] = [];\n\n // fetch assessment details from OneTrust in parallel\n await map(\n assessmentBatch,\n async (assessment, index) => {\n const assessmentNumber = BATCH_SIZE * batch + index + 1;\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching details...`,\n );\n const { templateName, assessmentId } = assessment;\n const assessmentDetails = await getOneTrustAssessment({\n oneTrust,\n assessmentId,\n });\n // fetch assessment's creator information\n const creatorId = assessmentDetails.createdBy.id;\n let creator = oneTrustCachedUsers[creatorId];\n if (!creator) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching creator...`,\n );\n try {\n creator = await getOneTrustUser({\n oneTrust,\n userId: creatorId,\n });\n oneTrustCachedUsers[creatorId] = creator;\n } catch (e) {\n logger.warn(\n colors.yellow(\n `[assessment ${assessmentNumber} of ${assessments.length}]: failed to fetch form creator.` +\n `\\tcreatorId: ${creatorId}. Assessment Title: ${assessment.name}. Template Title: ${templateName}`,\n ),\n );\n }\n }\n\n // fetch assessment approvers information\n const { approvers } = assessmentDetails;\n let approversDetails: OneTrustGetUserResponse[][] = [];\n if (approvers.length > 0) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching approvers...`,\n );\n approversDetails = await map(\n approvers.map(({ id }) => id),\n async (userId) => {\n try {\n let approver = oneTrustCachedUsers[userId];\n if (!approver) {\n approver = await getOneTrustUser({ oneTrust, userId });\n oneTrustCachedUsers[userId] = approver;\n }\n return [approver];\n } catch (e) {\n logger.warn(\n colors.yellow(\n `[assessment ${assessmentNumber} of ${assessments.length}]: failed to fetch a form approver.` +\n `\\tapproverId: ${userId}. Assessment Title: ${assessment.name}. Template Title: ${templateName}`,\n ),\n );\n return [];\n }\n },\n { concurrency: 5 },\n );\n }\n\n // fetch assessment internal respondents information\n const { respondents } = assessmentDetails;\n // if a user is an internal respondents, their 'name' field can't be an email.\n const internalRespondents = respondents.filter(\n (r) => !r.name.includes('@'),\n );\n let respondentsDetails: OneTrustGetUserResponse[][] = [];\n if (internalRespondents.length > 0) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching respondents...`,\n );\n respondentsDetails = await map(\n internalRespondents.map(({ id }) => id),\n async (userId) => {\n try {\n let respondent = oneTrustCachedUsers[userId];\n if (!respondent) {\n respondent = await getOneTrustUser({ oneTrust, userId });\n oneTrustCachedUsers[userId] = respondent;\n }\n return [respondent];\n } catch (e) {\n logger.warn(\n colors.yellow(\n `[assessment ${assessmentNumber} of ${assessments.length}]: failed to fetch a respondent.` +\n `\\trespondentId: ${userId}. Assessment Title: ${assessment.name}. Template Title: ${templateName}`,\n ),\n );\n return [];\n }\n },\n { concurrency: 5 },\n );\n }\n\n // fetch assessment risk information\n let riskDetails: OneTrustGetRiskResponse[] = [];\n const riskIds = uniq(\n assessmentDetails.sections.flatMap((s: OneTrustAssessmentSection) =>\n s.questions.flatMap((q: OneTrustAssessmentQuestion) =>\n (q.risks ?? []).flatMap((r) => r.riskId),\n ),\n ),\n );\n if (riskIds.length > 0) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching risks...`,\n );\n riskDetails = await map(\n riskIds,\n (riskId) => getOneTrustRisk({ oneTrust, riskId: riskId as string }),\n {\n concurrency: 5,\n },\n );\n }\n\n // enrich the assessments with user and risk details\n const enrichedAssessment = enrichOneTrustAssessment({\n assessment,\n assessmentDetails,\n riskDetails,\n creatorDetails: creator,\n approversDetails: approversDetails.flat(),\n respondentsDetails: respondentsDetails.flat(),\n });\n\n batchEnrichedAssessments.push(enrichedAssessment);\n },\n { concurrency: BATCH_SIZE },\n );\n\n // sync assessments in series to avoid concurrency bugs\n await mapSeries(\n batchEnrichedAssessments,\n async (enrichedAssessment, index) => {\n // the assessment's global index takes its batch into consideration\n const globalIndex = batch * BATCH_SIZE + index;\n\n if (dryRun && file) {\n // sync to file\n syncOneTrustAssessmentToDisk({\n assessment: enrichedAssessment,\n index: globalIndex,\n total: assessments.length,\n file,\n });\n } else if (transcend) {\n // sync to transcend\n await syncOneTrustAssessmentToTranscend({\n assessment: enrichedAssessment,\n transcend,\n total: assessments.length,\n index: globalIndex,\n });\n }\n },\n );\n });\n};\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkHAAVY3FGcjs = require('./chunk-HAAVY3FG.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunkVWGA62SGcjs = require('./chunk-VWGA62SG.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkFZTNEEMWcjs = require('./chunk-FZTNEEMW.cjs');require('./chunk-7PB6LVSE.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);async function v({auth:y,file:a,transcendUrl:C,dataSiloIds:f,includeAttributes:D,includeGuessedCategories:P,parentCategories:b,subCategories:h=[]}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);try{let o=_chunkVWGA62SGcjs.xc.call(void 0, C,y),$=await _chunkHAAVY3FGcjs.a.call(void 0, o,{dataSiloIds:f,includeGuessedCategories:P,parentCategories:b,includeAttributes:D,subCategories:h});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Writing datapoints to file "${a}"...`));let s=[],j=$.map(t=>{let n={"Property ID":t.id,"Data Silo":t.dataSilo.title,Object:t.dataPoint.name,"Object Path":t.dataPoint.path.join("."),Property:t.name,"Property Description":t.description,"Data Categories":t.categories.map(e=>`${e.category}:${e.name}`).join(", "),"Guessed Category":_optionalChain([t, 'access', _ => _.pendingCategoryGuesses, 'optionalAccess', _2 => _2[0]])?`${t.pendingCategoryGuesses[0].category.category}:${t.pendingCategoryGuesses[0].category.name}`:"","Processing Purposes":t.purposes.map(e=>`${e.purpose}:${e.name}`).join(", "),...Object.entries(_chunkFZTNEEMWcjs.d.call(void 0, t.attributeValues||[],({attributeKey:e})=>e.name)).reduce((e,[x,A])=>(e[x]=A.map(G=>G.name).join(","),e),{})};return s=_chunkFZTNEEMWcjs.j.call(void 0, [...s,...Object.keys(n)]),n});await _chunkVWGA62SGcjs.tg.call(void 0, a,j,s)}catch(o){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`An error occurred syncing the datapoints: ${o.message}`)),this.process.exit(1)}_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced datapoints to disk at ${a}! View at ${_chunkFZTNEEMWcjs.q}`))}exports.pullDatapoints = v;
|
|
2
|
+
//# sourceMappingURL=impl-B4H2FDZW.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-B4H2FDZW.cjs","../src/commands/inventory/pull-datapoints/impl.ts"],"names":["pullDatapoints","auth","file","transcendUrl","dataSiloIds","includeAttributes","includeGuessedCategories","parentCategories","subCategories","doneInputValidation","client","buildTranscendGraphQLClient","dataPoints","pullAllDatapoints","logger","colors","headers","inputs","point","result","category"],"mappings":"AAAA,quBAAwC,wDAAyC,wDAAkD,gCAA6B,wDAAyC,wDAAuD,gCAA6B,gFCI1Q,MAmBnB,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,iBAAA,CAAAC,CAAAA,CACA,wBAAA,CAAAC,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,aAAA,CAAAC,CAAAA,CAAgB,CAAC,CACnB,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,GAAI,CAEF,IAAMC,CAAAA,CAASC,kCAAAA,CAA4BR,CAAcF,CAAI,CAAA,CAEvDW,CAAAA,CAAa,MAAMC,iCAAAA,CAAkBH,CAAQ,CACjD,WAAA,CAAAN,CAAAA,CACA,wBAAA,CAAAE,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,iBAAA,CAAAF,CAAAA,CACA,aAAA,CAAAG,CACF,CAAC,CAAA,CAEDM,mBAAAA,CAAO,IAAA,CAAKC,gBAAAA,CAAO,OAAA,CAAQ,CAAA,4BAAA,EAA+Bb,CAAI,CAAA,IAAA,CAAM,CAAC,CAAA,CACrE,IAAIc,CAAAA,CAAoB,CAAC,CAAA,CACnBC,CAAAA,CAASL,CAAAA,CAAW,GAAA,CAAKM,CAAAA,EAAU,CACvC,IAAMC,CAAAA,CAAS,CACb,aAAA,CAAeD,CAAAA,CAAM,EAAA,CACrB,WAAA,CAAaA,CAAAA,CAAM,QAAA,CAAS,KAAA,CAC5B,MAAA,CAAQA,CAAAA,CAAM,SAAA,CAAU,IAAA,CACxB,aAAA,CAAeA,CAAAA,CAAM,SAAA,CAAU,IAAA,CAAK,IAAA,CAAK,GAAG,CAAA,CAC5C,QAAA,CAAUA,CAAAA,CAAM,IAAA,CAChB,sBAAA,CAAwBA,CAAAA,CAAM,WAAA,CAC9B,iBAAA,CAAmBA,CAAAA,CAAM,UAAA,CACtB,GAAA,CAAKE,CAAAA,EAAa,CAAA,EAAA","file":"/home/runner/work/cli/cli/dist/impl-B4H2FDZW.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { uniq, groupBy } from 'lodash-es';\n\nimport { logger } from '../../../logger';\nimport colors from 'colors';\nimport { buildTranscendGraphQLClient } from '../../../lib/graphql';\nimport { ADMIN_DASH_DATAPOINTS } from '../../../constants';\nimport { pullAllDatapoints } from '../../../lib/data-inventory';\nimport { DataCategoryType } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\nimport { writeLargeCsv } from '../../../lib/helpers';\n\nexport interface PullDatapointsCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n includeAttributes: boolean;\n includeGuessedCategories: boolean;\n parentCategories?: DataCategoryType[];\n subCategories?: string[];\n}\n\nexport async function pullDatapoints(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n dataSiloIds,\n includeAttributes,\n includeGuessedCategories,\n parentCategories,\n subCategories = [],\n }: PullDatapointsCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const dataPoints = await pullAllDatapoints(client, {\n dataSiloIds,\n includeGuessedCategories,\n parentCategories,\n includeAttributes,\n subCategories, // TODO: https://transcend.height.app/T-40482 - do by name not ID\n });\n\n logger.info(colors.magenta(`Writing datapoints to file \"${file}\"...`));\n let headers: string[] = [];\n const inputs = dataPoints.map((point) => {\n const result = {\n 'Property ID': point.id,\n 'Data Silo': point.dataSilo.title,\n Object: point.dataPoint.name,\n 'Object Path': point.dataPoint.path.join('.'),\n Property: point.name,\n 'Property Description': point.description,\n 'Data Categories': point.categories\n .map((category) => `${category.category}:${category.name}`)\n .join(', '),\n 'Guessed Category': point.pendingCategoryGuesses?.[0]\n ? `${point.pendingCategoryGuesses![0]!.category.category}:${\n point.pendingCategoryGuesses![0]!.category.name\n }`\n : '',\n 'Processing Purposes': point.purposes\n .map((purpose) => `${purpose.purpose}:${purpose.name}`)\n .join(', '),\n ...Object.entries(\n groupBy(\n point.attributeValues || [],\n ({ attributeKey }) => attributeKey.name,\n ),\n ).reduce((acc, [key, values]) => {\n acc[key] = values.map((value) => value.name).join(',');\n return acc;\n }, {} as Record<string, string>),\n };\n headers = uniq([...headers, ...Object.keys(result)]);\n return result;\n });\n await writeLargeCsv(file, inputs, headers);\n } catch (err) {\n logger.error(\n colors.red(`An error occurred syncing the datapoints: ${err.message}`),\n );\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced datapoints to disk at ${file}! View at ${ADMIN_DASH_DATAPOINTS}`,\n ),\n );\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkJH5HRI6Dcjs = require('./chunk-JH5HRI6D.cjs');var _chunkCLJATLM4cjs = require('./chunk-CLJATLM4.cjs');var _chunkUHERPTMCcjs = require('./chunk-UHERPTMC.cjs');require('./chunk-ABKDAPPR.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunkVWGA62SGcjs = require('./chunk-VWGA62SG.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkFZTNEEMWcjs = require('./chunk-FZTNEEMW.cjs');var _chunk7PB6LVSEcjs = require('./chunk-7PB6LVSE.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _bluebird = require('bluebird');var _path = require('path');var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);async function Y({auth:b,resources:g=_chunkCLJATLM4cjs.i,file:e,transcendUrl:p,dataSiloIds:d=[],integrationNames:T=[],trackerStatuses:h=_chunkCLJATLM4cjs.j,pageSize:y,skipDatapoints:S,skipSubDatapoints:$,includeGuessedCategories:A,debug:s}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);let i=await _chunkUHERPTMCcjs.b.call(void 0, b),C=g.includes("all")?Object.values(_chunk7PB6LVSEcjs.d):g;if(typeof i=="string"){try{let r=_chunkVWGA62SGcjs.xc.call(void 0, p,i),t=await _chunkVWGA62SGcjs.ie.call(void 0, r,{dataSiloIds:d,integrationNames:T,resources:C,pageSize:y,debug:s,skipDatapoints:S,skipSubDatapoints:$,includeGuessedCategories:A,trackerStatuses:h});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Writing configuration to file "${e}"...`)),_chunkJH5HRI6Dcjs.e.call(void 0, e,t)}catch(r){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`An error occurred syncing the schema: ${s?r.stack:r.message}`)),this.process.exit(1)}_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced yaml file to disk at ${e}! View at ${_chunkFZTNEEMWcjs.p}`))}else{if(!_fs2.default.lstatSync(e).isDirectory())throw new Error("File is expected to be a folder when passing in a list of API keys to pull from. e.g. --file=./working/");let r=[];await _bluebird.mapSeries.call(void 0, i,async(t,L)=>{let a=`[${L+1}/${i.length}][${t.organizationName}] `;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`~~~
|
|
2
2
|
|
|
3
3
|
${a}Attempting to pull configuration...
|
|
4
4
|
|
|
5
|
-
~~~`));let _=
|
|
6
|
-
//# sourceMappingURL=impl-
|
|
5
|
+
~~~`));let _=_chunkVWGA62SGcjs.xc.call(void 0, p,t.apiKey);try{let c=await _chunkVWGA62SGcjs.ie.call(void 0, _,{dataSiloIds:d,integrationNames:T,resources:C,pageSize:y,debug:s,skipDatapoints:S,skipSubDatapoints:$,includeGuessedCategories:A,trackerStatuses:h}),w=_path.join.call(void 0, e,`${t.organizationName}.yml`);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Writing configuration to file "${w}"...`)),_chunkJH5HRI6Dcjs.e.call(void 0, w,c),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`${a}Successfully pulled configuration!`))}catch(c){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`${a}Failed to sync configuration. - ${c.message}`)),r.push(t.organizationName)}}),r.length>0&&(_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Sync encountered errors for "${r.join(",")}". View output above for more information, or check out ${_chunkFZTNEEMWcjs.p}`)),this.process.exit(1))}}exports.pull = Y;
|
|
6
|
+
//# sourceMappingURL=impl-BBDBG5OZ.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-BBDBG5OZ.cjs","../src/commands/inventory/pull/impl.ts"],"names":["pull","auth","resources","DEFAULT_TRANSCEND_PULL_RESOURCES","file","transcendUrl","dataSiloIds","integrationNames","trackerStatuses","DEFAULT_CONSENT_TRACKER_STATUSES","pageSize","skipDatapoints","skipSubDatapoints","includeGuessedCategories","debug","doneInputValidation","apiKeyOrList","validateTranscendAuth","resourcesToPull","TranscendPullResource","client","buildTranscendGraphQLClient","configuration","pullTranscendConfiguration","logger","colors","writeTranscendYaml","err"],"mappings":"AAAA,iOAAwC,wDAAgD,wDAAyC,gCAA6B,wDAAyC,wDAAkD,gCAA6B,wDAAyC,wDAAyC,wDAAyC,gFCS9X,oCACO,4BACL,gEACN,MA0Bf,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CAAYC,mBAAAA,CACZ,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CAAc,CAAC,CAAA,CACf,gBAAA,CAAAC,CAAAA,CAAmB,CAAC,CAAA,CACpB,eAAA,CAAAC,CAAAA,CAAkBC,mBAAAA,CAClB,QAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,iBAAA,CAAAC,CAAAA,CACA,wBAAA,CAAAC,CAAAA,CACA,KAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAGrC,IAAMC,CAAAA,CAAe,MAAMC,iCAAAA,CAA0B,CAAA,CAE/CC,CAAAA,CAA2ChB,CAAAA,CAAU,QAAA,CAAS,KAAK,CAAA,CACrE,MAAA,CAAO,MAAA,CAAOiB,mBAAqB,CAAA,CAClCjB,CAAAA,CAGL,EAAA,CAAI,OAAOc,CAAAA,EAAiB,QAAA,CAAU,CACpC,GAAI,CAEF,IAAMI,CAAAA,CAASC,kCAAAA,CAA4BhB,CAAcW,CAAY,CAAA,CAE/DM,CAAAA,CAAgB,MAAMC,kCAAAA,CAA2BH,CAAQ,CAC7D,WAAA,CAAAd,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,SAAA,CAAWW,CAAAA,CACX,QAAA,CAAAR,CAAAA,CACA,KAAA,CAAAI,CAAAA,CACA,cAAA,CAAAH,CAAAA,CACA,iBAAA,CAAAC,CAAAA,CACA,wBAAA,CAAAC,CAAAA,CACA,eAAA,CAAAL,CACF,CAAC,CAAA,CAEDgB,mBAAAA,CAAO,IAAA,CAAKC,gBAAAA,CAAO,OAAA,CAAQ,CAAA,+BAAA,EAAkCrB,CAAI,CAAA,IAAA,CAAM,CAAC,CAAA,CACxEsB,iCAAAA,CAAmBtB,CAAMkB,CAAa,CACxC,CAAA,KAAA,CAASK,CAAAA,CAAK,CACZH,mBAAAA,CAAO,KAAA,CACLC,gBAAAA,CAAO,GAAA,CACL,CAAA,sCAAA,EACEX,CAAAA,CAAQa,CAAAA,CAAI,KAAA,CAAQA,CAAAA,CAAI,OAC1B,CAAA,CAAA;AA0BA;AAAgB;AAAA;AAiD1B,GAAA","file":"/home/runner/work/cli/cli/dist/impl-BBDBG5OZ.cjs","sourcesContent":[null,"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 'bluebird';\nimport { join } from 'node:path';\nimport fs from 'node: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';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface 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 doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n 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 this.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 this.process.exit(1);\n }\n }\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkCBBHRSKJcjs = require('./chunk-CBBHRSKJ.cjs');var _chunkJH5HRI6Dcjs = require('./chunk-JH5HRI6D.cjs');var _chunkUHERPTMCcjs = require('./chunk-UHERPTMC.cjs');require('./chunk-ABKDAPPR.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunkVWGA62SGcjs = require('./chunk-VWGA62SG.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');require('./chunk-FZTNEEMW.cjs');require('./chunk-7PB6LVSE.cjs');var _path = require('path');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _fs = require('fs');async function P({auth:S,dataFlowsYmlFolder:o,dataSilosYmlFolder:e,ignoreYmls:T=[],transcendUrl:v}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),(!_fs.existsSync.call(void 0, o)||!_fs.lstatSync.call(void 0, o).isDirectory())&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Folder does not exist: "${o}"`)),this.process.exit(1)),(!_fs.existsSync.call(void 0, e)||!_fs.lstatSync.call(void 0, e).isDirectory())&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Folder does not exist: "${e}"`)),this.process.exit(1));let u=_chunkVWGA62SGcjs.xc.call(void 0, v,S),{serviceToTitle:w,serviceToSupportedIntegration:F}=await _chunkVWGA62SGcjs.vd.call(void 0, u);_chunkUHERPTMCcjs.c.call(void 0, o).forEach(i=>{let{"data-flows":C=[]}=_chunkJH5HRI6Dcjs.d.call(void 0, _path.join.call(void 0, o,i)),{adTechDataSilos:r,siteTechDataSilos:s}=_chunkCBBHRSKJcjs.a.call(void 0, C,{serviceToSupportedIntegration:F,serviceToTitle:w}),a=[...r,...s];_chunkZUNVPK23cjs.a.log(`Total Services: ${a.length}`),_chunkZUNVPK23cjs.a.log(`Ad Tech Services: ${r.length}`),_chunkZUNVPK23cjs.a.log(`Site Tech Services: ${s.length}`),_chunkJH5HRI6Dcjs.e.call(void 0, _path.join.call(void 0, e,i),{"data-silos":T.includes(i)?[]:a})})}exports.deriveDataSilosFromDataFlows = P;
|
|
2
|
+
//# sourceMappingURL=impl-BRV53IYV.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-BRV53IYV.cjs","../src/commands/inventory/derive-data-silos-from-data-flows/impl.ts"],"names":["deriveDataSilosFromDataFlows","auth","dataFlowsYmlFolder","dataSilosYmlFolder","ignoreYmls","transcendUrl","doneInputValidation","existsSync","lstatSync","logger","colors","client","buildTranscendGraphQLClient","serviceToTitle","serviceToSupportedIntegration","fetchAndIndexCatalogs","listFiles","directory","dataFlows","readTranscendYaml","join","adTechDataSilos","siteTechDataSilos","dataFlowsToDataSilos","dataSilos"],"mappings":"AAAA,iOAAwC,wDAAgD,wDAAyC,gCAA6B,wDAAyC,wDAAkD,gCAA6B,wDAAyC,gCAA6B,gCAA6B,4BCKpW,gFACF,wBAImB,MAgBtC,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,kBAAA,CAAAC,CAAAA,CACA,kBAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CAAa,CAAC,CAAA,CACd,YAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAAA,CAInC,CAACC,4BAAAA,CAA6B,CAAA,EAC9B,CAACC,2BAAAA,CAA4B,CAAA,CAAE,WAAA,CAAY,CAAA,CAAA,EAAA,CAE3CC,mBAAAA,CAAO,KAAA,CAAMC,gBAAAA,CAAO,GAAA,CAAI,CAAA,wBAAA,EAA2BR,CAAkB,CAAA,CAAA,CAAG,CAAC,CAAA,CACzE,IAAA,CAAK,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,CAAA,CAAA,CAKnB,CAACK,4BAAAA,CAA6B,CAAA,EAC9B,CAACC,2BAAAA,CAA4B,CAAA,CAAE,WAAA,CAAY,CAAA,CAAA,EAAA,CAE3CC,mBAAAA,CAAO,KAAA,CAAMC,gBAAAA,CAAO,GAAA,CAAI,CAAA,wBAAA,EAA2BP,CAAkB,CAAA,CAAA,CAAG,CAAC,CAAA,CACzE,IAAA,CAAK,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,CAAA,CAIrB,IAAMQ,CAAAA,CAASC,kCAAAA,CAA4BP,CAAcJ,CAAI,CAAA,CACvD,CAAE,cAAA,CAAAY,CAAAA,CAAgB,6BAAA,CAAAC,CAA8B,CAAA,CACpD,MAAMC,kCAAAA,CAA4B,CAAA,CAGpCC,iCAAAA,CAA4B,CAAA,CAAE,OAAA,CAASC,CAAAA,EAAc,CAEnD,GAAM,CAAE,YAAA,CAAcC,CAAAA,CAAY,CAAC,CAAE,CAAA,CAAIC,iCAAAA,wBACvCC,CAAKlB,CAAoBe,CAAS,CACpC,CAAA,CAGM,CAAE,eAAA,CAAAI,CAAAA,CAAiB,iBAAA,CAAAC,CAAkB,CAAA,CAAIC,iCAAAA,CAC7CL,CACA,CACE,6BAAA,CAAAJ,CAAAA,CACA,cAAA,CAAAD,CACF,CACF,CAAA,CAGMW,CAAAA,CAAY,CAAC,GAAGH,CAAAA,CAAiB,GAAGC,CAAiB,CAAA,CAC3Db,mBAAAA,CAAO,GAAA,CAAI,CAAA,gBAAA,EAAmBe,CAAAA,CAAU,MAAM,CAAA,CAAA","file":"/home/runner/work/cli/cli/dist/impl-BRV53IYV.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport {\n fetchAndIndexCatalogs,\n buildTranscendGraphQLClient,\n} from '../../../lib/graphql';\nimport { join } from 'node:path';\nimport colors from 'colors';\nimport { logger } from '../../../logger';\nimport { dataFlowsToDataSilos } from '../../../lib/consent-manager/dataFlowsToDataSilos';\nimport { DataFlowInput } from '../../../codecs';\nimport { existsSync, lstatSync } from 'node:fs';\nimport { listFiles } from '../../../lib/api-keys';\nimport {\n readTranscendYaml,\n writeTranscendYaml,\n} from '../../../lib/readTranscendYaml';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface 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 doneInputValidation(this.process.exit);\n\n // Ensure folder is passed\n if (\n !existsSync(dataFlowsYmlFolder) ||\n !lstatSync(dataFlowsYmlFolder).isDirectory()\n ) {\n logger.error(colors.red(`Folder does not exist: \"${dataFlowsYmlFolder}\"`));\n this.process.exit(1);\n }\n\n // 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 this.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"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJ7BM4Z6Ucjs = require('./chunk-J7BM4Z6U.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');require('./chunk-VWGA62SG.cjs');require('./chunk-TSJTXXLZ.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-FZTNEEMW.cjs');require('./chunk-7PB6LVSE.cjs');async function u({auth:r,transcendUrl:i,file:e,enricherId:o,concurrency:s,markSilent:a,sombraAuth:m}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),await _chunkJ7BM4Z6Ucjs.d.call(void 0, {file:e,transcendUrl:i,enricherId:o,concurrency:s,markSilent:a,auth:r,sombraAuth:m})}exports.pushIdentifiers = u;
|
|
2
|
+
//# sourceMappingURL=impl-C52MFDKN.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/cli/cli/dist/impl-C52MFDKN.cjs","../src/commands/request/preflight/push-identifiers/impl.ts"],"names":["pushIdentifiers","auth","transcendUrl","file","enricherId","concurrency","markSilent","sombraAuth","doneInputValidation","pushManualEnrichmentIdentifiersFromCsv"],"mappings":"AAAA,iIAAwC,wDAAyC,gCAA6B,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCclO,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,MAAMC,iCAAAA,CACJ,IAAA,CAAAN,CAAAA,CACA,YAAA,CAAAD,CAAAA,CACA,UAAA,CAAAE,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,IAAA,CAAAL,CAAAA,CACA,UAAA,CAAAM,CACF,CAAC,CACH,CAAA,4BAAA","file":"/home/runner/work/cli/cli/dist/impl-C52MFDKN.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../../context';\nimport { pushManualEnrichmentIdentifiersFromCsv } from '../../../../lib/manual-enrichment';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nexport interface PushIdentifiersCommandFlags {\n auth: string;\n enricherId: string;\n sombraAuth?: string;\n transcendUrl: string;\n file: string;\n markSilent: boolean;\n concurrency: number;\n}\n\nexport async function pushIdentifiers(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n file,\n enricherId,\n concurrency,\n markSilent,\n sombraAuth,\n }: PushIdentifiersCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await pushManualEnrichmentIdentifiersFromCsv({\n file,\n transcendUrl,\n enricherId,\n concurrency,\n markSilent,\n auth,\n sombraAuth,\n });\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkZZPMCMEBcjs = require('./chunk-ZZPMCMEB.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunkVWGA62SGcjs = require('./chunk-VWGA62SG.cjs');require('./chunk-TSJTXXLZ.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');require('./chunk-FZTNEEMW.cjs');require('./chunk-7PB6LVSE.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var W=["userId","timestamp","partition","decryptionStatus","updatedAt","usp","gpp","tcf","airgapVersion","metadata","metadataTimestamp"];async function Y({auth:f,partition:o,sombraAuth:V,file:r,transcendUrl:l,timestampBefore:d,timestampAfter:u,updatedBefore:s,updatedAfter:i,identifiers:Q=[],concurrency:g,shouldChunk:C,windowConcurrency:B,maxChunks:G,maxLookbackDays:H}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);let h=await _chunkVWGA62SGcjs.yc.call(void 0, l,f,V),y=_chunkVWGA62SGcjs.xc.call(void 0, l,f),P=Q.map(e=>{if(!e.includes(":"))return{name:"email",value:e};let[t,m]=e.split(":");return{name:t,value:m}}),S={...d?{timestampBefore:d.toISOString()}:{},...u?{timestampAfter:u.toISOString()}:{},...i||s?{system:{...s?{updatedBefore:s.toISOString()}:{},...i?{updatedAfter:i.toISOString()}:{}}}:{},...P.length>0?{identifiers:P}:{}};_chunkZUNVPK23cjs.a.info(`Fetching consent preferences from partition ${o}, using mode=${C?"chunked-stream":"paged-stream"}...`),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Preparing CSV at: ${r}`));let[w,_]=await Promise.all([_chunkVWGA62SGcjs.hd.call(void 0, y),_chunkVWGA62SGcjs.vg.call(void 0, y)]),j=_.map(e=>e.name),E=Array.from(new Set(w.flatMap(e=>_nullishCoalesce(_optionalChain([e, 'access', _2 => _2.topics, 'optionalAccess', _3 => _3.map, 'call', _4 => _4(t=>`${e.trackingType}_${t.slug}`)]), () => ([]))))).sort((e,t)=>e.localeCompare(t)),K=Array.from(new Set(w.map(e=>e.trackingType))).sort((e,t)=>e.localeCompare(t)),M=[...W,...j,...K,...E],a=null,I=!1,b=e=>{if(!e||e.length===0)return;let t=e.map(_chunkZZPMCMEBcjs.b);if(!I){let m=Object.keys(_nullishCoalesce(t[0], () => ({}))),O=new Set;a=[...M,...m].filter(c=>c===void 0||O.has(c)?!1:(O.add(c),!0)),_chunkVWGA62SGcjs.og.call(void 0, r,a),I=!0}_chunkVWGA62SGcjs.pg.call(void 0, r,t,a)};if(C){await _chunkZZPMCMEBcjs.c.call(void 0, h,{partition:o,filterBy:S,limit:g,windowConcurrency:B,maxChunks:G,maxLookbackDays:H,onItems:e=>b(e)}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Finished writing CSV to ${r}`));return}await _chunkZZPMCMEBcjs.d.call(void 0, h,{partition:o,filterBy:S,limit:g,onItems:e=>b(e)}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Finished writing CSV to ${r}`))}exports.pullConsentPreferences = Y;
|
|
2
|
+
//# sourceMappingURL=impl-CDNCBR7T.cjs.map
|