asfur 1.0.127 → 1.0.129

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
@@ -824,3 +824,46 @@ export declare const MongoPredefinedQuerySchema: Schema<any, import("mongoose").
824
824
  } & {
825
825
  __v: number;
826
826
  }>;
827
+ export declare const MongoGeoSelectionGroupSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
828
+ versionKey: false;
829
+ toJSON: {
830
+ virtuals: true;
831
+ };
832
+ toObject: {
833
+ virtuals: true;
834
+ };
835
+ }, {
836
+ title: string;
837
+ created_at: number;
838
+ updated_at: number;
839
+ region_id: string;
840
+ geo_selections_ids: string[];
841
+ geo_selections: any[];
842
+ user_id?: string | null | undefined;
843
+ description?: string | null | undefined;
844
+ notes?: string | null | undefined;
845
+ }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
846
+ title: string;
847
+ created_at: number;
848
+ updated_at: number;
849
+ region_id: string;
850
+ geo_selections_ids: string[];
851
+ geo_selections: any[];
852
+ user_id?: string | null | undefined;
853
+ description?: string | null | undefined;
854
+ notes?: string | null | undefined;
855
+ }>, {}> & import("mongoose").FlatRecord<{
856
+ title: string;
857
+ created_at: number;
858
+ updated_at: number;
859
+ region_id: string;
860
+ geo_selections_ids: string[];
861
+ geo_selections: any[];
862
+ user_id?: string | null | undefined;
863
+ description?: string | null | undefined;
864
+ notes?: string | null | undefined;
865
+ }> & {
866
+ _id: import("mongoose").Types.ObjectId;
867
+ } & {
868
+ __v: number;
869
+ }>;
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.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;
17
+ exports.MongoGeoSelectionGroupSchema = 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");
@@ -331,3 +331,18 @@ exports.MongoPredefinedQuerySchema = new mongoose_1.Schema({
331
331
  toJSON: { virtuals: true },
332
332
  toObject: { virtuals: true },
333
333
  });
334
+ exports.MongoGeoSelectionGroupSchema = new mongoose_1.Schema({
335
+ user_id: { type: String },
336
+ region_id: { type: String, required: true },
337
+ title: { type: String, required: true },
338
+ description: { type: String },
339
+ created_at: { type: Number, default: Date.now },
340
+ updated_at: { type: Number, default: Date.now },
341
+ notes: { type: String },
342
+ geo_selections_ids: { type: [String] },
343
+ geo_selections: { type: [mongoose_1.Schema.Types.Mixed] }, // array of geo selection objects
344
+ }, {
345
+ versionKey: false,
346
+ toJSON: { virtuals: true },
347
+ toObject: { virtuals: true },
348
+ });
package/dist/types.d.ts CHANGED
@@ -2079,7 +2079,7 @@ export declare const zodPredefinedQuerySchema: z.ZodObject<{
2079
2079
  _id: string;
2080
2080
  name: string;
2081
2081
  }>]>, "many">>;
2082
- time_range: z.ZodUnion<[z.ZodObject<{
2082
+ time_range: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
2083
2083
  type: z.ZodLiteral<"relative">;
2084
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
2085
  }, "strip", z.ZodTypeAny, {
@@ -2100,44 +2100,36 @@ export declare const zodPredefinedQuerySchema: z.ZodObject<{
2100
2100
  type: "absolute";
2101
2101
  start: number;
2102
2102
  end: number;
2103
- }>]>;
2103
+ }>]>>;
2104
2104
  user_instructions: z.ZodOptional<z.ZodString>;
2105
- status: z.ZodDefault<z.ZodEnum<["active", "inactive"]>>;
2105
+ status: z.ZodOptional<z.ZodDefault<z.ZodEnum<["active", "inactive"]>>>;
2106
2106
  created_at: z.ZodOptional<z.ZodNumber>;
2107
2107
  updated_at: z.ZodOptional<z.ZodNumber>;
