@fonoster/common 0.7.5 → 0.7.9
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/dist/index.d.ts +1 -0
- package/dist/index.js +14 -0
- package/dist/protos/voice.proto +1 -2
- package/dist/utils/getServerCredentials.js +0 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/withErrorHandlingAndValidation.d.ts +5 -0
- package/dist/utils/withErrorHandlingAndValidation.js +8 -0
- package/dist/validators/calls.d.ts +48 -0
- package/dist/validators/{listCallsRequestSchema.js → calls.js} +25 -23
- package/dist/validators/common.d.ts +12 -2
- package/dist/validators/common.js +10 -3
- package/dist/validators/hostOrHostPortSchema.d.ts +1 -1
- package/dist/validators/hostOrHostPortSchema.js +0 -1
- package/dist/validators/identity.d.ts +119 -0
- package/dist/validators/identity.js +93 -0
- package/dist/validators/index.d.ts +4 -1
- package/dist/validators/index.js +4 -1
- package/dist/validators/secrets.d.ts +12 -0
- package/dist/validators/secrets.js +35 -0
- package/dist/validators/sipnet/acls.d.ts +4 -0
- package/dist/validators/sipnet/acls.js +26 -0
- package/dist/validators/sipnet/agents.d.ts +4 -0
- package/dist/validators/sipnet/agents.js +26 -0
- package/dist/validators/sipnet/credentials.d.ts +4 -0
- package/dist/validators/sipnet/credentials.js +26 -0
- package/dist/validators/sipnet/domains.d.ts +4 -0
- package/dist/validators/sipnet/domains.js +26 -0
- package/dist/validators/sipnet/index.d.ts +6 -0
- package/dist/validators/sipnet/index.js +40 -0
- package/dist/validators/sipnet/numbers.d.ts +39 -0
- package/dist/validators/sipnet/numbers.js +50 -0
- package/dist/validators/sipnet/trunks.d.ts +4 -0
- package/dist/validators/sipnet/trunks.js +26 -0
- package/package.json +4 -3
- package/dist/validators/listCallsRequestSchema.d.ts +0 -18
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -10,10 +10,23 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
13
18
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
19
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
20
|
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
16
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.Validators = void 0;
|
|
17
30
|
/*
|
|
18
31
|
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
19
32
|
* http://github.com/fonoster/fonoster
|
|
@@ -40,5 +53,6 @@ __exportStar(require("./notifications"), exports);
|
|
|
40
53
|
__exportStar(require("./tts"), exports);
|
|
41
54
|
__exportStar(require("./types"), exports);
|
|
42
55
|
__exportStar(require("./utils"), exports);
|
|
56
|
+
exports.Validators = __importStar(require("./validators"));
|
|
43
57
|
__exportStar(require("./validators"), exports);
|
|
44
58
|
__exportStar(require("./voice"), exports);
|
package/dist/protos/voice.proto
CHANGED
|
@@ -66,7 +66,6 @@ function getServerCredentials(config) {
|
|
|
66
66
|
serverKey
|
|
67
67
|
});
|
|
68
68
|
if (tlsOn) {
|
|
69
|
-
// TODO: Assert that all the required fields are present
|
|
70
69
|
const cacert = verifyClientCert ? fs.readFileSync(caCert) : null;
|
|
71
70
|
return grpc.ServerCredentials.createSsl(cacert, [
|
|
72
71
|
{
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -41,4 +41,5 @@ __exportStar(require("./getServerCredentials"), exports);
|
|
|
41
41
|
__exportStar(require("./toCamelCase"), exports);
|
|
42
42
|
__exportStar(require("./toPascalCase"), exports);
|
|
43
43
|
__exportStar(require("./withErrorHandling"), exports);
|
|
44
|
+
__exportStar(require("./withErrorHandlingAndValidation"), exports);
|
|
44
45
|
__exportStar(require("./withValidation"), exports);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare function withErrorHandlingAndValidation(fn: Function, schema: z.ZodSchema): (call: {
|
|
3
|
+
request: unknown;
|
|
4
|
+
}, callback: (error?: import("..").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
5
|
+
export { withErrorHandlingAndValidation };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withErrorHandlingAndValidation = withErrorHandlingAndValidation;
|
|
4
|
+
const withErrorHandling_1 = require("./withErrorHandling");
|
|
5
|
+
const withValidation_1 = require("./withValidation");
|
|
6
|
+
function withErrorHandlingAndValidation(fn, schema) {
|
|
7
|
+
return (0, withErrorHandling_1.withErrorHandling)((0, withValidation_1.withValidation)(fn, schema));
|
|
8
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { CallStatus, CallType } from "@fonoster/types";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
declare const createCallRequestSchema: z.ZodObject<{
|
|
4
|
+
from: z.ZodString;
|
|
5
|
+
to: z.ZodString;
|
|
6
|
+
appRef: z.ZodString;
|
|
7
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
timeout?: number;
|
|
10
|
+
from?: string;
|
|
11
|
+
to?: string;
|
|
12
|
+
appRef?: string;
|
|
13
|
+
}, {
|
|
14
|
+
timeout?: number;
|
|
15
|
+
from?: string;
|
|
16
|
+
to?: string;
|
|
17
|
+
appRef?: string;
|
|
18
|
+
}>;
|
|
19
|
+
declare const getCallRequestSchema: z.ZodObject<{
|
|
20
|
+
ref: z.ZodString;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
ref?: string;
|
|
23
|
+
}, {
|
|
24
|
+
ref?: string;
|
|
25
|
+
}>;
|
|
26
|
+
declare const listCallsRequestSchema: z.ZodObject<{
|
|
27
|
+
after: z.ZodOptional<z.ZodString>;
|
|
28
|
+
before: z.ZodOptional<z.ZodString>;
|
|
29
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
type: z.ZodOptional<z.ZodNativeEnum<typeof CallType>>;
|
|
31
|
+
status: z.ZodOptional<z.ZodNativeEnum<typeof CallStatus>>;
|
|
32
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
type?: CallType;
|
|
35
|
+
status?: CallStatus;
|
|
36
|
+
after?: string;
|
|
37
|
+
before?: string;
|
|
38
|
+
pageSize?: number;
|
|
39
|
+
pageToken?: string;
|
|
40
|
+
}, {
|
|
41
|
+
type?: CallType;
|
|
42
|
+
status?: CallStatus;
|
|
43
|
+
after?: string;
|
|
44
|
+
before?: string;
|
|
45
|
+
pageSize?: number;
|
|
46
|
+
pageToken?: string;
|
|
47
|
+
}>;
|
|
48
|
+
export { createCallRequestSchema, getCallRequestSchema, listCallsRequestSchema };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.listCallsRequestSchema = void 0;
|
|
3
|
+
exports.listCallsRequestSchema = exports.getCallRequestSchema = exports.createCallRequestSchema = void 0;
|
|
4
4
|
/*
|
|
5
5
|
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
6
6
|
* http://github.com/fonoster/fonoster
|
|
@@ -19,35 +19,37 @@ exports.listCallsRequestSchema = void 0;
|
|
|
19
19
|
* See the License for the specific language governing permissions and
|
|
20
20
|
* limitations under the License.
|
|
21
21
|
*/
|
|
22
|
+
const types_1 = require("@fonoster/types");
|
|
22
23
|
const zod_1 = require("zod");
|
|
24
|
+
const createCallRequestSchema = zod_1.z.object({
|
|
25
|
+
from: zod_1.z.string(),
|
|
26
|
+
to: zod_1.z.string(),
|
|
27
|
+
appRef: zod_1.z.string().uuid("Invalid call reference"),
|
|
28
|
+
timeout: zod_1.z.number().max(120, "Timeout must be less than 120s").optional()
|
|
29
|
+
});
|
|
30
|
+
exports.createCallRequestSchema = createCallRequestSchema;
|
|
31
|
+
const getCallRequestSchema = zod_1.z.object({
|
|
32
|
+
ref: zod_1.z.string().uuid("Invalid call reference")
|
|
33
|
+
});
|
|
34
|
+
exports.getCallRequestSchema = getCallRequestSchema;
|
|
23
35
|
const listCallsRequestSchema = zod_1.z.object({
|
|
24
36
|
after: zod_1.z
|
|
25
37
|
.string()
|
|
26
38
|
.datetime({ offset: true, message: "The date must be a valid ISO 8601" })
|
|
27
|
-
.optional()
|
|
28
|
-
.nullable(),
|
|
39
|
+
.optional(),
|
|
29
40
|
before: zod_1.z
|
|
30
41
|
.string()
|
|
31
42
|
.datetime({ offset: true, message: "The date must be a valid ISO 8601" })
|
|
32
|
-
.optional()
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
// .nullable(),
|
|
44
|
-
// status: z
|
|
45
|
-
// .nativeEnum(CallStatus, { message: "Invalid call status" })
|
|
46
|
-
// .optional()
|
|
47
|
-
// .nullable(),
|
|
48
|
-
pageToken: zod_1.z
|
|
49
|
-
.string({ message: "The pageToken must be a string" })
|
|
50
|
-
.optional()
|
|
51
|
-
.nullable()
|
|
43
|
+
.optional(),
|
|
44
|
+
pageSize: zod_1.z.number({ message: "Invalid pageSize value" }).optional(),
|
|
45
|
+
type: zod_1.z
|
|
46
|
+
.nativeEnum(types_1.CallType, {
|
|
47
|
+
message: "Invalid call type"
|
|
48
|
+
})
|
|
49
|
+
.optional(),
|
|
50
|
+
status: zod_1.z
|
|
51
|
+
.nativeEnum(types_1.CallStatus, { message: "Invalid call status" })
|
|
52
|
+
.optional(),
|
|
53
|
+
pageToken: zod_1.z.string({ message: "The pageToken must be a string" }).optional()
|
|
52
54
|
});
|
|
53
55
|
exports.listCallsRequestSchema = listCallsRequestSchema;
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
declare const
|
|
2
|
+
declare const baseApiObjectSchema: z.ZodObject<{
|
|
3
3
|
ref: z.ZodString;
|
|
4
4
|
}, "strip", z.ZodTypeAny, {
|
|
5
5
|
ref?: string;
|
|
6
6
|
}, {
|
|
7
7
|
ref?: string;
|
|
8
8
|
}>;
|
|
9
|
-
|
|
9
|
+
declare const listRequestSchema: z.ZodOptional<z.ZodObject<{
|
|
10
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
pageSize?: number;
|
|
14
|
+
pageToken?: string;
|
|
15
|
+
}, {
|
|
16
|
+
pageSize?: number;
|
|
17
|
+
pageToken?: string;
|
|
18
|
+
}>>;
|
|
19
|
+
export { baseApiObjectSchema, listRequestSchema };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.listRequestSchema = exports.baseApiObjectSchema = void 0;
|
|
4
4
|
/*
|
|
5
5
|
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
6
6
|
* http://github.com/fonoster/fonoster
|
|
@@ -20,7 +20,14 @@ exports.basicApiCallSchema = void 0;
|
|
|
20
20
|
* limitations under the License.
|
|
21
21
|
*/
|
|
22
22
|
const zod_1 = require("zod");
|
|
23
|
-
const
|
|
23
|
+
const baseApiObjectSchema = zod_1.z.object({
|
|
24
24
|
ref: zod_1.z.string()
|
|
25
25
|
});
|
|
26
|
-
exports.
|
|
26
|
+
exports.baseApiObjectSchema = baseApiObjectSchema;
|
|
27
|
+
const listRequestSchema = zod_1.z
|
|
28
|
+
.object({
|
|
29
|
+
pageSize: zod_1.z.number().optional(),
|
|
30
|
+
pageToken: zod_1.z.string().optional()
|
|
31
|
+
})
|
|
32
|
+
.optional();
|
|
33
|
+
exports.listRequestSchema = listRequestSchema;
|
|
@@ -23,7 +23,6 @@ const zod_1 = require("zod");
|
|
|
23
23
|
const hostOrHostPortSchema = zod_1.z
|
|
24
24
|
.string()
|
|
25
25
|
.optional()
|
|
26
|
-
.nullable()
|
|
27
26
|
.refine((value) => {
|
|
28
27
|
const hostRegex = /^(?!:\/\/)([a-zA-Z0-9-_]+(\.[a-zA-Z0-9-_]+)*|(\d{1,3}\.){3}\d{1,3})$/;
|
|
29
28
|
const hostPortRegex = /^(?!:\/\/)([a-zA-Z0-9-_]+(\.[a-zA-Z0-9-_]+)*|(\d{1,3}\.){3}\d{1,3}):\d{1,5}$/;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { ApiRoleEnum, WorkspaceRoleEnum } from "@fonoster/types";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
declare const createWorkspaceRequestSchema: z.ZodObject<{
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
name?: string;
|
|
7
|
+
}, {
|
|
8
|
+
name?: string;
|
|
9
|
+
}>;
|
|
10
|
+
declare const createApiKeyRequestSchema: z.ZodObject<{
|
|
11
|
+
role: z.ZodEnum<[ApiRoleEnum]>;
|
|
12
|
+
expiresAt: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
role?: ApiRoleEnum;
|
|
15
|
+
expiresAt?: number;
|
|
16
|
+
}, {
|
|
17
|
+
role?: ApiRoleEnum;
|
|
18
|
+
expiresAt?: number;
|
|
19
|
+
}>;
|
|
20
|
+
declare const exchangeApiKeysRequestSchema: z.ZodObject<{
|
|
21
|
+
accessKeyId: z.ZodString;
|
|
22
|
+
accessKeySecret: z.ZodString;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
accessKeyId?: string;
|
|
25
|
+
accessKeySecret?: string;
|
|
26
|
+
}, {
|
|
27
|
+
accessKeyId?: string;
|
|
28
|
+
accessKeySecret?: string;
|
|
29
|
+
}>;
|
|
30
|
+
declare const exchangeCredentialsRequestSchema: z.ZodObject<{
|
|
31
|
+
username: z.ZodString;
|
|
32
|
+
password: z.ZodString;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
username?: string;
|
|
35
|
+
password?: string;
|
|
36
|
+
}, {
|
|
37
|
+
username?: string;
|
|
38
|
+
password?: string;
|
|
39
|
+
}>;
|
|
40
|
+
declare const exchangeRefreshTokenRequestSchema: z.ZodObject<{
|
|
41
|
+
refreshToken: z.ZodString;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
refreshToken?: string;
|
|
44
|
+
}, {
|
|
45
|
+
refreshToken?: string;
|
|
46
|
+
}>;
|
|
47
|
+
declare const createUserRequestSchema: z.ZodObject<{
|
|
48
|
+
name: z.ZodString;
|
|
49
|
+
email: z.ZodString;
|
|
50
|
+
password: z.ZodString;
|
|
51
|
+
avatar: z.ZodString;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
name?: string;
|
|
54
|
+
email?: string;
|
|
55
|
+
password?: string;
|
|
56
|
+
avatar?: string;
|
|
57
|
+
}, {
|
|
58
|
+
name?: string;
|
|
59
|
+
email?: string;
|
|
60
|
+
password?: string;
|
|
61
|
+
avatar?: string;
|
|
62
|
+
}>;
|
|
63
|
+
declare const updateUserRequestSchema: z.ZodObject<{
|
|
64
|
+
ref: z.ZodString;
|
|
65
|
+
name: z.ZodUnion<[z.ZodString, z.ZodOptional<z.ZodString>]>;
|
|
66
|
+
password: z.ZodUnion<[z.ZodString, z.ZodOptional<z.ZodString>]>;
|
|
67
|
+
avatar: z.ZodUnion<[z.ZodString, z.ZodOptional<z.ZodString>]>;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
name?: string;
|
|
70
|
+
ref?: string;
|
|
71
|
+
password?: string;
|
|
72
|
+
avatar?: string;
|
|
73
|
+
}, {
|
|
74
|
+
name?: string;
|
|
75
|
+
ref?: string;
|
|
76
|
+
password?: string;
|
|
77
|
+
avatar?: string;
|
|
78
|
+
}>;
|
|
79
|
+
declare const inviteUserToWorkspaceRequestSchema: z.ZodObject<{
|
|
80
|
+
email: z.ZodString;
|
|
81
|
+
name: z.ZodString;
|
|
82
|
+
role: z.ZodEnum<[WorkspaceRoleEnum.ADMIN, WorkspaceRoleEnum.USER]>;
|
|
83
|
+
password: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
|
|
84
|
+
}, "strip", z.ZodTypeAny, {
|
|
85
|
+
name?: string;
|
|
86
|
+
email?: string;
|
|
87
|
+
role?: WorkspaceRoleEnum.ADMIN | WorkspaceRoleEnum.USER;
|
|
88
|
+
password?: string;
|
|
89
|
+
}, {
|
|
90
|
+
name?: string;
|
|
91
|
+
email?: string;
|
|
92
|
+
role?: WorkspaceRoleEnum.ADMIN | WorkspaceRoleEnum.USER;
|
|
93
|
+
password?: string;
|
|
94
|
+
}>;
|
|
95
|
+
declare const resendWorkspaceMembershipInvitationRequestSchema: z.ZodObject<{
|
|
96
|
+
userRef: z.ZodString;
|
|
97
|
+
}, "strip", z.ZodTypeAny, {
|
|
98
|
+
userRef?: string;
|
|
99
|
+
}, {
|
|
100
|
+
userRef?: string;
|
|
101
|
+
}>;
|
|
102
|
+
declare const updateWorkspaceRequestSchema: z.ZodObject<{
|
|
103
|
+
ref: z.ZodString;
|
|
104
|
+
name: z.ZodUnion<[z.ZodString, z.ZodOptional<z.ZodString>]>;
|
|
105
|
+
}, "strip", z.ZodTypeAny, {
|
|
106
|
+
name?: string;
|
|
107
|
+
ref?: string;
|
|
108
|
+
}, {
|
|
109
|
+
name?: string;
|
|
110
|
+
ref?: string;
|
|
111
|
+
}>;
|
|
112
|
+
declare const removeUserFromWorkspaceRequestSchema: z.ZodObject<{
|
|
113
|
+
userRef: z.ZodString;
|
|
114
|
+
}, "strip", z.ZodTypeAny, {
|
|
115
|
+
userRef?: string;
|
|
116
|
+
}, {
|
|
117
|
+
userRef?: string;
|
|
118
|
+
}>;
|
|
119
|
+
export { createApiKeyRequestSchema, createUserRequestSchema, createWorkspaceRequestSchema, exchangeApiKeysRequestSchema, exchangeCredentialsRequestSchema, exchangeRefreshTokenRequestSchema, inviteUserToWorkspaceRequestSchema, removeUserFromWorkspaceRequestSchema, resendWorkspaceMembershipInvitationRequestSchema, updateUserRequestSchema, updateWorkspaceRequestSchema };
|
|
@@ -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;
|
package/dist/validators/index.js
CHANGED
|
@@ -32,6 +32,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
32
32
|
* See the License for the specific language governing permissions and
|
|
33
33
|
* limitations under the License.
|
|
34
34
|
*/
|
|
35
|
+
__exportStar(require("./calls"), exports);
|
|
35
36
|
__exportStar(require("./common"), exports);
|
|
36
37
|
__exportStar(require("./hostOrHostPortSchema"), exports);
|
|
37
|
-
__exportStar(require("./
|
|
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,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,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,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,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,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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonoster/common",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.9",
|
|
4
4
|
"description": "Common library for Fonoster projects",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/fonoster#readme",
|
|
@@ -18,12 +18,13 @@
|
|
|
18
18
|
"clean": "rimraf ./dist node_modules tsconfig.tsbuildinfo"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@fonoster/logger": "^0.7.
|
|
21
|
+
"@fonoster/logger": "^0.7.9",
|
|
22
22
|
"@grpc/grpc-js": "~1.10.6",
|
|
23
23
|
"@grpc/proto-loader": "^0.7.12",
|
|
24
24
|
"grpc-health-check": "^2.0.2",
|
|
25
25
|
"handlebars": "^4.7.8",
|
|
26
26
|
"nodemailer": "^6.9.13",
|
|
27
|
+
"validator": "^13.12.0",
|
|
27
28
|
"zod-validation-error": "^3.3.0"
|
|
28
29
|
},
|
|
29
30
|
"files": [
|
|
@@ -42,5 +43,5 @@
|
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@types/nodemailer": "^6.4.14"
|
|
44
45
|
},
|
|
45
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "3b16a5ed87b84d03534bb20de4d59d5bbb51a742"
|
|
46
47
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
declare const listCallsRequestSchema: z.ZodObject<{
|
|
3
|
-
after: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
4
|
-
before: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
5
|
-
pageSize: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
6
|
-
pageToken: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
7
|
-
}, "strip", z.ZodTypeAny, {
|
|
8
|
-
after?: string;
|
|
9
|
-
before?: string;
|
|
10
|
-
pageSize?: number;
|
|
11
|
-
pageToken?: string;
|
|
12
|
-
}, {
|
|
13
|
-
after?: string;
|
|
14
|
-
before?: string;
|
|
15
|
-
pageSize?: number;
|
|
16
|
-
pageToken?: string;
|
|
17
|
-
}>;
|
|
18
|
-
export { listCallsRequestSchema };
|