erpnext-queue-client 2.5.2 → 2.5.4

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/dist/client.js CHANGED
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.TemporalClient = void 0;
7
4
  const client_1 = require("@temporalio/client");
8
- const zod_1 = __importDefault(require("zod"));
9
5
  const logger_1 = require("./utils/logger");
10
6
  const zodUtils_1 = require("./utils/zodUtils");
11
7
  const nanoid_1 = require("nanoid");
@@ -123,9 +119,12 @@ class TemporalClient {
123
119
  throw err;
124
120
  });
125
121
  logger_1.lg.info(`Started workflow ${runId}`);
126
- // console.log("TESTTEST", JSON.stringify(responseValidationModel, null, 2));
127
- const validatedData = (0, zodUtils_1.validateData)(data, responseValidationModel ?? zod_1.default.any().describe("Fallback any"));
128
- return validatedData;
122
+ if (responseValidationModel) {
123
+ return (0, zodUtils_1.validateData)(data, responseValidationModel);
124
+ }
125
+ else {
126
+ return data;
127
+ }
129
128
  }
130
129
  }
131
130
  exports.TemporalClient = TemporalClient;
@@ -7,12 +7,14 @@ export declare class ERPNextShipment extends ERPNextDoctypeSubmittableResourceRe
7
7
  constructor(temporalClient: TemporalClient);
8
8
  createShipmentDraft(deliveryNoteName: string): Promise<{
9
9
  status: string;
10
- shipment_id: string;
10
+ docstatus: number;
11
+ owner: string;
12
+ idx: number;
13
+ doctype: string;
11
14
  delivery_address_name: string;
12
15
  delivery_address: string;
13
16
  delivery_customer: string;
14
17
  delivery_to_type: string;
15
- description_of_content: string;
16
18
  pallets: string;
17
19
  pickup_address_name: string;
18
20
  pickup_address: string;
@@ -20,53 +22,28 @@ export declare class ERPNextShipment extends ERPNextDoctypeSubmittableResourceRe
20
22
  pickup_contact_email: string;
21
23
  pickup_contact_person: string;
22
24
  pickup_contact: string;
23
- pickup_date: string;
24
25
  pickup_from_type: string;
25
26
  pickup_from: string;
26
27
  pickup_to: string;
27
28
  pickup_type: string;
28
29
  shipment_amount: number;
29
- shipment_delivery_note: {
30
+ shipment_delivery_note: ({
30
31
  delivery_note: string;
32
+ grand_total: number;
31
33
  __unsaved?: number | null | undefined;
32
- grand_total?: number | undefined;
33
- }[];
34
- shipment_parcel: {
35
- length: number;
36
- count: number;
37
- width: number;
38
- height: number;
39
- weight: number;
40
- }[];
34
+ __islocal?: number | null | undefined;
35
+ } | undefined)[];
36
+ shipment_parcel: any[];
41
37
  shipment_type: string;
42
38
  tracking_status: string;
43
39
  value_of_goods: number;
44
- docstatus?: number | undefined;
40
+ __onload?: {
41
+ load_after_mapping: boolean;
42
+ } | null | undefined;
43
+ __unsaved?: number | null | undefined;
45
44
  incoterm?: string | null | undefined;
46
- shipping_provider?: string | null | undefined;
47
- awb_number?: string | null | undefined;
48
- carrier_service?: string | null | undefined;
49
- carrier?: string | null | undefined;
50
- delivery_company?: string | null | undefined;
51
- delivery_contact_email?: string | null | undefined;
52
- delivery_contact_name?: string | null | undefined;
53
- delivery_contact?: string | null | undefined;
54
- delivery_supplier?: string | null | undefined;
55
- delivery_to?: string | null | undefined;
56
- parcel_template?: string | null | undefined;
57
- pickup_contact_name?: string | null | undefined;
58
- pickup_customer?: string | null | undefined;
59
- pickup_supplier?: string | null | undefined;
60
- pickup?: string | null | undefined;
61
- service_provider?: string | null | undefined;
62
- shipping_label?: string | null | undefined;
63
- custom_return_label?: string | null | undefined;
64
- custom_return_shipping_provider?: string | null | undefined;
65
- tracking_status_info?: string | null | undefined;
66
- tracking_url?: string | null | undefined;
67
- custom_delivery_country?: string | undefined;
68
- custom_is_export?: number | null | undefined;
69
- custom_export_status?: "Open" | "Customs Declaration in Progress" | "Customs Declaration Submitted" | "Customs Declaration Confirmed" | null | undefined;
45
+ __islocal?: number | null | undefined;
46
+ delivery_contact?: string | undefined;
70
47
  }>;
