@nangohq/types 0.56.1 → 0.56.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/index.d.ts +1 -0
- package/dist/jobs/api.d.ts +53 -0
- package/dist/logs/api.d.ts +2 -2
- package/dist/logs/messages.d.ts +63 -54
- package/dist/persist/api.d.ts +17 -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<'invalid_content_type'> | ApiError<'not_found'> | ApiError<'conflict'> | ApiError<'forbidden'> | ApiError<'invalid_query_params', ValidationError[]> | ApiError<'invalid_headers', 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'> | ApiError<'invalid_connect_session_token_format'>;
|
|
14
|
+
export type ResDefaultErrors = ApiError<'invalid_content_type'> | ApiError<'not_found'> | ApiError<'conflict'> | ApiError<'forbidden'> | ApiError<'invalid_query_params', ValidationError[]> | ApiError<'invalid_headers', 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'> | ApiError<'invalid_connect_session_token_format'> | ApiError<'request_too_large'>;
|
|
15
15
|
export type EndpointMethod = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
|
|
16
16
|
/**
|
|
17
17
|
* API Request/Response type
|
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { JsonValue } from 'type-fest';
|
|
2
|
+
import type { ApiError, Endpoint } from '../api';
|
|
3
|
+
import type { RunnerOutputError } from '../runner';
|
|
4
|
+
import type { NangoProps } from '../runner/sdk';
|
|
5
|
+
export type PostHeartbeat = Endpoint<{
|
|
6
|
+
Method: 'POST';
|
|
7
|
+
Path: '/tasks/:taskId/heartbeat';
|
|
8
|
+
Params: {
|
|
9
|
+
taskId: string;
|
|
10
|
+
};
|
|
11
|
+
Body: never;
|
|
12
|
+
Error: ApiError<'heartbeat_failed'>;
|
|
13
|
+
Success: never;
|
|
14
|
+
}>;
|
|
15
|
+
export type PutTask = Endpoint<{
|
|
16
|
+
Method: 'PUT';
|
|
17
|
+
Path: '/tasks/:taskId';
|
|
18
|
+
Params: {
|
|
19
|
+
taskId: string;
|
|
20
|
+
};
|
|
21
|
+
Body: {
|
|
22
|
+
nangoProps?: NangoProps | undefined;
|
|
23
|
+
error?: RunnerOutputError | undefined;
|
|
24
|
+
output?: JsonValue | undefined;
|
|
25
|
+
};
|
|
26
|
+
Error: ApiError<'put_task_failed'>;
|
|
27
|
+
Success: never;
|
|
28
|
+
}>;
|
|
29
|
+
export type PostRegister = Endpoint<{
|
|
30
|
+
Method: 'POST';
|
|
31
|
+
Path: '/runners/:nodeId/register';
|
|
32
|
+
Params: {
|
|
33
|
+
nodeId: number;
|
|
34
|
+
};
|
|
35
|
+
Body: {
|
|
36
|
+
url: string;
|
|
37
|
+
};
|
|
38
|
+
Error: ApiError<'register_failed'>;
|
|
39
|
+
Success: {
|
|
40
|
+
status: 'ok';
|
|
41
|
+
};
|
|
42
|
+
}>;
|
|
43
|
+
export type PostIdle = Endpoint<{
|
|
44
|
+
Method: 'POST';
|
|
45
|
+
Path: '/runners/:nodeId/idle';
|
|
46
|
+
Params: {
|
|
47
|
+
nodeId: number;
|
|
48
|
+
};
|
|
49
|
+
Error: ApiError<'idle_failed'>;
|
|
50
|
+
Success: {
|
|
51
|
+
status: 'ok';
|
|
52
|
+
};
|
|
53
|
+
}>;
|
package/dist/logs/api.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Endpoint } from '../api';
|
|
2
2
|
import type { PickFromUnion } from '../utils';
|
|
3
|
-
import type { MessageRow,
|
|
3
|
+
import type { MessageRow, OperationList, OperationRow, OperationState } from './messages';
|
|
4
4
|
type Concat<T extends OperationList> = T extends {
|
|
5
5
|
action: string;
|
|
6
6
|
} ? `${T['type']}:${T['action']}` : never;
|
|
@@ -30,7 +30,7 @@ export type SearchOperations = Endpoint<{
|
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
32
|
}>;
|
|
33
|
-
export type SearchOperationsState = 'all' |
|
|
33
|
+
export type SearchOperationsState = 'all' | OperationState;
|
|
34
34
|
export type SearchOperationsType = 'all' | ConcatOperationListWithGroup;
|
|
35
35
|
export type SearchOperationsIntegration = 'all' | string;
|
|
36
36
|
export type SearchOperationsConnection = 'all' | string;
|
package/dist/logs/messages.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Merge
|
|
1
|
+
import type { Merge } from 'type-fest';
|
|
2
2
|
/**
|
|
3
3
|
* Level of the log and operation
|
|
4
4
|
*/
|
|
@@ -13,15 +13,10 @@ export type MessageMeta = Record<any, any>;
|
|
|
13
13
|
* - http: an HTTP request with request/response added to the log
|
|
14
14
|
*/
|
|
15
15
|
export type MessageType = 'log' | 'http';
|
|
16
|
-
/**
|
|
17
|
-
* Error code attached to the message
|
|
18
|
-
* Not used yet
|
|
19
|
-
*/
|
|
20
|
-
export type MessageCode = 'success';
|
|
21
16
|
/**
|
|
22
17
|
* State of the Operation
|
|
23
18
|
*/
|
|
24
|
-
export type
|
|
19
|
+
export type OperationState = 'waiting' | 'running' | 'success' | 'failed' | 'timeout' | 'cancelled';
|
|
25
20
|
/**
|
|
26
21
|
* Operations
|
|
27
22
|
*/
|
|
@@ -58,64 +53,83 @@ export interface OperationDeploy {
|
|
|
58
53
|
action: 'prebuilt' | 'custom';
|
|
59
54
|
}
|
|
60
55
|
export type OperationList = OperationSync | OperationProxy | OperationAction | OperationWebhook | OperationOnEvents | OperationDeploy | OperationAuth | OperationAdmin;
|
|
56
|
+
export interface MessageError {
|
|
57
|
+
name: string;
|
|
58
|
+
message: string;
|
|
59
|
+
type?: string | undefined;
|
|
60
|
+
payload?: any;
|
|
61
|
+
}
|
|
62
|
+
export interface MessageHTTPRequest {
|
|
63
|
+
url: string;
|
|
64
|
+
method: string;
|
|
65
|
+
headers: Record<string, string>;
|
|
66
|
+
body?: unknown;
|
|
67
|
+
}
|
|
68
|
+
export interface MessageHTTPResponse {
|
|
69
|
+
code: number;
|
|
70
|
+
headers: Record<string, string>;
|
|
71
|
+
}
|
|
72
|
+
export interface MessageHTTPRetry {
|
|
73
|
+
attempt: number;
|
|
74
|
+
max: number;
|
|
75
|
+
waited: number;
|
|
76
|
+
}
|
|
61
77
|
/**
|
|
62
78
|
* Full schema
|
|
63
79
|
*/
|
|
64
80
|
export interface MessageRow {
|
|
81
|
+
/**
|
|
82
|
+
* This ID is for debugging purpose, not for insertion
|
|
83
|
+
* It should never be used to index
|
|
84
|
+
*/
|
|
65
85
|
id: string;
|
|
66
86
|
source: 'internal' | 'user';
|
|
67
87
|
level: LogLevel;
|
|
68
88
|
type: MessageType;
|
|
69
89
|
message: string;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
90
|
+
parentId: string;
|
|
91
|
+
error?: MessageError | undefined;
|
|
92
|
+
request?: MessageHTTPRequest | undefined;
|
|
93
|
+
response?: MessageHTTPResponse | undefined;
|
|
94
|
+
meta?: MessageMeta | null | undefined;
|
|
95
|
+
retry?: MessageHTTPRetry | undefined;
|
|
96
|
+
createdAt: string;
|
|
97
|
+
endedAt?: string | undefined;
|
|
98
|
+
}
|
|
99
|
+
export interface OperationRow {
|
|
100
|
+
id: string;
|
|
101
|
+
source: 'internal';
|
|
102
|
+
level: LogLevel;
|
|
103
|
+
type: 'operation';
|
|
104
|
+
message: string;
|
|
105
|
+
operation: OperationList;
|
|
106
|
+
state: OperationState;
|
|
107
|
+
accountId: number;
|
|
108
|
+
accountName: string;
|
|
109
|
+
environmentId?: number | undefined;
|
|
110
|
+
environmentName?: string | undefined;
|
|
78
111
|
/**
|
|
79
112
|
* Provider name, i.e: github
|
|
80
113
|
*/
|
|
81
|
-
providerName
|
|
114
|
+
providerName?: string | undefined;
|
|
82
115
|
/**
|
|
83
116
|
* Database ID of the config, i.e: 9
|
|
84
117
|
*/
|
|
85
|
-
integrationId
|
|
118
|
+
integrationId?: number | undefined;
|
|
86
119
|
/**
|
|
87
120
|
* Unique config name, i.e: github-demo
|
|
88
121
|
*/
|
|
89
|
-
integrationName
|
|
90
|
-
connectionId
|
|
91
|
-
connectionName
|
|
92
|
-
syncConfigId
|
|
93
|
-
syncConfigName
|
|
94
|
-
jobId
|
|
95
|
-
userId
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
type?: string | null;
|
|
101
|
-
payload?: any;
|
|
102
|
-
} | null;
|
|
103
|
-
request: {
|
|
104
|
-
url: string;
|
|
105
|
-
method: string;
|
|
106
|
-
headers: Record<string, string>;
|
|
107
|
-
body?: unknown;
|
|
108
|
-
} | null;
|
|
109
|
-
response: {
|
|
110
|
-
code: number;
|
|
111
|
-
headers: Record<string, string>;
|
|
112
|
-
} | null;
|
|
113
|
-
meta: MessageMeta | null;
|
|
114
|
-
retry?: {
|
|
115
|
-
attempt: number;
|
|
116
|
-
max: number;
|
|
117
|
-
waited: number;
|
|
118
|
-
} | undefined;
|
|
122
|
+
integrationName?: string | undefined;
|
|
123
|
+
connectionId?: number | undefined;
|
|
124
|
+
connectionName?: string | undefined;
|
|
125
|
+
syncConfigId?: number | undefined;
|
|
126
|
+
syncConfigName?: string | undefined;
|
|
127
|
+
jobId?: string | undefined;
|
|
128
|
+
userId?: number | undefined;
|
|
129
|
+
error?: MessageError | undefined;
|
|
130
|
+
request?: MessageHTTPRequest | undefined;
|
|
131
|
+
response?: MessageHTTPResponse | undefined;
|
|
132
|
+
meta?: MessageMeta | undefined;
|
|
119
133
|
createdAt: string;
|
|
120
134
|
updatedAt: string;
|
|
121
135
|
startedAt: string | null;
|
|
@@ -123,14 +137,9 @@ export interface MessageRow {
|
|
|
123
137
|
expiresAt: string | null;
|
|
124
138
|
}
|
|
125
139
|
/**
|
|
126
|
-
* What is required to insert
|
|
140
|
+
* What is required to insert an Operation
|
|
127
141
|
*/
|
|
128
|
-
export type OperationRowInsert =
|
|
129
|
-
operation: OperationList;
|
|
130
|
-
}>, 'message'>;
|
|
131
|
-
export type OperationRow = SetNonNullable<Omit<MessageRow, 'operation'>, 'id' | 'message' | 'source' | 'createdAt' | 'accountId' | 'accountName' | 'type' | 'level' | 'expiresAt' | 'state'> & {
|
|
132
|
-
operation: OperationList;
|
|
133
|
-
};
|
|
142
|
+
export type OperationRowInsert = Merge<Partial<OperationRow>, Pick<OperationRow, 'operation'>>;
|
|
134
143
|
/**
|
|
135
144
|
* What is required to insert a Message
|
|
136
145
|
*/
|
package/dist/persist/api.d.ts
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
+
import type { ApiError, Endpoint } from '../api.js';
|
|
2
|
+
import type { MessageRowInsert } from '../logs/messages.js';
|
|
1
3
|
import type { MergingStrategy, NangoRecord } from '../record/api.js';
|
|
4
|
+
interface LogBody {
|
|
5
|
+
activityLogId: string;
|
|
6
|
+
log: MessageRowInsert;
|
|
7
|
+
}
|
|
8
|
+
export type PostLog = Endpoint<{
|
|
9
|
+
Method: 'POST';
|
|
10
|
+
Path: '/environment/:environmentId/log';
|
|
11
|
+
Params: {
|
|
12
|
+
environmentId: number;
|
|
13
|
+
};
|
|
14
|
+
Body: LogBody;
|
|
15
|
+
Error: ApiError<'post_log_failed'>;
|
|
16
|
+
Success: never;
|
|
17
|
+
}>;
|
|
2
18
|
export interface PostRecordsSuccess {
|
|
3
19
|
nextMerging: MergingStrategy;
|
|
4
20
|
}
|
|
@@ -15,3 +31,4 @@ export interface GetRecordsSuccess {
|
|
|
15
31
|
records: NangoRecord[];
|
|
16
32
|
nextCursor?: string;
|
|
17
33
|
}
|
|
34
|
+
export {};
|