harvester_sdk 1.0.17 → 1.0.18

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/dist/index.d.ts CHANGED
@@ -414,6 +414,7 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
414
414
  is_public: boolean;
415
415
  metadata: any;
416
416
  dominant_geos: string[];
417
+ mentions_in_discovery: number;
417
418
  priority: "low" | "medium" | "high" | "critical";
418
419
  notes?: string | null | undefined;
419
420
  description?: string | null | undefined;
@@ -444,6 +445,7 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
444
445
  is_public: boolean;
445
446
  metadata: any;
446
447
  dominant_geos: string[];
448
+ mentions_in_discovery: number;
447
449
  priority: "low" | "medium" | "high" | "critical";
448
450
  notes?: string | null | undefined;
449
451
  description?: string | null | undefined;
@@ -474,6 +476,7 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
474
476
  is_public: boolean;
475
477
  metadata: any;
476
478
  dominant_geos: string[];
479
+ mentions_in_discovery: number;
477
480
  priority: "low" | "medium" | "high" | "critical";
478
481
  notes?: string | null | undefined;
479
482
  description?: string | null | undefined;
package/dist/index.js CHANGED
@@ -232,6 +232,7 @@ exports.MongoSourceSchema = new mongoose_1.Schema({
232
232
  region_title: { type: String },
233
233
  group_id: { type: String },
234
234
  dominant_geos: { type: [String], default: [] },
235
+ mentions_in_discovery: { type: Number, default: 0 },
235
236
  requested_by: {
236
237
  type: {
237
238
  user_id: { type: String },
package/dist/types.d.ts CHANGED
@@ -95,6 +95,7 @@ export declare const zodSourceSchema: z.ZodObject<{
95
95
  region_title: z.ZodOptional<z.ZodString>;
96
96
  group_id: z.ZodOptional<z.ZodString>;
97
97
  dominant_geos: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
98
+ mentions_in_discovery: z.ZodOptional<z.ZodNumber>;
98
99
  requested_by: z.ZodOptional<z.ZodObject<{
99
100
  user_id: z.ZodOptional<z.ZodString>;
100
101
  username: z.ZodOptional<z.ZodString>;
@@ -139,6 +140,7 @@ export declare const zodSourceSchema: z.ZodObject<{
139
140
  region_title?: string | undefined;
140
141
  group_id?: string | undefined;
141
142
  dominant_geos?: string[] | undefined;
143
+ mentions_in_discovery?: number | undefined;
142
144
  requested_by?: {
143
145
  user_id?: string | undefined;
144
146
  username?: string | undefined;
@@ -170,6 +172,7 @@ export declare const zodSourceSchema: z.ZodObject<{
170
172
  region_title?: string | undefined;
171
173
  group_id?: string | undefined;
172
174
  dominant_geos?: string[] | undefined;
175
+ mentions_in_discovery?: number | undefined;
173
176
  requested_by?: {
174
177
  user_id?: string | undefined;
175
178
  username?: string | undefined;
package/dist/types.js CHANGED
@@ -88,6 +88,7 @@ exports.zodSourceSchema = zod_1.z.object({
88
88
  region_title: zod_1.z.string().optional(),
89
89
  group_id: zod_1.z.string().optional(),
90
90
  dominant_geos: zod_1.z.array(zod_1.z.string()).optional(),
91
+ mentions_in_discovery: zod_1.z.number().optional(),
91
92
  requested_by: zod_1.z
92
93
  .object({
93
94
  user_id: zod_1.z.string().optional(),
@@ -180,7 +181,15 @@ exports.websiteMetadataSchema = zod_1.z.object({
180
181
  });
181
182
  // Improved media schema with more types and optional dimensions
182
183
  exports.mediaItemSchema = zod_1.z.object({
183
- type: zod_1.z.enum(['image', 'video', 'audio', 'link', 'document', 'gif', 'sticker']),
184
+ type: zod_1.z.enum([
185
+ 'image',
186
+ 'video',
187
+ 'audio',
188
+ 'link',
189
+ 'document',
190
+ 'gif',
191
+ 'sticker',
192
+ ]),
184
193
  url: zod_1.z.string(),
185
194
  caption: zod_1.z.string().optional(),
186
195
  thumbnail_url: zod_1.z.string().optional(),
@@ -225,7 +234,8 @@ exports.zodDataSchema = zod_1.z.object({
225
234
  // Data/Post Identifiers
226
235
  data_id: zod_1.z.string().or(zod_1.z.number()).optional(),
227
236
  data_url: zod_1.z.string().url().optional(),
228
- data_original_type: zod_1.z.enum([
237
+ data_original_type: zod_1.z
238
+ .enum([
229
239
  'post',
230
240
  'comment',
231
241
  'reply',
@@ -237,14 +247,17 @@ exports.zodDataSchema = zod_1.z.object({
237
247
  'article',
238
248
  'link',
239
249
  'document',
240
- 'text'
241
- ]).optional(),
250
+ 'text',
251
+ ])
252
+ .optional(),
242
253
  // Content
243
254
  data_text: zod_1.z.string().optional(),
244
255
  data_language: zod_1.z.string().optional(),
245
256
  data_geo: zod_1.z.array(zod_1.z.string()).optional().default([]),
246
257
  // Analysis (populated by processors)
247
- data_sentiment: zod_1.z.enum(['positive', 'negative', 'neutral', 'mixed']).optional(),
258
+ data_sentiment: zod_1.z
259
+ .enum(['positive', 'negative', 'neutral', 'mixed'])
260
+ .optional(),
248
261
  data_topics: zod_1.z.array(zod_1.z.string()).optional(),
249
262
  data_keywords: zod_1.z.array(zod_1.z.string()).optional(),
250
263
  // Media attachments
@@ -261,13 +274,15 @@ exports.zodDataSchema = zod_1.z.object({
261
274
  replies: zod_1.z.any().optional(),
262
275
  replies_info: exports.repliesInfoSchema.optional(),
263
276
  // Engagement metrics (platform-specific)
264
- engagement: zod_1.z.object({
277
+ engagement: zod_1.z
278
+ .object({
265
279
  views: zod_1.z.number().optional(),
266
280
  likes: zod_1.z.number().optional(),
267
281
  shares: zod_1.z.number().optional(),
268
282
  comments: zod_1.z.number().optional(),
269
283
  reactions: zod_1.z.record(zod_1.z.string(), zod_1.z.number()).optional(), // e.g., { "like": 10, "love": 5 }
270
- }).optional(),
284
+ })
285
+ .optional(),
271
286
  // Content flags
272
287
  is_edited: zod_1.z.boolean().optional(),
273
288
  edit_date: zod_1.z.number().optional(),
@@ -280,15 +295,20 @@ exports.zodDataSchema = zod_1.z.object({
280
295
  hashtags: zod_1.z.array(zod_1.z.string()).optional().default([]),
281
296
  mentions: zod_1.z.array(zod_1.z.string()).optional().default([]),
282
297
  // Platform-specific metadata (flexible)
283
- metadata: zod_1.z.union([
298
+ metadata: zod_1.z
299
+ .union([
284
300
  exports.telegramMetadataSchema,
285
301
  exports.facebookMetadataSchema,
286
302
  exports.instagramMetadataSchema,
287
303
  exports.tiktokMetadataSchema,
288
304
  exports.websiteMetadataSchema,
289
305
  zod_1.z.record(zod_1.z.string(), zod_1.z.any()), // fallback for unknown platforms
290
- ]).optional(),
291
- processing_status: zod_1.z.enum(['raw', 'processed', 'error']).optional().default('raw'),
306
+ ])
307
+ .optional(),
308
+ processing_status: zod_1.z
309
+ .enum(['raw', 'processed', 'error'])
310
+ .optional()
311
+ .default('raw'),
292
312
  processing_errors: zod_1.z.string().optional(),
293
313
  });
294
314
  // Add validation refinement for platform-specific fields
@@ -299,6 +319,6 @@ exports.zodDataSchemaWithValidation = exports.zodDataSchema.refine((data) => {
299
319
  }
300
320
  return true;
301
321
  }, {
302
- message: "data_id is required for non-website platforms",
303
- path: ["data_id"],
322
+ message: 'data_id is required for non-website platforms',
323
+ path: ['data_id'],
304
324
  });
package/index.ts CHANGED
@@ -248,6 +248,7 @@ export const MongoSourceSchema = new Schema(
248
248
  region_title: { type: String }, // e.g., region title
249
249
  group_id: { type: String }, // e.g., source group ID
250
250
  dominant_geos: { type: [String], default: [] }, // e.g., dominant geos associated with this source
251
+ mentions_in_discovery: { type: Number, default: 0 }, // number of times this source was mentioned in discovery
251
252
  requested_by: {
252
253
  type: {
253
254
  user_id: { type: String },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harvester_sdk",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "SDK for interacting with the Harvester API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/types.ts CHANGED
@@ -94,6 +94,7 @@ export const zodSourceSchema = z.object({
94
94
  region_title: z.string().optional(), // e.g., region title
95
95
  group_id: z.string().optional(), // e.g., source group ID // INDEX
96
96
  dominant_geos: z.array(z.string()).optional(), // e.g., dominant geos associated with this source
97
+ mentions_in_discovery: z.number().optional(), // e.g., associated mentions or keywords
97
98
  requested_by: z
98
99
  .object({
99
100
  user_id: z.string().optional(),
@@ -194,7 +195,15 @@ export const websiteMetadataSchema = z.object({
194
195
 
195
196
  // Improved media schema with more types and optional dimensions
196
197
  export const mediaItemSchema = z.object({
197
- type: z.enum(['image', 'video', 'audio', 'link', 'document', 'gif', 'sticker']),
198
+ type: z.enum([
199
+ 'image',
200
+ 'video',
201
+ 'audio',
202
+ 'link',
203
+ 'document',
204
+ 'gif',
205
+ 'sticker',
206
+ ]),
198
207
  url: z.string(), // Can be a URL or file ID/path
199
208
  caption: z.string().optional(),
200
209
  thumbnail_url: z.string().optional(),
@@ -225,13 +234,13 @@ export const authorSchema = z.object({
225
234
 
226
235
  export const zodDataSchema = z.object({
227
236
  _id: z.string().optional(),
228
-
237
+
229
238
  // Timestamps
230
239
  timestamp: z.number().optional(), // INDEX - ingestion timestamp
231
240
  data_timestamp: z.number().optional(), // original post timestamp
232
- created_at: z.number(),
241
+ created_at: z.number(),
233
242
  updated_at: z.number(),
234
-
243
+
235
244
  // Platform & Source Info (denormalized for query performance)
236
245
  platform: z.enum(platformsList).optional(),
237
246
  source_id: z.string().or(z.number()), // INDEX - reference to Source _id
@@ -241,60 +250,66 @@ export const zodDataSchema = z.object({
241
250
  source_region_title: z.string().optional(),
242
251
  source_group_id: z.string().optional(), // INDEX
243
252
  source_dominant_geos: z.array(z.string()).optional().default([]),
244
-
253
+
245
254
  // Data/Post Identifiers
246
255
  data_id: z.string().or(z.number()).optional(), // INDEX - platform-specific post ID
247
256
  data_url: z.string().url().optional(), // direct link to the post
248
- data_original_type: z.enum([
249
- 'post',
250
- 'comment',
251
- 'reply',
252
- 'video',
253
- 'image',
254
- 'photo',
255
- 'story',
256
- 'reel',
257
- 'article',
258
- 'link',
259
- 'document',
260
- 'text'
261
- ]).optional(),
262
-
257
+ data_original_type: z
258
+ .enum([
259
+ 'post',
260
+ 'comment',
261
+ 'reply',
262
+ 'video',
263
+ 'image',
264
+ 'photo',
265
+ 'story',
266
+ 'reel',
267
+ 'article',
268
+ 'link',
269
+ 'document',
270
+ 'text',
271
+ ])
272
+ .optional(),
273
+
263
274
  // Content
264
275
  data_text: z.string().optional(),
265
276
  data_language: z.string().optional(), // ISO 639-1 code (e.g., 'en', 'ar')
266
277
  data_geo: z.array(z.string()).optional().default([]), // INDEX - extracted locations
267
-
278
+
268
279
  // Analysis (populated by processors)
269
- data_sentiment: z.enum(['positive', 'negative', 'neutral', 'mixed']).optional(),
280
+ data_sentiment: z
281
+ .enum(['positive', 'negative', 'neutral', 'mixed'])
282
+ .optional(),
270
283
  data_topics: z.array(z.string()).optional(), // extracted topics/themes
271
284
  data_keywords: z.array(z.string()).optional(), // extracted keywords
272
-
285
+
273
286
  // Media attachments
274
287
  media: z.array(mediaItemSchema).optional().default([]),
275
-
288
+
276
289
  // Author information
277
290
  author: z.string().optional(), // legacy field - display name
278
291
  author_username: z.string().optional(), // legacy field
279
292
  author_id: z.string().optional(), // legacy field
280
293
  author_info: authorSchema.optional(), // NEW - structured author info
281
-
294
+
282
295
  // Reply/Thread information
283
296
  is_reply: z.boolean().optional().default(false),
284
297
  reply_to_message_id: z.string().or(z.number()).optional(),
285
298
  reply_to_author_id: z.string().optional(),
286
299
  replies: z.any().optional(), // legacy field - keep for backward compatibility
287
300
  replies_info: repliesInfoSchema.optional(), // NEW - structured replies info
288
-
301
+
289
302
  // Engagement metrics (platform-specific)
290
- engagement: z.object({
291
- views: z.number().optional(),
292
- likes: z.number().optional(),
293
- shares: z.number().optional(),
294
- comments: z.number().optional(),
295
- reactions: z.record(z.string(), z.number()).optional(), // e.g., { "like": 10, "love": 5 }
296
- }).optional(),
297
-
303
+ engagement: z
304
+ .object({
305
+ views: z.number().optional(),
306
+ likes: z.number().optional(),
307
+ shares: z.number().optional(),
308
+ comments: z.number().optional(),
309
+ reactions: z.record(z.string(), z.number()).optional(), // e.g., { "like": 10, "love": 5 }
310
+ })
311
+ .optional(),
312
+
298
313
  // Content flags
299
314
  is_edited: z.boolean().optional(),
300
315
  edit_date: z.number().optional(),
@@ -303,25 +318,29 @@ export const zodDataSchema = z.object({
303
318
  is_forwarded: z.boolean().optional(),
304
319
  forwarded_from_id: z.string().optional(),
305
320
  forwarded_date: z.number().optional(),
306
-
321
+
307
322
  // Hashtags and mentions (extracted for easier querying)
308
323
  hashtags: z.array(z.string()).optional().default([]),
309
324
  mentions: z.array(z.string()).optional().default([]),
310
-
325
+
311
326
  // Platform-specific metadata (flexible)
312
- metadata: z.union([
313
- telegramMetadataSchema,
314
- facebookMetadataSchema,
315
- instagramMetadataSchema,
316
- tiktokMetadataSchema,
317
- websiteMetadataSchema,
318
- z.record(z.string(), z.any()), // fallback for unknown platforms
319
- ]).optional(),
320
-
321
- processing_status: z.enum(['raw', 'processed', 'error']).optional().default('raw'),
322
-
323
- processing_errors: z.string().optional(),
327
+ metadata: z
328
+ .union([
329
+ telegramMetadataSchema,
330
+ facebookMetadataSchema,
331
+ instagramMetadataSchema,
332
+ tiktokMetadataSchema,
333
+ websiteMetadataSchema,
334
+ z.record(z.string(), z.any()), // fallback for unknown platforms
335
+ ])
336
+ .optional(),
337
+
338
+ processing_status: z
339
+ .enum(['raw', 'processed', 'error'])
340
+ .optional()
341
+ .default('raw'),
324
342
 
343
+ processing_errors: z.string().optional(),
325
344
  });
326
345
 
327
346
  // Add validation refinement for platform-specific fields
@@ -334,8 +353,8 @@ export const zodDataSchemaWithValidation = zodDataSchema.refine(
334
353
  return true;
335
354
  },
336
355
  {
337
- message: "data_id is required for non-website platforms",
338
- path: ["data_id"],
356
+ message: 'data_id is required for non-website platforms',
357
+ path: ['data_id'],
339
358
  }
340
359
  );
341
360