@webitel/api-services 0.0.40 → 0.0.42
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/index.ts +1 -0
- package/src/api/clients/wtTypes/adjunctTypes/adjunctTypes.ts +167 -0
- package/src/api/clients/wtTypes/index.ts +1 -0
- package/src/gen/_docs/html/assets/navigation.js +1 -1
- package/src/gen/_docs/html/assets/search.js +1 -1
- package/src/gen/_docs/html/index.html +1 -1
- package/src/gen/_docs/html/interfaces/_models_engineCallFile.EngineCallFile.html +3 -2
- package/src/gen/_docs/html/interfaces/_models_engineHistoryCall.EngineHistoryCall.html +4 -2
- package/src/gen/_docs/html/interfaces/_models_engineHistoryCallCallForm.EngineHistoryCallCallForm.html +3 -0
- package/src/gen/_docs/html/modules/_models.html +1 -1
- package/src/gen/_docs/html/modules/_models_engineHistoryCallCallForm.html +1 -0
- package/src/gen/_docs/html/modules/index.html +1 -1
- package/src/gen/_docs/html/variables/call-service_call-service.zod.gen.patchHistoryCallResponse.html +1 -1
- package/src/gen/_docs/html/variables/call-service_call-service.zod.gen.searchHistoryCallPostResponse.html +1 -1
- package/src/gen/_docs/html/variables/call-service_call-service.zod.gen.searchHistoryCallResponse.html +1 -1
- package/src/gen/_models/engineCallFile.ts +1 -0
- package/src/gen/_models/engineHistoryCall.ts +3 -0
- package/src/gen/_models/engineHistoryCallCallForm.ts +12 -0
- package/src/gen/_models/index.ts +1 -0
- package/src/gen/call-service/call-service.msw.api.gen.ts +99 -0
- package/src/gen/call-service/call-service.zod.gen.ts +45 -0
- package/types/api/clients/index.d.ts +1 -0
- package/types/api/clients/wtTypes/adjunctTypes/adjunctTypes.d.ts +25 -0
- package/types/api/clients/wtTypes/index.d.ts +1 -0
- package/types/gen/_models/engineCallFile.d.ts +1 -0
- package/types/gen/_models/engineHistoryCall.d.ts +3 -0
- package/types/gen/_models/engineHistoryCallCallForm.d.ts +11 -0
- package/types/gen/call-service/call-service.zod.gen.d.ts +27 -0
package/package.json
CHANGED
package/src/api/clients/index.ts
CHANGED
|
@@ -29,6 +29,7 @@ export * from './skills/skills';
|
|
|
29
29
|
export * from './slas/slas';
|
|
30
30
|
export * from './teams/teams';
|
|
31
31
|
export * from './users/users';
|
|
32
|
+
export * from './wtTypes/adjunctTypes/adjunctTypes';
|
|
32
33
|
export * from './wtTypes/sysTypes/sysTypes';
|
|
33
34
|
export * from './wtTypes/typeExtensions/typeExtensions';
|
|
34
35
|
export * from './сontacts';
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { getDictionaries } from '@webitel/api-services/gen';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
getDefaultGetListResponse,
|
|
5
|
+
getDefaultGetParams,
|
|
6
|
+
} from '../../../defaults';
|
|
7
|
+
import {
|
|
8
|
+
applyTransform,
|
|
9
|
+
camelToSnake,
|
|
10
|
+
merge,
|
|
11
|
+
notify,
|
|
12
|
+
sanitize,
|
|
13
|
+
starToSearch,
|
|
14
|
+
} from '../../../transformers';
|
|
15
|
+
|
|
16
|
+
const getAdjunctTypesList = async (
|
|
17
|
+
{ repo, ...params },
|
|
18
|
+
{ silent = false } = {},
|
|
19
|
+
) => {
|
|
20
|
+
const fieldsToSend = ['page', 'size', 'q', 'sort', 'fields', 'id'];
|
|
21
|
+
|
|
22
|
+
const { page, size, fields, sort, id, q } = applyTransform(params, [
|
|
23
|
+
merge(getDefaultGetParams()),
|
|
24
|
+
starToSearch('search'),
|
|
25
|
+
(params) => ({ ...params, q: params.search }),
|
|
26
|
+
sanitize(fieldsToSend),
|
|
27
|
+
camelToSnake(),
|
|
28
|
+
]);
|
|
29
|
+
try {
|
|
30
|
+
const response = await getDictionaries().dictionariesSearchType({
|
|
31
|
+
page,
|
|
32
|
+
size,
|
|
33
|
+
sort,
|
|
34
|
+
fields,
|
|
35
|
+
q,
|
|
36
|
+
id,
|
|
37
|
+
});
|
|
38
|
+
const { data, next } = applyTransform(response.data, [
|
|
39
|
+
merge(getDefaultGetListResponse()),
|
|
40
|
+
]);
|
|
41
|
+
return {
|
|
42
|
+
items: applyTransform(data, []),
|
|
43
|
+
next,
|
|
44
|
+
};
|
|
45
|
+
} catch (err) {
|
|
46
|
+
if (silent) throw err; // dont show error if has no access to custom types
|
|
47
|
+
|
|
48
|
+
throw applyTransform(err, [notify]);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// const getCustomLookupRecord = async ({ itemId: id, repo }) => {
|
|
53
|
+
// try {
|
|
54
|
+
// const response = await dictionariesService.locateData(repo, id);
|
|
55
|
+
// return response.data;
|
|
56
|
+
// } catch (err) {
|
|
57
|
+
// throw applyTransform(err, [notify]);
|
|
58
|
+
// }
|
|
59
|
+
// };
|
|
60
|
+
|
|
61
|
+
// const addCustomLookupRecord = async ({ itemInstance, fieldsToSend, repo }) => {
|
|
62
|
+
// const item = applyTransform(itemInstance, [
|
|
63
|
+
// camelToSnake(),
|
|
64
|
+
// sanitize(fieldsToSend),
|
|
65
|
+
// ]);
|
|
66
|
+
// try {
|
|
67
|
+
// const response = await dictionariesService.createData(repo, item);
|
|
68
|
+
// return applyTransform(response.data, [snakeToCamel()]);
|
|
69
|
+
// } catch (err) {
|
|
70
|
+
// throw applyTransform(err, [notify]);
|
|
71
|
+
// }
|
|
72
|
+
// };
|
|
73
|
+
|
|
74
|
+
// const updateCustomLookupRecord = async ({
|
|
75
|
+
// itemInstance,
|
|
76
|
+
// fieldsToSend,
|
|
77
|
+
// itemId: id,
|
|
78
|
+
// repo,
|
|
79
|
+
// }) => {
|
|
80
|
+
// const item = applyTransform(itemInstance, [
|
|
81
|
+
// camelToSnake(),
|
|
82
|
+
// sanitize(fieldsToSend),
|
|
83
|
+
// ]);
|
|
84
|
+
// try {
|
|
85
|
+
// const response = await dictionariesService.updateData(repo, id, item);
|
|
86
|
+
// return applyTransform(response.data, [snakeToCamel()]);
|
|
87
|
+
// } catch (err) {
|
|
88
|
+
// throw applyTransform(err, [notify]);
|
|
89
|
+
// }
|
|
90
|
+
// };
|
|
91
|
+
|
|
92
|
+
// const deleteCustomLookupRecord = async ({ repo, id }) => {
|
|
93
|
+
// try {
|
|
94
|
+
// const response = await dictionariesService.deleteData2(repo, id);
|
|
95
|
+
// return response.data;
|
|
96
|
+
// } catch (err) {
|
|
97
|
+
// throw applyTransform(err, [notify]);
|
|
98
|
+
// }
|
|
99
|
+
// };
|
|
100
|
+
|
|
101
|
+
// const transformItemsForSelect =
|
|
102
|
+
// ({ primary, display }) =>
|
|
103
|
+
// (items) => {
|
|
104
|
+
// return items.map((item) => ({
|
|
105
|
+
// id: item[primary],
|
|
106
|
+
// name: get(item, display.split('.')),
|
|
107
|
+
// }));
|
|
108
|
+
// };
|
|
109
|
+
|
|
110
|
+
// // In this method we are using the same API as in getCustomLookupRecords,
|
|
111
|
+
// // but we are using different parameters, so we need to create a new method where we can pass the type of the lookup where type is path to api
|
|
112
|
+
// // for example: 'cities' has type 'dictionary/cities'
|
|
113
|
+
// const getCustomLookupRecordsLookup = async ({
|
|
114
|
+
// path,
|
|
115
|
+
// display,
|
|
116
|
+
// primary,
|
|
117
|
+
// ...params
|
|
118
|
+
// }) => {
|
|
119
|
+
// const fieldsToSend = ['page', 'size', 'q', 'sort', 'fields', 'id'];
|
|
120
|
+
|
|
121
|
+
// const url = applyTransform(params, [
|
|
122
|
+
// merge(getDefaultGetParams()),
|
|
123
|
+
// starToSearch('search'),
|
|
124
|
+
// (params) => ({ ...params, q: params.search }),
|
|
125
|
+
// sanitize(fieldsToSend),
|
|
126
|
+
// camelToSnake(),
|
|
127
|
+
// generateUrl(path),
|
|
128
|
+
// ]);
|
|
129
|
+
// try {
|
|
130
|
+
// const response = await instance.get(url);
|
|
131
|
+
// const { data, items, next } = applyTransform(response.data, [
|
|
132
|
+
// merge(getDefaultGetListResponse()),
|
|
133
|
+
// ]);
|
|
134
|
+
|
|
135
|
+
// return {
|
|
136
|
+
// // Some endpoints return data, some return items so we need to check for both of them
|
|
137
|
+
// items:
|
|
138
|
+
// applyTransform(data || items, [
|
|
139
|
+
// transformItemsForSelect({ display, primary }),
|
|
140
|
+
// ]) ?? [],
|
|
141
|
+
// next,
|
|
142
|
+
// };
|
|
143
|
+
// } catch (err) {
|
|
144
|
+
// throw applyTransform(err, [notify]);
|
|
145
|
+
// }
|
|
146
|
+
// };
|
|
147
|
+
|
|
148
|
+
// const CustomLookupApi = {
|
|
149
|
+
// getList: getCustomLookupRecords,
|
|
150
|
+
// get: getCustomLookupRecord,
|
|
151
|
+
// add: addCustomLookupRecord,
|
|
152
|
+
// update: updateCustomLookupRecord,
|
|
153
|
+
// delete: deleteCustomLookupRecord,
|
|
154
|
+
|
|
155
|
+
// getLookup: getCustomLookupRecordsLookup,
|
|
156
|
+
// };
|
|
157
|
+
|
|
158
|
+
// export default CustomLookupApi;
|
|
159
|
+
|
|
160
|
+
export const AdjunctTypesAPI = {
|
|
161
|
+
getList: getAdjunctTypesList,
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @alias AdjunctTypesAPI
|
|
166
|
+
*/
|
|
167
|
+
export const CustomLookupAPI = AdjunctTypesAPI;
|