@webitel/api-services 26.12.22 → 26.12.24

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 (394) hide show
  1. package/package.json +1 -1
  2. package/src/api/clients/_shared/__tests__/generatePermissionsApi.spec.ts +37 -0
  3. package/src/api/clients/_shared/generatePermissionsApi.ts +26 -1
  4. package/src/api/clients/emailProfiles/emailProfiles.ts +6 -19
  5. package/src/api/clients/importTemplates/importTemplates.ts +36 -21
  6. package/src/api/clients/index.ts +3 -1
  7. package/src/api/clients/logs/logs.ts +56 -94
  8. package/src/api/clients/objectClasses/objectClasses.ts +211 -0
  9. package/src/api/clients/queues/queues.ts +2 -2
  10. package/src/api/clients/ringtones/ringtones.ts +30 -0
  11. package/src/api/clients/roles/roles.ts +227 -0
  12. package/src/api/clients/schemaVariables/schemaVariables.ts +21 -17
  13. package/src/api/clients/storagePolicies/storagePolicies.ts +24 -36
  14. package/src/api/clients/triggers/triggerJobs.ts +22 -12
  15. package/src/api/clients/triggers/triggers.ts +12 -37
  16. package/src/api/clients/userSettings/userSettings.ts +21 -0
  17. package/src/enums/AccessMode/AccessMode.ts +8 -0
  18. package/src/enums/AccessRuleColumn/AccessRuleColumn.ts +11 -0
  19. package/src/enums/AccessRuleName/AccessRuleName.ts +10 -0
  20. package/src/enums/WebitelApplications/AdminSections.ts +45 -0
  21. package/src/enums/WebitelApplications/AuditorSections.ts +6 -0
  22. package/src/enums/WebitelApplications/CrmSections.ts +21 -0
  23. package/src/enums/WebitelApplications/SupervisorSections.ts +8 -0
  24. package/src/enums/WebitelApplications/WfmSections.ts +12 -0
  25. package/src/enums/WebitelApplications/WtApplication.ts +13 -0
  26. package/src/enums/index.ts +18 -0
  27. package/src/gen/_models/webitelKbTreeNode.ts +3 -0
  28. package/src/gen-wire/_models/webitelKbTreeNode.ts +3 -0
  29. package/src/gen-wire/access-store/access-store.msw.ts +491 -0
  30. package/src/gen-wire/agent-absence-service/agent-absence-service.msw.ts +985 -0
  31. package/src/gen-wire/agent-chat-service/agent-chat-service.msw.ts +986 -0
  32. package/src/gen-wire/agent-chat-tag-service/agent-chat-tag-service.msw.ts +76 -0
  33. package/src/gen-wire/agent-pause-cause-service/agent-pause-cause-service.msw.ts +1029 -0
  34. package/src/gen-wire/agent-service/agent-service.msw.ts +4444 -0
  35. package/src/gen-wire/agent-skill-service/agent-skill-service.msw.ts +1347 -0
  36. package/src/gen-wire/agent-team-service/agent-team-service.msw.ts +875 -0
  37. package/src/gen-wire/agent-working-conditions-service/agent-working-conditions-service.msw.ts +196 -0
  38. package/src/gen-wire/agent-working-schedule-service/agent-working-schedule-service.msw.ts +846 -0
  39. package/src/gen-wire/articles/articles.msw.ts +5132 -0
  40. package/src/gen-wire/articles/articles.zod.ts +10 -0
  41. package/src/gen-wire/attachments/attachments.msw.ts +387 -0
  42. package/src/gen-wire/audit-form-service/audit-form-service.msw.ts +3169 -0
  43. package/src/gen-wire/auth/auth.msw.ts +801 -0
  44. package/src/gen-wire/backend-profile-service/backend-profile-service.msw.ts +1131 -0
  45. package/src/gen-wire/bucket-service/bucket-service.msw.ts +330 -0
  46. package/src/gen-wire/calendar-service/calendar-service.msw.ts +1526 -0
  47. package/src/gen-wire/call-service/call-service.msw.ts +6221 -0
  48. package/src/gen-wire/case-articles/case-articles.msw.ts +656 -0
  49. package/src/gen-wire/case-comments/case-comments.msw.ts +1164 -0
  50. package/src/gen-wire/case-communications/case-communications.msw.ts +279 -0
  51. package/src/gen-wire/case-files/case-files.msw.ts +295 -0
  52. package/src/gen-wire/case-links/case-links.msw.ts +1002 -0
  53. package/src/gen-wire/case-timeline/case-timeline.msw.ts +1012 -0
  54. package/src/gen-wire/cases/cases.msw.ts +14299 -0
  55. package/src/gen-wire/cases-chat-catalog/cases-chat-catalog.msw.ts +992 -0
  56. package/src/gen-wire/catalogs/catalogs.msw.ts +4088 -0
  57. package/src/gen-wire/classes/classes.msw.ts +309 -0
  58. package/src/gen-wire/close-reason-groups/close-reason-groups.msw.ts +803 -0
  59. package/src/gen-wire/close-reasons/close-reasons.msw.ts +845 -0
  60. package/src/gen-wire/cognitive-profile-service/cognitive-profile-service.msw.ts +942 -0
  61. package/src/gen-wire/comments/comments.msw.ts +900 -0
  62. package/src/gen-wire/communication-type-service/communication-type-service.msw.ts +549 -0
  63. package/src/gen-wire/config-service/config-service.msw.ts +687 -0
  64. package/src/gen-wire/contact-groups/contact-groups.msw.ts +1494 -0
  65. package/src/gen-wire/contact-linking-service/contact-linking-service.msw.ts +96 -0
  66. package/src/gen-wire/contacts/contacts.msw.ts +12671 -0
  67. package/src/gen-wire/contacts-chat-catalog/contacts-chat-catalog.msw.ts +1571 -0
  68. package/src/gen-wire/customer/customer.msw.ts +1376 -0
  69. package/src/gen-wire/customers/customers.msw.ts +2279 -0
  70. package/src/gen-wire/devices/devices.msw.ts +2119 -0
  71. package/src/gen-wire/dictionaries/dictionaries.msw.ts +7852 -0
  72. package/src/gen-wire/domains/domains.msw.ts +218 -0
  73. package/src/gen-wire/dynamic-conditions/dynamic-conditions.msw.ts +1229 -0
  74. package/src/gen-wire/dynamic-groups/dynamic-groups.msw.ts +1685 -0
  75. package/src/gen-wire/email-profile-service/email-profile-service.msw.ts +1832 -0
  76. package/src/gen-wire/emails/emails.msw.ts +1627 -0
  77. package/src/gen-wire/embedding-models/embedding-models.msw.ts +1048 -0
  78. package/src/gen-wire/extensions/extensions.msw.ts +5062 -0
  79. package/src/gen-wire/feedback-service/feedback-service.msw.ts +149 -0
  80. package/src/gen-wire/file-policies-service/file-policies-service.msw.ts +1310 -0
  81. package/src/gen-wire/file-service/file-service.msw.ts +1442 -0
  82. package/src/gen-wire/file-transcript-service/file-transcript-service.msw.ts +290 -0
  83. package/src/gen-wire/forecast-calculation-service/forecast-calculation-service.msw.ts +837 -0
  84. package/src/gen-wire/ftsservice/ftsservice.msw.ts +90 -0
  85. package/src/gen-wire/groups/groups.msw.ts +5778 -0
  86. package/src/gen-wire/im-service-provider-v1-telegrambotservice/im-service-provider-v1-telegrambotservice.msw.ts +390 -0
  87. package/src/gen-wire/imclients/imclients.msw.ts +541 -0
  88. package/src/gen-wire/import-template-service/import-template-service.msw.ts +603 -0
  89. package/src/gen-wire/index.msw.ts +152 -0
  90. package/src/gen-wire/index.ts +1 -0
  91. package/src/gen-wire/knowledgebase-search/knowledgebase-search.msw.ts +94 -0
  92. package/src/gen-wire/labels/labels.msw.ts +784 -0
  93. package/src/gen-wire/languages/languages.msw.ts +1504 -0
  94. package/src/gen-wire/ldap/ldap.msw.ts +6443 -0
  95. package/src/gen-wire/list-service/list-service.msw.ts +1359 -0
  96. package/src/gen-wire/logger-service/logger-service.msw.ts +620 -0
  97. package/src/gen-wire/managers/managers.msw.ts +1508 -0
  98. package/src/gen-wire/media-file-service/media-file-service.msw.ts +429 -0
  99. package/src/gen-wire/meeting-service/meeting-service.msw.ts +179 -0
  100. package/src/gen-wire/member-service/member-service.msw.ts +5742 -0
  101. package/src/gen-wire/messages/messages.msw.ts +3663 -0
  102. package/src/gen-wire/oauth2-federation/oauth2-federation.msw.ts +1446 -0
  103. package/src/gen-wire/online-skills/online-skills.msw.ts +882 -0
  104. package/src/gen-wire/outbound-resource-group-service/outbound-resource-group-service.msw.ts +1417 -0
  105. package/src/gen-wire/outbound-resource-service/outbound-resource-service.msw.ts +2093 -0
  106. package/src/gen-wire/pause-template-service/pause-template-service.msw.ts +823 -0
  107. package/src/gen-wire/pdf-service/pdf-service.msw.ts +851 -0
  108. package/src/gen-wire/permissions/permissions.msw.ts +98 -0
  109. package/src/gen-wire/phones/phones.msw.ts +1627 -0
  110. package/src/gen-wire/photos/photos.msw.ts +1369 -0
  111. package/src/gen-wire/presence/presence.msw.ts +485 -0
  112. package/src/gen-wire/preset-query-service/preset-query-service.msw.ts +522 -0
  113. package/src/gen-wire/priorities/priorities.msw.ts +719 -0
  114. package/src/gen-wire/queue-bucket-service/queue-bucket-service.msw.ts +492 -0
  115. package/src/gen-wire/queue-hook-service/queue-hook-service.msw.ts +582 -0
  116. package/src/gen-wire/queue-resources-service/queue-resources-service.msw.ts +475 -0
  117. package/src/gen-wire/queue-service/queue-service.msw.ts +3759 -0
  118. package/src/gen-wire/queue-skill-service/queue-skill-service.msw.ts +672 -0
  119. package/src/gen-wire/quick-replies-service/quick-replies-service.msw.ts +1254 -0
  120. package/src/gen-wire/records/records.msw.ts +1847 -0
  121. package/src/gen-wire/region-service/region-service.msw.ts +528 -0
  122. package/src/gen-wire/related-cases/related-cases.msw.ts +1428 -0
  123. package/src/gen-wire/retrieval/retrieval.msw.ts +805 -0
  124. package/src/gen-wire/routing-chat-plan-service/routing-chat-plan-service.msw.ts +522 -0
  125. package/src/gen-wire/routing-outbound-call-service/routing-outbound-call-service.msw.ts +1057 -0
  126. package/src/gen-wire/routing-schema-service/routing-schema-service.msw.ts +1045 -0
  127. package/src/gen-wire/routing-variable-service/routing-variable-service.msw.ts +374 -0
  128. package/src/gen-wire/schema-variables-service/schema-variables-service.msw.ts +333 -0
  129. package/src/gen-wire/services/services.msw.ts +2921 -0
  130. package/src/gen-wire/shift-template-service/shift-template-service.msw.ts +727 -0
  131. package/src/gen-wire/skill-service/skill-service.msw.ts +1299 -0
  132. package/src/gen-wire/slaconditions/slaconditions.msw.ts +1087 -0
  133. package/src/gen-wire/slas/slas.msw.ts +1145 -0
  134. package/src/gen-wire/sources/sources.msw.ts +689 -0
  135. package/src/gen-wire/spaces/spaces.msw.ts +2456 -0
  136. package/src/gen-wire/status-conditions/status-conditions.msw.ts +897 -0
  137. package/src/gen-wire/statuses/statuses.msw.ts +791 -0
  138. package/src/gen-wire/system-setting-service/system-setting-service.msw.ts +343 -0
  139. package/src/gen-wire/tags/tags.msw.ts +133 -0
  140. package/src/gen-wire/team-chat-tag-service/team-chat-tag-service.msw.ts +214 -0
  141. package/src/gen-wire/team-hook-service/team-hook-service.msw.ts +552 -0
  142. package/src/gen-wire/team-trigger-service/team-trigger-service.msw.ts +669 -0
  143. package/src/gen-wire/timeline/timeline.msw.ts +1109 -0
  144. package/src/gen-wire/timezones/timezones.msw.ts +1523 -0
  145. package/src/gen-wire/trigger-service/trigger-service.msw.ts +1113 -0
  146. package/src/gen-wire/two-factor-authentication/two-factor-authentication.msw.ts +160 -0
  147. package/src/gen-wire/types/types.msw.ts +1696 -0
  148. package/src/gen-wire/user-access-tokens/user-access-tokens.msw.ts +1357 -0
  149. package/src/gen-wire/user-helper-service/user-helper-service.msw.ts +472 -0
  150. package/src/gen-wire/users/users.msw.ts +5595 -0
  151. package/src/gen-wire/variables/variables.msw.ts +1189 -0
  152. package/src/gen-wire/versions/versions.msw.ts +441 -0
  153. package/src/gen-wire/web-hook-service/web-hook-service.msw.ts +1128 -0
  154. package/src/gen-wire/webitel-im-api-gateway-v1-account/webitel-im-api-gateway-v1-account.msw.ts +986 -0
  155. package/src/gen-wire/webitel-im-api-gateway-v1-bots/webitel-im-api-gateway-v1-bots.msw.ts +253 -0
  156. package/src/gen-wire/webitel-im-api-gateway-v1-contacts/webitel-im-api-gateway-v1-contacts.msw.ts +246 -0
  157. package/src/gen-wire/webitel-im-api-gateway-v1-contactsettingsmanagement/webitel-im-api-gateway-v1-contactsettingsmanagement.msw.ts +148 -0
  158. package/src/gen-wire/webitel-im-api-gateway-v1-message/webitel-im-api-gateway-v1-message.msw.ts +1289 -0
  159. package/src/gen-wire/webitel-im-api-gateway-v1-messagehistory/webitel-im-api-gateway-v1-messagehistory.msw.ts +7390 -0
  160. package/src/gen-wire/webitel-im-api-gateway-v1-threadmanagement/webitel-im-api-gateway-v1-threadmanagement.msw.ts +15159 -0
  161. package/src/gen-wire/webitel-im-api-gateway-v1-threadpermission/webitel-im-api-gateway-v1-threadpermission.msw.ts +220 -0
  162. package/src/gen-wire/webitel-im-api-gateway-v1-threadpreviewservice/webitel-im-api-gateway-v1-threadpreviewservice.msw.ts +777 -0
  163. package/src/gen-wire/webitel-im-api-gateway-v1-threadtagmanagement/webitel-im-api-gateway-v1-threadtagmanagement.msw.ts +315 -0
  164. package/src/gen-wire/webitel-im-api-gateway-v1-updates/webitel-im-api-gateway-v1-updates.msw.ts +7922 -0
  165. package/src/gen-wire/webitel-im-api-provider-v1-facebookservice/webitel-im-api-provider-v1-facebookservice.msw.ts +504 -0
  166. package/src/gen-wire/webitel-im-api-provider-v1-instagramservice/webitel-im-api-provider-v1-instagramservice.msw.ts +341 -0
  167. package/src/gen-wire/webitel-im-api-provider-v1-metaappservice/webitel-im-api-provider-v1-metaappservice.msw.ts +395 -0
  168. package/src/gen-wire/webitel-im-api-provider-v1-metaoauthservice/webitel-im-api-provider-v1-metaoauthservice.msw.ts +170 -0
  169. package/src/gen-wire/webitel-im-api-provider-v1-viberbmservice/webitel-im-api-provider-v1-viberbmservice.msw.ts +426 -0
  170. package/src/gen-wire/webitel-im-api-provider-v1-whatsappservice/webitel-im-api-provider-v1-whatsappservice.msw.ts +383 -0
  171. package/src/gen-wire/webitel-im-provider-v1-customservice/webitel-im-provider-v1-customservice.msw.ts +586 -0
  172. package/src/gen-wire/webitel-im-provider-v1-facebookservice/webitel-im-provider-v1-facebookservice.msw.ts +610 -0
  173. package/src/gen-wire/webitel-im-provider-v1-gateservice/webitel-im-provider-v1-gateservice.msw.ts +183 -0
  174. package/src/gen-wire/webitel-im-provider-v1-gatetemplateservice/webitel-im-provider-v1-gatetemplateservice.msw.ts +195 -0
  175. package/src/gen-wire/webitel-im-provider-v1-instagramservice/webitel-im-provider-v1-instagramservice.msw.ts +442 -0
  176. package/src/gen-wire/webitel-im-provider-v1-metaappservice/webitel-im-provider-v1-metaappservice.msw.ts +514 -0
  177. package/src/gen-wire/webitel-im-provider-v1-metaoauthservice/webitel-im-provider-v1-metaoauthservice.msw.ts +166 -0
  178. package/src/gen-wire/webitel-im-provider-v1-providermessageservice/webitel-im-provider-v1-providermessageservice.msw.ts +466 -0
  179. package/src/gen-wire/webitel-im-provider-v1-viberbmservice/webitel-im-provider-v1-viberbmservice.msw.ts +662 -0
  180. package/src/gen-wire/webitel-im-provider-v1-viberservice/webitel-im-provider-v1-viberservice.msw.ts +550 -0
  181. package/src/gen-wire/webitel-im-provider-v1-whatsappservice/webitel-im-provider-v1-whatsappservice.msw.ts +573 -0
  182. package/src/gen-wire/working-condition-service/working-condition-service.msw.ts +925 -0
  183. package/src/gen-wire/working-schedule-service/working-schedule-service.msw.ts +1450 -0
  184. package/src/scripts/applicationsAccess/ApplicationsAccess.ts +372 -0
  185. package/src/scripts/applicationsAccess/__tests__/ApplicationsAccess.spec.ts +43 -0
  186. package/src/scripts/convertDuration/__tests__/convertDurationWithMilliseconds.spec.ts +19 -0
  187. package/src/scripts/convertDuration/convertDurationWithMilliseconds.ts +18 -0
  188. package/src/scripts/index.ts +12 -0
  189. package/src/scripts/resolveGrants/resolveGrants.ts +42 -0
  190. package/src/validations/changelog/__tests__/changelog.validations.spec.ts +41 -0
  191. package/src/validations/changelog/changelog.validations.ts +22 -0
  192. package/src/validations/emailProfile/__tests__/emailProfile.validations.spec.ts +105 -0
  193. package/src/validations/emailProfile/emailProfile.validations.ts +113 -0
  194. package/src/validations/importTemplate/__tests__/importTemplate.validations.spec.ts +77 -0
  195. package/src/validations/importTemplate/importTemplate.validations.ts +56 -0
  196. package/src/validations/index.ts +7 -0
  197. package/src/validations/role/__tests__/role.validations.spec.ts +53 -0
  198. package/src/validations/role/role.validations.ts +42 -0
  199. package/src/validations/schemaVariable/__tests__/schemaVariable.validations.spec.ts +50 -0
  200. package/src/validations/schemaVariable/schemaVariable.validations.ts +35 -0
  201. package/src/validations/storagePolicy/__tests__/storagePolicy.validations.spec.ts +52 -0
  202. package/src/validations/storagePolicy/storagePolicy.validations.ts +36 -0
  203. package/src/validations/trigger/__tests__/trigger.validations.spec.ts +92 -0
  204. package/src/validations/trigger/trigger.validations.ts +82 -0
  205. package/types/.tsbuildinfo +1 -1
  206. package/types/api/clients/_shared/generatePermissionsApi.d.ts +31 -0
  207. package/types/api/clients/importTemplates/importTemplates.d.ts +2 -2
  208. package/types/api/clients/index.d.ts +3 -0
  209. package/types/api/clients/logs/logs.d.ts +2 -2
  210. package/types/api/clients/objectClasses/objectClasses.d.ts +27 -0
  211. package/types/api/clients/ringtones/ringtones.d.ts +8 -0
  212. package/types/api/clients/roles/roles.d.ts +19 -0
  213. package/types/api/clients/userSettings/userSettings.d.ts +5 -0
  214. package/types/enums/AccessMode/AccessMode.d.ts +7 -0
  215. package/types/enums/AccessRuleColumn/AccessRuleColumn.d.ts +8 -0
  216. package/types/enums/AccessRuleName/AccessRuleName.d.ts +8 -0
  217. package/types/enums/WebitelApplications/AdminSections.d.ts +44 -0
  218. package/types/enums/WebitelApplications/AuditorSections.d.ts +4 -0
  219. package/types/enums/WebitelApplications/CrmSections.d.ts +16 -0
  220. package/types/enums/WebitelApplications/SupervisorSections.d.ts +6 -0
  221. package/types/enums/WebitelApplications/WfmSections.d.ts +9 -0
  222. package/types/enums/WebitelApplications/WtApplication.d.ts +12 -0
  223. package/types/enums/index.d.ts +10 -1
  224. package/types/gen/_models/webitelKbTreeNode.d.ts +3 -0
  225. package/types/gen-wire/_models/webitelKbTreeNode.d.ts +3 -0
  226. package/types/gen-wire/access-store/access-store.msw.d.ts +12 -0
  227. package/types/gen-wire/agent-absence-service/agent-absence-service.msw.d.ts +18 -0
  228. package/types/gen-wire/agent-chat-service/agent-chat-service.msw.d.ts +10 -0
  229. package/types/gen-wire/agent-chat-tag-service/agent-chat-tag-service.msw.d.ts +6 -0
  230. package/types/gen-wire/agent-pause-cause-service/agent-pause-cause-service.msw.d.ts +16 -0
  231. package/types/gen-wire/agent-service/agent-service.msw.d.ts +44 -0
  232. package/types/gen-wire/agent-skill-service/agent-skill-service.msw.d.ts +24 -0
  233. package/types/gen-wire/agent-team-service/agent-team-service.msw.d.ts +14 -0
  234. package/types/gen-wire/agent-working-conditions-service/agent-working-conditions-service.msw.d.ts +8 -0
  235. package/types/gen-wire/agent-working-schedule-service/agent-working-schedule-service.msw.d.ts +8 -0
  236. package/types/gen-wire/articles/articles.msw.d.ts +44 -0
  237. package/types/gen-wire/articles/articles.zod.d.ts +7 -0
  238. package/types/gen-wire/attachments/attachments.msw.d.ts +10 -0
  239. package/types/gen-wire/audit-form-service/audit-form-service.msw.d.ts +26 -0
  240. package/types/gen-wire/auth/auth.msw.d.ts +10 -0
  241. package/types/gen-wire/backend-profile-service/backend-profile-service.msw.d.ts +16 -0
  242. package/types/gen-wire/bucket-service/bucket-service.msw.d.ts +14 -0
  243. package/types/gen-wire/calendar-service/calendar-service.msw.d.ts +16 -0
  244. package/types/gen-wire/call-service/call-service.msw.d.ts +44 -0
  245. package/types/gen-wire/case-articles/case-articles.msw.d.ts +12 -0
  246. package/types/gen-wire/case-comments/case-comments.msw.d.ts +16 -0
  247. package/types/gen-wire/case-communications/case-communications.msw.d.ts +10 -0
  248. package/types/gen-wire/case-files/case-files.msw.d.ts +8 -0
  249. package/types/gen-wire/case-links/case-links.msw.d.ts +16 -0
  250. package/types/gen-wire/case-timeline/case-timeline.msw.d.ts +10 -0
  251. package/types/gen-wire/cases/cases.msw.d.ts +22 -0
  252. package/types/gen-wire/cases-chat-catalog/cases-chat-catalog.msw.d.ts +6 -0
  253. package/types/gen-wire/catalogs/catalogs.msw.d.ts +16 -0
  254. package/types/gen-wire/classes/classes.msw.d.ts +12 -0
  255. package/types/gen-wire/close-reason-groups/close-reason-groups.msw.d.ts +16 -0
  256. package/types/gen-wire/close-reasons/close-reasons.msw.d.ts +16 -0
  257. package/types/gen-wire/cognitive-profile-service/cognitive-profile-service.msw.d.ts +18 -0
  258. package/types/gen-wire/comments/comments.msw.d.ts +12 -0
  259. package/types/gen-wire/communication-type-service/communication-type-service.msw.d.ts +16 -0
  260. package/types/gen-wire/config-service/config-service.msw.d.ts +18 -0
  261. package/types/gen-wire/config-service/config-service.zod.d.ts +4 -4
  262. package/types/gen-wire/contact-groups/contact-groups.msw.d.ts +20 -0
  263. package/types/gen-wire/contact-linking-service/contact-linking-service.msw.d.ts +8 -0
  264. package/types/gen-wire/contacts/contacts.msw.d.ts +16 -0
  265. package/types/gen-wire/contacts-chat-catalog/contacts-chat-catalog.msw.d.ts +8 -0
  266. package/types/gen-wire/customer/customer.msw.d.ts +12 -0
  267. package/types/gen-wire/customers/customers.msw.d.ts +18 -0
  268. package/types/gen-wire/devices/devices.msw.d.ts +20 -0
  269. package/types/gen-wire/dictionaries/dictionaries.msw.d.ts +32 -0
  270. package/types/gen-wire/domains/domains.msw.d.ts +8 -0
  271. package/types/gen-wire/dynamic-conditions/dynamic-conditions.msw.d.ts +16 -0
  272. package/types/gen-wire/dynamic-groups/dynamic-groups.msw.d.ts +16 -0
  273. package/types/gen-wire/email-profile-service/email-profile-service.msw.d.ts +20 -0
  274. package/types/gen-wire/emails/emails.msw.d.ts +20 -0
  275. package/types/gen-wire/embedding-models/embedding-models.msw.d.ts +18 -0
  276. package/types/gen-wire/extensions/extensions.msw.d.ts +16 -0
  277. package/types/gen-wire/feedback-service/feedback-service.msw.d.ts +8 -0
  278. package/types/gen-wire/file-policies-service/file-policies-service.msw.d.ts +22 -0
  279. package/types/gen-wire/file-service/file-service.msw.d.ts +26 -0
  280. package/types/gen-wire/file-transcript-service/file-transcript-service.msw.d.ts +12 -0
  281. package/types/gen-wire/forecast-calculation-service/forecast-calculation-service.msw.d.ts +16 -0
  282. package/types/gen-wire/ftsservice/ftsservice.msw.d.ts +6 -0
  283. package/types/gen-wire/groups/groups.msw.d.ts +20 -0
  284. package/types/gen-wire/im-service-provider-v1-telegrambotservice/im-service-provider-v1-telegrambotservice.msw.d.ts +12 -0
  285. package/types/gen-wire/imclients/imclients.msw.d.ts +10 -0
  286. package/types/gen-wire/import-template-service/import-template-service.msw.d.ts +16 -0
  287. package/types/gen-wire/index.d.ts +1 -1
  288. package/types/gen-wire/index.msw.d.ts +152 -0
  289. package/types/gen-wire/knowledgebase-search/knowledgebase-search.msw.d.ts +6 -0
  290. package/types/gen-wire/labels/labels.msw.d.ts +14 -0
  291. package/types/gen-wire/languages/languages.msw.d.ts +18 -0
  292. package/types/gen-wire/ldap/ldap.msw.d.ts +46 -0
  293. package/types/gen-wire/list-service/list-service.msw.d.ts +26 -0
  294. package/types/gen-wire/logger-service/logger-service.msw.d.ts +12 -0
  295. package/types/gen-wire/logger-service/logger-service.zod.d.ts +4 -4
  296. package/types/gen-wire/managers/managers.msw.d.ts +20 -0
  297. package/types/gen-wire/media-file-service/media-file-service.msw.d.ts +10 -0
  298. package/types/gen-wire/meeting-service/meeting-service.msw.d.ts +10 -0
  299. package/types/gen-wire/member-service/member-service.msw.d.ts +54 -0
  300. package/types/gen-wire/messages/messages.msw.d.ts +16 -0
  301. package/types/gen-wire/oauth2-federation/oauth2-federation.msw.d.ts +18 -0
  302. package/types/gen-wire/online-skills/online-skills.msw.d.ts +16 -0
  303. package/types/gen-wire/outbound-resource-group-service/outbound-resource-group-service.msw.d.ts +24 -0
  304. package/types/gen-wire/outbound-resource-service/outbound-resource-service.msw.d.ts +30 -0
  305. package/types/gen-wire/pause-template-service/pause-template-service.msw.d.ts +14 -0
  306. package/types/gen-wire/pdf-service/pdf-service.msw.d.ts +22 -0
  307. package/types/gen-wire/permissions/permissions.msw.d.ts +6 -0
  308. package/types/gen-wire/phones/phones.msw.d.ts +20 -0
  309. package/types/gen-wire/photos/photos.msw.d.ts +20 -0
  310. package/types/gen-wire/presence/presence.msw.d.ts +8 -0
  311. package/types/gen-wire/preset-query-service/preset-query-service.msw.d.ts +16 -0
  312. package/types/gen-wire/priorities/priorities.msw.d.ts +16 -0
  313. package/types/gen-wire/queue-bucket-service/queue-bucket-service.msw.d.ts +16 -0
  314. package/types/gen-wire/queue-hook-service/queue-hook-service.msw.d.ts +16 -0
  315. package/types/gen-wire/queue-resources-service/queue-resources-service.msw.d.ts +14 -0
  316. package/types/gen-wire/queue-service/queue-service.msw.d.ts +24 -0
  317. package/types/gen-wire/queue-skill-service/queue-skill-service.msw.d.ts +16 -0
  318. package/types/gen-wire/quick-replies-service/quick-replies-service.msw.d.ts +16 -0
  319. package/types/gen-wire/records/records.msw.d.ts +16 -0
  320. package/types/gen-wire/region-service/region-service.msw.d.ts +16 -0
  321. package/types/gen-wire/related-cases/related-cases.msw.d.ts +16 -0
  322. package/types/gen-wire/retrieval/retrieval.msw.d.ts +14 -0
  323. package/types/gen-wire/routing-chat-plan-service/routing-chat-plan-service.msw.d.ts +16 -0
  324. package/types/gen-wire/routing-outbound-call-service/routing-outbound-call-service.msw.d.ts +18 -0
  325. package/types/gen-wire/routing-schema-service/routing-schema-service.msw.d.ts +18 -0
  326. package/types/gen-wire/routing-variable-service/routing-variable-service.msw.d.ts +14 -0
  327. package/types/gen-wire/schema-variables-service/schema-variables-service.msw.d.ts +16 -0
  328. package/types/gen-wire/services/services.msw.d.ts +16 -0
  329. package/types/gen-wire/shift-template-service/shift-template-service.msw.d.ts +14 -0
  330. package/types/gen-wire/skill-service/skill-service.msw.d.ts +22 -0
  331. package/types/gen-wire/slaconditions/slaconditions.msw.d.ts +16 -0
  332. package/types/gen-wire/slas/slas.msw.d.ts +16 -0
  333. package/types/gen-wire/sources/sources.msw.d.ts +16 -0
  334. package/types/gen-wire/spaces/spaces.msw.d.ts +26 -0
  335. package/types/gen-wire/status-conditions/status-conditions.msw.d.ts +16 -0
  336. package/types/gen-wire/statuses/statuses.msw.d.ts +16 -0
  337. package/types/gen-wire/system-setting-service/system-setting-service.msw.d.ts +18 -0
  338. package/types/gen-wire/tags/tags.msw.d.ts +8 -0
  339. package/types/gen-wire/team-chat-tag-service/team-chat-tag-service.msw.d.ts +12 -0
  340. package/types/gen-wire/team-hook-service/team-hook-service.msw.d.ts +16 -0
  341. package/types/gen-wire/team-trigger-service/team-trigger-service.msw.d.ts +20 -0
  342. package/types/gen-wire/timeline/timeline.msw.d.ts +10 -0
  343. package/types/gen-wire/timezones/timezones.msw.d.ts +20 -0
  344. package/types/gen-wire/trigger-service/trigger-service.msw.d.ts +20 -0
  345. package/types/gen-wire/two-factor-authentication/two-factor-authentication.msw.d.ts +8 -0
  346. package/types/gen-wire/types/types.msw.d.ts +8 -0
  347. package/types/gen-wire/user-access-tokens/user-access-tokens.msw.d.ts +16 -0
  348. package/types/gen-wire/user-helper-service/user-helper-service.msw.d.ts +10 -0
  349. package/types/gen-wire/users/users.msw.d.ts +34 -0
  350. package/types/gen-wire/variables/variables.msw.d.ts +18 -0
  351. package/types/gen-wire/versions/versions.msw.d.ts +10 -0
  352. package/types/gen-wire/web-hook-service/web-hook-service.msw.d.ts +16 -0
  353. package/types/gen-wire/webitel-im-api-gateway-v1-account/webitel-im-api-gateway-v1-account.msw.d.ts +14 -0
  354. package/types/gen-wire/webitel-im-api-gateway-v1-bots/webitel-im-api-gateway-v1-bots.msw.d.ts +10 -0
  355. package/types/gen-wire/webitel-im-api-gateway-v1-contacts/webitel-im-api-gateway-v1-contacts.msw.d.ts +6 -0
  356. package/types/gen-wire/webitel-im-api-gateway-v1-contactsettingsmanagement/webitel-im-api-gateway-v1-contactsettingsmanagement.msw.d.ts +8 -0
  357. package/types/gen-wire/webitel-im-api-gateway-v1-message/webitel-im-api-gateway-v1-message.msw.d.ts +32 -0
  358. package/types/gen-wire/webitel-im-api-gateway-v1-messagehistory/webitel-im-api-gateway-v1-messagehistory.msw.d.ts +12 -0
  359. package/types/gen-wire/webitel-im-api-gateway-v1-threadmanagement/webitel-im-api-gateway-v1-threadmanagement.msw.d.ts +36 -0
  360. package/types/gen-wire/webitel-im-api-gateway-v1-threadpermission/webitel-im-api-gateway-v1-threadpermission.msw.d.ts +8 -0
  361. package/types/gen-wire/webitel-im-api-gateway-v1-threadpreviewservice/webitel-im-api-gateway-v1-threadpreviewservice.msw.d.ts +10 -0
  362. package/types/gen-wire/webitel-im-api-gateway-v1-threadtagmanagement/webitel-im-api-gateway-v1-threadtagmanagement.msw.d.ts +16 -0
  363. package/types/gen-wire/webitel-im-api-gateway-v1-updates/webitel-im-api-gateway-v1-updates.msw.d.ts +6 -0
  364. package/types/gen-wire/webitel-im-api-provider-v1-facebookservice/webitel-im-api-provider-v1-facebookservice.msw.d.ts +18 -0
  365. package/types/gen-wire/webitel-im-api-provider-v1-instagramservice/webitel-im-api-provider-v1-instagramservice.msw.d.ts +10 -0
  366. package/types/gen-wire/webitel-im-api-provider-v1-metaappservice/webitel-im-api-provider-v1-metaappservice.msw.d.ts +10 -0
  367. package/types/gen-wire/webitel-im-api-provider-v1-metaoauthservice/webitel-im-api-provider-v1-metaoauthservice.msw.d.ts +8 -0
  368. package/types/gen-wire/webitel-im-api-provider-v1-viberbmservice/webitel-im-api-provider-v1-viberbmservice.msw.d.ts +12 -0
  369. package/types/gen-wire/webitel-im-api-provider-v1-whatsappservice/webitel-im-api-provider-v1-whatsappservice.msw.d.ts +10 -0
  370. package/types/gen-wire/webitel-im-provider-v1-customservice/webitel-im-provider-v1-customservice.msw.d.ts +12 -0
  371. package/types/gen-wire/webitel-im-provider-v1-facebookservice/webitel-im-provider-v1-facebookservice.msw.d.ts +20 -0
  372. package/types/gen-wire/webitel-im-provider-v1-gateservice/webitel-im-provider-v1-gateservice.msw.d.ts +6 -0
  373. package/types/gen-wire/webitel-im-provider-v1-gatetemplateservice/webitel-im-provider-v1-gatetemplateservice.msw.d.ts +10 -0
  374. package/types/gen-wire/webitel-im-provider-v1-instagramservice/webitel-im-provider-v1-instagramservice.msw.d.ts +12 -0
  375. package/types/gen-wire/webitel-im-provider-v1-metaappservice/webitel-im-provider-v1-metaappservice.msw.d.ts +12 -0
  376. package/types/gen-wire/webitel-im-provider-v1-metaoauthservice/webitel-im-provider-v1-metaoauthservice.msw.d.ts +8 -0
  377. package/types/gen-wire/webitel-im-provider-v1-providermessageservice/webitel-im-provider-v1-providermessageservice.msw.d.ts +22 -0
  378. package/types/gen-wire/webitel-im-provider-v1-viberbmservice/webitel-im-provider-v1-viberbmservice.msw.d.ts +16 -0
  379. package/types/gen-wire/webitel-im-provider-v1-viberservice/webitel-im-provider-v1-viberservice.msw.d.ts +12 -0
  380. package/types/gen-wire/webitel-im-provider-v1-whatsappservice/webitel-im-provider-v1-whatsappservice.msw.d.ts +12 -0
  381. package/types/gen-wire/working-condition-service/working-condition-service.msw.d.ts +14 -0
  382. package/types/gen-wire/working-schedule-service/working-schedule-service.msw.d.ts +20 -0
  383. package/types/scripts/applicationsAccess/ApplicationsAccess.d.ts +45 -0
  384. package/types/scripts/convertDuration/convertDurationWithMilliseconds.d.ts +6 -0
  385. package/types/scripts/index.d.ts +6 -1
  386. package/types/scripts/resolveGrants/resolveGrants.d.ts +11 -0
  387. package/types/validations/changelog/changelog.validations.d.ts +15 -0
  388. package/types/validations/emailProfile/emailProfile.validations.d.ts +36 -0
  389. package/types/validations/importTemplate/importTemplate.validations.d.ts +62 -0
  390. package/types/validations/index.d.ts +7 -0
  391. package/types/validations/role/role.validations.d.ts +34 -0
  392. package/types/validations/schemaVariable/schemaVariable.validations.d.ts +18 -0
  393. package/types/validations/storagePolicy/storagePolicy.validations.d.ts +26 -0
  394. package/types/validations/trigger/trigger.validations.d.ts +38 -0
