@nangohq/types 0.71.13 → 0.72.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,72 @@
1
+ export type AnalyticsSurface = 'web' | 'cli' | 'server';
2
+ export interface AnalyticsCategories {
3
+ auth: 'Signing up, logging in and account access';
4
+ audit: "The account's audit trail: who did what in the account. Not function logs";
5
+ onboarding: 'Getting Started';
6
+ connections: 'Creating and managing connections';
7
+ playground: 'The dashboard Playground';
8
+ functions: 'Writing, deploying and running syncs and actions, including from the CLI';
9
+ billing: 'Plans, usage and payment';
10
+ agents: 'Agent sessions and the tools agents call through them';
11
+ integrations: 'Creating and configuring integrations';
12
+ environments: 'Environments and their settings';
13
+ team: 'The people in an account and their roles';
14
+ logs: 'Searching and reading operation logs';
15
+ }
16
+ export interface AnalyticsObjects {
17
+ account: 'A Nango account';
18
+ user: 'A person in an account';
19
+ connection: "An end user's authorised link to an integration";
20
+ integration: 'A provider configured in an environment. Never `provider`';
21
+ deploy: 'Pushing functions to an environment';
22
+ command: 'A CLI command, such as `compile` or `deploy`';
23
+ function: 'A sync or an action';
24
+ run: 'One execution of a function';
25
+ api_key: 'An account or environment key';
26
+ environment: 'Dev, prod or a custom environment';
27
+ plan: "The account's pricing plan";
28
+ session: 'An agent session';
29
+ tool_call: 'One call an agent makes to a tool in its session';
30
+ proxy_request: "One request an agent sends to an integration's API through the proxy";
31
+ tool_search: 'One search an agent runs for tools in its session';
32
+ usage: "The Usage page's metrics and charts";
33
+ playground: 'The dashboard Playground panel';
34
+ agent_turn: 'One message and its reply in an Agent Playground chat';
35
+ approval: 'A tool call in an Agent Playground chat that waits for the user to approve or deny it';
36
+ two_factor: "A user's two-factor authentication";
37
+ recovery_codes: "A user's two-factor recovery codes";
38
+ password: "A user's password";
39
+ join_request: 'A request to join an existing account';
40
+ export: 'A file of records produced for download, such as the audit trail';
41
+ sync_command: "A run, full resync, pause, resume or cancel sent to a connection's sync";
42
+ operation: 'One entry in the logs, such as a sync run or an auth attempt';
43
+ filter: 'A search or filter on a dashboard list';
44
+ }
45
+ export interface AnalyticsUiElements {
46
+ button: 'A dashboard button, such as `create_button`';
47
+ link: 'A dashboard link, such as `invoice_link`';
48
+ tab: 'A dashboard tab';
49
+ modal: 'A dashboard modal';
50
+ page: 'A dashboard page, such as `create_page`';
51
+ }
52
+ export interface AnalyticsActions {
53
+ click: 'A UI element was clicked';
54
+ submit: 'A form or request was sent';
55
+ create: 'A new thing was created, or a creation attempt finished. Include `is_success` when failures are tracked';
56
+ view: 'A page or item was seen';
57
+ add: 'Something was added to an existing thing';
58
+ invite: 'Someone was invited';
59
+ update: 'Something changed';
60
+ delete: 'Something was destroyed';
61
+ remove: 'Something was taken out of an existing thing, not destroyed';
62
+ start: 'Something with a lifetime began, such as a session. Pairs with `end`';
63
+ end: 'Something with a lifetime stopped. Pairs with `start`';
64
+ complete: 'An operation that produces no new thing finished, such as a run or a tool call. Always carries `is_success`';
65
+ cancel: 'Someone stopped a process';
66
+ generate: 'Something was produced automatically';
67
+ send: 'Something was sent to someone';
68
+ }
69
+ export type AnalyticsCategory = keyof AnalyticsCategories;
70
+ export type AnalyticsObject = keyof AnalyticsObjects | `${string}_${keyof AnalyticsUiElements}`;
71
+ export type AnalyticsAction = keyof AnalyticsActions;
72
+ export type AnalyticsEventName = `${AnalyticsCategory}:${AnalyticsObject}_${AnalyticsAction}`;
@@ -1,10 +1,10 @@
1
1
  /** Every wildcard in a namespace: `environment:*`, `environment:connections:*`, … */
2
2
  export type WildcardsFor<Namespace extends string> = `${Namespace}:*` | `${Namespace}:${string}:*`;
3
- export declare const API_KEY_SCOPES: readonly ["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:connections:list", "environment:connections:list_credentials", "environment:connections:read", "environment:connections:read_credentials", "environment:connections:create", "environment:connections:update", "environment:connections:delete", "environment:connect_sessions:write", "environment:agent_sessions:write", "environment:syncs:read", "environment:syncs:execute", "environment:syncs:update", "environment:syncs:variant:create", "environment:syncs:variant:delete", "environment:functions:list", "environment:functions:read", "environment:functions:update", "environment:functions:delete", "environment:functions:compile", "environment:functions:dryrun", "environment:functions:invocations", "environment:deploy", "environment:records:read", "environment:records:write", "environment:logs:read", "environment:actions:execute", "environment:proxy", "environment:variables:read", "environment:webhook_signing_key:rotate", "environment:mcp"];
3
+ export declare const API_KEY_SCOPES: readonly ["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:connections:list", "environment:connections:list_credentials", "environment:connections:read", "environment:connections:read_credentials", "environment:connections:create", "environment:connections:update", "environment:connections:delete", "environment:connect_sessions:write", "environment:agent_sessions:write", "environment:syncs:read", "environment:syncs:execute", "environment:syncs:update", "environment:syncs:variant:create", "environment:syncs:variant:delete", "environment:functions:list", "environment:functions:read", "environment:functions:update", "environment:functions:delete", "environment:functions:compile", "environment:functions:dryrun", "environment:functions:invocations", "environment:deploy", "environment:records:read", "environment:records:write", "environment:logs:read", "environment:tools:call", "environment:proxy", "environment:variables:read", "environment:webhook_signing_key:rotate", "environment:mcp"];
4
4
  export type ConcreteApiKeyScope = (typeof API_KEY_SCOPES)[number];
