@webitel/api-services 0.1.69 → 0.1.70

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.
Files changed (89) hide show
  1. package/package.json +3 -1
  2. package/src/api/clients/_shared/types.ts +25 -0
  3. package/src/api/clients/index.ts +8 -0
  4. package/src/api/clients/queues/__tests__/fieldsToSend.spec.ts +135 -0
  5. package/src/api/clients/queues/__tests__/queueLogs.spec.ts +132 -0
  6. package/src/api/clients/queues/__tests__/queueMembers.spec.ts +175 -0
  7. package/src/api/clients/queues/__tests__/queues.spec.ts +130 -0
  8. package/src/api/clients/queues/defaults/__tests__/queueTypeDefaults.spec.ts +143 -0
  9. package/src/api/clients/queues/defaults/amd.ts +17 -0
  10. package/src/api/clients/queues/defaults/defaultQueue.ts +9 -0
  11. package/src/api/clients/queues/defaults/processing.ts +8 -4
  12. package/src/api/clients/queues/defaults/queueTypeDefaults.ts +305 -0
  13. package/src/api/clients/queues/queueAgents.ts +48 -0
  14. package/src/api/clients/queues/queueBuckets.ts +187 -0
  15. package/src/api/clients/queues/queueHooks.ts +184 -0
  16. package/src/api/clients/queues/queueLogs.ts +80 -0
  17. package/src/api/clients/queues/queueMembers.ts +426 -0
  18. package/src/api/clients/queues/queueResGroups.ts +176 -0
  19. package/src/api/clients/queues/queueSkills.ts +183 -0
  20. package/src/api/clients/queues/queueState.ts +97 -0
  21. package/src/api/clients/queues/queues.ts +124 -94
  22. package/src/api/clients/queues/scripts/__tests__/mapResetMembersFilters.spec.ts +132 -0
  23. package/src/api/clients/queues/scripts/mapResetMembersFilters.ts +52 -0
  24. package/src/enums/CallReportingStatus/CallReportingStatus.ts +13 -0
  25. package/src/enums/MemberStopCause/MemberStopCause.ts +13 -0
  26. package/src/enums/QueueStrategy/QueueStrategy.ts +27 -0
  27. package/src/enums/QueueType/QueueType.ts +31 -0
  28. package/src/enums/TimeBaseScore/TimeBaseScore.ts +6 -0
  29. package/src/enums/TypesResourceStrategy/TypesResourceStrategy.ts +7 -0
  30. package/src/enums/index.ts +21 -1
  31. package/src/scripts/index.ts +19 -1
  32. package/src/scripts/normalizeDatetime/normalizeDatetime.ts +132 -0
  33. package/src/validations/_shared/isFilled.ts +15 -0
  34. package/src/validations/_shared/lookup.validations.ts +28 -0
  35. package/src/validations/_shared/variablePair.validations.ts +18 -0
  36. package/src/validations/index.ts +12 -0
  37. package/src/validations/queue/__tests__/queue.validations.spec.ts +159 -0
  38. package/src/validations/queue/queue.rules.ts +166 -0
  39. package/src/validations/queue/queue.validations.ts +105 -0
  40. package/src/validations/queue/queueAmd.validations.ts +22 -0
  41. package/src/validations/queue/queuePayload.validations.ts +71 -0
  42. package/src/validations/queue/taskProcessing.validations.ts +21 -0
  43. package/src/validations/queueBucket/queueBucket.validations.ts +10 -0
  44. package/src/validations/queueHook/queueHook.validations.ts +10 -0
  45. package/src/validations/queueMember/memberCommunication.validations.ts +25 -0
  46. package/src/validations/queueMember/queueMember.validations.ts +38 -0
  47. package/src/validations/queueResGroup/queueResGroup.validations.ts +15 -0
  48. package/src/validations/queueSkill/queueSkill.validations.ts +42 -0
  49. package/types/.tsbuildinfo +1 -1
  50. package/types/api/clients/_shared/types.d.ts +20 -0
  51. package/types/api/clients/index.d.ts +8 -0
  52. package/types/api/clients/queues/defaults/amd.d.ts +17 -0
  53. package/types/api/clients/queues/defaults/defaultQueue.d.ts +9 -0
  54. package/types/api/clients/queues/defaults/processing.d.ts +7 -2
  55. package/types/api/clients/queues/defaults/queueTypeDefaults.d.ts +31 -0
  56. package/types/api/clients/queues/queueAgents.d.ts +7 -0
  57. package/types/api/clients/queues/queueBuckets.d.ts +12 -0
  58. package/types/api/clients/queues/queueHooks.d.ts +12 -0
  59. package/types/api/clients/queues/queueLogs.d.ts +7 -0
  60. package/types/api/clients/queues/queueMembers.d.ts +30 -0
  61. package/types/api/clients/queues/queueResGroups.d.ts +15 -0
  62. package/types/api/clients/queues/queueSkills.d.ts +12 -0
  63. package/types/api/clients/queues/queueState.d.ts +8 -0
  64. package/types/api/clients/queues/queues.d.ts +9 -1
  65. package/types/api/clients/queues/scripts/mapResetMembersFilters.d.ts +30 -0
  66. package/types/enums/CallReportingStatus/CallReportingStatus.d.ts +11 -0
  67. package/types/enums/MemberStopCause/MemberStopCause.d.ts +11 -0
  68. package/types/enums/QueueStrategy/QueueStrategy.d.ts +21 -0
  69. package/types/enums/QueueType/QueueType.d.ts +28 -0
  70. package/types/enums/TimeBaseScore/TimeBaseScore.d.ts +5 -0
  71. package/types/enums/TypesResourceStrategy/TypesResourceStrategy.d.ts +5 -0
  72. package/types/enums/index.d.ts +7 -1
  73. package/types/scripts/index.d.ts +3 -1
  74. package/types/scripts/normalizeDatetime/normalizeDatetime.d.ts +14 -0
  75. package/types/validations/_shared/isFilled.d.ts +9 -0
  76. package/types/validations/_shared/lookup.validations.d.ts +18 -0
  77. package/types/validations/_shared/variablePair.validations.d.ts +16 -0
  78. package/types/validations/index.d.ts +12 -0
  79. package/types/validations/queue/queue.rules.d.ts +21 -0
  80. package/types/validations/queue/queue.validations.d.ts +285 -0
  81. package/types/validations/queue/queueAmd.validations.d.ts +22 -0
  82. package/types/validations/queue/queuePayload.validations.d.ts +75 -0
  83. package/types/validations/queue/taskProcessing.validations.d.ts +22 -0
  84. package/types/validations/queueBucket/queueBucket.validations.d.ts +9 -0
  85. package/types/validations/queueHook/queueHook.validations.d.ts +10 -0
  86. package/types/validations/queueMember/memberCommunication.validations.d.ts +16 -0
  87. package/types/validations/queueMember/queueMember.validations.d.ts +48 -0
  88. package/types/validations/queueResGroup/queueResGroup.validations.d.ts +11 -0
  89. package/types/validations/queueSkill/queueSkill.validations.d.ts +34 -0
