@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.
- package/package.json +1 -1
- package/src/api/clients/_shared/__tests__/generatePermissionsApi.spec.ts +37 -0
- package/src/api/clients/_shared/generatePermissionsApi.ts +26 -1
- package/src/api/clients/emailProfiles/emailProfiles.ts +6 -19
- package/src/api/clients/importTemplates/importTemplates.ts +36 -21
- package/src/api/clients/index.ts +3 -1
- package/src/api/clients/logs/logs.ts +56 -94
- package/src/api/clients/objectClasses/objectClasses.ts +211 -0
- package/src/api/clients/queues/queues.ts +2 -2
- package/src/api/clients/ringtones/ringtones.ts +30 -0
- package/src/api/clients/roles/roles.ts +227 -0
- package/src/api/clients/schemaVariables/schemaVariables.ts +21 -17
- package/src/api/clients/storagePolicies/storagePolicies.ts +24 -36
- package/src/api/clients/triggers/triggerJobs.ts +22 -12
- package/src/api/clients/triggers/triggers.ts +12 -37
- package/src/api/clients/userSettings/userSettings.ts +21 -0
- package/src/enums/AccessMode/AccessMode.ts +8 -0
- package/src/enums/AccessRuleColumn/AccessRuleColumn.ts +11 -0
- package/src/enums/AccessRuleName/AccessRuleName.ts +10 -0
- package/src/enums/WebitelApplications/AdminSections.ts +45 -0
- package/src/enums/WebitelApplications/AuditorSections.ts +6 -0
- package/src/enums/WebitelApplications/CrmSections.ts +21 -0
- package/src/enums/WebitelApplications/SupervisorSections.ts +8 -0
- package/src/enums/WebitelApplications/WfmSections.ts +12 -0
- package/src/enums/WebitelApplications/WtApplication.ts +13 -0
- package/src/enums/index.ts +18 -0
- package/src/gen/_models/webitelKbTreeNode.ts +3 -0
- package/src/gen-wire/_models/webitelKbTreeNode.ts +3 -0
- package/src/gen-wire/access-store/access-store.msw.ts +491 -0
- package/src/gen-wire/agent-absence-service/agent-absence-service.msw.ts +985 -0
- package/src/gen-wire/agent-chat-service/agent-chat-service.msw.ts +986 -0
- package/src/gen-wire/agent-chat-tag-service/agent-chat-tag-service.msw.ts +76 -0
- package/src/gen-wire/agent-pause-cause-service/agent-pause-cause-service.msw.ts +1029 -0
- package/src/gen-wire/agent-service/agent-service.msw.ts +4444 -0
- package/src/gen-wire/agent-skill-service/agent-skill-service.msw.ts +1347 -0
- package/src/gen-wire/agent-team-service/agent-team-service.msw.ts +875 -0
- package/src/gen-wire/agent-working-conditions-service/agent-working-conditions-service.msw.ts +196 -0
- package/src/gen-wire/agent-working-schedule-service/agent-working-schedule-service.msw.ts +846 -0
- package/src/gen-wire/articles/articles.msw.ts +5132 -0
- package/src/gen-wire/articles/articles.zod.ts +10 -0
- package/src/gen-wire/attachments/attachments.msw.ts +387 -0
- package/src/gen-wire/audit-form-service/audit-form-service.msw.ts +3169 -0
- package/src/gen-wire/auth/auth.msw.ts +801 -0
- package/src/gen-wire/backend-profile-service/backend-profile-service.msw.ts +1131 -0
- package/src/gen-wire/bucket-service/bucket-service.msw.ts +330 -0
- package/src/gen-wire/calendar-service/calendar-service.msw.ts +1526 -0
- package/src/gen-wire/call-service/call-service.msw.ts +6221 -0
- package/src/gen-wire/case-articles/case-articles.msw.ts +656 -0
- package/src/gen-wire/case-comments/case-comments.msw.ts +1164 -0
- package/src/gen-wire/case-communications/case-communications.msw.ts +279 -0
- package/src/gen-wire/case-files/case-files.msw.ts +295 -0
- package/src/gen-wire/case-links/case-links.msw.ts +1002 -0
- package/src/gen-wire/case-timeline/case-timeline.msw.ts +1012 -0
- package/src/gen-wire/cases/cases.msw.ts +14299 -0
- package/src/gen-wire/cases-chat-catalog/cases-chat-catalog.msw.ts +992 -0
- package/src/gen-wire/catalogs/catalogs.msw.ts +4088 -0
- package/src/gen-wire/classes/classes.msw.ts +309 -0
- package/src/gen-wire/close-reason-groups/close-reason-groups.msw.ts +803 -0
- package/src/gen-wire/close-reasons/close-reasons.msw.ts +845 -0
- package/src/gen-wire/cognitive-profile-service/cognitive-profile-service.msw.ts +942 -0
- package/src/gen-wire/comments/comments.msw.ts +900 -0
- package/src/gen-wire/communication-type-service/communication-type-service.msw.ts +549 -0
- package/src/gen-wire/config-service/config-service.msw.ts +687 -0
- package/src/gen-wire/contact-groups/contact-groups.msw.ts +1494 -0
- package/src/gen-wire/contact-linking-service/contact-linking-service.msw.ts +96 -0
- package/src/gen-wire/contacts/contacts.msw.ts +12671 -0
- package/src/gen-wire/contacts-chat-catalog/contacts-chat-catalog.msw.ts +1571 -0
- package/src/gen-wire/customer/customer.msw.ts +1376 -0
- package/src/gen-wire/customers/customers.msw.ts +2279 -0
- package/src/gen-wire/devices/devices.msw.ts +2119 -0
- package/src/gen-wire/dictionaries/dictionaries.msw.ts +7852 -0
- package/src/gen-wire/domains/domains.msw.ts +218 -0
- package/src/gen-wire/dynamic-conditions/dynamic-conditions.msw.ts +1229 -0
- package/src/gen-wire/dynamic-groups/dynamic-groups.msw.ts +1685 -0
- package/src/gen-wire/email-profile-service/email-profile-service.msw.ts +1832 -0
- package/src/gen-wire/emails/emails.msw.ts +1627 -0
- package/src/gen-wire/embedding-models/embedding-models.msw.ts +1048 -0
- package/src/gen-wire/extensions/extensions.msw.ts +5062 -0
- package/src/gen-wire/feedback-service/feedback-service.msw.ts +149 -0
- package/src/gen-wire/file-policies-service/file-policies-service.msw.ts +1310 -0
- package/src/gen-wire/file-service/file-service.msw.ts +1442 -0
- package/src/gen-wire/file-transcript-service/file-transcript-service.msw.ts +290 -0
- package/src/gen-wire/forecast-calculation-service/forecast-calculation-service.msw.ts +837 -0
- package/src/gen-wire/ftsservice/ftsservice.msw.ts +90 -0
- package/src/gen-wire/groups/groups.msw.ts +5778 -0
- package/src/gen-wire/im-service-provider-v1-telegrambotservice/im-service-provider-v1-telegrambotservice.msw.ts +390 -0
- package/src/gen-wire/imclients/imclients.msw.ts +541 -0
- package/src/gen-wire/import-template-service/import-template-service.msw.ts +603 -0
- package/src/gen-wire/index.msw.ts +152 -0
- package/src/gen-wire/index.ts +1 -0
- package/src/gen-wire/knowledgebase-search/knowledgebase-search.msw.ts +94 -0
- package/src/gen-wire/labels/labels.msw.ts +784 -0
- package/src/gen-wire/languages/languages.msw.ts +1504 -0
- package/src/gen-wire/ldap/ldap.msw.ts +6443 -0
- package/src/gen-wire/list-service/list-service.msw.ts +1359 -0
- package/src/gen-wire/logger-service/logger-service.msw.ts +620 -0
- package/src/gen-wire/managers/managers.msw.ts +1508 -0
- package/src/gen-wire/media-file-service/media-file-service.msw.ts +429 -0
- package/src/gen-wire/meeting-service/meeting-service.msw.ts +179 -0
- package/src/gen-wire/member-service/member-service.msw.ts +5742 -0
- package/src/gen-wire/messages/messages.msw.ts +3663 -0
- package/src/gen-wire/oauth2-federation/oauth2-federation.msw.ts +1446 -0
- package/src/gen-wire/online-skills/online-skills.msw.ts +882 -0
- package/src/gen-wire/outbound-resource-group-service/outbound-resource-group-service.msw.ts +1417 -0
- package/src/gen-wire/outbound-resource-service/outbound-resource-service.msw.ts +2093 -0
- package/src/gen-wire/pause-template-service/pause-template-service.msw.ts +823 -0
- package/src/gen-wire/pdf-service/pdf-service.msw.ts +851 -0
- package/src/gen-wire/permissions/permissions.msw.ts +98 -0
- package/src/gen-wire/phones/phones.msw.ts +1627 -0
- package/src/gen-wire/photos/photos.msw.ts +1369 -0
- package/src/gen-wire/presence/presence.msw.ts +485 -0
- package/src/gen-wire/preset-query-service/preset-query-service.msw.ts +522 -0
- package/src/gen-wire/priorities/priorities.msw.ts +719 -0
- package/src/gen-wire/queue-bucket-service/queue-bucket-service.msw.ts +492 -0
- package/src/gen-wire/queue-hook-service/queue-hook-service.msw.ts +582 -0
- package/src/gen-wire/queue-resources-service/queue-resources-service.msw.ts +475 -0
- package/src/gen-wire/queue-service/queue-service.msw.ts +3759 -0
- package/src/gen-wire/queue-skill-service/queue-skill-service.msw.ts +672 -0
- package/src/gen-wire/quick-replies-service/quick-replies-service.msw.ts +1254 -0
- package/src/gen-wire/records/records.msw.ts +1847 -0
- package/src/gen-wire/region-service/region-service.msw.ts +528 -0
- package/src/gen-wire/related-cases/related-cases.msw.ts +1428 -0
- package/src/gen-wire/retrieval/retrieval.msw.ts +805 -0
- package/src/gen-wire/routing-chat-plan-service/routing-chat-plan-service.msw.ts +522 -0
- package/src/gen-wire/routing-outbound-call-service/routing-outbound-call-service.msw.ts +1057 -0
- package/src/gen-wire/routing-schema-service/routing-schema-service.msw.ts +1045 -0
- package/src/gen-wire/routing-variable-service/routing-variable-service.msw.ts +374 -0
- package/src/gen-wire/schema-variables-service/schema-variables-service.msw.ts +333 -0
- package/src/gen-wire/services/services.msw.ts +2921 -0
- package/src/gen-wire/shift-template-service/shift-template-service.msw.ts +727 -0
- package/src/gen-wire/skill-service/skill-service.msw.ts +1299 -0
- package/src/gen-wire/slaconditions/slaconditions.msw.ts +1087 -0
- package/src/gen-wire/slas/slas.msw.ts +1145 -0
- package/src/gen-wire/sources/sources.msw.ts +689 -0
- package/src/gen-wire/spaces/spaces.msw.ts +2456 -0
- package/src/gen-wire/status-conditions/status-conditions.msw.ts +897 -0
- package/src/gen-wire/statuses/statuses.msw.ts +791 -0
- package/src/gen-wire/system-setting-service/system-setting-service.msw.ts +343 -0
- package/src/gen-wire/tags/tags.msw.ts +133 -0
- package/src/gen-wire/team-chat-tag-service/team-chat-tag-service.msw.ts +214 -0
- package/src/gen-wire/team-hook-service/team-hook-service.msw.ts +552 -0
- package/src/gen-wire/team-trigger-service/team-trigger-service.msw.ts +669 -0
- package/src/gen-wire/timeline/timeline.msw.ts +1109 -0
- package/src/gen-wire/timezones/timezones.msw.ts +1523 -0
- package/src/gen-wire/trigger-service/trigger-service.msw.ts +1113 -0
- package/src/gen-wire/two-factor-authentication/two-factor-authentication.msw.ts +160 -0
- package/src/gen-wire/types/types.msw.ts +1696 -0
- package/src/gen-wire/user-access-tokens/user-access-tokens.msw.ts +1357 -0
- package/src/gen-wire/user-helper-service/user-helper-service.msw.ts +472 -0
- package/src/gen-wire/users/users.msw.ts +5595 -0
- package/src/gen-wire/variables/variables.msw.ts +1189 -0
- package/src/gen-wire/versions/versions.msw.ts +441 -0
- package/src/gen-wire/web-hook-service/web-hook-service.msw.ts +1128 -0
- package/src/gen-wire/webitel-im-api-gateway-v1-account/webitel-im-api-gateway-v1-account.msw.ts +986 -0
- package/src/gen-wire/webitel-im-api-gateway-v1-bots/webitel-im-api-gateway-v1-bots.msw.ts +253 -0
- package/src/gen-wire/webitel-im-api-gateway-v1-contacts/webitel-im-api-gateway-v1-contacts.msw.ts +246 -0
- package/src/gen-wire/webitel-im-api-gateway-v1-contactsettingsmanagement/webitel-im-api-gateway-v1-contactsettingsmanagement.msw.ts +148 -0
- package/src/gen-wire/webitel-im-api-gateway-v1-message/webitel-im-api-gateway-v1-message.msw.ts +1289 -0
- package/src/gen-wire/webitel-im-api-gateway-v1-messagehistory/webitel-im-api-gateway-v1-messagehistory.msw.ts +7390 -0
- package/src/gen-wire/webitel-im-api-gateway-v1-threadmanagement/webitel-im-api-gateway-v1-threadmanagement.msw.ts +15159 -0
- package/src/gen-wire/webitel-im-api-gateway-v1-threadpermission/webitel-im-api-gateway-v1-threadpermission.msw.ts +220 -0
- package/src/gen-wire/webitel-im-api-gateway-v1-threadpreviewservice/webitel-im-api-gateway-v1-threadpreviewservice.msw.ts +777 -0
- package/src/gen-wire/webitel-im-api-gateway-v1-threadtagmanagement/webitel-im-api-gateway-v1-threadtagmanagement.msw.ts +315 -0
- package/src/gen-wire/webitel-im-api-gateway-v1-updates/webitel-im-api-gateway-v1-updates.msw.ts +7922 -0
- package/src/gen-wire/webitel-im-api-provider-v1-facebookservice/webitel-im-api-provider-v1-facebookservice.msw.ts +504 -0
- package/src/gen-wire/webitel-im-api-provider-v1-instagramservice/webitel-im-api-provider-v1-instagramservice.msw.ts +341 -0
- package/src/gen-wire/webitel-im-api-provider-v1-metaappservice/webitel-im-api-provider-v1-metaappservice.msw.ts +395 -0
- package/src/gen-wire/webitel-im-api-provider-v1-metaoauthservice/webitel-im-api-provider-v1-metaoauthservice.msw.ts +170 -0
- package/src/gen-wire/webitel-im-api-provider-v1-viberbmservice/webitel-im-api-provider-v1-viberbmservice.msw.ts +426 -0
- package/src/gen-wire/webitel-im-api-provider-v1-whatsappservice/webitel-im-api-provider-v1-whatsappservice.msw.ts +383 -0
- package/src/gen-wire/webitel-im-provider-v1-customservice/webitel-im-provider-v1-customservice.msw.ts +586 -0
- package/src/gen-wire/webitel-im-provider-v1-facebookservice/webitel-im-provider-v1-facebookservice.msw.ts +610 -0
- package/src/gen-wire/webitel-im-provider-v1-gateservice/webitel-im-provider-v1-gateservice.msw.ts +183 -0
- package/src/gen-wire/webitel-im-provider-v1-gatetemplateservice/webitel-im-provider-v1-gatetemplateservice.msw.ts +195 -0
- package/src/gen-wire/webitel-im-provider-v1-instagramservice/webitel-im-provider-v1-instagramservice.msw.ts +442 -0
- package/src/gen-wire/webitel-im-provider-v1-metaappservice/webitel-im-provider-v1-metaappservice.msw.ts +514 -0
- package/src/gen-wire/webitel-im-provider-v1-metaoauthservice/webitel-im-provider-v1-metaoauthservice.msw.ts +166 -0
- package/src/gen-wire/webitel-im-provider-v1-providermessageservice/webitel-im-provider-v1-providermessageservice.msw.ts +466 -0
- package/src/gen-wire/webitel-im-provider-v1-viberbmservice/webitel-im-provider-v1-viberbmservice.msw.ts +662 -0
- package/src/gen-wire/webitel-im-provider-v1-viberservice/webitel-im-provider-v1-viberservice.msw.ts +550 -0
- package/src/gen-wire/webitel-im-provider-v1-whatsappservice/webitel-im-provider-v1-whatsappservice.msw.ts +573 -0
- package/src/gen-wire/working-condition-service/working-condition-service.msw.ts +925 -0
- package/src/gen-wire/working-schedule-service/working-schedule-service.msw.ts +1450 -0
- package/src/scripts/applicationsAccess/ApplicationsAccess.ts +372 -0
- package/src/scripts/applicationsAccess/__tests__/ApplicationsAccess.spec.ts +43 -0
- package/src/scripts/convertDuration/__tests__/convertDurationWithMilliseconds.spec.ts +19 -0
- package/src/scripts/convertDuration/convertDurationWithMilliseconds.ts +18 -0
- package/src/scripts/index.ts +12 -0
- package/src/scripts/resolveGrants/resolveGrants.ts +42 -0
- package/src/validations/changelog/__tests__/changelog.validations.spec.ts +41 -0
- package/src/validations/changelog/changelog.validations.ts +22 -0
- package/src/validations/emailProfile/__tests__/emailProfile.validations.spec.ts +105 -0
- package/src/validations/emailProfile/emailProfile.validations.ts +113 -0
- package/src/validations/importTemplate/__tests__/importTemplate.validations.spec.ts +77 -0
- package/src/validations/importTemplate/importTemplate.validations.ts +56 -0
- package/src/validations/index.ts +7 -0
- package/src/validations/role/__tests__/role.validations.spec.ts +53 -0
- package/src/validations/role/role.validations.ts +42 -0
- package/src/validations/schemaVariable/__tests__/schemaVariable.validations.spec.ts +50 -0
- package/src/validations/schemaVariable/schemaVariable.validations.ts +35 -0
- package/src/validations/storagePolicy/__tests__/storagePolicy.validations.spec.ts +52 -0
- package/src/validations/storagePolicy/storagePolicy.validations.ts +36 -0
- package/src/validations/trigger/__tests__/trigger.validations.spec.ts +92 -0
- package/src/validations/trigger/trigger.validations.ts +82 -0
- package/types/.tsbuildinfo +1 -1
- package/types/api/clients/_shared/generatePermissionsApi.d.ts +31 -0
- package/types/api/clients/importTemplates/importTemplates.d.ts +2 -2
- package/types/api/clients/index.d.ts +3 -0
- package/types/api/clients/logs/logs.d.ts +2 -2
- package/types/api/clients/objectClasses/objectClasses.d.ts +27 -0
- package/types/api/clients/ringtones/ringtones.d.ts +8 -0
- package/types/api/clients/roles/roles.d.ts +19 -0
- package/types/api/clients/userSettings/userSettings.d.ts +5 -0
- package/types/enums/AccessMode/AccessMode.d.ts +7 -0
- package/types/enums/AccessRuleColumn/AccessRuleColumn.d.ts +8 -0
- package/types/enums/AccessRuleName/AccessRuleName.d.ts +8 -0
- package/types/enums/WebitelApplications/AdminSections.d.ts +44 -0
- package/types/enums/WebitelApplications/AuditorSections.d.ts +4 -0
- package/types/enums/WebitelApplications/CrmSections.d.ts +16 -0
- package/types/enums/WebitelApplications/SupervisorSections.d.ts +6 -0
- package/types/enums/WebitelApplications/WfmSections.d.ts +9 -0
- package/types/enums/WebitelApplications/WtApplication.d.ts +12 -0
- package/types/enums/index.d.ts +10 -1
- package/types/gen/_models/webitelKbTreeNode.d.ts +3 -0
- package/types/gen-wire/_models/webitelKbTreeNode.d.ts +3 -0
- package/types/gen-wire/access-store/access-store.msw.d.ts +12 -0
- package/types/gen-wire/agent-absence-service/agent-absence-service.msw.d.ts +18 -0
- package/types/gen-wire/agent-chat-service/agent-chat-service.msw.d.ts +10 -0
- package/types/gen-wire/agent-chat-tag-service/agent-chat-tag-service.msw.d.ts +6 -0
- package/types/gen-wire/agent-pause-cause-service/agent-pause-cause-service.msw.d.ts +16 -0
- package/types/gen-wire/agent-service/agent-service.msw.d.ts +44 -0
- package/types/gen-wire/agent-skill-service/agent-skill-service.msw.d.ts +24 -0
- package/types/gen-wire/agent-team-service/agent-team-service.msw.d.ts +14 -0
- package/types/gen-wire/agent-working-conditions-service/agent-working-conditions-service.msw.d.ts +8 -0
- package/types/gen-wire/agent-working-schedule-service/agent-working-schedule-service.msw.d.ts +8 -0
- package/types/gen-wire/articles/articles.msw.d.ts +44 -0
- package/types/gen-wire/articles/articles.zod.d.ts +7 -0
- package/types/gen-wire/attachments/attachments.msw.d.ts +10 -0
- package/types/gen-wire/audit-form-service/audit-form-service.msw.d.ts +26 -0
- package/types/gen-wire/auth/auth.msw.d.ts +10 -0
- package/types/gen-wire/backend-profile-service/backend-profile-service.msw.d.ts +16 -0
- package/types/gen-wire/bucket-service/bucket-service.msw.d.ts +14 -0
- package/types/gen-wire/calendar-service/calendar-service.msw.d.ts +16 -0
- package/types/gen-wire/call-service/call-service.msw.d.ts +44 -0
- package/types/gen-wire/case-articles/case-articles.msw.d.ts +12 -0
- package/types/gen-wire/case-comments/case-comments.msw.d.ts +16 -0
- package/types/gen-wire/case-communications/case-communications.msw.d.ts +10 -0
- package/types/gen-wire/case-files/case-files.msw.d.ts +8 -0
- package/types/gen-wire/case-links/case-links.msw.d.ts +16 -0
- package/types/gen-wire/case-timeline/case-timeline.msw.d.ts +10 -0
- package/types/gen-wire/cases/cases.msw.d.ts +22 -0
- package/types/gen-wire/cases-chat-catalog/cases-chat-catalog.msw.d.ts +6 -0
- package/types/gen-wire/catalogs/catalogs.msw.d.ts +16 -0
- package/types/gen-wire/classes/classes.msw.d.ts +12 -0
- package/types/gen-wire/close-reason-groups/close-reason-groups.msw.d.ts +16 -0
- package/types/gen-wire/close-reasons/close-reasons.msw.d.ts +16 -0
- package/types/gen-wire/cognitive-profile-service/cognitive-profile-service.msw.d.ts +18 -0
- package/types/gen-wire/comments/comments.msw.d.ts +12 -0
- package/types/gen-wire/communication-type-service/communication-type-service.msw.d.ts +16 -0
- package/types/gen-wire/config-service/config-service.msw.d.ts +18 -0
- package/types/gen-wire/config-service/config-service.zod.d.ts +4 -4
- package/types/gen-wire/contact-groups/contact-groups.msw.d.ts +20 -0
- package/types/gen-wire/contact-linking-service/contact-linking-service.msw.d.ts +8 -0
- package/types/gen-wire/contacts/contacts.msw.d.ts +16 -0
- package/types/gen-wire/contacts-chat-catalog/contacts-chat-catalog.msw.d.ts +8 -0
- package/types/gen-wire/customer/customer.msw.d.ts +12 -0
- package/types/gen-wire/customers/customers.msw.d.ts +18 -0
- package/types/gen-wire/devices/devices.msw.d.ts +20 -0
- package/types/gen-wire/dictionaries/dictionaries.msw.d.ts +32 -0
- package/types/gen-wire/domains/domains.msw.d.ts +8 -0
- package/types/gen-wire/dynamic-conditions/dynamic-conditions.msw.d.ts +16 -0
- package/types/gen-wire/dynamic-groups/dynamic-groups.msw.d.ts +16 -0
- package/types/gen-wire/email-profile-service/email-profile-service.msw.d.ts +20 -0
- package/types/gen-wire/emails/emails.msw.d.ts +20 -0
- package/types/gen-wire/embedding-models/embedding-models.msw.d.ts +18 -0
- package/types/gen-wire/extensions/extensions.msw.d.ts +16 -0
- package/types/gen-wire/feedback-service/feedback-service.msw.d.ts +8 -0
- package/types/gen-wire/file-policies-service/file-policies-service.msw.d.ts +22 -0
- package/types/gen-wire/file-service/file-service.msw.d.ts +26 -0
- package/types/gen-wire/file-transcript-service/file-transcript-service.msw.d.ts +12 -0
- package/types/gen-wire/forecast-calculation-service/forecast-calculation-service.msw.d.ts +16 -0
- package/types/gen-wire/ftsservice/ftsservice.msw.d.ts +6 -0
- package/types/gen-wire/groups/groups.msw.d.ts +20 -0
- package/types/gen-wire/im-service-provider-v1-telegrambotservice/im-service-provider-v1-telegrambotservice.msw.d.ts +12 -0
- package/types/gen-wire/imclients/imclients.msw.d.ts +10 -0
- package/types/gen-wire/import-template-service/import-template-service.msw.d.ts +16 -0
- package/types/gen-wire/index.d.ts +1 -1
- package/types/gen-wire/index.msw.d.ts +152 -0
- package/types/gen-wire/knowledgebase-search/knowledgebase-search.msw.d.ts +6 -0
- package/types/gen-wire/labels/labels.msw.d.ts +14 -0
- package/types/gen-wire/languages/languages.msw.d.ts +18 -0
- package/types/gen-wire/ldap/ldap.msw.d.ts +46 -0
- package/types/gen-wire/list-service/list-service.msw.d.ts +26 -0
- package/types/gen-wire/logger-service/logger-service.msw.d.ts +12 -0
- package/types/gen-wire/logger-service/logger-service.zod.d.ts +4 -4
- package/types/gen-wire/managers/managers.msw.d.ts +20 -0
- package/types/gen-wire/media-file-service/media-file-service.msw.d.ts +10 -0
- package/types/gen-wire/meeting-service/meeting-service.msw.d.ts +10 -0
- package/types/gen-wire/member-service/member-service.msw.d.ts +54 -0
- package/types/gen-wire/messages/messages.msw.d.ts +16 -0
- package/types/gen-wire/oauth2-federation/oauth2-federation.msw.d.ts +18 -0
- package/types/gen-wire/online-skills/online-skills.msw.d.ts +16 -0
- package/types/gen-wire/outbound-resource-group-service/outbound-resource-group-service.msw.d.ts +24 -0
- package/types/gen-wire/outbound-resource-service/outbound-resource-service.msw.d.ts +30 -0
- package/types/gen-wire/pause-template-service/pause-template-service.msw.d.ts +14 -0
- package/types/gen-wire/pdf-service/pdf-service.msw.d.ts +22 -0
- package/types/gen-wire/permissions/permissions.msw.d.ts +6 -0
- package/types/gen-wire/phones/phones.msw.d.ts +20 -0
- package/types/gen-wire/photos/photos.msw.d.ts +20 -0
- package/types/gen-wire/presence/presence.msw.d.ts +8 -0
- package/types/gen-wire/preset-query-service/preset-query-service.msw.d.ts +16 -0
- package/types/gen-wire/priorities/priorities.msw.d.ts +16 -0
- package/types/gen-wire/queue-bucket-service/queue-bucket-service.msw.d.ts +16 -0
- package/types/gen-wire/queue-hook-service/queue-hook-service.msw.d.ts +16 -0
- package/types/gen-wire/queue-resources-service/queue-resources-service.msw.d.ts +14 -0
- package/types/gen-wire/queue-service/queue-service.msw.d.ts +24 -0
- package/types/gen-wire/queue-skill-service/queue-skill-service.msw.d.ts +16 -0
- package/types/gen-wire/quick-replies-service/quick-replies-service.msw.d.ts +16 -0
- package/types/gen-wire/records/records.msw.d.ts +16 -0
- package/types/gen-wire/region-service/region-service.msw.d.ts +16 -0
- package/types/gen-wire/related-cases/related-cases.msw.d.ts +16 -0
- package/types/gen-wire/retrieval/retrieval.msw.d.ts +14 -0
- package/types/gen-wire/routing-chat-plan-service/routing-chat-plan-service.msw.d.ts +16 -0
- package/types/gen-wire/routing-outbound-call-service/routing-outbound-call-service.msw.d.ts +18 -0
- package/types/gen-wire/routing-schema-service/routing-schema-service.msw.d.ts +18 -0
- package/types/gen-wire/routing-variable-service/routing-variable-service.msw.d.ts +14 -0
- package/types/gen-wire/schema-variables-service/schema-variables-service.msw.d.ts +16 -0
- package/types/gen-wire/services/services.msw.d.ts +16 -0
- package/types/gen-wire/shift-template-service/shift-template-service.msw.d.ts +14 -0
- package/types/gen-wire/skill-service/skill-service.msw.d.ts +22 -0
- package/types/gen-wire/slaconditions/slaconditions.msw.d.ts +16 -0
- package/types/gen-wire/slas/slas.msw.d.ts +16 -0
- package/types/gen-wire/sources/sources.msw.d.ts +16 -0
- package/types/gen-wire/spaces/spaces.msw.d.ts +26 -0
- package/types/gen-wire/status-conditions/status-conditions.msw.d.ts +16 -0
- package/types/gen-wire/statuses/statuses.msw.d.ts +16 -0
- package/types/gen-wire/system-setting-service/system-setting-service.msw.d.ts +18 -0
- package/types/gen-wire/tags/tags.msw.d.ts +8 -0
- package/types/gen-wire/team-chat-tag-service/team-chat-tag-service.msw.d.ts +12 -0
- package/types/gen-wire/team-hook-service/team-hook-service.msw.d.ts +16 -0
- package/types/gen-wire/team-trigger-service/team-trigger-service.msw.d.ts +20 -0
- package/types/gen-wire/timeline/timeline.msw.d.ts +10 -0
- package/types/gen-wire/timezones/timezones.msw.d.ts +20 -0
- package/types/gen-wire/trigger-service/trigger-service.msw.d.ts +20 -0
- package/types/gen-wire/two-factor-authentication/two-factor-authentication.msw.d.ts +8 -0
- package/types/gen-wire/types/types.msw.d.ts +8 -0
- package/types/gen-wire/user-access-tokens/user-access-tokens.msw.d.ts +16 -0
- package/types/gen-wire/user-helper-service/user-helper-service.msw.d.ts +10 -0
- package/types/gen-wire/users/users.msw.d.ts +34 -0
- package/types/gen-wire/variables/variables.msw.d.ts +18 -0
- package/types/gen-wire/versions/versions.msw.d.ts +10 -0
- package/types/gen-wire/web-hook-service/web-hook-service.msw.d.ts +16 -0
- package/types/gen-wire/webitel-im-api-gateway-v1-account/webitel-im-api-gateway-v1-account.msw.d.ts +14 -0
- package/types/gen-wire/webitel-im-api-gateway-v1-bots/webitel-im-api-gateway-v1-bots.msw.d.ts +10 -0
- package/types/gen-wire/webitel-im-api-gateway-v1-contacts/webitel-im-api-gateway-v1-contacts.msw.d.ts +6 -0
- package/types/gen-wire/webitel-im-api-gateway-v1-contactsettingsmanagement/webitel-im-api-gateway-v1-contactsettingsmanagement.msw.d.ts +8 -0
- package/types/gen-wire/webitel-im-api-gateway-v1-message/webitel-im-api-gateway-v1-message.msw.d.ts +32 -0
- package/types/gen-wire/webitel-im-api-gateway-v1-messagehistory/webitel-im-api-gateway-v1-messagehistory.msw.d.ts +12 -0
- package/types/gen-wire/webitel-im-api-gateway-v1-threadmanagement/webitel-im-api-gateway-v1-threadmanagement.msw.d.ts +36 -0
- package/types/gen-wire/webitel-im-api-gateway-v1-threadpermission/webitel-im-api-gateway-v1-threadpermission.msw.d.ts +8 -0
- package/types/gen-wire/webitel-im-api-gateway-v1-threadpreviewservice/webitel-im-api-gateway-v1-threadpreviewservice.msw.d.ts +10 -0
- package/types/gen-wire/webitel-im-api-gateway-v1-threadtagmanagement/webitel-im-api-gateway-v1-threadtagmanagement.msw.d.ts +16 -0
- package/types/gen-wire/webitel-im-api-gateway-v1-updates/webitel-im-api-gateway-v1-updates.msw.d.ts +6 -0
- package/types/gen-wire/webitel-im-api-provider-v1-facebookservice/webitel-im-api-provider-v1-facebookservice.msw.d.ts +18 -0
- package/types/gen-wire/webitel-im-api-provider-v1-instagramservice/webitel-im-api-provider-v1-instagramservice.msw.d.ts +10 -0
- package/types/gen-wire/webitel-im-api-provider-v1-metaappservice/webitel-im-api-provider-v1-metaappservice.msw.d.ts +10 -0
- package/types/gen-wire/webitel-im-api-provider-v1-metaoauthservice/webitel-im-api-provider-v1-metaoauthservice.msw.d.ts +8 -0
- package/types/gen-wire/webitel-im-api-provider-v1-viberbmservice/webitel-im-api-provider-v1-viberbmservice.msw.d.ts +12 -0
- package/types/gen-wire/webitel-im-api-provider-v1-whatsappservice/webitel-im-api-provider-v1-whatsappservice.msw.d.ts +10 -0
- package/types/gen-wire/webitel-im-provider-v1-customservice/webitel-im-provider-v1-customservice.msw.d.ts +12 -0
- package/types/gen-wire/webitel-im-provider-v1-facebookservice/webitel-im-provider-v1-facebookservice.msw.d.ts +20 -0
- package/types/gen-wire/webitel-im-provider-v1-gateservice/webitel-im-provider-v1-gateservice.msw.d.ts +6 -0
- package/types/gen-wire/webitel-im-provider-v1-gatetemplateservice/webitel-im-provider-v1-gatetemplateservice.msw.d.ts +10 -0
- package/types/gen-wire/webitel-im-provider-v1-instagramservice/webitel-im-provider-v1-instagramservice.msw.d.ts +12 -0
- package/types/gen-wire/webitel-im-provider-v1-metaappservice/webitel-im-provider-v1-metaappservice.msw.d.ts +12 -0
- package/types/gen-wire/webitel-im-provider-v1-metaoauthservice/webitel-im-provider-v1-metaoauthservice.msw.d.ts +8 -0
- package/types/gen-wire/webitel-im-provider-v1-providermessageservice/webitel-im-provider-v1-providermessageservice.msw.d.ts +22 -0
- package/types/gen-wire/webitel-im-provider-v1-viberbmservice/webitel-im-provider-v1-viberbmservice.msw.d.ts +16 -0
- package/types/gen-wire/webitel-im-provider-v1-viberservice/webitel-im-provider-v1-viberservice.msw.d.ts +12 -0
- package/types/gen-wire/webitel-im-provider-v1-whatsappservice/webitel-im-provider-v1-whatsappservice.msw.d.ts +12 -0
- package/types/gen-wire/working-condition-service/working-condition-service.msw.d.ts +14 -0
- package/types/gen-wire/working-schedule-service/working-schedule-service.msw.d.ts +20 -0
- package/types/scripts/applicationsAccess/ApplicationsAccess.d.ts +45 -0
- package/types/scripts/convertDuration/convertDurationWithMilliseconds.d.ts +6 -0
- package/types/scripts/index.d.ts +6 -1
- package/types/scripts/resolveGrants/resolveGrants.d.ts +11 -0
- package/types/validations/changelog/changelog.validations.d.ts +15 -0
- package/types/validations/emailProfile/emailProfile.validations.d.ts +36 -0
- package/types/validations/importTemplate/importTemplate.validations.d.ts +62 -0
- package/types/validations/index.d.ts +7 -0
- package/types/validations/role/role.validations.d.ts +34 -0
- package/types/validations/schemaVariable/schemaVariable.validations.d.ts +18 -0
- package/types/validations/storagePolicy/storagePolicy.validations.d.ts +26 -0
- package/types/validations/trigger/trigger.validations.d.ts +38 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EngineEmailAuthType,
|
|
3
|
+
type EngineEmailProfile,
|
|
4
|
+
} from '@webitel/api-services/gen/models';
|
|
5
|
+
import { get } from 'lodash-es';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
|
|
8
|
+
import { clearableNumberSchema } from '../_shared/clearableNumber.validations';
|
|
9
|
+
import { i18nIssue } from '../_shared/i18nIssue';
|
|
10
|
+
import { isFilled } from '../_shared/isFilled';
|
|
11
|
+
import { filledLookupSchema } from '../_shared/lookup.validations';
|
|
12
|
+
import type { ZodShape } from '../types';
|
|
13
|
+
|
|
14
|
+
/** [Claude] the highest tcp port, the limit of the imap and smtp port fields */
|
|
15
|
+
export const EMAIL_PROFILE_MAX_PORT = 65535;
|
|
16
|
+
|
|
17
|
+
const oauth2Fields = [
|
|
18
|
+
'clientId',
|
|
19
|
+
'clientSecret',
|
|
20
|
+
'redirectUrl',
|
|
21
|
+
] as const;
|
|
22
|
+
|
|
23
|
+
const oauth2Schema = z
|
|
24
|
+
.object({
|
|
25
|
+
clientId: z.string().optional().default(''),
|
|
26
|
+
clientSecret: z.string().optional().default(''),
|
|
27
|
+
redirectUrl: z.string().optional().default(''),
|
|
28
|
+
})
|
|
29
|
+
.passthrough();
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* [Claude] Email profile card schema.
|
|
33
|
+
*
|
|
34
|
+
* Plain auth signs in with a password, oauth2 with the app's client settings.
|
|
35
|
+
* The password is required only when creating: an empty one on update means
|
|
36
|
+
* "keep the current one".
|
|
37
|
+
*/
|
|
38
|
+
export const emailProfileSchema = z
|
|
39
|
+
.object<ZodShape<EngineEmailProfile>>({
|
|
40
|
+
id: z.string().optional(),
|
|
41
|
+
name: z.string().min(1).default(''),
|
|
42
|
+
description: z.string().optional().default(''),
|
|
43
|
+
enabled: z.boolean().default(true),
|
|
44
|
+
mailbox: z.string().min(1).default(''),
|
|
45
|
+
imapHost: z.string().min(1).default(''),
|
|
46
|
+
imapPort: clearableNumberSchema.default(993),
|
|
47
|
+
smtpHost: z.string().min(1).default(''),
|
|
48
|
+
smtpPort: clearableNumberSchema.default(587),
|
|
49
|
+
// [Claude] `.prefault`, not `.default`: zod 4's `.default({})` would skip the required check
|
|
50
|
+
schema: filledLookupSchema.prefault({}),
|
|
51
|
+
fetchInterval: clearableNumberSchema.default(60),
|
|
52
|
+
listen: z.boolean().default(false),
|
|
53
|
+
logged: z.boolean().default(false),
|
|
54
|
+
authType: z.string().min(1).default(EngineEmailAuthType.Plain),
|
|
55
|
+
login: z.string().min(1).default(''),
|
|
56
|
+
password: z.string().optional().default(''),
|
|
57
|
+
params: z
|
|
58
|
+
.object({
|
|
59
|
+
oauth2: oauth2Schema.prefault({}),
|
|
60
|
+
})
|
|
61
|
+
.passthrough()
|
|
62
|
+
.prefault({}),
|
|
63
|
+
})
|
|
64
|
+
.passthrough()
|
|
65
|
+
.superRefine((profile, ctx) => {
|
|
66
|
+
const requireField = (path: string) => {
|
|
67
|
+
if (isFilled(get(profile, path))) return;
|
|
68
|
+
ctx.addIssue({
|
|
69
|
+
code: 'custom',
|
|
70
|
+
path: path.split('.'),
|
|
71
|
+
...i18nIssue('required'),
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
requireField('fetchInterval');
|
|
76
|
+
|
|
77
|
+
for (const path of [
|
|
78
|
+
'imapPort',
|
|
79
|
+
'smtpPort',
|
|
80
|
+
]) {
|
|
81
|
+
requireField(path);
|
|
82
|
+
const port = get(profile, path);
|
|
83
|
+
if (
|
|
84
|
+
typeof port === 'number' &&
|
|
85
|
+
(port < 0 || port > EMAIL_PROFILE_MAX_PORT)
|
|
86
|
+
) {
|
|
87
|
+
ctx.addIssue({
|
|
88
|
+
code: port < 0 ? 'too_small' : 'too_big',
|
|
89
|
+
origin: 'number',
|
|
90
|
+
...(port < 0
|
|
91
|
+
? {
|
|
92
|
+
minimum: 0,
|
|
93
|
+
}
|
|
94
|
+
: {
|
|
95
|
+
maximum: EMAIL_PROFILE_MAX_PORT,
|
|
96
|
+
}),
|
|
97
|
+
inclusive: true,
|
|
98
|
+
input: port,
|
|
99
|
+
path: [
|
|
100
|
+
path,
|
|
101
|
+
],
|
|
102
|
+
} as Parameters<typeof ctx.addIssue>[0]);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (profile.authType === EngineEmailAuthType.OAuth2) {
|
|
107
|
+
for (const field of oauth2Fields) {
|
|
108
|
+
requireField(`params.oauth2.${field}`);
|
|
109
|
+
}
|
|
110
|
+
} else if (!profile.id) {
|
|
111
|
+
requireField('password');
|
|
112
|
+
}
|
|
113
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { StorageImportSourceType } 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 {
|
|
6
|
+
type ImportTemplateCard,
|
|
7
|
+
importTemplateSchema,
|
|
8
|
+
} from '../importTemplate.validations';
|
|
9
|
+
|
|
10
|
+
const issuePaths = (
|
|
11
|
+
result: ReturnType<typeof importTemplateSchema.safeParse>,
|
|
12
|
+
) => result.error?.issues.map(({ path }) => path.join('.')) ?? [];
|
|
13
|
+
|
|
14
|
+
const defaults = () => getDefaultsFromZodSchema(importTemplateSchema, {});
|
|
15
|
+
|
|
16
|
+
describe('importTemplateSchema', () => {
|
|
17
|
+
it('seeds a new template as a utf-8, comma-separated dialer import', () => {
|
|
18
|
+
expect(defaults()).toMatchObject({
|
|
19
|
+
name: '',
|
|
20
|
+
sourceType: StorageImportSourceType.Dialer,
|
|
21
|
+
parameters: {
|
|
22
|
+
charset: {
|
|
23
|
+
value: 'utf-8',
|
|
24
|
+
},
|
|
25
|
+
separator: ',',
|
|
26
|
+
skipHeaders: true,
|
|
27
|
+
clearMembers: false,
|
|
28
|
+
mappings: {
|
|
29
|
+
name: '',
|
|
30
|
+
destination: [],
|
|
31
|
+
code: [],
|
|
32
|
+
variables: [],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('requires name, source, separator and the name, destination and code columns', () => {
|
|
39
|
+
const template = defaults() as ImportTemplateCard;
|
|
40
|
+
template.parameters.separator = '';
|
|
41
|
+
|
|
42
|
+
expect(issuePaths(importTemplateSchema.safeParse(template))).toEqual(
|
|
43
|
+
expect.arrayContaining([
|
|
44
|
+
'name',
|
|
45
|
+
'source.id',
|
|
46
|
+
'parameters.separator',
|
|
47
|
+
'parameters.mappings.name',
|
|
48
|
+
'parameters.mappings.destination',
|
|
49
|
+
'parameters.mappings.code',
|
|
50
|
+
]),
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('accepts a filled template', () => {
|
|
55
|
+
const result = importTemplateSchema.safeParse({
|
|
56
|
+
...(defaults() as object),
|
|
57
|
+
name: 'import',
|
|
58
|
+
source: {
|
|
59
|
+
id: 1,
|
|
60
|
+
name: 'queue',
|
|
61
|
+
},
|
|
62
|
+
parameters: {
|
|
63
|
+
mappings: {
|
|
64
|
+
name: 'Name',
|
|
65
|
+
destination: [
|
|
66
|
+
'Phone',
|
|
67
|
+
],
|
|
68
|
+
code: [
|
|
69
|
+
'Type',
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
expect(result.success).toBe(true);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
StorageImportSourceType,
|
|
3
|
+
type StorageImportTemplate,
|
|
4
|
+
} from '@webitel/api-services/gen/models';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
|
|
7
|
+
import { filledLookupSchema } from '../_shared/lookup.validations';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* [Claude] CSV column names for each dialer member field: a single column for
|
|
11
|
+
* a plain field, a list of columns for a multi-value one.
|
|
12
|
+
*/
|
|
13
|
+
const importTemplateMappingsSchema = z.object({
|
|
14
|
+
name: z.string().min(1).default(''),
|
|
15
|
+
timezoneId: z.string().optional().default(''),
|
|
16
|
+
priority: z.string().optional().default(''),
|
|
17
|
+
expireAt: z.string().optional().default(''),
|
|
18
|
+
bucketId: z.string().optional().default(''),
|
|
19
|
+
agentId: z.string().optional().default(''),
|
|
20
|
+
variables: z.array(z.string()).default([]),
|
|
21
|
+
destination: z.array(z.string()).min(1).default([]),
|
|
22
|
+
commPriority: z.array(z.string()).default([]),
|
|
23
|
+
code: z.array(z.string()).min(1).default([]),
|
|
24
|
+
description: z.array(z.string()).default([]),
|
|
25
|
+
dtmf: z.array(z.string()).default([]),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const importTemplateParametersSchema = z.object({
|
|
29
|
+
charset: z
|
|
30
|
+
.object({
|
|
31
|
+
name: z.string(),
|
|
32
|
+
value: z.string(),
|
|
33
|
+
})
|
|
34
|
+
.default({
|
|
35
|
+
name: 'UTF-8',
|
|
36
|
+
value: 'utf-8',
|
|
37
|
+
}),
|
|
38
|
+
separator: z.string().min(1).default(','),
|
|
39
|
+
skipHeaders: z.boolean().default(true),
|
|
40
|
+
clearMembers: z.boolean().default(false),
|
|
41
|
+
// [Claude] `.prefault`, not `.default`: zod 4's `.default({})` would skip the nested defaults
|
|
42
|
+
mappings: importTemplateMappingsSchema.prefault({}),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export type ImportTemplateCard = Omit<StorageImportTemplate, 'parameters'> & {
|
|
46
|
+
parameters?: z.infer<typeof importTemplateParametersSchema>;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const importTemplateSchema = z.object({
|
|
50
|
+
id: z.number().optional(),
|
|
51
|
+
name: z.string().min(1).default(''),
|
|
52
|
+
description: z.string().optional().default(''),
|
|
53
|
+
source: filledLookupSchema.prefault({}),
|
|
54
|
+
sourceType: z.string().default(StorageImportSourceType.Dialer),
|
|
55
|
+
parameters: importTemplateParametersSchema.prefault({}),
|
|
56
|
+
});
|
package/src/validations/index.ts
CHANGED
|
@@ -29,6 +29,7 @@ export * from './caseServiceCatalog/caseServiceCatalog.validations';
|
|
|
29
29
|
export * from './caseSource/caseSource.validations';
|
|
30
30
|
export * from './caseStatus/caseStatus.validations';
|
|
31
31
|
export * from './caseStatusCondition/caseStatusCondition.validations';
|
|
32
|
+
export * from './changelog/changelog.validations';
|
|
32
33
|
export * from './chatGateway/chatGateway.validations';
|
|
33
34
|
export * from './chatplan/chatplan.validations';
|
|
34
35
|
export * from './cognitiveProfile/cognitiveProfile.validations';
|
|
@@ -40,8 +41,10 @@ export * from './contactGroupCondition/contactGroupCondition.validations';
|
|
|
40
41
|
export * from './contactPhone/contactPhone.validations';
|
|
41
42
|
export * from './device/device.validations';
|
|
42
43
|
export * from './dialplan/dialplan.validations';
|
|
44
|
+
export * from './emailProfile/emailProfile.validations';
|
|
43
45
|
export * from './flow/flow.validations';
|
|
44
46
|
export * from './gateway/gateway.validations';
|
|
47
|
+
export * from './importTemplate/importTemplate.validations';
|
|
45
48
|
export * from './license/licenseImport.validations';
|
|
46
49
|
export * from './OAuth/OAuth.validations';
|
|
47
50
|
export * from './onlineSkill/onlineSkill.validations';
|
|
@@ -63,15 +66,19 @@ export * from './resource/resource.validations';
|
|
|
63
66
|
export * from './resourceDisplay/resourceDisplay.validations';
|
|
64
67
|
export * from './resourceGroup/resourceGroup.validations';
|
|
65
68
|
export * from './resourceInGroup/resourceInGroup.validations';
|
|
69
|
+
export * from './role/role.validations';
|
|
70
|
+
export * from './schemaVariable/schemaVariable.validations';
|
|
66
71
|
export * from './shiftTemplate/shiftTemplate.validations';
|
|
67
72
|
export * from './skill/skill.validations';
|
|
68
73
|
export * from './sla/sla.validations';
|
|
69
74
|
export * from './slaCondition/slaCondition.validations';
|
|
75
|
+
export * from './storagePolicy/storagePolicy.validations';
|
|
70
76
|
export * from './team/team.validations';
|
|
71
77
|
export * from './teamAgent/teamAgent.validations';
|
|
72
78
|
export * from './teamFlow/teamFlow.validations';
|
|
73
79
|
export * from './teamHook/teamHook.validations';
|
|
74
80
|
export * from './textToSpeech/textToSpeech.validations';
|
|
81
|
+
export * from './trigger/trigger.validations';
|
|
75
82
|
export * from './typeExtension/typeExtension.validations';
|
|
76
83
|
export * from './types';
|
|
77
84
|
export * from './user/user.validations';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { getDefaultsFromZodSchema } from '@webitel/api-services/gen/utils';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { WtApplication } from '../../../enums';
|
|
5
|
+
|
|
6
|
+
import { roleSchema } from '../role.validations';
|
|
7
|
+
|
|
8
|
+
const issuePaths = (result: ReturnType<typeof roleSchema.safeParse>) =>
|
|
9
|
+
result.error?.issues.map(({ path }) => path.join('.')) ?? [];
|
|
10
|
+
|
|
11
|
+
const defaults = () => getDefaultsFromZodSchema(roleSchema, {});
|
|
12
|
+
|
|
13
|
+
describe('roleSchema', () => {
|
|
14
|
+
it('seeds a new role without permissions and with every app allowed', () => {
|
|
15
|
+
expect(defaults()).toMatchObject({
|
|
16
|
+
name: '',
|
|
17
|
+
description: '',
|
|
18
|
+
permissions: [],
|
|
19
|
+
metadata: {
|
|
20
|
+
access: {
|
|
21
|
+
[WtApplication.Admin]: {
|
|
22
|
+
_enabled: true,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('requires the name', () => {
|
|
30
|
+
expect(issuePaths(roleSchema.safeParse(defaults()))).toEqual([
|
|
31
|
+
'name',
|
|
32
|
+
]);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('keeps the access tree as is', () => {
|
|
36
|
+
const access = {
|
|
37
|
+
admin: {
|
|
38
|
+
_enabled: true,
|
|
39
|
+
users: {
|
|
40
|
+
_enabled: false,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
const result = roleSchema.safeParse({
|
|
45
|
+
name: 'role',
|
|
46
|
+
metadata: {
|
|
47
|
+
access,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
expect(result.data?.metadata.access).toEqual(access);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
import { ApplicationsAccess } from '../../scripts';
|
|
4
|
+
|
|
5
|
+
/** [Claude] a global action granted to the role, e.g. `playback_record_file` */
|
|
6
|
+
const rolePermissionSchema = z.looseObject({
|
|
7
|
+
id: z.string(),
|
|
8
|
+
name: z.string().optional(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* [Claude] The role's access to each app and its sections, as the tree built
|
|
13
|
+
* by `ApplicationsAccess`; a new role starts with everything allowed.
|
|
14
|
+
*/
|
|
15
|
+
const roleMetadataSchema = z.looseObject({
|
|
16
|
+
access: z
|
|
17
|
+
.record(z.string(), z.unknown())
|
|
18
|
+
.default(() => new ApplicationsAccess().getAccess()),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type RolePermission = z.infer<typeof rolePermissionSchema>;
|
|
22
|
+
|
|
23
|
+
export type RoleCard = {
|
|
24
|
+
id?: string | number;
|
|
25
|
+
name?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
permissions?: RolePermission[];
|
|
28
|
+
metadata?: z.infer<typeof roleMetadataSchema>;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const roleSchema = z.object({
|
|
32
|
+
id: z
|
|
33
|
+
.union([
|
|
34
|
+
z.string(),
|
|
35
|
+
z.number(),
|
|
36
|
+
])
|
|
37
|
+
.optional(),
|
|
38
|
+
name: z.string().min(1).default(''),
|
|
39
|
+
description: z.string().optional().default(''),
|
|
40
|
+
permissions: z.array(rolePermissionSchema).default([]),
|
|
41
|
+
metadata: roleMetadataSchema.prefault({}),
|
|
42
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { getDefaultsFromZodSchema } from '@webitel/api-services/gen/utils';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { schemaVariableSchema } from '../schemaVariable.validations';
|
|
5
|
+
|
|
6
|
+
const issuePaths = (
|
|
7
|
+
result: ReturnType<typeof schemaVariableSchema.safeParse>,
|
|
8
|
+
) => result.error?.issues.map(({ path }) => path.join('.')) ?? [];
|
|
9
|
+
|
|
10
|
+
const defaults = () => getDefaultsFromZodSchema(schemaVariableSchema, {});
|
|
11
|
+
|
|
12
|
+
describe('schemaVariableSchema', () => {
|
|
13
|
+
it('seeds a new variable as plain', () => {
|
|
14
|
+
expect(defaults()).toMatchObject({
|
|
15
|
+
name: '',
|
|
16
|
+
value: '',
|
|
17
|
+
encrypt: false,
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('requires name and value of a new variable', () => {
|
|
22
|
+
expect(issuePaths(schemaVariableSchema.safeParse(defaults()))).toEqual(
|
|
23
|
+
expect.arrayContaining([
|
|
24
|
+
'name',
|
|
25
|
+
'value',
|
|
26
|
+
]),
|
|
27
|
+
);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('requires the value of a new variable even when it is encrypted', () => {
|
|
31
|
+
const result = schemaVariableSchema.safeParse({
|
|
32
|
+
name: 'key',
|
|
33
|
+
encrypt: true,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
expect(issuePaths(result)).toEqual([
|
|
37
|
+
'value',
|
|
38
|
+
]);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('keeps the value of a saved encrypted variable when it is left empty', () => {
|
|
42
|
+
const result = schemaVariableSchema.safeParse({
|
|
43
|
+
id: 1,
|
|
44
|
+
name: 'key',
|
|
45
|
+
encrypt: true,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
expect(result.success).toBe(true);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { EngineSchemaVariable } from '@webitel/api-services/gen/models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
import { i18nIssue } from '../_shared/i18nIssue';
|
|
5
|
+
import { isFilled } from '../_shared/isFilled';
|
|
6
|
+
|
|
7
|
+
/** [Claude] the form edits `value` as text, the generated model leaves it untyped */
|
|
8
|
+
export type SchemaVariableCard = Omit<EngineSchemaVariable, 'value'> & {
|
|
9
|
+
value?: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* [Claude] Global variable card schema.
|
|
14
|
+
*
|
|
15
|
+
* An encrypted variable is never read back, so a saved one keeps its value
|
|
16
|
+
* when the field is left empty; a new or a plain one needs it.
|
|
17
|
+
*/
|
|
18
|
+
export const schemaVariableSchema = z
|
|
19
|
+
.object({
|
|
20
|
+
id: z.number().optional(),
|
|
21
|
+
name: z.string().min(1).default(''),
|
|
22
|
+
value: z.string().optional().default(''),
|
|
23
|
+
encrypt: z.boolean().default(false),
|
|
24
|
+
})
|
|
25
|
+
.superRefine((variable, ctx) => {
|
|
26
|
+
if (variable.id && variable.encrypt) return;
|
|
27
|
+
if (isFilled(variable.value)) return;
|
|
28
|
+
ctx.addIssue({
|
|
29
|
+
code: 'custom',
|
|
30
|
+
path: [
|
|
31
|
+
'value',
|
|
32
|
+
],
|
|
33
|
+
...i18nIssue('required'),
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { StorageUploadFileChannel } 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 { storagePolicySchema } from '../storagePolicy.validations';
|
|
6
|
+
|
|
7
|
+
const issuePaths = (result: ReturnType<typeof storagePolicySchema.safeParse>) =>
|
|
8
|
+
result.error?.issues.map(({ path }) => path.join('.')) ?? [];
|
|
9
|
+
|
|
10
|
+
const defaults = () => getDefaultsFromZodSchema(storagePolicySchema, {});
|
|
11
|
+
|
|
12
|
+
describe('storagePolicySchema', () => {
|
|
13
|
+
it('seeds a new policy as enabled and not encrypted', () => {
|
|
14
|
+
expect(defaults()).toMatchObject({
|
|
15
|
+
name: '',
|
|
16
|
+
enabled: true,
|
|
17
|
+
encrypt: false,
|
|
18
|
+
channels: [],
|
|
19
|
+
mimeTypes: [],
|
|
20
|
+
retentionDays: 0,
|
|
21
|
+
speedDownload: 0,
|
|
22
|
+
speedUpload: 0,
|
|
23
|
+
maxUploadSize: 0,
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('requires name, channels and mime types', () => {
|
|
28
|
+
expect(issuePaths(storagePolicySchema.safeParse(defaults()))).toEqual([
|
|
29
|
+
'name',
|
|
30
|
+
'channels',
|
|
31
|
+
'mimeTypes',
|
|
32
|
+
]);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('accepts the int64 strings the api returns for speeds and size', () => {
|
|
36
|
+
const result = storagePolicySchema.safeParse({
|
|
37
|
+
...defaults(),
|
|
38
|
+
name: 'policy',
|
|
39
|
+
channels: [
|
|
40
|
+
StorageUploadFileChannel.CallChannel,
|
|
41
|
+
],
|
|
42
|
+
mimeTypes: [
|
|
43
|
+
'audio/mpeg',
|
|
44
|
+
],
|
|
45
|
+
speedDownload: '100',
|
|
46
|
+
speedUpload: '200',
|
|
47
|
+
maxUploadSize: '300',
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
expect(result.success).toBe(true);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { StorageFilePolicy } from '@webitel/api-services/gen/models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
import type { ZodShape } from '../types';
|
|
5
|
+
|
|
6
|
+
/** [Claude] the api keeps speeds and the upload size as int64 strings, the form edits them as numbers */
|
|
7
|
+
export type StoragePolicyCard = Omit<
|
|
8
|
+
StorageFilePolicy,
|
|
9
|
+
'speedDownload' | 'speedUpload' | 'maxUploadSize'
|
|
10
|
+
> & {
|
|
11
|
+
speedDownload?: string | number;
|
|
12
|
+
speedUpload?: string | number;
|
|
13
|
+
maxUploadSize?: string | number;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const sizeSchema = z
|
|
17
|
+
.union([
|
|
18
|
+
z.string(),
|
|
19
|
+
z.number(),
|
|
20
|
+
])
|
|
21
|
+
.optional()
|
|
22
|
+
.default(0);
|
|
23
|
+
|
|
24
|
+
export const storagePolicySchema = z.object<ZodShape<StorageFilePolicy>>({
|
|
25
|
+
id: z.number().optional(),
|
|
26
|
+
name: z.string().min(1).default(''),
|
|
27
|
+
description: z.string().optional().default(''),
|
|
28
|
+
enabled: z.boolean().default(true),
|
|
29
|
+
encrypt: z.boolean().default(false),
|
|
30
|
+
channels: z.array(z.string()).min(1).default([]),
|
|
31
|
+
mimeTypes: z.array(z.string()).min(1).default([]),
|
|
32
|
+
retentionDays: z.number().min(0).optional().default(0),
|
|
33
|
+
speedDownload: sizeSchema,
|
|
34
|
+
speedUpload: sizeSchema,
|
|
35
|
+
maxUploadSize: sizeSchema,
|
|
36
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EngineTriggerEventType,
|
|
3
|
+
EngineTriggerObjectType,
|
|
4
|
+
EngineTriggerType,
|
|
5
|
+
} from '@webitel/api-services/gen/models';
|
|
6
|
+
import { getDefaultsFromZodSchema } from '@webitel/api-services/gen/utils';
|
|
7
|
+
import { describe, expect, it } from 'vitest';
|
|
8
|
+
|
|
9
|
+
import { triggerSchema } from '../trigger.validations';
|
|
10
|
+
|
|
11
|
+
const issuePaths = (result: ReturnType<typeof triggerSchema.safeParse>) =>
|
|
12
|
+
result.error?.issues.map(({ path }) => path.join('.')) ?? [];
|
|
13
|
+
|
|
14
|
+
const defaults = () => getDefaultsFromZodSchema(triggerSchema, {});
|
|
15
|
+
|
|
16
|
+
const named = {
|
|
17
|
+
name: 'trigger',
|
|
18
|
+
schema: {
|
|
19
|
+
id: '1',
|
|
20
|
+
name: 'flow',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
describe('triggerSchema', () => {
|
|
25
|
+
it('seeds a new trigger as an hourly cron', () => {
|
|
26
|
+
expect(defaults()).toMatchObject({
|
|
27
|
+
name: '',
|
|
28
|
+
enabled: true,
|
|
29
|
+
type: EngineTriggerType.Cron,
|
|
30
|
+
timeout: 60,
|
|
31
|
+
variables: [],
|
|
32
|
+
expression: '0 */1 12 * * *',
|
|
33
|
+
object: EngineTriggerObjectType.Cases,
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('requires name, flow and the timezone of a cron trigger', () => {
|
|
38
|
+
expect(issuePaths(triggerSchema.safeParse(defaults()))).toEqual(
|
|
39
|
+
expect.arrayContaining([
|
|
40
|
+
'name',
|
|
41
|
+
'schema.id',
|
|
42
|
+
'timezone.id',
|
|
43
|
+
]),
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('requires the object and the event of an event trigger, not the cron settings', () => {
|
|
48
|
+
const paths = issuePaths(
|
|
49
|
+
triggerSchema.safeParse({
|
|
50
|
+
...defaults(),
|
|
51
|
+
...named,
|
|
52
|
+
type: EngineTriggerType.Event,
|
|
53
|
+
object: '',
|
|
54
|
+
}),
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
expect(paths).toEqual([
|
|
58
|
+
'object',
|
|
59
|
+
'event',
|
|
60
|
+
]);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('accepts a filled event trigger and an emptied timeout', () => {
|
|
64
|
+
const result = triggerSchema.safeParse({
|
|
65
|
+
...defaults(),
|
|
66
|
+
...named,
|
|
67
|
+
type: EngineTriggerType.Event,
|
|
68
|
+
event: EngineTriggerEventType.Create,
|
|
69
|
+
timeout: null,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
expect(result.success).toBe(true);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('rejects a negative timeout', () => {
|
|
76
|
+
expect(
|
|
77
|
+
issuePaths(
|
|
78
|
+
triggerSchema.safeParse({
|
|
79
|
+
...defaults(),
|
|
80
|
+
...named,
|
|
81
|
+
timezone: {
|
|
82
|
+
id: 1,
|
|
83
|
+
name: 'UTC',
|
|
84
|
+
},
|
|
85
|
+
timeout: -1,
|
|
86
|
+
}),
|
|
87
|
+
),
|
|
88
|
+
).toEqual([
|
|
89
|
+
'timeout',
|
|
90
|
+
]);
|
|
91
|
+
});
|
|
92
|
+
});
|