@nangohq/types 0.54.0 → 0.56.0

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 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<'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'>;
15
15
  export type EndpointMethod = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
16
16
  /**
17
17
  * API Request/Response type
@@ -19,7 +19,8 @@ import type { PatchEnvironment, PostEnvironment } from './environment/api';
19
19
  import type { PatchWebhook } from './environment/api/webhook';
20
20
  import type { PostEnvironmentVariables } from './environment/variable/api';
21
21
  import type { GetPublicRecords } from './record/api';
22
- export type PublicApiEndpoints = SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation | PostPublicTbaAuthorization | PostPublicTableauAuthorization | PostPublicJwtAuthorization | PostPublicUnauthenticatedAuthorization | PostPublicApiKeyAuthorization | PostPublicBasicAuthorization | PostPublicAppStoreAuthorization | GetPublicProviders | GetPublicProvider | GetPublicListIntegrationsLegacy | GetPublicListIntegrations | GetPublicIntegration | DeletePublicIntegration | PostConnectSessions | PostPublicConnectSessionsReconnect | GetPublicConnections | GetPublicConnection | GetConnectSession | DeleteConnectSession | PostDeployInternal | PostPublicBillAuthorization | DeletePublicConnection | PostPublicSignatureAuthorization | PostPublicTwoStepAuthorization | PostPublicWebhook | GetPublicRecords;
22
+ import type { GetPublicScriptsConfig } from './scripts/http.api';
23
+ export type PublicApiEndpoints = SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation | PostPublicTbaAuthorization | PostPublicTableauAuthorization | PostPublicJwtAuthorization | PostPublicUnauthenticatedAuthorization | PostPublicApiKeyAuthorization | PostPublicBasicAuthorization | PostPublicAppStoreAuthorization | GetPublicProviders | GetPublicProvider | GetPublicListIntegrationsLegacy | GetPublicListIntegrations | GetPublicIntegration | DeletePublicIntegration | PostConnectSessions | PostPublicConnectSessionsReconnect | GetPublicConnections | GetPublicConnection | GetConnectSession | DeleteConnectSession | PostDeployInternal | PostPublicBillAuthorization | DeletePublicConnection | PostPublicSignatureAuthorization | PostPublicTwoStepAuthorization | PostPublicWebhook | GetPublicRecords | GetPublicScriptsConfig;
23
24
  export type PrivateApiEndpoints = PostSignup | PostSignin | GetTeam | PutTeam | GetUser | PatchUser | PostInvite | DeleteInvite | DeleteTeamUser | PostInsights | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | PatchOnboarding | PostInternalConnectSessions | GetIntegrationFlows | DeleteIntegration | PatchIntegration | GetIntegration | PostIntegration | GetConnections | GetConnectionsCount | GetConnection | GetInvite | GetMeta | GetEmailByExpiredToken | GetEmailByUuid | GetManagedCallback | PatchFlowDisable | PatchFlowEnable | PatchFlowFrequency | PutUpgradePreBuiltFlow | PostConnectionRefresh | PostManagedSignup | PostPreBuiltDeploy | PostEnvironment | PatchEnvironment | PatchWebhook | PostEnvironmentVariables;
24
25
  export type APIEndpoints = PrivateApiEndpoints | PublicApiEndpoints;
25
26
  /**
@@ -1,13 +1,13 @@
1
1
  import type { JSONSchema7 } from 'json-schema';
2
2
  import type { Endpoint, ApiError } from '../api.js';
3
- import type { IncomingFlowConfig, OnEventScriptsByProvider } from './incomingFlow.js';
3
+ import type { CLIDeployFlowConfig, OnEventScriptsByProvider } from './incomingFlow.js';
4
4
  import type { SyncDeploymentResult } from './index.js';
5
5
  import type { OnEventType } from '../scripts/on-events/api.js';
6
6
  export type PostDeployConfirmation = Endpoint<{
7
7
  Method: 'POST';
8
8
  Path: '/sync/deploy/confirmation';
9
9
  Body: {
10
- flowConfigs: IncomingFlowConfig[];
10
+ flowConfigs: CLIDeployFlowConfig[];
11
11
  onEventScriptsByProvider?: OnEventScriptsByProvider[] | undefined;
12
12
  reconcile: boolean;
13
13
  debug: boolean;
@@ -20,7 +20,7 @@ export type PostDeploy = Endpoint<{
20
20
  Method: 'POST';
21
21
  Path: '/sync/deploy';
22
22
  Body: {
23
- flowConfigs: IncomingFlowConfig[];
23
+ flowConfigs: CLIDeployFlowConfig[];
24
24
  onEventScriptsByProvider?: OnEventScriptsByProvider[] | undefined;
25
25
  nangoYamlBody: string;
26
26
  reconcile: boolean;
@@ -37,7 +37,7 @@ export type PostDeployInternal = Endpoint<{
37
37
  customEnvironment: string;
38
38
  };
39
39
  Body: {
40
- flowConfigs: IncomingFlowConfig[];
40
+ flowConfigs: CLIDeployFlowConfig[];
41
41
  onEventScriptsByProvider?: OnEventScriptsByProvider[] | undefined;
42
42
  nangoYamlBody: string;
43
43
  reconcile: boolean;
@@ -25,20 +25,16 @@ export interface LegacySyncModelSchema {
25
25
  type: string;
26
26
  }[];
27
27
  }
28
- interface InternalIncomingPreBuiltFlowConfig {
28
+ export interface PreBuiltFlowConfig {
29
29
  type: ScriptTypeLiteral;
30
30
  models: string[];
31
31
  runs: string | null;
32
- auto_start?: boolean;
32
+ auto_start?: boolean | undefined;
33
33
  attributes?: object | undefined;
34
34
  metadata?: NangoConfigMetadata | undefined;
35
35
  model_schema: string | NangoModel[];
36
- input?: string | LegacySyncModelSchema | undefined;
37
- endpoints?: (NangoSyncEndpointV2 | NangoSyncEndpointOld)[] | undefined;
38
36
  track_deletes: boolean;
39
37
  providerConfigKey: string;
40
- }
41
- export interface IncomingPreBuiltFlowConfig extends InternalIncomingPreBuiltFlowConfig {
42
38
  provider: string;
43
39
  is_public: boolean;
44
40
  public_route: string;
@@ -47,15 +43,29 @@ export interface IncomingPreBuiltFlowConfig extends InternalIncomingPreBuiltFlow
47
43
  nango_config_id?: number;
48
44
  fileBody?: IncomingScriptFiles;
49
45
  endpoints: NangoSyncEndpointV2[];
46
+ input?: NangoModel | LegacySyncModelSchema | undefined;
50
47
  }
51
- export interface IncomingFlowConfig extends InternalIncomingPreBuiltFlowConfig {
48
+ export interface CLIDeployFlowConfig {
49
+ type: ScriptTypeLiteral;
50
+ models: string[];
51
+ runs: string | null;
52
+ auto_start?: boolean;
53
+ attributes?: object | undefined;
54
+ metadata?: NangoConfigMetadata | undefined;
55
+ model_schema: string | NangoModel[];
56
+ endpoints?: (NangoSyncEndpointV2 | NangoSyncEndpointOld)[] | undefined;
57
+ track_deletes: boolean;
58
+ providerConfigKey: string;
59
+ input?: string | undefined;
52
60
  syncName: string;
53
61
  fileBody: IncomingScriptFiles;
54
62
  version?: string | undefined;
55
63
  sync_type?: SyncTypeLiteral | undefined;
56
64
  webhookSubscriptions?: string[] | undefined;
57
65
  }
58
- export type CleanedIncomingFlowConfig = Merge<IncomingFlowConfig, {
66
+ /**
67
+ * Flow shape after being sent by the CLI and cleaned in the backend
68
+ */
69
+ export type CleanedIncomingFlowConfig = Merge<CLIDeployFlowConfig, {
59
70
  endpoints: NangoSyncEndpointV2[];
60
71
  }>;
