1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "sbomJson": {
12 "bomFormat": "CycloneDX",
13 "specVersion": "1.6",
14 "version": 1,
15 "components": [
16 {
17 "type": "library",
18 "bom-ref": "pkg-0",
19 "name": "pkg-0",
20 "licenses": [
21 {
22 "expression": "MIT OR GPL-3.0-only"
23 }
24 ]
25 },
26 {
27 "type": "library",
28 "bom-ref": "pkg-1",
29 "name": "pkg-1",
30 "licenses": [
31 {
32 "expression": "MIT AND GPL-3.0-only"
33 }
34 ]
35 },
36 {
37 "type": "library",
38 "bom-ref": "pkg-2",
39 "name": "pkg-2",
40 "licenses": [
41 {
42 "expression": "NOASSERTION"
43 }
44 ]
45 }
46 ]
47 },
48 "allowedLicenses": [
49 "MIT",
50 "Apache-2.0"
51 ],
52 "reviewRequiredLicenses": [
53 "MPL-2.0"
54 ],
55 "blockedLicenses": [
56 "GPL-3.0-only"
57 ]
58};
59
60
61const run = await client.actor("afkdigital/sbom-license-policy-checker").call(input);
62
63
64console.log('Results from dataset');
65console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
66const { items } = await client.dataset(run.defaultDatasetId).listItems();
67items.forEach((item) => {
68 console.dir(item);
69});
70
71