@nubea-ecomm/wapo-sdk 0.2.0 → 0.3.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/auth-client.d.ts +28 -1
- package/dist/auth-client.js +35 -0
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/auth-client.d.ts
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
import { Transport } from './transport.js';
|
|
2
|
-
import type { ConsoleUser } from './types.js';
|
|
2
|
+
import type { ConsoleUser, Project } from './types.js';
|
|
3
3
|
export declare class WapoAuthClient extends Transport {
|
|
4
|
+
sessions(): Promise<{
|
|
5
|
+
data: {
|
|
6
|
+
id: string;
|
|
7
|
+
expires_at: string;
|
|
8
|
+
current: boolean;
|
|
9
|
+
}[];
|
|
10
|
+
}>;
|
|
11
|
+
revokeSession(id: string): Promise<unknown>;
|
|
12
|
+
changePassword(currentPassword: string, password: string): Promise<unknown>;
|
|
13
|
+
register(input: {
|
|
14
|
+
name: string;
|
|
15
|
+
email: string;
|
|
16
|
+
password: string;
|
|
17
|
+
}): Promise<unknown>;
|
|
18
|
+
confirm(token: string): Promise<unknown>;
|
|
19
|
+
resendConfirmation(email: string): Promise<unknown>;
|
|
20
|
+
recover(email: string): Promise<unknown>;
|
|
21
|
+
resetPassword(token: string, password: string): Promise<unknown>;
|
|
22
|
+
createProject(name: string): Promise<{
|
|
23
|
+
data: Project;
|
|
24
|
+
}>;
|
|
25
|
+
acceptProjectInvitation(token: string): Promise<{
|
|
26
|
+
data: {
|
|
27
|
+
project_id: string;
|
|
28
|
+
accepted: boolean;
|
|
29
|
+
};
|
|
30
|
+
}>;
|
|
4
31
|
me(): Promise<{
|
|
5
32
|
data: {
|
|
6
33
|
user: ConsoleUser;
|
package/dist/auth-client.js
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
import { Transport } from './transport.js';
|
|
2
2
|
export class WapoAuthClient extends Transport {
|
|
3
|
+
sessions() {
|
|
4
|
+
return this.request('GET', '/auth/v1/sessions');
|
|
5
|
+
}
|
|
6
|
+
revokeSession(id) {
|
|
7
|
+
return this.request('DELETE', `/auth/v1/sessions/${encodeURIComponent(id)}`);
|
|
8
|
+
}
|
|
9
|
+
changePassword(currentPassword, password) {
|
|
10
|
+
return this.request('POST', '/auth/v1/password', {
|
|
11
|
+
current_password: currentPassword,
|
|
12
|
+
password,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
register(input) {
|
|
16
|
+
return this.request('POST', '/auth/v1/register', input);
|
|
17
|
+
}
|
|
18
|
+
confirm(token) {
|
|
19
|
+
return this.request('POST', '/auth/v1/confirm', { token });
|
|
20
|
+
}
|
|
21
|
+
resendConfirmation(email) {
|
|
22
|
+
return this.request('POST', '/auth/v1/confirm/resend', { email });
|
|
23
|
+
}
|
|
24
|
+
recover(email) {
|
|
25
|
+
return this.request('POST', '/auth/v1/recover', { email });
|
|
26
|
+
}
|
|
27
|
+
resetPassword(token, password) {
|
|
28
|
+
return this.request('POST', '/auth/v1/recover/end', { token, password });
|
|
29
|
+
}
|
|
30
|
+
createProject(name) {
|
|
31
|
+
return this.request('POST', '/auth/v1/projects', {
|
|
32
|
+
name,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
acceptProjectInvitation(token) {
|
|
36
|
+
return this.request('POST', `/auth/v1/project-invitations/${encodeURIComponent(token)}`);
|
|
37
|
+
}
|
|
3
38
|
me() {
|
|
4
39
|
return this.request('GET', '/auth/v1/me');
|
|
5
40
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -174,6 +174,7 @@ export interface CustomerInput {
|
|
|
174
174
|
metadata?: Record<string, unknown>;
|
|
175
175
|
}
|
|
176
176
|
export interface ConsoleUser {
|
|
177
|
+
project_roles?: Record<string, 'admin' | 'member' | 'viewer' | 'billing'>;
|
|
177
178
|
role: UserRole;
|
|
178
179
|
all_projects: boolean;
|
|
179
180
|
project_ids: string[];
|