@@ -0,0 +1,183 @@
1
+ import { getQueueSkillService } from '@webitel/api-services/gen';
2
+ import { getShallowFieldsToSendFromZodSchema } from '@webitel/api-services/gen/utils';
3
+ import { queueSkillSchema } from '@webitel/api-services/validations';
4
+ import { getDefaultGetListResponse, getDefaultGetParams } from '../../defaults';
5
+ import {
6
+ applyTransform,
7
+ camelToSnake,
8
+ merge,
9
+ notify,
10
+ sanitize,
11
+ snakeToCamel,
12
+ starToSearch,
13
+ } from '../../transformers';
14
+ import type {
15
+ ApiId,
16
+ ApiParams,
17
+ NestedAddItemParams,
18
+ NestedDeleteItemParams,
19
+ NestedGetItemParams,
20
+ NestedPatchItemParams,
21
+ NestedUpdateItemParams,
22
+ } from '../_shared/types';
23
+
24
+ const fieldsToSend = [
25
+ ...getShallowFieldsToSendFromZodSchema(queueSkillSchema),
26
+ // injected by preRequestHandler; not part of the form, so not in the schema
27
+ 'queueId',
28
+ ];
29
+
30
+ const preRequestHandler = (parentId: ApiId) => (item: ApiParams) => ({
31
+ ...item,
32
+ queueId: parentId,
33
+ });
34
+
35
+ const getQueueSkillsList = async (params: ApiParams) => {
36
+ const { page, size, search, sort, fields, id, parentId, skillId } =
37
+ applyTransform(params, [
38
+ merge(getDefaultGetParams()),
39
+ starToSearch('search'),
40
+ ]);
41
+
42
+ try {
43
+ const response = await getQueueSkillService().searchQueueSkill(
44
+ Number(parentId),
45
+ {
46
+ page,
47
+ size,
48
+ // the generated param is `q`; `search` is what the datalist store sends
49
+ q: search,
50
+ sort,
51
+ fields,
52
+ id,
53
+ skillId,
54
+ },
55
+ );
56
+ const { items, next } = applyTransform(response.data, [
57
+ snakeToCamel(),
58
+ merge(getDefaultGetListResponse()),
59
+ ]);
60
+ return {
61
+ items,
62
+ next,
63
+ };
64
+ } catch (err) {
65
+ throw applyTransform(err, [
66
+ notify,
67
+ ]);
68
+ }
69
+ };
70
+
71
+ const getQueueSkill = async ({ parentId, itemId: id }: NestedGetItemParams) => {
72
+ try {
73
+ const response = await getQueueSkillService().readQueueSkill(
74
+ Number(parentId),
75
+ Number(id),
76
+ );
77
+ return applyTransform(response.data, [
78
+ snakeToCamel(),
79
+ ]);
80
+ } catch (err) {
81
+ throw applyTransform(err, [
82
+ notify,
83
+ ]);
84
+ }
85
+ };
86
+
87
+ const addQueueSkill = async ({
88
+ parentId,
89
+ itemInstance,
90
+ }: NestedAddItemParams) => {
91
+ const item = applyTransform(itemInstance, [
92
+ preRequestHandler(parentId),
93
+ sanitize(fieldsToSend),
94
+ camelToSnake(),
95
+ ]);
96
+ try {
97
+ const response = await getQueueSkillService().createQueueSkill(
98
+ Number(parentId),
99
+ item,
100
+ );
101
+ return applyTransform(response.data, [
102
+ snakeToCamel(),
103
+ ]);
104
+ } catch (err) {
105
+ throw applyTransform(err, [
106
+ notify,
107
+ ]);
108
+ }
109
+ };
110
+
111
+ const updateQueueSkill = async ({
112
+ itemInstance,
113
+ itemId: id,
114
+ parentId,
115
+ }: NestedUpdateItemParams) => {
116
+ const item = applyTransform(itemInstance, [
117
+ preRequestHandler(parentId),
118
+ sanitize(fieldsToSend),
119
+ camelToSnake(),
120
+ ]);
121
+ try {
122
+ const response = await getQueueSkillService().updateQueueSkill(
123
+ Number(parentId),
124
+ Number(id),
125
+ item,
126
+ );
127
+ return applyTransform(response.data, [
128
+ snakeToCamel(),
129
+ ]);
130
+ } catch (err) {
131
+ throw applyTransform(err, [
132
+ notify,
133
+ ]);
134
+ }
135
+ };
136
+
137
+ const patchQueueSkill = async ({
138
+ changes,
139
+ id,
140
+ parentId,
141
+ }: NestedPatchItemParams) => {
142
+ const body = applyTransform(changes, [
143
+ sanitize(fieldsToSend),
144
+ camelToSnake(),
145
+ ]);
146
+ try {
147
+ const response = await getQueueSkillService().patchQueueSkill(
148
+ Number(parentId),
149
+ Number(id),
150
+ body,
151
+ );
152
+ return applyTransform(response.data, [
153
+ snakeToCamel(),
154
+ ]);
155
+ } catch (err) {
156
+ throw applyTransform(err, [
157
+ notify,
158
+ ]);
159
+ }
160
+ };
161
+
162
+ const deleteQueueSkill = async ({ parentId, id }: NestedDeleteItemParams) => {
163
+ try {
164
+ const response = await getQueueSkillService().deleteQueueSkill(
165
+ Number(parentId),
166
+ Number(id),
167
+ );
168
+ return applyTransform(response.data, []);
169
+ } catch (err) {
170
+ throw applyTransform(err, [
171
+ notify,
172
+ ]);
173
+ }
174
+ };
175
+
176
+ export const QueueSkillsAPI = {
177
+ getList: getQueueSkillsList,
178
+ get: getQueueSkill,
179
+ add: addQueueSkill,
180
+ patch: patchQueueSkill,
181
+ update: updateQueueSkill,
182
+ delete: deleteQueueSkill,
183
+ };
@@ -0,0 +1,97 @@
1
+ import {
2
+ GetQueuesGlobalStateQueryParams,
3
+ getQueueService,
4
+ SetQueuesGlobalStateBody,
5
+ } from '@webitel/api-services/gen';
6
+ import { getShallowFieldsToSendFromZodSchema } from '@webitel/api-services/gen/utils';
7
+ import {
8
+ applyTransform,
9
+ camelToSnake,
10
+ notify,
11
+ sanitize,
12
+ snakeToCamel,
13
+ starToSearch,
14
+ } from '../../transformers';
15
+ import type { ApiParams } from '../_shared/types';
16
+
17
+ /**
18
+ * The queues registry's global enable/disable switcher. It reports and flips
19
+ * the state of every queue matching the table's current filters, so it takes
20
+ * the same filter names the datalist store holds and maps them onto the
21
+ * service's own param names.
22
+ */
23
+ const mapFilters = (params: ApiParams) => ({
24
+ q: params.search,
25
+ type: params.queueType,
26
+ teamId: params.team,
27
+ tags: params.tags,
28
+ });
29
+
30
+ const getQueuesGlobalState = async (params: ApiParams = {}) => {
31
+ const fieldsToSend = getShallowFieldsToSendFromZodSchema(
32
+ GetQueuesGlobalStateQueryParams,
33
+ );
34
+
35
+ const transformedParams = applyTransform(params, [
36
+ starToSearch('search'),
37
+ mapFilters,
38
+ sanitize(fieldsToSend),
39
+ camelToSnake(),
40
+ ]);
41
+
42
+ try {
43
+ const response =
44
+ await getQueueService().getQueuesGlobalState(transformedParams);
45
+ return applyTransform(response.data, [
46
+ snakeToCamel(),
47
+ ]);
48
+ } catch (err) {
49
+ throw applyTransform(err, [
50
+ notify,
51
+ ]);
52
+ }
53
+ };
54
+
55
+ const setQueuesGlobalState = async ({
56
+ enabled,
57
+ params,
58
+ }: {
59
+ enabled: boolean;
60
+ params: ApiParams;
61
+ }) => {
62
+ const fieldsToSend = getShallowFieldsToSendFromZodSchema(
63
+ SetQueuesGlobalStateBody,
64
+ );
65
+
66
+ const transformedParams = applyTransform(params, [
67
+ starToSearch('search'),
68
+ mapFilters,
69
+ ]);
70
+
71
+ const body = applyTransform(
72
+ {
73
+ enabled: !!enabled,
74
+ ...transformedParams,
75
+ },
76
+ [
77
+ sanitize(fieldsToSend),
78
+ camelToSnake(),
79
+ ],
80
+ );
81
+
82
+ try {
83
+ const response = await getQueueService().setQueuesGlobalState(body);
84
+ return applyTransform(response.data, [
85
+ snakeToCamel(),
86
+ ]);
87
+ } catch (err) {
88
+ throw applyTransform(err, [
89
+ notify,
90
+ ]);
91
+ }
92
+ };
93
+
94
+ export const QueuesStateAPI = {
95
+ getQueuesGlobalState,
96
+ setQueuesGlobalState,
97
+ };
@@ -1,12 +1,11 @@
1
+ import { getQueueService } from '@webitel/api-services/gen';
2
+ import { getShallowFieldsToSendFromZodSchema } from '@webitel/api-services/gen/utils';
3
+ import { queueSchema } from '@webitel/api-services/validations';
1
4
  import deepCopy from 'deep-copy';
