asfur 1.0.89 → 1.0.91

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
@@ -543,3 +543,40 @@ export declare const MongoReportSchema: Schema<any, import("mongoose").Model<any
543
543
  } & {
544
544
  __v: number;
545
545
  }>;
546
+ export declare const MongoNotificationSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
547
+ versionKey: false;
548
+ toJSON: {
549
+ virtuals: true;
550
+ };
551
+ toObject: {
552
+ virtuals: true;
553
+ };
554
+ }, {
555
+ message: string;
556
+ created_at: number;
557
+ updated_at: number;
558
+ user_id: string;
559
+ is_read: boolean;
560
+ priority: "low" | "medium" | "high" | "critical";
561
+ redirect_url?: string | null | undefined;
562
+ }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
563
+ message: string;
564
+ created_at: number;
565
+ updated_at: number;
566
+ user_id: string;
567
+ is_read: boolean;
568
+ priority: "low" | "medium" | "high" | "critical";
569
+ redirect_url?: string | null | undefined;
570
+ }>, {}> & import("mongoose").FlatRecord<{
571
+ message: string;
572
+ created_at: number;
573
+ updated_at: number;
574
+ user_id: string;
575
+ is_read: boolean;
576
+ priority: "low" | "medium" | "high" | "critical";
577
+ redirect_url?: string | null | undefined;
578
+ }> & {
579
+ _id: import("mongoose").Types.ObjectId;
580
+ } & {
581
+ __v: number;
582
+ }>;
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.MongoReportSchema = exports.MongoApiKeySchema = exports.MongoGeoSelectionSchema = exports.MongoGeoSchema = exports.MongoJobSchema = exports.MongoConversationSchema = exports.MongoUserSettingsSchema = exports.MongoQuerySchema = exports.MongoSourceSchema = exports.MongoInstructionsSchema = exports.MongoDataSchema = void 0;
17
+ exports.MongoNotificationSchema = exports.MongoReportSchema = exports.MongoApiKeySchema = exports.MongoGeoSelectionSchema = exports.MongoGeoSchema = exports.MongoJobSchema = exports.MongoConversationSchema = 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");
@@ -237,3 +237,16 @@ exports.MongoReportSchema = new mongoose_1.Schema({
237
237
  toJSON: { virtuals: true },
238
238
  toObject: { virtuals: true },
239
239
  });
240
+ exports.MongoNotificationSchema = new mongoose_1.Schema({
241
+ user_id: { type: String, required: true },
242
+ message: { type: String, required: true },
243
+ is_read: { type: Boolean, default: false },
244
+ priority: { type: String, enum: types_1.notificationPriorityList, default: 'low' },
245
+ redirect_url: { type: String },
246
+ created_at: { type: Number, default: Date.now },
247
+ updated_at: { type: Number, default: Date.now }, // last update date
248
+ }, {
249
+ versionKey: false,
250
+ toJSON: { virtuals: true },
251
+ toObject: { virtuals: true },
252
+ });
package/dist/types.d.ts CHANGED
@@ -684,6 +684,35 @@ export declare const zodReportSchema: z.ZodObject<{
684
684
  additional_instructions?: string | undefined;
685
685
  report_html?: string | undefined;
686
686
  }>;