5
5
  /** A scope, or a wildcard over scopes. Which wildcards resolve to something is checked at runtime. */
6
6
  export type ApiKeyScope = ConcreteApiKeyScope | WildcardsFor<'environment'>;
7
- export declare const ACCOUNT_API_KEY_SCOPES: readonly ["account:environments:list", "account:environments:create", "account:environments:delete", "account:environments:set_production", "account:environments:api_keys:list", "account:environments:api_keys:read", "account:environments:api_keys:create", "account:environments:api_keys:delete"];
7
+ export declare const ACCOUNT_API_KEY_SCOPES: readonly ["account:environments:list", "account:environments:read", "account:environments:read_secret", "account:environments:create", "account:environments:delete", "account:environments:set_production", "account:environments:api_keys:list", "account:environments:api_keys:read", "account:environments:api_keys:create", "account:environments:api_keys:update", "account:environments:api_keys:delete"];
8
8
  export type ConcreteAccountApiKeyScope = (typeof ACCOUNT_API_KEY_SCOPES)[number];
9
9
  export type AccountApiKeyScope = ConcreteAccountApiKeyScope | WildcardsFor<'account'>;
10
10
  export type CustomerKeyScope = ApiKeyScope | AccountApiKeyScope;
@@ -1,5 +1,5 @@
1
1
  import type { ConfirmEmail, CreateAccountApiKey, DeleteAccountApiKey, GetEmailByExpiredToken, GetEmailByUuid, GetManagedCallback, GetManagedEmailVerification, GetOnboardingAccountDiscovery, ListAccountApiKeys, PostForgotPassword, PostLogout, PostManagedEmailVerification, PostManagedSignup, PostOnboardingRequestInvite, PostSignin, PostSignup, PutResetPassword } from './account/api.js';
2
- import type { GetAsyncActionResult, GetPublicV1, PostInternalTriggerFunction, PostPublicTriggerAction } from './action/api.js';
2
+ import type { GetAsyncActionResult, GetPublicV1, PostInternalInvokeFunction, PostPublicTriggerAction } from './action/api.js';
3
3
  import type { PostImpersonate } from './admin/http.api.js';
4
4
  import type { DeleteAgentSession, PostAgentSessions } from './agent/api.js';
5
5
  import type { GetAgentSessionMcp, PostAgentSessionMcp } from './agent/mcp.api.js';
