harvester_sdk 1.0.17 → 1.0.19
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 +6 -3
- package/dist/index.js +4 -3
- package/dist/types.d.ts +7 -4
- package/dist/types.js +33 -13
- package/index.ts +5 -3
- package/package.json +1 -1
- package/types.ts +70 -51
package/dist/index.d.ts
CHANGED
|
@@ -414,7 +414,8 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
|
|
|
414
414
|
is_public: boolean;
|
|
415
415
|
metadata: any;
|
|
416
416
|
dominant_geos: string[];
|
|
417
|
-
|
|
417
|
+
mentions_in_discovery: number;
|
|
418
|
+
priority: "none" | "low" | "medium" | "high" | "critical";
|
|
418
419
|
notes?: string | null | undefined;
|
|
419
420
|
description?: string | null | undefined;
|
|
420
421
|
region_id?: string | null | undefined;
|
|
@@ -444,7 +445,8 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
|
|
|
444
445
|
is_public: boolean;
|
|
445
446
|
metadata: any;
|
|
446
447
|
dominant_geos: string[];
|
|
447
|
-
|
|
448
|
+
mentions_in_discovery: number;
|
|
449
|
+
priority: "none" | "low" | "medium" | "high" | "critical";
|
|
448
450
|
notes?: string | null | undefined;
|
|
449
451
|
description?: string | null | undefined;
|
|
450
452
|
region_id?: string | null | undefined;
|
|
@@ -474,7 +476,8 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
|
|
|
474
476
|
is_public: boolean;
|
|
475
477
|
metadata: any;
|
|
476
478
|
dominant_geos: string[];
|
|
477
|
-
|
|
479
|
+
mentions_in_discovery: number;
|
|
480
|
+
priority: "none" | "low" | "medium" | "high" | "critical";
|
|
478
481
|
notes?: string | null | undefined;
|
|
479
482
|
description?: string | null | undefined;
|
|
480
483
|
region_id?: string | null | undefined;
|
package/dist/index.js
CHANGED
|
@@ -54,7 +54,7 @@ exports.MongoDataSchema = new mongoose_1.Schema({
|
|
|
54
54
|
'article',
|
|
55
55
|
'link',
|
|
56
56
|
'document',
|
|
57
|
-
'text'
|
|
57
|
+
'text',
|
|
58
58
|
],
|
|
59
59
|
},
|
|
60
60
|
// Content
|
|
@@ -232,6 +232,7 @@ exports.MongoSourceSchema = new mongoose_1.Schema({
|
|
|
232
232
|
region_title: { type: String },
|
|
233
233
|
group_id: { type: String },
|
|
234
234
|
dominant_geos: { type: [String], default: [] },
|
|
235
|
+
mentions_in_discovery: { type: Number, default: 0 },
|
|
235
236
|
requested_by: {
|
|
236
237
|
type: {
|
|
237
238
|
user_id: { type: String },
|
|
@@ -245,8 +246,8 @@ exports.MongoSourceSchema = new mongoose_1.Schema({
|
|
|
245
246
|
notes: { type: String },
|
|
246
247
|
priority: {
|
|
247
248
|
type: String,
|
|
248
|
-
enum:
|
|
249
|
-
default: '
|
|
249
|
+
enum: types_1.priorityLevels,
|
|
250
|
+
default: 'none',
|
|
250
251
|
},
|
|
251
252
|
}, {
|
|
252
253
|
versionKey: false,
|
package/dist/types.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const platformEntityMap: {
|
|
|
8
8
|
readonly tiktok: readonly ["profile", "hashtag"];
|
|
9
9
|
readonly website: readonly ["website"];
|
|
10
10
|
};
|
|
11
|
-
export declare const priorityLevels: readonly ["low", "medium", "high", "critical"];
|
|
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
13
|
export declare const generalStatusList: readonly ["active", "inactive", "deleted"];
|
|
14
14
|
export declare const zodRegionSchema: z.ZodObject<{
|
|
@@ -95,6 +95,7 @@ export declare const zodSourceSchema: z.ZodObject<{
|
|
|
95
95
|
region_title: z.ZodOptional<z.ZodString>;
|
|
96
96
|
group_id: z.ZodOptional<z.ZodString>;
|
|
97
97
|
dominant_geos: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
98
|
+
mentions_in_discovery: z.ZodOptional<z.ZodNumber>;
|
|
98
99
|
requested_by: z.ZodOptional<z.ZodObject<{
|
|
99
100
|
user_id: z.ZodOptional<z.ZodString>;
|
|
100
101
|
username: z.ZodOptional<z.ZodString>;
|
|
@@ -115,7 +116,7 @@ export declare const zodSourceSchema: z.ZodObject<{
|
|
|
115
116
|
requested_at?: number | undefined;
|
|
116
117
|
}>>;
|
|
117
118
|
notes: z.ZodOptional<z.ZodString>;
|
|
118
|
-
priority: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
|
|
119
|
+
priority: z.ZodOptional<z.ZodEnum<["none", "low", "medium", "high", "critical"]>>;
|
|
119
120
|
}, "strip", z.ZodTypeAny, {
|
|
120
121
|
status: "active" | "pending" | "inactive" | "requested" | "discovered" | "deleted";
|
|
121
122
|
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "youtube" | "twitter" | "x" | "reddit" | "linkedin" | "snapchat" | "whatsapp" | "discord" | "twitch";
|
|
@@ -139,6 +140,7 @@ export declare const zodSourceSchema: z.ZodObject<{
|
|
|
139
140
|
region_title?: string | undefined;
|
|
140
141
|
group_id?: string | undefined;
|
|
141
142
|
dominant_geos?: string[] | undefined;
|
|
143
|
+
mentions_in_discovery?: number | undefined;
|
|
142
144
|
requested_by?: {
|
|
143
145
|
user_id?: string | undefined;
|
|
144
146
|
username?: string | undefined;
|
|
@@ -146,7 +148,7 @@ export declare const zodSourceSchema: z.ZodObject<{
|
|
|
146
148
|
email?: string | undefined;
|
|
147
149
|
requested_at?: number | undefined;
|
|
148
150
|
} | undefined;
|
|
149
|
-
priority?: "low" | "medium" | "high" | "critical" | undefined;
|
|
151
|
+
priority?: "none" | "low" | "medium" | "high" | "critical" | undefined;
|
|
150
152
|
}, {
|
|
151
153
|
status: "active" | "pending" | "inactive" | "requested" | "discovered" | "deleted";
|
|
152
154
|
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "youtube" | "twitter" | "x" | "reddit" | "linkedin" | "snapchat" | "whatsapp" | "discord" | "twitch";
|
|
@@ -170,6 +172,7 @@ export declare const zodSourceSchema: z.ZodObject<{
|
|
|
170
172
|
region_title?: string | undefined;
|
|
171
173
|
group_id?: string | undefined;
|
|
172
174
|
dominant_geos?: string[] | undefined;
|
|
175
|
+
mentions_in_discovery?: number | undefined;
|
|
173
176
|
requested_by?: {
|
|
174
177
|
user_id?: string | undefined;
|
|
175
178
|
username?: string | undefined;
|
|
@@ -177,7 +180,7 @@ export declare const zodSourceSchema: z.ZodObject<{
|
|
|
177
180
|
email?: string | undefined;
|
|
178
181
|
requested_at?: number | undefined;
|
|
179
182
|
} | undefined;
|
|
180
|
-
priority?: "low" | "medium" | "high" | "critical" | undefined;
|
|
183
|
+
priority?: "none" | "low" | "medium" | "high" | "critical" | undefined;
|
|
181
184
|
}>;
|
|
182
185
|
export declare const zodGeoSchema: z.ZodObject<{
|
|
183
186
|
_id: z.ZodOptional<z.ZodString>;
|
package/dist/types.js
CHANGED
|
@@ -34,7 +34,7 @@ exports.platformEntityMap = {
|
|
|
34
34
|
tiktok: ['profile', 'hashtag'],
|
|
35
35
|
website: ['website'],
|
|
36
36
|
};
|
|
37
|
-
exports.priorityLevels = ['low', 'medium', 'high', 'critical'];
|
|
37
|
+
exports.priorityLevels = ['none', 'low', 'medium', 'high', 'critical'];
|
|
38
38
|
exports.sourceStatusList = [
|
|
39
39
|
'active',
|
|
40
40
|
'pending',
|
|
@@ -88,6 +88,7 @@ exports.zodSourceSchema = zod_1.z.object({
|
|
|
88
88
|
region_title: zod_1.z.string().optional(),
|
|
89
89
|
group_id: zod_1.z.string().optional(),
|
|
90
90
|
dominant_geos: zod_1.z.array(zod_1.z.string()).optional(),
|
|
91
|
+
mentions_in_discovery: zod_1.z.number().optional(),
|
|
91
92
|
requested_by: zod_1.z
|
|
92
93
|
.object({
|
|
93
94
|
user_id: zod_1.z.string().optional(),
|
|
@@ -180,7 +181,15 @@ exports.websiteMetadataSchema = zod_1.z.object({
|
|
|
180
181
|
});
|
|
181
182
|
// Improved media schema with more types and optional dimensions
|
|
182
183
|
exports.mediaItemSchema = zod_1.z.object({
|
|
183
|
-
type: zod_1.z.enum([
|
|
184
|
+
type: zod_1.z.enum([
|
|
185
|
+
'image',
|
|
186
|
+
'video',
|
|
187
|
+
'audio',
|
|
188
|
+
'link',
|
|
189
|
+
'document',
|
|
190
|
+
'gif',
|
|
191
|
+
'sticker',
|
|
192
|
+
]),
|
|
184
193
|
url: zod_1.z.string(),
|
|
185
194
|
caption: zod_1.z.string().optional(),
|
|
186
195
|
thumbnail_url: zod_1.z.string().optional(),
|
|
@@ -225,7 +234,8 @@ exports.zodDataSchema = zod_1.z.object({
|
|
|
225
234
|
// Data/Post Identifiers
|
|
226
235
|
data_id: zod_1.z.string().or(zod_1.z.number()).optional(),
|
|
227
236
|
data_url: zod_1.z.string().url().optional(),
|
|
228
|
-
data_original_type: zod_1.z
|
|
237
|
+
data_original_type: zod_1.z
|
|
238
|
+
.enum([
|
|
229
239
|
'post',
|
|
230
240
|
'comment',
|
|
231
241
|
'reply',
|
|
@@ -237,14 +247,17 @@ exports.zodDataSchema = zod_1.z.object({
|
|
|
237
247
|
'article',
|
|
238
248
|
'link',
|
|
239
249
|
'document',
|
|
240
|
-
'text'
|
|
241
|
-
])
|
|
250
|
+
'text',
|
|
251
|
+
])
|
|
252
|
+
.optional(),
|
|
242
253
|
// Content
|
|
243
254
|
data_text: zod_1.z.string().optional(),
|
|
244
255
|
data_language: zod_1.z.string().optional(),
|
|
245
256
|
data_geo: zod_1.z.array(zod_1.z.string()).optional().default([]),
|
|
246
257
|
// Analysis (populated by processors)
|
|
247
|
-
data_sentiment: zod_1.z
|
|
258
|
+
data_sentiment: zod_1.z
|
|
259
|
+
.enum(['positive', 'negative', 'neutral', 'mixed'])
|
|
260
|
+
.optional(),
|
|
248
261
|
data_topics: zod_1.z.array(zod_1.z.string()).optional(),
|
|
249
262
|
data_keywords: zod_1.z.array(zod_1.z.string()).optional(),
|
|
250
263
|
// Media attachments
|
|
@@ -261,13 +274,15 @@ exports.zodDataSchema = zod_1.z.object({
|
|
|
261
274
|
replies: zod_1.z.any().optional(),
|
|
262
275
|
replies_info: exports.repliesInfoSchema.optional(),
|
|
263
276
|
// Engagement metrics (platform-specific)
|
|
264
|
-
engagement: zod_1.z
|
|
277
|
+
engagement: zod_1.z
|
|
278
|
+
.object({
|
|
265
279
|
views: zod_1.z.number().optional(),
|
|
266
280
|
likes: zod_1.z.number().optional(),
|
|
267
281
|
shares: zod_1.z.number().optional(),
|
|
268
282
|
comments: zod_1.z.number().optional(),
|
|
269
283
|
reactions: zod_1.z.record(zod_1.z.string(), zod_1.z.number()).optional(), // e.g., { "like": 10, "love": 5 }
|
|
270
|
-
})
|
|
284
|
+
})
|
|
285
|
+
.optional(),
|
|
271
286
|
// Content flags
|
|
272
287
|
is_edited: zod_1.z.boolean().optional(),
|
|
273
288
|
edit_date: zod_1.z.number().optional(),
|
|
@@ -280,15 +295,20 @@ exports.zodDataSchema = zod_1.z.object({
|
|
|
280
295
|
hashtags: zod_1.z.array(zod_1.z.string()).optional().default([]),
|
|
281
296
|
mentions: zod_1.z.array(zod_1.z.string()).optional().default([]),
|
|
282
297
|
// Platform-specific metadata (flexible)
|
|
283
|
-
metadata: zod_1.z
|
|
298
|
+
metadata: zod_1.z
|
|
299
|
+
.union([
|
|
284
300
|
exports.telegramMetadataSchema,
|
|
285
301
|
exports.facebookMetadataSchema,
|
|
286
302
|
exports.instagramMetadataSchema,
|
|
287
303
|
exports.tiktokMetadataSchema,
|
|
288
304
|
exports.websiteMetadataSchema,
|
|
289
305
|
zod_1.z.record(zod_1.z.string(), zod_1.z.any()), // fallback for unknown platforms
|
|
290
|
-
])
|
|
291
|
-
|
|
306
|
+
])
|
|
307
|
+
.optional(),
|
|
308
|
+
processing_status: zod_1.z
|
|
309
|
+
.enum(['raw', 'processed', 'error'])
|
|
310
|
+
.optional()
|
|
311
|
+
.default('raw'),
|
|
292
312
|
processing_errors: zod_1.z.string().optional(),
|
|
293
313
|
});
|
|
294
314
|
// Add validation refinement for platform-specific fields
|
|
@@ -299,6 +319,6 @@ exports.zodDataSchemaWithValidation = exports.zodDataSchema.refine((data) => {
|
|
|
299
319
|
}
|
|
300
320
|
return true;
|
|
301
321
|
}, {
|
|
302
|
-
message:
|
|
303
|
-
path: [
|
|
322
|
+
message: 'data_id is required for non-website platforms',
|
|
323
|
+
path: ['data_id'],
|
|
304
324
|
});
|
package/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
platformsList,
|
|
8
8
|
entityTypesList,
|
|
9
9
|
sourceStatusList,
|
|
10
|
+
priorityLevels,
|
|
10
11
|
} from './types';
|
|
11
12
|
|
|
12
13
|
export const MongoDataSchema = new Schema(
|
|
@@ -47,7 +48,7 @@ export const MongoDataSchema = new Schema(
|
|
|
47
48
|
'article',
|
|
48
49
|
'link',
|
|
49
50
|
'document',
|
|
50
|
-
'text'
|
|
51
|
+
'text',
|
|
51
52
|
],
|
|
52
53
|
},
|
|
53
54
|
|
|
@@ -248,6 +249,7 @@ export const MongoSourceSchema = new Schema(
|
|
|
248
249
|
region_title: { type: String }, // e.g., region title
|
|
249
250
|
group_id: { type: String }, // e.g., source group ID
|
|
250
251
|
dominant_geos: { type: [String], default: [] }, // e.g., dominant geos associated with this source
|
|
252
|
+
mentions_in_discovery: { type: Number, default: 0 }, // number of times this source was mentioned in discovery
|
|
251
253
|
requested_by: {
|
|
252
254
|
type: {
|
|
253
255
|
user_id: { type: String },
|
|
@@ -261,8 +263,8 @@ export const MongoSourceSchema = new Schema(
|
|
|
261
263
|
notes: { type: String }, // internal notes about the source
|
|
262
264
|
priority: {
|
|
263
265
|
type: String,
|
|
264
|
-
enum:
|
|
265
|
-
default: '
|
|
266
|
+
enum: priorityLevels,
|
|
267
|
+
default: 'none',
|
|
266
268
|
},
|
|
267
269
|
},
|
|
268
270
|
{
|
package/package.json
CHANGED
package/types.ts
CHANGED
|
@@ -35,7 +35,7 @@ export const platformEntityMap = {
|
|
|
35
35
|
website: ['website'],
|
|
36
36
|
} as const;
|
|
37
37
|
|
|
38
|
-
export const priorityLevels = ['low', 'medium', 'high', 'critical'] as const;
|
|
38
|
+
export const priorityLevels = ['none', 'low', 'medium', 'high', 'critical'] as const;
|
|
39
39
|
|
|
40
40
|
export const sourceStatusList = [
|
|
41
41
|
'active', // active and approved sources
|
|
@@ -94,6 +94,7 @@ export const zodSourceSchema = z.object({
|
|
|
94
94
|
region_title: z.string().optional(), // e.g., region title
|
|
95
95
|
group_id: z.string().optional(), // e.g., source group ID // INDEX
|
|
96
96
|
dominant_geos: z.array(z.string()).optional(), // e.g., dominant geos associated with this source
|
|
97
|
+
mentions_in_discovery: z.number().optional(), // e.g., associated mentions or keywords
|
|
97
98
|
requested_by: z
|
|
98
99
|
.object({
|
|
99
100
|
user_id: z.string().optional(),
|
|
@@ -194,7 +195,15 @@ export const websiteMetadataSchema = z.object({
|
|
|
194
195
|
|
|
195
196
|
// Improved media schema with more types and optional dimensions
|
|
196
197
|
export const mediaItemSchema = z.object({
|
|
197
|
-
type: z.enum([
|
|
198
|
+
type: z.enum([
|
|
199
|
+
'image',
|
|
200
|
+
'video',
|
|
201
|
+
'audio',
|
|
202
|
+
'link',
|
|
203
|
+
'document',
|
|
204
|
+
'gif',
|
|
205
|
+
'sticker',
|
|
206
|
+
]),
|
|
198
207
|
url: z.string(), // Can be a URL or file ID/path
|
|
199
208
|
caption: z.string().optional(),
|
|
200
209
|
thumbnail_url: z.string().optional(),
|
|
@@ -225,13 +234,13 @@ export const authorSchema = z.object({
|
|
|
225
234
|
|
|
226
235
|
export const zodDataSchema = z.object({
|
|
227
236
|
_id: z.string().optional(),
|
|
228
|
-
|
|
237
|
+
|
|
229
238
|
// Timestamps
|
|
230
239
|
timestamp: z.number().optional(), // INDEX - ingestion timestamp
|
|
231
240
|
data_timestamp: z.number().optional(), // original post timestamp
|
|
232
|
-
created_at: z.number(),
|
|
241
|
+
created_at: z.number(),
|
|
233
242
|
updated_at: z.number(),
|
|
234
|
-
|
|
243
|
+
|
|
235
244
|
// Platform & Source Info (denormalized for query performance)
|
|
236
245
|
platform: z.enum(platformsList).optional(),
|
|
237
246
|
source_id: z.string().or(z.number()), // INDEX - reference to Source _id
|
|
@@ -241,60 +250,66 @@ export const zodDataSchema = z.object({
|
|
|
241
250
|
source_region_title: z.string().optional(),
|
|
242
251
|
source_group_id: z.string().optional(), // INDEX
|
|
243
252
|
source_dominant_geos: z.array(z.string()).optional().default([]),
|
|
244
|
-
|
|
253
|
+
|
|
245
254
|
// Data/Post Identifiers
|
|
246
255
|
data_id: z.string().or(z.number()).optional(), // INDEX - platform-specific post ID
|
|
247
256
|
data_url: z.string().url().optional(), // direct link to the post
|
|
248
|
-
data_original_type: z
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
257
|
+
data_original_type: z
|
|
258
|
+
.enum([
|
|
259
|
+
'post',
|
|
260
|
+
'comment',
|
|
261
|
+
'reply',
|
|
262
|
+
'video',
|
|
263
|
+
'image',
|
|
264
|
+
'photo',
|
|
265
|
+
'story',
|
|
266
|
+
'reel',
|
|
267
|
+
'article',
|
|
268
|
+
'link',
|
|
269
|
+
'document',
|
|
270
|
+
'text',
|
|
271
|
+
])
|
|
272
|
+
.optional(),
|
|
273
|
+
|
|
263
274
|
// Content
|
|
264
275
|
data_text: z.string().optional(),
|
|
265
276
|
data_language: z.string().optional(), // ISO 639-1 code (e.g., 'en', 'ar')
|
|
266
277
|
data_geo: z.array(z.string()).optional().default([]), // INDEX - extracted locations
|
|
267
|
-
|
|
278
|
+
|
|
268
279
|
// Analysis (populated by processors)
|
|
269
|
-
data_sentiment: z
|
|
280
|
+
data_sentiment: z
|
|
281
|
+
.enum(['positive', 'negative', 'neutral', 'mixed'])
|
|
282
|
+
.optional(),
|
|
270
283
|
data_topics: z.array(z.string()).optional(), // extracted topics/themes
|
|
271
284
|
data_keywords: z.array(z.string()).optional(), // extracted keywords
|
|
272
|
-
|
|
285
|
+
|
|
273
286
|
// Media attachments
|
|
274
287
|
media: z.array(mediaItemSchema).optional().default([]),
|
|
275
|
-
|
|
288
|
+
|
|
276
289
|
// Author information
|
|
277
290
|
author: z.string().optional(), // legacy field - display name
|
|
278
291
|
author_username: z.string().optional(), // legacy field
|
|
279
292
|
author_id: z.string().optional(), // legacy field
|
|
280
293
|
author_info: authorSchema.optional(), // NEW - structured author info
|
|
281
|
-
|
|
294
|
+
|
|
282
295
|
// Reply/Thread information
|
|
283
296
|
is_reply: z.boolean().optional().default(false),
|
|
284
297
|
reply_to_message_id: z.string().or(z.number()).optional(),
|
|
285
298
|
reply_to_author_id: z.string().optional(),
|
|
286
299
|
replies: z.any().optional(), // legacy field - keep for backward compatibility
|
|
287
300
|
replies_info: repliesInfoSchema.optional(), // NEW - structured replies info
|
|
288
|
-
|
|
301
|
+
|
|
289
302
|
// Engagement metrics (platform-specific)
|
|
290
|
-
engagement: z
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
303
|
+
engagement: z
|
|
304
|
+
.object({
|
|
305
|
+
views: z.number().optional(),
|
|
306
|
+
likes: z.number().optional(),
|
|
307
|
+
shares: z.number().optional(),
|
|
308
|
+
comments: z.number().optional(),
|
|
309
|
+
reactions: z.record(z.string(), z.number()).optional(), // e.g., { "like": 10, "love": 5 }
|
|
310
|
+
})
|
|
311
|
+
.optional(),
|
|
312
|
+
|
|
298
313
|
// Content flags
|
|
299
314
|
is_edited: z.boolean().optional(),
|
|
300
315
|
edit_date: z.number().optional(),
|
|
@@ -303,25 +318,29 @@ export const zodDataSchema = z.object({
|
|
|
303
318
|
is_forwarded: z.boolean().optional(),
|
|
304
319
|
forwarded_from_id: z.string().optional(),
|
|
305
320
|
forwarded_date: z.number().optional(),
|
|
306
|
-
|
|
321
|
+
|
|
307
322
|
// Hashtags and mentions (extracted for easier querying)
|
|
308
323
|
hashtags: z.array(z.string()).optional().default([]),
|
|
309
324
|
mentions: z.array(z.string()).optional().default([]),
|
|
310
|
-
|
|
325
|
+
|
|
311
326
|
// Platform-specific metadata (flexible)
|
|
312
|
-
metadata: z
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
327
|
+
metadata: z
|
|
328
|
+
.union([
|
|
329
|
+
telegramMetadataSchema,
|
|
330
|
+
facebookMetadataSchema,
|
|
331
|
+
instagramMetadataSchema,
|
|
332
|
+
tiktokMetadataSchema,
|
|
333
|
+
websiteMetadataSchema,
|
|
334
|
+
z.record(z.string(), z.any()), // fallback for unknown platforms
|
|
335
|
+
])
|
|
336
|
+
.optional(),
|
|
337
|
+
|
|
338
|
+
processing_status: z
|
|
339
|
+
.enum(['raw', 'processed', 'error'])
|
|
340
|
+
.optional()
|
|
341
|
+
.default('raw'),
|
|
324
342
|
|
|
343
|
+
processing_errors: z.string().optional(),
|
|
325
344
|
});
|
|
326
345
|
|
|
327
346
|
// Add validation refinement for platform-specific fields
|
|
@@ -334,8 +353,8 @@ export const zodDataSchemaWithValidation = zodDataSchema.refine(
|
|
|
334
353
|
return true;
|
|
335
354
|
},
|
|
336
355
|
{
|
|
337
|
-
message:
|
|
338
|
-
path: [
|
|
356
|
+
message: 'data_id is required for non-website platforms',
|
|
357
|
+
path: ['data_id'],
|
|
339
358
|
}
|
|
340
359
|
);
|
|
341
360
|
|