@nangohq/types 0.45.0 → 0.46.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/api.d.ts +1 -1
- package/dist/auth/api.d.ts +0 -1
- package/dist/auth/http.api.d.ts +9 -7
- package/dist/deploy/api.d.ts +11 -1
- package/dist/deploy/incomingFlow.d.ts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/integration/api.d.ts +17 -3
- package/dist/integration/db.d.ts +10 -6
- package/dist/logs/messages.d.ts +5 -1
- package/dist/nangoYaml/index.d.ts +2 -2
- package/dist/providers/api.d.ts +4 -0
- package/dist/providers/provider.d.ts +3 -2
- package/dist/runner/index.d.ts +6 -0
- package/dist/scripts/on-events/api.d.ts +14 -0
- package/dist/scripts/{post-connection → on-events}/db.d.ts +1 -1
- package/dist/user/api.d.ts +1 -0
- package/dist/utils.d.ts +3 -0
- package/dist/web/env.d.ts +2 -1
- package/dist/webhooks/api.d.ts +7 -0
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface ValidationError {
|
|
|
11
11
|
message: string;
|
|
12
12
|
path: (string | number)[];
|
|
13
13
|
}
|
|
14
|
-
export type ResDefaultErrors = ApiError<'not_found'> | ApiError<'invalid_query_params', ValidationError[]> | ApiError<'invalid_body', ValidationError[]> | ApiError<'invalid_uri_params', ValidationError[]> | ApiError<'feature_disabled'> | ApiError<'generic_error_support', undefined, string> | ApiError<'server_error'> | ApiError<'resource_capped'> | ApiError<'missing_auth_header'> | ApiError<'malformed_auth_header'> | ApiError<'unknown_account'> | ApiError<'unknown_connect_session_token'> | ApiError<'invalid_cli_version'>;
|
|
14
|
+
export type ResDefaultErrors = ApiError<'not_found'> | ApiError<'invalid_query_params', ValidationError[]> | ApiError<'invalid_body', ValidationError[]> | ApiError<'invalid_uri_params', ValidationError[]> | ApiError<'feature_disabled'> | ApiError<'generic_error_support', undefined, string> | ApiError<'server_error'> | ApiError<'resource_capped'> | ApiError<'missing_auth_header'> | ApiError<'malformed_auth_header'> | ApiError<'unknown_account'> | ApiError<'unknown_connect_session_token'> | ApiError<'invalid_cli_version'> | ApiError<'invalid_permissions'>;
|
|
15
15
|
export type EndpointMethod = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
|
|
16
16
|
/**
|
|
17
17
|
* API Request/Response type
|
package/dist/auth/api.d.ts
CHANGED
|
@@ -55,7 +55,6 @@ export interface ApiKeyCredentials {
|
|
|
55
55
|
type: AuthModes['ApiKey'];
|
|
56
56
|
apiKey: string;
|
|
57
57
|
}
|
|
58
|
-
export type AuthCredentials = OAuth2Credentials | OAuth1Credentials | OAuth2ClientCredentials;
|
|
59
58
|
export interface AppCredentials {
|
|
60
59
|
type: AuthModes['App'];
|
|
61
60
|
access_token: string;
|
package/dist/auth/http.api.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export type ConnectionQueryString = {
|
|
|
9
9
|
} | {
|
|
10
10
|
connect_session_token: string;
|
|
11
11
|
});
|
|
12
|
+
type AuthErrors = ApiError<'invalid_body'> | ApiError<'invalid_query_params'> | ApiError<'unknown_provider_config'> | ApiError<'unknown_provider_template'> | ApiError<'invalid_auth_mode'> | ApiError<'invalid_credentials'> | ApiError<'integration_not_allowed'>;
|
|
12
13
|
export type PostPublicTbaAuthorization = Endpoint<{
|
|
13
14
|
Method: 'POST';
|
|
14
15
|
Body: {
|
|
@@ -22,7 +23,7 @@ export type PostPublicTbaAuthorization = Endpoint<{
|
|
|
22
23
|
providerConfigKey: string;
|
|
23
24
|
};
|
|
24
25
|
Path: '/auth/tba/:providerConfigKey';
|
|
25
|
-
Error:
|
|
26
|
+
Error: AuthErrors;
|
|
26
27
|
Success: {
|
|
27
28
|
providerConfigKey: string;
|
|
28
29
|
connectionId: string;
|
|
@@ -40,7 +41,7 @@ export type PostPublicTableauAuthorization = Endpoint<{
|
|
|
40
41
|
providerConfigKey: string;
|
|
41
42
|
};
|
|
42
43
|
Path: '/auth/tableau/:providerConfigKey';
|
|
43
|
-
Error:
|
|
44
|
+
Error: AuthErrors;
|
|
44
45
|
Success: {
|
|
45
46
|
providerConfigKey: string;
|
|
46
47
|
connectionId: string;
|
|
@@ -61,7 +62,7 @@ export type PostPublicJwtAuthorization = Endpoint<{
|
|
|
61
62
|
providerConfigKey: string;
|
|
62
63
|
};
|
|
63
64
|
Path: '/auth/jwt/:providerConfigKey';
|
|
64
|
-
Error:
|
|
65
|
+
Error: AuthErrors;
|
|
65
66
|
Success: {
|
|
66
67
|
providerConfigKey: string;
|
|
67
68
|
connectionId: string;
|
|
@@ -74,7 +75,7 @@ export type PostPublicUnauthenticatedAuthorization = Endpoint<{
|
|
|
74
75
|
providerConfigKey: string;
|
|
75
76
|
};
|
|
76
77
|
Path: '/auth/unauthenticated/:providerConfigKey';
|
|
77
|
-
Error:
|
|
78
|
+
Error: AuthErrors;
|
|
78
79
|
Success: {
|
|
79
80
|
providerConfigKey: string;
|
|
80
81
|
connectionId: string;
|
|
@@ -93,7 +94,7 @@ export type PostPublicBillAuthorization = Endpoint<{
|
|
|
93
94
|
providerConfigKey: string;
|
|
94
95
|
};
|
|
95
96
|
Path: '/auth/bill/:providerConfigKey';
|
|
96
|
-
Error:
|
|
97
|
+
Error: AuthErrors;
|
|
97
98
|
Success: {
|
|
98
99
|
providerConfigKey: string;
|
|
99
100
|
connectionId: string;
|
|
@@ -107,7 +108,7 @@ export type PostPublicTwoStepAuthorization = Endpoint<{
|
|
|
107
108
|
providerConfigKey: string;
|
|
108
109
|
};
|
|
109
110
|
Path: '/auth/two-step/:providerConfigKey';
|
|
110
|
-
Error:
|
|
111
|
+
Error: AuthErrors;
|
|
111
112
|
Success: {
|
|
112
113
|
providerConfigKey: string;
|
|
113
114
|
connectionId: string;
|
|
@@ -124,9 +125,10 @@ export type PostPublicSignatureAuthorization = Endpoint<{
|
|
|
124
125
|
providerConfigKey: string;
|
|
125
126
|
};
|
|
126
127
|
Path: '/auth/signature-based/:providerConfigKey';
|
|
127
|
-
Error:
|
|
128
|
+
Error: AuthErrors;
|
|
128
129
|
Success: {
|
|
129
130
|
providerConfigKey: string;
|
|
130
131
|
connectionId: string;
|
|
131
132
|
};
|
|
132
133
|
}>;
|
|
134
|
+
export {};
|
package/dist/deploy/api.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { JSONSchema7 } from 'json-schema';
|
|
|
2
2
|
import type { Endpoint, ApiError } from '../api.js';
|
|
3
3
|
import type { IncomingFlowConfig, OnEventScriptsByProvider } from './incomingFlow.js';
|
|
4
4
|
import type { SyncDeploymentResult } from './index.js';
|
|
5
|
+
import type { OnEventType } from '../scripts/on-events/api.js';
|
|
5
6
|
export type PostDeployConfirmation = Endpoint<{
|
|
6
7
|
Method: 'POST';
|
|
7
8
|
Path: '/sync/deploy/confirmation';
|
|
@@ -13,7 +14,7 @@ export type PostDeployConfirmation = Endpoint<{
|
|
|
13
14
|
singleDeployMode?: boolean;
|
|
14
15
|
jsonSchema?: JSONSchema7 | undefined;
|
|
15
16
|
};
|
|
16
|
-
Success:
|
|
17
|
+
Success: ScriptDifferences;
|
|
17
18
|
}>;
|
|
18
19
|
export type PostDeploy = Endpoint<{
|
|
19
20
|
Method: 'POST';
|
|
@@ -61,6 +62,11 @@ export interface SlimAction {
|
|
|
61
62
|
providerConfigKey: string;
|
|
62
63
|
name: string;
|
|
63
64
|
}
|
|
65
|
+
export interface SlimOnEventScript {
|
|
66
|
+
providerConfigKey: string;
|
|
67
|
+
name: string;
|
|
68
|
+
event: OnEventType;
|
|
69
|
+
}
|
|
64
70
|
export interface SyncAndActionDifferences {
|
|
65
71
|
newSyncs: SlimSync[];
|
|
66
72
|
deletedSyncs: SlimSync[];
|
|
@@ -68,3 +74,7 @@ export interface SyncAndActionDifferences {
|
|
|
68
74
|
deletedActions: SlimAction[];
|
|
69
75
|
deletedModels: string[];
|
|
70
76
|
}
|
|
77
|
+
export interface ScriptDifferences extends SyncAndActionDifferences {
|
|
78
|
+
newOnEventScripts: SlimOnEventScript[];
|
|
79
|
+
deletedOnEventScripts: SlimOnEventScript[];
|
|
80
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Merge } from 'type-fest';
|
|
2
|
-
import type { NangoModel, NangoSyncEndpointOld, NangoSyncEndpointV2,
|
|
2
|
+
import type { NangoModel, NangoSyncEndpointOld, NangoSyncEndpointV2, ScriptTypeLiteral, SyncTypeLiteral } from '../nangoYaml';
|
|
3
|
+
import type { OnEventType } from '../scripts/on-events/api';
|
|
3
4
|
export interface IncomingScriptFiles {
|
|
4
5
|
js: string;
|
|
5
6
|
ts: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,8 @@ export type * from './team/db.js';
|
|
|
22
22
|
export type * from './providers/api.js';
|
|
23
23
|
export type * from './proxy/api.js';
|
|
24
24
|
export type * from './environment/db.js';
|
|
25
|
-
export type * from './scripts/
|
|
25
|
+
export type * from './scripts/on-events/db.js';
|
|
26
|
+
export type * from './scripts/on-events/api.js';
|
|
26
27
|
export type * from './scripts/syncs/api.js';
|
|
27
28
|
export type * from './slackNotifications/db.js';
|
|
28
29
|
export type * from './notification/active-logs/db.js';
|
|
@@ -2,7 +2,7 @@ import type { Merge } from 'type-fest';
|
|
|
2
2
|
import type { ApiTimestamps, Endpoint } from '../api';
|
|
3
3
|
import type { IntegrationConfig } from './db';
|
|
4
4
|
import type { Provider } from '../providers/provider';
|
|
5
|
-
import type { AuthModeType } from '../auth/api';
|
|
5
|
+
import type { AuthModeType, AuthModes } from '../auth/api';
|
|
6
6
|
import type { NangoModel, NangoSyncEndpointV2, ScriptTypeLiteral } from '../nangoYaml';
|
|
7
7
|
import type { LegacySyncModelSchema, NangoConfigMetadata } from '../deploy/incomingFlow';
|
|
8
8
|
import type { JSONSchema7 } from 'json-schema';
|
|
@@ -13,6 +13,17 @@ export type ApiPublicIntegration = Merge<Pick<IntegrationConfig, 'created_at' |
|
|
|
13
13
|
} & ApiPublicIntegrationInclude;
|
|
14
14
|
export interface ApiPublicIntegrationInclude {
|
|
15
15
|
webhook_url?: string | null;
|
|
16
|
+
credentials?: {
|
|
17
|
+
type: AuthModes['OAuth2'] | AuthModes['OAuth1'] | AuthModes['TBA'];
|
|
18
|
+
client_id: string | null;
|
|
19
|
+
client_secret: string | null;
|
|
20
|
+
scopes: string | null;
|
|
21
|
+
} | {
|
|
22
|
+
type: AuthModes['App'];
|
|
23
|
+
app_id: string | null;
|
|
24
|
+
private_key: string | null;
|
|
25
|
+
app_link: string | null;
|
|
26
|
+
} | null;
|
|
16
27
|
}
|
|
17
28
|
export type GetPublicListIntegrationsLegacy = Endpoint<{
|
|
18
29
|
Method: 'GET';
|
|
@@ -24,6 +35,9 @@ export type GetPublicListIntegrationsLegacy = Endpoint<{
|
|
|
24
35
|
export type GetPublicListIntegrations = Endpoint<{
|
|
25
36
|
Method: 'GET';
|
|
26
37
|
Path: '/integrations';
|
|
38
|
+
Querystring?: {
|
|
39
|
+
connect_session_token: string;
|
|
40
|
+
};
|
|
27
41
|
Success: {
|
|
28
42
|
data: ApiPublicIntegration[];
|
|
29
43
|
};
|
|
@@ -35,7 +49,7 @@ export type GetPublicIntegration = Endpoint<{
|
|
|
35
49
|
uniqueKey: string;
|
|
36
50
|
};
|
|
37
51
|
Querystring: {
|
|
38
|
-
include?: 'webhook'[] | undefined;
|
|
52
|
+
include?: ('webhook' | 'credentials')[] | undefined;
|
|
39
53
|
};
|
|
40
54
|
Success: {
|
|
41
55
|
data: ApiPublicIntegration;
|
|
@@ -64,7 +78,7 @@ export type PostIntegration = Endpoint<{
|
|
|
64
78
|
data: ApiIntegration;
|
|
65
79
|
};
|
|
66
80
|
}>;
|
|
67
|
-
export type ApiIntegration = Merge<IntegrationConfig, ApiTimestamps>;
|
|
81
|
+
export type ApiIntegration = Omit<Merge<IntegrationConfig, ApiTimestamps>, 'oauth_client_secret_iv' | 'oauth_client_secret_tag'>;
|
|
68
82
|
export type GetIntegration = Endpoint<{
|
|
69
83
|
Method: 'GET';
|
|
70
84
|
Path: '/api/v1/integrations/:providerConfigKey';
|
package/dist/integration/db.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
+
import type { SetOptional } from 'type-fest';
|
|
1
2
|
import type { TimestampsAndDeleted } from '../db.js';
|
|
3
|
+
import type { NullablePartial } from '../utils.js';
|
|
2
4
|
export interface IntegrationConfig extends TimestampsAndDeleted {
|
|
3
|
-
id?: number;
|
|
5
|
+
id?: number | undefined;
|
|
4
6
|
unique_key: string;
|
|
5
7
|
provider: string;
|
|
6
|
-
oauth_client_id: string;
|
|
7
|
-
oauth_client_secret: string;
|
|
8
|
-
oauth_scopes?: string;
|
|
8
|
+
oauth_client_id: string | null;
|
|
9
|
+
oauth_client_secret: string | null;
|
|
10
|
+
oauth_scopes?: string | undefined | null;
|
|
9
11
|
environment_id: number;
|
|
10
12
|
oauth_client_secret_iv?: string | null;
|
|
11
13
|
oauth_client_secret_tag?: string | null;
|
|
12
|
-
app_link?: string | null;
|
|
13
|
-
custom?: Record<string, string
|
|
14
|
+
app_link?: string | null | undefined;
|
|
15
|
+
custom?: Record<string, string> | undefined | null;
|
|
16
|
+
missing_fields: string[];
|
|
14
17
|
}
|
|
18
|
+
export type DBCreateIntegration = SetOptional<NullablePartial<Omit<IntegrationConfig, 'created_at' | 'updated_at'>>, 'missing_fields'>;
|
package/dist/logs/messages.d.ts
CHANGED
|
@@ -37,6 +37,10 @@ export interface OperationAction {
|
|
|
37
37
|
type: 'action';
|
|
38
38
|
action: 'run';
|
|
39
39
|
}
|
|
40
|
+
export interface OperationOnEvents {
|
|
41
|
+
type: 'events';
|
|
42
|
+
action: 'post_connection_creation' | 'pre_connection_deletion';
|
|
43
|
+
}
|
|
40
44
|
export interface OperationAuth {
|
|
41
45
|
type: 'auth';
|
|
42
46
|
action: 'create_connection' | 'refresh_token' | 'post_connection' | 'connection_test';
|
|
@@ -53,7 +57,7 @@ export interface OperationDeploy {
|
|
|
53
57
|
type: 'deploy';
|
|
54
58
|
action: 'prebuilt' | 'custom';
|
|
55
59
|
}
|
|
56
|
-
export type OperationList = OperationSync | OperationProxy | OperationAction | OperationWebhook | OperationDeploy | OperationAuth | OperationAdmin;
|
|
60
|
+
export type OperationList = OperationSync | OperationProxy | OperationAction | OperationWebhook | OperationOnEvents | OperationDeploy | OperationAuth | OperationAdmin;
|
|
57
61
|
/**
|
|
58
62
|
* Full schema
|
|
59
63
|
*/
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { OnEventType } from '../scripts/on-events/api';
|
|
1
2
|
export type HTTP_METHOD = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
|
|
2
3
|
export type SyncTypeLiteral = 'incremental' | 'full';
|
|
3
4
|
export type ScriptFileType = 'actions' | 'syncs' | 'on-events' | 'post-connection-scripts';
|
|
4
|
-
export type ScriptTypeLiteral = 'action' | 'sync';
|
|
5
|
+
export type ScriptTypeLiteral = 'action' | 'sync' | 'on-event';
|
|
5
6
|
export interface NangoYamlV1 {
|
|
6
7
|
integrations: Record<string, Record<string, NangoYamlV1Integration>>;
|
|
7
8
|
models: NangoYamlModel;
|
|
@@ -63,7 +64,6 @@ export interface NangoYamlModelFields {
|
|
|
63
64
|
}
|
|
64
65
|
export type NangoYamlModelField = boolean | number | string | null | string[] | NangoYamlModelFields;
|
|
65
66
|
export type NangoYaml = NangoYamlV1 | NangoYamlV2;
|
|
66
|
-
export type OnEventType = 'post-connection-creation' | 'pre-connection-deletion';
|
|
67
67
|
export interface NangoYamlParsed {
|
|
68
68
|
yamlVersion: 'v1' | 'v2';
|
|
69
69
|
integrations: NangoYamlParsedIntegration[];
|
package/dist/providers/api.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export type GetPublicProviders = Endpoint<{
|
|
|
5
5
|
Path: `/providers`;
|
|
6
6
|
Querystring: {
|
|
7
7
|
search?: string | undefined;
|
|
8
|
+
connect_session_token?: string;
|
|
8
9
|
};
|
|
9
10
|
Success: {
|
|
10
11
|
data: ApiProvider[];
|
|
@@ -19,6 +20,9 @@ export type GetPublicProvider = Endpoint<{
|
|
|
19
20
|
Params: {
|
|
20
21
|
provider: string;
|
|
21
22
|
};
|
|
23
|
+
Querystring?: {
|
|
24
|
+
connect_session_token: string;
|
|
25
|
+
};
|
|
22
26
|
Success: {
|
|
23
27
|
data: ApiProvider;
|
|
24
28
|
};
|
|
@@ -33,6 +33,7 @@ export interface SimplifiedJSONSchema {
|
|
|
33
33
|
suffix?: string;
|
|
34
34
|
doc_section?: string;
|
|
35
35
|
secret?: string;
|
|
36
|
+
automated: boolean;
|
|
36
37
|
}
|
|
37
38
|
export interface BaseProvider {
|
|
38
39
|
display_name: string;
|
|
@@ -55,13 +56,13 @@ export interface BaseProvider {
|
|
|
55
56
|
};
|
|
56
57
|
};
|
|
57
58
|
authorization_url?: string;
|
|
58
|
-
|
|
59
|
+
authorization_url_skip_encode?: string[];
|
|
59
60
|
access_token_url?: string;
|
|
60
61
|
authorization_params?: Record<string, string>;
|
|
61
62
|
scope_separator?: string;
|
|
62
63
|
default_scopes?: string[];
|
|
63
64
|
token_url?: string | TokenUrlObject;
|
|
64
|
-
|
|
65
|
+
token_url_skip_encode?: string[];
|
|
65
66
|
token_params?: Record<string, string>;
|
|
66
67
|
authorization_url_replacements?: Record<string, string>;
|
|
67
68
|
redirect_uri_metadata?: string[];
|
package/dist/runner/index.d.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DBOnEventScript } from './db.js';
|
|
2
|
+
export type OnEventType = 'post-connection-creation' | 'pre-connection-deletion';
|
|
3
|
+
export interface OnEventScript {
|
|
4
|
+
id: DBOnEventScript['id'];
|
|
5
|
+
configId: DBOnEventScript['config_id'];
|
|
6
|
+
providerConfigKey: string;
|
|
7
|
+
name: DBOnEventScript['name'];
|
|
8
|
+
fileLocation: DBOnEventScript['file_location'];
|
|
9
|
+
version: DBOnEventScript['version'];
|
|
10
|
+
active: DBOnEventScript['active'];
|
|
11
|
+
event: OnEventType;
|
|
12
|
+
createdAt: DBOnEventScript['created_at'];
|
|
13
|
+
updatedAt: DBOnEventScript['updated_at'];
|
|
14
|
+
}
|
package/dist/user/api.d.ts
CHANGED
package/dist/utils.d.ts
CHANGED
|
@@ -10,4 +10,7 @@ export interface Logger {
|
|
|
10
10
|
}
|
|
11
11
|
type ValidateSelection<T, U> = U extends T ? U : never;
|
|
12
12
|
export type PickFromUnion<T, U extends T> = ValidateSelection<T, U>;
|
|
13
|
+
export type NullablePartial<TBase, TNullableKey extends keyof TBase = {
|
|
14
|
+
[K in keyof TBase]: null extends TBase[K] ? K : never;
|
|
15
|
+
}[keyof TBase]> = Partial<Pick<TBase, TNullableKey>> & Pick<TBase, Exclude<keyof TBase, TNullableKey>>;
|
|
13
16
|
export {};
|
package/dist/web/env.d.ts
CHANGED
|
@@ -4,8 +4,9 @@ export interface WindowEnv {
|
|
|
4
4
|
connectUrl: string;
|
|
5
5
|
publicSentryKey: string;
|
|
6
6
|
publicPosthogKey: string;
|
|
7
|
-
|
|
7
|
+
publicPosthogHost: string;
|
|
8
8
|
publicLogoDevKey: string;
|
|
9
|
+
publicKoalaKey: string;
|
|
9
10
|
isCloud: boolean;
|
|
10
11
|
features: {
|
|
11
12
|
logs: boolean;
|
package/dist/webhooks/api.d.ts
CHANGED
|
@@ -39,6 +39,13 @@ export interface NangoAuthWebhookBodyBase extends NangoWebhookBase {
|
|
|
39
39
|
provider: string;
|
|
40
40
|
environment: string;
|
|
41
41
|
operation: AuthOperationType;
|
|
42
|
+
/**
|
|
43
|
+
* Only presents if the connection happened with a session token
|
|
44
|
+
*/
|
|
45
|
+
endUser?: {
|
|
46
|
+
endUserId: string;
|
|
47
|
+
organizationId?: string | undefined;
|
|
48
|
+
} | undefined;
|
|
42
49
|
}
|
|
43
50
|
export interface NangoAuthWebhookBodySuccess extends NangoAuthWebhookBodyBase {
|
|
44
51
|
success: true;
|