@fonoster/identity 0.6.1 → 0.6.2-alpha.0
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/createApiKey.d.ts +2 -19
- package/dist/apikeys/createApiKey.js +8 -5
- package/dist/apikeys/deleteApiKey.d.ts +3 -14
- package/dist/apikeys/index.d.ts +0 -1
- package/dist/apikeys/index.js +0 -1
- package/dist/apikeys/listApiKeys.d.ts +1 -17
- package/dist/apikeys/regenerateApiKey.d.ts +2 -15
- package/dist/exchanges/exchangeCredentials.d.ts +2 -2
- package/dist/exchanges/payloads/users/getAccessTokenPayload.js +20 -2
- package/dist/exchanges/types.d.ts +1 -1
- package/dist/roles.js +5 -6
- package/dist/service.d.ts +32 -134
- package/dist/users/createUser.d.ts +2 -22
- package/dist/users/deleteUser.d.ts +3 -9
- package/dist/users/getUser.d.ts +2 -12
- package/dist/users/updateUser.d.ts +2 -22
- package/dist/utils/getApiKeyByAccessKeyId.d.ts +1 -1
- package/dist/utils/getUserByEmail.d.ts +3 -3
- package/dist/workspaces/createWorkspace.d.ts +2 -13
- package/dist/workspaces/deleteWorkspace.d.ts +3 -8
- package/dist/workspaces/deleteWorkspace.js +1 -4
- package/dist/workspaces/getWorkspace.d.ts +2 -11
- package/dist/workspaces/index.d.ts +0 -1
- package/dist/workspaces/index.js +0 -1
- package/dist/workspaces/inviteUserToWorkspace.d.ts +2 -24
- package/dist/workspaces/inviteUserToWorkspace.js +5 -9
- package/dist/workspaces/isAdminMember.js +2 -2
- package/dist/workspaces/isWorkspaceMember.js +1 -1
- package/dist/workspaces/listWorkspaces.d.ts +1 -10
- package/dist/workspaces/removeUserFromWorkspace.d.ts +1 -6
- package/dist/workspaces/resendWorkspaceMembershipInvitation.d.ts +1 -6
- package/dist/workspaces/updateWorkspace.d.ts +2 -16
- package/dist/workspaces/updateWorkspace.js +1 -4
- package/package.json +4 -3
- package/dist/apikeys/ApiRoleEnum.d.ts +0 -4
- package/dist/apikeys/ApiRoleEnum.js +0 -25
- package/dist/workspaces/WorkspaceRoleEnum.d.ts +0 -6
- package/dist/workspaces/WorkspaceRoleEnum.js +0 -27
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
import { GrpcErrorMessage } from "@fonoster/common";
|
|
2
|
-
import {
|
|
3
|
-
import { ApiRoleEnum } from "./ApiRoleEnum";
|
|
2
|
+
import { CreateApiKeyRequest, CreateApiKeyResponse } from "@fonoster/types";
|
|
4
3
|
import { Prisma } from "../db";
|
|
5
|
-
declare const CreatApiKeyRequestSchema: z.ZodObject<{
|
|
6
|
-
role: z.ZodEnum<[ApiRoleEnum]>;
|
|
7
|
-
expiresAt: z.ZodEffects<z.ZodNumber, number, number>;
|
|
8
|
-
}, "strip", z.ZodTypeAny, {
|
|
9
|
-
role?: ApiRoleEnum;
|
|
10
|
-
expiresAt?: number;
|
|
11
|
-
}, {
|
|
12
|
-
role?: ApiRoleEnum;
|
|
13
|
-
expiresAt?: number;
|
|
14
|
-
}>;
|
|
15
|
-
type CreateApiKeyRequest = z.infer<typeof CreatApiKeyRequestSchema>;
|
|
16
|
-
type CreateApiKeyResponse = {
|
|
17
|
-
ref: string;
|
|
18
|
-
accessKeyId: string;
|
|
19
|
-
accessKeySecret: string;
|
|
20
|
-
};
|
|
21
4
|
declare function createApiKey(prisma: Prisma): (call: {
|
|
22
5
|
request: CreateApiKeyRequest;
|
|
23
6
|
}, callback: (error: GrpcErrorMessage, response?: CreateApiKeyResponse) => void) => Promise<void>;
|
|
24
|
-
export { createApiKey };
|
|
7
|
+
export { createApiKey, CreateApiKeyRequest, CreateApiKeyResponse };
|
|
@@ -30,20 +30,23 @@ exports.createApiKey = createApiKey;
|
|
|
30
30
|
*/
|
|
31
31
|
const common_1 = require("@fonoster/common");
|
|
32
32
|
const logger_1 = require("@fonoster/logger");
|
|
33
|
+
const types_1 = require("@fonoster/types");
|
|
33
34
|
const zod_1 = require("zod");
|
|
34
|
-
const ApiRoleEnum_1 = require("./ApiRoleEnum");
|
|
35
35
|
const utils_1 = require("../utils");
|
|
36
36
|
const generateAccessKeyId_1 = require("../utils/generateAccessKeyId");
|
|
37
37
|
const generateAccessKeySecret_1 = require("../utils/generateAccessKeySecret");
|
|
38
38
|
const logger = (0, logger_1.getLogger)({ service: "identity", filePath: __filename });
|
|
39
|
-
const
|
|
40
|
-
role: zod_1.z.enum([
|
|
41
|
-
expiresAt: zod_1.z
|
|
39
|
+
const CreateApiKeyRequestSchema = zod_1.z.object({
|
|
40
|
+
role: zod_1.z.enum([types_1.ApiRoleEnum.WORKSPACE_ADMIN]),
|
|
41
|
+
expiresAt: zod_1.z
|
|
42
|
+
.number()
|
|
43
|
+
.transform((value) => (value === 0 ? null : value))
|
|
44
|
+
.optional()
|
|
42
45
|
});
|
|
43
46
|
function createApiKey(prisma) {
|
|
44
47
|
return (call, callback) => __awaiter(this, void 0, void 0, function* () {
|
|
45
48
|
try {
|
|
46
|
-
const validatedRequest =
|
|
49
|
+
const validatedRequest = CreateApiKeyRequestSchema.parse(call.request);
|
|
47
50
|
const accessKeyId = (0, utils_1.getAccessKeyIdFromCall)(call);
|
|
48
51
|
const { role, expiresAt } = validatedRequest;
|
|
49
52
|
logger.info("creating new ApiKey", { accessKeyId, role, expiresAt });
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
import { GrpcErrorMessage } from "@fonoster/common";
|
|
2
|
-
import {
|
|
2
|
+
import { BaseApiObject } from "@fonoster/types";
|
|
3
3
|
import { Prisma } from "../db";
|
|
4
|
-
declare const DeleteApiKeyRequestSchema: z.ZodObject<{
|
|
5
|
-
ref: z.ZodString;
|
|
6
|
-
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
ref?: string;
|
|
8
|
-
}, {
|
|
9
|
-
ref?: string;
|
|
10
|
-
}>;
|
|
11
|
-
type DeleteApiKeyRequest = z.infer<typeof DeleteApiKeyRequestSchema>;
|
|
12
|
-
type DeleteApiKeyResponse = {
|
|
13
|
-
ref: string;
|
|
14
|
-
};
|
|
15
4
|
declare function deleteApiKey(prisma: Prisma): (call: {
|
|
16
|
-
request:
|
|
17
|
-
}, callback: (error: GrpcErrorMessage, response?:
|
|
5
|
+
request: BaseApiObject;
|
|
6
|
+
}, callback: (error: GrpcErrorMessage, response?: BaseApiObject) => void) => Promise<void>;
|
|
18
7
|
export { deleteApiKey };
|
package/dist/apikeys/index.d.ts
CHANGED
package/dist/apikeys/index.js
CHANGED
|
@@ -1,22 +1,6 @@
|
|
|
1
1
|
import { GrpcErrorMessage } from "@fonoster/common";
|
|
2
|
-
import {
|
|
2
|
+
import { ListApiKeysRequest, ListApiKeysResponse } from "@fonoster/types";
|
|
3
3
|
import { Prisma } from "../db";
|
|
4
|
-
type ListApiKeysRequest = {
|
|
5
|
-
pageSize: number;
|
|
6
|
-
pageToken: string;
|
|
7
|
-
};
|
|
8
|
-
type ApiKey = {
|
|
9
|
-
ref: string;
|
|
10
|
-
accessKeyId: string;
|
|
11
|
-
role: ApiRoleEnum;
|
|
12
|
-
expiresAt: Date;
|
|
13
|
-
createdAt: Date;
|
|
14
|
-
updatedAt: Date;
|
|
15
|
-
};
|
|
16
|
-
type ListApiKeysResponse = {
|
|
17
|
-
items: ApiKey[];
|
|
18
|
-
nextPageToken?: string;
|
|
19
|
-
};
|
|
20
4
|
declare function listApiKeys(prisma: Prisma): (call: {
|
|
21
5
|
request: ListApiKeysRequest;
|
|
22
6
|
}, callback: (error: GrpcErrorMessage, response?: ListApiKeysResponse) => void) => Promise<void>;
|
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
import { GrpcErrorMessage } from "@fonoster/common";
|
|
2
|
-
import {
|
|
2
|
+
import { BaseApiObject, RegenerateApiKeyResponse } from "@fonoster/types";
|
|
3
3
|
import { Prisma } from "../db";
|
|
4
|
-
declare const RegenerateApiKeyRequestSchema: z.ZodObject<{
|
|
5
|
-
ref: z.ZodString;
|
|
6
|
-
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
ref?: string;
|
|
8
|
-
}, {
|
|
9
|
-
ref?: string;
|
|
10
|
-
}>;
|
|
11
|
-
type RegenerateApiKeyRequest = z.infer<typeof RegenerateApiKeyRequestSchema>;
|
|
12
|
-
type RegenerateApiKeyResponse = {
|
|
13
|
-
ref: string;
|
|
14
|
-
accessKeyId: string;
|
|
15
|
-
accessKeySecret: string;
|
|
16
|
-
};
|
|
17
4
|
declare function regenerateApiKey(prisma: Prisma): (call: {
|
|
18
|
-
request:
|
|
5
|
+
request: BaseApiObject;
|
|
19
6
|
}, callback: (error: GrpcErrorMessage, response?: RegenerateApiKeyResponse) => void) => Promise<void>;
|
|
20
7
|
export { regenerateApiKey };
|
|
@@ -6,11 +6,11 @@ declare const ExchangeCredentialsRequestSchema: z.ZodObject<{
|
|
|
6
6
|
username: z.ZodString;
|
|
7
7
|
password: z.ZodString;
|
|
8
8
|
}, "strip", z.ZodTypeAny, {
|
|
9
|
-
password?: string;
|
|
10
9
|
username?: string;
|
|
11
|
-
}, {
|
|
12
10
|
password?: string;
|
|
11
|
+
}, {
|
|
13
12
|
username?: string;
|
|
13
|
+
password?: string;
|
|
14
14
|
}>;
|
|
15
15
|
type ExchangeCredentialsRequest = z.infer<typeof ExchangeCredentialsRequestSchema>;
|
|
16
16
|
type ExchangeCredentialsResponse = {
|
|
@@ -10,7 +10,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.getAccessTokenPayload = getAccessTokenPayload;
|
|
13
|
-
|
|
13
|
+
/*
|
|
14
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
15
|
+
* http://github.com/fonoster/fonoster
|
|
16
|
+
*
|
|
17
|
+
* This file is part of Fonoster
|
|
18
|
+
*
|
|
19
|
+
* Licensed under the MIT License (the "License");
|
|
20
|
+
* you may not use this file except in compliance with
|
|
21
|
+
* the License. You may obtain a copy of the License at
|
|
22
|
+
*
|
|
23
|
+
* https://opensource.org/licenses/MIT
|
|
24
|
+
*
|
|
25
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
26
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
27
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
28
|
+
* See the License for the specific language governing permissions and
|
|
29
|
+
* limitations under the License.
|
|
30
|
+
*/
|
|
31
|
+
const types_1 = require("@fonoster/types");
|
|
14
32
|
const TokenUseEnum_1 = require("../../TokenUseEnum");
|
|
15
33
|
function getAccessTokenPayload(prisma, identityConfig) {
|
|
16
34
|
return (accessKeyId) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -34,7 +52,7 @@ function getAccessTokenPayload(prisma, identityConfig) {
|
|
|
34
52
|
const { ref, ownedWorkspaces, memberships } = user;
|
|
35
53
|
const access = ownedWorkspaces.map((workspace) => ({
|
|
36
54
|
accessKeyId: workspace.accessKeyId,
|
|
37
|
-
role:
|
|
55
|
+
role: types_1.WorkspaceRoleEnum.OWNER
|
|
38
56
|
}));
|
|
39
57
|
memberships.forEach((membership) => {
|
|
40
58
|
access.push({
|
package/dist/roles.js
CHANGED
|
@@ -20,8 +20,7 @@ exports.VOICE_SERVICE_ROLE = exports.workspaceAccess = exports.roles = void 0;
|
|
|
20
20
|
* See the License for the specific language governing permissions and
|
|
21
21
|
* limitations under the License.
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
24
|
-
const WorkspaceRoleEnum_1 = require("./workspaces/WorkspaceRoleEnum");
|
|
23
|
+
const types_1 = require("@fonoster/types");
|
|
25
24
|
const VOICE_SERVICE_ROLE = "VOICE_SERVICE";
|
|
26
25
|
exports.VOICE_SERVICE_ROLE = VOICE_SERVICE_ROLE;
|
|
27
26
|
const workspaceAccess = [
|
|
@@ -91,22 +90,22 @@ const fullIdentityAccess = [
|
|
|
91
90
|
];
|
|
92
91
|
const roles = [
|
|
93
92
|
{
|
|
94
|
-
name:
|
|
93
|
+
name: types_1.WorkspaceRoleEnum.OWNER,
|
|
95
94
|
description: "Access to all endpoints",
|
|
96
95
|
access: [...fullIdentityAccess, ...workspaceAccess]
|
|
97
96
|
},
|
|
98
97
|
{
|
|
99
|
-
name:
|
|
98
|
+
name: types_1.WorkspaceRoleEnum.ADMIN,
|
|
100
99
|
description: "Access to all endpoints",
|
|
101
100
|
access: [...fullIdentityAccess, ...workspaceAccess]
|
|
102
101
|
},
|
|
103
102
|
{
|
|
104
|
-
name:
|
|
103
|
+
name: types_1.ApiRoleEnum.WORKSPACE_ADMIN,
|
|
105
104
|
description: "Access to all endpoints",
|
|
106
105
|
access: [...fullIdentityAccess, ...workspaceAccess]
|
|
107
106
|
},
|
|
108
107
|
{
|
|
109
|
-
name:
|
|
108
|
+
name: types_1.WorkspaceRoleEnum.USER,
|
|
110
109
|
description: "Access to User and Workspace endpoints",
|
|
111
110
|
access: [
|
|
112
111
|
"/fonoster.identity.v1beta2.Identity/GetUser",
|
package/dist/service.d.ts
CHANGED
|
@@ -14,155 +14,53 @@ declare function buildIdentityService(identityConfig: IdentityConfig): {
|
|
|
14
14
|
};
|
|
15
15
|
handlers: {
|
|
16
16
|
createWorkspace: (call: {
|
|
17
|
-
request:
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
21
|
-
ref: string;
|
|
22
|
-
}) => void) => Promise<void>;
|
|
17
|
+
request: import("@fonoster/types").CreateWorkspaceRequest;
|
|
18
|
+
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").BaseApiObject) => void) => Promise<void>;
|
|
23
19
|
deleteWorkspace: (call: {
|
|
24
|
-
request:
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
28
|
-
ref: string;
|
|
29
|
-
}) => void) => Promise<void>;
|
|
20
|
+
request: import("@fonoster/types").BaseApiObject;
|
|
21
|
+
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").BaseApiObject) => void) => Promise<void>;
|
|
30
22
|
getWorkspace: (call: {
|
|
31
|
-
request:
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
35
|
-
ref: string;
|
|
36
|
-
name: string;
|
|
37
|
-
ownerRef: string;
|
|
38
|
-
createdAt: Date;
|
|
39
|
-
updatedAt: Date;
|
|
40
|
-
}) => void) => Promise<void>;
|
|
23
|
+
request: import("@fonoster/types").BaseApiObject;
|
|
24
|
+
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").Workspace) => void) => Promise<void>;
|
|
41
25
|
updateWorkspace: (call: {
|
|
42
|
-
request:
|
|
43
|
-
|
|
44
|
-
ref?: string;
|
|
45
|
-
};
|
|
46
|
-
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
47
|
-
ref: string;
|
|
48
|
-
}) => void) => Promise<void>;
|
|
26
|
+
request: import("@fonoster/types").UpdateWorkspaceRequest;
|
|
27
|
+
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").BaseApiObject) => void) => Promise<void>;
|
|
49
28
|
listWorkspaces: (call: {
|
|
50
29
|
request: unknown;
|
|
51
|
-
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?:
|
|
52
|
-
workspaces: {
|
|
53
|
-
ref: string;
|
|
54
|
-
name: string;
|
|
55
|
-
ownerRef: string;
|
|
56
|
-
createdAt: Date;
|
|
57
|
-
updatedAt: Date;
|
|
58
|
-
}[];
|
|
59
|
-
}) => void) => Promise<any[]>;
|
|
30
|
+
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").ListWorkspacesResponse) => void) => Promise<any[]>;
|
|
60
31
|
inviteUserToWorkspace: (call: {
|
|
61
|
-
request:
|
|
62
|
-
|
|
63
|
-
email?: string;
|
|
64
|
-
password?: string;
|
|
65
|
-
role?: import(".").WorkspaceRoleEnum.ADMIN | import(".").WorkspaceRoleEnum.USER;
|
|
66
|
-
};
|
|
67
|
-
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
68
|
-
workspaceRef: string;
|
|
69
|
-
userRef: string;
|
|
70
|
-
}) => void) => Promise<void>;
|
|
32
|
+
request: import("@fonoster/types").InviteUserToWorkspaceRequest;
|
|
33
|
+
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").InviteUserToWorkspaceResponse) => void) => Promise<void>;
|
|
71
34
|
resendWorkspaceMembershipInvitation: (call: {
|
|
72
|
-
request:
|
|
73
|
-
|
|
74
|
-
};
|
|
75
|
-
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
76
|
-
userRef: string;
|
|
77
|
-
}) => void) => Promise<void>;
|
|
35
|
+
request: import("@fonoster/types").ResendWorkspaceMembershipInvitationRequest;
|
|
36
|
+
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").ResendWorkspaceMembershipInvitationResponse) => void) => Promise<void>;
|
|
78
37
|
removeUserFromWorkspace: (call: {
|
|
79
|
-
request:
|
|
80
|
-
|
|
81
|
-
};
|
|
82
|
-
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
83
|
-
userRef: string;
|
|
84
|
-
}) => void) => Promise<void>;
|
|
38
|
+
request: import("@fonoster/types").RemoveUserFromWorkspaceRequest;
|
|
39
|
+
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").RemoveUserFromWorkspaceResponse) => void) => Promise<void>;
|
|
85
40
|
createUser: (call: {
|
|
86
|
-
request:
|
|
87
|
-
|
|
88
|
-
email?: string;
|
|
89
|
-
password?: string;
|
|
90
|
-
avatar?: string;
|
|
91
|
-
};
|
|
92
|
-
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
93
|
-
ref: string;
|
|
94
|
-
}) => void) => Promise<void>;
|
|
41
|
+
request: import("@fonoster/types").CreateUserRequest;
|
|
42
|
+
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").BaseApiObject) => void) => Promise<void>;
|
|
95
43
|
getUser: (call: {
|
|
96
|
-
request:
|
|
97
|
-
|
|
98
|
-
};
|
|
99
|
-
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
100
|
-
ref: string;
|
|
101
|
-
email: string;
|
|
102
|
-
name: string;
|
|
103
|
-
avatar: string;
|
|
104
|
-
createdAt: Date;
|
|
105
|
-
updatedAt: Date;
|
|
106
|
-
}) => void) => Promise<void>;
|
|
44
|
+
request: import("@fonoster/types").BaseApiObject;
|
|
45
|
+
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").User) => void) => Promise<void>;
|
|
107
46
|
deleteUser: (call: {
|
|
108
|
-
request:
|
|
109
|
-
|
|
110
|
-
};
|
|
111
|
-
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
112
|
-
ref: string;
|
|
113
|
-
}) => void) => Promise<void>;
|
|
47
|
+
request: import("@fonoster/common").BaseApiObject;
|
|
48
|
+
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/common").BaseApiObject) => void) => Promise<void>;
|
|
114
49
|
updateUser: (call: {
|
|
115
|
-
request:
|
|
116
|
-
|
|
117
|
-
ref?: string;
|
|
118
|
-
password?: string;
|
|
119
|
-
avatar?: string;
|
|
120
|
-
};
|
|
121
|
-
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
122
|
-
ref: string;
|
|
123
|
-
}) => void) => Promise<void>;
|
|
50
|
+
request: import("@fonoster/types").UpdateUserRequest;
|
|
51
|
+
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").BaseApiObject) => void) => Promise<void>;
|
|
124
52
|
createApiKey: (call: {
|
|
125
|
-
request:
|
|
126
|
-
|
|
127
|
-
expiresAt?: number;
|
|
128
|
-
};
|
|
129
|
-
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
130
|
-
ref: string;
|
|
131
|
-
accessKeyId: string;
|
|
132
|
-
accessKeySecret: string;
|
|
133
|
-
}) => void) => Promise<void>;
|
|
53
|
+
request: import("@fonoster/types/dist/identity.types").CreateApiKeyRequest;
|
|
54
|
+
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types/dist/identity.types").CreateApiKeyResponse) => void) => Promise<void>;
|
|
134
55
|
deleteApiKey: (call: {
|
|
135
|
-
request:
|
|
136
|
-
|
|
137
|
-
};
|
|
138
|
-
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
139
|
-
ref: string;
|
|
140
|
-
}) => void) => Promise<void>;
|
|
56
|
+
request: import("@fonoster/types").BaseApiObject;
|
|
57
|
+
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").BaseApiObject) => void) => Promise<void>;
|
|
141
58
|
listApiKeys: (call: {
|
|
142
|
-
request:
|
|
143
|
-
|
|
144
|
-
pageToken: string;
|
|
145
|
-
};
|
|
146
|
-
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
147
|
-
items: {
|
|
148
|
-
ref: string;
|
|
149
|
-
accessKeyId: string;
|
|
150
|
-
role: import(".").ApiRoleEnum;
|
|
151
|
-
expiresAt: Date;
|
|
152
|
-
createdAt: Date;
|
|
153
|
-
updatedAt: Date;
|
|
154
|
-
}[];
|
|
155
|
-
nextPageToken?: string;
|
|
156
|
-
}) => void) => Promise<void>;
|
|
59
|
+
request: import("@fonoster/types").ListApiKeysRequest;
|
|
60
|
+
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").ListApiKeysResponse) => void) => Promise<void>;
|
|
157
61
|
regenerateApiKey: (call: {
|
|
158
|
-
request:
|
|
159
|
-
|
|
160
|
-
};
|
|
161
|
-
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
162
|
-
ref: string;
|
|
163
|
-
accessKeyId: string;
|
|
164
|
-
accessKeySecret: string;
|
|
165
|
-
}) => void) => Promise<void>;
|
|
62
|
+
request: import("@fonoster/types").BaseApiObject;
|
|
63
|
+
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").RegenerateApiKeyResponse) => void) => Promise<void>;
|
|
166
64
|
exchangeApiKey: (call: {
|
|
167
65
|
request: {
|
|
168
66
|
accessKeyId?: string;
|
|
@@ -175,8 +73,8 @@ declare function buildIdentityService(identityConfig: IdentityConfig): {
|
|
|
175
73
|
}) => void) => Promise<void>;
|
|
176
74
|
exchangeCredentials: (call: {
|
|
177
75
|
request: {
|
|
178
|
-
password?: string;
|
|
179
76
|
username?: string;
|
|
77
|
+
password?: string;
|
|
180
78
|
};
|
|
181
79
|
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
182
80
|
idToken: string;
|
|
@@ -1,27 +1,7 @@
|
|
|
1
1
|
import { GrpcErrorMessage } from "@fonoster/common";
|
|
2
|
-
import {
|
|
2
|
+
import { BaseApiObject, CreateUserRequest } from "@fonoster/types";
|
|
3
3
|
import { Prisma } from "../db";
|
|
4
|
-
declare const CreateUserRequestSchema: z.ZodObject<{
|
|
5
|
-
name: z.ZodString;
|
|
6
|
-
email: z.ZodString;
|
|
7
|
-
password: z.ZodString;
|
|
8
|
-
avatar: z.ZodString;
|
|
9
|
-
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
name?: string;
|
|
11
|
-
email?: string;
|
|
12
|
-
password?: string;
|
|
13
|
-
avatar?: string;
|
|
14
|
-
}, {
|
|
15
|
-
name?: string;
|
|
16
|
-
email?: string;
|
|
17
|
-
password?: string;
|
|
18
|
-
avatar?: string;
|
|
19
|
-
}>;
|
|
20
|
-
type CreateUserRequest = z.infer<typeof CreateUserRequestSchema>;
|
|
21
|
-
type CreateUserResponse = {
|
|
22
|
-
ref: string;
|
|
23
|
-
};
|
|
24
4
|
declare function createUser(prisma: Prisma): (call: {
|
|
25
5
|
request: CreateUserRequest;
|
|
26
|
-
}, callback: (error: GrpcErrorMessage, response?:
|
|
6
|
+
}, callback: (error: GrpcErrorMessage, response?: BaseApiObject) => void) => Promise<void>;
|
|
27
7
|
export { createUser };
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import { GrpcErrorMessage } from "@fonoster/common";
|
|
1
|
+
import { BaseApiObject, GrpcErrorMessage } from "@fonoster/common";
|
|
2
2
|
import { Prisma } from "../db";
|
|
3
|
-
type DeleteUserRequest = {
|
|
4
|
-
ref: string;
|
|
5
|
-
};
|
|
6
|
-
type DeleteUserResponse = {
|
|
7
|
-
ref: string;
|
|
8
|
-
};
|
|
9
3
|
declare function deleteUser(prisma: Prisma): (call: {
|
|
10
|
-
request:
|
|
11
|
-
}, callback: (error: GrpcErrorMessage, response?:
|
|
4
|
+
request: BaseApiObject;
|
|
5
|
+
}, callback: (error: GrpcErrorMessage, response?: BaseApiObject) => void) => Promise<void>;
|
|
12
6
|
export { deleteUser };
|
package/dist/users/getUser.d.ts
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
import { GrpcErrorMessage } from "@fonoster/common";
|
|
2
|
+
import { BaseApiObject, User } from "@fonoster/types";
|
|
2
3
|
import { Prisma } from "../db";
|
|
3
|
-
type GetUserRequest = {
|
|
4
|
-
ref: string;
|
|
5
|
-
};
|
|
6
|
-
type User = {
|
|
7
|
-
ref: string;
|
|
8
|
-
email: string;
|
|
9
|
-
name: string;
|
|
10
|
-
avatar: string;
|
|
11
|
-
createdAt: Date;
|
|
12
|
-
updatedAt: Date;
|
|
13
|
-
};
|
|
14
4
|
declare function getUser(prisma: Prisma): (call: {
|
|
15
|
-
request:
|
|
5
|
+
request: BaseApiObject;
|
|
16
6
|
}, callback: (error: GrpcErrorMessage, response?: User) => void) => Promise<void>;
|
|
17
7
|
export { getUser };
|
|
@@ -1,27 +1,7 @@
|
|
|
1
1
|
import { GrpcErrorMessage } from "@fonoster/common";
|
|
2
|
-
import {
|
|
2
|
+
import { BaseApiObject, UpdateUserRequest } from "@fonoster/types";
|
|
3
3
|
import { Prisma } from "../db";
|
|
4
|
-
declare const UpdateUserRequestSchema: z.ZodObject<{
|
|
5
|
-
ref: z.ZodString;
|
|
6
|
-
name: z.ZodUnion<[z.ZodString, z.ZodNullable<z.ZodOptional<z.ZodString>>]>;
|
|
7
|
-
password: z.ZodUnion<[z.ZodString, z.ZodNullable<z.ZodOptional<z.ZodString>>]>;
|
|
8
|
-
avatar: z.ZodUnion<[z.ZodString, z.ZodNullable<z.ZodOptional<z.ZodString>>]>;
|
|
9
|
-
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
name?: string;
|
|
11
|
-
ref?: string;
|
|
12
|
-
password?: string;
|
|
13
|
-
avatar?: string;
|
|
14
|
-
}, {
|
|
15
|
-
name?: string;
|
|
16
|
-
ref?: string;
|
|
17
|
-
password?: string;
|
|
18
|
-
avatar?: string;
|
|
19
|
-
}>;
|
|
20
|
-
type UpdateUserRequest = z.infer<typeof UpdateUserRequestSchema>;
|
|
21
|
-
type UpdateUserResponse = {
|
|
22
|
-
ref: string;
|
|
23
|
-
};
|
|
24
4
|
declare function updateUser(prisma: Prisma): (call: {
|
|
25
5
|
request: UpdateUserRequest;
|
|
26
|
-
}, callback: (error: GrpcErrorMessage, response?:
|
|
6
|
+
}, callback: (error: GrpcErrorMessage, response?: BaseApiObject) => void) => Promise<void>;
|
|
27
7
|
export { updateUser };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Prisma } from "../db";
|
|
2
2
|
declare function getApiKeyByAccessKeyId(prisma: Prisma): (accessKeyId: string) => Promise<{
|
|
3
3
|
ref: string;
|
|
4
|
-
accessKeyId: string;
|
|
5
4
|
createdAt: Date;
|
|
6
5
|
updatedAt: Date;
|
|
6
|
+
accessKeyId: string;
|
|
7
7
|
role: "WORKSPACE_ADMIN";
|
|
8
8
|
workspaceRef: string;
|
|
9
9
|
accessKeySecret: string;
|
|
@@ -3,13 +3,13 @@ declare function getUserByEmail(prisma: Prisma): (email: string) => Promise<{
|
|
|
3
3
|
name: string;
|
|
4
4
|
ref: string;
|
|
5
5
|
email: string;
|
|
6
|
+
createdAt: Date;
|
|
7
|
+
updatedAt: Date;
|
|
8
|
+
password: string;
|
|
6
9
|
accessKeyId: string;
|
|
7
10
|
emailVerified: boolean;
|
|
8
|
-
password: string;
|
|
9
11
|
phoneNumber: string;
|
|
10
12
|
phoneNumberVerified: boolean;
|
|
11
13
|
avatar: string;
|
|
12
|
-
createdAt: Date;
|
|
13
|
-
updatedAt: Date;
|
|
14
14
|
}>;
|
|
15
15
|
export { getUserByEmail };
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
import { GrpcErrorMessage } from "@fonoster/common";
|
|
2
|
-
import {
|
|
2
|
+
import { BaseApiObject, CreateWorkspaceRequest } from "@fonoster/types";
|
|
3
3
|
import { Prisma } from "../db";
|
|
4
|
-
declare const CreateWorkspaceRequestSchema: z.ZodObject<{
|
|
5
|
-
name: z.ZodString;
|
|
6
|
-
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
name?: string;
|
|
8
|
-
}, {
|
|
9
|
-
name?: string;
|
|
10
|
-
}>;
|
|
11
|
-
type CreateWorkspaceRequest = z.infer<typeof CreateWorkspaceRequestSchema>;
|
|
12
|
-
type CreateWorkspaceResponse = {
|
|
13
|
-
ref: string;
|
|
14
|
-
};
|
|
15
4
|
declare function createWorkspace(prisma: Prisma): (call: {
|
|
16
5
|
request: CreateWorkspaceRequest;
|
|
17
|
-
}, callback: (error: GrpcErrorMessage, response?:
|
|
6
|
+
}, callback: (error: GrpcErrorMessage, response?: BaseApiObject) => void) => Promise<void>;
|
|
18
7
|
export { createWorkspace };
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { GrpcErrorMessage } from "@fonoster/common";
|
|
2
|
+
import { BaseApiObject } from "@fonoster/types";
|
|
2
3
|
import { Prisma } from "../db";
|
|
3
|
-
type DeleteWorkspaceRequest = {
|
|
4
|
-
ref: string;
|
|
5
|
-
};
|
|
6
|
-
type DeleteWorkspaceResponse = {
|
|
7
|
-
ref: string;
|
|
8
|
-
};
|
|
9
4
|
declare function deleteWorkspace(prisma: Prisma): (call: {
|
|
10
|
-
request:
|
|
11
|
-
}, callback: (error: GrpcErrorMessage, response?:
|
|
5
|
+
request: BaseApiObject;
|
|
6
|
+
}, callback: (error: GrpcErrorMessage, response?: BaseApiObject) => void) => Promise<void>;
|
|
12
7
|
export { deleteWorkspace };
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import { GrpcErrorMessage } from "@fonoster/common";
|
|
2
|
+
import { BaseApiObject, Workspace } from "@fonoster/types";
|
|
2
3
|
import { Prisma } from "../db";
|
|
3
|
-
type GetWorkspaceRequest = {
|
|
4
|
-
ref: string;
|
|
5
|
-
};
|
|
6
|
-
type Workspace = {
|
|
7
|
-
ref: string;
|
|
8
|
-
name: string;
|
|
9
|
-
ownerRef: string;
|
|
10
|
-
createdAt: Date;
|
|
11
|
-
updatedAt: Date;
|
|
12
|
-
};
|
|
13
4
|
declare function getWorkspace(prisma: Prisma): (call: {
|
|
14
|
-
request:
|
|
5
|
+
request: BaseApiObject;
|
|
15
6
|
}, callback: (error: GrpcErrorMessage, response?: Workspace) => void) => Promise<void>;
|
|
16
7
|
export { getWorkspace };
|
package/dist/workspaces/index.js
CHANGED
|
@@ -40,4 +40,3 @@ __exportStar(require("./listWorkspaces"), exports);
|
|
|
40
40
|
__exportStar(require("./inviteUserToWorkspace"), exports);
|
|
41
41
|
__exportStar(require("./removeUserFromWorkspace"), exports);
|
|
42
42
|
__exportStar(require("./resendWorkspaceMembershipInvitation"), exports);
|
|
43
|
-
__exportStar(require("./WorkspaceRoleEnum"), exports);
|
|
@@ -1,31 +1,9 @@
|
|
|
1
1
|
import { GrpcErrorMessage } from "@fonoster/common";
|
|
2
|
-
import {
|
|
3
|
-
import { WorkspaceRoleEnum } from "./WorkspaceRoleEnum";
|
|
2
|
+
import { InviteUserToWorkspaceRequest, InviteUserToWorkspaceResponse } from "@fonoster/types";
|
|
4
3
|
import { Prisma } from "../db";
|
|
5
4
|
import { IdentityConfig } from "../exchanges/types";
|
|
6
5
|
import { SendInvite } from "../invites/sendInvite";
|
|
7
|
-
declare const InviteUserToWorkspaceRequestSchema: z.ZodObject<{
|
|
8
|
-
email: z.ZodString;
|
|
9
|
-
name: z.ZodString;
|
|
10
|
-
role: z.ZodEnum<[WorkspaceRoleEnum.ADMIN, WorkspaceRoleEnum.USER]>;
|
|
11
|
-
password: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
|
|
12
|
-
}, "strip", z.ZodTypeAny, {
|
|
13
|
-
name?: string;
|
|
14
|
-
email?: string;
|
|
15
|
-
password?: string;
|
|
16
|
-
role?: WorkspaceRoleEnum.ADMIN | WorkspaceRoleEnum.USER;
|
|
17
|
-
}, {
|
|
18
|
-
name?: string;
|
|
19
|
-
email?: string;
|
|
20
|
-
password?: string;
|
|
21
|
-
role?: WorkspaceRoleEnum.ADMIN | WorkspaceRoleEnum.USER;
|
|
22
|
-
}>;
|
|
23
|
-
type InviteUserToWorkspaceRequest = z.infer<typeof InviteUserToWorkspaceRequestSchema>;
|
|
24
|
-
type CreateWorkspaceResponse = {
|
|
25
|
-
workspaceRef: string;
|
|
26
|
-
userRef: string;
|
|
27
|
-
};
|
|
28
6
|
declare function inviteUserToWorkspace(prisma: Prisma, identityConfig: IdentityConfig, sendInvite: SendInvite): (call: {
|
|
29
7
|
request: InviteUserToWorkspaceRequest;
|
|
30
|
-
}, callback: (error: GrpcErrorMessage, response?:
|
|
8
|
+
}, callback: (error: GrpcErrorMessage, response?: InviteUserToWorkspaceResponse) => void) => Promise<void>;
|
|
31
9
|
export { inviteUserToWorkspace };
|
|
@@ -30,13 +30,13 @@ exports.inviteUserToWorkspace = inviteUserToWorkspace;
|
|
|
30
30
|
*/
|
|
31
31
|
const common_1 = require("@fonoster/common");
|
|
32
32
|
const logger_1 = require("@fonoster/logger");
|
|
33
|
+
const types_1 = require("@fonoster/types");
|
|
33
34
|
const grpc_js_1 = require("@grpc/grpc-js");
|
|
34
35
|
const nanoid_1 = require("nanoid");
|
|
35
36
|
const zod_1 = require("zod");
|
|
36
37
|
const createSendEmail_1 = require("./createSendEmail");
|
|
37
38
|
const isAdminMember_1 = require("./isAdminMember");
|
|
38
39
|
const isWorkspaceMember_1 = require("./isWorkspaceMember");
|
|
39
|
-
const WorkspaceRoleEnum_1 = require("./WorkspaceRoleEnum");
|
|
40
40
|
const utils_1 = require("../utils");
|
|
41
41
|
const getTokenFromCall_1 = require("../utils/getTokenFromCall");
|
|
42
42
|
const getUserRefFromToken_1 = require("../utils/getUserRefFromToken");
|
|
@@ -44,7 +44,7 @@ const logger = (0, logger_1.getLogger)({ service: "identity", filePath: __filena
|
|
|
44
44
|
const InviteUserToWorkspaceRequestSchema = zod_1.z.object({
|
|
45
45
|
email: zod_1.z.string().email(),
|
|
46
46
|
name: zod_1.z.string().min(3, "Name must contain at least 3 characters").max(50),
|
|
47
|
-
role: zod_1.z.enum([
|
|
47
|
+
role: zod_1.z.enum([types_1.WorkspaceRoleEnum.ADMIN, types_1.WorkspaceRoleEnum.USER]),
|
|
48
48
|
password: zod_1.z
|
|
49
49
|
.string()
|
|
50
50
|
.min(6, "Password must contain at least 8 characters")
|
|
@@ -78,11 +78,6 @@ const createUser = (prisma) => {
|
|
|
78
78
|
});
|
|
79
79
|
});
|
|
80
80
|
};
|
|
81
|
-
var WorkspaceMemberStatus;
|
|
82
|
-
(function (WorkspaceMemberStatus) {
|
|
83
|
-
WorkspaceMemberStatus["PENDING"] = "PENDING";
|
|
84
|
-
WorkspaceMemberStatus["ACTIVE"] = "ACTIVE";
|
|
85
|
-
})(WorkspaceMemberStatus || (WorkspaceMemberStatus = {}));
|
|
86
81
|
function inviteUserToWorkspace(prisma, identityConfig, sendInvite) {
|
|
87
82
|
return (call, callback) => __awaiter(this, void 0, void 0, function* () {
|
|
88
83
|
try {
|
|
@@ -117,7 +112,8 @@ function inviteUserToWorkspace(prisma, identityConfig, sendInvite) {
|
|
|
117
112
|
user = yield createUser(prisma)({
|
|
118
113
|
name,
|
|
119
114
|
email,
|
|
120
|
-
password: oneTimePassword
|
|
115
|
+
password: oneTimePassword,
|
|
116
|
+
role
|
|
121
117
|
});
|
|
122
118
|
}
|
|
123
119
|
const newMember = yield prisma.workspaceMember.create({
|
|
@@ -125,7 +121,7 @@ function inviteUserToWorkspace(prisma, identityConfig, sendInvite) {
|
|
|
125
121
|
userRef: user.ref,
|
|
126
122
|
workspaceRef,
|
|
127
123
|
role: role,
|
|
128
|
-
status: WorkspaceMemberStatus.PENDING
|
|
124
|
+
status: types_1.WorkspaceMemberStatus.PENDING
|
|
129
125
|
},
|
|
130
126
|
include: {
|
|
131
127
|
workspace: true
|
|
@@ -28,7 +28,7 @@ exports.isAdminMember = isAdminMember;
|
|
|
28
28
|
* See the License for the specific language governing permissions and
|
|
29
29
|
* limitations under the License.
|
|
30
30
|
*/
|
|
31
|
-
const
|
|
31
|
+
const types_1 = require("@fonoster/types");
|
|
32
32
|
function isAdminMember(prisma) {
|
|
33
33
|
return (workspaceRef, adminRef) => __awaiter(this, void 0, void 0, function* () {
|
|
34
34
|
var _a;
|
|
@@ -47,6 +47,6 @@ function isAdminMember(prisma) {
|
|
|
47
47
|
return true;
|
|
48
48
|
}
|
|
49
49
|
const role = (_a = workspace === null || workspace === void 0 ? void 0 : workspace.members.find((member) => member.ref === adminRef)) === null || _a === void 0 ? void 0 : _a.role;
|
|
50
|
-
return role ===
|
|
50
|
+
return role === types_1.WorkspaceRoleEnum.ADMIN || role === types_1.WorkspaceRoleEnum.OWNER;
|
|
51
51
|
});
|
|
52
52
|
}
|
|
@@ -20,7 +20,7 @@ function isWorkspaceMember(prisma) {
|
|
|
20
20
|
const isMember = yield prisma.workspaceMember.findFirst({
|
|
21
21
|
where: {
|
|
22
22
|
// Force userId to be an empty string to ensure that the query is not
|
|
23
|
-
//
|
|
23
|
+
// filter by workspaceRef only
|
|
24
24
|
userRef: userRef || "",
|
|
25
25
|
workspaceRef
|
|
26
26
|
}
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import { GrpcErrorMessage } from "@fonoster/common";
|
|
2
|
+
import { ListWorkspacesResponse } from "@fonoster/types";
|
|
2
3
|
import { Prisma } from "../db";
|
|
3
|
-
type Workspace = {
|
|
4
|
-
ref: string;
|
|
5
|
-
name: string;
|
|
6
|
-
ownerRef: string;
|
|
7
|
-
createdAt: Date;
|
|
8
|
-
updatedAt: Date;
|
|
9
|
-
};
|
|
10
|
-
type ListWorkspacesResponse = {
|
|
11
|
-
workspaces: Workspace[];
|
|
12
|
-
};
|
|
13
4
|
declare function listWorkspaces(prisma: Prisma): (call: {
|
|
14
5
|
request: unknown;
|
|
15
6
|
}, callback: (error: GrpcErrorMessage, response?: ListWorkspacesResponse) => void) => Promise<any[]>;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { GrpcErrorMessage } from "@fonoster/common";
|
|
2
|
+
import { RemoveUserFromWorkspaceRequest, RemoveUserFromWorkspaceResponse } from "@fonoster/types";
|
|
2
3
|
import { Prisma } from "../db";
|
|
3
|
-
type RemoveUserFromWorkspaceRequest = {
|
|
4
|
-
userRef: string;
|
|
5
|
-
};
|
|
6
|
-
type RemoveUserFromWorkspaceResponse = {
|
|
7
|
-
userRef: string;
|
|
8
|
-
};
|
|
9
4
|
declare function removeUserFromWorkspace(prisma: Prisma): (call: {
|
|
10
5
|
request: RemoveUserFromWorkspaceRequest;
|
|
11
6
|
}, callback: (error: GrpcErrorMessage, response?: RemoveUserFromWorkspaceResponse) => void) => Promise<void>;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { GrpcErrorMessage } from "@fonoster/common";
|
|
2
|
+
import { ResendWorkspaceMembershipInvitationRequest, ResendWorkspaceMembershipInvitationResponse } from "@fonoster/types";
|
|
2
3
|
import { Prisma } from "../db";
|
|
3
4
|
import { IdentityConfig } from "../exchanges/types";
|
|
4
5
|
import { SendInvite } from "../invites/sendInvite";
|
|
5
|
-
type ResendWorkspaceMembershipInvitationRequest = {
|
|
6
|
-
userRef: string;
|
|
7
|
-
};
|
|
8
|
-
type ResendWorkspaceMembershipInvitationResponse = {
|
|
9
|
-
userRef: string;
|
|
10
|
-
};
|
|
11
6
|
declare function resendWorkspaceMembershipInvitation(prisma: Prisma, identityConfig: IdentityConfig, sendInvite: SendInvite): (call: {
|
|
12
7
|
request: ResendWorkspaceMembershipInvitationRequest;
|
|
13
8
|
}, callback: (error: GrpcErrorMessage, response?: ResendWorkspaceMembershipInvitationResponse) => void) => Promise<void>;
|
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
import { GrpcErrorMessage } from "@fonoster/common";
|
|
2
|
-
import {
|
|
2
|
+
import { BaseApiObject, UpdateWorkspaceRequest } from "@fonoster/types";
|
|
3
3
|
import { Prisma } from "../db";
|
|
4
|
-
declare const UpdateWorkspaceRequestSchema: z.ZodObject<{
|
|
5
|
-
ref: z.ZodString;
|
|
6
|
-
name: z.ZodUnion<[z.ZodString, z.ZodNullable<z.ZodOptional<z.ZodString>>]>;
|
|
7
|
-
}, "strip", z.ZodTypeAny, {
|
|
8
|
-
name?: string;
|
|
9
|
-
ref?: string;
|
|
10
|
-
}, {
|
|
11
|
-
name?: string;
|
|
12
|
-
ref?: string;
|
|
13
|
-
}>;
|
|
14
|
-
type UpdateWorkspaceRequest = z.infer<typeof UpdateWorkspaceRequestSchema>;
|
|
15
|
-
type UpdateWorkspaceResponse = {
|
|
16
|
-
ref: string;
|
|
17
|
-
};
|
|
18
4
|
declare function updateWorkspace(prisma: Prisma): (call: {
|
|
19
5
|
request: UpdateWorkspaceRequest;
|
|
20
|
-
}, callback: (error: GrpcErrorMessage, response?:
|
|
6
|
+
}, callback: (error: GrpcErrorMessage, response?: BaseApiObject) => void) => Promise<void>;
|
|
21
7
|
export { updateWorkspace };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonoster/identity",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2-alpha.0",
|
|
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,8 +20,9 @@
|
|
|
20
20
|
"fonoster": "./dist/index.js"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@fonoster/common": "^0.6.
|
|
23
|
+
"@fonoster/common": "^0.6.2-alpha.0",
|
|
24
24
|
"@fonoster/logger": "^0.6.1",
|
|
25
|
+
"@fonoster/types": "^0.6.2-alpha.0",
|
|
25
26
|
"@grpc/grpc-js": "~1.10.6",
|
|
26
27
|
"@prisma/client": "^5.14.0",
|
|
27
28
|
"jsonwebtoken": "^9.0.2",
|
|
@@ -46,5 +47,5 @@
|
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"@types/jsonwebtoken": "^9.0.6"
|
|
48
49
|
},
|
|
49
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "16ee05408eb3680afbf5ad2d313e889e89e3ef6d"
|
|
50
51
|
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApiRoleEnum = 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
|
-
var ApiRoleEnum;
|
|
23
|
-
(function (ApiRoleEnum) {
|
|
24
|
-
ApiRoleEnum["WORKSPACE_ADMIN"] = "WORKSPACE_ADMIN";
|
|
25
|
-
})(ApiRoleEnum || (exports.ApiRoleEnum = ApiRoleEnum = {}));
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WorkspaceRoleEnum = 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
|
-
var WorkspaceRoleEnum;
|
|
23
|
-
(function (WorkspaceRoleEnum) {
|
|
24
|
-
WorkspaceRoleEnum["OWNER"] = "OWNER";
|
|
25
|
-
WorkspaceRoleEnum["ADMIN"] = "ADMIN";
|
|
26
|
-
WorkspaceRoleEnum["USER"] = "USER";
|
|
27
|
-
})(WorkspaceRoleEnum || (exports.WorkspaceRoleEnum = WorkspaceRoleEnum = {}));
|