asfur 1.0.124 → 1.0.126

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,46 @@ 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
+ created_at: number;
795
+ updated_at: number;
796
+ title?: string | null | undefined;
797
+ time_range?: any;
798
+ user_instructions?: string | null | undefined;
799
+ }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
800
+ status: "active" | "inactive";
801
+ query: string;
802
+ geos: string[];
803
+ geos_ids: any[];
804
+ created_at: number;
805
+ updated_at: number;
806
+ title?: string | null | undefined;
807
+ time_range?: any;
808
+ user_instructions?: string | null | undefined;
809
+ }>, {}> & import("mongoose").FlatRecord<{
810
+ status: "active" | "inactive";
811
+ query: string;
812
+ geos: string[];
813
+ geos_ids: any[];
814
+ created_at: number;
815
+ updated_at: number;
816
+ title?: string | null | undefined;
817
+ time_range?: any;
818
+ user_instructions?: string | null | undefined;
819
+ }> & {
820
+ _id: import("mongoose").Types.ObjectId;
821
+ } & {
822
+ __v: number;
823
+ }>;
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,22 @@ 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
+ title: { type: String },
316
+ query: { type: String, required: true },
317
+ geos: { type: [String] },
318
+ geos_ids: { type: [mongoose_1.Schema.Types.Mixed] },
319
+ time_range: { type: mongoose_1.Schema.Types.Mixed },
320
+ user_instructions: { type: String },
321
+ status: {
322
+ type: String,
323
+ enum: types_1.generalStatusList,
324
+ default: 'active',
325
+ },
326
+ created_at: { type: Number, default: Date.now },
327
+ updated_at: { type: Number, default: Date.now }, // last update date
328
+ }, {
329
+ versionKey: false,
330
+ toJSON: { virtuals: true },
331
+ toObject: { virtuals: true },
332
+ });
package/dist/types.d.ts CHANGED
@@ -2063,6 +2063,90 @@ 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
+ title: z.ZodString;
2069
+ query: z.ZodString;
2070
+ geos: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2071
+ geos_ids: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
2072
+ _id: z.ZodString;
2073
+ name: z.ZodString;
2074
+ }, "strip", z.ZodTypeAny, {
2075
+ _id: string;
2076
+ name: string;
2077
+ }, {
2078
+ _id: string;
2079
+ name: string;
2080
+ }>]>, "many">>;
2081
+ time_range: z.ZodUnion<[z.ZodObject<{
2082
+ type: z.ZodLiteral<"relative">;
2083
+ 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"]>;
2084
+ }, "strip", z.ZodTypeAny, {
2085
+ type: "relative";
2086
+ 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";
2087
+ }, {
2088
+ type: "relative";
2089
+ 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";
2090
+ }>, z.ZodObject<{
2091
+ type: z.ZodLiteral<"absolute">;
2092
+ start: z.ZodNumber;
2093
+ end: z.ZodNumber;
2094
+ }, "strip", z.ZodTypeAny, {
2095
+ type: "absolute";
2096
+ start: number;
2097
+ end: number;
2098
+ }, {
2099
+ type: "absolute";
2100
+ start: number;
2101
+ end: number;
2102
+ }>]>;
2103
+ user_instructions: z.ZodOptional<z.ZodString>;
2104
+ status: z.ZodDefault<z.ZodEnum<["active", "inactive"]>>;
2105
+ created_at: z.ZodOptional<z.ZodNumber>;
2106
+ updated_at: z.ZodOptional<z.ZodNumber>;
2107
+ }, "strip", z.ZodTypeAny, {
2108
+ status: "active" | "inactive";
2109
+ title: string;
2110
+ query: string;
2111
+ time_range: {
2112
+ type: "relative";
2113
+ 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";
2114
+ } | {
2115
+ type: "absolute";
2116
+ start: number;
2117
+ end: number;
2118
+ };
2119
+ _id?: string | undefined;
2120
+ geos?: string[] | undefined;
2121
+ geos_ids?: (string | {
2122
+ _id: string;
2123
+ name: string;
2124
+ })[] | undefined;
2125
+ user_instructions?: string | undefined;
2126
+ created_at?: number | undefined;
2127
+ updated_at?: number | undefined;
2128
+ }, {
2129
+ title: string;
2130
+ query: string;
2131
+ time_range: {
2132
+ type: "relative";
2133
+ 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";
2134
+ } | {
2135
+ type: "absolute";
2136
+ start: number;
2137
+ end: number;
2138
+ };
2139
+ status?: "active" | "inactive" | undefined;
2140
+ _id?: string | undefined;
2141
+ geos?: string[] | undefined;
2142
+ geos_ids?: (string | {
2143
+ _id: string;
2144
+ name: string;
2145
+ })[] | undefined;
2146
+ user_instructions?: string | undefined;
2147
+ created_at?: number | undefined;
2148
+ updated_at?: number | undefined;
2149
+ }>;
2066
2150
  /**
2067
2151
  * 'approved' - active and approved sources,
2068
2152
  * 'back_to_business' - sources that were paused and now resumed,
@@ -2089,6 +2173,7 @@ export type MessageType = z.infer<typeof zodMessageSchema>;
2089
2173
  export type HeatmapType = z.infer<typeof zodHeatmapSchema>;
2090
2174
  export type SendEmailType = z.infer<typeof zodSendEmailSchema>;
2091
2175
  export type SendWhatsappType = z.infer<typeof zodSendWhatsappSchema>;
2176
+ export type PredefinedQueryType = z.infer<typeof zodPredefinedQuerySchema>;
2092
2177
  export type UserPublicMetadata = {
2093
2178
  is_admin?: boolean;
2094
2179
  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,17 @@ 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
+ title: zod_1.z.string().nonempty('Predefined query title must be provided'),
299
+ query: zod_1.z.string().nonempty('Predefined query must be provided'),
300
+ geos: zod_1.z.array(zod_1.z.string()).optional(),
301
+ geos_ids: zod_1.z
302
+ .array(zod_1.z.string().or(zod_1.z.object({ _id: zod_1.z.string(), name: zod_1.z.string() })))
303
+ .optional(),
304
+ time_range: exports.zodRelativeTimeRangeSchema.or(exports.zodAbsoluteTimeRangeSchema),
305
+ user_instructions: zod_1.z.string().optional(),
306
+ status: zod_1.z.enum(exports.generalStatusList).default('active'),
307
+ created_at: zod_1.z.number().optional(),
308
+ updated_at: zod_1.z.number().optional(), // last update date
309
+ });
package/index.ts CHANGED
@@ -356,3 +356,26 @@ export const MongoSendWhatsappSchema = new Schema(
356
356
  toObject: { virtuals: true },
357
357
  },
358
358
  );
359
+
360
+ export const MongoPredefinedQuerySchema = new Schema(
361
+ {
362
+ title: { type: String }, // title of the predefined query
363
+ query: { type: String, required: true }, // the actual predefined query
364
+ geos: { type: [String] }, // array of geo strings
365
+ geos_ids: { type: [Schema.Types.Mixed] }, // array of geo _id strings or objects with _id and name
366
+ time_range: { type: Schema.Types.Mixed }, // optional time range for the predefined query
367
+ user_instructions: { type: String }, // optional user instructions for the predefined query
368
+ status: {
369
+ type: String,
370
+ enum: generalStatusList,
371
+ default: 'active',
372
+ }, // status of the predefined query
373
+ created_at: { type: Number, default: Date.now }, // creation date
374
+ updated_at: { type: Number, default: Date.now }, // last update date
375
+ },
376
+ {
377
+ versionKey: false,
378
+ toJSON: { virtuals: true },
379
+ toObject: { virtuals: true },
380
+ },
381
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asfur",
3
- "version": "1.0.124",
3
+ "version": "1.0.126",
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,21 @@ 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
+ title: z.string().nonempty('Predefined query title must be provided'), // title of the predefined query
352
+ query: z.string().nonempty('Predefined query must be provided'), // the actual predefined query
353
+ geos: z.array(z.string()).optional(), // array of geo strings
354
+ geos_ids: z
355
+ .array(z.string().or(z.object({ _id: z.string(), name: z.string() })))
356
+ .optional(), // array of geo _id strings
357
+ time_range: zodRelativeTimeRangeSchema.or(zodAbsoluteTimeRangeSchema), // optional time range for the predefined query
358
+ user_instructions: z.string().optional(), // optional user instructions for the predefined query
359
+ status: z.enum(generalStatusList).default('active'), // status of the predefined query
360
+ created_at: z.number().optional(), // creation date
361
+ updated_at: z.number().optional(), // last update date
362
+ });
363
+
349
364
  /**
350
365
  * 'approved' - active and approved sources,
351
366
  * 'back_to_business' - sources that were paused and now resumed,
@@ -377,6 +392,7 @@ export type MessageType = z.infer<typeof zodMessageSchema>;
377
392
  export type HeatmapType = z.infer<typeof zodHeatmapSchema>;
378
393
  export type SendEmailType = z.infer<typeof zodSendEmailSchema>;
379
394
  export type SendWhatsappType = z.infer<typeof zodSendWhatsappSchema>;
395
+ export type PredefinedQueryType = z.infer<typeof zodPredefinedQuerySchema>;
380
396
 
381
397
  export type UserPublicMetadata = {
382
398
  is_admin?: boolean;