repzo 1.0.279 → 1.0.280

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/changelog.md CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
  ### Added
6
6
 
7
+ - add: LineTarget service and type; OAS YAML
8
+ - add: TargetRule, Plan, and Calendar services and types; OAS YAMLs for each
7
9
  - add: Automatic retry logic for HTTP requests with exponential backoff (default: 3 attempts, configurable via `retryAttempts` option)
8
10
  - add: `retryAttempts` option to SDK constructor for configuring retry behavior @mkhamis
9
11
  - add: 401 error protection - authentication errors are never retried @mkhamis
package/lib/index.d.ts CHANGED
@@ -137,10 +137,14 @@ export declare const end_points: {
137
137
  readonly JOB_CATEGORY: "job-category";
138
138
  readonly JOB_CATEGORY_AUTOSKIP_ANALYZE: "job-category-autoskip-analyze";
139
139
  readonly VISIT_REASON: "visit-reason";
140
+ readonly TARGET_RULE: "target-rule";
141
+ readonly PLAN: "plan";
142
+ readonly CALENDAR: "calendar";
143
+ readonly LINE_TARGET: "line-target";
140
144
  readonly BULK_IMPORT: "bulk-import";
141
145
  };
142
146
  export type EndPoints = (typeof end_points)[keyof typeof end_points];
143
- export declare const availableService: readonly ["client", "product", "variant", "category", "sub_category", "brand", "product_group", "tax", "measureunit", "measureunitFamily", "media", "priceList", "priceListItem", "team", "returnReason", "rep", "tag", "warehouse", "route", "productModifiersGroup", "channel", "speciality", "clientContact", "paymentTerm", "bank", "bank_list", "customStatus", "customList", "customListItem", "inventoryAdjustmentReason", "workorder", "workorderRequest", "supplier", "quickConvertToPdf", "visit", "activityFeedback", "activityFeedbackV2", "feedbackOption", "invoice", "proforma", "payment", "refund", "settlement", "voidSettlement", "check", "day", "receivingMaterial", "adjustAccount", "transfer", "msl", "mslProduct", "mediaStorage", "storecheckTemplate", "activityStorecheck", "activityItemStatus", "adjustInventory", "inventory", "integrationApp", "joinActionsWebHook", "patchAction", "updateIntegrationMeta", "assetPartType", "assetPart", "assetPartUnit", "assetPartReceival", "assetPartTransfer", "returnAssetPartUnit", "storeAssetPartUnit", "ocrInvoiceJobTemplate", "ocrInvoiceJobGroup", "activityAiSalesOrder", "ocrInvoiceJob", "ocrInvoiceJobPage", "settings", "mailUnsubscribe", "approvalRequest", "safeInvoiceSerialCounter", "clientLocation", "assetType", "asset", "assetUnit", "workorderPortal", "approval", "workorderCategory", "contract", "contractInstallment", "repBalanceSummary", "workorderPortalLink", "customField", "salesAnalyticsReport", "clmPresentation", "clmSequence", "clmSlide", "clmFetch", "pdfMergeField", "visitReason"];
147
+ export declare const availableService: readonly ["client", "product", "variant", "category", "sub_category", "brand", "product_group", "tax", "measureunit", "measureunitFamily", "media", "priceList", "priceListItem", "team", "returnReason", "rep", "tag", "warehouse", "route", "productModifiersGroup", "channel", "speciality", "clientContact", "paymentTerm", "bank", "bank_list", "customStatus", "customList", "customListItem", "inventoryAdjustmentReason", "workorder", "workorderRequest", "supplier", "quickConvertToPdf", "visit", "activityFeedback", "activityFeedbackV2", "feedbackOption", "invoice", "proforma", "payment", "refund", "settlement", "voidSettlement", "check", "day", "receivingMaterial", "adjustAccount", "transfer", "msl", "mslProduct", "mediaStorage", "storecheckTemplate", "activityStorecheck", "activityItemStatus", "adjustInventory", "inventory", "integrationApp", "joinActionsWebHook", "patchAction", "updateIntegrationMeta", "assetPartType", "assetPart", "assetPartUnit", "assetPartReceival", "assetPartTransfer", "returnAssetPartUnit", "storeAssetPartUnit", "ocrInvoiceJobTemplate", "ocrInvoiceJobGroup", "activityAiSalesOrder", "ocrInvoiceJob", "ocrInvoiceJobPage", "settings", "mailUnsubscribe", "approvalRequest", "safeInvoiceSerialCounter", "clientLocation", "assetType", "asset", "assetUnit", "workorderPortal", "approval", "workorderCategory", "contract", "contractInstallment", "repBalanceSummary", "workorderPortalLink", "customField", "salesAnalyticsReport", "clmPresentation", "clmSequence", "clmSlide", "clmFetch", "pdfMergeField", "visitReason", "targetRule", "plan", "calendar", "lineTarget", "bulkImport"];
144
148
  export type AvailableService = (typeof availableService)[number];
