@webitel/api-services 0.0.40 → 0.0.41

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