@webitel/api-services 26.12.11 → 26.12.13
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/skills/skillAgents.ts +18 -3
- package/src/enums/QueueStrategy/QueueStrategy.ts +20 -0
- package/src/enums/index.ts +5 -1
- package/src/validations/index.ts +1 -0
- package/src/validations/queue/queue.rules.ts +8 -0
- package/src/validations/skill/__tests__/skill.validations.spec.ts +32 -0
- package/src/validations/skill/skill.validations.ts +9 -0
- package/types/.tsbuildinfo +1 -1
- package/types/api/clients/skills/skillAgents.d.ts +6 -2
- package/types/enums/QueueStrategy/QueueStrategy.d.ts +15 -0
- package/types/enums/index.d.ts +2 -2
- package/types/validations/index.d.ts +1 -0
- package/types/validations/skill/skill.validations.d.ts +13 -0
package/package.json
CHANGED
|
@@ -11,11 +11,11 @@ import {
|
|
|
11
11
|
starToSearch,
|
|
12
12
|
} from '../../transformers';
|
|
13
13
|
import type {
|
|
14
|
+
ApiId,
|
|
14
15
|
ApiParams,
|
|
15
16
|
NestedAddItemParams,
|
|
16
17
|
NestedDeleteItemParams,
|
|
17
18
|
NestedGetItemParams,
|
|
18
|
-
NestedPatchItemParams,
|
|
19
19
|
UpdateItemParams,
|
|
20
20
|
} from '../_shared/types';
|
|
21
21
|
|
|
@@ -116,12 +116,19 @@ const addSkillAgent = async ({
|
|
|
116
116
|
/**
|
|
117
117
|
* Bulk edit: the body carries the ids to change, so `id` rides along with the
|
|
118
118
|
* sanitized changes rather than going in the path.
|
|
119
|
+
*
|
|
120
|
+
* [Claude] Takes one `id` (as `createTableStore`'s `patchItemProperty` sends
|
|
121
|
+
* it) or an array of them; no `id` patches every agent matching `changes.q`.
|
|
119
122
|
*/
|
|
120
123
|
const patchSkillAgent = async ({
|
|
121
124
|
parentId,
|
|
122
125
|
changes,
|
|
123
126
|
id,
|
|
124
|
-
}:
|
|
127
|
+
}: {
|
|
128
|
+
parentId?: ApiId;
|
|
129
|
+
changes?: ApiParams;
|
|
130
|
+
id?: ApiId | ApiId[];
|
|
131
|
+
}) => {
|
|
125
132
|
const sanitizedChanges = applyTransform(changes, [
|
|
126
133
|
sanitize(fieldsToSend),
|
|
127
134
|
camelToSnake(),
|
|
@@ -130,7 +137,15 @@ const patchSkillAgent = async ({
|
|
|
130
137
|
try {
|
|
131
138
|
const response = await getSkillService().patchSkillAgent(String(parentId), {
|
|
132
139
|
...sanitizedChanges,
|
|
133
|
-
id
|
|
140
|
+
id:
|
|
141
|
+
id === undefined
|
|
142
|
+
? undefined
|
|
143
|
+
: (Array.isArray(id)
|
|
144
|
+
? id
|
|
145
|
+
: [
|
|
146
|
+
id,
|
|
147
|
+
]
|
|
148
|
+
).map(String),
|
|
134
149
|
});
|
|
135
150
|
return applyTransform(response.data, [
|
|
136
151
|
snakeToCamel(),
|
|
@@ -5,3 +5,23 @@ export const QueueStrategy = {
|
|
|
5
5
|
} as const;
|
|
6
6
|
|
|
7
7
|
export type QueueStrategy = (typeof QueueStrategy)[keyof typeof QueueStrategy];
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @description
|
|
11
|
+
* Select options for the queue `strategy` field, in display order.
|
|
12
|
+
* `name` is the raw label the admin UI shows — not a locale key.
|
|
13
|
+
*/
|
|
14
|
+
export const QueueStrategyList = [
|
|
15
|
+
{
|
|
16
|
+
name: 'FIFO',
|
|
17
|
+
value: QueueStrategy.FIFO,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'LIFO',
|
|
21
|
+
value: QueueStrategy.LIFO,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'STRICT_FIFO',
|
|
25
|
+
value: QueueStrategy.STRICT_FIFO,
|
|
26
|
+
},
|
|
27
|
+
] as const;
|
package/src/enums/index.ts
CHANGED
|
@@ -6,7 +6,10 @@ import { ChatGatewayProvider } from './ChatGatewayProvider/ChatGatewayPrivider';
|
|
|
6
6
|
import { FormatDateMode } from './FormatDateMode/FormatDateMode';
|
|
7
7
|
import { MemberStopCause } from './MemberStopCause/MemberStopCause';
|
|
8
8
|
import { QueuePeriod } from './QueuePeriod/QueuePeriod';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
QueueStrategy,
|
|
11
|
+
QueueStrategyList,
|
|
12
|
+
} from './QueueStrategy/QueueStrategy';
|
|
10
13
|
import { QueueType, QueueTypeName } from './QueueType/QueueType';
|
|
11
14
|
import { RelativeDatetimeValue } from './RelativeDatetimeValue/RelativeDatetimeValue';
|
|
12
15
|
import { ResourceCidType } from './ResourceCidType/ResourceCidType';
|
|
@@ -26,6 +29,7 @@ export {
|
|
|
26
29
|
MemberStopCause,
|
|
27
30
|
QueuePeriod,
|
|
28
31
|
QueueStrategy,
|
|
32
|
+
QueueStrategyList,
|
|
29
33
|
QueueType,
|
|
30
34
|
QueueTypeName,
|
|
31
35
|
RelativeDatetimeValue,
|
package/src/validations/index.ts
CHANGED
|
@@ -51,6 +51,7 @@ export * from './resourceDisplay/resourceDisplay.validations';
|
|
|
51
51
|
export * from './resourceGroup/resourceGroup.validations';
|
|
52
52
|
export * from './resourceInGroup/resourceInGroup.validations';
|
|
53
53
|
export * from './shiftTemplate/shiftTemplate.validations';
|
|
54
|
+
export * from './skill/skill.validations';
|
|
54
55
|
export * from './sla/sla.validations';
|
|
55
56
|
export * from './slaCondition/slaCondition.validations';
|
|
56
57
|
export * from './team/team.validations';
|
|
@@ -37,6 +37,7 @@ export const sharedQueueRules: QueueTypeRule = {
|
|
|
37
37
|
export const queueTypeRules: Record<number, QueueTypeRule> = {
|
|
38
38
|
[QueueType.OFFLINE_QUEUE]: {
|
|
39
39
|
required: [
|
|
40
|
+
'strategy',
|
|
40
41
|
'calendar',
|
|
41
42
|
],
|
|
42
43
|
minValue: {
|
|
@@ -54,6 +55,7 @@ export const queueTypeRules: Record<number, QueueTypeRule> = {
|
|
|
54
55
|
},
|
|
55
56
|
[QueueType.OUTBOUND_IVR_QUEUE]: {
|
|
56
57
|
required: [
|
|
58
|
+
'strategy',
|
|
57
59
|
'calendar',
|
|
58
60
|
'schema',
|
|
59
61
|
'payload.resourceStrategy',
|
|
@@ -66,6 +68,7 @@ export const queueTypeRules: Record<number, QueueTypeRule> = {
|
|
|
66
68
|
},
|
|
67
69
|
[QueueType.PREVIEW_DIALER]: {
|
|
68
70
|
required: [
|
|
71
|
+
'strategy',
|
|
69
72
|
'calendar',
|
|
70
73
|
'payload.resourceStrategy',
|
|
71
74
|
],
|
|
@@ -76,6 +79,7 @@ export const queueTypeRules: Record<number, QueueTypeRule> = {
|
|
|
76
79
|
},
|
|
77
80
|
[QueueType.PROGRESSIVE_DIALER]: {
|
|
78
81
|
required: [
|
|
82
|
+
'strategy',
|
|
79
83
|
'calendar',
|
|
80
84
|
'payload.resourceStrategy',
|
|
81
85
|
'payload.progressiveCount',
|
|
@@ -88,6 +92,7 @@ export const queueTypeRules: Record<number, QueueTypeRule> = {
|
|
|
88
92
|
},
|
|
89
93
|
[QueueType.PREDICTIVE_DIALER]: {
|
|
90
94
|
required: [
|
|
95
|
+
'strategy',
|
|
91
96
|
'calendar',
|
|
92
97
|
'payload.resourceStrategy',
|
|
93
98
|
'payload.progressiveCount',
|
|
@@ -113,6 +118,7 @@ export const queueTypeRules: Record<number, QueueTypeRule> = {
|
|
|
113
118
|
/** shares a `case` label with CHAT_INBOUND_QUEUE in the legacy switch */
|
|
114
119
|
[QueueType.IM_CHAT_QUEUE]: {
|
|
115
120
|
required: [
|
|
121
|
+
'strategy',
|
|
116
122
|
'payload.timeBaseScore',
|
|
117
123
|
],
|
|
118
124
|
minValue: {
|
|
@@ -122,6 +128,7 @@ export const queueTypeRules: Record<number, QueueTypeRule> = {
|
|
|
122
128
|
},
|
|
123
129
|
[QueueType.INBOUND_JOB_QUEUE]: {
|
|
124
130
|
required: [
|
|
131
|
+
'strategy',
|
|
125
132
|
'calendar',
|
|
126
133
|
],
|
|
127
134
|
minValue: {
|
|
@@ -130,6 +137,7 @@ export const queueTypeRules: Record<number, QueueTypeRule> = {
|
|
|
130
137
|
},
|
|
131
138
|
[QueueType.OUTBOUND_JOB_QUEUE]: {
|
|
132
139
|
required: [
|
|
140
|
+
'strategy',
|
|
133
141
|
'calendar',
|
|
134
142
|
'schema',
|
|
135
143
|
],
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { getDefaultsFromZodSchema } from '@webitel/api-services/gen/utils';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { skillSchema } from '../skill.validations';
|
|
5
|
+
|
|
6
|
+
describe('skillSchema', () => {
|
|
7
|
+
it('seeds a new skill with the defaults the form expects', () => {
|
|
8
|
+
expect(getDefaultsFromZodSchema(skillSchema, {})).toMatchObject({
|
|
9
|
+
name: '',
|
|
10
|
+
description: '',
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('requires a name', () => {
|
|
15
|
+
const paths =
|
|
16
|
+
skillSchema
|
|
17
|
+
.safeParse({
|
|
18
|
+
name: '',
|
|
19
|
+
})
|
|
20
|
+
.error?.issues.map((issue) => issue.path.join('.')) ?? [];
|
|
21
|
+
|
|
22
|
+
expect(paths).toContain('name');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('accepts a skill without a description', () => {
|
|
26
|
+
expect(
|
|
27
|
+
skillSchema.safeParse({
|
|
28
|
+
name: 'English',
|
|
29
|
+
}).success,
|
|
30
|
+
).toBe(true);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EngineSkill } from '@webitel/api-services/gen/models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
import type { ZodShape } from '../types';
|
|
5
|
+
|
|
6
|
+
export const skillSchema = z.object<ZodShape<EngineSkill>>({
|
|
7
|
+
name: z.string().min(1).default(''),
|
|
8
|
+
description: z.string().optional().default(''),
|
|
9
|
+
});
|