harvester_sdk 1.0.2 → 1.0.4
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 +27 -43
- package/dist/index.js +16 -14
- package/dist/types.d.ts +19 -6
- package/dist/types.js +20 -10
- package/index.ts +16 -16
- package/package.json +1 -1
- package/types.ts +53 -38
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;
|
|
@@ -266,6 +250,7 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
|
|
|
266
250
|
tags: string[];
|
|
267
251
|
is_public: boolean;
|
|
268
252
|
metadata: any;
|
|
253
|
+
notes?: string | null | undefined;
|
|
269
254
|
description?: string | null | undefined;
|
|
270
255
|
region_id?: string | null | undefined;
|
|
271
256
|
title?: string | null | undefined;
|
|
@@ -280,7 +265,6 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
|
|
|
280
265
|
email?: string | null | undefined;
|
|
281
266
|
requested_at?: number | null | undefined;
|
|
282
267
|
} | null | undefined;
|
|
283
|
-
notes?: string | null | undefined;
|
|
284
268
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
285
269
|
name: string;
|
|
286
270
|
created_at: number;
|
|
@@ -291,6 +275,7 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
|
|
|
291
275
|
tags: string[];
|
|
292
276
|
is_public: boolean;
|
|
293
277
|
metadata: any;
|
|
278
|
+
notes?: string | null | undefined;
|
|
294
279
|
description?: string | null | undefined;
|
|
295
280
|
region_id?: string | null | undefined;
|
|
296
281
|
title?: string | null | undefined;
|
|
@@ -305,7 +290,6 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
|
|
|
305
290
|
email?: string | null | undefined;
|
|
306
291
|
requested_at?: number | null | undefined;
|
|
307
292
|
} | null | undefined;
|
|
308
|
-
notes?: string | null | undefined;
|
|
309
293
|
}>, {}> & import("mongoose").FlatRecord<{
|
|
310
294
|
name: string;
|
|
311
295
|
created_at: number;
|
|
@@ -316,6 +300,7 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
|
|
|
316
300
|
tags: string[];
|
|
317
301
|
is_public: boolean;
|
|
318
302
|
metadata: any;
|
|
303
|
+
notes?: string | null | undefined;
|
|
319
304
|
description?: string | null | undefined;
|
|
320
305
|
region_id?: string | null | undefined;
|
|
321
306
|
title?: string | null | undefined;
|
|
@@ -330,7 +315,6 @@ export declare const MongoSourceSchema: Schema<any, import("mongoose").Model<any
|
|
|
330
315
|
email?: string | null | undefined;
|
|
331
316
|
requested_at?: number | null | undefined;
|
|
332
317
|
} | null | undefined;
|
|
333
|
-
notes?: string | null | undefined;
|
|
334
318
|
}> & {
|
|
335
319
|
_id: import("mongoose").Types.ObjectId;
|
|
336
320
|
} & {
|
|
@@ -393,7 +377,7 @@ export declare const MongoUserSettingsSchema: Schema<any, import("mongoose").Mod
|
|
|
393
377
|
}, {
|
|
394
378
|
created_at: NativeDate;
|
|
395
379
|
updated_at: NativeDate;
|
|
396
|
-
status: "active" | "inactive";
|
|
380
|
+
status: "active" | "inactive" | "deleted";
|
|
397
381
|
user_id: string;
|
|
398
382
|
geos: string[];
|
|
399
383
|
sources: string[];
|
|
@@ -405,7 +389,7 @@ export declare const MongoUserSettingsSchema: Schema<any, import("mongoose").Mod
|
|
|
405
389
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
406
390
|
created_at: NativeDate;
|
|
407
391
|
updated_at: NativeDate;
|
|
408
|
-
status: "active" | "inactive";
|
|
392
|
+
status: "active" | "inactive" | "deleted";
|
|
409
393
|
user_id: string;
|
|
410
394
|
geos: string[];
|
|
411
395
|
sources: string[];
|
|
@@ -417,7 +401,7 @@ export declare const MongoUserSettingsSchema: Schema<any, import("mongoose").Mod
|
|
|
417
401
|
}>, {}> & import("mongoose").FlatRecord<{
|
|
418
402
|
created_at: NativeDate;
|
|
419
403
|
updated_at: NativeDate;
|
|
420
|
-
status: "active" | "inactive";
|
|
404
|
+
status: "active" | "inactive" | "deleted";
|
|
421
405
|
user_id: string;
|
|
422
406
|
geos: string[];
|
|
423
407
|
sources: string[];
|
|
@@ -442,7 +426,7 @@ export declare const MongoConversationSchema: Schema<any, import("mongoose").Mod
|
|
|
442
426
|
}, {
|
|
443
427
|
created_at: NativeDate;
|
|
444
428
|
updated_at: NativeDate;
|
|
445
|
-
status: "active" | "inactive";
|
|
429
|
+
status: "active" | "inactive" | "deleted";
|
|
446
430
|
user_id: string;
|
|
447
431
|
is_job: boolean;
|
|
448
432
|
title?: string | null | undefined;
|
|
@@ -450,7 +434,7 @@ export declare const MongoConversationSchema: Schema<any, import("mongoose").Mod
|
|
|
450
434
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
451
435
|
created_at: NativeDate;
|
|
452
436
|
updated_at: NativeDate;
|
|
453
|
-
status: "active" | "inactive";
|
|
437
|
+
status: "active" | "inactive" | "deleted";
|
|
454
438
|
user_id: string;
|
|
455
439
|
is_job: boolean;
|
|
456
440
|
title?: string | null | undefined;
|
|
@@ -458,7 +442,7 @@ export declare const MongoConversationSchema: Schema<any, import("mongoose").Mod
|
|
|
458
442
|
}>, {}> & import("mongoose").FlatRecord<{
|
|
459
443
|
created_at: NativeDate;
|
|
460
444
|
updated_at: NativeDate;
|
|
461
|
-
status: "active" | "inactive";
|
|
445
|
+
status: "active" | "inactive" | "deleted";
|
|
462
446
|
user_id: string;
|
|
463
447
|
is_job: boolean;
|
|
464
448
|
title?: string | null | undefined;
|
|
@@ -479,7 +463,7 @@ export declare const MongoJobSchema: Schema<any, import("mongoose").Model<any, a
|
|
|
479
463
|
}, {
|
|
480
464
|
created_at: number;
|
|
481
465
|
updated_at: number;
|
|
482
|
-
status: "active" | "inactive";
|
|
466
|
+
status: "active" | "inactive" | "deleted";
|
|
483
467
|
user_id: string;
|
|
484
468
|
query: any;
|
|
485
469
|
job_name: string;
|
|
@@ -493,7 +477,7 @@ export declare const MongoJobSchema: Schema<any, import("mongoose").Model<any, a
|
|
|
493
477
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
494
478
|
created_at: number;
|
|
495
479
|
updated_at: number;
|
|
496
|
-
status: "active" | "inactive";
|
|
480
|
+
status: "active" | "inactive" | "deleted";
|
|
497
481
|
user_id: string;
|
|
498
482
|
query: any;
|
|
499
483
|
job_name: string;
|
|
@@ -507,7 +491,7 @@ export declare const MongoJobSchema: Schema<any, import("mongoose").Model<any, a
|
|
|
507
491
|
}>, {}> & import("mongoose").FlatRecord<{
|
|
508
492
|
created_at: number;
|
|
509
493
|
updated_at: number;
|
|
510
|
-
status: "active" | "inactive";
|
|
494
|
+
status: "active" | "inactive" | "deleted";
|
|
511
495
|
user_id: string;
|
|
512
496
|
query: any;
|
|
513
497
|
job_name: string;
|
|
@@ -605,19 +589,19 @@ export declare const MongoApiKeySchema: Schema<any, import("mongoose").Model<any
|
|
|
605
589
|
}, {
|
|
606
590
|
created_at: number;
|
|
607
591
|
updated_at: number;
|
|
608
|
-
status: "active" | "inactive";
|
|
592
|
+
status: "active" | "inactive" | "deleted";
|
|
609
593
|
user_id: string;
|
|
610
594
|
api_key: string;
|
|
611
595
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
612
596
|
created_at: number;
|
|
613
597
|
updated_at: number;
|
|
614
|
-
status: "active" | "inactive";
|
|
598
|
+
status: "active" | "inactive" | "deleted";
|
|
615
599
|
user_id: string;
|
|
616
600
|
api_key: string;
|
|
617
601
|
}>, {}> & import("mongoose").FlatRecord<{
|
|
618
602
|
created_at: number;
|
|
619
603
|
updated_at: number;
|
|
620
|
-
status: "active" | "inactive";
|
|
604
|
+
status: "active" | "inactive" | "deleted";
|
|
621
605
|
user_id: string;
|
|
622
606
|
api_key: string;
|
|
623
607
|
}> & {
|
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 },
|
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
|
|
12
|
-
export declare const generalStatusList: readonly ["active", "inactive"];
|
|
11
|
+
export declare const sourceStatusList: 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,6 +66,8 @@ 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;
|
|
@@ -107,6 +119,7 @@ export declare const zodSourceSchema: z.ZodObject<{
|
|
|
107
119
|
_id?: string | undefined;
|
|
108
120
|
created_at?: number | undefined;
|
|
109
121
|
updated_at?: number | undefined;
|
|
122
|
+
notes?: string | undefined;
|
|
110
123
|
description?: string | undefined;
|
|
111
124
|
region_id?: string | undefined;
|
|
112
125
|
title?: string | undefined;
|
|
@@ -123,7 +136,6 @@ export declare const zodSourceSchema: z.ZodObject<{
|
|
|
123
136
|
email?: string | undefined;
|
|
124
137
|
requested_at?: number | undefined;
|
|
125
138
|
} | undefined;
|
|
126
|
-
notes?: string | undefined;
|
|
127
139
|
}, {
|
|
128
140
|
name: string;
|
|
129
141
|
status: "active" | "pending" | "inactive" | "requested" | "deleted";
|
|
@@ -132,6 +144,7 @@ export declare const zodSourceSchema: z.ZodObject<{
|
|
|
132
144
|
_id?: string | undefined;
|
|
133
145
|
created_at?: number | undefined;
|
|
134
146
|
updated_at?: number | undefined;
|
|
147
|
+
notes?: string | undefined;
|
|
135
148
|
description?: string | undefined;
|
|
136
149
|
region_id?: string | undefined;
|
|
137
150
|
title?: string | undefined;
|
|
@@ -149,7 +162,6 @@ export declare const zodSourceSchema: z.ZodObject<{
|
|
|
149
162
|
email?: string | undefined;
|
|
150
163
|
requested_at?: number | undefined;
|
|
151
164
|
} | undefined;
|
|
152
|
-
notes?: string | undefined;
|
|
153
165
|
}>;
|
|
154
166
|
export declare const zodGeoSchema: z.ZodObject<{
|
|
155
167
|
_id: z.ZodOptional<z.ZodString>;
|
|
@@ -314,10 +326,11 @@ export type RegionType = z.infer<typeof zodRegionSchema>;
|
|
|
314
326
|
export type SourceGroupType = z.infer<typeof zodSourceGroupSchema>;
|
|
315
327
|
export type SourceType = z.infer<typeof zodSourceSchema>;
|
|
316
328
|
export type DataType = z.infer<typeof zodDataSchema>;
|
|
317
|
-
export type
|
|
329
|
+
export type SourceStatusType = (typeof sourceStatusList)[number];
|
|
330
|
+
export type StatusType = (typeof generalStatusList)[number];
|
|
318
331
|
export type TimeRangeTypeLiteral = 'relative' | 'absolute';
|
|
319
332
|
export type AddSourceToReviewType = Pick<SourceType, 'platform' | 'url' | 'description'> & Partial<Pick<SourceType, 'public_id'>>;
|
|
320
333
|
export type GeoType = z.infer<typeof zodGeoSchema>;
|
|
321
334
|
export type GeoSelectionType = z.infer<typeof zodGeoSelectionSchema>;
|
|
322
|
-
export type PlatformEntityType<T extends typeof platformsList[number]> = typeof platformEntityMap[T][number];
|
|
335
|
+
export type PlatformEntityType<T extends (typeof platformsList)[number]> = (typeof platformEntityMap)[T][number];
|
|
323
336
|
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
|
@@ -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',
|
|
@@ -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'],
|
|
@@ -18,21 +25,23 @@ exports.platformEntityMap = {
|
|
|
18
25
|
tiktok: ['profile', 'hashtag'],
|
|
19
26
|
website: ['website'],
|
|
20
27
|
};
|
|
21
|
-
exports.
|
|
28
|
+
exports.sourceStatusList = [
|
|
22
29
|
'active',
|
|
23
30
|
'pending',
|
|
24
31
|
'inactive',
|
|
25
32
|
'requested',
|
|
26
|
-
'deleted' // sources that have been deleted
|
|
33
|
+
'deleted', // sources that have been deleted
|
|
27
34
|
];
|
|
28
|
-
exports.generalStatusList = ['active', 'inactive'];
|
|
35
|
+
exports.generalStatusList = ['active', 'inactive', 'deleted'];
|
|
29
36
|
exports.zodRegionSchema = zod_1.z.object({
|
|
30
37
|
_id: zod_1.z.string().optional(),
|
|
31
38
|
name: zod_1.z.string(),
|
|
32
39
|
slug: zod_1.z.string(),
|
|
33
40
|
legend: zod_1.z.string().optional(),
|
|
34
41
|
created_at: zod_1.z.number().optional(),
|
|
35
|
-
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
|
|
36
45
|
});
|
|
37
46
|
exports.zodSourceGroupSchema = zod_1.z.object({
|
|
38
47
|
_id: zod_1.z.string().optional(),
|
|
@@ -42,10 +51,11 @@ exports.zodSourceGroupSchema = zod_1.z.object({
|
|
|
42
51
|
region_id: zod_1.z.string().optional(),
|
|
43
52
|
max_active_sources: zod_1.z.number().optional(),
|
|
44
53
|
created_at: zod_1.z.number().optional(),
|
|
45
|
-
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(),
|
|
46
57
|
});
|
|
47
|
-
exports.zodSourceSchema = zod_1.z
|
|
48
|
-
.object({
|
|
58
|
+
exports.zodSourceSchema = zod_1.z.object({
|
|
49
59
|
_id: zod_1.z.string().optional(),
|
|
50
60
|
title: zod_1.z.string().optional(),
|
|
51
61
|
platform: zod_1.z.enum(exports.platformsList),
|
|
@@ -56,7 +66,7 @@ exports.zodSourceSchema = zod_1.z
|
|
|
56
66
|
description: zod_1.z.string().optional(),
|
|
57
67
|
language: zod_1.z.string().optional(),
|
|
58
68
|
tags: zod_1.z.array(zod_1.z.string()).optional(),
|
|
59
|
-
status: zod_1.z.enum(exports.
|
|
69
|
+
status: zod_1.z.enum(exports.sourceStatusList),
|
|
60
70
|
is_public: zod_1.z.boolean().default(true),
|
|
61
71
|
metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
|
|
62
72
|
created_at: zod_1.z.number().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
|
|
@@ -147,6 +146,7 @@ export const MongoSourceSchema = new Schema(
|
|
|
147
146
|
default: undefined,
|
|
148
147
|
}, // user who requested this source
|
|
149
148
|
notes: { type: String }, // internal notes about the source
|
|
149
|
+
|
|
150
150
|
},
|
|
151
151
|
{
|
|
152
152
|
versionKey: false,
|
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 = {
|
|
@@ -19,15 +26,15 @@ export const platformEntityMap = {
|
|
|
19
26
|
website: ['website'],
|
|
20
27
|
} as const;
|
|
21
28
|
|
|
22
|
-
export const
|
|
29
|
+
export const sourceStatusList = [
|
|
23
30
|
'active', // active and approved sources
|
|
24
31
|
'pending', // sources that are pending approval
|
|
25
32
|
'inactive', // sources that are inactive
|
|
26
33
|
'requested', // sources that are under review
|
|
27
|
-
'deleted' // sources that have been deleted
|
|
34
|
+
'deleted', // sources that have been deleted
|
|
28
35
|
] as const;
|
|
29
36
|
|
|
30
|
-
export const generalStatusList = ['active', 'inactive'] as const;
|
|
37
|
+
export const generalStatusList = ['active', 'inactive', 'deleted'] as const;
|
|
31
38
|
|
|
32
39
|
export const zodRegionSchema = z.object({
|
|
33
40
|
_id: z.string().optional(),
|
|
@@ -36,6 +43,8 @@ export const zodRegionSchema = z.object({
|
|
|
36
43
|
legend: z.string().optional(), // e.g., legend for maps
|
|
37
44
|
created_at: z.number().optional(), // creation date
|
|
38
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
|
|
39
48
|
});
|
|
40
49
|
|
|
41
50
|
export const zodSourceGroupSchema = z.object({
|
|
@@ -47,38 +56,39 @@ export const zodSourceGroupSchema = z.object({
|
|
|
47
56
|
max_active_sources: z.number().optional(), // e.g., maximum number of active sources allowed
|
|
48
57
|
created_at: z.number().optional(), // creation date
|
|
49
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(),
|
|
50
61
|
});
|
|
51
62
|
|
|
52
|
-
export const zodSourceSchema = z
|
|
53
|
-
.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
})
|
|
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(sourceStatusList), // 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(),
|
|
88
|
+
})
|
|
89
|
+
.optional(), // user who requested this source
|
|
90
|
+
notes: z.string().optional(), // internal notes about the source
|
|
91
|
+
});
|
|
82
92
|
|
|
83
93
|
export const zodGeoSchema = z.object({
|
|
84
94
|
_id: z.string().optional(),
|
|
@@ -149,20 +159,25 @@ export type RegionType = z.infer<typeof zodRegionSchema>;
|
|
|
149
159
|
export type SourceGroupType = z.infer<typeof zodSourceGroupSchema>;
|
|
150
160
|
export type SourceType = z.infer<typeof zodSourceSchema>;
|
|
151
161
|
export type DataType = z.infer<typeof zodDataSchema>;
|
|
152
|
-
export type
|
|
162
|
+
export type SourceStatusType = (typeof sourceStatusList)[number];
|
|
163
|
+
export type StatusType = (typeof generalStatusList)[number];
|
|
153
164
|
export type TimeRangeTypeLiteral = 'relative' | 'absolute';
|
|
154
165
|
export type AddSourceToReviewType = Pick<
|
|
155
166
|
SourceType,
|
|
156
167
|
'platform' | 'url' | 'description'
|
|
157
|
-
> &
|
|
168
|
+
> &
|
|
169
|
+
Partial<Pick<SourceType, 'public_id'>>;
|
|
158
170
|
|
|
159
171
|
export type GeoType = z.infer<typeof zodGeoSchema>;
|
|
160
172
|
export type GeoSelectionType = z.infer<typeof zodGeoSelectionSchema>;
|
|
161
173
|
|
|
162
174
|
// Helper type to get allowed entities for a specific platform
|
|
163
|
-
export type PlatformEntityType<T extends typeof platformsList[number]> =
|
|
175
|
+
export type PlatformEntityType<T extends (typeof platformsList)[number]> =
|
|
176
|
+
(typeof platformEntityMap)[T][number];
|
|
164
177
|
|
|
165
178
|
// Helper function to get allowed entities for a platform
|
|
166
|
-
export const getAllowedEntitiesForPlatform = (
|
|
179
|
+
export const getAllowedEntitiesForPlatform = (
|
|
180
|
+
platform: (typeof platformsList)[number]
|
|
181
|
+
) => {
|
|
167
182
|
return platformEntityMap[platform];
|
|
168
183
|
};
|