@nangohq/types 0.71.3 → 0.71.5
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 +79 -6
- package/dist/action/api.d.ts +4 -0
- package/dist/admin/http.api.d.ts +1 -1
- package/dist/agent/api.d.ts +88 -0
- package/dist/agent/connections.d.ts +44 -0
- package/dist/agent/mcp.api.d.ts +28 -0
- package/dist/agent/session.d.ts +20 -0
- package/dist/agent/toolset.d.ts +43 -0
- package/dist/api-keys/auth.d.ts +38 -0
- package/dist/api-keys/scopes.d.ts +10 -3
- package/dist/api.endpoints.d.ts +9 -7
- package/dist/audit-trail/api.d.ts +21 -7
- package/dist/audit-trail/event.d.ts +22 -3
- package/dist/auth/http.api.d.ts +11 -40
- package/dist/authz/types.d.ts +1 -1
- package/dist/billing/types.d.ts +46 -0
- package/dist/connection/api/get.d.ts +1 -1
- package/dist/connection/api/metadata.d.ts +8 -2
- package/dist/environment/api/index.d.ts +86 -0
- package/dist/{functions → function}/config.d.ts +20 -13
- package/dist/function/db.d.ts +2 -3
- package/dist/function/trigger.d.ts +61 -0
- package/dist/functions/api.d.ts +103 -0
- package/dist/index.d.ts +10 -4
- package/dist/integration/api.d.ts +1 -0
- package/dist/keystore/index.d.ts +10 -2
- package/dist/logs/messages.d.ts +23 -2
- package/dist/mcp/api.d.ts +3 -3
- package/dist/mfa/api.d.ts +2 -7
- package/dist/mfa/credential.d.ts +7 -0
- package/dist/mfa/db.d.ts +1 -0
- package/dist/persist/api.d.ts +1 -1
- package/dist/plans/db.d.ts +20 -0
- package/dist/plans/http.api.d.ts +109 -0
- package/dist/pubsub/events.d.ts +2 -2
- package/dist/runner/sdk.d.ts +1 -1
- package/dist/sharedCredentials/api.d.ts +2 -0
- package/dist/sharedCredentials/db.d.ts +1 -0
- package/dist/sharedCredentials/dto.d.ts +1 -1
- package/dist/stripe/http.api.d.ts +3 -0
- package/dist/sync/api.d.ts +1 -1
- package/dist/usage/index.d.ts +1 -1
- package/dist/user/api.d.ts +5 -1
- package/dist/user/db.d.ts +2 -0
- package/dist/web/env.d.ts +3 -0
- package/package.json +1 -1
- package/dist/functions/capabilities.d.ts +0 -7
package/dist/account/api.d.ts
CHANGED
|
@@ -1,6 +1,51 @@
|
|
|
1
|
+
import type { AccountApiKeyScope } from '../api-keys/scopes.js';
|
|
1
2
|
import type { ApiEndpoint, ApiError } from '../api.js';
|
|
2
3
|
import type { AuditPolicy } from '../audit-trail/event.js';
|
|
4
|
+
import type { MFACredential } from '../mfa/credential.js';
|
|
3
5
|
import type { ApiUser } from '../user/api.js';
|
|
6
|
+
export interface AccountApiKey {
|
|
7
|
+
id: number;
|
|
8
|
+
display_name: string;
|
|
9
|
+
scopes: AccountApiKeyScope[];
|
|
10
|
+
secret: string;
|
|
11
|
+
last_used_at: string | null;
|
|
12
|
+
created_at: string;
|
|
13
|
+
}
|
|
14
|
+
export type ListAccountApiKeys = ApiEndpoint<{
|
|
15
|
+
Audit: {
|
|
16
|
+
kind: 'no-audit';
|
|
17
|
+
reason: 'non-auditable';
|
|
18
|
+
};
|
|
19
|
+
Method: 'GET';
|
|
20
|
+
Path: '/api/v1/account/api-keys';
|
|
21
|
+
Success: {
|
|
22
|
+
data: AccountApiKey[];
|
|
23
|
+
};
|
|
24
|
+
}>;
|
|
25
|
+
export type CreateAccountApiKey = ApiEndpoint<{
|
|
26
|
+
Audit: AuditPolicy<'api_key', 'created', 'account'>;
|
|
27
|
+
Method: 'POST';
|
|
28
|
+
Path: '/api/v1/account/api-keys';
|
|
29
|
+
Body: {
|
|
30
|
+
display_name: string;
|
|
31
|
+
};
|
|
32
|
+
Success: {
|
|
33
|
+
data: Omit<AccountApiKey, 'last_used_at'>;
|
|
34
|
+
};
|
|
35
|
+
Error: ApiError<'conflict' | 'resource_capped'>;
|
|
36
|
+
}>;
|
|
37
|
+
export type DeleteAccountApiKey = ApiEndpoint<{
|
|
38
|
+
Audit: AuditPolicy<'api_key', 'deleted', 'account'>;
|
|
39
|
+
Method: 'DELETE';
|
|
40
|
+
Path: '/api/v1/account/api-keys/:keyId';
|
|
41
|
+
Params: {
|
|
42
|
+
keyId: number;
|
|
43
|
+
};
|
|
44
|
+
Success: {
|
|
45
|
+
success: true;
|
|
46
|
+
};
|
|
47
|
+
Error: ApiError<'not_found'>;
|
|
48
|
+
}>;
|
|
4
49
|
export type PostSignup = ApiEndpoint<{
|
|
5
50
|
Audit: AuditPolicy<'app_auth', 'signup', 'account'>;
|
|
6
51
|
Method: 'POST';
|
|
@@ -12,7 +57,7 @@ export type PostSignup = ApiEndpoint<{
|
|
|
12
57
|
token?: string | undefined;
|
|
13
58
|
foundUs?: string | undefined;
|
|
14
59
|
};
|
|
15
|
-
Error: ApiError<'email_already_verified'> | ApiError<'error_creating_user'> | ApiError<'user_already_exists'> | ApiError<'error_creating_account'> | ApiError<'
|
|
60
|
+
Error: ApiError<'email_already_verified'> | ApiError<'error_creating_user'> | ApiError<'user_already_exists'> | ApiError<'error_creating_account'> | ApiError<'not_found'> | ApiError<'email_not_verified'>;
|
|
16
61
|
Success: {
|
|
17
62
|
data: {
|
|
18
63
|
uuid: string;
|
|
@@ -32,10 +77,7 @@ export type ConfirmEmail = ApiEndpoint<{
|
|
|
32
77
|
};
|
|
33
78
|
Error: ApiError<'error_validating_user'> | ApiError<'invalid_token'> | ApiError<'token_expired'>;
|
|
34
79
|
Success: {
|
|
35
|
-
|
|
36
|
-
userId: number;
|
|
37
|
-
accountId: number;
|
|
38
|
-
showHearAboutUs?: boolean;
|
|
80
|
+
user: ApiUser;
|
|
39
81
|
};
|
|
40
82
|
}>;
|
|
41
83
|
export type ResendVerificationEmailByUuid = ApiEndpoint<{
|
|
@@ -113,6 +155,7 @@ export type PostSignin = ApiEndpoint<{
|
|
|
113
155
|
Error: ApiError<'email_not_verified'> | ApiError<'user_suspended'> | ApiError<'unauthorized'>;
|
|
114
156
|
Success: {
|
|
115
157
|
user: ApiUser;
|
|
158
|
+
url: string;
|
|
116
159
|
} | {
|
|
117
160
|
data: {
|
|
118
161
|
mfaRequired: true;
|
|
@@ -146,8 +189,9 @@ export type PutResetPassword = ApiEndpoint<{
|
|
|
146
189
|
Body: {
|
|
147
190
|
token: string;
|
|
148
191
|
password: string;
|
|
192
|
+
mfa?: MFACredential | undefined;
|
|
149
193
|
};
|
|
150
|
-
Error: ApiError<'user_not_found'> | ApiError<'invalid_token'>;
|
|
194
|
+
Error: ApiError<'user_not_found'> | ApiError<'invalid_token'> | ApiError<'invalid_mfa_code'> | ApiError<'mfa_code_required'>;
|
|
151
195
|
Success: {
|
|
152
196
|
success: true;
|
|
153
197
|
};
|
|
@@ -226,6 +270,35 @@ export type GetOnboardingHearAboutUs = ApiEndpoint<{
|
|
|
226
270
|
};
|
|
227
271
|
};
|
|
228
272
|
}>;
|
|
273
|
+
export type GetOnboardingAccountDiscovery = ApiEndpoint<{
|
|
274
|
+
Audit: {
|
|
275
|
+
kind: 'no-audit';
|
|
276
|
+
reason: 'non-auditable';
|
|
277
|
+
};
|
|
278
|
+
Method: 'GET';
|
|
279
|
+
Path: '/api/v1/account/onboarding/account-discovery';
|
|
280
|
+
Error: ApiError<'forbidden'>;
|
|
281
|
+
Success: {
|
|
282
|
+
data: {
|
|
283
|
+
suggestedAccountName: string | null;
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
}>;
|
|
287
|
+
export type PostOnboardingRequestInvite = ApiEndpoint<{
|
|
288
|
+
Audit: {
|
|
289
|
+
kind: 'no-audit';
|
|
290
|
+
reason: 'non-auditable';
|
|
291
|
+
};
|
|
292
|
+
Method: 'POST';
|
|
293
|
+
Path: '/api/v1/account/onboarding/request-invite';
|
|
294
|
+
Body: never;
|
|
295
|
+
Error: ApiError<'not_found'> | ApiError<'email_delivery_failed'>;
|
|
296
|
+
Success: {
|
|
297
|
+
data: {
|
|
298
|
+
success: true;
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
}>;
|
|
229
302
|
export type PostOnboardingHearAboutUs = ApiEndpoint<{
|
|
230
303
|
Audit: {
|
|
231
304
|
kind: 'no-audit';
|
package/dist/action/api.d.ts
CHANGED
package/dist/admin/http.api.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export type PostImpersonate = ApiEndpoint<{
|
|
|
14
14
|
loginReason: string;
|
|
15
15
|
code?: string | undefined;
|
|
16
16
|
};
|
|
17
|
-
Error: ApiError<'invalid_mfa_code'> | ApiError<'mfa_not_enabled'>;
|
|
17
|
+
Error: ApiError<'invalid_mfa_code'> | ApiError<'mfa_code_required'> | ApiError<'mfa_not_enabled'>;
|
|
18
18
|
Success: {
|
|
19
19
|
success: true;
|
|
20
20
|
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { ApiEndpoint, ApiError } from '../api.js';
|
|
2
|
+
import type { Tags } from '../db.js';
|
|
3
|
+
import type { AgentSessionUnknownPinnedConnectionsPayload } from './connections.js';
|
|
4
|
+
import type { AgentSessionToolsNotInToolsetPayload, AgentSessionUnknownIntegrationsPayload, AgentSessionUnknownToolsPayload, AgentSessionUnsupportedFunctionTypesPayload } from './toolset.js';
|
|
5
|
+
export interface AgentSessionToolListInput {
|
|
6
|
+
tools: string[];
|
|
7
|
+
}
|
|
8
|
+
export type AgentSessionIntegrationPolicyInput = '*' | {
|
|
9
|
+
allow?: AgentSessionToolListInput | '*' | undefined;
|
|
10
|
+
deny?: AgentSessionToolListInput | undefined;
|
|
11
|
+
};
|
|
12
|
+
export interface PostAgentSessionsBody {
|
|
13
|
+
tenant: {
|
|
14
|
+
connections: {
|
|
15
|
+
any?: {
|
|
16
|
+
tags: Tags;
|
|
17
|
+
}[] | undefined;
|
|
18
|
+
pinned?: {
|
|
19
|
+
integration_id: string;
|
|
20
|
+
connection_id: string;
|
|
21
|
+
}[] | undefined;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
toolset?: '*' | Record<string, AgentSessionIntegrationPolicyInput> | undefined;
|
|
25
|
+
pinned_tools?: Record<string, string[]> | undefined;
|
|
26
|
+
meta_tools?: Record<string, boolean> | undefined;
|
|
27
|
+
expires_in?: string | undefined;
|
|
28
|
+
}
|
|
29
|
+
export interface AgentSessionToolsetSummary {
|
|
30
|
+
connected: boolean;
|
|
31
|
+
tools_pinned: number;
|
|
32
|
+
tools_searchable: number;
|
|
33
|
+
}
|
|
34
|
+
export interface AgentSessionMetaToolsSummary {
|
|
35
|
+
nango_tool_search: boolean;
|
|
36
|
+
nango_execute: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface AgentSessionUnknownMetaToolsPayload {
|
|
39
|
+
meta_tools: string[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Creating a session does not require the connections read scope, so a returned candidate names the
|
|
43
|
+
* connection and nothing else. The tags that made it a candidate are on the session created
|
|
44
|
+
* operation, which is where an ambiguity gets debugged.
|
|
45
|
+
*/
|
|
46
|
+
export interface AgentSessionReturnedCandidate {
|
|
47
|
+
connection_id: string;
|
|
48
|
+
}
|
|
49
|
+
export interface AgentSessionAmbiguousConnectionsReply {
|
|
50
|
+
integrations: Record<string, {
|
|
51
|
+
match_count: number;
|
|
52
|
+
candidates: AgentSessionReturnedCandidate[];
|
|
53
|
+
}>;
|
|
54
|
+
}
|
|
55
|
+
export interface AgentSessionPinnedConnectionNotMatchedReply {
|
|
56
|
+
pinned: {
|
|
57
|
+
integration_id: string;
|
|
58
|
+
connection_id: string;
|
|
59
|
+
candidates: AgentSessionReturnedCandidate[];
|
|
60
|
+
}[];
|
|
61
|
+
}
|
|
62
|
+
export type AgentSessionCreationErrorCode = 'ambiguous_connections' | 'unknown_pinned_connection' | 'pinned_connection_not_matched' | 'unknown_integration' | 'unknown_tool' | 'unsupported_function_type' | 'tool_not_in_toolset' | 'unknown_meta_tool';
|
|
63
|
+
/**
|
|
64
|
+
* The payload is not correlated to the code by the compiler on purpose. AgentSessionCreationError
|
|
65
|
+
* carries it as a plain record, so a discriminated union here would only be a cast at the caller.
|
|
66
|
+
*/
|
|
67
|
+
export type AgentSessionCreationErrorPayload = AgentSessionAmbiguousConnectionsReply | AgentSessionUnknownPinnedConnectionsPayload | AgentSessionPinnedConnectionNotMatchedReply | AgentSessionUnknownIntegrationsPayload | AgentSessionUnknownToolsPayload | AgentSessionUnsupportedFunctionTypesPayload | AgentSessionToolsNotInToolsetPayload | AgentSessionUnknownMetaToolsPayload;
|
|
68
|
+
export type PostAgentSessionsCreationError = ApiError<AgentSessionCreationErrorCode, undefined, AgentSessionCreationErrorPayload>;
|
|
69
|
+
export type PostAgentSessions = ApiEndpoint<{
|
|
70
|
+
Audit: {
|
|
71
|
+
kind: 'no-audit';
|
|
72
|
+
reason: 'TODO: audit coverage pending';
|
|
73
|
+
};
|
|
74
|
+
Method: 'POST';
|
|
75
|
+
Path: '/sessions';
|
|
76
|
+
Body: PostAgentSessionsBody;
|
|
77
|
+
Error: PostAgentSessionsCreationError;
|
|
78
|
+
Success: {
|
|
79
|
+
data: {
|
|
80
|
+
session_id: string;
|
|
81
|
+
session_token: string;
|
|
82
|
+
mcp_url: string;
|
|
83
|
+
expires_at: string;
|
|
84
|
+
toolset: Record<string, AgentSessionToolsetSummary>;
|
|
85
|
+
meta_tools: AgentSessionMetaToolsSummary;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
}>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Tags } from '../db.js';
|
|
2
|
+
export interface AgentSessionConnectionSelector {
|
|
3
|
+
readonly tags: Tags;
|
|
4
|
+
}
|
|
5
|
+
export interface AgentSessionPinnedConnection {
|
|
6
|
+
readonly integrationId: string;
|
|
7
|
+
readonly connectionId: string;
|
|
8
|
+
}
|
|
9
|
+
export interface AgentSessionTenantConnections {
|
|
10
|
+
readonly any: AgentSessionConnectionSelector[];
|
|
11
|
+
readonly pinned: AgentSessionPinnedConnection[];
|
|
12
|
+
}
|
|
13
|
+
export interface AgentSessionResolvedConnection {
|
|
14
|
+
readonly integrationId: string;
|
|
15
|
+
readonly provider: string;
|
|
16
|
+
readonly connectionId: string;
|
|
17
|
+
readonly internalConnectionId: number;
|
|
18
|
+
readonly configId: number;
|
|
19
|
+
}
|
|
20
|
+
export type AgentSessionResolvedConnections = Record<string, AgentSessionResolvedConnection>;
|
|
21
|
+
export type AgentSessionConnectionResolutionErrorCode = 'ambiguous_connections' | 'pinned_connection_not_matched' | 'unknown_pinned_connection';
|
|
22
|
+
export interface AgentSessionConnectionCandidateReport {
|
|
23
|
+
readonly connection_id: string;
|
|
24
|
+
readonly tags: Tags;
|
|
25
|
+
}
|
|
26
|
+
export interface AgentSessionAmbiguousConnectionsPayload {
|
|
27
|
+
readonly integrations: Record<string, {
|
|
28
|
+
readonly match_count: number;
|
|
29
|
+
readonly candidates: AgentSessionConnectionCandidateReport[];
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
export interface AgentSessionUnknownPinnedConnectionsPayload {
|
|
33
|
+
readonly pinned: {
|
|
34
|
+
readonly integration_id: string;
|
|
35
|
+
readonly connection_id: string;
|
|
36
|
+
}[];
|
|
37
|
+
}
|
|
38
|
+
export interface AgentSessionPinnedConnectionNotMatchedPayload {
|
|
39
|
+
readonly pinned: {
|
|
40
|
+
readonly integration_id: string;
|
|
41
|
+
readonly connection_id: string;
|
|
42
|
+
readonly candidates: AgentSessionConnectionCandidateReport[];
|
|
43
|
+
}[];
|
|
44
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ApiEndpoint, ApiError } from '../api.js';
|
|
2
|
+
export type AgentSessionMcpErrorCode = 'session_not_found';
|
|
3
|
+
export type PostAgentSessionMcp = ApiEndpoint<{
|
|
4
|
+
Audit: {
|
|
5
|
+
kind: 'no-audit';
|
|
6
|
+
reason: 'TODO: audit coverage pending';
|
|
7
|
+
};
|
|
8
|
+
Method: 'POST';
|
|
9
|
+
Path: '/session/:sessionId/mcp';
|
|
10
|
+
Params: {
|
|
11
|
+
sessionId: string;
|
|
12
|
+
};
|
|
13
|
+
Body: Record<string, unknown>;
|
|
14
|
+
Success: Record<string, unknown>;
|
|
15
|
+
Error: ApiError<AgentSessionMcpErrorCode>;
|
|
16
|
+
}>;
|
|
17
|
+
export type GetAgentSessionMcp = ApiEndpoint<{
|
|
18
|
+
Audit: {
|
|
19
|
+
kind: 'no-audit';
|
|
20
|
+
reason: 'non-auditable';
|
|
21
|
+
};
|
|
22
|
+
Method: 'GET';
|
|
23
|
+
Path: '/session/:sessionId/mcp';
|
|
24
|
+
Params: {
|
|
25
|
+
sessionId: string;
|
|
26
|
+
};
|
|
27
|
+
Success: Record<string, unknown>;
|
|
28
|
+
}>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AgentSessionResolvedConnections } from './connections.js';
|
|
2
|
+
import type { AgentSessionCompiledToolset } from './toolset.js';
|
|
3
|
+
export interface AgentSessionMetaTools {
|
|
4
|
+
readonly nangoToolSearch: boolean;
|
|
5
|
+
readonly nangoExecute: boolean;
|
|
6
|
+
}
|
|
7
|
+
export type AgentSessionEndedReason = 'terminated' | 'expired';
|
|
8
|
+
export interface AgentSession {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly environmentId: number;
|
|
11
|
+
readonly accountId: number;
|
|
12
|
+
readonly resolvedConnections: AgentSessionResolvedConnections;
|
|
13
|
+
readonly compiledToolset: AgentSessionCompiledToolset;
|
|
14
|
+
readonly metaTools: AgentSessionMetaTools;
|
|
15
|
+
readonly expiresAt: Date;
|
|
16
|
+
readonly endedAt: Date | null;
|
|
17
|
+
readonly endedReason: AgentSessionEndedReason | null;
|
|
18
|
+
readonly createdAt: Date;
|
|
19
|
+
readonly updatedAt: Date;
|
|
20
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `allow` absent means every tool on the integration. `allow` present makes the
|
|
3
|
+
* integration an allowlist. `deny` always subtracts from whatever `allow` gave.
|
|
4
|
+
*/
|
|
5
|
+
export interface AgentSessionIntegrationPolicy {
|
|
6
|
+
readonly allow: '*' | readonly string[];
|
|
7
|
+
readonly deny: readonly string[];
|
|
8
|
+
}
|
|
9
|
+
export type AgentSessionToolsetPolicy = '*' | Readonly<Record<string, AgentSessionIntegrationPolicy>>;
|
|
10
|
+
export type AgentSessionPinnedTools = Readonly<Record<string, readonly string[]>>;
|
|
11
|
+
export interface AgentSessionCompiledTool {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly description: string;
|
|
14
|
+
}
|
|
15
|
+
export interface AgentSessionCompiledIntegration {
|
|
16
|
+
readonly provider: string;
|
|
17
|
+
readonly pinned: AgentSessionCompiledTool[];
|
|
18
|
+
readonly searchable: AgentSessionCompiledTool[];
|
|
19
|
+
}
|
|
20
|
+
export type AgentSessionCompiledToolset = Record<string, AgentSessionCompiledIntegration>;
|
|
21
|
+
export type AgentSessionToolsetCompilationErrorCode = 'unknown_integration' | 'unknown_tool' | 'unsupported_function_type' | 'tool_not_in_toolset';
|
|
22
|
+
export interface AgentSessionUnknownIntegrationsPayload {
|
|
23
|
+
readonly integrations: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface AgentSessionUnknownToolsPayload {
|
|
26
|
+
readonly tools: {
|
|
27
|
+
readonly integration_id: string;
|
|
28
|
+
readonly tool: string;
|
|
29
|
+
}[];
|
|
30
|
+
}
|
|
31
|
+
export interface AgentSessionUnsupportedFunctionTypesPayload {
|
|
32
|
+
readonly tools: {
|
|
33
|
+
readonly integration_id: string;
|
|
34
|
+
readonly tool: string;
|
|
35
|
+
readonly type: string;
|
|
36
|
+
}[];
|
|
37
|
+
}
|
|
38
|
+
export interface AgentSessionToolsNotInToolsetPayload {
|
|
39
|
+
readonly pinned: {
|
|
40
|
+
readonly integration_id: string;
|
|
41
|
+
readonly tool: string;
|
|
42
|
+
}[];
|
|
43
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { DBAPISecret, DBEnvironment } from '../environment/db.js';
|
|
2
|
+
import type { DBPlan } from '../plans/db.js';
|
|
3
|
+
import type { DBTeam } from '../team/db.js';
|
|
4
|
+
export type ApiKeyAuthSource = 'customer_key' | 'sandbox_token' | 'api_secret' | 'env_var' | 'connect_session';
|
|
5
|
+
export interface ApiKeyPrincipal {
|
|
6
|
+
type: 'api_key';
|
|
7
|
+
source: ApiKeyAuthSource;
|
|
8
|
+
accountId: number;
|
|
9
|
+
scopes: string[];
|
|
10
|
+
environmentIds: number[];
|
|
11
|
+
keyId?: number;
|
|
12
|
+
displayName?: string;
|
|
13
|
+
}
|
|
14
|
+
export type ApiKeyAuthorizationTarget = {
|
|
15
|
+
type: 'account';
|
|
16
|
+
accountId: number;
|
|
17
|
+
} | {
|
|
18
|
+
type: 'environment';
|
|
19
|
+
accountId: number;
|
|
20
|
+
environmentId: number;
|
|
21
|
+
};
|
|
22
|
+
export interface ApiKeyAuthDetails {
|
|
23
|
+
source: Exclude<ApiKeyAuthSource, 'connect_session'>;
|
|
24
|
+
scopes?: string[];
|
|
25
|
+
apiKeyId?: number;
|
|
26
|
+
apiKeyDisplayName?: string;
|
|
27
|
+
purpose?: 'dryrun' | 'deploy';
|
|
28
|
+
dryrunId?: string;
|
|
29
|
+
deploymentId?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface ApiKeyContext {
|
|
32
|
+
account: DBTeam;
|
|
33
|
+
environment?: DBEnvironment;
|
|
34
|
+
secret?: DBAPISecret;
|
|
35
|
+
plan: DBPlan | null;
|
|
36
|
+
principal: ApiKeyPrincipal;
|
|
37
|
+
auth: ApiKeyAuthDetails;
|
|
38
|
+
}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
export type
|
|
3
|
-
export declare const
|
|
1
|
+
/** Every wildcard in a namespace: `environment:*`, `environment:connections:*`, … */
|
|
2
|
+
export type WildcardsFor<Namespace extends string> = `${Namespace}:*` | `${Namespace}:${string}:*`;
|
|
3
|
+
export declare const API_KEY_SCOPES: readonly ["environment:integrations:list", "environment:integrations:list_credentials", "environment:integrations:list_functions", "environment:integrations:read", "environment:integrations:read_credentials", "environment:integrations:create", "environment:integrations:update", "environment:integrations:delete", "environment:connections:list", "environment:connections:list_credentials", "environment:connections:read", "environment:connections:read_credentials", "environment:connections:create", "environment:connections:update", "environment:connections:delete", "environment:connect_sessions:write", "environment:agent_sessions:write", "environment:syncs:read", "environment:syncs:execute", "environment:syncs:update", "environment:syncs:variant:create", "environment:syncs:variant:delete", "environment:functions:list", "environment:functions:read", "environment:functions:delete", "environment:functions:compile", "environment:functions:dryrun", "environment:functions:invocations", "environment:deploy", "environment:records:read", "environment:records:write", "environment:logs:read", "environment:actions:execute", "environment:proxy", "environment:variables:read", "environment:webhook_signing_key:rotate", "environment:mcp"];
|
|
4
|
+
export type ConcreteApiKeyScope = (typeof API_KEY_SCOPES)[number];
|
|
5
|
+
/** A scope, or a wildcard over scopes. Which wildcards resolve to something is checked at runtime. */
|
|
6
|
+
export type ApiKeyScope = ConcreteApiKeyScope | WildcardsFor<'environment'>;
|
|
7
|
+
export declare const ACCOUNT_API_KEY_SCOPES: readonly ["account:environments:create", "account:environments:delete", "account:environments:set_production", "account:environments:api_keys:create", "account:environments:api_keys:delete"];
|
|
8
|
+
export type ConcreteAccountApiKeyScope = (typeof ACCOUNT_API_KEY_SCOPES)[number];
|
|
9
|
+
export type AccountApiKeyScope = ConcreteAccountApiKeyScope | WildcardsFor<'account'>;
|
|
10
|
+
export type CustomerKeyScope = ApiKeyScope | AccountApiKeyScope;
|
package/dist/api.endpoints.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type { ConfirmEmail, GetEmailByExpiredToken, GetEmailByUuid, GetManagedCallback, GetManagedEmailVerification, PostForgotPassword, PostLogout, PostManagedEmailVerification, PostManagedSignup, PostSignin, PostSignup, PutResetPassword } from './account/api.js';
|
|
1
|
+
import type { ConfirmEmail, CreateAccountApiKey, DeleteAccountApiKey, GetEmailByExpiredToken, GetEmailByUuid, GetManagedCallback, GetManagedEmailVerification, GetOnboardingAccountDiscovery, ListAccountApiKeys, PostForgotPassword, PostLogout, PostManagedEmailVerification, PostManagedSignup, PostOnboardingRequestInvite, PostSignin, PostSignup, PutResetPassword } from './account/api.js';
|
|
2
2
|
import type { GetAsyncActionResult, GetPublicV1, PostInternalTriggerFunction, PostPublicTriggerAction } from './action/api.js';
|
|
3
3
|
import type { PostImpersonate } from './admin/http.api.js';
|
|
4
|
+
import type { PostAgentSessions } from './agent/api.js';
|
|
5
|
+
import type { GetAgentSessionMcp, PostAgentSessionMcp } from './agent/mcp.api.js';
|
|
4
6
|
import type { EndpointMethod } from './api.js';
|
|
5
|
-
import type { GetAuditTrail } from './audit-trail/api.js';
|
|
7
|
+
import type { GetAuditTrail, GetAuditTrailExport } from './audit-trail/api.js';
|
|
6
8
|
import type { PostPublicApiKeyAuthorization, PostPublicAwsSigV4Authorization, PostPublicBasicAuthorization, PostPublicBillAuthorization, PostPublicJwtAuthorization, PostPublicOauthOutboundAuthorization, PostPublicSignatureAuthorization, PostPublicTbaAuthorization, PostPublicTwoStepAuthorization, PostPublicUnauthenticatedAuthorization } from './auth/http.api.js';
|
|
7
9
|
import type { PostCliTelemetry } from './cli/api.js';
|
|
8
10
|
import type { GetPublicClientMetadata } from './clientMetadata/http.api.js';
|
|
@@ -11,11 +13,11 @@ import type { DeleteConnection, DeletePublicConnection, GetConnection, GetConnec
|
|
|
11
13
|
import type { PostConnectionMetadata, SetMetadata, UpdateMetadata } from './connection/api/metadata.js';
|
|
12
14
|
import type { GetConnectUISettings, PutConnectUISettings } from './connectUISettings/api.js';
|
|
13
15
|
import type { PostDeploy, PostDeployConfirmation, PostDeployInternal } from './deploy/api.js';
|
|
14
|
-
import type { CreateApiKey, DeleteApiKey, DeleteEnvironment, GetEnvironment, GetEnvironments, ListApiKeys, PatchApiKey, PatchEnvironment, PostEnvironment } from './environment/api/index.js';
|
|
16
|
+
import type { CreateApiKey, DeleteApiKey, DeleteEnvironment, DeletePublicApiKey, DeletePublicEnvironment, GetEnvironment, GetEnvironments, ListApiKeys, PatchApiKey, PatchEnvironment, PostEnvironment, PostPublicApiKey, PostPublicEnvironment, PostPublicRotateWebhookSigningKey, PostRotateWebhookSigningKey } from './environment/api/index.js';
|
|
15
17
|
import type { PatchWebhook } from './environment/api/webhook.js';
|
|
16
18
|
import type { PostEnvironmentVariables } from './environment/variable/api.js';
|
|
17
19
|
import type { PatchFlowDisable, PatchFlowEnable, PatchFlowFrequency, PostPreBuiltDeploy, PutUpgradePreBuiltFlow } from './flow/http.api.js';
|
|
18
|
-
import type { DeleteIntegrationFunction, DeletePublicIntegrationFunction, GetFunctionDeployment, GetFunctionDryrun, GetIntegrationFunction, GetIntegrationFunctions, GetIntegrationTemplates, GetProviderTemplates, GetPublicIntegrationFunction, GetPublicIntegrationFunctions, GetPublicProviderTemplates, PostFunctionCompile, PostFunctionDeployment, PostFunctionDeploymentResult, PostFunctionDryrun, PostFunctionDryrunResult } from './functions/api.js';
|
|
20
|
+
import type { DeleteIntegrationFunction, DeletePublicIntegrationFunction, GetFunctionDeployment, GetFunctionDryrun, GetFunctionInvocation, GetIntegrationFunction, GetIntegrationFunctions, GetIntegrationTemplates, GetProviderTemplates, GetPublicIntegrationFunction, GetPublicIntegrationFunctions, GetPublicProviderTemplates, PostFunctionCompile, PostFunctionDeployment, PostFunctionDeploymentBundle, PostFunctionDeploymentBundlePreview, PostFunctionDeploymentResult, PostFunctionDryrun, PostFunctionDryrunResult, PostFunctionInvocation } from './functions/api.js';
|
|
19
21
|
import type { GetGettingStarted, PatchGettingStarted } from './gettingStarted/api.js';
|
|
20
22
|
import type { DeleteIntegration, DeletePublicIntegration, GetFunctionCode, GetIntegration, GetIntegrationFlows, GetPublicFunctionCode, GetPublicIntegration, GetPublicListIntegrations, PatchIntegration, PatchPublicIntegration, PostIntegration, PostPublicIntegration, PostPublicQuickstartIntegration } from './integration/api.js';
|
|
21
23
|
import type { DeleteInvite, GetInvite, PostInvite } from './invitations/api.js';
|
|
@@ -23,7 +25,7 @@ import type { GetOperation, PostInsights, SearchFilters, SearchMessages, SearchO
|
|
|
23
25
|
import type { GetMeta } from './meta/api.js';
|
|
24
26
|
import type { DeleteMFA, GetMFAStatus, PostMFAActivation, PostMFAEnrollment, PostMFALoginVerification, PostMFARecoveryCodes } from './mfa/api.js';
|
|
25
27
|
import type { GetPlainHmac } from './plain/api.js';
|
|
26
|
-
import type { GetBillingUsage, GetBillingUsageTopDimensionValues, PostPlanChange, PostPlanExtendTrial, PutBillingInvoicingDetails } from './plans/http.api.js';
|
|
28
|
+
import type { DeleteSpendAlert, GetBillingPeriodCosts, GetBillingUsage, GetBillingUsageTopDimensionValues, GetOverdueInvoices, GetSpendAlert, GetUpcomingInvoice, PostPlanChange, PostPlanExtendTrial, PutBillingInvoicingDetails, PutSpendAlert } from './plans/http.api.js';
|
|
27
29
|
import type { GetProvider, GetProviders, GetPublicProvider, GetPublicProviders } from './providers/api.js';
|
|
28
30
|
import type { AllPublicProxy } from './proxy/http.api.js';
|
|
29
31
|
import type { GetConnectionRecordModels, GetConnectionRecords, GetPublicRecords, PatchPublicPruneRecords } from './record/api.js';
|
|
@@ -33,8 +35,8 @@ import type { GetPublicSyncStatus, PostPublicSyncPause, PostPublicSyncStart, Pos
|
|
|
33
35
|
import type { DeleteTeamUser, GetTeam, PatchTeamUser, PutTeam } from './team/api.js';
|
|
34
36
|
import type { GetUser, PatchUser, PutUserPassword } from './user/api.js';
|
|
35
37
|
import type { PostPublicWebhook } from './webhooks/http.api.js';
|
|
36
|
-
export type PublicApiEndpoints = SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation | PostPublicTrigger | PostPublicTbaAuthorization | PostPublicJwtAuthorization | PostPublicUnauthenticatedAuthorization | PostPublicApiKeyAuthorization | PostPublicBasicAuthorization | GetPublicProviders | GetPublicProvider | GetPublicListIntegrations | GetPublicIntegration | DeletePublicIntegration | PostConnectSessions | PostPublicConnectSessionsReconnect | GetPublicConnections | GetPublicConnection | GetConnectSession | DeleteConnectSession | PostDeployInternal | PostPublicBillAuthorization | DeletePublicConnection | DeleteConnection | PostPublicSignatureAuthorization | PostPublicTwoStepAuthorization | PostPublicWebhook | GetPublicClientMetadata | GetPublicRecords | PatchPublicPruneRecords | GetPublicScriptsConfig | PostPublicConnectTelemetry | PostCliTelemetry | PutPublicSyncConnectionFrequency | PostPublicIntegration | PostPublicQuickstartIntegration | PatchPublicIntegration | GetAsyncActionResult | PostPublicOauthOutboundAuthorization | PostPublicAwsSigV4Authorization | PostPublicConnection | PatchPublicConnection | PostPublicSyncStart | PostPublicSyncPause | GetPublicSyncStatus | GetPublicV1 | PostPublicTriggerAction | PostFunctionCompile | PostFunctionDryrun | GetFunctionDryrun | PostFunctionDryrunResult | PostFunctionDeployment | GetFunctionDeployment | PostFunctionDeploymentResult | GetPublicFunctionCode | GetPublicIntegrationFunctions | GetPublicIntegrationFunction | DeletePublicIntegrationFunction | GetPublicProviderTemplates | AllPublicProxy;
|
|
37
|
-
export type PrivateApiEndpoints = GetAuditTrail | ConfirmEmail | PostSignup | PostSignin | PostLogout | GetTeam | PutTeam | PostPlanExtendTrial | PostPlanChange | PutBillingInvoicingDetails | GetBillingUsage | GetBillingUsageTopDimensionValues | GetUser | PatchUser | PutUserPassword | PostInvite | DeleteInvite | DeleteTeamUser | PatchTeamUser | PostInsights | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | PostInternalConnectSessions | GetIntegrationFlows | GetIntegrationFunction | GetIntegrationFunctions | GetFunctionCode | DeleteIntegrationFunction | GetIntegrationTemplates | GetProviderTemplates | DeleteIntegration | PatchIntegration | GetIntegration | PostIntegration | GetConnections | GetConnectionsCount | GetConnection | PatchConnection | PostConnectionMetadata | GetConnectionRecordModels | GetConnectionRecords | GetInvite | GetMeta | GetEmailByExpiredToken | GetEmailByUuid | GetManagedCallback | GetManagedEmailVerification | PatchFlowDisable | PatchFlowEnable | PatchFlowFrequency | PutUpgradePreBuiltFlow | PostConnectionRefresh | PostManagedEmailVerification | PostManagedSignup | PostPreBuiltDeploy | PostEnvironment | PatchEnvironment | DeleteEnvironment | GetEnvironments | GetEnvironment | ListApiKeys | CreateApiKey | DeleteApiKey | PatchApiKey | PatchWebhook | PostEnvironmentVariables | PostImpersonate | GetSharedCredentialsProviders | GetSharedCredentialsProvider | PostSharedCredentialsProvider | PatchSharedCredentialsProvider | GetGettingStarted | PatchGettingStarted | GetConnectUISettings | PutConnectUISettings | GetProviders | GetProvider | PostInternalTriggerFunction | GetMFAStatus | PostMFAEnrollment | PostMFAActivation | PostMFARecoveryCodes | PostMFALoginVerification | DeleteMFA | GetPlainHmac;
|
|
38
|
+
export type PublicApiEndpoints = SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation | PostPublicTrigger | PostPublicTbaAuthorization | PostPublicJwtAuthorization | PostPublicUnauthenticatedAuthorization | PostPublicApiKeyAuthorization | PostPublicBasicAuthorization | GetPublicProviders | GetPublicProvider | GetPublicListIntegrations | GetPublicIntegration | DeletePublicIntegration | PostConnectSessions | PostAgentSessions | PostAgentSessionMcp | GetAgentSessionMcp | PostPublicConnectSessionsReconnect | GetPublicConnections | GetPublicConnection | GetConnectSession | DeleteConnectSession | PostDeployInternal | PostPublicBillAuthorization | DeletePublicConnection | DeleteConnection | PostPublicSignatureAuthorization | PostPublicTwoStepAuthorization | PostPublicWebhook | GetPublicClientMetadata | GetPublicRecords | PatchPublicPruneRecords | GetPublicScriptsConfig | PostPublicConnectTelemetry | PostCliTelemetry | PutPublicSyncConnectionFrequency | PostPublicIntegration | PostPublicQuickstartIntegration | PatchPublicIntegration | GetAsyncActionResult | PostPublicOauthOutboundAuthorization | PostPublicAwsSigV4Authorization | PostPublicConnection | PatchPublicConnection | PostPublicSyncStart | PostPublicSyncPause | GetPublicSyncStatus | GetPublicV1 | PostPublicTriggerAction | PostFunctionCompile | PostFunctionDryrun | GetFunctionDryrun | PostFunctionDryrunResult | PostFunctionDeployment | GetFunctionDeployment | PostFunctionDeploymentResult | PostFunctionInvocation | GetFunctionInvocation | PostFunctionDeploymentBundle | PostFunctionDeploymentBundlePreview | GetPublicFunctionCode | GetPublicIntegrationFunctions | GetPublicIntegrationFunction | DeletePublicIntegrationFunction | GetPublicProviderTemplates | PostPublicRotateWebhookSigningKey | AllPublicProxy | PostPublicEnvironment | DeletePublicEnvironment | PostPublicApiKey | DeletePublicApiKey;
|
|
39
|
+
export type PrivateApiEndpoints = GetAuditTrail | GetAuditTrailExport | ListAccountApiKeys | CreateAccountApiKey | DeleteAccountApiKey | ConfirmEmail | PostSignup | PostSignin | PostLogout | GetTeam | PutTeam | PostPlanExtendTrial | PostPlanChange | PutBillingInvoicingDetails | GetOverdueInvoices | GetBillingUsage | GetBillingUsageTopDimensionValues | GetUpcomingInvoice | GetBillingPeriodCosts | GetSpendAlert | PutSpendAlert | DeleteSpendAlert | GetUser | PatchUser | PutUserPassword | PostInvite | DeleteInvite | DeleteTeamUser | PatchTeamUser | PostInsights | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | PostInternalConnectSessions | GetIntegrationFlows | GetIntegrationFunction | GetIntegrationFunctions | GetFunctionCode | DeleteIntegrationFunction | GetIntegrationTemplates | GetProviderTemplates | DeleteIntegration | PatchIntegration | GetIntegration | PostIntegration | GetConnections | GetConnectionsCount | GetConnection | PatchConnection | PostConnectionMetadata | GetConnectionRecordModels | GetConnectionRecords | GetInvite | GetMeta | GetEmailByExpiredToken | GetEmailByUuid | GetManagedCallback | GetManagedEmailVerification | GetOnboardingAccountDiscovery | PostOnboardingRequestInvite | PatchFlowDisable | PatchFlowEnable | PatchFlowFrequency | PutUpgradePreBuiltFlow | PostConnectionRefresh | PostManagedEmailVerification | PostManagedSignup | PostPreBuiltDeploy | PostEnvironment | PatchEnvironment | DeleteEnvironment | GetEnvironments | GetEnvironment | PostRotateWebhookSigningKey | ListApiKeys | CreateApiKey | DeleteApiKey | PatchApiKey | PatchWebhook | PostEnvironmentVariables | PostImpersonate | GetSharedCredentialsProviders | GetSharedCredentialsProvider | PostSharedCredentialsProvider | PatchSharedCredentialsProvider | GetGettingStarted | PatchGettingStarted | GetConnectUISettings | PutConnectUISettings | GetProviders | GetProvider | PostInternalTriggerFunction | GetMFAStatus | PostMFAEnrollment | PostMFAActivation | PostMFARecoveryCodes | PostMFALoginVerification | DeleteMFA | GetPlainHmac;
|
|
38
40
|
export type APIEndpoints = PrivateApiEndpoints | PublicApiEndpoints;
|
|
39
41
|
/**
|
|
40
42
|
* Automatically narrow endpoints type with Method + Path
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ApiEndpoint } from '../api.js';
|
|
2
|
-
import type { AuditAction, AuditActor, AuditContext, AuditOutcome, AuditResource, AuditTarget, AuditTrailVersion } from './event.js';
|
|
1
|
+
import type { ApiEndpoint, ApiError } from '../api.js';
|
|
2
|
+
import type { AuditAction, AuditActor, AuditContext, AuditOutcome, AuditPolicy, AuditResource, AuditTarget, AuditTrailVersion, AuditVia } from './event.js';
|
|
3
3
|
export interface ApiAuditTrailEvent {
|
|
4
4
|
id: string;
|
|
5
5
|
version: AuditTrailVersion;
|
|
@@ -10,7 +10,7 @@ export interface ApiAuditTrailEvent {
|
|
|
10
10
|
display: string;
|
|
11
11
|
} | null;
|
|
12
12
|
actor: AuditActor;
|
|
13
|
-
via?:
|
|
13
|
+
via?: AuditVia[];
|
|
14
14
|
targets: AuditTarget[];
|
|
15
15
|
context: AuditContext;
|
|
16
16
|
outcome: AuditOutcome;
|
|
@@ -19,16 +19,16 @@ export interface ApiAuditTrailEvent {
|
|
|
19
19
|
metadata?: Record<string, unknown>;
|
|
20
20
|
}
|
|
21
21
|
export type GetAuditTrail = ApiEndpoint<{
|
|
22
|
-
Audit:
|
|
23
|
-
kind: 'no-audit';
|
|
24
|
-
reason: 'non-auditable';
|
|
25
|
-
};
|
|
22
|
+
Audit: AuditPolicy<'audit_trail', 'queried', 'account'>;
|
|
26
23
|
Method: 'GET';
|
|
27
24
|
Path: '/api/v1/audit-trail';
|
|
25
|
+
Error: ApiError<'feature_disabled'>;
|
|
28
26
|
Querystring: {
|
|
29
27
|
cursor?: string;
|
|
30
28
|
from?: string;
|
|
31
29
|
to?: string;
|
|
30
|
+
resources?: string;
|
|
31
|
+
actions?: string;
|
|
32
32
|
};
|
|
33
33
|
Success: {
|
|
34
34
|
data: ApiAuditTrailEvent[];
|
|
@@ -37,3 +37,17 @@ export type GetAuditTrail = ApiEndpoint<{
|
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
39
|
}>;
|
|
40
|
+
export type AuditExportMaxRows = 50_000;
|
|
41
|
+
export type GetAuditTrailExport = ApiEndpoint<{
|
|
42
|
+
Audit: AuditPolicy<'audit_trail', 'exported', 'account'>;
|
|
43
|
+
Method: 'GET';
|
|
44
|
+
Path: '/api/v1/audit-trail/export';
|
|
45
|
+
Error: ApiError<'feature_disabled'>;
|
|
46
|
+
Querystring: {
|
|
47
|
+
from?: string;
|
|
48
|
+
to?: string;
|
|
49
|
+
resources?: string;
|
|
50
|
+
actions?: string;
|
|
51
|
+
};
|
|
52
|
+
Success: never;
|
|
53
|
+
}>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export type AuditTrailVersion = '2026-07-16';
|
|
2
|
-
export type AuditActorType = 'user' | 'api_key' | '
|
|
2
|
+
export type AuditActorType = 'user' | 'api_key' | 'connect_session' | 'anonymous' | 'unknown';
|
|
3
3
|
export type AuditOutcome = 'success' | 'failure' | 'denied';
|
|
4
|
+
export type AuditViaType = 'impersonation';
|
|
5
|
+
export type AuditInterface = 'api' | 'mcp';
|
|
4
6
|
interface AuditEventTable {
|
|
5
7
|
connection: 'created' | 'updated' | 'metadata_updated' | 'refreshed' | 'deleted';
|
|
6
8
|
sync: 'enabled' | 'disabled' | 'paused' | 'started' | 'triggered' | 'cancelled' | 'frequency_changed' | 'variant_created' | 'variant_deleted';
|
|
@@ -10,10 +12,11 @@ interface AuditEventTable {
|
|
|
10
12
|
member: 'invited' | 'invite_accepted' | 'invite_declined' | 'invite_revoked' | 'role_changed' | 'removed';
|
|
11
13
|
team: 'updated';
|
|
12
14
|
user: 'updated';
|
|
13
|
-
environment: 'created' | 'updated' | 'variables_changed' | 'webhook_urls_changed' | 'deleted';
|
|
15
|
+
environment: 'created' | 'updated' | 'variables_changed' | 'webhook_urls_changed' | 'webhook_signing_key_rotated' | 'deleted';
|
|
14
16
|
app_auth: 'login' | 'logout' | 'signup' | 'password_changed' | 'password_reset';
|
|
15
17
|
mfa: 'enrolled' | 'enabled' | 'disabled' | 'verified' | 'recovery_regenerated';
|
|
16
|
-
billing: 'plan_changed' | 'trial_extended' | 'details_changed' | 'payment_method_added' | 'payment_method_removed';
|
|
18
|
+
billing: 'plan_changed' | 'trial_extended' | 'details_changed' | 'payment_method_added' | 'payment_method_removed' | 'spend_alert_changed' | 'spend_alert_removed';
|
|
19
|
+
audit_trail: 'exported' | 'queried';
|
|
17
20
|
}
|
|
18
21
|
export type AuditResource = keyof AuditEventTable;
|
|
19
22
|
export type AuditActionOf<R extends AuditResource> = AuditEventTable[R];
|
|
@@ -28,15 +31,31 @@ export interface AuditActor {
|
|
|
28
31
|
id: string;
|
|
29
32
|
display?: string;
|
|
30
33
|
}
|
|
34
|
+
export interface AuditVia {
|
|
35
|
+
type: AuditViaType;
|
|
36
|
+
id: string;
|
|
37
|
+
display?: string;
|
|
38
|
+
actorId?: string;
|
|
39
|
+
}
|
|
31
40
|
export interface AuditTarget {
|
|
32
41
|
type: AuditTargetType;
|
|
33
42
|
id: string;
|
|
34
43
|
display?: string;
|
|
35
44
|
}
|
|
36
45
|
export interface AuditContext {
|
|
46
|
+
interface?: AuditInterface;
|
|
37
47
|
ip?: string;
|
|
38
48
|
userAgent?: string;
|
|
39
49
|
}
|
|
50
|
+
export interface AuditAttribution {
|
|
51
|
+
kind: 'request';
|
|
52
|
+
actor: AuditActor;
|
|
53
|
+
context: AuditContext;
|
|
54
|
+
}
|
|
55
|
+
export interface NoAttribution {
|
|
56
|
+
kind: 'no-attribution';
|
|
57
|
+
reason: string;
|
|
58
|
+
}
|
|
40
59
|
export interface AuditPolicy<R extends AuditResource = AuditResource, A extends AuditActionOf<R> = AuditActionOf<R>, S extends AuditScope = AuditScope> {
|
|
41
60
|
kind: 'audit';
|
|
42
61
|
resource: R;
|