@nangohq/types 0.53.0 → 0.53.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,5 +1,5 @@
1
1
  import type { ApiError, ApiTimestamps, Endpoint } from '../../api.js';
2
- import type { DBConnection } from '../db.js';
2
+ import type { DBConnection, DBConnectionDecrypted } from '../db.js';
3
3
  import type { ActiveLog } from '../../notification/active-logs/db.js';
4
4
  import type { Merge } from 'type-fest';
5
5
  import type { ApiEndUser } from '../../endUser/index.js';
@@ -64,7 +64,7 @@ export type GetPublicConnections = Endpoint<{
64
64
  connections: ApiPublicConnection[];
65
65
  };
66
66
  }>;
67
- export type ApiConnectionFull = Merge<DBConnection, ApiTimestamps>;
67
+ export type ApiConnectionFull = Merge<DBConnectionDecrypted, ApiTimestamps>;
68
68
  export type GetConnection = Endpoint<{
69
69
  Method: 'GET';
70
70
  Params: {
@@ -88,7 +88,7 @@ export type GetConnection = Endpoint<{
88
88
  export type ApiPublicConnectionFull = Pick<DBConnection, 'id' | 'connection_id' | 'provider_config_key' | 'connection_config'> & {
89
89
  created_at: string;
90
90
  updated_at: string;
91
- last_fetched_at: string;
91
+ last_fetched_at: string | null;
92
92
  metadata: Record<string, unknown> | null;
93
93
  provider: string;
94
94
  errors: {
@@ -1,58 +1,53 @@
1
- import type { TimestampsAndDeleted } from '../db.js';
1
+ import type { TimestampsAndDeletedCorrect } from '../db.js';
2
2
  import type { AuthModeType, AuthOperationType, AllAuthCredentials } from '../auth/api.js';
3
3
  import type { DBEnvironment } from '../environment/db.js';
4
4
  import type { DBTeam } from '../team/db.js';
5
5
  import type { Merge } from 'type-fest';
6
+ import type { EndUser } from '../endUser/index.js';
6
7
  export type Metadata = Record<string, unknown>;
7
8
  export type ConnectionConfig = Record<string, any>;
8
- export interface BaseConnection extends TimestampsAndDeleted {
9
- id?: number;
10
- config_id?: number;
9
+ export interface DBConnection extends TimestampsAndDeletedCorrect {
10
+ id: number;
11
+ config_id: number;
11
12
  end_user_id: number | null;
13
+ /**
14
+ * @deprecated
15
+ */
12
16
  provider_config_key: string;
13
17
  connection_id: string;
14
18
  connection_config: ConnectionConfig;
15
19
  environment_id: number;
16
- metadata?: Metadata | null;
17
- credentials_iv?: string | null;
18
- credentials_tag?: string | null;
19
- last_fetched_at?: Date | null;
20
- }
21
- export interface StoredConnection extends BaseConnection {
22
- credentials: Record<string, any>;
20
+ metadata: Metadata | null;
21
+ credentials: {
22
+ encrypted_credentials?: string;
23
+ };
24
+ credentials_iv: string | null;
25
+ credentials_tag: string | null;
26
+ last_fetched_at: Date | null;
23
27
  }
24
- export type DBConnection = Merge<BaseConnection, {
25
- id: number;
26
- config_id: number;
27
- credentials: Record<string, any>;
28
- }>;
29
- export interface Connection extends BaseConnection {
28
+ export type DBConnectionDecrypted = Merge<DBConnection, {
30
29
  credentials: AllAuthCredentials;
31
- }
32
- export type RecentlyCreatedConnection = Pick<StoredConnection, 'id' | 'connection_id' | 'provider_config_key'> & {
30
+ }>;
31
+ export interface RecentlyCreatedConnection {
32
+ connection: DBConnection;
33
33
  auth_mode: AuthModeType;
34
34
  error?: string;
35
35
  operation: AuthOperationType;
36
36
  environment: DBEnvironment;
37
37
  account: DBTeam;
38
- };
39
- export interface NangoConnection {
40
- id?: number;
41
- connection_id: string;
42
- provider_config_key: string;
43
- environment_id: number;
44
- connection_config?: ConnectionConfig;
45
- /**
46
- * @deprecated
47
- */
48
- account_id?: number;
38
+ endUser: EndUser | undefined;
49
39
  }
50
- export interface ConnectionList {
51
- id: number;
52
- connection_id: string;
53
- provider_config_key: string;
54
- provider: string;
55
- created: string;
56
- metadata?: Metadata | null;
57
- error_log_id?: number | string | null;
40
+ export interface FailedConnectionError {
41
+ type: string;
42
+ description: string;
43
+ }
44
+ export interface RecentlyFailedConnection {
45
+ connection: DBConnection | Pick<DBConnection, 'connection_id' | 'provider_config_key'>;
46
+ auth_mode: AuthModeType;
47
+ error?: FailedConnectionError;
48
+ operation: AuthOperationType;
49
+ environment: DBEnvironment;
50
+ account: DBTeam;
58
51
  }
52
+ export type ConnectionInternal = Pick<DBConnection, 'id' | 'connection_id' | 'provider_config_key' | 'environment_id' | 'connection_config'>;
53
+ export type ConnectionJobs = Pick<DBConnection, 'id' | 'connection_id' | 'provider_config_key' | 'environment_id'>;
package/dist/db.d.ts CHANGED
@@ -6,5 +6,11 @@ export interface Deleted {
6
6
  deleted_at?: Date | null;
7
7
  deleted?: boolean;
8
8
  }
9
+ export interface DeletedCorrect {
10
+ deleted_at: Date | null;
11
+ deleted: boolean;
12
+ }
9
13
  export interface TimestampsAndDeleted extends Timestamps, Deleted {
10
14
  }
15
+ export interface TimestampsAndDeletedCorrect extends Timestamps, DeletedCorrect {
16
+ }
@@ -51,7 +51,7 @@ export interface OperationAdmin {
51
51
  }
52
52
  export interface OperationWebhook {
53
53
  type: 'webhook';
54
- action: 'incoming' | 'forward' | 'sync';
54
+ action: 'incoming' | 'forward' | 'sync' | 'connection_create' | 'connection_refresh';
55
55
  }
56
56
  export interface OperationDeploy {
57
57
  type: 'deploy';
@@ -131,7 +131,7 @@ export type OperationRow = Merge<Required<OperationRowInsert>, {
131
131
  /**
132
132
  * What is required to insert a Message
133
133
  */
134
- export type MessageRowInsert = Pick<MessageRow, 'type' | 'message'> & Partial<Omit<MessageRow, 'type' | 'message'>> & {
134
+ export type MessageRowInsert = Pick<MessageRow, 'type' | 'message' | 'createdAt'> & Partial<Omit<MessageRow, 'type' | 'message'>> & {
135
135
  id?: never;
136
136
  };
137
137
  export type MessageOrOperationRow = MessageRow | OperationRow;
@@ -1,4 +1,4 @@
1
- import type { MergingStrategy } from '../record/api.js';
1
+ import type { MergingStrategy, NangoRecord } from '../record/api.js';
2
2
  export interface PostRecordsSuccess {
3
3
  nextMerging: MergingStrategy;
4
4
  }
@@ -11,3 +11,7 @@ export interface DeleteRecordsSuccess {
11
11
  export interface GetCursorSuccess {
12
12
  cursor?: string;
13
13
  }
14
+ export interface GetRecordsSuccess {
15
+ records: NangoRecord[];
16
+ nextCursor?: string;
17
+ }
@@ -120,6 +120,12 @@ export interface ProviderTwoStep extends Omit<BaseProvider, 'body_format'> {
120
120
  token_expiration: string;
121
121
  token_expiration_strategy: 'expireAt' | 'expireIn';
122
122
  };
123
+ additional_steps?: {
124
+ body_format?: 'json' | 'form';
125
+ token_params?: Record<string, string>;
126
+ token_headers?: Record<string, string>;
127
+ token_url: string;
128
+ }[];
123
129
  token_expires_in_ms?: number;
124
130
  proxy_header_authorization?: string;
125
131
  body_format?: 'xml' | 'json' | 'form';
@@ -1,6 +1,6 @@
1
1
  import type { EndpointMethod } from '../api.js';
2
2
  import type { BasicApiCredentials, ApiKeyCredentials, AppCredentials } from '../auth/api.js';
3
- import type { Connection } from '../connection/db.js';
3
+ import type { DBConnectionDecrypted } from '../connection/db.js';
4
4
  import type { Provider } from '../providers/provider.js';
5
5
  export interface BaseProxyConfiguration {
6
6
  providerConfigKey: string;
@@ -26,12 +26,12 @@ export interface ApplicationConstructedProxyConfiguration extends BaseProxyConfi
26
26
  providerName: string;
27
27
  token: string | BasicApiCredentials | ApiKeyCredentials | AppCredentials;
28
28
  provider: Provider;
29
- connection: Connection;
29
+ connection: DBConnectionDecrypted;
30
30
  }
31
31
  export type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream';
32
32
  export interface InternalProxyConfiguration {
33
33
  providerName: string;
34
- connection: Connection;
34
+ connection: DBConnectionDecrypted;
35
35
  existingActivityLogId?: string | null | undefined;
36
36
  }
37
37
  export interface RetryHeaderConfig {
@@ -17,7 +17,7 @@ export type MergingStrategy = {
17
17
  strategy: 'override';
18
18
  } | {
19
19
  strategy: 'ignore_if_modified_after_cursor';
20
- cursor?: string;
20
+ cursor?: string | undefined;
21
21
  };
22
22
  export type CursorOffset = 'first' | 'last';
23
23
  export type GetPublicRecords = Endpoint<{
@@ -28,6 +28,7 @@ export interface NangoProps {
28
28
  provider: string;
29
29
  lastSyncDate?: Date;
30
30
  syncId?: string | undefined;
31
+ syncVariant?: string | undefined;
31
32
  nangoConnectionId?: number;
32
33
  syncJobId?: number | undefined;
33
34
  track_deletes?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/types",
3
- "version": "0.53.0",
3
+ "version": "0.53.2",
4
4
  "description": "Types used in Nango applications",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",