@transcend-io/cli 8.30.1 → 8.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/bin/bash-complete.cjs +1 -1
- package/dist/bin/cli.cjs +1 -1
- package/dist/bin/deprecated-command.cjs +2 -2
- package/dist/{chunk-LRADV5OI.cjs → chunk-52MA7ZLS.cjs} +2 -2
- package/dist/{chunk-LRADV5OI.cjs.map → chunk-52MA7ZLS.cjs.map} +1 -1
- package/dist/{chunk-HTS7K7QD.cjs → chunk-55B57ZAY.cjs} +4 -4
- package/dist/{chunk-HTS7K7QD.cjs.map → chunk-55B57ZAY.cjs.map} +1 -1
- package/dist/{chunk-LZA5Y4SB.cjs → chunk-7H4ALAHC.cjs} +4 -4
- package/dist/{chunk-LZA5Y4SB.cjs.map → chunk-7H4ALAHC.cjs.map} +1 -1
- package/dist/{chunk-T3BBQIRY.cjs → chunk-7PB6LVSE.cjs} +2 -2
- package/dist/chunk-7PB6LVSE.cjs.map +1 -0
- package/dist/{chunk-LU3DKRNK.cjs → chunk-ABKDAPPR.cjs} +2 -2
- package/dist/{chunk-LU3DKRNK.cjs.map → chunk-ABKDAPPR.cjs.map} +1 -1
- package/dist/{chunk-XEXS6R45.cjs → chunk-ALOB5SWZ.cjs} +2 -2
- package/dist/{chunk-XEXS6R45.cjs.map → chunk-ALOB5SWZ.cjs.map} +1 -1
- package/dist/{chunk-SPN6SWMF.cjs → chunk-DIB7IOEX.cjs} +2 -2
- package/dist/{chunk-SPN6SWMF.cjs.map → chunk-DIB7IOEX.cjs.map} +1 -1
- package/dist/{chunk-RAA5VWQS.cjs → chunk-G522ZIHS.cjs} +2 -2
- package/dist/{chunk-RAA5VWQS.cjs.map → chunk-G522ZIHS.cjs.map} +1 -1
- package/dist/{chunk-UXFL56TL.cjs → chunk-HCEZRZHV.cjs} +6 -6
- package/dist/{chunk-UXFL56TL.cjs.map → chunk-HCEZRZHV.cjs.map} +1 -1
- package/dist/{chunk-BQSBPO63.cjs → chunk-JH5HRI6D.cjs} +3 -3
- package/dist/{chunk-BQSBPO63.cjs.map → chunk-JH5HRI6D.cjs.map} +1 -1
- package/dist/{chunk-WURUFVEG.cjs → chunk-M3Y6JH6I.cjs} +2 -2
- package/dist/{chunk-WURUFVEG.cjs.map → chunk-M3Y6JH6I.cjs.map} +1 -1
- package/dist/{chunk-FIJLHU4Q.cjs → chunk-M7OVJJGB.cjs} +4 -4
- package/dist/{chunk-FIJLHU4Q.cjs.map → chunk-M7OVJJGB.cjs.map} +1 -1
- package/dist/{chunk-6KRRRMY2.cjs → chunk-MXT7N555.cjs} +21 -21
- package/dist/{chunk-6KRRRMY2.cjs.map → chunk-MXT7N555.cjs.map} +1 -1
- package/dist/{chunk-YYDWSYMF.cjs → chunk-NC6VWOMN.cjs} +2 -2
- package/dist/{chunk-YYDWSYMF.cjs.map → chunk-NC6VWOMN.cjs.map} +1 -1
- package/dist/{chunk-Z2DYKPKM.cjs → chunk-Q2RJZGYW.cjs} +2 -2
- package/dist/{chunk-Z2DYKPKM.cjs.map → chunk-Q2RJZGYW.cjs.map} +1 -1
- package/dist/{chunk-3FIDP42N.cjs → chunk-SKOTYI3A.cjs} +2 -2
- package/dist/chunk-SKOTYI3A.cjs.map +1 -0
- package/dist/{chunk-FHUHBSLE.cjs → chunk-TSJTXXLZ.cjs} +2 -2
- package/dist/{chunk-FHUHBSLE.cjs.map → chunk-TSJTXXLZ.cjs.map} +1 -1
- package/dist/{chunk-OMVVROKB.cjs → chunk-XXFLFF7Q.cjs} +2 -2
- package/dist/{chunk-OMVVROKB.cjs.map → chunk-XXFLFF7Q.cjs.map} +1 -1
- package/dist/impl-4CWCLU5Z.cjs +2 -0
- package/dist/{impl-J62VZXDY.cjs.map → impl-4CWCLU5Z.cjs.map} +1 -1
- package/dist/{impl-BSIFPZLW.cjs → impl-542SIWQ2.cjs} +2 -2
- package/dist/{impl-BSIFPZLW.cjs.map → impl-542SIWQ2.cjs.map} +1 -1
- package/dist/impl-55GTRVMZ.cjs +2 -0
- package/dist/{impl-FKXR7U4X.cjs.map → impl-55GTRVMZ.cjs.map} +1 -1
- package/dist/{impl-KBVYLYIZ.cjs → impl-5VMEZB7F.cjs} +2 -2
- package/dist/{impl-KBVYLYIZ.cjs.map → impl-5VMEZB7F.cjs.map} +1 -1
- package/dist/{impl-2X2FNMJR.cjs → impl-6ANYWCOV.cjs} +2 -2
- package/dist/{impl-2X2FNMJR.cjs.map → impl-6ANYWCOV.cjs.map} +1 -1
- package/dist/{impl-VBE4QUJN.cjs → impl-A7XL5O4W.cjs} +2 -2
- package/dist/{impl-VBE4QUJN.cjs.map → impl-A7XL5O4W.cjs.map} +1 -1
- package/dist/{impl-COZ7ADUO.cjs → impl-BQNXMBQ4.cjs} +4 -4
- package/dist/{impl-COZ7ADUO.cjs.map → impl-BQNXMBQ4.cjs.map} +1 -1
- package/dist/{impl-3BTFEGV4.cjs → impl-CFYRFABZ.cjs} +5 -5
- package/dist/{impl-3BTFEGV4.cjs.map → impl-CFYRFABZ.cjs.map} +1 -1
- package/dist/{impl-T7EOUHYL.cjs → impl-D2HENZNO.cjs} +2 -2
- package/dist/{impl-T7EOUHYL.cjs.map → impl-D2HENZNO.cjs.map} +1 -1
- package/dist/{impl-IFHM4YOL.cjs → impl-GEEPG7OH.cjs} +2 -2
- package/dist/{impl-IFHM4YOL.cjs.map → impl-GEEPG7OH.cjs.map} +1 -1
- package/dist/{impl-EE3BM53W.cjs → impl-GRGWQUU7.cjs} +2 -2
- package/dist/{impl-EE3BM53W.cjs.map → impl-GRGWQUU7.cjs.map} +1 -1
- package/dist/{impl-Z3EAXTJV.cjs → impl-JFYHXSOV.cjs} +2 -2
- package/dist/{impl-Z3EAXTJV.cjs.map → impl-JFYHXSOV.cjs.map} +1 -1
- package/dist/impl-JQVCW52V.cjs +2 -0
- package/dist/{impl-RTZTJWMX.cjs.map → impl-JQVCW52V.cjs.map} +1 -1
- package/dist/impl-JSXYZHX4.cjs +2 -0
- package/dist/{impl-VHY4ALCB.cjs.map → impl-JSXYZHX4.cjs.map} +1 -1
- package/dist/{impl-Q5WCETP4.cjs → impl-K2D3GTZG.cjs} +2 -2
- package/dist/{impl-Q5WCETP4.cjs.map → impl-K2D3GTZG.cjs.map} +1 -1
- package/dist/{impl-463J7BYV.cjs → impl-KQYINEBI.cjs} +2 -2
- package/dist/{impl-463J7BYV.cjs.map → impl-KQYINEBI.cjs.map} +1 -1
- package/dist/impl-KRJNBGJ6.cjs +2 -0
- package/dist/{impl-7BAUUGZT.cjs.map → impl-KRJNBGJ6.cjs.map} +1 -1
- package/dist/{impl-5WHENVVS.cjs → impl-NK42TN4C.cjs} +2 -2
- package/dist/{impl-5WHENVVS.cjs.map → impl-NK42TN4C.cjs.map} +1 -1
- package/dist/{impl-5GGFGRTD.cjs → impl-OQAP7YDW.cjs} +2 -2
- package/dist/{impl-5GGFGRTD.cjs.map → impl-OQAP7YDW.cjs.map} +1 -1
- package/dist/{impl-T5V56TM5.cjs → impl-PHBUSAGS.cjs} +2 -2
- package/dist/{impl-T5V56TM5.cjs.map → impl-PHBUSAGS.cjs.map} +1 -1
- package/dist/{impl-XAZ6YY3R.cjs → impl-PKWSORXX.cjs} +2 -2
- package/dist/{impl-XAZ6YY3R.cjs.map → impl-PKWSORXX.cjs.map} +1 -1
- package/dist/{impl-4CA7VK4U.cjs → impl-PWYKAVK4.cjs} +2 -2
- package/dist/{impl-4CA7VK4U.cjs.map → impl-PWYKAVK4.cjs.map} +1 -1
- package/dist/{impl-UMVE7IPO.cjs → impl-Q3P6DGHG.cjs} +2 -2
- package/dist/{impl-UMVE7IPO.cjs.map → impl-Q3P6DGHG.cjs.map} +1 -1
- package/dist/{impl-ZJ2L727T.cjs → impl-RD5UOJY6.cjs} +2 -2
- package/dist/{impl-ZJ2L727T.cjs.map → impl-RD5UOJY6.cjs.map} +1 -1
- package/dist/{impl-U76PZBUK.cjs → impl-REKQO7ZI.cjs} +2 -2
- package/dist/{impl-U76PZBUK.cjs.map → impl-REKQO7ZI.cjs.map} +1 -1
- package/dist/{impl-IM22LNW5.cjs → impl-RI3WQFOE.cjs} +3 -3
- package/dist/{impl-IM22LNW5.cjs.map → impl-RI3WQFOE.cjs.map} +1 -1
- package/dist/impl-SRI65ZIC.cjs +2 -0
- package/dist/{impl-IBOGAUVL.cjs.map → impl-SRI65ZIC.cjs.map} +1 -1
- package/dist/{impl-YEXEFJS7.cjs → impl-T67PUM7X.cjs} +2 -2
- package/dist/{impl-YEXEFJS7.cjs.map → impl-T67PUM7X.cjs.map} +1 -1
- package/dist/{impl-NEV6KDPU.cjs → impl-TCR3Y3J2.cjs} +2 -2
- package/dist/{impl-NEV6KDPU.cjs.map → impl-TCR3Y3J2.cjs.map} +1 -1
- package/dist/{impl-VPUALIUR.cjs → impl-U46BMUFL.cjs} +2 -2
- package/dist/{impl-VPUALIUR.cjs.map → impl-U46BMUFL.cjs.map} +1 -1
- package/dist/{impl-BLIELFUK.cjs → impl-UVQJ7HSK.cjs} +3 -3
- package/dist/{impl-BLIELFUK.cjs.map → impl-UVQJ7HSK.cjs.map} +1 -1
- package/dist/{impl-GJMVAL3N.cjs → impl-V3MXFXZF.cjs} +2 -2
- package/dist/{impl-GJMVAL3N.cjs.map → impl-V3MXFXZF.cjs.map} +1 -1
- package/dist/{impl-76E4DKAE.cjs → impl-VL3CJ2OT.cjs} +2 -2
- package/dist/{impl-76E4DKAE.cjs.map → impl-VL3CJ2OT.cjs.map} +1 -1
- package/dist/{impl-Z5HT5JQU.cjs → impl-VT3C6SP4.cjs} +2 -2
- package/dist/{impl-Z5HT5JQU.cjs.map → impl-VT3C6SP4.cjs.map} +1 -1
- package/dist/{impl-OFB5I4S6.cjs → impl-VUAC7AYF.cjs} +2 -2
- package/dist/{impl-OFB5I4S6.cjs.map → impl-VUAC7AYF.cjs.map} +1 -1
- package/dist/impl-VXOHC45F.cjs +3 -0
- package/dist/{impl-LMKJ6UBT.cjs.map → impl-VXOHC45F.cjs.map} +1 -1
- package/dist/{impl-UPDFANVR.cjs → impl-WMI46UXI.cjs} +2 -2
- package/dist/{impl-UPDFANVR.cjs.map → impl-WMI46UXI.cjs.map} +1 -1
- package/dist/{impl-FTSCECOZ.cjs → impl-XJBUIDZP.cjs} +2 -2
- package/dist/{impl-FTSCECOZ.cjs.map → impl-XJBUIDZP.cjs.map} +1 -1
- package/dist/impl-XLL66FXK.cjs +2 -0
- package/dist/{impl-X6TORGVF.cjs.map → impl-XLL66FXK.cjs.map} +1 -1
- package/dist/{impl-BSI3RBQ2.cjs → impl-YGVW4RTA.cjs} +2 -2
- package/dist/{impl-BSI3RBQ2.cjs.map → impl-YGVW4RTA.cjs.map} +1 -1
- package/dist/{impl-AWWB3TEU.cjs → impl-ZAKPYQ32.cjs} +2 -2
- package/dist/{impl-AWWB3TEU.cjs.map → impl-ZAKPYQ32.cjs.map} +1 -1
- package/dist/{impl-DS73OYLE.cjs → impl-ZTYQ3IB5.cjs} +2 -2
- package/dist/{impl-DS73OYLE.cjs.map → impl-ZTYQ3IB5.cjs.map} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +3 -3
- package/package.json +1 -1
- package/dist/chunk-3FIDP42N.cjs.map +0 -1
- package/dist/chunk-T3BBQIRY.cjs.map +0 -1
- package/dist/impl-7BAUUGZT.cjs +0 -2
- package/dist/impl-FKXR7U4X.cjs +0 -2
- package/dist/impl-IBOGAUVL.cjs +0 -2
- package/dist/impl-J62VZXDY.cjs +0 -2
- package/dist/impl-LMKJ6UBT.cjs +0 -3
- package/dist/impl-RTZTJWMX.cjs +0 -2
- package/dist/impl-VHY4ALCB.cjs +0 -2
- package/dist/impl-X6TORGVF.cjs +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunkXXFLFF7Qcjs = require('./chunk-XXFLFF7Q.cjs');var _graphqlrequest = require('graphql-request');var $n=_graphqlrequest.gql`
|
|
2
2
|
query TranscendCliDataPoints(
|
|
3
3
|
$filterBy: DataPointFiltersInput
|
|
4
4
|
$first: Int!
|
|
@@ -2981,12 +2981,12 @@
|
|
|
2981
2981
|
}
|
|
2982
2982
|
}
|
|
2983
2983
|
}
|
|
2984
|
-
`;var _typeutils = require('@transcend-io/type-utils');var _internationalization = require('@transcend-io/internationalization');var _privacytypes = require('@transcend-io/privacy-types');var _iots = require('io-ts'); var q = _interopRequireWildcard(_iots); var dt = _interopRequireWildcard(_iots); var ka = _interopRequireWildcard(_iots); var Je = _interopRequireWildcard(_iots); var P = _interopRequireWildcard(_iots); var V = _interopRequireWildcard(_iots); var be = _interopRequireWildcard(_iots); var ae = _interopRequireWildcard(_iots); var x = _interopRequireWildcard(_iots); var re = _interopRequireWildcard(_iots); var Xt = _interopRequireWildcard(_iots); var Ye = _interopRequireWildcard(_iots); var ql = _interopRequireWildcard(_iots);var Y="[NONE]",Kt= exports.dc ="[APPLY VALUE TO ALL ROWS]",ui= exports.ec ="<blank>",pr= exports.fc =["email","coreIdentifier"],At= exports.gc =(m=>(m.Email="email",m.CoreIdentifier="coreIdentifier",m.RequestType="requestType",m.SubjectType="subjectType",m.Locale="locale",m.Country="country",m.CountrySubDivision="countrySubDivision",m.RequestStatus="requestStatus",m.CreatedAt="createdAt",m.DataSiloIds="dataSiloIds",m))(At||{}),Ra= exports.hc ={email:!1,coreIdentifier:!0,requestType:!0,subjectType:!0,requestStatus:!1,createdAt:!1,dataSiloIds:!1,locale:!1,country:!1,countrySubDivision:!1},ba= exports.ic ={requestType:!0,subjectType:!0},wa= exports.jc =q.type({columnNames:q.partial(_typeutils.applyEnum.call(void 0, At,()=>q.string)),identifierNames:q.record(q.string,q.string),attributeNames:q.record(q.string,q.string),requestTypeToRequestAction:q.record(q.string,_typeutils.valuesOf.call(void 0, _privacytypes.RequestAction)),subjectTypeToSubjectName:q.record(q.string,q.string),languageToLocale:q.record(q.string,_typeutils.valuesOf.call(void 0, _internationalization.LOCALE_KEY)),regionToCountry:q.record(q.string,_typeutils.valuesOf.call(void 0, {..._privacytypes.IsoCountryCode,[Y]:Y})),regionToCountrySubDivision:q.record(q.string,_typeutils.valuesOf.call(void 0, {..._privacytypes.IsoCountrySubdivisionCode,[Y]:Y})),statusToRequestStatus:q.record(q.string,_typeutils.valuesOf.call(void 0, {..._privacytypes.CompletedRequestStatus,[Y]:Y}))}),lr= exports.kc =q.type({id:q.string,link:q.string,rowIndex:q.number,coreIdentifier:q.string,attemptedAt:q.string}),$a= exports.lc =q.type({failingRequests:q.array(q.record(q.string,q.any)),successfulRequests:q.array(lr),duplicateRequests:q.array(q.type({rowIndex:q.number,coreIdentifier:q.string,attemptedAt:q.string}))});var _inquirer = require('inquirer'); var _inquirer2 = _interopRequireDefault(_inquirer);var _fuzzysearch = require('fuzzysearch'); var _fuzzysearch2 = _interopRequireDefault(_fuzzysearch);function It(t,e){return _fuzzysearch2.default.call(void 0, t.toLowerCase(),e.toLowerCase())||_fuzzysearch2.default.call(void 0, e.toLowerCase(),t.toLowerCase())}function Tt(t,e,r,n){let i=t.filter(s=>It(e.toLowerCase(),s.toLowerCase()));return[...i,new _inquirer2.default.Separator,...r?[]:[Y],...n?[Kt]:[],...t.filter(s=>!i.includes(s))]}var _inquirerautocompleteprompt = require('inquirer-autocomplete-prompt'); var _inquirerautocompleteprompt2 = _interopRequireDefault(_inquirerautocompleteprompt);async function mt(t,e,r){_inquirer2.default.registerPrompt("autocomplete",_inquirerautocompleteprompt2.default);let n=t.map(s=>s||"<blank>").filter(s=>!r[s]);if(n.length===0)return r;let i=await _inquirer2.default.prompt(n.map(s=>({name:s,message:`Map value of: ${s}`,type:"autocomplete",default:e.find(o=>It(s,o)),source:(o,p)=>p?e.filter(c=>typeof c=="string"&&It(p,c)):e})));return{...r,..._typeutils.apply.call(void 0, i,s=>typeof s=="string"?s:Object.values(s)[0])}}function mi(t){return t.split(",").map(e=>e.trim()).filter(e=>e)}var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var va=dt.type({key:dt.string,values:dt.array(dt.string)});function La(t){let e=t.map(r=>{let[n,i]=r.trim().split(":");if(!i)throw new Error("Expected attributes in key:value1;value2,key2:value3;value4");let s=i.split(";");return{key:n,values:s}});return _chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Attributes to apply to all requests:")),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(JSON.stringify(e,null,2))),e}var _sync = require('csv-parse/sync');var _fs = require('fs');function _a(t,e,r={columns:!0}){let n=_sync.parse.call(void 0, _fs.readFileSync.call(void 0, t,"utf-8"),r);return _typeutils.decodeCodec.call(void 0, ka.array(e),n).map(o=>Object.entries(o).reduce((p,[c,u])=>Object.assign(p,{[c.replace(/[^a-z_.+\-A-Z -~]/g,"")]:u}),{}))}function He(t,e){return _chunkOMVVROKBcjs.j.call(void 0, t.map(r=>r[e]||"").flat())}async function Ga(t){let e=_chunkOMVVROKBcjs.j.call(void 0, t.map(i=>Object.keys(i)).flat()),r=t,n=!0;for(;n;){let{filterColumnName:i}=await _inquirer2.default.prompt([{name:"filterColumnName",message:`If you need to filter the list of requests to import, choose the column to filter on. Currently ${r.length} rows.`,type:"list",default:e,choices:[Y,...e]}]);if(n=Y!==i,n){let s=He(r,i),{valuesToKeep:o}=await _inquirer2.default.prompt([{name:"valuesToKeep",message:"Keep rows matching this value",type:"checkbox",default:e,choices:s}]);r=r.filter(p=>o.includes(p[i]))}}return _chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Importing ${r.length} requests`)),r}var _bluebird = require('bluebird');function Vc(t,e){return new (0, _graphqlrequest.GraphQLClient)(`${t}/graphql`,{headers:{...e,version:_chunkOMVVROKBcjs.m}})}function Z(t,e){return Vc(t,{Authorization:`Bearer ${e}`})}var _got = require('got'); var _got2 = _interopRequireDefault(_got);async function nt(t,e,r){let n=Z(t,e),{organization:i}=await l(n,so),{customerUrl:s}=i.sombra;if(["https://sombra-reverse-tunnel.transcend.io","https://sombra-reverse-tunnel.us.transcend.io"].includes(s))throw new Error("It looks like your Sombra customer ingress URL has not been set up. Please follow the instructions here to configure networking for Sombra: https://docs.transcend.io/docs/articles/sombra/deploying/customizing-sombra/networking");return _got2.default.extend({prefixUrl:s,headers:{Authorization:`Bearer ${e}`,...r?{"X-Sombra-Authorization":`Bearer ${r}`}:{}}})}function IC(t){return _got2.default.extend({prefixUrl:t})}async function RC(t,{id:e,bundleType:r}){await l(t,$s,{airgapBundleId:e,bundleType:r})}async function bC(t,{id:e,bundleType:r}){await l(t,ws,{airgapBundleId:e,bundleType:r})}async function qC(t,e){let r=await l(t,ro,{dataSiloId:e,type:"DATA_SILO_DISCOVERY"}),{plugins:n,totalCount:i}=r.plugins;return i===0&&(_chunkZUNVPK23cjs.a.error("No active data silo plugins found for this data silo."),process.exit(1)),n[0]}var di=20;async function cr(t,e={}){let r=[],n=0,i=!1;do{let{globalActionItems:{nodes:s}}=await l(t,Ys,{first:di,offset:n,filterBy:{...e,...e.startDueDate?{startDueDate:e.startDueDate.toISOString()}:{},...e.endDueDate?{endDueDate:e.endDueDate.toISOString()}:{}}});r.push(...s.map(o=>({...o,id:o.ids[0],title:o.titles[0],notes:o.notes[0],link:o.links[0]}))),n+=di,i=s.length===di}while(i);return r}var fi=20;async function ur(t){let e=[],r=0,n=!1;do{let{actions:{nodes:i}}=await l(t,Ks,{first:fi,offset:r});e.push(...i),r+=fi,n=i.length===fi}while(n);return e.sort((i,s)=>i.type.localeCompare(s.type))}var gi=20;async function mr(t,e={}){let r=[],n=0,i=!1;do{let{agentFiles:{nodes:s}}=await l(t,oa,{first:gi,offset:n,filterBy:e});r.push(...s),n+=gi,i=s.length===gi}while(i);return r.sort((s,o)=>s.name.localeCompare(o.name))}var yi=20;async function dr(t){let e=[],r=0,n=!1;do{let{agentFunctions:{nodes:i}}=await l(t,pa,{first:yi,offset:r});e.push(...i.map(s=>({...s,parameters:JSON.parse(s.parameters)}))),r+=yi,n=i.length===yi}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}var hi=20;async function fr(t,e={}){let r=[],n=0,i=!1;do{let{agents:{nodes:s}}=await l(t,ra,{first:hi,offset:n,filterBy:e});r.push(...s),n+=hi,i=s.length===hi}while(i);return r.sort((s,o)=>s.name.localeCompare(o.name))}var Ci=20;async function Na(t){let e=[],r=0,n=!1;do{let{assessmentForms:{nodes:i}}=await l(t,xo,{first:Ci,offset:r});e.push(...i),r+=Ci,n=i.length===Ci}while(n);return e.sort((i,s)=>i.title.localeCompare(s.title))}var Si=20;async function Ma(t){let e=[],r=0,n=!1;do{let{assessmentFormTemplates:{nodes:i}}=await l(t,vo,{first:Si,offset:r});e.push(...i),r+=Si,n=i.length===Si}while(n);return e.sort((i,s)=>i.title.localeCompare(s.title))}var Zc=50;async function zc(t,e){let{createPrivacyCenterAccessTokens:{nodes:r}}=await l(t,Xn,{input:{records:e}});return r.map(n=>n.token)}async function nS(t,e,r,n=10){let i=0;r&&r(0);let s=[];return await _bluebird.map.call(void 0, _chunkOMVVROKBcjs.b.call(void 0, e,Zc),async o=>{let c=(await zc(t,o.map(({index:u,...m})=>m))).map((u,m)=>({input:o[m],accessToken:u}));s.push(...c),i+=o.length,r&&r(i)},{concurrency:n}),s}var Ai=20;async function Fa(t){let e=[],r=0,n=!1;do{let{attributeKeys:{nodes:i}}=await l(t,ao,{first:Ai,offset:r});e.push(...i),r+=Ai,n=i.length===Ai}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}var Pt=100;async function Wc(t,e){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Fetching all attribute values for ${e}...`));let r=[],n=0,i=!1;do{let{attributeValues:{nodes:s}}=await l(t,us,{first:Pt,offset:n,attributeKeyId:e});r.push(...s),n+=Pt,i=s.length===Pt}while(i);return r.sort((s,o)=>s.name.localeCompare(o.name))}var Hc=[_privacytypes.AttributeKeyType.MultiSelect,_privacytypes.AttributeKeyType.SingleSelect];async function Et(t){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Fetching all attributes..."));let e=[],r=0,n=!1;do{let{attributeKeys:{nodes:i}}=await l(t,as,{first:Pt,offset:r});e.push(...await Promise.all(i.map(async s=>({...s,values:Hc.includes(s.type)?await Wc(t,s.id):[]})))),r+=Pt,n=i.length===Pt}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}var Ii=20;async function gr(t){let e=[],r=0,n=!1;do{let{businessEntities:{nodes:i}}=await l(t,Us,{first:Ii,offset:r});e.push(...i),r+=Ii,n=i.length===Ii}while(n);return e.sort((i,s)=>i.title.localeCompare(s.title))}async function Qa(t){let{consentManager:{consentManager:e}}=await l(t,Ps);return e}async function De(t,e){let{consentManager:{consentManager:r}}=await l(t,Ts,{},{},e);return r.id}var Ti=50;async function yr(t){let e=[],r=0,n=!1;do{let{experiences:{nodes:i}}=await l(t,gs,{first:Ti,offset:r});e.push(...i),r+=Ti,n=i.length===Ti}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}var Jc=(r=>(r.Hourly="1h",r.Daily="1d",r))(Jc||{});async function IS(t,e){let{analyticsData:{series:r}}=await l(t,Fs,{input:e});return r}async function Va(t,e){let{consentManagerTheme:{theme:r}}=await l(t,Es,{airgapBundleId:e});return r}var Pi=20;async function Ei(t,e=_privacytypes.ConsentTrackerStatus.Live){let r=[],n=0,i=await De(t),s=!1;do{let{cookies:{nodes:o}}=await l(t,Is,{first:Pi,offset:n,airgapBundleId:i,status:e});r.push(...o),n+=Pi,s=o.length===Pi}while(s);return r.sort((o,p)=>o.name.localeCompare(p.name))}var Ri=20;async function hr(t){let e=[],r=0,n=!1;do{let{dataSubCategories:{nodes:i}}=await l(t,fa,{first:Ri,offset:r});e.push(...i),r+=Ri,n=i.length===Ri}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}var bi=20;async function Rt(t,e=_privacytypes.ConsentTrackerStatus.Live){let r=[],n=0,i=await De(t),s=!1;do{let{dataFlows:{nodes:o}}=await l(t,As,{first:bi,offset:n,airgapBundleId:i,status:e,...e===_privacytypes.ConsentTrackerStatus.NeedsReview?{showZeroActivity:!0}:{}});r.push(...o),n+=bi,s=o.length===bi}while(s);return r.sort((o,p)=>o.value.localeCompare(p.value))}async function ja(t){let{translatedMessages:e}=await l(t,Po,{});return e}async function jt(t){let{organization:e}=await l(t,Hs);return e.deployedPrivacyCenterUrl}async function bt(t,e){let r=e;r||(r=await jt(t));let{privacyCenter:n}=await l(t,Ws,{url:r});return n.id}async function Cr(t){let e=await jt(t),{privacyCenterPolicies:r}=await l(t,ho,{url:e});return r.sort((n,i)=>n.title.defaultMessage.localeCompare(i.title.defaultMessage))}function Le(t){let e=[];return t.map(r=>{let n=e.find(i=>i.key===r.attributeKey.name);return n===void 0?(n={key:r.attributeKey.name,values:[r.name]},e.push(n)):n.values.push(r.name),e}),e}var wi=20;async function Ya(t){let e=[],r=0,n=!1;do{let{preferenceTopics:{nodes:i}}=await l(t,qo,{first:wi,offset:r});e.push(...i),r+=wi,n=i.length===wi}while(n);return e.sort((i,s)=>`${i.slug}:${i.purpose.trackingType}`.localeCompare(`${s.slug}:${s.purpose.trackingType}`))}async function Za(t){let e=await jt(t),{privacyCenter:{themeStr:r,...n}}=await l(t,Js,{url:e});return[{...n,theme:JSON.parse(r)}]}var $i=20;async function Sr(t){let e=[],r=0,n=!1;do{let{processingActivities:{nodes:i}}=await l(t,Aa,{first:$i,offset:r});e.push(...i),r+=$i,n=i.length===$i}while(n);return e.sort((i,s)=>i.title.localeCompare(s.title))}var xi=20;async function Ar(t){let e=[],r=0,n=!1;do{let{processingPurposeSubCategories:{nodes:i}}=await l(t,ha,{first:xi,offset:r});e.push(...i),r+=xi,n=i.length===xi}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}var Di=20;async function Ir(t,{includeDeleted:e=!1}={}){let r=[],n=0,i=!1;do{let{purposes:{nodes:s}}=await l(t,Do,{first:Di,offset:n,input:{includeDeleted:e}});r.push(...s),n+=Di,i=s.length===Di}while(i);return r.sort((s,o)=>s.trackingType.localeCompare(o.trackingType))}async function za(t){let[e,r]=await Promise.all([Ir(t),Ya(t)]);return e.map(n=>{let i=r.filter(s=>s.purpose.trackingType===n.trackingType);return{...n,topics:i}})}var qi=50;async function Tr(t,{requestId:e}){let r=[],n=0,i=!1;do{let{requestEnrichers:{nodes:s}}=await l(t,Ro,{first:qi,offset:n,requestId:e});r.push(...s),n+=qi,i=s.length===qi}while(i);return r}var vi=50;async function Wa(t,{requestId:e}){let r=[],n=0,i=!1;do{let{requestIdentifiers:{nodes:s}}=await l(t,Ho,{first:vi,offset:n,requestIds:[e]});r.push(...s),n+=vi,i=s.length===vi}while(i);return r}var _semver = require('semver'); var _semver2 = _interopRequireDefault(_semver);var Ha="7.180.0",nu=Je.type({id:Je.string,name:Je.string,value:Je.string,type:_typeutils.valuesOf.call(void 0, _privacytypes.IdentifierType)}),Li=50,ou= exports.kd =Je.type({identifiers:Je.array(nu)});async function Pr(t,e,{requestId:r}){let n=[],i=0,s=!1,{organization:{sombra:{version:o}}}=await l(t,Pa);if(o&&_semver2.default.lt(o,Ha))throw new Error(`Please upgrade Sombra to ${Ha} or greater to use this command.`);do{let p;try{p=await e.post("v1/request-identifiers",{json:{first:Li,offset:i,requestId:r}}).json()}catch(u){throw new Error(`Failed to fetch request identifiers: ${_optionalChain([u, 'optionalAccess', _2 => _2.response, 'optionalAccess', _3 => _3.body])||_optionalChain([u, 'optionalAccess', _4 => _4.message])}`)}let{identifiers:c}=_typeutils.decodeCodec.call(void 0, ou,p);n.push(...c),i+=Li,s=c.length===Li}while(s);return n}var _cliprogress = require('cli-progress'); var _cliprogress2 = _interopRequireDefault(_cliprogress);var mu=P.type({title:P.string,name:P.string,consent:P.boolean,enrichedPreferences:P.array(P.type({topic:P.string,selectValues:P.array(P.type({id:P.string,name:P.string,preferenceOption:P.type({id:P.string,slug:P.string,title:P.type({defaultMessage:P.string})})})),selectValue:P.type({id:P.string,name:P.string}),preferenceTopic:P.type({title:P.type({defaultMessage:P.string}),id:P.string,slug:P.string}),name:P.string,id:P.string,booleanValue:P.boolean}))}),GA= exports.nd =P.intersection([P.type({id:P.string,createdAt:P.string,email:P.string,type:_typeutils.valuesOf.call(void 0, _privacytypes.RequestAction),link:P.string,isSilent:P.boolean,origin:_typeutils.valuesOf.call(void 0, _privacytypes.RequestOrigin),isTest:P.boolean,coreIdentifier:P.string,details:P.string,locale:_typeutils.valuesOf.call(void 0, _internationalization.LOCALE_KEY),status:_typeutils.valuesOf.call(void 0, _privacytypes.RequestStatus),subjectType:P.string,country:P.union([P.null,_typeutils.valuesOf.call(void 0, _privacytypes.IsoCountryCode)]),countrySubDivision:P.union([P.null,_typeutils.valuesOf.call(void 0, _privacytypes.IsoCountrySubdivisionCode)]),attributeValues:P.array(P.type({id:P.string,attributeKey:P.type({name:P.string,id:P.string}),name:P.string}))}),P.partial({daysRemaining:P.union([P.null,P.number]),purpose:mu})]),Rr=50;async function le(t,{actions:e=[],statuses:r=[],origins:n=[],text:i,createdAtBefore:s,createdAtAfter:o,isTest:p,isSilent:c,isClosed:u,requestIds:m=[]}={}){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Fetching requests..."));let d=new Date().getTime(),f=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),g=[],y=0,S=!1;do{let{requests:{nodes:C,totalCount:O}}=await l(t,So,{first:Rr,offset:y,filterBy:{text:i,type:e.length>0?e:void 0,status:r.length>0?r:void 0,origin:n.length>0?n:void 0,isTest:p,isSilent:c,isClosed:u,createdAtBefore:s?s.toISOString():void 0,createdAtAfter:o?o.toISOString():void 0}});y===0&&O>Rr&&(_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Fetching ${O} requests`)),f.start(O,0)),g.push(...C),y+=Rr,f.update(y),S=C.length===Rr}while(S);f.stop();let I=new Date().getTime()-d;_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Completed fetching of ${g.length} request in "${I/1e3}" seconds.`));let L=g;return m&&m.length>0&&(L=L.filter(C=>m.includes(C.id)),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Filtered down to ${L.length} requests based on ${m.length} provided IDs.`))),L}var ki=20;async function br(t){let e=[],r=0,n=!1;do{let{teams:{nodes:i}}=await l(t,jo,{first:ki,offset:r});e.push(...i),r+=ki,n=i.length===ki}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}var _i=20;async function VA(t){let e=[],r=0,n=!1;do{let{users:{nodes:i}}=await l(t,Jo,{first:_i,offset:r});e.push(...i),r+=_i,n=i.length===_i}while(n);return e.sort((i,s)=>i.email.localeCompare(s.email))}var Oi=20;async function wr(t){let e=[],r=0,n=!1;do{let{vendors:{nodes:i}}=await l(t,ua,{first:Oi,offset:r});e.push(...i),r+=Oi,n=i.length===Oi}while(n);return e.sort((i,s)=>i.title.localeCompare(s.title))}var Gi=20,du="https://app.transcend.io/infrastructure/api-keys";async function fu(t,e){let r=[],n=0,i=!1;do{let{apiKeys:{nodes:s}}=await l(t,Wn,{first:Gi,offset:n,titles:e});r.push(...s),n+=Gi,i=s.length===Gi}while(i);return r.sort((s,o)=>s.title.localeCompare(o.title))}async function $r({"api-keys":t=[],"data-silos":e=[]},r,n=!1){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Fetching ${n?"all":t.length} API keys...`));let i=t.map(({title:m})=>m),s=_chunkOMVVROKBcjs.j.call(void 0, e.map(m=>m["api-key-title"]).filter(m=>!!m)),o=[...s,...i],p=await fu(r,n?void 0:[...s,...i]),c=_chunkOMVVROKBcjs.e.call(void 0, p,"title"),u=_chunkOMVVROKBcjs.c.call(void 0, o,p.map(({title:m})=>m));return u.length>0&&(_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to find API keys "${u.join('", "')}"! Make sure these API keys are created at: ${du}`)),process.exit(1)),c}var Ni=100;async function gu(t){let e=[],r=0,n=!1;do{let{catalogs:{nodes:i}}=await l(t,Mn,{first:Ni,offset:r});e.push(...i),r+=Ni,n=i.length===Ni}while(n);return e.sort((i,s)=>i.integrationName.localeCompare(s.integrationName))}async function iI(t){let e=await gu(t),r=e.reduce((i,s)=>Object.assign(i,{[s.integrationName]:s.title}),{}),n=e.reduce((i,s)=>Object.assign(i,{[s.integrationName]:s.hasApiFunctionality}),{});return{catalogs:e,serviceToTitle:r,serviceToSupportedIntegration:n}}async function Yt(t){let{internalSubjects:e}=await l(t,nr);return e}async function ep({"data-silos":t=[],"data-subjects":e=[],"processing-activities":r=[],enrichers:n=[]},i,s=!1){let o=_chunkOMVVROKBcjs.j.call(void 0, [..._chunkOMVVROKBcjs.a.call(void 0, t.map(m=>m["data-subjects"]||[])||[]),..._chunkOMVVROKBcjs.a.call(void 0, _nullishCoalesce(r.map(({dataSubjectTypes:m})=>_nullishCoalesce(m, () => ([]))), () => ([]))),..._chunkOMVVROKBcjs.a.call(void 0, n.map(m=>m["data-subjects"]||[])||[]),...e.map(m=>m.type)]);if(o.length===0&&!s)return{};let p=await Yt(i),c=_chunkOMVVROKBcjs.e.call(void 0, p,"type"),u=_chunkOMVVROKBcjs.c.call(void 0, o,p.map(({type:m})=>m));return u.length>0&&(_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating ${u.length} new data subjects...`)),await _bluebird.mapSeries.call(void 0, u,async m=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating data subject ${m}...`));let{createSubject:d}=await l(i,Vn,{type:m,skipPublish:!0});_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Created data subject ${m}!`)),c[m]=d.subject})),c}function tp(t,e){return t.forEach(r=>{if(!e[r])throw new Error(`Expected to find data subject definition: ${r}`)}),Object.values(e).filter(r=>!t.includes(r.type)).map(({id:r})=>r)}function rp(t,e){return t.forEach(r=>{if(!e[r])throw new Error(`Expected to find data subject definition: ${r}`)}),Object.values(e).filter(r=>!t.includes(r.type)).map(({type:r})=>r)}var Ui=20;async function Bi(t){let e=[],r=0,n=!1;do{let{identifiers:{nodes:i}}=await l(t,Fn,{first:Ui,offset:r});e.push(...i),r+=Ui,n=i.length===Ui}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}async function ip({enrichers:t=[],"data-silos":e=[],identifiers:r=[]},n,i=!1){let s=await Bi(n),o=_chunkOMVVROKBcjs.e.call(void 0, s,"name"),p=_chunkOMVVROKBcjs.j.call(void 0, [..._chunkOMVVROKBcjs.a.call(void 0, t.map(u=>[u["input-identifier"],...u["output-identifiers"]])),..._chunkOMVVROKBcjs.a.call(void 0, e.map(u=>u["identity-keys"])),...r.map(({name:u})=>u)]).filter(u=>!!u),c=_chunkOMVVROKBcjs.c.call(void 0, p,s.map(({name:u})=>u));if(c.length>0){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating ${c.length} new identifiers...`));let{newIdentifierTypes:u}=await l(n,Un),m=u.map(({name:d})=>d);await _bluebird.mapSeries.call(void 0, c,async d=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating identifier ${d}...`));let{createIdentifier:f}=await l(n,Bn,{input:{name:d,type:m.includes(d)?d:"custom",skipPublish:i}});_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Created identifier ${d}!`)),o[d]=f.identifier})}return o}var Qi=20;async function xr(t){let e=[],r=0,n=!1;do{let{promptGroups:{nodes:i}}=await l(t,_o,{first:Qi,offset:r});e.push(...i),r+=Qi,n=i.length===Qi}while(n);return e.sort((i,s)=>i.title.localeCompare(s.title))}var Vi=20;async function Dr(t){let e=[],r=0,n=!1;do{let{promptPartials:{nodes:i}}=await l(t,ko,{first:Vi,offset:r});e.push(...i),r+=Vi,n=i.length===Vi}while(n);return e.sort((i,s)=>i.title.localeCompare(s.title))}var Ki=20;async function $t(t,{text:e,titles:r=[],ids:n=[]}={}){let i=[],s=0,o=!1;do{let{prompts:{nodes:p}}=await l(t,Lo,{first:Ki,offset:s,filterBy:{...e?{text:e}:{},...r.length>0?{title:r}:{},...n.length>0?{id:n}:{}}});i.push(...p),s+=Ki,o=p.length===Ki}while(o);return i.sort((p,c)=>p.title.localeCompare(c.title))}async function wI(t,{promptTitles:e=[],promptIds:r=[]}={}){let{promptsWithVariables:n}=await l(t,Oo,{input:{...e.length>0?{promptTitles:e}:{},...r.length>0?{promptIds:r}:{}}});return n}var ji=20;async function qI(t,e){let r=[],n=0,i=!1;do{let{promptThreads:{nodes:s}}=await l(t,go,{first:ji,offset:n,filterBy:e});r.push(...s),n+=ji,i=s.length===ji}while(i);return r.sort((s,o)=>s.threadId.localeCompare(o.threadId))}async function np(t,{requestId:e,dataSiloId:r,requestStatuses:n,statuses:i}){let{requestDataSilos:{totalCount:s}}=await l(t,Hr,{first:1,offset:0,filterBy:{dataSiloId:r,requestId:e,status:i,requestStatus:n}});return s}var Yi=100;async function Zi(t,{requestId:e,dataSiloId:r,requestStatuses:n,statuses:i,limit:s,onProgress:o}){let p=[],c=0,u=!1;do{let{requestDataSilos:{nodes:m}}=await l(t,Hr,{first:Yi,offset:c,filterBy:{dataSiloId:r,requestId:e,status:i,requestStatus:n}});p.push(...m),c+=Yi,u=m.length===Yi,_optionalChain([o, 'optionalCall', _5 => _5(m.length)])}while(u&&(!s||c<s));return p}async function op(t,{requestId:e,dataSiloId:r}){let n=await Zi(t,{requestId:e,dataSiloId:r});if(n.length!==1)throw new Error(`Failed to find RequestDataSilo with requestId:${e},dataSiloId:${r}`);return n[0]}async function NI(t,{dataSiloId:e}){let{listReducedRequestsForDataSilo:{totalCount:r}}=await l(t,Ko,{input:{dataSiloId:e,isResolved:!1}});return r}async function BI(t,e,r){let n=[],i=null,s=!1;do{let o=await l(t,es,{filterBy:{...r},first:e,after:_nullishCoalesce(i, () => (void 0))}),{bulkRequestFiles:{nodes:p,pageInfo:c}}=o;n.push(...p),s=c.hasNextPage,i=c.endCursor}while(s);return n.sort((o,p)=>o.remoteId.localeCompare(p.remoteId))}async function jI(t,{email:e,password:r}){let{determineLoginMethod:{loginMethod:n}}=await l(t,ii,{email:e}),i=await t.rawRequest(ea,{email:e,password:r,publicKey:n.sombraPublicKey}),{login:{user:s}}=i.data,o=i.headers.get("set-cookie");if(!o||!o.includes("laravel"))throw new Error("Failed to get login cookie in response");return{roles:s.roles,loginCookie:o}}async function YI(t,{email:e,roleId:r}){let{determineLoginMethod:{loginMethod:n}}=await l(t,ii,{email:e,userId:r});await t.rawRequest(ta,{id:r,publicKey:n.sombraPublicKey})}async function HI(t,e){let{createApiKey:{apiKey:r}}=await l(t,Hn,{input:e});return r}async function JI(t,e){await l(t,Jn,{id:e})}var Iu=V.type({dependsOnQuestionReferenceId:V.string,comparisonOperator:V.union([V.literal(_privacytypes.ComparisonOperator.IsEqualTo),V.literal(_privacytypes.ComparisonOperator.IsNotEqualTo),V.literal(_privacytypes.ComparisonOperator.IsOneOf),V.literal(_privacytypes.ComparisonOperator.IsNotOneOf),V.literal(_privacytypes.ComparisonOperator.Contains)]),comparisonOperands:V.array(V.string)}),Tu= exports.Pd =V.type({dependsOnQuestionReferenceId:V.string,comparisonOperator:V.union([V.literal(_privacytypes.ComparisonOperator.IsNotShown),V.literal(_privacytypes.ComparisonOperator.IsShown)])}),ap= exports.Qd =V.union([Iu,Tu]),Pu= exports.Rd =V.recursion("AssessmentNestedRule",t=>V.intersection([V.type({logicOperator:_typeutils.valuesOf.call(void 0, _privacytypes.LogicOperator)}),V.partial({rules:V.array(ap),nestedRules:V.array(t)})])),Eu= exports.Sd =V.partial({action:_typeutils.valuesOf.call(void 0, _privacytypes.AssessmentsDisplayLogicAction),rule:ap,nestedRule:Pu});function zi(t){return _typeutils.decodeCodec.call(void 0, Eu,t)}var $u=be.intersection([be.partial({riskAssignment:be.partial({riskLevelId:be.string,riskMatrixRowId:be.string,riskMatrixColumnId:be.string})}),be.type({comparisonOperands:be.array(be.string),comparisonOperator:_typeutils.valuesOf.call(void 0, _privacytypes.ComparisonOperator)})]);function Wi(t){return _typeutils.decodeCodec.call(void 0, $u,t)}var Hi=20;async function cp(t,{titles:e,pageSize:r,ids:n=[],gql:i=vn,integrationNames:s=[]}){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Fetching ${n.length===0?"all":n.length} Data Silos...`));let o=[],p=0,c=!1;do{let{dataSilos:{nodes:u}}=await l(t,i,{filterBy:{ids:n.length>0?n:void 0,type:s.length>0?s:void 0,titles:e},first:r,offset:p});o.push(...u),p+=r,c=u.length===r}while(c);return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Found a total of ${o.length} data silo${n.length>0?` matching IDs ${n.join(",")}`:""}s${s.length>0?` matching integrationNames ${s.join(",")}`:""}`)),o.sort((u,m)=>u.title.localeCompare(m.title))}async function Du(t,e,{debug:r,includeGuessedCategories:n,pageSize:i}){let s=[],o=0,p=!1;do try{r&&_chunkZUNVPK23cjs.a.log(_colors2.default.magenta(`Pulling in subdatapoints for offset ${o}`));let{subDataPoints:{nodes:c}}=await l(t,n?Dn:xn,{first:i,filterBy:{dataPoints:[e]},offset:o});s.push(...c),o+=i,p=c.length===i,r&&_chunkZUNVPK23cjs.a.log(_colors2.default.green(`Pulled in subdatapoints for offset ${o} for dataPointId=${e}`))}catch(c){throw _chunkZUNVPK23cjs.a.error(_colors2.default.red(`An error fetching subdatapoints for offset ${o} for dataPointId=${e}`)),c}while(p);return _chunkOMVVROKBcjs.g.call(void 0, s,"name")}async function qu(t,e,{debug:r,pageSize:n,skipSubDatapoints:i,includeGuessedCategories:s}){let o=[],p=0,c=!1;do{r&&_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Fetching datapoints with offset: ${p}`));let{dataPoints:{nodes:u}}=await l(t,$n,{first:n,filterBy:{dataSilos:[e]},offset:p});r&&_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Fetched ${u.length} datapoints at offset: ${p}`)),i||(await _bluebird.map.call(void 0, u,async m=>{try{r&&_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Fetching subdatapoints for ${m.name} for datapoint offset ${p}`));let d=await Du(t,m.id,{pageSize:1e3,debug:r,includeGuessedCategories:s});o.push({...m,subDataPoints:d.sort((f,g)=>f.name.localeCompare(g.name))}),r&&_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully fetched subdatapoints for ${m.name}`))}catch(d){throw _chunkZUNVPK23cjs.a.error(_colors2.default.red(`An error fetching subdatapoints for ${m.name} datapoint offset ${p}`)),d}},{concurrency:5}),r&&_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Fetched all subdatapoints for page of datapoints at offset: ${p}`))),p+=n,c=u.length===n}while(c);return o.sort((u,m)=>u.name.localeCompare(m.name))}async function up(t,{ids:e,pageSize:r,titles:n,debug:i,skipDatapoints:s,skipSubDatapoints:o,includeGuessedCategories:p,integrationNames:c}){let u=[],m=await cp(t,{titles:n,ids:e,integrationNames:c,pageSize:r,gql:Ln});return s||await _bluebird.mapSeries.call(void 0, m,async(d,f)=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`[${f+1}/${m.length}] Fetching data silo - ${d.title}`));let g=await qu(t,d.id,{debug:i,pageSize:r,skipSubDatapoints:o,includeGuessedCategories:p});i&&_chunkZUNVPK23cjs.a.info(_colors2.default.green(`[${f+1}/${m.length}] Successfully fetched datapoint for - ${d.title}`)),u.push([d,g])}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully fetched all ${m.length} data silo configurations`)),u}async function mp(t,e,{pageSize:r,dataSubjectsByName:n,apiKeysByTitle:i}){let s=!1,o=new Date().getTime();_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${t.length}" data silos...`));let p=await cp(e,{titles:t.map(({title:I})=>I),pageSize:r}),c=_chunkOMVVROKBcjs.e.call(void 0, p,"title"),u=t.filter(({title:I})=>!c[I]);if(u.length>0){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating "${u.length}" data silos that did not exist...`));let I=_chunkOMVVROKBcjs.b.call(void 0, u,Hi);await _bluebird.mapSeries.call(void 0, I,async L=>{let{createDataSilos:{dataSilos:C}}=await l(e,kn,{input:L.map(O=>({name:O["outer-type"]||O.integrationName,title:O.title,country:O.country,countrySubDivision:O.countrySubDivision}))});C.forEach(O=>{c[O.title]=O})}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created "${u.length}" data silos!`))}let m=_chunkOMVVROKBcjs.b.call(void 0, t,Hi);await _bluebird.mapSeries.call(void 0, m,async(I,L)=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`[Batch ${L+1}/${m.length}] Syncing "${I.length}" data silos`)),await l(e,Vr,{input:{dataSilos:I.map(C=>({id:c[C.title].id,country:C.country,countrySubDivision:C.countrySubDivision,url:C.url,headers:C.headers,description:C.description,identifiers:C["identity-keys"],isLive:!C.disabled,ownerEmails:C.owners,teamNames:C.teams,dependedOnDataSiloTitles:C["deletion-dependencies"]?void 0:[],apiKeyId:C["api-key-title"]?i[C["api-key-title"]].id:void 0,dataSubjectBlockListIds:C["data-subjects"]?tp(C["data-subjects"],n):void 0,attributes:C.attributes,businessEntityTitles:C.businessEntityTitles,notifyEmailAddress:_optionalChain([C, 'access', _6 => _6["email-settings"], 'optionalAccess', _7 => _7["notify-email-address"]]),promptAVendorEmailSendFrequency:_optionalChain([C, 'access', _8 => _8["email-settings"], 'optionalAccess', _9 => _9["send-frequency"]]),promptAVendorEmailSendType:_optionalChain([C, 'access', _10 => _10["email-settings"], 'optionalAccess', _11 => _11["send-type"]]),promptAVendorEmailIncludeIdentifiersAttachment:_optionalChain([C, 'access', _12 => _12["email-settings"], 'optionalAccess', _13 => _13["include-identifiers-attachment"]]),promptAVendorEmailCompletionLinkType:_optionalChain([C, 'access', _14 => _14["email-settings"], 'optionalAccess', _15 => _15["completion-link-type"]]),manualWorkRetryFrequency:_optionalChain([C, 'access', _16 => _16["email-settings"], 'optionalAccess', _17 => _17["manual-work-retry-frequency"]])}))}}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`[Batch ${L+1}/${m.length}] Synced "${I.length}" data silos!`))});let d=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),f=t.filter(({datapoints:I=[]})=>I.length>0),g=t.map(({datapoints:I=[]})=>I.length).reduce((I,L)=>I+L,0);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${g}" datapoints from "${f.length}" data silos...`)),d.start(g,0);let y=0;await _bluebird.map.call(void 0, f,async({datapoints:I,title:L})=>{I&&await _bluebird.mapSeries.call(void 0, I,async C=>{let O=C.fields?C.fields.map(({key:J,description:me,categories:ce,purposes:X,attributes:Ae,...Ie})=>({name:J,description:me,categories:ce?ce.map(pe=>({...pe,name:pe.name||"Other"})):void 0,purposes:X?X.map(pe=>({...pe,name:pe.name||"Other"})):void 0,attributes:Ae,accessRequestVisibilityEnabled:Ie["access-request-visibility-enabled"],erasureRequestRedactionEnabled:Ie["erasure-request-redaction-enabled"]})):void 0,H={dataSiloId:c[L].id,path:C.path,name:C.key,title:C.title,description:C.description,...C.owners?{ownerEmails:C.owners}:{},...C.teams?{teamNames:C.teams}:{},...C["data-collection-tag"]?{dataCollectionTag:C["data-collection-tag"]}:{},querySuggestions:C["privacy-action-queries"]?Object.entries(C["privacy-action-queries"]).map(([J,me])=>({requestType:J,suggestedQuery:me})):void 0,enabledActions:C["privacy-actions"]||[],subDataPoints:O},K=(H.subDataPoints||[]).map(({name:J})=>J),se=K.filter((J,me)=>K.indexOf(J)!==me);if(se.length>0)_chunkZUNVPK23cjs.a.info(_colors2.default.red(`
|
|
2984
|
+
`;var _typeutils = require('@transcend-io/type-utils');var _internationalization = require('@transcend-io/internationalization');var _privacytypes = require('@transcend-io/privacy-types');var _iots = require('io-ts'); var q = _interopRequireWildcard(_iots); var dt = _interopRequireWildcard(_iots); var ka = _interopRequireWildcard(_iots); var Je = _interopRequireWildcard(_iots); var P = _interopRequireWildcard(_iots); var V = _interopRequireWildcard(_iots); var be = _interopRequireWildcard(_iots); var ae = _interopRequireWildcard(_iots); var x = _interopRequireWildcard(_iots); var re = _interopRequireWildcard(_iots); var Xt = _interopRequireWildcard(_iots); var Ye = _interopRequireWildcard(_iots); var ql = _interopRequireWildcard(_iots);var Y="[NONE]",Kt= exports.dc ="[APPLY VALUE TO ALL ROWS]",ui= exports.ec ="<blank>",pr= exports.fc =["email","coreIdentifier"],At= exports.gc =(m=>(m.Email="email",m.CoreIdentifier="coreIdentifier",m.RequestType="requestType",m.SubjectType="subjectType",m.Locale="locale",m.Country="country",m.CountrySubDivision="countrySubDivision",m.RequestStatus="requestStatus",m.CreatedAt="createdAt",m.DataSiloIds="dataSiloIds",m))(At||{}),Ra= exports.hc ={email:!1,coreIdentifier:!0,requestType:!0,subjectType:!0,requestStatus:!1,createdAt:!1,dataSiloIds:!1,locale:!1,country:!1,countrySubDivision:!1},ba= exports.ic ={requestType:!0,subjectType:!0},wa= exports.jc =q.type({columnNames:q.partial(_typeutils.applyEnum.call(void 0, At,()=>q.string)),identifierNames:q.record(q.string,q.string),attributeNames:q.record(q.string,q.string),requestTypeToRequestAction:q.record(q.string,_typeutils.valuesOf.call(void 0, _privacytypes.RequestAction)),subjectTypeToSubjectName:q.record(q.string,q.string),languageToLocale:q.record(q.string,_typeutils.valuesOf.call(void 0, _internationalization.LOCALE_KEY)),regionToCountry:q.record(q.string,_typeutils.valuesOf.call(void 0, {..._privacytypes.IsoCountryCode,[Y]:Y})),regionToCountrySubDivision:q.record(q.string,_typeutils.valuesOf.call(void 0, {..._privacytypes.IsoCountrySubdivisionCode,[Y]:Y})),statusToRequestStatus:q.record(q.string,_typeutils.valuesOf.call(void 0, {..._privacytypes.CompletedRequestStatus,[Y]:Y}))}),lr= exports.kc =q.type({id:q.string,link:q.string,rowIndex:q.number,coreIdentifier:q.string,attemptedAt:q.string}),$a= exports.lc =q.type({failingRequests:q.array(q.record(q.string,q.any)),successfulRequests:q.array(lr),duplicateRequests:q.array(q.type({rowIndex:q.number,coreIdentifier:q.string,attemptedAt:q.string}))});var _inquirer = require('inquirer'); var _inquirer2 = _interopRequireDefault(_inquirer);var _fuzzysearch = require('fuzzysearch'); var _fuzzysearch2 = _interopRequireDefault(_fuzzysearch);function It(t,e){return _fuzzysearch2.default.call(void 0, t.toLowerCase(),e.toLowerCase())||_fuzzysearch2.default.call(void 0, e.toLowerCase(),t.toLowerCase())}function Tt(t,e,r,n){let i=t.filter(s=>It(e.toLowerCase(),s.toLowerCase()));return[...i,new _inquirer2.default.Separator,...r?[]:[Y],...n?[Kt]:[],...t.filter(s=>!i.includes(s))]}var _inquirerautocompleteprompt = require('inquirer-autocomplete-prompt'); var _inquirerautocompleteprompt2 = _interopRequireDefault(_inquirerautocompleteprompt);async function mt(t,e,r){_inquirer2.default.registerPrompt("autocomplete",_inquirerautocompleteprompt2.default);let n=t.map(s=>s||"<blank>").filter(s=>!r[s]);if(n.length===0)return r;let i=await _inquirer2.default.prompt(n.map(s=>({name:s,message:`Map value of: ${s}`,type:"autocomplete",default:e.find(o=>It(s,o)),source:(o,p)=>p?e.filter(c=>typeof c=="string"&&It(p,c)):e})));return{...r,..._typeutils.apply.call(void 0, i,s=>typeof s=="string"?s:Object.values(s)[0])}}function mi(t){return t.split(",").map(e=>e.trim()).filter(e=>e)}var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var va=dt.type({key:dt.string,values:dt.array(dt.string)});function La(t){let e=t.map(r=>{let[n,i]=r.trim().split(":");if(!i)throw new Error("Expected attributes in key:value1;value2,key2:value3;value4");let s=i.split(";");return{key:n,values:s}});return _chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Attributes to apply to all requests:")),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(JSON.stringify(e,null,2))),e}var _sync = require('csv-parse/sync');var _fs = require('fs');function _a(t,e,r={columns:!0}){let n=_sync.parse.call(void 0, _fs.readFileSync.call(void 0, t,"utf-8"),r);return _typeutils.decodeCodec.call(void 0, ka.array(e),n).map(o=>Object.entries(o).reduce((p,[c,u])=>Object.assign(p,{[c.replace(/[^a-z_.+\-A-Z -~]/g,"")]:u}),{}))}function He(t,e){return _chunkXXFLFF7Qcjs.j.call(void 0, t.map(r=>r[e]||"").flat())}async function Ga(t){let e=_chunkXXFLFF7Qcjs.j.call(void 0, t.map(i=>Object.keys(i)).flat()),r=t,n=!0;for(;n;){let{filterColumnName:i}=await _inquirer2.default.prompt([{name:"filterColumnName",message:`If you need to filter the list of requests to import, choose the column to filter on. Currently ${r.length} rows.`,type:"list",default:e,choices:[Y,...e]}]);if(n=Y!==i,n){let s=He(r,i),{valuesToKeep:o}=await _inquirer2.default.prompt([{name:"valuesToKeep",message:"Keep rows matching this value",type:"checkbox",default:e,choices:s}]);r=r.filter(p=>o.includes(p[i]))}}return _chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Importing ${r.length} requests`)),r}var _bluebird = require('bluebird');function Vc(t,e){return new (0, _graphqlrequest.GraphQLClient)(`${t}/graphql`,{headers:{...e,version:_chunkXXFLFF7Qcjs.m}})}function Z(t,e){return Vc(t,{Authorization:`Bearer ${e}`})}var _got = require('got'); var _got2 = _interopRequireDefault(_got);async function nt(t,e,r){let n=Z(t,e),{organization:i}=await l(n,so),{customerUrl:s}=i.sombra;if(["https://sombra-reverse-tunnel.transcend.io","https://sombra-reverse-tunnel.us.transcend.io"].includes(s))throw new Error("It looks like your Sombra customer ingress URL has not been set up. Please follow the instructions here to configure networking for Sombra: https://docs.transcend.io/docs/articles/sombra/deploying/customizing-sombra/networking");return _got2.default.extend({prefixUrl:s,headers:{Authorization:`Bearer ${e}`,...r?{"X-Sombra-Authorization":`Bearer ${r}`}:{}}})}function IC(t){return _got2.default.extend({prefixUrl:t})}async function RC(t,{id:e,bundleType:r}){await l(t,$s,{airgapBundleId:e,bundleType:r})}async function bC(t,{id:e,bundleType:r}){await l(t,ws,{airgapBundleId:e,bundleType:r})}async function qC(t,e){let r=await l(t,ro,{dataSiloId:e,type:"DATA_SILO_DISCOVERY"}),{plugins:n,totalCount:i}=r.plugins;return i===0&&(_chunkZUNVPK23cjs.a.error("No active data silo plugins found for this data silo."),process.exit(1)),n[0]}var di=20;async function cr(t,e={}){let r=[],n=0,i=!1;do{let{globalActionItems:{nodes:s}}=await l(t,Ys,{first:di,offset:n,filterBy:{...e,...e.startDueDate?{startDueDate:e.startDueDate.toISOString()}:{},...e.endDueDate?{endDueDate:e.endDueDate.toISOString()}:{}}});r.push(...s.map(o=>({...o,id:o.ids[0],title:o.titles[0],notes:o.notes[0],link:o.links[0]}))),n+=di,i=s.length===di}while(i);return r}var fi=20;async function ur(t){let e=[],r=0,n=!1;do{let{actions:{nodes:i}}=await l(t,Ks,{first:fi,offset:r});e.push(...i),r+=fi,n=i.length===fi}while(n);return e.sort((i,s)=>i.type.localeCompare(s.type))}var gi=20;async function mr(t,e={}){let r=[],n=0,i=!1;do{let{agentFiles:{nodes:s}}=await l(t,oa,{first:gi,offset:n,filterBy:e});r.push(...s),n+=gi,i=s.length===gi}while(i);return r.sort((s,o)=>s.name.localeCompare(o.name))}var yi=20;async function dr(t){let e=[],r=0,n=!1;do{let{agentFunctions:{nodes:i}}=await l(t,pa,{first:yi,offset:r});e.push(...i.map(s=>({...s,parameters:JSON.parse(s.parameters)}))),r+=yi,n=i.length===yi}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}var hi=20;async function fr(t,e={}){let r=[],n=0,i=!1;do{let{agents:{nodes:s}}=await l(t,ra,{first:hi,offset:n,filterBy:e});r.push(...s),n+=hi,i=s.length===hi}while(i);return r.sort((s,o)=>s.name.localeCompare(o.name))}var Ci=20;async function Na(t){let e=[],r=0,n=!1;do{let{assessmentForms:{nodes:i}}=await l(t,xo,{first:Ci,offset:r});e.push(...i),r+=Ci,n=i.length===Ci}while(n);return e.sort((i,s)=>i.title.localeCompare(s.title))}var Si=20;async function Ma(t){let e=[],r=0,n=!1;do{let{assessmentFormTemplates:{nodes:i}}=await l(t,vo,{first:Si,offset:r});e.push(...i),r+=Si,n=i.length===Si}while(n);return e.sort((i,s)=>i.title.localeCompare(s.title))}var Zc=50;async function zc(t,e){let{createPrivacyCenterAccessTokens:{nodes:r}}=await l(t,Xn,{input:{records:e}});return r.map(n=>n.token)}async function nS(t,e,r,n=10){let i=0;r&&r(0);let s=[];return await _bluebird.map.call(void 0, _chunkXXFLFF7Qcjs.b.call(void 0, e,Zc),async o=>{let c=(await zc(t,o.map(({index:u,...m})=>m))).map((u,m)=>({input:o[m],accessToken:u}));s.push(...c),i+=o.length,r&&r(i)},{concurrency:n}),s}var Ai=20;async function Fa(t){let e=[],r=0,n=!1;do{let{attributeKeys:{nodes:i}}=await l(t,ao,{first:Ai,offset:r});e.push(...i),r+=Ai,n=i.length===Ai}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}var Pt=100;async function Wc(t,e){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Fetching all attribute values for ${e}...`));let r=[],n=0,i=!1;do{let{attributeValues:{nodes:s}}=await l(t,us,{first:Pt,offset:n,attributeKeyId:e});r.push(...s),n+=Pt,i=s.length===Pt}while(i);return r.sort((s,o)=>s.name.localeCompare(o.name))}var Hc=[_privacytypes.AttributeKeyType.MultiSelect,_privacytypes.AttributeKeyType.SingleSelect];async function Et(t){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Fetching all attributes..."));let e=[],r=0,n=!1;do{let{attributeKeys:{nodes:i}}=await l(t,as,{first:Pt,offset:r});e.push(...await Promise.all(i.map(async s=>({...s,values:Hc.includes(s.type)?await Wc(t,s.id):[]})))),r+=Pt,n=i.length===Pt}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}var Ii=20;async function gr(t){let e=[],r=0,n=!1;do{let{businessEntities:{nodes:i}}=await l(t,Us,{first:Ii,offset:r});e.push(...i),r+=Ii,n=i.length===Ii}while(n);return e.sort((i,s)=>i.title.localeCompare(s.title))}async function Qa(t){let{consentManager:{consentManager:e}}=await l(t,Ps);return e}async function De(t,e){let{consentManager:{consentManager:r}}=await l(t,Ts,{},{},e);return r.id}var Ti=50;async function yr(t){let e=[],r=0,n=!1;do{let{experiences:{nodes:i}}=await l(t,gs,{first:Ti,offset:r});e.push(...i),r+=Ti,n=i.length===Ti}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}var Jc=(r=>(r.Hourly="1h",r.Daily="1d",r))(Jc||{});async function IS(t,e){let{analyticsData:{series:r}}=await l(t,Fs,{input:e});return r}async function Va(t,e){let{consentManagerTheme:{theme:r}}=await l(t,Es,{airgapBundleId:e});return r}var Pi=20;async function Ei(t,e=_privacytypes.ConsentTrackerStatus.Live){let r=[],n=0,i=await De(t),s=!1;do{let{cookies:{nodes:o}}=await l(t,Is,{first:Pi,offset:n,airgapBundleId:i,status:e});r.push(...o),n+=Pi,s=o.length===Pi}while(s);return r.sort((o,p)=>o.name.localeCompare(p.name))}var Ri=20;async function hr(t){let e=[],r=0,n=!1;do{let{dataSubCategories:{nodes:i}}=await l(t,fa,{first:Ri,offset:r});e.push(...i),r+=Ri,n=i.length===Ri}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}var bi=20;async function Rt(t,e=_privacytypes.ConsentTrackerStatus.Live){let r=[],n=0,i=await De(t),s=!1;do{let{dataFlows:{nodes:o}}=await l(t,As,{first:bi,offset:n,airgapBundleId:i,status:e,...e===_privacytypes.ConsentTrackerStatus.NeedsReview?{showZeroActivity:!0}:{}});r.push(...o),n+=bi,s=o.length===bi}while(s);return r.sort((o,p)=>o.value.localeCompare(p.value))}async function ja(t){let{translatedMessages:e}=await l(t,Po,{});return e}async function jt(t){let{organization:e}=await l(t,Hs);return e.deployedPrivacyCenterUrl}async function bt(t,e){let r=e;r||(r=await jt(t));let{privacyCenter:n}=await l(t,Ws,{url:r});return n.id}async function Cr(t){let e=await jt(t),{privacyCenterPolicies:r}=await l(t,ho,{url:e});return r.sort((n,i)=>n.title.defaultMessage.localeCompare(i.title.defaultMessage))}function Le(t){let e=[];return t.map(r=>{let n=e.find(i=>i.key===r.attributeKey.name);return n===void 0?(n={key:r.attributeKey.name,values:[r.name]},e.push(n)):n.values.push(r.name),e}),e}var wi=20;async function Ya(t){let e=[],r=0,n=!1;do{let{preferenceTopics:{nodes:i}}=await l(t,qo,{first:wi,offset:r});e.push(...i),r+=wi,n=i.length===wi}while(n);return e.sort((i,s)=>`${i.slug}:${i.purpose.trackingType}`.localeCompare(`${s.slug}:${s.purpose.trackingType}`))}async function Za(t){let e=await jt(t),{privacyCenter:{themeStr:r,...n}}=await l(t,Js,{url:e});return[{...n,theme:JSON.parse(r)}]}var $i=20;async function Sr(t){let e=[],r=0,n=!1;do{let{processingActivities:{nodes:i}}=await l(t,Aa,{first:$i,offset:r});e.push(...i),r+=$i,n=i.length===$i}while(n);return e.sort((i,s)=>i.title.localeCompare(s.title))}var xi=20;async function Ar(t){let e=[],r=0,n=!1;do{let{processingPurposeSubCategories:{nodes:i}}=await l(t,ha,{first:xi,offset:r});e.push(...i),r+=xi,n=i.length===xi}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}var Di=20;async function Ir(t,{includeDeleted:e=!1}={}){let r=[],n=0,i=!1;do{let{purposes:{nodes:s}}=await l(t,Do,{first:Di,offset:n,input:{includeDeleted:e}});r.push(...s),n+=Di,i=s.length===Di}while(i);return r.sort((s,o)=>s.trackingType.localeCompare(o.trackingType))}async function za(t){let[e,r]=await Promise.all([Ir(t),Ya(t)]);return e.map(n=>{let i=r.filter(s=>s.purpose.trackingType===n.trackingType);return{...n,topics:i}})}var qi=50;async function Tr(t,{requestId:e}){let r=[],n=0,i=!1;do{let{requestEnrichers:{nodes:s}}=await l(t,Ro,{first:qi,offset:n,requestId:e});r.push(...s),n+=qi,i=s.length===qi}while(i);return r}var vi=50;async function Wa(t,{requestId:e}){let r=[],n=0,i=!1;do{let{requestIdentifiers:{nodes:s}}=await l(t,Ho,{first:vi,offset:n,requestIds:[e]});r.push(...s),n+=vi,i=s.length===vi}while(i);return r}var _semver = require('semver'); var _semver2 = _interopRequireDefault(_semver);var Ha="7.180.0",nu=Je.type({id:Je.string,name:Je.string,value:Je.string,type:_typeutils.valuesOf.call(void 0, _privacytypes.IdentifierType)}),Li=50,ou= exports.kd =Je.type({identifiers:Je.array(nu)});async function Pr(t,e,{requestId:r}){let n=[],i=0,s=!1,{organization:{sombra:{version:o}}}=await l(t,Pa);if(o&&_semver2.default.lt(o,Ha))throw new Error(`Please upgrade Sombra to ${Ha} or greater to use this command.`);do{let p;try{p=await e.post("v1/request-identifiers",{json:{first:Li,offset:i,requestId:r}}).json()}catch(u){throw new Error(`Failed to fetch request identifiers: ${_optionalChain([u, 'optionalAccess', _2 => _2.response, 'optionalAccess', _3 => _3.body])||_optionalChain([u, 'optionalAccess', _4 => _4.message])}`)}let{identifiers:c}=_typeutils.decodeCodec.call(void 0, ou,p);n.push(...c),i+=Li,s=c.length===Li}while(s);return n}var _cliprogress = require('cli-progress'); var _cliprogress2 = _interopRequireDefault(_cliprogress);var mu=P.type({title:P.string,name:P.string,consent:P.boolean,enrichedPreferences:P.array(P.type({topic:P.string,selectValues:P.array(P.type({id:P.string,name:P.string,preferenceOption:P.type({id:P.string,slug:P.string,title:P.type({defaultMessage:P.string})})})),selectValue:P.type({id:P.string,name:P.string}),preferenceTopic:P.type({title:P.type({defaultMessage:P.string}),id:P.string,slug:P.string}),name:P.string,id:P.string,booleanValue:P.boolean}))}),GA= exports.nd =P.intersection([P.type({id:P.string,createdAt:P.string,email:P.string,type:_typeutils.valuesOf.call(void 0, _privacytypes.RequestAction),link:P.string,isSilent:P.boolean,origin:_typeutils.valuesOf.call(void 0, _privacytypes.RequestOrigin),isTest:P.boolean,coreIdentifier:P.string,details:P.string,locale:_typeutils.valuesOf.call(void 0, _internationalization.LOCALE_KEY),status:_typeutils.valuesOf.call(void 0, _privacytypes.RequestStatus),subjectType:P.string,country:P.union([P.null,_typeutils.valuesOf.call(void 0, _privacytypes.IsoCountryCode)]),countrySubDivision:P.union([P.null,_typeutils.valuesOf.call(void 0, _privacytypes.IsoCountrySubdivisionCode)]),attributeValues:P.array(P.type({id:P.string,attributeKey:P.type({name:P.string,id:P.string}),name:P.string}))}),P.partial({daysRemaining:P.union([P.null,P.number]),purpose:mu})]),Rr=50;async function le(t,{actions:e=[],statuses:r=[],origins:n=[],text:i,createdAtBefore:s,createdAtAfter:o,isTest:p,isSilent:c,isClosed:u,requestIds:m=[]}={}){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Fetching requests..."));let d=new Date().getTime(),f=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),g=[],y=0,S=!1;do{let{requests:{nodes:C,totalCount:O}}=await l(t,So,{first:Rr,offset:y,filterBy:{text:i,type:e.length>0?e:void 0,status:r.length>0?r:void 0,origin:n.length>0?n:void 0,isTest:p,isSilent:c,isClosed:u,createdAtBefore:s?s.toISOString():void 0,createdAtAfter:o?o.toISOString():void 0}});y===0&&O>Rr&&(_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Fetching ${O} requests`)),f.start(O,0)),g.push(...C),y+=Rr,f.update(y),S=C.length===Rr}while(S);f.stop();let I=new Date().getTime()-d;_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Completed fetching of ${g.length} request in "${I/1e3}" seconds.`));let L=g;return m&&m.length>0&&(L=L.filter(C=>m.includes(C.id)),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Filtered down to ${L.length} requests based on ${m.length} provided IDs.`))),L}var ki=20;async function br(t){let e=[],r=0,n=!1;do{let{teams:{nodes:i}}=await l(t,jo,{first:ki,offset:r});e.push(...i),r+=ki,n=i.length===ki}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}var _i=20;async function VA(t){let e=[],r=0,n=!1;do{let{users:{nodes:i}}=await l(t,Jo,{first:_i,offset:r});e.push(...i),r+=_i,n=i.length===_i}while(n);return e.sort((i,s)=>i.email.localeCompare(s.email))}var Oi=20;async function wr(t){let e=[],r=0,n=!1;do{let{vendors:{nodes:i}}=await l(t,ua,{first:Oi,offset:r});e.push(...i),r+=Oi,n=i.length===Oi}while(n);return e.sort((i,s)=>i.title.localeCompare(s.title))}var Gi=20,du="https://app.transcend.io/infrastructure/api-keys";async function fu(t,e){let r=[],n=0,i=!1;do{let{apiKeys:{nodes:s}}=await l(t,Wn,{first:Gi,offset:n,titles:e});r.push(...s),n+=Gi,i=s.length===Gi}while(i);return r.sort((s,o)=>s.title.localeCompare(o.title))}async function $r({"api-keys":t=[],"data-silos":e=[]},r,n=!1){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Fetching ${n?"all":t.length} API keys...`));let i=t.map(({title:m})=>m),s=_chunkXXFLFF7Qcjs.j.call(void 0, e.map(m=>m["api-key-title"]).filter(m=>!!m)),o=[...s,...i],p=await fu(r,n?void 0:[...s,...i]),c=_chunkXXFLFF7Qcjs.e.call(void 0, p,"title"),u=_chunkXXFLFF7Qcjs.c.call(void 0, o,p.map(({title:m})=>m));return u.length>0&&(_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to find API keys "${u.join('", "')}"! Make sure these API keys are created at: ${du}`)),process.exit(1)),c}var Ni=100;async function gu(t){let e=[],r=0,n=!1;do{let{catalogs:{nodes:i}}=await l(t,Mn,{first:Ni,offset:r});e.push(...i),r+=Ni,n=i.length===Ni}while(n);return e.sort((i,s)=>i.integrationName.localeCompare(s.integrationName))}async function iI(t){let e=await gu(t),r=e.reduce((i,s)=>Object.assign(i,{[s.integrationName]:s.title}),{}),n=e.reduce((i,s)=>Object.assign(i,{[s.integrationName]:s.hasApiFunctionality}),{});return{catalogs:e,serviceToTitle:r,serviceToSupportedIntegration:n}}async function Yt(t){let{internalSubjects:e}=await l(t,nr);return e}async function ep({"data-silos":t=[],"data-subjects":e=[],"processing-activities":r=[],enrichers:n=[]},i,s=!1){let o=_chunkXXFLFF7Qcjs.j.call(void 0, [..._chunkXXFLFF7Qcjs.a.call(void 0, t.map(m=>m["data-subjects"]||[])||[]),..._chunkXXFLFF7Qcjs.a.call(void 0, _nullishCoalesce(r.map(({dataSubjectTypes:m})=>_nullishCoalesce(m, () => ([]))), () => ([]))),..._chunkXXFLFF7Qcjs.a.call(void 0, n.map(m=>m["data-subjects"]||[])||[]),...e.map(m=>m.type)]);if(o.length===0&&!s)return{};let p=await Yt(i),c=_chunkXXFLFF7Qcjs.e.call(void 0, p,"type"),u=_chunkXXFLFF7Qcjs.c.call(void 0, o,p.map(({type:m})=>m));return u.length>0&&(_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating ${u.length} new data subjects...`)),await _bluebird.mapSeries.call(void 0, u,async m=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating data subject ${m}...`));let{createSubject:d}=await l(i,Vn,{type:m,skipPublish:!0});_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Created data subject ${m}!`)),c[m]=d.subject})),c}function tp(t,e){return t.forEach(r=>{if(!e[r])throw new Error(`Expected to find data subject definition: ${r}`)}),Object.values(e).filter(r=>!t.includes(r.type)).map(({id:r})=>r)}function rp(t,e){return t.forEach(r=>{if(!e[r])throw new Error(`Expected to find data subject definition: ${r}`)}),Object.values(e).filter(r=>!t.includes(r.type)).map(({type:r})=>r)}var Ui=20;async function Bi(t){let e=[],r=0,n=!1;do{let{identifiers:{nodes:i}}=await l(t,Fn,{first:Ui,offset:r});e.push(...i),r+=Ui,n=i.length===Ui}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}async function ip({enrichers:t=[],"data-silos":e=[],identifiers:r=[]},n,i=!1){let s=await Bi(n),o=_chunkXXFLFF7Qcjs.e.call(void 0, s,"name"),p=_chunkXXFLFF7Qcjs.j.call(void 0, [..._chunkXXFLFF7Qcjs.a.call(void 0, t.map(u=>[u["input-identifier"],...u["output-identifiers"]])),..._chunkXXFLFF7Qcjs.a.call(void 0, e.map(u=>u["identity-keys"])),...r.map(({name:u})=>u)]).filter(u=>!!u),c=_chunkXXFLFF7Qcjs.c.call(void 0, p,s.map(({name:u})=>u));if(c.length>0){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating ${c.length} new identifiers...`));let{newIdentifierTypes:u}=await l(n,Un),m=u.map(({name:d})=>d);await _bluebird.mapSeries.call(void 0, c,async d=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating identifier ${d}...`));let{createIdentifier:f}=await l(n,Bn,{input:{name:d,type:m.includes(d)?d:"custom",skipPublish:i}});_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Created identifier ${d}!`)),o[d]=f.identifier})}return o}var Qi=20;async function xr(t){let e=[],r=0,n=!1;do{let{promptGroups:{nodes:i}}=await l(t,_o,{first:Qi,offset:r});e.push(...i),r+=Qi,n=i.length===Qi}while(n);return e.sort((i,s)=>i.title.localeCompare(s.title))}var Vi=20;async function Dr(t){let e=[],r=0,n=!1;do{let{promptPartials:{nodes:i}}=await l(t,ko,{first:Vi,offset:r});e.push(...i),r+=Vi,n=i.length===Vi}while(n);return e.sort((i,s)=>i.title.localeCompare(s.title))}var Ki=20;async function $t(t,{text:e,titles:r=[],ids:n=[]}={}){let i=[],s=0,o=!1;do{let{prompts:{nodes:p}}=await l(t,Lo,{first:Ki,offset:s,filterBy:{...e?{text:e}:{},...r.length>0?{title:r}:{},...n.length>0?{id:n}:{}}});i.push(...p),s+=Ki,o=p.length===Ki}while(o);return i.sort((p,c)=>p.title.localeCompare(c.title))}async function wI(t,{promptTitles:e=[],promptIds:r=[]}={}){let{promptsWithVariables:n}=await l(t,Oo,{input:{...e.length>0?{promptTitles:e}:{},...r.length>0?{promptIds:r}:{}}});return n}var ji=20;async function qI(t,e){let r=[],n=0,i=!1;do{let{promptThreads:{nodes:s}}=await l(t,go,{first:ji,offset:n,filterBy:e});r.push(...s),n+=ji,i=s.length===ji}while(i);return r.sort((s,o)=>s.threadId.localeCompare(o.threadId))}async function np(t,{requestId:e,dataSiloId:r,requestStatuses:n,statuses:i}){let{requestDataSilos:{totalCount:s}}=await l(t,Hr,{first:1,offset:0,filterBy:{dataSiloId:r,requestId:e,status:i,requestStatus:n}});return s}var Yi=100;async function Zi(t,{requestId:e,dataSiloId:r,requestStatuses:n,statuses:i,limit:s,onProgress:o}){let p=[],c=0,u=!1;do{let{requestDataSilos:{nodes:m}}=await l(t,Hr,{first:Yi,offset:c,filterBy:{dataSiloId:r,requestId:e,status:i,requestStatus:n}});p.push(...m),c+=Yi,u=m.length===Yi,_optionalChain([o, 'optionalCall', _5 => _5(m.length)])}while(u&&(!s||c<s));return p}async function op(t,{requestId:e,dataSiloId:r}){let n=await Zi(t,{requestId:e,dataSiloId:r});if(n.length!==1)throw new Error(`Failed to find RequestDataSilo with requestId:${e},dataSiloId:${r}`);return n[0]}async function NI(t,{dataSiloId:e}){let{listReducedRequestsForDataSilo:{totalCount:r}}=await l(t,Ko,{input:{dataSiloId:e,isResolved:!1}});return r}async function BI(t,e,r){let n=[],i=null,s=!1;do{let o=await l(t,es,{filterBy:{...r},first:e,after:_nullishCoalesce(i, () => (void 0))}),{bulkRequestFiles:{nodes:p,pageInfo:c}}=o;n.push(...p),s=c.hasNextPage,i=c.endCursor}while(s);return n.sort((o,p)=>o.remoteId.localeCompare(p.remoteId))}async function jI(t,{email:e,password:r}){let{determineLoginMethod:{loginMethod:n}}=await l(t,ii,{email:e}),i=await t.rawRequest(ea,{email:e,password:r,publicKey:n.sombraPublicKey}),{login:{user:s}}=i.data,o=i.headers.get("set-cookie");if(!o||!o.includes("laravel"))throw new Error("Failed to get login cookie in response");return{roles:s.roles,loginCookie:o}}async function YI(t,{email:e,roleId:r}){let{determineLoginMethod:{loginMethod:n}}=await l(t,ii,{email:e,userId:r});await t.rawRequest(ta,{id:r,publicKey:n.sombraPublicKey})}async function HI(t,e){let{createApiKey:{apiKey:r}}=await l(t,Hn,{input:e});return r}async function JI(t,e){await l(t,Jn,{id:e})}var Iu=V.type({dependsOnQuestionReferenceId:V.string,comparisonOperator:V.union([V.literal(_privacytypes.ComparisonOperator.IsEqualTo),V.literal(_privacytypes.ComparisonOperator.IsNotEqualTo),V.literal(_privacytypes.ComparisonOperator.IsOneOf),V.literal(_privacytypes.ComparisonOperator.IsNotOneOf),V.literal(_privacytypes.ComparisonOperator.Contains)]),comparisonOperands:V.array(V.string)}),Tu= exports.Pd =V.type({dependsOnQuestionReferenceId:V.string,comparisonOperator:V.union([V.literal(_privacytypes.ComparisonOperator.IsNotShown),V.literal(_privacytypes.ComparisonOperator.IsShown)])}),ap= exports.Qd =V.union([Iu,Tu]),Pu= exports.Rd =V.recursion("AssessmentNestedRule",t=>V.intersection([V.type({logicOperator:_typeutils.valuesOf.call(void 0, _privacytypes.LogicOperator)}),V.partial({rules:V.array(ap),nestedRules:V.array(t)})])),Eu= exports.Sd =V.partial({action:_typeutils.valuesOf.call(void 0, _privacytypes.AssessmentsDisplayLogicAction),rule:ap,nestedRule:Pu});function zi(t){return _typeutils.decodeCodec.call(void 0, Eu,t)}var $u=be.intersection([be.partial({riskAssignment:be.partial({riskLevelId:be.string,riskMatrixRowId:be.string,riskMatrixColumnId:be.string})}),be.type({comparisonOperands:be.array(be.string),comparisonOperator:_typeutils.valuesOf.call(void 0, _privacytypes.ComparisonOperator)})]);function Wi(t){return _typeutils.decodeCodec.call(void 0, $u,t)}var Hi=20;async function cp(t,{titles:e,pageSize:r,ids:n=[],gql:i=vn,integrationNames:s=[]}){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Fetching ${n.length===0?"all":n.length} Data Silos...`));let o=[],p=0,c=!1;do{let{dataSilos:{nodes:u}}=await l(t,i,{filterBy:{ids:n.length>0?n:void 0,type:s.length>0?s:void 0,titles:e},first:r,offset:p});o.push(...u),p+=r,c=u.length===r}while(c);return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Found a total of ${o.length} data silo${n.length>0?` matching IDs ${n.join(",")}`:""}s${s.length>0?` matching integrationNames ${s.join(",")}`:""}`)),o.sort((u,m)=>u.title.localeCompare(m.title))}async function Du(t,e,{debug:r,includeGuessedCategories:n,pageSize:i}){let s=[],o=0,p=!1;do try{r&&_chunkZUNVPK23cjs.a.log(_colors2.default.magenta(`Pulling in subdatapoints for offset ${o}`));let{subDataPoints:{nodes:c}}=await l(t,n?Dn:xn,{first:i,filterBy:{dataPoints:[e]},offset:o});s.push(...c),o+=i,p=c.length===i,r&&_chunkZUNVPK23cjs.a.log(_colors2.default.green(`Pulled in subdatapoints for offset ${o} for dataPointId=${e}`))}catch(c){throw _chunkZUNVPK23cjs.a.error(_colors2.default.red(`An error fetching subdatapoints for offset ${o} for dataPointId=${e}`)),c}while(p);return _chunkXXFLFF7Qcjs.g.call(void 0, s,"name")}async function qu(t,e,{debug:r,pageSize:n,skipSubDatapoints:i,includeGuessedCategories:s}){let o=[],p=0,c=!1;do{r&&_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Fetching datapoints with offset: ${p}`));let{dataPoints:{nodes:u}}=await l(t,$n,{first:n,filterBy:{dataSilos:[e]},offset:p});r&&_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Fetched ${u.length} datapoints at offset: ${p}`)),i||(await _bluebird.map.call(void 0, u,async m=>{try{r&&_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Fetching subdatapoints for ${m.name} for datapoint offset ${p}`));let d=await Du(t,m.id,{pageSize:1e3,debug:r,includeGuessedCategories:s});o.push({...m,subDataPoints:d.sort((f,g)=>f.name.localeCompare(g.name))}),r&&_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully fetched subdatapoints for ${m.name}`))}catch(d){throw _chunkZUNVPK23cjs.a.error(_colors2.default.red(`An error fetching subdatapoints for ${m.name} datapoint offset ${p}`)),d}},{concurrency:5}),r&&_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Fetched all subdatapoints for page of datapoints at offset: ${p}`))),p+=n,c=u.length===n}while(c);return o.sort((u,m)=>u.name.localeCompare(m.name))}async function up(t,{ids:e,pageSize:r,titles:n,debug:i,skipDatapoints:s,skipSubDatapoints:o,includeGuessedCategories:p,integrationNames:c}){let u=[],m=await cp(t,{titles:n,ids:e,integrationNames:c,pageSize:r,gql:Ln});return s||await _bluebird.mapSeries.call(void 0, m,async(d,f)=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`[${f+1}/${m.length}] Fetching data silo - ${d.title}`));let g=await qu(t,d.id,{debug:i,pageSize:r,skipSubDatapoints:o,includeGuessedCategories:p});i&&_chunkZUNVPK23cjs.a.info(_colors2.default.green(`[${f+1}/${m.length}] Successfully fetched datapoint for - ${d.title}`)),u.push([d,g])}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully fetched all ${m.length} data silo configurations`)),u}async function mp(t,e,{pageSize:r,dataSubjectsByName:n,apiKeysByTitle:i}){let s=!1,o=new Date().getTime();_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${t.length}" data silos...`));let p=await cp(e,{titles:t.map(({title:I})=>I),pageSize:r}),c=_chunkXXFLFF7Qcjs.e.call(void 0, p,"title"),u=t.filter(({title:I})=>!c[I]);if(u.length>0){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating "${u.length}" data silos that did not exist...`));let I=_chunkXXFLFF7Qcjs.b.call(void 0, u,Hi);await _bluebird.mapSeries.call(void 0, I,async L=>{let{createDataSilos:{dataSilos:C}}=await l(e,kn,{input:L.map(O=>({name:O["outer-type"]||O.integrationName,title:O.title,country:O.country,countrySubDivision:O.countrySubDivision}))});C.forEach(O=>{c[O.title]=O})}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created "${u.length}" data silos!`))}let m=_chunkXXFLFF7Qcjs.b.call(void 0, t,Hi);await _bluebird.mapSeries.call(void 0, m,async(I,L)=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`[Batch ${L+1}/${m.length}] Syncing "${I.length}" data silos`)),await l(e,Vr,{input:{dataSilos:I.map(C=>({id:c[C.title].id,country:C.country,countrySubDivision:C.countrySubDivision,url:C.url,headers:C.headers,description:C.description,identifiers:C["identity-keys"],isLive:!C.disabled,ownerEmails:C.owners,teamNames:C.teams,dependedOnDataSiloTitles:C["deletion-dependencies"]?void 0:[],apiKeyId:C["api-key-title"]?i[C["api-key-title"]].id:void 0,dataSubjectBlockListIds:C["data-subjects"]?tp(C["data-subjects"],n):void 0,attributes:C.attributes,businessEntityTitles:C.businessEntityTitles,notifyEmailAddress:_optionalChain([C, 'access', _6 => _6["email-settings"], 'optionalAccess', _7 => _7["notify-email-address"]]),promptAVendorEmailSendFrequency:_optionalChain([C, 'access', _8 => _8["email-settings"], 'optionalAccess', _9 => _9["send-frequency"]]),promptAVendorEmailSendType:_optionalChain([C, 'access', _10 => _10["email-settings"], 'optionalAccess', _11 => _11["send-type"]]),promptAVendorEmailIncludeIdentifiersAttachment:_optionalChain([C, 'access', _12 => _12["email-settings"], 'optionalAccess', _13 => _13["include-identifiers-attachment"]]),promptAVendorEmailCompletionLinkType:_optionalChain([C, 'access', _14 => _14["email-settings"], 'optionalAccess', _15 => _15["completion-link-type"]]),manualWorkRetryFrequency:_optionalChain([C, 'access', _16 => _16["email-settings"], 'optionalAccess', _17 => _17["manual-work-retry-frequency"]])}))}}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`[Batch ${L+1}/${m.length}] Synced "${I.length}" data silos!`))});let d=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),f=t.filter(({datapoints:I=[]})=>I.length>0),g=t.map(({datapoints:I=[]})=>I.length).reduce((I,L)=>I+L,0);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${g}" datapoints from "${f.length}" data silos...`)),d.start(g,0);let y=0;await _bluebird.map.call(void 0, f,async({datapoints:I,title:L})=>{I&&await _bluebird.mapSeries.call(void 0, I,async C=>{let O=C.fields?C.fields.map(({key:J,description:me,categories:ce,purposes:X,attributes:Ae,...Ie})=>({name:J,description:me,categories:ce?ce.map(pe=>({...pe,name:pe.name||"Other"})):void 0,purposes:X?X.map(pe=>({...pe,name:pe.name||"Other"})):void 0,attributes:Ae,accessRequestVisibilityEnabled:Ie["access-request-visibility-enabled"],erasureRequestRedactionEnabled:Ie["erasure-request-redaction-enabled"]})):void 0,H={dataSiloId:c[L].id,path:C.path,name:C.key,title:C.title,description:C.description,...C.owners?{ownerEmails:C.owners}:{},...C.teams?{teamNames:C.teams}:{},...C["data-collection-tag"]?{dataCollectionTag:C["data-collection-tag"]}:{},querySuggestions:C["privacy-action-queries"]?Object.entries(C["privacy-action-queries"]).map(([J,me])=>({requestType:J,suggestedQuery:me})):void 0,enabledActions:C["privacy-actions"]||[],subDataPoints:O},K=(H.subDataPoints||[]).map(({name:J})=>J),se=K.filter((J,me)=>K.indexOf(J)!==me);if(se.length>0)_chunkZUNVPK23cjs.a.info(_colors2.default.red(`
|
|
2985
2985
|
Cannot update datapoint "${C.key}" as it has duplicate sub-datapoints with the same name:
|
|
2986
2986
|
${se.join(`
|
|
2987
2987
|
`)}`)),s=!0;else try{await l(e,qn,H)}catch(J){_chunkZUNVPK23cjs.a.info(_colors2.default.red(`
|
|
2988
2988
|
Failed to update datapoint "${C.key}" for data silo "${L}"! -
|
|
2989
|
-
${J.message}`)),s=!0}y+=1,d.update(y)})},{concurrency:10}),d.stop();let R=new Date().getTime()-o;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${t.length}" data silos and "${g}" datapoints in "${R/1e3}" seconds!`)),{success:!s,dataSiloTitleToId:_typeutils.apply.call(void 0, c,({id:I})=>I)}}async function dp(t,e){let r=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" data silo dependencies...`));let n=_chunkOMVVROKBcjs.b.call(void 0, e,Hi);return await _bluebird.mapSeries.call(void 0, n,async(i,s)=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`[Batch ${s}/${i.length}] Updating "${i.length}" data silos...`));try{await l(t,Vr,{input:{dataSilos:i.map(([o,p])=>({id:o,dependedOnDataSiloTitles:p}))}}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`[Batch ${s+1}/${i.length}] Synced "${i.length}" data silos!`))}catch(o){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`[Batch ${s+1}/${i.length}] Failed to update "${i.length}" silos! - ${o.message}`))}}),!r}var Ji=20;async function Xi(t,e){let r=[],n=0,i=!1;do{let{enrichers:{nodes:s}}=await l(t,_n,{first:Ji,offset:n,title:e});r.push(...s),n+=Ji,i=s.length===Ji}while(i);return r.sort((s,o)=>s.title.localeCompare(o.title))}async function gp(t,{enricher:e,identifierByName:r,dataSubjectsByName:n}){let s=(await Xi(t,e.title)).find(({title:u})=>u===e.title),o=_optionalChain([e, 'access', _18 => _18["data-subjects"], 'optionalAccess', _19 => _19.map, 'call', _20 => _20(u=>{let m=n[u];if(!m)throw new Error(`Failed to find a data subject with name: ${u}`);return m.id})]),p=e["input-identifier"],c=e["privacy-actions"]||Object.values(_privacytypes.RequestAction);s?await l(t,Nn,{input:{id:s.id,title:e.title,url:e.url,headers:e.headers,testRegex:e.testRegex,lookerQueryTitle:e.lookerQueryTitle,expirationDuration:typeof e.expirationDuration=="number"?e.expirationDuration.toString():void 0,transitionRequestStatus:e.transitionRequestStatus,phoneNumbers:e.phoneNumbers,regionList:e.regionList,dataSubjectIds:o,description:e.description||"",inputIdentifier:p?r[p].id:void 0,identifiers:e["output-identifiers"].map(u=>r[u].id),...s.type===_privacytypes.EnricherType.Sombra?{}:{actions:c}}}):p&&await l(t,Gn,{input:{title:e.title,url:e.url,type:e.type||_privacytypes.EnricherType.Server,headers:e.headers,testRegex:e.testRegex,lookerQueryTitle:e.lookerQueryTitle,expirationDuration:typeof e.expirationDuration=="number"?e.expirationDuration.toString():void 0,transitionRequestStatus:e.transitionRequestStatus,phoneNumbers:e.phoneNumbers,dataSubjectIds:o,regionList:e.regionList,description:e.description||"",inputIdentifier:r[p].id,identifiers:e["output-identifiers"].map(u=>r[u].id),actions:c}})}var en=20;async function gt(t,e){let r=[],n=0,i=!1;do{let{templates:{nodes:s}}=await l(t,no,{first:en,offset:n,title:e});r.push(...s),n+=en,i=s.length===en}while(i);return r.sort((s,o)=>s.title.localeCompare(o.title))}async function yp(t,e){(await gt(e,t.title)).find(({title:i})=>i===t.title)||await l(e,oo,{title:t.title})}function tn(t){return t.map(({country:e,countrySubDivision:r})=>({country:e,...r?{countrySubDivision:r}:{}}))}async function xt(t,e={}){let{globalActionItemCollections:{nodes:r}}=await l(t,ns,{filterBy:{...e}});return r}var rn=50;async function zt(t){let e=[],r=0,n=!1;do{let{consentPartitions:{nodes:i}}=await l(t,ys,{first:rn,offset:r});e.push(...i),r+=rn,n=i.length===rn}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}async function Cp(t,e){let r=await De(t),n=!1,i=await zt(t),s=_chunkOMVVROKBcjs.c.call(void 0, e.map(({name:o})=>o),i.map(({name:o})=>o));return await _bluebird.mapSeries.call(void 0, s,async o=>{try{await l(t,Ms,{input:{id:r,name:o}}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created consent partition: ${o}!`))}catch(p){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to create consent partition: ${o}! - ${p.message}`)),n=!0}}),!n}var nn=30;async function Sp(t){let e=[],r=0,n=!1;do{let{siloDiscoveryResults:{nodes:i}}=await l(t,Ea,{first:nn,offset:r,input:{},filterBy:{}}),s=i.map(o=>o.title===null&&_optionalChain([o, 'access', _21 => _21.suggestedCatalog, 'optionalAccess', _22 => _22.title])?{...o,title:o.suggestedCatalog.title}:o);e.push(...s),r+=nn,n=i.length===nn}while(n);return e}var Gu=["dataSilos","enrichers","templates","apiKeys"];async function qP(t,{dataSiloIds:e,integrationNames:r,debug:n,resources:i=Gu,pageSize:s,skipDatapoints:o,includeGuessedCategories:p,skipSubDatapoints:c,trackerStatuses:u=Object.values(_privacytypes.ConsentTrackerStatus)}){if(e.length>0&&r.length>0)throw new Error("Only 1 of integrationNames OR dataSiloIds can be provided");_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Fetching data with page size ${s}...`));let[m,d,f,g,y,S,R,I,L,C,O,H,K,se,J,me,ce,X,Ae,Ie,pe,de,we,ke,Ze,Se,ne,ue,Ee,A,G,fe,ge,In]=await Promise.all([i.includes("dataSilos")||i.includes("dataSubjects")?Yt(t):[],i.includes("apiKeys")?$r({},t,!0):[],i.includes("dataSilos")?up(t,{ids:e,integrationNames:r,pageSize:s,debug:n,includeGuessedCategories:p,skipDatapoints:o,skipSubDatapoints:c}):[],i.includes("enrichers")?Xi(t):[],i.includes("dataFlows")?[...u.includes(_privacytypes.ConsentTrackerStatus.Live)?await Rt(t,_privacytypes.ConsentTrackerStatus.Live):[],...u.includes(_privacytypes.ConsentTrackerStatus.NeedsReview)?await Rt(t,_privacytypes.ConsentTrackerStatus.NeedsReview):[]]:[],i.includes("cookies")?[...u.includes(_privacytypes.ConsentTrackerStatus.Live)?await Ei(t,_privacytypes.ConsentTrackerStatus.Live):[],...u.includes(_privacytypes.ConsentTrackerStatus.NeedsReview)?await Ei(t,_privacytypes.ConsentTrackerStatus.NeedsReview):[]]:[],i.includes("customFields")?Et(t):[],i.includes("templates")?gt(t):[],i.includes("identifiers")?Bi(t):[],i.includes("actions")?ur(t):[],i.includes("businessEntities")?gr(t):[],i.includes("processingActivities")?Sr(t):[],i.includes("consentManager")?Qa(t):void 0,i.includes("consentManager")?yr(t):[],i.includes("prompts")?$t(t):[],i.includes("promptPartials")?Dr(t):[],i.includes("promptGroups")?xr(t):[],i.includes("agents")?fr(t):[],i.includes("agentFunctions")?dr(t):[],i.includes("agentFiles")?mr(t):[],i.includes("vendors")?wr(t):[],i.includes("dataCategories")?hr(t):[],i.includes("processingPurposes")?Ar(t):[],i.includes("actionItems")?cr(t,{type:[_privacytypes.ActionItemCode.Onboarding]}):[],i.includes("actionItemCollections")?xt(t):[],i.includes("teams")?br(t):[],i.includes("policies")?Cr(t):[],i.includes("privacyCenters")?Za(t):[],i.includes("messages")?ja(t):[],i.includes("partitions")?zt(t):[],i.includes("assessments")?Na(t):[],i.includes("assessmentTemplates")?Ma(t):[],i.includes("purposes")?za(t):[],i.includes("siloDiscoveryResults")?Sp(t):[]]),Ft=i.includes("consentManager")&&K?await Va(t,K.id):void 0,M={},tc=_chunkOMVVROKBcjs.a.call(void 0, f.map(([{apiKeys:h}])=>h.map(({title:T})=>T))),Tn=Object.values(d).filter(({title:h})=>i.includes("apiKeys")?!0:tc.includes(h));if(Tn.length>0&&i.includes("apiKeys")&&(M["api-keys"]=Tn.map(({title:h})=>({title:h}))),A.length>0&&i.includes("partitions")&&(M.partitions=A.map(({name:h,partition:T})=>({name:h,partition:T}))),K&&i.includes("consentManager")&&(M["consent-manager"]={bundleUrls:{TEST:K.testBundleURL,PRODUCTION:K.bundleURL},domains:K.configuration.domains||void 0,partition:K.configuration.partition||void 0,consentPrecedence:K.configuration.consentPrecedence||void 0,unknownRequestPolicy:K.configuration.unknownRequestPolicy||void 0,unknownCookiePolicy:K.configuration.unknownCookiePolicy||void 0,syncEndpoint:K.configuration.syncEndpoint||void 0,telemetryPartitioning:K.configuration.telemetryPartitioning||void 0,signedIabAgreement:K.configuration.signedIabAgreement||void 0,syncGroups:K.configuration.syncGroups||void 0,theme:Ft?{primaryColor:Ft.primaryColor||void 0,fontColor:Ft.fontColor||void 0,privacyPolicy:Ft.privacyPolicy||void 0,prompt:Ft.prompt}:void 0,experiences:se.map(h=>({name:h.name,displayName:h.displayName||void 0,regions:h.regions.map(T=>({countrySubDivision:T.countrySubDivision||void 0,country:T.country||void 0})),onConsentExpiry:h.onConsentExpiry,consentExpiry:h.consentExpiry,operator:h.operator,displayPriority:h.displayPriority,viewState:h.viewState,purposes:h.purposes.map(T=>({trackingType:T.trackingType})),optedOutPurposes:h.optedOutPurposes.map(T=>({trackingType:T.trackingType})),browserLanguages:h.browserLanguages,browserTimeZones:h.browserTimeZones}))}),G.length>0&&i.includes("assessments")&&(M.assessments=G.map(({title:h,assessmentGroup:T,sections:b,creator:w,description:$,status:D,assignees:v,externalAssignees:_,reviewers:B,isLocked:Q,isArchived:ee,isExternallyCreated:j,dueDate:F,createdAt:ye,assignedAt:_e,submittedAt:Ne,approvedAt:Me,rejectedAt:Fe,titleIsInternal:oe,retentionSchedule:Re,attributeValues:ze,resources:Ut,syncedRows:at})=>({title:h,group:T.title,sections:b.map(({title:Te,status:Ue,questions:$e,assignees:k,isReviewed:N,externalAssignees:he})=>({title:Te,status:Ue,questions:$e.map(({title:pt,type:Ur,subType:xe,placeholder:qe,description:lt,isRequired:rc,referenceId:ic,displayLogic:Pn,riskLogic:nc,riskCategories:oc,riskFramework:sc,answerOptions:ac,selectedAnswers:pc,allowedMimeTypes:lc,allowSelectOther:cc,syncModel:uc,syncColumn:mc,attributeKey:dc,requireRiskEvaluation:fc,requireRiskMatrixEvaluation:gc})=>{let Oe=Pn?zi(Pn):void 0;return{title:pt,type:Ur,"sub-type":xe,placeholder:qe,description:lt,"is-required":rc,"reference-id":ic,"display-logic":Oe&&Object.keys(Oe).length>0?{action:Oe.action,rule:Oe.rule?{"depends-on-question-reference-id":Oe.rule.dependsOnQuestionReferenceId,"comparison-operator":Oe.rule.comparisonOperator,"comparison-operands":"comparisonOperands"in Oe.rule?Oe.rule.comparisonOperands:void 0}:void 0,"nested-rule":Oe.nestedRule?{"logic-operator":Oe.nestedRule.logicOperator,rules:(Oe.nestedRule.rules||[]).map(ve=>({"depends-on-question-reference-id":ve.dependsOnQuestionReferenceId,"comparison-operator":ve.comparisonOperator,"comparison-operands":"comparisonOperands"in ve?ve.comparisonOperands:void 0}))}:void 0}:void 0,"risk-logic":nc.map(ve=>{let Br=Wi(ve);return{"risk-level":_optionalChain([Br, 'access', _23 => _23.riskAssignment, 'optionalAccess', _24 => _24.riskLevelId]),"comparison-operands":Br.comparisonOperands,"comparison-operator":Br.comparisonOperator}}),"risk-categories":oc.map(({title:ve})=>ve),"risk-framework":_optionalChain([sc, 'optionalAccess', _25 => _25.title]),"answer-options":ac.map(({value:ve})=>({value:ve})),"selected-answers":pc.map(({value:ve})=>ve),"allowed-mime-types":lc,"allow-select-other":cc,"sync-model":uc||void 0,"sync-column":mc||void 0,"attribute-key":_optionalChain([dc, 'optionalAccess', _26 => _26.name]),"require-risk-evaluation":fc,"require-risk-matrix-evaluation":gc}}),assignees:k.map(({email:pt})=>pt),"external-assignees":he.map(({email:pt})=>pt),"is-reviewed":N})),creator:_optionalChain([w, 'optionalAccess', _27 => _27.email]),description:$,status:D,assignees:v.map(({email:Te})=>Te),"external-assignees":_.map(({email:Te})=>Te),reviewers:B.map(({email:Te})=>Te),locked:Q,archived:ee,external:j,"title-is-internal":oe,"due-date":F||void 0,"created-at":ye||void 0,"assigned-at":_e||void 0,"submitted-at":Ne||void 0,"approved-at":Me||void 0,"rejected-at":Fe||void 0,"retention-schedule":Re?{type:Re.type,"duration-days":Re.durationDays,operand:Re.operation}:void 0,attributes:ze!==void 0&&ze.length>0?Le(ze):void 0,resources:Ut.map(({resourceType:Te,title:Ue,name:$e,category:k,type:N,purpose:he})=>({type:Te,title:k?`${k} - ${$e}`:he?`${he} - ${$e}`:Ue||$e||N||""})),rows:at.map(({resourceType:Te,title:Ue,name:$e,category:k,type:N,purpose:he})=>({type:Te,title:k?`${k} - ${$e}`:he?`${he} - ${$e}`:Ue||$e||N||""}))}))),fe.length>0&&i.includes("assessmentTemplates")&&(M["assessment-templates"]=fe.map(({title:h,description:T,sections:b,status:w,source:$,creator:D,isLocked:v,isArchived:_,createdAt:B,retentionSchedule:Q})=>({title:h,description:T,sections:b.map(({title:ee,questions:j})=>({title:ee,questions:j.map(({title:F,type:ye,subType:_e,placeholder:Ne,description:Me,isRequired:Fe,referenceId:oe,displayLogic:Re,riskLogic:ze,riskCategories:Ut,riskFramework:at,answerOptions:Te,allowedMimeTypes:Ue,allowSelectOther:$e,syncModel:k,syncColumn:N,attributeKey:he,requireRiskEvaluation:pt,requireRiskMatrixEvaluation:Ur})=>{let xe=Re?zi(Re):void 0;return{title:F,type:ye,"sub-type":_e,placeholder:Ne,description:Me,"is-required":Fe,"reference-id":oe,"display-logic":xe&&Object.keys(xe).length>0?{action:xe.action,rule:xe.rule?{"depends-on-question-reference-id":xe.rule.dependsOnQuestionReferenceId,"comparison-operator":xe.rule.comparisonOperator,"comparison-operands":"comparisonOperands"in xe.rule?xe.rule.comparisonOperands:void 0}:void 0,"nested-rule":xe.nestedRule?{"logic-operator":xe.nestedRule.logicOperator,rules:(xe.nestedRule.rules||[]).map(qe=>({"depends-on-question-reference-id":qe.dependsOnQuestionReferenceId,"comparison-operator":qe.comparisonOperator,"comparison-operands":"comparisonOperands"in qe?qe.comparisonOperands:void 0}))}:void 0}:void 0,"risk-logic":ze.map(qe=>{let lt=Wi(qe);return{"risk-level":_optionalChain([lt, 'access', _28 => _28.riskAssignment, 'optionalAccess', _29 => _29.riskLevelId]),"risk-matrix-row":_optionalChain([lt, 'access', _30 => _30.riskAssignment, 'optionalAccess', _31 => _31.riskMatrixRowId]),"risk-matrix-column":_optionalChain([lt, 'access', _32 => _32.riskAssignment, 'optionalAccess', _33 => _33.riskMatrixColumnId]),"comparison-operands":lt.comparisonOperands,"comparison-operator":lt.comparisonOperator}}),"risk-categories":Ut.map(({title:qe})=>qe),"risk-framework":_optionalChain([at, 'optionalAccess', _34 => _34.title]),"answer-options":Te.map(({value:qe})=>({value:qe})),"allowed-mime-types":Ue,"allow-select-other":$e,"sync-model":k||void 0,"sync-column":N||void 0,"attribute-key":_optionalChain([he, 'optionalAccess', _35 => _35.name]),"require-risk-evaluation":pt,"require-risk-matrix-evaluation":Ur}})})),status:w,source:$,creator:_optionalChain([D, 'optionalAccess', _36 => _36.email]),locked:v,archived:_,"created-at":B||void 0,"retention-schedule":Q?{type:Q.type,"duration-days":Q.durationDays,operand:Q.operation}:void 0}))),In.length>0&&i.includes("siloDiscoveryResults")&&(M.siloDiscoveryResults=In.map(({title:h,resourceId:T,suggestedCatalog:{title:b},plugin:{dataSilo:{title:w}},country:$,countrySubDivision:D,plaintextContext:v,containsSensitiveData:_,status:B})=>({title:h,resourceId:T,suggestedCatalog:b,plugin:w,country:$||void 0,countrySubDivision:D||void 0,plaintextContext:v,containsSensitiveData:_,status:B}))),J.length>0&&i.includes("prompts")&&(M.prompts=J.map(({title:h,content:T})=>({title:h,content:T}))),me.length>0&&i.includes("promptPartials")&&(M["prompt-partials"]=me.map(({title:h,content:T})=>({title:h,content:T}))),ce.length>0&&i.includes("promptGroups")&&(M["prompt-groups"]=ce.map(({title:h,description:T,prompts:b})=>({title:h,description:T,prompts:b.map(({title:w})=>w)}))),Se.length>0&&i.includes("teams")&&(M.teams=Se.map(({name:h,description:T,ssoDepartment:b,ssoGroup:w,ssoTitle:$,users:D,scopes:v})=>({name:h,description:T,"sso-department":b||void 0,"sso-group":w||void 0,"sso-title":$||void 0,users:D.map(({email:_})=>_),scopes:v.map(({name:_})=>_)}))),m.length>0&&i.includes("dataSubjects")&&(M["data-subjects"]=m.map(({type:h,title:T,active:b,adminDashboardDefaultSilentMode:w,actions:$})=>({type:h,title:_optionalChain([T, 'optionalAccess', _37 => _37.defaultMessage]),active:b,adminDashboardDefaultSilentMode:w,actions:$.map(({type:D})=>D)}))),ne.length>0&&(M.policies=ne.map(({title:h,versions:T,disabledLocales:b})=>({title:_optionalChain([h, 'optionalAccess', _38 => _38.defaultMessage]),content:_optionalChain([T, 'optionalAccess', _39 => _39[0], 'optionalAccess', _40 => _40.content, 'optionalAccess', _41 => _41.defaultMessage]),disabledLocales:b}))),Ee.length>0&&(M.messages=Ee.map(({id:h,defaultMessage:T,targetReactIntlId:b,description:w,translations:$})=>({id:h,defaultMessage:T,description:w,targetReactIntlId:b||void 0,translations:$.reduce((D,{locale:v,value:_})=>Object.assign(D,{[v]:_}),{})}))),ue.length>0){let h=ue[0];M["privacy-center"]={isDisabled:h.isDisabled,showPrivacyRequestButton:h.showPrivacyRequestButton,showPolicies:h.showPolicies,showTrackingTechnologies:h.showTrackingTechnologies,showCookies:h.showCookies,showDataFlows:h.showDataFlows,showConsentManager:h.showConsentManager,showManageYourPrivacy:h.showManageYourPrivacy,showMarketingPreferences:h.showMarketingPreferences,locales:h.locales,defaultLocale:h.defaultLocale,preferBrowserDefaultLocale:h.preferBrowserDefaultLocale,supportEmail:h.supportEmail||void 0,replyToEmail:h.replyToEmail||void 0,useNoReplyEmailAddress:h.useNoReplyEmailAddress,useCustomEmailDomain:h.useCustomEmailDomain,transformAccessReportJsonToCsv:h.transformAccessReportJsonToCsv,theme:h.theme}}if(O.length>0&&i.includes("businessEntities")&&(M["business-entities"]=O.map(({title:h,description:T,address:b,headquarterCountry:w,headquarterSubDivision:$,dataProtectionOfficerName:D,dataProtectionOfficerEmail:v,attributeValues:_})=>({title:h,description:T||void 0,address:b||void 0,headquarterCountry:w||void 0,headquarterSubDivision:$||void 0,dataProtectionOfficerName:D||void 0,dataProtectionOfficerEmail:v||void 0,attributes:_!==void 0&&_.length>0?Le(_):void 0}))),H.length>0&&i.includes("processingActivities")&&(M["processing-activities"]=H.map(({title:h,description:T,securityMeasureDetails:b,controllerships:w,storageRegions:$,transferRegions:D,retentionType:v,retentionPeriod:_,dataProtectionImpactAssessmentLink:B,dataProtectionImpactAssessmentStatus:Q,attributeValues:ee,dataSilos:j,dataSubjects:F,teams:ye,owners:_e,processingPurposeSubCategories:Ne,dataSubCategories:Me,saaSCategories:Fe})=>({title:h,description:T,securityMeasureDetails:_nullishCoalesce(b, () => (void 0)),controllerships:w.length>0?w:void 0,storageRegions:$.length>0?tn($):void 0,transferRegions:D.length>0?tn(D):void 0,retentionType:v,retentionPeriod:v===_privacytypes.RetentionType.StatedPeriod?_:void 0,dataProtectionImpactAssessmentLink:_nullishCoalesce(B, () => (void 0)),dataProtectionImpactAssessmentStatus:Q,attributes:ee!==void 0&&ee.length>0?Le(ee):void 0,dataSiloTitles:j.length>0?j.map(({title:oe})=>oe):void 0,dataSubjectTypes:F.length>0?F.map(({type:oe})=>oe):void 0,teamNames:ye.length>0?ye.map(({name:oe})=>oe):void 0,ownerEmails:_e.length>0?_e.map(({email:oe})=>oe):void 0,processingSubPurposes:Ne.length>0?Ne.map(({name:oe,purpose:Re})=>({purpose:Re,...oe?{name:oe}:{}})):void 0,dataSubCategories:Me.length>0?Me.map(({name:oe,category:Re})=>({category:Re,...oe?{name:oe}:{}})):void 0,saaSCategories:Fe.length>0?Fe.map(({title:oe})=>oe):void 0}))),C.length>0&&i.includes("actions")&&(M.actions=C.map(({type:h,skipSecondaryIfNoFiles:T,skipDownloadableStep:b,requiresReview:w,regionList:$,regionDetectionMethod:D,waitingPeriod:v})=>({type:h,...h===_privacytypes.RequestAction.Erasure?{skipSecondaryIfNoFiles:T,skipDownloadableStep:b}:{},requiresReview:w,waitingPeriod:v,regionDetectionMethod:D,regionList:$.length>0?$:void 0}))),L.length>0&&i.includes("identifiers")&&(M.identifiers=L.map(({name:h,type:T,regex:b,selectOptions:w,privacyCenterVisibility:$,isRequiredInForm:D,placeholder:v,displayTitle:_,dataSubjects:B,displayDescription:Q,displayOrder:ee,isUniqueOnPreferenceStore:j})=>({name:h,type:T,regex:b,selectOptions:w.length>0?w:void 0,privacyCenterVisibility:$.length>0?$:void 0,isRequiredInForm:D,placeholder:v||void 0,dataSubjects:B.length>0?B.map(({type:F})=>F):void 0,displayTitle:_optionalChain([_, 'optionalAccess', _42 => _42.defaultMessage]),displayDescription:_optionalChain([Q, 'optionalAccess', _43 => _43.defaultMessage]),displayOrder:ee,isUniqueOnPreferenceStore:j}))),X.length>0&&i.includes("agents")&&(M.agents=X.map(({name:h,agentId:T,description:b,instructions:w,codeInterpreterEnabled:$,retrievalEnabled:D,prompt:v,largeLanguageModel:_,teams:B,owners:Q,agentFunctions:ee,agentFiles:j})=>({name:h,agentId:T,description:b||void 0,instructions:w,codeInterpreterEnabled:$,retrievalEnabled:D,prompt:_optionalChain([v, 'optionalAccess', _44 => _44.title]),"large-language-model":{name:_.name,client:_.client},teams:B&&B.length>0?B.map(({name:F})=>F):void 0,owners:Q&&Q.length>0?Q.map(({email:F})=>F):void 0,"agent-functions":ee&&ee.length>0?ee.map(({name:F})=>F):void 0,"agent-files":j&&j.length>0?j.map(({name:F})=>F):void 0}))),ke.length>0&&i.includes("actionItems")&&(M["action-items"]=ke.map(({teams:h,users:T,customerExperienceActionItemIds:[b],dueDate:w,priority:$,resolved:D,collections:v,notes:_,link:B,title:Q,type:ee,attributeValues:j})=>({teams:h.map(({name:F})=>F),users:T.map(({email:F})=>F),dueDate:w||void 0,title:Q,notes:_,customerExperienceActionItemId:b,collections:v.map(({title:F})=>F),link:B,priority:$||void 0,resolved:D,type:ee,attributes:j!==void 0&&j.length>0?Le(j):void 0}))),Ze.length>0&&i.includes("actionItemCollections")&&(M["action-item-collections"]=Ze.map(({title:h,description:T,hidden:b,productLine:w})=>({title:h,description:T||void 0,hidden:b,productLine:w}))),Ae.length>0&&i.includes("agentFunctions")&&(M["agent-functions"]=Ae.map(({name:h,description:T,parameters:b})=>({name:h,description:T,parameters:JSON.stringify(b)}))),Ie.length>0&&i.includes("agentFiles")&&(M["agent-files"]=Ie.map(({name:h,description:T,fileId:b,size:w,purpose:$})=>({name:h,description:T,fileId:b,size:w,purpose:$}))),pe.length>0&&i.includes("vendors")&&(M.vendors=pe.map(({title:h,description:T,dataProcessingAgreementLink:b,contactName:w,contactPhone:$,address:D,headquarterCountry:v,headquarterSubDivision:_,websiteUrl:B,businessEntity:Q,teams:ee,owners:j,attributeValues:F})=>({title:h,description:T||void 0,dataProcessingAgreementLink:b||void 0,contactName:w||void 0,contactPhone:$||void 0,address:D||void 0,headquarterCountry:v||void 0,headquarterSubDivision:_||void 0,websiteUrl:B||void 0,businessEntity:_optionalChain([Q, 'optionalAccess', _45 => _45.title]),teams:ee&&ee.length>0?ee.map(({name:ye})=>ye):void 0,owners:j&&j.length>0?j.map(({email:ye})=>ye):void 0,attributes:F!==void 0&&F.length>0?Le(F):void 0}))),de.length>0&&i.includes("dataCategories")&&(M["data-categories"]=de.map(({name:h,category:T,description:b,regex:w,owners:$,teams:D,attributeValues:v})=>({name:h,category:T,description:b||void 0,regex:w||void 0,owners:$&&$.length>0?$.map(({email:_})=>_):void 0,teams:D&&D.length>0?D.map(({name:_})=>_):void 0,attributes:v!==void 0&&v.length>0?Le(v):void 0}))),we.length>0&&i.includes("processingPurposes")&&(M["processing-purposes"]=we.map(({name:h,purpose:T,description:b,owners:w,teams:$,attributeValues:D})=>({name:h,purpose:T,description:b||void 0,owners:w&&w.length>0?w.map(({email:v})=>v):void 0,teams:$&&$.length>0?$.map(({name:v})=>v):void 0,attributes:D!==void 0&&D.length>0?Le(D):void 0}))),y.length>0&&i.includes("dataFlows")&&(M["data-flows"]=y.map(({value:h,type:T,description:b,trackingType:w,service:$,status:D,owners:v,teams:_,attributeValues:B})=>({value:h,type:T,description:b||void 0,trackingPurposes:w,status:D,service:_optionalChain([$, 'optionalAccess', _46 => _46.integrationName]),owners:v.map(({email:Q})=>Q),teams:_.map(({name:Q})=>Q),attributes:B!==void 0&&B.length>0?Le(B):void 0}))),S.length>0&&i.includes("cookies")&&(M.cookies=S.map(({name:h,isRegex:T,description:b,trackingPurposes:w,service:$,status:D,owners:v,teams:_,attributeValues:B})=>({name:h,isRegex:T,description:b||void 0,trackingPurposes:w,status:D,service:_optionalChain([$, 'optionalAccess', _47 => _47.integrationName]),owners:v.map(({email:Q})=>Q),teams:_.map(({name:Q})=>Q),attributes:B!==void 0&&B.length>0?Le(B):void 0}))),R.length>0&&i.includes("customFields")&&(M.attributes=R.map(({description:h,name:T,type:b,values:w,enabledOn:$=[]})=>({description:h||void 0,resources:$,name:T,type:b,values:w.map(({name:D,color:v,description:_})=>({name:D,color:v||void 0,description:_}))}))),ge.length>0&&(M.purposes=ge.map(({name:h,description:T,trackingType:b,defaultConsent:w,configurable:$,showInConsentManager:D,isActive:v,displayOrder:_,optOutSignals:B,authLevel:Q,topics:ee,showInPrivacyCenter:j,title:F})=>({name:h,title:F,description:T||void 0,trackingType:b,"default-consent":w,configurable:$,"show-in-consent-manager":D,"show-in-privacy-center":j,"is-active":v,"display-order":_,"opt-out-signals":B.length>0?B:void 0,"auth-level":Q||void 0,"preference-topics":ee.map(({title:ye,type:_e,displayDescription:Ne,defaultConfiguration:Me,showInPrivacyCenter:Fe,preferenceOptionValues:oe})=>({title:ye.defaultMessage,type:_e,description:Ne.defaultMessage,"default-configuration":Me,"show-in-privacy-center":Fe,...oe.length>0?{options:oe.map(({title:Re,slug:ze})=>({title:Re.defaultMessage,slug:ze}))}:{}}))}))),e.length===0&&I.length>0&&i.includes("templates")&&(M.templates=I.map(({title:h})=>({title:h}))),g.length>0&&i.includes("enrichers")&&(M.enrichers=g.map(({title:h,url:T,type:b,inputIdentifier:w,identifiers:$,actions:D,testRegex:v,dataSubjects:_,expirationDuration:B,lookerQueryTitle:Q,transitionRequestStatus:ee,phoneNumbers:j,regionList:F})=>({title:h,url:T||void 0,type:b,"input-identifier":_optionalChain([w, 'optionalAccess', _48 => _48.name]),"output-identifiers":$.map(({name:ye})=>ye),"privacy-actions":Object.values(_privacytypes.RequestAction).length===D.length?void 0:D,testRegex:v||void 0,lookerQueryTitle:Q||void 0,expirationDuration:parseInt(B,10),transitionRequestStatus:ee||void 0,phoneNumbers:j&&j.length>0?j:void 0,regionList:F&&F.length>0?F:void 0,"data-subjects":_.map(({type:ye})=>ye)}))),f.length>0&&i.includes("dataSilos")){let h=_chunkOMVVROKBcjs.e.call(void 0, m,"type");M["data-silos"]=f.map(([{title:T,description:b,url:w,type:$,outerType:D,apiKeys:v,notifyEmailAddress:_,identifiers:B,dependentDataSilos:Q,owners:ee,country:j,countrySubDivision:F,teams:ye,subjectBlocklist:_e,isLive:Ne,promptAVendorEmailSendFrequency:Me,promptAVendorEmailSendType:Fe,promptAVendorEmailIncludeIdentifiersAttachment:oe,promptAVendorEmailCompletionLinkType:Re,manualWorkRetryFrequency:ze,catalog:Ut,attributeValues:at,discoveredBy:Te,businessEntities:Ue},$e])=>({title:T,description:b,integrationName:$,"outer-type":D||void 0,url:w||void 0,"api-key-title":_optionalChain([v, 'access', _49 => _49[0], 'optionalAccess', _50 => _50.title]),"identity-keys":B.filter(({isConnected:k})=>k).map(({name:k})=>k),...Q.length>0?{"deletion-dependencies":Q.map(({title:k})=>k)}:{},...ee.length>0?{owners:ee.map(({email:k})=>k)}:{},...ye.length>0?{teams:ye.map(({name:k})=>k)}:{},...Te.length>0?{discoveredBy:Te.map(({title:k})=>k)}:{},...Ue.length>0?{businessEntities:Ue.map(({title:k})=>k)}:{},country:j||void 0,countrySubDivision:F||void 0,disabled:!Ne,"data-subjects":_e.length>0?rp(_e.map(({type:k})=>k),h):void 0,...Ut.hasAvcFunctionality?{"email-settings":{"notify-email-address":_||void 0,"send-frequency":Me,"send-type":Fe,"include-identifiers-attachment":oe,"completion-link-type":Re,"manual-work-retry-frequency":ze}}:{},attributes:at!==void 0&&at.length>0?Le(at):void 0,datapoints:$e.map(k=>({key:k.name,title:_optionalChain([k, 'access', _51 => _51.title, 'optionalAccess', _52 => _52.defaultMessage]),description:_optionalChain([k, 'access', _53 => _53.description, 'optionalAccess', _54 => _54.defaultMessage]),owners:k.owners.map(({email:N})=>N),teams:k.teams.map(({name:N})=>N),...k.path.length>0?{path:k.path}:{},..._optionalChain([k, 'access', _55 => _55.dataCollection, 'optionalAccess', _56 => _56.title])?{"data-collection-tag":k.dataCollection.title.defaultMessage}:{},...k.dbIntegrationQueries.length>0?{"privacy-action-queries":_chunkOMVVROKBcjs.f.call(void 0, _chunkOMVVROKBcjs.e.call(void 0, k.dbIntegrationQueries,"requestType"),N=>N.suggestedQuery||N.query||void 0)}:{},...k.subDataPoints.length>0?{fields:k.subDataPoints.map(N=>({key:N.name,description:N.description,purposes:N.purposes,categories:N.categories,...p&&N.pendingCategoryGuesses?{"guessed-categories":N.pendingCategoryGuesses.filter(he=>he.status==="PENDING").map(he=>({category:{name:he.category.name,category:he.category.category},status:he.status,confidence:he.confidence,classifierVersion:he.classifierVersion||void 0}))}:{},"access-request-visibility-enabled":N.accessRequestVisibilityEnabled,"erasure-request-redaction-enabled":N.erasureRequestRedactionEnabled,attributes:N.attributeValues!==void 0&&N.attributeValues.length>0?Le(N.attributeValues):void 0})).sort((N,he)=>N.key.localeCompare(he.key))}:{},"privacy-actions":k.actionSettings.filter(({active:N})=>N).map(({type:N})=>N)})).sort((k,N)=>[..._nullishCoalesce(k.path, () => ([])),k.key].join(".").localeCompare([..._nullishCoalesce(N.path, () => ([])),N.key].join(".")))}))}return M}async function _P(t,e){let{reportPromptRun:{promptRun:r}}=await l(t,rs,{input:{...e,promptRunMessages:e.promptRunMessages.map(({content:n,...i})=>({...i,message:n}))}});return r.id}async function Ip(t,e){await l(t,bo,{requestEnricherId:e})}async function BP(t,e){await l(t,fs,{input:e})}var Fu=[...Object.values(_privacytypes.IsoCountryCode),...Object.values(_privacytypes.IsoCountrySubdivisionCode)];async function Tp(t,{action:e,actionId:r,skipPublish:n=!1}){await l(t,js,{input:{id:r,skipSecondaryIfNoFiles:e.skipSecondaryIfNoFiles,skipDownloadableStep:e.skipDownloadableStep,requiresReview:e.requiresReview,waitingPeriod:e.waitingPeriod,skipPublish:n,regionList:e.regionBlockList?_chunkOMVVROKBcjs.c.call(void 0, Fu,e.regionBlockList):e.regionList,regionDetectionMethod:e.regionDetectionMethod}})}async function Uu(t,e){let r={title:e.title,description:e.description||"",hidden:e.hidden||!1,productLine:e.productLine},{createActionItemCollection:n}=await l(t,os,{input:r});return n.created}async function Bu(t,e,r){await l(t,ss,{input:{id:r,title:e.title,description:e.description,hidden:e.hidden,productLine:e.productLine}})}async function Ep(t,e){let r=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" action item collections...`));let n=await xt(t),i=_chunkOMVVROKBcjs.e.call(void 0, n,"title"),s=e.filter(p=>!i[p.title]);await _bluebird.mapSeries.call(void 0, s,async p=>{try{await Uu(t,p),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created action item collection "${p.title}"!`))}catch(c){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create action item collection "${p.title}"! - ${c.message}`))}});let o=e.map(p=>[p,_optionalChain([i, 'access', _57 => _57[p.title], 'optionalAccess', _58 => _58.id])]).filter(p=>!!p[1]);return await _bluebird.mapSeries.call(void 0, o,async([p,c])=>{try{await Bu(t,p,c),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced action item collection "${p.title}"!`))}catch(u){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync action item collection "${p.title}"! - ${u.message}`))}}),!r}async function Qu(t,e,r,n={}){let i=_chunkOMVVROKBcjs.b.call(void 0, e,100);await _bluebird.mapSeries.call(void 0, i,async s=>{await l(t,zs,{input:s.map(o=>({title:o.title,type:o.type,priorityOverride:o.priority,dueDate:o.dueDate,customerExperienceActionItemId:o.customerExperienceActionItemId,resolved:o.resolved,notes:o.notes,link:o.link,assigneesUserEmails:o.users,assigneesTeamNames:o.teams,...o.attributes?{}:{},collectionIds:o.collections.map(p=>r[p].id)}))})})}async function Vu(t,e,r,n={}){let i=s=>{let o=n[s];if(!o)throw new Error(`Attribute key "${s}" does not exist!`);return o.id};await l(t,Zs,{input:{ids:[r],title:e.title,priorityOverride:e.priority,dueDate:e.dueDate,resolved:e.resolved,customerExperienceActionItemId:e.customerExperienceActionItemId,notes:e.notes,link:e.link,assigneesUserEmails:e.users,assigneesTeamNames:e.teams,...e.attributes?{attributes:e.attributes.map(({key:s,values:o})=>({attributeKeyId:i(s),attributeValueNames:o}))}:{}}})}function Ku({title:t,collections:e}){return`${t}-${e.map(r=>r.title).sort().join("-")}`}function Rp({title:t,collections:e}){return`${t}-${e.sort().join("-")}`}async function wp(t,e){let r=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" actionItems...`));let n=e.some(y=>y.attributes&&y.attributes.length>0),[i,s,o]=await Promise.all([cr(t),xt(t),n?Et(t):[]]),p=_chunkOMVVROKBcjs.e.call(void 0, s,"title"),c=_chunkOMVVROKBcjs.e.call(void 0, i,Ku),u=_chunkOMVVROKBcjs.e.call(void 0, o,"name"),m=_chunkOMVVROKBcjs.e.call(void 0, i.filter(y=>!!y.customerExperienceActionItemIds),({customerExperienceActionItemIds:y})=>y[0]),d=_chunkOMVVROKBcjs.j.call(void 0, e.map(y=>y.collections).flat()).filter(y=>!p[y]);if(d.length>0)return _chunkZUNVPK23cjs.a.info(_colors2.default.red(`Missing action item collections: "${d.join('", "')}" - please create them first!`)),!1;let f=e.filter(y=>!c[Rp(y)]&&!m[y.customerExperienceActionItemId]);if(f.length>0)try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating "${f.length}" actionItems...`)),await Qu(t,f,p,u),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created "${f.length}" actionItems!`))}catch(y){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create action items! - ${y.message}`))}let g=e.map(y=>[y,_optionalChain([c, 'access', _59 => _59[Rp(y)], 'optionalAccess', _60 => _60.id])||_optionalChain([m, 'access', _61 => _61[y.customerExperienceActionItemId], 'optionalAccess', _62 => _62.id])]).filter(y=>!!y[1]);return await _bluebird.mapSeries.call(void 0, g,async([y,S])=>{try{await Vu(t,y,S,u),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced action item "${y.title}"!`))}catch(R){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync action item "${y.title}"! - ${R.message}`))}}),!r}async function Yu(t,e){let r={name:e.name,description:e.description,fileId:e.fileId,size:e.size,purpose:e.purpose,fileUploadedAt:new Date,agentIds:[]},{createAgentFile:n}=await l(t,sa,{input:r});return n.agentFile}async function Zu(t,e){await l(t,aa,{input:{agentFiles:e.map(([r,n])=>({id:n,name:r.name,description:r.description,fileId:r.fileId,size:r.size,purpose:r.purpose}))}})}async function $p(t,e){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" agent files...`));let r=!1,n=await mr(t),i=_chunkOMVVROKBcjs.e.call(void 0, n,"name"),s=e.filter(o=>!i[o.name]);await _bluebird.mapSeries.call(void 0, s,async o=>{try{let p=await Yu(t,o);i[p.name]=p,_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced agent file "${o.name}"!`))}catch(p){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync agent file "${o.name}"! - ${p.message}`))}});try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${e.length}" agent files!`)),await Zu(t,e.map(o=>[o,i[o.name].id])),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced "${e.length}" agent files!`))}catch(o){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync "${e.length}" agent files! - ${o.message}`))}return!r}async function Wu(t,e){let r={name:e.name,description:e.description,parameters:e.parameters,agentIds:[]},{createAgentFunction:n}=await l(t,la,{input:r});return n.agentFunction}async function Hu(t,e){await l(t,ca,{input:{agentFunctions:e.map(([r,n])=>({id:n,name:r.name,description:r.description,parameters:r.parameters}))}})}async function xp(t,e){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" agent functions...`));let r=!1,n=await dr(t),i=_chunkOMVVROKBcjs.e.call(void 0, n,"name"),s=e.filter(o=>!i[o.name]);await _bluebird.mapSeries.call(void 0, s,async o=>{try{let p=await Wu(t,o);i[p.name]=p,_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced agent function "${o.name}"!`))}catch(p){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync agent function "${o.name}"! - ${p.message}`))}});try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${e.length}" agent functions!`)),await Hu(t,e.map(o=>[o,i[o.name].id])),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced "${e.length}" agent functions!`))}catch(o){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync "${e.length}" agent functions! - ${o.message}`))}return!r}async function Xu(t,e){let r={name:e.name,description:e.description,codeInterpreterEnabled:e.codeInterpreterEnabled,retrievalEnabled:e.retrievalEnabled,promptTitle:e.prompt,largeLanguageModelName:e["large-language-model"].name,largeLanguageModelClient:e["large-language-model"].client},{createAgent:n}=await l(t,ia,{input:r});return n.agent}async function em(t,e){await l(t,na,{input:{agents:e.map(([r,n])=>({id:n,name:r.name,description:r.description,codeInterpreterEnabled:r.codeInterpreterEnabled,retrievalEnabled:r.retrievalEnabled}))}})}async function Dp(t,e){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" agents...`));let r=!1,n=await fr(t),i=_chunkOMVVROKBcjs.e.call(void 0, n,"name"),s=e.filter(o=>!i[o.name]);await _bluebird.mapSeries.call(void 0, s,async o=>{try{let p=await Xu(t,o);i[p.name]=p,_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced agent "${o.name}"!`))}catch(p){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync agent "${o.name}"! - ${p.message}`))}});try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${e.length}" agents!`)),await em(t,e.map(o=>[o,i[o.name].id])),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced "${e.length}" agents!`))}catch(o){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync "${e.length}" agents ! - ${o.message}`))}return!r}async function qp(t,e,{existingAttribute:r,deleteExtraAttributeValues:n}){let i={name:e.name,enabledOn:e.resources},s;if(r)await l(t,ds,{attributeKeyId:r.id,description:r.isCustom?e.description:void 0,...i}),s=r.id;else{let{createAttributeKey:{attributeKey:m}}=await l(t,ms,{type:e.type,description:e.description,...i});s=m.id}let o=_chunkOMVVROKBcjs.e.call(void 0, _optionalChain([r, 'optionalAccess', _63 => _63.values])||[],"name"),{existingValues:p=[],newValues:c=[]}=_chunkOMVVROKBcjs.d.call(void 0, e.values||[],m=>o[m.name]?"existingValues":"newValues"),u=_chunkOMVVROKBcjs.c.call(void 0, (_optionalChain([r, 'optionalAccess', _64 => _64.values])||[]).map(({name:m})=>m),(e.values||[]).map(({name:m})=>m));c.length>0&&(await l(t,ps,{input:c.map(({name:m,...d})=>({name:m,attributeKeyId:s,...d}))}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Created ${c.length} attribute values`))),p.length>0&&(await l(t,ls,{input:p.map(({name:m,...d})=>({id:o[m].id,name:m,description:o[m].description,color:o[m].color,...d,attributeKeyId:s}))}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Updated ${p.length} attribute values`))),u.length>0&&n&&(await _bluebird.map.call(void 0, u,async m=>{await l(t,cs,{id:o[m].id})},{concurrency:10}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Deleted ${u.length} attribute values`)))}async function rm(t,e){let r={title:e.title,description:e.description,address:e.address,headquarterCountry:e.headquarterCountry,headquarterSubDivision:e.headquarterSubDivision,dataProtectionOfficerName:e.dataProtectionOfficerName,dataProtectionOfficerEmail:e.dataProtectionOfficerEmail,attributes:e.attributes,teamNames:e.teams,ownerEmails:e.owners},{createBusinessEntity:n}=await l(t,Bs,{input:r});return n.businessEntity}async function im(t,e){let r=_chunkOMVVROKBcjs.b.call(void 0, e,100);await _bluebird.mapSeries.call(void 0, r,async n=>{await l(t,Qs,{input:n.map(([i,s])=>({id:s,title:i.title,description:i.description,address:i.address,headquarterCountry:i.headquarterCountry,headquarterSubDivision:i.headquarterSubDivision,dataProtectionOfficerName:i.dataProtectionOfficerName,dataProtectionOfficerEmail:i.dataProtectionOfficerEmail,attributes:i.attributes,teamNames:i.teams,ownerEmails:i.owners}))})})}async function Lp(t,e){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" business entities...`));let r=!1,n=await gr(t),i=_chunkOMVVROKBcjs.e.call(void 0, n,"title"),s=e.filter(o=>!i[o.title]);await _bluebird.mapSeries.call(void 0, s,async o=>{try{let p=await rm(t,o);i[p.title]=p,_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced business entity "${o.title}"!`))}catch(p){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync business entity "${o.title}"! - ${p.message}`))}});try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${e.length}" business entities!`)),await im(t,e.map(o=>[o,i[o.title].id])),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced "${e.length}" business entities!`))}catch(o){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync "${e.length}" business entities ! - ${o.message}`))}return!r}var sn=20;async function kp(t){let e=[],r=0,n=!1;do{let{codePackages:{nodes:i}}=await l(t,uo,{first:sn,offset:r});e.push(...i),r+=sn,n=i.length===sn}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}var an=20;async function _p(t){let e=[],r=0,n=!1;do{let{softwareDevelopmentKits:{nodes:i}}=await l(t,po,{first:an,offset:r});e.push(...i),r+=an,n=i.length===an}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}var sm=100;async function am(t,e){let{createSoftwareDevelopmentKit:{softwareDevelopmentKit:r}}=await l(t,co,{input:e});return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created software development kit "${e.name}"!`)),r}async function pm(t,e){let{updateSoftwareDevelopmentKits:{softwareDevelopmentKits:r}}=await l(t,lo,{input:{softwareDevelopmentKits:e}});return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated ${e.length} software development kits!`)),r}async function Op(t,e,r=20){let n=!1,i=[];_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Syncing software development kits..."));let s=await _p(t),o=_chunkOMVVROKBcjs.e.call(void 0, s,({name:d,codePackageType:f})=>JSON.stringify({name:d,codePackageType:f})),p=e.map(d=>[d,_optionalChain([o, 'access', _65 => _65[JSON.stringify({name:d.name,codePackageType:d.codePackageType})], 'optionalAccess', _66 => _66.id])]),c=p.filter(([,d])=>!d).map(([d])=>d);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating "${c.length}" new software development kits...`)),await _bluebird.map.call(void 0, c,async d=>{let f=await am(t,d);i.push(f)},{concurrency:r}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced ${c.length} software development kits!`))}catch(d){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create software development kits! - ${d.message}`))}let u=p.filter(d=>!!d[1]),m=_chunkOMVVROKBcjs.b.call(void 0, u,sm);return _chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${u.length}" software development kits...`)),await _bluebird.mapSeries.call(void 0, m,async d=>{try{let f=await pm(t,d.map(([{codePackageType:g,...y},S])=>({...y,id:S})));i.push(...f),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated "${u.length}" software development kits!`))}catch(f){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to update software development kits! - ${f.message}`))}_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${e.length}" software development kits!`))}),{softwareDevelopmentKits:i,success:!n}}var pn=20;async function Gp(t){let e=[],r=0,n=!1;do{let{repositories:{nodes:i}}=await l(t,Yn,{first:pn,offset:r});e.push(...i),r+=pn,n=i.length===pn}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}var um=100;async function mm(t,e){let{createRepository:{repository:r}}=await l(t,zn,{input:e});return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created repository "${e.name}"!`)),r}async function dm(t,e){let{updateRepositories:{repositories:r}}=await l(t,Zn,{input:{repositories:e}});return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated ${e.length} repositories!`)),r}async function Np(t,e,r=20){let n=!1,i=[],s=await Gp(t),o=_chunkOMVVROKBcjs.e.call(void 0, s,"name"),p=e.map(d=>[d,_optionalChain([o, 'access', _67 => _67[d.name], 'optionalAccess', _68 => _68.id])]),c=p.filter(([,d])=>!d).map(([d])=>d);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating "${c.length}" new repositories...`)),await _bluebird.map.call(void 0, c,async d=>{let f=await mm(t,d);i.push(f)},{concurrency:r}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced ${c.length} repositories!`))}catch(d){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create repositories! - ${d.message}`))}let u=p.filter(d=>!!d[1]),m=_chunkOMVVROKBcjs.b.call(void 0, u,um);return _chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${u.length}" repositories...`)),await _bluebird.mapSeries.call(void 0, m,async d=>{try{let f=await dm(t,d.map(([g,y])=>({...g,id:y})));i.push(...f),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated "${u.length}" repositories!`))}catch(f){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to update repositories! - ${f.message}`))}_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${e.length}" repositories!`))}),{repositories:i,success:!n}}var ym=100,kt="%%%%";async function hm(t,e){let{createCodePackage:{codePackage:r}}=await l(t,fo,{input:e});return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created code package "${e.name}"!`)),r}async function Cm(t,e){let{updateCodePackages:{codePackages:r}}=await l(t,mo,{input:{codePackages:e}});return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated ${e.length} code packages!`)),r}async function QR(t,e,r=20){let n=!1,[i,{softwareDevelopmentKits:s}]=await Promise.all([kp(t),Op(t,_chunkOMVVROKBcjs.k.call(void 0, e.map(({type:f,softwareDevelopmentKits:g=[]})=>g.map(({name:y})=>({name:y,codePackageType:f}))).flat(),({name:f,codePackageType:g})=>`${f}${kt}${g}`),r),Np(t,_chunkOMVVROKBcjs.k.call(void 0, e,"repositoryName").map(({repositoryName:f})=>({name:f,url:`https://github.com/${f}`})))]),o=_chunkOMVVROKBcjs.e.call(void 0, s,({name:f,codePackageType:g})=>`${f}${kt}${g}`),p=_chunkOMVVROKBcjs.e.call(void 0, i,({name:f,type:g})=>`${f}${kt}${g}`),c=e.map(f=>[f,_optionalChain([p, 'access', _69 => _69[`${f.name}${kt}${f.type}`], 'optionalAccess', _70 => _70.id])]),u=c.filter(([,f])=>!f).map(([f])=>f);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating "${u.length}" new code packages...`)),await _bluebird.map.call(void 0, u,async({softwareDevelopmentKits:f,...g})=>{await hm(t,{...g,...f?{softwareDevelopmentKitIds:_chunkOMVVROKBcjs.j.call(void 0, f.map(({name:y})=>{let S=o[`${y}${kt}${g.type}`];if(!S)throw new Error(`Failed to find SDK with name: "${y}"`);return S.id}))}:{}})},{concurrency:r}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced ${u.length} code packages!`))}catch(f){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create code packages! - ${f.message}`))}let m=c.filter(f=>!!f[1]);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${m.length}" code packages...`));let d=_chunkOMVVROKBcjs.b.call(void 0, m,ym);return await _bluebird.mapSeries.call(void 0, d,async f=>{try{await Cm(t,f.map(([{softwareDevelopmentKits:g,repositoryName:y,...S},R])=>({...S,...g?{softwareDevelopmentKitIds:_chunkOMVVROKBcjs.j.call(void 0, g.map(({name:I})=>{let L=o[`${I}${kt}${S.type}`];if(!L)throw new Error(`Failed to find SDK with name: "${I}"`);return L.id}))}:{},id:R}))),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated "${f.length}" code packages!`))}catch(g){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to update code packages! - ${g.message}`))}}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${e.length}" code packages!`)),!n}async function Mp(t,{identifier:e,dataSubjectsByName:r,identifierId:n,skipPublish:i=!1}){await l(t,Qn,{input:{id:n,selectOptions:e.selectOptions,isRequiredInForm:e.isRequiredInForm,regex:e.regex,placeholder:e.placeholder,displayTitle:e.displayTitle,displayDescription:e.displayDescription,displayOrder:e.displayOrder,isUniqueOnPreferenceStore:e.isUniqueOnPreferenceStore,privacyCenterVisibility:e.privacyCenterVisibility,dataSubjectIds:e.dataSubjects?e.dataSubjects.map(s=>r[s].id):void 0,skipPublish:i}})}var Am=100;async function Im(t,e){let r=await De(t);await _bluebird.mapSeries.call(void 0, _chunkOMVVROKBcjs.b.call(void 0, e,Am),async n=>{await l(t,Ss,{airgapBundleId:r,cookies:n.map(i=>({name:i.name,trackingPurposes:i.trackingPurposes&&i.trackingPurposes.length>0?i.trackingPurposes:void 0,description:i.description,service:i.service,status:i.status,attributes:i.attributes,isRegex:i.isRegex}))})})}async function Fp(t,e){let r=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" cookies...`));let n=e.filter(i=>e.filter(s=>i.name===s.name&&i.isRegex===s.isRegex).length>1);if(n.length>0)throw new Error(`Failed to upload cookies as there were non-unique entries found: ${n.map(({name:i})=>i).join(",")}`);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Upserting "${e.length}" new cookies...`)),await Im(t,e),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced ${e.length} cookies!`))}catch(i){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create cookies! - ${i.message}`))}return!r}async function Tm(t,e){let r={name:e.name,description:e.description,ssoTitle:e["sso-title"],ssoDepartment:e["sso-department"],ssoGroup:e["sso-group"],scopes:e.scopes,userEmails:e.users},{createTeam:n}=await l(t,Yo,{input:r});return n.team}async function Pm(t,e,r){let{updateTeam:n}=await l(t,Zo,{input:{id:r,name:e.name,description:e.description,ssoTitle:e["sso-title"],ssoDepartment:e["sso-department"],ssoGroup:e["sso-group"],scopes:e.scopes,userEmails:e.users}});return n.team}async function Bp(t,e){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" teams...`));let r=!1,n=await br(t),i=_chunkOMVVROKBcjs.e.call(void 0, n,"name"),s=e.filter(p=>!i[p.name]),o=e.filter(p=>!!i[p.name]);return await _bluebird.mapSeries.call(void 0, s,async p=>{try{let c=await Tm(t,p);i[c.name]=c,_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created team "${p.name}"!`))}catch(c){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync team "${p.name}"! - ${c.message}`))}}),await _bluebird.mapSeries.call(void 0, o,async p=>{try{let c=await Pm(t,p,i[p.name].id);i[c.name]=c,_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated team "${p.name}"!`))}catch(c){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync team "${p.name}"! - ${c.message}`))}}),!r}async function Qp(t,{dataSubject:e,dataSubjectId:r,skipPublish:n=!1}){await l(t,Kn,{input:{id:r,title:e.title,adminDashboardDefaultSilentMode:e.adminDashboardDefaultSilentMode,actions:e.actions,skipPublish:n&&typeof e.active>"u"}}),typeof e.active=="boolean"&&await l(t,jn,{input:{id:r,active:e.active,skipPublish:n}})}async function Rm(t,e){let{createPrompt:{prompt:r}}=await l(t,No,{input:e});return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created prompt "${e.title}"!`)),r.id}async function bm(t,e){await l(t,Go,{input:{prompts:e.map(([r,n])=>({...r,id:n}))}}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated ${e.length} prompts!`))}async function Vp(t,e,r=20){let n=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" prompts...`));let i=await $t(t),s=_chunkOMVVROKBcjs.e.call(void 0, i,"title"),o=e.map(u=>[u,_optionalChain([s, 'access', _71 => _71[u.title], 'optionalAccess', _72 => _72.id])]),p=o.filter(([,u])=>!u).map(([u])=>u);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating "${p.length}" new prompts...`)),await _bluebird.map.call(void 0, p,async u=>{await Rm(t,u)},{concurrency:r}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced ${p.length} prompts!`))}catch(u){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create prompts! - ${u.message}`))}let c=o.filter(u=>!!u[1]);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${c.length}" prompts...`)),await bm(t,c),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated "${c.length}" prompts!`))}catch(u){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create prompts! - ${u.message}`))}return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${e.length}" prompts!`)),!n}var $m=100;async function xm(t,e){let r=await bt(t);await _bluebird.mapSeries.call(void 0, _chunkOMVVROKBcjs.b.call(void 0, e,$m),async n=>{await l(t,Co,{privacyCenterId:r,policies:n.map(([i,s])=>({id:s,title:i.title,disableEffectiveOn:i.disableEffectiveOn,disabledLocales:i.disabledLocales,...i.effectiveOn||i.content?{version:{...i.effectiveOn?{effectiveOn:i.effectiveOn}:{},...i.content?{content:{defaultMessage:i.content}}:{}}}:{}}))})})}async function Kp(t,e){let r=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" policies...`));let n=e.filter(o=>e.filter(p=>o.title===p.title).length>1);if(n.length>0)throw new Error(`Failed to upload policies as there were non-unique entries found: ${n.map(({title:o})=>o).join(",")}`);let i=await Cr(t),s=_chunkOMVVROKBcjs.e.call(void 0, i,({title:o})=>o.defaultMessage);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Upserting "${e.length}" new policies...`)),await xm(t,e.map(o=>[o,_optionalChain([s, 'access', _73 => _73[o.title], 'optionalAccess', _74 => _74.id])])),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced ${e.length} policies!`))}catch(o){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create policies! - ${o.message}`))}return!r}var qm=100;async function vm(t,e){await _bluebird.mapSeries.call(void 0, _chunkOMVVROKBcjs.b.call(void 0, e,qm),async r=>{await l(t,Eo,{messages:r.map(n=>({...n.id.includes(".")?{}:{id:n.id},defaultMessage:n.defaultMessage,targetReactIntlId:n.targetReactIntlId,translations:n.translations?Object.entries(n.translations).map(([i,s])=>({locale:i,value:s})):void 0}))})})}async function jp(t,e){let r=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" messages...`));let n=e.filter(i=>e.filter(s=>i.id===s.id).length>1);if(n.length>0)throw new Error(`Failed to upload messages as there were non-unique entries found: ${n.map(({id:i})=>i).join(",")}`);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Upserting "${e.length}" new messages...`)),await vm(t,e),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced ${e.length} messages!`))}catch(i){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create messages! - ${i.message}`))}return!r}async function Yp(t,e){let r=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Syncing privacy center..."));let n=await bt(t);try{await l(t,Xs,{input:{privacyCenterId:n,transformAccessReportJsonToCsv:e.transformAccessReportJsonToCsv,useCustomEmailDomain:e.useCustomEmailDomain,useNoReplyEmailAddress:e.useNoReplyEmailAddress,replyToEmail:e.replyToEmail,supportEmail:e.supportEmail,preferBrowserDefaultLocale:e.preferBrowserDefaultLocale,defaultLocale:e.defaultLocale,locales:e.locales,showMarketingPreferences:e.showMarketingPreferences,showManageYourPrivacy:e.showManageYourPrivacy,showPolicies:e.showPolicies,showConsentManager:e.showConsentManager,showDataFlows:e.showDataFlows,showCookies:e.showCookies,showTrackingTechnologies:e.showTrackingTechnologies,showPrivacyRequestButton:e.showPrivacyRequestButton,isDisabled:e.isDisabled,...e.theme?{colorPalette:e.theme.colors,componentStyles:e.theme.componentStyles,textStyles:e.theme.textStyles}:{}}}),_chunkZUNVPK23cjs.a.info(_colors2.default.green("Successfully synced privacy center!"))}catch(i){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create privacy center! - ${i.message}`))}return!r}var _airgapjstypes = require('@transcend-io/airgap.js-types');var zp="https://app.transcend.io/consent-manager/regional-experiences/purposes";async function Om(t,e){let r=await yr(t),n=_chunkOMVVROKBcjs.e.call(void 0, r,"name"),i=await Ir(t),s=_chunkOMVVROKBcjs.e.call(void 0, i,"trackingType");await _bluebird.map.call(void 0, e,async(o,p)=>{let c=_optionalChain([o, 'access', _75 => _75.purposes, 'optionalAccess', _76 => _76.map, 'call', _77 => _77((d,f)=>{let g=s[d.trackingType];if(!g)throw new Error(`Invalid purpose trackingType provided at consentManager.experiences[${p}].purposes[${f}]: ${d.trackingType}. See list of valid purposes ${zp}`);return g.id})]),u=_optionalChain([o, 'access', _78 => _78.optedOutPurposes, 'optionalAccess', _79 => _79.map, 'call', _80 => _80((d,f)=>{let g=s[d.trackingType];if(!g)throw new Error(`Invalid purpose trackingType provided at consentManager.experiences[${p}].optedOutPurposes[${f}]: ${d.trackingType}. See list of valid purposes ${zp}`);return g.id})]),m=n[o.name];m?(await l(t,Gs,{input:{id:m.id,name:o.displayName,regions:o.regions,operator:o.operator,onConsentExpiry:o.onConsentExpiry,consentExpiry:o.consentExpiry,displayPriority:o.displayPriority!==m.displayPriority?o.displayPriority:void 0,viewState:o.viewState,purposes:c,optedOutPurposes:u,browserLanguages:o.browserLanguages,browserTimeZones:o.browserTimeZones}}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced consent experience "${o.name}"!`))):(await l(t,Ns,{input:{name:o.name,displayName:o.displayName,regions:o.regions,operator:o.operator,onConsentExpiry:o.onConsentExpiry||_airgapjstypes.OnConsentExpiry.Prompt,consentExpiry:o.consentExpiry,displayPriority:o.displayPriority,viewState:o.viewState||_airgapjstypes.InitialViewState.Hidden,purposes:c||[],optedOutPurposes:u||[],browserLanguages:o.browserLanguages,browserTimeZones:o.browserTimeZones}}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created consent experience "${o.name}"!`)))},{concurrency:10})}async function Wp(t,e){let r;try{r=await De(t,1)}catch(n){if(n.message.includes("AirgapBundle not found")){let i=await bt(t),{createConsentManager:s}=await l(t,Rs,{domains:e.domains,privacyCenterId:i});r=s.consentManager.id}else throw n}if(e.domains&&await l(t,xs,{domains:e.domains,airgapBundleId:r}),e.partition){let i=(await zt(t)).find(s=>s.name===e.partition);if(!i)throw new Error(`Partition "${e.partition}" not found. Please create the partition first.`);await l(t,Ds,{partitionId:i.id,airgapBundleId:r})}e.version&&await l(t,bs,{airgapBundleId:r,version:e.version}),e.signedIabAgreement&&await l(t,qs,{input:{id:r,...e.signedIabAgreement?{signedIabAgreement:e.signedIabAgreement}:{}}}),e.unknownRequestPolicy&&await l(t,vs,{input:{id:r,unknownRequestPolicy:e.unknownRequestPolicy}}),e.unknownRequestPolicy&&await l(t,Ls,{input:{id:r,unknownCookiePolicy:e.unknownCookiePolicy}}),e.telemetryPartitioning&&await l(t,ks,{input:{id:r,strategy:e.telemetryPartitioning}}),e.consentPrecedence&&await l(t,_s,{input:{id:r,consentPrecedence:e.consentPrecedence}}),e.experiences&&await Om(t,e.experiences),e.theme&&await l(t,Os,{input:{airgapBundleId:r,...e.theme}})}var Xp=100;async function Gm(t,e,r=!1){let n=await De(t);await _bluebird.mapSeries.call(void 0, _chunkOMVVROKBcjs.b.call(void 0, e,Xp),async i=>{await l(t,Cs,{airgapBundleId:n,dataFlows:i.map(([s,o])=>({id:o,value:s.value,type:s.type,trackingType:s.trackingPurposes&&s.trackingPurposes.length>0?s.trackingPurposes:void 0,description:s.description,service:s.service,status:s.status,attributes:s.attributes})),classifyService:r})})}async function Nm(t,e,r=!1){let n=await De(t);await _bluebird.mapSeries.call(void 0, _chunkOMVVROKBcjs.b.call(void 0, e,Xp),async i=>{await l(t,hs,{airgapBundleId:n,dataFlows:i.map(s=>({value:s.value,type:s.type,trackingType:s.trackingPurposes&&s.trackingPurposes.length>0?s.trackingPurposes:void 0,description:s.description,service:s.service,status:s.status,attributes:s.attributes})),dropMatchingDataFlowsInTriage:!0,classifyService:r})})}async function el(t,e,r){let n=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" data flows...`));let i=e.filter(d=>e.filter(f=>d.value===f.value&&d.type===f.type).length>1);if(i.length>0)throw new Error(`Failed to upload data flows as there were non-unique entries found: ${i.map(({value:d})=>d).join(",")}`);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Fetching data flows..."));let[s,o]=await Promise.all([Rt(t,_privacytypes.ConsentTrackerStatus.Live),Rt(t,_privacytypes.ConsentTrackerStatus.NeedsReview)]),p=[...s,...o],c=e.map(d=>[d,_optionalChain([p, 'access', _81 => _81.find, 'call', _82 => _82(f=>d.value===f.value&&d.type===f.type), 'optionalAccess', _83 => _83.id])]),u=c.filter(([,d])=>!d).map(([d])=>d);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating "${u.length}" new data flows...`)),await Nm(t,u,r),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced ${u.length} data flows!`))}catch(d){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create data flows! - ${d.message}`))}let m=c.filter(d=>!!d[1]);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${m.length}" data flows...`)),await Gm(t,m,r),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated "${m.length}" data flows!`))}catch(d){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create data flows! - ${d.message}`))}return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${e.length}" data flows!`)),!n}async function Fm(t,e){let{createPromptPartial:{promptPartial:r}}=await l(t,Fo,{input:e});return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created prompt partial "${e.title}"!`)),r.id}async function Um(t,e){await l(t,Mo,{input:{promptPartials:e.map(([r,n])=>({...r,id:n}))}}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated ${e.length} prompt partials!`))}async function tl(t,e,r=20){let n=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" prompt partials...`));let i=await Dr(t),s=_chunkOMVVROKBcjs.e.call(void 0, i,"title"),o=e.map(u=>[u,_optionalChain([s, 'access', _84 => _84[u.title], 'optionalAccess', _85 => _85.id])]),p=o.filter(([,u])=>!u).map(([u])=>u);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating "${p.length}" new prompt partials...`)),await _bluebird.map.call(void 0, p,async u=>{await Fm(t,u)},{concurrency:r}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced ${p.length} prompt partials!`))}catch(u){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create prompt partials! - ${u.message}`))}let c=o.filter(u=>!!u[1]);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${c.length}" prompt partials...`)),await Um(t,c),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated "${c.length}" prompt partials!`))}catch(u){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create prompt partials! - ${u.message}`))}return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${e.length}" prompt partials!`)),!n}async function Qm(t,e){let{createPromptGroup:{promptGroup:r}}=await l(t,Bo,{input:e});return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created prompt group "${e.title}"!`)),r.id}async function Vm(t,e){await l(t,Uo,{input:{promptGroups:e.map(([r,n])=>({...r,id:n}))}}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated ${e.length} prompt groups!`))}async function rl(t,e,r=20){let n=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" prompt groups...`));let i=await xr(t),s=await $t(t),o=_chunkOMVVROKBcjs.e.call(void 0, s,"title"),p=_chunkOMVVROKBcjs.e.call(void 0, i,"title"),c=e.map(d=>[d,_optionalChain([p, 'access', _86 => _86[d.title], 'optionalAccess', _87 => _87.id])]),u=c.filter(([,d])=>!d).map(([d])=>d);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating "${u.length}" new prompt groups...`)),await _bluebird.map.call(void 0, u,async d=>{await Qm(t,{...d,promptIds:d.prompts.map(f=>{let g=o[f];if(!g)throw new Error(`Failed to find prompt with title: "${f}"`);return g.id})})},{concurrency:r}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced ${u.length} prompt groups!`))}catch(d){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create prompt groups! - ${d.message}`))}let m=c.filter(d=>!!d[1]);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${m.length}" prompt groups...`)),await Vm(t,m.map(([{prompts:d,...f},g])=>[{...f,promptIds:d.map(y=>{let S=o[y];if(!S)throw new Error(`Failed to find prompt with title: "${y}"`);return S.id})},g])),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated "${m.length}" prompt groups!`))}catch(d){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create prompt groups! - ${d.message}`))}return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${e.length}" prompt groups!`)),!n}async function jm(t,e){let r={title:e.title,description:e.description,address:e.address,headquarterCountry:e.headquarterCountry,headquarterSubDivision:e.headquarterSubDivision,dataProcessingAgreementLink:e.dataProcessingAgreementLink,contactName:e.contactName,contactPhone:e.contactPhone,websiteUrl:e.websiteUrl},{createVendor:n}=await l(t,ma,{input:r});return n.vendor}async function Ym(t,e){await l(t,da,{input:{vendors:e.map(([r,n])=>({id:n,title:r.title,description:r.description,address:r.address,headquarterCountry:r.headquarterCountry,headquarterSubDivision:r.headquarterSubDivision,dataProcessingAgreementLink:r.dataProcessingAgreementLink,contactName:r.contactName,contactPhone:r.contactPhone,websiteUrl:r.websiteUrl,attributes:r.attributes}))}})}async function il(t,e){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" vendors...`));let r=!1,n=await wr(t),i=_chunkOMVVROKBcjs.e.call(void 0, n,"title"),s=e.filter(o=>!i[o.title]);await _bluebird.mapSeries.call(void 0, s,async o=>{try{let p=await jm(t,o);i[p.title]=p,_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced vendor "${o.title}"!`))}catch(p){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync vendor "${o.title}"! - ${p.message}`))}});try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${e.length}" vendors!`)),await Ym(t,e.map(o=>[o,i[o.title].id])),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced "${e.length}" vendors!`))}catch(o){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync "${e.length}" vendors ! - ${o.message}`))}return!r}async function zm(t,e){let r={name:e.name,category:e.category,description:e.description},{createDataCategory:n}=await l(t,ga,{input:r});return n.dataCategory}async function Wm(t,e){await l(t,ya,{input:{dataSubCategories:e.map(([r,n])=>({id:n,description:r.description,attributes:r.attributes}))}})}async function nl(t,e){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" data categories...`));let r=!1,n=await hr(t),i=_chunkOMVVROKBcjs.e.call(void 0, n,({name:o,category:p})=>`${o}:${p}`),s=e.filter(o=>!i[`${o.name}:${o.category}`]);await _bluebird.mapSeries.call(void 0, s,async o=>{try{let p=await zm(t,o);i[`${p.name}:${p.category}`]=p,_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced data category "${o.name}"!`))}catch(p){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync data category "${o.name}"! - ${p.message}`))}});try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${e.length}" data categories!`)),await Wm(t,e.map(o=>[o,i[`${o.name}:${o.category}`].id])),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced "${e.length}" data categories!`))}catch(o){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync "${e.length}" data categories ! - ${o.message}`))}return!r}async function Jm(t,e){let r={name:e.name,purpose:e.purpose,description:e.description},{createProcessingPurposeSubCategory:n}=await l(t,Ca,{input:r});return n.processingPurposeSubCategory}async function Xm(t,e){await l(t,Sa,{input:{processingPurposeSubCategories:e.map(([r,n])=>({id:n,description:r.description,attributes:r.attributes}))}})}async function ol(t,e){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" processing purposes...`));let r=!1,n=await Ar(t),i=_chunkOMVVROKBcjs.e.call(void 0, n,({name:o,purpose:p})=>`${o}:${p}`),s=e.filter(o=>!i[`${o.name}:${o.purpose}`]);await _bluebird.mapSeries.call(void 0, s,async o=>{try{let p=await Jm(t,o);i[`${p.name}:${p.purpose}`]=p,_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced processing purpose "${o.name}"!`))}catch(p){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync processing purpose "${o.name}"! - ${p.message}`))}});try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${e.length}" processing purposes!`)),await Xm(t,e.map(o=>[o,i[`${o.name}:${o.purpose}`].id])),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced "${e.length}" processing purposes!`))}catch(o){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync "${e.length}" processing purposes ! - ${o.message}`))}return!r}async function td(t,e){let r={title:e.title,description:e.description},{createProcessingActivity:n}=await l(t,Ia,{input:r});return n.processingActivity}async function rd(t,e){let r=e.filter(([,n])=>n===void 0).map(([{title:n}])=>n);if(r.length>0)throw new Error(`The following ${r.length} processing activities do not exist and thus can't be updated: "${r.join('", "')}"`);await l(t,Ta,{input:{processingActivities:e.map(([{processingSubPurposes:n,dataSubCategories:i,saaSCategories:s,...o},p])=>({dataSubCategoryInputs:_optionalChain([i, 'optionalAccess', _88 => _88.map, 'call', _89 => _89(({category:c,name:u})=>({category:c,name:_nullishCoalesce(u, () => (""))}))]),processingPurposeSubCategoryInputs:_optionalChain([n, 'optionalAccess', _90 => _90.map, 'call', _91 => _91(({purpose:c,name:u})=>({purpose:c,name:_nullishCoalesce(u, () => ("Other"))}))]),saaSCategoryTitles:s,...o,id:p}))}})}async function sl(t,e){let r=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" processing activities...`));let n=await Sr(t),i=_chunkOMVVROKBcjs.e.call(void 0, n,"title"),s=e.filter(o=>!i[o.title]);s.length>0&&_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating "${s.length}" new processing activities...`)),await _bluebird.mapSeries.call(void 0, s,async o=>{try{let p=await td(t,o);i[p.title]=p,_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created processing activity "${o.title}"!`))}catch(p){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create processing activity "${o.title}"! - ${p.message}`))}});try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${e.length}" processing activities!`)),await rd(t,e.map(o=>[o,_optionalChain([i, 'access', _92 => _92[o.title], 'optionalAccess', _93 => _93.id])])),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced "${e.length}" processingActivities!`))}catch(o){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync "${e.length}" processingActivities! - ${o.message}`))}return!r}var Mt=10;async function Z$(t,e,{pageSize:r=50,publishToPrivacyCenter:n=!0,classifyService:i=!1,deleteExtraAttributeValues:s=!1}){let o=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Fetching data with page size ${r}...`));let{templates:p,attributes:c,actions:u,identifiers:m,"data-subjects":d,"business-entities":f,enrichers:g,cookies:y,"consent-manager":S,"data-silos":R,"data-flows":I,prompts:L,"prompt-groups":C,"prompt-partials":O,agents:H,"agent-functions":K,"agent-files":se,vendors:J,"data-categories":me,"processing-activities":ce,"processing-purposes":X,"action-items":Ae,"action-item-collections":Ie,teams:pe,"privacy-center":de,messages:we,policies:ke,partitions:Ze}=t,[Se,ne,ue]=await Promise.all([g||m?ip(t,e,!n):{},R||d||g||ce?ep(t,e):{},R&&R.map(A=>A["api-key-title"]||[]).reduce((A,G)=>A+G.length,0)>0?$r(t,e):{}]);if(S){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Syncing consent manager..."));try{await Wp(e,S),_chunkZUNVPK23cjs.a.info(_colors2.default.green("Successfully synced consent manager!"))}catch(A){o=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync consent manager! - ${A.message}`))}}if(L){let A=await Vp(e,L);o=o||!A}if(O){let A=await tl(e,O);o=o||!A}if(C){let A=await rl(e,C);o=o||!A}if(pe){let A=await Bp(e,pe);o=o||!A}if(p&&(_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${p.length}" email templates...`)),await _bluebird.map.call(void 0, p,async A=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing template "${A.title}"...`));try{await yp(A,e),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced template "${A.title}"!`))}catch(G){o=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync template "${A.title}"! - ${G.message}`))}},{concurrency:Mt}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${p.length}" email templates!`))),f){let A=await Lp(e,f);o=o||!A}if(J){let A=await il(e,J);o=o||!A}if(me){let A=await nl(e,me);o=o||!A}if(X){let A=await ol(e,X);o=o||!A}if(Ze){let A=await Cp(e,Ze);o=o||!A}if(H){let A=await Dp(e,H);o=o||!A}if(K){let A=await xp(e,K);o=o||!A}if(se){let A=await $p(e,se);o=o||!A}if(y){let A=await Fp(e,y);o=o||!A}if(Ie){let A=await Ep(e,Ie);o=o||!A}if(c){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${c.length}" attributes...`));let A=await Et(e);await _bluebird.map.call(void 0, c,async G=>{let fe=A.find(ge=>ge.name===G.name);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing attribute "${G.name}"...`));try{await qp(e,G,{existingAttribute:fe,deleteExtraAttributeValues:s}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced attribute "${G.name}"!`))}catch(ge){o=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync attribute "${G.name}"! - ${ge.message}`))}},{concurrency:Mt}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${c.length}" attributes!`))}if(Ae){let A=await wp(e,Ae);o=o||!A}if(g&&(_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${g.length}" enrichers...`)),await _bluebird.map.call(void 0, g,async A=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing enricher "${A.title}"...`));try{await gp(e,{enricher:A,identifierByName:Se,dataSubjectsByName:ne}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced enricher "${A.title}"!`))}catch(G){o=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync enricher "${A.title}"! - ${G.message}`))}},{concurrency:Mt}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${g.length}" enrichers!`))),m&&(_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${m.length}" identifiers...`)),await _bluebird.map.call(void 0, m,async A=>{let G=Se[A.name];if(!G)throw new Error(`Failed to find identifier with name: ${A.type}. Should have been auto-created by cli.`);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing identifier "${A.type}"...`));try{await Mp(e,{identifier:A,dataSubjectsByName:ne,identifierId:G.id,skipPublish:!n}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced identifier "${A.type}"!`))}catch(fe){o=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync identifier "${A.type}"! - ${fe.message}`))}},{concurrency:Mt}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${m.length}" identifiers!`))),u){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${u.length}" actions...`));let A=await ur(e);await _bluebird.map.call(void 0, u,async G=>{let fe=A.find(ge=>ge.type===G.type);if(!fe)throw new Error(`Failed to find action with type: ${G.type}. Should have already existing in the organization.`);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing action "${G.type}"...`));try{await Tp(e,{action:G,actionId:fe.id,skipPublish:!n}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced action "${G.type}"!`))}catch(ge){o=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync action "${G.type}"! - ${ge.message}`))}},{concurrency:Mt}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${u.length}" actions!`))}if(d){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${d.length}" data subjects...`));let A=await Yt(e);await _bluebird.map.call(void 0, d,async G=>{let fe=A.find(ge=>ge.type===G.type);if(!fe)throw new Error(`Failed to find data subject with type: ${G.type}. Should have already existing in the organization.`);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing data subject "${G.type}"...`));try{await Qp(e,{dataSubject:G,dataSubjectId:fe.id,skipPublish:!n}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced data subject "${G.type}"!`))}catch(ge){o=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync data subject "${G.type}"! - ${ge.message}`))}},{concurrency:Mt}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${d.length}" data subjects!`))}if(I){let A=await el(e,I,i);o=o||!A}if(de){let A=await Yp(e,de);o=o||!A}if(we){let A=await jp(e,we);o=o||!A}if(ke){let A=await Kp(e,ke);o=o||!A}let Ee=[];if(R){let{success:A,dataSiloTitleToId:G}=await mp(R,e,{dataSubjectsByName:ne,apiKeysByTitle:ue,pageSize:r});_optionalChain([R, 'optionalAccess', _94 => _94.forEach, 'call', _95 => _95(fe=>{fe["deletion-dependencies"]&&Ee.push([G[fe.title],fe["deletion-dependencies"]])})]),o=o||!A}if(Ee.length>0&&await dp(e,Ee),ce){let A=await sl(e,ce);o=o||!A}return o}var nd=1e3;async function ex(t,e,r){let n=_chunkOMVVROKBcjs.b.call(void 0, r,nd);await _bluebird.mapSeries.call(void 0, n,async i=>{await l(t,to,{pluginId:e,rawResults:i})})}async function ZD({requestActions:t,auth:e,requestIds:r,statuses:n=[_privacytypes.RequestStatus.Compiling,_privacytypes.RequestStatus.RequestMade,_privacytypes.RequestStatus.Delayed,_privacytypes.RequestStatus.Approving,_privacytypes.RequestStatus.Secondary,_privacytypes.RequestStatus.Enriching,_privacytypes.RequestStatus.Waiting,_privacytypes.RequestStatus.SecondaryApproving],createdAtAfter:i,createdAtBefore:s,concurrency:o=100,transcendUrl:p=_chunkOMVVROKBcjs.r}){let c=Z(p,e),u=new Date().getTime(),m=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),d=await le(c,{actions:t,statuses:n,createdAtBefore:s,createdAtAfter:i,isSilent:!1,requestIds:r});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Marking "${d.length}" as silent mode.`));let f=0;m.start(d.length,0),await _bluebird.map.call(void 0, d,async S=>{await l(c,St,{input:{id:S.id,isSilent:!0}}),f+=1,m.update(f)},{concurrency:o}),m.stop();let y=new Date().getTime()-u;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully marked ${f} requests as silent mode in "${y/1e3}" seconds!`)),d.length}async function ll(t,e){let r=_typeutils.getValues.call(void 0, At).filter(i=>!e.getValue("columnNames",i)),n=r.length===0?{}:await _inquirer2.default.prompt(r.map(i=>{let s=_chunkOMVVROKBcjs.h.call(void 0, i.replace("ColumnName","")),o=Tt(t,s,Ra[i],!!ba[i]);return{name:i,message:`Choose the column that will be used to map in the field: ${s}`,type:"list",default:o[0],choices:o}}));return await Promise.all(_typeutils.getEntries.call(void 0, n).map(([i,s])=>e.setValue(s,"columnNames",i))),n}async function cl(t,e,{state:r,columnNameMap:n}){let i=S=>r.getValue("columnNames",S)||n[S],{internalSubjects:s}=await l(t,nr);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Determining mapping of columns for request action"));let o=await mt(He(e,i("requestType")),Object.values(_privacytypes.RequestAction),r.getValue("requestTypeToRequestAction"));await r.setValue(o,"requestTypeToRequestAction"),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Determining mapping of columns for subject"));let p=await mt(He(e,i("subjectType")),s.map(({type:S})=>S),r.getValue("subjectTypeToSubjectName"));await r.setValue(p,"subjectTypeToSubjectName"),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Determining mapping of columns for locale"));let c=await mt(He(e,i("locale")),Object.values(_internationalization.LOCALE_KEY),r.getValue("languageToLocale"));await r.setValue(c,"languageToLocale"),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Determining mapping of columns for request status")),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Determining mapping of columns for request status"));let u=i("requestStatus"),m=u===Y?{}:await mt(He(e,u),[...Object.values(_privacytypes.CompletedRequestStatus),Y],r.getValue("statusToRequestStatus"));await r.setValue(m,"statusToRequestStatus"),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Determining mapping of columns for country"));let d=i("country"),f=d===Y?{}:await mt(He(e,d),[...Object.values(_privacytypes.IsoCountryCode),Y],r.getValue("regionToCountry"));await r.setValue(f,"regionToCountry"),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Determining mapping of columns for country sub division"));let g=i("countrySubDivision"),y=g===Y?{}:await mt(He(e,g),[...Object.values(_privacytypes.IsoCountrySubdivisionCode),Y],r.getValue("regionToCountrySubDivision"));await r.setValue(y,"regionToCountrySubDivision")}var _iotstypes = require('io-ts-types');var Id=ae.record(ae.string,ae.array(ae.intersection([ae.type({value:ae.string}),ae.partial({name:ae.string})]))),Pq= exports.tf =ae.intersection([ae.type({email:ae.string,attestedExtraIdentifiers:Id,coreIdentifier:ae.string,requestType:_typeutils.valuesOf.call(void 0, _privacytypes.RequestAction),subjectType:ae.string}),ae.partial({country:_typeutils.valuesOf.call(void 0, _privacytypes.IsoCountryCode),countrySubDivision:_typeutils.valuesOf.call(void 0, _privacytypes.IsoCountrySubdivisionCode),attributes:ae.array(va),status:_typeutils.valuesOf.call(void 0, _privacytypes.CompletedRequestStatus),createdAt:_iotstypes.DateFromISOString,dataSiloIds:ae.array(ae.string),locale:_typeutils.valuesOf.call(void 0, _internationalization.LOCALE_KEY)})]);function Td(t,e,r){if(e===_privacytypes.IdentifierType.Email)return t.toLowerCase();if(e===_privacytypes.IdentifierType.Phone){let n=t.replace(_privacytypes.NORMALIZE_PHONE_NUMBER,"").replace(/[()]/g,"").replace(/[–]/g,"").replace(/[:]/g,"").replace(/[]/g,"").replace(/[A-Za-z]/g,"");return n?n.startsWith("+")?n:`+${r}${n}`:""}return t}function ul(t,e,{columnNameMap:r,identifierNameMap:n,attributeNameMap:i,requestAttributeKeys:s,defaultPhoneCountryCode:o="1"}){let p=c=>e.getValue("columnNames",c)||r[c];return t.map(c=>{let u={};Object.entries(n).filter(([,g])=>g!==Y).forEach(([g,y])=>{let S=Object.values(_privacytypes.IdentifierType).includes(g)?g:_privacytypes.IdentifierType.Custom,R=c[y];if(R){let I=Td(R,S,o);I&&(u[S]||(u[S]=[]),u[S].push({value:I,name:g}))}});let m=[];Object.entries(i).filter(([,g])=>g!==Y).forEach(([g,y])=>{let S=c[y];if(S){let R=_optionalChain([s, 'access', _96 => _96.find, 'call', _97 => _97(I=>I.name===g), 'optionalAccess', _98 => _98.type])==="MULTI_SELECT";m.push({values:R?mi(S):S,key:g})}});let d=p("requestType"),f=p("subjectType");return[c,{email:c[p("email")],attestedExtraIdentifiers:u,attributes:m,coreIdentifier:c[p("coreIdentifier")],requestType:d===Kt?e.getValue("requestTypeToRequestAction",ui):e.getValue("requestTypeToRequestAction",c[d]),subjectType:f===Kt?e.getValue("subjectTypeToSubjectName",ui):e.getValue("subjectTypeToSubjectName",c[f]),...p("locale")!==Y&&c[p("locale")]?{locale:e.getValue("languageToLocale",c[p("locale")])}:{},...p("country")!==Y&&c[p("country")]?{country:e.getValue("regionToCountry",c[p("country")])}:{},...p("countrySubDivision")!==Y&&c[p("countrySubDivision")]?{countrySubDivision:e.getValue("regionToCountrySubDivision",c[p("countrySubDivision")])}:{},...p("requestStatus")!==Y&&e.getValue("statusToRequestStatus",c[p("requestStatus")])!==Y&&c[p("requestStatus")]?{status:e.getValue("statusToRequestStatus",c[p("requestStatus")])}:{},...p("createdAt")!==Y&&c[p("createdAt")]?{createdAt:new Date(c[p("createdAt")])}:{},...p("dataSiloIds")!==Y&&c[p("dataSiloIds")]?{dataSiloIds:mi(c[p("dataSiloIds")])}:{}}]})}var _path = require('path');var fl=x.type({defaultMessage:x.string,id:x.string}),wd= exports.xf =x.type({downloadKey:x.string,error:x.union([x.null,x.string]),mimetype:x.string,size:x.string,fileName:x.string,dataPoint:x.type({id:x.string,title:x.union([fl,x.null]),description:x.union([fl,x.null]),name:x.string,slug:x.string,encryption:x.union([_typeutils.valuesOf.call(void 0, _privacytypes.TableEncryptionType),x.null]),dataSilo:x.type({id:x.string,title:x.string,description:x.string,type:x.string,outerType:x.union([x.string,x.null])}),path:x.array(x.string)})}),$d= exports.yf =x.type({nodes:x.array(wd),totalCount:x.number,_links:x.partial({next:x.union([x.string,x.null]),previous:x.union([x.string,x.null])})});async function gl(t,{sombra:e,concurrency:r=5,limit:n=100}){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Pulling file metadata for ${t.length} requests`));let i=new Date().getTime(),s=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),o=0;s.start(t.length,0);let p=await _bluebird.map.call(void 0, t,async m=>{let d=[],f=!0,g=0;for(;f;){let y;try{let S=await e.get(`v1/data-subject-request/${m.id}/download-keys`,{searchParams:{limit:n,offset:g}}).json();y=_typeutils.decodeCodec.call(void 0, $d,S),d.push(...y.nodes),g+=n,f=!!y._links.next&&y.nodes.length===n}catch(S){throw new Error(`Received an error from server: ${_optionalChain([S, 'optionalAccess', _99 => _99.response, 'optionalAccess', _100 => _100.body])||_optionalChain([S, 'optionalAccess', _101 => _101.message])}`)}}return o+=1,s.update(o),[m,d]},{concurrency:r});s.stop();let u=new Date().getTime()-i;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully downloaded file metadata ${t.length} requests in "${u/1e3}" seconds!`)),p}async function yl(t,{requestId:e,sombra:r,onFileDownloaded:n,concurrency:i=20}){await _bluebird.map.call(void 0, t,async s=>{try{await r.get("v1/files",{searchParams:{downloadKey:s.downloadKey}}).buffer().then(o=>n(s,o))}catch(o){if(_optionalChain([o, 'optionalAccess', _102 => _102.response, 'optionalAccess', _103 => _103.body, 'optionalAccess', _104 => _104.includes, 'call', _105 => _105("fileMetadata#verify")])){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to pull file for: ${s.fileName} (request:${e}) - JWT expired. This likely means that the file is no longer available. Try restarting the request from scratch in Transcend Admin Dashboard. Skipping the download of this file.`));return}throw new Error(`Received an error from server: ${_optionalChain([o, 'optionalAccess', _106 => _106.response, 'optionalAccess', _107 => _107.body])||_optionalChain([o, 'optionalAccess', _108 => _108.message])}`)}},{concurrency:i})}async function Yq({auth:t,folderPath:e,requestIds:r,createdAtBefore:n,sombraAuth:i,createdAtAfter:s,statuses:o=[_privacytypes.RequestStatus.Approving,_privacytypes.RequestStatus.Downloadable],concurrency:p=5,transcendUrl:c=_chunkOMVVROKBcjs.r,approveAfterDownload:u=!1}){let m=Z(c,t),d=await nt(c,t,i);_fs.existsSync.call(void 0, e)||_fs.mkdirSync.call(void 0, e);let f=await le(m,{actions:[_privacytypes.RequestAction.Access],createdAtBefore:n,createdAtAfter:s,statuses:o,requestIds:r}),g=await gl(f,{sombra:d,concurrency:p}),y=new Date().getTime(),S=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),R=0,I=0;S.start(f.length,0),await _bluebird.map.call(void 0, g,async([O,H])=>{let K=_path.join.call(void 0, e,O.id);_fs.existsSync.call(void 0, K)||_fs.mkdirSync.call(void 0, K),await yl(H,{sombra:d,requestId:O.id,onFileDownloaded:(se,J)=>{let me=_path.join.call(void 0, K,se.fileName),ce=_path.dirname.call(void 0, me);_fs.existsSync.call(void 0, ce)||_fs.mkdirSync.call(void 0, ce,{recursive:!0}),_fs.writeFileSync.call(void 0, me,J)}}),u&&O.status===_privacytypes.RequestStatus.Approving&&(await l(m,or,{input:{requestId:O.id}}),I+=1),R+=1,S.update(R)},{concurrency:p}),S.stop();let C=new Date().getTime()-y;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully downloaded ${R} requests in "${C/1e3}" seconds!`)),I>0&&_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Approved ${I} requests in Transcend.`)),f.length}var dn=re.type({id:re.string,link:re.string,status:_typeutils.valuesOf.call(void 0, _privacytypes.RequestStatus),type:_typeutils.valuesOf.call(void 0, _privacytypes.RequestAction),subjectType:re.string,email:re.union([re.null,re.string]),coreIdentifier:re.string,isSilent:re.boolean,isTest:re.boolean,country:re.union([re.null,_typeutils.valuesOf.call(void 0, _privacytypes.IsoCountryCode)]),countrySubDivision:re.union([re.null,_typeutils.valuesOf.call(void 0, _privacytypes.IsoCountrySubdivisionCode)]),attributeValues:re.array(re.type({attributeKey:re.type({name:re.string}),name:re.string}))});async function Al(t,e,{details:r="",isTest:n=!1,emailIsVerified:i=!0,skipSendingReceipt:s=!1,isSilent:o=!0,additionalAttributes:p=[]}={}){let c=[...p];(e.attributes||[]).forEach(d=>{let f=c.find(g=>g.key===d.key);f?(f.values.push(...d.values),f.values=_chunkOMVVROKBcjs.j.call(void 0, f.values)):c.push(d)});let u;try{u=await t.post("v1/data-subject-request",{json:{type:e.requestType,subject:{coreIdentifier:e.coreIdentifier,email:e.email,emailIsVerified:i,attestedExtraIdentifiers:e.attestedExtraIdentifiers},subjectType:e.subjectType,isSilent:o,isTest:n,skipSendingReceipt:s,...e.locale?{locale:e.locale}:{},details:r,attributes:c,...e.country||e.countrySubDivision?{region:{...e.country?{country:e.country}:e.countrySubDivision?{country:e.countrySubDivision.split("-")[0]}:{},...e.countrySubDivision?{countrySubDivision:e.countrySubDivision}:{}}}:{},...e.createdAt?{createdAt:e.createdAt}:{},...e.dataSiloIds?{dataSiloIds:e.dataSiloIds}:{},...e.status?{completedRequestStatus:e.status}:{}}}).json()}catch(d){throw new Error(`Received an error from server: ${_optionalChain([d, 'optionalAccess', _109 => _109.response, 'optionalAccess', _110 => _110.body])||_optionalChain([d, 'optionalAccess', _111 => _111.message])}`)}let{request:m}=_typeutils.decodeCodec.call(void 0, re.type({request:dn}),u);return m}async function pv({requestActions:t,requestOrigins:e,auth:r,silentModeBefore:n,createdAtAfter:i,createdAtBefore:s,concurrency:o=50,transcendUrl:p=_chunkOMVVROKBcjs.r}){let c=Z(p,r),u=new Date().getTime(),m=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),d=await le(c,{actions:t,statuses:[_privacytypes.RequestStatus.Approving],createdAtAfter:i,origins:e,createdAtBefore:s});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Approving "${d.length}" requests.`));let f=0,g=0;m.start(d.length,0),await _bluebird.map.call(void 0, d,async R=>{n&&new Date(n)>new Date(R.createdAt)&&await l(c,St,{input:{id:R.id,isSilent:!0}});try{await l(c,or,{input:{requestId:R.id}})}catch(I){I.message.includes("Request must be in an approving state,")&&(g+=1)}f+=1,m.update(f)},{concurrency:o}),m.stop();let S=new Date().getTime()-u;return g>0&&_chunkZUNVPK23cjs.a.info(_colors2.default.yellow(`${g} requests were skipped.`)),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully approved ${f} requests in "${S/1e3}" seconds!`)),d.length}async function hv({requestActions:t=Object.values(_privacytypes.RequestAction),auth:e,requestIds:r,createdAtBefore:n,days:i=45,daysLeft:s=10,createdAtAfter:o,emailTemplate:p="Additional Time Needed",concurrency:c=100,transcendUrl:u=_chunkOMVVROKBcjs.r}){let m=Z(u,e),d=new Date().getTime(),f=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),y=(await gt(m,p)).find(C=>C.title===p);if(!y)throw new Error(`Failed to find a template with title: "${p}"`);let S=await le(m,{actions:t,createdAtBefore:n,createdAtAfter:o,isSilent:!1,isClosed:!1,requestIds:r});S=S.filter(C=>typeof C.daysRemaining=="number"&&C.daysRemaining<s),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Notifying "${S.length}" that more time is needed.`));let R=0;f.start(S.length,0),await _bluebird.map.call(void 0, S,async C=>{await l(m,Io,{input:{requestId:C.id,template:y.template.defaultMessage,subject:y.subject.defaultMessage,additionalTime:i}}),R+=1,f.update(R)},{concurrency:c}),f.stop();let L=new Date().getTime()-d;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully marked ${R} requests as silent mode in "${L/1e3}" seconds!`)),S.length}async function El(t,e,r){let{initializer:n}=await l(t,On),i=n.identifiers.filter(({name:o})=>!r.getValue("identifierNames",o)&&!pr.includes(o)),s=i.length===0?{}:await _inquirer2.default.prompt(i.map(({name:o})=>{let p=Tt(e,o,!1);return{name:o,message:`Choose the column that will be used to map in the identifier: ${o}`,type:"list",default:p[0],choices:p}}));return await Promise.all(Object.entries(s).map(([o,p])=>r.setValue(p,"identifierNames",o))),{...r.getValue("identifierNames"),...s}}async function _v({requestActions:t,cancellationTitle:e,auth:r,requestIds:n,silentModeBefore:i,createdAtBefore:s,createdAtAfter:o,statuses:p=[_privacytypes.RequestStatus.Compiling,_privacytypes.RequestStatus.RequestMade,_privacytypes.RequestStatus.Delayed,_privacytypes.RequestStatus.Approving,_privacytypes.RequestStatus.Secondary,_privacytypes.RequestStatus.Enriching,_privacytypes.RequestStatus.Waiting,_privacytypes.RequestStatus.SecondaryApproving],concurrency:c=50,transcendUrl:u=_chunkOMVVROKBcjs.r}){let m=Z(u,r),d=new Date().getTime(),f=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),g;if(e){let C=(await gt(m,e)).find(O=>O.title===e);if(!C)throw new Error(`Failed to find a template with title: "${e}"`);g=C}let y=await le(m,{actions:t,createdAtBefore:s,createdAtAfter:o,statuses:p,requestIds:n});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Canceling "${y.length}" requests${g?` Using template: ${g.title}`:""}.`));let S=0;f.start(y.length,0),await _bluebird.map.call(void 0, y,async L=>{i&&new Date(i)>new Date(L.createdAt)&&await l(m,St,{input:{id:L.id,isSilent:!0}}),await l(m,Ao,{input:{requestId:L.id,...g?{subject:`Re: ${g.subject.defaultMessage}`,template:g.template.defaultMessage}:{}}}),S+=1,f.update(S)},{concurrency:c}),f.stop();let I=new Date().getTime()-d;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully canceled ${S} requests in "${I/1e3}" seconds!`)),y.length}async function wl(t,e,r,n){let i=n.filter(({name:o})=>!r.getValue("attributeNames",o)),s=i.length===0?{}:await _inquirer2.default.prompt(i.map(({name:o})=>{let p=Tt(e,o,!1);return{name:o,message:`Choose the column that will be used to map in the attribute: ${o}`,type:"list",default:p[0],choices:p}}));return await Promise.all(Object.entries(s).map(([o,p])=>r.setValue(p,"attributeNames",o))),{...r.getValue("attributeNames"),...s}}var $l=/{\\"message\\":\\"(.+?)\\",/;function Or(t){return $l.test(t)?$l.exec(t)[1]:null}var _persistedstate = require('@transcend-io/persisted-state');async function aL({cacheFilepath:t,requestReceiptFolder:e,file:r,auth:n,sombraAuth:i,concurrency:s=100,defaultPhoneCountryCode:o="1",transcendUrl:p=_chunkOMVVROKBcjs.r,attributes:c=[],emailIsVerified:u=!0,skipFilterStep:m=!1,skipSendingReceipt:d=!0,isTest:f=!1,isSilent:g=!0,debug:y=!1,dryRun:S=!1}){let R=new Date().getTime(),I=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),L=La(c),C=new (0, _persistedstate.PersistedState)(t,wa,{columnNames:{},requestTypeToRequestAction:{},subjectTypeToSubjectName:{},languageToLocale:{},statusToRequestStatus:{},identifierNames:{},attributeNames:{},regionToCountrySubDivision:{},regionToCountry:{}}),O=_path.join.call(void 0, e,`tr-request-upload-${new Date().toISOString()}-${r.split("/").pop()}`.replace(".csv",".json")),H=new (0, _persistedstate.PersistedState)(O,$a,{successfulRequests:[],duplicateRequests:[],failingRequests:[]}),K=await nt(p,n,i),se=_a(r,Xt.record(Xt.string,Xt.string)),J=_chunkOMVVROKBcjs.j.call(void 0, se.map(Se=>Object.keys(Se)).flat());if(se.length===0)throw new Error("No Requests found in list! Ensure the first row of the CSV is a header and the rest are requests.");if(y){let Se=se[0];_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`First request: ${JSON.stringify(Se,null,2)}`))}let me=m?se:await Ga(se),ce=Z(p,n),X=await Fa(ce),Ae=await ll(J,C),Ie=await El(ce,J,C),pe=await wl(ce,J,C,X);await cl(ce,me,{state:C,columnNameMap:Ae});let de=ul(me,C,{defaultPhoneCountryCode:o,columnNameMap:Ae,identifierNameMap:Ie,attributeNameMap:pe,requestAttributeKeys:X});y||I.start(de.length,0);let we=0;await _bluebird.map.call(void 0, de,async([Se,ne],ue)=>{let Ee=y?`email:${ne.email} | coreIdentifier:${ne.coreIdentifier}`:`row:${ue.toString()}`;if(y&&_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`[${ue+1}/${de.length}] Importing: ${JSON.stringify(ne,null,2)}`)),S){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Bailing out on dry run because dryRun is set"));return}try{let A=await Al(K,ne,{details:`Uploaded by Transcend Cli: "tr-request-upload" : ${JSON.stringify(Se,null,2)}`,isTest:f,emailIsVerified:u,skipSendingReceipt:d,isSilent:g,additionalAttributes:L});y&&(_chunkZUNVPK23cjs.a.info(_colors2.default.green(`[${ue+1}/${de.length}] Successfully submitted the test data subject request: "${Ee}"`)),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`[${ue+1}/${de.length}] View it at: "${A.link}"`)));let G=H.getValue("successfulRequests");G.push({id:A.id,link:A.link,rowIndex:ue,coreIdentifier:A.coreIdentifier,attemptedAt:new Date().toISOString()}),await H.setValue(G,"successfulRequests")}catch(A){let G=`${A.message} - ${JSON.stringify(_optionalChain([A, 'access', _112 => _112.response, 'optionalAccess', _113 => _113.body]),null,2)}`,fe=Or(G);if(fe==="Client error: You have already made this request."){y&&_chunkZUNVPK23cjs.a.info(_colors2.default.yellow(`[${ue+1}/${de.length}] Skipping request as it is a duplicate`));let ge=H.getValue("duplicateRequests");ge.push({coreIdentifier:ne.coreIdentifier,rowIndex:ue,attemptedAt:new Date().toISOString()}),await H.setValue(ge,"duplicateRequests")}else{let ge=H.getValue("failingRequests");ge.push({...ne,rowIndex:ue,error:fe||G,attemptedAt:new Date().toISOString()}),await H.setValue(ge,"failingRequests"),y&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(fe||G)),_chunkZUNVPK23cjs.a.error(_colors2.default.red(`[${ue+1}/${de.length}] Failed to submit request for: "${Ee}"`)))}}we+=1,y||I.update(we)},{concurrency:s}),I.stop();let Ze=new Date().getTime()-R;_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Completed upload in "${Ze/1e3}" seconds.`)),H.getValue("duplicateRequests").length>0&&_chunkZUNVPK23cjs.a.info(_colors2.default.yellow(`Encountered "${H.getValue("duplicateRequests").length}" duplicate requests. See "${O}" to review the core identifiers for these requests.`)),H.getValue("failingRequests").length>0&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Encountered "${H.getValue("failingRequests").length}" errors. See "${O}" to review the error messages and inputs.`)),process.exit(1))}async function vl(t,e,{sendEmailReceipt:r=!1,skipWaitingPeriod:n=!1,emailIsVerified:i=!0,requestIdentifiers:s=[]}={}){let o=await t.post("v1/data-subject-request",{json:{type:e.type,subject:{coreIdentifier:e.coreIdentifier,email:e.email,emailIsVerified:i,...s.length>0?{attestedExtraIdentifiers:_typeutils.apply.call(void 0, _chunkOMVVROKBcjs.d.call(void 0, s.filter(c=>!(c.name==="email"&&c.value===e.email)&&!pr.includes(c.name)).map(c=>({...c,type:Object.values(_privacytypes.IdentifierType).includes(c.name)?c.name:_privacytypes.IdentifierType.Custom})),"type"),(c,u)=>c.map(({name:m,value:d})=>({...u===_privacytypes.IdentifierType.Custom?{name:m}:{},value:d})))}:{}},requestId:e.id,subjectType:e.subjectType,isSilent:e.isSilent,isTest:e.isTest,locale:e.locale,skipWaitingPeriod:n,createdAt:e.createdAt,details:`Restarted by Transcend cli: "tr-request-restart" - ${e.details}`,skipSendingReceipt:!r}}).json(),{request:p}=_typeutils.decodeCodec.call(void 0, ql.type({request:dn}),o);return p}var tf=Ye.intersection([lr,Ye.type({error:Ye.string})]),rf=Ye.type({restartedRequests:Ye.array(lr),failingRequests:Ye.array(tf)});async function wL({requestReceiptFolder:t,auth:e,sombraAuth:r,requestActions:n,requestStatuses:i,createdAtBefore:s,createdAtAfter:o,transcendUrl:p=_chunkOMVVROKBcjs.r,requestIds:c=[],createdAt:u=new Date,silentModeBefore:m,sendEmailReceipt:d=!1,emailIsVerified:f=!0,copyIdentifiers:g=!1,skipWaitingPeriod:y=!1,concurrency:S=20}){let R=new Date().getTime(),I=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),L=_path.join.call(void 0, t,`tr-request-restart-${new Date().toISOString()}.json`),C=new (0, _persistedstate.PersistedState)(L,rf,{restartedRequests:[],failingRequests:[]}),O=await nt(p,e,r),H=Z(p,e),se=(await le(H,{requestIds:c,actions:n,statuses:i,createdAtBefore:s,createdAtAfter:o})).filter(X=>new Date(X.createdAt)<u);if(_chunkZUNVPK23cjs.a.info(`Found ${se.length} requests to restart`),g&&_chunkZUNVPK23cjs.a.info("copyIdentifiers detected - All Identifiers will be copied."),d&&_chunkZUNVPK23cjs.a.info("sendEmailReceipt detected - Email receipts will be sent."),y&&_chunkZUNVPK23cjs.a.info("skipWaitingPeriod detected - Waiting period will be skipped."),c.length>0&&c.length!==se.length){let X=_chunkOMVVROKBcjs.c.call(void 0, c,se.map(({id:Ae})=>Ae));X.length>0&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to find the following requests by ID: ${X.join(",")}.`)),process.exit(1))}let J=0;I.start(se.length,0),await _bluebird.map.call(void 0, se,async(X,Ae)=>{try{let Ie=g?await Pr(H,O,{requestId:X.id}):[],pe=await vl(O,{...X,isSilent:m&&new Date(X.createdAt)<m?!0:X.isSilent},{requestIdentifiers:Ie,skipWaitingPeriod:y,sendEmailReceipt:d,emailIsVerified:f}),de=C.getValue("restartedRequests");de.push({id:pe.id,link:pe.link,rowIndex:Ae,coreIdentifier:pe.coreIdentifier,attemptedAt:new Date().toISOString()}),await C.setValue(de,"restartedRequests")}catch(Ie){let pe=`${Ie.message} - ${JSON.stringify(_optionalChain([Ie, 'access', _114 => _114.response, 'optionalAccess', _115 => _115.body]),null,2)}`,de=Or(pe),we=C.getValue("failingRequests");we.push({id:X.id,link:X.link,rowIndex:Ae,coreIdentifier:X.coreIdentifier,attemptedAt:new Date().toISOString(),error:de||pe}),await C.setValue(we,"failingRequests")}J+=1,I.update(J)},{concurrency:S}),I.stop();let ce=new Date().getTime()-R;_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Completed restarting of requests in "${ce/1e3}" seconds.`)),C.getValue("failingRequests").length>0&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Encountered "${C.getValue("failingRequests").length}" errors. See "${_path.resolve.call(void 0, L)}" to review the error messages and inputs.`)),process.exit(1))}async function OL({enricherIds:t,auth:e,concurrency:r=100,transcendUrl:n=_chunkOMVVROKBcjs.r}){let i=Z(n,e),s=new Date().getTime(),o=await le(i,{statuses:[_privacytypes.RequestStatus.Enriching]});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Processing enricher: "${t.join(",")}" fetched "${o.length}" in enriching status.`));let p=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),c=0;p.start(o.length,0);let u=0;await _bluebird.map.call(void 0, o,async f=>{let y=(await Tr(i,{requestId:f.id})).filter(S=>t.includes(S.enricher.id)&&![_privacytypes.RequestEnricherStatus.Resolved,_privacytypes.RequestEnricherStatus.Skipped].includes(S.status));y.length>0&&await _bluebird.mapSeries.call(void 0, y,async S=>{try{await l(i,wo,{requestEnricherId:S.id}),u+=1}catch(R){if(!R.message.includes("Client error: Cannot skip Request enricher because it has already completed"))throw R}}),c+=1,p.update(c)},{concurrency:r}),p.stop();let d=new Date().getTime()-s;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully skipped "${u}" for "${o.length}" requests in "${d/1e3}" seconds!`)),o.length}async function YL({auth:t,requestActions:e=[],createdAtBefore:r,createdAtAfter:n,transcendUrl:i=_chunkOMVVROKBcjs.r,requestEnricherStatuses:s=Object.values(_privacytypes.RequestEnricherStatus),requestIds:o=[],enricherId:p,concurrency:c=20}){let u=new Date().getTime(),m=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),d=Z(i,t);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Fetching requests to restart..."));let f=await le(d,{actions:e,statuses:[_privacytypes.RequestStatus.Enriching],createdAtBefore:r,createdAtAfter:n,requestIds:o}),g=0;if(o.length>0&&o.length!==f.length){let I=_chunkOMVVROKBcjs.c.call(void 0, o,f.map(({id:L})=>L));I.length>0&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to find the following requests by ID: ${I.join(",")}.`)),process.exit(1))}let y=0;m.start(f.length,0),await _bluebird.map.call(void 0, f,async I=>{let C=(await Tr(d,{requestId:I.id})).filter(O=>O.enricher.id===p&&s.includes(O.status));await _bluebird.map.call(void 0, C,async O=>{await Ip(d,O.id),g+=1}),y+=1,m.update(y)},{concurrency:c}),m.stop();let R=new Date().getTime()-u;_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Completed restarting of ${f.length} requests and ${g} enrichers in "${R/1e3}" seconds.`))}async function ik({requestActions:t,dataSiloId:e,auth:r,concurrency:n=20,transcendUrl:i=_chunkOMVVROKBcjs.r}){let s=Z(i,r),o=new Date().getTime(),p=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),c=await le(s,{actions:t,statuses:[_privacytypes.RequestStatus.Compiling,_privacytypes.RequestStatus.Approving]});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Retrying requests for Data Silo: "${e}", restarting "${c.length}" requests.`));let u=0,m=0;p.start(c.length,0),await _bluebird.map.call(void 0, c,async g=>{try{let y=await op(s,{requestId:g.id,dataSiloId:e});await l(s,Vo,{requestDataSiloId:y.id})}catch(y){if(!y.message.includes("Failed to find RequestDataSilo"))throw y;m+=1}u+=1,p.update(u)},{concurrency:n}),p.stop();let f=new Date().getTime()-o;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully notified Transcend in "${f/1e3}" seconds for ${u} requests, ${m} requests were skipped because data silo was not attached to the request!`)),c.length}async function dk({auth:t,sombraAuth:e,actions:r=[],statuses:n=[],identifierSearch:i,pageLimit:s=100,transcendUrl:o=_chunkOMVVROKBcjs.r,createdAtBefore:p,skipRequestIdentifiers:c=!1,createdAtAfter:u,isTest:m}){let d=Z(o,t),f=await nt(o,t,e),g="";p&&(g+=` before ${p.toISOString()}`),u&&(g+=`${g?", and":""} after ${u.toISOString()}`),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`${r.length>0?`Pulling requests of type "${r.join('" , "')}"`:"Pulling all requests"}${g}`));let y=await le(d,{actions:r,text:i,statuses:n,createdAtBefore:p,createdAtAfter:u,isTest:m}),S=c?y.map(I=>({...I,requestIdentifiers:[]})):await _bluebird.map.call(void 0, y,async I=>{let L=await Pr(d,f,{requestId:I.id});return{...I,requestIdentifiers:L}},{concurrency:s});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Pulled ${S.length} requests`));let R=S.map(({attributeValues:I,requestIdentifiers:L,id:C,email:O,type:H,status:K,subjectType:se,details:J,createdAt:me,country:ce,locale:X,origin:Ae,countrySubDivision:Ie,isSilent:pe,isTest:de,coreIdentifier:we,purpose:ke,...Ze})=>({"Request ID":C,"Created At":me,Email:O,"Core Identifier":we,"Request Type":H,"Data Subject Type":se,Status:K,Country:ce,"Country Sub Division":Ie,Details:J,Origin:Ae,"Silent Mode":pe,"Is Test Request":de,Language:X,"Purpose Trigger Name":_optionalChain([ke, 'optionalAccess', _116 => _116.title])||_optionalChain([ke, 'optionalAccess', _117 => _117.name])||"","Purpose Trigger Value":_optionalChain([ke, 'optionalAccess', _118 => _118.consent, 'optionalAccess', _119 => _119.toString, 'call', _120 => _120()])||"",...(_optionalChain([ke, 'optionalAccess', _121 => _121.enrichedPreferences])||[]).reduce((Se,ne)=>{let ue=_optionalChain([ne, 'access', _122 => _122.preferenceTopic, 'optionalAccess', _123 => _123.title, 'access', _124 => _124.defaultMessage])||ne.name;return ue?{...Se,[ue]:ne.selectValues?ne.selectValues.map(Ee=>Ee.name).join(";"):_optionalChain([ne, 'access', _125 => _125.selectValue, 'optionalAccess', _126 => _126.name])||ne.booleanValue}:Se},{}),...Ze,...Object.entries(_chunkOMVVROKBcjs.d.call(void 0, I,"attributeKey.name")).reduce((Se,[ne,ue])=>Object.assign(Se,{[ne]:ue.map(({name:Ee})=>Ee).join(",")}),{}),...Object.entries(_chunkOMVVROKBcjs.d.call(void 0, L,"name")).reduce((Se,[ne,ue])=>Object.assign(Se,{[ne]:ue.map(({value:Ee})=>Ee).join(",")}),{})}));return{requestsWithRequestIdentifiers:S,requestsFormattedForCsv:R}}async function Tk({dataSiloId:t,auth:e,concurrency:r=50,maxUploadPerChunk:n=5e4,status:i="SKIPPED",transcendUrl:s=_chunkOMVVROKBcjs.r,requestStatuses:o=[_privacytypes.RequestStatus.Compiling,_privacytypes.RequestStatus.Secondary]}){let p=Z(s,e),c=new Date().getTime(),u=await np(p,{dataSiloId:t,requestStatuses:o});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Marking ${u} request data silos as completed`));let m=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),d=0;for(m.start(u,0);d<u;){let y=await Zi(p,{dataSiloId:t,requestStatuses:o,limit:n,onProgress:S=>{d+=S/2,m.update(d)}});await _bluebird.map.call(void 0, y,async S=>{try{await l(p,Qo,{requestDataSiloId:S.id,status:i})}catch(R){if(!R.message.includes("Client error: Request must be active:"))throw R}d+=.5,m.update(d)},{concurrency:r})}m.stop();let g=new Date().getTime()-c;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully skipped "${u}" requests in "${g/1e3}" seconds!`)),u}async function vk({requestActions:t,identifierNames:e,auth:r,concurrency:n=20,transcendUrl:i=_chunkOMVVROKBcjs.r}){let s=Z(i,r),o=new Date().getTime(),p=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),c=await le(s,{actions:t,statuses:[_privacytypes.RequestStatus.Enriching]});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Fetched requests in preflight/enriching state."));let u=0,m=0;p.start(c.length,0),await _bluebird.map.call(void 0, c,async g=>{let S=(await Wa(s,{requestId:g.id})).filter(({isVerifiedAtLeastOnce:R,name:I})=>R===!1&&e.includes(I)).map(({id:R})=>R);S.length>0&&(await l(s,Wo,{input:{requestId:g.id,requestIdentifierIds:S}}),m+=S.length),u+=1,p.update(u)},{concurrency:n}),p.stop();let f=new Date().getTime()-o;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully cleared out unverified identifiers "${f/1e3}" seconds for ${u} requests, ${m} identifiers were cleared out!`)),c.length}async function g_({message:t}){let{response:e}=await _inquirer2.default.prompt([{name:"response",message:t,type:"confirm"}]);return e}async function y_({message:t}){let{response:e}=await _inquirer2.default.prompt([{name:"response",message:t,type:"text",validate:r=>r.trim().length>0}]);return e}async function h_({defaultValue:t,values:e,message:r}){_inquirer2.default.registerPrompt("autocomplete",_inquirerautocompleteprompt2.default);let{response:n}=await _inquirer2.default.prompt([{name:"response",message:r,type:"autocomplete",default:t,source:(i,s)=>s?e.filter(o=>typeof o=="string"&&It(s,o)):e}]);return n}function S_(t){let e=t.split(",").filter(n=>!!n),r={};return e.forEach(n=>{let[i,s]=n.split(":");if(!i||!s)throw new Error(`Invalid variable: ${n}. Expected format: key:value`);r[i]=s}),r}function Zl(t){let e=t;return _nullishCoalesce(_optionalChain([e, 'optionalAccess', _127 => _127.response, 'optionalAccess', _128 => _128.statusCode]), () => (_optionalChain([e, 'optionalAccess', _129 => _129.response, 'optionalAccess', _130 => _130.status])))}function zl(t){let e=t,r=_optionalChain([e, 'optionalAccess', _131 => _131.response, 'optionalAccess', _132 => _132.body])||_optionalChain([e, 'optionalAccess', _133 => _133.message])||"Unknown error";try{let n=JSON.parse(r),i=n.errors||_optionalChain([n, 'access', _134 => _134.error, 'optionalAccess', _135 => _135.errors])||[_optionalChain([n, 'access', _136 => _136.error, 'optionalAccess', _137 => _137.message])||n.error];r=(Array.isArray(i)?i:[i]).filter(Boolean).join(", ")}catch (e2){}return r}function Nr(t){return new Promise(e=>{setTimeout(()=>e(t),t)})}function E_(t){let e=Math.floor(t.length/2);return[t.slice(0,e),t.slice(e)]}async function x_(t,e,r){let n=0;for(;;)try{return await t()}catch(i){n+=1;let s=Zl(i),o=zl(i);if(!(n<=e.maxAttempts&&e.shouldRetry(s,o)))throw i;r(`Retrying after status=${s} attempt=${n}/${e.maxAttempts} \u2014 ${o}`),await Nr(e.delayMs)}}function q_(t,e){return Object.entries(t).reduce((r,[n,i],s)=>(r[n]=s<e?i:!0,r),{})}var Wl= (_class =class{constructor() { _class.prototype.__init.call(this); }__init() {this.buckets=[]}add(e){let r=Date.now();this.buckets.push({t:r,n:e});let n=r-12e4;for(;this.buckets.length&&this.buckets[0].t<n;)this.buckets.shift()}rate(e){let n=Date.now()-e,i=0;for(let s=this.buckets.length-1;s>=0;s-=1){let o=this.buckets[s];if(o.t<n)break;i+=o.n}return i/(e/1e3)}}, _class);function __(t){try{return t?_fs.readFileSync.call(void 0, t,"utf8"):""}catch (e3){return""}}function U_(t,e){t||(_chunkZUNVPK23cjs.a.error(_colors2.default.red("A --directory must be provided.")),e.process.exit(1));let r=[];try{r=_fs.readdirSync.call(void 0, t).filter(i=>i.endsWith(".parquet")).map(i=>_path.join.call(void 0, t,i)).filter(i=>{try{return _fs.statSync.call(void 0, i).isFile()}catch (e4){return!1}})}catch(n){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to read directory: ${t}`)),_chunkZUNVPK23cjs.a.error(_colors2.default.red(n.message)),e.process.exit(1)}return r.length===0&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`No Parquet files found in directory: ${t}`)),e.process.exit(1)),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Found: ${r.join(", ")} parquet files`)),r}var _nodeapi = require('@duckdb/node-api');async function Z_(t){let{filePath:e,outputDir:r,clearOutputDir:n,onProgress:i}=t,s=r||_path.dirname.call(void 0, e),{name:o}=_path.parse.call(void 0, e),p=_path.join.call(void 0, s,`${o}.csv`);if(_fs.mkdirSync.call(void 0, s,{recursive:!0}),n&&_fs.existsSync.call(void 0, p))try{_fs.rmSync.call(void 0, p,{force:!0})}catch(m){_chunkZUNVPK23cjs.a.warn(_colors2.default.yellow(`Could not remove existing output file ${p}: ${m.message}`))}let c=await _nodeapi.DuckDBInstance.create(":memory:"),u=await c.connect();try{await bf(u,"PRAGMA temp_directory='';");let m=f=>`'${f.replace(/'/g,"''")}'`,d=`
|
|
2989
|
+
${J.message}`)),s=!0}y+=1,d.update(y)})},{concurrency:10}),d.stop();let R=new Date().getTime()-o;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${t.length}" data silos and "${g}" datapoints in "${R/1e3}" seconds!`)),{success:!s,dataSiloTitleToId:_typeutils.apply.call(void 0, c,({id:I})=>I)}}async function dp(t,e){let r=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" data silo dependencies...`));let n=_chunkXXFLFF7Qcjs.b.call(void 0, e,Hi);return await _bluebird.mapSeries.call(void 0, n,async(i,s)=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`[Batch ${s}/${i.length}] Updating "${i.length}" data silos...`));try{await l(t,Vr,{input:{dataSilos:i.map(([o,p])=>({id:o,dependedOnDataSiloTitles:p}))}}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`[Batch ${s+1}/${i.length}] Synced "${i.length}" data silos!`))}catch(o){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`[Batch ${s+1}/${i.length}] Failed to update "${i.length}" silos! - ${o.message}`))}}),!r}var Ji=20;async function Xi(t,e){let r=[],n=0,i=!1;do{let{enrichers:{nodes:s}}=await l(t,_n,{first:Ji,offset:n,title:e});r.push(...s),n+=Ji,i=s.length===Ji}while(i);return r.sort((s,o)=>s.title.localeCompare(o.title))}async function gp(t,{enricher:e,identifierByName:r,dataSubjectsByName:n}){let s=(await Xi(t,e.title)).find(({title:u})=>u===e.title),o=_optionalChain([e, 'access', _18 => _18["data-subjects"], 'optionalAccess', _19 => _19.map, 'call', _20 => _20(u=>{let m=n[u];if(!m)throw new Error(`Failed to find a data subject with name: ${u}`);return m.id})]),p=e["input-identifier"],c=e["privacy-actions"]||Object.values(_privacytypes.RequestAction);s?await l(t,Nn,{input:{id:s.id,title:e.title,url:e.url,headers:e.headers,testRegex:e.testRegex,lookerQueryTitle:e.lookerQueryTitle,expirationDuration:typeof e.expirationDuration=="number"?e.expirationDuration.toString():void 0,transitionRequestStatus:e.transitionRequestStatus,phoneNumbers:e.phoneNumbers,regionList:e.regionList,dataSubjectIds:o,description:e.description||"",inputIdentifier:p?r[p].id:void 0,identifiers:e["output-identifiers"].map(u=>r[u].id),...s.type===_privacytypes.EnricherType.Sombra?{}:{actions:c}}}):p&&await l(t,Gn,{input:{title:e.title,url:e.url,type:e.type||_privacytypes.EnricherType.Server,headers:e.headers,testRegex:e.testRegex,lookerQueryTitle:e.lookerQueryTitle,expirationDuration:typeof e.expirationDuration=="number"?e.expirationDuration.toString():void 0,transitionRequestStatus:e.transitionRequestStatus,phoneNumbers:e.phoneNumbers,dataSubjectIds:o,regionList:e.regionList,description:e.description||"",inputIdentifier:r[p].id,identifiers:e["output-identifiers"].map(u=>r[u].id),actions:c}})}var en=20;async function gt(t,e){let r=[],n=0,i=!1;do{let{templates:{nodes:s}}=await l(t,no,{first:en,offset:n,title:e});r.push(...s),n+=en,i=s.length===en}while(i);return r.sort((s,o)=>s.title.localeCompare(o.title))}async function yp(t,e){(await gt(e,t.title)).find(({title:i})=>i===t.title)||await l(e,oo,{title:t.title})}function tn(t){return t.map(({country:e,countrySubDivision:r})=>({country:e,...r?{countrySubDivision:r}:{}}))}async function xt(t,e={}){let{globalActionItemCollections:{nodes:r}}=await l(t,ns,{filterBy:{...e}});return r}var rn=50;async function zt(t){let e=[],r=0,n=!1;do{let{consentPartitions:{nodes:i}}=await l(t,ys,{first:rn,offset:r});e.push(...i),r+=rn,n=i.length===rn}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}async function Cp(t,e){let r=await De(t),n=!1,i=await zt(t),s=_chunkXXFLFF7Qcjs.c.call(void 0, e.map(({name:o})=>o),i.map(({name:o})=>o));return await _bluebird.mapSeries.call(void 0, s,async o=>{try{await l(t,Ms,{input:{id:r,name:o}}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created consent partition: ${o}!`))}catch(p){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to create consent partition: ${o}! - ${p.message}`)),n=!0}}),!n}var nn=30;async function Sp(t){let e=[],r=0,n=!1;do{let{siloDiscoveryResults:{nodes:i}}=await l(t,Ea,{first:nn,offset:r,input:{},filterBy:{}}),s=i.map(o=>o.title===null&&_optionalChain([o, 'access', _21 => _21.suggestedCatalog, 'optionalAccess', _22 => _22.title])?{...o,title:o.suggestedCatalog.title}:o);e.push(...s),r+=nn,n=i.length===nn}while(n);return e}var Gu=["dataSilos","enrichers","templates","apiKeys"];async function qP(t,{dataSiloIds:e,integrationNames:r,debug:n,resources:i=Gu,pageSize:s,skipDatapoints:o,includeGuessedCategories:p,skipSubDatapoints:c,trackerStatuses:u=Object.values(_privacytypes.ConsentTrackerStatus)}){if(e.length>0&&r.length>0)throw new Error("Only 1 of integrationNames OR dataSiloIds can be provided");_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Fetching data with page size ${s}...`));let[m,d,f,g,y,S,R,I,L,C,O,H,K,se,J,me,ce,X,Ae,Ie,pe,de,we,ke,Ze,Se,ne,ue,Ee,A,G,fe,ge,In]=await Promise.all([i.includes("dataSilos")||i.includes("dataSubjects")?Yt(t):[],i.includes("apiKeys")?$r({},t,!0):[],i.includes("dataSilos")?up(t,{ids:e,integrationNames:r,pageSize:s,debug:n,includeGuessedCategories:p,skipDatapoints:o,skipSubDatapoints:c}):[],i.includes("enrichers")?Xi(t):[],i.includes("dataFlows")?[...u.includes(_privacytypes.ConsentTrackerStatus.Live)?await Rt(t,_privacytypes.ConsentTrackerStatus.Live):[],...u.includes(_privacytypes.ConsentTrackerStatus.NeedsReview)?await Rt(t,_privacytypes.ConsentTrackerStatus.NeedsReview):[]]:[],i.includes("cookies")?[...u.includes(_privacytypes.ConsentTrackerStatus.Live)?await Ei(t,_privacytypes.ConsentTrackerStatus.Live):[],...u.includes(_privacytypes.ConsentTrackerStatus.NeedsReview)?await Ei(t,_privacytypes.ConsentTrackerStatus.NeedsReview):[]]:[],i.includes("customFields")?Et(t):[],i.includes("templates")?gt(t):[],i.includes("identifiers")?Bi(t):[],i.includes("actions")?ur(t):[],i.includes("businessEntities")?gr(t):[],i.includes("processingActivities")?Sr(t):[],i.includes("consentManager")?Qa(t):void 0,i.includes("consentManager")?yr(t):[],i.includes("prompts")?$t(t):[],i.includes("promptPartials")?Dr(t):[],i.includes("promptGroups")?xr(t):[],i.includes("agents")?fr(t):[],i.includes("agentFunctions")?dr(t):[],i.includes("agentFiles")?mr(t):[],i.includes("vendors")?wr(t):[],i.includes("dataCategories")?hr(t):[],i.includes("processingPurposes")?Ar(t):[],i.includes("actionItems")?cr(t,{type:[_privacytypes.ActionItemCode.Onboarding]}):[],i.includes("actionItemCollections")?xt(t):[],i.includes("teams")?br(t):[],i.includes("policies")?Cr(t):[],i.includes("privacyCenters")?Za(t):[],i.includes("messages")?ja(t):[],i.includes("partitions")?zt(t):[],i.includes("assessments")?Na(t):[],i.includes("assessmentTemplates")?Ma(t):[],i.includes("purposes")?za(t):[],i.includes("systemDiscovery")?Sp(t):[]]),Ft=i.includes("consentManager")&&K?await Va(t,K.id):void 0,M={},tc=_chunkXXFLFF7Qcjs.a.call(void 0, f.map(([{apiKeys:h}])=>h.map(({title:T})=>T))),Tn=Object.values(d).filter(({title:h})=>i.includes("apiKeys")?!0:tc.includes(h));if(Tn.length>0&&i.includes("apiKeys")&&(M["api-keys"]=Tn.map(({title:h})=>({title:h}))),A.length>0&&i.includes("partitions")&&(M.partitions=A.map(({name:h,partition:T})=>({name:h,partition:T}))),K&&i.includes("consentManager")&&(M["consent-manager"]={bundleUrls:{TEST:K.testBundleURL,PRODUCTION:K.bundleURL},domains:K.configuration.domains||void 0,partition:K.configuration.partition||void 0,consentPrecedence:K.configuration.consentPrecedence||void 0,unknownRequestPolicy:K.configuration.unknownRequestPolicy||void 0,unknownCookiePolicy:K.configuration.unknownCookiePolicy||void 0,syncEndpoint:K.configuration.syncEndpoint||void 0,telemetryPartitioning:K.configuration.telemetryPartitioning||void 0,signedIabAgreement:K.configuration.signedIabAgreement||void 0,syncGroups:K.configuration.syncGroups||void 0,theme:Ft?{primaryColor:Ft.primaryColor||void 0,fontColor:Ft.fontColor||void 0,privacyPolicy:Ft.privacyPolicy||void 0,prompt:Ft.prompt}:void 0,experiences:se.map(h=>({name:h.name,displayName:h.displayName||void 0,regions:h.regions.map(T=>({countrySubDivision:T.countrySubDivision||void 0,country:T.country||void 0})),onConsentExpiry:h.onConsentExpiry,consentExpiry:h.consentExpiry,operator:h.operator,displayPriority:h.displayPriority,viewState:h.viewState,purposes:h.purposes.map(T=>({trackingType:T.trackingType})),optedOutPurposes:h.optedOutPurposes.map(T=>({trackingType:T.trackingType})),browserLanguages:h.browserLanguages,browserTimeZones:h.browserTimeZones}))}),G.length>0&&i.includes("assessments")&&(M.assessments=G.map(({title:h,assessmentGroup:T,sections:b,creator:w,description:$,status:D,assignees:v,externalAssignees:_,reviewers:B,isLocked:Q,isArchived:ee,isExternallyCreated:j,dueDate:F,createdAt:ye,assignedAt:_e,submittedAt:Ne,approvedAt:Me,rejectedAt:Fe,titleIsInternal:oe,retentionSchedule:Re,attributeValues:ze,resources:Ut,syncedRows:at})=>({title:h,group:T.title,sections:b.map(({title:Te,status:Ue,questions:$e,assignees:k,isReviewed:N,externalAssignees:he})=>({title:Te,status:Ue,questions:$e.map(({title:pt,type:Ur,subType:xe,placeholder:qe,description:lt,isRequired:rc,referenceId:ic,displayLogic:Pn,riskLogic:nc,riskCategories:oc,riskFramework:sc,answerOptions:ac,selectedAnswers:pc,allowedMimeTypes:lc,allowSelectOther:cc,syncModel:uc,syncColumn:mc,attributeKey:dc,requireRiskEvaluation:fc,requireRiskMatrixEvaluation:gc})=>{let Oe=Pn?zi(Pn):void 0;return{title:pt,type:Ur,"sub-type":xe,placeholder:qe,description:lt,"is-required":rc,"reference-id":ic,"display-logic":Oe&&Object.keys(Oe).length>0?{action:Oe.action,rule:Oe.rule?{"depends-on-question-reference-id":Oe.rule.dependsOnQuestionReferenceId,"comparison-operator":Oe.rule.comparisonOperator,"comparison-operands":"comparisonOperands"in Oe.rule?Oe.rule.comparisonOperands:void 0}:void 0,"nested-rule":Oe.nestedRule?{"logic-operator":Oe.nestedRule.logicOperator,rules:(Oe.nestedRule.rules||[]).map(ve=>({"depends-on-question-reference-id":ve.dependsOnQuestionReferenceId,"comparison-operator":ve.comparisonOperator,"comparison-operands":"comparisonOperands"in ve?ve.comparisonOperands:void 0}))}:void 0}:void 0,"risk-logic":nc.map(ve=>{let Br=Wi(ve);return{"risk-level":_optionalChain([Br, 'access', _23 => _23.riskAssignment, 'optionalAccess', _24 => _24.riskLevelId]),"comparison-operands":Br.comparisonOperands,"comparison-operator":Br.comparisonOperator}}),"risk-categories":oc.map(({title:ve})=>ve),"risk-framework":_optionalChain([sc, 'optionalAccess', _25 => _25.title]),"answer-options":ac.map(({value:ve})=>({value:ve})),"selected-answers":pc.map(({value:ve})=>ve),"allowed-mime-types":lc,"allow-select-other":cc,"sync-model":uc||void 0,"sync-column":mc||void 0,"attribute-key":_optionalChain([dc, 'optionalAccess', _26 => _26.name]),"require-risk-evaluation":fc,"require-risk-matrix-evaluation":gc}}),assignees:k.map(({email:pt})=>pt),"external-assignees":he.map(({email:pt})=>pt),"is-reviewed":N})),creator:_optionalChain([w, 'optionalAccess', _27 => _27.email]),description:$,status:D,assignees:v.map(({email:Te})=>Te),"external-assignees":_.map(({email:Te})=>Te),reviewers:B.map(({email:Te})=>Te),locked:Q,archived:ee,external:j,"title-is-internal":oe,"due-date":F||void 0,"created-at":ye||void 0,"assigned-at":_e||void 0,"submitted-at":Ne||void 0,"approved-at":Me||void 0,"rejected-at":Fe||void 0,"retention-schedule":Re?{type:Re.type,"duration-days":Re.durationDays,operand:Re.operation}:void 0,attributes:ze!==void 0&&ze.length>0?Le(ze):void 0,resources:Ut.map(({resourceType:Te,title:Ue,name:$e,category:k,type:N,purpose:he})=>({type:Te,title:k?`${k} - ${$e}`:he?`${he} - ${$e}`:Ue||$e||N||""})),rows:at.map(({resourceType:Te,title:Ue,name:$e,category:k,type:N,purpose:he})=>({type:Te,title:k?`${k} - ${$e}`:he?`${he} - ${$e}`:Ue||$e||N||""}))}))),fe.length>0&&i.includes("assessmentTemplates")&&(M["assessment-templates"]=fe.map(({title:h,description:T,sections:b,status:w,source:$,creator:D,isLocked:v,isArchived:_,createdAt:B,retentionSchedule:Q})=>({title:h,description:T,sections:b.map(({title:ee,questions:j})=>({title:ee,questions:j.map(({title:F,type:ye,subType:_e,placeholder:Ne,description:Me,isRequired:Fe,referenceId:oe,displayLogic:Re,riskLogic:ze,riskCategories:Ut,riskFramework:at,answerOptions:Te,allowedMimeTypes:Ue,allowSelectOther:$e,syncModel:k,syncColumn:N,attributeKey:he,requireRiskEvaluation:pt,requireRiskMatrixEvaluation:Ur})=>{let xe=Re?zi(Re):void 0;return{title:F,type:ye,"sub-type":_e,placeholder:Ne,description:Me,"is-required":Fe,"reference-id":oe,"display-logic":xe&&Object.keys(xe).length>0?{action:xe.action,rule:xe.rule?{"depends-on-question-reference-id":xe.rule.dependsOnQuestionReferenceId,"comparison-operator":xe.rule.comparisonOperator,"comparison-operands":"comparisonOperands"in xe.rule?xe.rule.comparisonOperands:void 0}:void 0,"nested-rule":xe.nestedRule?{"logic-operator":xe.nestedRule.logicOperator,rules:(xe.nestedRule.rules||[]).map(qe=>({"depends-on-question-reference-id":qe.dependsOnQuestionReferenceId,"comparison-operator":qe.comparisonOperator,"comparison-operands":"comparisonOperands"in qe?qe.comparisonOperands:void 0}))}:void 0}:void 0,"risk-logic":ze.map(qe=>{let lt=Wi(qe);return{"risk-level":_optionalChain([lt, 'access', _28 => _28.riskAssignment, 'optionalAccess', _29 => _29.riskLevelId]),"risk-matrix-row":_optionalChain([lt, 'access', _30 => _30.riskAssignment, 'optionalAccess', _31 => _31.riskMatrixRowId]),"risk-matrix-column":_optionalChain([lt, 'access', _32 => _32.riskAssignment, 'optionalAccess', _33 => _33.riskMatrixColumnId]),"comparison-operands":lt.comparisonOperands,"comparison-operator":lt.comparisonOperator}}),"risk-categories":Ut.map(({title:qe})=>qe),"risk-framework":_optionalChain([at, 'optionalAccess', _34 => _34.title]),"answer-options":Te.map(({value:qe})=>({value:qe})),"allowed-mime-types":Ue,"allow-select-other":$e,"sync-model":k||void 0,"sync-column":N||void 0,"attribute-key":_optionalChain([he, 'optionalAccess', _35 => _35.name]),"require-risk-evaluation":pt,"require-risk-matrix-evaluation":Ur}})})),status:w,source:$,creator:_optionalChain([D, 'optionalAccess', _36 => _36.email]),locked:v,archived:_,"created-at":B||void 0,"retention-schedule":Q?{type:Q.type,"duration-days":Q.durationDays,operand:Q.operation}:void 0}))),In.length>0&&i.includes("systemDiscovery")&&(M["system-discovery"]=In.map(({title:h,resourceId:T,suggestedCatalog:{title:b},plugin:{dataSilo:{title:w}},country:$,countrySubDivision:D,plaintextContext:v,containsSensitiveData:_,status:B})=>({title:h,resourceId:T,suggestedCatalog:b,plugin:w,country:$||void 0,countrySubDivision:D||void 0,plaintextContext:v,containsSensitiveData:_,status:B}))),J.length>0&&i.includes("prompts")&&(M.prompts=J.map(({title:h,content:T})=>({title:h,content:T}))),me.length>0&&i.includes("promptPartials")&&(M["prompt-partials"]=me.map(({title:h,content:T})=>({title:h,content:T}))),ce.length>0&&i.includes("promptGroups")&&(M["prompt-groups"]=ce.map(({title:h,description:T,prompts:b})=>({title:h,description:T,prompts:b.map(({title:w})=>w)}))),Se.length>0&&i.includes("teams")&&(M.teams=Se.map(({name:h,description:T,ssoDepartment:b,ssoGroup:w,ssoTitle:$,users:D,scopes:v})=>({name:h,description:T,"sso-department":b||void 0,"sso-group":w||void 0,"sso-title":$||void 0,users:D.map(({email:_})=>_),scopes:v.map(({name:_})=>_)}))),m.length>0&&i.includes("dataSubjects")&&(M["data-subjects"]=m.map(({type:h,title:T,active:b,adminDashboardDefaultSilentMode:w,actions:$})=>({type:h,title:_optionalChain([T, 'optionalAccess', _37 => _37.defaultMessage]),active:b,adminDashboardDefaultSilentMode:w,actions:$.map(({type:D})=>D)}))),ne.length>0&&(M.policies=ne.map(({title:h,versions:T,disabledLocales:b})=>({title:_optionalChain([h, 'optionalAccess', _38 => _38.defaultMessage]),content:_optionalChain([T, 'optionalAccess', _39 => _39[0], 'optionalAccess', _40 => _40.content, 'optionalAccess', _41 => _41.defaultMessage]),disabledLocales:b}))),Ee.length>0&&(M.messages=Ee.map(({id:h,defaultMessage:T,targetReactIntlId:b,description:w,translations:$})=>({id:h,defaultMessage:T,description:w,targetReactIntlId:b||void 0,translations:$.reduce((D,{locale:v,value:_})=>Object.assign(D,{[v]:_}),{})}))),ue.length>0){let h=ue[0];M["privacy-center"]={isDisabled:h.isDisabled,showPrivacyRequestButton:h.showPrivacyRequestButton,showPolicies:h.showPolicies,showTrackingTechnologies:h.showTrackingTechnologies,showCookies:h.showCookies,showDataFlows:h.showDataFlows,showConsentManager:h.showConsentManager,showManageYourPrivacy:h.showManageYourPrivacy,showMarketingPreferences:h.showMarketingPreferences,locales:h.locales,defaultLocale:h.defaultLocale,preferBrowserDefaultLocale:h.preferBrowserDefaultLocale,supportEmail:h.supportEmail||void 0,replyToEmail:h.replyToEmail||void 0,useNoReplyEmailAddress:h.useNoReplyEmailAddress,useCustomEmailDomain:h.useCustomEmailDomain,transformAccessReportJsonToCsv:h.transformAccessReportJsonToCsv,theme:h.theme}}if(O.length>0&&i.includes("businessEntities")&&(M["business-entities"]=O.map(({title:h,description:T,address:b,headquarterCountry:w,headquarterSubDivision:$,dataProtectionOfficerName:D,dataProtectionOfficerEmail:v,attributeValues:_})=>({title:h,description:T||void 0,address:b||void 0,headquarterCountry:w||void 0,headquarterSubDivision:$||void 0,dataProtectionOfficerName:D||void 0,dataProtectionOfficerEmail:v||void 0,attributes:_!==void 0&&_.length>0?Le(_):void 0}))),H.length>0&&i.includes("processingActivities")&&(M["processing-activities"]=H.map(({title:h,description:T,securityMeasureDetails:b,controllerships:w,storageRegions:$,transferRegions:D,retentionType:v,retentionPeriod:_,dataProtectionImpactAssessmentLink:B,dataProtectionImpactAssessmentStatus:Q,attributeValues:ee,dataSilos:j,dataSubjects:F,teams:ye,owners:_e,processingPurposeSubCategories:Ne,dataSubCategories:Me,saaSCategories:Fe})=>({title:h,description:T,securityMeasureDetails:_nullishCoalesce(b, () => (void 0)),controllerships:w.length>0?w:void 0,storageRegions:$.length>0?tn($):void 0,transferRegions:D.length>0?tn(D):void 0,retentionType:v,retentionPeriod:v===_privacytypes.RetentionType.StatedPeriod?_:void 0,dataProtectionImpactAssessmentLink:_nullishCoalesce(B, () => (void 0)),dataProtectionImpactAssessmentStatus:Q,attributes:ee!==void 0&&ee.length>0?Le(ee):void 0,dataSiloTitles:j.length>0?j.map(({title:oe})=>oe):void 0,dataSubjectTypes:F.length>0?F.map(({type:oe})=>oe):void 0,teamNames:ye.length>0?ye.map(({name:oe})=>oe):void 0,ownerEmails:_e.length>0?_e.map(({email:oe})=>oe):void 0,processingSubPurposes:Ne.length>0?Ne.map(({name:oe,purpose:Re})=>({purpose:Re,...oe?{name:oe}:{}})):void 0,dataSubCategories:Me.length>0?Me.map(({name:oe,category:Re})=>({category:Re,...oe?{name:oe}:{}})):void 0,saaSCategories:Fe.length>0?Fe.map(({title:oe})=>oe):void 0}))),C.length>0&&i.includes("actions")&&(M.actions=C.map(({type:h,skipSecondaryIfNoFiles:T,skipDownloadableStep:b,requiresReview:w,regionList:$,regionDetectionMethod:D,waitingPeriod:v})=>({type:h,...h===_privacytypes.RequestAction.Erasure?{skipSecondaryIfNoFiles:T,skipDownloadableStep:b}:{},requiresReview:w,waitingPeriod:v,regionDetectionMethod:D,regionList:$.length>0?$:void 0}))),L.length>0&&i.includes("identifiers")&&(M.identifiers=L.map(({name:h,type:T,regex:b,selectOptions:w,privacyCenterVisibility:$,isRequiredInForm:D,placeholder:v,displayTitle:_,dataSubjects:B,displayDescription:Q,displayOrder:ee,isUniqueOnPreferenceStore:j})=>({name:h,type:T,regex:b,selectOptions:w.length>0?w:void 0,privacyCenterVisibility:$.length>0?$:void 0,isRequiredInForm:D,placeholder:v||void 0,dataSubjects:B.length>0?B.map(({type:F})=>F):void 0,displayTitle:_optionalChain([_, 'optionalAccess', _42 => _42.defaultMessage]),displayDescription:_optionalChain([Q, 'optionalAccess', _43 => _43.defaultMessage]),displayOrder:ee,isUniqueOnPreferenceStore:j}))),X.length>0&&i.includes("agents")&&(M.agents=X.map(({name:h,agentId:T,description:b,instructions:w,codeInterpreterEnabled:$,retrievalEnabled:D,prompt:v,largeLanguageModel:_,teams:B,owners:Q,agentFunctions:ee,agentFiles:j})=>({name:h,agentId:T,description:b||void 0,instructions:w,codeInterpreterEnabled:$,retrievalEnabled:D,prompt:_optionalChain([v, 'optionalAccess', _44 => _44.title]),"large-language-model":{name:_.name,client:_.client},teams:B&&B.length>0?B.map(({name:F})=>F):void 0,owners:Q&&Q.length>0?Q.map(({email:F})=>F):void 0,"agent-functions":ee&&ee.length>0?ee.map(({name:F})=>F):void 0,"agent-files":j&&j.length>0?j.map(({name:F})=>F):void 0}))),ke.length>0&&i.includes("actionItems")&&(M["action-items"]=ke.map(({teams:h,users:T,customerExperienceActionItemIds:[b],dueDate:w,priority:$,resolved:D,collections:v,notes:_,link:B,title:Q,type:ee,attributeValues:j})=>({teams:h.map(({name:F})=>F),users:T.map(({email:F})=>F),dueDate:w||void 0,title:Q,notes:_,customerExperienceActionItemId:b,collections:v.map(({title:F})=>F),link:B,priority:$||void 0,resolved:D,type:ee,attributes:j!==void 0&&j.length>0?Le(j):void 0}))),Ze.length>0&&i.includes("actionItemCollections")&&(M["action-item-collections"]=Ze.map(({title:h,description:T,hidden:b,productLine:w})=>({title:h,description:T||void 0,hidden:b,productLine:w}))),Ae.length>0&&i.includes("agentFunctions")&&(M["agent-functions"]=Ae.map(({name:h,description:T,parameters:b})=>({name:h,description:T,parameters:JSON.stringify(b)}))),Ie.length>0&&i.includes("agentFiles")&&(M["agent-files"]=Ie.map(({name:h,description:T,fileId:b,size:w,purpose:$})=>({name:h,description:T,fileId:b,size:w,purpose:$}))),pe.length>0&&i.includes("vendors")&&(M.vendors=pe.map(({title:h,description:T,dataProcessingAgreementLink:b,contactName:w,contactPhone:$,address:D,headquarterCountry:v,headquarterSubDivision:_,websiteUrl:B,businessEntity:Q,teams:ee,owners:j,attributeValues:F})=>({title:h,description:T||void 0,dataProcessingAgreementLink:b||void 0,contactName:w||void 0,contactPhone:$||void 0,address:D||void 0,headquarterCountry:v||void 0,headquarterSubDivision:_||void 0,websiteUrl:B||void 0,businessEntity:_optionalChain([Q, 'optionalAccess', _45 => _45.title]),teams:ee&&ee.length>0?ee.map(({name:ye})=>ye):void 0,owners:j&&j.length>0?j.map(({email:ye})=>ye):void 0,attributes:F!==void 0&&F.length>0?Le(F):void 0}))),de.length>0&&i.includes("dataCategories")&&(M["data-categories"]=de.map(({name:h,category:T,description:b,regex:w,owners:$,teams:D,attributeValues:v})=>({name:h,category:T,description:b||void 0,regex:w||void 0,owners:$&&$.length>0?$.map(({email:_})=>_):void 0,teams:D&&D.length>0?D.map(({name:_})=>_):void 0,attributes:v!==void 0&&v.length>0?Le(v):void 0}))),we.length>0&&i.includes("processingPurposes")&&(M["processing-purposes"]=we.map(({name:h,purpose:T,description:b,owners:w,teams:$,attributeValues:D})=>({name:h,purpose:T,description:b||void 0,owners:w&&w.length>0?w.map(({email:v})=>v):void 0,teams:$&&$.length>0?$.map(({name:v})=>v):void 0,attributes:D!==void 0&&D.length>0?Le(D):void 0}))),y.length>0&&i.includes("dataFlows")&&(M["data-flows"]=y.map(({value:h,type:T,description:b,trackingType:w,service:$,status:D,owners:v,teams:_,attributeValues:B})=>({value:h,type:T,description:b||void 0,trackingPurposes:w,status:D,service:_optionalChain([$, 'optionalAccess', _46 => _46.integrationName]),owners:v.map(({email:Q})=>Q),teams:_.map(({name:Q})=>Q),attributes:B!==void 0&&B.length>0?Le(B):void 0}))),S.length>0&&i.includes("cookies")&&(M.cookies=S.map(({name:h,isRegex:T,description:b,trackingPurposes:w,service:$,status:D,owners:v,teams:_,attributeValues:B})=>({name:h,isRegex:T,description:b||void 0,trackingPurposes:w,status:D,service:_optionalChain([$, 'optionalAccess', _47 => _47.integrationName]),owners:v.map(({email:Q})=>Q),teams:_.map(({name:Q})=>Q),attributes:B!==void 0&&B.length>0?Le(B):void 0}))),R.length>0&&i.includes("customFields")&&(M.attributes=R.map(({description:h,name:T,type:b,values:w,enabledOn:$=[]})=>({description:h||void 0,resources:$,name:T,type:b,values:w.map(({name:D,color:v,description:_})=>({name:D,color:v||void 0,description:_}))}))),ge.length>0&&(M.purposes=ge.map(({name:h,description:T,trackingType:b,defaultConsent:w,configurable:$,showInConsentManager:D,isActive:v,displayOrder:_,optOutSignals:B,authLevel:Q,topics:ee,showInPrivacyCenter:j,title:F})=>({name:h,title:F,description:T||void 0,trackingType:b,"default-consent":w,configurable:$,"show-in-consent-manager":D,"show-in-privacy-center":j,"is-active":v,"display-order":_,"opt-out-signals":B.length>0?B:void 0,"auth-level":Q||void 0,"preference-topics":ee.map(({title:ye,type:_e,displayDescription:Ne,defaultConfiguration:Me,showInPrivacyCenter:Fe,preferenceOptionValues:oe})=>({title:ye.defaultMessage,type:_e,description:Ne.defaultMessage,"default-configuration":Me,"show-in-privacy-center":Fe,...oe.length>0?{options:oe.map(({title:Re,slug:ze})=>({title:Re.defaultMessage,slug:ze}))}:{}}))}))),e.length===0&&I.length>0&&i.includes("templates")&&(M.templates=I.map(({title:h})=>({title:h}))),g.length>0&&i.includes("enrichers")&&(M.enrichers=g.map(({title:h,url:T,type:b,inputIdentifier:w,identifiers:$,actions:D,testRegex:v,dataSubjects:_,expirationDuration:B,lookerQueryTitle:Q,transitionRequestStatus:ee,phoneNumbers:j,regionList:F})=>({title:h,url:T||void 0,type:b,"input-identifier":_optionalChain([w, 'optionalAccess', _48 => _48.name]),"output-identifiers":$.map(({name:ye})=>ye),"privacy-actions":Object.values(_privacytypes.RequestAction).length===D.length?void 0:D,testRegex:v||void 0,lookerQueryTitle:Q||void 0,expirationDuration:parseInt(B,10),transitionRequestStatus:ee||void 0,phoneNumbers:j&&j.length>0?j:void 0,regionList:F&&F.length>0?F:void 0,"data-subjects":_.map(({type:ye})=>ye)}))),f.length>0&&i.includes("dataSilos")){let h=_chunkXXFLFF7Qcjs.e.call(void 0, m,"type");M["data-silos"]=f.map(([{title:T,description:b,url:w,type:$,outerType:D,apiKeys:v,notifyEmailAddress:_,identifiers:B,dependentDataSilos:Q,owners:ee,country:j,countrySubDivision:F,teams:ye,subjectBlocklist:_e,isLive:Ne,promptAVendorEmailSendFrequency:Me,promptAVendorEmailSendType:Fe,promptAVendorEmailIncludeIdentifiersAttachment:oe,promptAVendorEmailCompletionLinkType:Re,manualWorkRetryFrequency:ze,catalog:Ut,attributeValues:at,discoveredBy:Te,businessEntities:Ue},$e])=>({title:T,description:b,integrationName:$,"outer-type":D||void 0,url:w||void 0,"api-key-title":_optionalChain([v, 'access', _49 => _49[0], 'optionalAccess', _50 => _50.title]),"identity-keys":B.filter(({isConnected:k})=>k).map(({name:k})=>k),...Q.length>0?{"deletion-dependencies":Q.map(({title:k})=>k)}:{},...ee.length>0?{owners:ee.map(({email:k})=>k)}:{},...ye.length>0?{teams:ye.map(({name:k})=>k)}:{},...Te.length>0?{discoveredBy:Te.map(({title:k})=>k)}:{},...Ue.length>0?{businessEntities:Ue.map(({title:k})=>k)}:{},country:j||void 0,countrySubDivision:F||void 0,disabled:!Ne,"data-subjects":_e.length>0?rp(_e.map(({type:k})=>k),h):void 0,...Ut.hasAvcFunctionality?{"email-settings":{"notify-email-address":_||void 0,"send-frequency":Me,"send-type":Fe,"include-identifiers-attachment":oe,"completion-link-type":Re,"manual-work-retry-frequency":ze}}:{},attributes:at!==void 0&&at.length>0?Le(at):void 0,datapoints:$e.map(k=>({key:k.name,title:_optionalChain([k, 'access', _51 => _51.title, 'optionalAccess', _52 => _52.defaultMessage]),description:_optionalChain([k, 'access', _53 => _53.description, 'optionalAccess', _54 => _54.defaultMessage]),owners:k.owners.map(({email:N})=>N),teams:k.teams.map(({name:N})=>N),...k.path.length>0?{path:k.path}:{},..._optionalChain([k, 'access', _55 => _55.dataCollection, 'optionalAccess', _56 => _56.title])?{"data-collection-tag":k.dataCollection.title.defaultMessage}:{},...k.dbIntegrationQueries.length>0?{"privacy-action-queries":_chunkXXFLFF7Qcjs.f.call(void 0, _chunkXXFLFF7Qcjs.e.call(void 0, k.dbIntegrationQueries,"requestType"),N=>N.suggestedQuery||N.query||void 0)}:{},...k.subDataPoints.length>0?{fields:k.subDataPoints.map(N=>({key:N.name,description:N.description,purposes:N.purposes,categories:N.categories,...p&&N.pendingCategoryGuesses?{"guessed-categories":N.pendingCategoryGuesses.filter(he=>he.status==="PENDING").map(he=>({category:{name:he.category.name,category:he.category.category},status:he.status,confidence:he.confidence,classifierVersion:he.classifierVersion||void 0}))}:{},"access-request-visibility-enabled":N.accessRequestVisibilityEnabled,"erasure-request-redaction-enabled":N.erasureRequestRedactionEnabled,attributes:N.attributeValues!==void 0&&N.attributeValues.length>0?Le(N.attributeValues):void 0})).sort((N,he)=>N.key.localeCompare(he.key))}:{},"privacy-actions":k.actionSettings.filter(({active:N})=>N).map(({type:N})=>N)})).sort((k,N)=>[..._nullishCoalesce(k.path, () => ([])),k.key].join(".").localeCompare([..._nullishCoalesce(N.path, () => ([])),N.key].join(".")))}))}return M}async function _P(t,e){let{reportPromptRun:{promptRun:r}}=await l(t,rs,{input:{...e,promptRunMessages:e.promptRunMessages.map(({content:n,...i})=>({...i,message:n}))}});return r.id}async function Ip(t,e){await l(t,bo,{requestEnricherId:e})}async function BP(t,e){await l(t,fs,{input:e})}var Fu=[...Object.values(_privacytypes.IsoCountryCode),...Object.values(_privacytypes.IsoCountrySubdivisionCode)];async function Tp(t,{action:e,actionId:r,skipPublish:n=!1}){await l(t,js,{input:{id:r,skipSecondaryIfNoFiles:e.skipSecondaryIfNoFiles,skipDownloadableStep:e.skipDownloadableStep,requiresReview:e.requiresReview,waitingPeriod:e.waitingPeriod,skipPublish:n,regionList:e.regionBlockList?_chunkXXFLFF7Qcjs.c.call(void 0, Fu,e.regionBlockList):e.regionList,regionDetectionMethod:e.regionDetectionMethod}})}async function Uu(t,e){let r={title:e.title,description:e.description||"",hidden:e.hidden||!1,productLine:e.productLine},{createActionItemCollection:n}=await l(t,os,{input:r});return n.created}async function Bu(t,e,r){await l(t,ss,{input:{id:r,title:e.title,description:e.description,hidden:e.hidden,productLine:e.productLine}})}async function Ep(t,e){let r=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" action item collections...`));let n=await xt(t),i=_chunkXXFLFF7Qcjs.e.call(void 0, n,"title"),s=e.filter(p=>!i[p.title]);await _bluebird.mapSeries.call(void 0, s,async p=>{try{await Uu(t,p),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created action item collection "${p.title}"!`))}catch(c){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create action item collection "${p.title}"! - ${c.message}`))}});let o=e.map(p=>[p,_optionalChain([i, 'access', _57 => _57[p.title], 'optionalAccess', _58 => _58.id])]).filter(p=>!!p[1]);return await _bluebird.mapSeries.call(void 0, o,async([p,c])=>{try{await Bu(t,p,c),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced action item collection "${p.title}"!`))}catch(u){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync action item collection "${p.title}"! - ${u.message}`))}}),!r}async function Qu(t,e,r,n={}){let i=_chunkXXFLFF7Qcjs.b.call(void 0, e,100);await _bluebird.mapSeries.call(void 0, i,async s=>{await l(t,zs,{input:s.map(o=>({title:o.title,type:o.type,priorityOverride:o.priority,dueDate:o.dueDate,customerExperienceActionItemId:o.customerExperienceActionItemId,resolved:o.resolved,notes:o.notes,link:o.link,assigneesUserEmails:o.users,assigneesTeamNames:o.teams,...o.attributes?{}:{},collectionIds:o.collections.map(p=>r[p].id)}))})})}async function Vu(t,e,r,n={}){let i=s=>{let o=n[s];if(!o)throw new Error(`Attribute key "${s}" does not exist!`);return o.id};await l(t,Zs,{input:{ids:[r],title:e.title,priorityOverride:e.priority,dueDate:e.dueDate,resolved:e.resolved,customerExperienceActionItemId:e.customerExperienceActionItemId,notes:e.notes,link:e.link,assigneesUserEmails:e.users,assigneesTeamNames:e.teams,...e.attributes?{attributes:e.attributes.map(({key:s,values:o})=>({attributeKeyId:i(s),attributeValueNames:o}))}:{}}})}function Ku({title:t,collections:e}){return`${t}-${e.map(r=>r.title).sort().join("-")}`}function Rp({title:t,collections:e}){return`${t}-${e.sort().join("-")}`}async function wp(t,e){let r=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" actionItems...`));let n=e.some(y=>y.attributes&&y.attributes.length>0),[i,s,o]=await Promise.all([cr(t),xt(t),n?Et(t):[]]),p=_chunkXXFLFF7Qcjs.e.call(void 0, s,"title"),c=_chunkXXFLFF7Qcjs.e.call(void 0, i,Ku),u=_chunkXXFLFF7Qcjs.e.call(void 0, o,"name"),m=_chunkXXFLFF7Qcjs.e.call(void 0, i.filter(y=>!!y.customerExperienceActionItemIds),({customerExperienceActionItemIds:y})=>y[0]),d=_chunkXXFLFF7Qcjs.j.call(void 0, e.map(y=>y.collections).flat()).filter(y=>!p[y]);if(d.length>0)return _chunkZUNVPK23cjs.a.info(_colors2.default.red(`Missing action item collections: "${d.join('", "')}" - please create them first!`)),!1;let f=e.filter(y=>!c[Rp(y)]&&!m[y.customerExperienceActionItemId]);if(f.length>0)try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating "${f.length}" actionItems...`)),await Qu(t,f,p,u),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created "${f.length}" actionItems!`))}catch(y){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create action items! - ${y.message}`))}let g=e.map(y=>[y,_optionalChain([c, 'access', _59 => _59[Rp(y)], 'optionalAccess', _60 => _60.id])||_optionalChain([m, 'access', _61 => _61[y.customerExperienceActionItemId], 'optionalAccess', _62 => _62.id])]).filter(y=>!!y[1]);return await _bluebird.mapSeries.call(void 0, g,async([y,S])=>{try{await Vu(t,y,S,u),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced action item "${y.title}"!`))}catch(R){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync action item "${y.title}"! - ${R.message}`))}}),!r}async function Yu(t,e){let r={name:e.name,description:e.description,fileId:e.fileId,size:e.size,purpose:e.purpose,fileUploadedAt:new Date,agentIds:[]},{createAgentFile:n}=await l(t,sa,{input:r});return n.agentFile}async function Zu(t,e){await l(t,aa,{input:{agentFiles:e.map(([r,n])=>({id:n,name:r.name,description:r.description,fileId:r.fileId,size:r.size,purpose:r.purpose}))}})}async function $p(t,e){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" agent files...`));let r=!1,n=await mr(t),i=_chunkXXFLFF7Qcjs.e.call(void 0, n,"name"),s=e.filter(o=>!i[o.name]);await _bluebird.mapSeries.call(void 0, s,async o=>{try{let p=await Yu(t,o);i[p.name]=p,_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced agent file "${o.name}"!`))}catch(p){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync agent file "${o.name}"! - ${p.message}`))}});try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${e.length}" agent files!`)),await Zu(t,e.map(o=>[o,i[o.name].id])),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced "${e.length}" agent files!`))}catch(o){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync "${e.length}" agent files! - ${o.message}`))}return!r}async function Wu(t,e){let r={name:e.name,description:e.description,parameters:e.parameters,agentIds:[]},{createAgentFunction:n}=await l(t,la,{input:r});return n.agentFunction}async function Hu(t,e){await l(t,ca,{input:{agentFunctions:e.map(([r,n])=>({id:n,name:r.name,description:r.description,parameters:r.parameters}))}})}async function xp(t,e){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" agent functions...`));let r=!1,n=await dr(t),i=_chunkXXFLFF7Qcjs.e.call(void 0, n,"name"),s=e.filter(o=>!i[o.name]);await _bluebird.mapSeries.call(void 0, s,async o=>{try{let p=await Wu(t,o);i[p.name]=p,_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced agent function "${o.name}"!`))}catch(p){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync agent function "${o.name}"! - ${p.message}`))}});try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${e.length}" agent functions!`)),await Hu(t,e.map(o=>[o,i[o.name].id])),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced "${e.length}" agent functions!`))}catch(o){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync "${e.length}" agent functions! - ${o.message}`))}return!r}async function Xu(t,e){let r={name:e.name,description:e.description,codeInterpreterEnabled:e.codeInterpreterEnabled,retrievalEnabled:e.retrievalEnabled,promptTitle:e.prompt,largeLanguageModelName:e["large-language-model"].name,largeLanguageModelClient:e["large-language-model"].client},{createAgent:n}=await l(t,ia,{input:r});return n.agent}async function em(t,e){await l(t,na,{input:{agents:e.map(([r,n])=>({id:n,name:r.name,description:r.description,codeInterpreterEnabled:r.codeInterpreterEnabled,retrievalEnabled:r.retrievalEnabled}))}})}async function Dp(t,e){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" agents...`));let r=!1,n=await fr(t),i=_chunkXXFLFF7Qcjs.e.call(void 0, n,"name"),s=e.filter(o=>!i[o.name]);await _bluebird.mapSeries.call(void 0, s,async o=>{try{let p=await Xu(t,o);i[p.name]=p,_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced agent "${o.name}"!`))}catch(p){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync agent "${o.name}"! - ${p.message}`))}});try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${e.length}" agents!`)),await em(t,e.map(o=>[o,i[o.name].id])),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced "${e.length}" agents!`))}catch(o){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync "${e.length}" agents ! - ${o.message}`))}return!r}async function qp(t,e,{existingAttribute:r,deleteExtraAttributeValues:n}){let i={name:e.name,enabledOn:e.resources},s;if(r)await l(t,ds,{attributeKeyId:r.id,description:r.isCustom?e.description:void 0,...i}),s=r.id;else{let{createAttributeKey:{attributeKey:m}}=await l(t,ms,{type:e.type,description:e.description,...i});s=m.id}let o=_chunkXXFLFF7Qcjs.e.call(void 0, _optionalChain([r, 'optionalAccess', _63 => _63.values])||[],"name"),{existingValues:p=[],newValues:c=[]}=_chunkXXFLFF7Qcjs.d.call(void 0, e.values||[],m=>o[m.name]?"existingValues":"newValues"),u=_chunkXXFLFF7Qcjs.c.call(void 0, (_optionalChain([r, 'optionalAccess', _64 => _64.values])||[]).map(({name:m})=>m),(e.values||[]).map(({name:m})=>m));c.length>0&&(await l(t,ps,{input:c.map(({name:m,...d})=>({name:m,attributeKeyId:s,...d}))}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Created ${c.length} attribute values`))),p.length>0&&(await l(t,ls,{input:p.map(({name:m,...d})=>({id:o[m].id,name:m,description:o[m].description,color:o[m].color,...d,attributeKeyId:s}))}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Updated ${p.length} attribute values`))),u.length>0&&n&&(await _bluebird.map.call(void 0, u,async m=>{await l(t,cs,{id:o[m].id})},{concurrency:10}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Deleted ${u.length} attribute values`)))}async function rm(t,e){let r={title:e.title,description:e.description,address:e.address,headquarterCountry:e.headquarterCountry,headquarterSubDivision:e.headquarterSubDivision,dataProtectionOfficerName:e.dataProtectionOfficerName,dataProtectionOfficerEmail:e.dataProtectionOfficerEmail,attributes:e.attributes,teamNames:e.teams,ownerEmails:e.owners},{createBusinessEntity:n}=await l(t,Bs,{input:r});return n.businessEntity}async function im(t,e){let r=_chunkXXFLFF7Qcjs.b.call(void 0, e,100);await _bluebird.mapSeries.call(void 0, r,async n=>{await l(t,Qs,{input:n.map(([i,s])=>({id:s,title:i.title,description:i.description,address:i.address,headquarterCountry:i.headquarterCountry,headquarterSubDivision:i.headquarterSubDivision,dataProtectionOfficerName:i.dataProtectionOfficerName,dataProtectionOfficerEmail:i.dataProtectionOfficerEmail,attributes:i.attributes,teamNames:i.teams,ownerEmails:i.owners}))})})}async function Lp(t,e){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" business entities...`));let r=!1,n=await gr(t),i=_chunkXXFLFF7Qcjs.e.call(void 0, n,"title"),s=e.filter(o=>!i[o.title]);await _bluebird.mapSeries.call(void 0, s,async o=>{try{let p=await rm(t,o);i[p.title]=p,_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced business entity "${o.title}"!`))}catch(p){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync business entity "${o.title}"! - ${p.message}`))}});try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${e.length}" business entities!`)),await im(t,e.map(o=>[o,i[o.title].id])),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced "${e.length}" business entities!`))}catch(o){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync "${e.length}" business entities ! - ${o.message}`))}return!r}var sn=20;async function kp(t){let e=[],r=0,n=!1;do{let{codePackages:{nodes:i}}=await l(t,uo,{first:sn,offset:r});e.push(...i),r+=sn,n=i.length===sn}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}var an=20;async function _p(t){let e=[],r=0,n=!1;do{let{softwareDevelopmentKits:{nodes:i}}=await l(t,po,{first:an,offset:r});e.push(...i),r+=an,n=i.length===an}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}var sm=100;async function am(t,e){let{createSoftwareDevelopmentKit:{softwareDevelopmentKit:r}}=await l(t,co,{input:e});return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created software development kit "${e.name}"!`)),r}async function pm(t,e){let{updateSoftwareDevelopmentKits:{softwareDevelopmentKits:r}}=await l(t,lo,{input:{softwareDevelopmentKits:e}});return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated ${e.length} software development kits!`)),r}async function Op(t,e,r=20){let n=!1,i=[];_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Syncing software development kits..."));let s=await _p(t),o=_chunkXXFLFF7Qcjs.e.call(void 0, s,({name:d,codePackageType:f})=>JSON.stringify({name:d,codePackageType:f})),p=e.map(d=>[d,_optionalChain([o, 'access', _65 => _65[JSON.stringify({name:d.name,codePackageType:d.codePackageType})], 'optionalAccess', _66 => _66.id])]),c=p.filter(([,d])=>!d).map(([d])=>d);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating "${c.length}" new software development kits...`)),await _bluebird.map.call(void 0, c,async d=>{let f=await am(t,d);i.push(f)},{concurrency:r}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced ${c.length} software development kits!`))}catch(d){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create software development kits! - ${d.message}`))}let u=p.filter(d=>!!d[1]),m=_chunkXXFLFF7Qcjs.b.call(void 0, u,sm);return _chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${u.length}" software development kits...`)),await _bluebird.mapSeries.call(void 0, m,async d=>{try{let f=await pm(t,d.map(([{codePackageType:g,...y},S])=>({...y,id:S})));i.push(...f),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated "${u.length}" software development kits!`))}catch(f){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to update software development kits! - ${f.message}`))}_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${e.length}" software development kits!`))}),{softwareDevelopmentKits:i,success:!n}}var pn=20;async function Gp(t){let e=[],r=0,n=!1;do{let{repositories:{nodes:i}}=await l(t,Yn,{first:pn,offset:r});e.push(...i),r+=pn,n=i.length===pn}while(n);return e.sort((i,s)=>i.name.localeCompare(s.name))}var um=100;async function mm(t,e){let{createRepository:{repository:r}}=await l(t,zn,{input:e});return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created repository "${e.name}"!`)),r}async function dm(t,e){let{updateRepositories:{repositories:r}}=await l(t,Zn,{input:{repositories:e}});return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated ${e.length} repositories!`)),r}async function Np(t,e,r=20){let n=!1,i=[],s=await Gp(t),o=_chunkXXFLFF7Qcjs.e.call(void 0, s,"name"),p=e.map(d=>[d,_optionalChain([o, 'access', _67 => _67[d.name], 'optionalAccess', _68 => _68.id])]),c=p.filter(([,d])=>!d).map(([d])=>d);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating "${c.length}" new repositories...`)),await _bluebird.map.call(void 0, c,async d=>{let f=await mm(t,d);i.push(f)},{concurrency:r}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced ${c.length} repositories!`))}catch(d){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create repositories! - ${d.message}`))}let u=p.filter(d=>!!d[1]),m=_chunkXXFLFF7Qcjs.b.call(void 0, u,um);return _chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${u.length}" repositories...`)),await _bluebird.mapSeries.call(void 0, m,async d=>{try{let f=await dm(t,d.map(([g,y])=>({...g,id:y})));i.push(...f),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated "${u.length}" repositories!`))}catch(f){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to update repositories! - ${f.message}`))}_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${e.length}" repositories!`))}),{repositories:i,success:!n}}var ym=100,kt="%%%%";async function hm(t,e){let{createCodePackage:{codePackage:r}}=await l(t,fo,{input:e});return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created code package "${e.name}"!`)),r}async function Cm(t,e){let{updateCodePackages:{codePackages:r}}=await l(t,mo,{input:{codePackages:e}});return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated ${e.length} code packages!`)),r}async function QR(t,e,r=20){let n=!1,[i,{softwareDevelopmentKits:s}]=await Promise.all([kp(t),Op(t,_chunkXXFLFF7Qcjs.k.call(void 0, e.map(({type:f,softwareDevelopmentKits:g=[]})=>g.map(({name:y})=>({name:y,codePackageType:f}))).flat(),({name:f,codePackageType:g})=>`${f}${kt}${g}`),r),Np(t,_chunkXXFLFF7Qcjs.k.call(void 0, e,"repositoryName").map(({repositoryName:f})=>({name:f,url:`https://github.com/${f}`})))]),o=_chunkXXFLFF7Qcjs.e.call(void 0, s,({name:f,codePackageType:g})=>`${f}${kt}${g}`),p=_chunkXXFLFF7Qcjs.e.call(void 0, i,({name:f,type:g})=>`${f}${kt}${g}`),c=e.map(f=>[f,_optionalChain([p, 'access', _69 => _69[`${f.name}${kt}${f.type}`], 'optionalAccess', _70 => _70.id])]),u=c.filter(([,f])=>!f).map(([f])=>f);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating "${u.length}" new code packages...`)),await _bluebird.map.call(void 0, u,async({softwareDevelopmentKits:f,...g})=>{await hm(t,{...g,...f?{softwareDevelopmentKitIds:_chunkXXFLFF7Qcjs.j.call(void 0, f.map(({name:y})=>{let S=o[`${y}${kt}${g.type}`];if(!S)throw new Error(`Failed to find SDK with name: "${y}"`);return S.id}))}:{}})},{concurrency:r}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced ${u.length} code packages!`))}catch(f){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create code packages! - ${f.message}`))}let m=c.filter(f=>!!f[1]);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${m.length}" code packages...`));let d=_chunkXXFLFF7Qcjs.b.call(void 0, m,ym);return await _bluebird.mapSeries.call(void 0, d,async f=>{try{await Cm(t,f.map(([{softwareDevelopmentKits:g,repositoryName:y,...S},R])=>({...S,...g?{softwareDevelopmentKitIds:_chunkXXFLFF7Qcjs.j.call(void 0, g.map(({name:I})=>{let L=o[`${I}${kt}${S.type}`];if(!L)throw new Error(`Failed to find SDK with name: "${I}"`);return L.id}))}:{},id:R}))),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated "${f.length}" code packages!`))}catch(g){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to update code packages! - ${g.message}`))}}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${e.length}" code packages!`)),!n}async function Mp(t,{identifier:e,dataSubjectsByName:r,identifierId:n,skipPublish:i=!1}){await l(t,Qn,{input:{id:n,selectOptions:e.selectOptions,isRequiredInForm:e.isRequiredInForm,regex:e.regex,placeholder:e.placeholder,displayTitle:e.displayTitle,displayDescription:e.displayDescription,displayOrder:e.displayOrder,isUniqueOnPreferenceStore:e.isUniqueOnPreferenceStore,privacyCenterVisibility:e.privacyCenterVisibility,dataSubjectIds:e.dataSubjects?e.dataSubjects.map(s=>r[s].id):void 0,skipPublish:i}})}var Am=100;async function Im(t,e){let r=await De(t);await _bluebird.mapSeries.call(void 0, _chunkXXFLFF7Qcjs.b.call(void 0, e,Am),async n=>{await l(t,Ss,{airgapBundleId:r,cookies:n.map(i=>({name:i.name,trackingPurposes:i.trackingPurposes&&i.trackingPurposes.length>0?i.trackingPurposes:void 0,description:i.description,service:i.service,status:i.status,attributes:i.attributes,isRegex:i.isRegex}))})})}async function Fp(t,e){let r=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" cookies...`));let n=e.filter(i=>e.filter(s=>i.name===s.name&&i.isRegex===s.isRegex).length>1);if(n.length>0)throw new Error(`Failed to upload cookies as there were non-unique entries found: ${n.map(({name:i})=>i).join(",")}`);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Upserting "${e.length}" new cookies...`)),await Im(t,e),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced ${e.length} cookies!`))}catch(i){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create cookies! - ${i.message}`))}return!r}async function Tm(t,e){let r={name:e.name,description:e.description,ssoTitle:e["sso-title"],ssoDepartment:e["sso-department"],ssoGroup:e["sso-group"],scopes:e.scopes,userEmails:e.users},{createTeam:n}=await l(t,Yo,{input:r});return n.team}async function Pm(t,e,r){let{updateTeam:n}=await l(t,Zo,{input:{id:r,name:e.name,description:e.description,ssoTitle:e["sso-title"],ssoDepartment:e["sso-department"],ssoGroup:e["sso-group"],scopes:e.scopes,userEmails:e.users}});return n.team}async function Bp(t,e){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" teams...`));let r=!1,n=await br(t),i=_chunkXXFLFF7Qcjs.e.call(void 0, n,"name"),s=e.filter(p=>!i[p.name]),o=e.filter(p=>!!i[p.name]);return await _bluebird.mapSeries.call(void 0, s,async p=>{try{let c=await Tm(t,p);i[c.name]=c,_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created team "${p.name}"!`))}catch(c){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync team "${p.name}"! - ${c.message}`))}}),await _bluebird.mapSeries.call(void 0, o,async p=>{try{let c=await Pm(t,p,i[p.name].id);i[c.name]=c,_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated team "${p.name}"!`))}catch(c){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync team "${p.name}"! - ${c.message}`))}}),!r}async function Qp(t,{dataSubject:e,dataSubjectId:r,skipPublish:n=!1}){await l(t,Kn,{input:{id:r,title:e.title,adminDashboardDefaultSilentMode:e.adminDashboardDefaultSilentMode,actions:e.actions,skipPublish:n&&typeof e.active>"u"}}),typeof e.active=="boolean"&&await l(t,jn,{input:{id:r,active:e.active,skipPublish:n}})}async function Rm(t,e){let{createPrompt:{prompt:r}}=await l(t,No,{input:e});return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created prompt "${e.title}"!`)),r.id}async function bm(t,e){await l(t,Go,{input:{prompts:e.map(([r,n])=>({...r,id:n}))}}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated ${e.length} prompts!`))}async function Vp(t,e,r=20){let n=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" prompts...`));let i=await $t(t),s=_chunkXXFLFF7Qcjs.e.call(void 0, i,"title"),o=e.map(u=>[u,_optionalChain([s, 'access', _71 => _71[u.title], 'optionalAccess', _72 => _72.id])]),p=o.filter(([,u])=>!u).map(([u])=>u);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating "${p.length}" new prompts...`)),await _bluebird.map.call(void 0, p,async u=>{await Rm(t,u)},{concurrency:r}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced ${p.length} prompts!`))}catch(u){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create prompts! - ${u.message}`))}let c=o.filter(u=>!!u[1]);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${c.length}" prompts...`)),await bm(t,c),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated "${c.length}" prompts!`))}catch(u){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create prompts! - ${u.message}`))}return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${e.length}" prompts!`)),!n}var $m=100;async function xm(t,e){let r=await bt(t);await _bluebird.mapSeries.call(void 0, _chunkXXFLFF7Qcjs.b.call(void 0, e,$m),async n=>{await l(t,Co,{privacyCenterId:r,policies:n.map(([i,s])=>({id:s,title:i.title,disableEffectiveOn:i.disableEffectiveOn,disabledLocales:i.disabledLocales,...i.effectiveOn||i.content?{version:{...i.effectiveOn?{effectiveOn:i.effectiveOn}:{},...i.content?{content:{defaultMessage:i.content}}:{}}}:{}}))})})}async function Kp(t,e){let r=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" policies...`));let n=e.filter(o=>e.filter(p=>o.title===p.title).length>1);if(n.length>0)throw new Error(`Failed to upload policies as there were non-unique entries found: ${n.map(({title:o})=>o).join(",")}`);let i=await Cr(t),s=_chunkXXFLFF7Qcjs.e.call(void 0, i,({title:o})=>o.defaultMessage);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Upserting "${e.length}" new policies...`)),await xm(t,e.map(o=>[o,_optionalChain([s, 'access', _73 => _73[o.title], 'optionalAccess', _74 => _74.id])])),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced ${e.length} policies!`))}catch(o){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create policies! - ${o.message}`))}return!r}var qm=100;async function vm(t,e){await _bluebird.mapSeries.call(void 0, _chunkXXFLFF7Qcjs.b.call(void 0, e,qm),async r=>{await l(t,Eo,{messages:r.map(n=>({...n.id.includes(".")?{}:{id:n.id},defaultMessage:n.defaultMessage,targetReactIntlId:n.targetReactIntlId,translations:n.translations?Object.entries(n.translations).map(([i,s])=>({locale:i,value:s})):void 0}))})})}async function jp(t,e){let r=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" messages...`));let n=e.filter(i=>e.filter(s=>i.id===s.id).length>1);if(n.length>0)throw new Error(`Failed to upload messages as there were non-unique entries found: ${n.map(({id:i})=>i).join(",")}`);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Upserting "${e.length}" new messages...`)),await vm(t,e),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced ${e.length} messages!`))}catch(i){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create messages! - ${i.message}`))}return!r}async function Yp(t,e){let r=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Syncing privacy center..."));let n=await bt(t);try{await l(t,Xs,{input:{privacyCenterId:n,transformAccessReportJsonToCsv:e.transformAccessReportJsonToCsv,useCustomEmailDomain:e.useCustomEmailDomain,useNoReplyEmailAddress:e.useNoReplyEmailAddress,replyToEmail:e.replyToEmail,supportEmail:e.supportEmail,preferBrowserDefaultLocale:e.preferBrowserDefaultLocale,defaultLocale:e.defaultLocale,locales:e.locales,showMarketingPreferences:e.showMarketingPreferences,showManageYourPrivacy:e.showManageYourPrivacy,showPolicies:e.showPolicies,showConsentManager:e.showConsentManager,showDataFlows:e.showDataFlows,showCookies:e.showCookies,showTrackingTechnologies:e.showTrackingTechnologies,showPrivacyRequestButton:e.showPrivacyRequestButton,isDisabled:e.isDisabled,...e.theme?{colorPalette:e.theme.colors,componentStyles:e.theme.componentStyles,textStyles:e.theme.textStyles}:{}}}),_chunkZUNVPK23cjs.a.info(_colors2.default.green("Successfully synced privacy center!"))}catch(i){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create privacy center! - ${i.message}`))}return!r}var _airgapjstypes = require('@transcend-io/airgap.js-types');var zp="https://app.transcend.io/consent-manager/regional-experiences/purposes";async function Om(t,e){let r=await yr(t),n=_chunkXXFLFF7Qcjs.e.call(void 0, r,"name"),i=await Ir(t),s=_chunkXXFLFF7Qcjs.e.call(void 0, i,"trackingType");await _bluebird.map.call(void 0, e,async(o,p)=>{let c=_optionalChain([o, 'access', _75 => _75.purposes, 'optionalAccess', _76 => _76.map, 'call', _77 => _77((d,f)=>{let g=s[d.trackingType];if(!g)throw new Error(`Invalid purpose trackingType provided at consentManager.experiences[${p}].purposes[${f}]: ${d.trackingType}. See list of valid purposes ${zp}`);return g.id})]),u=_optionalChain([o, 'access', _78 => _78.optedOutPurposes, 'optionalAccess', _79 => _79.map, 'call', _80 => _80((d,f)=>{let g=s[d.trackingType];if(!g)throw new Error(`Invalid purpose trackingType provided at consentManager.experiences[${p}].optedOutPurposes[${f}]: ${d.trackingType}. See list of valid purposes ${zp}`);return g.id})]),m=n[o.name];m?(await l(t,Gs,{input:{id:m.id,name:o.displayName,regions:o.regions,operator:o.operator,onConsentExpiry:o.onConsentExpiry,consentExpiry:o.consentExpiry,displayPriority:o.displayPriority!==m.displayPriority?o.displayPriority:void 0,viewState:o.viewState,purposes:c,optedOutPurposes:u,browserLanguages:o.browserLanguages,browserTimeZones:o.browserTimeZones}}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced consent experience "${o.name}"!`))):(await l(t,Ns,{input:{name:o.name,displayName:o.displayName,regions:o.regions,operator:o.operator,onConsentExpiry:o.onConsentExpiry||_airgapjstypes.OnConsentExpiry.Prompt,consentExpiry:o.consentExpiry,displayPriority:o.displayPriority,viewState:o.viewState||_airgapjstypes.InitialViewState.Hidden,purposes:c||[],optedOutPurposes:u||[],browserLanguages:o.browserLanguages,browserTimeZones:o.browserTimeZones}}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created consent experience "${o.name}"!`)))},{concurrency:10})}async function Wp(t,e){let r;try{r=await De(t,1)}catch(n){if(n.message.includes("AirgapBundle not found")){let i=await bt(t),{createConsentManager:s}=await l(t,Rs,{domains:e.domains,privacyCenterId:i});r=s.consentManager.id}else throw n}if(e.domains&&await l(t,xs,{domains:e.domains,airgapBundleId:r}),e.partition){let i=(await zt(t)).find(s=>s.name===e.partition);if(!i)throw new Error(`Partition "${e.partition}" not found. Please create the partition first.`);await l(t,Ds,{partitionId:i.id,airgapBundleId:r})}e.version&&await l(t,bs,{airgapBundleId:r,version:e.version}),e.signedIabAgreement&&await l(t,qs,{input:{id:r,...e.signedIabAgreement?{signedIabAgreement:e.signedIabAgreement}:{}}}),e.unknownRequestPolicy&&await l(t,vs,{input:{id:r,unknownRequestPolicy:e.unknownRequestPolicy}}),e.unknownRequestPolicy&&await l(t,Ls,{input:{id:r,unknownCookiePolicy:e.unknownCookiePolicy}}),e.telemetryPartitioning&&await l(t,ks,{input:{id:r,strategy:e.telemetryPartitioning}}),e.consentPrecedence&&await l(t,_s,{input:{id:r,consentPrecedence:e.consentPrecedence}}),e.experiences&&await Om(t,e.experiences),e.theme&&await l(t,Os,{input:{airgapBundleId:r,...e.theme}})}var Xp=100;async function Gm(t,e,r=!1){let n=await De(t);await _bluebird.mapSeries.call(void 0, _chunkXXFLFF7Qcjs.b.call(void 0, e,Xp),async i=>{await l(t,Cs,{airgapBundleId:n,dataFlows:i.map(([s,o])=>({id:o,value:s.value,type:s.type,trackingType:s.trackingPurposes&&s.trackingPurposes.length>0?s.trackingPurposes:void 0,description:s.description,service:s.service,status:s.status,attributes:s.attributes})),classifyService:r})})}async function Nm(t,e,r=!1){let n=await De(t);await _bluebird.mapSeries.call(void 0, _chunkXXFLFF7Qcjs.b.call(void 0, e,Xp),async i=>{await l(t,hs,{airgapBundleId:n,dataFlows:i.map(s=>({value:s.value,type:s.type,trackingType:s.trackingPurposes&&s.trackingPurposes.length>0?s.trackingPurposes:void 0,description:s.description,service:s.service,status:s.status,attributes:s.attributes})),dropMatchingDataFlowsInTriage:!0,classifyService:r})})}async function el(t,e,r){let n=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" data flows...`));let i=e.filter(d=>e.filter(f=>d.value===f.value&&d.type===f.type).length>1);if(i.length>0)throw new Error(`Failed to upload data flows as there were non-unique entries found: ${i.map(({value:d})=>d).join(",")}`);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Fetching data flows..."));let[s,o]=await Promise.all([Rt(t,_privacytypes.ConsentTrackerStatus.Live),Rt(t,_privacytypes.ConsentTrackerStatus.NeedsReview)]),p=[...s,...o],c=e.map(d=>[d,_optionalChain([p, 'access', _81 => _81.find, 'call', _82 => _82(f=>d.value===f.value&&d.type===f.type), 'optionalAccess', _83 => _83.id])]),u=c.filter(([,d])=>!d).map(([d])=>d);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating "${u.length}" new data flows...`)),await Nm(t,u,r),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced ${u.length} data flows!`))}catch(d){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create data flows! - ${d.message}`))}let m=c.filter(d=>!!d[1]);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${m.length}" data flows...`)),await Gm(t,m,r),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated "${m.length}" data flows!`))}catch(d){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create data flows! - ${d.message}`))}return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${e.length}" data flows!`)),!n}async function Fm(t,e){let{createPromptPartial:{promptPartial:r}}=await l(t,Fo,{input:e});return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created prompt partial "${e.title}"!`)),r.id}async function Um(t,e){await l(t,Mo,{input:{promptPartials:e.map(([r,n])=>({...r,id:n}))}}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated ${e.length} prompt partials!`))}async function tl(t,e,r=20){let n=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" prompt partials...`));let i=await Dr(t),s=_chunkXXFLFF7Qcjs.e.call(void 0, i,"title"),o=e.map(u=>[u,_optionalChain([s, 'access', _84 => _84[u.title], 'optionalAccess', _85 => _85.id])]),p=o.filter(([,u])=>!u).map(([u])=>u);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating "${p.length}" new prompt partials...`)),await _bluebird.map.call(void 0, p,async u=>{await Fm(t,u)},{concurrency:r}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced ${p.length} prompt partials!`))}catch(u){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create prompt partials! - ${u.message}`))}let c=o.filter(u=>!!u[1]);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${c.length}" prompt partials...`)),await Um(t,c),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated "${c.length}" prompt partials!`))}catch(u){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create prompt partials! - ${u.message}`))}return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${e.length}" prompt partials!`)),!n}async function Qm(t,e){let{createPromptGroup:{promptGroup:r}}=await l(t,Bo,{input:e});return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created prompt group "${e.title}"!`)),r.id}async function Vm(t,e){await l(t,Uo,{input:{promptGroups:e.map(([r,n])=>({...r,id:n}))}}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated ${e.length} prompt groups!`))}async function rl(t,e,r=20){let n=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" prompt groups...`));let i=await xr(t),s=await $t(t),o=_chunkXXFLFF7Qcjs.e.call(void 0, s,"title"),p=_chunkXXFLFF7Qcjs.e.call(void 0, i,"title"),c=e.map(d=>[d,_optionalChain([p, 'access', _86 => _86[d.title], 'optionalAccess', _87 => _87.id])]),u=c.filter(([,d])=>!d).map(([d])=>d);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating "${u.length}" new prompt groups...`)),await _bluebird.map.call(void 0, u,async d=>{await Qm(t,{...d,promptIds:d.prompts.map(f=>{let g=o[f];if(!g)throw new Error(`Failed to find prompt with title: "${f}"`);return g.id})})},{concurrency:r}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced ${u.length} prompt groups!`))}catch(d){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create prompt groups! - ${d.message}`))}let m=c.filter(d=>!!d[1]);try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${m.length}" prompt groups...`)),await Vm(t,m.map(([{prompts:d,...f},g])=>[{...f,promptIds:d.map(y=>{let S=o[y];if(!S)throw new Error(`Failed to find prompt with title: "${y}"`);return S.id})},g])),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully updated "${m.length}" prompt groups!`))}catch(d){n=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create prompt groups! - ${d.message}`))}return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${e.length}" prompt groups!`)),!n}async function jm(t,e){let r={title:e.title,description:e.description,address:e.address,headquarterCountry:e.headquarterCountry,headquarterSubDivision:e.headquarterSubDivision,dataProcessingAgreementLink:e.dataProcessingAgreementLink,contactName:e.contactName,contactPhone:e.contactPhone,websiteUrl:e.websiteUrl},{createVendor:n}=await l(t,ma,{input:r});return n.vendor}async function Ym(t,e){await l(t,da,{input:{vendors:e.map(([r,n])=>({id:n,title:r.title,description:r.description,address:r.address,headquarterCountry:r.headquarterCountry,headquarterSubDivision:r.headquarterSubDivision,dataProcessingAgreementLink:r.dataProcessingAgreementLink,contactName:r.contactName,contactPhone:r.contactPhone,websiteUrl:r.websiteUrl,attributes:r.attributes}))}})}async function il(t,e){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" vendors...`));let r=!1,n=await wr(t),i=_chunkXXFLFF7Qcjs.e.call(void 0, n,"title"),s=e.filter(o=>!i[o.title]);await _bluebird.mapSeries.call(void 0, s,async o=>{try{let p=await jm(t,o);i[p.title]=p,_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced vendor "${o.title}"!`))}catch(p){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync vendor "${o.title}"! - ${p.message}`))}});try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${e.length}" vendors!`)),await Ym(t,e.map(o=>[o,i[o.title].id])),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced "${e.length}" vendors!`))}catch(o){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync "${e.length}" vendors ! - ${o.message}`))}return!r}async function zm(t,e){let r={name:e.name,category:e.category,description:e.description},{createDataCategory:n}=await l(t,ga,{input:r});return n.dataCategory}async function Wm(t,e){await l(t,ya,{input:{dataSubCategories:e.map(([r,n])=>({id:n,description:r.description,attributes:r.attributes}))}})}async function nl(t,e){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" data categories...`));let r=!1,n=await hr(t),i=_chunkXXFLFF7Qcjs.e.call(void 0, n,({name:o,category:p})=>`${o}:${p}`),s=e.filter(o=>!i[`${o.name}:${o.category}`]);await _bluebird.mapSeries.call(void 0, s,async o=>{try{let p=await zm(t,o);i[`${p.name}:${p.category}`]=p,_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced data category "${o.name}"!`))}catch(p){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync data category "${o.name}"! - ${p.message}`))}});try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${e.length}" data categories!`)),await Wm(t,e.map(o=>[o,i[`${o.name}:${o.category}`].id])),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced "${e.length}" data categories!`))}catch(o){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync "${e.length}" data categories ! - ${o.message}`))}return!r}async function Jm(t,e){let r={name:e.name,purpose:e.purpose,description:e.description},{createProcessingPurposeSubCategory:n}=await l(t,Ca,{input:r});return n.processingPurposeSubCategory}async function Xm(t,e){await l(t,Sa,{input:{processingPurposeSubCategories:e.map(([r,n])=>({id:n,description:r.description,attributes:r.attributes}))}})}async function ol(t,e){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" processing purposes...`));let r=!1,n=await Ar(t),i=_chunkXXFLFF7Qcjs.e.call(void 0, n,({name:o,purpose:p})=>`${o}:${p}`),s=e.filter(o=>!i[`${o.name}:${o.purpose}`]);await _bluebird.mapSeries.call(void 0, s,async o=>{try{let p=await Jm(t,o);i[`${p.name}:${p.purpose}`]=p,_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced processing purpose "${o.name}"!`))}catch(p){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync processing purpose "${o.name}"! - ${p.message}`))}});try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${e.length}" processing purposes!`)),await Xm(t,e.map(o=>[o,i[`${o.name}:${o.purpose}`].id])),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced "${e.length}" processing purposes!`))}catch(o){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync "${e.length}" processing purposes ! - ${o.message}`))}return!r}async function td(t,e){let r={title:e.title,description:e.description},{createProcessingActivity:n}=await l(t,Ia,{input:r});return n.processingActivity}async function rd(t,e){let r=e.filter(([,n])=>n===void 0).map(([{title:n}])=>n);if(r.length>0)throw new Error(`The following ${r.length} processing activities do not exist and thus can't be updated: "${r.join('", "')}"`);await l(t,Ta,{input:{processingActivities:e.map(([{processingSubPurposes:n,dataSubCategories:i,saaSCategories:s,...o},p])=>({dataSubCategoryInputs:_optionalChain([i, 'optionalAccess', _88 => _88.map, 'call', _89 => _89(({category:c,name:u})=>({category:c,name:_nullishCoalesce(u, () => (""))}))]),processingPurposeSubCategoryInputs:_optionalChain([n, 'optionalAccess', _90 => _90.map, 'call', _91 => _91(({purpose:c,name:u})=>({purpose:c,name:_nullishCoalesce(u, () => ("Other"))}))]),saaSCategoryTitles:s,...o,id:p}))}})}async function sl(t,e){let r=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${e.length}" processing activities...`));let n=await Sr(t),i=_chunkXXFLFF7Qcjs.e.call(void 0, n,"title"),s=e.filter(o=>!i[o.title]);s.length>0&&_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Creating "${s.length}" new processing activities...`)),await _bluebird.mapSeries.call(void 0, s,async o=>{try{let p=await td(t,o);i[p.title]=p,_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully created processing activity "${o.title}"!`))}catch(p){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to create processing activity "${o.title}"! - ${p.message}`))}});try{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Updating "${e.length}" processing activities!`)),await rd(t,e.map(o=>[o,_optionalChain([i, 'access', _92 => _92[o.title], 'optionalAccess', _93 => _93.id])])),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced "${e.length}" processingActivities!`))}catch(o){r=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync "${e.length}" processingActivities! - ${o.message}`))}return!r}var Mt=10;async function Z$(t,e,{pageSize:r=50,publishToPrivacyCenter:n=!0,classifyService:i=!1,deleteExtraAttributeValues:s=!1}){let o=!1;_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Fetching data with page size ${r}...`));let{templates:p,attributes:c,actions:u,identifiers:m,"data-subjects":d,"business-entities":f,enrichers:g,cookies:y,"consent-manager":S,"data-silos":R,"data-flows":I,prompts:L,"prompt-groups":C,"prompt-partials":O,agents:H,"agent-functions":K,"agent-files":se,vendors:J,"data-categories":me,"processing-activities":ce,"processing-purposes":X,"action-items":Ae,"action-item-collections":Ie,teams:pe,"privacy-center":de,messages:we,policies:ke,partitions:Ze}=t,[Se,ne,ue]=await Promise.all([g||m?ip(t,e,!n):{},R||d||g||ce?ep(t,e):{},R&&R.map(A=>A["api-key-title"]||[]).reduce((A,G)=>A+G.length,0)>0?$r(t,e):{}]);if(S){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Syncing consent manager..."));try{await Wp(e,S),_chunkZUNVPK23cjs.a.info(_colors2.default.green("Successfully synced consent manager!"))}catch(A){o=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync consent manager! - ${A.message}`))}}if(L){let A=await Vp(e,L);o=o||!A}if(O){let A=await tl(e,O);o=o||!A}if(C){let A=await rl(e,C);o=o||!A}if(pe){let A=await Bp(e,pe);o=o||!A}if(p&&(_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${p.length}" email templates...`)),await _bluebird.map.call(void 0, p,async A=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing template "${A.title}"...`));try{await yp(A,e),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced template "${A.title}"!`))}catch(G){o=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync template "${A.title}"! - ${G.message}`))}},{concurrency:Mt}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${p.length}" email templates!`))),f){let A=await Lp(e,f);o=o||!A}if(J){let A=await il(e,J);o=o||!A}if(me){let A=await nl(e,me);o=o||!A}if(X){let A=await ol(e,X);o=o||!A}if(Ze){let A=await Cp(e,Ze);o=o||!A}if(H){let A=await Dp(e,H);o=o||!A}if(K){let A=await xp(e,K);o=o||!A}if(se){let A=await $p(e,se);o=o||!A}if(y){let A=await Fp(e,y);o=o||!A}if(Ie){let A=await Ep(e,Ie);o=o||!A}if(c){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${c.length}" attributes...`));let A=await Et(e);await _bluebird.map.call(void 0, c,async G=>{let fe=A.find(ge=>ge.name===G.name);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing attribute "${G.name}"...`));try{await qp(e,G,{existingAttribute:fe,deleteExtraAttributeValues:s}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced attribute "${G.name}"!`))}catch(ge){o=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync attribute "${G.name}"! - ${ge.message}`))}},{concurrency:Mt}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${c.length}" attributes!`))}if(Ae){let A=await wp(e,Ae);o=o||!A}if(g&&(_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${g.length}" enrichers...`)),await _bluebird.map.call(void 0, g,async A=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing enricher "${A.title}"...`));try{await gp(e,{enricher:A,identifierByName:Se,dataSubjectsByName:ne}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced enricher "${A.title}"!`))}catch(G){o=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync enricher "${A.title}"! - ${G.message}`))}},{concurrency:Mt}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${g.length}" enrichers!`))),m&&(_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${m.length}" identifiers...`)),await _bluebird.map.call(void 0, m,async A=>{let G=Se[A.name];if(!G)throw new Error(`Failed to find identifier with name: ${A.type}. Should have been auto-created by cli.`);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing identifier "${A.type}"...`));try{await Mp(e,{identifier:A,dataSubjectsByName:ne,identifierId:G.id,skipPublish:!n}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced identifier "${A.type}"!`))}catch(fe){o=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync identifier "${A.type}"! - ${fe.message}`))}},{concurrency:Mt}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${m.length}" identifiers!`))),u){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${u.length}" actions...`));let A=await ur(e);await _bluebird.map.call(void 0, u,async G=>{let fe=A.find(ge=>ge.type===G.type);if(!fe)throw new Error(`Failed to find action with type: ${G.type}. Should have already existing in the organization.`);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing action "${G.type}"...`));try{await Tp(e,{action:G,actionId:fe.id,skipPublish:!n}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced action "${G.type}"!`))}catch(ge){o=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync action "${G.type}"! - ${ge.message}`))}},{concurrency:Mt}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${u.length}" actions!`))}if(d){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing "${d.length}" data subjects...`));let A=await Yt(e);await _bluebird.map.call(void 0, d,async G=>{let fe=A.find(ge=>ge.type===G.type);if(!fe)throw new Error(`Failed to find data subject with type: ${G.type}. Should have already existing in the organization.`);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Syncing data subject "${G.type}"...`));try{await Qp(e,{dataSubject:G,dataSubjectId:fe.id,skipPublish:!n}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully synced data subject "${G.type}"!`))}catch(ge){o=!0,_chunkZUNVPK23cjs.a.info(_colors2.default.red(`Failed to sync data subject "${G.type}"! - ${ge.message}`))}},{concurrency:Mt}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Synced "${d.length}" data subjects!`))}if(I){let A=await el(e,I,i);o=o||!A}if(de){let A=await Yp(e,de);o=o||!A}if(we){let A=await jp(e,we);o=o||!A}if(ke){let A=await Kp(e,ke);o=o||!A}let Ee=[];if(R){let{success:A,dataSiloTitleToId:G}=await mp(R,e,{dataSubjectsByName:ne,apiKeysByTitle:ue,pageSize:r});_optionalChain([R, 'optionalAccess', _94 => _94.forEach, 'call', _95 => _95(fe=>{fe["deletion-dependencies"]&&Ee.push([G[fe.title],fe["deletion-dependencies"]])})]),o=o||!A}if(Ee.length>0&&await dp(e,Ee),ce){let A=await sl(e,ce);o=o||!A}return o}var nd=1e3;async function ex(t,e,r){let n=_chunkXXFLFF7Qcjs.b.call(void 0, r,nd);await _bluebird.mapSeries.call(void 0, n,async i=>{await l(t,to,{pluginId:e,rawResults:i})})}async function ZD({requestActions:t,auth:e,requestIds:r,statuses:n=[_privacytypes.RequestStatus.Compiling,_privacytypes.RequestStatus.RequestMade,_privacytypes.RequestStatus.Delayed,_privacytypes.RequestStatus.Approving,_privacytypes.RequestStatus.Secondary,_privacytypes.RequestStatus.Enriching,_privacytypes.RequestStatus.Waiting,_privacytypes.RequestStatus.SecondaryApproving],createdAtAfter:i,createdAtBefore:s,concurrency:o=100,transcendUrl:p=_chunkXXFLFF7Qcjs.r}){let c=Z(p,e),u=new Date().getTime(),m=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),d=await le(c,{actions:t,statuses:n,createdAtBefore:s,createdAtAfter:i,isSilent:!1,requestIds:r});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Marking "${d.length}" as silent mode.`));let f=0;m.start(d.length,0),await _bluebird.map.call(void 0, d,async S=>{await l(c,St,{input:{id:S.id,isSilent:!0}}),f+=1,m.update(f)},{concurrency:o}),m.stop();let y=new Date().getTime()-u;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully marked ${f} requests as silent mode in "${y/1e3}" seconds!`)),d.length}async function ll(t,e){let r=_typeutils.getValues.call(void 0, At).filter(i=>!e.getValue("columnNames",i)),n=r.length===0?{}:await _inquirer2.default.prompt(r.map(i=>{let s=_chunkXXFLFF7Qcjs.h.call(void 0, i.replace("ColumnName","")),o=Tt(t,s,Ra[i],!!ba[i]);return{name:i,message:`Choose the column that will be used to map in the field: ${s}`,type:"list",default:o[0],choices:o}}));return await Promise.all(_typeutils.getEntries.call(void 0, n).map(([i,s])=>e.setValue(s,"columnNames",i))),n}async function cl(t,e,{state:r,columnNameMap:n}){let i=S=>r.getValue("columnNames",S)||n[S],{internalSubjects:s}=await l(t,nr);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Determining mapping of columns for request action"));let o=await mt(He(e,i("requestType")),Object.values(_privacytypes.RequestAction),r.getValue("requestTypeToRequestAction"));await r.setValue(o,"requestTypeToRequestAction"),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Determining mapping of columns for subject"));let p=await mt(He(e,i("subjectType")),s.map(({type:S})=>S),r.getValue("subjectTypeToSubjectName"));await r.setValue(p,"subjectTypeToSubjectName"),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Determining mapping of columns for locale"));let c=await mt(He(e,i("locale")),Object.values(_internationalization.LOCALE_KEY),r.getValue("languageToLocale"));await r.setValue(c,"languageToLocale"),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Determining mapping of columns for request status")),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Determining mapping of columns for request status"));let u=i("requestStatus"),m=u===Y?{}:await mt(He(e,u),[...Object.values(_privacytypes.CompletedRequestStatus),Y],r.getValue("statusToRequestStatus"));await r.setValue(m,"statusToRequestStatus"),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Determining mapping of columns for country"));let d=i("country"),f=d===Y?{}:await mt(He(e,d),[...Object.values(_privacytypes.IsoCountryCode),Y],r.getValue("regionToCountry"));await r.setValue(f,"regionToCountry"),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Determining mapping of columns for country sub division"));let g=i("countrySubDivision"),y=g===Y?{}:await mt(He(e,g),[...Object.values(_privacytypes.IsoCountrySubdivisionCode),Y],r.getValue("regionToCountrySubDivision"));await r.setValue(y,"regionToCountrySubDivision")}var _iotstypes = require('io-ts-types');var Id=ae.record(ae.string,ae.array(ae.intersection([ae.type({value:ae.string}),ae.partial({name:ae.string})]))),Pq= exports.tf =ae.intersection([ae.type({email:ae.string,attestedExtraIdentifiers:Id,coreIdentifier:ae.string,requestType:_typeutils.valuesOf.call(void 0, _privacytypes.RequestAction),subjectType:ae.string}),ae.partial({country:_typeutils.valuesOf.call(void 0, _privacytypes.IsoCountryCode),countrySubDivision:_typeutils.valuesOf.call(void 0, _privacytypes.IsoCountrySubdivisionCode),attributes:ae.array(va),status:_typeutils.valuesOf.call(void 0, _privacytypes.CompletedRequestStatus),createdAt:_iotstypes.DateFromISOString,dataSiloIds:ae.array(ae.string),locale:_typeutils.valuesOf.call(void 0, _internationalization.LOCALE_KEY)})]);function Td(t,e,r){if(e===_privacytypes.IdentifierType.Email)return t.toLowerCase();if(e===_privacytypes.IdentifierType.Phone){let n=t.replace(_privacytypes.NORMALIZE_PHONE_NUMBER,"").replace(/[()]/g,"").replace(/[–]/g,"").replace(/[:]/g,"").replace(/[]/g,"").replace(/[A-Za-z]/g,"");return n?n.startsWith("+")?n:`+${r}${n}`:""}return t}function ul(t,e,{columnNameMap:r,identifierNameMap:n,attributeNameMap:i,requestAttributeKeys:s,defaultPhoneCountryCode:o="1"}){let p=c=>e.getValue("columnNames",c)||r[c];return t.map(c=>{let u={};Object.entries(n).filter(([,g])=>g!==Y).forEach(([g,y])=>{let S=Object.values(_privacytypes.IdentifierType).includes(g)?g:_privacytypes.IdentifierType.Custom,R=c[y];if(R){let I=Td(R,S,o);I&&(u[S]||(u[S]=[]),u[S].push({value:I,name:g}))}});let m=[];Object.entries(i).filter(([,g])=>g!==Y).forEach(([g,y])=>{let S=c[y];if(S){let R=_optionalChain([s, 'access', _96 => _96.find, 'call', _97 => _97(I=>I.name===g), 'optionalAccess', _98 => _98.type])==="MULTI_SELECT";m.push({values:R?mi(S):S,key:g})}});let d=p("requestType"),f=p("subjectType");return[c,{email:c[p("email")],attestedExtraIdentifiers:u,attributes:m,coreIdentifier:c[p("coreIdentifier")],requestType:d===Kt?e.getValue("requestTypeToRequestAction",ui):e.getValue("requestTypeToRequestAction",c[d]),subjectType:f===Kt?e.getValue("subjectTypeToSubjectName",ui):e.getValue("subjectTypeToSubjectName",c[f]),...p("locale")!==Y&&c[p("locale")]?{locale:e.getValue("languageToLocale",c[p("locale")])}:{},...p("country")!==Y&&c[p("country")]?{country:e.getValue("regionToCountry",c[p("country")])}:{},...p("countrySubDivision")!==Y&&c[p("countrySubDivision")]?{countrySubDivision:e.getValue("regionToCountrySubDivision",c[p("countrySubDivision")])}:{},...p("requestStatus")!==Y&&e.getValue("statusToRequestStatus",c[p("requestStatus")])!==Y&&c[p("requestStatus")]?{status:e.getValue("statusToRequestStatus",c[p("requestStatus")])}:{},...p("createdAt")!==Y&&c[p("createdAt")]?{createdAt:new Date(c[p("createdAt")])}:{},...p("dataSiloIds")!==Y&&c[p("dataSiloIds")]?{dataSiloIds:mi(c[p("dataSiloIds")])}:{}}]})}var _path = require('path');var fl=x.type({defaultMessage:x.string,id:x.string}),wd= exports.xf =x.type({downloadKey:x.string,error:x.union([x.null,x.string]),mimetype:x.string,size:x.string,fileName:x.string,dataPoint:x.type({id:x.string,title:x.union([fl,x.null]),description:x.union([fl,x.null]),name:x.string,slug:x.string,encryption:x.union([_typeutils.valuesOf.call(void 0, _privacytypes.TableEncryptionType),x.null]),dataSilo:x.type({id:x.string,title:x.string,description:x.string,type:x.string,outerType:x.union([x.string,x.null])}),path:x.array(x.string)})}),$d= exports.yf =x.type({nodes:x.array(wd),totalCount:x.number,_links:x.partial({next:x.union([x.string,x.null]),previous:x.union([x.string,x.null])})});async function gl(t,{sombra:e,concurrency:r=5,limit:n=100}){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Pulling file metadata for ${t.length} requests`));let i=new Date().getTime(),s=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),o=0;s.start(t.length,0);let p=await _bluebird.map.call(void 0, t,async m=>{let d=[],f=!0,g=0;for(;f;){let y;try{let S=await e.get(`v1/data-subject-request/${m.id}/download-keys`,{searchParams:{limit:n,offset:g}}).json();y=_typeutils.decodeCodec.call(void 0, $d,S),d.push(...y.nodes),g+=n,f=!!y._links.next&&y.nodes.length===n}catch(S){throw new Error(`Received an error from server: ${_optionalChain([S, 'optionalAccess', _99 => _99.response, 'optionalAccess', _100 => _100.body])||_optionalChain([S, 'optionalAccess', _101 => _101.message])}`)}}return o+=1,s.update(o),[m,d]},{concurrency:r});s.stop();let u=new Date().getTime()-i;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully downloaded file metadata ${t.length} requests in "${u/1e3}" seconds!`)),p}async function yl(t,{requestId:e,sombra:r,onFileDownloaded:n,concurrency:i=20}){await _bluebird.map.call(void 0, t,async s=>{try{await r.get("v1/files",{searchParams:{downloadKey:s.downloadKey}}).buffer().then(o=>n(s,o))}catch(o){if(_optionalChain([o, 'optionalAccess', _102 => _102.response, 'optionalAccess', _103 => _103.body, 'optionalAccess', _104 => _104.includes, 'call', _105 => _105("fileMetadata#verify")])){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to pull file for: ${s.fileName} (request:${e}) - JWT expired. This likely means that the file is no longer available. Try restarting the request from scratch in Transcend Admin Dashboard. Skipping the download of this file.`));return}throw new Error(`Received an error from server: ${_optionalChain([o, 'optionalAccess', _106 => _106.response, 'optionalAccess', _107 => _107.body])||_optionalChain([o, 'optionalAccess', _108 => _108.message])}`)}},{concurrency:i})}async function Yq({auth:t,folderPath:e,requestIds:r,createdAtBefore:n,sombraAuth:i,createdAtAfter:s,statuses:o=[_privacytypes.RequestStatus.Approving,_privacytypes.RequestStatus.Downloadable],concurrency:p=5,transcendUrl:c=_chunkXXFLFF7Qcjs.r,approveAfterDownload:u=!1}){let m=Z(c,t),d=await nt(c,t,i);_fs.existsSync.call(void 0, e)||_fs.mkdirSync.call(void 0, e);let f=await le(m,{actions:[_privacytypes.RequestAction.Access],createdAtBefore:n,createdAtAfter:s,statuses:o,requestIds:r}),g=await gl(f,{sombra:d,concurrency:p}),y=new Date().getTime(),S=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),R=0,I=0;S.start(f.length,0),await _bluebird.map.call(void 0, g,async([O,H])=>{let K=_path.join.call(void 0, e,O.id);_fs.existsSync.call(void 0, K)||_fs.mkdirSync.call(void 0, K),await yl(H,{sombra:d,requestId:O.id,onFileDownloaded:(se,J)=>{let me=_path.join.call(void 0, K,se.fileName),ce=_path.dirname.call(void 0, me);_fs.existsSync.call(void 0, ce)||_fs.mkdirSync.call(void 0, ce,{recursive:!0}),_fs.writeFileSync.call(void 0, me,J)}}),u&&O.status===_privacytypes.RequestStatus.Approving&&(await l(m,or,{input:{requestId:O.id}}),I+=1),R+=1,S.update(R)},{concurrency:p}),S.stop();let C=new Date().getTime()-y;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully downloaded ${R} requests in "${C/1e3}" seconds!`)),I>0&&_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Approved ${I} requests in Transcend.`)),f.length}var dn=re.type({id:re.string,link:re.string,status:_typeutils.valuesOf.call(void 0, _privacytypes.RequestStatus),type:_typeutils.valuesOf.call(void 0, _privacytypes.RequestAction),subjectType:re.string,email:re.union([re.null,re.string]),coreIdentifier:re.string,isSilent:re.boolean,isTest:re.boolean,country:re.union([re.null,_typeutils.valuesOf.call(void 0, _privacytypes.IsoCountryCode)]),countrySubDivision:re.union([re.null,_typeutils.valuesOf.call(void 0, _privacytypes.IsoCountrySubdivisionCode)]),attributeValues:re.array(re.type({attributeKey:re.type({name:re.string}),name:re.string}))});async function Al(t,e,{details:r="",isTest:n=!1,emailIsVerified:i=!0,skipSendingReceipt:s=!1,isSilent:o=!0,additionalAttributes:p=[]}={}){let c=[...p];(e.attributes||[]).forEach(d=>{let f=c.find(g=>g.key===d.key);f?(f.values.push(...d.values),f.values=_chunkXXFLFF7Qcjs.j.call(void 0, f.values)):c.push(d)});let u;try{u=await t.post("v1/data-subject-request",{json:{type:e.requestType,subject:{coreIdentifier:e.coreIdentifier,email:e.email,emailIsVerified:i,attestedExtraIdentifiers:e.attestedExtraIdentifiers},subjectType:e.subjectType,isSilent:o,isTest:n,skipSendingReceipt:s,...e.locale?{locale:e.locale}:{},details:r,attributes:c,...e.country||e.countrySubDivision?{region:{...e.country?{country:e.country}:e.countrySubDivision?{country:e.countrySubDivision.split("-")[0]}:{},...e.countrySubDivision?{countrySubDivision:e.countrySubDivision}:{}}}:{},...e.createdAt?{createdAt:e.createdAt}:{},...e.dataSiloIds?{dataSiloIds:e.dataSiloIds}:{},...e.status?{completedRequestStatus:e.status}:{}}}).json()}catch(d){throw new Error(`Received an error from server: ${_optionalChain([d, 'optionalAccess', _109 => _109.response, 'optionalAccess', _110 => _110.body])||_optionalChain([d, 'optionalAccess', _111 => _111.message])}`)}let{request:m}=_typeutils.decodeCodec.call(void 0, re.type({request:dn}),u);return m}async function pv({requestActions:t,requestOrigins:e,auth:r,silentModeBefore:n,createdAtAfter:i,createdAtBefore:s,concurrency:o=50,transcendUrl:p=_chunkXXFLFF7Qcjs.r}){let c=Z(p,r),u=new Date().getTime(),m=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),d=await le(c,{actions:t,statuses:[_privacytypes.RequestStatus.Approving],createdAtAfter:i,origins:e,createdAtBefore:s});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Approving "${d.length}" requests.`));let f=0,g=0;m.start(d.length,0),await _bluebird.map.call(void 0, d,async R=>{n&&new Date(n)>new Date(R.createdAt)&&await l(c,St,{input:{id:R.id,isSilent:!0}});try{await l(c,or,{input:{requestId:R.id}})}catch(I){I.message.includes("Request must be in an approving state,")&&(g+=1)}f+=1,m.update(f)},{concurrency:o}),m.stop();let S=new Date().getTime()-u;return g>0&&_chunkZUNVPK23cjs.a.info(_colors2.default.yellow(`${g} requests were skipped.`)),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully approved ${f} requests in "${S/1e3}" seconds!`)),d.length}async function hv({requestActions:t=Object.values(_privacytypes.RequestAction),auth:e,requestIds:r,createdAtBefore:n,days:i=45,daysLeft:s=10,createdAtAfter:o,emailTemplate:p="Additional Time Needed",concurrency:c=100,transcendUrl:u=_chunkXXFLFF7Qcjs.r}){let m=Z(u,e),d=new Date().getTime(),f=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),y=(await gt(m,p)).find(C=>C.title===p);if(!y)throw new Error(`Failed to find a template with title: "${p}"`);let S=await le(m,{actions:t,createdAtBefore:n,createdAtAfter:o,isSilent:!1,isClosed:!1,requestIds:r});S=S.filter(C=>typeof C.daysRemaining=="number"&&C.daysRemaining<s),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Notifying "${S.length}" that more time is needed.`));let R=0;f.start(S.length,0),await _bluebird.map.call(void 0, S,async C=>{await l(m,Io,{input:{requestId:C.id,template:y.template.defaultMessage,subject:y.subject.defaultMessage,additionalTime:i}}),R+=1,f.update(R)},{concurrency:c}),f.stop();let L=new Date().getTime()-d;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully marked ${R} requests as silent mode in "${L/1e3}" seconds!`)),S.length}async function El(t,e,r){let{initializer:n}=await l(t,On),i=n.identifiers.filter(({name:o})=>!r.getValue("identifierNames",o)&&!pr.includes(o)),s=i.length===0?{}:await _inquirer2.default.prompt(i.map(({name:o})=>{let p=Tt(e,o,!1);return{name:o,message:`Choose the column that will be used to map in the identifier: ${o}`,type:"list",default:p[0],choices:p}}));return await Promise.all(Object.entries(s).map(([o,p])=>r.setValue(p,"identifierNames",o))),{...r.getValue("identifierNames"),...s}}async function _v({requestActions:t,cancellationTitle:e,auth:r,requestIds:n,silentModeBefore:i,createdAtBefore:s,createdAtAfter:o,statuses:p=[_privacytypes.RequestStatus.Compiling,_privacytypes.RequestStatus.RequestMade,_privacytypes.RequestStatus.Delayed,_privacytypes.RequestStatus.Approving,_privacytypes.RequestStatus.Secondary,_privacytypes.RequestStatus.Enriching,_privacytypes.RequestStatus.Waiting,_privacytypes.RequestStatus.SecondaryApproving],concurrency:c=50,transcendUrl:u=_chunkXXFLFF7Qcjs.r}){let m=Z(u,r),d=new Date().getTime(),f=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),g;if(e){let C=(await gt(m,e)).find(O=>O.title===e);if(!C)throw new Error(`Failed to find a template with title: "${e}"`);g=C}let y=await le(m,{actions:t,createdAtBefore:s,createdAtAfter:o,statuses:p,requestIds:n});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Canceling "${y.length}" requests${g?` Using template: ${g.title}`:""}.`));let S=0;f.start(y.length,0),await _bluebird.map.call(void 0, y,async L=>{i&&new Date(i)>new Date(L.createdAt)&&await l(m,St,{input:{id:L.id,isSilent:!0}}),await l(m,Ao,{input:{requestId:L.id,...g?{subject:`Re: ${g.subject.defaultMessage}`,template:g.template.defaultMessage}:{}}}),S+=1,f.update(S)},{concurrency:c}),f.stop();let I=new Date().getTime()-d;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully canceled ${S} requests in "${I/1e3}" seconds!`)),y.length}async function wl(t,e,r,n){let i=n.filter(({name:o})=>!r.getValue("attributeNames",o)),s=i.length===0?{}:await _inquirer2.default.prompt(i.map(({name:o})=>{let p=Tt(e,o,!1);return{name:o,message:`Choose the column that will be used to map in the attribute: ${o}`,type:"list",default:p[0],choices:p}}));return await Promise.all(Object.entries(s).map(([o,p])=>r.setValue(p,"attributeNames",o))),{...r.getValue("attributeNames"),...s}}var $l=/{\\"message\\":\\"(.+?)\\",/;function Or(t){return $l.test(t)?$l.exec(t)[1]:null}var _persistedstate = require('@transcend-io/persisted-state');async function aL({cacheFilepath:t,requestReceiptFolder:e,file:r,auth:n,sombraAuth:i,concurrency:s=100,defaultPhoneCountryCode:o="1",transcendUrl:p=_chunkXXFLFF7Qcjs.r,attributes:c=[],emailIsVerified:u=!0,skipFilterStep:m=!1,skipSendingReceipt:d=!0,isTest:f=!1,isSilent:g=!0,debug:y=!1,dryRun:S=!1}){let R=new Date().getTime(),I=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),L=La(c),C=new (0, _persistedstate.PersistedState)(t,wa,{columnNames:{},requestTypeToRequestAction:{},subjectTypeToSubjectName:{},languageToLocale:{},statusToRequestStatus:{},identifierNames:{},attributeNames:{},regionToCountrySubDivision:{},regionToCountry:{}}),O=_path.join.call(void 0, e,`tr-request-upload-${new Date().toISOString()}-${r.split("/").pop()}`.replace(".csv",".json")),H=new (0, _persistedstate.PersistedState)(O,$a,{successfulRequests:[],duplicateRequests:[],failingRequests:[]}),K=await nt(p,n,i),se=_a(r,Xt.record(Xt.string,Xt.string)),J=_chunkXXFLFF7Qcjs.j.call(void 0, se.map(Se=>Object.keys(Se)).flat());if(se.length===0)throw new Error("No Requests found in list! Ensure the first row of the CSV is a header and the rest are requests.");if(y){let Se=se[0];_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`First request: ${JSON.stringify(Se,null,2)}`))}let me=m?se:await Ga(se),ce=Z(p,n),X=await Fa(ce),Ae=await ll(J,C),Ie=await El(ce,J,C),pe=await wl(ce,J,C,X);await cl(ce,me,{state:C,columnNameMap:Ae});let de=ul(me,C,{defaultPhoneCountryCode:o,columnNameMap:Ae,identifierNameMap:Ie,attributeNameMap:pe,requestAttributeKeys:X});y||I.start(de.length,0);let we=0;await _bluebird.map.call(void 0, de,async([Se,ne],ue)=>{let Ee=y?`email:${ne.email} | coreIdentifier:${ne.coreIdentifier}`:`row:${ue.toString()}`;if(y&&_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`[${ue+1}/${de.length}] Importing: ${JSON.stringify(ne,null,2)}`)),S){_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Bailing out on dry run because dryRun is set"));return}try{let A=await Al(K,ne,{details:`Uploaded by Transcend Cli: "tr-request-upload" : ${JSON.stringify(Se,null,2)}`,isTest:f,emailIsVerified:u,skipSendingReceipt:d,isSilent:g,additionalAttributes:L});y&&(_chunkZUNVPK23cjs.a.info(_colors2.default.green(`[${ue+1}/${de.length}] Successfully submitted the test data subject request: "${Ee}"`)),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`[${ue+1}/${de.length}] View it at: "${A.link}"`)));let G=H.getValue("successfulRequests");G.push({id:A.id,link:A.link,rowIndex:ue,coreIdentifier:A.coreIdentifier,attemptedAt:new Date().toISOString()}),await H.setValue(G,"successfulRequests")}catch(A){let G=`${A.message} - ${JSON.stringify(_optionalChain([A, 'access', _112 => _112.response, 'optionalAccess', _113 => _113.body]),null,2)}`,fe=Or(G);if(fe==="Client error: You have already made this request."){y&&_chunkZUNVPK23cjs.a.info(_colors2.default.yellow(`[${ue+1}/${de.length}] Skipping request as it is a duplicate`));let ge=H.getValue("duplicateRequests");ge.push({coreIdentifier:ne.coreIdentifier,rowIndex:ue,attemptedAt:new Date().toISOString()}),await H.setValue(ge,"duplicateRequests")}else{let ge=H.getValue("failingRequests");ge.push({...ne,rowIndex:ue,error:fe||G,attemptedAt:new Date().toISOString()}),await H.setValue(ge,"failingRequests"),y&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(fe||G)),_chunkZUNVPK23cjs.a.error(_colors2.default.red(`[${ue+1}/${de.length}] Failed to submit request for: "${Ee}"`)))}}we+=1,y||I.update(we)},{concurrency:s}),I.stop();let Ze=new Date().getTime()-R;_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Completed upload in "${Ze/1e3}" seconds.`)),H.getValue("duplicateRequests").length>0&&_chunkZUNVPK23cjs.a.info(_colors2.default.yellow(`Encountered "${H.getValue("duplicateRequests").length}" duplicate requests. See "${O}" to review the core identifiers for these requests.`)),H.getValue("failingRequests").length>0&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Encountered "${H.getValue("failingRequests").length}" errors. See "${O}" to review the error messages and inputs.`)),process.exit(1))}async function vl(t,e,{sendEmailReceipt:r=!1,skipWaitingPeriod:n=!1,emailIsVerified:i=!0,requestIdentifiers:s=[]}={}){let o=await t.post("v1/data-subject-request",{json:{type:e.type,subject:{coreIdentifier:e.coreIdentifier,email:e.email,emailIsVerified:i,...s.length>0?{attestedExtraIdentifiers:_typeutils.apply.call(void 0, _chunkXXFLFF7Qcjs.d.call(void 0, s.filter(c=>!(c.name==="email"&&c.value===e.email)&&!pr.includes(c.name)).map(c=>({...c,type:Object.values(_privacytypes.IdentifierType).includes(c.name)?c.name:_privacytypes.IdentifierType.Custom})),"type"),(c,u)=>c.map(({name:m,value:d})=>({...u===_privacytypes.IdentifierType.Custom?{name:m}:{},value:d})))}:{}},requestId:e.id,subjectType:e.subjectType,isSilent:e.isSilent,isTest:e.isTest,locale:e.locale,skipWaitingPeriod:n,createdAt:e.createdAt,details:`Restarted by Transcend cli: "tr-request-restart" - ${e.details}`,skipSendingReceipt:!r}}).json(),{request:p}=_typeutils.decodeCodec.call(void 0, ql.type({request:dn}),o);return p}var tf=Ye.intersection([lr,Ye.type({error:Ye.string})]),rf=Ye.type({restartedRequests:Ye.array(lr),failingRequests:Ye.array(tf)});async function wL({requestReceiptFolder:t,auth:e,sombraAuth:r,requestActions:n,requestStatuses:i,createdAtBefore:s,createdAtAfter:o,transcendUrl:p=_chunkXXFLFF7Qcjs.r,requestIds:c=[],createdAt:u=new Date,silentModeBefore:m,sendEmailReceipt:d=!1,emailIsVerified:f=!0,copyIdentifiers:g=!1,skipWaitingPeriod:y=!1,concurrency:S=20}){let R=new Date().getTime(),I=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),L=_path.join.call(void 0, t,`tr-request-restart-${new Date().toISOString()}.json`),C=new (0, _persistedstate.PersistedState)(L,rf,{restartedRequests:[],failingRequests:[]}),O=await nt(p,e,r),H=Z(p,e),se=(await le(H,{requestIds:c,actions:n,statuses:i,createdAtBefore:s,createdAtAfter:o})).filter(X=>new Date(X.createdAt)<u);if(_chunkZUNVPK23cjs.a.info(`Found ${se.length} requests to restart`),g&&_chunkZUNVPK23cjs.a.info("copyIdentifiers detected - All Identifiers will be copied."),d&&_chunkZUNVPK23cjs.a.info("sendEmailReceipt detected - Email receipts will be sent."),y&&_chunkZUNVPK23cjs.a.info("skipWaitingPeriod detected - Waiting period will be skipped."),c.length>0&&c.length!==se.length){let X=_chunkXXFLFF7Qcjs.c.call(void 0, c,se.map(({id:Ae})=>Ae));X.length>0&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to find the following requests by ID: ${X.join(",")}.`)),process.exit(1))}let J=0;I.start(se.length,0),await _bluebird.map.call(void 0, se,async(X,Ae)=>{try{let Ie=g?await Pr(H,O,{requestId:X.id}):[],pe=await vl(O,{...X,isSilent:m&&new Date(X.createdAt)<m?!0:X.isSilent},{requestIdentifiers:Ie,skipWaitingPeriod:y,sendEmailReceipt:d,emailIsVerified:f}),de=C.getValue("restartedRequests");de.push({id:pe.id,link:pe.link,rowIndex:Ae,coreIdentifier:pe.coreIdentifier,attemptedAt:new Date().toISOString()}),await C.setValue(de,"restartedRequests")}catch(Ie){let pe=`${Ie.message} - ${JSON.stringify(_optionalChain([Ie, 'access', _114 => _114.response, 'optionalAccess', _115 => _115.body]),null,2)}`,de=Or(pe),we=C.getValue("failingRequests");we.push({id:X.id,link:X.link,rowIndex:Ae,coreIdentifier:X.coreIdentifier,attemptedAt:new Date().toISOString(),error:de||pe}),await C.setValue(we,"failingRequests")}J+=1,I.update(J)},{concurrency:S}),I.stop();let ce=new Date().getTime()-R;_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Completed restarting of requests in "${ce/1e3}" seconds.`)),C.getValue("failingRequests").length>0&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Encountered "${C.getValue("failingRequests").length}" errors. See "${_path.resolve.call(void 0, L)}" to review the error messages and inputs.`)),process.exit(1))}async function OL({enricherIds:t,auth:e,concurrency:r=100,transcendUrl:n=_chunkXXFLFF7Qcjs.r}){let i=Z(n,e),s=new Date().getTime(),o=await le(i,{statuses:[_privacytypes.RequestStatus.Enriching]});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Processing enricher: "${t.join(",")}" fetched "${o.length}" in enriching status.`));let p=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),c=0;p.start(o.length,0);let u=0;await _bluebird.map.call(void 0, o,async f=>{let y=(await Tr(i,{requestId:f.id})).filter(S=>t.includes(S.enricher.id)&&![_privacytypes.RequestEnricherStatus.Resolved,_privacytypes.RequestEnricherStatus.Skipped].includes(S.status));y.length>0&&await _bluebird.mapSeries.call(void 0, y,async S=>{try{await l(i,wo,{requestEnricherId:S.id}),u+=1}catch(R){if(!R.message.includes("Client error: Cannot skip Request enricher because it has already completed"))throw R}}),c+=1,p.update(c)},{concurrency:r}),p.stop();let d=new Date().getTime()-s;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully skipped "${u}" for "${o.length}" requests in "${d/1e3}" seconds!`)),o.length}async function YL({auth:t,requestActions:e=[],createdAtBefore:r,createdAtAfter:n,transcendUrl:i=_chunkXXFLFF7Qcjs.r,requestEnricherStatuses:s=Object.values(_privacytypes.RequestEnricherStatus),requestIds:o=[],enricherId:p,concurrency:c=20}){let u=new Date().getTime(),m=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),d=Z(i,t);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Fetching requests to restart..."));let f=await le(d,{actions:e,statuses:[_privacytypes.RequestStatus.Enriching],createdAtBefore:r,createdAtAfter:n,requestIds:o}),g=0;if(o.length>0&&o.length!==f.length){let I=_chunkXXFLFF7Qcjs.c.call(void 0, o,f.map(({id:L})=>L));I.length>0&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to find the following requests by ID: ${I.join(",")}.`)),process.exit(1))}let y=0;m.start(f.length,0),await _bluebird.map.call(void 0, f,async I=>{let C=(await Tr(d,{requestId:I.id})).filter(O=>O.enricher.id===p&&s.includes(O.status));await _bluebird.map.call(void 0, C,async O=>{await Ip(d,O.id),g+=1}),y+=1,m.update(y)},{concurrency:c}),m.stop();let R=new Date().getTime()-u;_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Completed restarting of ${f.length} requests and ${g} enrichers in "${R/1e3}" seconds.`))}async function ik({requestActions:t,dataSiloId:e,auth:r,concurrency:n=20,transcendUrl:i=_chunkXXFLFF7Qcjs.r}){let s=Z(i,r),o=new Date().getTime(),p=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),c=await le(s,{actions:t,statuses:[_privacytypes.RequestStatus.Compiling,_privacytypes.RequestStatus.Approving]});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Retrying requests for Data Silo: "${e}", restarting "${c.length}" requests.`));let u=0,m=0;p.start(c.length,0),await _bluebird.map.call(void 0, c,async g=>{try{let y=await op(s,{requestId:g.id,dataSiloId:e});await l(s,Vo,{requestDataSiloId:y.id})}catch(y){if(!y.message.includes("Failed to find RequestDataSilo"))throw y;m+=1}u+=1,p.update(u)},{concurrency:n}),p.stop();let f=new Date().getTime()-o;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully notified Transcend in "${f/1e3}" seconds for ${u} requests, ${m} requests were skipped because data silo was not attached to the request!`)),c.length}async function dk({auth:t,sombraAuth:e,actions:r=[],statuses:n=[],identifierSearch:i,pageLimit:s=100,transcendUrl:o=_chunkXXFLFF7Qcjs.r,createdAtBefore:p,skipRequestIdentifiers:c=!1,createdAtAfter:u,isTest:m}){let d=Z(o,t),f=await nt(o,t,e),g="";p&&(g+=` before ${p.toISOString()}`),u&&(g+=`${g?", and":""} after ${u.toISOString()}`),_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`${r.length>0?`Pulling requests of type "${r.join('" , "')}"`:"Pulling all requests"}${g}`));let y=await le(d,{actions:r,text:i,statuses:n,createdAtBefore:p,createdAtAfter:u,isTest:m}),S=c?y.map(I=>({...I,requestIdentifiers:[]})):await _bluebird.map.call(void 0, y,async I=>{let L=await Pr(d,f,{requestId:I.id});return{...I,requestIdentifiers:L}},{concurrency:s});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Pulled ${S.length} requests`));let R=S.map(({attributeValues:I,requestIdentifiers:L,id:C,email:O,type:H,status:K,subjectType:se,details:J,createdAt:me,country:ce,locale:X,origin:Ae,countrySubDivision:Ie,isSilent:pe,isTest:de,coreIdentifier:we,purpose:ke,...Ze})=>({"Request ID":C,"Created At":me,Email:O,"Core Identifier":we,"Request Type":H,"Data Subject Type":se,Status:K,Country:ce,"Country Sub Division":Ie,Details:J,Origin:Ae,"Silent Mode":pe,"Is Test Request":de,Language:X,"Purpose Trigger Name":_optionalChain([ke, 'optionalAccess', _116 => _116.title])||_optionalChain([ke, 'optionalAccess', _117 => _117.name])||"","Purpose Trigger Value":_optionalChain([ke, 'optionalAccess', _118 => _118.consent, 'optionalAccess', _119 => _119.toString, 'call', _120 => _120()])||"",...(_optionalChain([ke, 'optionalAccess', _121 => _121.enrichedPreferences])||[]).reduce((Se,ne)=>{let ue=_optionalChain([ne, 'access', _122 => _122.preferenceTopic, 'optionalAccess', _123 => _123.title, 'access', _124 => _124.defaultMessage])||ne.name;return ue?{...Se,[ue]:ne.selectValues?ne.selectValues.map(Ee=>Ee.name).join(";"):_optionalChain([ne, 'access', _125 => _125.selectValue, 'optionalAccess', _126 => _126.name])||ne.booleanValue}:Se},{}),...Ze,...Object.entries(_chunkXXFLFF7Qcjs.d.call(void 0, I,"attributeKey.name")).reduce((Se,[ne,ue])=>Object.assign(Se,{[ne]:ue.map(({name:Ee})=>Ee).join(",")}),{}),...Object.entries(_chunkXXFLFF7Qcjs.d.call(void 0, L,"name")).reduce((Se,[ne,ue])=>Object.assign(Se,{[ne]:ue.map(({value:Ee})=>Ee).join(",")}),{})}));return{requestsWithRequestIdentifiers:S,requestsFormattedForCsv:R}}async function Tk({dataSiloId:t,auth:e,concurrency:r=50,maxUploadPerChunk:n=5e4,status:i="SKIPPED",transcendUrl:s=_chunkXXFLFF7Qcjs.r,requestStatuses:o=[_privacytypes.RequestStatus.Compiling,_privacytypes.RequestStatus.Secondary]}){let p=Z(s,e),c=new Date().getTime(),u=await np(p,{dataSiloId:t,requestStatuses:o});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Marking ${u} request data silos as completed`));let m=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),d=0;for(m.start(u,0);d<u;){let y=await Zi(p,{dataSiloId:t,requestStatuses:o,limit:n,onProgress:S=>{d+=S/2,m.update(d)}});await _bluebird.map.call(void 0, y,async S=>{try{await l(p,Qo,{requestDataSiloId:S.id,status:i})}catch(R){if(!R.message.includes("Client error: Request must be active:"))throw R}d+=.5,m.update(d)},{concurrency:r})}m.stop();let g=new Date().getTime()-c;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully skipped "${u}" requests in "${g/1e3}" seconds!`)),u}async function vk({requestActions:t,identifierNames:e,auth:r,concurrency:n=20,transcendUrl:i=_chunkXXFLFF7Qcjs.r}){let s=Z(i,r),o=new Date().getTime(),p=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),c=await le(s,{actions:t,statuses:[_privacytypes.RequestStatus.Enriching]});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta("Fetched requests in preflight/enriching state."));let u=0,m=0;p.start(c.length,0),await _bluebird.map.call(void 0, c,async g=>{let S=(await Wa(s,{requestId:g.id})).filter(({isVerifiedAtLeastOnce:R,name:I})=>R===!1&&e.includes(I)).map(({id:R})=>R);S.length>0&&(await l(s,Wo,{input:{requestId:g.id,requestIdentifierIds:S}}),m+=S.length),u+=1,p.update(u)},{concurrency:n}),p.stop();let f=new Date().getTime()-o;return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully cleared out unverified identifiers "${f/1e3}" seconds for ${u} requests, ${m} identifiers were cleared out!`)),c.length}async function g_({message:t}){let{response:e}=await _inquirer2.default.prompt([{name:"response",message:t,type:"confirm"}]);return e}async function y_({message:t}){let{response:e}=await _inquirer2.default.prompt([{name:"response",message:t,type:"text",validate:r=>r.trim().length>0}]);return e}async function h_({defaultValue:t,values:e,message:r}){_inquirer2.default.registerPrompt("autocomplete",_inquirerautocompleteprompt2.default);let{response:n}=await _inquirer2.default.prompt([{name:"response",message:r,type:"autocomplete",default:t,source:(i,s)=>s?e.filter(o=>typeof o=="string"&&It(s,o)):e}]);return n}function S_(t){let e=t.split(",").filter(n=>!!n),r={};return e.forEach(n=>{let[i,s]=n.split(":");if(!i||!s)throw new Error(`Invalid variable: ${n}. Expected format: key:value`);r[i]=s}),r}function Zl(t){let e=t;return _nullishCoalesce(_optionalChain([e, 'optionalAccess', _127 => _127.response, 'optionalAccess', _128 => _128.statusCode]), () => (_optionalChain([e, 'optionalAccess', _129 => _129.response, 'optionalAccess', _130 => _130.status])))}function zl(t){let e=t,r=_optionalChain([e, 'optionalAccess', _131 => _131.response, 'optionalAccess', _132 => _132.body])||_optionalChain([e, 'optionalAccess', _133 => _133.message])||"Unknown error";try{let n=JSON.parse(r),i=n.errors||_optionalChain([n, 'access', _134 => _134.error, 'optionalAccess', _135 => _135.errors])||[_optionalChain([n, 'access', _136 => _136.error, 'optionalAccess', _137 => _137.message])||n.error];r=(Array.isArray(i)?i:[i]).filter(Boolean).join(", ")}catch (e2){}return r}function Nr(t){return new Promise(e=>{setTimeout(()=>e(t),t)})}function E_(t){let e=Math.floor(t.length/2);return[t.slice(0,e),t.slice(e)]}async function x_(t,e,r){let n=0;for(;;)try{return await t()}catch(i){n+=1;let s=Zl(i),o=zl(i);if(!(n<=e.maxAttempts&&e.shouldRetry(s,o)))throw i;r(`Retrying after status=${s} attempt=${n}/${e.maxAttempts} \u2014 ${o}`),await Nr(e.delayMs)}}function q_(t,e){return Object.entries(t).reduce((r,[n,i],s)=>(r[n]=s<e?i:!0,r),{})}var Wl= (_class =class{constructor() { _class.prototype.__init.call(this); }__init() {this.buckets=[]}add(e){let r=Date.now();this.buckets.push({t:r,n:e});let n=r-12e4;for(;this.buckets.length&&this.buckets[0].t<n;)this.buckets.shift()}rate(e){let n=Date.now()-e,i=0;for(let s=this.buckets.length-1;s>=0;s-=1){let o=this.buckets[s];if(o.t<n)break;i+=o.n}return i/(e/1e3)}}, _class);function __(t){try{return t?_fs.readFileSync.call(void 0, t,"utf8"):""}catch (e3){return""}}function U_(t,e){t||(_chunkZUNVPK23cjs.a.error(_colors2.default.red("A --directory must be provided.")),e.process.exit(1));let r=[];try{r=_fs.readdirSync.call(void 0, t).filter(i=>i.endsWith(".parquet")).map(i=>_path.join.call(void 0, t,i)).filter(i=>{try{return _fs.statSync.call(void 0, i).isFile()}catch (e4){return!1}})}catch(n){_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Failed to read directory: ${t}`)),_chunkZUNVPK23cjs.a.error(_colors2.default.red(n.message)),e.process.exit(1)}return r.length===0&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red(`No Parquet files found in directory: ${t}`)),e.process.exit(1)),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Found: ${r.join(", ")} parquet files`)),r}var _nodeapi = require('@duckdb/node-api');async function Z_(t){let{filePath:e,outputDir:r,clearOutputDir:n,onProgress:i}=t,s=r||_path.dirname.call(void 0, e),{name:o}=_path.parse.call(void 0, e),p=_path.join.call(void 0, s,`${o}.csv`);if(_fs.mkdirSync.call(void 0, s,{recursive:!0}),n&&_fs.existsSync.call(void 0, p))try{_fs.rmSync.call(void 0, p,{force:!0})}catch(m){_chunkZUNVPK23cjs.a.warn(_colors2.default.yellow(`Could not remove existing output file ${p}: ${m.message}`))}let c=await _nodeapi.DuckDBInstance.create(":memory:"),u=await c.connect();try{await bf(u,"PRAGMA temp_directory='';");let m=f=>`'${f.replace(/'/g,"''")}'`,d=`
|
|
2990
2990
|
COPY (SELECT * FROM read_parquet(${m(e)}))
|
|
2991
2991
|
TO ${m(p)}
|
|
2992
2992
|
(HEADER, DELIMITER ',', QUOTE '"', ESCAPE '"', NULL '');
|
|
@@ -2998,4 +2998,4 @@ ${J.message}`)),s=!0}y+=1,d.update(y)})},{concurrency:10}),d.stop();let R=new Da
|
|
|
2998
2998
|
`)}function lO(t,e){let n=e.map(i=>Object.values(i)).map(i=>i.map(Fr).join(",")).join(`
|
|
2999
2999
|
`);_fs.appendFileSync.call(void 0, t,`
|
|
3000
3000
|
${n}`)}async function cO(t,e,r=!0){let n=_fs.createWriteStream.call(void 0, t);await new Promise((i,s)=>{try{let o=Mr.write(e,{headers:r,objectMode:!0}).on("error",s);n.on("error",s),n.on("finish",()=>i()),o.pipe(n)}catch(o){s(o)}})}function uO(t){let e=t.lastIndexOf(".");return{baseName:e!==-1?t.substring(0,e):t,extension:e!==-1?t.substring(e):".csv"}}function wf(t,e){let r={};for(let n of e)r[n]=t[n];return r}function $f(t){return new Promise(e=>{t.once("drain",e)})}async function mO(t,e,r=!0){let n;Array.isArray(r)?n=r:r===!0?n=e.length>0?Object.keys(e[0]):[]:n=!1;let i=_fs.createWriteStream.call(void 0, t),s=Mr.format({headers:n||void 0,objectMode:!0}),o=s.pipe(i),p=new Promise((c,u)=>{o.on("finish",()=>c()),o.on("error",u),s.on("error",u),i.on("error",u)});for(let c of e){let u=n?wf(c,n):c;s.write(u)||await $f(s)}return s.end(),await p,[t]}var xf=4,Df=["syntax error","got invalid value","Client error","cannot affect row a second time","GRAPHQL_VALIDATION_FAILED"];async function l(t,e,r,n,i=xf){let s=0;for(;;)try{return await t.request(e,r,n)}catch(o){if(o.message.includes("API key is invalid")&&(_chunkZUNVPK23cjs.a.error(_colors2.default.red("API key is invalid. Please ensure that the key provided to `transcendAuth` has the proper scope and is not expired, and that `transcendUrl` corresponds to the correct backend for your organization.")),process.exit(1)),Df.some(p=>o.message.includes(p)))throw o;if(o.message.startsWith("Client error: Too many requests")){let p=_optionalChain([o, 'access', _139 => _139.response, 'access', _140 => _140.headers, 'optionalAccess', _141 => _141.get, 'call', _142 => _142("x-ratelimit-reset")]),c=p?new Date(p).getTime()-new Date().getTime()+100:1e3*10;_chunkZUNVPK23cjs.a.log(_colors2.default.yellow(`DETECTED RATE LIMIT: ${o.message}. Sleeping for ${c}ms`)),await Nr(c)}if(s>=i)throw o;s+=1,_chunkZUNVPK23cjs.a.log(_colors2.default.yellow(`Retrying failed request (${s/i}): ${o.message}`))}}async function GO(t,{promptRunId:e,promptRunMessages:r=[],...n}){let{addMessagesToPromptRun:{promptRun:i}}=await l(t,is,{input:{...n,...e,promptRunMessages:r.map(({content:s,...o})=>({...o,message:s}))}});return i.id}exports.a = $n; exports.b = vf; exports.c = xn; exports.d = Lf; exports.e = Dn; exports.f = qn; exports.g = kf; exports.h = Gf; exports.i = vn; exports.j = Ff; exports.k = Ln; exports.l = Vr; exports.m = kn; exports.n = _n; exports.o = On; exports.p = Gn; exports.q = Nn; exports.r = Mn; exports.s = Fn; exports.t = Un; exports.u = Bn; exports.v = Qn; exports.w = nr; exports.x = Vn; exports.y = Kn; exports.z = jn; exports.A = Yn; exports.B = Zn; exports.C = zn; exports.D = Wn; exports.E = Hn; exports.F = Jn; exports.G = Xn; exports.H = to; exports.I = ro; exports.J = no; exports.K = oo; exports.L = so; exports.M = ao; exports.N = po; exports.O = lo; exports.P = co; exports.Q = uo; exports.R = mo; exports.S = fo; exports.T = go; exports.U = ho; exports.V = Co; exports.W = So; exports.X = or; exports.Y = Ao; exports.Z = St; exports._ = Io; exports.$ = Po; exports.aa = Eo; exports.ba = Ro; exports.ca = bo; exports.da = wo; exports.ea = Wr; exports.fa = xo; exports.ga = Rg; exports.ha = Do; exports.ia = qo; exports.ja = vo; exports.ka = Lo; exports.la = ko; exports.ma = _o; exports.na = Oo; exports.oa = Go; exports.pa = No; exports.qa = Mo; exports.ra = Fo; exports.sa = Uo; exports.ta = Bo; exports.ua = Hr; exports.va = Qo; exports.wa = Vo; exports.xa = Ko; exports.ya = jo; exports.za = Yo; exports.Aa = Zo; exports.Ba = Wo; exports.Ca = Ho; exports.Da = Jo; exports.Ea = Kg; exports.Fa = es; exports.Ga = rs; exports.Ha = is; exports.Ia = ns; exports.Ja = os; exports.Ka = ss; exports.La = as; exports.Ma = ps; exports.Na = ls; exports.Oa = cs; exports.Pa = us; exports.Qa = ms; exports.Ra = ds; exports.Sa = fs; exports.Ta = gs; exports.Ua = ys; exports.Va = hs; exports.Wa = Cs; exports.Xa = Ss; exports.Ya = As; exports.Za = Is; exports._a = Ts; exports.$a = Ps; exports.ab = Es; exports.bb = Rs; exports.cb = bs; exports.db = ws; exports.eb = $s; exports.fb = xs; exports.gb = Ds; exports.hb = qs; exports.ib = vs; exports.jb = Ls; exports.kb = ks; exports.lb = _s; exports.mb = Os; exports.nb = Gs; exports.ob = Ns; exports.pb = Ms; exports.qb = Fs; exports.rb = Us; exports.sb = Bs; exports.tb = Qs; exports.ub = Ks; exports.vb = js; exports.wb = Ys; exports.xb = Zs; exports.yb = zs; exports.zb = Ws; exports.Ab = Hs; exports.Bb = Js; exports.Cb = Xs; exports.Db = ii; exports.Eb = ea; exports.Fb = ta; exports.Gb = fy; exports.Hb = ra; exports.Ib = ia; exports.Jb = na; exports.Kb = oa; exports.Lb = sa; exports.Mb = aa; exports.Nb = pa; exports.Ob = la; exports.Pb = ca; exports.Qb = ua; exports.Rb = ma; exports.Sb = da; exports.Tb = fa; exports.Ub = ga; exports.Vb = ya; exports.Wb = ha; exports.Xb = Ca; exports.Yb = Sa; exports.Zb = Aa; exports._b = Ia; exports.$b = Ta; exports.ac = Pa; exports.bc = Ea; exports.cc = Y; exports.dc = Kt; exports.ec = ui; exports.fc = pr; exports.gc = At; exports.hc = Ra; exports.ic = ba; exports.jc = wa; exports.kc = lr; exports.lc = $a; exports.mc = It; exports.nc = Tt; exports.oc = mt; exports.pc = mi; exports.qc = va; exports.rc = La; exports.sc = _a; exports.tc = He; exports.uc = Ga; exports.vc = GO; exports.wc = Vc; exports.xc = Z; exports.yc = nt; exports.zc = IC; exports.Ac = RC; exports.Bc = bC; exports.Cc = qC; exports.Dc = cr; exports.Ec = ur; exports.Fc = mr; exports.Gc = dr; exports.Hc = fr; exports.Ic = Na; exports.Jc = Ma; exports.Kc = nS; exports.Lc = Fa; exports.Mc = Wc; exports.Nc = Hc; exports.Oc = Et; exports.Pc = gr; exports.Qc = Qa; exports.Rc = De; exports.Sc = yr; exports.Tc = Jc; exports.Uc = IS; exports.Vc = Va; exports.Wc = Ei; exports.Xc = hr; exports.Yc = Rt; exports.Zc = ja; exports._c = jt; exports.$c = bt; exports.ad = Cr; exports.bd = Le; exports.cd = Ya; exports.dd = Za; exports.ed = Sr; exports.fd = Ar; exports.gd = Ir; exports.hd = za; exports.id = Tr; exports.jd = Wa; exports.kd = ou; exports.ld = Pr; exports.md = mu; exports.nd = GA; exports.od = le; exports.pd = br; exports.qd = VA; exports.rd = wr; exports.sd = fu; exports.td = $r; exports.ud = gu; exports.vd = iI; exports.wd = Yt; exports.xd = ep; exports.yd = tp; exports.zd = rp; exports.Ad = xr; exports.Bd = Dr; exports.Cd = $t; exports.Dd = wI; exports.Ed = qI; exports.Fd = np; exports.Gd = Zi; exports.Hd = op; exports.Id = NI; exports.Jd = BI; exports.Kd = jI; exports.Ld = YI; exports.Md = HI; exports.Nd = JI; exports.Od = Iu; exports.Pd = Tu; exports.Qd = ap; exports.Rd = Pu; exports.Sd = Eu; exports.Td = zi; exports.Ud = $u; exports.Vd = Wi; exports.Wd = cp; exports.Xd = Du; exports.Yd = qu; exports.Zd = up; exports._d = mp; exports.$d = dp; exports.ae = Xi; exports.be = gp; exports.ce = gt; exports.de = yp; exports.ee = zt; exports.fe = Cp; exports.ge = Sp; exports.he = Gu; exports.ie = qP; exports.je = _P; exports.ke = Ip; exports.le = BP; exports.me = Tp; exports.ne = Uu; exports.oe = Bu; exports.pe = Ep; exports.qe = Qu; exports.re = Vu; exports.se = wp; exports.te = Yu; exports.ue = Zu; exports.ve = $p; exports.we = Wu; exports.xe = Hu; exports.ye = xp; exports.ze = Xu; exports.Ae = em; exports.Be = Dp; exports.Ce = qp; exports.De = rm; exports.Ee = im; exports.Fe = Lp; exports.Ge = am; exports.He = pm; exports.Ie = Op; exports.Je = mm; exports.Ke = dm; exports.Le = Np; exports.Me = hm; exports.Ne = Cm; exports.Oe = QR; exports.Pe = Om; exports.Qe = Wp; exports.Re = Im; exports.Se = Fp; exports.Te = zm; exports.Ue = Wm; exports.Ve = nl; exports.We = Gm; exports.Xe = Nm; exports.Ye = el; exports.Ze = Qp; exports._e = Mp; exports.$e = vm; exports.af = jp; exports.bf = xm; exports.cf = Kp; exports.df = Yp; exports.ef = sl; exports.ff = Jm; exports.gf = Xm; exports.hf = ol; exports.if = Rm; exports.jf = bm; exports.kf = Vp; exports.lf = jm; exports.mf = Ym; exports.nf = il; exports.of = ex; exports.pf = ZD; exports.qf = ll; exports.rf = cl; exports.sf = Id; exports.tf = Pq; exports.uf = Td; exports.vf = ul; exports.wf = fl; exports.xf = wd; exports.yf = $d; exports.zf = gl; exports.Af = yl; exports.Bf = Yq; exports.Cf = dn; exports.Df = Al; exports.Ef = pv; exports.Ff = hv; exports.Gf = El; exports.Hf = _v; exports.If = wl; exports.Jf = Or; exports.Kf = aL; exports.Lf = vl; exports.Mf = wL; exports.Nf = OL; exports.Of = YL; exports.Pf = ik; exports.Qf = dk; exports.Rf = Tk; exports.Sf = vk; exports.Tf = g_; exports.Uf = y_; exports.Vf = h_; exports.Wf = S_; exports.Xf = Zl; exports.Yf = zl; exports.Zf = Nr; exports._f = E_; exports.$f = x_; exports.ag = q_; exports.bg = Wl; exports.cg = __; exports.dg = U_; exports.eg = Z_; exports.fg = W_; exports.gg = H_; exports.hg = J_; exports.ig = X_; exports.jg = eO; exports.kg = tO; exports.lg = rO; exports.mg = iO; exports.ng = sO; exports.og = aO; exports.pg = pO; exports.qg = lO; exports.rg = cO; exports.sg = uO; exports.tg = mO; exports.ug = l; exports.vg = Bi; exports.wg = ip; exports.xg = Z$;
|
|
3001
|
-
//# sourceMappingURL=chunk-
|
|
3001
|
+
//# sourceMappingURL=chunk-55B57ZAY.cjs.map
|