harvester_sdk 1.0.16 → 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;
@@ -423,6 +424,8 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
423
424
  public_id?: any;
424
425
  url?: string | null | undefined;
425
426
  language?: string | null | undefined;
427
+ created_by?: string | null | undefined;
428
+ updated_by?: string | null | undefined;
426
429
  last_active_at?: number | null | undefined;
427
430
  region_title?: string | null | undefined;
428
431
  group_id?: string | null | undefined;
@@ -442,6 +445,7 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
442
445
  is_public: boolean;
443
446
  metadata: any;
444
447
  dominant_geos: string[];
448
+ mentions_in_discovery: number;
445
449
  priority: "low" | "medium" | "high" | "critical";
446
450
  notes?: string | null | undefined;
447
451
  description?: string | null | undefined;
@@ -451,6 +455,8 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
451
455
  public_id?: any;
452
456
  url?: string | null | undefined;
453
457
  language?: string | null | undefined;
458
+ created_by?: string | null | undefined;
459
+ updated_by?: string | null | undefined;
454
460
  last_active_at?: number | null | undefined;
455
461
  region_title?: string | null | undefined;
456
462
  group_id?: string | null | undefined;
@@ -470,6 +476,7 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
470
476
  is_public: boolean;
471
477
  metadata: any;
472
478
  dominant_geos: string[];
479
+ mentions_in_discovery: number;
473
480
  priority: "low" | "medium" | "high" | "critical";
474
481
  notes?: string | null | undefined;
475
482
  description?: string | null | undefined;
@@ -479,6 +486,8 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
479
486
  public_id?: any;
480
487
  url?: string | null | undefined;
481
488
  language?: string | null | undefined;
489
+ created_by?: string | null | undefined;
490
+ updated_by?: string | null | undefined;
482
491
  last_active_at?: number | null | undefined;
483
492
  region_title?: string | null | undefined;
484
493
  group_id?: string | null | undefined;
