@fonoster/identity-client 0.20.0 → 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 +29 -0
- package/dist/index.js +17 -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;
|
|
@@ -41,6 +57,8 @@ export interface InviteMemberRequest {
|
|
|
41
57
|
}
|
|
42
58
|
/** Channel a verification code is sent over. */
|
|
43
59
|
export type ContactType = "EMAIL" | "PHONE";
|
|
60
|
+
/** OAuth2 providers Identity can exchange an authorization code for. */
|
|
61
|
+
export type Oauth2Provider = "GITHUB";
|
|
44
62
|
export interface WorkspaceAccess {
|
|
45
63
|
accessKeyId: string;
|
|
46
64
|
role: string;
|
|
@@ -81,6 +99,10 @@ export declare class IdentityClient {
|
|
|
81
99
|
}>;
|
|
82
100
|
exchangeCredentials(request: ExchangeCredentialsRequest): Promise<ExchangeResponse>;
|
|
83
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>;
|
|
84
106
|
createWorkspace(name: string, token: string): Promise<{
|
|
85
107
|
ref: string;
|
|
86
108
|
}>;
|
|
@@ -108,6 +130,13 @@ export declare class IdentityClient {
|
|
|
108
130
|
resendWorkspaceMembershipInvitation(userRef: string, accessKeyId: string, token: string): Promise<{
|
|
109
131
|
userRef: string;
|
|
110
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
|
+
}>;
|
|
111
140
|
sendVerificationCode(contactType: ContactType, value: string): Promise<void>;
|
|
112
141
|
verifyCode(username: string, contactType: ContactType, value: string, verificationCode: string): Promise<void>;
|
|
113
142
|
sendResetPasswordCode(username: string, resetPasswordUrl: string): Promise<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
|
}
|
|
@@ -163,6 +171,15 @@ class IdentityClient {
|
|
|
163
171
|
resendWorkspaceMembershipInvitation(userRef, accessKeyId, token) {
|
|
164
172
|
return this.unary("resendWorkspaceMembershipInvitation", { userRef }, { token, accessKeyId });
|
|
165
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
|
+
}
|
|
166
183
|
sendVerificationCode(contactType, value) {
|
|
167
184
|
return this.unary("sendVerificationCode", { contactType, value });
|
|
168
185
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonoster/identity-client",
|
|
3
|
-
"version": "0.20.
|
|
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
|
}
|