71
48
  getShipmentInfoByOrderNumber(orderNumber: string): Promise<{
72
49
  name: string;
@@ -99,7 +76,6 @@ export declare class ERPNextShipment extends ERPNextDoctypeSubmittableResourceRe
99
76
  delivery_address: string;
100
77
  delivery_customer: string;
101
78
  delivery_to_type: string;
102
- description_of_content: string;
103
79
  pallets: string;
104
80
  pickup_address_name: string;
105
81
  pickup_address: string;
@@ -107,7 +83,6 @@ export declare class ERPNextShipment extends ERPNextDoctypeSubmittableResourceRe
107
83
  pickup_contact_email: string;
108
84
  pickup_contact_person: string;
109
85
  pickup_contact: string;
110
- pickup_date: string;
111
86
  pickup_from_type: string;
112
87
  pickup_from: string;
113
88
  pickup_to: string;
@@ -152,18 +127,20 @@ export declare class ERPNextShipment extends ERPNextDoctypeSubmittableResourceRe
152
127
  shipment_type: string;
153
128
  tracking_status: string;
154
129
  value_of_goods: number;
130
+ description_of_content: string;
131
+ pickup_date: string;
155
132
  custom_delivery_country: string;
156
133
  amended_from?: string | null | undefined;
157
134
  _user_tags?: string | null | undefined;
158
135
  incoterm?: string | null | undefined;
159
136
  shipping_provider?: string | null | undefined;
137
+ delivery_contact?: string | null | undefined;
160
138
  awb_number?: string | null | undefined;
161
139
  carrier_service?: string | null | undefined;
162
140
  carrier?: string | null | undefined;
163
141
  delivery_company?: string | null | undefined;
164
142
  delivery_contact_email?: string | null | undefined;
165
143
  delivery_contact_name?: string | null | undefined;
166
- delivery_contact?: string | null | undefined;
167
144
  delivery_supplier?: string | null | undefined;
168
145
  delivery_to?: string | null | undefined;
169
146
  parcel_template?: string | null | undefined;
@@ -4,7 +4,6 @@ exports.ERPNextShipment = void 0;
4
4
  const doctypeSubmittableResourceRequest_1 = require("../doctypeSubmittableResourceRequest");
5
5
  const methodRequest_1 = require("../methodRequest");
6
6
  const Shipment_1 = require("../model/Shipment");
7
- const zodContextOptionals_1 = require("../../utils/zodContextOptionals");
8
7
  class ERPNextShipment extends doctypeSubmittableResourceRequest_1.ERPNextDoctypeSubmittableResourceRequest {
9
8
  methodRequest;
10
9
  constructor(temporalClient) {
@@ -15,7 +14,7 @@ class ERPNextShipment extends doctypeSubmittableResourceRequest_1.ERPNextDoctype
15
14
  const draft = await this.methodRequest.request({
16
15
  methodName: "erpnext.stock.doctype.delivery_note.delivery_note.make_shipment",
17
16
  requestMethod: "POST",
18
- responseValidationModel: (0, zodContextOptionals_1.ResourceInput)(Shipment_1.Shipment),
17
+ responseValidationModel: Shipment_1.ShipmentDraftFromDeliveryNote,
19
18
  params: { source_name: deliveryNoteName },
20
19
  });
21
20
  return draft;
@@ -1,4 +1,136 @@
1
1
  import { z } from "zod";
2
+ export declare const ShipmentDraftFromDeliveryNote: z.ZodObject<{
3
+ __islocal: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
4
+ __onload: z.ZodNullable<z.ZodOptional<z.ZodObject<{
5
+ load_after_mapping: z.ZodBoolean;
6
+ }, "strip", z.ZodTypeAny, {
7
+ load_after_mapping: boolean;
8
+ }, {
9
+ load_after_mapping: boolean;
10
+ }>>>;
11
+ __unsaved: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
12
+ delivery_address_name: z.ZodString;
13
+ delivery_address: z.ZodString;
14
+ delivery_contact: z.ZodOptional<z.ZodString>;
15
+ delivery_customer: z.ZodString;
16
+ delivery_to_type: z.ZodString;
17
+ docstatus: z.ZodNumber;
18
+ doctype: z.ZodString;
19
+ idx: z.ZodNumber;
20
+ incoterm: z.ZodNullable<z.ZodOptional<z.ZodString>>;
21
+ owner: z.ZodString;
22
+ pallets: z.ZodString;
23
+ pickup_address_name: z.ZodString;
24
+ pickup_address: z.ZodString;
25
+ pickup_company: z.ZodString;
26
+ pickup_contact_email: z.ZodString;
27
+ pickup_contact_person: z.ZodString;
28
+ pickup_contact: z.ZodString;
29
+ pickup_from_type: z.ZodString;
30
+ pickup_from: z.ZodString;
31
+ pickup_to: z.ZodString;
32
+ pickup_type: z.ZodString;
33
+ shipment_amount: z.ZodNumber;
34
+ shipment_delivery_note: z.ZodArray<z.ZodOptional<z.ZodObject<{
35
+ delivery_note: z.ZodString;
36
+ grand_total: z.ZodNumber;
37
+ __islocal: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
38
+ __unsaved: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ delivery_note: string;
41
+ grand_total: number;
42
+ __unsaved?: number | null | undefined;
43
+ __islocal?: number | null | undefined;
44
+ }, {
45
+ delivery_note: string;
46
+ grand_total: number;
47
+ __unsaved?: number | null | undefined;
48
+ __islocal?: number | null | undefined;
49
+ }>>, "many">;
50
+ shipment_parcel: z.ZodArray<z.ZodOptional<z.ZodAny>, "many">;
51
+ shipment_type: z.ZodString;
52
+ status: z.ZodString;
53
+ tracking_status: z.ZodString;
54
+ value_of_goods: z.ZodNumber;
55
+ }, "strip", z.ZodTypeAny, {
56
+ status: string;
57
+ docstatus: number;
58
+ owner: string;
59
+ idx: number;
60
+ doctype: string;
61
+ delivery_address_name: string;
62
+ delivery_address: string;
63
+ delivery_customer: string;
64
+ delivery_to_type: string;
65
+ pallets: string;
66
+ pickup_address_name: string;
67
+ pickup_address: string;
68
+ pickup_company: string;
69
+ pickup_contact_email: string;
70
+ pickup_contact_person: string;
71
+ pickup_contact: string;
72
+ pickup_from_type: string;
73
+ pickup_from: string;
74
+ pickup_to: string;
75
+ pickup_type: string;
76
+ shipment_amount: number;
77
+ shipment_delivery_note: ({
78
+ delivery_note: string;
79
+ grand_total: number;
80
+ __unsaved?: number | null | undefined;
81
+ __islocal?: number | null | undefined;
82
+ } | undefined)[];
83
+ shipment_parcel: any[];
84
+ shipment_type: string;
85
+ tracking_status: string;
86
+ value_of_goods: number;
87
+ __onload?: {
88
+ load_after_mapping: boolean;
89
+ } | null | undefined;
90
+ __unsaved?: number | null | undefined;
91
+ incoterm?: string | null | undefined;
92
+ __islocal?: number | null | undefined;
93
+ delivery_contact?: string | undefined;
94
+ }, {
95
+ status: string;
96
+ docstatus: number;
97
+ owner: string;
98
+ idx: number;
99
+ doctype: string;
100
+ delivery_address_name: string;
101
+ delivery_address: string;
102
+ delivery_customer: string;
103
+ delivery_to_type: string;
104
+ pallets: string;
105
+ pickup_address_name: string;
106
+ pickup_address: string;
107
+ pickup_company: string;
108
+ pickup_contact_email: string;
109
+ pickup_contact_person: string;
110
+ pickup_contact: string;
111
+ pickup_from_type: string;
112
+ pickup_from: string;
113
+ pickup_to: string;
114
+ pickup_type: string;
115
+ shipment_amount: number;
116
+ shipment_delivery_note: ({
117
+ delivery_note: string;
118
+ grand_total: number;
119
+ __unsaved?: number | null | undefined;
120
+ __islocal?: number | null | undefined;
121
+ } | undefined)[];
122
+ shipment_parcel: any[];
123
+ shipment_type: string;
124
+ tracking_status: string;
125
+ value_of_goods: number;
126
+ __onload?: {
127
+ load_after_mapping: boolean;
128
+ } | null | undefined;
129
+ __unsaved?: number | null | undefined;
130
+ incoterm?: string | null | undefined;
131
+ __islocal?: number | null | undefined;
132
+ delivery_contact?: string | undefined;
133
+ }>;
2
134
  export declare const ShipmentExportStatus: z.ZodNullable<z.ZodOptional<z.ZodDefault<z.ZodEnum<["Open", "Customs Declaration in Progress", "Customs Declaration Submitted", "Customs Declaration Confirmed"]>>>>;
3
135
  export type ShipmentExportStatusType = z.infer<typeof ShipmentExportStatus>;
4
136
  export declare const ShipmentParcel: z.ZodObject<{
@@ -112,7 +244,6 @@ export declare const Shipment: z.ZodObject<{
112
244
  delivery_address: string;
113
245
  delivery_customer: string;
114
246
  delivery_to_type: string;
115
- description_of_content: string;
116
247
  pallets: string;
117
248
  pickup_address_name: string;
118
249
  pickup_address: string;
@@ -120,7 +251,6 @@ export declare const Shipment: z.ZodObject<{
120
251
  pickup_contact_email: string;
121
252
  pickup_contact_person: string;
122
253
  pickup_contact: string;
123
- pickup_date: string;
124
254
  pickup_from_type: string;
125
255
  pickup_from: string;
126
256
  pickup_to: string;
@@ -141,16 +271,18 @@ export declare const Shipment: z.ZodObject<{
141
271
  shipment_type: string;
142
272
  tracking_status: string;
143
273
  value_of_goods: number;
274
+ description_of_content: string;
275
+ pickup_date: string;
144
276
  custom_delivery_country: string;
145
277
  incoterm?: string | null | undefined;
146
278
  shipping_provider?: string | null | undefined;
279
+ delivery_contact?: string | null | undefined;
147
280
  awb_number?: string | null | undefined;
148
281
  carrier_service?: string | null | undefined;
149
282
  carrier?: string | null | undefined;
150
283
  delivery_company?: string | null | undefined;
151
284
  delivery_contact_email?: string | null | undefined;
152
285
  delivery_contact_name?: string | null | undefined;
153
- delivery_contact?: string | null | undefined;
154
286
  delivery_supplier?: string | null | undefined;
155
287
  delivery_to?: string | null | undefined;
156
288
  parcel_template?: string | null | undefined;
@@ -173,7 +305,6 @@ export declare const Shipment: z.ZodObject<{
173
305
  delivery_address: string;
174
306
  delivery_customer: string;
175
307
  delivery_to_type: string;
176
- description_of_content: string;
177
308
  pallets: string;
178
309
  pickup_address_name: string;
179
310
  pickup_address: string;
@@ -181,7 +312,6 @@ export declare const Shipment: z.ZodObject<{
181
312
  pickup_contact_email: string;
182
313
  pickup_contact_person: string;
183
314
  pickup_contact: string;
184
- pickup_date: string;
185
315
  pickup_from_type: string;
186
316
  pickup_from: string;
187
317
  pickup_to: string;
@@ -202,16 +332,18 @@ export declare const Shipment: z.ZodObject<{
202
332
  shipment_type: string;
203
333
  tracking_status: string;
204
334
  value_of_goods: number;
335
+ description_of_content: string;
336
+ pickup_date: string;
205
337
  custom_delivery_country: string;
206
338
  incoterm?: string | null | undefined;
207
339
  shipping_provider?: string | null | undefined;
340
+ delivery_contact?: string | null | undefined;
208
341
  awb_number?: string | null | undefined;
209
342
  carrier_service?: string | null | undefined;
210
343
  carrier?: string | null | undefined;
211
344
  delivery_company?: string | null | undefined;
212
345
  delivery_contact_email?: string | null | undefined;
213
346
  delivery_contact_name?: string | null | undefined;
214
- delivery_contact?: string | null | undefined;
215
347
  delivery_supplier?: string | null | undefined;
216
348
  delivery_to?: string | null | undefined;
217
349
  parcel_template?: string | null | undefined;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ShipmentInfoByOrderNumberMethodResponseData = exports.ShipmentAddShippingLabelAndSubmitBody = exports.Shipment = exports.ShipmentParcel = exports.ShipmentExportStatus = void 0;
3
+ exports.ShipmentInfoByOrderNumberMethodResponseData = exports.ShipmentAddShippingLabelAndSubmitBody = exports.Shipment = exports.ShipmentParcel = exports.ShipmentExportStatus = exports.ShipmentDraftFromDeliveryNote = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const zodContextOptionals_1 = require("../../utils/zodContextOptionals");
6
6
  const DocTypeHelpers_1 = require("./DocTypeHelpers");
@@ -17,6 +17,42 @@ const ShipmentDraftDeliveryNote = zod_1.z
17
17
  __unsaved: zod_1.z.number().optional().nullable(),
18
18
  })
19
19
  .describe("Shipment Draft Delivery Note");
20
+ // This is a custom subset of field from the Shipment model that represents the data that is returned from the conversion function.
21
+ exports.ShipmentDraftFromDeliveryNote = zod_1.z
22
+ .object({
23
+ __islocal: zod_1.z.number().optional().nullable(),
24
+ __onload: Onload.optional().nullable(),
25
+ __unsaved: zod_1.z.number().optional().nullable(),
26
+ delivery_address_name: zod_1.z.string(),
27
+ delivery_address: zod_1.z.string(),
28
+ delivery_contact: zod_1.z.string().optional(),
29
+ delivery_customer: zod_1.z.string(),
30
+ delivery_to_type: zod_1.z.string(),
31
+ docstatus: zod_1.z.number(),
32
+ doctype: zod_1.z.string(),
33
+ idx: zod_1.z.number(),
34
+ incoterm: zod_1.z.string().optional().nullable(),
35
+ owner: zod_1.z.string(),
36
+ pallets: zod_1.z.string(),
37
+ pickup_address_name: zod_1.z.string(),
38
+ pickup_address: zod_1.z.string(),
39
+ pickup_company: zod_1.z.string(),
40
+ pickup_contact_email: zod_1.z.string(),
41
+ pickup_contact_person: zod_1.z.string(),
42
+ pickup_contact: zod_1.z.string(),
43
+ pickup_from_type: zod_1.z.string(),
44
+ pickup_from: zod_1.z.string(),
45
+ pickup_to: zod_1.z.string(),
46
+ pickup_type: zod_1.z.string(),
47
+ shipment_amount: zod_1.z.number(),
48
+ shipment_delivery_note: zod_1.z.array(ShipmentDraftDeliveryNote.optional()),
49
+ shipment_parcel: zod_1.z.array(zod_1.z.any().optional()),
50
+ shipment_type: zod_1.z.string(),
51
+ status: zod_1.z.string(),
52
+ tracking_status: zod_1.z.string(),
53
+ value_of_goods: zod_1.z.number(),
54
+ })
55
+ .describe("Shipment Draft From Delivery Note");
20
56
  exports.ShipmentExportStatus = zod_1.z
21
57
  .enum([
22
58
  "Open",
package/package.json CHANGED
@@ -30,7 +30,7 @@
30
30
  "winston": "^3.15.0",
31
31
  "zod": "3.25.76"
32
32
  },
33
- "version": "2.5.2",
33
+ "version": "2.5.4",
34
34
  "devDependencies": {
35
35
  "@types/crypto-js": "^4.2.2",
36
36
  "@types/lodash": "^4.17.13",