@nangohq/types 0.42.0 → 0.42.2

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<{
@@ -121,3 +110,30 @@ export type PutResetPassword = Endpoint<{
121
110
  success: true;
122
111
  };
123
112
  }>;
113
+ export type PostManagedSignup = Endpoint<{
114
+ Method: 'POST';
115
+ Path: '/api/v1/account/managed/signup';
116
+ Body: {
117
+ provider: 'GoogleOAuth';
118
+ token?: string | undefined;
119
+ };
120
+ Success: {
121
+ data: {
122
+ url: string;
123
+ };
124
+ };
125
+ }>;
126
+ export type GetManagedCallback = Endpoint<{
127
+ Method: 'GET';
128
+ Path: '/api/v1/login/callback';
129
+ Querystring: {
130
+ code: string;
131
+ state?: string | undefined;
132
+ };
133
+ Error: ApiError<'error_creating_user'> | ApiError<'user_already_exists'> | ApiError<'error_creating_account'>;
134
+ Success: {
135
+ data: {
136
+ url: string;
137
+ };
138
+ };
139
+ }>;
@@ -1,12 +1,13 @@
1
1
  import type { EndpointMethod } from './api';
2
- import type { GetOperation, SearchFilters, SearchMessages, SearchOperations } from './logs/api';
2
+ import type { GetOperation, PostInsights, SearchFilters, SearchMessages, SearchOperations } from './logs/api';
3
3
  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 | PostInsights | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | GetOnboardingStatus | SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation;
10
11
  /**
11
12
  * Automatically narrow endpoints type with Method + Path
12
13
  */
@@ -10,6 +10,7 @@ export interface AuthModes {
10
10
  App: 'APP';
11
11
  None: 'NONE';
12
12
  TBA: 'TBA';
13
+ Tableau: 'TABLEAU';
13
14
  }
14
15
  export type AuthModeType = AuthModes[keyof AuthModes];
15
16
  export interface AuthOperation {
@@ -104,10 +105,18 @@ export interface TbaCredentials {
104
105
  client_secret?: string;
105
106
  };
106
107
  }
108
+ export interface TableauCredentials extends CredentialsCommon {
109
+ type: AuthModes['Tableau'];
110
+ pat_name: string;
111
+ pat_secret: string;
112
+ content_url?: string;
113
+ token?: string;
114
+ expires_at?: Date | undefined;
115
+ }
107
116
  export type UnauthCredentials = Record<string, never>;
108
117
  export type RefreshTokenResponse = AuthorizationTokenResponse;
109
118
  export interface AuthorizationTokenResponse extends Omit<OAuth2Credentials, 'type' | 'raw'> {
110
119
  expires_in?: number;
111
120
  }
112
121
  export type ImportedCredentials = (OAuth2Credentials & Partial<Pick<AuthorizationTokenResponse, 'expires_in'>> & Partial<Pick<BaseConnection, 'metadata' | 'connection_config'>>) | OAuth1Credentials;
113
- export type AllAuthCredentials = OAuth1Credentials | OAuth2Credentials | OAuth2ClientCredentials | BasicApiCredentials | ApiKeyCredentials | AppCredentials | AppStoreCredentials | UnauthCredentials | CustomCredentials | TbaCredentials;
122
+ export type AllAuthCredentials = OAuth1Credentials | OAuth2Credentials | OAuth2ClientCredentials | BasicApiCredentials | ApiKeyCredentials | AppCredentials | AppStoreCredentials | UnauthCredentials | CustomCredentials | TbaCredentials | TableauCredentials;
@@ -22,3 +22,24 @@ export type TbaAuthorization = Endpoint<{
22
22
  connectionId: string;
23
23
  };
24
24
  }>;
25
+ export type TableauAuthorization = Endpoint<{
26
+ Method: 'POST';
27
+ Body: {
28
+ pat_name: string;
29
+ pat_secret: string;
30
+ content_url?: string;
31
+ };
32
+ QueryParams: {
33
+ connectionId: string;
34
+ connectionConfig: ConnectionConfig;
35
+ };
36
+ Params: {
37
+ providerConfigKey: string;
38
+ };
39
+ Path: '/auth/tableau';
40
+ Error: ApiError<'invalid_body'> | ApiError<'invalid_query_params'> | ApiError<'unknown_provider_config'> | ApiError<'invalid_auth_mode'> | ApiError<'invalid_credentials'>;
41
+ Success: {
42
+ providerConfigKey: string;
43
+ connectionId: string;
44
+ };
45
+ }>;
package/dist/index.d.ts CHANGED
@@ -8,8 +8,10 @@ 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';
14
+ export type * from './meta/api.js';
13
15
  export type * from './invitations/api.js';
14
16
  export type * from './invitations/db.js';
15
17
  export type * from './team/api.js';
@@ -33,3 +35,4 @@ export type * from './environment/api/webhook.js';
33
35
  export type * from './webhooks/api.js';
34
36
  export type * from './flow/http.api.js';
35
37
  export type * from './utils.js';
38
+ export type * from './web/env.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
+ }>;
@@ -92,4 +92,25 @@ export type SearchFilters = Endpoint<{
92
92
  };
93
93
  }>;
94
94
  export type SearchFiltersData = SearchMessages['Success']['data'][0];
95
+ export type PostInsights = Endpoint<{
96
+ Method: 'POST';
97
+ Path: '/api/v1/logs/insights';
98
+ Querystring: {
99
+ env: string;
100
+ };
101
+ Body: {
102
+ type: 'action' | 'sync' | 'proxy' | 'webhook_external';
103
+ };
104
+ Success: {
105
+ data: {
106
+ histogram: InsightsHistogramEntry[];
107
+ };
108
+ };
109
+ }>;
110
+ export interface InsightsHistogramEntry {
111
+ key: string;
112
+ total: number;
113
+ success: number;
114
+ failure: number;
115
+ }
95
116
  export {};
@@ -0,0 +1,19 @@
1
+ import type { ApiError, Endpoint } from '../api';
2
+ import type { DBEnvironment } from '../environment/db';
3
+ export type GetMeta = Endpoint<{
4
+ Method: 'GET';
5
+ Path: '/api/v1/meta';
6
+ Querystring: {
7
+ env: string;
8
+ };
9
+ Error: ApiError<'user_not_found'>;
10
+ Success: {
11
+ data: {
12
+ environments: Pick<DBEnvironment, 'name'>[];
13
+ version: string;
14
+ baseUrl: string;
15
+ debugMode: boolean;
16
+ onboardingComplete: boolean;
17
+ };
18
+ };
19
+ }>;
@@ -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<{
@@ -42,7 +42,7 @@ export type DeleteTeamUser = Endpoint<{
42
42
  Params: {
43
43
  id: number;
44
44
  };
45
- Error: ApiError<'user_not_found'>;
45
+ Error: ApiError<'user_not_found'> | ApiError<'forbidden_self_delete'>;
46
46
  Success: {
47
47
  data: {
48
48
  success: true;
@@ -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
+ }
@@ -0,0 +1,15 @@
1
+ export interface WindowEnv {
2
+ apiUrl: string;
3
+ publicUrl: string;
4
+ publicSentryKey: string;
5
+ publicPosthogKey: string;
6
+ publicPosthogPost: string;
7
+ isCloud: boolean;
8
+ features: {
9
+ logs: boolean;
10
+ scripts: boolean;
11
+ auth: boolean;
12
+ managedAuth: boolean;
13
+ interactiveDemo: boolean;
14
+ };
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/types",
3
- "version": "0.42.0",
3
+ "version": "0.42.2",
4
4
  "description": "Types used in Nango applications",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",