harvester_sdk 1.0.56 → 1.0.58
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 +79 -0
- package/dist/index.js +34 -4
- package/dist/types.d.ts +79 -0
- package/dist/types.js +36 -3
- package/index.ts +37 -2
- package/package.json +1 -1
- package/types.ts +40 -1
package/dist/index.d.ts
CHANGED
|
@@ -336,6 +336,7 @@ export declare const MongoRegionSchema: Schema<any, import("mongoose").Model<any
|
|
|
336
336
|
created_at: number;
|
|
337
337
|
updated_at: number;
|
|
338
338
|
status: "active" | "inactive" | "deleted";
|
|
339
|
+
consume_languages: string[];
|
|
339
340
|
legend?: string | null | undefined;
|
|
340
341
|
notes?: string | null | undefined;
|
|
341
342
|
coordinates?: {
|
|
@@ -348,6 +349,7 @@ export declare const MongoRegionSchema: Schema<any, import("mongoose").Model<any
|
|
|
348
349
|
created_at: number;
|
|
349
350
|
updated_at: number;
|
|
350
351
|
status: "active" | "inactive" | "deleted";
|
|
352
|
+
consume_languages: string[];
|
|
351
353
|
legend?: string | null | undefined;
|
|
352
354
|
notes?: string | null | undefined;
|
|
353
355
|
coordinates?: {
|
|
@@ -360,6 +362,7 @@ export declare const MongoRegionSchema: Schema<any, import("mongoose").Model<any
|
|
|
360
362
|
created_at: number;
|
|
361
363
|
updated_at: number;
|
|
362
364
|
status: "active" | "inactive" | "deleted";
|
|
365
|
+
consume_languages: string[];
|
|
363
366
|
legend?: string | null | undefined;
|
|
364
367
|
notes?: string | null | undefined;
|
|
365
368
|
coordinates?: {
|
|
@@ -824,6 +827,12 @@ export declare const MongoEventSchema: Schema<any, import("mongoose").Model<any,
|
|
|
824
827
|
author_id?: string | null | undefined;
|
|
825
828
|
data_region_id?: string | null | undefined;
|
|
826
829
|
}> | null | undefined;
|
|
830
|
+
translated_data?: Map<string, {
|
|
831
|
+
keywords: string[];
|
|
832
|
+
title?: string | null | undefined;
|
|
833
|
+
data_short?: string | null | undefined;
|
|
834
|
+
data?: string | null | undefined;
|
|
835
|
+
}> | null | undefined;
|
|
827
836
|
event_id?: string | null | undefined;
|
|
828
837
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
829
838
|
created_at: number;
|
|
@@ -873,6 +882,12 @@ export declare const MongoEventSchema: Schema<any, import("mongoose").Model<any,
|
|
|
873
882
|
author_id?: string | null | undefined;
|
|
874
883
|
data_region_id?: string | null | undefined;
|
|
875
884
|
}> | null | undefined;
|
|
885
|
+
translated_data?: Map<string, {
|
|
886
|
+
keywords: string[];
|
|
887
|
+
title?: string | null | undefined;
|
|
888
|
+
data_short?: string | null | undefined;
|
|
889
|
+
data?: string | null | undefined;
|
|
890
|
+
}> | null | undefined;
|
|
876
891
|
event_id?: string | null | undefined;
|
|
877
892
|
}>, {}> & import("mongoose").FlatRecord<{
|
|
878
893
|
created_at: number;
|
|
@@ -922,12 +937,67 @@ export declare const MongoEventSchema: Schema<any, import("mongoose").Model<any,
|
|
|
922
937
|
author_id?: string | null | undefined;
|
|
923
938
|
data_region_id?: string | null | undefined;
|
|
924
939
|
}> | null | undefined;
|
|
940
|
+
translated_data?: Map<string, {
|
|
941
|
+
keywords: string[];
|
|
942
|
+
title?: string | null | undefined;
|
|
943
|
+
data_short?: string | null | undefined;
|
|
944
|
+
data?: string | null | undefined;
|
|
945
|
+
}> | null | undefined;
|
|
925
946
|
event_id?: string | null | undefined;
|
|
926
947
|
}> & {
|
|
927
948
|
_id: import("mongoose").Types.ObjectId;
|
|
928
949
|
} & {
|
|
929
950
|
__v: number;
|
|
930
951
|
}>;
|
|
952
|
+
export declare const MongoEventMonitoringSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
953
|
+
versionKey: false;
|
|
954
|
+
toJSON: {
|
|
955
|
+
virtuals: true;
|
|
956
|
+
};
|
|
957
|
+
toObject: {
|
|
958
|
+
virtuals: true;
|
|
959
|
+
};
|
|
960
|
+
}, {
|
|
961
|
+
created_at: number;
|
|
962
|
+
region_id: string;
|
|
963
|
+
geo_selection_id: string;
|
|
964
|
+
geo_selection_title: string;
|
|
965
|
+
event_ids: string[];
|
|
966
|
+
data_count: number;
|
|
967
|
+
existing_events_count: number;
|
|
968
|
+
events_updated: number;
|
|
969
|
+
events_created: number;
|
|
970
|
+
skipped: boolean;
|
|
971
|
+
geo_selection_group_id?: string | null | undefined;
|
|
972
|
+
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
973
|
+
created_at: number;
|
|
974
|
+
region_id: string;
|
|
975
|
+
geo_selection_id: string;
|
|
976
|
+
geo_selection_title: string;
|
|
977
|
+
event_ids: string[];
|
|
978
|
+
data_count: number;
|
|
979
|
+
existing_events_count: number;
|
|
980
|
+
events_updated: number;
|
|
981
|
+
events_created: number;
|
|
982
|
+
skipped: boolean;
|
|
983
|
+
geo_selection_group_id?: string | null | undefined;
|
|
984
|
+
}>, {}> & import("mongoose").FlatRecord<{
|
|
985
|
+
created_at: number;
|
|
986
|
+
region_id: string;
|
|
987
|
+
geo_selection_id: string;
|
|
988
|
+
geo_selection_title: string;
|
|
989
|
+
event_ids: string[];
|
|
990
|
+
data_count: number;
|
|
991
|
+
existing_events_count: number;
|
|
992
|
+
events_updated: number;
|
|
993
|
+
events_created: number;
|
|
994
|
+
skipped: boolean;
|
|
995
|
+
geo_selection_group_id?: string | null | undefined;
|
|
996
|
+
}> & {
|
|
997
|
+
_id: import("mongoose").Types.ObjectId;
|
|
998
|
+
} & {
|
|
999
|
+
__v: number;
|
|
1000
|
+
}>;
|
|
931
1001
|
export declare const MongoGeoSelectionGroupSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
932
1002
|
versionKey: false;
|
|
933
1003
|
toJSON: {
|
|
@@ -942,18 +1012,27 @@ export declare const MongoGeoSelectionGroupSchema: Schema<any, import("mongoose"
|
|
|
942
1012
|
updated_at: number;
|
|
943
1013
|
notes?: string | null | undefined;
|
|
944
1014
|
description?: string | null | undefined;
|
|
1015
|
+
region_id?: string | null | undefined;
|
|
1016
|
+
user_id?: string | null | undefined;
|
|
1017
|
+
limit?: number | null | undefined;
|
|
945
1018
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
946
1019
|
slug: string;
|
|
947
1020
|
created_at: number;
|
|
948
1021
|
updated_at: number;
|
|
949
1022
|
notes?: string | null | undefined;
|
|
950
1023
|
description?: string | null | undefined;
|
|
1024
|
+
region_id?: string | null | undefined;
|
|
1025
|
+
user_id?: string | null | undefined;
|
|
1026
|
+
limit?: number | null | undefined;
|
|
951
1027
|
}>, {}> & import("mongoose").FlatRecord<{
|
|
952
1028
|
slug: string;
|
|
953
1029
|
created_at: number;
|
|
954
1030
|
updated_at: number;
|
|
955
1031
|
notes?: string | null | undefined;
|
|
956
1032
|
description?: string | null | undefined;
|
|
1033
|
+
region_id?: string | null | undefined;
|
|
1034
|
+
user_id?: string | null | undefined;
|
|
1035
|
+
limit?: number | null | undefined;
|
|
957
1036
|
}> & {
|
|
958
1037
|
_id: import("mongoose").Types.ObjectId;
|
|
959
1038
|
} & {
|
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.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;
|
|
17
|
+
exports.MongoGeoSelectionGroupSchema = exports.MongoEventMonitoringSchema = 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
|
|
@@ -167,7 +167,8 @@ exports.MongoRegionSchema = new mongoose_1.Schema({
|
|
|
167
167
|
coordinates: {
|
|
168
168
|
type: { type: String, enum: ['point', 'polygon'] },
|
|
169
169
|
coordinates: { type: mongoose_1.Schema.Types.Mixed },
|
|
170
|
-
},
|
|
170
|
+
},
|
|
171
|
+
consume_languages: { type: [String] }, // e.g., dominant user languages that consume content from this region
|
|
171
172
|
}, {
|
|
172
173
|
versionKey: false,
|
|
173
174
|
toJSON: { virtuals: true },
|
|
@@ -373,18 +374,47 @@ exports.MongoEventSchema = new mongoose_1.Schema({
|
|
|
373
374
|
],
|
|
374
375
|
default: undefined,
|
|
375
376
|
},
|
|
376
|
-
embeddings: { type: [Number], default: [] },
|
|
377
|
+
embeddings: { type: [Number], default: [] },
|
|
378
|
+
translated_data: {
|
|
379
|
+
type: Map,
|
|
380
|
+
of: new mongoose_1.Schema({
|
|
381
|
+
title: { type: String },
|
|
382
|
+
data_short: { type: String },
|
|
383
|
+
data: { type: String },
|
|
384
|
+
keywords: { type: [String], default: [] },
|
|
385
|
+
}),
|
|
386
|
+
}, // translated data for different languages, e.g., { "en": { title, data_short, data, keywords }, "ar": { ... } }
|
|
387
|
+
}, {
|
|
388
|
+
versionKey: false,
|
|
389
|
+
toJSON: { virtuals: true },
|
|
390
|
+
toObject: { virtuals: true },
|
|
391
|
+
});
|
|
392
|
+
exports.MongoEventMonitoringSchema = new mongoose_1.Schema({
|
|
393
|
+
geo_selection_id: { type: String, required: true },
|
|
394
|
+
geo_selection_title: { type: String, required: true },
|
|
395
|
+
region_id: { type: String, required: true },
|
|
396
|
+
geo_selection_group_id: { type: String },
|
|
397
|
+
event_ids: { type: [String], default: [] },
|
|
398
|
+
data_count: { type: Number, required: true },
|
|
399
|
+
existing_events_count: { type: Number, required: true },
|
|
400
|
+
events_updated: { type: Number, required: true },
|
|
401
|
+
events_created: { type: Number, required: true },
|
|
402
|
+
skipped: { type: Boolean, required: true },
|
|
403
|
+
created_at: { type: Number, default: Date.now, required: true },
|
|
377
404
|
}, {
|
|
378
405
|
versionKey: false,
|
|
379
406
|
toJSON: { virtuals: true },
|
|
380
407
|
toObject: { virtuals: true },
|
|
381
408
|
});
|
|
382
409
|
exports.MongoGeoSelectionGroupSchema = new mongoose_1.Schema({
|
|
410
|
+
region_id: { type: String },
|
|
383
411
|
slug: { type: String, required: true },
|
|
384
412
|
description: { type: String },
|
|
385
413
|
created_at: { type: Number, default: Date.now },
|
|
386
414
|
updated_at: { type: Number, default: Date.now },
|
|
387
|
-
notes: { type: String },
|
|
415
|
+
notes: { type: String },
|
|
416
|
+
limit: { type: Number },
|
|
417
|
+
user_id: { type: String }, // optional user ID of the creator/owner of this group
|
|
388
418
|
}, {
|
|
389
419
|
versionKey: false,
|
|
390
420
|
toJSON: { virtuals: true },
|
package/dist/types.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare const platformEntityMap: {
|
|
|
10
10
|
};
|
|
11
11
|
export declare const priorityLevels: readonly ["none", "low", "medium", "high", "critical"];
|
|
12
12
|
export declare const sourceStatusList: readonly ["active", "pending", "inactive", "requested", "discovered", "deleted"];
|
|
13
|
+
export declare const userLanguagesList: readonly ["hebrew", "arabic", "french", "german", "chinese", "russian", "portuguese", "spanish"];
|
|
13
14
|
export declare const generalStatusList: readonly ["active", "inactive", "deleted"];
|
|
14
15
|
export declare const zodRegionSchema: z.ZodObject<{
|
|
15
16
|
_id: z.ZodOptional<z.ZodString>;
|
|
@@ -30,6 +31,7 @@ export declare const zodRegionSchema: z.ZodObject<{
|
|
|
30
31
|
type?: "point" | "polygon" | undefined;
|
|
31
32
|
coordinates?: [number, number] | [number, number][] | undefined;
|
|
32
33
|
}>>;
|
|
34
|
+
consume_languages: z.ZodOptional<z.ZodArray<z.ZodEnum<["hebrew", "arabic", "french", "german", "chinese", "russian", "portuguese", "spanish"]>, "many">>;
|
|
33
35
|
}, "strip", z.ZodTypeAny, {
|
|
34
36
|
name: string;
|
|
35
37
|
slug: string;
|
|
@@ -43,6 +45,7 @@ export declare const zodRegionSchema: z.ZodObject<{
|
|
|
43
45
|
type?: "point" | "polygon" | undefined;
|
|
44
46
|
coordinates?: [number, number] | [number, number][] | undefined;
|
|
45
47
|
} | undefined;
|
|
48
|
+
consume_languages?: ("hebrew" | "arabic" | "french" | "german" | "chinese" | "russian" | "portuguese" | "spanish")[] | undefined;
|
|
46
49
|
}, {
|
|
47
50
|
name: string;
|
|
48
51
|
slug: string;
|
|
@@ -56,6 +59,7 @@ export declare const zodRegionSchema: z.ZodObject<{
|
|
|
56
59
|
type?: "point" | "polygon" | undefined;
|
|
57
60
|
coordinates?: [number, number] | [number, number][] | undefined;
|
|
58
61
|
} | undefined;
|
|
62
|
+
consume_languages?: ("hebrew" | "arabic" | "french" | "german" | "chinese" | "russian" | "portuguese" | "spanish")[] | undefined;
|
|
59
63
|
}>;
|
|
60
64
|
export declare const zodSourceGroupSchema: z.ZodObject<{
|
|
61
65
|
_id: z.ZodOptional<z.ZodString>;
|
|
@@ -286,25 +290,34 @@ export declare const zodGeoSchema: z.ZodObject<{
|
|
|
286
290
|
}>;
|
|
287
291
|
export declare const zodGeoSelectionGroupSchema: z.ZodObject<{
|
|
288
292
|
_id: z.ZodOptional<z.ZodString>;
|
|
293
|
+
region_id: z.ZodString;
|
|
289
294
|
slug: z.ZodString;
|
|
290
295
|
description: z.ZodOptional<z.ZodString>;
|
|
291
296
|
created_at: z.ZodOptional<z.ZodNumber>;
|
|
292
297
|
updated_at: z.ZodOptional<z.ZodNumber>;
|
|
293
298
|
notes: z.ZodOptional<z.ZodString>;
|
|
299
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
300
|
+
user_id: z.ZodOptional<z.ZodString>;
|
|
294
301
|
}, "strip", z.ZodTypeAny, {
|
|
295
302
|
slug: string;
|
|
303
|
+
region_id: string;
|
|
296
304
|
_id?: string | undefined;
|
|
297
305
|
created_at?: number | undefined;
|
|
298
306
|
updated_at?: number | undefined;
|
|
299
307
|
notes?: string | undefined;
|
|
300
308
|
description?: string | undefined;
|
|
309
|
+
user_id?: string | undefined;
|
|
310
|
+
limit?: number | undefined;
|
|
301
311
|
}, {
|
|
302
312
|
slug: string;
|
|
313
|
+
region_id: string;
|
|
303
314
|
_id?: string | undefined;
|
|
304
315
|
created_at?: number | undefined;
|
|
305
316
|
updated_at?: number | undefined;
|
|
306
317
|
notes?: string | undefined;
|
|
307
318
|
description?: string | undefined;
|
|
319
|
+
user_id?: string | undefined;
|
|
320
|
+
limit?: number | undefined;
|
|
308
321
|
}>;
|
|
309
322
|
export declare const zodGeoSelectionSchema: z.ZodObject<{
|
|
310
323
|
_id: z.ZodOptional<z.ZodString>;
|
|
@@ -2231,6 +2244,22 @@ export declare const zodEventSchema: z.ZodObject<{
|
|
|
2231
2244
|
data_region_id?: string | undefined;
|
|
2232
2245
|
}>, "many">>;
|
|
2233
2246
|
embeddings: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
2247
|
+
translated_data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2248
|
+
title: z.ZodString;
|
|
2249
|
+
data_short: z.ZodString;
|
|
2250
|
+
data: z.ZodString;
|
|
2251
|
+
keywords: z.ZodArray<z.ZodString, "many">;
|
|
2252
|
+
}, "strip", z.ZodTypeAny, {
|
|
2253
|
+
title: string;
|
|
2254
|
+
keywords: string[];
|
|
2255
|
+
data_short: string;
|
|
2256
|
+
data: string;
|
|
2257
|
+
}, {
|
|
2258
|
+
title: string;
|
|
2259
|
+
keywords: string[];
|
|
2260
|
+
data_short: string;
|
|
2261
|
+
data: string;
|
|
2262
|
+
}>>>;
|
|
2234
2263
|
}, "strip", z.ZodTypeAny, {
|
|
2235
2264
|
created_at: number;
|
|
2236
2265
|
updated_at: number;
|
|
@@ -2276,6 +2305,12 @@ export declare const zodEventSchema: z.ZodObject<{
|
|
|
2276
2305
|
author_id?: string | undefined;
|
|
2277
2306
|
data_region_id?: string | undefined;
|
|
2278
2307
|
}[] | undefined;
|
|
2308
|
+
translated_data?: Record<string, {
|
|
2309
|
+
title: string;
|
|
2310
|
+
keywords: string[];
|
|
2311
|
+
data_short: string;
|
|
2312
|
+
data: string;
|
|
2313
|
+
}> | undefined;
|
|
2279
2314
|
}, {
|
|
2280
2315
|
created_at: number;
|
|
2281
2316
|
updated_at: number;
|
|
@@ -2321,5 +2356,49 @@ export declare const zodEventSchema: z.ZodObject<{
|
|
|
2321
2356
|
author_id?: string | undefined;
|
|
2322
2357
|
data_region_id?: string | undefined;
|
|
2323
2358
|
}[] | undefined;
|
|
2359
|
+
translated_data?: Record<string, {
|
|
2360
|
+
title: string;
|
|
2361
|
+
keywords: string[];
|
|
2362
|
+
data_short: string;
|
|
2363
|
+
data: string;
|
|
2364
|
+
}> | undefined;
|
|
2365
|
+
}>;
|
|
2366
|
+
export declare const zodEventMonitoringSchema: z.ZodObject<{
|
|
2367
|
+
geo_selection_id: z.ZodString;
|
|
2368
|
+
geo_selection_title: z.ZodString;
|
|
2369
|
+
region_id: z.ZodString;
|
|
2370
|
+
geo_selection_group_id: z.ZodOptional<z.ZodString>;
|
|
2371
|
+
event_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
2372
|
+
data_count: z.ZodNumber;
|
|
2373
|
+
existing_events_count: z.ZodNumber;
|
|
2374
|
+
events_updated: z.ZodNumber;
|
|
2375
|
+
events_created: z.ZodNumber;
|
|
2376
|
+
skipped: z.ZodBoolean;
|
|
2377
|
+
created_at: z.ZodNumber;
|
|
2378
|
+
}, "strip", z.ZodTypeAny, {
|
|
2379
|
+
created_at: number;
|
|
2380
|
+
region_id: string;
|
|
2381
|
+
geo_selection_id: string;
|
|
2382
|
+
geo_selection_title: string;
|
|
2383
|
+
data_count: number;
|
|
2384
|
+
existing_events_count: number;
|
|
2385
|
+
events_updated: number;
|
|
2386
|
+
events_created: number;
|
|
2387
|
+
skipped: boolean;
|
|
2388
|
+
geo_selection_group_id?: string | undefined;
|
|
2389
|
+
event_ids?: string[] | undefined;
|
|
2390
|
+
}, {
|
|
2391
|
+
created_at: number;
|
|
2392
|
+
region_id: string;
|
|
2393
|
+
geo_selection_id: string;
|
|
2394
|
+
geo_selection_title: string;
|
|
2395
|
+
data_count: number;
|
|
2396
|
+
existing_events_count: number;
|
|
2397
|
+
events_updated: number;
|
|
2398
|
+
events_created: number;
|
|
2399
|
+
skipped: boolean;
|
|
2400
|
+
geo_selection_group_id?: string | undefined;
|
|
2401
|
+
event_ids?: string[] | undefined;
|
|
2324
2402
|
}>;
|
|
2325
2403
|
export type EventType = z.infer<typeof zodEventSchema>;
|
|
2404
|
+
export type EventMonitoringType = z.infer<typeof zodEventMonitoringSchema>;
|
package/dist/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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;
|
|
3
|
+
exports.zodEventMonitoringSchema = 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.userLanguagesList = 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',
|
|
@@ -50,6 +50,16 @@ exports.sourceStatusList = [
|
|
|
50
50
|
'discovered',
|
|
51
51
|
'deleted', // sources that have been deleted
|
|
52
52
|
];
|
|
53
|
+
exports.userLanguagesList = [
|
|
54
|
+
'hebrew',
|
|
55
|
+
'arabic',
|
|
56
|
+
'french',
|
|
57
|
+
'german',
|
|
58
|
+
'chinese',
|
|
59
|
+
'russian',
|
|
60
|
+
'portuguese',
|
|
61
|
+
'spanish',
|
|
62
|
+
];
|
|
53
63
|
exports.generalStatusList = ['active', 'inactive', 'deleted'];
|
|
54
64
|
exports.zodRegionSchema = zod_1.z.object({
|
|
55
65
|
_id: zod_1.z.string().optional(),
|
|
@@ -71,6 +81,7 @@ exports.zodRegionSchema = zod_1.z.object({
|
|
|
71
81
|
.optional(),
|
|
72
82
|
})
|
|
73
83
|
.optional(),
|
|
84
|
+
consume_languages: zod_1.z.array(zod_1.z.enum(exports.userLanguagesList)).optional(), // e.g., dominant user languages that consume content from this region
|
|
74
85
|
});
|
|
75
86
|
exports.zodSourceGroupSchema = zod_1.z.object({
|
|
76
87
|
_id: zod_1.z.string().optional(),
|
|
@@ -145,11 +156,14 @@ exports.zodGeoSchema = zod_1.z.object({
|
|
|
145
156
|
});
|
|
146
157
|
exports.zodGeoSelectionGroupSchema = zod_1.z.object({
|
|
147
158
|
_id: zod_1.z.string().optional(),
|
|
159
|
+
region_id: zod_1.z.string(),
|
|
148
160
|
slug: zod_1.z.string(),
|
|
149
161
|
description: zod_1.z.string().optional(),
|
|
150
162
|
created_at: zod_1.z.number().optional(),
|
|
151
163
|
updated_at: zod_1.z.number().optional(),
|
|
152
|
-
notes: zod_1.z.string().optional(),
|
|
164
|
+
notes: zod_1.z.string().optional(),
|
|
165
|
+
limit: zod_1.z.number().optional(),
|
|
166
|
+
user_id: zod_1.z.string().optional(), // user who created this geo selection group
|
|
153
167
|
});
|
|
154
168
|
exports.zodGeoSelectionSchema = zod_1.z.object({
|
|
155
169
|
_id: zod_1.z.string().optional(),
|
|
@@ -459,5 +473,24 @@ exports.zodEventSchema = zod_1.z.object({
|
|
|
459
473
|
data_region_id: zod_1.z.string().optional(),
|
|
460
474
|
}))
|
|
461
475
|
.optional(),
|
|
462
|
-
embeddings: zod_1.z.array(zod_1.z.number()).optional(),
|
|
476
|
+
embeddings: zod_1.z.array(zod_1.z.number()).optional(),
|
|
477
|
+
translated_data: zod_1.z.record(zod_1.z.string(), zod_1.z.object({
|
|
478
|
+
title: zod_1.z.string(),
|
|
479
|
+
data_short: zod_1.z.string(),
|
|
480
|
+
data: zod_1.z.string(),
|
|
481
|
+
keywords: zod_1.z.array(zod_1.z.string()),
|
|
482
|
+
})).optional(),
|
|
483
|
+
});
|
|
484
|
+
exports.zodEventMonitoringSchema = zod_1.z.object({
|
|
485
|
+
geo_selection_id: zod_1.z.string(),
|
|
486
|
+
geo_selection_title: zod_1.z.string(),
|
|
487
|
+
region_id: zod_1.z.string(),
|
|
488
|
+
geo_selection_group_id: zod_1.z.string().optional(),
|
|
489
|
+
event_ids: zod_1.z.array(zod_1.z.string()).optional(),
|
|
490
|
+
data_count: zod_1.z.number(),
|
|
491
|
+
existing_events_count: zod_1.z.number(),
|
|
492
|
+
events_updated: zod_1.z.number(),
|
|
493
|
+
events_created: zod_1.z.number(),
|
|
494
|
+
skipped: zod_1.z.boolean(),
|
|
495
|
+
created_at: zod_1.z.number(),
|
|
463
496
|
});
|
package/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
platformsList,
|
|
12
12
|
sourceStatusList,
|
|
13
13
|
priorityLevels,
|
|
14
|
+
userLanguagesList,
|
|
14
15
|
} from './types';
|
|
15
16
|
|
|
16
17
|
export const MongoDataSchema = new Schema(
|
|
@@ -174,6 +175,7 @@ export const MongoRegionSchema = new Schema(
|
|
|
174
175
|
type: { type: String, enum: ['point', 'polygon'] },
|
|
175
176
|
coordinates: { type: Schema.Types.Mixed },
|
|
176
177
|
}, // GeoJSON format
|
|
178
|
+
consume_languages: { type: [String] }, // e.g., dominant user languages that consume content from this region
|
|
177
179
|
},
|
|
178
180
|
{
|
|
179
181
|
versionKey: false,
|
|
@@ -294,8 +296,6 @@ export const MongoGeoSchema = new Schema(
|
|
|
294
296
|
},
|
|
295
297
|
);
|
|
296
298
|
|
|
297
|
-
|
|
298
|
-
|
|
299
299
|
export const MongoGeoSelectionSchema = new Schema(
|
|
300
300
|
{
|
|
301
301
|
geo_selection_group_id: { type: String }, // e.g., geo selection group ID
|
|
@@ -414,6 +414,38 @@ export const MongoEventSchema = new Schema(
|
|
|
414
414
|
default: undefined,
|
|
415
415
|
}, // raw data items that triggered the event
|
|
416
416
|
embeddings: { type: [Number], default: [] }, // vector embeddings for ML tasks
|
|
417
|
+
translated_data: {
|
|
418
|
+
type: Map,
|
|
419
|
+
of: new Schema({
|
|
420
|
+
title: { type: String },
|
|
421
|
+
data_short: { type: String },
|
|
422
|
+
data: { type: String },
|
|
423
|
+
keywords: { type: [String], default: [] },
|
|
424
|
+
}),
|
|
425
|
+
}, // translated data for different languages, e.g., { "en": { title, data_short, data, keywords }, "ar": { ... } }
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
versionKey: false,
|
|
429
|
+
toJSON: { virtuals: true },
|
|
430
|
+
toObject: { virtuals: true },
|
|
431
|
+
},
|
|
432
|
+
);
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
export const MongoEventMonitoringSchema = new Schema(
|
|
437
|
+
{
|
|
438
|
+
geo_selection_id: { type: String, required: true },
|
|
439
|
+
geo_selection_title: { type: String, required: true },
|
|
440
|
+
region_id: { type: String, required: true },
|
|
441
|
+
geo_selection_group_id: { type: String },
|
|
442
|
+
event_ids: { type: [String], default: [] },
|
|
443
|
+
data_count: { type: Number, required: true },
|
|
444
|
+
existing_events_count: { type: Number, required: true },
|
|
445
|
+
events_updated: { type: Number, required: true },
|
|
446
|
+
events_created: { type: Number, required: true },
|
|
447
|
+
skipped: { type: Boolean, required: true },
|
|
448
|
+
created_at: { type: Number, default: Date.now, required: true },
|
|
417
449
|
},
|
|
418
450
|
{
|
|
419
451
|
versionKey: false,
|
|
@@ -424,11 +456,14 @@ export const MongoEventSchema = new Schema(
|
|
|
424
456
|
|
|
425
457
|
export const MongoGeoSelectionGroupSchema = new Schema(
|
|
426
458
|
{
|
|
459
|
+
region_id: { type: String }, // e.g., region ID
|
|
427
460
|
slug: { type: String, required: true }, // e.g., "group-name"
|
|
428
461
|
description: { type: String }, // e.g., "Description of the group"
|
|
429
462
|
created_at: { type: Number, default: Date.now }, // creation date
|
|
430
463
|
updated_at: { type: Number, default: Date.now }, // last update date
|
|
431
464
|
notes: { type: String }, // internal notes about the geo selection group
|
|
465
|
+
limit: { type: Number }, // optional limit for number of geos in this group
|
|
466
|
+
user_id: { type: String }, // optional user ID of the creator/owner of this group
|
|
432
467
|
},
|
|
433
468
|
{
|
|
434
469
|
versionKey: false,
|
package/package.json
CHANGED
package/types.ts
CHANGED
|
@@ -53,6 +53,17 @@ export const sourceStatusList = [
|
|
|
53
53
|
'deleted', // sources that have been deleted
|
|
54
54
|
] as const;
|
|
55
55
|
|
|
56
|
+
export const userLanguagesList = [
|
|
57
|
+
'hebrew',
|
|
58
|
+
'arabic',
|
|
59
|
+
'french',
|
|
60
|
+
'german',
|
|
61
|
+
'chinese',
|
|
62
|
+
'russian',
|
|
63
|
+
'portuguese',
|
|
64
|
+
'spanish',
|
|
65
|
+
] as const;
|
|
66
|
+
|
|
56
67
|
export const generalStatusList = ['active', 'inactive', 'deleted'] as const;
|
|
57
68
|
|
|
58
69
|
export const zodRegionSchema = z.object({
|
|
@@ -75,6 +86,7 @@ export const zodRegionSchema = z.object({
|
|
|
75
86
|
.optional(),
|
|
76
87
|
})
|
|
77
88
|
.optional(),
|
|
89
|
+
consume_languages: z.array(z.enum(userLanguagesList)).optional(), // e.g., dominant user languages that consume content from this region
|
|
78
90
|
});
|
|
79
91
|
|
|
80
92
|
export const zodSourceGroupSchema = z.object({
|
|
@@ -157,11 +169,14 @@ export const zodGeoSchema = z.object({
|
|
|
157
169
|
|
|
158
170
|
export const zodGeoSelectionGroupSchema = z.object({
|
|
159
171
|
_id: z.string().optional(),
|
|
172
|
+
region_id: z.string(), // e.g., region ID
|
|
160
173
|
slug: z.string(), // e.g., "group-name"
|
|
161
174
|
description: z.string().optional(), // e.g., "Description of the group"
|
|
162
175
|
created_at: z.number().optional(), // creation date
|
|
163
176
|
updated_at: z.number().optional(), // last update date
|
|
164
177
|
notes: z.string().optional(), // internal notes about the geo selection group
|
|
178
|
+
limit: z.number().optional(), // e.g., maximum number of geo selections allowed in this group
|
|
179
|
+
user_id: z.string().optional(), // user who created this geo selection group
|
|
165
180
|
});
|
|
166
181
|
|
|
167
182
|
export const zodGeoSelectionSchema = z.object({
|
|
@@ -530,6 +545,30 @@ export const zodEventSchema = z.object({
|
|
|
530
545
|
)
|
|
531
546
|
.optional(), // raw data items that triggered the event
|
|
532
547
|
embeddings: z.array(z.number()).optional(), // e.g., vector embeddings for ML tasks
|
|
548
|
+
translated_data: z.record(
|
|
549
|
+
z.string(),
|
|
550
|
+
z.object({
|
|
551
|
+
title: z.string(),
|
|
552
|
+
data_short: z.string(),
|
|
553
|
+
data: z.string(),
|
|
554
|
+
keywords: z.array(z.string()),
|
|
555
|
+
}),
|
|
556
|
+
).optional(),
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
export const zodEventMonitoringSchema = z.object({
|
|
560
|
+
geo_selection_id: z.string(),
|
|
561
|
+
geo_selection_title: z.string(),
|
|
562
|
+
region_id: z.string(),
|
|
563
|
+
geo_selection_group_id: z.string().optional(),
|
|
564
|
+
event_ids: z.array(z.string()).optional(),
|
|
565
|
+
data_count: z.number(),
|
|
566
|
+
existing_events_count: z.number(),
|
|
567
|
+
events_updated: z.number(),
|
|
568
|
+
events_created: z.number(),
|
|
569
|
+
skipped: z.boolean(),
|
|
570
|
+
created_at: z.number(),
|
|
533
571
|
});
|
|
534
572
|
|
|
535
|
-
export type EventType = z.infer<typeof zodEventSchema>;
|
|
573
|
+
export type EventType = z.infer<typeof zodEventSchema>;
|
|
574
|
+
export type EventMonitoringType = z.infer<typeof zodEventMonitoringSchema>;
|