harvester_sdk 1.0.3 → 1.0.5
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 -31
- package/dist/index.js +17 -14
- package/dist/types.d.ts +9 -5
- package/dist/types.js +5 -3
- package/index.ts +17 -16
- package/package.json +1 -1
- package/types.ts +9 -6
package/dist/index.d.ts
CHANGED
|
@@ -152,34 +152,6 @@ export declare const MongoDataSchema: Schema<any, import("mongoose").Model<any,
|
|
|
152
152
|
} & {
|
|
153
153
|
__v: number;
|
|
154
154
|
}>;
|
|
155
|
-
export declare const MongoInstructionsSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
156
|
-
versionKey: false;
|
|
157
|
-
toJSON: {
|
|
158
|
-
virtuals: true;
|
|
159
|
-
};
|
|
160
|
-
toObject: {
|
|
161
|
-
virtuals: true;
|
|
162
|
-
};
|
|
163
|
-
}, {
|
|
164
|
-
created_at: number;
|
|
165
|
-
updated_at: number;
|
|
166
|
-
user_id: string;
|
|
167
|
-
prompt?: string | null | undefined;
|
|
168
|
-
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
169
|
-
created_at: number;
|
|
170
|
-
updated_at: number;
|
|
171
|
-
user_id: string;
|
|
172
|
-
prompt?: string | null | undefined;
|
|
173
|
-
}>, {}> & import("mongoose").FlatRecord<{
|
|
174
|
-
created_at: number;
|
|
175
|
-
updated_at: number;
|
|
176
|
-
user_id: string;
|
|
177
|
-
prompt?: string | null | undefined;
|
|
178
|
-
}> & {
|
|
179
|
-
_id: import("mongoose").Types.ObjectId;
|
|
180
|
-
} & {
|
|
181
|
-
__v: number;
|
|
182
|
-
}>;
|
|
183
155
|
export declare const MongoRegionSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
184
156
|
versionKey: false;
|
|
185
157
|
toJSON: {
|
|
@@ -193,19 +165,25 @@ export declare const MongoRegionSchema: Schema<any, import("mongoose").Model<any
|
|
|
193
165
|
slug: string;
|
|
194
166
|
created_at: number;
|
|
195
167
|
updated_at: number;
|
|
168
|
+
status: "active" | "inactive" | "deleted";
|
|
196
169
|
legend?: string | null | undefined;
|
|
170
|
+
notes?: string | null | undefined;
|
|
197
171
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
198
172
|
name: string;
|
|
199
173
|
slug: string;
|
|
200
174
|
created_at: number;
|
|
201
175
|
updated_at: number;
|
|
176
|
+
status: "active" | "inactive" | "deleted";
|
|
202
177
|
legend?: string | null | undefined;
|
|
178
|
+
notes?: string | null | undefined;
|
|
203
179
|
}>, {}> & import("mongoose").FlatRecord<{
|
|
204
180
|
name: string;
|
|
205
181
|
slug: string;
|
|
206
182
|
created_at: number;
|
|
207
183
|
updated_at: number;
|
|
184
|
+
status: "active" | "inactive" | "deleted";
|
|
208
185
|
legend?: string | null | undefined;
|
|
186
|
+
notes?: string | null | undefined;
|
|
209
187
|
}> & {
|
|
210
188
|
_id: import("mongoose").Types.ObjectId;
|
|
211
189
|
} & {
|
|
@@ -223,7 +201,9 @@ export declare const MongoSourceGroupSchema: Schema<any, import("mongoose").Mode
|
|
|
223
201
|
name: string;
|
|
224
202
|
created_at: number;
|
|
225
203
|
updated_at: number;
|
|
204
|
+
status: "active" | "inactive" | "deleted";
|
|
226
205
|
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website";
|
|
206
|
+
notes?: string | null | undefined;
|
|
227
207
|
description?: string | null | undefined;
|
|
228
208
|
region_id?: string | null | undefined;
|
|
229
209
|
max_active_sources?: number | null | undefined;
|
|
@@ -231,7 +211,9 @@ export declare const MongoSourceGroupSchema: Schema<any, import("mongoose").Mode
|
|
|
231
211
|
name: string;
|
|
232
212
|
created_at: number;
|
|
233
213
|
updated_at: number;
|
|
214
|
+
status: "active" | "inactive" | "deleted";
|
|
234
215
|
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website";
|
|
216
|
+
notes?: string | null | undefined;
|
|
235
217
|
description?: string | null | undefined;
|
|
236
218
|
region_id?: string | null | undefined;
|
|
237
219
|
max_active_sources?: number | null | undefined;
|
|
@@ -239,7 +221,9 @@ export declare const MongoSourceGroupSchema: Schema<any, import("mongoose").Mode
|
|
|
239
221
|
name: string;
|
|
240
222
|
created_at: number;
|
|
241
223
|
updated_at: number;
|
|
224
|
+
status: "active" | "inactive" | "deleted";
|
|
242
225
|
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website";
|
|
226
|
+
notes?: string | null | undefined;
|
|
243
227
|
description?: string | null | undefined;
|
|
244
228
|
region_id?: string | null | undefined;
|
|
245
229
|
max_active_sources?: number | null | undefined;
|
|
@@ -260,12 +244,13 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
|
|
|
260
244
|
name: string;
|
|
261
245
|
created_at: number;
|
|
262
246
|
updated_at: number;
|
|
263
|
-
status: "active" | "pending" | "inactive" | "requested" | "deleted";
|
|
247
|
+
status: "active" | "pending" | "inactive" | "requested" | "discovered" | "deleted";
|
|
264
248
|
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website";
|
|
265
249
|
entity: "website" | "profile" | "group" | "page" | "channel" | "hashtag";
|
|
266
250
|
tags: string[];
|
|
267
251
|
is_public: boolean;
|
|
268
252
|
metadata: any;
|
|
253
|
+
dominant_geos: string[];
|
|
269
254
|
notes?: string | null | undefined;
|
|
270
255
|
description?: string | null | undefined;
|
|
271
256
|
region_id?: string | null | undefined;
|
|
@@ -285,12 +270,13 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
|
|
|
285
270
|
name: string;
|
|
286
271
|
created_at: number;
|
|
287
272
|
updated_at: number;
|
|
288
|
-
status: "active" | "pending" | "inactive" | "requested" | "deleted";
|
|
273
|
+
status: "active" | "pending" | "inactive" | "requested" | "discovered" | "deleted";
|
|
289
274
|
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website";
|
|
290
275
|
entity: "website" | "profile" | "group" | "page" | "channel" | "hashtag";
|
|
291
276
|
tags: string[];
|
|
292
277
|
is_public: boolean;
|
|
293
278
|
metadata: any;
|
|
279
|
+
dominant_geos: string[];
|
|
294
280
|
notes?: string | null | undefined;
|
|
295
281
|
description?: string | null | undefined;
|
|
296
282
|
region_id?: string | null | undefined;
|
|
@@ -310,12 +296,13 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
|
|
|
310
296
|
name: string;
|
|
311
297
|
created_at: number;
|
|
312
298
|
updated_at: number;
|
|
313
|
-
status: "active" | "pending" | "inactive" | "requested" | "deleted";
|
|
299
|
+
status: "active" | "pending" | "inactive" | "requested" | "discovered" | "deleted";
|
|
314
300
|
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website";
|
|
315
301
|
entity: "website" | "profile" | "group" | "page" | "channel" | "hashtag";
|
|
316
302
|
tags: string[];
|
|
317
303
|
is_public: boolean;
|
|
318
304
|
metadata: any;
|
|
305
|
+
dominant_geos: string[];
|
|
319
306
|
notes?: string | null | undefined;
|
|
320
307
|
description?: string | null | undefined;
|
|
321
308
|
region_id?: string | null | undefined;
|
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.MongoApiKeySchema = exports.MongoGeoSelectionSchema = exports.MongoGeoSchema = exports.MongoJobSchema = exports.MongoConversationSchema = exports.MongoUserSettingsSchema = exports.MongoQuerySchema = exports.MongoSourceSchema = exports.MongoSourceGroupSchema = exports.MongoRegionSchema = exports.
|
|
17
|
+
exports.MongoApiKeySchema = exports.MongoGeoSelectionSchema = exports.MongoGeoSchema = exports.MongoJobSchema = exports.MongoConversationSchema = exports.MongoUserSettingsSchema = exports.MongoQuerySchema = exports.MongoSourceSchema = exports.MongoSourceGroupSchema = exports.MongoRegionSchema = exports.MongoDataSchema = void 0;
|
|
18
18
|
// Export types for consumers
|
|
19
19
|
__exportStar(require("./types"), exports);
|
|
20
20
|
const mongoose_1 = require("mongoose");
|
|
@@ -62,22 +62,18 @@ exports.MongoDataSchema = new mongoose_1.Schema({
|
|
|
62
62
|
toJSON: { virtuals: true },
|
|
63
63
|
toObject: { virtuals: true },
|
|
64
64
|
});
|
|
65
|
-
exports.MongoInstructionsSchema = new mongoose_1.Schema({
|
|
66
|
-
user_id: { type: String, required: true },
|
|
67
|
-
prompt: { type: String },
|
|
68
|
-
created_at: { type: Number, default: Date.now },
|
|
69
|
-
updated_at: { type: Number, default: Date.now },
|
|
70
|
-
}, {
|
|
71
|
-
versionKey: false,
|
|
72
|
-
toJSON: { virtuals: true },
|
|
73
|
-
toObject: { virtuals: true },
|
|
74
|
-
});
|
|
75
65
|
exports.MongoRegionSchema = new mongoose_1.Schema({
|
|
76
66
|
name: { type: String, required: true },
|
|
77
67
|
slug: { type: String, required: true },
|
|
78
68
|
legend: { type: String },
|
|
79
69
|
created_at: { type: Number, default: Date.now },
|
|
80
|
-
updated_at: { type: Number, default: Date.now },
|
|
70
|
+
updated_at: { type: Number, default: Date.now },
|
|
71
|
+
status: {
|
|
72
|
+
type: String,
|
|
73
|
+
enum: types_1.generalStatusList,
|
|
74
|
+
default: 'active',
|
|
75
|
+
},
|
|
76
|
+
notes: { type: String }, // internal notes about the region
|
|
81
77
|
}, {
|
|
82
78
|
versionKey: false,
|
|
83
79
|
toJSON: { virtuals: true },
|
|
@@ -94,7 +90,13 @@ exports.MongoSourceGroupSchema = new mongoose_1.Schema({
|
|
|
94
90
|
region_id: { type: String },
|
|
95
91
|
max_active_sources: { type: Number },
|
|
96
92
|
created_at: { type: Number, default: Date.now },
|
|
97
|
-
updated_at: { type: Number, default: Date.now },
|
|
93
|
+
updated_at: { type: Number, default: Date.now },
|
|
94
|
+
notes: { type: String },
|
|
95
|
+
status: {
|
|
96
|
+
type: String,
|
|
97
|
+
enum: types_1.generalStatusList,
|
|
98
|
+
default: 'active',
|
|
99
|
+
},
|
|
98
100
|
}, {
|
|
99
101
|
versionKey: false,
|
|
100
102
|
toJSON: { virtuals: true },
|
|
@@ -120,7 +122,7 @@ exports.MongoSourceSchema = new mongoose_1.Schema({
|
|
|
120
122
|
tags: { type: [String], default: [] },
|
|
121
123
|
status: {
|
|
122
124
|
type: String,
|
|
123
|
-
enum: types_1.
|
|
125
|
+
enum: types_1.sourceStatusList,
|
|
124
126
|
default: 'pending',
|
|
125
127
|
},
|
|
126
128
|
is_public: { type: Boolean, default: true },
|
|
@@ -129,6 +131,7 @@ exports.MongoSourceSchema = new mongoose_1.Schema({
|
|
|
129
131
|
updated_at: { type: Number, default: Date.now },
|
|
130
132
|
region_id: { type: String },
|
|
131
133
|
group_id: { type: String },
|
|
134
|
+
dominant_geos: { type: [String], default: [] },
|
|
132
135
|
requested_by: {
|
|
133
136
|
type: {
|
|
134
137
|
user_id: { type: String },
|
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
|
|
11
|
+
export declare const sourceStatusList: readonly ["active", "pending", "inactive", "requested", "discovered", "deleted"];
|
|
12
12
|
export declare const generalStatusList: readonly ["active", "inactive", "deleted"];
|
|
13
13
|
export declare const zodRegionSchema: z.ZodObject<{
|
|
14
14
|
_id: z.ZodOptional<z.ZodString>;
|
|
@@ -83,13 +83,14 @@ export declare const zodSourceSchema: z.ZodObject<{
|
|
|
83
83
|
description: z.ZodOptional<z.ZodString>;
|
|
84
84
|
language: z.ZodOptional<z.ZodString>;
|
|
85
85
|
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
86
|
-
status: z.ZodEnum<["active", "pending", "inactive", "requested", "deleted"]>;
|
|
86
|
+
status: z.ZodEnum<["active", "pending", "inactive", "requested", "discovered", "deleted"]>;
|
|
87
87
|
is_public: z.ZodDefault<z.ZodBoolean>;
|
|
88
88
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
89
89
|
created_at: z.ZodOptional<z.ZodNumber>;
|
|
90
90
|
updated_at: z.ZodOptional<z.ZodNumber>;
|
|
91
91
|
region_id: z.ZodOptional<z.ZodString>;
|
|
92
92
|
group_id: z.ZodOptional<z.ZodString>;
|
|
93
|
+
dominant_geos: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
93
94
|
requested_by: z.ZodOptional<z.ZodObject<{
|
|
94
95
|
user_id: z.ZodOptional<z.ZodString>;
|
|
95
96
|
username: z.ZodOptional<z.ZodString>;
|
|
@@ -112,7 +113,7 @@ export declare const zodSourceSchema: z.ZodObject<{
|
|
|
112
113
|
notes: z.ZodOptional<z.ZodString>;
|
|
113
114
|
}, "strip", z.ZodTypeAny, {
|
|
114
115
|
name: string;
|
|
115
|
-
status: "active" | "pending" | "inactive" | "requested" | "deleted";
|
|
116
|
+
status: "active" | "pending" | "inactive" | "requested" | "discovered" | "deleted";
|
|
116
117
|
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website";
|
|
117
118
|
entity: "website" | "profile" | "group" | "page" | "channel" | "hashtag";
|
|
118
119
|
is_public: boolean;
|
|
@@ -129,6 +130,7 @@ export declare const zodSourceSchema: z.ZodObject<{
|
|
|
129
130
|
tags?: string[] | undefined;
|
|
130
131
|
metadata?: Record<string, any> | undefined;
|
|
131
132
|
group_id?: string | undefined;
|
|
133
|
+
dominant_geos?: string[] | undefined;
|
|
132
134
|
requested_by?: {
|
|
133
135
|
user_id?: string | undefined;
|
|
134
136
|
username?: string | undefined;
|
|
@@ -138,7 +140,7 @@ export declare const zodSourceSchema: z.ZodObject<{
|
|
|
138
140
|
} | undefined;
|
|
139
141
|
}, {
|
|
140
142
|
name: string;
|
|
141
|
-
status: "active" | "pending" | "inactive" | "requested" | "deleted";
|
|
143
|
+
status: "active" | "pending" | "inactive" | "requested" | "discovered" | "deleted";
|
|
142
144
|
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website";
|
|
143
145
|
entity: "website" | "profile" | "group" | "page" | "channel" | "hashtag";
|
|
144
146
|
_id?: string | undefined;
|
|
@@ -155,6 +157,7 @@ export declare const zodSourceSchema: z.ZodObject<{
|
|
|
155
157
|
is_public?: boolean | undefined;
|
|
156
158
|
metadata?: Record<string, any> | undefined;
|
|
157
159
|
group_id?: string | undefined;
|
|
160
|
+
dominant_geos?: string[] | undefined;
|
|
158
161
|
requested_by?: {
|
|
159
162
|
user_id?: string | undefined;
|
|
160
163
|
username?: string | undefined;
|
|
@@ -326,7 +329,8 @@ export type RegionType = z.infer<typeof zodRegionSchema>;
|
|
|
326
329
|
export type SourceGroupType = z.infer<typeof zodSourceGroupSchema>;
|
|
327
330
|
export type SourceType = z.infer<typeof zodSourceSchema>;
|
|
328
331
|
export type DataType = z.infer<typeof zodDataSchema>;
|
|
329
|
-
export type
|
|
332
|
+
export type SourceStatusType = (typeof sourceStatusList)[number];
|
|
333
|
+
export type StatusType = (typeof generalStatusList)[number];
|
|
330
334
|
export type TimeRangeTypeLiteral = 'relative' | 'absolute';
|
|
331
335
|
export type AddSourceToReviewType = Pick<SourceType, 'platform' | 'url' | 'description'> & Partial<Pick<SourceType, 'public_id'>>;
|
|
332
336
|
export type GeoType = z.infer<typeof zodGeoSchema>;
|
package/dist/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAllowedEntitiesForPlatform = exports.zodDataSchema = exports.zodGeoSelectionSchema = exports.zodGeoSchema = exports.zodSourceSchema = exports.zodSourceGroupSchema = exports.zodRegionSchema = exports.generalStatusList = exports.
|
|
3
|
+
exports.getAllowedEntitiesForPlatform = exports.zodDataSchema = exports.zodGeoSelectionSchema = exports.zodGeoSchema = exports.zodSourceSchema = exports.zodSourceGroupSchema = exports.zodRegionSchema = exports.generalStatusList = exports.sourceStatusList = exports.platformEntityMap = exports.entityTypesList = exports.platformsList = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.platformsList = [
|
|
6
6
|
'telegram',
|
|
@@ -25,11 +25,12 @@ exports.platformEntityMap = {
|
|
|
25
25
|
tiktok: ['profile', 'hashtag'],
|
|
26
26
|
website: ['website'],
|
|
27
27
|
};
|
|
28
|
-
exports.
|
|
28
|
+
exports.sourceStatusList = [
|
|
29
29
|
'active',
|
|
30
30
|
'pending',
|
|
31
31
|
'inactive',
|
|
32
32
|
'requested',
|
|
33
|
+
'discovered',
|
|
33
34
|
'deleted', // sources that have been deleted
|
|
34
35
|
];
|
|
35
36
|
exports.generalStatusList = ['active', 'inactive', 'deleted'];
|
|
@@ -66,13 +67,14 @@ exports.zodSourceSchema = zod_1.z.object({
|
|
|
66
67
|
description: zod_1.z.string().optional(),
|
|
67
68
|
language: zod_1.z.string().optional(),
|
|
68
69
|
tags: zod_1.z.array(zod_1.z.string()).optional(),
|
|
69
|
-
status: zod_1.z.enum(exports.
|
|
70
|
+
status: zod_1.z.enum(exports.sourceStatusList),
|
|
70
71
|
is_public: zod_1.z.boolean().default(true),
|
|
71
72
|
metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
|
|
72
73
|
created_at: zod_1.z.number().optional(),
|
|
73
74
|
updated_at: zod_1.z.number().optional(),
|
|
74
75
|
region_id: zod_1.z.string().optional(),
|
|
75
76
|
group_id: zod_1.z.string().optional(),
|
|
77
|
+
dominant_geos: zod_1.z.array(zod_1.z.string()).optional(),
|
|
76
78
|
requested_by: zod_1.z
|
|
77
79
|
.object({
|
|
78
80
|
user_id: zod_1.z.string().optional(),
|
package/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
generalStatusList,
|
|
7
7
|
platformsList,
|
|
8
8
|
entityTypesList,
|
|
9
|
-
|
|
9
|
+
sourceStatusList
|
|
10
10
|
} from './types';
|
|
11
11
|
|
|
12
12
|
export const MongoDataSchema = new Schema(
|
|
@@ -56,20 +56,6 @@ export const MongoDataSchema = new Schema(
|
|
|
56
56
|
}
|
|
57
57
|
);
|
|
58
58
|
|
|
59
|
-
export const MongoInstructionsSchema = new Schema(
|
|
60
|
-
{
|
|
61
|
-
user_id: { type: String, required: true },
|
|
62
|
-
prompt: { type: String },
|
|
63
|
-
created_at: { type: Number, default: Date.now },
|
|
64
|
-
updated_at: { type: Number, default: Date.now },
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
versionKey: false,
|
|
68
|
-
toJSON: { virtuals: true },
|
|
69
|
-
toObject: { virtuals: true },
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
|
|
73
59
|
export const MongoRegionSchema = new Schema(
|
|
74
60
|
{
|
|
75
61
|
name: { type: String, required: true }, // e.g., "New York"
|
|
@@ -77,6 +63,13 @@ export const MongoRegionSchema = new Schema(
|
|
|
77
63
|
legend: { type: String }, // e.g., legend for maps
|
|
78
64
|
created_at: { type: Number, default: Date.now }, // creation date
|
|
79
65
|
updated_at: { type: Number, default: Date.now }, // last update date
|
|
66
|
+
status: {
|
|
67
|
+
type: String,
|
|
68
|
+
enum: generalStatusList,
|
|
69
|
+
default: 'active',
|
|
70
|
+
},
|
|
71
|
+
notes: { type: String }, // internal notes about the region
|
|
72
|
+
|
|
80
73
|
},
|
|
81
74
|
{
|
|
82
75
|
versionKey: false,
|
|
@@ -98,6 +91,12 @@ export const MongoSourceGroupSchema = new Schema(
|
|
|
98
91
|
max_active_sources: { type: Number }, // e.g., maximum number of active sources allowed
|
|
99
92
|
created_at: { type: Number, default: Date.now }, // creation date
|
|
100
93
|
updated_at: { type: Number, default: Date.now }, // last update date
|
|
94
|
+
notes: { type: String }, // internal notes about the source group
|
|
95
|
+
status: {
|
|
96
|
+
type: String,
|
|
97
|
+
enum: generalStatusList,
|
|
98
|
+
default: 'active',
|
|
99
|
+
},
|
|
101
100
|
},
|
|
102
101
|
{
|
|
103
102
|
versionKey: false,
|
|
@@ -127,7 +126,7 @@ export const MongoSourceSchema = new Schema(
|
|
|
127
126
|
tags: { type: [String], default: [] }, // array of tags
|
|
128
127
|
status: {
|
|
129
128
|
type: String,
|
|
130
|
-
enum:
|
|
129
|
+
enum: sourceStatusList,
|
|
131
130
|
default: 'pending',
|
|
132
131
|
}, // INDEX
|
|
133
132
|
is_public: { type: Boolean, default: true }, // true if the source is public
|
|
@@ -136,6 +135,7 @@ export const MongoSourceSchema = new Schema(
|
|
|
136
135
|
updated_at: { type: Number, default: Date.now },
|
|
137
136
|
region_id: { type: String }, // e.g., region ID
|
|
138
137
|
group_id: { type: String }, // e.g., source group ID
|
|
138
|
+
dominant_geos: { type: [String], default: [] }, // e.g., dominant geos associated with this source
|
|
139
139
|
requested_by: {
|
|
140
140
|
type: {
|
|
141
141
|
user_id: { type: String },
|
|
@@ -147,6 +147,7 @@ export const MongoSourceSchema = new Schema(
|
|
|
147
147
|
default: undefined,
|
|
148
148
|
}, // user who requested this source
|
|
149
149
|
notes: { type: String }, // internal notes about the source
|
|
150
|
+
|
|
150
151
|
},
|
|
151
152
|
{
|
|
152
153
|
versionKey: false,
|
package/package.json
CHANGED
package/types.ts
CHANGED
|
@@ -26,11 +26,12 @@ export const platformEntityMap = {
|
|
|
26
26
|
website: ['website'],
|
|
27
27
|
} as const;
|
|
28
28
|
|
|
29
|
-
export const
|
|
29
|
+
export const sourceStatusList = [
|
|
30
30
|
'active', // active and approved sources
|
|
31
31
|
'pending', // sources that are pending approval
|
|
32
32
|
'inactive', // sources that are inactive
|
|
33
33
|
'requested', // sources that are under review
|
|
34
|
+
'discovered', // sources that have been discovered from an autopilot mode
|
|
34
35
|
'deleted', // sources that have been deleted
|
|
35
36
|
] as const;
|
|
36
37
|
|
|
@@ -63,7 +64,7 @@ export const zodSourceGroupSchema = z.object({
|
|
|
63
64
|
export const zodSourceSchema = z.object({
|
|
64
65
|
_id: z.string().optional(),
|
|
65
66
|
title: z.string().optional(), // e.g., 'Telegram Channel Name'
|
|
66
|
-
platform: z.enum(platformsList), // e.g., 'telegram', 'facebook'
|
|
67
|
+
platform: z.enum(platformsList), // e.g., 'telegram', 'facebook' // INDEX
|
|
67
68
|
entity: z.enum(entityTypesList), // e.g., 'channel', 'group', 'page', 'profile', 'hashtag'
|
|
68
69
|
public_id: z.string().or(z.number()).optional(), // e.g., '@telegram_channel_id'
|
|
69
70
|
name: z.string(), // e.g., 'Telegram Channel Name'
|
|
@@ -71,13 +72,14 @@ export const zodSourceSchema = z.object({
|
|
|
71
72
|
description: z.string().optional(), // e.g., 'A channel about news and updates'
|
|
72
73
|
language: z.string().optional(),
|
|
73
74
|
tags: z.array(z.string()).optional(),
|
|
74
|
-
status: z.enum(
|
|
75
|
+
status: z.enum(sourceStatusList), // INDEX
|
|
75
76
|
is_public: z.boolean().default(true), // true if the source is public
|
|
76
77
|
metadata: z.record(z.string(), z.any()).optional(), // flexible per platform
|
|
77
78
|
created_at: z.number().optional(),
|
|
78
79
|
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
|
|
80
|
+
region_id: z.string().optional(), // e.g., region ID // INDEX
|
|
81
|
+
group_id: z.string().optional(), // e.g., source group ID // INDEX
|
|
82
|
+
dominant_geos: z.array(z.string()).optional(), // e.g., dominant geos associated with this source
|
|
81
83
|
requested_by: z
|
|
82
84
|
.object({
|
|
83
85
|
user_id: z.string().optional(),
|
|
@@ -159,7 +161,8 @@ export type RegionType = z.infer<typeof zodRegionSchema>;
|
|
|
159
161
|
export type SourceGroupType = z.infer<typeof zodSourceGroupSchema>;
|
|
160
162
|
export type SourceType = z.infer<typeof zodSourceSchema>;
|
|
161
163
|
export type DataType = z.infer<typeof zodDataSchema>;
|
|
162
|
-
export type
|
|
164
|
+
export type SourceStatusType = (typeof sourceStatusList)[number];
|
|
165
|
+
export type StatusType = (typeof generalStatusList)[number];
|
|
163
166
|
export type TimeRangeTypeLiteral = 'relative' | 'absolute';
|
|
164
167
|
export type AddSourceToReviewType = Pick<
|
|
165
168
|
SourceType,
|