@webitel/api-services 26.12.22 → 26.12.23

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 (27) hide show
  1. package/package.json +1 -1
  2. package/src/api/clients/emailProfiles/emailProfiles.ts +6 -19
  3. package/src/api/clients/importTemplates/importTemplates.ts +36 -21
  4. package/src/api/clients/storagePolicies/storagePolicies.ts +24 -36
  5. package/src/api/clients/triggers/triggerJobs.ts +22 -12
  6. package/src/api/clients/triggers/triggers.ts +12 -37
  7. package/src/scripts/convertDuration/__tests__/convertDurationWithMilliseconds.spec.ts +19 -0
  8. package/src/scripts/convertDuration/convertDurationWithMilliseconds.ts +18 -0
  9. package/src/scripts/index.ts +2 -0
  10. package/src/validations/emailProfile/__tests__/emailProfile.validations.spec.ts +105 -0
  11. package/src/validations/emailProfile/emailProfile.validations.ts +113 -0
  12. package/src/validations/importTemplate/__tests__/importTemplate.validations.spec.ts +77 -0
  13. package/src/validations/importTemplate/importTemplate.validations.ts +56 -0
  14. package/src/validations/index.ts +4 -0
  15. package/src/validations/storagePolicy/__tests__/storagePolicy.validations.spec.ts +52 -0
  16. package/src/validations/storagePolicy/storagePolicy.validations.ts +36 -0
  17. package/src/validations/trigger/__tests__/trigger.validations.spec.ts +92 -0
  18. package/src/validations/trigger/trigger.validations.ts +82 -0
  19. package/types/.tsbuildinfo +1 -1
  20. package/types/api/clients/importTemplates/importTemplates.d.ts +2 -2
  21. package/types/scripts/convertDuration/convertDurationWithMilliseconds.d.ts +6 -0
  22. package/types/scripts/index.d.ts +2 -1
  23. package/types/validations/emailProfile/emailProfile.validations.d.ts +36 -0
  24. package/types/validations/importTemplate/importTemplate.validations.d.ts +62 -0
  25. package/types/validations/index.d.ts +4 -0
  26. package/types/validations/storagePolicy/storagePolicy.validations.d.ts +26 -0
  27. package/types/validations/trigger/trigger.validations.d.ts +38 -0
@@ -1,5 +1,5 @@
1
1
  import type { AddItemParams, ApiParams, DeleteItemParams, GetItemParams, PatchItemParams, UpdateItemParams } from '../_shared/types';
