@webitel/api-services 0.1.62 → 0.1.64
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/package.json +1 -1
- package/src/api/clients/onlineSkills/onlineSkills.ts +1 -1
- package/src/validations/_shared/i18nIssue.ts +18 -0
- package/src/validations/calendar/__tests__/calendar.validations.spec.ts +93 -7
- package/src/validations/calendar/calendar.validations.ts +52 -19
- package/types/.tsbuildinfo +1 -1
- package/types/validations/_shared/i18nIssue.d.ts +18 -0
- package/types/validations/calendar/calendar.validations.d.ts +14 -7
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schemas live in a package that has no access to the app's i18n, so a custom
|
|
3
|
+
* rule carries the message key in the issue params instead of a message.
|
|
4
|
+
* `configureZod` (`@webitel/ui-sdk/validations`) resolves it to
|
|
5
|
+
* `validation.<key>` at parse time.
|
|
6
|
+
*
|
|
7
|
+
* Never pass `message` alongside it: an explicit message wins over the global
|
|
8
|
+
* error map, and the raw key ends up in the ui.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* z.number().refine((v) => v < 1440, i18nIssue('hourRange'))
|
|
12
|
+
* ctx.addIssue({ code: 'custom', path: ['start'], ...i18nIssue('hourRange') })
|
|
13
|
+
*/
|
|
14
|
+
export declare const i18nIssue: (key: string) => {
|
|
15
|
+
params: {
|
|
16
|
+
i18nKey: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
export type CalendarDayRangeIssue = {
|
|
3
|
+
index: number;
|
|
4
|
+
prop: string;
|
|
5
|
+
/** message key, resolve as `validation.<key>` */
|
|
6
|
+
key: string;
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The same rules as the card schema, reported per row so a form can mark the
|
|
10
|
+
* offending inputs while the user types.
|
|
11
|
+
*
|
|
12
|
+
* A regle field status cannot serve that: with a standard schema, cross-row
|
|
13
|
+
* verdicts (overlapping ranges) are only re-derived by a full `$validate()`,
|
|
14
|
+
* so a row the user has not touched keeps a message that is no longer true.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getCalendarDayRangeIssues: (items: unknown) => CalendarDayRangeIssue[];
|
|
9
17
|
export declare const calendarSchema: z.ZodObject<{
|
|
10
18
|
accepts?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
|
|
11
19
|
createdAt?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
|
|
@@ -23,4 +31,3 @@ export declare const calendarSchema: z.ZodObject<{
|
|
|
23
31
|
updatedBy?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
|
|
24
32
|
expires?: z.ZodType | undefined;
|
|
25
33
|
}, z.core.$strip>;
|
|
26
|
-
export {};
|