@transcend-io/cli 8.28.0 → 8.30.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 -2
- 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-THOOR2KA.cjs → chunk-4WBBQCOV.cjs} +4 -4
- package/dist/{chunk-THOOR2KA.cjs.map → chunk-4WBBQCOV.cjs.map} +1 -1
- package/dist/{chunk-I7PFP5VB.cjs → chunk-4Y7PZGF3.cjs} +2 -2
- package/dist/{chunk-I7PFP5VB.cjs.map → chunk-4Y7PZGF3.cjs.map} +1 -1
- package/dist/chunk-56COHDFT.cjs +3001 -0
- package/dist/chunk-56COHDFT.cjs.map +1 -0
- package/dist/{chunk-K4TIJ3VM.cjs → chunk-5IHV6OHB.cjs} +2 -2
- package/dist/{chunk-K4TIJ3VM.cjs.map → chunk-5IHV6OHB.cjs.map} +1 -1
- package/dist/{chunk-EYOQLGDV.cjs → chunk-A3GRLGNU.cjs} +2 -2
- package/dist/{chunk-EYOQLGDV.cjs.map → chunk-A3GRLGNU.cjs.map} +1 -1
- package/dist/{chunk-AEL3DOYI.cjs → chunk-BAQ45VZI.cjs} +2 -2
- package/dist/{chunk-AEL3DOYI.cjs.map → chunk-BAQ45VZI.cjs.map} +1 -1
- package/dist/{chunk-FER7XKVN.cjs → chunk-BKPEELIQ.cjs} +2 -2
- package/dist/{chunk-FER7XKVN.cjs.map → chunk-BKPEELIQ.cjs.map} +1 -1
- package/dist/{chunk-JFZPP4VV.cjs → chunk-BQSBPO63.cjs} +3 -3
- package/dist/{chunk-JFZPP4VV.cjs.map → chunk-BQSBPO63.cjs.map} +1 -1
- package/dist/{chunk-LCDYXJN6.cjs → chunk-FHUHBSLE.cjs} +2 -2
- package/dist/{chunk-LCDYXJN6.cjs.map → chunk-FHUHBSLE.cjs.map} +1 -1
- package/dist/{chunk-CQT5QQ3U.cjs → chunk-GNEZHNUR.cjs} +2 -2
- package/dist/{chunk-CQT5QQ3U.cjs.map → chunk-GNEZHNUR.cjs.map} +1 -1
- package/dist/chunk-J5ZSDYK2.cjs +4 -0
- package/dist/chunk-J5ZSDYK2.cjs.map +1 -0
- package/dist/{chunk-ECGHWDVP.cjs → chunk-LU3DKRNK.cjs} +2 -2
- package/dist/chunk-LU3DKRNK.cjs.map +1 -0
- package/dist/{chunk-4PQ4RHUG.cjs → chunk-OSRNUQQ5.cjs} +4 -4
- package/dist/{chunk-4PQ4RHUG.cjs.map → chunk-OSRNUQQ5.cjs.map} +1 -1
- package/dist/{chunk-Q7I37FJV.cjs → chunk-T3BBQIRY.cjs} +2 -2
- package/dist/chunk-T3BBQIRY.cjs.map +1 -0
- package/dist/{chunk-Y35YHYXP.cjs → chunk-U7B2ZKV5.cjs} +21 -21
- package/dist/{chunk-Y35YHYXP.cjs.map → chunk-U7B2ZKV5.cjs.map} +1 -1
- package/dist/{chunk-YKGS253B.cjs → chunk-XSKGXUIG.cjs} +6 -6
- package/dist/{chunk-YKGS253B.cjs.map → chunk-XSKGXUIG.cjs.map} +1 -1
- package/dist/{chunk-RNZ72QMS.cjs → chunk-XURR4JGE.cjs} +2 -2
- package/dist/{chunk-RNZ72QMS.cjs.map → chunk-XURR4JGE.cjs.map} +1 -1
- package/dist/{chunk-L7Z4PFRC.cjs → chunk-ZPCV7RA2.cjs} +2 -2
- package/dist/{chunk-L7Z4PFRC.cjs.map → chunk-ZPCV7RA2.cjs.map} +1 -1
- package/dist/{impl-YWJCIRTP.cjs → impl-5IZGOLMG.cjs} +2 -2
- package/dist/{impl-YWJCIRTP.cjs.map → impl-5IZGOLMG.cjs.map} +1 -1
- package/dist/impl-5KE7PF4S.cjs +2 -0
- package/dist/{impl-PXT7QNSR.cjs.map → impl-5KE7PF4S.cjs.map} +1 -1
- package/dist/{impl-ZTZHVQYY.cjs → impl-63RUFEPF.cjs} +2 -2
- package/dist/{impl-ZTZHVQYY.cjs.map → impl-63RUFEPF.cjs.map} +1 -1
- package/dist/{impl-MBEVWSPX.cjs → impl-CYS34PCP.cjs} +2 -2
- package/dist/{impl-MBEVWSPX.cjs.map → impl-CYS34PCP.cjs.map} +1 -1
- package/dist/{impl-IIIT5MSV.cjs → impl-DFC7R4VO.cjs} +2 -2
- package/dist/{impl-IIIT5MSV.cjs.map → impl-DFC7R4VO.cjs.map} +1 -1
- package/dist/{impl-55NL4KOI.cjs → impl-DLADC4DX.cjs} +2 -2
- package/dist/{impl-55NL4KOI.cjs.map → impl-DLADC4DX.cjs.map} +1 -1
- package/dist/{impl-W35DMTQV.cjs → impl-EA6F65XG.cjs} +2 -2
- package/dist/{impl-W35DMTQV.cjs.map → impl-EA6F65XG.cjs.map} +1 -1
- package/dist/{impl-ANXIZT7S.cjs → impl-ECHPUQTL.cjs} +2 -2
- package/dist/{impl-ANXIZT7S.cjs.map → impl-ECHPUQTL.cjs.map} +1 -1
- package/dist/{impl-3YAJ7ZV3.cjs → impl-EE3BM53W.cjs} +2 -2
- package/dist/{impl-3YAJ7ZV3.cjs.map → impl-EE3BM53W.cjs.map} +1 -1
- package/dist/{impl-SVEK74IU.cjs → impl-FLUPS5AF.cjs} +2 -2
- package/dist/{impl-SVEK74IU.cjs.map → impl-FLUPS5AF.cjs.map} +1 -1
- package/dist/{impl-NCUMPL6B.cjs → impl-HMJ3RSYJ.cjs} +4 -4
- package/dist/{impl-NCUMPL6B.cjs.map → impl-HMJ3RSYJ.cjs.map} +1 -1
- package/dist/impl-HS3DVOVZ.cjs +2 -0
- package/dist/{impl-AP2ZTYJK.cjs.map → impl-HS3DVOVZ.cjs.map} +1 -1
- package/dist/{impl-NISL4HZY.cjs → impl-J4AIXCOM.cjs} +2 -2
- package/dist/{impl-NISL4HZY.cjs.map → impl-J4AIXCOM.cjs.map} +1 -1
- package/dist/{impl-SDQ6LUZD.cjs → impl-KGPFOOKN.cjs} +2 -2
- package/dist/{impl-SDQ6LUZD.cjs.map → impl-KGPFOOKN.cjs.map} +1 -1
- package/dist/{impl-DDQQGOQ3.cjs → impl-L5C2RKOS.cjs} +2 -2
- package/dist/{impl-DDQQGOQ3.cjs.map → impl-L5C2RKOS.cjs.map} +1 -1
- package/dist/{impl-7B7QDZZJ.cjs → impl-MLVDLR4J.cjs} +2 -2
- package/dist/{impl-7B7QDZZJ.cjs.map → impl-MLVDLR4J.cjs.map} +1 -1
- package/dist/impl-NA2AMJMD.cjs +2 -0
- package/dist/{impl-PE52QYSI.cjs.map → impl-NA2AMJMD.cjs.map} +1 -1
- package/dist/impl-NNSUFZJQ.cjs +3 -0
- package/dist/{impl-LDOILOAQ.cjs.map → impl-NNSUFZJQ.cjs.map} +1 -1
- package/dist/{impl-A6W2KTYL.cjs → impl-O752JHWB.cjs} +2 -2
- package/dist/{impl-A6W2KTYL.cjs.map → impl-O752JHWB.cjs.map} +1 -1
- package/dist/{impl-YJ6UUT4D.cjs → impl-P2XOCDM2.cjs} +2 -2
- package/dist/{impl-YJ6UUT4D.cjs.map → impl-P2XOCDM2.cjs.map} +1 -1
- package/dist/{impl-UC5CCT6E.cjs → impl-PC5SSKN6.cjs} +3 -3
- package/dist/{impl-UC5CCT6E.cjs.map → impl-PC5SSKN6.cjs.map} +1 -1
- package/dist/impl-QHSBTADS.cjs +2 -0
- package/dist/{impl-LQEYNOZS.cjs.map → impl-QHSBTADS.cjs.map} +1 -1
- package/dist/{impl-DT5KLE2G.cjs → impl-QZYAF6M6.cjs} +3 -3
- package/dist/{impl-DT5KLE2G.cjs.map → impl-QZYAF6M6.cjs.map} +1 -1
- package/dist/{impl-D7R3HZEC.cjs → impl-R4LLNQUP.cjs} +5 -5
- package/dist/{impl-D7R3HZEC.cjs.map → impl-R4LLNQUP.cjs.map} +1 -1
- package/dist/{impl-YHBNKYSL.cjs → impl-SHD5SUBY.cjs} +2 -2
- package/dist/{impl-YHBNKYSL.cjs.map → impl-SHD5SUBY.cjs.map} +1 -1
- package/dist/{impl-DVE332P5.cjs → impl-THXX4NLG.cjs} +2 -2
- package/dist/{impl-DVE332P5.cjs.map → impl-THXX4NLG.cjs.map} +1 -1
- package/dist/{impl-XHO6WQ2I.cjs → impl-TMXHKQO3.cjs} +2 -2
- package/dist/{impl-XHO6WQ2I.cjs.map → impl-TMXHKQO3.cjs.map} +1 -1
- package/dist/{impl-AZYBYV3X.cjs → impl-TPG3AZ2K.cjs} +2 -2
- package/dist/{impl-AZYBYV3X.cjs.map → impl-TPG3AZ2K.cjs.map} +1 -1
- package/dist/{impl-SVPD3IHV.cjs → impl-TR2HDZHR.cjs} +2 -2
- package/dist/{impl-SVPD3IHV.cjs.map → impl-TR2HDZHR.cjs.map} +1 -1
- package/dist/{impl-LKJFVX7E.cjs → impl-ULIJEGGC.cjs} +2 -2
- package/dist/{impl-LKJFVX7E.cjs.map → impl-ULIJEGGC.cjs.map} +1 -1
- package/dist/{impl-BL4XQEFX.cjs → impl-UNS2BXR7.cjs} +2 -2
- package/dist/{impl-BL4XQEFX.cjs.map → impl-UNS2BXR7.cjs.map} +1 -1
- package/dist/impl-VUTJ4QIY.cjs +2 -0
- package/dist/{impl-ALROZNDJ.cjs.map → impl-VUTJ4QIY.cjs.map} +1 -1
- package/dist/{impl-DXAKJNLZ.cjs → impl-WX2ULFZZ.cjs} +2 -2
- package/dist/{impl-DXAKJNLZ.cjs.map → impl-WX2ULFZZ.cjs.map} +1 -1
- package/dist/impl-XDFFTHEP.cjs +2 -0
- package/dist/{impl-M5QGTDLF.cjs.map → impl-XDFFTHEP.cjs.map} +1 -1
- package/dist/{impl-VZ6NJDAV.cjs → impl-XGCU7DCJ.cjs} +2 -2
- package/dist/{impl-VZ6NJDAV.cjs.map → impl-XGCU7DCJ.cjs.map} +1 -1
- package/dist/{impl-OFRMKTX5.cjs → impl-XPEPCZ67.cjs} +2 -2
- package/dist/{impl-OFRMKTX5.cjs.map → impl-XPEPCZ67.cjs.map} +1 -1
- package/dist/impl-XTRGFE33.cjs +2 -0
- package/dist/{impl-B7ODYIUX.cjs.map → impl-XTRGFE33.cjs.map} +1 -1
- package/dist/impl-XZYXPW67.cjs +2 -0
- package/dist/{impl-BDPD5CCN.cjs.map → impl-XZYXPW67.cjs.map} +1 -1
- package/dist/{impl-IFDUZGZM.cjs → impl-YLR5VYIP.cjs} +2 -2
- package/dist/{impl-IFDUZGZM.cjs.map → impl-YLR5VYIP.cjs.map} +1 -1
- package/dist/{impl-H2BRV4GP.cjs → impl-YTBJQDU6.cjs} +2 -2
- package/dist/{impl-H2BRV4GP.cjs.map → impl-YTBJQDU6.cjs.map} +1 -1
- package/dist/{impl-UZPP5VK5.cjs → impl-ZAXHTVRF.cjs} +2 -2
- package/dist/{impl-UZPP5VK5.cjs.map → impl-ZAXHTVRF.cjs.map} +1 -1
- package/dist/{impl-JPVEFSJB.cjs → impl-ZXJQNHSF.cjs} +2 -2
- package/dist/{impl-JPVEFSJB.cjs.map → impl-ZXJQNHSF.cjs.map} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10867 -5
- package/package.json +1 -1
- package/dist/chunk-7PF5VVAF.cjs +0 -4
- package/dist/chunk-7PF5VVAF.cjs.map +0 -1
- package/dist/chunk-ECGHWDVP.cjs.map +0 -1
- package/dist/chunk-KUBXRT3V.cjs +0 -2979
- package/dist/chunk-KUBXRT3V.cjs.map +0 -1
- package/dist/chunk-Q7I37FJV.cjs.map +0 -1
- package/dist/impl-ALROZNDJ.cjs +0 -2
- package/dist/impl-AP2ZTYJK.cjs +0 -2
- package/dist/impl-B7ODYIUX.cjs +0 -2
- package/dist/impl-BDPD5CCN.cjs +0 -2
- package/dist/impl-LDOILOAQ.cjs +0 -3
- package/dist/impl-LQEYNOZS.cjs +0 -2
- package/dist/impl-M5QGTDLF.cjs +0 -2
- package/dist/impl-PE52QYSI.cjs +0 -2
- package/dist/impl-PXT7QNSR.cjs +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunk56COHDFTcjs = require('./chunk-56COHDFT.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkA3GRLGNUcjs = require('./chunk-A3GRLGNU.cjs');var _crypto = require('crypto'); var E = _interopRequireWildcard(_crypto);var _jsonwebtoken = require('jsonwebtoken'); var $ = _interopRequireWildcard(_jsonwebtoken);function A(c,p,t){let n=Buffer.from(t,"base64"),u=Buffer.from(p,"base64"),f="id-aes256-wrap-pad",l=Buffer.from("A65959A6","hex"),o=E.createCipheriv(f,u,l),s={encryptedIdentifier:Buffer.concat([o.update(c),o.final()]).toString("base64")};return $.sign(s,n,{algorithm:"HS384"})}var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _iots = require('io-ts'); var r = _interopRequireWildcard(_iots);var _bluebird = require('bluebird');var _cliprogress = require('cli-progress'); var _cliprogress2 = _interopRequireDefault(_cliprogress);var _typeutils = require('@transcend-io/type-utils');var x=/^[0-9][Y|N]([Y|N])[Y|N]$/,I= exports.c =r.record(r.string,r.union([r.boolean,r.literal("Auto")]));async function q({base64EncryptionKey:c,base64SigningKey:p,preferences:t,partition:n,concurrency:u=100,transcendUrl:f=_chunkA3GRLGNUcjs.s}){let l=_chunk56COHDFTcjs.zc.call(void 0, f),o=t.filter(e=>e.usp&&!x.test(e.usp));if(o.length>0)throw new Error(`Received invalid usp strings: ${JSON.stringify(o,null,2)}`);let d=t.map((e,g)=>[e,g]).filter(([e])=>{if(!e.purposes)return!1;try{return _typeutils.decodeCodec.call(void 0, I,e.purposes),!1}catch (e2){return!0}});if(d.length>0)throw new Error(`Received invalid purpose maps: ${JSON.stringify(d,null,2)}`);let s=t.filter(e=>!e.usp&&!e.purposes);if(s.length>0)throw new Error(`Received invalid inputs, expected either purposes or usp to be defined: ${JSON.stringify(s,null,2)}`);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Uploading ${t.length} user preferences to partition ${n}`));let S=new Date().getTime(),m=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),v=0;m.start(t.length,0),await _bluebird.map.call(void 0, t,async({userId:e,confirmed:g="true",updated:C,prompted:P,purposes:N,...i})=>{let O=A(e,c,p),[,_]=i.usp?x.exec(i.usp)||[]:[],j={token:O,partition:n,consent:{confirmed:g==="true",purposes:N?_typeutils.decodeCodec.call(void 0, I,N):i.usp?{SaleOfInfo:_==="Y"}:{},...C?{updated:C==="true"}:{},...P?{prompted:P==="true"}:{},...i}};try{await l.post("sync",{json:j}).json()}catch(y){try{let h=JSON.parse(_optionalChain([y, 'optionalAccess', _2 => _2.response, 'optionalAccess', _3 => _3.body])||"{}");h.error&&_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Error: ${h.error}`))}catch (e3){}throw new Error(`Received an error from server: ${_optionalChain([y, 'optionalAccess', _4 => _4.response, 'optionalAccess', _5 => _5.body])||_optionalChain([y, 'optionalAccess', _6 => _6.message])}`)}v+=1,m.update(v)},{concurrency:u}),m.stop();let R=new Date().getTime()-S;_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully uploaded ${t.length} user preferences to partition ${n} in "${R/1e3}" seconds!`))}exports.a = A; exports.b = x; exports.c = I; exports.d = q;
|
|
2
|
+
//# sourceMappingURL=chunk-ZPCV7RA2.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/cli/cli/dist/chunk-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/cli/cli/dist/chunk-ZPCV7RA2.cjs","../src/lib/consent-manager/createConsentToken.ts","../src/lib/consent-manager/uploadConsents.ts"],"names":["createConsentToken","userId","base64EncryptionKey","base64SigningKey","signingKey","encryptionKey","encryptionAlgorithm","iv","cipher","jwtPayload","USP_STRING_REGEX","PurposeMap","uploadConsents","preferences","partition","concurrency","transcendUrl","DEFAULT_TRANSCEND_CONSENT_API","transcendConsentApi","createTranscendConsentGotInstance","invalidUspStrings","pref"],"mappings":"AAAA,u/BAAyC,wDAAoC,wDAAyC,0ECA9F,4FACH,SAWLA,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACQ,CAER,IAAMC,CAAAA,CAAa,MAAA,CAAO,IAAA,CAAKD,CAAAA,CAAkB,QAAQ,CAAA,CACnDE,CAAAA,CAAgB,MAAA,CAAO,IAAA,CAAKH,CAAAA,CAAqB,QAAQ,CAAA,CAGzDI,CAAAA,CAAsB,oBAAA,CAEtBC,CAAAA,CAAK,MAAA,CAAO,IAAA,CAAK,UAAA,CAAY,KAAK,CAAA,CAElCC,CAAAA,CAAgB,CAAA,CAAA,cAAA,CAAeF,CAAAA,CAAqBD,CAAAA,CAAeE,CAAE,CAAA,CAYrEE,CAAAA,CAAa,CACjB,mBAAA,CAV0B,MAAA,CAAO,MAAA,CAAO,CACxCD,CAAAA,CAAO,MAAA,CAAOP,CAAM,CAAA,CACpBO,CAAAA,CAAO,KAAA,CAAM,CACf,CAAC,CAAA,CAAE,QAAA,CAAS,QAAQ,CAQpB,CAAA,CAOA,OAJyB,CAAA,CAAA,IAAA,CAAKC,CAAAA,CAAYL,CAAAA,CAAY,CACpD,SAAA,CAAW,OACb,CAAC,CAGH,CC/CA,gFAAmB,qEACA,oCAEC,qGAGI,qDACI,IAIfM,CAAAA,CAAmB,0BAAA,CAEnBC,CAAAA,aAAe,CAAA,CAAA,MAAA,CACxB,CAAA,CAAA,MAAA,CACA,CAAA,CAAA,KAAA,CAAM,CAAG,CAAA,CAAA,OAAA,CAAW,CAAA,CAAA,OAAA,CAAQ,MAAM,CAAC,CAAC,CACxC,CAAA,CAOA,MAAA,SAAsBC,CAAAA,CAAe,CACnC,mBAAA,CAAAV,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,WAAA,CAAAU,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CAAc,GAAA,CACd,YAAA,CAAAC,CAAAA,CAAeC,mBACjB,CAAA,CAakB,CAEhB,IAAMC,CAAAA,CAAsBC,kCAAAA,CAA8C,CAAA,CAGpEC,CAAAA,CAAoBP,CAAAA,CAAY,MAAA,CACnCQ,CAAAA,EAASA,CAAAA,CAAK,GAAA,EAAO,CAACX,CAAAA,CAAiB,IAAA,CAAKW,CAAAA,CAAK,GAAG,CACvD,CAAA,CACA,EAAA,CAAID,CAAAA,CAAkB,MAAA,CAAS,CAAA,CAC7B,MAAM,IAAI,KAAA,CACR,CAAA,8BAAA,EAAiC,IAAA,CAAK,SAAA,CACpCA,CAAAA,CACA,IAAA,CACA,CACF,CAAC,CAAA,CAAA","file":"/home/runner/work/cli/cli/dist/chunk-ZPCV7RA2.cjs","sourcesContent":[null,"import * as crypto from 'crypto';\nimport * as jwt from 'jsonwebtoken';\n\n/**\n * Function to create a consent manager token\n *\n * @see https://docs.transcend.io/docs/consent/reference/managed-consent-database\n * @param userId - User ID\n * @param base64EncryptionKey - Encryption key\n * @param base64SigningKey - Signing key\n * @returns Token\n */\nexport function createConsentToken(\n userId: string,\n base64EncryptionKey: string,\n base64SigningKey: string,\n): string {\n // Read on for where to find these keys\n const signingKey = Buffer.from(base64SigningKey, 'base64');\n const encryptionKey = Buffer.from(base64EncryptionKey, 'base64');\n\n // NIST's AES-KWP implementation { aes 48 } - see https://tools.ietf.org/html/rfc5649\n const encryptionAlgorithm = 'id-aes256-wrap-pad';\n // Initial Value for AES-KWP integrity check - see https://tools.ietf.org/html/rfc5649#section-3\n const iv = Buffer.from('A65959A6', 'hex');\n // Set up encryption algorithm\n const cipher = crypto.createCipheriv(encryptionAlgorithm, encryptionKey, iv);\n\n // Encrypt the userId and base64-encode the result\n const encryptedIdentifier = Buffer.concat([\n cipher.update(userId),\n cipher.final(),\n ]).toString('base64');\n\n // Create the JWT content - jwt.sign will add a 'iat' (issued at) field to the payload\n // If you wanted to add something manually, consider\n // const issued: Date = new Date();\n // const isoDate = issued.toISOString();\n const jwtPayload = {\n encryptedIdentifier,\n };\n\n // Create a JSON web token and HMAC it with SHA-384\n const consentToken = jwt.sign(jwtPayload, signingKey, {\n algorithm: 'HS384',\n });\n\n return consentToken;\n}\n","import { createTranscendConsentGotInstance } from '../graphql';\nimport colors from 'colors';\nimport * as t from 'io-ts';\nimport { DEFAULT_TRANSCEND_CONSENT_API } from '../../constants';\nimport { map } from 'bluebird';\nimport { createConsentToken } from './createConsentToken';\nimport { logger } from '../../logger';\nimport cliProgress from 'cli-progress';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport type { ConsentPreferenceUpload } from './types';\nimport { ConsentPreferencesBody } from '@transcend-io/airgap.js-types';\n\nexport const USP_STRING_REGEX = /^[0-9][Y|N]([Y|N])[Y|N]$/;\n\nexport const PurposeMap = t.record(\n t.string,\n t.union([t.boolean, t.literal('Auto')]),\n);\n\n/**\n * Upload a set of consent preferences\n *\n * @param options - Options\n */\nexport async function uploadConsents({\n base64EncryptionKey,\n base64SigningKey,\n preferences,\n partition,\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_CONSENT_API,\n}: {\n /** base64 encryption key */\n base64EncryptionKey: string;\n /** base64 signing key */\n base64SigningKey: string;\n /** Partition key */\n partition: string;\n /** Sombra API key authentication */\n preferences: ConsentPreferenceUpload[];\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** Concurrency limit for approving */\n concurrency?: number;\n}): Promise<void> {\n // Create connection to API\n const transcendConsentApi = createTranscendConsentGotInstance(transcendUrl);\n\n // Ensure usp strings are valid\n const invalidUspStrings = preferences.filter(\n (pref) => pref.usp && !USP_STRING_REGEX.test(pref.usp),\n );\n if (invalidUspStrings.length > 0) {\n throw new Error(\n `Received invalid usp strings: ${JSON.stringify(\n invalidUspStrings,\n null,\n 2,\n )}`,\n );\n }\n\n // Ensure purpose maps are valid\n const invalidPurposeMaps = preferences\n .map((pref, ind) => [pref, ind] as [ConsentPreferenceUpload, number])\n .filter(([pref]) => {\n if (!pref.purposes) {\n return false;\n }\n try {\n decodeCodec(PurposeMap, pref.purposes);\n return false;\n } catch {\n return true;\n }\n });\n if (invalidPurposeMaps.length > 0) {\n throw new Error(\n `Received invalid purpose maps: ${JSON.stringify(\n invalidPurposeMaps,\n null,\n 2,\n )}`,\n );\n }\n\n // Ensure usp or preferences are provided\n const invalidInputs = preferences.filter(\n (pref) => !pref.usp && !pref.purposes,\n );\n if (invalidInputs.length > 0) {\n throw new Error(\n `Received invalid inputs, expected either purposes or usp to be defined: ${JSON.stringify(\n invalidInputs,\n null,\n 2,\n )}`,\n );\n }\n\n logger.info(\n colors.magenta(\n `Uploading ${preferences.length} user preferences to partition ${partition}`,\n ),\n );\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n // Build a GraphQL client\n let total = 0;\n progressBar.start(preferences.length, 0);\n await map(\n preferences,\n async ({\n userId,\n confirmed = 'true',\n updated,\n prompted,\n purposes,\n ...consent\n }) => {\n const token = createConsentToken(\n userId,\n base64EncryptionKey,\n base64SigningKey,\n );\n\n // parse usp string\n const [, saleStatus] = consent.usp\n ? USP_STRING_REGEX.exec(consent.usp) || []\n : [];\n\n const input = {\n token,\n partition,\n consent: {\n confirmed: confirmed === 'true',\n purposes: purposes\n ? decodeCodec(PurposeMap, purposes)\n : consent.usp\n ? { SaleOfInfo: saleStatus === 'Y' }\n : {},\n ...(updated ? { updated: updated === 'true' } : {}),\n ...(prompted ? { prompted: prompted === 'true' } : {}),\n ...consent,\n },\n } as ConsentPreferencesBody;\n\n // Make the request\n try {\n await transcendConsentApi\n .post('sync', {\n json: input,\n })\n .json();\n } catch (err) {\n try {\n const parsed = JSON.parse(err?.response?.body || '{}');\n if (parsed.error) {\n logger.error(colors.red(`Error: ${parsed.error}`));\n }\n } catch (e) {\n // continue\n }\n throw new Error(\n `Received an error from server: ${\n err?.response?.body || err?.message\n }`,\n );\n }\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully uploaded ${\n preferences.length\n } user preferences to partition ${partition} in \"${\n totalTime / 1000\n }\" seconds!`,\n ),\n );\n}\n"]}
|
|
@@ -1,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 }; }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 }; }var _chunk4Y7PZGF3cjs = require('./chunk-4Y7PZGF3.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk56COHDFTcjs = require('./chunk-56COHDFT.cjs');require('./chunk-FHUHBSLE.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');require('./chunk-A3GRLGNU.cjs');require('./chunk-T3BBQIRY.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _iots = require('io-ts'); var t = _interopRequireWildcard(_iots);var c=t.type({"Request Id":t.string});async function q({auth:i,dataSiloId:m,file:o,transcendUrl:n}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Reading "${o}" from disk`));let d=_chunk56COHDFTcjs.sc.call(void 0, o,c);await _chunk4Y7PZGF3cjs.f.call(void 0, {requestIds:d.map(l=>l["Request Id"]),transcendUrl:n,auth:i,dataSiloId:m})}exports.markRequestDataSilosCompleted = q;
|
|
2
|
+
//# sourceMappingURL=impl-5IZGOLMG.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-5IZGOLMG.cjs","../src/commands/request/system/mark-request-data-silos-completed/impl.ts"],"names":["RequestIdRow","markRequestDataSilosCompleted","auth","dataSiloId","file","transcendUrl","doneInputValidation","logger","colors","activeResults","readCsv","markRequestDataSiloIdsCompleted","request"],"mappings":"AAAA,mfAAwC,wDAAyC,wDAA0C,gCAA6B,wDAAyC,gCAA6B,gCAA6B,gFCCxO,qEACA,IAObA,CAAAA,CAAiB,CAAA,CAAA,IAAA,CAAK,CAC1B,YAAA,CAAgB,CAAA,CAAA,MAClB,CAAC,CAAA,CASD,MAAA,SAAsBC,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErCC,mBAAAA,CAAO,IAAA,CAAKC,gBAAAA,CAAO,OAAA,CAAQ,CAAA,SAAA,EAAYJ,CAAI,CAAA,WAAA,CAAa,CAAC,CAAA,CACzD,IAAMK,CAAAA,CAAgBC,kCAAAA,CAAQN,CAAMJ,CAAY,CAAA,CAEhD,MAAMW,iCAAAA,CACJ,UAAA,CAAYF,CAAAA,CAAc,GAAA,CAAKG,CAAAA,EAAYA,CAAAA,CAAQ,YAAY,CAAC,CAAA,CAChE,YAAA,CAAAP,CAAAA,CACA,IAAA,CAAAH,CAAAA,CACA,UAAA,CAAAC,CACF,CAAC,CACH,CAAA,0CAAA","file":"/home/runner/work/cli/cli/dist/impl-5IZGOLMG.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../../context';\nimport colors from 'colors';\nimport * as t from 'io-ts';\n\nimport { logger } from '../../../../logger';\nimport { markRequestDataSiloIdsCompleted } from '../../../../lib/cron';\nimport { readCsv } from '../../../../lib/requests';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nconst RequestIdRow = t.type({\n 'Request Id': t.string,\n});\n\nexport interface MarkRequestDataSilosCompletedCommandFlags {\n auth: string;\n dataSiloId: string;\n file: string;\n transcendUrl: string;\n}\n\nexport async function markRequestDataSilosCompleted(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n file,\n transcendUrl,\n }: MarkRequestDataSilosCompletedCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const activeResults = readCsv(file, RequestIdRow);\n\n await markRequestDataSiloIdsCompleted({\n requestIds: activeResults.map((request) => request['Request Id']),\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk56COHDFTcjs = require('./chunk-56COHDFT.cjs');require('./chunk-FHUHBSLE.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-A3GRLGNU.cjs');require('./chunk-T3BBQIRY.cjs');async function d({auth:r,transcendUrl:n,actions:o,statuses:s,requestIds:a,createdAtBefore:i,createdAtAfter:c,concurrency:m}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),await _chunk56COHDFTcjs.pf.call(void 0, {transcendUrl:n,requestActions:o,auth:r,requestIds:a,statuses:s,concurrency:m,createdAtBefore:i,createdAtAfter:c})}exports.markSilent = d;
|
|
2
|
+
//# sourceMappingURL=impl-5KE7PF4S.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-5KE7PF4S.cjs","../src/commands/request/mark-silent/impl.ts"],"names":["markSilent","auth","transcendUrl","actions","statuses","requestIds","createdAtBefore","createdAtAfter","concurrency","doneInputValidation","markSilentPrivacyRequests"],"mappings":"AAAA,iIAAwC,wDAA0C,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCgBtM,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,MAAMC,kCAAAA,CACJ,YAAA,CAAAR,CAAAA,CACA,cAAA,CAAgBC,CAAAA,CAChB,IAAA,CAAAF,CAAAA,CACA,UAAA,CAAAI,CAAAA,CACA,QAAA,CAAAD,CAAAA,CACA,WAAA,CAAAI,CAAAA,CACA,eAAA,CAAAF,CAAAA,CACA,cAAA,CAAAC,CACF,CAAC,CACH,CAAA,uBAAA","file":"/home/runner/work/cli/cli/dist/impl-5KE7PF4S.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { markSilentPrivacyRequests } from '../../../lib/requests';\nimport type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface MarkSilentCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses?: RequestStatus[];\n requestIds?: string[];\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function markSilent(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n actions,\n statuses,\n requestIds,\n createdAtBefore,\n createdAtAfter,\n concurrency,\n }: MarkSilentCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await markSilentPrivacyRequests({\n transcendUrl,\n requestActions: actions,\n auth,\n requestIds,\n statuses,\n concurrency,\n createdAtBefore,\n createdAtAfter,\n });\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk56COHDFTcjs = require('./chunk-56COHDFT.cjs');require('./chunk-FHUHBSLE.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-A3GRLGNU.cjs');require('./chunk-T3BBQIRY.cjs');async function c({auth:i,transcendUrl:n,identifierNames:r,actions:o=[]}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),await _chunk56COHDFTcjs.Sf.call(void 0, {requestActions:o,transcendUrl:n,auth:i,identifierNames:r})}exports.rejectUnverifiedIdentifiers = c;
|
|
2
|
+
//# sourceMappingURL=impl-63RUFEPF.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-63RUFEPF.cjs","../src/commands/request/reject-unverified-identifiers/impl.ts"],"names":["rejectUnverifiedIdentifiers","auth","transcendUrl","identifierNames","actions","doneInputValidation","removeUnverifiedRequestIdentifiers"],"mappings":"AAAA,iIAAwC,wDAA0C,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCYtM,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CAAU,CAAC,CACb,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,MAAMC,kCAAAA,CACJ,cAAA,CAAgBF,CAAAA,CAChB,YAAA,CAAAF,CAAAA,CACA,IAAA,CAAAD,CAAAA,CACA,eAAA,CAAAE,CACF,CAAC,CACH,CAAA,wCAAA","file":"/home/runner/work/cli/cli/dist/impl-63RUFEPF.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { removeUnverifiedRequestIdentifiers } from '../../../lib/requests';\nimport type { RequestAction } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface RejectUnverifiedIdentifiersCommandFlags {\n auth: string;\n identifierNames: string[];\n actions?: RequestAction[];\n transcendUrl: string;\n}\n\nexport async function rejectUnverifiedIdentifiers(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n identifierNames,\n actions = [],\n }: RejectUnverifiedIdentifiersCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await removeUnverifiedRequestIdentifiers({\n requestActions: actions,\n transcendUrl,\n auth,\n identifierNames,\n });\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _chunkJ5ZSDYK2cjs = require('./chunk-J5ZSDYK2.cjs');require('./chunk-5IHV6OHB.cjs');require('./chunk-LU3DKRNK.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk56COHDFTcjs = require('./chunk-56COHDFT.cjs');require('./chunk-FHUHBSLE.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkA3GRLGNUcjs = require('./chunk-A3GRLGNU.cjs');require('./chunk-T3BBQIRY.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _child_process = require('child_process');var d='A repository name must be provided. You can specify using --repositoryName=$REPO_NAME or by ensuring the command "git config --get remote.origin.url" returns the name of the repository';async function A({auth:f,scanPath:r,ignoreDirs:u,repositoryName:h,transcendUrl:y}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);let e=h;if(!e)try{let o=_child_process.execSync.call(void 0, `cd ${r} && git config --get remote.origin.url`).toString("utf-8").trim();[e]=o.includes("https:")?o.split("/").slice(3).join("/").split("."):(o.split(":").pop()||"").split("."),e||(_chunkZUNVPK23cjs.a.error(_colors2.default.red(d)),this.process.exit(1))}catch(a){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`${d} - Got error: ${a.message}`)),this.process.exit(1)}let x=_chunk56COHDFTcjs.xc.call(void 0, y,f),n=await _chunkJ5ZSDYK2cjs.b.call(void 0, {scanPath:r,ignoreDirs:u,repositoryName:e});await _chunk56COHDFTcjs.Oe.call(void 0, x,n);let s=new URL(_chunkA3GRLGNUcjs.o);s.pathname="/code-scanning/code-packages",_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Scan found ${n.length} packages at ${r}! View results at '${s.href}'`))}exports.scanPackages = A;
|
|
2
|
+
//# sourceMappingURL=impl-CYS34PCP.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-CYS34PCP.cjs","../src/commands/inventory/scan-packages/impl.ts"],"names":["REPO_ERROR","scanPackages","auth","scanPath","ignoreDirs","repositoryName","transcendUrl","doneInputValidation","gitRepositoryName","url","execSync","logger","colors","err"],"mappings":"AAAA,iOAAwC,gCAA6B,gCAA6B,wDAAyC,wDAAkD,gCAA6B,wDAAyC,wDAAyC,gCAA6B,gFCEtT,8CAOM,IAGnBA,CAAAA,CACJ,0LAAA,CAYF,MAAA,SAAsBC,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAGrC,IAAIC,CAAAA,CAAoBH,CAAAA,CACxB,EAAA,CAAI,CAACG,CAAAA,CACH,GAAI,CAKF,IAAMC,CAAAA,CAJOC,qCAAAA,CACX,GAAA,EAAMP,CAAQ,CAAA,sCAAA,CAChB,CAAA,CAEiB,QAAA,CAAS,OAAO,CAAA,CAAE,IAAA,CAAK,CAAA,CACxC,CAACK,CAAiB,CAAA,CAAKC,CAAAA,CAAI,QAAA,CAAS,QAAQ,CAAA,CAExCA,CAAAA,CAAI,KAAA,CAAM,GAAG,CAAA,CAAE,KAAA,CAAM,CAAC,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA,CAAE,KAAA,CAAM,GAAG,CAAA,CAAA,CAD1CA,CAAAA,CAAI,KAAA,CAAM,GAAG,CAAA,CAAE,GAAA,CAAI,CAAA,EAAK,EAAA,CAAA,CAAI,KAAA,CAAM,GAAG,CAAA,CAErCD,CAAAA,EAAAA,CACHG,mBAAAA,CAAO,KAAA,CAAMC,gBAAAA,CAAO,GAAA,CAAIZ,CAAU,CAAC,CAAA,CACnC,IAAA,CAAK,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,CAEvB,CAAA,KAAA,CAASa,CAAAA,CAAK,CACZF,mBAAAA,CAAO,KAAA,CAAMC,gBAAAA,CAAO,GAAA,CAAI,CAAA,EAAA","file":"/home/runner/work/cli/cli/dist/impl-CYS34PCP.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { logger } from '../../../logger';\nimport colors from 'colors';\nimport { ADMIN_DASH } from '../../../constants';\nimport { findCodePackagesInFolder } from '../../../lib/code-scanning';\nimport {\n buildTranscendGraphQLClient,\n syncCodePackages,\n} from '../../../lib/graphql';\nimport { execSync } from 'child_process';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nconst REPO_ERROR =\n 'A repository name must be provided. ' +\n 'You can specify using --repositoryName=$REPO_NAME or by ensuring the ' +\n 'command \"git config --get remote.origin.url\" returns the name of the repository';\n\nexport interface ScanPackagesCommandFlags {\n auth: string;\n scanPath: string;\n ignoreDirs?: string[];\n repositoryName?: string;\n transcendUrl: string;\n}\n\nexport async function scanPackages(\n this: LocalContext,\n {\n auth,\n scanPath,\n ignoreDirs,\n repositoryName,\n transcendUrl,\n }: ScanPackagesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Ensure repository name is specified\n let gitRepositoryName = repositoryName;\n if (!gitRepositoryName) {\n try {\n const name = execSync(\n `cd ${scanPath} && git config --get remote.origin.url`,\n );\n // Trim and parse the URL\n const url = name.toString('utf-8').trim();\n [gitRepositoryName] = !url.includes('https:')\n ? (url.split(':').pop() || '').split('.')\n : url.split('/').slice(3).join('/').split('.');\n if (!gitRepositoryName) {\n logger.error(colors.red(REPO_ERROR));\n this.process.exit(1);\n }\n } catch (err) {\n logger.error(colors.red(`${REPO_ERROR} - Got error: ${err.message}`));\n this.process.exit(1);\n }\n }\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Scan the codebase to discovery packages\n const results = await findCodePackagesInFolder({\n scanPath,\n ignoreDirs,\n repositoryName: gitRepositoryName,\n });\n\n // Report scan to Transcend\n await syncCodePackages(client, results);\n\n const newUrl = new URL(ADMIN_DASH);\n newUrl.pathname = '/code-scanning/code-packages';\n\n // Indicate success\n logger.info(\n colors.green(\n `Scan found ${results.length} packages at ${scanPath}! ` +\n `View results at '${newUrl.href}'`,\n ),\n );\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk56COHDFTcjs = require('./chunk-56COHDFT.cjs');require('./chunk-FHUHBSLE.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-A3GRLGNU.cjs');require('./chunk-T3BBQIRY.cjs');async function p({auth:r,actions:s,statuses:i=[],requestIds:c,silentModeBefore:e,createdAtBefore:t,createdAtAfter:n,cancellationTitle:u,transcendUrl:d,concurrency:l}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),await _chunk56COHDFTcjs.Hf.call(void 0, {transcendUrl:d,requestActions:s,auth:r,cancellationTitle:u,requestIds:c,statuses:i,concurrency:l,silentModeBefore:e?new Date(e):void 0,createdAtBefore:t?new Date(t):void 0,createdAtAfter:n?new Date(n):void 0})}exports.cancel = p;
|
|
2
|
+
//# sourceMappingURL=impl-DFC7R4VO.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-DFC7R4VO.cjs","../src/commands/request/cancel/impl.ts"],"names":["cancel","auth","actions","statuses","requestIds","silentModeBefore","createdAtBefore","createdAtAfter","cancellationTitle","transcendUrl","concurrency","doneInputValidation","cancelPrivacyRequests"],"mappings":"AAAA,iIAAwC,wDAA0C,gCAA6B,gCAA6B,gCAA6B,gCAA6B,MCkBtM,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CAAW,CAAC,CAAA,CACZ,UAAA,CAAAC,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,iBAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,MAAMC,kCAAAA,CACJ,YAAA,CAAAH,CAAAA,CACA,cAAA,CAAgBP,CAAAA,CAChB,IAAA,CAAAD,CAAAA,CACA,iBAAA,CAAAO,CAAAA,CACA,UAAA,CAAAJ,CAAAA,CACA,QAAA,CAAAD,CAAAA,CACA,WAAA,CAAAO,CAAAA,CACA,gBAAA,CAAkBL,CAAAA,CAAmB,IAAI,IAAA,CAAKA,CAAgB,CAAA,CAAI,KAAA,CAAA,CAClE,eAAA,CAAiBC,CAAAA,CAAkB,IAAI,IAAA,CAAKA,CAAe,CAAA,CAAI,KAAA,CAAA,CAC/D,cAAA,CAAgBC,CAAAA,CAAiB,IAAI,IAAA,CAAKA,CAAc,CAAA,CAAI,KAAA,CAC9D,CAAC,CACH,CAAA,mBAAA","file":"/home/runner/work/cli/cli/dist/impl-DFC7R4VO.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { cancelPrivacyRequests } from '../../../lib/requests';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface CancelCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses?: RequestStatus[];\n requestIds?: string[];\n silentModeBefore?: Date;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n cancellationTitle: string;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function cancel(\n this: LocalContext,\n {\n auth,\n actions,\n statuses = [],\n requestIds,\n silentModeBefore,\n createdAtBefore,\n createdAtAfter,\n cancellationTitle,\n transcendUrl,\n concurrency,\n }: CancelCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await cancelPrivacyRequests({\n transcendUrl,\n requestActions: actions,\n auth,\n cancellationTitle,\n requestIds,\n statuses,\n concurrency,\n silentModeBefore: silentModeBefore ? new Date(silentModeBefore) : undefined,\n createdAtBefore: createdAtBefore ? new Date(createdAtBefore) : undefined,\n createdAtAfter: createdAtAfter ? new Date(createdAtAfter) : undefined,\n });\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk56COHDFTcjs = require('./chunk-56COHDFT.cjs');require('./chunk-FHUHBSLE.cjs');require('./chunk-ZUNVPK23.cjs');require('./chunk-A3GRLGNU.cjs');require('./chunk-T3BBQIRY.cjs');var _privacytypes = require('@transcend-io/privacy-types');async function g({auth:r,transcendUrl:a,folderPath:n,requestIds:s,statuses:i=[_privacytypes.RequestStatus.Approving,_privacytypes.RequestStatus.Downloadable],concurrency:l,createdAtBefore:d,createdAtAfter:m,approveAfterDownload:c}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),await _chunk56COHDFTcjs.Bf.call(void 0, {transcendUrl:a,auth:r,folderPath:n,requestIds:s,statuses:i,concurrency:l,createdAtBefore:d,createdAtAfter:m,approveAfterDownload:c})}exports.downloadFiles = g;
|
|
2
|
+
//# sourceMappingURL=impl-DLADC4DX.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-DLADC4DX.cjs","../src/commands/request/download-files/impl.ts"],"names":["downloadFiles","auth","transcendUrl","folderPath","requestIds","statuses","RequestStatus","concurrency","createdAtBefore","createdAtAfter","approveAfterDownload","doneInputValidation","downloadPrivacyRequestFiles"],"mappings":"AAAA,iIAAwC,wDAA0C,gCAA6B,gCAA6B,gCAA6B,gCAA6B,2DCExK,MAgB9B,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CAAW,CAACC,2BAAAA,CAAc,SAAA,CAAWA,2BAAAA,CAAc,YAAY,CAAA,CAC/D,WAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,oBAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,MAAMC,kCAAAA,CACJ,YAAA,CAAAV,CAAAA,CACA,IAAA,CAAAD,CAAAA,CACA,UAAA,CAAAE,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,WAAA,CAAAE,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,oBAAA,CAAAC,CACF,CAAC,CACH,CAAA,0BAAA","file":"/home/runner/work/cli/cli/dist/impl-DLADC4DX.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport { downloadPrivacyRequestFiles } from '../../../lib/requests';\nimport { RequestStatus } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface DownloadFilesCommandFlags {\n auth: string;\n sombraAuth?: string;\n concurrency: number;\n requestIds?: string[];\n statuses?: RequestStatus[];\n folderPath: string;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n approveAfterDownload: boolean;\n transcendUrl: string;\n}\n\nexport async function downloadFiles(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n folderPath,\n requestIds,\n statuses = [RequestStatus.Approving, RequestStatus.Downloadable],\n concurrency,\n createdAtBefore,\n createdAtAfter,\n approveAfterDownload,\n }: DownloadFilesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await downloadPrivacyRequestFiles({\n transcendUrl,\n auth,\n folderPath,\n requestIds,\n statuses,\n concurrency,\n createdAtBefore,\n createdAtAfter,\n approveAfterDownload,\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 _chunkXSKGXUIGcjs = require('./chunk-XSKGXUIG.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk56COHDFTcjs = require('./chunk-56COHDFT.cjs');require('./chunk-FHUHBSLE.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');require('./chunk-A3GRLGNU.cjs');require('./chunk-T3BBQIRY.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 _chunk56COHDFTcjs.yc.call(void 0, l,f,V),y=_chunk56COHDFTcjs.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([_chunk56COHDFTcjs.hd.call(void 0, y),_chunk56COHDFTcjs.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(_chunkXSKGXUIGcjs.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)),_chunk56COHDFTcjs.og.call(void 0, r,a),I=!0}_chunk56COHDFTcjs.pg.call(void 0, r,t,a)};if(C){await _chunkXSKGXUIGcjs.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 _chunkXSKGXUIGcjs.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-EA6F65XG.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-EA6F65XG.cjs","../src/commands/consent/pull-consent-preferences/impl.ts"],"names":["CORE_COLS","pullConsentPreferences","auth","partition","sombraAuth","file","transcendUrl","timestampBefore","timestampAfter","updatedBefore","updatedAfter","identifiers","concurrency","shouldChunk","windowConcurrency","maxChunks","maxLookbackDays","doneInputValidation","sombra","createSombraGotInstance","client","buildTranscendGraphQLClient","parsedIdentifiers","identifier","name","value","filterBy","logger","colors"],"mappings":"AAAA,y0BAAsD,wDAAyC,wDAAkF,gCAA6B,wDAAyC,gCAA6B,gCAA6B,gFCC9R,IAqBbA,CAAAA,CAAY,CAChB,QAAA,CACA,WAAA,CACA,WAAA,CACA,kBAAA,CACA,WAAA,CACA,KAAA,CACA,KAAA,CACA,KAAA,CACA,eAAA,CACA,UAAA,CACA,mBACF,CAAA,CAoBA,MAAA,SAAsBC,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CAAc,CAAC,CAAA,CACf,WAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,iBAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAGrC,IAAMC,CAAAA,CAAS,MAAMC,kCAAAA,CAAwBb,CAAcJ,CAAAA,CAAME,CAAU,CAAA,CACrEgB,CAAAA,CAASC,kCAAAA,CAA4Bf,CAAcJ,CAAI,CAAA,CAGvDoB,CAAAA,CAAoBX,CAAAA,CAAY,GAAA,CACnCY,CAAAA,EAAqC,CACpC,EAAA,CAAI,CAACA,CAAAA,CAAW,QAAA,CAAS,GAAG,CAAA,CAC1B,MAAO,CACL,IAAA,CAAM,OAAA,CACN,KAAA,CAAOA,CACT,CAAA,CAEF,GAAM,CAACC,CAAAA,CAAMC,CAAK,CAAA,CAAIF,CAAAA,CAAW,KAAA,CAAM,GAAG,CAAA,CAC1C,MAAO,CAAE,IAAA,CAAAC,CAAAA,CAAM,KAAA,CAAAC,CAAM,CACvB,CACF,CAAA,CAGMC,CAAAA,CAAW,CACf,GAAInB,CAAAA,CACA,CAAE,eAAA,CAAiBA,CAAAA,CAAgB,WAAA,CAAY,CAAE,CAAA,CACjD,CAAC,CAAA,CACL,GAAIC,CAAAA,CAAiB,CAAE,cAAA,CAAgBA,CAAAA,CAAe,WAAA,CAAY,CAAE,CAAA,CAAI,CAAC,CAAA,CACzE,GAAIE,CAAAA,EAAgBD,CAAAA,CAChB,CACE,MAAA,CAAQ,CACN,GAAIA,CAAAA,CACA,CAAE,aAAA,CAAeA,CAAAA,CAAc,WAAA,CAAY,CAAE,CAAA,CAC7C,CAAC,CAAA,CACL,GAAIC,CAAAA,CACA,CAAE,YAAA,CAAcA,CAAAA,CAAa,WAAA,CAAY,CAAE,CAAA,CAC3C,CAAC,CACP,CACF,CAAA,CACA,CAAC,CAAA,CACL,GAAIY,CAAAA,CAAkB,MAAA,CAAS,CAAA,CAAI,CAAE,WAAA,CAAaA,CAAkB,CAAA,CAAI,CAAC,CAC3E,CAAA,CAEAK,mBAAAA,CAAO,IAAA,CACL,CAAA,4CAAA,EAA+CxB,CAAS,CAAA,aAAA,EACtDU,CAAAA,CAAc,gBAAA,CAAmB,cACnC,CAAA,GAAA,CACF,CAAA,CAEAc,mBAAAA,CAAO,IAAA,CAAKC,gBAAAA,CAAO,OAAA,CAAQ,CAAA,kBAAA,EAAqBvB,CAAI,CAAA,CAAA","file":"/home/runner/work/cli/cli/dist/impl-EA6F65XG.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport colors from 'colors';\n\nimport {\n fetchConsentPreferences,\n fetchConsentPreferencesChunked,\n transformPreferenceRecordToCsv,\n type PreferenceIdentifier,\n} from '../../../lib/preference-management';\nimport {\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n fetchAllIdentifiers,\n fetchAllPurposesAndPreferences,\n} from '../../../lib/graphql';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\nimport { logger } from '../../../logger';\nimport { initCsvFile, appendCsvRowsOrdered } from '../../../lib/helpers';\nimport type { PreferenceQueryResponseItem } from '@transcend-io/privacy-types';\n\n// Known “core” columns your transformer usually produces up front.\n// Leave this list conservative; we’ll still union with transformer keys.\nconst CORE_COLS = [\n 'userId',\n 'timestamp',\n 'partition',\n 'decryptionStatus',\n 'updatedAt',\n 'usp',\n 'gpp',\n 'tcf',\n 'airgapVersion',\n 'metadata',\n 'metadataTimestamp',\n];\n\nexport interface PullConsentPreferencesCommandFlags {\n auth: string;\n partition: string;\n sombraAuth?: string;\n file: string;\n transcendUrl: string;\n timestampBefore?: Date;\n timestampAfter?: Date;\n updatedBefore?: Date;\n updatedAfter?: Date;\n identifiers?: string[];\n concurrency: number;\n shouldChunk: boolean;\n windowConcurrency: number;\n maxChunks: number;\n maxLookbackDays: number;\n}\n\nexport async function pullConsentPreferences(\n this: LocalContext,\n {\n auth,\n partition,\n sombraAuth,\n file,\n transcendUrl,\n timestampBefore,\n timestampAfter,\n updatedBefore,\n updatedAfter,\n identifiers = [],\n concurrency,\n shouldChunk,\n windowConcurrency,\n maxChunks,\n maxLookbackDays,\n }: PullConsentPreferencesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, sombraAuth);\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Identifiers are key:value, parse to PreferenceIdentifier[]\n const parsedIdentifiers = identifiers.map(\n (identifier): PreferenceIdentifier => {\n if (!identifier.includes(':')) {\n return {\n name: 'email',\n value: identifier,\n };\n }\n const [name, value] = identifier.split(':');\n return { name, value };\n },\n );\n\n // Build filter\n const filterBy = {\n ...(timestampBefore\n ? { timestampBefore: timestampBefore.toISOString() }\n : {}),\n ...(timestampAfter ? { timestampAfter: timestampAfter.toISOString() } : {}),\n ...(updatedAfter || updatedBefore\n ? {\n system: {\n ...(updatedBefore\n ? { updatedBefore: updatedBefore.toISOString() }\n : {}),\n ...(updatedAfter\n ? { updatedAfter: updatedAfter.toISOString() }\n : {}),\n },\n }\n : {}),\n ...(parsedIdentifiers.length > 0 ? { identifiers: parsedIdentifiers } : {}),\n };\n\n logger.info(\n `Fetching consent preferences from partition ${partition}, using mode=${\n shouldChunk ? 'chunked-stream' : 'paged-stream'\n }...`,\n );\n\n logger.info(colors.magenta(`Preparing CSV at: ${file}`));\n\n // Fetch full sets (purposes+topics, identifiers) to ensure header completeness\n const [purposesWithTopics, allIdentifiers] = await Promise.all([\n fetchAllPurposesAndPreferences(client),\n fetchAllIdentifiers(client),\n ]);\n\n // Identifier columns: exactly the identifier names\n const identifierCols = allIdentifiers.map((i) => i.name);\n\n // Preference topic columns: topic names (de-duped)\n const topicCols = Array.from(\n new Set(\n purposesWithTopics.flatMap(\n (p) => p.topics?.map((t) => `${p.trackingType}_${t.slug}`) ?? [],\n ),\n ),\n ).sort((a, b) => a.localeCompare(b));\n\n // Some setups also want a per-purpose boolean column (e.g., “Email”, “Sms”).\n // If your transformer includes those, list them here, derived from purposes:\n const purposeCols = Array.from(\n new Set(purposesWithTopics.map((p) => p.trackingType)),\n ).sort((a, b) => a.localeCompare(b));\n\n // Build the complete header skeleton.\n // We’ll still union with the first transformed row’s keys to be safe.\n const completeHeadersList = [\n ...CORE_COLS,\n ...identifierCols,\n ...purposeCols,\n ...topicCols,\n ];\n\n // Lazily initialize CSV header order from the first transformed row.\n let headerOrder: string[] | null = null;\n let wroteHeader = false;\n const writeRows = (items: PreferenceQueryResponseItem[]): void => {\n if (!items || items.length === 0) return;\n const rows = items.map(transformPreferenceRecordToCsv);\n if (!wroteHeader) {\n const firstKeys = Object.keys(rows[0] ?? {});\n const seen = new Set<string>();\n headerOrder = [...completeHeadersList, ...firstKeys].filter((k) => {\n if (k === undefined) return false;\n if (seen.has(k)) return false;\n seen.add(k);\n return true;\n });\n initCsvFile(file, headerOrder);\n wroteHeader = true;\n }\n appendCsvRowsOrdered(file, rows, headerOrder!);\n };\n\n if (shouldChunk) {\n // Stream via chunked fetcher with page callback\n await fetchConsentPreferencesChunked(sombra, {\n partition,\n filterBy,\n limit: concurrency,\n windowConcurrency,\n maxChunks,\n maxLookbackDays,\n onItems: (items) => writeRows(items),\n });\n\n logger.info(colors.green(`Finished writing CSV to ${file}`));\n return;\n }\n\n // Non-chunked path: still stream page-by-page via onItems (no in-memory accumulation)\n await fetchConsentPreferences(sombra, {\n partition,\n filterBy,\n limit: concurrency, // page size (API max 50 enforced internally)\n onItems: (items) => writeRows(items),\n });\n\n logger.info(colors.green(`Finished writing CSV to ${file}`));\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 _chunk4WBBQCOVcjs = require('./chunk-4WBBQCOV.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');var _chunk56COHDFTcjs = require('./chunk-56COHDFT.cjs');require('./chunk-FHUHBSLE.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkA3GRLGNUcjs = require('./chunk-A3GRLGNU.cjs');require('./chunk-T3BBQIRY.cjs');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);async function j({auth:p,file:o,transcendUrl:f,dataSiloIds:g,subCategories:C,status:S,includeEncryptedSnippets:a}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit);try{let i=_chunk56COHDFTcjs.xc.call(void 0, f,p),b=await _chunk4WBBQCOVcjs.b.call(void 0, i,{dataSiloIds:g,subCategories:C,status:S,includeEncryptedSnippets:a});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Writing unstructured discovery files to file "${o}"...`));let s=[],h=b.map(t=>{let n={"Entry ID":t.id,"Data Silo ID":t.dataSiloId,"Object Path ID":t.scannedObjectPathId,"Object ID":t.scannedObjectId,...a?{Entry:t.name,"Context Snippet":t.contextSnippet}:{},"Data Category":`${t.dataSubCategory.category}:${t.dataSubCategory.name}`,"Classification Status":t.status,"Confidence Score":t.confidence,"Classification Method":t.classificationMethod,"Classifier Version":t.classifierVersion};return s=_chunkA3GRLGNUcjs.j.call(void 0, [...s,...Object.keys(n)]),n});await _chunk56COHDFTcjs.tg.call(void 0, o,h,s)}catch(i){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`An error occurred syncing the unstructured discovery files: ${i.message}`)),this.process.exit(1)}_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced unstructured discovery files to disk at ${o}!`))}exports.pullUnstructuredDiscoveryFiles = j;
|
|
2
|
+
//# sourceMappingURL=impl-ECHPUQTL.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-ECHPUQTL.cjs","../src/commands/inventory/pull-unstructured-discovery-files/impl.ts"],"names":["pullUnstructuredDiscoveryFiles","auth","file","transcendUrl","dataSiloIds","subCategories","status","includeEncryptedSnippets","doneInputValidation","client","buildTranscendGraphQLClient","entries","pullUnstructuredSubDataPointRecommendations","logger","colors","headers","inputs","entry","result"],"mappings":"AAAA,iOAAwC,wDAAyC,wDAAkD,gCAA6B,wDAAyC,wDAAyC,gCAA6B,gFCE5P,MAkBnB,SAAsBA,CAAAA,CAEpB,CACE,IAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,wBAAA,CAAAC,CACF,CAAA,CACe,CACfC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAErC,GAAI,CAEF,IAAMC,CAAAA,CAASC,kCAAAA,CAA4BP,CAAcF,CAAI,CAAA,CAEvDU,CAAAA,CAAU,MAAMC,iCAAAA,CAA4CH,CAAQ,CACxE,WAAA,CAAAL,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,wBAAA,CAAAC,CACF,CAAC,CAAA,CAEDM,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,OAAA,CACL,CAAA,8CAAA,EAAiDZ,CAAI,CAAA,IAAA,CACvD,CACF,CAAA,CACA,IAAIa,CAAAA,CAAoB,CAAC,CAAA,CACnBC,CAAAA,CAASL,CAAAA,CAAQ,GAAA,CAAKM,CAAAA,EAAU,CACpC,IAAMC,CAAAA,CAAS,CACb,UAAA,CAAYD,CAAAA,CAAM,EAAA,CAClB,cAAA,CAAgBA,CAAAA,CAAM,UAAA,CACtB,gBAAA,CAAkBA,CAAAA,CAAM,mBAAA,CACxB,WAAA,CAAaA,CAAAA,CAAM,eAAA,CACnB,GAAIV,CAAAA,CACA,CAAE,KAAA,CAAOU,CAAAA,CAAM,IAAA,CAAM,iBAAA,CAAmBA,CAAAA,CAAM,cAAe,CAAA,CAC7D,CAAC,CAAA,CACL,eAAA,CAAiB,CAAA,EAAA","file":"/home/runner/work/cli/cli/dist/impl-ECHPUQTL.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport type { UnstructuredSubDataPointRecommendationStatus } from '@transcend-io/privacy-types';\nimport colors from 'colors';\nimport { uniq } from 'lodash-es';\nimport { pullUnstructuredSubDataPointRecommendations } from '../../../lib/data-inventory';\nimport { buildTranscendGraphQLClient } from '../../../lib/graphql';\nimport { logger } from '../../../logger';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\nimport { writeLargeCsv } from '../../../lib/helpers';\n\nexport interface PullUnstructuredDiscoveryFilesCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n subCategories?: string[];\n status?: UnstructuredSubDataPointRecommendationStatus[];\n includeEncryptedSnippets: boolean;\n}\n\nexport async function pullUnstructuredDiscoveryFiles(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n dataSiloIds,\n subCategories,\n status,\n includeEncryptedSnippets,\n }: PullUnstructuredDiscoveryFilesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const entries = await pullUnstructuredSubDataPointRecommendations(client, {\n dataSiloIds,\n subCategories, // TODO: https://transcend.height.app/T-40482 - do by name not ID\n status,\n includeEncryptedSnippets,\n });\n\n logger.info(\n colors.magenta(\n `Writing unstructured discovery files to file \"${file}\"...`,\n ),\n );\n let headers: string[] = [];\n const inputs = entries.map((entry) => {\n const result = {\n 'Entry ID': entry.id,\n 'Data Silo ID': entry.dataSiloId,\n 'Object Path ID': entry.scannedObjectPathId,\n 'Object ID': entry.scannedObjectId,\n ...(includeEncryptedSnippets\n ? { Entry: entry.name, 'Context Snippet': entry.contextSnippet }\n : {}),\n 'Data Category': `${entry.dataSubCategory.category}:${entry.dataSubCategory.name}`,\n 'Classification Status': entry.status,\n 'Confidence Score': entry.confidence,\n 'Classification Method': entry.classificationMethod,\n 'Classifier Version': entry.classifierVersion,\n };\n headers = uniq([...headers, ...Object.keys(result)]);\n return result;\n });\n await writeLargeCsv(file, inputs, headers);\n } catch (err) {\n logger.error(\n colors.red(\n `An error occurred syncing the unstructured discovery files: ${err.message}`,\n ),\n );\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced unstructured discovery files to disk at ${file}!`,\n ),\n );\n}\n"]}
|
|
@@ -1,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 }; }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 }; }var _chunkBQSBPO63cjs = require('./chunk-BQSBPO63.cjs');var _chunkLU3DKRNKcjs = require('./chunk-LU3DKRNK.cjs');var _chunkWKCTKYN4cjs = require('./chunk-WKCTKYN4.cjs');require('./chunk-FHUHBSLE.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');require('./chunk-T3BBQIRY.cjs');var _iots = require('io-ts'); var f = _interopRequireWildcard(_iots);var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _fs = require('fs');var _typeutils = require('@transcend-io/type-utils');var _privacytypes = require('@transcend-io/privacy-types');function T({file:t,output:n}){_chunkWKCTKYN4cjs.a.call(void 0, this.process.exit),_fs.existsSync.call(void 0, t)||(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`File does not exist: --file="${t}"`)),this.process.exit(1));let u=_typeutils.decodeCodec.call(void 0, f.array(_chunkLU3DKRNKcjs.la),_fs.readFileSync.call(void 0, t,"utf-8")),e=[],r=[];u.forEach(a=>{a.dataFlows.filter(({type:o})=>o!==_privacytypes.DataFlowScope.CSP).forEach(o=>{e.push({value:o.value,type:o.type,status:_privacytypes.ConsentTrackerStatus.Live,trackingPurposes:o.trackingPurposes})}),a.cookies.forEach(o=>{r.push({name:o.name,status:_privacytypes.ConsentTrackerStatus.Live,trackingPurposes:o.trackingPurposes})})}),_chunkBQSBPO63cjs.e.call(void 0, n,{"data-flows":e,cookies:r}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully wrote ${e.length} data flows and ${r.length} cookies to file "${n}"`))}exports.consentManagerServiceJsonToYml = T;
|
|
2
|
+
//# sourceMappingURL=impl-EE3BM53W.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-EE3BM53W.cjs","../src/commands/inventory/consent-manager-service-json-to-yml/impl.ts"],"names":["consentManagerServiceJsonToYml","file","output","doneInputValidation","existsSync","logger","colors","services","decodeCodec","ConsentManagerServiceMetadata","readFileSync","dataFlows","cookies","service","type","DataFlowScope","dataFlow","ConsentTrackerStatus","cookie","writeTranscendYaml"],"mappings":"AAAA,mfAAwC,wDAA0C,wDAAyC,gCAA6B,wDAAyC,gCAA6B,qECC3M,gFAEA,wBAEsB,qDACb,2DASrB,SAQSA,CAAAA,CAEd,CAAE,IAAA,CAAAC,CAAAA,CAAM,MAAA,CAAAC,CAAO,CAAA,CACT,CACNC,iCAAAA,IAAoB,CAAK,OAAA,CAAQ,IAAI,CAAA,CAGhCC,4BAAAA,CAAe,CAAA,EAAA,CAClBC,mBAAAA,CAAO,KAAA,CAAMC,gBAAAA,CAAO,GAAA,CAAI,CAAA,6BAAA,EAAgCL,CAAI,CAAA,CAAA,CAAG,CAAC,CAAA,CAChE,IAAA,CAAK,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,CAAA,CAIrB,IAAMM,CAAAA,CAAWC,oCAAAA,CACb,CAAA,KAAA,CAAMC,oBAA6B,CAAA,CACrCC,8BAAAA,CAAaT,CAAM,OAAO,CAC5B,CAAA,CAGMU,CAAAA,CAA6B,CAAC,CAAA,CAC9BC,CAAAA,CAAyB,CAAC,CAAA,CAChCL,CAAAA,CAAS,OAAA,CAASM,CAAAA,EAAY,CAC5BA,CAAAA,CAAQ,SAAA,CACL,MAAA,CAAO,CAAC,CAAE,IAAA,CAAAC,CAAK,CAAA,CAAA,EAAMA,CAAAA,GAASC,2BAAAA,CAAc,GAAG,CAAA,CAC/C,OAAA,CAASC,CAAAA,EAAa,CACrBL,CAAAA,CAAU,IAAA,CAAK,CACb,KAAA,CAAOK,CAAAA,CAAS,KAAA,CAChB,IAAA,CAAMA,CAAAA,CAAS,IAAA,CACf,MAAA,CAAQC,kCAAAA,CAAqB,IAAA,CAC7B,gBAAA,CAAkBD,CAAAA,CAAS,gBAC7B,CAAC,CACH,CAAC,CAAA,CAEHH,CAAAA,CAAQ,OAAA,CAAQ,OAAA,CAASK,CAAAA,EAAW,CAClCN,CAAAA,CAAQ,IAAA,CAAK,CACX,IAAA,CAAMM,CAAAA,CAAO,IAAA,CACb,MAAA,CAAQD,kCAAAA,CAAqB,IAAA,CAC7B,gBAAA,CAAkBC,CAAAA,CAAO,gBAC3B,CAAC,CACH,CAAC,CACH,CAAC,CAAA,CAGDC,iCAAAA,CAAmBjB,CAAQ,CACzB,YAAA,CAAcS,CAAAA,CACd,OAAA,CAAAC,CACF,CAAC,CAAA,CAEDP,mBAAAA,CAAO,IAAA,CACLC,gBAAAA,CAAO,KAAA,CACL,CAAA,mBAAA,EAAsBK,CAAAA,CAAU,MAAM,CAAA,gBAAA,EAAmBC,CAAAA,CAAQ,MAAM,CAAA,kBAAA,EAAqBV,CAAM,CAAA,CAAA,CACpG,CACF,CACF,CAAA,2CAAA","file":"/home/runner/work/cli/cli/dist/impl-EE3BM53W.cjs","sourcesContent":[null,"import type { LocalContext } from '../../../context';\nimport * as t from 'io-ts';\nimport { writeTranscendYaml } from '../../../lib/readTranscendYaml';\nimport colors from 'colors';\nimport { logger } from '../../../logger';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport {\n ConsentManagerServiceMetadata,\n CookieInput,\n DataFlowInput,\n} from '../../../codecs';\nimport {\n ConsentTrackerStatus,\n DataFlowScope,\n} from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface ConsentManagerServiceJsonToYmlCommandFlags {\n file: string;\n output: string;\n}\n\nexport function consentManagerServiceJsonToYml(\n this: LocalContext,\n { file, output }: ConsentManagerServiceJsonToYmlCommandFlags,\n): void {\n doneInputValidation(this.process.exit);\n\n // Ensure files exist\n if (!existsSync(file)) {\n logger.error(colors.red(`File does not exist: --file=\"${file}\"`));\n this.process.exit(1);\n }\n\n // Read in each consent manager configuration\n const services = decodeCodec(\n t.array(ConsentManagerServiceMetadata),\n readFileSync(file, 'utf-8'),\n );\n\n // Create data flows and cookie configurations\n const dataFlows: DataFlowInput[] = [];\n const cookies: CookieInput[] = [];\n services.forEach((service) => {\n service.dataFlows\n .filter(({ type }) => type !== DataFlowScope.CSP)\n .forEach((dataFlow) => {\n dataFlows.push({\n value: dataFlow.value,\n type: dataFlow.type,\n status: ConsentTrackerStatus.Live,\n trackingPurposes: dataFlow.trackingPurposes,\n });\n });\n\n service.cookies.forEach((cookie) => {\n cookies.push({\n name: cookie.name,\n status: ConsentTrackerStatus.Live,\n trackingPurposes: cookie.trackingPurposes,\n });\n });\n });\n\n // write to disk\n writeTranscendYaml(output, {\n 'data-flows': dataFlows,\n cookies,\n });\n\n logger.info(\n colors.green(\n `Successfully wrote ${dataFlows.length} data flows and ${cookies.length} cookies to file \"${output}\"`,\n ),\n );\n}\n"]}
|
|
@@ -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 _chunk56COHDFTcjs = require('./chunk-56COHDFT.cjs');require('./chunk-FHUHBSLE.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');require('./chunk-A3GRLGNU.cjs');require('./chunk-T3BBQIRY.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=_chunk56COHDFTcjs.xc.call(void 0, $,k),b=c.type({[a]:c.string,...r?{[r]:c.string}:{}}),n=_chunk56COHDFTcjs.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 _chunk56COHDFTcjs.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 _chunk56COHDFTcjs.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-FLUPS5AF.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-FLUPS5AF.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-FLUPS5AF.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,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 _chunk56COHDFTcjs = require('./chunk-56COHDFT.cjs');require('./chunk-FHUHBSLE.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkA3GRLGNUcjs = require('./chunk-A3GRLGNU.cjs');var _chunkT3BBQIRYcjs = require('./chunk-T3BBQIRY.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(_chunkT3BBQIRYcjs.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=_chunkA3GRLGNUcjs.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=_chunkA3GRLGNUcjs.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=_chunkA3GRLGNUcjs.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 _chunk56COHDFTcjs.ug.call(void 0, t,_chunk56COHDFTcjs.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=_chunkA3GRLGNUcjs.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?_chunk56COHDFTcjs.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-HMJ3RSYJ.cjs.map
|