@nangohq/types 0.70.5 → 0.70.6

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.
@@ -1,3 +1,3 @@
1
- export declare const API_KEY_SCOPES: readonly ["environment:*", "environment:integrations:list", "environment:integrations:list_credentials", "environment:integrations:list_functions", "environment:integrations:read", "environment:integrations:read_credentials", "environment:integrations:create", "environment:integrations:update", "environment:integrations:delete", "environment:integrations:*", "environment:connections:list", "environment:connections:list_credentials", "environment:connections:read", "environment:connections:read_credentials", "environment:connections:create", "environment:connections:update", "environment:connections:delete", "environment:connections:*", "environment:connect_sessions:write", "environment:syncs:read", "environment:syncs:execute", "environment:syncs:update", "environment:syncs:variant:create", "environment:syncs:variant:delete", "environment:syncs:*", "environment:deploy", "environment:dryrun", "environment:records:read", "environment:records:write", "environment:records:*", "environment:actions:execute", "environment:actions:*", "environment:proxy", "environment:variables:read", "environment:mcp"];
1
+ export declare const API_KEY_SCOPES: readonly ["environment:*", "environment:integrations:list", "environment:integrations:list_credentials", "environment:integrations:list_functions", "environment:integrations:read", "environment:integrations:read_credentials", "environment:integrations:create", "environment:integrations:update", "environment:integrations:delete", "environment:integrations:*", "environment:connections:list", "environment:connections:list_credentials", "environment:connections:read", "environment:connections:read_credentials", "environment:connections:create", "environment:connections:update", "environment:connections:delete", "environment:connections:*", "environment:connect_sessions:write", "environment:syncs:read", "environment:syncs:execute", "environment:syncs:update", "environment:syncs:variant:create", "environment:syncs:variant:delete", "environment:syncs:*", "environment:functions:compile", "environment:functions:dryrun", "environment:functions:*", "environment:deploy", "environment:records:read", "environment:records:write", "environment:records:*", "environment:actions:execute", "environment:actions:*", "environment:proxy", "environment:variables:read", "environment:mcp"];
2
2
  export type ApiKeyScope = (typeof API_KEY_SCOPES)[number];
3
3
  export declare const ALL_SCOPES: string[];
