erpnext-queue-client 1.19.7 → 1.19.9

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.
@@ -18,8 +18,8 @@ class ERPNextServicecase {
18
18
  this.methodRequest = new methodRequest_1.ERPNextMethodRequest(temporalClient);
19
19
  this.temporalClient = temporalClient;
20
20
  this.baseRequest = new doctypeResourceRequest_1.ERPNextDoctypeResourceRequest(temporalClient, "Servicecase", Servicecase_1.Servicecase);
21
- this.attachmentCollectionRequest = new doctypeResourceRequest_1.ERPNextDoctypeResourceRequest(temporalClient, "Attachment Collection", Servicecase_1.AttachmentCollection);
22
- this.internalReasonCollectionRequest = new doctypeResourceRequest_1.ERPNextDoctypeResourceRequest(temporalClient, "Internal Reason Collection", Servicecase_1.InternalReasonCollection);
21
+ this.attachmentCollectionRequest = new doctypeResourceRequest_1.ERPNextDoctypeResourceRequest(temporalClient, "Servicecase Return Item Attachment Collection", Servicecase_1.AttachmentCollection);
22
+ this.internalReasonCollectionRequest = new doctypeResourceRequest_1.ERPNextDoctypeResourceRequest(temporalClient, "Servicecase Return Item Internal Reasons Collection", Servicecase_1.InternalReasonCollection);
23
23
  this.create = this.createServicecase;
24
24
  this.getList = this.baseRequest.getList;
25
25
  this.getById = this.baseRequest.getById;
@@ -4,18 +4,27 @@ exports.validateData = validateData;
4
4
  exports.pickFromSchema = pickFromSchema;
5
5
  const zod_1 = require("zod");
6
6
  const constants_1 = require("../constants");
7
+ const logger_1 = require("./logger");
7
8
  function validateData(data, ValidationModel) {
8
9
  if (!ValidationModel.description)
9
10
  throw new Error("ValidationModel.description is required");
10
11
  const validationResult = ValidationModel.safeParse(data);
11
12
  if (!validationResult.success) {
12
- throw {
13
+ const errorObject = {
13
14
  message: `Validation error in model ${ValidationModel.description}`,
14
15
  error: validationResult.error,
15
16
  input: constants_1.constants.DEBUG_MODE === "true"
16
17
  ? data
17
18
  : "set DEBUG_MODE to true to see the input",
18
19
  };
20
+ if (data &&
21
+ typeof data === "object" &&
22
+ "message" in data &&
23
+ typeof data.message === "string") {
24
+ logger_1.lg.error(errorObject);
25
+ throw new Error(data.message);
26
+ }
27
+ throw errorObject;
19
28
  }
20
29
  return validationResult.data;
21
30
  }
package/package.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "winston": "^3.15.0",
26
26
  "zod": "3.24.1"
27
27
  },
28
- "version": "1.19.7",
28
+ "version": "1.19.9",
29
29
  "devDependencies": {
30
30
  "@types/crypto-js": "^4.2.2",
31
31
  "@types/lodash": "^4.17.13",