erpnext-queue-client 1.1.0 → 1.1.2

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.
@@ -1,38 +1,40 @@
1
1
  import { z, ZodObject, ZodTypeAny } from "zod";
2
2
  import { TemporalClient } from "../client";
3
3
  import { ERPNextResourceRequest } from "./resourceRequest";
4
- export declare class ERPNextDoctypeResourceRequest<T extends ZodObject<any>> {
4
+ import { KeysOf } from "../utils/zodUtils";
5
+ import { DeleteResponseModel } from "./model/ERPNextResponse";
6
+ export declare class ERPNextDoctypeResourceRequest<TModel extends ZodObject<any>> {
5
7
  protected temporalClient: TemporalClient;
6
8
  protected resourceName: string;
7
- protected resourceModel: ZodTypeAny;
9
+ protected resourceModel: TModel;
8
10
  protected baseRequest: ERPNextResourceRequest;
9
- constructor(temporalClient: TemporalClient, resourceName: string, resourceModel: ZodTypeAny);
10
- getList<K extends keyof T["_type"], B extends boolean>({ fields, filters, skip, limit, priority, asDict, params, }: {
11
- fields?: K[];
11
+ constructor(temporalClient: TemporalClient, resourceName: string, resourceModel: TModel);
12
+ getList<TField extends KeysOf<TModel>, TAsDict extends boolean | undefined = undefined>({ fields, filters, skip, limit, priority, asDict, params, }: {
13
+ fields?: TField[] | undefined;
12
14
  filters?: string[][];
13
15
  skip?: number;
14
16
  limit?: number;
15
17
  priority?: number;
16
- asDict?: B;
18
+ asDict?: TAsDict;
17
19
  params?: string;
18
- }): Promise<B extends false ? Array<Array<string>> : T extends undefined ? any : Array<Pick<z.infer<T>, K extends keyof z.infer<T> ? K : never>>>;
19
- getById<T extends ZodTypeAny>({ resourceId, priority, }: {
20
+ }): Promise<TAsDict extends false ? Array<Array<string>> : typeof fields extends undefined ? Array<Pick<z.infer<TModel>, "name">> : Array<Pick<z.infer<TModel>, TField>>>;
21
+ getById({ resourceId, priority, }: {
20
22
  resourceId: string;
21
23
  priority?: number;
22
- }): Promise<z.TypeOf<T>>;
23
- updateById<K extends ZodTypeAny>({ resourceId, inputValidationModel, body, priority, }: {
24
+ }): Promise<z.TypeOf<TModel>>;
25
+ updateById<TInput extends TInputModel extends undefined ? Partial<z.TypeOf<TModel>> : TInputModel extends ZodTypeAny ? z.TypeOf<TInputModel> : any, TInputModel extends ZodTypeAny | undefined = undefined>({ resourceId, inputValidationModel, body, priority, }: {
24
26
  resourceId: string;
25
- inputValidationModel?: K;
27
+ inputValidationModel?: TInputModel;
26
28
  priority?: number;
27
- body: z.TypeOf<K>;
28
- }): Promise<z.TypeOf<T>>;
29
- create<K extends ZodTypeAny>({ inputValidationModel, body, priority, }: {
30
- inputValidationModel?: K;
29
+ body: TInput;
30
+ }): Promise<z.TypeOf<TModel>>;
31
+ create<TInput extends TInputModel extends undefined ? Partial<z.TypeOf<TModel>> : TInputModel extends ZodTypeAny ? z.TypeOf<TInputModel> : any, TInputModel extends ZodTypeAny | undefined = undefined>({ inputValidationModel, body, priority, }: {
32
+ inputValidationModel?: TInputModel;
31
33
  priority?: number;
32
- body: z.TypeOf<K>;
33
- }): Promise<z.TypeOf<T>>;
34
+ body: TInput;
35
+ }): Promise<z.TypeOf<TModel>>;
34
36
  deleteById({ resourceId, priority, }: {
35
37
  resourceId: string;
36
38
  priority?: number;
37
- }): Promise<z.TypeOf<T>>;
39
+ }): Promise<z.TypeOf<typeof DeleteResponseModel>>;
38
40
  }
