asfur 1.0.19 → 1.0.21

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 CHANGED
@@ -271,6 +271,7 @@ export declare const MongoSourceSchema: Schema<{
271
271
  tags?: string[] | undefined;
272
272
  metadata?: Record<string, any> | undefined;
273
273
  updated_at?: Date | undefined;
274
+ user_id?: string | undefined;
274
275
  }, import("mongoose").Model<{
275
276
  platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "document" | "other";
276
277
  status: "approved" | "pending" | "inactive" | "in_review";
@@ -289,6 +290,7 @@ export declare const MongoSourceSchema: Schema<{
289
290
  tags?: string[] | undefined;
290
291
  metadata?: Record<string, any> | undefined;
291
292
  updated_at?: Date | undefined;
293
+ user_id?: string | undefined;
292
294
  }, any, any, any, import("mongoose").Document<unknown, any, {
293
295
  platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "document" | "other";
294
296
  status: "approved" | "pending" | "inactive" | "in_review";
@@ -307,6 +309,7 @@ export declare const MongoSourceSchema: Schema<{
307
309
  tags?: string[] | undefined;
308
310
  metadata?: Record<string, any> | undefined;
309
311
  updated_at?: Date | undefined;
312
+ user_id?: string | undefined;
310
313
  }, any> & {
311
314
  platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "document" | "other";
312
315
  status: "approved" | "pending" | "inactive" | "in_review";
@@ -325,6 +328,7 @@ export declare const MongoSourceSchema: Schema<{
325
328
  tags?: string[] | undefined;
326
329
  metadata?: Record<string, any> | undefined;
327
330
  updated_at?: Date | undefined;
331
+ user_id?: string | undefined;
328
332
  } & Required<{
329
333
  _id: string;
330
334
  }> & {
@@ -347,6 +351,7 @@ export declare const MongoSourceSchema: Schema<{
347
351
  tags?: string[] | undefined;
348
352
  metadata?: Record<string, any> | undefined;
349
353
  updated_at?: Date | undefined;
354
+ user_id?: string | undefined;
350
355
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
351
356
  platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "document" | "other";
352
357
  status: "approved" | "pending" | "inactive" | "in_review";
@@ -365,6 +370,7 @@ export declare const MongoSourceSchema: Schema<{
365
370
  tags?: string[] | undefined;
366
371
  metadata?: Record<string, any> | undefined;
367
372
  updated_at?: Date | undefined;
373
+ user_id?: string | undefined;
368
374
  }>, {}> & import("mongoose").FlatRecord<{
369
375
  platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "document" | "other";
370
376
  status: "approved" | "pending" | "inactive" | "in_review";
@@ -383,12 +389,14 @@ export declare const MongoSourceSchema: Schema<{
383
389
  tags?: string[] | undefined;
384
390
  metadata?: Record<string, any> | undefined;
385
391
  updated_at?: Date | undefined;
392
+ user_id?: string | undefined;
386
393
  }> & Required<{
387
394
  _id: string;
388
395
  }> & {
389
396
  __v: number;
390
397
  }>;
391
398
  export declare const MongoQuerySchema: Schema<{
399
+ user_id: string;
392
400
  sources: string[];
393
401
  time_range: {
394
402
  type: "relative";
@@ -398,13 +406,13 @@ export declare const MongoQuerySchema: Schema<{
398
406
  start: number | Date;
399
407
  end: number | Date;
400
408
  };
401
- user_id: string;
402
409
  is_default: boolean;
403
410
  _id?: string | undefined;
404
411
  title?: string | undefined;
405
412
  query?: string | undefined;
406
413
  user_instructions?: string | undefined;
407
414
  }, import("mongoose").Model<{
415
+ user_id: string;
408
416
  sources: string[];
409
417
  time_range: {
410
418
  type: "relative";
@@ -414,13 +422,13 @@ export declare const MongoQuerySchema: Schema<{
414
422
  start: number | Date;
415
423
  end: number | Date;
416
424
  };
417
- user_id: string;
418
425
  is_default: boolean;
419
426
  _id?: string | undefined;
420
427
  title?: string | undefined;
421
428
  query?: string | undefined;
422
429
  user_instructions?: string | undefined;
423
430
  }, any, any, any, import("mongoose").Document<unknown, any, {
431
+ user_id: string;
424
432
  sources: string[];
425
433
  time_range: {
426
434
  type: "relative";
@@ -430,13 +438,13 @@ export declare const MongoQuerySchema: Schema<{
430
438
  start: number | Date;
431
439
  end: number | Date;
432
440
  };
433
- user_id: string;
434
441
  is_default: boolean;
435
442
  _id?: string | undefined;
436
443
  title?: string | undefined;
437
444
  query?: string | undefined;
438
445
  user_instructions?: string | undefined;
439
446
  }, any> & {
447
+ user_id: string;
440
448
  sources: string[];
441
449
  time_range: {
442
450
  type: "relative";
@@ -446,7 +454,6 @@ export declare const MongoQuerySchema: Schema<{
446
454
  start: number | Date;
447
455
  end: number | Date;
448
456
  };
449
- user_id: string;
450
457
  is_default: boolean;
451
458
  _id?: string | undefined;
452
459
  title?: string | undefined;
@@ -457,6 +464,7 @@ export declare const MongoQuerySchema: Schema<{
457
464
  }> & {
458
465
  __v: number;
459
466
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
467
+ user_id: string;
460
468
  sources: string[];
461
469
  time_range: {
462
470
  type: "relative";
@@ -466,13 +474,13 @@ export declare const MongoQuerySchema: Schema<{
466
474
  start: number | Date;
467
475
  end: number | Date;
468
476
  };
469
- user_id: string;
470
477
  is_default: boolean;
471
478
  _id?: string | undefined;
472
479
  title?: string | undefined;
473
480
  query?: string | undefined;
474
481
  user_instructions?: string | undefined;
475
482
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
483
+ user_id: string;
476
484
  sources: string[];
477
485
  time_range: {
478
486
  type: "relative";
@@ -482,13 +490,13 @@ export declare const MongoQuerySchema: Schema<{
482
490
  start: number | Date;
483
491
  end: number | Date;
484
492
  };
485
- user_id: string;
486
493
  is_default: boolean;
487
494
  _id?: string | undefined;
488
495
  title?: string | undefined;
489
496
  query?: string | undefined;
490
497
  user_instructions?: string | undefined;
491
498
  }>, {}> & import("mongoose").FlatRecord<{
499
+ user_id: string;
492
500
  sources: string[];
493
501
  time_range: {
494
502
  type: "relative";
@@ -498,7 +506,6 @@ export declare const MongoQuerySchema: Schema<{
498
506
  start: number | Date;
499
507
  end: number | Date;
500
508
  };
501
- user_id: string;
502
509
  is_default: boolean;
503
510
  _id?: string | undefined;
504
511
  title?: string | undefined;
@@ -509,3 +516,28 @@ export declare const MongoQuerySchema: Schema<{
509
516
  }> & {
510
517
  __v: number;
511
518
  }>;
519
+ export declare const MongoUserSettingsSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
520
+ versionKey: false;
521
+ toJSON: {
522
+ virtuals: true;
523
+ };
524
+ toObject: {
525
+ virtuals: true;
526
+ };
527
+ }, {
528
+ user_id: string;
529
+ sources: string[];
530
+ time_range?: any;
531
+ }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
532
+ user_id: string;
533
+ sources: string[];
534
+ time_range?: any;
535
+ }>, {}> & import("mongoose").FlatRecord<{
536
+ user_id: string;
537
+ sources: string[];
538
+ time_range?: any;
539
+ }> & {
540
+ _id: import("mongoose").Types.ObjectId;
541
+ } & {
542
+ __v: number;
543
+ }>;
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.MongoQuerySchema = exports.MongoSourceSchema = exports.MongoInstructionsSchema = exports.MongoDataSchema = void 0;
17
+ exports.MongoUserSettingsSchema = exports.MongoQuerySchema = exports.MongoSourceSchema = exports.MongoInstructionsSchema = exports.MongoDataSchema = void 0;
18
18
  // Export types for consumers
19
19
  __exportStar(require("./types"), exports);
20
20
  const mongoose_1 = require("mongoose");
@@ -105,3 +105,14 @@ exports.MongoQuerySchema = new mongoose_1.Schema({
105
105
  toJSON: { virtuals: true },
106
106
  toObject: { virtuals: true },
107
107
  });
108
+ exports.MongoUserSettingsSchema = new mongoose_1.Schema({
109
+ sources: { type: [String] },
110
+ time_range: {
111
+ type: mongoose_1.Schema.Types.Mixed, // can be relative or absolute time range
112
+ },
113
+ user_id: { type: String, required: true }, // user identifier
114
+ }, {
115
+ versionKey: false,
116
+ toJSON: { virtuals: true },
117
+ toObject: { virtuals: true },
118
+ });
package/dist/types.d.ts CHANGED
@@ -19,6 +19,7 @@ export declare const zodSourceSchema: z.ZodObject<{
19
19
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
20
20
  created_at: z.ZodDate;
21
21
  updated_at: z.ZodOptional<z.ZodDate>;
22
+ user_id: z.ZodOptional<z.ZodString>;
22
23
  }, "strip", z.ZodTypeAny, {
23
24
  platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "document" | "other";
24
25
  status: "approved" | "pending" | "inactive" | "in_review";
@@ -37,6 +38,7 @@ export declare const zodSourceSchema: z.ZodObject<{
37
38
  tags?: string[] | undefined;
38
39
  metadata?: Record<string, any> | undefined;
39
40
  updated_at?: Date | undefined;
41
+ user_id?: string | undefined;
40
42
  }, {
41
43
  platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "document" | "other";
42
44
  status: "approved" | "pending" | "inactive" | "in_review";
@@ -55,6 +57,7 @@ export declare const zodSourceSchema: z.ZodObject<{
55
57
  is_public?: boolean | undefined;
56
58
  metadata?: Record<string, any> | undefined;
57
59
  updated_at?: Date | undefined;
60
+ user_id?: string | undefined;
58
61
  }>;
59
62
  export declare const zodDataSchema: z.ZodObject<{
60
63
  _id: z.ZodOptional<z.ZodString>;
@@ -191,6 +194,7 @@ export declare const zodQuerySchema: z.ZodObject<{
191
194
  user_id: z.ZodString;
192
195
  is_default: z.ZodDefault<z.ZodBoolean>;
193
196
  }, "strip", z.ZodTypeAny, {
197
+ user_id: string;
194
198
  sources: string[];
195
199
  time_range: {
196
200
  type: "relative";
@@ -200,13 +204,13 @@ export declare const zodQuerySchema: z.ZodObject<{
200
204
  start: number | Date;
201
205
  end: number | Date;
202
206
  };
203
- user_id: string;
204
207
  is_default: boolean;
205
208
  _id?: string | undefined;
206
209
  title?: string | undefined;
207
210
  query?: string | undefined;
208
211
  user_instructions?: string | undefined;
209
212
  }, {
213
+ user_id: string;
210
214
  sources: string[];
211
215
  time_range: {
212
216
  type: "relative";
@@ -216,7 +220,6 @@ export declare const zodQuerySchema: z.ZodObject<{
216
220
  start: number | Date;
217
221
  end: number | Date;
218
222
  };
219
- user_id: string;
220
223
  _id?: string | undefined;
221
224
  title?: string | undefined;
222
225
  query?: string | undefined;
@@ -242,6 +245,57 @@ export declare const zodInstructionsSchema: z.ZodObject<{
242
245
  created_at?: number | Date | undefined;
243
246
  updated_at?: number | Date | undefined;
244
247
  }>;
248
+ export declare const zodUserSettingsSchema: z.ZodObject<{
249
+ _id: z.ZodOptional<z.ZodString>;
250
+ sources: z.ZodArray<z.ZodString, "many">;
251
+ time_range: z.ZodUnion<[z.ZodObject<{
252
+ type: z.ZodLiteral<"relative">;
253
+ time: z.ZodEnum<["last_12_hours", "last_24_hours", "last_48_hours", "last_72_hours", "last_week"]>;
254
+ }, "strip", z.ZodTypeAny, {
255
+ type: "relative";
256
+ time: "last_12_hours" | "last_24_hours" | "last_48_hours" | "last_72_hours" | "last_week";
257
+ }, {
258
+ type: "relative";
259
+ time: "last_12_hours" | "last_24_hours" | "last_48_hours" | "last_72_hours" | "last_week";
260
+ }>, z.ZodObject<{
261
+ type: z.ZodLiteral<"absolute">;
262
+ start: z.ZodUnion<[z.ZodDate, z.ZodNumber]>;
263
+ end: z.ZodUnion<[z.ZodDate, z.ZodNumber]>;
264
+ }, "strip", z.ZodTypeAny, {
265
+ type: "absolute";
266
+ start: number | Date;
267
+ end: number | Date;
268
+ }, {
269
+ type: "absolute";
270
+ start: number | Date;
271
+ end: number | Date;
272
+ }>]>;
273
+ user_id: z.ZodString;
274
+ }, "strip", z.ZodTypeAny, {
275
+ user_id: string;
276
+ sources: string[];
277
+ time_range: {
278
+ type: "relative";
279
+ time: "last_12_hours" | "last_24_hours" | "last_48_hours" | "last_72_hours" | "last_week";
280
+ } | {
281
+ type: "absolute";
282
+ start: number | Date;
283
+ end: number | Date;
284
+ };
285
+ _id?: string | undefined;
286
+ }, {
287
+ user_id: string;
288
+ sources: string[];
289
+ time_range: {
290
+ type: "relative";
291
+ time: "last_12_hours" | "last_24_hours" | "last_48_hours" | "last_72_hours" | "last_week";
292
+ } | {
293
+ type: "absolute";
294
+ start: number | Date;
295
+ end: number | Date;
296
+ };
297
+ _id?: string | undefined;
298
+ }>;
245
299
  export type SourceType = z.infer<typeof zodSourceSchema>;
246
300
  export type DataType = z.infer<typeof zodDataSchema>;
247
301
  export type QueryType = z.infer<typeof zodQuerySchema>;
@@ -250,3 +304,4 @@ export type StatusType = (typeof statusList)[number];
250
304
  export type TimeRangeType = z.infer<typeof zodRelativeTimeRangeSchema> | z.infer<typeof zodAbsoluteTimeRangeSchema>;
251
305
  export type TimeRangeTypeLiteral = 'relative' | 'absolute';
252
306
  export type AddSourceToReviewType = Pick<SourceType, 'platform' | 'url' | 'description' | 'source_public_id'>;
307
+ export type UserSettingsType = z.infer<typeof zodUserSettingsSchema>;
package/dist/types.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zodInstructionsSchema = exports.zodQuerySchema = exports.zodAbsoluteTimeRangeSchema = exports.zodRelativeTimeRangeSchema = exports.zodDataSchema = exports.zodSourceSchema = exports.statusList = exports.platformsList = void 0;
3
+ exports.zodUserSettingsSchema = exports.zodInstructionsSchema = exports.zodQuerySchema = exports.zodAbsoluteTimeRangeSchema = exports.zodRelativeTimeRangeSchema = exports.zodDataSchema = exports.zodSourceSchema = exports.statusList = exports.platformsList = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.platformsList = [
6
6
  'telegram',
@@ -35,6 +35,7 @@ exports.zodSourceSchema = zod_1.z.object({
35
35
  metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
36
36
  created_at: zod_1.z.coerce.date(),
37
37
  updated_at: zod_1.z.coerce.date().optional(),
38
+ user_id: zod_1.z.string().optional(), // user identifier
38
39
  });
39
40
  exports.zodDataSchema = zod_1.z.object({
40
41
  _id: zod_1.z.string().optional(),
@@ -95,3 +96,9 @@ exports.zodInstructionsSchema = zod_1.z.object({
95
96
  created_at: zod_1.z.coerce.date().or(zod_1.z.number()).optional(),
96
97
  updated_at: zod_1.z.coerce.date().or(zod_1.z.number()).optional(), // last update date
97
98
  });
99
+ exports.zodUserSettingsSchema = zod_1.z.object({
100
+ _id: zod_1.z.string().optional(),
101
+ sources: zod_1.z.array(zod_1.z.string()),
102
+ time_range: exports.zodRelativeTimeRangeSchema.or(exports.zodAbsoluteTimeRangeSchema),
103
+ user_id: zod_1.z.string().nonempty('User ID must be provided'), // user identifier
104
+ });
package/index.ts CHANGED
@@ -106,3 +106,18 @@ export const MongoQuerySchema = new Schema<QueryType>(
106
106
  toObject: { virtuals: true },
107
107
  }
108
108
  );
109
+
110
+ export const MongoUserSettingsSchema = new Schema(
111
+ {
112
+ sources: { type: [String] }, // array of source _id strings
113
+ time_range: {
114
+ type: Schema.Types.Mixed, // can be relative or absolute time range
115
+ },
116
+ user_id: { type: String, required: true }, // user identifier
117
+ },
118
+ {
119
+ versionKey: false,
120
+ toJSON: { virtuals: true },
121
+ toObject: { virtuals: true },
122
+ }
123
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asfur",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "description": "SDK for interacting with the Asfur API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/types.ts CHANGED
@@ -35,6 +35,7 @@ export const zodSourceSchema = z.object({
35
35
  metadata: z.record(z.string(), z.any()).optional(), // flexible per platform
36
36
  created_at: z.coerce.date(),
37
37
  updated_at: z.coerce.date().optional(),
38
+ user_id: z.string().optional(), // user identifier
38
39
  });
39
40
 
40
41
  export const zodDataSchema = z.object({
@@ -103,6 +104,14 @@ export const zodInstructionsSchema = z.object({
103
104
  updated_at: z.coerce.date().or(z.number()).optional(), // last update date
104
105
  });
105
106
 
107
+
108
+ export const zodUserSettingsSchema = z.object({
109
+ _id: z.string().optional(),
110
+ sources: z.array(z.string()), // array of source _id strings
111
+ time_range: zodRelativeTimeRangeSchema.or(zodAbsoluteTimeRangeSchema), // optional time range for the query
112
+ user_id: z.string().nonempty('User ID must be provided'), // user identifier
113
+ });
114
+
106
115
  export type SourceType = z.infer<typeof zodSourceSchema>;
107
116
  export type DataType = z.infer<typeof zodDataSchema>;
108
117
  export type QueryType = z.infer<typeof zodQuerySchema>;
@@ -116,3 +125,4 @@ export type AddSourceToReviewType = Pick<
116
125
  SourceType,
117
126
  'platform' | 'url' | 'description' | 'source_public_id'
118
127
  >;
128
+ export type UserSettingsType = z.infer<typeof zodUserSettingsSchema>;