2108
2108
  }, "strip", z.ZodTypeAny, {
2109
- status: "active" | "inactive";
2110
2109
  title: string;
2111
2110
  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
2111
  user_id: string;
2112
+ status?: "active" | "inactive" | undefined;
2121
2113
  _id?: string | undefined;
2122
2114
  geos?: string[] | undefined;
2123
2115
  geos_ids?: (string | {
2124
2116
  _id: string;
2125
2117
  name: string;
2126
2118
  })[] | 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: {
2119
+ time_range?: {
2134
2120
  type: "relative";
2135
2121
  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
2122
  } | {
2137
2123
  type: "absolute";
2138
2124
  start: number;
2139
2125
  end: number;
2140
- };
2126
+ } | undefined;
2127
+ user_instructions?: string | undefined;
2128
+ created_at?: number | undefined;
2129
+ updated_at?: number | undefined;
2130
+ }, {
2131
+ title: string;
2132
+ query: string;
2141
2133
  user_id: string;
2142
2134
  status?: "active" | "inactive" | undefined;
2143
2135
  _id?: string | undefined;
@@ -2146,10 +2138,143 @@ export declare const zodPredefinedQuerySchema: z.ZodObject<{
2146
2138
  _id: string;
2147
2139
  name: string;
2148
2140
  })[] | undefined;
2141
+ time_range?: {
2142
+ type: "relative";
2143
+ 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";
2144
+ } | {
2145
+ type: "absolute";
2146
+ start: number;
2147
+ end: number;
2148
+ } | undefined;
2149
2149
  user_instructions?: string | undefined;
2150
2150
  created_at?: number | undefined;
2151
2151
  updated_at?: number | undefined;
2152
2152
  }>;
