@nangohq/types 0.41.0 → 0.41.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.
@@ -98,3 +98,26 @@ export type Signin = Endpoint<{
98
98
  user: WebUser;
99
99
  };
100
100
  }>;
101
+ export type PostForgotPassword = Endpoint<{
102
+ Method: 'PUT';
103
+ Path: '/api/v1/account/forgot-password';
104
+ Body: {
105
+ email: string;
106
+ };
107
+ Error: ApiError<'user_not_found'>;
108
+ Success: {
109
+ success: true;
110
+ };
111
+ }>;
112
+ export type PutResetPassword = Endpoint<{
113
+ Method: 'PUT';
114
+ Path: '/api/v1/account/reset-password';
115
+ Body: {
116
+ token: string;
117
+ password: string;
118
+ };
119
+ Error: ApiError<'user_not_found'> | ApiError<'invalid_token'>;
120
+ Success: {
121
+ success: true;
122
+ };
123
+ }>;
package/dist/api.d.ts CHANGED
@@ -61,3 +61,7 @@ export interface ErrorPayload {
61
61
  type: string;
62
62
  description: string;
63
63
  }
64
+ export interface ApiTimestamps {
65
+ created_at: string;
66
+ updated_at: string;
67
+ }
@@ -3,7 +3,9 @@ import type { GetOperation, SearchFilters, SearchMessages, SearchOperations } fr
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
- export type APIEndpoints = SearchOperations | GetOperation | SearchMessages | SearchFilters | GetOnboardingStatus | SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation;
6
+ import type { GetTeam } from './team/api';
7
+ import type { PostForgotPassword, PutResetPassword, Signin, Signup } from './account/api';
8
+ export type APIEndpoints = Signup | Signin | GetTeam | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | GetOnboardingStatus | SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation;
7
9
  /**
8
10
  * Automatically narrow endpoints type with Method + Path
9
11
  */
@@ -1,7 +1,7 @@
1
1
  import type { TimestampsAndDeleted } from '../db.js';
2
2
  import type { ApiKeyCredentials, BasicApiCredentials, AuthModeType, AuthOperationType, AllAuthCredentials } from '../auth/api.js';
3
- import type { Environment } from '../environment/db.js';
4
- import type { Account } from '../account/db.js';
3
+ import type { DBEnvironment } from '../environment/db.js';
4
+ import type { DBTeam } from '../team/db.js';
5
5
  export type Metadata = Record<string, unknown>;
6
6
  export type ConnectionConfig = Record<string, any>;
7
7
  export interface BaseConnection extends TimestampsAndDeleted {
@@ -26,8 +26,8 @@ export type RecentlyCreatedConnection = Pick<StoredConnection, 'id' | 'connectio
26
26
  auth_mode: AuthModeType;
27
27
  error?: string;
28
28
  operation: AuthOperationType;
29
- environment: Environment;
30
- account: Account;
29
+ environment: DBEnvironment;
30
+ account: DBTeam;
31
31
  };
