harvester_sdk 1.0.54 → 1.0.56
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 +194 -0
- package/dist/index.js +50 -1
- package/dist/types.d.ts +232 -0
- package/dist/types.js +45 -2
- package/index.ts +59 -0
- package/package.json +1 -1
- package/types.ts +53 -2
package/dist/index.d.ts
CHANGED
|
@@ -615,6 +615,7 @@ export declare const MongoGeoSelectionSchema: Schema<any, import("mongoose").Mod
|
|
|
615
615
|
description?: string | null | undefined;
|
|
616
616
|
region_id?: string | null | undefined;
|
|
617
617
|
title?: string | null | undefined;
|
|
618
|
+
geo_selection_group_id?: string | null | undefined;
|
|
618
619
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
619
620
|
status: "active" | "inactive" | "deleted";
|
|
620
621
|
geos: string[];
|
|
@@ -629,6 +630,7 @@ export declare const MongoGeoSelectionSchema: Schema<any, import("mongoose").Mod
|
|
|
629
630
|
description?: string | null | undefined;
|
|
630
631
|
region_id?: string | null | undefined;
|
|
631
632
|
title?: string | null | undefined;
|
|
633
|
+
geo_selection_group_id?: string | null | undefined;
|
|
632
634
|
}>, {}> & import("mongoose").FlatRecord<{
|
|
633
635
|
status: "active" | "inactive" | "deleted";
|
|
634
636
|
geos: string[];
|
|
@@ -643,6 +645,7 @@ export declare const MongoGeoSelectionSchema: Schema<any, import("mongoose").Mod
|
|
|
643
645
|
description?: string | null | undefined;
|
|
644
646
|
region_id?: string | null | undefined;
|
|
645
647
|
title?: string | null | undefined;
|
|
648
|
+
geo_selection_group_id?: string | null | undefined;
|
|
646
649
|
}> & {
|
|
647
650
|
_id: import("mongoose").Types.ObjectId;
|
|
648
651
|
} & {
|
|
@@ -765,3 +768,194 @@ export declare const MongoServerReportSchema: Schema<any, import("mongoose").Mod
|
|
|
765
768
|
} & {
|
|
766
769
|
__v: number;
|
|
767
770
|
}>;
|
|
771
|
+
export declare const MongoEventSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
772
|
+
versionKey: false;
|
|
773
|
+
toJSON: {
|
|
774
|
+
virtuals: true;
|
|
775
|
+
};
|
|
776
|
+
toObject: {
|
|
777
|
+
virtuals: true;
|
|
778
|
+
};
|
|
779
|
+
}, {
|
|
780
|
+
created_at: number;
|
|
781
|
+
updated_at: number;
|
|
782
|
+
timestamp: number;
|
|
783
|
+
embeddings: number[];
|
|
784
|
+
keywords: string[];
|
|
785
|
+
type?: string | null | undefined;
|
|
786
|
+
region_id?: string | null | undefined;
|
|
787
|
+
title?: string | null | undefined;
|
|
788
|
+
geo_selection_id?: string | null | undefined;
|
|
789
|
+
geo_selection_title?: string | null | undefined;
|
|
790
|
+
data_short?: string | null | undefined;
|
|
791
|
+
data?: string | null | undefined;
|
|
792
|
+
geo_selection?: any;
|
|
793
|
+
raw_data?: import("mongoose").Types.DocumentArray<{
|
|
794
|
+
data_geo: string[];
|
|
795
|
+
platform?: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "youtube" | "twitter" | "x" | "reddit" | "linkedin" | "snapchat" | "whatsapp" | "discord" | "twitch" | null | undefined;
|
|
796
|
+
timestamp?: number | null | undefined;
|
|
797
|
+
source_id?: any;
|
|
798
|
+
data_id?: any;
|
|
799
|
+
data_url?: string | null | undefined;
|
|
800
|
+
data_text?: string | null | undefined;
|
|
801
|
+
author_username?: string | null | undefined;
|
|
802
|
+
author_id?: string | null | undefined;
|
|
803
|
+
data_region_id?: string | null | undefined;
|
|
804
|
+
}, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
|
|
805
|
+
data_geo: string[];
|
|
806
|
+
platform?: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "youtube" | "twitter" | "x" | "reddit" | "linkedin" | "snapchat" | "whatsapp" | "discord" | "twitch" | null | undefined;
|
|
807
|
+
timestamp?: number | null | undefined;
|
|
808
|
+
source_id?: any;
|
|
809
|
+
data_id?: any;
|
|
810
|
+
data_url?: string | null | undefined;
|
|
811
|
+
data_text?: string | null | undefined;
|
|
812
|
+
author_username?: string | null | undefined;
|
|
813
|
+
author_id?: string | null | undefined;
|
|
814
|
+
data_region_id?: string | null | undefined;
|
|
815
|
+
}> & {
|
|
816
|
+
data_geo: string[];
|
|
817
|
+
platform?: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "youtube" | "twitter" | "x" | "reddit" | "linkedin" | "snapchat" | "whatsapp" | "discord" | "twitch" | null | undefined;
|
|
818
|
+
timestamp?: number | null | undefined;
|
|
819
|
+
source_id?: any;
|
|
820
|
+
data_id?: any;
|
|
821
|
+
data_url?: string | null | undefined;
|
|
822
|
+
data_text?: string | null | undefined;
|
|
823
|
+
author_username?: string | null | undefined;
|
|
824
|
+
author_id?: string | null | undefined;
|
|
825
|
+
data_region_id?: string | null | undefined;
|
|
826
|
+
}> | null | undefined;
|
|
827
|
+
event_id?: string | null | undefined;
|
|
828
|
+
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
829
|
+
created_at: number;
|
|
830
|
+
updated_at: number;
|
|
831
|
+
timestamp: number;
|
|
832
|
+
embeddings: number[];
|
|
833
|
+
keywords: string[];
|
|
834
|
+
type?: string | null | undefined;
|
|
835
|
+
region_id?: string | null | undefined;
|
|
836
|
+
title?: string | null | undefined;
|
|
837
|
+
geo_selection_id?: string | null | undefined;
|
|
838
|
+
geo_selection_title?: string | null | undefined;
|
|
839
|
+
data_short?: string | null | undefined;
|
|
840
|
+
data?: string | null | undefined;
|
|
841
|
+
geo_selection?: any;
|
|
842
|
+
raw_data?: import("mongoose").Types.DocumentArray<{
|
|
843
|
+
data_geo: string[];
|
|
844
|
+
platform?: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "youtube" | "twitter" | "x" | "reddit" | "linkedin" | "snapchat" | "whatsapp" | "discord" | "twitch" | null | undefined;
|
|
845
|
+
timestamp?: number | null | undefined;
|
|
846
|
+
source_id?: any;
|
|
847
|
+
data_id?: any;
|
|
848
|
+
data_url?: string | null | undefined;
|
|
849
|
+
data_text?: string | null | undefined;
|
|
850
|
+
author_username?: string | null | undefined;
|
|
851
|
+
author_id?: string | null | undefined;
|
|
852
|
+
data_region_id?: string | null | undefined;
|
|
853
|
+
}, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
|
|
854
|
+
data_geo: string[];
|
|
855
|
+
platform?: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "youtube" | "twitter" | "x" | "reddit" | "linkedin" | "snapchat" | "whatsapp" | "discord" | "twitch" | null | undefined;
|
|
856
|
+
timestamp?: number | null | undefined;
|
|
857
|
+
source_id?: any;
|
|
858
|
+
data_id?: any;
|
|
859
|
+
data_url?: string | null | undefined;
|
|
860
|
+
data_text?: string | null | undefined;
|
|
861
|
+
author_username?: string | null | undefined;
|
|
862
|
+
author_id?: string | null | undefined;
|
|
863
|
+
data_region_id?: string | null | undefined;
|
|
864
|
+
}> & {
|
|
865
|
+
data_geo: string[];
|
|
866
|
+
platform?: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "youtube" | "twitter" | "x" | "reddit" | "linkedin" | "snapchat" | "whatsapp" | "discord" | "twitch" | null | undefined;
|
|
867
|
+
timestamp?: number | null | undefined;
|
|
868
|
+
source_id?: any;
|
|
869
|
+
data_id?: any;
|
|
870
|
+
data_url?: string | null | undefined;
|
|
871
|
+
data_text?: string | null | undefined;
|
|
872
|
+
author_username?: string | null | undefined;
|
|
873
|
+
author_id?: string | null | undefined;
|
|
874
|
+
data_region_id?: string | null | undefined;
|
|
875
|
+
}> | null | undefined;
|
|
876
|
+
event_id?: string | null | undefined;
|
|
877
|
+
}>, {}> & import("mongoose").FlatRecord<{
|
|
878
|
+
created_at: number;
|
|
879
|
+
updated_at: number;
|
|
880
|
+
timestamp: number;
|
|
881
|
+
embeddings: number[];
|
|
882
|
+
keywords: string[];
|
|
883
|
+
type?: string | null | undefined;
|
|
884
|
+
region_id?: string | null | undefined;
|
|
885
|
+
title?: string | null | undefined;
|
|
886
|
+
geo_selection_id?: string | null | undefined;
|
|
887
|
+
geo_selection_title?: string | null | undefined;
|
|
888
|
+
data_short?: string | null | undefined;
|
|
889
|
+
data?: string | null | undefined;
|
|
890
|
+
geo_selection?: any;
|
|
891
|
+
raw_data?: import("mongoose").Types.DocumentArray<{
|
|
892
|
+
data_geo: string[];
|
|
893
|
+
platform?: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "youtube" | "twitter" | "x" | "reddit" | "linkedin" | "snapchat" | "whatsapp" | "discord" | "twitch" | null | undefined;
|
|
894
|
+
timestamp?: number | null | undefined;
|
|
895
|
+
source_id?: any;
|
|
896
|
+
data_id?: any;
|
|
897
|
+
data_url?: string | null | undefined;
|
|
898
|
+
data_text?: string | null | undefined;
|
|
899
|
+
author_username?: string | null | undefined;
|
|
900
|
+
author_id?: string | null | undefined;
|
|
901
|
+
data_region_id?: string | null | undefined;
|
|
902
|
+
}, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
|
|
903
|
+
data_geo: string[];
|
|
904
|
+
platform?: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "youtube" | "twitter" | "x" | "reddit" | "linkedin" | "snapchat" | "whatsapp" | "discord" | "twitch" | null | undefined;
|
|
905
|
+
timestamp?: number | null | undefined;
|
|
906
|
+
source_id?: any;
|
|
907
|
+
data_id?: any;
|
|
908
|
+
data_url?: string | null | undefined;
|
|
909
|
+
data_text?: string | null | undefined;
|
|
910
|
+
author_username?: string | null | undefined;
|
|
911
|
+
author_id?: string | null | undefined;
|
|
912
|
+
data_region_id?: string | null | undefined;
|
|
913
|
+
}> & {
|
|
914
|
+
data_geo: string[];
|
|
915
|
+
platform?: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "youtube" | "twitter" | "x" | "reddit" | "linkedin" | "snapchat" | "whatsapp" | "discord" | "twitch" | null | undefined;
|
|
916
|
+
timestamp?: number | null | undefined;
|
|
917
|
+
source_id?: any;
|
|
918
|
+
data_id?: any;
|
|
919
|
+
data_url?: string | null | undefined;
|
|
920
|
+
data_text?: string | null | undefined;
|
|
921
|
+
author_username?: string | null | undefined;
|
|
922
|
+
author_id?: string | null | undefined;
|
|
923
|
+
data_region_id?: string | null | undefined;
|
|
924
|
+
}> | null | undefined;
|
|
925
|
+
event_id?: string | null | undefined;
|
|
926
|
+
}> & {
|
|
927
|
+
_id: import("mongoose").Types.ObjectId;
|
|
928
|
+
} & {
|
|
929
|
+
__v: number;
|
|
930
|
+
}>;
|
|
931
|
+
export declare const MongoGeoSelectionGroupSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
932
|
+
versionKey: false;
|
|
933
|
+
toJSON: {
|
|
934
|
+
virtuals: true;
|
|
935
|
+
};
|
|
936
|
+
toObject: {
|
|
937
|
+
virtuals: true;
|
|
938
|
+
};
|
|
939
|
+
}, {
|
|
940
|
+
slug: string;
|
|
941
|
+
created_at: number;
|
|
942
|
+
updated_at: number;
|
|
943
|
+
notes?: string | null | undefined;
|
|
944
|
+
description?: string | null | undefined;
|
|
945
|
+
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
946
|
+
slug: string;
|
|
947
|
+
created_at: number;
|
|
948
|
+
updated_at: number;
|
|
949
|
+
notes?: string | null | undefined;
|
|
950
|
+
description?: string | null | undefined;
|
|
951
|
+
}>, {}> & import("mongoose").FlatRecord<{
|
|
952
|
+
slug: string;
|
|
953
|
+
created_at: number;
|
|
954
|
+
updated_at: number;
|
|
955
|
+
notes?: string | null | undefined;
|
|
956
|
+
description?: string | null | undefined;
|
|
957
|
+
}> & {
|
|
958
|
+
_id: import("mongoose").Types.ObjectId;
|
|
959
|
+
} & {
|
|
960
|
+
__v: number;
|
|
961
|
+
}>;
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ 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.MongoServerReportSchema = exports.MongoRegionSummarySchema = exports.MongoApiKeySchema = exports.MongoGeoSelectionSchema = exports.MongoGeoSchema = exports.MongoSourceSchema = exports.MongoSourceGroupSchema = exports.MongoRegionSchema = exports.MongoDataSchema = exports.HarvesterSDKError = exports.createHarvesterSDK = exports.HarvesterSDK = void 0;
|
|
17
|
+
exports.MongoGeoSelectionGroupSchema = exports.MongoEventSchema = exports.MongoServerReportSchema = exports.MongoRegionSummarySchema = exports.MongoApiKeySchema = exports.MongoGeoSelectionSchema = exports.MongoGeoSchema = exports.MongoSourceSchema = exports.MongoSourceGroupSchema = exports.MongoRegionSchema = exports.MongoDataSchema = exports.HarvesterSDKError = exports.createHarvesterSDK = exports.HarvesterSDK = void 0;
|
|
18
18
|
// Export types for consumers
|
|
19
19
|
__exportStar(require("./types"), exports);
|
|
20
20
|
// Export SDK
|
|
@@ -274,6 +274,7 @@ exports.MongoGeoSchema = new mongoose_1.Schema({
|
|
|
274
274
|
toObject: { virtuals: true },
|
|
275
275
|
});
|
|
276
276
|
exports.MongoGeoSelectionSchema = new mongoose_1.Schema({
|
|
277
|
+
geo_selection_group_id: { type: String },
|
|
277
278
|
title: { type: String },
|
|
278
279
|
description: { type: String },
|
|
279
280
|
type: { type: String },
|
|
@@ -341,3 +342,51 @@ exports.MongoServerReportSchema = new mongoose_1.Schema({
|
|
|
341
342
|
toJSON: { virtuals: true },
|
|
342
343
|
toObject: { virtuals: true },
|
|
343
344
|
});
|
|
345
|
+
exports.MongoEventSchema = new mongoose_1.Schema({
|
|
346
|
+
event_id: { type: String },
|
|
347
|
+
timestamp: { type: Number, default: Date.now },
|
|
348
|
+
region_id: { type: String },
|
|
349
|
+
geo_selection_id: { type: String },
|
|
350
|
+
geo_selection_title: { type: String },
|
|
351
|
+
type: { type: String },
|
|
352
|
+
title: { type: String },
|
|
353
|
+
data_short: { type: String },
|
|
354
|
+
data: { type: String },
|
|
355
|
+
created_at: { type: Number, default: Date.now },
|
|
356
|
+
updated_at: { type: Number, default: Date.now },
|
|
357
|
+
keywords: { type: [String], default: [] },
|
|
358
|
+
geo_selection: { type: mongoose_1.Schema.Types.Mixed },
|
|
359
|
+
raw_data: {
|
|
360
|
+
type: [
|
|
361
|
+
{
|
|
362
|
+
platform: { type: String, enum: types_1.platformsList },
|
|
363
|
+
source_id: { type: mongoose_1.Schema.Types.Mixed },
|
|
364
|
+
data_id: { type: mongoose_1.Schema.Types.Mixed },
|
|
365
|
+
data_url: { type: String },
|
|
366
|
+
data_text: { type: String },
|
|
367
|
+
author_username: { type: String },
|
|
368
|
+
author_id: { type: String },
|
|
369
|
+
timestamp: { type: Number },
|
|
370
|
+
data_geo: { type: [String], default: [] },
|
|
371
|
+
data_region_id: { type: String },
|
|
372
|
+
},
|
|
373
|
+
],
|
|
374
|
+
default: undefined,
|
|
375
|
+
},
|
|
376
|
+
embeddings: { type: [Number], default: [] }, // vector embeddings for ML tasks
|
|
377
|
+
}, {
|
|
378
|
+
versionKey: false,
|
|
379
|
+
toJSON: { virtuals: true },
|
|
380
|
+
toObject: { virtuals: true },
|
|
381
|
+
});
|
|
382
|
+
exports.MongoGeoSelectionGroupSchema = new mongoose_1.Schema({
|
|
383
|
+
slug: { type: String, required: true },
|
|
384
|
+
description: { type: String },
|
|
385
|
+
created_at: { type: Number, default: Date.now },
|
|
386
|
+
updated_at: { type: Number, default: Date.now },
|
|
387
|
+
notes: { type: String }, // internal notes about the geo selection group
|
|
388
|
+
}, {
|
|
389
|
+
versionKey: false,
|
|
390
|
+
toJSON: { virtuals: true },
|
|
391
|
+
toObject: { virtuals: true },
|
|
392
|
+
});
|
package/dist/types.d.ts
CHANGED
|
@@ -284,8 +284,31 @@ export declare const zodGeoSchema: z.ZodObject<{
|
|
|
284
284
|
subscribers?: string[] | undefined;
|
|
285
285
|
is_used?: boolean | undefined;
|
|
286
286
|
}>;
|
|
287
|
+
export declare const zodGeoSelectionGroupSchema: z.ZodObject<{
|
|
288
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
289
|
+
slug: z.ZodString;
|
|
290
|
+
description: z.ZodOptional<z.ZodString>;
|
|
291
|
+
created_at: z.ZodOptional<z.ZodNumber>;
|
|
292
|
+
updated_at: z.ZodOptional<z.ZodNumber>;
|
|
293
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
294
|
+
}, "strip", z.ZodTypeAny, {
|
|
295
|
+
slug: string;
|
|
296
|
+
_id?: string | undefined;
|
|
297
|
+
created_at?: number | undefined;
|
|
298
|
+
updated_at?: number | undefined;
|
|
299
|
+
notes?: string | undefined;
|
|
300
|
+
description?: string | undefined;
|
|
301
|
+
}, {
|
|
302
|
+
slug: string;
|
|
303
|
+
_id?: string | undefined;
|
|
304
|
+
created_at?: number | undefined;
|
|
305
|
+
updated_at?: number | undefined;
|
|
306
|
+
notes?: string | undefined;
|
|
307
|
+
description?: string | undefined;
|
|
308
|
+
}>;
|
|
287
309
|
export declare const zodGeoSelectionSchema: z.ZodObject<{
|
|
288
310
|
_id: z.ZodOptional<z.ZodString>;
|
|
311
|
+
geo_selection_group_id: z.ZodOptional<z.ZodString>;
|
|
289
312
|
title: z.ZodOptional<z.ZodString>;
|
|
290
313
|
description: z.ZodOptional<z.ZodString>;
|
|
291
314
|
type: z.ZodOptional<z.ZodString>;
|
|
@@ -321,6 +344,7 @@ export declare const zodGeoSelectionSchema: z.ZodObject<{
|
|
|
321
344
|
description?: string | undefined;
|
|
322
345
|
region_id?: string | undefined;
|
|
323
346
|
title?: string | undefined;
|
|
347
|
+
geo_selection_group_id?: string | undefined;
|
|
324
348
|
geos?: string[] | undefined;
|
|
325
349
|
lat?: number | undefined;
|
|
326
350
|
lng?: number | undefined;
|
|
@@ -338,6 +362,7 @@ export declare const zodGeoSelectionSchema: z.ZodObject<{
|
|
|
338
362
|
description?: string | undefined;
|
|
339
363
|
region_id?: string | undefined;
|
|
340
364
|
title?: string | undefined;
|
|
365
|
+
geo_selection_group_id?: string | undefined;
|
|
341
366
|
geos?: string[] | undefined;
|
|
342
367
|
lat?: number | undefined;
|
|
343
368
|
lng?: number | undefined;
|
|
@@ -2082,6 +2107,7 @@ export type MediaItemType = z.infer<typeof mediaItemSchema>;
|
|
|
2082
2107
|
export type AuthorType = z.infer<typeof authorSchema>;
|
|
2083
2108
|
export type RepliesInfoType = z.infer<typeof repliesInfoSchema>;
|
|
2084
2109
|
export type GeoType = z.infer<typeof zodGeoSchema>;
|
|
2110
|
+
export type GeoSelectionGroupType = z.infer<typeof zodGeoSelectionGroupSchema>;
|
|
2085
2111
|
export type GeoSelectionType = z.infer<typeof zodGeoSelectionSchema>;
|
|
2086
2112
|
export type DashboardStatsType = z.infer<typeof zodDashboardStatsSchema>;
|
|
2087
2113
|
export type RegionSummaryType = z.infer<typeof zodRegionSummarySchema>;
|
|
@@ -2091,3 +2117,209 @@ export type FacebookMetadataType = z.infer<typeof facebookMetadataSchema>;
|
|
|
2091
2117
|
export type InstagramMetadataType = z.infer<typeof instagramMetadataSchema>;
|
|
2092
2118
|
export type TiktokMetadataType = z.infer<typeof tiktokMetadataSchema>;
|
|
2093
2119
|
export type WebsiteMetadataType = z.infer<typeof websiteMetadataSchema>;
|
|
2120
|
+
/**
|
|
2121
|
+
* Harvester events
|
|
2122
|
+
*/
|
|
2123
|
+
export declare const zodEventSchema: z.ZodObject<{
|
|
2124
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
2125
|
+
region_id: z.ZodString;
|
|
2126
|
+
geo_selection_id: z.ZodOptional<z.ZodString>;
|
|
2127
|
+
geo_selection_title: z.ZodOptional<z.ZodString>;
|
|
2128
|
+
type: z.ZodString;
|
|
2129
|
+
title: z.ZodString;
|
|
2130
|
+
data_short: z.ZodOptional<z.ZodString>;
|
|
2131
|
+
data: z.ZodString;
|
|
2132
|
+
created_at: z.ZodNumber;
|
|
2133
|
+
updated_at: z.ZodNumber;
|
|
2134
|
+
keywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
2135
|
+
geo_selection: z.ZodObject<{
|
|
2136
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
2137
|
+
geo_selection_group_id: z.ZodOptional<z.ZodString>;
|
|
2138
|
+
title: z.ZodOptional<z.ZodString>;
|
|
2139
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2140
|
+
type: z.ZodOptional<z.ZodString>;
|
|
2141
|
+
geos: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
2142
|
+
region_id: z.ZodOptional<z.ZodString>;
|
|
2143
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
2144
|
+
status: z.ZodOptional<z.ZodEnum<["active", "inactive", "deleted"]>>;
|
|
2145
|
+
created_at: z.ZodOptional<z.ZodNumber>;
|
|
2146
|
+
updated_at: z.ZodOptional<z.ZodNumber>;
|
|
2147
|
+
coordinates: z.ZodOptional<z.ZodObject<{
|
|
2148
|
+
type: z.ZodOptional<z.ZodEnum<["point", "polygon"]>>;
|
|
2149
|
+
coordinates: z.ZodOptional<z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">]>>;
|
|
2150
|
+
}, "strip", z.ZodTypeAny, {
|
|
2151
|
+
type?: "point" | "polygon" | undefined;
|
|
2152
|
+
coordinates?: [number, number] | [number, number][] | undefined;
|
|
2153
|
+
}, {
|
|
2154
|
+
type?: "point" | "polygon" | undefined;
|
|
2155
|
+
coordinates?: [number, number] | [number, number][] | undefined;
|
|
2156
|
+
}>>;
|
|
2157
|
+
lat: z.ZodOptional<z.ZodNumber>;
|
|
2158
|
+
lng: z.ZodOptional<z.ZodNumber>;
|
|
2159
|
+
}, "strip", z.ZodTypeAny, {
|
|
2160
|
+
_id?: string | undefined;
|
|
2161
|
+
created_at?: number | undefined;
|
|
2162
|
+
updated_at?: number | undefined;
|
|
2163
|
+
status?: "active" | "inactive" | "deleted" | undefined;
|
|
2164
|
+
notes?: string | undefined;
|
|
2165
|
+
type?: string | undefined;
|
|
2166
|
+
coordinates?: {
|
|
2167
|
+
type?: "point" | "polygon" | undefined;
|
|
2168
|
+
coordinates?: [number, number] | [number, number][] | undefined;
|
|
2169
|
+
} | undefined;
|
|
2170
|
+
description?: string | undefined;
|
|
2171
|
+
region_id?: string | undefined;
|
|
2172
|
+
title?: string | undefined;
|
|
2173
|
+
geo_selection_group_id?: string | undefined;
|
|
2174
|
+
geos?: string[] | undefined;
|
|
2175
|
+
lat?: number | undefined;
|
|
2176
|
+
lng?: number | undefined;
|
|
2177
|
+
}, {
|
|
2178
|
+
_id?: string | undefined;
|
|
2179
|
+
created_at?: number | undefined;
|
|
2180
|
+
updated_at?: number | undefined;
|
|
2181
|
+
status?: "active" | "inactive" | "deleted" | undefined;
|
|
2182
|
+
notes?: string | undefined;
|
|
2183
|
+
type?: string | undefined;
|
|
2184
|
+
coordinates?: {
|
|
2185
|
+
type?: "point" | "polygon" | undefined;
|
|
2186
|
+
coordinates?: [number, number] | [number, number][] | undefined;
|
|
2187
|
+
} | undefined;
|
|
2188
|
+
description?: string | undefined;
|
|
2189
|
+
region_id?: string | undefined;
|
|
2190
|
+
title?: string | undefined;
|
|
2191
|
+
geo_selection_group_id?: string | undefined;
|
|
2192
|
+
geos?: string[] | undefined;
|
|
2193
|
+
lat?: number | undefined;
|
|
2194
|
+
lng?: number | undefined;
|
|
2195
|
+
}>;
|
|
2196
|
+
raw_data: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2197
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
2198
|
+
platform: z.ZodEnum<["telegram", "facebook", "instagram", "tiktok", "website", "youtube", "twitter", "x", "reddit", "linkedin", "snapchat", "whatsapp", "discord", "twitch"]>;
|
|
2199
|
+
source_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
2200
|
+
data_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
2201
|
+
data_url: z.ZodOptional<z.ZodString>;
|
|
2202
|
+
data_text: z.ZodOptional<z.ZodString>;
|
|
2203
|
+
author_username: z.ZodOptional<z.ZodString>;
|
|
2204
|
+
author_id: z.ZodOptional<z.ZodString>;
|
|
2205
|
+
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
2206
|
+
data_geo: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
2207
|
+
data_region_id: z.ZodOptional<z.ZodString>;
|
|
2208
|
+
}, "strip", z.ZodTypeAny, {
|
|
2209
|
+
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "youtube" | "twitter" | "x" | "reddit" | "linkedin" | "snapchat" | "whatsapp" | "discord" | "twitch";
|
|
2210
|
+
source_id: string | number;
|
|
2211
|
+
data_id: string | number;
|
|
2212
|
+
data_geo: string[];
|
|
2213
|
+
_id?: string | undefined;
|
|
2214
|
+
timestamp?: number | undefined;
|
|
2215
|
+
data_url?: string | undefined;
|
|
2216
|
+
data_text?: string | undefined;
|
|
2217
|
+
author_username?: string | undefined;
|
|
2218
|
+
author_id?: string | undefined;
|
|
2219
|
+
data_region_id?: string | undefined;
|
|
2220
|
+
}, {
|
|
2221
|
+
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "youtube" | "twitter" | "x" | "reddit" | "linkedin" | "snapchat" | "whatsapp" | "discord" | "twitch";
|
|
2222
|
+
source_id: string | number;
|
|
2223
|
+
data_id: string | number;
|
|
2224
|
+
_id?: string | undefined;
|
|
2225
|
+
timestamp?: number | undefined;
|
|
2226
|
+
data_url?: string | undefined;
|
|
2227
|
+
data_text?: string | undefined;
|
|
2228
|
+
data_geo?: string[] | undefined;
|
|
2229
|
+
author_username?: string | undefined;
|
|
2230
|
+
author_id?: string | undefined;
|
|
2231
|
+
data_region_id?: string | undefined;
|
|
2232
|
+
}>, "many">>;
|
|
2233
|
+
embeddings: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
2234
|
+
}, "strip", z.ZodTypeAny, {
|
|
2235
|
+
created_at: number;
|
|
2236
|
+
updated_at: number;
|
|
2237
|
+
type: string;
|
|
2238
|
+
region_id: string;
|
|
2239
|
+
title: string;
|
|
2240
|
+
data: string;
|
|
2241
|
+
geo_selection: {
|
|
2242
|
+
_id?: string | undefined;
|
|
2243
|
+
created_at?: number | undefined;
|
|
2244
|
+
updated_at?: number | undefined;
|
|
2245
|
+
status?: "active" | "inactive" | "deleted" | undefined;
|
|
2246
|
+
notes?: string | undefined;
|
|
2247
|
+
type?: string | undefined;
|
|
2248
|
+
coordinates?: {
|
|
2249
|
+
type?: "point" | "polygon" | undefined;
|
|
2250
|
+
coordinates?: [number, number] | [number, number][] | undefined;
|
|
2251
|
+
} | undefined;
|
|
2252
|
+
description?: string | undefined;
|
|
2253
|
+
region_id?: string | undefined;
|
|
2254
|
+
title?: string | undefined;
|
|
2255
|
+
geo_selection_group_id?: string | undefined;
|
|
2256
|
+
geos?: string[] | undefined;
|
|
2257
|
+
lat?: number | undefined;
|
|
2258
|
+
lng?: number | undefined;
|
|
2259
|
+
};
|
|
2260
|
+
_id?: string | undefined;
|
|
2261
|
+
embeddings?: number[] | undefined;
|
|
2262
|
+
keywords?: string[] | undefined;
|
|
2263
|
+
geo_selection_id?: string | undefined;
|
|
2264
|
+
geo_selection_title?: string | undefined;
|
|
2265
|
+
data_short?: string | undefined;
|
|
2266
|
+
raw_data?: {
|
|
2267
|
+
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "youtube" | "twitter" | "x" | "reddit" | "linkedin" | "snapchat" | "whatsapp" | "discord" | "twitch";
|
|
2268
|
+
source_id: string | number;
|
|
2269
|
+
data_id: string | number;
|
|
2270
|
+
data_geo: string[];
|
|
2271
|
+
_id?: string | undefined;
|
|
2272
|
+
timestamp?: number | undefined;
|
|
2273
|
+
data_url?: string | undefined;
|
|
2274
|
+
data_text?: string | undefined;
|
|
2275
|
+
author_username?: string | undefined;
|
|
2276
|
+
author_id?: string | undefined;
|
|
2277
|
+
data_region_id?: string | undefined;
|
|
2278
|
+
}[] | undefined;
|
|
2279
|
+
}, {
|
|
2280
|
+
created_at: number;
|
|
2281
|
+
updated_at: number;
|
|
2282
|
+
type: string;
|
|
2283
|
+
region_id: string;
|
|
2284
|
+
title: string;
|
|
2285
|
+
data: string;
|
|
2286
|
+
geo_selection: {
|
|
2287
|
+
_id?: string | undefined;
|
|
2288
|
+
created_at?: number | undefined;
|
|
2289
|
+
updated_at?: number | undefined;
|
|
2290
|
+
status?: "active" | "inactive" | "deleted" | undefined;
|
|
2291
|
+
notes?: string | undefined;
|
|
2292
|
+
type?: string | undefined;
|
|
2293
|
+
coordinates?: {
|
|
2294
|
+
type?: "point" | "polygon" | undefined;
|
|
2295
|
+
coordinates?: [number, number] | [number, number][] | undefined;
|
|
2296
|
+
} | undefined;
|
|
2297
|
+
description?: string | undefined;
|
|
2298
|
+
region_id?: string | undefined;
|
|
2299
|
+
title?: string | undefined;
|
|
2300
|
+
geo_selection_group_id?: string | undefined;
|
|
2301
|
+
geos?: string[] | undefined;
|
|
2302
|
+
lat?: number | undefined;
|
|
2303
|
+
lng?: number | undefined;
|
|
2304
|
+
};
|
|
2305
|
+
_id?: string | undefined;
|
|
2306
|
+
embeddings?: number[] | undefined;
|
|
2307
|
+
keywords?: string[] | undefined;
|
|
2308
|
+
geo_selection_id?: string | undefined;
|
|
2309
|
+
geo_selection_title?: string | undefined;
|
|
2310
|
+
data_short?: string | undefined;
|
|
2311
|
+
raw_data?: {
|
|
2312
|
+
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "youtube" | "twitter" | "x" | "reddit" | "linkedin" | "snapchat" | "whatsapp" | "discord" | "twitch";
|
|
2313
|
+
source_id: string | number;
|
|
2314
|
+
data_id: string | number;
|
|
2315
|
+
_id?: string | undefined;
|
|
2316
|
+
timestamp?: number | undefined;
|
|
2317
|
+
data_url?: string | undefined;
|
|
2318
|
+
data_text?: string | undefined;
|
|
2319
|
+
data_geo?: string[] | undefined;
|
|
2320
|
+
author_username?: string | undefined;
|
|
2321
|
+
author_id?: string | undefined;
|
|
2322
|
+
data_region_id?: string | undefined;
|
|
2323
|
+
}[] | undefined;
|
|
2324
|
+
}>;
|
|
2325
|
+
export type EventType = z.infer<typeof zodEventSchema>;
|
package/dist/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.zodServerReportSchema = exports.zodRegionSummarySchema = exports.zodDashboardStatsSchema = exports.zodDataSchemaWithValidation = exports.zodDataSchema = exports.authorSchema = exports.repliesInfoSchema = exports.mediaItemSchema = exports.websiteMetadataSchema = exports.tiktokMetadataSchema = exports.instagramMetadataSchema = exports.facebookMetadataSchema = exports.telegramMetadataSchema = exports.zodGeoSelectionSchema = exports.zodGeoSchema = exports.zodSourceSchema = exports.zodSourceGroupSchema = exports.zodRegionSchema = exports.generalStatusList = exports.sourceStatusList = exports.priorityLevels = exports.platformEntityMap = exports.entityTypesList = exports.platformsList = void 0;
|
|
3
|
+
exports.zodEventSchema = exports.zodServerReportSchema = exports.zodRegionSummarySchema = exports.zodDashboardStatsSchema = exports.zodDataSchemaWithValidation = exports.zodDataSchema = exports.authorSchema = exports.repliesInfoSchema = exports.mediaItemSchema = exports.websiteMetadataSchema = exports.tiktokMetadataSchema = exports.instagramMetadataSchema = exports.facebookMetadataSchema = exports.telegramMetadataSchema = exports.zodGeoSelectionSchema = exports.zodGeoSelectionGroupSchema = exports.zodGeoSchema = exports.zodSourceSchema = exports.zodSourceGroupSchema = exports.zodRegionSchema = exports.generalStatusList = exports.sourceStatusList = exports.priorityLevels = exports.platformEntityMap = exports.entityTypesList = exports.platformsList = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.platformsList = [
|
|
6
6
|
'telegram',
|
|
@@ -25,7 +25,7 @@ exports.entityTypesList = [
|
|
|
25
25
|
'channel',
|
|
26
26
|
'hashtag',
|
|
27
27
|
'website',
|
|
28
|
-
'rss'
|
|
28
|
+
'rss',
|
|
29
29
|
];
|
|
30
30
|
// Platform-specific entity mappings
|
|
31
31
|
exports.platformEntityMap = {
|
|
@@ -143,8 +143,17 @@ exports.zodGeoSchema = zod_1.z.object({
|
|
|
143
143
|
subscribers: zod_1.z.array(zod_1.z.string()).optional(),
|
|
144
144
|
is_used: zod_1.z.boolean().optional().default(false), // true if this geo is used in any source
|
|
145
145
|
});
|
|
146
|
+
exports.zodGeoSelectionGroupSchema = zod_1.z.object({
|
|
147
|
+
_id: zod_1.z.string().optional(),
|
|
148
|
+
slug: zod_1.z.string(),
|
|
149
|
+
description: zod_1.z.string().optional(),
|
|
150
|
+
created_at: zod_1.z.number().optional(),
|
|
151
|
+
updated_at: zod_1.z.number().optional(),
|
|
152
|
+
notes: zod_1.z.string().optional(), // internal notes about the geo selection group
|
|
153
|
+
});
|
|
146
154
|
exports.zodGeoSelectionSchema = zod_1.z.object({
|
|
147
155
|
_id: zod_1.z.string().optional(),
|
|
156
|
+
geo_selection_group_id: zod_1.z.string().optional(),
|
|
148
157
|
title: zod_1.z.string().optional(),
|
|
149
158
|
description: zod_1.z.string().optional(),
|
|
150
159
|
type: zod_1.z.string().optional(),
|
|
@@ -418,3 +427,37 @@ exports.zodServerReportSchema = zod_1.z.object({
|
|
|
418
427
|
})
|
|
419
428
|
.optional(),
|
|
420
429
|
});
|
|
430
|
+
// -------------------
|
|
431
|
+
/**
|
|
432
|
+
* Harvester events
|
|
433
|
+
*/
|
|
434
|
+
exports.zodEventSchema = zod_1.z.object({
|
|
435
|
+
_id: zod_1.z.string().optional(),
|
|
436
|
+
region_id: zod_1.z.string(),
|
|
437
|
+
geo_selection_id: zod_1.z.string().optional(),
|
|
438
|
+
geo_selection_title: zod_1.z.string().optional(),
|
|
439
|
+
type: zod_1.z.string(),
|
|
440
|
+
title: zod_1.z.string(),
|
|
441
|
+
data_short: zod_1.z.string().optional(),
|
|
442
|
+
data: zod_1.z.string(),
|
|
443
|
+
created_at: zod_1.z.number(),
|
|
444
|
+
updated_at: zod_1.z.number(),
|
|
445
|
+
keywords: zod_1.z.array(zod_1.z.string()).optional(),
|
|
446
|
+
geo_selection: exports.zodGeoSelectionSchema,
|
|
447
|
+
raw_data: zod_1.z
|
|
448
|
+
.array(zod_1.z.object({
|
|
449
|
+
_id: zod_1.z.string().optional(),
|
|
450
|
+
platform: zod_1.z.enum(exports.platformsList),
|
|
451
|
+
source_id: zod_1.z.string().or(zod_1.z.number()),
|
|
452
|
+
data_id: zod_1.z.string().or(zod_1.z.number()),
|
|
453
|
+
data_url: zod_1.z.string().url().optional(),
|
|
454
|
+
data_text: zod_1.z.string().optional(),
|
|
455
|
+
author_username: zod_1.z.string().optional(),
|
|
456
|
+
author_id: zod_1.z.string().optional(),
|
|
457
|
+
timestamp: zod_1.z.number().optional(),
|
|
458
|
+
data_geo: zod_1.z.array(zod_1.z.string()).optional().default([]),
|
|
459
|
+
data_region_id: zod_1.z.string().optional(),
|
|
460
|
+
}))
|
|
461
|
+
.optional(),
|
|
462
|
+
embeddings: zod_1.z.array(zod_1.z.number()).optional(), // e.g., vector embeddings for ML tasks
|
|
463
|
+
});
|
package/index.ts
CHANGED
|
@@ -294,8 +294,11 @@ export const MongoGeoSchema = new Schema(
|
|
|
294
294
|
},
|
|
295
295
|
);
|
|
296
296
|
|
|
297
|
+
|
|
298
|
+
|
|
297
299
|
export const MongoGeoSelectionSchema = new Schema(
|
|
298
300
|
{
|
|
301
|
+
geo_selection_group_id: { type: String }, // e.g., geo selection group ID
|
|
299
302
|
title: { type: String }, // e.g., "New York, USA"
|
|
300
303
|
description: { type: String }, // e.g., "A city in the USA"
|
|
301
304
|
type: { type: String }, // e.g., "city", "region", "country"
|
|
@@ -377,3 +380,59 @@ export const MongoServerReportSchema = new Schema(
|
|
|
377
380
|
toObject: { virtuals: true },
|
|
378
381
|
},
|
|
379
382
|
);
|
|
383
|
+
|
|
384
|
+
export const MongoEventSchema = new Schema(
|
|
385
|
+
{
|
|
386
|
+
event_id: { type: String }, // unique identifier for the event
|
|
387
|
+
timestamp: { type: Number, default: Date.now }, // event creation timestamp
|
|
388
|
+
region_id: { type: String }, // e.g., region ID
|
|
389
|
+
geo_selection_id: { type: String }, // e.g., geo selection ID
|
|
390
|
+
geo_selection_title: { type: String }, // e.g., geo selection title
|
|
391
|
+
type: { type: String }, // e.g., 'alert', 'info'
|
|
392
|
+
title: { type: String }, // e.g., 'Red sea escalating'
|
|
393
|
+
data_short: { type: String }, // e.g., 'overview of the event'
|
|
394
|
+
data: { type: String }, // in depth data about the event, this string is updated each time the object is updated
|
|
395
|
+
created_at: { type: Number, default: Date.now }, // creation date
|
|
396
|
+
updated_at: { type: Number, default: Date.now }, // last update date
|
|
397
|
+
keywords: { type: [String], default: [] }, // e.g., ['red sea', 'escalating']
|
|
398
|
+
geo_selection: { type: Schema.Types.Mixed }, // embedded geo selection object
|
|
399
|
+
raw_data: {
|
|
400
|
+
type: [
|
|
401
|
+
{
|
|
402
|
+
platform: { type: String, enum: platformsList },
|
|
403
|
+
source_id: { type: Schema.Types.Mixed },
|
|
404
|
+
data_id: { type: Schema.Types.Mixed },
|
|
405
|
+
data_url: { type: String },
|
|
406
|
+
data_text: { type: String },
|
|
407
|
+
author_username: { type: String },
|
|
408
|
+
author_id: { type: String },
|
|
409
|
+
timestamp: { type: Number },
|
|
410
|
+
data_geo: { type: [String], default: [] },
|
|
411
|
+
data_region_id: { type: String },
|
|
412
|
+
},
|
|
413
|
+
],
|
|
414
|
+
default: undefined,
|
|
415
|
+
}, // raw data items that triggered the event
|
|
416
|
+
embeddings: { type: [Number], default: [] }, // vector embeddings for ML tasks
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
versionKey: false,
|
|
420
|
+
toJSON: { virtuals: true },
|
|
421
|
+
toObject: { virtuals: true },
|
|
422
|
+
},
|
|
423
|
+
);
|
|
424
|
+
|
|
425
|
+
export const MongoGeoSelectionGroupSchema = new Schema(
|
|
426
|
+
{
|
|
427
|
+
slug: { type: String, required: true }, // e.g., "group-name"
|
|
428
|
+
description: { type: String }, // e.g., "Description of the group"
|
|
429
|
+
created_at: { type: Number, default: Date.now }, // creation date
|
|
430
|
+
updated_at: { type: Number, default: Date.now }, // last update date
|
|
431
|
+
notes: { type: String }, // internal notes about the geo selection group
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
versionKey: false,
|
|
435
|
+
toJSON: { virtuals: true },
|
|
436
|
+
toObject: { virtuals: true },
|
|
437
|
+
},
|
|
438
|
+
);
|
package/package.json
CHANGED
package/types.ts
CHANGED
|
@@ -24,7 +24,7 @@ export const entityTypesList = [
|
|
|
24
24
|
'channel',
|
|
25
25
|
'hashtag',
|
|
26
26
|
'website',
|
|
27
|
-
'rss'
|
|
27
|
+
'rss',
|
|
28
28
|
] as const;
|
|
29
29
|
|
|
30
30
|
// Platform-specific entity mappings
|
|
@@ -97,7 +97,7 @@ export const zodSourceGroupSchema = z.object({
|
|
|
97
97
|
error_count: z.number().optional(),
|
|
98
98
|
total_posts: z.number().optional(),
|
|
99
99
|
sources_discovered: z.number().optional(),
|
|
100
|
-
})
|
|
100
|
+
}),
|
|
101
101
|
)
|
|
102
102
|
.optional(),
|
|
103
103
|
});
|
|
@@ -155,8 +155,18 @@ export const zodGeoSchema = z.object({
|
|
|
155
155
|
is_used: z.boolean().optional().default(false), // true if this geo is used in any source
|
|
156
156
|
});
|
|
157
157
|
|
|
158
|
+
export const zodGeoSelectionGroupSchema = z.object({
|
|
159
|
+
_id: z.string().optional(),
|
|
160
|
+
slug: z.string(), // e.g., "group-name"
|
|
161
|
+
description: z.string().optional(), // e.g., "Description of the group"
|
|
162
|
+
created_at: z.number().optional(), // creation date
|
|
163
|
+
updated_at: z.number().optional(), // last update date
|
|
164
|
+
notes: z.string().optional(), // internal notes about the geo selection group
|
|
165
|
+
});
|
|
166
|
+
|
|
158
167
|
export const zodGeoSelectionSchema = z.object({
|
|
159
168
|
_id: z.string().optional(),
|
|
169
|
+
geo_selection_group_id: z.string().optional(), // e.g., geo selection group ID
|
|
160
170
|
title: z.string().optional(), // e.g., "New York, USA"
|
|
161
171
|
description: z.string().optional(), // e.g., "A city in the USA"
|
|
162
172
|
type: z.string().optional(), // e.g., "city", "region", "country"
|
|
@@ -471,6 +481,7 @@ export type MediaItemType = z.infer<typeof mediaItemSchema>;
|
|
|
471
481
|
export type AuthorType = z.infer<typeof authorSchema>;
|
|
472
482
|
export type RepliesInfoType = z.infer<typeof repliesInfoSchema>;
|
|
473
483
|
export type GeoType = z.infer<typeof zodGeoSchema>;
|
|
484
|
+
export type GeoSelectionGroupType = z.infer<typeof zodGeoSelectionGroupSchema>;
|
|
474
485
|
export type GeoSelectionType = z.infer<typeof zodGeoSelectionSchema>;
|
|
475
486
|
export type DashboardStatsType = z.infer<typeof zodDashboardStatsSchema>;
|
|
476
487
|
export type RegionSummaryType = z.infer<typeof zodRegionSummarySchema>;
|
|
@@ -482,3 +493,43 @@ export type FacebookMetadataType = z.infer<typeof facebookMetadataSchema>;
|
|
|
482
493
|
export type InstagramMetadataType = z.infer<typeof instagramMetadataSchema>;
|
|
483
494
|
export type TiktokMetadataType = z.infer<typeof tiktokMetadataSchema>;
|
|
484
495
|
export type WebsiteMetadataType = z.infer<typeof websiteMetadataSchema>;
|
|
496
|
+
|
|
497
|
+
// -------------------
|
|
498
|
+
/**
|
|
499
|
+
* Harvester events
|
|
500
|
+
*/
|
|
501
|
+
|
|
502
|
+
export const zodEventSchema = z.object({
|
|
503
|
+
_id: z.string().optional(),
|
|
504
|
+
region_id: z.string(), // e.g., region ID
|
|
505
|
+
geo_selection_id: z.string().optional(), // e.g., geo selection ID
|
|
506
|
+
geo_selection_title: z.string().optional(), // e.g., geo selection title
|
|
507
|
+
type: z.string(), // e.g., 'alert', 'info'
|
|
508
|
+
title: z.string(), // e.g., 'Red sea escalating'
|
|
509
|
+
data_short: z.string().optional(), // e.g., 'overview of the event'
|
|
510
|
+
data: z.string(), // in depth data about the event, this string is updated each time the object is updated
|
|
511
|
+
created_at: z.number(), // e.g., 1751210833000
|
|
512
|
+
updated_at: z.number(), // e.g., 1751210833000
|
|
513
|
+
keywords: z.array(z.string()).optional(), // e.g., ['red sea', 'escalating']
|
|
514
|
+
geo_selection: zodGeoSelectionSchema,
|
|
515
|
+
raw_data: z
|
|
516
|
+
.array(
|
|
517
|
+
z.object({
|
|
518
|
+
_id: z.string().optional(),
|
|
519
|
+
platform: z.enum(platformsList),
|
|
520
|
+
source_id: z.string().or(z.number()),
|
|
521
|
+
data_id: z.string().or(z.number()),
|
|
522
|
+
data_url: z.string().url().optional(),
|
|
523
|
+
data_text: z.string().optional(),
|
|
524
|
+
author_username: z.string().optional(),
|
|
525
|
+
author_id: z.string().optional(),
|
|
526
|
+
timestamp: z.number().optional(),
|
|
527
|
+
data_geo: z.array(z.string()).optional().default([]),
|
|
528
|
+
data_region_id: z.string().optional(),
|
|
529
|
+
}),
|
|
530
|
+
)
|
|
531
|
+
.optional(), // raw data items that triggered the event
|
|
532
|
+
embeddings: z.array(z.number()).optional(), // e.g., vector embeddings for ML tasks
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
export type EventType = z.infer<typeof zodEventSchema>;
|