@transcend-io/cli 7.0.0-alpha.6 → 7.0.0-alpha.7

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.
Files changed (60) hide show
  1. package/dist/bin/bash-complete.js +1 -1
  2. package/dist/bin/cli.js +1 -1
  3. package/dist/bin/deprecated-command.js +1 -1
  4. package/dist/{chunk-T5XKXHEX.js → chunk-4HZHZ32O.js} +1 -1
  5. package/dist/{chunk-NGVJ6L35.js → chunk-5TDUSKDZ.js} +1 -1
  6. package/dist/{chunk-FI3PMXDN.js → chunk-AYMLP7SL.js} +1 -1
  7. package/dist/{chunk-P6Y4JJ7H.js → chunk-DLIWRRVR.js} +14 -14
  8. package/dist/{chunk-CZFGCIEO.js → chunk-F5KKB33H.js} +1 -1
  9. package/dist/chunk-IQZKONXI.js +8 -0
  10. package/dist/{chunk-7HDHUOTF.js → chunk-LE6MXFBT.js} +1 -1
  11. package/dist/{chunk-4ZV5X5DQ.js → chunk-MLF3XCRS.js} +1 -1
  12. package/dist/{chunk-B45U2NAI.js → chunk-NYDK4VPA.js} +1 -1
  13. package/dist/{chunk-Z77MEZNJ.js → chunk-PNOEWENG.js} +1 -1
  14. package/dist/{chunk-HNMFVG75.js → chunk-QAPBYN24.js} +1 -1
  15. package/dist/{chunk-ELYPVDLC.js → chunk-QXOUJ7DT.js} +1 -1
  16. package/dist/{chunk-4S2LOGFN.js → chunk-T4AGEIE3.js} +1 -1
  17. package/dist/{impl-T22SYITP.js → impl-22YTZZ5H.js} +1 -1
  18. package/dist/{impl-LAJLFEXD.js → impl-46IFTUCW.js} +1 -1
  19. package/dist/{impl-FJRPV5PJ.js → impl-4WQTM3GN.js} +1 -1
  20. package/dist/{impl-XS4TFODP.js → impl-52S3Z4ZE.js} +1 -1
  21. package/dist/{impl-H4UVNREH.js → impl-6J4LHKU5.js} +1 -1
  22. package/dist/{impl-UPRMABFX.js → impl-75FHAT4R.js} +1 -1
  23. package/dist/{impl-J2EOVLOE.js → impl-7C43442T.js} +1 -1
  24. package/dist/{impl-7SOARMNA.js → impl-7W6EBZXZ.js} +1 -1
  25. package/dist/{impl-4HVU2DPL.js → impl-CLLZCY76.js} +1 -1
  26. package/dist/{impl-6XFLK23G.js → impl-GSXYV2XR.js} +1 -1
  27. package/dist/impl-ICGIPWVJ.js +1 -0
  28. package/dist/{impl-6QYOU3LQ.js → impl-IDWP2NIG.js} +1 -1
  29. package/dist/{impl-FAK3X2IM.js → impl-ISWFGOUS.js} +1 -1
  30. package/dist/{impl-BE2FBQB2.js → impl-JRA6GN3V.js} +1 -1
  31. package/dist/{impl-4J5UT2YS.js → impl-K2ZB3AKB.js} +1 -1
  32. package/dist/{impl-CWRYQS7O.js → impl-KQ2R65SG.js} +1 -1
  33. package/dist/{impl-WMDL5UOF.js → impl-LNLKIPIP.js} +1 -1
  34. package/dist/{impl-ERKTUJJM.js → impl-MFDS7DPF.js} +1 -1
  35. package/dist/{impl-FWV53PHN.js → impl-NVBTQCSL.js} +1 -1
  36. package/dist/{impl-27ZMTITY.js → impl-PS2DUGWP.js} +1 -1
  37. package/dist/{impl-6XIVNFHV.js → impl-Q65ZCWEQ.js} +1 -1
  38. package/dist/{impl-ABUUSFBL.js → impl-QR3ARAMQ.js} +1 -1
  39. package/dist/{impl-CQWH2NIM.js → impl-QTDGR3SU.js} +1 -1
  40. package/dist/{impl-SRQ3L7UZ.js → impl-QYJFDBIV.js} +1 -1
  41. package/dist/{impl-FWVAOA62.js → impl-TLUPGHWG.js} +1 -1
  42. package/dist/impl-ULVQLOA5.js +1 -0
  43. package/dist/{impl-F3HANU3F.js → impl-URMADXQA.js} +1 -1
  44. package/dist/{impl-SWXA6ZBI.js → impl-UV5ERXN5.js} +1 -1
  45. package/dist/{impl-M6PFOSZI.js → impl-UYCGE2TQ.js} +1 -1
  46. package/dist/impl-VT26YO3N.js +1 -0
  47. package/dist/{impl-CFQR7ENW.js → impl-W454HAAT.js} +1 -1
  48. package/dist/{impl-XDCAAD6P.js → impl-YBSUR2MT.js} +1 -1
  49. package/dist/{impl-JA6H6ALC.js → impl-YJ2FK37I.js} +1 -1
  50. package/dist/{impl-GJK6YEB5.js → impl-YT7F6KTN.js} +1 -1
  51. package/dist/{impl-IM4ZHNF7.js → impl-ZBWVSFDE.js} +1 -1
  52. package/dist/{impl-UCJD5FZ6.js → impl-ZEEUCWKF.js} +1 -1
  53. package/dist/impl-ZXDLJ2TY.js +8 -0
  54. package/dist/index.js +1 -1
  55. package/package.json +1 -1
  56. package/dist/chunk-FL3V7KJR.js +0 -8
  57. package/dist/impl-4LDKW5YP.js +0 -8
  58. package/dist/impl-KE4S4ANH.js +0 -1
  59. package/dist/impl-UIHX2POD.js +0 -1
  60. package/dist/impl-ZTS5VZXR.js +0 -1
