@nangohq/types 0.40.0 → 0.40.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.
- package/dist/api.d.ts +1 -1
- package/dist/environment/api/webhook.d.ts +46 -0
- package/dist/environment/db.d.ts +10 -0
- package/dist/index.d.ts +6 -0
- package/dist/logs/messages.d.ts +1 -0
- package/dist/nangoYaml/index.d.ts +106 -0
- package/dist/proxy/api.d.ts +1 -2
- package/dist/utils.d.ts +9 -0
- package/dist/webhooks/api.d.ts +49 -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'>;
|
|
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<'missing_auth_header'> | ApiError<'generic_error_support', undefined, string>;
|
|
15
15
|
export type EndpointMethod = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
|
|
16
16
|
/**
|
|
17
17
|
* API Request/Response type
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Endpoint } from '../../api.js';
|
|
2
|
+
export interface WebhookSettings {
|
|
3
|
+
alwaysSendWebhook: boolean;
|
|
4
|
+
sendAuthWebhook: boolean;
|
|
5
|
+
sendRefreshFailedWebhook: boolean;
|
|
6
|
+
sendSyncFailedWebhook: boolean;
|
|
7
|
+
}
|
|
8
|
+
export type UpdateWebhookSettings = Endpoint<{
|
|
9
|
+
Method: 'PATCH';
|
|
10
|
+
Querystring: {
|
|
11
|
+
env: string;
|
|
12
|
+
};
|
|
13
|
+
Path: '/api/v1/environment/webhook/settings';
|
|
14
|
+
Body: WebhookSettings;
|
|
15
|
+
Success: WebhookSettings;
|
|
16
|
+
}>;
|
|
17
|
+
export type UpdatePrimaryUrl = Endpoint<{
|
|
18
|
+
Method: 'PATCH';
|
|
19
|
+
Querystring: {
|
|
20
|
+
env: string;
|
|
21
|
+
};
|
|
22
|
+
Path: '/api/v1/environment/webhook/url/primary-url';
|
|
23
|
+
Body: {
|
|
24
|
+
url: string;
|
|
25
|
+
};
|
|
26
|
+
Success: {
|
|
27
|
+
data: {
|
|
28
|
+
url: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}>;
|
|
32
|
+
export type UpdateSecondaryUrl = Endpoint<{
|
|
33
|
+
Method: 'PATCH';
|
|
34
|
+
Querystring: {
|
|
35
|
+
env: string;
|
|
36
|
+
};
|
|
37
|
+
Path: '/api/v1/environment/webhook/secondary-url';
|
|
38
|
+
Body: {
|
|
39
|
+
url: string;
|
|
40
|
+
};
|
|
41
|
+
Success: {
|
|
42
|
+
data: {
|
|
43
|
+
url: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
}>;
|
package/dist/environment/db.d.ts
CHANGED
|
@@ -35,3 +35,13 @@ export interface Environment extends Timestamps {
|
|
|
35
35
|
slack_notifications: boolean;
|
|
36
36
|
webhook_receive_url?: string;
|
|
37
37
|
}
|
|
38
|
+
export interface ExternalWebhook extends Timestamps {
|
|
39
|
+
id: number;
|
|
40
|
+
environment_id: number;
|
|
41
|
+
primary_url: string;
|
|
42
|
+
secondary_url: string;
|
|
43
|
+
on_sync_completion_always: boolean;
|
|
44
|
+
on_auth_creation: boolean;
|
|
45
|
+
on_auth_refresh_error: boolean;
|
|
46
|
+
on_sync_error: boolean;
|
|
47
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export type * from './account/db.js';
|
|
|
11
11
|
export type * from './user/api.js';
|
|
12
12
|
export type * from './connection/api/metadata.js';
|
|
13
13
|
export type * from './connection/db.js';
|
|
14
|
+
export type * from './proxy/api.js';
|
|
14
15
|
export type * from './environment/db.js';
|
|
15
16
|
export type * from './scripts/post-connection/api.js';
|
|
16
17
|
export type * from './scripts/post-connection/db.js';
|
|
@@ -21,3 +22,8 @@ export type * from './integration/db.js';
|
|
|
21
22
|
export type * from './integration/template.js';
|
|
22
23
|
export type * from './auth/api.js';
|
|
23
24
|
export type * from './auth/db.js';
|
|
25
|
+
export type * from './nangoYaml/index.js';
|
|
26
|
+
export type * from './utils.js';
|
|
27
|
+
export type * from './environment/db.js';
|
|
28
|
+
export type * from './environment/api/webhook.js';
|
|
29
|
+
export type * from './webhooks/api.js';
|
package/dist/logs/messages.d.ts
CHANGED
|
@@ -120,3 +120,4 @@ export type OperationRow = Pick<MessageRow, OperationRequired> & Omit<MessageRow
|
|
|
120
120
|
export type MessageRowInsert = Pick<MessageRow, 'type' | 'message'> & Partial<Omit<MessageRow, 'type' | 'message'>> & {
|
|
121
121
|
id?: string | undefined;
|
|
122
122
|
};
|
|
123
|
+
export type LogsBuffer = Pick<MessageRow, 'level' | 'message' | 'createdAt'> & Partial<Pick<MessageRow, 'error' | 'meta'>>;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
export type HTTP_VERB = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
|
|
2
|
+
export type SyncTypeLiteral = 'incremental' | 'full';
|
|
3
|
+
export interface NangoYamlV1 {
|
|
4
|
+
integrations: Record<string, Record<string, NangoYamlV1Integration>>;
|
|
5
|
+
models: NangoYamlModel;
|
|
6
|
+
}
|
|
7
|
+
export interface NangoYamlV1Integration {
|
|
8
|
+
type?: 'action' | 'sync';
|
|
9
|
+
returns?: string | string[];
|
|
10
|
+
description?: string;
|
|
11
|
+
runs?: string;
|
|
12
|
+
track_deletes?: boolean;
|
|
13
|
+
auto_start?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface NangoYamlV2 {
|
|
16
|
+
integrations: Record<string, NangoYamlV2Integration>;
|
|
17
|
+
models: NangoYamlModel;
|
|
18
|
+
}
|
|
19
|
+
export interface NangoYamlV2Integration {
|
|
20
|
+
provider?: string;
|
|
21
|
+
syncs?: Record<string, NangoYamlV2IntegrationSync>;
|
|
22
|
+
actions?: Record<string, NangoYamlV2IntegrationAction>;
|
|
23
|
+
'post-connection-scripts'?: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface NangoYamlV2IntegrationSync {
|
|
26
|
+
endpoint: string | string[];
|
|
27
|
+
output: string | string[];
|
|
28
|
+
description?: string;
|
|
29
|
+
sync_type?: SyncTypeLiteral;
|
|
30
|
+
track_deletes?: boolean;
|
|
31
|
+
auto_start?: boolean;
|
|
32
|
+
runs: string;
|
|
33
|
+
scopes?: string | string[];
|
|
34
|
+
input?: string;
|
|
35
|
+
'webhook-subscriptions'?: string | string[];
|
|
36
|
+
}
|
|
37
|
+
export interface NangoYamlV2IntegrationAction {
|
|
38
|
+
endpoint: string;
|
|
39
|
+
output?: string | string[];
|
|
40
|
+
description?: string;
|
|
41
|
+
scopes?: string | string[];
|
|
42
|
+
input?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface NangoYamlModel {
|
|
45
|
+
[key: string]: NangoYamlModelFields;
|
|
46
|
+
}
|
|
47
|
+
export interface NangoYamlModelFields {
|
|
48
|
+
[key: string]: NangoYamlModelField;
|
|
49
|
+
}
|
|
50
|
+
export type NangoYamlModelField = boolean | number | string | null | string[] | NangoYamlModelFields;
|
|
51
|
+
export type NangoYaml = NangoYamlV1 | NangoYamlV2;
|
|
52
|
+
export interface NangoYamlParsed {
|
|
53
|
+
yamlVersion: 'v1' | 'v2';
|
|
54
|
+
integrations: NangoYamlParsedIntegration[];
|
|
55
|
+
models: Map<string, NangoModel>;
|
|
56
|
+
}
|
|
57
|
+
export interface NangoYamlParsedIntegration {
|
|
58
|
+
providerConfigKey: string;
|
|
59
|
+
syncs: ParsedNangoSync[];
|
|
60
|
+
actions: ParsedNangoAction[];
|
|
61
|
+
postConnectionScripts: string[];
|
|
62
|
+
}
|
|
63
|
+
export interface ParsedNangoSync {
|
|
64
|
+
name: string;
|
|
65
|
+
type: 'sync';
|
|
66
|
+
endpoints: NangoSyncEndpoint[];
|
|
67
|
+
description: string;
|
|
68
|
+
sync_type: SyncTypeLiteral;
|
|
69
|
+
track_deletes: boolean;
|
|
70
|
+
auto_start: boolean;
|
|
71
|
+
runs: string;
|
|
72
|
+
scopes: string[];
|
|
73
|
+
input: string | null;
|
|
74
|
+
output: string[] | null;
|
|
75
|
+
usedModels: string[];
|
|
76
|
+
webhookSubscriptions: string[];
|
|
77
|
+
}
|
|
78
|
+
export interface ParsedNangoAction {
|
|
79
|
+
name: string;
|
|
80
|
+
type: 'action';
|
|
81
|
+
description: string;
|
|
82
|
+
input: string | null;
|
|
83
|
+
output: string[] | null;
|
|
84
|
+
endpoint: NangoSyncEndpoint | null;
|
|
85
|
+
scopes: string[];
|
|
86
|
+
usedModels: string[];
|
|
87
|
+
}
|
|
88
|
+
export type LayoutMode = 'root' | 'nested';
|
|
89
|
+
export interface NangoModel {
|
|
90
|
+
name: string;
|
|
91
|
+
fields: NangoModelField[];
|
|
92
|
+
isAnon?: boolean;
|
|
93
|
+
}
|
|
94
|
+
export interface NangoModelField {
|
|
95
|
+
name: string;
|
|
96
|
+
value: string | number | boolean | null | undefined | NangoModelField[];
|
|
97
|
+
dynamic?: boolean;
|
|
98
|
+
tsType?: boolean;
|
|
99
|
+
model?: boolean;
|
|
100
|
+
array?: boolean;
|
|
101
|
+
union?: boolean;
|
|
102
|
+
optional?: boolean;
|
|
103
|
+
}
|
|
104
|
+
export type NangoSyncEndpoint = {
|
|
105
|
+
[key in HTTP_VERB]?: string;
|
|
106
|
+
};
|
package/dist/proxy/api.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { EndpointMethod } from '../api.js';
|
|
|
3
3
|
import type { BasicApiCredentials, ApiKeyCredentials, AppCredentials } from '../auth/api.js';
|
|
4
4
|
import type { Connection } from '../connection/db.js';
|
|
5
5
|
import type { Template as ProviderTemplate } from '../integration/template.js';
|
|
6
|
-
interface BaseProxyConfiguration {
|
|
6
|
+
export interface BaseProxyConfiguration {
|
|
7
7
|
providerConfigKey: string;
|
|
8
8
|
connectionId: string;
|
|
9
9
|
endpoint: string;
|
|
@@ -62,4 +62,3 @@ export interface LinkPagination extends Pagination {
|
|
|
62
62
|
export interface OffsetPagination extends Pagination {
|
|
63
63
|
offset_name_in_request: string;
|
|
64
64
|
}
|
|
65
|
-
export {};
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { AuthOperationType, AuthModeType } from '../auth/api.js';
|
|
2
|
+
import type { SyncResult, SyncType } from '../scripts/syncs/api.js';
|
|
3
|
+
import type { ErrorPayload } from '../api.js';
|
|
4
|
+
export type WebhookTypes = 'sync' | 'auth' | 'forward';
|
|
5
|
+
export interface NangoSyncWebhookBody {
|
|
6
|
+
from: string;
|
|
7
|
+
type: 'sync';
|
|
8
|
+
connectionId: string;
|
|
9
|
+
providerConfigKey: string;
|
|
10
|
+
syncName: string;
|
|
11
|
+
model: string;
|
|
12
|
+
syncType: SyncType;
|
|
13
|
+
}
|
|
14
|
+
export interface NangoSyncWebhookBodySuccess extends NangoSyncWebhookBody {
|
|
15
|
+
modifiedAfter: string;
|
|
16
|
+
responseResults: SyncResult;
|
|
17
|
+
success: true;
|
|
18
|
+
queryTimeStamp: string | null;
|
|
19
|
+
}
|
|
20
|
+
export interface NangoSyncWebhookBodyError {
|
|
21
|
+
success: false;
|
|
22
|
+
error: ErrorPayload;
|
|
23
|
+
startedAt: string;
|
|
24
|
+
failedAt: string;
|
|
25
|
+
}
|
|
26
|
+
export interface NangoAuthWebhookBody {
|
|
27
|
+
from: string;
|
|
28
|
+
type: 'auth';
|
|
29
|
+
connectionId: string;
|
|
30
|
+
authMode: AuthModeType;
|
|
31
|
+
providerConfigKey: string;
|
|
32
|
+
provider: string;
|
|
33
|
+
environment: string;
|
|
34
|
+
operation: AuthOperationType;
|
|
35
|
+
}
|
|
36
|
+
export interface NangoAuthWebhookBodySuccess extends NangoAuthWebhookBody {
|
|
37
|
+
success: true;
|
|
38
|
+
}
|
|
39
|
+
export interface NangoAuthWebhookBodyError extends NangoAuthWebhookBody {
|
|
40
|
+
success: false;
|
|
41
|
+
error: ErrorPayload;
|
|
42
|
+
}
|
|
43
|
+
export interface NangoForwardWebhookBody {
|
|
44
|
+
from: string;
|
|
45
|
+
type: WebhookTypes;
|
|
46
|
+
connectionId?: string;
|
|
47
|
+
providerConfigKey: string;
|
|
48
|
+
payload: unknown;
|
|
49
|
+
}
|