@nangohq/types 0.71.2 → 0.71.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/account/api.d.ts +100 -19
  2. package/dist/action/api.d.ts +21 -5
  3. package/dist/admin/http.api.d.ts +8 -2
  4. package/dist/api-keys/auth.d.ts +38 -0
  5. package/dist/api-keys/scopes.d.ts +3 -1
  6. package/dist/api.d.ts +7 -0
  7. package/dist/api.endpoints.d.ts +7 -6
  8. package/dist/audit-trail/api.d.ts +41 -0
  9. package/dist/audit-trail/event.d.ts +56 -0
  10. package/dist/auth/api.d.ts +2 -10
  11. package/dist/auth/http.api.d.ts +50 -26
  12. package/dist/authz/types.d.ts +1 -1
  13. package/dist/billing/http.api.d.ts +6 -2
  14. package/dist/cli/api.d.ts +6 -2
  15. package/dist/clientMetadata/http.api.d.ts +6 -2
  16. package/dist/connect/api.d.ts +36 -7
  17. package/dist/connectUISettings/api.d.ts +11 -3
  18. package/dist/connection/api/get.d.ts +39 -12
  19. package/dist/connection/api/metadata.d.ts +8 -4
  20. package/dist/db.d.ts +5 -0
  21. package/dist/deploy/api.d.ts +14 -4
  22. package/dist/environment/api/index.d.ts +34 -11
  23. package/dist/environment/api/otlp.d.ts +6 -2
  24. package/dist/environment/api/webhook.d.ts +4 -2
  25. package/dist/environment/variable/api.d.ts +4 -2
  26. package/dist/flow/http.api.d.ts +17 -7
  27. package/dist/function/config.d.ts +65 -0
  28. package/dist/function/db.d.ts +39 -0
  29. package/dist/functions/api.d.ts +141 -17
  30. package/dist/gettingStarted/api.d.ts +11 -3
  31. package/dist/index.d.ts +7 -3
  32. package/dist/integration/api.d.ts +52 -15
  33. package/dist/invitations/api.d.ts +15 -6
  34. package/dist/logs/api.d.ts +26 -6
  35. package/dist/mcp/api.d.ts +21 -5
  36. package/dist/meta/api.d.ts +7 -2
  37. package/dist/mfa/api.d.ts +35 -6
  38. package/dist/plain/api.d.ts +6 -2
  39. package/dist/plans/http.api.d.ts +33 -9
  40. package/dist/providers/api.d.ts +21 -5
  41. package/dist/providers/provider.d.ts +4 -7
  42. package/dist/proxy/http.api.d.ts +6 -2
  43. package/dist/pubsub/events.d.ts +3 -1
  44. package/dist/record/api.d.ts +21 -5
  45. package/dist/scripts/http.api.d.ts +6 -2
  46. package/dist/stripe/http.api.d.ts +16 -5
  47. package/dist/sync/api.d.ts +22 -8
  48. package/dist/team/api.d.ts +18 -6
  49. package/dist/user/api.d.ts +11 -4
  50. package/dist/user/db.d.ts +2 -0
  51. package/dist/webhooks/http.api.d.ts +6 -2
  52. package/package.json +1 -1
  53. package/dist/functions/capabilities.d.ts +0 -7