package/dist/index.js CHANGED
@@ -225,11 +225,14 @@ exports.MongoSourceSchema = new mongoose_1.Schema({
225
225
  metadata: { type: Object, default: {} },
226
226
  created_at: { type: Number, default: Date.now },
227
227
  updated_at: { type: Number, default: Date.now },
228
+ created_by: { type: String },
229
+ updated_by: { type: String },
228
230
  last_active_at: { type: Number },
229
231
  region_id: { type: String },
230
232
  region_title: { type: String },
231
233
  group_id: { type: String },
232
234
  dominant_geos: { type: [String], default: [] },
235
+ mentions_in_discovery: { type: Number, default: 0 },
233
236
  requested_by: {
234
237
  type: {
235
238
  user_id: { type: String },
package/dist/types.d.ts CHANGED
@@ -88,11 +88,14 @@ export declare const zodSourceSchema: z.ZodObject<{
88
88
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
89
89
  created_at: z.ZodOptional<z.ZodNumber>;
90
90
  updated_at: z.ZodOptional<z.ZodNumber>;
91
+ created_by: z.ZodOptional<z.ZodString>;
92
+ updated_by: z.ZodOptional<z.ZodString>;
91
93
  last_active_at: z.ZodOptional<z.ZodNumber>;
92
94
  region_id: z.ZodOptional<z.ZodString>;
93
95
  region_title: z.ZodOptional<z.ZodString>;
94
96
  group_id: z.ZodOptional<z.ZodString>;
95
97
  dominant_geos: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
98
+ mentions_in_discovery: z.ZodOptional<z.ZodNumber>;
96
99
  requested_by: z.ZodOptional<z.ZodObject<{
97
100
  user_id: z.ZodOptional<z.ZodString>;
98
101
  username: z.ZodOptional<z.ZodString>;
@@ -131,10 +134,13 @@ export declare const zodSourceSchema: z.ZodObject<{
131
134
  language?: string | undefined;
132
135
  tags?: string[] | undefined;
133
136
  metadata?: Record<string, any> | undefined;
137
+ created_by?: string | undefined;
138
+ updated_by?: string | undefined;
134
139
  last_active_at?: number | undefined;
135
140
  region_title?: string | undefined;
136
141
  group_id?: string | undefined;
137
142
  dominant_geos?: string[] | undefined;
143
+ mentions_in_discovery?: number | undefined;
138
144
  requested_by?: {
139
145
  user_id?: string | undefined;
140
146
  username?: string | undefined;
@@ -160,10 +166,13 @@ export declare const zodSourceSchema: z.ZodObject<{
160
166
  tags?: string[] | undefined;
161
167
  is_public?: boolean | undefined;
162
168
  metadata?: Record<string, any> | undefined;
169
+ created_by?: string | undefined;
170
+ updated_by?: string | undefined;
163
171
  last_active_at?: number | undefined;
164
172
  region_title?: string | undefined;
165
173
  group_id?: string | undefined;
166
174
  dominant_geos?: string[] | undefined;
175
+ mentions_in_discovery?: number | undefined;
167
176
  requested_by?: {
168
177
  user_id?: string | undefined;
169
178
  username?: string | undefined;
package/dist/types.js CHANGED
@@ -81,11 +81,14 @@ exports.zodSourceSchema = zod_1.z.object({
81
81
  metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
82
82
  created_at: zod_1.z.number().optional(),
83
83
  updated_at: zod_1.z.number().optional(),
84
+ created_by: zod_1.z.string().optional(),
85
+ updated_by: zod_1.z.string().optional(),
84
86
  last_active_at: zod_1.z.number().optional(),
85
87
  region_id: zod_1.z.string().optional(),
86
88
  region_title: zod_1.z.string().optional(),
87
89
  group_id: zod_1.z.string().optional(),
88
90
  dominant_geos: zod_1.z.array(zod_1.z.string()).optional(),
91
+ mentions_in_discovery: zod_1.z.number().optional(),
89
92
  requested_by: zod_1.z
90
93
  .object({
91
94
  user_id: zod_1.z.string().optional(),
@@ -178,7 +181,15 @@ exports.websiteMetadataSchema = zod_1.z.object({
178
181
  });
179
182
  // Improved media schema with more types and optional dimensions
180
183
  exports.mediaItemSchema = zod_1.z.object({
181
- 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
+ ]),
182
193
  url: zod_1.z.string(),
183
194
  caption: zod_1.z.string().optional(),
184
195
  thumbnail_url: zod_1.z.string().optional(),
@@ -223,7 +234,8 @@ exports.zodDataSchema = zod_1.z.object({
223
234
  // Data/Post Identifiers
224
235
  data_id: zod_1.z.string().or(zod_1.z.number()).optional(),
225
236
  data_url: zod_1.z.string().url().optional(),
226
- data_original_type: zod_1.z.enum([
237
+ data_original_type: zod_1.z
238
+ .enum([
227
239
  'post',
228
240
  'comment',
229
241
  'reply',
@@ -235,14 +247,17 @@ exports.zodDataSchema = zod_1.z.object({
235
247
  'article',
236
248
  'link',
237
249
  'document',
238
- 'text'
239
- ]).optional(),
250
+ 'text',
251
+ ])
252
+ .optional(),
240
253
  // Content
241
254
  data_text: zod_1.z.string().optional(),
242
255
  data_language: zod_1.z.string().optional(),
243
256
  data_geo: zod_1.z.array(zod_1.z.string()).optional().default([]),
244
257
  // Analysis (populated by processors)
245
- 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(),
246
261
  data_topics: zod_1.z.array(zod_1.z.string()).optional(),
247
262
  data_keywords: zod_1.z.array(zod_1.z.string()).optional(),
248
263
  // Media attachments
@@ -259,13 +274,15 @@ exports.zodDataSchema = zod_1.z.object({
259
274
  replies: zod_1.z.any().optional(),
260
275
  replies_info: exports.repliesInfoSchema.optional(),
261
276
  // Engagement metrics (platform-specific)
262
- engagement: zod_1.z.object({
277
+ engagement: zod_1.z
278
+ .object({
263
279
  views: zod_1.z.number().optional(),
264
280
  likes: zod_1.z.number().optional(),
265
281
  shares: zod_1.z.number().optional(),
266
282
  comments: zod_1.z.number().optional(),
267
283
  reactions: zod_1.z.record(zod_1.z.string(), zod_1.z.number()).optional(), // e.g., { "like": 10, "love": 5 }
268
- }).optional(),
284
+ })
285
+ .optional(),
269
286
  // Content flags
270
287
  is_edited: zod_1.z.boolean().optional(),
271
288
  edit_date: zod_1.z.number().optional(),
@@ -278,15 +295,20 @@ exports.zodDataSchema = zod_1.z.object({
278
295
  hashtags: zod_1.z.array(zod_1.z.string()).optional().default([]),
279
296
  mentions: zod_1.z.array(zod_1.z.string()).optional().default([]),
280
297
  // Platform-specific metadata (flexible)
281
- metadata: zod_1.z.union([
298
+ metadata: zod_1.z
299
+ .union([
282
300
  exports.telegramMetadataSchema,
283
301
  exports.facebookMetadataSchema,
284
302
  exports.instagramMetadataSchema,
285
303
  exports.tiktokMetadataSchema,
286
304
  exports.websiteMetadataSchema,
287
305
  zod_1.z.record(zod_1.z.string(), zod_1.z.any()), // fallback for unknown platforms
288
- ]).optional(),
289
- 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'),
290
312
  processing_errors: zod_1.z.string().optional(),
291
313
  });
292
314
  // Add validation refinement for platform-specific fields
@@ -297,6 +319,6 @@ exports.zodDataSchemaWithValidation = exports.zodDataSchema.refine((data) => {
297
319
  }
298
320
  return true;
299
321
  }, {
300
- message: "data_id is required for non-website platforms",
301
- path: ["data_id"],
322
+ message: 'data_id is required for non-website platforms',
323
+ path: ['data_id'],
302
324
  });
package/index.ts CHANGED
@@ -241,11 +241,14 @@ export const MongoSourceSchema = new Schema(
241
241
  metadata: { type: Object, default: {} }, // flexible per platform
242
242
  created_at: { type: Number, default: Date.now },
243
243
  updated_at: { type: Number, default: Date.now },
244
+ created_by: { type: String },
245
+ updated_by: { type: String },
244
246
  last_active_at: { type: Number }, // last time data was collected from this source
245
247
  region_id: { type: String }, // e.g., region ID
246
248
  region_title: { type: String }, // e.g., region title
247
249
  group_id: { type: String }, // e.g., source group ID
248
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
249
252
  requested_by: {
250
253
  type: {
251
254
  user_id: { type: String },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harvester_sdk",
3
- "version": "1.0.16",
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
@@ -87,11 +87,14 @@ export const zodSourceSchema = z.object({
87
87
  metadata: z.record(z.string(), z.any()).optional(), // flexible per platform
88
88
  created_at: z.number().optional(),
89
89
  updated_at: z.number().optional(),
90
+ created_by: z.string().optional(),
91
+ updated_by: z.string().optional(),
90
92
  last_active_at: z.number().optional(), // last time data was collected from this source
91
93
  region_id: z.string().optional(), // e.g., region ID // INDEX
92
94
  region_title: z.string().optional(), // e.g., region title
93
95
  group_id: z.string().optional(), // e.g., source group ID // INDEX
94
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
95
98
  requested_by: z
96
99
  .object({
97
100
  user_id: z.string().optional(),
@@ -192,7 +195,15 @@ export const websiteMetadataSchema = z.object({
192
195
 
193
196
  // Improved media schema with more types and optional dimensions
194
197
  export const mediaItemSchema = z.object({
195
- 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
+ ]),
196
207
  url: z.string(), // Can be a URL or file ID/path
197
208
  caption: z.string().optional(),
198
209
  thumbnail_url: z.string().optional(),
@@ -223,13 +234,13 @@ export const authorSchema = z.object({
223
234
 
224
235
  export const zodDataSchema = z.object({
225
236
  _id: z.string().optional(),
226
-
237
+
227
238
  // Timestamps
228
239
  timestamp: z.number().optional(), // INDEX - ingestion timestamp
229
240
  data_timestamp: z.number().optional(), // original post timestamp
230
- created_at: z.number(),
241
+ created_at: z.number(),
231
242
  updated_at: z.number(),
232
-
243
+
233
244
  // Platform & Source Info (denormalized for query performance)
234
245
  platform: z.enum(platformsList).optional(),
235
246
  source_id: z.string().or(z.number()), // INDEX - reference to Source _id
@@ -239,60 +250,66 @@ export const zodDataSchema = z.object({
239
250
  source_region_title: z.string().optional(),
240
251
  source_group_id: z.string().optional(), // INDEX
241
252
  source_dominant_geos: z.array(z.string()).optional().default([]),
242
-
253
+
243
254
  // Data/Post Identifiers
244
255
  data_id: z.string().or(z.number()).optional(), // INDEX - platform-specific post ID
245
256
  data_url: z.string().url().optional(), // direct link to the post
246
- data_original_type: z.enum([
247
- 'post',
248
- 'comment',
249
- 'reply',
250
- 'video',
251
- 'image',
252
- 'photo',
253
- 'story',
254
- 'reel',
255
- 'article',
256
- 'link',
257
- 'document',
258
- 'text'
259
- ]).optional(),
260
-
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
+
261
274
  // Content
262
275
  data_text: z.string().optional(),
263
276
  data_language: z.string().optional(), // ISO 639-1 code (e.g., 'en', 'ar')
264
277
  data_geo: z.array(z.string()).optional().default([]), // INDEX - extracted locations
265
-
278
+
266
279
  // Analysis (populated by processors)
267
- data_sentiment: z.enum(['positive', 'negative', 'neutral', 'mixed']).optional(),
280
+ data_sentiment: z
281
+ .enum(['positive', 'negative', 'neutral', 'mixed'])
282
+ .optional(),
268
283
  data_topics: z.array(z.string()).optional(), // extracted topics/themes
269
284
  data_keywords: z.array(z.string()).optional(), // extracted keywords
270
-
285
+
271
286
  // Media attachments
272
287
  media: z.array(mediaItemSchema).optional().default([]),
273
-
288
+
274
289
  // Author information
275
290
  author: z.string().optional(), // legacy field - display name
276
291
  author_username: z.string().optional(), // legacy field
277
292
  author_id: z.string().optional(), // legacy field
278
293
  author_info: authorSchema.optional(), // NEW - structured author info
279
-
294
+
280
295
  // Reply/Thread information
281
296
  is_reply: z.boolean().optional().default(false),
282
297
  reply_to_message_id: z.string().or(z.number()).optional(),
283
298
  reply_to_author_id: z.string().optional(),
284
299
  replies: z.any().optional(), // legacy field - keep for backward compatibility
285
300
  replies_info: repliesInfoSchema.optional(), // NEW - structured replies info
286
-
301
+
287
302
  // Engagement metrics (platform-specific)
288
- engagement: z.object({
289
- views: z.number().optional(),
290
- likes: z.number().optional(),
291
- shares: z.number().optional(),
292
- comments: z.number().optional(),
293
- reactions: z.record(z.string(), z.number()).optional(), // e.g., { "like": 10, "love": 5 }
294
- }).optional(),
295
-
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
+
296
313
  // Content flags
297
314
  is_edited: z.boolean().optional(),
298
315
  edit_date: z.number().optional(),
@@ -301,25 +318,29 @@ export const zodDataSchema = z.object({
301
318
  is_forwarded: z.boolean().optional(),
302
319
  forwarded_from_id: z.string().optional(),
303
320
  forwarded_date: z.number().optional(),
304
-
321
+
305
322
  // Hashtags and mentions (extracted for easier querying)
306
323
  hashtags: z.array(z.string()).optional().default([]),
307
324
  mentions: z.array(z.string()).optional().default([]),
308
-
325
+
309
326
  // Platform-specific metadata (flexible)
310
- metadata: z.union([
311
- telegramMetadataSchema,
312
- facebookMetadataSchema,
313
- instagramMetadataSchema,
314
- tiktokMetadataSchema,
315
- websiteMetadataSchema,
316
- z.record(z.string(), z.any()), // fallback for unknown platforms
317
- ]).optional(),
318
-
319
- processing_status: z.enum(['raw', 'processed', 'error']).optional().default('raw'),
320
-
321
- 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'),
322
342
 
343
+ processing_errors: z.string().optional(),
323
344
  });
324
345
 
325
346
  // Add validation refinement for platform-specific fields
@@ -332,8 +353,8 @@ export const zodDataSchemaWithValidation = zodDataSchema.refine(
332
353
  return true;
333
354
  },
334
355
  {
335
- message: "data_id is required for non-website platforms",
336
- path: ["data_id"],
356
+ message: 'data_id is required for non-website platforms',
357
+ path: ['data_id'],
337
358
  }
338
359
  );
339
360