@@ -20,12 +20,12 @@ class ERPNextDoctypeResourceRequest {
20
20
  }
21
21
  getList(_a) {
22
22
  return __awaiter(this, arguments, void 0, function* ({ fields, filters, skip, limit, priority = 5, asDict, params, }) {
23
- return this.baseRequest.getList(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ resourceName: this.resourceName, resourceModel: this.resourceModel, priority }, (fields ? { fields } : {})), (filters ? { filters } : {})), (limit ? { limit } : {})), (skip ? { skip } : {})), (typeof asDict === "boolean" ? { asDict } : {})), (params ? { params } : {})));
23
+ return yield this.baseRequest.getList(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ resourceName: this.resourceName, resourceModel: this.resourceModel, priority }, (fields ? { fields } : {})), (filters ? { filters } : {})), (limit ? { limit } : {})), (skip ? { skip } : {})), (params ? { params } : {})), (asDict ? { asDict } : {})));
24
24
  });
25
25
  }
26
26
  getById(_a) {
27
27
  return __awaiter(this, arguments, void 0, function* ({ resourceId, priority = 5, }) {
28
- return this.baseRequest.getById({
28
+ return yield this.baseRequest.getById({
29
29
  resourceName: this.resourceName,
30
30
  resourceId,
31
31
  resourceModel: this.resourceModel,
@@ -35,19 +35,19 @@ class ERPNextDoctypeResourceRequest {
35
35
  }
36
36
  updateById(_a) {
37
37
  return __awaiter(this, arguments, void 0, function* ({ resourceId, inputValidationModel, body, priority = 5, }) {
38
- return this.baseRequest.updateById(Object.assign(Object.assign({ resourceName: this.resourceName, resourceId }, (inputValidationModel ? { inputValidationModel } : {})), { resourceModel: this.resourceModel, body,
38
+ return yield this.baseRequest.updateById(Object.assign(Object.assign({ resourceName: this.resourceName, resourceId }, (inputValidationModel ? { inputValidationModel } : {})), { resourceModel: this.resourceModel, body,
39
39
  priority }));
40
40
  });
41
41
  }
42
42
  create(_a) {
43
43
  return __awaiter(this, arguments, void 0, function* ({ inputValidationModel, body, priority = 5, }) {
44
- return this.baseRequest.create(Object.assign(Object.assign({ resourceName: this.resourceName }, (inputValidationModel ? { inputValidationModel } : {})), { resourceModel: this.resourceModel, body,
44
+ return yield this.baseRequest.create(Object.assign(Object.assign({ resourceName: this.resourceName }, (inputValidationModel ? { inputValidationModel } : {})), { resourceModel: this.resourceModel, body,
45
45
  priority }));
46
46
  });
47
47
  }
48
48
  deleteById(_a) {
49
49
  return __awaiter(this, arguments, void 0, function* ({ resourceId, priority = 5, }) {
50
- return this.baseRequest.deleteById({
50
+ return yield this.baseRequest.deleteById({
51
51
  resourceName: this.resourceName,
52
52
  resourceId,
53
53
  resourceModel: this.resourceModel,
@@ -1,8 +1,8 @@
1
1
  import { ZodObject } from "zod";
2
2
  import { ERPNextDoctypeResourceRequest } from "./doctypeResourceRequest";
3
3
  import { TemporalClient } from "../client";
4
- export declare class ERPNextDoctypeSubmittableResourceRequest<T extends ZodObject<any>> extends ERPNextDoctypeResourceRequest<T> {
5
- constructor(temporalClient: TemporalClient, resourceName: string, resourceModel: ZodObject<any>);
6
- cancel(resourceId: string): Promise<import("zod").TypeOf<T>>;
7
- submit(resourceId: string): Promise<import("zod").TypeOf<T>>;
4
+ export declare class ERPNextDoctypeSubmittableResourceRequest<TModel extends ZodObject<any>> extends ERPNextDoctypeResourceRequest<TModel> {
5
+ constructor(temporalClient: TemporalClient, resourceName: string, resourceModel: TModel);
6
+ cancel(resourceId: string): Promise<import("zod").TypeOf<TModel>>;
7
+ submit(resourceId: string): Promise<import("zod").TypeOf<TModel>>;
8
8
  }
@@ -4,15 +4,15 @@ import { Address, AddressPostBodyType } from "../model/Address";
4
4
  export declare class ERPNextAddress {
5
5
  protected temporalClient: TemporalClient;
6
6
  protected baseRequest: ERPNextDoctypeResourceRequest<typeof Address>;
7
- getList: <K extends ("name" | "address_title" | "address_line1" | "address_type" | "city" | "pincode" | "country" | "email_id" | "is_shipping_address" | "links" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "docstatus" | "doctype" | "is_primary_address" | "is_your_company_address" | "disabled") | ("address_line2" | "parent" | "parentfield" | "parenttype" | "import_reference" | "state" | "phone" | "fax" | "tax_category" | "county"), B extends boolean>({ fields, filters, skip, limit, priority, asDict, params, }: {
8
- fields?: K[];
7
+ getList: <TField extends ("name" | "address_title" | "address_line1" | "address_type" | "city" | "pincode" | "country" | "email_id" | "is_shipping_address" | "links" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "docstatus" | "doctype" | "is_primary_address" | "is_your_company_address" | "disabled") | ("address_line2" | "parent" | "parentfield" | "parenttype" | "import_reference" | "state" | "phone" | "fax" | "tax_category" | "county"), TAsDict extends boolean | undefined = undefined>({ fields, filters, skip, limit, priority, asDict, params, }: {
8
+ fields?: TField[] | undefined;
9
9
  filters?: string[][];
10
10
  skip?: number;
11
11
  limit?: number;
12
12
  priority?: number;
13
- asDict?: B;
13
+ asDict?: TAsDict;
14
14
  params?: string;
15
- }) => Promise<B extends false ? string[][] : Pick<{
15
+ }) => Promise<TAsDict extends false ? string[][] : Pick<{
16
16
  name: string;
17
17
  address_title: string;
18
18
  address_line1: string;
@@ -58,16 +58,10 @@ export declare class ERPNextAddress {
58
58
  fax?: string | null | undefined;
59
59
  tax_category?: string | null | undefined;
60
60
  county?: string | null | undefined;
61
- }, K extends ("name" | "address_title" | "address_line1" | "address_type" | "city" | "pincode" | "country" | "email_id" | "is_shipping_address" | "links" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "docstatus" | "doctype" | "is_primary_address" | "is_your_company_address" | "disabled") | ("address_line2" | "parent" | "parentfield" | "parenttype" | "import_reference" | "state" | "phone" | "fax" | "tax_category" | "county") ? K : never>[]>;
62
- getById: <T extends import("zod").ZodTypeAny>({ resourceId, priority, }: {
61
+ }, TField>[]>;
62
+ getById: ({ resourceId, priority, }: {
63
63
  resourceId: string;
64
64
  priority?: number;
65
- }) => Promise<import("zod").TypeOf<T>>;
66
- updateById: <K extends import("zod").ZodTypeAny>({ resourceId, inputValidationModel, body, priority, }: {
67
- resourceId: string;
68
- inputValidationModel?: K;
69
- priority?: number;
70
- body: import("zod").TypeOf<K>;
71
65
  }) => Promise<{
72
66
  name: string;
73
67
  address_title: string;
@@ -115,9 +109,57 @@ export declare class ERPNextAddress {
115
109
  tax_category?: string | null | undefined;
116
110
  county?: string | null | undefined;
117
111
  }>;
118
- deleteById: ({ resourceId, priority, }: {
112
+ updateById: <TInput extends TInputModel extends undefined ? Partial<{
113
+ name: string;
114
+ address_title: string;
115
+ address_line1: string;
116
+ address_type: string;
117
+ city: string;
118
+ pincode: string;
119
+ country: string;
120
+ email_id: string;
121
+ is_shipping_address: boolean;
122
+ links: {
123
+ name: string;
124
+ link_doctype: string;
125
+ link_name: string;
126
+ owner: string;
127
+ creation: string;
128
+ modified: string;
129
+ modified_by: string;
130
+ parent: string;
131
+ parentfield: string;
132
+ parenttype: string;
133
+ idx: number;
134
+ docstatus: number;
135
+ link_title: string;
136
+ doctype: string;
137
+ }[];
138
+ owner: string;
139
+ creation: string;
140
+ modified: string;
141
+ modified_by: string;
142
+ idx: number;
143
+ docstatus: number;
144
+ doctype: string;
145
+ is_primary_address: boolean;
146
+ is_your_company_address: boolean;
147
+ disabled: boolean;
148
+ address_line2?: string | null | undefined;
149
+ parent?: string | null | undefined;
150
+ parentfield?: string | null | undefined;
151
+ parenttype?: string | null | undefined;
152
+ import_reference?: string | null | undefined;
153
+ state?: string | null | undefined;
154
+ phone?: string | null | undefined;
155
+ fax?: string | null | undefined;
156
+ tax_category?: string | null | undefined;
157
+ county?: string | null | undefined;
158
+ }> : TInputModel extends import("zod").ZodTypeAny ? import("zod").TypeOf<TInputModel> : any, TInputModel extends import("zod").ZodTypeAny | undefined = undefined>({ resourceId, inputValidationModel, body, priority, }: {
119
159
  resourceId: string;
160
+ inputValidationModel?: TInputModel;
120
161
  priority?: number;
162
+ body: TInput;
121
163
  }) => Promise<{
122
164
  name: string;
123
165
  address_title: string;
@@ -165,6 +207,10 @@ export declare class ERPNextAddress {
165
207
  tax_category?: string | null | undefined;
166
208
  county?: string | null | undefined;
167
209
  }>;
210
+ deleteById: ({ resourceId, priority, }: {
211
+ resourceId: string;
212
+ priority?: number;
213
+ }) => Promise<import("zod").TypeOf<typeof import("../model/ERPNextResponse").DeleteResponseModel>>;
168
214
  constructor(temporalClient: TemporalClient);
169
215
  create(address: Omit<AddressPostBodyType, "links">, customerName: string): Promise<{
170
216
  name: string;
@@ -213,7 +259,7 @@ export declare class ERPNextAddress {
213
259
  tax_category?: string | null | undefined;
214
260
  county?: string | null | undefined;
215
261
  }>;
216
- getAddressesByEmail: <K extends keyof (typeof Address)["_type"]>(email: string, fields?: K[]) => Promise<string[][] | Pick<{
262
+ getAddressesByEmail: <K extends keyof (typeof Address)["_type"]>(email: string, fields?: K[]) => Promise<Pick<{
217
263
  name: string;
218
264
  address_title: string;
219
265
  address_line1: string;
@@ -259,5 +305,5 @@ export declare class ERPNextAddress {
259
305
  fax?: string | null | undefined;
260
306
  tax_category?: string | null | undefined;
261
307
  county?: string | null | undefined;
262
- }, K extends ("name" | "address_title" | "address_line1" | "address_type" | "city" | "pincode" | "country" | "email_id" | "is_shipping_address" | "links" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "docstatus" | "doctype" | "is_primary_address" | "is_your_company_address" | "disabled") | ("address_line2" | "parent" | "parentfield" | "parenttype" | "import_reference" | "state" | "phone" | "fax" | "tax_category" | "county") ? K : never>[]>;
308
+ }, K>[]>;
263
309
  }
@@ -4,15 +4,15 @@ import { Contact, ContactPostBodyType } from "../model/Contact";
4
4
  export declare class ERPNextContact {
5
5
  protected temporalClient: TemporalClient;
6
6
  protected baseRequest: ERPNextDoctypeResourceRequest<typeof Contact>;
7
- getList: <K extends ("name" | "email_id" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "docstatus" | "doctype" | "first_name" | "email_ids" | "sync_with_google_contacts" | "pulled_from_google_contacts" | "is_primary_contact" | "is_billing_contact" | "unsubscribed") | ("status" | "links" | "phone" | "last_name" | "middle_name" | "company" | "mobile_no" | "image" | "phone_nos"), B extends boolean>({ fields, filters, skip, limit, priority, asDict, params, }: {
8
- fields?: K[];
7
+ getList: <TField extends ("name" | "email_id" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "docstatus" | "doctype" | "first_name" | "email_ids" | "sync_with_google_contacts" | "pulled_from_google_contacts" | "is_primary_contact" | "is_billing_contact" | "unsubscribed") | ("status" | "links" | "phone" | "last_name" | "middle_name" | "company" | "mobile_no" | "image" | "phone_nos"), TAsDict extends boolean | undefined = undefined>({ fields, filters, skip, limit, priority, asDict, params, }: {
8
+ fields?: TField[] | undefined;
9
9
  filters?: string[][];
10
10
  skip?: number;
11
11
  limit?: number;
12
12
  priority?: number;
13
- asDict?: B;
13
+ asDict?: TAsDict;
14
14
  params?: string;
15
- }) => Promise<B extends false ? string[][] : Pick<{
15
+ }) => Promise<TAsDict extends false ? string[][] : Pick<{
16
16
  name: string;
17
17
  email_id: string;
18
18
  owner: string;
@@ -82,16 +82,10 @@ export declare class ERPNextContact {
82
82
  is_primary_phone: boolean;
83
83
  is_primary_mobile_no: boolean;
84
84
  }[] | null | undefined;
85
- }, K extends ("name" | "email_id" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "docstatus" | "doctype" | "first_name" | "email_ids" | "sync_with_google_contacts" | "pulled_from_google_contacts" | "is_primary_contact" | "is_billing_contact" | "unsubscribed") | ("status" | "links" | "phone" | "last_name" | "middle_name" | "company" | "mobile_no" | "image" | "phone_nos") ? K : never>[]>;
86
- getById: <T extends import("zod").ZodTypeAny>({ resourceId, priority, }: {
85
+ }, TField>[]>;
86
+ getById: ({ resourceId, priority, }: {
87
87
  resourceId: string;
88
88
  priority?: number;
89
- }) => Promise<import("zod").TypeOf<T>>;
90
- updateById: <K extends import("zod").ZodTypeAny>({ resourceId, inputValidationModel, body, priority, }: {
91
- resourceId: string;
92
- inputValidationModel?: K;
93
- priority?: number;
94
- body: import("zod").TypeOf<K>;
95
89
  }) => Promise<{
96
90
  name: string;
97
91
  email_id: string;
@@ -163,9 +157,81 @@ export declare class ERPNextContact {
163
157
  is_primary_mobile_no: boolean;
164
158
  }[] | null | undefined;
165
159
  }>;
166
- deleteById: ({ resourceId, priority, }: {
160
+ updateById: <TInput extends TInputModel extends undefined ? Partial<{
161
+ name: string;
162
+ email_id: string;
163
+ owner: string;
164
+ creation: string;
165
+ modified: string;
166
+ modified_by: string;
167
+ idx: number;
168
+ docstatus: number;
169
+ doctype: string;
170
+ first_name: string;
171
+ email_ids: {
172
+ name: string;
173
+ email_id: string;
174
+ owner: string;
175
+ creation: string;
176
+ modified: string;
177
+ modified_by: string;
178
+ parent: string;
179
+ parentfield: string;
180
+ parenttype: string;
181
+ idx: number;
182
+ docstatus: number;
183
+ doctype: string;
184
+ is_primary: boolean;
185
+ }[];
186
+ sync_with_google_contacts: number;
187
+ pulled_from_google_contacts: boolean;
188
+ is_primary_contact: boolean;
189
+ is_billing_contact: boolean;
190
+ unsubscribed: boolean;
191
+ status?: string | null | undefined;
192
+ links?: {
193
+ name: string;
194
+ link_doctype: string;
195
+ link_name: string;
196
+ owner: string;
197
+ creation: string;
198
+ modified: string;
199
+ modified_by: string;
200
+ parent: string;
201
+ parentfield: string;
202
+ parenttype: string;
203
+ idx: number;
204
+ docstatus: number;
205
+ link_title: string;
206
+ doctype: string;
207
+ }[] | null | undefined;
208
+ phone?: string | null | undefined;
209
+ last_name?: string | null | undefined;
210
+ middle_name?: string | null | undefined;
211
+ company?: string | null | undefined;
212
+ mobile_no?: string | null | undefined;
213
+ image?: string | null | undefined;
214
+ phone_nos?: {
215
+ name: string;
216
+ owner: string;
217
+ creation: string;
218
+ modified: string;
219
+ modified_by: string;
220
+ parent: string;
221
+ parentfield: string;
222
+ parenttype: string;
223
+ idx: number;
224
+ docstatus: number;
225
+ doctype: string;
226
+ phone: string;
227
+ is_primary_phone: boolean;
228
+ is_primary_mobile_no: boolean;
229
+ }[] | null | undefined;
230
+ }> : TInputModel extends import("zod").ZodTypeAny ? import("zod").TypeOf<TInputModel> : any, TInputModel extends import("zod").ZodTypeAny | undefined = undefined>({ resourceId, inputValidationModel, body, priority, }: {
167
231
  resourceId: string;
232
+ inputValidationModel?: TInputModel;
168
233
  priority?: number;
234
+ body: TInput;
169
235
  }) => Promise<{
170
236
  name: string;
171
237
  email_id: string;
@@ -237,8 +303,12 @@ export declare class ERPNextContact {
237
303
  is_primary_mobile_no: boolean;
238
304
  }[] | null | undefined;
239
305
  }>;
306
+ deleteById: ({ resourceId, priority, }: {
307
+ resourceId: string;
308
+ priority?: number;
309
+ }) => Promise<import("zod").TypeOf<typeof import("../model/ERPNextResponse").DeleteResponseModel>>;
240
310
  constructor(temporalClient: TemporalClient);
241
- getContactsByAddressEmail: <K extends keyof (typeof Contact)["_type"]>(email: string, fields?: K[]) => Promise<string[][] | Pick<{
311
+ getContactsByAddressEmail: <K extends keyof (typeof Contact)["_type"]>(email: string, fields?: K[]) => Promise<Pick<{
242
312
  name: string;
243
313
  email_id: string;
244
314
  owner: string;
@@ -308,7 +378,7 @@ export declare class ERPNextContact {
308
378
  is_primary_phone: boolean;
309
379
  is_primary_mobile_no: boolean;
310
380
  }[] | null | undefined;
311
- }, K extends ("name" | "email_id" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "docstatus" | "doctype" | "first_name" | "email_ids" | "sync_with_google_contacts" | "pulled_from_google_contacts" | "is_primary_contact" | "is_billing_contact" | "unsubscribed") | ("status" | "links" | "phone" | "last_name" | "middle_name" | "company" | "mobile_no" | "image" | "phone_nos") ? K : never>[]>;
381
+ }, K>[]>;
312
382
  create: (contact: Omit<ContactPostBodyType, "links">, customerName: string) => Promise<{
313
383
  name: string;
314
384
  email_id: string;