@transcend-io/cli 7.0.0-alpha.11 → 7.0.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/dist/bin/bash-complete.js +1 -1
  2. package/dist/bin/cli.js +1 -1
  3. package/dist/bin/deprecated-command.js +1 -1
  4. package/dist/{chunk-6WKTY4YQ.js → chunk-24SSWBXM.js} +2 -2
  5. package/dist/{chunk-HGLIJXXG.js → chunk-6P4FW6XR.js} +2 -2
  6. package/dist/{chunk-UUBO75GS.js → chunk-7QHA6ZIV.js} +2 -2
  7. package/dist/{chunk-AB4DHWRB.js → chunk-HH2PQ3PQ.js} +2 -2
  8. package/dist/{chunk-GD7WEHDA.js → chunk-INLBXSQE.js} +2 -2
  9. package/dist/{chunk-GSXHJEKW.js → chunk-KRN6Q433.js} +2 -2
  10. package/dist/{chunk-R6QTIUFA.js → chunk-MVDOKJ6J.js} +2 -2
  11. package/dist/chunk-SF46ZLPT.js +2 -0
  12. package/dist/chunk-SF46ZLPT.js.map +1 -0
  13. package/dist/{chunk-WEQUQAB7.js → chunk-TDBKATQK.js} +2 -2
  14. package/dist/{chunk-FSJPJZNH.js → chunk-WSDWILYI.js} +2 -2
  15. package/dist/{chunk-UK7OFHQR.js → chunk-XNR74SBS.js} +2 -2
  16. package/dist/{chunk-JXPGBZXN.js → chunk-ZLRUIEVQ.js} +16 -16
  17. package/dist/{chunk-TR32ZRNC.js → chunk-ZTD7APNF.js} +2 -2
  18. package/dist/impl-25VWUB6L.js +2 -0
  19. package/dist/{impl-42N5BEEM.js → impl-3M5R6G5M.js} +2 -2
  20. package/dist/impl-5OEPVWPL.js +2 -0
  21. package/dist/{impl-N3R63BI4.js → impl-AFRHPZGF.js} +2 -2
  22. package/dist/{impl-VDNSV4OU.js → impl-CCUCFOCW.js} +2 -2
  23. package/dist/{impl-IAKEYWMV.js → impl-E36SWF4Z.js} +2 -2
  24. package/dist/{impl-TOLP53IM.js → impl-E5WXNV47.js} +2 -2
  25. package/dist/{impl-KRV7L5SP.js → impl-EVICJMI3.js} +2 -2
  26. package/dist/{impl-5NAYXPAC.js → impl-G5TGSB4H.js} +2 -2
  27. package/dist/{impl-B5C37V2L.js → impl-GNG2DOKG.js} +2 -2
  28. package/dist/{impl-ZX6PDQW6.js → impl-GNSHZ3OL.js} +2 -2
  29. package/dist/{impl-XGFKUJGX.js → impl-GPCURY4M.js} +2 -2
  30. package/dist/impl-GZRQOFY6.js +2 -0
  31. package/dist/{impl-MGARGP2M.js → impl-HEC3SVYP.js} +2 -2
  32. package/dist/{impl-QSO5YEU5.js → impl-HH24GIMG.js} +2 -2
  33. package/dist/{impl-JFHF7SF7.js → impl-I24OLEN5.js} +2 -2
  34. package/dist/{impl-R3SREBHK.js → impl-IAXNYDJT.js} +2 -2
  35. package/dist/{impl-4CRAE4V6.js → impl-J33PI3PK.js} +2 -2
  36. package/dist/{impl-BWZUWHVF.js → impl-JZDUGI7W.js} +2 -2
  37. package/dist/{impl-Z4G3R4DW.js → impl-LZ3HI26W.js} +2 -2
  38. package/dist/{impl-GGEEIOQF.js → impl-MEDPDKAE.js} +2 -2
  39. package/dist/{impl-ZN4EG5UY.js → impl-MLS6TI7N.js} +2 -2
  40. package/dist/{impl-FYAEBZIM.js → impl-NI7KSBSS.js} +2 -2
  41. package/dist/{impl-7DL7ZS4K.js → impl-OM6EKANE.js} +2 -2
  42. package/dist/impl-T4WDJSWZ.js +2 -0
  43. package/dist/{impl-2TCAWTV7.js → impl-U37YTCPW.js} +2 -2
  44. package/dist/{impl-TKRPL6CJ.js → impl-U5555HGJ.js} +2 -2
  45. package/dist/{impl-PERB6GYW.js → impl-UHFSVVIS.js} +2 -2
  46. package/dist/{impl-NNBY4R6T.js → impl-UIVTSO57.js} +2 -2
  47. package/dist/{impl-7JFWBWQZ.js → impl-UQYL5PXR.js} +2 -2
  48. package/dist/{impl-FAOTDDQ5.js → impl-V5QTKTU4.js} +2 -2
  49. package/dist/{impl-NCWU4WVO.js → impl-WDPWOOFV.js} +2 -2
  50. package/dist/{impl-D47U6GWY.js → impl-WZAF2LD3.js} +2 -2
  51. package/dist/{impl-5N4IKF4U.js → impl-XF26H3HG.js} +2 -2
  52. package/dist/{impl-NE4OGF7U.js → impl-XQY2Q5R6.js} +2 -2
  53. package/dist/{impl-JPOE7MKX.js → impl-YB2LON7S.js} +2 -2
  54. package/dist/{impl-TMKWWJKO.js → impl-YNGQIWW7.js} +2 -2
  55. package/dist/{impl-VUKRE7OK.js → impl-ZA3PKNQN.js} +2 -2
  56. package/dist/index.d.ts +1 -1
  57. package/dist/index.js +1 -1
  58. package/package.json +2 -2
  59. package/dist/chunk-XWOTEZCO.js +0 -2
  60. package/dist/chunk-XWOTEZCO.js.map +0 -1
  61. package/dist/impl-645HDE5S.js +0 -2
  62. package/dist/impl-B4WDU4OW.js +0 -2
  63. package/dist/impl-IFLVVVBT.js +0 -2
  64. package/dist/impl-RCQ2XX63.js +0 -2
  65. /package/dist/{chunk-6WKTY4YQ.js.map → chunk-24SSWBXM.js.map} +0 -0
  66. /package/dist/{chunk-HGLIJXXG.js.map → chunk-6P4FW6XR.js.map} +0 -0
  67. /package/dist/{chunk-UUBO75GS.js.map → chunk-7QHA6ZIV.js.map} +0 -0
  68. /package/dist/{chunk-AB4DHWRB.js.map → chunk-HH2PQ3PQ.js.map} +0 -0
  69. /package/dist/{chunk-GD7WEHDA.js.map → chunk-INLBXSQE.js.map} +0 -0
  70. /package/dist/{chunk-GSXHJEKW.js.map → chunk-KRN6Q433.js.map} +0 -0
  71. /package/dist/{chunk-R6QTIUFA.js.map → chunk-MVDOKJ6J.js.map} +0 -0
  72. /package/dist/{chunk-WEQUQAB7.js.map → chunk-TDBKATQK.js.map} +0 -0
  73. /package/dist/{chunk-FSJPJZNH.js.map → chunk-WSDWILYI.js.map} +0 -0
  74. /package/dist/{chunk-UK7OFHQR.js.map → chunk-XNR74SBS.js.map} +0 -0
  75. /package/dist/{chunk-JXPGBZXN.js.map → chunk-ZLRUIEVQ.js.map} +0 -0
  76. /package/dist/{chunk-TR32ZRNC.js.map → chunk-ZTD7APNF.js.map} +0 -0
  77. /package/dist/{impl-IFLVVVBT.js.map → impl-25VWUB6L.js.map} +0 -0
  78. /package/dist/{impl-42N5BEEM.js.map → impl-3M5R6G5M.js.map} +0 -0
  79. /package/dist/{impl-RCQ2XX63.js.map → impl-5OEPVWPL.js.map} +0 -0
  80. /package/dist/{impl-N3R63BI4.js.map → impl-AFRHPZGF.js.map} +0 -0
  81. /package/dist/{impl-VDNSV4OU.js.map → impl-CCUCFOCW.js.map} +0 -0
  82. /package/dist/{impl-IAKEYWMV.js.map → impl-E36SWF4Z.js.map} +0 -0
  83. /package/dist/{impl-TOLP53IM.js.map → impl-E5WXNV47.js.map} +0 -0
  84. /package/dist/{impl-KRV7L5SP.js.map → impl-EVICJMI3.js.map} +0 -0
  85. /package/dist/{impl-5NAYXPAC.js.map → impl-G5TGSB4H.js.map} +0 -0
  86. /package/dist/{impl-B5C37V2L.js.map → impl-GNG2DOKG.js.map} +0 -0
  87. /package/dist/{impl-ZX6PDQW6.js.map → impl-GNSHZ3OL.js.map} +0 -0
  88. /package/dist/{impl-XGFKUJGX.js.map → impl-GPCURY4M.js.map} +0 -0
  89. /package/dist/{impl-645HDE5S.js.map → impl-GZRQOFY6.js.map} +0 -0
  90. /package/dist/{impl-MGARGP2M.js.map → impl-HEC3SVYP.js.map} +0 -0
  91. /package/dist/{impl-QSO5YEU5.js.map → impl-HH24GIMG.js.map} +0 -0
  92. /package/dist/{impl-JFHF7SF7.js.map → impl-I24OLEN5.js.map} +0 -0
  93. /package/dist/{impl-R3SREBHK.js.map → impl-IAXNYDJT.js.map} +0 -0
  94. /package/dist/{impl-4CRAE4V6.js.map → impl-J33PI3PK.js.map} +0 -0
  95. /package/dist/{impl-BWZUWHVF.js.map → impl-JZDUGI7W.js.map} +0 -0
  96. /package/dist/{impl-Z4G3R4DW.js.map → impl-LZ3HI26W.js.map} +0 -0
  97. /package/dist/{impl-GGEEIOQF.js.map → impl-MEDPDKAE.js.map} +0 -0
  98. /package/dist/{impl-ZN4EG5UY.js.map → impl-MLS6TI7N.js.map} +0 -0
  99. /package/dist/{impl-FYAEBZIM.js.map → impl-NI7KSBSS.js.map} +0 -0
  100. /package/dist/{impl-7DL7ZS4K.js.map → impl-OM6EKANE.js.map} +0 -0
  101. /package/dist/{impl-B4WDU4OW.js.map → impl-T4WDJSWZ.js.map} +0 -0
  102. /package/dist/{impl-2TCAWTV7.js.map → impl-U37YTCPW.js.map} +0 -0
  103. /package/dist/{impl-TKRPL6CJ.js.map → impl-U5555HGJ.js.map} +0 -0
  104. /package/dist/{impl-PERB6GYW.js.map → impl-UHFSVVIS.js.map} +0 -0
  105. /package/dist/{impl-NNBY4R6T.js.map → impl-UIVTSO57.js.map} +0 -0
  106. /package/dist/{impl-7JFWBWQZ.js.map → impl-UQYL5PXR.js.map} +0 -0
  107. /package/dist/{impl-FAOTDDQ5.js.map → impl-V5QTKTU4.js.map} +0 -0
  108. /package/dist/{impl-NCWU4WVO.js.map → impl-WDPWOOFV.js.map} +0 -0
  109. /package/dist/{impl-D47U6GWY.js.map → impl-WZAF2LD3.js.map} +0 -0
  110. /package/dist/{impl-5N4IKF4U.js.map → impl-XF26H3HG.js.map} +0 -0
  111. /package/dist/{impl-NE4OGF7U.js.map → impl-XQY2Q5R6.js.map} +0 -0
  112. /package/dist/{impl-JPOE7MKX.js.map → impl-YB2LON7S.js.map} +0 -0
  113. /package/dist/{impl-TMKWWJKO.js.map → impl-YNGQIWW7.js.map} +0 -0
  114. /package/dist/{impl-VUKRE7OK.js.map → impl-ZA3PKNQN.js.map} +0 -0
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import{a as s}from"../chunk-72U6ETHG.js";import{a as o}from"../chunk-JXPGBZXN.js";import"../chunk-GD7WEHDA.js";import"../chunk-L5ULN3IT.js";import"../chunk-XWOTEZCO.js";import"../chunk-ARVEJERC.js";import{proposeCompletions as r}from"@stricli/core";var t=process.argv.slice(3);process.env.COMP_LINE?.endsWith(" ")&&t.push("");await r(o,t,s(process));try{for(let{completion:p}of await r(o,t,s(process)))process.stdout.write(`${p}
2
+ import{a as s}from"../chunk-72U6ETHG.js";import{a as o}from"../chunk-ZLRUIEVQ.js";import"../chunk-INLBXSQE.js";import"../chunk-L5ULN3IT.js";import"../chunk-SF46ZLPT.js";import"../chunk-ARVEJERC.js";import{proposeCompletions as r}from"@stricli/core";var t=process.argv.slice(3);process.env.COMP_LINE?.endsWith(" ")&&t.push("");await r(o,t,s(process));try{for(let{completion:p}of await r(o,t,s(process)))process.stdout.write(`${p}
3
3
  `)}catch{}
4
4
  //# sourceMappingURL=bash-complete.js.map
package/dist/bin/cli.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{a as o}from"../chunk-72U6ETHG.js";import{a as r}from"../chunk-JXPGBZXN.js";import"../chunk-GD7WEHDA.js";import"../chunk-L5ULN3IT.js";import"../chunk-XWOTEZCO.js";import"../chunk-ARVEJERC.js";import{run as i}from"@stricli/core";await i(r,process.argv.slice(2),o(process));
2
+ import{a as o}from"../chunk-72U6ETHG.js";import{a as r}from"../chunk-ZLRUIEVQ.js";import"../chunk-INLBXSQE.js";import"../chunk-L5ULN3IT.js";import"../chunk-SF46ZLPT.js";import"../chunk-ARVEJERC.js";import{run as i}from"@stricli/core";await i(r,process.argv.slice(2),o(process));
3
3
  //# sourceMappingURL=cli.js.map
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{a as n}from"../chunk-JXPGBZXN.js";import"../chunk-GD7WEHDA.js";import{a as r}from"../chunk-43JWXG77.js";import"../chunk-L5ULN3IT.js";import"../chunk-XWOTEZCO.js";import"../chunk-ARVEJERC.js";import{generateHelpTextForAllCommands as c}from"@stricli/core";var s={"tr-build-xdi-sync-endpoint":["consent","build-xdi-sync-endpoint"],"tr-consent-manager-service-json-to-yml":["inventory","consent-manager-service-json-to-yml"],"tr-consent-managers-to-business-entities":["inventory","consent-managers-to-business-entities"],"tr-cron-mark-identifiers-completed":["request","cron","mark-identifiers-completed"],"tr-cron-pull-identifiers":["request","cron","pull-identifiers"],"tr-derive-data-silos-from-data-flows":["inventory","derive-data-silos-from-data-flows"],"tr-derive-data-silos-from-data-flows-cross-instance":["inventory","derive-data-silos-from-data-flows-cross-instance"],"tr-discover-silos":["inventory","discover-silos"],"tr-generate-api-keys":["admin","generate-api-keys"],"tr-manual-enrichment-pull-identifiers":["request","preflight","pull-identifiers"],"tr-manual-enrichment-push-identifiers":["request","preflight","push-identifiers"],"tr-mark-request-data-silos-completed":["request","system","mark-request-data-silos-completed"],"tr-pull":["inventory","pull"],"tr-pull-consent-metrics":["consent","pull-consent-metrics"],"tr-pull-consent-preferences":["consent","pull-consent-preferences"],"tr-pull-datapoints":["inventory","pull-datapoints"],"tr-pull-pull-unstructured-discovery-files":["inventory","pull-unstructured-discovery-files"],"tr-push":["inventory","push"],"tr-request-approve":["request","approve"],"tr-request-cancel":["request","cancel"],"tr-request-download-files":["request","download-files"],"tr-request-enricher-restart":["request","enricher-restart"],"tr-request-export":["request","export"],"tr-request-mark-silent":["request","mark-silent"],"tr-request-notify-additional-time":["request","notify-additional-time"],"tr-request-reject-unverified-identifiers":["request","reject-unverified-identifiers"],"tr-request-restart":["request","restart"],"tr-request-upload":["request","upload"],"tr-retry-request-data-silos":["request","system","retry-request-data-silos"],"tr-scan-packages":["inventory","scan-packages"],"tr-skip-preflight-jobs":["request","skip-preflight-jobs"],"tr-skip-request-data-silos":["request","system","skip-request-data-silos"],"tr-sync-ot":["migration","sync-ot"],"tr-update-consent-manager":["consent","update-consent-manager"],"tr-upload-consent-preferences":["consent","upload-consent-preferences"],"tr-upload-cookies-from-csv":["consent","upload-cookies-from-csv"],"tr-upload-data-flows-from-csv":["consent","upload-data-flows-from-csv"],"tr-upload-preferences":["consent","upload-preferences"]};function m(t){return c(n).find(o=>o[0]===`${n.config.name} ${t.join(" ")}`)?.[1]}function i(t){r.log("[DEPRECATION NOTICE]");let e=s[t];if(!e){let a=Object.entries(s).map(([d,l])=>`\`${d}\` -> \`${n.config.name} ${l.join(" ")}\``).join(`
2
+ import{a as n}from"../chunk-ZLRUIEVQ.js";import"../chunk-INLBXSQE.js";import{a as r}from"../chunk-43JWXG77.js";import"../chunk-L5ULN3IT.js";import"../chunk-SF46ZLPT.js";import"../chunk-ARVEJERC.js";import{generateHelpTextForAllCommands as c}from"@stricli/core";var s={"tr-build-xdi-sync-endpoint":["consent","build-xdi-sync-endpoint"],"tr-consent-manager-service-json-to-yml":["inventory","consent-manager-service-json-to-yml"],"tr-consent-managers-to-business-entities":["inventory","consent-managers-to-business-entities"],"tr-cron-mark-identifiers-completed":["request","cron","mark-identifiers-completed"],"tr-cron-pull-identifiers":["request","cron","pull-identifiers"],"tr-derive-data-silos-from-data-flows":["inventory","derive-data-silos-from-data-flows"],"tr-derive-data-silos-from-data-flows-cross-instance":["inventory","derive-data-silos-from-data-flows-cross-instance"],"tr-discover-silos":["inventory","discover-silos"],"tr-generate-api-keys":["admin","generate-api-keys"],"tr-manual-enrichment-pull-identifiers":["request","preflight","pull-identifiers"],"tr-manual-enrichment-push-identifiers":["request","preflight","push-identifiers"],"tr-mark-request-data-silos-completed":["request","system","mark-request-data-silos-completed"],"tr-pull":["inventory","pull"],"tr-pull-consent-metrics":["consent","pull-consent-metrics"],"tr-pull-consent-preferences":["consent","pull-consent-preferences"],"tr-pull-datapoints":["inventory","pull-datapoints"],"tr-pull-pull-unstructured-discovery-files":["inventory","pull-unstructured-discovery-files"],"tr-push":["inventory","push"],"tr-request-approve":["request","approve"],"tr-request-cancel":["request","cancel"],"tr-request-download-files":["request","download-files"],"tr-request-enricher-restart":["request","enricher-restart"],"tr-request-export":["request","export"],"tr-request-mark-silent":["request","mark-silent"],"tr-request-notify-additional-time":["request","notify-additional-time"],"tr-request-reject-unverified-identifiers":["request","reject-unverified-identifiers"],"tr-request-restart":["request","restart"],"tr-request-upload":["request","upload"],"tr-retry-request-data-silos":["request","system","retry-request-data-silos"],"tr-scan-packages":["inventory","scan-packages"],"tr-skip-preflight-jobs":["request","skip-preflight-jobs"],"tr-skip-request-data-silos":["request","system","skip-request-data-silos"],"tr-sync-ot":["migration","sync-ot"],"tr-update-consent-manager":["consent","update-consent-manager"],"tr-upload-consent-preferences":["consent","upload-consent-preferences"],"tr-upload-cookies-from-csv":["consent","upload-cookies-from-csv"],"tr-upload-data-flows-from-csv":["consent","upload-data-flows-from-csv"],"tr-upload-preferences":["consent","upload-preferences"]};function m(t){return c(n).find(o=>o[0]===`${n.config.name} ${t.join(" ")}`)?.[1]}function i(t){r.log("[DEPRECATION NOTICE]");let e=s[t];if(!e){let a=Object.entries(s).map(([d,l])=>`\`${d}\` -> \`${n.config.name} ${l.join(" ")}\``).join(`
3
3
  `);r.log(`This command is deprecated as of v7.0.0. Here is a list of new commands, mapped to their legacy command names:
4
4
  ${a}`);return}r.log(`\`${t}\` is deprecated as of v7.0.0.
5
5
  Use \`${n.config.name} ${e.join(" ")}\` instead.
@@ -1,4 +1,4 @@
1
- import{c as u}from"./chunk-R6QTIUFA.js";import{a as E}from"./chunk-43JWXG77.js";import{readFileSync as b}from"fs";import{findAllWithRegex as F}from"@transcend-io/type-utils";import{CodePackageType as w}from"@transcend-io/privacy-types";var N=/target ('|")(.*?)('|")/,O=/pod ('|")(.*?)('|")(, ('|")~> (.+?)('|")|)/,y={supportedFiles:["Podfile"],ignoreDirs:["Pods"],scanFunction:e=>{let n=b(e,"utf-8"),o=F({value:new RegExp(N,"g"),matches:["quote1","name","quote2"]},n),c=F({value:new RegExp(O,"g"),matches:["quote1","name","quote2","extra","quote3","version","quote4"]},n);return o.map((t,p)=>({name:t.name,type:w.CocoaPods,softwareDevelopmentKits:c.filter(r=>r.matchIndex>t.matchIndex&&(!o[p+1]||r.matchIndex<o[p+1].matchIndex)).map(r=>({name:r.name,version:r.version}))}))}};import{readFileSync as T}from"fs";import{findAllWithRegex as l}from"@transcend-io/type-utils";import{dirname as h}from"path";var K=/implementation( *)('|")(.+?):(.+?):(.+?|)('|")/,M=/apply plugin: *('|")(.+?)(:(.+?)|)('|")/,j=/implementation group:( *)('|")(.+?)('|"),( *)name:( *)('|")(.+?)('|"),( *)version:( *)('|")(.+?)('|")/,L=/applicationId( *)"(.+?)"/,S={supportedFiles:["build.gradle**"],ignoreDirs:["gradle-app.setting","gradle-wrapper.jar","gradle-wrapper.properties"],scanFunction:e=>{let n=T(e,"utf-8"),o=h(e),c=l({value:new RegExp(K,"g"),matches:["space","quote1","name","path","version","quote2"]},n),a=l({value:new RegExp(M,"g"),matches:["quote1","name","group","version","quote2"]},n),t=l({value:new RegExp(j,"g"),matches:["space1","quote1","group","quote2","space2","space3","quote3","name","quote4","space4","space5","quote5","version","quote6"]},n),p=l({value:new RegExp(L,"g"),matches:["space","name"]},n);if(p.length>1)throw new Error(`Expected only one applicationId per file: ${e}`);return[{name:p[0]?.name||o.split("/").pop(),softwareDevelopmentKits:[...c,...t,...a].map(r=>({name:r.name,version:r.version||void 0}))}]}};import{readFileSync as $}from"fs";import{dirname as J}from"path";var x={supportedFiles:["package.json"],ignoreDirs:["node_modules","serverless-build","lambda-build"],scanFunction:e=>{let n=$(e,"utf-8"),o=J(e),c=JSON.parse(n),{name:a,description:t,dependencies:p={},devDependencies:r={},optionalDependencies:i={}}=c;return[{name:a||o.split("/").pop(),description:t,softwareDevelopmentKits:[...Object.entries(p).map(([s,m])=>({name:s,version:typeof m=="string"?m:void 0})),...Object.entries(r).map(([s,m])=>({name:s,version:typeof m=="string"?m:void 0,isDevDependency:!0})),...Object.entries(i).map(([s,m])=>({name:s,version:typeof m=="string"?m:void 0}))]}]}};import{readFileSync as R}from"fs";import{findAllWithRegex as X}from"@transcend-io/type-utils";import{dirname as U,join as W}from"path";import{CodePackageType as Y}from"@transcend-io/privacy-types";var V=/(.+?)(=+)(.+)/,H=/name *= *('|")(.+?)('|")/,Q=/description *= *('|")(.+?)('|")/,P={supportedFiles:["requirements.txt"],ignoreDirs:["build","lib","lib64"],scanFunction:e=>{let n=R(e,"utf-8"),o=U(e),a=u(o).find(s=>s==="setup.py"),t=a?R(W(o,a),"utf-8"):void 0,p=t?(H.exec(t)||[])[2]:void 0,r=t?(Q.exec(t)||[])[2]:void 0,i=X({value:new RegExp(V,"g"),matches:["name","equals","version"]},n);return[{name:p||o.split("/").pop(),description:r||void 0,type:Y.RequirementsTxt,softwareDevelopmentKits:i.map(s=>({name:s.name,version:s.version}))}]}};import{readFileSync as G}from"fs";import{findAllWithRegex as z}from"@transcend-io/type-utils";import{dirname as B}from"path";import{CodePackageType as Z}from"@transcend-io/privacy-types";var ee=/gem *('|")(.+?)('|")(, *('|")(.+?)('|")|)/,ne=/spec\.name *= *('|")(.+?)('|")/,oe=/spec\.description *= *('|")(.+?)('|")/,te=/spec\.summary *= *('|")(.+?)('|")/,k={supportedFiles:["Gemfile"],ignoreDirs:["bin"],scanFunction:e=>{let n=G(e,"utf-8"),o=B(e),a=u(o).find(s=>s===".gemspec"),t=a?G(a,"utf-8"):void 0,p=t?(ne.exec(t)||[])[2]:void 0,r=t?(oe.exec(t)||te.exec(t)||[])[1]:void 0,i=z({value:new RegExp(ee,"g"),matches:["quote1","name","quote2","hasVersion","quote3","version","quote4"]},n);return[{name:p||o.split("/").pop(),description:r||void 0,type:Z.RequirementsTxt,softwareDevelopmentKits:i.map(s=>({name:s.name,version:s.version}))}]}};import{readFileSync as re}from"fs";import{CodePackageType as ie}from"@transcend-io/privacy-types";import se from"js-yaml";import{dirname as ae}from"path";function pe(e){return e.split(`
1
+ import{c as u}from"./chunk-MVDOKJ6J.js";import{a as E}from"./chunk-43JWXG77.js";import{readFileSync as b}from"fs";import{findAllWithRegex as F}from"@transcend-io/type-utils";import{CodePackageType as w}from"@transcend-io/privacy-types";var N=/target ('|")(.*?)('|")/,O=/pod ('|")(.*?)('|")(, ('|")~> (.+?)('|")|)/,y={supportedFiles:["Podfile"],ignoreDirs:["Pods"],scanFunction:e=>{let n=b(e,"utf-8"),o=F({value:new RegExp(N,"g"),matches:["quote1","name","quote2"]},n),c=F({value:new RegExp(O,"g"),matches:["quote1","name","quote2","extra","quote3","version","quote4"]},n);return o.map((t,p)=>({name:t.name,type:w.CocoaPods,softwareDevelopmentKits:c.filter(r=>r.matchIndex>t.matchIndex&&(!o[p+1]||r.matchIndex<o[p+1].matchIndex)).map(r=>({name:r.name,version:r.version}))}))}};import{readFileSync as T}from"fs";import{findAllWithRegex as l}from"@transcend-io/type-utils";import{dirname as h}from"path";var K=/implementation( *)('|")(.+?):(.+?):(.+?|)('|")/,M=/apply plugin: *('|")(.+?)(:(.+?)|)('|")/,j=/implementation group:( *)('|")(.+?)('|"),( *)name:( *)('|")(.+?)('|"),( *)version:( *)('|")(.+?)('|")/,L=/applicationId( *)"(.+?)"/,S={supportedFiles:["build.gradle**"],ignoreDirs:["gradle-app.setting","gradle-wrapper.jar","gradle-wrapper.properties"],scanFunction:e=>{let n=T(e,"utf-8"),o=h(e),c=l({value:new RegExp(K,"g"),matches:["space","quote1","name","path","version","quote2"]},n),a=l({value:new RegExp(M,"g"),matches:["quote1","name","group","version","quote2"]},n),t=l({value:new RegExp(j,"g"),matches:["space1","quote1","group","quote2","space2","space3","quote3","name","quote4","space4","space5","quote5","version","quote6"]},n),p=l({value:new RegExp(L,"g"),matches:["space","name"]},n);if(p.length>1)throw new Error(`Expected only one applicationId per file: ${e}`);return[{name:p[0]?.name||o.split("/").pop(),softwareDevelopmentKits:[...c,...t,...a].map(r=>({name:r.name,version:r.version||void 0}))}]}};import{readFileSync as $}from"fs";import{dirname as J}from"path";var x={supportedFiles:["package.json"],ignoreDirs:["node_modules","serverless-build","lambda-build"],scanFunction:e=>{let n=$(e,"utf-8"),o=J(e),c=JSON.parse(n),{name:a,description:t,dependencies:p={},devDependencies:r={},optionalDependencies:i={}}=c;return[{name:a||o.split("/").pop(),description:t,softwareDevelopmentKits:[...Object.entries(p).map(([s,m])=>({name:s,version:typeof m=="string"?m:void 0})),...Object.entries(r).map(([s,m])=>({name:s,version:typeof m=="string"?m:void 0,isDevDependency:!0})),...Object.entries(i).map(([s,m])=>({name:s,version:typeof m=="string"?m:void 0}))]}]}};import{readFileSync as R}from"fs";import{findAllWithRegex as X}from"@transcend-io/type-utils";import{dirname as U,join as W}from"path";import{CodePackageType as Y}from"@transcend-io/privacy-types";var V=/(.+?)(=+)(.+)/,H=/name *= *('|")(.+?)('|")/,Q=/description *= *('|")(.+?)('|")/,P={supportedFiles:["requirements.txt"],ignoreDirs:["build","lib","lib64"],scanFunction:e=>{let n=R(e,"utf-8"),o=U(e),a=u(o).find(s=>s==="setup.py"),t=a?R(W(o,a),"utf-8"):void 0,p=t?(H.exec(t)||[])[2]:void 0,r=t?(Q.exec(t)||[])[2]:void 0,i=X({value:new RegExp(V,"g"),matches:["name","equals","version"]},n);return[{name:p||o.split("/").pop(),description:r||void 0,type:Y.RequirementsTxt,softwareDevelopmentKits:i.map(s=>({name:s.name,version:s.version}))}]}};import{readFileSync as G}from"fs";import{findAllWithRegex as z}from"@transcend-io/type-utils";import{dirname as B}from"path";import{CodePackageType as Z}from"@transcend-io/privacy-types";var ee=/gem *('|")(.+?)('|")(, *('|")(.+?)('|")|)/,ne=/spec\.name *= *('|")(.+?)('|")/,oe=/spec\.description *= *('|")(.+?)('|")/,te=/spec\.summary *= *('|")(.+?)('|")/,k={supportedFiles:["Gemfile"],ignoreDirs:["bin"],scanFunction:e=>{let n=G(e,"utf-8"),o=B(e),a=u(o).find(s=>s===".gemspec"),t=a?G(a,"utf-8"):void 0,p=t?(ne.exec(t)||[])[2]:void 0,r=t?(oe.exec(t)||te.exec(t)||[])[1]:void 0,i=z({value:new RegExp(ee,"g"),matches:["quote1","name","quote2","hasVersion","quote3","version","quote4"]},n);return[{name:p||o.split("/").pop(),description:r||void 0,type:Z.RequirementsTxt,softwareDevelopmentKits:i.map(s=>({name:s.name,version:s.version}))}]}};import{readFileSync as re}from"fs";import{CodePackageType as ie}from"@transcend-io/privacy-types";import se from"js-yaml";import{dirname as ae}from"path";function pe(e){return e.split(`
2
2
  `).map(n=>{let o=n.indexOf("#");return o>-1&&!n.substring(0,o).includes('"')&&!n.substring(0,o).includes("'")?n.substring(0,o).trim():n}).filter(n=>n.length>0).join(`
3
3
  `)}var v={supportedFiles:["pubspec.yml"],ignoreDirs:["build"],scanFunction:e=>{let n=ae(e),o=re(e,"utf-8"),{name:c,description:a,dev_dependencies:t={},dependencies:p={}}=se.load(pe(o));return[{name:c||n.split("/").pop(),description:a,type:ie.RequirementsTxt,softwareDevelopmentKits:[...Object.entries(p).map(([r,i])=>({name:r,version:typeof i=="string"?i:typeof i=="number"?i.toString():i?.sdk})),...Object.entries(t).map(([r,i])=>({name:r,version:typeof i=="string"?i:typeof i=="number"?i.toString():i?.sdk,isDevDependency:!0}))]}]}};import{readFileSync as ce}from"fs";import{dirname as me}from"path";var I={supportedFiles:["composer.json"],ignoreDirs:["vendor","node_modules","cache","build","dist"],scanFunction:e=>{let n=ce(e,"utf-8"),o=me(e),c=JSON.parse(n),{name:a,description:t,require:p={},"require-dev":r={}}=c;return[{name:a||o.split("/").pop(),description:t,softwareDevelopmentKits:[...Object.entries(p).map(([i,s])=>({name:i,version:typeof s=="string"?s:void 0})),...Object.entries(r).map(([i,s])=>({name:i,version:typeof s=="string"?s:void 0,isDevDependency:!0}))]}]}};import{readFileSync as de}from"fs";import{CodePackageType as ge}from"@transcend-io/privacy-types";import{decodeCodec as fe}from"@transcend-io/type-utils";import*as d from"io-ts";import{dirname as ue}from"path";var le=d.type({pins:d.array(d.type({identity:d.string,kind:d.string,location:d.string,state:d.type({revision:d.string,version:d.string})})),version:d.number}),D={supportedFiles:["Package.resolved"],ignoreDirs:[],scanFunction:e=>{let n=de(e,"utf-8"),o=fe(le,n);return[{name:ue(e).split("/").pop()||"",type:ge.CocoaPods,softwareDevelopmentKits:o.pins.map(c=>({name:c.identity,version:c.state.version}))}]}};import{CodePackageType as f}from"@transcend-io/privacy-types";var gn={cocoaPods:y,gradle:S,javascriptPackageJson:x,pythonRequirementsTxt:P,gemfile:k,pubspec:v,swift:D},_={[f.CocoaPods]:y,[f.Gradle]:S,[f.PackageJson]:x,[f.RequirementsTxt]:P,[f.Gemfile]:k,[f.Pubspec]:v,[f.ComposerJson]:I,[f.Swift]:D};import Ce from"fast-glob";import A from"colors";import{getEntries as Ee}from"@transcend-io/type-utils";async function Sn({scanPath:e,ignoreDirs:n=[],repositoryName:o}){return(await Promise.all(Ee(_).map(async([a,t])=>{let{ignoreDirs:p,supportedFiles:r,scanFunction:i}=t,s=[...n,...p].filter(m=>m.length>0);try{let m=await Ce(`${e}/**/${r.join("|")}`,{ignore:s.map(g=>`${e}/**/${g}`),unique:!0,onlyFiles:!0});E.info(A.magenta(`Scanning: ${m.length} files of type ${a}`));let C=m.map(g=>i(g).map(q=>({...q,relativePath:g.replace(`${e}/`,"")}))).flat();return E.info(A.green(`Found: ${C.length} packages and ${C.map(({softwareDevelopmentKits:g=[]})=>g).flat().length} sdks`)),C.map(g=>({...g,type:a,repositoryName:o}))}catch(m){throw new Error(`Error scanning globs ${r} with error: ${m}`)}}))).flat()}export{gn as a,Sn as b};
