erpnext-queue-client 2.4.2 → 2.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +87 -105
- package/dist/constants.js +1 -0
- package/dist/dataConverter.js +4 -13
- package/dist/erpnext/decryptFromErpNext.server.js +1 -1
- package/dist/erpnext/decryptFromErpNext.server.test.js +2 -11
- package/dist/erpnext/doctypeResourceRequest.js +44 -37
- package/dist/erpnext/doctypeSubmittableResourceRequest.js +19 -33
- package/dist/erpnext/doctypes/address.js +40 -41
- package/dist/erpnext/doctypes/consolidatedCustomsInvoice.js +18 -20
- package/dist/erpnext/doctypes/contact.js +30 -30
- package/dist/erpnext/doctypes/deliveryNote.js +13 -12
- package/dist/erpnext/doctypes/item.d.ts +10 -10
- package/dist/erpnext/doctypes/item.js +64 -63
- package/dist/erpnext/doctypes/paymentEntry.js +42 -43
- package/dist/erpnext/doctypes/productBundle.js +15 -17
- package/dist/erpnext/doctypes/purchaseInvoice.js +45 -49
- package/dist/erpnext/doctypes/purchaseReceipt.js +41 -43
- package/dist/erpnext/doctypes/salesInvoice.js +42 -43
- package/dist/erpnext/doctypes/servicecase.js +103 -114
- package/dist/erpnext/doctypes/shipment.js +30 -35
- package/dist/erpnext/doctypes/stock.js +94 -109
- package/dist/erpnext/doctypes/tags.js +58 -77
- package/dist/erpnext/erpnextRequestWrapper.js +83 -80
- package/dist/erpnext/fileRequests.js +28 -29
- package/dist/erpnext/methodRequest.js +37 -43
- package/dist/erpnext/model/DocTypeHelpers.js +2 -3
- package/dist/erpnext/model/Item.d.ts +6 -6
- package/dist/erpnext/model/Item.js +1 -1
- package/dist/erpnext/model/PurchaseOrder.d.ts +34 -32
- package/dist/erpnext/model/PurchaseOrder.js +1 -1
- package/dist/erpnext/model/StockEntry.d.ts +63 -21
- package/dist/erpnext/model/StockEntry.js +22 -21
- package/dist/erpnext/reports.js +81 -89
- package/dist/erpnext/resourceRequest.js +142 -150
- package/dist/index.js +43 -3
- package/dist/index.test.js +69 -83
- package/dist/utils/fernet.server.js +24 -4
- package/dist/utils/request.js +59 -72
- package/dist/utils/zodContextOptionals.js +15 -6
- package/dist/utils/zodUtils.js +2 -2
- 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
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
? `${credentials.erpnextUrl}/api/
|
|
34
|
-
: "
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
? `${inputUrl}
|
|
47
|
-
:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
40
|
-
|
|
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(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
: responseValidationModel
|
|
31
|
-
|
|
32
|
-
|
|
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(
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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((
|
|
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(
|
|
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(),
|
|
@@ -336,7 +336,7 @@ export declare const PurchaseOrder: z.ZodObject<{
|
|
|
336
336
|
taxes: z.ZodArray<z.ZodAny, "many"> & {
|
|
337
337
|
__optionalForInput: true;
|
|
338
338
|
};
|
|
339
|
-
payment_schedule: z.
|
|
339
|
+
payment_schedule: z.ZodArray<z.ZodObject<{
|
|
340
340
|
payment_term: z.ZodNullable<z.ZodOptional<z.ZodAny>>;
|
|
341
341
|
description: z.ZodNullable<z.ZodOptional<z.ZodAny>>;
|
|
342
342
|
due_date: z.ZodString;
|
|
@@ -378,7 +378,9 @@ export declare const PurchaseOrder: z.ZodObject<{
|
|
|
378
378
|
base_payment_amount?: number | null | undefined;
|
|
379
379
|
discount_type?: any;
|
|
380
380
|
discount_date?: any;
|
|
381
|
-
}>, "many"
|
|
381
|
+
}>, "many"> & {
|
|
382
|
+
__optionalForInput: true;
|
|
383
|
+
};
|
|
382
384
|
}, "strip", z.ZodTypeAny, {
|
|
383
385
|
company: string;
|
|
384
386
|
is_internal_supplier: number;
|
|
@@ -459,6 +461,21 @@ export declare const PurchaseOrder: z.ZodObject<{
|
|
|
459
461
|
supplier: string;
|
|
460
462
|
is_subcontracted: number;
|
|
461
463
|
supplied_items: any[];
|
|
464
|
+
payment_schedule: {
|
|
465
|
+
due_date: string;
|
|
466
|
+
payment_amount: number;
|
|
467
|
+
description?: any;
|
|
468
|
+
payment_term?: any;
|
|
469
|
+
mode_of_payment?: any;
|
|
470
|
+
paid_amount?: number | null | undefined;
|
|
471
|
+
invoice_portion?: number | null | undefined;
|
|
472
|
+
discount?: number | null | undefined;
|
|
473
|
+
outstanding?: number | null | undefined;
|
|
474
|
+
discounted_amount?: number | null | undefined;
|
|
475
|
+
base_payment_amount?: number | null | undefined;
|
|
476
|
+
discount_type?: any;
|
|
477
|
+
discount_date?: any;
|
|
478
|
+
}[];
|
|
462
479
|
transaction_date: string;
|
|
463
480
|
status?: string | null | undefined;
|
|
464
481
|
doctype?: string | null | undefined;
|
|
@@ -529,21 +546,6 @@ export declare const PurchaseOrder: z.ZodObject<{
|
|
|
529
546
|
payment_terms_template?: string | null | undefined;
|
|
530
547
|
party_account_currency?: string | null | undefined;
|
|
531
548
|
per_received?: number | null | undefined;
|
|
532
|
-
payment_schedule?: {
|
|
533
|
-
due_date: string;
|
|
534
|
-
payment_amount: number;
|
|
535
|
-
description?: any;
|
|
536
|
-
payment_term?: any;
|
|
537
|
-
mode_of_payment?: any;
|
|
538
|
-
paid_amount?: number | null | undefined;
|
|
539
|
-
invoice_portion?: number | null | undefined;
|
|
540
|
-
discount?: number | null | undefined;
|
|
541
|
-
outstanding?: number | null | undefined;
|
|
542
|
-
discounted_amount?: number | null | undefined;
|
|
543
|
-
base_payment_amount?: number | null | undefined;
|
|
544
|
-
discount_type?: any;
|
|
545
|
-
discount_date?: any;
|
|
546
|
-
}[] | undefined;
|
|
547
549
|
schedule_date?: string | null | undefined;
|
|
548
550
|
supplier_address?: string | null | undefined;
|
|
549
551
|
supplier_warehouse?: any;
|
|
@@ -641,6 +643,21 @@ export declare const PurchaseOrder: z.ZodObject<{
|
|
|
641
643
|
supplier: string;
|
|
642
644
|
is_subcontracted: number;
|
|
643
645
|
supplied_items: any[];
|
|
646
|
+
payment_schedule: {
|
|
647
|
+
due_date: string;
|
|
648
|
+
payment_amount: number;
|
|
649
|
+
description?: any;
|
|
650
|
+
payment_term?: any;
|
|
651
|
+
mode_of_payment?: any;
|
|
652
|
+
paid_amount?: number | null | undefined;
|
|
653
|
+
invoice_portion?: number | null | undefined;
|
|
654
|
+
discount?: number | null | undefined;
|
|
655
|
+
outstanding?: number | null | undefined;
|
|
656
|
+
discounted_amount?: number | null | undefined;
|
|
657
|
+
base_payment_amount?: number | null | undefined;
|
|
658
|
+
discount_type?: any;
|
|
659
|
+
discount_date?: any;
|
|
660
|
+
}[];
|
|
644
661
|
transaction_date: string;
|
|
645
662
|
status?: string | null | undefined;
|
|
646
663
|
doctype?: string | null | undefined;
|
|
@@ -711,21 +728,6 @@ export declare const PurchaseOrder: z.ZodObject<{
|
|
|
711
728
|
payment_terms_template?: string | null | undefined;
|
|
712
729
|
party_account_currency?: string | null | undefined;
|
|
713
730
|
per_received?: number | null | undefined;
|
|
714
|
-
payment_schedule?: {
|
|
715
|
-
due_date: string;
|
|
716
|
-
payment_amount: number;
|
|
717
|
-
description?: any;
|
|
718
|
-
payment_term?: any;
|
|
719
|
-
mode_of_payment?: any;
|
|
720
|
-
paid_amount?: number | null | undefined;
|
|
721
|
-
invoice_portion?: number | null | undefined;
|
|
722
|
-
discount?: number | null | undefined;
|
|
723
|
-
outstanding?: number | null | undefined;
|
|
724
|
-
discounted_amount?: number | null | undefined;
|
|
725
|
-
base_payment_amount?: number | null | undefined;
|
|
726
|
-
discount_type?: any;
|
|
727
|
-
discount_date?: any;
|
|
728
|
-
}[] | undefined;
|
|
729
731
|
schedule_date?: string | null | undefined;
|
|
730
732
|
supplier_address?: string | null | undefined;
|
|
731
733
|
supplier_warehouse?: any;
|
|
@@ -191,6 +191,6 @@ exports.PurchaseOrder = zod_1.z
|
|
|
191
191
|
pricing_rules: (0, zodContextOptionals_1.optionalForInput)(zod_1.z.array(zod_1.z.any())),
|
|
192
192
|
supplied_items: (0, zodContextOptionals_1.optionalForInput)(zod_1.z.array(zod_1.z.any())),
|
|
193
193
|
taxes: (0, zodContextOptionals_1.optionalForInput)(zod_1.z.array(zod_1.z.any())),
|
|
194
|
-
payment_schedule: zod_1.z.array(PaymentSchedule)
|
|
194
|
+
payment_schedule: (0, zodContextOptionals_1.optionalForInput)(zod_1.z.array(PaymentSchedule)),
|
|
195
195
|
})
|
|
196
196
|
.describe("PurchaseOrder");
|