@transcend-io/cli 10.5.5 → 10.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{app-Ba_-DZvM.mjs → app-BqpEdY_i.mjs} +17 -17
- package/dist/{app-Ba_-DZvM.mjs.map → app-BqpEdY_i.mjs.map} +1 -1
- package/dist/{approvePrivacyRequests-BMxJtVip.mjs → approvePrivacyRequests-BbiLF33j.mjs} +2 -2
- package/dist/{approvePrivacyRequests-BMxJtVip.mjs.map → approvePrivacyRequests-BbiLF33j.mjs.map} +1 -1
- package/dist/bin/bash-complete.mjs +1 -1
- package/dist/bin/cli.mjs +1 -1
- package/dist/bin/deprecated-command.mjs +1 -1
- package/dist/{buildXdiSyncEndpoint-CoMnCoOr.mjs → buildXdiSyncEndpoint-Crym6E35.mjs} +2 -2
- package/dist/{buildXdiSyncEndpoint-CoMnCoOr.mjs.map → buildXdiSyncEndpoint-Crym6E35.mjs.map} +1 -1
- package/dist/{bulkRestartRequests-BCjIRquE.mjs → bulkRestartRequests-C4gD5zJo.mjs} +2 -2
- package/dist/{bulkRestartRequests-BCjIRquE.mjs.map → bulkRestartRequests-C4gD5zJo.mjs.map} +1 -1
- package/dist/{bulkRetryEnrichers-B04E_eQ1.mjs → bulkRetryEnrichers-7b8ozxGC.mjs} +2 -2
- package/dist/{bulkRetryEnrichers-B04E_eQ1.mjs.map → bulkRetryEnrichers-7b8ozxGC.mjs.map} +1 -1
- package/dist/{cancelPrivacyRequests-BHVJdn5R.mjs → cancelPrivacyRequests-BHlMNcL2.mjs} +2 -2
- package/dist/{cancelPrivacyRequests-BHVJdn5R.mjs.map → cancelPrivacyRequests-BHlMNcL2.mjs.map} +1 -1
- package/dist/codecs-Dnq-rEcB.mjs +2 -0
- package/dist/codecs-Dnq-rEcB.mjs.map +1 -0
- package/dist/{command-Boc-4Yl2.mjs → command-DFo4Yw8R.mjs} +2 -2
- package/dist/{command-Boc-4Yl2.mjs.map → command-DFo4Yw8R.mjs.map} +1 -1
- package/dist/{constants-CeIAxxnY.mjs → constants-BdSIZSI2.mjs} +2 -2
- package/dist/{constants-CeIAxxnY.mjs.map → constants-BdSIZSI2.mjs.map} +1 -1
- package/dist/{createExtraKeyHandler-CUsI4MJp.mjs → createExtraKeyHandler-AmHwVrGx.mjs} +2 -2
- package/dist/{createExtraKeyHandler-CUsI4MJp.mjs.map → createExtraKeyHandler-AmHwVrGx.mjs.map} +1 -1
- package/dist/{downloadPrivacyRequestFiles-CmXRxhiH.mjs → downloadPrivacyRequestFiles-CYHv1D2D.mjs} +2 -2
- package/dist/{downloadPrivacyRequestFiles-CmXRxhiH.mjs.map → downloadPrivacyRequestFiles-CYHv1D2D.mjs.map} +1 -1
- package/dist/{generateCrossAccountApiKeys-DFPlA4Xq.mjs → generateCrossAccountApiKeys-DyfLtOUz.mjs} +2 -2
- package/dist/{generateCrossAccountApiKeys-DFPlA4Xq.mjs.map → generateCrossAccountApiKeys-DyfLtOUz.mjs.map} +1 -1
- package/dist/{impl-B9k51caj.mjs → impl-B2DlnN7c.mjs} +2 -2
- package/dist/{impl-B9k51caj.mjs.map → impl-B2DlnN7c.mjs.map} +1 -1
- package/dist/{impl-BNlURiXP.mjs → impl-B6J8AZFe.mjs} +2 -2
- package/dist/{impl-BNlURiXP.mjs.map → impl-B6J8AZFe.mjs.map} +1 -1
- package/dist/{impl-oZ2tCI0C.mjs → impl-BBkRnXXO.mjs} +2 -2
- package/dist/{impl-oZ2tCI0C.mjs.map → impl-BBkRnXXO.mjs.map} +1 -1
- package/dist/{impl-DAkC-ISt.mjs → impl-BNlM4XS8.mjs} +2 -2
- package/dist/{impl-DAkC-ISt.mjs.map → impl-BNlM4XS8.mjs.map} +1 -1
- package/dist/{impl-D08NgYQt.mjs → impl-BTzJZ87D.mjs} +2 -2
- package/dist/{impl-D08NgYQt.mjs.map → impl-BTzJZ87D.mjs.map} +1 -1
- package/dist/{impl-B6G1l077.mjs → impl-B_CFb_tI.mjs} +2 -2
- package/dist/{impl-B6G1l077.mjs.map → impl-B_CFb_tI.mjs.map} +1 -1
- package/dist/{impl-C0aNrkWB.mjs → impl-B_d5bbX9.mjs} +2 -2
- package/dist/{impl-C0aNrkWB.mjs.map → impl-B_d5bbX9.mjs.map} +1 -1
- package/dist/{impl-CFYxHmDT.mjs → impl-BhNnDVWM.mjs} +2 -2
- package/dist/{impl-CFYxHmDT.mjs.map → impl-BhNnDVWM.mjs.map} +1 -1
- package/dist/{impl-Cur6XyjJ.mjs → impl-Bjw_g9HH.mjs} +2 -2
- package/dist/{impl-Cur6XyjJ.mjs.map → impl-Bjw_g9HH.mjs.map} +1 -1
- package/dist/{impl-BPzWGw_C.mjs → impl-Bl16ocZt.mjs} +2 -2
- package/dist/{impl-BPzWGw_C.mjs.map → impl-Bl16ocZt.mjs.map} +1 -1
- package/dist/{impl-DM9-TSso.mjs → impl-BmNFmqwQ.mjs} +2 -2
- package/dist/{impl-DM9-TSso.mjs.map → impl-BmNFmqwQ.mjs.map} +1 -1
- package/dist/{impl-sjVATWtP.mjs → impl-BnI9fFMb.mjs} +2 -2
- package/dist/{impl-sjVATWtP.mjs.map → impl-BnI9fFMb.mjs.map} +1 -1
- package/dist/{impl-DOOUxjYh.mjs → impl-Bs54Sjas.mjs} +2 -2
- package/dist/{impl-DOOUxjYh.mjs.map → impl-Bs54Sjas.mjs.map} +1 -1
- package/dist/{impl-Df2PHYFL.mjs → impl-BxufzUhr.mjs} +2 -2
- package/dist/{impl-Df2PHYFL.mjs.map → impl-BxufzUhr.mjs.map} +1 -1
- package/dist/{impl-DCC9QQh4.mjs → impl-C08anQRz.mjs} +2 -2
- package/dist/{impl-DCC9QQh4.mjs.map → impl-C08anQRz.mjs.map} +1 -1
- package/dist/{impl-D_0xeTKV.mjs → impl-C2pyM_Cu.mjs} +2 -2
- package/dist/{impl-D_0xeTKV.mjs.map → impl-C2pyM_Cu.mjs.map} +1 -1
- package/dist/{impl-VVA4YqAf.mjs → impl-C7XGfhWy.mjs} +2 -2
- package/dist/{impl-VVA4YqAf.mjs.map → impl-C7XGfhWy.mjs.map} +1 -1
- package/dist/{impl-DSh-TbvV.mjs → impl-CEUIa3q2.mjs} +2 -2
- package/dist/{impl-DSh-TbvV.mjs.map → impl-CEUIa3q2.mjs.map} +1 -1
- package/dist/{impl-Cik8JUMN.mjs → impl-CHVpShd9.mjs} +2 -2
- package/dist/{impl-Cik8JUMN.mjs.map → impl-CHVpShd9.mjs.map} +1 -1
- package/dist/{impl-YtstnAO6.mjs → impl-CKaLZ0Jg.mjs} +2 -2
- package/dist/{impl-YtstnAO6.mjs.map → impl-CKaLZ0Jg.mjs.map} +1 -1
- package/dist/{impl-DzLb8cTW.mjs → impl-CQQM5Tb8.mjs} +2 -2
- package/dist/{impl-DzLb8cTW.mjs.map → impl-CQQM5Tb8.mjs.map} +1 -1
- package/dist/{impl-BF43axuw.mjs → impl-CRCh454R.mjs} +2 -2
- package/dist/{impl-BF43axuw.mjs.map → impl-CRCh454R.mjs.map} +1 -1
- package/dist/{impl-CluXp6cM.mjs → impl-CinadBeB.mjs} +2 -2
- package/dist/{impl-CluXp6cM.mjs.map → impl-CinadBeB.mjs.map} +1 -1
- package/dist/{impl-DrrdL07c.mjs → impl-CrdcMZcO.mjs} +2 -2
- package/dist/{impl-DrrdL07c.mjs.map → impl-CrdcMZcO.mjs.map} +1 -1
- package/dist/{impl-B_sOmwwO.mjs → impl-DElidOYf.mjs} +2 -2
- package/dist/{impl-B_sOmwwO.mjs.map → impl-DElidOYf.mjs.map} +1 -1
- package/dist/{impl-BfRfETav.mjs → impl-DO2R4Zmw.mjs} +2 -2
- package/dist/{impl-BfRfETav.mjs.map → impl-DO2R4Zmw.mjs.map} +1 -1
- package/dist/{impl-DFQi40lD.mjs → impl-DP8b1Qt9.mjs} +2 -2
- package/dist/{impl-DFQi40lD.mjs.map → impl-DP8b1Qt9.mjs.map} +1 -1
- package/dist/{impl-BVW11QMd.mjs → impl-DPba0Bxa.mjs} +2 -2
- package/dist/{impl-BVW11QMd.mjs.map → impl-DPba0Bxa.mjs.map} +1 -1
- package/dist/{impl-DXJFzBeT.mjs → impl-DZjaw2J0.mjs} +2 -2
- package/dist/{impl-DXJFzBeT.mjs.map → impl-DZjaw2J0.mjs.map} +1 -1
- package/dist/{impl-BuxT4Cx2.mjs → impl-Dm6ITkBn.mjs} +2 -2
- package/dist/{impl-BuxT4Cx2.mjs.map → impl-Dm6ITkBn.mjs.map} +1 -1
- package/dist/{impl-BhNbz52a.mjs → impl-DmSgvZ0_.mjs} +2 -2
- package/dist/{impl-BhNbz52a.mjs.map → impl-DmSgvZ0_.mjs.map} +1 -1
- package/dist/{impl-BropNAtt.mjs → impl-DrlB3Gm4.mjs} +2 -2
- package/dist/{impl-BropNAtt.mjs.map → impl-DrlB3Gm4.mjs.map} +1 -1
- package/dist/{impl-0SyxIFWL.mjs → impl-GpHrj-__.mjs} +2 -2
- package/dist/{impl-0SyxIFWL.mjs.map → impl-GpHrj-__.mjs.map} +1 -1
- package/dist/{impl-BW3HCdPO.mjs → impl-Xona8YN1.mjs} +2 -2
- package/dist/{impl-BW3HCdPO.mjs.map → impl-Xona8YN1.mjs.map} +1 -1
- package/dist/{impl-OB3mOEa_.mjs → impl-axLG5Qcd.mjs} +2 -2
- package/dist/{impl-OB3mOEa_.mjs.map → impl-axLG5Qcd.mjs.map} +1 -1
- package/dist/{impl-DZh4_ftE.mjs → impl-kKCUQ5RP.mjs} +2 -2
- package/dist/{impl-DZh4_ftE.mjs.map → impl-kKCUQ5RP.mjs.map} +1 -1
- package/dist/{impl-B_H7wl2s.mjs → impl-zTurkFZ1.mjs} +2 -2
- package/dist/{impl-B_H7wl2s.mjs.map → impl-zTurkFZ1.mjs.map} +1 -1
- package/dist/index.d.mts +459 -12
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{markRequestDataSiloIdsCompleted-D3e6FsGA.mjs → markRequestDataSiloIdsCompleted-Dix_6dHL.mjs} +2 -2
- package/dist/{markRequestDataSiloIdsCompleted-D3e6FsGA.mjs.map → markRequestDataSiloIdsCompleted-Dix_6dHL.mjs.map} +1 -1
- package/dist/{markSilentPrivacyRequests-DzgnobYG.mjs → markSilentPrivacyRequests-CDHSup8w.mjs} +2 -2
- package/dist/{markSilentPrivacyRequests-DzgnobYG.mjs.map → markSilentPrivacyRequests-CDHSup8w.mjs.map} +1 -1
- package/dist/{notifyPrivacyRequestsAdditionalTime-BcJ701Ta.mjs → notifyPrivacyRequestsAdditionalTime-DCUKJLfR.mjs} +2 -2
- package/dist/{notifyPrivacyRequestsAdditionalTime-BcJ701Ta.mjs.map → notifyPrivacyRequestsAdditionalTime-DCUKJLfR.mjs.map} +1 -1
- package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-CPY9eRLF.mjs → pullChunkedCustomSiloOutstandingIdentifiers-BLgrmhmd.mjs} +2 -2
- package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-CPY9eRLF.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-BLgrmhmd.mjs.map} +1 -1
- package/dist/{pullManualEnrichmentIdentifiersToCsv-CDCL8Ju4.mjs → pullManualEnrichmentIdentifiersToCsv-Boam7IAS.mjs} +2 -2
- package/dist/{pullManualEnrichmentIdentifiersToCsv-CDCL8Ju4.mjs.map → pullManualEnrichmentIdentifiersToCsv-Boam7IAS.mjs.map} +1 -1
- package/dist/pullTranscendConfiguration-BHP6t_Nq.mjs +58 -0
- package/dist/pullTranscendConfiguration-BHP6t_Nq.mjs.map +1 -0
- package/dist/{pushCronIdentifiersFromCsv-X5f82qIF.mjs → pushCronIdentifiersFromCsv-BKdDUgrt.mjs} +2 -2
- package/dist/{pushCronIdentifiersFromCsv-X5f82qIF.mjs.map → pushCronIdentifiersFromCsv-BKdDUgrt.mjs.map} +1 -1
- package/dist/{pushManualEnrichmentIdentifiersFromCsv-dUpnhCWn.mjs → pushManualEnrichmentIdentifiersFromCsv-ibwgC0Z2.mjs} +2 -2
- package/dist/{pushManualEnrichmentIdentifiersFromCsv-dUpnhCWn.mjs.map → pushManualEnrichmentIdentifiersFromCsv-ibwgC0Z2.mjs.map} +1 -1
- package/dist/{readTranscendYaml-BbnEGgVD.mjs → readTranscendYaml-CGb2UUyM.mjs} +2 -2
- package/dist/{readTranscendYaml-BbnEGgVD.mjs.map → readTranscendYaml-CGb2UUyM.mjs.map} +1 -1
- package/dist/{removeUnverifiedRequestIdentifiers-KDwOif_H.mjs → removeUnverifiedRequestIdentifiers-CCo-6ZHG.mjs} +2 -2
- package/dist/{removeUnverifiedRequestIdentifiers-KDwOif_H.mjs.map → removeUnverifiedRequestIdentifiers-CCo-6ZHG.mjs.map} +1 -1
- package/dist/{retryRequestDataSilos-DDH-GkA6.mjs → retryRequestDataSilos-Bf5N77w_.mjs} +2 -2
- package/dist/{retryRequestDataSilos-DDH-GkA6.mjs.map → retryRequestDataSilos-Bf5N77w_.mjs.map} +1 -1
- package/dist/{skipPreflightJobs-PFFvHaOC.mjs → skipPreflightJobs-Be3J3jpy.mjs} +2 -2
- package/dist/{skipPreflightJobs-PFFvHaOC.mjs.map → skipPreflightJobs-Be3J3jpy.mjs.map} +1 -1
- package/dist/{skipRequestDataSilos-6Pq98znw.mjs → skipRequestDataSilos-DRj6out9.mjs} +2 -2
- package/dist/{skipRequestDataSilos-6Pq98znw.mjs.map → skipRequestDataSilos-DRj6out9.mjs.map} +1 -1
- package/dist/{streamPrivacyRequestsToCsv-Cf9KND_e.mjs → streamPrivacyRequestsToCsv-a082Gx5g.mjs} +2 -2
- package/dist/{streamPrivacyRequestsToCsv-Cf9KND_e.mjs.map → streamPrivacyRequestsToCsv-a082Gx5g.mjs.map} +1 -1
- package/dist/{updateConsentManagerVersionToLatest-DIDPQXSc.mjs → updateConsentManagerVersionToLatest-B_HqBFUb.mjs} +2 -2
- package/dist/{updateConsentManagerVersionToLatest-DIDPQXSc.mjs.map → updateConsentManagerVersionToLatest-B_HqBFUb.mjs.map} +1 -1
- package/dist/{uploadConsents-B4PwgLpU.mjs → uploadConsents-DB2S0uTr.mjs} +2 -2
- package/dist/{uploadConsents-B4PwgLpU.mjs.map → uploadConsents-DB2S0uTr.mjs.map} +1 -1
- package/dist/{uploadCookiesFromCsv-CQdJEOvo.mjs → uploadCookiesFromCsv-B_T98E-X.mjs} +2 -2
- package/dist/{uploadCookiesFromCsv-CQdJEOvo.mjs.map → uploadCookiesFromCsv-B_T98E-X.mjs.map} +1 -1
- package/dist/{uploadDataFlowsFromCsv-COJoB65k.mjs → uploadDataFlowsFromCsv-Clt1mhIJ.mjs} +2 -2
- package/dist/{uploadDataFlowsFromCsv-COJoB65k.mjs.map → uploadDataFlowsFromCsv-Clt1mhIJ.mjs.map} +1 -1
- package/dist/{uploadPrivacyRequestsFromCsv-CFdjDd4L.mjs → uploadPrivacyRequestsFromCsv-CVWtM97j.mjs} +2 -2
- package/dist/{uploadPrivacyRequestsFromCsv-CFdjDd4L.mjs.map → uploadPrivacyRequestsFromCsv-CVWtM97j.mjs.map} +1 -1
- package/dist/{validateTranscendAuth-BHw0WQu1.mjs → validateTranscendAuth-DJ8qHb9B.mjs} +2 -2
- package/dist/{validateTranscendAuth-BHw0WQu1.mjs.map → validateTranscendAuth-DJ8qHb9B.mjs.map} +1 -1
- package/package.json +4 -4
- package/dist/codecs-B2mV72Wn.mjs +0 -2
- package/dist/codecs-B2mV72Wn.mjs.map +0 -1
- package/dist/pullTranscendConfiguration-D_znkqJz.mjs +0 -58
- package/dist/pullTranscendConfiguration-D_znkqJz.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,i as t,n,o as r,r as i,t as a}from"./enums-CyFTrzXY.mjs";import{a as o,c as s,d as c,f as l,h as u,i as d,l as f,m as p,n as m,o as h,p as g,r as _,s as v,t as y,u as b}from"./constants-CeIAxxnY.mjs";import{t as x}from"./logger-Bj782ZYD.mjs";import{$ as S,A as ee,B as te,C as ne,D as re,E as ie,F as ae,G as oe,H as se,I as ce,J as le,K as ue,L as de,M as fe,N as pe,O as me,P as he,Q as ge,R as _e,S as ve,T as ye,U as be,V as xe,W as C,X as w,Y as T,Z as E,_ as D,_t as O,a as k,at as A,b as j,bt as M,c as Se,ct as Ce,d as we,dt as Te,et as Ee,f as De,ft as Oe,g as ke,gt as Ae,h as je,ht as Me,i as Ne,it as Pe,j as Fe,k as Ie,l as Le,lt as Re,m as ze,mt as Be,n as Ve,nt as He,o as Ue,ot as We,p as Ge,pt as Ke,q as qe,r as Je,rt as Ye,s as Xe,st as Ze,t as Qe,tt as $e,u as et,ut as tt,v as nt,vt as rt,w as it,x as at,xt as ot,y as st,yt as ct,z as lt}from"./codecs-B2mV72Wn.mjs";import{a as ut,i as dt,n as ft,r as pt,t as mt}from"./readTranscendYaml-BbnEGgVD.mjs";import{a as ht,i as gt,n as _t,r as vt,t as yt}from"./parseVariablesFromString-BeKOGw5n.mjs";import{a as bt,c as xt,i as St,l as Ct,n as wt,o as Tt,r as Et,s as Dt,t as Ot,u as kt}from"./constants-CLxPXlJM.mjs";import{i as At,n as jt,r as Mt,t as Nt}from"./parseAttributesFromString-q4-59nEN.mjs";import{a as Pt,c as Ft,d as It,f as Lt,i as Rt,l as zt,n as Bt,o as Vt,r as Ht,s as Ut,t as Wt,u as Gt}from"./uploadPrivacyRequestsFromCsv-CFdjDd4L.mjs";import{t as Kt}from"./readCsv-C4TyEs-r.mjs";import{n as qt,t as Jt}from"./pullUnstructuredSubDataPointRecommendations-D0z-vPgq.mjs";import{a as Yt,i as Xt,n as Zt,o as Qt,r as $t,t as en}from"./request-DfkRPQFr.mjs";import{i as tn,n as nn,r as rn,t as an}from"./pullTranscendConfiguration-D_znkqJz.mjs";import{i as on,n as sn,r as N,t as cn}from"./fetchAllRequests-CHHdyb4Q.mjs";import{a as ln,i as un,n as dn,r as fn,t as pn}from"./pullChunkedCustomSiloOutstandingIdentifiers-CPY9eRLF.mjs";import{n as mn,r as hn,t as gn}from"./syncCodePackages-CAk_Hjyl.mjs";import{t as _n}from"./markSilentPrivacyRequests-DzgnobYG.mjs";import{a as vn,i as yn,n as bn,o as xn,r as Sn,t as Cn}from"./downloadPrivacyRequestFiles-CmXRxhiH.mjs";import{n as wn,r as Tn,t as En}from"./extractClientError-i-Tw_az7.mjs";import{t as Dn}from"./approvePrivacyRequests-BMxJtVip.mjs";import{t as On}from"./notifyPrivacyRequestsAdditionalTime-BcJ701Ta.mjs";import{t as kn}from"./cancelPrivacyRequests-BHVJdn5R.mjs";import{n as An,t as jn}from"./bulkRestartRequests-BCjIRquE.mjs";import{t as Mn}from"./skipPreflightJobs-PFFvHaOC.mjs";import{t as Nn}from"./bulkRetryEnrichers-B04E_eQ1.mjs";import{t as Pn}from"./retryRequestDataSilos-DDH-GkA6.mjs";import{n as P,r as F,t as Fn}from"./streamPrivacyRequestsToCsv-Cf9KND_e.mjs";import{n as In,r as Ln,t as Rn}from"./inquirer-B4iEodLy.mjs";import{t as zn}from"./collectParquetFilesOrExit-BJiAyaQ5.mjs";import{t as Bn}from"./collectCsvFilesOrExit-CbtyKAzu.mjs";import{t as Vn}from"./parquetToCsvOneFile-B84XXInh.mjs";import{a as Hn,i as Un,n as Wn,o as Gn,r as Kn,s as qn,t as Jn}from"./writeCsv-C4pjXGsD.mjs";import{t as Yn}from"./skipRequestDataSilos-6Pq98znw.mjs";import{t as Xn}from"./removeUnverifiedRequestIdentifiers-KDwOif_H.mjs";import{t as Zn}from"./updateConsentManagerVersionToLatest-DIDPQXSc.mjs";import{t as Qn}from"./uploadDataFlowsFromCsv-COJoB65k.mjs";import{t as $n}from"./uploadCookiesFromCsv-CQdJEOvo.mjs";import{t as er}from"./pullConsentManagerMetrics-zKgjc3Ap.mjs";import{n as tr,r as nr,t as rr}from"./buildXdiSyncEndpoint-CoMnCoOr.mjs";import{t as ir}from"./consentManagersToBusinessEntities-BdKDganK.mjs";import{i as ar,n as or,r as sr,t as cr}from"./uploadConsents-B4PwgLpU.mjs";import{n as lr,r as ur,t as dr}from"./pushCronIdentifiersFromCsv-X5f82qIF.mjs";import{t as fr}from"./markRequestDataSiloIdsCompleted-D3e6FsGA.mjs";import{t as pr}from"./generateCrossAccountApiKeys-DFPlA4Xq.mjs";import{t as mr}from"./validateTranscendAuth-BHw0WQu1.mjs";import{t as hr}from"./listFiles-D2wMHnEr.mjs";import{t as gr}from"./pullAllDatapoints-Bbmky50p.mjs";import{t as _r}from"./pullManualEnrichmentIdentifiersToCsv-CDCL8Ju4.mjs";import{n as vr,r as yr,t as br}from"./pushManualEnrichmentIdentifiersFromCsv-dUpnhCWn.mjs";import{ChatCompletionRole as I,PromptRunProductArea as L,PromptStatus as R,QueueStatus as z}from"@transcend-io/privacy-types";import{chunk as B,difference as xr,groupBy as Sr,keyBy as V,uniq as Cr}from"lodash-es";import{apply as wr,decodeCodec as H,getValues as Tr}from"@transcend-io/type-utils";import{readFileSync as Er,readdirSync as Dr,statSync as Or}from"node:fs";import{join as kr}from"node:path";import U from"colors";import{UPDATE_OR_CREATE_COOKIES as Ar,buildTranscendGraphQLClient as W,createSombraGotInstance as jr,fetchAllAgentFiles as Mr,fetchAllAgents as G,fetchAllLargeLanguageModels as Nr,fetchAllPromptThreads as Pr,fetchAllRequestIdentifiers as Fr,fetchConsentManagerId as Ir,fetchPromptsWithVariables as Lr,makeGraphQLRequest as Rr,reportPromptRun as K,validateSombraVersion as q}from"@transcend-io/sdk";import{map as J,mapSeries as Y}from"@transcend-io/utils";import{createHandlebarsWithHelpers as X}from"@transcend-io/handlebars-utils";import{execSync as Z}from"child_process";import zr from"fast-glob";async function Q(e,t){let n=await Ir(e,{logger:x});await Y(B(t,100),async t=>{await Rr(e,Ar,{variables:{airgapBundleId:n,cookies:t.map(e=>({name:e.name,trackingPurposes:e.trackingPurposes&&e.trackingPurposes.length>0?e.trackingPurposes:void 0,description:e.description,service:e.service,status:e.status,attributes:e.attributes,isRegex:e.isRegex}))},logger:x})})}async function Br(e,t){let n=!1;x.info(U.magenta(`Syncing "${t.length}" cookies...`));let r=t.filter(e=>t.filter(t=>e.name===t.name&&e.isRegex===t.isRegex).length>1);if(r.length>0)throw Error(`Failed to upload cookies as there were non-unique entries found: ${r.map(({name:e})=>e).join(`,`)}`);try{x.info(U.magenta(`Upserting "${t.length}" new cookies...`)),await Q(e,t),x.info(U.green(`Successfully synced ${t.length} cookies!`))}catch(e){n=!0,x.error(U.red(`Failed to create cookies! - ${e.message}`))}return!n}async function Vr({auth:e,sombraAuth:t,actions:n=[],statuses:r=[],identifierSearch:i,pageLimit:a=100,concurrency:s=1,transcendUrl:c=o,createdAtBefore:l,skipRequestIdentifiers:u=!1,createdAtAfter:d,updatedAtBefore:f,updatedAtAfter:p,isTest:m}){let h=W(c,e),g=await jr(c,e,{logger:x,sombraApiKey:t,sombraUrl:process.env.SOMBRA_URL}),_=``;l&&(_+=` before ${l.toISOString()}`),d&&(_+=`${_?`, and`:``} after ${d.toISOString()}`),x.info(U.magenta(`${n.length>0?`Pulling requests of type "${n.join(`" , "`)}"`:`Pulling all requests`}${_}`));let v=s>1&&d&&l,y=v?P(d,l,s):[{createdAtAfter:d,createdAtBefore:l}];v&&x.info(U.magenta(`Splitting date range into ${s} parallel chunks`));let b=(await J(y,e=>N(h,{actions:n,text:i,statuses:r,createdAtBefore:e.createdAtBefore,createdAtAfter:e.createdAtAfter,updatedAtBefore:f,updatedAtAfter:p,isTest:m}),{concurrency:v?s:1})).flat();u||await q(h,{logger:x});let S=u?b.map(e=>({...e,requestIdentifiers:[]})):await J(b,async e=>{let t=await Fr(h,g,{filterBy:{requestId:e.id},skipSombraCheck:!0,logger:x});return{...e,requestIdentifiers:t}},{concurrency:a});return x.info(U.magenta(`Pulled ${S.length} requests`)),{requestsWithRequestIdentifiers:S,requestsFormattedForCsv:S.map(F)}}function Hr(e){try{return e?Er(e,`utf8`):``}catch{return``}}function Ur(e){return Dr(e).filter(t=>Or(kr(e,t)).isDirectory())}function $(e){return RegExp(`<${e}>([\\s\\S]+?)<\\/${e}>`)}function Wr(e){return e}const Gr=e=>{try{return JSON.parse(e)}catch{return e}};var Kr=class{prompts;handlebarsOptions;promptContentMap;largeLanguageModels=[];agentsByName={};agentsByAgentId={};graphQLClient;defaultVariables;variables;handlebars;transcendApiKey;transcendUrl;requireApproval;cacheDuration;lastUpdatedAt;constructor({prompts:e,handlebarsOptions:t={},transcendUrl:n=o,transcendApiKey:r,requireApproval:i=!0,cacheDuration:a,defaultVariables:s={}}){this.prompts=e,this.transcendUrl=n,this.transcendApiKey=r,this.variables=s,this.defaultVariables=s,this.graphQLClient=W(n,typeof r==`object`?r.release():r),this.requireApproval=i,this.cacheDuration=a,this.handlebarsOptions=t,this.handlebars=X(t)}async fetchPromptsAndMetadata(){let e=Tr(this.prompts),t=e.map(({id:e})=>e).filter(e=>!!e),n=e.map(({title:e})=>e).filter(e=>!!e),r=Cr(e.map(({agentNames:e})=>e||[]).flat()),[i,a,o]=await Promise.all([Lr(this.graphQLClient,{logger:x,filterBy:{ids:t,titles:n}}),Nr(this.graphQLClient,{logger:x}),G(this.graphQLClient,{logger:x,filterBy:{names:r}})]);this.agentsByName=V(o,`name`),this.agentsByAgentId=V(o,`agentId`),this.largeLanguageModels=a.filter(e=>e.isTranscendHosted===!1);let s=V(i.prompts,`title`),c=V(i.prompts,`id`);return this.variables={...i.calculatedVariables.reduce((e,t)=>Object.assign(e,{[t.name]:t.data?JSON.parse(t.data):t.data}),{}),...this.defaultVariables},this.handlebars=X({...this.handlebarsOptions,templates:[...this.handlebarsOptions.templates||[],...i.promptPartials.map(e=>({name:e.slug,content:e.content}))]}),this.promptContentMap=wr(this.prompts,({id:e,title:t})=>{let n=e?c[e]:t?s[t]:void 0;if(!n)throw Error(`Failed to find prompt with title: "${t}" and id: "${e}"`);return n}),this.lastUpdatedAt=new Date,i}async getAgentByName(e){let t=this.agentsByName[e];if(t)return t;let[n]=await G(this.graphQLClient,{logger:x,filterBy:{names:[e]}});if(n)return this.agentsByName[n.name]=n,this.agentsByAgentId[n.agentId]=n,n}async getPromptThreadBySlackTs(e){let[t]=await Pr(this.graphQLClient,{logger:x,filterBy:{slackMessageTs:[e]}});return t}async getAgentsByName(e){if(e.length<1)throw Error(`Expected at least one name to be provided`);let{hasCache:t=[],missingCache:n=[]}=Sr(e,e=>this.agentsByName[e]?`hasCache`:`missingCache`),r=t.map(e=>this.agentsByName[e]);if(n.length===0)return r;let i=B(n,50),a=[];return await Y(i,async e=>{let t=await G(this.graphQLClient,{logger:x,filterBy:{names:e}});t.forEach(e=>{this.agentsByName[e.name]=e,this.agentsByAgentId[e.agentId]=e}),a.push(...t)}),[...r,...a]}getAgentFiles(e){return Mr(this.graphQLClient,{logger:x,filterBy:e})}getLargeLanguageModel(e){let t=this.largeLanguageModels.find(t=>typeof e==`string`?t.id===e:t.name===e.name&&t.client===e.client);if(!t)throw Error(`Failed to find model matching: ${typeof e==`string`?e:JSON.stringify(e)}`);return t}async getPromptDefinition(e){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let{promptContentMap:t}=this;if(!t)throw Error(`Expected this.promptContentMap to be defined`);let n=t[e];if(!n)throw Error(`Expected this.promptContentMap[${e}] to be defined`);return n}async compilePrompt(e,t){let n=await this.getPromptDefinition(e),r=this.prompts[e];if(!r)throw Error(`Expected this.prompts[${e}] to be defined`);if(this.requireApproval&&n.status!==R.Approved)throw Error(`Assessment "${n.title}" cannot be used because its in status: "${n.status}"`);if(n.status===R.Rejected)throw Error(`Assessment "${n.title}" cannot be used because it's in status: "${n.status}"`);return H(r.paramCodec,t),this.handlebars.compile(n.content)({currentDate:new Date().toISOString(),...this.variables,...t})}parseAiResponse(e,t){let n=this.prompts[e];if(!n)throw Error(`Expected this.prompts[${e}] to be defined`);let r=n.extractFromTag&&($(n.extractFromTag).exec(t)||[])[1]||t;return H(n.outputCodec,Gr(r),!1)}async reportAndParsePromptRun(e,{largeLanguageModel:t,...n}){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let r=n.name||`@transcend-io/cli-prompt-run-${new Date().toISOString()}`;if(!this.promptContentMap)throw Error(`Expected this.promptContentMap to be defined`);let i=this.promptContentMap[e];if(!i)throw Error(`Expected this.prompts[${e}] to be defined`);if(n.promptRunMessages.length===0)throw Error(`promptRunMessages is expected to have length > 0`);if(n.promptRunMessages[0].role!==I.System)throw Error(`promptRunMessages[0].role is expected to be = ${I.System}`);if(n.promptRunMessages[n.promptRunMessages.length-1].role!==I.Assistant)throw Error(`promptRunMessages[${n.promptRunMessages.length-1}].role is expected to be = ${I.Assistant}`);let a=n.promptRunMessages[n.promptRunMessages.length-1].content,o;try{o=this.parseAiResponse(e,a)}catch(e){throw await K(this.graphQLClient,{productArea:L.PromptManager,...n,name:r,error:e.message,status:z.Error,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:i.id,promptRunMessages:n.promptRunMessages.map((e,t)=>({...e,...t===0?{template:i.content}:{}}))},{logger:x}),e}let s=await K(this.graphQLClient,{productArea:L.PromptManager,...n,name:r,status:z.Resolved,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:i.id,promptRunMessages:n.promptRunMessages.map((e,t)=>({...e,...t===0?{template:i.content}:{}}))},{logger:x});return{result:o,promptRunId:s,promptRunUrl:`https://app.transcend.io/prompts/runs/${s}`}}async reportPromptRunError(e,{largeLanguageModel:t,...n}){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let r=n.name||`@transcend-io/cli-prompt-run-${new Date().toISOString()}`;if(!this.promptContentMap)throw Error(`Expected this.promptContentMap to be defined`);let i=this.promptContentMap[e];if(!i)throw Error(`Expected this.prompts[${e}] to be defined`);if(n.promptRunMessages.length===0)throw Error(`promptRunMessages is expected to have length > 0`);if(n.promptRunMessages[0].role!==I.System)throw Error(`promptRunMessages[0].role is expected to be = ${I.System}`);let a=await K(this.graphQLClient,{productArea:L.PromptManager,...n,name:r,status:z.Error,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:i.id,promptRunMessages:n.promptRunMessages.map((e,t)=>({...e,...t===0?{template:i.content}:{}}))},{logger:x});return{promptRunId:a,promptRunUrl:`https://app.transcend.io/prompts/runs/${a}`}}};function qr(e){return e.replace(/(https?:\/\/[^\s]+)/g,`<link-omitted>`)}function Jr(e){return Object.entries(e).reduce((e,[t,n])=>n!=null&&n!==``&&!(Array.isArray(n)&&n.length===0)&&!(typeof n==`object`&&Object.keys(n).length===0)?Object.assign(e,{[t]:n}):e,{})}function Yr({baseBranch:e,rootDirectory:t,githubRepo:n,excludedGlob:r=[],fileBlockList:i=[]}){Z(`git fetch origin ${e}`);let a=Z(`git ls-remote ${n} "refs/heads/${e}" | cut -f 1`,{encoding:`utf-8`}).split(`
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,t as a}from"./enums-CyFTrzXY.mjs";import{a as o,c as s,d as c,f as l,h as u,i as d,l as f,m as p,n as m,o as h,p as g,r as _,s as v,t as y,u as b}from"./constants-BdSIZSI2.mjs";import{t as x}from"./logger-Bj782ZYD.mjs";import{$ as S,A as ee,B as te,C as ne,D as re,E as ie,F as ae,G as oe,H as se,I as ce,J as le,K as ue,L as de,M as fe,N as pe,O as me,P as he,Q as ge,R as _e,S as ve,T as ye,U as be,V as xe,W as C,X as w,Y as T,Z as E,_ as D,_t as O,a as k,at as A,b as j,bt as M,c as Se,ct as Ce,d as we,dt as Te,et as Ee,f as De,ft as Oe,g as ke,gt as Ae,h as je,ht as Me,i as Ne,it as Pe,j as Fe,k as Ie,l as Le,lt as Re,m as ze,mt as Be,n as Ve,nt as He,o as Ue,ot as We,p as Ge,pt as Ke,q as qe,r as Je,rt as Ye,s as Xe,st as Ze,t as Qe,tt as $e,u as et,ut as tt,v as nt,vt as rt,w as it,x as at,xt as ot,y as st,yt as ct,z as lt}from"./codecs-Dnq-rEcB.mjs";import{a as ut,i as dt,n as ft,r as pt,t as mt}from"./readTranscendYaml-CGb2UUyM.mjs";import{a as ht,i as gt,n as _t,r as vt,t as yt}from"./parseVariablesFromString-BeKOGw5n.mjs";import{a as bt,c as xt,i as St,l as Ct,n as wt,o as Tt,r as Et,s as Dt,t as Ot,u as kt}from"./constants-CLxPXlJM.mjs";import{i as At,n as jt,r as Mt,t as Nt}from"./parseAttributesFromString-q4-59nEN.mjs";import{a as Pt,c as Ft,d as It,f as Lt,i as Rt,l as zt,n as Bt,o as Vt,r as Ht,s as Ut,t as Wt,u as Gt}from"./uploadPrivacyRequestsFromCsv-CVWtM97j.mjs";import{t as Kt}from"./readCsv-C4TyEs-r.mjs";import{n as qt,t as Jt}from"./pullUnstructuredSubDataPointRecommendations-D0z-vPgq.mjs";import{a as Yt,i as Xt,n as Zt,o as Qt,r as $t,t as en}from"./request-DfkRPQFr.mjs";import{i as tn,n as nn,r as rn,t as an}from"./pullTranscendConfiguration-BHP6t_Nq.mjs";import{i as on,n as sn,r as N,t as cn}from"./fetchAllRequests-CHHdyb4Q.mjs";import{a as ln,i as un,n as dn,r as fn,t as pn}from"./pullChunkedCustomSiloOutstandingIdentifiers-BLgrmhmd.mjs";import{n as mn,r as hn,t as gn}from"./syncCodePackages-CAk_Hjyl.mjs";import{t as _n}from"./markSilentPrivacyRequests-CDHSup8w.mjs";import{a as vn,i as yn,n as bn,o as xn,r as Sn,t as Cn}from"./downloadPrivacyRequestFiles-CYHv1D2D.mjs";import{n as wn,r as Tn,t as En}from"./extractClientError-i-Tw_az7.mjs";import{t as Dn}from"./approvePrivacyRequests-BbiLF33j.mjs";import{t as On}from"./notifyPrivacyRequestsAdditionalTime-DCUKJLfR.mjs";import{t as kn}from"./cancelPrivacyRequests-BHlMNcL2.mjs";import{n as An,t as jn}from"./bulkRestartRequests-C4gD5zJo.mjs";import{t as Mn}from"./skipPreflightJobs-Be3J3jpy.mjs";import{t as Nn}from"./bulkRetryEnrichers-7b8ozxGC.mjs";import{t as Pn}from"./retryRequestDataSilos-Bf5N77w_.mjs";import{n as P,r as F,t as Fn}from"./streamPrivacyRequestsToCsv-a082Gx5g.mjs";import{n as In,r as Ln,t as Rn}from"./inquirer-B4iEodLy.mjs";import{t as zn}from"./collectParquetFilesOrExit-BJiAyaQ5.mjs";import{t as Bn}from"./collectCsvFilesOrExit-CbtyKAzu.mjs";import{t as Vn}from"./parquetToCsvOneFile-B84XXInh.mjs";import{a as Hn,i as Un,n as Wn,o as Gn,r as Kn,s as qn,t as Jn}from"./writeCsv-C4pjXGsD.mjs";import{t as Yn}from"./skipRequestDataSilos-DRj6out9.mjs";import{t as Xn}from"./removeUnverifiedRequestIdentifiers-CCo-6ZHG.mjs";import{t as Zn}from"./updateConsentManagerVersionToLatest-B_HqBFUb.mjs";import{t as Qn}from"./uploadDataFlowsFromCsv-Clt1mhIJ.mjs";import{t as $n}from"./uploadCookiesFromCsv-B_T98E-X.mjs";import{t as er}from"./pullConsentManagerMetrics-zKgjc3Ap.mjs";import{n as tr,r as nr,t as rr}from"./buildXdiSyncEndpoint-Crym6E35.mjs";import{t as ir}from"./consentManagersToBusinessEntities-BdKDganK.mjs";import{i as ar,n as or,r as sr,t as cr}from"./uploadConsents-DB2S0uTr.mjs";import{n as lr,r as ur,t as dr}from"./pushCronIdentifiersFromCsv-BKdDUgrt.mjs";import{t as fr}from"./markRequestDataSiloIdsCompleted-Dix_6dHL.mjs";import{t as pr}from"./generateCrossAccountApiKeys-DyfLtOUz.mjs";import{t as mr}from"./validateTranscendAuth-DJ8qHb9B.mjs";import{t as hr}from"./listFiles-D2wMHnEr.mjs";import{t as gr}from"./pullAllDatapoints-Bbmky50p.mjs";import{t as _r}from"./pullManualEnrichmentIdentifiersToCsv-Boam7IAS.mjs";import{n as vr,r as yr,t as br}from"./pushManualEnrichmentIdentifiersFromCsv-ibwgC0Z2.mjs";import{ChatCompletionRole as I,PromptRunProductArea as L,PromptStatus as R,QueueStatus as z}from"@transcend-io/privacy-types";import{chunk as B,difference as xr,groupBy as Sr,keyBy as V,uniq as Cr}from"lodash-es";import{apply as wr,decodeCodec as H,getValues as Tr}from"@transcend-io/type-utils";import{readFileSync as Er,readdirSync as Dr,statSync as Or}from"node:fs";import{join as kr}from"node:path";import U from"colors";import{UPDATE_OR_CREATE_COOKIES as Ar,buildTranscendGraphQLClient as W,createSombraGotInstance as jr,fetchAllAgentFiles as Mr,fetchAllAgents as G,fetchAllLargeLanguageModels as Nr,fetchAllPromptThreads as Pr,fetchAllRequestIdentifiers as Fr,fetchConsentManagerId as Ir,fetchPromptsWithVariables as Lr,makeGraphQLRequest as Rr,reportPromptRun as K,validateSombraVersion as q}from"@transcend-io/sdk";import{map as J,mapSeries as Y}from"@transcend-io/utils";import{createHandlebarsWithHelpers as X}from"@transcend-io/handlebars-utils";import{execSync as Z}from"child_process";import zr from"fast-glob";async function Q(e,t){let n=await Ir(e,{logger:x});await Y(B(t,100),async t=>{await Rr(e,Ar,{variables:{airgapBundleId:n,cookies:t.map(e=>({name:e.name,trackingPurposes:e.trackingPurposes&&e.trackingPurposes.length>0?e.trackingPurposes:void 0,description:e.description,service:e.service,status:e.status,attributes:e.attributes,isRegex:e.isRegex}))},logger:x})})}async function Br(e,t){let n=!1;x.info(U.magenta(`Syncing "${t.length}" cookies...`));let r=t.filter(e=>t.filter(t=>e.name===t.name&&e.isRegex===t.isRegex).length>1);if(r.length>0)throw Error(`Failed to upload cookies as there were non-unique entries found: ${r.map(({name:e})=>e).join(`,`)}`);try{x.info(U.magenta(`Upserting "${t.length}" new cookies...`)),await Q(e,t),x.info(U.green(`Successfully synced ${t.length} cookies!`))}catch(e){n=!0,x.error(U.red(`Failed to create cookies! - ${e.message}`))}return!n}async function Vr({auth:e,sombraAuth:t,actions:n=[],statuses:r=[],identifierSearch:i,pageLimit:a=100,concurrency:s=1,transcendUrl:c=o,createdAtBefore:l,skipRequestIdentifiers:u=!1,createdAtAfter:d,updatedAtBefore:f,updatedAtAfter:p,isTest:m}){let h=W(c,e),g=await jr(c,e,{logger:x,sombraApiKey:t,sombraUrl:process.env.SOMBRA_URL}),_=``;l&&(_+=` before ${l.toISOString()}`),d&&(_+=`${_?`, and`:``} after ${d.toISOString()}`),x.info(U.magenta(`${n.length>0?`Pulling requests of type "${n.join(`" , "`)}"`:`Pulling all requests`}${_}`));let v=s>1&&d&&l,y=v?P(d,l,s):[{createdAtAfter:d,createdAtBefore:l}];v&&x.info(U.magenta(`Splitting date range into ${s} parallel chunks`));let b=(await J(y,e=>N(h,{actions:n,text:i,statuses:r,createdAtBefore:e.createdAtBefore,createdAtAfter:e.createdAtAfter,updatedAtBefore:f,updatedAtAfter:p,isTest:m}),{concurrency:v?s:1})).flat();u||await q(h,{logger:x});let S=u?b.map(e=>({...e,requestIdentifiers:[]})):await J(b,async e=>{let t=await Fr(h,g,{filterBy:{requestId:e.id},skipSombraCheck:!0,logger:x});return{...e,requestIdentifiers:t}},{concurrency:a});return x.info(U.magenta(`Pulled ${S.length} requests`)),{requestsWithRequestIdentifiers:S,requestsFormattedForCsv:S.map(F)}}function Hr(e){try{return e?Er(e,`utf8`):``}catch{return``}}function Ur(e){return Dr(e).filter(t=>Or(kr(e,t)).isDirectory())}function $(e){return RegExp(`<${e}>([\\s\\S]+?)<\\/${e}>`)}function Wr(e){return e}const Gr=e=>{try{return JSON.parse(e)}catch{return e}};var Kr=class{prompts;handlebarsOptions;promptContentMap;largeLanguageModels=[];agentsByName={};agentsByAgentId={};graphQLClient;defaultVariables;variables;handlebars;transcendApiKey;transcendUrl;requireApproval;cacheDuration;lastUpdatedAt;constructor({prompts:e,handlebarsOptions:t={},transcendUrl:n=o,transcendApiKey:r,requireApproval:i=!0,cacheDuration:a,defaultVariables:s={}}){this.prompts=e,this.transcendUrl=n,this.transcendApiKey=r,this.variables=s,this.defaultVariables=s,this.graphQLClient=W(n,typeof r==`object`?r.release():r),this.requireApproval=i,this.cacheDuration=a,this.handlebarsOptions=t,this.handlebars=X(t)}async fetchPromptsAndMetadata(){let e=Tr(this.prompts),t=e.map(({id:e})=>e).filter(e=>!!e),n=e.map(({title:e})=>e).filter(e=>!!e),r=Cr(e.map(({agentNames:e})=>e||[]).flat()),[i,a,o]=await Promise.all([Lr(this.graphQLClient,{logger:x,filterBy:{ids:t,titles:n}}),Nr(this.graphQLClient,{logger:x}),G(this.graphQLClient,{logger:x,filterBy:{names:r}})]);this.agentsByName=V(o,`name`),this.agentsByAgentId=V(o,`agentId`),this.largeLanguageModels=a.filter(e=>e.isTranscendHosted===!1);let s=V(i.prompts,`title`),c=V(i.prompts,`id`);return this.variables={...i.calculatedVariables.reduce((e,t)=>Object.assign(e,{[t.name]:t.data?JSON.parse(t.data):t.data}),{}),...this.defaultVariables},this.handlebars=X({...this.handlebarsOptions,templates:[...this.handlebarsOptions.templates||[],...i.promptPartials.map(e=>({name:e.slug,content:e.content}))]}),this.promptContentMap=wr(this.prompts,({id:e,title:t})=>{let n=e?c[e]:t?s[t]:void 0;if(!n)throw Error(`Failed to find prompt with title: "${t}" and id: "${e}"`);return n}),this.lastUpdatedAt=new Date,i}async getAgentByName(e){let t=this.agentsByName[e];if(t)return t;let[n]=await G(this.graphQLClient,{logger:x,filterBy:{names:[e]}});if(n)return this.agentsByName[n.name]=n,this.agentsByAgentId[n.agentId]=n,n}async getPromptThreadBySlackTs(e){let[t]=await Pr(this.graphQLClient,{logger:x,filterBy:{slackMessageTs:[e]}});return t}async getAgentsByName(e){if(e.length<1)throw Error(`Expected at least one name to be provided`);let{hasCache:t=[],missingCache:n=[]}=Sr(e,e=>this.agentsByName[e]?`hasCache`:`missingCache`),r=t.map(e=>this.agentsByName[e]);if(n.length===0)return r;let i=B(n,50),a=[];return await Y(i,async e=>{let t=await G(this.graphQLClient,{logger:x,filterBy:{names:e}});t.forEach(e=>{this.agentsByName[e.name]=e,this.agentsByAgentId[e.agentId]=e}),a.push(...t)}),[...r,...a]}getAgentFiles(e){return Mr(this.graphQLClient,{logger:x,filterBy:e})}getLargeLanguageModel(e){let t=this.largeLanguageModels.find(t=>typeof e==`string`?t.id===e:t.name===e.name&&t.client===e.client);if(!t)throw Error(`Failed to find model matching: ${typeof e==`string`?e:JSON.stringify(e)}`);return t}async getPromptDefinition(e){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let{promptContentMap:t}=this;if(!t)throw Error(`Expected this.promptContentMap to be defined`);let n=t[e];if(!n)throw Error(`Expected this.promptContentMap[${e}] to be defined`);return n}async compilePrompt(e,t){let n=await this.getPromptDefinition(e),r=this.prompts[e];if(!r)throw Error(`Expected this.prompts[${e}] to be defined`);if(this.requireApproval&&n.status!==R.Approved)throw Error(`Assessment "${n.title}" cannot be used because its in status: "${n.status}"`);if(n.status===R.Rejected)throw Error(`Assessment "${n.title}" cannot be used because it's in status: "${n.status}"`);return H(r.paramCodec,t),this.handlebars.compile(n.content)({currentDate:new Date().toISOString(),...this.variables,...t})}parseAiResponse(e,t){let n=this.prompts[e];if(!n)throw Error(`Expected this.prompts[${e}] to be defined`);let r=n.extractFromTag&&($(n.extractFromTag).exec(t)||[])[1]||t;return H(n.outputCodec,Gr(r),!1)}async reportAndParsePromptRun(e,{largeLanguageModel:t,...n}){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let r=n.name||`@transcend-io/cli-prompt-run-${new Date().toISOString()}`;if(!this.promptContentMap)throw Error(`Expected this.promptContentMap to be defined`);let i=this.promptContentMap[e];if(!i)throw Error(`Expected this.prompts[${e}] to be defined`);if(n.promptRunMessages.length===0)throw Error(`promptRunMessages is expected to have length > 0`);if(n.promptRunMessages[0].role!==I.System)throw Error(`promptRunMessages[0].role is expected to be = ${I.System}`);if(n.promptRunMessages[n.promptRunMessages.length-1].role!==I.Assistant)throw Error(`promptRunMessages[${n.promptRunMessages.length-1}].role is expected to be = ${I.Assistant}`);let a=n.promptRunMessages[n.promptRunMessages.length-1].content,o;try{o=this.parseAiResponse(e,a)}catch(e){throw await K(this.graphQLClient,{productArea:L.PromptManager,...n,name:r,error:e.message,status:z.Error,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:i.id,promptRunMessages:n.promptRunMessages.map((e,t)=>({...e,...t===0?{template:i.content}:{}}))},{logger:x}),e}let s=await K(this.graphQLClient,{productArea:L.PromptManager,...n,name:r,status:z.Resolved,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:i.id,promptRunMessages:n.promptRunMessages.map((e,t)=>({...e,...t===0?{template:i.content}:{}}))},{logger:x});return{result:o,promptRunId:s,promptRunUrl:`https://app.transcend.io/prompts/runs/${s}`}}async reportPromptRunError(e,{largeLanguageModel:t,...n}){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let r=n.name||`@transcend-io/cli-prompt-run-${new Date().toISOString()}`;if(!this.promptContentMap)throw Error(`Expected this.promptContentMap to be defined`);let i=this.promptContentMap[e];if(!i)throw Error(`Expected this.prompts[${e}] to be defined`);if(n.promptRunMessages.length===0)throw Error(`promptRunMessages is expected to have length > 0`);if(n.promptRunMessages[0].role!==I.System)throw Error(`promptRunMessages[0].role is expected to be = ${I.System}`);let a=await K(this.graphQLClient,{productArea:L.PromptManager,...n,name:r,status:z.Error,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:i.id,promptRunMessages:n.promptRunMessages.map((e,t)=>({...e,...t===0?{template:i.content}:{}}))},{logger:x});return{promptRunId:a,promptRunUrl:`https://app.transcend.io/prompts/runs/${a}`}}};function qr(e){return e.replace(/(https?:\/\/[^\s]+)/g,`<link-omitted>`)}function Jr(e){return Object.entries(e).reduce((e,[t,n])=>n!=null&&n!==``&&!(Array.isArray(n)&&n.length===0)&&!(typeof n==`object`&&Object.keys(n).length===0)?Object.assign(e,{[t]:n}):e,{})}function Yr({baseBranch:e,rootDirectory:t,githubRepo:n,excludedGlob:r=[],fileBlockList:i=[]}){Z(`git fetch origin ${e}`);let a=Z(`git ls-remote ${n} "refs/heads/${e}" | cut -f 1`,{encoding:`utf-8`}).split(`
|
|
2
2
|
`)[0],o=Z(`git rev-parse HEAD`,{encoding:`utf-8`}).split(`
|
|
3
3
|
`)[0];if(!a||!o)throw Error(`FAILED TO FIND COMMIT RANGE`);let s=xr(Z(`git fetch && git diff --name-only "${e||a}...${o}" -- ${t}`,{encoding:`utf-8`}).split(`
|
|
4
4
|
`).filter(e=>e),i),c=r.length>0?zr.sync(s,{ignore:r}):s,l={};return c.forEach(e=>{l[e]=Z(`git show ${o}:${e}`,{encoding:`utf-8`})}),{changedFiles:s,fileDiffs:l,repoName:n.split(`/`).pop().split(`.`)[0],commit:o}}export{y as ADMIN_DASH,m as ADMIN_DASH_DATAPOINTS,_ as ADMIN_DASH_INTEGRATIONS,en as APPROVE_PRIVACY_REQUEST,tn as ASSESSMENT_TEMPLATES,Qe as ActionInput,Ve as ActionItemCollectionInput,Je as ActionItemInput,Ne as AgentFileInput,k as AgentFunctionInput,Ue as AgentInput,Xe as ApiKeyInput,Se as AssessmentAnswerOptionInput,Le as AssessmentDisplayLogicInput,et as AssessmentInput,we as AssessmentNestedRuleInput,De as AssessmentResourceInput,Ge as AssessmentRetentionScheduleInput,ze as AssessmentRuleInput,je as AssessmentSectionInput,ke as AssessmentSectionQuestionInput,D as AssessmentTemplateInput,Rt as AttestedExtraIdentifiers,nt as AttributeInput,st as AttributePreview,j as AttributeValueInput,Ot as BLANK,wt as BULK_APPLY,at as BusinessEntityInput,Zt as CANCEL_PRIVACY_REQUEST,Et as CAN_APPLY_IN_BULK,St as CachedFileState,bt as CachedRequestState,ve as CodePackageInput,ne as CodePackageSdk,Tt as ColumnName,it as ConsentManageExperienceInput,ye as ConsentManagerInput,ie as ConsentManagerServiceMetadata,re as ConsentPreferenceTopic,me as ConsentPreferenceTopicOptionValue,Ie as ConsentPurpose,ee as CookieCsvInput,Fe as CookieInput,dn as CronIdentifier,lr as CronIdentifierPush,fn as CronPartition,d as DEBUG,o as DEFAULT_TRANSCEND_API,h as DEFAULT_TRANSCEND_CONSENT_API,an as DEFAULT_TRANSCEND_PULL_RESOURCES,fe as DataCategoryGuessInput,pe as DataCategoryInput,he as DataCategoryPreviewInput,ae as DataCategoryRecommendationInput,ce as DataFlowCsvInput,de as DataFlowInput,_e as DataSiloInput,lt as DataSubjectInput,te as DatapointInput,qt as ENTRY_COUNT,vr as EnrichPrivacyRequest,xe as EnricherInput,se as FieldInput,Dt as IDENTIFIER_BLOCK_LIST,rr as IP_ADDRESS_REGEX,xt as IS_REQUIRED,be as IdentifierInput,C as ImportOnetrustAssessmentsInput,Sn as IntlMessage,oe as IntlMessageInput,Ct as NONE,$t as NOTIFY_ADDITIONAL_TIME,a as OneTrustFileFormat,n as OneTrustPullResource,i as OneTrustPullSource,ue as OpenAIEnabledRoute,qe as OpenAIEnabledRoutes,le as OpenAIIntegration,t as OpenAIRouteName,Nt as ParsedAttributeInput,T as PartitionInput,w as PathfinderPolicy,e as PathfinderPolicyName,E as PathfinderPolicyNameC,ge as PathfinderPromptRunMetadata,S as PolicyInput,Ee as PrivacyCenterInput,cn as PrivacyRequest,Pt as PrivacyRequestInput,wn as PrivacyRequestResponse,$e as ProcessingActivityInput,He as ProcessingPurposeInput,Ye as ProcessingPurposePreviewInput,Pe as PromptAVendorEmailSettings,A as PromptGroupInput,We as PromptInput,Ze as PromptPartialInput,cr as PurposeMap,Xt as REQUESTS,Yt as REQUESTS_COUNT,v as RETRYABLE_BATCH_STATUSES,Ce as RegionInput,Re as RepositoryInput,yn as RequestFileMetadata,vn as RequestFileMetadataResponse,sn as RequestPurposeTrigger,tt as RiskAssignmentInput,Te as RiskLogicInput,s as SCOPES_BY_TITLE,f as SCOPE_TITLES,Oe as SiloDiscoveryResultInput,Ke as SoftwareDevelopmentKitInput,Be as StoredApiKey,kt as SuccessfulRequest,b as TR_PULL_RESOURCE_SCOPE_MAP,c as TR_PUSH_RESOURCE_SCOPE_MAP,l as TR_YML_RESOURCE_TO_FIELD_NAME,Me as TeamInput,Ae as TemplateInput,O as TranscendInput,Kr as TranscendPromptManager,r as TranscendPullResource,Qt as UPDATE_PRIVACY_REQUEST,or as USP_STRING_REGEX,mt as VARIABLE_PARAMETERS_NAME,ft as VARIABLE_PARAMETERS_REGEXP,rt as VendorInput,ct as WebhookHeader,Jn as appendCsvRowsOrdered,Wn as appendCsvSync,Dn as approvePrivacyRequests,ot as buildAIIntegrationType,M as buildEnabledRouteType,tr as buildXdiSyncEndpoint,jn as bulkRestartRequests,Nn as bulkRetryEnrichers,kn as cancelPrivacyRequests,Bn as collectCsvFilesOrExit,zn as collectParquetFilesOrExit,ir as consentManagersToBusinessEntities,gn as createCodePackage,ar as createConsentToken,$ as createRegexForTag,Wr as defineTranscendPrompts,p as description,nr as domainToHost,Cn as downloadPrivacyRequestFiles,yr as enrichPrivacyRequest,ht as ensureAllDataSubjectsExist,En as extractClientError,rn as fetchAllAssessmentTemplates,N as fetchAllRequests,ln as fetchRequestDataSiloActiveCount,on as fetchRequestsTotalCount,Jr as filterNullishValuesFromObject,Gt as filterRows,F as formatRequestForCsv,Mt as fuzzyMatchColumns,At as fuzzySearch,pr as generateCrossAccountApiKeys,xn as getFileMetadataForPrivacyRequests,Yr as getGitFilesThatChanged,It as getUniqueValuesForColumn,Kn as initCsvFile,Rn as inquirerAutoComplete,In as inquirerConfirmBoolean,Ln as inquirerConfirmText,Ur as listDirectories,hr as listFiles,Bt as mapColumnsToAttributes,Ht as mapColumnsToIdentifiers,zt as mapCsvColumnsToApi,Vt as mapCsvRowsToRequestInputs,Lt as mapEnumValues,Ft as mapRequestEnumValues,ur as markCronIdentifierCompleted,fr as markRequestDataSiloIdsCompleted,_n as markSilentPrivacyRequests,_t as mergeTranscendInputs,g as name,Ut as normalizeIdentifierValue,On as notifyPrivacyRequestsAdditionalTime,Vn as parquetToCsvOneFile,jt as parseAttributesFromString,Un as parseFilePath,yt as parseVariablesFromString,gr as pullAllDatapoints,pn as pullChunkedCustomSiloOutstandingIdentifiers,er as pullConsentManagerMetrics,un as pullCronPageOfIdentifiers,_r as pullManualEnrichmentIdentifiersToCsv,Vr as pullPrivacyRequests,nn as pullTranscendConfiguration,Jt as pullUnstructuredSubDataPointRecommendations,dr as pushCronIdentifiersFromCsv,br as pushManualEnrichmentIdentifiersFromCsv,Kt as readCsv,Hr as readSafe,pt as readTranscendYaml,qr as removeLinks,Xn as removeUnverifiedRequestIdentifiers,dt as replaceVariablesInYaml,An as restartPrivacyRequest,Pn as retryRequestDataSilos,Mn as skipPreflightJobs,Yn as skipRequestDataSilos,P as splitDateRange,bn as streamPrivacyRequestFiles,Fn as streamPrivacyRequestsToCsv,Tn as submitPrivacyRequest,mn as syncCodePackages,vt as syncConfigurationToTranscend,Br as syncCookies,gt as syncDataSilos,hn as updateCodePackages,Zn as updateConsentManagerVersionToLatest,Q as updateOrCreateCookies,sr as uploadConsents,$n as uploadCookiesFromCsv,Qn as uploadDataFlowsFromCsv,Wt as uploadPrivacyRequestsFromCsv,mr as validateTranscendAuth,u as version,Hn as writeCsv,Gn as writeCsvSync,qn as writeLargeCsv,ut as writeTranscendYaml};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./constants-
|
|
2
|
-
//# sourceMappingURL=markRequestDataSiloIdsCompleted-
|
|
1
|
+
import{a as e}from"./constants-BdSIZSI2.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{RequestDataSiloStatus as n}from"@transcend-io/privacy-types";import r from"colors";import{CHANGE_REQUEST_DATA_SILO_STATUS as i,buildTranscendGraphQLClient as a,fetchRequestDataSilo as o,makeGraphQLRequest as s}from"@transcend-io/sdk";import{map as c}from"@transcend-io/utils";import l from"cli-progress";async function u({requestIds:u,dataSiloId:d,auth:f,concurrency:p=100,status:m=n.Resolved,transcendUrl:h=e}){let g=a(h,f),_=new Date().getTime(),v=new l.SingleBar({},l.Presets.shades_classic);t.info(r.magenta(`Notifying Transcend for data silo "${d}" marking "${u.length}" requests as completed.`));let y=0;v.start(u.length,0),await c(u,async e=>{let n=await o(g,{logger:t,filterBy:{requestId:e,dataSiloId:d}});try{await s(g,i,{variables:{requestDataSiloId:n.id,status:m},logger:t})}catch(e){if(!e.message.includes(`Client error: Request must be active:`)&&!e.message.includes(`Failed to find RequestDataSilo`))throw e}y+=1,v.update(y)},{concurrency:p}),v.stop();let b=new Date().getTime()-_;return t.info(r.green(`Successfully notified Transcend in "${b/1e3}" seconds!`)),u.length}export{u as t};
|
|
2
|
+
//# sourceMappingURL=markRequestDataSiloIdsCompleted-Dix_6dHL.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markRequestDataSiloIdsCompleted-
|
|
1
|
+
{"version":3,"file":"markRequestDataSiloIdsCompleted-Dix_6dHL.mjs","names":[],"sources":["../src/lib/cron/markRequestDataSiloIdsCompleted.ts"],"sourcesContent":["import { RequestDataSiloStatus } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n makeGraphQLRequest,\n CHANGE_REQUEST_DATA_SILO_STATUS,\n fetchRequestDataSilo,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\n\n/**\n * Given a CSV of Request IDs, mark associated RequestDataSilos as completed\n *\n * @param options - Options\n * @returns Number of items marked as completed\n */\nexport async function markRequestDataSiloIdsCompleted({\n requestIds,\n dataSiloId,\n auth,\n concurrency = 100,\n status = RequestDataSiloStatus.Resolved,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The list of request ids to mark as completed */\n requestIds: string[];\n /** Transcend API key authentication */\n auth: string;\n /** Data Silo ID to pull down jobs for */\n dataSiloId: string;\n /** Status to update requests to */\n status?: RequestDataSiloStatus;\n /** Upload concurrency */\n concurrency?: number;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Notify Transcend\n logger.info(\n colors.magenta(\n `Notifying Transcend for data silo \"${dataSiloId}\" marking \"${requestIds.length}\" requests as completed.`,\n ),\n );\n\n let total = 0;\n progressBar.start(requestIds.length, 0);\n await map(\n requestIds,\n async (requestId) => {\n const requestDataSilo = await fetchRequestDataSilo(client, {\n logger,\n filterBy: { requestId, dataSiloId },\n });\n\n try {\n await makeGraphQLRequest<{\n /** Whether we successfully uploaded the results */\n success: boolean;\n }>(client, CHANGE_REQUEST_DATA_SILO_STATUS, {\n variables: {\n requestDataSiloId: requestDataSilo.id,\n status,\n },\n logger,\n });\n } catch (err) {\n if (\n !err.message.includes('Client error: Request must be active:') &&\n !err.message.includes('Failed to find RequestDataSilo')\n ) {\n throw err;\n }\n }\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(colors.green(`Successfully notified Transcend in \"${totalTime / 1000}\" seconds!`));\n return requestIds.length;\n}\n"],"mappings":"yYAoBA,eAAsB,EAAgC,CACpD,aACA,aACA,OACA,cAAc,IACd,SAAS,EAAsB,SAC/B,eAAe,GAcG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAGrF,EAAO,KACL,EAAO,QACL,sCAAsC,EAAW,aAAa,EAAW,OAAO,0BACjF,CACF,CAED,IAAI,EAAQ,EACZ,EAAY,MAAM,EAAW,OAAQ,EAAE,CACvC,MAAM,EACJ,EACA,KAAO,IAAc,CACnB,IAAM,EAAkB,MAAM,EAAqB,EAAQ,CACzD,SACA,SAAU,CAAE,YAAW,aAAY,CACpC,CAAC,CAEF,GAAI,CACF,MAAM,EAGH,EAAQ,EAAiC,CAC1C,UAAW,CACT,kBAAmB,EAAgB,GACnC,SACD,CACD,SACD,CAAC,OACK,EAAK,CACZ,GACE,CAAC,EAAI,QAAQ,SAAS,wCAAwC,EAC9D,CAAC,EAAI,QAAQ,SAAS,iCAAiC,CAEvD,MAAM,EAIV,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAGvB,OADA,EAAO,KAAK,EAAO,MAAM,uCAAuC,EAAY,IAAK,YAAY,CAAC,CACvF,EAAW"}
|
package/dist/{markSilentPrivacyRequests-DzgnobYG.mjs → markSilentPrivacyRequests-CDHSup8w.mjs}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./constants-
|
|
2
|
-
//# sourceMappingURL=markSilentPrivacyRequests-
|
|
1
|
+
import{a as e}from"./constants-BdSIZSI2.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{o as n}from"./request-DfkRPQFr.mjs";import{r}from"./fetchAllRequests-CHHdyb4Q.mjs";import{RequestStatus as i}from"@transcend-io/privacy-types";import a from"colors";import{buildTranscendGraphQLClient as o,makeGraphQLRequest as s}from"@transcend-io/sdk";import{map as c}from"@transcend-io/utils";import l from"cli-progress";async function u({requestActions:u,auth:d,requestIds:f,statuses:p=[i.Compiling,i.RequestMade,i.Delayed,i.Approving,i.Secondary,i.Enriching,i.Waiting,i.SecondaryApproving],createdAtAfter:m,createdAtBefore:h,updatedAtBefore:g,updatedAtAfter:_,concurrency:v=100,transcendUrl:y=e}){let b=o(y,d),x=new Date().getTime(),S=new l.SingleBar({},l.Presets.shades_classic),C=await r(b,{actions:u,statuses:p,createdAtBefore:h,createdAtAfter:m,updatedAtBefore:g,updatedAtAfter:_,isSilent:!1,requestIds:f});t.info(a.magenta(`Marking "${C.length}" as silent mode.`));let w=0;S.start(C.length,0),await c(C,async e=>{await s(b,n,{variables:{input:{id:e.id,isSilent:!0}},logger:t}),w+=1,S.update(w)},{concurrency:v}),S.stop();let T=new Date().getTime()-x;return t.info(a.green(`Successfully marked ${w} requests as silent mode in "${T/1e3}" seconds!`)),C.length}export{u as t};
|
|
2
|
+
//# sourceMappingURL=markSilentPrivacyRequests-CDHSup8w.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markSilentPrivacyRequests-
|
|
1
|
+
{"version":3,"file":"markSilentPrivacyRequests-CDHSup8w.mjs","names":[],"sources":["../src/lib/requests/markSilentPrivacyRequests.ts"],"sourcesContent":["import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, makeGraphQLRequest } from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { UPDATE_PRIVACY_REQUEST, fetchAllRequests } from '../graphql/index.js';\n\n/**\n * Mark a set of privacy requests to be in silent mode\n *\n * @param options - Options\n * @returns The number of requests marked silent\n */\nexport async function markSilentPrivacyRequests({\n requestActions,\n auth,\n requestIds,\n statuses = [\n RequestStatus.Compiling,\n RequestStatus.RequestMade,\n RequestStatus.Delayed,\n RequestStatus.Approving,\n RequestStatus.Secondary,\n RequestStatus.Enriching,\n RequestStatus.Waiting,\n RequestStatus.SecondaryApproving,\n ],\n createdAtAfter,\n createdAtBefore,\n updatedAtBefore,\n updatedAtAfter,\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The request actions that should be restarted */\n requestActions: RequestAction[];\n /** Transcend API key authentication */\n auth: string;\n /** Concurrency limit for approving */\n concurrency?: number;\n /** The request statuses to mark silent */\n statuses?: RequestStatus[];\n /** The set of privacy requests to mark silent */\n requestIds?: string[];\n /** Filter for requests created before this date */\n createdAtBefore?: Date;\n /** Filter for requests created after this date */\n createdAtAfter?: Date;\n /** Filter for requests updated before this date */\n updatedAtBefore?: Date;\n /** Filter for requests updated after this date */\n updatedAtAfter?: Date;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Pull in the requests\n const allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n statuses,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isSilent: false,\n requestIds,\n });\n\n // Notify Transcend\n logger.info(colors.magenta(`Marking \"${allRequests.length}\" as silent mode.`));\n\n let total = 0;\n progressBar.start(allRequests.length, 0);\n await map(\n allRequests,\n async (requestToMarkSilent) => {\n await makeGraphQLRequest(client, UPDATE_PRIVACY_REQUEST, {\n variables: {\n input: {\n id: requestToMarkSilent.id,\n isSilent: true,\n },\n },\n logger,\n });\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully marked ${total} requests as silent mode in \"${totalTime / 1000}\" seconds!`,\n ),\n );\n return allRequests.length;\n}\n"],"mappings":"4ZAgBA,eAAsB,EAA0B,CAC9C,iBACA,OACA,aACA,WAAW,CACT,EAAc,UACd,EAAc,YACd,EAAc,QACd,EAAc,UACd,EAAc,UACd,EAAc,UACd,EAAc,QACd,EAAc,mBACf,CACD,iBACA,kBACA,kBACA,iBACA,cAAc,IACd,eAAe,GAsBG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAG/E,EAAc,MAAM,EAAiB,EAAQ,CACjD,QAAS,EACT,WACA,kBACA,iBACA,kBACA,iBACA,SAAU,GACV,aACD,CAAC,CAGF,EAAO,KAAK,EAAO,QAAQ,YAAY,EAAY,OAAO,mBAAmB,CAAC,CAE9E,IAAI,EAAQ,EACZ,EAAY,MAAM,EAAY,OAAQ,EAAE,CACxC,MAAM,EACJ,EACA,KAAO,IAAwB,CAC7B,MAAM,EAAmB,EAAQ,EAAwB,CACvD,UAAW,CACT,MAAO,CACL,GAAI,EAAoB,GACxB,SAAU,GACX,CACF,CACD,SACD,CAAC,CAEF,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAOvB,OALA,EAAO,KACL,EAAO,MACL,uBAAuB,EAAM,+BAA+B,EAAY,IAAK,YAC9E,CACF,CACM,EAAY"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./constants-
|
|
2
|
-
//# sourceMappingURL=notifyPrivacyRequestsAdditionalTime-
|
|
1
|
+
import{a as e}from"./constants-BdSIZSI2.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{r as n}from"./request-DfkRPQFr.mjs";import{r}from"./fetchAllRequests-CHHdyb4Q.mjs";import{RequestAction as i}from"@transcend-io/privacy-types";import a from"colors";import{buildTranscendGraphQLClient as o,fetchAllTemplates as s,makeGraphQLRequest as c}from"@transcend-io/sdk";import{map as l}from"@transcend-io/utils";import u from"cli-progress";async function d({requestActions:d=Object.values(i),auth:f,requestIds:p,createdAtBefore:m,days:h=45,daysLeft:g=10,createdAtAfter:_,updatedAtBefore:v,updatedAtAfter:y,emailTemplate:b=`Additional Time Needed`,concurrency:x=100,transcendUrl:S=e}){let C=o(S,f),w=new Date().getTime(),T=new u.SingleBar({},u.Presets.shades_classic),E=(await s(C,{logger:t,filterBy:{title:b}})).find(e=>e.title===b);if(!E)throw Error(`Failed to find a template with title: "${b}"`);let D=await r(C,{actions:d,createdAtBefore:m,createdAtAfter:_,updatedAtBefore:v,updatedAtAfter:y,isSilent:!1,isClosed:!1,requestIds:p});D=D.filter(e=>typeof e.daysRemaining==`number`&&e.daysRemaining<g),t.info(a.magenta(`Notifying "${D.length}" that more time is needed.`));let O=0;T.start(D.length,0),await l(D,async e=>{await c(C,n,{variables:{input:{requestId:e.id,template:E.template.defaultMessage,subject:E.subject.defaultMessage,additionalTime:h}},logger:t}),O+=1,T.update(O)},{concurrency:x}),T.stop();let k=new Date().getTime()-w;return t.info(a.green(`Successfully marked ${O} requests as silent mode in "${k/1e3}" seconds!`)),D.length}export{d as t};
|
|
2
|
+
//# sourceMappingURL=notifyPrivacyRequestsAdditionalTime-DCUKJLfR.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifyPrivacyRequestsAdditionalTime-
|
|
1
|
+
{"version":3,"file":"notifyPrivacyRequestsAdditionalTime-DCUKJLfR.mjs","names":[],"sources":["../src/lib/requests/notifyPrivacyRequestsAdditionalTime.ts"],"sourcesContent":["import { RequestAction } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n fetchAllTemplates,\n makeGraphQLRequest,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { NOTIFY_ADDITIONAL_TIME, fetchAllRequests } from '../graphql/index.js';\n\n/**\n * Mark a set of privacy requests to be in silent mode.\n * Note requests in silent mode are ignored\n *\n * @param options - Options\n * @returns The number of requests marked silent\n */\nexport async function notifyPrivacyRequestsAdditionalTime({\n requestActions = Object.values(RequestAction),\n auth,\n requestIds,\n createdAtBefore,\n days = 45,\n daysLeft = 10,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n emailTemplate = 'Additional Time Needed',\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The request actions that should be restarted */\n requestActions?: RequestAction[];\n /** Filter for requests created before this date */\n createdAtBefore: Date;\n /** Filter for requests created after this date */\n createdAtAfter?: Date;\n /** Filter for requests updated before this date */\n updatedAtBefore?: Date;\n /** Filter for requests updated after this date */\n updatedAtAfter?: Date;\n /** Email template */\n emailTemplate?: string;\n /** Transcend API key authentication */\n auth: string;\n /** Number of days to extend request by */\n days?: number;\n /**\n * Only notify requests that have less than this number of days until they are considered expired.\n * This allows for re-running the command without notifying the same users multiple times\n */\n daysLeft?: number;\n /** Concurrency limit for approving */\n concurrency?: number;\n /** The set of privacy requests to notify */\n requestIds?: string[];\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Grab the template with that title\n const matchingTemplates = await fetchAllTemplates(client, {\n logger,\n filterBy: { title: emailTemplate },\n });\n const exactTemplateMatch = matchingTemplates.find((template) => template.title === emailTemplate);\n if (!exactTemplateMatch) {\n throw new Error(`Failed to find a template with title: \"${emailTemplate}\"`);\n }\n\n // Pull in the requests\n let allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isSilent: false,\n isClosed: false,\n requestIds,\n });\n\n // Filter requests by daysLeft\n allRequests = allRequests.filter(\n (request) => typeof request.daysRemaining === 'number' && request.daysRemaining < daysLeft,\n );\n\n // Notify Transcend\n logger.info(colors.magenta(`Notifying \"${allRequests.length}\" that more time is needed.`));\n\n let total = 0;\n progressBar.start(allRequests.length, 0);\n await map(\n allRequests,\n async (requestToNotify) => {\n await makeGraphQLRequest(client, NOTIFY_ADDITIONAL_TIME, {\n variables: {\n input: {\n requestId: requestToNotify.id,\n template: exactTemplateMatch.template.defaultMessage,\n subject: exactTemplateMatch.subject.defaultMessage,\n additionalTime: days,\n },\n },\n logger,\n });\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully marked ${total} requests as silent mode in \"${totalTime / 1000}\" seconds!`,\n ),\n );\n return allRequests.length;\n}\n"],"mappings":"mbAqBA,eAAsB,EAAoC,CACxD,iBAAiB,OAAO,OAAO,EAAc,CAC7C,OACA,aACA,kBACA,OAAO,GACP,WAAW,GACX,iBACA,kBACA,iBACA,gBAAgB,yBAChB,cAAc,IACd,eAAe,GA6BG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAO/E,GAAqB,MAJK,EAAkB,EAAQ,CACxD,SACA,SAAU,CAAE,MAAO,EAAe,CACnC,CAAC,EAC2C,KAAM,GAAa,EAAS,QAAU,EAAc,CACjG,GAAI,CAAC,EACH,MAAU,MAAM,0CAA0C,EAAc,GAAG,CAI7E,IAAI,EAAc,MAAM,EAAiB,EAAQ,CAC/C,QAAS,EACT,kBACA,iBACA,kBACA,iBACA,SAAU,GACV,SAAU,GACV,aACD,CAAC,CAGF,EAAc,EAAY,OACvB,GAAY,OAAO,EAAQ,eAAkB,UAAY,EAAQ,cAAgB,EACnF,CAGD,EAAO,KAAK,EAAO,QAAQ,cAAc,EAAY,OAAO,6BAA6B,CAAC,CAE1F,IAAI,EAAQ,EACZ,EAAY,MAAM,EAAY,OAAQ,EAAE,CACxC,MAAM,EACJ,EACA,KAAO,IAAoB,CACzB,MAAM,EAAmB,EAAQ,EAAwB,CACvD,UAAW,CACT,MAAO,CACL,UAAW,EAAgB,GAC3B,SAAU,EAAmB,SAAS,eACtC,QAAS,EAAmB,QAAQ,eACpC,eAAgB,EACjB,CACF,CACD,SACD,CAAC,CAEF,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAOvB,OALA,EAAO,KACL,EAAO,MACL,uBAAuB,EAAM,+BAA+B,EAAY,IAAK,YAC9E,CACF,CACM,EAAY"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./constants-
|
|
2
|
-
//# sourceMappingURL=pullChunkedCustomSiloOutstandingIdentifiers-
|
|
1
|
+
import{a as e}from"./constants-BdSIZSI2.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{decodeCodec as n}from"@transcend-io/type-utils";import r from"colors";import*as i from"io-ts";import{REDUCED_REQUESTS_FOR_DATA_SILO_COUNT as a,buildTranscendGraphQLClient as o,createSombraGotInstance as s,makeGraphQLRequest as c,withTransientRetry as l}from"@transcend-io/sdk";import{mapSeries as u}from"@transcend-io/utils";import d from"cli-progress";async function f(e,{dataSiloId:n}){let{listReducedRequestsForDataSilo:{totalCount:r}}=await c(e,a,{variables:{input:{dataSiloId:n,isResolved:!1}},logger:t});return r}const p=i.type({id:i.string,name:i.string,partition:i.string}),m=i.intersection([i.type({identifier:i.string,type:i.string,coreIdentifier:i.string,dataSiloId:i.string,requestId:i.string,nonce:i.string,requestCreatedAt:i.string,daysUntilOverdue:i.number,attributes:i.array(i.type({key:i.string,values:i.array(i.string)}))}),i.partial({partition:i.union([p,i.null])})]);async function h(e,{dataSiloId:r,limit:a=100,offset:o=0,requestType:s}){try{let c=await l(`pullCronPageOfIdentifiers`,()=>e.get(`v1/data-silo/${r}/pending-requests/${s}`,{searchParams:{offset:o,limit:a}}).json(),{logger:t,maxAttempts:6,baseDelayMs:500}),{items:u}=n(i.type({items:i.array(m)}),c);return u}catch(e){throw Error(`Received an error from server: ${e?.response?.body||e?.message}`)}}async function g({dataSiloId:n,auth:i,sombraAuth:a,actions:c,apiPageSize:l=100,savePageSize:p=1e3,onSave:m,transcendUrl:g=e,skipRequestCount:_=!1}){if(p%l!==0)throw Error(`savePageSize must be a multiple of apiPageSize. savePageSize: ${p}, apiPageSize: ${l}`);let v=await s(g,i,{logger:t,sombraApiKey:a,sombraUrl:process.env.SOMBRA_URL}),y=o(g,i),b=0;_||(b=await f(y,{dataSiloId:n})),t.info(r.magenta(`Pulling ${_?`all`:b} outstanding request identifiers for data silo: "${n}" for requests of types "${c.join(`", "`)}"`));let x=new Date().getTime(),S=new d.SingleBar({},d.Presets.shades_classic),C=new Set,w=[],T=[];_||S.start(b,0),await u(c,async e=>{let i=0,a=!0;for(;a;){let o=await h(v,{dataSiloId:n,limit:l,offset:i,requestType:e}),s=o.map(t=>(C.add(t.requestId),{...t,action:e})),c=s.map(({attributes:e,partition:t,...n})=>({...n,...t?{partitionId:t.id,partitionName:t.name,partitionKey:t.partition}:{},...e.reduce((e,t)=>Object.assign(e,{[t.key]:t.values.join(`,`)}),{})}));w.push(...s),T.push(...c),T.length>=p&&(await m(T),T=[]),a=o.length===l,i+=l,_?t.info(r.magenta(`Pulled ${o.length} outstanding identifiers for ${C.size} requests`)):S.update(C.size)}}),T.length>0&&await m(T),_||S.stop();let E=new Date().getTime()-x;return t.info(r.green(`Successfully pulled ${w.length} outstanding identifiers from ${C.size} requests in "${E/1e3}" seconds!`)),{identifiers:w}}export{f as a,h as i,m as n,p as r,g as t};
|
|
2
|
+
//# sourceMappingURL=pullChunkedCustomSiloOutstandingIdentifiers-BLgrmhmd.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pullChunkedCustomSiloOutstandingIdentifiers-CPY9eRLF.mjs","names":[],"sources":["../src/lib/graphql/fetchRequestDataSiloActiveCount.ts","../src/lib/cron/pullCronPageOfIdentifiers.ts","../src/lib/cron/pullChunkedCustomSiloOutstandingIdentifiers.ts"],"sourcesContent":["import { makeGraphQLRequest, REDUCED_REQUESTS_FOR_DATA_SILO_COUNT } from '@transcend-io/sdk';\nimport { GraphQLClient } from 'graphql-request';\n\nimport { logger } from '../../logger.js';\n\n/**\n * Get number of open requests for a data silo\n *\n * @param client - GraphQL client\n * @param options - Filter options\n * @returns List of request identifiers\n */\nexport async function fetchRequestDataSiloActiveCount(\n client: GraphQLClient,\n {\n dataSiloId,\n }: {\n /** Data silo ID */\n dataSiloId: string;\n },\n): Promise<number> {\n const {\n listReducedRequestsForDataSilo: { totalCount },\n } = await makeGraphQLRequest<{\n /** Requests */\n listReducedRequestsForDataSilo: {\n /** Total count */\n totalCount: number;\n };\n }>(client, REDUCED_REQUESTS_FOR_DATA_SILO_COUNT, {\n variables: {\n input: {\n dataSiloId,\n isResolved: false,\n },\n },\n logger,\n });\n\n return totalCount;\n}\n","import { RequestAction } from '@transcend-io/privacy-types';\nimport { withTransientRetry } from '@transcend-io/sdk';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport type { Got } from 'got';\nimport * as t from 'io-ts';\n\nimport { logger } from '../../logger.js';\n\n/** Consent partition metadata when a DSR is scoped to a partition */\nexport const CronPartition = t.type({\n /** ID of the partition */\n id: t.string,\n /** The human readable name of the partition */\n name: t.string,\n /** The unique identifying partition value */\n partition: t.string,\n});\n\n/** Type override */\nexport type CronPartition = t.TypeOf<typeof CronPartition>;\n\nexport const CronIdentifier = t.intersection([\n t.type({\n /** The identifier value */\n identifier: t.string,\n /** The type of identifier */\n type: t.string,\n /** The core identifier of the request */\n coreIdentifier: t.string,\n /** The ID of the underlying data silo */\n dataSiloId: t.string,\n /** The ID of the underlying request */\n requestId: t.string,\n /** The request nonce */\n nonce: t.string,\n /** The time the request was created */\n requestCreatedAt: t.string,\n /** The number of days until the request is overdue */\n daysUntilOverdue: t.number,\n /** Request attributes */\n attributes: t.array(\n t.type({\n key: t.string,\n values: t.array(t.string),\n }),\n ),\n }),\n t.partial({\n /** The consent partition that scopes this request, when applicable */\n partition: t.union([CronPartition, t.null]),\n }),\n]);\n\n/** Type override */\nexport type CronIdentifier = t.TypeOf<typeof CronIdentifier>;\n\n/**\n * Pull a offset of identifiers for a cron job\n *\n * @see https://docs.transcend.io/docs/api-reference/GET/v1/data-silo/(id)/pending-requests/(type)\n * @param sombra - Sombra instance configured to make requests\n * @param options - Additional options\n * @returns Successfully submitted request\n */\nexport async function pullCronPageOfIdentifiers(\n sombra: Got,\n {\n dataSiloId,\n limit = 100,\n offset = 0,\n requestType,\n }: {\n /** Data Silo ID */\n dataSiloId: string;\n /** Type of request */\n requestType: RequestAction;\n /** Number of identifiers to pull in */\n limit?: number;\n /** Page to pull in */\n offset?: number;\n },\n): Promise<CronIdentifier[]> {\n try {\n // `GET pending-requests` is a read and therefore safe to retry on transient\n // gateway / network errors. Customers running `transcend cron\n // pull-identifiers` against large silos would otherwise see the command\n // abort on a single 502 from the Sombra reverse tunnel.\n const response = await withTransientRetry(\n 'pullCronPageOfIdentifiers',\n () =>\n sombra\n .get(`v1/data-silo/${dataSiloId}/pending-requests/${requestType}`, {\n searchParams: {\n offset,\n limit,\n },\n })\n .json(),\n { logger, maxAttempts: 6, baseDelayMs: 500 },\n );\n\n const { items } = decodeCodec(\n t.type({\n items: t.array(CronIdentifier),\n }),\n response,\n );\n return items;\n } catch (err) {\n throw new Error(`Received an error from server: ${err?.response?.body || err?.message}`);\n }\n}\n","import { RequestAction } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, createSombraGotInstance } from '@transcend-io/sdk';\nimport { mapSeries } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { fetchRequestDataSiloActiveCount } from '../graphql/index.js';\nimport { pullCronPageOfIdentifiers, CronIdentifier } from './pullCronPageOfIdentifiers.js';\n\n/**\n * A CSV formatted identifier\n */\nexport type CsvFormattedIdentifier = {\n [k in string]: string | null | boolean | number;\n};\n\nexport interface CronIdentifierWithAction extends CronIdentifier {\n /** The request action that the identifier relates to */\n action: RequestAction;\n}\n\n/**\n * Pull the set of identifiers outstanding for a cron or AVC integration\n *\n * This function is designed to be used in a loop, and will call the onSave callback\n * with a chunk of identifiers when the savePageSize is reached.\n *\n * @param options - Options\n * @returns The identifiers and identifiers formatted for CSV\n */\nexport async function pullChunkedCustomSiloOutstandingIdentifiers({\n dataSiloId,\n auth,\n sombraAuth,\n actions,\n apiPageSize = 100,\n savePageSize = 1000,\n onSave,\n transcendUrl = DEFAULT_TRANSCEND_API,\n skipRequestCount = false,\n}: {\n /** Transcend API key authentication */\n auth: string;\n /** Data Silo ID to pull down jobs for */\n dataSiloId: string;\n /** The request actions to fetch */\n actions: RequestAction[];\n /** How many identifiers to pull in a single call to the backend */\n apiPageSize: number;\n /** How many identifiers to save at a time (usually to a CSV file, should be a multiple of apiPageSize) */\n savePageSize: number;\n /** Callback function called when a chunk of identifiers is ready to be saved */\n onSave: (chunk: CsvFormattedIdentifier[]) => Promise<void>;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** Sombra API key authentication */\n sombraAuth?: string;\n /** Skip request count */\n skipRequestCount?: boolean;\n}): Promise<{\n /** Raw Identifiers */\n identifiers: CronIdentifierWithAction[];\n}> {\n // Validate savePageSize\n if (savePageSize % apiPageSize !== 0) {\n throw new Error(\n `savePageSize must be a multiple of apiPageSize. savePageSize: ${savePageSize}, apiPageSize: ${apiPageSize}`,\n );\n }\n\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, {\n logger,\n sombraApiKey: sombraAuth,\n sombraUrl: process.env.SOMBRA_URL,\n });\n\n // Create GraphQL client to connect to Transcend backend\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n let totalRequestCount = 0;\n if (!skipRequestCount) {\n totalRequestCount = await fetchRequestDataSiloActiveCount(client, {\n dataSiloId,\n });\n }\n\n logger.info(\n colors.magenta(\n `Pulling ${skipRequestCount ? 'all' : totalRequestCount} outstanding request identifiers ` +\n `for data silo: \"${dataSiloId}\" for requests of types \"${actions.join('\", \"')}\"`,\n ),\n );\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n const foundRequestIds = new Set<string>();\n\n // identifiers found in total\n const identifiers: CronIdentifierWithAction[] = [];\n // current chunk of identifiers to be saved\n let currentChunk: CsvFormattedIdentifier[] = [];\n\n // map over each action\n if (!skipRequestCount) {\n progressBar.start(totalRequestCount, 0);\n }\n await mapSeries(actions, async (action) => {\n let offset = 0;\n let shouldContinue = true;\n\n // Fetch a page of identifiers\n while (shouldContinue) {\n const pageIdentifiers = await pullCronPageOfIdentifiers(sombra, {\n dataSiloId,\n limit: apiPageSize,\n offset,\n requestType: action,\n });\n\n const identifiersWithAction: CronIdentifierWithAction[] = pageIdentifiers.map(\n (identifier) => {\n foundRequestIds.add(identifier.requestId);\n return {\n ...identifier,\n action,\n };\n },\n );\n\n const csvFormattedIdentifiers = identifiersWithAction.map(\n ({ attributes, partition, ...identifier }) => ({\n ...identifier,\n ...(partition\n ? {\n partitionId: partition.id,\n partitionName: partition.name,\n partitionKey: partition.partition,\n }\n : {}),\n ...attributes.reduce(\n (acc, val) =>\n Object.assign(acc, {\n [val.key]: val.values.join(','),\n }),\n {},\n ),\n }),\n );\n\n identifiers.push(...identifiersWithAction);\n currentChunk.push(...csvFormattedIdentifiers);\n\n // Check if we've reached the savePageSize and call the onSave callback\n if (currentChunk.length >= savePageSize) {\n await onSave(currentChunk);\n currentChunk = [];\n }\n\n shouldContinue = pageIdentifiers.length === apiPageSize;\n offset += apiPageSize;\n if (!skipRequestCount) {\n progressBar.update(foundRequestIds.size);\n } else {\n logger.info(\n colors.magenta(\n `Pulled ${pageIdentifiers.length} outstanding identifiers for ${foundRequestIds.size} requests`,\n ),\n );\n }\n }\n });\n\n // Save any remaining identifiers in the current chunk\n if (currentChunk.length > 0) {\n await onSave(currentChunk);\n }\n\n if (!skipRequestCount) {\n progressBar.stop();\n }\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully pulled ${identifiers.length} outstanding identifiers from ${\n foundRequestIds.size\n } requests in \"${totalTime / 1000}\" seconds!`,\n ),\n );\n\n return { identifiers };\n}\n"],"mappings":"0bAYA,eAAsB,EACpB,EACA,CACE,cAKe,CACjB,GAAM,CACJ,+BAAgC,CAAE,eAChC,MAAM,EAMP,EAAQ,EAAsC,CAC/C,UAAW,CACT,MAAO,CACL,aACA,WAAY,GACb,CACF,CACD,SACD,CAAC,CAEF,OAAO,EC9BT,MAAa,EAAgB,EAAE,KAAK,CAElC,GAAI,EAAE,OAEN,KAAM,EAAE,OAER,UAAW,EAAE,OACd,CAAC,CAKW,EAAiB,EAAE,aAAa,CAC3C,EAAE,KAAK,CAEL,WAAY,EAAE,OAEd,KAAM,EAAE,OAER,eAAgB,EAAE,OAElB,WAAY,EAAE,OAEd,UAAW,EAAE,OAEb,MAAO,EAAE,OAET,iBAAkB,EAAE,OAEpB,iBAAkB,EAAE,OAEpB,WAAY,EAAE,MACZ,EAAE,KAAK,CACL,IAAK,EAAE,OACP,OAAQ,EAAE,MAAM,EAAE,OAAO,CAC1B,CAAC,CACH,CACF,CAAC,CACF,EAAE,QAAQ,CAER,UAAW,EAAE,MAAM,CAAC,EAAe,EAAE,KAAK,CAAC,CAC5C,CAAC,CACH,CAAC,CAaF,eAAsB,EACpB,EACA,CACE,aACA,QAAQ,IACR,SAAS,EACT,eAWyB,CAC3B,GAAI,CAKF,IAAM,EAAW,MAAM,EACrB,gCAEE,EACG,IAAI,gBAAgB,EAAW,oBAAoB,IAAe,CACjE,aAAc,CACZ,SACA,QACD,CACF,CAAC,CACD,MAAM,CACX,CAAE,SAAQ,YAAa,EAAG,YAAa,IAAK,CAC7C,CAEK,CAAE,SAAU,EAChB,EAAE,KAAK,CACL,MAAO,EAAE,MAAM,EAAe,CAC/B,CAAC,CACF,EACD,CACD,OAAO,QACA,EAAK,CACZ,MAAU,MAAM,kCAAkC,GAAK,UAAU,MAAQ,GAAK,UAAU,EC7E5F,eAAsB,EAA4C,CAChE,aACA,OACA,aACA,UACA,cAAc,IACd,eAAe,IACf,SACA,eAAe,EACf,mBAAmB,IAuBlB,CAED,GAAI,EAAe,IAAgB,EACjC,MAAU,MACR,iEAAiE,EAAa,iBAAiB,IAChG,CAIH,IAAM,EAAS,MAAM,EAAwB,EAAc,EAAM,CAC/D,SACA,aAAc,EACd,UAAW,QAAQ,IAAI,WACxB,CAAC,CAGI,EAAS,EAA4B,EAAc,EAAK,CAE1D,EAAoB,EACnB,IACH,EAAoB,MAAM,EAAgC,EAAQ,CAChE,aACD,CAAC,EAGJ,EAAO,KACL,EAAO,QACL,WAAW,EAAmB,MAAQ,EAAkB,mDACnC,EAAW,2BAA2B,EAAQ,KAAK,OAAO,CAAC,GACjF,CACF,CAGD,IAAM,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAC/E,EAAkB,IAAI,IAGtB,EAA0C,EAAE,CAE9C,EAAyC,EAAE,CAG1C,GACH,EAAY,MAAM,EAAmB,EAAE,CAEzC,MAAM,EAAU,EAAS,KAAO,IAAW,CACzC,IAAI,EAAS,EACT,EAAiB,GAGrB,KAAO,GAAgB,CACrB,IAAM,EAAkB,MAAM,EAA0B,EAAQ,CAC9D,aACA,MAAO,EACP,SACA,YAAa,EACd,CAAC,CAEI,EAAoD,EAAgB,IACvE,IACC,EAAgB,IAAI,EAAW,UAAU,CAClC,CACL,GAAG,EACH,SACD,EAEJ,CAEK,EAA0B,EAAsB,KACnD,CAAE,aAAY,YAAW,GAAG,MAAkB,CAC7C,GAAG,EACH,GAAI,EACA,CACE,YAAa,EAAU,GACvB,cAAe,EAAU,KACzB,aAAc,EAAU,UACzB,CACD,EAAE,CACN,GAAG,EAAW,QACX,EAAK,IACJ,OAAO,OAAO,EAAK,EAChB,EAAI,KAAM,EAAI,OAAO,KAAK,IAAI,CAChC,CAAC,CACJ,EAAE,CACH,CACF,EACF,CAED,EAAY,KAAK,GAAG,EAAsB,CAC1C,EAAa,KAAK,GAAG,EAAwB,CAGzC,EAAa,QAAU,IACzB,MAAM,EAAO,EAAa,CAC1B,EAAe,EAAE,EAGnB,EAAiB,EAAgB,SAAW,EAC5C,GAAU,EACL,EAGH,EAAO,KACL,EAAO,QACL,UAAU,EAAgB,OAAO,+BAA+B,EAAgB,KAAK,WACtF,CACF,CAND,EAAY,OAAO,EAAgB,KAAK,GAS5C,CAGE,EAAa,OAAS,GACxB,MAAM,EAAO,EAAa,CAGvB,GACH,EAAY,MAAM,CAGpB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAUvB,OARA,EAAO,KACL,EAAO,MACL,uBAAuB,EAAY,OAAO,gCACxC,EAAgB,KACjB,gBAAgB,EAAY,IAAK,YACnC,CACF,CAEM,CAAE,cAAa"}
|
|
1
|
+
{"version":3,"file":"pullChunkedCustomSiloOutstandingIdentifiers-BLgrmhmd.mjs","names":[],"sources":["../src/lib/graphql/fetchRequestDataSiloActiveCount.ts","../src/lib/cron/pullCronPageOfIdentifiers.ts","../src/lib/cron/pullChunkedCustomSiloOutstandingIdentifiers.ts"],"sourcesContent":["import { makeGraphQLRequest, REDUCED_REQUESTS_FOR_DATA_SILO_COUNT } from '@transcend-io/sdk';\nimport { GraphQLClient } from 'graphql-request';\n\nimport { logger } from '../../logger.js';\n\n/**\n * Get number of open requests for a data silo\n *\n * @param client - GraphQL client\n * @param options - Filter options\n * @returns List of request identifiers\n */\nexport async function fetchRequestDataSiloActiveCount(\n client: GraphQLClient,\n {\n dataSiloId,\n }: {\n /** Data silo ID */\n dataSiloId: string;\n },\n): Promise<number> {\n const {\n listReducedRequestsForDataSilo: { totalCount },\n } = await makeGraphQLRequest<{\n /** Requests */\n listReducedRequestsForDataSilo: {\n /** Total count */\n totalCount: number;\n };\n }>(client, REDUCED_REQUESTS_FOR_DATA_SILO_COUNT, {\n variables: {\n input: {\n dataSiloId,\n isResolved: false,\n },\n },\n logger,\n });\n\n return totalCount;\n}\n","import { RequestAction } from '@transcend-io/privacy-types';\nimport { withTransientRetry } from '@transcend-io/sdk';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport type { Got } from 'got';\nimport * as t from 'io-ts';\n\nimport { logger } from '../../logger.js';\n\n/** Consent partition metadata when a DSR is scoped to a partition */\nexport const CronPartition = t.type({\n /** ID of the partition */\n id: t.string,\n /** The human readable name of the partition */\n name: t.string,\n /** The unique identifying partition value */\n partition: t.string,\n});\n\n/** Type override */\nexport type CronPartition = t.TypeOf<typeof CronPartition>;\n\nexport const CronIdentifier = t.intersection([\n t.type({\n /** The identifier value */\n identifier: t.string,\n /** The type of identifier */\n type: t.string,\n /** The core identifier of the request */\n coreIdentifier: t.string,\n /** The ID of the underlying data silo */\n dataSiloId: t.string,\n /** The ID of the underlying request */\n requestId: t.string,\n /** The request nonce */\n nonce: t.string,\n /** The time the request was created */\n requestCreatedAt: t.string,\n /** The number of days until the request is overdue */\n daysUntilOverdue: t.number,\n /** Request attributes */\n attributes: t.array(\n t.type({\n key: t.string,\n values: t.array(t.string),\n }),\n ),\n }),\n t.partial({\n /** The consent partition that scopes this request, when applicable */\n partition: t.union([CronPartition, t.null]),\n }),\n]);\n\n/** Type override */\nexport type CronIdentifier = t.TypeOf<typeof CronIdentifier>;\n\n/**\n * Pull a offset of identifiers for a cron job\n *\n * @see https://docs.transcend.io/docs/api-reference/GET/v1/data-silo/(id)/pending-requests/(type)\n * @param sombra - Sombra instance configured to make requests\n * @param options - Additional options\n * @returns Successfully submitted request\n */\nexport async function pullCronPageOfIdentifiers(\n sombra: Got,\n {\n dataSiloId,\n limit = 100,\n offset = 0,\n requestType,\n }: {\n /** Data Silo ID */\n dataSiloId: string;\n /** Type of request */\n requestType: RequestAction;\n /** Number of identifiers to pull in */\n limit?: number;\n /** Page to pull in */\n offset?: number;\n },\n): Promise<CronIdentifier[]> {\n try {\n // `GET pending-requests` is a read and therefore safe to retry on transient\n // gateway / network errors. Customers running `transcend cron\n // pull-identifiers` against large silos would otherwise see the command\n // abort on a single 502 from the Sombra reverse tunnel.\n const response = await withTransientRetry(\n 'pullCronPageOfIdentifiers',\n () =>\n sombra\n .get(`v1/data-silo/${dataSiloId}/pending-requests/${requestType}`, {\n searchParams: {\n offset,\n limit,\n },\n })\n .json(),\n { logger, maxAttempts: 6, baseDelayMs: 500 },\n );\n\n const { items } = decodeCodec(\n t.type({\n items: t.array(CronIdentifier),\n }),\n response,\n );\n return items;\n } catch (err) {\n throw new Error(`Received an error from server: ${err?.response?.body || err?.message}`);\n }\n}\n","import { RequestAction } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, createSombraGotInstance } from '@transcend-io/sdk';\nimport { mapSeries } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { fetchRequestDataSiloActiveCount } from '../graphql/index.js';\nimport { pullCronPageOfIdentifiers, CronIdentifier } from './pullCronPageOfIdentifiers.js';\n\n/**\n * A CSV formatted identifier\n */\nexport type CsvFormattedIdentifier = {\n [k in string]: string | null | boolean | number;\n};\n\nexport interface CronIdentifierWithAction extends CronIdentifier {\n /** The request action that the identifier relates to */\n action: RequestAction;\n}\n\n/**\n * Pull the set of identifiers outstanding for a cron or AVC integration\n *\n * This function is designed to be used in a loop, and will call the onSave callback\n * with a chunk of identifiers when the savePageSize is reached.\n *\n * @param options - Options\n * @returns The identifiers and identifiers formatted for CSV\n */\nexport async function pullChunkedCustomSiloOutstandingIdentifiers({\n dataSiloId,\n auth,\n sombraAuth,\n actions,\n apiPageSize = 100,\n savePageSize = 1000,\n onSave,\n transcendUrl = DEFAULT_TRANSCEND_API,\n skipRequestCount = false,\n}: {\n /** Transcend API key authentication */\n auth: string;\n /** Data Silo ID to pull down jobs for */\n dataSiloId: string;\n /** The request actions to fetch */\n actions: RequestAction[];\n /** How many identifiers to pull in a single call to the backend */\n apiPageSize: number;\n /** How many identifiers to save at a time (usually to a CSV file, should be a multiple of apiPageSize) */\n savePageSize: number;\n /** Callback function called when a chunk of identifiers is ready to be saved */\n onSave: (chunk: CsvFormattedIdentifier[]) => Promise<void>;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** Sombra API key authentication */\n sombraAuth?: string;\n /** Skip request count */\n skipRequestCount?: boolean;\n}): Promise<{\n /** Raw Identifiers */\n identifiers: CronIdentifierWithAction[];\n}> {\n // Validate savePageSize\n if (savePageSize % apiPageSize !== 0) {\n throw new Error(\n `savePageSize must be a multiple of apiPageSize. savePageSize: ${savePageSize}, apiPageSize: ${apiPageSize}`,\n );\n }\n\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, {\n logger,\n sombraApiKey: sombraAuth,\n sombraUrl: process.env.SOMBRA_URL,\n });\n\n // Create GraphQL client to connect to Transcend backend\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n let totalRequestCount = 0;\n if (!skipRequestCount) {\n totalRequestCount = await fetchRequestDataSiloActiveCount(client, {\n dataSiloId,\n });\n }\n\n logger.info(\n colors.magenta(\n `Pulling ${skipRequestCount ? 'all' : totalRequestCount} outstanding request identifiers ` +\n `for data silo: \"${dataSiloId}\" for requests of types \"${actions.join('\", \"')}\"`,\n ),\n );\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n const foundRequestIds = new Set<string>();\n\n // identifiers found in total\n const identifiers: CronIdentifierWithAction[] = [];\n // current chunk of identifiers to be saved\n let currentChunk: CsvFormattedIdentifier[] = [];\n\n // map over each action\n if (!skipRequestCount) {\n progressBar.start(totalRequestCount, 0);\n }\n await mapSeries(actions, async (action) => {\n let offset = 0;\n let shouldContinue = true;\n\n // Fetch a page of identifiers\n while (shouldContinue) {\n const pageIdentifiers = await pullCronPageOfIdentifiers(sombra, {\n dataSiloId,\n limit: apiPageSize,\n offset,\n requestType: action,\n });\n\n const identifiersWithAction: CronIdentifierWithAction[] = pageIdentifiers.map(\n (identifier) => {\n foundRequestIds.add(identifier.requestId);\n return {\n ...identifier,\n action,\n };\n },\n );\n\n const csvFormattedIdentifiers = identifiersWithAction.map(\n ({ attributes, partition, ...identifier }) => ({\n ...identifier,\n ...(partition\n ? {\n partitionId: partition.id,\n partitionName: partition.name,\n partitionKey: partition.partition,\n }\n : {}),\n ...attributes.reduce(\n (acc, val) =>\n Object.assign(acc, {\n [val.key]: val.values.join(','),\n }),\n {},\n ),\n }),\n );\n\n identifiers.push(...identifiersWithAction);\n currentChunk.push(...csvFormattedIdentifiers);\n\n // Check if we've reached the savePageSize and call the onSave callback\n if (currentChunk.length >= savePageSize) {\n await onSave(currentChunk);\n currentChunk = [];\n }\n\n shouldContinue = pageIdentifiers.length === apiPageSize;\n offset += apiPageSize;\n if (!skipRequestCount) {\n progressBar.update(foundRequestIds.size);\n } else {\n logger.info(\n colors.magenta(\n `Pulled ${pageIdentifiers.length} outstanding identifiers for ${foundRequestIds.size} requests`,\n ),\n );\n }\n }\n });\n\n // Save any remaining identifiers in the current chunk\n if (currentChunk.length > 0) {\n await onSave(currentChunk);\n }\n\n if (!skipRequestCount) {\n progressBar.stop();\n }\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully pulled ${identifiers.length} outstanding identifiers from ${\n foundRequestIds.size\n } requests in \"${totalTime / 1000}\" seconds!`,\n ),\n );\n\n return { identifiers };\n}\n"],"mappings":"0bAYA,eAAsB,EACpB,EACA,CACE,cAKe,CACjB,GAAM,CACJ,+BAAgC,CAAE,eAChC,MAAM,EAMP,EAAQ,EAAsC,CAC/C,UAAW,CACT,MAAO,CACL,aACA,WAAY,GACb,CACF,CACD,SACD,CAAC,CAEF,OAAO,EC9BT,MAAa,EAAgB,EAAE,KAAK,CAElC,GAAI,EAAE,OAEN,KAAM,EAAE,OAER,UAAW,EAAE,OACd,CAAC,CAKW,EAAiB,EAAE,aAAa,CAC3C,EAAE,KAAK,CAEL,WAAY,EAAE,OAEd,KAAM,EAAE,OAER,eAAgB,EAAE,OAElB,WAAY,EAAE,OAEd,UAAW,EAAE,OAEb,MAAO,EAAE,OAET,iBAAkB,EAAE,OAEpB,iBAAkB,EAAE,OAEpB,WAAY,EAAE,MACZ,EAAE,KAAK,CACL,IAAK,EAAE,OACP,OAAQ,EAAE,MAAM,EAAE,OAAO,CAC1B,CAAC,CACH,CACF,CAAC,CACF,EAAE,QAAQ,CAER,UAAW,EAAE,MAAM,CAAC,EAAe,EAAE,KAAK,CAAC,CAC5C,CAAC,CACH,CAAC,CAaF,eAAsB,EACpB,EACA,CACE,aACA,QAAQ,IACR,SAAS,EACT,eAWyB,CAC3B,GAAI,CAKF,IAAM,EAAW,MAAM,EACrB,gCAEE,EACG,IAAI,gBAAgB,EAAW,oBAAoB,IAAe,CACjE,aAAc,CACZ,SACA,QACD,CACF,CAAC,CACD,MAAM,CACX,CAAE,SAAQ,YAAa,EAAG,YAAa,IAAK,CAC7C,CAEK,CAAE,SAAU,EAChB,EAAE,KAAK,CACL,MAAO,EAAE,MAAM,EAAe,CAC/B,CAAC,CACF,EACD,CACD,OAAO,QACA,EAAK,CACZ,MAAU,MAAM,kCAAkC,GAAK,UAAU,MAAQ,GAAK,UAAU,EC7E5F,eAAsB,EAA4C,CAChE,aACA,OACA,aACA,UACA,cAAc,IACd,eAAe,IACf,SACA,eAAe,EACf,mBAAmB,IAuBlB,CAED,GAAI,EAAe,IAAgB,EACjC,MAAU,MACR,iEAAiE,EAAa,iBAAiB,IAChG,CAIH,IAAM,EAAS,MAAM,EAAwB,EAAc,EAAM,CAC/D,SACA,aAAc,EACd,UAAW,QAAQ,IAAI,WACxB,CAAC,CAGI,EAAS,EAA4B,EAAc,EAAK,CAE1D,EAAoB,EACnB,IACH,EAAoB,MAAM,EAAgC,EAAQ,CAChE,aACD,CAAC,EAGJ,EAAO,KACL,EAAO,QACL,WAAW,EAAmB,MAAQ,EAAkB,mDACnC,EAAW,2BAA2B,EAAQ,KAAK,OAAO,CAAC,GACjF,CACF,CAGD,IAAM,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAC/E,EAAkB,IAAI,IAGtB,EAA0C,EAAE,CAE9C,EAAyC,EAAE,CAG1C,GACH,EAAY,MAAM,EAAmB,EAAE,CAEzC,MAAM,EAAU,EAAS,KAAO,IAAW,CACzC,IAAI,EAAS,EACT,EAAiB,GAGrB,KAAO,GAAgB,CACrB,IAAM,EAAkB,MAAM,EAA0B,EAAQ,CAC9D,aACA,MAAO,EACP,SACA,YAAa,EACd,CAAC,CAEI,EAAoD,EAAgB,IACvE,IACC,EAAgB,IAAI,EAAW,UAAU,CAClC,CACL,GAAG,EACH,SACD,EAEJ,CAEK,EAA0B,EAAsB,KACnD,CAAE,aAAY,YAAW,GAAG,MAAkB,CAC7C,GAAG,EACH,GAAI,EACA,CACE,YAAa,EAAU,GACvB,cAAe,EAAU,KACzB,aAAc,EAAU,UACzB,CACD,EAAE,CACN,GAAG,EAAW,QACX,EAAK,IACJ,OAAO,OAAO,EAAK,EAChB,EAAI,KAAM,EAAI,OAAO,KAAK,IAAI,CAChC,CAAC,CACJ,EAAE,CACH,CACF,EACF,CAED,EAAY,KAAK,GAAG,EAAsB,CAC1C,EAAa,KAAK,GAAG,EAAwB,CAGzC,EAAa,QAAU,IACzB,MAAM,EAAO,EAAa,CAC1B,EAAe,EAAE,EAGnB,EAAiB,EAAgB,SAAW,EAC5C,GAAU,EACL,EAGH,EAAO,KACL,EAAO,QACL,UAAU,EAAgB,OAAO,+BAA+B,EAAgB,KAAK,WACtF,CACF,CAND,EAAY,OAAO,EAAgB,KAAK,GAS5C,CAGE,EAAa,OAAS,GACxB,MAAM,EAAO,EAAa,CAGvB,GACH,EAAY,MAAM,CAGpB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAUvB,OARA,EAAO,KACL,EAAO,MACL,uBAAuB,EAAY,OAAO,gCACxC,EAAgB,KACjB,gBAAgB,EAAY,IAAK,YACnC,CACF,CAEM,CAAE,cAAa"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./constants-
|
|
2
|
-
//# sourceMappingURL=pullManualEnrichmentIdentifiersToCsv-
|
|
1
|
+
import{a as e}from"./constants-BdSIZSI2.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{r as n}from"./fetchAllRequests-CHHdyb4Q.mjs";import{a as r}from"./writeCsv-C4pjXGsD.mjs";import{RequestStatus as i}from"@transcend-io/privacy-types";import{groupBy as a,uniq as o}from"lodash-es";import s from"colors";import{buildTranscendGraphQLClient as c,createSombraGotInstance as l,fetchAllRequestEnrichers as u,fetchAllRequestIdentifiers as d,validateSombraVersion as f}from"@transcend-io/sdk";import{map as p}from"@transcend-io/utils";async function m({file:m,auth:h,sombraAuth:g,requestActions:_=[],concurrency:v=100,transcendUrl:y=e}){let b=c(y,h),x=await l(y,h,{logger:t,sombraApiKey:g,sombraUrl:process.env.SOMBRA_URL});t.info(s.magenta(`Pulling manual enrichment requests, filtered for actions: ${_.join(`,`)}`));let S=await n(b,{actions:_,statuses:[i.Enriching]});await f(b,{logger:t});let C=[];await p(S,async e=>{let n=await u(b,{filterBy:{requestId:e.id},logger:t});if(n.filter(({status:e})=>e===`ACTION_REQUIRED`)){let r=await d(b,x,{filterBy:{requestId:e.id},skipSombraCheck:!0,logger:t});C.push({...e,requestIdentifiers:r,requestEnrichers:n})}},{concurrency:v});let w=C.map(({attributeValues:e,requestIdentifiers:t,requestEnrichers:n,...r})=>({...r,...Object.entries(a(t,`name`)).reduce((e,[t,n])=>Object.assign(e,{[t]:n.map(({value:e})=>e).join(`,`)}),{}),...Object.entries(a(e,`attributeKey.name`)).reduce((e,[t,n])=>Object.assign(e,{[t]:n.map(({name:e})=>e).join(`,`)}),{})}));return await r(m,w,o(w.map(e=>Object.keys(e)).flat())),t.info(s.green(`Successfully wrote ${C.length} requests to file "${m}"`)),C}export{m as t};
|
|
2
|
+
//# sourceMappingURL=pullManualEnrichmentIdentifiersToCsv-Boam7IAS.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pullManualEnrichmentIdentifiersToCsv-
|
|
1
|
+
{"version":3,"file":"pullManualEnrichmentIdentifiersToCsv-Boam7IAS.mjs","names":[],"sources":["../src/lib/manual-enrichment/pullManualEnrichmentIdentifiersToCsv.ts"],"sourcesContent":["import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n fetchAllRequestEnrichers,\n fetchAllRequestIdentifiers,\n validateSombraVersion,\n type RequestEnricher,\n type RequestIdentifier,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport colors from 'colors';\nimport { groupBy, uniq } from 'lodash-es';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { type PrivacyRequest, fetchAllRequests } from '../graphql/index.js';\nimport { writeCsv } from '../helpers/writeCsv.js';\n\nexport interface PrivacyRequestWithIdentifiers extends PrivacyRequest {\n /** Request Enrichers */\n requestEnrichers: RequestEnricher[];\n /** Request Identifiers */\n requestIdentifiers: RequestIdentifier[];\n}\n\n/**\n * Pull the set of manual enrichment jobs to CSV\n *\n * @param options - Options\n * @returns List of requests with identifiers\n */\nexport async function pullManualEnrichmentIdentifiersToCsv({\n file,\n auth,\n sombraAuth,\n requestActions = [],\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** Sombra API key */\n sombraAuth?: string;\n /** Concurrency */\n concurrency?: number;\n /** The request actions to fetch */\n requestActions?: RequestAction[];\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<PrivacyRequestWithIdentifiers[]> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const sombra = await createSombraGotInstance(transcendUrl, auth, {\n logger,\n sombraApiKey: sombraAuth,\n sombraUrl: process.env.SOMBRA_URL,\n });\n\n logger.info(\n colors.magenta(\n `Pulling manual enrichment requests, filtered for actions: ${requestActions.join(',')}`,\n ),\n );\n\n // Pull all privacy requests\n const allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n statuses: [RequestStatus.Enriching],\n });\n\n await validateSombraVersion(client, { logger });\n\n // Requests to save\n const savedRequests: PrivacyRequestWithIdentifiers[] = [];\n\n // Filter down requests to what is needed\n await map(\n allRequests,\n async (request) => {\n // Fetch enrichers\n const requestEnrichers = await fetchAllRequestEnrichers(client, {\n filterBy: { requestId: request.id },\n logger,\n });\n\n // Check if manual enrichment exists for that request\n const hasManualEnrichment = requestEnrichers.filter(\n ({ status }) => status === 'ACTION_REQUIRED',\n );\n\n // Save request to queue\n if (hasManualEnrichment) {\n const requestIdentifiers = await fetchAllRequestIdentifiers(client, sombra, {\n filterBy: { requestId: request.id },\n skipSombraCheck: true,\n logger,\n });\n savedRequests.push({\n ...request,\n requestIdentifiers,\n requestEnrichers,\n });\n }\n },\n {\n concurrency,\n },\n );\n\n const data = savedRequests.map(\n ({\n attributeValues,\n requestIdentifiers,\n requestEnrichers, // eslint-disable-line @typescript-eslint/no-unused-vars\n ...request\n }) => ({\n ...request,\n // flatten identifiers\n ...Object.entries(groupBy(requestIdentifiers, 'name')).reduce(\n (acc, [key, values]) =>\n Object.assign(acc, {\n [key]: values.map(({ value }) => value).join(','),\n }),\n {},\n ),\n // flatten attributes\n ...Object.entries(groupBy(attributeValues, 'attributeKey.name')).reduce(\n (acc, [key, values]) =>\n Object.assign(acc, {\n [key]: values.map(({ name }) => name).join(','),\n }),\n {},\n ),\n }),\n );\n\n // Write out to CSV\n const headers = uniq(data.map((d) => Object.keys(d)).flat());\n await writeCsv(file, data, headers);\n\n logger.info(\n colors.green(`Successfully wrote ${savedRequests.length} requests to file \"${file}\"`),\n );\n\n return savedRequests;\n}\n"],"mappings":"khBAgCA,eAAsB,EAAqC,CACzD,OACA,OACA,aACA,iBAAiB,EAAE,CACnB,cAAc,IACd,eAAe,GAc4B,CAE3C,IAAM,EAAS,EAA4B,EAAc,EAAK,CACxD,EAAS,MAAM,EAAwB,EAAc,EAAM,CAC/D,SACA,aAAc,EACd,UAAW,QAAQ,IAAI,WACxB,CAAC,CAEF,EAAO,KACL,EAAO,QACL,6DAA6D,EAAe,KAAK,IAAI,GACtF,CACF,CAGD,IAAM,EAAc,MAAM,EAAiB,EAAQ,CACjD,QAAS,EACT,SAAU,CAAC,EAAc,UAAU,CACpC,CAAC,CAEF,MAAM,EAAsB,EAAQ,CAAE,SAAQ,CAAC,CAG/C,IAAM,EAAiD,EAAE,CAGzD,MAAM,EACJ,EACA,KAAO,IAAY,CAEjB,IAAM,EAAmB,MAAM,EAAyB,EAAQ,CAC9D,SAAU,CAAE,UAAW,EAAQ,GAAI,CACnC,SACD,CAAC,CAQF,GAL4B,EAAiB,QAC1C,CAAE,YAAa,IAAW,kBAIN,CAAE,CACvB,IAAM,EAAqB,MAAM,EAA2B,EAAQ,EAAQ,CAC1E,SAAU,CAAE,UAAW,EAAQ,GAAI,CACnC,gBAAiB,GACjB,SACD,CAAC,CACF,EAAc,KAAK,CACjB,GAAG,EACH,qBACA,mBACD,CAAC,GAGN,CACE,cACD,CACF,CAED,IAAM,EAAO,EAAc,KACxB,CACC,kBACA,qBACA,mBACA,GAAG,MACE,CACL,GAAG,EAEH,GAAG,OAAO,QAAQ,EAAQ,EAAoB,OAAO,CAAC,CAAC,QACpD,EAAK,CAAC,EAAK,KACV,OAAO,OAAO,EAAK,EAChB,GAAM,EAAO,KAAK,CAAE,WAAY,EAAM,CAAC,KAAK,IAAI,CAClD,CAAC,CACJ,EAAE,CACH,CAED,GAAG,OAAO,QAAQ,EAAQ,EAAiB,oBAAoB,CAAC,CAAC,QAC9D,EAAK,CAAC,EAAK,KACV,OAAO,OAAO,EAAK,EAChB,GAAM,EAAO,KAAK,CAAE,UAAW,EAAK,CAAC,KAAK,IAAI,CAChD,CAAC,CACJ,EAAE,CACH,CACF,EACF,CAUD,OANA,MAAM,EAAS,EAAM,EADL,EAAK,EAAK,IAAK,GAAM,OAAO,KAAK,EAAE,CAAC,CAAC,MAAM,CACzB,CAAC,CAEnC,EAAO,KACL,EAAO,MAAM,sBAAsB,EAAc,OAAO,qBAAqB,EAAK,GAAG,CACtF,CAEM"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import{t as e}from"./logger-Bj782ZYD.mjs";import{ActionItemCode as t,ConsentTrackerStatus as n,RequestAction as r,RetentionType as i}from"@transcend-io/privacy-types";import{flatten as a,keyBy as o,mapValues as s}from"lodash-es";import c from"colors";import{ASSESSMENT_SECTION_FIELDS as l,convertToDataSubjectAllowlist as u,fetchAllActionItemCollections as d,fetchAllActionItems as f,fetchAllActions as p,fetchAllAgentFiles as m,fetchAllAgentFunctions as h,fetchAllAgents as g,fetchAllAssessments as _,fetchAllAttributes as v,fetchAllBusinessEntities as y,fetchAllCookies as b,fetchAllDataCategories as x,fetchAllDataFlows as S,fetchAllDataSubjects as C,fetchAllEnrichers as w,fetchAllIdentifiers as T,fetchAllMessages as E,fetchAllPolicies as D,fetchAllPrivacyCenters as O,fetchAllProcessingActivities as ee,fetchAllProcessingPurposes as te,fetchAllPromptGroups as ne,fetchAllPromptPartials as re,fetchAllPrompts as ie,fetchAllPurposesAndPreferences as ae,fetchAllSiloDiscoveryResults as oe,fetchAllTeams as se,fetchAllTemplates as ce,fetchAllVendors as le,fetchApiKeys as ue,fetchConsentManager as de,fetchConsentManagerExperiences as fe,fetchConsentManagerTheme as pe,fetchConsentThemes as me,fetchConsentVariants as he,fetchEnrichedDataSilos as ge,fetchPartitions as _e,formatAttributeValues as k,formatRegions as A,makeGraphQLRequest as j,parseAssessmentDisplayLogic as M,parseAssessmentRiskLogic as N}from"@transcend-io/sdk";import{gql as P}from"graphql-request";const F=P`
|
|
2
|
+
query TranscendCliAssessmentTemplates(
|
|
3
|
+
$first: Int!
|
|
4
|
+
$offset: Int!
|
|
5
|
+
$filterBy: AssessmentFormTemplateFiltersInput
|
|
6
|
+
) {
|
|
7
|
+
assessmentFormTemplates(
|
|
8
|
+
first: $first
|
|
9
|
+
offset: $offset
|
|
10
|
+
filterBy: $filterBy
|
|
11
|
+
) {
|
|
12
|
+
nodes {
|
|
13
|
+
id
|
|
14
|
+
creator {
|
|
15
|
+
id
|
|
16
|
+
email
|
|
17
|
+
name
|
|
18
|
+
}
|
|
19
|
+
lastEditor {
|
|
20
|
+
id
|
|
21
|
+
email
|
|
22
|
+
name
|
|
23
|
+
}
|
|
24
|
+
title
|
|
25
|
+
description
|
|
26
|
+
status
|
|
27
|
+
source
|
|
28
|
+
parentId
|
|
29
|
+
isLocked
|
|
30
|
+
isArchived
|
|
31
|
+
createdAt
|
|
32
|
+
updatedAt
|
|
33
|
+
retentionSchedule {
|
|
34
|
+
id
|
|
35
|
+
type
|
|
36
|
+
durationDays
|
|
37
|
+
operation
|
|
38
|
+
createdAt
|
|
39
|
+
updatedAt
|
|
40
|
+
}
|
|
41
|
+
assessmentEmailSet {
|
|
42
|
+
id
|
|
43
|
+
title
|
|
44
|
+
description
|
|
45
|
+
isDefault
|
|
46
|
+
templates {
|
|
47
|
+
id
|
|
48
|
+
title
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
sections {
|
|
52
|
+
${l}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`;async function I(t){let n=[],r=0,i=!1;do{let{assessmentFormTemplates:{nodes:a}}=await j(t,F,{variables:{first:20,offset:r},logger:e});n.push(...a),r+=20,i=a.length===20}while(i);return n.sort((e,t)=>e.title.localeCompare(t.title))}const L=[`dataSilos`,`enrichers`,`templates`,`apiKeys`];async function R(l,{dataSiloIds:j,integrationNames:P,debug:F,resources:R=L,pageSize:z,skipDatapoints:ve,includeGuessedCategories:B,skipSubDatapoints:ye,trackerStatuses:V=Object.values(n)}){if(j.length>0&&P.length>0)throw Error(`Only 1 of integrationNames OR dataSiloIds can be provided`);e.info(c.magenta(`Fetching data with page size ${z}...`));let[H,be,U,W,G,K,q,J,xe,Se,Ce,we,Y,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,X,Re,ze,Be,Ve,He,Ue,We,Ge,Ke]=await Promise.all([R.includes(`dataSilos`)||R.includes(`dataSubjects`)?C(l,{logger:e}):[],R.includes(`apiKeys`)?ue(l,{fetchAll:!0,logger:e}):[],R.includes(`dataSilos`)?ge(l,{ids:j,integrationNames:P,pageSize:z,debug:F,includeGuessedCategories:B,skipDatapoints:ve,skipSubDatapoints:ye,logger:e}):[],R.includes(`enrichers`)?w(l,{logger:e}):[],R.includes(`dataFlows`)?[...V.includes(n.Live)?await S(l,{logger:e,filterBy:{status:n.Live}}):[],...V.includes(n.NeedsReview)?await S(l,{logger:e,filterBy:{status:n.NeedsReview}}):[]]:[],R.includes(`cookies`)?[...V.includes(n.Live)?await b(l,{logger:e,filterBy:{status:n.Live}}):[],...V.includes(n.NeedsReview)?await b(l,{logger:e,filterBy:{status:n.NeedsReview}}):[]]:[],R.includes(`customFields`)?v(l,{logger:e}):[],R.includes(`templates`)?ce(l,{logger:e}):[],R.includes(`identifiers`)?T(l,{logger:e}):[],R.includes(`actions`)?p(l,{logger:e}):[],R.includes(`businessEntities`)?y(l,{logger:e}):[],R.includes(`processingActivities`)?ee(l,{logger:e}):[],R.includes(`consentManager`)?de(l,{logger:e}):void 0,R.includes(`consentManager`)?fe(l,{logger:e}):[],R.includes(`consentManager`)?he(l,{logger:e}):[],R.includes(`consentManager`)?me(l,{logger:e}):[],R.includes(`prompts`)?ie(l,{logger:e}):[],R.includes(`promptPartials`)?re(l,{logger:e}):[],R.includes(`promptGroups`)?ne(l,{logger:e}):[],R.includes(`agents`)?g(l,{logger:e}):[],R.includes(`agentFunctions`)?h(l,{logger:e}):[],R.includes(`agentFiles`)?m(l,{logger:e}):[],R.includes(`vendors`)?le(l,{logger:e}):[],R.includes(`dataCategories`)?x(l,{logger:e}):[],R.includes(`processingPurposes`)?te(l,{logger:e}):[],R.includes(`actionItems`)?f(l,{logger:e,filterBy:{type:[t.Onboarding]}}):[],R.includes(`actionItemCollections`)?d(l,{logger:e}):[],R.includes(`teams`)?se(l,{logger:e}):[],R.includes(`policies`)?D(l,{logger:e}):[],R.includes(`privacyCenters`)?O(l,{logger:e}):[],R.includes(`messages`)?E(l,{logger:e}):[],R.includes(`partitions`)?_e(l,{logger:e}):[],R.includes(`assessments`)?_(l,{logger:e}):[],R.includes(`assessmentTemplates`)?I(l):[],R.includes(`purposes`)?ae(l,{logger:e}):[],R.includes(`systemDiscovery`)?oe(l,{logger:e}):[]]),Z=R.includes(`consentManager`)&&Y?await pe(l,{logger:e,filterBy:{airgapBundleId:Y.id}}):void 0,Q={},qe=a(U.map(([{apiKeys:e}])=>e.map(({title:e})=>e))),$=Object.values(be).filter(({title:e})=>R.includes(`apiKeys`)?!0:qe.includes(e));if($.length>0&&R.includes(`apiKeys`)&&(Q[`api-keys`]=$.map(({title:e})=>({title:e}))),He.length>0&&R.includes(`partitions`)&&(Q.partitions=He.map(({name:e,partition:t})=>({name:e,partition:t}))),Y&&R.includes(`consentManager`)&&(Q[`consent-manager`]={bundleUrls:{TEST:Y.testBundleURL,PRODUCTION:Y.bundleURL},domains:Y.configuration.domains||void 0,partition:Y.configuration.partition||void 0,consentPrecedence:Y.configuration.consentPrecedence||void 0,unknownRequestPolicy:Y.configuration.unknownRequestPolicy||void 0,unknownCookiePolicy:Y.configuration.unknownCookiePolicy||void 0,syncEndpoint:Y.configuration.syncEndpoint||void 0,telemetryPartitioning:Y.configuration.telemetryPartitioning||void 0,signedIabAgreement:Y.configuration.signedIabAgreement||void 0,syncGroups:Y.configuration.syncGroups||void 0,theme:Z?{primaryColor:Z.primaryColor||void 0,fontColor:Z.fontColor||void 0,privacyPolicy:Z.privacyPolicy||void 0,prompt:Z.prompt}:void 0,experiences:Te.map(e=>({name:e.name,displayName:e.displayName||void 0,regions:e.regions.map(e=>({countrySubDivision:e.countrySubDivision||void 0,country:e.country||void 0})),onConsentExpiry:e.onConsentExpiry,consentExpiry:e.consentExpiry,operator:e.operator,displayPriority:e.displayPriority,viewState:e.viewState,purposes:e.purposes.map(e=>({trackingType:e.trackingType})),optedOutPurposes:e.optedOutPurposes.map(e=>({trackingType:e.trackingType})),browserLanguages:e.browserLanguages,browserTimeZones:e.browserTimeZones,consentUiVariantSlug:e.consentUiVariant?.slug})),consentVariants:Ee.map(e=>({id:e.id,name:e.name,slug:e.slug,description:e.description,configuration:JSON.stringify(e.configuration),locales:e.locales,status:e.status,userFlow:e.userFlow,themeSlug:e.theme?.slug})),consentThemes:De.map(e=>({id:e.id,name:e.name,slug:e.slug,configuration:JSON.stringify(e.configuration)}))}),Ue.length>0&&R.includes(`assessments`)&&(Q.assessments=Ue.map(({title:e,assessmentGroup:t,sections:n,creator:r,description:i,status:a,assignees:o,externalAssignees:s,reviewers:c,isLocked:l,isArchived:u,isExternallyCreated:d,dueDate:f,createdAt:p,assignedAt:m,submittedAt:h,approvedAt:g,rejectedAt:_,titleIsInternal:v,retentionSchedule:y,attributeValues:b,resources:x,syncedRows:S})=>({title:e,group:t.title,sections:n.map(({title:e,status:t,questions:n,assignees:r,isReviewed:i,externalAssignees:a})=>({title:e,status:t,questions:n.map(({title:e,type:t,subType:n,placeholder:r,description:i,isRequired:a,referenceId:o,displayLogic:s,riskLogic:c,riskCategories:l,riskFramework:u,answerOptions:d,selectedAnswers:f,allowedMimeTypes:p,allowSelectOther:m,syncModel:h,syncColumn:g,attributeKey:_,requireRiskEvaluation:v,requireRiskMatrixEvaluation:y})=>{let b=s?M(s):void 0;return{title:e,type:t,"sub-type":n,placeholder:r,description:i,"is-required":a,"reference-id":o,"display-logic":b&&Object.keys(b).length>0?{action:b.action,rule:b.rule?{"depends-on-question-reference-id":b.rule.dependsOnQuestionReferenceId,"comparison-operator":b.rule.comparisonOperator,"comparison-operands":`comparisonOperands`in b.rule?b.rule.comparisonOperands:void 0}:void 0,"nested-rule":b.nestedRule?{"logic-operator":b.nestedRule.logicOperator,rules:(b.nestedRule.rules||[]).map(e=>({"depends-on-question-reference-id":e.dependsOnQuestionReferenceId,"comparison-operator":e.comparisonOperator,"comparison-operands":`comparisonOperands`in e?e.comparisonOperands:void 0}))}:void 0}:void 0,"risk-logic":c.map(e=>{let t=N(e);return{"risk-level":t.riskAssignment?.riskLevelId,"comparison-operands":t.comparisonOperands,"comparison-operator":t.comparisonOperator}}),"risk-categories":l.map(({title:e})=>e),"risk-framework":u?.title,"answer-options":d.map(({value:e})=>({value:e})),"selected-answers":f.map(({value:e})=>e),"allowed-mime-types":p,"allow-select-other":m,"sync-model":h||void 0,"sync-column":g||void 0,"attribute-key":_?.name,"require-risk-evaluation":v,"require-risk-matrix-evaluation":y}}),assignees:r.map(({email:e})=>e),"external-assignees":a.map(({email:e})=>e),"is-reviewed":i})),creator:r?.email,description:i,status:a,assignees:o.map(({email:e})=>e),"external-assignees":s.map(({email:e})=>e),reviewers:c.map(({email:e})=>e),locked:l,archived:u,external:d,"title-is-internal":v,"due-date":f||void 0,"created-at":p||void 0,"assigned-at":m||void 0,"submitted-at":h||void 0,"approved-at":g||void 0,"rejected-at":_||void 0,"retention-schedule":y?{type:y.type,"duration-days":y.durationDays,operand:y.operation}:void 0,attributes:b!==void 0&&b.length>0?k(b):void 0,resources:x.map(({resourceType:e,title:t,name:n,category:r,type:i,purpose:a})=>({type:e,title:r?`${r} - ${n}`:a?`${a} - ${n}`:t||n||i||``})),rows:S.map(({resourceType:e,title:t,name:n,category:r,type:i,purpose:a})=>({type:e,title:r?`${r} - ${n}`:a?`${a} - ${n}`:t||n||i||``}))}))),We.length>0&&R.includes(`assessmentTemplates`)&&(Q[`assessment-templates`]=We.map(({title:e,description:t,sections:n,status:r,source:i,creator:a,isLocked:o,isArchived:s,createdAt:c,retentionSchedule:l})=>({title:e,description:t,sections:n.map(({title:e,questions:t})=>({title:e,questions:t.map(({title:e,type:t,subType:n,placeholder:r,description:i,isRequired:a,referenceId:o,displayLogic:s,riskLogic:c,riskCategories:l,riskFramework:u,answerOptions:d,allowedMimeTypes:f,allowSelectOther:p,syncModel:m,syncColumn:h,attributeKey:g,requireRiskEvaluation:_,requireRiskMatrixEvaluation:v})=>{let y=s?M(s):void 0;return{title:e,type:t,"sub-type":n,placeholder:r,description:i,"is-required":a,"reference-id":o,"display-logic":y&&Object.keys(y).length>0?{action:y.action,rule:y.rule?{"depends-on-question-reference-id":y.rule.dependsOnQuestionReferenceId,"comparison-operator":y.rule.comparisonOperator,"comparison-operands":`comparisonOperands`in y.rule?y.rule.comparisonOperands:void 0}:void 0,"nested-rule":y.nestedRule?{"logic-operator":y.nestedRule.logicOperator,rules:(y.nestedRule.rules||[]).map(e=>({"depends-on-question-reference-id":e.dependsOnQuestionReferenceId,"comparison-operator":e.comparisonOperator,"comparison-operands":`comparisonOperands`in e?e.comparisonOperands:void 0}))}:void 0}:void 0,"risk-logic":c.map(e=>{let t=N(e);return{"risk-level":t.riskAssignment?.riskLevelId,"risk-matrix-row":t.riskAssignment?.riskMatrixRowId,"risk-matrix-column":t.riskAssignment?.riskMatrixColumnId,"comparison-operands":t.comparisonOperands,"comparison-operator":t.comparisonOperator}}),"risk-categories":l.map(({title:e})=>e),"risk-framework":u?.title,"answer-options":d.map(({value:e})=>({value:e})),"allowed-mime-types":f,"allow-select-other":p,"sync-model":m||void 0,"sync-column":h||void 0,"attribute-key":g?.name,"require-risk-evaluation":_,"require-risk-matrix-evaluation":v}})})),status:r,source:i,creator:a?.email,locked:o,archived:s,"created-at":c||void 0,"retention-schedule":l?{type:l.type,"duration-days":l.durationDays,operand:l.operation}:void 0}))),Ke.length>0&&R.includes(`systemDiscovery`)&&(Q[`system-discovery`]=Ke.map(({title:e,resourceId:t,suggestedCatalog:{title:n},plugin:{dataSilo:{title:r}},country:i,countrySubDivision:a,plaintextContext:o,containsSensitiveData:s,status:c})=>({title:e,resourceId:t,suggestedCatalog:n,plugin:r,country:i||void 0,countrySubDivision:a||void 0,plaintextContext:o,containsSensitiveData:s,status:c}))),Oe.length>0&&R.includes(`prompts`)&&(Q.prompts=Oe.map(({title:e,content:t})=>({title:e,content:t}))),ke.length>0&&R.includes(`promptPartials`)&&(Q[`prompt-partials`]=ke.map(({title:e,content:t})=>({title:e,content:t}))),Ae.length>0&&R.includes(`promptGroups`)&&(Q[`prompt-groups`]=Ae.map(({title:e,description:t,prompts:n})=>({title:e,description:t,prompts:n.map(({title:e})=>e)}))),Re.length>0&&R.includes(`teams`)&&(Q.teams=Re.map(({name:e,description:t,ssoDepartment:n,ssoGroup:r,ssoTitle:i,users:a,scopes:o,parentTeam:s})=>({name:e,description:t,"sso-department":n||void 0,"sso-group":r||void 0,"sso-title":i||void 0,"parent-team-name":s?.name,users:a.map(({email:e})=>e),scopes:o.map(({name:e})=>e)}))),H.length>0&&R.includes(`dataSubjects`)&&(Q[`data-subjects`]=H.map(({type:e,title:t,active:n,adminDashboardDefaultSilentMode:r,actions:i})=>({type:e,title:t?.defaultMessage,active:n,adminDashboardDefaultSilentMode:r,actions:i.map(({type:e})=>e)}))),ze.length>0&&(Q.policies=ze.map(({title:e,versions:t,disabledLocales:n})=>({title:e?.defaultMessage,content:t?.[0]?.content?.defaultMessage,disabledLocales:n}))),Ve.length>0&&(Q.messages=Ve.map(({id:e,defaultMessage:t,targetReactIntlId:n,description:r,translations:i})=>({id:e,defaultMessage:t,description:r,targetReactIntlId:n||void 0,translations:i.reduce((e,{locale:t,value:n})=>Object.assign(e,{[t]:n}),{})}))),Be.length>0){let e=Be[0];Q[`privacy-center`]={isDisabled:e.isDisabled,showPrivacyRequestButton:e.showPrivacyRequestButton,showPolicies:e.showPolicies,showTrackingTechnologies:e.showTrackingTechnologies,showCookies:e.showCookies,showDataFlows:e.showDataFlows,showConsentManager:e.showConsentManager,showManageYourPrivacy:e.showManageYourPrivacy,showMarketingPreferences:e.showMarketingPreferences,locales:e.locales,defaultLocale:e.defaultLocale,preferBrowserDefaultLocale:e.preferBrowserDefaultLocale,supportEmail:e.supportEmail||void 0,replyToEmail:e.replyToEmail||void 0,useNoReplyEmailAddress:e.useNoReplyEmailAddress,useCustomEmailDomain:e.useCustomEmailDomain,transformAccessReportJsonToCsv:e.transformAccessReportJsonToCsv,theme:e.theme}}if(Ce.length>0&&R.includes(`businessEntities`)&&(Q[`business-entities`]=Ce.map(({title:e,description:t,address:n,headquarterCountry:r,headquarterSubDivision:i,dataProtectionOfficerName:a,dataProtectionOfficerEmail:o,attributeValues:s})=>({title:e,description:t||void 0,address:n||void 0,headquarterCountry:r||void 0,headquarterSubDivision:i||void 0,dataProtectionOfficerName:a||void 0,dataProtectionOfficerEmail:o||void 0,attributes:s!==void 0&&s.length>0?k(s):void 0}))),we.length>0&&R.includes(`processingActivities`)&&(Q[`processing-activities`]=we.map(({title:e,description:t,securityMeasureDetails:n,controllerships:r,storageRegions:a,transferRegions:o,retentionType:s,retentionPeriod:c,dataProtectionImpactAssessmentLink:l,dataProtectionImpactAssessmentStatus:u,attributeValues:d,dataSilos:f,dataSubjects:p,teams:m,owners:h,processingPurposeSubCategories:g,dataSubCategories:_,saaSCategories:v})=>({title:e,description:t,securityMeasureDetails:n??void 0,controllerships:r.length>0?r:void 0,storageRegions:a.length>0?A(a):void 0,transferRegions:o.length>0?A(o):void 0,retentionType:s,retentionPeriod:s===i.StatedPeriod?c:void 0,dataProtectionImpactAssessmentLink:l??void 0,dataProtectionImpactAssessmentStatus:u,attributes:d!==void 0&&d.length>0?k(d):void 0,dataSiloTitles:f.length>0?f.map(({title:e})=>e):void 0,dataSubjectTypes:p.length>0?p.map(({type:e})=>e):void 0,teamNames:m.length>0?m.map(({name:e})=>e):void 0,ownerEmails:h.length>0?h.map(({email:e})=>e):void 0,processingSubPurposes:g.length>0?g.map(({name:e,purpose:t})=>({purpose:t,...e?{name:e}:{}})):void 0,dataSubCategories:_.length>0?_.map(({name:e,category:t})=>({category:t,...e?{name:e}:{}})):void 0,saaSCategories:v.length>0?v.map(({title:e})=>e):void 0}))),Se.length>0&&R.includes(`actions`)&&(Q.actions=Se.map(({type:e,skipSecondaryIfNoFiles:t,skipDownloadableStep:n,requiresReview:i,regionList:a,regionDetectionMethod:o,waitingPeriod:s})=>({type:e,...e===r.Erasure?{skipSecondaryIfNoFiles:t,skipDownloadableStep:n}:{},requiresReview:i,waitingPeriod:s,regionDetectionMethod:o,regionList:a.length>0?a:void 0}))),xe.length>0&&R.includes(`identifiers`)&&(Q.identifiers=xe.map(({name:e,type:t,regex:n,selectOptions:r,privacyCenterVisibility:i,isRequiredInForm:a,placeholder:o,displayTitle:s,dataSubjects:c,displayDescription:l,displayOrder:u,isUniqueOnPreferenceStore:d})=>({name:e,type:t,regex:n,selectOptions:r.length>0?r:void 0,privacyCenterVisibility:i.length>0?i:void 0,isRequiredInForm:a,placeholder:o||void 0,dataSubjects:c.length>0?c.map(({type:e})=>e):void 0,displayTitle:s?.defaultMessage,displayDescription:l?.defaultMessage,displayOrder:u,isUniqueOnPreferenceStore:d}))),je.length>0&&R.includes(`agents`)&&(Q.agents=je.map(({name:e,agentId:t,description:n,instructions:r,codeInterpreterEnabled:i,retrievalEnabled:a,prompt:o,largeLanguageModel:s,teams:c,owners:l,agentFunctions:u,agentFiles:d})=>({name:e,agentId:t,description:n||void 0,instructions:r,codeInterpreterEnabled:i,retrievalEnabled:a,prompt:o?.title,"large-language-model":{name:s.name,client:s.client},teams:c&&c.length>0?c.map(({name:e})=>e):void 0,owners:l&&l.length>0?l.map(({email:e})=>e):void 0,"agent-functions":u&&u.length>0?u.map(({name:e})=>e):void 0,"agent-files":d&&d.length>0?d.map(({name:e})=>e):void 0}))),Le.length>0&&R.includes(`actionItems`)&&(Q[`action-items`]=Le.map(({teams:e,users:t,customerExperienceActionItemIds:[n],dueDate:r,priority:i,resolved:a,collections:o,notes:s,link:c,title:l,type:u,attributeValues:d})=>({teams:e.map(({name:e})=>e),users:t.map(({email:e})=>e),dueDate:r||void 0,title:l,notes:s,customerExperienceActionItemId:n,collections:o.map(({title:e})=>e),link:c,priority:i||void 0,resolved:a,type:u,attributes:d!==void 0&&d.length>0?k(d):void 0}))),X.length>0&&R.includes(`actionItemCollections`)&&(Q[`action-item-collections`]=X.map(({title:e,description:t,hidden:n,productLine:r})=>({title:e,description:t||void 0,hidden:n,productLine:r}))),Me.length>0&&R.includes(`agentFunctions`)&&(Q[`agent-functions`]=Me.map(({name:e,description:t,parameters:n})=>({name:e,description:t,parameters:JSON.stringify(n)}))),Ne.length>0&&R.includes(`agentFiles`)&&(Q[`agent-files`]=Ne.map(({name:e,description:t,fileId:n,size:r,purpose:i})=>({name:e,description:t,fileId:n,size:r,purpose:i}))),Pe.length>0&&R.includes(`vendors`)&&(Q.vendors=Pe.map(({title:e,description:t,dataProcessingAgreementLink:n,contactName:r,contactPhone:i,address:a,headquarterCountry:o,headquarterSubDivision:s,websiteUrl:c,businessEntity:l,teams:u,owners:d,attributeValues:f})=>({title:e,description:t||void 0,dataProcessingAgreementLink:n||void 0,contactName:r||void 0,contactPhone:i||void 0,address:a||void 0,headquarterCountry:o||void 0,headquarterSubDivision:s||void 0,websiteUrl:c||void 0,businessEntity:l?.title,teams:u&&u.length>0?u.map(({name:e})=>e):void 0,owners:d&&d.length>0?d.map(({email:e})=>e):void 0,attributes:f!==void 0&&f.length>0?k(f):void 0}))),Fe.length>0&&R.includes(`dataCategories`)&&(Q[`data-categories`]=Fe.map(({name:e,category:t,description:n,regex:r,owners:i,teams:a,attributeValues:o})=>({name:e,category:t,description:n||void 0,regex:r||void 0,owners:i&&i.length>0?i.map(({email:e})=>e):void 0,teams:a&&a.length>0?a.map(({name:e})=>e):void 0,attributes:o!==void 0&&o.length>0?k(o):void 0}))),Ie.length>0&&R.includes(`processingPurposes`)&&(Q[`processing-purposes`]=Ie.map(({name:e,purpose:t,description:n,owners:r,teams:i,attributeValues:a})=>({name:e,purpose:t,description:n||void 0,owners:r&&r.length>0?r.map(({email:e})=>e):void 0,teams:i&&i.length>0?i.map(({name:e})=>e):void 0,attributes:a!==void 0&&a.length>0?k(a):void 0}))),G.length>0&&R.includes(`dataFlows`)&&(Q[`data-flows`]=G.map(({value:e,type:t,description:n,trackingType:r,service:i,status:a,owners:o,teams:s,attributeValues:c})=>({value:e,type:t,description:n||void 0,trackingPurposes:r,status:a,service:i?.integrationName,owners:o.map(({email:e})=>e),teams:s.map(({name:e})=>e),attributes:c!==void 0&&c.length>0?k(c):void 0}))),K.length>0&&R.includes(`cookies`)&&(Q.cookies=K.map(({name:e,isRegex:t,description:n,trackingPurposes:r,service:i,status:a,owners:o,teams:s,attributeValues:c})=>({name:e,isRegex:t,description:n||void 0,trackingPurposes:r,status:a,service:i?.integrationName,owners:o.map(({email:e})=>e),teams:s.map(({name:e})=>e),attributes:c!==void 0&&c.length>0?k(c):void 0}))),q.length>0&&R.includes(`customFields`)&&(Q.attributes=q.map(({description:e,name:t,type:n,values:r,enabledOn:i=[]})=>({description:e||void 0,resources:i,name:t,type:n,values:r.map(({name:e,color:t,description:n})=>({name:e,color:t||void 0,description:n}))}))),Ge.length>0&&(Q.purposes=Ge.map(({name:e,description:t,trackingType:n,defaultConsent:r,configurable:i,showInConsentManager:a,isActive:o,displayOrder:s,optOutSignals:c,authLevel:l,topics:u,showInPrivacyCenter:d,title:f})=>({name:e,title:f,description:t||void 0,trackingType:n,"default-consent":r,configurable:i,"show-in-consent-manager":a,"show-in-privacy-center":d,"is-active":o,"display-order":s,"opt-out-signals":c.length>0?c:void 0,"auth-level":l||void 0,"preference-topics":u.map(({title:e,type:t,displayDescription:n,defaultConfiguration:r,showInPrivacyCenter:i,preferenceOptionValues:a})=>({title:e.defaultMessage,type:t,description:n.defaultMessage,"default-configuration":r,"show-in-privacy-center":i,...a.length>0?{options:a.map(({title:e,slug:t})=>({title:e.defaultMessage,slug:t}))}:{}}))}))),j.length===0&&J.length>0&&R.includes(`templates`)&&(Q.templates=J.map(({title:e})=>({title:e}))),W.length>0&&R.includes(`enrichers`)&&(Q.enrichers=W.map(({title:e,url:t,type:n,inputIdentifier:i,identifiers:a,actions:o,testRegex:s,dataSubjects:c,expirationDuration:l,lookerQueryTitle:u,transitionRequestStatus:d,phoneNumbers:f,regionList:p})=>({title:e,url:t||void 0,type:n,"input-identifier":i?.name,"output-identifiers":a.map(({name:e})=>e),"privacy-actions":Object.values(r).length===o.length?void 0:o,testRegex:s||void 0,lookerQueryTitle:u||void 0,expirationDuration:parseInt(l,10),transitionRequestStatus:d||void 0,phoneNumbers:f&&f.length>0?f:void 0,regionList:p&&p.length>0?p:void 0,"data-subjects":c.map(({type:e})=>e)}))),U.length>0&&R.includes(`dataSilos`)){let e=o(H,`type`);Q[`data-silos`]=U.map(([{title:t,description:n,url:r,type:i,outerType:a,apiKeys:c,notifyEmailAddress:l,identifiers:d,dependentDataSilos:f,owners:p,country:m,countrySubDivision:h,teams:g,subjectBlocklist:_,isLive:v,promptAVendorEmailSendFrequency:y,promptAVendorEmailSendType:b,promptAVendorEmailIncludeIdentifiersAttachment:x,promptAVendorEmailCompletionLinkType:S,manualWorkRetryFrequency:C,catalog:w,attributeValues:T,discoveredBy:E,businessEntities:D},O])=>({title:t,description:n,integrationName:i,"outer-type":a||void 0,url:r||void 0,"api-key-title":c[0]?.title,"identity-keys":d.filter(({isConnected:e})=>e).map(({name:e})=>e),...f.length>0?{"deletion-dependencies":f.map(({title:e})=>e)}:{},...p.length>0?{owners:p.map(({email:e})=>e)}:{},...g.length>0?{teams:g.map(({name:e})=>e)}:{},...E.length>0?{discoveredBy:E.map(({title:e})=>e)}:{},...D.length>0?{businessEntities:D.map(({title:e})=>e)}:{},country:m||void 0,countrySubDivision:h||void 0,disabled:!v,"data-subjects":_.length>0?u(_.map(({type:e})=>e),e):void 0,...w.hasAvcFunctionality?{"email-settings":{"notify-email-address":l||void 0,"send-frequency":y,"send-type":b,"include-identifiers-attachment":x,"completion-link-type":S,"manual-work-retry-frequency":C}}:{},attributes:T!==void 0&&T.length>0?k(T):void 0,datapoints:O.map(e=>({key:e.name,title:e.title?.defaultMessage,description:e.description?.defaultMessage,owners:e.owners.map(({email:e})=>e),teams:e.teams.map(({name:e})=>e),...e.path.length>0?{path:e.path}:{},...e.dataCollection?.title?{"data-collection-tag":e.dataCollection.title.defaultMessage}:{},...e.dbIntegrationQueries.length>0?{"privacy-action-queries":s(o(e.dbIntegrationQueries,`requestType`),e=>e.suggestedQuery||e.query||void 0)}:{},...e.subDataPoints.length>0?{fields:e.subDataPoints.map(e=>({key:e.name,description:e.description,purposes:e.purposes,categories:e.categories,...B&&e.pendingCategoryGuesses?{"guessed-categories":e.pendingCategoryGuesses.filter(e=>e.status===`PENDING`).map(e=>({category:{name:e.category.name,category:e.category.category},status:e.status,confidence:e.confidence,classifierVersion:e.classifierVersion||void 0}))}:{},"access-request-visibility-enabled":e.accessRequestVisibilityEnabled,"erasure-request-redaction-enabled":e.erasureRequestRedactionEnabled,attributes:e.attributeValues!==void 0&&e.attributeValues.length>0?k(e.attributeValues):void 0})).sort((e,t)=>e.key.localeCompare(t.key))}:{},"privacy-actions":e.actionSettings.filter(({active:e})=>e).map(({type:e})=>e)})).sort((e,t)=>[...e.path??[],e.key].join(`.`).localeCompare([...t.path??[],t.key].join(`.`)))}))}return Q}export{F as i,R as n,I as r,L as t};
|
|
58
|
+
//# sourceMappingURL=pullTranscendConfiguration-BHP6t_Nq.mjs.map
|