4
- //# sourceMappingURL=chunk-6WKTY4YQ.js.map
4
+ //# sourceMappingURL=chunk-24SSWBXM.js.map
@@ -1,3 +1,3 @@
1
- import{c as _}from"./chunk-MA4JWWRO.js";import{n as A,q as x}from"./chunk-TR32ZRNC.js";import{Ae as O,Be as D,_ as T,_b as j,b as R,pe as y,qe as E,ye as L}from"./chunk-WEQUQAB7.js";import{a as r}from"./chunk-43JWXG77.js";import{e as b}from"./chunk-L5ULN3IT.js";import{RequestStatus as U}from"@transcend-io/privacy-types";import k from"colors";import{groupBy as G,uniq as Q}from"lodash-es";async function te({file:u,auth:s,sombraAuth:g,requestActions:f=[],concurrency:p=100,transcendUrl:n=b}){let o=y(n,s),e=await E(n,s,g);r.info(k.magenta(`Pulling manual enrichment requests, filtered for actions: ${f.join(",")}`));let d=await L(o,{actions:f,statuses:[U.Enriching]}),i=[];await R(d,async t=>{let c=await D(o,{requestId:t.id});if(c.filter(({status:m})=>m==="ACTION_REQUIRED")){let m=await O(o,e,{requestId:t.id});i.push({...t,requestIdentifiers:m,requestEnrichers:c})}},{concurrency:p});let l=i.map(({attributeValues:t,requestIdentifiers:c,requestEnrichers:I,...m})=>({...m,...Object.entries(G(c,"name")).reduce((w,[P,$])=>Object.assign(w,{[P]:$.map(({value:C})=>C).join(",")}),{}),...Object.entries(G(t,"attributeKey.name")).reduce((w,[P,$])=>Object.assign(w,{[P]:$.map(({name:C})=>C).join(",")}),{})})),a=Q(l.map(t=>Object.keys(t)).flat());return _(u,l,a),r.info(k.green(`Successfully wrote ${i.length} requests to file "${u}"`)),i}import*as q from"io-ts";import{uniq as F}from"lodash-es";import v from"colors";var S="https://app.transcend.io/privacy-requests/incoming-requests/",M=q.record(q.string,q.string);async function N(u,{id:s,...g},f,p){if(!s){let e=`Request ID must be provided to enricher request.${p?` Found error in row: ${p}`:""}`;throw r.error(v.red(e)),new Error(e)}let n=s.toLowerCase(),o=Object.entries(g).reduce((e,[d,i])=>F(A(i)).length===0?e:Object.assign(e,{[d]:F(A(i)).map(a=>({value:d==="email"?a.toLowerCase():a}))}),{});try{return await u.post("v1/enrich-identifiers",{headers:{"x-transcend-request-id":n,"x-transcend-enricher-id":f},json:{enrichedIdentifiers:o}}).json(),r.error(v.green(`Successfully enriched request: ${S}${n}`)),!0}catch(e){if(typeof e.response.body=="string"&&e.response.body.includes("Cannot update a resolved RequestEnricher"))return r.warn(v.magenta(`Skipped enrichment for request: ${S}${n}, request is no longer in the enriching phase.`)),!1;throw r.error(v.red(`Failed to enricher identifiers for request with id: ${S}${n} - ${e.message} - ${e.response.body}`)),e}}import h from"colors";async function ge({file:u,auth:s,sombraAuth:g,enricherId:f,markSilent:p,concurrency:n=100,transcendUrl:o=b}){let e=await E(o,s,g),d=y(o,s);r.info(h.magenta(`Reading "${u}" from disk`));let i=x(u,M);r.info(h.magenta(`Enriching "${i.length}" privacy requests.`));let l=0,a=0,t=0;if(await R(i,async(c,I)=>{try{p&&(await j(d,T,{input:{id:c.id,isSilent:!0}}),r.info(h.magenta(`Mark request as silent mode - ${c.id}`))),await N(e,c,f,I)?l+=1:a+=1}catch{t+=1}},{concurrency:n}),r.info(h.green(`Successfully notified Transcend!
1
+ import{c as _}from"./chunk-MA4JWWRO.js";import{n as A,q as x}from"./chunk-ZTD7APNF.js";import{Ae as O,Be as D,_ as T,_b as j,b as R,pe as y,qe as E,ye as L}from"./chunk-TDBKATQK.js";import{a as r}from"./chunk-43JWXG77.js";import{e as b}from"./chunk-L5ULN3IT.js";import{RequestStatus as U}from"@transcend-io/privacy-types";import k from"colors";import{groupBy as G,uniq as Q}from"lodash-es";async function te({file:u,auth:s,sombraAuth:g,requestActions:f=[],concurrency:p=100,transcendUrl:n=b}){let o=y(n,s),e=await E(n,s,g);r.info(k.magenta(`Pulling manual enrichment requests, filtered for actions: ${f.join(",")}`));let d=await L(o,{actions:f,statuses:[U.Enriching]}),i=[];await R(d,async t=>{let c=await D(o,{requestId:t.id});if(c.filter(({status:m})=>m==="ACTION_REQUIRED")){let m=await O(o,e,{requestId:t.id});i.push({...t,requestIdentifiers:m,requestEnrichers:c})}},{concurrency:p});let l=i.map(({attributeValues:t,requestIdentifiers:c,requestEnrichers:I,...m})=>({...m,...Object.entries(G(c,"name")).reduce((w,[P,$])=>Object.assign(w,{[P]:$.map(({value:C})=>C).join(",")}),{}),...Object.entries(G(t,"attributeKey.name")).reduce((w,[P,$])=>Object.assign(w,{[P]:$.map(({name:C})=>C).join(",")}),{})})),a=Q(l.map(t=>Object.keys(t)).flat());return _(u,l,a),r.info(k.green(`Successfully wrote ${i.length} requests to file "${u}"`)),i}import*as q from"io-ts";import{uniq as F}from"lodash-es";import v from"colors";var S="https://app.transcend.io/privacy-requests/incoming-requests/",M=q.record(q.string,q.string);async function N(u,{id:s,...g},f,p){if(!s){let e=`Request ID must be provided to enricher request.${p?` Found error in row: ${p}`:""}`;throw r.error(v.red(e)),new Error(e)}let n=s.toLowerCase(),o=Object.entries(g).reduce((e,[d,i])=>F(A(i)).length===0?e:Object.assign(e,{[d]:F(A(i)).map(a=>({value:d==="email"?a.toLowerCase():a}))}),{});try{return await u.post("v1/enrich-identifiers",{headers:{"x-transcend-request-id":n,"x-transcend-enricher-id":f},json:{enrichedIdentifiers:o}}).json(),r.error(v.green(`Successfully enriched request: ${S}${n}`)),!0}catch(e){if(typeof e.response.body=="string"&&e.response.body.includes("Cannot update a resolved RequestEnricher"))return r.warn(v.magenta(`Skipped enrichment for request: ${S}${n}, request is no longer in the enriching phase.`)),!1;throw r.error(v.red(`Failed to enricher identifiers for request with id: ${S}${n} - ${e.message} - ${e.response.body}`)),e}}import h from"colors";async function ge({file:u,auth:s,sombraAuth:g,enricherId:f,markSilent:p,concurrency:n=100,transcendUrl:o=b}){let e=await E(o,s,g),d=y(o,s);r.info(h.magenta(`Reading "${u}" from disk`));let i=x(u,M);r.info(h.magenta(`Enriching "${i.length}" privacy requests.`));let l=0,a=0,t=0;if(await R(i,async(c,I)=>{try{p&&(await j(d,T,{input:{id:c.id,isSilent:!0}}),r.info(h.magenta(`Mark request as silent mode - ${c.id}`))),await N(e,c,f,I)?l+=1:a+=1}catch{t+=1}},{concurrency:n}),r.info(h.green(`Successfully notified Transcend!
2
2
  Success count: ${l}.`)),a>0&&r.info(h.magenta(`Skipped count: ${a}.`)),t>0)throw r.info(h.red(`Error Count: ${t}.`)),new Error(`Failed to enrich: ${t} requests.`);return i.length}export{te as a,M as b,N as c,ge as d};
3
- //# sourceMappingURL=chunk-HGLIJXXG.js.map
3
+ //# sourceMappingURL=chunk-6P4FW6XR.js.map
@@ -1,2 +1,2 @@
1
- import{q as N}from"./chunk-TR32ZRNC.js";import{De as U,_b as F,a as v,b as q,pe as D,qe as R,ve as O,wa as G}from"./chunk-WEQUQAB7.js";import{a as t}from"./chunk-43JWXG77.js";import{e as T}from"./chunk-L5ULN3IT.js";import*as e from"io-ts";import{decodeCodec as Y}from"@transcend-io/type-utils";var Z=e.type({identifier:e.string,type:e.string,coreIdentifier:e.string,dataSiloId:e.string,requestId:e.string,nonce:e.string,requestCreatedAt:e.string,daysUntilOverdue:e.number,attributes:e.array(e.type({key:e.string,values:e.array(e.string)}))});async function L(r,{dataSiloId:s,limit:c=100,offset:n=0,requestType:a}){try{let i=await r.get(`v1/data-silo/${s}/pending-requests/${a}`,{searchParams:{offset:n,limit:c}}).json(),{items:f}=Y(e.type({items:e.array(Z)}),i);return f}catch(i){throw new Error(`Received an error from server: ${i?.response?.body||i?.message}`)}}import*as S from"io-ts";var B=S.type({nonce:S.string,identifier:S.string});async function j(r,{nonce:s,identifier:c}){try{return await r.put("v1/data-silo",{headers:{"x-transcend-nonce":s},json:{profiles:[{profileId:c}]}}),!0}catch(n){if(n.response?.statusCode===409)return!1;throw new Error(`Received an error from server: ${n?.response?.body||n?.message}`)}}import{chunk as W}from"lodash-es";import p from"colors";import Q from"cli-progress";async function ue({file:r,dataSiloId:s,auth:c,sombraAuth:n,concurrency:a=100,transcendUrl:i=T,sleepSeconds:f=10}){let y=await R(i,c,n);t.info(p.magenta(`Reading "${r}" from disk`));let o=N(r,B);t.info(p.magenta(`Notifying Transcend for data silo "${s}" marking "${o.length}" identifiers as completed.`));let C=new Date().getTime(),w=new Q.SingleBar({},Q.Presets.shades_classic),d=0,u=0,l=0;w.start(o.length,0);let m=W(o,a),I=m.length;await v(m,async($,P)=>{t.info(p.blue(`Processing chunk ${P+1}/${I} (${W.length} items)`)),await q($,async h=>{try{await j(y,h)?d+=1:u+=1}catch(b){t.error(p.red(`Error notifying Transcend for identifier "${h.identifier}" - ${b?.message}`)),l+=1}w.update(d+u)}),f>0&&P<I-1&&(t.info(p.yellow(`Sleeping for ${f}s before next chunk...`)),await new Promise(h=>{setTimeout(h,f*1e3)}))}),w.stop();let x=new Date().getTime()-C;if(t.info(p.green(`Successfully notified Transcend for ${d} identifiers in "${x/1e3}" seconds!`)),u&&t.info(p.magenta(`There were ${u} identifiers that were not in a state to be updated.They likely have already been resolved.`)),l)throw t.error(p.red(`There were ${l} identifiers that failed to be updated. Please review the logs for more information.`)),new Error("Failed to update all identifiers");return o.length}import z from"colors";import H from"cli-progress";import{RequestDataSiloStatus as ee}from"@transcend-io/privacy-types";async function Te({requestIds:r,dataSiloId:s,auth:c,concurrency:n=100,status:a=ee.Resolved,transcendUrl:i=T}){let f=D(i,c),y=new Date().getTime(),o=new H.SingleBar({},H.Presets.shades_classic);t.info(z.magenta(`Notifying Transcend for data silo "${s}" marking "${r.length}" requests as completed.`));let C=0;o.start(r.length,0),await q(r,async u=>{let l=await U(f,{requestId:u,dataSiloId:s});try{await F(f,G,{requestDataSiloId:l.id,status:a})}catch(m){if(!m.message.includes("Client error: Request must be active:"))throw m}C+=1,o.update(C)},{concurrency:n}),o.stop();let d=new Date().getTime()-y;return t.info(z.green(`Successfully notified Transcend in "${d/1e3}" seconds!`)),r.length}import k from"colors";import J from"cli-progress";async function ke({dataSiloId:r,auth:s,sombraAuth:c,actions:n,apiPageSize:a=100,savePageSize:i=1e3,onSave:f,transcendUrl:y=T,skipRequestCount:o=!1}){if(i%a!==0)throw new Error(`savePageSize must be a multiple of apiPageSize. savePageSize: ${i}, apiPageSize: ${a}`);let C=await R(y,s,c),w=D(y,s),d=0;o||(d=await O(w,{dataSiloId:r})),t.info(k.magenta(`Pulling ${o?"all":d} outstanding request identifiers for data silo: "${r}" for requests of types "${n.join('", "')}"`));let u=new Date().getTime(),l=new J.SingleBar({},J.Presets.shades_classic),m=new Set,I=[],g=[];o||l.start(d,0),await v(n,async $=>{let P=0,h=!0;for(;h;){let b=await L(C,{dataSiloId:r,limit:a,offset:P,requestType:$}),E=b.map(A=>(m.add(A.requestId),{...A,action:$})),M=E.map(({attributes:A,...V})=>({...V,...A.reduce((X,_)=>Object.assign(X,{[_.key]:_.values.join(",")}),{})}));I.push(...E),g.push(...M),g.length>=i&&(await f(g),g=[]),h=b.length===a,P+=a,o?t.info(k.magenta(`Pulled ${b.length} outstanding identifiers for ${m.size} requests`)):l.update(m.size)}}),g.length>0&&await f(g),o||l.stop();let x=new Date().getTime()-u;return t.info(k.green(`Successfully pulled ${I.length} outstanding identifiers from ${m.size} requests in "${x/1e3}" seconds!`)),{identifiers:I}}export{Z as a,L as b,B as c,j as d,ue as e,Te as f,ke as g};
2
- //# sourceMappingURL=chunk-UUBO75GS.js.map
1
+ import{q as N}from"./chunk-ZTD7APNF.js";import{De as U,_b as F,a as v,b as q,pe as D,qe as R,ve as O,wa as G}from"./chunk-TDBKATQK.js";import{a as t}from"./chunk-43JWXG77.js";import{e as T}from"./chunk-L5ULN3IT.js";import*as e from"io-ts";import{decodeCodec as Y}from"@transcend-io/type-utils";var Z=e.type({identifier:e.string,type:e.string,coreIdentifier:e.string,dataSiloId:e.string,requestId:e.string,nonce:e.string,requestCreatedAt:e.string,daysUntilOverdue:e.number,attributes:e.array(e.type({key:e.string,values:e.array(e.string)}))});async function L(r,{dataSiloId:s,limit:c=100,offset:n=0,requestType:a}){try{let i=await r.get(`v1/data-silo/${s}/pending-requests/${a}`,{searchParams:{offset:n,limit:c}}).json(),{items:f}=Y(e.type({items:e.array(Z)}),i);return f}catch(i){throw new Error(`Received an error from server: ${i?.response?.body||i?.message}`)}}import*as S from"io-ts";var B=S.type({nonce:S.string,identifier:S.string});async function j(r,{nonce:s,identifier:c}){try{return await r.put("v1/data-silo",{headers:{"x-transcend-nonce":s},json:{profiles:[{profileId:c}]}}),!0}catch(n){if(n.response?.statusCode===409)return!1;throw new Error(`Received an error from server: ${n?.response?.body||n?.message}`)}}import{chunk as W}from"lodash-es";import p from"colors";import Q from"cli-progress";async function ue({file:r,dataSiloId:s,auth:c,sombraAuth:n,concurrency:a=100,transcendUrl:i=T,sleepSeconds:f=10}){let y=await R(i,c,n);t.info(p.magenta(`Reading "${r}" from disk`));let o=N(r,B);t.info(p.magenta(`Notifying Transcend for data silo "${s}" marking "${o.length}" identifiers as completed.`));let C=new Date().getTime(),w=new Q.SingleBar({},Q.Presets.shades_classic),d=0,u=0,l=0;w.start(o.length,0);let m=W(o,a),I=m.length;await v(m,async($,P)=>{t.info(p.blue(`Processing chunk ${P+1}/${I} (${W.length} items)`)),await q($,async h=>{try{await j(y,h)?d+=1:u+=1}catch(b){t.error(p.red(`Error notifying Transcend for identifier "${h.identifier}" - ${b?.message}`)),l+=1}w.update(d+u)}),f>0&&P<I-1&&(t.info(p.yellow(`Sleeping for ${f}s before next chunk...`)),await new Promise(h=>{setTimeout(h,f*1e3)}))}),w.stop();let x=new Date().getTime()-C;if(t.info(p.green(`Successfully notified Transcend for ${d} identifiers in "${x/1e3}" seconds!`)),u&&t.info(p.magenta(`There were ${u} identifiers that were not in a state to be updated.They likely have already been resolved.`)),l)throw t.error(p.red(`There were ${l} identifiers that failed to be updated. Please review the logs for more information.`)),new Error("Failed to update all identifiers");return o.length}import z from"colors";import H from"cli-progress";import{RequestDataSiloStatus as ee}from"@transcend-io/privacy-types";async function Te({requestIds:r,dataSiloId:s,auth:c,concurrency:n=100,status:a=ee.Resolved,transcendUrl:i=T}){let f=D(i,c),y=new Date().getTime(),o=new H.SingleBar({},H.Presets.shades_classic);t.info(z.magenta(`Notifying Transcend for data silo "${s}" marking "${r.length}" requests as completed.`));let C=0;o.start(r.length,0),await q(r,async u=>{let l=await U(f,{requestId:u,dataSiloId:s});try{await F(f,G,{requestDataSiloId:l.id,status:a})}catch(m){if(!m.message.includes("Client error: Request must be active:"))throw m}C+=1,o.update(C)},{concurrency:n}),o.stop();let d=new Date().getTime()-y;return t.info(z.green(`Successfully notified Transcend in "${d/1e3}" seconds!`)),r.length}import k from"colors";import J from"cli-progress";async function ke({dataSiloId:r,auth:s,sombraAuth:c,actions:n,apiPageSize:a=100,savePageSize:i=1e3,onSave:f,transcendUrl:y=T,skipRequestCount:o=!1}){if(i%a!==0)throw new Error(`savePageSize must be a multiple of apiPageSize. savePageSize: ${i}, apiPageSize: ${a}`);let C=await R(y,s,c),w=D(y,s),d=0;o||(d=await O(w,{dataSiloId:r})),t.info(k.magenta(`Pulling ${o?"all":d} outstanding request identifiers for data silo: "${r}" for requests of types "${n.join('", "')}"`));let u=new Date().getTime(),l=new J.SingleBar({},J.Presets.shades_classic),m=new Set,I=[],g=[];o||l.start(d,0),await v(n,async $=>{let P=0,h=!0;for(;h;){let b=await L(C,{dataSiloId:r,limit:a,offset:P,requestType:$}),E=b.map(A=>(m.add(A.requestId),{...A,action:$})),M=E.map(({attributes:A,...V})=>({...V,...A.reduce((X,_)=>Object.assign(X,{[_.key]:_.values.join(",")}),{})}));I.push(...E),g.push(...M),g.length>=i&&(await f(g),g=[]),h=b.length===a,P+=a,o?t.info(k.magenta(`Pulled ${b.length} outstanding identifiers for ${m.size} requests`)):l.update(m.size)}}),g.length>0&&await f(g),o||l.stop();let x=new Date().getTime()-u;return t.info(k.green(`Successfully pulled ${I.length} outstanding identifiers from ${m.size} requests in "${x/1e3}" seconds!`)),{identifiers:I}}export{Z as a,L as b,B as c,j as d,ue as e,Te as f,ke as g};
2
+ //# sourceMappingURL=chunk-7QHA6ZIV.js.map
@@ -1,2 +1,2 @@
1
- import{k as i}from"./chunk-TR32ZRNC.js";import o from"inquirer";import m from"inquirer-autocomplete-prompt";async function c({message:e}){let{response:r}=await o.prompt([{name:"response",message:e,type:"confirm"}]);return r}async function l({message:e}){let{response:r}=await o.prompt([{name:"response",message:e,type:"text",validate:t=>t.trim().length>0}]);return r}async function y({defaultValue:e,values:r,message:t}){o.registerPrompt("autocomplete",m);let{response:p}=await o.prompt([{name:"response",message:t,type:"autocomplete",default:e,source:(a,n)=>n?r.filter(s=>typeof s=="string"&&i(n,s)):r}]);return p}export{c as a,l as b,y as c};
2
- //# sourceMappingURL=chunk-AB4DHWRB.js.map
1
+ import{k as i}from"./chunk-ZTD7APNF.js";import o from"inquirer";import m from"inquirer-autocomplete-prompt";async function c({message:e}){let{response:r}=await o.prompt([{name:"response",message:e,type:"confirm"}]);return r}async function l({message:e}){let{response:r}=await o.prompt([{name:"response",message:e,type:"text",validate:t=>t.trim().length>0}]);return r}async function y({defaultValue:e,values:r,message:t}){o.registerPrompt("autocomplete",m);let{response:p}=await o.prompt([{name:"response",message:t,type:"autocomplete",default:e,source:(a,n)=>n?r.filter(s=>typeof s=="string"&&i(n,s)):r}]);return p}export{c as a,l as b,y as c};
2
+ //# sourceMappingURL=chunk-HH2PQ3PQ.js.map
@@ -1,4 +1,4 @@
1
- import{e as o,f as i}from"./chunk-L5ULN3IT.js";import{d as n}from"./chunk-ARVEJERC.js";import{buildCommand as p,numberParser as m}from"@stricli/core";import{ConsentTrackerStatus as u}from"@transcend-io/privacy-types";import{ScopeName as f,TRANSCEND_SCOPES as s}from"@transcend-io/privacy-types";function b(e){if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e))throw new Error(`Invalid UUID format: ${e}`);return e}function a(e){try{return new URL(e).toString().replace(/\/$/,"")}catch{throw new Error(`Invalid URL format: ${e}`)}}function g(e){return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function S(e){let r=new Date(e);if(Number.isNaN(r.getTime()))throw new TypeError(`Invalid date: ${e}. Try using the ISO 8601 format (YYYY-MM-DDTHH:MM:SS.SSSZ)`);return r}var l=({scopes:e,requiresSiloScope:r=!1})=>{let t={kind:"parsed",parse:String,brief:"The Transcend API key."};return r&&(t.brief+=" This key must be associated with the data silo(s) being operated on."),e==="Varies"?{...t,brief:`${t.brief} The scopes required will vary depending on the operation performed. If in doubt, the ${s[f.FullAdmin].title} scope will always work.`}:e.length===0?{...t,brief:`${t.brief} No scopes are required for this command.`}:{...t,brief:`${t.brief} Requires scopes: ${e.map(c=>`"${s[c].title}"`).join(", ")}`}},d=(e=o)=>({kind:"parsed",parse:a,brief:"URL of the Transcend backend. Use https://api.us.transcend.io for US hosting",default:e}),U=(e=i)=>({kind:"parsed",parse:a,brief:"URL of the Transcend consent backend. Use https://consent.us.transcend.io for US hosting",default:e}),D=()=>({kind:"parsed",parse:String,brief:"The Sombra internal key, use for additional authentication when self-hosting Sombra",optional:!0});var h=["dataSilos","enrichers","templates","apiKeys"],v=Object.values(u),C=p({loader:async()=>{let{pull:e}=await import("./impl-42N5BEEM.js");return e},parameters:{flags:{auth:l({scopes:"Varies"}),resources:{kind:"enum",values:["all",...Object.values(n)],brief:`The different resource types to pull in. Defaults to ${h.join(",")}.`,variadic:",",optional:!0},file:{kind:"parsed",parse:String,brief:"Path to the YAML file to pull into",default:"./transcend.yml"},transcendUrl:d(),dataSiloIds:{kind:"parsed",parse:String,variadic:",",brief:"The UUIDs of the data silos that should be pulled into the YAML file",optional:!0},integrationNames:{kind:"parsed",parse:String,variadic:",",brief:"The types of integrations to pull down",optional:!0},trackerStatuses:{kind:"enum",values:Object.values(u),variadic:",",brief:"The statuses of consent manager trackers to pull down. Defaults to all statuses.",optional:!0},pageSize:{kind:"parsed",parse:m,brief:"The page size to use when paginating over the API",default:"50"},skipDatapoints:{kind:"boolean",brief:"When true, skip pulling in datapoints alongside data silo resource",default:!1},skipSubDatapoints:{kind:"boolean",brief:"When true, skip pulling in subDatapoints alongside data silo resource",default:!1},includeGuessedCategories:{kind:"boolean",brief:"When true, included guessed data categories that came from the content classifier",default:!1},debug:{kind:"boolean",brief:"Set to true to include debug logs while pulling the configuration",default:!1}}},docs:{brief:"Pull metadata from Transcend into transcend.yml",fullDescription:`Generates a transcend.yml by pulling the configuration from your Transcend instance.
1
+ import{e as o,f as i}from"./chunk-L5ULN3IT.js";import{d as n}from"./chunk-ARVEJERC.js";import{buildCommand as p,numberParser as m}from"@stricli/core";import{ConsentTrackerStatus as u}from"@transcend-io/privacy-types";import{ScopeName as f,TRANSCEND_SCOPES as s}from"@transcend-io/privacy-types";function b(e){if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e))throw new Error(`Invalid UUID format: ${e}`);return e}function a(e){try{return new URL(e).toString().replace(/\/$/,"")}catch{throw new Error(`Invalid URL format: ${e}`)}}function g(e){return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function S(e){let r=new Date(e);if(Number.isNaN(r.getTime()))throw new TypeError(`Invalid date: ${e}. Try using the ISO 8601 format (YYYY-MM-DDTHH:MM:SS.SSSZ)`);return r}var l=({scopes:e,requiresSiloScope:r=!1})=>{let t={kind:"parsed",parse:String,brief:"The Transcend API key."};return r&&(t.brief+=" This key must be associated with the data silo(s) being operated on."),e==="Varies"?{...t,brief:`${t.brief} The scopes required will vary depending on the operation performed. If in doubt, the ${s[f.FullAdmin].title} scope will always work.`}:e.length===0?{...t,brief:`${t.brief} No scopes are required for this command.`}:{...t,brief:`${t.brief} Requires scopes: ${e.map(c=>`"${s[c].title}"`).join(", ")}`}},d=(e=o)=>({kind:"parsed",parse:a,brief:"URL of the Transcend backend. Use https://api.us.transcend.io for US hosting",default:e}),U=(e=i)=>({kind:"parsed",parse:a,brief:"URL of the Transcend consent backend. Use https://consent.us.transcend.io for US hosting",default:e}),D=()=>({kind:"parsed",parse:String,brief:"The Sombra internal key, use for additional authentication when self-hosting Sombra",optional:!0});var h=["dataSilos","enrichers","templates","apiKeys"],v=Object.values(u),C=p({loader:async()=>{let{pull:e}=await import("./impl-3M5R6G5M.js");return e},parameters:{flags:{auth:l({scopes:"Varies"}),resources:{kind:"enum",values:["all",...Object.values(n)],brief:`The different resource types to pull in. Defaults to ${h.join(",")}.`,variadic:",",optional:!0},file:{kind:"parsed",parse:String,brief:"Path to the YAML file to pull into",default:"./transcend.yml"},transcendUrl:d(),dataSiloIds:{kind:"parsed",parse:String,variadic:",",brief:"The UUIDs of the data silos that should be pulled into the YAML file",optional:!0},integrationNames:{kind:"parsed",parse:String,variadic:",",brief:"The types of integrations to pull down",optional:!0},trackerStatuses:{kind:"enum",values:Object.values(u),variadic:",",brief:"The statuses of consent manager trackers to pull down. Defaults to all statuses.",optional:!0},pageSize:{kind:"parsed",parse:m,brief:"The page size to use when paginating over the API",default:"50"},skipDatapoints:{kind:"boolean",brief:"When true, skip pulling in datapoints alongside data silo resource",default:!1},skipSubDatapoints:{kind:"boolean",brief:"When true, skip pulling in subDatapoints alongside data silo resource",default:!1},includeGuessedCategories:{kind:"boolean",brief:"When true, included guessed data categories that came from the content classifier",default:!1},debug:{kind:"boolean",brief:"Set to true to include debug logs while pulling the configuration",default:!1}}},docs:{brief:"Pull metadata from Transcend into transcend.yml",fullDescription:`Generates a transcend.yml by pulling the configuration from your Transcend instance.
2
2
 
3
3
  The API key needs various scopes depending on the resources being pulled (see the CLI's README for more details).
4
4
 
@@ -6,4 +6,4 @@ This command can be helpful if you are looking to:
6
6
 
7
7
  - Copy your data into another instance
8
8
  - Generate a transcend.yml file as a starting point to maintain parts of your data inventory in code.`}});export{b as a,g as b,S as c,l as d,d as e,U as f,D as g,h,v as i,C as j};
9
- //# sourceMappingURL=chunk-GD7WEHDA.js.map
9
+ //# sourceMappingURL=chunk-INLBXSQE.js.map
@@ -1,4 +1,4 @@
1
- import{_b as S,a as w,f as $,i as B,j as T,l as R}from"./chunk-WEQUQAB7.js";import{a as i}from"./chunk-43JWXG77.js";import{keyBy as O,uniq as A,chunk as U,sortBy as G}from"lodash-es";import{SubDataPointDataSubCategoryGuessStatus as _}from"@transcend-io/privacy-types";import h from"cli-progress";import{gql as L}from"graphql-request";import f from"colors";async function q(u,{dataSiloIds:e=[],includeGuessedCategories:l,includeAttributes:a,parentCategories:c=[],subCategories:t=[],pageSize:p=1e3}={}){let n=[],m=new Date().getTime(),d=new h.SingleBar({},h.Presets.shades_classic),s={...c.length>0?{category:c}:{},...t.length>0?{subCategoryIds:t}:{},...c.length+t.length>0&&!l?{status:_.Approved}:{},...e.length>0?{dataSilos:e}:{}},{subDataPoints:{totalCount:o}}=await S(u,$,{filterBy:s});i.info(f.magenta("[Step 1/3] Pulling in all subdatapoints")),d.start(o,0);let y=0,D=!1,r,b=0;do try{let{subDataPoints:{nodes:P}}=await S(u,L`
1
+ import{_b as S,a as w,f as $,i as B,j as T,l as R}from"./chunk-TDBKATQK.js";import{a as i}from"./chunk-43JWXG77.js";import{keyBy as O,uniq as A,chunk as U,sortBy as G}from"lodash-es";import{SubDataPointDataSubCategoryGuessStatus as _}from"@transcend-io/privacy-types";import h from"cli-progress";import{gql as L}from"graphql-request";import f from"colors";async function q(u,{dataSiloIds:e=[],includeGuessedCategories:l,includeAttributes:a,parentCategories:c=[],subCategories:t=[],pageSize:p=1e3}={}){let n=[],m=new Date().getTime(),d=new h.SingleBar({},h.Presets.shades_classic),s={...c.length>0?{category:c}:{},...t.length>0?{subCategoryIds:t}:{},...c.length+t.length>0&&!l?{status:_.Approved}:{},...e.length>0?{dataSilos:e}:{}},{subDataPoints:{totalCount:o}}=await S(u,$,{filterBy:s});i.info(f.magenta("[Step 1/3] Pulling in all subdatapoints")),d.start(o,0);let y=0,D=!1,r,b=0;do try{let{subDataPoints:{nodes:P}}=await S(u,L`
2
2
  query TranscendCliSubDataPointCsvExport(
3
3
  $filterBy: SubDataPointFiltersInput
4
4
  $first: Int!
@@ -72,4 +72,4 @@ import{_b as S,a as w,f as $,i as B,j as T,l as R}from"./chunk-WEQUQAB7.js";impo
72
72
  }
73
73
  }
74
74
  `,{first:t,offset:r,filterBy:{...d}});D=g[g.length-1]?.id,p.push(...g),y=g.length===t,o+=g.length,r+=g.length,m.update(o)}catch(g){throw i.error(v.red(`An error fetching subdatapoints for cursor ${D} and offset ${r}`)),g}while(y);m.stop();let I=new Date().getTime()-n,C=V(p,"name");return i.info(v.green(`Successfully pulled in ${C.length} subdatapoints in ${I/1e3} seconds!`)),C}export{H as a,st as b};
75
- //# sourceMappingURL=chunk-GSXHJEKW.js.map
75
+ //# sourceMappingURL=chunk-KRN6Q433.js.map
@@ -1,2 +1,2 @@
1
- import{fa as p}from"./chunk-LAYHULHH.js";import{Fe as h,Ge as z,Ie as $,Je as w,a as y,oe as u,zc as A}from"./chunk-WEQUQAB7.js";import{a as i}from"./chunk-43JWXG77.js";import{e as S}from"./chunk-L5ULN3IT.js";import n from"colors";async function H({email:r,password:a,scopes:f,apiKeyTitle:t,parentOrganizationId:o,deleteExistingApiKey:l=!0,createNewApiKey:x=!0,transcendUrl:k=S}){let s=await u(k,{});i.info(n.magenta("Logging in using email and password."));let{roles:d,loginCookie:P}=await h(s,{email:r,password:a});i.info(n.green(`Successfully logged in and found ${d.length} role${d.length===1?"":"s"}!`));let K=o?d.filter(e=>e.organization.id===o||e.organization.parentOrganizationId===o):d;s.setHeaders({Cookie:P});let m=[],c=[];return i.info(n.magenta(`Generating API keys with title: ${t}, scopes: ${f.join(",")}.`)),await y(K,async e=>{try{await z(s,{roleId:e.id,email:r}),i.info(n.magenta(`Checking if API key already exists in organization "${e.organization.name}" with title: "${t}".`));let[g]=await A(s,[t]);if(g&&l)i.info(n.yellow(`Deleting existing API key in "${e.organization.name}" with title: "${t}".`)),await w(s,g.id),i.info(n.green(`Successfully deleted API key in "${e.organization.name}" with title: "${t}".`));else if(g)throw new Error(`API key already exists with title: "${t}"`);if(x){i.info(n.magenta(`Creating API key in "${e.organization.name}" with title: "${t}".`));let{apiKey:N}=await $(s,{title:t,scopes:f});m.push({organizationName:e.organization.name,organizationId:e.organization.id,apiKey:N}),i.info(n.green(`Successfully created API key in "${e.organization.name}" with title: "${t}".`))}else m.push({organizationName:e.organization.name,organizationId:e.organization.id,apiKey:""})}catch(g){i.error(n.red(`Failed to create API key in organization "${e.organization.name}"! - ${g.message}`)),c.push({organizationName:e.organization.name,organizationId:e.organization.id,error:g.message})}}),i.info(n.green(`Successfully created ${m.length} API key${m.length===1?"":"s"}`)),c.length>0&&i.error(n.red(`Failed to create ${c.length} API key${c.length===1?"":"s"}!`)),{errors:c,apiKeys:m}}import{decodeCodec as C}from"@transcend-io/type-utils";import E from"colors";import*as I from"io-ts";import{existsSync as G,readFileSync as D}from"fs";function T(r){return r||(i.error(E.red("A Transcend API key must be provided. You can specify using --auth=$TRANSCEND_API_KEY")),process.exit(1)),G(r)?C(I.array(p),D(r,"utf-8")):r}import{existsSync as F,readdirSync as b}from"fs";function Z(r,a,f=!1){if(!F(r))return[];let t=b(r).filter(o=>a?a.filter(l=>o.endsWith(l)).length:!0).filter(o=>o.indexOf(".")>0);return f?t.map(o=>o.replace(/\.[^/.]+$/,"")):t}import{readdirSync as R,statSync as _}from"fs";import{join as L}from"path";function te(r){return R(r).filter(a=>_(L(r,a)).isDirectory())}export{H as a,T as b,Z as c,te as d};
2
- //# sourceMappingURL=chunk-R6QTIUFA.js.map
1
+ import{fa as p}from"./chunk-LAYHULHH.js";import{Fe as h,Ge as z,Ie as $,Je as w,a as y,oe as u,zc as A}from"./chunk-TDBKATQK.js";import{a as i}from"./chunk-43JWXG77.js";import{e as S}from"./chunk-L5ULN3IT.js";import n from"colors";async function H({email:r,password:a,scopes:f,apiKeyTitle:t,parentOrganizationId:o,deleteExistingApiKey:l=!0,createNewApiKey:x=!0,transcendUrl:k=S}){let s=await u(k,{});i.info(n.magenta("Logging in using email and password."));let{roles:d,loginCookie:P}=await h(s,{email:r,password:a});i.info(n.green(`Successfully logged in and found ${d.length} role${d.length===1?"":"s"}!`));let K=o?d.filter(e=>e.organization.id===o||e.organization.parentOrganizationId===o):d;s.setHeaders({Cookie:P});let m=[],c=[];return i.info(n.magenta(`Generating API keys with title: ${t}, scopes: ${f.join(",")}.`)),await y(K,async e=>{try{await z(s,{roleId:e.id,email:r}),i.info(n.magenta(`Checking if API key already exists in organization "${e.organization.name}" with title: "${t}".`));let[g]=await A(s,[t]);if(g&&l)i.info(n.yellow(`Deleting existing API key in "${e.organization.name}" with title: "${t}".`)),await w(s,g.id),i.info(n.green(`Successfully deleted API key in "${e.organization.name}" with title: "${t}".`));else if(g)throw new Error(`API key already exists with title: "${t}"`);if(x){i.info(n.magenta(`Creating API key in "${e.organization.name}" with title: "${t}".`));let{apiKey:N}=await $(s,{title:t,scopes:f});m.push({organizationName:e.organization.name,organizationId:e.organization.id,apiKey:N}),i.info(n.green(`Successfully created API key in "${e.organization.name}" with title: "${t}".`))}else m.push({organizationName:e.organization.name,organizationId:e.organization.id,apiKey:""})}catch(g){i.error(n.red(`Failed to create API key in organization "${e.organization.name}"! - ${g.message}`)),c.push({organizationName:e.organization.name,organizationId:e.organization.id,error:g.message})}}),i.info(n.green(`Successfully created ${m.length} API key${m.length===1?"":"s"}`)),c.length>0&&i.error(n.red(`Failed to create ${c.length} API key${c.length===1?"":"s"}!`)),{errors:c,apiKeys:m}}import{decodeCodec as C}from"@transcend-io/type-utils";import E from"colors";import*as I from"io-ts";import{existsSync as G,readFileSync as D}from"fs";function T(r){return r||(i.error(E.red("A Transcend API key must be provided. You can specify using --auth=$TRANSCEND_API_KEY")),process.exit(1)),G(r)?C(I.array(p),D(r,"utf-8")):r}import{existsSync as F,readdirSync as b}from"fs";function Z(r,a,f=!1){if(!F(r))return[];let t=b(r).filter(o=>a?a.filter(l=>o.endsWith(l)).length:!0).filter(o=>o.indexOf(".")>0);return f?t.map(o=>o.replace(/\.[^/.]+$/,"")):t}import{readdirSync as R,statSync as _}from"fs";import{join as L}from"path";function te(r){return R(r).filter(a=>_(L(r,a)).isDirectory())}export{H as a,T as b,Z as c,te as d};
2
+ //# sourceMappingURL=chunk-MVDOKJ6J.js.map
@@ -0,0 +1,2 @@
1
+ var s="A command line interface for programmatic operations across Transcend.",i="7.0.0-alpha.13";export{s as a,i as b};
2
+ //# sourceMappingURL=chunk-SF46ZLPT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"author\": \"Transcend Inc.\",\n \"name\": \"@transcend-io/cli\",\n \"description\": \"A command line interface for programmatic operations across Transcend.\",\n \"version\": \"7.0.0-alpha.13\",\n \"homepage\": \"https://github.com/transcend-io/cli\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/transcend-io/cli.git\"\n },\n \"type\": \"module\",\n \"license\": \"UNLICENSED\",\n \"main\": \"dist/index.js\",\n \"bin\": {\n \"transcend\": \"dist/bin/cli.js\",\n \"__cli_bash_complete\": \"dist/bin/bash-complete.js\",\n \"__tr-build-xdi-sync-endpoint\": \"dist/bin/deprecated-command.js\",\n \"__tr-consent-manager-service-json-to-yml\": \"dist/bin/deprecated-command.js\",\n \"__tr-consent-managers-to-business-entities\": \"dist/bin/deprecated-command.js\",\n \"__tr-cron-mark-identifiers-completed\": \"dist/bin/deprecated-command.js\",\n \"__tr-cron-pull-identifiers\": \"dist/bin/deprecated-command.js\",\n \"__tr-cron-pull-profiles\": \"dist/bin/deprecated-command.js\",\n \"__tr-derive-data-silos-from-data-flows\": \"dist/bin/deprecated-command.js\",\n \"__tr-derive-data-silos-from-data-flows-cross-instance\": \"dist/bin/deprecated-command.js\",\n \"__tr-discover-silos\": \"dist/bin/deprecated-command.js\",\n \"__tr-generate-api-keys\": \"dist/bin/deprecated-command.js\",\n \"__tr-manual-enrichment-pull-identifiers\": \"dist/bin/deprecated-command.js\",\n \"__tr-manual-enrichment-push-identifiers\": \"dist/bin/deprecated-command.js\",\n \"__tr-mark-request-data-silos-completed\": \"dist/bin/deprecated-command.js\",\n \"__tr-pull\": \"dist/bin/deprecated-command.js\",\n \"__tr-pull-consent-metrics\": \"dist/bin/deprecated-command.js\",\n \"__tr-pull-consent-preferences\": \"dist/bin/deprecated-command.js\",\n \"__tr-pull-datapoints\": \"dist/bin/deprecated-command.js\",\n \"__tr-pull-unstructured-discovery-files\": \"dist/bin/deprecated-command.js\",\n \"__tr-push\": \"dist/bin/deprecated-command.js\",\n \"__tr-request-approve\": \"dist/bin/deprecated-command.js\",\n \"__tr-request-cancel\": \"dist/bin/deprecated-command.js\",\n \"__tr-request-download-files\": \"dist/bin/deprecated-command.js\",\n \"__tr-request-enricher-restart\": \"dist/bin/deprecated-command.js\",\n \"__tr-request-export\": \"dist/bin/deprecated-command.js\",\n \"__tr-request-mark-silent\": \"dist/bin/deprecated-command.js\",\n \"__tr-request-notify-additional-time\": \"dist/bin/deprecated-command.js\",\n \"__tr-request-reject-unverified-identifiers\": \"dist/bin/deprecated-command.js\",\n \"__tr-request-restart\": \"dist/bin/deprecated-command.js\",\n \"__tr-request-upload\": \"dist/bin/deprecated-command.js\",\n \"__tr-retry-request-data-silos\": \"dist/bin/deprecated-command.js\",\n \"__tr-scan-packages\": \"dist/bin/deprecated-command.js\",\n \"__tr-skip-request-data-silos\": \"dist/bin/deprecated-command.js\",\n \"__tr-sync-ot\": \"dist/bin/deprecated-command.js\",\n \"__tr-update-consent-manager\": \"dist/bin/deprecated-command.js\",\n \"__tr-upload-consent-preferences\": \"dist/bin/deprecated-command.js\",\n \"__tr-upload-cookies-from-csv\": \"dist/bin/deprecated-command.js\",\n \"__tr-upload-data-flows-from-csv\": \"dist/bin/deprecated-command.js\",\n \"__tr-upload-preferences\": \"dist/bin/deprecated-command.js\"\n },\n \"engines\": {\n \"node\": \">=18\"\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"start\": \"./dist/bin/cli.js\",\n \"prebuild\": \"tsc -p tsconfig.json\",\n \"build\": \"tsup\",\n \"build:watch\": \"tsup --watch\",\n \"prepublishOnly\": \"pnpm lint && pnpm build && pnpm test && pnpm publint\",\n \"lint\": \"pnpm run --parallel --aggregate-output \\\"/^lint:*/\\\"\",\n \"lint:prettier\": \"prettier --check . --log-level warn\",\n \"lint:types\": \"tsc --noEmit\",\n \"lint:eslint\": \"eslint .\",\n \"format\": \"prettier --write .\",\n \"test\": \"vitest run\",\n \"script:transcend-json-schema\": \"tsx scripts/buildTranscendJsonSchema.ts && prettier ./transcend-yml-schema-*.json --write\",\n \"script:pathfinder-json-schema\": \"tsx scripts/buildPathfinderJsonSchema.ts && prettier ./pathfinder-policy-yml-schema.json --write\",\n \"script:build-readme-docs\": \"tsx scripts/buildReadmeDocs.ts\"\n },\n \"tsup\": {\n \"entry\": [\n \"src/bin/cli.ts\",\n \"src/bin/bash-complete.ts\",\n \"src/bin/deprecated-command.ts\",\n \"src/index.ts\"\n ],\n \"format\": [\n \"esm\"\n ],\n \"sourcemap\": true,\n \"dts\": true,\n \"tsconfig\": \"tsconfig.json\",\n \"clean\": true,\n \"splitting\": true,\n \"minify\": true\n },\n \"dependencies\": {\n \"@stricli/auto-complete\": \"^1.2.0\",\n \"@stricli/core\": \"^1.2.0\",\n \"@transcend-io/airgap.js-types\": \"^12.12.1\",\n \"@transcend-io/handlebars-utils\": \"^1.1.0\",\n \"@transcend-io/internationalization\": \"^1.6.0\",\n \"@transcend-io/persisted-state\": \"^1.0.4\",\n \"@transcend-io/privacy-types\": \"^4.124.1\",\n \"@transcend-io/secret-value\": \"^1.2.0\",\n \"@transcend-io/type-utils\": \"^1.8.0\",\n \"JSONStream\": \"^1.3.5\",\n \"cli-progress\": \"^3.11.2\",\n \"colors\": \"^1.4.0\",\n \"csv-parse\": \"^5.6.0\",\n \"fast-csv\": \"^4.3.6\",\n \"fast-glob\": \"^3.2.12\",\n \"fp-ts\": \"^2.16.1\",\n \"fuzzysearch\": \"^1.0.3\",\n \"global-agent\": \"^3.0.0\",\n \"got\": \"^11.8.5\",\n \"graphql-request\": \"^5.0.0\",\n \"inquirer\": \"=7.3.3\",\n \"inquirer-autocomplete-prompt\": \"=1.3.0\",\n \"io-ts\": \"^2.2.21\",\n \"io-ts-types\": \"^0.5.16\",\n \"js-yaml\": \"^4.1.0\",\n \"jsonwebtoken\": \"^9.0.2\",\n \"lodash-es\": \"^4.17.21\",\n \"query-string\": \"=7.0.0\",\n \"semver\": \"^7.6.0\",\n \"undici\": \"^5.22.1\",\n \"yargs-parser\": \"^21.1.1\"\n },\n \"devDependencies\": {\n \"@types/JSONStream\": \"npm:@types/jsonstream@^0.8.33\",\n \"@types/cli-progress\": \"^3.11.0\",\n \"@types/colors\": \"^1.2.1\",\n \"@types/fuzzysearch\": \"^1.0.0\",\n \"@types/global-agent\": \"^2.1.1\",\n \"@types/inquirer\": \"^7.3.1\",\n \"@types/inquirer-autocomplete-prompt\": \"^3.0.0\",\n \"@types/js-yaml\": \"^4.0.5\",\n \"@types/json-schema\": \"^7.0.15\",\n \"@types/jsonwebtoken\": \"^9\",\n \"@types/lodash-es\": \"^4.17.12\",\n \"@types/node\": \"^18.15.11\",\n \"@types/semver\": \"^7\",\n \"@types/yargs-parser\": \"^21.0.0\",\n \"@typescript-eslint/eslint-plugin\": \"^5.58.0\",\n \"@typescript-eslint/parser\": \"^5.58.0\",\n \"depcheck\": \"^1.4.3\",\n \"doctoc\": \"^2.2.1\",\n \"eslint\": \"^8.38.0\",\n \"eslint-config-airbnb-base\": \"^15.0.0\",\n \"eslint-import-resolver-typescript\": \"^3.5.5\",\n \"eslint-plugin-eslint-comments\": \"^3.2.0\",\n \"eslint-plugin-import\": \"2.27.5\",\n \"eslint-plugin-jsdoc\": \"^41.1.1\",\n \"fdir\": \"^6.4.6\",\n \"prettier\": \"^2.8.7\",\n \"publint\": \"^0.3.12\",\n \"tsup\": \"^8.5.0\",\n \"tsx\": \"^4.20.3\",\n \"typescript\": \"^5.0.4\",\n \"vite-tsconfig-paths\": \"^5.1.4\",\n \"vitest\": \"^3.2.4\"\n },\n \"packageManager\": \"pnpm@10.12.4+sha512.5ea8b0deed94ed68691c9bad4c955492705c5eeb8a87ef86bc62c74a26b037b08ff9570f108b2e4dbd1dd1a9186fea925e527f141c648e85af45631074680184\"\n}\n"],"mappings":"AAGE,IAAAA,EAAe,yEACfC,EAAW","names":["description","version"]}
@@ -1,4 +1,4 @@
1
- import{a}from"./chunk-43JWXG77.js";import{b as di}from"./chunk-XWOTEZCO.js";async function T(t,e){let n=[];for(let r=0;r<t.length;r+=1)n.push(await e(t[r],r,t.length));return n}async function M(t,e,n={}){let{concurrency:r=1/0}=n,i=new Array(t.length),s=[],o=0,l=async()=>{if(o>=t.length)return;let d=o;o+=1;let m=e(t[d],d,t.length).then(h=>{i[d]=h});s.push(m),await m;let g=s.indexOf(m);g>-1&&s.splice(g,1)},u=Math.min(r,t.length),c=[];for(let d=0;d<u;d+=1)c.push(l());for(await Promise.all(c);o<t.length;)s.length<r?await l():await Promise.race(s);return await Promise.all(s),i}import{gql as Me}from"graphql-request";var fi=Me`
1
+ import{a}from"./chunk-43JWXG77.js";import{b as di}from"./chunk-SF46ZLPT.js";async function T(t,e){let n=[];for(let r=0;r<t.length;r+=1)n.push(await e(t[r],r,t.length));return n}async function M(t,e,n={}){let{concurrency:r=1/0}=n,i=new Array(t.length),s=[],o=0,l=async()=>{if(o>=t.length)return;let d=o;o+=1;let m=e(t[d],d,t.length).then(h=>{i[d]=h});s.push(m),await m;let g=s.indexOf(m);g>-1&&s.splice(g,1)},u=Math.min(r,t.length),c=[];for(let d=0;d<u;d+=1)c.push(l());for(await Promise.all(c);o<t.length;)s.length<r?await l():await Promise.race(s);return await Promise.all(s),i}import{gql as Me}from"graphql-request";var fi=Me`
2
2
  query TranscendCliDataPoints(
3
3
  $filterBy: DataPointFiltersInput
4
4
  $first: Int!
@@ -2828,4 +2828,4 @@ ${Ee.join(`
2828
2828
  `)}`)),s=!0;else try{await p(e,Ci,V)}catch(X){a.info(N.red(`
2829
2829
  Failed to update datapoint "${A.key}" for data silo "${Q}"! -
2830
2830
  ${X.message}`)),s=!0}I+=1,m.update(I)})},{concurrency:10}),m.stop();let H=new Date().getTime()-o;return a.info(N.green(`Synced "${t.length}" data silos and "${h}" datapoints in "${H/1e3}" seconds!`)),{success:!s,dataSiloTitleToId:cp(u,({id:G})=>G)}}async function fs(t,e){let n=!1;a.info(N.magenta(`Syncing "${e.length}" data silo dependencies...`));let r=Sn(e,En);return await T(r,async(i,s)=>{a.info(N.magenta(`[Batch ${s}/${i.length}] Updating "${i.length}" data silos...`));try{await p(t,Ht,{input:{dataSilos:i.map(([o,l])=>({id:o,dependedOnDataSiloTitles:l}))}}),a.info(N.green(`[Batch ${s+1}/${i.length}] Synced "${i.length}" data silos!`))}catch(o){n=!0,a.info(N.red(`[Batch ${s+1}/${i.length}] Failed to update "${i.length}" silos! - ${o.message}`))}}),!n}async function gs(t){let{consentManager:{consentManager:e}}=await p(t,to);return e}async function ie(t,e){let{consentManager:{consentManager:n}}=await p(t,eo,{},{},e);return n.id}var Rn=50;async function Et(t){let e=[],n=0,r=!1;do{let{experiences:{nodes:i}}=await p(t,Yr,{first:Rn,offset:n});e.push(...i),n+=Rn,r=i.length===Rn}while(r);return e.sort((i,s)=>i.name.localeCompare(s.name))}var dp=(n=>(n.Hourly="1h",n.Daily="1d",n))(dp||{});async function Af(t,e){let{analyticsData:{series:n}}=await p(t,Io,{input:e});return n}async function ys(t,e){let{consentManagerTheme:{theme:n}}=await p(t,no,{airgapBundleId:e});return n}import Rt from"colors";import{chunk as fp}from"lodash-es";var gp=100;async function yp(t,e){let n=await ie(t);await T(fp(e,gp),async r=>{await p(t,zr,{airgapBundleId:n,cookies:r.map(i=>({name:i.name,trackingPurposes:i.trackingPurposes&&i.trackingPurposes.length>0?i.trackingPurposes:void 0,description:i.description,service:i.service,status:i.status,attributes:i.attributes,isRegex:i.isRegex}))})})}async function Cs(t,e){let n=!1;a.info(Rt.magenta(`Syncing "${e.length}" cookies...`));let r=e.filter(i=>e.filter(s=>i.name===s.name&&i.isRegex===s.isRegex).length>1);if(r.length>0)throw new Error(`Failed to upload cookies as there were non-unique entries found: ${r.map(({name:i})=>i).join(",")}`);try{a.info(Rt.magenta(`Upserting "${e.length}" new cookies...`)),await yp(t,e),a.info(Rt.green(`Successfully synced ${e.length} cookies!`))}catch(i){n=!0,a.info(Rt.red(`Failed to create cookies! - ${i.message}`))}return!n}var wn=20;async function wt(t){let e=[],n=0,r=!1;do{let{teams:{nodes:i}}=await p(t,wr,{first:wn,offset:n});e.push(...i),n+=wn,r=i.length===wn}while(r);return e.sort((i,s)=>i.name.localeCompare(s.name))}async function hs(t,{dataSubject:e,dataSubjectId:n,skipPublish:r=!1}){await p(t,Li,{input:{id:n,title:e.title,adminDashboardDefaultSilentMode:e.adminDashboardDefaultSilentMode,actions:e.actions,skipPublish:r&&typeof e.active>"u"}}),typeof e.active=="boolean"&&await p(t,ki,{input:{id:n,active:e.active,skipPublish:r}})}import{keyBy as Cp,uniq as hp,difference as Ip}from"lodash-es";import Is from"colors";var $n=20,Ap="https://app.transcend.io/infrastructure/api-keys";async function Tp(t,e){let n=[],r=0,i=!1;do{let{apiKeys:{nodes:s}}=await p(t,qi,{first:$n,offset:r,titles:e});n.push(...s),r+=$n,i=s.length===$n}while(i);return n.sort((s,o)=>s.title.localeCompare(o.title))}async function $t({"api-keys":t=[],"data-silos":e=[]},n,r=!1){a.info(Is.magenta(`Fetching ${r?"all":t.length} API keys...`));let i=t.map(({title:d})=>d),s=hp(e.map(d=>d["api-key-title"]).filter(d=>!!d)),o=[...s,...i],l=await Tp(n,r?void 0:[...s,...i]),u=Cp(l,"title"),c=Ip(o,l.map(({title:d})=>d));return c.length>0&&(a.info(Is.red(`Failed to find API keys "${c.join('", "')}"! Make sure these API keys are created at: ${Ap}`)),process.exit(1)),u}var bn=20;async function Be(t,{text:e,titles:n=[],ids:r=[]}={}){let i=[],s=0,o=!1;do{let{prompts:{nodes:l}}=await p(t,fr,{first:bn,offset:s,filterBy:{...e?{text:e}:{},...n.length>0?{title:n}:{},...r.length>0?{id:r}:{}}});i.push(...l),s+=bn,o=l.length===bn}while(o);return i.sort((l,u)=>l.title.localeCompare(u.title))}async function Kf(t,{promptTitles:e=[],promptIds:n=[]}={}){let{promptsWithVariables:r}=await p(t,Cr,{input:{...e.length>0?{promptTitles:e}:{},...n.length>0?{promptIds:n}:{}}});return r}import fe from"colors";import{keyBy as Pp}from"lodash-es";async function Sp(t,e){let{createPrompt:{prompt:n}}=await p(t,Ir,{input:e});return a.info(fe.green(`Successfully created prompt "${e.title}"!`)),n.id}async function Ep(t,e){await p(t,hr,{input:{prompts:e.map(([n,r])=>({...n,id:r}))}}),a.info(fe.green(`Successfully updated ${e.length} prompts!`))}async function As(t,e,n=20){let r=!1;a.info(fe.magenta(`Syncing "${e.length}" prompts...`));let i=await Be(t),s=Pp(i,"title"),o=e.map(c=>[c,s[c.title]?.id]),l=o.filter(([,c])=>!c).map(([c])=>c);try{a.info(fe.magenta(`Creating "${l.length}" new prompts...`)),await M(l,async c=>{await Sp(t,c)},{concurrency:n}),a.info(fe.green(`Successfully synced ${l.length} prompts!`))}catch(c){r=!0,a.info(fe.red(`Failed to create prompts! - ${c.message}`))}let u=o.filter(c=>!!c[1]);try{a.info(fe.magenta(`Updating "${u.length}" prompts...`)),await Ep(t,u),a.info(fe.green(`Successfully updated "${u.length}" prompts!`))}catch(c){r=!0,a.info(fe.red(`Failed to create prompts! - ${c.message}`))}return a.info(fe.green(`Synced "${e.length}" prompts!`)),!r}async function ft(t){let{organization:e}=await p(t,Do);return e.deployedPrivacyCenterUrl}async function Ke(t,e){let n=e;n||(n=await ft(t));let{privacyCenter:r}=await p(t,xo,{url:n});return r.id}async function bt(t){let e=await ft(t),{privacyCenterPolicies:n}=await p(t,tr,{url:e});return n.sort((r,i)=>r.title.defaultMessage.localeCompare(i.title.defaultMessage))}import xt from"colors";import{chunk as Rp,keyBy as wp}from"lodash-es";var $p=100;async function bp(t,e){let n=await Ke(t);await T(Rp(e,$p),async r=>{await p(t,nr,{privacyCenterId:n,policies:r.map(([i,s])=>({id:s,title:i.title,disableEffectiveOn:i.disableEffectiveOn,disabledLocales:i.disabledLocales,...i.effectiveOn||i.content?{version:{...i.effectiveOn?{effectiveOn:i.effectiveOn}:{},...i.content?{content:{defaultMessage:i.content}}:{}}}:{}}))})})}async function Ts(t,e){let n=!1;a.info(xt.magenta(`Syncing "${e.length}" policies...`));let r=e.filter(o=>e.filter(l=>o.title===l.title).length>1);if(r.length>0)throw new Error(`Failed to upload policies as there were non-unique entries found: ${r.map(({title:o})=>o).join(",")}`);let i=await bt(t),s=wp(i,({title:o})=>o.defaultMessage);try{a.info(xt.magenta(`Upserting "${e.length}" new policies...`)),await bp(t,e.map(o=>[o,s[o.title]?.id])),a.info(xt.green(`Successfully synced ${e.length} policies!`))}catch(o){n=!0,a.info(xt.red(`Failed to create policies! - ${o.message}`))}return!n}import Dt from"colors";import{chunk as xp}from"lodash-es";var Dp=100;async function Lp(t,e){await T(xp(e,Dp),async n=>{await p(t,sr,{messages:n.map(r=>({...r.id.includes(".")?{}:{id:r.id},defaultMessage:r.defaultMessage,targetReactIntlId:r.targetReactIntlId,translations:r.translations?Object.entries(r.translations).map(([i,s])=>({locale:i,value:s})):void 0}))})})}async function Ps(t,e){let n=!1;a.info(Dt.magenta(`Syncing "${e.length}" messages...`));let r=e.filter(i=>e.filter(s=>i.id===s.id).length>1);if(r.length>0)throw new Error(`Failed to upload messages as there were non-unique entries found: ${r.map(({id:i})=>i).join(",")}`);try{a.info(Dt.magenta(`Upserting "${e.length}" new messages...`)),await Lp(t,e),a.info(Dt.green(`Successfully synced ${e.length} messages!`))}catch(i){n=!0,a.info(Dt.red(`Failed to create messages! - ${i.message}`))}return!n}import xn from"colors";async function Ss(t,e){let n=!1;a.info(xn.magenta("Syncing privacy center..."));let r=await Ke(t);try{await p(t,ko,{input:{privacyCenterId:r,transformAccessReportJsonToCsv:e.transformAccessReportJsonToCsv,useCustomEmailDomain:e.useCustomEmailDomain,useNoReplyEmailAddress:e.useNoReplyEmailAddress,replyToEmail:e.replyToEmail,supportEmail:e.supportEmail,preferBrowserDefaultLocale:e.preferBrowserDefaultLocale,defaultLocale:e.defaultLocale,locales:e.locales,showMarketingPreferences:e.showMarketingPreferences,showManageYourPrivacy:e.showManageYourPrivacy,showPolicies:e.showPolicies,showConsentManager:e.showConsentManager,showDataFlows:e.showDataFlows,showCookies:e.showCookies,showTrackingTechnologies:e.showTrackingTechnologies,showPrivacyRequestButton:e.showPrivacyRequestButton,isDisabled:e.isDisabled,...e.theme?{colorPalette:e.theme.colors,componentStyles:e.theme.componentStyles,textStyles:e.theme.textStyles}:{}}}),a.info(xn.green("Successfully synced privacy center!"))}catch(i){n=!0,a.info(xn.red(`Failed to create privacy center! - ${i.message}`))}return!n}import Es from"colors";import{difference as kp}from"lodash-es";var Dn=50;async function gt(t){let e=[],n=0,r=!1;do{let{consentPartitions:{nodes:i}}=await p(t,Zr,{first:Dn,offset:n});e.push(...i),n+=Dn,r=i.length===Dn}while(r);return e.sort((i,s)=>i.name.localeCompare(s.name))}async function Rs(t,e){let n=await ie(t),r=!1,i=await gt(t),s=kp(e.map(({name:o})=>o),i.map(({name:o})=>o));return await T(s,async o=>{try{await p(t,ho,{input:{id:n,name:o}}),a.info(Es.green(`Successfully created consent partition: ${o}!`))}catch(l){a.error(Es.red(`Failed to create consent partition: ${o}! - ${l.message}`)),r=!0}}),!r}var Ln=20;async function Lt(t,{includeDeleted:e=!1}={}){let n=[],r=0,i=!1;do{let{purposes:{nodes:s}}=await p(t,mr,{first:Ln,offset:r,input:{includeDeleted:e}});n.push(...s),r+=Ln,i=s.length===Ln}while(i);return n.sort((s,o)=>s.trackingType.localeCompare(o.trackingType))}import ws from"colors";import{keyBy as $s}from"lodash-es";import{InitialViewState as _p,OnConsentExpiry as Gp}from"@transcend-io/airgap.js-types";var bs="https://app.transcend.io/consent-manager/regional-experiences/purposes";async function vp(t,e){let n=await Et(t),r=$s(n,"name"),i=await Lt(t),s=$s(i,"trackingType");await M(e,async(o,l)=>{let u=o.purposes?.map((m,g)=>{let h=s[m.trackingType];if(!h)throw new Error(`Invalid purpose trackingType provided at consentManager.experiences[${l}].purposes[${g}]: ${m.trackingType}. See list of valid purposes ${bs}`);return h.id}),c=o.optedOutPurposes?.map((m,g)=>{let h=s[m.trackingType];if(!h)throw new Error(`Invalid purpose trackingType provided at consentManager.experiences[${l}].optedOutPurposes[${g}]: ${m.trackingType}. See list of valid purposes ${bs}`);return h.id}),d=r[o.name];d?(await p(t,yo,{input:{id:d.id,name:o.displayName,regions:o.regions,operator:o.operator,onConsentExpiry:o.onConsentExpiry,consentExpiry:o.consentExpiry,displayPriority:o.displayPriority!==d.displayPriority?o.displayPriority:void 0,viewState:o.viewState,purposes:u,optedOutPurposes:c,browserLanguages:o.browserLanguages,browserTimeZones:o.browserTimeZones}}),a.info(ws.green(`Successfully synced consent experience "${o.name}"!`))):(await p(t,Co,{input:{name:o.name,displayName:o.displayName,regions:o.regions,operator:o.operator,onConsentExpiry:o.onConsentExpiry||Gp.Prompt,consentExpiry:o.consentExpiry,displayPriority:o.displayPriority,viewState:o.viewState||_p.Hidden,purposes:u||[],optedOutPurposes:c||[],browserLanguages:o.browserLanguages,browserTimeZones:o.browserTimeZones}}),a.info(ws.green(`Successfully created consent experience "${o.name}"!`)))},{concurrency:10})}async function xs(t,e){let n;try{n=await ie(t,1)}catch(r){if(r.message.includes("AirgapBundle not found")){let i=await Ke(t),{createConsentManager:s}=await p(t,io,{domains:e.domains,privacyCenterId:i});n=s.consentManager.id}else throw r}if(e.domains&&await p(t,ao,{domains:e.domains,airgapBundleId:n}),e.partition){let i=(await gt(t)).find(s=>s.name===e.partition);if(!i)throw new Error(`Partition "${e.partition}" not found. Please create the partition first.`);await p(t,po,{partitionId:i.id,airgapBundleId:n})}e.version&&await p(t,ro,{airgapBundleId:n,version:e.version}),(e.uspapi||e.signedIabAgreement)&&await p(t,lo,{input:{id:n,...e.uspapi?{uspapi:e.uspapi}:{},...e.signedIabAgreement?{signedIabAgreement:e.signedIabAgreement}:{}}}),e.unknownRequestPolicy&&await p(t,co,{input:{id:n,unknownRequestPolicy:e.unknownRequestPolicy}}),e.unknownRequestPolicy&&await p(t,mo,{input:{id:n,unknownCookiePolicy:e.unknownCookiePolicy}}),e.telemetryPartitioning&&await p(t,uo,{input:{id:n,strategy:e.telemetryPartitioning}}),e.consentPrecedence&&await p(t,fo,{input:{id:n,consentPrecedence:e.consentPrecedence}}),e.experiences&&await vp(t,e.experiences),e.theme&&await p(t,go,{input:{airgapBundleId:n,...e.theme}})}import Ls from"colors";import{AttributeKeyType as Ds}from"@transcend-io/privacy-types";var Ve=100;async function qp(t,e){a.info(Ls.magenta(`Fetching all attribute values for ${e}...`));let n=[],r=0,i=!1;do{let{attributeValues:{nodes:s}}=await p(t,Br,{first:Ve,offset:r,attributeKeyId:e});n.push(...s),r+=Ve,i=s.length===Ve}while(i);return n.sort((s,o)=>s.name.localeCompare(o.name))}var Op=[Ds.MultiSelect,Ds.SingleSelect];async function je(t){a.info(Ls.magenta("Fetching all attributes..."));let e=[],n=0,r=!1;do{let{attributeKeys:{nodes:i}}=await p(t,Mr,{first:Ve,offset:n});e.push(...await Promise.all(i.map(async s=>({...s,values:Op.includes(s.type)?await qp(t,s.id):[]})))),n+=Ve,r=i.length===Ve}while(r);return e.sort((i,s)=>i.name.localeCompare(s.name))}var kn=20;async function kt(t){let e=[],n=0,r=!1;do{let{businessEntities:{nodes:i}}=await p(t,Ao,{first:kn,offset:n});e.push(...i),n+=kn,r=i.length===kn}while(r);return e.sort((i,s)=>i.title.localeCompare(s.title))}import{keyBy as Np,chunk as Mp}from"lodash-es";import Ye from"colors";async function Up(t,e){let n={title:e.title,description:e.description,address:e.address,headquarterCountry:e.headquarterCountry,headquarterSubDivision:e.headquarterSubDivision,dataProtectionOfficerName:e.dataProtectionOfficerName,dataProtectionOfficerEmail:e.dataProtectionOfficerEmail,attributes:e.attributes,teamNames:e.teams,ownerEmails:e.owners},{createBusinessEntity:r}=await p(t,To,{input:n});return r.businessEntity}async function Fp(t,e){let n=Mp(e,100);await T(n,async r=>{await p(t,Po,{input:r.map(([i,s])=>({id:s,title:i.title,description:i.description,address:i.address,headquarterCountry:i.headquarterCountry,headquarterSubDivision:i.headquarterSubDivision,dataProtectionOfficerName:i.dataProtectionOfficerName,dataProtectionOfficerEmail:i.dataProtectionOfficerEmail,attributes:i.attributes,teamNames:i.teams,ownerEmails:i.owners}))})})}async function ks(t,e){a.info(Ye.magenta(`Syncing "${e.length}" business entities...`));let n=!1,r=await kt(t),i=Np(r,"title"),s=e.filter(o=>!i[o.title]);await T(s,async o=>{try{let l=await Up(t,o);i[l.title]=l,a.info(Ye.green(`Successfully synced business entity "${o.title}"!`))}catch(l){n=!0,a.info(Ye.red(`Failed to sync business entity "${o.title}"! - ${l.message}`))}});try{a.info(Ye.magenta(`Updating "${e.length}" business entities!`)),await Fp(t,e.map(o=>[o,i[o.title].id])),a.info(Ye.green(`Successfully synced "${e.length}" business entities!`))}catch(o){n=!0,a.info(Ye.red(`Failed to sync "${e.length}" business entities ! - ${o.message}`))}return!n}import{ConsentTrackerStatus as _s}from"@transcend-io/privacy-types";var _n=20;async function Ze(t,e=_s.Live){let n=[],r=0,i=await ie(t),s=!1;do{let{dataFlows:{nodes:o}}=await p(t,Jr,{first:_n,offset:r,airgapBundleId:i,status:e,...e===_s.NeedsReview?{showZeroActivity:!0}:{}});n.push(...o),r+=_n,s=o.length===_n}while(s);return n.sort((o,l)=>o.value.localeCompare(l.value))}import{chunk as vs}from"lodash-es";import Ie from"colors";import{ConsentTrackerStatus as Gs}from"@transcend-io/privacy-types";var qs=100;async function Qp(t,e,n=!1){let r=await ie(t);await T(vs(e,qs),async i=>{await p(t,Wr,{airgapBundleId:r,dataFlows:i.map(([s,o])=>({id:o,value:s.value,type:s.type,trackingType:s.trackingPurposes&&s.trackingPurposes.length>0?s.trackingPurposes:void 0,description:s.description,service:s.service,status:s.status,attributes:s.attributes})),classifyService:n})})}async function Bp(t,e,n=!1){let r=await ie(t);await T(vs(e,qs),async i=>{await p(t,Hr,{airgapBundleId:r,dataFlows:i.map(s=>({value:s.value,type:s.type,trackingType:s.trackingPurposes&&s.trackingPurposes.length>0?s.trackingPurposes:void 0,description:s.description,service:s.service,status:s.status,attributes:s.attributes})),dropMatchingDataFlowsInTriage:!0,classifyService:n})})}async function Os(t,e,n){let r=!1;a.info(Ie.magenta(`Syncing "${e.length}" data flows...`));let i=e.filter(m=>e.filter(g=>m.value===g.value&&m.type===g.type).length>1);if(i.length>0)throw new Error(`Failed to upload data flows as there were non-unique entries found: ${i.map(({value:m})=>m).join(",")}`);a.info(Ie.magenta("Fetching data flows..."));let[s,o]=await Promise.all([Ze(t,Gs.Live),Ze(t,Gs.NeedsReview)]),l=[...s,...o],u=e.map(m=>[m,l.find(g=>m.value===g.value&&m.type===g.type)?.id]),c=u.filter(([,m])=>!m).map(([m])=>m);try{a.info(Ie.magenta(`Creating "${c.length}" new data flows...`)),await Bp(t,c,n),a.info(Ie.green(`Successfully synced ${c.length} data flows!`))}catch(m){r=!0,a.info(Ie.red(`Failed to create data flows! - ${m.message}`))}let d=u.filter(m=>!!m[1]);try{a.info(Ie.magenta(`Updating "${d.length}" data flows...`)),await Qp(t,d,n),a.info(Ie.green(`Successfully updated "${d.length}" data flows!`))}catch(m){r=!0,a.info(Ie.red(`Failed to create data flows! - ${m.message}`))}return a.info(Ie.green(`Synced "${e.length}" data flows!`)),!r}import{difference as Kp}from"lodash-es";import{IsoCountryCode as Vp,IsoCountrySubdivisionCode as jp}from"@transcend-io/privacy-types";var Yp=[...Object.values(Vp),...Object.values(jp)];async function Ns(t,{action:e,actionId:n,skipPublish:r=!1}){await p(t,Ro,{input:{id:n,skipSecondaryIfNoFiles:e.skipSecondaryIfNoFiles,skipDownloadableStep:e.skipDownloadableStep,requiresReview:e.requiresReview,waitingPeriod:e.waitingPeriod,skipPublish:r,regionList:e.regionBlockList?Kp(Yp,e.regionBlockList):e.regionList,regionDetectionMethod:e.regionDetectionMethod}})}var Gn=20;async function vn(t,e){let n=[],r=0,i=!1;do{let{templates:{nodes:s}}=await p(t,Bi,{first:Gn,offset:r,title:e});n.push(...s),r+=Gn,i=s.length===Gn}while(i);return n.sort((s,o)=>s.title.localeCompare(o.title))}async function Ms(t,e){(await vn(e,t.title)).find(({title:i})=>i===t.title)||await p(e,Ki,{title:t.title})}var qn=20;async function _t(t){let e=[],n=0,r=!1;do{let{actions:{nodes:i}}=await p(t,Eo,{first:qn,offset:n});e.push(...i),n+=qn,r=i.length===qn}while(r);return e.sort((i,s)=>i.type.localeCompare(s.type))}var On=20;async function Gt(t){let e=[],n=0,r=!1;do{let{promptPartials:{nodes:i}}=await p(t,gr,{first:On,offset:n});e.push(...i),n+=On,r=i.length===On}while(r);return e.sort((i,s)=>i.title.localeCompare(s.title))}var Nn=20;async function vt(t){let e=[],n=0,r=!1;do{let{promptGroups:{nodes:i}}=await p(t,yr,{first:Nn,offset:n});e.push(...i),n+=Nn,r=i.length===Nn}while(r);return e.sort((i,s)=>i.title.localeCompare(s.title))}var Mn=20;async function qt(t,e={}){let n=[],r=0,i=!1;do{let{agents:{nodes:s}}=await p(t,vo,{first:Mn,offset:r,filterBy:e});n.push(...s),r+=Mn,i=s.length===Mn}while(i);return n.sort((s,o)=>s.name.localeCompare(o.name))}import{keyBy as Zp}from"lodash-es";import He from"colors";async function Hp(t,e){let n={name:e.name,description:e.description,codeInterpreterEnabled:e.codeInterpreterEnabled,retrievalEnabled:e.retrievalEnabled,promptTitle:e.prompt,largeLanguageModelName:e["large-language-model"].name,largeLanguageModelClient:e["large-language-model"].client},{createAgent:r}=await p(t,qo,{input:n});return r.agent}async function Wp(t,e){await p(t,Oo,{input:{agents:e.map(([n,r])=>({id:r,name:n.name,description:n.description,codeInterpreterEnabled:n.codeInterpreterEnabled,retrievalEnabled:n.retrievalEnabled}))}})}async function Us(t,e){a.info(He.magenta(`Syncing "${e.length}" agents...`));let n=!1,r=await qt(t),i=Zp(r,"name"),s=e.filter(o=>!i[o.name]);await T(s,async o=>{try{let l=await Hp(t,o);i[l.name]=l,a.info(He.green(`Successfully synced agent "${o.name}"!`))}catch(l){n=!0,a.info(He.red(`Failed to sync agent "${o.name}"! - ${l.message}`))}});try{a.info(He.magenta(`Updating "${e.length}" agents!`)),await Wp(t,e.map(o=>[o,i[o.name].id])),a.info(He.green(`Successfully synced "${e.length}" agents!`))}catch(o){n=!0,a.info(He.red(`Failed to sync "${e.length}" agents ! - ${o.message}`))}return!n}import{keyBy as zp}from"lodash-es";import yt from"colors";async function We(t,e={}){let{globalActionItemCollections:{nodes:n}}=await p(t,qr,{filterBy:{...e}});return n}async function Jp(t,e){let n={title:e.title,description:e.description||"",hidden:e.hidden||!1,productLine:e.productLine},{createActionItemCollection:r}=await p(t,Or,{input:n});return r.created}async function Xp(t,e,n){await p(t,Nr,{input:{id:n,title:e.title,description:e.description,hidden:e.hidden,productLine:e.productLine}})}async function Fs(t,e){let n=!1;a.info(yt.magenta(`Syncing "${e.length}" action item collections...`));let r=await We(t),i=zp(r,"title"),s=e.filter(l=>!i[l.title]);await T(s,async l=>{try{await Jp(t,l),a.info(yt.green(`Successfully created action item collection "${l.title}"!`))}catch(u){n=!0,a.info(yt.red(`Failed to create action item collection "${l.title}"! - ${u.message}`))}});let o=e.map(l=>[l,i[l.title]?.id]).filter(l=>!!l[1]);return await T(o,async([l,u])=>{try{await Xp(t,l,u),a.info(yt.green(`Successfully synced action item collection "${l.title}"!`))}catch(c){n=!0,a.info(yt.red(`Failed to sync action item collection "${l.title}"! - ${c.message}`))}}),!n}var Un=20;async function Ot(t,e={}){let n=[],r=0,i=!1;do{let{globalActionItems:{nodes:s}}=await p(t,wo,{first:Un,offset:r,filterBy:{...e,...e.startDueDate?{startDueDate:e.startDueDate.toISOString()}:{},...e.endDueDate?{endDueDate:e.endDueDate.toISOString()}:{}}});n.push(...s.map(o=>({...o,id:o.ids[0],title:o.titles[0],notes:o.notes[0],link:o.links[0]}))),r+=Un,i=s.length===Un}while(i);return n}import{uniq as el,keyBy as Nt,chunk as tl}from"lodash-es";import Ue from"colors";async function nl(t,e,n,r={}){let i=tl(e,100);await T(i,async s=>{await p(t,bo,{input:s.map(o=>({title:o.title,type:o.type,priorityOverride:o.priority,dueDate:o.dueDate,customerExperienceActionItemId:o.customerExperienceActionItemId,resolved:o.resolved,notes:o.notes,link:o.link,assigneesUserEmails:o.users,assigneesTeamNames:o.teams,...o.attributes?{}:{},collectionIds:o.collections.map(l=>n[l].id)}))})})}async function il(t,e,n,r={}){let i=s=>{let o=r[s];if(!o)throw new Error(`Attribute key "${s}" does not exist!`);return o.id};await p(t,$o,{input:{ids:[n],title:e.title,priorityOverride:e.priority,dueDate:e.dueDate,resolved:e.resolved,customerExperienceActionItemId:e.customerExperienceActionItemId,notes:e.notes,link:e.link,assigneesUserEmails:e.users,assigneesTeamNames:e.teams,...e.attributes?{attributes:e.attributes.map(({key:s,values:o})=>({attributeKeyId:i(s),attributeValueNames:o}))}:{}}})}function rl({title:t,collections:e}){return`${t}-${e.map(n=>n.title).sort().join("-")}`}function Qs({title:t,collections:e}){return`${t}-${e.sort().join("-")}`}async function Bs(t,e){let n=!1;a.info(Ue.magenta(`Syncing "${e.length}" actionItems...`));let r=e.some(I=>I.attributes&&I.attributes.length>0),[i,s,o]=await Promise.all([Ot(t),We(t),r?je(t):[]]),l=Nt(s,"title"),u=Nt(i,rl),c=Nt(o,"name"),d=Nt(i.filter(I=>!!I.customerExperienceActionItemIds),({customerExperienceActionItemIds:I})=>I[0]),m=el(e.map(I=>I.collections).flat()).filter(I=>!l[I]);if(m.length>0)return a.info(Ue.red(`Missing action item collections: "${m.join('", "')}" - please create them first!`)),!1;let g=e.filter(I=>!u[Qs(I)]&&!d[I.customerExperienceActionItemId]);if(g.length>0)try{a.info(Ue.magenta(`Creating "${g.length}" actionItems...`)),await nl(t,g,l,c),a.info(Ue.green(`Successfully created "${g.length}" actionItems!`))}catch(I){n=!0,a.info(Ue.red(`Failed to create action items! - ${I.message}`))}let h=e.map(I=>[I,u[Qs(I)]?.id||d[I.customerExperienceActionItemId]?.id]).filter(I=>!!I[1]);return await T(h,async([I,B])=>{try{await il(t,I,B,c),a.info(Ue.green(`Successfully synced action item "${I.title}"!`))}catch(H){n=!0,a.info(Ue.red(`Failed to sync action item "${I.title}"! - ${H.message}`))}}),!n}var Fn=20;async function Mt(t){let e=[],n=0,r=!1;do{let{agentFunctions:{nodes:i}}=await p(t,Fo,{first:Fn,offset:n});e.push(...i.map(s=>({...s,parameters:JSON.parse(s.parameters)}))),n+=Fn,r=i.length===Fn}while(r);return e.sort((i,s)=>i.name.localeCompare(s.name))}import{keyBy as ol}from"lodash-es";import ze from"colors";async function sl(t,e){let n={name:e.name,description:e.description,parameters:e.parameters,agentIds:[]},{createAgentFunction:r}=await p(t,Qo,{input:n});return r.agentFunction}async function al(t,e){await p(t,Bo,{input:{agentFunctions:e.map(([n,r])=>({id:r,name:n.name,description:n.description,parameters:n.parameters}))}})}async function Ks(t,e){a.info(ze.magenta(`Syncing "${e.length}" agent functions...`));let n=!1,r=await Mt(t),i=ol(r,"name"),s=e.filter(o=>!i[o.name]);await T(s,async o=>{try{let l=await sl(t,o);i[l.name]=l,a.info(ze.green(`Successfully synced agent function "${o.name}"!`))}catch(l){n=!0,a.info(ze.red(`Failed to sync agent function "${o.name}"! - ${l.message}`))}});try{a.info(ze.magenta(`Updating "${e.length}" agent functions!`)),await al(t,e.map(o=>[o,i[o.name].id])),a.info(ze.green(`Successfully synced "${e.length}" agent functions!`))}catch(o){n=!0,a.info(ze.red(`Failed to sync "${e.length}" agent functions! - ${o.message}`))}return!n}var Qn=20;async function Ut(t,e={}){let n=[],r=0,i=!1;do{let{agentFiles:{nodes:s}}=await p(t,No,{first:Qn,offset:r,filterBy:e});n.push(...s),r+=Qn,i=s.length===Qn}while(i);return n.sort((s,o)=>s.name.localeCompare(o.name))}import{keyBy as pl}from"lodash-es";import Je from"colors";async function ll(t,e){let n={name:e.name,description:e.description,fileId:e.fileId,size:e.size,purpose:e.purpose,fileUploadedAt:new Date,agentIds:[]},{createAgentFile:r}=await p(t,Mo,{input:n});return r.agentFile}async function cl(t,e){await p(t,Uo,{input:{agentFiles:e.map(([n,r])=>({id:r,name:n.name,description:n.description,fileId:n.fileId,size:n.size,purpose:n.purpose}))}})}async function Vs(t,e){a.info(Je.magenta(`Syncing "${e.length}" agent files...`));let n=!1,r=await Ut(t),i=pl(r,"name"),s=e.filter(o=>!i[o.name]);await T(s,async o=>{try{let l=await ll(t,o);i[l.name]=l,a.info(Je.green(`Successfully synced agent file "${o.name}"!`))}catch(l){n=!0,a.info(Je.red(`Failed to sync agent file "${o.name}"! - ${l.message}`))}});try{a.info(Je.magenta(`Updating "${e.length}" agent files!`)),await cl(t,e.map(o=>[o,i[o.name].id])),a.info(Je.green(`Successfully synced "${e.length}" agent files!`))}catch(o){n=!0,a.info(Je.red(`Failed to sync "${e.length}" agent files! - ${o.message}`))}return!n}var Bn=20;async function Ft(t){let e=[],n=0,r=!1;do{let{vendors:{nodes:i}}=await p(t,Ko,{first:Bn,offset:n});e.push(...i),n+=Bn,r=i.length===Bn}while(r);return e.sort((i,s)=>i.title.localeCompare(s.title))}import{keyBy as ml}from"lodash-es";import Xe from"colors";async function ul(t,e){let n={title:e.title,description:e.description,address:e.address,headquarterCountry:e.headquarterCountry,headquarterSubDivision:e.headquarterSubDivision,dataProcessingAgreementLink:e.dataProcessingAgreementLink,contactName:e.contactName,contactPhone:e.contactPhone,websiteUrl:e.websiteUrl},{createVendor:r}=await p(t,Vo,{input:n});return r.vendor}async function dl(t,e){await p(t,jo,{input:{vendors:e.map(([n,r])=>({id:r,title:n.title,description:n.description,address:n.address,headquarterCountry:n.headquarterCountry,headquarterSubDivision:n.headquarterSubDivision,dataProcessingAgreementLink:n.dataProcessingAgreementLink,contactName:n.contactName,contactPhone:n.contactPhone,websiteUrl:n.websiteUrl,attributes:n.attributes}))}})}async function js(t,e){a.info(Xe.magenta(`Syncing "${e.length}" vendors...`));let n=!1,r=await Ft(t),i=ml(r,"title"),s=e.filter(o=>!i[o.title]);await T(s,async o=>{try{let l=await ul(t,o);i[l.title]=l,a.info(Xe.green(`Successfully synced vendor "${o.title}"!`))}catch(l){n=!0,a.info(Xe.red(`Failed to sync vendor "${o.title}"! - ${l.message}`))}});try{a.info(Xe.magenta(`Updating "${e.length}" vendors!`)),await dl(t,e.map(o=>[o,i[o.title].id])),a.info(Xe.green(`Successfully synced "${e.length}" vendors!`))}catch(o){n=!0,a.info(Xe.red(`Failed to sync "${e.length}" vendors ! - ${o.message}`))}return!n}var Kn=20;async function Qt(t){let e=[],n=0,r=!1;do{let{dataSubCategories:{nodes:i}}=await p(t,Yo,{first:Kn,offset:n});e.push(...i),n+=Kn,r=i.length===Kn}while(r);return e.sort((i,s)=>i.name.localeCompare(s.name))}import{keyBy as fl}from"lodash-es";import et from"colors";async function gl(t,e){let n={name:e.name,category:e.category,description:e.description},{createDataCategory:r}=await p(t,Zo,{input:n});return r.dataCategory}async function yl(t,e){await p(t,Ho,{input:{dataSubCategories:e.map(([n,r])=>({id:r,description:n.description,attributes:n.attributes}))}})}async function Ys(t,e){a.info(et.magenta(`Syncing "${e.length}" data categories...`));let n=!1,r=await Qt(t),i=fl(r,({name:o,category:l})=>`${o}:${l}`),s=e.filter(o=>!i[`${o.name}:${o.category}`]);await T(s,async o=>{try{let l=await gl(t,o);i[`${l.name}:${l.category}`]=l,a.info(et.green(`Successfully synced data category "${o.name}"!`))}catch(l){n=!0,a.info(et.red(`Failed to sync data category "${o.name}"! - ${l.message}`))}});try{a.info(et.magenta(`Updating "${e.length}" data categories!`)),await yl(t,e.map(o=>[o,i[`${o.name}:${o.category}`].id])),a.info(et.green(`Successfully synced "${e.length}" data categories!`))}catch(o){n=!0,a.info(et.red(`Failed to sync "${e.length}" data categories ! - ${o.message}`))}return!n}var Vn=20;async function Bt(t){let e=[],n=0,r=!1;do{let{processingPurposeSubCategories:{nodes:i}}=await p(t,Wo,{first:Vn,offset:n});e.push(...i),n+=Vn,r=i.length===Vn}while(r);return e.sort((i,s)=>i.name.localeCompare(s.name))}import{keyBy as Cl}from"lodash-es";import tt from"colors";async function hl(t,e){let n={name:e.name,purpose:e.purpose,description:e.description},{createProcessingPurposeSubCategory:r}=await p(t,zo,{input:n});return r.processingPurposeSubCategory}async function Il(t,e){await p(t,Jo,{input:{processingPurposeSubCategories:e.map(([n,r])=>({id:r,description:n.description,attributes:n.attributes}))}})}async function Zs(t,e){a.info(tt.magenta(`Syncing "${e.length}" processing purposes...`));let n=!1,r=await Bt(t),i=Cl(r,({name:o,purpose:l})=>`${o}:${l}`),s=e.filter(o=>!i[`${o.name}:${o.purpose}`]);await T(s,async o=>{try{let l=await hl(t,o);i[`${l.name}:${l.purpose}`]=l,a.info(tt.green(`Successfully synced processing purpose "${o.name}"!`))}catch(l){n=!0,a.info(tt.red(`Failed to sync processing purpose "${o.name}"! - ${l.message}`))}});try{a.info(tt.magenta(`Updating "${e.length}" processing purposes!`)),await Il(t,e.map(o=>[o,i[`${o.name}:${o.purpose}`].id])),a.info(tt.green(`Successfully synced "${e.length}" processing purposes!`))}catch(o){n=!0,a.info(tt.red(`Failed to sync "${e.length}" processing purposes ! - ${o.message}`))}return!n}import L from"colors";import{keyBy as Al}from"lodash-es";import Ct from"colors";async function Tl(t,e){let n={name:e.name,description:e.description,ssoTitle:e["sso-title"],ssoDepartment:e["sso-department"],ssoGroup:e["sso-group"],scopes:e.scopes,userEmails:e.users},{createTeam:r}=await p(t,$r,{input:n});return r.team}async function Pl(t,e,n){let{updateTeam:r}=await p(t,br,{input:{id:n,name:e.name,description:e.description,ssoTitle:e["sso-title"],ssoDepartment:e["sso-department"],ssoGroup:e["sso-group"],scopes:e.scopes,userEmails:e.users}});return r.team}async function Hs(t,e){a.info(Ct.magenta(`Syncing "${e.length}" teams...`));let n=!1,r=await wt(t),i=Al(r,"name"),s=e.filter(l=>!i[l.name]),o=e.filter(l=>!!i[l.name]);return await T(s,async l=>{try{let u=await Tl(t,l);i[u.name]=u,a.info(Ct.green(`Successfully created team "${l.name}"!`))}catch(u){n=!0,a.info(Ct.red(`Failed to sync team "${l.name}"! - ${u.message}`))}}),await T(o,async l=>{try{let u=await Pl(t,l,i[l.name].id);i[u.name]=u,a.info(Ct.green(`Successfully updated team "${l.name}"!`))}catch(u){n=!0,a.info(Ct.red(`Failed to sync team "${l.name}"! - ${u.message}`))}}),!n}import ge from"colors";import{keyBy as Sl}from"lodash-es";async function El(t,e){let{createPromptPartial:{promptPartial:n}}=await p(t,Tr,{input:e});return a.info(ge.green(`Successfully created prompt partial "${e.title}"!`)),n.id}async function Rl(t,e){await p(t,Ar,{input:{promptPartials:e.map(([n,r])=>({...n,id:r}))}}),a.info(ge.green(`Successfully updated ${e.length} prompt partials!`))}async function Ws(t,e,n=20){let r=!1;a.info(ge.magenta(`Syncing "${e.length}" prompt partials...`));let i=await Gt(t),s=Sl(i,"title"),o=e.map(c=>[c,s[c.title]?.id]),l=o.filter(([,c])=>!c).map(([c])=>c);try{a.info(ge.magenta(`Creating "${l.length}" new prompt partials...`)),await M(l,async c=>{await El(t,c)},{concurrency:n}),a.info(ge.green(`Successfully synced ${l.length} prompt partials!`))}catch(c){r=!0,a.info(ge.red(`Failed to create prompt partials! - ${c.message}`))}let u=o.filter(c=>!!c[1]);try{a.info(ge.magenta(`Updating "${u.length}" prompt partials...`)),await Rl(t,u),a.info(ge.green(`Successfully updated "${u.length}" prompt partials!`))}catch(c){r=!0,a.info(ge.red(`Failed to create prompt partials! - ${c.message}`))}return a.info(ge.green(`Synced "${e.length}" prompt partials!`)),!r}import ye from"colors";import{keyBy as zs}from"lodash-es";async function wl(t,e){let{createPromptGroup:{promptGroup:n}}=await p(t,Sr,{input:e});return a.info(ye.green(`Successfully created prompt group "${e.title}"!`)),n.id}async function $l(t,e){await p(t,Pr,{input:{promptGroups:e.map(([n,r])=>({...n,id:r}))}}),a.info(ye.green(`Successfully updated ${e.length} prompt groups!`))}async function Js(t,e,n=20){let r=!1;a.info(ye.magenta(`Syncing "${e.length}" prompt groups...`));let i=await vt(t),s=await Be(t),o=zs(s,"title"),l=zs(i,"title"),u=e.map(m=>[m,l[m.title]?.id]),c=u.filter(([,m])=>!m).map(([m])=>m);try{a.info(ye.magenta(`Creating "${c.length}" new prompt groups...`)),await M(c,async m=>{await wl(t,{...m,promptIds:m.prompts.map(g=>{let h=o[g];if(!h)throw new Error(`Failed to find prompt with title: "${g}"`);return h.id})})},{concurrency:n}),a.info(ye.green(`Successfully synced ${c.length} prompt groups!`))}catch(m){r=!0,a.info(ye.red(`Failed to create prompt groups! - ${m.message}`))}let d=u.filter(m=>!!m[1]);try{a.info(ye.magenta(`Updating "${d.length}" prompt groups...`)),await $l(t,d.map(([{prompts:m,...g},h])=>[{...g,promptIds:m.map(I=>{let B=o[I];if(!B)throw new Error(`Failed to find prompt with title: "${I}"`);return B.id})},h])),a.info(ye.green(`Successfully updated "${d.length}" prompt groups!`))}catch(m){r=!0,a.info(ye.red(`Failed to create prompt groups! - ${m.message}`))}return a.info(ye.green(`Synced "${e.length}" prompt groups!`)),!r}var nt=10;async function zI(t,e,{pageSize:n=50,publishToPrivacyCenter:r=!0,classifyService:i=!1,deleteExtraAttributeValues:s=!1}){let o=!1;a.info(L.magenta(`Fetching data with page size ${n}...`));let{templates:l,attributes:u,actions:c,identifiers:d,"data-subjects":m,"business-entities":g,enrichers:h,cookies:I,"consent-manager":B,"data-silos":H,"data-flows":G,prompts:Q,"prompt-groups":A,"prompt-partials":j,agents:V,"agent-functions":Le,"agent-files":Ee,vendors:X,"data-categories":oe,"processing-purposes":Re,"action-items":we,"action-item-collections":ke,teams:$e,"privacy-center":se,messages:ot,policies:st,partitions:at}=t,[pt,Fe,ht]=await Promise.all([h||d?ts(t,e,!r):{},H||m||h?as(t,e):{},H&&H.map(y=>y["api-key-title"]||[]).reduce((y,k)=>y+k.length,0)>0?$t(t,e):{}]);if(B){a.info(L.magenta("Syncing consent manager..."));try{await xs(e,B),a.info(L.green("Successfully synced consent manager!"))}catch(y){o=!0,a.info(L.red(`Failed to sync consent manager! - ${y.message}`))}}if(Q){let y=await As(e,Q);o=o||!y}if(j){let y=await Ws(e,j);o=o||!y}if(A){let y=await Js(e,A);o=o||!y}if($e){let y=await Hs(e,$e);o=o||!y}if(l&&(a.info(L.magenta(`Syncing "${l.length}" email templates...`)),await M(l,async y=>{a.info(L.magenta(`Syncing template "${y.title}"...`));try{await Ms(y,e),a.info(L.green(`Successfully synced template "${y.title}"!`))}catch(k){o=!0,a.info(L.red(`Failed to sync template "${y.title}"! - ${k.message}`))}},{concurrency:nt}),a.info(L.green(`Synced "${l.length}" email templates!`))),g){let y=await ks(e,g);o=o||!y}if(X){let y=await js(e,X);o=o||!y}if(oe){let y=await Ys(e,oe);o=o||!y}if(Re){let y=await Zs(e,Re);o=o||!y}if(at){let y=await Rs(e,at);o=o||!y}if(V){let y=await Us(e,V);o=o||!y}if(Le){let y=await Ks(e,Le);o=o||!y}if(Ee){let y=await Vs(e,Ee);o=o||!y}if(I){let y=await Cs(e,I);o=o||!y}if(ke){let y=await Fs(e,ke);o=o||!y}if(u){a.info(L.magenta(`Syncing "${u.length}" attributes...`));let y=await je(e);await M(u,async k=>{let W=y.find(ee=>ee.name===k.name);a.info(L.magenta(`Syncing attribute "${k.name}"...`));try{await os(e,k,{existingAttribute:W,deleteExtraAttributeValues:s}),a.info(L.green(`Successfully synced attribute "${k.name}"!`))}catch(ee){o=!0,a.info(L.red(`Failed to sync attribute "${k.name}"! - ${ee.message}`))}},{concurrency:nt}),a.info(L.green(`Synced "${u.length}" attributes!`))}if(we){let y=await Bs(e,we);o=o||!y}if(h&&(a.info(L.magenta(`Syncing "${h.length}" enrichers...`)),await M(h,async y=>{a.info(L.magenta(`Syncing enricher "${y.title}"...`));try{await rs(e,{enricher:y,identifierByName:pt,dataSubjectsByName:Fe}),a.info(L.green(`Successfully synced enricher "${y.title}"!`))}catch(k){o=!0,a.info(L.red(`Failed to sync enricher "${y.title}"! - ${k.message}`))}},{concurrency:nt}),a.info(L.green(`Synced "${h.length}" enrichers!`))),d&&(a.info(L.magenta(`Syncing "${d.length}" identifiers...`)),await M(d,async y=>{let k=pt[y.name];if(!k)throw new Error(`Failed to find identifier with name: ${y.type}. Should have been auto-created by cli.`);a.info(L.magenta(`Syncing identifier "${y.type}"...`));try{await ns(e,{identifier:y,dataSubjectsByName:Fe,identifierId:k.id,skipPublish:!r}),a.info(L.green(`Successfully synced identifier "${y.type}"!`))}catch(W){o=!0,a.info(L.red(`Failed to sync identifier "${y.type}"! - ${W.message}`))}},{concurrency:nt}),a.info(L.green(`Synced "${d.length}" identifiers!`))),c){a.info(L.magenta(`Syncing "${c.length}" actions...`));let y=await _t(e);await M(c,async k=>{let W=y.find(ee=>ee.type===k.type);if(!W)throw new Error(`Failed to find action with type: ${k.type}. Should have already existing in the organization.`);a.info(L.magenta(`Syncing action "${k.type}"...`));try{await Ns(e,{action:k,actionId:W.id,skipPublish:!r}),a.info(L.green(`Successfully synced action "${k.type}"!`))}catch(ee){o=!0,a.info(L.red(`Failed to sync action "${k.type}"! - ${ee.message}`))}},{concurrency:nt}),a.info(L.green(`Synced "${c.length}" actions!`))}if(m){a.info(L.magenta(`Syncing "${m.length}" data subjects...`));let y=await dt(e);await M(m,async k=>{let W=y.find(ee=>ee.type===k.type);if(!W)throw new Error(`Failed to find data subject with type: ${k.type}. Should have already existing in the organization.`);a.info(L.magenta(`Syncing data subject "${k.type}"...`));try{await hs(e,{dataSubject:k,dataSubjectId:W.id,skipPublish:!r}),a.info(L.green(`Successfully synced data subject "${k.type}"!`))}catch(ee){o=!0,a.info(L.red(`Failed to sync data subject "${k.type}"! - ${ee.message}`))}},{concurrency:nt}),a.info(L.green(`Synced "${m.length}" data subjects!`))}if(G){let y=await Os(e,G,i);o=o||!y}if(se){let y=await Ss(e,se);o=o||!y}if(ot){let y=await Ps(e,ot);o=o||!y}if(st){let y=await Ts(e,st);o=o||!y}let Qe=[];if(H){let{success:y,dataSiloTitleToId:k}=await ds(H,e,{dataSubjectsByName:Fe,apiKeysByTitle:ht,pageSize:n});H?.forEach(W=>{W["deletion-dependencies"]&&Qe.push([k[W.title],W["deletion-dependencies"]])}),o=o||!y}return Qe.length>0&&await fs(e,Qe),o}async function nA(t,e){let n=await p(t,Fi,{dataSiloId:e,type:"DATA_SILO_DISCOVERY"}),{plugins:r,totalCount:i}=n.plugins;return i===0&&(a.error("No active data silo plugins found for this data silo."),process.exit(1)),r[0]}async function Xs(t){let e=await ft(t),{privacyCenter:{themeStr:n,...r}}=await p(t,Lo,{url:e});return[{...r,theme:JSON.parse(n)}]}async function ea(t){let{translatedMessages:e}=await p(t,or,{});return e}import{ConsentTrackerStatus as bl}from"@transcend-io/privacy-types";var jn=20;async function Yn(t,e=bl.Live){let n=[],r=0,i=await ie(t),s=!1;do{let{cookies:{nodes:o}}=await p(t,Xr,{first:jn,offset:r,airgapBundleId:i,status:e});n.push(...o),r+=jn,s=o.length===jn}while(s);return n.sort((o,l)=>o.name.localeCompare(l.name))}var Zn=20;async function ta(t){let e=[],n=0,r=!1;do{let{assessmentForms:{nodes:i}}=await p(t,cr,{first:Zn,offset:n});e.push(...i),n+=Zn,r=i.length===Zn}while(r);return e.sort((i,s)=>i.title.localeCompare(s.title))}var Hn=20;async function na(t){let e=[],n=0,r=!1;do{let{assessmentFormTemplates:{nodes:i}}=await p(t,dr,{first:Hn,offset:n});e.push(...i),n+=Hn,r=i.length===Hn}while(r);return e.sort((i,s)=>i.title.localeCompare(s.title))}import{AssessmentsDisplayLogicAction as xl,ComparisonOperator as Dl,LogicOperator as Ll}from"@transcend-io/privacy-types";import{decodeCodec as kl,valuesOf as Wn}from"@transcend-io/type-utils";import*as Z from"io-ts";var ia=Z.type({dependsOnQuestionReferenceId:Z.string,comparisonOperator:Wn(Dl),comparisonOperands:Z.array(Z.string)}),_l=Z.recursion("AssessmentNestedRule",t=>Z.intersection([Z.type({logicOperator:Wn(Ll)}),Z.partial({rules:Z.array(ia),nestedRules:Z.array(t)})])),Gl=Z.partial({action:Wn(xl),rule:ia,nestedRule:_l});function zn(t){return kl(Gl,t)}import{ComparisonOperator as vl}from"@transcend-io/privacy-types";import{decodeCodec as ql,valuesOf as Ol}from"@transcend-io/type-utils";import*as te from"io-ts";var Nl=te.intersection([te.partial({riskAssignment:te.partial({riskLevelId:te.string,riskMatrixRowId:te.string,riskMatrixColumnId:te.string})}),te.type({comparisonOperands:te.array(te.string),comparisonOperator:Ol(vl)})]);function Jn(t){return ql(Nl,t)}var Xn=20;async function ra(t){let e=[],n=0,r=!1;do{let{preferenceTopics:{nodes:i}}=await p(t,ur,{first:Xn,offset:n});e.push(...i),n+=Xn,r=i.length===Xn}while(r);return e.sort((i,s)=>`${i.slug}:${i.purpose.trackingType}`.localeCompare(`${s.slug}:${s.purpose.trackingType}`))}async function oa(t){let[e,n]=await Promise.all([Lt(t),ra(t)]);return e.map(r=>{let i=n.filter(s=>s.purpose.trackingType===r.trackingType);return{...r,topics:i}})}import{RequestAction as sa,ConsentTrackerStatus as Ae,ActionItemCode as Ml}from"@transcend-io/privacy-types";import{flatten as Ul,keyBy as aa,mapValues as Fl}from"lodash-es";function ce(t){let e=[];return t.map(n=>{let r=e.find(i=>i.key===n.attributeKey.name);return r===void 0?(r={key:n.attributeKey.name,values:[n.name]},e.push(r)):r.values.push(n.name),e}),e}import Ql from"colors";var Bl=["dataSilos","enrichers","templates","apiKeys"];async function RT(t,{dataSiloIds:e,integrationNames:n,debug:r,resources:i=Bl,pageSize:s,skipDatapoints:o,includeGuessedCategories:l,skipSubDatapoints:u,trackerStatuses:c=Object.values(Ae)}){if(e.length>0&&n.length>0)throw new Error("Only 1 of integrationNames OR dataSiloIds can be provided");a.info(Ql.magenta(`Fetching data with page size ${s}...`));let[d,m,g,h,I,B,H,G,Q,A,j,V,Le,Ee,X,oe,Re,we,ke,$e,se,ot,st,at,pt,Fe,ht,Qe,y,k,W,ee]=await Promise.all([i.includes("dataSilos")||i.includes("dataSubjects")?dt(t):[],i.includes("apiKeys")?$t({},t,!0):[],i.includes("dataSilos")?us(t,{ids:e,integrationNames:n,pageSize:s,debug:r,includeGuessedCategories:l,skipDatapoints:o,skipSubDatapoints:u}):[],i.includes("enrichers")?An(t):[],i.includes("dataFlows")?[...c.includes(Ae.Live)?await Ze(t,Ae.Live):[],...c.includes(Ae.NeedsReview)?await Ze(t,Ae.NeedsReview):[]]:[],i.includes("cookies")?[...c.includes(Ae.Live)?await Yn(t,Ae.Live):[],...c.includes(Ae.NeedsReview)?await Yn(t,Ae.NeedsReview):[]]:[],i.includes("customFields")?je(t):[],i.includes("templates")?vn(t):[],i.includes("identifiers")?hn(t):[],i.includes("actions")?_t(t):[],i.includes("businessEntities")?kt(t):[],i.includes("consentManager")?gs(t):void 0,i.includes("consentManager")?Et(t):[],i.includes("prompts")?Be(t):[],i.includes("promptPartials")?Gt(t):[],i.includes("promptGroups")?vt(t):[],i.includes("agents")?qt(t):[],i.includes("agentFunctions")?Mt(t):[],i.includes("agentFiles")?Ut(t):[],i.includes("vendors")?Ft(t):[],i.includes("dataCategories")?Qt(t):[],i.includes("processingPurposes")?Bt(t):[],i.includes("actionItems")?Ot(t,{type:[Ml.Onboarding]}):[],i.includes("actionItemCollections")?We(t):[],i.includes("teams")?wt(t):[],i.includes("policies")?bt(t):[],i.includes("privacyCenters")?Xs(t):[],i.includes("messages")?ea(t):[],i.includes("partitions")?gt(t):[],i.includes("assessments")?ta(t):[],i.includes("assessmentTemplates")?na(t):[],i.includes("purposes")?oa(t):[]]),lt=i.includes("consentManager")&&V?await ys(t,V.id):void 0,_={},Ta=Ul(g.map(([{apiKeys:f}])=>f.map(({title:C})=>C))),mi=Object.values(m).filter(({title:f})=>i.includes("apiKeys")?!0:Ta.includes(f));if(mi.length>0&&i.includes("apiKeys")&&(_["api-keys"]=mi.map(({title:f})=>({title:f}))),y.length>0&&i.includes("partitions")&&(_.partitions=y.map(({name:f,partition:C})=>({name:f,partition:C}))),V&&i.includes("consentManager")&&(_["consent-manager"]={bundleUrls:{TEST:V.testBundleURL,PRODUCTION:V.bundleURL},domains:V.configuration.domains||void 0,partition:V.configuration.partition||void 0,consentPrecedence:V.configuration.consentPrecedence||void 0,unknownRequestPolicy:V.configuration.unknownRequestPolicy||void 0,unknownCookiePolicy:V.configuration.unknownCookiePolicy||void 0,syncEndpoint:V.configuration.syncEndpoint||void 0,telemetryPartitioning:V.configuration.telemetryPartitioning||void 0,signedIabAgreement:V.configuration.signedIabAgreement||void 0,uspapi:V.configuration.uspapi||void 0,syncGroups:V.configuration.syncGroups||void 0,theme:lt?{primaryColor:lt.primaryColor||void 0,fontColor:lt.fontColor||void 0,privacyPolicy:lt.privacyPolicy||void 0,prompt:lt.prompt}:void 0,experiences:Le.map(f=>({name:f.name,displayName:f.displayName||void 0,regions:f.regions.map(C=>({countrySubDivision:C.countrySubDivision||void 0,country:C.country||void 0})),onConsentExpiry:f.onConsentExpiry,consentExpiry:f.consentExpiry,operator:f.operator,displayPriority:f.displayPriority,viewState:f.viewState,purposes:f.purposes.map(C=>({trackingType:C.trackingType})),optedOutPurposes:f.optedOutPurposes.map(C=>({trackingType:C.trackingType})),browserLanguages:f.browserLanguages,browserTimeZones:f.browserTimeZones}))}),k.length>0&&i.includes("assessments")&&(_.assessments=k.map(({title:f,assessmentGroup:C,sections:P,creator:S,description:E,status:w,assignees:$,externalAssignees:b,reviewers:q,isLocked:v,isArchived:K,isExternallyCreated:U,dueDate:O,createdAt:z,assignedAt:be,submittedAt:_e,approvedAt:Ge,rejectedAt:ve,titleIsInternal:xe,retentionSchedule:ae,attributeValues:he,resources:ct,syncedRows:qe})=>({title:f,group:C.title,sections:P.map(({title:J,status:me,questions:ne,assignees:R,isReviewed:x,externalAssignees:Y})=>({title:J,status:me,questions:ne.map(({title:Oe,type:Yt,subType:re,placeholder:pe,description:Ne,isRequired:Pa,referenceId:Sa,displayLogic:ui,riskLogic:Ea,riskCategories:Ra,riskFramework:wa,answerOptions:$a,selectedAnswers:ba,allowedMimeTypes:xa,allowSelectOther:Da,syncModel:La,syncColumn:ka,attributeKey:_a,requireRiskEvaluation:Ga,requireRiskMatrixEvaluation:va})=>{let ue=ui?zn(ui):void 0;return{title:Oe,type:Yt,"sub-type":re,placeholder:pe,description:Ne,"is-required":Pa,"reference-id":Sa,"display-logic":ue&&Object.keys(ue).length>0?{action:ue.action,rule:ue.rule?{"depends-on-question-reference-id":ue.rule.dependsOnQuestionReferenceId,"comparison-operator":ue.rule.comparisonOperator,"comparison-operands":ue.rule.comparisonOperands}:void 0,"nested-rule":ue.nestedRule?{"logic-operator":ue.nestedRule.logicOperator,rules:(ue.nestedRule.rules||[]).map(le=>({"depends-on-question-reference-id":le.dependsOnQuestionReferenceId,"comparison-operator":le.comparisonOperator,"comparison-operands":le.comparisonOperands}))}:void 0}:void 0,"risk-logic":Ea.map(le=>{let Zt=Jn(le);return{"risk-level":Zt.riskAssignment?.riskLevelId,"comparison-operands":Zt.comparisonOperands,"comparison-operator":Zt.comparisonOperator}}),"risk-categories":Ra.map(({title:le})=>le),"risk-framework":wa?.title,"answer-options":$a.map(({value:le})=>({value:le})),"selected-answers":ba.map(({value:le})=>le),"allowed-mime-types":xa,"allow-select-other":Da,"sync-model":La||void 0,"sync-column":ka||void 0,"attribute-key":_a?.name,"require-risk-evaluation":Ga,"require-risk-matrix-evaluation":va}}),assignees:R.map(({email:Oe})=>Oe),"external-assignees":Y.map(({email:Oe})=>Oe),"is-reviewed":x})),creator:S?.email,description:E,status:w,assignees:$.map(({email:J})=>J),"external-assignees":b.map(({email:J})=>J),reviewers:q.map(({email:J})=>J),locked:v,archived:K,external:U,"title-is-internal":xe,"due-date":O||void 0,"created-at":z||void 0,"assigned-at":be||void 0,"submitted-at":_e||void 0,"approved-at":Ge||void 0,"rejected-at":ve||void 0,"retention-schedule":ae?{type:ae.type,"duration-days":ae.durationDays,operand:ae.operation}:void 0,attributes:he!==void 0&&he.length>0?ce(he):void 0,resources:ct.map(({resourceType:J,title:me,name:ne,category:R,type:x,purpose:Y})=>({type:J,title:R?`${R} - ${ne}`:Y?`${Y} - ${ne}`:me||ne||x||""})),rows:qe.map(({resourceType:J,title:me,name:ne,category:R,type:x,purpose:Y})=>({type:J,title:R?`${R} - ${ne}`:Y?`${Y} - ${ne}`:me||ne||x||""}))}))),W.length>0&&i.includes("assessmentTemplates")&&(_["assessment-templates"]=W.map(({title:f,description:C,sections:P,status:S,source:E,creator:w,isLocked:$,isArchived:b,createdAt:q,retentionSchedule:v})=>({title:f,description:C,sections:P.map(({title:K,questions:U})=>({title:K,questions:U.map(({title:O,type:z,subType:be,placeholder:_e,description:Ge,isRequired:ve,referenceId:xe,displayLogic:ae,riskLogic:he,riskCategories:ct,riskFramework:qe,answerOptions:J,allowedMimeTypes:me,allowSelectOther:ne,syncModel:R,syncColumn:x,attributeKey:Y,requireRiskEvaluation:Oe,requireRiskMatrixEvaluation:Yt})=>{let re=ae?zn(ae):void 0;return{title:O,type:z,"sub-type":be,placeholder:_e,description:Ge,"is-required":ve,"reference-id":xe,"display-logic":re&&Object.keys(re).length>0?{action:re.action,rule:re.rule?{"depends-on-question-reference-id":re.rule.dependsOnQuestionReferenceId,"comparison-operator":re.rule.comparisonOperator,"comparison-operands":re.rule.comparisonOperands}:void 0,"nested-rule":re.nestedRule?{"logic-operator":re.nestedRule.logicOperator,rules:(re.nestedRule.rules||[]).map(pe=>({"depends-on-question-reference-id":pe.dependsOnQuestionReferenceId,"comparison-operator":pe.comparisonOperator,"comparison-operands":pe.comparisonOperands}))}:void 0}:void 0,"risk-logic":he.map(pe=>{let Ne=Jn(pe);return{"risk-level":Ne.riskAssignment?.riskLevelId,"risk-matrix-row":Ne.riskAssignment?.riskMatrixRowId,"risk-matrix-column":Ne.riskAssignment?.riskMatrixColumnId,"comparison-operands":Ne.comparisonOperands,"comparison-operator":Ne.comparisonOperator}}),"risk-categories":ct.map(({title:pe})=>pe),"risk-framework":qe?.title,"answer-options":J.map(({value:pe})=>({value:pe})),"allowed-mime-types":me,"allow-select-other":ne,"sync-model":R||void 0,"sync-column":x||void 0,"attribute-key":Y?.name,"require-risk-evaluation":Oe,"require-risk-matrix-evaluation":Yt}})})),status:S,source:E,creator:w?.email,locked:$,archived:b,"created-at":q||void 0,"retention-schedule":v?{type:v.type,"duration-days":v.durationDays,operand:v.operation}:void 0}))),Ee.length>0&&i.includes("prompts")&&(_.prompts=Ee.map(({title:f,content:C})=>({title:f,content:C}))),X.length>0&&i.includes("promptPartials")&&(_["prompt-partials"]=X.map(({title:f,content:C})=>({title:f,content:C}))),oe.length>0&&i.includes("promptGroups")&&(_["prompt-groups"]=oe.map(({title:f,description:C,prompts:P})=>({title:f,description:C,prompts:P.map(({title:S})=>S)}))),pt.length>0&&i.includes("teams")&&(_.teams=pt.map(({name:f,description:C,ssoDepartment:P,ssoGroup:S,ssoTitle:E,users:w,scopes:$})=>({name:f,description:C,"sso-department":P||void 0,"sso-group":S||void 0,"sso-title":E||void 0,users:w.map(({email:b})=>b),scopes:$.map(({name:b})=>b)}))),d.length>0&&i.includes("dataSubjects")&&(_["data-subjects"]=d.map(({type:f,title:C,active:P,adminDashboardDefaultSilentMode:S,actions:E})=>({type:f,title:C?.defaultMessage,active:P,adminDashboardDefaultSilentMode:S,actions:E.map(({type:w})=>w)}))),Fe.length>0&&(_.policies=Fe.map(({title:f,versions:C,disabledLocales:P})=>({title:f?.defaultMessage,content:C?.[0]?.content?.defaultMessage,disabledLocales:P}))),Qe.length>0&&(_.messages=Qe.map(({id:f,defaultMessage:C,targetReactIntlId:P,translations:S})=>({id:f,defaultMessage:C,targetReactIntlId:P||void 0,translations:S.reduce((E,{locale:w,value:$})=>Object.assign(E,{[w]:$}),{})}))),ht.length>0){let f=ht[0];_["privacy-center"]={isDisabled:f.isDisabled,showPrivacyRequestButton:f.showPrivacyRequestButton,showPolicies:f.showPolicies,showTrackingTechnologies:f.showTrackingTechnologies,showCookies:f.showCookies,showDataFlows:f.showDataFlows,showConsentManager:f.showConsentManager,showManageYourPrivacy:f.showManageYourPrivacy,showMarketingPreferences:f.showMarketingPreferences,locales:f.locales,defaultLocale:f.defaultLocale,preferBrowserDefaultLocale:f.preferBrowserDefaultLocale,supportEmail:f.supportEmail||void 0,replyToEmail:f.replyToEmail||void 0,useNoReplyEmailAddress:f.useNoReplyEmailAddress,useCustomEmailDomain:f.useCustomEmailDomain,transformAccessReportJsonToCsv:f.transformAccessReportJsonToCsv,theme:f.theme}}if(j.length>0&&i.includes("businessEntities")&&(_["business-entities"]=j.map(({title:f,description:C,address:P,headquarterCountry:S,headquarterSubDivision:E,dataProtectionOfficerName:w,dataProtectionOfficerEmail:$,attributeValues:b})=>({title:f,description:C||void 0,address:P||void 0,headquarterCountry:S||void 0,headquarterSubDivision:E||void 0,dataProtectionOfficerName:w||void 0,dataProtectionOfficerEmail:$||void 0,attributes:b!==void 0&&b.length>0?ce(b):void 0}))),A.length>0&&i.includes("actions")&&(_.actions=A.map(({type:f,skipSecondaryIfNoFiles:C,skipDownloadableStep:P,requiresReview:S,regionList:E,regionDetectionMethod:w,waitingPeriod:$})=>({type:f,...f===sa.Erasure?{skipSecondaryIfNoFiles:C,skipDownloadableStep:P}:{},requiresReview:S,waitingPeriod:$,regionDetectionMethod:w,regionList:E.length>0?E:void 0}))),Q.length>0&&i.includes("identifiers")&&(_.identifiers=Q.map(({name:f,type:C,regex:P,selectOptions:S,privacyCenterVisibility:E,isRequiredInForm:w,placeholder:$,displayTitle:b,dataSubjects:q,displayDescription:v,displayOrder:K})=>({name:f,type:C,regex:P,selectOptions:S.length>0?S:void 0,privacyCenterVisibility:E.length>0?E:void 0,isRequiredInForm:w,placeholder:$||void 0,dataSubjects:q.length>0?q.map(({type:U})=>U):void 0,displayTitle:b?.defaultMessage,displayDescription:v?.defaultMessage,displayOrder:K}))),Re.length>0&&i.includes("agents")&&(_.agents=Re.map(({name:f,agentId:C,description:P,instructions:S,codeInterpreterEnabled:E,retrievalEnabled:w,prompt:$,largeLanguageModel:b,teams:q,owners:v,agentFunctions:K,agentFiles:U})=>({name:f,agentId:C,description:P||void 0,instructions:S,codeInterpreterEnabled:E,retrievalEnabled:w,prompt:$?.title,"large-language-model":{name:b.name,client:b.client},teams:q&&q.length>0?q.map(({name:O})=>O):void 0,owners:v&&v.length>0?v.map(({email:O})=>O):void 0,"agent-functions":K&&K.length>0?K.map(({name:O})=>O):void 0,"agent-files":U&&U.length>0?U.map(({name:O})=>O):void 0}))),st.length>0&&i.includes("actionItems")&&(_["action-items"]=st.map(({teams:f,users:C,customerExperienceActionItemIds:[P],dueDate:S,priority:E,resolved:w,collections:$,notes:b,link:q,title:v,type:K,attributeValues:U})=>({teams:f.map(({name:O})=>O),users:C.map(({email:O})=>O),dueDate:S||void 0,title:v,notes:b,customerExperienceActionItemId:P,collections:$.map(({title:O})=>O),link:q,priority:E||void 0,resolved:w,type:K,attributes:U!==void 0&&U.length>0?ce(U):void 0}))),at.length>0&&i.includes("actionItemCollections")&&(_["action-item-collections"]=at.map(({title:f,description:C,hidden:P,productLine:S})=>({title:f,description:C||void 0,hidden:P,productLine:S}))),we.length>0&&i.includes("agentFunctions")&&(_["agent-functions"]=we.map(({name:f,description:C,parameters:P})=>({name:f,description:C,parameters:JSON.stringify(P)}))),ke.length>0&&i.includes("agentFiles")&&(_["agent-files"]=ke.map(({name:f,description:C,fileId:P,size:S,purpose:E})=>({name:f,description:C,fileId:P,size:S,purpose:E}))),$e.length>0&&i.includes("vendors")&&(_.vendors=$e.map(({title:f,description:C,dataProcessingAgreementLink:P,contactName:S,contactPhone:E,address:w,headquarterCountry:$,headquarterSubDivision:b,websiteUrl:q,businessEntity:v,teams:K,owners:U,attributeValues:O})=>({title:f,description:C||void 0,dataProcessingAgreementLink:P||void 0,contactName:S||void 0,contactPhone:E||void 0,address:w||void 0,headquarterCountry:$||void 0,headquarterSubDivision:b||void 0,websiteUrl:q||void 0,businessEntity:v?.title,teams:K&&K.length>0?K.map(({name:z})=>z):void 0,owners:U&&U.length>0?U.map(({email:z})=>z):void 0,attributes:O!==void 0&&O.length>0?ce(O):void 0}))),se.length>0&&i.includes("dataCategories")&&(_["data-categories"]=se.map(({name:f,category:C,description:P,regex:S,owners:E,teams:w,attributeValues:$})=>({name:f,category:C,description:P||void 0,regex:S||void 0,owners:E&&E.length>0?E.map(({email:b})=>b):void 0,teams:w&&w.length>0?w.map(({name:b})=>b):void 0,attributes:$!==void 0&&$.length>0?ce($):void 0}))),ot.length>0&&i.includes("processingPurposes")&&(_["processing-purposes"]=ot.map(({name:f,purpose:C,description:P,owners:S,teams:E,attributeValues:w})=>({name:f,purpose:C,description:P||void 0,owners:S&&S.length>0?S.map(({email:$})=>$):void 0,teams:E&&E.length>0?E.map(({name:$})=>$):void 0,attributes:w!==void 0&&w.length>0?ce(w):void 0}))),I.length>0&&i.includes("dataFlows")&&(_["data-flows"]=I.map(({value:f,type:C,description:P,trackingType:S,service:E,status:w,owners:$,teams:b,attributeValues:q})=>({value:f,type:C,description:P||void 0,trackingPurposes:S,status:w,service:E?.integrationName,owners:$.map(({email:v})=>v),teams:b.map(({name:v})=>v),attributes:q!==void 0&&q.length>0?ce(q):void 0}))),B.length>0&&i.includes("cookies")&&(_.cookies=B.map(({name:f,isRegex:C,description:P,trackingPurposes:S,service:E,status:w,owners:$,teams:b,attributeValues:q})=>({name:f,isRegex:C,description:P||void 0,trackingPurposes:S,status:w,service:E?.integrationName,owners:$.map(({email:v})=>v),teams:b.map(({name:v})=>v),attributes:q!==void 0&&q.length>0?ce(q):void 0}))),H.length>0&&i.includes("customFields")&&(_.attributes=H.map(({description:f,name:C,type:P,values:S,enabledOn:E=[]})=>({description:f||void 0,resources:E,name:C,type:P,values:S.map(({name:w,color:$,description:b})=>({name:w,color:$||void 0,description:b}))}))),ee.length>0&&(_.purposes=ee.map(({name:f,description:C,trackingType:P,defaultConsent:S,configurable:E,showInConsentManager:w,isActive:$,displayOrder:b,optOutSignals:q,authLevel:v,topics:K,showInPrivacyCenter:U,title:O})=>({name:f,title:O,description:C||void 0,trackingType:P,"default-consent":S,configurable:E,"show-in-consent-manager":w,"show-in-privacy-center":U,"is-active":$,"display-order":b,"opt-out-signals":q.length>0?q:void 0,"auth-level":v||void 0,"preference-topics":K.map(({title:z,type:be,displayDescription:_e,defaultConfiguration:Ge,showInPrivacyCenter:ve,preferenceOptionValues:xe})=>({title:z.defaultMessage,type:be,description:_e.defaultMessage,"default-configuration":Ge,"show-in-privacy-center":ve,...xe.length>0?{options:xe.map(({title:ae,slug:he})=>({title:ae.defaultMessage,slug:he}))}:{}}))}))),e.length===0&&G.length>0&&i.includes("templates")&&(_.templates=G.map(({title:f})=>({title:f}))),h.length>0&&i.includes("enrichers")&&(_.enrichers=h.map(({title:f,url:C,type:P,inputIdentifier:S,identifiers:E,actions:w,testRegex:$,dataSubjects:b,expirationDuration:q,lookerQueryTitle:v,transitionRequestStatus:K,phoneNumbers:U,regionList:O})=>({title:f,url:C||void 0,type:P,"input-identifier":S?.name,"output-identifiers":E.map(({name:z})=>z),"privacy-actions":Object.values(sa).length===w.length?void 0:w,testRegex:$||void 0,lookerQueryTitle:v||void 0,expirationDuration:parseInt(q,10),transitionRequestStatus:K||void 0,phoneNumbers:U&&U.length>0?U:void 0,regionList:O&&O.length>0?O:void 0,"data-subjects":b.map(({type:z})=>z)}))),g.length>0&&i.includes("dataSilos")){let f=aa(d,"type");_["data-silos"]=g.map(([{title:C,description:P,url:S,type:E,outerType:w,apiKeys:$,notifyEmailAddress:b,identifiers:q,dependentDataSilos:v,owners:K,country:U,countrySubDivision:O,teams:z,subjectBlocklist:be,isLive:_e,promptAVendorEmailSendFrequency:Ge,promptAVendorEmailSendType:ve,promptAVendorEmailIncludeIdentifiersAttachment:xe,promptAVendorEmailCompletionLinkType:ae,manualWorkRetryFrequency:he,catalog:ct,attributeValues:qe,discoveredBy:J,businessEntities:me},ne])=>({title:C,description:P,integrationName:E,"outer-type":w||void 0,url:S||void 0,"api-key-title":$[0]?.title,"identity-keys":q.filter(({isConnected:R})=>R).map(({name:R})=>R),...v.length>0?{"deletion-dependencies":v.map(({title:R})=>R)}:{},...K.length>0?{owners:K.map(({email:R})=>R)}:{},...z.length>0?{teams:z.map(({name:R})=>R)}:{},...J.length>0?{discoveredBy:J.map(({title:R})=>R)}:{},...me.length>0?{businessEntities:me.map(({title:R})=>R)}:{},country:U||void 0,countrySubDivision:O||void 0,disabled:!_e,"data-subjects":be.length>0?ls(be.map(({type:R})=>R),f):void 0,...ct.hasAvcFunctionality?{"email-settings":{"notify-email-address":b||void 0,"send-frequency":Ge,"send-type":ve,"include-identifiers-attachment":xe,"completion-link-type":ae,"manual-work-retry-frequency":he}}:{},attributes:qe!==void 0&&qe.length>0?ce(qe):void 0,datapoints:ne.map(R=>({key:R.name,title:R.title?.defaultMessage,description:R.description?.defaultMessage,owners:R.owners.map(({email:x})=>x),teams:R.teams.map(({name:x})=>x),...R.path.length>0?{path:R.path}:{},...R.dataCollection?.title?{"data-collection-tag":R.dataCollection.title.defaultMessage}:{},...R.dbIntegrationQueries.length>0?{"privacy-action-queries":Fl(aa(R.dbIntegrationQueries,"requestType"),x=>x.suggestedQuery||x.query||void 0)}:{},...R.subDataPoints.length>0?{fields:R.subDataPoints.map(x=>({key:x.name,description:x.description,purposes:x.purposes,categories:x.categories,...l&&x.pendingCategoryGuesses?{"guessed-categories":x.pendingCategoryGuesses.filter(Y=>Y.status==="PENDING").map(Y=>({category:{name:Y.category.name,category:Y.category.category},status:Y.status,confidence:Y.confidence,classifierVersion:Y.classifierVersion||void 0}))}:{},"access-request-visibility-enabled":x.accessRequestVisibilityEnabled,"erasure-request-redaction-enabled":x.erasureRequestRedactionEnabled,attributes:x.attributeValues!==void 0&&x.attributeValues.length>0?ce(x.attributeValues):void 0})).sort((x,Y)=>x.key.localeCompare(Y.key))}:{},"privacy-actions":R.actionSettings.filter(({active:x})=>x).map(({type:x})=>x)})).sort((R,x)=>[...R.path??[],R.key].join(".").localeCompare([...x.path??[],x.key].join(".")))}))}return _}import Ce from"colors";import{chunk as Kl,keyBy as Vl}from"lodash-es";var ei=20;async function pa(t){let e=[],n=0,r=!1;do{let{softwareDevelopmentKits:{nodes:i}}=await p(t,Yi,{first:ei,offset:n});e.push(...i),n+=ei,r=i.length===ei}while(r);return e.sort((i,s)=>i.name.localeCompare(s.name))}var jl=100;async function Yl(t,e){let{createSoftwareDevelopmentKit:{softwareDevelopmentKit:n}}=await p(t,Hi,{input:e});return a.info(Ce.green(`Successfully created software development kit "${e.name}"!`)),n}async function Zl(t,e){let{updateSoftwareDevelopmentKits:{softwareDevelopmentKits:n}}=await p(t,Zi,{input:{softwareDevelopmentKits:e}});return a.info(Ce.green(`Successfully updated ${e.length} software development kits!`)),n}async function la(t,e,n=20){let r=!1,i=[];a.info(Ce.magenta("Syncing software development kits..."));let s=await pa(t),o=Vl(s,({name:m,codePackageType:g})=>JSON.stringify({name:m,codePackageType:g})),l=e.map(m=>[m,o[JSON.stringify({name:m.name,codePackageType:m.codePackageType})]?.id]),u=l.filter(([,m])=>!m).map(([m])=>m);try{a.info(Ce.magenta(`Creating "${u.length}" new software development kits...`)),await M(u,async m=>{let g=await Yl(t,m);i.push(g)},{concurrency:n}),a.info(Ce.green(`Successfully synced ${u.length} software development kits!`))}catch(m){r=!0,a.info(Ce.red(`Failed to create software development kits! - ${m.message}`))}let c=l.filter(m=>!!m[1]),d=Kl(c,jl);return a.info(Ce.magenta(`Updating "${c.length}" software development kits...`)),await T(d,async m=>{try{let g=await Zl(t,m.map(([{codePackageType:h,...I},B])=>({...I,id:B})));i.push(...g),a.info(Ce.green(`Successfully updated "${c.length}" software development kits!`))}catch(g){r=!0,a.info(Ce.red(`Failed to update software development kits! - ${g.message}`))}a.info(Ce.green(`Synced "${e.length}" software development kits!`))}),{softwareDevelopmentKits:i,success:!r}}import Te from"colors";import{chunk as Hl,keyBy as Wl}from"lodash-es";var ti=20;async function ca(t){let e=[],n=0,r=!1;do{let{repositories:{nodes:i}}=await p(t,_i,{first:ti,offset:n});e.push(...i),n+=ti,r=i.length===ti}while(r);return e.sort((i,s)=>i.name.localeCompare(s.name))}var zl=100;async function Jl(t,e){let{createRepository:{repository:n}}=await p(t,vi,{input:e});return a.info(Te.green(`Successfully created repository "${e.name}"!`)),n}async function Xl(t,e){let{updateRepositories:{repositories:n}}=await p(t,Gi,{input:{repositories:e}});return a.info(Te.green(`Successfully updated ${e.length} repositories!`)),n}async function ma(t,e,n=20){let r=!1,i=[],s=await ca(t),o=Wl(s,"name"),l=e.map(m=>[m,o[m.name]?.id]),u=l.filter(([,m])=>!m).map(([m])=>m);try{a.info(Te.magenta(`Creating "${u.length}" new repositories...`)),await M(u,async m=>{let g=await Jl(t,m);i.push(g)},{concurrency:n}),a.info(Te.green(`Successfully synced ${u.length} repositories!`))}catch(m){r=!0,a.info(Te.red(`Failed to create repositories! - ${m.message}`))}let c=l.filter(m=>!!m[1]),d=Hl(c,zl);return a.info(Te.magenta(`Updating "${c.length}" repositories...`)),await T(d,async m=>{try{let g=await Xl(t,m.map(([h,I])=>({...h,id:I})));i.push(...g),a.info(Te.green(`Successfully updated "${c.length}" repositories!`))}catch(g){r=!0,a.info(Te.red(`Failed to update repositories! - ${g.message}`))}a.info(Te.green(`Synced "${e.length}" repositories!`))}),{repositories:i,success:!r}}import{chunk as ec,uniq as da,keyBy as fa,uniqBy as ga}from"lodash-es";import Pe from"colors";var ni=20;async function ua(t){let e=[],n=0,r=!1;do{let{codePackages:{nodes:i}}=await p(t,Wi,{first:ni,offset:n});e.push(...i),n+=ni,r=i.length===ni}while(r);return e.sort((i,s)=>i.name.localeCompare(s.name))}var tc=100,it="%%%%";async function nc(t,e){let{createCodePackage:{codePackage:n}}=await p(t,Ji,{input:e});return a.info(Pe.green(`Successfully created code package "${e.name}"!`)),n}async function ic(t,e){let{updateCodePackages:{codePackages:n}}=await p(t,zi,{input:{codePackages:e}});return a.info(Pe.green(`Successfully updated ${e.length} code packages!`)),n}async function cP(t,e,n=20){let r=!1,[i,{softwareDevelopmentKits:s}]=await Promise.all([ua(t),la(t,ga(e.map(({type:g,softwareDevelopmentKits:h=[]})=>h.map(({name:I})=>({name:I,codePackageType:g}))).flat(),({name:g,codePackageType:h})=>`${g}${it}${h}`),n),ma(t,ga(e,"repositoryName").map(({repositoryName:g})=>({name:g,url:`https://github.com/${g}`})))]),o=fa(s,({name:g,codePackageType:h})=>`${g}${it}${h}`),l=fa(i,({name:g,type:h})=>`${g}${it}${h}`),u=e.map(g=>[g,l[`${g.name}${it}${g.type}`]?.id]),c=u.filter(([,g])=>!g).map(([g])=>g);try{a.info(Pe.magenta(`Creating "${c.length}" new code packages...`)),await M(c,async({softwareDevelopmentKits:g,...h})=>{await nc(t,{...h,...g?{softwareDevelopmentKitIds:da(g.map(({name:I})=>{let B=o[`${I}${it}${h.type}`];if(!B)throw new Error(`Failed to find SDK with name: "${I}"`);return B.id}))}:{}})},{concurrency:n}),a.info(Pe.green(`Successfully synced ${c.length} code packages!`))}catch(g){r=!0,a.info(Pe.red(`Failed to create code packages! - ${g.message}`))}let d=u.filter(g=>!!g[1]);a.info(Pe.magenta(`Updating "${d.length}" code packages...`));let m=ec(d,tc);return await T(m,async g=>{try{await ic(t,g.map(([{softwareDevelopmentKits:h,repositoryName:I,...B},H])=>({...B,...h?{softwareDevelopmentKitIds:da(h.map(({name:G})=>{let Q=o[`${G}${it}${B.type}`];if(!Q)throw new Error(`Failed to find SDK with name: "${G}"`);return Q.id}))}:{},id:H}))),a.info(Pe.green(`Successfully updated "${g.length}" code packages!`))}catch(h){r=!0,a.info(Pe.red(`Failed to update code packages! - ${h.message}`))}}),a.info(Pe.green(`Synced "${e.length}" code packages!`)),!r}import{chunk as rc}from"lodash-es";var oc=1e3;async function yP(t,e,n){let r=rc(n,oc);await T(r,async i=>{await p(t,Ui,{pluginId:e,rawResults:i})})}var ii=100;async function sc(t){let e=[],n=0,r=!1;do{let{catalogs:{nodes:i}}=await p(t,Ei,{first:ii,offset:n});e.push(...i),n+=ii,r=i.length===ii}while(r);return e.sort((i,s)=>i.integrationName.localeCompare(s.integrationName))}async function AP(t){let e=await sc(t),n=e.reduce((i,s)=>Object.assign(i,{[s.integrationName]:s.title}),{}),r=e.reduce((i,s)=>Object.assign(i,{[s.integrationName]:s.hasApiFunctionality}),{});return{catalogs:e,serviceToTitle:n,serviceToSupportedIntegration:r}}import{GraphQLClient as ac}from"graphql-request";function pc(t,e){return new ac(`${t}/graphql`,{headers:{...e,version:di}})}function ya(t,e){return pc(t,{Authorization:`Bearer ${e}`})}import lc from"got";async function DP(t,e,n){let r=ya(t,e),{organization:i}=await p(r,Vi);return lc.extend({prefixUrl:i.sombra.customerUrl,headers:{Authorization:`Bearer ${e}`,...n?{"X-Sombra-Authorization":`Bearer ${n}`}:{}}})}async function GP(t,e){await p(t,jr,{input:e})}async function NP(t,e){await p(t,pr,{requestEnricherId:e})}var ri=20;async function QP(t,e){let n=[],r=0,i=!1;do{let{promptThreads:{nodes:s}}=await p(t,Xi,{first:ri,offset:r,filterBy:e});n.push(...s),r+=ri,i=s.length===ri}while(i);return n.sort((s,o)=>s.threadId.localeCompare(o.threadId))}var oi=50;async function jP(t,{requestId:e}){let n=[],r=0,i=!1;do{let{requestIdentifiers:{nodes:s}}=await p(t,Dr,{first:oi,offset:r,requestIds:[e]});n.push(...s),r+=oi,i=s.length===oi}while(i);return n}async function WP(t,{dataSiloId:e}){let{listReducedRequestsForDataSilo:{totalCount:n}}=await p(t,Rr,{input:{dataSiloId:e,isResolved:!1}});return n}var si=20;async function eS(t){let e=[],n=0,r=!1;do{let{attributeKeys:{nodes:i}}=await p(t,ji,{first:si,offset:n});e.push(...i),n+=si,r=i.length===si}while(r);return e.sort((i,s)=>i.name.localeCompare(s.name))}import Kt from"colors";import*as D from"io-ts";import Ca from"cli-progress";import{valuesOf as rt}from"@transcend-io/type-utils";import{RequestAction as cc,RequestOrigin as mc,RequestStatus as uc,IsoCountryCode as dc,IsoCountrySubdivisionCode as fc}from"@transcend-io/privacy-types";import{LanguageKey as gc}from"@transcend-io/internationalization";var cS=D.intersection([D.type({id:D.string,createdAt:D.string,email:D.string,type:rt(cc),link:D.string,isSilent:D.boolean,origin:rt(mc),isTest:D.boolean,coreIdentifier:D.string,details:D.string,locale:rt(gc),status:rt(uc),subjectType:D.string,country:D.union([D.null,rt(dc)]),countrySubDivision:D.union([D.null,rt(fc)]),attributeValues:D.array(D.type({id:D.string,attributeKey:D.type({name:D.string,id:D.string}),name:D.string}))}),D.partial({daysRemaining:D.union([D.null,D.number])})]),Vt=50;async function mS(t,{actions:e=[],statuses:n=[],origins:r=[],text:i,createdAtBefore:s,createdAtAfter:o,isTest:l,isSilent:u,isClosed:c,requestIds:d=[]}={}){a.info(Kt.magenta("Fetching requests..."));let m=new Date().getTime(),g=new Ca.SingleBar({},Ca.Presets.shades_classic),h=[],I=0,B=!1;do{let{requests:{nodes:A,totalCount:j}}=await p(t,ir,{first:Vt,offset:I,filterBy:{text:i,type:e.length>0?e:void 0,status:n.length>0?n:void 0,origin:r.length>0?r:void 0,isTest:l,isSilent:u,isClosed:c,createdAtBefore:s?s.toISOString():void 0,createdAtAfter:o?o.toISOString():void 0}});I===0&&j>Vt&&(a.info(Kt.magenta(`Fetching ${j} requests`)),g.start(j,0)),h.push(...A),I+=Vt,g.update(I),B=A.length===Vt}while(B);g.stop();let G=new Date().getTime()-m;a.info(Kt.green(`Completed fetching of ${h.length} request in "${G/1e3}" seconds.`));let Q=h;return d&&d.length>0&&(Q=Q.filter(A=>d.includes(A.id)),a.info(Kt.green(`Filtered down to ${Q.length} requests based on ${d.length} provided IDs.`))),Q}import{IdentifierType as yc}from"@transcend-io/privacy-types";import{decodeCodec as Cc,valuesOf as hc}from"@transcend-io/type-utils";import*as Se from"io-ts";import Ic from"semver";var ha="7.180",Ac=Se.type({id:Se.string,name:Se.string,value:Se.string,type:hc(yc)}),ai=50,Tc=Se.type({identifiers:Se.array(Ac)});async function hS(t,e,{requestId:n}){let r=[],i=0,s=!1,{organization:{sombra:{version:o}}}=await p(t,Xo);if(o&&Ic.lt(o,ha))throw new Error(`Please upgrade Sombra to ${ha} or greater to use this command.`);do{let l;try{l=await e.post("v1/request-identifiers",{json:{first:ai,offset:i,requestId:n}}).json()}catch(c){throw new Error(`Failed to fetch request identifiers: ${c?.response?.body||c?.message}`)}let{identifiers:u}=Cc(Tc,l);r.push(...u),i+=ai,s=u.length===ai}while(s);return r}var pi=50;async function PS(t,{requestId:e}){let n=[],r=0,i=!1;do{let{requestEnrichers:{nodes:s}}=await p(t,ar,{first:pi,offset:r,requestId:e});n.push(...s),r+=pi,i=s.length===pi}while(i);return n}import Ia from"colors";import Aa from"cli-progress";var jt=100;async function Pc(t,{requestId:e,dataSiloId:n,requestStatuses:r,statuses:i,skipLog:s=!1}){let o=new Date().getTime(),l=new Aa.SingleBar({},Aa.Presets.shades_classic),u=[],c=0,d=!1;do{let{requestDataSilos:{nodes:h,totalCount:I}}=await p(t,Er,{first:jt,offset:c,filterBy:{dataSiloId:n,requestId:e,status:i,requestStatus:r}});u.push(...h),c===0&&I>jt&&(a.info(Ia.magenta(`Fetching ${I} requests`)),l.start(I,0)),c+=jt,d=h.length===jt,l.update(c)}while(d);l.stop();let g=new Date().getTime()-o;return s||a.info(Ia.green(`Completed fetching of ${u.length} request data silos in "${g/1e3}" seconds.`)),u}async function xS(t,{requestId:e,dataSiloId:n}){let r=await Pc(t,{requestId:e,dataSiloId:n,skipLog:!0});if(r.length!==1)throw new Error(`Failed to find RequestDataSilo with requestId:${e},dataSiloId:${n}`);return r[0]}import Sc from"got";function _S(t){return Sc.extend({prefixUrl:t})}async function OS(t,{email:e,password:n}){let{determineLoginMethod:{loginMethod:r}}=await p(t,pn,{email:e}),i=await t.rawRequest(_o,{email:e,password:n,publicKey:r.sombraPublicKey}),{login:{user:s}}=i.data,o=i.headers.get("set-cookie");if(!o||!o.includes("laravel"))throw new Error("Failed to get login cookie in response");return{roles:s.roles,loginCookie:o}}async function NS(t,{email:e,roleId:n}){let{determineLoginMethod:{loginMethod:r}}=await p(t,pn,{email:e,userId:n});await t.rawRequest(Go,{id:n,publicKey:r.sombraPublicKey})}var li=20;async function QS(t){let e=[],n=0,r=!1;do{let{users:{nodes:i}}=await p(t,Lr,{first:li,offset:n});e.push(...i),n+=li,r=i.length===li}while(r);return e.sort((i,s)=>i.email.localeCompare(s.email))}async function jS(t,e){let{createApiKey:{apiKey:n}}=await p(t,Oi,{input:e});return n}async function YS(t,e){await p(t,Ni,{id:e})}var ci=20;async function zS(t,e){let n=[],r=0,i=!1;do{let{requestFiles:{nodes:s}}=await p(t,kr,{first:ci,offset:r,filterBy:e});n.push(...s),r+=ci,i=s.length===ci}while(i);return n.sort((s,o)=>s.remoteId.localeCompare(o.remoteId))}async function tE(t,{id:e,bundleType:n}){await p(t,so,{airgapBundleId:e,bundleType:n})}async function nE(t,{id:e,bundleType:n}){await p(t,oo,{airgapBundleId:e,bundleType:n})}async function sE(t,e){let{reportPromptRun:{promptRun:n}}=await p(t,Gr,{input:{...e,promptRunMessages:e.promptRunMessages.map(({content:r,...i})=>({...i,message:r}))}});return n.id}async function cE(t,{promptRunId:e,promptRunMessages:n=[],...r}){let{addMessagesToPromptRun:{promptRun:i}}=await p(t,vr,{input:{...r,...e,promptRunMessages:n.map(({content:s,...o})=>({...o,message:s}))}});return i.id}export{T as a,M as b,fi as c,wc as d,gi as e,$c as f,yi as g,Ci as h,bc as i,Lc as j,hi as k,Gc as l,Ii as m,Ht as n,Ai as o,Ti as p,Oc as q,Pi as r,Si as s,Ei as t,Ri as u,wi as v,$i as w,bi as x,xi as y,Di as z,Li as A,ki as B,_i as C,Gi as D,vi as E,qi as F,Oi as G,Ni as H,Ui as I,Fi as J,Bi as K,Ki as L,Vi as M,ji as N,Yi as O,Zi as P,Hi as Q,Wi as R,zi as S,Ji as T,Xi as U,tr as V,nr as W,ir as X,um as Y,dm as Z,fm as _,gm as $,or as aa,sr as ba,ar as ca,pr as da,Am as ea,tn as fa,cr as ga,Sm as ha,mr as ia,ur as ja,dr as ka,fr as la,gr as ma,yr as na,Cr as oa,hr as pa,Ir as qa,Ar as ra,Tr as sa,Pr as ta,Sr as ua,Er as va,vm as wa,qm as xa,Rr as ya,wr as za,$r as Aa,br as Ba,Fm as Ca,Dr as Da,Lr as Ea,kr as Fa,Gr as Ga,vr as Ha,qr as Ia,Or as Ja,Nr as Ka,Mr as La,Ur as Ma,Fr as Na,Qr as Oa,Br as Pa,Kr as Qa,Vr as Ra,jr as Sa,Yr as Ta,Zr as Ua,Hr as Va,Wr as Wa,zr as Xa,Jr as Ya,Xr as Za,eo as _a,to as $a,no as ab,io as bb,ro as cb,oo as db,so as eb,ao as fb,po as gb,lo as hb,co as ib,mo as jb,uo as kb,fo as lb,go as mb,yo as nb,Co as ob,ho as pb,Io as qb,Ao as rb,To as sb,Po as tb,Eo as ub,Ro as vb,wo as wb,$o as xb,bo as yb,xo as zb,Do as Ab,Lo as Bb,ko as Cb,pn as Db,_o as Eb,Go as Fb,fu as Gb,vo as Hb,qo as Ib,Oo as Jb,No as Kb,Mo as Lb,Uo as Mb,Fo as Nb,Qo as Ob,Bo as Pb,Ko as Qb,Vo as Rb,jo as Sb,Yo as Tb,Zo as Ub,Ho as Vb,Wo as Wb,zo as Xb,Jo as Yb,Xo as Zb,p as _b,hn as $b,ts as ac,ns as bc,An as cc,rs as dc,os as ec,dt as fc,as as gc,ps as hc,ls as ic,ms as jc,mp as kc,up as lc,us as mc,ds as nc,fs as oc,gs as pc,ie as qc,Et as rc,dp as sc,Af as tc,ys as uc,yp as vc,Cs as wc,wt as xc,hs as yc,Tp as zc,$t as Ac,Be as Bc,Kf as Cc,Sp as Dc,Ep as Ec,As as Fc,ft as Gc,Ke as Hc,bt as Ic,bp as Jc,Ts as Kc,Lp as Lc,Ps as Mc,Ss as Nc,gt as Oc,Rs as Pc,Lt as Qc,vp as Rc,xs as Sc,qp as Tc,Op as Uc,je as Vc,kt as Wc,Up as Xc,Fp as Yc,ks as Zc,Ze as _c,Qp as $c,Bp as ad,Os as bd,Ns as cd,vn as dd,Ms as ed,_t as fd,Gt as gd,vt as hd,qt as id,Hp as jd,Wp as kd,Us as ld,Jp as md,Xp as nd,Fs as od,Ot as pd,nl as qd,il as rd,Bs as sd,Mt as td,sl as ud,al as vd,Ks as wd,Ut as xd,ll as yd,cl as zd,Vs as Ad,Ft as Bd,ul as Cd,dl as Dd,js as Ed,Qt as Fd,gl as Gd,yl as Hd,Ys as Id,Bt as Jd,hl as Kd,Il as Ld,Zs as Md,zI as Nd,nA as Od,Xs as Pd,ea as Qd,Yn as Rd,ta as Sd,na as Td,ia as Ud,_l as Vd,Gl as Wd,zn as Xd,Nl as Yd,Jn as Zd,ra as _d,oa as $d,Bl as ae,RT as be,Yl as ce,Zl as de,la as ee,Jl as fe,Xl as ge,ma as he,nc as ie,ic as je,cP as ke,yP as le,sc as me,AP as ne,pc as oe,ya as pe,DP as qe,GP as re,NP as se,QP as te,jP as ue,WP as ve,eS as we,cS as xe,mS as ye,Tc as ze,hS as Ae,PS as Be,Pc as Ce,xS as De,_S as Ee,OS as Fe,NS as Ge,QS as He,jS as Ie,YS as Je,zS as Ke,tE as Le,nE as Me,sE as Ne,cE as Oe};
