@webitel/api-services 26.8.79 → 26.8.81

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.8.79",
3
+ "version": "26.8.81",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,8 +32,17 @@ export const flexibleLookupSchema = z.object({
32
32
  /**
33
33
  * The same, but required — reproducing Vuelidate's `required` on a lookup,
34
34
  * which treated an empty object as missing.
35
+ *
36
+ * [Claude] The issue is reported on `id`, not on the lookup itself: regle
37
+ * builds a nested status for an object field and drops issues pathed at the
38
+ * object, so a cleared (`{}`) lookup would pass as valid in the form.
35
39
  */
36
40
  export const filledLookupSchema = flexibleLookupSchema.refine(
37
41
  (value) => isFilled(value),
38
- i18nIssue('required'),
42
+ {
43
+ path: [
44
+ 'id',
45
+ ],
46
+ ...i18nIssue('required'),
47
+ },
39
48
  );
@@ -45,8 +45,8 @@ describe('agentSchema', () => {
45
45
  taskCount: 1,
46
46
  });
47
47
 
48
- expect(paths).toContain('user');
49
- expect(paths).toContain('team');
48
+ expect(paths).toContain('user.id');
49
+ expect(paths).toContain('team.id');
50
50
  });
51
51
 
52
52
  it('requires chat and task counts of at least 1', () => {
@@ -53,7 +53,7 @@ describe('resourceSchema', () => {
53
53
  expect(paths).toEqual(
54
54
  expect.arrayContaining([
55
55
  'name',
56
- 'gateway',
56
+ 'gateway.id',
57
57
  'rps',
58
58
  'limit',
59
59
  'maxSuccessivelyErrors',
@@ -52,7 +52,7 @@ describe('resourceGroupSchema', () => {
52
52
 
53
53
  const paths = result.error?.issues.map((issue) => issue.path.join('.'));
54
54
  expect(paths).toContain('name');
55
- expect(paths).toContain('communication');
55
+ expect(paths).toContain('communication.id');
56
56
  });
57
57
 
58
58
  it('requires at least one time range', () => {
@@ -22,7 +22,7 @@ describe('resourceInGroupSchema', () => {
22
22
  });
23
23
 
24
24
  expect(result.error?.issues.map((issue) => issue.path.join('.'))).toContain(
25
- 'resource',
25
+ 'resource.id',
26
26
  );
27
27
  });
28
28
 
@@ -79,6 +79,29 @@ describe('teamSchema', () => {
79
79
  ).toBe(true);
80
80
  });
81
81
 
82
+ it('rejects negative timing parameters', () => {
83
+ const paths = issuePaths({
84
+ ...filledTeam,
85
+ maxNoAnswer: -1,
86
+ wrapUpTime: -1,
87
+ noAnswerDelayTime: -1,
88
+ taskAcceptTimeout: -1,
89
+ callTimeout: -1,
90
+ inviteChatTimeout: -1,
91
+ });
92
+
93
+ expect(paths).toEqual(
94
+ expect.arrayContaining([
95
+ 'maxNoAnswer',
96
+ 'wrapUpTime',
97
+ 'noAnswerDelayTime',
98
+ 'taskAcceptTimeout',
99
+ 'callTimeout',
100
+ 'inviteChatTimeout',
101
+ ]),
102
+ );
103
+ });
104
+
82
105
  it('accepts a filled team', () => {
83
106
  expect(teamSchema.safeParse(filledTeam).success).toBe(true);
84
107
  });
@@ -11,10 +11,10 @@ export const teamSchema = z.object<ZodShape<EngineAgentTeam>>({
11
11
  strategy: z.string().min(1).default(''),
12
12
  admin: z.array(flexibleLookupSchema).optional().default([]),
13
13
  screenControl: z.boolean().optional().default(false),
14
- maxNoAnswer: z.number().default(3),
15
- wrapUpTime: z.number().default(15),
16
- noAnswerDelayTime: z.number().default(30),
17
- taskAcceptTimeout: z.number().default(30),
18
- callTimeout: z.number().default(60),
19
- inviteChatTimeout: z.number().default(30),
14
+ maxNoAnswer: z.number().min(0).default(3),
15
+ wrapUpTime: z.number().min(0).default(15),
16
+ noAnswerDelayTime: z.number().min(0).default(30),
17
+ taskAcceptTimeout: z.number().min(0).default(30),
18
+ callTimeout: z.number().min(0).default(60),
19
+ inviteChatTimeout: z.number().min(0).default(30),
20
20
  });
@@ -15,7 +15,7 @@ describe('teamFlowSchema', () => {
15
15
  });
16
16
 
17
17
  expect(paths).toContain('name');
18
- expect(paths).toContain('schema');
18
+ expect(paths).toContain('schema.id');
19
19
  });
20
20
 
21
21
  it('accepts a filled flow', () => {
@@ -15,7 +15,7 @@ describe('teamHookSchema', () => {
15
15
  });
16
16
 
17
17
  expect(paths).toContain('event');
18
- expect(paths).toContain('schema');
18
+ expect(paths).toContain('schema.id');
19
19
  });
20
20
 
21
21
  it('accepts a filled hook', () => {