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,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.erpnextRequest = erpnextRequest;
13
4
  exports.erpNextDownloadFile = erpNextDownloadFile;
@@ -15,79 +6,91 @@ const request_1 = require("../utils/request");
15
6
  const zodUtils_1 = require("../utils/zodUtils");
16
7
  const ERPNextResponse_1 = require("./model/ERPNextResponse");
17
8
  function getHeaders(credentials) {
18
- return Object.assign({
19
- Authorization: `token ${credentials.erpnextApiKey}:${credentials.erpnextApiSecret}`,
20
- "Content-Type": "application/json",
21
- }, (credentials.cloudflareAccessClientId &&
22
- credentials.cloudflareAccessClientSecret
23
- ? {
24
- "CF-Access-Client-Id": credentials.cloudflareAccessClientId,
25
- "CF-Access-Client-Secret": credentials.cloudflareAccessClientSecret,
26
- }
27
- : {}));
9
+ return {
10
+ ...{
11
+ Authorization: `token ${credentials.erpnextApiKey}:${credentials.erpnextApiSecret}`,
12
+ "Content-Type": "application/json",
13
+ },
14
+ ...(credentials.cloudflareAccessClientId &&
15
+ credentials.cloudflareAccessClientSecret
16
+ ? {
17
+ "CF-Access-Client-Id": credentials.cloudflareAccessClientId,
18
+ "CF-Access-Client-Secret": credentials.cloudflareAccessClientSecret,
19
+ }
20
+ : {}),
21
+ };
28
22
  }
