1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "before": `Key / Document,Key / Section,Key / Product,Key / Version,Key / Locale,Key / Visibility,Content Hash,Evidence Hash,Source Revision,Extractor Version,Validity
12fictional-document-1,fictional-section-1,fictional-assistant,1,en,private,aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,source-r1,fictional-extractor-1,valid`,
13 "after": `Key / Document,Key / Section,Key / Product,Key / Version,Key / Locale,Key / Visibility,Content Hash,Evidence Hash,Source Revision,Extractor Version,Validity
14fictional-document-1,fictional-section-1,fictional-assistant,1,en,private,aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc,source-r2,fictional-extractor-1,valid`,
15 "items": `Id,Kind,Product,Version,Locale,Visibility
16fictional-test-1,test,fictional-assistant,1,en,private
17fictional-test-2,test,fictional-assistant,1,en,private`,
18 "links": "From Source / Document,From Source / Section,From Source / Product,From Source / Version,From Source / Locale,From Source / Visibility,From Item / Id,From Item / Kind,From Item / Product,From Item / Version,From Item / Locale,From Item / Visibility,To / Id,To / Kind,To / Product,To / Version,To / Locale,To / Visibility\nfictional-document-1,fictional-section-1,fictional-assistant,1,en,private,\\N,\\N,\\N,\\N,\\N,\\N,fictional-test-1,test,fictional-assistant,1,en,private\n\\N,\\N,\\N,\\N,\\N,\\N,fictional-unknown-answer,answer,fictional-assistant,1,en,private,fictional-test-2,test,fictional-assistant,1,en,private\n",
19 "mapping": {
20 "before_capture": {
21 "capture_id": "fictional-source-before",
22 "scope_id": "fictional-declared-source-inventory",
23 "captured_at": "2026-10-01T12:00:00Z",
24 "capture_state": "complete"
25 },
26 "after_capture": {
27 "capture_id": "fictional-source-after",
28 "scope_id": "fictional-declared-source-inventory",
29 "captured_at": "2026-10-02T12:00:00Z",
30 "capture_state": "complete"
31 },
32 "null_token": "\\N",
33 "before": [
34 {
35 "source": "Key / Document",
36 "target": "key.document"
37 },
38 {
39 "source": "Key / Section",
40 "target": "key.section"
41 },
42 {
43 "source": "Key / Product",
44 "target": "key.product"
45 },
46 {
47 "source": "Key / Version",
48 "target": "key.version"
49 },
50 {
51 "source": "Key / Locale",
52 "target": "key.locale"
53 },
54 {
55 "source": "Key / Visibility",
56 "target": "key.visibility"
57 },
58 {
59 "source": "Content Hash",
60 "target": "content_hash"
61 },
62 {
63 "source": "Evidence Hash",
64 "target": "evidence_hash"
65 },
66 {
67 "source": "Source Revision",
68 "target": "source_revision"
69 },
70 {
71 "source": "Extractor Version",
72 "target": "extractor_version"
73 },
74 {
75 "source": "Validity",
76 "target": "validity"
77 }
78 ],
79 "after": [
80 {
81 "source": "Key / Document",
82 "target": "key.document"
83 },
84 {
85 "source": "Key / Section",
86 "target": "key.section"
87 },
88 {
89 "source": "Key / Product",
90 "target": "key.product"
91 },
92 {
93 "source": "Key / Version",
94 "target": "key.version"
95 },
96 {
97 "source": "Key / Locale",
98 "target": "key.locale"
99 },
100 {
101 "source": "Key / Visibility",
102 "target": "key.visibility"
103 },
104 {
105 "source": "Content Hash",
106 "target": "content_hash"
107 },
108 {
109 "source": "Evidence Hash",
110 "target": "evidence_hash"
111 },
112 {
113 "source": "Source Revision",
114 "target": "source_revision"
115 },
116 {
117 "source": "Extractor Version",
118 "target": "extractor_version"
119 },
120 {
121 "source": "Validity",
122 "target": "validity"
123 }
124 ],
125 "items": [
126 {
127 "source": "Id",
128 "target": "id"
129 },
130 {
131 "source": "Kind",
132 "target": "kind"
133 },
134 {
135 "source": "Product",
136 "target": "product"
137 },
138 {
139 "source": "Version",
140 "target": "version"
141 },
142 {
143 "source": "Locale",
144 "target": "locale"
145 },
146 {
147 "source": "Visibility",
148 "target": "visibility"
149 }
150 ],
151 "links": [
152 {
153 "source": "From Source / Document",
154 "target": "from_source.document"
155 },
156 {
157 "source": "From Source / Section",
158 "target": "from_source.section"
159 },
160 {
161 "source": "From Source / Product",
162 "target": "from_source.product"
163 },
164 {
165 "source": "From Source / Version",
166 "target": "from_source.version"
167 },
168 {
169 "source": "From Source / Locale",
170 "target": "from_source.locale"
171 },
172 {
173 "source": "From Source / Visibility",
174 "target": "from_source.visibility"
175 },
176 {
177 "source": "From Item / Id",
178 "target": "from_item.id"
179 },
180 {
181 "source": "From Item / Kind",
182 "target": "from_item.kind"
183 },
184 {
185 "source": "From Item / Product",
186 "target": "from_item.product"
187 },
188 {
189 "source": "From Item / Version",
190 "target": "from_item.version"
191 },
192 {
193 "source": "From Item / Locale",
194 "target": "from_item.locale"
195 },
196 {
197 "source": "From Item / Visibility",
198 "target": "from_item.visibility"
199 },
200 {
201 "source": "To / Id",
202 "target": "to.id"
203 },
204 {
205 "source": "To / Kind",
206 "target": "to.kind"
207 },
208 {
209 "source": "To / Product",
210 "target": "to.product"
211 },
212 {
213 "source": "To / Version",
214 "target": "to.version"
215 },
216 {
217 "source": "To / Locale",
218 "target": "to.locale"
219 },
220 {
221 "source": "To / Visibility",
222 "target": "to.visibility"
223 }
224 ]
225 }
226};
227
228
229const run = await client.actor("critd/answer-drift-planner").call(input);
230
231
232console.log('Results from dataset');
233console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
234const { items } = await client.dataset(run.defaultDatasetId).listItems();
235items.forEach((item) => {
236 console.dir(item);
237});
238
239