2831
- //# sourceMappingURL=chunk-WEQUQAB7.js.map
2831
+ //# sourceMappingURL=chunk-TDBKATQK.js.map
@@ -1,2 +1,2 @@
1
- import{Ee as N,b}from"./chunk-WEQUQAB7.js";import{a}from"./chunk-43JWXG77.js";import{f as U}from"./chunk-L5ULN3IT.js";import*as E from"crypto";import*as $ from"jsonwebtoken";function B(c,l,n){let o=Buffer.from(n,"base64"),f=Buffer.from(l,"base64"),u="id-aes256-wrap-pad",d=Buffer.from("A65959A6","hex"),s=E.createCipheriv(u,f,d),i={encryptedIdentifier:Buffer.concat([s.update(c),s.final()]).toString("base64")};return $.sign(i,o,{algorithm:"HS384"})}import*as e from"io-ts";var O=e.intersection([e.type({userId:e.string,timestamp:e.string}),e.partial({confirmed:e.union([e.literal("true"),e.literal("false")]),updated:e.union([e.literal("true"),e.literal("false")]),prompted:e.union([e.literal("true"),e.literal("false")]),metadata:e.string,usp:e.union([e.string,e.null]),gpp:e.union([e.string,e.null])})]),Y=e.intersection([O,e.partial({purposes:e.string})]),G=e.intersection([O,e.type({partition:e.string}),e.partial({tcf:e.union([e.string,e.null]),purposes:e.record(e.string,e.union([e.boolean,e.string]))})]);import P from"colors";import*as r from"io-ts";import A from"cli-progress";import{decodeCodec as I}from"@transcend-io/type-utils";var R=/^[0-9][Y|N]([Y|N])[Y|N]$/,_=r.record(r.string,r.union([r.boolean,r.literal("Auto")]));async function Z({base64EncryptionKey:c,base64SigningKey:l,preferences:n,partition:o,concurrency:f=100,transcendUrl:u=U}){let d=N(u),s=n.filter(t=>t.usp&&!R.test(t.usp));if(s.length>0)throw new Error(`Received invalid usp strings: ${JSON.stringify(s,null,2)}`);let m=n.map((t,y)=>[t,y]).filter(([t])=>{if(!t.purposes)return!1;try{return I(_,t.purposes),!1}catch{return!0}});if(m.length>0)throw new Error(`Received invalid purpose maps: ${JSON.stringify(m,null,2)}`);let i=n.filter(t=>!t.usp&&!t.purposes);if(i.length>0)throw new Error(`Received invalid inputs, expected either purposes or usp to be defined: ${JSON.stringify(i,null,2)}`);a.info(P.magenta(`Uploading ${n.length} user preferences to partition ${o}`));let w=new Date().getTime(),g=new A.SingleBar({},A.Presets.shades_classic),S=0;g.start(n.length,0),await b(n,async({userId:t,confirmed:y="true",updated:T,prompted:v,purposes:x,...p})=>{let k=B(t,c,l),[,D]=p.usp?R.exec(p.usp)||[]:[],F={token:k,partition:o,consent:{confirmed:y==="true",purposes:x?I(_,x):p.usp?{SaleOfInfo:D==="Y"}:{},...T?{updated:T==="true"}:{},...v?{prompted:v==="true"}:{},...p}};try{await d.post("sync",{json:F}).json()}catch(h){try{let C=JSON.parse(h?.response?.body||"{}");C.error&&a.error(P.red(`Error: ${C.error}`))}catch{}throw new Error(`Received an error from server: ${h?.response?.body||h?.message}`)}S+=1,g.update(S)},{concurrency:f}),g.stop();let j=new Date().getTime()-w;a.info(P.green(`Successfully uploaded ${n.length} user preferences to partition ${o} in "${j/1e3}" seconds!`))}export{B as a,Y as b,G as c,R as d,_ as e,Z as f};
2
- //# sourceMappingURL=chunk-FSJPJZNH.js.map
1
+ import{Ee as N,b}from"./chunk-TDBKATQK.js";import{a}from"./chunk-43JWXG77.js";import{f as U}from"./chunk-L5ULN3IT.js";import*as E from"crypto";import*as $ from"jsonwebtoken";function B(c,l,n){let o=Buffer.from(n,"base64"),f=Buffer.from(l,"base64"),u="id-aes256-wrap-pad",d=Buffer.from("A65959A6","hex"),s=E.createCipheriv(u,f,d),i={encryptedIdentifier:Buffer.concat([s.update(c),s.final()]).toString("base64")};return $.sign(i,o,{algorithm:"HS384"})}import*as e from"io-ts";var O=e.intersection([e.type({userId:e.string,timestamp:e.string}),e.partial({confirmed:e.union([e.literal("true"),e.literal("false")]),updated:e.union([e.literal("true"),e.literal("false")]),prompted:e.union([e.literal("true"),e.literal("false")]),metadata:e.string,usp:e.union([e.string,e.null]),gpp:e.union([e.string,e.null])})]),Y=e.intersection([O,e.partial({purposes:e.string})]),G=e.intersection([O,e.type({partition:e.string}),e.partial({tcf:e.union([e.string,e.null]),purposes:e.record(e.string,e.union([e.boolean,e.string]))})]);import P from"colors";import*as r from"io-ts";import A from"cli-progress";import{decodeCodec as I}from"@transcend-io/type-utils";var R=/^[0-9][Y|N]([Y|N])[Y|N]$/,_=r.record(r.string,r.union([r.boolean,r.literal("Auto")]));async function Z({base64EncryptionKey:c,base64SigningKey:l,preferences:n,partition:o,concurrency:f=100,transcendUrl:u=U}){let d=N(u),s=n.filter(t=>t.usp&&!R.test(t.usp));if(s.length>0)throw new Error(`Received invalid usp strings: ${JSON.stringify(s,null,2)}`);let m=n.map((t,y)=>[t,y]).filter(([t])=>{if(!t.purposes)return!1;try{return I(_,t.purposes),!1}catch{return!0}});if(m.length>0)throw new Error(`Received invalid purpose maps: ${JSON.stringify(m,null,2)}`);let i=n.filter(t=>!t.usp&&!t.purposes);if(i.length>0)throw new Error(`Received invalid inputs, expected either purposes or usp to be defined: ${JSON.stringify(i,null,2)}`);a.info(P.magenta(`Uploading ${n.length} user preferences to partition ${o}`));let w=new Date().getTime(),g=new A.SingleBar({},A.Presets.shades_classic),S=0;g.start(n.length,0),await b(n,async({userId:t,confirmed:y="true",updated:T,prompted:v,purposes:x,...p})=>{let k=B(t,c,l),[,D]=p.usp?R.exec(p.usp)||[]:[],F={token:k,partition:o,consent:{confirmed:y==="true",purposes:x?I(_,x):p.usp?{SaleOfInfo:D==="Y"}:{},...T?{updated:T==="true"}:{},...v?{prompted:v==="true"}:{},...p}};try{await d.post("sync",{json:F}).json()}catch(h){try{let C=JSON.parse(h?.response?.body||"{}");C.error&&a.error(P.red(`Error: ${C.error}`))}catch{}throw new Error(`Received an error from server: ${h?.response?.body||h?.message}`)}S+=1,g.update(S)},{concurrency:f}),g.stop();let j=new Date().getTime()-w;a.info(P.green(`Successfully uploaded ${n.length} user preferences to partition ${o} in "${j/1e3}" seconds!`))}export{B as a,Y as b,G as c,R as d,_ as e,Z as f};
2
+ //# sourceMappingURL=chunk-WSDWILYI.js.map
@@ -1,4 +1,4 @@
1
- import{c as x}from"./chunk-FSJPJZNH.js";import{n as u,q as D}from"./chunk-TR32ZRNC.js";import{ga as w,ha as _}from"./chunk-LAYHULHH.js";import{Le as O,Me as U,a as R,b as P,bd as b,pc as L,pe as S,qc as M,tc as N,wc as k}from"./chunk-WEQUQAB7.js";import{a as c}from"./chunk-43JWXG77.js";import{e as C}from"./chunk-L5ULN3IT.js";import{ConsentBundleType as H}from"@transcend-io/privacy-types";import A from"colors";async function at({auth:e,deploy:i=!1,transcendUrl:o=C,bundleTypes:t=Object.values(H)}){let r=S(o,e),n=await M(r);await R(t,async a=>{c.info(A.magenta(`Update Consent Manager bundle with ID "${n}" and type "${a}" to latest version...`)),await U(r,{id:n,bundleType:a}),c.info(A.green(`Updated Consent Manager bundle with ID "${n}" and type "${a}" to latest version!`))}),i&&await R(t,async a=>{c.info(A.magenta(`Deploying Consent Manager bundle with ID "${n}" and type "${a}"...`)),await O(r,{id:n,bundleType:a}),c.info(A.green(`Deployed Consent Manager bundle with ID "${n}" and type "${a}"!`))})}import G from"colors";var K=["ID","Activity","Encounters","Last Seen At","Has Native Do Not Sell/Share Support","IAB USP API Support","Service Description","Website URL","Categories of Recipients"];async function Ct({auth:e,trackerStatus:i,file:o,classifyService:t=!1,transcendUrl:r=C}){let n=S(r,e);c.info(G.magenta(`Reading "${o}" from disk`));let l=D(o,w).map(({Type:d,Notes:m,Service:f,Purpose:E,Status:g,Owners:I,Teams:T,"Connections Made To":v,...y})=>({value:v,type:d,description:m,trackingPurposes:u(E),status:g||i,owners:I?u(I):void 0,teams:T?u(T):void 0,attributes:Object.entries(y).filter(([h])=>!K.includes(h)).map(([h,B])=>({key:h,values:u(B)}))}));await b(n,l,t)||(c.error(G.red("Encountered error(s) syncing data flows from CSV, see logs above for more info. ")),process.exit(1))}import F from"colors";var j=["ID","Activity","Encounters","Last Seen At","Has Native Do Not Sell/Share Support","IAB USP API Support","Service Description","Website URL","Categories of Recipients"];async function vt({auth:e,trackerStatus:i,file:o,transcendUrl:t=C}){let r=S(t,e);c.info(F.magenta(`Reading "${o}" from disk`));let a=D(o,_).map(({"Is Regex?":s,Notes:d,Service:m,Purpose:f,Status:E,Owners:g,Teams:I,Name:T,...v})=>({...typeof s=="string"?{isRegex:s.toLowerCase()==="true"}:{},name:T,description:d,trackingPurposes:u(f),status:E||i,owners:g?u(g):void 0,teams:I?u(I):void 0,attributes:Object.entries(v).filter(([y])=>!j.includes(y)).map(([y,h])=>({key:y,values:u(h)}))}));await k(r,a)||(c.error(F.red("Encountered error(s) syncing cookies from CSV, see logs above for more info. ")),process.exit(1))}var Y=1e3,Q=60*Y,V=60*Q,X=24*V,z=7*X;async function Lt(e,{bin:i,start:o,end:t=new Date}){let r=await M(e),n=Math.floor(o.getTime()/1e3),a=Math.floor(t.getTime()/1e3);if(n>a)throw new Error('Received "end" date that happened before "start" date');if(i==="1h"&&t.getTime()-o.getTime()>z*2)throw new Error("When using bin=1h, start and end time can be no more than 2 weeks apart");let l=o.toISOString(),s=t.toISOString(),[d,m,f]=await Promise.all([N(e,{dataSource:"PRIVACY_SIGNAL_TIMESERIES",startDate:l,endDate:s,forceRefetch:!0,airgapBundleId:r,binInterval:i,smoothTimeseries:!1}),N(e,{dataSource:"CONSENT_CHANGES_TIMESERIES",startDate:l,endDate:s,forceRefetch:!0,airgapBundleId:r,binInterval:i,smoothTimeseries:!1}),N(e,{dataSource:"CONSENT_SESSIONS_BY_REGIME",startDate:l,endDate:s,forceRefetch:!0,airgapBundleId:r,binInterval:i,smoothTimeseries:!1})]);return{PRIVACY_SIGNAL_TIMESERIES:d,CONSENT_CHANGES_TIMESERIES:m,CONSENT_SESSIONS_BY_REGIME:f}}var $=e=>new URL(`https://${e}`).hostname.split(".").slice(-2).join(".");import W from"colors";import{difference as q}from"lodash-es";var J=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;async function Ht(e,{xdiLocation:i,transcendUrl:o=C,removeIpAddresses:t=!0,domainBlockList:r=["localhost"],xdiAllowedCommands:n="ConsentManager:Sync"}){let a=Array.isArray(e)?e:[{apiKey:e,organizationId:"",organizationName:""}],l=await P(a,async m=>{c.info(W.magenta(`Pulling consent metadata for organization - ${m.organizationName}`));let f=S(o,m.apiKey);return await L(f)},{concurrency:5}),s={};return l.forEach(m=>{let f=m.partition?.partition||m.bundleURL.split("/").reverse()[1];s[f]||(s[f]=[]);let E=q(m.configuration.domains.filter(g=>!t||!J.test(g)).map(g=>$(g)),r);s[f]=[...new Set([...s[f]||[],...E])]}),{html:`
1
+ import{c as x}from"./chunk-WSDWILYI.js";import{n as u,q as D}from"./chunk-ZTD7APNF.js";import{ga as w,ha as _}from"./chunk-LAYHULHH.js";import{Le as O,Me as U,a as R,b as P,bd as b,pc as L,pe as S,qc as M,tc as N,wc as k}from"./chunk-TDBKATQK.js";import{a as c}from"./chunk-43JWXG77.js";import{e as C}from"./chunk-L5ULN3IT.js";import{ConsentBundleType as H}from"@transcend-io/privacy-types";import A from"colors";async function at({auth:e,deploy:i=!1,transcendUrl:o=C,bundleTypes:t=Object.values(H)}){let r=S(o,e),n=await M(r);await R(t,async a=>{c.info(A.magenta(`Update Consent Manager bundle with ID "${n}" and type "${a}" to latest version...`)),await U(r,{id:n,bundleType:a}),c.info(A.green(`Updated Consent Manager bundle with ID "${n}" and type "${a}" to latest version!`))}),i&&await R(t,async a=>{c.info(A.magenta(`Deploying Consent Manager bundle with ID "${n}" and type "${a}"...`)),await O(r,{id:n,bundleType:a}),c.info(A.green(`Deployed Consent Manager bundle with ID "${n}" and type "${a}"!`))})}import G from"colors";var K=["ID","Activity","Encounters","Last Seen At","Has Native Do Not Sell/Share Support","IAB USP API Support","Service Description","Website URL","Categories of Recipients"];async function Ct({auth:e,trackerStatus:i,file:o,classifyService:t=!1,transcendUrl:r=C}){let n=S(r,e);c.info(G.magenta(`Reading "${o}" from disk`));let l=D(o,w).map(({Type:d,Notes:m,Service:f,Purpose:E,Status:g,Owners:I,Teams:T,"Connections Made To":v,...y})=>({value:v,type:d,description:m,trackingPurposes:u(E),status:g||i,owners:I?u(I):void 0,teams:T?u(T):void 0,attributes:Object.entries(y).filter(([h])=>!K.includes(h)).map(([h,B])=>({key:h,values:u(B)}))}));await b(n,l,t)||(c.error(G.red("Encountered error(s) syncing data flows from CSV, see logs above for more info. ")),process.exit(1))}import F from"colors";var j=["ID","Activity","Encounters","Last Seen At","Has Native Do Not Sell/Share Support","IAB USP API Support","Service Description","Website URL","Categories of Recipients"];async function vt({auth:e,trackerStatus:i,file:o,transcendUrl:t=C}){let r=S(t,e);c.info(F.magenta(`Reading "${o}" from disk`));let a=D(o,_).map(({"Is Regex?":s,Notes:d,Service:m,Purpose:f,Status:E,Owners:g,Teams:I,Name:T,...v})=>({...typeof s=="string"?{isRegex:s.toLowerCase()==="true"}:{},name:T,description:d,trackingPurposes:u(f),status:E||i,owners:g?u(g):void 0,teams:I?u(I):void 0,attributes:Object.entries(v).filter(([y])=>!j.includes(y)).map(([y,h])=>({key:y,values:u(h)}))}));await k(r,a)||(c.error(F.red("Encountered error(s) syncing cookies from CSV, see logs above for more info. ")),process.exit(1))}var Y=1e3,Q=60*Y,V=60*Q,X=24*V,z=7*X;async function Lt(e,{bin:i,start:o,end:t=new Date}){let r=await M(e),n=Math.floor(o.getTime()/1e3),a=Math.floor(t.getTime()/1e3);if(n>a)throw new Error('Received "end" date that happened before "start" date');if(i==="1h"&&t.getTime()-o.getTime()>z*2)throw new Error("When using bin=1h, start and end time can be no more than 2 weeks apart");let l=o.toISOString(),s=t.toISOString(),[d,m,f]=await Promise.all([N(e,{dataSource:"PRIVACY_SIGNAL_TIMESERIES",startDate:l,endDate:s,forceRefetch:!0,airgapBundleId:r,binInterval:i,smoothTimeseries:!1}),N(e,{dataSource:"CONSENT_CHANGES_TIMESERIES",startDate:l,endDate:s,forceRefetch:!0,airgapBundleId:r,binInterval:i,smoothTimeseries:!1}),N(e,{dataSource:"CONSENT_SESSIONS_BY_REGIME",startDate:l,endDate:s,forceRefetch:!0,airgapBundleId:r,binInterval:i,smoothTimeseries:!1})]);return{PRIVACY_SIGNAL_TIMESERIES:d,CONSENT_CHANGES_TIMESERIES:m,CONSENT_SESSIONS_BY_REGIME:f}}var $=e=>new URL(`https://${e}`).hostname.split(".").slice(-2).join(".");import W from"colors";import{difference as q}from"lodash-es";var J=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;async function Ht(e,{xdiLocation:i,transcendUrl:o=C,removeIpAddresses:t=!0,domainBlockList:r=["localhost"],xdiAllowedCommands:n="ConsentManager:Sync"}){let a=Array.isArray(e)?e:[{apiKey:e,organizationId:"",organizationName:""}],l=await P(a,async m=>{c.info(W.magenta(`Pulling consent metadata for organization - ${m.organizationName}`));let f=S(o,m.apiKey);return await L(f)},{concurrency:5}),s={};return l.forEach(m=>{let f=m.partition?.partition||m.bundleURL.split("/").reverse()[1];s[f]||(s[f]=[]);let E=q(m.configuration.domains.filter(g=>!t||!J.test(g)).map(g=>$(g)),r);s[f]=[...new Set([...s[f]||[],...E])]}),{html:`
2
2
  <!DOCTYPE html>
3
3
  <script
4
4
  src="${i}"
@@ -9,4 +9,4 @@ data-xdi-commands="${n}"
9
9
 
10
10
  ~~~~~~~~~~~
11
11
  Airgap scripts to host:`),i.forEach(({attributes:o,title:t},r)=>{o?.find(n=>n.key==="Airgap Production URL")?.values?.forEach(n=>{c.info(`${r}) ${t} - ${n}`)})}),i}import*as p from"io-ts";import{decodeCodec as Z}from"@transcend-io/type-utils";var tt=p.intersection([p.type({nodes:p.array(x)}),p.partial({lastKey:p.partial({userId:p.string,partition:p.string,timestamp:p.string})})]);async function zt(e,{partition:i,filterBy:o={},limit:t=50}){let r,n=[],a=!0;for(;a;){let l=await e.post("v1/consent-preferences",{json:{partition:i,...o,startKey:r||void 0,limit:t}}).json(),{nodes:s,lastKey:d}=Z(tt,l);if(!s||s.length===0)break;n.push(...s),r=d,a=!!d&&Object.keys(d).length>0}return n}export{at as a,Ct as b,vt as c,Lt as d,$ as e,J as f,Ht as g,Yt as h,tt as i,zt as j};
12
- //# sourceMappingURL=chunk-UK7OFHQR.js.map
12
+ //# sourceMappingURL=chunk-XNR74SBS.js.map