@@ -14,15 +14,16 @@ import type { DeleteConnection, DeletePublicConnection, GetConnection, GetConnec
14
14
  import type { PostConnectionMetadata, SetMetadata, UpdateMetadata } from './connection/api/metadata.js';
15
15
  import type { GetConnectUISettings, PutConnectUISettings } from './connectUISettings/api.js';
16
16
  import type { PostDeploy, PostDeployConfirmation, PostDeployInternal } from './deploy/api.js';
17
- import type { CreateApiKey, DeleteApiKey, DeleteEnvironment, DeletePublicApiKey, DeletePublicEnvironment, GetEnvironment, GetEnvironments, GetPublicApiKey, GetPublicApiKeys, GetPublicEnvironments, ListApiKeys, PatchApiKey, PatchEnvironment, PostEnvironment, PostPublicApiKey, PostPublicEnvironment, PostPublicRotateWebhookSigningKey, PostRotateWebhookSigningKey } from './environment/api/index.js';
17
+ import type { CreateApiKey, DeleteApiKey, DeleteEnvironment, DeletePublicApiKey, DeletePublicEnvironment, GetEnvironment, GetEnvironments, GetPublicApiKey, GetPublicApiKeys, GetPublicEnvironment, GetPublicEnvironments, ListApiKeys, PatchApiKey, PatchEnvironment, PatchPublicApiKey, PostEnvironment, PostPublicApiKey, PostPublicEnvironment, PostPublicRotateWebhookSigningKey, PostRotateWebhookSigningKey } from './environment/api/index.js';
18
18
  import type { PatchWebhook } from './environment/api/webhook.js';
19
19
  import type { PostEnvironmentVariables } from './environment/variable/api.js';
20
20
  import type { PatchFlowDisable, PatchFlowEnable, PatchFlowFrequency, PostPreBuiltDeploy, PutUpgradePreBuiltFlow } from './flow/http.api.js';
21
- import type { DeleteFunctionVariant, DeleteIntegrationFunction, DeletePublicIntegrationFunction, GetFunction, GetFunctionDeployment, GetFunctionDryrun, GetFunctionInvocation, GetFunctions, GetIntegrationFunction, GetIntegrationFunctions, GetIntegrationTemplates, GetProviderTemplates, GetPublicIntegrationFunction, GetPublicIntegrationFunctions, GetPublicProviderTemplates, PatchConnectionFunction, PatchFunction, PatchFunctionVariant, PostFunctionCompile, PostFunctionDeployment, PostFunctionDeploymentBundle, PostFunctionDeploymentBundlePreview, PostFunctionDeploymentResult, PostFunctionDryrun, PostFunctionDryrunResult, PostFunctionInvocation, PostFunctionVariant } from './functions/api.js';
21
+ import type { DeleteFunctionVariant, DeleteIntegrationFunction, DeletePublicIntegrationFunction, GetFunction, GetFunctionDeployment, GetFunctionDryrun, GetFunctionInvocation, GetFunctions, GetIntegrationFunction, GetIntegrationFunctions, GetIntegrationTemplates, GetProviderTemplateCode, GetProviderTemplates, GetPublicIntegrationFunction, GetPublicIntegrationFunctions, GetPublicProviderTemplateCode, GetPublicProviderTemplates, PatchConnectionFunction, PatchFunction, PatchFunctionVariant, PostFunctionCompile, PostFunctionDeployment, PostFunctionDeploymentBundle, PostFunctionDeploymentBundlePreview, PostFunctionDeploymentResult, PostFunctionDryrun, PostFunctionDryrunResult, PostFunctionInvocation, PostFunctionVariant, PostToolCall } from './functions/api.js';
22
22
  import type { GetGettingStarted, PatchGettingStarted } from './gettingStarted/api.js';
23
23
  import type { DeleteIntegration, DeletePublicIntegration, GetFunctionCode, GetIntegration, GetIntegrationFlows, GetPublicFunctionCode, GetPublicIntegration, GetPublicListIntegrations, PatchIntegration, PatchPublicIntegration, PostIntegration, PostPublicIntegration, PostPublicQuickstartIntegration } from './integration/api.js';
24
24
  import type { DeleteInvite, GetInvite, PostInvite } from './invitations/api.js';
25
25
  import type { GetOperation, PostInsights, SearchFilters, SearchMessages, SearchOperations } from './logs/api.js';
26
+ import type { GetConnectionToolsMcp, PostConnectionToolsMcp } from './mcp/api.js';
26
27
  import type { GetMeta } from './meta/api.js';
27
28
  import type { DeleteMFA, GetMFAStatus, PostMFAActivation, PostMFAEnrollment, PostMFALoginVerification, PostMFARecoveryCodes } from './mfa/api.js';
28
29
  import type { GetPlainHmac } from './plain/api.js';
@@ -36,8 +37,8 @@ import type { GetConnectionSyncs, GetPublicSyncStatus, PostPublicSyncPause, Post
36
37
  import type { DeleteTeamUser, GetTeam, PatchTeamUser, PutTeam } from './team/api.js';
37
38
  import type { GetUser, PatchUser, PutUserPassword } from './user/api.js';
38
39
  import type { PostPublicWebhook } from './webhooks/http.api.js';
39
- export type PublicApiEndpoints = SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation | PostPublicTrigger | PostPublicTbaAuthorization | PostPublicJwtAuthorization | PostPublicUnauthenticatedAuthorization | PostPublicApiKeyAuthorization | PostPublicBasicAuthorization | GetPublicProviders | GetPublicProvider | GetPublicListIntegrations | GetPublicIntegration | DeletePublicIntegration | PostConnectSessions | PostAgentSessions | DeleteAgentSession | PostAgentSessionMcp | GetAgentSessionMcp | PostPublicConnectSessionsReconnect | GetPublicConnections | GetPublicConnection | GetConnectSession | DeleteConnectSession | PostDeployInternal | PostPublicBillAuthorization | DeletePublicConnection | DeleteConnection | PostPublicSignatureAuthorization | PostPublicTwoStepAuthorization | PostPublicWebhook | GetPublicClientMetadata | GetPublicRecords | PatchPublicPruneRecords | GetPublicScriptsConfig | PostPublicConnectTelemetry | PostCliTelemetry | PutPublicSyncConnectionFrequency | PostPublicIntegration | PostPublicQuickstartIntegration | PatchPublicIntegration | GetAsyncActionResult | PostPublicOauthOutboundAuthorization | PostPublicAwsSigV4Authorization | PostPublicConnection | PatchPublicConnection | PostPublicSyncStart | PostPublicSyncPause | GetPublicSyncStatus | GetPublicV1 | PostPublicTriggerAction | PostFunctionCompile | GetFunction | GetFunctions | PatchFunction | PostFunctionDryrun | GetFunctionDryrun | PostFunctionDryrunResult | PostFunctionDeployment | GetFunctionDeployment | PostFunctionDeploymentResult | PostFunctionInvocation | PostFunctionVariant | PatchFunctionVariant | PatchConnectionFunction | DeleteFunctionVariant | GetFunctionInvocation | PostFunctionDeploymentBundle | PostFunctionDeploymentBundlePreview | GetPublicFunctionCode | GetPublicIntegrationFunctions | GetPublicIntegrationFunction | DeletePublicIntegrationFunction | GetPublicProviderTemplates | PostPublicRotateWebhookSigningKey | AllPublicProxy | PostPublicEnvironment | DeletePublicEnvironment | GetPublicEnvironments | GetPublicApiKey | GetPublicApiKeys | PostPublicApiKey | DeletePublicApiKey;
40
- export type PrivateApiEndpoints = GetAuditTrail | GetAuditTrailExport | ListAccountApiKeys | CreateAccountApiKey | DeleteAccountApiKey | ConfirmEmail | PostSignup | PostSignin | PostLogout | GetTeam | PutTeam | PostPlanExtendTrial | PostPlanChange | PutBillingInvoicingDetails | GetOverdueInvoices | GetBillingUsage | GetBillingUsageTopDimensionValues | GetUpcomingInvoice | GetBillingPeriodCosts | GetProjectedCosts | GetSpendAlert | PutSpendAlert | DeleteSpendAlert | GetUser | PatchUser | PutUserPassword | PostInvite | DeleteInvite | DeleteTeamUser | PatchTeamUser | PostInsights | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | PostInternalConnectSessions | GetIntegrationFlows | GetIntegrationFunction | GetIntegrationFunctions | GetFunctionCode | DeleteIntegrationFunction | GetIntegrationTemplates | GetProviderTemplates | DeleteIntegration | PatchIntegration | GetIntegration | PostIntegration | GetConnections | GetConnectionsCount | GetConnection | PatchConnection | PostConnectionMetadata | GetConnectionRecordModels | GetConnectionRecords | GetConnectionSyncs | GetInvite | GetMeta | GetEmailByExpiredToken | GetEmailByUuid | GetManagedCallback | GetManagedEmailVerification | GetOnboardingAccountDiscovery | PostOnboardingRequestInvite | PatchFlowDisable | PatchFlowEnable | PatchFlowFrequency | PutUpgradePreBuiltFlow | PostConnectionRefresh | PostManagedEmailVerification | PostManagedSignup | PostPreBuiltDeploy | PostEnvironment | PatchEnvironment | DeleteEnvironment | GetEnvironments | GetEnvironment | PostRotateWebhookSigningKey | ListApiKeys | CreateApiKey | DeleteApiKey | PatchApiKey | PatchWebhook | PostEnvironmentVariables | PostImpersonate | GetSharedCredentialsProviders | GetSharedCredentialsProvider | PostSharedCredentialsProvider | PatchSharedCredentialsProvider | GetGettingStarted | PatchGettingStarted | GetConnectUISettings | PutConnectUISettings | GetProviders | GetProvider | PostInternalTriggerFunction | GetMFAStatus | PostMFAEnrollment | PostMFAActivation | PostMFARecoveryCodes | PostMFALoginVerification | DeleteMFA | GetPlainHmac | PostAgentPlaygroundChat;
40
+ export type PublicApiEndpoints = SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation | PostPublicTrigger | PostPublicTbaAuthorization | PostPublicJwtAuthorization | PostPublicUnauthenticatedAuthorization | PostPublicApiKeyAuthorization | PostPublicBasicAuthorization | GetPublicProviders | GetPublicProvider | GetPublicListIntegrations | GetPublicIntegration | DeletePublicIntegration | PostConnectSessions | PostAgentSessions | DeleteAgentSession | PostAgentSessionMcp | GetAgentSessionMcp | PostConnectionToolsMcp | GetConnectionToolsMcp | PostPublicConnectSessionsReconnect | GetPublicConnections | GetPublicConnection | GetConnectSession | DeleteConnectSession | PostDeployInternal | PostPublicBillAuthorization | DeletePublicConnection | DeleteConnection | PostPublicSignatureAuthorization | PostPublicTwoStepAuthorization | PostPublicWebhook | GetPublicClientMetadata | GetPublicRecords | PatchPublicPruneRecords | GetPublicScriptsConfig | PostPublicConnectTelemetry | PostCliTelemetry | PutPublicSyncConnectionFrequency | PostPublicIntegration | PostPublicQuickstartIntegration | PatchPublicIntegration | GetAsyncActionResult | PostPublicOauthOutboundAuthorization | PostPublicAwsSigV4Authorization | PostPublicConnection | PatchPublicConnection | PostPublicSyncStart | PostPublicSyncPause | GetPublicSyncStatus | GetPublicV1 | PostPublicTriggerAction | PostFunctionCompile | GetFunction | GetFunctions | PatchFunction | PostFunctionDryrun | GetFunctionDryrun | PostFunctionDryrunResult | PostFunctionDeployment | GetFunctionDeployment | PostFunctionDeploymentResult | PostFunctionInvocation | PostFunctionVariant | PatchFunctionVariant | PatchConnectionFunction | DeleteFunctionVariant | GetFunctionInvocation | PostFunctionDeploymentBundle | PostFunctionDeploymentBundlePreview | GetPublicFunctionCode | GetPublicIntegrationFunctions | GetPublicIntegrationFunction | PostToolCall | DeletePublicIntegrationFunction | GetPublicProviderTemplates | GetPublicProviderTemplateCode | PostPublicRotateWebhookSigningKey | AllPublicProxy | PostPublicEnvironment | DeletePublicEnvironment | GetPublicEnvironment | GetPublicEnvironments | GetPublicApiKey | GetPublicApiKeys | PostPublicApiKey | PatchPublicApiKey | DeletePublicApiKey;
41
+ export type PrivateApiEndpoints = GetAuditTrail | GetAuditTrailExport | ListAccountApiKeys | CreateAccountApiKey | DeleteAccountApiKey | ConfirmEmail | PostSignup | PostSignin | PostLogout | GetTeam | PutTeam | PostPlanExtendTrial | PostPlanChange | PutBillingInvoicingDetails | GetOverdueInvoices | GetBillingUsage | GetBillingUsageTopDimensionValues | GetUpcomingInvoice | GetBillingPeriodCosts | GetProjectedCosts | GetSpendAlert | PutSpendAlert | DeleteSpendAlert | GetUser | PatchUser | PutUserPassword | PostInvite | DeleteInvite | DeleteTeamUser | PatchTeamUser | PostInsights | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | PostInternalConnectSessions | GetIntegrationFlows | GetIntegrationFunction | GetIntegrationFunctions | GetFunctionCode | DeleteIntegrationFunction | GetIntegrationTemplates | GetProviderTemplates | GetProviderTemplateCode | DeleteIntegration | PatchIntegration | GetIntegration | PostIntegration | GetConnections | GetConnectionsCount | GetConnection | PatchConnection | PostConnectionMetadata | GetConnectionRecordModels | GetConnectionRecords | GetConnectionSyncs | GetInvite | GetMeta | GetEmailByExpiredToken | GetEmailByUuid | GetManagedCallback | GetManagedEmailVerification | GetOnboardingAccountDiscovery | PostOnboardingRequestInvite | PatchFlowDisable | PatchFlowEnable | PatchFlowFrequency | PutUpgradePreBuiltFlow | PostConnectionRefresh | PostManagedEmailVerification | PostManagedSignup | PostPreBuiltDeploy | PostEnvironment | PatchEnvironment | DeleteEnvironment | GetEnvironments | GetEnvironment | PostRotateWebhookSigningKey | ListApiKeys | CreateApiKey | DeleteApiKey | PatchApiKey | PatchWebhook | PostEnvironmentVariables | PostImpersonate | GetSharedCredentialsProviders | GetSharedCredentialsProvider | PostSharedCredentialsProvider | PatchSharedCredentialsProvider | GetGettingStarted | PatchGettingStarted | GetConnectUISettings | PutConnectUISettings | GetProviders | GetProvider | PostInternalInvokeFunction | GetMFAStatus | PostMFAEnrollment | PostMFAActivation | PostMFARecoveryCodes | PostMFALoginVerification | DeleteMFA | GetPlainHmac | PostAgentPlaygroundChat;
41
42
  export type APIEndpoints = PrivateApiEndpoints | PublicApiEndpoints;
42
43
  /**
43
44
  * Automatically narrow endpoints type with Method + Path
@@ -34,6 +34,38 @@ export type GetPublicEnvironments = ApiEndpoint<{
34
34
  data: Pick<DBEnvironment, 'id' | 'uuid' | 'name' | 'is_production'>[];
35
35
  };
36
36
  }>;
37
+ export type GetPublicEnvironment = ApiEndpoint<{
38
+ Audit: {
39
+ kind: 'no-audit';
40
+ reason: 'non-auditable';
41
+ };
42
+ Method: 'GET';
43
+ Path: '/environments/:environmentUuid';
44
+ Params: {
45
+ environmentUuid: string;
46
+ };
47
+ Querystring: {
48
+ with_secrets?: 'true' | 'false' | undefined;
49
+ };
50
+ Success: {
51
+ data: {
52
+ id: number;
53
+ uuid: string;
54
+ name: string;
55
+ is_production: boolean;
56
+ callback_url: string;
57
+ slack_notifications: boolean;
58
+ otlp_endpoint: string | null;
59
+ otlp_headers?: {
60
+ name: string;
61
+ value: string;
62
+ }[];
63
+ webhooks: ApiWebhooks & {
64
+ signing_key?: string;
65
+ };
66
+ };
67
+ };
68
+ }>;
37
69
  export type PostEnvironment = ApiEndpoint<{
38
70
  Audit: AuditPolicy<'environment', 'created', 'account'>;
39
71
  Method: 'POST';
@@ -62,9 +94,35 @@ export type PostPublicEnvironment = ApiEndpoint<{
62
94
  name: string;
63
95
  value: string;
64
96
  }[] | undefined;
97
+ webhooks?: {
98
+ primary_url?: string | undefined;
99
+ secondary_url?: string | undefined;
100
+ on_sync_completion_always?: boolean | undefined;
101
+ on_auth_creation?: boolean | undefined;
102
+ on_auth_refresh_error?: boolean | undefined;
103
+ on_sync_error?: boolean | undefined;
104
+ on_async_action_completion?: boolean | undefined;
105
+ on_connection_deletion?: boolean | undefined;
106
+ signing_key?: string | undefined;
107
+ } | undefined;
65
108
  };
66
109
  Success: {
67
- data: Pick<DBEnvironment, 'id' | 'uuid' | 'name'>;
110
+ data: {
111
+ id: number;
112
+ uuid: string;
113
+ name: string;
114
+ is_production: boolean;
115
+ callback_url: string;
116
+ slack_notifications: boolean;
117
+ otlp_endpoint: string | null;
118
+ otlp_headers: {
119
+ name: string;
120
+ value: string;
121
+ }[];
122
+ webhooks: ApiWebhooks & {
123
+ signing_key: string;
124
+ };
125
+ };
68
126
  };
69
127
  Error: ApiError<'conflict' | 'resource_capped' | 'invalid_is_prod_flag'>;
70
128
  }>;
@@ -211,6 +269,7 @@ export type PostPublicApiKey = ApiEndpoint<{
211
269
  };
212
270
  Body: {
213
271
  display_name: string;
272
+ scopes?: ApiKeyScope[];
214
273
  };
215
274
  Success: {
216
275
  data: {
@@ -271,6 +330,30 @@ export type GetPublicApiKey = ApiEndpoint<{
271
330
  };
272
331
  };
273
332
  }>;
333
+ export type PatchPublicApiKey = ApiEndpoint<{
334
+ Audit: AuditPolicy<'api_key', 'updated', 'environment'>;
335
+ Method: 'PATCH';
336
+ Path: '/environments/:environmentUuid/api-keys/:keyUuid';
337
+ Params: {
338
+ environmentUuid: string;
339
+ keyUuid: string;
340
+ };
341
+ Body: {
342
+ display_name?: string;
343
+ scopes?: ApiKeyScope[];
344
+ };
345
+ Success: {
346
+ data: {
347
+ id: number;
348
+ uuid: string;
349
+ display_name: string;
350
+ scopes: ApiKeyScope[];
351
+ last_used_at: string | null;
352
+ created_at: string;
353
+ };
354
+ };
355
+ Error: ApiError<'conflict' | 'not_found'>;
356
+ }>;
274
357
  export type DeletePublicApiKey = ApiEndpoint<{
275
358
  Audit: AuditPolicy<'api_key', 'deleted', 'environment'>;
276
359
  Method: 'DELETE';
@@ -1,5 +1,6 @@
1
1
  import type { OnEventType } from '../scripts/on-events/api.js';
2
- export type FunctionTags = Record<string, string | string[]>;
2
+ export type FunctionTagValue = string | string[];
3
+ export type FunctionTags = Record<string, FunctionTagValue>;
3
4
  export interface FunctionCapabilities {
4
5
  usesRecords: boolean;
5
6
  usesOutbound: boolean;
@@ -1,6 +1,7 @@
1
1
  import type { TimestampsAndDeletedAt } from '../db.js';
2
2
  import type { FunctionSource } from '../syncConfigs/db.js';
3
3
  import type { FunctionCapabilities, FunctionLimits, FunctionRequires, FunctionTags, FunctionTriggerDefinition } from './config.js';
4
+ import type { ToolTags } from './tool.js';
4
5
  import type { JSONSchema7 } from 'json-schema';
5
6
  export interface DBFunctionConfig extends TimestampsAndDeletedAt {
6
7
  id: number;
@@ -15,7 +16,7 @@ export interface DBFunctionConfigVersion extends TimestampsAndDeletedAt {
15
16
  id: number;
16
17
  function_config_id: number;
17
18
  description: string;
18
- tags: FunctionTags;
19
+ tags: FunctionTags | ToolTags;
19
20
  file_location: string;
20
21
  version: string;
21
22
  source: FunctionSource;
@@ -0,0 +1,20 @@
1
+ import type { FunctionTagValue } from './config.js';
2
+ /** Explicit provider scope requirements; omit the declaration when requirements are unknown. */
3
+ export type RequiredScopes = {
4
+ all: [string, ...string[]];
5
+ any?: never;
6
+ none?: never;
7
+ } | {
8
+ any: [string, ...string[]];
9
+ all?: never;
10
+ none?: never;
11
+ } | {
12
+ none: true;
13
+ all?: never;
14
+ any?: never;
15
+ };
16
+ export interface ToolTags {
17
+ instructions?: string;
18
+ required_scopes?: RequiredScopes;
19
+ [key: string]: FunctionTagValue | RequiredScopes;
20
+ }
@@ -1,8 +1,9 @@
1
1
  import type { ApiEndpoint, ApiError } from '../api.js';
2
2
  import type { AuditPolicy } from '../audit-trail/event.js';
3
3
  import type { FunctionCapabilities, FunctionLimits, FunctionRequires, FunctionTags, FunctionTriggerDefinition } from '../function/config.js';
4
+ import type { ToolTags } from '../function/tool.js';
4
5
  import type { FunctionSource } from '../syncConfigs/db.js';
5
- import type { FunctionType, ListedNangoFunction, NangoActionFunction, NangoFunctionTemplate, NangoSyncFunction } from './domain.js';
6
+ import type { FunctionListType, FunctionType, ListedNangoFunction, NangoActionFunction, NangoFunctionTemplate, NangoSyncFunction } from './domain.js';
6
7
  import type { JSONSchema7 } from 'json-schema';
7
8
  export type RunnableFunctionType = Extract<FunctionType, 'action' | 'sync'>;
8
9
  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';
@@ -229,10 +230,12 @@ export interface GetFunctionResponse {
229
230
  provider: string;
230
231
  name: string;
231
232
  description: string;
232
- tags: FunctionTags;
233
+ tags: FunctionTags | ToolTags;
233
234
  state: 'enabled' | 'disabled';
234
235
  source: FunctionSource;
235
236
  trigger: FunctionTriggerDefinition;
237
+ input_json_schema: JSONSchema7 | null;
238
+ output_json_schema: JSONSchema7 | null;
236
239
  created_at: string;
237
240
  updated_at: string;
238
241
  }
@@ -299,7 +302,7 @@ export type PostFunctionInvocation = ApiEndpoint<{
299
302
  invocation_type: FunctionInvocationType;
300
303
  options?: Record<string, unknown> | undefined;
301
304
  };
302
- Error: ApiError<FunctionInvocationErrorCode>;
305
+ Error: ApiError<FunctionInvocationErrorCode | 'function_runtime_error'>;
303
306
  Success: FunctionInvocationSuccess;
304
307
  }>;
305
308
  export type FunctionVariantErrorCode = 'invalid_variant' | 'function_not_found' | 'connection_not_found' | 'function_disabled' | 'function_variant_not_found' | 'invalid_frequency' | 'resource_capped' | 'server_error';
@@ -383,11 +386,11 @@ export type GetFunctionInvocation = ApiEndpoint<{
383
386
  functionUuid: string;
384
387
  id: string;
385
388
  };
386
- Error: ApiError<'invalid_uri_params' | 'not_found' | 'function_not_found' | 'connection_not_found' | 'function_failed' | 'server_error'>;
389
+ Error: ApiError<'invalid_uri_params' | 'not_found' | 'function_not_found' | 'connection_not_found' | 'function_failed' | 'function_runtime_error' | 'server_error'>;
387
390
  Success: FunctionInvocationSuccess;
388
391
  }>;
