@nangohq/types 0.45.1 → 0.46.1

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<'not_found'> | ApiError<'invalid_query_params', 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'>;
14
+ export type ResDefaultErrors = ApiError<'not_found'> | ApiError<'invalid_query_params', 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
@@ -55,7 +55,6 @@ export interface ApiKeyCredentials {
55
55
  type: AuthModes['ApiKey'];
56
56
  apiKey: string;
57
57
  }
58
- export type AuthCredentials = OAuth2Credentials | OAuth1Credentials | OAuth2ClientCredentials;
59
58
  export interface AppCredentials {
60
59
  type: AuthModes['App'];
61
60
  access_token: string;
@@ -2,7 +2,11 @@ import type { Endpoint } from '../api.js';
2
2
  export interface ConnectSessionPayload {
3
3
  allowed_integrations?: string[] | undefined;
4
4
  integrations_config_defaults?: Record<string, {
5
- connection_config: Record<string, unknown>;
5
+ user_scopes?: string | undefined;
6
+ connection_config: {
7
+ [key: string]: unknown;
8
+ oauth_scopes_override?: string | undefined;
9
+ };
6
10
  }> | undefined;
7
11
  end_user: {
8
12
  id: string;
@@ -21,7 +25,7 @@ export type PostConnectSessions = Endpoint<{
21
25
  Success: {
22
26
  data: {
23
27
  token: string;
24
- expires_at: Date;
28
+ expires_at: string;
25
29
  };
26
30
  };
27
31
  }>;
@@ -41,5 +45,5 @@ export type PostInternalConnectSessions = Endpoint<{
41
45
  Method: 'POST';
42
46
  Path: '/api/v1/connect/sessions';
43
47
  Success: PostConnectSessions['Success'];
44
- Body: Pick<ConnectSessionPayload, 'allowed_integrations'>;
48
+ Body: Pick<ConnectSessionPayload, 'allowed_integrations' | 'end_user' | 'organization'>;
45
49
  }>;
@@ -5,7 +5,12 @@ export interface ConnectSession {
5
5
  readonly environmentId: number;
6
6
  readonly allowedIntegrations?: string[] | null;
7
7
  readonly integrationsConfigDefaults?: Record<string, {
8
- connectionConfig: Record<string, unknown>;
8
+ /** Only used by Slack */
9
+ user_scopes?: string | undefined;
10
+ connectionConfig: {
11
+ [key: string]: unknown;
12
+ oauth_scopes_override?: string | undefined;
13
+ };
9
14
  }> | null;
10
15
  readonly createdAt: Date;
11
16
  readonly updatedAt: Date | null;
@@ -2,6 +2,7 @@ import type { JSONSchema7 } from 'json-schema';
2
2
  import type { Endpoint, ApiError } from '../api.js';
3
3
  import type { IncomingFlowConfig, OnEventScriptsByProvider } from './incomingFlow.js';
4
4
  import type { SyncDeploymentResult } from './index.js';
5
+ import type { OnEventType } from '../scripts/on-events/api.js';
5
6
  export type PostDeployConfirmation = Endpoint<{
6
7
  Method: 'POST';
7
8
  Path: '/sync/deploy/confirmation';
@@ -13,7 +14,7 @@ export type PostDeployConfirmation = Endpoint<{
13
14
  singleDeployMode?: boolean;
14
15
  jsonSchema?: JSONSchema7 | undefined;
15
16
  };
16
- Success: SyncAndActionDifferences;
17
+ Success: ScriptDifferences;
17
18
  }>;
18
19
  export type PostDeploy = Endpoint<{
19
20
  Method: 'POST';
@@ -61,6 +62,11 @@ export interface SlimAction {
61
62
  providerConfigKey: string;
62
63
  name: string;
63
64
  }
65
+ export interface SlimOnEventScript {
66
+ providerConfigKey: string;
67
+ name: string;
68
+ event: OnEventType;
69
+ }
64
70
  export interface SyncAndActionDifferences {
65
71
  newSyncs: SlimSync[];
66
72
  deletedSyncs: SlimSync[];
@@ -68,3 +74,7 @@ export interface SyncAndActionDifferences {
68
74
  deletedActions: SlimAction[];
69
75
  deletedModels: string[];
70
76
  }
77
+ export interface ScriptDifferences extends SyncAndActionDifferences {
78
+ newOnEventScripts: SlimOnEventScript[];
79
+ deletedOnEventScripts: SlimOnEventScript[];
80
+ }
@@ -1,5 +1,6 @@
1
1
  import type { Merge } from 'type-fest';
2
- import type { NangoModel, NangoSyncEndpointOld, NangoSyncEndpointV2, OnEventType, ScriptTypeLiteral, SyncTypeLiteral } from '../nangoYaml';
2
+ import type { NangoModel, NangoSyncEndpointOld, NangoSyncEndpointV2, ScriptTypeLiteral, SyncTypeLiteral } from '../nangoYaml';
3
+ import type { OnEventType } from '../scripts/on-events/api';
3
4
  export interface IncomingScriptFiles {
4
5
  js: string;
5
6
  ts: string;
package/dist/index.d.ts CHANGED
@@ -22,7 +22,8 @@ export type * from './team/db.js';
22
22
  export type * from './providers/api.js';
23
23
  export type * from './proxy/api.js';
24
24
  export type * from './environment/db.js';
25
- export type * from './scripts/post-connection/db.js';
25
+ export type * from './scripts/on-events/db.js';
26
+ export type * from './scripts/on-events/api.js';
26
27
  export type * from './scripts/syncs/api.js';
27
28
  export type * from './slackNotifications/db.js';
28
29
  export type * from './notification/active-logs/db.js';
@@ -2,7 +2,7 @@ import type { Merge } from 'type-fest';
2
2
  import type { ApiTimestamps, Endpoint } from '../api';
3
3
  import type { IntegrationConfig } from './db';
4
4
  import type { Provider } from '../providers/provider';
5
- import type { AuthModeType } from '../auth/api';
5
+ import type { AuthModeType, AuthModes } from '../auth/api';
6
6
  import type { NangoModel, NangoSyncEndpointV2, ScriptTypeLiteral } from '../nangoYaml';
7
7
  import type { LegacySyncModelSchema, NangoConfigMetadata } from '../deploy/incomingFlow';
8
8
  import type { JSONSchema7 } from 'json-schema';
@@ -13,6 +13,17 @@ export type ApiPublicIntegration = Merge<Pick<IntegrationConfig, 'created_at' |
13
13
  } & ApiPublicIntegrationInclude;
14
14
  export interface ApiPublicIntegrationInclude {
15
15
  webhook_url?: string | null;
16
+ credentials?: {
17
+ type: AuthModes['OAuth2'] | AuthModes['OAuth1'] | AuthModes['TBA'];
18
+ client_id: string | null;
19
+ client_secret: string | null;
20
+ scopes: string | null;
21
+ } | {
22
+ type: AuthModes['App'];
23
+ app_id: string | null;
24
+ private_key: string | null;
25
+ app_link: string | null;
26
+ } | null;
16
27
  }
17
28
  export type GetPublicListIntegrationsLegacy = Endpoint<{
18
29
  Method: 'GET';
@@ -24,6 +35,9 @@ export type GetPublicListIntegrationsLegacy = Endpoint<{
24
35
  export type GetPublicListIntegrations = Endpoint<{
25
36
  Method: 'GET';
26
37
  Path: '/integrations';
38
+ Querystring?: {
39
+ connect_session_token: string;
40
+ };
27
41
  Success: {
28
42
  data: ApiPublicIntegration[];
29
43
  };
@@ -35,7 +49,7 @@ export type GetPublicIntegration = Endpoint<{
35
49
  uniqueKey: string;
36
50
  };
37
51
  Querystring: {
38
- include?: 'webhook'[] | undefined;
52
+ include?: ('webhook' | 'credentials')[] | undefined;
39
53
  };
40
54
  Success: {
41
55
  data: ApiPublicIntegration;
@@ -51,6 +65,14 @@ export type DeletePublicIntegration = Endpoint<{
51
65
  success: true;
52
66
  };
53
67
  }>;
68
+ export type ApiIntegration = Omit<Merge<IntegrationConfig, ApiTimestamps>, 'oauth_client_secret_iv' | 'oauth_client_secret_tag'>;
69
+ export type GetIntegrations = Endpoint<{
70
+ Method: 'GET';
71
+ Path: '/api/v1/integrations';
72
+ Success: {
73
+ data: ApiIntegration[];
74
+ };
75
+ }>;
54
76
  export type PostIntegration = Endpoint<{
55
77
  Method: 'POST';
56
78
  Path: '/api/v1/integrations';
@@ -64,7 +86,6 @@ export type PostIntegration = Endpoint<{
64
86
  data: ApiIntegration;
65
87
  };
66
88
  }>;
67
- export type ApiIntegration = Omit<Merge<IntegrationConfig, ApiTimestamps>, 'oauth_client_secret_iv' | 'oauth_client_secret_tag'>;
68
89
  export type GetIntegration = Endpoint<{
69
90
  Method: 'GET';
70
91
  Path: '/api/v1/integrations/:providerConfigKey';
@@ -1,15 +1,18 @@
1
+ import type { SetOptional } from 'type-fest';
1
2
  import type { TimestampsAndDeleted } from '../db.js';
3
+ import type { NullablePartial } from '../utils.js';
2
4
  export interface IntegrationConfig extends TimestampsAndDeleted {
3
5
  id?: number | undefined;
4
6
  unique_key: string;
5
7
  provider: string;
6
- oauth_client_id: string;
7
- oauth_client_secret: string;
8
- oauth_scopes?: string | undefined;
8
+ oauth_client_id: string | null;
9
+ oauth_client_secret: string | null;
10
+ oauth_scopes?: string | undefined | null;
9
11
  environment_id: number;
10
12
  oauth_client_secret_iv?: string | null;
11
13
  oauth_client_secret_tag?: string | null;
12
14
  app_link?: string | null | undefined;
13
- custom?: Record<string, string> | undefined;
15
+ custom?: Record<string, string> | undefined | null;
14
16
  missing_fields: string[];
15
17
  }
18
+ export type DBCreateIntegration = SetOptional<NullablePartial<Omit<IntegrationConfig, 'created_at' | 'updated_at'>>, 'missing_fields'>;
@@ -1,7 +1,8 @@
1
+ import type { OnEventType } from '../scripts/on-events/api';
1
2
  export type HTTP_METHOD = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
2
3
  export type SyncTypeLiteral = 'incremental' | 'full';
3
4
  export type ScriptFileType = 'actions' | 'syncs' | 'on-events' | 'post-connection-scripts';
4
- export type ScriptTypeLiteral = 'action' | 'sync';
5
+ export type ScriptTypeLiteral = 'action' | 'sync' | 'on-event';
5
6
  export interface NangoYamlV1 {
6
7
  integrations: Record<string, Record<string, NangoYamlV1Integration>>;
7
8
  models: NangoYamlModel;
@@ -63,7 +64,6 @@ export interface NangoYamlModelFields {
63
64
  }
64
65
  export type NangoYamlModelField = boolean | number | string | null | string[] | NangoYamlModelFields;
65
66
  export type NangoYaml = NangoYamlV1 | NangoYamlV2;
66
- export type OnEventType = 'post-connection-creation' | 'pre-connection-deletion';
67
67
  export interface NangoYamlParsed {
68
68
  yamlVersion: 'v1' | 'v2';
69
69
  integrations: NangoYamlParsedIntegration[];
@@ -5,6 +5,7 @@ export type GetPublicProviders = Endpoint<{
5
5
  Path: `/providers`;
6
6
  Querystring: {
7
7
  search?: string | undefined;
8
+ connect_session_token?: string;
8
9
  };
9
10
  Success: {
10
11
  data: ApiProvider[];
@@ -19,6 +20,9 @@ export type GetPublicProvider = Endpoint<{
19
20
  Params: {
20
21
  provider: string;
21
22
  };
23
+ Querystring?: {
24
+ connect_session_token: string;
25
+ };
22
26
  Success: {
23
27
  data: ApiProvider;
24
28
  };
@@ -33,6 +33,7 @@ export interface SimplifiedJSONSchema {
33
33
  suffix?: string;
34
34
  doc_section?: string;
35
35
  secret?: string;
36
+ automated: boolean;
36
37
  }
37
38
  export interface BaseProvider {
38
39
  display_name: string;
@@ -39,6 +39,8 @@ export interface InternalProxyConfiguration {
39
39
  export interface RetryHeaderConfig {
40
40
  at?: string;
41
41
  after?: string;
42
+ remaining?: string;
43
+ error_code?: number;
42
44
  }
43
45
  export declare enum PaginationType {
44
46
  CURSOR = "cursor",
@@ -8,3 +8,9 @@ export interface RunnerOutput {
8
8
  error: RunnerOutputError | null;
9
9
  response?: any;
10
10
  }
11
+ export interface RunnerFlags {
12
+ validateActionInput: boolean;
13
+ validateActionOutput: boolean;
14
+ validateSyncRecords: boolean;
15
+ validateSyncMetadata: boolean;
16
+ }
@@ -0,0 +1,14 @@
1
+ import type { DBOnEventScript } from './db.js';
2
+ export type OnEventType = 'post-connection-creation' | 'pre-connection-deletion';
3
+ export interface OnEventScript {
4
+ id: DBOnEventScript['id'];
5
+ configId: DBOnEventScript['config_id'];
6
+ providerConfigKey: string;
7
+ name: DBOnEventScript['name'];
8
+ fileLocation: DBOnEventScript['file_location'];
9
+ version: DBOnEventScript['version'];
10
+ active: DBOnEventScript['active'];
11
+ event: OnEventType;
12
+ createdAt: DBOnEventScript['created_at'];
13
+ updatedAt: DBOnEventScript['updated_at'];
14
+ }
@@ -1,5 +1,5 @@
1
1
  import type { Timestamps } from '../../db.js';
2
- export interface OnEventScript extends Timestamps {
2
+ export interface DBOnEventScript extends Timestamps {
3
3
  id: number;
4
4
  config_id: number;
5
5
  name: string;
@@ -21,4 +21,5 @@ export interface ApiUser {
21
21
  accountId: number;
22
22
  email: string;
23
23
  name: string;
24
+ uuid: string;
24
25
  }
package/dist/utils.d.ts CHANGED
@@ -10,4 +10,12 @@ export interface Logger {
10
10
  }
11
11
  type ValidateSelection<T, U> = U extends T ? U : never;
12
12
  export type PickFromUnion<T, U extends T> = ValidateSelection<T, U>;
13
+ export type NullablePartial<TBase, TNullableKey extends keyof TBase = {
14
+ [K in keyof TBase]: null extends TBase[K] ? K : never;
15
+ }[keyof TBase]> = Partial<Pick<TBase, TNullableKey>> & Pick<TBase, Exclude<keyof TBase, TNullableKey>>;
16
+ export type Jsonable = string | number | boolean | null | undefined | readonly Jsonable[] | {
17
+ readonly [key: string]: Jsonable;
18
+ } | {
19
+ toJSON(): Jsonable;
20
+ };
13
21
  export {};
package/dist/web/env.d.ts CHANGED
@@ -4,8 +4,9 @@ export interface WindowEnv {
4
4
  connectUrl: string;
5
5
  publicSentryKey: string;
6
6
  publicPosthogKey: string;
7
- publicPosthogPost: string;
7
+ publicPosthogHost: string;
8
8
  publicLogoDevKey: string;
9
+ publicKoalaKey: string;
9
10
  isCloud: boolean;
10
11
  features: {
11
12
  logs: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/types",
3
- "version": "0.45.1",
3
+ "version": "0.46.1",
4
4
  "description": "Types used in Nango applications",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",