repzo 1.0.29 → 1.0.31
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/lib/index.d.ts +333 -652
- package/lib/index.js +978 -1475
- package/lib/types/index.d.ts +4879 -4882
- package/package.json +1 -1
- package/src/index.ts +42 -0
- package/src/types/index.ts +343 -1
- package/test.ts +8 -0
- package/test.js +0 -11
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1259,6 +1259,7 @@ export default class Repzo {
|
|
|
1259
1259
|
);
|
|
1260
1260
|
},
|
|
1261
1261
|
};
|
|
1262
|
+
|
|
1262
1263
|
quickConvertToPdf = {
|
|
1263
1264
|
_path: "/quick-convert-to-pdf",
|
|
1264
1265
|
find: async (
|
|
@@ -1301,6 +1302,47 @@ export default class Repzo {
|
|
|
1301
1302
|
return res;
|
|
1302
1303
|
},
|
|
1303
1304
|
};
|
|
1305
|
+
visit = {
|
|
1306
|
+
_path: "/visit",
|
|
1307
|
+
find: async (
|
|
1308
|
+
params?: Service.Visit.Find.Params
|
|
1309
|
+
): Promise<Service.Visit.Find.Result> => {
|
|
1310
|
+
let res: Service.Visit.Find.Result = await this._fetch(
|
|
1311
|
+
this.svAPIEndpoint,
|
|
1312
|
+
this.visit._path,
|
|
1313
|
+
params
|
|
1314
|
+
);
|
|
1315
|
+
return res;
|
|
1316
|
+
},
|
|
1317
|
+
get: async (
|
|
1318
|
+
id: Service.Visit.Get.ID,
|
|
1319
|
+
params?: Service.Visit.Get.Params
|
|
1320
|
+
): Promise<Service.Visit.Get.Result> => {
|
|
1321
|
+
return await this._fetch(
|
|
1322
|
+
this.svAPIEndpoint,
|
|
1323
|
+
this.visit._path + `/${id}`,
|
|
1324
|
+
params
|
|
1325
|
+
);
|
|
1326
|
+
},
|
|
1327
|
+
create: async (
|
|
1328
|
+
body: Service.Visit.Create.Body
|
|
1329
|
+
): Promise<Service.Visit.Create.Result> => {
|
|
1330
|
+
let res = await this._create(this.svAPIEndpoint, this.visit._path, body);
|
|
1331
|
+
return res;
|
|
1332
|
+
},
|
|
1333
|
+
|
|
1334
|
+
update: async (
|
|
1335
|
+
id: Service.Visit.Update.ID,
|
|
1336
|
+
body: Service.Visit.Update.Body
|
|
1337
|
+
): Promise<Service.Visit.Update.Result> => {
|
|
1338
|
+
let res: Service.Visit.Update.Result = await this._update(
|
|
1339
|
+
this.svAPIEndpoint,
|
|
1340
|
+
this.visit._path + `/${id}`,
|
|
1341
|
+
body
|
|
1342
|
+
);
|
|
1343
|
+
return res;
|
|
1344
|
+
},
|
|
1345
|
+
};
|
|
1304
1346
|
invoice = {
|
|
1305
1347
|
_path: "/fullinvoices",
|
|
1306
1348
|
find: async (
|
package/src/types/index.ts
CHANGED
|
@@ -16,6 +16,14 @@ export interface Headers {
|
|
|
16
16
|
[key: string]: string;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
interface ActivityComment {
|
|
20
|
+
time: number;
|
|
21
|
+
user_name: string;
|
|
22
|
+
user_id: string;
|
|
23
|
+
user_type: string;
|
|
24
|
+
comment: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
19
27
|
interface AdminCreator {
|
|
20
28
|
_id: string;
|
|
21
29
|
type: "admin";
|
|
@@ -90,6 +98,15 @@ interface ClientLocationPopulated {
|
|
|
90
98
|
interface FormPopulated {
|
|
91
99
|
name: string;
|
|
92
100
|
}
|
|
101
|
+
interface VisitMeta {
|
|
102
|
+
geo_fence_setting_visit_start: boolean;
|
|
103
|
+
geo_fence_setting_visit_end: boolean;
|
|
104
|
+
geo_fence_setting_radius: number;
|
|
105
|
+
offline_mode: boolean;
|
|
106
|
+
start_visit_in_fence: boolean;
|
|
107
|
+
end_visit_in_fence: boolean;
|
|
108
|
+
client_verified: boolean;
|
|
109
|
+
}
|
|
93
110
|
interface thumbnailStoragePopulated {
|
|
94
111
|
_id: string;
|
|
95
112
|
createdAt: string;
|
|
@@ -113,6 +130,7 @@ interface thumbnailStoragePopulated {
|
|
|
113
130
|
| " images"
|
|
114
131
|
| "zip";
|
|
115
132
|
}
|
|
133
|
+
|
|
116
134
|
interface MediaPopulated {
|
|
117
135
|
_id: string;
|
|
118
136
|
media_type:
|
|
@@ -300,7 +318,7 @@ export type DocumentTypes =
|
|
|
300
318
|
| "retailExecutionPreset"
|
|
301
319
|
| "paymentMethod"
|
|
302
320
|
| "approvalRequest";
|
|
303
|
-
export type PrintTypes =
|
|
321
|
+
export type PrintTypes = "workorder" | "form" | "invoice" | "proforma";
|
|
304
322
|
|
|
305
323
|
export interface MediaDoc {
|
|
306
324
|
_id?: string;
|
|
@@ -342,6 +360,12 @@ export interface MediaDoc {
|
|
|
342
360
|
region: string;
|
|
343
361
|
time: number;
|
|
344
362
|
}
|
|
363
|
+
|
|
364
|
+
export interface GeoTag {
|
|
365
|
+
lat: number;
|
|
366
|
+
lng: number;
|
|
367
|
+
formatted_address: string;
|
|
368
|
+
}
|
|
345
369
|
// <reference path = "vehicle.ts" />
|
|
346
370
|
export namespace Service {
|
|
347
371
|
export namespace Client {
|
|
@@ -2708,6 +2732,324 @@ export namespace Service {
|
|
|
2708
2732
|
}
|
|
2709
2733
|
}
|
|
2710
2734
|
|
|
2735
|
+
export namespace Visit {
|
|
2736
|
+
export interface VisitSchema {
|
|
2737
|
+
geoPoint: {
|
|
2738
|
+
type: "Point";
|
|
2739
|
+
coordinates: number[];
|
|
2740
|
+
};
|
|
2741
|
+
start_geo_tag: GeoTag;
|
|
2742
|
+
end_geo_tag: GeoTag;
|
|
2743
|
+
route: string;
|
|
2744
|
+
time: number;
|
|
2745
|
+
user: Rep.RepSchema;
|
|
2746
|
+
tags: Tag.TagBody[];
|
|
2747
|
+
client: string;
|
|
2748
|
+
client_name: string;
|
|
2749
|
+
client_location_verified?: boolean;
|
|
2750
|
+
user_name?: string;
|
|
2751
|
+
visit_id: string;
|
|
2752
|
+
sync_id?: string;
|
|
2753
|
+
start_time: number;
|
|
2754
|
+
end_time: number;
|
|
2755
|
+
business_day_rep?: string;
|
|
2756
|
+
business_day: string;
|
|
2757
|
+
call_start_time?: number;
|
|
2758
|
+
call_end_time?: number;
|
|
2759
|
+
call_total_time?: number;
|
|
2760
|
+
total_time: number;
|
|
2761
|
+
platform: string;
|
|
2762
|
+
version_name: string;
|
|
2763
|
+
battery_level: number;
|
|
2764
|
+
device_brand?: string;
|
|
2765
|
+
device_os?: string;
|
|
2766
|
+
device_os_version?: string;
|
|
2767
|
+
device_model?: string;
|
|
2768
|
+
time_zone?: string;
|
|
2769
|
+
identifier?: number;
|
|
2770
|
+
device_id?: string;
|
|
2771
|
+
device_unique_id?: string;
|
|
2772
|
+
type?: string;
|
|
2773
|
+
notes?: string[];
|
|
2774
|
+
photos?: string[];
|
|
2775
|
+
forms?: string[];
|
|
2776
|
+
teams?: string[];
|
|
2777
|
+
tasks?: string[];
|
|
2778
|
+
audits?: string[];
|
|
2779
|
+
network_state?: number;
|
|
2780
|
+
distance?: number;
|
|
2781
|
+
start_distance?: number;
|
|
2782
|
+
end_distance?: number;
|
|
2783
|
+
delta_distance?: number;
|
|
2784
|
+
start_out_of_geofence?: boolean;
|
|
2785
|
+
end_out_of_geofence?: boolean;
|
|
2786
|
+
start_accuracy?: number;
|
|
2787
|
+
end_accuracy?: number;
|
|
2788
|
+
closed_by_system?: boolean;
|
|
2789
|
+
meta: VisitMeta;
|
|
2790
|
+
lines?: string[];
|
|
2791
|
+
client_geo_location: {
|
|
2792
|
+
type: {
|
|
2793
|
+
lat: Number;
|
|
2794
|
+
lng: Number;
|
|
2795
|
+
};
|
|
2796
|
+
};
|
|
2797
|
+
geofencing_radius?: number;
|
|
2798
|
+
availability?: string[];
|
|
2799
|
+
selected_product_lines: Line.LineSchema[];
|
|
2800
|
+
workorder: Workorder.WorkorderSchema;
|
|
2801
|
+
asset?: string;
|
|
2802
|
+
asset_unit?: string;
|
|
2803
|
+
auto_closed_by_geofence?: boolean;
|
|
2804
|
+
auto_closed_by_geofence_reason:
|
|
2805
|
+
| "out_of_geofence"
|
|
2806
|
+
| "low_accuracy"
|
|
2807
|
+
| "location_turned_off";
|
|
2808
|
+
company_namespace: string[];
|
|
2809
|
+
}
|
|
2810
|
+
export interface CreateBody {
|
|
2811
|
+
geoPoint: {
|
|
2812
|
+
type: "Point";
|
|
2813
|
+
coordinates: number[];
|
|
2814
|
+
};
|
|
2815
|
+
start_geo_tag: GeoTag;
|
|
2816
|
+
route: string;
|
|
2817
|
+
time: number;
|
|
2818
|
+
user: Rep.RepSchema;
|
|
2819
|
+
tags: Tag.TagBody[];
|
|
2820
|
+
client: string;
|
|
2821
|
+
client_name: string;
|
|
2822
|
+
client_location_verified?: boolean;
|
|
2823
|
+
user_name?: string;
|
|
2824
|
+
visit_id: string;
|
|
2825
|
+
sync_id?: string;
|
|
2826
|
+
start_time: number;
|
|
2827
|
+
business_day_rep?: string;
|
|
2828
|
+
business_day: string;
|
|
2829
|
+
platform: string;
|
|
2830
|
+
version_name: string;
|
|
2831
|
+
battery_level: number;
|
|
2832
|
+
device_brand?: string;
|
|
2833
|
+
device_os?: string;
|
|
2834
|
+
device_os_version?: string;
|
|
2835
|
+
device_model?: string;
|
|
2836
|
+
time_zone?: string;
|
|
2837
|
+
identifier?: number;
|
|
2838
|
+
device_id?: string;
|
|
2839
|
+
device_unique_id?: string;
|
|
2840
|
+
type?: string;
|
|
2841
|
+
network_state?: number;
|
|
2842
|
+
distance?: number;
|
|
2843
|
+
start_distance?: number;
|
|
2844
|
+
start_accuracy?: number;
|
|
2845
|
+
meta: VisitMeta;
|
|
2846
|
+
lines?: string[];
|
|
2847
|
+
client_geo_location: {
|
|
2848
|
+
type: {
|
|
2849
|
+
lat: Number;
|
|
2850
|
+
lng: Number;
|
|
2851
|
+
};
|
|
2852
|
+
};
|
|
2853
|
+
geofencing_radius?: number;
|
|
2854
|
+
availability?: string[];
|
|
2855
|
+
workorder: Workorder.WorkorderSchema;
|
|
2856
|
+
asset?: string;
|
|
2857
|
+
asset_unit?: string;
|
|
2858
|
+
company_namespace: string[];
|
|
2859
|
+
}
|
|
2860
|
+
export interface UpdateBody {
|
|
2861
|
+
geoPoint?: {
|
|
2862
|
+
type: "Point";
|
|
2863
|
+
coordinates: number[];
|
|
2864
|
+
};
|
|
2865
|
+
end_geo_tag?: GeoTag;
|
|
2866
|
+
route?: string;
|
|
2867
|
+
time?: number;
|
|
2868
|
+
user?: Rep.RepSchema;
|
|
2869
|
+
tags?: Tag.TagBody[];
|
|
2870
|
+
client?: string;
|
|
2871
|
+
client_name?: string;
|
|
2872
|
+
client_location_verified?: boolean;
|
|
2873
|
+
user_name?: string;
|
|
2874
|
+
visit_id?: string;
|
|
2875
|
+
sync_id?: string;
|
|
2876
|
+
end_time?: number;
|
|
2877
|
+
business_day_rep?: string;
|
|
2878
|
+
business_day?: string;
|
|
2879
|
+
call_start_time?: number;
|
|
2880
|
+
call_end_time?: number;
|
|
2881
|
+
call_total_time?: number;
|
|
2882
|
+
total_time?: number;
|
|
2883
|
+
platform?: string;
|
|
2884
|
+
version_name?: string;
|
|
2885
|
+
battery_level?: number;
|
|
2886
|
+
device_brand?: string;
|
|
2887
|
+
device_os?: string;
|
|
2888
|
+
device_os_version?: string;
|
|
2889
|
+
device_model?: string;
|
|
2890
|
+
time_zone?: string;
|
|
2891
|
+
identifier?: number;
|
|
2892
|
+
device_id?: string;
|
|
2893
|
+
device_unique_id?: string;
|
|
2894
|
+
type?: string;
|
|
2895
|
+
notes?: string[];
|
|
2896
|
+
photos?: string[];
|
|
2897
|
+
forms?: string[];
|
|
2898
|
+
teams?: string[];
|
|
2899
|
+
tasks?: string[];
|
|
2900
|
+
audits?: string[];
|
|
2901
|
+
network_state?: number;
|
|
2902
|
+
distance?: number;
|
|
2903
|
+
end_distance?: number;
|
|
2904
|
+
delta_distance?: number;
|
|
2905
|
+
end_out_of_geofence?: boolean;
|
|
2906
|
+
end_accuracy?: number;
|
|
2907
|
+
closed_by_system?: boolean;
|
|
2908
|
+
meta: VisitMeta;
|
|
2909
|
+
lines?: string[];
|
|
2910
|
+
client_geo_location?: {
|
|
2911
|
+
type: {
|
|
2912
|
+
lat: Number;
|
|
2913
|
+
lng: Number;
|
|
2914
|
+
};
|
|
2915
|
+
};
|
|
2916
|
+
geofencing_radius?: number;
|
|
2917
|
+
availability?: string[];
|
|
2918
|
+
selected_product_lines?: Line.LineSchema[];
|
|
2919
|
+
workorder?: Workorder.WorkorderSchema;
|
|
2920
|
+
asset?: string;
|
|
2921
|
+
asset_unit?: string;
|
|
2922
|
+
auto_closed_by_geofence?: boolean;
|
|
2923
|
+
auto_closed_by_geofence_reason?:
|
|
2924
|
+
| "out_of_geofence"
|
|
2925
|
+
| "low_accuracy"
|
|
2926
|
+
| "location_turned_off";
|
|
2927
|
+
company_namespace: string[];
|
|
2928
|
+
}
|
|
2929
|
+
type VisitSchemaWithPopulatedKeys = {
|
|
2930
|
+
notes: {
|
|
2931
|
+
content: string;
|
|
2932
|
+
geo_tag: GeoTag;
|
|
2933
|
+
time: number;
|
|
2934
|
+
platform: string;
|
|
2935
|
+
version_name: string;
|
|
2936
|
+
battery_level: number;
|
|
2937
|
+
comments: ActivityComment[];
|
|
2938
|
+
};
|
|
2939
|
+
tasks: {
|
|
2940
|
+
start_photo: string;
|
|
2941
|
+
end_photo: string;
|
|
2942
|
+
start_media: MediaDoc;
|
|
2943
|
+
end_media: MediaDoc;
|
|
2944
|
+
geo_tag: GeoTag;
|
|
2945
|
+
time: number;
|
|
2946
|
+
platform: string;
|
|
2947
|
+
version_name: string;
|
|
2948
|
+
battery_level: number;
|
|
2949
|
+
start_time: number;
|
|
2950
|
+
end_time: number;
|
|
2951
|
+
total_time: number;
|
|
2952
|
+
comments: ActivityComment[];
|
|
2953
|
+
};
|
|
2954
|
+
photos: {
|
|
2955
|
+
photo: string;
|
|
2956
|
+
media: MediaDoc;
|
|
2957
|
+
geo_tag: GeoTag;
|
|
2958
|
+
caption: string;
|
|
2959
|
+
time: number;
|
|
2960
|
+
platform: string;
|
|
2961
|
+
version_name: string;
|
|
2962
|
+
battery_level: number;
|
|
2963
|
+
comments: ActivityComment[];
|
|
2964
|
+
};
|
|
2965
|
+
forms: {
|
|
2966
|
+
results: { [key: string]: any };
|
|
2967
|
+
form_id: string;
|
|
2968
|
+
geo_tag: GeoTag;
|
|
2969
|
+
time: number;
|
|
2970
|
+
platform: string;
|
|
2971
|
+
version_name: string;
|
|
2972
|
+
battery_level: number;
|
|
2973
|
+
comments: ActivityComment[];
|
|
2974
|
+
};
|
|
2975
|
+
audits: {
|
|
2976
|
+
audits: {
|
|
2977
|
+
inventories: {
|
|
2978
|
+
media: MediaDoc;
|
|
2979
|
+
};
|
|
2980
|
+
};
|
|
2981
|
+
geo_tag: GeoTag;
|
|
2982
|
+
time: number;
|
|
2983
|
+
platform: string;
|
|
2984
|
+
version_name: string;
|
|
2985
|
+
battery_level: number;
|
|
2986
|
+
comments: ActivityComment[];
|
|
2987
|
+
};
|
|
2988
|
+
availability: {
|
|
2989
|
+
products_available: {
|
|
2990
|
+
product_id: Pick<Product.ProductSchema, "_id">;
|
|
2991
|
+
available: boolean;
|
|
2992
|
+
};
|
|
2993
|
+
media: MediaDoc;
|
|
2994
|
+
geo_tag: GeoTag;
|
|
2995
|
+
time: number;
|
|
2996
|
+
platform: string;
|
|
2997
|
+
version_name: string;
|
|
2998
|
+
battery_level: number;
|
|
2999
|
+
comment: ActivityComment[];
|
|
3000
|
+
};
|
|
3001
|
+
tags: string | Tag.TagSchema;
|
|
3002
|
+
};
|
|
3003
|
+
export namespace Find {
|
|
3004
|
+
export type Params = DefaultPaginationQueryParams & {
|
|
3005
|
+
user?: string;
|
|
3006
|
+
from_time?: number;
|
|
3007
|
+
to_time?: number;
|
|
3008
|
+
client?: string;
|
|
3009
|
+
route?: string;
|
|
3010
|
+
teams?: string[];
|
|
3011
|
+
company_namespace?: string;
|
|
3012
|
+
tags?: string[];
|
|
3013
|
+
CLIENT_TAGS?: string[];
|
|
3014
|
+
AREA_TAGS?: string;
|
|
3015
|
+
availability?: string[];
|
|
3016
|
+
visit_id?: string;
|
|
3017
|
+
from_total_time?: number;
|
|
3018
|
+
to_total_time?: number;
|
|
3019
|
+
closed_by_system?: boolean;
|
|
3020
|
+
};
|
|
3021
|
+
export interface Result extends DefaultPaginationResult {
|
|
3022
|
+
data: VisitSchema[];
|
|
3023
|
+
absolute_total: number;
|
|
3024
|
+
page_total: number;
|
|
3025
|
+
}
|
|
3026
|
+
}
|
|
3027
|
+
type PopulatedKeys =
|
|
3028
|
+
| "notes"
|
|
3029
|
+
| "tasks"
|
|
3030
|
+
| "photos"
|
|
3031
|
+
| "forms"
|
|
3032
|
+
| "audits"
|
|
3033
|
+
| "tags"
|
|
3034
|
+
| "availability";
|
|
3035
|
+
export namespace Create {
|
|
3036
|
+
export type Body = CreateBody;
|
|
3037
|
+
export type Result = VisitSchema;
|
|
3038
|
+
}
|
|
3039
|
+
export namespace Get {
|
|
3040
|
+
export type ID = string;
|
|
3041
|
+
export interface Params {
|
|
3042
|
+
populatedKeys?: PopulatedKeys[];
|
|
3043
|
+
}
|
|
3044
|
+
export type Result = VisitSchemaWithPopulatedKeys;
|
|
3045
|
+
}
|
|
3046
|
+
export namespace Update {
|
|
3047
|
+
export type ID = string;
|
|
3048
|
+
export type Body = UpdateBody;
|
|
3049
|
+
export type Result = VisitSchema;
|
|
3050
|
+
}
|
|
3051
|
+
}
|
|
3052
|
+
|
|
2711
3053
|
export namespace Workorder {
|
|
2712
3054
|
export interface WorkorderSchema {
|
|
2713
3055
|
_id: string;
|
package/test.ts
ADDED
package/test.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import Repzo from "./lib/index.js";
|
|
2
|
-
// import Repzo from "repzo"
|
|
3
|
-
let repzo = new Repzo("qOIWZDYSjObf5W1Pti3efUM1D6S9vaqk8I_GoxOLnas");
|
|
4
|
-
let workorders = await repzo.workorder.get("63832c86180e66bcde05a49c")
|
|
5
|
-
console.log(workorders);
|
|
6
|
-
// let clients = repzo.client.find({ search: "Mecca" });
|
|
7
|
-
// console.log(clients);
|
|
8
|
-
// repzo.client.create({ name: "kf" });
|
|
9
|
-
// repzo.headers["ho"] = "faf";
|
|
10
|
-
// repzo.client.update("", {});
|
|
11
|
-
// repzo.
|