asfur 1.0.125 → 1.0.127

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
@@ -778,3 +778,49 @@ export declare const MongoSendWhatsappSchema: Schema<any, import("mongoose").Mod
778
778
  } & {
779
779
  __v: number;
780
780
  }>;
781
+ export declare const MongoPredefinedQuerySchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
782
+ versionKey: false;
783
+ toJSON: {
784
+ virtuals: true;
785
+ };
786
+ toObject: {
787
+ virtuals: true;
788
+ };
789
+ }, {
790
+ status: "active" | "inactive";
791
+ query: string;
792
+ geos: string[];
793
+ geos_ids: any[];
794
+ user_id: string;
795
+ created_at: number;
796
+ updated_at: number;
797
+ title?: string | null | undefined;
798
+ time_range?: any;
799
+ user_instructions?: string | null | undefined;
800
+ }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
801
+ status: "active" | "inactive";
802
+ query: string;
803
+ geos: string[];
804
+ geos_ids: any[];
805
+ user_id: string;
806
+ created_at: number;
807
+ updated_at: number;
808
+ title?: string | null | undefined;
809
+ time_range?: any;
810
+ user_instructions?: string | null | undefined;
811
+ }>, {}> & import("mongoose").FlatRecord<{
812
+ status: "active" | "inactive";
813
+ query: string;
814
+ geos: string[];
815
+ geos_ids: any[];
816
+ user_id: string;
817
+ created_at: number;
818
+ updated_at: number;
819
+ title?: string | null | undefined;
820
+ time_range?: any;
821
+ user_instructions?: string | null | undefined;
822
+ }> & {
823
+ _id: import("mongoose").Types.ObjectId;
824
+ } & {
825
+ __v: number;
826
+ }>;
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.MongoSendWhatsappSchema = exports.MongoSendEmailSchema = exports.MongoMessageSchema = exports.MongoHeatmapSchema = exports.MongoScenarioScoreSchema = exports.MongoScenarioSchema = exports.MongoNotificationSchema = exports.MongoReportSchema = exports.MongoApiKeySchema = exports.MongoJobSchema = exports.MongoConversationSchema = exports.MongoUserSettingsSchema = exports.MongoQuerySchema = exports.MongoInstructionsSchema = void 0;
17
+ exports.MongoPredefinedQuerySchema = exports.MongoSendWhatsappSchema = exports.MongoSendEmailSchema = exports.MongoMessageSchema = exports.MongoHeatmapSchema = exports.MongoScenarioScoreSchema = exports.MongoScenarioSchema = exports.MongoNotificationSchema = exports.MongoReportSchema = exports.MongoApiKeySchema = exports.MongoJobSchema = exports.MongoConversationSchema = exports.MongoUserSettingsSchema = exports.MongoQuerySchema = exports.MongoInstructionsSchema = void 0;
18
18
  // Export types for consumers
19
19
  __exportStar(require("./types"), exports);
20
20
  const mongoose_1 = require("mongoose");
@@ -311,3 +311,23 @@ exports.MongoSendWhatsappSchema = new mongoose_1.Schema({
311
311
  toJSON: { virtuals: true },
312
312
  toObject: { virtuals: true },
313
313
  });
314
+ exports.MongoPredefinedQuerySchema = new mongoose_1.Schema({
315
+ user_id: { type: String, required: true },
316
+ title: { type: String },
317
+ query: { type: String, required: true },
318
+ geos: { type: [String] },
319
+ geos_ids: { type: [mongoose_1.Schema.Types.Mixed] },
320
+ time_range: { type: mongoose_1.Schema.Types.Mixed },
321
+ user_instructions: { type: String },
322
+ status: {
323
+ type: String,
324
+ enum: types_1.generalStatusList,
325
+ default: 'active',
326
+ },
327
+ created_at: { type: Number, default: Date.now },
328
+ updated_at: { type: Number, default: Date.now }, // last update date
329
+ }, {
330
+ versionKey: false,
331
+ toJSON: { virtuals: true },
332
+ toObject: { virtuals: true },
333
+ });
package/dist/types.d.ts CHANGED
@@ -2063,6 +2063,93 @@ export declare const zodSendWhatsappSchema: z.ZodObject<{
2063
2063
  body: string;
2064
2064
  html?: string | undefined;
2065
2065
  }>;