687
+ export declare const notificationPriorityList: readonly ["low", "medium", "high", "critical"];
688
+ export declare const zodNotificationSchema: z.ZodObject<{
689
+ _id: z.ZodOptional<z.ZodString>;
690
+ user_id: z.ZodString;
691
+ message: z.ZodString;
692
+ is_read: z.ZodDefault<z.ZodBoolean>;
693
+ priority: z.ZodEnum<["low", "medium", "high", "critical"]>;
694
+ redirect_url: z.ZodOptional<z.ZodString>;
695
+ created_at: z.ZodOptional<z.ZodNumber>;
696
+ updated_at: z.ZodOptional<z.ZodNumber>;
697
+ }, "strip", z.ZodTypeAny, {
698
+ message: string;
699
+ user_id: string;
700
+ is_read: boolean;
701
+ priority: "low" | "medium" | "high" | "critical";
702
+ _id?: string | undefined;
703
+ created_at?: number | undefined;
704
+ updated_at?: number | undefined;
705
+ redirect_url?: string | undefined;
706
+ }, {
707
+ message: string;
708
+ user_id: string;
709
+ priority: "low" | "medium" | "high" | "critical";
710
+ _id?: string | undefined;
711
+ created_at?: number | undefined;
712
+ updated_at?: number | undefined;
713
+ is_read?: boolean | undefined;
714
+ redirect_url?: string | undefined;
715
+ }>;
687
716
  /**
688
717
  * 'approved' - active and approved sources,
689
718
  * 'back_to_business' - sources that were paused and now resumed,
@@ -708,6 +737,7 @@ export type GeoType = z.infer<typeof zodGeoSchema>;
708
737
  export type GeoSelectionType = z.infer<typeof zodGeoSelectionSchema>;
709
738
  export type ApiKeyType = z.infer<typeof zodApiKeySchema>;
710
739
  export type ReportType = z.infer<typeof zodReportSchema>;
740
+ export type NotificationType = z.infer<typeof zodNotificationSchema>;
711
741
  export type UserPublicMetadata = {
712
742
  is_admin?: boolean;
713
743
  regions?: {
package/dist/types.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zodReportSchema = exports.reportProcessStatusList = exports.zodApiKeySchema = exports.zodCronScheduleResponseSchema = exports.zodJobSchema = exports.zodConversationSchema = exports.zodUserSettingsSchema = exports.zodInstructionsSchema = exports.zodQuerySchema = exports.zodAbsoluteTimeRangeSchema = exports.zodRelativeTimeRangeSchema = exports.relativeTimeRangeList = exports.zodDataSchema = exports.zodSourceSchema = exports.zodGeoSelectionSchema = exports.zodGeoSchema = exports.generalStatusList = exports.statusList = exports.platformsList = void 0;
3
+ exports.zodNotificationSchema = exports.notificationPriorityList = exports.zodReportSchema = exports.reportProcessStatusList = exports.zodApiKeySchema = exports.zodCronScheduleResponseSchema = exports.zodJobSchema = exports.zodConversationSchema = exports.zodUserSettingsSchema = exports.zodInstructionsSchema = exports.zodQuerySchema = exports.zodAbsoluteTimeRangeSchema = exports.zodRelativeTimeRangeSchema = exports.relativeTimeRangeList = exports.zodDataSchema = exports.zodSourceSchema = exports.zodGeoSelectionSchema = exports.zodGeoSchema = exports.generalStatusList = exports.statusList = exports.platformsList = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.platformsList = [
6
6
  'telegram',
@@ -211,3 +211,19 @@ exports.zodReportSchema = zod_1.z.object({
211
211
  type: zod_1.z.enum(['pdf', 'slide']),
212
212
  process_status: zod_1.z.enum(exports.reportProcessStatusList), // status of the report generation process
213
213
  });
214
+ exports.notificationPriorityList = [
215
+ 'low',
216
+ 'medium',
217
+ 'high',
218
+ 'critical',
219
+ ];
220
+ exports.zodNotificationSchema = zod_1.z.object({
221
+ _id: zod_1.z.string().optional(),
222
+ user_id: zod_1.z.string(),
223
+ message: zod_1.z.string(),
224
+ is_read: zod_1.z.boolean().default(false),
225
+ priority: zod_1.z.enum(exports.notificationPriorityList),
226
+ redirect_url: zod_1.z.string().url().optional(),
227
+ created_at: zod_1.z.number().optional(),
228
+ updated_at: zod_1.z.number().optional(), // last update date
229
+ });
package/index.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  export * from './types';
3
3
 
4
4
  import { Schema } from 'mongoose';
5
- import { generalStatusList } from './types';
5
+ import { generalStatusList, notificationPriorityList } from './types';
6
6
 
7
7
  export const MongoDataSchema = new Schema(
8
8
  {
@@ -245,7 +245,7 @@ export const MongoApiKeySchema = new Schema(
245
245
  export const MongoReportSchema = new Schema(
246
246
  {
247
247
  user_id: { type: String, required: true }, // user identifier
248
- thread_id: { type: String },
248
+ thread_id: { type: String },
249
249
  title: { type: String }, // report title
250
250
  last_assistant_messages_count: { type: Number }, // number of assistant messages at the time of report
251
251
  additional_instructions: { type: String }, // additional instructions provided by the user
@@ -265,3 +265,20 @@ export const MongoReportSchema = new Schema(
265
265
  toObject: { virtuals: true },
266
266
  }
267
267
  );
268
+
269
+ export const MongoNotificationSchema = new Schema(
270
+ {
271
+ user_id: { type: String, required: true }, // user identifier
272
+ message: { type: String, required: true }, // notification message
273
+ is_read: { type: Boolean, default: false }, // read status
274
+ priority: { type: String, enum: notificationPriorityList, default: 'low' }, // notification priority
275
+ redirect_url: { type: String }, // optional URL to redirect when the notification is clicked
276
+ created_at: { type: Number, default: Date.now }, // creation date
277
+ updated_at: { type: Number, default: Date.now }, // last update date
278
+ },
279
+ {
280
+ versionKey: false,
281
+ toJSON: { virtuals: true },
282
+ toObject: { virtuals: true },
283
+ }
284
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asfur",
3
- "version": "1.0.89",
3
+ "version": "1.0.91",
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
@@ -234,6 +234,24 @@ export const zodReportSchema = z.object({
234
234
  process_status: z.enum(reportProcessStatusList), // status of the report generation process
235
235
  });
236
236
 
237
+ export const notificationPriorityList = [
238
+ 'low',
239
+ 'medium',
240
+ 'high',
241
+ 'critical',
242
+ ] as const;
243
+
244
+ export const zodNotificationSchema = z.object({
245
+ _id: z.string().optional(),
246
+ user_id: z.string(), // user identifier
247
+ message: z.string(), // notification message
248
+ is_read: z.boolean().default(false), // true if the notification has been read
249
+ priority: z.enum(notificationPriorityList), // priority of the notification
250
+ redirect_url: z.string().url().optional(), // optional URL to redirect when the notification is clicked
251
+ created_at: z.number().optional(), // creation date
252
+ updated_at: z.number().optional(), // last update date
253
+ });
254
+
237
255
  /**
238
256
  * 'approved' - active and approved sources,
239
257
  * 'back_to_business' - sources that were paused and now resumed,
@@ -265,6 +283,7 @@ export type GeoType = z.infer<typeof zodGeoSchema>;
265
283
  export type GeoSelectionType = z.infer<typeof zodGeoSelectionSchema>;
266
284
  export type ApiKeyType = z.infer<typeof zodApiKeySchema>;
267
285
  export type ReportType = z.infer<typeof zodReportSchema>;
286
+ export type NotificationType = z.infer<typeof zodNotificationSchema>;
268
287
 
269
288
  export type UserPublicMetadata = {
270
289
  is_admin?: boolean;