32
32
  export interface ApiConnection {
33
33
  id?: number;
package/dist/db.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export interface Timestamps {
2
- created_at?: Date;
3
- updated_at?: Date;
2
+ created_at: Date;
3
+ updated_at: Date;
4
4
  }
5
5
  export interface Deleted {
6
6
  deleted_at?: Date | null;
@@ -47,4 +47,5 @@ export interface SyncAndActionDifferences {
47
47
  deletedSyncs: SlimSync[];
48
48
  newActions: SlimAction[];
49
49
  deletedActions: SlimAction[];
50
+ deletedModels: string[];
50
51
  }
@@ -52,4 +52,11 @@ export interface IncomingFlowConfig extends InternalIncomingPreBuiltFlowConfig {
52
52
  sync_type?: SyncTypeLiteral | undefined;
53
53
  webhookSubscriptions?: string[] | undefined;
54
54
  }
55
+ export interface IncomingFlowConfigUpgrade extends IncomingFlowConfig {
56
+ id: string;
57
+ upgrade_version: string;
58
+ last_deployed: string;
59
+ is_public: true;
60
+ pre_built: true;
61
+ }
55
62
  export {};
@@ -1,5 +1,5 @@
1
1
  import type { Timestamps } from '../db';
2
- export interface EnvironmentVariable extends Timestamps {
2
+ export interface DBEnvironmentVariable extends Timestamps {
3
3
  id?: number;
4
4
  name: string;
5
5
  value: string;
@@ -7,7 +7,7 @@ export interface EnvironmentVariable extends Timestamps {
7
7
  value_iv?: string | null;
8
8
  value_tag?: string | null;
9
9
  }
10
- export interface Environment extends Timestamps {
10
+ export interface DBEnvironment extends Timestamps {
11
11
  id: number;
12
12
  uuid: string;
13
13
  name: string;
@@ -28,7 +28,7 @@ export interface Environment extends Timestamps {
28
28
  hmac_digest?: string | null;
29
29
  secret_key_rotatable?: boolean;
30
30
  public_key_rotatable?: boolean;
31
- pending_secret_key?: string | null;
31
+ pending_secret_key: string | null;
32
32
  pending_secret_key_iv?: string | null;
33
33
  pending_secret_key_tag?: string | null;
34
34
  pending_public_key?: string | null;
@@ -0,0 +1,11 @@
1
+ import type { ApiError, Endpoint } from '../api';
2
+ import type { IncomingFlowConfigUpgrade } from '../deploy/incomingFlow';
3
+ export type UpgradePreBuiltFlow = Endpoint<{
4
+ Method: 'PUT';
5
+ Path: '/api/v1/flow/upgrade/pre-built';
6
+ Body: IncomingFlowConfigUpgrade;
7
+ Error: ApiError<'upgrade_failed'>;
8
+ Success: {
9
+ success: true;
10
+ };
11
+ }>;
package/dist/index.d.ts CHANGED
@@ -7,10 +7,12 @@ export type * from './record/api.js';
7
7
  export type * from './logs/api.js';
8
8
  export type * from './logs/messages.js';
9
9
  export type * from './account/api.js';
10
- export type * from './account/db.js';
11
10
  export type * from './user/api.js';
12
11
  export type * from './connection/api/metadata.js';
13
12
  export type * from './connection/db.js';
13
+ export type * from './invitations/db.js';
14
+ export type * from './team/api.js';
15
+ export type * from './team/db.js';
14
16
  export type * from './proxy/api.js';
15
17
  export type * from './environment/db.js';
16
18
  export type * from './scripts/post-connection/db.js';
@@ -28,4 +30,5 @@ export type * from './nangoYaml/index.js';
28
30
  export type * from './environment/db.js';
29
31
  export type * from './environment/api/webhook.js';
30
32
  export type * from './webhooks/api.js';
33
+ export type * from './flow/http.api.js';
31
34
  export type * from './utils.js';
@@ -60,7 +60,7 @@ export interface TemplateOAuth2 extends Template {
60
60
  authorization_method?: OAuthAuthorizationMethodType;
61
61
  body_format?: OAuthBodyFormatType;
62
62
  refresh_url?: string;
63
- token_request_auth_method?: 'basic';
63
+ token_request_auth_method?: 'basic' | 'custom';
64
64
  }
65
65
  export interface TemplateOAuth1 extends Template {
66
66
  auth_mode: 'OAUTH1';
@@ -0,0 +1,11 @@
1
+ import type { Timestamps } from '../db';
2
+ export interface DBInvitation extends Timestamps {
3
+ id: number;
4
+ name: string;
5
+ email: string;
6
+ account_id: number;
7
+ invited_by: number;
8
+ token: string;
9
+ expires_at: Date;
10
+ accepted: boolean;
11
+ }
@@ -13,6 +13,7 @@ export interface NangoYamlV1Integration {
13
13
  runs?: string;
14
14
  track_deletes?: boolean;
15
15
  auto_start?: boolean;
16
+ version?: string;
16
17
  }
17
18
  export interface NangoYamlV2 {
18
19
  integrations: Record<string, NangoYamlV2Integration>;
@@ -35,6 +36,7 @@ export interface NangoYamlV2IntegrationSync {
35
36
  scopes?: string | string[];
36
37
  input?: string;
37
38
  'webhook-subscriptions'?: string | string[];
39
+ version?: string;
38
40
  }
39
41
  export interface NangoYamlV2IntegrationAction {
40
42
  endpoint: string;
@@ -42,6 +44,7 @@ export interface NangoYamlV2IntegrationAction {
42
44
  description?: string;
43
45
  scopes?: string | string[];
44
46
  input?: string;
47
+ version?: string;
45
48
  }
46
49
  export interface NangoYamlModel {
47
50
  [key: string]: NangoYamlModelFields;
@@ -76,6 +79,7 @@ export interface ParsedNangoSync {
76
79
  output: string[] | null;
77
80
  usedModels: string[];
78
81
  webhookSubscriptions: string[];
82
+ version: string;
79
83
  }
80
84
  export interface ParsedNangoAction {
81
85
  name: string;
@@ -86,6 +90,7 @@ export interface ParsedNangoAction {
86
90
  endpoint: NangoSyncEndpoint | null;
87
91
  scopes: string[];
88
92
  usedModels: string[];
93
+ version: string;
89
94
  }
90
95
  export type LayoutMode = 'root' | 'nested';
91
96
  export interface NangoModel {
@@ -0,0 +1,21 @@
1
+ import type { Merge } from 'type-fest';
2
+ import type { ApiTimestamps, Endpoint } from '../api';
3
+ import type { DBInvitation } from '../invitations/db';
4
+ import type { WebUser } from '../user/api';
5
+ import type { DBTeam } from './db';
6
+ export type GetTeam = Endpoint<{
7
+ Method: 'GET';
8
+ Path: '/api/v1/team';
9
+ Querystring: {
10
+ env: string;
11
+ };
12
+ Success: {
13
+ data: {
14
+ account: ApiTeam;
15
+ users: WebUser[];
16
+ invitedUsers: Omit<DBInvitation, 'token'>[];
17
+ isAdminTeam: boolean;
18
+ };
19
+ };
20
+ }>;
21
+ export type ApiTeam = Merge<DBTeam, ApiTimestamps>;
@@ -0,0 +1,7 @@
1
+ import type { Timestamps } from '../db';
2
+ export interface DBTeam extends Timestamps {
3
+ id: number;
4
+ name: string;
5
+ uuid: string;
6
+ is_capped: boolean;
7
+ }
@@ -1,6 +1,23 @@
1
+ import type { Timestamps } from '../db';
1
2
  export interface WebUser {
2
3
  id: number;
3
4
  accountId: number;
4
5
  email: string;
5
6
  name: string;
6
7
  }
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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/types",
3
- "version": "0.41.0",
3
+ "version": "0.41.1",
4
4
  "description": "Types used in Nango applications",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",
@@ -1,10 +0,0 @@
1
- export interface Account {
2
- id: number;
3
- name: string;
4
- secret_key: string;
5
- host?: string | null;
6
- websockets_path?: string;
7
- uuid: string;
8
- is_admin?: boolean;
9
- is_capped?: boolean;
10
- }