2066
+ export declare const zodPredefinedQuerySchema: z.ZodObject<{
2067
+ _id: z.ZodOptional<z.ZodString>;
2068
+ user_id: z.ZodString;
2069
+ title: z.ZodString;
2070
+ query: z.ZodString;
2071
+ geos: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2072
+ geos_ids: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
2073
+ _id: z.ZodString;
2074
+ name: z.ZodString;
2075
+ }, "strip", z.ZodTypeAny, {
2076
+ _id: string;
2077
+ name: string;
2078
+ }, {
2079
+ _id: string;
2080
+ name: string;
2081
+ }>]>, "many">>;
2082
+ time_range: z.ZodUnion<[z.ZodObject<{
2083
+ type: z.ZodLiteral<"relative">;
2084
+ time: z.ZodEnum<["last_30_minutes", "last_1_hour", "last_2_hours", "last_6_hours", "last_12_hours", "last_24_hours", "last_48_hours", "last_72_hours", "last_week"]>;
2085
+ }, "strip", z.ZodTypeAny, {
2086
+ type: "relative";
2087
+ time: "last_30_minutes" | "last_1_hour" | "last_2_hours" | "last_6_hours" | "last_12_hours" | "last_24_hours" | "last_48_hours" | "last_72_hours" | "last_week";
2088
+ }, {
2089
+ type: "relative";
2090
+ time: "last_30_minutes" | "last_1_hour" | "last_2_hours" | "last_6_hours" | "last_12_hours" | "last_24_hours" | "last_48_hours" | "last_72_hours" | "last_week";
2091
+ }>, z.ZodObject<{
2092
+ type: z.ZodLiteral<"absolute">;
2093
+ start: z.ZodNumber;
2094
+ end: z.ZodNumber;
2095
+ }, "strip", z.ZodTypeAny, {
2096
+ type: "absolute";
2097
+ start: number;
2098
+ end: number;
2099
+ }, {
2100
+ type: "absolute";
2101
+ start: number;
2102
+ end: number;
2103
+ }>]>;
2104
+ user_instructions: z.ZodOptional<z.ZodString>;
2105
+ status: z.ZodDefault<z.ZodEnum<["active", "inactive"]>>;
2106
+ created_at: z.ZodOptional<z.ZodNumber>;
2107
+ updated_at: z.ZodOptional<z.ZodNumber>;
2108
+ }, "strip", z.ZodTypeAny, {
2109
+ status: "active" | "inactive";
2110
+ title: string;
2111
+ query: string;
2112
+ time_range: {
2113
+ type: "relative";
2114
+ time: "last_30_minutes" | "last_1_hour" | "last_2_hours" | "last_6_hours" | "last_12_hours" | "last_24_hours" | "last_48_hours" | "last_72_hours" | "last_week";
2115
+ } | {
2116
+ type: "absolute";
2117
+ start: number;
2118
+ end: number;
2119
+ };
2120
+ user_id: string;
2121
+ _id?: string | undefined;
2122
+ geos?: string[] | undefined;
2123
+ geos_ids?: (string | {
2124
+ _id: string;
2125
+ name: string;
2126
+ })[] | undefined;
2127
+ user_instructions?: string | undefined;
2128
+ created_at?: number | undefined;
2129
+ updated_at?: number | undefined;
2130
+ }, {
2131
+ title: string;
2132
+ query: string;
2133
+ time_range: {
2134
+ type: "relative";
2135
+ time: "last_30_minutes" | "last_1_hour" | "last_2_hours" | "last_6_hours" | "last_12_hours" | "last_24_hours" | "last_48_hours" | "last_72_hours" | "last_week";
2136
+ } | {
2137
+ type: "absolute";
2138
+ start: number;
2139
+ end: number;
2140
+ };
2141
+ user_id: string;
2142
+ status?: "active" | "inactive" | undefined;
2143
+ _id?: string | undefined;
2144
+ geos?: string[] | undefined;
2145
+ geos_ids?: (string | {
2146
+ _id: string;
2147
+ name: string;
2148
+ })[] | undefined;
2149
+ user_instructions?: string | undefined;
2150
+ created_at?: number | undefined;
2151
+ updated_at?: number | undefined;
2152
+ }>;
2066
2153
  /**
2067
2154
  * 'approved' - active and approved sources,
2068
2155
  * 'back_to_business' - sources that were paused and now resumed,
@@ -2089,6 +2176,7 @@ export type MessageType = z.infer<typeof zodMessageSchema>;
2089
2176
  export type HeatmapType = z.infer<typeof zodHeatmapSchema>;
2090
2177
  export type SendEmailType = z.infer<typeof zodSendEmailSchema>;
2091
2178
  export type SendWhatsappType = z.infer<typeof zodSendWhatsappSchema>;
2179
+ export type PredefinedQueryType = z.infer<typeof zodPredefinedQuerySchema>;
2092
2180
  export type UserPublicMetadata = {
2093
2181
  is_admin?: boolean;
2094
2182
  regions?: {
package/dist/types.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zodSendWhatsappSchema = exports.zodSendEmailSchema = exports.zodScenarioSchema = exports.zodScenarioScoreSchema = exports.scenarioScoreTypeList = exports.zodNotificationSchema = exports.notificationPriorityList = exports.zodReportSchema = exports.reportProcessStatusList = exports.zodApiKeySchema = exports.zodCronScheduleResponseSchema = exports.zodMessageSchema = exports.zodHeatmapSchema = exports.zodJobSchema = exports.zodConversationSchema = exports.zodUserSettingsSchema = exports.zodInstructionsSchema = exports.zodQuerySchema = exports.zodAlertSchema = exports.zodAbsoluteTimeRangeSchema = exports.zodRelativeTimeRangeSchema = exports.requestedContentList = exports.relativeTimeRangeList = exports.jobRunStatusList = exports.generalStatusList = void 0;
3
+ exports.zodPredefinedQuerySchema = exports.zodSendWhatsappSchema = exports.zodSendEmailSchema = exports.zodScenarioSchema = exports.zodScenarioScoreSchema = exports.scenarioScoreTypeList = exports.zodNotificationSchema = exports.notificationPriorityList = exports.zodReportSchema = exports.reportProcessStatusList = exports.zodApiKeySchema = exports.zodCronScheduleResponseSchema = exports.zodMessageSchema = exports.zodHeatmapSchema = exports.zodJobSchema = exports.zodConversationSchema = exports.zodUserSettingsSchema = exports.zodInstructionsSchema = exports.zodQuerySchema = exports.zodAlertSchema = exports.zodAbsoluteTimeRangeSchema = exports.zodRelativeTimeRangeSchema = exports.requestedContentList = exports.relativeTimeRangeList = exports.jobRunStatusList = exports.generalStatusList = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.generalStatusList = ['active', 'inactive'];
6
6
  exports.jobRunStatusList = ['done', 'failed', 'in_progress'];
@@ -293,3 +293,18 @@ exports.zodSendWhatsappSchema = zod_1.z.object({
293
293
  body: zod_1.z.string(),
294
294
  html: zod_1.z.string().optional(), // optional message body in HTML format
295
295
  });
296
+ exports.zodPredefinedQuerySchema = zod_1.z.object({
297
+ _id: zod_1.z.string().optional(),
298
+ user_id: zod_1.z.string().nonempty('User ID must be provided'),
299
+ title: zod_1.z.string().nonempty('Predefined query title must be provided'),
300
+ query: zod_1.z.string().nonempty('Predefined query must be provided'),
301
+ geos: zod_1.z.array(zod_1.z.string()).optional(),
302
+ geos_ids: zod_1.z
303
+ .array(zod_1.z.string().or(zod_1.z.object({ _id: zod_1.z.string(), name: zod_1.z.string() })))
304
+ .optional(),
305
+ time_range: exports.zodRelativeTimeRangeSchema.or(exports.zodAbsoluteTimeRangeSchema),
306
+ user_instructions: zod_1.z.string().optional(),
307
+ status: zod_1.z.enum(exports.generalStatusList).default('active'),
308
+ created_at: zod_1.z.number().optional(),
309
+ updated_at: zod_1.z.number().optional(), // last update date
310
+ });
package/index.ts CHANGED
@@ -356,3 +356,27 @@ export const MongoSendWhatsappSchema = new Schema(
356
356
  toObject: { virtuals: true },
357
357
  },
358
358
  );
359
+
360
+ export const MongoPredefinedQuerySchema = new Schema(
361
+ {
362
+ user_id: { type: String, required: true }, // user identifier
363
+ title: { type: String }, // title of the predefined query
364
+ query: { type: String, required: true }, // the actual predefined query
365
+ geos: { type: [String] }, // array of geo strings
366
+ geos_ids: { type: [Schema.Types.Mixed] }, // array of geo _id strings or objects with _id and name
367
+ time_range: { type: Schema.Types.Mixed }, // optional time range for the predefined query
368
+ user_instructions: { type: String }, // optional user instructions for the predefined query
369
+ status: {
370
+ type: String,
371
+ enum: generalStatusList,
372
+ default: 'active',
373
+ }, // status of the predefined query
374
+ created_at: { type: Number, default: Date.now }, // creation date
375
+ updated_at: { type: Number, default: Date.now }, // last update date
376
+ },
377
+ {
378
+ versionKey: false,
379
+ toJSON: { virtuals: true },
380
+ toObject: { virtuals: true },
381
+ },
382
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asfur",
3
- "version": "1.0.125",
3
+ "version": "1.0.127",
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
@@ -346,6 +346,22 @@ export const zodSendWhatsappSchema = z.object({
346
346
  html: z.string().optional(), // optional message body in HTML format
347
347
  });
348
348
 
349
+ export const zodPredefinedQuerySchema = z.object({
350
+ _id: z.string().optional(),
351
+ user_id: z.string().nonempty('User ID must be provided'), // user identifier
352
+ title: z.string().nonempty('Predefined query title must be provided'), // title of the predefined query
353
+ query: z.string().nonempty('Predefined query must be provided'), // the actual predefined query
354
+ geos: z.array(z.string()).optional(), // array of geo strings
355
+ geos_ids: z
356
+ .array(z.string().or(z.object({ _id: z.string(), name: z.string() })))
357
+ .optional(), // array of geo _id strings
358
+ time_range: zodRelativeTimeRangeSchema.or(zodAbsoluteTimeRangeSchema), // optional time range for the predefined query
359
+ user_instructions: z.string().optional(), // optional user instructions for the predefined query
360
+ status: z.enum(generalStatusList).default('active'), // status of the predefined query
361
+ created_at: z.number().optional(), // creation date
362
+ updated_at: z.number().optional(), // last update date
363
+ });
364
+
349
365
  /**
350
366
  * 'approved' - active and approved sources,
351
367
  * 'back_to_business' - sources that were paused and now resumed,
@@ -377,6 +393,7 @@ export type MessageType = z.infer<typeof zodMessageSchema>;
377
393
  export type HeatmapType = z.infer<typeof zodHeatmapSchema>;
378
394
  export type SendEmailType = z.infer<typeof zodSendEmailSchema>;
379
395
  export type SendWhatsappType = z.infer<typeof zodSendWhatsappSchema>;
396
+ export type PredefinedQueryType = z.infer<typeof zodPredefinedQuerySchema>;
380
397
 
381
398
  export type UserPublicMetadata = {
382
399
  is_admin?: boolean;