erpnext-queue-client 2.4.5 → 2.5.1

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.
Files changed (35) hide show
  1. package/dist/client.js +7 -1
  2. package/dist/erpnext/doctypeResourceRequest.d.ts +12 -1
  3. package/dist/erpnext/doctypeResourceRequest.js +3 -3
  4. package/dist/erpnext/doctypes/address.d.ts +3 -233
  5. package/dist/erpnext/doctypes/address.js +5 -16
  6. package/dist/erpnext/doctypes/consolidatedCustomsInvoice.d.ts +3 -486
  7. package/dist/erpnext/doctypes/consolidatedCustomsInvoice.js +4 -18
  8. package/dist/erpnext/doctypes/contact.d.ts +3 -358
  9. package/dist/erpnext/doctypes/contact.js +6 -17
  10. package/dist/erpnext/doctypes/deliveryNote.d.ts +1 -1575
  11. package/dist/erpnext/doctypes/deliveryNote.js +2 -19
  12. package/dist/erpnext/doctypes/item.d.ts +1 -1019
  13. package/dist/erpnext/doctypes/item.js +3 -16
  14. package/dist/erpnext/doctypes/paymentEntry.d.ts +1 -728
  15. package/dist/erpnext/doctypes/paymentEntry.js +4 -21
  16. package/dist/erpnext/doctypes/productBundle.d.ts +1 -143
  17. package/dist/erpnext/doctypes/productBundle.js +2 -13
  18. package/dist/erpnext/doctypes/purchaseInvoice.d.ts +1 -1395
  19. package/dist/erpnext/doctypes/purchaseInvoice.js +4 -19
  20. package/dist/erpnext/doctypes/purchaseReceipt.d.ts +1 -1204
  21. package/dist/erpnext/doctypes/purchaseReceipt.js +4 -19
  22. package/dist/erpnext/doctypes/salesInvoice.d.ts +1 -2517
  23. package/dist/erpnext/doctypes/salesInvoice.js +4 -21
  24. package/dist/erpnext/doctypes/servicecase.d.ts +24 -425
  25. package/dist/erpnext/doctypes/servicecase.js +14 -15
  26. package/dist/erpnext/doctypes/shipment.d.ts +1 -758
  27. package/dist/erpnext/doctypes/shipment.js +3 -20
  28. package/dist/erpnext/item.getList.alias-parsing.test.d.ts +1 -0
  29. package/dist/erpnext/item.getList.alias-parsing.test.js +66 -0
  30. package/dist/erpnext/methodRequest.js +0 -2
  31. package/dist/erpnext/resourceRequest.js +1 -9
  32. package/dist/index.test.js +3 -2
  33. package/dist/utils/zodUtils.d.ts +1 -1
  34. package/dist/utils/zodUtils.js +35 -24
  35. package/package.json +1 -1
@@ -4,28 +4,11 @@ exports.ERPNextSalesInvoice = void 0;
4
4
  const doctypeSubmittableResourceRequest_1 = require("../doctypeSubmittableResourceRequest");
5
5
  const methodRequest_1 = require("../methodRequest");
6
6
  const SalesInvoice_1 = require("../model/SalesInvoice");