@@ -0,0 +1,372 @@
1
+ import deepCopy from 'deep-copy';
2
+ import deepmerge from 'deepmerge';
3
+
4
+ import {
5
+ AdminSections,
6
+ AuditorSections,
7
+ CrmSections,
8
+ SupervisorSections,
9
+ WfmSections,
10
+ WtApplication,
11
+ } from '../../enums';
12
+
13
+ /** [Claude] every level optional, as the minified access the api keeps */
14
+ type PartialDeep<T> = {
15
+ [K in keyof T]?: T[K] extends object ? PartialDeep<T[K]> : T[K];
16
+ };
17
+
18
+ type BaseAccessSchema = {
19
+ _enabled: boolean;
20
+ _locale: string;
21
+ };
22
+
23
+ export type ApplicationsAccessSchema = {
24
+ [WtApplication.Agent]: BaseAccessSchema;
25
+ } & {
26
+ [WtApplication.History]: BaseAccessSchema;
27
+ } & {
28
+ [WtApplication.Analytics]: BaseAccessSchema;
29
+ } & {
30
+ [WtApplication.Supervisor]: BaseAccessSchema &
31
+ Partial<Record<SupervisorSections, BaseAccessSchema>>;
32
+ } & {
33
+ [WtApplication.Admin]: BaseAccessSchema &
34
+ Partial<Record<AdminSections, BaseAccessSchema>>;
35
+ } & {
36
+ [WtApplication.Audit]: BaseAccessSchema &
37
+ Partial<Record<AuditorSections, BaseAccessSchema>>;
38
+ } & {
39
+ [WtApplication.Crm]: BaseAccessSchema &
40
+ Partial<Record<CrmSections, BaseAccessSchema>>;
41
+ } & {
42
+ [WtApplication.Wfm]: BaseAccessSchema &
43
+ Partial<Record<WfmSections, BaseAccessSchema>>;
44
+ };
45
+
46
+ /**
47
+ * [Claude] The same tree walked by key, as the role access ui does: apps and
48
+ * sections are looked up by name, and crm adjunct types add `_custom` sections
49
+ * the schema above doesn't list.
50
+ */
51
+ // biome-ignore lint/suspicious/noExplicitAny: a node holds both its `_`-config and its sections
52
+ export type ApplicationsAccessTree = Record<string, Record<string, any>>;
53
+
54
+ const applicationsAccess = (value = true): ApplicationsAccessSchema => ({
55
+ [WtApplication.Agent]: {
56
+ _enabled: value,
57
+ _locale: `WtApplication.${WtApplication.Agent}.name`,
58
+ },
59
+ [WtApplication.History]: {
60
+ _enabled: value,
61
+ _locale: `WtApplication.${WtApplication.History}.name`,
62
+ },
63
+ [WtApplication.Analytics]: {
64
+ _enabled: value,
65
+ _locale: `WtApplication.${WtApplication.Analytics}.name`,
66
+ },
67
+ [WtApplication.Supervisor]: {
68
+ _enabled: value,
69
+ _locale: `WtApplication.${WtApplication.Supervisor}.name`,
70
+ [SupervisorSections.Queues]: {
71
+ _enabled: value,
72
+ _locale: `WtApplication.${WtApplication.Supervisor}.sections.${SupervisorSections.Queues}`,
73
+ },
74
+ [SupervisorSections.Agents]: {
75
+ _enabled: value,
76
+ _locale: `WtApplication.${WtApplication.Supervisor}.sections.${SupervisorSections.Agents}`,
77
+ },
78
+ [SupervisorSections.ActiveCalls]: {
79
+ _enabled: value,
80
+ _locale: `WtApplication.${WtApplication.Supervisor}.sections.${SupervisorSections.ActiveCalls}`,
81
+ },
82
+ },
83
+ [WtApplication.Admin]: {
84
+ _enabled: value,
85
+ _locale: `WtApplication.${WtApplication.Admin}.name`,
86
+ [AdminSections.License]: {
87
+ _enabled: value,
88
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.License}`,
89
+ },
90
+ [AdminSections.Users]: {
91
+ _enabled: value,
92
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Users}`,
93
+ },
94
+ [AdminSections.Devices]: {
95
+ _enabled: value,
96
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Devices}`,
97
+ },
98
+ [AdminSections.Flow]: {
99
+ _enabled: value,
100
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Flow}`,
101
+ },
102
+ [AdminSections.Dialplan]: {
103
+ _enabled: value,
104
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Dialplan}`,
105
+ },
106
+ [AdminSections.Gateways]: {
107
+ _enabled: value,
108
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Gateways}`,
109
+ },
110
+ [AdminSections.Chatplan]: {
111
+ _enabled: value,
112
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Chatplan}`,
113
+ },
114
+ [AdminSections.ChatGateways]: {
115
+ _enabled: value,
116
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.ChatGateways}`,
117
+ },
118
+ [AdminSections.Skills]: {
119
+ _enabled: value,
120
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Skills}`,
121
+ },
122
+ [AdminSections.Buckets]: {
123
+ _enabled: value,
124
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Buckets}`,
125
+ },
126
+ [AdminSections.Blacklist]: {
127
+ _enabled: value,
128
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Blacklist}`,
129
+ },
130
+ [AdminSections.Regions]: {
131
+ _enabled: value,
132
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Regions}`,
133
+ },
134
+ [AdminSections.Calendars]: {
135
+ _enabled: value,
136
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Calendars}`,
137
+ },
138
+ [AdminSections.Communications]: {
139
+ _enabled: value,
140
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Communications}`,
141
+ },
142
+ [AdminSections.PauseCause]: {
143
+ _enabled: value,
144
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.PauseCause}`,
145
+ },
146
+ [AdminSections.ActivityTypes]: {
147
+ _enabled: value,
148
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.ActivityTypes}`,
149
+ },
150
+ [AdminSections.Media]: {
151
+ _enabled: value,
152
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Media}`,
153
+ },
154
+ [AdminSections.QuickReplies]: {
155
+ _enabled: value,
156
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.QuickReplies}`,
157
+ },
158
+ [AdminSections.Agents]: {
159
+ _enabled: value,
160
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Agents}`,
161
+ },
162
+ [AdminSections.Teams]: {
163
+ _enabled: value,
164
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Teams}`,
165
+ },
166
+ [AdminSections.Resources]: {
167
+ _enabled: value,
168
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Resources}`,
169
+ },
170
+ [AdminSections.ResourceGroups]: {
171
+ _enabled: value,
172
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.ResourceGroups}`,
173
+ },
174
+ [AdminSections.Queues]: {
175
+ _enabled: value,
176
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Queues}`,
177
+ },
178
+ [AdminSections.Storage]: {
179
+ _enabled: value,
180
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Storage}`,
181
+ },
182
+ [AdminSections.StoragePolicies]: {
183
+ _enabled: value,
184
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.StoragePolicies}`,
185
+ },
186
+ [AdminSections.CognitiveProfiles]: {
187
+ _enabled: value,
188
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.CognitiveProfiles}`,
189
+ },
190
+ [AdminSections.EmailProfiles]: {
191
+ _enabled: value,
192
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.EmailProfiles}`,
193
+ },
194
+ [AdminSections.SingleSignOn]: {
195
+ _enabled: value,
196
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.SingleSignOn}`,
197
+ },
198
+ [AdminSections.ImportCsv]: {
199
+ _enabled: value,
200
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.ImportCsv}`,
201
+ },
202
+ [AdminSections.Triggers]: {
203
+ _enabled: value,
204
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Triggers}`,
205
+ },
206
+ [AdminSections.Roles]: {
207
+ _enabled: value,
208
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Roles}`,
209
+ },
210
+ [AdminSections.Objects]: {
211
+ _enabled: value,
212
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Objects}`,
213
+ },
214
+ [AdminSections.Changelogs]: {
215
+ _enabled: value,
216
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Changelogs}`,
217
+ },
218
+ [AdminSections.Configuration]: {
219
+ _enabled: value,
220
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.Configuration}`,
221
+ },
222
+ [AdminSections.GlobalVariables]: {
223
+ _enabled: value,
224
+ _locale: `WtApplication.${WtApplication.Admin}.sections.${AdminSections.GlobalVariables}`,
225
+ },
226
+ },
227
+ [WtApplication.Audit]: {
228
+ _enabled: value,
229
+ _locale: `WtApplication.${WtApplication.Audit}.name`,
230
+ [AuditorSections.Scorecards]: {
231
+ _enabled: value,
232
+ _locale: `WtApplication.${WtApplication.Audit}.sections.${AuditorSections.Scorecards}`,
233
+ },
234
+ },
235
+ [WtApplication.Crm]: {
236
+ _enabled: value,
237
+ _locale: `WtApplication.${WtApplication.Crm}.name`,
238
+ [CrmSections.Contacts]: {
239
+ _enabled: value,
240
+ _locale: `WtApplication.${WtApplication.Crm}.sections.${CrmSections.Contacts}`,
241
+ },
242
+ [CrmSections.Cases]: {
243
+ _enabled: value,
244
+ _locale: `WtApplication.${WtApplication.Crm}.sections.${CrmSections.Cases}`,
245
+ },
246
+ [CrmSections.Slas]: {
247
+ _enabled: value,
248
+ _locale: `WtApplication.${WtApplication.Crm}.sections.${CrmSections.Slas}`,
249
+ },
250
+ [CrmSections.Sources]: {
251
+ _enabled: value,
252
+ _locale: `WtApplication.${WtApplication.Crm}.sections.${CrmSections.Sources}`,
253
+ },
254
+ [CrmSections.ServiceCatalogs]: {
255
+ _enabled: value,
256
+ _locale: `WtApplication.${WtApplication.Crm}.sections.${CrmSections.ServiceCatalogs}`,
257
+ },
258
+ [CrmSections.CloseReasonGroups]: {
259
+ _enabled: value,
260
+ _locale: `WtApplication.${WtApplication.Crm}.sections.${CrmSections.CloseReasonGroups}`,
261
+ },
262
+ [CrmSections.ContactGroups]: {
263
+ _enabled: value,
264
+ _locale: `WtApplication.${WtApplication.Crm}.sections.${CrmSections.ContactGroups}`,
265
+ },
266
+ [CrmSections.Priorities]: {
267
+ _enabled: value,
268
+ _locale: `WtApplication.${WtApplication.Crm}.sections.${CrmSections.Priorities}`,
269
+ },
270
+ [CrmSections.Statuses]: {
271
+ _enabled: value,
272
+ _locale: `WtApplication.${WtApplication.Crm}.sections.${CrmSections.Statuses}`,
273
+ },
274
+ [CrmSections.CasesExtensions]: {
275
+ _enabled: value,
276
+ _locale: `WtApplication.overrideApplicationsAccess.${WtApplication.Crm}.sections.${CrmSections.CasesExtensions}`,
277
+ },
278
+ [CrmSections.ContactsExtensions]: {
279
+ _enabled: value,
280
+ _locale: `WtApplication.overrideApplicationsAccess.${WtApplication.Crm}.sections.${CrmSections.ContactsExtensions}`,
281
+ },
282
+ [CrmSections.CustomLookups]: {
283
+ _enabled: value,
284
+ _locale: `WtApplication.overrideApplicationsAccess.${WtApplication.Crm}.sections.${CrmSections.CustomLookups}`,
285
+ },
286
+ },
287
+ [WtApplication.Wfm]: {
288
+ _enabled: value,
289
+ _locale: `WtApplication.${WtApplication.Wfm}.name`,
290
+ [WfmSections.Agents]: {
291
+ _enabled: value,
292
+ _locale: `WtApplication.${WtApplication.Wfm}.sections.${WfmSections.Agents}`,
293
+ },
294
+ [WfmSections.Schedules]: {
295
+ _enabled: value,
296
+ _locale: `WtApplication.${WtApplication.Wfm}.sections.${WfmSections.Schedules}`,
297
+ },
298
+ [WfmSections.ForecastCalculation]: {
299
+ _enabled: value,
300
+ _locale: `WtApplication.${WtApplication.Wfm}.sections.${WfmSections.ForecastCalculation}`,
301
+ },
302
+ [WfmSections.ShiftTemplates]: {
303
+ _enabled: value,
304
+ _locale: `WtApplication.${WtApplication.Wfm}.sections.${WfmSections.ShiftTemplates}`,
305
+ },
306
+ [WfmSections.PauseTemplates]: {
307
+ _enabled: value,
308
+ _locale: `WtApplication.${WtApplication.Wfm}.sections.${WfmSections.PauseTemplates}`,
309
+ },
310
+ [WfmSections.WorkingConditions]: {
311
+ _enabled: value,
312
+ _locale: `WtApplication.${WtApplication.Wfm}.sections.${WfmSections.WorkingConditions}`,
313
+ },
314
+ },
315
+ });
316
+
317
+ /**
318
+ */
319
+ export class ApplicationsAccess {
320
+ access: ApplicationsAccessSchema;
321
+
322
+ // value param could be passed to set same value for all options
323
+ constructor(
324
+ {
325
+ access,
326
+ value,
327
+ }: {
328
+ access?: PartialDeep<ApplicationsAccessSchema>;
329
+ value?: boolean;
330
+ } = {
331
+ value: true,
332
+ },
333
+ ) {
334
+ /* if access, deeply merge with falsy values schema
335
+ if no access, "not configured => full permissions" */
336
+ this.access = access
337
+ ? ApplicationsAccess.restore(access)
338
+ : applicationsAccess(value);
339
+ }
340
+
341
+ // minify schema for API sending
342
+ static minify(access: Record<string, unknown>) {
343
+ const rmEmptyKeys = (obj: Record<string, unknown>) => {
344
+ Object.keys(obj).forEach((key) => {
345
+ if (!obj[key] || key === '_locale') delete obj[key];
346
+ if (typeof obj[key] === 'object') {
347
+ const nested = obj[key] as Record<string, unknown>;
348
+ rmEmptyKeys(nested);
349
+
350
+ if (!Object.keys(nested).length) delete obj[key];
351
+ }
352
+ });
353
+ return obj;
354
+ };
355
+ return rmEmptyKeys(deepCopy(access));
356
+ }
357
+
358
+ // restore minified schema from API response
359
+ static restore(
360
+ access: PartialDeep<ApplicationsAccessSchema>,
361
+ ): ApplicationsAccessSchema {
362
+ return deepmerge(
363
+ applicationsAccess(false),
364
+ access,
365
+ ) as ApplicationsAccessSchema;
366
+ // return deepmerge(access, applicationsAccess(false));
367
+ }
368
+
369
+ getAccess() {
370
+ return this.access;
371
+ }
372
+ }
@@ -0,0 +1,43 @@
1
+ import { describe, expect, it } from 'vitest';
2
+
3
+ import { WfmSections, WtApplication } from '../../../enums';
4
+ import { ApplicationsAccess } from '../ApplicationsAccess';
5
+
6
+ const wfmSections = [
7
+ WfmSections.Agents,
8
+ WfmSections.Schedules,
9
+ WfmSections.ForecastCalculation,
10
+ WfmSections.ShiftTemplates,
11
+ WfmSections.PauseTemplates,
12
+ WfmSections.WorkingConditions,
13
+ ];
14
+
15
+ describe('ApplicationsAccess', () => {
16
+ it('includes WFM application with its sections', () => {
17
+ const { access } = new ApplicationsAccess();
18
+
19
+ expect(access[WtApplication.Wfm]._enabled).toBe(true);
20
+ expect(access[WtApplication.Wfm]._locale).toBe(
21
+ `WtApplication.${WtApplication.Wfm}.name`,
22
+ );
23
+ wfmSections.forEach((section) => {
24
+ expect(access[WtApplication.Wfm][section]).toEqual({
25
+ _enabled: true,
26
+ _locale: `WtApplication.${WtApplication.Wfm}.sections.${section}`,
27
+ });
28
+ });
29
+ });
30
+
31
+ it('restores WFM as disabled when it is missing from saved access', () => {
32
+ const { access } = new ApplicationsAccess({
33
+ access: {
34
+ [WtApplication.Crm]: {
35
+ _enabled: true,
36
+ },
37
+ },
38
+ });
39
+
40
+ expect(access[WtApplication.Wfm]._enabled).toBe(false);
41
+ expect(access[WtApplication.Wfm][WfmSections.Agents]?._enabled).toBe(false);
42
+ });
43
+ });
@@ -0,0 +1,19 @@
1
+ import { describe, expect, it } from 'vitest';
2
+
3
+ import convertDurationWithMilliseconds from '../convertDurationWithMilliseconds';
4
+
5
+ describe('convertDurationWithMilliseconds', () => {
6
+ it('formats hours, minutes, seconds and milliseconds', () => {
7
+ expect(convertDurationWithMilliseconds(3_723_456)).toBe('01:02:03.456');
8
+ });
9
+
10
+ it('pads milliseconds to three digits', () => {
11
+ expect(convertDurationWithMilliseconds(1_005)).toBe('00:00:01.005');
12
+ });
13
+
14
+ it('shows zero for a missing or invalid duration', () => {
15
+ expect(convertDurationWithMilliseconds()).toBe('00:00:00.000');
16
+ expect(convertDurationWithMilliseconds(Number.NaN)).toBe('00:00:00.000');
17
+ expect(convertDurationWithMilliseconds(-10)).toBe('00:00:00.000');
18
+ });
19
+ });
@@ -0,0 +1,18 @@
1
+ import convertDuration from './convertDuration';
2
+
3
+ /**
4
+ * [Claude] A duration given in milliseconds, as `HH:MM:SS.mmm`. A missing or
5
+ * invalid one (e.g. a run that has not stopped yet) shows as zero.
6
+ */
7
+ const convertDurationWithMilliseconds = (duration?: number) => {
8
+ const milliseconds = Number.isFinite(duration)
9
+ ? Math.max(0, Math.floor(duration as number))
10
+ : 0;
11
+
12
+ const time = convertDuration(Math.floor(milliseconds / 1000));
13
+ const rest = `${milliseconds % 1000}`.padStart(3, '0');
14
+
15
+ return `${time}.${rest}`;
16
+ };
17
+
18
+ export default convertDurationWithMilliseconds;
@@ -1,4 +1,10 @@
1
+ import {
2
+ ApplicationsAccess,
3
+ type ApplicationsAccessSchema,
4
+ type ApplicationsAccessTree,
5
+ } from './applicationsAccess/ApplicationsAccess';
1
6
  import convertDuration from './convertDuration/convertDuration';
