@webitel/api-services 26.12.1 → 26.12.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/api-services",
3
- "version": "26.12.1",
3
+ "version": "26.12.3",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -48,6 +48,12 @@ export default {
48
48
  name: 'Scorecard with this name already exists.',
49
49
  },
50
50
  },
51
+ update: {
52
+ valid: {
53
+ name: ({ linked }: MessageContext) =>
54
+ linked('backendErrors.store.sqlAuditForm.save.valid.name'),
55
+ },
56
+ },
51
57
  },
52
58
  sqlCalendar: {
53
59
  save: {
@@ -55,6 +61,12 @@ export default {
55
61
  name: 'Lookup with this name already exists.',
56
62
  },
57
63
  },
64
+ update: {
65
+ valid: {
66
+ name: ({ linked }: MessageContext) =>
67
+ linked('backendErrors.store.sqlCalendar.save.valid.name'),
68
+ },
69
+ },
58
70
  },
59
71
  },
60
72
  },
@@ -48,6 +48,12 @@ export default {
48
48
  name: 'Ya existe una hoja de puntuación con este nombre.',
49
49
  },
50
50
  },
51
+ update: {
52
+ valid: {
53
+ name: ({ linked }: MessageContext) =>
54
+ linked('backendErrors.store.sqlAuditForm.save.valid.name'),
55
+ },
56
+ },
51
57
  },
52
58
  sqlCalendar: {
53
59
  save: {
@@ -55,6 +61,12 @@ export default {
55
61
  name: 'Ya existe un catálogo con este nombre.',
56
62
  },
57
63
  },
64
+ update: {
65
+ valid: {
66
+ name: ({ linked }: MessageContext) =>
67
+ linked('backendErrors.store.sqlCalendar.save.valid.name'),
68
+ },
69
+ },
58
70
  },
59
71
  },
60
72
  },
@@ -48,6 +48,12 @@ export default {
48
48
  name: 'Мұндай атаумен сауалнама бұрыннан бар.',
49
49
  },
50
50
  },
51
+ update: {
52
+ valid: {
53
+ name: ({ linked }: MessageContext) =>
54
+ linked('backendErrors.store.sqlAuditForm.save.valid.name'),
55
+ },
56
+ },
51
57
  },
52
58
  sqlCalendar: {
53
59
  save: {
@@ -55,6 +61,12 @@ export default {
55
61
  name: 'Мұндай атаумен анықтамалық бұрыннан бар.',
56
62
  },
57
63
  },
64
+ update: {
65
+ valid: {
66
+ name: ({ linked }: MessageContext) =>
67
+ linked('backendErrors.store.sqlCalendar.save.valid.name'),
68
+ },
69
+ },
58
70
  },
59
71
  },
60
72
  },
@@ -48,6 +48,12 @@ export default {
48
48
  name: 'Arkusz ocen o tej nazwie już istnieje.',
49
49
  },
50
50
  },
51
+ update: {
52
+ valid: {
53
+ name: ({ linked }: MessageContext) =>
54
+ linked('backendErrors.store.sqlAuditForm.save.valid.name'),
55
+ },
56
+ },
51
57
  },
52
58
  sqlCalendar: {
53
59
  save: {
@@ -55,6 +61,12 @@ export default {
55
61
  name: 'Słownik o tej nazwie już istnieje.',
56
62
  },
57
63
  },
64
+ update: {
65
+ valid: {
66
+ name: ({ linked }: MessageContext) =>
67
+ linked('backendErrors.store.sqlCalendar.save.valid.name'),
68
+ },
69
+ },
58
70
  },
59
71
  },
60
72
  },
@@ -48,6 +48,12 @@ export default {
48
48
  name: 'Există deja o fișă de evaluare cu acest nume.',
49
49
  },
50
50
  },
51
+ update: {
52
+ valid: {
53
+ name: ({ linked }: MessageContext) =>
54
+ linked('backendErrors.store.sqlAuditForm.save.valid.name'),
55
+ },
56
+ },
51
57
  },
52
58
  sqlCalendar: {
53
59
  save: {
@@ -55,6 +61,12 @@ export default {
55
61
  name: 'Există deja un nomenclator cu acest nume.',
56
62
  },
57
63
  },
64
+ update: {
65
+ valid: {
66
+ name: ({ linked }: MessageContext) =>
67
+ linked('backendErrors.store.sqlCalendar.save.valid.name'),
68
+ },
69
+ },
58
70
  },
59
71
  },
60
72
  },
@@ -48,6 +48,12 @@ export default {
48
48
  name: 'Анкета с таким названием уже существует.',
49
49
  },
50
50
  },
51
+ update: {
52
+ valid: {
53
+ name: ({ linked }: MessageContext) =>
54
+ linked('backendErrors.store.sqlAuditForm.save.valid.name'),
55
+ },
56
+ },
51
57
  },
52
58
  sqlCalendar: {
53
59
  save: {
@@ -55,6 +61,12 @@ export default {
55
61
  name: 'Справочник с таким названием уже существует.',
56
62
  },
57
63
  },
64
+ update: {
65
+ valid: {
66
+ name: ({ linked }: MessageContext) =>
67
+ linked('backendErrors.store.sqlCalendar.save.valid.name'),
68
+ },
69
+ },
58
70
  },
