@nangohq/types 0.39.18
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 +45 -0
- package/dist/db.d.ts +10 -0
- package/dist/index.d.ts +4 -0
- package/dist/onboarding/api.d.ts +16 -0
- package/dist/onboarding/db.d.ts +10 -0
- package/dist/record/api.d.ts +13 -0
- package/package.json +18 -0
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface ApiError<TCode extends string> {
|
|
2
|
+
error: {
|
|
3
|
+
code: TCode;
|
|
4
|
+
message?: string | undefined;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* API Request/Response type
|
|
9
|
+
*/
|
|
10
|
+
export interface Endpoint<T extends {
|
|
11
|
+
Params?: Record<string, any>;
|
|
12
|
+
Body?: Record<string, any>;
|
|
13
|
+
Querystring?: Record<string, any>;
|
|
14
|
+
Error?: ApiError<any> | never;
|
|
15
|
+
Success: Record<string, any> | never;
|
|
16
|
+
}> {
|
|
17
|
+
/**
|
|
18
|
+
* URL params
|
|
19
|
+
*/
|
|
20
|
+
Params: T['Params'] extends Record<string, any> ? T['Params'] : never;
|
|
21
|
+
/**
|
|
22
|
+
* URL query string
|
|
23
|
+
*/
|
|
24
|
+
Querystring: T['Querystring'] extends Record<string, any> ? T['Querystring'] : never;
|
|
25
|
+
/**
|
|
26
|
+
* Helpers: Querystring + Params
|
|
27
|
+
*/
|
|
28
|
+
QP: (T['Params'] extends Record<string, any> ? T['Params'] : never) & (T['Querystring'] extends Record<string, any> ? T['Querystring'] : never);
|
|
29
|
+
/**
|
|
30
|
+
* Received body
|
|
31
|
+
*/
|
|
32
|
+
Body: T['Body'] extends Record<string, any> ? T['Body'] : never;
|
|
33
|
+
/**
|
|
34
|
+
* Response body for success
|
|
35
|
+
*/
|
|
36
|
+
Success: T['Success'];
|
|
37
|
+
/**
|
|
38
|
+
* Response body for any error
|
|
39
|
+
*/
|
|
40
|
+
Errors: T['Error'];
|
|
41
|
+
/**
|
|
42
|
+
* Response body (success + error)
|
|
43
|
+
*/
|
|
44
|
+
Reply: T['Error'] extends ApiError<any> ? T['Error'] | T['Success'] : T['Success'];
|
|
45
|
+
}
|
package/dist/db.d.ts
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ApiError, Endpoint } from '../api';
|
|
2
|
+
import type { NangoRecord } from '../record/api';
|
|
3
|
+
export type GetOnboardingStatus = Endpoint<{
|
|
4
|
+
Params: {
|
|
5
|
+
foo: 'bar';
|
|
6
|
+
};
|
|
7
|
+
Error: ApiError<'onboarding_dev_only'> | ApiError<'no_onboarding'> | ApiError<'failed_to_get_records'> | ApiError<'invalid_query_params'>;
|
|
8
|
+
Success: {
|
|
9
|
+
id: number;
|
|
10
|
+
progress: number;
|
|
11
|
+
records: NangoRecord[] | null;
|
|
12
|
+
provider: boolean;
|
|
13
|
+
connection: boolean;
|
|
14
|
+
sync: boolean;
|
|
15
|
+
};
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type RecordLastAction = 'ADDED' | 'UPDATED' | 'DELETED' | 'added' | 'updated' | 'deleted';
|
|
2
|
+
export interface RecordMetadata {
|
|
3
|
+
first_seen_at: string;
|
|
4
|
+
last_modified_at: string;
|
|
5
|
+
last_action: RecordLastAction;
|
|
6
|
+
deleted_at: string | null;
|
|
7
|
+
cursor: string;
|
|
8
|
+
}
|
|
9
|
+
export interface NangoRecord {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
id: string | number;
|
|
12
|
+
_nango_metadata: RecordMetadata;
|
|
13
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nangohq/types",
|
|
3
|
+
"version": "0.39.18",
|
|
4
|
+
"description": "Types used in Nango applications",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"typings": "dist/index.d.ts",
|
|
7
|
+
"scripts": {},
|
|
8
|
+
"keywords": [],
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/NangoHQ/nango.git",
|
|
12
|
+
"directory": "packages/utils"
|
|
13
|
+
},
|
|
14
|
+
"license": "SEE LICENSE IN LICENSE FILE IN GIT REPOSITORY",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist/**/*"
|
|
17
|
+
]
|
|
18
|
+
}
|