@transcend-io/cli 8.24.1 → 8.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -15
- package/dist/bin/bash-complete.cjs +1 -1
- package/dist/bin/cli.cjs +1 -1
- package/dist/bin/deprecated-command.cjs +2 -2
- package/dist/{chunk-YFF6A56N.cjs → chunk-2Q7ADV5Y.cjs} +2 -2
- package/dist/{chunk-YFF6A56N.cjs.map → chunk-2Q7ADV5Y.cjs.map} +1 -1
- package/dist/{chunk-KKAJPI6O.cjs → chunk-5PTFTN6J.cjs} +11 -11
- package/dist/{chunk-KKAJPI6O.cjs.map → chunk-5PTFTN6J.cjs.map} +1 -1
- package/dist/chunk-7ZGJ4MJF.cjs +12 -0
- package/dist/{chunk-AOO3U7W3.cjs.map → chunk-7ZGJ4MJF.cjs.map} +1 -1
- package/dist/{chunk-T5QZTOZC.cjs → chunk-BGZ6TA6C.cjs} +2 -2
- package/dist/{chunk-T5QZTOZC.cjs.map → chunk-BGZ6TA6C.cjs.map} +1 -1
- package/dist/{chunk-NA6JTKNJ.cjs → chunk-COKHIMLO.cjs} +2 -2
- package/dist/{chunk-NA6JTKNJ.cjs.map → chunk-COKHIMLO.cjs.map} +1 -1
- package/dist/chunk-F3BRFYKD.cjs +2 -0
- package/dist/chunk-F3BRFYKD.cjs.map +1 -0
- package/dist/{chunk-TRQBFWZP.cjs → chunk-GG7P2RO6.cjs} +2 -2
- package/dist/{chunk-TRQBFWZP.cjs.map → chunk-GG7P2RO6.cjs.map} +1 -1
- package/dist/{chunk-WAXPOCXW.cjs → chunk-HRNCQV6G.cjs} +4 -4
- package/dist/{chunk-WAXPOCXW.cjs.map → chunk-HRNCQV6G.cjs.map} +1 -1
- package/dist/{chunk-NNHHVBQP.cjs → chunk-KYVDLURL.cjs} +4 -4
- package/dist/{chunk-NNHHVBQP.cjs.map → chunk-KYVDLURL.cjs.map} +1 -1
- package/dist/{chunk-O3EACWMC.cjs → chunk-MOWFESXN.cjs} +2 -2
- package/dist/{chunk-O3EACWMC.cjs.map → chunk-MOWFESXN.cjs.map} +1 -1
- package/dist/{chunk-MWZABOIC.cjs → chunk-MPMKY5NF.cjs} +22 -22
- package/dist/chunk-MPMKY5NF.cjs.map +1 -0
- package/dist/{chunk-VY55L6P5.cjs → chunk-NI434OII.cjs} +2 -2
- package/dist/{chunk-VY55L6P5.cjs.map → chunk-NI434OII.cjs.map} +1 -1
- package/dist/{chunk-VTYBZZQ5.cjs → chunk-RGBVP433.cjs} +2 -2
- package/dist/{chunk-VTYBZZQ5.cjs.map → chunk-RGBVP433.cjs.map} +1 -1
- package/dist/chunk-WWJHUHSQ.cjs +12 -0
- package/dist/chunk-WWJHUHSQ.cjs.map +1 -0
- package/dist/{impl-OPBD2KMY.cjs → impl-32ZRDOCN.cjs} +5 -5
- package/dist/{impl-OPBD2KMY.cjs.map → impl-32ZRDOCN.cjs.map} +1 -1
- package/dist/{impl-3PH5TSFY.cjs → impl-3VTN6SPE.cjs} +3 -3
- package/dist/{impl-3PH5TSFY.cjs.map → impl-3VTN6SPE.cjs.map} +1 -1
- package/dist/{impl-WIGDO7DS.cjs → impl-4YI4ERPI.cjs} +2 -2
- package/dist/{impl-WIGDO7DS.cjs.map → impl-4YI4ERPI.cjs.map} +1 -1
- package/dist/{impl-6HWW3LAY.cjs → impl-5H724WN5.cjs} +2 -2
- package/dist/{impl-6HWW3LAY.cjs.map → impl-5H724WN5.cjs.map} +1 -1
- package/dist/{impl-MAHW2W43.cjs → impl-6S3K72GP.cjs} +2 -2
- package/dist/{impl-MAHW2W43.cjs.map → impl-6S3K72GP.cjs.map} +1 -1
- package/dist/{impl-SMK2SUTD.cjs → impl-7G2TDJGL.cjs} +2 -2
- package/dist/{impl-SMK2SUTD.cjs.map → impl-7G2TDJGL.cjs.map} +1 -1
- package/dist/{impl-VMV24ZJH.cjs → impl-7WCN5RAN.cjs} +2 -2
- package/dist/{impl-VMV24ZJH.cjs.map → impl-7WCN5RAN.cjs.map} +1 -1
- package/dist/{impl-VXHUL55C.cjs → impl-7ZGTTYG5.cjs} +2 -2
- package/dist/{impl-VXHUL55C.cjs.map → impl-7ZGTTYG5.cjs.map} +1 -1
- package/dist/impl-AI276JNQ.cjs +2 -0
- package/dist/impl-AI276JNQ.cjs.map +1 -0
- package/dist/{impl-FO3XHC3T.cjs → impl-AQY6F4SC.cjs} +2 -2
- package/dist/{impl-FO3XHC3T.cjs.map → impl-AQY6F4SC.cjs.map} +1 -1
- package/dist/{impl-IESXEP2S.cjs → impl-CLA7WK6U.cjs} +2 -2
- package/dist/{impl-IESXEP2S.cjs.map → impl-CLA7WK6U.cjs.map} +1 -1
- package/dist/{impl-CUNZ7YNN.cjs → impl-CP2GLGVZ.cjs} +2 -2
- package/dist/{impl-CUNZ7YNN.cjs.map → impl-CP2GLGVZ.cjs.map} +1 -1
- package/dist/impl-CRQ4DYII.cjs +2 -0
- package/dist/impl-CRQ4DYII.cjs.map +1 -0
- package/dist/{impl-OOQNMHTX.cjs → impl-EQ4EH4QJ.cjs} +2 -2
- package/dist/{impl-OOQNMHTX.cjs.map → impl-EQ4EH4QJ.cjs.map} +1 -1
- package/dist/{impl-2YVWUXEC.cjs → impl-FD5CDY7Y.cjs} +2 -2
- package/dist/{impl-2YVWUXEC.cjs.map → impl-FD5CDY7Y.cjs.map} +1 -1
- package/dist/{impl-L6F4PTY3.cjs → impl-FJ4XWHLE.cjs} +2 -2
- package/dist/{impl-L6F4PTY3.cjs.map → impl-FJ4XWHLE.cjs.map} +1 -1
- package/dist/{impl-2TS5SALN.cjs → impl-G6WAGNDN.cjs} +2 -2
- package/dist/{impl-2TS5SALN.cjs.map → impl-G6WAGNDN.cjs.map} +1 -1
- package/dist/{impl-TXQ7EFQE.cjs → impl-GIPZ5EW5.cjs} +2 -2
- package/dist/{impl-TXQ7EFQE.cjs.map → impl-GIPZ5EW5.cjs.map} +1 -1
- package/dist/{impl-7YED2CRU.cjs → impl-HCY5MWEP.cjs} +2 -2
- package/dist/{impl-7YED2CRU.cjs.map → impl-HCY5MWEP.cjs.map} +1 -1
- package/dist/{impl-WLYOQTIL.cjs → impl-HEPMD6RG.cjs} +2 -2
- package/dist/{impl-WLYOQTIL.cjs.map → impl-HEPMD6RG.cjs.map} +1 -1
- package/dist/{impl-MCE7B6NW.cjs → impl-JREQ3SEN.cjs} +2 -2
- package/dist/{impl-MCE7B6NW.cjs.map → impl-JREQ3SEN.cjs.map} +1 -1
- package/dist/{impl-IBGULX7G.cjs → impl-K5LDQF7V.cjs} +2 -2
- package/dist/{impl-IBGULX7G.cjs.map → impl-K5LDQF7V.cjs.map} +1 -1
- package/dist/{impl-WKBZDQYY.cjs → impl-KPZSEHQG.cjs} +2 -2
- package/dist/{impl-WKBZDQYY.cjs.map → impl-KPZSEHQG.cjs.map} +1 -1
- package/dist/{impl-IZTOX7X3.cjs → impl-LGUMGRRA.cjs} +2 -2
- package/dist/{impl-IZTOX7X3.cjs.map → impl-LGUMGRRA.cjs.map} +1 -1
- package/dist/{impl-YEXHKEWQ.cjs → impl-LI3SHHAQ.cjs} +2 -2
- package/dist/{impl-YEXHKEWQ.cjs.map → impl-LI3SHHAQ.cjs.map} +1 -1
- package/dist/{impl-YPKYWIYP.cjs → impl-MH7OR57S.cjs} +2 -2
- package/dist/{impl-YPKYWIYP.cjs.map → impl-MH7OR57S.cjs.map} +1 -1
- package/dist/{impl-OCLMWYMP.cjs → impl-OIXVXSLU.cjs} +2 -2
- package/dist/{impl-OCLMWYMP.cjs.map → impl-OIXVXSLU.cjs.map} +1 -1
- package/dist/{impl-2Y7WAQGJ.cjs → impl-OXOU2A27.cjs} +2 -2
- package/dist/{impl-2Y7WAQGJ.cjs.map → impl-OXOU2A27.cjs.map} +1 -1
- package/dist/impl-PZ3JDEQN.cjs +2 -0
- package/dist/{impl-R3RC2YP7.cjs.map → impl-PZ3JDEQN.cjs.map} +1 -1
- package/dist/{impl-4EEEQLZS.cjs → impl-QSTK5NYY.cjs} +3 -3
- package/dist/{impl-4EEEQLZS.cjs.map → impl-QSTK5NYY.cjs.map} +1 -1
- package/dist/{impl-AKKWJJRW.cjs → impl-QZHQCQ3B.cjs} +2 -2
- package/dist/{impl-AKKWJJRW.cjs.map → impl-QZHQCQ3B.cjs.map} +1 -1
- package/dist/{impl-RHAYM5BX.cjs → impl-SYXFCDZC.cjs} +4 -4
- package/dist/{impl-RHAYM5BX.cjs.map → impl-SYXFCDZC.cjs.map} +1 -1
- package/dist/{impl-DDDGYCKH.cjs → impl-TCN6BRVK.cjs} +2 -2
- package/dist/{impl-DDDGYCKH.cjs.map → impl-TCN6BRVK.cjs.map} +1 -1
- package/dist/{impl-FGLNPBNN.cjs → impl-TFAARXUG.cjs} +2 -2
- package/dist/{impl-FGLNPBNN.cjs.map → impl-TFAARXUG.cjs.map} +1 -1
- package/dist/{impl-ZVMYU6PT.cjs → impl-VAQF5Y6W.cjs} +2 -2
- package/dist/{impl-ZVMYU6PT.cjs.map → impl-VAQF5Y6W.cjs.map} +1 -1
- package/dist/{impl-6OZ2ZIVM.cjs → impl-VGJPIZZY.cjs} +2 -2
- package/dist/{impl-6OZ2ZIVM.cjs.map → impl-VGJPIZZY.cjs.map} +1 -1
- package/dist/impl-VGOV6N6A.cjs +2 -0
- package/dist/impl-VGOV6N6A.cjs.map +1 -0
- package/dist/{impl-DJCQNX56.cjs → impl-X6Z7MKVJ.cjs} +2 -2
- package/dist/{impl-DJCQNX56.cjs.map → impl-X6Z7MKVJ.cjs.map} +1 -1
- package/dist/{impl-YHIIZRG6.cjs → impl-YIYW7STX.cjs} +2 -2
- package/dist/{impl-YHIIZRG6.cjs.map → impl-YIYW7STX.cjs.map} +1 -1
- package/dist/{impl-4RXGRXXS.cjs → impl-ZGACCLWF.cjs} +2 -2
- package/dist/{impl-4RXGRXXS.cjs.map → impl-ZGACCLWF.cjs.map} +1 -1
- package/dist/{impl-JIVQZGAO.cjs → impl-ZV4VREIU.cjs} +2 -2
- package/dist/{impl-JIVQZGAO.cjs.map → impl-ZV4VREIU.cjs.map} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +43 -89
- package/package.json +1 -1
- package/dist/chunk-AOO3U7W3.cjs +0 -12
- package/dist/chunk-MWZABOIC.cjs.map +0 -1
- package/dist/chunk-ZUT7UIQU.cjs +0 -2
- package/dist/chunk-ZUT7UIQU.cjs.map +0 -1
- package/dist/impl-KUZ5CZKZ.cjs +0 -2
- package/dist/impl-KUZ5CZKZ.cjs.map +0 -1
- package/dist/impl-R3RC2YP7.cjs +0 -2
- package/dist/impl-TJIMDEBN.cjs +0 -12
- package/dist/impl-TJIMDEBN.cjs.map +0 -1
- package/dist/impl-VKEICKZ7.cjs +0 -2
- package/dist/impl-VKEICKZ7.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -1800,27 +1800,29 @@ transcend consent pull-consent-metrics --auth="$TRANSCEND_API_KEY" --start=2024-
|
|
|
1800
1800
|
|
|
1801
1801
|
```txt
|
|
1802
1802
|
USAGE
|
|
1803
|
-
transcend consent pull-consent-preferences (--auth value) (--partition value) [--sombraAuth value] [--file value] [--transcendUrl value] [--timestampBefore value] [--timestampAfter value] [--identifiers value]... [--concurrency value]
|
|
1803
|
+
transcend consent pull-consent-preferences (--auth value) (--partition value) [--sombraAuth value] [--file value] [--transcendUrl value] [--timestampBefore value] [--timestampAfter value] [--updatedBefore value] [--updatedAfter value] [--identifiers value]... [--concurrency value]
|
|
1804
1804
|
transcend consent pull-consent-preferences --help
|
|
1805
1805
|
|
|
1806
|
-
|
|
1806
|
+
Uses POST /v1/preferences/{partition}/query with cursor-based pagination. Supports filtering by identifiers, collection timestamps, and system.updatedAt.
|
|
1807
1807
|
|
|
1808
1808
|
FLAGS
|
|
1809
1809
|
--auth The Transcend API key. Requires scopes: "View Managed Consent Database Admin API"
|
|
1810
|
-
--partition
|
|
1810
|
+
--partition Partition ID to query in the Preference Store
|
|
1811
1811
|
[--sombraAuth] The Sombra internal key, use for additional authentication when self-hosting Sombra
|
|
1812
|
-
[--file] Path to
|
|
1813
|
-
[--transcendUrl] URL of the Transcend backend. Use https://api.us.transcend.io for US hosting
|
|
1814
|
-
[--timestampBefore] Filter
|
|
1815
|
-
[--timestampAfter] Filter
|
|
1816
|
-
[--
|
|
1817
|
-
[--
|
|
1812
|
+
[--file] Path to CSV output file [default = ./preferences.csv]
|
|
1813
|
+
[--transcendUrl] URL of the Transcend backend. Use https://api.us.transcend.io for US hosting [default = https://api.transcend.io]
|
|
1814
|
+
[--timestampBefore] Filter: preferences collected before this time (timestampBefore)
|
|
1815
|
+
[--timestampAfter] Filter: preferences collected after this time (timestampAfter)
|
|
1816
|
+
[--updatedBefore] Filter: preferences updated before this time (system.updatedAt)
|
|
1817
|
+
[--updatedAfter] Filter: preferences updated after this time (system.updatedAt)
|
|
1818
|
+
[--identifiers]... Filter specific users by identifier(s) as "name:value". If name is omitted, defaults to "email". Multiple values separated by commas. [separator = ,]
|
|
1819
|
+
[--concurrency] Page size / concurrency used when downloading (1–50 per API). Higher = fewer pages. [default = 50]
|
|
1818
1820
|
-h --help Print help information and exit
|
|
1819
1821
|
```
|
|
1820
1822
|
|
|
1821
1823
|
#### Examples
|
|
1822
1824
|
|
|
1823
|
-
**Fetch all consent preferences from partition
|
|
1825
|
+
**Fetch all consent preferences from a partition**
|
|
1824
1826
|
|
|
1825
1827
|
```sh
|
|
1826
1828
|
transcend consent pull-consent-preferences \
|
|
@@ -1828,7 +1830,7 @@ transcend consent pull-consent-preferences \
|
|
|
1828
1830
|
--partition=4d1c5daa-90b7-4d18-aa40-f86a43d2c726
|
|
1829
1831
|
```
|
|
1830
1832
|
|
|
1831
|
-
**Fetch all consent preferences
|
|
1833
|
+
**Fetch all consent preferences and save to ./consent.csv**
|
|
1832
1834
|
|
|
1833
1835
|
```sh
|
|
1834
1836
|
transcend consent pull-consent-preferences \
|
|
@@ -1837,7 +1839,7 @@ transcend consent pull-consent-preferences \
|
|
|
1837
1839
|
--file=./consent.csv
|
|
1838
1840
|
```
|
|
1839
1841
|
|
|
1840
|
-
**Filter
|
|
1842
|
+
**Filter by consent collection time (timestampBefore)**
|
|
1841
1843
|
|
|
1842
1844
|
```sh
|
|
1843
1845
|
transcend consent pull-consent-preferences \
|
|
@@ -1846,7 +1848,7 @@ transcend consent pull-consent-preferences \
|
|
|
1846
1848
|
--timestampBefore=2024-04-03T00:00:00.000Z
|
|
1847
1849
|
```
|
|
1848
1850
|
|
|
1849
|
-
**Filter
|
|
1851
|
+
**Filter by consent collection time (timestampAfter)**
|
|
1850
1852
|
|
|
1851
1853
|
```sh
|
|
1852
1854
|
transcend consent pull-consent-preferences \
|
|
@@ -1855,7 +1857,26 @@ transcend consent pull-consent-preferences \
|
|
|
1855
1857
|
--timestampAfter=2024-04-03T00:00:00.000Z
|
|
1856
1858
|
```
|
|
1857
1859
|
|
|
1858
|
-
**
|
|
1860
|
+
**Filter by last update time (system.updatedAt window)**
|
|
1861
|
+
|
|
1862
|
+
```sh
|
|
1863
|
+
transcend consent pull-consent-preferences \
|
|
1864
|
+
--auth="$TRANSCEND_API_KEY" \
|
|
1865
|
+
--partition=4d1c5daa-90b7-4d18-aa40-f86a43d2c726 \
|
|
1866
|
+
--updatedAfter=2024-08-26T00:00:00.000Z \
|
|
1867
|
+
--updatedBefore=2024-08-27T00:00:00.000Z
|
|
1868
|
+
```
|
|
1869
|
+
|
|
1870
|
+
**Filter specific users by identifiers (name:value). Default name=email if omitted.**
|
|
1871
|
+
|
|
1872
|
+
```sh
|
|
1873
|
+
transcend consent pull-consent-preferences \
|
|
1874
|
+
--auth="$TRANSCEND_API_KEY" \
|
|
1875
|
+
--partition=4d1c5daa-90b7-4d18-aa40-f86a43d2c726 \
|
|
1876
|
+
--identifiers=email:no-track@example.com,phone:+11234567890,pls-no-track@example.com
|
|
1877
|
+
```
|
|
1878
|
+
|
|
1879
|
+
**Self-hosted Sombra: include Sombra internal key header**
|
|
1859
1880
|
|
|
1860
1881
|
```sh
|
|
1861
1882
|
transcend consent pull-consent-preferences \
|
|
@@ -1864,7 +1885,7 @@ transcend consent pull-consent-preferences \
|
|
|
1864
1885
|
--partition=4d1c5daa-90b7-4d18-aa40-f86a43d2c726
|
|
1865
1886
|
```
|
|
1866
1887
|
|
|
1867
|
-
**
|
|
1888
|
+
**Use a specific backend base URL (e.g., US-hosted)**
|
|
1868
1889
|
|
|
1869
1890
|
```sh
|
|
1870
1891
|
transcend consent pull-consent-preferences \
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict"; function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkT462ONFXcjs = require('../chunk-T462ONFX.cjs');var
|
|
2
|
+
"use strict"; function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkT462ONFXcjs = require('../chunk-T462ONFX.cjs');var _chunkMPMKY5NFcjs = require('../chunk-MPMKY5NF.cjs');require('../chunk-RGBVP433.cjs');require('../chunk-NI434OII.cjs');require('../chunk-Q7I37FJV.cjs');var _core = require('@stricli/core');async function e(){let o=process.argv.slice(3);_optionalChain([process, 'access', _ => _.env, 'access', _2 => _2.COMP_LINE, 'optionalAccess', _3 => _3.endsWith, 'call', _4 => _4(" ")])&&o.push(""),await _core.proposeCompletions.call(void 0, _chunkMPMKY5NFcjs.a,o,_chunkT462ONFXcjs.a.call(void 0, process));try{for(let{completion:r}of await _core.proposeCompletions.call(void 0, _chunkMPMKY5NFcjs.a,o,_chunkT462ONFXcjs.a.call(void 0, process)))process.stdout.write(`${r}
|
|
3
3
|
`)}catch (e2){}}e();
|
|
4
4
|
//# sourceMappingURL=bash-complete.cjs.map
|
package/dist/bin/cli.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var _chunkT462ONFXcjs = require('../chunk-T462ONFX.cjs');var
|
|
2
|
+
"use strict";var _chunkT462ONFXcjs = require('../chunk-T462ONFX.cjs');var _chunkMPMKY5NFcjs = require('../chunk-MPMKY5NF.cjs');require('../chunk-RGBVP433.cjs');require('../chunk-NI434OII.cjs');require('../chunk-Q7I37FJV.cjs');var _core = require('@stricli/core');async function n(){await _core.run.call(void 0, _chunkMPMKY5NFcjs.a,process.argv.slice(2),_chunkT462ONFXcjs.a.call(void 0, process))}n();
|
|
3
3
|
//# sourceMappingURL=cli.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict"; function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var
|
|
2
|
+
"use strict"; function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkMPMKY5NFcjs = require('../chunk-MPMKY5NF.cjs');require('../chunk-RGBVP433.cjs');var _chunkZUNVPK23cjs = require('../chunk-ZUNVPK23.cjs');require('../chunk-NI434OII.cjs');require('../chunk-Q7I37FJV.cjs');var _core = require('@stricli/core');var o={"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 p(t){return _optionalChain([_core.generateHelpTextForAllCommands.call(void 0, _chunkMPMKY5NFcjs.a), 'access', _ => _.find, 'call', _2 => _2(s=>s[0]===`${_chunkMPMKY5NFcjs.a.config.name} ${t.join(" ")}`), 'optionalAccess', _3 => _3[1]])}function i(t){_chunkZUNVPK23cjs.a.log("[DEPRECATION NOTICE]");let e=o[t];if(!e){let a=Object.entries(o).map(([l,d])=>`\`${l}\` -> \`${_chunkMPMKY5NFcjs.a.config.name} ${d.join(" ")}\``).join(`
|
|
3
3
|
`);_chunkZUNVPK23cjs.a.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}_chunkZUNVPK23cjs.a.log(`\`${t}\` is deprecated as of v7.0.0.
|
|
5
|
-
Use \`${
|
|
5
|
+
Use \`${_chunkMPMKY5NFcjs.a.config.name} ${e.join(" ")}\` instead.
|
|
6
6
|
`);let s=p(e);if(!s)throw new Error(`Failed to get help text for command: \`${e.join(" ")}\``);_chunkZUNVPK23cjs.a.log(s)}function m(){let e=_optionalChain([process, 'access', _4 => _4.argv, 'access', _5 => _5.at, 'call', _6 => _6(-1), 'optionalAccess', _7 => _7.split, 'call', _8 => _8("/"), 'access', _9 => _9.pop, 'call', _10 => _10(), 'optionalAccess', _11 => _11.trim, 'call', _12 => _12()]);if(e)i(e);else throw new Error("Deprecated command");process.exit(1)}m();
|
|
7
7
|
//# sourceMappingURL=deprecated-command.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkMOWFESXNcjs = require('./chunk-MOWFESXN.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _fs = require('fs');var _typeutils = require('@transcend-io/type-utils');var _privacytypes = require('@transcend-io/privacy-types');var K=/target ('|")(.*?)('|")/,L=/pod ('|")(.*?)('|")(, ('|")~> (.+?)('|")|)/,y={supportedFiles:["Podfile"],ignoreDirs:["Pods"],scanFunction:t=>{let e=_fs.readFileSync.call(void 0, t,"utf-8"),r=_typeutils.findAllWithRegex.call(void 0, {value:new RegExp(K,"g"),matches:["quote1","name","quote2"]},e),m=_typeutils.findAllWithRegex.call(void 0, {value:new RegExp(L,"g"),matches:["quote1","name","quote2","extra","quote3","version","quote4"]},e);return r.map((s,a)=>({name:s.name,type:_privacytypes.CodePackageType.CocoaPods,softwareDevelopmentKits:m.filter(i=>i.matchIndex>s.matchIndex&&(!r[a+1]||i.matchIndex<r[a+1].matchIndex)).map(i=>({name:i.name,version:i.version}))}))}};var _path = require('path');var X=/implementation( *)('|")(.+?):(.+?):(.+?|)('|")/,j=/apply plugin: *('|")(.+?)(:(.+?)|)('|")/,J=/implementation group:( *)('|")(.+?)('|"),( *)name:( *)('|")(.+?)('|"),( *)version:( *)('|")(.+?)('|")/,U=/applicationId( *)"(.+?)"/,_={supportedFiles:["build.gradle**"],ignoreDirs:["gradle-app.setting","gradle-wrapper.jar","gradle-wrapper.properties"],scanFunction:t=>{let e=_fs.readFileSync.call(void 0, t,"utf-8"),r=_path.dirname.call(void 0, t),m=_typeutils.findAllWithRegex.call(void 0, {value:new RegExp(X,"g"),matches:["space","quote1","name","path","version","quote2"]},e),c=_typeutils.findAllWithRegex.call(void 0, {value:new RegExp(j,"g"),matches:["quote1","name","group","version","quote2"]},e),s=_typeutils.findAllWithRegex.call(void 0, {value:new RegExp(J,"g"),matches:["space1","quote1","group","quote2","space2","space3","quote3","name","quote4","space4","space5","quote5","version","quote6"]},e),a=_typeutils.findAllWithRegex.call(void 0, {value:new RegExp(U,"g"),matches:["space","name"]},e);if(a.length>1)throw new Error(`Expected only one applicationId per file: ${t}`);return[{name:_optionalChain([a, 'access', _2 => _2[0], 'optionalAccess', _3 => _3.name])||r.split("/").pop(),softwareDevelopmentKits:[...m,...s,...c].map(i=>({name:i.name,version:i.version||void 0}))}]}};var I={supportedFiles:["package.json"],ignoreDirs:["node_modules","serverless-build","lambda-build"],scanFunction:t=>{let e=_fs.readFileSync.call(void 0, t,"utf-8"),r=_path.dirname.call(void 0, t),m=JSON.parse(e),{name:c,description:s,dependencies:a={},devDependencies:i={},optionalDependencies:n={}}=m;return[{name:c||r.split("/").pop(),description:s,softwareDevelopmentKits:[...Object.entries(a).map(([o,p])=>({name:o,version:typeof p=="string"?p:void 0})),...Object.entries(i).map(([o,p])=>({name:o,version:typeof p=="string"?p:void 0,isDevDependency:!0})),...Object.entries(n).map(([o,p])=>({name:o,version:typeof p=="string"?p:void 0}))]}]}};var z=/(.+?)(=+)(.+)/,Z=/name *= *('|")(.+?)('|")/,ee=/description *= *('|")(.+?)('|")/,x={supportedFiles:["requirements.txt"],ignoreDirs:["build","lib","lib64"],scanFunction:t=>{let e=_fs.readFileSync.call(void 0, t,"utf-8"),r=_path.dirname.call(void 0, t),c=_chunkMOWFESXNcjs.c.call(void 0, r).find(o=>o==="setup.py"),s=c?_fs.readFileSync.call(void 0, _path.join.call(void 0, r,c),"utf-8"):void 0,a=s?(Z.exec(s)||[])[2]:void 0,i=s?(ee.exec(s)||[])[2]:void 0,n=_typeutils.findAllWithRegex.call(void 0, {value:new RegExp(z,"g"),matches:["name","equals","version"]},e);return[{name:a||r.split("/").pop(),description:i||void 0,type:_privacytypes.CodePackageType.RequirementsTxt,softwareDevelopmentKits:n.map(o=>({name:o.name,version:o.version}))}]}};var re=/gem *('|")(.+?)('|")(, *('|")(.+?)('|")|)/,se=/spec\.name *= *('|")(.+?)('|")/,ie=/spec\.description *= *('|")(.+?)('|")/,pe=/spec\.summary *= *('|")(.+?)('|")/,D={supportedFiles:["Gemfile"],ignoreDirs:["bin"],scanFunction:t=>{let e=_fs.readFileSync.call(void 0, t,"utf-8"),r=_path.dirname.call(void 0, t),c=_chunkMOWFESXNcjs.c.call(void 0, r).find(o=>o===".gemspec"),s=c?_fs.readFileSync.call(void 0, c,"utf-8"):void 0,a=s?(se.exec(s)||[])[2]:void 0,i=s?(ie.exec(s)||pe.exec(s)||[])[1]:void 0,n=_typeutils.findAllWithRegex.call(void 0, {value:new RegExp(re,"g"),matches:["quote1","name","quote2","hasVersion","quote3","version","quote4"]},e);return[{name:a||r.split("/").pop(),description:i||void 0,type:_privacytypes.CodePackageType.RequirementsTxt,softwareDevelopmentKits:n.map(o=>({name:o.name,version:o.version}))}]}};var _jsyaml = require('js-yaml'); var _jsyaml2 = _interopRequireDefault(_jsyaml);function ge(t){return t.split(`
|
|
2
2
|
`).map(e=>{let r=e.indexOf("#");return r>-1&&!e.substring(0,r).includes('"')&&!e.substring(0,r).includes("'")?e.substring(0,r).trim():e}).filter(e=>e.length>0).join(`
|
|
3
3
|
`)}var P={supportedFiles:["pubspec.yml"],ignoreDirs:["build"],scanFunction:t=>{let e=_path.dirname.call(void 0, t),r=_fs.readFileSync.call(void 0, t,"utf-8"),{name:m,description:c,dev_dependencies:s={},dependencies:a={}}=_jsyaml2.default.load(ge(r));return[{name:m||e.split("/").pop(),description:c,type:_privacytypes.CodePackageType.RequirementsTxt,softwareDevelopmentKits:[...Object.entries(a).map(([i,n])=>({name:i,version:typeof n=="string"?n:typeof n=="number"?n.toString():_optionalChain([n, 'optionalAccess', _4 => _4.sdk])})),...Object.entries(s).map(([i,n])=>({name:i,version:typeof n=="string"?n:typeof n=="number"?n.toString():_optionalChain([n, 'optionalAccess', _5 => _5.sdk]),isDevDependency:!0}))]}]}};var F={supportedFiles:["composer.json"],ignoreDirs:["vendor","node_modules","cache","build","dist"],scanFunction:t=>{let e=_fs.readFileSync.call(void 0, t,"utf-8"),r=_path.dirname.call(void 0, t),m=JSON.parse(e),{name:c,description:s,require:a={},"require-dev":i={}}=m;return[{name:c||r.split("/").pop(),description:s,softwareDevelopmentKits:[...Object.entries(a).map(([n,o])=>({name:n,version:typeof o=="string"?o:void 0})),...Object.entries(i).map(([n,o])=>({name:n,version:typeof o=="string"?o:void 0,isDevDependency:!0}))]}]}};var _iots = require('io-ts'); var d = _interopRequireWildcard(_iots);var ye=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}),A={supportedFiles:["Package.resolved"],ignoreDirs:[],scanFunction:t=>{let e=_fs.readFileSync.call(void 0, t,"utf-8"),r=_typeutils.decodeCodec.call(void 0, ye,e);return[{name:_path.dirname.call(void 0, t).split("/").pop()||"",type:_privacytypes.CodePackageType.CocoaPods,softwareDevelopmentKits:r.pins.map(m=>({name:m.identity,version:m.state.version}))}]}};var R="(implementation|api|kapt|ksp|debugImplementation|releaseImplementation|androidTestImplementation|testImplementation|compileOnly|runtimeOnly)",xe=new RegExp(`${R}\\s*\\(\\s*["']([^"':\\s]+):([^"':\\s]+):?([^"']*)["']\\s*\\)`,"g"),De=new RegExp(`${R}\\s*\\(\\s*platform\\(\\s*["']([^"':\\s]+):([^"':\\s]+):?([^"']*)["']\\s*\\)\\s*\\)`,"g"),Pe=new RegExp(`${R}\\s*\\(\\s*libs(?:\\.[\\w\\-\\.]+|\\[["'][^"']+["']\\])\\s*\\)`,"g"),Ae=/id\s*\(\s*["']([^"']+)["']\s*\)(?:\s*version\s*["']([^"']+)["'])?/g,Re=/apply\s*\(\s*plugin\s*=\s*["']([^"']+)["']\s*\)/g,ke=/plugins\s*\{[^}]*alias\s*\(\s*libs(?:\.plugins)?(?:\.[\w\-.]+|\[["'][^"']+["']\])\s*\)[^}]*\}/g,ve=/applicationId\s*=\s*["']([^"']+)["']/g,Ge=/applicationId\s*\(\s*["']([^"']+)["']\s*\)/g;function u(t,e){let r=e&&e.trim().length>0&&e!=="_"?e.trim():void 0;return{name:t,version:r}}var w={supportedFiles:["**/build.gradle.kts","**/*.gradle.kts"],ignoreDirs:["gradle-app.setting","gradle-wrapper.jar","gradle-wrapper.properties"],scanFunction:t=>{let e=_fs.readFileSync.call(void 0, t,"utf-8"),r=_path.dirname.call(void 0, t),m=[..._typeutils.findAllWithRegex.call(void 0, {value:ve,matches:["name"]},e),..._typeutils.findAllWithRegex.call(void 0, {value:Ge,matches:["name"]},e)];if(m.length>1)throw new Error(`Expected only one applicationId per file: ${t}`);let c=_optionalChain([m, 'access', _6 => _6[0], 'optionalAccess', _7 => _7.name])||r.split("/").pop(),s=[];for(let n of e.matchAll(xe)){let[,,o,p,f]=n;s.push(u(`${o}:${p}`,f))}for(let n of e.matchAll(De)){let[,,o,p,f]=n;s.push(u(`${o}:${p}`,f))}for(let n of e.matchAll(Pe)){let o=n[0].replace(/^[^(]+\(\s*/,"").replace(/\)\s*$/,"").trim();s.push(u(o))}let a=[];for(let n of e.matchAll(Ae)){let[,o,p]=n;a.push(u(o,p))}for(let n of e.matchAll(Re)){let[,o]=n;a.push(u(o))}if(ke.test(e)){let n=e.matchAll(/alias\s*\(\s*(libs(?:\.plugins)?(?:\.[\w\-.]+|\[["'][^"']+["']\]))\s*\)/g);for(let o of n)a.push(u(o[1]))}let i=[...s,...a].reduce((n,o)=>{let p=`${o.name}@@${o.version||""}`;return n.map.has(p)||(n.map.set(p,o),n.list.push(o)),n},{map:new Map,list:[]}).list;return[{name:c,softwareDevelopmentKits:i}]}};var hn={cocoaPods:y,gradle:_,javascriptPackageJson:I,pythonRequirementsTxt:x,gemfile:D,pubspec:P,swift:A},T={[_privacytypes.CodePackageType.CocoaPods]:y,[_privacytypes.CodePackageType.Gradle]:_,[_privacytypes.CodePackageType.PackageJson]:I,[_privacytypes.CodePackageType.RequirementsTxt]:x,[_privacytypes.CodePackageType.Gemfile]:D,[_privacytypes.CodePackageType.Pubspec]:P,[_privacytypes.CodePackageType.ComposerJson]:F,[_privacytypes.CodePackageType.Swift]:A,[_privacytypes.CodePackageType.Kotlin]:w};var _fastglob = require('fast-glob'); var _fastglob2 = _interopRequireDefault(_fastglob);var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);async function Kn({scanPath:t,ignoreDirs:e=[],repositoryName:r}){return(await Promise.all(_typeutils.getEntries.call(void 0, T).map(async([c,s])=>{let{ignoreDirs:a,supportedFiles:i,scanFunction:n}=s,o=[...e,...a].filter(p=>p.length>0);try{let p=await _fastglob2.default.call(void 0, `${t}/**/${i.join("|")}`,{ignore:o.map(l=>`${t}/**/${l}`),unique:!0,onlyFiles:!0});_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Scanning: ${p.length} files of type ${c}`));let f=p.map(l=>n(l).map(N=>({...N,relativePath:l.replace(`${t}/`,"")}))).flat();return _chunkZUNVPK23cjs.a.info(_colors2.default.green(`Found: ${f.length} packages and ${f.map(({softwareDevelopmentKits:l=[]})=>l).flat().length} sdks`)),f.map(l=>({...l,type:c,repositoryName:r}))}catch(p){throw new Error(`Error scanning globs ${i} with error: ${p}`)}}))).flat()}exports.a = hn; exports.b = Kn;
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
4
|
+
//# sourceMappingURL=chunk-2Q7ADV5Y.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/cli/cli/dist/chunk-YFF6A56N.cjs","../src/lib/code-scanning/integrations/cocoaPods.ts","../src/lib/code-scanning/integrations/gradle.ts","../src/lib/code-scanning/integrations/pubspec.ts","../src/lib/code-scanning/integrations/kotlin.ts"],"names":["POD_TARGET_REGEX","POD_PACKAGE_REGEX","cocoaPods","filePath","fileContents","readFileSync","targets","findAllWithRegex","packages","target","ind","CodePackageType","pkg","GRADLE_IMPLEMENTATION_REGEX","GRADLE_PLUGIN_REGEX","GRADLE_IMPLEMENTATION_GROUP_REGEX","GRADLE_APPLICATION_NAME_REGEX","gradle","directory","dirname","targetPlugins","targetGroups","applications"],"mappings":"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","file":"/home/runner/work/cli/cli/dist/chunk-YFF6A56N.cjs","sourcesContent":[null,"import { readFileSync } from 'node: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 'node:fs';\nimport { CodeScanningConfig } from '../types';\nimport { findAllWithRegex } from '@transcend-io/type-utils';\nimport { dirname } from 'node: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 'node:fs';\nimport { CodeScanningConfig } from '../types';\nimport { CodePackageType } from '@transcend-io/privacy-types';\nimport yaml from 'js-yaml';\nimport { dirname } from 'node: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 'node:fs';\nimport { dirname } from 'node:path';\nimport { CodeScanningConfig } from '../types';\nimport { findAllWithRegex } from '@transcend-io/type-utils';\n\n/**\n * Kotlin DSL (build.gradle.kts) dependency & plugin parsing\n */\n\nconst KTS_DEP_CONFIGS =\n // eslint-disable-next-line max-len\n '(implementation|api|kapt|ksp|debugImplementation|releaseImplementation|androidTestImplementation|testImplementation|compileOnly|runtimeOnly)';\n\n// e.g. implementation(\"com.google.firebase:firebase-analytics:18.0.0\")\nconst KTS_DEP_STRING_COORDS_REGEX = new RegExp(\n `${KTS_DEP_CONFIGS}\\\\s*\\\\(\\\\s*[\"']([^\"':\\\\s]+):([^\"':\\\\s]+):?([^\"']*)[\"']\\\\s*\\\\)`,\n 'g',\n);\n// captures: [1]=config, [2]=group, [3]=artifact, [4]=version (may be '')\n\n// e.g. implementation(platform(\"com.google.firebase:firebase-bom:33.1.2\"))\nconst KTS_DEP_PLATFORM_REGEX = new RegExp(\n `${KTS_DEP_CONFIGS}\\\\s*\\\\(\\\\s*platform\\\\(\\\\s*[\"']([^\"':\\\\s]+):([^\"':\\\\s]+):?([^\"']*)[\"']\\\\s*\\\\)\\\\s*\\\\)`,\n 'g',\n);\n\n// e.g. implementation(libs.androidx.appcompat) / implementation(libs[\"androidx-core-ktx\"])\nconst KTS_DEP_LIBS_ALIAS_REGEX = new RegExp(\n `${KTS_DEP_CONFIGS}\\\\s*\\\\(\\\\s*libs(?:\\\\.[\\\\w\\\\-\\\\.]+|\\\\[[\"'][^\"']+[\"']\\\\])\\\\s*\\\\)`,\n 'g',\n);\n\n// Plugins:\n// plugins { id(\"com.google.gms.google-services\") version \"4.4.2\" apply false }\n// plugins { id(\"org.jetbrains.kotlin.android\") }\n// apply(plugin = \"newrelic\")\n// plugins { alias(libs.plugins.kotlin.android) }\nconst KTS_PLUGIN_ID_REGEX =\n /id\\s*\\(\\s*[\"']([^\"']+)[\"']\\s*\\)(?:\\s*version\\s*[\"']([^\"']+)[\"'])?/g;\nconst KTS_PLUGIN_APPLY_REGEX =\n /apply\\s*\\(\\s*plugin\\s*=\\s*[\"']([^\"']+)[\"']\\s*\\)/g;\nconst KTS_PLUGIN_ALIAS_REGEX =\n /plugins\\s*\\{[^}]*alias\\s*\\(\\s*libs(?:\\.plugins)?(?:\\.[\\w\\-.]+|\\[[\"'][^\"']+[\"']\\])\\s*\\)[^}]*\\}/g;\n\n// applicationId in Kotlin DSL:\n// applicationId = \"com.foo.bar\"\n// applicationId(\"com.foo.bar\")\nconst KTS_APPLICATION_ID_EQ_REGEX = /applicationId\\s*=\\s*[\"']([^\"']+)[\"']/g;\nconst KTS_APPLICATION_ID_CALL_REGEX =\n /applicationId\\s*\\(\\s*[\"']([^\"']+)[\"']\\s*\\)/g;\n\n/**\n * Input dep entry (partial)\n */\ntype DepInput = {\n /** Name of the dependency */\n name: string;\n /** Version of the dependency */\n version?: string;\n};\n\n/**\n * Helper to normalize a parsed dep entry\n *\n * @param name - name\n * @param version - version\n * @returns normalized entry\n */\nfunction depEntry(name: string, version?: string): DepInput {\n const v =\n version && version.trim().length > 0 && version !== '_'\n ? version.trim()\n : undefined;\n return { name, version: v };\n}\n\nexport const kotlin: CodeScanningConfig = {\n supportedFiles: ['**/build.gradle.kts', '**/*.gradle.kts'],\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 // ---------- applicationId ----------\n const appIds = [\n ...findAllWithRegex(\n { value: KTS_APPLICATION_ID_EQ_REGEX, matches: ['name'] },\n fileContents,\n ),\n ...findAllWithRegex(\n { value: KTS_APPLICATION_ID_CALL_REGEX, matches: ['name'] },\n fileContents,\n ),\n ];\n if (appIds.length > 1) {\n throw new Error(`Expected only one applicationId per file: ${filePath}`);\n }\n const appName = appIds[0]?.name || directory.split('/').pop()!;\n\n // ---------- dependencies ----------\n const deps: Array<DepInput> = [];\n\n // \"group:artifact:version\"\n for (const m of fileContents.matchAll(KTS_DEP_STRING_COORDS_REGEX)) {\n const [, , group, artifact, version] = m;\n deps.push(depEntry(`${group}:${artifact}`, version));\n }\n\n // platform(\"group:artifact:version\")\n for (const m of fileContents.matchAll(KTS_DEP_PLATFORM_REGEX)) {\n const [, , group, artifact, version] = m;\n // Record as regular coord (you may prefer to tag as BoM separately)\n deps.push(depEntry(`${group}:${artifact}`, version));\n }\n\n // libs aliases (version catalogs) — keep alias as name, unknown version\n for (const m of fileContents.matchAll(KTS_DEP_LIBS_ALIAS_REGEX)) {\n // Grab the exact token as name (best-effort)\n const token = m[0]\n .replace(/^[^(]+\\(\\s*/, '')\n .replace(/\\)\\s*$/, '')\n .trim(); // e.g., libs.androidx.appcompat or libs[\"androidx-core-ktx\"]\n deps.push(depEntry(token));\n }\n\n // ---------- plugins ----------\n const plugins: Array<DepInput> = [];\n\n for (const m of fileContents.matchAll(KTS_PLUGIN_ID_REGEX)) {\n const [, pid, pver] = m;\n plugins.push(depEntry(pid, pver));\n }\n\n for (const m of fileContents.matchAll(KTS_PLUGIN_APPLY_REGEX)) {\n const [, pid] = m;\n plugins.push(depEntry(pid));\n }\n\n // alias(libs.plugins...) — keep alias token (no version)\n if (KTS_PLUGIN_ALIAS_REGEX.test(fileContents)) {\n // Collect all alias lines to preserve identifiers; light parse:\n const aliasMatches = fileContents.matchAll(\n /alias\\s*\\(\\s*(libs(?:\\.plugins)?(?:\\.[\\w\\-.]+|\\[[\"'][^\"']+[\"']\\]))\\s*\\)/g,\n );\n for (const m of aliasMatches) {\n plugins.push(depEntry(m[1]));\n }\n }\n\n // ---------- compose final list ----------\n // Merge deps + plugins as \"softwareDevelopmentKits\"\n const softwareDevelopmentKits = [...deps, ...plugins]\n // de-dup by name+version\n .reduce(\n (acc, cur) => {\n const key = `${cur.name}@@${cur.version || ''}`;\n if (!acc.map.has(key)) {\n acc.map.set(key, cur);\n acc.list.push(cur);\n }\n return acc;\n },\n {\n map: new Map<string, DepInput>(),\n list: [] as Array<DepInput>,\n },\n ).list;\n\n return [\n {\n name: appName,\n softwareDevelopmentKits,\n },\n ];\n },\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/cli/cli/dist/chunk-2Q7ADV5Y.cjs","../src/lib/code-scanning/integrations/cocoaPods.ts","../src/lib/code-scanning/integrations/gradle.ts","../src/lib/code-scanning/integrations/pubspec.ts","../src/lib/code-scanning/integrations/kotlin.ts"],"names":["POD_TARGET_REGEX","POD_PACKAGE_REGEX","cocoaPods","filePath","fileContents","readFileSync","targets","findAllWithRegex","packages","target","ind","CodePackageType","pkg","GRADLE_IMPLEMENTATION_REGEX","GRADLE_PLUGIN_REGEX","GRADLE_IMPLEMENTATION_GROUP_REGEX","GRADLE_APPLICATION_NAME_REGEX","gradle","directory","dirname","targetPlugins","targetGroups","applications"],"mappings":"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","file":"/home/runner/work/cli/cli/dist/chunk-2Q7ADV5Y.cjs","sourcesContent":[null,"import { readFileSync } from 'node: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 'node:fs';\nimport { CodeScanningConfig } from '../types';\nimport { findAllWithRegex } from '@transcend-io/type-utils';\nimport { dirname } from 'node: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 'node:fs';\nimport { CodeScanningConfig } from '../types';\nimport { CodePackageType } from '@transcend-io/privacy-types';\nimport yaml from 'js-yaml';\nimport { dirname } from 'node: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 'node:fs';\nimport { dirname } from 'node:path';\nimport { CodeScanningConfig } from '../types';\nimport { findAllWithRegex } from '@transcend-io/type-utils';\n\n/**\n * Kotlin DSL (build.gradle.kts) dependency & plugin parsing\n */\n\nconst KTS_DEP_CONFIGS =\n // eslint-disable-next-line max-len\n '(implementation|api|kapt|ksp|debugImplementation|releaseImplementation|androidTestImplementation|testImplementation|compileOnly|runtimeOnly)';\n\n// e.g. implementation(\"com.google.firebase:firebase-analytics:18.0.0\")\nconst KTS_DEP_STRING_COORDS_REGEX = new RegExp(\n `${KTS_DEP_CONFIGS}\\\\s*\\\\(\\\\s*[\"']([^\"':\\\\s]+):([^\"':\\\\s]+):?([^\"']*)[\"']\\\\s*\\\\)`,\n 'g',\n);\n// captures: [1]=config, [2]=group, [3]=artifact, [4]=version (may be '')\n\n// e.g. implementation(platform(\"com.google.firebase:firebase-bom:33.1.2\"))\nconst KTS_DEP_PLATFORM_REGEX = new RegExp(\n `${KTS_DEP_CONFIGS}\\\\s*\\\\(\\\\s*platform\\\\(\\\\s*[\"']([^\"':\\\\s]+):([^\"':\\\\s]+):?([^\"']*)[\"']\\\\s*\\\\)\\\\s*\\\\)`,\n 'g',\n);\n\n// e.g. implementation(libs.androidx.appcompat) / implementation(libs[\"androidx-core-ktx\"])\nconst KTS_DEP_LIBS_ALIAS_REGEX = new RegExp(\n `${KTS_DEP_CONFIGS}\\\\s*\\\\(\\\\s*libs(?:\\\\.[\\\\w\\\\-\\\\.]+|\\\\[[\"'][^\"']+[\"']\\\\])\\\\s*\\\\)`,\n 'g',\n);\n\n// Plugins:\n// plugins { id(\"com.google.gms.google-services\") version \"4.4.2\" apply false }\n// plugins { id(\"org.jetbrains.kotlin.android\") }\n// apply(plugin = \"newrelic\")\n// plugins { alias(libs.plugins.kotlin.android) }\nconst KTS_PLUGIN_ID_REGEX =\n /id\\s*\\(\\s*[\"']([^\"']+)[\"']\\s*\\)(?:\\s*version\\s*[\"']([^\"']+)[\"'])?/g;\nconst KTS_PLUGIN_APPLY_REGEX =\n /apply\\s*\\(\\s*plugin\\s*=\\s*[\"']([^\"']+)[\"']\\s*\\)/g;\nconst KTS_PLUGIN_ALIAS_REGEX =\n /plugins\\s*\\{[^}]*alias\\s*\\(\\s*libs(?:\\.plugins)?(?:\\.[\\w\\-.]+|\\[[\"'][^\"']+[\"']\\])\\s*\\)[^}]*\\}/g;\n\n// applicationId in Kotlin DSL:\n// applicationId = \"com.foo.bar\"\n// applicationId(\"com.foo.bar\")\nconst KTS_APPLICATION_ID_EQ_REGEX = /applicationId\\s*=\\s*[\"']([^\"']+)[\"']/g;\nconst KTS_APPLICATION_ID_CALL_REGEX =\n /applicationId\\s*\\(\\s*[\"']([^\"']+)[\"']\\s*\\)/g;\n\n/**\n * Input dep entry (partial)\n */\ntype DepInput = {\n /** Name of the dependency */\n name: string;\n /** Version of the dependency */\n version?: string;\n};\n\n/**\n * Helper to normalize a parsed dep entry\n *\n * @param name - name\n * @param version - version\n * @returns normalized entry\n */\nfunction depEntry(name: string, version?: string): DepInput {\n const v =\n version && version.trim().length > 0 && version !== '_'\n ? version.trim()\n : undefined;\n return { name, version: v };\n}\n\nexport const kotlin: CodeScanningConfig = {\n supportedFiles: ['**/build.gradle.kts', '**/*.gradle.kts'],\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 // ---------- applicationId ----------\n const appIds = [\n ...findAllWithRegex(\n { value: KTS_APPLICATION_ID_EQ_REGEX, matches: ['name'] },\n fileContents,\n ),\n ...findAllWithRegex(\n { value: KTS_APPLICATION_ID_CALL_REGEX, matches: ['name'] },\n fileContents,\n ),\n ];\n if (appIds.length > 1) {\n throw new Error(`Expected only one applicationId per file: ${filePath}`);\n }\n const appName = appIds[0]?.name || directory.split('/').pop()!;\n\n // ---------- dependencies ----------\n const deps: Array<DepInput> = [];\n\n // \"group:artifact:version\"\n for (const m of fileContents.matchAll(KTS_DEP_STRING_COORDS_REGEX)) {\n const [, , group, artifact, version] = m;\n deps.push(depEntry(`${group}:${artifact}`, version));\n }\n\n // platform(\"group:artifact:version\")\n for (const m of fileContents.matchAll(KTS_DEP_PLATFORM_REGEX)) {\n const [, , group, artifact, version] = m;\n // Record as regular coord (you may prefer to tag as BoM separately)\n deps.push(depEntry(`${group}:${artifact}`, version));\n }\n\n // libs aliases (version catalogs) — keep alias as name, unknown version\n for (const m of fileContents.matchAll(KTS_DEP_LIBS_ALIAS_REGEX)) {\n // Grab the exact token as name (best-effort)\n const token = m[0]\n .replace(/^[^(]+\\(\\s*/, '')\n .replace(/\\)\\s*$/, '')\n .trim(); // e.g., libs.androidx.appcompat or libs[\"androidx-core-ktx\"]\n deps.push(depEntry(token));\n }\n\n // ---------- plugins ----------\n const plugins: Array<DepInput> = [];\n\n for (const m of fileContents.matchAll(KTS_PLUGIN_ID_REGEX)) {\n const [, pid, pver] = m;\n plugins.push(depEntry(pid, pver));\n }\n\n for (const m of fileContents.matchAll(KTS_PLUGIN_APPLY_REGEX)) {\n const [, pid] = m;\n plugins.push(depEntry(pid));\n }\n\n // alias(libs.plugins...) — keep alias token (no version)\n if (KTS_PLUGIN_ALIAS_REGEX.test(fileContents)) {\n // Collect all alias lines to preserve identifiers; light parse:\n const aliasMatches = fileContents.matchAll(\n /alias\\s*\\(\\s*(libs(?:\\.plugins)?(?:\\.[\\w\\-.]+|\\[[\"'][^\"']+[\"']\\]))\\s*\\)/g,\n );\n for (const m of aliasMatches) {\n plugins.push(depEntry(m[1]));\n }\n }\n\n // ---------- compose final list ----------\n // Merge deps + plugins as \"softwareDevelopmentKits\"\n const softwareDevelopmentKits = [...deps, ...plugins]\n // de-dup by name+version\n .reduce(\n (acc, cur) => {\n const key = `${cur.name}@@${cur.version || ''}`;\n if (!acc.map.has(key)) {\n acc.map.set(key, cur);\n acc.list.push(cur);\n }\n return acc;\n },\n {\n map: new Map<string, DepInput>(),\n list: [] as Array<DepInput>,\n },\n ).list;\n\n return [\n {\n name: appName,\n softwareDevelopmentKits,\n },\n ];\n },\n};\n"]}
|