@nangohq/types 0.42.9 → 0.42.11

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.
@@ -8,7 +8,11 @@ import type { PostForgotPassword, PutResetPassword, PostSignin, PostSignup } fro
8
8
  import type { DeleteInvite, PostInvite } from './invitations/api';
9
9
  import type { GetUser, PatchUser } from './user/api';
10
10
  import type { GetListIntegrations } from './integration/api';
11
- export type APIEndpoints = PostSignup | PostSignin | GetTeam | PutTeam | GetUser | PatchUser | PostInvite | DeleteInvite | DeleteTeamUser | PostInsights | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | GetOnboardingStatus | SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation | GetListIntegrations;
11
+ import type { PostPublicTableauAuthorization, PostPublicTbaAuthorization, PostPublicUnauthenticatedAuthorization } from './auth/http.api';
12
+ import type { GetPublicProvider, GetPublicProviders } from './providers/api';
13
+ export type PublicApiEndpoints = SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation | PostPublicTbaAuthorization | PostPublicTableauAuthorization | PostPublicUnauthenticatedAuthorization | GetPublicProviders | GetPublicProvider;
14
+ export type PrivateApiEndpoints = PostSignup | PostSignin | GetTeam | PutTeam | GetUser | PatchUser | PostInvite | DeleteInvite | DeleteTeamUser | PostInsights | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | GetOnboardingStatus | GetListIntegrations;
15
+ export type APIEndpoints = PrivateApiEndpoints | PublicApiEndpoints;
12
16
  /**
13
17
  * Automatically narrow endpoints type with Method + Path
14
18
  */
@@ -1,43 +1,62 @@
1
1
  import type { ApiError, Endpoint } from '../api';