61
- export {};
@@ -9,6 +9,7 @@ export interface SyncDeploymentResult {
9
9
  input?: string | LegacySyncModelSchema | undefined | null;
10
10
  models: string | string[];
11
11
  id?: number | undefined;
12
+ runs?: string | null;
12
13
  /** @deprecated legacy **/
13
14
  sync_name?: string;
14
15
  /** @deprecated legacy **/
@@ -0,0 +1,35 @@
1
+ import type { JSONSchema7 } from 'json-schema';
2
+ import type { LegacySyncModelSchema, NangoConfigMetadata } from '../deploy/incomingFlow';
3
+ import type { NangoModel, NangoSyncEndpointV2, ScriptTypeLiteral, SyncTypeLiteral } from '../nangoYaml';
4
+ export interface NangoSyncConfig {
5
+ name: string;
6
+ type?: ScriptTypeLiteral;
7
+ runs?: string | null;
8
+ auto_start?: boolean;
9
+ attributes?: object;
10
+ description?: string;
11
+ scopes?: string[];
12
+ metadata?: NangoConfigMetadata;
13
+ track_deletes?: boolean;
14
+ returns: string[];
15
+ models: NangoModel[] | LegacySyncModelSchema[];
16
+ endpoints: NangoSyncEndpointV2[];
17
+ is_public?: boolean | null;
18
+ pre_built?: boolean | null;
19
+ version?: string | null;
20
+ last_deployed?: string | null;
21
+ id?: number;
22
+ input?: NangoModel | LegacySyncModelSchema | undefined;
23
+ sync_type?: SyncTypeLiteral;
24
+ webhookSubscriptions?: string[];
25
+ enabled?: boolean;
26
+ json_schema: JSONSchema7 | null;
27
+ upgrade_version?: string;
28
+ }
29
+ export interface StandardNangoConfig {
30
+ providerConfigKey: string;
31
+ provider?: string;
32
+ syncs: NangoSyncConfig[];
33
+ actions: NangoSyncConfig[];
34
+ [`on-events`]: NangoSyncConfig[];
35
+ }
package/dist/index.d.ts CHANGED
@@ -24,9 +24,11 @@ export type * from './proxy/api.js';
24
24
  export type * from './scripts/on-events/db.js';
25
25
  export type * from './scripts/on-events/api.js';
26
26
  export type * from './scripts/syncs/api.js';
27
+ export type * from './scripts/http.api.js';
27
28
  export type * from './slackNotifications/db.js';
28
29
  export type * from './notification/active-logs/db.js';
29
30
  export type * from './connection/api/get.js';
31
+ export type * from './sync/api.js';
30
32
  export type * from './integration/api.js';
31
33
  export type * from './integration/db.js';
32
34
  export type * from './providers/provider.js';
@@ -52,6 +54,7 @@ export type * from './environment/variable/api.js';
52
54
  export type * from './webhooks/api.js';
53
55
  export type * from './webhooks/http.api.js';
54
56
  export type * from './flow/http.api.js';
57
+ export type * from './flow/index.js';
55
58
  export type * from './utils.js';
56
59
  export type * from './web/env.js';
57
60
  export type * from './fleet/api.js';
@@ -3,9 +3,7 @@ import type { ApiTimestamps, Endpoint } from '../api';
3
3
  import type { IntegrationConfig } from './db';
4
4
  import type { Provider } from '../providers/provider';
5
5
  import type { AuthModeType, AuthModes } from '../auth/api';
6
- import type { NangoModel, NangoSyncEndpointV2, ScriptTypeLiteral, SyncTypeLiteral } from '../nangoYaml';
7
- import type { LegacySyncModelSchema, NangoConfigMetadata } from '../deploy/incomingFlow';
8
- import type { JSONSchema7 } from 'json-schema';
6
+ import type { NangoSyncConfig } from '../flow';
9
7
  export type ApiPublicIntegration = Merge<Pick<IntegrationConfig, 'created_at' | 'updated_at' | 'unique_key' | 'provider'>, ApiTimestamps> & {
10
8
  logo: string;
11
9
  display_name: string;
@@ -157,31 +155,6 @@ export type DeleteIntegration = Endpoint<{
157
155
  };
158
156
  };
159
157
  }>;
