erpnext-queue-client 1.8.0 → 1.8.2
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.
|
@@ -49,8 +49,10 @@ const Report = (reportRowModel) => zod_1.z
|
|
|
49
49
|
})
|
|
50
50
|
.describe("Report Generator " + reportRowModel.description);
|
|
51
51
|
exports.Report = Report;
|
|
52
|
-
exports.PendingPreparedReport = zod_1.z
|
|
52
|
+
exports.PendingPreparedReport = zod_1.z
|
|
53
|
+
.object({
|
|
53
54
|
prepared_report: zod_1.z.boolean(),
|
|
54
55
|
doc: zod_1.z.null(),
|
|
55
56
|
add_total_row: zod_1.z.boolean(),
|
|
56
|
-
})
|
|
57
|
+
})
|
|
58
|
+
.describe("Pending Prepared Report");
|
package/dist/erpnext/reports.js
CHANGED
|
@@ -76,14 +76,14 @@ class ERPNextReports extends methodRequest_1.ERPNextMethodRequest {
|
|
|
76
76
|
methodName: `frappe.desk.query_report.run`,
|
|
77
77
|
body: Object.assign({ report_name: reportName }, body),
|
|
78
78
|
requestMethod: "POST",
|
|
79
|
-
responseValidationModel: zod_1.z.any(),
|
|
79
|
+
responseValidationModel: zod_1.z.any().describe("Any"),
|
|
80
80
|
});
|
|
81
81
|
// Casting to correct type since Typescript is not able to infer the type correctly.
|
|
82
82
|
// Type safety is ensured by zod
|
|
83
83
|
if ((reportResponse === null || reportResponse === void 0 ? void 0 : reportResponse.result) &&
|
|
84
84
|
((_a = reportResponse === null || reportResponse === void 0 ? void 0 : reportResponse.doc) === null || _a === void 0 ? void 0 : _a.name) === enqueuedReportName) {
|
|
85
85
|
const validatedReponse = responseValidationModel.parse(reportResponse);
|
|
86
|
-
return validatedReponse
|
|
86
|
+
return validatedReponse.result.filter((r) => !(0, lodash_1.isArray)(r));
|
|
87
87
|
}
|
|
88
88
|
yield (0, utils_1.timeout)(1000);
|
|
89
89
|
}
|
|
@@ -101,12 +101,14 @@ class ERPNextReports extends methodRequest_1.ERPNextMethodRequest {
|
|
|
101
101
|
methodName: `frappe.desk.query_report.run`,
|
|
102
102
|
body: Object.assign({ report_name: reportName }, body),
|
|
103
103
|
requestMethod: "POST",
|
|
104
|
-
responseValidationModel,
|
|
104
|
+
responseValidationModel: zod_1.z.any().describe("Any"),
|
|
105
105
|
});
|
|
106
106
|
// Casting to correct type since Typescript is not able to infer the type correctly.
|
|
107
107
|
// Type safety is ensured by zod
|
|
108
|
-
if ((reportResponse === null || reportResponse === void 0 ? void 0 : reportResponse.result) && ((_a = reportResponse === null || reportResponse === void 0 ? void 0 : reportResponse.doc) === null || _a === void 0 ? void 0 : _a.name) === name)
|
|
109
|
-
|
|
108
|
+
if ((reportResponse === null || reportResponse === void 0 ? void 0 : reportResponse.result) && ((_a = reportResponse === null || reportResponse === void 0 ? void 0 : reportResponse.doc) === null || _a === void 0 ? void 0 : _a.name) === name) {
|
|
109
|
+
const validatedReponse = responseValidationModel.parse(reportResponse);
|
|
110
|
+
return validatedReponse.result.filter((r) => !(0, lodash_1.isArray)(r));
|
|
111
|
+
}
|
|
110
112
|
yield (0, utils_1.timeout)(1000);
|
|
111
113
|
}
|
|
112
114
|
throw new Error(`Failed to get report ${reportName} with body ${JSON.stringify(body)}`);
|