2
- import type { ConnectionConfig } from '../connection/db';
3
- export type TbaAuthorization = Endpoint<{
2
+ export type PostPublicTbaAuthorization = Endpoint<{
4
3
  Method: 'POST';
5
4
  Body: {
6
5
  token_id: string;
7
6
  token_secret: string;
8
- oauth_client_id_override?: string;
9
- oauth_client_secret_override?: string;
7
+ oauth_client_id_override?: string | undefined;
8
+ oauth_client_secret_override?: string | undefined;
10
9
  };
11
- QueryParams: {
12
- connectionId: string;
13
- connectionConfig: ConnectionConfig;
10
+ Querystring: {
11
+ connection_id: string;
12
+ public_key: string;
13
+ params?: Record<string, any> | undefined;
14
+ hmac?: string | undefined;
14
15
  };
15
16
  Params: {
16
17
  providerConfigKey: string;
17
18
  };
18
19
  Path: '/auth/tba';
19
- Error: ApiError<'invalid_body'> | ApiError<'invalid_query_params'> | ApiError<'unknown_provider_config'> | ApiError<'invalid_auth_mode'> | ApiError<'invalid_credentials'>;
20
+ Error: ApiError<'invalid_body'> | ApiError<'invalid_query_params'> | ApiError<'unknown_provider_config'> | ApiError<'unknown_provider_template'> | ApiError<'invalid_auth_mode'> | ApiError<'invalid_credentials'>;
20
21
  Success: {
21
22
  providerConfigKey: string;
22
23
  connectionId: string;
23
24
  };
24
25
  }>;
25
- export type TableauAuthorization = Endpoint<{
26
+ export type PostPublicTableauAuthorization = Endpoint<{
26
27
  Method: 'POST';
27
28
  Body: {
28
29
  pat_name: string;
29
30
  pat_secret: string;
30
- content_url?: string;
31
+ content_url?: string | undefined;
31
32
  };
32
- QueryParams: {
33
- connectionId: string;
34
- connectionConfig: ConnectionConfig;
33
+ Querystring: {
34
+ connection_id: string;
35
+ public_key: string;
36
+ params?: Record<string, any> | undefined;
37
+ hmac?: string | undefined;
35
38
  };
36
39
  Params: {
37
40
  providerConfigKey: string;
38
41
  };
39
42
  Path: '/auth/tableau';
40
- Error: ApiError<'invalid_body'> | ApiError<'invalid_query_params'> | ApiError<'unknown_provider_config'> | ApiError<'invalid_auth_mode'> | ApiError<'invalid_credentials'>;
43
+ Error: ApiError<'invalid_body'> | ApiError<'invalid_query_params'> | ApiError<'unknown_provider_config'> | ApiError<'unknown_provider_template'> | ApiError<'invalid_auth_mode'> | ApiError<'invalid_credentials'>;
44
+ Success: {
45
+ providerConfigKey: string;
46
+ connectionId: string;
47
+ };
48
+ }>;
49
+ export type PostPublicUnauthenticatedAuthorization = Endpoint<{
50
+ Method: 'POST';
51
+ Querystring: {
52
+ connection_id: string;
53
+ hmac?: string | undefined;
54
+ };
55
+ Params: {
56
+ providerConfigKey: string;
57
+ };
58
+ Path: '/auth/unauthenticated';
59
+ Error: ApiError<'invalid_body'> | ApiError<'invalid_query_params'> | ApiError<'unknown_provider_config'> | ApiError<'unknown_provider_template'> | ApiError<'invalid_auth_mode'> | ApiError<'invalid_credentials'>;
41
60
  Success: {
42
61
  providerConfigKey: string;
43
62
  connectionId: string;
@@ -2,7 +2,7 @@ import type { ApiError, Endpoint } from '../api';
2
2
  import type { ScriptTypeLiteral } from '../nangoYaml';
3
3
  export type PutUpgradePreBuiltFlow = Endpoint<{
4
4
  Method: 'PUT';
5
- Path: '/api/v1/flow/pre-built/upgrade';
5
+ Path: '/api/v1/flows/pre-built/upgrade';
6
6
  Body: {
7
7
  id: number;
8
8
  provider: string;
@@ -19,7 +19,7 @@ export type PutUpgradePreBuiltFlow = Endpoint<{
19
19
  }>;
20
20
  export type PostPreBuiltDeploy = Endpoint<{
21
21
  Method: 'POST';
22
- Path: '/api/v1/flow/pre-built/deploy';
22
+ Path: '/api/v1/flows/pre-built/deploy';
23
23
  Body: {
24
24
  provider: string;
25
25
  providerConfigKey: string;
@@ -33,3 +33,61 @@ export type PostPreBuiltDeploy = Endpoint<{
33
33
  };
34
34
  };
35
35
  }>;
36
+ export type PatchFlowEnable = Endpoint<{
37
+ Method: 'PATCH';
38
+ Path: '/api/v1/flows/:id/enable';
39
+ Params: {
40
+ id: number;
41
+ };
42
+ Body: {
43
+ provider: string;
44
+ providerConfigKey: string;
45
+ scriptName: string;
46
+ type: ScriptTypeLiteral;
47
+ };
48
+ Error: ApiError<'unknown_provider'> | ApiError<'resource_capped'> | ApiError<'unknown_sync_config'>;
49
+ Success: {
50
+ data: {
51
+ success: boolean;
52
+ };
53
+ };
54
+ }>;
55
+ export type PatchFlowDisable = Endpoint<{
56
+ Method: 'PATCH';
57
+ Path: '/api/v1/flows/:id/disable';
58
+ Params: {
59
+ id: number;
60
+ };
61
+ Body: {
62
+ provider: string;
63
+ providerConfigKey: string;
64
+ scriptName: string;
65
+ type: ScriptTypeLiteral;
66
+ };
67
+ Error: ApiError<'unknown_provider'>;
68
+ Success: {
69
+ data: {
70
+ success: boolean;
71
+ };
72
+ };
73
+ }>;
74
+ export type PatchFlowFrequency = Endpoint<{
75
+ Method: 'PATCH';
76
+ Path: '/api/v1/flows/:id/frequency';
77
+ Params: {
78
+ id: number;
79
+ };
80
+ Body: {
81
+ provider: string;
82
+ providerConfigKey: string;
83
+ scriptName: string;
84
+ type: ScriptTypeLiteral;
85
+ frequency: string;
86
+ };
87
+ Error: ApiError<'unknown_provider'> | ApiError<'unknown_sync_config'> | ApiError<'failed_to_update_frequency'>;
88
+ Success: {
89
+ data: {
90
+ success: boolean;
91
+ };
92
+ };
93
+ }>;
package/dist/index.d.ts CHANGED
@@ -14,8 +14,11 @@ export type * from './connection/db.js';
14
14
  export type * from './meta/api.js';
15
15
  export type * from './invitations/api.js';
16
16
  export type * from './invitations/db.js';
17
+ export type * from './syncConfigs/db.js';
18
+ export type * from './syncConfigs/api.js';
17
19
  export type * from './team/api.js';
18
20
  export type * from './team/db.js';
21
+ export type * from './providers/api.js';
19
22
  export type * from './proxy/api.js';
20
23
  export type * from './environment/db.js';
21
24
  export type * from './scripts/post-connection/db.js';
@@ -25,7 +28,7 @@ export type * from './notification/active-logs/db.js';
25
28
  export type * from './connection/api/get.js';
26
29
  export type * from './integration/api.js';
27
30
  export type * from './integration/db.js';
28
- export type * from './integration/template.js';
31
+ export type * from './providers/provider.js';
29
32
  export type * from './auth/api.js';
30
33
  export type * from './auth/db.js';
31
34
  export type * from './auth/http.api.js';
@@ -1,4 +1,12 @@
1
- import type { Endpoint } from '../api';
1
+ import type { Merge } from 'type-fest';
2
+ import type { ApiTimestamps, Endpoint } from '../api';
3
+ import type { IntegrationConfig } from './db';
4
+ import type { Provider } from '../providers/provider';
5
+ import type { AuthModeType } from '../auth/api';
6
+ import type { NangoModel, NangoSyncEndpoint, ScriptTypeLiteral } from '../nangoYaml';
7
+ import type { LegacySyncModelSchema, NangoConfigMetadata } from '../deploy/incomingFlow';
8
+ import type { JSONSchema7 } from 'json-schema';
9
+ import type { SyncType } from '../scripts/syncs/api';
2
10
  export type GetListIntegrations = Endpoint<{
3
11
  Method: 'GET';
4
12
  Path: '/config';
@@ -19,9 +27,70 @@ export type DeleteIntegrationPublic = Endpoint<{
19
27
  success: true;
20
28
  };
21
29
  }>;
30
+ export type PostIntegration = Endpoint<{
31
+ Method: 'POST';
32
+ Path: '/api/v1/integrations';
33
+ Body: {
34
+ provider: string;
35
+ };
36
+ Success: {
37
+ data: ApiIntegration;
38
+ };
39
+ }>;
40
+ export type ApiIntegration = Merge<IntegrationConfig, ApiTimestamps>;
41
+ export type GetIntegration = Endpoint<{
42
+ Method: 'GET';
43
+ Path: '/api/v1/integrations/:providerConfigKey';
44
+ Params: {
45
+ providerConfigKey: string;
46
+ };
47
+ Success: {
48
+ data: {
49
+ integration: ApiIntegration;
50
+ template: Provider;
51
+ meta: {
52
+ connectionsCount: number;
53
+ webhookUrl: string | null;
54
+ webhookSecret: string | null;
55
+ };
56
+ };
57
+ };
58
+ }>;
59
+ export type PatchIntegration = Endpoint<{
60
+ Method: 'PATCH';
61
+ Path: '/api/v1/integrations/:providerConfigKey';
62
+ Params: {
63
+ providerConfigKey: string;
64
+ };
65
+ Body: {
66
+ integrationId?: string | undefined;
67
+ } | {
68
+ authType: Extract<AuthModeType, 'OAUTH1' | 'OAUTH2' | 'TBA'>;
69
+ clientId: string;
70
+ clientSecret: string;
71
+ scopes?: string | undefined;
72
+ } | {
73
+ authType: Extract<AuthModeType, 'APP'>;
74
+ appId: string;
75
+ appLink: string;
76
+ privateKey: string;
77
+ } | {
78
+ authType: Extract<AuthModeType, 'CUSTOM'>;
79
+ clientId: string;
80
+ clientSecret: string;
81
+ appId: string;
82
+ appLink: string;
83
+ privateKey: string;
84
+ };
85
+ Success: {
86
+ data: {
87
+ success: boolean;
88
+ };
89
+ };
90
+ }>;
22
91
  export type DeleteIntegration = Endpoint<{
23
92
  Method: 'DELETE';
24
- Path: '/api/v1/integration/:providerConfigKey';
93
+ Path: '/api/v1/integrations/:providerConfigKey';
25
94
  Params: {
26
95
  providerConfigKey: string;
27
96
  };
@@ -31,3 +100,41 @@ export type DeleteIntegration = Endpoint<{
31
100
  };
32
101
  };
33
102
  }>;
103
+ export interface NangoSyncConfig {
104
+ name: string;
105
+ type?: ScriptTypeLiteral;
106
+ runs: string;
107
+ auto_start?: boolean;
108
+ attributes?: object;
109
+ description?: string;
110
+ scopes?: string[];
111
+ metadata?: NangoConfigMetadata;
112
+ track_deletes?: boolean;
113
+ returns: string[] | string;
114
+ models: any[];
115
+ endpoints: NangoSyncEndpoint[];
116
+ is_public?: boolean | null;
117
+ pre_built?: boolean | null;
118
+ version?: string | null;
119
+ last_deployed?: string | null;
120
+ id?: number;
121
+ input?: NangoModel | LegacySyncModelSchema;
122
+ sync_type?: SyncType;
123
+ nango_yaml_version?: string;
124
+ webhookSubscriptions?: string[];
125
+ enabled?: boolean;
126
+ json_schema: JSONSchema7 | null;
127
+ upgrade_version?: string;
128
+ }
129
+ export type GetIntegrationFlows = Endpoint<{
130
+ Method: 'GET';
131
+ Path: '/api/v1/integrations/:providerConfigKey/flows';
132
+ Params: {
133
+ providerConfigKey: string;
134
+ };
135
+ Success: {
136
+ data: {
137
+ flows: NangoSyncConfig[];
138
+ };
139
+ };
140
+ }>;
@@ -0,0 +1,25 @@
1
+ import type { Endpoint } from '../api';
2
+ import type { Provider } from './provider';
3
+ export type GetPublicProviders = Endpoint<{
4
+ Method: 'GET';
5
+ Path: `/providers`;
6
+ Querystring: {
7
+ search?: string | undefined;
8
+ };
9
+ Success: {
10
+ data: ApiProvider[];
11
+ };
12
+ }>;
13
+ export type ApiProvider = Provider & {
14
+ name: string;
15
+ };
16
+ export type GetPublicProvider = Endpoint<{
17
+ Method: 'GET';
18
+ Path: `/providers/:provider`;
19
+ Params: {
20
+ provider: string;
21
+ };
22
+ Success: {
23
+ data: ApiProvider;
24
+ };
25
+ }>;
@@ -12,7 +12,13 @@ export interface TokenUrlObject {
12
12
  APP?: string;
13
13
  NONE?: string;
14
14
  }
15
- export interface Template {
15
+ export interface ProviderAlias {
16
+ alias?: string;
17
+ proxy: {
18
+ base_url?: string;
19
+ };
20
+ }
21
+ export interface BaseProvider {
16
22
  auth_mode: AuthModeType;
17
23
  proxy?: {
18
24
  base_url: string;
@@ -49,7 +55,7 @@ export interface Template {
49
55
  categories?: string[];
50
56
  connection_configuration?: string[];
51
57
  }
52
- export interface TemplateOAuth2 extends Template {
58
+ export interface ProviderOAuth2 extends BaseProvider {
53
59
  auth_mode: 'OAUTH2' | 'CUSTOM';
54
60
  disable_pkce?: boolean;
55
61
  token_params?: {
@@ -64,7 +70,7 @@ export interface TemplateOAuth2 extends Template {
64
70
  expires_in_unit?: 'milliseconds';
65
71
  token_request_auth_method?: 'basic' | 'custom';
66
72
  }
67
- export interface TemplateOAuth1 extends Template {
73
+ export interface ProviderOAuth1 extends BaseProvider {
68
74
  auth_mode: 'OAUTH1';
69
75
  request_url: string;
70
76
  request_params?: Record<string, string>;
@@ -72,3 +78,4 @@ export interface TemplateOAuth1 extends Template {
72
78
  token_http_method?: 'GET' | 'PUT' | 'POST';
73
79
  signature_method: 'HMAC-SHA1' | 'RSA-SHA1' | 'PLAINTEXT';
74
80
  }
81
+ export type Provider = BaseProvider | ProviderOAuth1 | ProviderOAuth2;
@@ -2,7 +2,7 @@ import type { ParamsSerializerOptions } from 'axios';
2
2
  import type { EndpointMethod } from '../api.js';
3
3
  import type { BasicApiCredentials, ApiKeyCredentials, AppCredentials } from '../auth/api.js';
4
4
  import type { Connection } from '../connection/db.js';
5
- import type { Template as ProviderTemplate } from '../integration/template.js';
5
+ import type { Provider } from '../providers/provider.js';
6
6
  export interface BaseProxyConfiguration {
7
7
  providerConfigKey: string;
8
8
  connectionId: string;
@@ -25,16 +25,16 @@ export interface UserProvidedProxyConfiguration extends BaseProxyConfiguration {
25
25
  export interface ApplicationConstructedProxyConfiguration extends BaseProxyConfiguration {
26
26
  decompress?: boolean;
27
27
  method: EndpointMethod;
28
- provider: string;
28
+ providerName: string;
29
29
  token: string | BasicApiCredentials | ApiKeyCredentials | AppCredentials;
30
- template: ProviderTemplate;
30
+ provider: Provider;
31
31
  connection: Connection;
32
32
  }
33
33
  export type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream';
34
34
  export interface InternalProxyConfiguration {
35
- provider: string;
35
+ providerName: string;
36
36
  connection: Connection;
37
- existingActivityLogId?: number | null;
37
+ existingActivityLogId?: string | null | undefined;
38
38
  }
39
39
  export interface RetryHeaderConfig {
40
40
  at?: string;
@@ -0,0 +1,4 @@
1
+ import type { Merge } from 'type-fest';
2
+ import type { ApiTimestamps } from '../api';
3
+ import type { DBSyncConfig } from './db';
4
+ export type ApiSyncConfig = Merge<DBSyncConfig, ApiTimestamps>;
@@ -0,0 +1,28 @@
1
+ import type { JSONSchema7 } from 'json-schema';
2
+ import type { TimestampsAndDeleted } from '../db';
3
+ import type { LegacySyncModelSchema, NangoConfigMetadata } from '../deploy/incomingFlow';
4
+ import type { NangoModel, ScriptTypeLiteral, SyncTypeLiteral } from '../nangoYaml';
5
+ export interface DBSyncConfig extends TimestampsAndDeleted {
6
+ id: number;
7
+ sync_name: string;
8
+ nango_config_id: number;
9
+ file_location: string;
10
+ version: string;
11
+ models: string[] | null;
12
+ active: boolean;
13
+ runs: string | null;
14
+ model_schema: LegacySyncModelSchema[] | NangoModel[] | null;
15
+ environment_id: number;
16
+ track_deletes: boolean;
17
+ type: ScriptTypeLiteral;
18
+ auto_start: boolean;
19
+ attributes: object;
20
+ pre_built: boolean;
21
+ is_public: boolean;
22
+ metadata: NangoConfigMetadata;
23
+ input: string | undefined;
24
+ sync_type: SyncTypeLiteral | undefined;
25
+ webhook_subscriptions: string[] | null;
26
+ enabled: boolean;
27
+ models_json_schema: JSONSchema7 | null;
28
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/types",
3
- "version": "0.42.9",
3
+ "version": "0.42.11",
4
4
  "description": "Types used in Nango applications",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",