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
package/dist/client.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.TemporalClient = void 0;
4
7
  const client_1 = require("@temporalio/client");
8
+ const zod_1 = __importDefault(require("zod"));
5
9
  const logger_1 = require("./utils/logger");
6
10
  const zodUtils_1 = require("./utils/zodUtils");
7
11
  const nanoid_1 = require("nanoid");
@@ -119,7 +123,9 @@ class TemporalClient {
119
123
  throw err;
120
124
  });
121
125
  logger_1.lg.info(`Started workflow ${runId}`);
122
- return data;
126
+ // console.log("TESTTEST", JSON.stringify(responseValidationModel, null, 2));
127
+ const validatedData = (0, zodUtils_1.validateData)(data, responseValidationModel ?? zod_1.default.any());
128
+ return validatedData;
123
129
  }
124
130
  }
125
131
  exports.TemporalClient = TemporalClient;
@@ -10,7 +10,7 @@ export declare class ERPNextDoctypeResourceRequest<TModel extends AnyZodObject>
10
10
  protected resourceModel: TModel;
11
11
  protected baseRequest: ERPNextResourceRequest;
12
12
  constructor(temporalClient: TemporalClient, resourceName: string, resourceModel: TModel);
13
- getList<TFieldOptions extends KeysOfModel<TModel>, TSelectedFields extends readonly TFieldOptions[] | readonly ["*"] | undefined = undefined, TAsDict extends boolean | undefined = undefined>({ fields, filters, skip, limit, priority, asDict, params, }?: {
13
+ getList<TFieldOptions extends KeysOfModel<TModel>, TSelectedFields extends readonly TFieldOptions[] | readonly ["*"] | undefined = undefined, TAsDict extends boolean | undefined = undefined>(args: {
14
14
  fields?: TSelectedFields;
15
15
  filters?: (string | string[])[][];
16
16
  skip?: number;
@@ -18,7 +18,18 @@ export declare class ERPNextDoctypeResourceRequest<TModel extends AnyZodObject>
18
18
  priority?: number;
19
19
  asDict?: TAsDict;
20
20
  params?: Record<string, string>;
21
+ resourceModel?: undefined;
21
22
  }): Promise<GetListReturnValue<TModel, TFieldOptions, TSelectedFields, TAsDict>>;
23
+ getList<TOverrideModel extends AnyZodObject, TFieldOptions extends KeysOfModel<TOverrideModel>, TSelectedFields extends readonly TFieldOptions[] | readonly ["*"] | undefined = undefined, TAsDict extends boolean | undefined = undefined>(args: {
24
+ fields?: TSelectedFields;
25
+ filters?: (string | string[])[][];
26
+ skip?: number;
27
+ limit?: number;
28
+ resourceModel: TOverrideModel;
29
+ priority?: number;
30
+ asDict?: TAsDict;
31
+ params?: Record<string, string>;
32
+ }): Promise<GetListReturnValue<TOverrideModel, TFieldOptions, TSelectedFields, TAsDict>>;
22
33
  getById({ resourceId, priority, }: {
23
34
  resourceId: string;
24
35
  priority?: number;
@@ -13,12 +13,12 @@ class ERPNextDoctypeResourceRequest {
13
13
  this.resourceModel = resourceModel.describe(resourceName);
14
14
  this.baseRequest = new resourceRequest_1.ERPNextResourceRequest(this.temporalClient);
15
15
  }
16
- async getList({ fields, filters, skip, limit, priority = 5, asDict, params, } = {}) {
16
+ async getList({ fields, filters, skip, limit, resourceModel, priority = 5, asDict, params, } = {}) {
17
17
  return await this.baseRequest.getList({
18
18
  resourceName: this.resourceName,
19
- resourceModel: this.resourceModel,
19
+ resourceModel: resourceModel ?? this.resourceModel,
20
20
  priority,
21
- ...(fields !== undefined ? { fields } : {}),
21
+ ...(fields !== undefined ? { fields: fields } : {}),
22
22
  ...(filters !== undefined ? { filters } : {}),
23
23
  ...(limit !== undefined ? { limit } : {}),
24
24
  ...(skip !== undefined ? { skip } : {}),
@@ -1,242 +1,12 @@
1
- import { z } from "zod";
2
1
  import { TemporalClient } from "../../client";
3
2
  import { ERPNextDoctypeResourceRequest } from "../doctypeResourceRequest";
4
3
  import { ERPNextMethodRequest } from "../methodRequest";
5
4
  import { Address, AddressInputType } from "../model/Address";
6
- export declare class ERPNextAddress {
7
- protected temporalClient: TemporalClient;
8
- protected baseRequest: ERPNextDoctypeResourceRequest<typeof Address>;
5
+ export declare class ERPNextAddress extends ERPNextDoctypeResourceRequest<typeof Address> {
9
6
  protected methodRequest: ERPNextMethodRequest;
10
- getList: <TFieldOptions extends ("docstatus" | "name" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "address_type" | "address_line1" | "pincode" | "city" | "country" | "is_primary_address" | "is_shipping_address" | "is_your_company_address" | "disabled") | ("_user_tags" | "import_reference" | "address_title" | "address_line2" | "state" | "phone" | "fax" | "tax_category" | "county" | "email_id" | "links"), TSelectedFields extends readonly ["*"] | readonly TFieldOptions[] | undefined = undefined, TAsDict extends boolean | undefined = undefined>({ fields, filters, skip, limit, priority, asDict, params, }?: {
11
- fields?: TSelectedFields;
12
- filters?: (string | string[])[][];
13
- skip?: number;
14
- limit?: number;
15
- priority?: number;
16
- asDict?: TAsDict;
17
- params?: Record<string, string>;
18
- }) => Promise<(TAsDict extends false ? string[][] : TSelectedFields extends undefined ? {
19
- name: string;
20
- }[] : TSelectedFields extends readonly ["*"] ? {
21
- docstatus: number;
22
- name: string;
23
- owner: string;
24
- creation: string;
25
- modified: string;
26
- modified_by: string;
27
- idx: number;
28
- address_type: string;
29
- address_line1: string;
30
- pincode: string;
31
- city: string;
32
- country: string;
33
- is_primary_address: 0 | 1;
34
- is_shipping_address: 0 | 1;
35
- is_your_company_address: 0 | 1;
36
- disabled: 0 | 1;
37
- _user_tags?: string | null | undefined;
38
- import_reference?: string | null | undefined;
39
- address_title?: string | null | undefined;
40
- address_line2?: string | null | undefined;
41
- state?: string | null | undefined;
42
- phone?: string | null | undefined;
43
- fax?: string | null | undefined;
44
- tax_category?: string | null | undefined;
45
- county?: string | null | undefined;
46
- email_id?: string | null | undefined;
47
- links?: {
48
- docstatus: number;
49
- name: string;
50
- owner: string;
51
- creation: string;
52
- modified: string;
53
- modified_by: string;
54
- idx: number;
55
- doctype: string;
56
- parent: string;
57
- parenttype: string;
58
- parentfield: string;
59
- link_doctype: string;
60
- link_name: string;
61
- _user_tags?: string | null | undefined;
62
- link_title?: string | null | undefined;
63
- }[] | undefined;
64
- }[] : 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 ("docstatus" | "name" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "address_type" | "address_line1" | "pincode" | "city" | "country" | "is_primary_address" | "is_shipping_address" | "is_your_company_address" | "disabled") | ("_user_tags" | "import_reference" | "address_title" | "address_line2" | "state" | "phone" | "fax" | "tax_category" | "county" | "email_id" | "links") ? {
65
- docstatus: number;
66
- name: string;
67
- owner: string;
68
- creation: string;
69
- modified: string;
70
- modified_by: string;
71
- idx: number;
72
- address_type: string;
73
- address_line1: string;
74
- pincode: string;
75
- city: string;
76
- country: string;
77
- is_primary_address: 0 | 1;
78
- is_shipping_address: 0 | 1;
79
- is_your_company_address: 0 | 1;
80
- disabled: 0 | 1;
81
- _user_tags?: string | null | undefined;
82
- import_reference?: string | null | undefined;
83
- address_title?: string | null | undefined;
84
- address_line2?: string | null | undefined;
85
- state?: string | null | undefined;
86
- phone?: string | null | undefined;
87
- fax?: string | null | undefined;
88
- tax_category?: string | null | undefined;
89
- county?: string | null | undefined;
90
- email_id?: string | null | undefined;
91
- links?: {
92
- docstatus: number;
93
- name: string;
94
- owner: string;
95
- creation: string;
96
- modified: string;
97
- modified_by: string;
98
- idx: number;
99
- doctype: string;
100
- parent: string;
101
- parenttype: string;
102
- parentfield: string;
103
- link_doctype: string;
104
- link_name: string;
105
- _user_tags?: string | null | undefined;
106
- link_title?: string | null | undefined;
107
- }[] | undefined;
108
- }[(("docstatus" | "name" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "address_type" | "address_line1" | "pincode" | "city" | "country" | "is_primary_address" | "is_shipping_address" | "is_your_company_address" | "disabled") | ("_user_tags" | "import_reference" | "address_title" | "address_line2" | "state" | "phone" | "fax" | "tax_category" | "county" | "email_id" | "links")) & (K_1 extends `${infer _Before} as ${infer Alias}` ? Alias : K_1)] : never; }[] : any) extends infer T ? { [K in keyof T]: T[K]; } : never>;
109
- getById: ({ resourceId, priority, }: {
110
- resourceId: string;
111
- priority?: number;
112
- }) => Promise<{
113
- docstatus: number;
114
- name: string;
115
- owner: string;
116
- creation: string;
117
- modified: string;
118
- modified_by: string;
119
- idx: number;
120
- doctype: string;
121
- address_type: string;
122
- address_line1: string;
123
- pincode: string;
124
- city: string;
125
- country: string;
126
- is_primary_address: 0 | 1;
127
- is_shipping_address: 0 | 1;
128
- is_your_company_address: 0 | 1;
129
- disabled: 0 | 1;
130
- _user_tags?: string | null | undefined;
131
- import_reference?: string | null | undefined;
132
- address_title?: string | null | undefined;
133
- address_line2?: string | null | undefined;
134
- state?: string | null | undefined;
135
- phone?: string | null | undefined;
136
- fax?: string | null | undefined;
137
- tax_category?: string | null | undefined;
138
- county?: string | null | undefined;
139
- email_id?: string | null | undefined;
140
- links?: {
141
- docstatus: number;
142
- name: string;
143
- owner: string;
144
- creation: string;
145
- modified: string;
146
- modified_by: string;
147
- idx: number;
148
- doctype: string;
149
- parent: string;
150
- parenttype: string;
151
- parentfield: string;
152
- link_doctype: string;
153
- link_name: string;
154
- _user_tags?: string | null | undefined;
155
- link_title?: string | null | undefined;
156
- }[] | undefined;
157
- } | undefined>;
158
- updateById: <TInput extends TInputModel extends undefined ? Partial<{
159
- address_type: string;
160
- address_line1: string;
161
- pincode: string;
162
- city: string;
163
- country: string;
164
- docstatus?: number | undefined;
165
- import_reference?: string | null | undefined;
166
- address_title?: string | null | undefined;
167
- address_line2?: string | null | undefined;
168
- state?: string | null | undefined;
169
- phone?: string | null | undefined;
170
- fax?: string | null | undefined;
171
- tax_category?: string | null | undefined;
172
- county?: string | null | undefined;
173
- email_id?: string | null | undefined;
174
- is_primary_address?: 0 | 1 | undefined;
175
- is_shipping_address?: 0 | 1 | undefined;
176
- is_your_company_address?: 0 | 1 | undefined;
177
- disabled?: 0 | 1 | undefined;
178
- links?: {
179
- link_doctype: string;
180
- link_name: string;
181
- link_title?: string | null | undefined;
182
- }[] | undefined;
183
- }> : TInputModel extends z.ZodTypeAny ? z.TypeOf<TInputModel> : any, TInputModel extends z.ZodTypeAny | undefined = undefined>({ resourceId, inputValidationModel, body, priority, }: {
184
- resourceId: string;
185
- inputValidationModel?: TInputModel;
186
- priority?: number;
187
- body: TInput;
188
- }) => Promise<{
189
- docstatus: number;
190
- name: string;
191
- owner: string;
192
- creation: string;
193
- modified: string;
194
- modified_by: string;
195
- idx: number;
196
- doctype: string;
197
- address_type: string;
198
- address_line1: string;
199
- pincode: string;
200
- city: string;
201
- country: string;
202
- is_primary_address: 0 | 1;
203
- is_shipping_address: 0 | 1;
204
- is_your_company_address: 0 | 1;
205
- disabled: 0 | 1;
206
- _user_tags?: string | null | undefined;
207
- import_reference?: string | null | undefined;
208
- address_title?: string | null | undefined;
209
- address_line2?: string | null | undefined;
210
- state?: string | null | undefined;
211
- phone?: string | null | undefined;
212
- fax?: string | null | undefined;
213
- tax_category?: string | null | undefined;
214
- county?: string | null | undefined;
215
- email_id?: string | null | undefined;
216
- links?: {
217
- docstatus: number;
218
- name: string;
219
- owner: string;
220
- creation: string;
221
- modified: string;
222
- modified_by: string;
223
- idx: number;
224
- doctype: string;
225
- parent: string;
226
- parenttype: string;
227
- parentfield: string;
228
- link_doctype: string;
229
- link_name: string;
230
- _user_tags?: string | null | undefined;
231
- link_title?: string | null | undefined;
232
- }[] | undefined;
233
- }>;
234
- deleteById: ({ resourceId, priority, }: {
235
- resourceId: string;
236
- priority?: number;
237
- }) => Promise<z.TypeOf<typeof import("../model/ERPNextResponse").DeleteResponseModel>>;
238
7
  constructor(temporalClient: TemporalClient);
239
- create(address: AddressInputType, customerName: string): Promise<{
8
+ /** Create an address linked to a customer. */
9
+ createForCustomer(address: AddressInputType, customerName: string): Promise<{
240
10
  docstatus: number;
241
11
  name: string;
242
12
  owner: string;
@@ -9,25 +9,15 @@ const Address_1 = require("../model/Address");
9
9
  const DocInfo_1 = require("../model/DocInfo");
10
10
  const DocTypeHelpers_1 = require("../model/DocTypeHelpers");
11
11
  const Supplier_1 = require("../model/Supplier");
12
- class ERPNextAddress {
13
- temporalClient;
14
- baseRequest;
12
+ class ERPNextAddress extends doctypeResourceRequest_1.ERPNextDoctypeResourceRequest {
15
13
  methodRequest;
16
- getList;
17
- getById;
18
- updateById;
19
- deleteById;
20
14
  constructor(temporalClient) {
21
- this.temporalClient = temporalClient;
22
- this.baseRequest = new doctypeResourceRequest_1.ERPNextDoctypeResourceRequest(temporalClient, "Address", Address_1.Address);
15
+ super(temporalClient, "Address", Address_1.Address);
23
16
  this.methodRequest = new methodRequest_1.ERPNextMethodRequest(temporalClient);
24
- this.getList = this.baseRequest.getList;
25
- this.getById = this.baseRequest.getById;
26
- this.updateById = this.baseRequest.updateById;
27
- this.deleteById = this.baseRequest.deleteById;
28
17
  }
29
- async create(address, customerName) {
30
- const result = await this.baseRequest.create({
18
+ /** Create an address linked to a customer. */
19
+ async createForCustomer(address, customerName) {
20
+ return this.create({
31
21
  body: {
32
22
  ...address,
33
23
  links: [
@@ -38,7 +28,6 @@ class ERPNextAddress {
38
28
  ],
39
29
  },
40
30
  });
41
- return result;
42
31
  }
43
32
  getAddressesByEmail = async (email, fields = ["name"]) => {
44
33
  const result = await this.getList({