@@ -1 +1 @@
1
- import{$ as Ve,Ae as ye,Be as qe,Ca as Qe,Ce as Ye,De as We,Y as de,Z as ke,_ as oe,_b as P,a as je,b,dd as ge,ea as Me,pe as w,q as Fe,qe as W,se as Ge,ue as Ke,wa as Be,we as ze,xa as Ue,y as _e,ye as E}from"./chunk-7HDHUOTF.js";import{a as u}from"./chunk-OERYFLN2.js";import{e as C}from"./chunk-APA5PR4U.js";import{applyEnum as Jt,valuesOf as le}from"@transcend-io/type-utils";import{LanguageKey as Zt}from"@transcend-io/internationalization";import{CompletedRequestStatus as Ht,RequestAction as Xt,IsoCountryCode as er,IsoCountrySubdivisionCode as tr}from"@transcend-io/privacy-types";import*as R from"io-ts";var A="[NONE]",ce="[APPLY VALUE TO ALL ROWS]",Ce="<blank>",Re=["email","coreIdentifier"],ie=(c=>(c.Email="email",c.CoreIdentifier="coreIdentifier",c.RequestType="requestType",c.SubjectType="subjectType",c.Locale="locale",c.Country="country",c.CountrySubDivision="countrySubDivision",c.RequestStatus="requestStatus",c.CreatedAt="createdAt",c.DataSiloIds="dataSiloIds",c))(ie||{}),Je={email:!1,coreIdentifier:!0,requestType:!0,subjectType:!0,requestStatus:!1,createdAt:!1,dataSiloIds:!1,locale:!1,country:!1,countrySubDivision:!1},Ze={requestType:!0,subjectType:!0},He=R.type({columnNames:R.partial(Jt(ie,()=>R.string)),identifierNames:R.record(R.string,R.string),attributeNames:R.record(R.string,R.string),requestTypeToRequestAction:R.record(R.string,le(Xt)),subjectTypeToSubjectName:R.record(R.string,R.string),languageToLocale:R.record(R.string,le(Zt)),regionToCountry:R.record(R.string,le({...er,[A]:A})),regionToCountrySubDivision:R.record(R.string,le({...tr,[A]:A})),statusToRequestStatus:R.record(R.string,le({...Ht,[A]:A}))}),he=R.type({id:R.string,link:R.string,rowIndex:R.number,coreIdentifier:R.string,attemptedAt:R.string}),Xe=R.type({failingRequests:R.array(R.record(R.string,R.any)),successfulRequests:R.array(he),duplicateRequests:R.array(R.type({rowIndex:R.number,coreIdentifier:R.string,attemptedAt:R.string}))});import rr from"inquirer";import et from"fuzzysearch";function Se(n,e){return et(n.toLowerCase(),e.toLowerCase())||et(e.toLowerCase(),n.toLowerCase())}function ne(n,e,s,l){let a=n.filter(o=>Se(e.toLowerCase(),o.toLowerCase()));return[...a,new rr.Separator,...s?[]:[A],...l?[ce]:[],...n.filter(o=>!a.includes(o))]}import tt from"inquirer";import sr from"inquirer-autocomplete-prompt";import{apply as or}from"@transcend-io/type-utils";async function ee(n,e,s){tt.registerPrompt("autocomplete",sr);let l=n.map(o=>o||"<blank>").filter(o=>!s[o]);if(l.length===0)return s;let a=await tt.prompt(l.map(o=>({name:o,message:`Map value of: ${o}`,type:"autocomplete",default:e.find(i=>Se(o,i)),source:(i,r)=>r?e.filter(t=>typeof t=="string"&&Se(r,t)):e})));return{...s,...or(a,o=>typeof o=="string"?o:Object.values(o)[0])}}function Ie(n){return n.split(",").map(e=>e.trim()).filter(e=>e)}import rt from"colors";import*as te from"io-ts";var st=te.type({key:te.string,values:te.array(te.string)});function ot(n){let e=n.map(s=>{let[l,a]=s.trim().split(":");if(!a)throw new Error("Expected attributes in key:value1;value2,key2:value3;value4");let o=a.split(";");return{key:l,values:o}});return u.info(rt.magenta("Attributes to apply to all requests:")),u.info(rt.magenta(JSON.stringify(e,null,2))),e}import{parse as ir}from"csv-parse/sync";import{readFileSync as nr}from"fs";import*as it from"io-ts";import{decodeCodec as ar}from"@transcend-io/type-utils";function nt(n,e,s={columns:!0}){let l=ir(nr(n,"utf-8"),s);return ar(it.array(e),l).map(i=>Object.entries(i).reduce((r,[t,y])=>Object.assign(r,{[t.replace(/[^a-z_.+\-A-Z -~]/g,"")]:y}),{}))}import{uniq as ur}from"lodash-es";function G(n,e){return ur(n.map(s=>s[e]||"").flat())}import at from"inquirer";import lr from"colors";import{uniq as cr}from"lodash-es";async function ut(n){let e=cr(n.map(a=>Object.keys(a)).flat()),s=n,l=!0;for(;l;){let{filterColumnName:a}=await at.prompt([{name:"filterColumnName",message:`If you need to filter the list of requests to import, choose the column to filter on. Currently ${s.length} rows.`,type:"list",default:e,choices:[A,...e]}]);if(l=A!==a,l){let o=G(s,a),{valuesToKeep:i}=await at.prompt([{name:"valuesToKeep",message:"Keep rows matching this value",type:"checkbox",default:e,choices:o}]);s=s.filter(r=>i.includes(r[a]))}}return u.info(lr.magenta(`Importing ${s.length} requests`)),s}import lt from"colors";import{RequestStatus as J}from"@transcend-io/privacy-types";import ct from"cli-progress";async function Ys({requestActions:n,auth:e,requestIds:s,statuses:l=[J.Compiling,J.RequestMade,J.Delayed,J.Approving,J.Secondary,J.Enriching,J.Waiting,J.SecondaryApproving],createdAtAfter:a,createdAtBefore:o,concurrency:i=100,transcendUrl:r=C}){let t=w(r,e),y=new Date().getTime(),c=new ct.SingleBar({},ct.Presets.shades_classic),g=await E(t,{actions:n,statuses:l,createdAtBefore:o,createdAtAfter:a,isSilent:!1,requestIds:s});u.info(lt.magenta(`Marking "${g.length}" as silent mode.`));let m=0;c.start(g.length,0),await b(g,async f=>{await P(t,oe,{input:{id:f.id,isSilent:!0}}),m+=1,c.update(m)},{concurrency:i}),c.stop();let p=new Date().getTime()-y;return u.info(lt.green(`Successfully marked ${m} requests as silent mode in "${p/1e3}" seconds!`)),g.length}import{getValues as mr,getEntries as pr}from"@transcend-io/type-utils";import fr from"inquirer";import{startCase as dr}from"lodash-es";async function mt(n,e){let s=mr(ie).filter(a=>!e.getValue("columnNames",a)),l=s.length===0?{}:await fr.prompt(s.map(a=>{let o=dr(a.replace("ColumnName","")),i=ne(n,o,Je[a],!!Ze[a]);return{name:a,message:`Choose the column that will be used to map in the field: ${o}`,type:"list",default:i[0],choices:i}}));return await Promise.all(pr(l).map(([a,o])=>e.setValue(o,"columnNames",a))),l}import re from"colors";import{CompletedRequestStatus as gr,RequestAction as yr,IsoCountryCode as qr,IsoCountrySubdivisionCode as Rr}from"@transcend-io/privacy-types";import{LanguageKey as hr}from"@transcend-io/internationalization";async function pt(n,e,{state:s,columnNameMap:l}){let a=f=>s.getValue("columnNames",f)||l[f],{internalSubjects:o}=await P(n,_e);u.info(re.magenta("Determining mapping of columns for request action"));let i=await ee(G(e,a("requestType")),Object.values(yr),s.getValue("requestTypeToRequestAction"));await s.setValue(i,"requestTypeToRequestAction"),u.info(re.magenta("Determining mapping of columns for subject"));let r=await ee(G(e,a("subjectType")),o.map(({type:f})=>f),s.getValue("subjectTypeToSubjectName"));await s.setValue(r,"subjectTypeToSubjectName"),u.info(re.magenta("Determining mapping of columns for locale"));let t=await ee(G(e,a("locale")),Object.values(hr),s.getValue("languageToLocale"));await s.setValue(t,"languageToLocale"),u.info(re.magenta("Determining mapping of columns for request status")),u.info(re.magenta("Determining mapping of columns for request status"));let y=a("requestStatus"),c=y===A?{}:await ee(G(e,y),[...Object.values(gr),A],s.getValue("statusToRequestStatus"));await s.setValue(c,"statusToRequestStatus"),u.info(re.magenta("Determining mapping of columns for country"));let g=a("country"),m=g===A?{}:await ee(G(e,g),[...Object.values(qr),A],s.getValue("regionToCountry"));await s.setValue(m,"regionToCountry"),u.info(re.magenta("Determining mapping of columns for country sub division"));let d=a("countrySubDivision"),p=d===A?{}:await ee(G(e,d),[...Object.values(Rr),A],s.getValue("regionToCountrySubDivision"));await s.setValue(p,"regionToCountrySubDivision")}import{LanguageKey as Sr}from"@transcend-io/internationalization";import{DateFromISOString as br}from"io-ts-types";import*as D from"io-ts";import{NORMALIZE_PHONE_NUMBER as Tr,CompletedRequestStatus as Ar,RequestAction as wr,IdentifierType as be,IsoCountryCode as Cr,IsoCountrySubdivisionCode as Ir}from"@transcend-io/privacy-types";import{valuesOf as me}from"@transcend-io/type-utils";var Pr=D.record(D.string,D.array(D.intersection([D.type({value:D.string}),D.partial({name:D.string})]))),wo=D.intersection([D.type({email:D.string,attestedExtraIdentifiers:Pr,coreIdentifier:D.string,requestType:me(wr),subjectType:D.string}),D.partial({country:me(Cr),countrySubDivision:me(Ir),attributes:D.array(st),status:me(Ar),createdAt:br,dataSiloIds:D.array(D.string),locale:me(Sr)})]);function Dr(n,e,s){if(e===be.Email)return n.toLowerCase();if(e===be.Phone){let l=n.replace(Tr,"").replace(/[()]/g,"").replace(/[–]/g,"").replace(/[:]/g,"").replace(/[‭‬]/g,"").replace(/[A-Za-z]/g,"");return l?l.startsWith("+")?l:`+${s}${l}`:""}return n}function ft(n,e,{columnNameMap:s,identifierNameMap:l,attributeNameMap:a,requestAttributeKeys:o,defaultPhoneCountryCode:i="1"}){let r=t=>e.getValue("columnNames",t)||s[t];return n.map(t=>{let y={};Object.entries(l).filter(([,d])=>d!==A).forEach(([d,p])=>{let f=Object.values(be).includes(d)?d:be.Custom,h=t[p];if(h){let S=Dr(h,f,i);S&&(y[f]||(y[f]=[]),y[f].push({value:S,name:d}))}});let c=[];Object.entries(a).filter(([,d])=>d!==A).forEach(([d,p])=>{let f=t[p];if(f){let h=o.find(S=>S.name===d)?.type==="MULTI_SELECT";c.push({values:h?Ie(f):f,key:d})}});let g=r("requestType"),m=r("subjectType");return[t,{email:t[r("email")],attestedExtraIdentifiers:y,attributes:c,coreIdentifier:t[r("coreIdentifier")],requestType:g===ce?e.getValue("requestTypeToRequestAction",Ce):e.getValue("requestTypeToRequestAction",t[g]),subjectType:m===ce?e.getValue("subjectTypeToSubjectName",Ce):e.getValue("subjectTypeToSubjectName",t[m]),...r("locale")!==A&&t[r("locale")]?{locale:e.getValue("languageToLocale",t[r("locale")])}:{},...r("country")!==A&&t[r("country")]?{country:e.getValue("regionToCountry",t[r("country")])}:{},...r("countrySubDivision")!==A&&t[r("countrySubDivision")]?{countrySubDivision:e.getValue("regionToCountrySubDivision",t[r("countrySubDivision")])}:{},...r("requestStatus")!==A&&e.getValue("statusToRequestStatus",t[r("requestStatus")])!==A&&t[r("requestStatus")]?{status:e.getValue("statusToRequestStatus",t[r("requestStatus")])}:{},...r("createdAt")!==A&&t[r("createdAt")]?{createdAt:new Date(t[r("createdAt")])}:{},...r("dataSiloIds")!==A&&t[r("dataSiloIds")]?{dataSiloIds:Ie(t[r("dataSiloIds")])}:{}}]})}import dt from"colors";import gt from"cli-progress";import*as q from"io-ts";import{decodeCodec as Er,valuesOf as vr}from"@transcend-io/type-utils";import{TableEncryptionType as Nr}from"@transcend-io/privacy-types";var yt=q.type({defaultMessage:q.string,id:q.string}),xr=q.type({downloadKey:q.string,error:q.union([q.null,q.string]),mimetype:q.string,size:q.string,fileName:q.string,dataPoint:q.type({id:q.string,title:q.union([yt,q.null]),description:q.union([yt,q.null]),name:q.string,slug:q.string,encryption:q.union([vr(Nr),q.null]),dataSilo:q.type({id:q.string,title:q.string,description:q.string,type:q.string,outerType:q.union([q.string,q.null])}),path:q.array(q.string)})}),Lr=q.type({nodes:q.array(xr),totalCount:q.number,_links:q.partial({next:q.union([q.string,q.null]),previous:q.union([q.string,q.null])})});async function qt(n,{sombra:e,concurrency:s=5,limit:l=100}){u.info(dt.magenta(`Pulling file metadata for ${n.length} requests`));let a=new Date().getTime(),o=new gt.SingleBar({},gt.Presets.shades_classic),i=0;o.start(n.length,0);let r=await b(n,async c=>{let g=[],m=!0,d=0;for(;m;){let p;try{let f=await e.get(`v1/data-subject-request/${c.id}/download-keys`,{searchParams:{limit:l,offset:d}}).json();p=Er(Lr,f),g.push(...p.nodes),d+=l,m=!!p._links.next&&p.nodes.length===l}catch(f){throw new Error(`Received an error from server: ${f?.response?.body||f?.message}`)}}return i+=1,o.update(i),[c,g]},{concurrency:s});o.stop();let y=new Date().getTime()-a;return u.info(dt.green(`Successfully downloaded file metadata ${n.length} requests in "${y/1e3}" seconds!`)),r}import $r from"colors";async function Rt(n,{requestId:e,sombra:s,onFileDownloaded:l,concurrency:a=20}){await b(n,async o=>{try{await s.get("v1/files",{searchParams:{downloadKey:o.downloadKey}}).buffer().then(i=>l(o,i))}catch(i){if(i?.response?.body?.includes("fileMetadata#verify")){u.error($r.red(`Failed to pull file for: ${o.fileName} (request:${e}) - JWT expired. This likely means that the file is no longer available. Try restarting the request from scratch in Transcend Admin Dashboard. Skipping the download of this file.`));return}throw new Error(`Received an error from server: ${i?.response?.body||i?.message}`)}},{concurrency:a})}import{existsSync as Pe,mkdirSync as De,writeFileSync as Or}from"fs";import{dirname as jr,join as ht}from"path";import St from"colors";import{RequestAction as Fr,RequestStatus as Ee}from"@transcend-io/privacy-types";import bt from"cli-progress";async function Yo({auth:n,folderPath:e,requestIds:s,createdAtBefore:l,sombraAuth:a,createdAtAfter:o,statuses:i=[Ee.Approving,Ee.Downloadable],concurrency:r=5,transcendUrl:t=C,approveAfterDownload:y=!1}){let c=w(t,n),g=await W(t,n,a);Pe(e)||De(e);let m=await E(c,{actions:[Fr.Access],createdAtBefore:l,createdAtAfter:o,statuses:i,requestIds:s}),d=await qt(m,{sombra:g,concurrency:r}),p=new Date().getTime(),f=new bt.SingleBar({},bt.Presets.shades_classic),h=0,S=0;f.start(m.length,0),await b(d,async([v,x])=>{let K=ht(e,v.id);Pe(K)||De(K),await Rt(x,{sombra:g,requestId:v.id,onFileDownloaded:($,_)=>{let z=ht(K,$.fileName),j=jr(z);Pe(j)||De(j,{recursive:!0}),Or(z,_)}}),y&&v.status===Ee.Approving&&(await P(c,de,{input:{requestId:v.id}}),S+=1),h+=1,f.update(h)},{concurrency:r}),f.stop();let T=new Date().getTime()-p;return u.info(St.green(`Successfully downloaded ${h} requests in "${T/1e3}" seconds!`)),S>0&&u.info(St.green(`Approved ${S} requests in Transcend.`)),m.length}import*as I from"io-ts";import{uniq as _r}from"lodash-es";import{valuesOf as Te,decodeCodec as kr}from"@transcend-io/type-utils";import{IsoCountryCode as Vr,IsoCountrySubdivisionCode as Mr,RequestAction as Br,RequestStatus as Ur}from"@transcend-io/privacy-types";var ve=I.type({id:I.string,link:I.string,status:Te(Ur),type:Te(Br),subjectType:I.string,email:I.union([I.null,I.string]),coreIdentifier:I.string,isSilent:I.boolean,isTest:I.boolean,country:I.union([I.null,Te(Vr)]),countrySubDivision:I.union([I.null,Te(Mr)]),attributeValues:I.array(I.type({attributeKey:I.type({name:I.string}),name:I.string}))});async function Tt(n,e,{details:s="",isTest:l=!1,emailIsVerified:a=!0,skipSendingReceipt:o=!1,isSilent:i=!0,additionalAttributes:r=[]}={}){let t=[...r];(e.attributes||[]).forEach(g=>{let m=t.find(d=>d.key===g.key);m?(m.values.push(...g.values),m.values=_r(m.values)):t.push(g)});let y;try{y=await n.post("v1/data-subject-request",{json:{type:e.requestType,subject:{coreIdentifier:e.coreIdentifier,email:e.email,emailIsVerified:a,attestedExtraIdentifiers:e.attestedExtraIdentifiers},subjectType:e.subjectType,isSilent:i,isTest:l,skipSendingReceipt:o,...e.locale?{locale:e.locale}:{},details:s,attributes:t,...e.country||e.countrySubDivision?{region:{...e.country?{country:e.country}:e.countrySubDivision?{country:e.countrySubDivision.split("-")[0]}:{},...e.countrySubDivision?{countrySubDivision:e.countrySubDivision}:{}}}:{},...e.createdAt?{createdAt:e.createdAt}:{},...e.dataSiloIds?{dataSiloIds:e.dataSiloIds}:{},...e.status?{completedRequestStatus:e.status}:{}}}).json()}catch(g){throw new Error(`Received an error from server: ${g?.response?.body||g?.message}`)}let{request:c}=kr(I.type({request:ve}),y);return c}import Ne from"colors";import{RequestStatus as Qr}from"@transcend-io/privacy-types";import At from"cli-progress";async function li({requestActions:n,requestOrigins:e,auth:s,silentModeBefore:l,createdAtAfter:a,createdAtBefore:o,concurrency:i=50,transcendUrl:r=C}){let t=w(r,s),y=new Date().getTime(),c=new At.SingleBar({},At.Presets.shades_classic),g=await E(t,{actions:n,statuses:[Qr.Approving],createdAtAfter:a,origins:e,createdAtBefore:o});u.info(Ne.magenta(`Approving "${g.length}" requests.`));let m=0,d=0;c.start(g.length,0),await b(g,async h=>{l&&new Date(l)>new Date(h.createdAt)&&await P(t,oe,{input:{id:h.id,isSilent:!0}});try{await P(t,de,{input:{requestId:h.id}})}catch(S){S.message.includes("Request must be in an approving state,")&&(d+=1)}m+=1,c.update(m)},{concurrency:i}),c.stop();let f=new Date().getTime()-y;return d>0&&u.info(Ne.yellow(`${d} requests were skipped.`)),u.info(Ne.green(`Successfully approved ${m} requests in "${f/1e3}" seconds!`)),g.length}import wt from"colors";import{RequestAction as Gr}from"@transcend-io/privacy-types";import Ct from"cli-progress";async function Ri({requestActions:n=Object.values(Gr),auth:e,requestIds:s,createdAtBefore:l,days:a=45,daysLeft:o=10,createdAtAfter:i,emailTemplate:r="Additional Time Needed",concurrency:t=100,transcendUrl:y=C}){let c=w(y,e),g=new Date().getTime(),m=new Ct.SingleBar({},Ct.Presets.shades_classic),p=(await ge(c,r)).find(T=>T.title===r);if(!p)throw new Error(`Failed to find a template with title: "${r}"`);let f=await E(c,{actions:n,createdAtBefore:l,createdAtAfter:i,isSilent:!1,isClosed:!1,requestIds:s});f=f.filter(T=>typeof T.daysRemaining=="number"&&T.daysRemaining<o),u.info(wt.magenta(`Notifying "${f.length}" that more time is needed.`));let h=0;m.start(f.length,0),await b(f,async T=>{await P(c,Ve,{input:{requestId:T.id,template:p.template.defaultMessage,subject:p.subject.defaultMessage,additionalTime:a}}),h+=1,m.update(h)},{concurrency:t}),m.stop();let N=new Date().getTime()-g;return u.info(wt.green(`Successfully marked ${h} requests as silent mode in "${N/1e3}" seconds!`)),f.length}import Kr from"inquirer";async function It(n,e,s){let{initializer:l}=await P(n,Fe),a=l.identifiers.filter(({name:i})=>!s.getValue("identifierNames",i)&&!Re.includes(i)),o=a.length===0?{}:await Kr.prompt(a.map(({name:i})=>{let r=ne(e,i,!1);return{name:i,message:`Choose the column that will be used to map in the identifier: ${i}`,type:"list",default:r[0],choices:r}}));return await Promise.all(Object.entries(o).map(([i,r])=>s.setValue(r,"identifierNames",i))),{...s.getValue("identifierNames"),...o}}import Pt from"colors";import{RequestStatus as Z}from"@transcend-io/privacy-types";import Dt from"cli-progress";async function ji({requestActions:n,cancellationTitle:e,auth:s,requestIds:l,silentModeBefore:a,createdAtBefore:o,createdAtAfter:i,statuses:r=[Z.Compiling,Z.RequestMade,Z.Delayed,Z.Approving,Z.Secondary,Z.Enriching,Z.Waiting,Z.SecondaryApproving],concurrency:t=50,transcendUrl:y=C}){let c=w(y,s),g=new Date().getTime(),m=new Dt.SingleBar({},Dt.Presets.shades_classic),d;if(e){let T=(await ge(c,e)).find(v=>v.title===e);if(!T)throw new Error(`Failed to find a template with title: "${e}"`);d=T}let p=await E(c,{actions:n,createdAtBefore:o,createdAtAfter:i,statuses:r,requestIds:l});u.info(Pt.magenta(`Canceling "${p.length}" requests${d?` Using template: ${d.title}`:""}.`));let f=0;m.start(p.length,0),await b(p,async N=>{a&&new Date(a)>new Date(N.createdAt)&&await P(c,oe,{input:{id:N.id,isSilent:!0}}),await P(c,ke,{input:{requestId:N.id,...d?{subject:`Re: ${d.subject.defaultMessage}`,template:d.template.defaultMessage}:{}}}),f+=1,m.update(f)},{concurrency:t}),m.stop();let S=new Date().getTime()-g;return u.info(Pt.green(`Successfully canceled ${f} requests in "${S/1e3}" seconds!`)),p.length}import zr from"inquirer";async function Et(n,e,s,l){let a=l.filter(({name:i})=>!s.getValue("attributeNames",i)),o=a.length===0?{}:await zr.prompt(a.map(({name:i})=>{let r=ne(e,i,!1);return{name:i,message:`Choose the column that will be used to map in the attribute: ${i}`,type:"list",default:r[0],choices:r}}));return await Promise.all(Object.entries(o).map(([i,r])=>s.setValue(r,"attributeNames",i))),{...s.getValue("attributeNames"),...o}}var vt=/{\\"message\\":\\"(.+?)\\",/;function Ae(n){return vt.test(n)?vt.exec(n)[1]:null}import F from"colors";import*as pe from"io-ts";import{uniq as Yr}from"lodash-es";import Nt from"cli-progress";import{join as Wr}from"path";import{PersistedState as xt}from"@transcend-io/persisted-state";async function ln({cacheFilepath:n,requestReceiptFolder:e,file:s,auth:l,sombraAuth:a,concurrency:o=100,defaultPhoneCountryCode:i="1",transcendUrl:r=C,attributes:t=[],emailIsVerified:y=!0,skipFilterStep:c=!1,skipSendingReceipt:g=!0,isTest:m=!1,isSilent:d=!0,debug:p=!1,dryRun:f=!1}){let h=new Date().getTime(),S=new Nt.SingleBar({},Nt.Presets.shades_classic),N=ot(t),T=new xt(n,He,{columnNames:{},requestTypeToRequestAction:{},subjectTypeToSubjectName:{},languageToLocale:{},statusToRequestStatus:{},identifierNames:{},attributeNames:{},regionToCountrySubDivision:{},regionToCountry:{}}),v=Wr(e,`tr-request-upload-${new Date().toISOString()}-${s.split("/").pop()}`.replace(".csv",".json")),x=new xt(v,Xe,{successfulRequests:[],duplicateRequests:[],failingRequests:[]}),K=await W(r,l,a),$=nt(s,pe.record(pe.string,pe.string)),_=Yr($.map(U=>Object.keys(U)).flat());if($.length===0)throw new Error("No Requests found in list! Ensure the first row of the CSV is a header and the rest are requests.");if(p){let U=$[0];u.info(F.magenta(`First request: ${JSON.stringify(U,null,2)}`))}let z=c?$:await ut($),j=w(r,l),L=await ze(j),B=await mt(_,T),Y=await It(j,_,T),k=await Et(j,_,T,L);await pt(j,z,{state:T,columnNameMap:B});let O=ft(z,T,{defaultPhoneCountryCode:i,columnNameMap:B,identifierNameMap:Y,attributeNameMap:k,requestAttributeKeys:L});p||S.start(O.length,0);let H=0;await b(O,async([U,V],Q)=>{let Oe=p?`email:${V.email} | coreIdentifier:${V.coreIdentifier}`:`row:${Q.toString()}`;if(p&&u.info(F.magenta(`[${Q+1}/${O.length}] Importing: ${JSON.stringify(V,null,2)}`)),f){u.info(F.magenta("Bailing out on dry run because dryRun is set"));return}try{let X=await Tt(K,V,{details:`Uploaded by Transcend Cli: "tr-request-upload" : ${JSON.stringify(U,null,2)}`,isTest:m,emailIsVerified:y,skipSendingReceipt:g,isSilent:d,additionalAttributes:N});p&&(u.info(F.green(`[${Q+1}/${O.length}] Successfully submitted the test data subject request: "${Oe}"`)),u.info(F.green(`[${Q+1}/${O.length}] View it at: "${X.link}"`)));let se=x.getValue("successfulRequests");se.push({id:X.id,link:X.link,rowIndex:Q,coreIdentifier:X.coreIdentifier,attemptedAt:new Date().toISOString()}),await x.setValue(se,"successfulRequests")}catch(X){let se=`${X.message} - ${JSON.stringify(X.response?.body,null,2)}`,we=Ae(se);if(we==="Client error: You have already made this request."){p&&u.info(F.yellow(`[${Q+1}/${O.length}] Skipping request as it is a duplicate`));let ue=x.getValue("duplicateRequests");ue.push({coreIdentifier:V.coreIdentifier,rowIndex:Q,attemptedAt:new Date().toISOString()}),await x.setValue(ue,"duplicateRequests")}else{let ue=x.getValue("failingRequests");ue.push({...V,rowIndex:Q,error:we||se,attemptedAt:new Date().toISOString()}),await x.setValue(ue,"failingRequests"),p&&(u.error(F.red(we||se)),u.error(F.red(`[${Q+1}/${O.length}] Failed to submit request for: "${Oe}"`)))}}H+=1,p||S.update(H)},{concurrency:o}),S.stop();let ae=new Date().getTime()-h;u.info(F.green(`Completed upload in "${ae/1e3}" seconds.`)),x.getValue("duplicateRequests").length>0&&u.info(F.yellow(`Encountered "${x.getValue("duplicateRequests").length}" duplicate requests. See "${v}" to review the core identifiers for these requests.`)),x.getValue("failingRequests").length>0&&(u.error(F.red(`Encountered "${x.getValue("failingRequests").length}" errors. See "${v}" to review the error messages and inputs.`)),process.exit(1))}import*as Lt from"io-ts";import{groupBy as Jr}from"lodash-es";import{apply as Zr,decodeCodec as Hr}from"@transcend-io/type-utils";import{IdentifierType as xe}from"@transcend-io/privacy-types";async function $t(n,e,{sendEmailReceipt:s=!1,skipWaitingPeriod:l=!1,emailIsVerified:a=!0,requestIdentifiers:o=[]}={}){let i=await n.post("v1/data-subject-request",{json:{type:e.type,subject:{coreIdentifier:e.coreIdentifier,email:e.email,emailIsVerified:a,...o.length>0?{attestedExtraIdentifiers:Zr(Jr(o.filter(t=>!(t.name==="email"&&t.value===e.email)&&!Re.includes(t.name)).map(t=>({...t,type:Object.values(xe).includes(t.name)?t.name:xe.Custom})),"type"),(t,y)=>t.map(({name:c,value:g})=>({...y===xe.Custom?{name:c}:{},value:g})))}:{}},requestId:e.id,subjectType:e.subjectType,isSilent:e.isSilent,isTest:e.isTest,locale:e.locale,skipWaitingPeriod:l,createdAt:e.createdAt,details:`Restarted by Transcend cli: "tr-request-restart" - ${e.details}`,skipSendingReceipt:!s}}).json(),{request:r}=Hr(Lt.type({request:ve}),i);return r}import{PersistedState as Xr}from"@transcend-io/persisted-state";import Ot from"cli-progress";import Le from"colors";import*as M from"io-ts";import{difference as es}from"lodash-es";import{join as ts}from"path";var rs=M.intersection([he,M.type({error:M.string})]),ss=M.type({restartedRequests:M.array(he),failingRequests:M.array(rs)});async function En({requestReceiptFolder:n,auth:e,sombraAuth:s,requestActions:l,requestStatuses:a,createdAtBefore:o,createdAtAfter:i,transcendUrl:r=C,requestIds:t=[],createdAt:y=new Date,silentModeBefore:c,sendEmailReceipt:g=!1,emailIsVerified:m=!0,copyIdentifiers:d=!1,skipWaitingPeriod:p=!1,concurrency:f=20}){let h=new Date().getTime(),S=new Ot.SingleBar({},Ot.Presets.shades_classic),N=ts(n,`tr-request-restart-${new Date().toISOString()}`),T=new Xr(N,ss,{restartedRequests:[],failingRequests:[]}),v=await W(r,e,s),x=w(r,e),$=(await E(x,{actions:l,statuses:a,createdAtBefore:o,createdAtAfter:i})).filter(L=>new Date(L.createdAt)<y);if(u.info(`Found ${$.length} requests to process`),d&&u.info("copyIdentifiers detected - All Identifiers will be copied."),g&&u.info("sendEmailReceipt detected - Email receipts will be sent."),p&&u.info("skipWaitingPeriod detected - Waiting period will be skipped."),t.length>0&&t.length!==$.length){let L=es(t,$.map(({id:B})=>B));L.length>0&&(u.error(Le.red(`Failed to find the following requests by ID: ${L.join(",")}.`)),process.exit(1))}let _=0;S.start($.length,0),await b($,async(L,B)=>{try{let Y=d?await ye(x,v,{requestId:L.id}):[],k=await $t(v,{...L,isSilent:c&&new Date(L.createdAt)<c?!0:L.isSilent},{requestIdentifiers:Y,skipWaitingPeriod:p,sendEmailReceipt:g,emailIsVerified:m}),O=T.getValue("restartedRequests");O.push({id:k.id,link:k.link,rowIndex:B,coreIdentifier:k.coreIdentifier,attemptedAt:new Date().toISOString()}),await T.setValue(O,"restartedRequests")}catch(Y){let k=`${Y.message} - ${JSON.stringify(Y.response?.body,null,2)}`,O=Ae(k),H=T.getValue("failingRequests");H.push({id:L.id,link:L.link,rowIndex:B,coreIdentifier:L.coreIdentifier,attemptedAt:new Date().toISOString(),error:O||k}),await T.setValue(H,"failingRequests")}_+=1,S.update(_)},{concurrency:f}),S.stop();let j=new Date().getTime()-h;u.info(Le.green(`Completed restarting of requests in "${j/1e3}" seconds.`)),T.getValue("failingRequests").length>0&&(u.error(Le.red(`Encountered "${T.getValue("failingRequests").length}" errors. See "${N}" to review the error messages and inputs.`)),process.exit(1))}import jt from"colors";import Ft from"cli-progress";import{RequestEnricherStatus as _t,RequestStatus as os}from"@transcend-io/privacy-types";async function _n({enricherIds:n,auth:e,concurrency:s=100,transcendUrl:l=C}){let a=w(l,e),o=new Date().getTime(),i=await E(a,{statuses:[os.Enriching]});u.info(jt.magenta(`Processing enricher: "${n.join(",")}" fetched "${i.length}" in enriching status.`));let r=new Ft.SingleBar({},Ft.Presets.shades_classic),t=0;r.start(i.length,0);let y=0;await b(i,async m=>{let p=(await qe(a,{requestId:m.id})).filter(f=>n.includes(f.enricher.id)&&![_t.Resolved,_t.Skipped].includes(f.status));p.length>0&&await je(p,async f=>{try{await P(a,Me,{requestEnricherId:f.id}),y+=1}catch(h){if(!h.message.includes("Client error: Cannot skip Request enricher because it has already completed"))throw h}}),t+=1,r.update(t)},{concurrency:s}),r.stop();let g=new Date().getTime()-o;return u.info(jt.green(`Successfully skipped "${y}" for "${i.length}" requests in "${g/1e3}" seconds!`)),i.length}import{RequestEnricherStatus as is,RequestStatus as ns}from"@transcend-io/privacy-types";import kt from"cli-progress";import $e from"colors";import{difference as as}from"lodash-es";async function Wn({auth:n,requestActions:e=[],createdAtBefore:s,createdAtAfter:l,transcendUrl:a=C,requestEnricherStatuses:o=Object.values(is),requestIds:i=[],enricherId:r,concurrency:t=20}){let y=new Date().getTime(),c=new kt.SingleBar({},kt.Presets.shades_classic),g=w(a,n);u.info($e.magenta("Fetching requests to restart..."));let m=await E(g,{actions:e,statuses:[ns.Enriching],createdAtBefore:s,createdAtAfter:l,requestIds:i}),d=0;if(i.length>0&&i.length!==m.length){let S=as(i,m.map(({id:N})=>N));S.length>0&&(u.error($e.red(`Failed to find the following requests by ID: ${S.join(",")}.`)),process.exit(1))}let p=0;c.start(m.length,0),await b(m,async S=>{let T=(await qe(g,{requestId:S.id})).filter(v=>v.enricher.id===r&&o.includes(v.status));await b(T,async v=>{await Ge(g,v.id),d+=1}),p+=1,c.update(p)},{concurrency:t}),c.stop();let h=new Date().getTime()-y;u.info($e.green(`Completed restarting of ${m.length} requests and ${d} enrichers in "${h/1e3}" seconds.`))}import Vt from"colors";import{RequestStatus as Mt}from"@transcend-io/privacy-types";import Bt from"cli-progress";async function ia({requestActions:n,dataSiloId:e,auth:s,concurrency:l=20,transcendUrl:a=C}){let o=w(a,s),i=new Date().getTime(),r=new Bt.SingleBar({},Bt.Presets.shades_classic),t=await E(o,{actions:n,statuses:[Mt.Compiling,Mt.Approving]});u.info(Vt.magenta(`Retrying requests for Data Silo: "${e}", restarting "${t.length}" requests.`));let y=0,c=0;r.start(t.length,0),await b(t,async d=>{try{let p=await We(o,{requestId:d.id,dataSiloId:e});await P(o,Ue,{requestDataSiloId:p.id})}catch(p){if(!p.message.includes("Failed to find RequestDataSilo"))throw p;c+=1}y+=1,r.update(y)},{concurrency:l}),r.stop();let m=new Date().getTime()-i;return u.info(Vt.green(`Successfully notified Transcend in "${m/1e3}" seconds for ${y} requests, ${c} requests were skipped because data silo was not attached to the request!`)),t.length}import Ut from"colors";import{groupBy as Qt}from"lodash-es";async function ga({auth:n,sombraAuth:e,actions:s=[],statuses:l=[],identifierSearch:a,pageLimit:o=100,transcendUrl:i=C,createdAtBefore:r,createdAtAfter:t,isTest:y}){let c=w(i,n),g=await W(i,n,e),m="";r&&(m+=` before ${r.toISOString()}`),t&&(m+=`${m?", and":""} after ${t.toISOString()}`),u.info(Ut.magenta(`${s.length>0?`Pulling requests of type "${s.join('" , "')}"`:"Pulling all requests"}${m}`));let d=await E(c,{actions:s,text:a,statuses:l,createdAtBefore:r,createdAtAfter:t,isTest:y}),p=await b(d,async h=>{let S=await ye(c,g,{requestId:h.id});return{...h,requestIdentifiers:S}},{concurrency:o});u.info(Ut.magenta(`Pulled ${p.length} requests`));let f=p.map(({attributeValues:h,requestIdentifiers:S,id:N,email:T,type:v,status:x,subjectType:K,details:$,createdAt:_,country:z,locale:j,origin:L,countrySubDivision:B,isSilent:Y,isTest:k,coreIdentifier:O,...H})=>({"Request ID":N,"Created At":_,Email:T,"Core Identifier":O,"Request Type":v,"Data Subject Type":K,Status:x,Country:z,"Country Sub Division":B,Details:$,Origin:L,"Silent Mode":Y,"Is Test Request":k,Language:j,...H,...Object.entries(Qt(h,"attributeKey.name")).reduce((fe,[ae,U])=>Object.assign(fe,{[ae]:U.map(({name:V})=>V).join(",")}),{}),...Object.entries(Qt(S,"name")).reduce((fe,[ae,U])=>Object.assign(fe,{[ae]:U.map(({value:V})=>V).join(",")}),{})}));return{requestsWithRequestIdentifiers:p,requestsFormattedForCsv:f}}import Gt from"colors";import Kt from"cli-progress";import{RequestStatus as zt}from"@transcend-io/privacy-types";async function wa({dataSiloId:n,auth:e,concurrency:s=100,status:l="SKIPPED",transcendUrl:a=C,requestStatuses:o=[zt.Compiling,zt.Secondary]}){let i=w(a,e),r=new Date().getTime(),t=await Ye(i,{dataSiloId:n,requestStatuses:o});u.info(Gt.magenta(`Processing data silo: "${n}" marking "${t.length}" requests as skipped.`));let y=new Kt.SingleBar({},Kt.Presets.shades_classic),c=0;y.start(t.length,0),await b(t,async d=>{try{await P(i,Be,{requestDataSiloId:d.id,status:l})}catch(p){if(!p.message.includes("Client error: Request must be active:"))throw p}c+=1,y.update(c)},{concurrency:s}),y.stop();let m=new Date().getTime()-r;return u.info(Gt.green(`Successfully skipped "${t.length}" requests in "${m/1e3}" seconds!`)),t.length}import Yt from"colors";import{RequestStatus as us}from"@transcend-io/privacy-types";import Wt from"cli-progress";async function $a({requestActions:n,identifierNames:e,auth:s,concurrency:l=20,transcendUrl:a=C}){let o=w(a,s),i=new Date().getTime(),r=new Wt.SingleBar({},Wt.Presets.shades_classic),t=await E(o,{actions:n,statuses:[us.Enriching]});u.info(Yt.magenta("Fetched requests in preflight/enriching state."));let y=0,c=0;r.start(t.length,0),await b(t,async d=>{let f=(await Ke(o,{requestId:d.id})).filter(({isVerifiedAtLeastOnce:h,name:S})=>h===!1&&e.includes(S)).map(({id:h})=>h);f.length>0&&(await P(o,Qe,{input:{requestId:d.id,requestIdentifierIds:f}}),c+=f.length),y+=1,r.update(y)},{concurrency:l}),r.stop();let m=new Date().getTime()-i;return u.info(Yt.green(`Successfully cleared out unverified identifiers "${m/1e3}" seconds for ${y} requests, ${c} identifiers were cleared out!`)),t.length}export{A as a,ce as b,Ce as c,Re as d,ie as e,Je as f,Ze as g,He as h,he as i,Xe as j,Se as k,ne as l,ee as m,Ie as n,st as o,ot as p,nt as q,G as r,ut as s,Ys as t,mt as u,pt as v,Pr as w,wo as x,Dr as y,ft as z,yt as A,xr as B,Lr as C,qt as D,Rt as E,Yo as F,ve as G,Tt as H,li as I,Ri as J,It as K,ji as L,Et as M,Ae as N,ln as O,$t as P,En as Q,_n as R,Wn as S,ia as T,ga as U,wa as V,$a as W};
1
+ import{$ as Ve,Ae as ye,Be as qe,Ca as Qe,Ce as Ye,De as We,Y as de,Z as ke,_ as oe,_b as P,a as je,b,dd as ge,ea as Me,pe as w,q as Fe,qe as W,se as Ge,ue as Ke,wa as Be,we as ze,xa as Ue,y as _e,ye as E}from"./chunk-LE6MXFBT.js";import{a as u}from"./chunk-OERYFLN2.js";import{e as C}from"./chunk-APA5PR4U.js";import{applyEnum as Jt,valuesOf as le}from"@transcend-io/type-utils";import{LanguageKey as Zt}from"@transcend-io/internationalization";import{CompletedRequestStatus as Ht,RequestAction as Xt,IsoCountryCode as er,IsoCountrySubdivisionCode as tr}from"@transcend-io/privacy-types";import*as R from"io-ts";var A="[NONE]",ce="[APPLY VALUE TO ALL ROWS]",Ce="<blank>",Re=["email","coreIdentifier"],ie=(c=>(c.Email="email",c.CoreIdentifier="coreIdentifier",c.RequestType="requestType",c.SubjectType="subjectType",c.Locale="locale",c.Country="country",c.CountrySubDivision="countrySubDivision",c.RequestStatus="requestStatus",c.CreatedAt="createdAt",c.DataSiloIds="dataSiloIds",c))(ie||{}),Je={email:!1,coreIdentifier:!0,requestType:!0,subjectType:!0,requestStatus:!1,createdAt:!1,dataSiloIds:!1,locale:!1,country:!1,countrySubDivision:!1},Ze={requestType:!0,subjectType:!0},He=R.type({columnNames:R.partial(Jt(ie,()=>R.string)),identifierNames:R.record(R.string,R.string),attributeNames:R.record(R.string,R.string),requestTypeToRequestAction:R.record(R.string,le(Xt)),subjectTypeToSubjectName:R.record(R.string,R.string),languageToLocale:R.record(R.string,le(Zt)),regionToCountry:R.record(R.string,le({...er,[A]:A})),regionToCountrySubDivision:R.record(R.string,le({...tr,[A]:A})),statusToRequestStatus:R.record(R.string,le({...Ht,[A]:A}))}),he=R.type({id:R.string,link:R.string,rowIndex:R.number,coreIdentifier:R.string,attemptedAt:R.string}),Xe=R.type({failingRequests:R.array(R.record(R.string,R.any)),successfulRequests:R.array(he),duplicateRequests:R.array(R.type({rowIndex:R.number,coreIdentifier:R.string,attemptedAt:R.string}))});import rr from"inquirer";import et from"fuzzysearch";function Se(n,e){return et(n.toLowerCase(),e.toLowerCase())||et(e.toLowerCase(),n.toLowerCase())}function ne(n,e,s,l){let a=n.filter(o=>Se(e.toLowerCase(),o.toLowerCase()));return[...a,new rr.Separator,...s?[]:[A],...l?[ce]:[],...n.filter(o=>!a.includes(o))]}import tt from"inquirer";import sr from"inquirer-autocomplete-prompt";import{apply as or}from"@transcend-io/type-utils";async function ee(n,e,s){tt.registerPrompt("autocomplete",sr);let l=n.map(o=>o||"<blank>").filter(o=>!s[o]);if(l.length===0)return s;let a=await tt.prompt(l.map(o=>({name:o,message:`Map value of: ${o}`,type:"autocomplete",default:e.find(i=>Se(o,i)),source:(i,r)=>r?e.filter(t=>typeof t=="string"&&Se(r,t)):e})));return{...s,...or(a,o=>typeof o=="string"?o:Object.values(o)[0])}}function Ie(n){return n.split(",").map(e=>e.trim()).filter(e=>e)}import rt from"colors";import*as te from"io-ts";var st=te.type({key:te.string,values:te.array(te.string)});function ot(n){let e=n.map(s=>{let[l,a]=s.trim().split(":");if(!a)throw new Error("Expected attributes in key:value1;value2,key2:value3;value4");let o=a.split(";");return{key:l,values:o}});return u.info(rt.magenta("Attributes to apply to all requests:")),u.info(rt.magenta(JSON.stringify(e,null,2))),e}import{parse as ir}from"csv-parse/sync";import{readFileSync as nr}from"fs";import*as it from"io-ts";import{decodeCodec as ar}from"@transcend-io/type-utils";function nt(n,e,s={columns:!0}){let l=ir(nr(n,"utf-8"),s);return ar(it.array(e),l).map(i=>Object.entries(i).reduce((r,[t,y])=>Object.assign(r,{[t.replace(/[^a-z_.+\-A-Z -~]/g,"")]:y}),{}))}import{uniq as ur}from"lodash-es";function G(n,e){return ur(n.map(s=>s[e]||"").flat())}import at from"inquirer";import lr from"colors";import{uniq as cr}from"lodash-es";async function ut(n){let e=cr(n.map(a=>Object.keys(a)).flat()),s=n,l=!0;for(;l;){let{filterColumnName:a}=await at.prompt([{name:"filterColumnName",message:`If you need to filter the list of requests to import, choose the column to filter on. Currently ${s.length} rows.`,type:"list",default:e,choices:[A,...e]}]);if(l=A!==a,l){let o=G(s,a),{valuesToKeep:i}=await at.prompt([{name:"valuesToKeep",message:"Keep rows matching this value",type:"checkbox",default:e,choices:o}]);s=s.filter(r=>i.includes(r[a]))}}return u.info(lr.magenta(`Importing ${s.length} requests`)),s}import lt from"colors";import{RequestStatus as J}from"@transcend-io/privacy-types";import ct from"cli-progress";async function Ys({requestActions:n,auth:e,requestIds:s,statuses:l=[J.Compiling,J.RequestMade,J.Delayed,J.Approving,J.Secondary,J.Enriching,J.Waiting,J.SecondaryApproving],createdAtAfter:a,createdAtBefore:o,concurrency:i=100,transcendUrl:r=C}){let t=w(r,e),y=new Date().getTime(),c=new ct.SingleBar({},ct.Presets.shades_classic),g=await E(t,{actions:n,statuses:l,createdAtBefore:o,createdAtAfter:a,isSilent:!1,requestIds:s});u.info(lt.magenta(`Marking "${g.length}" as silent mode.`));let m=0;c.start(g.length,0),await b(g,async f=>{await P(t,oe,{input:{id:f.id,isSilent:!0}}),m+=1,c.update(m)},{concurrency:i}),c.stop();let p=new Date().getTime()-y;return u.info(lt.green(`Successfully marked ${m} requests as silent mode in "${p/1e3}" seconds!`)),g.length}import{getValues as mr,getEntries as pr}from"@transcend-io/type-utils";import fr from"inquirer";import{startCase as dr}from"lodash-es";async function mt(n,e){let s=mr(ie).filter(a=>!e.getValue("columnNames",a)),l=s.length===0?{}:await fr.prompt(s.map(a=>{let o=dr(a.replace("ColumnName","")),i=ne(n,o,Je[a],!!Ze[a]);return{name:a,message:`Choose the column that will be used to map in the field: ${o}`,type:"list",default:i[0],choices:i}}));return await Promise.all(pr(l).map(([a,o])=>e.setValue(o,"columnNames",a))),l}import re from"colors";import{CompletedRequestStatus as gr,RequestAction as yr,IsoCountryCode as qr,IsoCountrySubdivisionCode as Rr}from"@transcend-io/privacy-types";import{LanguageKey as hr}from"@transcend-io/internationalization";async function pt(n,e,{state:s,columnNameMap:l}){let a=f=>s.getValue("columnNames",f)||l[f],{internalSubjects:o}=await P(n,_e);u.info(re.magenta("Determining mapping of columns for request action"));let i=await ee(G(e,a("requestType")),Object.values(yr),s.getValue("requestTypeToRequestAction"));await s.setValue(i,"requestTypeToRequestAction"),u.info(re.magenta("Determining mapping of columns for subject"));let r=await ee(G(e,a("subjectType")),o.map(({type:f})=>f),s.getValue("subjectTypeToSubjectName"));await s.setValue(r,"subjectTypeToSubjectName"),u.info(re.magenta("Determining mapping of columns for locale"));let t=await ee(G(e,a("locale")),Object.values(hr),s.getValue("languageToLocale"));await s.setValue(t,"languageToLocale"),u.info(re.magenta("Determining mapping of columns for request status")),u.info(re.magenta("Determining mapping of columns for request status"));let y=a("requestStatus"),c=y===A?{}:await ee(G(e,y),[...Object.values(gr),A],s.getValue("statusToRequestStatus"));await s.setValue(c,"statusToRequestStatus"),u.info(re.magenta("Determining mapping of columns for country"));let g=a("country"),m=g===A?{}:await ee(G(e,g),[...Object.values(qr),A],s.getValue("regionToCountry"));await s.setValue(m,"regionToCountry"),u.info(re.magenta("Determining mapping of columns for country sub division"));let d=a("countrySubDivision"),p=d===A?{}:await ee(G(e,d),[...Object.values(Rr),A],s.getValue("regionToCountrySubDivision"));await s.setValue(p,"regionToCountrySubDivision")}import{LanguageKey as Sr}from"@transcend-io/internationalization";import{DateFromISOString as br}from"io-ts-types";import*as D from"io-ts";import{NORMALIZE_PHONE_NUMBER as Tr,CompletedRequestStatus as Ar,RequestAction as wr,IdentifierType as be,IsoCountryCode as Cr,IsoCountrySubdivisionCode as Ir}from"@transcend-io/privacy-types";import{valuesOf as me}from"@transcend-io/type-utils";var Pr=D.record(D.string,D.array(D.intersection([D.type({value:D.string}),D.partial({name:D.string})]))),wo=D.intersection([D.type({email:D.string,attestedExtraIdentifiers:Pr,coreIdentifier:D.string,requestType:me(wr),subjectType:D.string}),D.partial({country:me(Cr),countrySubDivision:me(Ir),attributes:D.array(st),status:me(Ar),createdAt:br,dataSiloIds:D.array(D.string),locale:me(Sr)})]);function Dr(n,e,s){if(e===be.Email)return n.toLowerCase();if(e===be.Phone){let l=n.replace(Tr,"").replace(/[()]/g,"").replace(/[–]/g,"").replace(/[:]/g,"").replace(/[‭‬]/g,"").replace(/[A-Za-z]/g,"");return l?l.startsWith("+")?l:`+${s}${l}`:""}return n}function ft(n,e,{columnNameMap:s,identifierNameMap:l,attributeNameMap:a,requestAttributeKeys:o,defaultPhoneCountryCode:i="1"}){let r=t=>e.getValue("columnNames",t)||s[t];return n.map(t=>{let y={};Object.entries(l).filter(([,d])=>d!==A).forEach(([d,p])=>{let f=Object.values(be).includes(d)?d:be.Custom,h=t[p];if(h){let S=Dr(h,f,i);S&&(y[f]||(y[f]=[]),y[f].push({value:S,name:d}))}});let c=[];Object.entries(a).filter(([,d])=>d!==A).forEach(([d,p])=>{let f=t[p];if(f){let h=o.find(S=>S.name===d)?.type==="MULTI_SELECT";c.push({values:h?Ie(f):f,key:d})}});let g=r("requestType"),m=r("subjectType");return[t,{email:t[r("email")],attestedExtraIdentifiers:y,attributes:c,coreIdentifier:t[r("coreIdentifier")],requestType:g===ce?e.getValue("requestTypeToRequestAction",Ce):e.getValue("requestTypeToRequestAction",t[g]),subjectType:m===ce?e.getValue("subjectTypeToSubjectName",Ce):e.getValue("subjectTypeToSubjectName",t[m]),...r("locale")!==A&&t[r("locale")]?{locale:e.getValue("languageToLocale",t[r("locale")])}:{},...r("country")!==A&&t[r("country")]?{country:e.getValue("regionToCountry",t[r("country")])}:{},...r("countrySubDivision")!==A&&t[r("countrySubDivision")]?{countrySubDivision:e.getValue("regionToCountrySubDivision",t[r("countrySubDivision")])}:{},...r("requestStatus")!==A&&e.getValue("statusToRequestStatus",t[r("requestStatus")])!==A&&t[r("requestStatus")]?{status:e.getValue("statusToRequestStatus",t[r("requestStatus")])}:{},...r("createdAt")!==A&&t[r("createdAt")]?{createdAt:new Date(t[r("createdAt")])}:{},...r("dataSiloIds")!==A&&t[r("dataSiloIds")]?{dataSiloIds:Ie(t[r("dataSiloIds")])}:{}}]})}import dt from"colors";import gt from"cli-progress";import*as q from"io-ts";import{decodeCodec as Er,valuesOf as vr}from"@transcend-io/type-utils";import{TableEncryptionType as Nr}from"@transcend-io/privacy-types";var yt=q.type({defaultMessage:q.string,id:q.string}),xr=q.type({downloadKey:q.string,error:q.union([q.null,q.string]),mimetype:q.string,size:q.string,fileName:q.string,dataPoint:q.type({id:q.string,title:q.union([yt,q.null]),description:q.union([yt,q.null]),name:q.string,slug:q.string,encryption:q.union([vr(Nr),q.null]),dataSilo:q.type({id:q.string,title:q.string,description:q.string,type:q.string,outerType:q.union([q.string,q.null])}),path:q.array(q.string)})}),Lr=q.type({nodes:q.array(xr),totalCount:q.number,_links:q.partial({next:q.union([q.string,q.null]),previous:q.union([q.string,q.null])})});async function qt(n,{sombra:e,concurrency:s=5,limit:l=100}){u.info(dt.magenta(`Pulling file metadata for ${n.length} requests`));let a=new Date().getTime(),o=new gt.SingleBar({},gt.Presets.shades_classic),i=0;o.start(n.length,0);let r=await b(n,async c=>{let g=[],m=!0,d=0;for(;m;){let p;try{let f=await e.get(`v1/data-subject-request/${c.id}/download-keys`,{searchParams:{limit:l,offset:d}}).json();p=Er(Lr,f),g.push(...p.nodes),d+=l,m=!!p._links.next&&p.nodes.length===l}catch(f){throw new Error(`Received an error from server: ${f?.response?.body||f?.message}`)}}return i+=1,o.update(i),[c,g]},{concurrency:s});o.stop();let y=new Date().getTime()-a;return u.info(dt.green(`Successfully downloaded file metadata ${n.length} requests in "${y/1e3}" seconds!`)),r}import $r from"colors";async function Rt(n,{requestId:e,sombra:s,onFileDownloaded:l,concurrency:a=20}){await b(n,async o=>{try{await s.get("v1/files",{searchParams:{downloadKey:o.downloadKey}}).buffer().then(i=>l(o,i))}catch(i){if(i?.response?.body?.includes("fileMetadata#verify")){u.error($r.red(`Failed to pull file for: ${o.fileName} (request:${e}) - JWT expired. This likely means that the file is no longer available. Try restarting the request from scratch in Transcend Admin Dashboard. Skipping the download of this file.`));return}throw new Error(`Received an error from server: ${i?.response?.body||i?.message}`)}},{concurrency:a})}import{existsSync as Pe,mkdirSync as De,writeFileSync as Or}from"fs";import{dirname as jr,join as ht}from"path";import St from"colors";import{RequestAction as Fr,RequestStatus as Ee}from"@transcend-io/privacy-types";import bt from"cli-progress";async function Yo({auth:n,folderPath:e,requestIds:s,createdAtBefore:l,sombraAuth:a,createdAtAfter:o,statuses:i=[Ee.Approving,Ee.Downloadable],concurrency:r=5,transcendUrl:t=C,approveAfterDownload:y=!1}){let c=w(t,n),g=await W(t,n,a);Pe(e)||De(e);let m=await E(c,{actions:[Fr.Access],createdAtBefore:l,createdAtAfter:o,statuses:i,requestIds:s}),d=await qt(m,{sombra:g,concurrency:r}),p=new Date().getTime(),f=new bt.SingleBar({},bt.Presets.shades_classic),h=0,S=0;f.start(m.length,0),await b(d,async([v,x])=>{let K=ht(e,v.id);Pe(K)||De(K),await Rt(x,{sombra:g,requestId:v.id,onFileDownloaded:($,_)=>{let z=ht(K,$.fileName),j=jr(z);Pe(j)||De(j,{recursive:!0}),Or(z,_)}}),y&&v.status===Ee.Approving&&(await P(c,de,{input:{requestId:v.id}}),S+=1),h+=1,f.update(h)},{concurrency:r}),f.stop();let T=new Date().getTime()-p;return u.info(St.green(`Successfully downloaded ${h} requests in "${T/1e3}" seconds!`)),S>0&&u.info(St.green(`Approved ${S} requests in Transcend.`)),m.length}import*as I from"io-ts";import{uniq as _r}from"lodash-es";import{valuesOf as Te,decodeCodec as kr}from"@transcend-io/type-utils";import{IsoCountryCode as Vr,IsoCountrySubdivisionCode as Mr,RequestAction as Br,RequestStatus as Ur}from"@transcend-io/privacy-types";var ve=I.type({id:I.string,link:I.string,status:Te(Ur),type:Te(Br),subjectType:I.string,email:I.union([I.null,I.string]),coreIdentifier:I.string,isSilent:I.boolean,isTest:I.boolean,country:I.union([I.null,Te(Vr)]),countrySubDivision:I.union([I.null,Te(Mr)]),attributeValues:I.array(I.type({attributeKey:I.type({name:I.string}),name:I.string}))});async function Tt(n,e,{details:s="",isTest:l=!1,emailIsVerified:a=!0,skipSendingReceipt:o=!1,isSilent:i=!0,additionalAttributes:r=[]}={}){let t=[...r];(e.attributes||[]).forEach(g=>{let m=t.find(d=>d.key===g.key);m?(m.values.push(...g.values),m.values=_r(m.values)):t.push(g)});let y;try{y=await n.post("v1/data-subject-request",{json:{type:e.requestType,subject:{coreIdentifier:e.coreIdentifier,email:e.email,emailIsVerified:a,attestedExtraIdentifiers:e.attestedExtraIdentifiers},subjectType:e.subjectType,isSilent:i,isTest:l,skipSendingReceipt:o,...e.locale?{locale:e.locale}:{},details:s,attributes:t,...e.country||e.countrySubDivision?{region:{...e.country?{country:e.country}:e.countrySubDivision?{country:e.countrySubDivision.split("-")[0]}:{},...e.countrySubDivision?{countrySubDivision:e.countrySubDivision}:{}}}:{},...e.createdAt?{createdAt:e.createdAt}:{},...e.dataSiloIds?{dataSiloIds:e.dataSiloIds}:{},...e.status?{completedRequestStatus:e.status}:{}}}).json()}catch(g){throw new Error(`Received an error from server: ${g?.response?.body||g?.message}`)}let{request:c}=kr(I.type({request:ve}),y);return c}import Ne from"colors";import{RequestStatus as Qr}from"@transcend-io/privacy-types";import At from"cli-progress";async function li({requestActions:n,requestOrigins:e,auth:s,silentModeBefore:l,createdAtAfter:a,createdAtBefore:o,concurrency:i=50,transcendUrl:r=C}){let t=w(r,s),y=new Date().getTime(),c=new At.SingleBar({},At.Presets.shades_classic),g=await E(t,{actions:n,statuses:[Qr.Approving],createdAtAfter:a,origins:e,createdAtBefore:o});u.info(Ne.magenta(`Approving "${g.length}" requests.`));let m=0,d=0;c.start(g.length,0),await b(g,async h=>{l&&new Date(l)>new Date(h.createdAt)&&await P(t,oe,{input:{id:h.id,isSilent:!0}});try{await P(t,de,{input:{requestId:h.id}})}catch(S){S.message.includes("Request must be in an approving state,")&&(d+=1)}m+=1,c.update(m)},{concurrency:i}),c.stop();let f=new Date().getTime()-y;return d>0&&u.info(Ne.yellow(`${d} requests were skipped.`)),u.info(Ne.green(`Successfully approved ${m} requests in "${f/1e3}" seconds!`)),g.length}import wt from"colors";import{RequestAction as Gr}from"@transcend-io/privacy-types";import Ct from"cli-progress";async function Ri({requestActions:n=Object.values(Gr),auth:e,requestIds:s,createdAtBefore:l,days:a=45,daysLeft:o=10,createdAtAfter:i,emailTemplate:r="Additional Time Needed",concurrency:t=100,transcendUrl:y=C}){let c=w(y,e),g=new Date().getTime(),m=new Ct.SingleBar({},Ct.Presets.shades_classic),p=(await ge(c,r)).find(T=>T.title===r);if(!p)throw new Error(`Failed to find a template with title: "${r}"`);let f=await E(c,{actions:n,createdAtBefore:l,createdAtAfter:i,isSilent:!1,isClosed:!1,requestIds:s});f=f.filter(T=>typeof T.daysRemaining=="number"&&T.daysRemaining<o),u.info(wt.magenta(`Notifying "${f.length}" that more time is needed.`));let h=0;m.start(f.length,0),await b(f,async T=>{await P(c,Ve,{input:{requestId:T.id,template:p.template.defaultMessage,subject:p.subject.defaultMessage,additionalTime:a}}),h+=1,m.update(h)},{concurrency:t}),m.stop();let N=new Date().getTime()-g;return u.info(wt.green(`Successfully marked ${h} requests as silent mode in "${N/1e3}" seconds!`)),f.length}import Kr from"inquirer";async function It(n,e,s){let{initializer:l}=await P(n,Fe),a=l.identifiers.filter(({name:i})=>!s.getValue("identifierNames",i)&&!Re.includes(i)),o=a.length===0?{}:await Kr.prompt(a.map(({name:i})=>{let r=ne(e,i,!1);return{name:i,message:`Choose the column that will be used to map in the identifier: ${i}`,type:"list",default:r[0],choices:r}}));return await Promise.all(Object.entries(o).map(([i,r])=>s.setValue(r,"identifierNames",i))),{...s.getValue("identifierNames"),...o}}import Pt from"colors";import{RequestStatus as Z}from"@transcend-io/privacy-types";import Dt from"cli-progress";async function ji({requestActions:n,cancellationTitle:e,auth:s,requestIds:l,silentModeBefore:a,createdAtBefore:o,createdAtAfter:i,statuses:r=[Z.Compiling,Z.RequestMade,Z.Delayed,Z.Approving,Z.Secondary,Z.Enriching,Z.Waiting,Z.SecondaryApproving],concurrency:t=50,transcendUrl:y=C}){let c=w(y,s),g=new Date().getTime(),m=new Dt.SingleBar({},Dt.Presets.shades_classic),d;if(e){let T=(await ge(c,e)).find(v=>v.title===e);if(!T)throw new Error(`Failed to find a template with title: "${e}"`);d=T}let p=await E(c,{actions:n,createdAtBefore:o,createdAtAfter:i,statuses:r,requestIds:l});u.info(Pt.magenta(`Canceling "${p.length}" requests${d?` Using template: ${d.title}`:""}.`));let f=0;m.start(p.length,0),await b(p,async N=>{a&&new Date(a)>new Date(N.createdAt)&&await P(c,oe,{input:{id:N.id,isSilent:!0}}),await P(c,ke,{input:{requestId:N.id,...d?{subject:`Re: ${d.subject.defaultMessage}`,template:d.template.defaultMessage}:{}}}),f+=1,m.update(f)},{concurrency:t}),m.stop();let S=new Date().getTime()-g;return u.info(Pt.green(`Successfully canceled ${f} requests in "${S/1e3}" seconds!`)),p.length}import zr from"inquirer";async function Et(n,e,s,l){let a=l.filter(({name:i})=>!s.getValue("attributeNames",i)),o=a.length===0?{}:await zr.prompt(a.map(({name:i})=>{let r=ne(e,i,!1);return{name:i,message:`Choose the column that will be used to map in the attribute: ${i}`,type:"list",default:r[0],choices:r}}));return await Promise.all(Object.entries(o).map(([i,r])=>s.setValue(r,"attributeNames",i))),{...s.getValue("attributeNames"),...o}}var vt=/{\\"message\\":\\"(.+?)\\",/;function Ae(n){return vt.test(n)?vt.exec(n)[1]:null}import F from"colors";import*as pe from"io-ts";import{uniq as Yr}from"lodash-es";import Nt from"cli-progress";import{join as Wr}from"path";import{PersistedState as xt}from"@transcend-io/persisted-state";async function ln({cacheFilepath:n,requestReceiptFolder:e,file:s,auth:l,sombraAuth:a,concurrency:o=100,defaultPhoneCountryCode:i="1",transcendUrl:r=C,attributes:t=[],emailIsVerified:y=!0,skipFilterStep:c=!1,skipSendingReceipt:g=!0,isTest:m=!1,isSilent:d=!0,debug:p=!1,dryRun:f=!1}){let h=new Date().getTime(),S=new Nt.SingleBar({},Nt.Presets.shades_classic),N=ot(t),T=new xt(n,He,{columnNames:{},requestTypeToRequestAction:{},subjectTypeToSubjectName:{},languageToLocale:{},statusToRequestStatus:{},identifierNames:{},attributeNames:{},regionToCountrySubDivision:{},regionToCountry:{}}),v=Wr(e,`tr-request-upload-${new Date().toISOString()}-${s.split("/").pop()}`.replace(".csv",".json")),x=new xt(v,Xe,{successfulRequests:[],duplicateRequests:[],failingRequests:[]}),K=await W(r,l,a),$=nt(s,pe.record(pe.string,pe.string)),_=Yr($.map(U=>Object.keys(U)).flat());if($.length===0)throw new Error("No Requests found in list! Ensure the first row of the CSV is a header and the rest are requests.");if(p){let U=$[0];u.info(F.magenta(`First request: ${JSON.stringify(U,null,2)}`))}let z=c?$:await ut($),j=w(r,l),L=await ze(j),B=await mt(_,T),Y=await It(j,_,T),k=await Et(j,_,T,L);await pt(j,z,{state:T,columnNameMap:B});let O=ft(z,T,{defaultPhoneCountryCode:i,columnNameMap:B,identifierNameMap:Y,attributeNameMap:k,requestAttributeKeys:L});p||S.start(O.length,0);let H=0;await b(O,async([U,V],Q)=>{let Oe=p?`email:${V.email} | coreIdentifier:${V.coreIdentifier}`:`row:${Q.toString()}`;if(p&&u.info(F.magenta(`[${Q+1}/${O.length}] Importing: ${JSON.stringify(V,null,2)}`)),f){u.info(F.magenta("Bailing out on dry run because dryRun is set"));return}try{let X=await Tt(K,V,{details:`Uploaded by Transcend Cli: "tr-request-upload" : ${JSON.stringify(U,null,2)}`,isTest:m,emailIsVerified:y,skipSendingReceipt:g,isSilent:d,additionalAttributes:N});p&&(u.info(F.green(`[${Q+1}/${O.length}] Successfully submitted the test data subject request: "${Oe}"`)),u.info(F.green(`[${Q+1}/${O.length}] View it at: "${X.link}"`)));let se=x.getValue("successfulRequests");se.push({id:X.id,link:X.link,rowIndex:Q,coreIdentifier:X.coreIdentifier,attemptedAt:new Date().toISOString()}),await x.setValue(se,"successfulRequests")}catch(X){let se=`${X.message} - ${JSON.stringify(X.response?.body,null,2)}`,we=Ae(se);if(we==="Client error: You have already made this request."){p&&u.info(F.yellow(`[${Q+1}/${O.length}] Skipping request as it is a duplicate`));let ue=x.getValue("duplicateRequests");ue.push({coreIdentifier:V.coreIdentifier,rowIndex:Q,attemptedAt:new Date().toISOString()}),await x.setValue(ue,"duplicateRequests")}else{let ue=x.getValue("failingRequests");ue.push({...V,rowIndex:Q,error:we||se,attemptedAt:new Date().toISOString()}),await x.setValue(ue,"failingRequests"),p&&(u.error(F.red(we||se)),u.error(F.red(`[${Q+1}/${O.length}] Failed to submit request for: "${Oe}"`)))}}H+=1,p||S.update(H)},{concurrency:o}),S.stop();let ae=new Date().getTime()-h;u.info(F.green(`Completed upload in "${ae/1e3}" seconds.`)),x.getValue("duplicateRequests").length>0&&u.info(F.yellow(`Encountered "${x.getValue("duplicateRequests").length}" duplicate requests. See "${v}" to review the core identifiers for these requests.`)),x.getValue("failingRequests").length>0&&(u.error(F.red(`Encountered "${x.getValue("failingRequests").length}" errors. See "${v}" to review the error messages and inputs.`)),process.exit(1))}import*as Lt from"io-ts";import{groupBy as Jr}from"lodash-es";import{apply as Zr,decodeCodec as Hr}from"@transcend-io/type-utils";import{IdentifierType as xe}from"@transcend-io/privacy-types";async function $t(n,e,{sendEmailReceipt:s=!1,skipWaitingPeriod:l=!1,emailIsVerified:a=!0,requestIdentifiers:o=[]}={}){let i=await n.post("v1/data-subject-request",{json:{type:e.type,subject:{coreIdentifier:e.coreIdentifier,email:e.email,emailIsVerified:a,...o.length>0?{attestedExtraIdentifiers:Zr(Jr(o.filter(t=>!(t.name==="email"&&t.value===e.email)&&!Re.includes(t.name)).map(t=>({...t,type:Object.values(xe).includes(t.name)?t.name:xe.Custom})),"type"),(t,y)=>t.map(({name:c,value:g})=>({...y===xe.Custom?{name:c}:{},value:g})))}:{}},requestId:e.id,subjectType:e.subjectType,isSilent:e.isSilent,isTest:e.isTest,locale:e.locale,skipWaitingPeriod:l,createdAt:e.createdAt,details:`Restarted by Transcend cli: "tr-request-restart" - ${e.details}`,skipSendingReceipt:!s}}).json(),{request:r}=Hr(Lt.type({request:ve}),i);return r}import{PersistedState as Xr}from"@transcend-io/persisted-state";import Ot from"cli-progress";import Le from"colors";import*as M from"io-ts";import{difference as es}from"lodash-es";import{join as ts}from"path";var rs=M.intersection([he,M.type({error:M.string})]),ss=M.type({restartedRequests:M.array(he),failingRequests:M.array(rs)});async function En({requestReceiptFolder:n,auth:e,sombraAuth:s,requestActions:l,requestStatuses:a,createdAtBefore:o,createdAtAfter:i,transcendUrl:r=C,requestIds:t=[],createdAt:y=new Date,silentModeBefore:c,sendEmailReceipt:g=!1,emailIsVerified:m=!0,copyIdentifiers:d=!1,skipWaitingPeriod:p=!1,concurrency:f=20}){let h=new Date().getTime(),S=new Ot.SingleBar({},Ot.Presets.shades_classic),N=ts(n,`tr-request-restart-${new Date().toISOString()}`),T=new Xr(N,ss,{restartedRequests:[],failingRequests:[]}),v=await W(r,e,s),x=w(r,e),$=(await E(x,{actions:l,statuses:a,createdAtBefore:o,createdAtAfter:i})).filter(L=>new Date(L.createdAt)<y);if(u.info(`Found ${$.length} requests to process`),d&&u.info("copyIdentifiers detected - All Identifiers will be copied."),g&&u.info("sendEmailReceipt detected - Email receipts will be sent."),p&&u.info("skipWaitingPeriod detected - Waiting period will be skipped."),t.length>0&&t.length!==$.length){let L=es(t,$.map(({id:B})=>B));L.length>0&&(u.error(Le.red(`Failed to find the following requests by ID: ${L.join(",")}.`)),process.exit(1))}let _=0;S.start($.length,0),await b($,async(L,B)=>{try{let Y=d?await ye(x,v,{requestId:L.id}):[],k=await $t(v,{...L,isSilent:c&&new Date(L.createdAt)<c?!0:L.isSilent},{requestIdentifiers:Y,skipWaitingPeriod:p,sendEmailReceipt:g,emailIsVerified:m}),O=T.getValue("restartedRequests");O.push({id:k.id,link:k.link,rowIndex:B,coreIdentifier:k.coreIdentifier,attemptedAt:new Date().toISOString()}),await T.setValue(O,"restartedRequests")}catch(Y){let k=`${Y.message} - ${JSON.stringify(Y.response?.body,null,2)}`,O=Ae(k),H=T.getValue("failingRequests");H.push({id:L.id,link:L.link,rowIndex:B,coreIdentifier:L.coreIdentifier,attemptedAt:new Date().toISOString(),error:O||k}),await T.setValue(H,"failingRequests")}_+=1,S.update(_)},{concurrency:f}),S.stop();let j=new Date().getTime()-h;u.info(Le.green(`Completed restarting of requests in "${j/1e3}" seconds.`)),T.getValue("failingRequests").length>0&&(u.error(Le.red(`Encountered "${T.getValue("failingRequests").length}" errors. See "${N}" to review the error messages and inputs.`)),process.exit(1))}import jt from"colors";import Ft from"cli-progress";import{RequestEnricherStatus as _t,RequestStatus as os}from"@transcend-io/privacy-types";async function _n({enricherIds:n,auth:e,concurrency:s=100,transcendUrl:l=C}){let a=w(l,e),o=new Date().getTime(),i=await E(a,{statuses:[os.Enriching]});u.info(jt.magenta(`Processing enricher: "${n.join(",")}" fetched "${i.length}" in enriching status.`));let r=new Ft.SingleBar({},Ft.Presets.shades_classic),t=0;r.start(i.length,0);let y=0;await b(i,async m=>{let p=(await qe(a,{requestId:m.id})).filter(f=>n.includes(f.enricher.id)&&![_t.Resolved,_t.Skipped].includes(f.status));p.length>0&&await je(p,async f=>{try{await P(a,Me,{requestEnricherId:f.id}),y+=1}catch(h){if(!h.message.includes("Client error: Cannot skip Request enricher because it has already completed"))throw h}}),t+=1,r.update(t)},{concurrency:s}),r.stop();let g=new Date().getTime()-o;return u.info(jt.green(`Successfully skipped "${y}" for "${i.length}" requests in "${g/1e3}" seconds!`)),i.length}import{RequestEnricherStatus as is,RequestStatus as ns}from"@transcend-io/privacy-types";import kt from"cli-progress";import $e from"colors";import{difference as as}from"lodash-es";async function Wn({auth:n,requestActions:e=[],createdAtBefore:s,createdAtAfter:l,transcendUrl:a=C,requestEnricherStatuses:o=Object.values(is),requestIds:i=[],enricherId:r,concurrency:t=20}){let y=new Date().getTime(),c=new kt.SingleBar({},kt.Presets.shades_classic),g=w(a,n);u.info($e.magenta("Fetching requests to restart..."));let m=await E(g,{actions:e,statuses:[ns.Enriching],createdAtBefore:s,createdAtAfter:l,requestIds:i}),d=0;if(i.length>0&&i.length!==m.length){let S=as(i,m.map(({id:N})=>N));S.length>0&&(u.error($e.red(`Failed to find the following requests by ID: ${S.join(",")}.`)),process.exit(1))}let p=0;c.start(m.length,0),await b(m,async S=>{let T=(await qe(g,{requestId:S.id})).filter(v=>v.enricher.id===r&&o.includes(v.status));await b(T,async v=>{await Ge(g,v.id),d+=1}),p+=1,c.update(p)},{concurrency:t}),c.stop();let h=new Date().getTime()-y;u.info($e.green(`Completed restarting of ${m.length} requests and ${d} enrichers in "${h/1e3}" seconds.`))}import Vt from"colors";import{RequestStatus as Mt}from"@transcend-io/privacy-types";import Bt from"cli-progress";async function ia({requestActions:n,dataSiloId:e,auth:s,concurrency:l=20,transcendUrl:a=C}){let o=w(a,s),i=new Date().getTime(),r=new Bt.SingleBar({},Bt.Presets.shades_classic),t=await E(o,{actions:n,statuses:[Mt.Compiling,Mt.Approving]});u.info(Vt.magenta(`Retrying requests for Data Silo: "${e}", restarting "${t.length}" requests.`));let y=0,c=0;r.start(t.length,0),await b(t,async d=>{try{let p=await We(o,{requestId:d.id,dataSiloId:e});await P(o,Ue,{requestDataSiloId:p.id})}catch(p){if(!p.message.includes("Failed to find RequestDataSilo"))throw p;c+=1}y+=1,r.update(y)},{concurrency:l}),r.stop();let m=new Date().getTime()-i;return u.info(Vt.green(`Successfully notified Transcend in "${m/1e3}" seconds for ${y} requests, ${c} requests were skipped because data silo was not attached to the request!`)),t.length}import Ut from"colors";import{groupBy as Qt}from"lodash-es";async function ga({auth:n,sombraAuth:e,actions:s=[],statuses:l=[],identifierSearch:a,pageLimit:o=100,transcendUrl:i=C,createdAtBefore:r,createdAtAfter:t,isTest:y}){let c=w(i,n),g=await W(i,n,e),m="";r&&(m+=` before ${r.toISOString()}`),t&&(m+=`${m?", and":""} after ${t.toISOString()}`),u.info(Ut.magenta(`${s.length>0?`Pulling requests of type "${s.join('" , "')}"`:"Pulling all requests"}${m}`));let d=await E(c,{actions:s,text:a,statuses:l,createdAtBefore:r,createdAtAfter:t,isTest:y}),p=await b(d,async h=>{let S=await ye(c,g,{requestId:h.id});return{...h,requestIdentifiers:S}},{concurrency:o});u.info(Ut.magenta(`Pulled ${p.length} requests`));let f=p.map(({attributeValues:h,requestIdentifiers:S,id:N,email:T,type:v,status:x,subjectType:K,details:$,createdAt:_,country:z,locale:j,origin:L,countrySubDivision:B,isSilent:Y,isTest:k,coreIdentifier:O,...H})=>({"Request ID":N,"Created At":_,Email:T,"Core Identifier":O,"Request Type":v,"Data Subject Type":K,Status:x,Country:z,"Country Sub Division":B,Details:$,Origin:L,"Silent Mode":Y,"Is Test Request":k,Language:j,...H,...Object.entries(Qt(h,"attributeKey.name")).reduce((fe,[ae,U])=>Object.assign(fe,{[ae]:U.map(({name:V})=>V).join(",")}),{}),...Object.entries(Qt(S,"name")).reduce((fe,[ae,U])=>Object.assign(fe,{[ae]:U.map(({value:V})=>V).join(",")}),{})}));return{requestsWithRequestIdentifiers:p,requestsFormattedForCsv:f}}import Gt from"colors";import Kt from"cli-progress";import{RequestStatus as zt}from"@transcend-io/privacy-types";async function wa({dataSiloId:n,auth:e,concurrency:s=100,status:l="SKIPPED",transcendUrl:a=C,requestStatuses:o=[zt.Compiling,zt.Secondary]}){let i=w(a,e),r=new Date().getTime(),t=await Ye(i,{dataSiloId:n,requestStatuses:o});u.info(Gt.magenta(`Processing data silo: "${n}" marking "${t.length}" requests as skipped.`));let y=new Kt.SingleBar({},Kt.Presets.shades_classic),c=0;y.start(t.length,0),await b(t,async d=>{try{await P(i,Be,{requestDataSiloId:d.id,status:l})}catch(p){if(!p.message.includes("Client error: Request must be active:"))throw p}c+=1,y.update(c)},{concurrency:s}),y.stop();let m=new Date().getTime()-r;return u.info(Gt.green(`Successfully skipped "${t.length}" requests in "${m/1e3}" seconds!`)),t.length}import Yt from"colors";import{RequestStatus as us}from"@transcend-io/privacy-types";import Wt from"cli-progress";async function $a({requestActions:n,identifierNames:e,auth:s,concurrency:l=20,transcendUrl:a=C}){let o=w(a,s),i=new Date().getTime(),r=new Wt.SingleBar({},Wt.Presets.shades_classic),t=await E(o,{actions:n,statuses:[us.Enriching]});u.info(Yt.magenta("Fetched requests in preflight/enriching state."));let y=0,c=0;r.start(t.length,0),await b(t,async d=>{let f=(await Ke(o,{requestId:d.id})).filter(({isVerifiedAtLeastOnce:h,name:S})=>h===!1&&e.includes(S)).map(({id:h})=>h);f.length>0&&(await P(o,Qe,{input:{requestId:d.id,requestIdentifierIds:f}}),c+=f.length),y+=1,r.update(y)},{concurrency:l}),r.stop();let m=new Date().getTime()-i;return u.info(Yt.green(`Successfully cleared out unverified identifiers "${m/1e3}" seconds for ${y} requests, ${c} identifiers were cleared out!`)),t.length}export{A as a,ce as b,Ce as c,Re as d,ie as e,Je as f,Ze as g,He as h,he as i,Xe as j,Se as k,ne as l,ee as m,Ie as n,st as o,ot as p,nt as q,G as r,ut as s,Ys as t,mt as u,pt as v,Pr as w,wo as x,Dr as y,ft as z,yt as A,xr as B,Lr as C,qt as D,Rt as E,Yo as F,ve as G,Tt as H,li as I,Ri as J,It as K,ji as L,Et as M,Ae as N,ln as O,$t as P,En as Q,_n as R,Wn as S,ia as T,ga as U,wa as V,$a as W};
@@ -1,4 +1,4 @@
1
- import{c as x}from"./chunk-T5XKXHEX.js";import{n as u,q as D}from"./chunk-ELYPVDLC.js";import{ga as w,ha as _}from"./chunk-HMF46LB7.js";import{Le as O,Me as U,a as R,b as P,bd as b,pc as L,pe as S,qc as M,tc as N,wc as k}from"./chunk-7HDHUOTF.js";import{a as c}from"./chunk-OERYFLN2.js";import{e as C}from"./chunk-APA5PR4U.js";import{ConsentBundleType as H}from"@transcend-io/privacy-types";import A from"colors";async function at({auth:e,deploy:i=!1,transcendUrl:o=C,bundleTypes:t=Object.values(H)}){let r=S(o,e),n=await M(r);await R(t,async a=>{c.info(A.magenta(`Update Consent Manager bundle with ID "${n}" and type "${a}" to latest version...`)),await U(r,{id:n,bundleType:a}),c.info(A.green(`Updated Consent Manager bundle with ID "${n}" and type "${a}" to latest version!`))}),i&&await R(t,async a=>{c.info(A.magenta(`Deploying Consent Manager bundle with ID "${n}" and type "${a}"...`)),await O(r,{id:n,bundleType:a}),c.info(A.green(`Deployed Consent Manager bundle with ID "${n}" and type "${a}"!`))})}import G from"colors";var K=["ID","Activity","Encounters","Last Seen At","Has Native Do Not Sell/Share Support","IAB USP API Support","Service Description","Website URL","Categories of Recipients"];async function Ct({auth:e,trackerStatus:i,file:o,classifyService:t=!1,transcendUrl:r=C}){let n=S(r,e);c.info(G.magenta(`Reading "${o}" from disk`));let l=D(o,w).map(({Type:d,Notes:m,Service:f,Purpose:E,Status:g,Owners:I,Teams:T,"Connections Made To":v,...y})=>({value:v,type:d,description:m,trackingPurposes:u(E),status:g||i,owners:I?u(I):void 0,teams:T?u(T):void 0,attributes:Object.entries(y).filter(([h])=>!K.includes(h)).map(([h,B])=>({key:h,values:u(B)}))}));await b(n,l,t)||(c.error(G.red("Encountered error(s) syncing data flows from CSV, see logs above for more info. ")),process.exit(1))}import F from"colors";var j=["ID","Activity","Encounters","Last Seen At","Has Native Do Not Sell/Share Support","IAB USP API Support","Service Description","Website URL","Categories of Recipients"];async function vt({auth:e,trackerStatus:i,file:o,transcendUrl:t=C}){let r=S(t,e);c.info(F.magenta(`Reading "${o}" from disk`));let a=D(o,_).map(({"Is Regex?":s,Notes:d,Service:m,Purpose:f,Status:E,Owners:g,Teams:I,Name:T,...v})=>({...typeof s=="string"?{isRegex:s.toLowerCase()==="true"}:{},name:T,description:d,trackingPurposes:u(f),status:E||i,owners:g?u(g):void 0,teams:I?u(I):void 0,attributes:Object.entries(v).filter(([y])=>!j.includes(y)).map(([y,h])=>({key:y,values:u(h)}))}));await k(r,a)||(c.error(F.red("Encountered error(s) syncing cookies from CSV, see logs above for more info. ")),process.exit(1))}var Y=1e3,Q=60*Y,V=60*Q,X=24*V,z=7*X;async function Lt(e,{bin:i,start:o,end:t=new Date}){let r=await M(e),n=Math.floor(o.getTime()/1e3),a=Math.floor(t.getTime()/1e3);if(n>a)throw new Error('Received "end" date that happened before "start" date');if(i==="1h"&&t.getTime()-o.getTime()>z*2)throw new Error("When using bin=1h, start and end time can be no more than 2 weeks apart");let l=o.toISOString(),s=t.toISOString(),[d,m,f]=await Promise.all([N(e,{dataSource:"PRIVACY_SIGNAL_TIMESERIES",startDate:l,endDate:s,forceRefetch:!0,airgapBundleId:r,binInterval:i,smoothTimeseries:!1}),N(e,{dataSource:"CONSENT_CHANGES_TIMESERIES",startDate:l,endDate:s,forceRefetch:!0,airgapBundleId:r,binInterval:i,smoothTimeseries:!1}),N(e,{dataSource:"CONSENT_SESSIONS_BY_REGIME",startDate:l,endDate:s,forceRefetch:!0,airgapBundleId:r,binInterval:i,smoothTimeseries:!1})]);return{PRIVACY_SIGNAL_TIMESERIES:d,CONSENT_CHANGES_TIMESERIES:m,CONSENT_SESSIONS_BY_REGIME:f}}var $=e=>new URL(`https://${e}`).hostname.split(".").slice(-2).join(".");import W from"colors";import{difference as q}from"lodash-es";var J=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;async function Ht(e,{xdiLocation:i,transcendUrl:o=C,removeIpAddresses:t=!0,domainBlockList:r=["localhost"],xdiAllowedCommands:n="ConsentManager:Sync"}){let a=Array.isArray(e)?e:[{apiKey:e,organizationId:"",organizationName:""}],l=await P(a,async m=>{c.info(W.magenta(`Pulling consent metadata for organization - ${m.organizationName}`));let f=S(o,m.apiKey);return await L(f)},{concurrency:5}),s={};return l.forEach(m=>{let f=m.partition?.partition||m.bundleURL.split("/").reverse()[1];s[f]||(s[f]=[]);let E=q(m.configuration.domains.filter(g=>!t||!J.test(g)).map(g=>$(g)),r);s[f]=[...new Set([...s[f]||[],...E])]}),{html:`
1
+ import{c as x}from"./chunk-4HZHZ32O.js";import{n as u,q as D}from"./chunk-QXOUJ7DT.js";import{ga as w,ha as _}from"./chunk-HMF46LB7.js";import{Le as O,Me as U,a as R,b as P,bd as b,pc as L,pe as S,qc as M,tc as N,wc as k}from"./chunk-LE6MXFBT.js";import{a as c}from"./chunk-OERYFLN2.js";import{e as C}from"./chunk-APA5PR4U.js";import{ConsentBundleType as H}from"@transcend-io/privacy-types";import A from"colors";async function at({auth:e,deploy:i=!1,transcendUrl:o=C,bundleTypes:t=Object.values(H)}){let r=S(o,e),n=await M(r);await R(t,async a=>{c.info(A.magenta(`Update Consent Manager bundle with ID "${n}" and type "${a}" to latest version...`)),await U(r,{id:n,bundleType:a}),c.info(A.green(`Updated Consent Manager bundle with ID "${n}" and type "${a}" to latest version!`))}),i&&await R(t,async a=>{c.info(A.magenta(`Deploying Consent Manager bundle with ID "${n}" and type "${a}"...`)),await O(r,{id:n,bundleType:a}),c.info(A.green(`Deployed Consent Manager bundle with ID "${n}" and type "${a}"!`))})}import G from"colors";var K=["ID","Activity","Encounters","Last Seen At","Has Native Do Not Sell/Share Support","IAB USP API Support","Service Description","Website URL","Categories of Recipients"];async function Ct({auth:e,trackerStatus:i,file:o,classifyService:t=!1,transcendUrl:r=C}){let n=S(r,e);c.info(G.magenta(`Reading "${o}" from disk`));let l=D(o,w).map(({Type:d,Notes:m,Service:f,Purpose:E,Status:g,Owners:I,Teams:T,"Connections Made To":v,...y})=>({value:v,type:d,description:m,trackingPurposes:u(E),status:g||i,owners:I?u(I):void 0,teams:T?u(T):void 0,attributes:Object.entries(y).filter(([h])=>!K.includes(h)).map(([h,B])=>({key:h,values:u(B)}))}));await b(n,l,t)||(c.error(G.red("Encountered error(s) syncing data flows from CSV, see logs above for more info. ")),process.exit(1))}import F from"colors";var j=["ID","Activity","Encounters","Last Seen At","Has Native Do Not Sell/Share Support","IAB USP API Support","Service Description","Website URL","Categories of Recipients"];async function vt({auth:e,trackerStatus:i,file:o,transcendUrl:t=C}){let r=S(t,e);c.info(F.magenta(`Reading "${o}" from disk`));let a=D(o,_).map(({"Is Regex?":s,Notes:d,Service:m,Purpose:f,Status:E,Owners:g,Teams:I,Name:T,...v})=>({...typeof s=="string"?{isRegex:s.toLowerCase()==="true"}:{},name:T,description:d,trackingPurposes:u(f),status:E||i,owners:g?u(g):void 0,teams:I?u(I):void 0,attributes:Object.entries(v).filter(([y])=>!j.includes(y)).map(([y,h])=>({key:y,values:u(h)}))}));await k(r,a)||(c.error(F.red("Encountered error(s) syncing cookies from CSV, see logs above for more info. ")),process.exit(1))}var Y=1e3,Q=60*Y,V=60*Q,X=24*V,z=7*X;async function Lt(e,{bin:i,start:o,end:t=new Date}){let r=await M(e),n=Math.floor(o.getTime()/1e3),a=Math.floor(t.getTime()/1e3);if(n>a)throw new Error('Received "end" date that happened before "start" date');if(i==="1h"&&t.getTime()-o.getTime()>z*2)throw new Error("When using bin=1h, start and end time can be no more than 2 weeks apart");let l=o.toISOString(),s=t.toISOString(),[d,m,f]=await Promise.all([N(e,{dataSource:"PRIVACY_SIGNAL_TIMESERIES",startDate:l,endDate:s,forceRefetch:!0,airgapBundleId:r,binInterval:i,smoothTimeseries:!1}),N(e,{dataSource:"CONSENT_CHANGES_TIMESERIES",startDate:l,endDate:s,forceRefetch:!0,airgapBundleId:r,binInterval:i,smoothTimeseries:!1}),N(e,{dataSource:"CONSENT_SESSIONS_BY_REGIME",startDate:l,endDate:s,forceRefetch:!0,airgapBundleId:r,binInterval:i,smoothTimeseries:!1})]);return{PRIVACY_SIGNAL_TIMESERIES:d,CONSENT_CHANGES_TIMESERIES:m,CONSENT_SESSIONS_BY_REGIME:f}}var $=e=>new URL(`https://${e}`).hostname.split(".").slice(-2).join(".");import W from"colors";import{difference as q}from"lodash-es";var J=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;async function Ht(e,{xdiLocation:i,transcendUrl:o=C,removeIpAddresses:t=!0,domainBlockList:r=["localhost"],xdiAllowedCommands:n="ConsentManager:Sync"}){let a=Array.isArray(e)?e:[{apiKey:e,organizationId:"",organizationName:""}],l=await P(a,async m=>{c.info(W.magenta(`Pulling consent metadata for organization - ${m.organizationName}`));let f=S(o,m.apiKey);return await L(f)},{concurrency:5}),s={};return l.forEach(m=>{let f=m.partition?.partition||m.bundleURL.split("/").reverse()[1];s[f]||(s[f]=[]);let E=q(m.configuration.domains.filter(g=>!t||!J.test(g)).map(g=>$(g)),r);s[f]=[...new Set([...s[f]||[],...E])]}),{html:`
2
2
  <!DOCTYPE html>
3
3
  <script
4
4
  src="${i}"
@@ -1 +1 @@
1
- import{t}from"./chunk-ELYPVDLC.js";import"./chunk-7HDHUOTF.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";async function u({auth:e,transcendUrl:r,actions:a,statuses:n,requestIds:s,createdAtBefore:o,createdAtAfter:i,concurrency:c}){await t({transcendUrl:r,requestActions:a,auth:e,requestIds:s,statuses:n,concurrency:c,createdAtBefore:o,createdAtAfter:i})}export{u as markSilent};
1
+ import{t}from"./chunk-QXOUJ7DT.js";import"./chunk-LE6MXFBT.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";async function u({auth:e,transcendUrl:r,actions:a,statuses:n,requestIds:s,createdAtBefore:o,createdAtAfter:i,concurrency:c}){await t({transcendUrl:r,requestActions:a,auth:e,requestIds:s,statuses:n,concurrency:c,createdAtBefore:o,createdAtAfter:i})}export{u as markSilent};
@@ -1 +1 @@
1
- import{d as o,e as r}from"./chunk-QQRMUEM7.js";import{c as m}from"./chunk-HNMFVG75.js";import{h as a}from"./chunk-4S2LOGFN.js";import"./chunk-T5XKXHEX.js";import"./chunk-ELYPVDLC.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import"./chunk-7HDHUOTF.js";import{a as t}from"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";import{join as u}from"path";import c from"colors";import{existsSync as g,lstatSync as l}from"fs";function b({consentManagerYmlFolder:s,output:n}){(!g(s)||!l(s).isDirectory())&&(t.error(c.red(`Folder does not exist: "${s}"`)),process.exit(1));let p=m(s).map(i=>{let{"consent-manager":f}=o(u(s,i));return{name:i,input:f}}),e=a(p);r(n,{"business-entities":e}),t.info(c.green(`Successfully wrote ${e.length} business entities to file "${n}"`))}export{b as consentManagersToBusinessEntities};
1
+ import{d as o,e as r}from"./chunk-QQRMUEM7.js";import{c as m}from"./chunk-QAPBYN24.js";import{h as a}from"./chunk-T4AGEIE3.js";import"./chunk-4HZHZ32O.js";import"./chunk-QXOUJ7DT.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import"./chunk-LE6MXFBT.js";import{a as t}from"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";import{join as u}from"path";import c from"colors";import{existsSync as g,lstatSync as l}from"fs";function b({consentManagerYmlFolder:s,output:n}){(!g(s)||!l(s).isDirectory())&&(t.error(c.red(`Folder does not exist: "${s}"`)),process.exit(1));let p=m(s).map(i=>{let{"consent-manager":f}=o(u(s,i));return{name:i,input:f}}),e=a(p);r(n,{"business-entities":e}),t.info(c.green(`Successfully wrote ${e.length} business entities to file "${n}"`))}export{b as consentManagersToBusinessEntities};
@@ -1 +1 @@
1
- import{a as t}from"./chunk-B45U2NAI.js";import"./chunk-RBOBI6B6.js";import"./chunk-ELYPVDLC.js";import"./chunk-7HDHUOTF.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";async function c({auth:n,transcendUrl:e,file:i,concurrency:r,actions:o,sombraAuth:s}){await t({file:i,transcendUrl:e,concurrency:r,requestActions:o,auth:n,sombraAuth:s})}export{c as pullIdentifiers};
1
+ import{a as t}from"./chunk-NYDK4VPA.js";import"./chunk-RBOBI6B6.js";import"./chunk-QXOUJ7DT.js";import"./chunk-LE6MXFBT.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";async function c({auth:n,transcendUrl:e,file:i,concurrency:r,actions:o,sombraAuth:s}){await t({file:i,transcendUrl:e,concurrency:r,requestActions:o,auth:n,sombraAuth:s})}export{c as pullIdentifiers};
@@ -1 +1 @@
1
- import"./chunk-NGVJ6L35.js";import{c as s}from"./chunk-RBOBI6B6.js";import{U as r}from"./chunk-ELYPVDLC.js";import"./chunk-7HDHUOTF.js";import{a as o}from"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";import y from"colors";import{uniq as q}from"lodash-es";async function v({auth:n,transcendUrl:a,file:e,pageLimit:i,actions:m,sombraAuth:c,statuses:u,createdAtBefore:p,createdAtAfter:f,showTests:l}){let{requestsFormattedForCsv:t}=await r({transcendUrl:a,pageLimit:i,actions:m,statuses:u,auth:n,sombraAuth:c,createdAtBefore:p,createdAtAfter:f,isTest:l}),g=q(t.map(d=>Object.keys(d)).flat());s(e,t,g),o.info(y.green(`Successfully wrote ${t.length} requests to file "${e}"`))}export{v as _export};
1
+ import"./chunk-5TDUSKDZ.js";import{c as s}from"./chunk-RBOBI6B6.js";import{U as r}from"./chunk-QXOUJ7DT.js";import"./chunk-LE6MXFBT.js";import{a as o}from"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";import y from"colors";import{uniq as q}from"lodash-es";async function v({auth:n,transcendUrl:a,file:e,pageLimit:i,actions:m,sombraAuth:c,statuses:u,createdAtBefore:p,createdAtAfter:f,showTests:l}){let{requestsFormattedForCsv:t}=await r({transcendUrl:a,pageLimit:i,actions:m,statuses:u,auth:n,sombraAuth:c,createdAtBefore:p,createdAtAfter:f,isTest:l}),g=q(t.map(d=>Object.keys(d)).flat());s(e,t,g),o.info(y.green(`Successfully wrote ${t.length} requests to file "${e}"`))}export{v as _export};
@@ -1 +1 @@
1
- import{I as e}from"./chunk-ELYPVDLC.js";import"./chunk-7HDHUOTF.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";async function m({auth:t,actions:r,origins:o,silentModeBefore:i,createdAtBefore:n,createdAtAfter:a,transcendUrl:s,concurrency:c}){await e({transcendUrl:s,requestActions:r,auth:t,requestOrigins:o,concurrency:c,silentModeBefore:i,createdAtBefore:n,createdAtAfter:a})}export{m as approve};
1
+ import{I as e}from"./chunk-QXOUJ7DT.js";import"./chunk-LE6MXFBT.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";async function m({auth:t,actions:r,origins:o,silentModeBefore:i,createdAtBefore:n,createdAtAfter:a,transcendUrl:s,concurrency:c}){await e({transcendUrl:s,requestActions:r,auth:t,requestOrigins:o,concurrency:c,silentModeBefore:i,createdAtBefore:n,createdAtAfter:a})}export{m as approve};
@@ -1 +1 @@
1
- import{b as d}from"./chunk-Z77MEZNJ.js";import"./chunk-NGVJ6L35.js";import{c as u}from"./chunk-RBOBI6B6.js";import"./chunk-ELYPVDLC.js";import{pe as c}from"./chunk-7HDHUOTF.js";import{a as e}from"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";import i from"colors";import{uniq as b}from"lodash-es";async function x({auth:l,file:s,transcendUrl:m,dataSiloIds:f,subCategories:p,status:g,includeEncryptedSnippets:a}){try{let o=c(m,l),C=await d(o,{dataSiloIds:f,subCategories:p,status:g,includeEncryptedSnippets:a});e.info(i.magenta(`Writing unstructured discovery files to file "${s}"...`));let r=[],S=C.map(t=>{let n={"Entry ID":t.id,"Data Silo ID":t.dataSiloId,"Object Path ID":t.scannedObjectPathId,"Object ID":t.scannedObjectId,...a?{Entry:t.name,"Context Snippet":t.contextSnippet}:{},"Data Category":`${t.dataSubCategory.category}:${t.dataSubCategory.name}`,"Classification Status":t.status,"Confidence Score":t.confidence,"Classification Method":t.classificationMethod,"Classifier Version":t.classifierVersion};return r=b([...r,...Object.keys(n)]),n});u(s,S,r)}catch(o){e.error(i.red(`An error occurred syncing the unstructured discovery files: ${o.message}`)),process.exit(1)}e.info(i.green(`Successfully synced unstructured discovery files to disk at ${s}!`))}export{x as pullUnstructuredDiscoveryFiles};
1
+ import{b as d}from"./chunk-PNOEWENG.js";import"./chunk-5TDUSKDZ.js";import{c as u}from"./chunk-RBOBI6B6.js";import"./chunk-QXOUJ7DT.js";import{pe as c}from"./chunk-LE6MXFBT.js";import{a as e}from"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";import i from"colors";import{uniq as b}from"lodash-es";async function x({auth:l,file:s,transcendUrl:m,dataSiloIds:f,subCategories:p,status:g,includeEncryptedSnippets:a}){try{let o=c(m,l),C=await d(o,{dataSiloIds:f,subCategories:p,status:g,includeEncryptedSnippets:a});e.info(i.magenta(`Writing unstructured discovery files to file "${s}"...`));let r=[],S=C.map(t=>{let n={"Entry ID":t.id,"Data Silo ID":t.dataSiloId,"Object Path ID":t.scannedObjectPathId,"Object ID":t.scannedObjectId,...a?{Entry:t.name,"Context Snippet":t.contextSnippet}:{},"Data Category":`${t.dataSubCategory.category}:${t.dataSubCategory.name}`,"Classification Status":t.status,"Confidence Score":t.confidence,"Classification Method":t.classificationMethod,"Classifier Version":t.classifierVersion};return r=b([...r,...Object.keys(n)]),n});u(s,S,r)}catch(o){e.error(i.red(`An error occurred syncing the unstructured discovery files: ${o.message}`)),process.exit(1)}e.info(i.green(`Successfully synced unstructured discovery files to disk at ${s}!`))}export{x as pullUnstructuredDiscoveryFiles};
@@ -1,3 +1,3 @@
1
- import{a as D}from"./chunk-FI3PMXDN.js";import"./chunk-HNMFVG75.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import{Od as u,le as S,pe as y}from"./chunk-7HDHUOTF.js";import{a as r}from"./chunk-OERYFLN2.js";import{b as h}from"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";import{stringify as C}from"query-string";import w from"colors";import v from"fast-glob";async function m({scanPath:t,fileGlobs:e,ignoreDirs:g,config:p}){let{ignoreDirs:f,supportedFiles:s,scanFunction:a}=p,n=e===""?s:s.concat(e.split(",")),l=[...g.split(","),...f].filter(o=>o.length>0);try{let o=await v(`${t}/**/${n.join("|")}`,{ignore:l.map(i=>`${t}/**/${i}`),unique:!0,onlyFiles:!0});r.info(`Scanning: ${o.length} files`);let $=o.map(i=>a(i)).flat().map(i=>i.softwareDevelopmentKits||[]).flat(),d=[...new Set($.map(i=>i.name))];return r.info(`Found: ${d.length} unique dependencies`),d.map(i=>({name:i,resourceId:`${t}/**/${i}`,useStrictClassifier:!0}))}catch(o){throw new Error(`Error scanning globs ${m} with error: ${o}`)}}async function k({scanPath:t,dataSiloId:e,auth:g,fileGlobs:p,ignoreDirs:f,transcendUrl:s}){let a=y(s,g),n=await u(a,e),l=D[n.dataSilo.type];l||(r.error(w.red(`This plugin "${n.dataSilo.type}" is not supported for offline silo discovery.`)),process.exit(1));let o=await m({scanPath:t,fileGlobs:p,ignoreDirs:f,config:l});await S(a,n.id,o);let c=new URL(h);c.pathname="/data-map/data-inventory/silo-discovery/triage",c.search=C({filters:JSON.stringify({pluginIds:[n.id]})}),r.info(w.green(`Scan found ${o.length} potential data silos at ${t}! View at '${c.href}'
1
+ import{a as D}from"./chunk-AYMLP7SL.js";import"./chunk-QAPBYN24.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import{Od as u,le as S,pe as y}from"./chunk-LE6MXFBT.js";import{a as r}from"./chunk-OERYFLN2.js";import{b as h}from"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";import{stringify as C}from"query-string";import w from"colors";import v from"fast-glob";async function m({scanPath:t,fileGlobs:e,ignoreDirs:g,config:p}){let{ignoreDirs:f,supportedFiles:s,scanFunction:a}=p,n=e===""?s:s.concat(e.split(",")),l=[...g.split(","),...f].filter(o=>o.length>0);try{let o=await v(`${t}/**/${n.join("|")}`,{ignore:l.map(i=>`${t}/**/${i}`),unique:!0,onlyFiles:!0});r.info(`Scanning: ${o.length} files`);let $=o.map(i=>a(i)).flat().map(i=>i.softwareDevelopmentKits||[]).flat(),d=[...new Set($.map(i=>i.name))];return r.info(`Found: ${d.length} unique dependencies`),d.map(i=>({name:i,resourceId:`${t}/**/${i}`,useStrictClassifier:!0}))}catch(o){throw new Error(`Error scanning globs ${m} with error: ${o}`)}}async function k({scanPath:t,dataSiloId:e,auth:g,fileGlobs:p,ignoreDirs:f,transcendUrl:s}){let a=y(s,g),n=await u(a,e),l=D[n.dataSilo.type];l||(r.error(w.red(`This plugin "${n.dataSilo.type}" is not supported for offline silo discovery.`)),process.exit(1));let o=await m({scanPath:t,fileGlobs:p,ignoreDirs:f,config:l});await S(a,n.id,o);let c=new URL(h);c.pathname="/data-map/data-inventory/silo-discovery/triage",c.search=C({filters:JSON.stringify({pluginIds:[n.id]})}),r.info(w.green(`Scan found ${o.length} potential data silos at ${t}! View at '${c.href}'
2
2
 
3
3
  NOTE: it may take 2-3 minutes for scan results to appear in the UI.`))}export{k as discoverSilos};
@@ -1,4 +1,4 @@
1
- import{a as S}from"./chunk-AHYJJKNA.js";import{a as A}from"./chunk-T2PLXAEM.js";import{d as b}from"./chunk-QQRMUEM7.js";import{b as v,c as C}from"./chunk-HNMFVG75.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import{Nd as x,a as w,pe as T}from"./chunk-7HDHUOTF.js";import{a as n}from"./chunk-OERYFLN2.js";import{c as d}from"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";import{existsSync as z,lstatSync as F}from"fs";import{join as L}from"path";import o from"colors";async function I({transcendUrl:i,auth:c,pageSize:h,publishToPrivacyCenter:y,contents:l,deleteExtraAttributeValues:m=!1,classifyService:f=!1}){let u=T(i,c);try{return!await x(l,u,{pageSize:h,publishToPrivacyCenter:y,classifyService:f,deleteExtraAttributeValues:m})}catch(t){return n.error(o.red(`An unexpected error occurred syncing the schema: ${t.message}`)),!1}}async function H({file:i="./transcend.yml",transcendUrl:c,auth:h,variables:y,pageSize:l,publishToPrivacyCenter:m,classifyService:f,deleteExtraAttributeValues:u}){let t=await v(h),N=A(y),p;if(Array.isArray(t)&&F(i).isDirectory()?p=C(i).map(e=>L(i,e)):p=i.split(","),p.length<1)throw new Error("No file specified!");let s=p.map(e=>{z(e)?n.info(o.magenta(`Reading file "${e}"...`)):(n.error(o.red(`The file path does not exist on disk: ${e}. You can specify the filepath using --file=./examples/transcend.yml`)),process.exit(1));try{let r=b(e,N);return n.info(o.green(`Successfully read in "${e}"`)),{content:r,name:e.split("/").pop().replace(".yml","")}}catch(r){n.error(o.red(`The shape of your yaml file is invalid with the following errors: ${r.message}`)),process.exit(1)}});if(typeof t=="string"){let[e,...r]=s.map(({content:g})=>g),$=S(e,...r);await I({transcendUrl:c,auth:t,contents:$,publishToPrivacyCenter:m,deleteExtraAttributeValues:u,pageSize:l,classifyService:!!f})||(n.info(o.red(`Sync encountered errors. View output above for more information, or check out ${d}`)),process.exit(1))}else{if(s.length!==1&&s.length!==t.length)throw new Error(`Expected list of yml files to be equal to the list of API keys.Got ${s.length} YML file${s.length===1?"":"s"} and ${t.length} API key${t.length===1?"":"s"}`);let e=[];await w(t,async(r,$)=>{let a=`[${$+1}/${t.length}][${r.organizationName}] `;n.info(o.magenta(`~~~
1
+ import{a as S}from"./chunk-AHYJJKNA.js";import{a as A}from"./chunk-T2PLXAEM.js";import{d as b}from"./chunk-QQRMUEM7.js";import{b as v,c as C}from"./chunk-QAPBYN24.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import{Nd as x,a as w,pe as T}from"./chunk-LE6MXFBT.js";import{a as n}from"./chunk-OERYFLN2.js";import{c as d}from"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";import{existsSync as z,lstatSync as F}from"fs";import{join as L}from"path";import o from"colors";async function I({transcendUrl:i,auth:c,pageSize:h,publishToPrivacyCenter:y,contents:l,deleteExtraAttributeValues:m=!1,classifyService:f=!1}){let u=T(i,c);try{return!await x(l,u,{pageSize:h,publishToPrivacyCenter:y,classifyService:f,deleteExtraAttributeValues:m})}catch(t){return n.error(o.red(`An unexpected error occurred syncing the schema: ${t.message}`)),!1}}async function H({file:i="./transcend.yml",transcendUrl:c,auth:h,variables:y,pageSize:l,publishToPrivacyCenter:m,classifyService:f,deleteExtraAttributeValues:u}){let t=await v(h),N=A(y),p;if(Array.isArray(t)&&F(i).isDirectory()?p=C(i).map(e=>L(i,e)):p=i.split(","),p.length<1)throw new Error("No file specified!");let s=p.map(e=>{z(e)?n.info(o.magenta(`Reading file "${e}"...`)):(n.error(o.red(`The file path does not exist on disk: ${e}. You can specify the filepath using --file=./examples/transcend.yml`)),process.exit(1));try{let r=b(e,N);return n.info(o.green(`Successfully read in "${e}"`)),{content:r,name:e.split("/").pop().replace(".yml","")}}catch(r){n.error(o.red(`The shape of your yaml file is invalid with the following errors: ${r.message}`)),process.exit(1)}});if(typeof t=="string"){let[e,...r]=s.map(({content:g})=>g),$=S(e,...r);await I({transcendUrl:c,auth:t,contents:$,publishToPrivacyCenter:m,deleteExtraAttributeValues:u,pageSize:l,classifyService:!!f})||(n.info(o.red(`Sync encountered errors. View output above for more information, or check out ${d}`)),process.exit(1))}else{if(s.length!==1&&s.length!==t.length)throw new Error(`Expected list of yml files to be equal to the list of API keys.Got ${s.length} YML file${s.length===1?"":"s"} and ${t.length} API key${t.length===1?"":"s"}`);let e=[];await w(t,async(r,$)=>{let a=`[${$+1}/${t.length}][${r.organizationName}] `;n.info(o.magenta(`~~~
2
2
 
3
3
  ${a}Attempting to push configuration...
4
4
 
@@ -1 +1 @@
1
- import{d as n}from"./chunk-B45U2NAI.js";import"./chunk-RBOBI6B6.js";import"./chunk-ELYPVDLC.js";import"./chunk-7HDHUOTF.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";async function c({auth:t,transcendUrl:r,file:e,enricherId:i,concurrency:s,markSilent:o,sombraAuth:a}){await n({file:e,transcendUrl:r,enricherId:i,concurrency:s,markSilent:o,auth:t,sombraAuth:a})}export{c as pushIdentifiers};
1
+ import{d as n}from"./chunk-NYDK4VPA.js";import"./chunk-RBOBI6B6.js";import"./chunk-QXOUJ7DT.js";import"./chunk-LE6MXFBT.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";async function c({auth:t,transcendUrl:r,file:e,enricherId:i,concurrency:s,markSilent:o,sombraAuth:a}){await n({file:e,transcendUrl:r,enricherId:i,concurrency:s,markSilent:o,auth:t,sombraAuth:a})}export{c as pushIdentifiers};
@@ -1 +1 @@
1
- import{J as t}from"./chunk-ELYPVDLC.js";import"./chunk-7HDHUOTF.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";async function f({auth:e,transcendUrl:i,createdAtBefore:n,createdAtAfter:o,actions:r,daysLeft:a,days:s,requestIds:m,emailTemplate:c,concurrency:d}){await t({transcendUrl:i,requestActions:r,auth:e,emailTemplate:c,days:s,daysLeft:a,requestIds:m,concurrency:d,createdAtBefore:n,createdAtAfter:o})}export{f as notifyAdditionalTime};
1
+ import{J as t}from"./chunk-QXOUJ7DT.js";import"./chunk-LE6MXFBT.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";async function f({auth:e,transcendUrl:i,createdAtBefore:n,createdAtAfter:o,actions:r,daysLeft:a,days:s,requestIds:m,emailTemplate:c,concurrency:d}){await t({transcendUrl:i,requestActions:r,auth:e,emailTemplate:c,days:s,daysLeft:a,requestIds:m,concurrency:d,createdAtBefore:n,createdAtAfter:o})}export{f as notifyAdditionalTime};
@@ -0,0 +1 @@
1
+ import{b as a}from"./chunk-T4AGEIE3.js";import"./chunk-4HZHZ32O.js";import"./chunk-QXOUJ7DT.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import"./chunk-LE6MXFBT.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";async function n({auth:o,trackerStatus:t,file:r,classifyService:s,transcendUrl:e}){await a({auth:o,trackerStatus:t,file:r,classifyService:s,transcendUrl:e})}export{n as uploadDataFlowsFromCsv};
@@ -1 +1 @@
1
- import{b as r}from"./chunk-HNMFVG75.js";import{g as t}from"./chunk-4S2LOGFN.js";import"./chunk-T5XKXHEX.js";import"./chunk-ELYPVDLC.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import"./chunk-7HDHUOTF.js";import{a as n}from"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";import e from"colors";import{writeFileSync as g}from"fs";async function C({auth:d,xdiLocation:s,file:i,removeIpAddresses:c,domainBlockList:o,xdiAllowedCommands:l,transcendUrl:a}){let m=await r(d),{syncGroups:p,html:f}=await t(m,{xdiLocation:s,transcendUrl:a,removeIpAddresses:c,domainBlockList:o.length>0?o:void 0,xdiAllowedCommands:l});n.info(e.green(`Successfully constructed sync endpoint for sync groups: ${JSON.stringify(p,null,2)}`)),g(i,f),n.info(e.green(`Wrote configuration to file "${i}"!`))}export{C as buildXdiSyncEndpoint};
1
+ import{b as r}from"./chunk-QAPBYN24.js";import{g as t}from"./chunk-T4AGEIE3.js";import"./chunk-4HZHZ32O.js";import"./chunk-QXOUJ7DT.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import"./chunk-LE6MXFBT.js";import{a as n}from"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";import e from"colors";import{writeFileSync as g}from"fs";async function C({auth:d,xdiLocation:s,file:i,removeIpAddresses:c,domainBlockList:o,xdiAllowedCommands:l,transcendUrl:a}){let m=await r(d),{syncGroups:p,html:f}=await t(m,{xdiLocation:s,transcendUrl:a,removeIpAddresses:c,domainBlockList:o.length>0?o:void 0,xdiAllowedCommands:l});n.info(e.green(`Successfully constructed sync endpoint for sync groups: ${JSON.stringify(p,null,2)}`)),g(i,f),n.info(e.green(`Wrote configuration to file "${i}"!`))}export{C as buildXdiSyncEndpoint};
@@ -1,4 +1,4 @@
1
- import{a as Q}from"./chunk-CZFGCIEO.js";import"./chunk-T2PLXAEM.js";import{n as F,p as X,q as Z}from"./chunk-ELYPVDLC.js";import"./chunk-W6GUOMVP.js";import{Qc as H,_d as ee,a as A,b as V,pe as te,qe as re}from"./chunk-7HDHUOTF.js";import{a as l}from"./chunk-OERYFLN2.js";import{f as oe}from"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";import v from"colors";import k from"colors";import{chunk as Qe}from"lodash-es";import ye from"cli-progress";import{PersistedState as Ge}from"@transcend-io/persisted-state";import{keyBy as De}from"lodash-es";import*as x from"io-ts";import de from"colors";import{PreferenceQueryResponseItem as Ue}from"@transcend-io/privacy-types";import ne from"colors";import se from"cli-progress";import{chunk as ke}from"lodash-es";import{decodeCodec as Re}from"@transcend-io/type-utils";import*as T from"io-ts";var Me=T.intersection([T.type({nodes:T.array(Ue)}),T.partial({cursor:T.string})]),Ve=["ENOTFOUND","ETIMEDOUT","504 Gateway Time-out","Task timed out after"];async function ie(m,{identifiers:n,partitionKey:h,skipLogging:d=!1}){let s=[],u=ke(n,100),i=new Date().getTime(),t=new se.SingleBar({},se.Presets.shades_classic);d||t.start(n.length,0);let c=0;await V(u,async e=>{let a=0,g=3;for(;a<g;)try{let p=await m.post(`v1/preferences/${h}/query`,{json:{filter:{identifiers:e},limit:e.length}}).json(),w=Re(Me,p);s.push(...w.nodes),c+=e.length,t.update(c);break}catch(p){a+=1;let w=p?.response?.body||p?.message||"";if(a>=g||!Ve.some(P=>w.includes(P)))throw new Error(`Received an error from server after ${a} attempts: ${w}`);l.warn(ne.yellow(`[RETRYING FAILED REQUEST - Attempt ${a}] Failed to fetch ${e.length} user preferences from partition ${h}: ${w}`))}},{concurrency:40}),t.stop();let r=new Date().getTime()-i;return d||l.info(ne.green(`Completed download in "${r/1e3}" seconds.`)),s}import{PreferenceTopicType as G}from"@transcend-io/privacy-types";import{apply as Fe}from"@transcend-io/type-utils";function D({row:m,columnToPurposeName:n,purposeSlugs:h,preferenceTopics:d}){let s={};return Object.entries(n).forEach(([u,{purpose:i,preference:t,valueMapping:c}])=>{if(!h.includes(i))throw new Error(`Invalid purpose slug: ${i}, expected: ${h.join(", ")}`);if(t){let f=d.find(g=>g.slug===t&&g.purpose.trackingType===i);if(!f){let g=d.filter(p=>p.purpose.trackingType===i).map(p=>p.slug);throw new Error(`Invalid preference slug: ${t} for purpose: ${i}. Allowed preference slugs for purpose are: ${g.join(",")}`)}s[i]||(s[i]={preferences:[]}),s[i].preferences||(s[i].preferences=[]);let r=m[u],e=c[r],a=typeof e=="string"&&e.trim()||null;switch(f.type){case G.Boolean:if(typeof e!="boolean")throw new Error(`Invalid value for boolean preference: ${t}, expected boolean, got: ${r}`);s[i].preferences.push({topic:t,choice:{booleanValue:e}});break;case G.Select:if(typeof e!="string"&&e!==null)throw new Error(`Invalid value for select preference: ${t}, expected string or null, got: ${r}`);if(a&&!f.preferenceOptionValues.map(({slug:g})=>g).includes(a))throw new Error(`Invalid value for select preference: ${t}, expected one of: ${f.preferenceOptionValues.map(({slug:g})=>g).join(", ")}, got: ${r}`);s[i].preferences.push({topic:t,choice:{selectValue:a}});break;case G.MultiSelect:if(typeof r!="string")throw new Error(`Invalid value for multi select preference: ${t}, expected string, got: ${r}`);s[i].preferences.push({topic:t,choice:{selectValues:F(r).map(g=>{let p=c[g];if(typeof p!="string")throw new Error(`Invalid value for multi select preference: ${t}, expected one of: ${f.preferenceOptionValues.map(({slug:w})=>w).join(", ")}, got: ${g}`);return p}).sort((g,p)=>g.localeCompare(p))}});break;default:throw new Error(`Unknown preference type: ${f.type}`)}}else s[i]?s[i].enabled=c[m[u]]===!0:s[i]={enabled:c[m[u]]===!0}}),Fe(s,(u,i)=>{if(typeof u.enabled!="boolean")throw new Error(`No mapping provided for purpose.enabled=true/false value: ${i}`);return{...u,enabled:u.enabled}})}import{uniq as Se,difference as Ee}from"lodash-es";import ae from"colors";import Ie from"inquirer";var q="[NONE]";async function pe(m,n){let h=Se(m.map(s=>Object.keys(s)).flat()),d=Ee(h,[...n.identifierColumn?[n.identifierColumn]:[],...Object.keys(n.columnToPurposeName)]);if(!n.timestampColum){let{timestampName:s}=await Ie.prompt([{name:"timestampName",message:"Choose the column that will be used as the timestamp of last preference update",type:"list",default:d.find(u=>u.toLowerCase().includes("date"))||d.find(u=>u.toLowerCase().includes("time"))||d[0],choices:[...d,q]}]);n.timestampColum=s}if(l.info(ae.magenta(`Using timestamp column "${n.timestampColum}"`)),n.timestampColum!==q){let s=m.map((u,i)=>u[n.timestampColum]?null:[i]).filter(u=>!!u).flat();if(s.length>0)throw new Error(`The timestamp column "${n.timestampColum}" is missing a value for the following rows: ${s.join(`
1
+ import{a as Q}from"./chunk-F5KKB33H.js";import"./chunk-T2PLXAEM.js";import{n as F,p as X,q as Z}from"./chunk-QXOUJ7DT.js";import"./chunk-W6GUOMVP.js";import{Qc as H,_d as ee,a as A,b as V,pe as te,qe as re}from"./chunk-LE6MXFBT.js";import{a as l}from"./chunk-OERYFLN2.js";import{f as oe}from"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";import v from"colors";import k from"colors";import{chunk as Qe}from"lodash-es";import ye from"cli-progress";import{PersistedState as Ge}from"@transcend-io/persisted-state";import{keyBy as De}from"lodash-es";import*as x from"io-ts";import de from"colors";import{PreferenceQueryResponseItem as Ue}from"@transcend-io/privacy-types";import ne from"colors";import se from"cli-progress";import{chunk as ke}from"lodash-es";import{decodeCodec as Re}from"@transcend-io/type-utils";import*as T from"io-ts";var Me=T.intersection([T.type({nodes:T.array(Ue)}),T.partial({cursor:T.string})]),Ve=["ENOTFOUND","ETIMEDOUT","504 Gateway Time-out","Task timed out after"];async function ie(m,{identifiers:n,partitionKey:h,skipLogging:d=!1}){let s=[],u=ke(n,100),i=new Date().getTime(),t=new se.SingleBar({},se.Presets.shades_classic);d||t.start(n.length,0);let c=0;await V(u,async e=>{let a=0,g=3;for(;a<g;)try{let p=await m.post(`v1/preferences/${h}/query`,{json:{filter:{identifiers:e},limit:e.length}}).json(),w=Re(Me,p);s.push(...w.nodes),c+=e.length,t.update(c);break}catch(p){a+=1;let w=p?.response?.body||p?.message||"";if(a>=g||!Ve.some(P=>w.includes(P)))throw new Error(`Received an error from server after ${a} attempts: ${w}`);l.warn(ne.yellow(`[RETRYING FAILED REQUEST - Attempt ${a}] Failed to fetch ${e.length} user preferences from partition ${h}: ${w}`))}},{concurrency:40}),t.stop();let r=new Date().getTime()-i;return d||l.info(ne.green(`Completed download in "${r/1e3}" seconds.`)),s}import{PreferenceTopicType as G}from"@transcend-io/privacy-types";import{apply as Fe}from"@transcend-io/type-utils";function D({row:m,columnToPurposeName:n,purposeSlugs:h,preferenceTopics:d}){let s={};return Object.entries(n).forEach(([u,{purpose:i,preference:t,valueMapping:c}])=>{if(!h.includes(i))throw new Error(`Invalid purpose slug: ${i}, expected: ${h.join(", ")}`);if(t){let f=d.find(g=>g.slug===t&&g.purpose.trackingType===i);if(!f){let g=d.filter(p=>p.purpose.trackingType===i).map(p=>p.slug);throw new Error(`Invalid preference slug: ${t} for purpose: ${i}. Allowed preference slugs for purpose are: ${g.join(",")}`)}s[i]||(s[i]={preferences:[]}),s[i].preferences||(s[i].preferences=[]);let r=m[u],e=c[r],a=typeof e=="string"&&e.trim()||null;switch(f.type){case G.Boolean:if(typeof e!="boolean")throw new Error(`Invalid value for boolean preference: ${t}, expected boolean, got: ${r}`);s[i].preferences.push({topic:t,choice:{booleanValue:e}});break;case G.Select:if(typeof e!="string"&&e!==null)throw new Error(`Invalid value for select preference: ${t}, expected string or null, got: ${r}`);if(a&&!f.preferenceOptionValues.map(({slug:g})=>g).includes(a))throw new Error(`Invalid value for select preference: ${t}, expected one of: ${f.preferenceOptionValues.map(({slug:g})=>g).join(", ")}, got: ${r}`);s[i].preferences.push({topic:t,choice:{selectValue:a}});break;case G.MultiSelect:if(typeof r!="string")throw new Error(`Invalid value for multi select preference: ${t}, expected string, got: ${r}`);s[i].preferences.push({topic:t,choice:{selectValues:F(r).map(g=>{let p=c[g];if(typeof p!="string")throw new Error(`Invalid value for multi select preference: ${t}, expected one of: ${f.preferenceOptionValues.map(({slug:w})=>w).join(", ")}, got: ${g}`);return p}).sort((g,p)=>g.localeCompare(p))}});break;default:throw new Error(`Unknown preference type: ${f.type}`)}}else s[i]?s[i].enabled=c[m[u]]===!0:s[i]={enabled:c[m[u]]===!0}}),Fe(s,(u,i)=>{if(typeof u.enabled!="boolean")throw new Error(`No mapping provided for purpose.enabled=true/false value: ${i}`);return{...u,enabled:u.enabled}})}import{uniq as Se,difference as Ee}from"lodash-es";import ae from"colors";import Ie from"inquirer";var q="[NONE]";async function pe(m,n){let h=Se(m.map(s=>Object.keys(s)).flat()),d=Ee(h,[...n.identifierColumn?[n.identifierColumn]:[],...Object.keys(n.columnToPurposeName)]);if(!n.timestampColum){let{timestampName:s}=await Ie.prompt([{name:"timestampName",message:"Choose the column that will be used as the timestamp of last preference update",type:"list",default:d.find(u=>u.toLowerCase().includes("date"))||d.find(u=>u.toLowerCase().includes("time"))||d[0],choices:[...d,q]}]);n.timestampColum=s}if(l.info(ae.magenta(`Using timestamp column "${n.timestampColum}"`)),n.timestampColum!==q){let s=m.map((u,i)=>u[n.timestampColum]?null:[i]).filter(u=>!!u).flat();if(s.length>0)throw new Error(`The timestamp column "${n.timestampColum}" is missing a value for the following rows: ${s.join(`
2
2
  `)}`);l.info(ae.magenta(`The timestamp column "${n.timestampColum}" is present for all row`))}return n}import{uniq as Ne,groupBy as Oe,difference as xe}from"lodash-es";import N from"colors";import je from"inquirer";async function le(m,n){let h=Ne(m.map(t=>Object.keys(t)).flat()),d=xe(h,[...n.identifierColumn?[n.identifierColumn]:[],...Object.keys(n.columnToPurposeName)]);if(!n.identifierColumn){let{identifierName:t}=await je.prompt([{name:"identifierName",message:"Choose the column that will be used as the identifier to upload consent preferences by",type:"list",default:d.find(c=>c.toLowerCase().includes("email"))||d[0],choices:d}]);n.identifierColumn=t}l.info(N.magenta(`Using identifier column "${n.identifierColumn}"`));let s=m.map((t,c)=>t[n.identifierColumn]?null:[c]).filter(t=>!!t).flat();if(s.length>0){let t=`The identifier column "${n.identifierColumn}" is missing a value for the following rows: ${s.join(", ")}`;if(l.warn(N.yellow(t)),!await Q({message:"Would you like to skip rows missing an identifier?"}))throw new Error(t);let f=m.length;m=m.filter(r=>r[n.identifierColumn]),l.info(N.yellow(`Skipped ${f-m.length} rows missing an identifier`))}l.info(N.magenta(`The identifier column "${n.identifierColumn}" is present for all rows`));let u=Oe(m,n.identifierColumn),i=Object.entries(u).filter(([,t])=>t.length>1);if(i.length>0){let t=`The identifier column "${n.identifierColumn}" has duplicate values for the following rows: ${i.slice(0,10).map(([f,r])=>`${f} (${r.length})`).join(`
3
3
  `)}`;if(l.warn(N.yellow(t)),!await Q({message:"Would you like to automatically take the latest update?"}))throw new Error(t);m=Object.entries(u).map(([,f])=>f.sort((e,a)=>new Date(a[n.timestampColum]).getTime()-new Date(e[n.timestampColum]).getTime())[0]).filter(f=>f)}return{currentState:n,preferences:m}}import{uniq as ce,difference as Ae}from"lodash-es";import W from"colors";import O from"inquirer";import{PreferenceTopicType as _}from"@transcend-io/privacy-types";async function fe(m,n,{purposeSlugs:h,preferenceTopics:d,forceTriggerWorkflows:s}){let u=ce(m.map(c=>Object.keys(c)).flat()),i=Ae(u,[...n.identifierColumn?[n.identifierColumn]:[],...n.timestampColum?[n.timestampColum]:[]]);if(i.length===0){if(s)return n;throw new Error("No other columns to process")}let t=[...h,...d.map(c=>`${c.purpose.trackingType}->${c.slug}`)];return await A(i,async c=>{let f=ce(m.map(e=>e[c])),r=n.columnToPurposeName[c];if(r)l.info(W.magenta(`Column "${c}" is associated with purpose "${r.purpose}"`));else{let{purposeName:e}=await O.prompt([{name:"purposeName",message:`Choose the purpose that column ${c} is associated with`,type:"list",default:t.find(p=>p.startsWith(h[0])),choices:t}]),[a,g]=e.split("->");r={purpose:a,preference:g||null,valueMapping:{}}}await A(f,async e=>{if(r.valueMapping[e]!==void 0){l.info(W.magenta(`Value "${e}" is associated with purpose value "${r.valueMapping[e]}"`));return}if(r.preference===null){let{purposeValue:a}=await O.prompt([{name:"purposeValue",message:`Choose the purpose value for value "${e}" associated with purpose "${r.purpose}"`,type:"confirm",default:e!=="false"}]);r.valueMapping[e]=a}if(r.preference!==null){let a=d.find(p=>p.slug===r.preference);if(!a){l.error(W.red(`Preference topic "${r.preference}" not found`));return}let g=a.preferenceOptionValues.map(({slug:p})=>p);if(a.type===_.Boolean){let{preferenceValue:p}=await O.prompt([{name:"preferenceValue",message:`Choose the preference value for "${a.slug}" value "${e}" associated with purpose "${r.purpose}"`,type:"confirm",default:e!=="false"}]);r.valueMapping[e]=p;return}if(a.type===_.Select){let{preferenceValue:p}=await O.prompt([{name:"preferenceValue",message:`Choose the preference value for "${a.slug}" value "${e}" associated with purpose "${r.purpose}"`,type:"list",choices:g,default:g.find(w=>w===e)}]);r.valueMapping[e]=p;return}if(a.type===_.MultiSelect){let p=F(e);await A(p,async w=>{if(r.valueMapping[w]!==void 0)return;let{preferenceValue:P}=await O.prompt([{name:"preferenceValue",message:`Choose the preference value for "${a.slug}" value "${w}" associated with purpose "${r.purpose}"`,type:"list",choices:g,default:g.find(y=>y===w)}]);r.valueMapping[w]=P});return}throw new Error(`Unknown preference topic type: ${a.type}`)}}),n.columnToPurposeName[c]=r}),n}import{PreferenceTopicType as K}from"@transcend-io/privacy-types";function me({currentConsentRecord:m,pendingUpdates:n,preferenceTopics:h}){return Object.entries(n).every(([d,{preferences:s=[],enabled:u}])=>{let i=m.purposes.find(c=>c.purpose===d);return!!i&&i.enabled===u?s.every(({topic:c,choice:f})=>i.preferences&&i.preferences.find(r=>{if(r.topic!==c)return!1;let e=h.find(a=>a.slug===c&&a.purpose.trackingType===d);if(!e)throw new Error(`Could not find preference topic for ${c}`);switch(e.type){case K.Boolean:return r.choice.booleanValue===f.booleanValue;case K.Select:return r.choice.selectValue===f.selectValue;case K.MultiSelect:let a=(r.choice.selectValues||[]).sort(),g=(f.selectValues||[]).sort();return a.length===g.length&&a.every((p,w)=>p===g[w]);default:throw new Error(`Unknown preference topic type: ${e.type}`)}})):!1})}import{PreferenceTopicType as Y}from"@transcend-io/privacy-types";function ue({currentConsentRecord:m,pendingUpdates:n,preferenceTopics:h}){return!!Object.entries(n).find(([d,{preferences:s=[],enabled:u}])=>{let i=m.purposes.find(t=>t.purpose===d);return i?i.enabled!==u?!0:!!s.find(({topic:t,choice:c})=>{let f=(i.preferences||[]).find(e=>e.topic===t);if(!f)return!1;let r=h.find(e=>e.slug===t&&e.purpose.trackingType===d);if(!r)throw new Error(`Could not find preference topic for ${t}`);switch(r.type){case Y.Boolean:return f.choice.booleanValue!==c.booleanValue;case Y.Select:return f.choice.selectValue!==c.selectValue;case Y.MultiSelect:let e=(f.choice.selectValues||[]).sort(),a=(c.selectValues||[]).sort();return e.length!==a.length||!e.every((g,p)=>g===a[p]);default:throw new Error(`Unknown preference topic type: ${r.type}`)}}):!1})}async function ge({file:m,sombra:n,purposeSlugs:h,preferenceTopics:d,partitionKey:s,skipExistingRecordCheck:u,forceTriggerWorkflows:i},t){let c=new Date().getTime(),f=t.getValue("fileMetadata");l.info(de.magenta(`Reading in file: "${m}"`));let r=Z(m,x.record(x.string,x.string)),e={columnToPurposeName:{},pendingSafeUpdates:{},pendingConflictUpdates:{},skippedUpdates:{},...f[m]||{},lastFetchedAt:new Date().toISOString()};e=await pe(r,e),f[m]=e,await t.setValue(f,"fileMetadata");let a=await le(r,e);e=a.currentState,r=a.preferences,f[m]=e,await t.setValue(f,"fileMetadata"),e=await fe(r,e,{preferenceTopics:d,purposeSlugs:h,forceTriggerWorkflows:i}),f[m]=e,await t.setValue(f,"fileMetadata");let g=r.map(y=>y[e.identifierColumn]),p=u?[]:await ie(n,{identifiers:g.map(y=>({value:y})),partitionKey:s}),w=De(p,"userId");e.pendingConflictUpdates={},e.pendingSafeUpdates={},e.skippedUpdates={},r.forEach(y=>{let C=y[e.identifierColumn],S=D({row:y,columnToPurposeName:e.columnToPurposeName,preferenceTopics:d,purposeSlugs:h}),U=w[C];if(i&&!U)throw new Error(`No existing consent record found for user with id: ${C}.
4
4
  When 'forceTriggerWorkflows' is set all the user identifiers should contain a consent record`);if(U&&me({currentConsentRecord:U,pendingUpdates:S,preferenceTopics:d})&&!i){e.skippedUpdates[C]=y;return}if(U&&ue({currentConsentRecord:U,pendingUpdates:S,preferenceTopics:d})){e.pendingConflictUpdates[C]={row:y,record:U};return}e.pendingSafeUpdates[C]=y}),f[m]=e,await t.setValue(f,"fileMetadata");let P=new Date().getTime();l.info(de.green(`Successfully pre-processed file: "${m}" in ${(P-c)/1e3}s`))}import{PreferenceQueryResponseItem as qe,PreferenceUpdateItem as we}from"@transcend-io/privacy-types";import*as o from"io-ts";var Be=o.type({purpose:o.string,preference:o.union([o.string,o.null]),valueMapping:o.record(o.string,o.union([o.string,o.boolean,o.null]))}),Le=o.intersection([o.type({columnToPurposeName:o.record(o.string,Be),lastFetchedAt:o.string,pendingSafeUpdates:o.record(o.string,o.record(o.string,o.string)),pendingConflictUpdates:o.record(o.string,o.type({record:qe,row:o.record(o.string,o.string)})),skippedUpdates:o.record(o.string,o.record(o.string,o.string))}),o.partial({identifierColumn:o.string,timestampColum:o.string})]),he=o.type({fileMetadata:o.record(o.string,Le),failingUpdates:o.record(o.string,o.type({uploadedAt:o.string,error:o.string,update:we})),pendingUpdates:o.record(o.string,we)});import{apply as We}from"@transcend-io/type-utils";async function Pe({auth:m,sombraAuth:n,receiptFilepath:h,file:d,partition:s,isSilent:u=!0,dryRun:i=!1,skipWorkflowTriggers:t=!1,skipConflictUpdates:c=!1,skipExistingRecordCheck:f=!1,attributes:r=[],transcendUrl:e=oe,forceTriggerWorkflows:a=!1}){let g=X(r),p=new Ge(h,he,{fileMetadata:{},failingUpdates:{},pendingUpdates:{}}),w=p.getValue("failingUpdates"),P=p.getValue("pendingUpdates"),y=p.getValue("fileMetadata");l.info(k.magenta(`Restored cache, there are:
@@ -1 +1 @@
1
- import"./chunk-NGVJ6L35.js";import{c as i}from"./chunk-RBOBI6B6.js";import{j as s}from"./chunk-4S2LOGFN.js";import"./chunk-T5XKXHEX.js";import"./chunk-ELYPVDLC.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import{qe as o}from"./chunk-7HDHUOTF.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";async function h({auth:a,partition:m,sombraAuth:c,file:p,transcendUrl:f,timestampBefore:e,timestampAfter:r,identifiers:n=[],concurrency:l}){let g=await o(f,a,c),u=await s(g,{partition:m,filterBy:{...e?{timestampBefore:e.toISOString()}:{},...r?{timestampAfter:r.toISOString()}:{},...n.length>0?{identifiers:n}:{}},limit:l});i(p,u.map(t=>({...t,purposes:JSON.stringify(t.purposes),...t.purposes})))}export{h as pullConsentPreferences};
1
+ import"./chunk-5TDUSKDZ.js";import{c as i}from"./chunk-RBOBI6B6.js";import{j as s}from"./chunk-T4AGEIE3.js";import"./chunk-4HZHZ32O.js";import"./chunk-QXOUJ7DT.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import{qe as o}from"./chunk-LE6MXFBT.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";async function h({auth:a,partition:m,sombraAuth:c,file:p,transcendUrl:f,timestampBefore:e,timestampAfter:r,identifiers:n=[],concurrency:l}){let g=await o(f,a,c),u=await s(g,{partition:m,filterBy:{...e?{timestampBefore:e.toISOString()}:{},...r?{timestampAfter:r.toISOString()}:{},...n.length>0?{identifiers:n}:{}},limit:l});i(p,u.map(t=>({...t,purposes:JSON.stringify(t.purposes),...t.purposes})))}export{h as pullConsentPreferences};
@@ -1,4 +1,4 @@
1
- import{a}from"./chunk-HNMFVG75.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import"./chunk-7HDHUOTF.js";import{a as n}from"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";import x from"colors";import{writeFileSync as A}from"fs";import{TRANSCEND_SCOPES as E}from"@transcend-io/privacy-types";import{keyBy as K}from"lodash-es";var i=K(Object.entries(E).map(([t,o])=>({...o,name:t})),"title"),N=Object.keys(i);async function P({email:t,password:o,apiKeyTitle:p,file:c,scopes:m,deleteExistingApiKey:l,createNewApiKey:g,parentOrganizationId:f,transcendUrl:y}){let r=m.map(e=>e.trim()),s=r.filter(e=>!i[e]);s.length>0&&(n.error(x.red(`Failed to parse scopes:"${s.join(",")}".
1
+ import{a}from"./chunk-QAPBYN24.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import"./chunk-LE6MXFBT.js";import{a as n}from"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";import x from"colors";import{writeFileSync as A}from"fs";import{TRANSCEND_SCOPES as E}from"@transcend-io/privacy-types";import{keyBy as K}from"lodash-es";var i=K(Object.entries(E).map(([t,o])=>({...o,name:t})),"title"),N=Object.keys(i);async function P({email:t,password:o,apiKeyTitle:p,file:c,scopes:m,deleteExistingApiKey:l,createNewApiKey:g,parentOrganizationId:f,transcendUrl:y}){let r=m.map(e=>e.trim()),s=r.filter(e=>!i[e]);s.length>0&&(n.error(x.red(`Failed to parse scopes:"${s.join(",")}".
2
2
  Expected one of:
3
3
  ${N.join(`
4
4
  `)}`)),process.exit(1));let S=r.map(e=>i[e].name),{errors:d,apiKeys:C}=await a({transcendUrl:y,password:o,email:t,parentOrganizationId:f,deleteExistingApiKey:l,createNewApiKey:g,apiKeyTitle:p,scopes:S});A(c,`${JSON.stringify(C,null,2)}
@@ -1 +1 @@
1
- import{L as a}from"./chunk-ELYPVDLC.js";import"./chunk-7HDHUOTF.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";async function m({auth:s,actions:o,statuses:r=[],requestIds:c,silentModeBefore:e,createdAtBefore:t,createdAtAfter:n,cancellationTitle:i,transcendUrl:u,concurrency:d}){await a({transcendUrl:u,requestActions:o,auth:s,cancellationTitle:i,requestIds:c,statuses:r,concurrency:d,silentModeBefore:e?new Date(e):void 0,createdAtBefore:t?new Date(t):void 0,createdAtAfter:n?new Date(n):void 0})}export{m as cancel};
1
+ import{L as a}from"./chunk-QXOUJ7DT.js";import"./chunk-LE6MXFBT.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";async function m({auth:s,actions:o,statuses:r=[],requestIds:c,silentModeBefore:e,createdAtBefore:t,createdAtAfter:n,cancellationTitle:i,transcendUrl:u,concurrency:d}){await a({transcendUrl:u,requestActions:o,auth:s,cancellationTitle:i,requestIds:c,statuses:r,concurrency:d,silentModeBefore:e?new Date(e):void 0,createdAtBefore:t?new Date(t):void 0,createdAtAfter:n?new Date(n):void 0})}export{m as cancel};
@@ -1 +1 @@
1
- import{b as m}from"./chunk-HNMFVG75.js";import{a as t}from"./chunk-4S2LOGFN.js";import"./chunk-T5XKXHEX.js";import"./chunk-ELYPVDLC.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import{a as g}from"./chunk-7HDHUOTF.js";import{a as n}from"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";import a from"colors";import{ConsentBundleType as p}from"@transcend-io/privacy-types";async function M({auth:f,bundleTypes:r=[p.Production,p.Test],deploy:i,transcendUrl:s}){let e=await m(f);typeof e=="string"?(await t({deploy:i,transcendUrl:s,auth:e,bundleTypes:r}),n.info(a.green("Successfully updated Consent Manager!"))):(await g(e,async o=>{n.info(a.magenta(`Updating Consent Manager for organization "${o.organizationName}"...`)),await t({deploy:i,transcendUrl:s,auth:o.apiKey,bundleTypes:r}),n.info(a.green(`Successfully updated Consent Manager for organization "${o.organizationName}"!`))}),n.info(a.green("Successfully updated Consent Managers!")))}export{M as updateConsentManager};
1
+ import{b as m}from"./chunk-QAPBYN24.js";import{a as t}from"./chunk-T4AGEIE3.js";import"./chunk-4HZHZ32O.js";import"./chunk-QXOUJ7DT.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import{a as g}from"./chunk-LE6MXFBT.js";import{a as n}from"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";import a from"colors";import{ConsentBundleType as p}from"@transcend-io/privacy-types";async function M({auth:f,bundleTypes:r=[p.Production,p.Test],deploy:i,transcendUrl:s}){let e=await m(f);typeof e=="string"?(await t({deploy:i,transcendUrl:s,auth:e,bundleTypes:r}),n.info(a.green("Successfully updated Consent Manager!"))):(await g(e,async o=>{n.info(a.magenta(`Updating Consent Manager for organization "${o.organizationName}"...`)),await t({deploy:i,transcendUrl:s,auth:o.apiKey,bundleTypes:r}),n.info(a.green(`Successfully updated Consent Manager for organization "${o.organizationName}"!`))}),n.info(a.green("Successfully updated Consent Managers!")))}export{M as updateConsentManager};
@@ -1 +1 @@
1
- import{f as s}from"./chunk-NGVJ6L35.js";import"./chunk-RBOBI6B6.js";import{q as a}from"./chunk-ELYPVDLC.js";import"./chunk-7HDHUOTF.js";import{a as o}from"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";import l from"colors";import*as t from"io-ts";var p=t.type({"Request Id":t.string});async function R({auth:r,dataSiloId:i,file:e,transcendUrl:m}){o.info(l.magenta(`Reading "${e}" from disk`));let n=a(e,p);await s({requestIds:n.map(d=>d["Request Id"]),transcendUrl:m,auth:r,dataSiloId:i})}export{R as markRequestDataSilosCompleted};
1
+ import{f as s}from"./chunk-5TDUSKDZ.js";import"./chunk-RBOBI6B6.js";import{q as a}from"./chunk-QXOUJ7DT.js";import"./chunk-LE6MXFBT.js";import{a as o}from"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";import l from"colors";import*as t from"io-ts";var p=t.type({"Request Id":t.string});async function R({auth:r,dataSiloId:i,file:e,transcendUrl:m}){o.info(l.magenta(`Reading "${e}" from disk`));let n=a(e,p);await s({requestIds:n.map(d=>d["Request Id"]),transcendUrl:m,auth:r,dataSiloId:i})}export{R as markRequestDataSilosCompleted};
@@ -1,4 +1,4 @@
1
- import{_b as L,a as N,b as R,ha as _,pe as D}from"./chunk-7HDHUOTF.js";import{a}from"./chunk-OERYFLN2.js";import"./chunk-4ZV5X5DQ.js";import{b as U}from"./chunk-EZCJGIOS.js";import ge from"colors";import X from"got";var Q=({hostname:t,auth:e})=>X.extend({prefixUrl:`https://${t}`,headers:{accept:"application/json","content-type":"application/json",authorization:`Bearer ${e}`}});import Re from"colors";import xe from"yargs-parser";var Ge=Object.values(U);import te from"colors";import j from"fs";var w=({assessment:t,index:e,total:s,wrap:r=!0})=>{let n="";(e===0||r)&&(n=`[
1
+ import{_b as L,a as N,b as R,ha as _,pe as D}from"./chunk-LE6MXFBT.js";import{a}from"./chunk-OERYFLN2.js";import"./chunk-MLF3XCRS.js";import{b as U}from"./chunk-EZCJGIOS.js";import ge from"colors";import X from"got";var Q=({hostname:t,auth:e})=>X.extend({prefixUrl:`https://${t}`,headers:{accept:"application/json","content-type":"application/json",authorization:`Bearer ${e}`}});import Re from"colors";import xe from"yargs-parser";var Ge=Object.values(U);import te from"colors";import j from"fs";var w=({assessment:t,index:e,total:s,wrap:r=!0})=>{let n="";(e===0||r)&&(n=`[
2
2
  `);let m=JSON.stringify(t),o=s&&e<s-1&&!r?",":"";return n=`${n+m+o}
3
3
  `,(s&&e===s-1||r)&&(n+=`
4
4
  ]`),n};var B=({file:t,assessment:e,index:s,total:r})=>{a.info(te.magenta(`Writing enriched assessment ${s+1} of ${r} to file "${t}"...`)),s===0?j.writeFileSync(t,w({assessment:e,index:s,total:r,wrap:!1})):j.appendFileSync(t,w({assessment:e,index:s,total:r,wrap:!1}))};import P from"colors";import{decodeCodec as re}from"@transcend-io/type-utils";import{OneTrustGetListOfAssessmentsResponse as ne}from"@transcend-io/privacy-types";var q=async({oneTrust:t})=>{let e=0,s=1,r=0,n=[];for(;e<s;){let{body:m}=await t.get(`api/assessment/v2/assessments?page=${e}&size=2000`),{page:o,content:u}=re(ne,m);n.push(...u??[]),e===0&&(s=o?.totalPages??0,r=o?.totalElements??0),e+=1,a.info(`Fetched ${n.length} of ${r} assessments.`)}return n};import{decodeCodec as oe}from"@transcend-io/type-utils";import{OneTrustGetAssessmentResponse as ie}from"@transcend-io/privacy-types";var J=async({oneTrust:t,assessmentId:e})=>{let{body:s}=await t.get(`api/assessment/v2/assessments/${e}/export?ExcludeSkippedQuestions=false`);return oe(ie,s)};import{decodeCodec as ae}from"@transcend-io/type-utils";import{OneTrustGetRiskResponse as me}from"@transcend-io/privacy-types";var K=async({oneTrust:t,riskId:e})=>{let{body:s}=await t.get(`api/risk/v2/risks/${e}`);return ae(me,s)};import{decodeCodec as ce}from"@transcend-io/type-utils";import{OneTrustGetUserResponse as ue}from"@transcend-io/privacy-types";var b=async({oneTrust:t,userId:e})=>{let{body:s}=await t.get(`api/scim/v2/Users/${e}`);return ce(ue,s)};import{uniq as pe}from"lodash-es";import{keyBy as I}from"lodash-es";var W=({assessment:t,assessmentDetails:e,riskDetails:s,creatorDetails:r,approversDetails:n,respondentsDetails:m})=>{let o=I(s,"id"),{sections:u,createdBy:g,...h}=e,O=u.map(i=>{let{questions:A,...$}=i,x=A.map(E=>{let{risks:C,...G}=E,v=(C??[]).map(y=>{let S=o[y.riskId];return{...y,...S,level:y.level,impactLevel:y.impactLevel??0}});return{...G,risks:v}});return{...$,questions:x}}),p={...g,active:r?.active??!1,userType:r?.userType??"Internal",emails:r?.emails??[],title:r?.title??null,givenName:r?.name.givenName??null,familyName:r?.name.familyName??null},d=I(n,"id"),l=e.approvers.flatMap(i=>d[i.id]?[{...i,approver:{...i.approver,active:d[i.id].active,userType:d[i.id].userType,emails:d[i.id].emails,title:d[i.id].title,givenName:d[i.id].name.givenName??null,familyName:d[i.id].name.familyName??null}}]:[]),T=I(m,"id"),F=e.respondents.filter(i=>!i.name.includes("@")).flatMap(i=>T[i.id]?[{...i,active:T[i.id].active,userType:T[i.id].userType,emails:T[i.id].emails,title:T[i.id].title,givenName:T[i.id].name.givenName??null,familyName:T[i.id].name.familyName??null}]:[]);return{...t,...h,approvers:l,respondents:F,createdBy:p,sections:O}};import H from"colors";var k=async({transcend:t,assessment:e,total:s,index:r})=>{a.info(H.magenta(`Writing enriched assessment ${r+1} ${s?`of ${s} `:" "}to Transcend...`));let m={json:w({assessment:e,index:r,total:s})};try{await L(t,_,{input:m})}catch{a.error(H.red(`Failed to sync assessment ${r+1} ${s?`of ${s} `:" "}to Transcend.
@@ -1,4 +1,4 @@
1
- import{e as l}from"./chunk-QQRMUEM7.js";import{h as R,i as b}from"./chunk-FL3V7KJR.js";import{b as N}from"./chunk-HNMFVG75.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import{a as P,be as m,pe as u}from"./chunk-7HDHUOTF.js";import{a as o}from"./chunk-OERYFLN2.js";import{c as f}from"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import{d as E}from"./chunk-EZCJGIOS.js";import n from"colors";import{join as k}from"path";import D from"fs";async function M({auth:x,resources:g=R,file:t,transcendUrl:p,dataSiloIds:d=[],integrationNames:T=[],trackerStatuses:y=b,pageSize:S,skipDatapoints:h,skipSubDatapoints:$,includeGuessedCategories:A,debug:a}){let i=await N(x),C=g.includes("all")?Object.values(E):g;if(typeof i=="string"){try{let r=u(p,i),e=await m(r,{dataSiloIds:d,integrationNames:T,resources:C,pageSize:S,debug:a,skipDatapoints:h,skipSubDatapoints:$,includeGuessedCategories:A,trackerStatuses:y});o.info(n.magenta(`Writing configuration to file "${t}"...`)),l(t,e)}catch(r){o.error(n.red(`An error occurred syncing the schema: ${a?r.stack:r.message}`)),process.exit(1)}o.info(n.green(`Successfully synced yaml file to disk at ${t}! View at ${f}`))}else{if(!D.lstatSync(t).isDirectory())throw new Error("File is expected to be a folder when passing in a list of API keys to pull from. e.g. --file=./working/");let r=[];await P(i,async(e,L)=>{let s=`[${L+1}/${i.length}][${e.organizationName}] `;o.info(n.magenta(`~~~
1
+ import{e as l}from"./chunk-QQRMUEM7.js";import{h as R,i as b}from"./chunk-IQZKONXI.js";import{b as N}from"./chunk-QAPBYN24.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import{a as P,be as m,pe as u}from"./chunk-LE6MXFBT.js";import{a as o}from"./chunk-OERYFLN2.js";import{c as f}from"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import{d as E}from"./chunk-EZCJGIOS.js";import n from"colors";import{join as k}from"path";import D from"fs";async function M({auth:x,resources:g=R,file:t,transcendUrl:p,dataSiloIds:d=[],integrationNames:T=[],trackerStatuses:y=b,pageSize:S,skipDatapoints:h,skipSubDatapoints:$,includeGuessedCategories:A,debug:a}){let i=await N(x),C=g.includes("all")?Object.values(E):g;if(typeof i=="string"){try{let r=u(p,i),e=await m(r,{dataSiloIds:d,integrationNames:T,resources:C,pageSize:S,debug:a,skipDatapoints:h,skipSubDatapoints:$,includeGuessedCategories:A,trackerStatuses:y});o.info(n.magenta(`Writing configuration to file "${t}"...`)),l(t,e)}catch(r){o.error(n.red(`An error occurred syncing the schema: ${a?r.stack:r.message}`)),process.exit(1)}o.info(n.green(`Successfully synced yaml file to disk at ${t}! View at ${f}`))}else{if(!D.lstatSync(t).isDirectory())throw new Error("File is expected to be a folder when passing in a list of API keys to pull from. e.g. --file=./working/");let r=[];await P(i,async(e,L)=>{let s=`[${L+1}/${i.length}][${e.organizationName}] `;o.info(n.magenta(`~~~
2
2
 
3
3
  ${s}Attempting to pull configuration...
4
4
 
@@ -1 +1 @@
1
- import{a as w}from"./chunk-ZB5DNAF3.js";import{d as D,e as h}from"./chunk-QQRMUEM7.js";import{c as y}from"./chunk-HNMFVG75.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import{ne as S,pe as T}from"./chunk-7HDHUOTF.js";import{a as c}from"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";import{join as O}from"path";import{difference as v}from"lodash-es";import I from"colors";import{existsSync as $,lstatSync as b}from"fs";async function Q({auth:F,dataFlowsYmlFolder:a,output:x,ignoreYmls:C=[],transcendUrl:k}){a||(c.error(I.red("Missing required arg: --dataFlowsYmlFolder=./working/data-flows/")),process.exit(1)),(!$(a)||!b(a).isDirectory())&&(c.error(I.red(`Folder does not exist: "${a}"`)),process.exit(1));let N=C.map(t=>t.split(".")[0]),l=y(a).map(t=>{let{"data-flows":o=[]}=D(O(a,t)),{adTechDataSilos:m,siteTechDataSilos:r}=w(o,{serviceToSupportedIntegration:u,serviceToTitle:f});return{adTechDataSilos:m,siteTechDataSilos:r,organizationName:t.split(".")[0]}}),s={};l.forEach(({adTechDataSilos:t,siteTechDataSilos:o,organizationName:m})=>{[...t,...o].forEach(e=>{let n=e["outer-type"]||e.integrationName;s[n]||(s[n]=[]),s[n].push(m),s[n]=[...new Set(s[n])]})});let p=[...new Set(l.map(({adTechDataSilos:t})=>t.map(o=>o["outer-type"]||o.integrationName)).flat())],g=v([...new Set(l.map(({siteTechDataSilos:t})=>t.map(o=>o["outer-type"]||o.integrationName)).flat())],p),i={};l.forEach(({adTechDataSilos:t,siteTechDataSilos:o})=>{[...t,...o].forEach(r=>{let e=r["outer-type"]||r.integrationName,n=r.attributes?.find(E=>E.key==="Found On Domain");i[e]||(i[e]=[]),i[e].push(...n?.values||[]),i[e]=[...new Set(i[e])]})});let A=T(k,F),{serviceToTitle:f,serviceToSupportedIntegration:u}=await S(A),d=[...p,...g].map(t=>({title:f[t],...u[t]?{integrationName:t}:{integrationName:"promptAPerson","outer-type":t},attributes:[{key:"Tech Type",values:["Ad Tech"]},{key:"Business Units",values:v(s[t]||[],N)},{key:"Found On Domain",values:i[t]||[]}]}));c.log(`Total Services: ${d.length}`),c.log(`Ad Tech Services: ${p.length}`),c.log(`Site Tech Services: ${g.length}`),h(x,{"data-silos":d})}export{Q as deriveDataSilosFromDataFlowsCrossInstance};
1
+ import{a as w}from"./chunk-ZB5DNAF3.js";import{d as D,e as h}from"./chunk-QQRMUEM7.js";import{c as y}from"./chunk-QAPBYN24.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import{ne as S,pe as T}from"./chunk-LE6MXFBT.js";import{a as c}from"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";import{join as O}from"path";import{difference as v}from"lodash-es";import I from"colors";import{existsSync as $,lstatSync as b}from"fs";async function Q({auth:F,dataFlowsYmlFolder:a,output:x,ignoreYmls:C=[],transcendUrl:k}){a||(c.error(I.red("Missing required arg: --dataFlowsYmlFolder=./working/data-flows/")),process.exit(1)),(!$(a)||!b(a).isDirectory())&&(c.error(I.red(`Folder does not exist: "${a}"`)),process.exit(1));let N=C.map(t=>t.split(".")[0]),l=y(a).map(t=>{let{"data-flows":o=[]}=D(O(a,t)),{adTechDataSilos:m,siteTechDataSilos:r}=w(o,{serviceToSupportedIntegration:u,serviceToTitle:f});return{adTechDataSilos:m,siteTechDataSilos:r,organizationName:t.split(".")[0]}}),s={};l.forEach(({adTechDataSilos:t,siteTechDataSilos:o,organizationName:m})=>{[...t,...o].forEach(e=>{let n=e["outer-type"]||e.integrationName;s[n]||(s[n]=[]),s[n].push(m),s[n]=[...new Set(s[n])]})});let p=[...new Set(l.map(({adTechDataSilos:t})=>t.map(o=>o["outer-type"]||o.integrationName)).flat())],g=v([...new Set(l.map(({siteTechDataSilos:t})=>t.map(o=>o["outer-type"]||o.integrationName)).flat())],p),i={};l.forEach(({adTechDataSilos:t,siteTechDataSilos:o})=>{[...t,...o].forEach(r=>{let e=r["outer-type"]||r.integrationName,n=r.attributes?.find(E=>E.key==="Found On Domain");i[e]||(i[e]=[]),i[e].push(...n?.values||[]),i[e]=[...new Set(i[e])]})});let A=T(k,F),{serviceToTitle:f,serviceToSupportedIntegration:u}=await S(A),d=[...p,...g].map(t=>({title:f[t],...u[t]?{integrationName:t}:{integrationName:"promptAPerson","outer-type":t},attributes:[{key:"Tech Type",values:["Ad Tech"]},{key:"Business Units",values:v(s[t]||[],N)},{key:"Found On Domain",values:i[t]||[]}]}));c.log(`Total Services: ${d.length}`),c.log(`Ad Tech Services: ${p.length}`),c.log(`Site Tech Services: ${g.length}`),h(x,{"data-silos":d})}export{Q as deriveDataSilosFromDataFlowsCrossInstance};
@@ -1 +1 @@
1
- import{e as t}from"./chunk-NGVJ6L35.js";import"./chunk-RBOBI6B6.js";import"./chunk-ELYPVDLC.js";import"./chunk-7HDHUOTF.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";async function s({file:e,transcendUrl:r,auth:i,sombraAuth:o,dataSiloId:n}){await t({file:e,transcendUrl:r,auth:i,sombraAuth:o,dataSiloId:n})}export{s as markIdentifiersCompleted};
1
+ import{e as t}from"./chunk-5TDUSKDZ.js";import"./chunk-RBOBI6B6.js";import"./chunk-QXOUJ7DT.js";import"./chunk-LE6MXFBT.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";async function s({file:e,transcendUrl:r,auth:i,sombraAuth:o,dataSiloId:n}){await t({file:e,transcendUrl:r,auth:i,sombraAuth:o,dataSiloId:n})}export{s as markIdentifiersCompleted};
@@ -1 +1 @@
1
- import{a as l}from"./chunk-Z77MEZNJ.js";import"./chunk-NGVJ6L35.js";import{c as m}from"./chunk-RBOBI6B6.js";import"./chunk-ELYPVDLC.js";import{pe as c}from"./chunk-7HDHUOTF.js";import{a as r}from"./chunk-OERYFLN2.js";import{d as g}from"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";import{uniq as A,groupBy as G}from"lodash-es";import n from"colors";async function k({auth:p,file:a,transcendUrl:d,dataSiloIds:u,includeAttributes:y,includeGuessedCategories:C,parentCategories:f,subCategories:D=[]}){try{let o=c(d,p),P=await l(o,{dataSiloIds:u,includeGuessedCategories:C,parentCategories:f,includeAttributes:y,subCategories:D});r.info(n.magenta(`Writing datapoints to file "${a}"...`));let s=[],b=P.map(e=>{let i={"Property ID":e.id,"Data Silo":e.dataSilo.title,Object:e.dataPoint.name,"Object Path":e.dataPoint.path.join("."),Property:e.name,"Property Description":e.description,"Data Categories":e.categories.map(t=>`${t.category}:${t.name}`).join(", "),"Guessed Category":e.pendingCategoryGuesses?.[0]?`${e.pendingCategoryGuesses[0].category.category}:${e.pendingCategoryGuesses[0].category.name}`:"","Processing Purposes":e.purposes.map(t=>`${t.purpose}:${t.name}`).join(", "),...Object.entries(G(e.attributeValues||[],({attributeKey:t})=>t.name)).reduce((t,[$,h])=>(t[$]=h.map(j=>j.name).join(","),t),{})};return s=A([...s,...Object.keys(i)]),i});m(a,b,s)}catch(o){r.error(n.red(`An error occurred syncing the datapoints: ${o.message}`)),process.exit(1)}r.info(n.green(`Successfully synced datapoints to disk at ${a}! View at ${g}`))}export{k as pullDatapoints};
1
+ import{a as l}from"./chunk-PNOEWENG.js";import"./chunk-5TDUSKDZ.js";import{c as m}from"./chunk-RBOBI6B6.js";import"./chunk-QXOUJ7DT.js";import{pe as c}from"./chunk-LE6MXFBT.js";import{a as r}from"./chunk-OERYFLN2.js";import{d as g}from"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";import{uniq as A,groupBy as G}from"lodash-es";import n from"colors";async function k({auth:p,file:a,transcendUrl:d,dataSiloIds:u,includeAttributes:y,includeGuessedCategories:C,parentCategories:f,subCategories:D=[]}){try{let o=c(d,p),P=await l(o,{dataSiloIds:u,includeGuessedCategories:C,parentCategories:f,includeAttributes:y,subCategories:D});r.info(n.magenta(`Writing datapoints to file "${a}"...`));let s=[],b=P.map(e=>{let i={"Property ID":e.id,"Data Silo":e.dataSilo.title,Object:e.dataPoint.name,"Object Path":e.dataPoint.path.join("."),Property:e.name,"Property Description":e.description,"Data Categories":e.categories.map(t=>`${t.category}:${t.name}`).join(", "),"Guessed Category":e.pendingCategoryGuesses?.[0]?`${e.pendingCategoryGuesses[0].category.category}:${e.pendingCategoryGuesses[0].category.name}`:"","Processing Purposes":e.purposes.map(t=>`${t.purpose}:${t.name}`).join(", "),...Object.entries(G(e.attributeValues||[],({attributeKey:t})=>t.name)).reduce((t,[$,h])=>(t[$]=h.map(j=>j.name).join(","),t),{})};return s=A([...s,...Object.keys(i)]),i});m(a,b,s)}catch(o){r.error(n.red(`An error occurred syncing the datapoints: ${o.message}`)),process.exit(1)}r.info(n.green(`Successfully synced datapoints to disk at ${a}! View at ${g}`))}export{k as pullDatapoints};
@@ -1 +1 @@
1
- import{Q as e}from"./chunk-ELYPVDLC.js";import"./chunk-7HDHUOTF.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";async function A({auth:t,requestReceiptFolder:s,sombraAuth:r,actions:a,statuses:o,requestIds:i,createdAt:n,emailIsVerified:c,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:m,skipWaitingPeriod:l,createdAtBefore:p,createdAtAfter:f,concurrency:R,transcendUrl:q}){await e({requestReceiptFolder:s,auth:t,sombraAuth:r,requestActions:a,requestStatuses:o,requestIds:i,createdAt:n,emailIsVerified:c,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:m,skipWaitingPeriod:l,createdAtBefore:p,createdAtAfter:f,concurrency:R,transcendUrl:q})}export{A as restart};
1
+ import{Q as e}from"./chunk-QXOUJ7DT.js";import"./chunk-LE6MXFBT.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";async function A({auth:t,requestReceiptFolder:s,sombraAuth:r,actions:a,statuses:o,requestIds:i,createdAt:n,emailIsVerified:c,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:m,skipWaitingPeriod:l,createdAtBefore:p,createdAtAfter:f,concurrency:R,transcendUrl:q}){await e({requestReceiptFolder:s,auth:t,sombraAuth:r,requestActions:a,requestStatuses:o,requestIds:i,createdAt:n,emailIsVerified:c,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:m,skipWaitingPeriod:l,createdAtBefore:p,createdAtAfter:f,concurrency:R,transcendUrl:q})}export{A as restart};
@@ -1 +1 @@
1
- import{V as t}from"./chunk-ELYPVDLC.js";import"./chunk-7HDHUOTF.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";async function n({auth:s,dataSiloId:a,status:e,statuses:i,transcendUrl:o}){await t({transcendUrl:o,auth:s,status:e,dataSiloId:a,requestStatuses:i})}export{n as skipRequestDataSilos};
1
+ import{V as t}from"./chunk-QXOUJ7DT.js";import"./chunk-LE6MXFBT.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";async function n({auth:s,dataSiloId:a,status:e,statuses:i,transcendUrl:o}){await t({transcendUrl:o,auth:s,status:e,dataSiloId:a,requestStatuses:i})}export{n as skipRequestDataSilos};
@@ -0,0 +1 @@
1
+ import{c as o}from"./chunk-T4AGEIE3.js";import"./chunk-4HZHZ32O.js";import"./chunk-QXOUJ7DT.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import"./chunk-LE6MXFBT.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";async function i({auth:t,trackerStatus:r,file:s,transcendUrl:a}){await o({auth:t,trackerStatus:r,file:s,transcendUrl:a})}export{i as uploadCookiesFromCsv};
@@ -1 +1 @@
1
- import{S as r}from"./chunk-ELYPVDLC.js";import"./chunk-7HDHUOTF.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";async function m({auth:n,enricherId:s,actions:i,requestEnricherStatuses:a,requestIds:c,createdAtBefore:e,createdAtAfter:t,concurrency:o,transcendUrl:u}){await r({auth:n,enricherId:s,requestActions:i,requestEnricherStatuses:a,requestIds:c,createdAtBefore:e?new Date(e):void 0,createdAtAfter:t?new Date(t):void 0,concurrency:o,transcendUrl:u})}export{m as enricherRestart};
1
+ import{S as r}from"./chunk-QXOUJ7DT.js";import"./chunk-LE6MXFBT.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";async function m({auth:n,enricherId:s,actions:i,requestEnricherStatuses:a,requestIds:c,createdAtBefore:e,createdAtAfter:t,concurrency:o,transcendUrl:u}){await r({auth:n,enricherId:s,requestActions:i,requestEnricherStatuses:a,requestIds:c,createdAtBefore:e?new Date(e):void 0,createdAtAfter:t?new Date(t):void 0,concurrency:o,transcendUrl:u})}export{m as enricherRestart};
@@ -1 +1 @@
1
- import{W as e}from"./chunk-ELYPVDLC.js";import"./chunk-7HDHUOTF.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";async function s({auth:t,transcendUrl:i,identifierNames:n,actions:r=[]}){await e({requestActions:r,transcendUrl:i,auth:t,identifierNames:n})}export{s as rejectUnverifiedIdentifiers};
1
+ import{W as e}from"./chunk-QXOUJ7DT.js";import"./chunk-LE6MXFBT.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";async function s({auth:t,transcendUrl:i,identifierNames:n,actions:r=[]}){await e({requestActions:r,transcendUrl:i,auth:t,identifierNames:n})}export{s as rejectUnverifiedIdentifiers};
@@ -1 +1 @@
1
- import{O as t,n as e}from"./chunk-ELYPVDLC.js";import"./chunk-7HDHUOTF.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";async function y({auth:o,file:i,transcendUrl:n,cacheFilepath:a,requestReceiptFolder:r,sombraAuth:s,concurrency:l,attributes:c,isTest:d,isSilent:p,skipSendingReceipt:u,emailIsVerified:m,skipFilterStep:b,dryRun:g,debug:C,defaultPhoneCountryCode:f}){await t({cacheFilepath:a,requestReceiptFolder:r,file:i,auth:o,sombraAuth:s,concurrency:l,transcendUrl:n,defaultPhoneCountryCode:f,attributes:e(c),debug:C,skipFilterStep:b,isSilent:p,skipSendingReceipt:u,emailIsVerified:m,isTest:d,dryRun:g})}export{y as upload};
1
+ import{O as t,n as e}from"./chunk-QXOUJ7DT.js";import"./chunk-LE6MXFBT.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";async function y({auth:o,file:i,transcendUrl:n,cacheFilepath:a,requestReceiptFolder:r,sombraAuth:s,concurrency:l,attributes:c,isTest:d,isSilent:p,skipSendingReceipt:u,emailIsVerified:m,skipFilterStep:b,dryRun:g,debug:C,defaultPhoneCountryCode:f}){await t({cacheFilepath:a,requestReceiptFolder:r,file:i,auth:o,sombraAuth:s,concurrency:l,transcendUrl:n,defaultPhoneCountryCode:f,attributes:e(c),debug:C,skipFilterStep:b,isSilent:p,skipSendingReceipt:u,emailIsVerified:m,isTest:d,dryRun:g})}export{y as upload};
@@ -0,0 +1 @@
1
+ import{b as n,f as r}from"./chunk-4HZHZ32O.js";import{q as e}from"./chunk-QXOUJ7DT.js";import"./chunk-LE6MXFBT.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";async function d({base64EncryptionKey:o,base64SigningKey:t,partition:s,file:i,consentUrl:a,concurrency:c}){let m=e(i,n);await r({base64EncryptionKey:o,base64SigningKey:t,preferences:m,partition:s,concurrency:c,transcendUrl:a})}export{d as uploadConsentPreferences};
@@ -1 +1 @@
1
- import{b as p}from"./chunk-FI3PMXDN.js";import"./chunk-HNMFVG75.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import{ke as c,pe as m}from"./chunk-7HDHUOTF.js";import{a as r}from"./chunk-OERYFLN2.js";import{b as g}from"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";import n from"colors";import{execSync as k}from"child_process";var l='A repository name must be provided. You can specify using --repositoryName=$REPO_NAME or by ensuring the command "git config --get remote.origin.url" returns the name of the repository';async function S({auth:d,scanPath:o,ignoreDirs:f,repositoryName:u,transcendUrl:y}){let e=u;if(!e)try{let t=k(`cd ${o} && git config --get remote.origin.url`).toString("utf-8").trim();[e]=t.includes("https:")?t.split("/").slice(3).join("/").split("."):(t.split(":").pop()||"").split("."),e||(r.error(n.red(l)),process.exit(1))}catch(a){r.error(n.red(`${l} - Got error: ${a.message}`)),process.exit(1)}let h=m(y,d),i=await p({scanPath:o,ignoreDirs:f,repositoryName:e});await c(h,i);let s=new URL(g);s.pathname="/code-scanning/code-packages",r.info(n.green(`Scan found ${i.length} packages at ${o}! View results at '${s.href}'`))}export{S as scanPackages};
1
+ import{b as p}from"./chunk-AYMLP7SL.js";import"./chunk-QAPBYN24.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import{ke as c,pe as m}from"./chunk-LE6MXFBT.js";import{a as r}from"./chunk-OERYFLN2.js";import{b as g}from"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";import n from"colors";import{execSync as k}from"child_process";var l='A repository name must be provided. You can specify using --repositoryName=$REPO_NAME or by ensuring the command "git config --get remote.origin.url" returns the name of the repository';async function S({auth:d,scanPath:o,ignoreDirs:f,repositoryName:u,transcendUrl:y}){let e=u;if(!e)try{let t=k(`cd ${o} && git config --get remote.origin.url`).toString("utf-8").trim();[e]=t.includes("https:")?t.split("/").slice(3).join("/").split("."):(t.split(":").pop()||"").split("."),e||(r.error(n.red(l)),process.exit(1))}catch(a){r.error(n.red(`${l} - Got error: ${a.message}`)),process.exit(1)}let h=m(y,d),i=await p({scanPath:o,ignoreDirs:f,repositoryName:e});await c(h,i);let s=new URL(g);s.pathname="/code-scanning/code-packages",r.info(n.green(`Scan found ${i.length} packages at ${o}! View results at '${s.href}'`))}export{S as scanPackages};
@@ -1 +1 @@
1
- import{R as t}from"./chunk-ELYPVDLC.js";import"./chunk-7HDHUOTF.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";async function e({auth:i,transcendUrl:o,enricherIds:r}){await t({transcendUrl:o,auth:i,enricherIds:r})}export{e as skipPreflightJobs};
1
+ import{R as t}from"./chunk-QXOUJ7DT.js";import"./chunk-LE6MXFBT.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";async function e({auth:i,transcendUrl:o,enricherIds:r}){await t({transcendUrl:o,auth:i,enricherIds:r})}export{e as skipPreflightJobs};
@@ -1 +1 @@
1
- import{F as t}from"./chunk-ELYPVDLC.js";import"./chunk-7HDHUOTF.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";import{RequestStatus as e}from"@transcend-io/privacy-types";async function f({auth:o,transcendUrl:a,folderPath:r,requestIds:n,statuses:s=[e.Approving,e.Downloadable],concurrency:i,createdAtBefore:l,createdAtAfter:d,approveAfterDownload:c}){await t({transcendUrl:a,auth:o,folderPath:r,requestIds:n,statuses:s,concurrency:i,createdAtBefore:l,createdAtAfter:d,approveAfterDownload:c})}export{f as downloadFiles};
1
+ import{F as t}from"./chunk-QXOUJ7DT.js";import"./chunk-LE6MXFBT.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";import{RequestStatus as e}from"@transcend-io/privacy-types";async function f({auth:o,transcendUrl:a,folderPath:r,requestIds:n,statuses:s=[e.Approving,e.Downloadable],concurrency:i,createdAtBefore:l,createdAtAfter:d,approveAfterDownload:c}){await t({transcendUrl:a,auth:o,folderPath:r,requestIds:n,statuses:s,concurrency:i,createdAtBefore:l,createdAtAfter:d,approveAfterDownload:c})}export{f as downloadFiles};
@@ -1 +1 @@
1
- import{g as f}from"./chunk-NGVJ6L35.js";import{c as l,d as m}from"./chunk-RBOBI6B6.js";import"./chunk-ELYPVDLC.js";import"./chunk-7HDHUOTF.js";import{a as t}from"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";import o from"colors";import{uniq as P}from"lodash-es";async function N({file:d,transcendUrl:u,auth:p,sombraAuth:g,dataSiloId:c,actions:v,pageLimit:r,skipRequestCount:n,chunkSize:e}){n&&t.info(o.yellow("Skipping request count as requested. This may help speed up the call.")),(Number.isNaN(e)||e<=0||e%r!==0)&&(t.error(o.red(`Invalid chunk size: "${e}". Must be a positive integer that is a multiple of ${r}.`)),process.exit(1));let{baseName:b,extension:C}=m(d),a=0;await f({transcendUrl:u,apiPageSize:r,savePageSize:e,onSave:i=>{let s=`${b}-${a}${C}`;t.info(o.blue(`Saving ${i.length} identifiers to file "${s}"`));let $=P(i.map(I=>Object.keys(I)).flat());return l(s,i,$),t.info(o.green(`Successfully wrote ${i.length} identifiers to file "${s}"`)),a+=1,Promise.resolve()},actions:v,auth:p,sombraAuth:g,dataSiloId:c,skipRequestCount:n})}export{N as pullIdentifiers};
1
+ import{g as f}from"./chunk-5TDUSKDZ.js";import{c as l,d as m}from"./chunk-RBOBI6B6.js";import"./chunk-QXOUJ7DT.js";import"./chunk-LE6MXFBT.js";import{a as t}from"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";import o from"colors";import{uniq as P}from"lodash-es";async function N({file:d,transcendUrl:u,auth:p,sombraAuth:g,dataSiloId:c,actions:v,pageLimit:r,skipRequestCount:n,chunkSize:e}){n&&t.info(o.yellow("Skipping request count as requested. This may help speed up the call.")),(Number.isNaN(e)||e<=0||e%r!==0)&&(t.error(o.red(`Invalid chunk size: "${e}". Must be a positive integer that is a multiple of ${r}.`)),process.exit(1));let{baseName:b,extension:C}=m(d),a=0;await f({transcendUrl:u,apiPageSize:r,savePageSize:e,onSave:i=>{let s=`${b}-${a}${C}`;t.info(o.blue(`Saving ${i.length} identifiers to file "${s}"`));let $=P(i.map(I=>Object.keys(I)).flat());return l(s,i,$),t.info(o.green(`Successfully wrote ${i.length} identifiers to file "${s}"`)),a+=1,Promise.resolve()},actions:v,auth:p,sombraAuth:g,dataSiloId:c,skipRequestCount:n})}export{N as pullIdentifiers};
@@ -1 +1 @@
1
- import{a as p}from"./chunk-ZB5DNAF3.js";import{d as c,e as l}from"./chunk-QQRMUEM7.js";import{c as d}from"./chunk-HNMFVG75.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import{ne as m,pe as g}from"./chunk-7HDHUOTF.js";import{a as o}from"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";import{join as f}from"path";import e from"colors";import{existsSync as D,lstatSync as h}from"fs";async function M({auth:x,dataFlowsYmlFolder:r,dataSilosYmlFolder:t,ignoreYmls:S=[],transcendUrl:T}){r||(o.error(e.red("Missing required arg: --dataFlowsYmlFolder=./working/data-flows/")),process.exit(1)),(!D(r)||!h(r).isDirectory())&&(o.error(e.red(`Folder does not exist: "${r}"`)),process.exit(1)),t||(o.error(e.red("Missing required arg: --dataSilosYmlFolder=./working/data-silos/")),process.exit(1)),(!D(t)||!h(t).isDirectory())&&(o.error(e.red(`Folder does not exist: "${t}"`)),process.exit(1));let w=g(T,x),{serviceToTitle:u,serviceToSupportedIntegration:v}=await m(w);d(r).forEach(i=>{let{"data-flows":F=[]}=c(f(r,i)),{adTechDataSilos:s,siteTechDataSilos:a}=p(F,{serviceToSupportedIntegration:v,serviceToTitle:u}),n=[...s,...a];o.log(`Total Services: ${n.length}`),o.log(`Ad Tech Services: ${s.length}`),o.log(`Site Tech Services: ${a.length}`),l(f(t,i),{"data-silos":S.includes(i)?[]:n})})}export{M as deriveDataSilosFromDataFlows};
1
+ import{a as p}from"./chunk-ZB5DNAF3.js";import{d as c,e as l}from"./chunk-QQRMUEM7.js";import{c as d}from"./chunk-QAPBYN24.js";import"./chunk-HMF46LB7.js";import"./chunk-W6GUOMVP.js";import{ne as m,pe as g}from"./chunk-LE6MXFBT.js";import{a as o}from"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";import{join as f}from"path";import e from"colors";import{existsSync as D,lstatSync as h}from"fs";async function M({auth:x,dataFlowsYmlFolder:r,dataSilosYmlFolder:t,ignoreYmls:S=[],transcendUrl:T}){r||(o.error(e.red("Missing required arg: --dataFlowsYmlFolder=./working/data-flows/")),process.exit(1)),(!D(r)||!h(r).isDirectory())&&(o.error(e.red(`Folder does not exist: "${r}"`)),process.exit(1)),t||(o.error(e.red("Missing required arg: --dataSilosYmlFolder=./working/data-silos/")),process.exit(1)),(!D(t)||!h(t).isDirectory())&&(o.error(e.red(`Folder does not exist: "${t}"`)),process.exit(1));let w=g(T,x),{serviceToTitle:u,serviceToSupportedIntegration:v}=await m(w);d(r).forEach(i=>{let{"data-flows":F=[]}=c(f(r,i)),{adTechDataSilos:s,siteTechDataSilos:a}=p(F,{serviceToSupportedIntegration:v,serviceToTitle:u}),n=[...s,...a];o.log(`Total Services: ${n.length}`),o.log(`Ad Tech Services: ${s.length}`),o.log(`Site Tech Services: ${a.length}`),l(f(t,i),{"data-silos":S.includes(i)?[]:n})})}export{M as deriveDataSilosFromDataFlows};
@@ -1 +1 @@
1
- import{T as t}from"./chunk-ELYPVDLC.js";import"./chunk-7HDHUOTF.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-4ZV5X5DQ.js";import"./chunk-EZCJGIOS.js";async function i({auth:e,dataSiloId:a,actions:o,transcendUrl:s}){await t({requestActions:o,transcendUrl:s,auth:e,dataSiloId:a})}export{i as retryRequestDataSilos};
1
+ import{T as t}from"./chunk-QXOUJ7DT.js";import"./chunk-LE6MXFBT.js";import"./chunk-OERYFLN2.js";import"./chunk-APA5PR4U.js";import"./chunk-MLF3XCRS.js";import"./chunk-EZCJGIOS.js";async function i({auth:e,dataSiloId:a,actions:o,transcendUrl:s}){await t({requestActions:o,transcendUrl:s,auth:e,dataSiloId:a})}export{i as retryRequestDataSilos};