@transcend-io/cli 8.38.1 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-keys-C7JLTDUZ.mjs +2 -0
- package/dist/api-keys-C7JLTDUZ.mjs.map +1 -0
- package/dist/app-Dti3qTxV.mjs +131 -0
- package/dist/app-Dti3qTxV.mjs.map +1 -0
- package/dist/bin/bash-complete.mjs +3 -0
- package/dist/bin/bash-complete.mjs.map +1 -0
- package/dist/bin/cli.mjs +3 -0
- package/dist/bin/cli.mjs.map +1 -0
- package/dist/bin/deprecated-command.mjs +5 -0
- package/dist/bin/deprecated-command.mjs.map +1 -0
- package/dist/buildAIIntegrationType-Bk0EbFKV.mjs +2 -0
- package/dist/buildAIIntegrationType-Bk0EbFKV.mjs.map +1 -0
- package/dist/code-scanning-3tLsE1W5.mjs +4 -0
- package/dist/code-scanning-3tLsE1W5.mjs.map +1 -0
- package/dist/codecs-TR6p48v3.mjs +2 -0
- package/dist/codecs-TR6p48v3.mjs.map +1 -0
- package/dist/command-BlHM1nCd.mjs +9 -0
- package/dist/command-BlHM1nCd.mjs.map +1 -0
- package/dist/consent-manager-BoaaMjRQ.mjs +12 -0
- package/dist/consent-manager-BoaaMjRQ.mjs.map +1 -0
- package/dist/constants-DdeeX81W.mjs +2 -0
- package/dist/constants-DdeeX81W.mjs.map +1 -0
- package/dist/context-bkKpii_t.mjs +2 -0
- package/dist/{context-_8xfl0dt.cjs.map → context-bkKpii_t.mjs.map} +1 -1
- package/dist/cron-DOicA1l8.mjs +2 -0
- package/dist/cron-DOicA1l8.mjs.map +1 -0
- package/dist/data-inventory-OeEcogPl.mjs +75 -0
- package/dist/data-inventory-OeEcogPl.mjs.map +1 -0
- package/dist/dataFlowsToDataSilos-RAhfPV0l.mjs +2 -0
- package/dist/dataFlowsToDataSilos-RAhfPV0l.mjs.map +1 -0
- package/dist/done-input-validation-CcZtaz03.mjs +2 -0
- package/dist/{done-input-validation-DGckEJ5a.cjs.map → done-input-validation-CcZtaz03.mjs.map} +1 -1
- package/dist/enums-CyFTrzXY.mjs +2 -0
- package/dist/{enums-BZulhPFa.cjs.map → enums-CyFTrzXY.mjs.map} +1 -1
- package/dist/impl--Ov8Om49.mjs +2 -0
- package/dist/impl--Ov8Om49.mjs.map +1 -0
- package/dist/impl-4BP7gY61.mjs +2 -0
- package/dist/impl-4BP7gY61.mjs.map +1 -0
- package/dist/impl-B0d5M861.mjs +2 -0
- package/dist/impl-B0d5M861.mjs.map +1 -0
- package/dist/impl-B40z0Aoz2.mjs +2 -0
- package/dist/impl-B40z0Aoz2.mjs.map +1 -0
- package/dist/impl-B8CoAX4t.mjs +2 -0
- package/dist/impl-B8CoAX4t.mjs.map +1 -0
- package/dist/impl-BDKBhSiG2.mjs +2 -0
- package/dist/impl-BDKBhSiG2.mjs.map +1 -0
- package/dist/impl-BEzyqD_12.mjs +2 -0
- package/dist/impl-BEzyqD_12.mjs.map +1 -0
- package/dist/impl-BI4zCNs0.mjs +2 -0
- package/dist/impl-BI4zCNs0.mjs.map +1 -0
- package/dist/impl-BJ9Ge6Wf2.mjs +2 -0
- package/dist/impl-BJ9Ge6Wf2.mjs.map +1 -0
- package/dist/impl-BPz3SpXo2.mjs +2 -0
- package/dist/impl-BPz3SpXo2.mjs.map +1 -0
- package/dist/impl-BYBNi68b.mjs +5 -0
- package/dist/impl-BYBNi68b.mjs.map +1 -0
- package/dist/impl-Bh04BLeU2.mjs +2 -0
- package/dist/impl-Bh04BLeU2.mjs.map +1 -0
- package/dist/impl-BhMd6_J22.mjs +2 -0
- package/dist/impl-BhMd6_J22.mjs.map +1 -0
- package/dist/impl-BiWrlucD.mjs +2 -0
- package/dist/impl-BiWrlucD.mjs.map +1 -0
- package/dist/impl-BpMKYqSR.mjs +2 -0
- package/dist/{impl-B8rg6CMv.cjs.map → impl-BpMKYqSR.mjs.map} +1 -1
- package/dist/impl-BraVBCrF2.mjs +4 -0
- package/dist/impl-BraVBCrF2.mjs.map +1 -0
- package/dist/impl-BvTvjK72.mjs +2 -0
- package/dist/impl-BvTvjK72.mjs.map +1 -0
- package/dist/impl-BvZai1Pf2.mjs +2 -0
- package/dist/impl-BvZai1Pf2.mjs.map +1 -0
- package/dist/impl-C73Uh2Ze.mjs +2 -0
- package/dist/impl-C73Uh2Ze.mjs.map +1 -0
- package/dist/impl-CIJ6P1GD.mjs +3 -0
- package/dist/impl-CIJ6P1GD.mjs.map +1 -0
- package/dist/impl-CNiEzL3_2.mjs +2 -0
- package/dist/impl-CNiEzL3_2.mjs.map +1 -0
- package/dist/impl-CTPHR7O62.mjs +2 -0
- package/dist/impl-CTPHR7O62.mjs.map +1 -0
- package/dist/impl-CU29SrJb2.mjs +2 -0
- package/dist/impl-CU29SrJb2.mjs.map +1 -0
- package/dist/impl-CaTnsoDi.mjs +2 -0
- package/dist/{impl-BIjDq-3S.cjs.map → impl-CaTnsoDi.mjs.map} +1 -1
- package/dist/impl-CiQeM677.mjs +2 -0
- package/dist/impl-CiQeM677.mjs.map +1 -0
- package/dist/impl-CkY0wfCz.mjs +2 -0
- package/dist/impl-CkY0wfCz.mjs.map +1 -0
- package/dist/impl-CoZhgLjC.mjs +12 -0
- package/dist/impl-CoZhgLjC.mjs.map +1 -0
- package/dist/impl-CvxsioT4.mjs +2 -0
- package/dist/impl-CvxsioT4.mjs.map +1 -0
- package/dist/impl-D2HalFgB2.mjs +2 -0
- package/dist/impl-D2HalFgB2.mjs.map +1 -0
- package/dist/impl-DFNq8PBe.mjs +2 -0
- package/dist/impl-DFNq8PBe.mjs.map +1 -0
- package/dist/impl-DOgLpdLw.mjs +2 -0
- package/dist/impl-DOgLpdLw.mjs.map +1 -0
- package/dist/impl-DP757pBT.mjs +2 -0
- package/dist/impl-DP757pBT.mjs.map +1 -0
- package/dist/impl-DVDN007x.mjs +2 -0
- package/dist/impl-DVDN007x.mjs.map +1 -0
- package/dist/impl-DfKI4fmI.mjs +2 -0
- package/dist/impl-DfKI4fmI.mjs.map +1 -0
- package/dist/impl-DgsWGnhH.mjs +2 -0
- package/dist/impl-DgsWGnhH.mjs.map +1 -0
- package/dist/impl-DzSmriDw.mjs +2 -0
- package/dist/impl-DzSmriDw.mjs.map +1 -0
- package/dist/impl-EhTHDCC1.mjs +2 -0
- package/dist/{impl-JgMjiEBD.cjs.map → impl-EhTHDCC1.mjs.map} +1 -1
- package/dist/impl-J-dQqTZJ2.mjs +2 -0
- package/dist/impl-J-dQqTZJ2.mjs.map +1 -0
- package/dist/impl-SxwaNC4m2.mjs +2 -0
- package/dist/impl-SxwaNC4m2.mjs.map +1 -0
- package/dist/impl-fESuqAH1.mjs +2 -0
- package/dist/{impl-ChHjX-p0.cjs.map → impl-fESuqAH1.mjs.map} +1 -1
- package/dist/impl-gYrR3kIh.mjs +4 -0
- package/dist/impl-gYrR3kIh.mjs.map +1 -0
- package/dist/impl-iwjvzA7a.mjs +2 -0
- package/dist/impl-iwjvzA7a.mjs.map +1 -0
- package/dist/impl-nKY3m-Vx.mjs +2 -0
- package/dist/impl-nKY3m-Vx.mjs.map +1 -0
- package/dist/impl-qiK6VF4F2.mjs +2 -0
- package/dist/impl-qiK6VF4F2.mjs.map +1 -0
- package/dist/{index.d.cts → index.d.mts} +1760 -3516
- package/dist/index.mjs +5 -0
- package/dist/index.mjs.map +1 -0
- package/dist/logger-Bj782ZYD.mjs +2 -0
- package/dist/logger-Bj782ZYD.mjs.map +1 -0
- package/dist/manual-enrichment-CYoZNBjO.mjs +2 -0
- package/dist/manual-enrichment-CYoZNBjO.mjs.map +1 -0
- package/dist/mergeTranscendInputs-Coj_e2N3.mjs +2 -0
- package/dist/{mergeTranscendInputs-BIBCYbug.cjs.map → mergeTranscendInputs-Coj_e2N3.mjs.map} +1 -1
- package/dist/pooling-BkZAO1Zs.mjs +23 -0
- package/dist/pooling-BkZAO1Zs.mjs.map +1 -0
- package/dist/preference-management-BHj26bmE.mjs +7 -0
- package/dist/preference-management-BHj26bmE.mjs.map +1 -0
- package/dist/readTranscendYaml-DhKG1ViI.mjs +4 -0
- package/dist/readTranscendYaml-DhKG1ViI.mjs.map +1 -0
- package/dist/syncConfigurationToTranscend-wWSbGVrI.mjs +3010 -0
- package/dist/syncConfigurationToTranscend-wWSbGVrI.mjs.map +1 -0
- package/dist/uploadConsents-nsjKy1I4.mjs +2 -0
- package/dist/uploadConsents-nsjKy1I4.mjs.map +1 -0
- package/package.json +46 -49
- package/dist/api-keys-y8Txn6tT.cjs +0 -2
- package/dist/api-keys-y8Txn6tT.cjs.map +0 -1
- package/dist/app-_ZoYl64o.cjs +0 -131
- package/dist/app-_ZoYl64o.cjs.map +0 -1
- package/dist/bin/bash-complete.cjs +0 -3
- package/dist/bin/bash-complete.cjs.map +0 -1
- package/dist/bin/cli.cjs +0 -3
- package/dist/bin/cli.cjs.map +0 -1
- package/dist/bin/deprecated-command.cjs +0 -5
- package/dist/bin/deprecated-command.cjs.map +0 -1
- package/dist/buildAIIntegrationType-BwuCYR-o.cjs +0 -2
- package/dist/buildAIIntegrationType-BwuCYR-o.cjs.map +0 -1
- package/dist/chunk-Bmb41Sf3.cjs +0 -1
- package/dist/code-scanning-ByZQgqip.cjs +0 -4
- package/dist/code-scanning-ByZQgqip.cjs.map +0 -1
- package/dist/codecs-Bvmb8o9R.cjs +0 -2
- package/dist/codecs-Bvmb8o9R.cjs.map +0 -1
- package/dist/command-CLULRNcd.cjs +0 -9
- package/dist/command-CLULRNcd.cjs.map +0 -1
- package/dist/consent-manager-CJZ5GTmv.cjs +0 -12
- package/dist/consent-manager-CJZ5GTmv.cjs.map +0 -1
- package/dist/constants-CzmvL6Mw.cjs +0 -2
- package/dist/constants-CzmvL6Mw.cjs.map +0 -1
- package/dist/context-_8xfl0dt.cjs +0 -2
- package/dist/cron-Ts7kHP6_.cjs +0 -2
- package/dist/cron-Ts7kHP6_.cjs.map +0 -1
- package/dist/data-inventory-D0Tt_vAm.cjs +0 -75
- package/dist/data-inventory-D0Tt_vAm.cjs.map +0 -1
- package/dist/dataFlowsToDataSilos-B7nTxawV.cjs +0 -2
- package/dist/dataFlowsToDataSilos-B7nTxawV.cjs.map +0 -1
- package/dist/done-input-validation-DGckEJ5a.cjs +0 -2
- package/dist/enums-BZulhPFa.cjs +0 -2
- package/dist/impl-1qwMfsU4.cjs +0 -2
- package/dist/impl-1qwMfsU4.cjs.map +0 -1
- package/dist/impl-73q3K0b_.cjs +0 -2
- package/dist/impl-73q3K0b_.cjs.map +0 -1
- package/dist/impl-8HXqFDdD.cjs +0 -2
- package/dist/impl-8HXqFDdD.cjs.map +0 -1
- package/dist/impl-AZPWCkCp.cjs +0 -2
- package/dist/impl-AZPWCkCp.cjs.map +0 -1
- package/dist/impl-B61wd2KQ.cjs +0 -2
- package/dist/impl-B61wd2KQ.cjs.map +0 -1
- package/dist/impl-B8rg6CMv.cjs +0 -2
- package/dist/impl-BIjDq-3S.cjs +0 -2
- package/dist/impl-BPxZw3LN.cjs +0 -2
- package/dist/impl-BPxZw3LN.cjs.map +0 -1
- package/dist/impl-BczOEWXK.cjs +0 -2
- package/dist/impl-BczOEWXK.cjs.map +0 -1
- package/dist/impl-BeUsmMIp.cjs +0 -2
- package/dist/impl-BeUsmMIp.cjs.map +0 -1
- package/dist/impl-Bhv353rp.cjs +0 -2
- package/dist/impl-Bhv353rp.cjs.map +0 -1
- package/dist/impl-BiPKUZQ2.cjs +0 -2
- package/dist/impl-BiPKUZQ2.cjs.map +0 -1
- package/dist/impl-BvrbCovf.cjs +0 -12
- package/dist/impl-BvrbCovf.cjs.map +0 -1
- package/dist/impl-BxKSXO7j.cjs +0 -2
- package/dist/impl-BxKSXO7j.cjs.map +0 -1
- package/dist/impl-ByavdlGX.cjs +0 -2
- package/dist/impl-ByavdlGX.cjs.map +0 -1
- package/dist/impl-C6Vv_fyU.cjs +0 -2
- package/dist/impl-C6Vv_fyU.cjs.map +0 -1
- package/dist/impl-CGSBsFc7.cjs +0 -2
- package/dist/impl-CGSBsFc7.cjs.map +0 -1
- package/dist/impl-ChHjX-p0.cjs +0 -2
- package/dist/impl-ChqwjO34.cjs +0 -2
- package/dist/impl-ChqwjO34.cjs.map +0 -1
- package/dist/impl-CrieEyzk.cjs +0 -2
- package/dist/impl-CrieEyzk.cjs.map +0 -1
- package/dist/impl-Cru4riTc.cjs +0 -5
- package/dist/impl-Cru4riTc.cjs.map +0 -1
- package/dist/impl-CujcX7vE.cjs +0 -2
- package/dist/impl-CujcX7vE.cjs.map +0 -1
- package/dist/impl-D9OOb2JE.cjs +0 -2
- package/dist/impl-D9OOb2JE.cjs.map +0 -1
- package/dist/impl-DCKUxoWY.cjs +0 -2
- package/dist/impl-DCKUxoWY.cjs.map +0 -1
- package/dist/impl-DG_MFWMU.cjs +0 -2
- package/dist/impl-DG_MFWMU.cjs.map +0 -1
- package/dist/impl-DHIiB7cV.cjs +0 -2
- package/dist/impl-DHIiB7cV.cjs.map +0 -1
- package/dist/impl-DYHQz-Wu.cjs +0 -2
- package/dist/impl-DYHQz-Wu.cjs.map +0 -1
- package/dist/impl-D_4LdDL9.cjs +0 -2
- package/dist/impl-D_4LdDL9.cjs.map +0 -1
- package/dist/impl-D_tCWU8I.cjs +0 -2
- package/dist/impl-D_tCWU8I.cjs.map +0 -1
- package/dist/impl-DhKyE3ja.cjs +0 -2
- package/dist/impl-DhKyE3ja.cjs.map +0 -1
- package/dist/impl-DkyT66jZ.cjs +0 -2
- package/dist/impl-DkyT66jZ.cjs.map +0 -1
- package/dist/impl-DpkTAuVd.cjs +0 -2
- package/dist/impl-DpkTAuVd.cjs.map +0 -1
- package/dist/impl-DvFcMtV7.cjs +0 -4
- package/dist/impl-DvFcMtV7.cjs.map +0 -1
- package/dist/impl-Dzi2-R-5.cjs +0 -3
- package/dist/impl-Dzi2-R-5.cjs.map +0 -1
- package/dist/impl-Dzyo_6if.cjs +0 -2
- package/dist/impl-Dzyo_6if.cjs.map +0 -1
- package/dist/impl-HogBsNBk.cjs +0 -2
- package/dist/impl-HogBsNBk.cjs.map +0 -1
- package/dist/impl-JgMjiEBD.cjs +0 -2
- package/dist/impl-JkHt--m4.cjs +0 -4
- package/dist/impl-JkHt--m4.cjs.map +0 -1
- package/dist/impl-_wktLwfn.cjs +0 -2
- package/dist/impl-_wktLwfn.cjs.map +0 -1
- package/dist/impl-afJ-fKK4.cjs +0 -2
- package/dist/impl-afJ-fKK4.cjs.map +0 -1
- package/dist/impl-brt-L_kS.cjs +0 -2
- package/dist/impl-brt-L_kS.cjs.map +0 -1
- package/dist/impl-iuvcsdad.cjs +0 -2
- package/dist/impl-iuvcsdad.cjs.map +0 -1
- package/dist/impl-kmDIC1No.cjs +0 -2
- package/dist/impl-kmDIC1No.cjs.map +0 -1
- package/dist/impl-zSp6Nypz.cjs +0 -2
- package/dist/impl-zSp6Nypz.cjs.map +0 -1
- package/dist/index.cjs +0 -5
- package/dist/index.cjs.map +0 -1
- package/dist/logger-DQwEYtSS.cjs +0 -2
- package/dist/logger-DQwEYtSS.cjs.map +0 -1
- package/dist/manual-enrichment-CW8iihdb.cjs +0 -2
- package/dist/manual-enrichment-CW8iihdb.cjs.map +0 -1
- package/dist/mergeTranscendInputs-BIBCYbug.cjs +0 -2
- package/dist/pooling-Dw0a42I_.cjs +0 -23
- package/dist/pooling-Dw0a42I_.cjs.map +0 -1
- package/dist/preference-management-CkmW6Z91.cjs +0 -7
- package/dist/preference-management-CkmW6Z91.cjs.map +0 -1
- package/dist/readTranscendYaml-Cycz6RxW.cjs +0 -4
- package/dist/readTranscendYaml-Cycz6RxW.cjs.map +0 -1
- package/dist/syncConfigurationToTranscend-DkeLrq-I.cjs +0 -3009
- package/dist/syncConfigurationToTranscend-DkeLrq-I.cjs.map +0 -1
- package/dist/uploadConsents-zr1Hg-JE.cjs +0 -2
- package/dist/uploadConsents-zr1Hg-JE.cjs.map +0 -1
- /package/dist/bin/{bash-complete.d.cts → bash-complete.d.mts} +0 -0
- /package/dist/bin/{cli.d.cts → cli.d.mts} +0 -0
- /package/dist/bin/{deprecated-command.d.cts → deprecated-command.d.mts} +0 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import{t as e}from"./logger-Bj782ZYD.mjs";import{Cs as t,Ds as n,Ss as r,bs as i,i as a,js as o}from"./syncConfigurationToTranscend-wWSbGVrI.mjs";import{SubDataPointDataSubCategoryGuessStatus as s}from"@transcend-io/privacy-types";import{chunk as c,keyBy as l,sortBy as u,uniq as d}from"lodash-es";import f from"colors";import{gql as p}from"graphql-request";import m from"cli-progress";async function h(t,{dataSiloIds:r=[],includeGuessedCategories:i,includeAttributes:o,parentCategories:c=[],subCategories:l=[],pageSize:d=1e3}={}){let h=[],g=new Date().getTime(),_=new m.SingleBar({},m.Presets.shades_classic),v={...c.length>0?{category:c}:{},...l.length>0?{subCategoryIds:l}:{},...c.length+l.length>0&&!i?{status:s.Approved}:{},...r.length>0?{dataSilos:r}:{}},{subDataPoints:{totalCount:y}}=await a(t,n,{filterBy:v});e.info(f.magenta(`[Step 1/3] Pulling in all subdatapoints`)),_.start(y,0);let b=0,x=!1,S,C=0;do try{let{subDataPoints:{nodes:e}}=await a(t,p`
|
|
2
|
+
query TranscendCliSubDataPointCsvExport(
|
|
3
|
+
$filterBy: SubDataPointFiltersInput
|
|
4
|
+
$first: Int!
|
|
5
|
+
$offset: Int!
|
|
6
|
+
) {
|
|
7
|
+
subDataPoints(
|
|
8
|
+
filterBy: $filterBy
|
|
9
|
+
first: $first
|
|
10
|
+
offset: $offset
|
|
11
|
+
useMaster: false
|
|
12
|
+
) {
|
|
13
|
+
nodes {
|
|
14
|
+
id
|
|
15
|
+
name
|
|
16
|
+
description
|
|
17
|
+
dataPointId
|
|
18
|
+
dataSiloId
|
|
19
|
+
purposes {
|
|
20
|
+
name
|
|
21
|
+
purpose
|
|
22
|
+
}
|
|
23
|
+
categories {
|
|
24
|
+
name
|
|
25
|
+
category
|
|
26
|
+
}
|
|
27
|
+
${i?`pendingCategoryGuesses {
|
|
28
|
+
category {
|
|
29
|
+
name
|
|
30
|
+
category
|
|
31
|
+
}
|
|
32
|
+
status
|
|
33
|
+
classifierVersion
|
|
34
|
+
}`:``}
|
|
35
|
+
${o?`attributeValues {
|
|
36
|
+
attributeKey {
|
|
37
|
+
name
|
|
38
|
+
}
|
|
39
|
+
name
|
|
40
|
+
}`:``}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`,{first:d,offset:C,filterBy:{...v}});S=e[e.length-1]?.id,h.push(...e),x=e.length===d,b+=e.length,C+=e.length,_.update(b)}catch(t){throw e.error(f.red(`An error fetching subdatapoints for cursor ${S} and offset ${C}`)),t}while(x);_.stop();let w=new Date().getTime()-g,T=u(h,`name`);return e.info(f.green(`Successfully pulled in ${T.length} subdatapoints in ${w/1e3} seconds!`)),T}async function g(n,{dataPointIds:r=[],pageSize:i=100}){let s=[],l=new Date().getTime(),u=new m.SingleBar({},m.Presets.shades_classic);e.info(f.magenta(`[Step 2/3] Fetching metadata for ${r.length} datapoints`));let d=c(r,i);u.start(r.length,0);let p=0;await o(d,async r=>{try{let{dataPoints:{nodes:e}}=await a(n,t,{first:i,filterBy:{ids:r}});s.push(...e),p+=r.length,u.update(p)}catch(t){throw e.error(f.red(`An error fetching subdatapoints for IDs ${r.join(`, `)}`)),t}}),u.stop();let h=new Date().getTime()-l;return e.info(f.green(`Successfully pulled in ${s.length} dataPoints in ${h/1e3} seconds!`)),s}async function _(t,{dataSiloIds:n=[],pageSize:r=100}){let s=[],l=new Date().getTime(),u=new m.SingleBar({},m.Presets.shades_classic);e.info(f.magenta(`[Step 3/3] Fetching metadata for ${n.length} data silos`));let d=c(n,r);u.start(n.length,0);let p=0;await o(d,async n=>{try{let{dataSilos:{nodes:e}}=await a(t,i,{first:r,filterBy:{ids:n}});s.push(...e),p+=n.length,u.update(p)}catch(t){throw e.error(f.red(`An error fetching data silos for IDs ${n.join(`, `)}`)),t}}),u.stop();let h=new Date().getTime()-l;return e.info(f.green(`Successfully pulled in ${s.length} data silos in ${h/1e3} seconds!`)),s}async function v(e,{dataSiloIds:t=[],includeGuessedCategories:n,includeAttributes:r,parentCategories:i=[],subCategories:a=[],pageSize:o=1e3}={}){let s=await h(e,{dataSiloIds:t,includeGuessedCategories:n,includeAttributes:r,parentCategories:i,subCategories:a,pageSize:o}),c=l(await g(e,{dataPointIds:d(s.map(e=>e.dataPointId))}),`id`),u=l(await _(e,{dataSiloIds:d(s.map(e=>e.dataSiloId))}),`id`);return s.map(e=>({...e,dataPoint:c[e.dataPointId],dataSilo:u[e.dataSiloId]}))}async function y(t,{dataSiloIds:n=[],status:i,subCategories:o=[],includeEncryptedSnippets:s,pageSize:c=100}={}){let l=[],d=new Date().getTime(),h=new m.SingleBar({},m.Presets.shades_classic),g={...o.length>0?{subCategoryIds:o}:{},...i?{status:i}:{},...n.length>0?{dataSilos:n}:{}},{unstructuredSubDataPointRecommendations:{totalCount:_}}=await a(t,r,{filterBy:g});e.info(f.magenta(`[Step 1/3] Pulling in all subdatapoints`)),h.start(_,0);let v=0,y=!1,b,x=0;do try{let{unstructuredSubDataPointRecommendations:{nodes:e}}=await a(t,p`
|
|
45
|
+
query TranscendCliUnstructuredSubDataPointRecommendationCsvExport(
|
|
46
|
+
$filterBy: UnstructuredSubDataPointRecommendationsFilterInput
|
|
47
|
+
$first: Int!
|
|
48
|
+
$offset: Int!
|
|
49
|
+
) {
|
|
50
|
+
unstructuredSubDataPointRecommendations(
|
|
51
|
+
filterBy: $filterBy
|
|
52
|
+
first: $first
|
|
53
|
+
offset: $offset
|
|
54
|
+
useMaster: false
|
|
55
|
+
) {
|
|
56
|
+
nodes {
|
|
57
|
+
id
|
|
58
|
+
dataSiloId
|
|
59
|
+
scannedObjectPathId
|
|
60
|
+
scannedObjectId
|
|
61
|
+
${s?`name`:``}
|
|
62
|
+
${s?`contextSnippet`:``}
|
|
63
|
+
dataSubCategory {
|
|
64
|
+
name
|
|
65
|
+
category
|
|
66
|
+
}
|
|
67
|
+
status
|
|
68
|
+
confidence
|
|
69
|
+
classificationMethod
|
|
70
|
+
classifierVersion
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
`,{first:c,offset:x,filterBy:{...g}});b=e[e.length-1]?.id,l.push(...e),y=e.length===c,v+=e.length,x+=e.length,h.update(v)}catch(t){throw e.error(f.red(`An error fetching subdatapoints for cursor ${b} and offset ${x}`)),t}while(y);h.stop();let S=new Date().getTime()-d,C=u(l,`name`);return e.info(f.green(`Successfully pulled in ${C.length} subdatapoints in ${S/1e3} seconds!`)),C}export{v as n,y as t};
|
|
75
|
+
//# sourceMappingURL=data-inventory-OeEcogPl.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-inventory-OeEcogPl.mjs","names":[],"sources":["../src/lib/data-inventory/pullAllDatapoints.ts","../src/lib/data-inventory/pullUnstructuredSubDataPointRecommendations.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport { keyBy, uniq, chunk, sortBy } from 'lodash-es';\nimport {\n type DataCategoryType,\n SubDataPointDataSubCategoryGuessStatus,\n} from '@transcend-io/privacy-types';\nimport cliProgress from 'cli-progress';\nimport { gql } from 'graphql-request';\nimport colors from 'colors';\nimport type { GraphQLClient } from 'graphql-request';\nimport {\n DATAPOINT_EXPORT,\n DATA_SILO_EXPORT,\n type DataSiloAttributeValue,\n SUB_DATA_POINTS_COUNT,\n makeGraphQLRequest,\n} from '../graphql';\nimport { logger } from '../../logger';\nimport type { DataCategoryInput, ProcessingPurposeInput } from '../../codecs';\nimport { mapSeries } from '../bluebird';\n\nexport interface DataSiloCsvPreview {\n /** ID of dataSilo */\n id: string;\n /** Name of dataSilo */\n title: string;\n}\n\nexport interface DataPointCsvPreview {\n /** ID of dataPoint */\n id: string;\n /** The path to this data point */\n path: string[];\n /** Description */\n description: {\n /** Default message */\n defaultMessage: string;\n };\n /** Name */\n name: string;\n}\n\nexport interface SubDataPointCsvPreview {\n /** ID of subDatapoint */\n id: string;\n /** Name (or key) of the subdatapoint */\n name: string;\n /** The description */\n description?: string;\n /** Personal data category */\n categories: DataCategoryInput[];\n /** Data point ID */\n dataPointId: string;\n /** The data silo ID */\n dataSiloId: string;\n /** The processing purpose for this sub datapoint */\n purposes: ProcessingPurposeInput[];\n /** Attribute attached to subdatapoint */\n attributeValues?: DataSiloAttributeValue[];\n /** Data category guesses that are output by the classifier */\n pendingCategoryGuesses?: {\n /** Data category being guessed */\n category: DataCategoryInput;\n /** Status of guess */\n status: SubDataPointDataSubCategoryGuessStatus;\n /** classifier version that produced the guess */\n classifierVersion: number;\n }[];\n}\n\nexport interface DatapointFilterOptions {\n /** IDs of data silos to filter down */\n dataSiloIds?: string[];\n /** Whether to include guessed categories, defaults to only approved categories */\n includeGuessedCategories?: boolean;\n /** Whether or not to include attributes */\n includeAttributes?: boolean;\n /** Parent categories to filter down for */\n parentCategories?: DataCategoryType[];\n /** Sub categories to filter down for */\n subCategories?: string[]; // TODO: https://transcend.height.app/T-40482 - do by name not ID\n}\n\n/**\n * Pull subdatapoint information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The subdatapoints\n */\nasync function pullSubDatapoints(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n includeGuessedCategories,\n includeAttributes,\n parentCategories = [],\n subCategories = [],\n pageSize = 1000,\n }: DatapointFilterOptions & {\n /** Page size to pull in */\n pageSize?: number;\n } = {},\n): Promise<SubDataPointCsvPreview[]> {\n const subDataPoints: SubDataPointCsvPreview[] = [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n // Filters\n const filterBy = {\n ...(parentCategories.length > 0 ? { category: parentCategories } : {}),\n ...(subCategories.length > 0 ? { subCategoryIds: subCategories } : {}),\n // if parentCategories or subCategories and not includeGuessedCategories\n ...(parentCategories.length + subCategories.length > 0 &&\n !includeGuessedCategories\n ? // then only show data points with approved data categories\n { status: SubDataPointDataSubCategoryGuessStatus.Approved }\n : {}),\n ...(dataSiloIds.length > 0 ? { dataSilos: dataSiloIds } : {}),\n };\n\n // Build a GraphQL client\n const {\n subDataPoints: { totalCount },\n } = await makeGraphQLRequest<{\n /** Query response */\n subDataPoints: {\n /** Count */\n totalCount: number;\n };\n }>(client, SUB_DATA_POINTS_COUNT, {\n filterBy,\n });\n\n logger.info(colors.magenta('[Step 1/3] Pulling in all subdatapoints'));\n\n progressBar.start(totalCount, 0);\n let total = 0;\n let shouldContinue = false;\n let cursor: string | undefined;\n let offset = 0;\n do {\n try {\n const {\n subDataPoints: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n subDataPoints: {\n /** List of matches */\n nodes: SubDataPointCsvPreview[];\n };\n }>(\n client,\n gql`\n query TranscendCliSubDataPointCsvExport(\n $filterBy: SubDataPointFiltersInput\n $first: Int!\n $offset: Int!\n ) {\n subDataPoints(\n filterBy: $filterBy\n first: $first\n offset: $offset\n useMaster: false\n ) {\n nodes {\n id\n name\n description\n dataPointId\n dataSiloId\n purposes {\n name\n purpose\n }\n categories {\n name\n category\n }\n ${\n includeGuessedCategories\n ? `pendingCategoryGuesses {\n category {\n name\n category\n }\n status\n classifierVersion\n }`\n : ''\n }\n ${\n includeAttributes\n ? `attributeValues {\n attributeKey {\n name\n }\n name\n }`\n : ''\n }\n }\n }\n }\n `,\n {\n first: pageSize,\n offset,\n filterBy: {\n ...filterBy,\n // TODO: https://transcend.height.app/T-40484 - add cursor support\n // ...(cursor ? { cursor: { id: cursor } } : {}),\n },\n },\n );\n\n cursor = nodes[nodes.length - 1]?.id as string;\n subDataPoints.push(...nodes);\n shouldContinue = nodes.length === pageSize;\n total += nodes.length;\n offset += nodes.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(\n `An error fetching subdatapoints for cursor ${cursor} and offset ${offset}`,\n ),\n );\n throw err;\n }\n } while (shouldContinue);\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n const sorted = sortBy(subDataPoints, 'name');\n\n logger.info(\n colors.green(\n `Successfully pulled in ${sorted.length} subdatapoints in ${\n totalTime / 1000\n } seconds!`,\n ),\n );\n return sorted;\n}\n\n/**\n * Pull datapoint information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The datapoints\n */\nasync function pullDatapoints(\n client: GraphQLClient,\n {\n dataPointIds = [],\n pageSize = 100,\n }: {\n /** IDs of data points to filter down */\n dataPointIds: string[];\n /** Page size to pull in */\n pageSize?: number;\n },\n): Promise<DataPointCsvPreview[]> {\n const dataPoints: DataPointCsvPreview[] = [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n logger.info(\n colors.magenta(\n `[Step 2/3] Fetching metadata for ${dataPointIds.length} datapoints`,\n ),\n );\n\n // Group by 100\n const dataPointsGrouped = chunk(dataPointIds, pageSize);\n\n progressBar.start(dataPointIds.length, 0);\n let total = 0;\n await mapSeries(dataPointsGrouped, async (dataPointIdsGroup) => {\n try {\n const {\n dataPoints: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n dataPoints: {\n /** List of matches */\n nodes: DataPointCsvPreview[];\n };\n }>(client, DATAPOINT_EXPORT, {\n first: pageSize,\n filterBy: {\n ids: dataPointIdsGroup,\n },\n });\n\n dataPoints.push(...nodes);\n total += dataPointIdsGroup.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(\n `An error fetching subdatapoints for IDs ${dataPointIdsGroup.join(\n ', ',\n )}`,\n ),\n );\n throw err;\n }\n });\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully pulled in ${dataPoints.length} dataPoints in ${\n totalTime / 1000\n } seconds!`,\n ),\n );\n return dataPoints;\n}\n\n/**\n * Pull data silo information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The data silos\n */\nasync function pullDataSilos(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n pageSize = 100,\n }: {\n /** IDs of data silos to filter down */\n dataSiloIds: string[];\n /** Page size to pull in */\n pageSize?: number;\n },\n): Promise<DataSiloCsvPreview[]> {\n const dataSilos: DataSiloCsvPreview[] = [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n logger.info(\n colors.magenta(\n `[Step 3/3] Fetching metadata for ${dataSiloIds.length} data silos`,\n ),\n );\n\n // Group by 100\n const dataSilosGrouped = chunk(dataSiloIds, pageSize);\n\n progressBar.start(dataSiloIds.length, 0);\n let total = 0;\n await mapSeries(dataSilosGrouped, async (dataSiloIdsGroup) => {\n try {\n const {\n dataSilos: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n dataSilos: {\n /** List of matches */\n nodes: DataSiloCsvPreview[];\n };\n }>(client, DATA_SILO_EXPORT, {\n first: pageSize,\n filterBy: {\n ids: dataSiloIdsGroup,\n },\n });\n\n dataSilos.push(...nodes);\n total += dataSiloIdsGroup.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(\n `An error fetching data silos for IDs ${dataSiloIdsGroup.join(', ')}`,\n ),\n );\n throw err;\n }\n });\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully pulled in ${dataSilos.length} data silos in ${\n totalTime / 1000\n } seconds!`,\n ),\n );\n return dataSilos;\n}\n\n/**\n * Pull all datapoints from the data inventory.\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The datapoints and data silos\n */\nexport async function pullAllDatapoints(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n includeGuessedCategories,\n includeAttributes,\n parentCategories = [],\n subCategories = [],\n pageSize = 1000,\n }: DatapointFilterOptions & {\n /** Page size to pull in */\n pageSize?: number;\n } = {},\n): Promise<\n (SubDataPointCsvPreview & {\n /** Data point information */\n dataPoint: DataPointCsvPreview;\n /** Data silo information */\n dataSilo: DataSiloCsvPreview;\n })[]\n> {\n // Subdatapoint information\n const subDatapoints = await pullSubDatapoints(client, {\n dataSiloIds,\n includeGuessedCategories,\n includeAttributes,\n parentCategories,\n subCategories,\n pageSize,\n });\n\n // The datapoint ids to grab\n const dataPointIds = uniq(subDatapoints.map((point) => point.dataPointId));\n const dataPoints = await pullDatapoints(client, {\n dataPointIds,\n });\n const dataPointById = keyBy(dataPoints, 'id');\n\n // The data silo IDs to grab\n const allDataSiloIds = uniq(subDatapoints.map((point) => point.dataSiloId));\n const dataSilos = await pullDataSilos(client, {\n dataSiloIds: allDataSiloIds,\n });\n const dataSiloById = keyBy(dataSilos, 'id');\n\n return subDatapoints.map((subDataPoint) => ({\n ...subDataPoint,\n dataPoint: dataPointById[subDataPoint.dataPointId],\n dataSilo: dataSiloById[subDataPoint.dataSiloId],\n }));\n}\n/* eslint-enable max-lines */\n","import type { UnstructuredSubDataPointRecommendationStatus } from '@transcend-io/privacy-types';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\nimport { gql, type GraphQLClient } from 'graphql-request';\nimport { sortBy } from 'lodash-es';\nimport type { DataCategoryInput } from '../../codecs';\nimport { ENTRY_COUNT, makeGraphQLRequest } from '../graphql';\nimport { logger } from '../../logger';\n\ninterface UnstructuredSubDataPointRecommendationCsvPreview {\n /** ID of subDatapoint */\n id: string;\n /** Entry or Named Entity recognized by the classifier */\n name: string;\n /** Context snippet including entry */\n contextSnippet: string;\n /** Scanned object ID */\n scannedObjectId: string;\n /** Scanned object path ID */\n scannedObjectPathId: string;\n /** The data silo ID */\n dataSiloId: string;\n /** Personal data category */\n dataSubCategory: DataCategoryInput;\n /** Classification Status */\n status: UnstructuredSubDataPointRecommendationStatus;\n /** Confidence */\n confidence: number;\n /** Classification method */\n classificationMethod: string;\n /** Classifier version */\n classifierVersion: string;\n}\n\ninterface EntryFilterOptions {\n /** IDs of data silos to filter down */\n dataSiloIds?: string[];\n /** Parent categories to filter down for */\n status?: UnstructuredSubDataPointRecommendationStatus[];\n /** Sub categories to filter down for */\n subCategories?: string[]; // TODO: https://transcend.height.app/T-40482 - do by name not ID\n /** Include entry and snippet */\n includeEncryptedSnippets?: boolean;\n /** Include encryptedSamplesS3Key */\n includeEncryptedSamplesS3Key?: boolean;\n}\n/**\n * Pull unstructured subdatapoint information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @param options.dataSiloIds - IDs of data silos to filter down\n * @param options.status - Parent categories to filter down for\n * @param options.subCategories - Sub categories to filter down for\n * @param options.includeEncryptedSnippets - Include entry and snippet\n * @param options.includeEncryptedSamplesS3Key - Include encryptedSamplesS3Key\n * @param options.pageSize - Page size to pull in\n * @returns A promise that resolves to an array of unstructured subdatapoint recommendations\n */\nexport async function pullUnstructuredSubDataPointRecommendations(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n status,\n subCategories = [],\n includeEncryptedSnippets,\n pageSize = 100,\n }: EntryFilterOptions & {\n /** Page size to pull in */\n pageSize?: number;\n } = {},\n): Promise<UnstructuredSubDataPointRecommendationCsvPreview[]> {\n const unstructuredSubDataPointRecommendations: UnstructuredSubDataPointRecommendationCsvPreview[] =\n [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n // Filters\n const filterBy = {\n ...(subCategories.length > 0 ? { subCategoryIds: subCategories } : {}),\n ...(status ? { status } : {}),\n ...(dataSiloIds.length > 0 ? { dataSilos: dataSiloIds } : {}),\n };\n\n // Build a GraphQL client\n const {\n unstructuredSubDataPointRecommendations: { totalCount },\n } = await makeGraphQLRequest<{\n /** Query response */\n unstructuredSubDataPointRecommendations: {\n /** Count */\n totalCount: number;\n };\n }>(client, ENTRY_COUNT, {\n filterBy,\n });\n\n logger.info(colors.magenta('[Step 1/3] Pulling in all subdatapoints'));\n\n progressBar.start(totalCount, 0);\n let total = 0;\n let shouldContinue = false;\n let cursor: string | undefined;\n let offset = 0;\n do {\n try {\n const {\n unstructuredSubDataPointRecommendations: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n unstructuredSubDataPointRecommendations: {\n /** List of matches */\n nodes: UnstructuredSubDataPointRecommendationCsvPreview[];\n };\n }>(\n client,\n gql`\n query TranscendCliUnstructuredSubDataPointRecommendationCsvExport(\n $filterBy: UnstructuredSubDataPointRecommendationsFilterInput\n $first: Int!\n $offset: Int!\n ) {\n unstructuredSubDataPointRecommendations(\n filterBy: $filterBy\n first: $first\n offset: $offset\n useMaster: false\n ) {\n nodes {\n id\n dataSiloId\n scannedObjectPathId\n scannedObjectId\n ${includeEncryptedSnippets ? 'name' : ''}\n ${includeEncryptedSnippets ? 'contextSnippet' : ''}\n dataSubCategory {\n name\n category\n }\n status\n confidence\n classificationMethod\n classifierVersion\n }\n }\n }\n `,\n {\n first: pageSize,\n offset,\n filterBy: {\n ...filterBy,\n },\n },\n );\n\n cursor = nodes[nodes.length - 1]?.id as string;\n unstructuredSubDataPointRecommendations.push(...nodes);\n shouldContinue = nodes.length === pageSize;\n total += nodes.length;\n offset += nodes.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(\n `An error fetching subdatapoints for cursor ${cursor} and offset ${offset}`,\n ),\n );\n throw err;\n }\n } while (shouldContinue);\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n const sorted = sortBy(unstructuredSubDataPointRecommendations, 'name');\n\n logger.info(\n colors.green(\n `Successfully pulled in ${sorted.length} subdatapoints in ${\n totalTime / 1000\n } seconds!`,\n ),\n );\n return sorted;\n}\n"],"mappings":"kYA0FA,eAAe,EACb,EACA,CACE,cAAc,EAAE,CAChB,2BACA,oBACA,mBAAmB,EAAE,CACrB,gBAAgB,EAAE,CAClB,WAAW,KAIT,EAAE,CAC6B,CACnC,IAAM,EAA0C,EAAE,CAG5C,EAAK,IAAI,MAAM,CAAC,S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E,GAAI,EAAS,CAAE,SAAQ,CAAG,EAAE,CAC5B,GAAI,EAAY,OAAS,EAAI,CAAE,UAAW,EAAa,CAAG,EAAE,CAC7D,CAGK,CACJ,wCAAyC,CAAE,eACzC,MAAM,EAMP,EAAQ,EAAa,CACtB,WACD,CAAC,CAEF,EAAO,KAAK,EAAO,QAAQ,0CAA0C,CAAC,CAEtE,EAAY,MAAM,EAAY,EAAE,CAChC,IAAI,EAAQ,EACR,EAAiB,GACjB,EACA,EAAS,EACb,EACE,IAAI,CACF,GAAM,CACJ,wCAAyC,CAAE,UACzC,MAAM,EAOR,EACA,CAAG;;;;;;;;;;;;;;;;;kBAiBO,EAA2B,OAAS,GAAG;kBACvC,EAA2B,iBAAmB,GAAG;;;;;;;;;;;;UAa3D,CACE,MAAO,EACP,SACA,SAAU,CACR,GAAG,EACJ,CACF,CACF,CAED,EAAS,EAAM,EAAM,OAAS,IAAI,GAClC,EAAwC,KAAK,GAAG,EAAM,CACtD,EAAiB,EAAM,SAAW,EAClC,GAAS,EAAM,OACf,GAAU,EAAM,OAChB,EAAY,OAAO,EAAM,OAClB,EAAK,CAMZ,MALA,EAAO,MACL,EAAO,IACL,8CAA8C,EAAO,cAAc,IACpE,CACF,CACK,QAED,GAET,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SAAS,CACR,EAEjB,EAAS,EAAO,EAAyC,OAAO,CAStE,OAPA,EAAO,KACL,EAAO,MACL,0BAA0B,EAAO,OAAO,oBACtC,EAAY,IACb,WACF,CACF,CACM"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{union as e}from"lodash-es";function t(t,{adTechPurposes:n=[`SaleOfInfo`],serviceToTitle:r,serviceToSupportedIntegration:i}){let a=[],o=[],s={};t.forEach(t=>{let{service:r,attributes:i=[]}=t;if(!r||r===`internalService`)return;let c=i.find(e=>e.key===`Found on Domain`);c&&(s[r]||(s[r]=[]),s[r].push(...c.values.map(e=>e.replace(`https://`,``).replace(`http://`,``))),s[r]=[...new Set(s[r])]),e(t.trackingPurposes,n).length>0?(o.push(r),a.includes(r)&&(a=a.filter(e=>e!==r))):o.includes(r)||a.push(r)});let c=[...new Set(o)].map(e=>({title:r[e],...i[e]?{integrationName:e}:{integrationName:`promptAPerson`,"outer-type":e},attributes:[{key:`Tech Type`,values:[`Ad Tech`]},{key:`Found On Domain`,values:s[e]||[]}]}));return{siteTechDataSilos:[...new Set(a)].map(e=>({title:r[e],...i[e]?{integrationName:e}:{integrationName:`promptAPerson`,outerType:e},attributes:[{key:`Tech Type`,values:[`Site Tech`]},{key:`Found On Domain`,values:s[e]||[]}]})),adTechDataSilos:c}}export{t};
|
|
2
|
+
//# sourceMappingURL=dataFlowsToDataSilos-RAhfPV0l.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataFlowsToDataSilos-RAhfPV0l.mjs","names":[],"sources":["../src/lib/consent-manager/dataFlowsToDataSilos.ts"],"sourcesContent":["import { DataFlowInput, DataSiloInput } from '../../codecs';\nimport { union } from 'lodash-es';\nimport { IndexedCatalogs } from '../graphql';\n\n/**\n * Convert data flow configurations into a set of data silo configurations\n *\n * @param inputs - Data flow input to convert to data silos\n * @param options - Additional options\n * @returns Business entity configuration input\n */\nexport function dataFlowsToDataSilos(\n inputs: DataFlowInput[],\n {\n adTechPurposes = ['SaleOfInfo'],\n serviceToTitle,\n serviceToSupportedIntegration,\n }: IndexedCatalogs & {\n /** List of purposes that are considered \"Ad Tech\" */\n adTechPurposes?: string[];\n },\n): {\n /** List of data silo configurations for site-tech services */\n siteTechDataSilos: DataSiloInput[];\n /** List of data silo configurations for ad-tech services */\n adTechDataSilos: DataSiloInput[];\n} {\n // List of site tech integrations\n let siteTechIntegrations: string[] = [];\n\n // List of ad tech integrations\n const adTechIntegrations: string[] = [];\n\n // Mapping from service name to list of\n const serviceToFoundOnDomain: { [k in string]: string[] } = {};\n\n // iterate over each flow\n inputs.forEach((flow) => {\n // process data flows with services\n const { service, attributes = [] } = flow;\n if (!service || service === 'internalService') {\n return;\n }\n\n // create mapping to found on domain\n const foundOnDomain = attributes.find(\n (attr) => attr.key === 'Found on Domain',\n );\n\n // Create a list of all domains where the data flow was found\n if (foundOnDomain) {\n if (!serviceToFoundOnDomain[service]) {\n serviceToFoundOnDomain[service] = [];\n }\n serviceToFoundOnDomain[service]!.push(\n ...foundOnDomain.values.map((v) =>\n v.replace('https://', '').replace('http://', ''),\n ),\n );\n serviceToFoundOnDomain[service] = [\n ...new Set(serviceToFoundOnDomain[service]),\n ];\n }\n\n // Keep track of ad tech\n if (union(flow.trackingPurposes, adTechPurposes).length > 0) {\n // add service to ad tech list\n adTechIntegrations.push(service);\n\n // remove from site tech list\n if (siteTechIntegrations.includes(service)) {\n siteTechIntegrations = siteTechIntegrations.filter(\n (s) => s !== service,\n );\n }\n } else if (!adTechIntegrations.includes(service)) {\n // add to site tech list\n siteTechIntegrations.push(service);\n }\n });\n\n // create the list of ad tech integrations\n const adTechDataSilos = [...new Set(adTechIntegrations)].map((service) => ({\n title: serviceToTitle[service],\n ...(serviceToSupportedIntegration[service]\n ? { integrationName: service }\n : { integrationName: 'promptAPerson', 'outer-type': service }),\n attributes: [\n {\n key: 'Tech Type',\n values: ['Ad Tech'],\n },\n {\n key: 'Found On Domain',\n values: serviceToFoundOnDomain[service] || [],\n },\n ],\n }));\n\n // create the list of site tech integrations\n const siteTechDataSilos = [...new Set(siteTechIntegrations)].map(\n (service) => ({\n title: serviceToTitle[service],\n ...(serviceToSupportedIntegration[service]\n ? { integrationName: service }\n : { integrationName: 'promptAPerson', outerType: service }),\n attributes: [\n {\n key: 'Tech Type',\n values: ['Site Tech'],\n },\n {\n key: 'Found On Domain',\n values: serviceToFoundOnDomain[service] || [],\n },\n ],\n }),\n );\n\n return {\n siteTechDataSilos,\n adTechDataSilos,\n };\n}\n"],"mappings":"kCAWA,SAAgB,EACd,EACA,CACE,iBAAiB,CAAC,aAAa,CAC/B,iBACA,iCAUF,CAEA,I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kBACL,OAAQ,EAAuB,IAAY,EAAE,CAC9C,CACF,CACF,EACF,CAIC,kBACD"}
|
package/dist/{done-input-validation-DGckEJ5a.cjs.map → done-input-validation-CcZtaz03.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"done-input-validation-
|
|
1
|
+
{"version":3,"file":"done-input-validation-CcZtaz03.mjs","names":[],"sources":["../src/lib/cli/done-input-validation.ts"],"sourcesContent":["/**\n * If the environment variable `DEVELOPMENT_MODE_VALIDATE_ONLY` is set,\n * this function will exit the process with a status code of 0.\n *\n * This is useful for development mode, where we want to validate the\n * command flags without actually running the command.\n *\n * This should be called after input validation, and must be agnostic to the environment (e.g., the existence of a file on the file system)\n *\n * @param exit - The function to exit the process.\n */\nexport function doneInputValidation(exit: (code?: number) => void): void {\n if (process.env.DEVELOPMENT_MODE_VALIDATE_ONLY === 'true') {\n exit(0);\n }\n}\n"],"mappings":"AAWA,SAAgB,EAAoB,EAAqC,CACnE,QAAQ,IAAI,iCAAmC,QACjD,EAAK,EAAE"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{makeEnum as e}from"@transcend-io/type-utils";let t=function(e){return e.Json=`json`,e}({}),n=function(e){return e.Assessments=`assessments`,e}({}),r=function(e){return e.OneTrust=`oneTrust`,e.File=`file`,e}({}),i=function(e){return e.ApiKeys=`apiKeys`,e.Attributes=`customFields`,e.Templates=`templates`,e.DataSilos=`dataSilos`,e.Enrichers=`enrichers`,e.DataFlows=`dataFlows`,e.BusinessEntities=`businessEntities`,e.ProcessingActivities=`processingActivities`,e.Actions=`actions`,e.DataSubjects=`dataSubjects`,e.Identifiers=`identifiers`,e.Cookies=`cookies`,e.ConsentManager=`consentManager`,e.Partitions=`partitions`,e.Prompts=`prompts`,e.PromptPartials=`promptPartials`,e.PromptGroups=`promptGroups`,e.Agents=`agents`,e.AgentFunctions=`agentFunctions`,e.AgentFiles=`agentFiles`,e.Vendors=`vendors`,e.DataCategories=`dataCategories`,e.ProcessingPurposes=`processingPurposes`,e.ActionItems=`actionItems`,e.ActionItemCollections=`actionItemCollections`,e.Teams=`teams`,e.PrivacyCenters=`privacyCenters`,e.Policies=`policies`,e.Messages=`messages`,e.Assessments=`assessments`,e.AssessmentTemplates=`assessmentTemplates`,e.Purposes=`purposes`,e.SystemDiscovery=`systemDiscovery`,e}({});const a=e({RedactEmail:`redactEmail`,Log:`log`,LogToTranscend:`logToTranscend`,ApplyTranscendPolicies:`applyTranscendPolicies`}),o=e({ChatCompletion:`/v1/chat/completions`,Embeddings:`/v1/embeddings`,Completions:`/v1/completions`,Agents:`/v1/assistants`,Agent:`/v1/assistants/:assistantId`,Threads:`/v1/threads`,Thread:`/v1/threads/:threadId`,Messages:`/v1/threads/:threadId/messages`,Message:`/v1/threads/:threadId/messages/:messageId`,Runs:`/v1/threads/:threadId/runs`,Run:`/v1/threads/:threadId/runs/:runId`,Files:`/v1/files`,File:`/v1/files/:fileId`});export{a,o as i,n,i as o,r,t};
|
|
2
|
+
//# sourceMappingURL=enums-CyFTrzXY.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums-
|
|
1
|
+
{"version":3,"file":"enums-CyFTrzXY.mjs","names":[],"sources":["../src/enums.ts"],"sourcesContent":["import { makeEnum } from '@transcend-io/type-utils';\n\n/** Accepted file formats for exporting resources from OneTrust */\nexport enum OneTrustFileFormat {\n Json = 'json',\n}\n\n/**\n * Resources that can be pulled in from OneTrust\n */\nexport enum OneTrustPullResource {\n Assessments = 'assessments',\n}\n\n/**\n * Where to read OneTrust resources from\n */\nexport enum OneTrustPullSource {\n OneTrust = 'oneTrust',\n File = 'file',\n}\n\n/**\n * Resources that can be pulled in\n */\nexport enum TranscendPullResource {\n ApiKeys = 'apiKeys',\n Attributes = 'customFields',\n Templates = 'templates',\n DataSilos = 'dataSilos',\n Enrichers = 'enrichers',\n DataFlows = 'dataFlows',\n BusinessEntities = 'businessEntities',\n ProcessingActivities = 'processingActivities',\n Actions = 'actions',\n DataSubjects = 'dataSubjects',\n Identifiers = 'identifiers',\n Cookies = 'cookies',\n ConsentManager = 'consentManager',\n Partitions = 'partitions',\n Prompts = 'prompts',\n PromptPartials = 'promptPartials',\n PromptGroups = 'promptGroups',\n Agents = 'agents',\n AgentFunctions = 'agentFunctions',\n AgentFiles = 'agentFiles',\n Vendors = 'vendors',\n DataCategories = 'dataCategories',\n ProcessingPurposes = 'processingPurposes',\n ActionItems = 'actionItems',\n ActionItemCollections = 'actionItemCollections',\n Teams = 'teams',\n PrivacyCenters = 'privacyCenters',\n Policies = 'policies',\n Messages = 'messages',\n Assessments = 'assessments',\n AssessmentTemplates = 'assessmentTemplates',\n Purposes = 'purposes',\n SystemDiscovery = 'systemDiscovery',\n}\n\n/**\n * Names of built in policies for pathfinder\n */\nexport const PathfinderPolicyName = makeEnum({\n RedactEmail: 'redactEmail',\n Log: 'log',\n LogToTranscend: 'logToTranscend',\n ApplyTranscendPolicies: 'applyTranscendPolicies',\n});\n\n/**\n * Type override\n */\nexport type PathfinderPolicyName =\n (typeof PathfinderPolicyName)[keyof typeof PathfinderPolicyName];\n\n/**\n * The names of the OpenAI routes that we support setting policies for\n * reference: https://platform.openai.com/docs/api-reference/introduction\n */\nexport const OpenAIRouteName = makeEnum({\n ChatCompletion: '/v1/chat/completions',\n Embeddings: '/v1/embeddings',\n Completions: '/v1/completions',\n Agents: '/v1/assistants',\n Agent: '/v1/assistants/:assistantId',\n Threads: '/v1/threads',\n Thread: '/v1/threads/:threadId',\n Messages: '/v1/threads/:threadId/messages',\n Message: '/v1/threads/:threadId/messages/:messageId',\n Runs: '/v1/threads/:threadId/runs',\n Run: '/v1/threads/:threadId/runs/:runId',\n Files: '/v1/files',\n File: '/v1/files/:fileId',\n});\n\n/**\n * Type override\n */\nexport type OpenAIRouteName =\n (typeof OpenAIRouteName)[keyof typeof OpenAIRouteName];\n"],"mappings":"oDAGA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,KAAA,aACD,CAKW,EAAL,SAAA,EAAA,OACL,GAAA,YAAA,oBACD,CAKW,EAAL,SAAA,EAAA,OACL,GAAA,SAAA,WACA,EAAA,KAAA,aACD,CAKW,EAAL,SAAA,EAAA,OACL,GAAA,QAAA,UACA,EAAA,WAAA,eACA,EAAA,UAAA,YACA,EAAA,UAAA,YACA,EAAA,UAAA,YACA,EAAA,UAAA,YACA,EAAA,iBAAA,mBACA,EAAA,qBAAA,uBACA,EAAA,QAAA,UACA,EAAA,aAAA,eACA,EAAA,YAAA,cACA,EAAA,QAAA,UACA,EAAA,eAAA,iBACA,EAAA,WAAA,aACA,EAAA,QAAA,UACA,EAAA,eAAA,iBACA,EAAA,aAAA,eACA,EAAA,OAAA,SACA,EAAA,eAAA,iBACA,EAAA,WAAA,aACA,EAAA,QAAA,UACA,EAAA,eAAA,iBACA,EAAA,mBAAA,qBACA,EAAA,YAAA,cACA,EAAA,sBAAA,wBACA,EAAA,MAAA,QACA,EAAA,eAAA,iBACA,EAAA,SAAA,WACA,EAAA,SAAA,WACA,EAAA,YAAA,cACA,EAAA,oBAAA,sBACA,EAAA,SAAA,WACA,EAAA,gBAAA,wBACD,CAKD,MAAa,EAAuB,EAAS,CAC3C,YAAa,cACb,IAAK,MACL,eAAgB,iBAChB,uBAAwB,yBACzB,CAAC,CAYW,EAAkB,EAAS,CACtC,eAAgB,uBAChB,WAAY,iBACZ,YAAa,kBACb,OAAQ,iBACR,MAAO,8BACP,QAAS,cACT,OAAQ,wBACR,SAAU,iCACV,QAAS,4CACT,KAAM,6BACN,IAAK,oCACL,MAAO,YACP,KAAM,oBACP,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import"./constants-DdeeX81W.mjs";import{t as e}from"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{ui as t}from"./syncConfigurationToTranscend-wWSbGVrI.mjs";import{n}from"./cron-DOicA1l8.mjs";import{t as r}from"./done-input-validation-CcZtaz03.mjs";import i from"colors";import*as a from"io-ts";const o=a.type({"Request Id":a.string});async function s({auth:a,dataSiloId:s,file:c,transcendUrl:l}){r(this.process.exit),e.info(i.magenta(`Reading "${c}" from disk`)),await n({requestIds:t(c,o).map(e=>e[`Request Id`]),transcendUrl:l,auth:a,dataSiloId:s})}export{s as markRequestDataSilosCompleted};
|
|
2
|
+
//# sourceMappingURL=impl--Ov8Om49.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impl--Ov8Om49.mjs","names":[],"sources":["../src/commands/request/system/mark-request-data-silos-completed/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context';\nimport colors from 'colors';\nimport * as t from 'io-ts';\n\nimport { logger } from '../../../../logger';\nimport { markRequestDataSiloIdsCompleted } from '../../../../lib/cron';\nimport { readCsv } from '../../../../lib/requests';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nconst RequestIdRow = t.type({\n 'Request Id': t.string,\n});\n\nexport interface MarkRequestDataSilosCompletedCommandFlags {\n auth: string;\n dataSiloId: string;\n file: string;\n transcendUrl: string;\n}\n\nexport async function markRequestDataSilosCompleted(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n file,\n transcendUrl,\n }: MarkRequestDataSilosCompletedCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const activeResults = readCsv(file, RequestIdRow);\n\n await markRequestDataSiloIdsCompleted({\n requestIds: activeResults.map((request) => request['Request Id']),\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"],"mappings":"iWASA,MAAM,EAAe,EAAE,KAAK,CAC1B,aAAc,EAAE,OACjB,CAAC,CASF,eAAsB,EAEpB,CACE,OACA,aACA,OACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,EAAO,KAAK,EAAO,QAAQ,YAAY,EAAK,aAAa,CAAC,CAG1D,MAAM,EAAgC,CACpC,WAHoB,EAAQ,EAAM,EAAa,CAGrB,IAAK,GAAY,EAAQ,cAAc,CACjE,eACA,OACA,aACD,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import{c as e}from"./constants-DdeeX81W.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import"./codecs-TR6p48v3.mjs";import"./syncConfigurationToTranscend-wWSbGVrI.mjs";import{i as t}from"./api-keys-C7JLTDUZ.mjs";import{t as n}from"./done-input-validation-CcZtaz03.mjs";import{writeFileSync as r}from"node:fs";async function i({email:i,password:a,apiKeyTitle:o,file:s,scopes:c,deleteExistingApiKey:l,createNewApiKey:u,parentOrganizationId:d,transcendUrl:f}){n(this.process.exit);let{errors:p,apiKeys:m}=await t({transcendUrl:f,password:a,email:i,parentOrganizationId:d,deleteExistingApiKey:l,createNewApiKey:u,apiKeyTitle:o,scopes:c.map(t=>e[t].name)});r(s,`${JSON.stringify(m,null,2)}\n`),p.length>0&&this.process.exit(1)}export{i as generateApiKeys};
|
|
2
|
+
//# sourceMappingURL=impl-4BP7gY61.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impl-4BP7gY61.mjs","names":[],"sources":["../src/commands/admin/generate-api-keys/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { writeFileSync } from 'node:fs';\n\nimport { ScopeName } from '@transcend-io/privacy-types';\n\nimport { generateCrossAccountApiKeys } from '../../../lib/api-keys';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\nimport { SCOPES_BY_TITLE } from '../../../constants';\n\n// Command flag interface\nexport interface GenerateApiKeysCommandFlags {\n email: string;\n password: string;\n apiKeyTitle: string;\n file: string;\n scopes: string[];\n deleteExistingApiKey: boolean;\n createNewApiKey: boolean;\n parentOrganizationId?: string;\n transcendUrl: string;\n}\n\n// Command implementation\nexport async function generateApiKeys(\n this: LocalContext,\n {\n email,\n password,\n apiKeyTitle,\n file,\n scopes,\n deleteExistingApiKey,\n createNewApiKey,\n parentOrganizationId,\n transcendUrl,\n }: GenerateApiKeysCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const scopeNames = scopes.map(\n (scopeTitle) => SCOPES_BY_TITLE[scopeTitle].name as ScopeName,\n );\n\n // Upload privacy requests\n const { errors, apiKeys } = await generateCrossAccountApiKeys({\n transcendUrl,\n password,\n email,\n parentOrganizationId,\n deleteExistingApiKey,\n createNewApiKey,\n apiKeyTitle,\n scopes: scopeNames,\n });\n\n // Write to disk\n writeFileSync(file, `${JSON.stringify(apiKeys, null, 2)}\\n`);\n if (errors.length > 0) {\n this.process.exit(1);\n }\n}\n"],"mappings":"qXAuBA,eAAsB,EAEpB,CACE,QACA,WACA,cACA,OACA,SACA,uBACA,kBACA,uBACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAOtC,GAAM,CAAE,SAAQ,WAAY,MAAM,EAA4B,CAC5D,eACA,WACA,QACA,uBACA,uBACA,kBACA,cACA,OAbiB,EAAO,IACvB,GAAe,EAAgB,GAAY,KAC7C,CAYA,CAAC,CAGF,EAAc,EAAM,GAAG,KAAK,UAAU,EAAS,KAAM,EAAE,CAAC,IAAI,CACxD,EAAO,OAAS,GAClB,KAAK,QAAQ,KAAK,EAAE"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import"./constants-DdeeX81W.mjs";import{t as e}from"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import"./codecs-TR6p48v3.mjs";import{a as t,r as n}from"./readTranscendYaml-DhKG1ViI.mjs";import{ai as r,or as i}from"./syncConfigurationToTranscend-wWSbGVrI.mjs";import{n as a}from"./api-keys-C7JLTDUZ.mjs";import{t as o}from"./done-input-validation-CcZtaz03.mjs";import{t as s}from"./dataFlowsToDataSilos-RAhfPV0l.mjs";import{existsSync as c,lstatSync as l}from"node:fs";import{join as u}from"node:path";import d from"colors";async function f({auth:f,dataFlowsYmlFolder:p,dataSilosYmlFolder:m,ignoreYmls:h=[],transcendUrl:g}){o(this.process.exit),(!c(p)||!l(p).isDirectory())&&(e.error(d.red(`Folder does not exist: "${p}"`)),this.process.exit(1)),(!c(m)||!l(m).isDirectory())&&(e.error(d.red(`Folder does not exist: "${m}"`)),this.process.exit(1));let{serviceToTitle:_,serviceToSupportedIntegration:v}=await i(r(g,f));a(p).forEach(r=>{let{"data-flows":i=[]}=n(u(p,r)),{adTechDataSilos:a,siteTechDataSilos:o}=s(i,{serviceToSupportedIntegration:v,serviceToTitle:_}),c=[...a,...o];e.log(`Total Services: ${c.length}`),e.log(`Ad Tech Services: ${a.length}`),e.log(`Site Tech Services: ${o.length}`),t(u(m,r),{"data-silos":h.includes(r)?[]:c})})}export{f as deriveDataSilosFromDataFlows};
|
|
2
|
+
//# sourceMappingURL=impl-B0d5M861.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impl-B0d5M861.mjs","names":[],"sources":["../src/commands/inventory/derive-data-silos-from-data-flows/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport {\n fetchAndIndexCatalogs,\n buildTranscendGraphQLClient,\n} from '../../../lib/graphql';\nimport { join } from 'node:path';\nimport colors from 'colors';\nimport { logger } from '../../../logger';\nimport { dataFlowsToDataSilos } from '../../../lib/consent-manager/dataFlowsToDataSilos';\nimport { DataFlowInput } from '../../../codecs';\nimport { existsSync, lstatSync } from 'node:fs';\nimport { listFiles } from '../../../lib/api-keys';\nimport {\n readTranscendYaml,\n writeTranscendYaml,\n} from '../../../lib/readTranscendYaml';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface DeriveDataSilosFromDataFlowsCommandFlags {\n auth: string;\n dataFlowsYmlFolder: string;\n dataSilosYmlFolder: string;\n ignoreYmls?: string[];\n transcendUrl: string;\n}\n\nexport async function deriveDataSilosFromDataFlows(\n this: LocalContext,\n {\n auth,\n dataFlowsYmlFolder,\n dataSilosYmlFolder,\n ignoreYmls = [],\n transcendUrl,\n }: DeriveDataSilosFromDataFlowsCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Ensure folder is passed\n if (\n !existsSync(dataFlowsYmlFolder) ||\n !lstatSync(dataFlowsYmlFolder).isDirectory()\n ) {\n logger.error(colors.red(`Folder does not exist: \"${dataFlowsYmlFolder}\"`));\n this.process.exit(1);\n }\n\n // Ensure folder is passed\n if (\n !existsSync(dataSilosYmlFolder) ||\n !lstatSync(dataSilosYmlFolder).isDirectory()\n ) {\n logger.error(colors.red(`Folder does not exist: \"${dataSilosYmlFolder}\"`));\n this.process.exit(1);\n }\n\n // Fetch all integrations in the catalog\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const { serviceToTitle, serviceToSupportedIntegration } =\n await fetchAndIndexCatalogs(client);\n\n // List of each data flow yml file\n listFiles(dataFlowsYmlFolder).forEach((directory) => {\n // read in the data flows for a specific instance\n const { 'data-flows': dataFlows = [] } = readTranscendYaml(\n join(dataFlowsYmlFolder, directory),\n );\n\n // map the data flows to data silos\n const { adTechDataSilos, siteTechDataSilos } = dataFlowsToDataSilos(\n dataFlows as DataFlowInput[],\n {\n serviceToSupportedIntegration,\n serviceToTitle,\n },\n );\n\n // combine and write to yml file\n const dataSilos = [...adTechDataSilos, ...siteTechDataSilos];\n logger.log(`Total Services: ${dataSilos.length}`);\n logger.log(`Ad Tech Services: ${adTechDataSilos.length}`);\n logger.log(`Site Tech Services: ${siteTechDataSilos.length}`);\n writeTranscendYaml(join(dataSilosYmlFolder, directory), {\n 'data-silos': ignoreYmls.includes(directory) ? [] : dataSilos,\n });\n });\n}\n"],"mappings":"ikBA0BA,eAAsB,EAEpB,CACE,OACA,qBACA,qBACA,aAAa,EAAE,CACf,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,EAIpC,CAAC,EAAW,EAAmB,EAC/B,CAAC,EAAU,EAAmB,CAAC,aAAa,IAE5C,EAAO,MAAM,EAAO,IAAI,2BAA2B,EAAmB,GAAG,CAAC,CAC1E,KAAK,QAAQ,KAAK,EAAE,GAKpB,CAAC,EAAW,EAAmB,EAC/B,CAAC,EAAU,EAAmB,CAAC,aAAa,IAE5C,EAAO,MAAM,EAAO,IAAI,2BAA2B,EAAmB,GAAG,CAAC,CAC1E,KAAK,QAAQ,KAAK,EAAE,EAKtB,GAAM,CAAE,iBAAgB,iCACtB,MAAM,EAFO,EAA4B,EAAc,EAAK,CAEzB,CAGrC,EAAU,EAAmB,CAAC,QAAS,GAAc,CAEnD,GAAM,CAAE,aAAc,EAAY,EAAE,EAAK,EACvC,EAAK,EAAoB,EAAU,CACpC,CAGK,CAAE,kBAAiB,qBAAsB,EAC7C,EACA,CACE,gCACA,iBACD,CACF,CAGK,EAAY,CAAC,GAAG,EAAiB,GAAG,EAAkB,CAC5D,EAAO,IAAI,mBAAmB,EAAU,SAAS,CACjD,EAAO,IAAI,qBAAqB,EAAgB,SAAS,CACzD,EAAO,IAAI,uBAAuB,EAAkB,SAAS,CAC7D,EAAmB,EAAK,EAAoB,EAAU,CAAE,CACtD,aAAc,EAAW,SAAS,EAAU,CAAG,EAAE,CAAG,EACrD,CAAC,EACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import"./constants-DdeeX81W.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import"./syncConfigurationToTranscend-wWSbGVrI.mjs";import{t as e}from"./manual-enrichment-CYoZNBjO.mjs";import{t}from"./done-input-validation-CcZtaz03.mjs";async function n({auth:n,transcendUrl:r,file:i,enricherId:a,concurrency:o,markSilent:s,sombraAuth:c}){t(this.process.exit),await e({file:i,transcendUrl:r,enricherId:a,concurrency:o,markSilent:s,auth:n,sombraAuth:c})}export{n as pushIdentifiers};
|
|
2
|
+
//# sourceMappingURL=impl-B40z0Aoz2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impl-B40z0Aoz2.mjs","names":[],"sources":["../src/commands/request/preflight/push-identifiers/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context';\nimport { pushManualEnrichmentIdentifiersFromCsv } from '../../../../lib/manual-enrichment';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nexport interface PushIdentifiersCommandFlags {\n auth: string;\n enricherId: string;\n sombraAuth?: string;\n transcendUrl: string;\n file: string;\n markSilent: boolean;\n concurrency: number;\n}\n\nexport async function pushIdentifiers(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n file,\n enricherId,\n concurrency,\n markSilent,\n sombraAuth,\n }: PushIdentifiersCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await pushManualEnrichmentIdentifiersFromCsv({\n file,\n transcendUrl,\n enricherId,\n concurrency,\n markSilent,\n auth,\n sombraAuth,\n });\n}\n"],"mappings":"uSAcA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,aACA,cACA,aACA,cAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAAuC,CAC3C,OACA,eACA,aACA,cACA,aACA,OACA,aACD,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import"./constants-DdeeX81W.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{W as e,pi as t}from"./syncConfigurationToTranscend-wWSbGVrI.mjs";import{t as n}from"./done-input-validation-CcZtaz03.mjs";async function r({auth:r,file:i,transcendUrl:a,cacheFilepath:o,requestReceiptFolder:s,sombraAuth:c,concurrency:l,attributes:u,isTest:d,isSilent:f,skipSendingReceipt:p,emailIsVerified:m,skipFilterStep:h,dryRun:g,debug:_,defaultPhoneCountryCode:v}){n(this.process.exit),await e({cacheFilepath:o,requestReceiptFolder:s,file:i,auth:r,sombraAuth:c,concurrency:l,transcendUrl:a,defaultPhoneCountryCode:v,attributes:t(u),debug:_,skipFilterStep:h,isSilent:f,skipSendingReceipt:p,emailIsVerified:m,isTest:d,dryRun:g})}export{r as upload};
|
|
2
|
+
//# sourceMappingURL=impl-B8CoAX4t.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impl-B8CoAX4t.mjs","names":[],"sources":["../src/commands/request/upload/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport {\n splitCsvToList,\n uploadPrivacyRequestsFromCsv,\n} from '../../../lib/requests';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface UploadCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n cacheFilepath: string;\n requestReceiptFolder: string;\n sombraAuth?: string;\n concurrency: number;\n attributes: string;\n isTest: boolean;\n isSilent: boolean;\n skipSendingReceipt: boolean;\n emailIsVerified: boolean;\n skipFilterStep: boolean;\n dryRun: boolean;\n debug: boolean;\n defaultPhoneCountryCode: string;\n}\n\nexport async function upload(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n cacheFilepath,\n requestReceiptFolder,\n sombraAuth,\n concurrency,\n attributes,\n isTest,\n isSilent,\n skipSendingReceipt,\n emailIsVerified,\n skipFilterStep,\n dryRun,\n debug,\n defaultPhoneCountryCode,\n }: UploadCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await uploadPrivacyRequestsFromCsv({\n cacheFilepath,\n requestReceiptFolder,\n file,\n auth,\n sombraAuth,\n concurrency,\n transcendUrl,\n defaultPhoneCountryCode,\n attributes: splitCsvToList(attributes),\n debug,\n skipFilterStep,\n isSilent,\n skipSendingReceipt,\n emailIsVerified,\n isTest,\n dryRun,\n });\n}\n"],"mappings":"2QA0BA,eAAsB,EAEpB,CACE,OACA,OACA,eACA,gBACA,uBACA,aACA,cACA,aACA,SACA,WACA,qBACA,kBACA,iBACA,SACA,QACA,2BAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAA6B,CACjC,gBACA,uBACA,OACA,OACA,aACA,cACA,eACA,0BACA,WAAY,EAAe,EAAW,CACtC,QACA,iBACA,WACA,qBACA,kBACA,SACA,SACD,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import"./constants-DdeeX81W.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{Y as e}from"./syncConfigurationToTranscend-wWSbGVrI.mjs";import{t}from"./done-input-validation-CcZtaz03.mjs";async function n({auth:n,transcendUrl:r,createdAtBefore:i,createdAtAfter:a,updatedAtBefore:o,updatedAtAfter:s,actions:c,daysLeft:l,days:u,requestIds:d,emailTemplate:f,concurrency:p}){t(this.process.exit),await e({transcendUrl:r,requestActions:c,auth:n,emailTemplate:f,days:u,daysLeft:l,requestIds:d,concurrency:p,createdAtBefore:i,createdAtAfter:a,updatedAtBefore:o,updatedAtAfter:s})}export{n as notifyAdditionalTime};
|
|
2
|
+
//# sourceMappingURL=impl-BDKBhSiG2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impl-BDKBhSiG2.mjs","names":[],"sources":["../src/commands/request/notify-additional-time/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { notifyPrivacyRequestsAdditionalTime } from '../../../lib/requests';\nimport type { RequestAction } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface NotifyAdditionalTimeCommandFlags {\n auth: string;\n createdAtBefore: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n actions?: RequestAction[];\n daysLeft: number;\n days: number;\n requestIds?: string[];\n emailTemplate: string;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function notifyAdditionalTime(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n actions,\n daysLeft,\n days,\n requestIds,\n emailTemplate,\n concurrency,\n }: NotifyAdditionalTimeCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await notifyPrivacyRequestsAdditionalTime({\n transcendUrl,\n requestActions: actions,\n auth,\n emailTemplate,\n days,\n daysLeft,\n requestIds,\n concurrency,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n });\n}\n"],"mappings":"8PAoBA,eAAsB,EAEpB,CACE,OACA,eACA,kBACA,iBACA,kBACA,iBACA,UACA,WACA,OACA,aACA,gBACA,eAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAAoC,CACxC,eACA,eAAgB,EAChB,OACA,gBACA,OACA,WACA,aACA,cACA,kBACA,iBACA,kBACA,iBACD,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import"./constants-DdeeX81W.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{V as e}from"./syncConfigurationToTranscend-wWSbGVrI.mjs";import{t}from"./done-input-validation-CcZtaz03.mjs";async function n({auth:n,transcendUrl:r,enricherIds:i}){t(this.process.exit),await e({transcendUrl:r,auth:n,enricherIds:i})}export{n as skipPreflightJobs};
|
|
2
|
+
//# sourceMappingURL=impl-BEzyqD_12.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impl-BEzyqD_12.mjs","names":["skipPreflightJobsHelper"],"sources":["../src/commands/request/skip-preflight-jobs/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { skipPreflightJobs as skipPreflightJobsHelper } from '../../../lib/requests';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface SkipPreflightJobsCommandFlags {\n auth: string;\n enricherIds: string[];\n transcendUrl: string;\n}\n\nexport async function skipPreflightJobs(\n this: LocalContext,\n { auth, transcendUrl, enricherIds }: SkipPreflightJobsCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await skipPreflightJobsHelper({\n transcendUrl,\n auth,\n enricherIds,\n });\n}\n"],"mappings":"8PAUA,eAAsB,EAEpB,CAAE,OAAM,eAAc,eACP,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAAwB,CAC5B,eACA,OACA,cACD,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import"./constants-DdeeX81W.mjs";import{t as e}from"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{Kr as t,ai as n,l as r,ui as i}from"./syncConfigurationToTranscend-wWSbGVrI.mjs";import{t as a}from"./done-input-validation-CcZtaz03.mjs";import{SombraStandardScope as o}from"@transcend-io/privacy-types";import{existsSync as s}from"node:fs";import c from"colors";import*as l from"io-ts";import u from"cli-progress";async function d({auth:d,file:f,transcendUrl:p,duration:m,subjectType:h,emailColumnName:g,coreIdentifierColumnName:_}){a(this.process.exit),s(f)||(e.error(c.red(`File does not exist: "${f}". Please provide a valid path to a CSV file.`)),this.process.exit(1));try{let a=n(p,d),s=i(f,l.type({[g]:l.string,..._?{[_]:l.string}:{}}));if(!s.length)throw Error(`Input CSV is empty.`);let v=s.map((e,t)=>[e,t]).filter(([e])=>!e[g]?.trim());if(v.length){let e=v.map(([,e])=>e+2).join(`, `);throw Error(`The following rows are missing the required "${g}" column: ${e}`)}if(_){let e=s.map((e,t)=>[e,t]).filter(([e])=>!e[_]?.trim());if(e.length){let t=e.map(([,e])=>e+2).join(`, `);throw Error(`The following rows are missing the required "${_}" column: ${t}`)}}let y=Math.max(1,Math.floor(m/1e3)),b=s.map((e,t)=>{let n=e[g].trim(),r=_?e[_]?.trim():void 0;return{subjectType:h,scopes:[o.PreferenceManagement],expiresIn:y,email:n,...r?{coreIdentifier:r}:{},index:t}}),x=new u.SingleBar({},u.Presets.shades_classic);x.start(b.length,0);let S=Date.now(),C=await t(a,b,e=>{x.update(e)});x.update(b.length),x.stop();let w=C.map(({accessToken:e,input:t})=>{if(typeof t.index!=`number`)throw Error(`Internal error: missing input index.`);return{...s[t.index],token:e}});e.info(c.magenta(`Writing access tokens to file "${f}"...`)),await r(f,w,!0);let T=Math.round((Date.now()-S)/1e3);e.info(c.green(`Successfully generated ${C.length} access tokens to "${f}" in ${T}s!`))}catch(t){e.error(c.red(`An error occurred while generating access tokens: ${t?.message||String(t)}`)),this.process.exit(1)}}export{d as generateAccessTokens};
|
|
2
|
+
//# sourceMappingURL=impl-BI4zCNs0.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impl-BI4zCNs0.mjs","names":[],"sources":["../src/commands/consent/generate-access-tokens/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport * as t from 'io-ts';\nimport colors from 'colors';\nimport { logger } from '../../../logger';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\nimport { existsSync } from 'node:fs';\nimport cliProgress from 'cli-progress';\nimport {\n buildTranscendGraphQLClient,\n createPreferenceAccessTokens,\n type PreferenceAccessTokenInputWithIndex,\n} from '../../../lib/graphql';\nimport { readCsv } from '../../../lib/requests';\nimport { SombraStandardScope } from '@transcend-io/privacy-types';\nimport { writeCsv } from '../../../lib/helpers';\n\n/**\n * CLI flags accepted by the `generate-access-tokens` command.\n *\n * These are passed down from the CLI parser into the parent process.\n */\nexport type GenerateAccessTokenCommandFlags = {\n auth: string;\n file: string;\n duration: number;\n transcendUrl: string;\n subjectType: string;\n emailColumnName: string;\n coreIdentifierColumnName?: string;\n};\n\n/**\n * Take in a CSV of user identifiers and generate access tokens for each user.\n *\n * Expected CSV columns:\n * - [emailColumnName] (required)\n * - [coreIdentifierColumnName] (optional)\n *\n * @param this - Bound CLI context (provides process exit + logging).\n * @param flags - CLI options for the run.\n */\nexport async function generateAccessTokens(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n duration,\n subjectType,\n emailColumnName,\n coreIdentifierColumnName,\n }: GenerateAccessTokenCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n if (!existsSync(file)) {\n logger.error(\n colors.red(\n `File does not exist: \"${file}\". Please provide a valid path to a CSV file.`,\n ),\n );\n this.process.exit(1);\n }\n\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read + parse CSV\n const codec = t.type({\n [emailColumnName]: t.string,\n ...(coreIdentifierColumnName\n ? { [coreIdentifierColumnName]: t.string }\n : {}),\n });\n const rows: Array<Record<string, string>> = readCsv(file, codec);\n if (!rows.length) {\n throw new Error('Input CSV is empty.');\n }\n\n // Ensure emails and core identifiers exist\n const missingEmail = rows\n .map((r, i) => [r, i] as const)\n .filter(([r]) => !r[emailColumnName]?.trim());\n if (missingEmail.length) {\n const rowNumbers = missingEmail\n .map(([, i]) => i + 2) // +2 to account for header row and 0-indexing\n .join(', ');\n throw new Error(\n `The following rows are missing the required \"${emailColumnName}\" column: ${rowNumbers}`,\n );\n }\n if (coreIdentifierColumnName) {\n const missingCoreId = rows\n .map((r, i) => [r, i] as const)\n .filter(([r]) => !r[coreIdentifierColumnName]?.trim());\n if (missingCoreId.length) {\n const rowNumbers = missingCoreId\n .map(([, i]) => i + 2) // +2 to account for header row and 0-indexing\n .join(', ');\n throw new Error(\n `The following rows are missing the required \"${coreIdentifierColumnName}\" column: ${rowNumbers}`,\n );\n }\n }\n\n // Duration provided by CLI is in ms; GraphQL expects seconds\n const expiresInSeconds = Math.max(1, Math.floor(duration / 1000));\n\n // Build inputs for GraphQL\n const inputs = rows.map((r, index): PreferenceAccessTokenInputWithIndex => {\n const email = r[emailColumnName].trim();\n const coreIdentifier = coreIdentifierColumnName\n ? r[coreIdentifierColumnName]?.trim()\n : undefined;\n const scopes = [SombraStandardScope.PreferenceManagement];\n return {\n subjectType,\n scopes,\n expiresIn: expiresInSeconds,\n email,\n ...(coreIdentifier ? { coreIdentifier } : {}),\n index,\n };\n });\n\n // Progress bar\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n progressBar.start(inputs.length, 0);\n\n // Kick off token creation (batched internally)\n const t0 = Date.now();\n const results = await createPreferenceAccessTokens(\n client,\n inputs,\n (progress) => {\n progressBar.update(progress);\n },\n );\n progressBar.update(inputs.length);\n progressBar.stop();\n\n // Prepare output CSV rows\n const outputRows = results.map(({ accessToken, input }) => {\n if (typeof input.index !== 'number') {\n throw new Error('Internal error: missing input index.');\n }\n return {\n ...rows[input.index],\n token: accessToken,\n };\n });\n\n logger.info(colors.magenta(`Writing access tokens to file \"${file}\"...`));\n await writeCsv(file, outputRows, true);\n\n const totalTimeSec = Math.round((Date.now() - t0) / 1000);\n logger.info(\n colors.green(\n `Successfully generated ${results.length} access tokens to \"${file}\" in ${totalTimeSec}s!`,\n ),\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (err: any) {\n logger.error(\n colors.red(\n `An error occurred while generating access tokens: ${\n err?.message || String(err)\n }`,\n ),\n );\n this.process.exit(1);\n }\n}\n"],"mappings":"wdAyCA,eAAsB,EAEpB,CACE,OACA,OACA,eACA,WACA,cACA,kBACA,4BAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CACjC,EAAW,EAAK,GACnB,EAAO,MACL,EAAO,IACL,yBAAyB,EAAK,+CAC/B,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,GAAI,CAEF,IAAM,EAAS,EAA4B,EAAc,EAAK,CASxD,EAAsC,EAAQ,EANtC,EAAE,KAAK,EAClB,GAAkB,EAAE,OACrB,GAAI,EACA,EAAG,GAA2B,EAAE,OAAQ,CACxC,EAAE,CACP,CAAC,CAC8D,CAChE,GAAI,CAAC,EAAK,OACR,MAAU,MAAM,sBAAsB,CAIxC,IAAM,EAAe,EAClB,KAAK,EAAG,IAAM,CAAC,EAAG,EAAE,CAAU,CAC9B,QAAQ,CAAC,KAAO,CAAC,EAAE,IAAkB,MAAM,CAAC,CAC/C,GAAI,EAA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,GAAK,CAEtC,IAAM,EAAe,KAAK,OAAO,KAAK,KAAK,CAAG,GAAM,IAAK,CACzD,EAAO,KACL,EAAO,MACL,0BAA0B,EAAQ,OAAO,qBAAqB,EAAK,OAAO,EAAa,IACxF,CACF,OAEM,EAAU,CACjB,EAAO,MACL,EAAO,IACL,qDACE,GAAK,SAAW,OAAO,EAAI,GAE9B,CACF,CACD,KAAK,QAAQ,KAAK,EAAE"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import"./constants-DdeeX81W.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import"./syncConfigurationToTranscend-wWSbGVrI.mjs";import{r as e}from"./cron-DOicA1l8.mjs";import{t}from"./done-input-validation-CcZtaz03.mjs";async function n({file:n,transcendUrl:r,auth:i,sombraAuth:a,dataSiloId:o}){t(this.process.exit),await e({file:n,transcendUrl:r,auth:i,sombraAuth:a,dataSiloId:o})}export{n as markIdentifiersCompleted};
|
|
2
|
+
//# sourceMappingURL=impl-BJ9Ge6Wf2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impl-BJ9Ge6Wf2.mjs","names":[],"sources":["../src/commands/request/cron/mark-identifiers-completed/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context';\nimport { pushCronIdentifiersFromCsv } from '../../../../lib/cron';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nexport interface MarkIdentifiersCompletedCommandFlags {\n file: string;\n transcendUrl: string;\n auth: string;\n sombraAuth?: string;\n dataSiloId: string;\n}\n\nexport async function markIdentifiersCompleted(\n this: LocalContext,\n {\n file,\n transcendUrl,\n auth,\n sombraAuth,\n dataSiloId,\n }: MarkIdentifiersCompletedCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await pushCronIdentifiersFromCsv({\n file,\n transcendUrl,\n auth,\n sombraAuth,\n dataSiloId,\n });\n}\n"],"mappings":"0RAYA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,aACA,cAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAA2B,CAC/B,OACA,eACA,OACA,aACA,aACD,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import"./constants-DdeeX81W.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{dt as e}from"./syncConfigurationToTranscend-wWSbGVrI.mjs";import{t}from"./done-input-validation-CcZtaz03.mjs";async function n({auth:n,transcendUrl:r,actions:i,statuses:a,requestIds:o,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u,concurrency:d}){t(this.process.exit),await e({transcendUrl:r,requestActions:i,auth:n,requestIds:o,statuses:a,concurrency:d,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u})}export{n as markSilent};
|
|
2
|
+
//# sourceMappingURL=impl-BPz3SpXo2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impl-BPz3SpXo2.mjs","names":[],"sources":["../src/commands/request/mark-silent/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { markSilentPrivacyRequests } from '../../../lib/requests';\nimport type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface MarkSilentCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses?: RequestStatus[];\n requestIds?: string[];\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function markSilent(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n actions,\n statuses,\n requestIds,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n }: MarkSilentCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await markSilentPrivacyRequests({\n transcendUrl,\n requestActions: actions,\n auth,\n requestIds,\n statuses,\n concurrency,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n });\n}\n"],"mappings":"+PAkBA,eAAsB,EAEpB,CACE,OACA,eACA,UACA,WACA,aACA,kBACA,iBACA,kBACA,iBACA,eAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAA0B,CAC9B,eACA,eAAgB,EAChB,OACA,aACA,WACA,cACA,kBACA,iBACA,kBACA,iBACD,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{t as e}from"./logger-Bj782ZYD.mjs";import{t}from"./done-input-validation-CcZtaz03.mjs";import n from"node:fs";import r from"node:path";import i from"colors";import a from"fast-glob";import{spawn as o}from"node:child_process";function s(e,t,r){return new Promise((i,a)=>{let o=n.createReadStream(e),s=Buffer.alloc(0),c=t.length,l=0;o.on(`data`,e=>{let n=e;if(r){let e=r-l;if(e<=0){o.destroy(),i(!1);return}n.length>e&&(n=n.subarray(0,e)),l+=n.length}let a=s.length?Buffer.concat([s,n]):n;if(a.toString(`utf8`).toLowerCase().includes(t.toString(`utf8`))){o.destroy(),i(!0);return}s=c>1?Buffer.from(a.subarray(Math.max(0,a.length-(c-1)))):Buffer.alloc(0)}),o.on(`error`,a),o.on(`close`,()=>i(!1)),o.on(`end`,()=>i(!1))})}async function c(e,t,n){let r=0,i=Array.from({length:Math.min(t,e.length)},async()=>{for(;;){let t=r;if(r+=1,t>=e.length)return;await n(e[t])}});await Promise.all(i)}function l(e,t){return new Promise((n,r)=>{let i=o(e,[`-noheader`,`-batch`,`-cmd`,t],{stdio:[`ignore`,`pipe`,`pipe`]}),a=``,s=``;i.stdout.on(`data`,e=>{a+=String(e)}),i.stderr.on(`data`,e=>{s+=String(e)}),i.on(`error`,r),i.on(`close`,e=>{e===0?n(a):r(Error(`duckdb exited ${e}: ${s}`))})})}async function u(e,t){return(await l(e,[`SELECT column_name`,`FROM parquet_schema('${t.replace(/'/g,`''`)}')`,`WHERE lower(column_type) LIKE '%varchar%'`,` OR lower(column_type) LIKE '%string%';`].join(`
|
|
2
|
+
`))).split(`
|
|
3
|
+
`).map(e=>e.trim()).filter(Boolean)}async function d(e,t,n){let r=await u(e,t);if(r.length===0)return!1;let i=t.replace(/'/g,`''`),a=r.map(e=>`"${e.replace(/"/g,`""`)}" = '${n.replace(/'/g,`''`)}'`).join(` OR `);return(await l(e,[`SELECT 1 AS hit FROM read_parquet('${i}')`,`WHERE ${a}`,`LIMIT 1;`].join(`
|
|
4
|
+
`))).trim().length>0}async function f(n){t(this.process.exit);let{needle:o,root:l,exts:u,noParquet:f,concurrency:p,maxBytes:m}=n,h=r.resolve(l),g=new Set(u.split(`,`).map(e=>e.trim().replace(/^\./,``).toLowerCase()).filter(Boolean)),_=Array.from(g).map(e=>`**/*.${e}`);e.info(i.green(`Searching for "${o}" in ${h} (exts: ${[...g].join(`, `)})`));let v=await a(_,{cwd:h,absolute:!0,onlyFiles:!0,followSymbolicLinks:!1,suppressErrors:!0}),y=Buffer.from(o.toLowerCase(),`utf8`),b=[];if(await c(v,p,async e=>{try{await s(e,y,m)&&(b.push(e),this.process.stdout.write(`${e}\n`))}catch{}}),!f){let t=await a([`**/*.parquet`],{cwd:h,absolute:!0,onlyFiles:!0,followSymbolicLinks:!1,suppressErrors:!0});t.length>0&&(e.info(i.green(`Scanning ${t.length} parquet file(s) via DuckDB...`)),await c(t,Math.max(2,Math.floor(p/4)),async e=>{try{await d(`duckdb`,e,o)&&(b.push(e),this.process.stdout.write(`${e}\n`))}catch{}}))}e.info(i.green(`Done. Found ${b.length} matching file(s).`))}export{f as findTextInFolder};
|
|
5
|
+
//# sourceMappingURL=impl-BYBNi68b.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impl-BYBNi68b.mjs","names":["fg"],"sources":["../src/commands/admin/find-text-in-folder/impl.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { spawn } from 'node:child_process';\nimport fg from 'fast-glob';\nimport colors from 'colors';\nimport type { LocalContext } from '../../../context';\nimport { logger } from '../../../logger';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\n/** CLI flags accepted by the `find-text-in-folder` command. */\nexport type FindTextInFolderCommandFlags = {\n /** The text string to search for */\n needle: string;\n /** Root directory to search */\n root: string;\n /** Comma-separated file extensions */\n exts: string;\n /** Skip parquet file scanning */\n noParquet: boolean;\n /** Max concurrent file scans */\n concurrency: number;\n /** Stop scanning each file after N bytes */\n maxBytes?: number;\n};\n\n/**\n * Streams through a file checking if it contains the needle (case-insensitive).\n *\n * @param filePath - Absolute path to the file to scan\n * @param needle - Lowercased needle as a Buffer\n * @param maxBytes - Optional byte limit per file\n * @returns Whether the file contains the needle\n */\nexport function fileContainsExactBytes(\n filePath: string,\n needle: Buffer,\n maxBytes?: number,\n): Promise<boolean> {\n return new Promise<boolean>((resolve, reject) => {\n const stream = fs.createReadStream(filePath);\n let carry = Buffer.alloc(0);\n const n = needle.length;\n let seen = 0;\n\n stream.on('data', (raw: Buffer) => {\n let chunk = raw;\n\n if (maxBytes) {\n const remaining = maxBytes - seen;\n if (remaining <= 0) {\n stream.destroy();\n resolve(false);\n return;\n }\n if (chunk.length > remaining) {\n chunk = chunk.subarray(0, remaining);\n }\n seen += chunk.length;\n }\n\n const buf = carry.length ? Buffer.concat([carry, chunk]) : chunk;\n const haystack = buf.toString('utf8').toLowerCase();\n if (haystack.includes(needle.toString('utf8'))) {\n stream.destroy();\n resolve(true);\n return;\n }\n\n // Keep last n-1 bytes to catch boundary matches\n if (n > 1) {\n carry = Buffer.from(buf.subarray(Math.max(0, buf.length - (n - 1))));\n } else {\n carry = Buffer.alloc(0);\n }\n });\n\n stream.on('error', reject);\n stream.on('close', () => resolve(false));\n stream.on('end', () => resolve(false));\n });\n}\n\n/**\n * Run async workers over items with bounded concurrency.\n *\n * @param items - Array of items to process\n * @param limit - Maximum concurrent workers\n * @param worker - Async function to run per item\n * @returns Resolves when all items are processed\n */\nasync function runWithConcurrency<T>(\n items: T[],\n limit: number,\n worker: (item: T) => Promise<void>,\n): Promise<void> {\n let idx = 0;\n const runners = Array.from(\n { length: Math.min(limit, items.length) },\n async () => {\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const current = idx;\n idx += 1;\n if (current >= items.length) return;\n await worker(items[current]);\n }\n },\n );\n await Promise.all(runners);\n}\n\n/**\n * Execute a DuckDB query and return stdout.\n *\n * @param duckdbPath - Path to the duckdb binary\n * @param sql - SQL query to execute\n * @returns The stdout output from duckdb\n */\nfunction duckdbQuery(duckdbPath: string, sql: string): Promise<string> {\n return new Promise<string>((resolve, reject) => {\n const child = spawn(duckdbPath, ['-noheader', '-batch', '-cmd', sql], {\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n\n let stdout = '';\n let stderr = '';\n child.stdout.on('data', (d) => {\n stdout += String(d);\n });\n child.stderr.on('data', (d) => {\n stderr += String(d);\n });\n\n child.on('error', reject);\n child.on('close', (code) => {\n if (code === 0) resolve(stdout);\n else reject(new Error(`duckdb exited ${code}: ${stderr}`));\n });\n });\n}\n\n/**\n * Get all VARCHAR/STRING column names from a parquet file.\n *\n * @param duckdbPath - Path to the duckdb binary\n * @param filePath - Absolute path to the parquet file\n * @returns Array of string column names\n */\nasync function duckdbGetParquetStringColumns(\n duckdbPath: string,\n filePath: string,\n): Promise<string[]> {\n const escaped = filePath.replace(/'/g, \"''\");\n const sql = [\n 'SELECT column_name',\n `FROM parquet_schema('${escaped}')`,\n \"WHERE lower(column_type) LIKE '%varchar%'\",\n \" OR lower(column_type) LIKE '%string%';\",\n ].join('\\n');\n\n const out = await duckdbQuery(duckdbPath, sql);\n return out\n .split('\\n')\n .map((l) => l.trim())\n .filter(Boolean);\n}\n\n/**\n * Check if any string column in a parquet file contains the needle value.\n *\n * @param duckdbPath - Path to the duckdb binary\n * @param filePath - Absolute path to the parquet file\n * @param needle - The string to search for (exact equality per column)\n * @returns Whether any row/column matches\n */\nasync function parquetFileHasExactString(\n duckdbPath: string,\n filePath: string,\n needle: string,\n): Promise<boolean> {\n const cols = await duckdbGetParquetStringColumns(duckdbPath, filePath);\n if (cols.length === 0) return false;\n\n const escaped = filePath.replace(/'/g, \"''\");\n const orChain = cols\n .map((c) => `\"${c.replace(/\"/g, '\"\"')}\" = '${needle.replace(/'/g, \"''\")}'`)\n .join(' OR ');\n\n const sql = [\n `SELECT 1 AS hit FROM read_parquet('${escaped}')`,\n `WHERE ${orChain}`,\n 'LIMIT 1;',\n ].join('\\n');\n\n const out = await duckdbQuery(duckdbPath, sql);\n return out.trim().length > 0;\n}\n\n/**\n * Entrypoint for the `admin find-text-in-folder` command.\n *\n * Searches a folder of files for a given text string. Useful for finding\n * a needle in a haystack across many large files (multi-GB CSVs, JSON\n * dumps, log archives). Files are streamed so memory stays flat.\n *\n * @param this - Bound CLI context\n * @param flags - CLI flags for the run\n */\nexport async function findTextInFolder(\n this: LocalContext,\n flags: FindTextInFolderCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const { needle, root, exts, noParquet, concurrency, maxBytes } = flags;\n const rootAbs = path.resolve(root);\n\n const extSet = new Set(\n exts\n .split(',')\n .map((x) => x.trim().replace(/^\\./, '').toLowerCase())\n .filter(Boolean),\n );\n const patterns = Array.from(extSet).map((e) => `**/*.${e}`);\n\n logger.info(\n colors.green(\n `Searching for \"${needle}\" in ${rootAbs} (exts: ${[...extSet].join(\n ', ',\n )})`,\n ),\n );\n\n const normalFiles = await fg(patterns, {\n cwd: rootAbs,\n absolute: true,\n onlyFiles: true,\n followSymbolicLinks: false,\n suppressErrors: true,\n });\n\n const needleBuf = Buffer.from(needle.toLowerCase(), 'utf8');\n const hits: string[] = [];\n\n await runWithConcurrency(normalFiles, concurrency, async (file) => {\n try {\n const ok = await fileContainsExactBytes(file, needleBuf, maxBytes);\n if (ok) {\n hits.push(file);\n this.process.stdout.write(`${file}\\n`);\n }\n } catch {\n // ignore unreadable files\n }\n });\n\n if (!noParquet) {\n const parquetFiles = await fg(['**/*.parquet'], {\n cwd: rootAbs,\n absolute: true,\n onlyFiles: true,\n followSymbolicLinks: false,\n suppressErrors: true,\n });\n\n if (parquetFiles.length > 0) {\n logger.info(\n colors.green(\n `Scanning ${parquetFiles.length} parquet file(s) via DuckDB...`,\n ),\n );\n\n await runWithConcurrency(\n parquetFiles,\n Math.max(2, Math.floor(concurrency / 4)),\n async (file) => {\n try {\n const ok = await parquetFileHasExactString('duckdb', file, needle);\n if (ok) {\n hits.push(file);\n this.process.stdout.write(`${file}\\n`);\n }\n } catch {\n // ignore parquet read issues\n }\n },\n );\n }\n }\n\n logger.info(colors.green(`Done. Found ${hits.length} matching file(s).`));\n}\n"],"mappings":"wOAiCA,SAAgB,EACd,EACA,EACA,EACkB,CAClB,OAAO,IAAI,SAAkB,EAAS,IAAW,CAC/C,IAAM,EAAS,EAAG,iBAAiB,EAAS,CACxC,EAAQ,OAAO,MAAM,EAAE,CACrB,EAAI,EAAO,OACb,EAAO,EAEX,EAAO,GAAG,OAAS,GAAgB,CACjC,IAAI,EAAQ,EAEZ,GAAI,EAAU,CACZ,IAAM,EAAY,EAAW,EAC7B,GAAI,GAAa,EAAG,CAClB,EAAO,SAAS,CAChB,EAAQ,GAAM,CACd,OAEE,EAAM,OAAS,IACjB,EAAQ,EAAM,SAAS,EAAG,EAAU,EAEtC,GAAQ,EAAM,OAGhB,IAAM,EAAM,EAAM,OAAS,OAAO,OAAO,CAAC,EAAO,EAAM,CAAC,CAAG,EAE3D,GADiB,EAAI,SAAS,OAAO,CAAC,aAAa,CACtC,SAAS,EAAO,SAAS,OAAO,CAAC,CAAE,CAC9C,EAAO,SAAS,CAChB,EAAQ,GAAK,CACb,OAIF,AAGE,EAHE,EAAI,EACE,OAAO,KAAK,EAAI,SAAS,KAAK,IAAI,EAAG,EAAI,QAAU,EAAI,GAAG,CAAC,CAAC,CAE5D,OA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,GACV,UAAW,GACX,oBAAqB,GACrB,eAAgB,GACjB,CAAC,CAEE,EAAa,OAAS,IACxB,EAAO,KACL,EAAO,MACL,YAAY,EAAa,OAAO,gCACjC,CACF,CAED,MAAM,EACJ,EACA,KAAK,IAAI,EAAG,KAAK,MAAM,EAAc,EAAE,CAAC,CACxC,KAAO,IAAS,CACd,GAAI,CACS,MAAM,EAA0B,SAAU,EAAM,EAAO,GAEhE,EAAK,KAAK,EAAK,CACf,KAAK,QAAQ,OAAO,MAAM,GAAG,EAAK,IAAI,OAElC,IAIX,EAIL,EAAO,KAAK,EAAO,MAAM,eAAe,EAAK,OAAO,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import"./constants-DdeeX81W.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{P as e}from"./syncConfigurationToTranscend-wWSbGVrI.mjs";import{t}from"./done-input-validation-CcZtaz03.mjs";async function n({auth:n,transcendUrl:r,identifierNames:i,actions:a=[]}){t(this.process.exit),await e({requestActions:a,transcendUrl:r,auth:n,identifierNames:i})}export{n as rejectUnverifiedIdentifiers};
|
|
2
|
+
//# sourceMappingURL=impl-Bh04BLeU2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impl-Bh04BLeU2.mjs","names":[],"sources":["../src/commands/request/reject-unverified-identifiers/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { removeUnverifiedRequestIdentifiers } from '../../../lib/requests';\nimport type { RequestAction } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface RejectUnverifiedIdentifiersCommandFlags {\n auth: string;\n identifierNames: string[];\n actions?: RequestAction[];\n transcendUrl: string;\n}\n\nexport async function rejectUnverifiedIdentifiers(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n identifierNames,\n actions = [],\n }: RejectUnverifiedIdentifiersCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await removeUnverifiedRequestIdentifiers({\n requestActions: actions,\n transcendUrl,\n auth,\n identifierNames,\n });\n}\n"],"mappings":"8PAYA,eAAsB,EAEpB,CACE,OACA,eACA,kBACA,UAAU,EAAE,EAEC,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAAmC,CACvC,eAAgB,EAChB,eACA,OACA,kBACD,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import"./constants-DdeeX81W.mjs";import{t as e}from"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{I as t}from"./syncConfigurationToTranscend-wWSbGVrI.mjs";import{t as n}from"./done-input-validation-CcZtaz03.mjs";import r from"colors";async function i({auth:i,transcendUrl:a,file:o,pageLimit:s,concurrency:c,actions:l,sombraAuth:u,skipRequestIdentifiers:d,statuses:f,createdAtBefore:p,createdAtAfter:m,updatedAtBefore:h,updatedAtAfter:g,showTests:_}){n(this.process.exit);let{filePaths:v,totalCount:y}=await t({transcendUrl:a,concurrency:c,pageLimit:s,actions:l,statuses:f,auth:i,sombraAuth:u,skipRequestIdentifiers:d,createdAtBefore:p,createdAtAfter:m,updatedAtBefore:h,updatedAtAfter:g,isTest:_,file:o});e.info(r.green(`Successfully wrote ${y} requests to ${v.length} file(s): ${v.join(`, `)}`))}export{i as _export};
|
|
2
|
+
//# sourceMappingURL=impl-BhMd6_J22.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impl-BhMd6_J22.mjs","names":[],"sources":["../src/commands/request/export/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport colors from 'colors';\n\nimport { logger } from '../../../logger';\nimport { streamPrivacyRequestsToCsv } from '../../../lib/requests';\nimport type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface ExportCommandFlags {\n auth: string;\n sombraAuth?: string;\n actions?: RequestAction[];\n statuses?: RequestStatus[];\n transcendUrl: string;\n file: string;\n concurrency: number;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n showTests?: boolean;\n skipRequestIdentifiers?: boolean;\n pageLimit: number;\n}\n\n// `export` is a reserved keyword, so we need to prefix it with an underscore\n// eslint-disable-next-line no-underscore-dangle\nexport async function _export(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n file,\n pageLimit,\n concurrency,\n actions,\n sombraAuth,\n skipRequestIdentifiers,\n statuses,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n showTests,\n }: ExportCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const { filePaths, totalCount } = await streamPrivacyRequestsToCsv({\n transcendUrl,\n concurrency,\n pageLimit,\n actions,\n statuses,\n auth,\n sombraAuth,\n skipRequestIdentifiers,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isTest: showTests,\n file,\n });\n\n logger.info(\n colors.green(\n `Successfully wrote ${totalCount} requests to ` +\n `${filePaths.length} file(s): ${filePaths.join(', ')}`,\n ),\n );\n}\n"],"mappings":"qSA2BA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,YACA,cACA,UACA,aACA,yBACA,WACA,kBACA,iBACA,kBACA,iBACA,aAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAM,CAAE,YAAW,cAAe,MAAM,EAA2B,CACjE,eACA,cACA,YACA,UACA,WACA,OACA,aACA,yBACA,kBACA,iBACA,kBACA,iBACA,OAAQ,EACR,OACD,CAAC,CAEF,EAAO,KACL,EAAO,MACL,sBAAsB,EAAW,eAC5B,EAAU,OAAO,YAAY,EAAU,KAAK,KAAK,GACvD,CACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import{r as e}from"./constants-DdeeX81W.mjs";import{t}from"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import"./codecs-TR6p48v3.mjs";import{r as n}from"./readTranscendYaml-DhKG1ViI.mjs";import{A as r,ai as i,js as a,t as o}from"./syncConfigurationToTranscend-wWSbGVrI.mjs";import{t as s}from"./mergeTranscendInputs-Coj_e2N3.mjs";import{n as c,r as l}from"./api-keys-C7JLTDUZ.mjs";import{t as u}from"./done-input-validation-CcZtaz03.mjs";import{existsSync as d,lstatSync as f}from"node:fs";import{join as p}from"node:path";import m from"colors";async function h({transcendUrl:e,auth:n,pageSize:r,publishToPrivacyCenter:a,contents:s,deleteExtraAttributeValues:c=!1,classifyService:l=!1}){let u=i(e,n);try{return!await o(s,u,{pageSize:r,publishToPrivacyCenter:a,classifyService:l,deleteExtraAttributeValues:c})}catch(e){return t.error(m.red(`An unexpected error occurred syncing the schema: ${e.message}`)),!1}}async function g({file:i=`./transcend.yml`,transcendUrl:o,auth:g,variables:_,pageSize:v,publishToPrivacyCenter:y,classifyService:b,deleteExtraAttributeValues:x}){u(this.process.exit);let S=await l(g),C=r(_),w;if(w=Array.isArray(S)&&f(i).isDirectory()?c(i).map(e=>p(i,e)):i.split(`,`),w.length<1)throw Error(`No file specified!`);let T=w.map(e=>{d(e)?t.info(m.magenta(`Reading file "${e}"...`)):(t.error(m.red(`The file path does not exist on disk: ${e}. You can specify the filepath using --file=./examples/transcend.yml`)),this.process.exit(1));try{let r=n(e,C);return t.info(m.green(`Successfully read in "${e}"`)),{content:r,name:e.split(`/`).pop().replace(`.yml`,``)}}catch(e){t.error(m.red(`The shape of your yaml file is invalid with the following errors: ${e.message}`)),this.process.exit(1)}});if(typeof S==`string`){let[n,...r]=T.map(({content:e})=>e);await h({transcendUrl:o,auth:S,contents:s(n,...r),publishToPrivacyCenter:y,deleteExtraAttributeValues:x,pageSize:v,classifyService:!!b})||(t.info(m.red(`Sync encountered errors. View output above for more information, or check out ${e}`)),this.process.exit(1))}else{if(T.length!==1&&T.length!==S.length)throw Error(`Expected list of yml files to be equal to the list of API keys.Got ${T.length} YML file${T.length===1?``:`s`} and ${S.length} API key${S.length===1?``:`s`}`);let n=[];await a(S,async(e,r)=>{let i=`[${r+1}/${S.length}][${e.organizationName}] `;t.info(m.magenta(`~~~\n\n${i}Attempting to push configuration...\n\n~~~`));let a=T.length===1?T[0].content:T.find(t=>t.name===e.organizationName)?.content;if(!a){t.error(m.red(`${i}Failed to find transcend.yml file for organization: "${e.organizationName}".`)),n.push(e.organizationName);return}await h({transcendUrl:o,auth:e.apiKey,contents:a,pageSize:v,publishToPrivacyCenter:y,deleteExtraAttributeValues:x,classifyService:b})?t.info(m.green(`${i}Successfully pushed configuration!`)):(t.error(m.red(`${i}Failed to sync configuration.`)),n.push(e.organizationName))}),n.length>0&&(t.info(m.red(`Sync encountered errors for "${n.join(`,`)}". View output above for more information, or check out ${e}`)),this.process.exit(1))}t.info(m.green(`Successfully synced yaml file to Transcend! View at ${e}`))}export{g as push};
|
|
2
|
+
//# sourceMappingURL=impl-BiWrlucD.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impl-BiWrlucD.mjs","names":[],"sources":["../src/commands/inventory/push/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\n\nimport { logger } from '../../../logger';\nimport { mapSeries } from '../../../lib/bluebird';\nimport { existsSync, lstatSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { readTranscendYaml } from '../../../lib/readTranscendYaml';\nimport colors from 'colors';\nimport {\n buildTranscendGraphQLClient,\n syncConfigurationToTranscend,\n} from '../../../lib/graphql';\n\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants';\nimport { TranscendInput } from '../../../codecs';\nimport { validateTranscendAuth, listFiles } from '../../../lib/api-keys';\nimport { mergeTranscendInputs } from '../../../lib/mergeTranscendInputs';\nimport { parseVariablesFromString } from '../../../lib/helpers/parseVariablesFromString';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\n/**\n * Sync configuration to Transcend\n *\n * @param options - Options\n * @returns True if synced successfully, false if error occurs\n */\nasync function syncConfiguration({\n transcendUrl,\n auth,\n pageSize,\n publishToPrivacyCenter,\n contents,\n deleteExtraAttributeValues = false,\n classifyService = false,\n}: {\n /** Transcend YAML */\n contents: TranscendInput;\n /** Transcend URL */\n transcendUrl: string;\n /** API key */\n auth: string;\n /** Page size */\n pageSize: number;\n /** Skip privacy center publish step */\n publishToPrivacyCenter: boolean;\n /** classify data flow service if missing */\n classifyService?: boolean;\n /** Delete attributes when syncing */\n deleteExtraAttributeValues?: boolean;\n}): Promise<boolean> {\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Sync to Transcend\n try {\n const encounteredError = await syncConfigurationToTranscend(\n contents,\n client,\n {\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n },\n );\n return !encounteredError;\n } catch (err) {\n logger.error(\n colors.red(\n `An unexpected error occurred syncing the schema: ${err.message}`,\n ),\n );\n return false;\n }\n}\n\nexport interface PushCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n pageSize: number;\n variables: string;\n publishToPrivacyCenter: boolean;\n classifyService: boolean;\n deleteExtraAttributeValues: boolean;\n}\n\nexport async function push(\n this: LocalContext,\n {\n file = './transcend.yml',\n transcendUrl,\n auth,\n variables,\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n }: PushCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Parse out the variables\n const vars = parseVariablesFromString(variables);\n\n // check if we are being passed a list of API keys and a list of files\n let fileList: string[];\n if (Array.isArray(apiKeyOrList) && lstatSync(file).isDirectory()) {\n fileList = listFiles(file).map((filePath) => join(file, filePath));\n } else {\n fileList = file.split(',');\n }\n\n // Ensure at least one file is parsed\n if (fileList.length < 1) {\n throw new Error('No file specified!');\n }\n\n // eslint-disable-next-line array-callback-return,consistent-return\n const transcendInputs = fileList.map((filePath) => {\n // Ensure yaml file exists on disk\n if (!existsSync(filePath)) {\n logger.error(\n colors.red(\n `The file path does not exist on disk: ${filePath}. You can specify the filepath using --file=./examples/transcend.yml`,\n ),\n );\n this.process.exit(1);\n } else {\n logger.info(colors.magenta(`Reading file \"${filePath}\"...`));\n }\n\n try {\n // Read in the yaml file and validate it's shape\n const newContents = readTranscendYaml(filePath, vars);\n logger.info(colors.green(`Successfully read in \"${filePath}\"`));\n return {\n content: newContents,\n name: filePath.split('/').pop()!.replace('.yml', ''),\n };\n } catch (err) {\n logger.error(\n colors.red(\n `The shape of your yaml file is invalid with the following errors: ${err.message}`,\n ),\n );\n this.process.exit(1);\n }\n });\n\n // process a single API key\n if (typeof apiKeyOrList === 'string') {\n // if passed multiple inputs, merge them together\n const [base, ...rest] = transcendInputs.map(({ content }) => content);\n const contents = mergeTranscendInputs(base, ...rest);\n\n // sync the configuration\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKeyOrList,\n contents,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n pageSize,\n classifyService: !!classifyService,\n });\n\n // exist with error code\n if (!success) {\n logger.info(\n colors.red(\n `Sync encountered errors. View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n } else {\n // if passed multiple inputs, expect them to be one per instance\n if (\n transcendInputs.length !== 1 &&\n transcendInputs.length !== apiKeyOrList.length\n ) {\n throw new Error(\n 'Expected list of yml files to be equal to the list of API keys.' +\n `Got ${transcendInputs.length} YML file${\n transcendInputs.length === 1 ? '' : 's'\n } and ${apiKeyOrList.length} API key${\n apiKeyOrList.length === 1 ? '' : 's'\n }`,\n );\n }\n\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${\n apiKey.organizationName\n }] `;\n logger.info(\n colors.magenta(\n `~~~\\n\\n${prefix}Attempting to push configuration...\\n\\n~~~`,\n ),\n );\n\n // use the merged contents if 1 yml passed, else use the contents that map to that organization\n const useContents =\n transcendInputs.length === 1\n ? transcendInputs[0].content\n : transcendInputs.find(\n (input) => input.name === apiKey.organizationName,\n )?.content;\n\n // Throw error if cannot find a yml file matching that organization name\n if (!useContents) {\n logger.error(\n colors.red(\n `${prefix}Failed to find transcend.yml file for organization: \"${apiKey.organizationName}\".`,\n ),\n );\n encounteredErrors.push(apiKey.organizationName);\n return;\n }\n\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKey.apiKey,\n contents: useContents,\n pageSize,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n classifyService,\n });\n\n if (success) {\n logger.info(\n colors.green(`${prefix}Successfully pushed configuration!`),\n );\n } else {\n logger.error(colors.red(`${prefix}Failed to sync configuration.`));\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n logger.info(\n colors.red(\n `Sync encountered errors for \"${encounteredErrors.join(\n ',',\n )}\". View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced yaml file to Transcend! View at ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n}\n"],"mappings":"slBA0BA,eAAe,EAAkB,CAC/B,eACA,OACA,WACA,yBACA,WACA,6BAA6B,GAC7B,kBAAkB,IAgBC,CACnB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAG9D,GAAI,CAWF,MAAO,CAVkB,MAAM,EAC7B,EACA,EACA,CACE,WACA,yBACA,kBACA,6BACD,CACF,OAEM,EAAK,CAMZ,OALA,EAAO,MACL,EAAO,IACL,oDAAoD,EAAI,UACzD,CACF,CACM,IAeX,eAAsB,EAEpB,CACE,OAAO,kBACP,eACA,OACA,YACA,WACA,yBACA,kBACA,8BAEa,CACf,EAAoB,KAAK,Q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ACrC,OAAO,EAAa,OAAO,UAC1B,EAAa,SAAW,EAAI,GAAK,MAEtC,CAGH,IAAM,EAA8B,EAAE,CACtC,MAAM,EAAU,EAAc,MAAO,EAAQ,IAAQ,CACnD,IAAM,EAAS,IAAI,EAAM,EAAE,GAAG,EAAa,OAAO,IAChD,EAAO,iBACR,IACD,EAAO,KACL,EAAO,QACL,UAAU,EAAO,4CAClB,CACF,CAGD,IAAM,EACJ,EAAgB,SAAW,EACvB,EAAgB,GAAG,QACnB,EAAgB,KACb,GAAU,EAAM,OAAS,EAAO,iBAClC,EAAE,QAGT,GAAI,CAAC,EAAa,CAChB,EAAO,MACL,EAAO,IACL,GAAG,EAAO,uDAAuD,EAAO,iBAAiB,IAC1F,CACF,CACD,EAAkB,KAAK,EAAO,iBAAiB,CAC/C,OAGc,MAAM,EAAkB,CACtC,eACA,KAAM,EAAO,OACb,SAAU,EACV,WACA,yBACA,6BACA,kBACD,CAAC,CAGA,EAAO,KACL,EAAO,MAAM,GAAG,EAAO,oCAAoC,CAC5D,EAED,EAAO,MAAM,EAAO,IAAI,GAAG,EAAO,+BAA+B,CAAC,CAClE,EAAkB,KAAK,EAAO,iBAAiB,GAEjD,CAEE,EAAkB,OAAS,IAC7B,EAAO,KACL,EAAO,IACL,gCAAgC,EAAkB,KAChD,IACD,CAAC,0DAA0D,IAC7D,CACF,CAED,KAAK,QAAQ,KAAK,EAAE,EAKxB,EAAO,KACL,EAAO,MACL,uDAAuD,IACxD,CACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./enums-CyFTrzXY.mjs";import"./constants-DdeeX81W.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{F as e}from"./syncConfigurationToTranscend-wWSbGVrI.mjs";import{t}from"./done-input-validation-CcZtaz03.mjs";async function n({auth:n,dataSiloId:r,status:i,statuses:a,transcendUrl:o}){t(this.process.exit),await e({transcendUrl:o,auth:n,status:i,dataSiloId:r,requestStatuses:a})}export{n as skipRequestDataSilos};
|
|
2
|
+
//# sourceMappingURL=impl-BpMKYqSR.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-BpMKYqSR.mjs","names":["skipRequestDataSilosHelper"],"sources":["../src/commands/request/system/skip-request-data-silos/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context';\nimport type {\n RequestDataSiloStatus,\n RequestStatus,\n} from '@transcend-io/privacy-types';\nimport { skipRequestDataSilos as skipRequestDataSilosHelper } from '../../../../lib/requests';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nexport interface SkipRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n transcendUrl: string;\n statuses: RequestStatus[];\n status:\n | (typeof RequestDataSiloStatus)['Skipped']\n | (typeof RequestDataSiloStatus)['Resolved'];\n}\n\nexport async function skipRequestDataSilos(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n status,\n statuses,\n transcendUrl,\n }: SkipRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await skipRequestDataSilosHelper({\n transcendUrl,\n auth,\n status,\n dataSiloId,\n requestStatuses: statuses,\n });\n}\n"],"mappings":"8PAkBA,eAAsB,EAEpB,CACE,OACA,aACA,SACA,WACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAA2B,CAC/B,eACA,OACA,SACA,aACA,gBAAiB,EAClB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{n as e,r as t,t as n}from"./enums-CyFTrzXY.mjs";import"./constants-DdeeX81W.mjs";import{t as r}from"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{As as i,ai as a,i as o,js as s,wo as c}from"./syncConfigurationToTranscend-wWSbGVrI.mjs";import{t as l}from"./done-input-validation-CcZtaz03.mjs";import{OneTrustEnrichedAssessment as u,OneTrustGetAssessmentResponse as d,OneTrustGetListOfAssessmentsResponse as f,OneTrustGetRiskResponse as p,OneTrustGetUserResponse as m}from"@transcend-io/privacy-types";import{keyBy as h,uniq as g}from"lodash-es";import{decodeCodec as _}from"@transcend-io/type-utils";import v,{createReadStream as y}from"node:fs";import b from"colors";import"yargs-parser";import x from"got";import S from"JSONStream";const C=({hostname:e,auth:t})=>x.extend({prefixUrl:`https://${e}`,headers:{accept:`application/json`,"content-type":`application/json`,authorization:`Bearer ${t}`}});Object.values(e);const w=({assessment:e,index:t,total:n,wrap:r=!0})=>{let i=``;(t===0||r)&&(i=`[
|
|
2
|
+
`);let a=JSON.stringify(e),o=n&&t<n-1&&!r?`,`:``;return i=`${i+a+o}\n`,(n&&t===n-1||r)&&(i+=`
|
|
3
|
+
]`),i},T=({file:e,assessment:t,index:n,total:i})=>{r.info(b.magenta(`Writing enriched assessment ${n+1} of ${i} to file "${e}"...`)),n===0?v.writeFileSync(e,w({assessment:t,index:n,total:i,wrap:!1})):v.appendFileSync(e,w({assessment:t,index:n,total:i,wrap:!1}))},E=async({oneTrust:e})=>{let t=0,n=1,i=0,a=[];for(;t<n;){let{body:o}=await e.get(`api/assessment/v2/assessments?page=${t}&size=2000`),{page:s,content:c}=_(f,o);a.push(...c??[]),t===0&&(n=s?.totalPages??0,i=s?.totalElements??0),t+=1,r.info(`Fetched ${a.length} of ${i} assessments.`)}return a},D=async({oneTrust:e,assessmentId:t})=>{let{body:n}=await e.get(`api/assessment/v2/assessments/${t}/export?ExcludeSkippedQuestions=false`);return _(d,n)},O=async({oneTrust:e,riskId:t})=>{let{body:n}=await e.get(`api/risk/v2/risks/${t}`);return _(p,n)},k=async({oneTrust:e,userId:t})=>{let{body:n}=await e.get(`api/scim/v2/Users/${t}`);return _(m,n)},A=({assessment:e,assessmentDetails:t,riskDetails:n,creatorDetails:r,approversDetails:i,respondentsDetails:a})=>{let o=h(n,`id`),{sections:s,createdBy:c,...l}=t,u=s.map(e=>{let{questions:t,...n}=e,r=t.map(e=>{let{risks:t,...n}=e,r=(t??[]).map(e=>{let t=o[e.riskId];return{...e,...t,level:e.level,impactLevel:e.impactLevel??0}});return{...n,risks:r}});return{...n,questions:r}}),d={...c,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},f=h(i,`id`),p=t.approvers.flatMap(e=>f[e.id]?[{...e,approver:{...e.approver,active:f[e.id].active,userType:f[e.id].userType,emails:f[e.id].emails,title:f[e.id].title,givenName:f[e.id].name.givenName??null,familyName:f[e.id].name.familyName??null}}]:[]),m=h(a,`id`),g=t.respondents.filter(e=>!e.name.includes(`@`)).flatMap(e=>m[e.id]?[{...e,active:m[e.id].active,userType:m[e.id].userType,emails:m[e.id].emails,title:m[e.id].title,givenName:m[e.id].name.givenName??null,familyName:m[e.id].name.familyName??null}]:[]);return{...e,...l,approvers:p,respondents:g,createdBy:d,sections:u}},j=async({transcend:e,assessment:t,total:n,index:i})=>{r.info(b.magenta(`Writing enriched assessment ${i+1} ${n?`of ${n} `:` `}to Transcend...`));let a={json:w({assessment:t,index:i,total:n})};try{await o(e,c,{input:a})}catch{r.error(b.red(`Failed to sync assessment ${i+1} ${n?`of ${n} `:` `}to Transcend.\n\tAssessment Title: ${t.name}. Template Title: ${t.template.name}\n`))}},M=async({oneTrust:e,file:t,dryRun:n,transcend:a})=>{r.info(`Getting list of all assessments from OneTrust...`);let o=await E({oneTrust:e}),c={};await s(Array.from({length:Math.ceil(o.length/5)},(e,t)=>o.slice(t*5,(t+1)*5)),async(l,u)=>{let d=[];await i(l,async(t,n)=>{let a=5*u+n+1;r.info(`[assessment ${a} of ${o.length}]: fetching details...`);let{templateName:s,assessmentId:l}=t,f=await D({oneTrust:e,assessmentId:l}),p=f.createdBy.id,m=c[p];if(!m){r.info(`[assessment ${a} of ${o.length}]: fetching creator...`);try{m=await k({oneTrust:e,userId:p}),c[p]=m}catch{r.warn(b.yellow(`[assessment ${a} of ${o.length}]: failed to fetch form creator.\tcreatorId: ${p}. Assessment Title: ${t.name}. Template Title: ${s}`))}}let{approvers:h}=f,_=[];h.length>0&&(r.info(`[assessment ${a} of ${o.length}]: fetching approvers...`),_=await i(h.map(({id:e})=>e),async n=>{try{let t=c[n];return t||(t=await k({oneTrust:e,userId:n}),c[n]=t),[t]}catch{return r.warn(b.yellow(`[assessment ${a} of ${o.length}]: failed to fetch a form approver.\tapproverId: ${n}. Assessment Title: ${t.name}. Template Title: ${s}`)),[]}},{concurrency:5}));let{respondents:v}=f,y=v.filter(e=>!e.name.includes(`@`)),x=[];y.length>0&&(r.info(`[assessment ${a} of ${o.length}]: fetching respondents...`),x=await i(y.map(({id:e})=>e),async n=>{try{let t=c[n];return t||(t=await k({oneTrust:e,userId:n}),c[n]=t),[t]}catch{return r.warn(b.yellow(`[assessment ${a} of ${o.length}]: failed to fetch a respondent.\trespondentId: ${n}. Assessment Title: ${t.name}. Template Title: ${s}`)),[]}},{concurrency:5}));let S=[],C=g(f.sections.flatMap(e=>e.questions.flatMap(e=>(e.risks??[]).flatMap(e=>e.riskId))));C.length>0&&(r.info(`[assessment ${a} of ${o.length}]: fetching risks...`),S=await i(C,t=>O({oneTrust:e,riskId:t}),{concurrency:5}));let w=A({assessment:t,assessmentDetails:f,riskDetails:S,creatorDetails:m,approversDetails:_.flat(),respondentsDetails:x.flat()});d.push(w)},{concurrency:5}),await s(d,async(e,r)=>{let i=u*5+r;n&&t?T({assessment:e,index:i,total:o.length,file:t}):a&&await j({assessment:e,transcend:a,total:o.length,index:i})})})},N=({transcend:e,file:t})=>(r.info(`Getting list of all assessments from file ${t}...`),new Promise((n,i)=>{let a=y(t,{encoding:`utf-8`,highWaterMark:64*1024}),o=S.parse(`*`),s=0;a.pipe(o),o.on(`data`,async n=>{try{o.pause(),await j({assessment:_(u,n),transcend:e,index:s}),s+=1,o.resume()}catch(e){r.error(b.red(`Failed to parse the assessment ${s} from file '${t}': ${e.message}.`))}}),o.on(`end`,()=>{r.info(`Finished processing ${s} assessments from file ${t}`),n()}),o.on(`error`,e=>{r.error(b.red(`Error parsing file '${t}': ${e.message}`)),i(e)}),a.on(`error`,e=>{r.error(b.red(`Error reading file '${t}': ${e.message}`)),i(e)})}));async function P({hostname:i,oneTrustAuth:o,source:s,transcendAuth:c,transcendUrl:u,resource:d,file:f,dryRun:p,debug:m}){if(!p&&!c)throw Error('Must specify a "transcendAuth" parameter to sync resources to Transcend. e.g. --transcendAuth=${TRANSCEND_API_KEY}');if(p&&!f)throw Error(`Must set a "file" parameter when "dryRun" is "true". e.g. --file=./oneTrustAssessments.json`);if(f){let e=f.split(`.`);if(e.length<2)throw Error(`The "file" parameter has an invalid format. Expected a path with extensions. e.g. --file=./pathToFile.json.`);if(e.at(-1)!==n.Json)throw Error(`Expected the format of the "file" parameters '${f}' to be '${n.Json}', but got '${e.at(-1)}'.`)}if(s===t.OneTrust){if(!i)throw Error(`Missing required parameter "hostname". e.g. --hostname=customer.my.onetrust.com`);if(!o)throw Error(`Missing required parameter "oneTrustAuth". e.g. --oneTrustAuth=$ONE_TRUST_AUTH_TOKEN`)}else{if(!f)throw Error(`Must specify a "file" parameter to read the OneTrust assessments from. e.g. --source=./oneTrustAssessments.json`);if(p)throw Error(`Cannot read and write to a file simultaneously. Emit the "source" parameter or set it to ${t.OneTrust} if "dryRun" is enabled.`)}l(this.process.exit);let h=i&&o?C({hostname:i,auth:o}):void 0,g=u&&c?a(u,c):void 0;try{d===e.Assessments&&(s===t.OneTrust&&h?await M({oneTrust:h,file:f,dryRun:p,...g&&{transcend:g}}):s===t.File&&f&&g&&await N({file:f,transcend:g}))}catch(e){throw Error(`An error occurred syncing the resource ${d} from OneTrust: ${m?e.stack:e.message}`)}r.info(b.green(`Successfully synced OneTrust ${d} to ${p?`disk at "${f}"`:`Transcend`}!`))}export{P as syncOt};
|
|
4
|
+
//# sourceMappingURL=impl-BraVBCrF2.mjs.map
|