2
- declare const getImportTemplatesList: (params: ApiParams) => Promise<{
2
+ declare const searchImportTemplates: (params: ApiParams) => Promise<{
3
3
  items: any;
4
4
  next: any;
5
5
  }>;
@@ -20,7 +20,7 @@ export declare const ImportTemplatesAPI: {
20
20
  patch: ({ changes, id }: PatchItemParams) => Promise<any>;
21
21
  update: ({ itemInstance, itemId: id, }: UpdateItemParams) => Promise<any>;
22
22
  delete: ({ id }: DeleteItemParams) => Promise<any>;
23
- getLookup: (params: Parameters<typeof getImportTemplatesList>[0]) => Promise<{
23
+ getLookup: (params: Parameters<typeof searchImportTemplates>[0]) => Promise<{
24
24
  items: any;
25
25
  next: any;
26
26
  }>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * [Claude] A duration given in milliseconds, as `HH:MM:SS.mmm`. A missing or
3
+ * invalid one (e.g. a run that has not stopped yet) shows as zero.
4
+ */
5
+ declare const convertDurationWithMilliseconds: (duration?: number) => string;
6
+ export default convertDurationWithMilliseconds;
@@ -1,7 +1,8 @@
1
1
  import convertDuration from './convertDuration/convertDuration';
2
+ import convertDurationWithMilliseconds from './convertDuration/convertDurationWithMilliseconds';
2
3
  import { minToSec, secToMin } from './convertTimeUnits/convertTimeUnits';
3
4
  import downloadFile from './downloadFile/downloadFile';
4
5
  import { FileFormat } from './downloadFile/types/fileFormat.types';
5
6
  import { isRelativeDatetimeValue, normalizeDatetimeRange, normalizeToTimestamp } from './normalizeDatetime/normalizeDatetime';
6
7
  export type { DatetimeRangeValue, NormalizeDatetimeOptions, NormalizeDatetimeValueParam, RelativeDatetimeRoundOption, } from './normalizeDatetime/normalizeDatetime';
7
- export { convertDuration, downloadFile, FileFormat, isRelativeDatetimeValue, minToSec, normalizeDatetimeRange, normalizeToTimestamp, secToMin, };
8
+ export { convertDuration, convertDurationWithMilliseconds, downloadFile, FileFormat, isRelativeDatetimeValue, minToSec, normalizeDatetimeRange, normalizeToTimestamp, secToMin, };
@@ -0,0 +1,36 @@
1
+ import { z } from 'zod';
2
+ /** [Claude] the highest tcp port, the limit of the imap and smtp port fields */
3
+ export declare const EMAIL_PROFILE_MAX_PORT = 65535;
4
+ /**
5
+ * [Claude] Email profile card schema.
6
+ *
7
+ * Plain auth signs in with a password, oauth2 with the app's client settings.
8
+ * The password is required only when creating: an empty one on update means
9
+ * "keep the current one".
10
+ */
11
+ export declare const emailProfileSchema: z.ZodObject<{
12
+ activityAt?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
13
+ authType?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
14
+ createdAt?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
15
+ createdBy?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
16
+ description?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
17
+ enabled?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
18
+ fetchError?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
19
+ fetchInterval?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
20
+ id?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
21
+ imapHost?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
22
+ imapPort?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
23
+ listen?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
24
+ logged?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
25
+ login?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
26
+ mailbox?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
27
+ name?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
28
+ params?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
29
+ password?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
30
+ schema?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
31
+ smtpHost?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
32
+ smtpPort?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
33
+ state?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
34
+ updatedAt?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
35
+ updatedBy?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
36
+ }, z.core.$loose>;
@@ -0,0 +1,62 @@
1
+ import { type StorageImportTemplate } from '@webitel/api-services/gen/models';
2
+ import { z } from 'zod';
3
+ declare const importTemplateParametersSchema: z.ZodObject<{
4
+ charset: z.ZodDefault<z.ZodObject<{
5
+ name: z.ZodString;
6
+ value: z.ZodString;
7
+ }, z.core.$strip>>;
8
+ separator: z.ZodDefault<z.ZodString>;
9
+ skipHeaders: z.ZodDefault<z.ZodBoolean>;
10
+ clearMembers: z.ZodDefault<z.ZodBoolean>;
11
+ mappings: z.ZodPrefault<z.ZodObject<{
12
+ name: z.ZodDefault<z.ZodString>;
13
+ timezoneId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
14
+ priority: z.ZodDefault<z.ZodOptional<z.ZodString>>;
15
+ expireAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
16
+ bucketId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
17
+ agentId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
18
+ variables: z.ZodDefault<z.ZodArray<z.ZodString>>;
19
+ destination: z.ZodDefault<z.ZodArray<z.ZodString>>;
20
+ commPriority: z.ZodDefault<z.ZodArray<z.ZodString>>;
21
+ code: z.ZodDefault<z.ZodArray<z.ZodString>>;
22
+ description: z.ZodDefault<z.ZodArray<z.ZodString>>;
23
+ dtmf: z.ZodDefault<z.ZodArray<z.ZodString>>;
24
+ }, z.core.$strip>>;
25
+ }, z.core.$strip>;
26
+ export type ImportTemplateCard = Omit<StorageImportTemplate, 'parameters'> & {
27
+ parameters?: z.infer<typeof importTemplateParametersSchema>;
28
+ };
29
+ export declare const importTemplateSchema: z.ZodObject<{
30
+ id: z.ZodOptional<z.ZodNumber>;
31
+ name: z.ZodDefault<z.ZodString>;
32
+ description: z.ZodDefault<z.ZodOptional<z.ZodString>>;
33
+ source: z.ZodPrefault<z.ZodObject<{
34
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
35
+ name: z.ZodOptional<z.ZodString>;
36
+ }, z.core.$strip>>;
37
+ sourceType: z.ZodDefault<z.ZodString>;
38
+ parameters: z.ZodPrefault<z.ZodObject<{
39
+ charset: z.ZodDefault<z.ZodObject<{
40
+ name: z.ZodString;
41
+ value: z.ZodString;
42
+ }, z.core.$strip>>;
43
+ separator: z.ZodDefault<z.ZodString>;
44
+ skipHeaders: z.ZodDefault<z.ZodBoolean>;
45
+ clearMembers: z.ZodDefault<z.ZodBoolean>;
46
+ mappings: z.ZodPrefault<z.ZodObject<{
47
+ name: z.ZodDefault<z.ZodString>;
48
+ timezoneId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
49
+ priority: z.ZodDefault<z.ZodOptional<z.ZodString>>;
50
+ expireAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
51
+ bucketId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
52
+ agentId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
53
+ variables: z.ZodDefault<z.ZodArray<z.ZodString>>;
54
+ destination: z.ZodDefault<z.ZodArray<z.ZodString>>;
55
+ commPriority: z.ZodDefault<z.ZodArray<z.ZodString>>;
56
+ code: z.ZodDefault<z.ZodArray<z.ZodString>>;
57
+ description: z.ZodDefault<z.ZodArray<z.ZodString>>;
58
+ dtmf: z.ZodDefault<z.ZodArray<z.ZodString>>;
59
+ }, z.core.$strip>>;
60
+ }, z.core.$strip>>;
61
+ }, z.core.$strip>;
62
+ export {};
@@ -40,8 +40,10 @@ export * from './contactGroupCondition/contactGroupCondition.validations';
40
40
  export * from './contactPhone/contactPhone.validations';
41
41
  export * from './device/device.validations';
42
42
  export * from './dialplan/dialplan.validations';
43
+ export * from './emailProfile/emailProfile.validations';
43
44
  export * from './flow/flow.validations';
44
45
  export * from './gateway/gateway.validations';
46
+ export * from './importTemplate/importTemplate.validations';
45
47
  export * from './license/licenseImport.validations';
46
48
  export * from './OAuth/OAuth.validations';
47
49
  export * from './onlineSkill/onlineSkill.validations';
@@ -67,11 +69,13 @@ export * from './shiftTemplate/shiftTemplate.validations';
67
69
  export * from './skill/skill.validations';
68
70
  export * from './sla/sla.validations';
69
71
  export * from './slaCondition/slaCondition.validations';
72
+ export * from './storagePolicy/storagePolicy.validations';
70
73
  export * from './team/team.validations';
71
74
  export * from './teamAgent/teamAgent.validations';
72
75
  export * from './teamFlow/teamFlow.validations';
73
76
  export * from './teamHook/teamHook.validations';
74
77
  export * from './textToSpeech/textToSpeech.validations';
78
+ export * from './trigger/trigger.validations';
75
79
  export * from './typeExtension/typeExtension.validations';
76
80
  export * from './types';
77
81
  export * from './user/user.validations';
@@ -0,0 +1,26 @@
1
+ import type { StorageFilePolicy } from '@webitel/api-services/gen/models';
2
+ import { z } from 'zod';
3
+ /** [Claude] the api keeps speeds and the upload size as int64 strings, the form edits them as numbers */
4
+ export type StoragePolicyCard = Omit<StorageFilePolicy, 'speedDownload' | 'speedUpload' | 'maxUploadSize'> & {
5
+ speedDownload?: string | number;
6
+ speedUpload?: string | number;
7
+ maxUploadSize?: string | number;
8
+ };
9
+ export declare const storagePolicySchema: z.ZodObject<{
10
+ channels?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
11
+ createdAt?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
12
+ createdBy?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
13
+ description?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
14
+ enabled?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
15
+ encrypt?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
16
+ id?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
17
+ maxUploadSize?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
18
+ mimeTypes?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
19
+ name?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
20
+ position?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
21
+ retentionDays?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
22
+ speedDownload?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
23
+ speedUpload?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
24
+ updatedAt?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
25
+ updatedBy?: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
26
+ }, z.core.$strip>;
@@ -0,0 +1,38 @@
1
+ import { type EngineTrigger } from '@webitel/api-services/gen/models';
2
+ import { z } from 'zod';
3
+ import { type VariablePair } from '../_shared/variablePair.validations';
4
+ /** [Claude] the card's trigger: `variables` is the editable pair list, the api takes a map */
5
+ export type TriggerCard = Omit<EngineTrigger, 'variables'> & {
6
+ variables?: VariablePair[];
7
+ };
8
+ /**
9
+ * [Claude] Trigger card schema.
10
+ *
11
+ * A cron trigger runs on a schedule, so it needs the expression and its
12
+ * timezone; an event trigger runs on an object's event, so it needs both of
13
+ * those. Whether the expression is a valid cron is left to the app, which
14
+ * has the cron parser.
15
+ */
16
+ export declare const triggerSchema: z.ZodObject<{
17
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
18
+ name: z.ZodDefault<z.ZodString>;
19
+ description: z.ZodDefault<z.ZodOptional<z.ZodString>>;
20
+ enabled: z.ZodDefault<z.ZodBoolean>;
21
+ type: z.ZodDefault<z.ZodString>;
22
+ schema: z.ZodPrefault<z.ZodObject<{
23
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
24
+ name: z.ZodOptional<z.ZodString>;
25
+ }, z.core.$strip>>;
26
+ timeout: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
27
+ variables: z.ZodDefault<z.ZodArray<z.ZodObject<{
28
+ key: z.ZodString;
29
+ value: z.ZodString;
30
+ }, z.core.$strip>>>;
31
+ expression: z.ZodDefault<z.ZodOptional<z.ZodString>>;
32
+ timezone: z.ZodDefault<z.ZodOptional<z.ZodObject<{
33
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
34
+ name: z.ZodOptional<z.ZodString>;
35
+ }, z.core.$strip>>>;
36
+ object: z.ZodDefault<z.ZodOptional<z.ZodString>>;
37
+ event: z.ZodDefault<z.ZodOptional<z.ZodString>>;
38
+ }, z.core.$loose>;