erpnext-queue-client 1.0.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.
- package/dist/client.d.ts +25 -0
- package/dist/client.js +141 -0
- package/dist/constants.d.ts +6 -0
- package/dist/constants.js +26 -0
- package/dist/erpnext/decryptFromErpNext.server.d.ts +2 -0
- package/dist/erpnext/decryptFromErpNext.server.js +17 -0
- package/dist/erpnext/decryptFromErpNext.server.test.d.ts +1 -0
- package/dist/erpnext/decryptFromErpNext.server.test.js +30 -0
- package/dist/erpnext/erpnextRequestWrapper.d.ts +5 -0
- package/dist/erpnext/erpnextRequestWrapper.js +91 -0
- package/dist/erpnext/erpnextRequests.d.ts +1786 -0
- package/dist/erpnext/erpnextRequests.js +339 -0
- package/dist/erpnext/model/Address.d.ts +349 -0
- package/dist/erpnext/model/Address.js +99 -0
- package/dist/erpnext/model/Contact.d.ts +546 -0
- package/dist/erpnext/model/Contact.js +118 -0
- package/dist/erpnext/model/Country.d.ts +78 -0
- package/dist/erpnext/model/Country.js +30 -0
- package/dist/erpnext/model/Customer.d.ts +99 -0
- package/dist/erpnext/model/Customer.js +42 -0
- package/dist/erpnext/model/DateSchema.d.ts +2 -0
- package/dist/erpnext/model/DateSchema.js +8 -0
- package/dist/erpnext/model/DeliveryNote.d.ts +1648 -0
- package/dist/erpnext/model/DeliveryNote.js +219 -0
- package/dist/erpnext/model/DispatchRun.d.ts +688 -0
- package/dist/erpnext/model/DispatchRun.js +167 -0
- package/dist/erpnext/model/DispatcherPreset.d.ts +159 -0
- package/dist/erpnext/model/DispatcherPreset.js +43 -0
- package/dist/erpnext/model/ERPNextQueue.d.ts +48 -0
- package/dist/erpnext/model/ERPNextQueue.js +5 -0
- package/dist/erpnext/model/ERPNextRequest.d.ts +29 -0
- package/dist/erpnext/model/ERPNextRequest.js +2 -0
- package/dist/erpnext/model/ERPNextResponse.d.ts +17 -0
- package/dist/erpnext/model/ERPNextResponse.js +18 -0
- package/dist/erpnext/model/File.d.ts +146 -0
- package/dist/erpnext/model/File.js +36 -0
- package/dist/erpnext/model/Fulfiller.d.ts +175 -0
- package/dist/erpnext/model/Fulfiller.js +79 -0
- package/dist/erpnext/model/FulfillerSettings.d.ts +130 -0
- package/dist/erpnext/model/FulfillerSettings.js +34 -0
- package/dist/erpnext/model/FulfillmentStation.d.ts +9 -0
- package/dist/erpnext/model/FulfillmentStation.js +9 -0
- package/dist/erpnext/model/Item.d.ts +1710 -0
- package/dist/erpnext/model/Item.js +239 -0
- package/dist/erpnext/model/ProjectedQuantityReport.d.ts +281 -0
- package/dist/erpnext/model/ProjectedQuantityReport.js +72 -0
- package/dist/erpnext/model/PurchaseOrder.d.ts +906 -0
- package/dist/erpnext/model/PurchaseOrder.js +248 -0
- package/dist/erpnext/model/Receipt.d.ts +790 -0
- package/dist/erpnext/model/Receipt.js +212 -0
- package/dist/erpnext/model/ReceiptDraft.d.ts +541 -0
- package/dist/erpnext/model/ReceiptDraft.js +149 -0
- package/dist/erpnext/model/Shipment.d.ts +1139 -0
- package/dist/erpnext/model/Shipment.js +191 -0
- package/dist/erpnext/model/ShippingProvider.d.ts +434 -0
- package/dist/erpnext/model/ShippingProvider.js +204 -0
- package/dist/erpnext/model/StockDict.d.ts +3 -0
- package/dist/erpnext/model/StockDict.js +7 -0
- package/dist/erpnext/model/WarehouseCategory.d.ts +20 -0
- package/dist/erpnext/model/WarehouseCategory.js +15 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +18 -0
- package/dist/utils/fernet.server.d.ts +150 -0
- package/dist/utils/fernet.server.js +344 -0
- package/dist/utils/logger.d.ts +5 -0
- package/dist/utils/logger.js +45 -0
- package/dist/utils/request.d.ts +28 -0
- package/dist/utils/request.js +107 -0
- package/dist/utils/utils.d.ts +4 -0
- package/dist/utils/utils.js +23 -0
- package/dist/utils/zodUtils.d.ts +2 -0
- package/dist/utils/zodUtils.js +17 -0
- package/package.json +32 -0
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.erpnextRequests = erpnextRequests;
|
|
13
|
+
const lodash_1 = require("lodash");
|
|
14
|
+
const Address_1 = require("./model/Address");
|
|
15
|
+
const Item_1 = require("./model/Item");
|
|
16
|
+
const ProjectedQuantityReport_1 = require("./model/ProjectedQuantityReport");
|
|
17
|
+
const Shipment_1 = require("./model/Shipment");
|
|
18
|
+
const utils_1 = require("../utils/utils");
|
|
19
|
+
const Address_2 = require("./model/Address");
|
|
20
|
+
const Contact_1 = require("./model/Contact");
|
|
21
|
+
const Country_1 = require("./model/Country");
|
|
22
|
+
const Customer_1 = require("./model/Customer");
|
|
23
|
+
const DeliveryNote_1 = require("./model/DeliveryNote");
|
|
24
|
+
const File_1 = require("./model/File");
|
|
25
|
+
const PurchaseOrder_1 = require("./model/PurchaseOrder");
|
|
26
|
+
const Receipt_1 = require("./model/Receipt");
|
|
27
|
+
const ReceiptDraft_1 = require("./model/ReceiptDraft");
|
|
28
|
+
const StockDict_1 = require("./model/StockDict");
|
|
29
|
+
const ShippingProvider_1 = require("./model/ShippingProvider");
|
|
30
|
+
function erpnextRequests(client) {
|
|
31
|
+
/* --------------------------------- Country -------------------------------- */
|
|
32
|
+
return {
|
|
33
|
+
getCountryList: () => __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const result = yield client.executeERPNextRequest("getCountryList", {
|
|
35
|
+
requestMethod: "GET",
|
|
36
|
+
responseValidationModel: (0, Country_1.CountryList)(["name", "code"]),
|
|
37
|
+
resourceName: "Country",
|
|
38
|
+
params: `?fields=["name", "code"]`,
|
|
39
|
+
}, "erpnext");
|
|
40
|
+
return result;
|
|
41
|
+
}),
|
|
42
|
+
/* --------------------------------- Address --------------------------------- */
|
|
43
|
+
createShippingAddress: (address_1, ...args_1) => __awaiter(this, [address_1, ...args_1], void 0, function* (address, customerName = "") {
|
|
44
|
+
const result = yield client.executeERPNextRequest("createShippingAddress", {
|
|
45
|
+
requestMethod: "POST",
|
|
46
|
+
responseValidationModel: Address_2.Address,
|
|
47
|
+
resourceName: "Address",
|
|
48
|
+
body: Object.assign(Object.assign({}, address), { links: [
|
|
49
|
+
{
|
|
50
|
+
link_doctype: "Customer",
|
|
51
|
+
link_name: customerName,
|
|
52
|
+
},
|
|
53
|
+
] }),
|
|
54
|
+
}, "erpnext");
|
|
55
|
+
return result;
|
|
56
|
+
}),
|
|
57
|
+
getAddressById: (id) => __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const result = yield client.executeERPNextRequest("getAddressById", {
|
|
59
|
+
requestMethod: "GET",
|
|
60
|
+
responseValidationModel: Address_2.Address,
|
|
61
|
+
resourceName: "Address",
|
|
62
|
+
resourceId: encodeURIComponent(id),
|
|
63
|
+
}, "erpnext");
|
|
64
|
+
return result;
|
|
65
|
+
}),
|
|
66
|
+
/* ------------------------------- AddressList ------------------------------ */
|
|
67
|
+
getAddressesByEmail: (email) => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
const result = yield client.executeERPNextRequest("getAddressesByEmail", {
|
|
69
|
+
requestMethod: "GET",
|
|
70
|
+
responseValidationModel: Address_1.AddressListName,
|
|
71
|
+
resourceName: "Address",
|
|
72
|
+
params: `?fields=["name"]&filters=[["email_id","=","${encodeURIComponent(email)}"]]`,
|
|
73
|
+
}, "erpnext");
|
|
74
|
+
return result;
|
|
75
|
+
}),
|
|
76
|
+
getAddressesByAddressFields: (address) => __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
const searchCriteria = [];
|
|
78
|
+
if (address.address_line1)
|
|
79
|
+
searchCriteria.push(["address_line1", "=", address.address_line1]);
|
|
80
|
+
if (address.city)
|
|
81
|
+
searchCriteria.push(["city", "=", address.city]);
|
|
82
|
+
if (address.pincode)
|
|
83
|
+
searchCriteria.push(["pincode", "=", address.pincode]);
|
|
84
|
+
if (address.phone)
|
|
85
|
+
searchCriteria.push(["phone", "=", address.phone]);
|
|
86
|
+
if (address.email_id)
|
|
87
|
+
searchCriteria.push(["email_id", "=", address.email_id]);
|
|
88
|
+
const result = yield client.executeERPNextRequest("getAddressesByAddressFields", {
|
|
89
|
+
requestMethod: "GET",
|
|
90
|
+
responseValidationModel: Address_1.AddressListName,
|
|
91
|
+
resourceName: "Address",
|
|
92
|
+
params: `?fields=["name"]&filters=${encodeURIComponent(JSON.stringify(searchCriteria))}`,
|
|
93
|
+
}, "erpnext");
|
|
94
|
+
return result;
|
|
95
|
+
}),
|
|
96
|
+
/* ------------------------------- Contact -------------------------------- */
|
|
97
|
+
getContactById: (id) => __awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
const result = yield client.executeERPNextRequest("getContactById", {
|
|
99
|
+
requestMethod: "GET",
|
|
100
|
+
responseValidationModel: Contact_1.Contact,
|
|
101
|
+
resourceName: "Contact",
|
|
102
|
+
resourceId: encodeURIComponent(id),
|
|
103
|
+
}, "erpnext");
|
|
104
|
+
return result;
|
|
105
|
+
}),
|
|
106
|
+
getContactsByAddressEmail: (address) => __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
const searchCriteria = [];
|
|
108
|
+
if (address.email_id)
|
|
109
|
+
searchCriteria.push(["Contact", "email_id", "=", address.email_id]);
|
|
110
|
+
const result = yield client.executeERPNextRequest("getContactsByAddressEmail", {
|
|
111
|
+
requestMethod: "GET",
|
|
112
|
+
responseValidationModel: Contact_1.ContactListName,
|
|
113
|
+
resourceName: "Contact",
|
|
114
|
+
params: `?fields=["name"]&filters=${encodeURIComponent(JSON.stringify(searchCriteria))}`,
|
|
115
|
+
}, "erpnext");
|
|
116
|
+
return result;
|
|
117
|
+
}),
|
|
118
|
+
createContact: (contact_1, ...args_1) => __awaiter(this, [contact_1, ...args_1], void 0, function* (contact, customerName = "") {
|
|
119
|
+
const result = yield client.executeERPNextRequest("createContact", {
|
|
120
|
+
requestMethod: "POST",
|
|
121
|
+
responseValidationModel: Contact_1.Contact,
|
|
122
|
+
resourceName: "Contact",
|
|
123
|
+
body: Object.assign(Object.assign({}, contact), { links: [
|
|
124
|
+
{
|
|
125
|
+
link_doctype: "Customer",
|
|
126
|
+
link_name: customerName,
|
|
127
|
+
},
|
|
128
|
+
] }),
|
|
129
|
+
}, "erpnext");
|
|
130
|
+
return result;
|
|
131
|
+
}),
|
|
132
|
+
/* ------------------------------- Customer ------------------------------ */
|
|
133
|
+
createCustomer: (body) => __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
const result = yield client.executeERPNextRequest("createCustomer", {
|
|
135
|
+
requestMethod: "POST",
|
|
136
|
+
responseValidationModel: Customer_1.Customer,
|
|
137
|
+
resourceName: "Customer",
|
|
138
|
+
body,
|
|
139
|
+
}, "erpnext");
|
|
140
|
+
return result;
|
|
141
|
+
}),
|
|
142
|
+
getDeliveryNote: (deliveryNoteErpNextName) => __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
return yield client.executeERPNextRequest("getDeliveryNote", {
|
|
144
|
+
resourceName: "Delivery Note",
|
|
145
|
+
requestMethod: "GET",
|
|
146
|
+
responseValidationModel: DeliveryNote_1.DeliveryNote,
|
|
147
|
+
resourceId: deliveryNoteErpNextName,
|
|
148
|
+
}, "erpnext");
|
|
149
|
+
}),
|
|
150
|
+
printDeliveryNote: (deliveryNoteName_1, ...args_1) => __awaiter(this, [deliveryNoteName_1, ...args_1], void 0, function* (deliveryNoteName, language = "de") {
|
|
151
|
+
return yield client.utils.executeERPNextRequestDownloadFile(`/api/method/frappe.utils.print_format.download_pdf?doctype=Delivery%20Note&name=${deliveryNoteName}&_lang=${language}`);
|
|
152
|
+
}),
|
|
153
|
+
cancelDeliveryNote: (deliveryNoteName) => __awaiter(this, void 0, void 0, function* () {
|
|
154
|
+
return yield client.executeERPNextRequest("cancelDeliveryNote", {
|
|
155
|
+
resourceName: "Delivery Note",
|
|
156
|
+
resourceId: deliveryNoteName,
|
|
157
|
+
requestMethod: "PUT",
|
|
158
|
+
responseValidationModel: DeliveryNote_1.DeliveryNote,
|
|
159
|
+
body: {
|
|
160
|
+
docstatus: 2,
|
|
161
|
+
},
|
|
162
|
+
}, "erpnext");
|
|
163
|
+
}),
|
|
164
|
+
/* -------------------------------- Shipment -------------------------------- */
|
|
165
|
+
createShipmentDraft: (deliveryNoteName) => __awaiter(this, void 0, void 0, function* () {
|
|
166
|
+
const draft = yield client.executeERPNextRequest("createShipmentDraft", {
|
|
167
|
+
methodName: "erpnext.stock.doctype.delivery_note.delivery_note.make_shipment",
|
|
168
|
+
requestMethod: "POST",
|
|
169
|
+
responseValidationModel: Shipment_1.ShipmentDraftFromDeliveryNote,
|
|
170
|
+
params: `?source_name=${deliveryNoteName}`,
|
|
171
|
+
}, "erpnext");
|
|
172
|
+
return draft;
|
|
173
|
+
}),
|
|
174
|
+
getShipment: (shipmentErpNextName) => __awaiter(this, void 0, void 0, function* () {
|
|
175
|
+
const shipment = yield client.executeERPNextRequest("getShipment", {
|
|
176
|
+
resourceName: "Shipment",
|
|
177
|
+
requestMethod: "GET",
|
|
178
|
+
responseValidationModel: Shipment_1.Shipment,
|
|
179
|
+
resourceId: shipmentErpNextName,
|
|
180
|
+
}, "erpnext");
|
|
181
|
+
return shipment;
|
|
182
|
+
}),
|
|
183
|
+
updateShipment: (shipmentErpNextName, updateBody) => __awaiter(this, void 0, void 0, function* () {
|
|
184
|
+
const shipment = yield client.executeERPNextRequest("updateShipment", {
|
|
185
|
+
resourceName: "Shipment",
|
|
186
|
+
requestMethod: "PUT",
|
|
187
|
+
inputValidationModel: Shipment_1.ShipmentAddShippingLabelAndSubmitBody,
|
|
188
|
+
responseValidationModel: Shipment_1.Shipment,
|
|
189
|
+
resourceId: shipmentErpNextName,
|
|
190
|
+
body: updateBody,
|
|
191
|
+
}, "erpnext");
|
|
192
|
+
return shipment;
|
|
193
|
+
}),
|
|
194
|
+
cancelShipment: (shipmentName) => __awaiter(this, void 0, void 0, function* () {
|
|
195
|
+
const result = yield client.executeERPNextRequest("cancelShipment", {
|
|
196
|
+
resourceName: "Shipment",
|
|
197
|
+
resourceId: shipmentName,
|
|
198
|
+
requestMethod: "PUT",
|
|
199
|
+
responseValidationModel: Shipment_1.Shipment,
|
|
200
|
+
body: {
|
|
201
|
+
docstatus: 2,
|
|
202
|
+
},
|
|
203
|
+
}, "erpnext");
|
|
204
|
+
return result;
|
|
205
|
+
}),
|
|
206
|
+
deleteShipment: (shipmentName) => __awaiter(this, void 0, void 0, function* () {
|
|
207
|
+
const result = yield client.executeERPNextRequest("deleteShipment", {
|
|
208
|
+
resourceName: "Shipment",
|
|
209
|
+
resourceId: shipmentName,
|
|
210
|
+
requestMethod: "DELETE",
|
|
211
|
+
responseValidationModel: false,
|
|
212
|
+
}, "erpnext");
|
|
213
|
+
return result;
|
|
214
|
+
}),
|
|
215
|
+
/* ---------------------------- Shipping Provider -------------------------- */
|
|
216
|
+
getShippingProvider: (shippingProviderErpNextName) => __awaiter(this, void 0, void 0, function* () {
|
|
217
|
+
const shipment = yield client.executeERPNextRequest("getShippingProvider", {
|
|
218
|
+
resourceName: "Shipping Provider",
|
|
219
|
+
resourceId: shippingProviderErpNextName,
|
|
220
|
+
requestMethod: "GET",
|
|
221
|
+
responseValidationModel: ShippingProvider_1.ShippingProvider,
|
|
222
|
+
}, "erpnext");
|
|
223
|
+
return shipment;
|
|
224
|
+
}),
|
|
225
|
+
/* ---------------------------------- Item ---------------------------------- */
|
|
226
|
+
getNoneStockItems: () => __awaiter(this, void 0, void 0, function* () {
|
|
227
|
+
const validated = yield client.executeERPNextRequest("getNoneStockItems", {
|
|
228
|
+
requestMethod: "GET",
|
|
229
|
+
resourceName: "Item",
|
|
230
|
+
responseValidationModel: Item_1.ErpNextResponseDictFalse,
|
|
231
|
+
params: '?filters=[["is_stock_item","=","0"]]&as_dict=False',
|
|
232
|
+
}, "erpnext");
|
|
233
|
+
return validated
|
|
234
|
+
.map(([item]) => {
|
|
235
|
+
return item;
|
|
236
|
+
})
|
|
237
|
+
.filter(utils_1.isDefined);
|
|
238
|
+
}),
|
|
239
|
+
/* --------------------------- Projected Quantity --------------------------- */
|
|
240
|
+
getStockDict: (warehouse) => __awaiter(this, void 0, void 0, function* () {
|
|
241
|
+
const validated = yield client.executeERPNextRequest("getStockDict", {
|
|
242
|
+
requestMethod: "GET",
|
|
243
|
+
methodName: `get_stock_from_bin?warehouse=${encodeURIComponent(warehouse)}`,
|
|
244
|
+
responseValidationModel: StockDict_1.StockDict,
|
|
245
|
+
}, "erpnext");
|
|
246
|
+
return validated;
|
|
247
|
+
}),
|
|
248
|
+
/* --------------------------- Projected Quantity --------------------------- */
|
|
249
|
+
getProjectedQuantity: (...args_1) => __awaiter(this, [...args_1], void 0, function* (options = {}) {
|
|
250
|
+
const { itemCodes, warehouse } = options;
|
|
251
|
+
const validated = yield client.executeERPNextRequest("getProjectedQuantity", {
|
|
252
|
+
requestMethod: "POST",
|
|
253
|
+
methodName: "frappe.desk.query_report.run",
|
|
254
|
+
inputValidationModel: ProjectedQuantityReport_1.GetProjectedQuantityRequestBody,
|
|
255
|
+
responseValidationModel: ProjectedQuantityReport_1.GetProjectedQuantity,
|
|
256
|
+
body: Object.assign({ report_name: "Stock Projected Qty" }, ((itemCodes === null || itemCodes === void 0 ? void 0 : itemCodes.length) || warehouse
|
|
257
|
+
? {
|
|
258
|
+
filters: Object.assign(Object.assign({}, ((itemCodes === null || itemCodes === void 0 ? void 0 : itemCodes.length) === 1 && { item_code: itemCodes[0] })), (warehouse && { warehouse })),
|
|
259
|
+
}
|
|
260
|
+
: {})),
|
|
261
|
+
}, "erpnext");
|
|
262
|
+
const stockLevels = {};
|
|
263
|
+
validated.result
|
|
264
|
+
.filter((r) => !(0, lodash_1.isArray)(r))
|
|
265
|
+
.forEach((r) => {
|
|
266
|
+
const projectedQuantity = r;
|
|
267
|
+
stockLevels[projectedQuantity.item_code] = stockLevels[projectedQuantity.item_code]
|
|
268
|
+
? stockLevels[projectedQuantity.item_code] +
|
|
269
|
+
projectedQuantity.actual_qty
|
|
270
|
+
: projectedQuantity.actual_qty;
|
|
271
|
+
});
|
|
272
|
+
// Add 0 for requested items that are not in stock
|
|
273
|
+
itemCodes === null || itemCodes === void 0 ? void 0 : itemCodes.forEach((sku) => {
|
|
274
|
+
if (Object(stockLevels).hasOwnProperty(sku))
|
|
275
|
+
return;
|
|
276
|
+
stockLevels[sku] = 0;
|
|
277
|
+
});
|
|
278
|
+
return stockLevels;
|
|
279
|
+
}),
|
|
280
|
+
/* --------------------------- Upload File --------------------------- */
|
|
281
|
+
uploadFile: (file_1, filename_1, ...args_1) => __awaiter(this, [file_1, filename_1, ...args_1], void 0, function* (file, filename, doctypeToLinkTo = "", docnameToLinkTo = "", isPrivate = true) {
|
|
282
|
+
const body = Object.assign({ filedata: file.toString("base64"), filename, from_form: 1, is_private: isPrivate ? 1 : 0 }, (doctypeToLinkTo &&
|
|
283
|
+
docnameToLinkTo && {
|
|
284
|
+
doctype: doctypeToLinkTo,
|
|
285
|
+
docname: docnameToLinkTo,
|
|
286
|
+
}));
|
|
287
|
+
const result = yield client.utils.executeERPNextRequestWithoutTemporalQueue({
|
|
288
|
+
requestMethod: "POST",
|
|
289
|
+
responseValidationModel: File_1.ERPNextValidatedFile,
|
|
290
|
+
methodName: "uploadfile",
|
|
291
|
+
body,
|
|
292
|
+
});
|
|
293
|
+
return result;
|
|
294
|
+
}),
|
|
295
|
+
/* -------------------------------- Purchase Order ---------------------------- */
|
|
296
|
+
cancelPurchaseOrder: (purchaseOrderName) => __awaiter(this, void 0, void 0, function* () {
|
|
297
|
+
return yield client.executeERPNextRequest("cancelPurchaseOrder", {
|
|
298
|
+
resourceName: "Purchase Order",
|
|
299
|
+
resourceId: purchaseOrderName,
|
|
300
|
+
requestMethod: "PUT",
|
|
301
|
+
responseValidationModel: PurchaseOrder_1.PurchaseOrder,
|
|
302
|
+
body: {
|
|
303
|
+
docstatus: 2,
|
|
304
|
+
},
|
|
305
|
+
}, "erpnext");
|
|
306
|
+
}),
|
|
307
|
+
/* -------------------------------- Receipt -------------------------------- */
|
|
308
|
+
createReceiptDraft: (purchaseOrderName) => __awaiter(this, void 0, void 0, function* () {
|
|
309
|
+
const draft = yield client.executeERPNextRequest("createReceiptDraft", {
|
|
310
|
+
methodName: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_receipt",
|
|
311
|
+
requestMethod: "POST",
|
|
312
|
+
responseValidationModel: ReceiptDraft_1.ReceiptDraft,
|
|
313
|
+
params: `?source_name=${purchaseOrderName}`,
|
|
314
|
+
}, "erpnext");
|
|
315
|
+
return draft;
|
|
316
|
+
}),
|
|
317
|
+
createReceipt: (purchaseOrderName) => __awaiter(this, void 0, void 0, function* () {
|
|
318
|
+
const receiptDraft = yield this.createReceiptDraft(purchaseOrderName);
|
|
319
|
+
const body = Object.assign(Object.assign({}, receiptDraft), { docstatus: 1 });
|
|
320
|
+
return yield client.executeERPNextRequest("createReceipt", {
|
|
321
|
+
resourceName: "Purchase Receipt",
|
|
322
|
+
requestMethod: "POST",
|
|
323
|
+
responseValidationModel: Receipt_1.Receipt,
|
|
324
|
+
body,
|
|
325
|
+
}, "erpnext");
|
|
326
|
+
}),
|
|
327
|
+
cancelReceipt: (receiptName) => __awaiter(this, void 0, void 0, function* () {
|
|
328
|
+
return yield client.executeERPNextRequest("cancelReceipt", {
|
|
329
|
+
resourceName: "Purchase Receipt",
|
|
330
|
+
resourceId: receiptName,
|
|
331
|
+
requestMethod: "PUT",
|
|
332
|
+
responseValidationModel: Receipt_1.Receipt,
|
|
333
|
+
body: {
|
|
334
|
+
docstatus: 2,
|
|
335
|
+
},
|
|
336
|
+
}, "erpnext");
|
|
337
|
+
}),
|
|
338
|
+
};
|
|
339
|
+
}
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const DynamicLinkPostBody: z.ZodObject<{
|
|
3
|
+
link_doctype: z.ZodString;
|
|
4
|
+
link_name: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
link_doctype?: string;
|
|
7
|
+
link_name?: string;
|
|
8
|
+
}, {
|
|
9
|
+
link_doctype?: string;
|
|
10
|
+
link_name?: string;
|
|
11
|
+
}>;
|
|
12
|
+
declare const AddressPostBody: z.ZodObject<{
|
|
13
|
+
address_title: z.ZodString;
|
|
14
|
+
address_line1: z.ZodString;
|
|
15
|
+
address_line2: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
16
|
+
address_type: z.ZodString;
|
|
17
|
+
city: z.ZodString;
|
|
18
|
+
country: z.ZodString;
|
|
19
|
+
email_id: z.ZodString;
|
|
20
|
+
is_shipping_address: z.ZodNumber;
|
|
21
|
+
links: z.ZodArray<z.ZodObject<{
|
|
22
|
+
link_doctype: z.ZodString;
|
|
23
|
+
link_name: z.ZodString;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
link_doctype?: string;
|
|
26
|
+
link_name?: string;
|
|
27
|
+
}, {
|
|
28
|
+
link_doctype?: string;
|
|
29
|
+
link_name?: string;
|
|
30
|
+
}>, "many">;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
address_title?: string;
|
|
33
|
+
address_line1?: string;
|
|
34
|
+
address_line2?: string;
|
|
35
|
+
address_type?: string;
|
|
36
|
+
city?: string;
|
|
37
|
+
country?: string;
|
|
38
|
+
email_id?: string;
|
|
39
|
+
is_shipping_address?: number;
|
|
40
|
+
links?: {
|
|
41
|
+
link_doctype?: string;
|
|
42
|
+
link_name?: string;
|
|
43
|
+
}[];
|
|
44
|
+
}, {
|
|
45
|
+
address_title?: string;
|
|
46
|
+
address_line1?: string;
|
|
47
|
+
address_line2?: string;
|
|
48
|
+
address_type?: string;
|
|
49
|
+
city?: string;
|
|
50
|
+
country?: string;
|
|
51
|
+
email_id?: string;
|
|
52
|
+
is_shipping_address?: number;
|
|
53
|
+
links?: {
|
|
54
|
+
link_doctype?: string;
|
|
55
|
+
link_name?: string;
|
|
56
|
+
}[];
|
|
57
|
+
}>;
|
|
58
|
+
export type AddressPostBodyType = z.infer<typeof AddressPostBody>;
|
|
59
|
+
export declare const Address: z.ZodObject<{
|
|
60
|
+
name: z.ZodString;
|
|
61
|
+
owner: z.ZodString;
|
|
62
|
+
creation: z.ZodString;
|
|
63
|
+
modified: z.ZodString;
|
|
64
|
+
modified_by: z.ZodString;
|
|
65
|
+
import_reference: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
66
|
+
parent: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
67
|
+
parentfield: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
68
|
+
parenttype: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
69
|
+
idx: z.ZodNumber;
|
|
70
|
+
docstatus: z.ZodNumber;
|
|
71
|
+
address_title: z.ZodString;
|
|
72
|
+
address_type: z.ZodString;
|
|
73
|
+
address_line1: z.ZodString;
|
|
74
|
+
address_line2: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
75
|
+
pincode: z.ZodEffects<z.ZodString, string, unknown>;
|
|
76
|
+
state: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
77
|
+
phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
78
|
+
fax: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
79
|
+
tax_category: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
80
|
+
city: z.ZodString;
|
|
81
|
+
country: z.ZodString;
|
|
82
|
+
county: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
83
|
+
email_id: z.ZodString;
|
|
84
|
+
is_primary_address: z.ZodEffects<z.ZodNumber, boolean, number>;
|
|
85
|
+
is_shipping_address: z.ZodEffects<z.ZodNumber, boolean, number>;
|
|
86
|
+
is_your_company_address: z.ZodEffects<z.ZodNumber, boolean, number>;
|
|
87
|
+
disabled: z.ZodEffects<z.ZodNumber, boolean, number>;
|
|
88
|
+
doctype: z.ZodString;
|
|
89
|
+
links: z.ZodArray<z.ZodObject<{
|
|
90
|
+
name: z.ZodString;
|
|
91
|
+
owner: z.ZodString;
|
|
92
|
+
creation: z.ZodString;
|
|
93
|
+
modified: z.ZodString;
|
|
94
|
+
modified_by: z.ZodString;
|
|
95
|
+
parent: z.ZodString;
|
|
96
|
+
parentfield: z.ZodString;
|
|
97
|
+
parenttype: z.ZodString;
|
|
98
|
+
idx: z.ZodNumber;
|
|
99
|
+
docstatus: z.ZodNumber;
|
|
100
|
+
link_doctype: z.ZodString;
|
|
101
|
+
link_name: z.ZodString;
|
|
102
|
+
link_title: z.ZodString;
|
|
103
|
+
doctype: z.ZodString;
|
|
104
|
+
}, "strip", z.ZodTypeAny, {
|
|
105
|
+
name?: string;
|
|
106
|
+
link_doctype?: string;
|
|
107
|
+
link_name?: string;
|
|
108
|
+
owner?: string;
|
|
109
|
+
creation?: string;
|
|
110
|
+
modified?: string;
|
|
111
|
+
modified_by?: string;
|
|
112
|
+
parent?: string;
|
|
113
|
+
parentfield?: string;
|
|
114
|
+
parenttype?: string;
|
|
115
|
+
idx?: number;
|
|
116
|
+
docstatus?: number;
|
|
117
|
+
link_title?: string;
|
|
118
|
+
doctype?: string;
|
|
119
|
+
}, {
|
|
120
|
+
name?: string;
|
|
121
|
+
link_doctype?: string;
|
|
122
|
+
link_name?: string;
|
|
123
|
+
owner?: string;
|
|
124
|
+
creation?: string;
|
|
125
|
+
modified?: string;
|
|
126
|
+
modified_by?: string;
|
|
127
|
+
parent?: string;
|
|
128
|
+
parentfield?: string;
|
|
129
|
+
parenttype?: string;
|
|
130
|
+
idx?: number;
|
|
131
|
+
docstatus?: number;
|
|
132
|
+
link_title?: string;
|
|
133
|
+
doctype?: string;
|
|
134
|
+
}>, "many">;
|
|
135
|
+
}, "strip", z.ZodTypeAny, {
|
|
136
|
+
name?: string;
|
|
137
|
+
address_title?: string;
|
|
138
|
+
address_line1?: string;
|
|
139
|
+
address_line2?: string;
|
|
140
|
+
address_type?: string;
|
|
141
|
+
city?: string;
|
|
142
|
+
country?: string;
|
|
143
|
+
email_id?: string;
|
|
144
|
+
is_shipping_address?: boolean;
|
|
145
|
+
links?: {
|
|
146
|
+
name?: string;
|
|
147
|
+
link_doctype?: string;
|
|
148
|
+
link_name?: string;
|
|
149
|
+
owner?: string;
|
|
150
|
+
creation?: string;
|
|
151
|
+
modified?: string;
|
|
152
|
+
modified_by?: string;
|
|
153
|
+
parent?: string;
|
|
154
|
+
parentfield?: string;
|
|
155
|
+
parenttype?: string;
|
|
156
|
+
idx?: number;
|
|
157
|
+
docstatus?: number;
|
|
158
|
+
link_title?: string;
|
|
159
|
+
doctype?: string;
|
|
160
|
+
}[];
|
|
161
|
+
owner?: string;
|
|
162
|
+
creation?: string;
|
|
163
|
+
modified?: string;
|
|
164
|
+
modified_by?: string;
|
|
165
|
+
parent?: string;
|
|
166
|
+
parentfield?: string;
|
|
167
|
+
parenttype?: string;
|
|
168
|
+
idx?: number;
|
|
169
|
+
docstatus?: number;
|
|
170
|
+
doctype?: string;
|
|
171
|
+
import_reference?: string;
|
|
172
|
+
pincode?: string;
|
|
173
|
+
state?: string;
|
|
174
|
+
phone?: string;
|
|
175
|
+
fax?: string;
|
|
176
|
+
tax_category?: string;
|
|
177
|
+
county?: string;
|
|
178
|
+
is_primary_address?: boolean;
|
|
179
|
+
is_your_company_address?: boolean;
|
|
180
|
+
disabled?: boolean;
|
|
181
|
+
}, {
|
|
182
|
+
name?: string;
|
|
183
|
+
address_title?: string;
|
|
184
|
+
address_line1?: string;
|
|
185
|
+
address_line2?: string;
|
|
186
|
+
address_type?: string;
|
|
187
|
+
city?: string;
|
|
188
|
+
country?: string;
|
|
189
|
+
email_id?: string;
|
|
190
|
+
is_shipping_address?: number;
|
|
191
|
+
links?: {
|
|
192
|
+
name?: string;
|
|
193
|
+
link_doctype?: string;
|
|
194
|
+
link_name?: string;
|
|
195
|
+
owner?: string;
|
|
196
|
+
creation?: string;
|
|
197
|
+
modified?: string;
|
|
198
|
+
modified_by?: string;
|
|
199
|
+
parent?: string;
|
|
200
|
+
parentfield?: string;
|
|
201
|
+
parenttype?: string;
|
|
202
|
+
idx?: number;
|
|
203
|
+
docstatus?: number;
|
|
204
|
+
link_title?: string;
|
|
205
|
+
doctype?: string;
|
|
206
|
+
}[];
|
|
207
|
+
owner?: string;
|
|
208
|
+
creation?: string;
|
|
209
|
+
modified?: string;
|
|
210
|
+
modified_by?: string;
|
|
211
|
+
parent?: string;
|
|
212
|
+
parentfield?: string;
|
|
213
|
+
parenttype?: string;
|
|
214
|
+
idx?: number;
|
|
215
|
+
docstatus?: number;
|
|
216
|
+
doctype?: string;
|
|
217
|
+
import_reference?: string;
|
|
218
|
+
pincode?: unknown;
|
|
219
|
+
state?: string;
|
|
220
|
+
phone?: string;
|
|
221
|
+
fax?: string;
|
|
222
|
+
tax_category?: string;
|
|
223
|
+
county?: string;
|
|
224
|
+
is_primary_address?: number;
|
|
225
|
+
is_your_company_address?: number;
|
|
226
|
+
disabled?: number;
|
|
227
|
+
}>;
|
|
228
|
+
export declare const AddressListName: z.ZodArray<z.ZodObject<Pick<{
|
|
229
|
+
name: z.ZodString;
|
|
230
|
+
owner: z.ZodString;
|
|
231
|
+
creation: z.ZodString;
|
|
232
|
+
modified: z.ZodString;
|
|
233
|
+
modified_by: z.ZodString;
|
|
234
|
+
import_reference: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
235
|
+
parent: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
236
|
+
parentfield: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
237
|
+
parenttype: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
238
|
+
idx: z.ZodNumber;
|
|
239
|
+
docstatus: z.ZodNumber;
|
|
240
|
+
address_title: z.ZodString;
|
|
241
|
+
address_type: z.ZodString;
|
|
242
|
+
address_line1: z.ZodString;
|
|
243
|
+
address_line2: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
244
|
+
pincode: z.ZodEffects<z.ZodString, string, unknown>;
|
|
245
|
+
state: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
246
|
+
phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
247
|
+
fax: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
248
|
+
tax_category: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
249
|
+
city: z.ZodString;
|
|
250
|
+
country: z.ZodString;
|
|
251
|
+
county: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
252
|
+
email_id: z.ZodString;
|
|
253
|
+
is_primary_address: z.ZodEffects<z.ZodNumber, boolean, number>;
|
|
254
|
+
is_shipping_address: z.ZodEffects<z.ZodNumber, boolean, number>;
|
|
255
|
+
is_your_company_address: z.ZodEffects<z.ZodNumber, boolean, number>;
|
|
256
|
+
disabled: z.ZodEffects<z.ZodNumber, boolean, number>;
|
|
257
|
+
doctype: z.ZodString;
|
|
258
|
+
links: z.ZodArray<z.ZodObject<{
|
|
259
|
+
name: z.ZodString;
|
|
260
|
+
owner: z.ZodString;
|
|
261
|
+
creation: z.ZodString;
|
|
262
|
+
modified: z.ZodString;
|
|
263
|
+
modified_by: z.ZodString;
|
|
264
|
+
parent: z.ZodString;
|
|
265
|
+
parentfield: z.ZodString;
|
|
266
|
+
parenttype: z.ZodString;
|
|
267
|
+
idx: z.ZodNumber;
|
|
268
|
+
docstatus: z.ZodNumber;
|
|
269
|
+
link_doctype: z.ZodString;
|
|
270
|
+
link_name: z.ZodString;
|
|
271
|
+
link_title: z.ZodString;
|
|
272
|
+
doctype: z.ZodString;
|
|
273
|
+
}, "strip", z.ZodTypeAny, {
|
|
274
|
+
name?: string;
|
|
275
|
+
link_doctype?: string;
|
|
276
|
+
link_name?: string;
|
|
277
|
+
owner?: string;
|
|
278
|
+
creation?: string;
|
|
279
|
+
modified?: string;
|
|
280
|
+
modified_by?: string;
|
|
281
|
+
parent?: string;
|
|
282
|
+
parentfield?: string;
|
|
283
|
+
parenttype?: string;
|
|
284
|
+
idx?: number;
|
|
285
|
+
docstatus?: number;
|
|
286
|
+
link_title?: string;
|
|
287
|
+
doctype?: string;
|
|
288
|
+
}, {
|
|
289
|
+
name?: string;
|
|
290
|
+
link_doctype?: string;
|
|
291
|
+
link_name?: string;
|
|
292
|
+
owner?: string;
|
|
293
|
+
creation?: string;
|
|
294
|
+
modified?: string;
|
|
295
|
+
modified_by?: string;
|
|
296
|
+
parent?: string;
|
|
297
|
+
parentfield?: string;
|
|
298
|
+
parenttype?: string;
|
|
299
|
+
idx?: number;
|
|
300
|
+
docstatus?: number;
|
|
301
|
+
link_title?: string;
|
|
302
|
+
doctype?: string;
|
|
303
|
+
}>, "many">;
|
|
304
|
+
}, "name">, "strip", z.ZodTypeAny, {
|
|
305
|
+
name?: string;
|
|
306
|
+
}, {
|
|
307
|
+
name?: string;
|
|
308
|
+
}>, "many">;
|
|
309
|
+
export type AddressType = z.infer<typeof Address>;
|
|
310
|
+
export type AddressListNameType = z.infer<typeof AddressListName>;
|
|
311
|
+
export declare const ShipstormAddress: z.ZodObject<{
|
|
312
|
+
address_title: z.ZodString;
|
|
313
|
+
address_type: z.ZodString;
|
|
314
|
+
address_line1: z.ZodString;
|
|
315
|
+
address_line2: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
316
|
+
pincode: z.ZodEffects<z.ZodString, string, unknown>;
|
|
317
|
+
state: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
318
|
+
phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
319
|
+
city: z.ZodString;
|
|
320
|
+
country: z.ZodString;
|
|
321
|
+
email_id: z.ZodString;
|
|
322
|
+
is_shipping_address: z.ZodBoolean;
|
|
323
|
+
}, "strip", z.ZodTypeAny, {
|
|
324
|
+
address_title?: string;
|
|
325
|
+
address_line1?: string;
|
|
326
|
+
address_line2?: string;
|
|
327
|
+
address_type?: string;
|
|
328
|
+
city?: string;
|
|
329
|
+
country?: string;
|
|
330
|
+
email_id?: string;
|
|
331
|
+
is_shipping_address?: boolean;
|
|
332
|
+
pincode?: string;
|
|
333
|
+
state?: string;
|
|
334
|
+
phone?: string;
|
|
335
|
+
}, {
|
|
336
|
+
address_title?: string;
|
|
337
|
+
address_line1?: string;
|
|
338
|
+
address_line2?: string;
|
|
339
|
+
address_type?: string;
|
|
340
|
+
city?: string;
|
|
341
|
+
country?: string;
|
|
342
|
+
email_id?: string;
|
|
343
|
+
is_shipping_address?: boolean;
|
|
344
|
+
pincode?: unknown;
|
|
345
|
+
state?: string;
|
|
346
|
+
phone?: string;
|
|
347
|
+
}>;
|
|
348
|
+
export type ShipstormAddressType = z.infer<typeof ShipstormAddress>;
|
|
349
|
+
export {};
|