erpnext-queue-client 2.4.3 → 2.4.5

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 (41) hide show
  1. package/dist/client.js +87 -105
  2. package/dist/constants.js +1 -0
  3. package/dist/dataConverter.js +4 -13
  4. package/dist/erpnext/decryptFromErpNext.server.js +1 -1
  5. package/dist/erpnext/decryptFromErpNext.server.test.js +2 -11
  6. package/dist/erpnext/doctypeResourceRequest.js +44 -37
  7. package/dist/erpnext/doctypeSubmittableResourceRequest.js +19 -33
  8. package/dist/erpnext/doctypes/address.js +40 -41
  9. package/dist/erpnext/doctypes/consolidatedCustomsInvoice.js +18 -20
  10. package/dist/erpnext/doctypes/contact.js +30 -30
  11. package/dist/erpnext/doctypes/deliveryNote.js +13 -12
  12. package/dist/erpnext/doctypes/item.d.ts +10 -10
  13. package/dist/erpnext/doctypes/item.js +64 -63
  14. package/dist/erpnext/doctypes/paymentEntry.js +42 -43
  15. package/dist/erpnext/doctypes/productBundle.js +15 -17
  16. package/dist/erpnext/doctypes/purchaseInvoice.js +45 -49
  17. package/dist/erpnext/doctypes/purchaseReceipt.js +41 -43
  18. package/dist/erpnext/doctypes/salesInvoice.js +42 -43
  19. package/dist/erpnext/doctypes/servicecase.js +103 -114
  20. package/dist/erpnext/doctypes/shipment.js +30 -35
  21. package/dist/erpnext/doctypes/stock.js +94 -109
  22. package/dist/erpnext/doctypes/tags.js +58 -77
  23. package/dist/erpnext/erpnextRequestWrapper.js +83 -80
  24. package/dist/erpnext/fileRequests.js +28 -29
  25. package/dist/erpnext/methodRequest.js +37 -43
  26. package/dist/erpnext/model/DocTypeHelpers.js +2 -3
  27. package/dist/erpnext/model/Item.d.ts +6 -6
  28. package/dist/erpnext/model/Item.js +1 -1
  29. package/dist/erpnext/model/StockEntry.d.ts +63 -21
  30. package/dist/erpnext/model/StockEntry.js +22 -21
  31. package/dist/erpnext/model/Waitlist.d.ts +22 -6
  32. package/dist/erpnext/model/Waitlist.js +6 -9
  33. package/dist/erpnext/reports.js +81 -89
  34. package/dist/erpnext/resourceRequest.js +142 -150
  35. package/dist/index.js +43 -3
  36. package/dist/index.test.js +69 -83
  37. package/dist/utils/fernet.server.js +24 -4
  38. package/dist/utils/request.js +59 -72
  39. package/dist/utils/zodContextOptionals.js +5 -3
  40. package/dist/utils/zodUtils.js +2 -2
  41. package/package.json +1 -1
@@ -1,19 +1,19 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.ERPNextConsolidatedCustomsInvoice = void 0;
13
4
  const doctypeSubmittableResourceRequest_1 = require("../doctypeSubmittableResourceRequest");
14
5
  const methodRequest_1 = require("../methodRequest");
15
6
  const ConsolidatedCustomsInvoice_1 = require("../model/ConsolidatedCustomsInvoice");