59
71
  },
60
72
  },
@@ -48,6 +48,12 @@ export default {
48
48
  name: 'Анкета з такою назвою вже існує.',
49
49
  },
50
50
  },
51
+ update: {
52
+ valid: {
53
+ name: ({ linked }: MessageContext) =>
54
+ linked('backendErrors.store.sqlAuditForm.save.valid.name'),
55
+ },
56
+ },
51
57
  },
52
58
  sqlCalendar: {
53
59
  save: {
@@ -55,6 +61,12 @@ export default {
55
61
  name: 'Довідник із такою назвою вже існує.',
56
62
  },
57
63
  },
64
+ update: {
65
+ valid: {
66
+ name: ({ linked }: MessageContext) =>
67
+ linked('backendErrors.store.sqlCalendar.save.valid.name'),
68
+ },
69
+ },
58
70
  },
59
71
  },
60
72
  },
@@ -48,6 +48,12 @@ export default {
48
48
  name: 'Bu nomdagi baholash varaqasi allaqachon mavjud.',
49
49
  },
50
50
  },
51
+ update: {
52
+ valid: {
53
+ name: ({ linked }: MessageContext) =>
54
+ linked('backendErrors.store.sqlAuditForm.save.valid.name'),
55
+ },
56
+ },
51
57
  },
52
58
  sqlCalendar: {
53
59
  save: {
@@ -55,6 +61,12 @@ export default {
55
61
  name: "Bu nomdagi ma'lumotnoma allaqachon mavjud.",
56
62
  },
57
63
  },
64
+ update: {
65
+ valid: {
66
+ name: ({ linked }: MessageContext) =>
67
+ linked('backendErrors.store.sqlCalendar.save.valid.name'),
68
+ },
69
+ },
58
70
  },
59
71
  },
60
72
  },
@@ -48,6 +48,12 @@ export default {
48
48
  name: 'Phiếu chấm điểm với tên này đã tồn tại.',
49
49
  },
50
50
  },
51
+ update: {
52
+ valid: {
53
+ name: ({ linked }: MessageContext) =>
54
+ linked('backendErrors.store.sqlAuditForm.save.valid.name'),
55
+ },
56
+ },
51
57
  },
52
58
  sqlCalendar: {
53
59
  save: {
@@ -55,6 +61,12 @@ export default {
55
61
  name: 'Danh mục với tên này đã tồn tại.',
56
62
  },
57
63
  },
64
+ update: {
65
+ valid: {
66
+ name: ({ linked }: MessageContext) =>
67
+ linked('backendErrors.store.sqlCalendar.save.valid.name'),
68
+ },
69
+ },
58
70
  },
59
71
  },
60
72
  },
@@ -0,0 +1,45 @@
1
+ import { describe, expect, it } from 'vitest';
2
+
3
+ import { requiredDurationSchema } from '../duration.validations';
4
+
5
+ const tooSmallIssue = expect.objectContaining({
6
+ code: 'too_small',
7
+ minimum: 1,
8
+ });
9
+
10
+ describe('requiredDurationSchema', () => {
11
+ it.each([
12
+ 1,
13
+ 60,
14
+ '1',
15
+ '3600',
16
+ ])('accepts %j', (value) => {
17
+ expect(requiredDurationSchema().safeParse(value).success).toBe(true);
18
+ });
19
+
20
+ it.each([
21
+ 0,
22
+ '0',
23
+ '',
24
+ 'abc',
25
+ ])('rejects %j as too small', (value) => {
26
+ const result = requiredDurationSchema().safeParse(value);
27
+
28
+ expect(result.success).toBe(false);
29
+ expect(result.error?.issues).toEqual([
30
+ tooSmallIssue,
31
+ ]);
32
+ });
33
+
34
+ it.each([
35
+ undefined,
36
+ null,
37
+ ])('rejects missing %j', (value) => {
38
+ expect(requiredDurationSchema().safeParse(value).success).toBe(false);
39
+ });
40
+
41
+ it('respects custom min', () => {
42
+ expect(requiredDurationSchema(60).safeParse('59').success).toBe(false);
43
+ expect(requiredDurationSchema(60).safeParse(60).success).toBe(true);
44
+ });
45
+ });
@@ -1,7 +1,23 @@
1
1
  import { z } from 'zod';
2
2
 
3
+ /**
4
+ * [Claude] Duration may come as a numeric string (e.g. "0" from wt-timepicker),
5
+ * so compare the numeric value, not the string length.
6
+ */
3
7
  export const requiredDurationSchema = (min = 1) =>
4
- z.union([
5
- z.string().min(min),
6
- z.number().min(min),
7
- ]);
8
+ z
9
+ .union([
10
+ z.string(),
11
+ z.number(),
12
+ ])
13
+ .superRefine((value, ctx) => {
14
+ if (Number(value) >= min) return;
15
+
16
+ ctx.addIssue({
17
+ code: 'too_small',
18
+ origin: 'number',
19
+ minimum: min,
20
+ inclusive: true,
21
+ input: value,
22
+ });
23
+ });