@fonoster/common 0.9.7 → 0.9.14
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/identity/roles.js
CHANGED
|
@@ -23,7 +23,7 @@ exports.workspaceAccess = exports.roles = exports.VOICE_SERVICE_ROLE = exports.U
|
|
|
23
23
|
const types_1 = require("@fonoster/types");
|
|
24
24
|
const VOICE_SERVICE_ROLE = "VOICE_SERVICE";
|
|
25
25
|
exports.VOICE_SERVICE_ROLE = VOICE_SERVICE_ROLE;
|
|
26
|
-
// The
|
|
26
|
+
// The WorkspaceRole.USER is the same as the USER_ROLE constant
|
|
27
27
|
// We will split this two roles in the future
|
|
28
28
|
const USER_ROLE = "USER";
|
|
29
29
|
exports.USER_ROLE = USER_ROLE;
|
|
@@ -83,6 +83,7 @@ const fullIdentityAccess = [
|
|
|
83
83
|
"/fonoster.identity.v1beta2.Identity/GetWorkspace",
|
|
84
84
|
"/fonoster.identity.v1beta2.Identity/UpdateWorkspace",
|
|
85
85
|
"/fonoster.identity.v1beta2.Identity/ListWorkspaces",
|
|
86
|
+
"/fonoster.identity.v1beta2.Identity/ListWorkspaceMembers",
|
|
86
87
|
"/fonoster.identity.v1beta2.Identity/DeleteWorkspace",
|
|
87
88
|
"/fonoster.identity.v1beta2.Identity/InviteUserToWorkspace",
|
|
88
89
|
"/fonoster.identity.v1beta2.Identity/RemoveUserFromWorkspace",
|
|
@@ -95,12 +96,12 @@ const fullIdentityAccess = [
|
|
|
95
96
|
];
|
|
96
97
|
const roles = [
|
|
97
98
|
{
|
|
98
|
-
name: types_1.
|
|
99
|
+
name: types_1.WorkspaceRole.OWNER,
|
|
99
100
|
description: "Access to all endpoints",
|
|
100
101
|
access: [...fullIdentityAccess, ...workspaceAccess]
|
|
101
102
|
},
|
|
102
103
|
{
|
|
103
|
-
name: types_1.
|
|
104
|
+
name: types_1.WorkspaceRole.ADMIN,
|
|
104
105
|
description: "Access to all endpoints",
|
|
105
106
|
access: [...fullIdentityAccess, ...workspaceAccess]
|
|
106
107
|
},
|
|
@@ -120,7 +121,7 @@ const roles = [
|
|
|
120
121
|
]
|
|
121
122
|
},
|
|
122
123
|
{
|
|
123
|
-
name: types_1.
|
|
124
|
+
name: types_1.ApiRole.WORKSPACE_ADMIN,
|
|
124
125
|
description: "Access to all endpoints",
|
|
125
126
|
access: [...fullIdentityAccess, ...workspaceAccess]
|
|
126
127
|
},
|
package/dist/identity/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WorkspaceRole } from "@fonoster/types";
|
|
2
2
|
declare enum TokenUseEnum {
|
|
3
3
|
ID = "id",
|
|
4
4
|
ACCESS = "access",
|
|
@@ -15,7 +15,7 @@ type Role = {
|
|
|
15
15
|
};
|
|
16
16
|
type Access = {
|
|
17
17
|
accessKeyId: string;
|
|
18
|
-
role:
|
|
18
|
+
role: WorkspaceRole;
|
|
19
19
|
};
|
|
20
20
|
type BaseToken = {
|
|
21
21
|
iss: string;
|
|
@@ -32,7 +32,8 @@ service Identity {
|
|
|
32
32
|
rpc InviteUserToWorkspace (InviteUserToWorkspaceRequest) returns (InviteUserToWorkspaceResponse) {}
|
|
33
33
|
rpc RemoveUserFromWorkspace (RemoveUserFromWorkspaceRequest) returns (RemoveUserFromWorkspaceResponse) {}
|
|
34
34
|
rpc ResendWorkspaceMembershipInvitation (ResendWorkspaceMembershipInvitationRequest) returns (ResendWorkspaceMembershipInvitationResponse) {}
|
|
35
|
-
|
|
35
|
+
rpc ListWorkspaceMembers (ListWorkspaceMembersRequest) returns (ListWorkspaceMembersResponse) {}
|
|
36
|
+
|
|
36
37
|
// User specific actions
|
|
37
38
|
rpc CreateUser (CreateUserRequest) returns (CreateUserResponse) {}
|
|
38
39
|
rpc GetUser (GetUserRequest) returns (User) {}
|
|
@@ -134,6 +135,27 @@ message ResendWorkspaceMembershipInvitationResponse {
|
|
|
134
135
|
string user_ref = 1;
|
|
135
136
|
}
|
|
136
137
|
|
|
138
|
+
message Member {
|
|
139
|
+
string ref = 1;
|
|
140
|
+
string user_ref = 2;
|
|
141
|
+
string name = 3;
|
|
142
|
+
string email = 4;
|
|
143
|
+
string role = 5;
|
|
144
|
+
string status = 6;
|
|
145
|
+
int32 created_at = 7;
|
|
146
|
+
int32 updated_at = 8;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
message ListWorkspaceMembersRequest {
|
|
150
|
+
string page_token = 1;
|
|
151
|
+
int32 page_size = 2;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
message ListWorkspaceMembersResponse {
|
|
155
|
+
repeated Member items = 1;
|
|
156
|
+
string next_page_token = 2;
|
|
157
|
+
}
|
|
158
|
+
|
|
137
159
|
// User Resources
|
|
138
160
|
enum ContactType {
|
|
139
161
|
EMAIL = 0;
|
|
@@ -217,8 +239,8 @@ message DeleteApiKeyResponse {
|
|
|
217
239
|
}
|
|
218
240
|
|
|
219
241
|
message ListApiKeysRequest {
|
|
220
|
-
|
|
221
|
-
|
|
242
|
+
string page_token = 1;
|
|
243
|
+
int32 page_size = 2;
|
|
222
244
|
}
|
|
223
245
|
|
|
224
246
|
message ListApiKeysResponse {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ApiRole, WorkspaceRole } from "@fonoster/types";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
declare const createWorkspaceRequestSchema: z.ZodObject<{
|
|
4
4
|
name: z.ZodString;
|
|
@@ -8,13 +8,13 @@ declare const createWorkspaceRequestSchema: z.ZodObject<{
|
|
|
8
8
|
name?: string;
|
|
9
9
|
}>;
|
|
10
10
|
declare const createApiKeyRequestSchema: z.ZodObject<{
|
|
11
|
-
role: z.ZodEnum<[
|
|
11
|
+
role: z.ZodEnum<[ApiRole]>;
|
|
12
12
|
expiresAt: z.ZodOptional<z.ZodNumber>;
|
|
13
13
|
}, "strip", z.ZodTypeAny, {
|
|
14
|
-
role?:
|
|
14
|
+
role?: ApiRole;
|
|
15
15
|
expiresAt?: number;
|
|
16
16
|
}, {
|
|
17
|
-
role?:
|
|
17
|
+
role?: ApiRole;
|
|
18
18
|
expiresAt?: number;
|
|
19
19
|
}>;
|
|
20
20
|
declare const exchangeApiKeysRequestSchema: z.ZodObject<{
|
|
@@ -92,16 +92,16 @@ declare const updateUserRequestSchema: z.ZodObject<{
|
|
|
92
92
|
declare const inviteUserToWorkspaceRequestSchema: z.ZodObject<{
|
|
93
93
|
email: z.ZodString;
|
|
94
94
|
name: z.ZodString;
|
|
95
|
-
role: z.ZodEnum<[
|
|
95
|
+
role: z.ZodEnum<[WorkspaceRole.ADMIN, WorkspaceRole.USER]>;
|
|
96
96
|
password: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
|
|
97
97
|
}, "strip", z.ZodTypeAny, {
|
|
98
98
|
name?: string;
|
|
99
|
-
role?:
|
|
99
|
+
role?: WorkspaceRole.ADMIN | WorkspaceRole.USER;
|
|
100
100
|
password?: string;
|
|
101
101
|
email?: string;
|
|
102
102
|
}, {
|
|
103
103
|
name?: string;
|
|
104
|
-
role?:
|
|
104
|
+
role?: WorkspaceRole.ADMIN | WorkspaceRole.USER;
|
|
105
105
|
password?: string;
|
|
106
106
|
email?: string;
|
|
107
107
|
}>;
|
|
@@ -36,7 +36,7 @@ const createWorkspaceRequestSchema = zod_1.z.object({
|
|
|
36
36
|
});
|
|
37
37
|
exports.createWorkspaceRequestSchema = createWorkspaceRequestSchema;
|
|
38
38
|
const createApiKeyRequestSchema = zod_1.z.object({
|
|
39
|
-
role: zod_1.z.enum([types_1.
|
|
39
|
+
role: zod_1.z.enum([types_1.ApiRole.WORKSPACE_ADMIN]),
|
|
40
40
|
expiresAt: zod_1.z
|
|
41
41
|
.number()
|
|
42
42
|
.int({ message: messages_1.POSITIVE_INTEGER_MESSAGE })
|
|
@@ -89,7 +89,7 @@ exports.updateUserRequestSchema = updateUserRequestSchema;
|
|
|
89
89
|
const inviteUserToWorkspaceRequestSchema = zod_1.z.object({
|
|
90
90
|
email: zod_1.z.string().email({ message: EMAIL_MESSAGE }),
|
|
91
91
|
name: zod_1.z.string().max(50, { message: MAX_NAME_MESSAGE }),
|
|
92
|
-
role: zod_1.z.enum([types_1.
|
|
92
|
+
role: zod_1.z.enum([types_1.WorkspaceRole.ADMIN, types_1.WorkspaceRole.USER]),
|
|
93
93
|
password: zod_1.z.string().min(8, { message: PASSWORD_MESSAGE }).or(zod_1.z.undefined())
|
|
94
94
|
});
|
|
95
95
|
exports.inviteUserToWorkspaceRequestSchema = inviteUserToWorkspaceRequestSchema;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonoster/common",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.14",
|
|
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,7 +18,7 @@
|
|
|
18
18
|
"clean": "rimraf ./dist node_modules tsconfig.tsbuildinfo"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@fonoster/logger": "^0.9.
|
|
21
|
+
"@fonoster/logger": "^0.9.12",
|
|
22
22
|
"@grpc/grpc-js": "~1.10.6",
|
|
23
23
|
"@grpc/proto-loader": "^0.7.12",
|
|
24
24
|
"@influxdata/influxdb-client": "^1.35.0",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/nodemailer": "^6.4.14"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "ba1b5e9898fafef1d3c4d3f1e72d3c2326fcec7b"
|
|
52
52
|
}
|