@fonoster/identity-client 0.19.1 → 0.20.1
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 +36 -0
- package/dist/index.js +31 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,22 @@ export interface ExchangeCredentialsRequest {
|
|
|
11
11
|
password: string;
|
|
12
12
|
twoFactorCode?: string;
|
|
13
13
|
}
|
|
14
|
+
export interface User {
|
|
15
|
+
ref: string;
|
|
16
|
+
email: string;
|
|
17
|
+
phone?: string;
|
|
18
|
+
name: string;
|
|
19
|
+
avatar?: string;
|
|
20
|
+
createdAt?: number;
|
|
21
|
+
updatedAt?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface UpdateUserRequest {
|
|
24
|
+
ref: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
password?: string;
|
|
27
|
+
phone?: string;
|
|
28
|
+
avatar?: string;
|
|
29
|
+
}
|
|
14
30
|
export interface ExchangeResponse {
|
|
15
31
|
idToken?: string;
|
|
16
32
|
accessToken: string;
|
|
@@ -39,6 +55,10 @@ export interface InviteMemberRequest {
|
|
|
39
55
|
role: string;
|
|
40
56
|
name?: string;
|
|
41
57
|
}
|
|
58
|
+
/** Channel a verification code is sent over. */
|
|
59
|
+
export type ContactType = "EMAIL" | "PHONE";
|
|
60
|
+
/** OAuth2 providers Identity can exchange an authorization code for. */
|
|
61
|
+
export type Oauth2Provider = "GITHUB";
|
|
42
62
|
export interface WorkspaceAccess {
|
|
43
63
|
accessKeyId: string;
|
|
44
64
|
role: string;
|
|
@@ -79,6 +99,10 @@ export declare class IdentityClient {
|
|
|
79
99
|
}>;
|
|
80
100
|
exchangeCredentials(request: ExchangeCredentialsRequest): Promise<ExchangeResponse>;
|
|
81
101
|
exchangeRefreshToken(refreshToken: string): Promise<ExchangeResponse>;
|
|
102
|
+
/** Exchange an OAuth2 authorization code for tokens (sign in). */
|
|
103
|
+
exchangeOauth2Code(provider: Oauth2Provider, code: string): Promise<ExchangeResponse>;
|
|
104
|
+
/** Create an account from an OAuth2 authorization code, returning tokens (sign up). */
|
|
105
|
+
createUserWithOauth2Code(code: string): Promise<ExchangeResponse>;
|
|
82
106
|
createWorkspace(name: string, token: string): Promise<{
|
|
83
107
|
ref: string;
|
|
84
108
|
}>;
|
|
@@ -90,6 +114,9 @@ export declare class IdentityClient {
|
|
|
90
114
|
updateWorkspace(ref: string, name: string, token: string): Promise<{
|
|
91
115
|
ref: string;
|
|
92
116
|
}>;
|
|
117
|
+
deleteWorkspace(ref: string, token: string): Promise<{
|
|
118
|
+
ref: string;
|
|
119
|
+
}>;
|
|
93
120
|
listWorkspaceMembers(accessKeyId: string, token: string): Promise<{
|
|
94
121
|
items: WorkspaceMember[];
|
|
95
122
|
nextPageToken?: string;
|
|
@@ -103,6 +130,15 @@ export declare class IdentityClient {
|
|
|
103
130
|
resendWorkspaceMembershipInvitation(userRef: string, accessKeyId: string, token: string): Promise<{
|
|
104
131
|
userRef: string;
|
|
105
132
|
}>;
|
|
133
|
+
getUser(ref: string, token: string): Promise<User>;
|
|
134
|
+
updateUser(request: UpdateUserRequest, token: string): Promise<{
|
|
135
|
+
ref: string;
|
|
136
|
+
}>;
|
|
137
|
+
deleteUser(ref: string, token: string): Promise<{
|
|
138
|
+
ref: string;
|
|
139
|
+
}>;
|
|
140
|
+
sendVerificationCode(contactType: ContactType, value: string): Promise<void>;
|
|
141
|
+
verifyCode(username: string, contactType: ContactType, value: string, verificationCode: string): Promise<void>;
|
|
106
142
|
sendResetPasswordCode(username: string, resetPasswordUrl: string): Promise<void>;
|
|
107
143
|
resetPassword(username: string, password: string, verificationCode: string): Promise<void>;
|
|
108
144
|
close(): void;
|
package/dist/index.js
CHANGED
|
@@ -136,6 +136,14 @@ class IdentityClient {
|
|
|
136
136
|
exchangeRefreshToken(refreshToken) {
|
|
137
137
|
return this.unary("exchangeRefreshToken", { refreshToken });
|
|
138
138
|
}
|
|
139
|
+
/** Exchange an OAuth2 authorization code for tokens (sign in). */
|
|
140
|
+
exchangeOauth2Code(provider, code) {
|
|
141
|
+
return this.unary("exchangeOauth2Code", { provider, code });
|
|
142
|
+
}
|
|
143
|
+
/** Create an account from an OAuth2 authorization code, returning tokens (sign up). */
|
|
144
|
+
createUserWithOauth2Code(code) {
|
|
145
|
+
return this.unary("createUserWithOauth2Code", { code });
|
|
146
|
+
}
|
|
139
147
|
createWorkspace(name, token) {
|
|
140
148
|
return this.unary("createWorkspace", { name }, { token });
|
|
141
149
|
}
|
|
@@ -148,6 +156,9 @@ class IdentityClient {
|
|
|
148
156
|
updateWorkspace(ref, name, token) {
|
|
149
157
|
return this.unary("updateWorkspace", { ref, name }, { token });
|
|
150
158
|
}
|
|
159
|
+
deleteWorkspace(ref, token) {
|
|
160
|
+
return this.unary("deleteWorkspace", { ref }, { token });
|
|
161
|
+
}
|
|
151
162
|
listWorkspaceMembers(accessKeyId, token) {
|
|
152
163
|
return this.unary("listWorkspaceMembers", {}, { token, accessKeyId });
|
|
153
164
|
}
|
|
@@ -160,6 +171,26 @@ class IdentityClient {
|
|
|
160
171
|
resendWorkspaceMembershipInvitation(userRef, accessKeyId, token) {
|
|
161
172
|
return this.unary("resendWorkspaceMembershipInvitation", { userRef }, { token, accessKeyId });
|
|
162
173
|
}
|
|
174
|
+
getUser(ref, token) {
|
|
175
|
+
return this.unary("getUser", { ref }, { token });
|
|
176
|
+
}
|
|
177
|
+
updateUser(request, token) {
|
|
178
|
+
return this.unary("updateUser", request, { token });
|
|
179
|
+
}
|
|
180
|
+
deleteUser(ref, token) {
|
|
181
|
+
return this.unary("deleteUser", { ref }, { token });
|
|
182
|
+
}
|
|
183
|
+
sendVerificationCode(contactType, value) {
|
|
184
|
+
return this.unary("sendVerificationCode", { contactType, value });
|
|
185
|
+
}
|
|
186
|
+
verifyCode(username, contactType, value, verificationCode) {
|
|
187
|
+
return this.unary("verifyCode", {
|
|
188
|
+
username,
|
|
189
|
+
contactType,
|
|
190
|
+
value,
|
|
191
|
+
verificationCode
|
|
192
|
+
});
|
|
193
|
+
}
|
|
163
194
|
sendResetPasswordCode(username, resetPasswordUrl) {
|
|
164
195
|
return this.unary("sendResetPasswordCode", { username, resetPasswordUrl });
|
|
165
196
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonoster/identity-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"description": "Lightweight client for the Fonoster Identity gRPC service",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "eb410d1401ac015226cd72b6da920e1fb7b5f0cd"
|
|
32
32
|
}
|