@nangohq/types 0.71.4 → 0.71.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/account/api.d.ts +49 -2
  2. package/dist/action/api.d.ts +4 -0
  3. package/dist/admin/http.api.d.ts +1 -1
  4. package/dist/agent/api.d.ts +88 -0
  5. package/dist/agent/connections.d.ts +44 -0
  6. package/dist/agent/mcp.api.d.ts +28 -0
  7. package/dist/agent/session.d.ts +20 -0
  8. package/dist/agent/toolSearch.d.ts +34 -0
  9. package/dist/agent/toolset.d.ts +43 -0
  10. package/dist/api-keys/auth.d.ts +2 -0
  11. package/dist/api-keys/scopes.d.ts +9 -4
  12. package/dist/api.endpoints.d.ts +9 -7
  13. package/dist/audit-trail/api.d.ts +21 -8
  14. package/dist/audit-trail/event.d.ts +135 -15
  15. package/dist/audit-trail/metadata.d.ts +99 -0
  16. package/dist/auth/api.d.ts +1 -1
  17. package/dist/auth/http.api.d.ts +11 -40
  18. package/dist/authz/types.d.ts +1 -1
  19. package/dist/billing/types.d.ts +56 -10
  20. package/dist/connection/api/get.d.ts +1 -1
  21. package/dist/connection/api/metadata.d.ts +8 -2
  22. package/dist/environment/api/index.d.ts +92 -1
  23. package/dist/environment/api/webhook.d.ts +1 -0
  24. package/dist/environment/db.d.ts +2 -0
  25. package/dist/function/trigger.d.ts +61 -0
  26. package/dist/functions/api.d.ts +35 -0
  27. package/dist/index.d.ts +10 -2
  28. package/dist/keystore/index.d.ts +10 -2
  29. package/dist/logs/messages.d.ts +24 -3
  30. package/dist/meta/api.d.ts +1 -0
  31. package/dist/mfa/api.d.ts +2 -7
  32. package/dist/mfa/credential.d.ts +7 -0
  33. package/dist/mfa/db.d.ts +1 -0
  34. package/dist/persist/api.d.ts +1 -1
  35. package/dist/plans/db.d.ts +21 -1
  36. package/dist/plans/http.api.d.ts +109 -0
  37. package/dist/providers/provider.d.ts +1 -0
  38. package/dist/pubsub/events.d.ts +2 -2
  39. package/dist/runner/sdk.d.ts +1 -1
  40. package/dist/sharedCredentials/api.d.ts +2 -0
  41. package/dist/sharedCredentials/db.d.ts +1 -0
  42. package/dist/sharedCredentials/dto.d.ts +1 -1
  43. package/dist/stripe/http.api.d.ts +3 -0
  44. package/dist/sync/api.d.ts +1 -1
  45. package/dist/usage/index.d.ts +1 -1
  46. package/dist/user/api.d.ts +5 -1
  47. package/dist/web/env.d.ts +3 -0
  48. package/dist/webhooks/api.d.ts +2 -1
  49. package/package.json +1 -1
@@ -1,6 +1,52 @@
1
+ import type { AccountApiKeyScope } from '../api-keys/scopes.js';
1
2
  import type { ApiEndpoint, ApiError } from '../api.js';
2
3
  import type { AuditPolicy } from '../audit-trail/event.js';
4
+ import type { MFACredential } from '../mfa/credential.js';
3
5
  import type { ApiUser } from '../user/api.js';
