@nangohq/types 0.71.6 → 0.71.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.
@@ -1,6 +1,8 @@
1
1
  import type { ApiEndpoint, ApiError } from '../api.js';
2
+ import type { AuditPolicy } from '../audit-trail/event.js';
2
3
  import type { Tags } from '../db.js';
3
4
  import type { AgentSessionUnknownPinnedConnectionsPayload } from './connections.js';
5
+ import type { AgentSessionEndedReason } from './session.js';
4
6
  import type { AgentSessionToolsNotInToolsetPayload, AgentSessionUnknownIntegrationsPayload, AgentSessionUnknownToolsPayload, AgentSessionUnsupportedFunctionTypesPayload } from './toolset.js';
5
7
  export interface AgentSessionToolListInput {
6
8
  tools: string[];
@@ -34,6 +36,7 @@ export interface AgentSessionToolsetSummary {
34
36
  export interface AgentSessionMetaToolsSummary {
35
37
  nango_tool_search: boolean;
36
38
  nango_execute: boolean;
39
+ nango_proxy: boolean;
37
40
  }
38
41
  export interface AgentSessionUnknownMetaToolsPayload {
39
42
  meta_tools: string[];
@@ -67,10 +70,7 @@ export type AgentSessionCreationErrorCode = 'ambiguous_connections' | 'unknown_p
67
70
  export type AgentSessionCreationErrorPayload = AgentSessionAmbiguousConnectionsReply | AgentSessionUnknownPinnedConnectionsPayload | AgentSessionPinnedConnectionNotMatchedReply | AgentSessionUnknownIntegrationsPayload | AgentSessionUnknownToolsPayload | AgentSessionUnsupportedFunctionTypesPayload | AgentSessionToolsNotInToolsetPayload | AgentSessionUnknownMetaToolsPayload;
68
71
  export type PostAgentSessionsCreationError = ApiError<AgentSessionCreationErrorCode, undefined, AgentSessionCreationErrorPayload>;
69
72
  export type PostAgentSessions = ApiEndpoint<{
70
- Audit: {
71
- kind: 'no-audit';
72
- reason: 'TODO: audit coverage pending';
73
- };
73
+ Audit: AuditPolicy<'agent_session', 'created', 'environment'>;
74
74
  Method: 'POST';
75
75
  Path: '/sessions';
76
76
  Body: PostAgentSessionsBody;
@@ -86,3 +86,19 @@ export type PostAgentSessions = ApiEndpoint<{
86
86
  };
87
87
  };
88
88
  }>;
89
+ export interface ApiTerminatedAgentSession {
90
+ session_id: string;
91
+ ended_at: string;
92
+ reason: AgentSessionEndedReason;
93
+ }
94
+ export type DeleteAgentSession = ApiEndpoint<{
95
+ Audit: AuditPolicy<'agent_session', 'terminated', 'environment'>;
96
+ Method: 'DELETE';
97
+ Path: '/sessions/:sessionId';
98
+ Params: {
99
+ sessionId: string;
100
+ };
101
+ Success: {
102
+ data: ApiTerminatedAgentSession;
103
+ };
104
+ }>;
@@ -18,6 +18,7 @@ export interface AgentSessionResolvedConnection {
18
18
  readonly configId: number;
19
19
  }
20
20
  export type AgentSessionResolvedConnections = Record<string, AgentSessionResolvedConnection>;
21
+ export type AgentSessionResolvedConnectionSummary = Omit<AgentSessionResolvedConnection, 'internalConnectionId' | 'configId'>;
21
22
  export type AgentSessionConnectionResolutionErrorCode = 'ambiguous_connections' | 'pinned_connection_not_matched' | 'unknown_pinned_connection';
22
23
  export interface AgentSessionConnectionCandidateReport {
23
24
  readonly connection_id: string;
@@ -3,6 +3,7 @@ import type { AgentSessionCompiledToolset } from './toolset.js';
3
3
  export interface AgentSessionMetaTools {
4
4
  readonly nangoToolSearch: boolean;
5
5
  readonly nangoExecute: boolean;
6
+ readonly nangoProxy: boolean;
6
7
  }
7
8
  export type AgentSessionEndedReason = 'terminated' | 'expired';
8
9
  export interface AgentSession {
@@ -18,6 +18,11 @@ export interface AgentSessionCompiledIntegration {
18
18
  readonly searchable: AgentSessionCompiledTool[];
19
19
  }
20
20
  export type AgentSessionCompiledToolset = Record<string, AgentSessionCompiledIntegration>;
21
+ export interface AgentSessionToolNames {
22
+ readonly provider: string;
23
+ readonly pinned: string[];
24
+ readonly searchable: string[];
25
+ }
21
26
  export type AgentSessionToolsetCompilationErrorCode = 'unknown_integration' | 'unknown_tool' | 'unsupported_function_type' | 'tool_not_in_toolset';
22
27
  export interface AgentSessionUnknownIntegrationsPayload {
23
28
  readonly integrations: string[];
@@ -4,7 +4,7 @@ export declare const API_KEY_SCOPES: readonly ["environment:integrations:list",
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:create", "account:environments:delete", "account:environments:set_production", "account:environments:api_keys:create", "account:environments:api_keys:delete"];
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"];
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,7 +1,7 @@
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
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';
4
+ import type { DeleteAgentSession, PostAgentSessions } from './agent/api.js';
5
5
  import type { GetAgentSessionMcp, PostAgentSessionMcp } from './agent/mcp.api.js';
6
6
  import type { EndpointMethod } from './api.js';
7
7
  import type { GetAuditTrail, GetAuditTrailExport } from './audit-trail/api.js';
@@ -13,7 +13,7 @@ import type { DeleteConnection, DeletePublicConnection, GetConnection, GetConnec
13
13
  import type { PostConnectionMetadata, SetMetadata, UpdateMetadata } from './connection/api/metadata.js';
14
14
  import type { GetConnectUISettings, PutConnectUISettings } from './connectUISettings/api.js';
15
15
  import type { PostDeploy, PostDeployConfirmation, PostDeployInternal } from './deploy/api.js';
16
- import type { CreateApiKey, DeleteApiKey, DeleteEnvironment, DeletePublicApiKey, DeletePublicEnvironment, GetEnvironment, GetEnvironments, ListApiKeys, PatchApiKey, PatchEnvironment, PostEnvironment, PostPublicApiKey, PostPublicEnvironment, PostPublicRotateWebhookSigningKey, PostRotateWebhookSigningKey } from './environment/api/index.js';
16
+ 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
17
  import type { PatchWebhook } from './environment/api/webhook.js';
18
18
  import type { PostEnvironmentVariables } from './environment/variable/api.js';
19
19
  import type { PatchFlowDisable, PatchFlowEnable, PatchFlowFrequency, PostPreBuiltDeploy, PutUpgradePreBuiltFlow } from './flow/http.api.js';
@@ -25,18 +25,18 @@ import type { GetOperation, PostInsights, SearchFilters, SearchMessages, SearchO
25
25
  import type { GetMeta } from './meta/api.js';
26
26
  import type { DeleteMFA, GetMFAStatus, PostMFAActivation, PostMFAEnrollment, PostMFALoginVerification, PostMFARecoveryCodes } from './mfa/api.js';
27
27
  import type { GetPlainHmac } from './plain/api.js';
28
- import type { DeleteSpendAlert, GetBillingPeriodCosts, GetBillingUsage, GetBillingUsageTopDimensionValues, GetOverdueInvoices, GetSpendAlert, GetUpcomingInvoice, PostPlanChange, PostPlanExtendTrial, PutBillingInvoicingDetails, PutSpendAlert } from './plans/http.api.js';
28
+ import type { DeleteSpendAlert, GetBillingPeriodCosts, GetBillingUsage, GetBillingUsageTopDimensionValues, GetOverdueInvoices, GetProjectedCosts, GetSpendAlert, GetUpcomingInvoice, PostPlanChange, PostPlanExtendTrial, PutBillingInvoicingDetails, PutSpendAlert } from './plans/http.api.js';
29
29
  import type { GetProvider, GetProviders, GetPublicProvider, GetPublicProviders } from './providers/api.js';
30
30
  import type { AllPublicProxy } from './proxy/http.api.js';
31
31
  import type { GetConnectionRecordModels, GetConnectionRecords, GetPublicRecords, PatchPublicPruneRecords } from './record/api.js';
32
32
  import type { GetPublicScriptsConfig } from './scripts/http.api.js';
33
33
  import type { GetSharedCredentialsProvider, GetSharedCredentialsProviders, PatchSharedCredentialsProvider, PostSharedCredentialsProvider } from './sharedCredentials/api.js';
34
- import type { GetPublicSyncStatus, PostPublicSyncPause, PostPublicSyncStart, PostPublicTrigger, PutPublicSyncConnectionFrequency } from './sync/api.js';
34
+ import type { GetConnectionSyncs, GetPublicSyncStatus, PostPublicSyncPause, PostPublicSyncStart, PostPublicTrigger, PutPublicSyncConnectionFrequency } from './sync/api.js';
35
35
  import type { DeleteTeamUser, GetTeam, PatchTeamUser, PutTeam } from './team/api.js';
36
36
  import type { GetUser, PatchUser, PutUserPassword } from './user/api.js';
37
37
  import type { PostPublicWebhook } from './webhooks/http.api.js';
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
+ 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 | PostFunctionDryrun | GetFunctionDryrun | PostFunctionDryrunResult | PostFunctionDeployment | GetFunctionDeployment | PostFunctionDeploymentResult | PostFunctionInvocation | GetFunctionInvocation | PostFunctionDeploymentBundle | PostFunctionDeploymentBundlePreview | GetPublicFunctionCode | GetPublicIntegrationFunctions | GetPublicIntegrationFunction | DeletePublicIntegrationFunction | GetPublicProviderTemplates | PostPublicRotateWebhookSigningKey | AllPublicProxy | PostPublicEnvironment | DeletePublicEnvironment | GetPublicEnvironments | GetPublicApiKey | GetPublicApiKeys | 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 | 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;
40
40
  export type APIEndpoints = PrivateApiEndpoints | PublicApiEndpoints;
41
41
  /**
42
42
  * Automatically narrow endpoints type with Method + Path
@@ -30,14 +30,28 @@ export type GetAuditTrail = ApiEndpoint<{
30
30
  to?: string;
31
31
  resources?: string;
32
32
  actions?: string;
33
+ showTotal?: boolean | undefined;
33
34
  };
34
35
  Success: {
35
36
  data: ApiAuditTrailEvent[];
37
+ total?: AuditTrailTotal;
36
38
  pagination: {
37
39
  nextCursor: string | null;
38
40
  };
39
41
  };
40
42
  }>;
43
+ /**
44
+ * How many events the filters match, not how many the page holds. Absent unless `showTotal` was
45
+ * asked for, and when the count failed.
46
+ *
47
+ * The read is bounded, so `relation` says whether `value` is the answer or a floor — `gte` means the
48
+ * account has at least this many and the count stopped looking. Shaped after Elasticsearch's `hits.total`
49
+ * so a caller cannot read the number without seeing which it is.
50
+ */
51
+ export interface AuditTrailTotal {
52
+ value: number;
53
+ relation: 'eq' | 'gte';
54
+ }
41
55
  export type AuditExportMaxRows = 50_000;
42
56
  export type GetAuditTrailExport = ApiEndpoint<{
43
57
  Audit: AuditPolicy<'audit_trail', 'exported', 'account'>;
@@ -1,4 +1,4 @@
1
- import type { ApiKeyUpdatedMetadata, AppAuthLoginMetadata, AuditTrailFiltersMetadata, AuditTrailQueriedMetadata, BillingPaymentMethodRemovedMetadata, BillingPlanChangedMetadata, BillingSpendAlertChangedMetadata, ConnectionMetadata, ConnectionUpdatedMetadata, EnvironmentCreatedMetadata, EnvironmentUpdatedMetadata, EnvironmentVariablesChangedMetadata, EnvironmentWebhookMetadata, FunctionDeletedMetadata, FunctionDeployedMetadata, FunctionUpgradedMetadata, IntegrationProviderMetadata, IntegrationUpdatedMetadata, MemberInvitedMetadata, MemberRoleChangedMetadata, MfaVerifiedMetadata, SyncBaseMetadata, SyncFrequencyChangedMetadata, SyncTriggeredMetadata, SyncVariantMetadata, TeamUpdatedMetadata, UserUpdatedMetadata } from './metadata.js';
1
+ import type { AgentSessionCreatedMetadata, ApiKeyUpdatedMetadata, AppAuthLoginMetadata, AuditTrailFiltersMetadata, AuditTrailQueriedMetadata, BillingPaymentMethodRemovedMetadata, BillingPlanChangedMetadata, BillingSpendAlertChangedMetadata, ConnectionMetadata, ConnectionUpdatedMetadata, EnvironmentCreatedMetadata, EnvironmentUpdatedMetadata, EnvironmentVariablesChangedMetadata, EnvironmentWebhookMetadata, FunctionDeletedMetadata, FunctionDeployedMetadata, FunctionUpgradedMetadata, IntegrationProviderMetadata, IntegrationUpdatedMetadata, MemberInvitedMetadata, MemberRoleChangedMetadata, MfaVerifiedMetadata, SyncBaseMetadata, SyncFrequencyChangedMetadata, SyncTriggeredMetadata, SyncVariantMetadata, TeamUpdatedMetadata, UserUpdatedMetadata } from './metadata.js';
2
2
  export type AuditTrailVersion = '2026-07-16';
3
3
  export type AuditActorType = 'user' | 'api_key' | 'public_key' | 'connect_session' | 'anonymous' | 'unknown';
4
4
  export type AuditOutcome = 'success' | 'failure' | 'denied';
@@ -87,6 +87,10 @@ interface AuditEventTable {
87
87
  exported: AuditTrailFiltersMetadata;
88
88
  queried: AuditTrailQueriedMetadata;
89
89
  };
90
+ agent_session: {
91
+ created: AgentSessionCreatedMetadata;
92
+ terminated: never;
93
+ };
90
94
  }
91
95
  export type AuditResource = keyof AuditEventTable;
92
96
  export type AuditActionOf<R extends AuditResource> = R extends AuditResource ? keyof AuditEventTable[R] & string : never;
@@ -97,7 +101,7 @@ export type AuditEventKey = {
97
101
  /** The metadata an action may carry. `never` for the actions that carry none. */
98
102
  export type AuditMetadataFor<R extends AuditResource, A> = A extends keyof AuditEventTable[R] ? AuditEventTable[R][A] : never;
99
103
  export type AuditScope = 'account' | 'environment';
100
- export type AuditTargetType = 'connection' | 'sync' | 'function' | 'integration' | 'api_key' | 'member' | 'team' | 'user' | 'environment';
104
+ export type AuditTargetType = 'connection' | 'sync' | 'function' | 'integration' | 'api_key' | 'member' | 'team' | 'user' | 'environment' | 'agent_session';
101
105
  export interface AuditActor {
102
106
  type: AuditActorType;
103
107
  id: string;
@@ -97,3 +97,6 @@ export interface MfaVerifiedMetadata {
97
97
  export interface BillingSpendAlertChangedMetadata {
98
98
  thresholdInCents?: number;
99
99
  }
100
+ export interface AgentSessionCreatedMetadata {
101
+ expiresAt?: string;
102
+ }
@@ -2,15 +2,17 @@ import type { Result } from '../result.js';
2
2
  import type { DBTeam } from '../team/db.js';
3
3
  import type { UsageMetric } from '../usage/index.js';
4
4
  export interface BillingClient {
5
- ingest: (events: BillingEvent[]) => Promise<Result<void>>;
6
5
  linkStripeToCustomer(teamId: number, customerId: string): Promise<Result<void>>;
7
6
  getOrCreateCustomer: (accountId: number, defaultTo: Pick<BillingInvoicingDetails, 'legalEntityName' | 'email'>) => Promise<Result<BillingCustomer>>;
8
7
  getCustomer: (accountId: number) => Promise<Result<BillingCustomer>>;
9
8
  putCustomer: (accountId: number, invoicingDetails: BillingInvoicingDetails) => Promise<Result<BillingCustomer>>;
10
- getSubscription: (accountId: number) => Promise<Result<BillingSubscription | null>>;
9
+ getSubscription: (accountId: number) => Promise<Result<BillingSubscription>>;
11
10
  getOverdueInvoices: (accountId: number) => Promise<Result<BillingOverdueInvoices>>;
12
11
  getUpcomingInvoice: (subscriptionId: string) => Promise<Result<BillingUpcomingInvoice | null>>;
13
- getPeriodCosts: (subscriptionId: string) => Promise<Result<BillingPeriodCosts | null>>;
12
+ getPeriodCosts: (subscriptionId: string, timeframe?: {
13
+ start: Date;
14
+ end: Date;
15
+ }) => Promise<Result<BillingPeriodCosts | null>>;
14
16
  getSpendAlert: (subscriptionId: string) => Promise<Result<BillingSpendAlert | null>>;
15
17
  setSpendAlert: (subscriptionId: string, opts: {
16
18
  thresholdInCents: number;
@@ -18,17 +20,22 @@ export interface BillingClient {
18
20
  removeSpendAlert: (subscriptionId: string) => Promise<Result<void>>;
19
21
  createSubscription: (team: DBTeam, planExternalId: string) => Promise<Result<BillingSubscription>>;
20
22
  getUsage: (subscriptionId: string, opts?: GetBillingUsageOpts) => Promise<Result<BillingUsageMetrics>>;
21
- upgrade: (opts: {
22
- subscriptionId: string;
23
- planExternalId: string;
24
- }) => Promise<Result<{
23
+ upgrade: (opts: PlanChangeRequest) => Promise<Result<{
25
24
  pendingChangeId: string;
26
25
  amountInCents: number | null;
27
26
  }>>;
28
- downgrade: (opts: {
27
+ downgrade: (opts: PlanChangeRequest) => Promise<Result<void>>;
28
+ startGrowthAddon: (opts: {
29
29
  subscriptionId: string;
30
- planExternalId: string;
31
- }) => Promise<Result<void>>;
30
+ }) => Promise<Result<{
31
+ priceIntervalId: string | null;
32
+ }>>;
33
+ endGrowthAddon: (opts: {
34
+ subscriptionId: string;
35
+ priceIntervalId: string;
36
+ }) => Promise<Result<{
37
+ growthFeaturesEndsAt: Date | null;
38
+ }>>;
32
39
  applyPendingChanges: (opts: {
33
40
  pendingChangeId: string;
34
41
  /**
@@ -49,6 +56,10 @@ export interface BillingClient {
49
56
  verifyWebhookSignature(body: string, headers: Record<string, unknown>, secret: string): Result<true>;
50
57
  getPlanById(planId: string): Promise<Result<BillingPlan>>;
51
58
  }
59
+ export interface PlanChangeRequest {
60
+ subscriptionId: string;
61
+ planExternalId: string;
62
+ }
52
63
  export interface BillingCustomer {
53
64
  id: string;
54
65
  invoicingDetails: BillingInvoicingDetails;
@@ -78,6 +89,13 @@ export interface BillingSubscription {
78
89
  id: string;
79
90
  pendingChangeId?: string | undefined;
80
91
  planExternalId: string;
92
+ hasGrowthFeatures: boolean;
93
+ growthFeaturesEndsAt: Date | null;
94
+ /** Orb's price interval is the allocation of a price for a given time period.
95
+ * The Growth add-on is an external price that gets attached to the plan, so we must parse
96
+ * its interval in order to know whether there's a scheduled operation in the future.
97
+ */
98
+ growthFeaturesPriceIntervalId: string | null;
81
99
  }
82
100
  export interface BillingOverdueInvoices {
83
101
  hasOverdue: boolean;
@@ -113,6 +131,7 @@ export interface BillingPeriodCosts {
113
131
  metric: UsageMetric | null;
114
132
  amountInCents: number | null;
115
133
  }[];
134
+ fixedInCents: number;
116
135
  currency: string;
117
136
  }
118
137
  export type CounterUsageMetric = Exclude<UsageMetric, 'records' | 'connections'>;
@@ -221,73 +240,3 @@ export interface BillingPlan {
221
240
  id: string;
222
241
  external_plan_id: string;
223
242
  }
224
- type BillingPropertyValue = string | number | boolean | Date | undefined;
225
- type BillingProperties = Record<string, BillingPropertyValue | Record<string, BillingPropertyValue>>;
226
- interface BillingEventBase<TType extends string, TProperties extends BillingProperties = BillingProperties> {
227
- type: TType;
228
- properties: {
229
- timestamp: Date;
230
- idempotencyKey?: string | undefined;
231
- accountId: number;
232
- count: number;
233
- } & TProperties;
234
- }
235
- export type MarBillingEvent = BillingEventBase<'monthly_active_records', {
236
- environmentId: number;
237
- environmentName: string;
238
- integrationId: string;
239
- syncId: string;
240
- model: string;
241
- }>;
242
- export type RecordsBillingEvent = BillingEventBase<'records', {
243
- frequencyMs: number;
244
- telemetry: {
245
- sizeBytes: number;
246
- };
247
- }>;
248
- export type ActionsBillingEvent = BillingEventBase<'billable_actions', {
249
- environmentId: number;
250
- environmentName: string;
251
- integrationId: string;
252
- actionName: string;
253
- }>;
254
- export type FunctionExecutionsBillingEvent = BillingEventBase<'function_executions', {
255
- environmentId: number;
256
- environmentName: string;
257
- integrationId: string;
258
- type: string;
259
- functionName: string;
260
- telemetry: {
261
- successes: number;
262
- failures: number;
263
- durationMs: number;
264
- compute: number;
265
- customLogs: number;
266
- proxyCalls: number;
267
- };
268
- frequencyMs?: number | undefined;
269
- }>;
270
- export type ProxyBillingEvent = BillingEventBase<'proxy', {
271
- environmentId: number;
272
- environmentName: string;
273
- integrationId: string;
274
- telemetry: {
275
- successes: number;
276
- failures: number;
277
- };
278
- }>;
279
- export type WebhookForwardBillingEvent = BillingEventBase<'webhook_forwards', {
280
- environmentId: number;
281
- environmentName: string;
282
- integrationId: string;
283
- telemetry: {
284
- successes: number;
285
- failures: number;
286
- };
287
- }>;
288
- export type ConnectionsBillingEvent = BillingEventBase<'billable_connections'>;
289
- export type ConnectionsBillingEventV2 = BillingEventBase<'billable_connections_v2', {
290
- frequencyMs: number;
291
- }>;
292
- export type BillingEvent = MarBillingEvent | RecordsBillingEvent | ActionsBillingEvent | ProxyBillingEvent | WebhookForwardBillingEvent | FunctionExecutionsBillingEvent | ConnectionsBillingEvent | ConnectionsBillingEventV2;
293
- export {};
@@ -114,8 +114,13 @@ export type PostInternalConnectSessions = ApiEndpoint<{
114
114
  };
115
115
  Method: 'POST';
116
116
  Path: '/api/v1/connect/sessions';
117
+ Querystring: {
118
+ env: string;
119
+ };
117
120
  Success: PostConnectSessions['Success'];
118
- Body: Pick<ConnectSessionInput, 'allowed_integrations' | 'end_user' | 'organization' | 'integrations_config_defaults' | 'overrides' | 'webhook_url_override'>;
121
+ Body: Pick<ConnectSessionInput, 'allowed_integrations' | 'end_user' | 'organization' | 'integrations_config_defaults' | 'overrides' | 'webhook_url_override'> & {
122
+ is_preview?: boolean | undefined;
123
+ };
119
124
  }>;
120
125
  export type PostPublicConnectTelemetry = ApiEndpoint<{
121
126
  Audit: {
@@ -20,6 +20,20 @@ export type GetEnvironments = ApiEndpoint<{
20
20
  data: Pick<DBEnvironment, 'name' | 'is_production'>[];
21
21
  };
22
22
  }>;
23
+ export type GetPublicEnvironments = ApiEndpoint<{
24
+ Audit: {
25
+ kind: 'no-audit';
26
+ reason: 'non-auditable';
27
+ };
28
+ Method: 'GET';
29
+ Path: '/environments';
30
+ Querystring: {
31
+ name?: string | undefined;
32
+ };
33
+ Success: {
34
+ data: Pick<DBEnvironment, 'id' | 'uuid' | 'name' | 'is_production'>[];
35
+ };
36
+ }>;
23
37
  export type PostEnvironment = ApiEndpoint<{
24
38
  Audit: AuditPolicy<'environment', 'created', 'account'>;
25
39
  Method: 'POST';
@@ -210,6 +224,53 @@ export type PostPublicApiKey = ApiEndpoint<{
210
224
  };
211
225
  Error: ApiError<'conflict' | 'resource_capped'>;
212
226
  }>;
227
+ export type GetPublicApiKeys = ApiEndpoint<{
228
+ Audit: {
229
+ kind: 'no-audit';
230
+ reason: 'non-auditable';
231
+ };
232
+ Method: 'GET';
233
+ Path: '/environments/:environmentUuid/api-keys';
234
+ Params: {
235
+ environmentUuid: string;
236
+ };
237
+ Querystring: {
238
+ display_name?: string | undefined;
239
+ };
240
+ Success: {
241
+ data: {
242
+ id: number;
243
+ uuid: string;
244
+ display_name: string;
245
+ scopes: ApiKeyScope[];
246
+ last_used_at: string | null;
247
+ created_at: string;
248
+ }[];
249
+ };
250
+ }>;
251
+ export type GetPublicApiKey = ApiEndpoint<{
252
+ Audit: {
253
+ kind: 'no-audit';
254
+ reason: 'non-auditable';
255
+ };
256
+ Method: 'GET';
257
+ Path: '/environments/:environmentUuid/api-keys/:keyUuid';
258
+ Params: {
259
+ environmentUuid: string;
260
+ keyUuid: string;
261
+ };
262
+ Success: {
263
+ data: {
264
+ id: number;
265
+ uuid: string;
266
+ display_name: string;
267
+ scopes: ApiKeyScope[];
268
+ secret: string;
269
+ last_used_at: string | null;
270
+ created_at: string;
271
+ };
272
+ };
273
+ }>;
213
274
  export type DeletePublicApiKey = ApiEndpoint<{
214
275
  Audit: AuditPolicy<'api_key', 'deleted', 'environment'>;
215
276
  Method: 'DELETE';
@@ -1,7 +1,7 @@
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, FunctionTriggerDefinition } from '../function/config.js';
4
- import type { DeployedNangoFunction, FunctionType, NangoActionFunction, NangoFunctionTemplate, NangoSyncFunction } from './domain.js';
4
+ import type { FunctionType, ListedNangoFunction, NangoActionFunction, NangoFunctionTemplate, NangoSyncFunction } from './domain.js';
5
5
  import type { JSONSchema7 } from 'json-schema';
6
6
  export type RunnableFunctionType = Extract<FunctionType, 'action' | 'sync'>;
7
7
  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';
@@ -262,15 +262,15 @@ export interface FunctionListFilters {
262
262
  limit?: number;
263
263
  }
264
264
  export interface FunctionListSuccess {
265
- data: DeployedNangoFunction[];
265
+ data: ListedNangoFunction[];
266
266
  pagination: {
267
267
  total: number;
268
268
  page: number;
269
269
  limit: number;
270
270
  };
271
271
  }
272
- export interface DeployedFunctionSuccess {
273
- data: DeployedNangoFunction;
272
+ export interface ListedFunctionSuccess {
273
+ data: ListedNangoFunction;
274
274
  }
275
275
  export interface FunctionDeletionSuccess {
276
276
  data: {
@@ -310,7 +310,7 @@ export type GetIntegrationFunction = ApiEndpoint<{
310
310
  providerConfigKey: string;
311
311
  functionName: string;
312
312
  };
313
- Success: DeployedFunctionSuccess;
313
+ Success: ListedFunctionSuccess;
314
314
  }>;
315
315
  export type DeleteIntegrationFunction = ApiEndpoint<{
316
316
  Audit: AuditPolicy<'function', 'deleted', 'environment'>;
@@ -370,7 +370,7 @@ export type GetPublicIntegrationFunction = ApiEndpoint<{
370
370
  uniqueKey: string;
371
371
  name: string;
372
372
  };
373
- Success: DeployedFunctionSuccess;
373
+ Success: ListedFunctionSuccess;
374
374
  }>;
375
375
  export type DeletePublicIntegrationFunction = ApiEndpoint<{
376
376
  Audit: AuditPolicy<'function', 'deleted', 'environment'>;
@@ -28,18 +28,18 @@ export interface NangoOnEventFunction extends NangoFunctionBase {
28
28
  event: OnEventType;
29
29
  }
30
30
  export type NangoFunction = NangoSyncFunction | NangoActionFunction | NangoOnEventFunction;
31
- export interface DeployedMeta {
31
+ export interface FunctionAvailability {
32
32
  id: number;
33
33
  enabled: boolean;
34
34
  /** ISO-8601 timestamp. */
35
35
  last_deployed: string;
36
36
  source: FunctionSource;
37
37
  }
38
- export type DeployedNangoSyncFunction = NangoSyncFunction & DeployedMeta;
39
- export type DeployedNangoActionFunction = NangoActionFunction & DeployedMeta;
40
- export type DeployedNangoOnEventFunction = NangoOnEventFunction & DeployedMeta;
41
- export type DeployedNangoFunction = DeployedNangoSyncFunction | DeployedNangoActionFunction | DeployedNangoOnEventFunction;
38
+ export type ListedNangoSyncFunction = NangoSyncFunction & FunctionAvailability;
39
+ export type ListedNangoActionFunction = NangoActionFunction & FunctionAvailability;
40
+ export type ListedNangoOnEventFunction = NangoOnEventFunction & FunctionAvailability;
41
+ export type ListedNangoFunction = ListedNangoSyncFunction | ListedNangoActionFunction | ListedNangoOnEventFunction;
42
42
  export type NangoFunctionTemplate = (NangoSyncFunction | NangoActionFunction) & {
43
- deployed?: DeployedMeta;
43
+ deployed?: FunctionAvailability;
44
44
  };
45
45
  export {};
package/dist/index.d.ts CHANGED
@@ -109,5 +109,4 @@ export type * from './function/trigger.js';
109
109
  export type * from './functions/api.js';
110
110
  export type * from './functions/domain.js';
111
111
  export type * from './lambda/index.js';
112
- export type * from './authz/types.js';
113
112
  export type * from './pubsub/events.js';
@@ -239,6 +239,7 @@ export interface MCPOAuth2GenericAuthBody {
239
239
  clientName?: string | undefined;
240
240
  clientUri?: string | undefined;
241
241
  clientLogoUri?: string | undefined;
242
+ scopes?: string | undefined;
242
243
  }
243
244
  export interface InstallPluginAuthBody {
244
245
  authType: Extract<AuthModeType, 'INSTALL_PLUGIN'>;
@@ -24,6 +24,7 @@ export type SearchOperations = ApiEndpoint<{
24
24
  integrations?: SearchOperationsIntegration[] | undefined;
25
25
  connections?: SearchOperationsConnection[] | undefined;
26
26
  syncs?: SearchOperationsSync[] | undefined;
27
+ agentSessions?: SearchOperationsAgentSession[] | undefined;
27
28
  period?: SearchPeriod | undefined;
28
29
  cursor?: string | null | undefined;
29
30
  };
@@ -40,6 +41,7 @@ export type SearchOperationsType = 'all' | ConcatOperationListWithGroup;
40
41
  export type SearchOperationsIntegration = 'all' | string;
41
42
  export type SearchOperationsConnection = 'all' | string;
42
43
  export type SearchOperationsSync = 'all' | string;
44
+ export type SearchOperationsAgentSession = 'all' | string;
43
45
  export interface SearchPeriod {
44
46
  from: string;
45
47
  to: string;
@@ -102,7 +104,7 @@ export type SearchFilters = ApiEndpoint<{
102
104
  env: string;
103
105
  };
104
106
  Body: {
105
- category: 'integration' | 'syncConfig' | 'connection';
107
+ category: SearchFiltersCategory;
106
108
  search?: string | undefined;
107
109
  };
108
110
  Success: {
@@ -112,6 +114,7 @@ export type SearchFilters = ApiEndpoint<{
112
114
  }[];
113
115
  };
114
116
  }>;
117
+ export type SearchFiltersCategory = 'integration' | 'syncConfig' | 'connection' | 'agentSession';
115
118
  export type SearchFiltersData = SearchMessages['Success']['data'][0];
116
119
  export type PostInsights = ApiEndpoint<{
117
120
  Audit: {
@@ -58,7 +58,7 @@ export interface OperationDeploy {
58
58
  }
59
59
  export interface OperationAgentSession {
60
60
  type: 'agent_session';
61
- action: 'create';
61
+ action: 'create' | 'terminate' | 'tool_search';
62
62
  }
63
63
  export type OperationList = OperationFunction | OperationSync | OperationProxy | OperationAction | OperationWebhook | OperationOnEvents | OperationDeploy | OperationAuth | OperationAdmin | OperationAgentSession;
64
64
  /**
@@ -1,5 +1,6 @@
1
1
  import type { ApiEndpoint, ApiError } from '../api.js';
2
2
  import type { DBEnvironment } from '../environment/db.js';
3
+ export type ApiEnvironmentSummary = Pick<DBEnvironment, 'id' | 'account_id' | 'name' | 'is_production'>;
3
4
  export type GetMeta = ApiEndpoint<{
4
5
  Audit: {
5
6
  kind: 'no-audit';
@@ -13,13 +14,12 @@ export type GetMeta = ApiEndpoint<{
13
14
  Error: ApiError<'user_not_found'>;
14
15
  Success: {
15
16
  data: {
16
- environments: Pick<DBEnvironment, 'name' | 'is_production'>[];
17
+ environments: ApiEnvironmentSummary[];
17
18
  version: string;
18
19
  baseUrl: string;
19
20
  debugMode: boolean;
20
21
  gettingStartedClosed: boolean;
21
22
  auditTrail: boolean;
22
- s26Pricing: boolean;
23
23
  };
24
24
  };
25
25
  }>;
@@ -11,6 +11,9 @@ export interface DBPlan extends Timestamps {
11
11
  orb_future_plan: string | null;
12
12
  orb_future_plan_at: Date | null;
13
13
  orb_subscribed_at: Date | null;
14
+ has_growth_features: boolean;
15
+ growth_features_starts_at: Date | null;
16
+ growth_features_ends_at: Date | null;
14
17
  trial_start_at: Date | null;
15
18
  trial_end_at: Date | null;
16
19
  trial_extension_count: number;
@@ -59,6 +62,11 @@ export interface DBPlan extends Timestamps {
59
62
  * @default null
60
63
  */
61
64
  function_logs_max: number | null;
65
+ /** Limit the amount of billable data transfer (in bytes) that can be used in a month
66
+ * Set to null to remove limit
67
+ * @default null
68
+ */
69
+ data_transfer_max: number | null;
62
70
  /**
63
71
  * Limit the number of environments that can be created
64
72
  * @default 2
@@ -29,8 +29,11 @@ export interface PlanDefinition {
29
29
  nextPlan: string[] | null;
30
30
  prevPlan: string[] | null;
31
31
  basePrice?: number;
32
+ keepsGrowthAddOnOnMigration?: boolean;
32
33
  cta?: string;
33
34
  hidden?: boolean;
35
+ /** No longer sold, but accounts already on it keep it. */
36
+ retired?: boolean;
34
37
  flags: Omit<Partial<DBPlan>, 'id' | 'account_id' | 'name'>;
35
38
  }
36
39
  export type GetPlans = ApiEndpoint<{
@@ -175,8 +178,11 @@ export type GetBillingPeriodCosts = ApiEndpoint<{
175
178
  };
176
179
  Method: 'GET';
177
180
  Path: '/api/v1/plans/billing/period-costs';
181
+ /** Omitting `from` and `to` uses the current billing period. */
178
182
  Querystring: {
179
183
  env: string;
184
+ from?: string;
185
+ to?: string;
180
186
  };
181
187
  Success: {
182
188
  data: {
@@ -186,6 +192,7 @@ export type GetBillingPeriodCosts = ApiEndpoint<{
186
192
  /** False when some usage price mapped to no metric of ours — an absent metric can't safely
187
193
  * read as $0, since the money might be one of theirs. */
188
194
  fullyAttributed: boolean;
195
+ fixedInCents: number;
189
196
  currency: string | null;
190
197
  /** True when there's no billing period to report costs for — a free plan, no linked
191
198
  * subscription, or an ended one. `metrics`/`currency` are otherwise never empty/null. */
@@ -193,6 +200,35 @@ export type GetBillingPeriodCosts = ApiEndpoint<{
193
200
  };
194
201
  };
195
202
  }>;
203
+ export type GetProjectedCosts = ApiEndpoint<{
204
+ Audit: {
205
+ kind: 'no-audit';
206
+ reason: 'non-auditable';
207
+ };
208
+ Method: 'GET';
209
+ Path: '/api/v1/plans/billing/projected-costs';
210
+ Querystring: {
211
+ env: string;
212
+ } | {
213
+ env: string;
214
+ from: string;
215
+ to: string;
216
+ };
217
+ Success: {
218
+ data: {
219
+ metrics: Partial<Record<UsageMetric, number>>;
220
+ subtotalInCents: number;
221
+ minimumInCents: number;
222
+ minimumApplied: boolean;
223
+ growthAddOnInCents: number;
224
+ totalInCents: number;
225
+ periodComplete: boolean;
226
+ currency: string;
227
+ /** True when no Pay-as-you-go migration is scheduled. */
228
+ notApplicable: boolean;
229
+ };
230
+ };
231
+ }>;
196
232
  export type GetSpendAlert = ApiEndpoint<{
197
233
  Audit: {
198
234
  kind: 'no-audit';
@@ -264,6 +300,7 @@ export type PostPlanChange = ApiEndpoint<{
264
300
  };
265
301
  Body: {
266
302
  orbId: string;
303
+ withGrowthFeatures: boolean;
267
304
  };
268
305
  Success: {
269
306
  data: {
@@ -141,6 +141,7 @@ export interface ProviderMcpOAUTH2 extends Omit<BaseProvider, 'body_format'> {
141
141
  }
142
142
  export interface ProviderMcpOAuth2Generic extends Omit<BaseProvider, 'body_format'> {
143
143
  auth_mode: 'MCP_OAUTH2_GENERIC';
144
+ mcp_server_url?: string;
144
145
  }
145
146
  export interface ProviderJwt extends BaseProvider {
146
147
  auth_mode: 'JWT';
@@ -1,6 +1,53 @@
1
1
  import type { ApiEndpoint, ApiError } from '../api.js';
2
2
  import type { AuditPolicy } from '../audit-trail/event.js';
3
- import type { ReportedSyncJobStatus } from './index.js';
3
+ import type { ReportedSyncJobStatus, SyncResultByModel, SyncStatus } from './index.js';
4
+ export interface ApiConnectionSyncJob {
5
+ created_at: string;
6
+ updated_at: string;
7
+ status: SyncStatus;
8
+ result: SyncResultByModel | null;
9
+ }
10
+ export interface ApiConnectionSync {
11
+ id: string;
12
+ name: string;
13
+ variant: string;
14
+ nango_connection_id: number;
15
+ models: string[];
16
+ frequency: string | null;
17
+ /** null when the orchestrator has no schedule for the sync, or could not be reached. */
18
+ schedule_status: 'STARTED' | 'PAUSED' | 'DELETED' | null;
19
+ status: SyncStatus;
20
+ /** Unix seconds. */
21
+ futureActionTimes: number[];
22
+ latest_sync: ApiConnectionSyncJob | null;
23
+ /** Keyed by bare model name; null when the record store could not be reached. */
24
+ record_count: Record<string, number> | null;
25
+ }
26
+ export type GetConnectionSyncs = ApiEndpoint<{
27
+ Audit: {
28
+ kind: 'no-audit';
29
+ reason: 'non-auditable';
30
+ };
31
+ Method: 'GET';
32
+ Path: '/api/v1/sync';
33
+ Querystring: {
34
+ env: string;
35
+ connection_id: string;
36
+ provider_config_key: string;
37
+ name?: string | undefined;
38
+ variant?: string | undefined;
39
+ page?: number | undefined;
40
+ limit?: number | undefined;
41
+ };
42
+ Success: {
43
+ data: ApiConnectionSync[];
44
+ pagination: {
45
+ total: number;
46
+ page: number;
47
+ limit: number;
48
+ };
49
+ };
50
+ }>;
4
51
  export type PostPublicTrigger = ApiEndpoint<{
5
52
  Audit: {
6
53
  kind: 'no-audit';
@@ -21,7 +21,6 @@ export type GetTeam = ApiEndpoint<{
21
21
  users: ApiTeamUser[];
22
22
  invitedUsers: ApiInvitation[];
23
23
  isAdminTeam: boolean;
24
- mfaFeatureEnabled: boolean;
25
24
  };
26
25
  };
27
26
  }>;
@@ -10,7 +10,7 @@ export type GetUser = ApiEndpoint<{
10
10
  Method: 'GET';
11
11
  Path: `/api/v1/user`;
12
12
  Success: {
13
- data: ApiUserWithPermissions;
13
+ data: ApiUserWithGrants;
14
14
  };
15
15
  }>;
16
16
  export type InternalGetUsers = Endpoint<{
@@ -44,10 +44,12 @@ export interface ApiUser {
44
44
  role: Role;
45
45
  gettingStartedClosed: boolean;
46
46
  }
47
- export type AllowedPermissions = Partial<Record<string, Partial<Record<'production' | 'non-production' | 'global', ('create' | 'read' | 'update' | 'delete' | '*')[]>>>>;
48
- export type ApiUserWithPermissions = ApiUser & {
49
- role: Role;
50
- permissions: AllowedPermissions;
47
+ export type ApiGrant = {
48
+ can: string[];
49
+ where: string[];
50
+ };
51
+ export type ApiUserWithGrants = ApiUser & {
52
+ grants: readonly ApiGrant[];
51
53
  hasPassword: boolean;
52
54
  };
53
55
  export type PutUserPassword = ApiEndpoint<{
@@ -1,28 +1,12 @@
1
+ import type { FunctionTrigger } from '../function/trigger.js';
1
2
  import type { JsonValue } from 'type-fest';
2
- /**
3
- * SQS message envelope for the webhook task-dispatch queue.
4
- *
5
- * The server produces one of these per (syncConfig × webhook subscription × connection)
6
- * triple resulting from an inbound provider webhook. The jobs consumer parses these and
7
- * calls the orchestrator to schedule the actual webhook task using `taskName` as the
8
- * idempotency key.
9
- */
10
- export interface WebhookDispatchMessage {
3
+ interface DispatchMessageBase {
11
4
  version: 1;
12
- kind: 'webhook';
13
- /**
14
- * Deterministic scheduler task name; used by the orchestrator as the
15
- * idempotency key so duplicate SQS deliveries resolve to the same task.
16
- */
17
- taskName: string;
18
5
  createdAt: string;
19
6
  accountId: number;
20
7
  integrationId: number;
21
8
  provider: string;
22
- parentSyncName: string;
23
- /** Webhook subscription name matched on the inbound payload; passed to executeWebhook as args.webhookName. */
24
- webhookName: string;
25
- /** Activity log id created before enqueue; reused so redelivery of this published message keeps the same taskName. */
9
+ /** Activity log created before enqueue and reused by the eventual execution. */
26
10
  activityLogId: string;
27
11
  connection: {
28
12
  id: number;
@@ -30,5 +14,41 @@ export interface WebhookDispatchMessage {
30
14
  provider_config_key: string;
31
15
  environment_id: number;
32
16
  };
17
+ }
18
+ /**
19
+ * SQS message envelope for the webhook task-dispatch queue.
20
+ *
21
+ * The server produces one of these per (syncConfig × webhook subscription × connection)
22
+ * triple resulting from an inbound provider webhook. The jobs consumer parses these and
23
+ * calls the orchestrator to schedule the legacy webhook task using `taskName` as its
24
+ * task name.
25
+ */
26
+ export interface LegacyDispatchMessage extends DispatchMessageBase {
27
+ kind: 'webhook';
28
+ /** Deterministic scheduler task name used to deduplicate queue redeliveries. */
29
+ taskName: string;
30
+ parentSyncName: string;
31
+ /** Webhook subscription name matched on the inbound payload; passed to executeWebhook as args.webhookName. */
32
+ webhookName: string;
33
33
  payload: JsonValue;
34
34
  }
35
+ export interface FunctionDispatchMessage extends DispatchMessageBase {
36
+ kind: 'function';
37
+ /** Deterministic key used to deduplicate queue redeliveries. */
38
+ idempotencyKey: string;
39
+ functionName: string;
40
+ trigger: Omit<Extract<FunctionTrigger, {
41
+ kind: 'http';
42
+ }>, 'request' | 'connection'> & {
43
+ request: Extract<FunctionTrigger, {
44
+ kind: 'http';
45
+ }>['request'];
46
+ subscriptions: string[];
47
+ connection: NonNullable<Extract<FunctionTrigger, {
48
+ kind: 'http';
49
+ }>['connection']>;
50
+ };
51
+ maxConcurrency: number;
52
+ }
53
+ export type DispatchMessage = LegacyDispatchMessage | FunctionDispatchMessage;
54
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/types",
3
- "version": "0.71.6",
3
+ "version": "0.71.8",
4
4
  "description": "Types used in Nango applications",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",
@@ -1,12 +0,0 @@
1
- import type { Role } from '../user/db.js';
2
- export type Action = 'create' | 'read' | 'update' | 'delete' | '*';
3
- export type Resource = 'team' | 'team_member' | 'invite' | 'connect_ui_settings' | 'billing' | 'plan' | 'environment' | 'environment_production_flag' | 'environment_key' | 'account_key' | 'environment_variable' | 'webhook' | 'integration' | 'connection' | 'flow' | 'sync_command' | 'secret_key' | 'connection_credential' | 'log' | 'audit_trail' | '*';
4
- export type Scope = 'production' | 'non-production' | 'global';
5
- export interface Permission {
6
- action: Action;
7
- resource: Resource;
8
- scope: Scope;
9
- }
10
- export interface PermissionEvaluator {
11
- evaluate(role: Role, permission: Permission): Promise<boolean>;
12
- }