145
149
  export default class Repzo {
146
150
  private svAPIEndpoint;
@@ -290,6 +294,10 @@ export default class Repzo {
290
294
  readonly JOB_CATEGORY: "job-category";
291
295
  readonly JOB_CATEGORY_AUTOSKIP_ANALYZE: "job-category-autoskip-analyze";
292
296
  readonly VISIT_REASON: "visit-reason";
297
+ readonly TARGET_RULE: "target-rule";
298
+ readonly PLAN: "plan";
299
+ readonly CALENDAR: "calendar";
300
+ readonly LINE_TARGET: "line-target";
293
301
  readonly BULK_IMPORT: "bulk-import";
294
302
  };
295
303
  private _retryRequest;
@@ -298,7 +306,7 @@ export default class Repzo {
298
306
  private _update;
299
307
  private _patch;
300
308
  private _delete;
301
- available_services: readonly ["client", "product", "variant", "category", "sub_category", "brand", "product_group", "tax", "measureunit", "measureunitFamily", "media", "priceList", "priceListItem", "team", "returnReason", "rep", "tag", "warehouse", "route", "productModifiersGroup", "channel", "speciality", "clientContact", "paymentTerm", "bank", "bank_list", "customStatus", "customList", "customListItem", "inventoryAdjustmentReason", "workorder", "workorderRequest", "supplier", "quickConvertToPdf", "visit", "activityFeedback", "activityFeedbackV2", "feedbackOption", "invoice", "proforma", "payment", "refund", "settlement", "voidSettlement", "check", "day", "receivingMaterial", "adjustAccount", "transfer", "msl", "mslProduct", "mediaStorage", "storecheckTemplate", "activityStorecheck", "activityItemStatus", "adjustInventory", "inventory", "integrationApp", "joinActionsWebHook", "patchAction", "updateIntegrationMeta", "assetPartType", "assetPart", "assetPartUnit", "assetPartReceival", "assetPartTransfer", "returnAssetPartUnit", "storeAssetPartUnit", "ocrInvoiceJobTemplate", "ocrInvoiceJobGroup", "activityAiSalesOrder", "ocrInvoiceJob", "ocrInvoiceJobPage", "settings", "mailUnsubscribe", "approvalRequest", "safeInvoiceSerialCounter", "clientLocation", "assetType", "asset", "assetUnit", "workorderPortal", "approval", "workorderCategory", "contract", "contractInstallment", "repBalanceSummary", "workorderPortalLink", "customField", "salesAnalyticsReport", "clmPresentation", "clmSequence", "clmSlide", "clmFetch", "pdfMergeField", "visitReason"];
309
+ available_services: readonly ["client", "product", "variant", "category", "sub_category", "brand", "product_group", "tax", "measureunit", "measureunitFamily", "media", "priceList", "priceListItem", "team", "returnReason", "rep", "tag", "warehouse", "route", "productModifiersGroup", "channel", "speciality", "clientContact", "paymentTerm", "bank", "bank_list", "customStatus", "customList", "customListItem", "inventoryAdjustmentReason", "workorder", "workorderRequest", "supplier", "quickConvertToPdf", "visit", "activityFeedback", "activityFeedbackV2", "feedbackOption", "invoice", "proforma", "payment", "refund", "settlement", "voidSettlement", "check", "day", "receivingMaterial", "adjustAccount", "transfer", "msl", "mslProduct", "mediaStorage", "storecheckTemplate", "activityStorecheck", "activityItemStatus", "adjustInventory", "inventory", "integrationApp", "joinActionsWebHook", "patchAction", "updateIntegrationMeta", "assetPartType", "assetPart", "assetPartUnit", "assetPartReceival", "assetPartTransfer", "returnAssetPartUnit", "storeAssetPartUnit", "ocrInvoiceJobTemplate", "ocrInvoiceJobGroup", "activityAiSalesOrder", "ocrInvoiceJob", "ocrInvoiceJobPage", "settings", "mailUnsubscribe", "approvalRequest", "safeInvoiceSerialCounter", "clientLocation", "assetType", "asset", "assetUnit", "workorderPortal", "approval", "workorderCategory", "contract", "contractInstallment", "repBalanceSummary", "workorderPortalLink", "customField", "salesAnalyticsReport", "clmPresentation", "clmSequence", "clmSlide", "clmFetch", "pdfMergeField", "visitReason", "targetRule", "plan", "calendar", "lineTarget", "bulkImport"];
302
310
  generateUUID: ({ prefix, suffix, length, }: {
303
311
  prefix?: string;
304
312
  suffix?: string;
@@ -1346,6 +1354,38 @@ export default class Repzo {
1346
1354
  update: (id: Service.VisitReason.Update.ID, body: Service.VisitReason.Update.Body) => Promise<Service.VisitReason.Update.Result>;
1347
1355
  remove: (id: Service.VisitReason.Remove.ID) => Promise<Service.VisitReason.Remove.Result>;
1348
1356
  };
1357
+ targetRule: {
1358
+ _path: "target-rule";
1359
+ find: (params?: Service.TargetRule.Find.Params) => Promise<Service.TargetRule.Find.Result>;
1360
+ get: (id: Service.TargetRule.Get.ID) => Promise<Service.TargetRule.Get.Result>;
1361
+ create: (body: Service.TargetRule.Create.Body) => Promise<Service.TargetRule.Create.Result>;
1362
+ update: (id: Service.TargetRule.Update.ID, body: Service.TargetRule.Update.Body) => Promise<Service.TargetRule.Update.Result>;
1363
+ remove: (id: Service.TargetRule.Remove.ID) => Promise<Service.TargetRule.Remove.Result>;
1364
+ };
1365
+ plan: {
1366
+ _path: "plan";
1367
+ find: (params?: Service.Plan.Find.Params) => Promise<Service.Plan.Find.Result>;
1368
+ get: (id: Service.Plan.Get.ID, params?: Service.Plan.Get.Params) => Promise<Service.Plan.Get.Result>;
1369
+ create: (body: Service.Plan.Create.Body) => Promise<Service.Plan.Create.Result>;
1370
+ update: (id: Service.Plan.Update.ID, body: Service.Plan.Update.Body) => Promise<Service.Plan.Update.Result>;
1371
+ remove: (id: Service.Plan.Remove.ID) => Promise<Service.Plan.Remove.Result>;
1372
+ };
1373
+ calendar: {
1374
+ _path: "calendar";
1375
+ find: (params?: Service.Calendar.Find.Params) => Promise<Service.Calendar.Find.Result>;
1376
+ get: (id: Service.Calendar.Get.ID, params?: Service.Calendar.Get.Params) => Promise<Service.Calendar.Get.Result>;
1377
+ create: (body: Service.Calendar.Create.Body, params?: Service.Calendar.Create.Params) => Promise<Service.Calendar.Create.Result>;
1378
+ update: (id: Service.Calendar.Update.ID, body: Service.Calendar.Update.Body) => Promise<Service.Calendar.Update.Result>;
1379
+ remove: (id: Service.Calendar.Remove.ID) => Promise<Service.Calendar.Remove.Result>;
1380
+ };
1381
+ lineTarget: {
1382
+ _path: "line-target";
1383
+ find: (params?: Service.LineTarget.Find.Params) => Promise<Service.LineTarget.Find.Result>;
1384
+ get: (id: Service.LineTarget.Get.ID, params?: Service.LineTarget.Get.Params) => Promise<Service.LineTarget.Get.Result>;
1385
+ create: (body: Service.LineTarget.Create.Body) => Promise<Service.LineTarget.Create.Result>;
1386
+ update: (id: Service.LineTarget.Update.ID, body: Service.LineTarget.Update.Body) => Promise<Service.LineTarget.Update.Result>;
1387
+ remove: (id: Service.LineTarget.Remove.ID, params?: Service.LineTarget.Remove.Params) => Promise<Service.LineTarget.Remove.Result>;
1388
+ };
1349
1389
  bulkImport: {
1350
1390
  _path: "bulk-import";
1351
1391
  find: (params?: Service.BulkImport.Find.Params) => Promise<Service.BulkImport.Find.Result>;
package/lib/index.js CHANGED
@@ -139,6 +139,10 @@ export const end_points = {
139
139
  JOB_CATEGORY: "job-category",
140
140
  JOB_CATEGORY_AUTOSKIP_ANALYZE: "job-category-autoskip-analyze",
141
141
  VISIT_REASON: "visit-reason",
142
+ TARGET_RULE: "target-rule",
143
+ PLAN: "plan",
144
+ CALENDAR: "calendar",
145
+ LINE_TARGET: "line-target",
142
146
  BULK_IMPORT: "bulk-import",
143
147
  };
144
148
  export const availableService = [
@@ -238,6 +242,11 @@ export const availableService = [
238
242
  "clmFetch",
239
243
  "pdfMergeField",
240
244
  "visitReason",
245
+ "targetRule",
246
+ "plan",
247
+ "calendar",
248
+ "lineTarget",
249
+ "bulkImport",
241
250
  ];
242
251
  class Repzo {
243
252
  constructor(apiKey, options) {
@@ -2795,6 +2804,94 @@ class Repzo {
2795
2804
  return res;
2796
2805
  },
2797
2806
  };
2807
+ this.targetRule = {
2808
+ _path: Repzo._end_points.TARGET_RULE,
2809
+ find: async (params) => {
2810
+ let res = await this._fetch(this.svAPIEndpoint, this.targetRule._path, params);
2811
+ return res;
2812
+ },
2813
+ get: async (id) => {
2814
+ return await this._fetch(this.svAPIEndpoint, this.targetRule._path + `/${id}`);
2815
+ },
2816
+ create: async (body) => {
2817
+ let res = await this._create(this.svAPIEndpoint, this.targetRule._path, body);
2818
+ return res;
2819
+ },
2820
+ update: async (id, body) => {
2821
+ let res = await this._update(this.svAPIEndpoint, this.targetRule._path + `/${id}`, body);
2822
+ return res;
2823
+ },
2824
+ remove: async (id) => {
2825
+ let res = await this._delete(this.svAPIEndpoint, this.targetRule._path + `/${id}`);
2826
+ return res;
2827
+ },
2828
+ };
2829
+ this.plan = {
2830
+ _path: Repzo._end_points.PLAN,
2831
+ find: async (params) => {
2832
+ let res = await this._fetch(this.svAPIEndpoint, this.plan._path, params);
2833
+ return res;
2834
+ },
2835
+ get: async (id, params) => {
2836
+ return await this._fetch(this.svAPIEndpoint, this.plan._path + `/${id}`, params);
2837
+ },
2838
+ create: async (body) => {
2839
+ let res = await this._create(this.svAPIEndpoint, this.plan._path, body);
2840
+ return res;
2841
+ },
2842
+ update: async (id, body) => {
2843
+ let res = await this._update(this.svAPIEndpoint, this.plan._path + `/${id}`, body);
2844
+ return res;
2845
+ },
2846
+ remove: async (id) => {
2847
+ let res = await this._delete(this.svAPIEndpoint, this.plan._path + `/${id}`);
2848
+ return res;
2849
+ },
2850
+ };
2851
+ this.calendar = {
2852
+ _path: Repzo._end_points.CALENDAR,
2853
+ find: async (params) => {
2854
+ let res = await this._fetch(this.svAPIEndpoint, this.calendar._path, params);
2855
+ return res;
2856
+ },
2857
+ get: async (id, params) => {
2858
+ return await this._fetch(this.svAPIEndpoint, this.calendar._path + `/${id}`, params);
2859
+ },
2860
+ create: async (body, params) => {
2861
+ let res = await this._create(this.svAPIEndpoint, this.calendar._path, body, params);
2862
+ return res;
2863
+ },
2864
+ update: async (id, body) => {
2865
+ let res = await this._update(this.svAPIEndpoint, this.calendar._path + `/${id}`, body);
2866
+ return res;
2867
+ },
2868
+ remove: async (id) => {
2869
+ let res = await this._delete(this.svAPIEndpoint, this.calendar._path + `/${id}`);
2870
+ return res;
2871
+ },
2872
+ };
2873
+ this.lineTarget = {
2874
+ _path: Repzo._end_points.LINE_TARGET,
2875
+ find: async (params) => {
2876
+ let res = await this._fetch(this.svAPIEndpoint, this.lineTarget._path, params);
2877
+ return res;
2878
+ },
2879
+ get: async (id, params) => {
2880
+ return await this._fetch(this.svAPIEndpoint, this.lineTarget._path + `/${id}`, params);
2881
+ },
2882
+ create: async (body) => {
2883
+ let res = await this._create(this.svAPIEndpoint, this.lineTarget._path, body);
2884
+ return res;
2885
+ },
2886
+ update: async (id, body) => {
2887
+ let res = await this._update(this.svAPIEndpoint, this.lineTarget._path + `/${id}`, body);
2888
+ return res;
2889
+ },
2890
+ remove: async (id, params) => {
2891
+ let res = await this._delete(this.svAPIEndpoint, this.lineTarget._path + (id ? `/${id}` : ""), params);
2892
+ return res;
2893
+ },
2894
+ };
2798
2895
  this.bulkImport = {
2799
2896
  _path: Repzo._end_points.BULK_IMPORT,
2800
2897
  find: async (params) => {
@@ -19106,6 +19106,459 @@ export declare namespace Service {
19106
19106
  type Result = Data;
19107
19107
  }
19108
19108
  }
19109
+ namespace TargetRule {
19110
+ type RuleType = "rep-visit" | "time-clock" | "rep-photo" | "rep-invoice" | "rep-proforma" | "item-status" | "rep-payment";
19111
+ type Period = "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
19112
+ interface Point {
19113
+ ratio: number;
19114
+ points: number;
19115
+ }
19116
+ interface RepVisitFilter {
19117
+ filter: "chain" | "channel" | "country" | "city" | "state" | "client" | "photoTag" | "clientTag" | "areaTag" | "from_total_time" | "to_total_time" | "from_call_total_time" | "to_call_total_time" | "feedback" | "activity" | "speciality";
19118
+ value: any[];
19119
+ photoCount?: number;
19120
+ }
19121
+ interface RepVisitDetails {
19122
+ type?: "rep-visit";
19123
+ filter: RepVisitFilter[];
19124
+ limit?: number;
19125
+ aggregation_key: "count" | "count-distinct" | "duration";
19126
+ period: Period;
19127
+ required_target: {
19128
+ type: "absolute" | "assigned_to";
19129
+ value: number;
19130
+ };
19131
+ }
19132
+ interface TimeClockFilter {
19133
+ filter: "from_startTime" | "to_startTime" | "from_endTime" | "to_endTime" | "from_timeOnDuty" | "to_timeOnDuty" | "from_breaksTime" | "to_breaksTime" | "from_timeInVisits" | "to_timeInVisits" | "from_totalTravelTime" | "to_totalTravelTime" | "from_travelTimeBetweenVisists" | "to_travelTimeBetweenVisists" | "from_scheduled" | "to_scheduled" | "from_unscheduled" | "to_unscheduled" | "from_missed" | "to_missed" | "closed_by_system";
19134
+ value: any;
19135
+ }
19136
+ interface TimeClockDetails {
19137
+ type?: "time-clock";
19138
+ filter: TimeClockFilter[];
19139
+ aggregation_key: "count" | "timeOnDuty" | "breaksTime" | "timeInVisits" | "totalTravelTime" | "travelTimeBetweenVisists" | "scheduled" | "unscheduled" | "missed";
19140
+ period: Period;
19141
+ limit?: number;
19142
+ required_target: {
19143
+ type: "absolute";
19144
+ value: number;
19145
+ };
19146
+ }
19147
+ interface RepPhotoFilter {
19148
+ filter: "chain" | "channel" | "country" | "city" | "state" | "client" | "photoTag" | "clientTag" | "areaTag" | "speciality";
19149
+ value: any[];
19150
+ }
19151
+ interface RepPhotoDetails {
19152
+ type?: "rep-photo";
19153
+ filter: RepPhotoFilter[];
19154
+ limit?: number;
19155
+ aggregation_key: "count" | "count-distinct";
19156
+ period: Period;
19157
+ required_target: {
19158
+ type: "absolute" | "assigned_to";
19159
+ value: number;
19160
+ };
19161
+ }
19162
+ interface ItemStatusFilter {
19163
+ filter: "teams" | "route" | "client" | "chain" | "channel" | "country" | "city" | "state" | "clientTag" | "areaTag" | "speciality" | "product" | "category" | "sub_category" | "brand" | "product_group" | "status" | "previous_status" | "item_status_type";
19164
+ value: any[];
19165
+ }
19166
+ interface ItemStatusDetails {
19167
+ type?: "item-status";
19168
+ filter: ItemStatusFilter[];
19169
+ limit?: number;
19170
+ aggregation_key: "count" | "prescriptions";
19171
+ period: Period;
19172
+ required_target: {
19173
+ type: "absolute";
19174
+ value: number;
19175
+ };
19176
+ }
19177
+ interface RepPaymentFilter {
19178
+ filter: "route" | "payment_type" | "status" | "client" | "chain" | "channel" | "country" | "city" | "clientTag" | "areaTag" | "teams" | "from_amount" | "to_amount" | "speciality" | "custom_status";
19179
+ value: any[];
19180
+ }
19181
+ interface RepPaymentDetails {
19182
+ type?: "rep-payment";
19183
+ filter: RepPaymentFilter[];
19184
+ limit?: number;
19185
+ aggregation_key: "count" | "count-distinct" | "amount";
19186
+ period: Period;
19187
+ required_target: {
19188
+ type: "absolute";
19189
+ value: number;
19190
+ };
19191
+ }
19192
+ interface RepInvoiceFilter {
19193
+ filter: "client" | "chain" | "channel" | "country" | "city" | "state" | "clientTag" | "areaTag" | "teams" | "product" | "variant" | "category" | "sub_category" | "brand" | "product_group" | "status" | "speciality" | "custom_status" | "from_base_unit_qty" | "to_base_unit_qty";
19194
+ value: any[];
19195
+ }
19196
+ interface RepInvoiceDetails {
19197
+ type?: "rep-invoice";
19198
+ filter: RepInvoiceFilter[];
19199
+ limit?: number;
19200
+ aggregation_key: "count" | "total" | "pre_total" | "return_total" | "count-distinct" | "qty";
19201
+ period: Period;
19202
+ required_target: {
19203
+ type: "absolute";
19204
+ value: number;
19205
+ };
19206
+ }
19207
+ interface RepProformaDetails {
19208
+ type?: "rep-proforma";
19209
+ filter: RepInvoiceFilter[];
19210
+ limit?: number;
19211
+ aggregation_key: "count" | "total" | "pre_total" | "return_total" | "count-distinct" | "qty";
19212
+ period: Period;
19213
+ required_target: {
19214
+ type: "absolute";
19215
+ value: number;
19216
+ };
19217
+ }
19218
+ type Details = RepVisitDetails | TimeClockDetails | RepPhotoDetails | ItemStatusDetails | RepPaymentDetails | RepInvoiceDetails | RepProformaDetails;
19219
+ interface Data {
19220
+ _id: StringId;
19221
+ name: string;
19222
+ points: Point[];
19223
+ allowOverOne?: boolean;
19224
+ type: RuleType;
19225
+ disabled: boolean;
19226
+ targets_group?: StringId;
19227
+ company_namespace: string[];
19228
+ details: Details;
19229
+ cycle?: any;
19230
+ createdAt: string;
19231
+ updatedAt: string;
19232
+ __v?: number;
19233
+ }
19234
+ interface CreateBody {
19235
+ company_namespace?: string[];
19236
+ name: string;
19237
+ type: RuleType;
19238
+ details: Details;
19239
+ points?: Point[];
19240
+ allowOverOne?: boolean;
19241
+ targets_group?: StringId;
19242
+ disabled?: boolean;
19243
+ }
19244
+ type UpdateBody = Partial<CreateBody>;
19245
+ namespace Find {
19246
+ type Params = DefaultPaginationQueryParams & {
19247
+ _id?: StringId | StringId[];
19248
+ search?: string;
19249
+ name?: string | string[];
19250
+ type?: RuleType | RuleType[];
19251
+ targets_group?: StringId | StringId[];
19252
+ "details.period"?: Period | Period[];
19253
+ disabled?: boolean;
19254
+ from_updatedAt?: number;
19255
+ to_updatedAt?: number;
19256
+ from_createdAt?: number;
19257
+ to_createdAt?: number;
19258
+ };
19259
+ interface Result extends DefaultPaginationResult {
19260
+ data: Data[];
19261
+ }
19262
+ }
19263
+ namespace Get {
19264
+ type ID = StringId;
19265
+ type Result = Data;
19266
+ }
19267
+ namespace Create {
19268
+ type Body = CreateBody;
19269
+ type Result = Data;
19270
+ }
19271
+ namespace Update {
19272
+ type ID = StringId;
19273
+ type Body = UpdateBody;
19274
+ type Result = Data;
19275
+ }
19276
+ namespace Remove {
19277
+ type ID = StringId;
19278
+ type Result = Data;
19279
+ }
19280
+ }
19281
+ namespace Plan {
19282
+ interface Editor {
19283
+ _id: StringId;
19284
+ type: "admin" | "rep";
19285
+ rep?: StringId;
19286
+ admin?: StringId;
19287
+ name?: string;
19288
+ }
19289
+ interface BuildListItem {
19290
+ calendar?: StringId;
19291
+ route?: StringId;
19292
+ client?: StringId;
19293
+ note?: string;
19294
+ from?: string;
19295
+ to?: string;
19296
+ visit_reason?: StringId;
19297
+ visit_note?: string;
19298
+ }
19299
+ interface BuildEntry {
19300
+ day: string;
19301
+ list: BuildListItem[];
19302
+ }
19303
+ interface Data {
19304
+ _id: StringId;
19305
+ name: string;
19306
+ editor?: Editor;
19307
+ startsAt?: string;
19308
+ endsAt?: string;
19309
+ build: BuildEntry[];
19310
+ sync_id: string;
19311
+ calendars?: StringId[];
19312
+ disabled: boolean;
19313
+ builtAt: number;
19314
+ company_namespace: string[];
19315
+ createdAt: string;
19316
+ updatedAt: string;
19317
+ __v?: number;
19318
+ }
19319
+ interface CreateBody {
19320
+ company_namespace?: string[];
19321
+ name: string;
19322
+ startsAt?: string;
19323
+ endsAt?: string;
19324
+ build?: BuildEntry[];
19325
+ sync_id: string;
19326
+ calendars?: StringId[];
19327
+ disabled?: boolean;
19328
+ builtAt?: number;
19329
+ }
19330
+ type UpdateBody = Partial<CreateBody>;
19331
+ namespace Find {
19332
+ type Params = DefaultPaginationQueryParams & {
19333
+ _id?: StringId | StringId[];
19334
+ search?: string;
19335
+ name?: string | string[];
19336
+ disabled?: boolean;
19337
+ myDailyPlan?: boolean;
19338
+ timezone?: string;
19339
+ from_updatedAt?: number;
19340
+ to_updatedAt?: number;
19341
+ from_createdAt?: number;
19342
+ to_createdAt?: number;
19343
+ populatedKeys?: string | string[];
19344
+ };
19345
+ interface Result extends DefaultPaginationResult {
19346
+ data: Data[];
19347
+ }
19348
+ }
19349
+ namespace Get {
19350
+ type ID = StringId;
19351
+ type Params = {
19352
+ populatedKeys?: string | string[];
19353
+ };
19354
+ type Result = Data;
19355
+ }
19356
+ namespace Create {
19357
+ type Body = CreateBody;
19358
+ type Result = Data;
19359
+ }
19360
+ namespace Update {
19361
+ type ID = StringId;
19362
+ type Body = UpdateBody;
19363
+ type Result = Data;
19364
+ }
19365
+ namespace Remove {
19366
+ type ID = StringId;
19367
+ type Result = Data;
19368
+ }
19369
+ }
19370
+ namespace Calendar {
19371
+ type CalendarType = "weekly" | "weeklyGroup";
19372
+ interface User {
19373
+ _id: StringId;
19374
+ type: "admin" | "rep";
19375
+ rep?: StringId;
19376
+ admin?: StringId;
19377
+ name?: string;
19378
+ }
19379
+ interface ClientEntry {
19380
+ client: StringId;
19381
+ from?: string;
19382
+ to?: string;
19383
+ visit_reason?: StringId;
19384
+ visit_note?: string;
19385
+ }
19386
+ interface WeeklyDetails {
19387
+ type?: "weekly";
19388
+ days: Day[];
19389
+ every: number;
19390
+ }
19391
+ interface DaysGroup {
19392
+ days: Day[];
19393
+ }
19394
+ interface WeeklyGroupDetails {
19395
+ type?: "weeklyGroup";
19396
+ daysGroups: DaysGroup[];
19397
+ groupSize: number;
19398
+ }
19399
+ type Details = WeeklyDetails | WeeklyGroupDetails;
19400
+ interface Data {
19401
+ _id: StringId;
19402
+ name: string;
19403
+ type: CalendarType;
19404
+ details: Details;
19405
+ creator: User;
19406
+ editor: User;
19407
+ routes?: StringId[];
19408
+ sync_id: string;
19409
+ clients?: ClientEntry[];
19410
+ occurrences?: number;
19411
+ startsAt: string;
19412
+ endsAt?: string;
19413
+ disabled: boolean;
19414
+ note?: string;
19415
+ visit_reason?: StringId;
19416
+ visit_note?: string;
19417
+ company_namespace: string[];
19418
+ createdAt: string;
19419
+ updatedAt: string;
19420
+ __v?: number;
19421
+ }
19422
+ interface CreateBody {
19423
+ company_namespace?: string[];
19424
+ name: string;
19425
+ type: CalendarType;
19426
+ details: Details;
19427
+ sync_id: string;
19428
+ startsAt: string;
19429
+ endsAt?: string;
19430
+ routes?: StringId[];
19431
+ clients?: ClientEntry[];
19432
+ occurrences?: number;
19433
+ disabled?: boolean;
19434
+ note?: string;
19435
+ visit_reason?: StringId;
19436
+ visit_note?: string;
19437
+ }
19438
+ type UpdateBody = Partial<CreateBody>;
19439
+ namespace Find {
19440
+ type Params = DefaultPaginationQueryParams & {
19441
+ _id?: StringId | StringId[];
19442
+ search?: string;
19443
+ name?: string | string[];
19444
+ type?: CalendarType | CalendarType[];
19445
+ rep?: StringId | StringId[];
19446
+ plan?: StringId | StringId[];
19447
+ visit_reason?: StringId | StringId[];
19448
+ groupSize?: number;
19449
+ from_groupSize?: number;
19450
+ to_groupSize?: number;
19451
+ disabled?: boolean;
19452
+ from_updatedAt?: number;
19453
+ to_updatedAt?: number;
19454
+ from_createdAt?: number;
19455
+ to_createdAt?: number;
19456
+ populatedKeys?: string | string[];
19457
+ };
19458
+ interface Result extends DefaultPaginationResult {
19459
+ data: Data[];
19460
+ }
19461
+ }
19462
+ namespace Get {
19463
+ type ID = StringId;
19464
+ type Params = {
19465
+ populatedKeys?: string | string[];
19466
+ };
19467
+ type Result = Data;
19468
+ }
19469
+ namespace Create {
19470
+ type Body = CreateBody;
19471
+ type Params = {
19472
+ assignTo?: StringId;
19473
+ assignedToMe?: boolean;
19474
+ };
19475
+ type Result = Data;
19476
+ }
19477
+ namespace Update {
19478
+ type ID = StringId;
19479
+ type Body = UpdateBody;
19480
+ type Result = Data;
19481
+ }
19482
+ namespace Remove {
19483
+ type ID = StringId;
19484
+ type Result = Data;
19485
+ }
19486
+ }
19487
+ namespace LineTarget {
19488
+ export type UserType = "rep" | "client";
19489
+ export interface User {
19490
+ _id: StringId;
19491
+ name?: string;
19492
+ type?: UserType;
19493
+ rep?: StringId;
19494
+ client?: StringId;
19495
+ }
19496
+ export interface Data {
19497
+ _id: StringId;
19498
+ line: StringId;
19499
+ target: number;
19500
+ classification: StringId;
19501
+ user?: User;
19502
+ company_namespace: string[];
19503
+ createdAt: string;
19504
+ updatedAt: string;
19505
+ __v?: number;
19506
+ }
19507
+ export interface CreateBody {
19508
+ company_namespace?: string[];
19509
+ line: StringId;
19510
+ target: number;
19511
+ classification: StringId;
19512
+ user?: User;
19513
+ }
19514
+ export type UpdateBody = Partial<CreateBody>;
19515
+ type PopulatedKeys = "client" | "rep" | "classification" | "line";
19516
+ export namespace Find {
19517
+ type Params = DefaultPaginationQueryParams & {
19518
+ populatedKeys?: PopulatedKeys | PopulatedKeys[];
19519
+ _id?: StringId | StringId[];
19520
+ line?: StringId | StringId[];
19521
+ classification?: StringId | StringId[];
19522
+ "user._id"?: StringId | StringId[];
19523
+ rep?: StringId | StringId[];
19524
+ client?: StringId | StringId[];
19525
+ from_updatedAt?: number;
19526
+ to_updatedAt?: number;
19527
+ from_createdAt?: number;
19528
+ to_createdAt?: number;
19529
+ };
19530
+ interface Result extends DefaultPaginationResult {
19531
+ data: Data[];
19532
+ }
19533
+ }
19534
+ export namespace Get {
19535
+ type ID = StringId;
19536
+ type Params = {
19537
+ populatedKeys?: PopulatedKeys | PopulatedKeys[];
19538
+ };
19539
+ type Result = Data;
19540
+ }
19541
+ export namespace Create {
19542
+ type Body = CreateBody;
19543
+ type Result = Data;
19544
+ }
19545
+ export namespace Update {
19546
+ type ID = StringId;
19547
+ type Body = UpdateBody;
19548
+ type Result = Data;
19549
+ }
19550
+ export namespace Remove {
19551
+ type ID = StringId | null;
19552
+ type Params = {
19553
+ all?: boolean;
19554
+ };
19555
+ interface Result {
19556
+ deletedCount: number;
19557
+ success: number;
19558
+ }
19559
+ }
19560
+ export {};
19561
+ }
19109
19562
  namespace BulkImport {
19110
19563
  type BulkImportType = "insertTags" | "insertClients" | "insertReps" | "updateReps" | "updateClients" | "insertProducts" | "insertVariants" | "updateProducts" | "updateVariants" | "updateCategories" | "updateSubCategories" | "insertCategories" | "insertSubCategories" | "insertAvailabilityMsl" | "updateAvailabilityMsl" | "updateAvailabilityMslWithProducts" | "updateMslWithVariants" | "insertJobCategories" | "updateJobCategories" | "updateJobs" | "insertJobs" | "updateTags" | "insertRoutes" | "updateRoutes" | "updateRoutesWithClients" | "insertPlans" | "updatePlans" | "updatePlansWithRules" | "weeklyGroupRules" | "weeklyRules" | "updateRulesWithRoutes" | "updateTargetRulesWithClients" | "updateTargetRulesWithReps" | "insertTransfers" | "adjustAccounts" | "insertRules" | "updateRules" | "insertInvoices" | "insertWarehouses" | "updateWarehouses" | "insertProductGroups" | "updateProductGroups" | "updatePriceListItems" | "updateMeasureunit" | "insertMeasureunit" | "insertMeasureunitFamily" | "updateMeasureunitFamily" | "insertLineTarget" | "clientLineClassification" | "updateLineTarget" | "insertReceivingMaterials" | "insertRetailExecutionPresets" | "updateRetailExecutionPresets" | "insertCustomListItems" | "updateCustomListItems" | "insertAssets" | "updateAssets" | "insertAssetUnits" | "updateAssetUnits" | "insertSpeciality" | "updateSpeciality" | "insertClientLocation" | "updateClientLocation" | "deleteLineTarget" | "updatePromotions" | "insertReminders" | "updateReminders" | "insertVariantBatch" | "updateVariantBatch" | "insertSettlements" | "updateClientUblInfo" | "insertSuppliers" | "updateSuppliers" | "insertTargetRules" | "insertContractInstallments" | "updateContractInstallments" | "insertContracts" | "updateContracts" | "insertAssetPartTypes" | "updateAssetPartTypes" | "insertAssetParts" | "updateAssetParts";
19111
19564
  interface ToBeInserted {