5
+ import deepmerge from 'deepmerge';
2
6
  import { isEmpty } from 'lodash-es';
3
- import { QueueServiceApiFactory } from 'webitel-sdk';
4
- import {
5
- getDefaultGetListResponse,
6
- getDefaultGetParams,
7
- getDefaultInstance,
8
- getDefaultOpenAPIConfig,
9
- } from '../../defaults';
7
+ import { QueueType } from '../../../enums';
8
+ import { getDefaultGetListResponse, getDefaultGetParams } from '../../defaults';
10
9
  import {
11
10
  applyTransform,
12
11
  camelToSnake,
@@ -17,6 +16,7 @@ import {
17
16
  snakeToCamel,
18
17
  starToSearch,
19
18
  } from '../../transformers';
19
+ import { generatePermissionsApi } from '../_shared/generatePermissionsApi';
20
20
  import type {
21
21
  AddItemParams,
22
22
  ApiParams,
@@ -25,45 +25,53 @@ import type {
25
25
  PatchItemParams,
26
26
  UpdateItemParams,
27
27
  } from '../_shared/types';
28
- import processing from './defaults/processing';
29
-
30
- const instance = getDefaultInstance();
31
- const configuration = getDefaultOpenAPIConfig();
28
+ import { processing } from './defaults/processing';
29
+ import { getQueueDefaults } from './defaults/queueTypeDefaults';
32
30
 
33
- const queueService = QueueServiceApiFactory(configuration, '', instance);
31
+ const baseUrl = '/call_center/queues';
34
32
 
35
33
  const doNotConvertKeys = [
36
34
  'variables',
37
35
  ];
38
36
 
39
- const fieldsToSend = [
40
- 'name',
41
- 'type',
42
- 'strategy',
43
- 'team',
44
- 'priority',
45
- 'dncList',
46
- 'schema',
47
- 'payload',
48
- 'taskProcessing',
49
- 'maxOfRetry',
50
- 'timeout',
51
- 'secBetweenRetries',
52
- 'variables',
53
- 'calendar',
54
- 'description',
55
- 'enabled',
56
- 'ringtone',
57
- 'doSchema',
58
- 'afterSchema',
59
- 'stickyAgent',
60
- 'grantee',
61
- 'tags',
62
- ];
37
+ /**
38
+ * Derived from the schema, so the form and the request cannot drift apart.
39
+ *
40
+ * Note this sends top-level `formSchema`, which the previous hand-written list
41
+ * omitted even though chat queues seed it and the service accepts it.
42
+ */
43
+ const fieldsToSend = getShallowFieldsToSendFromZodSchema(queueSchema);
44
+
45
+ /**
46
+ * proto3 omits zero values on the wire, and `OFFLINE_QUEUE` is `0` — so an
47
+ * offline queue comes back with no `type` key at all.
48
+ *
49
+ * This is not cosmetic: everything downstream keys on `type`. Without it
50
+ * `getQueueDefaults` falls through to the type-agnostic base, the Params tab
51
+ * renders no type-specific controls, and `queueSchema`'s `superRefine` skips
52
+ * the per-type branch entirely — all silently. Restore it before any reader
53
+ * sees the item.
54
+ */
55
+ const restoreOmittedType = (item: ApiParams) => ({
56
+ type: QueueType.OFFLINE_QUEUE,
57
+ ...item,
58
+ });
59
+
60
+ /**
61
+ * Same proto3 omission, for the columns the table renders directly. Legacy did
62
+ * this via a `defaultObject`; these are the zero values, not form defaults.
63
+ */
64
+ const listZeroValues = {
65
+ enabled: false,
66
+ active: 0,
67
+ waiting: 0,
68
+ priority: 0,
69
+ };
63
70
 
64
71
  const preRequestHandler = (item: ApiParams) => {
65
72
  const copy = deepCopy(item);
66
- copy.variables = copy.variables.reduce(
73
+ // a queue whose `variables` the service omitted arrives without the key
74
+ copy.variables = (copy.variables ?? []).reduce(
67
75
  (variables: ApiParams, variable: ApiParams) => {
68
76
  if (!variable.key) return variables;
69
77
  variables[variable.key] = variable.value;
@@ -75,14 +83,6 @@ const preRequestHandler = (item: ApiParams) => {
75
83
  };
76
84
 
77
85
  const getQueuesList = async (params: ApiParams) => {
78
- const defaultObject = {
79
- type: 0,
80
- enabled: false,
81
- active: 0,
82
- waiting: 0,
83
- priority: '0',
84
- };
85
-
86
86
  const { page, size, search, sort, fields, id, queueType, team, tags } =
87
87
  applyTransform(params, [
88
88
  merge(getDefaultGetParams()),
@@ -90,24 +90,29 @@ const getQueuesList = async (params: ApiParams) => {
90
90
  ]);
91
91
 
92
92
  try {
93
- const response = await queueService.searchQueue(
93
+ const response = await getQueueService().searchQueue({
94
94
  page,
95
95
  size,
96
- search,
96
+ // the generated param is `q`; `search` is what the datalist store sends
97
+ q: search,
97
98
  sort,
98
99
  fields,
99
100
  id,
100
- queueType,
101
- team,
101
+ // the service names these after the fields, not after the filters
102
+ type: queueType,
103
+ teamId: team,
102
104
  tags,
103
- );
105
+ });
104
106
  const { items, next } = applyTransform(response.data, [
105
107
  snakeToCamel(doNotConvertKeys),
106
108
  merge(getDefaultGetListResponse()),
107
109
  ]);
108
110
  return {
109
111
  items: applyTransform(items, [
110
- mergeEach(defaultObject),
112
+ mergeEach({
113
+ ...listZeroValues,
114
+ type: QueueType.OFFLINE_QUEUE,
115
+ }),
111
116
  ]),
112
117
  next,
113
118
  };
@@ -118,38 +123,57 @@ const getQueuesList = async (params: ApiParams) => {
118
123
  }
119
124
  };
120
125
 
126
+ const responseHandler = (item: ApiParams) => {
127
+ const copy = deepCopy(item);
128
+ if (copy.variables) {
129
+ copy.variables = Object.keys(copy.variables).map((key) => ({
130
+ key,
131
+ value: copy.variables[key],
132
+ }));
133
+ }
134
+ if (isEmpty(copy.taskProcessing)) {
135
+ copy.taskProcessing = processing({
136
+ enabled: !!copy.processing,
137
+ formSchema: copy.formSchema,
138
+ sec: copy.processingSec || 0,
139
+ renewalSec: copy.processingRenewalSec || 0,
140
+ });
141
+ }
142
+ return copy;
143
+ };
144
+
145
+ /**
146
+ * Seeds every field the queue's type can use, so the card form has a
147
+ * complete draft. Regle derives its nested `$fields` from state keys, not
148
+ * from the Zod schema, so a key the backend omitted would otherwise have no
149
+ * validation entry — no required marker, no error text, silently.
150
+ *
151
+ * Runs AFTER `responseHandler` on purpose: the handler back-fills
152
+ * `taskProcessing` from the legacy flat fields only while it `isEmpty`, and
153
+ * seeding the defaults first would suppress that. The item stays last in
154
+ * the merge, so real values always win over defaults.
155
+ */
156
+ const mergeTypeDefaults = (item: ApiParams) =>
157
+ deepmerge(getQueueDefaults(item.type), item);
158
+
159
+ /**
160
+ * `add` and `update` answer with the saved queue, and the card store adopts
161
+ * that response as its new state instead of re-reading the queue — so it has
162
+ * to arrive in exactly the shape `get` returns. Without this the form loses
163
+ * the `variables` pair list (the next save then throws), the reconstructed
164
+ * `taskProcessing`, and an offline queue's `type`.
165
+ */
166
+ const cardResponseTransforms = [
167
+ snakeToCamel(doNotConvertKeys),
168
+ restoreOmittedType,
169
+ responseHandler,
170
+ mergeTypeDefaults,
171
+ ];
172
+
121
173
  const getQueue = async ({ itemId: id }: GetItemParams) => {
122
- const defaultObject = {
123
- tags: [],
124
- type: 0,
125
- formSchema: {},
126
- taskProcessing: {},
127
- };
128
- const responseHandler = (item: ApiParams) => {
129
- const copy = deepCopy(item);
130
- if (copy.variables) {
131
- copy.variables = Object.keys(copy.variables).map((key) => ({
132
- key,
133
- value: copy.variables[key],
134
- }));
135
- }
136
- if (isEmpty(copy.taskProcessing)) {
137
- copy.taskProcessing = processing({
138
- enabled: !!copy.processing,
139
- formSchema: copy.formSchema,
140
- sec: copy.processingSec || 0,
141
- renewalSec: copy.processingRenewalSec || 0,
142
- });
143
- }
144
- return copy;
145
- };
146
174
  try {
147
- const response = await queueService.readQueue(String(id));
148
- return applyTransform(response.data, [
149
- snakeToCamel(doNotConvertKeys),
150
- merge(defaultObject),
151
- responseHandler,
152
- ]);
175
+ const response = await getQueueService().readQueue(String(id));
176
+ return applyTransform(response.data, cardResponseTransforms);
153
177
  } catch (err) {
154
178
  throw applyTransform(err, [
155
179
  notify,
@@ -164,10 +188,8 @@ const addQueue = async ({ itemInstance }: AddItemParams) => {
164
188
  camelToSnake(doNotConvertKeys),
165
189
  ]);
166
190
  try {
167
- const response = await queueService.createQueue(item);
168
- return applyTransform(response.data, [
169
- snakeToCamel(doNotConvertKeys),
170
- ]);
191
+ const response = await getQueueService().createQueue(item);
192
+ return applyTransform(response.data, cardResponseTransforms);
171
193
  } catch (err) {
172
194
  throw applyTransform(err, [
173
195
  notify,
@@ -182,10 +204,8 @@ const updateQueue = async ({ itemInstance, itemId: id }: UpdateItemParams) => {
182
204
  camelToSnake(doNotConvertKeys),
183
205
  ]);
184
206
  try {
185
- const response = await queueService.updateQueue(String(id), item);
186
- return applyTransform(response.data, [
187
- snakeToCamel(doNotConvertKeys),
188
- ]);
207
+ const response = await getQueueService().updateQueue(String(id), item);
208
+ return applyTransform(response.data, cardResponseTransforms);
189
209
  } catch (err) {
190
210
  throw applyTransform(err, [
191
211
  notify,
@@ -199,7 +219,7 @@ const patchQueue = async ({ id, changes }: PatchItemParams) => {
199
219
  camelToSnake(doNotConvertKeys),
200
220
  ]);
201
221
  try {
202
- const response = await queueService.patchQueue(String(id), item);
222
+ const response = await getQueueService().patchQueue(String(id), item);
203
223
  return applyTransform(response.data, [
204
224
  snakeToCamel(doNotConvertKeys),
205
225
  ]);
@@ -212,7 +232,7 @@ const patchQueue = async ({ id, changes }: PatchItemParams) => {
212
232
 
213
233
  const deleteQueue = async ({ id }: DeleteItemParams) => {
214
234
  try {
215
- const response = await queueService.deleteQueue(String(id));
235
+ const response = await getQueueService().deleteQueue(String(id));
216
236
  return applyTransform(response.data, []);
217
237
  } catch (err) {
218
238
  throw applyTransform(err, [
@@ -238,13 +258,13 @@ const getQueuesTags = async (params: ApiParams) => {
238
258
  camelToSnake(doNotConvertKeys),
239
259
  ]);
240
260
  try {
241
- const response = await queueService.searchQueueTags(
261
+ const response = await getQueueService().searchQueueTags({
242
262
  page,
243
263
  size,
244
- search,
264
+ q: search,
245
265
  sort,
246
266
  fields,
247
- );
267
+ });
248
268
  const { items, next } = applyTransform(response.data, [
249
269
  snakeToCamel(doNotConvertKeys),
250
270
  merge(getDefaultGetListResponse()),
@@ -260,6 +280,13 @@ const getQueuesTags = async (params: ApiParams) => {
260
280
  }
261
281
  };
262
282
 
283
+ export type { QueueDefaults } from './defaults/queueTypeDefaults';
284
+ export {
285
+ getQueueDefaults,
286
+ hasQueueTypeDefaults,
287
+ QueueTypeDefaults,
288
+ } from './defaults/queueTypeDefaults';
289
+
263
290
  export const QueuesAPI = {
264
291
  getList: getQueuesList,
265
292
  get: getQueue,
@@ -269,4 +296,7 @@ export const QueuesAPI = {
269
296
  delete: deleteQueue,
270
297
  getLookup: getQueuesLookup,
271
298
  getQueuesTags,
299
+ // `getPermissionsList` + `patchPermissions`, the pair PermissionsApiModule
300
+ // adapts for ui-datalist's permissions page.
301
+ ...generatePermissionsApi(baseUrl),
272
302
  };