@nubea-ecomm/wapo-sdk 0.2.0 → 0.4.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.
@@ -1,6 +1,34 @@
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
+ language?: ConsoleUser['language'];
18
+ }): Promise<unknown>;
19
+ confirm(token: string): Promise<unknown>;
20
+ resendConfirmation(email: string): Promise<unknown>;
21
+ recover(email: string): Promise<unknown>;
22
+ resetPassword(token: string, password: string): Promise<unknown>;
23
+ createProject(name: string): Promise<{
24
+ data: Project;
25
+ }>;
26
+ acceptProjectInvitation(token: string): Promise<{
27
+ data: {
28
+ project_id: string;
29
+ accepted: boolean;
30
+ };
31
+ }>;
4
32
  me(): Promise<{
5
33
  data: {
6
34
  user: ConsoleUser;
@@ -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[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nubea-ecomm/wapo-sdk",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Typed JavaScript and TypeScript client for the Wapo messaging API",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",