@nangohq/types 0.40.9 → 0.41.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.
- package/dist/auth/api.d.ts +4 -3
- package/dist/connection/db.d.ts +2 -2
- package/dist/webhooks/api.d.ts +20 -11
- package/package.json +1 -1
package/dist/auth/api.d.ts
CHANGED
|
@@ -43,17 +43,17 @@ export interface CredentialsCommon<T = Record<string, any>> {
|
|
|
43
43
|
raw: T;
|
|
44
44
|
}
|
|
45
45
|
export interface BasicApiCredentials {
|
|
46
|
-
type
|
|
46
|
+
type: AuthModes['Basic'];
|
|
47
47
|
username: string;
|
|
48
48
|
password: string;
|
|
49
49
|
}
|
|
50
50
|
export interface ApiKeyCredentials {
|
|
51
|
-
type
|
|
51
|
+
type: AuthModes['ApiKey'];
|
|
52
52
|
apiKey: string;
|
|
53
53
|
}
|
|
54
54
|
export type AuthCredentials = OAuth2Credentials | OAuth1Credentials | OAuth2ClientCredentials;
|
|
55
55
|
export interface AppCredentials {
|
|
56
|
-
type
|
|
56
|
+
type: AuthModes['App'];
|
|
57
57
|
access_token: string;
|
|
58
58
|
expires_at?: Date | undefined;
|
|
59
59
|
raw: Record<string, any>;
|
|
@@ -110,3 +110,4 @@ export interface AuthorizationTokenResponse extends Omit<OAuth2Credentials, 'typ
|
|
|
110
110
|
expires_in?: number;
|
|
111
111
|
}
|
|
112
112
|
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;
|
package/dist/connection/db.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TimestampsAndDeleted } from '../db.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ApiKeyCredentials, BasicApiCredentials, AuthModeType, AuthOperationType, AllAuthCredentials } from '../auth/api.js';
|
|
3
3
|
import type { Environment } from '../environment/db.js';
|
|
4
4
|
import type { Account } from '../account/db.js';
|
|
5
5
|
export type Metadata = Record<string, unknown>;
|
|
@@ -20,7 +20,7 @@ export interface StoredConnection extends BaseConnection {
|
|
|
20
20
|
credentials: Record<string, any>;
|
|
21
21
|
}
|
|
22
22
|
export interface Connection extends BaseConnection {
|
|
23
|
-
credentials:
|
|
23
|
+
credentials: AllAuthCredentials;
|
|
24
24
|
}
|
|
25
25
|
export type RecentlyCreatedConnection = Pick<StoredConnection, 'id' | 'connection_id' | 'provider_config_key'> & {
|
|
26
26
|
auth_mode: AuthModeType;
|
package/dist/webhooks/api.d.ts
CHANGED
|
@@ -2,8 +2,12 @@ import type { AuthOperationType, AuthModeType } from '../auth/api.js';
|
|
|
2
2
|
import type { SyncResult, SyncType } from '../scripts/syncs/api.js';
|
|
3
3
|
import type { ErrorPayload } from '../api.js';
|
|
4
4
|
export type WebhookTypes = 'sync' | 'auth' | 'forward';
|
|
5
|
-
export interface
|
|
5
|
+
export interface NangoWebhookBase {
|
|
6
6
|
from: string;
|
|
7
|
+
type: WebhookTypes;
|
|
8
|
+
}
|
|
9
|
+
export type NangoWebhookBody = NangoSyncWebhookBody | NangoAuthWebhookBody;
|
|
10
|
+
export interface NangoSyncWebhookBodyBase extends NangoWebhookBase {
|
|
7
11
|
type: 'sync';
|
|
8
12
|
connectionId: string;
|
|
9
13
|
providerConfigKey: string;
|
|
@@ -11,20 +15,23 @@ export interface NangoSyncWebhookBody {
|
|
|
11
15
|
model: string;
|
|
12
16
|
syncType: SyncType;
|
|
13
17
|
}
|
|
14
|
-
export interface NangoSyncWebhookBodySuccess extends
|
|
18
|
+
export interface NangoSyncWebhookBodySuccess extends NangoSyncWebhookBodyBase {
|
|
19
|
+
success: true;
|
|
15
20
|
modifiedAfter: string;
|
|
16
21
|
responseResults: SyncResult;
|
|
17
|
-
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated legacy, use modifiedAfter instead
|
|
24
|
+
*/
|
|
18
25
|
queryTimeStamp: string | null;
|
|
19
26
|
}
|
|
20
|
-
export interface NangoSyncWebhookBodyError {
|
|
27
|
+
export interface NangoSyncWebhookBodyError extends NangoSyncWebhookBodyBase {
|
|
21
28
|
success: false;
|
|
22
29
|
error: ErrorPayload;
|
|
23
30
|
startedAt: string;
|
|
24
31
|
failedAt: string;
|
|
25
32
|
}
|
|
26
|
-
export
|
|
27
|
-
|
|
33
|
+
export type NangoSyncWebhookBody = NangoSyncWebhookBodySuccess | NangoSyncWebhookBodyError;
|
|
34
|
+
export interface NangoAuthWebhookBodyBase extends NangoWebhookBase {
|
|
28
35
|
type: 'auth';
|
|
29
36
|
connectionId: string;
|
|
30
37
|
authMode: AuthModeType;
|
|
@@ -33,16 +40,18 @@ export interface NangoAuthWebhookBody {
|
|
|
33
40
|
environment: string;
|
|
34
41
|
operation: AuthOperationType;
|
|
35
42
|
}
|
|
36
|
-
export interface NangoAuthWebhookBodySuccess extends
|
|
43
|
+
export interface NangoAuthWebhookBodySuccess extends NangoAuthWebhookBodyBase {
|
|
37
44
|
success: true;
|
|
45
|
+
type: 'auth';
|
|
38
46
|
}
|
|
39
|
-
export interface NangoAuthWebhookBodyError extends
|
|
47
|
+
export interface NangoAuthWebhookBodyError extends NangoAuthWebhookBodyBase {
|
|
40
48
|
success: false;
|
|
41
49
|
error: ErrorPayload;
|
|
50
|
+
type: 'auth';
|
|
42
51
|
}
|
|
43
|
-
export
|
|
44
|
-
|
|
45
|
-
type:
|
|
52
|
+
export type NangoAuthWebhookBody = NangoAuthWebhookBodySuccess | NangoAuthWebhookBodyError;
|
|
53
|
+
export interface NangoForwardWebhookBody extends NangoWebhookBase {
|
|
54
|
+
type: 'forward';
|
|
46
55
|
connectionId?: string;
|
|
47
56
|
providerConfigKey: string;
|
|
48
57
|
payload: unknown;
|