@transcend-io/cli 7.0.0-alpha.10 → 7.0.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/bash-complete.d.ts +1 -0
- package/dist/bin/bash-complete.js +2 -1
- package/dist/bin/bash-complete.js.map +1 -0
- package/dist/bin/cli.d.ts +1 -0
- package/dist/bin/cli.js +2 -1
- package/dist/bin/cli.js.map +1 -0
- package/dist/bin/deprecated-command.d.ts +1 -0
- package/dist/bin/deprecated-command.js +2 -1
- package/dist/bin/deprecated-command.js.map +1 -0
- package/dist/{chunk-W6GUOMVP.js → chunk-347UQP43.js} +2 -1
- package/dist/chunk-347UQP43.js.map +1 -0
- package/dist/{chunk-OERYFLN2.js → chunk-43JWXG77.js} +1 -0
- package/dist/chunk-43JWXG77.js.map +1 -0
- package/dist/{chunk-T2PLXAEM.js → chunk-4GLITB3Y.js} +1 -0
- package/dist/chunk-4GLITB3Y.js.map +1 -0
- package/dist/{chunk-LWRD3DNX.js → chunk-6WKTY4YQ.js} +2 -1
- package/dist/chunk-6WKTY4YQ.js.map +1 -0
- package/dist/{chunk-XMGVDVM2.js → chunk-72U6ETHG.js} +1 -0
- package/dist/chunk-72U6ETHG.js.map +1 -0
- package/dist/{chunk-RAHNPFEG.js → chunk-AB4DHWRB.js} +2 -1
- package/dist/chunk-AB4DHWRB.js.map +1 -0
- package/dist/{chunk-EZCJGIOS.js → chunk-ARVEJERC.js} +1 -0
- package/dist/chunk-ARVEJERC.js.map +1 -0
- package/dist/{chunk-ZB5DNAF3.js → chunk-CBAHSBSW.js} +1 -0
- package/dist/chunk-CBAHSBSW.js.map +1 -0
- package/dist/{chunk-VN4S2A5A.js → chunk-FSJPJZNH.js} +2 -1
- package/dist/chunk-FSJPJZNH.js.map +1 -0
- package/dist/{chunk-U66XZ2QS.js → chunk-GD7WEHDA.js} +2 -1
- package/dist/chunk-GD7WEHDA.js.map +1 -0
- package/dist/{chunk-DTKOSX7V.js → chunk-GSXHJEKW.js} +2 -1
- package/dist/chunk-GSXHJEKW.js.map +1 -0
- package/dist/{chunk-RZ3H3AKY.js → chunk-HGLIJXXG.js} +2 -1
- package/dist/chunk-HGLIJXXG.js.map +1 -0
- package/dist/{chunk-MKUBKUQO.js → chunk-JXPGBZXN.js} +17 -16
- package/dist/chunk-JXPGBZXN.js.map +1 -0
- package/dist/{chunk-APA5PR4U.js → chunk-L5ULN3IT.js} +1 -0
- package/dist/chunk-L5ULN3IT.js.map +1 -0
- package/dist/{chunk-AHYJJKNA.js → chunk-L7ZIX4SU.js} +1 -0
- package/dist/chunk-L7ZIX4SU.js.map +1 -0
- package/dist/{chunk-HMF46LB7.js → chunk-LAYHULHH.js} +2 -1
- package/dist/chunk-LAYHULHH.js.map +1 -0
- package/dist/{chunk-RBOBI6B6.js → chunk-MA4JWWRO.js} +1 -0
- package/dist/chunk-MA4JWWRO.js.map +1 -0
- package/dist/{chunk-QQRMUEM7.js → chunk-OEB7WG3G.js} +2 -1
- package/dist/chunk-OEB7WG3G.js.map +1 -0
- package/dist/{chunk-R5WBISY5.js → chunk-R6QTIUFA.js} +2 -1
- package/dist/chunk-R6QTIUFA.js.map +1 -0
- package/dist/{chunk-DXOAW6K3.js → chunk-TR32ZRNC.js} +2 -1
- package/dist/chunk-TR32ZRNC.js.map +1 -0
- package/dist/{chunk-F4XXBUFM.js → chunk-UK7OFHQR.js} +2 -1
- package/dist/chunk-UK7OFHQR.js.map +1 -0
- package/dist/{chunk-L2SPDKF4.js → chunk-UUBO75GS.js} +2 -1
- package/dist/chunk-UUBO75GS.js.map +1 -0
- package/dist/{chunk-2FMBK7EQ.js → chunk-WEQUQAB7.js} +2 -1
- package/dist/chunk-WEQUQAB7.js.map +1 -0
- package/dist/chunk-XWOTEZCO.js +2 -0
- package/dist/chunk-XWOTEZCO.js.map +1 -0
- package/dist/impl-2TCAWTV7.js +2 -0
- package/dist/impl-2TCAWTV7.js.map +1 -0
- package/dist/{impl-A3A3743Y.js → impl-42N5BEEM.js} +2 -1
- package/dist/impl-42N5BEEM.js.map +1 -0
- package/dist/{impl-LMGG6SET.js → impl-4CRAE4V6.js} +2 -1
- package/dist/impl-4CRAE4V6.js.map +1 -0
- package/dist/impl-5N4IKF4U.js +2 -0
- package/dist/impl-5N4IKF4U.js.map +1 -0
- package/dist/{impl-K6LFUREX.js → impl-5NAYXPAC.js} +2 -1
- package/dist/impl-5NAYXPAC.js.map +1 -0
- package/dist/{impl-NYB4YSNU.js → impl-5YV7K446.js} +2 -1
- package/dist/impl-5YV7K446.js.map +1 -0
- package/dist/impl-645HDE5S.js +2 -0
- package/dist/impl-645HDE5S.js.map +1 -0
- package/dist/{impl-MQYUMXYT.js → impl-7DL7ZS4K.js} +2 -1
- package/dist/impl-7DL7ZS4K.js.map +1 -0
- package/dist/impl-7JFWBWQZ.js +2 -0
- package/dist/impl-7JFWBWQZ.js.map +1 -0
- package/dist/impl-B4WDU4OW.js +2 -0
- package/dist/impl-B4WDU4OW.js.map +1 -0
- package/dist/{impl-424N4CNI.js → impl-B5C37V2L.js} +2 -1
- package/dist/impl-B5C37V2L.js.map +1 -0
- package/dist/{impl-W5OXXCN3.js → impl-BWZUWHVF.js} +2 -1
- package/dist/impl-BWZUWHVF.js.map +1 -0
- package/dist/{impl-ZIZA6YZP.js → impl-D47U6GWY.js} +2 -1
- package/dist/impl-D47U6GWY.js.map +1 -0
- package/dist/{impl-QW7LVCIG.js → impl-FAOTDDQ5.js} +2 -1
- package/dist/impl-FAOTDDQ5.js.map +1 -0
- package/dist/{impl-XLJ55WDX.js → impl-FYAEBZIM.js} +2 -1
- package/dist/impl-FYAEBZIM.js.map +1 -0
- package/dist/{impl-YO4XMK67.js → impl-GGEEIOQF.js} +2 -1
- package/dist/impl-GGEEIOQF.js.map +1 -0
- package/dist/{impl-Q4AYM2LP.js → impl-IAKEYWMV.js} +2 -1
- package/dist/impl-IAKEYWMV.js.map +1 -0
- package/dist/impl-IFLVVVBT.js +2 -0
- package/dist/impl-IFLVVVBT.js.map +1 -0
- package/dist/impl-JFHF7SF7.js +2 -0
- package/dist/impl-JFHF7SF7.js.map +1 -0
- package/dist/{impl-6KSDOODU.js → impl-JPOE7MKX.js} +2 -1
- package/dist/impl-JPOE7MKX.js.map +1 -0
- package/dist/{impl-CVXUBWM3.js → impl-KRV7L5SP.js} +2 -1
- package/dist/impl-KRV7L5SP.js.map +1 -0
- package/dist/{impl-6TNYAKRE.js → impl-MGARGP2M.js} +2 -1
- package/dist/impl-MGARGP2M.js.map +1 -0
- package/dist/{impl-REBNHNHS.js → impl-N3R63BI4.js} +2 -1
- package/dist/impl-N3R63BI4.js.map +1 -0
- package/dist/impl-NCWU4WVO.js +2 -0
- package/dist/impl-NCWU4WVO.js.map +1 -0
- package/dist/{impl-WWVBI2VM.js → impl-NE4OGF7U.js} +2 -1
- package/dist/impl-NE4OGF7U.js.map +1 -0
- package/dist/{impl-VKJ2BBOI.js → impl-NNBY4R6T.js} +2 -1
- package/dist/impl-NNBY4R6T.js.map +1 -0
- package/dist/{impl-6YQILA4G.js → impl-PERB6GYW.js} +2 -1
- package/dist/impl-PERB6GYW.js.map +1 -0
- package/dist/impl-QSO5YEU5.js +2 -0
- package/dist/impl-QSO5YEU5.js.map +1 -0
- package/dist/impl-R3SREBHK.js +2 -0
- package/dist/impl-R3SREBHK.js.map +1 -0
- package/dist/impl-RCQ2XX63.js +2 -0
- package/dist/impl-RCQ2XX63.js.map +1 -0
- package/dist/{impl-O57JWKDO.js → impl-TKRPL6CJ.js} +2 -1
- package/dist/impl-TKRPL6CJ.js.map +1 -0
- package/dist/{impl-TRV73CJM.js → impl-TMKWWJKO.js} +2 -1
- package/dist/impl-TMKWWJKO.js.map +1 -0
- package/dist/{impl-GCP4YV4V.js → impl-TOLP53IM.js} +2 -1
- package/dist/impl-TOLP53IM.js.map +1 -0
- package/dist/{impl-UKT74QA2.js → impl-VDNSV4OU.js} +2 -1
- package/dist/impl-VDNSV4OU.js.map +1 -0
- package/dist/impl-VUKRE7OK.js +2 -0
- package/dist/impl-VUKRE7OK.js.map +1 -0
- package/dist/{impl-MCGNBSTB.js → impl-XGFKUJGX.js} +2 -1
- package/dist/impl-XGFKUJGX.js.map +1 -0
- package/dist/{impl-GFKQQAIZ.js → impl-Z4G3R4DW.js} +2 -1
- package/dist/impl-Z4G3R4DW.js.map +1 -0
- package/dist/{impl-AGGJXPJE.js → impl-ZN4EG5UY.js} +2 -1
- package/dist/impl-ZN4EG5UY.js.map +1 -0
- package/dist/{impl-DFX7WJML.js → impl-ZX6PDQW6.js} +2 -1
- package/dist/impl-ZX6PDQW6.js.map +1 -0
- package/dist/index.d.ts +117643 -0
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -0
- package/package.json +3 -1
- package/dist/chunk-R76D6QCT.js +0 -1
- package/dist/impl-2WFCE3NQ.js +0 -1
- package/dist/impl-4QGAT3EL.js +0 -1
- package/dist/impl-6EM4MWFJ.js +0 -1
- package/dist/impl-DUO3FKJO.js +0 -1
- package/dist/impl-GW34VD6D.js +0 -1
- package/dist/impl-HJ2TEJA4.js +0 -1
- package/dist/impl-HXSGNZWA.js +0 -1
- package/dist/impl-I36LGCWV.js +0 -1
- package/dist/impl-IWD4XEGF.js +0 -1
- package/dist/impl-M2QHMARV.js +0 -1
- package/dist/impl-Q26ZNVKH.js +0 -1
- package/dist/impl-RREKLU5Y.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as s}from"../chunk-
|
|
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}
|
|
3
3
|
`)}catch{}
|
|
4
|
+
//# sourceMappingURL=bash-complete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/bin/bash-complete.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { proposeCompletions } from '@stricli/core';\nimport { app } from '../app';\nimport { buildContext } from '../context';\n\nconst inputs = process.argv.slice(3);\nif (process.env.COMP_LINE?.endsWith(' ')) {\n inputs.push('');\n}\nawait proposeCompletions(app, inputs, buildContext(process));\ntry {\n for (const { completion } of await proposeCompletions(\n app,\n inputs,\n buildContext(process),\n )) {\n process.stdout.write(`${completion}\\n`);\n }\n} catch {\n // ignore\n}\n"],"mappings":";sMACA,OAAS,sBAAAA,MAA0B,gBAInC,IAAMC,EAAS,QAAQ,KAAK,MAAM,CAAC,EAC/B,QAAQ,IAAI,WAAW,SAAS,GAAG,GACrCA,EAAO,KAAK,EAAE,EAEhB,MAAMC,EAAmBC,EAAKF,EAAQG,EAAa,OAAO,CAAC,EAC3D,GAAI,CACF,OAAW,CAAE,WAAAC,CAAW,IAAK,MAAMH,EACjCC,EACAF,EACAG,EAAa,OAAO,CACtB,EACE,QAAQ,OAAO,MAAM,GAAGC,CAAU;AAAA,CAAI,CAE1C,MAAQ,CAER","names":["proposeCompletions","inputs","proposeCompletions","app","buildContext","completion"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/bin/cli.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as o}from"../chunk-
|
|
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));
|
|
3
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/bin/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { run } from '@stricli/core';\nimport { app } from '../app';\nimport { buildContext } from '../context';\n\nawait run(app, process.argv.slice(2), buildContext(process));\n"],"mappings":";sMACA,OAAS,OAAAA,MAAW,gBAIpB,MAAMC,EAAIC,EAAK,QAAQ,KAAK,MAAM,CAAC,EAAGC,EAAa,OAAO,CAAC","names":["run","run","app","buildContext"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as n}from"../chunk-
|
|
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(`
|
|
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.
|
|
6
6
|
`);let o=m(e);if(!o)throw new Error(`Failed to get help text for command: \`${e.join(" ")}\``);r.log(o)}function p(){let e=process.argv.at(-1)?.split("/").pop()?.trim();if(e)i(e);else throw new Error("Deprecated command");process.exit(1)}p();
|
|
7
|
+
//# sourceMappingURL=deprecated-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/cli/legacy-commands.ts","../../src/bin/deprecated-command.ts"],"sourcesContent":["import {\n generateHelpTextForAllCommands,\n type Application,\n type CommandContext,\n} from '@stricli/core';\nimport { app } from '../app';\nimport { logger } from '@/logger';\n\n// Maps legacy (<7.0.0) command names to their modern command structure\nexport const legacyCommandToModernCommandMap: Record<string, string[]> = {\n 'tr-build-xdi-sync-endpoint': ['consent', 'build-xdi-sync-endpoint'],\n 'tr-consent-manager-service-json-to-yml': [\n 'inventory',\n 'consent-manager-service-json-to-yml',\n ],\n 'tr-consent-managers-to-business-entities': [\n 'inventory',\n 'consent-managers-to-business-entities',\n ],\n 'tr-cron-mark-identifiers-completed': [\n 'request',\n 'cron',\n 'mark-identifiers-completed',\n ],\n 'tr-cron-pull-identifiers': ['request', 'cron', 'pull-identifiers'],\n 'tr-derive-data-silos-from-data-flows': [\n 'inventory',\n 'derive-data-silos-from-data-flows',\n ],\n 'tr-derive-data-silos-from-data-flows-cross-instance': [\n 'inventory',\n 'derive-data-silos-from-data-flows-cross-instance',\n ],\n 'tr-discover-silos': ['inventory', 'discover-silos'],\n 'tr-generate-api-keys': ['admin', 'generate-api-keys'],\n 'tr-manual-enrichment-pull-identifiers': [\n 'request',\n 'preflight',\n 'pull-identifiers',\n ],\n 'tr-manual-enrichment-push-identifiers': [\n 'request',\n 'preflight',\n 'push-identifiers',\n ],\n 'tr-mark-request-data-silos-completed': [\n 'request',\n 'system',\n 'mark-request-data-silos-completed',\n ],\n 'tr-pull': ['inventory', 'pull'],\n 'tr-pull-consent-metrics': ['consent', 'pull-consent-metrics'],\n 'tr-pull-consent-preferences': ['consent', 'pull-consent-preferences'],\n 'tr-pull-datapoints': ['inventory', 'pull-datapoints'],\n 'tr-pull-pull-unstructured-discovery-files': [\n 'inventory',\n 'pull-unstructured-discovery-files',\n ],\n 'tr-push': ['inventory', 'push'],\n 'tr-request-approve': ['request', 'approve'],\n 'tr-request-cancel': ['request', 'cancel'],\n 'tr-request-download-files': ['request', 'download-files'],\n 'tr-request-enricher-restart': ['request', 'enricher-restart'],\n 'tr-request-export': ['request', 'export'],\n 'tr-request-mark-silent': ['request', 'mark-silent'],\n 'tr-request-notify-additional-time': ['request', 'notify-additional-time'],\n 'tr-request-reject-unverified-identifiers': [\n 'request',\n 'reject-unverified-identifiers',\n ],\n 'tr-request-restart': ['request', 'restart'],\n 'tr-request-upload': ['request', 'upload'],\n 'tr-retry-request-data-silos': [\n 'request',\n 'system',\n 'retry-request-data-silos',\n ],\n 'tr-scan-packages': ['inventory', 'scan-packages'],\n 'tr-skip-preflight-jobs': ['request', 'skip-preflight-jobs'],\n 'tr-skip-request-data-silos': [\n 'request',\n 'system',\n 'skip-request-data-silos',\n ],\n 'tr-sync-ot': ['migration', 'sync-ot'],\n 'tr-update-consent-manager': ['consent', 'update-consent-manager'],\n 'tr-upload-consent-preferences': ['consent', 'upload-consent-preferences'],\n 'tr-upload-cookies-from-csv': ['consent', 'upload-cookies-from-csv'],\n 'tr-upload-data-flows-from-csv': ['consent', 'upload-data-flows-from-csv'],\n 'tr-upload-preferences': ['consent', 'upload-preferences'],\n};\n\n// All commands have been migrated to the modern command structure\n\n/**\n * Gets the help text for a command\n *\n * @param command - The command to get help text for\n * @returns The help text for the command\n */\nexport function getHelpTextForCommand(command: string[]): string | undefined {\n const helpTextForAllCommands = generateHelpTextForAllCommands(\n app as Application<CommandContext>,\n );\n\n return helpTextForAllCommands.find(\n (x) => x[0] === `${app.config.name} ${command.join(' ')}`,\n )?.[1];\n}\n\n/**\n * Logs a modern command recommendation for a legacy command\n *\n * @param legacyCommand - The legacy command to log a modern command recommendation for\n * @example\n * logModernCommandRecommendation('tr-cron-mark-identifiers-completed');\n */\nexport function logModernCommandRecommendation(\n legacyCommand: keyof typeof legacyCommandToModernCommandMap,\n): void {\n logger.log('[DEPRECATION NOTICE]');\n\n const modernCommand = legacyCommandToModernCommandMap[legacyCommand];\n if (!modernCommand) {\n const modernCommandString = Object.entries(legacyCommandToModernCommandMap)\n .map(\n ([legacyCommand, modernCommand]) =>\n `\\`${legacyCommand}\\` -> \\`${app.config.name} ${modernCommand.join(\n ' ',\n )}\\``,\n )\n .join('\\n');\n logger.log(\n 'This command is deprecated as of v7.0.0.' +\n ` Here is a list of new commands, mapped to their legacy command names:\n${modernCommandString}`,\n );\n return;\n }\n\n logger.log(\n `\\`${legacyCommand}\\` is deprecated as of v7.0.0.\\nUse \\`${\n app.config.name\n } ${modernCommand.join(' ')}\\` instead.\\n`,\n );\n\n const helpText = getHelpTextForCommand(modernCommand);\n if (!helpText) {\n throw new Error(\n `Failed to get help text for command: \\`${modernCommand.join(' ')}\\``,\n );\n }\n\n logger.log(helpText);\n}\n","#!/usr/bin/env node\nimport { logModernCommandRecommendation } from '../cli/legacy-commands';\n\n/**\n * Runs when a deprecated command is called.\n */\nfunction main(): void {\n const command = process.argv.at(-1);\n const legacyCommand = command?.split('/').pop()?.trim();\n if (legacyCommand) {\n logModernCommandRecommendation(legacyCommand);\n } else {\n throw new Error('Deprecated command');\n }\n\n process.exit(1);\n}\n\nmain();\n"],"mappings":";sMAAA,OACE,kCAAAA,MAGK,gBAKA,IAAMC,EAA4D,CACvE,6BAA8B,CAAC,UAAW,yBAAyB,EACnE,yCAA0C,CACxC,YACA,qCACF,EACA,2CAA4C,CAC1C,YACA,uCACF,EACA,qCAAsC,CACpC,UACA,OACA,4BACF,EACA,2BAA4B,CAAC,UAAW,OAAQ,kBAAkB,EAClE,uCAAwC,CACtC,YACA,mCACF,EACA,sDAAuD,CACrD,YACA,kDACF,EACA,oBAAqB,CAAC,YAAa,gBAAgB,EACnD,uBAAwB,CAAC,QAAS,mBAAmB,EACrD,wCAAyC,CACvC,UACA,YACA,kBACF,EACA,wCAAyC,CACvC,UACA,YACA,kBACF,EACA,uCAAwC,CACtC,UACA,SACA,mCACF,EACA,UAAW,CAAC,YAAa,MAAM,EAC/B,0BAA2B,CAAC,UAAW,sBAAsB,EAC7D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AIK,EAAc,KAC5D,GACF,CAAC,IACL,EACC,KAAK;AAAA,CAAI,EACZD,EAAO,IACL;AAAA,EAEJE,CAAmB,EACjB,EACA,MACF,CAEAF,EAAO,IACL,KAAKD,CAAa;AAAA,QAChBH,EAAI,OAAO,IACb,IAAIK,EAAc,KAAK,GAAG,CAAC;AAAA,CAC7B,EAEA,IAAME,EAAWV,EAAsBQ,CAAa,EACpD,GAAI,CAACE,EACH,MAAM,IAAI,MACR,0CAA0CF,EAAc,KAAK,GAAG,CAAC,IACnE,EAGFD,EAAO,IAAIG,CAAQ,CACrB,CCpJA,SAASC,GAAa,CAEpB,IAAMC,EADU,QAAQ,KAAK,GAAG,EAAE,GACH,MAAM,GAAG,EAAE,IAAI,GAAG,KAAK,EACtD,GAAIA,EACFC,EAA+BD,CAAa,MAE5C,OAAM,IAAI,MAAM,oBAAoB,EAGtC,QAAQ,KAAK,CAAC,CAChB,CAEAD,EAAK","names":["generateHelpTextForAllCommands","legacyCommandToModernCommandMap","getHelpTextForCommand","command","generateHelpTextForAllCommands","app","x","logModernCommandRecommendation","legacyCommand","logger","modernCommand","modernCommandString","helpText","main","legacyCommand","logModernCommandRecommendation"]}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{e as o}from"./chunk-
|
|
1
|
+
import{e as o}from"./chunk-ARVEJERC.js";import*as e from"io-ts";import{valuesOf as a}from"@transcend-io/type-utils";var d=({TRouteName:t})=>e.type({routeName:t,enabledPolicies:e.array(a(o))});import*as r from"io-ts";var l=({TEnabledRoutes:t})=>r.type({enabledRoutes:t});export{d as a,l as b};
|
|
2
|
+
//# sourceMappingURL=chunk-347UQP43.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/helpers/buildEnabledRouteType.ts","../src/lib/helpers/buildAIIntegrationType.ts"],"sourcesContent":["import * as t from 'io-ts';\nimport { EnabledRouteC } from '../../codecs';\nimport { valuesOf } from '@transcend-io/type-utils';\nimport { PathfinderPolicyName } from '../../enums';\n\n/**\n * Builds a custom io-ts type that represents a route allowed by the proxy\n *\n * @param TRouteName - the string with the name of the allowed route\n * @returns custom io-ts AllowedRoute type\n */\nexport const buildEnabledRouteType = <T extends t.Mixed>({\n TRouteName,\n}: {\n /** the type of the routeName property */\n TRouteName: T;\n}): EnabledRouteC<T> =>\n t.type({\n routeName: TRouteName,\n enabledPolicies: t.array(valuesOf(PathfinderPolicyName)),\n });\n","import * as t from 'io-ts';\nimport { AIIntegrationC, EnabledRouteC } from '../../codecs';\n\n/**\n * Helper to build a custom io-ts type representing an AIIntegration\n *\n * @param TEnabledRoutes - the type of the enabledRoutes for the AIIntegration type\n * @returns an AIIntegration type\n */\nexport const buildAIIntegrationType = <\n T extends t.Mixed,\n P extends t.ArrayC<EnabledRouteC<T>>,\n>({\n TEnabledRoutes,\n}: {\n /** the type of the enabledRoutes property */\n TEnabledRoutes: P;\n}): AIIntegrationC<T> =>\n t.type({\n enabledRoutes: TEnabledRoutes,\n });\n"],"mappings":"wCAAA,UAAYA,MAAO,QAEnB,OAAS,YAAAC,MAAgB,2BASlB,IAAMC,EAAwB,CAAoB,CACvD,WAAAC,CACF,IAII,OAAK,CACL,UAAWA,EACX,gBAAmB,QAAMC,EAASC,CAAoB,CAAC,CACzD,CAAC,ECpBH,UAAYC,MAAO,QASZ,IAAMC,EAAyB,CAGpC,CACA,eAAAC,CACF,IAII,OAAK,CACL,cAAeA,CACjB,CAAC","names":["t","valuesOf","buildEnabledRouteType","TRouteName","valuesOf","PathfinderPolicyName","t","buildAIIntegrationType","TEnabledRoutes"]}
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
import r from"colors";import{bootstrap as t}from"global-agent";import{ProxyAgent as e,setGlobalDispatcher as s}from"undici";import p from"yargs-parser";var i=console,{httpProxy:o=process.env.http_proxy}=p(process.argv.slice(2));o&&(i.info(r.green(`Initializing proxy: ${o}`)),process.env.GLOBAL_AGENT_HTTP_PROXY=o,t(),s(new e(o)));export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-43JWXG77.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/logger.ts"],"sourcesContent":["import colors from 'colors';\nimport { bootstrap } from 'global-agent';\nimport { ProxyAgent, setGlobalDispatcher } from 'undici';\nimport yargs from 'yargs-parser';\n\nexport const logger = console;\n\n// When the proxy env var of flag is specified, initiate the proxy\nconst { httpProxy = process.env.http_proxy } = yargs(process.argv.slice(2));\nif (httpProxy) {\n logger.info(colors.green(`Initializing proxy: ${httpProxy}`));\n\n // Use global-agent, which overrides `request` based requests\n process.env.GLOBAL_AGENT_HTTP_PROXY = httpProxy;\n bootstrap();\n\n // Use undici, which overrides `fetch` based requests\n setGlobalDispatcher(new ProxyAgent(httpProxy));\n}\n"],"mappings":"AAAA,OAAOA,MAAY,SACnB,OAAS,aAAAC,MAAiB,eAC1B,OAAS,cAAAC,EAAY,uBAAAC,MAA2B,SAChD,OAAOC,MAAW,eAEX,IAAMC,EAAS,QAGhB,CAAE,UAAAC,EAAY,QAAQ,IAAI,UAAW,EAAIF,EAAM,QAAQ,KAAK,MAAM,CAAC,CAAC,EACtEE,IACFD,EAAO,KAAKL,EAAO,MAAM,uBAAuBM,CAAS,EAAE,CAAC,EAG5D,QAAQ,IAAI,wBAA0BA,EACtCL,EAAU,EAGVE,EAAoB,IAAID,EAAWI,CAAS,CAAC","names":["colors","bootstrap","ProxyAgent","setGlobalDispatcher","yargs","logger","httpProxy"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/helpers/parseVariablesFromString.ts"],"sourcesContent":["/**\n * Parse variables from string\n *\n * @param variables - Variables as string\n * @returns Variables as object\n */\nexport function parseVariablesFromString(variables: string): {\n [k in string]: string;\n} {\n // Parse out the variables\n const splitVars = variables.split(',').filter((x) => !!x);\n const vars: { [k in string]: string } = {};\n splitVars.forEach((variable) => {\n const [k, v] = variable.split(':');\n if (!k || !v) {\n throw new Error(\n `Invalid variable: ${variable}. Expected format: key:value`,\n );\n }\n vars[k] = v;\n });\n return vars;\n}\n"],"mappings":"AAMO,SAASA,EAAyBC,EAEvC,CAEA,IAAMC,EAAYD,EAAU,MAAM,GAAG,EAAE,OAAQE,GAAM,CAAC,CAACA,CAAC,EAClDC,EAAkC,CAAC,EACzC,OAAAF,EAAU,QAASG,GAAa,CAC9B,GAAM,CAACC,EAAGC,CAAC,EAAIF,EAAS,MAAM,GAAG,EACjC,GAAI,CAACC,GAAK,CAACC,EACT,MAAM,IAAI,MACR,qBAAqBF,CAAQ,8BAC/B,EAEFD,EAAKE,CAAC,EAAIC,CACZ,CAAC,EACMH,CACT","names":["parseVariablesFromString","variables","splitVars","x","vars","variable","k","v"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import{c as u}from"./chunk-
|
|
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(`
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/code-scanning/integrations/cocoaPods.ts","../src/lib/code-scanning/integrations/gradle.ts","../src/lib/code-scanning/integrations/javascriptPackageJson.ts","../src/lib/code-scanning/integrations/pythonRequirementsTxt.ts","../src/lib/code-scanning/integrations/gemfile.ts","../src/lib/code-scanning/integrations/pubspec.ts","../src/lib/code-scanning/integrations/composerJson.ts","../src/lib/code-scanning/integrations/swift.ts","../src/lib/code-scanning/constants.ts","../src/lib/code-scanning/findCodePackagesInFolder.ts"],"sourcesContent":["import { readFileSync } from 'fs';\nimport { CodeScanningConfig } from '../types';\nimport { CodePackageSdk } from '../../../codecs';\nimport { findAllWithRegex } from '@transcend-io/type-utils';\nimport { CodePackageType } from '@transcend-io/privacy-types';\n\nconst POD_TARGET_REGEX = /target ('|\")(.*?)('|\")/;\nconst POD_PACKAGE_REGEX = /pod ('|\")(.*?)('|\")(, ('|\")~> (.+?)('|\")|)/;\n\nexport const cocoaPods: CodeScanningConfig = {\n supportedFiles: ['Podfile'],\n ignoreDirs: ['Pods'],\n scanFunction: (filePath) => {\n const fileContents = readFileSync(filePath, 'utf-8');\n\n const targets = findAllWithRegex(\n {\n value: new RegExp(POD_TARGET_REGEX, 'g'),\n matches: ['quote1', 'name', 'quote2'],\n },\n fileContents,\n );\n const packages = findAllWithRegex(\n {\n value: new RegExp(POD_PACKAGE_REGEX, 'g'),\n matches: [\n 'quote1',\n 'name',\n 'quote2',\n 'extra',\n 'quote3',\n 'version',\n 'quote4',\n ],\n },\n fileContents,\n );\n\n const deps: CodePackageSdk[] = targets.map((target, ind) => ({\n name: target.name,\n type: CodePackageType.CocoaPods,\n softwareDevelopmentKits: packages\n .filter(\n (pkg) =>\n pkg.matchIndex > target.matchIndex &&\n (!targets[ind + 1] || pkg.matchIndex < targets[ind + 1].matchIndex),\n )\n .map((pkg) => ({\n name: pkg.name,\n version: pkg.version,\n })),\n }));\n\n return deps;\n },\n};\n","import { readFileSync } from 'fs';\nimport { CodeScanningConfig } from '../types';\nimport { findAllWithRegex } from '@transcend-io/type-utils';\nimport { dirname } from 'path';\n\nconst GRADLE_IMPLEMENTATION_REGEX =\n /implementation( *)('|\")(.+?):(.+?):(.+?|)('|\")/;\nconst GRADLE_PLUGIN_REGEX = /apply plugin: *('|\")(.+?)(:(.+?)|)('|\")/;\nconst GRADLE_IMPLEMENTATION_GROUP_REGEX =\n /implementation group:( *)('|\")(.+?)('|\"),( *)name:( *)('|\")(.+?)('|\"),( *)version:( *)('|\")(.+?)('|\")/;\nconst GRADLE_APPLICATION_NAME_REGEX = /applicationId( *)\"(.+?)\"/;\n\n/**\n * So far, there are three ways of defining dependencies that is supported\n * implementation group: 'org.eclipse.jdt', name: 'org.eclipse.jdt.core', version: '3.28.0'\n * or\n * implementation 'com.google.firebase:firebase-analytics:18.0.0'\n * or\n * apply plugin: 'com.google.gms.google-services'\n *\n * single and double quotes are both recognized\n */\nexport const gradle: CodeScanningConfig = {\n supportedFiles: ['build.gradle**'],\n ignoreDirs: [\n 'gradle-app.setting',\n 'gradle-wrapper.jar',\n 'gradle-wrapper.properties',\n ],\n scanFunction: (filePath) => {\n const fileContents = readFileSync(filePath, 'utf-8');\n const directory = dirname(filePath);\n\n const targets = findAllWithRegex(\n {\n value: new RegExp(GRADLE_IMPLEMENTATION_REGEX, 'g'),\n matches: ['space', 'quote1', 'name', 'path', 'version', 'quote2'],\n },\n fileContents,\n );\n const targetPlugins = findAllWithRegex(\n {\n value: new RegExp(GRADLE_PLUGIN_REGEX, 'g'),\n matches: ['quote1', 'name', 'group', 'version', 'quote2'],\n },\n fileContents,\n );\n const targetGroups = findAllWithRegex(\n {\n value: new RegExp(GRADLE_IMPLEMENTATION_GROUP_REGEX, 'g'),\n matches: [\n 'space1',\n 'quote1',\n 'group',\n 'quote2',\n 'space2',\n 'space3',\n 'quote3',\n 'name',\n 'quote4',\n 'space4',\n 'space5',\n 'quote5',\n 'version',\n 'quote6',\n ],\n },\n fileContents,\n );\n const applications = findAllWithRegex(\n {\n value: new RegExp(GRADLE_APPLICATION_NAME_REGEX, 'g'),\n matches: ['space', 'name'],\n },\n fileContents,\n );\n if (applications.length > 1) {\n throw new Error(`Expected only one applicationId per file: ${filePath}`);\n }\n\n return [\n {\n name: applications[0]?.name || directory.split('/').pop()!,\n softwareDevelopmentKits: [\n ...targets,\n ...targetGroups,\n ...targetPlugins,\n ].map((target) => ({\n name: target.name,\n version: target.version || undefined,\n })),\n },\n ];\n },\n};\n","import { readFileSync } from 'fs';\nimport { CodeScanningConfig } from '../types';\nimport { CodePackageSdk } from '../../../codecs';\nimport { dirname } from 'path';\n\nexport const javascriptPackageJson: CodeScanningConfig = {\n supportedFiles: ['package.json'],\n ignoreDirs: ['node_modules', 'serverless-build', 'lambda-build'],\n scanFunction: (filePath) => {\n const file = readFileSync(filePath, 'utf-8');\n const directory = dirname(filePath);\n const asJson = JSON.parse(file);\n const {\n name,\n description,\n dependencies = {},\n devDependencies = {},\n optionalDependencies = {},\n } = asJson;\n return [\n {\n // name of the package\n name: name || directory.split('/').pop()!,\n description,\n softwareDevelopmentKits: [\n ...Object.entries(dependencies).map(\n ([name, version]): CodePackageSdk => ({\n name,\n version: typeof version === 'string' ? version : undefined,\n }),\n ),\n ...Object.entries(devDependencies).map(\n ([name, version]): CodePackageSdk => ({\n name,\n version: typeof version === 'string' ? version : undefined,\n isDevDependency: true,\n }),\n ),\n ...Object.entries(optionalDependencies).map(\n ([name, version]): CodePackageSdk => ({\n name,\n version: typeof version === 'string' ? version : undefined,\n }),\n ),\n ],\n },\n ];\n },\n};\n","import { readFileSync } from 'fs';\nimport { CodeScanningConfig } from '../types';\nimport { findAllWithRegex } from '@transcend-io/type-utils';\nimport { listFiles } from '../../api-keys';\nimport { dirname, join } from 'path';\nimport { CodePackageType } from '@transcend-io/privacy-types';\n\nconst REQUIREMENTS_PACKAGE_MATCH = /(.+?)(=+)(.+)/;\nconst PACKAGE_NAME = /name *= *('|\")(.+?)('|\")/;\nconst PACKAGE_DESCRIPTION = /description *= *('|\")(.+?)('|\")/;\n\nexport const pythonRequirementsTxt: CodeScanningConfig = {\n supportedFiles: ['requirements.txt'],\n ignoreDirs: ['build', 'lib', 'lib64'],\n scanFunction: (filePath) => {\n const fileContents = readFileSync(filePath, 'utf-8');\n const directory = dirname(filePath);\n const filesInFolder = listFiles(directory);\n\n // parse setup file for name\n const setupFile = filesInFolder.find((file) => file === 'setup.py');\n const setupFileContents = setupFile\n ? readFileSync(join(directory, setupFile), 'utf-8')\n : undefined;\n const packageName = setupFileContents\n ? (PACKAGE_NAME.exec(setupFileContents) || [])[2]\n : undefined;\n const packageDescription = setupFileContents\n ? (PACKAGE_DESCRIPTION.exec(setupFileContents) || [])[2]\n : undefined;\n\n const targets = findAllWithRegex(\n {\n value: new RegExp(REQUIREMENTS_PACKAGE_MATCH, 'g'),\n matches: ['name', 'equals', 'version'],\n },\n fileContents,\n );\n\n return [\n {\n name: packageName || directory.split('/').pop()!,\n description: packageDescription || undefined,\n type: CodePackageType.RequirementsTxt,\n softwareDevelopmentKits: targets.map((pkg) => ({\n name: pkg.name,\n version: pkg.version,\n })),\n },\n ];\n },\n};\n","import { readFileSync } from 'fs';\nimport { CodeScanningConfig } from '../types';\nimport { findAllWithRegex } from '@transcend-io/type-utils';\nimport { listFiles } from '../../api-keys';\nimport { dirname } from 'path';\nimport { CodePackageType } from '@transcend-io/privacy-types';\n\nconst GEM_PACKAGE_REGEX = /gem *('|\")(.+?)('|\")(, *('|\")(.+?)('|\")|)/;\nconst GEMFILE_PACKAGE_NAME_REGEX = /spec\\.name *= *('|\")(.+?)('|\")/;\nconst GEMFILE_PACKAGE_DESCRIPTION_REGEX =\n /spec\\.description *= *('|\")(.+?)('|\")/;\nconst GEMFILE_PACKAGE_SUMMARY_REGEX = /spec\\.summary *= *('|\")(.+?)('|\")/;\n\nexport const gemfile: CodeScanningConfig = {\n supportedFiles: ['Gemfile'],\n ignoreDirs: ['bin'],\n scanFunction: (filePath) => {\n const fileContents = readFileSync(filePath, 'utf-8');\n const directory = dirname(filePath);\n const filesInFolder = listFiles(directory);\n\n // parse gemspec file for name\n const gemspec = filesInFolder.find((file) => file === '.gemspec');\n const gemspecContents = gemspec\n ? readFileSync(gemspec, 'utf-8')\n : undefined;\n const gemfileName = gemspecContents\n ? (GEMFILE_PACKAGE_NAME_REGEX.exec(gemspecContents) || [])[2]\n : undefined;\n const gemfileDescription = gemspecContents\n ? (GEMFILE_PACKAGE_DESCRIPTION_REGEX.exec(gemspecContents) ||\n GEMFILE_PACKAGE_SUMMARY_REGEX.exec(gemspecContents) ||\n [])[1]\n : undefined;\n\n const targets = findAllWithRegex(\n {\n value: new RegExp(GEM_PACKAGE_REGEX, 'g'),\n matches: [\n 'quote1',\n 'name',\n 'quote2',\n 'hasVersion',\n 'quote3',\n 'version',\n 'quote4',\n ],\n },\n fileContents,\n );\n\n return [\n {\n name: gemfileName || directory.split('/').pop()!,\n description: gemfileDescription || undefined,\n type: CodePackageType.RequirementsTxt,\n softwareDevelopmentKits: targets.map((pkg) => ({\n name: pkg.name,\n version: pkg.version,\n })),\n },\n ];\n },\n};\n","import { readFileSync } from 'fs';\nimport { CodeScanningConfig } from '../types';\nimport { CodePackageType } from '@transcend-io/privacy-types';\nimport yaml from 'js-yaml';\nimport { dirname } from 'path';\n\n/**\n * Remove YAML comments from a string\n *\n * @param yamlString - YAML string\n * @returns String without comments\n */\nfunction removeYAMLComments(yamlString: string): string {\n return yamlString\n .split('\\n')\n .map((line) => {\n // Remove inline comments\n const commentIndex = line.indexOf('#');\n if (commentIndex > -1) {\n // Check if '#' is not inside a string\n if (\n !line.substring(0, commentIndex).includes('\"') &&\n !line.substring(0, commentIndex).includes(\"'\")\n ) {\n return line.substring(0, commentIndex).trim();\n }\n }\n return line;\n })\n .filter((line) => line.length > 0)\n .join('\\n');\n}\n\nexport const pubspec: CodeScanningConfig = {\n supportedFiles: ['pubspec.yml'],\n ignoreDirs: ['build'],\n scanFunction: (filePath) => {\n const directory = dirname(filePath);\n const fileContents = readFileSync(filePath, 'utf-8');\n const {\n name,\n description,\n dev_dependencies = {},\n dependencies = {},\n } = yaml.load(removeYAMLComments(fileContents)) as {\n /** Name */\n name?: string;\n /** Description */\n description?: string;\n /** Dev dependencies */\n dev_dependencies?: { [k in string]: number | Record<string, string> };\n /** Dependencies */\n dependencies?: { [k in string]: number | Record<string, string> };\n };\n return [\n {\n name: name || directory.split('/').pop()!,\n description,\n type: CodePackageType.RequirementsTxt,\n softwareDevelopmentKits: [\n ...Object.entries(dependencies).map(([name, version]) => ({\n name,\n version:\n typeof version === 'string'\n ? version\n : typeof version === 'number'\n ? version.toString()\n : version?.sdk,\n })),\n ...Object.entries(dev_dependencies).map(([name, version]) => ({\n name,\n version:\n typeof version === 'string'\n ? version\n : typeof version === 'number'\n ? version.toString()\n : version?.sdk,\n isDevDependency: true,\n })),\n ],\n },\n ];\n },\n};\n","import { readFileSync } from 'fs';\nimport { CodeScanningConfig } from '../types';\nimport { CodePackageSdk } from '../../../codecs';\nimport { dirname } from 'path';\n\nexport const composerJson: CodeScanningConfig = {\n supportedFiles: ['composer.json'],\n ignoreDirs: ['vendor', 'node_modules', 'cache', 'build', 'dist'],\n scanFunction: (filePath) => {\n const file = readFileSync(filePath, 'utf-8');\n const directory = dirname(filePath);\n const asJson = JSON.parse(file);\n const {\n name,\n description,\n require: requireDependencies = {},\n 'require-dev': requiredDevDependencies = {},\n } = asJson;\n return [\n {\n // name of the package\n name: name || directory.split('/').pop()!,\n description,\n softwareDevelopmentKits: [\n ...Object.entries(requireDependencies).map(\n ([name, version]): CodePackageSdk => ({\n name,\n version: typeof version === 'string' ? version : undefined,\n }),\n ),\n ...Object.entries(requiredDevDependencies).map(\n ([name, version]): CodePackageSdk => ({\n name,\n version: typeof version === 'string' ? version : undefined,\n isDevDependency: true,\n }),\n ),\n ],\n },\n ];\n },\n};\n","import { readFileSync } from 'fs';\nimport { CodeScanningConfig } from '../types';\nimport { CodePackageType } from '@transcend-io/privacy-types';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport * as t from 'io-ts';\nimport { dirname } from 'path';\n\nconst SwiftPackage = t.type({\n pins: t.array(\n t.type({\n identity: t.string,\n kind: t.string,\n location: t.string,\n state: t.type({\n revision: t.string,\n version: t.string,\n }),\n }),\n ),\n version: t.number,\n});\n\nexport const swift: CodeScanningConfig = {\n supportedFiles: ['Package.resolved'],\n ignoreDirs: [],\n scanFunction: (filePath) => {\n const fileContents = readFileSync(filePath, 'utf-8');\n\n const parsed = decodeCodec(SwiftPackage, fileContents);\n\n return [\n {\n name: dirname(filePath).split('/').pop() || '', // FIXME pull from Package.swift ->> name if possible\n type: CodePackageType.CocoaPods, // FIXME should be swift\n softwareDevelopmentKits: parsed.pins.map((target) => ({\n name: target.identity,\n version: target.state.version,\n })),\n },\n ];\n },\n};\n","import { CodeScanningConfig } from './types';\nimport {\n cocoaPods,\n gradle,\n javascriptPackageJson,\n gemfile,\n composerJson,\n pubspec,\n swift,\n pythonRequirementsTxt,\n} from './integrations';\nimport { CodePackageType } from '@transcend-io/privacy-types';\n\n/**\n * @deprecated TODO: https://transcend.height.app/T-32325 - use code scanning instead\n */\nexport const SILO_DISCOVERY_CONFIGS: {\n [k in string]: CodeScanningConfig;\n} = {\n cocoaPods,\n gradle,\n javascriptPackageJson,\n pythonRequirementsTxt,\n gemfile,\n pubspec,\n swift,\n};\n\nexport const CODE_SCANNING_CONFIGS: {\n [k in CodePackageType]: CodeScanningConfig;\n} = {\n [CodePackageType.CocoaPods]: cocoaPods,\n [CodePackageType.Gradle]: gradle,\n [CodePackageType.PackageJson]: javascriptPackageJson,\n [CodePackageType.RequirementsTxt]: pythonRequirementsTxt,\n [CodePackageType.Gemfile]: gemfile,\n [CodePackageType.Pubspec]: pubspec,\n [CodePackageType.ComposerJson]: composerJson,\n [CodePackageType.Swift]: swift,\n};\n","import fastGlob from 'fast-glob';\nimport colors from 'colors';\nimport { CodePackageInput } from '../../codecs';\nimport { getEntries } from '@transcend-io/type-utils';\nimport { CODE_SCANNING_CONFIGS } from './constants';\nimport { logger } from '../../logger';\n\n/**\n * Helper to scan and discovery all of the code packages within a folder\n *\n * @param options - Options\n * @returns the list of integrations\n */\nexport async function findCodePackagesInFolder({\n scanPath,\n ignoreDirs = [],\n repositoryName,\n}: {\n /** The name of the github repository reporting packages for */\n repositoryName: string;\n /** Where to look for package.json files */\n scanPath: string;\n /** The directories to ignore (excludes node_modules and serverless-build) */\n ignoreDirs?: string[];\n}): Promise<CodePackageInput[]> {\n const allCodePackages = await Promise.all(\n getEntries(CODE_SCANNING_CONFIGS).map(async ([codePackageType, config]) => {\n const {\n ignoreDirs: configIgnoreDirs,\n supportedFiles,\n scanFunction,\n } = config;\n const dirsToIgnore = [...ignoreDirs, ...configIgnoreDirs].filter(\n (dir) => dir.length > 0,\n );\n try {\n const filesToScan: string[] = await fastGlob(\n `${scanPath}/**/${supportedFiles.join('|')}`,\n {\n ignore: dirsToIgnore.map((dir: string) => `${scanPath}/**/${dir}`),\n unique: true,\n onlyFiles: true,\n },\n );\n logger.info(\n colors.magenta(\n `Scanning: ${filesToScan.length} files of type ${codePackageType}`,\n ),\n );\n const allPackages = filesToScan\n .map((filePath) =>\n scanFunction(filePath).map((result) => ({\n ...result,\n relativePath: filePath.replace(`${scanPath}/`, ''),\n })),\n )\n .flat();\n logger.info(\n colors.green(\n `Found: ${allPackages.length} packages and ${\n allPackages\n .map(\n ({ softwareDevelopmentKits = [] }) => softwareDevelopmentKits,\n )\n .flat().length\n } sdks`,\n ),\n );\n\n return allPackages.map(\n (pkg): CodePackageInput => ({\n ...pkg,\n type: codePackageType,\n repositoryName,\n }),\n );\n } catch (error) {\n throw new Error(\n `Error scanning globs ${supportedFiles} with error: ${error}`,\n );\n }\n }),\n );\n\n return allCodePackages.flat();\n}\n"],"mappings":"gFAAA,OAAS,gBAAAA,MAAoB,KAG7B,OAAS,oBAAAC,MAAwB,2BACjC,OAAS,mBAAAC,MAAuB,8BAEhC,IAAMC,EAAmB,yBACnBC,EAAoB,6CAEbC,EAAgC,CAC3C,eAAgB,CAAC,SAAS,EAC1B,WAAY,CAAC,MAAM,EACnB,aAAeC,GAAa,CAC1B,IAAMC,EAAeP,EAAaM,EAAU,OAAO,EAE7CE,EAAUP,EACd,CACE,MAAO,IAAI,OAAOE,EAAkB,GAAG,EACvC,QAAS,CAAC,SAAU,OAAQ,QAAQ,CACtC,EACAI,CACF,EACME,EAAWR,EACf,CACE,MAAO,IAAI,OAAOG,EAAmB,GAAG,EACxC,QAAS,CACP,SACA,OACA,SACA,QACA,SACA,UACA,QACF,CACF,EACAG,CACF,EAiBA,OAf+BC,EAAQ,IAAI,CAACE,EAAQC,KAAS,CAC3D,KAAMD,EAAO,KACb,KAAMR,EAAgB,UACtB,wBAAyBO,EACtB,OACEG,GACCA,EAAI,WAAaF,EAAO,aACvB,CAACF,EAAQG,EAAM,CAAC,GAAKC,EAAI,WAAaJ,EAAQG,EAAM,CAAC,EAAE,WAC5D,EACC,IAAKC,IAAS,CACb,KAAMA,EAAI,KACV,QAASA,EAAI,OACf,EAAE,CACN,EAAE,CAGJ,CACF,ECvDA,OAAS,gBAAAC,MAAoB,KAE7B,OAAS,oBAAAC,MAAwB,2BACjC,OAAS,WAAAC,MAAe,OAExB,IAAMC,EACJ,iDACIC,EAAsB,0CACtBC,EACJ,wGACIC,EAAgC,2BAYzBC,EAA6B,CACxC,eAAgB,CAAC,gBAAgB,EACjC,WAAY,CAC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AI,CACF,IAAMC,EAAwB,MAAMC,GAClC,GAAGb,CAAQ,OAAOQ,EAAe,KAAK,GAAG,CAAC,GAC1C,CACE,OAAQE,EAAa,IAAKC,GAAgB,GAAGX,CAAQ,OAAOW,CAAG,EAAE,EACjE,OAAQ,GACR,UAAW,EACb,CACF,EACAG,EAAO,KACLC,EAAO,QACL,aAAaH,EAAY,MAAM,kBAAkBP,CAAe,EAClE,CACF,EACA,IAAMW,EAAcJ,EACjB,IAAKK,GACJR,EAAaQ,CAAQ,EAAE,IAAKC,IAAY,CACtC,GAAGA,EACH,aAAcD,EAAS,QAAQ,GAAGjB,CAAQ,IAAK,EAAE,CACnD,EAAE,CACJ,EACC,KAAK,EACR,OAAAc,EAAO,KACLC,EAAO,MACL,UAAUC,EAAY,MAAM,iBAC1BA,EACG,IACC,CAAC,CAAE,wBAAAG,EAA0B,CAAC,CAAE,IAAMA,CACxC,EACC,KAAK,EAAE,MACZ,OACF,CACF,EAEOH,EAAY,IAChBI,IAA2B,CAC1B,GAAGA,EACH,KAAMf,EACN,eAAAH,CACF,EACF,CACF,OAASmB,EAAO,CACd,MAAM,IAAI,MACR,wBAAwBb,CAAc,gBAAgBa,CAAK,EAC7D,CACF,CACF,CAAC,CACH,GAEuB,KAAK,CAC9B","names":["readFileSync","findAllWithRegex","CodePackageType","POD_TARGET_REGEX","POD_PACKAGE_REGEX","cocoaPods","filePath","fileContents","targets","packages","target","ind","pkg","readFileSync","findAllWithRegex","dirname","GRADLE_IMPLEMENTATION_REGEX","GRADLE_PLUGIN_REGEX","GRADLE_IMPLEMENTATION_GROUP_REGEX","GRADLE_APPLICATION_NAME_REGEX","gradle","filePath","fileContents","directory","targets","targetPlugins","targetGroups","applications","target","readFileSync","dirname","javascriptPackageJson","filePath","file","directory","asJson","name","description","dependencies","devDependencies","optionalDependencies","version","readFileSync","findAllWithRegex","dirname","join","CodePackageType","REQUIREMENTS_PACKAGE_MATCH","PACKAGE_NAME","PACKAGE_DESCRIPTION","pythonRequirementsTxt","filePath","fileContents","readFileSync","directory","setupFile","listFiles","file","setupFileContents","packageName","packageDescription","targets","findAllWithRegex","pkg","readFileSync","findAllWithRegex","dirname","CodePackageType","GEM_PACKAGE_REGEX","GEMFILE_PACKAGE_NAME_REGEX","GEMFILE_PACKAGE_DESCRIPTION_REGEX","GEMFILE_PACKAGE_SUMMARY_REGEX","gemfile","filePath","fileContents","readFileSync","directory","gemspec","listFiles","file","gemspecContents","gemfileName","gemfileDescription","targets","findAllWithRegex","pkg","readFileSync","CodePackageType","yaml","dirname","removeYAMLComments","yamlString","line","commentIndex","pubspec","filePath","directory","fileContents","name","description","dev_dependencies","dependencies","version","readFileSync","dirname","composerJson","filePath","file","directory","asJson","name","description","requireDependencies","requiredDevDependencies","version","readFileSync","CodePackageType","decodeCodec","t","dirname","SwiftPackage","swift","filePath","fileContents","parsed","target","CodePackageType","SILO_DISCOVERY_CONFIGS","cocoaPods","gradle","javascriptPackageJson","pythonRequirementsTxt","gemfile","pubspec","swift","CODE_SCANNING_CONFIGS","composerJson","fastGlob","colors","getEntries","findCodePackagesInFolder","scanPath","ignoreDirs","repositoryName","getEntries","CODE_SCANNING_CONFIGS","codePackageType","config","configIgnoreDirs","supportedFiles","scanFunction","dirsToIgnore","dir","filesToScan","fastGlob","logger","colors","allPackages","filePath","result","softwareDevelopmentKits","pkg","error"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/context.ts"],"sourcesContent":["import fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport type { StricliAutoCompleteContext } from '@stricli/auto-complete';\nimport type { CommandContext } from '@stricli/core';\n\nexport interface LocalContext\n extends CommandContext,\n StricliAutoCompleteContext {\n /** The Node.js process object */\n readonly process: NodeJS.Process;\n // ...\n}\n\n/**\n * Builds the context for the CLI.\n *\n * @param process - The Node.js process object.\n * @returns The context for the CLI.\n */\nexport function buildContext(process: NodeJS.Process): LocalContext {\n return {\n process,\n os,\n fs,\n path,\n };\n}\n"],"mappings":"AAAA,OAAOA,MAAQ,KACf,OAAOC,MAAQ,KACf,OAAOC,MAAU,OAkBV,SAASC,EAAaC,EAAuC,CAClE,MAAO,CACL,QAAAA,EACA,GAAAH,EACA,GAAAD,EACA,KAAAE,CACF,CACF","names":["fs","os","path","buildContext","process"]}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{k as i}from"./chunk-
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/helpers/inquirer.ts"],"sourcesContent":["import inquirer from 'inquirer';\nimport autoCompletePrompt from 'inquirer-autocomplete-prompt';\nimport { fuzzySearch } from '../requests';\nimport { ObjByString } from '@transcend-io/type-utils';\n\n/**\n * Inquirer confirm text\n *\n * @param options - Options\n */\nexport async function inquirerConfirmBoolean({\n message,\n}: {\n /** Message */\n message: string;\n}): Promise<boolean> {\n const { response } = await inquirer.prompt<{\n /** confirmation */\n response: boolean;\n }>([\n {\n name: 'response',\n message,\n type: 'confirm',\n },\n ]);\n return response;\n}\n\n/**\n * Inquirer confirm text\n *\n * @param options - Options\n */\nexport async function inquirerConfirmText({\n message,\n}: {\n /** Message */\n message: string;\n}): Promise<string> {\n const { response } = await inquirer.prompt<{\n /** confirmation */\n response: string;\n }>([\n {\n name: 'response',\n message,\n type: 'text',\n validate: (x) => x.trim().length > 0,\n },\n ]);\n return response;\n}\n\n/**\n * Inquirer auto complete\n *\n * @param options - Options\n */\nexport async function inquirerAutoComplete({\n defaultValue,\n values,\n message,\n}: {\n /** Default value */\n defaultValue?: string;\n /** Message */\n message: string;\n /** Values to select */\n values: string[];\n}): Promise<string> {\n inquirer.registerPrompt('autocomplete', autoCompletePrompt);\n const { response } = await inquirer.prompt<{\n /** confirmation */\n response: string;\n }>([\n {\n name: 'response',\n message,\n type: 'autocomplete',\n default: defaultValue,\n source: (answersSoFar: ObjByString, input: string) =>\n !input\n ? values\n : values.filter(\n (x) => typeof x === 'string' && fuzzySearch(input, x),\n ),\n },\n ]);\n return response;\n}\n"],"mappings":"wCAAA,OAAOA,MAAc,WACrB,OAAOC,MAAwB,+BAS/B,eAAsBC,EAAuB,CAC3C,QAAAC,CACF,EAGqB,CACnB,GAAM,CAAE,SAAAC,CAAS,EAAI,MAAMC,EAAS,OAGjC,CACD,CACE,KAAM,WACN,QAAAF,EACA,KAAM,SACR,CACF,CAAC,EACD,OAAOC,CACT,CAOA,eAAsBE,EAAoB,CACxC,QAAAH,CACF,EAGoB,CAClB,GAAM,CAAE,SAAAC,CAAS,EAAI,MAAMC,EAAS,OAGjC,CACD,CACE,KAAM,WACN,QAAAF,EACA,KAAM,OACN,SAAWI,GAAMA,EAAE,KAAK,EAAE,OAAS,CACrC,CACF,CAAC,EACD,OAAOH,CACT,CAOA,eAAsBI,EAAqB,CACzC,aAAAC,EACA,OAAAC,EACA,QAAAP,CACF,EAOoB,CAClBE,EAAS,eAAe,eAAgBM,CAAkB,EAC1D,GAAM,CAAE,SAAAP,CAAS,EAAI,MAAMC,EAAS,OAGjC,CACD,CACE,KAAM,WACN,QAAAF,EACA,KAAM,eACN,QAASM,EACT,OAAQ,CAACG,EAA2BC,IACjCA,EAEGH,EAAO,OACJH,GAAM,OAAOA,GAAM,UAAYO,EAAYD,EAAON,CAAC,CACtD,EAHAG,CAIR,CACF,CAAC,EACD,OAAON,CACT","names":["inquirer","autoCompletePrompt","inquirerConfirmBoolean","message","response","inquirer","inquirerConfirmText","x","inquirerAutoComplete","defaultValue","values","autoCompletePrompt","answersSoFar","input","fuzzySearch"]}
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
import{makeEnum as e}from"@transcend-io/type-utils";var a=(s=>(s.Json="json",s))(a||{}),o=(s=>(s.Assessments="assessments",s))(o||{}),p=(i=>(i.OneTrust="oneTrust",i.File="file",i))(p||{}),m=(t=>(t.ApiKeys="apiKeys",t.Attributes="customFields",t.Templates="templates",t.DataSilos="dataSilos",t.Enrichers="enrichers",t.DataFlows="dataFlows",t.BusinessEntities="businessEntities",t.Actions="actions",t.DataSubjects="dataSubjects",t.Identifiers="identifiers",t.Cookies="cookies",t.ConsentManager="consentManager",t.Partitions="partitions",t.Prompts="prompts",t.PromptPartials="promptPartials",t.PromptGroups="promptGroups",t.Agents="agents",t.AgentFunctions="agentFunctions",t.AgentFiles="agentFiles",t.Vendors="vendors",t.DataCategories="dataCategories",t.ProcessingPurposes="processingPurposes",t.ActionItems="actionItems",t.ActionItemCollections="actionItemCollections",t.Teams="teams",t.PrivacyCenters="privacyCenters",t.Policies="policies",t.Messages="messages",t.Assessments="assessments",t.AssessmentTemplates="assessmentTemplates",t.Purposes="purposes",t))(m||{}),n=e({RedactEmail:"redactEmail",Log:"log",LogToTranscend:"logToTranscend",ApplyTranscendPolicies:"applyTranscendPolicies"}),h=e({ChatCompletion:"/v1/chat/completions",Embeddings:"/v1/embeddings",Completions:"/v1/completions",Agents:"/v1/assistants",Agent:"/v1/assistants/:assistantId",Threads:"/v1/threads",Thread:"/v1/threads/:threadId",Messages:"/v1/threads/:threadId/messages",Message:"/v1/threads/:threadId/messages/:messageId",Runs:"/v1/threads/:threadId/runs",Run:"/v1/threads/:threadId/runs/:runId",Files:"/v1/files",File:"/v1/files/:fileId"});export{a,o as b,p as c,m as d,n as e,h as f};
|
|
2
|
+
//# sourceMappingURL=chunk-ARVEJERC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/enums.ts"],"sourcesContent":["import { makeEnum } from '@transcend-io/type-utils';\n\n/** Accepted file formats for exporting resources from OneTrust */\nexport enum OneTrustFileFormat {\n Json = 'json',\n}\n\n/**\n * Resources that can be pulled in from OneTrust\n */\nexport enum OneTrustPullResource {\n Assessments = 'assessments',\n}\n\n/**\n * Where to read OneTrust resources from\n */\nexport enum OneTrustPullSource {\n OneTrust = 'oneTrust',\n File = 'file',\n}\n\n/**\n * Resources that can be pulled in\n */\nexport enum TranscendPullResource {\n ApiKeys = 'apiKeys',\n Attributes = 'customFields',\n Templates = 'templates',\n DataSilos = 'dataSilos',\n Enrichers = 'enrichers',\n DataFlows = 'dataFlows',\n BusinessEntities = 'businessEntities',\n Actions = 'actions',\n DataSubjects = 'dataSubjects',\n Identifiers = 'identifiers',\n Cookies = 'cookies',\n ConsentManager = 'consentManager',\n Partitions = 'partitions',\n Prompts = 'prompts',\n PromptPartials = 'promptPartials',\n PromptGroups = 'promptGroups',\n Agents = 'agents',\n AgentFunctions = 'agentFunctions',\n AgentFiles = 'agentFiles',\n Vendors = 'vendors',\n DataCategories = 'dataCategories',\n ProcessingPurposes = 'processingPurposes',\n ActionItems = 'actionItems',\n ActionItemCollections = 'actionItemCollections',\n Teams = 'teams',\n PrivacyCenters = 'privacyCenters',\n Policies = 'policies',\n Messages = 'messages',\n Assessments = 'assessments',\n AssessmentTemplates = 'assessmentTemplates',\n Purposes = 'purposes',\n}\n\n/**\n * Names of built in policies for pathfinder\n */\nexport const PathfinderPolicyName = makeEnum({\n RedactEmail: 'redactEmail',\n Log: 'log',\n LogToTranscend: 'logToTranscend',\n ApplyTranscendPolicies: 'applyTranscendPolicies',\n});\n\n/**\n * Type override\n */\nexport type PathfinderPolicyName =\n (typeof PathfinderPolicyName)[keyof typeof PathfinderPolicyName];\n\n/**\n * The names of the OpenAI routes that we support setting policies for\n * reference: https://platform.openai.com/docs/api-reference/introduction\n */\nexport const OpenAIRouteName = makeEnum({\n ChatCompletion: '/v1/chat/completions',\n Embeddings: '/v1/embeddings',\n Completions: '/v1/completions',\n Agents: '/v1/assistants',\n Agent: '/v1/assistants/:assistantId',\n Threads: '/v1/threads',\n Thread: '/v1/threads/:threadId',\n Messages: '/v1/threads/:threadId/messages',\n Message: '/v1/threads/:threadId/messages/:messageId',\n Runs: '/v1/threads/:threadId/runs',\n Run: '/v1/threads/:threadId/runs/:runId',\n Files: '/v1/files',\n File: '/v1/files/:fileId',\n});\n\n/**\n * Type override\n */\nexport type OpenAIRouteName =\n (typeof OpenAIRouteName)[keyof typeof OpenAIRouteName];\n"],"mappings":"AAAA,OAAS,YAAAA,MAAgB,2BAGlB,IAAKC,OACVA,EAAA,KAAO,OADGA,OAAA,IAOAC,OACVA,EAAA,YAAc,cADJA,OAAA,IAOAC,OACVA,EAAA,SAAW,WACXA,EAAA,KAAO,OAFGA,OAAA,IAQAC,OACVA,EAAA,QAAU,UACVA,EAAA,WAAa,eACbA,EAAA,UAAY,YACZA,EAAA,UAAY,YACZA,EAAA,UAAY,YACZA,EAAA,UAAY,YACZA,EAAA,iBAAmB,mBACnBA,EAAA,QAAU,UACVA,EAAA,aAAe,eACfA,EAAA,YAAc,cACdA,EAAA,QAAU,UACVA,EAAA,eAAiB,iBACjBA,EAAA,WAAa,aACbA,EAAA,QAAU,UACVA,EAAA,eAAiB,iBACjBA,EAAA,aAAe,eACfA,EAAA,OAAS,SACTA,EAAA,eAAiB,iBACjBA,EAAA,WAAa,aACbA,EAAA,QAAU,UACVA,EAAA,eAAiB,iBACjBA,EAAA,mBAAqB,qBACrBA,EAAA,YAAc,cACdA,EAAA,sBAAwB,wBACxBA,EAAA,MAAQ,QACRA,EAAA,eAAiB,iBACjBA,EAAA,SAAW,WACXA,EAAA,SAAW,WACXA,EAAA,YAAc,cACdA,EAAA,oBAAsB,sBACtBA,EAAA,SAAW,WA/BDA,OAAA,IAqCCC,EAAuBL,EAAS,CAC3C,YAAa,cACb,IAAK,MACL,eAAgB,iBAChB,uBAAwB,wBAC1B,CAAC,EAYYM,EAAkBN,EAAS,CACtC,eAAgB,uBAChB,WAAY,iBACZ,YAAa,kBACb,OAAQ,iBACR,MAAO,8BACP,QAAS,cACT,OAAQ,wBACR,SAAU,iCACV,QAAS,4CACT,KAAM,6BACN,IAAK,oCACL,MAAO,YACP,KAAM,mBACR,CAAC","names":["makeEnum","OneTrustFileFormat","OneTrustPullResource","OneTrustPullSource","TranscendPullResource","PathfinderPolicyName","OpenAIRouteName"]}
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
import{union as c}from"lodash-es";function f(l,{adTechPurposes:p=["SaleOfInfo"],serviceToTitle:s,serviceToSupportedIntegration:r}){let e=[],i=[],n={};l.forEach(t=>{let{service:a,attributes:h=[]}=t;if(!a||a==="internalService")return;let u=h.find(o=>o.key==="Found on Domain");u&&(n[a]||(n[a]=[]),n[a].push(...u.values.map(o=>o.replace("https://","").replace("http://",""))),n[a]=[...new Set(n[a])]),c(t.trackingPurposes,p).length>0?(i.push(a),e.includes(a)&&(e=e.filter(o=>o!==a))):i.includes(a)||e.push(a)});let m=[...new Set(i)].map(t=>({title:s[t],...r[t]?{integrationName:t}:{integrationName:"promptAPerson","outer-type":t},attributes:[{key:"Tech Type",values:["Ad Tech"]},{key:"Found On Domain",values:n[t]||[]}]}));return{siteTechDataSilos:[...new Set(e)].map(t=>({title:s[t],...r[t]?{integrationName:t}:{integrationName:"promptAPerson",outerType:t},attributes:[{key:"Tech Type",values:["Site Tech"]},{key:"Found On Domain",values:n[t]||[]}]})),adTechDataSilos:m}}export{f as a};
|
|
2
|
+
//# sourceMappingURL=chunk-CBAHSBSW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/consent-manager/dataFlowsToDataSilos.ts"],"sourcesContent":["import { DataFlowInput, DataSiloInput } from '../../codecs';\nimport { union } from 'lodash-es';\nimport { IndexedCatalogs } from '../graphql';\n\n/**\n * Convert data flow configurations into a set of data silo configurations\n *\n * @param inputs - Data flow input to convert to data silos\n * @param options - Additional options\n * @returns Business entity configuration input\n */\nexport function dataFlowsToDataSilos(\n inputs: DataFlowInput[],\n {\n adTechPurposes = ['SaleOfInfo'],\n serviceToTitle,\n serviceToSupportedIntegration,\n }: IndexedCatalogs & {\n /** List of purposes that are considered \"Ad Tech\" */\n adTechPurposes?: string[];\n },\n): {\n /** List of data silo configurations for site-tech services */\n siteTechDataSilos: DataSiloInput[];\n /** List of data silo configurations for ad-tech services */\n adTechDataSilos: DataSiloInput[];\n} {\n // List of site tech integrations\n let siteTechIntegrations: string[] = [];\n\n // List of ad tech integrations\n const adTechIntegrations: string[] = [];\n\n // Mapping from service name to list of\n const serviceToFoundOnDomain: { [k in string]: string[] } = {};\n\n // iterate over each flow\n inputs.forEach((flow) => {\n // process data flows with services\n const { service, attributes = [] } = flow;\n if (!service || service === 'internalService') {\n return;\n }\n\n // create mapping to found on domain\n const foundOnDomain = attributes.find(\n (attr) => attr.key === 'Found on Domain',\n );\n\n // Create a list of all domains where the data flow was found\n if (foundOnDomain) {\n if (!serviceToFoundOnDomain[service]) {\n serviceToFoundOnDomain[service] = [];\n }\n serviceToFoundOnDomain[service]!.push(\n ...foundOnDomain.values.map((v) =>\n v.replace('https://', '').replace('http://', ''),\n ),\n );\n serviceToFoundOnDomain[service] = [\n ...new Set(serviceToFoundOnDomain[service]),\n ];\n }\n\n // Keep track of ad tech\n if (union(flow.trackingPurposes, adTechPurposes).length > 0) {\n // add service to ad tech list\n adTechIntegrations.push(service);\n\n // remove from site tech list\n if (siteTechIntegrations.includes(service)) {\n siteTechIntegrations = siteTechIntegrations.filter(\n (s) => s !== service,\n );\n }\n } else if (!adTechIntegrations.includes(service)) {\n // add to site tech list\n siteTechIntegrations.push(service);\n }\n });\n\n // create the list of ad tech integrations\n const adTechDataSilos = [...new Set(adTechIntegrations)].map((service) => ({\n title: serviceToTitle[service],\n ...(serviceToSupportedIntegration[service]\n ? { integrationName: service }\n : { integrationName: 'promptAPerson', 'outer-type': service }),\n attributes: [\n {\n key: 'Tech Type',\n values: ['Ad Tech'],\n },\n {\n key: 'Found On Domain',\n values: serviceToFoundOnDomain[service] || [],\n },\n ],\n }));\n\n // create the list of site tech integrations\n const siteTechDataSilos = [...new Set(siteTechIntegrations)].map(\n (service) => ({\n title: serviceToTitle[service],\n ...(serviceToSupportedIntegration[service]\n ? { integrationName: service }\n : { integrationName: 'promptAPerson', outerType: service }),\n attributes: [\n {\n key: 'Tech Type',\n values: ['Site Tech'],\n },\n {\n key: 'Found On Domain',\n values: serviceToFoundOnDomain[service] || [],\n },\n ],\n }),\n );\n\n return {\n siteTechDataSilos,\n adTechDataSilos,\n };\n}\n"],"mappings":"AACA,OAAS,SAAAA,MAAa,YAUf,SAASC,EACdC,EACA,CACE,eAAAC,EAAiB,CAAC,YAAY,EAC9B,eAAAC,EACA,8BAAAC,CACF,EASA,CAEA,IAAIC,EAAiC,CAAC,EAGhCC,EAA+B,CAAC,EAGhCC,EAAsD,CAAC,EAG7DN,EAAO,QAASO,GAAS,CAEvB,GAAM,CAAE,QAAAC,EAAS,WAAAC,EAAa,CAAC,CAAE,EAAIF,EACrC,GAAI,CAACC,GAAWA,IAAY,kBAC1B,OAIF,IAAME,EAAgBD,EAAW,KAC9BE,GAASA,EAAK,MAAQ,iBACzB,EAGID,IACGJ,EAAuBE,CAAO,IACjCF,EAAuBE,CAAO,EAAI,CAAC,GAErCF,EAAuBE,CAAO,EAAG,KAC/B,GAAGE,EAAc,OAAO,IAAKE,GAC3BA,EAAE,QAAQ,WAAY,EAAE,EAAE,QAAQ,UAAW,EAAE,CACjD,CACF,EACAN,EAAuBE,CAAO,EAAI,CAChC,GAAG,IAAI,IAAIF,EAAuBE,CAAO,CAAC,CAC5C,GAIEV,EAAMS,EAAK,iBAAkBN,CAAc,EAAE,OAAS,GAExDI,EAAmB,KAAKG,CAAO,EAG3BJ,EAAqB,SAASI,CAAO,IACvCJ,EAAuBA,EAAqB,OACzCS,GAAMA,IAAML,CACf,IAEQH,EAAmB,SAASG,CAAO,GAE7CJ,EAAqB,KAAKI,CAAO,CAErC,CAAC,EAGD,IAAMM,EAAkB,CAAC,GAAG,IAAI,IAAIT,CAAkB,CAAC,EAAE,IAAKG,IAAa,CACzE,MAAON,EAAeM,CAAO,EAC7B,GAAIL,EAA8BK,CAAO,EACrC,CAAE,gBAAiBA,CAAQ,EAC3B,CAAE,gBAAiB,gBAAiB,aAAcA,CAAQ,EAC9D,WAAY,CACV,CACE,IAAK,YACL,OAAQ,CAAC,SAAS,CACpB,EACA,CACE,IAAK,kBACL,OAAQF,EAAuBE,CAAO,GAAK,CAAC,CAC9C,CACF,CACF,EAAE,EAsBF,MAAO,CACL,kBApBwB,CAAC,GAAG,IAAI,IAAIJ,CAAoB,CAAC,EAAE,IAC1DI,IAAa,CACZ,MAAON,EAAeM,CAAO,EAC7B,GAAIL,EAA8BK,CAAO,EACrC,CAAE,gBAAiBA,CAAQ,EAC3B,CAAE,gBAAiB,gBAAiB,UAAWA,CAAQ,EAC3D,WAAY,CACV,CACE,IAAK,YACL,OAAQ,CAAC,WAAW,CACtB,EACA,CACE,IAAK,kBACL,OAAQF,EAAuBE,CAAO,GAAK,CAAC,CAC9C,CACF,CACF,EACF,EAIE,gBAAAM,CACF,CACF","names":["union","dataFlowsToDataSilos","inputs","adTechPurposes","serviceToTitle","serviceToSupportedIntegration","siteTechIntegrations","adTechIntegrations","serviceToFoundOnDomain","flow","service","attributes","foundOnDomain","attr","v","s","adTechDataSilos"]}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{Ee as N,b}from"./chunk-
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/consent-manager/createConsentToken.ts","../src/lib/consent-manager/types.ts","../src/lib/consent-manager/uploadConsents.ts"],"sourcesContent":["import * as crypto from 'crypto';\nimport * as jwt from 'jsonwebtoken';\n\n/**\n * Function to create a consent manager token\n *\n * @see https://docs.transcend.io/docs/consent/reference/managed-consent-database\n * @param userId - User ID\n * @param base64EncryptionKey - Encryption key\n * @param base64SigningKey - Signing key\n * @returns Token\n */\nexport function createConsentToken(\n userId: string,\n base64EncryptionKey: string,\n base64SigningKey: string,\n): string {\n // Read on for where to find these keys\n const signingKey = Buffer.from(base64SigningKey, 'base64');\n const encryptionKey = Buffer.from(base64EncryptionKey, 'base64');\n\n // NIST's AES-KWP implementation { aes 48 } - see https://tools.ietf.org/html/rfc5649\n const encryptionAlgorithm = 'id-aes256-wrap-pad';\n // Initial Value for AES-KWP integrity check - see https://tools.ietf.org/html/rfc5649#section-3\n const iv = Buffer.from('A65959A6', 'hex');\n // Set up encryption algorithm\n const cipher = crypto.createCipheriv(encryptionAlgorithm, encryptionKey, iv);\n\n // Encrypt the userId and base64-encode the result\n const encryptedIdentifier = Buffer.concat([\n cipher.update(userId),\n cipher.final(),\n ]).toString('base64');\n\n // Create the JWT content - jwt.sign will add a 'iat' (issued at) field to the payload\n // If you wanted to add something manually, consider\n // const issued: Date = new Date();\n // const isoDate = issued.toISOString();\n const jwtPayload = {\n encryptedIdentifier,\n };\n\n // Create a JSON web token and HMAC it with SHA-384\n const consentToken = jwt.sign(jwtPayload, signingKey, {\n algorithm: 'HS384',\n });\n\n return consentToken;\n}\n","import * as t from 'io-ts';\n\nexport const ConsentPreferenceBase = t.intersection([\n t.type({\n /** User ID */\n userId: t.string,\n /** Has the consent been updated (including no-change confirmation) since default resolution */\n timestamp: t.string,\n }),\n t.partial({\n /** Was tracking consent confirmed by the user? If this is false, the consent was resolved from defaults & is not yet confirmed */\n confirmed: t.union([t.literal('true'), t.literal('false')]),\n /**\n * Has the consent been updated (including no-change confirmation) since default resolution\n */\n updated: t.union([t.literal('true'), t.literal('false')]),\n /**\n * Whether or not the UI has been shown to the end-user (undefined in older versions of airgap.js)\n */\n prompted: t.union([t.literal('true'), t.literal('false')]),\n /** Consent metadata */\n metadata: t.string,\n /** US Privacy (USP) String */\n usp: t.union([t.string, t.null]),\n /** IAB GPP String */\n gpp: t.union([t.string, t.null]),\n }),\n]);\n\n/** Type override */\nexport type ConsentPreferenceBase = t.TypeOf<typeof ConsentPreferenceUpload>;\n\nexport const ConsentPreferenceUpload = t.intersection([\n ConsentPreferenceBase,\n t.partial({\n /**\n * Purpose map\n * This is a stringified JSON object with keys as purpose names and values as booleans or 'Auto'\n */\n purposes: t.string,\n }),\n]);\n\n/** Type override */\nexport type ConsentPreferenceUpload = t.TypeOf<typeof ConsentPreferenceUpload>;\n\nexport const ConsentPreferenceFetch = t.intersection([\n ConsentPreferenceBase,\n t.type({\n /** This is the partition key used for the dynamo entry */\n partition: t.string,\n }),\n t.partial({\n /** IAB TCF String */\n tcf: t.union([t.string, t.null]),\n /**\n * Purpose map\n * This is a JSON object with keys as purpose names and values as booleans or 'Auto'\n */\n purposes: t.record(t.string, t.union([t.boolean, t.string])),\n }),\n]);\n\n/** Type override */\nexport type ConsentPreferenceFetch = t.TypeOf<typeof ConsentPreferenceFetch>;\n","import { createTranscendConsentGotInstance } from '../graphql';\nimport colors from 'colors';\nimport * as t from 'io-ts';\nimport { DEFAULT_TRANSCEND_CONSENT_API } from '../../constants';\nimport { map } from '@/lib/bluebird-replace';\nimport { createConsentToken } from './createConsentToken';\nimport { logger } from '../../logger';\nimport cliProgress from 'cli-progress';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport type { ConsentPreferenceUpload } from './types';\nimport { ConsentPreferencesBody } from '@transcend-io/airgap.js-types';\n\nexport const USP_STRING_REGEX = /^[0-9][Y|N]([Y|N])[Y|N]$/;\n\nexport const PurposeMap = t.record(\n t.string,\n t.union([t.boolean, t.literal('Auto')]),\n);\n\n/**\n * Upload a set of consent preferences\n *\n * @param options - Options\n */\nexport async function uploadConsents({\n base64EncryptionKey,\n base64SigningKey,\n preferences,\n partition,\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_CONSENT_API,\n}: {\n /** base64 encryption key */\n base64EncryptionKey: string;\n /** base64 signing key */\n base64SigningKey: string;\n /** Partition key */\n partition: string;\n /** Sombra API key authentication */\n preferences: ConsentPreferenceUpload[];\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** Concurrency limit for approving */\n concurrency?: number;\n}): Promise<void> {\n // Create connection to API\n const transcendConsentApi = createTranscendConsentGotInstance(transcendUrl);\n\n // Ensure usp strings are valid\n const invalidUspStrings = preferences.filter(\n (pref) => pref.usp && !USP_STRING_REGEX.test(pref.usp),\n );\n if (invalidUspStrings.length > 0) {\n throw new Error(\n `Received invalid usp strings: ${JSON.stringify(\n invalidUspStrings,\n null,\n 2,\n )}`,\n );\n }\n\n // Ensure purpose maps are valid\n const invalidPurposeMaps = preferences\n .map((pref, ind) => [pref, ind] as [ConsentPreferenceUpload, number])\n .filter(([pref]) => {\n if (!pref.purposes) {\n return false;\n }\n try {\n decodeCodec(PurposeMap, pref.purposes);\n return false;\n } catch {\n return true;\n }\n });\n if (invalidPurposeMaps.length > 0) {\n throw new Error(\n `Received invalid purpose maps: ${JSON.stringify(\n invalidPurposeMaps,\n null,\n 2,\n )}`,\n );\n }\n\n // Ensure usp or preferences are provided\n const invalidInputs = preferences.filter(\n (pref) => !pref.usp && !pref.purposes,\n );\n if (invalidInputs.length > 0) {\n throw new Error(\n `Received invalid inputs, expected either purposes or usp to be defined: ${JSON.stringify(\n invalidInputs,\n null,\n 2,\n )}`,\n );\n }\n\n logger.info(\n colors.magenta(\n `Uploading ${preferences.length} user preferences to partition ${partition}`,\n ),\n );\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n // Build a GraphQL client\n let total = 0;\n progressBar.start(preferences.length, 0);\n await map(\n preferences,\n async ({\n userId,\n confirmed = 'true',\n updated,\n prompted,\n purposes,\n ...consent\n }) => {\n const token = createConsentToken(\n userId,\n base64EncryptionKey,\n base64SigningKey,\n );\n\n // parse usp string\n const [, saleStatus] = consent.usp\n ? USP_STRING_REGEX.exec(consent.usp) || []\n : [];\n\n const input = {\n token,\n partition,\n consent: {\n confirmed: confirmed === 'true',\n purposes: purposes\n ? decodeCodec(PurposeMap, purposes)\n : consent.usp\n ? { SaleOfInfo: saleStatus === 'Y' }\n : {},\n ...(updated ? { updated: updated === 'true' } : {}),\n ...(prompted ? { prompted: prompted === 'true' } : {}),\n ...consent,\n },\n } as ConsentPreferencesBody;\n\n // Make the request\n try {\n await transcendConsentApi\n .post('sync', {\n json: input,\n })\n .json();\n } catch (err) {\n try {\n const parsed = JSON.parse(err?.response?.body || '{}');\n if (parsed.error) {\n logger.error(colors.red(`Error: ${parsed.error}`));\n }\n } catch (e) {\n // continue\n }\n throw new Error(\n `Received an error from server: ${\n err?.response?.body || err?.message\n }`,\n );\n }\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully uploaded ${\n preferences.length\n } user preferences to partition ${partition} in \"${\n totalTime / 1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Y,OAAQ,CAAC,EACvC,MAAMiB,EACJjB,EACA,MAAO,CACL,OAAAkB,EACA,UAAAC,EAAY,OACZ,QAAAC,EACA,SAAAC,EACA,SAAAC,EACA,GAAGC,CACL,IAAM,CACJ,IAAMC,EAAQC,EACZP,EACApB,EACAC,CACF,EAGM,CAAC,CAAE2B,CAAU,EAAIH,EAAQ,IAC3B5B,EAAiB,KAAK4B,EAAQ,GAAG,GAAK,CAAC,EACvC,CAAC,EAECI,EAAQ,CACZ,MAAAH,EACA,UAAAvB,EACA,QAAS,CACP,UAAWkB,IAAc,OACzB,SAAUG,EACN5B,EAAYE,EAAY0B,CAAQ,EAChCC,EAAQ,IACR,CAAE,WAAYG,IAAe,GAAI,EACjC,CAAC,EACL,GAAIN,EAAU,CAAE,QAASA,IAAY,MAAO,EAAI,CAAC,EACjD,GAAIC,EAAW,CAAE,SAAUA,IAAa,MAAO,EAAI,CAAC,EACpD,GAAGE,CACL,CACF,EAGA,GAAI,CACF,MAAMlB,EACH,KAAK,OAAQ,CACZ,KAAMsB,CACR,CAAC,EACA,KAAK,CACV,OAASC,EAAK,CACZ,GAAI,CACF,IAAMC,EAAS,KAAK,MAAMD,GAAK,UAAU,MAAQ,IAAI,EACjDC,EAAO,OACTjB,EAAO,MAAMC,EAAO,IAAI,UAAUgB,EAAO,KAAK,EAAE,CAAC,CAErD,MAAY,CAEZ,CACA,MAAM,IAAI,MACR,kCACED,GAAK,UAAU,MAAQA,GAAK,OAC9B,EACF,CACF,CAEAZ,GAAS,EACTD,EAAY,OAAOC,CAAK,CAC1B,EACA,CAAE,YAAAd,CAAY,CAChB,EAEAa,EAAY,KAAK,EAEjB,IAAMe,EADK,IAAI,KAAK,EAAE,QAAQ,EACPhB,EAEvBF,EAAO,KACLC,EAAO,MACL,yBACEb,EAAY,MACd,kCAAkCC,CAAS,QACzC6B,EAAY,GACd,YACF,CACF,CACF","names":["crypto","jwt","createConsentToken","userId","base64EncryptionKey","base64SigningKey","signingKey","encryptionKey","encryptionAlgorithm","iv","cipher","jwtPayload","t","ConsentPreferenceBase","ConsentPreferenceUpload","ConsentPreferenceFetch","colors","t","cliProgress","decodeCodec","USP_STRING_REGEX","PurposeMap","uploadConsents","base64EncryptionKey","base64SigningKey","preferences","partition","concurrency","transcendUrl","DEFAULT_TRANSCEND_CONSENT_API","transcendConsentApi","createTranscendConsentGotInstance","invalidUspStrings","pref","invalidPurposeMaps","ind","invalidInputs","logger","colors","t0","progressBar","total","map","userId","confirmed","updated","prompted","purposes","consent","token","createConsentToken","saleStatus","input","err","parsed","totalTime"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as o,f as i}from"./chunk-
|
|
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.
|
|
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,3 +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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/inventory/pull/command.ts","../src/cli/common-parameters.ts","../src/cli/parsers.ts"],"sourcesContent":["import { buildCommand, numberParser } from '@stricli/core';\nimport { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport {\n createAuthParameter,\n createTranscendUrlParameter,\n} from '@/cli/common-parameters';\nimport { TranscendPullResource } from '@/enums';\n\nexport const DEFAULT_TRANSCEND_PULL_RESOURCES = [\n TranscendPullResource.DataSilos,\n TranscendPullResource.Enrichers,\n TranscendPullResource.Templates,\n TranscendPullResource.ApiKeys,\n];\n\nexport const DEFAULT_CONSENT_TRACKER_STATUSES =\n Object.values(ConsentTrackerStatus);\n\nexport const pullCommand = buildCommand({\n loader: async () => {\n const { pull } = await import('./impl');\n return pull;\n },\n parameters: {\n flags: {\n auth: createAuthParameter({\n scopes: 'Varies',\n }),\n resources: {\n kind: 'enum',\n values: ['all', ...Object.values(TranscendPullResource)],\n brief: `The different resource types to pull in. Defaults to ${DEFAULT_TRANSCEND_PULL_RESOURCES.join(\n ',',\n )}.`,\n variadic: ',',\n optional: true,\n },\n file: {\n kind: 'parsed',\n parse: String,\n brief: 'Path to the YAML file to pull into',\n default: './transcend.yml',\n },\n transcendUrl: createTranscendUrlParameter(),\n dataSiloIds: {\n kind: 'parsed',\n parse: String,\n variadic: ',',\n brief:\n 'The UUIDs of the data silos that should be pulled into the YAML file',\n optional: true,\n },\n integrationNames: {\n kind: 'parsed',\n parse: String,\n variadic: ',',\n brief: 'The types of integrations to pull down',\n optional: true,\n },\n trackerStatuses: {\n kind: 'enum',\n values: Object.values(ConsentTrackerStatus),\n variadic: ',',\n brief:\n 'The statuses of consent manager trackers to pull down. Defaults to all statuses.',\n optional: true,\n },\n pageSize: {\n kind: 'parsed',\n parse: numberParser,\n brief: 'The page size to use when paginating over the API',\n default: '50',\n },\n skipDatapoints: {\n kind: 'boolean',\n brief:\n 'When true, skip pulling in datapoints alongside data silo resource',\n default: false,\n },\n skipSubDatapoints: {\n kind: 'boolean',\n brief:\n 'When true, skip pulling in subDatapoints alongside data silo resource',\n default: false,\n },\n includeGuessedCategories: {\n kind: 'boolean',\n brief:\n 'When true, included guessed data categories that came from the content classifier',\n default: false,\n },\n debug: {\n kind: 'boolean',\n brief:\n 'Set to true to include debug logs while pulling the configuration',\n default: false,\n },\n },\n },\n docs: {\n brief: 'Pull metadata from Transcend into transcend.yml',\n fullDescription: `Generates a transcend.yml by pulling the configuration from your Transcend instance.\n\nThe API key needs various scopes depending on the resources being pulled (see the CLI's README for more details).\n\nThis command can be helpful if you are looking to:\n\n- Copy your data into another instance\n- Generate a transcend.yml file as a starting point to maintain parts of your data inventory in code.`,\n },\n});\n","import { ScopeName, TRANSCEND_SCOPES } from '@transcend-io/privacy-types';\nimport { urlParser } from './parsers';\nimport {\n DEFAULT_TRANSCEND_API,\n DEFAULT_TRANSCEND_CONSENT_API,\n} from '@/constants';\n\n/**\n * Common parameter builders for CLI commands\n * These reduce duplication and ensure consistency across commands\n */\n\n/**\n * Creates a standard authentication parameter\n *\n * @param root0 - The scopes and whether it requires a silo scope\n * @returns The parameter object\n */\nexport const createAuthParameter = ({\n scopes,\n requiresSiloScope = false,\n}: {\n /** The scopes required for the command */\n scopes: ScopeName[] | 'Varies';\n /** Whether the command requires a silo scope */\n requiresSiloScope?: boolean;\n}) => {\n const parameter = {\n kind: 'parsed' as const,\n parse: String,\n brief: 'The Transcend API key.',\n };\n\n if (requiresSiloScope) {\n parameter.brief +=\n ' This key must be associated with the data silo(s) being operated on.';\n }\n\n if (scopes === 'Varies') {\n return {\n ...parameter,\n brief: `${\n parameter.brief\n } The scopes required will vary depending on the operation performed. If in doubt, the ${\n TRANSCEND_SCOPES[ScopeName.FullAdmin].title\n } scope will always work.`,\n };\n }\n\n if (scopes.length === 0) {\n return {\n ...parameter,\n brief: `${parameter.brief} No scopes are required for this command.`,\n };\n }\n\n return {\n ...parameter,\n brief: `${parameter.brief} Requires scopes: ${scopes\n .map((s) => `\"${TRANSCEND_SCOPES[s].title}\"`)\n .join(', ')}`,\n };\n};\n\n/**\n * Creates a standard Transcend URL parameter\n *\n * @param defaultUrl - The default URL to use if not provided\n * @returns The parameter object\n */\nexport const createTranscendUrlParameter = (\n defaultUrl = DEFAULT_TRANSCEND_API,\n) => ({\n kind: 'parsed' as const,\n parse: urlParser,\n brief:\n 'URL of the Transcend backend. Use https://api.us.transcend.io for US hosting',\n default: defaultUrl,\n});\n\n/**\n * Creates a standard Consent URL parameter\n *\n * @param defaultUrl - The default URL to use if not provided\n * @returns The parameter object\n */\nexport const createConsentUrlParameter = (\n defaultUrl = DEFAULT_TRANSCEND_CONSENT_API,\n) => ({\n kind: 'parsed' as const,\n parse: urlParser,\n brief:\n 'URL of the Transcend consent backend. Use https://consent.us.transcend.io for US hosting',\n default: defaultUrl,\n});\n\n/**\n * Creates a standard Sombra authentication parameter\n *\n * @returns The parameter object\n */\nexport const createSombraAuthParameter = () => ({\n kind: 'parsed' as const,\n parse: String,\n brief:\n 'The Sombra internal key, use for additional authentication when self-hosting Sombra',\n optional: true as const,\n});\n","/**\n * Validates and returns a UUID string.\n *\n * @param input - The input string to validate as UUID\n * @returns The validated UUID string\n * @throws Error if input is not a valid UUID\n */\nexport function uuidParser(input: string): string {\n const uuidRegex =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\n if (!uuidRegex.test(input)) {\n throw new Error(`Invalid UUID format: ${input}`);\n }\n return input;\n}\n\n/**\n * Validates and returns a URL string.\n *\n * @param input - The input string to validate as URL\n * @returns The validated URL string\n * @throws Error if input is not a valid URL\n */\nexport function urlParser(input: string): string {\n try {\n const url = new URL(input);\n return url.toString().replace(/\\/$/, '');\n } catch {\n throw new Error(`Invalid URL format: ${input}`);\n }\n}\n\n/**\n * Parse a comma-separated string to array.\n * NOTE: Prefer using `variadic` for list arguments instead of this function. This should only be used for arguments which have a default value.\n *\n * @param input - The comma-separated string to parse\n * @returns Array of trimmed, non-empty strings\n */\nexport function arrayParser(input: string): string[] {\n return input\n .split(',')\n .map((s) => s.trim())\n .filter((s) => s.length > 0);\n}\n\n/**\n * Parse a date string to a Date object.\n *\n * @param input - The date string to parse\n * @returns The parsed Date object\n * @throws TypeError if input is not a valid date\n */\nexport function dateParser(input: string): Date {\n const date = new Date(input);\n if (Number.isNaN(date.getTime())) {\n throw new TypeError(\n `Invalid date: ${input}. Try using the ISO 8601 format (YYYY-MM-DDTHH:MM:SS.SSSZ)`,\n );\n }\n return date;\n}\n"],"mappings":"uFAAA,OAAS,gBAAAA,EAAc,gBAAAC,MAAoB,gBAC3C,OAAS,wBAAAC,MAA4B,8BCDrC,OAAS,aAAAC,EAAW,oBAAAC,MAAwB,8BCOrC,SAASC,EAAWC,EAAuB,CAGhD,GAAI,CADF,6EACa,KAAKA,CAAK,EACvB,MAAM,IAAI,MAAM,wBAAwBA,CAAK,EAAE,EAEjD,OAAOA,CACT,CASO,SAASC,EAAUD,EAAuB,CAC/C,GAAI,CAEF,OADY,IAAI,IAAIA,CAAK,EACd,SAAS,EAAE,QAAQ,MAAO,EAAE,CACzC,MAAQ,CACN,MAAM,IAAI,MAAM,uBAAuBA,CAAK,EAAE,CAChD,CACF,CASO,SAASE,EAAYF,EAAyB,CACnD,OAAOA,EACJ,MAAM,GAAG,EACT,IAAKG,GAAMA,EAAE,KAAK,CAAC,EACnB,OAAQA,GAAMA,EAAE,OAAS,CAAC,CAC/B,CASO,SAASC,EAAWJ,EAAqB,CAC9C,IAAMK,EAAO,IAAI,KAAKL,CAAK,EAC3B,GAAI,OAAO,MAAMK,EAAK,QAAQ,CAAC,EAC7B,MAAM,IAAI,UACR,iBAAiBL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aAAcQ,EAA4B,EAC1C,YAAa,CACX,KAAM,SACN,MAAO,OACP,SAAU,IACV,MACE,uEACF,SAAU,EACZ,EACA,iBAAkB,CAChB,KAAM,SACN,MAAO,OACP,SAAU,IACV,MAAO,yCACP,SAAU,EACZ,EACA,gBAAiB,CACf,KAAM,OACN,OAAQ,OAAO,OAAON,CAAoB,EAC1C,SAAU,IACV,MACE,mFACF,SAAU,EACZ,EACA,SAAU,CACR,KAAM,SACN,MAAOO,EACP,MAAO,oDACP,QAAS,IACX,EACA,eAAgB,CACd,KAAM,UACN,MACE,qEACF,QAAS,EACX,EACA,kBAAmB,CACjB,KAAM,UACN,MACE,wEACF,QAAS,EACX,EACA,yBAA0B,CACxB,KAAM,UACN,MACE,oFACF,QAAS,EACX,EACA,MAAO,CACL,KAAM,UACN,MACE,oEACF,QAAS,EACX,CACF,CACF,EACA,KAAM,CACJ,MAAO,kDACP,gBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sGAQnB,CACF,CAAC","names":["buildCommand","numberParser","ConsentTrackerStatus","ScopeName","TRANSCEND_SCOPES","uuidParser","input","urlParser","arrayParser","s","dateParser","date","createAuthParameter","scopes","requiresSiloScope","parameter","TRANSCEND_SCOPES","ScopeName","s","createTranscendUrlParameter","defaultUrl","DEFAULT_TRANSCEND_API","urlParser","createConsentUrlParameter","DEFAULT_TRANSCEND_CONSENT_API","createSombraAuthParameter","DEFAULT_TRANSCEND_PULL_RESOURCES","DEFAULT_CONSENT_TRACKER_STATUSES","ConsentTrackerStatus","pullCommand","buildCommand","pull","createAuthParameter","TranscendPullResource","createTranscendUrlParameter","numberParser"]}
|
|
@@ -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-
|
|
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`
|
|
2
2
|
query TranscendCliSubDataPointCsvExport(
|
|
3
3
|
$filterBy: SubDataPointFiltersInput
|
|
4
4
|
$first: Int!
|
|
@@ -72,3 +72,4 @@ import{_b as S,a as w,f as $,i as B,j as T,l as R}from"./chunk-2FMBK7EQ.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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/data-inventory/pullAllDatapoints.ts","../src/lib/data-inventory/pullUnstructuredSubDataPointRecommendations.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport { keyBy, uniq, chunk, sortBy } from 'lodash-es';\nimport {\n type DataCategoryType,\n SubDataPointDataSubCategoryGuessStatus,\n} from '@transcend-io/privacy-types';\nimport cliProgress from 'cli-progress';\nimport { gql } from 'graphql-request';\nimport colors from 'colors';\nimport type { GraphQLClient } from 'graphql-request';\nimport {\n DATAPOINT_EXPORT,\n DATA_SILO_EXPORT,\n type DataSiloAttributeValue,\n SUB_DATA_POINTS_COUNT,\n makeGraphQLRequest,\n} from '../graphql';\nimport { logger } from '../../logger';\nimport type { DataCategoryInput, ProcessingPurposeInput } from '../../codecs';\nimport { mapSeries } from '@/lib/bluebird-replace';\n\nexport interface DataSiloCsvPreview {\n /** ID of dataSilo */\n id: string;\n /** Name of dataSilo */\n title: string;\n}\n\nexport interface DataPointCsvPreview {\n /** ID of dataPoint */\n id: string;\n /** The path to this data point */\n path: string[];\n /** Description */\n description: {\n /** Default message */\n defaultMessage: string;\n };\n /** Name */\n name: string;\n}\n\nexport interface SubDataPointCsvPreview {\n /** ID of subDatapoint */\n id: string;\n /** Name (or key) of the subdatapoint */\n name: string;\n /** The description */\n description?: string;\n /** Personal data category */\n categories: DataCategoryInput[];\n /** Data point ID */\n dataPointId: string;\n /** The data silo ID */\n dataSiloId: string;\n /** The processing purpose for this sub datapoint */\n purposes: ProcessingPurposeInput[];\n /** Attribute attached to subdatapoint */\n attributeValues?: DataSiloAttributeValue[];\n /** Data category guesses that are output by the classifier */\n pendingCategoryGuesses?: {\n /** Data category being guessed */\n category: DataCategoryInput;\n /** Status of guess */\n status: SubDataPointDataSubCategoryGuessStatus;\n /** classifier version that produced the guess */\n classifierVersion: number;\n }[];\n}\n\nexport interface DatapointFilterOptions {\n /** IDs of data silos to filter down */\n dataSiloIds?: string[];\n /** Whether to include guessed categories, defaults to only approved categories */\n includeGuessedCategories?: boolean;\n /** Whether or not to include attributes */\n includeAttributes?: boolean;\n /** Parent categories to filter down for */\n parentCategories?: DataCategoryType[];\n /** Sub categories to filter down for */\n subCategories?: string[]; // TODO: https://transcend.height.app/T-40482 - do by name not ID\n}\n\n/**\n * Pull subdatapoint information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The subdatapoints\n */\nasync function pullSubDatapoints(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n includeGuessedCategories,\n includeAttributes,\n parentCategories = [],\n subCategories = [],\n pageSize = 1000,\n }: DatapointFilterOptions & {\n /** Page size to pull in */\n pageSize?: number;\n } = {},\n): Promise<SubDataPointCsvPreview[]> {\n const subDataPoints: SubDataPointCsvPreview[] = [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n // Filters\n const filterBy = {\n ...(parentCategories.length > 0 ? { category: parentCategories } : {}),\n ...(subCategories.length > 0 ? { subCategoryIds: subCategories } : {}),\n // if parentCategories or subCategories and not includeGuessedCategories\n ...(parentCategories.length + subCategories.length > 0 &&\n !includeGuessedCategories\n ? // then only show data points with approved data categories\n { status: SubDataPointDataSubCategoryGuessStatus.Approved }\n : {}),\n ...(dataSiloIds.length > 0 ? { dataSilos: dataSiloIds } : {}),\n };\n\n // Build a GraphQL client\n const {\n subDataPoints: { totalCount },\n } = await makeGraphQLRequest<{\n /** Query response */\n subDataPoints: {\n /** Count */\n totalCount: number;\n };\n }>(client, SUB_DATA_POINTS_COUNT, {\n filterBy,\n });\n\n logger.info(colors.magenta('[Step 1/3] Pulling in all subdatapoints'));\n\n progressBar.start(totalCount, 0);\n let total = 0;\n let shouldContinue = false;\n let cursor: string | undefined;\n let offset = 0;\n do {\n try {\n const {\n subDataPoints: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n subDataPoints: {\n /** List of matches */\n nodes: SubDataPointCsvPreview[];\n };\n }>(\n client,\n gql`\n query TranscendCliSubDataPointCsvExport(\n $filterBy: SubDataPointFiltersInput\n $first: Int!\n $offset: Int!\n ) {\n subDataPoints(\n filterBy: $filterBy\n first: $first\n offset: $offset\n useMaster: false\n ) {\n nodes {\n id\n name\n description\n dataPointId\n dataSiloId\n purposes {\n name\n purpose\n }\n categories {\n name\n category\n }\n ${\n includeGuessedCategories\n ? `pendingCategoryGuesses {\n category {\n name\n category\n }\n status\n classifierVersion\n }`\n : ''\n }\n ${\n includeAttributes\n ? `attributeValues {\n attributeKey {\n name\n }\n name\n }`\n : ''\n }\n }\n }\n }\n `,\n {\n first: pageSize,\n offset,\n filterBy: {\n ...filterBy,\n // TODO: https://transcend.height.app/T-40484 - add cursor support\n // ...(cursor ? { cursor: { id: cursor } } : {}),\n },\n },\n );\n\n cursor = nodes[nodes.length - 1]?.id as string;\n subDataPoints.push(...nodes);\n shouldContinue = nodes.length === pageSize;\n total += nodes.length;\n offset += nodes.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(\n `An error fetching subdatapoints for cursor ${cursor} and offset ${offset}`,\n ),\n );\n throw err;\n }\n } while (shouldContinue);\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n const sorted = sortBy(subDataPoints, 'name');\n\n logger.info(\n colors.green(\n `Successfully pulled in ${sorted.length} subdatapoints in ${\n totalTime / 1000\n } seconds!`,\n ),\n );\n return sorted;\n}\n\n/**\n * Pull datapoint information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The datapoints\n */\nasync function pullDatapoints(\n client: GraphQLClient,\n {\n dataPointIds = [],\n pageSize = 100,\n }: {\n /** IDs of data points to filter down */\n dataPointIds: string[];\n /** Page size to pull in */\n pageSize?: number;\n },\n): Promise<DataPointCsvPreview[]> {\n const dataPoints: DataPointCsvPreview[] = [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n logger.info(\n colors.magenta(\n `[Step 2/3] Fetching metadata for ${dataPointIds.length} datapoints`,\n ),\n );\n\n // Group by 100\n const dataPointsGrouped = chunk(dataPointIds, pageSize);\n\n progressBar.start(dataPointIds.length, 0);\n let total = 0;\n await mapSeries(dataPointsGrouped, async (dataPointIdsGroup) => {\n try {\n const {\n dataPoints: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n dataPoints: {\n /** List of matches */\n nodes: DataPointCsvPreview[];\n };\n }>(client, DATAPOINT_EXPORT, {\n first: pageSize,\n filterBy: {\n ids: dataPointIdsGroup,\n },\n });\n\n dataPoints.push(...nodes);\n total += dataPointIdsGroup.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(\n `An error fetching subdatapoints for IDs ${dataPointIdsGroup.join(\n ', ',\n )}`,\n ),\n );\n throw err;\n }\n });\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully pulled in ${dataPoints.length} dataPoints in ${\n totalTime / 1000\n } seconds!`,\n ),\n );\n return dataPoints;\n}\n\n/**\n * Pull data silo information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The data silos\n */\nasync function pullDataSilos(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n pageSize = 100,\n }: {\n /** IDs of data silos to filter down */\n dataSiloIds: string[];\n /** Page size to pull in */\n pageSize?: number;\n },\n): Promise<DataSiloCsvPreview[]> {\n const dataSilos: DataSiloCsvPreview[] = [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n logger.info(\n colors.magenta(\n `[Step 3/3] Fetching metadata for ${dataSiloIds.length} data silos`,\n ),\n );\n\n // Group by 100\n const dataSilosGrouped = chunk(dataSiloIds, pageSize);\n\n progressBar.start(dataSiloIds.length, 0);\n let total = 0;\n await mapSeries(dataSilosGrouped, async (dataSiloIdsGroup) => {\n try {\n const {\n dataSilos: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n dataSilos: {\n /** List of matches */\n nodes: DataSiloCsvPreview[];\n };\n }>(client, DATA_SILO_EXPORT, {\n first: pageSize,\n filterBy: {\n ids: dataSiloIdsGroup,\n },\n });\n\n dataSilos.push(...nodes);\n total += dataSiloIdsGroup.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(\n `An error fetching data silos for IDs ${dataSiloIdsGroup.join(', ')}`,\n ),\n );\n throw err;\n }\n });\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully pulled in ${dataSilos.length} data silos in ${\n totalTime / 1000\n } seconds!`,\n ),\n );\n return dataSilos;\n}\n\n/**\n * Pull all datapoints from the data inventory.\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The datapoints and data silos\n */\nexport async function pullAllDatapoints(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n includeGuessedCategories,\n includeAttributes,\n parentCategories = [],\n subCategories = [],\n pageSize = 1000,\n }: DatapointFilterOptions & {\n /** Page size to pull in */\n pageSize?: number;\n } = {},\n): Promise<\n (SubDataPointCsvPreview & {\n /** Data point information */\n dataPoint: DataPointCsvPreview;\n /** Data silo information */\n dataSilo: DataSiloCsvPreview;\n })[]\n> {\n // Subdatapoint information\n const subDatapoints = await pullSubDatapoints(client, {\n dataSiloIds,\n includeGuessedCategories,\n includeAttributes,\n parentCategories,\n subCategories,\n pageSize,\n });\n\n // The datapoint ids to grab\n const dataPointIds = uniq(subDatapoints.map((point) => point.dataPointId));\n const dataPoints = await pullDatapoints(client, {\n dataPointIds,\n });\n const dataPointById = keyBy(dataPoints, 'id');\n\n // The data silo IDs to grab\n const allDataSiloIds = uniq(subDatapoints.map((point) => point.dataSiloId));\n const dataSilos = await pullDataSilos(client, {\n dataSiloIds: allDataSiloIds,\n });\n const dataSiloById = keyBy(dataSilos, 'id');\n\n return subDatapoints.map((subDataPoint) => ({\n ...subDataPoint,\n dataPoint: dataPointById[subDataPoint.dataPointId],\n dataSilo: dataSiloById[subDataPoint.dataSiloId],\n }));\n}\n/* eslint-enable max-lines */\n","import type { UnstructuredSubDataPointRecommendationStatus } from '@transcend-io/privacy-types';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\nimport { gql, type GraphQLClient } from 'graphql-request';\nimport { sortBy } from 'lodash-es';\nimport type { DataCategoryInput } from '../../codecs';\nimport { ENTRY_COUNT, makeGraphQLRequest } from '../graphql';\nimport { logger } from '../../logger';\n\ninterface UnstructuredSubDataPointRecommendationCsvPreview {\n /** ID of subDatapoint */\n id: string;\n /** Entry or Named Entity recognized by the classifier */\n name: string;\n /** Context snippet including entry */\n contextSnippet: string;\n /** Scanned object ID */\n scannedObjectId: string;\n /** Scanned object path ID */\n scannedObjectPathId: string;\n /** The data silo ID */\n dataSiloId: string;\n /** Personal data category */\n dataSubCategory: DataCategoryInput;\n /** Classification Status */\n status: UnstructuredSubDataPointRecommendationStatus;\n /** Confidence */\n confidence: number;\n /** Classification method */\n classificationMethod: string;\n /** Classifier version */\n classifierVersion: string;\n}\n\ninterface EntryFilterOptions {\n /** IDs of data silos to filter down */\n dataSiloIds?: string[];\n /** Parent categories to filter down for */\n status?: UnstructuredSubDataPointRecommendationStatus[];\n /** Sub categories to filter down for */\n subCategories?: string[]; // TODO: https://transcend.height.app/T-40482 - do by name not ID\n /** Include entry and snippet */\n includeEncryptedSnippets?: boolean;\n /** Include encryptedSamplesS3Key */\n includeEncryptedSamplesS3Key?: boolean;\n}\n/**\n * Pull unstructured subdatapoint information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @param options.dataSiloIds - IDs of data silos to filter down\n * @param options.status - Parent categories to filter down for\n * @param options.subCategories - Sub categories to filter down for\n * @param options.includeEncryptedSnippets - Include entry and snippet\n * @param options.includeEncryptedSamplesS3Key - Include encryptedSamplesS3Key\n * @param options.pageSize - Page size to pull in\n * @returns A promise that resolves to an array of unstructured subdatapoint recommendations\n */\nexport async function pullUnstructuredSubDataPointRecommendations(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n status,\n subCategories = [],\n includeEncryptedSnippets,\n pageSize = 100,\n }: EntryFilterOptions & {\n /** Page size to pull in */\n pageSize?: number;\n } = {},\n): Promise<UnstructuredSubDataPointRecommendationCsvPreview[]> {\n const unstructuredSubDataPointRecommendations: UnstructuredSubDataPointRecommendationCsvPreview[] =\n [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n // Filters\n const filterBy = {\n ...(subCategories.length > 0 ? { subCategoryIds: subCategories } : {}),\n ...(status ? { status } : {}),\n ...(dataSiloIds.length > 0 ? { dataSilos: dataSiloIds } : {}),\n };\n\n // Build a GraphQL client\n const {\n unstructuredSubDataPointRecommendations: { totalCount },\n } = await makeGraphQLRequest<{\n /** Query response */\n unstructuredSubDataPointRecommendations: {\n /** Count */\n totalCount: number;\n };\n }>(client, ENTRY_COUNT, {\n filterBy,\n });\n\n logger.info(colors.magenta('[Step 1/3] Pulling in all subdatapoints'));\n\n progressBar.start(totalCount, 0);\n let total = 0;\n let shouldContinue = false;\n let cursor: string | undefined;\n let offset = 0;\n do {\n try {\n const {\n unstructuredSubDataPointRecommendations: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n unstructuredSubDataPointRecommendations: {\n /** List of matches */\n nodes: UnstructuredSubDataPointRecommendationCsvPreview[];\n };\n }>(\n client,\n gql`\n query TranscendCliUnstructuredSubDataPointRecommendationCsvExport(\n $filterBy: UnstructuredSubDataPointRecommendationsFilterInput\n $first: Int!\n $offset: Int!\n ) {\n unstructuredSubDataPointRecommendations(\n filterBy: $filterBy\n first: $first\n offset: $offset\n useMaster: false\n ) {\n nodes {\n id\n dataSiloId\n scannedObjectPathId\n scannedObjectId\n ${includeEncryptedSnippets ? 'name' : ''}\n ${includeEncryptedSnippets ? 'contextSnippet' : ''}\n dataSubCategory {\n name\n category\n }\n status\n confidence\n classificationMethod\n classifierVersion\n }\n }\n }\n `,\n {\n first: pageSize,\n offset,\n filterBy: {\n ...filterBy,\n },\n },\n );\n\n cursor = nodes[nodes.length - 1]?.id as string;\n unstructuredSubDataPointRecommendations.push(...nodes);\n shouldContinue = nodes.length === pageSize;\n total += nodes.length;\n offset += nodes.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(\n `An error fetching subdatapoints for cursor ${cursor} and offset ${offset}`,\n ),\n );\n throw err;\n }\n } while (shouldContinue);\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n const sorted = sortBy(unstructuredSubDataPointRecommendations, 'name');\n\n logger.info(\n colors.green(\n `Successfully pulled in ${sorted.length} subdatapoints in ${\n totalTime / 1000\n } seconds!`,\n ),\n );\n return sorted;\n}\n"],"mappings":"oHACA,OAAS,SAAAA,EAAO,QAAAC,EAAM,SAAAC,EAAO,UAAAC,MAAc,YAC3C,OAEE,0CAAAC,MACK,8BACP,OAAOC,MAAiB,eACxB,OAAS,OAAAC,MAAW,kBACpB,OAAOC,MAAY,SAkFnB,eAAeC,EACbC,EACA,CACE,YAAAC,EAAc,CAAC,EACf,yBAAAC,EACA,kBAAAC,EACA,iBAAAC,EAAmB,CAAC,EACpB,cAAAC,EAAgB,CAAC,EACjB,SAAAC,EAAW,GACb,EAGI,CAAC,EAC8B,CACnC,IAAMC,EAA0C,CAAC,EAG3CC,EAAK,IAAI,KAAK,EAAE,QAAQ,EAGxBC,EAAc,IAAIC,EAAY,UAClC,CAAC,EACDA,EAAY,QAAQ,cACtB,EAGMC,EAAW,CACf,GAAIP,EAAiB,OAAS,EAAI,CAAE,SAAUA,CAAiB,EAAI,CAAC,EACpE,GAAIC,EAAc,OAAS,EAAI,CAAE,eAAgBA,CAAc,EAAI,CAAC,EAEpE,GAAID,EAAiB,OAASC,EAAc,OAAS,GACrD,CAACH,EAEG,CAAE,OAAQU,EAAuC,QAAS,EAC1D,CAAC,EACL,GAAIX,EAAY,OAAS,EAAI,CAAE,UAAWA,CAAY,EAAI,CAAC,CAC7D,EAGM,CACJ,cAAe,CAAE,WAAAY,CAAW,CAC9B,EAAI,MAA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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAa1D,CACE,MAAOC,EACP,OAAAc,EACA,SAAU,CACR,GAAGT,CACL,CACF,CACF,EAEAQ,EAASE,EAAMA,EAAM,OAAS,CAAC,GAAG,GAClCd,EAAwC,KAAK,GAAGc,CAAK,EACrDH,EAAiBG,EAAM,SAAWf,EAClCW,GAASI,EAAM,OACfD,GAAUC,EAAM,OAChBZ,EAAY,OAAOQ,CAAK,CAC1B,OAASM,EAAK,CACZ,MAAAR,EAAO,MACLC,EAAO,IACL,8CAA8CG,CAAM,eAAeC,CAAM,EAC3E,CACF,EACMG,CACR,OACOL,GAETT,EAAY,KAAK,EAEjB,IAAMe,EADK,IAAI,KAAK,EAAE,QAAQ,EACPhB,EAEjBiB,EAASC,EAAOnB,EAAyC,MAAM,EAErE,OAAAQ,EAAO,KACLC,EAAO,MACL,0BAA0BS,EAAO,MAAM,qBACrCD,EAAY,GACd,WACF,CACF,EACOC,CACT","names":["keyBy","uniq","chunk","sortBy","SubDataPointDataSubCategoryGuessStatus","cliProgress","gql","colors","pullSubDatapoints","client","dataSiloIds","includeGuessedCategories","includeAttributes","parentCategories","subCategories","pageSize","subDataPoints","t0","progressBar","cliProgress","filterBy","SubDataPointDataSubCategoryGuessStatus","totalCount","makeGraphQLRequest","SUB_DATA_POINTS_COUNT","logger","colors","total","shouldContinue","cursor","offset","nodes","gql","err","totalTime","sorted","sortBy","pullDatapoints","dataPointIds","dataPoints","dataPointsGrouped","chunk","mapSeries","dataPointIdsGroup","DATAPOINT_EXPORT","pullDataSilos","dataSilos","dataSilosGrouped","dataSiloIdsGroup","DATA_SILO_EXPORT","pullAllDatapoints","subDatapoints","uniq","point","dataPointById","keyBy","allDataSiloIds","dataSiloById","subDataPoint","cliProgress","colors","gql","sortBy","pullUnstructuredSubDataPointRecommendations","client","dataSiloIds","status","subCategories","includeEncryptedSnippets","pageSize","unstructuredSubDataPointRecommendations","t0","progressBar","cliProgress","filterBy","totalCount","makeGraphQLRequest","ENTRY_COUNT","logger","colors","total","shouldContinue","cursor","offset","nodes","gql","err","totalTime","sorted","sortBy"]}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{c as _}from"./chunk-
|
|
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!
|
|
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
|