389
392
  export interface FunctionListFilters {
390
- type?: FunctionType;
393
+ type?: FunctionListType;
391
394
  search?: string;
392
395
  page?: number;
393
396
  limit?: number;
@@ -435,7 +438,7 @@ export type GetIntegrationFunction = ApiEndpoint<{
435
438
  Path: '/api/v1/integrations/:providerConfigKey/functions/:functionName';
436
439
  Querystring: {
437
440
  env: string;
438
- type?: FunctionType;
441
+ type?: FunctionListType;
439
442
  };
440
443
  Params: {
441
444
  providerConfigKey: string;
@@ -495,7 +498,7 @@ export type GetPublicIntegrationFunction = ApiEndpoint<{
495
498
  Method: 'GET';
496
499
  Path: '/integrations/:uniqueKey/functions/:name';
497
500
  Querystring: {
498
- type?: FunctionType;
501
+ type?: FunctionListType;
499
502
  };
500
503
  Params: {
501
504
  uniqueKey: string;
@@ -518,6 +521,26 @@ export type DeletePublicIntegrationFunction = ApiEndpoint<{
518
521
  Error: ApiError<'function_managed_by_deploy' | 'invalid_request'>;
519
522
  Success: FunctionDeletionSuccess;
520
523
  }>;
524
+ export type PostToolCall = ApiEndpoint<{
525
+ Audit: {
526
+ kind: 'no-audit';
527
+ reason: 'data-plane operation';
528
+ };
529
+ Method: 'POST';
530
+ Path: '/connections/:connectionId/tools/:name/calls';
531
+ Params: {
532
+ connectionId: string;
533
+ name: string;
534
+ };
535
+ Headers: {
536
+ 'provider-config-key'?: string | undefined;
537
+ };
538
+ Body: {
539
+ input?: unknown | undefined;
540
+ };
541
+ Error: ApiError<FunctionInvocationErrorCode | 'function_runtime_error' | 'ambiguous_connection'>;
542
+ Success: FunctionInvocationSuccess;
543
+ }>;
521
544
  export type GetPublicProviderTemplates = ApiEndpoint<{
522
545
  Audit: {
523
546
  kind: 'no-audit';
@@ -530,6 +553,53 @@ export type GetPublicProviderTemplates = ApiEndpoint<{
530
553
  };
531
554
  Success: ProviderTemplatesSuccess;
532
555
  }>;
556
+ type ProviderTemplateCodeError = ApiError<'unknown_function'> | ApiError<'source_unavailable'> | ApiError<'ambiguous_function', undefined, {
557
+ matches: {
558
+ type: FunctionType;
559
+ name: string;
560
+ }[];
561
+ }>;
562
+ export type GetPublicProviderTemplateCode = ApiEndpoint<{
563
+ Audit: {
564
+ kind: 'no-audit';
565
+ reason: 'non-auditable';
566
+ };
567
+ Method: 'GET';
568
+ Path: '/providers/:provider/templates/:name/code';
569
+ Params: {
570
+ provider: string;
571
+ name: string;
572
+ };
573
+ Querystring: {
574
+ type?: FunctionType | undefined;
575
+ };
576
+ Success: {
577
+ type: FunctionType;
578
+ code: string;
579
+ };
580
+ Error: ProviderTemplateCodeError;
581
+ }>;
582
+ export type GetProviderTemplateCode = ApiEndpoint<{
583
+ Audit: {
584
+ kind: 'no-audit';
585
+ reason: 'non-auditable';
586
+ };
587
+ Method: 'GET';
588
+ Path: '/api/v1/providers/:providerConfigKey/templates/:name/code';
589
+ Params: {
590
+ providerConfigKey: string;
591
+ name: string;
592
+ };
593
+ Querystring: {
594
+ env: string;
595
+ type?: FunctionType | undefined;
596
+ };
597
+ Success: {
598
+ type: FunctionType;
599
+ code: string;
600
+ };
601
+ Error: ProviderTemplateCodeError;
602
+ }>;
533
603
  export type GetIntegrationTemplates = ApiEndpoint<{
534
604
  Audit: {
535
605
  kind: 'no-audit';
@@ -551,7 +621,7 @@ export interface FunctionDeploymentArtifact {
551
621
  name: string;
552
622
  integrationId: string;
553
623
  description: string;
554
- tags?: FunctionTags | undefined;
624
+ tags?: FunctionTags | ToolTags | undefined;
555
625
  trigger: FunctionTriggerDefinition;
556
626
  requires: FunctionRequires;
557
627
  capabilities: FunctionCapabilities;
@@ -1,9 +1,12 @@
1
+ import type { FunctionTags } from '../function/config.js';
2
+ import type { ToolTags } from '../function/tool.js';
1
3
  import type { OnEventType } from '../scripts/on-events/api.js';
2
4
  import type { FunctionSource } from '../syncConfigs/db.js';
3
5
  import type { JSONSchema7 } from 'json-schema';
4
6
  /** `tools-catalog` is list/API only — never a DB `FunctionSource`. */
5
7
  export type FunctionListSource = FunctionSource | 'tools-catalog';
6
8
  export type FunctionType = 'action' | 'sync' | 'on-event';
9
+ export type FunctionListType = FunctionType | 'tool';
7
10
  interface NangoFunctionBase {
8
11
  name: string;
9
12
  description?: string;
@@ -40,7 +43,7 @@ export interface FunctionAvailability {
40
43
  }
41
44
  /** A row in a function list. Catalog actions have no deployed row. */
42
45
  export interface ListedFunctionAvailability {
43
- /** Sync-config id. `null` when the function is served from the catalog (no deployed row). */
46
+ /** Sync-config id. `null` when the function is served from the catalog (no deployed row) or is a tool (identified by `uuid`). */
44
47
  id: number | null;
45
48
  enabled: boolean;
46
49
  /** ISO-8601 timestamp. `null` when the function was never deployed. */
@@ -50,7 +53,19 @@ export interface ListedFunctionAvailability {
50
53
  export type ListedNangoSyncFunction = NangoSyncFunction & ListedFunctionAvailability;
51
54
  export type ListedNangoActionFunction = NangoActionFunction & ListedFunctionAvailability;
52
55
  export type ListedNangoOnEventFunction = NangoOnEventFunction & ListedFunctionAvailability;
53
- export type ListedNangoFunction = ListedNangoSyncFunction | ListedNangoActionFunction | ListedNangoOnEventFunction;
56
+ export type ListedNangoToolFunction = NangoFunctionBase & ListedFunctionAvailability & {
57
+ type: 'tool';
58
+ uuid: string;
59
+ integration_id: string;
60
+ provider: string;
61
+ description: string;
62
+ input_json_schema: JSONSchema7 | null;
63
+ output_json_schema: JSONSchema7 | null;
64
+ meta: Pick<ToolTags, 'instructions' | 'required_scopes'> & {
65
+ tags: FunctionTags;
66
+ };
67
+ };
68
+ export type ListedNangoFunction = ListedNangoSyncFunction | ListedNangoActionFunction | ListedNangoOnEventFunction | ListedNangoToolFunction;
54
69
  export type NangoFunctionTemplate = (NangoSyncFunction | NangoActionFunction) & {
55
70
  deployed?: FunctionAvailability;
56
71
  };
package/dist/index.d.ts CHANGED
@@ -4,6 +4,8 @@ export type * from './api.endpoints.js';
4
4
  export type * from './audit-trail/api.js';
5
5
  export type * from './audit-trail/event.js';
6
6
  export type * from './audit-trail/metadata.js';
7
+ export type * from './analytics/catalogue.js';
8
+ export type * from './analytics/taxonomy.js';
7
9
  export type * from './gettingStarted/db.js';
8
10
  export type * from './gettingStarted/dto.js';
9
11
  export type * from './gettingStarted/api.js';
@@ -110,7 +112,10 @@ export type * from './mfa/db.js';
110
112
  export type * from './function/config.js';
111
113
  export type * from './function/db.js';
112
114
  export type * from './function/trigger.js';
115
+ export type * from './function/tool.js';
113
116
  export type * from './functions/api.js';
114
117
  export type * from './functions/domain.js';
115
118
  export type * from './lambda/index.js';
116
119
  export type * from './pubsub/events.js';
120
+ export type { SignupAdvertising } from './account/signupAdvertising.js';
121
+ export type * from './self-hosting/db.js';
@@ -2,11 +2,11 @@ import type { ApiEndpoint, ApiError, ApiTimestamps } from '../api.js';
2
2
  import type { AuditPolicy } from '../audit-trail/event.js';
3
3
  import type { AuthModes, AuthModeType } from '../auth/api.js';
4
4
  import type { NangoSyncConfig } from '../flow/index.js';
5
- import type { ScriptTypeLiteral } from '../nangoYaml/index.js';
5
+ import type { FunctionListType } from '../functions/domain.js';
6
6
  import type { Provider } from '../providers/provider.js';
7
7
  import type { IntegrationConfig } from './db.js';
8
8
  import type { Merge } from 'type-fest';
9
- export type ApiPublicIntegration = Merge<Pick<IntegrationConfig, 'created_at' | 'updated_at' | 'unique_key' | 'provider' | 'display_name' | 'forward_webhooks'>, ApiTimestamps> & {
9
+ export type ApiPublicIntegration = Merge<Pick<IntegrationConfig, 'created_at' | 'updated_at' | 'unique_key' | 'provider' | 'display_name' | 'forward_webhooks' | 'missing_fields'>, ApiTimestamps> & {
10
10
  logo: string;
11
11
  } & ApiPublicIntegrationInclude;
12
12
  export interface ApiPublicIntegrationInclude {
@@ -152,18 +152,13 @@ export type GetPublicFunctionCode = ApiEndpoint<{
152
152
  name: string;
153
153
  };
154
154
  Querystring: {
155
- type?: ScriptTypeLiteral | undefined;
155
+ type?: FunctionListType | undefined;
156
156
  };
157
157
  Success: {
158
- type: ScriptTypeLiteral;
158
+ type: FunctionListType;
159
159
  code: string;
160
160
  };
161
- Error: ApiError<'not_found'> | ApiError<'ambiguous_function', undefined, {
162
- matches: {
163
- type: ScriptTypeLiteral;
164
- name: string;
165
- }[];
166
- }>;
161
+ Error: ApiError<'not_found'>;
167
162
  }>;
168
163
  export type GetFunctionCode = ApiEndpoint<{
169
164
  Audit: {
@@ -178,18 +173,13 @@ export type GetFunctionCode = ApiEndpoint<{
178
173
  };
179
174
  Querystring: {
180
175
  env: string;
181
- type?: ScriptTypeLiteral | undefined;
176
+ type?: FunctionListType | undefined;
182
177
  };
183
178
  Success: {
184
- type: ScriptTypeLiteral;
179
+ type: FunctionListType;
185
180
  code: string;
186
181
  };
187
- Error: ApiError<'not_found'> | ApiError<'ambiguous_function', undefined, {
188
- matches: {
189
- type: ScriptTypeLiteral;
190
- name: string;
191
- }[];
192
- }>;
182
+ Error: ApiError<'not_found'>;
193
183
  }>;
194
184
  export type ApiIntegration = Omit<Merge<IntegrationConfig, ApiTimestamps>, 'oauth_client_secret_iv' | 'oauth_client_secret_tag'>;
195
185
  export type ApiIntegrationList = ApiIntegration & {
@@ -371,22 +361,22 @@ export type GetIntegrationFlows = ApiEndpoint<{
371
361
  }>;
372
362
  export type ApiPublicIntegrationCredentials = {
373
363
  type: Extract<AuthModeType, 'OAUTH1' | 'OAUTH2' | 'TBA'>;
374
- client_id: string;
375
- client_secret: string;
364
+ client_id?: string | undefined;
365
+ client_secret?: string | undefined;
376
366
  scopes?: string | undefined;
377
367
  webhook_secret?: string | undefined;
378
368
  } | {
379
369
  type: Extract<AuthModeType, 'APP'>;
380
- app_id: string;
381
- app_link: string;
382
- private_key: string;
370
+ app_id?: string | undefined;
371
+ app_link?: string | undefined;
372
+ private_key?: string | undefined;
383
373
  } | {
384
374
  type: Extract<AuthModeType, 'CUSTOM'>;
385
- client_id: string;
386
- client_secret: string;
387
- app_id: string;
388
- app_link: string;
389
- private_key: string;
375
+ client_id?: string | undefined;
376
+ client_secret?: string | undefined;
377
+ app_id?: string | undefined;
378
+ app_link?: string | undefined;
379
+ private_key?: string | undefined;
390
380
  } | {
391
381
  type: Extract<AuthModeType, 'MCP_OAUTH2_GENERIC'>;
392
382
  client_name?: string | undefined;
@@ -31,6 +31,7 @@ export type GetMeta = ApiEndpoint<{
31
31
  toolsCatalog: boolean;
32
32
  accountGroup: AccountGroupProperties;
33
33
  agentPlayground: boolean;
34
+ hasBaa: boolean;
34
35
  };
35
36
  };
36
37
  }>;
@@ -313,3 +313,4 @@ export type PostPlanChange = ApiEndpoint<{
313
313
  };
314
314
  };
315
315
  }>;
316
+ export type GrowthAddonState = 'none' | 'active' | 'pending-removal' | 'pending-activation';