@webitel/api-services 0.1.70 → 0.1.71

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": "0.1.70",
3
+ "version": "0.1.71",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -141,3 +141,49 @@ describe('getQueueDefaults', () => {
141
141
  expect(hasQueueTypeDefaults(undefined)).toBe(false);
142
142
  });
143
143
  });
144
+
145
+ /**
146
+ * A lookup the user has not filled must be seeded as `undefined`, not `{}`.
147
+ *
148
+ * The key still has to be there — regle builds its `$fields` from the state
149
+ * keys — but an empty *object* makes regle treat the field as a collection and
150
+ * file a root-level `superRefine` issue for it under an index, where nothing
151
+ * reads it: the field shows no error, `r$.$error` stays false so the save
152
+ * button stays enabled, and the save then aborts silently on `$validate()`.
153
+ *
154
+ * [WTEL-10140](https://webitel.atlassian.net/browse/WTEL-10140)
155
+ */
156
+ describe('lookup defaults', () => {
157
+ const lookupKeys = [
158
+ 'calendar',
159
+ 'dncList',
160
+ 'team',
161
+ 'ringtone',
162
+ 'grantee',
163
+ 'schema',
164
+ 'doSchema',
165
+ 'afterSchema',
166
+ 'formSchema',
167
+ ];
168
+
169
+ it('seeds unset lookups as undefined, keeping the key', () => {
170
+ for (const type of allQueueTypes) {
171
+ const defaults = getQueueDefaults(type) as Record<string, unknown>;
172
+
173
+ for (const key of lookupKeys) {
174
+ if (!(key in defaults)) continue;
175
+
176
+ expect(
177
+ defaults[key],
178
+ `${key} on queue type ${type} must be undefined, not an empty object`,
179
+ ).toBeUndefined();
180
+ }
181
+ }
182
+ });
183
+
184
+ it('keeps taskProcessing.formSchema out of the empty-object shape too', () => {
185
+ const taskProcessing = processing() as Record<string, unknown>;
186
+
187
+ expect(taskProcessing.formSchema).toBeUndefined();
188
+ });
189
+ });
@@ -2,7 +2,7 @@ export const amd = () => ({
2
2
  enabled: false,
3
3
  ai: false,
4
4
  positive: [],
5
- playback: {},
5
+ playback: undefined,
6
6
  allowNotSure: false,
7
7
  silenceNotSure: false,
8
8
  maxWordLength: 5000,
@@ -3,7 +3,7 @@ export const defaultQueue = () => ({
3
3
  description: '',
4
4
  priority: 0,
5
5
  tags: [],
6
- dncList: {},
7
- calendar: {},
6
+ dncList: undefined,
7
+ calendar: undefined,
8
8
  variables: [],
9
9
  });
@@ -4,7 +4,7 @@ export const processing = (overrides = {}) =>
4
4
  deepmerge(
5
5
  {
6
6
  enabled: false,
7
- formSchema: {},
7
+ formSchema: undefined,
8
8
  sec: 30,
9
9
  renewalSec: 15,
10
10
  prolongationOptions: {
@@ -33,11 +33,11 @@ export interface QueueDefaults {
33
33
  const offlineQueue = (): QueueDefaults => ({
34
34
  ...defaultQueue(),
35
35
  type: QueueType.OFFLINE_QUEUE,
36
- team: {},
36
+ team: undefined,
37
37
  strategy: QueueStrategy.FIFO,
38
- doSchema: {},
39
- afterSchema: {},
40
- grantee: {},
38
+ doSchema: undefined,
39
+ afterSchema: undefined,
40
+ grantee: undefined,
41
41
  taskProcessing: processing(),
42
42
  payload: {
43
43
  maxAttempts: 3,
@@ -54,9 +54,9 @@ const offlineQueue = (): QueueDefaults => ({
54
54
  const inboundQueue = (): QueueDefaults => ({
55
55
  ...defaultQueue(),
56
56
  type: QueueType.INBOUND_QUEUE,
57
- team: {},
58
- ringtone: {},
59
- grantee: {},
57
+ team: undefined,
58
+ ringtone: undefined,
59
+ grantee: undefined,
60
60
  stickyAgent: false,
61
61
  taskProcessing: processing(),
62
62
  payload: {
@@ -80,10 +80,10 @@ const outboundIVRQueue = (): QueueDefaults => ({
80
80
  ...defaultQueue(),
81
81
  type: QueueType.OUTBOUND_IVR_QUEUE,
82
82
  strategy: QueueStrategy.FIFO,
83
- schema: {},
84
- doSchema: {},
85
- afterSchema: {},
86
- grantee: {},
83
+ schema: undefined,
84
+ doSchema: undefined,
85
+ afterSchema: undefined,
86
+ grantee: undefined,
87
87
  payload: {
88
88
  minDuration: 3,
89
89
  maxAttempts: 3,
@@ -104,11 +104,11 @@ const outboundIVRQueue = (): QueueDefaults => ({
104
104
  const previewDialer = (): QueueDefaults => ({
105
105
  ...defaultQueue(),
106
106
  type: QueueType.PREVIEW_DIALER,
107
- team: {},
107
+ team: undefined,
108
108
  strategy: QueueStrategy.FIFO,
109
- doSchema: {},
110
- afterSchema: {},
111
- grantee: {},
109
+ doSchema: undefined,
110
+ afterSchema: undefined,
111
+ grantee: undefined,
112
112
  stickyAgent: false,
113
113
  taskProcessing: processing(),
114
114
  payload: {
@@ -132,12 +132,12 @@ const previewDialer = (): QueueDefaults => ({
132
132
  const progressiveDialer = (): QueueDefaults => ({
133
133
  ...defaultQueue(),
134
134
  type: QueueType.PROGRESSIVE_DIALER,
135
- team: {},
135
+ team: undefined,
136
136
  strategy: QueueStrategy.FIFO,
137
- doSchema: {},
138
- afterSchema: {},
139
- ringtone: {},
140
- grantee: {},
137
+ doSchema: undefined,
138
+ afterSchema: undefined,
139
+ ringtone: undefined,
140
+ grantee: undefined,
141
141
  stickyAgent: false,
142
142
  taskProcessing: processing(),
143
143
  payload: {
@@ -165,11 +165,11 @@ const predictiveDialer = (): QueueDefaults => ({
165
165
  ...defaultQueue(),
166
166
  type: QueueType.PREDICTIVE_DIALER,
167
167
  strategy: QueueStrategy.FIFO,
168
- team: {},
169
- doSchema: {},
170
- afterSchema: {},
171
- ringtone: {},
172
- grantee: {},
168
+ team: undefined,
169
+ doSchema: undefined,
170
+ afterSchema: undefined,
171
+ ringtone: undefined,
172
+ grantee: undefined,
173
173
  stickyAgent: false,
174
174
  taskProcessing: processing(),
175
175
  payload: {
@@ -209,9 +209,9 @@ const predictiveDialer = (): QueueDefaults => ({
209
209
  const chatInboundQueue = (): QueueDefaults => ({
210
210
  ...defaultQueue(),
211
211
  type: QueueType.CHAT_INBOUND_QUEUE,
212
- team: {},
212
+ team: undefined,
213
213
  strategy: QueueStrategy.FIFO,
214
- formSchema: {},
214
+ formSchema: undefined,
215
215
  stickyAgent: false,
216
216
  taskProcessing: processing(),
217
217
  payload: {
@@ -241,10 +241,10 @@ const imChatQueue = (): QueueDefaults => ({
241
241
  const inboundJobQueue = (): QueueDefaults => ({
242
242
  ...defaultQueue(),
243
243
  type: QueueType.INBOUND_JOB_QUEUE,
244
- team: {},
244
+ team: undefined,
245
245
  strategy: QueueStrategy.FIFO,
246
- doSchema: {},
247
- afterSchema: {},
246
+ doSchema: undefined,
247
+ afterSchema: undefined,
248
248
  stickyAgent: false,
249
249
  taskProcessing: processing(),
250
250
  payload: {
@@ -262,9 +262,9 @@ const outboundJobQueue = (): QueueDefaults => ({
262
262
  ...defaultQueue(),
263
263
  type: QueueType.OUTBOUND_JOB_QUEUE,
264
264
  strategy: QueueStrategy.FIFO,
265
- schema: {},
266
- doSchema: {},
267
- afterSchema: {},
265
+ schema: undefined,
266
+ doSchema: undefined,
267
+ afterSchema: undefined,
268
268
  payload: {
269
269
  maxAttempts: 3,
270
270
  originateTimeout: 60,