@fonoster/common 0.7.4 → 0.7.7

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 (67) hide show
  1. package/README.md +2 -2
  2. package/dist/constants.d.ts +1 -1
  3. package/dist/constants.js +2 -2
  4. package/dist/errors/index.d.ts +1 -1
  5. package/dist/errors/index.js +1 -1
  6. package/dist/index.d.ts +7 -5
  7. package/dist/index.js +20 -5
  8. package/dist/notifications/compileTemplate.d.ts +1 -1
  9. package/dist/notifications/createEmailSender.d.ts +1 -1
  10. package/dist/protos/voice.proto +1 -2
  11. package/dist/tts/index.d.ts +1 -1
  12. package/dist/tts/index.js +2 -2
  13. package/dist/tts/types.d.ts +1 -1
  14. package/dist/tts/types.js +1 -1
  15. package/dist/types.d.ts +1 -1
  16. package/dist/utils/createService.d.ts +1 -1
  17. package/dist/utils/getServerCredentials.d.ts +1 -1
  18. package/dist/utils/getServerCredentials.js +0 -1
  19. package/dist/utils/index.d.ts +5 -2
  20. package/dist/utils/index.js +5 -2
  21. package/dist/utils/withErrorHandling.d.ts +5 -0
  22. package/dist/utils/withErrorHandling.js +42 -0
  23. package/dist/utils/withErrorHandlingAndValidation.d.ts +5 -0
  24. package/dist/utils/withErrorHandlingAndValidation.js +8 -0
  25. package/dist/utils/withValidation.d.ts +6 -0
  26. package/dist/utils/withValidation.js +18 -0
  27. package/dist/validators/calls.d.ts +48 -0
  28. package/dist/validators/calls.js +55 -0
  29. package/dist/validators/common.d.ts +19 -0
  30. package/dist/validators/common.js +33 -0
  31. package/dist/validators/hostOrHostPortSchema.d.ts +3 -0
  32. package/dist/validators/hostOrHostPortSchema.js +33 -0
  33. package/dist/validators/identity.d.ts +119 -0
  34. package/dist/validators/identity.js +93 -0
  35. package/dist/validators/index.d.ts +6 -0
  36. package/dist/validators/index.js +40 -0
  37. package/dist/validators/secrets.d.ts +12 -0
  38. package/dist/validators/secrets.js +35 -0
  39. package/dist/validators/sipnet/acls.d.ts +4 -0
  40. package/dist/validators/sipnet/acls.js +26 -0
  41. package/dist/validators/sipnet/agents.d.ts +4 -0
  42. package/dist/validators/sipnet/agents.js +26 -0
  43. package/dist/validators/sipnet/credentials.d.ts +4 -0
  44. package/dist/validators/sipnet/credentials.js +26 -0
  45. package/dist/validators/sipnet/domains.d.ts +4 -0
  46. package/dist/validators/sipnet/domains.js +26 -0
  47. package/dist/validators/sipnet/index.d.ts +6 -0
  48. package/dist/validators/sipnet/index.js +40 -0
  49. package/dist/validators/sipnet/numbers.d.ts +39 -0
  50. package/dist/validators/sipnet/numbers.js +50 -0
  51. package/dist/validators/sipnet/trunks.d.ts +4 -0
  52. package/dist/validators/sipnet/trunks.js +26 -0
  53. package/dist/voice/Dial.d.ts +1 -1
  54. package/dist/voice/Dial.js +1 -1
  55. package/dist/voice/Mute.d.ts +1 -1
  56. package/dist/voice/Play.d.ts +1 -1
  57. package/dist/voice/PlaybackControl.d.ts +1 -1
  58. package/dist/voice/Record.d.ts +1 -1
  59. package/dist/voice/Say.d.ts +1 -1
  60. package/dist/voice/Stream.d.ts +1 -1
  61. package/dist/voice/Stream.js +1 -1
  62. package/dist/voice/StreamGather.d.ts +1 -1
  63. package/dist/voice/index.d.ts +3 -3
  64. package/dist/voice/index.js +11 -11
  65. package/dist/voice/voice.d.ts +1 -1
  66. package/dist/voice/voice.js +1 -1
  67. package/package.json +4 -3
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateWorkspaceRequestSchema = exports.updateUserRequestSchema = exports.resendWorkspaceMembershipInvitationRequestSchema = exports.removeUserFromWorkspaceRequestSchema = exports.inviteUserToWorkspaceRequestSchema = exports.exchangeRefreshTokenRequestSchema = exports.exchangeCredentialsRequestSchema = exports.exchangeApiKeysRequestSchema = exports.createWorkspaceRequestSchema = exports.createUserRequestSchema = exports.createApiKeyRequestSchema = void 0;
4
+ /*
5
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
6
+ * http://github.com/fonoster/fonoster
7
+ *
8
+ * This file is part of Fonoster
9
+ *
10
+ * Licensed under the MIT License (the "License");
11
+ * you may not use this file except in compliance with
12
+ * the License. You may obtain a copy of the License at
13
+ *
14
+ * https://opensource.org/licenses/MIT
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ const types_1 = require("@fonoster/types");
23
+ const zod_1 = require("zod");
24
+ const MIN_NAME_MESSAGE = "The name is required";
25
+ const MAX_NAME_MESSAGE = "Name must contain at most 50 characters";
26
+ const EMAIL_MESSAGE = "Invalid email";
27
+ const PASSWORD_MESSAGE = "Password must contain at least 8 characters";
28
+ const USER_REF_MESSAGE = "Invalid user reference";
29
+ const WORKSPACE_REF_MESSAGE = "Invalid workspace reference";
30
+ const createWorkspaceRequestSchema = zod_1.z.object({
31
+ name: zod_1.z.string().min(1, MIN_NAME_MESSAGE).max(50, MAX_NAME_MESSAGE)
32
+ });
33
+ exports.createWorkspaceRequestSchema = createWorkspaceRequestSchema;
34
+ const createApiKeyRequestSchema = zod_1.z.object({
35
+ role: zod_1.z.enum([types_1.ApiRoleEnum.WORKSPACE_ADMIN]),
36
+ expiresAt: zod_1.z
37
+ .number()
38
+ .transform((value) => (value === 0 ? null : value))
39
+ .optional()
40
+ });
41
+ exports.createApiKeyRequestSchema = createApiKeyRequestSchema;
42
+ const exchangeApiKeysRequestSchema = zod_1.z.object({
43
+ accessKeyId: zod_1.z.string().uuid("Invalid accessKeyId"),
44
+ accessKeySecret: zod_1.z.string()
45
+ });
46
+ exports.exchangeApiKeysRequestSchema = exchangeApiKeysRequestSchema;
47
+ const exchangeCredentialsRequestSchema = zod_1.z.object({
48
+ username: zod_1.z.string().email("Invalid username, must be an email address"),
49
+ password: zod_1.z.string()
50
+ });
51
+ exports.exchangeCredentialsRequestSchema = exchangeCredentialsRequestSchema;
52
+ const exchangeRefreshTokenRequestSchema = zod_1.z.object({
53
+ refreshToken: zod_1.z.string()
54
+ });
55
+ exports.exchangeRefreshTokenRequestSchema = exchangeRefreshTokenRequestSchema;
56
+ const createUserRequestSchema = zod_1.z.object({
57
+ name: zod_1.z.string().max(50, MAX_NAME_MESSAGE),
58
+ email: zod_1.z.string().email(EMAIL_MESSAGE),
59
+ password: zod_1.z.string().min(8, PASSWORD_MESSAGE).max(100),
60
+ avatar: zod_1.z.string().url().max(255, "Invalid avatar URL")
61
+ });
62
+ exports.createUserRequestSchema = createUserRequestSchema;
63
+ const updateUserRequestSchema = zod_1.z.object({
64
+ ref: zod_1.z.string().uuid(USER_REF_MESSAGE),
65
+ name: zod_1.z.string().max(50, MAX_NAME_MESSAGE).or(zod_1.z.string().optional()),
66
+ password: zod_1.z.string().min(8, PASSWORD_MESSAGE).or(zod_1.z.string().optional()),
67
+ avatar: zod_1.z.string().url().or(zod_1.z.string().optional())
68
+ });
69
+ exports.updateUserRequestSchema = updateUserRequestSchema;
70
+ const inviteUserToWorkspaceRequestSchema = zod_1.z.object({
71
+ email: zod_1.z.string().email(EMAIL_MESSAGE),
72
+ name: zod_1.z.string().max(50, MAX_NAME_MESSAGE),
73
+ role: zod_1.z.enum([types_1.WorkspaceRoleEnum.ADMIN, types_1.WorkspaceRoleEnum.USER]),
74
+ password: zod_1.z.string().min(8, PASSWORD_MESSAGE).or(zod_1.z.undefined())
75
+ });
76
+ exports.inviteUserToWorkspaceRequestSchema = inviteUserToWorkspaceRequestSchema;
77
+ const resendWorkspaceMembershipInvitationRequestSchema = zod_1.z.object({
78
+ userRef: zod_1.z.string().uuid(USER_REF_MESSAGE)
79
+ });
80
+ exports.resendWorkspaceMembershipInvitationRequestSchema = resendWorkspaceMembershipInvitationRequestSchema;
81
+ const updateWorkspaceRequestSchema = zod_1.z.object({
82
+ ref: zod_1.z.string().uuid(WORKSPACE_REF_MESSAGE),
83
+ name: zod_1.z
84
+ .string()
85
+ .min(1, MIN_NAME_MESSAGE)
86
+ .max(50, MAX_NAME_MESSAGE)
87
+ .or(zod_1.z.string().optional())
88
+ });
89
+ exports.updateWorkspaceRequestSchema = updateWorkspaceRequestSchema;
90
+ const removeUserFromWorkspaceRequestSchema = zod_1.z.object({
91
+ userRef: zod_1.z.string().uuid(USER_REF_MESSAGE)
92
+ });
93
+ exports.removeUserFromWorkspaceRequestSchema = removeUserFromWorkspaceRequestSchema;
@@ -0,0 +1,6 @@
1
+ export * from "./calls";
2
+ export * from "./common";
3
+ export * from "./hostOrHostPortSchema";
4
+ export * from "./identity";
5
+ export * from "./secrets";
6
+ export * from "./sipnet";
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /*
18
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
19
+ * http://github.com/fonoster/fonoster
20
+ *
21
+ * This file is part of Fonoster
22
+ *
23
+ * Licensed under the MIT License (the "License");
24
+ * you may not use this file except in compliance with
25
+ * the License. You may obtain a copy of the License at
26
+ *
27
+ * https://opensource.org/licenses/MIT
28
+ *
29
+ * Unless required by applicable law or agreed to in writing, software
30
+ * distributed under the License is distributed on an "AS IS" BASIS,
31
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32
+ * See the License for the specific language governing permissions and
33
+ * limitations under the License.
34
+ */
35
+ __exportStar(require("./calls"), exports);
36
+ __exportStar(require("./common"), exports);
37
+ __exportStar(require("./hostOrHostPortSchema"), exports);
38
+ __exportStar(require("./identity"), exports);
39
+ __exportStar(require("./secrets"), exports);
40
+ __exportStar(require("./sipnet"), exports);
@@ -0,0 +1,12 @@
1
+ import { z } from "zod";
2
+ declare const createSecretRequestSchema: z.ZodObject<{
3
+ name: z.ZodString;
4
+ secret: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ name?: string;
7
+ secret?: string;
8
+ }, {
9
+ name?: string;
10
+ secret?: string;
11
+ }>;
12
+ export { createSecretRequestSchema };
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createSecretRequestSchema = void 0;
4
+ /*
5
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
6
+ * http://github.com/fonoster/fonoster
7
+ *
8
+ * This file is part of Fonoster
9
+ *
10
+ * Licensed under the MIT License (the "License");
11
+ * you may not use this file except in compliance with
12
+ * the License. You may obtain a copy of the License at
13
+ *
14
+ * https://opensource.org/licenses/MIT
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ const zod_1 = require("zod");
23
+ // Allows only letters, numbers, underscores, and hyphens
24
+ const validNameRegex = /^[a-zA-Z0-9_-]+$/;
25
+ const createSecretRequestSchema = zod_1.z.object({
26
+ name: zod_1.z
27
+ .string()
28
+ .regex(validNameRegex, {
29
+ message: "Name can only contain letters, numbers, underscores, or hyphens. No spaces allowed."
30
+ })
31
+ .min(3, { message: "Name must be at least 3 characters long." })
32
+ .max(32, { message: "Name must be at most 32 characters long." }),
33
+ secret: zod_1.z.string()
34
+ });
35
+ exports.createSecretRequestSchema = createSecretRequestSchema;
@@ -0,0 +1,4 @@
1
+ import { z } from "zod";
2
+ declare const createAclRequestSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
3
+ declare const updateAclRequestSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
4
+ export { createAclRequestSchema, updateAclRequestSchema };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateAclRequestSchema = exports.createAclRequestSchema = void 0;
4
+ /*
5
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
6
+ * http://github.com/fonoster/fonoster
7
+ *
8
+ * This file is part of Fonoster
9
+ *
10
+ * Licensed under the MIT License (the "License");
11
+ * you may not use this file except in compliance with
12
+ * the License. You may obtain a copy of the License at
13
+ *
14
+ * https://opensource.org/licenses/MIT
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ const zod_1 = require("zod");
23
+ const createAclRequestSchema = zod_1.z.object({});
24
+ exports.createAclRequestSchema = createAclRequestSchema;
25
+ const updateAclRequestSchema = zod_1.z.object({});
26
+ exports.updateAclRequestSchema = updateAclRequestSchema;
@@ -0,0 +1,4 @@
1
+ import { z } from "zod";
2
+ declare const createAgentRequestSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
3
+ declare const updateAgentRequestSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
4
+ export { createAgentRequestSchema, updateAgentRequestSchema };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateAgentRequestSchema = exports.createAgentRequestSchema = void 0;
4
+ /*
5
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
6
+ * http://github.com/fonoster/fonoster
7
+ *
8
+ * This file is part of Fonoster
9
+ *
10
+ * Licensed under the MIT License (the "License");
11
+ * you may not use this file except in compliance with
12
+ * the License. You may obtain a copy of the License at
13
+ *
14
+ * https://opensource.org/licenses/MIT
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ const zod_1 = require("zod");
23
+ const createAgentRequestSchema = zod_1.z.object({});
24
+ exports.createAgentRequestSchema = createAgentRequestSchema;
25
+ const updateAgentRequestSchema = zod_1.z.object({});
26
+ exports.updateAgentRequestSchema = updateAgentRequestSchema;
@@ -0,0 +1,4 @@
1
+ import { z } from "zod";
2
+ declare const createCredentialsRequestSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
3
+ declare const updateCredentialsRequestSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
4
+ export { createCredentialsRequestSchema, updateCredentialsRequestSchema };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateCredentialsRequestSchema = exports.createCredentialsRequestSchema = void 0;
4
+ /*
5
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
6
+ * http://github.com/fonoster/fonoster
7
+ *
8
+ * This file is part of Fonoster
9
+ *
10
+ * Licensed under the MIT License (the "License");
11
+ * you may not use this file except in compliance with
12
+ * the License. You may obtain a copy of the License at
13
+ *
14
+ * https://opensource.org/licenses/MIT
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ const zod_1 = require("zod");
23
+ const createCredentialsRequestSchema = zod_1.z.object({});
24
+ exports.createCredentialsRequestSchema = createCredentialsRequestSchema;
25
+ const updateCredentialsRequestSchema = zod_1.z.object({});
26
+ exports.updateCredentialsRequestSchema = updateCredentialsRequestSchema;
@@ -0,0 +1,4 @@
1
+ import { z } from "zod";
2
+ declare const createDomainRequestSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
3
+ declare const updateDomainRequestSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
4
+ export { createDomainRequestSchema, updateDomainRequestSchema };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateDomainRequestSchema = exports.createDomainRequestSchema = void 0;
4
+ /*
5
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
6
+ * http://github.com/fonoster/fonoster
7
+ *
8
+ * This file is part of Fonoster
9
+ *
10
+ * Licensed under the MIT License (the "License");
11
+ * you may not use this file except in compliance with
12
+ * the License. You may obtain a copy of the License at
13
+ *
14
+ * https://opensource.org/licenses/MIT
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ const zod_1 = require("zod");
23
+ const createDomainRequestSchema = zod_1.z.object({});
24
+ exports.createDomainRequestSchema = createDomainRequestSchema;
25
+ const updateDomainRequestSchema = zod_1.z.object({});
26
+ exports.updateDomainRequestSchema = updateDomainRequestSchema;
@@ -0,0 +1,6 @@
1
+ export * from "./acls";
2
+ export * from "./agents";
3
+ export * from "./credentials";
4
+ export * from "./domains";
5
+ export * from "./numbers";
6
+ export * from "./trunks";
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /*
18
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
19
+ * http://github.com/fonoster/fonoster
20
+ *
21
+ * This file is part of Fonoster
22
+ *
23
+ * Licensed under the MIT License (the "License");
24
+ * you may not use this file except in compliance with
25
+ * the License. You may obtain a copy of the License at
26
+ *
27
+ * https://opensource.org/licenses/MIT
28
+ *
29
+ * Unless required by applicable law or agreed to in writing, software
30
+ * distributed under the License is distributed on an "AS IS" BASIS,
31
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32
+ * See the License for the specific language governing permissions and
33
+ * limitations under the License.
34
+ */
35
+ __exportStar(require("./acls"), exports);
36
+ __exportStar(require("./agents"), exports);
37
+ __exportStar(require("./credentials"), exports);
38
+ __exportStar(require("./domains"), exports);
39
+ __exportStar(require("./numbers"), exports);
40
+ __exportStar(require("./trunks"), exports);
@@ -0,0 +1,39 @@
1
+ import { z } from "zod";
2
+ declare const createNumberRequestSchema: z.ZodEffects<z.ZodObject<{
3
+ agentAor: z.ZodOptional<z.ZodString>;
4
+ appRef: z.ZodOptional<z.ZodString>;
5
+ countryIsoCode: z.ZodEffects<z.ZodString, string, string>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ countryIsoCode?: string;
8
+ appRef?: string;
9
+ agentAor?: string;
10
+ }, {
11
+ countryIsoCode?: string;
12
+ appRef?: string;
13
+ agentAor?: string;
14
+ }>, {
15
+ countryIsoCode?: string;
16
+ appRef?: string;
17
+ agentAor?: string;
18
+ }, {
19
+ countryIsoCode?: string;
20
+ appRef?: string;
21
+ agentAor?: string;
22
+ }>;
23
+ declare const updateNumberRequestSchema: z.ZodEffects<z.ZodObject<{
24
+ agentAor: z.ZodOptional<z.ZodString>;
25
+ appRef: z.ZodOptional<z.ZodString>;
26
+ }, "strip", z.ZodTypeAny, {
27
+ appRef?: string;
28
+ agentAor?: string;
29
+ }, {
30
+ appRef?: string;
31
+ agentAor?: string;
32
+ }>, {
33
+ appRef?: string;
34
+ agentAor?: string;
35
+ }, {
36
+ appRef?: string;
37
+ agentAor?: string;
38
+ }>;
39
+ export { createNumberRequestSchema, updateNumberRequestSchema };
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.updateNumberRequestSchema = exports.createNumberRequestSchema = void 0;
7
+ /*
8
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
9
+ * http://github.com/fonoster/fonoster
10
+ *
11
+ * This file is part of Fonoster
12
+ *
13
+ * Licensed under the MIT License (the "License");
14
+ * you may not use this file except in compliance with
15
+ * the License. You may obtain a copy of the License at
16
+ *
17
+ * https://opensource.org/licenses/MIT
18
+ *
19
+ * Unless required by applicable law or agreed to in writing, software
20
+ * distributed under the License is distributed on an "AS IS" BASIS,
21
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
+ * See the License for the specific language governing permissions and
23
+ * limitations under the License.
24
+ */
25
+ const isISO31661Alpha2_1 = __importDefault(require("validator/lib/isISO31661Alpha2"));
26
+ const zod_1 = require("zod");
27
+ const sipUriRegex = /^sip:[a-zA-Z0-9_.-]+@[a-zA-Z0-9_.-]+$/;
28
+ const sipUriSchema = zod_1.z.string().regex(sipUriRegex, "Invalid SIP URI");
29
+ const countryIsoCodeSchema = zod_1.z.string().refine((val) => (0, isISO31661Alpha2_1.default)(val), {
30
+ message: "Invalid country ISO code"
31
+ });
32
+ const createNumberRequestSchema = zod_1.z
33
+ .object({
34
+ agentAor: sipUriSchema.optional(),
35
+ appRef: zod_1.z.string().optional(),
36
+ countryIsoCode: countryIsoCodeSchema
37
+ })
38
+ .refine(({ agentAor, appRef }) => !(agentAor !== undefined && appRef !== undefined), {
39
+ message: "You can only provide one of the following fields: 'agentAor' or 'appRef'"
40
+ });
41
+ exports.createNumberRequestSchema = createNumberRequestSchema;
42
+ const updateNumberRequestSchema = zod_1.z
43
+ .object({
44
+ agentAor: sipUriSchema.optional(),
45
+ appRef: zod_1.z.string().optional()
46
+ })
47
+ .refine(({ agentAor, appRef }) => !(agentAor !== undefined && appRef !== undefined), {
48
+ message: "You can only provide one of the following fields: 'agentAor' or 'appRef'"
49
+ });
50
+ exports.updateNumberRequestSchema = updateNumberRequestSchema;
@@ -0,0 +1,4 @@
1
+ import { z } from "zod";
2
+ declare const createTrunkRequestSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
3
+ declare const updateTrunkRequestSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
4
+ export { createTrunkRequestSchema, updateTrunkRequestSchema };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateTrunkRequestSchema = exports.createTrunkRequestSchema = void 0;
4
+ /*
5
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
6
+ * http://github.com/fonoster/fonoster
7
+ *
8
+ * This file is part of Fonoster
9
+ *
10
+ * Licensed under the MIT License (the "License");
11
+ * you may not use this file except in compliance with
12
+ * the License. You may obtain a copy of the License at
13
+ *
14
+ * https://opensource.org/licenses/MIT
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ const zod_1 = require("zod");
23
+ const createTrunkRequestSchema = zod_1.z.object({});
24
+ exports.createTrunkRequestSchema = createTrunkRequestSchema;
25
+ const updateTrunkRequestSchema = zod_1.z.object({});
26
+ exports.updateTrunkRequestSchema = updateTrunkRequestSchema;
@@ -20,4 +20,4 @@ type DialOptions = {
20
20
  type DialRequest = VerbRequest & DialOptions & {
21
21
  destination: string;
22
22
  };
23
- export { DialRequest, DialOptions, DialStatus, DialRecordDirection };
23
+ export { DialOptions, DialRecordDirection, DialRequest, DialStatus };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DialRecordDirection = exports.DialStatus = void 0;
3
+ exports.DialStatus = exports.DialRecordDirection = void 0;
4
4
  var DialRecordDirection;
5
5
  (function (DialRecordDirection) {
6
6
  DialRecordDirection["IN"] = "IN";
@@ -10,4 +10,4 @@ declare enum MuteDirection {
10
10
  type MuteRequest = VerbRequest & {
11
11
  direction: MuteDirection;
12
12
  };
13
- export { MuteOptions, MuteRequest, MuteDirection };
13
+ export { MuteDirection, MuteOptions, MuteRequest };
@@ -9,4 +9,4 @@ type PlayResponse = {
9
9
  sessionRef: string;
10
10
  playbackRef: string;
11
11
  };
12
- export { PlayRequest, PlayResponse, PlayOptions };
12
+ export { PlayOptions, PlayRequest, PlayResponse };
@@ -10,4 +10,4 @@ type PlaybackControlRequest = VerbRequest & {
10
10
  playbackRef: string;
11
11
  action: PlaybackControlAction;
12
12
  };
13
- export { PlaybackControlRequest, PlaybackControlAction };
13
+ export { PlaybackControlAction, PlaybackControlRequest };
@@ -15,4 +15,4 @@ type RecordResponse = {
15
15
  duration: number;
16
16
  format: RecordFormat;
17
17
  };
18
- export { RecordOptions, RecordRequest, RecordResponse, RecordFormat };
18
+ export { RecordFormat, RecordOptions, RecordRequest, RecordResponse };
@@ -12,4 +12,4 @@ type SayOptions = {
12
12
  playbackRef?: string;
13
13
  [key: string]: any;
14
14
  };
15
- export { SayRequest, SayResponse, SayOptions };
15
+ export { SayOptions, SayRequest, SayResponse };
@@ -32,4 +32,4 @@ type StreamPayload = {
32
32
  code?: string;
33
33
  message?: string;
34
34
  };
35
- export { StreamDirection, StreamAudioFormat, StreamMessageType, StreamOptions, StartStreamRequest, StartStreamResponse, StopStreamRequest, StreamPayload };
35
+ export { StartStreamRequest, StartStreamResponse, StopStreamRequest, StreamAudioFormat, StreamDirection, StreamMessageType, StreamOptions, StreamPayload };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StreamMessageType = exports.StreamAudioFormat = exports.StreamDirection = void 0;
3
+ exports.StreamMessageType = exports.StreamDirection = exports.StreamAudioFormat = void 0;
4
4
  /*
5
5
  * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
6
6
  * http://github.com/fonoster/fonoster
@@ -12,4 +12,4 @@ type StreamGatherPayload = VerbResponse & {
12
12
  speech?: string;
13
13
  digit?: string;
14
14
  };
15
- export { StreamGatherSource, StreamGatherPayload, StartStreamGatherRequest, StreamGatherOptions };
15
+ export { StartStreamGatherRequest, StreamGatherOptions, StreamGatherPayload, StreamGatherSource };
@@ -1,12 +1,12 @@
1
- export * from "./voice";
2
1
  export * from "./Dial";
3
2
  export * from "./Gather";
4
- export * from "./Verb";
5
3
  export * from "./Mute";
6
4
  export * from "./Play";
7
- export * from "./PlaybackControl";
8
5
  export * from "./PlayDtmf";
6
+ export * from "./PlaybackControl";
9
7
  export * from "./Record";
10
8
  export * from "./Say";
11
9
  export * from "./Stream";
12
10
  export * from "./StreamGather";
11
+ export * from "./Verb";
12
+ export * from "./voice";
@@ -14,6 +14,17 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Dial"), exports);
18
+ __exportStar(require("./Gather"), exports);
19
+ __exportStar(require("./Mute"), exports);
20
+ __exportStar(require("./Play"), exports);
21
+ __exportStar(require("./PlayDtmf"), exports);
22
+ __exportStar(require("./PlaybackControl"), exports);
23
+ __exportStar(require("./Record"), exports);
24
+ __exportStar(require("./Say"), exports);
25
+ __exportStar(require("./Stream"), exports);
26
+ __exportStar(require("./StreamGather"), exports);
27
+ __exportStar(require("./Verb"), exports);
17
28
  /*
18
29
  * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
19
30
  * http://github.com/fonoster/fonoster
@@ -33,14 +44,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
33
44
  * limitations under the License.
34
45
  */
