@nangohq/types 0.40.1 → 0.40.3
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/index.d.ts +3 -0
- package/dist/logs/api.d.ts +3 -3
- package/dist/logs/messages.d.ts +23 -16
- package/dist/nangoYaml/index.d.ts +106 -0
- package/dist/utils.d.ts +9 -0
- package/package.json +3 -2
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,6 +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';
|
|
24
27
|
export type * from './environment/db.js';
|
|
25
28
|
export type * from './environment/api/webhook.js';
|
|
26
29
|
export type * from './webhooks/api.js';
|
package/dist/logs/api.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Endpoint } from '../api';
|
|
2
|
-
import type {
|
|
3
|
-
type Concat<T extends
|
|
2
|
+
import type { MessageRow, MessageState, OperationList, OperationRow } from './messages';
|
|
3
|
+
type Concat<T extends OperationList> = T[keyof T] | (T extends {
|
|
4
4
|
action: string;
|
|
5
5
|
} ? `${T['type']}:${T['action']}` : never);
|
|
6
6
|
export type SearchOperations = Endpoint<{
|
|
@@ -28,7 +28,7 @@ export type SearchOperations = Endpoint<{
|
|
|
28
28
|
};
|
|
29
29
|
}>;
|
|
30
30
|
export type SearchOperationsState = 'all' | MessageState;
|
|
31
|
-
export type SearchOperationsType = 'all' | Concat<
|
|
31
|
+
export type SearchOperationsType = 'all' | Concat<OperationList>;
|
|
32
32
|
export type SearchOperationsIntegration = 'all' | string;
|
|
33
33
|
export type SearchOperationsConnection = 'all' | string;
|
|
34
34
|
export type SearchOperationsSync = 'all' | string;
|
package/dist/logs/messages.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Merge } from 'type-fest';
|
|
1
2
|
/**
|
|
2
3
|
* Level of the log and operation
|
|
3
4
|
*/
|
|
@@ -24,37 +25,37 @@ export type MessageState = 'waiting' | 'running' | 'success' | 'failed' | 'timeo
|
|
|
24
25
|
/**
|
|
25
26
|
* Operations
|
|
26
27
|
*/
|
|
27
|
-
export interface
|
|
28
|
+
export interface OperationSync {
|
|
28
29
|
type: 'sync';
|
|
29
30
|
action: 'pause' | 'unpause' | 'run' | 'request_run' | 'request_run_full' | 'cancel' | 'init';
|
|
30
31
|
}
|
|
31
|
-
export interface
|
|
32
|
+
export interface OperationProxy {
|
|
32
33
|
type: 'proxy';
|
|
33
34
|
}
|
|
34
|
-
export interface
|
|
35
|
+
export interface OperationAction {
|
|
35
36
|
type: 'action';
|
|
36
37
|
}
|
|
37
|
-
export interface
|
|
38
|
+
export interface OperationAuth {
|
|
38
39
|
type: 'auth';
|
|
39
40
|
action: 'create_connection' | 'refresh_token' | 'post_connection';
|
|
40
41
|
}
|
|
41
|
-
export interface
|
|
42
|
+
export interface OperationAdmin {
|
|
42
43
|
type: 'admin';
|
|
43
44
|
action: 'impersonation';
|
|
44
45
|
}
|
|
45
|
-
export interface
|
|
46
|
+
export interface OperationWebhook {
|
|
46
47
|
type: 'webhook';
|
|
47
48
|
action: 'incoming' | 'outgoing';
|
|
48
49
|
}
|
|
49
|
-
export interface
|
|
50
|
+
export interface OperationDeploy {
|
|
50
51
|
type: 'deploy';
|
|
51
52
|
action: 'prebuilt' | 'custom';
|
|
52
53
|
}
|
|
53
|
-
export type
|
|
54
|
+
export type OperationList = OperationSync | OperationProxy | OperationAction | OperationWebhook | OperationDeploy | OperationAuth | OperationAdmin;
|
|
54
55
|
/**
|
|
55
56
|
* Full schema
|
|
56
57
|
*/
|
|
57
|
-
export
|
|
58
|
+
export interface MessageRow {
|
|
58
59
|
id: string;
|
|
59
60
|
source: 'internal' | 'user';
|
|
60
61
|
level: LogLevel;
|
|
@@ -63,6 +64,7 @@ export type MessageRow = {
|
|
|
63
64
|
title: string | null;
|
|
64
65
|
state: MessageState;
|
|
65
66
|
code: MessageCode | null;
|
|
67
|
+
operation: null;
|
|
66
68
|
accountId: number | null;
|
|
67
69
|
accountName: string | null;
|
|
68
70
|
environmentId: number | null;
|
|
@@ -105,18 +107,23 @@ export type MessageRow = {
|
|
|
105
107
|
startedAt: string | null;
|
|
106
108
|
endedAt: string | null;
|
|
107
109
|
expiresAt: string | null;
|
|
108
|
-
}
|
|
109
|
-
operation: MessageOperation | null;
|
|
110
|
-
};
|
|
110
|
+
}
|
|
111
111
|
/**
|
|
112
112
|
* What is required to insert a Message
|
|
113
113
|
*/
|
|
114
|
-
export type
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
export type OperationRowInsert = Merge<Partial<MessageRow>, {
|
|
115
|
+
message: string;
|
|
116
|
+
operation: OperationList;
|
|
117
|
+
}>;
|
|
118
|
+
export type OperationRow = Merge<Required<OperationRowInsert>, {
|
|
119
|
+
accountId: number;
|
|
120
|
+
accountName: string;
|
|
121
|
+
}>;
|
|
117
122
|
/**
|
|
118
123
|
* What is required to insert a Message
|
|
119
124
|
*/
|
|
120
125
|
export type MessageRowInsert = Pick<MessageRow, 'type' | 'message'> & Partial<Omit<MessageRow, 'type' | 'message'>> & {
|
|
121
|
-
id?:
|
|
126
|
+
id?: never;
|
|
122
127
|
};
|
|
128
|
+
export type LogsBuffer = Pick<MessageRow, 'level' | 'message' | 'createdAt'> & Partial<Pick<MessageRow, 'error' | 'meta'>>;
|
|
129
|
+
export type MessageOrOperationRow = MessageRow | OperationRow;
|
|
@@ -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/utils.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nangohq/types",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.3",
|
|
4
4
|
"description": "Types used in Nango applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"directory": "packages/utils"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"axios": "^1.3.4"
|
|
15
|
+
"axios": "^1.3.4",
|
|
16
|
+
"type-fest": "4.14.0"
|
|
16
17
|
},
|
|
17
18
|
"license": "SEE LICENSE IN LICENSE FILE IN GIT REPOSITORY",
|
|
18
19
|
"files": [
|