@@ -1,4 +1,4 @@
1
- import type { ApiError, Endpoint } from '../api.js';
1
+ import type { ApiEndpoint, ApiError } from '../api.js';
2
2
  export type ConnectionQueryString = {
3
3
  connection_id?: string | undefined;
4
4
  params?: Record<string, any> | undefined;
@@ -34,7 +34,11 @@ export interface WebSocketConnectionResponseSuccess {
34
34
  private_key?: string | undefined;
35
35
  }
36
36
  type AuthErrors = ApiError<'invalid_body'> | ApiError<'invalid_query_params'> | ApiError<'unknown_provider_config'> | ApiError<'unknown_provider_template'> | ApiError<'invalid_auth_mode'> | ApiError<'invalid_credentials'> | ApiError<'integration_not_allowed'> | ApiError<'invalid_connection'> | ApiError<'connection_test_failed'> | ApiError<'connection_validation_failed'>;
37
- export type PostPublicApiKeyAuthorization = Endpoint<{
37
+ export type PostPublicApiKeyAuthorization = ApiEndpoint<{
38
+ Audit: {
39
+ kind: 'no-audit';
40
+ reason: 'TODO: audit coverage pending';
41
+ };
38
42
  Method: 'POST';
39
43
  Body: {
40
44
  apiKey: string;
@@ -47,23 +51,11 @@ export type PostPublicApiKeyAuthorization = Endpoint<{
47
51
  Error: AuthErrors;
48
52
  Success: ConnectionResponseSuccess;
49
53
  }>;
50
- export type PostPublicAppStoreAuthorization = Endpoint<{
51
- Method: 'POST';
52
- Body: {
53
- privateKeyId: string;
54
- privateKey: string;
55
- issuerId: string;
56
- scope?: string | undefined;
54
+ export type PostPublicBasicAuthorization = ApiEndpoint<{
55
+ Audit: {
56
+ kind: 'no-audit';
57
+ reason: 'TODO: audit coverage pending';
57
58
  };
58
- Querystring: ConnectionQueryString;
59
- Params: {
60
- providerConfigKey: string;
61
- };
62
- Path: '/app-store-auth/:providerConfigKey';
63
- Error: AuthErrors;
64
- Success: ConnectionResponseSuccess;
65
- }>;
66
- export type PostPublicBasicAuthorization = Endpoint<{
67
59
  Method: 'POST';
68
60
  Body: {
69
61
  username: string;
@@ -77,7 +69,11 @@ export type PostPublicBasicAuthorization = Endpoint<{
77
69
  Error: AuthErrors;
78
70
  Success: ConnectionResponseSuccess;
79
71
  }>;
80
- export type PostPublicTbaAuthorization = Endpoint<{
72
+ export type PostPublicTbaAuthorization = ApiEndpoint<{
73
+ Audit: {
74
+ kind: 'no-audit';
75
+ reason: 'TODO: audit coverage pending';
76
+ };
81
77
  Method: 'POST';
82
78
  Body: {
83
79
  token_id: string;
@@ -94,7 +90,11 @@ export type PostPublicTbaAuthorization = Endpoint<{
94
90
  Error: AuthErrors;
95
91
  Success: ConnectionResponseSuccess;
96
92
  }>;
97
- export type PostPublicJwtAuthorization = Endpoint<{
93
+ export type PostPublicJwtAuthorization = ApiEndpoint<{
94
+ Audit: {
95
+ kind: 'no-audit';
96
+ reason: 'TODO: audit coverage pending';
97
+ };
98
98
  Method: 'POST';
99
99
  Body: Record<string, any>;
100
100
  Querystring: ConnectionQueryString;
@@ -105,7 +105,11 @@ export type PostPublicJwtAuthorization = Endpoint<{
105
105
  Error: AuthErrors;
106
106
  Success: ConnectionResponseSuccess;
107
107
  }>;
108
- export type PostPublicUnauthenticatedAuthorization = Endpoint<{
108
+ export type PostPublicUnauthenticatedAuthorization = ApiEndpoint<{
109
+ Audit: {
110
+ kind: 'no-audit';
111
+ reason: 'TODO: audit coverage pending';
112
+ };
109
113
  Method: 'POST';
110
114
  Querystring: ConnectionQueryString;
111
115
  Params: {
@@ -115,7 +119,11 @@ export type PostPublicUnauthenticatedAuthorization = Endpoint<{
115
119
  Error: AuthErrors;
116
120
  Success: ConnectionResponseSuccess;
117
121
  }>;
118
- export type PostPublicBillAuthorization = Endpoint<{
122
+ export type PostPublicBillAuthorization = ApiEndpoint<{
123
+ Audit: {
124
+ kind: 'no-audit';
125
+ reason: 'TODO: audit coverage pending';
126
+ };
119
127
  Method: 'POST';
120
128
  Body: {
121
129
  username: string;
@@ -131,7 +139,11 @@ export type PostPublicBillAuthorization = Endpoint<{
131
139
  Error: AuthErrors;
132
140
  Success: ConnectionResponseSuccess;
133
141
  }>;
134
- export type PostPublicTwoStepAuthorization = Endpoint<{
142
+ export type PostPublicTwoStepAuthorization = ApiEndpoint<{
143
+ Audit: {
144
+ kind: 'no-audit';
145
+ reason: 'TODO: audit coverage pending';
146
+ };
135
147
  Method: 'POST';
136
148
  Body: Record<string, any>;
137
149
  Querystring: ConnectionQueryString;
@@ -142,7 +154,11 @@ export type PostPublicTwoStepAuthorization = Endpoint<{
142
154
  Error: AuthErrors;
143
155
  Success: ConnectionResponseSuccess;
144
156
  }>;
145
- export type PostPublicSignatureAuthorization = Endpoint<{
157
+ export type PostPublicSignatureAuthorization = ApiEndpoint<{
158
+ Audit: {
159
+ kind: 'no-audit';
160
+ reason: 'TODO: audit coverage pending';
161
+ };
146
162
  Method: 'POST';
147
163
  Body: {
148
164
  username: string;
@@ -157,7 +173,11 @@ export type PostPublicSignatureAuthorization = Endpoint<{
157
173
  Success: ConnectionResponseSuccess;
158
174
  }>;
159
175
  type AwsSigV4AuthErrors = AuthErrors | ApiError<'invalid_aws_sigv4_config'> | ApiError<'missing_aws_sigv4_service'> | ApiError<'missing_aws_sigv4_sts_endpoint'> | ApiError<'missing_aws_sigv4_builtin_credentials'> | ApiError<'missing_aws_sigv4_region'> | ApiError<'aws_sigv4_sts_request_failed'>;
160
- export type PostPublicAwsSigV4Authorization = Endpoint<{
176
+ export type PostPublicAwsSigV4Authorization = ApiEndpoint<{
177
+ Audit: {
178
+ kind: 'no-audit';
179
+ reason: 'TODO: audit coverage pending';
180
+ };
161
181
  Method: 'POST';
162
182
  Body: {
163
183
  role_arn: string;
@@ -171,7 +191,11 @@ export type PostPublicAwsSigV4Authorization = Endpoint<{
171
191
  Error: AwsSigV4AuthErrors;
172
192
  Success: ConnectionResponseSuccess;
173
193
  }>;
174
- export type PostPublicOauthOutboundAuthorization = Endpoint<{
194
+ export type PostPublicOauthOutboundAuthorization = ApiEndpoint<{
195
+ Audit: {
196
+ kind: 'no-audit';
197
+ reason: 'TODO: audit coverage pending';
198
+ };
175
199
  Method: 'POST';
176
200
  Body: {
177
201
  username: string;
@@ -1,6 +1,6 @@
1
1
  import type { Role } from '../user/db.js';
2
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' | 'environment_variable' | 'webhook' | 'integration' | 'connection' | 'flow' | 'sync_command' | 'secret_key' | 'connection_credential' | 'log' | '*';
3
+ export type Resource = 'team' | 'team_member' | 'invite' | 'connect_ui_settings' | 'billing' | 'plan' | 'environment' | 'environment_production_flag' | 'environment_key' | 'environment_variable' | 'webhook' | 'integration' | 'connection' | 'flow' | 'sync_command' | 'secret_key' | 'connection_credential' | 'log' | 'audit_trail' | '*';
4
4
  export type Scope = 'production' | 'non-production' | 'global';
5
5
  export interface Permission {
6
6
  action: Action;
@@ -1,5 +1,9 @@
1
- import type { Endpoint } from '../api.js';
2
- export type PostOrbWebhooks = Endpoint<{
1
+ import type { ApiEndpoint } from '../api.js';
2
+ export type PostOrbWebhooks = ApiEndpoint<{
3
+ Audit: {
4
+ kind: 'no-audit';
5
+ reason: 'non-auditable';
6
+ };
3
7
  Method: 'POST';
4
8
  Path: '/api/v1/orb/webhooks';
5
9
  Body: any;
package/dist/cli/api.d.ts CHANGED
@@ -1,6 +1,10 @@
1
- import type { Endpoint } from '../api.js';
1
+ import type { ApiEndpoint } from '../api.js';
2
2
  export type CliTelemetryEvent = 'cli:init' | 'cli:create' | 'cli:compile' | 'cli:dev' | 'cli:dryrun' | 'cli:generate:docs' | 'cli:generate:tests' | 'cli:clone' | 'cli:migrate_to_zero_yaml' | 'cli:deploy' | 'cli:pull';
3
- export type PostCliTelemetry = Endpoint<{
3
+ export type PostCliTelemetry = ApiEndpoint<{
4
+ Audit: {
5
+ kind: 'no-audit';
6
+ reason: 'non-auditable';
7
+ };
4
8
  Method: 'POST';
5
9
  Path: '/cli/telemetry';
6
10
  Body: {
@@ -1,5 +1,9 @@
1
- import type { ApiError, Endpoint } from '../api.js';
2
- export type GetPublicClientMetadata = Endpoint<{
1
+ import type { ApiEndpoint, ApiError } from '../api.js';
2
+ export type GetPublicClientMetadata = ApiEndpoint<{
3
+ Audit: {
4
+ kind: 'no-audit';
5
+ reason: 'non-auditable';
6
+ };
3
7
  Method: 'GET';
4
8
  Path: '/oauth/client-metadata/:environmentUuid/:providerConfigKey';
5
9
  Params: {
@@ -1,4 +1,4 @@
1
- import type { Endpoint } from '../api.js';
1
+ import type { ApiEndpoint } from '../api.js';
2
2
  import type { ConnectUISettings } from '../connectUISettings/dto.js';
3
3
  import type { ApiEndUser } from '../endUser/index.js';
4
4
  export interface ConnectSessionInput {
@@ -33,6 +33,11 @@ export type ConnectSessionOutput = Omit<ConnectSessionInput, 'end_user' | 'organ
33
33
  endUser: ApiEndUser | null;
34
34
  isReconnecting?: boolean;
35
35
  connectUISettings: ConnectUISettings;
36
+ /**
37
+ * Server-side WebSocket upgrade path (NANGO_SERVER_WEBSOCKETS_PATH), sent on self-hosted
38
+ * deployments so Connect UI opens its OAuth-result socket on the matching path.
39
+ */
40
+ websocketsPath?: string;
36
41
  };
37
42
  export type PostConnectSessionsBody = ConnectSessionInput | (Omit<ConnectSessionInput, 'end_user' | 'tags'> & {
38
43
  /**
@@ -41,7 +46,11 @@ export type PostConnectSessionsBody = ConnectSessionInput | (Omit<ConnectSession
41
46
  tags: NonNullable<ConnectSessionInput['tags']>;
42
47
  end_user?: ConnectSessionInput['end_user'] | undefined;
43
48
  });
44
- export type PostConnectSessions = Endpoint<{
49
+ export type PostConnectSessions = ApiEndpoint<{
50
+ Audit: {
51
+ kind: 'no-audit';
52
+ reason: 'non-auditable';
53
+ };
45
54
  Method: 'POST';
46
55
  Path: '/connect/sessions';
47
56
  Body: PostConnectSessionsBody;
@@ -53,7 +62,11 @@ export type PostConnectSessions = Endpoint<{
53
62
  };
54
63
  };
55
64
  }>;
56
- export type PostPublicConnectSessionsReconnect = Endpoint<{
65
+ export type PostPublicConnectSessionsReconnect = ApiEndpoint<{
66
+ Audit: {
67
+ kind: 'no-audit';
68
+ reason: 'non-auditable';
69
+ };
57
70
  Method: 'POST';
58
71
  Path: '/connect/sessions/reconnect';
59
72
  Body: {
@@ -74,25 +87,41 @@ export type PostPublicConnectSessionsReconnect = Endpoint<{
74
87
  };
75
88
  };
76
89
  }>;
77
- export type GetConnectSession = Endpoint<{
90
+ export type GetConnectSession = ApiEndpoint<{
91
+ Audit: {
92
+ kind: 'no-audit';
93
+ reason: 'non-auditable';
94
+ };
78
95
  Method: 'GET';
79
96
  Path: '/connect/session';
80
97
  Success: {
81
98
  data: ConnectSessionOutput;
82
99
  };
83
100
  }>;
84
- export type DeleteConnectSession = Endpoint<{
101
+ export type DeleteConnectSession = ApiEndpoint<{
102
+ Audit: {
103
+ kind: 'no-audit';
104
+ reason: 'non-auditable';
105
+ };
85
106
  Method: 'DELETE';
86
107
  Path: '/connect/session';
87
108
  Success: never;
88
109
  }>;
89
- export type PostInternalConnectSessions = Endpoint<{
110
+ export type PostInternalConnectSessions = ApiEndpoint<{
111
+ Audit: {
112
+ kind: 'no-audit';
113
+ reason: 'non-auditable';
114
+ };
90
115
  Method: 'POST';
91
116
  Path: '/api/v1/connect/sessions';
92
117
  Success: PostConnectSessions['Success'];
93
118
  Body: Pick<ConnectSessionInput, 'allowed_integrations' | 'end_user' | 'organization' | 'integrations_config_defaults' | 'overrides' | 'webhook_url_override'>;
94
119
  }>;
95
- export type PostPublicConnectTelemetry = Endpoint<{
120
+ export type PostPublicConnectTelemetry = ApiEndpoint<{
121
+ Audit: {
122
+ kind: 'no-audit';
123
+ reason: 'non-auditable';
124
+ };
96
125
  Method: 'POST';
97
126
  Path: '/connect/telemetry';
98
127
  Body: {
@@ -1,6 +1,10 @@
1
- import type { ApiError, Endpoint } from '../api.js';
1
+ import type { ApiEndpoint, ApiError } from '../api.js';
2
2
  import type { ConnectUISettings } from './dto.js';
3
- export type GetConnectUISettings = Endpoint<{
3
+ export type GetConnectUISettings = ApiEndpoint<{
4
+ Audit: {
5
+ kind: 'no-audit';
6
+ reason: 'non-auditable';
7
+ };
4
8
  Method: 'GET';
5
9
  Path: '/api/v1/connect-ui-settings';
6
10
  Querystring: {
@@ -11,7 +15,11 @@ export type GetConnectUISettings = Endpoint<{
11
15
  };
12
16
  Error: ApiError<'failed_to_get_connect_ui_settings'>;
13
17
  }>;
14
- export type PutConnectUISettings = Endpoint<{
18
+ export type PutConnectUISettings = ApiEndpoint<{
19
+ Audit: {
20
+ kind: 'no-audit';
21
+ reason: 'non-auditable';
22
+ };
15
23
  Method: 'PUT';
16
24
  Path: '/api/v1/connect-ui-settings';
17
25
  Querystring: {
@@ -1,4 +1,5 @@
1
- import type { ApiError, ApiTimestamps, Endpoint } from '../../api.js';
1
+ import type { ApiEndpoint, ApiError, ApiTimestamps } from '../../api.js';
2
+ import type { AuditPolicy } from '../../audit-trail/event.js';
2
3
  import type { ApiKeyCredentials, ApiPublicAllAuthCredentials, BasicApiCredentials, OAuth1Credentials, OAuth2ClientCredentials, OAuth2Credentials, TbaCredentials } from '../../auth/api.js';
3
4
  import type { EndUserInput } from '../../connect/api.js';
4
5
  import type { Tags } from '../../db.js';
@@ -17,7 +18,11 @@ export type ApiConnectionSimple = Pick<Merge<DBConnection, ApiTimestamps>, 'id'
17
18
  tags: Tags;
18
19
  pausedSyncs: string[];
19
20
  };
20
- export type GetConnections = Endpoint<{
21
+ export type GetConnections = ApiEndpoint<{
22
+ Audit: {
23
+ kind: 'no-audit';
24
+ reason: 'non-auditable';
25
+ };
21
26
  Method: 'GET';
22
27
  Querystring: {
23
28
  env: string;
@@ -31,7 +36,11 @@ export type GetConnections = Endpoint<{
31
36
  data: ApiConnectionSimple[];
32
37
  };
33
38
  }>;
34
- export type GetConnectionsCount = Endpoint<{
39
+ export type GetConnectionsCount = ApiEndpoint<{
40
+ Audit: {
41
+ kind: 'no-audit';
42
+ reason: 'non-auditable';
43
+ };
35
44
  Method: 'GET';
36
45
  Querystring: {
37
46
  env: string;
@@ -58,7 +67,11 @@ export type ApiPublicConnection = Pick<DBConnection, 'id' | 'connection_id'> & {
58
67
  end_user: ApiEndUser | null;
59
68
  tags: Tags;
60
69
  };
61
- export type GetPublicConnections = Endpoint<{
70
+ export type GetPublicConnections = ApiEndpoint<{
71
+ Audit: {
72
+ kind: 'no-audit';
73
+ reason: 'non-auditable';
74
+ };
62
75
  Method: 'GET';
63
76
  Querystring: {
64
77
  connectionId?: string | undefined;
@@ -75,7 +88,8 @@ export type GetPublicConnections = Endpoint<{
75
88
  connections: ApiPublicConnection[];
76
89
  };
77
90
  }>;
78
- export type PostPublicConnection = Endpoint<{
91
+ export type PostPublicConnection = ApiEndpoint<{
92
+ Audit: AuditPolicy<'connection', 'created', 'environment'>;
79
93
  Method: 'POST';
80
94
  Path: '/connections';
81
95
  Body: {
@@ -102,7 +116,7 @@ export type PostPublicConnection = Endpoint<{
102
116
  Success: ApiPublicConnectionFull;
103
117
  }>;
104
118
  export type ApiConnectionFull = Omit<ReplaceInObject<DBConnectionDecrypted, Date, string>, 'credentials_iv' | 'end_user_id' | 'credentials_tag' | 'deleted' | 'deleted_at'>;
105
- export type GetConnection = Endpoint<{
119
+ export type GetConnection = ApiEndpoint<{
106
120
  Method: 'GET';
107
121
  Params: {
108
122
  connectionId: string;
@@ -113,6 +127,10 @@ export type GetConnection = Endpoint<{
113
127
  };
114
128
  Path: '/api/v1/connections/:connectionId';
115
129
  Error: ApiError<'unknown_provider_config'>;
130
+ Audit: {
131
+ kind: 'no-audit';
132
+ reason: 'non-auditable';
133
+ };
116
134
  Success: {
117
135
  data: {
118
136
  provider: string;
@@ -137,7 +155,11 @@ export type ApiPublicConnectionFull = Pick<DBConnection, 'id' | 'connection_id'
137
155
  tags: Tags;
138
156
  credentials: ApiPublicAllAuthCredentials;
139
157
  };
140
- export type GetPublicConnection = Endpoint<{
158
+ export type GetPublicConnection = ApiEndpoint<{
159
+ Audit: {
160
+ kind: 'no-audit';
161
+ reason: 'non-auditable';
162
+ };
141
163
  Method: 'GET';
142
164
  Params: {
143
165
  connectionId: string;
@@ -152,7 +174,8 @@ export type GetPublicConnection = Endpoint<{
152
174
  Error: ApiError<'unknown_provider_config' | 'invalid_credentials'>;
153
175
  Success: ApiPublicConnectionFull;
154
176
  }>;
155
- export type PatchPublicConnection = Endpoint<{
177
+ export type PatchPublicConnection = ApiEndpoint<{
178
+ Audit: AuditPolicy<'connection', 'updated', 'environment'>;
156
179
  Method: 'PATCH';
157
180
  Path: '/connections/:connectionId';
158
181
  Params: {
@@ -171,7 +194,8 @@ export type PatchPublicConnection = Endpoint<{
171
194
  };
172
195
  Error: ApiError<'unknown_provider_config' | 'not_found' | 'server_error' | 'invalid_body'>;
173
196
  }>;
174
- export type PatchConnection = Endpoint<{
197
+ export type PatchConnection = ApiEndpoint<{
198
+ Audit: AuditPolicy<'connection', 'updated', 'environment'>;
175
199
  Method: 'PATCH';
176
200
  Path: '/api/v1/connections/:connectionId';
177
201
  Params: {
@@ -191,7 +215,8 @@ export type PatchConnection = Endpoint<{
191
215
  };
192
216
  Error: ApiError<'unknown_provider_config' | 'not_found' | 'server_error' | 'invalid_body'>;
193
217
  }>;
194
- export type PostConnectionRefresh = Endpoint<{
218
+ export type PostConnectionRefresh = ApiEndpoint<{
219
+ Audit: AuditPolicy<'connection', 'refreshed', 'environment'>;
195
220
  Method: 'POST';
196
221
  Params: {
197
222
  connectionId: string;
@@ -208,7 +233,8 @@ export type PostConnectionRefresh = Endpoint<{
208
233
  };
209
234
  };
210
235
  }>;
211
- export type DeletePublicConnection = Endpoint<{
236
+ export type DeletePublicConnection = ApiEndpoint<{
237
+ Audit: AuditPolicy<'connection', 'deleted', 'environment'>;
212
238
  Method: 'DELETE';
213
239
  Path: '/connection/:connectionId';
214
240
  Params: {
@@ -222,7 +248,7 @@ export type DeletePublicConnection = Endpoint<{
222
248
  success: boolean;
223
249
  };
224
250
  }>;
225
- export type DeleteConnection = Endpoint<{
251
+ export type DeleteConnection = ApiEndpoint<{
226
252
  Method: 'DELETE';
227
253
  Path: '/api/v1/connections/:connectionId';
228
254
  Params: {
@@ -236,4 +262,5 @@ export type DeleteConnection = Endpoint<{
236
262
  Success: {
237
263
  success: boolean;
238
264
  };
265
+ Audit: AuditPolicy<'connection', 'deleted', 'environment'>;
239
266
  }>;
@@ -1,4 +1,5 @@
1
- import type { ApiError, Endpoint } from '../../api.js';
1
+ import type { ApiEndpoint, ApiError } from '../../api.js';
2
+ import type { AuditPolicy } from '../../audit-trail/event.js';
2
3
  import type { Metadata } from '../db.js';
3
4
  export interface MetadataBody {
4
5
  connection_id: string | string[];
@@ -6,21 +7,24 @@ export interface MetadataBody {
6
7
  metadata: Metadata;
7
8
  }
8
9
  type MetadataError = ApiError<'invalid_body'> | ApiError<'unknown_connection'>;
9
- export type SetMetadata = Endpoint<{
10
+ export type SetMetadata = ApiEndpoint<{
11
+ Audit: AuditPolicy<'connection', 'metadata_updated', 'environment'>;
10
12
  Method: 'POST';
11
13
  Body: MetadataBody;
12
14
  Path: '/connection/metadata';
13
15
  Error: MetadataError;
14
16
  Success: MetadataBody;
15
17
  }>;
16
- export type UpdateMetadata = Endpoint<{
18
+ export type UpdateMetadata = ApiEndpoint<{
19
+ Audit: AuditPolicy<'connection', 'metadata_updated', 'environment'>;
17
20
  Method: 'PATCH';
18
21
  Path: '/connection/metadata';
19
22
  Body: MetadataBody;
20
23
  Error: MetadataError;
21
24
  Success: MetadataBody;
22
25
  }>;
23
- export type PostConnectionMetadata = Endpoint<{
26
+ export type PostConnectionMetadata = ApiEndpoint<{
27
+ Audit: AuditPolicy<'connection', 'metadata_updated', 'environment'>;
24
28
  Method: 'POST';
25
29
  Path: '/api/v1/connections/:connectionId/metadata';
26
30
  Params: {
package/dist/db.d.ts CHANGED
@@ -10,8 +10,13 @@ export interface DeletedCorrect {
10
10
  deleted_at: Date | null;
11
11
  deleted: boolean;
12
12
  }
13
+ export interface DeletedAt {
14
+ deleted_at: Date | null;
15
+ }
13
16
  export interface TimestampsAndDeleted extends Timestamps, Deleted {
14
17
  }
15
18
  export interface TimestampsAndDeletedCorrect extends Timestamps, DeletedCorrect {
16
19
  }
20
+ export interface TimestampsAndDeletedAt extends Timestamps, DeletedAt {
21
+ }
17
22
  export type Tags = Record<string, string>;
@@ -1,10 +1,15 @@
1
- import type { ApiError, Endpoint } from '../api.js';
1
+ import type { ApiEndpoint, ApiError } from '../api.js';
2
+ import type { AuditPolicy } from '../audit-trail/event.js';
2
3
  import type { OnEventType } from '../scripts/on-events/api.js';
3
4
  import type { FunctionSource } from '../syncConfigs/db.js';
4
5
  import type { CLIDeployFlowConfig, OnEventScriptsByProvider } from './incomingFlow.js';
5
6
  import type { SyncDeploymentResult } from './index.js';
6
7
  import type { JSONSchema7 } from 'json-schema';
7
- export type PostDeployConfirmation = Endpoint<{
8
+ export type PostDeployConfirmation = ApiEndpoint<{
9
+ Audit: {
10
+ kind: 'no-audit';
11
+ reason: 'TODO: audit coverage pending';
12
+ };
8
13
  Method: 'POST';
9
14
  Path: '/sync/deploy/confirmation';
10
15
  Body: {
@@ -19,7 +24,8 @@ export type PostDeployConfirmation = Endpoint<{
19
24
  };
20
25
  Success: ScriptDifferences;
21
26
  }>;
22
- export type PostDeploy = Endpoint<{
27
+ export type PostDeploy = ApiEndpoint<{
28
+ Audit: AuditPolicy<'function', 'deployed', 'environment'>;
23
29
  Method: 'POST';
24
30
  Path: '/sync/deploy';
25
31
  Body: {
@@ -36,7 +42,11 @@ export type PostDeploy = Endpoint<{
36
42
  };
37
43
  Success: SyncDeploymentResult[];
38
44
  }>;
39
- export type PostDeployInternal = Endpoint<{
45
+ export type PostDeployInternal = ApiEndpoint<{
46
+ Audit: {
47
+ kind: 'no-audit';
48
+ reason: 'TODO: audit coverage pending';
49
+ };
40
50
  Method: 'POST';
41
51
  Path: '/sync/deploy/internal';
42
52
  Querystring: {
@@ -1,5 +1,6 @@
1
1
  import type { ApiKeyScope } from '../../api-keys/scopes.js';
2
- import type { ApiError, ApiTimestamps, Endpoint } from '../../api.js';
2
+ import type { ApiEndpoint, ApiError, ApiTimestamps } from '../../api.js';
3
+ import type { AuditPolicy } from '../../audit-trail/event.js';
3
4
  import type { ApiPlan } from '../../plans/http.api.js';
4
5
  import type { DBEnvironment, DBExternalWebhook } from '../db.js';
5
6
  import type { ApiEnvironmentVariable } from '../variable/api.js';
@@ -8,14 +9,19 @@ export type ApiEnvironment = Merge<DBEnvironment, {
8
9
  callback_url: string;
9
10
  } & ApiTimestamps>;
10
11
  export type ApiWebhooks = Omit<DBExternalWebhook, 'id' | 'environment_id' | 'created_at' | 'updated_at'>;
11
- export type GetEnvironments = Endpoint<{
12
+ export type GetEnvironments = ApiEndpoint<{
13
+ Audit: {
14
+ kind: 'no-audit';
15
+ reason: 'non-auditable';
16
+ };
12
17
  Method: 'GET';
13
18
  Path: '/api/v1/environments';
14
19
  Success: {
15
20
  data: Pick<DBEnvironment, 'name' | 'is_production'>[];
16
21
  };
17
22
  }>;
18
- export type PostEnvironment = Endpoint<{
23
+ export type PostEnvironment = ApiEndpoint<{
24
+ Audit: AuditPolicy<'environment', 'created', 'account'>;
19
25
  Method: 'POST';
20
26
  Path: '/api/v1/environments';
21
27
  Body: {
@@ -25,7 +31,11 @@ export type PostEnvironment = Endpoint<{
25
31
  data: Pick<DBEnvironment, 'id' | 'name'>;
26
32
  };
27
33
  }>;
28
- export type GetEnvironment = Endpoint<{
34
+ export type GetEnvironment = ApiEndpoint<{
35
+ Audit: {
36
+ kind: 'no-audit';
37
+ reason: 'non-auditable';
38
+ };
29
39
  Method: 'GET';
30
40
  Path: '/api/v1/environments/current';
31
41
  Success: {
@@ -43,7 +53,8 @@ export type GetEnvironment = Endpoint<{
43
53
  };
44
54
  };
45
55
  }>;
46
- export type PatchEnvironment = Endpoint<{
56
+ export type PatchEnvironment = ApiEndpoint<{
57
+ Audit: AuditPolicy<'environment', 'updated', 'environment'>;
47
58
  Method: 'PATCH';
48
59
  Path: '/api/v1/environments';
49
60
  Body: {
@@ -64,13 +75,18 @@ export type PatchEnvironment = Endpoint<{
64
75
  };
65
76
  Error: ApiError<'conflict' | 'cannot_toggle_prod_environment'>;
66
77
  }>;
67
- export type DeleteEnvironment = Endpoint<{
78
+ export type DeleteEnvironment = ApiEndpoint<{
79
+ Audit: AuditPolicy<'environment', 'deleted', 'environment'>;
68
80
  Method: 'DELETE';
69
81
  Path: '/api/v1/environments';
70
82
  Success: never;
71
83
  Error: ApiError<'cannot_delete_prod_environment'>;
72
84
  }>;
73
- export type GetPublicEnvironmentVariables = Endpoint<{
85
+ export type GetPublicEnvironmentVariables = ApiEndpoint<{
86
+ Audit: {
87
+ kind: 'no-audit';
88
+ reason: 'non-auditable';
89
+ };
74
90
  Method: 'GET';
75
91
  Path: '/api/v1/environment-variables';
76
92
  Success: {
@@ -78,7 +94,11 @@ export type GetPublicEnvironmentVariables = Endpoint<{
78
94
  value: string;
79
95
  }[];
80
96
  }>;
81
- export type ListApiKeys = Endpoint<{
97
+ export type ListApiKeys = ApiEndpoint<{
98
+ Audit: {
99
+ kind: 'no-audit';
100
+ reason: 'non-auditable';
101
+ };
82
102
  Method: 'GET';
83
103
  Path: '/api/v1/environment/api-keys';
84
104
  Success: {
@@ -92,7 +112,8 @@ export type ListApiKeys = Endpoint<{
92
112
  }[];
93
113
  };
94
114
  }>;
95
- export type CreateApiKey = Endpoint<{
115
+ export type CreateApiKey = ApiEndpoint<{
116
+ Audit: AuditPolicy<'api_key', 'created', 'environment'>;
96
117
  Method: 'POST';
97
118
  Path: '/api/v1/environment/api-keys';
98
119
  Body: {
@@ -110,7 +131,8 @@ export type CreateApiKey = Endpoint<{
110
131
  };
111
132
  Error: ApiError<'conflict' | 'resource_capped'>;
112
133
  }>;
113
- export type DeleteApiKey = Endpoint<{
134
+ export type DeleteApiKey = ApiEndpoint<{
135
+ Audit: AuditPolicy<'api_key', 'deleted', 'environment'>;
114
136
  Method: 'DELETE';
115
137
  Path: '/api/v1/environment/api-keys/:keyId';
116
138
  Params: {
@@ -120,7 +142,8 @@ export type DeleteApiKey = Endpoint<{
120
142
  success: true;
121
143
  };
122
144
  }>;
123
- export type PatchApiKey = Endpoint<{
145
+ export type PatchApiKey = ApiEndpoint<{
146
+ Audit: AuditPolicy<'api_key', 'updated', 'environment'>;
124
147
  Method: 'PATCH';
125
148
  Path: '/api/v1/environment/api-keys/:keyId';
126
149
  Params: {
@@ -1,9 +1,13 @@
1
- import type { ApiError, Endpoint } from '../../api.js';
1
+ import type { ApiEndpoint, ApiError } from '../../api.js';
2
2
  export interface OtlpSettings {
3
3
  endpoint: string;
4
4
  headers: Record<string, string>;
5
5
  }
6
- export type UpdateOtlpSettings = Endpoint<{
6
+ export type UpdateOtlpSettings = ApiEndpoint<{
7
+ Audit: {
8
+ kind: 'no-audit';
9
+ reason: 'TODO: audit coverage pending';
10
+ };
7
11
  Method: 'POST';
8
12
  Querystring: {
9
13
  env: string;