lkd-web-kit 0.7.1 → 0.7.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.
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const z = require('zod');
|
|
6
|
+
|
|
7
|
+
const nullableButRequired = (schema, message = "Campo requerido") => schema.nullable().transform((val, ctx) => {
|
|
8
|
+
if (val === null) {
|
|
9
|
+
ctx.addIssue({
|
|
8
10
|
code: "custom",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
fatal: true,
|
|
12
|
+
message
|
|
11
13
|
});
|
|
14
|
+
return z.z.NEVER;
|
|
12
15
|
}
|
|
16
|
+
return val;
|
|
13
17
|
});
|
|
14
18
|
|
|
15
19
|
exports.nullableButRequired = nullableButRequired;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const nullableButRequired = (schema, message = "Campo requerido") => schema.nullable().transform((val, ctx) => {
|
|
4
|
+
if (val === null) {
|
|
5
|
+
ctx.addIssue({
|
|
4
6
|
code: "custom",
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
fatal: true,
|
|
8
|
+
message
|
|
7
9
|
});
|
|
10
|
+
return z.NEVER;
|
|
8
11
|
}
|
|
12
|
+
return val;
|
|
9
13
|
});
|
|
10
14
|
|
|
11
15
|
export { nullableButRequired };
|
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const z = require('zod');
|
|
6
|
+
|
|
7
|
+
const optionalButRequired = (schema, message = "Campo requerido") => schema.optional().transform((val, ctx) => {
|
|
8
|
+
if (val === void 0) {
|
|
9
|
+
ctx.addIssue({
|
|
8
10
|
code: "custom",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
fatal: true,
|
|
12
|
+
message
|
|
11
13
|
});
|
|
14
|
+
return z.z.NEVER;
|
|
12
15
|
}
|
|
16
|
+
return val;
|
|
13
17
|
});
|
|
14
18
|
|
|
15
19
|
exports.optionalButRequired = optionalButRequired;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const optionalButRequired = (schema, message = "Campo requerido") => schema.optional().transform((val, ctx) => {
|
|
4
|
+
if (val === void 0) {
|
|
5
|
+
ctx.addIssue({
|
|
4
6
|
code: "custom",
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
fatal: true,
|
|
8
|
+
message
|
|
7
9
|
});
|
|
10
|
+
return z.NEVER;
|
|
8
11
|
}
|
|
12
|
+
return val;
|
|
9
13
|
});
|
|
10
14
|
|
|
11
15
|
export { optionalButRequired };
|
package/dist/index.d.ts
CHANGED
|
@@ -497,7 +497,7 @@ export declare const newRoute: {
|
|
|
497
497
|
<LocalQuery extends object = {}, PathParams extends Params = {}>(pathBuilder: (params: PathParams) => string, options?: RouteOptions<LocalQuery, PathParams> | undefined): (params?: RouteInput<PathParams, LocalQuery> | undefined) => string;
|
|
498
498
|
};
|
|
499
499
|
|
|
500
|
-
export declare const nullableButRequired: <T extends ZodType>(schema: T, message?: string) => z.ZodNullable<T
|
|
500
|
+
export declare const nullableButRequired: <T extends ZodType>(schema: T, message?: string) => z.ZodPipe<z.ZodNullable<T>, z.ZodTransform<Awaited<z.core.output<T> & undefined> | Awaited<z.core.output<T> & {}>, z.core.output<T> | null>>;
|
|
501
501
|
|
|
502
502
|
export declare const numberToTimeInput: (number: number) => string;
|
|
503
503
|
|
|
@@ -508,7 +508,7 @@ export declare type OnScrollProgressOptions = {
|
|
|
508
508
|
disabled?: boolean;
|
|
509
509
|
};
|
|
510
510
|
|
|
511
|
-
export declare const optionalButRequired: <T extends ZodType>(schema: T, message?: string) => z.ZodOptional<T
|
|
511
|
+
export declare const optionalButRequired: <T extends ZodType>(schema: T, message?: string) => z.ZodPipe<z.ZodOptional<T>, z.ZodTransform<Awaited<z.core.output<T> & null> | Awaited<z.core.output<T> & {}>, z.core.output<T> | undefined>>;
|
|
512
512
|
|
|
513
513
|
export declare const PageDataProvider: ({ value, children }: PageDataProviderProps) => JSX.Element;
|
|
514
514
|
|