@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 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
@@ -0,0 +1,10 @@
1
+ export interface Timestamps {
2
+ created_at?: Date;
3
+ updated_at?: Date;
4
+ }
5
+ export interface Deleted {
6
+ deleted_at?: Date | null;
7
+ deleted?: boolean;
8
+ }
9
+ export interface TimestampsAndDeleted extends Timestamps, Deleted {
10
+ }
@@ -0,0 +1,4 @@
1
+ export type * from './db.js';
2
+ export type * from './onboarding/db.js';
3
+ export type * from './onboarding/api.js';
4
+ export type * from './record/api.js';
@@ -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,10 @@
1
+ import type { Timestamps } from '../db';
2
+ /**
3
+ * Onboarding row in database
4
+ */
5
+ export interface DBOnboarding extends Timestamps {
6
+ id: number;
7
+ user_id: number;
8
+ progress: number;
9
+ complete: boolean;
10
+ }
@@ -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
+ }