@nangohq/types 0.42.8 → 0.42.10
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/connection/api/get.d.ts +29 -0
- package/dist/flow/http.api.d.ts +61 -3
- package/dist/index.d.ts +3 -0
- package/dist/integration/api.d.ts +109 -2
- package/dist/logs/api.d.ts +5 -3
- package/dist/logs/messages.d.ts +5 -4
- package/dist/slackNotifications/db.d.ts +11 -0
- package/dist/syncConfigs/api.d.ts +4 -0
- package/dist/syncConfigs/db.d.ts +28 -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<'missing_auth_header'> | ApiError<'generic_error_support', undefined, string> | ApiError<'server_error'>;
|
|
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> | ApiError<'server_error'> | ApiError<'resource_capped'>;
|
|
15
15
|
export type EndpointMethod = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
|
|
16
16
|
/**
|
|
17
17
|
* API Request/Response type
|
|
@@ -19,3 +19,32 @@ export type GetConnection = Endpoint<{
|
|
|
19
19
|
errorLog: ActiveLog | null;
|
|
20
20
|
};
|
|
21
21
|
}>;
|
|
22
|
+
export type DeletePublicConnection = Endpoint<{
|
|
23
|
+
Method: 'DELETE';
|
|
24
|
+
Path: '/connection/:connectionId';
|
|
25
|
+
Params: {
|
|
26
|
+
connectionId: string;
|
|
27
|
+
};
|
|
28
|
+
Querystring: {
|
|
29
|
+
provider_config_key: string;
|
|
30
|
+
};
|
|
31
|
+
Error: ApiError<'unknown_connection'> | ApiError<'unknown_provider_config'>;
|
|
32
|
+
Success: {
|
|
33
|
+
success: boolean;
|
|
34
|
+
};
|
|
35
|
+
}>;
|
|
36
|
+
export type DeleteConnection = Endpoint<{
|
|
37
|
+
Method: 'DELETE';
|
|
38
|
+
Path: '/connection/:connectionId';
|
|
39
|
+
Params: {
|
|
40
|
+
connectionId: string;
|
|
41
|
+
};
|
|
42
|
+
Querystring: {
|
|
43
|
+
provider_config_key: string;
|
|
44
|
+
env: string;
|
|
45
|
+
};
|
|
46
|
+
Error: ApiError<'unknown_connection'> | ApiError<'unknown_provider_config'>;
|
|
47
|
+
Success: {
|
|
48
|
+
success: boolean;
|
|
49
|
+
};
|
|
50
|
+
}>;
|
package/dist/flow/http.api.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ApiError, Endpoint } from '../api';
|
|
|
2
2
|
import type { ScriptTypeLiteral } from '../nangoYaml';
|
|
3
3
|
export type PutUpgradePreBuiltFlow = Endpoint<{
|
|
4
4
|
Method: 'PUT';
|
|
5
|
-
Path: '/api/v1/
|
|
5
|
+
Path: '/api/v1/flows/pre-built/upgrade';
|
|
6
6
|
Body: {
|
|
7
7
|
id: number;
|
|
8
8
|
provider: string;
|
|
@@ -19,17 +19,75 @@ export type PutUpgradePreBuiltFlow = Endpoint<{
|
|
|
19
19
|
}>;
|
|
20
20
|
export type PostPreBuiltDeploy = Endpoint<{
|
|
21
21
|
Method: 'POST';
|
|
22
|
-
Path: '/api/v1/
|
|
22
|
+
Path: '/api/v1/flows/pre-built/deploy';
|
|
23
23
|
Body: {
|
|
24
24
|
provider: string;
|
|
25
25
|
providerConfigKey: string;
|
|
26
26
|
scriptName: string;
|
|
27
27
|
type: ScriptTypeLiteral;
|
|
28
28
|
};
|
|
29
|
-
Error: ApiError<'unknown_provider'> | ApiError<'
|
|
29
|
+
Error: ApiError<'unknown_provider'> | ApiError<'failed_to_deploy', Error[]> | ApiError<'unknown_flow'>;
|
|
30
30
|
Success: {
|
|
31
31
|
data: {
|
|
32
32
|
id: number;
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
35
|
}>;
|
|
36
|
+
export type PatchFlowEnable = Endpoint<{
|
|
37
|
+
Method: 'PATCH';
|
|
38
|
+
Path: '/api/v1/flows/:id/enable';
|
|
39
|
+
Params: {
|
|
40
|
+
id: number;
|
|
41
|
+
};
|
|
42
|
+
Body: {
|
|
43
|
+
provider: string;
|
|
44
|
+
providerConfigKey: string;
|
|
45
|
+
scriptName: string;
|
|
46
|
+
type: ScriptTypeLiteral;
|
|
47
|
+
};
|
|
48
|
+
Error: ApiError<'unknown_provider'> | ApiError<'resource_capped'> | ApiError<'unknown_sync_config'>;
|
|
49
|
+
Success: {
|
|
50
|
+
data: {
|
|
51
|
+
success: boolean;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
}>;
|
|
55
|
+
export type PatchFlowDisable = Endpoint<{
|
|
56
|
+
Method: 'PATCH';
|
|
57
|
+
Path: '/api/v1/flows/:id/disable';
|
|
58
|
+
Params: {
|
|
59
|
+
id: number;
|
|
60
|
+
};
|
|
61
|
+
Body: {
|
|
62
|
+
provider: string;
|
|
63
|
+
providerConfigKey: string;
|
|
64
|
+
scriptName: string;
|
|
65
|
+
type: ScriptTypeLiteral;
|
|
66
|
+
};
|
|
67
|
+
Error: ApiError<'unknown_provider'>;
|
|
68
|
+
Success: {
|
|
69
|
+
data: {
|
|
70
|
+
success: boolean;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
}>;
|
|
74
|
+
export type PatchFlowFrequency = Endpoint<{
|
|
75
|
+
Method: 'PATCH';
|
|
76
|
+
Path: '/api/v1/flows/:id/frequency';
|
|
77
|
+
Params: {
|
|
78
|
+
id: number;
|
|
79
|
+
};
|
|
80
|
+
Body: {
|
|
81
|
+
provider: string;
|
|
82
|
+
providerConfigKey: string;
|
|
83
|
+
scriptName: string;
|
|
84
|
+
type: ScriptTypeLiteral;
|
|
85
|
+
frequency: string;
|
|
86
|
+
};
|
|
87
|
+
Error: ApiError<'unknown_provider'> | ApiError<'unknown_sync_config'> | ApiError<'failed_to_update_frequency'>;
|
|
88
|
+
Success: {
|
|
89
|
+
data: {
|
|
90
|
+
success: boolean;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
}>;
|
package/dist/index.d.ts
CHANGED
|
@@ -14,12 +14,15 @@ export type * from './connection/db.js';
|
|
|
14
14
|
export type * from './meta/api.js';
|
|
15
15
|
export type * from './invitations/api.js';
|
|
16
16
|
export type * from './invitations/db.js';
|
|
17
|
+
export type * from './syncConfigs/db.js';
|
|
18
|
+
export type * from './syncConfigs/api.js';
|
|
17
19
|
export type * from './team/api.js';
|
|
18
20
|
export type * from './team/db.js';
|
|
19
21
|
export type * from './proxy/api.js';
|
|
20
22
|
export type * from './environment/db.js';
|
|
21
23
|
export type * from './scripts/post-connection/db.js';
|
|
22
24
|
export type * from './scripts/syncs/api.js';
|
|
25
|
+
export type * from './slackNotifications/db.js';
|
|
23
26
|
export type * from './notification/active-logs/db.js';
|
|
24
27
|
export type * from './connection/api/get.js';
|
|
25
28
|
export type * from './integration/api.js';
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Merge } from 'type-fest';
|
|
2
|
+
import type { ApiTimestamps, Endpoint } from '../api';
|
|
3
|
+
import type { IntegrationConfig } from './db';
|
|
4
|
+
import type { Template } from './template';
|
|
5
|
+
import type { AuthModeType } from '../auth/api';
|
|
6
|
+
import type { NangoModel, NangoSyncEndpoint, ScriptTypeLiteral } from '../nangoYaml';
|
|
7
|
+
import type { LegacySyncModelSchema, NangoConfigMetadata } from '../deploy/incomingFlow';
|
|
8
|
+
import type { JSONSchema7 } from 'json-schema';
|
|
9
|
+
import type { SyncType } from '../scripts/syncs/api';
|
|
2
10
|
export type GetListIntegrations = Endpoint<{
|
|
3
11
|
Method: 'GET';
|
|
4
12
|
Path: '/config';
|
|
@@ -19,9 +27,70 @@ export type DeleteIntegrationPublic = Endpoint<{
|
|
|
19
27
|
success: true;
|
|
20
28
|
};
|
|
21
29
|
}>;
|
|
30
|
+
export type PostIntegration = Endpoint<{
|
|
31
|
+
Method: 'POST';
|
|
32
|
+
Path: '/api/v1/integrations';
|
|
33
|
+
Body: {
|
|
34
|
+
provider: string;
|
|
35
|
+
};
|
|
36
|
+
Success: {
|
|
37
|
+
data: ApiIntegration;
|
|
38
|
+
};
|
|
39
|
+
}>;
|
|
40
|
+
export type ApiIntegration = Merge<IntegrationConfig, ApiTimestamps>;
|
|
41
|
+
export type GetIntegration = Endpoint<{
|
|
42
|
+
Method: 'GET';
|
|
43
|
+
Path: '/api/v1/integrations/:providerConfigKey';
|
|
44
|
+
Params: {
|
|
45
|
+
providerConfigKey: string;
|
|
46
|
+
};
|
|
47
|
+
Success: {
|
|
48
|
+
data: {
|
|
49
|
+
integration: ApiIntegration;
|
|
50
|
+
template: Template;
|
|
51
|
+
meta: {
|
|
52
|
+
connectionsCount: number;
|
|
53
|
+
webhookUrl: string | null;
|
|
54
|
+
webhookSecret: string | null;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
}>;
|
|
59
|
+
export type PatchIntegration = Endpoint<{
|
|
60
|
+
Method: 'PATCH';
|
|
61
|
+
Path: '/api/v1/integrations/:providerConfigKey';
|
|
62
|
+
Params: {
|
|
63
|
+
providerConfigKey: string;
|
|
64
|
+
};
|
|
65
|
+
Body: {
|
|
66
|
+
integrationId?: string | undefined;
|
|
67
|
+
} | {
|
|
68
|
+
authType: Extract<AuthModeType, 'OAUTH1' | 'OAUTH2' | 'TBA'>;
|
|
69
|
+
clientId: string;
|
|
70
|
+
clientSecret: string;
|
|
71
|
+
scopes?: string | undefined;
|
|
72
|
+
} | {
|
|
73
|
+
authType: Extract<AuthModeType, 'APP'>;
|
|
74
|
+
appId: string;
|
|
75
|
+
appLink: string;
|
|
76
|
+
privateKey: string;
|
|
77
|
+
} | {
|
|
78
|
+
authType: Extract<AuthModeType, 'CUSTOM'>;
|
|
79
|
+
clientId: string;
|
|
80
|
+
clientSecret: string;
|
|
81
|
+
appId: string;
|
|
82
|
+
appLink: string;
|
|
83
|
+
privateKey: string;
|
|
84
|
+
};
|
|
85
|
+
Success: {
|
|
86
|
+
data: {
|
|
87
|
+
success: boolean;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
}>;
|
|
22
91
|
export type DeleteIntegration = Endpoint<{
|
|
23
92
|
Method: 'DELETE';
|
|
24
|
-
Path: '/api/v1/
|
|
93
|
+
Path: '/api/v1/integrations/:providerConfigKey';
|
|
25
94
|
Params: {
|
|
26
95
|
providerConfigKey: string;
|
|
27
96
|
};
|
|
@@ -31,3 +100,41 @@ export type DeleteIntegration = Endpoint<{
|
|
|
31
100
|
};
|
|
32
101
|
};
|
|
33
102
|
}>;
|
|
103
|
+
export interface NangoSyncConfig {
|
|
104
|
+
name: string;
|
|
105
|
+
type?: ScriptTypeLiteral;
|
|
106
|
+
runs: string;
|
|
107
|
+
auto_start?: boolean;
|
|
108
|
+
attributes?: object;
|
|
109
|
+
description?: string;
|
|
110
|
+
scopes?: string[];
|
|
111
|
+
metadata?: NangoConfigMetadata;
|
|
112
|
+
track_deletes?: boolean;
|
|
113
|
+
returns: string[] | string;
|
|
114
|
+
models: any[];
|
|
115
|
+
endpoints: NangoSyncEndpoint[];
|
|
116
|
+
is_public?: boolean | null;
|
|
117
|
+
pre_built?: boolean | null;
|
|
118
|
+
version?: string | null;
|
|
119
|
+
last_deployed?: string | null;
|
|
120
|
+
id?: number;
|
|
121
|
+
input?: NangoModel | LegacySyncModelSchema;
|
|
122
|
+
sync_type?: SyncType;
|
|
123
|
+
nango_yaml_version?: string;
|
|
124
|
+
webhookSubscriptions?: string[];
|
|
125
|
+
enabled?: boolean;
|
|
126
|
+
json_schema: JSONSchema7 | null;
|
|
127
|
+
upgrade_version?: string;
|
|
128
|
+
}
|
|
129
|
+
export type GetIntegrationFlows = Endpoint<{
|
|
130
|
+
Method: 'GET';
|
|
131
|
+
Path: '/api/v1/integrations/:providerConfigKey/flows';
|
|
132
|
+
Params: {
|
|
133
|
+
providerConfigKey: string;
|
|
134
|
+
};
|
|
135
|
+
Success: {
|
|
136
|
+
data: {
|
|
137
|
+
flows: NangoSyncConfig[];
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
}>;
|
package/dist/logs/api.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { Endpoint } from '../api';
|
|
2
2
|
import type { MessageRow, MessageState, OperationList, OperationRow } from './messages';
|
|
3
|
-
type Concat<T extends OperationList> = T
|
|
3
|
+
type Concat<T extends OperationList> = T extends {
|
|
4
4
|
action: string;
|
|
5
|
-
} ? `${T['type']}:${T['action']}` : never
|
|
5
|
+
} ? `${T['type']}:${T['action']}` : never;
|
|
6
|
+
export type ConcatOperationList = Concat<OperationList>;
|
|
7
|
+
export type ConcatOperationListWithGroup = OperationList[keyof OperationList] | ConcatOperationList;
|
|
6
8
|
export type SearchOperations = Endpoint<{
|
|
7
9
|
Method: 'POST';
|
|
8
10
|
Path: '/api/v1/logs/operations';
|
|
@@ -28,7 +30,7 @@ export type SearchOperations = Endpoint<{
|
|
|
28
30
|
};
|
|
29
31
|
}>;
|
|
30
32
|
export type SearchOperationsState = 'all' | MessageState;
|
|
31
|
-
export type SearchOperationsType = 'all' |
|
|
33
|
+
export type SearchOperationsType = 'all' | ConcatOperationListWithGroup;
|
|
32
34
|
export type SearchOperationsIntegration = 'all' | string;
|
|
33
35
|
export type SearchOperationsConnection = 'all' | string;
|
|
34
36
|
export type SearchOperationsSync = 'all' | string;
|
package/dist/logs/messages.d.ts
CHANGED
|
@@ -31,9 +31,11 @@ export interface OperationSync {
|
|
|
31
31
|
}
|
|
32
32
|
export interface OperationProxy {
|
|
33
33
|
type: 'proxy';
|
|
34
|
+
action: 'call';
|
|
34
35
|
}
|
|
35
36
|
export interface OperationAction {
|
|
36
37
|
type: 'action';
|
|
38
|
+
action: 'run';
|
|
37
39
|
}
|
|
38
40
|
export interface OperationAuth {
|
|
39
41
|
type: 'auth';
|
|
@@ -113,11 +115,11 @@ export interface MessageRow {
|
|
|
113
115
|
/**
|
|
114
116
|
* What is required to insert a Message
|
|
115
117
|
*/
|
|
116
|
-
export type OperationRowInsert = Merge<Partial<MessageRow>, {
|
|
117
|
-
message: string;
|
|
118
|
+
export type OperationRowInsert = Omit<Merge<Partial<MessageRow>, {
|
|
118
119
|
operation: OperationList;
|
|
119
|
-
}>;
|
|
120
|
+
}>, 'message'>;
|
|
120
121
|
export type OperationRow = Merge<Required<OperationRowInsert>, {
|
|
122
|
+
message: string;
|
|
121
123
|
accountId: number;
|
|
122
124
|
accountName: string;
|
|
123
125
|
}>;
|
|
@@ -127,5 +129,4 @@ export type OperationRow = Merge<Required<OperationRowInsert>, {
|
|
|
127
129
|
export type MessageRowInsert = Pick<MessageRow, 'type' | 'message'> & Partial<Omit<MessageRow, 'type' | 'message'>> & {
|
|
128
130
|
id?: never;
|
|
129
131
|
};
|
|
130
|
-
export type LogsBuffer = Pick<MessageRow, 'level' | 'message' | 'createdAt'> & Partial<Pick<MessageRow, 'error' | 'meta' | 'type' | 'request' | 'response'>>;
|
|
131
132
|
export type MessageOrOperationRow = MessageRow | OperationRow;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Timestamps } from '../db';
|
|
2
|
+
export interface DBSlackNotification extends Timestamps {
|
|
3
|
+
id: number;
|
|
4
|
+
open: boolean;
|
|
5
|
+
environment_id: number;
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
connection_list: number[];
|
|
9
|
+
slack_timestamp: string | null;
|
|
10
|
+
admin_slack_timestamp: string | null;
|
|
11
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { JSONSchema7 } from 'json-schema';
|
|
2
|
+
import type { TimestampsAndDeleted } from '../db';
|
|
3
|
+
import type { LegacySyncModelSchema, NangoConfigMetadata } from '../deploy/incomingFlow';
|
|
4
|
+
import type { NangoModel, ScriptTypeLiteral, SyncTypeLiteral } from '../nangoYaml';
|
|
5
|
+
export interface DBSyncConfig extends TimestampsAndDeleted {
|
|
6
|
+
id: number;
|
|
7
|
+
sync_name: string;
|
|
8
|
+
nango_config_id: number;
|
|
9
|
+
file_location: string;
|
|
10
|
+
version: string;
|
|
11
|
+
models: string[] | null;
|
|
12
|
+
active: boolean;
|
|
13
|
+
runs: string | null;
|
|
14
|
+
model_schema: LegacySyncModelSchema[] | NangoModel[] | null;
|
|
15
|
+
environment_id: number;
|
|
16
|
+
track_deletes: boolean;
|
|
17
|
+
type: ScriptTypeLiteral;
|
|
18
|
+
auto_start: boolean;
|
|
19
|
+
attributes: object;
|
|
20
|
+
pre_built: boolean;
|
|
21
|
+
is_public: boolean;
|
|
22
|
+
metadata: NangoConfigMetadata;
|
|
23
|
+
input: string | undefined;
|
|
24
|
+
sync_type: SyncTypeLiteral | undefined;
|
|
25
|
+
webhook_subscriptions: string[] | null;
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
models_json_schema: JSONSchema7 | null;
|
|
28
|
+
}
|