@nangohq/types 0.71.5 → 0.71.7
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.
- package/dist/account/api.d.ts +1 -0
- package/dist/agent/api.d.ts +21 -0
- package/dist/agent/session.d.ts +1 -0
- package/dist/agent/toolSearch.d.ts +34 -0
- package/dist/api-keys/auth.d.ts +2 -0
- package/dist/api-keys/scopes.d.ts +1 -1
- package/dist/api.endpoints.d.ts +6 -6
- package/dist/audit-trail/api.d.ts +17 -2
- package/dist/audit-trail/event.d.ts +119 -16
- package/dist/audit-trail/metadata.d.ts +99 -0
- package/dist/auth/api.d.ts +1 -1
- package/dist/billing/types.d.ts +39 -90
- package/dist/connect/api.d.ts +6 -1
- package/dist/environment/api/index.d.ts +76 -10
- package/dist/environment/api/webhook.d.ts +1 -0
- package/dist/environment/db.d.ts +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/logs/messages.d.ts +2 -2
- package/dist/meta/api.d.ts +2 -1
- package/dist/plans/db.d.ts +3 -1
- package/dist/plans/http.api.d.ts +37 -0
- package/dist/providers/provider.d.ts +1 -0
- package/dist/sync/api.d.ts +48 -1
- package/dist/team/api.d.ts +0 -1
- package/dist/user/api.d.ts +7 -5
- package/dist/webhooks/api.d.ts +2 -1
- package/dist/webhooks/dispatch.d.ts +39 -19
- package/package.json +1 -1
- package/dist/authz/types.d.ts +0 -12
package/dist/account/api.d.ts
CHANGED
package/dist/agent/api.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ApiEndpoint, ApiError } from '../api.js';
|
|
2
2
|
import type { Tags } from '../db.js';
|
|
3
3
|
import type { AgentSessionUnknownPinnedConnectionsPayload } from './connections.js';
|
|
4
|
+
import type { AgentSessionEndedReason } from './session.js';
|
|
4
5
|
import type { AgentSessionToolsNotInToolsetPayload, AgentSessionUnknownIntegrationsPayload, AgentSessionUnknownToolsPayload, AgentSessionUnsupportedFunctionTypesPayload } from './toolset.js';
|
|
5
6
|
export interface AgentSessionToolListInput {
|
|
6
7
|
tools: string[];
|
|
@@ -34,6 +35,7 @@ export interface AgentSessionToolsetSummary {
|
|
|
34
35
|
export interface AgentSessionMetaToolsSummary {
|
|
35
36
|
nango_tool_search: boolean;
|
|
36
37
|
nango_execute: boolean;
|
|
38
|
+
nango_proxy: boolean;
|
|
37
39
|
}
|
|
38
40
|
export interface AgentSessionUnknownMetaToolsPayload {
|
|
39
41
|
meta_tools: string[];
|
|
@@ -86,3 +88,22 @@ export type PostAgentSessions = ApiEndpoint<{
|
|
|
86
88
|
};
|
|
87
89
|
};
|
|
88
90
|
}>;
|
|
91
|
+
export interface ApiTerminatedAgentSession {
|
|
92
|
+
session_id: string;
|
|
93
|
+
ended_at: string;
|
|
94
|
+
reason: AgentSessionEndedReason;
|
|
95
|
+
}
|
|
96
|
+
export type DeleteAgentSession = ApiEndpoint<{
|
|
97
|
+
Audit: {
|
|
98
|
+
kind: 'no-audit';
|
|
99
|
+
reason: 'TODO: audit coverage pending';
|
|
100
|
+
};
|
|
101
|
+
Method: 'DELETE';
|
|
102
|
+
Path: '/sessions/:sessionId';
|
|
103
|
+
Params: {
|
|
104
|
+
sessionId: string;
|
|
105
|
+
};
|
|
106
|
+
Success: {
|
|
107
|
+
data: ApiTerminatedAgentSession;
|
|
108
|
+
};
|
|
109
|
+
}>;
|
package/dist/agent/session.d.ts
CHANGED
|
@@ -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 {
|
|
@@ -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
|
+
}
|
package/dist/api-keys/auth.d.ts
CHANGED
|
@@ -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;
|
|
@@ -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;
|
package/dist/api.endpoints.d.ts
CHANGED
|
@@ -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
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { ApiEndpoint, ApiError } from '../api.js';
|
|
2
|
-
import type { AuditAction, AuditActor, AuditContext, AuditOutcome, AuditPolicy, AuditResource, AuditTarget, AuditTrailVersion, AuditVia } from './event.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:
|
|
10
|
+
id: string;
|
|
10
11
|
display: string;
|
|
11
12
|
} | null;
|
|
12
13
|
actor: AuditActor;
|
|
@@ -29,14 +30,28 @@ export type GetAuditTrail = ApiEndpoint<{
|
|
|
29
30
|
to?: string;
|
|
30
31
|
resources?: string;
|
|
31
32
|
actions?: string;
|
|
33
|
+
showTotal?: boolean | undefined;
|
|
32
34
|
};
|
|
33
35
|
Success: {
|
|
34
36
|
data: ApiAuditTrailEvent[];
|
|
37
|
+
total?: AuditTrailTotal;
|
|
35
38
|
pagination: {
|
|
36
39
|
nextCursor: string | null;
|
|
37
40
|
};
|
|
38
41
|
};
|
|
39
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
|
+
}
|
|
40
55
|
export type AuditExportMaxRows = 50_000;
|
|
41
56
|
export type GetAuditTrailExport = ApiEndpoint<{
|
|
42
57
|
Audit: AuditPolicy<'audit_trail', 'exported', 'account'>;
|
|
@@ -1,29 +1,101 @@
|
|
|
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
2
|
export type AuditTrailVersion = '2026-07-16';
|
|
2
|
-
export type AuditActorType = 'user' | 'api_key' | 'connect_session' | 'anonymous' | 'unknown';
|
|
3
|
+
export type AuditActorType = 'user' | 'api_key' | 'public_key' | 'connect_session' | 'anonymous' | 'unknown';
|
|
3
4
|
export type AuditOutcome = 'success' | 'failure' | 'denied';
|
|
4
5
|
export type AuditViaType = 'impersonation';
|
|
5
6
|
export type AuditInterface = 'api' | 'mcp';
|
|
6
7
|
interface AuditEventTable {
|
|
7
|
-
connection:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
connection: {
|
|
9
|
+
created: ConnectionMetadata;
|
|
10
|
+
updated: ConnectionUpdatedMetadata;
|
|
11
|
+
metadata_updated: ConnectionMetadata;
|
|
12
|
+
refreshed: ConnectionMetadata;
|
|
13
|
+
deleted: ConnectionMetadata;
|
|
14
|
+
};
|
|
15
|
+
sync: {
|
|
16
|
+
enabled: SyncBaseMetadata;
|
|
17
|
+
disabled: SyncBaseMetadata;
|
|
18
|
+
paused: SyncBaseMetadata;
|
|
19
|
+
started: SyncBaseMetadata;
|
|
20
|
+
triggered: SyncTriggeredMetadata;
|
|
21
|
+
cancelled: SyncBaseMetadata;
|
|
22
|
+
frequency_changed: SyncFrequencyChangedMetadata;
|
|
23
|
+
variant_created: SyncVariantMetadata;
|
|
24
|
+
variant_deleted: SyncVariantMetadata;
|
|
25
|
+
};
|
|
26
|
+
function: {
|
|
27
|
+
deployed: FunctionDeployedMetadata;
|
|
28
|
+
upgraded: FunctionUpgradedMetadata;
|
|
29
|
+
deleted: FunctionDeletedMetadata;
|
|
30
|
+
};
|
|
31
|
+
integration: {
|
|
32
|
+
created: IntegrationProviderMetadata;
|
|
33
|
+
updated: IntegrationProviderMetadata & IntegrationUpdatedMetadata;
|
|
34
|
+
deleted: IntegrationProviderMetadata;
|
|
35
|
+
};
|
|
36
|
+
api_key: {
|
|
37
|
+
created: ApiKeyUpdatedMetadata;
|
|
38
|
+
updated: ApiKeyUpdatedMetadata;
|
|
39
|
+
deleted: never;
|
|
40
|
+
};
|
|
41
|
+
member: {
|
|
42
|
+
invited: MemberInvitedMetadata;
|
|
43
|
+
invite_accepted: never;
|
|
44
|
+
invite_declined: never;
|
|
45
|
+
invite_revoked: never;
|
|
46
|
+
role_changed: MemberRoleChangedMetadata;
|
|
47
|
+
removed: never;
|
|
48
|
+
};
|
|
49
|
+
team: {
|
|
50
|
+
updated: TeamUpdatedMetadata;
|
|
51
|
+
};
|
|
52
|
+
user: {
|
|
53
|
+
updated: UserUpdatedMetadata;
|
|
54
|
+
};
|
|
55
|
+
environment: {
|
|
56
|
+
created: EnvironmentCreatedMetadata;
|
|
57
|
+
updated: EnvironmentUpdatedMetadata;
|
|
58
|
+
variables_changed: EnvironmentVariablesChangedMetadata;
|
|
59
|
+
webhook_urls_changed: EnvironmentWebhookMetadata;
|
|
60
|
+
webhook_signing_key_rotated: never;
|
|
61
|
+
deleted: never;
|
|
62
|
+
};
|
|
63
|
+
app_auth: {
|
|
64
|
+
login: AppAuthLoginMetadata;
|
|
65
|
+
logout: never;
|
|
66
|
+
signup: never;
|
|
67
|
+
password_changed: never;
|
|
68
|
+
password_reset: never;
|
|
69
|
+
};
|
|
70
|
+
mfa: {
|
|
71
|
+
enrolled: never;
|
|
72
|
+
enabled: never;
|
|
73
|
+
disabled: never;
|
|
74
|
+
verified: MfaVerifiedMetadata;
|
|
75
|
+
recovery_regenerated: never;
|
|
76
|
+
};
|
|
77
|
+
billing: {
|
|
78
|
+
plan_changed: BillingPlanChangedMetadata;
|
|
79
|
+
trial_extended: never;
|
|
80
|
+
details_changed: never;
|
|
81
|
+
payment_method_added: never;
|
|
82
|
+
payment_method_removed: BillingPaymentMethodRemovedMetadata;
|
|
83
|
+
spend_alert_changed: BillingSpendAlertChangedMetadata;
|
|
84
|
+
spend_alert_removed: never;
|
|
85
|
+
};
|
|
86
|
+
audit_trail: {
|
|
87
|
+
exported: AuditTrailFiltersMetadata;
|
|
88
|
+
queried: AuditTrailQueriedMetadata;
|
|
89
|
+
};
|
|
20
90
|
}
|
|
21
91
|
export type AuditResource = keyof AuditEventTable;
|
|
22
|
-
export type AuditActionOf<R extends AuditResource> = AuditEventTable[R];
|
|
92
|
+
export type AuditActionOf<R extends AuditResource> = R extends AuditResource ? keyof AuditEventTable[R] & string : never;
|
|
23
93
|
export type AuditAction = AuditActionOf<AuditResource>;
|
|
24
94
|
export type AuditEventKey = {
|
|
25
|
-
[R in AuditResource]: `${R}.${
|
|
95
|
+
[R in AuditResource]: `${R}.${AuditActionOf<R>}`;
|
|
26
96
|
}[AuditResource];
|
|
97
|
+
/** The metadata an action may carry. `never` for the actions that carry none. */
|
|
98
|
+
export type AuditMetadataFor<R extends AuditResource, A> = A extends keyof AuditEventTable[R] ? AuditEventTable[R][A] : never;
|
|
27
99
|
export type AuditScope = 'account' | 'environment';
|
|
28
100
|
export type AuditTargetType = 'connection' | 'sync' | 'function' | 'integration' | 'api_key' | 'member' | 'team' | 'user' | 'environment';
|
|
29
101
|
export interface AuditActor {
|
|
@@ -70,4 +142,35 @@ export type EndpointAudit = AuditPolicy | NoAudit<string>;
|
|
|
70
142
|
export type SerializedAuditEvent = {
|
|
71
143
|
event: string;
|
|
72
144
|
};
|
|
145
|
+
export type AuditResourceAction = {
|
|
146
|
+
[R in AuditResource]: {
|
|
147
|
+
[A in AuditActionOf<R>]: [AuditMetadataFor<R, A>] extends [never] ? {
|
|
148
|
+
resource: R;
|
|
149
|
+
action: A;
|
|
150
|
+
} : {
|
|
151
|
+
resource: R;
|
|
152
|
+
action: A;
|
|
153
|
+
metadata?: AuditMetadataFor<R, A>;
|
|
154
|
+
};
|
|
155
|
+
}[AuditActionOf<R>];
|
|
156
|
+
}[AuditResource];
|
|
157
|
+
interface AuditEventCommon {
|
|
158
|
+
occurredAt: string;
|
|
159
|
+
accountId: number;
|
|
160
|
+
scope: AuditScope;
|
|
161
|
+
environment: {
|
|
162
|
+
id: string;
|
|
163
|
+
display: string;
|
|
164
|
+
} | null;
|
|
165
|
+
actor: AuditActor;
|
|
166
|
+
via?: AuditVia[];
|
|
167
|
+
targets: AuditTarget[];
|
|
168
|
+
context: AuditContext;
|
|
169
|
+
outcome: AuditOutcome;
|
|
170
|
+
}
|
|
171
|
+
export type AuditEvent = AuditEventCommon & AuditResourceAction;
|
|
172
|
+
export type StoredAuditEvent = AuditEvent & {
|
|
173
|
+
id: string;
|
|
174
|
+
version: AuditTrailVersion;
|
|
175
|
+
};
|
|
73
176
|
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { FunctionSource } from '../syncConfigs/db.js';
|
|
2
|
+
export interface ConnectionMetadata {
|
|
3
|
+
providerConfigKey?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ConnectionUpdatedMetadata {
|
|
6
|
+
providerConfigKey?: string;
|
|
7
|
+
changedFields?: string[];
|
|
8
|
+
}
|
|
9
|
+
export interface IntegrationProviderMetadata {
|
|
10
|
+
provider?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface IntegrationUpdatedMetadata {
|
|
13
|
+
changedFields?: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface EnvironmentCreatedMetadata {
|
|
16
|
+
name?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface AuditTrailFiltersMetadata {
|
|
19
|
+
from?: string;
|
|
20
|
+
to?: string;
|
|
21
|
+
resources?: string[];
|
|
22
|
+
actions?: string[];
|
|
23
|
+
}
|
|
24
|
+
export interface AuditTrailQueriedMetadata extends AuditTrailFiltersMetadata {
|
|
25
|
+
continued?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface MemberInvitedMetadata {
|
|
28
|
+
role?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface FunctionDeployedMetadata {
|
|
31
|
+
source?: FunctionSource;
|
|
32
|
+
type?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface FunctionUpgradedMetadata {
|
|
35
|
+
upgradeVersion?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface FunctionDeletedMetadata {
|
|
38
|
+
type?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface ApiKeyUpdatedMetadata {
|
|
41
|
+
displayName?: string;
|
|
42
|
+
scopes?: string[];
|
|
43
|
+
}
|
|
44
|
+
export interface SyncBaseMetadata {
|
|
45
|
+
providerConfigKey?: string;
|
|
46
|
+
connectionId?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface SyncFrequencyChangedMetadata extends SyncBaseMetadata {
|
|
49
|
+
frequency?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface SyncVariantMetadata extends SyncBaseMetadata {
|
|
52
|
+
variant?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface SyncTriggeredMetadata extends SyncBaseMetadata {
|
|
55
|
+
reset?: boolean;
|
|
56
|
+
emptyCache?: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface MemberRoleChangedMetadata {
|
|
59
|
+
fromRole?: string;
|
|
60
|
+
toRole?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface TeamUpdatedMetadata {
|
|
63
|
+
name?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface UserUpdatedMetadata {
|
|
66
|
+
name?: string;
|
|
67
|
+
gettingStartedClosed?: boolean;
|
|
68
|
+
}
|
|
69
|
+
export interface EnvironmentUpdatedMetadata {
|
|
70
|
+
name?: string;
|
|
71
|
+
changedFields?: string[];
|
|
72
|
+
}
|
|
73
|
+
export interface EnvironmentVariablesChangedMetadata {
|
|
74
|
+
variableCount?: number;
|
|
75
|
+
variableNames?: string[];
|
|
76
|
+
}
|
|
77
|
+
export interface EnvironmentWebhookMetadata {
|
|
78
|
+
changedFields?: string[];
|
|
79
|
+
primaryUrl?: string;
|
|
80
|
+
secondaryUrl?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface BillingPlanChangedMetadata {
|
|
83
|
+
fromPlan?: string;
|
|
84
|
+
toPlan?: string;
|
|
85
|
+
}
|
|
86
|
+
export type AppAuthLoginMethod = 'local' | 'sso' | 'managed';
|
|
87
|
+
export interface AppAuthLoginMetadata {
|
|
88
|
+
mfaRequired?: boolean;
|
|
89
|
+
method?: AppAuthLoginMethod;
|
|
90
|
+
}
|
|
91
|
+
export interface BillingPaymentMethodRemovedMetadata {
|
|
92
|
+
paymentMethodId?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface MfaVerifiedMetadata {
|
|
95
|
+
method?: 'totp' | 'recovery_code';
|
|
96
|
+
}
|
|
97
|
+
export interface BillingSpendAlertChangedMetadata {
|
|
98
|
+
thresholdInCents?: number;
|
|
99
|
+
}
|
package/dist/auth/api.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface AuthModes {
|
|
|
20
20
|
AwsSigV4: 'AWS_SIGV4';
|
|
21
21
|
}
|
|
22
22
|
export type AuthModeType = AuthModes[keyof AuthModes];
|
|
23
|
-
export type AuthOperationType = 'creation' | 'override' | 'refresh' | 'unknown';
|
|
23
|
+
export type AuthOperationType = 'creation' | 'override' | 'refresh' | 'deletion' | 'unknown';
|
|
24
24
|
export interface OAuthAuthorizationMethod {
|
|
25
25
|
BODY: 'body';
|
|
26
26
|
HEADER: 'header';
|
package/dist/billing/types.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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,30 +20,35 @@ 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
|
-
|
|
31
|
-
|
|
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
|
/**
|
|
35
|
-
*
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Amount collected via Stripe in dollars (e.g. "25.00"). Orb uses this
|
|
40
|
-
* to credit the customer the difference vs. the actual invoice amount,
|
|
41
|
-
* so overcharges (e.g. when falling back to the base fee) are corrected
|
|
42
|
-
* automatically. No credit is issued if the amounts match exactly.
|
|
42
|
+
* Payment collected up front.
|
|
43
|
+
*
|
|
44
|
+
* Omitted for a plan billed fully in arrears, where nothing is collected when the change is applied.
|
|
43
45
|
*/
|
|
44
|
-
|
|
46
|
+
payment?: {
|
|
47
|
+
/** The external payment ID; for Stripe, it's the PaymentIntent ID. */
|
|
48
|
+
externalId: string;
|
|
49
|
+
/** Amount collected in dollars. */
|
|
50
|
+
amountCollected: string;
|
|
51
|
+
} | undefined;
|
|
45
52
|
}) => Promise<Result<BillingSubscription>>;
|
|
46
53
|
cancelPendingChanges: (opts: {
|
|
47
54
|
pendingChangeId: string;
|
|
@@ -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'>;
|
|
@@ -126,7 +145,7 @@ export interface BreakdownDimensions {
|
|
|
126
145
|
webhook_forwards: 'environment_id' | 'integration_id' | 'connection_id' | 'success';
|
|
127
146
|
records: 'environment_id' | 'integration_id' | 'connection_id' | 'model';
|
|
128
147
|
connections: 'environment_id' | 'integration_id';
|
|
129
|
-
data_transfer: 'environment_id' | 'integration_id' | 'connection_id' | '
|
|
148
|
+
data_transfer: 'environment_id' | 'integration_id' | 'connection_id' | 'source';
|
|
130
149
|
}
|
|
131
150
|
export type DimensionFor<M extends UsageMetric> = 'none' | BreakdownDimensions[M];
|
|
132
151
|
export interface GetBillingUsageOpts {
|
|
@@ -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 {};
|
package/dist/connect/api.d.ts
CHANGED
|
@@ -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';
|
|
@@ -28,7 +42,7 @@ export type PostEnvironment = ApiEndpoint<{
|
|
|
28
42
|
name: string;
|
|
29
43
|
};
|
|
30
44
|
Success: {
|
|
31
|
-
data: Pick<DBEnvironment, 'id' | 'name'>;
|
|
45
|
+
data: Pick<DBEnvironment, 'id' | 'uuid' | 'name'>;
|
|
32
46
|
};
|
|
33
47
|
Error: ApiError<'conflict' | 'resource_capped' | 'invalid_is_prod_flag'>;
|
|
34
48
|
}>;
|
|
@@ -50,16 +64,16 @@ export type PostPublicEnvironment = ApiEndpoint<{
|
|
|
50
64
|
}[] | undefined;
|
|
51
65
|
};
|
|
52
66
|
Success: {
|
|
53
|
-
data: Pick<DBEnvironment, 'id' | 'name'>;
|
|
67
|
+
data: Pick<DBEnvironment, 'id' | 'uuid' | 'name'>;
|
|
54
68
|
};
|
|
55
69
|
Error: ApiError<'conflict' | 'resource_capped' | 'invalid_is_prod_flag'>;
|
|
56
70
|
}>;
|
|
57
71
|
export type DeletePublicEnvironment = ApiEndpoint<{
|
|
58
72
|
Audit: AuditPolicy<'environment', 'deleted', 'account'>;
|
|
59
73
|
Method: 'DELETE';
|
|
60
|
-
Path: '/environments/:
|
|
74
|
+
Path: '/environments/:environmentUuid';
|
|
61
75
|
Params: {
|
|
62
|
-
|
|
76
|
+
environmentUuid: string;
|
|
63
77
|
};
|
|
64
78
|
Success: never;
|
|
65
79
|
Error: ApiError<'cannot_delete_prod_environment'>;
|
|
@@ -159,6 +173,7 @@ export type ListApiKeys = ApiEndpoint<{
|
|
|
159
173
|
Success: {
|
|
160
174
|
data: {
|
|
161
175
|
id: number;
|
|
176
|
+
uuid: string;
|
|
162
177
|
display_name: string;
|
|
163
178
|
scopes: ApiKeyScope[];
|
|
164
179
|
secret: string;
|
|
@@ -178,6 +193,7 @@ export type CreateApiKey = ApiEndpoint<{
|
|
|
178
193
|
Success: {
|
|
179
194
|
data: {
|
|
180
195
|
id: number;
|
|
196
|
+
uuid: string;
|
|
181
197
|
display_name: string;
|
|
182
198
|
scopes: ApiKeyScope[];
|
|
183
199
|
secret: string;
|
|
@@ -189,14 +205,17 @@ export type CreateApiKey = ApiEndpoint<{
|
|
|
189
205
|
export type PostPublicApiKey = ApiEndpoint<{
|
|
190
206
|
Audit: AuditPolicy<'api_key', 'created', 'environment'>;
|
|
191
207
|
Method: 'POST';
|
|
192
|
-
Path: '/
|
|
208
|
+
Path: '/environments/:environmentUuid/api-keys';
|
|
209
|
+
Params: {
|
|
210
|
+
environmentUuid: string;
|
|
211
|
+
};
|
|
193
212
|
Body: {
|
|
194
|
-
environment_id: number;
|
|
195
213
|
display_name: string;
|
|
196
214
|
};
|
|
197
215
|
Success: {
|
|
198
216
|
data: {
|
|
199
217
|
id: number;
|
|
218
|
+
uuid: string;
|
|
200
219
|
display_name: string;
|
|
201
220
|
scopes: ApiKeyScope[];
|
|
202
221
|
secret: string;
|
|
@@ -205,13 +224,60 @@ export type PostPublicApiKey = ApiEndpoint<{
|
|
|
205
224
|
};
|
|
206
225
|
Error: ApiError<'conflict' | 'resource_capped'>;
|
|
207
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
|
+
}>;
|
|
208
274
|
export type DeletePublicApiKey = ApiEndpoint<{
|
|
209
275
|
Audit: AuditPolicy<'api_key', 'deleted', 'environment'>;
|
|
210
276
|
Method: 'DELETE';
|
|
211
|
-
Path: '/
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
277
|
+
Path: '/environments/:environmentUuid/api-keys/:keyUuid';
|
|
278
|
+
Params: {
|
|
279
|
+
environmentUuid: string;
|
|
280
|
+
keyUuid: string;
|
|
215
281
|
};
|
|
216
282
|
Success: {
|
|
217
283
|
success: true;
|
|
@@ -15,6 +15,7 @@ export type PatchWebhook = ApiEndpoint<{
|
|
|
15
15
|
on_auth_refresh_error?: boolean | undefined;
|
|
16
16
|
on_sync_error?: boolean | undefined;
|
|
17
17
|
on_async_action_completion?: boolean | undefined;
|
|
18
|
+
on_connection_deletion?: boolean | undefined;
|
|
18
19
|
};
|
|
19
20
|
Success: {
|
|
20
21
|
success: boolean;
|
package/dist/environment/db.d.ts
CHANGED
|
@@ -63,6 +63,7 @@ export interface DBExternalWebhook extends Timestamps {
|
|
|
63
63
|
on_auth_refresh_error: boolean;
|
|
64
64
|
on_sync_error: boolean;
|
|
65
65
|
on_async_action_completion: boolean;
|
|
66
|
+
on_connection_deletion: boolean;
|
|
66
67
|
}
|
|
67
68
|
export interface DBAPISecret extends Timestamps {
|
|
68
69
|
id: number;
|
|
@@ -77,6 +78,7 @@ export interface DBAPISecret extends Timestamps {
|
|
|
77
78
|
export type CustomerKeyType = 'api' | 'webhook_signing';
|
|
78
79
|
export interface DBCustomerKey extends Timestamps {
|
|
79
80
|
id: number;
|
|
81
|
+
uuid: string;
|
|
80
82
|
account_id: number;
|
|
81
83
|
key_type: CustomerKeyType;
|
|
82
84
|
display_name: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type * from './api.js';
|
|
|
3
3
|
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
|
+
export type * from './audit-trail/metadata.js';
|
|
6
7
|
export type * from './gettingStarted/db.js';
|
|
7
8
|
export type * from './gettingStarted/dto.js';
|
|
8
9
|
export type * from './gettingStarted/api.js';
|
|
@@ -15,6 +16,7 @@ export type * from './agent/api.js';
|
|
|
15
16
|
export type * from './agent/connections.js';
|
|
16
17
|
export type * from './agent/mcp.api.js';
|
|
17
18
|
export type * from './agent/session.js';
|
|
19
|
+
export type * from './agent/toolSearch.js';
|
|
18
20
|
export type * from './agent/toolset.js';
|
|
19
21
|
export type * from './admin/http.api.js';
|
|
20
22
|
export type * from './account/api.js';
|
|
@@ -107,5 +109,4 @@ export type * from './function/trigger.js';
|
|
|
107
109
|
export type * from './functions/api.js';
|
|
108
110
|
export type * from './functions/domain.js';
|
|
109
111
|
export type * from './lambda/index.js';
|
|
110
|
-
export type * from './authz/types.js';
|
|
111
112
|
export type * from './pubsub/events.js';
|
package/dist/logs/messages.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export interface OperationAdmin {
|
|
|
50
50
|
}
|
|
51
51
|
export interface OperationWebhook {
|
|
52
52
|
type: 'webhook';
|
|
53
|
-
action: 'incoming' | 'forward' | 'sync' | 'connection_create' | 'connection_refresh';
|
|
53
|
+
action: 'incoming' | 'forward' | 'sync' | 'connection_create' | 'connection_refresh' | 'connection_delete';
|
|
54
54
|
}
|
|
55
55
|
export interface OperationDeploy {
|
|
56
56
|
type: 'deploy';
|
|
@@ -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';
|
|
62
62
|
}
|
|
63
63
|
export type OperationList = OperationFunction | OperationSync | OperationProxy | OperationAction | OperationWebhook | OperationOnEvents | OperationDeploy | OperationAuth | OperationAdmin | OperationAgentSession;
|
|
64
64
|
/**
|
package/dist/meta/api.d.ts
CHANGED
|
@@ -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,7 +14,7 @@ export type GetMeta = ApiEndpoint<{
|
|
|
13
14
|
Error: ApiError<'user_not_found'>;
|
|
14
15
|
Success: {
|
|
15
16
|
data: {
|
|
16
|
-
environments:
|
|
17
|
+
environments: ApiEnvironmentSummary[];
|
|
17
18
|
version: string;
|
|
18
19
|
baseUrl: string;
|
|
19
20
|
debugMode: boolean;
|
package/dist/plans/db.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ type FunctionRuntime = 'runner' | 'lambda';
|
|
|
3
3
|
export interface DBPlan extends Timestamps {
|
|
4
4
|
id: number;
|
|
5
5
|
account_id: number;
|
|
6
|
-
name: 'free' | 'free-uncapped' | 'startup-deal' | 'starter-v2' | 'growth-v2' | 'enterprise' | 'enterprise-cloud-hosted' | 'starter' | 'growth' | 'starter-legacy' | 'scale-legacy' | 'growth-legacy';
|
|
6
|
+
name: 'free' | 'free-uncapped' | 'startup-deal' | 'pay-as-you-go' | 'starter-v2' | 'growth-v2' | 'enterprise' | 'enterprise-cloud-hosted' | 'starter' | 'growth' | 'starter-legacy' | 'scale-legacy' | 'growth-legacy';
|
|
7
7
|
stripe_customer_id: string | null;
|
|
8
8
|
stripe_payment_id: string | null;
|
|
9
9
|
orb_customer_id: string | null;
|
|
@@ -11,6 +11,8 @@ 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_ends_at: Date | null;
|
|
14
16
|
trial_start_at: Date | null;
|
|
15
17
|
trial_end_at: Date | null;
|
|
16
18
|
trial_extension_count: number;
|
package/dist/plans/http.api.d.ts
CHANGED
|
@@ -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: {
|
|
@@ -220,6 +220,7 @@ export interface ProviderTwoStep extends Omit<BaseProvider, 'body_format'> {
|
|
|
220
220
|
recipient?: string;
|
|
221
221
|
header?: Record<string, string>;
|
|
222
222
|
payload?: Record<string, string>;
|
|
223
|
+
singleUse?: boolean;
|
|
223
224
|
};
|
|
224
225
|
assertion_option?: Record<string, SimplifiedJSONSchema>;
|
|
225
226
|
token_expires_in_ms?: number;
|
package/dist/sync/api.d.ts
CHANGED
|
@@ -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';
|
package/dist/team/api.d.ts
CHANGED
package/dist/user/api.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type GetUser = ApiEndpoint<{
|
|
|
10
10
|
Method: 'GET';
|
|
11
11
|
Path: `/api/v1/user`;
|
|
12
12
|
Success: {
|
|
13
|
-
data:
|
|
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
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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<{
|
package/dist/webhooks/api.d.ts
CHANGED
|
@@ -39,7 +39,8 @@ export type NangoSyncWebhookBody = NangoSyncWebhookBodySuccess | NangoSyncWebhoo
|
|
|
39
39
|
export interface NangoAuthWebhookBodyBase extends NangoWebhookBase {
|
|
40
40
|
type: 'auth';
|
|
41
41
|
connectionId: string;
|
|
42
|
-
|
|
42
|
+
/** 'unknown' when the connection's integration could no longer be resolved (e.g. it was deleted). */
|
|
43
|
+
authMode: AuthModeType | 'unknown';
|
|
43
44
|
providerConfigKey: string;
|
|
44
45
|
provider: string;
|
|
45
46
|
environment: string;
|
|
@@ -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
|
-
|
|
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
package/dist/authz/types.d.ts
DELETED
|
@@ -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
|
-
}
|