1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "baselineDate": "2026-10-01",
12 "currentDate": "2026-11-01",
13 "baselineProducts": [
14 {
15 "handle": "trail-bottle",
16 "title": "Trail Bottle",
17 "variants": [
18 {
19 "available": true
20 }
21 ]
22 },
23 {
24 "handle": "canvas-tote",
25 "title": "Canvas Tote",
26 "variants": [
27 {
28 "available": true
29 },
30 {
31 "available": true
32 }
33 ]
34 },
35 {
36 "handle": "desk-lamp",
37 "title": "Desk Lamp",
38 "variants": [
39 {
40 "available": true
41 }
42 ]
43 },
44 {
45 "handle": "wool-socks",
46 "title": "Wool Socks",
47 "variants": [
48 {
49 "available": true
50 }
51 ]
52 },
53 {
54 "handle": "sample-mug",
55 "title": "Sample Mug",
56 "variants": [
57 {
58 "available": false
59 }
60 ]
61 }
62 ],
63 "currentProducts": [
64 {
65 "handle": "trail-bottle",
66 "title": "Trail Bottle",
67 "variants": [
68 {
69 "available": true
70 }
71 ]
72 },
73 {
74 "handle": "canvas-tote",
75 "title": "Canvas Tote",
76 "variants": [
77 {
78 "available": false
79 },
80 {
81 "available": false
82 }
83 ]
84 },
85 {
86 "handle": "wool-socks",
87 "title": "Wool Socks",
88 "variants": [
89 {
90 "available": true
91 }
92 ]
93 },
94 {
95 "handle": "sample-mug",
96 "title": "Sample Mug",
97 "variants": [
98 {
99 "available": false
100 }
101 ]
102 },
103 {
104 "handle": "new-scarf",
105 "title": "New Scarf",
106 "variants": [
107 {
108 "available": true
109 }
110 ]
111 }
112 ],
113 "salesWeights": [
114 {
115 "handle": "trail-bottle",
116 "weight": 400
117 },
118 {
119 "handle": "canvas-tote",
120 "weight": 250
121 },
122 {
123 "handle": "desk-lamp",
124 "weight": 120
125 },
126 {
127 "handle": "sample-mug",
128 "weight": 30
129 }
130 ]
131};
132
133
134const run = await client.actor("practical_ai_lab_jp/pal-shopify-collection-revenue-exposure-audit").call(input);
135
136
137console.log('Results from dataset');
138console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
139const { items } = await client.dataset(run.defaultDatasetId).listItems();
140items.forEach((item) => {
141 console.dir(item);
142});
143
144