160
- export interface NangoSyncConfig {
161
- name: string;
162
- type?: ScriptTypeLiteral;
163
- runs: string;
164
- auto_start?: boolean;
165
- attributes?: object;
166
- description?: string;
167
- scopes?: string[];
168
- metadata?: NangoConfigMetadata;
169
- track_deletes?: boolean;
170
- returns: string[] | string;
171
- models: any[];
172
- endpoints: NangoSyncEndpointV2[];
173
- is_public?: boolean | null;
174
- pre_built?: boolean | null;
175
- version?: string | null;
176
- last_deployed?: string | null;
177
- id?: number;
178
- input?: NangoModel | LegacySyncModelSchema;
179
- sync_type?: SyncTypeLiteral;
180
- webhookSubscriptions?: string[];
181
- enabled?: boolean;
182
- json_schema: JSONSchema7 | null;
183
- upgrade_version?: string;
184
- }
185
158
  export type GetIntegrationFlows = Endpoint<{
186
159
  Method: 'GET';
187
160
  Path: '/api/v1/integrations/:providerConfigKey/flows';
@@ -59,6 +59,7 @@ export interface BaseProvider {
59
59
  authorization_url_skip_encode?: string[];
60
60
  access_token_url?: string;
61
61
  authorization_params?: Record<string, string>;
62
+ authorization_code_param_in_callback?: string;
62
63
  scope_separator?: string;
63
64
  default_scopes?: string[];
64
65
  token_url?: string | TokenUrlObject;
@@ -1,4 +1,3 @@
1
- import type { BasicApiCredentials, ApiKeyCredentials, AppCredentials, TbaCredentials, TableauCredentials, JwtCredentials, TwoStepCredentials, SignatureCredentials } from '../auth/api.js';
2
1
  import type { DBConnectionDecrypted } from '../connection/db.js';
3
2
  import type { HTTP_METHOD } from '../nangoYaml/index.js';
4
3
  import type { Provider } from '../providers/provider.js';
@@ -15,13 +14,12 @@ export interface ProxyFile {
15
14
  }
16
15
  export interface BaseProxyConfiguration {
17
16
  providerConfigKey: string;
18
- connectionId: string;
19
17
  endpoint: string;
20
18
  retries?: number;
21
19
  data?: unknown;
22
20
  files?: ProxyFile[];
23
21
  headers?: Record<string, string>;
24
- params?: string | Record<string, string | number>;
22
+ params?: string | Record<string, string | number | string[] | number[]>;
25
23
  baseUrlOverride?: string;
26
24
  responseType?: ResponseType | undefined;
27
25
  retryHeader?: RetryHeaderConfig;
@@ -32,19 +30,16 @@ export interface UserProvidedProxyConfiguration extends BaseProxyConfiguration {
32
30
  method?: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE' | 'get' | 'post' | 'patch' | 'put' | 'delete';
33
31
  paginate?: Partial<CursorPagination> | Partial<LinkPagination> | Partial<OffsetPagination>;
34
32
  }
33
+ export type ConnectionForProxy = Pick<DBConnectionDecrypted, 'connection_id' | 'connection_config' | 'credentials' | 'metadata'>;
35
34
  export interface ApplicationConstructedProxyConfiguration extends BaseProxyConfiguration {
36
- decompress?: boolean;
35
+ decompress: boolean;
37
36
  method: HTTP_METHOD;
38
37
  providerName: string;
39
- token: string | BasicApiCredentials | ApiKeyCredentials | AppCredentials | TbaCredentials | TableauCredentials | JwtCredentials | TwoStepCredentials | SignatureCredentials;
40
38
  provider: Provider;
41
- connection: Pick<DBConnectionDecrypted, 'connection_id' | 'connection_config' | 'credentials' | 'metadata'>;
42
39
  }
43
40
  export type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream';
44
41
  export interface InternalProxyConfiguration {
45
42
  providerName: string;
46
- connection: Pick<DBConnectionDecrypted, 'connection_id' | 'connection_config' | 'credentials' | 'metadata'>;
47
- existingActivityLogId?: string | null | undefined;
48
43
  }
49
44
  export interface RetryHeaderConfig {
50
45
  at?: string;
@@ -30,6 +30,7 @@ export type GetPublicRecords = Endpoint<{
30
30
  Error: ApiError<'unknown_connection'>;
31
31
  Querystring: {
32
32
  model: string;
33
+ variant?: string | undefined;
33
34
  delta?: string | undefined;
34
35
  modified_after?: string | undefined;
35
36
  limit?: number | undefined;
@@ -0,0 +1,7 @@
1
+ import type { Endpoint } from '../api';
2
+ import type { StandardNangoConfig } from '../flow';
3
+ export type GetPublicScriptsConfig = Endpoint<{
4
+ Method: 'GET';
5
+ Path: `/scripts/config`;
6
+ Success: StandardNangoConfig[];
7
+ }>;
@@ -0,0 +1,35 @@
1
+ import type { ApiError, Endpoint } from '../api.js';
2
+ export type PostSyncVariant = Endpoint<{
3
+ Method: 'POST';
4
+ Path: '/sync/:name/variant/:variant';
5
+ Body: {
6
+ provider_config_key: string;
7
+ connection_id: string;
8
+ };
9
+ Params: {
10
+ name: string;
11
+ variant: string;
12
+ };
13
+ Error: ApiError<'invalid_variant' | 'unknown_connection' | 'unknown_provider_config' | 'unknown_sync' | 'sync_variant_already_exists' | 'failed_sync_variant_creation'>;
14
+ Success: {
15
+ id: string;
16
+ name: string;
17
+ variant: string;
18
+ };
19
+ }>;
20
+ export type DeleteSyncVariant = Endpoint<{
21
+ Method: 'DELETE';
22
+ Path: '/sync/:name/variant/:variant';
23
+ Body: {
24
+ provider_config_key: string;
25
+ connection_id: string;
26
+ };
27
+ Params: {
28
+ name: string;
29
+ variant: string;
30
+ };
31
+ Error: ApiError<'invalid_variant' | 'unknown_connection' | 'failed_sync_variant_deletion'>;
32
+ Success: {
33
+ success: boolean;
34
+ };
35
+ }>;
@@ -12,6 +12,7 @@ export interface NangoSyncWebhookBodyBase extends NangoWebhookBase {
12
12
  connectionId: string;
13
13
  providerConfigKey: string;
14
14
  syncName: string;
15
+ syncVariant: string;
15
16
  model: string;
16
17
  syncType: 'INCREMENTAL' | 'INITIAL' | 'WEBHOOK';
17
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/types",
3
- "version": "0.54.0",
3
+ "version": "0.56.0",
4
4
  "description": "Types used in Nango applications",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",