16
7
  class ERPNextConsolidatedCustomsInvoice {
8
+ temporalClient;
9
+ baseRequest;
10
+ methodRequest;
11
+ getList;
12
+ getById;
13
+ updateById;
14
+ deleteById;
15
+ cancel;
16
+ submit;
17
17
  constructor(temporalClient) {
18
18
  this.temporalClient = temporalClient;
19
19
  this.baseRequest = new doctypeSubmittableResourceRequest_1.ERPNextDoctypeSubmittableResourceRequest(temporalClient, "Consolidated Customs Invoice", ConsolidatedCustomsInvoice_1.ConsolidatedCustomsInvoice);
@@ -25,17 +25,15 @@ class ERPNextConsolidatedCustomsInvoice {
25
25
  this.cancel = this.baseRequest.cancel;
26
26
  this.submit = this.baseRequest.submit;
27
27
  }
28
- create(_a) {
29
- return __awaiter(this, arguments, void 0, function* ({ shipments, }) {
30
- return yield this.methodRequest.request({
31
- requestMethod: "POST",
32
- methodName: "consolidated_customs_invoice.create",
33
- responseValidationModel: ConsolidatedCustomsInvoice_1.ConsolidatedCustomsInvoiceCreateMethodResponseSchema,
34
- inputValidationModel: ConsolidatedCustomsInvoice_1.ConsolidatedCustomsInvoiceCreateMethodInput,
35
- body: {
36
- shipments,
37
- },
38
- });
28
+ async create({ shipments, }) {
29
+ return await this.methodRequest.request({
30
+ requestMethod: "POST",
31
+ methodName: "consolidated_customs_invoice.create",
32
+ responseValidationModel: ConsolidatedCustomsInvoice_1.ConsolidatedCustomsInvoiceCreateMethodResponseSchema,
33
+ inputValidationModel: ConsolidatedCustomsInvoice_1.ConsolidatedCustomsInvoiceCreateMethodInput,
34
+ body: {
35
+ shipments,
36
+ },
39
37
  });
40
38
  }
41
39
  }
@@ -1,40 +1,16 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.ERPNextContact = void 0;
13
4
  const doctypeResourceRequest_1 = require("../doctypeResourceRequest");
14
5
  const Contact_1 = require("../model/Contact");
15
6
  class ERPNextContact {
7
+ temporalClient;
8
+ baseRequest;
9
+ getList;
10
+ getById;
11
+ updateById;
12
+ deleteById;
16
13
  constructor(temporalClient) {
17
- this.getContactsByAddressEmail = (email_1, ...args_1) => __awaiter(this, [email_1, ...args_1], void 0, function* (email, fields = ["name"]) {
18
- const filters = [];
19
- filters.push(["Contact", "email_id", "=", email]);
20
- const result = yield this.getList({
21
- fields,
22
- filters,
23
- });
24
- return result;
25
- });
26
- this.create = (contact, customerName) => __awaiter(this, void 0, void 0, function* () {
27
- const result = yield this.baseRequest.create({
28
- body: Object.assign(Object.assign({}, contact), { links: [
29
- {
30
- link_doctype: "Customer",
31
- link_name: customerName,
32
- link_title: customerName,
33
- },
34
- ] }),
35
- });
36
- return result;
37
- });
38
14
  this.temporalClient = temporalClient;
39
15
  this.baseRequest = new doctypeResourceRequest_1.ERPNextDoctypeResourceRequest(temporalClient, "Contact", Contact_1.Contact);
40
16
  this.getList = this.baseRequest.getList;
@@ -42,5 +18,29 @@ class ERPNextContact {
42
18
  this.updateById = this.baseRequest.updateById;
43
19
  this.deleteById = this.baseRequest.deleteById;
44
20
  }
21
+ getContactsByAddressEmail = async (email, fields = ["name"]) => {
22
+ const filters = [];
23
+ filters.push(["Contact", "email_id", "=", email]);
24
+ const result = await this.getList({
25
+ fields,
26
+ filters,
27
+ });
28
+ return result;
29
+ };
30
+ create = async (contact, customerName) => {
31
+ const result = await this.baseRequest.create({
32
+ body: {
33
+ ...contact,
34
+ links: [
35
+ {
36
+ link_doctype: "Customer",
37
+ link_name: customerName,
38
+ link_title: customerName,
39
+ },
40
+ ],
41
+ },
42
+ });
43
+ return result;
44
+ };
45
45
  }
46
46
  exports.ERPNextContact = ERPNextContact;
@@ -1,22 +1,20 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.ERPNextDeliveryNote = void 0;
13
4
  const doctypeSubmittableResourceRequest_1 = require("../doctypeSubmittableResourceRequest");
14
5
  const DeliveryNote_1 = require("../model/DeliveryNote");
15
6
  class ERPNextDeliveryNote {
7
+ fileRequests;
8
+ temporalClient;
9
+ baseRequest;
10
+ create;
11
+ getList;
12
+ getById;
13
+ updateById;
14
+ deleteById;
15
+ submit;
16
+ cancel;
16
17
  constructor(temporalClient, fileRequests) {
17
- this.printDeliveryNote = (resourceId_1, ...args_1) => __awaiter(this, [resourceId_1, ...args_1], void 0, function* (resourceId, language = "de") {
18
- return yield this.fileRequests.fileDownload(`/api/method/frappe.utils.print_format.download_pdf?doctype=Delivery%20Note&name=${resourceId}&_lang=${language}`);
19
- });
20
18
  this.fileRequests = fileRequests;
21
19
  this.temporalClient = temporalClient;
22
20
  this.baseRequest = new doctypeSubmittableResourceRequest_1.ERPNextDoctypeSubmittableResourceRequest(temporalClient, "Delivery Note", DeliveryNote_1.DeliveryNote);
@@ -28,5 +26,8 @@ class ERPNextDeliveryNote {
28
26
  this.submit = this.baseRequest.submit;
29
27
  this.cancel = this.baseRequest.cancel;
30
28
  }
29
+ printDeliveryNote = async (resourceId, language = "de") => {
30
+ return await this.fileRequests.fileDownload(`/api/method/frappe.utils.print_format.download_pdf?doctype=Delivery%20Note&name=${resourceId}&_lang=${language}`);
31
+ };
31
32
  }
32
33
  exports.ERPNextDeliveryNote = ERPNextDeliveryNote;
@@ -8,7 +8,7 @@ export declare class ERPNextItem {
8
8
  protected temporalClient: TemporalClient;
9
9
  protected baseRequest: ERPNextDoctypeResourceRequest<typeof Item>;
10
10
  protected methodRequest: ERPNextMethodRequest;
11
- getList: <TFieldOptions extends ("description" | "docstatus" | "name" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "disabled" | "naming_series" | "item_code" | "delivered_by_supplier" | "weight_uom" | "item_name" | "item_group" | "stock_uom" | "grant_commission" | "override_base_name" | "sync_from_warehouse" | "allow_alternative_item" | "is_stock_item" | "custom_is_digital" | "include_item_in_manufacturing" | "opening_stock" | "valuation_rate" | "standard_rate" | "is_fixed_asset" | "auto_create_assets" | "over_delivery_receipt_allowance" | "over_billing_allowance" | "custom_is_shipping_enabled" | "dimensions_unit" | "custom_dimension_format" | "shipping_dimensions_unit" | "packaging_weight_unit_cardboard" | "packaging_weight_unit_plastic" | "shelf_life_in_days" | "end_of_life" | "default_material_request_type" | "valuation_method" | "product_weight_unit" | "has_batch_no" | "create_new_batch" | "has_expiry_date" | "retain_sample" | "sample_quantity" | "has_serial_no" | "has_variants" | "variant_based_on" | "min_order_qty" | "safety_stock" | "is_purchase_item" | "custom_include_in_purchase_planning" | "lead_time_days" | "last_purchase_rate" | "is_customer_provided_item" | "fsc_percentage" | "sales_uom" | "is_sales_item" | "custom_is_selling_enabled" | "max_discount" | "enable_deferred_revenue" | "no_of_months" | "enable_deferred_expense" | "no_of_months_exp" | "inspection_required_before_purchase" | "inspection_required_before_delivery" | "is_sub_contracted_item" | "customer_code" | "total_projected_qty" | "custom_oversell_amount") | ("length" | "_user_tags" | "image" | "weight_per_unit" | "customs_tariff_number" | "country_of_origin" | "warehouse_category" | "ean" | "shipping_template" | "width" | "height" | "shipping_length" | "shipping_width" | "shipping_height" | "packaging_weight_cardboard" | "packaging_weight_plastic" | "product_weight" | "fsc_status" | "custom_fsc_type_of_wood" | "custom_fsc_product_group" | "custom_product_version" | "custom_supplier" | "purchase_description" | "custom_stock_reserve" | "custom_sales_category" | "custom_shopify_content_configuration" | "custom_compliance" | "custom_serviceportal_configuration"), TSelectedFields extends readonly ["*"] | readonly TFieldOptions[] | undefined = undefined, TAsDict extends boolean | undefined = undefined>({ fields, filters, skip, limit, priority, asDict, params, }?: {
11
+ getList: <TFieldOptions extends ("description" | "docstatus" | "name" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "disabled" | "naming_series" | "item_code" | "delivered_by_supplier" | "weight_uom" | "item_name" | "item_group" | "stock_uom" | "grant_commission" | "override_base_name" | "sync_from_warehouse" | "allow_alternative_item" | "is_stock_item" | "custom_is_digital" | "include_item_in_manufacturing" | "opening_stock" | "valuation_rate" | "standard_rate" | "is_fixed_asset" | "auto_create_assets" | "over_delivery_receipt_allowance" | "over_billing_allowance" | "custom_is_shipping_enabled" | "dimensions_unit" | "custom_dimension_format" | "shipping_dimensions_unit" | "packaging_weight_unit_cardboard" | "packaging_weight_unit_plastic" | "shelf_life_in_days" | "default_material_request_type" | "valuation_method" | "product_weight_unit" | "has_batch_no" | "create_new_batch" | "has_expiry_date" | "retain_sample" | "sample_quantity" | "has_serial_no" | "has_variants" | "variant_based_on" | "min_order_qty" | "safety_stock" | "is_purchase_item" | "custom_include_in_purchase_planning" | "lead_time_days" | "last_purchase_rate" | "is_customer_provided_item" | "fsc_percentage" | "sales_uom" | "is_sales_item" | "custom_is_selling_enabled" | "max_discount" | "enable_deferred_revenue" | "no_of_months" | "enable_deferred_expense" | "no_of_months_exp" | "inspection_required_before_purchase" | "inspection_required_before_delivery" | "is_sub_contracted_item" | "customer_code" | "total_projected_qty" | "custom_oversell_amount") | ("length" | "_user_tags" | "image" | "weight_per_unit" | "customs_tariff_number" | "country_of_origin" | "warehouse_category" | "ean" | "shipping_template" | "width" | "height" | "shipping_length" | "shipping_width" | "shipping_height" | "packaging_weight_cardboard" | "packaging_weight_plastic" | "end_of_life" | "product_weight" | "fsc_status" | "custom_fsc_type_of_wood" | "custom_fsc_product_group" | "custom_product_version" | "custom_supplier" | "purchase_description" | "custom_stock_reserve" | "custom_sales_category" | "custom_shopify_content_configuration" | "custom_compliance" | "custom_serviceportal_configuration"), TSelectedFields extends readonly ["*"] | readonly TFieldOptions[] | undefined = undefined, TAsDict extends boolean | undefined = undefined>({ fields, filters, skip, limit, priority, asDict, params, }?: {
12
12
  fields?: TSelectedFields;
13
13
  filters?: (string | string[])[][];
14
14
  skip?: number;
@@ -56,7 +56,6 @@ export declare class ERPNextItem {
56
56
  packaging_weight_unit_cardboard: "kg" | "g" | "mg";
57
57
  packaging_weight_unit_plastic: "kg" | "g" | "mg";
58
58
  shelf_life_in_days: number;
59
- end_of_life: string;
60
59
  default_material_request_type: string;
61
60
  valuation_method: string;
62
61
  product_weight_unit: "kg" | "g" | "mg";
@@ -106,6 +105,7 @@ export declare class ERPNextItem {
106
105
  shipping_height?: number | null | undefined;
107
106
  packaging_weight_cardboard?: number | null | undefined;
108
107
  packaging_weight_plastic?: number | null | undefined;
108
+ end_of_life?: string | null | undefined;
109
109
  product_weight?: number | null | undefined;
110
110
  fsc_status?: string | null | undefined;
111
111
  custom_fsc_type_of_wood?: string | null | undefined;
@@ -118,7 +118,7 @@ export declare class ERPNextItem {
118
118
  custom_shopify_content_configuration?: string | null | undefined;
119
119
  custom_compliance?: string | null | undefined;
120
120
  custom_serviceportal_configuration?: string | null | undefined;
121
- }[] : 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 ("description" | "docstatus" | "name" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "disabled" | "naming_series" | "item_code" | "delivered_by_supplier" | "weight_uom" | "item_name" | "item_group" | "stock_uom" | "grant_commission" | "override_base_name" | "sync_from_warehouse" | "allow_alternative_item" | "is_stock_item" | "custom_is_digital" | "include_item_in_manufacturing" | "opening_stock" | "valuation_rate" | "standard_rate" | "is_fixed_asset" | "auto_create_assets" | "over_delivery_receipt_allowance" | "over_billing_allowance" | "custom_is_shipping_enabled" | "dimensions_unit" | "custom_dimension_format" | "shipping_dimensions_unit" | "packaging_weight_unit_cardboard" | "packaging_weight_unit_plastic" | "shelf_life_in_days" | "end_of_life" | "default_material_request_type" | "valuation_method" | "product_weight_unit" | "has_batch_no" | "create_new_batch" | "has_expiry_date" | "retain_sample" | "sample_quantity" | "has_serial_no" | "has_variants" | "variant_based_on" | "min_order_qty" | "safety_stock" | "is_purchase_item" | "custom_include_in_purchase_planning" | "lead_time_days" | "last_purchase_rate" | "is_customer_provided_item" | "fsc_percentage" | "sales_uom" | "is_sales_item" | "custom_is_selling_enabled" | "max_discount" | "enable_deferred_revenue" | "no_of_months" | "enable_deferred_expense" | "no_of_months_exp" | "inspection_required_before_purchase" | "inspection_required_before_delivery" | "is_sub_contracted_item" | "customer_code" | "total_projected_qty" | "custom_oversell_amount") | ("length" | "_user_tags" | "image" | "weight_per_unit" | "customs_tariff_number" | "country_of_origin" | "warehouse_category" | "ean" | "shipping_template" | "width" | "height" | "shipping_length" | "shipping_width" | "shipping_height" | "packaging_weight_cardboard" | "packaging_weight_plastic" | "product_weight" | "fsc_status" | "custom_fsc_type_of_wood" | "custom_fsc_product_group" | "custom_product_version" | "custom_supplier" | "purchase_description" | "custom_stock_reserve" | "custom_sales_category" | "custom_shopify_content_configuration" | "custom_compliance" | "custom_serviceportal_configuration") ? {
121
+ }[] : 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 ("description" | "docstatus" | "name" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "disabled" | "naming_series" | "item_code" | "delivered_by_supplier" | "weight_uom" | "item_name" | "item_group" | "stock_uom" | "grant_commission" | "override_base_name" | "sync_from_warehouse" | "allow_alternative_item" | "is_stock_item" | "custom_is_digital" | "include_item_in_manufacturing" | "opening_stock" | "valuation_rate" | "standard_rate" | "is_fixed_asset" | "auto_create_assets" | "over_delivery_receipt_allowance" | "over_billing_allowance" | "custom_is_shipping_enabled" | "dimensions_unit" | "custom_dimension_format" | "shipping_dimensions_unit" | "packaging_weight_unit_cardboard" | "packaging_weight_unit_plastic" | "shelf_life_in_days" | "default_material_request_type" | "valuation_method" | "product_weight_unit" | "has_batch_no" | "create_new_batch" | "has_expiry_date" | "retain_sample" | "sample_quantity" | "has_serial_no" | "has_variants" | "variant_based_on" | "min_order_qty" | "safety_stock" | "is_purchase_item" | "custom_include_in_purchase_planning" | "lead_time_days" | "last_purchase_rate" | "is_customer_provided_item" | "fsc_percentage" | "sales_uom" | "is_sales_item" | "custom_is_selling_enabled" | "max_discount" | "enable_deferred_revenue" | "no_of_months" | "enable_deferred_expense" | "no_of_months_exp" | "inspection_required_before_purchase" | "inspection_required_before_delivery" | "is_sub_contracted_item" | "customer_code" | "total_projected_qty" | "custom_oversell_amount") | ("length" | "_user_tags" | "image" | "weight_per_unit" | "customs_tariff_number" | "country_of_origin" | "warehouse_category" | "ean" | "shipping_template" | "width" | "height" | "shipping_length" | "shipping_width" | "shipping_height" | "packaging_weight_cardboard" | "packaging_weight_plastic" | "end_of_life" | "product_weight" | "fsc_status" | "custom_fsc_type_of_wood" | "custom_fsc_product_group" | "custom_product_version" | "custom_supplier" | "purchase_description" | "custom_stock_reserve" | "custom_sales_category" | "custom_shopify_content_configuration" | "custom_compliance" | "custom_serviceportal_configuration") ? {
122
122
  description: string;
123
123
  docstatus: number;
124
124
  name: string;
@@ -156,7 +156,6 @@ export declare class ERPNextItem {
156
156
  packaging_weight_unit_cardboard: "kg" | "g" | "mg";
157
157
  packaging_weight_unit_plastic: "kg" | "g" | "mg";
158
158
  shelf_life_in_days: number;
159
- end_of_life: string;
160
159
  default_material_request_type: string;
161
160
  valuation_method: string;
162
161
  product_weight_unit: "kg" | "g" | "mg";
@@ -206,6 +205,7 @@ export declare class ERPNextItem {
206
205
  shipping_height?: number | null | undefined;
207
206
  packaging_weight_cardboard?: number | null | undefined;
208
207
  packaging_weight_plastic?: number | null | undefined;
208
+ end_of_life?: string | null | undefined;
209
209
  product_weight?: number | null | undefined;
210
210
  fsc_status?: string | null | undefined;
211
211
  custom_fsc_type_of_wood?: string | null | undefined;
@@ -218,7 +218,7 @@ export declare class ERPNextItem {
218
218
  custom_shopify_content_configuration?: string | null | undefined;
219
219
  custom_compliance?: string | null | undefined;
220
220
  custom_serviceportal_configuration?: string | null | undefined;
221
- }[(("description" | "docstatus" | "name" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "disabled" | "naming_series" | "item_code" | "delivered_by_supplier" | "weight_uom" | "item_name" | "item_group" | "stock_uom" | "grant_commission" | "override_base_name" | "sync_from_warehouse" | "allow_alternative_item" | "is_stock_item" | "custom_is_digital" | "include_item_in_manufacturing" | "opening_stock" | "valuation_rate" | "standard_rate" | "is_fixed_asset" | "auto_create_assets" | "over_delivery_receipt_allowance" | "over_billing_allowance" | "custom_is_shipping_enabled" | "dimensions_unit" | "custom_dimension_format" | "shipping_dimensions_unit" | "packaging_weight_unit_cardboard" | "packaging_weight_unit_plastic" | "shelf_life_in_days" | "end_of_life" | "default_material_request_type" | "valuation_method" | "product_weight_unit" | "has_batch_no" | "create_new_batch" | "has_expiry_date" | "retain_sample" | "sample_quantity" | "has_serial_no" | "has_variants" | "variant_based_on" | "min_order_qty" | "safety_stock" | "is_purchase_item" | "custom_include_in_purchase_planning" | "lead_time_days" | "last_purchase_rate" | "is_customer_provided_item" | "fsc_percentage" | "sales_uom" | "is_sales_item" | "custom_is_selling_enabled" | "max_discount" | "enable_deferred_revenue" | "no_of_months" | "enable_deferred_expense" | "no_of_months_exp" | "inspection_required_before_purchase" | "inspection_required_before_delivery" | "is_sub_contracted_item" | "customer_code" | "total_projected_qty" | "custom_oversell_amount") | ("length" | "_user_tags" | "image" | "weight_per_unit" | "customs_tariff_number" | "country_of_origin" | "warehouse_category" | "ean" | "shipping_template" | "width" | "height" | "shipping_length" | "shipping_width" | "shipping_height" | "packaging_weight_cardboard" | "packaging_weight_plastic" | "product_weight" | "fsc_status" | "custom_fsc_type_of_wood" | "custom_fsc_product_group" | "custom_product_version" | "custom_supplier" | "purchase_description" | "custom_stock_reserve" | "custom_sales_category" | "custom_shopify_content_configuration" | "custom_compliance" | "custom_serviceportal_configuration")) & (K_1 extends `${infer _Before} as ${infer Alias}` ? Alias : K_1)] : never; }[] : any) extends infer T ? { [K in keyof T]: T[K]; } : never>;
221
+ }[(("description" | "docstatus" | "name" | "owner" | "creation" | "modified" | "modified_by" | "idx" | "disabled" | "naming_series" | "item_code" | "delivered_by_supplier" | "weight_uom" | "item_name" | "item_group" | "stock_uom" | "grant_commission" | "override_base_name" | "sync_from_warehouse" | "allow_alternative_item" | "is_stock_item" | "custom_is_digital" | "include_item_in_manufacturing" | "opening_stock" | "valuation_rate" | "standard_rate" | "is_fixed_asset" | "auto_create_assets" | "over_delivery_receipt_allowance" | "over_billing_allowance" | "custom_is_shipping_enabled" | "dimensions_unit" | "custom_dimension_format" | "shipping_dimensions_unit" | "packaging_weight_unit_cardboard" | "packaging_weight_unit_plastic" | "shelf_life_in_days" | "default_material_request_type" | "valuation_method" | "product_weight_unit" | "has_batch_no" | "create_new_batch" | "has_expiry_date" | "retain_sample" | "sample_quantity" | "has_serial_no" | "has_variants" | "variant_based_on" | "min_order_qty" | "safety_stock" | "is_purchase_item" | "custom_include_in_purchase_planning" | "lead_time_days" | "last_purchase_rate" | "is_customer_provided_item" | "fsc_percentage" | "sales_uom" | "is_sales_item" | "custom_is_selling_enabled" | "max_discount" | "enable_deferred_revenue" | "no_of_months" | "enable_deferred_expense" | "no_of_months_exp" | "inspection_required_before_purchase" | "inspection_required_before_delivery" | "is_sub_contracted_item" | "customer_code" | "total_projected_qty" | "custom_oversell_amount") | ("length" | "_user_tags" | "image" | "weight_per_unit" | "customs_tariff_number" | "country_of_origin" | "warehouse_category" | "ean" | "shipping_template" | "width" | "height" | "shipping_length" | "shipping_width" | "shipping_height" | "packaging_weight_cardboard" | "packaging_weight_plastic" | "end_of_life" | "product_weight" | "fsc_status" | "custom_fsc_type_of_wood" | "custom_fsc_product_group" | "custom_product_version" | "custom_supplier" | "purchase_description" | "custom_stock_reserve" | "custom_sales_category" | "custom_shopify_content_configuration" | "custom_compliance" | "custom_serviceportal_configuration")) & (K_1 extends `${infer _Before} as ${infer Alias}` ? Alias : K_1)] : never; }[] : any) extends infer T ? { [K in keyof T]: T[K]; } : never>;
222
222
  getById: ({ resourceId, priority, }: {
223
223
  resourceId: string;
224
224
  priority?: number;
@@ -262,7 +262,6 @@ export declare class ERPNextItem {
262
262
  packaging_weight_unit_cardboard: "kg" | "g" | "mg";
263
263
  packaging_weight_unit_plastic: "kg" | "g" | "mg";
264
264
  shelf_life_in_days: number;
265
- end_of_life: string;
266
265
  default_material_request_type: string;
267
266
  valuation_method: string;
268
267
  product_weight_unit: "kg" | "g" | "mg";
@@ -394,6 +393,7 @@ export declare class ERPNextItem {
394
393
  shipping_height?: number | null | undefined;
395
394
  packaging_weight_cardboard?: number | null | undefined;
396
395
  packaging_weight_plastic?: number | null | undefined;
396
+ end_of_life?: string | null | undefined;
397
397
  product_weight?: number | null | undefined;
398
398
  fsc_status?: string | null | undefined;
399
399
  custom_fsc_type_of_wood?: string | null | undefined;
@@ -435,7 +435,6 @@ export declare class ERPNextItem {
435
435
  packaging_weight_unit_cardboard: "kg" | "g" | "mg";
436
436
  packaging_weight_unit_plastic: "kg" | "g" | "mg";
437
437
  shelf_life_in_days: number;
438
- end_of_life: string;
439
438
  default_material_request_type: string;
440
439
  valuation_method: string;
441
440
  product_weight_unit: "kg" | "g" | "mg";
@@ -511,6 +510,7 @@ export declare class ERPNextItem {
511
510
  shipping_height?: number | null | undefined;
512
511
  packaging_weight_cardboard?: number | null | undefined;
513
512
  packaging_weight_plastic?: number | null | undefined;
513
+ end_of_life?: string | null | undefined;
514
514
  product_weight?: number | null | undefined;
515
515
  fsc_status?: string | null | undefined;
516
516
  custom_fsc_type_of_wood?: string | null | undefined;
@@ -568,7 +568,6 @@ export declare class ERPNextItem {
568
568
  packaging_weight_unit_cardboard: "kg" | "g" | "mg";
569
569
  packaging_weight_unit_plastic: "kg" | "g" | "mg";
570
570
  shelf_life_in_days: number;
571
- end_of_life: string;
572
571
  default_material_request_type: string;
573
572
  valuation_method: string;
574
573
  product_weight_unit: "kg" | "g" | "mg";
@@ -700,6 +699,7 @@ export declare class ERPNextItem {
700
699
  shipping_height?: number | null | undefined;
701
700
  packaging_weight_cardboard?: number | null | undefined;
702
701
  packaging_weight_plastic?: number | null | undefined;
702
+ end_of_life?: string | null | undefined;
703
703
  product_weight?: number | null | undefined;
704
704
  fsc_status?: string | null | undefined;
705
705
  custom_fsc_type_of_wood?: string | null | undefined;
@@ -745,7 +745,6 @@ export declare class ERPNextItem {
745
745
  packaging_weight_unit_cardboard: "kg" | "g" | "mg";
746
746
  packaging_weight_unit_plastic: "kg" | "g" | "mg";
747
747
  shelf_life_in_days: number;
748
- end_of_life: string;
749
748
  default_material_request_type: string;
750
749
  valuation_method: string;
751
750
  product_weight_unit: "kg" | "g" | "mg";
@@ -821,6 +820,7 @@ export declare class ERPNextItem {
821
820
  shipping_height?: number | null | undefined;
822
821
  packaging_weight_cardboard?: number | null | undefined;
823
822
  packaging_weight_plastic?: number | null | undefined;
823
+ end_of_life?: string | null | undefined;
824
824
  product_weight?: number | null | undefined;
825
825
  fsc_status?: string | null | undefined;
826
826
  custom_fsc_type_of_wood?: string | null | undefined;
@@ -878,7 +878,6 @@ export declare class ERPNextItem {
878
878
  packaging_weight_unit_cardboard: "kg" | "g" | "mg";
879
879
  packaging_weight_unit_plastic: "kg" | "g" | "mg";
880
880
  shelf_life_in_days: number;
881
- end_of_life: string;
882
881
  default_material_request_type: string;
883
882
  valuation_method: string;
884
883
  product_weight_unit: "kg" | "g" | "mg";
@@ -1010,6 +1009,7 @@ export declare class ERPNextItem {
1010
1009
  shipping_height?: number | null | undefined;
1011
1010
  packaging_weight_cardboard?: number | null | undefined;
1012
1011
  packaging_weight_plastic?: number | null | undefined;
1012
+ end_of_life?: string | null | undefined;
1013
1013
  product_weight?: number | null | undefined;
1014
1014
  fsc_status?: string | null | undefined;
1015
1015
  custom_fsc_type_of_wood?: string | null | undefined;
@@ -1,13 +1,4 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.ERPNextItem = void 0;
13
4
  const lodash_1 = require("lodash");
@@ -19,6 +10,14 @@ const Item_1 = require("../model/Item");
19
10
  const ProjectedQuantityReport_1 = require("../model/ProjectedQuantityReport");
20
11
  const StockDict_1 = require("../model/StockDict");
21
12
  class ERPNextItem {
13
+ temporalClient;
14
+ baseRequest;
15
+ methodRequest;
16
+ getList;
17
+ getById;
18
+ updateById;
19
+ deleteById;
20
+ create;
22
21
  constructor(temporalClient) {
23
22
  this.temporalClient = temporalClient;
24
23
  this.baseRequest = new doctypeResourceRequest_1.ERPNextDoctypeResourceRequest(temporalClient, "Item", Item_1.Item);
@@ -29,69 +28,71 @@ class ERPNextItem {
29
28
  this.create = this.baseRequest.create;
30
29
  this.methodRequest = new methodRequest_1.ERPNextMethodRequest(temporalClient);
31
30
  }
32
- getNoneStockItems(params) {
33
- return __awaiter(this, void 0, void 0, function* () {
34
- const result = yield this.baseRequest.getList(Object.assign({ filters: [["is_stock_item", "=", "0"]], asDict: false }, (params ? { params } : {})));
35
- return result.map(([item_code]) => item_code).filter(utils_1.isDefined);
31
+ async getNoneStockItems(params) {
32
+ const result = await this.baseRequest.getList({
33
+ filters: [["is_stock_item", "=", "0"]],
34
+ asDict: false,
35
+ ...(params ? { params } : {}),
36
36
  });
37
+ return result.map(([item_code]) => item_code).filter(utils_1.isDefined);
37
38
  }
38
- getStockDict(warehouse) {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- const result = yield this.methodRequest.request({
41
- requestMethod: "GET",
42
- methodName: `get_stock_from_bin?warehouse=${encodeURIComponent(warehouse)}`,
43
- responseValidationModel: StockDict_1.StockDict,
44
- });
45
- return result;
39
+ async getStockDict(warehouse) {
40
+ const result = await this.methodRequest.request({
41
+ requestMethod: "GET",
42
+ methodName: `get_stock_from_bin?warehouse=${encodeURIComponent(warehouse)}`,
43
+ responseValidationModel: StockDict_1.StockDict,
46
44
  });
45
+ return result;
47
46
  }
48
- getProjectedQuantity() {
49
- return __awaiter(this, arguments, void 0, function* (options = {}) {
50
- const { itemCodes, warehouse } = options;
51
- const validated = yield this.methodRequest.request({
52
- requestMethod: "POST",
53
- methodName: "frappe.desk.query_report.run",
54
- inputValidationModel: ProjectedQuantityReport_1.GetProjectedQuantityRequestBody,
55
- responseValidationModel: ProjectedQuantityReport_1.GetProjectedQuantity,
56
- body: Object.assign({ report_name: "Stock Projected Qty" }, ((itemCodes === null || itemCodes === void 0 ? void 0 : itemCodes.length) || warehouse
47
+ async getProjectedQuantity(options = {}) {
48
+ const { itemCodes, warehouse } = options;
49
+ const validated = await this.methodRequest.request({
50
+ requestMethod: "POST",
51
+ methodName: "frappe.desk.query_report.run",
52
+ inputValidationModel: ProjectedQuantityReport_1.GetProjectedQuantityRequestBody,
53
+ responseValidationModel: ProjectedQuantityReport_1.GetProjectedQuantity,
54
+ body: {
55
+ report_name: "Stock Projected Qty",
56
+ ...(itemCodes?.length || warehouse
57
57
  ? {
58
- filters: Object.assign(Object.assign({}, ((itemCodes === null || itemCodes === void 0 ? void 0 : itemCodes.length) === 1 && { item_code: itemCodes[0] })), (warehouse && { warehouse })),
58
+ filters: {
59
+ ...(itemCodes?.length === 1 && { item_code: itemCodes[0] }),
60
+ ...(warehouse && { warehouse }),
61
+ },
59
62
  }
60
- : {})),
61
- });
62
- const stockLevels = {};
63
- validated.result
64
- .filter((r) => !(0, lodash_1.isArray)(r))
65
- .forEach((r) => {
66
- const projectedQuantity = r;
67
- stockLevels[projectedQuantity.item_code] = stockLevels[projectedQuantity.item_code]
68
- ? stockLevels[projectedQuantity.item_code] +
69
- projectedQuantity.actual_qty
70
- : projectedQuantity.actual_qty;
71
- });
72
- // Add 0 for requested items that are not in stock
73
- itemCodes === null || itemCodes === void 0 ? void 0 : itemCodes.forEach((sku) => {
74
- if (Object(stockLevels).hasOwnProperty(sku))
75
- return;
76
- stockLevels[sku] = 0;
77
- });
78
- return stockLevels;
63
+ : {}),
64
+ },
79
65
  });
66
+ const stockLevels = {};
67
+ validated.result
68
+ .filter((r) => !(0, lodash_1.isArray)(r))
69
+ .forEach((r) => {
70
+ const projectedQuantity = r;
71
+ stockLevels[projectedQuantity.item_code] = stockLevels[projectedQuantity.item_code]
72
+ ? stockLevels[projectedQuantity.item_code] +
73
+ projectedQuantity.actual_qty
74
+ : projectedQuantity.actual_qty;
75
+ });
76
+ // Add 0 for requested items that are not in stock
77
+ itemCodes?.forEach((sku) => {
78
+ if (Object(stockLevels).hasOwnProperty(sku))
79
+ return;
80
+ stockLevels[sku] = 0;
81
+ });
82
+ return stockLevels;
80
83
  }
81
- createBStockItems(aStockSkus) {
82
- return __awaiter(this, void 0, void 0, function* () {
83
- const result = yield this.methodRequest.request({
84
- requestMethod: "POST",
85
- methodName: `create-bstock-items`,
86
- body: {
87
- skus: aStockSkus,
88
- },
89
- responseValidationModel: zod_1.z
90
- .array(zod_1.z.string())
91
- .describe("Created B-Stock Item Response"),
92
- });
93
- return result;
84
+ async createBStockItems(aStockSkus) {
85
+ const result = await this.methodRequest.request({
86
+ requestMethod: "POST",
87
+ methodName: `create-bstock-items`,
88
+ body: {
89
+ skus: aStockSkus,
90
+ },
91
+ responseValidationModel: zod_1.z
92
+ .array(zod_1.z.string())
93
+ .describe("Created B-Stock Item Response"),
94
94
  });
95
+ return result;
95
96
  }
96
97
  }
97
98
  exports.ERPNextItem = ERPNextItem;
@@ -1,19 +1,20 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.ERPNextPaymentEntry = void 0;
13
4
  const doctypeSubmittableResourceRequest_1 = require("../doctypeSubmittableResourceRequest");
14
5
  const methodRequest_1 = require("../methodRequest");
15
6
  const PaymentEntry_1 = require("../model/PaymentEntry");
16
7
  class ERPNextPaymentEntry {
8
+ temporalClient;
9
+ baseRequest;
10
+ methodRequest;
11
+ getList;
12
+ getById;
13
+ create;
14
+ updateById;
15
+ deleteById;
16
+ cancel;
17
+ submit;
17
18
  constructor(temporalClient) {
18
19
  this.temporalClient = temporalClient;
19
20
  this.baseRequest = new doctypeSubmittableResourceRequest_1.ERPNextDoctypeSubmittableResourceRequest(temporalClient, "Payment Entry", PaymentEntry_1.PaymentEntry);
@@ -26,46 +27,44 @@ class ERPNextPaymentEntry {
26
27
  this.cancel = this.baseRequest.cancel;
27
28
  this.submit = this.baseRequest.submit;
28
29
  }
29
- createPaymentEntryDraftFromSalesOrder(salesOrderName) {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- const draft = yield this.methodRequest.request({
32
- methodName: "erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry",
33
- requestMethod: "POST",
34
- responseValidationModel: PaymentEntry_1.PaymentEntryDraft,
35
- params: { dt: "Sales Order", dn: salesOrderName },
36
- });
37
- return draft;
30
+ async createPaymentEntryDraftFromSalesOrder(salesOrderName) {
31
+ const draft = await this.methodRequest.request({
32
+ methodName: "erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry",
33
+ requestMethod: "POST",
34
+ responseValidationModel: PaymentEntry_1.PaymentEntryDraft,
35
+ params: { dt: "Sales Order", dn: salesOrderName },
38
36
  });
37
+ return draft;
39
38
  }
40
- createPaymentEntryDraftFromSalesInvoice(salesInvoiceName) {
41
- return __awaiter(this, void 0, void 0, function* () {
42
- const draft = yield this.methodRequest.request({
43
- methodName: "erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry",
44
- requestMethod: "POST",
45
- responseValidationModel: PaymentEntry_1.PaymentEntryDraft,
46
- params: { dt: "Sales Invoice", dn: salesInvoiceName },
47
- });
48
- return draft;
39
+ async createPaymentEntryDraftFromSalesInvoice(salesInvoiceName) {
40
+ const draft = await this.methodRequest.request({
41
+ methodName: "erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry",
42
+ requestMethod: "POST",
43
+ responseValidationModel: PaymentEntry_1.PaymentEntryDraft,
44
+ params: { dt: "Sales Invoice", dn: salesInvoiceName },
49
45
  });
46
+ return draft;
50
47
  }
51
- createFromSalesOrder(salesOrderName_1) {
52
- return __awaiter(this, arguments, void 0, function* (salesOrderName, submit = false) {
53
- const paymentEntryDraft = yield this.createPaymentEntryDraftFromSalesOrder(salesOrderName);
54
- const body = Object.assign(Object.assign({}, paymentEntryDraft), (submit === true ? { docstatus: 1 } : {}));
55
- return yield this.baseRequest.create({
56
- inputValidationModel: PaymentEntry_1.PaymentEntryDraft,
57
- body,
58
- });
48
+ async createFromSalesOrder(salesOrderName, submit = false) {
49
+ const paymentEntryDraft = await this.createPaymentEntryDraftFromSalesOrder(salesOrderName);
50
+ const body = {
51
+ ...paymentEntryDraft,
52
+ ...(submit === true ? { docstatus: 1 } : {}),
53
+ };
54
+ return await this.baseRequest.create({
55
+ inputValidationModel: PaymentEntry_1.PaymentEntryDraft,
56
+ body,
59
57
  });
60
58
  }
61
- createFromSalesInvoice(salesInvoiceName_1) {
62
- return __awaiter(this, arguments, void 0, function* (salesInvoiceName, submit = false) {
63
- const paymentEntryDraft = yield this.createPaymentEntryDraftFromSalesInvoice(salesInvoiceName);
64
- const body = Object.assign(Object.assign({}, paymentEntryDraft), (submit === true ? { docstatus: 1 } : {}));
65
- return yield this.baseRequest.create({
66
- inputValidationModel: PaymentEntry_1.PaymentEntryDraft,
67
- body,
68
- });
59
+ async createFromSalesInvoice(salesInvoiceName, submit = false) {
60
+ const paymentEntryDraft = await this.createPaymentEntryDraftFromSalesInvoice(salesInvoiceName);
61
+ const body = {
62
+ ...paymentEntryDraft,
63
+ ...(submit === true ? { docstatus: 1 } : {}),
64
+ };
65
+ return await this.baseRequest.create({
66
+ inputValidationModel: PaymentEntry_1.PaymentEntryDraft,
67
+ body,
69
68
  });
70
69
  }
71
70
  }