repzo 1.0.24 → 1.0.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repzo",
3
- "version": "1.0.24",
3
+ "version": "1.0.26",
4
4
  "description": "Repzo TypeScript SDK",
5
5
  "main": "./lib/index.js",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -1236,7 +1236,71 @@ export default class Repzo {
1236
1236
  return res;
1237
1237
  },
1238
1238
  };
1239
-
1239
+ workorder = {
1240
+ _path: "/workorder",
1241
+ find: async (
1242
+ params?: Service.Workorder.Find.Params
1243
+ ): Promise<Service.Workorder.Find.Result> => {
1244
+ let res: Service.Workorder.Find.Result = await this._fetch(
1245
+ this.svAPIEndpoint,
1246
+ this.workorder._path,
1247
+ params
1248
+ );
1249
+ return res;
1250
+ },
1251
+ get: async (
1252
+ id: Service.Workorder.Get.ID,
1253
+ params?: Service.Workorder.Get.Params
1254
+ ): Promise<Service.Workorder.Get.Result> => {
1255
+ return await this._fetch(
1256
+ this.svAPIEndpoint,
1257
+ this.workorder._path + `/${id}`,
1258
+ params
1259
+ );
1260
+ },
1261
+ };
1262
+ quickConvertToPdf = {
1263
+ _path: "/quick-convert-to-pdf",
1264
+ find: async (
1265
+ params?: Service.QuickConvertToPdf.Find.Params
1266
+ ): Promise<Service.QuickConvertToPdf.Find.Result> => {
1267
+ let res: Service.QuickConvertToPdf.Find.Result = await this._fetch(
1268
+ this.svAPIEndpoint,
1269
+ this.quickConvertToPdf._path,
1270
+ params
1271
+ );
1272
+ return res;
1273
+ },
1274
+ get: async (
1275
+ id: Service.QuickConvertToPdf.Get.ID,
1276
+ params?: Service.QuickConvertToPdf.Get.Params
1277
+ ): Promise<Service.QuickConvertToPdf.Get.Result> => {
1278
+ return await this._fetch(
1279
+ this.svAPIEndpoint,
1280
+ this.quickConvertToPdf._path + `/${id}`,
1281
+ params
1282
+ );
1283
+ },
1284
+ create: async (
1285
+ body: Service.QuickConvertToPdf.Create.Body
1286
+ ): Promise<Service.QuickConvertToPdf.Create.Result> => {
1287
+ let res = await this._create(
1288
+ this.svAPIEndpoint,
1289
+ this.quickConvertToPdf._path,
1290
+ body
1291
+ );
1292
+ return res;
1293
+ },
1294
+ remove: async (
1295
+ id: Service.QuickConvertToPdf.Remove.ID
1296
+ ): Promise<Service.QuickConvertToPdf.Remove.Result> => {
1297
+ let res: Service.QuickConvertToPdf.Remove.Result = await this._delete(
1298
+ this.svAPIEndpoint,
1299
+ this.quickConvertToPdf._path + `/${id}`
1300
+ );
1301
+ return res;
1302
+ },
1303
+ };
1240
1304
  invoice = {
1241
1305
  _path: "/fullinvoices",
1242
1306
  find: async (
@@ -72,13 +72,82 @@ interface Check {
72
72
  disabled?: boolean;
73
73
  }
74
74
 
75
+ interface AssetUnitsPopulated {
76
+ name: string;
77
+ cover_photo: MediaPopulated;
78
+ }
79
+ interface AssetsPopulated {
80
+ name: string;
81
+ cover_photo: MediaPopulated;
82
+ }
83
+ interface RepresentativesPopulated {
84
+ name: string;
85
+ _id: string;
86
+ }
87
+ interface ClientLocationPopulated {
88
+ name: string;
89
+ }
90
+ interface FormPopulated {
91
+ name: string;
92
+ }
93
+ interface thumbnailStoragePopulated {
94
+ _id: string;
95
+ createdAt: string;
96
+ ContentType: string;
97
+ mime_type: string;
98
+ publicUrl: string;
99
+ type_name: "FileAttachment" | "ImageAttachment";
100
+ file_name: string;
101
+ media_id: string;
102
+ media_type:
103
+ | "csv"
104
+ | "json"
105
+ | "image"
106
+ | "pdf"
107
+ | " ppt"
108
+ | "pptx"
109
+ | "xls"
110
+ | "xlsx"
111
+ | "doc"
112
+ | "docx"
113
+ | " images"
114
+ | "zip";
115
+ }
116
+ interface MediaPopulated {
117
+ _id: string;
118
+ media_type:
119
+ | "csv"
120
+ | "json"
121
+ | "image"
122
+ | "pdf"
123
+ | " ppt"
124
+ | "pptx"
125
+ | "xls"
126
+ | "xlsx"
127
+ | "doc"
128
+ | "docx"
129
+ | " images"
130
+ | "zip";
131
+ mime_type: string;
132
+ publicUrl: string;
133
+ file_name: string;
134
+ type_name: "FileAttachment" | "ImageAttachment";
135
+ media_id: string;
136
+ ContentType: string;
137
+ createdAt: string;
138
+ updatedAt: string;
139
+ thumbnails: thumbnailStoragePopulated;
140
+ }
141
+
75
142
  export interface DefaultPaginationQueryParams {
76
143
  per_page?: number;
77
144
  page?: number;
78
145
  sort?: string;
79
146
  sortPageOrder?: "asc" | "dsc";
80
147
  }
81
-
148
+ interface WorkorderCategoryPopulated {
149
+ name: string;
150
+ }
82
151
  export interface DefaultPaginationResult {
83
152
  total_result: number;
84
153
  current_count: number;
@@ -92,7 +161,187 @@ export interface DefaultPaginationResult {
92
161
  path: string;
93
162
  data: any[];
94
163
  }
95
-
164
+ export interface List {
165
+ client: string | { _id: string };
166
+ note?: string;
167
+ route?: string;
168
+ calendar: string;
169
+ }
170
+ export interface Build {
171
+ day: string;
172
+ list: List[];
173
+ start_date?: number | undefined;
174
+ }
175
+ export type Calendar = CalendarWeekly | CalendarWeeklyGroup;
176
+ export interface Route {
177
+ disabled: boolean;
178
+ list: List[];
179
+ _id: string;
180
+ }
181
+ export type Priority = 0 | 1 | 2 | 3;
182
+ export type WorkorderStatus =
183
+ | "open"
184
+ | "done"
185
+ | "cancelled"
186
+ | "inprogress"
187
+ | "onhold";
188
+
189
+ export type Priority_human = "none" | "low" | "medium" | "high";
190
+ export type Day =
191
+ | "Sun"
192
+ | "Mon"
193
+ | "Tue"
194
+ | "Wed"
195
+ | "Thu"
196
+ | "Fri"
197
+ | "Sat"
198
+ | string;
199
+ export interface WeeklyDetails {
200
+ every: number;
201
+ days: Day[];
202
+ }
203
+ export interface CalendarWeekly {
204
+ type: "weekly";
205
+ disabled: boolean;
206
+ startsAt: string;
207
+ endsAt: string;
208
+ details: WeeklyDetails;
209
+ occurrences: number;
210
+ routes: Route[];
211
+ clients: string[] | string;
212
+ note?: string;
213
+ _id: string;
214
+ }
215
+ export interface DaysGroup {
216
+ days: Day[];
217
+ }
218
+ export interface WeeklyGroupDetails {
219
+ daysGroups: DaysGroup[];
220
+ groupSize: number;
221
+ }
222
+ export interface CalendarWeeklyGroup {
223
+ type: "weeklyGroup";
224
+ disabled: boolean;
225
+ startsAt: string;
226
+ endsAt: string;
227
+ details: WeeklyGroupDetails;
228
+ occurrences: number;
229
+ routes: Route[];
230
+ clients: string[] | string;
231
+ note?: string;
232
+ _id: string;
233
+ }
234
+ export type Model =
235
+ | "quickConvertToPdf"
236
+ | "warehouses"
237
+ | "transfers"
238
+ | "transactions"
239
+ | "taxes"
240
+ | "productvariations"
241
+ | "products"
242
+ | "pricelistsitems"
243
+ | "pricelists"
244
+ | "payments"
245
+ | "ledger_payments"
246
+ | "mslsales"
247
+ | "mslproducts"
248
+ | "measureunits"
249
+ | "measureunitfamilies"
250
+ | "invoicesitems"
251
+ | "invoices"
252
+ | "ledger_goods"
253
+ | "fullinvoices"
254
+ | "checks"
255
+ | "clients"
256
+ | "activities"
257
+ | "bigReports"
258
+ | "admins";
259
+ export type DocumentTypes =
260
+ | "form"
261
+ | "quickConvertToPdf"
262
+ | "clients"
263
+ | "asset"
264
+ | "assetUnit"
265
+ | "workorder"
266
+ | "clientLocation"
267
+ | "clientContact"
268
+ | "commentsThread"
269
+ | "workorderRequest"
270
+ | "workorderPortal"
271
+ | "invoice"
272
+ | "products"
273
+ | "productvariations"
274
+ | "representatives"
275
+ | "productcategories"
276
+ | "productSubCategory"
277
+ | "speciality"
278
+ | "line"
279
+ | "banner"
280
+ | "intgAvailableApps"
281
+ | "availability_msl"
282
+ | "reminders"
283
+ | "audits"
284
+ | "availability"
285
+ | "photos"
286
+ | "planogram"
287
+ | "tasks"
288
+ | "checks"
289
+ | "notificationsCenter"
290
+ | "admins"
291
+ | "settings"
292
+ | "printWorkorderPortalLink"
293
+ | "bulkExport"
294
+ | "generateRule"
295
+ | "scheduleEmail"
296
+ | "custom-list-item"
297
+ | "days"
298
+ | "bulkImport"
299
+ | "sv.activitiesstorechecks"
300
+ | "retailExecutionPreset"
301
+ | "paymentMethod"
302
+ | "approvalRequest";
303
+ export type PrintTypes = DocumentTypes & ("workorder" | "form");
304
+
305
+ export interface MediaDoc {
306
+ _id?: string;
307
+ media_id: string;
308
+ media_type:
309
+ | "csv"
310
+ | "json"
311
+ | "image"
312
+ | "pdf"
313
+ | "ppt"
314
+ | "pptx"
315
+ | "xls"
316
+ | "xlsx"
317
+ | "thumbnail"
318
+ | "doc"
319
+ | "docx"
320
+ | "images";
321
+ mime_type: "image/jpeg" | string;
322
+ ContentType: "image/jpeg" | string;
323
+ file_name: string;
324
+ width: number;
325
+ height: number;
326
+ company_namespace: string[];
327
+ ContentLength?: number;
328
+ ETag?: string;
329
+ Metadata?: {};
330
+ key: string;
331
+ pathSuffix: string;
332
+ pathPrefix: string;
333
+ parentDocumentType?: DocumentTypes;
334
+ parentDocumentId?: string;
335
+ parentDocumentKey?: string;
336
+ publicUrl: string;
337
+ baseUrl: string;
338
+ type_name: "FileAttachment" | "ImageAttachment";
339
+ thumbnails: thumbnailStoragePopulated;
340
+ extension: string;
341
+ bucket_name: string;
342
+ region: string;
343
+ time: number;
344
+ }
96
345
  // <reference path = "vehicle.ts" />
97
346
  export namespace Service {
98
347
  export namespace Client {
@@ -2459,6 +2708,262 @@ export namespace Service {
2459
2708
  }
2460
2709
  }
2461
2710
 
2711
+ export namespace Workorder {
2712
+ export interface WorkorderSchema {
2713
+ _id: string;
2714
+ creator?: AdminCreator | RepCreator | ClientCreator;
2715
+ editor?: AdminCreator | RepCreator | ClientCreator;
2716
+ name?: string;
2717
+ local_name?: string;
2718
+ description?: string;
2719
+ disabled: boolean;
2720
+ integration_meta?: { [key: string]: any };
2721
+ status: WorkorderStatus;
2722
+ assets?: string[];
2723
+ asset_units?: string[];
2724
+ workorder_categories: string[];
2725
+ due_date?: number;
2726
+ start_date?: number;
2727
+ client_location: string;
2728
+ priority?: Priority;
2729
+ priority_human?: Priority_human;
2730
+ client: string;
2731
+ client_name: string;
2732
+ workorder_request?: string;
2733
+ createdAt?: Date;
2734
+ updatedAt?: Date;
2735
+ company_namespace: string[];
2736
+ serial_number?: SerialNumber;
2737
+ assigned_to?: string[];
2738
+ forms?: string[];
2739
+ time: number;
2740
+ is_overdue: boolean;
2741
+ opened_at: number;
2742
+ done_at: number;
2743
+ cancelled_at: number;
2744
+ inprogress_at: number;
2745
+ done_by?: AdminCreator | RepCreator | ClientCreator;
2746
+ cancelled_by?: AdminCreator | RepCreator | ClientCreator;
2747
+ opened_by?: AdminCreator | RepCreator | ClientCreator;
2748
+ inprogress_by?: AdminCreator | RepCreator | ClientCreator;
2749
+ build: Build[];
2750
+ calendars: Calendar[];
2751
+ builtAt: number;
2752
+ due_date_day: string;
2753
+ last_done_at: number;
2754
+ last_done_by: AdminCreator | RepCreator | ClientCreator;
2755
+ resolve_time: number;
2756
+ sync_id: string;
2757
+ startsAt: string;
2758
+ endsAt: string;
2759
+ teams_populated?: Pick<Team.TeamSchema, "name">;
2760
+ client_populated?: Pick<Client.ClientSchema, "client_code" | "name">;
2761
+ asset_units_populated?: AssetUnitsPopulated[];
2762
+ assets_populated?: AssetsPopulated[];
2763
+ assigned_to_populated?: RepresentativesPopulated;
2764
+ client_location_populated?: ClientLocationPopulated;
2765
+ workorder_categories_populated?: WorkorderCategoryPopulated[];
2766
+ forms_populated?: FormPopulated[];
2767
+ media_populated?: MediaPopulated;
2768
+ cover_photo_populated?: MediaPopulated;
2769
+ }
2770
+ interface CreateBody {
2771
+ company_namespace: string[];
2772
+ creator?: AdminCreator | RepCreator | ClientCreator;
2773
+ name: string;
2774
+ local_name?: string;
2775
+ description?: string;
2776
+ disabled?: boolean;
2777
+ integration_meta?: { [key: string]: any };
2778
+ status: WorkorderStatus;
2779
+ assets?: string[];
2780
+ asset_units?: string[];
2781
+ workorder_categories: string[];
2782
+ due_date?: number;
2783
+ start_date?: number;
2784
+ client_location: string;
2785
+ priority?: Priority;
2786
+ priority_human?: Priority_human;
2787
+ client: string;
2788
+ client_name?: string;
2789
+ serial_number?: SerialNumber;
2790
+ workorder_request?: string;
2791
+ assigned_to?: string[];
2792
+ forms?: string[];
2793
+ calendars: Calendar[];
2794
+ parent_repeating_workorder?: string;
2795
+ due_date_day?: string;
2796
+ last_done_at: number;
2797
+ last_done_by: AdminCreator | RepCreator | ClientCreator;
2798
+ resolve_time: number;
2799
+ sync_id: string;
2800
+ opened_at: number;
2801
+ time: number;
2802
+ opened_by: AdminCreator | RepCreator | ClientCreator;
2803
+ }
2804
+ interface UpdateBody {
2805
+ company_namespace: string[];
2806
+ _id?: string;
2807
+ creator?: AdminCreator | RepCreator | ClientCreator;
2808
+ editor?: AdminCreator | RepCreator | ClientCreator;
2809
+ name?: string;
2810
+ local_name?: string;
2811
+ description?: string;
2812
+ disabled?: boolean;
2813
+ integration_meta?: { [key: string]: any };
2814
+ status: WorkorderStatus;
2815
+ assets?: string[];
2816
+ asset_units?: string[];
2817
+ workorder_categories: string[];
2818
+ due_date?: number;
2819
+ start_date?: number;
2820
+ client_location: string;
2821
+ priority?: Priority;
2822
+ priority_human?: Priority_human;
2823
+ client: string;
2824
+ client_name?: string;
2825
+ workorder_request?: string;
2826
+ createdAt?: Date;
2827
+ updatedAt?: Date;
2828
+ serial_number?: SerialNumber;
2829
+ assigned_to?: string[];
2830
+ forms?: string[];
2831
+ time: number;
2832
+ is_overdue: boolean;
2833
+ opened_at: number;
2834
+ done_at: number;
2835
+ cancelled_at: number;
2836
+ inprogress_at: number;
2837
+ done_by?: AdminCreator | RepCreator | ClientCreator;
2838
+ cancelled_by?: AdminCreator | RepCreator | ClientCreator;
2839
+ opened_by?: AdminCreator | RepCreator | ClientCreator;
2840
+ inprogress_by?: AdminCreator | RepCreator | ClientCreator;
2841
+ calendars: Calendar[];
2842
+ parent_repeating_workorder?: string;
2843
+ due_date_day?: string;
2844
+ last_done_at: number;
2845
+ last_done_by: AdminCreator | RepCreator | ClientCreator;
2846
+ resolve_time: number;
2847
+ sync_id?: string;
2848
+ }
2849
+ type SortingKeys =
2850
+ | "due_date"
2851
+ | "priority"
2852
+ | "updatedAt"
2853
+ | "createdAt"
2854
+ | "from_updatedAt"
2855
+ | "to_updatedAt"
2856
+ | "_id";
2857
+ type PopulatedKeys =
2858
+ | "client"
2859
+ | "asset_units"
2860
+ | "assets"
2861
+ | "assigned_to"
2862
+ | "client_location"
2863
+ | "workorder_categories"
2864
+ | "forms"
2865
+ | "media"
2866
+ | "cover_photo"
2867
+ | "teams";
2868
+ export namespace Find {
2869
+ export type Params = DefaultPaginationQueryParams & {
2870
+ name?: string;
2871
+ _id?: string;
2872
+ assigned_to?: string[];
2873
+ priority?: Priority;
2874
+ priority_human?: Priority_human;
2875
+ status?: WorkorderStatus;
2876
+ workorder_categories?: string[];
2877
+ client_location?: string;
2878
+ client?: string;
2879
+ assets?: string[];
2880
+ asset_units?: string[];
2881
+ due_date?: number;
2882
+ start_date?: number;
2883
+ forms?: string[];
2884
+ from_createdAt?: number;
2885
+ to_createdAt?: number;
2886
+ from_updatedAt?: number;
2887
+ to_updatedAt?: number;
2888
+ from_start_date?: number;
2889
+ to_start_date?: number;
2890
+ from_due_date?: number;
2891
+ to_due_date?: number;
2892
+ teams?: string[];
2893
+ };
2894
+ export interface Result extends DefaultPaginationResult {
2895
+ data: WorkorderSchema[];
2896
+ absolute_total: number;
2897
+ page_total: number;
2898
+ }
2899
+ }
2900
+ export namespace Get {
2901
+ export type ID = string;
2902
+ export interface Params {
2903
+ populatedKeys?: PopulatedKeys[];
2904
+ sortPage?: SortingKeys;
2905
+ }
2906
+ export type Result = WorkorderSchema;
2907
+ }
2908
+ }
2909
+
2910
+ export namespace QuickConvertToPdf {
2911
+ export interface QuickConvertToPdfSchema {
2912
+ _id?: string;
2913
+ creator: AdminCreator | RepCreator | ClientCreator;
2914
+ document_id?: string[];
2915
+ document_type: PrintTypes;
2916
+ print_media?: string;
2917
+ print_media_populated?: MediaDoc;
2918
+ state?:
2919
+ | "queued"
2920
+ | "initiated"
2921
+ | "started"
2922
+ | "delayed"
2923
+ | "completed"
2924
+ | "in_progress"
2925
+ | "failed";
2926
+ content?: string;
2927
+ sync_id: string;
2928
+ }
2929
+ interface CreateBody {
2930
+ document_id?: string[];
2931
+ document_type: PrintTypes;
2932
+ sync_id: string;
2933
+ }
2934
+
2935
+ type PopulatedKeys = "print_media";
2936
+ export namespace Find {
2937
+ export type Params = DefaultPaginationQueryParams & {
2938
+ document_id?: string;
2939
+ document_type?: PrintTypes;
2940
+ print_media?: string;
2941
+ disabled?: boolean;
2942
+ };
2943
+ export interface Result extends DefaultPaginationResult {
2944
+ data: QuickConvertToPdfSchema[];
2945
+ absolute_total: number;
2946
+ page_total: number;
2947
+ }
2948
+ }
2949
+ export namespace Get {
2950
+ export type ID = string;
2951
+ export interface Params {
2952
+ populatedKeys?: PopulatedKeys[];
2953
+ }
2954
+ export type Result = QuickConvertToPdfSchema;
2955
+ }
2956
+ export namespace Create {
2957
+ export type Body = CreateBody;
2958
+ export type Result = QuickConvertToPdfSchema;
2959
+ }
2960
+
2961
+ export namespace Remove {
2962
+ export type ID = string;
2963
+ export type Result = QuickConvertToPdfSchema;
2964
+ }
2965
+ }
2966
+
2462
2967
  export namespace FullInvoice {
2463
2968
  export interface InvoiceSchema {
2464
2969
  _id: string;
package/test.js ADDED
@@ -0,0 +1,11 @@
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.
package/test.ts DELETED
@@ -1,8 +0,0 @@
1
- import Repzo from "./src/index.js";
2
- let repzo = new Repzo("");
3
- let clients = repzo.client.find({ search: "Mecca" });
4
- console.log(clients);
5
- repzo.client.create({ name: "kf" });
6
- repzo.headers["ho"] = "faf";
7
- repzo.client.update("", {});
8
- // repzo.