harvester_sdk 1.0.6 → 1.0.8
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 +54 -232
- package/dist/index.js +22 -102
- package/dist/types.d.ts +54 -49
- package/dist/types.js +24 -16
- package/index.ts +24 -122
- package/package.json +1 -1
- package/types.ts +32 -31
package/dist/index.d.ts
CHANGED
|
@@ -36,11 +36,9 @@ export declare const MongoDataSchema: Schema<any, import("mongoose").Model<any,
|
|
|
36
36
|
}, {
|
|
37
37
|
created_at: number;
|
|
38
38
|
updated_at: number;
|
|
39
|
-
|
|
40
|
-
timestamp: number;
|
|
41
|
-
text_geo: string[];
|
|
39
|
+
source_dominant_geos: string[];
|
|
42
40
|
source_id: any;
|
|
43
|
-
|
|
41
|
+
data_geo: string[];
|
|
44
42
|
media: import("mongoose").Types.DocumentArray<{
|
|
45
43
|
type?: "image" | "video" | "audio" | "link" | null | undefined;
|
|
46
44
|
url?: string | null | undefined;
|
|
@@ -54,31 +52,33 @@ export declare const MongoDataSchema: Schema<any, import("mongoose").Model<any,
|
|
|
54
52
|
url?: string | null | undefined;
|
|
55
53
|
caption?: string | null | undefined;
|
|
56
54
|
}>;
|
|
57
|
-
|
|
55
|
+
platform?: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | null | undefined;
|
|
58
56
|
metadata?: any;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
timestamp?: number | null | undefined;
|
|
58
|
+
source_region_id?: string | null | undefined;
|
|
59
|
+
source_region_title?: string | null | undefined;
|
|
60
|
+
source_title?: string | null | undefined;
|
|
61
|
+
source_url?: string | null | undefined;
|
|
62
|
+
source_group_id?: string | null | undefined;
|
|
63
|
+
data_id?: any;
|
|
64
|
+
data_text?: string | null | undefined;
|
|
65
|
+
data_url?: string | null | undefined;
|
|
66
|
+
data_original_type?: string | null | undefined;
|
|
67
|
+
data_language?: string | null | undefined;
|
|
68
|
+
data_sentiment?: string | null | undefined;
|
|
69
|
+
data_timestamp?: number | null | undefined;
|
|
65
70
|
is_reply?: boolean | null | undefined;
|
|
66
71
|
reply_to_message_id?: any;
|
|
67
72
|
author?: string | null | undefined;
|
|
68
|
-
replies?: any;
|
|
69
|
-
entities?: any;
|
|
70
73
|
author_username?: string | null | undefined;
|
|
74
|
+
replies?: any;
|
|
71
75
|
author_id?: string | null | undefined;
|
|
72
|
-
source_geo?: string | null | undefined;
|
|
73
|
-
pipeline_name?: string | null | undefined;
|
|
74
76
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
75
77
|
created_at: number;
|
|
76
78
|
updated_at: number;
|
|
77
|
-
|
|
78
|
-
timestamp: number;
|
|
79
|
-
text_geo: string[];
|
|
79
|
+
source_dominant_geos: string[];
|
|
80
80
|
source_id: any;
|
|
81
|
-
|
|
81
|
+
data_geo: string[];
|
|
82
82
|
media: import("mongoose").Types.DocumentArray<{
|
|
83
83
|
type?: "image" | "video" | "audio" | "link" | null | undefined;
|
|
84
84
|
url?: string | null | undefined;
|
|
@@ -92,31 +92,33 @@ export declare const MongoDataSchema: Schema<any, import("mongoose").Model<any,
|
|
|
92
92
|
url?: string | null | undefined;
|
|
93
93
|
caption?: string | null | undefined;
|
|
94
94
|
}>;
|
|
95
|
-
|
|
95
|
+
platform?: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | null | undefined;
|
|
96
96
|
metadata?: any;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
timestamp?: number | null | undefined;
|
|
98
|
+
source_region_id?: string | null | undefined;
|
|
99
|
+
source_region_title?: string | null | undefined;
|
|
100
|
+
source_title?: string | null | undefined;
|
|
101
|
+
source_url?: string | null | undefined;
|
|
102
|
+
source_group_id?: string | null | undefined;
|
|
103
|
+
data_id?: any;
|
|
104
|
+
data_text?: string | null | undefined;
|
|
105
|
+
data_url?: string | null | undefined;
|
|
106
|
+
data_original_type?: string | null | undefined;
|
|
107
|
+
data_language?: string | null | undefined;
|
|
108
|
+
data_sentiment?: string | null | undefined;
|
|
109
|
+
data_timestamp?: number | null | undefined;
|
|
103
110
|
is_reply?: boolean | null | undefined;
|
|
104
111
|
reply_to_message_id?: any;
|
|
105
112
|
author?: string | null | undefined;
|
|
106
|
-
replies?: any;
|
|
107
|
-
entities?: any;
|
|
108
113
|
author_username?: string | null | undefined;
|
|
114
|
+
replies?: any;
|
|
109
115
|
author_id?: string | null | undefined;
|
|
110
|
-
source_geo?: string | null | undefined;
|
|
111
|
-
pipeline_name?: string | null | undefined;
|
|
112
116
|
}>, {}> & import("mongoose").FlatRecord<{
|
|
113
117
|
created_at: number;
|
|
114
118
|
updated_at: number;
|
|
115
|
-
|
|
116
|
-
timestamp: number;
|
|
117
|
-
text_geo: string[];
|
|
119
|
+
source_dominant_geos: string[];
|
|
118
120
|
source_id: any;
|
|
119
|
-
|
|
121
|
+
data_geo: string[];
|
|
120
122
|
media: import("mongoose").Types.DocumentArray<{
|
|
121
123
|
type?: "image" | "video" | "audio" | "link" | null | undefined;
|
|
122
124
|
url?: string | null | undefined;
|
|
@@ -130,23 +132,27 @@ export declare const MongoDataSchema: Schema<any, import("mongoose").Model<any,
|
|
|
130
132
|
url?: string | null | undefined;
|
|
131
133
|
caption?: string | null | undefined;
|
|
132
134
|
}>;
|
|
133
|
-
|
|
135
|
+
platform?: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | null | undefined;
|
|
134
136
|
metadata?: any;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
timestamp?: number | null | undefined;
|
|
138
|
+
source_region_id?: string | null | undefined;
|
|
139
|
+
source_region_title?: string | null | undefined;
|
|
140
|
+
source_title?: string | null | undefined;
|
|
141
|
+
source_url?: string | null | undefined;
|
|
142
|
+
source_group_id?: string | null | undefined;
|
|
143
|
+
data_id?: any;
|
|
144
|
+
data_text?: string | null | undefined;
|
|
145
|
+
data_url?: string | null | undefined;
|
|
146
|
+
data_original_type?: string | null | undefined;
|
|
147
|
+
data_language?: string | null | undefined;
|
|
148
|
+
data_sentiment?: string | null | undefined;
|
|
149
|
+
data_timestamp?: number | null | undefined;
|
|
141
150
|
is_reply?: boolean | null | undefined;
|
|
142
151
|
reply_to_message_id?: any;
|
|
143
152
|
author?: string | null | undefined;
|
|
144
|
-
replies?: any;
|
|
145
|
-
entities?: any;
|
|
146
153
|
author_username?: string | null | undefined;
|
|
154
|
+
replies?: any;
|
|
147
155
|
author_id?: string | null | undefined;
|
|
148
|
-
source_geo?: string | null | undefined;
|
|
149
|
-
pipeline_name?: string | null | undefined;
|
|
150
156
|
}> & {
|
|
151
157
|
_id: import("mongoose").Types.ObjectId;
|
|
152
158
|
} & {
|
|
@@ -257,6 +263,7 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
|
|
|
257
263
|
public_id?: any;
|
|
258
264
|
url?: string | null | undefined;
|
|
259
265
|
language?: string | null | undefined;
|
|
266
|
+
region_title?: string | null | undefined;
|
|
260
267
|
group_id?: string | null | undefined;
|
|
261
268
|
requested_by?: {
|
|
262
269
|
user_id?: string | null | undefined;
|
|
@@ -282,6 +289,7 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
|
|
|
282
289
|
public_id?: any;
|
|
283
290
|
url?: string | null | undefined;
|
|
284
291
|
language?: string | null | undefined;
|
|
292
|
+
region_title?: string | null | undefined;
|
|
285
293
|
group_id?: string | null | undefined;
|
|
286
294
|
requested_by?: {
|
|
287
295
|
user_id?: string | null | undefined;
|
|
@@ -307,6 +315,7 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
|
|
|
307
315
|
public_id?: any;
|
|
308
316
|
url?: string | null | undefined;
|
|
309
317
|
language?: string | null | undefined;
|
|
318
|
+
region_title?: string | null | undefined;
|
|
310
319
|
group_id?: string | null | undefined;
|
|
311
320
|
requested_by?: {
|
|
312
321
|
user_id?: string | null | undefined;
|
|
@@ -320,193 +329,6 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
|
|
|
320
329
|
} & {
|
|
321
330
|
__v: number;
|
|
322
331
|
}>;
|
|
323
|
-
export declare const MongoQuerySchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
324
|
-
versionKey: false;
|
|
325
|
-
toJSON: {
|
|
326
|
-
virtuals: true;
|
|
327
|
-
};
|
|
328
|
-
toObject: {
|
|
329
|
-
virtuals: true;
|
|
330
|
-
};
|
|
331
|
-
}, {
|
|
332
|
-
user_id: string;
|
|
333
|
-
timestamp: number;
|
|
334
|
-
geos: string[];
|
|
335
|
-
sources: string[];
|
|
336
|
-
geos_ids: string[];
|
|
337
|
-
time_range: any;
|
|
338
|
-
title?: string | null | undefined;
|
|
339
|
-
query?: string | null | undefined;
|
|
340
|
-
user_instructions?: string | null | undefined;
|
|
341
|
-
user_time_zone?: string | null | undefined;
|
|
342
|
-
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
343
|
-
user_id: string;
|
|
344
|
-
timestamp: number;
|
|
345
|
-
geos: string[];
|
|
346
|
-
sources: string[];
|
|
347
|
-
geos_ids: string[];
|
|
348
|
-
time_range: any;
|
|
349
|
-
title?: string | null | undefined;
|
|
350
|
-
query?: string | null | undefined;
|
|
351
|
-
user_instructions?: string | null | undefined;
|
|
352
|
-
user_time_zone?: string | null | undefined;
|
|
353
|
-
}>, {}> & import("mongoose").FlatRecord<{
|
|
354
|
-
user_id: string;
|
|
355
|
-
timestamp: number;
|
|
356
|
-
geos: string[];
|
|
357
|
-
sources: string[];
|
|
358
|
-
geos_ids: string[];
|
|
359
|
-
time_range: any;
|
|
360
|
-
title?: string | null | undefined;
|
|
361
|
-
query?: string | null | undefined;
|
|
362
|
-
user_instructions?: string | null | undefined;
|
|
363
|
-
user_time_zone?: string | null | undefined;
|
|
364
|
-
}> & {
|
|
365
|
-
_id: import("mongoose").Types.ObjectId;
|
|
366
|
-
} & {
|
|
367
|
-
__v: number;
|
|
368
|
-
}>;
|
|
369
|
-
export declare const MongoUserSettingsSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
370
|
-
versionKey: false;
|
|
371
|
-
toJSON: {
|
|
372
|
-
virtuals: true;
|
|
373
|
-
};
|
|
374
|
-
toObject: {
|
|
375
|
-
virtuals: true;
|
|
376
|
-
};
|
|
377
|
-
}, {
|
|
378
|
-
created_at: NativeDate;
|
|
379
|
-
updated_at: NativeDate;
|
|
380
|
-
status: "active" | "inactive" | "deleted";
|
|
381
|
-
user_id: string;
|
|
382
|
-
geos: string[];
|
|
383
|
-
sources: string[];
|
|
384
|
-
has_jobs_access: boolean;
|
|
385
|
-
active_jobs_limit: number;
|
|
386
|
-
time_range?: any;
|
|
387
|
-
thread_id?: string | null | undefined;
|
|
388
|
-
instructions?: string | null | undefined;
|
|
389
|
-
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
390
|
-
created_at: NativeDate;
|
|
391
|
-
updated_at: NativeDate;
|
|
392
|
-
status: "active" | "inactive" | "deleted";
|
|
393
|
-
user_id: string;
|
|
394
|
-
geos: string[];
|
|
395
|
-
sources: string[];
|
|
396
|
-
has_jobs_access: boolean;
|
|
397
|
-
active_jobs_limit: number;
|
|
398
|
-
time_range?: any;
|
|
399
|
-
thread_id?: string | null | undefined;
|
|
400
|
-
instructions?: string | null | undefined;
|
|
401
|
-
}>, {}> & import("mongoose").FlatRecord<{
|
|
402
|
-
created_at: NativeDate;
|
|
403
|
-
updated_at: NativeDate;
|
|
404
|
-
status: "active" | "inactive" | "deleted";
|
|
405
|
-
user_id: string;
|
|
406
|
-
geos: string[];
|
|
407
|
-
sources: string[];
|
|
408
|
-
has_jobs_access: boolean;
|
|
409
|
-
active_jobs_limit: number;
|
|
410
|
-
time_range?: any;
|
|
411
|
-
thread_id?: string | null | undefined;
|
|
412
|
-
instructions?: string | null | undefined;
|
|
413
|
-
}> & {
|
|
414
|
-
_id: import("mongoose").Types.ObjectId;
|
|
415
|
-
} & {
|
|
416
|
-
__v: number;
|
|
417
|
-
}>;
|
|
418
|
-
export declare const MongoConversationSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
419
|
-
versionKey: false;
|
|
420
|
-
toJSON: {
|
|
421
|
-
virtuals: true;
|
|
422
|
-
};
|
|
423
|
-
toObject: {
|
|
424
|
-
virtuals: true;
|
|
425
|
-
};
|
|
426
|
-
}, {
|
|
427
|
-
created_at: NativeDate;
|
|
428
|
-
updated_at: NativeDate;
|
|
429
|
-
status: "active" | "inactive" | "deleted";
|
|
430
|
-
user_id: string;
|
|
431
|
-
is_job: boolean;
|
|
432
|
-
title?: string | null | undefined;
|
|
433
|
-
thread_id?: string | null | undefined;
|
|
434
|
-
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
435
|
-
created_at: NativeDate;
|
|
436
|
-
updated_at: NativeDate;
|
|
437
|
-
status: "active" | "inactive" | "deleted";
|
|
438
|
-
user_id: string;
|
|
439
|
-
is_job: boolean;
|
|
440
|
-
title?: string | null | undefined;
|
|
441
|
-
thread_id?: string | null | undefined;
|
|
442
|
-
}>, {}> & import("mongoose").FlatRecord<{
|
|
443
|
-
created_at: NativeDate;
|
|
444
|
-
updated_at: NativeDate;
|
|
445
|
-
status: "active" | "inactive" | "deleted";
|
|
446
|
-
user_id: string;
|
|
447
|
-
is_job: boolean;
|
|
448
|
-
title?: string | null | undefined;
|
|
449
|
-
thread_id?: string | null | undefined;
|
|
450
|
-
}> & {
|
|
451
|
-
_id: import("mongoose").Types.ObjectId;
|
|
452
|
-
} & {
|
|
453
|
-
__v: number;
|
|
454
|
-
}>;
|
|
455
|
-
export declare const MongoJobSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
456
|
-
versionKey: false;
|
|
457
|
-
toJSON: {
|
|
458
|
-
virtuals: true;
|
|
459
|
-
};
|
|
460
|
-
toObject: {
|
|
461
|
-
virtuals: true;
|
|
462
|
-
};
|
|
463
|
-
}, {
|
|
464
|
-
created_at: number;
|
|
465
|
-
updated_at: number;
|
|
466
|
-
status: "active" | "inactive" | "deleted";
|
|
467
|
-
user_id: string;
|
|
468
|
-
query: any;
|
|
469
|
-
job_name: string;
|
|
470
|
-
thread_id?: string | null | undefined;
|
|
471
|
-
job_description?: string | null | undefined;
|
|
472
|
-
schedule?: string | null | undefined;
|
|
473
|
-
schedule_text?: string | null | undefined;
|
|
474
|
-
active_until?: number | null | undefined;
|
|
475
|
-
conversation_id?: string | null | undefined;
|
|
476
|
-
time_zone?: string | null | undefined;
|
|
477
|
-
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
478
|
-
created_at: number;
|
|
479
|
-
updated_at: number;
|
|
480
|
-
status: "active" | "inactive" | "deleted";
|
|
481
|
-
user_id: string;
|
|
482
|
-
query: any;
|
|
483
|
-
job_name: string;
|
|
484
|
-
thread_id?: string | null | undefined;
|
|
485
|
-
job_description?: string | null | undefined;
|
|
486
|
-
schedule?: string | null | undefined;
|
|
487
|
-
schedule_text?: string | null | undefined;
|
|
488
|
-
active_until?: number | null | undefined;
|
|
489
|
-
conversation_id?: string | null | undefined;
|
|
490
|
-
time_zone?: string | null | undefined;
|
|
491
|
-
}>, {}> & import("mongoose").FlatRecord<{
|
|
492
|
-
created_at: number;
|
|
493
|
-
updated_at: number;
|
|
494
|
-
status: "active" | "inactive" | "deleted";
|
|
495
|
-
user_id: string;
|
|
496
|
-
query: any;
|
|
497
|
-
job_name: string;
|
|
498
|
-
thread_id?: string | null | undefined;
|
|
499
|
-
job_description?: string | null | undefined;
|
|
500
|
-
schedule?: string | null | undefined;
|
|
501
|
-
schedule_text?: string | null | undefined;
|
|
502
|
-
active_until?: number | null | undefined;
|
|
503
|
-
conversation_id?: string | null | undefined;
|
|
504
|
-
time_zone?: string | null | undefined;
|
|
505
|
-
}> & {
|
|
506
|
-
_id: import("mongoose").Types.ObjectId;
|
|
507
|
-
} & {
|
|
508
|
-
__v: number;
|
|
509
|
-
}>;
|
|
510
332
|
export declare const MongoGeoSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
511
333
|
versionKey: false;
|
|
512
334
|
toJSON: {
|
package/dist/index.js
CHANGED
|
@@ -14,33 +14,37 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.MongoApiKeySchema = exports.MongoGeoSelectionSchema = exports.MongoGeoSchema = exports.
|
|
17
|
+
exports.MongoApiKeySchema = exports.MongoGeoSelectionSchema = exports.MongoGeoSchema = exports.MongoSourceSchema = exports.MongoSourceGroupSchema = exports.MongoRegionSchema = exports.MongoDataSchema = void 0;
|
|
18
18
|
// Export types for consumers
|
|
19
19
|
__exportStar(require("./types"), exports);
|
|
20
20
|
const mongoose_1 = require("mongoose");
|
|
21
21
|
const types_1 = require("./types");
|
|
22
22
|
exports.MongoDataSchema = new mongoose_1.Schema({
|
|
23
|
-
|
|
24
|
-
source_public_id: { type: mongoose_1.Schema.Types.Mixed },
|
|
25
|
-
source_name: { type: String, required: true },
|
|
26
|
-
platform_id: { type: mongoose_1.Schema.Types.Mixed },
|
|
23
|
+
timestamp: { type: Number },
|
|
27
24
|
platform: {
|
|
28
25
|
type: String,
|
|
29
26
|
enum: types_1.platformsList,
|
|
30
|
-
required: true,
|
|
31
27
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
source_region_id: { type: String },
|
|
29
|
+
source_region_title: { type: String },
|
|
30
|
+
source_dominant_geos: { type: [String], default: [] },
|
|
31
|
+
source_id: { type: mongoose_1.Schema.Types.Mixed, required: true },
|
|
32
|
+
source_title: { type: String },
|
|
33
|
+
source_url: { type: String },
|
|
34
|
+
source_group_id: { type: String },
|
|
35
|
+
data_id: { type: mongoose_1.Schema.Types.Mixed },
|
|
36
|
+
data_geo: { type: [String], default: [] },
|
|
37
|
+
data_text: { type: String },
|
|
38
|
+
data_url: { type: String },
|
|
39
|
+
data_original_type: { type: String },
|
|
40
|
+
data_language: { type: String },
|
|
41
|
+
data_sentiment: { type: String },
|
|
42
|
+
data_timestamp: { type: Number },
|
|
39
43
|
is_reply: { type: Boolean },
|
|
40
44
|
reply_to_message_id: { type: mongoose_1.Schema.Types.Mixed },
|
|
41
45
|
metadata: { type: Object },
|
|
42
|
-
created_at: { type: Number, default: Date.now },
|
|
43
|
-
updated_at: { type: Number, default: Date.now },
|
|
46
|
+
created_at: { type: Number, default: Date.now, required: true },
|
|
47
|
+
updated_at: { type: Number, default: Date.now, required: true },
|
|
44
48
|
media: {
|
|
45
49
|
type: [
|
|
46
50
|
{
|
|
@@ -51,12 +55,9 @@ exports.MongoDataSchema = new mongoose_1.Schema({
|
|
|
51
55
|
],
|
|
52
56
|
},
|
|
53
57
|
author: { type: String },
|
|
54
|
-
replies: { type: mongoose_1.Schema.Types.Mixed },
|
|
55
|
-
entities: { type: mongoose_1.Schema.Types.Mixed },
|
|
56
58
|
author_username: { type: String },
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
source_region: { type: String }, // e.g., "New York", "California"
|
|
59
|
+
replies: { type: mongoose_1.Schema.Types.Mixed },
|
|
60
|
+
author_id: { type: String }, // e.g., author ID
|
|
60
61
|
}, {
|
|
61
62
|
versionKey: false,
|
|
62
63
|
toJSON: { virtuals: true },
|
|
@@ -129,6 +130,7 @@ exports.MongoSourceSchema = new mongoose_1.Schema({
|
|
|
129
130
|
created_at: { type: Number, default: Date.now },
|
|
130
131
|
updated_at: { type: Number, default: Date.now },
|
|
131
132
|
region_id: { type: String },
|
|
133
|
+
region_title: { type: String },
|
|
132
134
|
group_id: { type: String },
|
|
133
135
|
dominant_geos: { type: [String], default: [] },
|
|
134
136
|
requested_by: {
|
|
@@ -147,88 +149,6 @@ exports.MongoSourceSchema = new mongoose_1.Schema({
|
|
|
147
149
|
toJSON: { virtuals: true },
|
|
148
150
|
toObject: { virtuals: true },
|
|
149
151
|
});
|
|
150
|
-
exports.MongoQuerySchema = new mongoose_1.Schema({
|
|
151
|
-
title: { type: String },
|
|
152
|
-
query: { type: String },
|
|
153
|
-
sources: { type: [String] },
|
|
154
|
-
geos: { type: [String], required: true },
|
|
155
|
-
geos_ids: { type: [String], required: true },
|
|
156
|
-
time_range: {
|
|
157
|
-
type: mongoose_1.Schema.Types.Mixed,
|
|
158
|
-
required: true,
|
|
159
|
-
},
|
|
160
|
-
user_id: { type: String, required: true },
|
|
161
|
-
user_instructions: { type: String },
|
|
162
|
-
user_time_zone: { type: String },
|
|
163
|
-
timestamp: { type: Number, default: Date.now }, // creation date
|
|
164
|
-
}, {
|
|
165
|
-
versionKey: false,
|
|
166
|
-
toJSON: { virtuals: true },
|
|
167
|
-
toObject: { virtuals: true },
|
|
168
|
-
});
|
|
169
|
-
exports.MongoUserSettingsSchema = new mongoose_1.Schema({
|
|
170
|
-
sources: { type: [String] },
|
|
171
|
-
geos: { type: [String], default: [] },
|
|
172
|
-
time_range: {
|
|
173
|
-
type: mongoose_1.Schema.Types.Mixed,
|
|
174
|
-
},
|
|
175
|
-
user_id: { type: String, required: true },
|
|
176
|
-
thread_id: { type: String },
|
|
177
|
-
instructions: { type: String },
|
|
178
|
-
has_jobs_access: { type: Boolean, default: false },
|
|
179
|
-
active_jobs_limit: { type: Number, default: 5 },
|
|
180
|
-
created_at: { type: Date, default: Date.now },
|
|
181
|
-
updated_at: { type: Date, default: Date.now },
|
|
182
|
-
status: {
|
|
183
|
-
type: String,
|
|
184
|
-
enum: types_1.generalStatusList,
|
|
185
|
-
default: 'active',
|
|
186
|
-
}, // status of the user
|
|
187
|
-
}, {
|
|
188
|
-
versionKey: false,
|
|
189
|
-
toJSON: { virtuals: true },
|
|
190
|
-
toObject: { virtuals: true },
|
|
191
|
-
});
|
|
192
|
-
exports.MongoConversationSchema = new mongoose_1.Schema({
|
|
193
|
-
user_id: { type: String, required: true },
|
|
194
|
-
title: { type: String },
|
|
195
|
-
thread_id: { type: String },
|
|
196
|
-
status: {
|
|
197
|
-
type: String,
|
|
198
|
-
enum: types_1.generalStatusList,
|
|
199
|
-
default: 'active',
|
|
200
|
-
},
|
|
201
|
-
created_at: { type: Date, default: Date.now },
|
|
202
|
-
updated_at: { type: Date, default: Date.now },
|
|
203
|
-
is_job: { type: Boolean, default: false }, // true if this is a job conversation
|
|
204
|
-
}, {
|
|
205
|
-
versionKey: false,
|
|
206
|
-
toJSON: { virtuals: true },
|
|
207
|
-
toObject: { virtuals: true },
|
|
208
|
-
});
|
|
209
|
-
exports.MongoJobSchema = new mongoose_1.Schema({
|
|
210
|
-
user_id: { type: String, required: true },
|
|
211
|
-
job_name: { type: String, required: true },
|
|
212
|
-
job_description: { type: String },
|
|
213
|
-
status: {
|
|
214
|
-
type: String,
|
|
215
|
-
enum: types_1.generalStatusList,
|
|
216
|
-
default: 'active',
|
|
217
|
-
},
|
|
218
|
-
created_at: { type: Number, default: Date.now },
|
|
219
|
-
updated_at: { type: Number, default: Date.now },
|
|
220
|
-
schedule: { type: String },
|
|
221
|
-
schedule_text: { type: String },
|
|
222
|
-
active_until: { type: Number || undefined },
|
|
223
|
-
query: { type: mongoose_1.Schema.Types.Mixed, required: true },
|
|
224
|
-
conversation_id: { type: String },
|
|
225
|
-
thread_id: { type: String },
|
|
226
|
-
time_zone: { type: String }, // optional timezone for the job
|
|
227
|
-
}, {
|
|
228
|
-
versionKey: false,
|
|
229
|
-
toJSON: { virtuals: true },
|
|
230
|
-
toObject: { virtuals: true },
|
|
231
|
-
});
|
|
232
152
|
exports.MongoGeoSchema = new mongoose_1.Schema({
|
|
233
153
|
geo_text: { type: String },
|
|
234
154
|
timestamp: { type: Number },
|
package/dist/types.d.ts
CHANGED
|
@@ -88,6 +88,7 @@ export declare const zodSourceSchema: z.ZodObject<{
|
|
|
88
88
|
created_at: z.ZodOptional<z.ZodNumber>;
|
|
89
89
|
updated_at: z.ZodOptional<z.ZodNumber>;
|
|
90
90
|
region_id: z.ZodOptional<z.ZodString>;
|
|
91
|
+
region_title: z.ZodOptional<z.ZodString>;
|
|
91
92
|
group_id: z.ZodOptional<z.ZodString>;
|
|
92
93
|
dominant_geos: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
93
94
|
requested_by: z.ZodOptional<z.ZodObject<{
|
|
@@ -127,6 +128,7 @@ export declare const zodSourceSchema: z.ZodObject<{
|
|
|
127
128
|
language?: string | undefined;
|
|
128
129
|
tags?: string[] | undefined;
|
|
129
130
|
metadata?: Record<string, any> | undefined;
|
|
131
|
+
region_title?: string | undefined;
|
|
130
132
|
group_id?: string | undefined;
|
|
131
133
|
dominant_geos?: string[] | undefined;
|
|
132
134
|
requested_by?: {
|
|
@@ -153,6 +155,7 @@ export declare const zodSourceSchema: z.ZodObject<{
|
|
|
153
155
|
tags?: string[] | undefined;
|
|
154
156
|
is_public?: boolean | undefined;
|
|
155
157
|
metadata?: Record<string, any> | undefined;
|
|
158
|
+
region_title?: string | undefined;
|
|
156
159
|
group_id?: string | undefined;
|
|
157
160
|
dominant_geos?: string[] | undefined;
|
|
158
161
|
requested_by?: {
|
|
@@ -217,19 +220,24 @@ export declare const zodGeoSelectionSchema: z.ZodObject<{
|
|
|
217
220
|
geos?: string[] | undefined;
|
|
218
221
|
}>;
|
|
219
222
|
export declare const zodDataSchema: z.ZodObject<{
|
|
220
|
-
text_geo: z.ZodArray<z.ZodString, "many">;
|
|
221
|
-
timestamp: z.ZodNumber;
|
|
222
|
-
platform: z.ZodEnum<["telegram", "facebook", "instagram", "tiktok", "website"]>;
|
|
223
|
-
source_region: z.ZodOptional<z.ZodString>;
|
|
224
223
|
_id: z.ZodOptional<z.ZodString>;
|
|
224
|
+
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
225
|
+
platform: z.ZodOptional<z.ZodEnum<["telegram", "facebook", "instagram", "tiktok", "website"]>>;
|
|
226
|
+
source_region_id: z.ZodOptional<z.ZodString>;
|
|
227
|
+
source_region_title: z.ZodOptional<z.ZodString>;
|
|
228
|
+
source_dominant_geos: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
225
229
|
source_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
230
|
+
source_title: z.ZodOptional<z.ZodString>;
|
|
231
|
+
source_url: z.ZodOptional<z.ZodString>;
|
|
232
|
+
source_group_id: z.ZodOptional<z.ZodString>;
|
|
233
|
+
data_id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
234
|
+
data_geo: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
235
|
+
data_text: z.ZodOptional<z.ZodString>;
|
|
236
|
+
data_url: z.ZodOptional<z.ZodString>;
|
|
237
|
+
data_original_type: z.ZodOptional<z.ZodString>;
|
|
238
|
+
data_language: z.ZodOptional<z.ZodString>;
|
|
239
|
+
data_sentiment: z.ZodOptional<z.ZodString>;
|
|
240
|
+
data_timestamp: z.ZodOptional<z.ZodNumber>;
|
|
233
241
|
is_reply: z.ZodOptional<z.ZodBoolean>;
|
|
234
242
|
reply_to_message_id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
235
243
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
@@ -249,29 +257,31 @@ export declare const zodDataSchema: z.ZodObject<{
|
|
|
249
257
|
caption?: string | undefined;
|
|
250
258
|
}>, "many">>;
|
|
251
259
|
author: z.ZodOptional<z.ZodString>;
|
|
252
|
-
replies: z.ZodOptional<z.ZodAny>;
|
|
253
|
-
entities: z.ZodOptional<z.ZodAny>;
|
|
254
260
|
author_username: z.ZodOptional<z.ZodString>;
|
|
261
|
+
replies: z.ZodOptional<z.ZodAny>;
|
|
255
262
|
author_id: z.ZodOptional<z.ZodString>;
|
|
256
|
-
group_id: z.ZodOptional<z.ZodString>;
|
|
257
263
|
}, "strip", z.ZodTypeAny, {
|
|
258
264
|
created_at: number;
|
|
259
265
|
updated_at: number;
|
|
260
|
-
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website";
|
|
261
|
-
timestamp: number;
|
|
262
|
-
text_geo: string[];
|
|
263
266
|
source_id: string | number;
|
|
264
|
-
source_public_id: string | number;
|
|
265
|
-
source_name: string;
|
|
266
|
-
platform_id: string | number;
|
|
267
|
-
original_text_id: string | number;
|
|
268
267
|
_id?: string | undefined;
|
|
269
|
-
|
|
268
|
+
platform?: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | undefined;
|
|
270
269
|
metadata?: Record<string, any> | undefined;
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
270
|
+
timestamp?: number | undefined;
|
|
271
|
+
source_region_id?: string | undefined;
|
|
272
|
+
source_region_title?: string | undefined;
|
|
273
|
+
source_dominant_geos?: string[] | undefined;
|
|
274
|
+
source_title?: string | undefined;
|
|
275
|
+
source_url?: string | undefined;
|
|
276
|
+
source_group_id?: string | undefined;
|
|
277
|
+
data_id?: string | number | undefined;
|
|
278
|
+
data_geo?: string[] | undefined;
|
|
279
|
+
data_text?: string | undefined;
|
|
280
|
+
data_url?: string | undefined;
|
|
281
|
+
data_original_type?: string | undefined;
|
|
282
|
+
data_language?: string | undefined;
|
|
283
|
+
data_sentiment?: string | undefined;
|
|
284
|
+
data_timestamp?: number | undefined;
|
|
275
285
|
is_reply?: boolean | undefined;
|
|
276
286
|
reply_to_message_id?: string | number | undefined;
|
|
277
287
|
media?: {
|
|
@@ -280,28 +290,31 @@ export declare const zodDataSchema: z.ZodObject<{
|
|
|
280
290
|
caption?: string | undefined;
|
|
281
291
|
}[] | undefined;
|
|
282
292
|
author?: string | undefined;
|
|
283
|
-
replies?: any;
|
|
284
|
-
entities?: any;
|
|
285
293
|
author_username?: string | undefined;
|
|
294
|
+
replies?: any;
|
|
286
295
|
author_id?: string | undefined;
|
|
287
296
|
}, {
|
|
288
297
|
created_at: number;
|
|
289
298
|
updated_at: number;
|
|
290
|
-
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website";
|
|
291
|
-
timestamp: number;
|
|
292
|
-
text_geo: string[];
|
|
293
299
|
source_id: string | number;
|
|
294
|
-
source_public_id: string | number;
|
|
295
|
-
source_name: string;
|
|
296
|
-
platform_id: string | number;
|
|
297
|
-
original_text_id: string | number;
|
|
298
300
|
_id?: string | undefined;
|
|
299
|
-
|
|
301
|
+
platform?: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | undefined;
|
|
300
302
|
metadata?: Record<string, any> | undefined;
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
timestamp?: number | undefined;
|
|
304
|
+
source_region_id?: string | undefined;
|
|
305
|
+
source_region_title?: string | undefined;
|
|
306
|
+
source_dominant_geos?: string[] | undefined;
|
|
307
|
+
source_title?: string | undefined;
|
|
308
|
+
source_url?: string | undefined;
|
|
309
|
+
source_group_id?: string | undefined;
|
|
310
|
+
data_id?: string | number | undefined;
|
|
311
|
+
data_geo?: string[] | undefined;
|
|
312
|
+
data_text?: string | undefined;
|
|
313
|
+
data_url?: string | undefined;
|
|
314
|
+
data_original_type?: string | undefined;
|
|
315
|
+
data_language?: string | undefined;
|
|
316
|
+
data_sentiment?: string | undefined;
|
|
317
|
+
data_timestamp?: number | undefined;
|
|
305
318
|
is_reply?: boolean | undefined;
|
|
306
319
|
reply_to_message_id?: string | number | undefined;
|
|
307
320
|
media?: {
|
|
@@ -310,18 +323,10 @@ export declare const zodDataSchema: z.ZodObject<{
|
|
|
310
323
|
caption?: string | undefined;
|
|
311
324
|
}[] | undefined;
|
|
312
325
|
author?: string | undefined;
|
|
313
|
-
replies?: any;
|
|
314
|
-
entities?: any;
|
|
315
326
|
author_username?: string | undefined;
|
|
327
|
+
replies?: any;
|
|
316
328
|
author_id?: string | undefined;
|
|
317
329
|
}>;
|
|
318
|
-
/**
|
|
319
|
-
* 'approved' - active and approved sources,
|
|
320
|
-
* 'back_to_business' - sources that were paused and now resumed,
|
|
321
|
-
* 'pending' - sources that are pending approval,
|
|
322
|
-
* 'inactive' - sources that are inactive,
|
|
323
|
-
* 'in_review' - sources that are under review
|
|
324
|
-
*/
|
|
325
330
|
export type RegionType = z.infer<typeof zodRegionSchema>;
|
|
326
331
|
export type SourceGroupType = z.infer<typeof zodSourceGroupSchema>;
|
|
327
332
|
export type SourceType = z.infer<typeof zodSourceSchema>;
|
package/dist/types.js
CHANGED
|
@@ -72,6 +72,7 @@ exports.zodSourceSchema = zod_1.z.object({
|
|
|
72
72
|
created_at: zod_1.z.number().optional(),
|
|
73
73
|
updated_at: zod_1.z.number().optional(),
|
|
74
74
|
region_id: zod_1.z.string().optional(),
|
|
75
|
+
region_title: zod_1.z.string().optional(),
|
|
75
76
|
group_id: zod_1.z.string().optional(),
|
|
76
77
|
dominant_geos: zod_1.z.array(zod_1.z.string()).optional(),
|
|
77
78
|
requested_by: zod_1.z
|
|
@@ -105,20 +106,24 @@ exports.zodGeoSelectionSchema = zod_1.z.object({
|
|
|
105
106
|
updated_at: zod_1.z.number().optional(), // last update date
|
|
106
107
|
});
|
|
107
108
|
exports.zodDataSchema = zod_1.z.object({
|
|
108
|
-
// Filterable fields
|
|
109
|
-
text_geo: zod_1.z.array(zod_1.z.string()),
|
|
110
|
-
timestamp: zod_1.z.number(),
|
|
111
|
-
platform: zod_1.z.enum(exports.platformsList),
|
|
112
|
-
source_region: zod_1.z.string().optional(),
|
|
113
109
|
_id: zod_1.z.string().optional(),
|
|
110
|
+
timestamp: zod_1.z.number().optional(),
|
|
111
|
+
platform: zod_1.z.enum(exports.platformsList).optional(),
|
|
112
|
+
source_region_id: zod_1.z.string().optional(),
|
|
113
|
+
source_region_title: zod_1.z.string().optional(),
|
|
114
|
+
source_dominant_geos: zod_1.z.array(zod_1.z.string()).optional(),
|
|
114
115
|
source_id: zod_1.z.string().or(zod_1.z.number()),
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
source_title: zod_1.z.string().optional(),
|
|
117
|
+
source_url: zod_1.z.string().url().optional(),
|
|
118
|
+
source_group_id: zod_1.z.string().optional(),
|
|
119
|
+
data_id: zod_1.z.string().or(zod_1.z.number()).optional(),
|
|
120
|
+
data_geo: zod_1.z.array(zod_1.z.string()).optional(),
|
|
121
|
+
data_text: zod_1.z.string().optional(),
|
|
122
|
+
data_url: zod_1.z.string().url().optional(),
|
|
123
|
+
data_original_type: zod_1.z.string().optional(),
|
|
124
|
+
data_language: zod_1.z.string().optional(),
|
|
125
|
+
data_sentiment: zod_1.z.string().optional(),
|
|
126
|
+
data_timestamp: zod_1.z.number().optional(),
|
|
122
127
|
is_reply: zod_1.z.boolean().optional(),
|
|
123
128
|
reply_to_message_id: zod_1.z.string().or(zod_1.z.number()).optional(),
|
|
124
129
|
metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
|
|
@@ -132,11 +137,14 @@ exports.zodDataSchema = zod_1.z.object({
|
|
|
132
137
|
}))
|
|
133
138
|
.optional(),
|
|
134
139
|
author: zod_1.z.string().optional(),
|
|
135
|
-
replies: zod_1.z.any().optional(),
|
|
136
|
-
entities: zod_1.z.any().optional(),
|
|
137
140
|
author_username: zod_1.z.string().optional(),
|
|
138
|
-
|
|
139
|
-
|
|
141
|
+
replies: zod_1.z.any().optional(),
|
|
142
|
+
author_id: zod_1.z.string().optional(), // e.g., author ID -> get from post
|
|
143
|
+
// translated_text: z.string().optional(), // translated text if available - most of the time it will be translated to English
|
|
144
|
+
// entities: z.any().optional(), // array of reply texts or IDs
|
|
145
|
+
// source_public_id: z.string().or(z.number()), // e.g., 'telegram:1234567890' (message_id)
|
|
146
|
+
// platform_id: z.string().or(z.number()), // channel_id reference to Source source_id
|
|
147
|
+
// original_text_id: z.string().or(z.number()), // message_id
|
|
140
148
|
});
|
|
141
149
|
// Helper function to get allowed entities for a platform
|
|
142
150
|
const getAllowedEntitiesForPlatform = (platform) => {
|
package/index.ts
CHANGED
|
@@ -2,36 +2,40 @@
|
|
|
2
2
|
export * from './types';
|
|
3
3
|
|
|
4
4
|
import { Schema } from 'mongoose';
|
|
5
|
-
import {
|
|
6
|
-
generalStatusList,
|
|
7
|
-
platformsList,
|
|
5
|
+
import {
|
|
6
|
+
generalStatusList,
|
|
7
|
+
platformsList,
|
|
8
8
|
entityTypesList,
|
|
9
|
-
sourceStatusList
|
|
9
|
+
sourceStatusList,
|
|
10
10
|
} from './types';
|
|
11
11
|
|
|
12
12
|
export const MongoDataSchema = new Schema(
|
|
13
13
|
{
|
|
14
|
-
|
|
15
|
-
source_public_id: { type: Schema.Types.Mixed }, // e.g., 'telegram:1234567890' (message_id)
|
|
16
|
-
source_name: { type: String, required: true }, // e.g., 'Telegram Channel Name'
|
|
17
|
-
platform_id: { type: Schema.Types.Mixed }, // channel_id reference to Source source_id
|
|
14
|
+
timestamp: { type: Number }, // INDEX - date in milliseconds
|
|
18
15
|
platform: {
|
|
19
16
|
type: String,
|
|
20
17
|
enum: platformsList,
|
|
21
|
-
required: true,
|
|
22
18
|
}, // e.g., 'telegram', 'facebook'
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
source_region_id: { type: String }, // e.g., 'hebron'
|
|
20
|
+
source_region_title: { type: String }, // e.g., 'hebron'
|
|
21
|
+
source_dominant_geos: { type: [String], default: [] }, // e.g., ['hebron', 'west bank']
|
|
22
|
+
source_id: { type: Schema.Types.Mixed, required: true }, // INDEX - reference to Source _id
|
|
23
|
+
source_title: { type: String }, // e.g., 'Telegram Channel Name'
|
|
24
|
+
source_url: { type: String }, // e.g., 'https://t.me/telegram_channel_name'
|
|
25
|
+
source_group_id: { type: String }, // e.g., source group ID
|
|
26
|
+
data_id: { type: Schema.Types.Mixed }, // INDEX - original text ID (e.g., message_id)
|
|
27
|
+
data_geo: { type: [String], default: [] }, // INDEX - e.g., ["sinjil", "ramallah", "west bank"]
|
|
28
|
+
data_text: { type: String }, // processed text content
|
|
29
|
+
data_url: { type: String }, // original text URL if available
|
|
30
|
+
data_original_type: { type: String }, // e.g., 'post', 'comment', 'reply', 'video', 'image'
|
|
31
|
+
data_language: { type: String }, // detected language of the text
|
|
32
|
+
data_sentiment: { type: String }, // sentiment analysis result
|
|
33
|
+
data_timestamp: { type: Number }, // original post timestamp if different from ingestion timestamp
|
|
30
34
|
is_reply: { type: Boolean }, // true if this text is a reply to another text
|
|
31
35
|
reply_to_message_id: { type: Schema.Types.Mixed },
|
|
32
36
|
metadata: { type: Object }, // platform-specific fields
|
|
33
|
-
created_at: { type: Number, default: Date.now },
|
|
34
|
-
updated_at: { type: Number, default: Date.now },
|
|
37
|
+
created_at: { type: Number, default: Date.now, required: true },
|
|
38
|
+
updated_at: { type: Number, default: Date.now, required: true },
|
|
35
39
|
media: {
|
|
36
40
|
type: [
|
|
37
41
|
{
|
|
@@ -42,12 +46,9 @@ export const MongoDataSchema = new Schema(
|
|
|
42
46
|
],
|
|
43
47
|
}, // media attachments
|
|
44
48
|
author: { type: String }, // e.g., author name or ID
|
|
45
|
-
replies: { type: Schema.Types.Mixed }, // array of reply texts or IDs
|
|
46
|
-
entities: { type: Schema.Types.Mixed }, // array of entities
|
|
47
49
|
author_username: { type: String }, // e.g., author username
|
|
50
|
+
replies: { type: Schema.Types.Mixed }, // array of reply texts or IDs
|
|
48
51
|
author_id: { type: String }, // e.g., author ID
|
|
49
|
-
pipeline_name: { type: String }, // e.g., 'default_pipeline'
|
|
50
|
-
source_region: { type: String }, // e.g., "New York", "California"
|
|
51
52
|
},
|
|
52
53
|
{
|
|
53
54
|
versionKey: false,
|
|
@@ -69,7 +70,6 @@ export const MongoRegionSchema = new Schema(
|
|
|
69
70
|
default: 'active',
|
|
70
71
|
},
|
|
71
72
|
notes: { type: String }, // internal notes about the region
|
|
72
|
-
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
75
|
versionKey: false,
|
|
@@ -133,6 +133,7 @@ export const MongoSourceSchema = new Schema(
|
|
|
133
133
|
created_at: { type: Number, default: Date.now },
|
|
134
134
|
updated_at: { type: Number, default: Date.now },
|
|
135
135
|
region_id: { type: String }, // e.g., region ID
|
|
136
|
+
region_title: { type: String }, // e.g., region title
|
|
136
137
|
group_id: { type: String }, // e.g., source group ID
|
|
137
138
|
dominant_geos: { type: [String], default: [] }, // e.g., dominant geos associated with this source
|
|
138
139
|
requested_by: {
|
|
@@ -146,105 +147,6 @@ export const MongoSourceSchema = new Schema(
|
|
|
146
147
|
default: undefined,
|
|
147
148
|
}, // user who requested this source
|
|
148
149
|
notes: { type: String }, // internal notes about the source
|
|
149
|
-
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
versionKey: false,
|
|
153
|
-
toJSON: { virtuals: true },
|
|
154
|
-
toObject: { virtuals: true },
|
|
155
|
-
}
|
|
156
|
-
);
|
|
157
|
-
|
|
158
|
-
export const MongoQuerySchema = new Schema(
|
|
159
|
-
{
|
|
160
|
-
title: { type: String }, // e.g., 'Search Query'
|
|
161
|
-
query: { type: String }, // search query includes geo information where it should be extracted with LLM
|
|
162
|
-
sources: { type: [String] }, // array of source _id strings
|
|
163
|
-
geos: { type: [String], required: true }, // array of geo strings
|
|
164
|
-
geos_ids: { type: [String], required: true }, // array of geo _id strings
|
|
165
|
-
time_range: {
|
|
166
|
-
type: Schema.Types.Mixed, // can be relative or absolute time range
|
|
167
|
-
required: true,
|
|
168
|
-
},
|
|
169
|
-
user_id: { type: String, required: true }, // user identifier
|
|
170
|
-
user_instructions: { type: String }, // optional user instructions for the query
|
|
171
|
-
user_time_zone: { type: String }, // user's timezone
|
|
172
|
-
timestamp: { type: Number, default: Date.now }, // creation date
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
versionKey: false,
|
|
176
|
-
toJSON: { virtuals: true },
|
|
177
|
-
toObject: { virtuals: true },
|
|
178
|
-
}
|
|
179
|
-
);
|
|
180
|
-
|
|
181
|
-
export const MongoUserSettingsSchema = new Schema(
|
|
182
|
-
{
|
|
183
|
-
sources: { type: [String] }, // array of source _id strings
|
|
184
|
-
geos: { type: [String], default: [] }, // array of geo strings
|
|
185
|
-
time_range: {
|
|
186
|
-
type: Schema.Types.Mixed,
|
|
187
|
-
},
|
|
188
|
-
user_id: { type: String, required: true },
|
|
189
|
-
thread_id: { type: String },
|
|
190
|
-
instructions: { type: String }, // optional user instructions for the query
|
|
191
|
-
has_jobs_access: { type: Boolean, default: false }, // true if the user has access to jobs
|
|
192
|
-
active_jobs_limit: { type: Number, default: 5 }, // maximum number of active jobs allowed
|
|
193
|
-
created_at: { type: Date, default: Date.now }, // creation date
|
|
194
|
-
updated_at: { type: Date, default: Date.now }, // last update date
|
|
195
|
-
status: {
|
|
196
|
-
type: String,
|
|
197
|
-
enum: generalStatusList,
|
|
198
|
-
default: 'active',
|
|
199
|
-
}, // status of the user
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
versionKey: false,
|
|
203
|
-
toJSON: { virtuals: true },
|
|
204
|
-
toObject: { virtuals: true },
|
|
205
|
-
}
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
export const MongoConversationSchema = new Schema(
|
|
209
|
-
{
|
|
210
|
-
user_id: { type: String, required: true }, // user identifier
|
|
211
|
-
title: { type: String }, // optional title for the conversation
|
|
212
|
-
thread_id: { type: String }, // thread ID for the conversation
|
|
213
|
-
status: {
|
|
214
|
-
type: String,
|
|
215
|
-
enum: generalStatusList,
|
|
216
|
-
default: 'active',
|
|
217
|
-
}, // status of the conversation
|
|
218
|
-
created_at: { type: Date, default: Date.now }, // creation date
|
|
219
|
-
updated_at: { type: Date, default: Date.now }, // last update date
|
|
220
|
-
is_job: { type: Boolean, default: false }, // true if this is a job conversation
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
versionKey: false,
|
|
224
|
-
toJSON: { virtuals: true },
|
|
225
|
-
toObject: { virtuals: true },
|
|
226
|
-
}
|
|
227
|
-
);
|
|
228
|
-
|
|
229
|
-
export const MongoJobSchema = new Schema(
|
|
230
|
-
{
|
|
231
|
-
user_id: { type: String, required: true }, // user identifier
|
|
232
|
-
job_name: { type: String, required: true }, // name of the automation job
|
|
233
|
-
job_description: { type: String }, // description of the job
|
|
234
|
-
status: {
|
|
235
|
-
type: String,
|
|
236
|
-
enum: generalStatusList,
|
|
237
|
-
default: 'active',
|
|
238
|
-
}, // status of the job
|
|
239
|
-
created_at: { type: Number, default: Date.now }, // creation date
|
|
240
|
-
updated_at: { type: Number, default: Date.now }, // last update date
|
|
241
|
-
schedule: { type: String }, // cron schedule for the job
|
|
242
|
-
schedule_text: { type: String }, // cron schedule in free-text format
|
|
243
|
-
active_until: { type: Number || undefined }, // optional date until which the job is active
|
|
244
|
-
query: { type: Schema.Types.Mixed, required: true }, // query associated with the job
|
|
245
|
-
conversation_id: { type: String }, // optional conversation ID for the job
|
|
246
|
-
thread_id: { type: String }, // thread ID for the job
|
|
247
|
-
time_zone: { type: String }, // optional timezone for the job
|
|
248
150
|
},
|
|
249
151
|
{
|
|
250
152
|
versionKey: false,
|
package/package.json
CHANGED
package/types.ts
CHANGED
|
@@ -77,6 +77,7 @@ export const zodSourceSchema = z.object({
|
|
|
77
77
|
created_at: z.number().optional(),
|
|
78
78
|
updated_at: z.number().optional(),
|
|
79
79
|
region_id: z.string().optional(), // e.g., region ID // INDEX
|
|
80
|
+
region_title: z.string().optional(), // e.g., region title
|
|
80
81
|
group_id: z.string().optional(), // e.g., source group ID // INDEX
|
|
81
82
|
dominant_geos: z.array(z.string()).optional(), // e.g., dominant geos associated with this source
|
|
82
83
|
requested_by: z
|
|
@@ -113,24 +114,28 @@ export const zodGeoSelectionSchema = z.object({
|
|
|
113
114
|
});
|
|
114
115
|
|
|
115
116
|
export const zodDataSchema = z.object({
|
|
116
|
-
// Filterable fields
|
|
117
|
-
text_geo: z.array(z.string()), // INDEX - e.g., ["sinjil", "ramallah", "west bank"]
|
|
118
|
-
timestamp: z.number(), // INDEX - date in milliseconds - e.g., 1751210833000
|
|
119
|
-
platform: z.enum(platformsList), // e.g., 'telegram', 'facebook'
|
|
120
|
-
source_region: z.string().optional(), // e.g., 'hebron'
|
|
121
117
|
_id: z.string().optional(),
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
118
|
+
timestamp: z.number().optional(), // INDEX - date in milliseconds - e.g., 1751210833000
|
|
119
|
+
platform: z.enum(platformsList).optional(), // e.g., 'telegram', 'facebook'
|
|
120
|
+
source_region_id: z.string().optional(), // e.g., 'hebron' -> get from source object
|
|
121
|
+
source_region_title: z.string().optional(), // e.g., 'hebron' -> get from source object
|
|
122
|
+
source_dominant_geos: z.array(z.string()).optional(), // e.g., ['hebron', 'west bank'] -> get from source object
|
|
123
|
+
source_id: z.string().or(z.number()), // INDEX - reference to Source _id (e.g., '60c72b2f9b1e8d3f4c8b4567') -> get from source object
|
|
124
|
+
source_title: z.string().optional(), // e.g., 'Telegram Channel Name' -> get from source object
|
|
125
|
+
source_url: z.string().url().optional(), // e.g., 'https://t.me/telegram_channel_name' -> get from source object
|
|
126
|
+
source_group_id: z.string().optional(), // e.g., 'default_pipeline' -> get from source object
|
|
127
|
+
data_id: z.string().or(z.number()).optional(), // INDEX - original text ID (e.g., message_id) -> get from post
|
|
128
|
+
data_geo: z.array(z.string()).optional(), // INDEX - e.g., ["sinjil", "ramallah", "west bank"] -> get from processor
|
|
129
|
+
data_text: z.string().optional(), // processed text content -> get from post or processor
|
|
130
|
+
data_url: z.string().url().optional(), // original text URL if available -> get from post
|
|
131
|
+
data_original_type: z.string().optional(), // e.g., 'post', 'comment', 'reply', 'video', 'image' -> get from post
|
|
132
|
+
data_language: z.string().optional(), // detected language of the text -> get from post or processor
|
|
133
|
+
data_sentiment: z.string().optional(), // sentiment analysis result -> get from processor
|
|
134
|
+
data_timestamp: z.number().optional(), // original post timestamp if different from ingestion timestamp -> get from post
|
|
135
|
+
is_reply: z.boolean().optional(), // true if this text is a reply to another text -> get from post
|
|
136
|
+
reply_to_message_id: z.string().or(z.number()).optional(), // ID of the message this is a reply to -> get from post
|
|
137
|
+
metadata: z.record(z.string(), z.any()).optional(), // platform-specific fields -> get from post
|
|
138
|
+
created_at: z.number(),
|
|
134
139
|
updated_at: z.number(),
|
|
135
140
|
media: z
|
|
136
141
|
.array(
|
|
@@ -140,22 +145,18 @@ export const zodDataSchema = z.object({
|
|
|
140
145
|
caption: z.string().optional(),
|
|
141
146
|
})
|
|
142
147
|
)
|
|
143
|
-
.optional(), // media attachments
|
|
144
|
-
author: z.string().optional(), // e.g., author name or ID
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
.optional(), // media attachments -> get from post
|
|
149
|
+
author: z.string().optional(), // e.g., author name or ID -> get from post
|
|
150
|
+
author_username: z.string().optional(), // e.g., author username -> get from post
|
|
151
|
+
replies: z.any().optional(), // array of reply texts or IDs -> get from post
|
|
152
|
+
author_id: z.string().optional(), // e.g., author ID -> get from post
|
|
153
|
+
// translated_text: z.string().optional(), // translated text if available - most of the time it will be translated to English
|
|
154
|
+
// entities: z.any().optional(), // array of reply texts or IDs
|
|
155
|
+
// source_public_id: z.string().or(z.number()), // e.g., 'telegram:1234567890' (message_id)
|
|
156
|
+
// platform_id: z.string().or(z.number()), // channel_id reference to Source source_id
|
|
157
|
+
// original_text_id: z.string().or(z.number()), // message_id
|
|
150
158
|
});
|
|
151
159
|
|
|
152
|
-
/**
|
|
153
|
-
* 'approved' - active and approved sources,
|
|
154
|
-
* 'back_to_business' - sources that were paused and now resumed,
|
|
155
|
-
* 'pending' - sources that are pending approval,
|
|
156
|
-
* 'inactive' - sources that are inactive,
|
|
157
|
-
* 'in_review' - sources that are under review
|
|
158
|
-
*/
|
|
159
160
|
export type RegionType = z.infer<typeof zodRegionSchema>;
|
|
160
161
|
export type SourceGroupType = z.infer<typeof zodSourceGroupSchema>;
|
|
161
162
|
export type SourceType = z.infer<typeof zodSourceSchema>;
|