35
46
  __exportStar(require("./voice"), exports);
36
- __exportStar(require("./Dial"), exports);
37
- __exportStar(require("./Gather"), exports);
38
- __exportStar(require("./Verb"), exports);
39
- __exportStar(require("./Mute"), exports);
40
- __exportStar(require("./Play"), exports);
41
- __exportStar(require("./PlaybackControl"), exports);
42
- __exportStar(require("./PlayDtmf"), exports);
43
- __exportStar(require("./Record"), exports);
44
- __exportStar(require("./Say"), exports);
45
- __exportStar(require("./Stream"), exports);
46
- __exportStar(require("./StreamGather"), exports);
@@ -111,4 +111,4 @@ type BaseVoiceStream<T, W> = {
111
111
  };
112
112
  type VoiceSessionStreamServer = BaseVoiceStream<VoiceIn, VoiceOut>;
113
113
  type VoiceSessionStreamClient = BaseVoiceStream<VoiceOut | GrpcError, VoiceIn | GrpcError>;
114
- export { VoiceClientConfig, VoiceSessionStreamServer, VoiceSessionStreamClient, StreamEvent, StreamContent, VoiceIn, VoiceOut, DATA, END, ERROR };
114
+ export { DATA, END, ERROR, StreamContent, StreamEvent, VoiceClientConfig, VoiceIn, VoiceOut, VoiceSessionStreamClient, VoiceSessionStreamServer };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ERROR = exports.END = exports.DATA = exports.StreamContent = exports.StreamEvent = void 0;
3
+ exports.StreamEvent = exports.StreamContent = exports.ERROR = exports.END = exports.DATA = void 0;
4
4
  const DATA = "data";
5
5
  exports.DATA = DATA;
6
6
  const END = "end";