@@ -12,7 +12,7 @@ import type { CreateApiKey, DeleteApiKey, DeleteEnvironment, GetEnvironment, Get
12
12
  import type { PatchWebhook } from './environment/api/webhook.js';
13
13
  import type { PostEnvironmentVariables } from './environment/variable/api.js';
14
14
  import type { PatchFlowDisable, PatchFlowEnable, PatchFlowFrequency, PostPreBuiltDeploy, PutUpgradePreBuiltFlow } from './flow/http.api.js';
15
- import type { GetIntegrationFunction, GetIntegrationFunctions, GetIntegrationTemplates, GetProviderTemplates, PostRemoteFunctionCompile, PostRemoteFunctionDeploy, PostRemoteFunctionDryrun } from './functions/api.js';
15
+ import type { GetFunctionDryrun, GetIntegrationFunction, GetIntegrationFunctions, GetIntegrationTemplates, GetProviderTemplates, PostFunctionCompile, PostFunctionDeployment, PostFunctionDryrun, PostFunctionDryrunResult, PostRemoteFunctionCompile, PostRemoteFunctionDeploy, PostRemoteFunctionDryrun } from './functions/api.js';
16
16
  import type { GetGettingStarted, PatchGettingStarted } from './gettingStarted/api.js';
17
17
  import type { DeleteIntegration, DeletePublicIntegration, GetIntegration, GetIntegrationFlows, GetPublicFunctionCode, GetPublicIntegration, GetPublicListIntegrations, PatchIntegration, PatchPublicIntegration, PostIntegration, PostPublicIntegration, PostPublicQuickstartIntegration } from './integration/api.js';
18
18
  import type { DeleteInvite, GetInvite, PostInvite } from './invitations/api.js';
@@ -28,7 +28,7 @@ import type { GetPublicSyncStatus, PostPublicSyncPause, PostPublicSyncStart, Pos
28
28
  import type { DeleteTeamUser, GetTeam, PatchTeamUser, PutTeam } from './team/api.js';
29
29
  import type { GetUser, PatchUser } from './user/api.js';
30
30
  import type { PostPublicWebhook } from './webhooks/http.api.js';
31
- 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 | PostPublicQuickstartIntegration | PatchPublicIntegration | GetAsyncActionResult | PostPublicOauthOutboundAuthorization | PostPublicConnection | PatchPublicConnection | PostPublicSyncStart | PostPublicSyncPause | GetPublicSyncStatus | GetPublicV1 | PostPublicTriggerAction | PostRemoteFunctionCompile | PostRemoteFunctionDryrun | PostRemoteFunctionDeploy | GetPublicFunctionCode | AllPublicProxy;
31
+ 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 | PostPublicQuickstartIntegration | PatchPublicIntegration | GetAsyncActionResult | PostPublicOauthOutboundAuthorization | PostPublicConnection | PatchPublicConnection | PostPublicSyncStart | PostPublicSyncPause | GetPublicSyncStatus | GetPublicV1 | PostPublicTriggerAction | PostFunctionCompile | PostFunctionDryrun | GetFunctionDryrun | PostFunctionDryrunResult | PostFunctionDeployment | PostRemoteFunctionCompile | PostRemoteFunctionDryrun | PostRemoteFunctionDeploy | GetPublicFunctionCode | AllPublicProxy;
32
32
  export type PrivateApiEndpoints = PostSignup | PostSignin | PostLogout | GetTeam | PutTeam | PostPlanExtendTrial | PostPlanChange | PutBillingInvoicingDetails | GetUser | PatchUser | PostInvite | DeleteInvite | DeleteTeamUser | PatchTeamUser | PostInsights | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | PostInternalConnectSessions | GetIntegrationFlows | GetIntegrationFunction | GetIntegrationFunctions | GetIntegrationTemplates | GetProviderTemplates | DeleteIntegration | PatchIntegration | GetIntegration | PostIntegration | GetConnections | GetConnectionsCount | GetConnection | GetInvite | GetMeta | GetEmailByExpiredToken | GetEmailByUuid | GetManagedCallback | GetManagedEmailVerification | PatchFlowDisable | PatchFlowEnable | PatchFlowFrequency | PutUpgradePreBuiltFlow | PostConnectionRefresh | PostManagedEmailVerification | PostManagedSignup | PostPreBuiltDeploy | PostEnvironment | PatchEnvironment | DeleteEnvironment | GetEnvironments | GetEnvironment | ListApiKeys | CreateApiKey | DeleteApiKey | PatchApiKey | PatchWebhook | PostEnvironmentVariables | PostImpersonate | GetSharedCredentialsProviders | GetSharedCredentialsProvider | PostSharedCredentialsProvider | PatchSharedCredentialsProvider | GetGettingStarted | PatchGettingStarted | GetConnectUISettings | PutConnectUISettings | GetProviders | GetProvider | PostInternalTriggerFunction;
33
33
  export type APIEndpoints = PrivateApiEndpoints | PublicApiEndpoints;
34
34
  /**
@@ -1,6 +1,7 @@
1
1
  import type { ApiError, Endpoint } from '../api.js';
2
2
  import type { DeployedNangoFunction, FunctionType, NangoActionFunction, NangoFunctionTemplate, NangoSyncFunction } from './domain.js';
3
- export type FunctionErrorCode = 'invalid_request' | 'integration_not_found' | 'compilation_error' | 'dryrun_error' | 'deployment_error' | 'connection_not_found' | 'function_disabled' | 'timeout' | 'validation_error';
3
+ export type RunnableFunctionType = Extract<FunctionType, 'action' | 'sync'>;
4
+ export type FunctionErrorCode = 'invalid_request' | 'integration_not_found' | 'compilation_error' | 'dryrun_error' | 'deployment_error' | 'connection_not_found' | 'dryrun_not_found' | 'function_disabled' | 'execution_environment_unavailable' | 'timeout' | 'validation_error';
4
5
  export interface ProxyCall {
5
6
  method: string;
6
7
  endpoint: string;
@@ -13,70 +14,168 @@ export interface ProxyCall {
13
14
  response: unknown;
14
15
  headers: Record<string, unknown>;
15
16
  }
16
- export type PostRemoteFunctionCompile = Endpoint<{
17
+ export interface FunctionCompileBody {
18
+ code: string;
19
+ }
20
+ export interface FunctionCompileSuccess {
21
+ bundle_size_bytes: number;
22
+ bundled_js: string;
23
+ compiled_at: string;
24
+ }
25
+ export interface FunctionDryrunBody {
26
+ integration_id: string;
27
+ function_type: RunnableFunctionType;
28
+ code: string;
29
+ connection_id: string;
30
+ input?: unknown;
31
+ metadata?: Record<string, unknown> | undefined;
32
+ checkpoint?: Record<string, unknown> | undefined;
33
+ last_sync_date?: string | undefined;
34
+ }
35
+ export type FunctionDryrunStatus = 'waiting' | 'running' | 'success' | 'failed';
36
+ export interface FunctionDryrunCreateSuccess {
37
+ id: string;
38
+ status: Extract<FunctionDryrunStatus, 'waiting' | 'running'>;
39
+ created_at: string;
40
+ }
41
+ export interface FunctionDryrunResultSuccess {
42
+ id: string;
43
+ status: FunctionDryrunStatus;
44
+ integration_id: string;
45
+ function_type: RunnableFunctionType;
46
+ created_at: string;
47
+ updated_at: string;
48
+ started_at?: string | undefined;
49
+ completed_at?: string | undefined;
50
+ duration_ms?: number | undefined;
51
+ output?: string | undefined;
52
+ result?: unknown;
53
+ error?: ApiError<FunctionErrorCode>['error'] | undefined;
54
+ }
55
+ export type FunctionDryrunResultBody = {
56
+ status: 'success';
57
+ output: string;
58
+ duration_ms?: number | undefined;
59
+ } | {
60
+ status: 'failed';
61
+ output?: string | undefined;
62
+ duration_ms?: number | undefined;
63
+ error: {
64
+ code?: string | undefined;
65
+ message: string;
66
+ payload?: unknown;
67
+ };
68
+ };
69
+ export interface FunctionDeploymentBody {
70
+ type: 'function';
71
+ integration_id: string;
72
+ function_name: string;
73
+ function_type: RunnableFunctionType;
74
+ code: string;
75
+ version?: string | undefined;
76
+ allow_destructive?: boolean | undefined;
77
+ }
78
+ export interface FunctionDeploySuccess {
79
+ integration_id: string;
80
+ function_name: string;
81
+ function_type: RunnableFunctionType;
82
+ deployed: boolean;
83
+ deployed_functions: {
84
+ name: string;
85
+ version: string;
86
+ }[];
87
+ output: string;
88
+ }
89
+ export type PostFunctionCompile = Endpoint<{
17
90
  Method: 'POST';
18
- Path: '/remote-function/compile';
19
- Body: {
20
- integration_id: string;
21
- function_name: string;
22
- function_type: FunctionType;
23
- code: string;
91
+ Path: '/functions/compile';
92
+ Body: FunctionCompileBody;
93
+ Error: ApiError<FunctionErrorCode>;
94
+ Success: FunctionCompileSuccess;
95
+ }>;
96
+ export type PostFunctionDryrun = Endpoint<{
97
+ Method: 'POST';
98
+ Path: '/functions/dryruns';
99
+ Body: FunctionDryrunBody;
100
+ Error: ApiError<FunctionErrorCode>;
101
+ Success: FunctionDryrunCreateSuccess;
102
+ }>;
103
+ export type GetFunctionDryrun = Endpoint<{
104
+ Method: 'GET';
105
+ Path: '/functions/dryruns/:id';
106
+ Params: {
107
+ id: string;
108
+ };
109
+ Error: ApiError<FunctionErrorCode>;
110
+ Success: FunctionDryrunResultSuccess;
111
+ }>;
112
+ export type PostFunctionDryrunResult = Endpoint<{
113
+ Method: 'POST';
114
+ Path: '/functions/dryruns/:id/result';
115
+ Params: {
116
+ id: string;
24
117
  };
118
+ Body: FunctionDryrunResultBody;
25
119
  Error: ApiError<FunctionErrorCode>;
26
120
  Success: {
27
- integration_id: string;
28
- function_name: string;
29
- function_type: FunctionType;
30
- bundle_size_bytes: number;
31
- bundled_js: string;
32
- compiled_at: string;
121
+ ok: true;
33
122
  };
34
123
  }>;
124
+ export type PostFunctionDeployment = Endpoint<{
125
+ Method: 'POST';
126
+ Path: '/functions/deployments';
127
+ Body: FunctionDeploymentBody;
128
+ Error: ApiError<FunctionErrorCode>;
129
+ Success: FunctionDeploySuccess;
130
+ }>;
131
+ export interface RemoteFunctionCompileBody {
132
+ integration_id: string;
133
+ function_name: string;
134
+ function_type: RunnableFunctionType;
135
+ code: string;
136
+ }
137
+ export interface RemoteFunctionCompileSuccess extends FunctionCompileSuccess {
138
+ integration_id: string;
139
+ function_name: string;
140
+ function_type: RunnableFunctionType;
141
+ }
142
+ export interface RemoteFunctionDryrunBody extends RemoteFunctionCompileBody {
143
+ connection_id: string;
144
+ input?: unknown;
145
+ metadata?: Record<string, unknown> | undefined;
146
+ checkpoint?: Record<string, unknown> | undefined;
147
+ last_sync_date?: string | undefined;
148
+ }
149
+ export interface RemoteFunctionDryrunSuccess {
150
+ integration_id: string;
151
+ function_name: string;
152
+ function_type: RunnableFunctionType;
153
+ duration_ms: number;
154
+ result?: unknown;
155
+ }
156
+ export interface RemoteFunctionDeployBody extends RemoteFunctionCompileBody {
157
+ allow_destructive?: boolean | undefined;
158
+ }
159
+ export type PostRemoteFunctionCompile = Endpoint<{
160
+ Method: 'POST';
161
+ Path: '/remote-function/compile';
162
+ Body: RemoteFunctionCompileBody;
163
+ Error: ApiError<FunctionErrorCode>;
164
+ Success: RemoteFunctionCompileSuccess;
165
+ }>;
35
166
  export type PostRemoteFunctionDryrun = Endpoint<{
36
167
  Method: 'POST';
37
168
  Path: '/remote-function/dryrun';
38
- Body: {
39
- integration_id: string;
40
- function_name: string;
41
- function_type: FunctionType;
42
- code: string;
43
- connection_id: string;
44
- input?: unknown;
45
- metadata?: Record<string, unknown> | undefined;
46
- checkpoint?: Record<string, unknown> | undefined;
47
- last_sync_date?: string | undefined;
48
- };
169
+ Body: RemoteFunctionDryrunBody;
49
170
  Error: ApiError<FunctionErrorCode>;
50
- Success: {
51
- integration_id: string;
52
- function_name: string;
53
- function_type: FunctionType;
54
- execution_timeout_at: string;
55
- duration_ms: number;
56
- result?: unknown;
57
- };
171
+ Success: RemoteFunctionDryrunSuccess;
58
172
  }>;
59
173
  export type PostRemoteFunctionDeploy = Endpoint<{
60
174
  Method: 'POST';
61
175
  Path: '/remote-function/deploy';
62
- Body: {
63
- integration_id: string;
64
- function_name: string;
65
- function_type: FunctionType;
66
- code: string;
67
- };
176
+ Body: RemoteFunctionDeployBody;
68
177
  Error: ApiError<FunctionErrorCode>;
69
- Success: {
70
- integration_id: string;
71
- function_name: string;
72
- function_type: FunctionType;
73
- deployed: boolean;
74
- deployed_functions: {
75
- name: string;
76
- version: string;
77
- }[];
78
- output: string;
79
- };
178
+ Success: FunctionDeploySuccess;
80
179
  }>;
81
180
  export type GetIntegrationFunctions = Endpoint<{
82
181
  Method: 'GET';
@@ -16,6 +16,29 @@ export type PostLog = Endpoint<{
16
16
  Error: ApiError<'post_log_failed'>;
17
17
  Success: never;
18
18
  }>;
19
+ type WithTags<T> = T & {
20
+ integrationId: string;
21
+ connectionId: string;
22
+ syncId?: string | undefined;
23
+ };
24
+ export type RunnerDataTransferTelemetry = WithTags<{
25
+ type: 'data_transfer';
26
+ bytesSent: number;
27
+ bytesReceived: number;
28
+ }>;
29
+ export type RunnerTelemetry = RunnerDataTransferTelemetry;
30
+ export type PostRunnerTelemetry = Endpoint<{
31
+ Method: 'POST';
32
+ Path: '/environment/:environmentId/runner/telemetry';
33
+ Params: {
34
+ environmentId: number;
35
+ };
36
+ Body: {
37
+ events: RunnerTelemetry[];
38
+ };
39
+ Error: ApiError<'post_runner_telemetry_failed'>;
40
+ Success: never;
41
+ }>;
19
42
  export interface PostRecordsSuccess {
20
43
  nextMerging: MergingStrategy;
21
44
  }
@@ -80,6 +80,11 @@ export interface DBPlan extends Timestamps {
80
80
  * @default false
81
81
  */
82
82
  has_otel: boolean;
83
+ /**
84
+ * Enable runner telemetry export to persist
85
+ * @default false
86
+ */
87
+ export_runner_telemetry: boolean;
83
88
  /**
84
89
  * Change the applied rate limit for the public API
85
90
  * @default "m"
@@ -21,6 +21,7 @@ export interface RunnerFlags {
21
21
  validateActionOutput: boolean;
22
22
  validateSyncRecords: boolean;
23
23
  validateSyncMetadata: boolean;
24
+ exportRunnerTelemetry: boolean;
24
25
  }
25
26
  export interface RoutingContext {
26
27
  plan: DBPlan | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/types",
3
- "version": "0.70.5",
3
+ "version": "0.70.6",
4
4
  "description": "Types used in Nango applications",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",
@@ -12,7 +12,7 @@
12
12
  "directory": "packages/utils"
13
13
  },
14
14
  "dependencies": {
15
- "axios": "1.15.2",
15
+ "axios": "1.16.1",
16
16
  "json-schema": "0.4.0",
17
17
  "type-fest": "4.41.0"
18
18
  },