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