erpnext-queue-client 2.4.1 → 2.4.3
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.
|
@@ -20,7 +20,8 @@ function ResourceInput(schema) {
|
|
|
20
20
|
function makeMarkedKeysOptional(shape) {
|
|
21
21
|
const newShape = zod_1.z.object({}).shape;
|
|
22
22
|
for (const [key, value] of Object.entries(shape)) {
|
|
23
|
-
|
|
23
|
+
const markedAsOptionalForInput = isMarkedOptionalForInput(value);
|
|
24
|
+
if (markedAsOptionalForInput) {
|
|
24
25
|
newShape[key] = value.optional();
|
|
25
26
|
}
|
|
26
27
|
else {
|
|
@@ -29,14 +30,20 @@ function ResourceInput(schema) {
|
|
|
29
30
|
// Recurse one level into nested objects to apply the same optionalization
|
|
30
31
|
if (value instanceof zod_1.z.ZodObject) {
|
|
31
32
|
const innerShape = value.shape;
|
|
32
|
-
|
|
33
|
+
const result = zod_1.z.object(makeMarkedKeysOptional(innerShape));
|
|
34
|
+
newShape[key] = markedAsOptionalForInput
|
|
35
|
+
? result.optional()
|
|
36
|
+
: result;
|
|
33
37
|
}
|
|
34
38
|
else if (value instanceof zod_1.ZodArray) {
|
|
35
39
|
const arrayElement = value.element;
|
|
36
40
|
// Only recurse if the array element is a ZodObject
|
|
37
41
|
if (arrayElement instanceof zod_1.z.ZodObject) {
|
|
38
42
|
const arrayElementShape = arrayElement.shape;
|
|
39
|
-
|
|
43
|
+
const result = zod_1.z.array(zod_1.z.object(makeMarkedKeysOptional(arrayElementShape)));
|
|
44
|
+
newShape[key] = markedAsOptionalForInput
|
|
45
|
+
? result.optional()
|
|
46
|
+
: result;
|
|
40
47
|
}
|
|
41
48
|
// else: keep the original array type (already assigned above)
|
|
42
49
|
}
|