repzo 1.0.115 → 1.0.117

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
@@ -7,6 +7,7 @@
7
7
  - add: asset-part-type, asset-part, asset-part-unit, asset-part-transfer, asset-part-receival, return-asset-part-unit & store-asset-part-unit @maramalshen
8
8
  - update adjustInventory @maramalshen
9
9
  - update FullInvoice with ubl keys @maramalshen
10
+ - add: approval-request @maramalshen
10
11
 
11
12
  ### Changed
12
13
 
package/lib/index.d.ts CHANGED
@@ -85,6 +85,7 @@ export default class Repzo {
85
85
  readonly OCR_INVOICE_JOB_PAGE: "ocr-invoice-job-page";
86
86
  readonly SETTINGS: "settings";
87
87
  readonly MAIL_UNSUBSCRIBE: "mail-unsubscribe";
88
+ readonly APPROVAL_REQUEST: "approval-request";
88
89
  };
89
90
  private _fetch;
90
91
  private _create;
@@ -1316,4 +1317,25 @@ export default class Repzo {
1316
1317
  params: Service.MailUnsubsrcibe.Create.Params
1317
1318
  ) => Promise<Service.MailUnsubsrcibe.Create.Result>;
1318
1319
  };
1320
+ approvalRequest: {
1321
+ _path: "approval-request";
1322
+ find: (
1323
+ params?: Service.ApprovalRequest.Find.Params
1324
+ ) => Promise<Service.ApprovalRequest.Find.Result>;
1325
+ get: (
1326
+ id: Service.ApprovalRequest.Get.ID,
1327
+ params?: Service.ApprovalRequest.Get.Params
1328
+ ) => Promise<Service.ApprovalRequest.Get.Result>;
1329
+ create: (
1330
+ body: Service.ApprovalRequest.Create.Body
1331
+ ) => Promise<Service.ApprovalRequest.Create.Result>;
1332
+ update: (
1333
+ id: Service.ApprovalRequest.Update.ID,
1334
+ body: Service.ApprovalRequest.Update.Body
1335
+ ) => Promise<Service.ApprovalRequest.Update.Result>;
1336
+ remove: (
1337
+ id: Service.ApprovalRequest.Update.ID,
1338
+ params: Service.ApprovalRequest.Remove.Params
1339
+ ) => Promise<Service.ApprovalRequest.Remove.Result>;
1340
+ };
1319
1341
  }
package/lib/index.js CHANGED
@@ -74,6 +74,7 @@ export default class Repzo {
74
74
  OCR_INVOICE_JOB_PAGE: "ocr-invoice-job-page",
75
75
  SETTINGS: "settings",
76
76
  MAIL_UNSUBSCRIBE: "mail-unsubscribe",
77
+ APPROVAL_REQUEST: "approval-request",
77
78
  };
78
79
  this.END_POINTS = this._end_points;
79
80
  this.client = {
@@ -2424,6 +2425,48 @@ export default class Repzo {
2424
2425
  return res;
2425
2426
  },
2426
2427
  };
2428
+ this.approvalRequest = {
2429
+ _path: this._end_points.APPROVAL_REQUEST,
2430
+ find: async (params) => {
2431
+ let res = await this._fetch(
2432
+ this.svAPIEndpoint,
2433
+ this.approvalRequest._path,
2434
+ params
2435
+ );
2436
+ return res;
2437
+ },
2438
+ get: async (id, params) => {
2439
+ return await this._fetch(
2440
+ this.svAPIEndpoint,
2441
+ this.approvalRequest._path + `/${id}`,
2442
+ params
2443
+ );
2444
+ },
2445
+ create: async (body) => {
2446
+ let res = await this._create(
2447
+ this.svAPIEndpoint,
2448
+ this.approvalRequest._path,
2449
+ body
2450
+ );
2451
+ return res;
2452
+ },
2453
+ update: async (id, body) => {
2454
+ let res = await this._update(
2455
+ this.svAPIEndpoint,
2456
+ this.approvalRequest._path + `/${id}`,
2457
+ body
2458
+ );
2459
+ return res;
2460
+ },
2461
+ remove: async (id, params) => {
2462
+ let res = await this._delete(
2463
+ this.svAPIEndpoint,
2464
+ this.approvalRequest._path + `/${id}`,
2465
+ params
2466
+ );
2467
+ return res;
2468
+ },
2469
+ };
2427
2470
  this.svAPIEndpoint =
2428
2471
  !options?.env || options?.env == "production"
2429
2472
  ? "https://sv.api.repzo.me"
@@ -387,7 +387,7 @@ export interface GeoTag {
387
387
  }
388
388
  interface GeoPoint {
389
389
  type: "Point";
390
- coordinates: number[];
390
+ coordinates: [number, number];
391
391
  }
