harvester_sdk 1.0.1 → 1.0.3
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 +18 -18
- package/dist/types.d.ts +20 -60
- package/dist/types.js +19 -15
- package/package.json +1 -1
- package/types.ts +49 -44
package/dist/index.d.ts
CHANGED
|
@@ -260,12 +260,13 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
|
|
|
260
260
|
name: string;
|
|
261
261
|
created_at: number;
|
|
262
262
|
updated_at: number;
|
|
263
|
-
status: "active" | "pending" | "inactive" | "requested";
|
|
263
|
+
status: "active" | "pending" | "inactive" | "requested" | "deleted";
|
|
264
264
|
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website";
|
|
265
265
|
entity: "website" | "profile" | "group" | "page" | "channel" | "hashtag";
|
|
266
266
|
tags: string[];
|
|
267
267
|
is_public: boolean;
|
|
268
268
|
metadata: any;
|
|
269
|
+
notes?: string | null | undefined;
|
|
269
270
|
description?: string | null | undefined;
|
|
270
271
|
region_id?: string | null | undefined;
|
|
271
272
|
title?: string | null | undefined;
|
|
@@ -280,17 +281,17 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
|
|
|
280
281
|
email?: string | null | undefined;
|
|
281
282
|
requested_at?: number | null | undefined;
|
|
282
283
|
} | null | undefined;
|
|
283
|
-
notes?: string | null | undefined;
|
|
284
284
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
285
285
|
name: string;
|
|
286
286
|
created_at: number;
|
|
287
287
|
updated_at: number;
|
|
288
|
-
status: "active" | "pending" | "inactive" | "requested";
|
|
288
|
+
status: "active" | "pending" | "inactive" | "requested" | "deleted";
|
|
289
289
|
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website";
|
|
290
290
|
entity: "website" | "profile" | "group" | "page" | "channel" | "hashtag";
|
|
291
291
|
tags: string[];
|
|
292
292
|
is_public: boolean;
|
|
293
293
|
metadata: any;
|
|
294
|
+
notes?: string | null | undefined;
|
|
294
295
|
description?: string | null | undefined;
|
|
295
296
|
region_id?: string | null | undefined;
|
|
296
297
|
title?: string | null | undefined;
|
|
@@ -305,17 +306,17 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
|
|
|
305
306
|
email?: string | null | undefined;
|
|
306
307
|
requested_at?: number | null | undefined;
|
|
307
308
|
} | null | undefined;
|
|
308
|
-
notes?: string | null | undefined;
|
|
309
309
|
}>, {}> & import("mongoose").FlatRecord<{
|
|
310
310
|
name: string;
|
|
311
311
|
created_at: number;
|
|
312
312
|
updated_at: number;
|
|
313
|
-
status: "active" | "pending" | "inactive" | "requested";
|
|
313
|
+
status: "active" | "pending" | "inactive" | "requested" | "deleted";
|
|
314
314
|
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website";
|
|
315
315
|
entity: "website" | "profile" | "group" | "page" | "channel" | "hashtag";
|
|
316
316
|
tags: string[];
|
|
317
317
|
is_public: boolean;
|
|
318
318
|
metadata: any;
|
|
319
|
+
notes?: string | null | undefined;
|
|
319
320
|
description?: string | null | undefined;
|
|
320
321
|
region_id?: string | null | undefined;
|
|
321
322
|
title?: string | null | undefined;
|
|
@@ -330,7 +331,6 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
|
|
|
330
331
|
email?: string | null | undefined;
|
|
331
332
|
requested_at?: number | null | undefined;
|
|
332
333
|
} | null | undefined;
|
|
333
|
-
notes?: string | null | undefined;
|
|
334
334
|
}> & {
|
|
335
335
|
_id: import("mongoose").Types.ObjectId;
|
|
336
336
|
} & {
|
|
@@ -393,7 +393,7 @@ export declare const MongoUserSettingsSchema: Schema<any, import("mongoose").Mod
|
|
|
393
393
|
}, {
|
|
394
394
|
created_at: NativeDate;
|
|
395
395
|
updated_at: NativeDate;
|
|
396
|
-
status: "active" | "inactive";
|
|
396
|
+
status: "active" | "inactive" | "deleted";
|
|
397
397
|
user_id: string;
|
|
398
398
|
geos: string[];
|
|
399
399
|
sources: string[];
|
|
@@ -405,7 +405,7 @@ export declare const MongoUserSettingsSchema: Schema<any, import("mongoose").Mod
|
|
|
405
405
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
406
406
|
created_at: NativeDate;
|
|
407
407
|
updated_at: NativeDate;
|
|
408
|
-
status: "active" | "inactive";
|
|
408
|
+
status: "active" | "inactive" | "deleted";
|
|
409
409
|
user_id: string;
|
|
410
410
|
geos: string[];
|
|
411
411
|
sources: string[];
|
|
@@ -417,7 +417,7 @@ export declare const MongoUserSettingsSchema: Schema<any, import("mongoose").Mod
|
|
|
417
417
|
}>, {}> & import("mongoose").FlatRecord<{
|
|
418
418
|
created_at: NativeDate;
|
|
419
419
|
updated_at: NativeDate;
|
|
420
|
-
status: "active" | "inactive";
|
|
420
|
+
status: "active" | "inactive" | "deleted";
|
|
421
421
|
user_id: string;
|
|
422
422
|
geos: string[];
|
|
423
423
|
sources: string[];
|
|
@@ -442,7 +442,7 @@ export declare const MongoConversationSchema: Schema<any, import("mongoose").Mod
|
|
|
442
442
|
}, {
|
|
443
443
|
created_at: NativeDate;
|
|
444
444
|
updated_at: NativeDate;
|
|
445
|
-
status: "active" | "inactive";
|
|
445
|
+
status: "active" | "inactive" | "deleted";
|
|
446
446
|
user_id: string;
|
|
447
447
|
is_job: boolean;
|
|
448
448
|
title?: string | null | undefined;
|
|
@@ -450,7 +450,7 @@ export declare const MongoConversationSchema: Schema<any, import("mongoose").Mod
|
|
|
450
450
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
451
451
|
created_at: NativeDate;
|
|
452
452
|
updated_at: NativeDate;
|
|
453
|
-
status: "active" | "inactive";
|
|
453
|
+
status: "active" | "inactive" | "deleted";
|
|
454
454
|
user_id: string;
|
|
455
455
|
is_job: boolean;
|
|
456
456
|
title?: string | null | undefined;
|
|
@@ -458,7 +458,7 @@ export declare const MongoConversationSchema: Schema<any, import("mongoose").Mod
|
|
|
458
458
|
}>, {}> & import("mongoose").FlatRecord<{
|
|
459
459
|
created_at: NativeDate;
|
|
460
460
|
updated_at: NativeDate;
|
|
461
|
-
status: "active" | "inactive";
|
|
461
|
+
status: "active" | "inactive" | "deleted";
|
|
462
462
|
user_id: string;
|
|
463
463
|
is_job: boolean;
|
|
464
464
|
title?: string | null | undefined;
|
|
@@ -479,7 +479,7 @@ export declare const MongoJobSchema: Schema<any, import("mongoose").Model<any, a
|
|
|
479
479
|
}, {
|
|
480
480
|
created_at: number;
|
|
481
481
|
updated_at: number;
|
|
482
|
-
status: "active" | "inactive";
|
|
482
|
+
status: "active" | "inactive" | "deleted";
|
|
483
483
|
user_id: string;
|
|
484
484
|
query: any;
|
|
485
485
|
job_name: string;
|
|
@@ -493,7 +493,7 @@ export declare const MongoJobSchema: Schema<any, import("mongoose").Model<any, a
|
|
|
493
493
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
494
494
|
created_at: number;
|
|
495
495
|
updated_at: number;
|
|
496
|
-
status: "active" | "inactive";
|
|
496
|
+
status: "active" | "inactive" | "deleted";
|
|
497
497
|
user_id: string;
|
|
498
498
|
query: any;
|
|
499
499
|
job_name: string;
|
|
@@ -507,7 +507,7 @@ export declare const MongoJobSchema: Schema<any, import("mongoose").Model<any, a
|
|
|
507
507
|
}>, {}> & import("mongoose").FlatRecord<{
|
|
508
508
|
created_at: number;
|
|
509
509
|
updated_at: number;
|
|
510
|
-
status: "active" | "inactive";
|
|
510
|
+
status: "active" | "inactive" | "deleted";
|
|
511
511
|
user_id: string;
|
|
512
512
|
query: any;
|
|
513
513
|
job_name: string;
|
|
@@ -605,19 +605,19 @@ export declare const MongoApiKeySchema: Schema<any, import("mongoose").Model<any
|
|
|
605
605
|
}, {
|
|
606
606
|
created_at: number;
|
|
607
607
|
updated_at: number;
|
|
608
|
-
status: "active" | "inactive";
|
|
608
|
+
status: "active" | "inactive" | "deleted";
|
|
609
609
|
user_id: string;
|
|
610
610
|
api_key: string;
|
|
611
611
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
612
612
|
created_at: number;
|
|
613
613
|
updated_at: number;
|
|
614
|
-
status: "active" | "inactive";
|
|
614
|
+
status: "active" | "inactive" | "deleted";
|
|
615
615
|
user_id: string;
|
|
616
616
|
api_key: string;
|
|
617
617
|
}>, {}> & import("mongoose").FlatRecord<{
|
|
618
618
|
created_at: number;
|
|
619
619
|
updated_at: number;
|
|
620
|
-
status: "active" | "inactive";
|
|
620
|
+
status: "active" | "inactive" | "deleted";
|
|
621
621
|
user_id: string;
|
|
622
622
|
api_key: string;
|
|
623
623
|
}> & {
|
package/dist/types.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ export declare const platformEntityMap: {
|
|
|
8
8
|
readonly tiktok: readonly ["profile", "hashtag"];
|
|
9
9
|
readonly website: readonly ["website"];
|
|
10
10
|
};
|
|
11
|
-
export declare const zodSourceStatusList: readonly ["active", "pending", "inactive", "requested"];
|
|
12
|
-
export declare const generalStatusList: readonly ["active", "inactive"];
|
|
11
|
+
export declare const zodSourceStatusList: readonly ["active", "pending", "inactive", "requested", "deleted"];
|
|
12
|
+
export declare const generalStatusList: readonly ["active", "inactive", "deleted"];
|
|
13
13
|
export declare const zodRegionSchema: z.ZodObject<{
|
|
14
14
|
_id: z.ZodOptional<z.ZodString>;
|
|
15
15
|
name: z.ZodString;
|
|
@@ -17,6 +17,8 @@ export declare const zodRegionSchema: z.ZodObject<{
|
|
|
17
17
|
legend: z.ZodOptional<z.ZodString>;
|
|
18
18
|
created_at: z.ZodOptional<z.ZodNumber>;
|
|
19
19
|
updated_at: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
status: z.ZodOptional<z.ZodEnum<["active", "inactive", "deleted"]>>;
|
|
21
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
20
22
|
}, "strip", z.ZodTypeAny, {
|
|
21
23
|
name: string;
|
|
22
24
|
slug: string;
|
|
@@ -24,6 +26,8 @@ export declare const zodRegionSchema: z.ZodObject<{
|
|
|
24
26
|
legend?: string | undefined;
|
|
25
27
|
created_at?: number | undefined;
|
|
26
28
|
updated_at?: number | undefined;
|
|
29
|
+
status?: "active" | "inactive" | "deleted" | undefined;
|
|
30
|
+
notes?: string | undefined;
|
|
27
31
|
}, {
|
|
28
32
|
name: string;
|
|
29
33
|
slug: string;
|
|
@@ -31,6 +35,8 @@ export declare const zodRegionSchema: z.ZodObject<{
|
|
|
31
35
|
legend?: string | undefined;
|
|
32
36
|
created_at?: number | undefined;
|
|
33
37
|
updated_at?: number | undefined;
|
|
38
|
+
status?: "active" | "inactive" | "deleted" | undefined;
|
|
39
|
+
notes?: string | undefined;
|
|
34
40
|
}>;
|
|
35
41
|
export declare const zodSourceGroupSchema: z.ZodObject<{
|
|
36
42
|
_id: z.ZodOptional<z.ZodString>;
|
|
@@ -41,12 +47,16 @@ export declare const zodSourceGroupSchema: z.ZodObject<{
|
|
|
41
47
|
max_active_sources: z.ZodOptional<z.ZodNumber>;
|
|
42
48
|
created_at: z.ZodOptional<z.ZodNumber>;
|
|
43
49
|
updated_at: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
51
|
+
status: z.ZodOptional<z.ZodEnum<["active", "inactive", "deleted"]>>;
|
|
44
52
|
}, "strip", z.ZodTypeAny, {
|
|
45
53
|
name: string;
|
|
46
54
|
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website";
|
|
47
55
|
_id?: string | undefined;
|
|
48
56
|
created_at?: number | undefined;
|
|
49
57
|
updated_at?: number | undefined;
|
|
58
|
+
status?: "active" | "inactive" | "deleted" | undefined;
|
|
59
|
+
notes?: string | undefined;
|
|
50
60
|
description?: string | undefined;
|
|
51
61
|
region_id?: string | undefined;
|
|
52
62
|
max_active_sources?: number | undefined;
|
|
@@ -56,11 +66,13 @@ export declare const zodSourceGroupSchema: z.ZodObject<{
|
|
|
56
66
|
_id?: string | undefined;
|
|
57
67
|
created_at?: number | undefined;
|
|
58
68
|
updated_at?: number | undefined;
|
|
69
|
+
status?: "active" | "inactive" | "deleted" | undefined;
|
|
70
|
+
notes?: string | undefined;
|
|
59
71
|
description?: string | undefined;
|
|
60
72
|
region_id?: string | undefined;
|
|
61
73
|
max_active_sources?: number | undefined;
|
|
62
74
|
}>;
|
|
63
|
-
export declare const zodSourceSchema: z.
|
|
75
|
+
export declare const zodSourceSchema: z.ZodObject<{
|
|
64
76
|
_id: z.ZodOptional<z.ZodString>;
|
|
65
77
|
title: z.ZodOptional<z.ZodString>;
|
|
66
78
|
platform: z.ZodEnum<["telegram", "facebook", "instagram", "tiktok", "website"]>;
|
|
@@ -71,7 +83,7 @@ export declare const zodSourceSchema: z.ZodEffects<z.ZodObject<{
|
|
|
71
83
|
description: z.ZodOptional<z.ZodString>;
|
|
72
84
|
language: z.ZodOptional<z.ZodString>;
|
|
73
85
|
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
74
|
-
status: z.ZodEnum<["active", "pending", "inactive", "requested"]>;
|
|
86
|
+
status: z.ZodEnum<["active", "pending", "inactive", "requested", "deleted"]>;
|
|
75
87
|
is_public: z.ZodDefault<z.ZodBoolean>;
|
|
76
88
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
77
89
|
created_at: z.ZodOptional<z.ZodNumber>;
|
|
@@ -100,65 +112,14 @@ export declare const zodSourceSchema: z.ZodEffects<z.ZodObject<{
|
|
|
100
112
|
notes: z.ZodOptional<z.ZodString>;
|
|
101
113
|
}, "strip", z.ZodTypeAny, {
|
|
102
114
|
name: string;
|
|
103
|
-
status: "active" | "pending" | "inactive" | "requested";
|
|
115
|
+
status: "active" | "pending" | "inactive" | "requested" | "deleted";
|
|
104
116
|
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website";
|
|
105
117
|
entity: "website" | "profile" | "group" | "page" | "channel" | "hashtag";
|
|
106
118
|
is_public: boolean;
|
|
107
119
|
_id?: string | undefined;
|
|
108
120
|
created_at?: number | undefined;
|
|
109
121
|
updated_at?: number | undefined;
|
|
110
|
-
description?: string | undefined;
|
|
111
|
-
region_id?: string | undefined;
|
|
112
|
-
title?: string | undefined;
|
|
113
|
-
public_id?: string | number | undefined;
|
|
114
|
-
url?: string | undefined;
|
|
115
|
-
language?: string | undefined;
|
|
116
|
-
tags?: string[] | undefined;
|
|
117
|
-
metadata?: Record<string, any> | undefined;
|
|
118
|
-
group_id?: string | undefined;
|
|
119
|
-
requested_by?: {
|
|
120
|
-
user_id?: string | undefined;
|
|
121
|
-
username?: string | undefined;
|
|
122
|
-
full_name?: string | undefined;
|
|
123
|
-
email?: string | undefined;
|
|
124
|
-
requested_at?: number | undefined;
|
|
125
|
-
} | undefined;
|
|
126
122
|
notes?: string | undefined;
|
|
127
|
-
}, {
|
|
128
|
-
name: string;
|
|
129
|
-
status: "active" | "pending" | "inactive" | "requested";
|
|
130
|
-
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website";
|
|
131
|
-
entity: "website" | "profile" | "group" | "page" | "channel" | "hashtag";
|
|
132
|
-
_id?: string | undefined;
|
|
133
|
-
created_at?: number | undefined;
|
|
134
|
-
updated_at?: number | undefined;
|
|
135
|
-
description?: string | undefined;
|
|
136
|
-
region_id?: string | undefined;
|
|
137
|
-
title?: string | undefined;
|
|
138
|
-
public_id?: string | number | undefined;
|
|
139
|
-
url?: string | undefined;
|
|
140
|
-
language?: string | undefined;
|
|
141
|
-
tags?: string[] | undefined;
|
|
142
|
-
is_public?: boolean | undefined;
|
|
143
|
-
metadata?: Record<string, any> | undefined;
|
|
144
|
-
group_id?: string | undefined;
|
|
145
|
-
requested_by?: {
|
|
146
|
-
user_id?: string | undefined;
|
|
147
|
-
username?: string | undefined;
|
|
148
|
-
full_name?: string | undefined;
|
|
149
|
-
email?: string | undefined;
|
|
150
|
-
requested_at?: number | undefined;
|
|
151
|
-
} | undefined;
|
|
152
|
-
notes?: string | undefined;
|
|
153
|
-
}>, {
|
|
154
|
-
name: string;
|
|
155
|
-
status: "active" | "pending" | "inactive" | "requested";
|
|
156
|
-
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website";
|
|
157
|
-
entity: "website" | "profile" | "group" | "page" | "channel" | "hashtag";
|
|
158
|
-
is_public: boolean;
|
|
159
|
-
_id?: string | undefined;
|
|
160
|
-
created_at?: number | undefined;
|
|
161
|
-
updated_at?: number | undefined;
|
|
162
123
|
description?: string | undefined;
|
|
163
124
|
region_id?: string | undefined;
|
|
164
125
|
title?: string | undefined;
|
|
@@ -175,15 +136,15 @@ export declare const zodSourceSchema: z.ZodEffects<z.ZodObject<{
|
|
|
175
136
|
email?: string | undefined;
|
|
176
137
|
requested_at?: number | undefined;
|
|
177
138
|
} | undefined;
|
|
178
|
-
notes?: string | undefined;
|
|
179
139
|
}, {
|
|
180
140
|
name: string;
|
|
181
|
-
status: "active" | "pending" | "inactive" | "requested";
|
|
141
|
+
status: "active" | "pending" | "inactive" | "requested" | "deleted";
|
|
182
142
|
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website";
|
|
183
143
|
entity: "website" | "profile" | "group" | "page" | "channel" | "hashtag";
|
|
184
144
|
_id?: string | undefined;
|
|
185
145
|
created_at?: number | undefined;
|
|
186
146
|
updated_at?: number | undefined;
|
|
147
|
+
notes?: string | undefined;
|
|
187
148
|
description?: string | undefined;
|
|
188
149
|
region_id?: string | undefined;
|
|
189
150
|
title?: string | undefined;
|
|
@@ -201,7 +162,6 @@ export declare const zodSourceSchema: z.ZodEffects<z.ZodObject<{
|
|
|
201
162
|
email?: string | undefined;
|
|
202
163
|
requested_at?: number | undefined;
|
|
203
164
|
} | undefined;
|
|
204
|
-
notes?: string | undefined;
|
|
205
165
|
}>;
|
|
206
166
|
export declare const zodGeoSchema: z.ZodObject<{
|
|
207
167
|
_id: z.ZodOptional<z.ZodString>;
|
|
@@ -371,5 +331,5 @@ export type TimeRangeTypeLiteral = 'relative' | 'absolute';
|
|
|
371
331
|
export type AddSourceToReviewType = Pick<SourceType, 'platform' | 'url' | 'description'> & Partial<Pick<SourceType, 'public_id'>>;
|
|
372
332
|
export type GeoType = z.infer<typeof zodGeoSchema>;
|
|
373
333
|
export type GeoSelectionType = z.infer<typeof zodGeoSelectionSchema>;
|
|
374
|
-
export type PlatformEntityType<T extends typeof platformsList[number]> = typeof platformEntityMap[T][number];
|
|
334
|
+
export type PlatformEntityType<T extends (typeof platformsList)[number]> = (typeof platformEntityMap)[T][number];
|
|
375
335
|
export declare const getAllowedEntitiesForPlatform: (platform: (typeof platformsList)[number]) => readonly ["channel", "group"] | readonly ["profile", "page", "group"] | readonly ["profile", "hashtag"] | readonly ["website"];
|
package/dist/types.js
CHANGED
|
@@ -9,7 +9,14 @@ exports.platformsList = [
|
|
|
9
9
|
'tiktok',
|
|
10
10
|
'website',
|
|
11
11
|
];
|
|
12
|
-
exports.entityTypesList = [
|
|
12
|
+
exports.entityTypesList = [
|
|
13
|
+
'profile',
|
|
14
|
+
'group',
|
|
15
|
+
'page',
|
|
16
|
+
'channel',
|
|
17
|
+
'hashtag',
|
|
18
|
+
'website',
|
|
19
|
+
];
|
|
13
20
|
// Platform-specific entity mappings
|
|
14
21
|
exports.platformEntityMap = {
|
|
15
22
|
telegram: ['channel', 'group'],
|
|
@@ -22,16 +29,19 @@ exports.zodSourceStatusList = [
|
|
|
22
29
|
'active',
|
|
23
30
|
'pending',
|
|
24
31
|
'inactive',
|
|
25
|
-
'requested',
|
|
32
|
+
'requested',
|
|
33
|
+
'deleted', // sources that have been deleted
|
|
26
34
|
];
|
|
27
|
-
exports.generalStatusList = ['active', 'inactive'];
|
|
35
|
+
exports.generalStatusList = ['active', 'inactive', 'deleted'];
|
|
28
36
|
exports.zodRegionSchema = zod_1.z.object({
|
|
29
37
|
_id: zod_1.z.string().optional(),
|
|
30
38
|
name: zod_1.z.string(),
|
|
31
39
|
slug: zod_1.z.string(),
|
|
32
40
|
legend: zod_1.z.string().optional(),
|
|
33
41
|
created_at: zod_1.z.number().optional(),
|
|
34
|
-
updated_at: zod_1.z.number().optional(),
|
|
42
|
+
updated_at: zod_1.z.number().optional(),
|
|
43
|
+
status: zod_1.z.enum(exports.generalStatusList).optional(),
|
|
44
|
+
notes: zod_1.z.string().optional(), // internal notes about the region
|
|
35
45
|
});
|
|
36
46
|
exports.zodSourceGroupSchema = zod_1.z.object({
|
|
37
47
|
_id: zod_1.z.string().optional(),
|
|
@@ -41,10 +51,11 @@ exports.zodSourceGroupSchema = zod_1.z.object({
|
|
|
41
51
|
region_id: zod_1.z.string().optional(),
|
|
42
52
|
max_active_sources: zod_1.z.number().optional(),
|
|
43
53
|
created_at: zod_1.z.number().optional(),
|
|
44
|
-
updated_at: zod_1.z.number().optional(),
|
|
54
|
+
updated_at: zod_1.z.number().optional(),
|
|
55
|
+
notes: zod_1.z.string().optional(),
|
|
56
|
+
status: zod_1.z.enum(exports.generalStatusList).optional(),
|
|
45
57
|
});
|
|
46
|
-
exports.zodSourceSchema = zod_1.z
|
|
47
|
-
.object({
|
|
58
|
+
exports.zodSourceSchema = zod_1.z.object({
|
|
48
59
|
_id: zod_1.z.string().optional(),
|
|
49
60
|
title: zod_1.z.string().optional(),
|
|
50
61
|
platform: zod_1.z.enum(exports.platformsList),
|
|
@@ -72,14 +83,7 @@ exports.zodSourceSchema = zod_1.z
|
|
|
72
83
|
})
|
|
73
84
|
.optional(),
|
|
74
85
|
notes: zod_1.z.string().optional(), // internal notes about the source
|
|
75
|
-
})
|
|
76
|
-
.refine((data) => {
|
|
77
|
-
const allowedEntities = exports.platformEntityMap[data.platform];
|
|
78
|
-
return allowedEntities.includes(data.entity);
|
|
79
|
-
}, (data) => ({
|
|
80
|
-
message: `Entity "${data.entity}" is not valid for platform "${data.platform}". Allowed entities: ${exports.platformEntityMap[data.platform].join(', ')}`,
|
|
81
|
-
path: ['entity'],
|
|
82
|
-
}));
|
|
86
|
+
});
|
|
83
87
|
exports.zodGeoSchema = zod_1.z.object({
|
|
84
88
|
_id: zod_1.z.string().optional(),
|
|
85
89
|
geo_text: zod_1.z.string().optional(),
|
package/package.json
CHANGED
package/types.ts
CHANGED
|
@@ -8,7 +8,14 @@ export const platformsList = [
|
|
|
8
8
|
'website',
|
|
9
9
|
] as const;
|
|
10
10
|
|
|
11
|
-
export const entityTypesList = [
|
|
11
|
+
export const entityTypesList = [
|
|
12
|
+
'profile',
|
|
13
|
+
'group',
|
|
14
|
+
'page',
|
|
15
|
+
'channel',
|
|
16
|
+
'hashtag',
|
|
17
|
+
'website',
|
|
18
|
+
] as const;
|
|
12
19
|
|
|
13
20
|
// Platform-specific entity mappings
|
|
14
21
|
export const platformEntityMap = {
|
|
@@ -24,9 +31,10 @@ export const zodSourceStatusList = [
|
|
|
24
31
|
'pending', // sources that are pending approval
|
|
25
32
|
'inactive', // sources that are inactive
|
|
26
33
|
'requested', // sources that are under review
|
|
34
|
+
'deleted', // sources that have been deleted
|
|
27
35
|
] as const;
|
|
28
36
|
|
|
29
|
-
export const generalStatusList = ['active', 'inactive'] as const;
|
|
37
|
+
export const generalStatusList = ['active', 'inactive', 'deleted'] as const;
|
|
30
38
|
|
|
31
39
|
export const zodRegionSchema = z.object({
|
|
32
40
|
_id: z.string().optional(),
|
|
@@ -35,6 +43,8 @@ export const zodRegionSchema = z.object({
|
|
|
35
43
|
legend: z.string().optional(), // e.g., legend for maps
|
|
36
44
|
created_at: z.number().optional(), // creation date
|
|
37
45
|
updated_at: z.number().optional(), // last update date
|
|
46
|
+
status: z.enum(generalStatusList).optional(),
|
|
47
|
+
notes: z.string().optional(), // internal notes about the region
|
|
38
48
|
});
|
|
39
49
|
|
|
40
50
|
export const zodSourceGroupSchema = z.object({
|
|
@@ -46,48 +56,39 @@ export const zodSourceGroupSchema = z.object({
|
|
|
46
56
|
max_active_sources: z.number().optional(), // e.g., maximum number of active sources allowed
|
|
47
57
|
created_at: z.number().optional(), // creation date
|
|
48
58
|
updated_at: z.number().optional(), // last update date
|
|
59
|
+
notes: z.string().optional(), // internal notes about the source group
|
|
60
|
+
status: z.enum(generalStatusList).optional(),
|
|
49
61
|
});
|
|
50
62
|
|
|
51
|
-
export const zodSourceSchema = z
|
|
52
|
-
.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
requested_at: z.number().optional(),
|
|
77
|
-
})
|
|
78
|
-
.optional(), // user who requested this source
|
|
79
|
-
notes: z.string().optional(), // internal notes about the source
|
|
80
|
-
})
|
|
81
|
-
.refine(
|
|
82
|
-
(data) => {
|
|
83
|
-
const allowedEntities = platformEntityMap[data.platform] as readonly string[];
|
|
84
|
-
return allowedEntities.includes(data.entity);
|
|
85
|
-
},
|
|
86
|
-
(data) => ({
|
|
87
|
-
message: `Entity "${data.entity}" is not valid for platform "${data.platform}". Allowed entities: ${platformEntityMap[data.platform].join(', ')}`,
|
|
88
|
-
path: ['entity'],
|
|
63
|
+
export const zodSourceSchema = z.object({
|
|
64
|
+
_id: z.string().optional(),
|
|
65
|
+
title: z.string().optional(), // e.g., 'Telegram Channel Name'
|
|
66
|
+
platform: z.enum(platformsList), // e.g., 'telegram', 'facebook'
|
|
67
|
+
entity: z.enum(entityTypesList), // e.g., 'channel', 'group', 'page', 'profile', 'hashtag'
|
|
68
|
+
public_id: z.string().or(z.number()).optional(), // e.g., '@telegram_channel_id'
|
|
69
|
+
name: z.string(), // e.g., 'Telegram Channel Name'
|
|
70
|
+
url: z.string().url().optional(), // e.g., 'https://t.me/telegram_channel_name'
|
|
71
|
+
description: z.string().optional(), // e.g., 'A channel about news and updates'
|
|
72
|
+
language: z.string().optional(),
|
|
73
|
+
tags: z.array(z.string()).optional(),
|
|
74
|
+
status: z.enum(zodSourceStatusList), // INDEX
|
|
75
|
+
is_public: z.boolean().default(true), // true if the source is public
|
|
76
|
+
metadata: z.record(z.string(), z.any()).optional(), // flexible per platform
|
|
77
|
+
created_at: z.number().optional(),
|
|
78
|
+
updated_at: z.number().optional(),
|
|
79
|
+
region_id: z.string().optional(), // e.g., region ID
|
|
80
|
+
group_id: z.string().optional(), // e.g., source group ID
|
|
81
|
+
requested_by: z
|
|
82
|
+
.object({
|
|
83
|
+
user_id: z.string().optional(),
|
|
84
|
+
username: z.string().optional(),
|
|
85
|
+
full_name: z.string().optional(),
|
|
86
|
+
email: z.string().optional(),
|
|
87
|
+
requested_at: z.number().optional(),
|
|
89
88
|
})
|
|
90
|
-
|
|
89
|
+
.optional(), // user who requested this source
|
|
90
|
+
notes: z.string().optional(), // internal notes about the source
|
|
91
|
+
});
|
|
91
92
|
|
|
92
93
|
export const zodGeoSchema = z.object({
|
|
93
94
|
_id: z.string().optional(),
|
|
@@ -163,15 +164,19 @@ export type TimeRangeTypeLiteral = 'relative' | 'absolute';
|
|
|
163
164
|
export type AddSourceToReviewType = Pick<
|
|
164
165
|
SourceType,
|
|
165
166
|
'platform' | 'url' | 'description'
|
|
166
|
-
> &
|
|
167
|
+
> &
|
|
168
|
+
Partial<Pick<SourceType, 'public_id'>>;
|
|
167
169
|
|
|
168
170
|
export type GeoType = z.infer<typeof zodGeoSchema>;
|
|
169
171
|
export type GeoSelectionType = z.infer<typeof zodGeoSelectionSchema>;
|
|
170
172
|
|
|
171
173
|
// Helper type to get allowed entities for a specific platform
|
|
172
|
-
export type PlatformEntityType<T extends typeof platformsList[number]> =
|
|
174
|
+
export type PlatformEntityType<T extends (typeof platformsList)[number]> =
|
|
175
|
+
(typeof platformEntityMap)[T][number];
|
|
173
176
|
|
|
174
177
|
// Helper function to get allowed entities for a platform
|
|
175
|
-
export const getAllowedEntitiesForPlatform = (
|
|
178
|
+
export const getAllowedEntitiesForPlatform = (
|
|
179
|
+
platform: (typeof platformsList)[number]
|
|
180
|
+
) => {
|
|
176
181
|
return platformEntityMap[platform];
|
|
177
182
|
};
|