erpnext-queue-client 1.1.2 → 1.2.0
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/erpnext/doctypeResourceRequest.d.ts +1 -1
- package/dist/erpnext/doctypeResourceRequest.js +2 -2
- package/dist/erpnext/doctypes/address.d.ts +48 -15
- package/dist/erpnext/doctypes/address.js +22 -0
- package/dist/erpnext/doctypes/contact.d.ts +13 -13
- package/dist/erpnext/doctypes/deliveryNote.d.ts +15 -15
- package/dist/erpnext/doctypes/deliveryNote.js +1 -1
- package/dist/erpnext/doctypes/item.d.ts +13 -13
- package/dist/erpnext/doctypes/purchaseInvoice.d.ts +2161 -0
- package/dist/erpnext/doctypes/purchaseInvoice.js +79 -0
- package/dist/erpnext/doctypes/purchaseReceipt.d.ts +493 -156
- package/dist/erpnext/doctypes/purchaseReceipt.js +24 -3
- package/dist/erpnext/doctypes/shipment.d.ts +11 -11
- package/dist/erpnext/doctypes/stock.d.ts +56 -0
- package/dist/erpnext/doctypes/stock.js +100 -0
- package/dist/erpnext/methodRequest.d.ts +2 -1
- package/dist/erpnext/methodRequest.js +7 -5
- package/dist/erpnext/model/Account.d.ts +44 -0
- package/dist/erpnext/model/Account.js +21 -0
- package/dist/erpnext/model/Address.d.ts +7 -7
- package/dist/erpnext/model/Address.js +6 -3
- package/dist/erpnext/model/Attachment.d.ts +17 -0
- package/dist/erpnext/model/Attachment.js +12 -0
- package/dist/erpnext/model/Contact.d.ts +6 -6
- package/dist/erpnext/model/Customer.d.ts +7 -7
- package/dist/erpnext/model/DeliveryNote.d.ts +8 -8
- package/dist/erpnext/model/DocInfo.d.ts +1149 -0
- package/dist/erpnext/model/DocInfo.js +46 -0
- package/dist/erpnext/model/DocTypeHelpers.d.ts +2 -0
- package/dist/erpnext/model/DocTypeHelpers.js +6 -0
- package/dist/erpnext/model/File.d.ts +4 -4
- package/dist/erpnext/model/Fulfiller.d.ts +5 -5
- package/dist/erpnext/model/Item.d.ts +14 -14
- package/dist/erpnext/model/Item.js +1 -1
- package/dist/erpnext/model/Logs.d.ts +20 -0
- package/dist/erpnext/model/Logs.js +13 -0
- package/dist/erpnext/model/PaymentEntry.d.ts +9 -9
- package/dist/erpnext/model/PaymentEntry.js +9 -5
- package/dist/erpnext/model/Permissions.d.ts +56 -0
- package/dist/erpnext/model/Permissions.js +23 -0
- package/dist/erpnext/model/PurchaseInvoice.d.ts +1773 -0
- package/dist/erpnext/model/PurchaseInvoice.js +215 -0
- package/dist/erpnext/model/PurchaseOrder.d.ts +56 -56
- package/dist/erpnext/model/Receipt.d.ts +50 -50
- package/dist/erpnext/model/ReceiptDraft.d.ts +38 -38
- package/dist/erpnext/model/Report.d.ts +24 -0
- package/dist/erpnext/model/Report.js +12 -0
- package/dist/erpnext/model/Shipment.d.ts +6 -6
- package/dist/erpnext/model/Stock.d.ts +555 -0
- package/dist/erpnext/model/Stock.js +101 -0
- package/dist/erpnext/model/StockEntry.d.ts +10 -10
- package/dist/erpnext/model/StockEntry.js +8 -4
- package/dist/erpnext/model/StockReconciliation.d.ts +2 -2
- package/dist/erpnext/model/Supplier.d.ts +95 -25
- package/dist/erpnext/model/Supplier.js +10 -7
- package/dist/erpnext/model/User.d.ts +20 -0
- package/dist/erpnext/model/User.js +13 -0
- package/dist/erpnext/model/Version.d.ts +17 -0
- package/dist/erpnext/model/Version.js +12 -0
- package/dist/erpnext/resourceRequest.js +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/package.json +1 -1
|
@@ -26,7 +26,7 @@ class ERPNextPurchaseReceipt {
|
|
|
26
26
|
this.cancel = this.baseRequest.cancel;
|
|
27
27
|
this.submit = this.baseRequest.submit;
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
createReceiptDraftFromPurchaseOrder(purchaseOrderName) {
|
|
30
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
31
|
const draft = yield this.methodRequest.request({
|
|
32
32
|
methodName: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_receipt",
|
|
@@ -37,9 +37,30 @@ class ERPNextPurchaseReceipt {
|
|
|
37
37
|
return draft;
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
createFromPurchaseOrder(purchaseOrderName_1) {
|
|
41
41
|
return __awaiter(this, arguments, void 0, function* (purchaseOrderName, submit = false) {
|
|
42
|
-
const receiptDraft = yield this.
|
|
42
|
+
const receiptDraft = yield this.createReceiptDraftFromPurchaseOrder(purchaseOrderName);
|
|
43
|
+
const body = Object.assign(Object.assign({}, receiptDraft), (submit === true ? { docstatus: 1 } : {}));
|
|
44
|
+
return yield this.baseRequest.create({
|
|
45
|
+
inputValidationModel: ReceiptDraft_1.ReceiptDraft,
|
|
46
|
+
body,
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
createReceiptDraftFromPurchaseInvoice(purchaseInvoiceName) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const draft = yield this.methodRequest.request({
|
|
53
|
+
methodName: `erpnext.accounts.doctype.purchase_invoice.purchase_invoice.make_purchase_receipt`,
|
|
54
|
+
requestMethod: "POST",
|
|
55
|
+
responseValidationModel: ReceiptDraft_1.ReceiptDraft,
|
|
56
|
+
params: `?source_name=${purchaseInvoiceName}`,
|
|
57
|
+
});
|
|
58
|
+
return draft;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
createFromPurchaseInvoice(purchaseInvoiceName_1) {
|
|
62
|
+
return __awaiter(this, arguments, void 0, function* (purchaseInvoiceName, submit = false) {
|
|
63
|
+
const receiptDraft = yield this.createReceiptDraftFromPurchaseInvoice(purchaseInvoiceName);
|
|
43
64
|
const body = Object.assign(Object.assign({}, receiptDraft), (submit === true ? { docstatus: 1 } : {}));
|
|
44
65
|
return yield this.baseRequest.create({
|
|
45
66
|
inputValidationModel: ReceiptDraft_1.ReceiptDraft,
|
|
@@ -6,7 +6,7 @@ export declare class ERPNextShipment {
|
|
|
6
6
|
protected temporalClient: TemporalClient;
|
|
7
7
|
protected baseRequest: ERPNextDoctypeSubmittableResourceRequest<typeof Shipment>;
|
|
8
8
|
protected methodRequest: ERPNextMethodRequest;
|
|
9
|
-
getList: <TField extends ("status" | "name" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "docstatus" | "doctype" | "delivery_address_name" | "delivery_address" | "delivery_customer" | "delivery_to_type" | "incoterm" | "pallets" | "pickup_address_name" | "pickup_address" | "pickup_company" | "pickup_contact_email" | "pickup_contact_person" | "pickup_contact" | "pickup_from_type" | "pickup_from" | "pickup_to" | "pickup_type" | "shipment_amount" | "shipment_delivery_note" | "shipment_parcel" | "shipment_type" | "tracking_status" | "value_of_goods" | "description_of_content" | "pickup_date" | "shipment_id") | ("parent" | "parentfield" | "parenttype" | "
|
|
9
|
+
getList: <TField extends ("status" | "name" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "docstatus" | "doctype" | "delivery_address_name" | "delivery_address" | "delivery_customer" | "delivery_to_type" | "incoterm" | "pallets" | "pickup_address_name" | "pickup_address" | "pickup_company" | "pickup_contact_email" | "pickup_contact_person" | "pickup_contact" | "pickup_from_type" | "pickup_from" | "pickup_to" | "pickup_type" | "shipment_amount" | "shipment_delivery_note" | "shipment_parcel" | "shipment_type" | "tracking_status" | "value_of_goods" | "description_of_content" | "pickup_date" | "shipment_id") | ("parent" | "parentfield" | "parenttype" | "__onload" | "amended_from" | "delivery_contact" | "awb_number" | "carrier_service" | "carrier" | "delivery_company" | "delivery_contact_email" | "delivery_contact_name" | "delivery_supplier" | "delivery_to" | "parcel_template" | "pickup_contact_name" | "pickup_customer" | "pickup_supplier" | "pickup" | "service_provider" | "shipping_label" | "shipping_provider" | "custom_return_label" | "custom_return_shipping_provider" | "tracking_status_info" | "tracking_url"), TAsDict extends boolean | undefined = undefined>({ fields, filters, skip, limit, priority, asDict, params, }?: {
|
|
10
10
|
fields?: TField[] | undefined;
|
|
11
11
|
filters?: string[][];
|
|
12
12
|
skip?: number;
|
|
@@ -84,10 +84,10 @@ export declare class ERPNextShipment {
|
|
|
84
84
|
parent?: string | null | undefined;
|
|
85
85
|
parentfield?: string | null | undefined;
|
|
86
86
|
parenttype?: string | null | undefined;
|
|
87
|
-
amended_from?: string | null | undefined;
|
|
88
87
|
__onload?: {
|
|
89
88
|
load_after_mapping: boolean;
|
|
90
89
|
} | null | undefined;
|
|
90
|
+
amended_from?: string | null | undefined;
|
|
91
91
|
delivery_contact?: string | null | undefined;
|
|
92
92
|
awb_number?: string | null | undefined;
|
|
93
93
|
carrier_service?: string | null | undefined;
|
|
@@ -183,10 +183,10 @@ export declare class ERPNextShipment {
|
|
|
183
183
|
parent?: string | null | undefined;
|
|
184
184
|
parentfield?: string | null | undefined;
|
|
185
185
|
parenttype?: string | null | undefined;
|
|
186
|
-
amended_from?: string | null | undefined;
|
|
187
186
|
__onload?: {
|
|
188
187
|
load_after_mapping: boolean;
|
|
189
188
|
} | null | undefined;
|
|
189
|
+
amended_from?: string | null | undefined;
|
|
190
190
|
delivery_contact?: string | null | undefined;
|
|
191
191
|
awb_number?: string | null | undefined;
|
|
192
192
|
carrier_service?: string | null | undefined;
|
|
@@ -279,10 +279,10 @@ export declare class ERPNextShipment {
|
|
|
279
279
|
parent?: string | null | undefined;
|
|
280
280
|
parentfield?: string | null | undefined;
|
|
281
281
|
parenttype?: string | null | undefined;
|
|
282
|
-
amended_from?: string | null | undefined;
|
|
283
282
|
__onload?: {
|
|
284
283
|
load_after_mapping: boolean;
|
|
285
284
|
} | null | undefined;
|
|
285
|
+
amended_from?: string | null | undefined;
|
|
286
286
|
delivery_contact?: string | null | undefined;
|
|
287
287
|
awb_number?: string | null | undefined;
|
|
288
288
|
carrier_service?: string | null | undefined;
|
|
@@ -379,10 +379,10 @@ export declare class ERPNextShipment {
|
|
|
379
379
|
parent?: string | null | undefined;
|
|
380
380
|
parentfield?: string | null | undefined;
|
|
381
381
|
parenttype?: string | null | undefined;
|
|
382
|
-
amended_from?: string | null | undefined;
|
|
383
382
|
__onload?: {
|
|
384
383
|
load_after_mapping: boolean;
|
|
385
384
|
} | null | undefined;
|
|
385
|
+
amended_from?: string | null | undefined;
|
|
386
386
|
delivery_contact?: string | null | undefined;
|
|
387
387
|
awb_number?: string | null | undefined;
|
|
388
388
|
carrier_service?: string | null | undefined;
|
|
@@ -479,10 +479,10 @@ export declare class ERPNextShipment {
|
|
|
479
479
|
parent?: string | null | undefined;
|
|
480
480
|
parentfield?: string | null | undefined;
|
|
481
481
|
parenttype?: string | null | undefined;
|
|
482
|
-
amended_from?: string | null | undefined;
|
|
483
482
|
__onload?: {
|
|
484
483
|
load_after_mapping: boolean;
|
|
485
484
|
} | null | undefined;
|
|
485
|
+
amended_from?: string | null | undefined;
|
|
486
486
|
delivery_contact?: string | null | undefined;
|
|
487
487
|
awb_number?: string | null | undefined;
|
|
488
488
|
carrier_service?: string | null | undefined;
|
|
@@ -578,10 +578,10 @@ export declare class ERPNextShipment {
|
|
|
578
578
|
parent?: string | null | undefined;
|
|
579
579
|
parentfield?: string | null | undefined;
|
|
580
580
|
parenttype?: string | null | undefined;
|
|
581
|
-
amended_from?: string | null | undefined;
|
|
582
581
|
__onload?: {
|
|
583
582
|
load_after_mapping: boolean;
|
|
584
583
|
} | null | undefined;
|
|
584
|
+
amended_from?: string | null | undefined;
|
|
585
585
|
delivery_contact?: string | null | undefined;
|
|
586
586
|
awb_number?: string | null | undefined;
|
|
587
587
|
carrier_service?: string | null | undefined;
|
|
@@ -674,10 +674,10 @@ export declare class ERPNextShipment {
|
|
|
674
674
|
parent?: string | null | undefined;
|
|
675
675
|
parentfield?: string | null | undefined;
|
|
676
676
|
parenttype?: string | null | undefined;
|
|
677
|
-
amended_from?: string | null | undefined;
|
|
678
677
|
__onload?: {
|
|
679
678
|
load_after_mapping: boolean;
|
|
680
679
|
} | null | undefined;
|
|
680
|
+
amended_from?: string | null | undefined;
|
|
681
681
|
delivery_contact?: string | null | undefined;
|
|
682
682
|
awb_number?: string | null | undefined;
|
|
683
683
|
carrier_service?: string | null | undefined;
|
|
@@ -770,10 +770,10 @@ export declare class ERPNextShipment {
|
|
|
770
770
|
parent?: string | null | undefined;
|
|
771
771
|
parentfield?: string | null | undefined;
|
|
772
772
|
parenttype?: string | null | undefined;
|
|
773
|
-
amended_from?: string | null | undefined;
|
|
774
773
|
__onload?: {
|
|
775
774
|
load_after_mapping: boolean;
|
|
776
775
|
} | null | undefined;
|
|
776
|
+
amended_from?: string | null | undefined;
|
|
777
777
|
delivery_contact?: string | null | undefined;
|
|
778
778
|
awb_number?: string | null | undefined;
|
|
779
779
|
carrier_service?: string | null | undefined;
|
|
@@ -835,10 +835,10 @@ export declare class ERPNextShipment {
|
|
|
835
835
|
shipment_type: string;
|
|
836
836
|
tracking_status: string;
|
|
837
837
|
value_of_goods: number;
|
|
838
|
-
__unsaved?: number | null | undefined;
|
|
839
838
|
__onload?: {
|
|
840
839
|
load_after_mapping: boolean;
|
|
841
840
|
} | null | undefined;
|
|
841
|
+
__unsaved?: number | null | undefined;
|
|
842
842
|
__islocal?: number | null | undefined;
|
|
843
843
|
delivery_contact?: string | undefined;
|
|
844
844
|
incoterm?: string | null | undefined;
|
|
@@ -913,10 +913,10 @@ export declare class ERPNextShipment {
|
|
|
913
913
|
parent?: string | null | undefined;
|
|
914
914
|
parentfield?: string | null | undefined;
|
|
915
915
|
parenttype?: string | null | undefined;
|
|
916
|
-
amended_from?: string | null | undefined;
|
|
917
916
|
__onload?: {
|
|
918
917
|
load_after_mapping: boolean;
|
|
919
918
|
} | null | undefined;
|
|
919
|
+
amended_from?: string | null | undefined;
|
|
920
920
|
delivery_contact?: string | null | undefined;
|
|
921
921
|
awb_number?: string | null | undefined;
|
|
922
922
|
carrier_service?: string | null | undefined;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { TemporalClient } from "../../client";
|
|
2
|
+
import { ERPNextMethodRequest } from "../methodRequest";
|
|
3
|
+
export declare class ERPNextStock {
|
|
4
|
+
protected temporalClient: TemporalClient;
|
|
5
|
+
protected methodRequest: ERPNextMethodRequest;
|
|
6
|
+
constructor(temporalClient: TemporalClient);
|
|
7
|
+
getStockBalanceAtDate(date: Date, warehouse?: string): Promise<((string | number)[] | {
|
|
8
|
+
name: string;
|
|
9
|
+
item_code: string;
|
|
10
|
+
description?: string | null | undefined;
|
|
11
|
+
brand?: string | null | undefined;
|
|
12
|
+
company?: string | null | undefined;
|
|
13
|
+
item_name?: string | null | undefined;
|
|
14
|
+
item_group?: string | null | undefined;
|
|
15
|
+
stock_uom?: string | null | undefined;
|
|
16
|
+
warehouse?: string | null | undefined;
|
|
17
|
+
currency?: string | null | undefined;
|
|
18
|
+
bal_qty?: number | null | undefined;
|
|
19
|
+
bal_val?: number | null | undefined;
|
|
20
|
+
in_qty?: number | null | undefined;
|
|
21
|
+
in_val?: number | null | undefined;
|
|
22
|
+
opening_qty?: number | null | undefined;
|
|
23
|
+
opening_val?: number | null | undefined;
|
|
24
|
+
out_qty?: number | null | undefined;
|
|
25
|
+
out_val?: number | null | undefined;
|
|
26
|
+
reorder_level?: number | null | undefined;
|
|
27
|
+
reorder_qty?: number | null | undefined;
|
|
28
|
+
val_rate?: number | null | undefined;
|
|
29
|
+
})[]>;
|
|
30
|
+
getStockProjectedQuantityReport(warehouse?: string, sku?: string): Promise<{
|
|
31
|
+
item_code: string;
|
|
32
|
+
description?: string | null | undefined;
|
|
33
|
+
brand?: string | null | undefined;
|
|
34
|
+
item_name?: string | null | undefined;
|
|
35
|
+
item_group?: string | null | undefined;
|
|
36
|
+
stock_uom?: string | null | undefined;
|
|
37
|
+
warehouse?: string | null | undefined;
|
|
38
|
+
actual_qty?: number | null | undefined;
|
|
39
|
+
planned_qty?: number | null | undefined;
|
|
40
|
+
indented_qty?: number | null | undefined;
|
|
41
|
+
ordered_qty?: number | null | undefined;
|
|
42
|
+
reserved_qty?: number | null | undefined;
|
|
43
|
+
reserved_qty_for_production?: number | null | undefined;
|
|
44
|
+
reserved_qty_for_sub_contract?: number | null | undefined;
|
|
45
|
+
reserved_qty_for_pos?: number | null | undefined;
|
|
46
|
+
projected_qty?: number | null | undefined;
|
|
47
|
+
re_order_level?: number | null | undefined;
|
|
48
|
+
re_order_qty?: number | null | undefined;
|
|
49
|
+
shortage_qty?: number | null | undefined;
|
|
50
|
+
}[]>;
|
|
51
|
+
getStockFromBin(topLevelWarehouse: string): Promise<any>;
|
|
52
|
+
getBundleStockFromBin(topLevelWarehouse: string): Promise<any>;
|
|
53
|
+
getStock(topLevelWarehouse: string, options?: {
|
|
54
|
+
includeBundleStock: boolean;
|
|
55
|
+
}): Promise<any>;
|
|
56
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
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.ERPNextStock = void 0;
|
|
13
|
+
const lodash_1 = require("lodash");
|
|
14
|
+
const utils_1 = require("../../utils/utils");
|
|
15
|
+
const methodRequest_1 = require("../methodRequest");
|
|
16
|
+
const Stock_1 = require("../model/Stock");
|
|
17
|
+
class ERPNextStock {
|
|
18
|
+
constructor(temporalClient) {
|
|
19
|
+
this.temporalClient = temporalClient;
|
|
20
|
+
this.methodRequest = new methodRequest_1.ERPNextMethodRequest(temporalClient);
|
|
21
|
+
}
|
|
22
|
+
getStockBalanceAtDate(date_1) {
|
|
23
|
+
return __awaiter(this, arguments, void 0, function* (date, warehouse = "") {
|
|
24
|
+
var _a;
|
|
25
|
+
const dateString = date.toISOString().substring(0, 10);
|
|
26
|
+
const result = yield this.methodRequest.request({
|
|
27
|
+
methodName: "frappe.desk.query_report.background_enqueue_run",
|
|
28
|
+
requestMethod: "POST",
|
|
29
|
+
params: `?report_name=Stock Balance&filters={"from_date":"${dateString}","to_date":"${dateString}"${warehouse ? `,"warehouse":"${warehouse}"` : ""}}`,
|
|
30
|
+
responseValidationModel: Stock_1.StockBalanceReportRequest,
|
|
31
|
+
});
|
|
32
|
+
const { name } = result;
|
|
33
|
+
for (let i = 0; i < 100; i++) {
|
|
34
|
+
const reportResponse = yield this.methodRequest.request({
|
|
35
|
+
methodName: `frappe.desk.query_report.run`,
|
|
36
|
+
body: {
|
|
37
|
+
report_name: "Stock Balance",
|
|
38
|
+
filters: Object.assign({ from_date: dateString, to_date: dateString }, (warehouse && { warehouse })),
|
|
39
|
+
},
|
|
40
|
+
requestMethod: "POST",
|
|
41
|
+
responseValidationModel: Stock_1.StockBalanceReport,
|
|
42
|
+
});
|
|
43
|
+
if ((reportResponse === null || reportResponse === void 0 ? void 0 : reportResponse.result) && ((_a = reportResponse === null || reportResponse === void 0 ? void 0 : reportResponse.doc) === null || _a === void 0 ? void 0 : _a.name) === name)
|
|
44
|
+
return reportResponse === null || reportResponse === void 0 ? void 0 : reportResponse.result.filter((r) => !(0, lodash_1.isArray)(r));
|
|
45
|
+
yield (0, utils_1.timeout)(1000);
|
|
46
|
+
}
|
|
47
|
+
throw new Error(`Failed to get stock Balance${warehouse && ` for warehouse ${warehouse}`}`);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
getStockProjectedQuantityReport(warehouse, sku) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const result = yield this.methodRequest.request({
|
|
53
|
+
methodName: "frappe.desk.query_report.run",
|
|
54
|
+
body: {
|
|
55
|
+
report_name: "Stock Projected Qty",
|
|
56
|
+
filters: Object.assign(Object.assign({}, (warehouse && { warehouse })), (sku && { item_code: sku })),
|
|
57
|
+
},
|
|
58
|
+
requestMethod: "POST",
|
|
59
|
+
responseValidationModel: Stock_1.StockProjectedQuantityReport,
|
|
60
|
+
});
|
|
61
|
+
return result.result.filter((r) => !(0, lodash_1.isArray)(r));
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
getStockFromBin(topLevelWarehouse) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
return yield this.methodRequest.request({
|
|
67
|
+
methodName: `get_stock_from_bin`,
|
|
68
|
+
requestMethod: "GET",
|
|
69
|
+
params: `?warehouse=${topLevelWarehouse}`,
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
getBundleStockFromBin(topLevelWarehouse) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
return yield this.methodRequest.request({
|
|
76
|
+
methodName: `get_bundle_stock_from_bin`,
|
|
77
|
+
requestMethod: "GET",
|
|
78
|
+
params: `?warehouse=${topLevelWarehouse}`,
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
getStock(topLevelWarehouse_1) {
|
|
83
|
+
return __awaiter(this, arguments, void 0, function* (topLevelWarehouse, options = { includeBundleStock: false }) {
|
|
84
|
+
const stock = yield this.methodRequest.request({
|
|
85
|
+
methodName: `get_stock_from_bin`,
|
|
86
|
+
requestMethod: "GET",
|
|
87
|
+
params: `?warehouse=${topLevelWarehouse}`,
|
|
88
|
+
});
|
|
89
|
+
if (!options.includeBundleStock)
|
|
90
|
+
return stock;
|
|
91
|
+
const bundleStock = yield this.methodRequest.request({
|
|
92
|
+
methodName: `get_bundle_stock_from_bin`,
|
|
93
|
+
requestMethod: "GET",
|
|
94
|
+
params: `?warehouse=${topLevelWarehouse}`,
|
|
95
|
+
});
|
|
96
|
+
return Object.assign(Object.assign({}, stock), bundleStock);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.ERPNextStock = ERPNextStock;
|
|
@@ -3,12 +3,13 @@ import { TemporalClient } from "../client";
|
|
|
3
3
|
export declare class ERPNextMethodRequest {
|
|
4
4
|
private temporalClient;
|
|
5
5
|
constructor(temporalClient: TemporalClient);
|
|
6
|
-
request<T extends ZodTypeAny, K extends ZodTypeAny>({ methodName, requestMethod, body, inputValidationModel, responseValidationModel, params, priority, }: {
|
|
6
|
+
request<T extends ZodTypeAny, K extends ZodTypeAny>({ methodName, requestMethod, body, inputValidationModel, responseValidationModel, isAutoWrapResponseValidationWithMessage, params, priority, }: {
|
|
7
7
|
methodName: string;
|
|
8
8
|
requestMethod: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
9
9
|
body?: z.TypeOf<K>;
|
|
10
10
|
inputValidationModel?: K;
|
|
11
11
|
responseValidationModel?: T;
|
|
12
|
+
isAutoWrapResponseValidationWithMessage?: boolean;
|
|
12
13
|
params?: string;
|
|
13
14
|
priority?: number;
|
|
14
15
|
}): Promise<z.TypeOf<T>>;
|
|
@@ -16,16 +16,18 @@ class ERPNextMethodRequest {
|
|
|
16
16
|
this.temporalClient = temporalClient;
|
|
17
17
|
}
|
|
18
18
|
request(_a) {
|
|
19
|
-
return __awaiter(this, arguments, void 0, function* ({ methodName, requestMethod, body, inputValidationModel, responseValidationModel, params, priority = 5, }) {
|
|
19
|
+
return __awaiter(this, arguments, void 0, function* ({ methodName, requestMethod, body, inputValidationModel, responseValidationModel, isAutoWrapResponseValidationWithMessage = true, params, priority = 5, }) {
|
|
20
20
|
if (responseValidationModel && !responseValidationModel.description)
|
|
21
21
|
throw new Error("Resource model must have a description");
|
|
22
22
|
const result = yield this.temporalClient.executeERPNextRequestWorkflow(`${requestMethod}-${methodName}`, Object.assign(Object.assign(Object.assign(Object.assign({ methodName,
|
|
23
23
|
requestMethod }, (inputValidationModel ? { inputValidationModel } : {})), { responseValidationModel: responseValidationModel
|
|
24
|
-
?
|
|
25
|
-
.
|
|
26
|
-
|
|
24
|
+
? isAutoWrapResponseValidationWithMessage
|
|
25
|
+
? zod_1.z
|
|
26
|
+
.object({ message: responseValidationModel })
|
|
27
|
+
.describe(responseValidationModel.description)
|
|
28
|
+
: responseValidationModel
|
|
27
29
|
: undefined }), (params ? { params } : {})), { body }), "erpnext", priority);
|
|
28
|
-
return result.message;
|
|
30
|
+
return isAutoWrapResponseValidationWithMessage ? result.message : result;
|
|
29
31
|
});
|
|
30
32
|
}
|
|
31
33
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const Account: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
owner: z.ZodString;
|
|
5
|
+
creation: z.ZodString;
|
|
6
|
+
modified: z.ZodString;
|
|
7
|
+
modified_by: z.ZodString;
|
|
8
|
+
docstatus: z.ZodNumber;
|
|
9
|
+
idx: z.ZodNumber;
|
|
10
|
+
company: z.ZodString;
|
|
11
|
+
account: z.ZodString;
|
|
12
|
+
parent: z.ZodString;
|
|
13
|
+
parentfield: z.ZodString;
|
|
14
|
+
parenttype: z.ZodString;
|
|
15
|
+
doctype: z.ZodString;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
name: string;
|
|
18
|
+
owner: string;
|
|
19
|
+
creation: string;
|
|
20
|
+
modified: string;
|
|
21
|
+
modified_by: string;
|
|
22
|
+
parent: string;
|
|
23
|
+
parentfield: string;
|
|
24
|
+
parenttype: string;
|
|
25
|
+
idx: number;
|
|
26
|
+
docstatus: number;
|
|
27
|
+
doctype: string;
|
|
28
|
+
company: string;
|
|
29
|
+
account: string;
|
|
30
|
+
}, {
|
|
31
|
+
name: string;
|
|
32
|
+
owner: string;
|
|
33
|
+
creation: string;
|
|
34
|
+
modified: string;
|
|
35
|
+
modified_by: string;
|
|
36
|
+
parent: string;
|
|
37
|
+
parentfield: string;
|
|
38
|
+
parenttype: string;
|
|
39
|
+
idx: number;
|
|
40
|
+
docstatus: number;
|
|
41
|
+
doctype: string;
|
|
42
|
+
company: string;
|
|
43
|
+
account: string;
|
|
44
|
+
}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Account = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.Account = zod_1.z
|
|
6
|
+
.object({
|
|
7
|
+
name: zod_1.z.string(),
|
|
8
|
+
owner: zod_1.z.string(),
|
|
9
|
+
creation: zod_1.z.string(),
|
|
10
|
+
modified: zod_1.z.string(),
|
|
11
|
+
modified_by: zod_1.z.string(),
|
|
12
|
+
docstatus: zod_1.z.number(),
|
|
13
|
+
idx: zod_1.z.number(),
|
|
14
|
+
company: zod_1.z.string(),
|
|
15
|
+
account: zod_1.z.string(),
|
|
16
|
+
parent: zod_1.z.string(),
|
|
17
|
+
parentfield: zod_1.z.string(),
|
|
18
|
+
parenttype: zod_1.z.string(),
|
|
19
|
+
doctype: zod_1.z.string(),
|
|
20
|
+
})
|
|
21
|
+
.describe("Account");
|
|
@@ -75,7 +75,7 @@ export declare const Address: z.ZodObject<{
|
|
|
75
75
|
address_type: z.ZodString;
|
|
76
76
|
address_line1: z.ZodString;
|
|
77
77
|
address_line2: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
78
|
-
pincode: z.ZodEffects<z.ZodString, string, unknown
|
|
78
|
+
pincode: z.ZodNullable<z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>>;
|
|
79
79
|
state: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
80
80
|
phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
81
81
|
fax: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
@@ -83,7 +83,7 @@ export declare const Address: z.ZodObject<{
|
|
|
83
83
|
city: z.ZodString;
|
|
84
84
|
country: z.ZodString;
|
|
85
85
|
county: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
86
|
-
email_id: z.ZodString
|
|
86
|
+
email_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
87
87
|
is_primary_address: z.ZodEffects<z.ZodNumber, boolean, number>;
|
|
88
88
|
is_shipping_address: z.ZodEffects<z.ZodNumber, boolean, number>;
|
|
89
89
|
is_your_company_address: z.ZodEffects<z.ZodNumber, boolean, number>;
|
|
@@ -141,9 +141,7 @@ export declare const Address: z.ZodObject<{
|
|
|
141
141
|
address_line1: string;
|
|
142
142
|
address_type: string;
|
|
143
143
|
city: string;
|
|
144
|
-
pincode: string;
|
|
145
144
|
country: string;
|
|
146
|
-
email_id: string;
|
|
147
145
|
is_shipping_address: boolean;
|
|
148
146
|
links: {
|
|
149
147
|
name: string;
|
|
@@ -172,6 +170,8 @@ export declare const Address: z.ZodObject<{
|
|
|
172
170
|
is_your_company_address: boolean;
|
|
173
171
|
disabled: boolean;
|
|
174
172
|
address_line2?: string | null | undefined;
|
|
173
|
+
pincode?: string | null | undefined;
|
|
174
|
+
email_id?: string | null | undefined;
|
|
175
175
|
parent?: string | null | undefined;
|
|
176
176
|
parentfield?: string | null | undefined;
|
|
177
177
|
parenttype?: string | null | undefined;
|
|
@@ -188,7 +188,6 @@ export declare const Address: z.ZodObject<{
|
|
|
188
188
|
address_type: string;
|
|
189
189
|
city: string;
|
|
190
190
|
country: string;
|
|
191
|
-
email_id: string;
|
|
192
191
|
is_shipping_address: number;
|
|
193
192
|
links: {
|
|
194
193
|
name: string;
|
|
@@ -218,6 +217,7 @@ export declare const Address: z.ZodObject<{
|
|
|
218
217
|
disabled: number;
|
|
219
218
|
address_line2?: string | null | undefined;
|
|
220
219
|
pincode?: unknown;
|
|
220
|
+
email_id?: string | null | undefined;
|
|
221
221
|
parent?: string | null | undefined;
|
|
222
222
|
parentfield?: string | null | undefined;
|
|
223
223
|
parenttype?: string | null | undefined;
|
|
@@ -244,7 +244,7 @@ export declare const AddressListName: z.ZodArray<z.ZodObject<Pick<{
|
|
|
244
244
|
address_type: z.ZodString;
|
|
245
245
|
address_line1: z.ZodString;
|
|
246
246
|
address_line2: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
247
|
-
pincode: z.ZodEffects<z.ZodString, string, unknown
|
|
247
|
+
pincode: z.ZodNullable<z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>>;
|
|
248
248
|
state: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
249
249
|
phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
250
250
|
fax: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
@@ -252,7 +252,7 @@ export declare const AddressListName: z.ZodArray<z.ZodObject<Pick<{
|
|
|
252
252
|
city: z.ZodString;
|
|
253
253
|
country: z.ZodString;
|
|
254
254
|
county: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
255
|
-
email_id: z.ZodString
|
|
255
|
+
email_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
256
256
|
is_primary_address: z.ZodEffects<z.ZodNumber, boolean, number>;
|
|
257
257
|
is_shipping_address: z.ZodEffects<z.ZodNumber, boolean, number>;
|
|
258
258
|
is_your_company_address: z.ZodEffects<z.ZodNumber, boolean, number>;
|
|
@@ -57,9 +57,12 @@ exports.Address = zod_1.z
|
|
|
57
57
|
address_type: zod_1.z.string(),
|
|
58
58
|
address_line1: zod_1.z.string(),
|
|
59
59
|
address_line2: zod_1.z.string().optional().nullable(),
|
|
60
|
-
pincode: zod_1.z
|
|
60
|
+
pincode: zod_1.z
|
|
61
|
+
.preprocess((input) => {
|
|
61
62
|
return typeof input === "string" ? input.trim() : input;
|
|
62
|
-
}, zod_1.z.string())
|
|
63
|
+
}, zod_1.z.string())
|
|
64
|
+
.optional()
|
|
65
|
+
.nullable(),
|
|
63
66
|
state: zod_1.z.string().optional().nullable(),
|
|
64
67
|
phone: zod_1.z.string().optional().nullable(),
|
|
65
68
|
fax: zod_1.z.string().optional().nullable(),
|
|
@@ -67,7 +70,7 @@ exports.Address = zod_1.z
|
|
|
67
70
|
city: zod_1.z.string(),
|
|
68
71
|
country: zod_1.z.string(),
|
|
69
72
|
county: zod_1.z.string().optional().nullable(),
|
|
70
|
-
email_id: zod_1.z.string(),
|
|
73
|
+
email_id: zod_1.z.string().optional().nullable(),
|
|
71
74
|
is_primary_address: zod_1.z.number().transform(Boolean),
|
|
72
75
|
is_shipping_address: zod_1.z.number().transform(Boolean),
|
|
73
76
|
is_your_company_address: zod_1.z.number().transform(Boolean),
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const Attachment: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
file_name: z.ZodString;
|
|
5
|
+
file_url: z.ZodString;
|
|
6
|
+
is_private: z.ZodNumber;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
name: string;
|
|
9
|
+
file_name: string;
|
|
10
|
+
file_url: string;
|
|
11
|
+
is_private: number;
|
|
12
|
+
}, {
|
|
13
|
+
name: string;
|
|
14
|
+
file_name: string;
|
|
15
|
+
file_url: string;
|
|
16
|
+
is_private: number;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Attachment = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.Attachment = zod_1.z
|
|
6
|
+
.object({
|
|
7
|
+
name: zod_1.z.string(),
|
|
8
|
+
file_name: zod_1.z.string(),
|
|
9
|
+
file_url: zod_1.z.string(),
|
|
10
|
+
is_private: zod_1.z.number(),
|
|
11
|
+
})
|
|
12
|
+
.describe("Attachment");
|
|
@@ -263,11 +263,11 @@ export declare const Contact: z.ZodObject<{
|
|
|
263
263
|
doctype: string;
|
|
264
264
|
}[] | null | undefined;
|
|
265
265
|
phone?: string | null | undefined;
|
|
266
|
+
image?: string | null | undefined;
|
|
267
|
+
company?: string | null | undefined;
|
|
266
268
|
last_name?: string | null | undefined;
|
|
267
269
|
middle_name?: string | null | undefined;
|
|
268
|
-
company?: string | null | undefined;
|
|
269
270
|
mobile_no?: string | null | undefined;
|
|
270
|
-
image?: string | null | undefined;
|
|
271
271
|
phone_nos?: {
|
|
272
272
|
name: string;
|
|
273
273
|
owner: string;
|
|
@@ -333,11 +333,11 @@ export declare const Contact: z.ZodObject<{
|
|
|
333
333
|
doctype: string;
|
|
334
334
|
}[] | null | undefined;
|
|
335
335
|
phone?: string | null | undefined;
|
|
336
|
+
image?: string | null | undefined;
|
|
337
|
+
company?: string | null | undefined;
|
|
336
338
|
last_name?: string | null | undefined;
|
|
337
339
|
middle_name?: string | null | undefined;
|
|
338
|
-
company?: string | null | undefined;
|
|
339
340
|
mobile_no?: string | null | undefined;
|
|
340
|
-
image?: string | null | undefined;
|
|
341
341
|
phone_nos?: {
|
|
342
342
|
name: string;
|
|
343
343
|
owner: string;
|
|
@@ -530,16 +530,16 @@ export declare const ShipstormContact: z.ZodObject<{
|
|
|
530
530
|
}, "strip", z.ZodTypeAny, {
|
|
531
531
|
email_id: string;
|
|
532
532
|
phone?: string | null | undefined;
|
|
533
|
+
company?: string | null | undefined;
|
|
533
534
|
first_name?: string | null | undefined;
|
|
534
535
|
last_name?: string | null | undefined;
|
|
535
|
-
company?: string | null | undefined;
|
|
536
536
|
mobile_no?: string | null | undefined;
|
|
537
537
|
}, {
|
|
538
538
|
email_id: string;
|
|
539
539
|
phone?: string | null | undefined;
|
|
540
|
+
company?: string | null | undefined;
|
|
540
541
|
first_name?: string | null | undefined;
|
|
541
542
|
last_name?: string | null | undefined;
|
|
542
|
-
company?: string | null | undefined;
|
|
543
543
|
mobile_no?: string | null | undefined;
|
|
544
544
|
}>;
|
|
545
545
|
export type ShipstormContactType = z.infer<typeof ShipstormContact>;
|
|
@@ -51,6 +51,7 @@ export declare const Customer: z.ZodObject<{
|
|
|
51
51
|
doctype: string;
|
|
52
52
|
disabled: boolean;
|
|
53
53
|
naming_series: string;
|
|
54
|
+
is_frozen: boolean;
|
|
54
55
|
customer_name: string;
|
|
55
56
|
is_internal_customer: boolean;
|
|
56
57
|
customer_group: string;
|
|
@@ -58,14 +59,13 @@ export declare const Customer: z.ZodObject<{
|
|
|
58
59
|
customer_type: string;
|
|
59
60
|
so_required: boolean;
|
|
60
61
|
dn_required: boolean;
|
|
61
|
-
is_frozen: boolean;
|
|
62
62
|
language?: string | null | undefined;
|
|
63
|
+
companies?: (string | undefined)[] | null | undefined;
|
|
64
|
+
accounts?: (string | undefined)[] | null | undefined;
|
|
63
65
|
sales_team?: (string | undefined)[] | null | undefined;
|
|
64
66
|
customer_primary_address?: string | null | undefined;
|
|
65
67
|
primary_address?: string | null | undefined;
|
|
66
68
|
default_commission_rate?: number | null | undefined;
|
|
67
|
-
companies?: (string | undefined)[] | null | undefined;
|
|
68
|
-
accounts?: (string | undefined)[] | null | undefined;
|
|
69
69
|
credit_limits?: (string | undefined)[] | null | undefined;
|
|
70
70
|
}, {
|
|
71
71
|
name: string;
|
|
@@ -82,17 +82,17 @@ export declare const Customer: z.ZodObject<{
|
|
|
82
82
|
territory: string;
|
|
83
83
|
customer_type: string;
|
|
84
84
|
disabled?: number | undefined;
|
|
85
|
-
is_internal_customer?: number | undefined;
|
|
86
85
|
language?: string | null | undefined;
|
|
86
|
+
is_frozen?: number | undefined;
|
|
87
|
+
companies?: (string | undefined)[] | null | undefined;
|
|
88
|
+
accounts?: (string | undefined)[] | null | undefined;
|
|
89
|
+
is_internal_customer?: number | undefined;
|
|
87
90
|
sales_team?: (string | undefined)[] | null | undefined;
|
|
88
91
|
so_required?: number | undefined;
|
|
89
92
|
dn_required?: number | undefined;
|
|
90
93
|
customer_primary_address?: string | null | undefined;
|
|
91
94
|
primary_address?: string | null | undefined;
|
|
92
|
-
is_frozen?: number | undefined;
|
|
93
95
|
default_commission_rate?: number | null | undefined;
|
|
94
|
-
companies?: (string | undefined)[] | null | undefined;
|
|
95
|
-
accounts?: (string | undefined)[] | null | undefined;
|
|
96
96
|
credit_limits?: (string | undefined)[] | null | undefined;
|
|
97
97
|
}>;
|
|
98
98
|
export type CustomerType = z.infer<typeof Customer>;
|