repzo 1.0.121 → 1.0.123

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
@@ -9,6 +9,7 @@
9
9
  - update FullInvoice with ubl keys @maramalshen
10
10
  - add: approval-request @maramalshen
11
11
  - add: workorder-request @maramalshen
12
+ - add: approval @maramalshen
12
13
 
13
14
  ### Changed
14
15
 
package/lib/index.d.ts CHANGED
@@ -92,6 +92,8 @@ export default class Repzo {
92
92
  readonly ASSET_TYPE: "asset-type";
93
93
  readonly ASSET: "asset";
94
94
  readonly ASSET_UNIT: "asset-unit";
95
+ readonly WORKORDER_PORTAL: "workorder-portal";
96
+ readonly APPROVAL: "approvals";
95
97
  };
96
98
  private _fetch;
97
99
  private _create;
@@ -1454,4 +1456,44 @@ export default class Repzo {
1454
1456
  params: Service.AssetUnit.Remove.Params
1455
1457
  ) => Promise<Service.AssetUnit.Remove.Result>;
1456
1458
  };
1459
+ workorderPortal: {
1460
+ _path: "workorder-portal";
1461
+ find: (
1462
+ params?: Service.WorkorderPortal.Find.Params
1463
+ ) => Promise<Service.WorkorderPortal.Find.Result>;
1464
+ get: (
1465
+ id: Service.WorkorderPortal.Get.ID,
1466
+ params?: Service.WorkorderPortal.Get.Params
1467
+ ) => Promise<Service.WorkorderPortal.Get.Result>;
1468
+ create: (
1469
+ body: Service.WorkorderPortal.Create.Body
1470
+ ) => Promise<Service.WorkorderPortal.Create.Result>;
1471
+ update: (
1472
+ id: Service.WorkorderPortal.Update.ID,
1473
+ body: Service.WorkorderPortal.Update.Body
1474
+ ) => Promise<Service.WorkorderPortal.Update.Result>;
1475
+ remove: (
1476
+ id: Service.WorkorderPortal.Update.ID
1477
+ ) => Promise<Service.WorkorderPortal.Remove.Result>;
1478
+ };
1479
+ approval: {
1480
+ _path: "approvals";
1481
+ find: (
1482
+ params?: Service.Approval.Find.Params
1483
+ ) => Promise<Service.Approval.Find.Result>;
1484
+ get: (
1485
+ id: Service.Approval.Get.ID,
1486
+ params?: Service.Approval.Get.Params
1487
+ ) => Promise<Service.Approval.Get.Result>;
1488
+ create: (
1489
+ body: Service.Approval.Create.Body
1490
+ ) => Promise<Service.Approval.Create.Result>;
1491
+ update: (
1492
+ id: Service.Approval.Update.ID,
1493
+ body: Service.Approval.Update.Body
1494
+ ) => Promise<Service.Approval.Update.Result>;
1495
+ remove: (
1496
+ id: Service.Approval.Remove.ID
1497
+ ) => Promise<Service.Approval.Remove.Result>;
1498
+ };
1457
1499
  }
package/lib/index.js CHANGED
@@ -81,6 +81,8 @@ export default class Repzo {
81
81
  ASSET_TYPE: "asset-type",
82
82
  ASSET: "asset",
83
83
  ASSET_UNIT: "asset-unit",
84
+ WORKORDER_PORTAL: "workorder-portal",
85
+ APPROVAL: "approvals",
84
86
  };
85
87
  this.END_POINTS = this._end_points;
86
88
  this.client = {
@@ -2692,6 +2694,88 @@ export default class Repzo {
2692
2694
  return res;
2693
2695
  },
2694
2696
  };
2697
+ this.workorderPortal = {
2698
+ _path: this._end_points.WORKORDER_PORTAL,
2699
+ find: async (params) => {
2700
+ let res = await this._fetch(
2701
+ this.svAPIEndpoint,
2702
+ this.workorderPortal._path,
2703
+ params
2704
+ );
2705
+ return res;
2706
+ },
2707
+ get: async (id, params) => {
2708
+ return await this._fetch(
2709
+ this.svAPIEndpoint,
2710
+ this.workorderPortal._path + `/${id}`,
2711
+ params
2712
+ );
2713
+ },
2714
+ create: async (body) => {
2715
+ let res = await this._create(
2716
+ this.svAPIEndpoint,
2717
+ this.workorderPortal._path,
2718
+ body
2719
+ );
2720
+ return res;
2721
+ },
2722
+ update: async (id, body) => {
2723
+ let res = await this._update(
2724
+ this.svAPIEndpoint,
2725
+ this.workorderPortal._path + `/${id}`,
2726
+ body
2727
+ );
2728
+ return res;
2729
+ },
2730
+ remove: async (id) => {
2731
+ let res = await this._delete(
2732
+ this.svAPIEndpoint,
2733
+ this.workorderPortal._path + `/${id}`
2734
+ );
2735
+ return res;
2736
+ },
2737
+ };
2738
+ this.approval = {
2739
+ _path: this._end_points.APPROVAL,
2740
+ find: async (params) => {
2741
+ let res = await this._fetch(
2742
+ this.svAPIEndpoint,
2743
+ this.approval._path,
2744
+ params
2745
+ );
2746
+ return res;
2747
+ },
2748
+ get: async (id, params) => {
2749
+ return await this._fetch(
2750
+ this.svAPIEndpoint,
2751
+ this.approval._path + `/${id}`,
2752
+ params
2753
+ );
2754
+ },
2755
+ create: async (body) => {
2756
+ let res = await this._create(
2757
+ this.svAPIEndpoint,
2758
+ this.approval._path,
2759
+ body
2760
+ );
2761
+ return res;
2762
+ },
2763
+ update: async (id, body) => {
2764
+ let res = await this._update(
2765
+ this.svAPIEndpoint,
2766
+ this.approval._path + `/${id}`,
2767
+ body
2768
+ );
2769
+ return res;
2770
+ },
2771
+ remove: async (id) => {
2772
+ let res = await this._delete(
2773
+ this.svAPIEndpoint,
2774
+ this.approval._path + `/${id}`
2775
+ );
2776
+ return res;
2777
+ },
2778
+ };
2695
2779
  this.svAPIEndpoint =
