@nangohq/types 0.69.45 → 0.69.47

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.
@@ -26,6 +26,7 @@ export type PostPublicTriggerAction = Endpoint<{
26
26
  };
27
27
  Success: any;
28
28
  }>;
29
+ /** @deprecated Use POST /action/trigger to trigger actions and GET /records to fetch sync records instead. */
29
30
  export type GetPublicV1 = Endpoint<{
30
31
  Method: 'GET';
31
32
  Path: `/v1/:path`;
@@ -24,11 +24,11 @@ import type { GetPublicRecords, PatchPublicPruneRecords } from './record/api.js'
24
24
  import type { GetPublicScriptsConfig } from './scripts/http.api.js';
25
25
  import type { GetSharedCredentialsProvider, GetSharedCredentialsProviders, PatchSharedCredentialsProvider, PostSharedCredentialsProvider } from './sharedCredentials/api.js';
26
26
  import type { GetPublicSyncStatus, PostPublicSyncPause, PostPublicSyncStart, PostPublicTrigger, PutPublicSyncConnectionFrequency } from './sync/api.js';
27
- import type { DeleteTeamUser, GetTeam, PutTeam } from './team/api.js';
27
+ import type { DeleteTeamUser, GetTeam, PatchTeamUser, PutTeam } from './team/api.js';
28
28
  import type { GetUser, PatchUser } from './user/api.js';
29
29
  import type { PostPublicWebhook } from './webhooks/http.api.js';
30
30
  export type PublicApiEndpoints = SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation | PostPublicTrigger | PostPublicTbaAuthorization | PostPublicJwtAuthorization | PostPublicUnauthenticatedAuthorization | PostPublicApiKeyAuthorization | PostPublicBasicAuthorization | PostPublicAppStoreAuthorization | GetPublicProviders | GetPublicProvider | GetPublicListIntegrations | GetPublicIntegration | DeletePublicIntegration | PostConnectSessions | PostPublicConnectSessionsReconnect | GetPublicConnections | GetPublicConnection | GetConnectSession | DeleteConnectSession | PostDeployInternal | PostPublicBillAuthorization | DeletePublicConnection | PostPublicSignatureAuthorization | PostPublicTwoStepAuthorization | PostPublicWebhook | GetPublicRecords | PatchPublicPruneRecords | GetPublicScriptsConfig | PostPublicConnectTelemetry | PutPublicSyncConnectionFrequency | PostPublicIntegration | PatchPublicIntegration | GetAsyncActionResult | PostPublicOauthOutboundAuthorization | PostPublicConnection | PatchPublicConnection | PostPublicSyncStart | PostPublicSyncPause | GetPublicSyncStatus | GetPublicV1 | PostPublicTriggerAction | AllPublicProxy;
31
- export type PrivateApiEndpoints = PostSignup | PostSignin | PostLogout | GetTeam | PutTeam | PostPlanExtendTrial | PostPlanChange | GetUser | PatchUser | PostInvite | DeleteInvite | DeleteTeamUser | PostInsights | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | PostInternalConnectSessions | GetIntegrationFlows | DeleteIntegration | PatchIntegration | GetIntegration | PostIntegration | GetConnections | GetConnectionsCount | GetConnection | GetInvite | GetMeta | GetEmailByExpiredToken | GetEmailByUuid | GetManagedCallback | PatchFlowDisable | PatchFlowEnable | PatchFlowFrequency | PutUpgradePreBuiltFlow | PostConnectionRefresh | PostManagedSignup | PostPreBuiltDeploy | PostEnvironment | PatchEnvironment | DeleteEnvironment | GetEnvironments | GetEnvironment | PatchWebhook | PostEnvironmentVariables | PostImpersonate | GetSharedCredentialsProviders | GetSharedCredentialsProvider | PostSharedCredentialsProvider | PatchSharedCredentialsProvider | GetGettingStarted | PatchGettingStarted | GetConnectUISettings | PutConnectUISettings | GetProviders | GetProvider;
31
+ export type PrivateApiEndpoints = PostSignup | PostSignin | PostLogout | GetTeam | PutTeam | PostPlanExtendTrial | PostPlanChange | GetUser | PatchUser | PostInvite | DeleteInvite | DeleteTeamUser | PatchTeamUser | PostInsights | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | PostInternalConnectSessions | GetIntegrationFlows | DeleteIntegration | PatchIntegration | GetIntegration | PostIntegration | GetConnections | GetConnectionsCount | GetConnection | GetInvite | GetMeta | GetEmailByExpiredToken | GetEmailByUuid | GetManagedCallback | PatchFlowDisable | PatchFlowEnable | PatchFlowFrequency | PutUpgradePreBuiltFlow | PostConnectionRefresh | PostManagedSignup | PostPreBuiltDeploy | PostEnvironment | PatchEnvironment | DeleteEnvironment | GetEnvironments | GetEnvironment | PatchWebhook | PostEnvironmentVariables | PostImpersonate | GetSharedCredentialsProviders | GetSharedCredentialsProvider | PostSharedCredentialsProvider | PatchSharedCredentialsProvider | GetGettingStarted | PatchGettingStarted | GetConnectUISettings | PutConnectUISettings | GetProviders | GetProvider;
32
32
  export type APIEndpoints = PrivateApiEndpoints | PublicApiEndpoints;
33
33
  /**
34
34
  * Automatically narrow endpoints type with Method + Path
@@ -0,0 +1,12 @@
1
+ import type { Role } from '../user/db.js';
2
+ export type Action = 'create' | 'read' | 'update' | 'delete' | '*';
3
+ export type Resource = 'team' | 'team_member' | 'invite' | 'connect_ui_settings' | 'billing' | 'plan' | 'environment' | 'environment_production_flag' | 'environment_key' | 'environment_variable' | 'webhook' | 'integration' | 'connection' | 'flow' | 'sync_command' | 'secret_key' | 'connection_credential' | 'log' | '*';
4
+ export type Scope = 'production' | 'non-production' | 'global';
5
+ export interface Permission {
6
+ action: Action;
7
+ resource: Resource;
8
+ scope: Scope;
9
+ }
10
+ export interface PermissionEvaluator {
11
+ evaluate(role: Role, permission: Permission): Promise<boolean>;
12
+ }
@@ -1,5 +1,6 @@
1
1
  import type { NangoSyncEndpointOld, NangoSyncEndpointV2, ScriptTypeLiteral, SyncTypeLiteral } from '../nangoYaml/index.js';
2
2
  import type { OnEventType } from '../scripts/on-events/api.js';
3
+ import type { Feature } from '../syncConfigs/db.js';
3
4
  import type { JSONSchema7 } from 'json-schema';
4
5
  import type { Merge } from 'type-fest';
5
6
  export interface IncomingScriptFiles {
@@ -82,6 +83,7 @@ export interface CLIDeployFlowConfig {
82
83
  sync_type?: SyncTypeLiteral | undefined;
83
84
  webhookSubscriptions?: string[] | undefined;
84
85
  models_json_schema?: JSONSchema7 | undefined;
86
+ features?: Feature[] | undefined;
85
87
  }
86
88
  /**
87
89
  * Flow shape after being sent by the CLI and cleaned in the backend
@@ -11,7 +11,7 @@ export type GetEnvironments = Endpoint<{
11
11
  Method: 'GET';
12
12
  Path: '/api/v1/environments';
13
13
  Success: {
14
- data: Pick<DBEnvironment, 'name'>[];
14
+ data: Pick<DBEnvironment, 'name' | 'is_production'>[];
15
15
  };
16
16
  }>;
17
17
  export type PostEnvironment = Endpoint<{
@@ -45,6 +45,7 @@ export type PatchEnvironment = Endpoint<{
45
45
  Path: '/api/v1/environments';
46
46
  Body: {
47
47
  name?: string | undefined;
48
+ is_production?: boolean | undefined;
48
49
  callback_url?: string | undefined;
49
50
  hmac_key?: string | undefined;
50
51
  hmac_enabled?: boolean | undefined;
@@ -58,7 +59,7 @@ export type PatchEnvironment = Endpoint<{
58
59
  Success: {
59
60
  data: ApiEnvironment;
60
61
  };
61
- Error: ApiError<'conflict'>;
62
+ Error: ApiError<'conflict' | 'cannot_toggle_prod_environment'>;
62
63
  }>;
63
64
  export type DeleteEnvironment = Endpoint<{
64
65
  Method: 'DELETE';
@@ -106,3 +106,15 @@ export type PatchFlowFrequency = Endpoint<{
106
106
  };
107
107
  };
108
108
  }>;
109
+ export type GetFlowDownload = Endpoint<{
110
+ Method: 'GET';
111
+ Path: '/api/v1/flows/:id/download';
112
+ Querystring: {
113
+ env: string;
114
+ };
115
+ Params: {
116
+ id: number;
117
+ };
118
+ Success: never;
119
+ Error: ApiError<'failed_to_download_flow'>;
120
+ }>;
@@ -1,5 +1,6 @@
1
1
  import type { LegacySyncModelSchema, NangoConfigMetadata } from '../deploy/incomingFlow.js';
2
2
  import type { NangoModel, NangoSyncEndpointV2, ScriptTypeLiteral, SyncTypeLiteral } from '../nangoYaml/index.js';
3
+ import type { Feature } from '../syncConfigs/db.js';
3
4
  import type { JSONSchema7 } from 'json-schema';
4
5
  export interface NangoSyncConfig {
5
6
  name: string;
@@ -27,6 +28,7 @@ export interface NangoSyncConfig {
27
28
  upgrade_version?: string;
28
29
  sdk_version: string | null;
29
30
  models?: NangoModel[] | LegacySyncModelSchema[] | undefined;
31
+ features: Feature[];
30
32
  }
31
33
  export interface StandardNangoConfig {
32
34
  providerConfigKey: string;
package/dist/index.d.ts CHANGED
@@ -85,3 +85,4 @@ export type * from './jobs/api.js';
85
85
  export type * from './checkpoint/types.js';
86
86
  export type * from './checkpoint/db.js';
87
87
  export type * from './mcp/api.js';
88
+ export type * from './authz/types.js';
@@ -1,6 +1,7 @@
1
1
  import type { ApiError, Endpoint } from '../api.js';
2
2
  import type { ApiInvitation, ApiTeam } from '../team/api.js';
3
3
  import type { ApiUser } from '../user/api.js';
4
+ import type { Role } from '../user/db.js';
4
5
  export type PostInvite = Endpoint<{
5
6
  Method: 'POST';
6
7
  Path: '/api/v1/invite';
@@ -9,6 +10,7 @@ export type PostInvite = Endpoint<{
9
10
  };
10
11
  Body: {
11
12
  emails: string[];
13
+ role?: Role;
12
14
  };
13
15
  Success: {
14
16
  data: {
@@ -1,4 +1,5 @@
1
1
  import type { Timestamps } from '../db.js';
2
+ import type { Role } from '../user/db.js';
2
3
  export interface DBInvitation extends Timestamps {
3
4
  id: number;
4
5
  name: string;
@@ -8,4 +9,5 @@ export interface DBInvitation extends Timestamps {
8
9
  token: string;
9
10
  expires_at: Date;
10
11
  accepted: boolean;
12
+ role: Role;
11
13
  }
@@ -9,7 +9,7 @@ export type GetMeta = Endpoint<{
9
9
  Error: ApiError<'user_not_found'>;
10
10
  Success: {
11
11
  data: {
12
- environments: Pick<DBEnvironment, 'name'>[];
12
+ environments: Pick<DBEnvironment, 'name' | 'is_production'>[];
13
13
  version: string;
14
14
  baseUrl: string;
15
15
  debugMode: boolean;
@@ -1,4 +1,5 @@
1
1
  import type { OnEventType } from '../scripts/on-events/api.js';
2
+ import type { Feature } from '../syncConfigs/db.js';
2
3
  import type { JSONSchema7 } from 'json-schema';
3
4
  export type HTTP_METHOD = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
4
5
  /** @deprecated **/
@@ -98,6 +99,7 @@ export interface ParsedNangoSync {
98
99
  webhookSubscriptions: string[];
99
100
  version: string;
100
101
  json_schema?: JSONSchema7 | undefined;
102
+ features?: Feature[] | undefined;
101
103
  }
102
104
  export interface ParsedNangoAction {
103
105
  name: string;
@@ -110,6 +112,7 @@ export interface ParsedNangoAction {
110
112
  usedModels: string[];
111
113
  version: string;
112
114
  json_schema?: JSONSchema7 | undefined;
115
+ features?: Feature[] | undefined;
113
116
  }
114
117
  export type LayoutMode = 'root' | 'nested';
115
118
  export interface NangoModel {
@@ -145,5 +145,10 @@ export interface DBPlan extends Timestamps {
145
145
  * @default 100
146
146
  */
147
147
  variants_per_sync_max: number;
148
+ /**
149
+ * Override the prefix for the function routing
150
+ * @default null
151
+ */
152
+ fleet_node_routing_override: string | null;
148
153
  }
149
154
  export {};
@@ -132,6 +132,7 @@ export interface ProviderJwt extends BaseProvider {
132
132
  auth_mode: 'JWT';
133
133
  signature: {
134
134
  protocol: 'RSA' | 'HMAC';
135
+ hmac_secret_encoding?: 'hex' | 'utf8';
135
136
  };
136
137
  token: {
137
138
  signing_key: string;
@@ -1,6 +1,7 @@
1
1
  import type { TelemetryBag } from './sdk.js';
2
2
  import type { CheckpointRange } from '../checkpoint/types.js';
3
3
  import type { DBPlan } from '../plans/db.js';
4
+ import type { Feature } from '../syncConfigs/db.js';
4
5
  export interface RunnerOutputError {
5
6
  type: string;
6
7
  payload: Record<string, unknown> | unknown[];
@@ -21,6 +22,7 @@ export interface RunnerFlags {
21
22
  validateSyncRecords: boolean;
22
23
  validateSyncMetadata: boolean;
23
24
  }
24
- export interface RuntimeContext {
25
+ export interface RoutingContext {
25
26
  plan: DBPlan | null;
27
+ features: Feature[];
26
28
  }
@@ -24,7 +24,7 @@ export type PostPublicTrigger = Endpoint<{
24
24
  Success: {
25
25
  success: boolean;
26
26
  };
27
- Error: ApiError<'missing_provider_config_key'>;
27
+ Error: ApiError<'missing_provider_config_key' | 'unknown_provider_config' | 'unknown_connection' | 'no_syncs_found'>;
28
28
  }>;
29
29
  export type PostSyncVariant = Endpoint<{
30
30
  Method: 'POST';
@@ -89,6 +89,7 @@ export type PostPublicSyncPause = Endpoint<{
89
89
  Success: {
90
90
  success: boolean;
91
91
  };
92
+ Error: ApiError<'no_syncs_found' | 'unknown_connection' | 'unknown_provider_config'>;
92
93
  }>;
93
94
  export type PostPublicSyncStart = Endpoint<{
94
95
  Method: 'POST';
@@ -104,6 +105,7 @@ export type PostPublicSyncStart = Endpoint<{
104
105
  Success: {
105
106
  success: boolean;
106
107
  };
108
+ Error: ApiError<'no_syncs_found' | 'unknown_connection' | 'unknown_provider_config'>;
107
109
  }>;
108
110
  export type GetPublicSyncStatus = Endpoint<{
109
111
  Method: 'GET';
@@ -2,6 +2,7 @@ import type { TimestampsAndDeleted } from '../db.js';
2
2
  import type { LegacySyncModelSchema, NangoConfigMetadata } from '../deploy/incomingFlow.js';
3
3
  import type { NangoModel, ScriptTypeLiteral, SyncTypeLiteral } from '../nangoYaml/index.js';
4
4
  import type { JSONSchema7 } from 'json-schema';
5
+ export type Feature = 'checkpoints';
5
6
  export interface DBSyncConfig extends TimestampsAndDeleted {
6
7
  id: number;
7
8
  sync_name: string;
@@ -27,5 +28,6 @@ export interface DBSyncConfig extends TimestampsAndDeleted {
27
28
  enabled: boolean;
28
29
  models_json_schema: JSONSchema7 | null;
29
30
  sdk_version: string | null;
31
+ features: Feature[];
30
32
  }
31
33
  export type DBSyncConfigInsert = Omit<DBSyncConfig, 'id'>;
@@ -2,6 +2,7 @@ import type { ApiError, ApiTimestamps, Endpoint } from '../api.js';
2
2
  import type { DBTeam } from './db.js';
3
3
  import type { DBInvitation } from '../invitations/db.js';
4
4
  import type { ApiUser } from '../user/api.js';
5
+ import type { Role } from '../user/db.js';
5
6
  import type { Merge } from 'type-fest';
6
7
  export type GetTeam = Endpoint<{
7
8
  Method: 'GET';
@@ -49,3 +50,22 @@ export type DeleteTeamUser = Endpoint<{
49
50
  };
50
51
  };
51
52
  }>;
53
+ export type PatchTeamUser = Endpoint<{
54
+ Method: 'PATCH';
55
+ Path: '/api/v1/team/users/:id';
56
+ Querystring: {
57
+ env: string;
58
+ };
59
+ Params: {
60
+ id: number;
61
+ };
62
+ Body: {
63
+ role: Role;
64
+ };
65
+ Error: ApiError<'user_not_found'> | ApiError<'forbidden_self_demotion'>;
66
+ Success: {
67
+ data: {
68
+ success: true;
69
+ };
70
+ };
71
+ }>;
@@ -1,9 +1,10 @@
1
1
  import type { Endpoint } from '../api.js';
2
+ import type { Role } from './db.js';
2
3
  export type GetUser = Endpoint<{
3
4
  Method: 'GET';
4
5
  Path: `/api/v1/user`;
5
6
  Success: {
6
- data: ApiUser;
7
+ data: ApiUserWithPermissions;
7
8
  };
8
9
  }>;
9
10
  export type InternalGetUsers = Endpoint<{
@@ -33,8 +34,14 @@ export interface ApiUser {
33
34
  email: string;
34
35
  name: string;
35
36
  uuid: string;
37
+ role: Role;
36
38
  gettingStartedClosed: boolean;
37
39
  }
40
+ export type AllowedPermissions = Partial<Record<string, Partial<Record<'production' | 'non-production' | 'global', ('create' | 'read' | 'update' | 'delete' | '*')[]>>>>;
41
+ export type ApiUserWithPermissions = ApiUser & {
42
+ role: Role;
43
+ permissions: AllowedPermissions;
44
+ };
38
45
  export type PutUserPassword = Endpoint<{
39
46
  Method: 'PUT';
40
47
  Path: `/api/v1/user/password`;
package/dist/user/db.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { Timestamps } from '../db.js';
2
+ export type Role = 'administrator' | 'production_support' | 'development_full_access';
2
3
  export interface DBUser extends Timestamps {
3
4
  id: number;
4
5
  email: string;
@@ -14,4 +15,5 @@ export interface DBUser extends Timestamps {
14
15
  email_verification_token_expires_at: Date | null;
15
16
  uuid: string;
16
17
  getting_started_closed: boolean;
18
+ role: Role;
17
19
  }
package/dist/web/env.d.ts CHANGED
@@ -21,5 +21,6 @@ export interface WindowEnv {
21
21
  gettingStarted: boolean;
22
22
  slack: boolean;
23
23
  plan: boolean;
24
+ authRoles: boolean;
24
25
  };
25
26
  }
@@ -1,6 +1,7 @@
1
1
  import type { AsyncActionResponse } from '../action/api.js';
2
2
  import type { ErrorPayload, SyncErrorPayload } from '../api.js';
3
3
  import type { AuthModeType, AuthOperationType } from '../auth/api.js';
4
+ import type { CheckpointRange } from '../checkpoint/types.js';
4
5
  import type { SyncResult } from '../sync/index.js';
5
6
  export type WebhookTypes = 'sync' | 'auth' | 'forward' | 'async_action';
6
7
  export interface NangoWebhookBase {
@@ -15,6 +16,7 @@ export interface NangoSyncWebhookBodyBase extends NangoWebhookBase {
15
16
  syncName: string;
16
17
  syncVariant: string;
17
18
  model: string;
19
+ checkpoints?: CheckpointRange | undefined;
18
20
  /** @deprecated **/
19
21
  syncType: 'INCREMENTAL' | 'INITIAL' | 'WEBHOOK';
20
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/types",
3
- "version": "0.69.45",
3
+ "version": "0.69.47",
4
4
  "description": "Types used in Nango applications",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",