@fonoster/identity 0.6.2 → 0.6.6
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/apikeys/listApiKeys.js +1 -8
- package/dist/createAuthInterceptor.js +1 -1
- package/dist/roles.js +6 -5
- package/dist/service.d.ts +1 -1
- package/dist/utils/getUserByEmail.d.ts +1 -1
- package/dist/workspaces/listWorkspaces.d.ts +1 -1
- package/dist/workspaces/listWorkspaces.js +6 -5
- package/package.json +4 -4
|
@@ -32,14 +32,7 @@ function listApiKeys(prisma) {
|
|
|
32
32
|
skip: pageToken ? 1 : 0,
|
|
33
33
|
cursor: pageToken ? { ref: pageToken } : undefined
|
|
34
34
|
});
|
|
35
|
-
const items = keys.map((key) => ({
|
|
36
|
-
ref: key.ref,
|
|
37
|
-
accessKeyId: key.accessKeyId,
|
|
38
|
-
role: key.role,
|
|
39
|
-
expiresAt: key.expiresAt,
|
|
40
|
-
createdAt: key.createdAt,
|
|
41
|
-
updatedAt: key.updatedAt
|
|
42
|
-
}));
|
|
35
|
+
const items = keys.map((key) => (Object.assign(Object.assign({}, key), { role: key.role })));
|
|
43
36
|
const response = {
|
|
44
37
|
items,
|
|
45
38
|
nextPageToken: (_a = items[items.length - 1]) === null || _a === void 0 ? void 0 : _a.ref
|
|
@@ -48,7 +48,7 @@ function createAuthInterceptor(identityPublicKey, publicPath) {
|
|
|
48
48
|
const accessKeyId = (0, utils_1.getAccessKeyIdFromCall)(call);
|
|
49
49
|
logger.verbose("intercepting api call to path", { accessKeyId, path });
|
|
50
50
|
if (publicPath.includes(methodDefinition.path)) {
|
|
51
|
-
logger.verbose("
|
|
51
|
+
logger.verbose("passing auth control to edge function", { path });
|
|
52
52
|
return call;
|
|
53
53
|
}
|
|
54
54
|
const token = (0, utils_1.getTokenFromCall)(call);
|
package/dist/roles.js
CHANGED
|
@@ -79,6 +79,7 @@ const fullIdentityAccess = [
|
|
|
79
79
|
"/fonoster.identity.v1beta2.Identity/GetWorkspace",
|
|
80
80
|
"/fonoster.identity.v1beta2.Identity/UpdateWorkspace",
|
|
81
81
|
"/fonoster.identity.v1beta2.Identity/ListWorkspaces",
|
|
82
|
+
"/fonoster.identity.v1beta2.Identity/DeleteWorkspace",
|
|
82
83
|
"/fonoster.identity.v1beta2.Identity/InviteUserToWorkspace",
|
|
83
84
|
"/fonoster.identity.v1beta2.Identity/RemoveUserFromWorkspace",
|
|
84
85
|
"/fonoster.identity.v1beta2.Identity/ResendWorkspaceMembershipInvitation",
|
|
@@ -99,11 +100,6 @@ const roles = [
|
|
|
99
100
|
description: "Access to all endpoints",
|
|
100
101
|
access: [...fullIdentityAccess, ...workspaceAccess]
|
|
101
102
|
},
|
|
102
|
-
{
|
|
103
|
-
name: types_1.ApiRoleEnum.WORKSPACE_ADMIN,
|
|
104
|
-
description: "Access to all endpoints",
|
|
105
|
-
access: [...fullIdentityAccess, ...workspaceAccess]
|
|
106
|
-
},
|
|
107
103
|
{
|
|
108
104
|
name: types_1.WorkspaceRoleEnum.USER,
|
|
109
105
|
description: "Access to User and Workspace endpoints",
|
|
@@ -119,6 +115,11 @@ const roles = [
|
|
|
119
115
|
...workspaceAccess
|
|
120
116
|
]
|
|
121
117
|
},
|
|
118
|
+
{
|
|
119
|
+
name: types_1.ApiRoleEnum.WORKSPACE_ADMIN,
|
|
120
|
+
description: "Access to all endpoints",
|
|
121
|
+
access: [...fullIdentityAccess, ...workspaceAccess]
|
|
122
|
+
},
|
|
122
123
|
{
|
|
123
124
|
name: VOICE_SERVICE_ROLE,
|
|
124
125
|
description: "Role with access only to the Voice service endpoint",
|
package/dist/service.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ declare function buildIdentityService(identityConfig: IdentityConfig): {
|
|
|
27
27
|
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").BaseApiObject) => void) => Promise<void>;
|
|
28
28
|
listWorkspaces: (call: {
|
|
29
29
|
request: unknown;
|
|
30
|
-
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").ListWorkspacesResponse) => void) => Promise<
|
|
30
|
+
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").ListWorkspacesResponse) => void) => Promise<void>;
|
|
31
31
|
inviteUserToWorkspace: (call: {
|
|
32
32
|
request: import("@fonoster/types").InviteUserToWorkspaceRequest;
|
|
33
33
|
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").InviteUserToWorkspaceResponse) => void) => Promise<void>;
|
|
@@ -5,9 +5,9 @@ declare function getUserByEmail(prisma: Prisma): (email: string) => Promise<{
|
|
|
5
5
|
email: string;
|
|
6
6
|
createdAt: Date;
|
|
7
7
|
updatedAt: Date;
|
|
8
|
-
password: string;
|
|
9
8
|
accessKeyId: string;
|
|
10
9
|
emailVerified: boolean;
|
|
10
|
+
password: string;
|
|
11
11
|
phoneNumber: string;
|
|
12
12
|
phoneNumberVerified: boolean;
|
|
13
13
|
avatar: string;
|
|
@@ -3,5 +3,5 @@ import { ListWorkspacesResponse } from "@fonoster/types";
|
|
|
3
3
|
import { Prisma } from "../db";
|
|
4
4
|
declare function listWorkspaces(prisma: Prisma): (call: {
|
|
5
5
|
request: unknown;
|
|
6
|
-
}, callback: (error: GrpcErrorMessage, response?: ListWorkspacesResponse) => void) => Promise<
|
|
6
|
+
}, callback: (error: GrpcErrorMessage, response?: ListWorkspacesResponse) => void) => Promise<void>;
|
|
7
7
|
export { listWorkspaces };
|
|
@@ -17,7 +17,7 @@ const getUserRefFromToken_1 = require("../utils/getUserRefFromToken");
|
|
|
17
17
|
const logger = (0, logger_1.getLogger)({ service: "identity", filePath: __filename });
|
|
18
18
|
function listWorkspaces(prisma) {
|
|
19
19
|
return (call, callback) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
var _a;
|
|
20
|
+
var _a, _b;
|
|
21
21
|
const token = (0, getTokenFromCall_1.getTokenFromCall)(call);
|
|
22
22
|
const userRef = (0, getUserRefFromToken_1.getUserRefFromToken)(token);
|
|
23
23
|
const access = (0, utils_1.decodeToken)(token);
|
|
@@ -26,7 +26,7 @@ function listWorkspaces(prisma) {
|
|
|
26
26
|
userRef,
|
|
27
27
|
workspacesAccessKeyIds
|
|
28
28
|
});
|
|
29
|
-
const
|
|
29
|
+
const items = yield prisma.workspace.findMany({
|
|
30
30
|
where: {
|
|
31
31
|
OR: [
|
|
32
32
|
{
|
|
@@ -47,8 +47,9 @@ function listWorkspaces(prisma) {
|
|
|
47
47
|
]
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
callback(null, {
|
|
51
|
+
items,
|
|
52
|
+
nextPageToken: (_b = items[items.length - 1]) === null || _b === void 0 ? void 0 : _b.ref
|
|
53
|
+
});
|
|
53
54
|
});
|
|
54
55
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonoster/identity",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6",
|
|
4
4
|
"description": "Identity service for Fonoster",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/fonoster#readme",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"fonoster": "./dist/index.js"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@fonoster/common": "^0.6.
|
|
23
|
+
"@fonoster/common": "^0.6.6",
|
|
24
24
|
"@fonoster/logger": "^0.6.2",
|
|
25
|
-
"@fonoster/types": "^0.6.
|
|
25
|
+
"@fonoster/types": "^0.6.6",
|
|
26
26
|
"@grpc/grpc-js": "~1.10.6",
|
|
27
27
|
"@prisma/client": "^5.14.0",
|
|
28
28
|
"jsonwebtoken": "^9.0.2",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/jsonwebtoken": "^9.0.6"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "258137711c4897a4bda49de369db1722da17ec3f"
|
|
51
51
|
}
|