2696
2780
  !options?.env || options?.env == "production"
2697
2781
  ? "https://sv.api.repzo.me"
@@ -112,6 +112,8 @@ interface ClientLocationPopulated {
112
112
  }
113
113
  interface FormPopulated {
114
114
  name: string;
115
+ _id: StringId;
116
+ local_name?: string;
115
117
  }
116
118
  interface VisitMeta {
117
119
  geo_fence_setting_visit_start: boolean;
@@ -5414,6 +5416,225 @@ export declare namespace Service {
5414
5416
  }
5415
5417
  export {};
5416
5418
  }
5419
+ namespace WorkorderPortal {
5420
+ interface Accepted_system_fields {
5421
+ field: "clients" | "clientLocation" | "asset" | "assetUnit";
5422
+ is_required: true;
5423
+ is_name_visible: Boolean;
5424
+ }
5425
+ type Default_Priority_human = "none" | "low" | "medium" | "high";
5426
+ type Default_Priority = 0 | 1 | 2 | 3;
5427
+ export interface Data {
5428
+ creator: AdminOrRep;
5429
+ name: string;
5430
+ description?: string;
5431
+ default_priority_human?: Default_Priority_human;
5432
+ default_priority?: Default_Priority;
5433
+ default_workorder_categories?: StringId[];
5434
+ teams?: string[];
5435
+ company_namespace: string[];
5436
+ allow_media_upload: "optional" | "required" | "hidden";
5437
+ allow_signature: "optional" | "required" | "hidden";
5438
+ header?: string;
5439
+ footer?: string;
5440
+ accepted_custom_fields?: string[];
5441
+ accepted_system_fields: Accepted_system_fields[];
5442
+ header_logo?: string;
5443
+ footer_logo?: string;
5444
+ createdAt?: Date;
5445
+ updatedAt?: Date;
5446
+ editor?: AdminOrRep;
5447
+ _id: StringId;
5448
+ disabled: boolean;
5449
+ website?: string;
5450
+ cover_photo?: StringId;
5451
+ activate_formV2_portal: boolean;
5452
+ activate_sales_order_portal: boolean;
5453
+ activate_workorder_request_portal: boolean;
5454
+ formV2?: StringId[];
5455
+ product_groups?: StringId[];
5456
+ geoPoint?: GeoPoint;
5457
+ location_name?: string;
5458
+ social_media_platforms?: {
5459
+ platform: StringId;
5460
+ handle?: string;
5461
+ url?: string;
5462
+ account_type: string;
5463
+ }[];
5464
+ }
5465
+ export interface CreateBody {
5466
+ creator?: AdminOrRep;
5467
+ name: string;
5468
+ description?: string;
5469
+ default_priority_human?: Default_Priority_human;
5470
+ default_priority?: Default_Priority;
5471
+ default_workorder_categories?: StringId[];
5472
+ customFields?: {
5473
+ [key: string]: any;
5474
+ };
5475
+ teams?: StringId[];
5476
+ allow_media_upload?: "optional" | "required" | "hidden";
5477
+ allow_signature?: "optional" | "required" | "hidden";
5478
+ header?: string;
5479
+ footer?: string;
5480
+ accepted_custom_fields?: StringId[];
5481
+ accepted_system_fields?: Accepted_system_fields[];
5482
+ header_logo?: string;
5483
+ footer_logo?: string;
5484
+ website?: string;
5485
+ cover_photo?: StringId;
5486
+ activate_formV2_portal: boolean;
5487
+ activate_sales_order_portal: boolean;
5488
+ activate_workorder_request_portal: boolean;
5489
+ formV2?: StringId[];
5490
+ product_groups?: StringId[];
5491
+ geoPoint?: GeoPoint;
5492
+ location_name?: string;
5493
+ social_media_platforms?: {
5494
+ platform: StringId;
5495
+ handle?: string;
5496
+ url?: string;
5497
+ account_type: string;
5498
+ }[];
5499
+ }
5500
+ export interface UpdateBody {
5501
+ name?: string;
5502
+ description?: string;
5503
+ default_priority_human?: Default_Priority_human;
5504
+ default_priority?: Default_Priority;
5505
+ default_workorder_categories?: StringId[];
5506
+ teams?: StringId[];
5507
+ allow_media_upload?: "optional" | "required" | "hidden";
5508
+ allow_signature?: "optional" | "required" | "hidden";
5509
+ header?: string;
5510
+ footer?: string;
5511
+ accepted_custom_fields?: StringId[];
5512
+ accepted_system_fields?: Accepted_system_fields[];
5513
+ header_logo?: string;
5514
+ footer_logo?: string;
5515
+ editor?: AdminOrRep;
5516
+ website?: string;
5517
+ cover_photo?: StringId;
5518
+ activate_formV2_portal?: boolean;
5519
+ activate_sales_order_portal?: boolean;
5520
+ activate_workorder_request_portal?: boolean;
5521
+ formV2?: StringId[];
5522
+ product_groups?: StringId[];
5523
+ geoPoint?: GeoPoint;
5524
+ location_name?: string;
5525
+ social_media_platforms?: {
5526
+ platform: StringId;
5527
+ handle: string;
5528
+ url: string;
5529
+ account_type: string;
5530
+ }[];
5531
+ }
5532
+ export interface PopulatedDoc {
5533
+ creator: AdminOrRep;
5534
+ name: string;
5535
+ description?: string;
5536
+ default_priority_human?: Default_Priority_human;
5537
+ default_priority?: Default_Priority;
5538
+ default_workorder_categories?: StringId[];
5539
+ default_workorder_categories_populated?: WorkorderCategoryPopulated[];
5540
+ teams?: string[];
5541
+ company_namespace: string[];
5542
+ allow_media_upload: "optional" | "required" | "hidden";
5543
+ allow_signature: "optional" | "required" | "hidden";
5544
+ header?: string;
5545
+ footer?: string;
5546
+ accepted_custom_fields?: string[];
5547
+ accepted_custom_fields_populated?: {
5548
+ [key: string]: string | number | boolean;
5549
+ }[];
5550
+ accepted_system_fields: Accepted_system_fields[];
5551
+ header_logo?: string;
5552
+ header_logo_populated?: PopulatedMediaStorage[];
5553
+ footer_logo?: string;
5554
+ footer_logo_populated?: PopulatedMediaStorage[];
5555
+ createdAt?: Date;
5556
+ updatedAt?: Date;
5557
+ editor?: AdminOrRep;
5558
+ _id: StringId;
5559
+ disabled: boolean;
5560
+ website?: string;
5561
+ cover_photo?: StringId;
5562
+ activate_formV2_portal: boolean;
5563
+ activate_sales_order_portal: boolean;
5564
+ activate_workorder_request_portal: boolean;
5565
+ formV2?: StringId[];
5566
+ formV2_populated?: FormPopulated[];
5567
+ product_groups?: Pick<
5568
+ ProductGroup.ProductGroupSchema,
5569
+ "_id" | "name" | "local_name"
5570
+ >[];
5571
+ geoPoint?: GeoPoint;
5572
+ location_name?: string;
5573
+ social_media_platforms?: {
5574
+ platform: StringId;
5575
+ handle?: string;
5576
+ url?: string;
5577
+ account_type: string;
5578
+ }[];
5579
+ }
5580
+ type SortingKeys = "default_priority" | "updatedAt" | "createdAt";
5581
+ type PopulatedKeys =
5582
+ | "default_workorder_categories"
5583
+ | "header_logo"
5584
+ | "footer_logo"
5585
+ | "accepted_custom_fields"
5586
+ | "formV2"
5587
+ | "product_groups";
5588
+ export namespace Find {
5589
+ type Params = DefaultPaginationQueryParams & {
5590
+ _id?: StringId | StringId[];
5591
+ name?: string | string[];
5592
+ default_priority?: Default_Priority | Default_Priority[];
5593
+ default_priority_human?:
5594
+ | Default_Priority_human
5595
+ | Default_Priority_human[];
5596
+ default_workorder_categories?: StringId | StringId[];
5597
+ formV2?: StringId | StringId[];
5598
+ product_groups?: StringId | StringId[];
5599
+ activate_formV2_portal?: boolean;
5600
+ activate_sales_order_portal?: boolean;
5601
+ activate_workorder_request_portal?: boolean;
5602
+ from_updatedAt?: number;
5603
+ to_updatedAt?: number;
5604
+ disabled?: boolean;
5605
+ search?: string;
5606
+ populatedKeys?: PopulatedKeys | PopulatedKeys[];
5607
+ sortBy?: {
5608
+ field: SortingKeys;
5609
+ type: "asc" | "desc";
5610
+ }[];
5611
+ };
5612
+ interface Result extends DefaultPaginationResult {
5613
+ data: Data[] | PopulatedDoc[];
5614
+ }
5615
+ }
5616
+ export namespace Get {
5617
+ type ID = string;
5618
+ interface Params {
5619
+ populatedKeys?: PopulatedKeys[];
5620
+ }
5621
+ type Result = Data | PopulatedDoc;
5622
+ }
5623
+ export namespace Create {
5624
+ type Body = CreateBody;
5625
+ type Result = Data;
5626
+ }
5627
+ export namespace Update {
5628
+ type ID = string;
5629
+ type Body = UpdateBody;
5630
+ type Result = Data;
5631
+ }
5632
+ export namespace Remove {
5633
+ type ID = string;
5634
+ type Result = Data;
5635
+ }
5636
+ export {};
5637
+ }
5417
5638
  namespace QuickConvertToPdf {
5418
5639
  export interface QuickConvertToPdfSchema {
5419
5640
  _id?: string;
@@ -7886,6 +8107,184 @@ export declare namespace Service {
7886
8107
  type Result = SupplierSchema;
7887
8108
  }
7888
8109
  }
8110
+ namespace Approval {
8111
+ interface Data {
8112
+ _id: StringId;
8113
+ creator: AdminCreator;
8114
+ name: string;
8115
+ disabled: boolean;
8116
+ company_namespace: string[];
8117
+ type:
8118
+ | "proforma"
8119
+ | "transfer"
8120
+ | "approval-request"
8121
+ | "receiving-material"
8122
+ | "asset-part-transfer"
8123
+ | "adjust-inventory"
8124
+ | "return-asset-part-unit"
8125
+ | "store-asset-part-unit";
8126
+ position?: number;
8127
+ description?: string;
8128
+ rules: {
8129
+ index: number;
8130
+ name: string;
8131
+ permissions: {
8132
+ can_edit: boolean;
8133
+ };
8134
+ admins: {
8135
+ _id: StringId;
8136
+ name?: string;
8137
+ type: "admin";
8138
+ }[];
8139
+ reps: {
8140
+ _id: StringId;
8141
+ name?: string;
8142
+ type: "rep";
8143
+ }[];
8144
+ append_creator?: boolean;
8145
+ append_assigned_origin_warehouse_rep?: boolean;
8146
+ append_assigned_destination_warehouse_rep?: boolean;
8147
+ send_email?: boolean;
8148
+ }[];
8149
+ filters?: {
8150
+ key: string;
8151
+ operator: "eq" | "ne" | "in" | "nin" | "gt" | "gte" | "lt" | "lte";
8152
+ value: any[];
8153
+ manipulator_function?: string;
8154
+ }[];
8155
+ createdAt: Date;
8156
+ updatedAt: Date;
8157
+ __v: number;
8158
+ }
8159
+ interface CreateBody {
8160
+ name: string;
8161
+ type:
8162
+ | "proforma"
8163
+ | "transfer"
8164
+ | "approval-request"
8165
+ | "receiving-material"
8166
+ | "asset-part-transfer"
8167
+ | "adjust-inventory"
8168
+ | "return-asset-part-unit"
8169
+ | "store-asset-part-unit";
8170
+ creator?: AdminCreator;
8171
+ disabled?: boolean;
8172
+ company_namespace?: string[];
8173
+ position?: number;
8174
+ description?: string;
8175
+ rules: {
8176
+ index: number;
8177
+ name: string;
8178
+ permissions?: {
8179
+ can_edit: boolean;
8180
+ };
8181
+ admins?: {
8182
+ _id: StringId;
8183
+ name?: string;
8184
+ type: "admin";
8185
+ }[];
8186
+ reps?: {
8187
+ _id: StringId;
8188
+ name?: string;
8189
+ type: "rep";
8190
+ }[];
8191
+ append_creator?: boolean;
8192
+ append_assigned_origin_warehouse_rep?: boolean;
8193
+ append_assigned_destination_warehouse_rep?: boolean;
8194
+ send_email?: boolean;
8195
+ }[];
8196
+ filters?: {
8197
+ key: string;
8198
+ operator: "eq" | "ne" | "in" | "nin" | "gt" | "gte" | "lt" | "lte";
8199
+ value: any[];
8200
+ manipulator_function?: string;
8201
+ }[];
8202
+ }
8203
+ interface UpdateBody {
8204
+ _id?: StringId;
8205
+ creator?: AdminCreator;
8206
+ name?: string;
8207
+ disabled?: boolean;
8208
+ company_namespace?: string[];
8209
+ type?:
8210
+ | "proforma"
8211
+ | "transfer"
8212
+ | "approval-request"
8213
+ | "receiving-material"
8214
+ | "asset-part-transfer"
8215
+ | "adjust-inventory"
8216
+ | "return-asset-part-unit"
8217
+ | "store-asset-part-unit";
8218
+ position?: number;
8219
+ description?: string;
8220
+ rules?: {
8221
+ index: number;
8222
+ name: string;
8223
+ permissions?: {
8224
+ can_edit: boolean;
8225
+ };
8226
+ admins?: {
8227
+ _id: StringId;
8228
+ name?: string;
8229
+ type: "admin";
8230
+ }[];
8231
+ reps?: {
8232
+ _id: StringId;
8233
+ name?: string;
8234
+ type: "rep";
8235
+ }[];
8236
+ append_creator?: boolean;
8237
+ append_assigned_origin_warehouse_rep?: boolean;
8238
+ append_assigned_destination_warehouse_rep?: boolean;
8239
+ send_email?: boolean;
8240
+ }[];
8241
+ filters?: {
8242
+ key: string;
8243
+ operator: "eq" | "ne" | "in" | "nin" | "gt" | "gte" | "lt" | "lte";
8244
+ value: any[];
8245
+ manipulator_function?: string;
8246
+ }[];
8247
+ createdAt?: Date;
8248
+ updatedAt?: Date;
8249
+ __v?: number;
8250
+ }
8251
+ namespace Find {
8252
+ type Params = DefaultPaginationQueryParams & {
8253
+ _id?: StringId[] | StringId;
8254
+ search?: string;
8255
+ name?: string[] | string;
8256
+ disabled?: boolean;
8257
+ sortBy?: {
8258
+ field: "_id" | "position" | "updatedAt";
8259
+ type: "asc" | "desc";
8260
+ }[];
8261
+ [key: string]: any;
8262
+ };
8263
+ interface Result extends DefaultPaginationResult {
8264
+ data: Data[];
8265
+ }
8266
+ }
8267
+ namespace Get {
8268
+ type ID = string;
8269
+ type Params = {
8270
+ [key: string]: any;
8271
+ };
8272
+ type Result = Data;
8273
+ }
8274
+ namespace Create {
8275
+ type Body = CreateBody;
8276
+ type Result = Data;
8277
+ }
8278
+ namespace Update {
8279
+ type ID = string;
8280
+ type Body = UpdateBody;
8281
+ type Result = Data;
8282
+ }
8283
+ namespace Remove {
8284
+ type ID = string;
8285
+ type Result = Data;
8286
+ }
8287
+ }
7889
8288
  namespace Cycle {
7890
8289
  type CycleStatus = "pending" | "approved" | "processing" | "rejected";
7891
8290
  export interface Schema {
@@ -12694,6 +13093,11 @@ export declare namespace Service {
12694
13093
  createdAt: Date;
12695
13094
  updatedAt: Date;
12696
13095
  }
13096
+ export type PopulatedDoc = Data & {
13097
+ cycle?: Cycle.Schema & {
13098
+ approval?: string | Approval.Data;
13099
+ };
13100
+ };
12697
13101
  export interface CreateBody {
12698
13102
  document_id?: StringId;
12699
13103
  document_type: "client" | "visit";
@@ -12898,10 +13302,12 @@ export declare namespace Service {
12898
13302
  field: "_id";
12899
13303
  type: "asc" | "desc";
12900
13304
  }[];
13305
+ withCycle?: boolean;
13306
+ populatedKeys?: ["approval"];
12901
13307
  [key: string]: any;
12902
13308
  };
12903
13309
  interface Result extends DefaultPaginationResult {
12904
- data: Data[];
13310
+ data: Data[] | PopulatedDoc[];
12905
13311
  }
12906
13312
  }
12907
13313
  export namespace Get {
@@ -12911,10 +13317,13 @@ export declare namespace Service {
12911
13317
  validityCheck?: boolean;
12912
13318
  originalDoc_populatedKeys?: PopulatedKeys[];
12913
13319
  withOriginalDoc?: boolean;
13320
+ populatedKeys?: ["approval"];
12914
13321
  [key: string]: any;
12915
13322
  };
12916
13323
  type Result = Data & {
12917
- cycle?: Cycle.Schema;
13324
+ cycle?: Cycle.Schema & {
13325
+ approval?: string | Approval.Data;
13326
+ };
12918
13327
  original_doc?: Client.ClientSchema | Visit.VisitSchema;
12919
13328
  };
12920
13329
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repzo",
3
- "version": "1.0.121",
3
+ "version": "1.0.123",
4
4
  "description": "Repzo TypeScript SDK",
5
5
  "main": "./lib/index.js",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -116,6 +116,8 @@ export default class Repzo {
116
116
  ASSET_TYPE: "asset-type",
117
117
  ASSET: "asset",
118
118
  ASSET_UNIT: "asset-unit",
119
+ WORKORDER_PORTAL: "workorder-portal",
120
+ APPROVAL: "approvals",
119
121
  } as const;
120
122
  public END_POINTS = this._end_points;
121
123
  private async _fetch(baseUrl: string, path: string, params?: Params) {
@@ -4092,6 +4094,114 @@ export default class Repzo {
4092
4094
  return res;
4093
4095
  },
4094
4096
  };
4097
+
4098
+ workorderPortal = {
4099
+ _path: this._end_points.WORKORDER_PORTAL,
4100
+ find: async (
4101
+ params?: Service.WorkorderPortal.Find.Params
4102
+ ): Promise<Service.WorkorderPortal.Find.Result> => {
4103
+ let res: Service.WorkorderPortal.Find.Result = await this._fetch(
4104
+ this.svAPIEndpoint,
4105
+ this.workorderPortal._path,
4106
+ params
4107
+ );
4108
+ return res;
4109
+ },
4110
+ get: async (
4111
+ id: Service.WorkorderPortal.Get.ID,
4112
+ params?: Service.WorkorderPortal.Get.Params
4113
+ ): Promise<Service.WorkorderPortal.Get.Result> => {
4114
+ return await this._fetch(
4115
+ this.svAPIEndpoint,
4116
+ this.workorderPortal._path + `/${id}`,
4117
+ params
4118
+ );
4119
+ },
4120
+ create: async (
4121
+ body: Service.WorkorderPortal.Create.Body
4122
+ ): Promise<Service.WorkorderPortal.Create.Result> => {
4123
+ let res = await this._create(
4124
+ this.svAPIEndpoint,
4125
+ this.workorderPortal._path,
4126
+ body
4127
+ );
4128
+ return res;
4129
+ },
4130
+ update: async (
4131
+ id: Service.WorkorderPortal.Update.ID,
4132
+ body: Service.WorkorderPortal.Update.Body
4133
+ ): Promise<Service.WorkorderPortal.Update.Result> => {
4134
+ let res: Service.WorkorderPortal.Update.Result = await this._update(
4135
+ this.svAPIEndpoint,
4136
+ this.workorderPortal._path + `/${id}`,
4137
+ body
4138
+ );
4139
+ return res;
4140
+ },
4141
+ remove: async (
4142
+ id: Service.WorkorderPortal.Update.ID
4143
+ ): Promise<Service.WorkorderPortal.Remove.Result> => {
4144
+ let res: Service.WorkorderPortal.Remove.Result = await this._delete(
4145
+ this.svAPIEndpoint,
4146
+ this.workorderPortal._path + `/${id}`
4147
+ );
4148
+ return res;
4149
+ },
4150
+ };
4151
+
4152
+ approval = {
4153
+ _path: this._end_points.APPROVAL,
4154
+ find: async (
4155
+ params?: Service.Approval.Find.Params
4156
+ ): Promise<Service.Approval.Find.Result> => {
4157
+ let res: Service.Approval.Find.Result = await this._fetch(
4158
+ this.svAPIEndpoint,
4159
+ this.approval._path,
4160
+ params
4161
+ );
4162
+ return res;
4163
+ },
4164
+ get: async (
4165
+ id: Service.Approval.Get.ID,
4166
+ params?: Service.Approval.Get.Params
4167
+ ): Promise<Service.Approval.Get.Result> => {
4168
+ return await this._fetch(
4169
+ this.svAPIEndpoint,
4170
+ this.approval._path + `/${id}`,
4171
+ params
4172
+ );
4173
+ },
4174
+ create: async (
4175
+ body: Service.Approval.Create.Body
4176
+ ): Promise<Service.Approval.Create.Result> => {
4177
+ let res = await this._create(
4178
+ this.svAPIEndpoint,
4179
+ this.approval._path,
4180
+ body
4181
+ );
4182
+ return res;
4183
+ },
4184
+ update: async (
4185
+ id: Service.Approval.Update.ID,
4186
+ body: Service.Approval.Update.Body
4187
+ ): Promise<Service.Approval.Update.Result> => {
4188
+ let res: Service.Approval.Update.Result = await this._update(
4189
+ this.svAPIEndpoint,
4190
+ this.approval._path + `/${id}`,
4191
+ body
4192
+ );
4193
+ return res;
4194
+ },
4195
+ remove: async (
4196
+ id: Service.Approval.Remove.ID
4197
+ ): Promise<Service.Approval.Remove.Result> => {
4198
+ let res: Service.Approval.Remove.Result = await this._delete(
4199
+ this.svAPIEndpoint,
4200
+ this.approval._path + `/${id}`
4201
+ );
4202
+ return res;
4203
+ },
4204
+ };
4095
4205
  }
4096
4206
 
4097
4207
  function normalizeParams(params: Params): { [key: string]: any } {
@@ -115,6 +115,8 @@ interface ClientLocationPopulated {
115
115
  }
116
116
  interface FormPopulated {
117
117
  name: string;
118
+ _id: StringId;
119
+ local_name?: string;
118
120
  }
119
121
  interface VisitMeta {
120
122
  geo_fence_setting_visit_start: boolean;
@@ -5426,6 +5428,222 @@ export namespace Service {
5426
5428
  }
5427
5429
  }
5428
5430
 
5431
+ export namespace WorkorderPortal {
5432
+ interface Accepted_system_fields {
5433
+ field: "clients" | "clientLocation" | "asset" | "assetUnit";
5434
+ is_required: true;
5435
+ is_name_visible: Boolean;
5436
+ }
5437
+ type Default_Priority_human = "none" | "low" | "medium" | "high";
5438
+ type Default_Priority = 0 | 1 | 2 | 3;
5439
+ export interface Data {
5440
+ creator: AdminOrRep;
5441
+ name: string;
5442
+ description?: string;
5443
+ default_priority_human?: Default_Priority_human;
5444
+ default_priority?: Default_Priority;
5445
+ default_workorder_categories?: StringId[];
5446
+ teams?: string[];
5447
+ company_namespace: string[];
5448
+ allow_media_upload: "optional" | "required" | "hidden";
5449
+ allow_signature: "optional" | "required" | "hidden";
5450
+ header?: string;
5451
+ footer?: string;
5452
+ accepted_custom_fields?: string[];
5453
+ accepted_system_fields: Accepted_system_fields[];
5454
+ header_logo?: string;
5455
+ footer_logo?: string;
5456
+ createdAt?: Date;
5457
+ updatedAt?: Date;
5458
+ editor?: AdminOrRep;
5459
+ _id: StringId;
5460
+ disabled: boolean;
5461
+ website?: string;
5462
+ cover_photo?: StringId;
5463
+ activate_formV2_portal: boolean;
5464
+ activate_sales_order_portal: boolean;
5465
+ activate_workorder_request_portal: boolean;
5466
+ formV2?: StringId[];
5467
+ product_groups?: StringId[];
5468
+ geoPoint?: GeoPoint;
5469
+ location_name?: string;
5470
+ social_media_platforms?: {
5471
+ platform: StringId;
5472
+ handle?: string;
5473
+ url?: string;
5474
+ account_type: string;
5475
+ }[];
5476
+ }
5477
+ export interface CreateBody {
5478
+ creator?: AdminOrRep;
5479
+ name: string;
5480
+ description?: string;
5481
+ default_priority_human?: Default_Priority_human;
5482
+ default_priority?: Default_Priority;
5483
+ default_workorder_categories?: StringId[];
5484
+ customFields?: { [key: string]: any };
5485
+ teams?: StringId[];
5486
+ allow_media_upload?: "optional" | "required" | "hidden";
5487
+ allow_signature?: "optional" | "required" | "hidden";
5488
+ header?: string;
5489
+ footer?: string;
5490
+ accepted_custom_fields?: StringId[];
5491
+ accepted_system_fields?: Accepted_system_fields[];
5492
+ header_logo?: string;
5493
+ footer_logo?: string;
5494
+ website?: string;
5495
+ cover_photo?: StringId;
5496
+ activate_formV2_portal: boolean;
5497
+ activate_sales_order_portal: boolean;
5498
+ activate_workorder_request_portal: boolean;
5499
+ formV2?: StringId[];
5500
+ product_groups?: StringId[];
5501
+ geoPoint?: GeoPoint;
5502
+ location_name?: string;
5503
+ social_media_platforms?: {
5504
+ platform: StringId;
5505
+ handle?: string;
5506
+ url?: string;
5507
+ account_type: string;
5508
+ }[];
5509
+ }
5510
+ export interface UpdateBody {
5511
+ name?: string;
5512
+ description?: string;
5513
+ default_priority_human?: Default_Priority_human;
5514
+ default_priority?: Default_Priority;
5515
+ default_workorder_categories?: StringId[];
5516
+ teams?: StringId[];
5517
+ allow_media_upload?: "optional" | "required" | "hidden";
5518
+ allow_signature?: "optional" | "required" | "hidden";
5519
+ header?: string;
5520
+ footer?: string;
5521
+ accepted_custom_fields?: StringId[];
5522
+ accepted_system_fields?: Accepted_system_fields[];
5523
+ header_logo?: string;
5524
+ footer_logo?: string;
5525
+ editor?: AdminOrRep;
5526
+ website?: string;
5527
+ cover_photo?: StringId;
5528
+ activate_formV2_portal?: boolean;
5529
+ activate_sales_order_portal?: boolean;
5530
+ activate_workorder_request_portal?: boolean;
5531
+ formV2?: StringId[];
5532
+ product_groups?: StringId[];
5533
+ geoPoint?: GeoPoint;
5534
+ location_name?: string;
5535
+ social_media_platforms?: {
5536
+ platform: StringId;
5537
+ handle: string;
5538
+ url: string;
5539
+ account_type: string;
5540
+ }[];
5541
+ }
5542
+ export interface PopulatedDoc {
5543
+ creator: AdminOrRep;
5544
+ name: string;
5545
+ description?: string;
5546
+ default_priority_human?: Default_Priority_human;
5547
+ default_priority?: Default_Priority;
5548
+ default_workorder_categories?: StringId[];
5549
+ default_workorder_categories_populated?: WorkorderCategoryPopulated[];
5550
+ teams?: string[];
5551
+ company_namespace: string[];
5552
+ allow_media_upload: "optional" | "required" | "hidden";
5553
+ allow_signature: "optional" | "required" | "hidden";
5554
+ header?: string;
5555
+ footer?: string;
5556
+ accepted_custom_fields?: string[];
5557
+ accepted_custom_fields_populated?: {
5558
+ [key: string]: string | number | boolean;
5559
+ }[];
5560
+ accepted_system_fields: Accepted_system_fields[];
5561
+ header_logo?: string;
5562
+ header_logo_populated?: PopulatedMediaStorage[];
5563
+ footer_logo?: string;
5564
+ footer_logo_populated?: PopulatedMediaStorage[];
5565
+ createdAt?: Date;
5566
+ updatedAt?: Date;
5567
+ editor?: AdminOrRep;
5568
+ _id: StringId;
5569
+ disabled: boolean;
5570
+ website?: string;
5571
+ cover_photo?: StringId;
5572
+ activate_formV2_portal: boolean;
5573
+ activate_sales_order_portal: boolean;
5574
+ activate_workorder_request_portal: boolean;
5575
+ formV2?: StringId[];
5576
+ formV2_populated?: FormPopulated[];
5577
+ product_groups?: Pick<
5578
+ ProductGroup.ProductGroupSchema,
5579
+ "_id" | "name" | "local_name"
5580
+ >[];
5581
+ geoPoint?: GeoPoint;
5582
+ location_name?: string;
5583
+ social_media_platforms?: {
5584
+ platform: StringId;
5585
+ handle?: string;
5586
+ url?: string;
5587
+ account_type: string;
5588
+ }[];
5589
+ }
5590
+
5591
+ type SortingKeys = "default_priority" | "updatedAt" | "createdAt";
5592
+ type PopulatedKeys =
5593
+ | "default_workorder_categories"
5594
+ | "header_logo"
5595
+ | "footer_logo"
5596
+ | "accepted_custom_fields"
5597
+ | "formV2"
5598
+ | "product_groups";
5599
+
5600
+ export namespace Find {
5601
+ export type Params = DefaultPaginationQueryParams & {
5602
+ _id?: StringId | StringId[];
5603
+ name?: string | string[];
5604
+ default_priority?: Default_Priority | Default_Priority[];
5605
+ default_priority_human?:
5606
+ | Default_Priority_human
5607
+ | Default_Priority_human[];
5608
+ default_workorder_categories?: StringId | StringId[];
5609
+ formV2?: StringId | StringId[];
5610
+ product_groups?: StringId | StringId[];
5611
+ activate_formV2_portal?: boolean;
5612
+ activate_sales_order_portal?: boolean;
5613
+ activate_workorder_request_portal?: boolean;
5614
+ from_updatedAt?: number;
5615
+ to_updatedAt?: number;
5616
+ disabled?: boolean;
5617
+ search?: string;
5618
+ populatedKeys?: PopulatedKeys | PopulatedKeys[];
5619
+ sortBy?: { field: SortingKeys; type: "asc" | "desc" }[];
5620
+ };
5621
+ export interface Result extends DefaultPaginationResult {
5622
+ data: Data[] | PopulatedDoc[];
5623
+ }
5624
+ }
5625
+ export namespace Get {
5626
+ export type ID = string;
5627
+ export interface Params {
5628
+ populatedKeys?: PopulatedKeys[];
5629
+ }
5630
+ export type Result = Data | PopulatedDoc;
5631
+ }
5632
+ export namespace Create {
5633
+ export type Body = CreateBody;
5634
+ export type Result = Data;
5635
+ }
5636
+ export namespace Update {
5637
+ export type ID = string;
5638
+ export type Body = UpdateBody;
5639
+ export type Result = Data;
5640
+ }
5641
+ export namespace Remove {
5642
+ export type ID = string;
5643
+ export type Result = Data;
5644
+ }
5645
+ }
5646
+
5429
5647
  export namespace QuickConvertToPdf {
5430
5648
  export interface QuickConvertToPdfSchema {
5431
5649
  _id?: string;
@@ -7768,6 +7986,155 @@ export namespace Service {
7768
7986
  }
7769
7987
  }
7770
7988
 
7989
+ export namespace Approval {
7990
+ export interface Data {
7991
+ _id: StringId;
7992
+ creator: AdminCreator;
7993
+ name: string;
7994
+ disabled: boolean;
7995
+ company_namespace: string[];
7996
+ type:
7997
+ | "proforma"
7998
+ | "transfer"
7999
+ | "approval-request"
8000
+ | "receiving-material"
8001
+ | "asset-part-transfer"
8002
+ | "adjust-inventory"
8003
+ | "return-asset-part-unit"
8004
+ | "store-asset-part-unit";
8005
+ position?: number;
8006
+ description?: string;
8007
+ rules: {
8008
+ index: number;
8009
+ name: string;
8010
+ permissions: { can_edit: boolean };
8011
+ admins: { _id: StringId; name?: string; type: "admin" }[];
8012
+ reps: { _id: StringId; name?: string; type: "rep" }[];
8013
+ append_creator?: boolean;
8014
+ append_assigned_origin_warehouse_rep?: boolean;
8015
+ append_assigned_destination_warehouse_rep?: boolean;
8016
+ send_email?: boolean;
8017
+ }[];
8018
+ filters?: {
8019
+ key: string;
8020
+ operator: "eq" | "ne" | "in" | "nin" | "gt" | "gte" | "lt" | "lte";
8021
+ value: any[];
8022
+ manipulator_function?: string;
8023
+ }[];
8024
+ createdAt: Date;
8025
+ updatedAt: Date;
8026
+ __v: number;
8027
+ }
8028
+
8029
+ export interface CreateBody {
8030
+ name: string;
8031
+ type:
8032
+ | "proforma"
8033
+ | "transfer"
8034
+ | "approval-request"
8035
+ | "receiving-material"
8036
+ | "asset-part-transfer"
8037
+ | "adjust-inventory"
8038
+ | "return-asset-part-unit"
8039
+ | "store-asset-part-unit";
8040
+ creator?: AdminCreator;
8041
+ disabled?: boolean;
8042
+ company_namespace?: string[];
8043
+ position?: number;
8044
+ description?: string;
8045
+ rules: {
8046
+ index: number;
8047
+ name: string;
8048
+ permissions?: { can_edit: boolean };
8049
+ admins?: { _id: StringId; name?: string; type: "admin" }[];
8050
+ reps?: { _id: StringId; name?: string; type: "rep" }[];
8051
+ append_creator?: boolean;
8052
+ append_assigned_origin_warehouse_rep?: boolean;
8053
+ append_assigned_destination_warehouse_rep?: boolean;
8054
+ send_email?: boolean;
8055
+ }[];
8056
+ filters?: {
8057
+ key: string;
8058
+ operator: "eq" | "ne" | "in" | "nin" | "gt" | "gte" | "lt" | "lte";
8059
+ value: any[];
8060
+ manipulator_function?: string;
8061
+ }[];
8062
+ }
8063
+ export interface UpdateBody {
8064
+ _id?: StringId;
8065
+ creator?: AdminCreator;
8066
+ name?: string;
8067
+ disabled?: boolean;
8068
+ company_namespace?: string[];
8069
+ type?:
8070
+ | "proforma"
8071
+ | "transfer"
8072
+ | "approval-request"
8073
+ | "receiving-material"
8074
+ | "asset-part-transfer"
8075
+ | "adjust-inventory"
8076
+ | "return-asset-part-unit"
8077
+ | "store-asset-part-unit";
8078
+ position?: number;
8079
+ description?: string;
8080
+ rules?: {
8081
+ index: number;
8082
+ name: string;
8083
+ permissions?: { can_edit: boolean };
8084
+ admins?: { _id: StringId; name?: string; type: "admin" }[];
8085
+ reps?: { _id: StringId; name?: string; type: "rep" }[];
8086
+ append_creator?: boolean;
8087
+ append_assigned_origin_warehouse_rep?: boolean;
8088
+ append_assigned_destination_warehouse_rep?: boolean;
8089
+ send_email?: boolean;
8090
+ }[];
8091
+ filters?: {
8092
+ key: string;
8093
+ operator: "eq" | "ne" | "in" | "nin" | "gt" | "gte" | "lt" | "lte";
8094
+ value: any[];
8095
+ manipulator_function?: string;
8096
+ }[];
8097
+ createdAt?: Date;
8098
+ updatedAt?: Date;
8099
+ __v?: number;
8100
+ }
8101
+
8102
+ export namespace Find {
8103
+ export type Params = DefaultPaginationQueryParams & {
8104
+ _id?: StringId[] | StringId;
8105
+ search?: string;
8106
+ name?: string[] | string;
8107
+ disabled?: boolean;
8108
+ sortBy?: {
8109
+ field: "_id" | "position" | "updatedAt";
8110
+ type: "asc" | "desc";
8111
+ }[];
8112
+ [key: string]: any; // integration_meta.
8113
+ };
8114
+ export interface Result extends DefaultPaginationResult {
8115
+ data: Data[];
8116
+ }
8117
+ }
8118
+ export namespace Get {
8119
+ export type ID = string;
8120
+ export type Params = { [key: string]: any };
8121
+ export type Result = Data;
8122
+ }
8123
+ export namespace Create {
8124
+ export type Body = CreateBody;
8125
+ export type Result = Data;
8126
+ }
8127
+ export namespace Update {
8128
+ export type ID = string;
8129
+ export type Body = UpdateBody;
8130
+ export type Result = Data;
8131
+ }
8132
+ export namespace Remove {
8133
+ export type ID = string;
8134
+ export type Result = Data;
8135
+ }
8136
+ }
8137
+
7771
8138
  export namespace Cycle {
7772
8139
  type CycleStatus = "pending" | "approved" | "processing" | "rejected";
7773
8140
  export interface Schema {
@@ -12233,7 +12600,9 @@ export namespace Service {
12233
12600
  createdAt: Date;
12234
12601
  updatedAt: Date;
12235
12602
  }
12236
-
12603
+ export type PopulatedDoc = Data & {
12604
+ cycle?: Cycle.Schema & { approval?: string | Approval.Data };
12605
+ };
12237
12606
  export interface CreateBody {
12238
12607
  document_id?: StringId;
12239
12608
  document_type: "client" | "visit";
@@ -12427,10 +12796,12 @@ export namespace Service {
12427
12796
  "meta.business_day": string | string[];
12428
12797
  "meta.form._id": StringId | StringId[];
12429
12798
  sortBy?: { field: "_id"; type: "asc" | "desc" }[];
12799
+ withCycle?: boolean;
12800
+ populatedKeys?: ["approval"];
12430
12801
  [key: string]: any; // integration_meta.
12431
12802
  };
12432
12803
  export interface Result extends DefaultPaginationResult {
12433
- data: Data[];
12804
+ data: Data[] | PopulatedDoc[];
12434
12805
  }
12435
12806
  }
12436
12807
  export namespace Get {
@@ -12440,10 +12811,11 @@ export namespace Service {
12440
12811
  validityCheck?: boolean;
12441
12812
  originalDoc_populatedKeys?: PopulatedKeys[];
12442
12813
  withOriginalDoc?: boolean;
12814
+ populatedKeys?: ["approval"];
12443
12815
  [key: string]: any; // integration_meta.
12444
12816
  };
12445
12817
  export type Result = Data & {
12446
- cycle?: Cycle.Schema;
12818
+ cycle?: Cycle.Schema & { approval?: string | Approval.Data };
12447
12819
  original_doc?: Client.ClientSchema | Visit.VisitSchema;
12448
12820
  };
12449
12821
  }