@nangohq/types 0.42.0 → 0.42.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.
@@ -1,31 +1,20 @@
1
1
  import type { ApiError, Endpoint } from '../api';
2
- import type { WebUser } from '../user/api';
3
- export type Signup = Endpoint<{
2
+ import type { ApiUser } from '../user/api';
3
+ export type PostSignup = Endpoint<{
4
4
  Method: 'POST';
5
5
  Path: '/api/v1/account/signup';
6
6
  Body: {
7
7
  email: string;
8
8
  name: string;
9
9
  password: string;
10
+ token?: string | undefined;
10
11
  };
11
- Error: ApiError<'email_already_verified'> | ApiError<'error_creating_user'> | ApiError<'user_already_exists'> | ApiError<'error_creating_account'> | ApiError<'email_not_verified'>;
12
+ Error: ApiError<'email_already_verified'> | ApiError<'error_creating_user'> | ApiError<'user_already_exists'> | ApiError<'error_creating_account'> | ApiError<'invalid_invite_token'> | ApiError<'email_not_verified'>;
12
13
  Success: {
13
- uuid: string;
14
- };
15
- }>;
16
- export type SignupWithToken = Endpoint<{
17
- Method: 'POST';
18
- Path: '/api/v1/account/signup/token';
19
- Body: {
20
- email: string;
21
- name: string;
22
- password: string;
23
- token: string;
24
- accountId: number;
25
- };
26
- Error: ApiError<'error_creating_user'> | ApiError<'user_already_exists'> | ApiError<'invalid_invite_token'> | ApiError<'error_logging_in'> | ApiError<'invalid_account_id'>;
27
- Success: {
28
- user: WebUser;
14
+ data: {
15
+ uuid: string;
16
+ verified: boolean;
17
+ };
29
18
  };
30
19
  }>;
31
20
  export type ValidateEmailAndLogin = Endpoint<{
@@ -36,7 +25,7 @@ export type ValidateEmailAndLogin = Endpoint<{
36
25
  };
37
26
  Error: ApiError<'error_logging_in'> | ApiError<'error_validating_user'> | ApiError<'token_expired'> | ApiError<'error_refreshing_token'>;
38
27
  Success: {
39
- user: WebUser;
28
+ user: ApiUser;
40
29
  };
41
30
  }>;
42
31
  export type ResendVerificationEmailByUuid = Endpoint<{
@@ -86,7 +75,7 @@ export type GetEmailByExpiredToken = Endpoint<{
86
75
  uuid: string;
87
76
  };
88
77
  }>;
89
- export type Signin = Endpoint<{
78
+ export type PostSignin = Endpoint<{
90
79
  Method: 'POST';
91
80
  Path: '/api/v1/account/signin';
92
81
  Body: {
@@ -95,7 +84,7 @@ export type Signin = Endpoint<{
95
84
  };
96
85
  Error: ApiError<'email_not_verified'> | ApiError<'unauthorized'>;
97
86
  Success: {
98
- user: WebUser;
87
+ user: ApiUser;
99
88
  };
100
89
  }>;
101
90
  export type PostForgotPassword = Endpoint<{
@@ -4,9 +4,10 @@ import type { GetOnboardingStatus } from './onboarding/api';
4
4
  import type { SetMetadata, UpdateMetadata } from './connection/api/metadata';
5
5
  import type { PostDeploy, PostDeployConfirmation } from './deploy/api';
6
6
  import type { DeleteTeamUser, GetTeam, PutTeam } from './team/api';
7
- import type { PostForgotPassword, PutResetPassword, Signin, Signup } from './account/api';
7
+ import type { PostForgotPassword, PutResetPassword, PostSignin, PostSignup } from './account/api';
8
8
  import type { DeleteInvite, PostInvite } from './invitations/api';
9
- export type APIEndpoints = Signup | Signin | GetTeam | PutTeam | PostInvite | DeleteInvite | DeleteTeamUser | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | GetOnboardingStatus | SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation;
9
+ import type { GetUser, PatchUser } from './user/api';
10
+ export type APIEndpoints = PostSignup | PostSignin | GetTeam | PutTeam | GetUser | PatchUser | PostInvite | DeleteInvite | DeleteTeamUser | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | GetOnboardingStatus | SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation;
10
11
  /**
11
12
  * Automatically narrow endpoints type with Method + Path
12
13
  */
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export type * from './logs/api.js';
8
8
  export type * from './logs/messages.js';
9
9
  export type * from './account/api.js';
10
10
  export type * from './user/api.js';
11
+ export type * from './user/db.js';
11
12
  export type * from './connection/api/metadata.js';
12
13
  export type * from './connection/db.js';
13
14
  export type * from './invitations/api.js';
@@ -1,4 +1,6 @@
1
1
  import type { Endpoint } from '../api';
2
+ import type { ApiInvitation, ApiTeam } from '../team/api';
3
+ import type { ApiUser } from '../user/api';
2
4
  export type PostInvite = Endpoint<{
3
5
  Method: 'POST';
4
6
  Path: '/api/v1/invite';
@@ -29,3 +31,42 @@ export type DeleteInvite = Endpoint<{
29
31
  };
30
32
  };
31
33
  }>;
34
+ export type GetInvite = Endpoint<{
35
+ Method: 'GET';
36
+ Path: '/api/v1/invite/:id';
37
+ Params: {
38
+ id: string;
39
+ };
40
+ Success: {
41
+ data: {
42
+ invitedBy: ApiUser;
43
+ invitation: ApiInvitation;
44
+ newTeam: ApiTeam;
45
+ newTeamUsers: number;
46
+ };
47
+ };
48
+ }>;
49
+ export type AcceptInvite = Endpoint<{
50
+ Method: 'POST';
51
+ Path: '/api/v1/invite/:id';
52
+ Params: {
53
+ id: string;
54
+ };
55
+ Success: {
56
+ data: {
57
+ success: boolean;
58
+ };
59
+ };
60
+ }>;
61
+ export type DeclineInvite = Endpoint<{
62
+ Method: 'DELETE';
63
+ Path: '/api/v1/invite/:id';
64
+ Params: {
65
+ id: string;
66
+ };
67
+ Success: {
68
+ data: {
69
+ success: boolean;
70
+ };
71
+ };
72
+ }>;
@@ -1,7 +1,7 @@
1
1
  import type { Merge } from 'type-fest';
2
2
  import type { ApiError, ApiTimestamps, Endpoint } from '../api';
3
3
  import type { DBInvitation } from '../invitations/db';
4
- import type { WebUser } from '../user/api';
4
+ import type { ApiUser } from '../user/api';
5
5
  import type { DBTeam } from './db';
6
6
  export type GetTeam = Endpoint<{
7
7
  Method: 'GET';
@@ -12,7 +12,7 @@ export type GetTeam = Endpoint<{
12
12
  Success: {
13
13
  data: {
14
14
  account: ApiTeam;
15
- users: WebUser[];
15
+ users: ApiUser[];
16
16
  invitedUsers: ApiInvitation[];
17
17
  isAdminTeam: boolean;
18
18
  };
@@ -30,7 +30,7 @@ export type PutTeam = Endpoint<{
30
30
  name: string;
31
31
  };
32
32
  Success: {
33
- data: DBTeam;
33
+ data: ApiTeam;
34
34
  };
35
35
  }>;
36
36
  export type DeleteTeamUser = Endpoint<{
@@ -1,23 +1,24 @@
1
- import type { Timestamps } from '../db';
2
- export interface WebUser {
1
+ import type { Endpoint } from '../api';
2
+ export type GetUser = Endpoint<{
3
+ Method: 'GET';
4
+ Path: `/api/v1/user`;
5
+ Success: {
6
+ data: ApiUser;
7
+ };
8
+ }>;
9
+ export type PatchUser = Endpoint<{
10
+ Method: 'PATCH';
11
+ Path: `/api/v1/user`;
12
+ Body: {
13
+ name: string;
14
+ };
15
+ Success: {
16
+ data: ApiUser;
17
+ };
18
+ }>;
19
+ export interface ApiUser {
3
20
  id: number;
4
21
  accountId: number;
5
22
  email: string;
6
23
  name: string;
7
24
  }
8
- export interface DBUser extends Timestamps {
9
- id: number;
10
- email: string;
11
- name: string;
12
- hashed_password: string;
13
- salt: string;
14
- account_id: number;
15
- reset_password_token: string | undefined;
16
- suspended: boolean;
17
- suspended_at: Date;
18
- currentUser?: boolean;
19
- email_verified: boolean;
20
- email_verification_token: string | null;
21
- email_verification_token_expires_at: Date | null;
22
- uuid: string;
23
- }
@@ -0,0 +1,16 @@
1
+ import type { Timestamps } from '../db';
2
+ export interface DBUser extends Timestamps {
3
+ id: number;
4
+ email: string;
5
+ name: string;
6
+ hashed_password: string;
7
+ salt: string;
8
+ account_id: number;
9
+ reset_password_token: string | undefined;
10
+ suspended: boolean;
11
+ suspended_at: Date;
12
+ email_verified: boolean;
13
+ email_verification_token: string | null;
14
+ email_verification_token_expires_at: Date | null;
15
+ uuid: string;
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/types",
3
- "version": "0.42.0",
3
+ "version": "0.42.1",
4
4
  "description": "Types used in Nango applications",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",