7
+ import convertDurationWithMilliseconds from './convertDuration/convertDurationWithMilliseconds';
2
8
  import { minToSec, secToMin } from './convertTimeUnits/convertTimeUnits';
3
9
  import downloadFile from './downloadFile/downloadFile';
4
10
  import { FileFormat } from './downloadFile/types/fileFormat.types';
@@ -7,6 +13,7 @@ import {
7
13
  normalizeDatetimeRange,
8
14
  normalizeToTimestamp,
9
15
  } from './normalizeDatetime/normalizeDatetime';
16
+ import { resolveGrants } from './resolveGrants/resolveGrants';
10
17
 
11
18
  export type {
12
19
  DatetimeRangeValue,
@@ -14,13 +21,18 @@ export type {
14
21
  NormalizeDatetimeValueParam,
15
22
  RelativeDatetimeRoundOption,
16
23
  } from './normalizeDatetime/normalizeDatetime';
24
+ export type { ResolveGrantsParams } from './resolveGrants/resolveGrants';
25
+ export type { ApplicationsAccessSchema, ApplicationsAccessTree };
17
26
  export {
27
+ ApplicationsAccess,
18
28
  convertDuration,
29
+ convertDurationWithMilliseconds,
19
30
  downloadFile,
20
31
  FileFormat,
21
32
  isRelativeDatetimeValue,
22
33
  minToSec,
23
34
  normalizeDatetimeRange,
24
35
  normalizeToTimestamp,
36
+ resolveGrants,
25
37
  secToMin,
26
38
  };
@@ -0,0 +1,42 @@
1
+ import { AccessMode } from '../../enums/AccessMode/AccessMode';
2
+
3
+ export interface ResolveGrantsParams {
4
+ /** [Claude] what the row has for this rule now */
5
+ have: {
6
+ rule: string;
7
+ };
8
+ ruleName: string;
9
+ mode:
10
+ | {
11
+ id: number;
12
+ }
13
+ | number;
14
+ }
15
+
16
+ /*
17
+ [Claude] what to send for a rule, by what the row has and what is picked
18
+ has | patch | got
19
+ -----+-------+-----
20
+ - | w | w
21
+ w | w | -
22
+ - | ww | ww
23
+ w | ww | ww
24
+ ww | ww | w
25
+ ww | w | -
26
+ */
27
+ export const resolveGrants = ({
28
+ have,
29
+ ruleName,
30
+ mode,
31
+ }: ResolveGrantsParams): string | null => {
32
+ switch (typeof mode === 'number' ? mode : mode?.id) {
33
+ case AccessMode.Forbidden:
34
+ return ruleName;
35
+ case AccessMode.Allow:
36
+ return have.rule || ruleName;
37
+ case AccessMode.Manage:
38
+ return `${ruleName}${ruleName}`;
39
+ default:
40
+ return null;
41
+ }
42
+ };
@@ -0,0 +1,41 @@
1
+ import { getDefaultsFromZodSchema } from '@webitel/api-services/gen/utils';
2
+ import { describe, expect, it } from 'vitest';
3
+
4
+ import { changelogSchema } from '../changelog.validations';
5
+
6
+ const issuePaths = (result: ReturnType<typeof changelogSchema.safeParse>) =>
7
+ result.error?.issues.map(({ path }) => path.join('.')) ?? [];
8
+
9
+ const defaults = () => getDefaultsFromZodSchema(changelogSchema, {});
10
+
11
+ describe('changelogSchema', () => {
12
+ it('seeds a new changelog as a disabled weekly one kept for a week', () => {
13
+ expect(defaults()).toMatchObject({
14
+ daysToStore: 7,
15
+ period: 7,
16
+ enabled: false,
17
+ description: '',
18
+ });
19
+ });
20
+
21
+ it('requires the object', () => {
22
+ expect(issuePaths(changelogSchema.safeParse(defaults()))).toEqual([
23
+ 'object.id',
24
+ ]);
25
+ });
26
+
27
+ it('keeps the logs for a day at least', () => {
28
+ const result = changelogSchema.safeParse({
29
+ ...(defaults() as object),
30
+ object: {
31
+ id: 1,
32
+ name: 'schema',
33
+ },
34
+ daysToStore: 0,
35
+ });
36
+
37
+ expect(issuePaths(result)).toEqual([
38
+ 'daysToStore',
39
+ ]);
40
+ });
41
+ });
@@ -0,0 +1,22 @@
1
+ import type { LoggerConfig } from '@webitel/api-services/gen/models';
2
+ import { z } from 'zod';
3
+
4
+ import {
5
+ filledLookupSchema,
6
+ flexibleLookupSchema,
7
+ } from '../_shared/lookup.validations';
8
+ import type { ZodShape } from '../types';
9
+
10
+ export type ChangelogCard = LoggerConfig;
11
+
12
+ /** [Claude] Changelog card schema: which object is logged, where the logs go and for how long. */
13
+ export const changelogSchema = z.object<ZodShape<LoggerConfig>>({
14
+ id: z.number().optional(),
15
+ // [Claude] `.prefault`, not `.default`: zod 4's `.default({})` would skip the required check
16
+ object: filledLookupSchema.prefault({}),
17
+ storage: flexibleLookupSchema.optional().default({}),
18
+ daysToStore: z.number().min(1).default(7),
19
+ period: z.number().default(7),
20
+ enabled: z.boolean().default(false),
21
+ description: z.string().optional().default(''),
22
+ });
@@ -0,0 +1,105 @@
1
+ import { EngineEmailAuthType } from '@webitel/api-services/gen/models';
2
+ import { getDefaultsFromZodSchema } from '@webitel/api-services/gen/utils';
3
+ import { describe, expect, it } from 'vitest';
4
+
5
+ import { emailProfileSchema } from '../emailProfile.validations';
6
+
7
+ const issuePaths = (result: ReturnType<typeof emailProfileSchema.safeParse>) =>
8
+ result.error?.issues.map(({ path }) => path.join('.')) ?? [];
9
+
10
+ const filled = {
11
+ name: 'support',
12
+ mailbox: 'support@example.com',
13
+ imapHost: 'imap.example.com',
14
+ smtpHost: 'smtp.example.com',
15
+ login: 'support@example.com',
16
+ password: 'secret',
17
+ schema: {
18
+ id: '1',
19
+ name: 'flow',
20
+ },
21
+ };
22
+
23
+ describe('emailProfileSchema', () => {
24
+ it('seeds a new profile with plain auth and the usual ports', () => {
25
+ expect(getDefaultsFromZodSchema(emailProfileSchema, {})).toMatchObject({
26
+ enabled: true,
27
+ imapPort: 993,
28
+ smtpPort: 587,
29
+ fetchInterval: 60,
30
+ listen: false,
31
+ authType: EngineEmailAuthType.Plain,
32
+ params: {
33
+ oauth2: {
34
+ clientId: '',
35
+ clientSecret: '',
36
+ redirectUrl: '',
37
+ },
38
+ },
39
+ });
40
+ });
41
+
42
+ it('requires the connection settings, the flow and a password for a new profile', () => {
43
+ const paths = issuePaths(
44
+ emailProfileSchema.safeParse(
45
+ getDefaultsFromZodSchema(emailProfileSchema, {}),
46
+ ),
47
+ );
48
+
49
+ expect(paths).toEqual(
50
+ expect.arrayContaining([
51
+ 'name',
52
+ 'mailbox',
53
+ 'imapHost',
54
+ 'smtpHost',
55
+ 'login',
56
+ 'schema.id',
57
+ 'password',
58
+ ]),
59
+ );
60
+ });
61
+
62
+ it('does not require the password of a saved profile', () => {
63
+ const result = emailProfileSchema.safeParse({
64
+ ...getDefaultsFromZodSchema(emailProfileSchema, {}),
65
+ ...filled,
66
+ id: '1',
67
+ password: '',
68
+ });
69
+
70
+ expect(result.success).toBe(true);
71
+ });
72
+
73
+ it('requires the client settings instead of a password for oauth2', () => {
74
+ const paths = issuePaths(
75
+ emailProfileSchema.safeParse({
76
+ ...getDefaultsFromZodSchema(emailProfileSchema, {}),
77
+ ...filled,
78
+ password: '',
79
+ authType: EngineEmailAuthType.OAuth2,
80
+ }),
81
+ );
82
+
83
+ expect(paths).toEqual([
84
+ 'params.oauth2.clientId',
85
+ 'params.oauth2.clientSecret',
86
+ 'params.oauth2.redirectUrl',
87
+ ]);
88
+ });
89
+
90
+ it('rejects a port out of range and an emptied one', () => {
91
+ const paths = issuePaths(
92
+ emailProfileSchema.safeParse({
93
+ ...getDefaultsFromZodSchema(emailProfileSchema, {}),
94
+ ...filled,
95
+ imapPort: 70000,
96
+ smtpPort: null,
97
+ }),
98
+ );
99
+
100
+ expect(paths).toEqual([
101
+ 'imapPort',
102
+ 'smtpPort',
103
+ ]);
104
+ });
105
+ });