392
392
  export declare namespace Service {
393
393
  namespace Client {
@@ -437,7 +437,7 @@ export declare namespace Service {
437
437
  phone?: string;
438
438
  state?: string;
439
439
  zip?: string;
440
- assigned_to?: string[];
440
+ assigned_to: string[];
441
441
  last_location_update?: number;
442
442
  credit_limit?: number;
443
443
  tax_number?: string;
@@ -489,7 +489,7 @@ export declare namespace Service {
489
489
  updatedAt: string;
490
490
  __v: number;
491
491
  }
492
- interface ClientBody {
492
+ export interface CreateBody {
493
493
  name?: string;
494
494
  local_name?: string;
495
495
  tags?: string[];
@@ -557,7 +557,7 @@ export declare namespace Service {
557
557
  is_simplified?: boolean;
558
558
  last_login_time?: number;
559
559
  }
560
- type PopulatedKeys =
560
+ export type PopulatedKeys =
561
561
  | "tags"
562
562
  | "reps"
563
563
  | "assigned_to"
@@ -649,14 +649,14 @@ export declare namespace Service {
649
649
  type Result = ClientSchemaWithPopulatedKeys;
650
650
  }
651
651
  export namespace Create {
652
- interface Body extends ClientBody {
652
+ interface Body extends CreateBody {
653
653
  name: string;
654
654
  }
655
655
  type Result = ClientSchema;
656
656
  }
657
657
  export namespace Update {
658
658
  type ID = string;
659
- interface Body extends ClientBody {
659
+ interface Body extends CreateBody {
660
660
  _id?: string;
661
661
  createdAt?: string;
662
662
  updatedAt?: string;
@@ -4746,7 +4746,7 @@ export declare namespace Service {
4746
4746
  client?: string | Client.ClientSchema;
4747
4747
  route?: string | Route.RouteSchema;
4748
4748
  };
4749
- type PopulatedKeys =
4749
+ export type PopulatedKeys =
4750
4750
  | "notes"
4751
4751
  | "tasks"
4752
4752
  | "photos"
@@ -6175,7 +6175,7 @@ export declare namespace Service {
6175
6175
  client_id: string;
6176
6176
  client_name: string;
6177
6177
  comment?: string;
6178
- creator: AdminCreator | RepCreator | ClientCreator;
6178
+ creator: AdminOrRepOrTenant | ClientCreator;
6179
6179
  implemented_by?: AdminCreator | RepCreator;
6180
6180
  latest: boolean;
6181
6181
  version?: number;
@@ -6391,7 +6391,7 @@ export declare namespace Service {
6391
6391
  client_id?: string;
6392
6392
  client_name?: string;
6393
6393
  comment?: string;
6394
- creator?: AdminCreator | RepCreator | ClientCreator;
6394
+ creator?: AdminOrRepOrTenant | ClientCreator;
6395
6395
  implemented_by?: AdminCreator | RepCreator;
6396
6396
  latest?: boolean;
6397
6397
  version?: number;
@@ -12391,6 +12391,334 @@ export declare namespace Service {
12391
12391
  };
12392
12392
  }
12393
12393
  }
12394
+ namespace ApprovalRequest {
12395
+ export interface Data {
12396
+ _id: StringId;
12397
+ app_code: string;
12398
+ document_id?: StringId;
12399
+ document_type: "client" | "visit";
12400
+ sync_id: string;
12401
+ method?: "create" | "update" | "delete" | "patch";
12402
+ visit_id?: string;
12403
+ type:
12404
+ | "skip_job_at_visit_end"
12405
+ | "end_visit_out_of_geofence"
12406
+ | "skip_visit_from_route"
12407
+ | "create_client"
12408
+ | "update_client"
12409
+ | "delete_client";
12410
+ subtype?:
12411
+ | "client_details"
12412
+ | "client_assigned_to"
12413
+ | "client_location"
12414
+ | "client_credit_limit";
12415
+ implementation_type:
12416
+ | "create_doc"
12417
+ | "update_doc"
12418
+ | "delete_doc"
12419
+ | "no_implementation";
12420
+ creator: AdminOrRepOrTenant;
12421
+ editor?: AdminOrRepOrTenant;
12422
+ status: "pending" | "approved" | "processing" | "rejected";
12423
+ implementation_status: "pending" | "failed" | "success";
12424
+ implementation_error?: any;
12425
+ teams?: StringId[];
12426
+ payload: {
12427
+ body?: {
12428
+ type:
12429
+ | "skip_job_at_visit_end"
12430
+ | "end_visit_out_of_geofence"
12431
+ | "skip_visit_from_route"
12432
+ | "create_client"
12433
+ | "update_client"
12434
+ | "delete_client";
12435
+ [key: string]: any;
12436
+ } & Client.CreateBody;
12437
+ writeQuery?: {
12438
+ key: string;
12439
+ command: "set" | "addToSet" | "pull";
12440
+ value: any;
12441
+ }[];
12442
+ };
12443
+ meta?: {
12444
+ form?: {
12445
+ _id: StringId;
12446
+ name: string;
12447
+ };
12448
+ business_day?: string;
12449
+ client?: StringId;
12450
+ route?: StringId;
12451
+ [ket: string]: any;
12452
+ };
12453
+ history?: {
12454
+ editor?: AdminOrRepOrTenant;
12455
+ status: "pending" | "approved" | "processing" | "rejected";
12456
+ diff: {
12457
+ [key: string]: any;
12458
+ };
12459
+ createdAt: Date;
12460
+ updatedAt: Date;
12461
+ }[];
12462
+ comment?: string;
12463
+ media?: StringId[];
12464
+ time: number;
12465
+ geoPoint?: GeoPoint;
12466
+ accuracy?: number;
12467
+ serial_number: SerialNumber;
12468
+ disabled: boolean;
12469
+ approved_time?: number;
12470
+ rejected_time?: number;
12471
+ processing_time?: number;
12472
+ pending_time?: number;
12473
+ reference_name?: string;
12474
+ reference_local_name?: string;
12475
+ last_approved_approval_request?: StringId;
12476
+ last_approved_approval_request_serial_number?: SerialNumber;
12477
+ last_approved_approval_request_createdAt?: Date;
12478
+ company_namespace: string[];
12479
+ createdAt: Date;
12480
+ updatedAt: Date;
12481
+ }
12482
+ export interface CreateBody {
12483
+ document_id?: StringId;
12484
+ document_type: "client" | "visit";
12485
+ sync_id: string;
12486
+ method?: "create" | "update" | "delete" | "patch";
12487
+ visit_id?: string;
12488
+ type:
12489
+ | "skip_job_at_visit_end"
12490
+ | "end_visit_out_of_geofence"
12491
+ | "skip_visit_from_route"
12492
+ | "create_client"
12493
+ | "update_client"
12494
+ | "delete_client";
12495
+ subtype?:
12496
+ | "client_details"
12497
+ | "client_assigned_to"
12498
+ | "client_location"
12499
+ | "client_credit_limit";
12500
+ implementation_type:
12501
+ | "create_doc"
12502
+ | "update_doc"
12503
+ | "delete_doc"
12504
+ | "no_implementation";
12505
+ creator?: AdminOrRepOrTenant;
12506
+ status?: "pending";
12507
+ implementation_status?: "pending";
12508
+ teams?: StringId[];
12509
+ payload?: {
12510
+ body?: {
12511
+ type:
12512
+ | "skip_job_at_visit_end"
12513
+ | "end_visit_out_of_geofence"
12514
+ | "skip_visit_from_route"
12515
+ | "create_client"
12516
+ | "update_client"
12517
+ | "delete_client";
12518
+ [key: string]: any;
12519
+ } & Client.CreateBody;
12520
+ writeQuery?: {
12521
+ key: string;
12522
+ command: "set" | "addToSet" | "pull";
12523
+ value: any;
12524
+ }[];
12525
+ };
12526
+ meta?: {
12527
+ form?: {
12528
+ _id: StringId;
12529
+ name: string;
12530
+ };
12531
+ business_day?: string;
12532
+ client?: StringId;
12533
+ route?: StringId;
12534
+ [ket: string]: any;
12535
+ };
12536
+ history?: {
12537
+ editor?: AdminOrRepOrTenant;
12538
+ status: "pending" | "approved" | "processing" | "rejected";
12539
+ diff: {
12540
+ [key: string]: any;
12541
+ };
12542
+ createdAt: Date;
12543
+ updatedAt: Date;
12544
+ }[];
12545
+ comment?: string;
12546
+ media?: StringId[];
12547
+ time?: number;
12548
+ geoPoint?: GeoPoint;
12549
+ accuracy?: number;
12550
+ serial_number?: SerialNumber;
12551
+ disabled?: boolean;
12552
+ pending_time?: number;
12553
+ reference_name?: string;
12554
+ reference_local_name?: string;
12555
+ last_approved_approval_request?: StringId;
12556
+ last_approved_approval_request_serial_number?: SerialNumber;
12557
+ last_approved_approval_request_createdAt?: Date;
12558
+ company_namespace: string[];
12559
+ }
12560
+ export interface UpdateBody {
12561
+ _id?: StringId;
12562
+ app_code?: string;
12563
+ document_id?: StringId;
12564
+ document_type?: "client" | "visit";
12565
+ sync_id?: string;
12566
+ method?: "create" | "update" | "delete" | "patch";
12567
+ visit_id?: string;
12568
+ type?:
12569
+ | "skip_job_at_visit_end"
12570
+ | "end_visit_out_of_geofence"
12571
+ | "skip_visit_from_route"
12572
+ | "create_client"
12573
+ | "update_client"
12574
+ | "delete_client";
12575
+ subtype?:
12576
+ | "client_details"
12577
+ | "client_assigned_to"
12578
+ | "client_location"
12579
+ | "client_credit_limit";
12580
+ implementation_type?:
12581
+ | "create_doc"
12582
+ | "update_doc"
12583
+ | "delete_doc"
12584
+ | "no_implementation";
12585
+ creator?: AdminOrRepOrTenant;
12586
+ editor?: AdminOrRepOrTenant;
12587
+ teams?: StringId[];
12588
+ status: "pending" | "approved" | "processing" | "rejected";
12589
+ implementation_status?: "pending" | "failed" | "success";
12590
+ implementation_error?: any;
12591
+ payload?: {
12592
+ body?: {
12593
+ type:
12594
+ | "skip_job_at_visit_end"
12595
+ | "end_visit_out_of_geofence"
12596
+ | "skip_visit_from_route"
12597
+ | "create_client"
12598
+ | "update_client"
12599
+ | "delete_client";
12600
+ [key: string]: any;
12601
+ } & Client.CreateBody;
12602
+ writeQuery?: {
12603
+ key: string;
12604
+ command: "set" | "addToSet" | "pull";
12605
+ value: any;
12606
+ }[];
12607
+ };
12608
+ meta?: {
12609
+ form?: {
12610
+ _id: StringId;
12611
+ name: string;
12612
+ };
12613
+ business_day?: string;
12614
+ client?: StringId;
12615
+ route?: StringId;
12616
+ [ket: string]: any;
12617
+ };
12618
+ history?: {
12619
+ editor?: AdminOrRepOrTenant;
12620
+ status: "pending" | "approved" | "processing" | "rejected";
12621
+ diff: {
12622
+ [key: string]: any;
12623
+ };
12624
+ createdAt: Date;
12625
+ updatedAt: Date;
12626
+ }[];
12627
+ comment?: string;
12628
+ media?: StringId[];
12629
+ time?: number;
12630
+ geoPoint?: GeoPoint;
12631
+ accuracy?: number;
12632
+ serial_number?: SerialNumber;
12633
+ disabled?: boolean;
12634
+ approved_time?: number;
12635
+ rejected_time?: number;
12636
+ processing_time?: number;
12637
+ pending_time?: number;
12638
+ reference_name?: string;
12639
+ reference_local_name?: string;
12640
+ last_approved_approval_request?: StringId;
12641
+ last_approved_approval_request_serial_number?: SerialNumber;
12642
+ last_approved_approval_request_createdAt?: Date;
12643
+ company_namespace?: string[];
12644
+ createdAt?: Date;
12645
+ updatedAt?: Date;
12646
+ }
12647
+ type PopulatedKeys = Client.PopulatedKeys | Visit.PopulatedKeys;
12648
+ export namespace Find {
12649
+ type Params = DefaultPaginationQueryParams & {
12650
+ nodeCycles?: StringId[] | StringId;
12651
+ _id?: StringId[] | StringId;
12652
+ search?: string;
12653
+ serial_number?: string[] | string;
12654
+ "serial_number.formatted"?: string[] | string;
12655
+ sync_id?: string[] | string;
12656
+ creator?: StringId[] | StringId;
12657
+ "creator._id"?: StringId[] | StringId;
12658
+ "creator.type"?: string | string[];
12659
+ type?: Data["type"][] | Data["type"];
12660
+ subtype?: Data["subtype"][] | Data["subtype"];
12661
+ document_type?: Data["document_type"][] | Data["document_type"];
12662
+ document_id?: StringId | StringId[];
12663
+ implementation_type?:
12664
+ | Data["implementation_type"][]
12665
+ | Data["implementation_type"];
12666
+ implementation_status?:
12667
+ | Data["implementation_status"][]
12668
+ | Data["implementation_status"];
12669
+ teams?: StringId[] | StringId;
12670
+ status?: Data["status"][] | Data["status"];
12671
+ from_time?: number;
12672
+ to_time?: number;
12673
+ from_createdAt?: number;
12674
+ to_createdAt?: number;
12675
+ from_updatedAt?: number;
12676
+ to_updatedAt?: number;
12677
+ visit_id?: string | string[];
12678
+ "meta.client": StringId | StringId[];
12679
+ "meta.route": StringId | StringId[];
12680
+ "meta.business_day": string | string[];
12681
+ "meta.form._id": StringId | StringId[];
12682
+ sortBy?: {
12683
+ field: "_id";
12684
+ type: "asc" | "desc";
12685
+ }[];
12686
+ [key: string]: any;
12687
+ };
12688
+ interface Result extends DefaultPaginationResult {
12689
+ data: Data[];
12690
+ }
12691
+ }
12692
+ export namespace Get {
12693
+ type ID = StringId;
12694
+ type Params = {
12695
+ withCycle?: boolean;
12696
+ validityCheck?: boolean;
12697
+ originalDoc_populatedKeys?: PopulatedKeys[];
12698
+ withOriginalDoc?: boolean;
12699
+ [key: string]: any;
12700
+ };
12701
+ type Result = Data & {
12702
+ cycle?: Cycle.Schema;
12703
+ original_doc?: Client.ClientSchema | Visit.VisitSchema;
12704
+ };
12705
+ }
12706
+ export namespace Create {
12707
+ type Body = CreateBody;
12708
+ type Result = Data;
12709
+ }
12710
+ export namespace Update {
12711
+ type ID = StringId;
12712
+ type Body = UpdateBody;
12713
+ type Result = Data;
12714
+ }
12715
+ export namespace Remove {
12716
+ type ID = string;
12717
+ type Params = {};
12718
+ type Result = Data;
12719
+ }
12720
+ export {};
12721
+ }
12394
12722
  }
12395
12723
  export type StringId = string;
12396
12724
  export type NameSpaces = string[];
@@ -12401,6 +12729,14 @@ export interface AdminOrRep {
12401
12729
  admin?: StringId;
12402
12730
  rep?: StringId;
12403
12731
  }
12732
+ export interface AdminOrRepOrTenant {
12733
+ _id: StringId;
12734
+ type: "admin" | "rep" | "tenant";
12735
+ name?: string;
12736
+ admin?: StringId;
12737
+ rep?: StringId;
12738
+ tenant?: StringId;
12739
+ }
12404
12740
  interface ValidityCheck {
12405
12741
  valid: boolean;
12406
12742
  reasons: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repzo",
3
- "version": "1.0.115",
3
+ "version": "1.0.117",
4
4
  "description": "Repzo TypeScript SDK",
5
5
  "main": "./lib/index.js",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -109,6 +109,7 @@ export default class Repzo {
109
109
  OCR_INVOICE_JOB_PAGE: "ocr-invoice-job-page",
110
110
  SETTINGS: "settings",
111
111
  MAIL_UNSUBSCRIBE: "mail-unsubscribe",
112
+ APPROVAL_REQUEST: "approval-request",
112
113
  } as const;
113
114
  public END_POINTS = this._end_points;
114
115
  private async _fetch(baseUrl: string, path: string, params?: Params) {
@@ -3741,6 +3742,62 @@ export default class Repzo {
3741
3742
  return res;
3742
3743
  },
3743
3744
  };
3745
+
3746
+ approvalRequest = {
3747
+ _path: this._end_points.APPROVAL_REQUEST,
3748
+ find: async (
3749
+ params?: Service.ApprovalRequest.Find.Params
3750
+ ): Promise<Service.ApprovalRequest.Find.Result> => {
3751
+ let res: Service.ApprovalRequest.Find.Result = await this._fetch(
3752
+ this.svAPIEndpoint,
3753
+ this.approvalRequest._path,
3754
+ params
3755
+ );
3756
+ return res;
3757
+ },
3758
+ get: async (
3759
+ id: Service.ApprovalRequest.Get.ID,
3760
+ params?: Service.ApprovalRequest.Get.Params
3761
+ ): Promise<Service.ApprovalRequest.Get.Result> => {
3762
+ return await this._fetch(
3763
+ this.svAPIEndpoint,
3764
+ this.approvalRequest._path + `/${id}`,
3765
+ params
3766
+ );
3767
+ },
3768
+ create: async (
3769
+ body: Service.ApprovalRequest.Create.Body
3770
+ ): Promise<Service.ApprovalRequest.Create.Result> => {
3771
+ let res = await this._create(
3772
+ this.svAPIEndpoint,
3773
+ this.approvalRequest._path,
3774
+ body
3775
+ );
3776
+ return res;
3777
+ },
3778
+ update: async (
3779
+ id: Service.ApprovalRequest.Update.ID,
3780
+ body: Service.ApprovalRequest.Update.Body
3781
+ ): Promise<Service.ApprovalRequest.Update.Result> => {
3782
+ let res: Service.ApprovalRequest.Update.Result = await this._update(
3783
+ this.svAPIEndpoint,
3784
+ this.approvalRequest._path + `/${id}`,
3785
+ body
3786
+ );
3787
+ return res;
3788
+ },
3789
+ remove: async (
3790
+ id: Service.ApprovalRequest.Update.ID,
3791
+ params: Service.ApprovalRequest.Remove.Params
3792
+ ): Promise<Service.ApprovalRequest.Remove.Result> => {
3793
+ let res: Service.ApprovalRequest.Remove.Result = await this._delete(
3794
+ this.svAPIEndpoint,
3795
+ this.approvalRequest._path + `/${id}`,
3796
+ params
3797
+ );
3798
+ return res;
3799
+ },
3800
+ };
3744
3801
  }
3745
3802
 
3746
3803
  function normalizeParams(params: Params): { [key: string]: any } {
@@ -392,7 +392,7 @@ export interface GeoTag {
392
392
  }
393
393
  interface GeoPoint {
394
394
  type: "Point";
395
- coordinates: number[];
395
+ coordinates: [number, number];
396
396
  }
397
397
 
398
398
  // <reference path = "vehicle.ts" />
@@ -444,7 +444,7 @@ export namespace Service {
444
444
  phone?: string;
445
445
  state?: string;
446
446
  zip?: string;
447
- assigned_to?: string[];
447
+ assigned_to: string[];
448
448
  last_location_update?: number;
449
449
  credit_limit?: number;
450
450
  tax_number?: string;
@@ -492,7 +492,7 @@ export namespace Service {
492
492
  updatedAt: string;
493
493
  __v: number;
494
494
  }
495
- interface ClientBody {
495
+ export interface CreateBody {
496
496
  name?: string;
497
497
  local_name?: string;
498
498
  tags?: string[];
@@ -556,7 +556,7 @@ export namespace Service {
556
556
  is_simplified?: boolean;
557
557
  last_login_time?: number;
558
558
  }
559
- type PopulatedKeys =
559
+ export type PopulatedKeys =
560
560
  | "tags"
561
561
  | "reps"
562
562
  | "assigned_to"
@@ -652,7 +652,7 @@ export namespace Service {
652
652
  }
653
653
 
654
654
  export namespace Create {
655
- export interface Body extends ClientBody {
655
+ export interface Body extends CreateBody {
656
656
  name: string;
657
657
  }
658
658
  export type Result = ClientSchema;
@@ -660,7 +660,7 @@ export namespace Service {
660
660
 
661
661
  export namespace Update {
662
662
  export type ID = string;
663
- export interface Body extends ClientBody {
663
+ export interface Body extends CreateBody {
664
664
  _id?: string;
665
665
  createdAt?: string;
666
666
  updatedAt?: string;
@@ -4781,7 +4781,7 @@ export namespace Service {
4781
4781
  client?: string | Client.ClientSchema;
4782
4782
  route?: string | Route.RouteSchema;
4783
4783
  };
4784
- type PopulatedKeys =
4784
+ export type PopulatedKeys =
4785
4785
  | "notes"
4786
4786
  | "tasks"
4787
4787
  | "photos"
@@ -6124,7 +6124,7 @@ export namespace Service {
6124
6124
  client_id: string;
6125
6125
  client_name: string;
6126
6126
  comment?: string;
6127
- creator: AdminCreator | RepCreator | ClientCreator;
6127
+ creator: AdminOrRepOrTenant | ClientCreator;
6128
6128
  implemented_by?: AdminCreator | RepCreator;
6129
6129
  latest: boolean;
6130
6130
  version?: number;
@@ -6324,7 +6324,7 @@ export namespace Service {
6324
6324
  client_id?: string;
6325
6325
  client_name?: string;
6326
6326
  comment?: string;
6327
- creator?: AdminCreator | RepCreator | ClientCreator;
6327
+ creator?: AdminOrRepOrTenant | ClientCreator;
6328
6328
  implemented_by?: AdminCreator | RepCreator;
6329
6329
  latest?: boolean;
6330
6330
  version?: number;
@@ -11943,6 +11943,319 @@ export namespace Service {
11943
11943
  export type Result = { message: string; success: boolean };
11944
11944
  }
11945
11945
  }
11946
+
11947
+ export namespace ApprovalRequest {
11948
+ export interface Data {
11949
+ _id: StringId;
11950
+ app_code: string;
11951
+ document_id?: StringId;
11952
+ document_type: "client" | "visit";
11953
+ sync_id: string;
11954
+ method?: "create" | "update" | "delete" | "patch";
11955
+ visit_id?: string;
11956
+ type:
11957
+ | "skip_job_at_visit_end"
11958
+ | "end_visit_out_of_geofence"
11959
+ | "skip_visit_from_route"
11960
+ | "create_client"
11961
+ | "update_client"
11962
+ | "delete_client";
11963
+ subtype?:
11964
+ | "client_details"
11965
+ | "client_assigned_to"
11966
+ | "client_location"
11967
+ | "client_credit_limit";
11968
+ implementation_type:
11969
+ | "create_doc"
11970
+ | "update_doc"
11971
+ | "delete_doc"
11972
+ | "no_implementation";
11973
+ creator: AdminOrRepOrTenant;
11974
+ editor?: AdminOrRepOrTenant;
11975
+ status: "pending" | "approved" | "processing" | "rejected";
11976
+ implementation_status: "pending" | "failed" | "success";
11977
+ implementation_error?: any;
11978
+ teams?: StringId[];
11979
+ payload: {
11980
+ body?: {
11981
+ type:
11982
+ | "skip_job_at_visit_end"
11983
+ | "end_visit_out_of_geofence"
11984
+ | "skip_visit_from_route"
11985
+ | "create_client"
11986
+ | "update_client"
11987
+ | "delete_client";
11988
+ [key: string]: any;
11989
+ } & Client.CreateBody;
11990
+ writeQuery?: {
11991
+ key: string;
11992
+ command: "set" | "addToSet" | "pull";
11993
+ value: any;
11994
+ }[];
11995
+ };
11996
+ meta?: {
11997
+ form?: { _id: StringId; name: string };
11998
+ business_day?: string;
11999
+ client?: StringId;
12000
+ route?: StringId;
12001
+ [ket: string]: any;
12002
+ };
12003
+ history?: {
12004
+ editor?: AdminOrRepOrTenant;
12005
+ status: "pending" | "approved" | "processing" | "rejected";
12006
+ diff: { [key: string]: any };
12007
+ createdAt: Date;
12008
+ updatedAt: Date;
12009
+ }[];
12010
+ comment?: string;
12011
+ media?: StringId[];
12012
+ time: number;
12013
+ geoPoint?: GeoPoint;
12014
+ accuracy?: number;
12015
+ serial_number: SerialNumber;
12016
+ disabled: boolean;
12017
+ approved_time?: number;
12018
+ rejected_time?: number;
12019
+ processing_time?: number;
12020
+ pending_time?: number;
12021
+ reference_name?: string;
12022
+ reference_local_name?: string;
12023
+ last_approved_approval_request?: StringId;
12024
+ last_approved_approval_request_serial_number?: SerialNumber;
12025
+ last_approved_approval_request_createdAt?: Date;
12026
+ company_namespace: string[];
12027
+ createdAt: Date;
12028
+ updatedAt: Date;
12029
+ }
12030
+
12031
+ export interface CreateBody {
12032
+ document_id?: StringId;
12033
+ document_type: "client" | "visit";
12034
+ sync_id: string;
12035
+ method?: "create" | "update" | "delete" | "patch";
12036
+ visit_id?: string;
12037
+ type:
12038
+ | "skip_job_at_visit_end"
12039
+ | "end_visit_out_of_geofence"
12040
+ | "skip_visit_from_route"
12041
+ | "create_client"
12042
+ | "update_client"
12043
+ | "delete_client";
12044
+ subtype?:
12045
+ | "client_details"
12046
+ | "client_assigned_to"
12047
+ | "client_location"
12048
+ | "client_credit_limit";
12049
+ implementation_type:
12050
+ | "create_doc"
12051
+ | "update_doc"
12052
+ | "delete_doc"
12053
+ | "no_implementation";
12054
+ creator?: AdminOrRepOrTenant;
12055
+ status?: "pending";
12056
+ implementation_status?: "pending";
12057
+ teams?: StringId[];
12058
+ payload?: {
12059
+ body?: {
12060
+ type:
12061
+ | "skip_job_at_visit_end"
12062
+ | "end_visit_out_of_geofence"
12063
+ | "skip_visit_from_route"
12064
+ | "create_client"
12065
+ | "update_client"
12066
+ | "delete_client";
12067
+ [key: string]: any;
12068
+ } & Client.CreateBody;
12069
+ writeQuery?: {
12070
+ key: string;
12071
+ command: "set" | "addToSet" | "pull";
12072
+ value: any;
12073
+ }[];
12074
+ };
12075
+ meta?: {
12076
+ form?: { _id: StringId; name: string };
12077
+ business_day?: string;
12078
+ client?: StringId;
12079
+ route?: StringId;
12080
+ [ket: string]: any;
12081
+ };
12082
+ history?: {
12083
+ editor?: AdminOrRepOrTenant;
12084
+ status: "pending" | "approved" | "processing" | "rejected";
12085
+ diff: { [key: string]: any };
12086
+ createdAt: Date;
12087
+ updatedAt: Date;
12088
+ }[];
12089
+ comment?: string;
12090
+ media?: StringId[];
12091
+ time?: number;
12092
+ geoPoint?: GeoPoint;
12093
+ accuracy?: number;
12094
+ serial_number?: SerialNumber;
12095
+ disabled?: boolean;
12096
+ pending_time?: number;
12097
+ reference_name?: string;
12098
+ reference_local_name?: string;
12099
+ last_approved_approval_request?: StringId;
12100
+ last_approved_approval_request_serial_number?: SerialNumber;
12101
+ last_approved_approval_request_createdAt?: Date;
12102
+ company_namespace: string[];
12103
+ }
12104
+ export interface UpdateBody {
12105
+ _id?: StringId;
12106
+ app_code?: string;
12107
+ document_id?: StringId;
12108
+ document_type?: "client" | "visit";
12109
+ sync_id?: string;
12110
+ method?: "create" | "update" | "delete" | "patch";
12111
+ visit_id?: string;
12112
+ type?:
12113
+ | "skip_job_at_visit_end"
12114
+ | "end_visit_out_of_geofence"
12115
+ | "skip_visit_from_route"
12116
+ | "create_client"
12117
+ | "update_client"
12118
+ | "delete_client";
12119
+ subtype?:
12120
+ | "client_details"
12121
+ | "client_assigned_to"
12122
+ | "client_location"
12123
+ | "client_credit_limit";
12124
+ implementation_type?:
12125
+ | "create_doc"
12126
+ | "update_doc"
12127
+ | "delete_doc"
12128
+ | "no_implementation";
12129
+ creator?: AdminOrRepOrTenant;
12130
+ editor?: AdminOrRepOrTenant;
12131
+ teams?: StringId[];
12132
+ status: "pending" | "approved" | "processing" | "rejected";
12133
+ implementation_status?: "pending" | "failed" | "success";
12134
+ implementation_error?: any;
12135
+ payload?: {
12136
+ body?: {
12137
+ type:
12138
+ | "skip_job_at_visit_end"
12139
+ | "end_visit_out_of_geofence"
12140
+ | "skip_visit_from_route"
12141
+ | "create_client"
12142
+ | "update_client"
12143
+ | "delete_client";
12144
+ [key: string]: any;
12145
+ } & Client.CreateBody;
12146
+ writeQuery?: {
12147
+ key: string;
12148
+ command: "set" | "addToSet" | "pull";
12149
+ value: any;
12150
+ }[];
12151
+ };
12152
+ meta?: {
12153
+ form?: { _id: StringId; name: string };
12154
+ business_day?: string;
12155
+ client?: StringId;
12156
+ route?: StringId;
12157
+ [ket: string]: any;
12158
+ };
12159
+ history?: {
12160
+ editor?: AdminOrRepOrTenant;
12161
+ status: "pending" | "approved" | "processing" | "rejected";
12162
+ diff: { [key: string]: any };
12163
+ createdAt: Date;
12164
+ updatedAt: Date;
12165
+ }[];
12166
+ comment?: string;
12167
+ media?: StringId[];
12168
+ time?: number;
12169
+ geoPoint?: GeoPoint;
12170
+ accuracy?: number;
12171
+ serial_number?: SerialNumber;
12172
+ disabled?: boolean;
12173
+ approved_time?: number;
12174
+ rejected_time?: number;
12175
+ processing_time?: number;
12176
+ pending_time?: number;
12177
+ reference_name?: string;
12178
+ reference_local_name?: string;
12179
+ last_approved_approval_request?: StringId;
12180
+ last_approved_approval_request_serial_number?: SerialNumber;
12181
+ last_approved_approval_request_createdAt?: Date;
12182
+ company_namespace?: string[];
12183
+ createdAt?: Date;
12184
+ updatedAt?: Date;
12185
+ }
12186
+ type PopulatedKeys = Client.PopulatedKeys | Visit.PopulatedKeys;
12187
+
12188
+ export namespace Find {
12189
+ export type Params = DefaultPaginationQueryParams & {
12190
+ nodeCycles?: StringId[] | StringId;
12191
+ _id?: StringId[] | StringId;
12192
+ search?: string; // serial_number.formatted
12193
+ serial_number?: string[] | string;
12194
+ "serial_number.formatted"?: string[] | string;
12195
+ sync_id?: string[] | string;
12196
+ creator?: StringId[] | StringId;
12197
+ // creator_type?: Data["creator"]["type"] | Data["creator"]["type"][];
12198
+ "creator._id"?: StringId[] | StringId;
12199
+ "creator.type"?: string | string[];
12200
+ type?: Data["type"][] | Data["type"];
12201
+ subtype?: Data["subtype"][] | Data["subtype"];
12202
+ document_type?: Data["document_type"][] | Data["document_type"];
12203
+ document_id?: StringId | StringId[];
12204
+ implementation_type?:
12205
+ | Data["implementation_type"][]
12206
+ | Data["implementation_type"];
12207
+ implementation_status?:
12208
+ | Data["implementation_status"][]
12209
+ | Data["implementation_status"];
12210
+ teams?: StringId[] | StringId;
12211
+ status?: Data["status"][] | Data["status"];
12212
+ from_time?: number;
12213
+ to_time?: number;
12214
+ from_createdAt?: number;
12215
+ to_createdAt?: number;
12216
+ from_updatedAt?: number;
12217
+ to_updatedAt?: number;
12218
+ visit_id?: string | string[];
12219
+ "meta.client": StringId | StringId[];
12220
+ "meta.route": StringId | StringId[];
12221
+ "meta.business_day": string | string[];
12222
+ "meta.form._id": StringId | StringId[];
12223
+ sortBy?: { field: "_id"; type: "asc" | "desc" }[];
12224
+ [key: string]: any; // integration_meta.
12225
+ };
12226
+ export interface Result extends DefaultPaginationResult {
12227
+ data: Data[];
12228
+ }
12229
+ }
12230
+ export namespace Get {
12231
+ export type ID = StringId;
12232
+ export type Params = {
12233
+ withCycle?: boolean;
12234
+ validityCheck?: boolean;
12235
+ originalDoc_populatedKeys?: PopulatedKeys[];
12236
+ withOriginalDoc?: boolean;
12237
+ [key: string]: any; // integration_meta.
12238
+ };
12239
+ export type Result = Data & {
12240
+ cycle?: Cycle.Schema;
12241
+ original_doc?: Client.ClientSchema | Visit.VisitSchema;
12242
+ };
12243
+ }
12244
+ export namespace Create {
12245
+ export type Body = CreateBody;
12246
+ export type Result = Data;
12247
+ }
12248
+ export namespace Update {
12249
+ export type ID = StringId;
12250
+ export type Body = UpdateBody;
12251
+ export type Result = Data;
12252
+ }
12253
+ export namespace Remove {
12254
+ export type ID = string;
12255
+ export type Params = {};
12256
+ export type Result = Data;
12257
+ }
12258
+ }
11946
12259
  }
11947
12260
 
11948
12261
  export type StringId = string;
@@ -11954,6 +12267,14 @@ export interface AdminOrRep {
11954
12267
  admin?: StringId;
11955
12268
  rep?: StringId;
11956
12269
  }
12270
+ export interface AdminOrRepOrTenant {
12271
+ _id: StringId;
12272
+ type: "admin" | "rep" | "tenant";
12273
+ name?: string;
12274
+ admin?: StringId;
12275
+ rep?: StringId;
12276
+ tenant?: StringId;
12277
+ }
11957
12278
  interface ValidityCheck {
11958
12279
  valid: boolean;
11959
12280
  reasons: { message: string; code: string }[];