29
- function erpnextRequest(credentials, options) {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- var _a, _b;
32
- const baseUrl = "methodName" in options && options.methodName
33
- ? `${credentials.erpnextUrl}/api/method/${options.methodName}`
34
- : "resourceName" in options && options.resourceName
35
- ? `${credentials.erpnextUrl}/api/resource/${options.resourceName}`
36
- : ((_a = ("url" in options && options.url)) !== null && _a !== void 0 ? _a : undefined);
37
- if (!baseUrl)
38
- throw new Error("No resource or method name provided");
39
- const inputUrl = `${baseUrl.startsWith("/api/method") ? `${credentials.erpnextUrl}` : ""}${baseUrl}${"resourceId" in options && options.resourceId
40
- ? `/${options.resourceId}`
41
- : ""}${options.params ? `${options.params}` : ""}`;
42
- const url = "resourceName" in options &&
43
- options.resourceName &&
44
- options.requestMethod === "GET"
45
- ? inputUrl.includes("?")
46
- ? `${inputUrl}&limit=0`
47
- : !("resourceId" in options && options.resourceId)
48
- ? `${inputUrl}?limit=0`
49
- : inputUrl
50
- : inputUrl;
51
- const combinedHeaders = Object.assign(Object.assign({}, getHeaders(credentials)), (options.headers ? options.headers : {}));
52
- // lgTemporal.info(`Temp url request check ${url}`);
53
- const unvalidatedResult = yield (0, request_1.request)(Object.assign({ headers: combinedHeaders, url, method: options.requestMethod, inputValidationModel: (_b = ("inputValidationModel" in options && options.inputValidationModel)) !== null && _b !== void 0 ? _b : false, responseValidationModel: false }, ("body" in options && options.body ? { body: options.body } : {}))).catch((err) => {
54
- throw err.status
55
- ? new Error(`Error ${err.status}: ${err.response &&
56
- typeof err.response === "object" &&
57
- "_server_messages" in err.response &&
58
- typeof err.response._server_messages === "string"
59
- ? JSON.parse(err.response._server_messages)
60
- : JSON.stringify(err.response)}`)
61
- : err;
62
- });
63
- if (!options.responseValidationModel)
64
- return unvalidatedResult;
65
- let returnValue;
66
- if ("methodName" in options && options.methodName) {
67
- const validatedResult = (0, zodUtils_1.validateData)(unvalidatedResult, ERPNextResponse_1.ERPNextMethodResponse);
68
- returnValue = (0, zodUtils_1.validateData)(validatedResult.message, options.responseValidationModel);
69
- }
70
- else {
71
- const validatedResult = (0, zodUtils_1.validateData)(unvalidatedResult, ERPNextResponse_1.ERPNextResourceResponse);
72
- returnValue = (0, zodUtils_1.validateData)(validatedResult.data, options.responseValidationModel);
73
- }
74
- return returnValue;
23
+ async function erpnextRequest(credentials, options) {
24
+ const baseUrl = "methodName" in options && options.methodName
25
+ ? `${credentials.erpnextUrl}/api/method/${options.methodName}`
26
+ : "resourceName" in options && options.resourceName
27
+ ? `${credentials.erpnextUrl}/api/resource/${options.resourceName}`
28
+ : (("url" in options && options.url) ?? undefined);
29
+ if (!baseUrl)
30
+ throw new Error("No resource or method name provided");
31
+ const inputUrl = `${baseUrl.startsWith("/api/method") ? `${credentials.erpnextUrl}` : ""}${baseUrl}${"resourceId" in options && options.resourceId
32
+ ? `/${options.resourceId}`
33
+ : ""}${options.params ? `${options.params}` : ""}`;
34
+ const url = "resourceName" in options &&
35
+ options.resourceName &&
36
+ options.requestMethod === "GET"
37
+ ? inputUrl.includes("?")
38
+ ? `${inputUrl}&limit=0`
39
+ : !("resourceId" in options && options.resourceId)
40
+ ? `${inputUrl}?limit=0`
41
+ : inputUrl
42
+ : inputUrl;
43
+ const combinedHeaders = {
44
+ ...getHeaders(credentials),
45
+ ...(options.headers ? options.headers : {}),
46
+ };
47
+ // lgTemporal.info(`Temp url request check ${url}`);
48
+ const unvalidatedResult = await (0, request_1.request)({
49
+ headers: combinedHeaders,
50
+ url,
51
+ method: options.requestMethod,
52
+ inputValidationModel: ("inputValidationModel" in options && options.inputValidationModel) ??
53
+ false,
54
+ responseValidationModel: false,
55
+ ...("body" in options && options.body ? { body: options.body } : {}),
56
+ }).catch((err) => {
57
+ throw err.status
58
+ ? new Error(`Error ${err.status}: ${err.response &&
59
+ typeof err.response === "object" &&
60
+ "_server_messages" in err.response &&
61
+ typeof err.response._server_messages === "string"
62
+ ? JSON.parse(err.response._server_messages)
63
+ : JSON.stringify(err.response)}`)
64
+ : err;
75
65
  });
66
+ if (!options.responseValidationModel)
67
+ return unvalidatedResult;
68
+ let returnValue;
69
+ if ("methodName" in options && options.methodName) {
70
+ const validatedResult = (0, zodUtils_1.validateData)(unvalidatedResult, ERPNextResponse_1.ERPNextMethodResponse);
71
+ returnValue = (0, zodUtils_1.validateData)(validatedResult.message, options.responseValidationModel);
72
+ }
73
+ else {
74
+ const validatedResult = (0, zodUtils_1.validateData)(unvalidatedResult, ERPNextResponse_1.ERPNextResourceResponse);
75
+ returnValue = (0, zodUtils_1.validateData)(validatedResult.data, options.responseValidationModel);
76
+ }
77
+ return returnValue;
76
78
  }
77
- function erpNextDownloadFile(credentials, url) {
78
- return __awaiter(this, void 0, void 0, function* () {
79
- const isErpNextPrivateUrl = url.includes("/api/method");
80
- const inputUrl = `${url.startsWith("/api/method") ? `${credentials.erpnextUrl}` : ""}${url}`;
81
- let response = yield fetch(inputUrl, Object.assign(Object.assign({}, (isErpNextPrivateUrl ? { headers: getHeaders(credentials) } : {})), { redirect: isErpNextPrivateUrl ? "manual" : "follow" }));
82
- if ((response === null || response === void 0 ? void 0 : response.status) === 302) {
83
- const redirectUrl = response.headers.get("location");
84
- if (!redirectUrl)
85
- throw new Error("No redirect url");
86
- response = yield fetch(redirectUrl);
87
- }
88
- if (!response.body)
89
- throw new Error("No response body");
90
- const buffer = yield response.arrayBuffer();
91
- return Buffer.from(buffer);
79
+ async function erpNextDownloadFile(credentials, url) {
80
+ const isErpNextPrivateUrl = url.includes("/api/method");
81
+ const inputUrl = `${url.startsWith("/api/method") ? `${credentials.erpnextUrl}` : ""}${url}`;
82
+ let response = await fetch(inputUrl, {
83
+ ...(isErpNextPrivateUrl ? { headers: getHeaders(credentials) } : {}),
84
+ redirect: isErpNextPrivateUrl ? "manual" : "follow",
92
85
  });
86
+ if (response?.status === 302) {
87
+ const redirectUrl = response.headers.get("location");
88
+ if (!redirectUrl)
89
+ throw new Error("No redirect url");
90
+ response = await fetch(redirectUrl);
91
+ }
92
+ if (!response.body)
93
+ throw new Error("No response body");
94
+ const buffer = await response.arrayBuffer();
95
+ return Buffer.from(buffer);
93
96
  }
@@ -1,43 +1,42 @@
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.ERPNextFileRequests = void 0;
13
4
  const erpnextRequestWrapper_1 = require("./erpnextRequestWrapper");
14
5
  const DocTypeHelpers_1 = require("./model/DocTypeHelpers");
15
6
  const File_1 = require("./model/File");
16
7
  class ERPNextFileRequests {
8
+ client;
9
+ credentials;
17
10
  constructor(client, credentials) {
18
- this.fileDownload = (url) => __awaiter(this, void 0, void 0, function* () {
19
- if (!this.credentials)
20
- throw new Error("File download not possible. Please provide ERPNext API credentials.");
21
- return yield (0, erpnextRequestWrapper_1.erpNextDownloadFile)(this.credentials, url);
22
- });
23
- this.fileUpload = (file_1, filename_1, ...args_1) => __awaiter(this, [file_1, filename_1, ...args_1], void 0, function* (file, filename, doctypeToLinkTo = "", docnameToLinkTo = "", isPrivate = true, priority = 5) {
24
- if (!this.credentials)
25
- throw new Error("File upload not possible. Please provide ERPNext API credentials.");
26
- const body = Object.assign({ filedata: file.toString("base64"), filename, from_form: 1, is_private: isPrivate ? 1 : 0 }, (doctypeToLinkTo &&
11
+ this.client = client;
12
+ this.credentials = credentials;
13
+ }
14
+ fileDownload = async (url) => {
15
+ if (!this.credentials)
16
+ throw new Error("File download not possible. Please provide ERPNext API credentials.");
17
+ return await (0, erpnextRequestWrapper_1.erpNextDownloadFile)(this.credentials, url);
18
+ };
19
+ fileUpload = async (file, filename, doctypeToLinkTo = "", docnameToLinkTo = "", isPrivate = true, priority = 5) => {
20
+ if (!this.credentials)
21
+ throw new Error("File upload not possible. Please provide ERPNext API credentials.");
22
+ const body = {
23
+ filedata: file.toString("base64"),
24
+ filename,
25
+ from_form: 1,
26
+ is_private: isPrivate ? 1 : 0,
27
+ ...(doctypeToLinkTo &&
27
28
  docnameToLinkTo && {
28
29
  doctype: doctypeToLinkTo,
29
30
  docname: docnameToLinkTo,
30
- }));
31
- const result = yield (0, erpnextRequestWrapper_1.erpnextRequest)(this.credentials, {
32
- requestMethod: "POST",
33
- responseValidationModel: (0, DocTypeHelpers_1.DocModel)(File_1.ERPNextValidatedFile),
34
- methodName: "uploadfile",
35
- body,
36
- });
37
- return result;
31
+ }),
32
+ };
33
+ const result = await (0, erpnextRequestWrapper_1.erpnextRequest)(this.credentials, {
34
+ requestMethod: "POST",
35
+ responseValidationModel: (0, DocTypeHelpers_1.DocModel)(File_1.ERPNextValidatedFile),
36
+ methodName: "uploadfile",
37
+ body,
38
38
  });
39
- this.client = client;
40
- this.credentials = credentials;
41
- }
39
+ return result;
40
+ };
42
41
  }
43
42
  exports.ERPNextFileRequests = ERPNextFileRequests;
@@ -1,57 +1,51 @@
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.ERPNextMethodRequest = void 0;
13
4
  const zod_1 = require("zod");
14
5
  const utils_1 = require("../utils/utils");
15
6
  const ERPNextDocTypeMeta_1 = require("./model/ERPNextDocTypeMeta");
16
7
  class ERPNextMethodRequest {
8
+ temporalClient;
17
9
  constructor(temporalClient) {
18
10
  this.temporalClient = temporalClient;
19
11
  }
20
- request(_a) {
21
- return __awaiter(this, arguments, void 0, function* ({ methodName, requestMethod, body, inputValidationModel, responseValidationModel, isAutoWrapResponseValidationWithMessage = true, params, priority = 5, }) {
22
- if (responseValidationModel && !responseValidationModel.description)
23
- throw new Error("Resource model must have a description");
24
- const result = yield this.temporalClient.executeERPNextRequestWorkflow(`${requestMethod}-${methodName}`, Object.assign(Object.assign(Object.assign(Object.assign({ methodName,
25
- requestMethod }, (inputValidationModel ? { inputValidationModel } : {})), { responseValidationModel: responseValidationModel
26
- ? isAutoWrapResponseValidationWithMessage
27
- ? zod_1.z
28
- .object({ message: responseValidationModel })
29
- .describe(responseValidationModel.description)
30
- : responseValidationModel
31
- : undefined }), (params ? { params: (0, utils_1.paramsToString)(params) } : {})), { body }), "erpnext", priority);
32
- return isAutoWrapResponseValidationWithMessage ? result.message : result;
33
- });
12
+ async request({ methodName, requestMethod, body, inputValidationModel, responseValidationModel, isAutoWrapResponseValidationWithMessage = true, params, priority = 5, }) {
13
+ if (responseValidationModel && !responseValidationModel.description)
14
+ throw new Error("Resource model must have a description");
15
+ const result = await this.temporalClient.executeERPNextRequestWorkflow(`${requestMethod}-${methodName}`, {
16
+ methodName,
17
+ requestMethod,
18
+ ...(inputValidationModel ? { inputValidationModel } : {}),
19
+ responseValidationModel: responseValidationModel
20
+ ? isAutoWrapResponseValidationWithMessage
21
+ ? zod_1.z
22
+ .object({ message: responseValidationModel })
23
+ .describe(responseValidationModel.description)
24
+ : responseValidationModel
25
+ : undefined,
26
+ ...(params ? { params: (0, utils_1.paramsToString)(params) } : {}),
27
+ body,
28
+ }, "erpnext", priority);
29
+ return isAutoWrapResponseValidationWithMessage ? result.message : result;
34
30
  }
35
- getSubmittedLinkedDocs(_a) {
36
- return __awaiter(this, arguments, void 0, function* ({ doctype, resourceId, }) {
37
- return yield this.request({
38
- methodName: "frappe.desk.form.linked_with.get_submitted_linked_docs",
39
- requestMethod: "POST",
40
- body: {
41
- doctype,
42
- name: resourceId,
43
- },
44
- responseValidationModel: zod_1.z
45
- .object({
46
- docs: zod_1.z.array(zod_1.z.object({
47
- doctype: zod_1.z.string(),
48
- name: zod_1.z.string(),
49
- docstatus: ERPNextDocTypeMeta_1.Docstatus,
50
- })),
51
- count: zod_1.z.number(),
52
- })
53
- .describe("Submitted linked docs response"),
54
- });
31
+ async getSubmittedLinkedDocs({ doctype, resourceId, }) {
32
+ return await this.request({
33
+ methodName: "frappe.desk.form.linked_with.get_submitted_linked_docs",
34
+ requestMethod: "POST",
35
+ body: {
36
+ doctype,
37
+ name: resourceId,
38
+ },
39
+ responseValidationModel: zod_1.z
40
+ .object({
41
+ docs: zod_1.z.array(zod_1.z.object({
42
+ doctype: zod_1.z.string(),
43
+ name: zod_1.z.string(),
44
+ docstatus: ERPNextDocTypeMeta_1.Docstatus,
45
+ })),
46
+ count: zod_1.z.number(),
47
+ })
48
+ .describe("Submitted linked docs response"),
55
49
  });
56
50
  }
57
51
  }
@@ -44,9 +44,8 @@ const augmentArrayField = (value) => {
44
44
  return value;
45
45
  };
46
46
  const DocModel = (BaseModel, isSubmittable) => {
47
- var _a, _b;
48
47
  // First merge with DocTypeMeta to add metadata fields
49
- const withMeta = BaseModel.merge(ERPNextDocTypeMeta_1.DocTypeMeta).describe(((_a = BaseModel.description) !== null && _a !== void 0 ? _a : "Unnamed Model") + " Doc");
48
+ const withMeta = BaseModel.merge(ERPNextDocTypeMeta_1.DocTypeMeta).describe((BaseModel.description ?? "Unnamed Model") + " Doc");
50
49
  const withSubmittableMeta = isSubmittable
51
50
  ? withMeta.merge(ERPNextDocTypeMeta_1.SubmittableMeta)
52
51
  : withMeta;
@@ -58,7 +57,7 @@ const DocModel = (BaseModel, isSubmittable) => {
58
57
  }
59
58
  return zod_1.z
60
59
  .object(newShape)
61
- .describe((_b = BaseModel.description) !== null && _b !== void 0 ? _b : "Unnamed DocType Model");
60
+ .describe(BaseModel.description ?? "Unnamed DocType Model");
62
61
  };
63
62
  exports.DocModel = DocModel;
64
63
  const DocModelListEntry = (BaseModel) => {
@@ -299,7 +299,7 @@ export declare const Item: z.ZodObject<{
299
299
  packaging_weight_unit_plastic: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"kg">, z.ZodLiteral<"g">]>, z.ZodLiteral<"mg">]>;
300
300
  description: z.ZodString;
301
301
  shelf_life_in_days: z.ZodNumber;
302
- end_of_life: z.ZodString;
302
+ end_of_life: z.ZodNullable<z.ZodOptional<z.ZodString>>;
303
303
  default_material_request_type: z.ZodString;
304
304
  valuation_method: z.ZodString;
305
305
  product_weight: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
@@ -434,7 +434,6 @@ export declare const Item: z.ZodObject<{
434
434
  packaging_weight_unit_cardboard: "kg" | "g" | "mg";
435
435
  packaging_weight_unit_plastic: "kg" | "g" | "mg";
436
436
  shelf_life_in_days: number;
437
- end_of_life: string;
438
437
  default_material_request_type: string;
439
438
  valuation_method: string;
440
439
  product_weight_unit: "kg" | "g" | "mg";
@@ -505,6 +504,7 @@ export declare const Item: z.ZodObject<{
505
504
  shipping_height?: number | null | undefined;
506
505
  packaging_weight_cardboard?: number | null | undefined;
507
506
  packaging_weight_plastic?: number | null | undefined;
507
+ end_of_life?: string | null | undefined;
508
508
  product_weight?: number | null | undefined;
509
509
  fsc_status?: string | null | undefined;
510
510
  custom_fsc_type_of_wood?: string | null | undefined;
@@ -544,7 +544,6 @@ export declare const Item: z.ZodObject<{
544
544
  packaging_weight_unit_cardboard: "kg" | "g" | "mg";
545
545
  packaging_weight_unit_plastic: "kg" | "g" | "mg";
546
546
  shelf_life_in_days: number;
547
- end_of_life: string;
548
547
  default_material_request_type: string;
549
548
  valuation_method: string;
550
549
  product_weight_unit: "kg" | "g" | "mg";
@@ -619,6 +618,7 @@ export declare const Item: z.ZodObject<{
619
618
  shipping_height?: number | null | undefined;
620
619
  packaging_weight_cardboard?: number | null | undefined;
621
620
  packaging_weight_plastic?: number | null | undefined;
621
+ end_of_life?: string | null | undefined;
622
622
  product_weight?: number | null | undefined;
623
623
  fsc_status?: string | null | undefined;
624
624
  custom_fsc_type_of_wood?: string | null | undefined;
@@ -682,7 +682,7 @@ export declare const ItemDoc: import("./DocTypeHelpers").DocModelType<z.ZodObjec
682
682
  packaging_weight_unit_plastic: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"kg">, z.ZodLiteral<"g">]>, z.ZodLiteral<"mg">]>;
683
683
  description: z.ZodString;
684
684
  shelf_life_in_days: z.ZodNumber;
685
- end_of_life: z.ZodString;
685
+ end_of_life: z.ZodNullable<z.ZodOptional<z.ZodString>>;
686
686
  default_material_request_type: z.ZodString;
687
687
  valuation_method: z.ZodString;
688
688
  product_weight: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
@@ -817,7 +817,6 @@ export declare const ItemDoc: import("./DocTypeHelpers").DocModelType<z.ZodObjec
817
817
  packaging_weight_unit_cardboard: "kg" | "g" | "mg";
818
818
  packaging_weight_unit_plastic: "kg" | "g" | "mg";
819
819
  shelf_life_in_days: number;
820
- end_of_life: string;
821
820
  default_material_request_type: string;
822
821
  valuation_method: string;
823
822
  product_weight_unit: "kg" | "g" | "mg";
@@ -888,6 +887,7 @@ export declare const ItemDoc: import("./DocTypeHelpers").DocModelType<z.ZodObjec
888
887
  shipping_height?: number | null | undefined;
889
888
  packaging_weight_cardboard?: number | null | undefined;
890
889
  packaging_weight_plastic?: number | null | undefined;
890
+ end_of_life?: string | null | undefined;
891
891
  product_weight?: number | null | undefined;
892
892
  fsc_status?: string | null | undefined;
893
893
  custom_fsc_type_of_wood?: string | null | undefined;
@@ -927,7 +927,6 @@ export declare const ItemDoc: import("./DocTypeHelpers").DocModelType<z.ZodObjec
927
927
  packaging_weight_unit_cardboard: "kg" | "g" | "mg";
928
928
  packaging_weight_unit_plastic: "kg" | "g" | "mg";
929
929
  shelf_life_in_days: number;
930
- end_of_life: string;
931
930
  default_material_request_type: string;
932
931
  valuation_method: string;
933
932
  product_weight_unit: "kg" | "g" | "mg";
@@ -1002,6 +1001,7 @@ export declare const ItemDoc: import("./DocTypeHelpers").DocModelType<z.ZodObjec
1002
1001
  shipping_height?: number | null | undefined;
1003
1002
  packaging_weight_cardboard?: number | null | undefined;
1004
1003
  packaging_weight_plastic?: number | null | undefined;
1004
+ end_of_life?: string | null | undefined;
1005
1005
  product_weight?: number | null | undefined;
1006
1006
  fsc_status?: string | null | undefined;
1007
1007
  custom_fsc_type_of_wood?: string | null | undefined;
@@ -91,7 +91,7 @@ exports.Item = zod_1.z
91
91
  .or(zod_1.z.literal("mg")),
92
92
  description: zod_1.z.string(),
93
93
  shelf_life_in_days: zod_1.z.number(),
94
- end_of_life: zod_1.z.string(),
94
+ end_of_life: zod_1.z.string().optional().nullable(),
95
95
  default_material_request_type: zod_1.z.string(),
96
96
  valuation_method: zod_1.z.string(),
97
97
  product_weight: zod_1.z.number().optional().nullable(),
@@ -24,27 +24,51 @@ declare const StockEntryItem: z.ZodObject<{
24
24
  export type StockEntryItemType = z.infer<typeof StockEntryItem>;
25
25
  export declare const StockEntry: z.ZodObject<{
26
26
  external_name: z.ZodOptional<z.ZodString>;
27
- naming_series: z.ZodString;
27
+ naming_series: z.ZodString & {
28
+ __optionalForInput: true;
29
+ };
28
30
  stock_entry_type: z.ZodString;
29
31
  outgoing_stock_entry: z.ZodOptional<z.ZodString>;
30
- purpose: z.ZodString;
31
- add_to_transit: z.ZodNumber;
32
+ purpose: z.ZodString & {
33
+ __optionalForInput: true;
34
+ };
35
+ add_to_transit: z.ZodNumber & {
36
+ __optionalForInput: true;
37
+ };
32
38
  work_order: z.ZodOptional<z.ZodString>;
33
39
  purchase_order: z.ZodOptional<z.ZodString>;
34
40
  delivery_note_no: z.ZodOptional<z.ZodString>;
35
41
  sales_invoice_no: z.ZodOptional<z.ZodString>;
36
42
  pick_list: z.ZodOptional<z.ZodString>;
37
43
  purchase_receipt_no: z.ZodOptional<z.ZodString>;
38
- company: z.ZodString;
39
- posting_date: z.ZodString;
40
- posting_time: z.ZodString;
41
- set_posting_time: z.ZodNumber;
42
- inspection_required: z.ZodNumber;
43
- from_bom: z.ZodNumber;
44
- apply_putaway_rule: z.ZodNumber;
44
+ company: z.ZodString & {
45
+ __optionalForInput: true;
46
+ };
47
+ posting_date: z.ZodString & {
48
+ __optionalForInput: true;
49
+ };
50
+ posting_time: z.ZodString & {
51
+ __optionalForInput: true;
52
+ };
53
+ set_posting_time: z.ZodNumber & {
54
+ __optionalForInput: true;
55
+ };
56
+ inspection_required: z.ZodNumber & {
57
+ __optionalForInput: true;
58
+ };
59
+ from_bom: z.ZodNumber & {
60
+ __optionalForInput: true;
61
+ };
62
+ apply_putaway_rule: z.ZodNumber & {
63
+ __optionalForInput: true;
64
+ };
45
65
  bom_no: z.ZodOptional<z.ZodString>;
46
- fg_completed_qty: z.ZodNumber;
47
- use_multi_level_bom: z.ZodNumber;
66
+ fg_completed_qty: z.ZodNumber & {
67
+ __optionalForInput: true;
68
+ };
69
+ use_multi_level_bom: z.ZodNumber & {
70
+ __optionalForInput: true;
71
+ };
48
72
  from_warehouse: z.ZodOptional<z.ZodString>;
49
73
  source_warehouse_address: z.ZodOptional<z.ZodString>;
50
74
  source_address_display: z.ZodOptional<z.ZodString>;
@@ -52,10 +76,18 @@ export declare const StockEntry: z.ZodObject<{
52
76
  target_warehouse_address: z.ZodOptional<z.ZodString>;
53
77
  target_address_display: z.ZodOptional<z.ZodString>;
54
78
  scan_barcode: z.ZodOptional<z.ZodString>;
55
- total_outgoing_value: z.ZodNumber;
56
- total_incoming_value: z.ZodNumber;
57
- value_difference: z.ZodNumber;
58
- total_additional_costs: z.ZodNumber;
79
+ total_outgoing_value: z.ZodNumber & {
80
+ __optionalForInput: true;
81
+ };
82
+ total_incoming_value: z.ZodNumber & {
83
+ __optionalForInput: true;
84
+ };
85
+ value_difference: z.ZodNumber & {
86
+ __optionalForInput: true;
87
+ };
88
+ total_additional_costs: z.ZodNumber & {
89
+ __optionalForInput: true;
90
+ };
59
91
  supplier: z.ZodOptional<z.ZodString>;
60
92
  supplier_name: z.ZodOptional<z.ZodString>;
61
93
  supplier_address: z.ZodOptional<z.ZodString>;
@@ -63,14 +95,22 @@ export declare const StockEntry: z.ZodObject<{
63
95
  project: z.ZodOptional<z.ZodString>;
64
96
  select_print_heading: z.ZodOptional<z.ZodString>;
65
97
  letter_head: z.ZodOptional<z.ZodString>;
66
- is_opening: z.ZodString;
98
+ is_opening: z.ZodString & {
99
+ __optionalForInput: true;
100
+ };
67
101
  remarks: z.ZodOptional<z.ZodString>;
68
- per_transferred: z.ZodNumber;
69
- total_amount: z.ZodNumber;
102
+ per_transferred: z.ZodNumber & {
103
+ __optionalForInput: true;
104
+ };
105
+ total_amount: z.ZodNumber & {
106
+ __optionalForInput: true;
107
+ };
70
108
  job_card: z.ZodOptional<z.ZodString>;
71
109
  amended_from: z.ZodOptional<z.ZodString>;
72
110
  credit_note: z.ZodOptional<z.ZodString>;
73
- is_return: z.ZodNumber;
111
+ is_return: z.ZodNumber & {
112
+ __optionalForInput: true;
113
+ };
74
114
  items: z.ZodArray<z.ZodObject<{
75
115
  t_warehouse: z.ZodOptional<z.ZodString>;
76
116
  s_warehouse: z.ZodOptional<z.ZodString>;
@@ -93,7 +133,9 @@ export declare const StockEntry: z.ZodObject<{
93
133
  s_warehouse?: string | undefined;
94
134
  basic_rate?: number | undefined;
95
135
  }>, "many">;
96
- additional_costs: z.ZodArray<z.ZodString, "many">;
136
+ additional_costs: z.ZodArray<z.ZodString, "many"> & {
137
+ __optionalForInput: true;
138
+ };
97
139
  }, "strip", z.ZodTypeAny, {
98
140
  company: string;
99
141
  naming_series: string;