@agentproto/collect 0.0.0-stage → 0.1.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/LICENSE +202 -0
- package/README.md +642 -2
- package/dist/chunk-FQLYZIVI.mjs +405 -0
- package/dist/chunk-FQLYZIVI.mjs.map +1 -0
- package/dist/chunk-SOLT3HJH.mjs +213 -0
- package/dist/chunk-SOLT3HJH.mjs.map +1 -0
- package/dist/chunk-SYTQ6RN6.mjs +98 -0
- package/dist/chunk-SYTQ6RN6.mjs.map +1 -0
- package/dist/connector-DUNy3vSU.d.ts +981 -0
- package/dist/connectors.d.ts +104 -0
- package/dist/connectors.mjs +1197 -0
- package/dist/connectors.mjs.map +1 -0
- package/dist/engine-BRXHKg5A.d.ts +384 -0
- package/dist/index.d.ts +134 -0
- package/dist/index.mjs +1494 -0
- package/dist/index.mjs.map +1 -0
- package/dist/node.d.ts +526 -0
- package/dist/node.mjs +2322 -0
- package/dist/node.mjs.map +1 -0
- package/package.json +71 -3
|
@@ -0,0 +1,981 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const ItemKind: z.ZodEnum<{
|
|
4
|
+
article: "article";
|
|
5
|
+
post: "post";
|
|
6
|
+
thread: "thread";
|
|
7
|
+
submission: "submission";
|
|
8
|
+
review: "review";
|
|
9
|
+
video: "video";
|
|
10
|
+
query: "query";
|
|
11
|
+
}>;
|
|
12
|
+
type ItemKind = z.infer<typeof ItemKind>;
|
|
13
|
+
declare const MissingReason: z.ZodEnum<{
|
|
14
|
+
not_exposed: "not_exposed";
|
|
15
|
+
hidden: "hidden";
|
|
16
|
+
blocked: "blocked";
|
|
17
|
+
}>;
|
|
18
|
+
type MissingReason = z.infer<typeof MissingReason>;
|
|
19
|
+
declare const MetricName: z.ZodEnum<{
|
|
20
|
+
views: "views";
|
|
21
|
+
likes: "likes";
|
|
22
|
+
reposts: "reposts";
|
|
23
|
+
replies: "replies";
|
|
24
|
+
bookmarks: "bookmarks";
|
|
25
|
+
points: "points";
|
|
26
|
+
comments: "comments";
|
|
27
|
+
reactions: "reactions";
|
|
28
|
+
score: "score";
|
|
29
|
+
rating: "rating";
|
|
30
|
+
helpfulVotes: "helpfulVotes";
|
|
31
|
+
}>;
|
|
32
|
+
type MetricName = z.infer<typeof MetricName>;
|
|
33
|
+
declare const Subject: z.ZodObject<{
|
|
34
|
+
label: z.ZodString;
|
|
35
|
+
provenance: z.ZodEnum<{
|
|
36
|
+
query: "query";
|
|
37
|
+
source_tag: "source_tag";
|
|
38
|
+
classifier: "classifier";
|
|
39
|
+
}>;
|
|
40
|
+
classifier: z.ZodOptional<z.ZodObject<{
|
|
41
|
+
name: z.ZodString;
|
|
42
|
+
version: z.ZodString;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
type Subject = z.infer<typeof Subject>;
|
|
46
|
+
declare const ItemLinks: z.ZodObject<{
|
|
47
|
+
target: z.ZodOptional<z.ZodString>;
|
|
48
|
+
parent: z.ZodOptional<z.ZodString>;
|
|
49
|
+
root: z.ZodOptional<z.ZodString>;
|
|
50
|
+
quoted: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
type ItemLinks = z.infer<typeof ItemLinks>;
|
|
53
|
+
declare const ItemPart: z.ZodObject<{
|
|
54
|
+
id: z.ZodString;
|
|
55
|
+
text: z.ZodString;
|
|
56
|
+
authorRef: z.ZodOptional<z.ZodString>;
|
|
57
|
+
postedAt: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODate, z.ZodISODateTime]>>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
type ItemPart = z.infer<typeof ItemPart>;
|
|
60
|
+
declare const CollectItem: z.ZodObject<{
|
|
61
|
+
id: z.ZodString;
|
|
62
|
+
source: z.ZodString;
|
|
63
|
+
sourceInstance: z.ZodOptional<z.ZodString>;
|
|
64
|
+
kind: z.ZodEnum<{
|
|
65
|
+
article: "article";
|
|
66
|
+
post: "post";
|
|
67
|
+
thread: "thread";
|
|
68
|
+
submission: "submission";
|
|
69
|
+
review: "review";
|
|
70
|
+
video: "video";
|
|
71
|
+
query: "query";
|
|
72
|
+
}>;
|
|
73
|
+
url: z.ZodOptional<z.ZodString>;
|
|
74
|
+
canonicalUrl: z.ZodOptional<z.ZodString>;
|
|
75
|
+
contentId: z.ZodOptional<z.ZodString>;
|
|
76
|
+
contentGroupId: z.ZodOptional<z.ZodString>;
|
|
77
|
+
subjects: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
78
|
+
label: z.ZodString;
|
|
79
|
+
provenance: z.ZodEnum<{
|
|
80
|
+
query: "query";
|
|
81
|
+
source_tag: "source_tag";
|
|
82
|
+
classifier: "classifier";
|
|
83
|
+
}>;
|
|
84
|
+
classifier: z.ZodOptional<z.ZodObject<{
|
|
85
|
+
name: z.ZodString;
|
|
86
|
+
version: z.ZodString;
|
|
87
|
+
}, z.core.$strip>>;
|
|
88
|
+
}, z.core.$strip>>>;
|
|
89
|
+
title: z.ZodOptional<z.ZodString>;
|
|
90
|
+
text: z.ZodOptional<z.ZodString>;
|
|
91
|
+
textTruncated: z.ZodOptional<z.ZodBoolean>;
|
|
92
|
+
language: z.ZodOptional<z.ZodString>;
|
|
93
|
+
wordCount: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
format: z.ZodOptional<z.ZodString>;
|
|
95
|
+
authorRef: z.ZodOptional<z.ZodString>;
|
|
96
|
+
submitterRef: z.ZodOptional<z.ZodString>;
|
|
97
|
+
publishedAt: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODate, z.ZodISODateTime]>>;
|
|
98
|
+
postedAt: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODate, z.ZodISODateTime]>>;
|
|
99
|
+
firstSeenAt: z.ZodISODateTime;
|
|
100
|
+
links: z.ZodOptional<z.ZodObject<{
|
|
101
|
+
target: z.ZodOptional<z.ZodString>;
|
|
102
|
+
parent: z.ZodOptional<z.ZodString>;
|
|
103
|
+
root: z.ZodOptional<z.ZodString>;
|
|
104
|
+
quoted: z.ZodOptional<z.ZodString>;
|
|
105
|
+
}, z.core.$strip>>;
|
|
106
|
+
outboundLinks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
107
|
+
parts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
108
|
+
id: z.ZodString;
|
|
109
|
+
text: z.ZodString;
|
|
110
|
+
authorRef: z.ZodOptional<z.ZodString>;
|
|
111
|
+
postedAt: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODate, z.ZodISODateTime]>>;
|
|
112
|
+
}, z.core.$strip>>>;
|
|
113
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
114
|
+
hasMedia: z.ZodOptional<z.ZodBoolean>;
|
|
115
|
+
query: z.ZodOptional<z.ZodString>;
|
|
116
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
117
|
+
rawRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
118
|
+
ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
119
|
+
}, z.core.$strip>;
|
|
120
|
+
type CollectItem = z.infer<typeof CollectItem>;
|
|
121
|
+
declare const ObservationBase: z.ZodObject<{
|
|
122
|
+
itemId: z.ZodString;
|
|
123
|
+
measuredAt: z.ZodISODateTime;
|
|
124
|
+
metrics: z.ZodDefault<z.ZodRecord<z.ZodEnum<{
|
|
125
|
+
views: "views";
|
|
126
|
+
likes: "likes";
|
|
127
|
+
reposts: "reposts";
|
|
128
|
+
replies: "replies";
|
|
129
|
+
bookmarks: "bookmarks";
|
|
130
|
+
points: "points";
|
|
131
|
+
comments: "comments";
|
|
132
|
+
reactions: "reactions";
|
|
133
|
+
score: "score";
|
|
134
|
+
rating: "rating";
|
|
135
|
+
helpfulVotes: "helpfulVotes";
|
|
136
|
+
}> & z.core.$partial, z.ZodNumber>>;
|
|
137
|
+
partMetrics: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodEnum<{
|
|
138
|
+
views: "views";
|
|
139
|
+
likes: "likes";
|
|
140
|
+
reposts: "reposts";
|
|
141
|
+
replies: "replies";
|
|
142
|
+
bookmarks: "bookmarks";
|
|
143
|
+
points: "points";
|
|
144
|
+
comments: "comments";
|
|
145
|
+
reactions: "reactions";
|
|
146
|
+
score: "score";
|
|
147
|
+
rating: "rating";
|
|
148
|
+
helpfulVotes: "helpfulVotes";
|
|
149
|
+
}> & z.core.$partial, z.ZodNumber>>>;
|
|
150
|
+
rawValues: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
151
|
+
views: "views";
|
|
152
|
+
likes: "likes";
|
|
153
|
+
reposts: "reposts";
|
|
154
|
+
replies: "replies";
|
|
155
|
+
bookmarks: "bookmarks";
|
|
156
|
+
points: "points";
|
|
157
|
+
comments: "comments";
|
|
158
|
+
reactions: "reactions";
|
|
159
|
+
score: "score";
|
|
160
|
+
rating: "rating";
|
|
161
|
+
helpfulVotes: "helpfulVotes";
|
|
162
|
+
}> & z.core.$partial, z.ZodString>>;
|
|
163
|
+
missing: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
164
|
+
views: "views";
|
|
165
|
+
likes: "likes";
|
|
166
|
+
reposts: "reposts";
|
|
167
|
+
replies: "replies";
|
|
168
|
+
bookmarks: "bookmarks";
|
|
169
|
+
points: "points";
|
|
170
|
+
comments: "comments";
|
|
171
|
+
reactions: "reactions";
|
|
172
|
+
score: "score";
|
|
173
|
+
rating: "rating";
|
|
174
|
+
helpfulVotes: "helpfulVotes";
|
|
175
|
+
}> & z.core.$partial, z.ZodEnum<{
|
|
176
|
+
not_exposed: "not_exposed";
|
|
177
|
+
hidden: "hidden";
|
|
178
|
+
blocked: "blocked";
|
|
179
|
+
}>>>;
|
|
180
|
+
transport: z.ZodOptional<z.ZodString>;
|
|
181
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
182
|
+
taskId: z.ZodOptional<z.ZodString>;
|
|
183
|
+
recordKey: z.ZodOptional<z.ZodString>;
|
|
184
|
+
rawRef: z.ZodOptional<z.ZodString>;
|
|
185
|
+
}, z.core.$strip>;
|
|
186
|
+
/** Unrefined shape of `Observation`, for consumers that need `.extend()`, `.pick()` or `.partial()`. */
|
|
187
|
+
declare const Observation: z.ZodObject<{
|
|
188
|
+
itemId: z.ZodString;
|
|
189
|
+
measuredAt: z.ZodISODateTime;
|
|
190
|
+
metrics: z.ZodDefault<z.ZodRecord<z.ZodEnum<{
|
|
191
|
+
views: "views";
|
|
192
|
+
likes: "likes";
|
|
193
|
+
reposts: "reposts";
|
|
194
|
+
replies: "replies";
|
|
195
|
+
bookmarks: "bookmarks";
|
|
196
|
+
points: "points";
|
|
197
|
+
comments: "comments";
|
|
198
|
+
reactions: "reactions";
|
|
199
|
+
score: "score";
|
|
200
|
+
rating: "rating";
|
|
201
|
+
helpfulVotes: "helpfulVotes";
|
|
202
|
+
}> & z.core.$partial, z.ZodNumber>>;
|
|
203
|
+
partMetrics: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodEnum<{
|
|
204
|
+
views: "views";
|
|
205
|
+
likes: "likes";
|
|
206
|
+
reposts: "reposts";
|
|
207
|
+
replies: "replies";
|
|
208
|
+
bookmarks: "bookmarks";
|
|
209
|
+
points: "points";
|
|
210
|
+
comments: "comments";
|
|
211
|
+
reactions: "reactions";
|
|
212
|
+
score: "score";
|
|
213
|
+
rating: "rating";
|
|
214
|
+
helpfulVotes: "helpfulVotes";
|
|
215
|
+
}> & z.core.$partial, z.ZodNumber>>>;
|
|
216
|
+
rawValues: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
217
|
+
views: "views";
|
|
218
|
+
likes: "likes";
|
|
219
|
+
reposts: "reposts";
|
|
220
|
+
replies: "replies";
|
|
221
|
+
bookmarks: "bookmarks";
|
|
222
|
+
points: "points";
|
|
223
|
+
comments: "comments";
|
|
224
|
+
reactions: "reactions";
|
|
225
|
+
score: "score";
|
|
226
|
+
rating: "rating";
|
|
227
|
+
helpfulVotes: "helpfulVotes";
|
|
228
|
+
}> & z.core.$partial, z.ZodString>>;
|
|
229
|
+
missing: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
230
|
+
views: "views";
|
|
231
|
+
likes: "likes";
|
|
232
|
+
reposts: "reposts";
|
|
233
|
+
replies: "replies";
|
|
234
|
+
bookmarks: "bookmarks";
|
|
235
|
+
points: "points";
|
|
236
|
+
comments: "comments";
|
|
237
|
+
reactions: "reactions";
|
|
238
|
+
score: "score";
|
|
239
|
+
rating: "rating";
|
|
240
|
+
helpfulVotes: "helpfulVotes";
|
|
241
|
+
}> & z.core.$partial, z.ZodEnum<{
|
|
242
|
+
not_exposed: "not_exposed";
|
|
243
|
+
hidden: "hidden";
|
|
244
|
+
blocked: "blocked";
|
|
245
|
+
}>>>;
|
|
246
|
+
transport: z.ZodOptional<z.ZodString>;
|
|
247
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
248
|
+
taskId: z.ZodOptional<z.ZodString>;
|
|
249
|
+
recordKey: z.ZodOptional<z.ZodString>;
|
|
250
|
+
rawRef: z.ZodOptional<z.ZodString>;
|
|
251
|
+
}, z.core.$strip>;
|
|
252
|
+
type Observation = z.infer<typeof Observation>;
|
|
253
|
+
declare const AudienceKind: z.ZodEnum<{
|
|
254
|
+
followers: "followers";
|
|
255
|
+
karma: "karma";
|
|
256
|
+
subscribers: "subscribers";
|
|
257
|
+
}>;
|
|
258
|
+
type AudienceKind = z.infer<typeof AudienceKind>;
|
|
259
|
+
declare const AudienceUnknownReason: z.ZodEnum<{
|
|
260
|
+
not_exposed: "not_exposed";
|
|
261
|
+
blocked: "blocked";
|
|
262
|
+
not_fetched: "not_fetched";
|
|
263
|
+
}>;
|
|
264
|
+
type AudienceUnknownReason = z.infer<typeof AudienceUnknownReason>;
|
|
265
|
+
/** One reading of an audience figure. Either `value` is known or `unknown` says why not. */
|
|
266
|
+
declare const AudienceReading: z.ZodObject<{
|
|
267
|
+
measuredAt: z.ZodISODateTime;
|
|
268
|
+
kind: z.ZodEnum<{
|
|
269
|
+
followers: "followers";
|
|
270
|
+
karma: "karma";
|
|
271
|
+
subscribers: "subscribers";
|
|
272
|
+
}>;
|
|
273
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
274
|
+
rawValue: z.ZodOptional<z.ZodString>;
|
|
275
|
+
unknown: z.ZodOptional<z.ZodEnum<{
|
|
276
|
+
not_exposed: "not_exposed";
|
|
277
|
+
blocked: "blocked";
|
|
278
|
+
not_fetched: "not_fetched";
|
|
279
|
+
}>>;
|
|
280
|
+
}, z.core.$strip>;
|
|
281
|
+
type AudienceReading = z.infer<typeof AudienceReading>;
|
|
282
|
+
declare const Actor: z.ZodObject<{
|
|
283
|
+
ref: z.ZodString;
|
|
284
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
285
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
286
|
+
profileUrl: z.ZodOptional<z.ZodString>;
|
|
287
|
+
accountCreatedAt: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODate, z.ZodISODateTime]>>;
|
|
288
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
289
|
+
audience: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
290
|
+
measuredAt: z.ZodISODateTime;
|
|
291
|
+
kind: z.ZodEnum<{
|
|
292
|
+
followers: "followers";
|
|
293
|
+
karma: "karma";
|
|
294
|
+
subscribers: "subscribers";
|
|
295
|
+
}>;
|
|
296
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
297
|
+
rawValue: z.ZodOptional<z.ZodString>;
|
|
298
|
+
unknown: z.ZodOptional<z.ZodEnum<{
|
|
299
|
+
not_exposed: "not_exposed";
|
|
300
|
+
blocked: "blocked";
|
|
301
|
+
not_fetched: "not_fetched";
|
|
302
|
+
}>>;
|
|
303
|
+
}, z.core.$strip>>>;
|
|
304
|
+
recordKey: z.ZodOptional<z.ZodString>;
|
|
305
|
+
}, z.core.$strip>;
|
|
306
|
+
type Actor = z.infer<typeof Actor>;
|
|
307
|
+
declare const PickupKind: z.ZodEnum<{
|
|
308
|
+
media_pickup: "media_pickup";
|
|
309
|
+
crosspost: "crosspost";
|
|
310
|
+
media_publication: "media_publication";
|
|
311
|
+
}>;
|
|
312
|
+
type PickupKind = z.infer<typeof PickupKind>;
|
|
313
|
+
declare const PickupMethod: z.ZodEnum<{
|
|
314
|
+
link: "link";
|
|
315
|
+
content_id: "content_id";
|
|
316
|
+
near_text: "near_text";
|
|
317
|
+
declared: "declared";
|
|
318
|
+
legacy_flag: "legacy_flag";
|
|
319
|
+
}>;
|
|
320
|
+
type PickupMethod = z.infer<typeof PickupMethod>;
|
|
321
|
+
/** Methods whose evidence is exact, so the pickup counts as verified. */
|
|
322
|
+
declare const VERIFIED_PICKUP_METHODS: readonly PickupMethod[];
|
|
323
|
+
declare const PickupBase: z.ZodObject<{
|
|
324
|
+
itemId: z.ZodString;
|
|
325
|
+
kind: z.ZodEnum<{
|
|
326
|
+
media_pickup: "media_pickup";
|
|
327
|
+
crosspost: "crosspost";
|
|
328
|
+
media_publication: "media_publication";
|
|
329
|
+
}>;
|
|
330
|
+
pickupItemId: z.ZodOptional<z.ZodString>;
|
|
331
|
+
pickupUrl: z.ZodOptional<z.ZodString>;
|
|
332
|
+
outlet: z.ZodOptional<z.ZodString>;
|
|
333
|
+
relation: z.ZodEnum<{
|
|
334
|
+
republication: "republication";
|
|
335
|
+
citation: "citation";
|
|
336
|
+
}>;
|
|
337
|
+
evidence: z.ZodObject<{
|
|
338
|
+
outboundLink: z.ZodOptional<z.ZodString>;
|
|
339
|
+
excerpt: z.ZodOptional<z.ZodString>;
|
|
340
|
+
similarity: z.ZodOptional<z.ZodNumber>;
|
|
341
|
+
rawRef: z.ZodOptional<z.ZodString>;
|
|
342
|
+
}, z.core.$strip>;
|
|
343
|
+
method: z.ZodEnum<{
|
|
344
|
+
link: "link";
|
|
345
|
+
content_id: "content_id";
|
|
346
|
+
near_text: "near_text";
|
|
347
|
+
declared: "declared";
|
|
348
|
+
legacy_flag: "legacy_flag";
|
|
349
|
+
}>;
|
|
350
|
+
verified: z.ZodBoolean;
|
|
351
|
+
firstSeenAt: z.ZodISODateTime;
|
|
352
|
+
measuredAt: z.ZodISODateTime;
|
|
353
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
354
|
+
taskId: z.ZodOptional<z.ZodString>;
|
|
355
|
+
recordKey: z.ZodOptional<z.ZodString>;
|
|
356
|
+
}, z.core.$strip>;
|
|
357
|
+
/** Unrefined shape of `Pickup`, for consumers that need `.extend()`, `.pick()` or `.partial()`. */
|
|
358
|
+
declare const Pickup: z.ZodObject<{
|
|
359
|
+
itemId: z.ZodString;
|
|
360
|
+
kind: z.ZodEnum<{
|
|
361
|
+
media_pickup: "media_pickup";
|
|
362
|
+
crosspost: "crosspost";
|
|
363
|
+
media_publication: "media_publication";
|
|
364
|
+
}>;
|
|
365
|
+
pickupItemId: z.ZodOptional<z.ZodString>;
|
|
366
|
+
pickupUrl: z.ZodOptional<z.ZodString>;
|
|
367
|
+
outlet: z.ZodOptional<z.ZodString>;
|
|
368
|
+
relation: z.ZodEnum<{
|
|
369
|
+
republication: "republication";
|
|
370
|
+
citation: "citation";
|
|
371
|
+
}>;
|
|
372
|
+
evidence: z.ZodObject<{
|
|
373
|
+
outboundLink: z.ZodOptional<z.ZodString>;
|
|
374
|
+
excerpt: z.ZodOptional<z.ZodString>;
|
|
375
|
+
similarity: z.ZodOptional<z.ZodNumber>;
|
|
376
|
+
rawRef: z.ZodOptional<z.ZodString>;
|
|
377
|
+
}, z.core.$strip>;
|
|
378
|
+
method: z.ZodEnum<{
|
|
379
|
+
link: "link";
|
|
380
|
+
content_id: "content_id";
|
|
381
|
+
near_text: "near_text";
|
|
382
|
+
declared: "declared";
|
|
383
|
+
legacy_flag: "legacy_flag";
|
|
384
|
+
}>;
|
|
385
|
+
verified: z.ZodBoolean;
|
|
386
|
+
firstSeenAt: z.ZodISODateTime;
|
|
387
|
+
measuredAt: z.ZodISODateTime;
|
|
388
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
389
|
+
taskId: z.ZodOptional<z.ZodString>;
|
|
390
|
+
recordKey: z.ZodOptional<z.ZodString>;
|
|
391
|
+
}, z.core.$strip>;
|
|
392
|
+
type Pickup = z.infer<typeof Pickup>;
|
|
393
|
+
declare const Recipe: z.ZodObject<{
|
|
394
|
+
name: z.ZodOptional<z.ZodString>;
|
|
395
|
+
sources: z.ZodArray<z.ZodObject<{
|
|
396
|
+
connector: z.ZodString;
|
|
397
|
+
instance: z.ZodOptional<z.ZodString>;
|
|
398
|
+
queries: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
399
|
+
text: z.ZodString;
|
|
400
|
+
subject: z.ZodString;
|
|
401
|
+
}, z.core.$strip>>>;
|
|
402
|
+
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
403
|
+
}, z.core.$strip>>;
|
|
404
|
+
window: z.ZodOptional<z.ZodObject<{
|
|
405
|
+
from: z.ZodOptional<z.ZodISODateTime>;
|
|
406
|
+
to: z.ZodOptional<z.ZodISODateTime>;
|
|
407
|
+
}, z.core.$strip>>;
|
|
408
|
+
sampling: z.ZodOptional<z.ZodObject<{
|
|
409
|
+
bands: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
410
|
+
metric: z.ZodOptional<z.ZodEnum<{
|
|
411
|
+
views: "views";
|
|
412
|
+
likes: "likes";
|
|
413
|
+
reposts: "reposts";
|
|
414
|
+
replies: "replies";
|
|
415
|
+
bookmarks: "bookmarks";
|
|
416
|
+
points: "points";
|
|
417
|
+
comments: "comments";
|
|
418
|
+
reactions: "reactions";
|
|
419
|
+
score: "score";
|
|
420
|
+
rating: "rating";
|
|
421
|
+
helpfulVotes: "helpfulVotes";
|
|
422
|
+
}>>;
|
|
423
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
424
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
425
|
+
quota: z.ZodOptional<z.ZodNumber>;
|
|
426
|
+
}, z.core.$strip>>>;
|
|
427
|
+
keepMissingMetric: z.ZodOptional<z.ZodBoolean>;
|
|
428
|
+
perDomainCap: z.ZodOptional<z.ZodNumber>;
|
|
429
|
+
seed: z.ZodOptional<z.ZodNumber>;
|
|
430
|
+
}, z.core.$strip>>;
|
|
431
|
+
caps: z.ZodOptional<z.ZodObject<{
|
|
432
|
+
perConnector: z.ZodOptional<z.ZodNumber>;
|
|
433
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
434
|
+
}, z.core.$strip>>;
|
|
435
|
+
workers: z.ZodDefault<z.ZodNumber>;
|
|
436
|
+
lookahead: z.ZodOptional<z.ZodNumber>;
|
|
437
|
+
sinks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
438
|
+
}, z.core.$strip>;
|
|
439
|
+
type Recipe = z.infer<typeof Recipe>;
|
|
440
|
+
declare const FailureCause: z.ZodEnum<{
|
|
441
|
+
blocked: "blocked";
|
|
442
|
+
empty: "empty";
|
|
443
|
+
network: "network";
|
|
444
|
+
http: "http";
|
|
445
|
+
challenge: "challenge";
|
|
446
|
+
parse: "parse";
|
|
447
|
+
other: "other";
|
|
448
|
+
}>;
|
|
449
|
+
type FailureCause = z.infer<typeof FailureCause>;
|
|
450
|
+
/** Every `with*` field and `eligible` is a count of items; shares are computed by the reader. */
|
|
451
|
+
declare const CoverageCell: z.ZodObject<{
|
|
452
|
+
platform: z.ZodString;
|
|
453
|
+
format: z.ZodString;
|
|
454
|
+
language: z.ZodString;
|
|
455
|
+
subject: z.ZodString;
|
|
456
|
+
items: z.ZodNumber;
|
|
457
|
+
withAuthorAudience: z.ZodNumber;
|
|
458
|
+
withPrimaryMetric: z.ZodNumber;
|
|
459
|
+
withAge: z.ZodNumber;
|
|
460
|
+
withAuthorId: z.ZodNumber;
|
|
461
|
+
withUniqueContent: z.ZodNumber;
|
|
462
|
+
eligible: z.ZodNumber;
|
|
463
|
+
}, z.core.$strip>;
|
|
464
|
+
type CoverageCell = z.infer<typeof CoverageCell>;
|
|
465
|
+
declare const Coverage: z.ZodObject<{
|
|
466
|
+
cells: z.ZodArray<z.ZodObject<{
|
|
467
|
+
platform: z.ZodString;
|
|
468
|
+
format: z.ZodString;
|
|
469
|
+
language: z.ZodString;
|
|
470
|
+
subject: z.ZodString;
|
|
471
|
+
items: z.ZodNumber;
|
|
472
|
+
withAuthorAudience: z.ZodNumber;
|
|
473
|
+
withPrimaryMetric: z.ZodNumber;
|
|
474
|
+
withAge: z.ZodNumber;
|
|
475
|
+
withAuthorId: z.ZodNumber;
|
|
476
|
+
withUniqueContent: z.ZodNumber;
|
|
477
|
+
eligible: z.ZodNumber;
|
|
478
|
+
}, z.core.$strip>>;
|
|
479
|
+
}, z.core.$strip>;
|
|
480
|
+
type Coverage = z.infer<typeof Coverage>;
|
|
481
|
+
declare const SampledReport: z.ZodObject<{
|
|
482
|
+
candidates: z.ZodNumber;
|
|
483
|
+
kept: z.ZodNumber;
|
|
484
|
+
dropped: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
485
|
+
}, z.core.$strip>;
|
|
486
|
+
type SampledReport = z.infer<typeof SampledReport>;
|
|
487
|
+
declare const ConnectorReport: z.ZodObject<{
|
|
488
|
+
connector: z.ZodString;
|
|
489
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
490
|
+
ok: "ok";
|
|
491
|
+
partial: "partial";
|
|
492
|
+
failed: "failed";
|
|
493
|
+
skipped: "skipped";
|
|
494
|
+
}>>;
|
|
495
|
+
skippedReason: z.ZodOptional<z.ZodString>;
|
|
496
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
497
|
+
tasks: z.ZodObject<{
|
|
498
|
+
planned: z.ZodNumber;
|
|
499
|
+
done: z.ZodNumber;
|
|
500
|
+
failed: z.ZodNumber;
|
|
501
|
+
skipped: z.ZodNumber;
|
|
502
|
+
}, z.core.$strip>;
|
|
503
|
+
newItems: z.ZodNumber;
|
|
504
|
+
observations: z.ZodNumber;
|
|
505
|
+
duplicates: z.ZodNumber;
|
|
506
|
+
failures: z.ZodDefault<z.ZodRecord<z.ZodEnum<{
|
|
507
|
+
blocked: "blocked";
|
|
508
|
+
empty: "empty";
|
|
509
|
+
network: "network";
|
|
510
|
+
http: "http";
|
|
511
|
+
challenge: "challenge";
|
|
512
|
+
parse: "parse";
|
|
513
|
+
other: "other";
|
|
514
|
+
}> & z.core.$partial, z.ZodNumber>>;
|
|
515
|
+
escalations: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
516
|
+
from: z.ZodString;
|
|
517
|
+
to: z.ZodString;
|
|
518
|
+
count: z.ZodNumber;
|
|
519
|
+
}, z.core.$strip>>>;
|
|
520
|
+
durationMs: z.ZodNumber;
|
|
521
|
+
sampled: z.ZodOptional<z.ZodObject<{
|
|
522
|
+
candidates: z.ZodNumber;
|
|
523
|
+
kept: z.ZodNumber;
|
|
524
|
+
dropped: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
525
|
+
}, z.core.$strip>>;
|
|
526
|
+
coverage: z.ZodOptional<z.ZodObject<{
|
|
527
|
+
cells: z.ZodArray<z.ZodObject<{
|
|
528
|
+
platform: z.ZodString;
|
|
529
|
+
format: z.ZodString;
|
|
530
|
+
language: z.ZodString;
|
|
531
|
+
subject: z.ZodString;
|
|
532
|
+
items: z.ZodNumber;
|
|
533
|
+
withAuthorAudience: z.ZodNumber;
|
|
534
|
+
withPrimaryMetric: z.ZodNumber;
|
|
535
|
+
withAge: z.ZodNumber;
|
|
536
|
+
withAuthorId: z.ZodNumber;
|
|
537
|
+
withUniqueContent: z.ZodNumber;
|
|
538
|
+
eligible: z.ZodNumber;
|
|
539
|
+
}, z.core.$strip>>;
|
|
540
|
+
}, z.core.$strip>>;
|
|
541
|
+
}, z.core.$strip>;
|
|
542
|
+
type ConnectorReport = z.infer<typeof ConnectorReport>;
|
|
543
|
+
declare const RunReport: z.ZodObject<{
|
|
544
|
+
runId: z.ZodString;
|
|
545
|
+
startedAt: z.ZodISODateTime;
|
|
546
|
+
finishedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
547
|
+
connectors: z.ZodArray<z.ZodObject<{
|
|
548
|
+
connector: z.ZodString;
|
|
549
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
550
|
+
ok: "ok";
|
|
551
|
+
partial: "partial";
|
|
552
|
+
failed: "failed";
|
|
553
|
+
skipped: "skipped";
|
|
554
|
+
}>>;
|
|
555
|
+
skippedReason: z.ZodOptional<z.ZodString>;
|
|
556
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
557
|
+
tasks: z.ZodObject<{
|
|
558
|
+
planned: z.ZodNumber;
|
|
559
|
+
done: z.ZodNumber;
|
|
560
|
+
failed: z.ZodNumber;
|
|
561
|
+
skipped: z.ZodNumber;
|
|
562
|
+
}, z.core.$strip>;
|
|
563
|
+
newItems: z.ZodNumber;
|
|
564
|
+
observations: z.ZodNumber;
|
|
565
|
+
duplicates: z.ZodNumber;
|
|
566
|
+
failures: z.ZodDefault<z.ZodRecord<z.ZodEnum<{
|
|
567
|
+
blocked: "blocked";
|
|
568
|
+
empty: "empty";
|
|
569
|
+
network: "network";
|
|
570
|
+
http: "http";
|
|
571
|
+
challenge: "challenge";
|
|
572
|
+
parse: "parse";
|
|
573
|
+
other: "other";
|
|
574
|
+
}> & z.core.$partial, z.ZodNumber>>;
|
|
575
|
+
escalations: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
576
|
+
from: z.ZodString;
|
|
577
|
+
to: z.ZodString;
|
|
578
|
+
count: z.ZodNumber;
|
|
579
|
+
}, z.core.$strip>>>;
|
|
580
|
+
durationMs: z.ZodNumber;
|
|
581
|
+
sampled: z.ZodOptional<z.ZodObject<{
|
|
582
|
+
candidates: z.ZodNumber;
|
|
583
|
+
kept: z.ZodNumber;
|
|
584
|
+
dropped: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
585
|
+
}, z.core.$strip>>;
|
|
586
|
+
coverage: z.ZodOptional<z.ZodObject<{
|
|
587
|
+
cells: z.ZodArray<z.ZodObject<{
|
|
588
|
+
platform: z.ZodString;
|
|
589
|
+
format: z.ZodString;
|
|
590
|
+
language: z.ZodString;
|
|
591
|
+
subject: z.ZodString;
|
|
592
|
+
items: z.ZodNumber;
|
|
593
|
+
withAuthorAudience: z.ZodNumber;
|
|
594
|
+
withPrimaryMetric: z.ZodNumber;
|
|
595
|
+
withAge: z.ZodNumber;
|
|
596
|
+
withAuthorId: z.ZodNumber;
|
|
597
|
+
withUniqueContent: z.ZodNumber;
|
|
598
|
+
eligible: z.ZodNumber;
|
|
599
|
+
}, z.core.$strip>>;
|
|
600
|
+
}, z.core.$strip>>;
|
|
601
|
+
}, z.core.$strip>>;
|
|
602
|
+
coverage: z.ZodOptional<z.ZodObject<{
|
|
603
|
+
cells: z.ZodArray<z.ZodObject<{
|
|
604
|
+
platform: z.ZodString;
|
|
605
|
+
format: z.ZodString;
|
|
606
|
+
language: z.ZodString;
|
|
607
|
+
subject: z.ZodString;
|
|
608
|
+
items: z.ZodNumber;
|
|
609
|
+
withAuthorAudience: z.ZodNumber;
|
|
610
|
+
withPrimaryMetric: z.ZodNumber;
|
|
611
|
+
withAge: z.ZodNumber;
|
|
612
|
+
withAuthorId: z.ZodNumber;
|
|
613
|
+
withUniqueContent: z.ZodNumber;
|
|
614
|
+
eligible: z.ZodNumber;
|
|
615
|
+
}, z.core.$strip>>;
|
|
616
|
+
}, z.core.$strip>>;
|
|
617
|
+
}, z.core.$strip>;
|
|
618
|
+
type RunReport = z.infer<typeof RunReport>;
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Transport contracts: what the engine hands to a connector's `fetch`.
|
|
622
|
+
* Types only, plus the typed error every transport throws. The shipped
|
|
623
|
+
* implementations live in the Node entry.
|
|
624
|
+
*/
|
|
625
|
+
type TransportName = "api" | "http" | "browser";
|
|
626
|
+
/** Why a transport could not give usable content. */
|
|
627
|
+
type TransportErrorCause = "blocked" | "empty" | "network" | "challenge" | "http";
|
|
628
|
+
interface TransportErrorOptions {
|
|
629
|
+
/** HTTP status when the failure came from a response. */
|
|
630
|
+
status?: number;
|
|
631
|
+
/** Final URL of the failed request, when known. */
|
|
632
|
+
url?: string;
|
|
633
|
+
/** Body of the failed response, kept as a raw when present. */
|
|
634
|
+
body?: Uint8Array;
|
|
635
|
+
/** File extension of `body` (without the dot). */
|
|
636
|
+
ext?: string;
|
|
637
|
+
/** `Content-Type` of the failed response, so its body can be decoded later. */
|
|
638
|
+
contentType?: string;
|
|
639
|
+
/** The underlying error, when there is one. */
|
|
640
|
+
origin?: unknown;
|
|
641
|
+
}
|
|
642
|
+
declare class TransportError extends Error {
|
|
643
|
+
/** Why the transport gave no usable content. */
|
|
644
|
+
readonly cause: TransportErrorCause;
|
|
645
|
+
readonly code = "TRANSPORT_ERROR";
|
|
646
|
+
readonly status?: number;
|
|
647
|
+
readonly url?: string;
|
|
648
|
+
readonly body?: Uint8Array;
|
|
649
|
+
readonly ext?: string;
|
|
650
|
+
readonly contentType?: string;
|
|
651
|
+
readonly origin?: unknown;
|
|
652
|
+
constructor(
|
|
653
|
+
/** Why the transport gave no usable content. */
|
|
654
|
+
cause: TransportErrorCause, message: string, options?: TransportErrorOptions);
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Thrown by an auth-adding transport when the secret it needs is not
|
|
658
|
+
* available. The engine records the task as `skipped` with this reason; it is
|
|
659
|
+
* not a failure and does not fall back. The message names the secret, never
|
|
660
|
+
* its value.
|
|
661
|
+
*/
|
|
662
|
+
declare class MissingSecretError extends Error {
|
|
663
|
+
readonly secret: string;
|
|
664
|
+
readonly code = "MISSING_SECRET";
|
|
665
|
+
constructor(secret: string);
|
|
666
|
+
}
|
|
667
|
+
interface HttpRequest {
|
|
668
|
+
url: string;
|
|
669
|
+
method?: string;
|
|
670
|
+
headers?: Record<string, string>;
|
|
671
|
+
body?: string | Uint8Array;
|
|
672
|
+
timeoutMs?: number;
|
|
673
|
+
signal?: AbortSignal;
|
|
674
|
+
/**
|
|
675
|
+
* Lower-case names of headers that carry credentials. A transport that
|
|
676
|
+
* follows redirects drops them when a hop leaves the origin.
|
|
677
|
+
*/
|
|
678
|
+
credentialHeaders?: string[];
|
|
679
|
+
/**
|
|
680
|
+
* The URL itself carries a credential (a query parameter). A transport that
|
|
681
|
+
* follows redirects refuses any hop that leaves the origin, with a `blocked`
|
|
682
|
+
* error.
|
|
683
|
+
*/
|
|
684
|
+
urlCredential?: boolean;
|
|
685
|
+
}
|
|
686
|
+
interface HttpResponse {
|
|
687
|
+
status: number;
|
|
688
|
+
headers: Record<string, string>;
|
|
689
|
+
body: Uint8Array;
|
|
690
|
+
/** Final URL, after redirects. */
|
|
691
|
+
url: string;
|
|
692
|
+
}
|
|
693
|
+
/** Used for both the `http` and the `api` transport (the latter adds auth headers from a `SecretsPort`). */
|
|
694
|
+
interface HttpTransport {
|
|
695
|
+
request(request: HttpRequest): Promise<HttpResponse>;
|
|
696
|
+
}
|
|
697
|
+
/** Handle of a page the browser transport opened. Only pages it opened are ever touched. */
|
|
698
|
+
interface BrowserPage {
|
|
699
|
+
id: string;
|
|
700
|
+
url?: string;
|
|
701
|
+
}
|
|
702
|
+
interface BrowserWaitOptions {
|
|
703
|
+
/** CSS selector to wait for. */
|
|
704
|
+
selector?: string;
|
|
705
|
+
/** Script that returns true when the page is ready. */
|
|
706
|
+
predicate?: string;
|
|
707
|
+
timeoutMs?: number;
|
|
708
|
+
}
|
|
709
|
+
interface BrowserScrollOptions {
|
|
710
|
+
/** Number of scroll steps. */
|
|
711
|
+
steps?: number;
|
|
712
|
+
pixels?: number;
|
|
713
|
+
}
|
|
714
|
+
interface BrowserTransport {
|
|
715
|
+
/** Open a new background page on `url`. */
|
|
716
|
+
open(url: string): Promise<BrowserPage>;
|
|
717
|
+
/** Run a script in the page and return its JSON-serialisable result. */
|
|
718
|
+
evaluate<T = unknown>(page: BrowserPage, script: string): Promise<T>;
|
|
719
|
+
/** Same-origin fetch from inside the page. */
|
|
720
|
+
fetchInPage(page: BrowserPage, request: HttpRequest): Promise<HttpResponse>;
|
|
721
|
+
scroll(page: BrowserPage, options?: BrowserScrollOptions): Promise<void>;
|
|
722
|
+
waitFor(page: BrowserPage, options: BrowserWaitOptions): Promise<void>;
|
|
723
|
+
close(page: BrowserPage): Promise<void>;
|
|
724
|
+
}
|
|
725
|
+
/** Where secrets come from. The engine never logs or stores a secret value. */
|
|
726
|
+
interface SecretsPort {
|
|
727
|
+
get(name: string): Promise<string | undefined>;
|
|
728
|
+
}
|
|
729
|
+
/** The transports a collector can use, by name. A missing entry means that transport is not available. */
|
|
730
|
+
/** What a connector declares of its access: enough to build its own authenticated transport. */
|
|
731
|
+
interface ApiConnectorInfo {
|
|
732
|
+
readonly id: string;
|
|
733
|
+
readonly access: {
|
|
734
|
+
level: "none";
|
|
735
|
+
} | {
|
|
736
|
+
level: "key";
|
|
737
|
+
secret: string;
|
|
738
|
+
} | {
|
|
739
|
+
level: "session";
|
|
740
|
+
site: string;
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
/** Builds the `api` transport of one connector, so each connector carries its own credential. Called once per connector and run. */
|
|
744
|
+
type ApiTransportFactory = (connector: ApiConnectorInfo) => HttpTransport;
|
|
745
|
+
interface TransportSet {
|
|
746
|
+
/** One shared transport, or a factory that gives each connector its own. */
|
|
747
|
+
api?: HttpTransport | ApiTransportFactory;
|
|
748
|
+
http?: HttpTransport;
|
|
749
|
+
browser?: BrowserTransport;
|
|
750
|
+
}
|
|
751
|
+
/** What a connector's `fetch` receives: the chosen transport, with its name. */
|
|
752
|
+
type FetchTransport = {
|
|
753
|
+
name: "api" | "http";
|
|
754
|
+
http: HttpTransport;
|
|
755
|
+
} | {
|
|
756
|
+
name: "browser";
|
|
757
|
+
browser: BrowserTransport;
|
|
758
|
+
};
|
|
759
|
+
|
|
760
|
+
/** A unit of work a connector plans: stable id, plain-JSON parameters. */
|
|
761
|
+
declare const CollectTask: z.ZodObject<{
|
|
762
|
+
id: z.ZodString;
|
|
763
|
+
kind: z.ZodOptional<z.ZodString>;
|
|
764
|
+
params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
765
|
+
}, z.core.$strip>;
|
|
766
|
+
type CollectTask = z.input<typeof CollectTask>;
|
|
767
|
+
declare const CounterDeclaration: z.ZodObject<{
|
|
768
|
+
name: z.ZodEnum<{
|
|
769
|
+
views: "views";
|
|
770
|
+
likes: "likes";
|
|
771
|
+
reposts: "reposts";
|
|
772
|
+
replies: "replies";
|
|
773
|
+
bookmarks: "bookmarks";
|
|
774
|
+
points: "points";
|
|
775
|
+
comments: "comments";
|
|
776
|
+
reactions: "reactions";
|
|
777
|
+
score: "score";
|
|
778
|
+
rating: "rating";
|
|
779
|
+
helpfulVotes: "helpfulVotes";
|
|
780
|
+
}>;
|
|
781
|
+
unit: z.ZodString;
|
|
782
|
+
scope: z.ZodEnum<{
|
|
783
|
+
thread: "thread";
|
|
784
|
+
root: "root";
|
|
785
|
+
}>;
|
|
786
|
+
primary: z.ZodDefault<z.ZodBoolean>;
|
|
787
|
+
}, z.core.$strip>;
|
|
788
|
+
type CounterDeclaration = z.input<typeof CounterDeclaration>;
|
|
789
|
+
declare const AccessDeclaration: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
790
|
+
level: z.ZodLiteral<"none">;
|
|
791
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
792
|
+
level: z.ZodLiteral<"key">;
|
|
793
|
+
secret: z.ZodString;
|
|
794
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
795
|
+
level: z.ZodLiteral<"session">;
|
|
796
|
+
site: z.ZodString;
|
|
797
|
+
}, z.core.$strip>], "level">;
|
|
798
|
+
type AccessDeclaration = z.infer<typeof AccessDeclaration>;
|
|
799
|
+
declare const Capability: z.ZodEnum<{
|
|
800
|
+
search: "search";
|
|
801
|
+
list: "list";
|
|
802
|
+
"read-by-url": "read-by-url";
|
|
803
|
+
"author-profile": "author-profile";
|
|
804
|
+
"re-observe": "re-observe";
|
|
805
|
+
}>;
|
|
806
|
+
type Capability = z.infer<typeof Capability>;
|
|
807
|
+
declare const Pace: z.ZodObject<{
|
|
808
|
+
delayMs: z.ZodDefault<z.ZodNumber>;
|
|
809
|
+
maxTasksPerRun: z.ZodOptional<z.ZodNumber>;
|
|
810
|
+
}, z.core.$strip>;
|
|
811
|
+
type Pace = z.infer<typeof Pace>;
|
|
812
|
+
/**
|
|
813
|
+
* How to tell whether the browser holds an open session on the site of a
|
|
814
|
+
* `session` connector. `collect doctor` opens `url`, then runs `evaluate`, a
|
|
815
|
+
* function body, in the page, wrapped there: an exception is caught in the
|
|
816
|
+
* page and only a fixed code crosses back (`open` when the body returned
|
|
817
|
+
* exactly `true`, `none` for anything else, `error` when it threw). It must
|
|
818
|
+
* answer from what the page shows and never return cookies or tokens. The
|
|
819
|
+
* script is the connector's own trusted code; the read-only rule binds the
|
|
820
|
+
* connector author (no submitting, posting or changing anything).
|
|
821
|
+
*/
|
|
822
|
+
declare const SessionCheck: z.ZodObject<{
|
|
823
|
+
url: z.ZodString;
|
|
824
|
+
evaluate: z.ZodString;
|
|
825
|
+
}, z.core.$strip>;
|
|
826
|
+
type SessionCheck = z.infer<typeof SessionCheck>;
|
|
827
|
+
declare const TransportNameSchema: z.ZodEnum<{
|
|
828
|
+
http: "http";
|
|
829
|
+
api: "api";
|
|
830
|
+
browser: "browser";
|
|
831
|
+
}>;
|
|
832
|
+
/** The data part of a connector, validated by `defineConnector`. */
|
|
833
|
+
declare const ConnectorDeclaration: z.ZodObject<{
|
|
834
|
+
id: z.ZodString;
|
|
835
|
+
version: z.ZodString;
|
|
836
|
+
transports: z.ZodArray<z.ZodEnum<{
|
|
837
|
+
http: "http";
|
|
838
|
+
api: "api";
|
|
839
|
+
browser: "browser";
|
|
840
|
+
}>>;
|
|
841
|
+
access: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
842
|
+
level: z.ZodLiteral<"none">;
|
|
843
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
844
|
+
level: z.ZodLiteral<"key">;
|
|
845
|
+
secret: z.ZodString;
|
|
846
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
847
|
+
level: z.ZodLiteral<"session">;
|
|
848
|
+
site: z.ZodString;
|
|
849
|
+
}, z.core.$strip>], "level">>;
|
|
850
|
+
capabilities: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
851
|
+
search: "search";
|
|
852
|
+
list: "list";
|
|
853
|
+
"read-by-url": "read-by-url";
|
|
854
|
+
"author-profile": "author-profile";
|
|
855
|
+
"re-observe": "re-observe";
|
|
856
|
+
}>>>;
|
|
857
|
+
counters: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
858
|
+
name: z.ZodEnum<{
|
|
859
|
+
views: "views";
|
|
860
|
+
likes: "likes";
|
|
861
|
+
reposts: "reposts";
|
|
862
|
+
replies: "replies";
|
|
863
|
+
bookmarks: "bookmarks";
|
|
864
|
+
points: "points";
|
|
865
|
+
comments: "comments";
|
|
866
|
+
reactions: "reactions";
|
|
867
|
+
score: "score";
|
|
868
|
+
rating: "rating";
|
|
869
|
+
helpfulVotes: "helpfulVotes";
|
|
870
|
+
}>;
|
|
871
|
+
unit: z.ZodString;
|
|
872
|
+
scope: z.ZodEnum<{
|
|
873
|
+
thread: "thread";
|
|
874
|
+
root: "root";
|
|
875
|
+
}>;
|
|
876
|
+
primary: z.ZodDefault<z.ZodBoolean>;
|
|
877
|
+
}, z.core.$strip>>>;
|
|
878
|
+
pace: z.ZodDefault<z.ZodObject<{
|
|
879
|
+
delayMs: z.ZodDefault<z.ZodNumber>;
|
|
880
|
+
maxTasksPerRun: z.ZodOptional<z.ZodNumber>;
|
|
881
|
+
}, z.core.$strip>>;
|
|
882
|
+
sessionCheck: z.ZodOptional<z.ZodObject<{
|
|
883
|
+
url: z.ZodString;
|
|
884
|
+
evaluate: z.ZodString;
|
|
885
|
+
}, z.core.$strip>>;
|
|
886
|
+
}, z.core.$strip>;
|
|
887
|
+
type RecipeSource = Recipe["sources"][number];
|
|
888
|
+
/** A raw body a connector fetched. The engine stores it, whatever its status. */
|
|
889
|
+
interface FetchedRaw {
|
|
890
|
+
url: string;
|
|
891
|
+
/** File extension without the dot, e.g. `json`, `html`. */
|
|
892
|
+
ext: string;
|
|
893
|
+
bytes: Uint8Array;
|
|
894
|
+
httpStatus?: number;
|
|
895
|
+
/** `Content-Type` of the response, kept with the raw so a replay decodes it the same way. */
|
|
896
|
+
contentType?: string;
|
|
897
|
+
/** Set when the page is a verification or challenge page. */
|
|
898
|
+
challenge?: boolean;
|
|
899
|
+
}
|
|
900
|
+
interface FetchResult {
|
|
901
|
+
raws: FetchedRaw[];
|
|
902
|
+
/** Next page, linked article, author profile... queued after this task. */
|
|
903
|
+
tasks?: CollectTask[];
|
|
904
|
+
}
|
|
905
|
+
interface FetchContext {
|
|
906
|
+
secrets: SecretsPort;
|
|
907
|
+
signal?: AbortSignal;
|
|
908
|
+
/** Current time from the collector's clock, ISO. */
|
|
909
|
+
now: string;
|
|
910
|
+
}
|
|
911
|
+
interface ParseInput {
|
|
912
|
+
connector: string;
|
|
913
|
+
task: z.infer<typeof CollectTask>;
|
|
914
|
+
raw: {
|
|
915
|
+
/** Store ref of the stored body. */
|
|
916
|
+
ref: string;
|
|
917
|
+
url: string;
|
|
918
|
+
ext: string;
|
|
919
|
+
bytes: Uint8Array;
|
|
920
|
+
httpStatus?: number;
|
|
921
|
+
/** `Content-Type` the body was fetched with, when the connector recorded it. */
|
|
922
|
+
contentType?: string;
|
|
923
|
+
fetchedAt: string;
|
|
924
|
+
transport: TransportName;
|
|
925
|
+
};
|
|
926
|
+
}
|
|
927
|
+
type Fill<T, K extends string> = Omit<T, K> & Partial<Record<K, string>>;
|
|
928
|
+
/** An item as a connector returns it: the engine fills what it can compute. */
|
|
929
|
+
type ParsedItem = Omit<z.input<typeof CollectItem>, "id" | "firstSeenAt"> & {
|
|
930
|
+
/** Defaults to `source:` plus a hash of the canonical URL. */
|
|
931
|
+
id?: string;
|
|
932
|
+
firstSeenAt?: string;
|
|
933
|
+
};
|
|
934
|
+
type ParsedObservation = Fill<z.input<typeof ObservationBase>, "measuredAt">;
|
|
935
|
+
type ParsedPickup = Fill<z.input<typeof PickupBase>, "firstSeenAt" | "measuredAt">;
|
|
936
|
+
interface ParseResult {
|
|
937
|
+
items?: ParsedItem[];
|
|
938
|
+
observations?: ParsedObservation[];
|
|
939
|
+
actors?: Array<z.input<typeof Actor>>;
|
|
940
|
+
pickups?: ParsedPickup[];
|
|
941
|
+
}
|
|
942
|
+
type ConnectorDeclarationInput = z.input<typeof ConnectorDeclaration>;
|
|
943
|
+
/** Arrays may be readonly, so a `Connector` can be spread into a new definition. */
|
|
944
|
+
type ReadonlyArrays<T> = {
|
|
945
|
+
[K in keyof T]: T[K] extends Array<infer U> | undefined ? readonly U[] | Extract<T[K], undefined> : T[K];
|
|
946
|
+
};
|
|
947
|
+
interface ConnectorDefinition extends ReadonlyArrays<ConnectorDeclarationInput> {
|
|
948
|
+
/** Validates `ext` of every item this connector returns. */
|
|
949
|
+
ext?: z.ZodType;
|
|
950
|
+
/** Deterministic: the same recipe gives the same tasks, with the same ids. No I/O. */
|
|
951
|
+
plan(recipe: Recipe, sources: RecipeSource[]): CollectTask[];
|
|
952
|
+
/** The only phase that touches the network. */
|
|
953
|
+
fetch(task: z.infer<typeof CollectTask>, transport: FetchTransport, context: FetchContext): Promise<FetchResult>;
|
|
954
|
+
/** Pure: a stored raw in, records out. Replayable without network. */
|
|
955
|
+
parse(input: ParseInput): ParseResult | Promise<ParseResult>;
|
|
956
|
+
}
|
|
957
|
+
interface Connector extends Omit<ConnectorDefinition, keyof ConnectorDeclarationInput> {
|
|
958
|
+
readonly id: string;
|
|
959
|
+
readonly version: string;
|
|
960
|
+
readonly transports: readonly TransportName[];
|
|
961
|
+
readonly access: AccessDeclaration;
|
|
962
|
+
readonly capabilities: readonly Capability[];
|
|
963
|
+
readonly counters: ReadonlyArray<z.infer<typeof CounterDeclaration>>;
|
|
964
|
+
readonly pace: Pace;
|
|
965
|
+
readonly sessionCheck?: SessionCheck;
|
|
966
|
+
}
|
|
967
|
+
/** Validate the declaration of a connector and return it with its defaults filled. */
|
|
968
|
+
declare function defineConnector(definition: ConnectorDefinition): Connector;
|
|
969
|
+
interface ConnectorRegistry {
|
|
970
|
+
register(connector: Connector): void;
|
|
971
|
+
get(id: string): Connector | undefined;
|
|
972
|
+
list(): Connector[];
|
|
973
|
+
}
|
|
974
|
+
/** An isolated registry (tests, embedding). */
|
|
975
|
+
declare function createConnectorRegistry(initial?: Connector[]): ConnectorRegistry;
|
|
976
|
+
/** Register a connector (shipped, external or private) in the process-wide registry. */
|
|
977
|
+
declare function registerConnector(connector: Connector): Connector;
|
|
978
|
+
declare function getConnector(id: string): Connector | undefined;
|
|
979
|
+
declare function listConnectors(): Connector[];
|
|
980
|
+
|
|
981
|
+
export { RunReport as $, AccessDeclaration as A, type BrowserPage as B, type Connector as C, type HttpTransport as D, ItemLinks as E, FailureCause as F, ItemPart as G, type HttpRequest as H, ItemKind as I, MissingReason as J, MissingSecretError as K, ObservationBase as L, MetricName as M, type ParseInput as N, Observation as O, Pace as P, type ParseResult as Q, Recipe as R, Subject as S, type ParsedItem as T, type ParsedObservation as U, type ParsedPickup as V, Pickup as W, PickupBase as X, PickupKind as Y, PickupMethod as Z, type RecipeSource as _, CollectTask as a, SampledReport as a0, SessionCheck as a1, TransportError as a2, type TransportErrorCause as a3, type TransportErrorOptions as a4, type TransportName as a5, TransportNameSchema as a6, type TransportSet as a7, VERIFIED_PICKUP_METHODS as a8, createConnectorRegistry as a9, defineConnector as aa, getConnector as ab, listConnectors as ac, registerConnector as ad, type SecretsPort as b, type ConnectorRegistry as c, Coverage as d, Actor as e, type ApiConnectorInfo as f, type ApiTransportFactory as g, AudienceKind as h, AudienceReading as i, AudienceUnknownReason as j, type BrowserScrollOptions as k, type BrowserTransport as l, type BrowserWaitOptions as m, Capability as n, CollectItem as o, ConnectorDeclaration as p, type ConnectorDeclarationInput as q, type ConnectorDefinition as r, ConnectorReport as s, CounterDeclaration as t, CoverageCell as u, type FetchContext as v, type FetchResult as w, type FetchTransport as x, type FetchedRaw as y, type HttpResponse as z };
|