7
- class ERPNextSalesInvoice {
8
- temporalClient;
9
- baseRequest;
7
+ class ERPNextSalesInvoice extends doctypeSubmittableResourceRequest_1.ERPNextDoctypeSubmittableResourceRequest {
10
8
  methodRequest;
11
- getList;
12
- getById;
13
- create;
14
- updateById;
15
- deleteById;
16
- cancel;
17
- submit;
18
9
  constructor(temporalClient) {
19
- this.temporalClient = temporalClient;
20
- this.baseRequest = new doctypeSubmittableResourceRequest_1.ERPNextDoctypeSubmittableResourceRequest(temporalClient, "Sales Invoice", SalesInvoice_1.SalesInvoice);
10
+ super(temporalClient, "Sales Invoice", SalesInvoice_1.SalesInvoice);
21
11
  this.methodRequest = new methodRequest_1.ERPNextMethodRequest(temporalClient);
22
- this.getList = this.baseRequest.getList;
23
- this.getById = this.baseRequest.getById;
24
- this.create = this.baseRequest.create;
25
- this.updateById = this.baseRequest.updateById;
26
- this.deleteById = this.baseRequest.deleteById;
27
- this.cancel = this.baseRequest.cancel;
28
- this.submit = this.baseRequest.submit;
29
12
  }
30
13
  async createInvoiceDraftFromSalesOrder(salesOrderName) {
31
14
  const draft = await this.methodRequest.request({
@@ -42,7 +25,7 @@ class ERPNextSalesInvoice {
42
25
  ...invoiceDraft,
43
26
  ...(submit === true ? { docstatus: 1 } : {}),
44
27
  };
45
- return await this.baseRequest.create({
28
+ return await this.create({
46
29
  inputValidationModel: SalesInvoice_1.SalesInvoiceDraft,
47
30
  body,
48
31
  });
@@ -62,7 +45,7 @@ class ERPNextSalesInvoice {
62
45
  ...invoiceDraft,
63
46
  ...(submit === true ? { docstatus: 1 } : {}),
64
47
  };
65
- return await this.baseRequest.create({
48
+ return await this.create({
66
49
  inputValidationModel: SalesInvoice_1.SalesInvoiceDraft,
67
50
  body,
68
51
  });
@@ -1,443 +1,42 @@
1
1
  import { z } from "zod";
2
2
  import { TemporalClient } from "../../client";
3
+ import { DocModelType } from "../model/DocTypeHelpers";
3
4
  import { ERPNextDoctypeResourceRequest } from "../doctypeResourceRequest";
4
5
  import { AttachmentCollection, AttachmentCollectionType, InternalReasonCollection, InternalReasonCollectionType, Servicecase, ServicecaseInputType } from "../model/Servicecase";
5
- export declare class ERPNextServicecase {
6
+ export declare class ERPNextServicecase extends ERPNextDoctypeResourceRequest<typeof Servicecase> {
6
7
  private methodRequest;
7
- protected temporalClient: TemporalClient;
8
- protected baseRequest: ERPNextDoctypeResourceRequest<typeof Servicecase>;
9
8
  protected attachmentCollectionRequest: ERPNextDoctypeResourceRequest<typeof AttachmentCollection>;
10
9
  protected internalReasonCollectionRequest: ERPNextDoctypeResourceRequest<typeof InternalReasonCollection>;
11
- create: (servicecase: ServicecaseInputType, options?: {
12
- priority: number;
13
- }) => Promise<{
14
- status: "EDITING" | "SUBMITTED" | "COMPLETED";
15
- docstatus: number;
16
- name: string;
17
- owner: string;
18
- creation: string;
19
- modified: string;
20
- modified_by: string;
21
- idx: number;
22
- doctype: string;
23
- country: string;
24
- title: string;
25
- order_number: string;
26
- shop: "Shopify" | "Amazon FBA" | "Amazon FBM" | "Otto" | "Amazon" | "WordPress";
27
- is_sent_to_client: 0 | 1;
28
- is_sent_to_cc: 0 | 1;
29
- created_with: "Amazon FBA" | "Amazon FBM" | "Serviceportal" | "Missive Sidebar";
30
- return_items: {
31
- docstatus: number;
32
- name: string;
33
- owner: string;
34
- creation: string;
35
- modified: string;
36
- modified_by: string;
37
- idx: number;
38
- doctype: string;
39
- parent: string;
40
- parenttype: string;
41
- parentfield: string;
42
- item: string;
43
- return_quantity: number;
44
- is_complaint: 0 | 1;
45
- _user_tags?: string | null | undefined;
46
- attachments?: string | null | undefined;
47
- internal_reasons?: string | null | undefined;
48
- line_item_id?: string | null | undefined;
49
- bundle_parent_item?: string | null | undefined;
50
- total_price?: number | null | undefined;
51
- intent?: "return" | "solve" | null | undefined;
52
- servicecase_reason?: string | null | undefined;
53
- servicecase_solution?: string | null | undefined;
54
- batch_number?: string | null | undefined;
55
- complaint_description?: string | null | undefined;
56
- }[];
57
- return_shipping_items: {
58
- docstatus: number;
59
- name: string;
60
- owner: string;
61
- creation: string;
62
- modified: string;
63
- modified_by: string;
64
- idx: number;
65
- doctype: string;
66
- parent: string;
67
- parenttype: string;
68
- parentfield: string;
69
- quantity: number;
70
- item: string;
71
- return_item: string;
72
- shipment_id: string;
73
- return_fee: number;
74
- _user_tags?: string | null | undefined;
75
- return_label?: string | null | undefined;
76
- shipping_provider?: string | null | undefined;
77
- }[];
78
- _user_tags?: string | null | undefined;
79
- external_id?: string | null | undefined;
80
- customer_email?: string | null | undefined;
81
- complaint_date?: string | null | undefined;
82
- customer_message?: string | null | undefined;
83
- agreed_terms?: string | null | undefined;
84
- }>;
85
- getList: <TFieldOptions extends ("status" | "docstatus" | "name" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "country" | "title" | "order_number" | "shop" | "is_sent_to_client" | "is_sent_to_cc" | "created_with") | ("_user_tags" | "external_id" | "customer_email" | "complaint_date" | "customer_message" | "agreed_terms"), TSelectedFields extends readonly ["*"] | readonly TFieldOptions[] | undefined = undefined, TAsDict extends boolean | undefined = undefined>({ fields, filters, skip, limit, priority, asDict, params, }?: {
86
- fields?: TSelectedFields;
87
- filters?: (string | string[])[][];
88
- skip?: number;
89
- limit?: number;
90
- priority?: number;
91
- asDict?: TAsDict;
92
- params?: Record<string, string>;
93
- }) => Promise<(TAsDict extends false ? string[][] : TSelectedFields extends undefined ? {
94
- name: string;
95
- }[] : TSelectedFields extends readonly ["*"] ? {
96
- status: "EDITING" | "SUBMITTED" | "COMPLETED";
97
- docstatus: number;
98
- name: string;
99
- owner: string;
100
- creation: string;
101
- modified: string;
102
- modified_by: string;
103
- idx: number;
104
- country: string;
105
- title: string;
106
- order_number: string;
107
- shop: "Shopify" | "Amazon FBA" | "Amazon FBM" | "Otto" | "Amazon" | "WordPress";
108
- is_sent_to_client: 0 | 1;
109
- is_sent_to_cc: 0 | 1;
110
- created_with: "Amazon FBA" | "Amazon FBM" | "Serviceportal" | "Missive Sidebar";
111
- _user_tags?: string | null | undefined;
112
- external_id?: string | null | undefined;
113
- customer_email?: string | null | undefined;
114
- complaint_date?: string | null | undefined;
115
- customer_message?: string | null | undefined;
116
- agreed_terms?: string | null | undefined;
117
- }[] : TSelectedFields extends readonly TFieldOptions[] ? { [K_1 in TSelectedFields[number] as K_1 extends `${infer _Before} as ${infer Alias}` ? Alias : K_1]: (K_1 extends `${infer _Before} as ${infer Alias}` ? Alias : K_1) extends ("status" | "docstatus" | "name" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "country" | "title" | "order_number" | "shop" | "is_sent_to_client" | "is_sent_to_cc" | "created_with") | ("_user_tags" | "external_id" | "customer_email" | "complaint_date" | "customer_message" | "agreed_terms") ? {
118
- status: "EDITING" | "SUBMITTED" | "COMPLETED";
119
- docstatus: number;
120
- name: string;
121
- owner: string;
122
- creation: string;
123
- modified: string;
124
- modified_by: string;
125
- idx: number;
126
- country: string;
127
- title: string;
128
- order_number: string;
129
- shop: "Shopify" | "Amazon FBA" | "Amazon FBM" | "Otto" | "Amazon" | "WordPress";
130
- is_sent_to_client: 0 | 1;
131
- is_sent_to_cc: 0 | 1;
132
- created_with: "Amazon FBA" | "Amazon FBM" | "Serviceportal" | "Missive Sidebar";
133
- _user_tags?: string | null | undefined;
134
- external_id?: string | null | undefined;
135
- customer_email?: string | null | undefined;
136
- complaint_date?: string | null | undefined;
137
- customer_message?: string | null | undefined;
138
- agreed_terms?: string | null | undefined;
139
- }[(("status" | "docstatus" | "name" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "country" | "title" | "order_number" | "shop" | "is_sent_to_client" | "is_sent_to_cc" | "created_with") | ("_user_tags" | "external_id" | "customer_email" | "complaint_date" | "customer_message" | "agreed_terms")) & (K_1 extends `${infer _Before} as ${infer Alias}` ? Alias : K_1)] : never; }[] : any) extends infer T ? { [K in keyof T]: T[K]; } : never>;
140
- getById: ({ resourceId, priority, }: {
141
- resourceId: string;
142
- priority?: number;
143
- }) => Promise<{
144
- status: "EDITING" | "SUBMITTED" | "COMPLETED";
145
- docstatus: number;
146
- name: string;
147
- owner: string;
148
- creation: string;
149
- modified: string;
150
- modified_by: string;
151
- idx: number;
152
- doctype: string;
153
- country: string;
154
- title: string;
155
- order_number: string;
156
- shop: "Shopify" | "Amazon FBA" | "Amazon FBM" | "Otto" | "Amazon" | "WordPress";
157
- is_sent_to_client: 0 | 1;
158
- is_sent_to_cc: 0 | 1;
159
- created_with: "Amazon FBA" | "Amazon FBM" | "Serviceportal" | "Missive Sidebar";
160
- return_items: {
161
- docstatus: number;
162
- name: string;
163
- owner: string;
164
- creation: string;
165
- modified: string;
166
- modified_by: string;
167
- idx: number;
168
- doctype: string;
169
- parent: string;
170
- parenttype: string;
171
- parentfield: string;
172
- item: string;
173
- return_quantity: number;
174
- is_complaint: 0 | 1;
175
- _user_tags?: string | null | undefined;
176
- attachments?: string | null | undefined;
177
- internal_reasons?: string | null | undefined;
178
- line_item_id?: string | null | undefined;
179
- bundle_parent_item?: string | null | undefined;
180
- total_price?: number | null | undefined;
181
- intent?: "return" | "solve" | null | undefined;
182
- servicecase_reason?: string | null | undefined;
183
- servicecase_solution?: string | null | undefined;
184
- batch_number?: string | null | undefined;
185
- complaint_description?: string | null | undefined;
186
- }[];
187
- return_shipping_items: {
188
- docstatus: number;
189
- name: string;
190
- owner: string;
191
- creation: string;
192
- modified: string;
193
- modified_by: string;
194
- idx: number;
195
- doctype: string;
196
- parent: string;
197
- parenttype: string;
198
- parentfield: string;
199
- quantity: number;
200
- item: string;
201
- return_item: string;
202
- shipment_id: string;
203
- return_fee: number;
204
- _user_tags?: string | null | undefined;
205
- return_label?: string | null | undefined;
206
- shipping_provider?: string | null | undefined;
207
- }[];
208
- _user_tags?: string | null | undefined;
209
- external_id?: string | null | undefined;
210
- customer_email?: string | null | undefined;
211
- complaint_date?: string | null | undefined;
212
- customer_message?: string | null | undefined;
213
- agreed_terms?: string | null | undefined;
214
- } | undefined>;
215
- updateById: (resourceId: string, servicecase: ServicecaseInputType, options?: {
216
- priority: number;
217
- }) => Promise<{
218
- status: "EDITING" | "SUBMITTED" | "COMPLETED";
219
- docstatus: number;
220
- name: string;
221
- owner: string;
222
- creation: string;
223
- modified: string;
224
- modified_by: string;
225
- idx: number;
226
- doctype: string;
227
- country: string;
228
- title: string;
229
- order_number: string;
230
- shop: "Shopify" | "Amazon FBA" | "Amazon FBM" | "Otto" | "Amazon" | "WordPress";
231
- is_sent_to_client: 0 | 1;
232
- is_sent_to_cc: 0 | 1;
233
- created_with: "Amazon FBA" | "Amazon FBM" | "Serviceportal" | "Missive Sidebar";
234
- return_items: {
235
- docstatus: number;
236
- name: string;
237
- owner: string;
238
- creation: string;
239
- modified: string;
240
- modified_by: string;
241
- idx: number;
242
- doctype: string;
243
- parent: string;
244
- parenttype: string;
245
- parentfield: string;
246
- item: string;
247
- return_quantity: number;
248
- is_complaint: 0 | 1;
249
- _user_tags?: string | null | undefined;
250
- attachments?: string | null | undefined;
251
- internal_reasons?: string | null | undefined;
252
- line_item_id?: string | null | undefined;
253
- bundle_parent_item?: string | null | undefined;
254
- total_price?: number | null | undefined;
255
- intent?: "return" | "solve" | null | undefined;
256
- servicecase_reason?: string | null | undefined;
257
- servicecase_solution?: string | null | undefined;
258
- batch_number?: string | null | undefined;
259
- complaint_description?: string | null | undefined;
260
- }[];
261
- return_shipping_items: {
262
- docstatus: number;
263
- name: string;
264
- owner: string;
265
- creation: string;
266
- modified: string;
267
- modified_by: string;
268
- idx: number;
269
- doctype: string;
270
- parent: string;
271
- parenttype: string;
272
- parentfield: string;
273
- quantity: number;
274
- item: string;
275
- return_item: string;
276
- shipment_id: string;
277
- return_fee: number;
278
- _user_tags?: string | null | undefined;
279
- return_label?: string | null | undefined;
280
- shipping_provider?: string | null | undefined;
281
- }[];
282
- _user_tags?: string | null | undefined;
283
- external_id?: string | null | undefined;
284
- customer_email?: string | null | undefined;
285
- complaint_date?: string | null | undefined;
286
- customer_message?: string | null | undefined;
287
- agreed_terms?: string | null | undefined;
288
- }>;
289
- deleteById: ({ resourceId, priority, }: {
290
- resourceId: string;
291
- priority?: number;
292
- }) => Promise<z.TypeOf<typeof import("../model/ERPNextResponse").DeleteResponseModel>>;
293
10
  constructor(temporalClient: TemporalClient);
11
+ create(args: Parameters<ERPNextDoctypeResourceRequest<typeof Servicecase>["create"]>[0]): Promise<z.infer<DocModelType<typeof Servicecase>>>;
12
+ updateById(args: Parameters<ERPNextDoctypeResourceRequest<typeof Servicecase>["updateById"]>[0]): Promise<z.infer<DocModelType<typeof Servicecase>>>;
294
13
  createServicecase(servicecase: ServicecaseInputType, options?: {
295
14
  priority: number;
296
15
  }): Promise<{
297
- status: "EDITING" | "SUBMITTED" | "COMPLETED";
298
- docstatus: number;
299
- name: string;
300
- owner: string;
301
- creation: string;
302
- modified: string;
303
- modified_by: string;
304
- idx: number;
305
- doctype: string;
306
- country: string;
307
- title: string;
308
- order_number: string;
309
- shop: "Shopify" | "Amazon FBA" | "Amazon FBM" | "Otto" | "Amazon" | "WordPress";
310
- is_sent_to_client: 0 | 1;
311
- is_sent_to_cc: 0 | 1;
312
- created_with: "Amazon FBA" | "Amazon FBM" | "Serviceportal" | "Missive Sidebar";
313
- return_items: {
314
- docstatus: number;
315
- name: string;
316
- owner: string;
317
- creation: string;
318
- modified: string;
319
- modified_by: string;
320
- idx: number;
321
- doctype: string;
322
- parent: string;
323
- parenttype: string;
324
- parentfield: string;
325
- item: string;
326
- return_quantity: number;
327
- is_complaint: 0 | 1;
328
- _user_tags?: string | null | undefined;
329
- attachments?: string | null | undefined;
330
- internal_reasons?: string | null | undefined;
331
- line_item_id?: string | null | undefined;
332
- bundle_parent_item?: string | null | undefined;
333
- total_price?: number | null | undefined;
334
- intent?: "return" | "solve" | null | undefined;
335
- servicecase_reason?: string | null | undefined;
336
- servicecase_solution?: string | null | undefined;
337
- batch_number?: string | null | undefined;
338
- complaint_description?: string | null | undefined;
339
- }[];
340
- return_shipping_items: {
341
- docstatus: number;
342
- name: string;
343
- owner: string;
344
- creation: string;
345
- modified: string;
346
- modified_by: string;
347
- idx: number;
348
- doctype: string;
349
- parent: string;
350
- parenttype: string;
351
- parentfield: string;
352
- quantity: number;
353
- item: string;
354
- return_item: string;
355
- shipment_id: string;
356
- return_fee: number;
357
- _user_tags?: string | null | undefined;
358
- return_label?: string | null | undefined;
359
- shipping_provider?: string | null | undefined;
360
- }[];
361
- _user_tags?: string | null | undefined;
362
- external_id?: string | null | undefined;
363
- customer_email?: string | null | undefined;
364
- complaint_date?: string | null | undefined;
365
- customer_message?: string | null | undefined;
366
- agreed_terms?: string | null | undefined;
16
+ [x: string]: any;
17
+ name?: unknown;
18
+ owner?: unknown;
19
+ creation?: unknown;
20
+ modified?: unknown;
21
+ modified_by?: unknown;
22
+ idx?: unknown;
23
+ docstatus?: unknown;
24
+ doctype?: unknown;
25
+ _user_tags?: unknown;
367
26
  }>;
368
27
  updateServicecase(resourceId: string, servicecase: ServicecaseInputType, options?: {
369
28
  priority: number;
370
29
  }): Promise<{
371
- status: "EDITING" | "SUBMITTED" | "COMPLETED";
372
- docstatus: number;
373
- name: string;
374
- owner: string;
375
- creation: string;
376
- modified: string;
377
- modified_by: string;
378
- idx: number;
379
- doctype: string;
380
- country: string;
381
- title: string;
382
- order_number: string;
383
- shop: "Shopify" | "Amazon FBA" | "Amazon FBM" | "Otto" | "Amazon" | "WordPress";
384
- is_sent_to_client: 0 | 1;
385
- is_sent_to_cc: 0 | 1;
386
- created_with: "Amazon FBA" | "Amazon FBM" | "Serviceportal" | "Missive Sidebar";
387
- return_items: {
388
- docstatus: number;
389
- name: string;
390
- owner: string;
391
- creation: string;
392
- modified: string;
393
- modified_by: string;
394
- idx: number;
395
- doctype: string;
396
- parent: string;
397
- parenttype: string;
398
- parentfield: string;
399
- item: string;
400
- return_quantity: number;
401
- is_complaint: 0 | 1;
402
- _user_tags?: string | null | undefined;
403
- attachments?: string | null | undefined;
404
- internal_reasons?: string | null | undefined;
405
- line_item_id?: string | null | undefined;
406
- bundle_parent_item?: string | null | undefined;
407
- total_price?: number | null | undefined;
408
- intent?: "return" | "solve" | null | undefined;
409
- servicecase_reason?: string | null | undefined;
410
- servicecase_solution?: string | null | undefined;
411
- batch_number?: string | null | undefined;
412
- complaint_description?: string | null | undefined;
413
- }[];
414
- return_shipping_items: {
415
- docstatus: number;
416
- name: string;
417
- owner: string;
418
- creation: string;
419
- modified: string;
420
- modified_by: string;
421
- idx: number;
422
- doctype: string;
423
- parent: string;
424
- parenttype: string;
425
- parentfield: string;
426
- quantity: number;
427
- item: string;
428
- return_item: string;
429
- shipment_id: string;
430
- return_fee: number;
431
- _user_tags?: string | null | undefined;
432
- return_label?: string | null | undefined;
433
- shipping_provider?: string | null | undefined;
434
- }[];
435
- _user_tags?: string | null | undefined;
436
- external_id?: string | null | undefined;
437
- customer_email?: string | null | undefined;
438
- complaint_date?: string | null | undefined;
439
- customer_message?: string | null | undefined;
440
- agreed_terms?: string | null | undefined;
30
+ [x: string]: any;
31
+ name?: unknown;
32
+ owner?: unknown;
33
+ creation?: unknown;
34
+ modified?: unknown;
35
+ modified_by?: unknown;
36
+ idx?: unknown;
37
+ docstatus?: unknown;
38
+ doctype?: unknown;
39
+ _user_tags?: unknown;
441
40
  }>;
442
41
  getServicecasesExtended({ email, id, priority, }: {
443
42
  email?: string;
@@ -6,28 +6,25 @@ const logger_1 = require("../../utils/logger");
6
6
  const doctypeResourceRequest_1 = require("../doctypeResourceRequest");
7
7
  const methodRequest_1 = require("../methodRequest");
8
8
  const Servicecase_1 = require("../model/Servicecase");
9
- class ERPNextServicecase {
9
+ class ERPNextServicecase extends doctypeResourceRequest_1.ERPNextDoctypeResourceRequest {
10
10
  methodRequest;
11
- temporalClient;
12
- baseRequest;
13
11
  attachmentCollectionRequest;
14
12
  internalReasonCollectionRequest;
15
- create;
16
- getList;
17
- getById;
18
- updateById;
19
- deleteById;
20
13
  constructor(temporalClient) {
14
+ super(temporalClient, "Servicecase", Servicecase_1.Servicecase);
21
15
  this.methodRequest = new methodRequest_1.ERPNextMethodRequest(temporalClient);
22
- this.temporalClient = temporalClient;
23
- this.baseRequest = new doctypeResourceRequest_1.ERPNextDoctypeResourceRequest(temporalClient, "Servicecase", Servicecase_1.Servicecase);
24
16
  this.attachmentCollectionRequest = new doctypeResourceRequest_1.ERPNextDoctypeResourceRequest(temporalClient, "Servicecase Return Item Attachment Collection", Servicecase_1.AttachmentCollection);
25
17
  this.internalReasonCollectionRequest = new doctypeResourceRequest_1.ERPNextDoctypeResourceRequest(temporalClient, "Servicecase Return Item Internal Reasons Collection", Servicecase_1.InternalReasonCollection);
26
- this.create = this.createServicecase;
27
- this.getList = this.baseRequest.getList;
28
- this.getById = this.baseRequest.getById;
29
- this.updateById = this.updateServicecase;
30
- this.deleteById = this.baseRequest.deleteById;
18
+ }
19
+ async create(args) {
20
+ return this.createServicecase(args.body, {
21
+ priority: args.priority ?? 5,
22
+ });
23
+ }
24
+ async updateById(args) {
25
+ return this.updateServicecase(args.resourceId, args.body, {
26
+ priority: args.priority ?? 5,
27
+ });
31
28
  }
32
29
  async createServicecase(servicecase, options = { priority: 5 }) {
33
30
  for (const returnItem of servicecase.return_items ?? []) {
@@ -51,6 +48,7 @@ class ERPNextServicecase {
51
48
  returnItem.internal_reasons = internalReasonsCollection.name;
52
49
  }
53
50
  const newServicecase = await this.baseRequest.create({
51
+ resourceName: this.resourceName,
54
52
  body: servicecase,
55
53
  inputValidationModel: Servicecase_1.ServicecaseInput,
56
54
  priority: options.priority,
@@ -73,6 +71,7 @@ class ERPNextServicecase {
73
71
  }
74
72
  }
75
73
  const updatedServicecase = await this.baseRequest.updateById({
74
+ resourceName: this.resourceName,
76
75
  resourceId,
77
76
  body: servicecase,
78
77
  inputValidationModel: Servicecase_1.ServicecaseInput,