2153
+ export declare const zodGeoSelectionGroupSchema: z.ZodObject<{
2154
+ _id: z.ZodOptional<z.ZodString>;
2155
+ user_id: z.ZodOptional<z.ZodString>;
2156
+ region_id: z.ZodString;
2157
+ title: z.ZodString;
2158
+ description: z.ZodOptional<z.ZodString>;
2159
+ created_at: z.ZodOptional<z.ZodNumber>;
2160
+ updated_at: z.ZodOptional<z.ZodNumber>;
2161
+ notes: z.ZodOptional<z.ZodString>;
2162
+ geo_selections_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2163
+ geo_selections: z.ZodOptional<z.ZodArray<z.ZodObject<{
2164
+ _id: z.ZodOptional<z.ZodString>;
2165
+ title: z.ZodOptional<z.ZodString>;
2166
+ description: z.ZodOptional<z.ZodString>;
2167
+ type: z.ZodOptional<z.ZodString>;
2168
+ geos: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2169
+ region_id: z.ZodOptional<z.ZodString>;
2170
+ notes: z.ZodOptional<z.ZodString>;
2171
+ status: z.ZodOptional<z.ZodEnum<["active", "inactive", "deleted"]>>;
2172
+ created_at: z.ZodOptional<z.ZodNumber>;
2173
+ updated_at: z.ZodOptional<z.ZodNumber>;
2174
+ coordinates: z.ZodOptional<z.ZodObject<{
2175
+ type: z.ZodOptional<z.ZodEnum<["point", "polygon"]>>;
2176
+ coordinates: z.ZodOptional<z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">]>>;
2177
+ }, "strip", z.ZodTypeAny, {
2178
+ type?: "point" | "polygon" | undefined;
2179
+ coordinates?: [number, number] | [number, number][] | undefined;
2180
+ }, {
2181
+ type?: "point" | "polygon" | undefined;
2182
+ coordinates?: [number, number] | [number, number][] | undefined;
2183
+ }>>;
2184
+ lat: z.ZodOptional<z.ZodNumber>;
2185
+ lng: z.ZodOptional<z.ZodNumber>;
2186
+ }, "strip", z.ZodTypeAny, {
2187
+ _id?: string | undefined;
2188
+ created_at?: number | undefined;
2189
+ updated_at?: number | undefined;
2190
+ status?: "active" | "inactive" | "deleted" | undefined;
2191
+ notes?: string | undefined;
2192
+ type?: string | undefined;
2193
+ coordinates?: {
2194
+ type?: "point" | "polygon" | undefined;
2195
+ coordinates?: [number, number] | [number, number][] | undefined;
2196
+ } | undefined;
2197
+ description?: string | undefined;
2198
+ region_id?: string | undefined;
2199
+ title?: string | undefined;
2200
+ geos?: string[] | undefined;
2201
+ lat?: number | undefined;
2202
+ lng?: number | undefined;
2203
+ }, {
2204
+ _id?: string | undefined;
2205
+ created_at?: number | undefined;
2206
+ updated_at?: number | undefined;
2207
+ status?: "active" | "inactive" | "deleted" | undefined;
2208
+ notes?: string | undefined;
2209
+ type?: string | undefined;
2210
+ coordinates?: {
2211
+ type?: "point" | "polygon" | undefined;
2212
+ coordinates?: [number, number] | [number, number][] | undefined;
2213
+ } | undefined;
2214
+ description?: string | undefined;
2215
+ region_id?: string | undefined;
2216
+ title?: string | undefined;
2217
+ geos?: string[] | undefined;
2218
+ lat?: number | undefined;
2219
+ lng?: number | undefined;
2220
+ }>, "many">>;
2221
+ }, "strip", z.ZodTypeAny, {
2222
+ title: string;
2223
+ region_id: string;
2224
+ _id?: string | undefined;
2225
+ user_id?: string | undefined;
2226
+ created_at?: number | undefined;
2227
+ updated_at?: number | undefined;
2228
+ description?: string | undefined;
2229
+ notes?: string | undefined;
2230
+ geo_selections_ids?: string[] | undefined;
2231
+ geo_selections?: {
2232
+ _id?: string | undefined;
2233
+ created_at?: number | undefined;
2234
+ updated_at?: number | undefined;
2235
+ status?: "active" | "inactive" | "deleted" | undefined;
2236
+ notes?: string | undefined;
2237
+ type?: string | undefined;
2238
+ coordinates?: {
2239
+ type?: "point" | "polygon" | undefined;
2240
+ coordinates?: [number, number] | [number, number][] | undefined;
2241
+ } | undefined;
2242
+ description?: string | undefined;
2243
+ region_id?: string | undefined;
2244
+ title?: string | undefined;
2245
+ geos?: string[] | undefined;
2246
+ lat?: number | undefined;
2247
+ lng?: number | undefined;
2248
+ }[] | undefined;
2249
+ }, {
2250
+ title: string;
2251
+ region_id: string;
2252
+ _id?: string | undefined;
2253
+ user_id?: string | undefined;
2254
+ created_at?: number | undefined;
2255
+ updated_at?: number | undefined;
2256
+ description?: string | undefined;
2257
+ notes?: string | undefined;
2258
+ geo_selections_ids?: string[] | undefined;
2259
+ geo_selections?: {
2260
+ _id?: string | undefined;
2261
+ created_at?: number | undefined;
2262
+ updated_at?: number | undefined;
2263
+ status?: "active" | "inactive" | "deleted" | undefined;
2264
+ notes?: string | undefined;
2265
+ type?: string | undefined;
2266
+ coordinates?: {
2267
+ type?: "point" | "polygon" | undefined;
2268
+ coordinates?: [number, number] | [number, number][] | undefined;
2269
+ } | undefined;
2270
+ description?: string | undefined;
2271
+ region_id?: string | undefined;
2272
+ title?: string | undefined;
2273
+ geos?: string[] | undefined;
2274
+ lat?: number | undefined;
2275
+ lng?: number | undefined;
2276
+ }[] | undefined;
2277
+ }>;
2153
2278
  /**
2154
2279
  * 'approved' - active and approved sources,
2155
2280
  * 'back_to_business' - sources that were paused and now resumed,
package/dist/types.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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;
3
+ exports.zodGeoSelectionGroupSchema = 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
+ const harvester_sdk_1 = require("harvester_sdk");
4
5
  const zod_1 = require("zod");
5
6
  exports.generalStatusList = ['active', 'inactive'];
6
7
  exports.jobRunStatusList = ['done', 'failed', 'in_progress'];
@@ -302,9 +303,21 @@ exports.zodPredefinedQuerySchema = zod_1.z.object({
302
303
  geos_ids: zod_1.z
303
304
  .array(zod_1.z.string().or(zod_1.z.object({ _id: zod_1.z.string(), name: zod_1.z.string() })))
304
305
  .optional(),
305
- time_range: exports.zodRelativeTimeRangeSchema.or(exports.zodAbsoluteTimeRangeSchema),
306
+ time_range: exports.zodRelativeTimeRangeSchema.or(exports.zodAbsoluteTimeRangeSchema).optional(),
306
307
  user_instructions: zod_1.z.string().optional(),
307
- status: zod_1.z.enum(exports.generalStatusList).default('active'),
308
+ status: zod_1.z.enum(exports.generalStatusList).default('active').optional(),
308
309
  created_at: zod_1.z.number().optional(),
309
310
  updated_at: zod_1.z.number().optional(), // last update date
310
311
  });
312
+ exports.zodGeoSelectionGroupSchema = zod_1.z.object({
313
+ _id: zod_1.z.string().optional(),
314
+ user_id: zod_1.z.string().optional(),
315
+ region_id: zod_1.z.string(),
316
+ title: zod_1.z.string(),
317
+ description: zod_1.z.string().optional(),
318
+ created_at: zod_1.z.number().optional(),
319
+ updated_at: zod_1.z.number().optional(),
320
+ notes: zod_1.z.string().optional(),
321
+ geo_selections_ids: zod_1.z.array(zod_1.z.string()).optional(),
322
+ geo_selections: harvester_sdk_1.zodGeoSelectionSchema.array().optional(), // array of geo selection objects
323
+ });
package/index.ts CHANGED
@@ -380,3 +380,23 @@ export const MongoPredefinedQuerySchema = new Schema(
380
380
  toObject: { virtuals: true },
381
381
  },
382
382
  );
383
+
384
+ export const MongoGeoSelectionGroupSchema = new Schema(
385
+ {
386
+ user_id: { type: String }, // user who created this geo selection group
387
+ region_id: { type: String, required: true }, // e.g., region ID
388
+ title: { type: String, required: true }, // e.g., "group-name"
389
+ description: { type: String }, // e.g., "Description of the group"
390
+ created_at: { type: Number, default: Date.now }, // creation date
391
+ updated_at: { type: Number, default: Date.now }, // last update date
392
+ notes: { type: String }, // internal notes about the geo selection group
393
+ geo_selections_ids: { type: [String] }, // array of geo selection IDs
394
+ geo_selections: { type: [Schema.Types.Mixed] }, // array of geo selection objects
395
+ },
396
+ {
397
+ versionKey: false,
398
+ toJSON: { virtuals: true },
399
+ toObject: { virtuals: true },
400
+ },
401
+ );
402
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asfur",
3
- "version": "1.0.127",
3
+ "version": "1.0.129",
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
@@ -6,6 +6,7 @@ import {
6
6
  SourceType,
7
7
  RegionSummaryType,
8
8
  PaginatedResponse,
9
+ zodGeoSelectionSchema,
9
10
  } from 'harvester_sdk';
10
11
  import { z } from 'zod';
11
12
 
@@ -355,13 +356,26 @@ export const zodPredefinedQuerySchema = z.object({
355
356
  geos_ids: z
356
357
  .array(z.string().or(z.object({ _id: z.string(), name: z.string() })))
357
358
  .optional(), // array of geo _id strings
358
- time_range: zodRelativeTimeRangeSchema.or(zodAbsoluteTimeRangeSchema), // optional time range for the predefined query
359
+ time_range: zodRelativeTimeRangeSchema.or(zodAbsoluteTimeRangeSchema).optional(), // optional time range for the predefined query
359
360
  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
+ status: z.enum(generalStatusList).default('active').optional(), // status of the predefined query
361
362
  created_at: z.number().optional(), // creation date
362
363
  updated_at: z.number().optional(), // last update date
363
364
  });
364
365
 
366
+ export const zodGeoSelectionGroupSchema = z.object({
367
+ _id: z.string().optional(),
368
+ user_id: z.string().optional(), // user who created this geo selection group
369
+ region_id: z.string(), // e.g., region ID
370
+ title: z.string(), // e.g., "group-name"
371
+ description: z.string().optional(), // e.g., "Description of the group"
372
+ created_at: z.number().optional(), // creation date
373
+ updated_at: z.number().optional(), // last update date
374
+ notes: z.string().optional(), // internal notes about the geo selection group
375
+ geo_selections_ids: z.array(z.string()).optional(), // array of geo selection IDs
376
+ geo_selections: zodGeoSelectionSchema.array().optional(), // array of geo selection objects
377
+ });
378
+
365
379
  /**
366
380
  * 'approved' - active and approved sources,
367
381
  * 'back_to_business' - sources that were paused and now resumed,