6
+ export interface AccountApiKey {
7
+ id: number;
8
+ uuid: string;
9
+ display_name: string;
10
+ scopes: AccountApiKeyScope[];
11
+ secret: string;
12
+ last_used_at: string | null;
13
+ created_at: string;
14
+ }
15
+ export type ListAccountApiKeys = ApiEndpoint<{
16
+ Audit: {
17
+ kind: 'no-audit';
18
+ reason: 'non-auditable';
19
+ };
20
+ Method: 'GET';
21
+ Path: '/api/v1/account/api-keys';
22
+ Success: {
23
+ data: AccountApiKey[];
24
+ };
25
+ }>;
26
+ export type CreateAccountApiKey = ApiEndpoint<{
27
+ Audit: AuditPolicy<'api_key', 'created', 'account'>;
28
+ Method: 'POST';
29
+ Path: '/api/v1/account/api-keys';
30
+ Body: {
31
+ display_name: string;
32
+ };
33
+ Success: {
34
+ data: Omit<AccountApiKey, 'last_used_at'>;
35
+ };
36
+ Error: ApiError<'conflict' | 'resource_capped'>;
37
+ }>;
38
+ export type DeleteAccountApiKey = ApiEndpoint<{
39
+ Audit: AuditPolicy<'api_key', 'deleted', 'account'>;
40
+ Method: 'DELETE';
41
+ Path: '/api/v1/account/api-keys/:keyId';
42
+ Params: {
43
+ keyId: number;
44
+ };
45
+ Success: {
46
+ success: true;
47
+ };
48
+ Error: ApiError<'not_found'>;
49
+ }>;
4
50
  export type PostSignup = ApiEndpoint<{
5
51
  Audit: AuditPolicy<'app_auth', 'signup', 'account'>;
6
52
  Method: 'POST';
@@ -12,7 +58,7 @@ export type PostSignup = ApiEndpoint<{
12
58
  token?: string | undefined;
13
59
  foundUs?: string | undefined;
14
60
  };
15
- Error: ApiError<'email_already_verified'> | ApiError<'error_creating_user'> | ApiError<'user_already_exists'> | ApiError<'error_creating_account'> | ApiError<'invalid_invite_token'> | ApiError<'email_not_verified'>;
61
+ Error: ApiError<'email_already_verified'> | ApiError<'error_creating_user'> | ApiError<'user_already_exists'> | ApiError<'error_creating_account'> | ApiError<'not_found'> | ApiError<'email_not_verified'>;
16
62
  Success: {
17
63
  data: {
18
64
  uuid: string;
@@ -144,8 +190,9 @@ export type PutResetPassword = ApiEndpoint<{
144
190
  Body: {
145
191
  token: string;
146
192
  password: string;
193
+ mfa?: MFACredential | undefined;
147
194
  };
148
- Error: ApiError<'user_not_found'> | ApiError<'invalid_token'>;
195
+ Error: ApiError<'user_not_found'> | ApiError<'invalid_token'> | ApiError<'invalid_mfa_code'> | ApiError<'mfa_code_required'>;
149
196
  Success: {
150
197
  success: true;
151
198
  };
@@ -1,4 +1,8 @@
1
1
  import type { ApiEndpoint } from '../api.js';
2
+ export interface AsyncFunctionResponse {
3
+ id: string;
4
+ statusUrl: string;
5
+ }
2
6
  export interface AsyncActionResponse {
3
7
  id: string;
4
8
  statusUrl: string;
@@ -14,7 +14,7 @@ export type PostImpersonate = ApiEndpoint<{
14
14
  loginReason: string;
15
15
  code?: string | undefined;
16
16
  };
17
- Error: ApiError<'invalid_mfa_code'> | ApiError<'mfa_not_enabled'>;
17
+ Error: ApiError<'invalid_mfa_code'> | ApiError<'mfa_code_required'> | ApiError<'mfa_not_enabled'>;
18
18
  Success: {
19
19
  success: true;
20
20
  };
@@ -0,0 +1,88 @@
1
+ import type { ApiEndpoint, ApiError } from '../api.js';
2
+ import type { Tags } from '../db.js';
3
+ import type { AgentSessionUnknownPinnedConnectionsPayload } from './connections.js';
4
+ import type { AgentSessionToolsNotInToolsetPayload, AgentSessionUnknownIntegrationsPayload, AgentSessionUnknownToolsPayload, AgentSessionUnsupportedFunctionTypesPayload } from './toolset.js';
5
+ export interface AgentSessionToolListInput {
6
+ tools: string[];
7
+ }
8
+ export type AgentSessionIntegrationPolicyInput = '*' | {
9
+ allow?: AgentSessionToolListInput | '*' | undefined;
10
+ deny?: AgentSessionToolListInput | undefined;
11
+ };
12
+ export interface PostAgentSessionsBody {
13
+ tenant: {
14
+ connections: {
15
+ any?: {
16
+ tags: Tags;
17
+ }[] | undefined;
18
+ pinned?: {
19
+ integration_id: string;
20
+ connection_id: string;
21
+ }[] | undefined;
22
+ };
23
+ };
24
+ toolset?: '*' | Record<string, AgentSessionIntegrationPolicyInput> | undefined;
25
+ pinned_tools?: Record<string, string[]> | undefined;
26
+ meta_tools?: Record<string, boolean> | undefined;
27
+ expires_in?: string | undefined;
28
+ }
29
+ export interface AgentSessionToolsetSummary {
30
+ connected: boolean;
31
+ tools_pinned: number;
32
+ tools_searchable: number;
33
+ }
34
+ export interface AgentSessionMetaToolsSummary {
35
+ nango_tool_search: boolean;
36
+ nango_execute: boolean;
37
+ }
38
+ export interface AgentSessionUnknownMetaToolsPayload {
39
+ meta_tools: string[];
40
+ }
41
+ /**
42
+ * Creating a session does not require the connections read scope, so a returned candidate names the
43
+ * connection and nothing else. The tags that made it a candidate are on the session created
44
+ * operation, which is where an ambiguity gets debugged.
45
+ */
46
+ export interface AgentSessionReturnedCandidate {
47
+ connection_id: string;
48
+ }
49
+ export interface AgentSessionAmbiguousConnectionsReply {
50
+ integrations: Record<string, {
51
+ match_count: number;
52
+ candidates: AgentSessionReturnedCandidate[];
53
+ }>;
54
+ }
55
+ export interface AgentSessionPinnedConnectionNotMatchedReply {
56
+ pinned: {
57
+ integration_id: string;
58
+ connection_id: string;
59
+ candidates: AgentSessionReturnedCandidate[];
60
+ }[];
61
+ }
62
+ export type AgentSessionCreationErrorCode = 'ambiguous_connections' | 'unknown_pinned_connection' | 'pinned_connection_not_matched' | 'unknown_integration' | 'unknown_tool' | 'unsupported_function_type' | 'tool_not_in_toolset' | 'unknown_meta_tool';
63
+ /**
64
+ * The payload is not correlated to the code by the compiler on purpose. AgentSessionCreationError
65
+ * carries it as a plain record, so a discriminated union here would only be a cast at the caller.
66
+ */
67
+ export type AgentSessionCreationErrorPayload = AgentSessionAmbiguousConnectionsReply | AgentSessionUnknownPinnedConnectionsPayload | AgentSessionPinnedConnectionNotMatchedReply | AgentSessionUnknownIntegrationsPayload | AgentSessionUnknownToolsPayload | AgentSessionUnsupportedFunctionTypesPayload | AgentSessionToolsNotInToolsetPayload | AgentSessionUnknownMetaToolsPayload;
68
+ export type PostAgentSessionsCreationError = ApiError<AgentSessionCreationErrorCode, undefined, AgentSessionCreationErrorPayload>;
69
+ export type PostAgentSessions = ApiEndpoint<{
70
+ Audit: {
71
+ kind: 'no-audit';
72
+ reason: 'TODO: audit coverage pending';
73
+ };
74
+ Method: 'POST';
75
+ Path: '/sessions';
76
+ Body: PostAgentSessionsBody;
77
+ Error: PostAgentSessionsCreationError;
78
+ Success: {
79
+ data: {
80
+ session_id: string;
81
+ session_token: string;
82
+ mcp_url: string;
83
+ expires_at: string;
84
+ toolset: Record<string, AgentSessionToolsetSummary>;
85
+ meta_tools: AgentSessionMetaToolsSummary;
86
+ };
87
+ };
88
+ }>;
@@ -0,0 +1,44 @@
1
+ import type { Tags } from '../db.js';
2
+ export interface AgentSessionConnectionSelector {
3
+ readonly tags: Tags;
4
+ }
5
+ export interface AgentSessionPinnedConnection {
6
+ readonly integrationId: string;
7
+ readonly connectionId: string;
8
+ }
9
+ export interface AgentSessionTenantConnections {
10
+ readonly any: AgentSessionConnectionSelector[];
11
+ readonly pinned: AgentSessionPinnedConnection[];
12
+ }
13
+ export interface AgentSessionResolvedConnection {
14
+ readonly integrationId: string;
15
+ readonly provider: string;
16
+ readonly connectionId: string;
17
+ readonly internalConnectionId: number;
18
+ readonly configId: number;
19
+ }
20
+ export type AgentSessionResolvedConnections = Record<string, AgentSessionResolvedConnection>;
21
+ export type AgentSessionConnectionResolutionErrorCode = 'ambiguous_connections' | 'pinned_connection_not_matched' | 'unknown_pinned_connection';
22
+ export interface AgentSessionConnectionCandidateReport {
23
+ readonly connection_id: string;
24
+ readonly tags: Tags;
25
+ }
26
+ export interface AgentSessionAmbiguousConnectionsPayload {
27
+ readonly integrations: Record<string, {
28
+ readonly match_count: number;
29
+ readonly candidates: AgentSessionConnectionCandidateReport[];
30
+ }>;
31
+ }
32
+ export interface AgentSessionUnknownPinnedConnectionsPayload {
33
+ readonly pinned: {
34
+ readonly integration_id: string;
35
+ readonly connection_id: string;
36
+ }[];
37
+ }
38
+ export interface AgentSessionPinnedConnectionNotMatchedPayload {
39
+ readonly pinned: {
40
+ readonly integration_id: string;
41
+ readonly connection_id: string;
42
+ readonly candidates: AgentSessionConnectionCandidateReport[];
43
+ }[];
44
+ }
@@ -0,0 +1,28 @@
1
+ import type { ApiEndpoint, ApiError } from '../api.js';
2
+ export type AgentSessionMcpErrorCode = 'session_not_found';
3
+ export type PostAgentSessionMcp = ApiEndpoint<{
4
+ Audit: {
5
+ kind: 'no-audit';
6
+ reason: 'TODO: audit coverage pending';
7
+ };
8
+ Method: 'POST';
9
+ Path: '/session/:sessionId/mcp';
10
+ Params: {
11
+ sessionId: string;
12
+ };
13
+ Body: Record<string, unknown>;
14
+ Success: Record<string, unknown>;
15
+ Error: ApiError<AgentSessionMcpErrorCode>;
16
+ }>;
17
+ export type GetAgentSessionMcp = ApiEndpoint<{
18
+ Audit: {
19
+ kind: 'no-audit';
20
+ reason: 'non-auditable';
21
+ };
22
+ Method: 'GET';
23
+ Path: '/session/:sessionId/mcp';
24
+ Params: {
25
+ sessionId: string;
26
+ };
27
+ Success: Record<string, unknown>;
28
+ }>;
@@ -0,0 +1,20 @@
1
+ import type { AgentSessionResolvedConnections } from './connections.js';
2
+ import type { AgentSessionCompiledToolset } from './toolset.js';
3
+ export interface AgentSessionMetaTools {
4
+ readonly nangoToolSearch: boolean;
5
+ readonly nangoExecute: boolean;
6
+ }
7
+ export type AgentSessionEndedReason = 'terminated' | 'expired';
8
+ export interface AgentSession {
9
+ readonly id: string;
10
+ readonly environmentId: number;
11
+ readonly accountId: number;
12
+ readonly resolvedConnections: AgentSessionResolvedConnections;
13
+ readonly compiledToolset: AgentSessionCompiledToolset;
14
+ readonly metaTools: AgentSessionMetaTools;
15
+ readonly expiresAt: Date;
16
+ readonly endedAt: Date | null;
17
+ readonly endedReason: AgentSessionEndedReason | null;
18
+ readonly createdAt: Date;
19
+ readonly updatedAt: Date;
20
+ }
@@ -0,0 +1,34 @@
1
+ import type { JSONSchema7 } from 'json-schema';
2
+ export type AgentSessionToolConnectionState = {
3
+ readonly status: 'connected';
4
+ readonly connection_id: string;
5
+ } | {
6
+ readonly status: 'not_connected';
7
+ };
8
+ /** `schema` carries the arguments, `none` means there are none, `unavailable` means they could not be read. */
9
+ export type AgentSessionToolInput = {
10
+ readonly kind: 'schema';
11
+ readonly schema: JSONSchema7;
12
+ } | {
13
+ readonly kind: 'none';
14
+ } | {
15
+ readonly kind: 'unavailable';
16
+ };
17
+ export interface AgentSessionToolMatch {
18
+ /** What to pass to nango_execute. Names are sanitised and clipped, so use it as given. */
19
+ readonly tool: string;
20
+ readonly integration: string;
21
+ readonly action: string;
22
+ readonly provider: string;
23
+ readonly description: string;
24
+ /** Whether the tool is in the agent's tool list, under the same name. */
25
+ readonly listed: boolean;
26
+ readonly connection: AgentSessionToolConnectionState;
27
+ /** Only on a best match. A soft match is a lead to narrow down, not something to call yet. */
28
+ readonly input?: AgentSessionToolInput;
29
+ }
30
+ export interface AgentSessionToolSearchResult {
31
+ readonly guidance: string;
32
+ readonly matches: AgentSessionToolMatch[];
33
+ readonly related: AgentSessionToolMatch[];
34
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * `allow` absent means every tool on the integration. `allow` present makes the
3
+ * integration an allowlist. `deny` always subtracts from whatever `allow` gave.
4
+ */
5
+ export interface AgentSessionIntegrationPolicy {
6
+ readonly allow: '*' | readonly string[];
7
+ readonly deny: readonly string[];
8
+ }
9
+ export type AgentSessionToolsetPolicy = '*' | Readonly<Record<string, AgentSessionIntegrationPolicy>>;
10
+ export type AgentSessionPinnedTools = Readonly<Record<string, readonly string[]>>;
11
+ export interface AgentSessionCompiledTool {
12
+ readonly name: string;
13
+ readonly description: string;
14
+ }
15
+ export interface AgentSessionCompiledIntegration {
16
+ readonly provider: string;
17
+ readonly pinned: AgentSessionCompiledTool[];
18
+ readonly searchable: AgentSessionCompiledTool[];
19
+ }
20
+ export type AgentSessionCompiledToolset = Record<string, AgentSessionCompiledIntegration>;
21
+ export type AgentSessionToolsetCompilationErrorCode = 'unknown_integration' | 'unknown_tool' | 'unsupported_function_type' | 'tool_not_in_toolset';
22
+ export interface AgentSessionUnknownIntegrationsPayload {
23
+ readonly integrations: string[];
24
+ }
25
+ export interface AgentSessionUnknownToolsPayload {
26
+ readonly tools: {
27
+ readonly integration_id: string;
28
+ readonly tool: string;
29
+ }[];
30
+ }
31
+ export interface AgentSessionUnsupportedFunctionTypesPayload {
32
+ readonly tools: {
33
+ readonly integration_id: string;
34
+ readonly tool: string;
35
+ readonly type: string;
36
+ }[];
37
+ }
38
+ export interface AgentSessionToolsNotInToolsetPayload {
39
+ readonly pinned: {
40
+ readonly integration_id: string;
41
+ readonly tool: string;
42
+ }[];
43
+ }
@@ -23,6 +23,8 @@ export interface ApiKeyAuthDetails {
23
23
  source: Exclude<ApiKeyAuthSource, 'connect_session'>;
24
24
  scopes?: string[];
25
25
  apiKeyId?: number;
26
+ /** Public identifier of a customer key; absent for the other auth sources, which have no key row. */
27
+ apiKeyUuid?: string;
26
28
  apiKeyDisplayName?: string;
27
29
  purpose?: 'dryrun' | 'deploy';
28
30
  dryrunId?: string;
@@ -1,5 +1,10 @@
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:logs:read", "environment:actions:execute", "environment:actions:*", "environment:proxy", "environment:variables:read", "environment:mcp"];
2
- export type ApiKeyScope = (typeof API_KEY_SCOPES)[number];
3
- export declare const ACCOUNT_API_KEY_SCOPES: readonly ["account:*", "account:billing:read", "account:team:invite_member"];
4
- export type AccountApiKeyScope = (typeof ACCOUNT_API_KEY_SCOPES)[number];
1
+ /** Every wildcard in a namespace: `environment:*`, `environment:connections:*`, … */
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: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"];
4
+ export type ConcreteApiKeyScope = (typeof API_KEY_SCOPES)[number];
5
+ /** A scope, or a wildcard over scopes. Which wildcards resolve to something is checked at runtime. */
6
+ export type ApiKeyScope = ConcreteApiKeyScope | WildcardsFor<'environment'>;
7
+ export declare const ACCOUNT_API_KEY_SCOPES: readonly ["account:environments:create", "account:environments:delete", "account:environments:set_production", "account:environments:api_keys:create", "account:environments:api_keys:delete"];
8
+ export type ConcreteAccountApiKeyScope = (typeof ACCOUNT_API_KEY_SCOPES)[number];
9
+ export type AccountApiKeyScope = ConcreteAccountApiKeyScope | WildcardsFor<'account'>;
5
10
  export type CustomerKeyScope = ApiKeyScope | AccountApiKeyScope;
@@ -1,8 +1,10 @@
1
- import type { ConfirmEmail, GetEmailByExpiredToken, GetEmailByUuid, GetManagedCallback, GetManagedEmailVerification, GetOnboardingAccountDiscovery, PostForgotPassword, PostLogout, PostManagedEmailVerification, PostManagedSignup, PostOnboardingRequestInvite, PostSignin, PostSignup, PutResetPassword } from './account/api.js';
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
2
  import type { GetAsyncActionResult, GetPublicV1, PostInternalTriggerFunction, PostPublicTriggerAction } from './action/api.js';
3
3
  import type { PostImpersonate } from './admin/http.api.js';
4
+ import type { PostAgentSessions } from './agent/api.js';
5
+ import type { GetAgentSessionMcp, PostAgentSessionMcp } from './agent/mcp.api.js';
4
6
  import type { EndpointMethod } from './api.js';
5
- import type { GetAuditTrail } from './audit-trail/api.js';
7
+ import type { GetAuditTrail, GetAuditTrailExport } from './audit-trail/api.js';
6
8
  import type { PostPublicApiKeyAuthorization, PostPublicAwsSigV4Authorization, PostPublicBasicAuthorization, PostPublicBillAuthorization, PostPublicJwtAuthorization, PostPublicOauthOutboundAuthorization, PostPublicSignatureAuthorization, PostPublicTbaAuthorization, PostPublicTwoStepAuthorization, PostPublicUnauthenticatedAuthorization } from './auth/http.api.js';
7
9
  import type { PostCliTelemetry } from './cli/api.js';
8
10
  import type { GetPublicClientMetadata } from './clientMetadata/http.api.js';
@@ -11,11 +13,11 @@ import type { DeleteConnection, DeletePublicConnection, GetConnection, GetConnec
11
13
  import type { PostConnectionMetadata, SetMetadata, UpdateMetadata } from './connection/api/metadata.js';
12
14
  import type { GetConnectUISettings, PutConnectUISettings } from './connectUISettings/api.js';
13
15
  import type { PostDeploy, PostDeployConfirmation, PostDeployInternal } from './deploy/api.js';
14
- import type { CreateApiKey, DeleteApiKey, DeleteEnvironment, GetEnvironment, GetEnvironments, ListApiKeys, PatchApiKey, PatchEnvironment, PostEnvironment } from './environment/api/index.js';
16
+ import type { CreateApiKey, DeleteApiKey, DeleteEnvironment, DeletePublicApiKey, DeletePublicEnvironment, GetEnvironment, GetEnvironments, ListApiKeys, PatchApiKey, PatchEnvironment, PostEnvironment, PostPublicApiKey, PostPublicEnvironment, PostPublicRotateWebhookSigningKey, PostRotateWebhookSigningKey } from './environment/api/index.js';
15
17
  import type { PatchWebhook } from './environment/api/webhook.js';
16
18
  import type { PostEnvironmentVariables } from './environment/variable/api.js';
17
19
  import type { PatchFlowDisable, PatchFlowEnable, PatchFlowFrequency, PostPreBuiltDeploy, PutUpgradePreBuiltFlow } from './flow/http.api.js';
18
- import type { DeleteIntegrationFunction, DeletePublicIntegrationFunction, GetFunctionDeployment, GetFunctionDryrun, GetIntegrationFunction, GetIntegrationFunctions, GetIntegrationTemplates, GetProviderTemplates, GetPublicIntegrationFunction, GetPublicIntegrationFunctions, GetPublicProviderTemplates, PostFunctionCompile, PostFunctionDeployment, PostFunctionDeploymentBundle, PostFunctionDeploymentBundlePreview, PostFunctionDeploymentResult, PostFunctionDryrun, PostFunctionDryrunResult } from './functions/api.js';
20
+ import type { DeleteIntegrationFunction, DeletePublicIntegrationFunction, GetFunctionDeployment, GetFunctionDryrun, GetFunctionInvocation, GetIntegrationFunction, GetIntegrationFunctions, GetIntegrationTemplates, GetProviderTemplates, GetPublicIntegrationFunction, GetPublicIntegrationFunctions, GetPublicProviderTemplates, PostFunctionCompile, PostFunctionDeployment, PostFunctionDeploymentBundle, PostFunctionDeploymentBundlePreview, PostFunctionDeploymentResult, PostFunctionDryrun, PostFunctionDryrunResult, PostFunctionInvocation } from './functions/api.js';
19
21
  import type { GetGettingStarted, PatchGettingStarted } from './gettingStarted/api.js';
20
22
  import type { DeleteIntegration, DeletePublicIntegration, GetFunctionCode, GetIntegration, GetIntegrationFlows, GetPublicFunctionCode, GetPublicIntegration, GetPublicListIntegrations, PatchIntegration, PatchPublicIntegration, PostIntegration, PostPublicIntegration, PostPublicQuickstartIntegration } from './integration/api.js';
21
23
  import type { DeleteInvite, GetInvite, PostInvite } from './invitations/api.js';
@@ -23,7 +25,7 @@ import type { GetOperation, PostInsights, SearchFilters, SearchMessages, SearchO
23
25
  import type { GetMeta } from './meta/api.js';
24
26
  import type { DeleteMFA, GetMFAStatus, PostMFAActivation, PostMFAEnrollment, PostMFALoginVerification, PostMFARecoveryCodes } from './mfa/api.js';
25
27
  import type { GetPlainHmac } from './plain/api.js';
26
- import type { GetBillingUsage, GetBillingUsageTopDimensionValues, PostPlanChange, PostPlanExtendTrial, PutBillingInvoicingDetails } from './plans/http.api.js';
28
+ import type { DeleteSpendAlert, GetBillingPeriodCosts, GetBillingUsage, GetBillingUsageTopDimensionValues, GetOverdueInvoices, GetSpendAlert, GetUpcomingInvoice, PostPlanChange, PostPlanExtendTrial, PutBillingInvoicingDetails, PutSpendAlert } from './plans/http.api.js';
27
29
  import type { GetProvider, GetProviders, GetPublicProvider, GetPublicProviders } from './providers/api.js';
28
30
  import type { AllPublicProxy } from './proxy/http.api.js';
29
31
  import type { GetConnectionRecordModels, GetConnectionRecords, GetPublicRecords, PatchPublicPruneRecords } from './record/api.js';
@@ -33,8 +35,8 @@ import type { GetPublicSyncStatus, PostPublicSyncPause, PostPublicSyncStart, Pos
33
35
  import type { DeleteTeamUser, GetTeam, PatchTeamUser, PutTeam } from './team/api.js';
34
36
  import type { GetUser, PatchUser, PutUserPassword } from './user/api.js';
35
37
  import type { PostPublicWebhook } from './webhooks/http.api.js';
36
- export type PublicApiEndpoints = SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation | PostPublicTrigger | PostPublicTbaAuthorization | PostPublicJwtAuthorization | PostPublicUnauthenticatedAuthorization | PostPublicApiKeyAuthorization | PostPublicBasicAuthorization | GetPublicProviders | GetPublicProvider | GetPublicListIntegrations | GetPublicIntegration | DeletePublicIntegration | PostConnectSessions | 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 | PostFunctionDryrun | GetFunctionDryrun | PostFunctionDryrunResult | PostFunctionDeployment | GetFunctionDeployment | PostFunctionDeploymentResult | PostFunctionDeploymentBundle | PostFunctionDeploymentBundlePreview | GetPublicFunctionCode | GetPublicIntegrationFunctions | GetPublicIntegrationFunction | DeletePublicIntegrationFunction | GetPublicProviderTemplates | AllPublicProxy;
37
- export type PrivateApiEndpoints = GetAuditTrail | ConfirmEmail | 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 | GetFunctionCode | DeleteIntegrationFunction | GetIntegrationTemplates | GetProviderTemplates | DeleteIntegration | PatchIntegration | GetIntegration | PostIntegration | GetConnections | GetConnectionsCount | GetConnection | PatchConnection | PostConnectionMetadata | GetConnectionRecordModels | GetConnectionRecords | GetInvite | GetMeta | GetEmailByExpiredToken | GetEmailByUuid | GetManagedCallback | GetManagedEmailVerification | GetOnboardingAccountDiscovery | PostOnboardingRequestInvite | 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 | GetMFAStatus | PostMFAEnrollment | PostMFAActivation | PostMFARecoveryCodes | PostMFALoginVerification | DeleteMFA | GetPlainHmac;
38
+ export type PublicApiEndpoints = SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation | PostPublicTrigger | PostPublicTbaAuthorization | PostPublicJwtAuthorization | PostPublicUnauthenticatedAuthorization | PostPublicApiKeyAuthorization | PostPublicBasicAuthorization | GetPublicProviders | GetPublicProvider | GetPublicListIntegrations | GetPublicIntegration | DeletePublicIntegration | PostConnectSessions | PostAgentSessions | 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 | PostFunctionDryrun | GetFunctionDryrun | PostFunctionDryrunResult | PostFunctionDeployment | GetFunctionDeployment | PostFunctionDeploymentResult | PostFunctionInvocation | GetFunctionInvocation | PostFunctionDeploymentBundle | PostFunctionDeploymentBundlePreview | GetPublicFunctionCode | GetPublicIntegrationFunctions | GetPublicIntegrationFunction | DeletePublicIntegrationFunction | GetPublicProviderTemplates | PostPublicRotateWebhookSigningKey | AllPublicProxy | PostPublicEnvironment | DeletePublicEnvironment | PostPublicApiKey | DeletePublicApiKey;
39
+ export type PrivateApiEndpoints = GetAuditTrail | GetAuditTrailExport | ListAccountApiKeys | CreateAccountApiKey | DeleteAccountApiKey | ConfirmEmail | PostSignup | PostSignin | PostLogout | GetTeam | PutTeam | PostPlanExtendTrial | PostPlanChange | PutBillingInvoicingDetails | GetOverdueInvoices | GetBillingUsage | GetBillingUsageTopDimensionValues | GetUpcomingInvoice | GetBillingPeriodCosts | 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 | 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;
38
40
  export type APIEndpoints = PrivateApiEndpoints | PublicApiEndpoints;
39
41
  /**
40
42
  * Automatically narrow endpoints type with Method + Path
@@ -1,16 +1,17 @@
1
- import type { ApiEndpoint } from '../api.js';
2
- import type { AuditAction, AuditActor, AuditContext, AuditOutcome, AuditResource, AuditTarget, AuditTrailVersion } from './event.js';
1
+ import type { ApiEndpoint, ApiError } from '../api.js';
2
+ import type { AuditAction, AuditActor, AuditContext, AuditOutcome, AuditPolicy, AuditResource, AuditScope, AuditTarget, AuditTrailVersion, AuditVia } from './event.js';
3
3
  export interface ApiAuditTrailEvent {
4
4
  id: string;
5
5
  version: AuditTrailVersion;
6
6
  occurredAt: string;
7
7
  accountId: number;
8
+ scope: AuditScope;
8
9
  environment: {
9
- id: number;
10
+ id: string;
10
11
  display: string;
11
12
  } | null;
12
13
  actor: AuditActor;
13
- via?: AuditActor[];
14
+ via?: AuditVia[];
14
15
  targets: AuditTarget[];
15
16
  context: AuditContext;
16
17
  outcome: AuditOutcome;
@@ -19,12 +20,10 @@ export interface ApiAuditTrailEvent {
19
20
  metadata?: Record<string, unknown>;
20
21
  }
21
22
  export type GetAuditTrail = ApiEndpoint<{
22
- Audit: {
23
- kind: 'no-audit';
24
- reason: 'non-auditable';
25
- };
23
+ Audit: AuditPolicy<'audit_trail', 'queried', 'account'>;
26
24
  Method: 'GET';
27
25
  Path: '/api/v1/audit-trail';
26
+ Error: ApiError<'feature_disabled'>;
28
27
  Querystring: {
29
28
  cursor?: string;
30
29
  from?: string;
@@ -39,3 +38,17 @@ export type GetAuditTrail = ApiEndpoint<{
39
38
  };
40
39
  };
41
40
  }>;
41
+ export type AuditExportMaxRows = 50_000;
42
+ export type GetAuditTrailExport = ApiEndpoint<{
43
+ Audit: AuditPolicy<'audit_trail', 'exported', 'account'>;
44
+ Method: 'GET';
45
+ Path: '/api/v1/audit-trail/export';
46
+ Error: ApiError<'feature_disabled'>;
47
+ Querystring: {
48
+ from?: string;
49
+ to?: string;
50
+ resources?: string;
51
+ actions?: string;
52
+ };
53
+ Success: never;
54
+ }>;