@nangohq/types 0.39.27 → 0.39.29
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 +5 -4
- package/dist/api.endpoints.d.ts +3 -2
- package/dist/connection/api/metadata.d.ts +23 -0
- package/dist/connection/db.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/logs/api.d.ts +14 -2
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -10,12 +10,12 @@ export interface ValidationError {
|
|
|
10
10
|
message: string;
|
|
11
11
|
path: (string | number)[];
|
|
12
12
|
}
|
|
13
|
-
export type ResDefaultErrors = ApiError<'not_found'> | ApiError<'invalid_query_params', ValidationError[]> | ApiError<'invalid_body', ValidationError[]> | ApiError<'feature_disabled'>;
|
|
13
|
+
export type ResDefaultErrors = ApiError<'not_found'> | ApiError<'invalid_query_params', ValidationError[]> | ApiError<'invalid_body', ValidationError[]> | ApiError<'invalid_uri_params', ValidationError[]> | ApiError<'feature_disabled'>;
|
|
14
14
|
export type EndpointMethod = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
|
|
15
15
|
/**
|
|
16
16
|
* API Request/Response type
|
|
17
17
|
*/
|
|
18
|
-
export interface
|
|
18
|
+
export interface EndpointDefinition {
|
|
19
19
|
Method: EndpointMethod;
|
|
20
20
|
Path: string;
|
|
21
21
|
Params?: Record<string, any>;
|
|
@@ -23,7 +23,8 @@ export interface Endpoint<T extends {
|
|
|
23
23
|
Querystring?: Record<string, any>;
|
|
24
24
|
Error?: ApiError<any> | never;
|
|
25
25
|
Success: Record<string, any> | never;
|
|
26
|
-
}
|
|
26
|
+
}
|
|
27
|
+
export interface Endpoint<T extends EndpointDefinition> {
|
|
27
28
|
Method: T['Method'];
|
|
28
29
|
Path: T['Path'];
|
|
29
30
|
/**
|
|
@@ -49,7 +50,7 @@ export interface Endpoint<T extends {
|
|
|
49
50
|
/**
|
|
50
51
|
* Response body for any error
|
|
51
52
|
*/
|
|
52
|
-
Errors: ResDefaultErrors | T['Error'];
|
|
53
|
+
Errors: T['Error'] extends ApiError<any> ? ResDefaultErrors | T['Error'] : ResDefaultErrors;
|
|
53
54
|
/**
|
|
54
55
|
* Response body (success + error)
|
|
55
56
|
*/
|
package/dist/api.endpoints.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { EndpointMethod } from './api';
|
|
2
|
-
import type { SearchLogs } from './logs/api';
|
|
2
|
+
import type { GetOperation, SearchLogs } from './logs/api';
|
|
3
3
|
import type { GetOnboardingStatus } from './onboarding/api';
|
|
4
|
-
|
|
4
|
+
import type { SetMetadata, UpdateMetadata } from './connection/api/metadata';
|
|
5
|
+
export type APIEndpoints = SearchLogs | GetOperation | GetOnboardingStatus | SetMetadata | UpdateMetadata;
|
|
5
6
|
/**
|
|
6
7
|
* Automatically narrow endpoints type with Method + Path
|
|
7
8
|
*/
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ApiError, Endpoint } from '../../api';
|
|
2
|
+
import type { Metadata } from '../db';
|
|
3
|
+
export interface MetadataBody {
|
|
4
|
+
connection_id: string | string[];
|
|
5
|
+
provider_config_key: string;
|
|
6
|
+
metadata: Metadata;
|
|
7
|
+
}
|
|
8
|
+
type MetadataError = ApiError<'invalid_body'> | ApiError<'unknown_connection'>;
|
|
9
|
+
export type SetMetadata = Endpoint<{
|
|
10
|
+
Method: 'POST';
|
|
11
|
+
Body: MetadataBody;
|
|
12
|
+
Path: '/connection/metadata';
|
|
13
|
+
Error: MetadataError;
|
|
14
|
+
Success: MetadataBody;
|
|
15
|
+
}>;
|
|
16
|
+
export type UpdateMetadata = Endpoint<{
|
|
17
|
+
Method: 'PATCH';
|
|
18
|
+
Path: '/connection/metadata';
|
|
19
|
+
Body: MetadataBody;
|
|
20
|
+
Error: MetadataError;
|
|
21
|
+
Success: MetadataBody;
|
|
22
|
+
}>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Metadata = Record<string, unknown>;
|
package/dist/index.d.ts
CHANGED
package/dist/logs/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Endpoint } from '../api';
|
|
2
2
|
import type { MessageState, OperationRow } from './messages';
|
|
3
3
|
export type SearchLogs = Endpoint<{
|
|
4
4
|
Method: 'POST';
|
|
@@ -10,7 +10,6 @@ export type SearchLogs = Endpoint<{
|
|
|
10
10
|
limit?: number;
|
|
11
11
|
states?: SearchLogsState[];
|
|
12
12
|
};
|
|
13
|
-
Error: ApiError<'invalid_query_params'>;
|
|
14
13
|
Success: {
|
|
15
14
|
data: OperationRow[];
|
|
16
15
|
pagination: {
|
|
@@ -20,3 +19,16 @@ export type SearchLogs = Endpoint<{
|
|
|
20
19
|
}>;
|
|
21
20
|
export type SearchLogsState = 'all' | MessageState;
|
|
22
21
|
export type SearchLogsData = SearchLogs['Success']['data'][0];
|
|
22
|
+
export type GetOperation = Endpoint<{
|
|
23
|
+
Method: 'GET';
|
|
24
|
+
Path: `/api/v1/logs/operations/:operationId`;
|
|
25
|
+
Querystring: {
|
|
26
|
+
env: string;
|
|
27
|
+
};
|
|
28
|
+
Params: {
|
|
29
|
+
operationId: string;
|
|
30
|
+
};
|
|
31
|
+
Success: {
|
|
32
|
+
data: OperationRow;
|
|
33
|
+
};
|
|
34
|
+
}>;
|