@nangohq/types 0.70.6 → 0.70.8

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.
@@ -95,12 +95,11 @@ export type PostLogout = Endpoint<{
95
95
  Success: never;
96
96
  }>;
97
97
  export type PostForgotPassword = Endpoint<{
98
- Method: 'PUT';
98
+ Method: 'POST';
99
99
  Path: '/api/v1/account/forgot-password';
100
100
  Body: {
101
101
  email: string;
102
102
  };
103
- Error: ApiError<'user_not_found'>;
104
103
  Success: {
105
104
  success: true;
106
105
  };
@@ -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: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"];
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:list", "environment:functions:read", "environment:functions:delete", "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[];
@@ -2,7 +2,7 @@ import type { GetEmailByExpiredToken, GetEmailByUuid, GetManagedCallback, GetMan
2
2
  import type { GetAsyncActionResult, GetPublicV1, PostInternalTriggerFunction, PostPublicTriggerAction } from './action/api.js';
3
3
  import type { PostImpersonate } from './admin/http.api.js';
4
4
  import type { EndpointMethod } from './api.js';
5
- import type { PostPublicApiKeyAuthorization, PostPublicAppStoreAuthorization, PostPublicBasicAuthorization, PostPublicBillAuthorization, PostPublicJwtAuthorization, PostPublicOauthOutboundAuthorization, PostPublicSignatureAuthorization, PostPublicTbaAuthorization, PostPublicTwoStepAuthorization, PostPublicUnauthenticatedAuthorization } from './auth/http.api.js';
5
+ import type { PostPublicApiKeyAuthorization, PostPublicAppStoreAuthorization, PostPublicAwsSigV4Authorization, PostPublicBasicAuthorization, PostPublicBillAuthorization, PostPublicJwtAuthorization, PostPublicOauthOutboundAuthorization, PostPublicSignatureAuthorization, PostPublicTbaAuthorization, PostPublicTwoStepAuthorization, PostPublicUnauthenticatedAuthorization } from './auth/http.api.js';
6
6
  import type { DeleteConnectSession, GetConnectSession, PostConnectSessions, PostInternalConnectSessions, PostPublicConnectSessionsReconnect, PostPublicConnectTelemetry } from './connect/api.js';
7
7
  import type { GetConnectUISettings, PutConnectUISettings } from './connectUISettings/api.js';
8
8
  import type { DeletePublicConnection, GetConnection, GetConnections, GetConnectionsCount, GetPublicConnection, GetPublicConnections, PatchPublicConnection, PostConnectionRefresh, PostPublicConnection } from './connection/api/get.js';
@@ -12,24 +12,25 @@ 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 { GetFunctionDryrun, GetIntegrationFunction, GetIntegrationFunctions, GetIntegrationTemplates, GetProviderTemplates, PostFunctionCompile, PostFunctionDeployment, PostFunctionDryrun, PostFunctionDryrunResult, PostRemoteFunctionCompile, PostRemoteFunctionDeploy, PostRemoteFunctionDryrun } from './functions/api.js';
15
+ import type { DeleteIntegrationFunction, DeletePublicIntegrationFunction, GetFunctionDeployment, GetFunctionDryrun, GetIntegrationFunction, GetIntegrationFunctions, GetIntegrationTemplates, GetProviderTemplates, GetPublicIntegrationFunction, GetPublicIntegrationFunctions, GetPublicProviderTemplates, PostFunctionCompile, PostFunctionDeployment, PostFunctionDeploymentResult, PostFunctionDryrun, PostFunctionDryrunResult } 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';
19
19
  import type { GetOperation, PostInsights, SearchFilters, SearchMessages, SearchOperations } from './logs/api.js';
20
20
  import type { GetMeta } from './meta/api.js';
21
- import type { PostPlanChange, PostPlanExtendTrial, PutBillingInvoicingDetails } from './plans/http.api.js';
21
+ import type { GetPlainHmac } from './plain/api.js';
22
+ import type { GetBillingUsage, GetBillingUsageTopDimensionValues, PostPlanChange, PostPlanExtendTrial, PutBillingInvoicingDetails } from './plans/http.api.js';
22
23
  import type { GetProvider, GetProviders, GetPublicProvider, GetPublicProviders } from './providers/api.js';
23
24
  import type { AllPublicProxy } from './proxy/http.api.js';
24
- import type { GetPublicRecords, PatchPublicPruneRecords } from './record/api.js';
25
+ import type { GetConnectionRecordModels, GetConnectionRecords, GetPublicRecords, PatchPublicPruneRecords } from './record/api.js';
25
26
  import type { GetPublicScriptsConfig } from './scripts/http.api.js';
26
27
  import type { GetSharedCredentialsProvider, GetSharedCredentialsProviders, PatchSharedCredentialsProvider, PostSharedCredentialsProvider } from './sharedCredentials/api.js';
27
28
  import type { GetPublicSyncStatus, PostPublicSyncPause, PostPublicSyncStart, PostPublicTrigger, PutPublicSyncConnectionFrequency } from './sync/api.js';
28
29
  import type { DeleteTeamUser, GetTeam, PatchTeamUser, PutTeam } from './team/api.js';
29
- import type { GetUser, PatchUser } from './user/api.js';
30
+ import type { GetUser, PatchUser, PutUserPassword } from './user/api.js';
30
31
  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 | PostFunctionCompile | PostFunctionDryrun | GetFunctionDryrun | PostFunctionDryrunResult | PostFunctionDeployment | PostRemoteFunctionCompile | PostRemoteFunctionDryrun | PostRemoteFunctionDeploy | GetPublicFunctionCode | AllPublicProxy;
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;
32
+ 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 | PostPublicAwsSigV4Authorization | PostPublicConnection | PatchPublicConnection | PostPublicSyncStart | PostPublicSyncPause | GetPublicSyncStatus | GetPublicV1 | PostPublicTriggerAction | PostFunctionCompile | PostFunctionDryrun | GetFunctionDryrun | PostFunctionDryrunResult | PostFunctionDeployment | GetFunctionDeployment | PostFunctionDeploymentResult | GetPublicFunctionCode | GetPublicIntegrationFunctions | GetPublicIntegrationFunction | DeletePublicIntegrationFunction | GetPublicProviderTemplates | AllPublicProxy;
33
+ export type PrivateApiEndpoints = PostSignup | PostSignin | PostLogout | GetTeam | PutTeam | PostPlanExtendTrial | PostPlanChange | PutBillingInvoicingDetails | GetBillingUsage | GetBillingUsageTopDimensionValues | GetUser | PatchUser | PutUserPassword | PostInvite | DeleteInvite | DeleteTeamUser | PatchTeamUser | PostInsights | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | PostInternalConnectSessions | GetIntegrationFlows | GetIntegrationFunction | GetIntegrationFunctions | DeleteIntegrationFunction | GetIntegrationTemplates | GetProviderTemplates | DeleteIntegration | PatchIntegration | GetIntegration | PostIntegration | GetConnections | GetConnectionsCount | GetConnection | GetConnectionRecordModels | GetConnectionRecords | 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 | GetPlainHmac;
33
34
  export type APIEndpoints = PrivateApiEndpoints | PublicApiEndpoints;
34
35
  /**
35
36
  * Automatically narrow endpoints type with Method + Path
@@ -17,6 +17,7 @@ export interface AuthModes {
17
17
  MCP_OAUTH2: 'MCP_OAUTH2';
18
18
  MCP_OAUTH2_GENERIC: 'MCP_OAUTH2_GENERIC';
19
19
  InstallPlugin: 'INSTALL_PLUGIN';
20
+ AwsSigV4: 'AWS_SIGV4';
20
21
  }
21
22
  export type AuthModeType = AuthModes[keyof AuthModes];
22
23
  export type AuthOperationType = 'creation' | 'override' | 'refresh' | 'unknown';
@@ -146,6 +147,17 @@ export interface InstallPluginCredentials {
146
147
  type: AuthModes['Basic'];
147
148
  [key: string]: any;
148
149
  }
150
+ export interface AwsSigV4Credentials extends CredentialsCommon {
151
+ type: AuthModes['AwsSigV4'];
152
+ role_arn: string;
153
+ region: string;
154
+ service: string;
155
+ access_key_id: string;
156
+ secret_access_key: string;
157
+ session_token: string;
158
+ expires_at?: Date | undefined;
159
+ external_id?: string | undefined;
160
+ }
149
161
  export interface CombinedOauth2AppCredentials extends CredentialsCommon {
150
162
  type: AuthModes['Custom'];
151
163
  app: AppCredentials;
@@ -157,5 +169,5 @@ export interface AuthorizationTokenResponse extends Omit<OAuth2Credentials, 'typ
157
169
  expires_in?: number;
158
170
  }
159
171
  export type TestableCredentials = ApiKeyCredentials | BasicApiCredentials | TbaCredentials | JwtCredentials | SignatureCredentials;
160
- export type RefreshableCredentials = OAuth2Credentials | AppCredentials | AppStoreCredentials | OAuth2ClientCredentials | JwtCredentials | TwoStepCredentials | BillCredentials | SignatureCredentials;
161
- export type AllAuthCredentials = OAuth1Credentials | OAuth2Credentials | OAuth2ClientCredentials | BasicApiCredentials | ApiKeyCredentials | AppCredentials | AppStoreCredentials | UnauthCredentials | CustomCredentials | TbaCredentials | JwtCredentials | BillCredentials | TwoStepCredentials | CombinedOauth2AppCredentials | SignatureCredentials | InstallPluginCredentials;
172
+ export type RefreshableCredentials = OAuth2Credentials | AppCredentials | AppStoreCredentials | OAuth2ClientCredentials | JwtCredentials | TwoStepCredentials | BillCredentials | SignatureCredentials | AwsSigV4Credentials;
173
+ export type AllAuthCredentials = OAuth1Credentials | OAuth2Credentials | OAuth2ClientCredentials | BasicApiCredentials | ApiKeyCredentials | AppCredentials | AppStoreCredentials | UnauthCredentials | CustomCredentials | TbaCredentials | JwtCredentials | BillCredentials | TwoStepCredentials | CombinedOauth2AppCredentials | SignatureCredentials | InstallPluginCredentials | AwsSigV4Credentials;
@@ -156,6 +156,21 @@ export type PostPublicSignatureAuthorization = Endpoint<{
156
156
  Error: AuthErrors;
157
157
  Success: ConnectionResponseSuccess;
158
158
  }>;
159
+ type AwsSigV4AuthErrors = AuthErrors | ApiError<'invalid_aws_sigv4_config'> | ApiError<'missing_aws_sigv4_service'> | ApiError<'missing_aws_sigv4_sts_endpoint'> | ApiError<'missing_aws_sigv4_builtin_credentials'> | ApiError<'missing_aws_sigv4_region'> | ApiError<'aws_sigv4_sts_request_failed'>;
160
+ export type PostPublicAwsSigV4Authorization = Endpoint<{
161
+ Method: 'POST';
162
+ Body: {
163
+ role_arn: string;
164
+ region?: string | undefined;
165
+ };
166
+ Querystring: ConnectionQueryString;
167
+ Params: {
168
+ providerConfigKey: string;
169
+ };
170
+ Path: '/auth/aws-sigv4/:providerConfigKey';
171
+ Error: AwsSigV4AuthErrors;
172
+ Success: ConnectionResponseSuccess;
173
+ }>;
159
174
  export type PostPublicOauthOutboundAuthorization = Endpoint<{
160
175
  Method: 'POST';
161
176
  Body: {
@@ -70,6 +70,18 @@ export interface BillingSubscription {
70
70
  pendingChangeId?: string | undefined;
71
71
  planExternalId: string;
72
72
  }
73
+ export type CounterUsageMetric = Exclude<UsageMetric, 'records' | 'connections'>;
74
+ export type AvgUsageMetric = Extract<UsageMetric, 'records' | 'connections'>;
75
+ export interface BreakdownDimensions {
76
+ proxy: 'environment_id' | 'integration_id' | 'connection_id' | 'success';
77
+ function_executions: 'environment_id' | 'integration_id' | 'connection_id' | 'function_name' | 'function_type' | 'success';
78
+ function_logs: 'environment_id' | 'integration_id' | 'connection_id' | 'function_name' | 'function_type' | 'success';
79
+ function_compute_gbms: 'environment_id' | 'integration_id' | 'connection_id' | 'function_name' | 'function_type' | 'success';
80
+ webhook_forwards: 'environment_id' | 'integration_id' | 'connection_id' | 'success';
81
+ records: 'environment_id' | 'integration_id' | 'connection_id' | 'model';
82
+ connections: 'environment_id' | 'integration_id';
83
+ }
84
+ export type DimensionFor<M extends UsageMetric> = 'none' | BreakdownDimensions[M];
73
85
  export interface GetBillingUsageOpts {
74
86
  timeframe?: {
75
87
  start: Date;
@@ -80,6 +92,44 @@ export interface GetBillingUsageOpts {
80
92
  id: string;
81
93
  group_by?: 'environmentId' | 'environmentName' | 'integrationId' | 'type' | 'functionName' | 'model';
82
94
  };
95
+ /**
96
+ * Per-request override of the dashboard backend source. Honoured only
97
+ * when `FLAG_ALLOW_OVERRIDE_GETUSAGE_SERVICE` is enabled (dev gate); ignored
98
+ * everywhere else, so the default stays Orb. Only used by
99
+ * `UsageTracker.getBillingUsage`; the Orb client itself ignores it.
100
+ */
101
+ source?: 'clickhouse' | 'orb';
102
+ /**
103
+ * Per-metric dimension breakdown spec. Honoured only on the CH path
104
+ * (records / connections via `getDailySumAndBatches`, counters via
105
+ * `getDailyCounter`); the Orb client ignores it. Each metric's
106
+ * `BillingUsageMetric` gains a `breakdown` array of up to `top + 1`
107
+ * series (top-N dimension values + a single 'rest' aggregating the
108
+ * long tail). Top defaults to 10 and is clamped server-side to
109
+ * the CH cap.
110
+ */
111
+ breakdown?: {
112
+ [M in UsageMetric]?: BreakdownDimensions[M] | undefined;
113
+ };
114
+ top?: number;
115
+ /**
116
+ * Subset of metrics to populate in the response. When set, only those
117
+ * metrics are fanned out (CH path) and returned. Omitted → all 7.
118
+ * Ignored on the Orb path.
119
+ */
120
+ metrics?: UsageMetric[];
121
+ /**
122
+ * Per-metric row-level filter: scopes that metric's response to rows
123
+ * where the given dimension equals the given value. Mutually exclusive
124
+ * with `breakdown[<metric>]` on the same metric — controllers reject
125
+ * the combination. CH path only; the Orb client ignores it.
126
+ */
127
+ filter?: {
128
+ [M in UsageMetric]?: {
129
+ dimension: BreakdownDimensions[M];
130
+ value: string;
131
+ } | undefined;
132
+ };
83
133
  }
84
134
  export interface BillingUsageMetric {
85
135
  externalId: string;
@@ -87,6 +137,15 @@ export interface BillingUsageMetric {
87
137
  key: string;
88
138
  value: string;
89
139
  };
140
+ /**
141
+ * The top-N + 'rest' breakdown collapses every dim value outside the top
142
+ * into a single rollup bucket. Marked with `isRest: true` so the dashboard
143
+ * can distinguish it from a real dim value that happens to literally be
144
+ * the string 'rest' (e.g. a `connection_id` or `model` named 'rest').
145
+ * `group.value` is set to the display string 'rest' as a default; the
146
+ * flag is the authoritative signal.
147
+ */
148
+ isRest?: true;
90
149
  total: number;
91
150
  usage: {
92
151
  timeframeStart: Date;
@@ -94,6 +153,19 @@ export interface BillingUsageMetric {
94
153
  quantity: number;
95
154
  }[];
96
155
  view_mode: 'cumulative' | 'periodic';
156
+ /**
157
+ * Populated only when the request included a `breakdown` spec for this
158
+ * metric AND the CH path served the request. Each entry is a per-
159
+ * dimension-value series (carrying its own `group: {key, value}`), with
160
+ * one 'rest' entry aggregating the long tail.
161
+ *
162
+ * Mutually exclusive with the top-level `usage`/`total`: when breakdown
163
+ * is requested the top-level is empty (`usage: []`, `total: 0`) and only
164
+ * `breakdown` carries data — callers asking for a breakdown opt into the
165
+ * per-dim view. When breakdown is NOT requested, the top-level is the
166
+ * no-dim global and this field is absent.
167
+ */
168
+ breakdown?: BillingUsageMetric[];
97
169
  }
98
170
  export type BillingUsageMetrics = Partial<Record<UsageMetric, BillingUsageMetric | undefined>>;
99
171
  export interface ApiBillingUsageMetric extends BillingUsageMetric {
@@ -1,7 +1,7 @@
1
1
  import type { ApiError, Endpoint } from '../api.js';
2
2
  import type { DeployedNangoFunction, FunctionType, NangoActionFunction, NangoFunctionTemplate, NangoSyncFunction } from './domain.js';
3
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
+ export type FunctionErrorCode = 'invalid_request' | 'server_error' | 'integration_not_found' | 'compilation_error' | 'dryrun_error' | 'deployment_error' | 'connection_not_found' | 'dryrun_not_found' | 'deployment_not_found' | 'function_disabled' | 'execution_environment_unavailable' | 'timeout' | 'validation_error';
5
5
  export interface ProxyCall {
6
6
  method: string;
7
7
  endpoint: string;
@@ -32,7 +32,9 @@ export interface FunctionDryrunBody {
32
32
  checkpoint?: Record<string, unknown> | undefined;
33
33
  last_sync_date?: string | undefined;
34
34
  }
35
- export type FunctionDryrunStatus = 'waiting' | 'running' | 'success' | 'failed';
35
+ export type FunctionAsyncJobStatus = 'waiting' | 'running' | 'success' | 'failed';
36
+ export type FunctionDryrunStatus = FunctionAsyncJobStatus;
37
+ export type FunctionDeploymentStatus = FunctionAsyncJobStatus;
36
38
  export interface FunctionDryrunCreateSuccess {
37
39
  id: string;
38
40
  status: Extract<FunctionDryrunStatus, 'waiting' | 'running'>;
@@ -75,17 +77,44 @@ export interface FunctionDeploymentBody {
75
77
  version?: string | undefined;
76
78
  allow_destructive?: boolean | undefined;
77
79
  }
78
- export interface FunctionDeploySuccess {
80
+ export interface FunctionDeploymentCreateSuccess {
81
+ id: string;
82
+ status: Extract<FunctionDeploymentStatus, 'waiting' | 'running'>;
83
+ created_at: string;
84
+ }
85
+ export interface FunctionDeploymentResultSuccess {
86
+ id: string;
87
+ status: FunctionDeploymentStatus;
79
88
  integration_id: string;
80
89
  function_name: string;
81
90
  function_type: RunnableFunctionType;
82
- deployed: boolean;
83
- deployed_functions: {
91
+ created_at: string;
92
+ updated_at: string;
93
+ started_at?: string | undefined;
94
+ completed_at?: string | undefined;
95
+ duration_ms?: number | undefined;
96
+ deployed?: boolean | undefined;
97
+ deployed_functions?: {
84
98
  name: string;
85
99
  version: string;
86
- }[];
87
- output: string;
100
+ }[] | undefined;
101
+ output?: string | undefined;
102
+ error?: ApiError<FunctionErrorCode>['error'] | undefined;
88
103
  }
104
+ export type FunctionDeploymentResultBody = {
105
+ status: 'success';
106
+ output: string;
107
+ duration_ms?: number | undefined;
108
+ } | {
109
+ status: 'failed';
110
+ output?: string | undefined;
111
+ duration_ms?: number | undefined;
112
+ error: {
113
+ code?: string | undefined;
114
+ message: string;
115
+ payload?: unknown;
116
+ };
117
+ };
89
118
  export type PostFunctionCompile = Endpoint<{
90
119
  Method: 'POST';
91
120
  Path: '/functions/compile';
@@ -126,78 +155,64 @@ export type PostFunctionDeployment = Endpoint<{
126
155
  Path: '/functions/deployments';
127
156
  Body: FunctionDeploymentBody;
128
157
  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;
158
+ Success: FunctionDeploymentCreateSuccess;
165
159
  }>;
166
- export type PostRemoteFunctionDryrun = Endpoint<{
167
- Method: 'POST';
168
- Path: '/remote-function/dryrun';
169
- Body: RemoteFunctionDryrunBody;
160
+ export type GetFunctionDeployment = Endpoint<{
161
+ Method: 'GET';
162
+ Path: '/functions/deployments/:id';
163
+ Params: {
164
+ id: string;
165
+ };
170
166
  Error: ApiError<FunctionErrorCode>;
171
- Success: RemoteFunctionDryrunSuccess;
167
+ Success: FunctionDeploymentResultSuccess;
172
168
  }>;
173
- export type PostRemoteFunctionDeploy = Endpoint<{
169
+ export type PostFunctionDeploymentResult = Endpoint<{
174
170
  Method: 'POST';
175
- Path: '/remote-function/deploy';
176
- Body: RemoteFunctionDeployBody;
171
+ Path: '/functions/deployments/:id/result';
172
+ Params: {
173
+ id: string;
174
+ };
175
+ Body: FunctionDeploymentResultBody;
177
176
  Error: ApiError<FunctionErrorCode>;
178
- Success: FunctionDeploySuccess;
177
+ Success: {
178
+ ok: true;
179
+ };
179
180
  }>;
181
+ export interface FunctionListFilters {
182
+ type?: FunctionType;
183
+ search?: string;
184
+ page?: number;
185
+ limit?: number;
186
+ }
187
+ export interface FunctionListSuccess {
188
+ data: DeployedNangoFunction[];
189
+ pagination: {
190
+ total: number;
191
+ page: number;
192
+ limit: number;
193
+ };
194
+ }
195
+ export interface DeployedFunctionSuccess {
196
+ data: DeployedNangoFunction;
197
+ }
198
+ export interface FunctionDeletionSuccess {
199
+ data: {
200
+ success: boolean;
201
+ };
202
+ }
203
+ export interface ProviderTemplatesSuccess {
204
+ data: (NangoSyncFunction | NangoActionFunction)[];
205
+ }
180
206
  export type GetIntegrationFunctions = Endpoint<{
181
207
  Method: 'GET';
182
208
  Path: '/api/v1/integrations/:providerConfigKey/functions';
183
209
  Querystring: {
184
210
  env: string;
185
- type?: FunctionType;
186
- search?: string;
187
- page?: number;
188
- limit?: number;
189
- };
211
+ } & FunctionListFilters;
190
212
  Params: {
191
213
  providerConfigKey: string;
192
214
  };
193
- Success: {
194
- data: DeployedNangoFunction[];
195
- pagination: {
196
- total: number;
197
- page: number;
198
- limit: number;
199
- };
200
- };
215
+ Success: FunctionListSuccess;
201
216
  }>;
202
217
  export type GetIntegrationFunction = Endpoint<{
203
218
  Method: 'GET';
@@ -210,9 +225,22 @@ export type GetIntegrationFunction = Endpoint<{
210
225
  providerConfigKey: string;
211
226
  functionName: string;
212
227
  };
213
- Success: {
214
- data: DeployedNangoFunction;
228
+ Success: DeployedFunctionSuccess;
229
+ }>;
230
+ export type DeleteIntegrationFunction = Endpoint<{
231
+ Method: 'DELETE';
232
+ Path: '/api/v1/integrations/:providerConfigKey/functions/:functionName';
233
+ /** TODO: support deleting on-event functions */
234
+ Querystring: {
235
+ env: string;
236
+ type: RunnableFunctionType;
215
237
  };
238
+ Params: {
239
+ providerConfigKey: string;
240
+ functionName: string;
241
+ };
242
+ Error: ApiError<'function_managed_by_deploy'>;
243
+ Success: FunctionDeletionSuccess;
216
244
  }>;
217
245
  export type GetProviderTemplates = Endpoint<{
218
246
  Method: 'GET';
@@ -223,9 +251,50 @@ export type GetProviderTemplates = Endpoint<{
223
251
  Params: {
224
252
  providerConfigKey: string;
225
253
  };
226
- Success: {
227
- data: (NangoSyncFunction | NangoActionFunction)[];
254
+ Success: ProviderTemplatesSuccess;
255
+ }>;
256
+ export type GetPublicIntegrationFunctions = Endpoint<{
257
+ Method: 'GET';
258
+ Path: '/integrations/:uniqueKey/functions';
259
+ Querystring: FunctionListFilters;
260
+ Params: {
261
+ uniqueKey: string;
262
+ };
263
+ Success: FunctionListSuccess;
264
+ }>;
265
+ export type GetPublicIntegrationFunction = Endpoint<{
266
+ Method: 'GET';
267
+ Path: '/integrations/:uniqueKey/functions/:name';
268
+ Querystring: {
269
+ type?: FunctionType;
270
+ };
271
+ Params: {
272
+ uniqueKey: string;
273
+ name: string;
274
+ };
275
+ Success: DeployedFunctionSuccess;
276
+ }>;
277
+ export type DeletePublicIntegrationFunction = Endpoint<{
278
+ Method: 'DELETE';
279
+ Path: '/integrations/:uniqueKey/functions/:name';
280
+ /** TODO: support deleting on-event functions */
281
+ Querystring: {
282
+ type: RunnableFunctionType;
283
+ };
284
+ Params: {
285
+ uniqueKey: string;
286
+ name: string;
287
+ };
288
+ Error: ApiError<'function_managed_by_deploy'>;
289
+ Success: FunctionDeletionSuccess;
290
+ }>;
291
+ export type GetPublicProviderTemplates = Endpoint<{
292
+ Method: 'GET';
293
+ Path: '/providers/:provider/templates';
294
+ Params: {
295
+ provider: string;
228
296
  };
297
+ Success: ProviderTemplatesSuccess;
229
298
  }>;
230
299
  export type GetIntegrationTemplates = Endpoint<{
231
300
  Method: 'GET';
package/dist/index.d.ts CHANGED
@@ -13,6 +13,7 @@ export type * from './admin/http.api.js';
13
13
  export type * from './account/api.js';
14
14
  export type * from './user/api.js';
15
15
  export type * from './user/db.js';
16
+ export type * from './plain/api.js';
16
17
  export type * from './connection/api/metadata.js';
17
18
  export type * from './connection/db.js';
18
19
  export type * from './connectUISettings/dto.js';
@@ -10,6 +10,7 @@ export type ApiPublicIntegration = Merge<Pick<IntegrationConfig, 'created_at' |
10
10
  } & ApiPublicIntegrationInclude;
11
11
  export interface ApiPublicIntegrationInclude {
12
12
  webhook_url?: string | null;
13
+ credentials_label?: Record<string, string> | undefined;
13
14
  credentials?: {
14
15
  type: AuthModes['OAuth2'] | AuthModes['OAuth1'] | AuthModes['TBA'];
15
16
  client_id: string | null;
@@ -49,6 +50,7 @@ export type PostPublicIntegration = Endpoint<{
49
50
  display_name?: string | undefined;
50
51
  credentials?: ApiPublicIntegrationCredentials | undefined;
51
52
  forward_webhooks?: boolean | undefined;
53
+ integration_config?: Record<string, string> | undefined;
52
54
  };
53
55
  Success: {
54
56
  data: ApiPublicIntegration;
@@ -91,6 +93,8 @@ export type PatchPublicIntegration = Endpoint<{
91
93
  display_name?: string | undefined;
92
94
  credentials?: ApiPublicIntegrationCredentials | undefined;
93
95
  forward_webhooks?: boolean | undefined;
96
+ integration_config?: Record<string, string> | undefined;
97
+ custom?: Record<string, string> | undefined;
94
98
  };
95
99
  Success: {
96
100
  data: ApiPublicIntegration;
@@ -208,6 +212,7 @@ export type PostIntegration = Endpoint<{
208
212
  displayName?: string | undefined;
209
213
  forward_webhooks?: boolean | undefined;
210
214
  auth?: IntegrationAuthBody | undefined;
215
+ integrationConfig?: Record<string, string> | undefined;
211
216
  };
212
217
  Success: {
213
218
  data: ApiIntegration;
@@ -248,6 +253,7 @@ export type PatchIntegration = Endpoint<{
248
253
  webhookSecret?: string | undefined;
249
254
  displayName?: string | undefined;
250
255
  forward_webhooks?: boolean | undefined;
256
+ integrationConfig?: Record<string, string> | undefined;
251
257
  } | IntegrationAuthBody;
252
258
  Success: {
253
259
  data: {
@@ -14,6 +14,7 @@ export type GetMeta = Endpoint<{
14
14
  baseUrl: string;
15
15
  debugMode: boolean;
16
16
  gettingStartedClosed: boolean;
17
+ billingUsageSource: 'clickhouse' | 'orb';
17
18
  };
18
19
  };
19
20
  }>;
@@ -4,8 +4,13 @@ import type { JSONSchema7 } from 'json-schema';
4
4
  export type HTTP_METHOD = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
5
5
  /** @deprecated **/
6
6
  export type SyncTypeLiteral = 'incremental' | 'full';
7
- export type ScriptFileType = 'actions' | 'syncs' | 'on-events' | 'post-connection-scripts';
7
+ export type ScriptFileType = 'actions' | 'syncs' | 'on-events' | 'functions' | 'webhooks' | 'post-connection-scripts';
8
8
  export type ScriptTypeLiteral = 'action' | 'sync' | 'on-event';
9
+ /**
10
+ * The `function` primitive is authored via `createFunction()` / `createWebhook()`. It is tracked
11
+ * separately from {@link ScriptTypeLiteral} (sync/action/on-event) while it is introduced additively.
12
+ */
13
+ export type FunctionScriptTypeLiteral = 'function';
9
14
  export interface NangoYamlV1 {
10
15
  integrations: Record<string, Record<string, NangoYamlV1Integration>>;
11
16
  models: NangoYamlModel;
@@ -76,6 +81,7 @@ export interface NangoYamlParsedIntegration {
76
81
  providerConfigKey: string;
77
82
  syncs: ParsedNangoSync[];
78
83
  actions: ParsedNangoAction[];
84
+ functions: ParsedNangoFunction[];
79
85
  onEventScripts: Record<OnEventType, string[]>;
80
86
  /**
81
87
  * @deprecated
@@ -101,6 +107,47 @@ export interface ParsedNangoSync {
101
107
  json_schema?: JSONSchema7 | undefined;
102
108
  features?: Feature[] | undefined;
103
109
  }
110
+ /** Serializable view of a function trigger (the executable hooks live in the deployed file body). */
111
+ export interface ParsedFunctionTrigger {
112
+ type: 'http' | 'schedule' | 'event';
113
+ /** http trigger: maps to the URL path segment. */
114
+ name?: string;
115
+ /** http trigger: 'integration' (default) or 'connection' for tokenized per-connection URLs. */
116
+ scope?: 'integration' | 'connection';
117
+ /** schedule trigger. */
118
+ schedule?: string;
119
+ /** event trigger. */
120
+ event?: string;
121
+ /** Whether ingress coalescing is configured (the window/key config). */
122
+ debounce?: {
123
+ key?: {
124
+ body: string;
125
+ } | {
126
+ header: string;
127
+ };
128
+ windowMs: number;
129
+ maxWindowMs?: number;
130
+ maxEntities?: number;
131
+ payloadMode?: 'latest' | 'all';
132
+ };
133
+ /** Whether the trigger ships an `ingressChallenge` hook (executed at ingress). */
134
+ hasIngressChallenge?: boolean;
135
+ /** Whether the trigger ships an `ingressValidation` hook (executed at ingress). */
136
+ hasIngressValidation?: boolean;
137
+ }
138
+ export interface ParsedNangoFunction {
139
+ name: string;
140
+ type: 'function';
141
+ description: string;
142
+ triggers: ParsedFunctionTrigger[];
143
+ input: string | null;
144
+ output: string[] | null;
145
+ scopes: string[];
146
+ usedModels: string[];
147
+ version: string;
148
+ json_schema?: JSONSchema7 | undefined;
149
+ features?: Feature[] | undefined;
150
+ }
104
151
  export interface ParsedNangoAction {
105
152
  name: string;
106
153
  type: 'action';
@@ -143,7 +190,7 @@ export interface FlowsYaml {
143
190
  models: NangoYamlModel;
144
191
  }>;
145
192
  }
146
- export type FlowZeroJson = NangoYamlParsedIntegration & {
193
+ export type FlowZeroJson = Omit<NangoYamlParsedIntegration, 'functions'> & {
147
194
  jsonSchema?: JSONSchema7;
148
195
  sdkVersion: string;
149
196
  };
@@ -23,8 +23,10 @@ type WithTags<T> = T & {
23
23
  };
24
24
  export type RunnerDataTransferTelemetry = WithTags<{
25
25
  type: 'data_transfer';
26
+ callsite: 'proxy' | 'uncontrolled_fetch' | 'persist_records' | 'persist_logs';
26
27
  bytesSent: number;
27
28
  bytesReceived: number;
29
+ count: number;
28
30
  }>;
29
31
  export type RunnerTelemetry = RunnerDataTransferTelemetry;
30
32
  export type PostRunnerTelemetry = Endpoint<{
@@ -0,0 +1,11 @@
1
+ import type { ApiError, Endpoint } from '../api.js';
2
+ export type GetPlainHmac = Endpoint<{
3
+ Method: 'GET';
4
+ Path: `/api/v1/plain`;
5
+ Success: {
6
+ data: {
7
+ hash: string;
8
+ };
9
+ };
10
+ Error: ApiError<'unauthorized'>;
11
+ }>;
@@ -126,11 +126,6 @@ export interface DBPlan extends Timestamps {
126
126
  * @default false
127
127
  */
128
128
  can_disable_connect_ui_watermark: boolean;
129
- /**
130
- * Enable or disable remote function compile, dry-run, and deploy endpoints
131
- * @default false
132
- */
133
- remote_functions: boolean;
134
129
  /**
135
130
  * Sync Function Runtime
136
131
  * @default "runner"
@@ -161,6 +156,11 @@ export interface DBPlan extends Timestamps {
161
156
  * @default true
162
157
  */
163
158
  has_records_autopruning: boolean;
159
+ /**
160
+ * Records store key for this account
161
+ * @default 'default'
162
+ */
163
+ records_store: 'default' | 'records2';
164
164
  /**
165
165
  * Limit the number of variants per sync
166
166
  * @default 100
@@ -1,8 +1,8 @@
1
- import type { ApiBillingUsageMetrics, BillingCustomer, BillingInvoicingDetails } from '../billing/types.js';
2
- import type { MetricUsageSummary, UsageMetric } from '../usage/index.js';
3
- import type { ReplaceInObject } from '../utils.js';
4
1
  import type { DBPlan } from './db.js';
5
2
  import type { Endpoint } from '../api.js';
3
+ import type { ApiBillingUsageMetrics, BillingCustomer, BillingInvoicingDetails, BreakdownDimensions } from '../billing/types.js';
4
+ import type { MetricUsageSummary, UsageMetric } from '../usage/index.js';
5
+ import type { ReplaceInObject } from '../utils.js';
6
6
  export type ApiPlan = ReplaceInObject<DBPlan, Date, string>;
7
7
  export type PostPlanExtendTrial = Endpoint<{
8
8
  Method: 'POST';
@@ -61,6 +61,28 @@ export type GetUsage = Endpoint<{
61
61
  data: Record<UsageMetric, MetricUsageSummary>;
62
62
  };
63
63
  }>;
64
+ export type GetBillingUsageTopDimensionValues = Endpoint<{
65
+ Method: 'GET';
66
+ Path: '/api/v1/plans/billing-usage/top-dimension-values';
67
+ Querystring: {
68
+ [M in UsageMetric]: {
69
+ env: string;
70
+ metric: M;
71
+ dimension: BreakdownDimensions[M];
72
+ from: string;
73
+ to: string;
74
+ limit?: string | undefined;
75
+ };
76
+ }[UsageMetric];
77
+ Success: {
78
+ data: {
79
+ values: {
80
+ id: string;
81
+ label: string;
82
+ }[];
83
+ };
84
+ };
85
+ }>;
64
86
  export type GetBillingUsage = Endpoint<{
65
87
  Method: 'GET';
66
88
  Path: '/api/v1/plans/billing-usage';
@@ -68,6 +90,13 @@ export type GetBillingUsage = Endpoint<{
68
90
  env: string;
69
91
  from?: string | undefined;
70
92
  to?: string | undefined;
93
+ source?: 'clickhouse' | 'orb' | undefined;
94
+ metrics?: UsageMetric[] | undefined;
95
+ breakdown?: {
96
+ [M in UsageMetric]?: BreakdownDimensions[M] | undefined;
97
+ } | undefined;
98
+ top?: string | undefined;
99
+ filter?: Partial<Record<UsageMetric, string | undefined>> | undefined;
71
100
  };
72
101
  Success: {
73
102
  data: {
@@ -1,5 +1,5 @@
1
1
  import type { Endpoint } from '../api.js';
2
- import type { Provider } from './provider.js';
2
+ import type { Provider, SimplifiedJSONSchema } from './provider.js';
3
3
  import type { AuthModeType } from '../auth/api.js';
4
4
  export type GetPublicProviders = Endpoint<{
5
5
  Method: 'GET';
@@ -41,6 +41,7 @@ export interface ApiProviderListItem {
41
41
  preConfigured: boolean;
42
42
  preConfiguredScopes: string[];
43
43
  clientRegistration?: 'dynamic' | 'static' | 'metadata';
44
+ integration_config?: Record<string, SimplifiedJSONSchema> | undefined;
44
45
  }
45
46
  export type GetProviders = Endpoint<{
46
47
  Method: 'GET';
@@ -34,6 +34,12 @@ export interface SimplifiedJSONSchema {
34
34
  doc_section?: string;
35
35
  secret?: string;
36
36
  automated: boolean;
37
+ enum?: string[];
38
+ warnings?: Record<string, string>;
39
+ visible_when?: {
40
+ field: string;
41
+ equals: string;
42
+ };
37
43
  }
38
44
  export interface BaseProvider {
39
45
  display_name: string;
@@ -44,6 +50,7 @@ export interface BaseProvider {
44
50
  headers?: Record<string, string>;
45
51
  connection_config?: Record<string, string>;
46
52
  query?: Record<string, string>;
53
+ body?: Record<string, string>;
47
54
  retry?: RetryHeaderConfig;
48
55
  decompress?: boolean;
49
56
  forward_headers_on_redirect?: boolean;
@@ -85,6 +92,7 @@ export interface BaseProvider {
85
92
  connection_configuration?: string[];
86
93
  connection_config?: Record<string, SimplifiedJSONSchema>;
87
94
  credentials?: Record<string, SimplifiedJSONSchema>;
95
+ integration_config?: Record<string, SimplifiedJSONSchema>;
88
96
  assertion_option?: Record<string, SimplifiedJSONSchema>;
89
97
  authorization_url_fragment?: string;
90
98
  body_format?: OAuthBodyFormatType;
@@ -126,6 +134,7 @@ export interface ProviderMcpOAUTH2 extends Omit<BaseProvider, 'body_format'> {
126
134
  auth_mode: 'MCP_OAUTH2';
127
135
  registration_url?: string;
128
136
  client_registration: McpOAuth2ClientRegistration;
137
+ registration_params?: Record<string, string | string[]>;
129
138
  }
130
139
  export interface ProviderMcpOAuth2Generic extends Omit<BaseProvider, 'body_format'> {
131
140
  auth_mode: 'MCP_OAUTH2_GENERIC';
@@ -191,6 +200,7 @@ export interface ProviderTwoStep extends Omit<BaseProvider, 'body_format'> {
191
200
  token_expiration_strategy?: 'expireAt' | 'expireIn';
192
201
  refresh_token?: string;
193
202
  };
203
+ token_response_headers?: string[];
194
204
  additional_steps?: {
195
205
  body_format?: 'json' | 'form';
196
206
  token_params?: Record<string, string>;
@@ -224,6 +234,9 @@ export interface ProviderSignature extends BaseProvider {
224
234
  expires_in_ms: number;
225
235
  };
226
236
  }
237
+ export interface ProviderAwsSigV4 extends BaseProvider {
238
+ auth_mode: 'AWS_SIGV4';
239
+ }
227
240
  export interface ProviderApiKey extends BaseProvider {
228
241
  auth_mode: 'API_KEY';
229
242
  }
@@ -231,6 +244,6 @@ export interface ProviderInstallPlugin extends BaseProvider {
231
244
  auth_mode: 'INSTALL_PLUGIN';
232
245
  auth_type: 'BASIC';
233
246
  }
234
- export type Provider = BaseProvider | ProviderOAuth1 | ProviderOAuth2 | ProviderJwt | ProviderTwoStep | ProviderSignature | ProviderApiKey | ProviderBill | ProviderGithubApp | ProviderAppleAppStore | ProviderCustom | ProviderMcpOAUTH2 | ProviderMcpOAuth2Generic | ProviderInstallPlugin;
235
- export type RefreshableProvider = ProviderTwoStep | ProviderJwt | ProviderSignature | ProviderOAuth2 | ProviderMcpOAuth2Generic;
247
+ export type Provider = BaseProvider | ProviderOAuth1 | ProviderOAuth2 | ProviderJwt | ProviderTwoStep | ProviderSignature | ProviderAwsSigV4 | ProviderApiKey | ProviderBill | ProviderGithubApp | ProviderAppleAppStore | ProviderCustom | ProviderMcpOAUTH2 | ProviderMcpOAuth2Generic | ProviderInstallPlugin;
248
+ export type RefreshableProvider = ProviderTwoStep | ProviderJwt | ProviderSignature | ProviderOAuth2 | ProviderMcpOAuth2Generic | ProviderAwsSigV4;
236
249
  export type TestableProvider = ProviderApiKey;
@@ -27,6 +27,16 @@ export interface BaseProxyConfiguration {
27
27
  retryHeader?: RetryHeaderConfig;
28
28
  retryOn?: number[] | null;
29
29
  forwardHeadersOnRedirect?: boolean;
30
+ /**
31
+ * If set, called with the resolved outbound URL before the proxy request is sent.
32
+ * Implementations may throw (e.g. shared `ProxyError`) to abort the request.
33
+ */
34
+ validateProxyRequestUrl?: (args: {
35
+ absoluteUrl: string;
36
+ proxyConfig: ApplicationConstructedProxyConfiguration;
37
+ connection: ConnectionForProxy;
38
+ integrationConfig?: IntegrationConfigForProxy;
39
+ }) => void;
30
40
  /**
31
41
  * If set, called with the absolute URL of each HTTP redirect before Axios follows it.
32
42
  * Implementations may throw (e.g. shared `ProxyError`) to abort the redirect.
@@ -39,7 +49,7 @@ export interface UserProvidedProxyConfiguration extends BaseProxyConfiguration {
39
49
  paginate?: Partial<CursorPagination> | Partial<LinkPagination> | Partial<OffsetPagination>;
40
50
  }
41
51
  export type ConnectionForProxy = Pick<DBConnectionDecrypted, 'connection_id' | 'connection_config' | 'credentials' | 'metadata'>;
42
- export type IntegrationConfigForProxy = Pick<DBIntegrationDecrypted, 'oauth_client_id' | 'oauth_client_secret'>;
52
+ export type IntegrationConfigForProxy = Pick<DBIntegrationDecrypted, 'oauth_client_id' | 'oauth_client_secret' | 'custom'>;
43
53
  export interface ApplicationConstructedProxyConfiguration extends BaseProxyConfiguration {
44
54
  decompress: boolean;
45
55
  method: HTTP_METHOD;
@@ -95,6 +95,17 @@ export type UsageWebhookForwardEvent = UsageEventBase<'usage.webhook_forward', {
95
95
  success: boolean;
96
96
  };
97
97
  }>;
98
+ export type DataTransferCallsite = 'credential_test_hook' | 'credential_verification_hook' | 'connection_hook' | 'webhook_forward' | 'proxy' | 'uncontrolled_fetch' | 'persist_logs' | 'persist_records';
99
+ export type UsageDataTransferEvent = UsageEventBase<'usage.data_transfer', {
100
+ value: number;
101
+ properties: {
102
+ package: 'server' | 'runner' | 'shared';
103
+ callsite: DataTransferCallsite;
104
+ ingressedBytes: number;
105
+ egressedBytes: number;
106
+ syncId?: string;
107
+ };
108
+ }>;
98
109
  type EnforceUsageEventBase<T extends UsageEventBase<any, any>> = T;
99
- export type UsageEvent = EnforceUsageEventBase<UsageMarEvent | UsageRecordsEvent | UsageActionsEvent | UsageConnectionsEvent | UsageFunctionExecutionsEvent | UsageProxyEvent | UsageWebhookForwardEvent>;
110
+ export type UsageEvent = EnforceUsageEventBase<UsageMarEvent | UsageRecordsEvent | UsageActionsEvent | UsageConnectionsEvent | UsageFunctionExecutionsEvent | UsageProxyEvent | UsageWebhookForwardEvent | UsageDataTransferEvent>;
100
111
  export {};
@@ -63,3 +63,48 @@ export type PatchPublicPruneRecords = Endpoint<{
63
63
  has_more: boolean;
64
64
  };
65
65
  }>;
66
+ export interface ConnectionRecordModel {
67
+ model: string;
68
+ variant: string | null;
69
+ count: number;
70
+ size_bytes: number;
71
+ updated_at: string;
72
+ }
73
+ export type GetConnectionRecordModels = Endpoint<{
74
+ Method: 'GET';
75
+ Path: '/api/v1/connections/:connectionId/records/models';
76
+ Params: {
77
+ connectionId: string;
78
+ };
79
+ Querystring: {
80
+ env: string;
81
+ provider_config_key: string;
82
+ };
83
+ Success: {
84
+ data: ConnectionRecordModel[];
85
+ };
86
+ }>;
87
+ export type GetConnectionRecords = Endpoint<{
88
+ Method: 'GET';
89
+ Path: '/api/v1/connections/:connectionId/records';
90
+ Params: {
91
+ connectionId: string;
92
+ };
93
+ Querystring: {
94
+ env: string;
95
+ provider_config_key: string;
96
+ model: string;
97
+ variant?: string | undefined;
98
+ limit?: number | undefined;
99
+ cursor?: string | undefined;
100
+ metadata_only?: boolean | undefined;
101
+ /** When set, return at most one full record for this external id (for lazy payload fetch). metadata_only is ignored */
102
+ record_id?: string | undefined;
103
+ };
104
+ Success: {
105
+ data: {
106
+ next_cursor: string | null;
107
+ records: NangoRecord[];
108
+ };
109
+ };
110
+ }>;
package/dist/web/env.d.ts CHANGED
@@ -8,6 +8,7 @@ export interface WindowEnv {
8
8
  publicPosthogHost: string;
9
9
  publicLogoDevKey: string;
10
10
  publicStripeKey: string;
11
+ publicPlainAppId: string;
11
12
  isCloud: boolean;
12
13
  isHosted: boolean;
13
14
  isEnterprise: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/types",
3
- "version": "0.70.6",
3
+ "version": "0.70.8",
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.16.1",
15
+ "axios": "1.18.0",
16
16
  "json-schema": "0.4.0",
17
17
  "type-fest": "4.41.0"
18
18
  },