@nangohq/types 0.71.4 → 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.
Files changed (40) hide show
  1. package/dist/account/api.d.ts +48 -2
  2. package/dist/action/api.d.ts +4 -0
  3. package/dist/admin/http.api.d.ts +1 -1
  4. package/dist/agent/api.d.ts +88 -0
  5. package/dist/agent/connections.d.ts +44 -0
  6. package/dist/agent/mcp.api.d.ts +28 -0
  7. package/dist/agent/session.d.ts +20 -0
  8. package/dist/agent/toolset.d.ts +43 -0
  9. package/dist/api-keys/scopes.d.ts +9 -4
  10. package/dist/api.endpoints.d.ts +9 -7
  11. package/dist/audit-trail/api.d.ts +19 -7
  12. package/dist/audit-trail/event.d.ts +20 -3
  13. package/dist/auth/http.api.d.ts +11 -40
  14. package/dist/authz/types.d.ts +1 -1
  15. package/dist/billing/types.d.ts +46 -0
  16. package/dist/connection/api/get.d.ts +1 -1
  17. package/dist/connection/api/metadata.d.ts +8 -2
  18. package/dist/environment/api/index.d.ts +86 -0
  19. package/dist/function/trigger.d.ts +61 -0
  20. package/dist/functions/api.d.ts +35 -0
  21. package/dist/index.d.ts +8 -2
  22. package/dist/keystore/index.d.ts +10 -2
  23. package/dist/logs/messages.d.ts +23 -2
  24. package/dist/mfa/api.d.ts +2 -7
  25. package/dist/mfa/credential.d.ts +7 -0
  26. package/dist/mfa/db.d.ts +1 -0
  27. package/dist/persist/api.d.ts +1 -1
  28. package/dist/plans/db.d.ts +20 -0
  29. package/dist/plans/http.api.d.ts +109 -0
  30. package/dist/pubsub/events.d.ts +2 -2
  31. package/dist/runner/sdk.d.ts +1 -1
  32. package/dist/sharedCredentials/api.d.ts +2 -0
  33. package/dist/sharedCredentials/db.d.ts +1 -0
  34. package/dist/sharedCredentials/dto.d.ts +1 -1
  35. package/dist/stripe/http.api.d.ts +3 -0
  36. package/dist/sync/api.d.ts +1 -1
  37. package/dist/usage/index.d.ts +1 -1
  38. package/dist/user/api.d.ts +5 -1
  39. package/dist/web/env.d.ts +3 -0
  40. package/package.json +1 -1
@@ -8,6 +8,14 @@ export interface BillingClient {
8
8
  getCustomer: (accountId: number) => Promise<Result<BillingCustomer>>;
9
9
  putCustomer: (accountId: number, invoicingDetails: BillingInvoicingDetails) => Promise<Result<BillingCustomer>>;
10
10
  getSubscription: (accountId: number) => Promise<Result<BillingSubscription | null>>;
11
+ getOverdueInvoices: (accountId: number) => Promise<Result<BillingOverdueInvoices>>;
12
+ getUpcomingInvoice: (subscriptionId: string) => Promise<Result<BillingUpcomingInvoice | null>>;
13
+ getPeriodCosts: (subscriptionId: string) => Promise<Result<BillingPeriodCosts | null>>;
14
+ getSpendAlert: (subscriptionId: string) => Promise<Result<BillingSpendAlert | null>>;
15
+ setSpendAlert: (subscriptionId: string, opts: {
16
+ thresholdInCents: number;
17
+ }) => Promise<Result<BillingSpendAlert>>;
18
+ removeSpendAlert: (subscriptionId: string) => Promise<Result<void>>;
11
19
  createSubscription: (team: DBTeam, planExternalId: string) => Promise<Result<BillingSubscription>>;
12
20
  getUsage: (subscriptionId: string, opts?: GetBillingUsageOpts) => Promise<Result<BillingUsageMetrics>>;
13
21
  upgrade: (opts: {
@@ -49,6 +57,7 @@ export interface BillingCustomer {
49
57
  export interface BillingInvoicingDetails {
50
58
  legalEntityName: string;
51
59
  email: string;
60
+ additionalEmails: string[];
52
61
  address: BillingAddress | null;
53
62
  taxId: BillingTaxId | null;
54
63
  }
@@ -70,6 +79,42 @@ export interface BillingSubscription {
70
79
  pendingChangeId?: string | undefined;
71
80
  planExternalId: string;
72
81
  }
82
+ export interface BillingOverdueInvoices {
83
+ hasOverdue: boolean;
84
+ }
85
+ /** Orb's upcoming invoice for a subscription — the whole invoice, not a month's slice of it. */
86
+ export interface BillingUpcomingInvoice {
87
+ amountInCents: number;
88
+ /** ISO 4217, uppercased. Orb's `credits` is rejected upstream. */
89
+ currency: string;
90
+ }
91
+ /** Orb's single `cost_exceeded` alert for a subscription; Orb holds all of its state. */
92
+ export interface BillingSpendAlert {
93
+ id: string;
94
+ thresholdInCents: number;
95
+ /** ISO 4217, uppercased. Null when Orb reports a unit that isn't a currency. */
96
+ currency: string | null;
97
+ }
98
+ export interface BillingPeriodCosts {
99
+ /** Integer cents charged this billing period per metric, excluding every fixed price. A metric is
100
+ * absent when the subscription carries no price for it, which is not the same as being charged 0. */
101
+ metrics: Partial<Record<UsageMetric, number>>;
102
+ /** Metrics with a real price whose charge we couldn't read — an unparseable amount, or a currency
103
+ * other prices don't share. A charge exists; we just can't state it, so it reads as a dash, not $0. */
104
+ malformedMetrics: UsageMetric[];
105
+ /** False when a price maps to no metric of ours, so an unpriced row can't safely claim $0 — the
106
+ * money might be one of theirs. */
107
+ fullyAttributed: boolean;
108
+ /** The individual prices behind `malformedMetrics` and a false `fullyAttributed`, for alerting —
109
+ * not sent over HTTP. */
110
+ flagged: {
111
+ priceId: string;
112
+ priceName: string;
113
+ metric: UsageMetric | null;
114
+ amountInCents: number | null;
115
+ }[];
116
+ currency: string;
117
+ }
73
118
  export type CounterUsageMetric = Exclude<UsageMetric, 'records' | 'connections'>;
74
119
  export type AvgUsageMetric = Extract<UsageMetric, 'records' | 'connections'>;
75
120
  export interface BreakdownDimensions {
@@ -77,6 +122,7 @@ export interface BreakdownDimensions {
77
122
  function_executions: 'environment_id' | 'integration_id' | 'connection_id' | 'function_name' | 'function_type' | 'success';
78
123
  function_logs: 'environment_id' | 'integration_id' | 'connection_id' | 'function_name' | 'function_type' | 'success';
79
124
  function_compute_gbms: 'environment_id' | 'integration_id' | 'connection_id' | 'function_name' | 'function_type' | 'success';
125
+ function_duration_seconds: 'environment_id' | 'integration_id' | 'connection_id' | 'function_name' | 'function_type' | 'success';
80
126
  webhook_forwards: 'environment_id' | 'integration_id' | 'connection_id' | 'success';
81
127
  records: 'environment_id' | 'integration_id' | 'connection_id' | 'model';
82
128
  connections: 'environment_id' | 'integration_id';
@@ -171,7 +171,7 @@ export type GetPublicConnection = ApiEndpoint<{
171
171
  refresh_github_app_jwt_token?: boolean | undefined;
172
172
  };
173
173
  Path: '/connection/:connectionId';
174
- Error: ApiError<'unknown_provider_config' | 'invalid_credentials'>;
174
+ Error: ApiError<'unknown_provider_config' | 'not_found' | 'invalid_credentials' | 'server_error'>;
175
175
  Success: ApiPublicConnectionFull;
176
176
  }>;
177
177
  export type PatchPublicConnection = ApiEndpoint<{
@@ -8,7 +8,10 @@ export interface MetadataBody {
8
8
  }
9
9
  type MetadataError = ApiError<'invalid_body'> | ApiError<'unknown_connection'>;
10
10
  export type SetMetadata = ApiEndpoint<{
11
- Audit: AuditPolicy<'connection', 'metadata_updated', 'environment'>;
11
+ Audit: {
12
+ kind: 'no-audit';
13
+ reason: 'data-plane operation';
14
+ };
12
15
  Method: 'POST';
13
16
  Body: MetadataBody;
14
17
  Path: '/connection/metadata';
@@ -16,7 +19,10 @@ export type SetMetadata = ApiEndpoint<{
16
19
  Success: MetadataBody;
17
20
  }>;
18
21
  export type UpdateMetadata = ApiEndpoint<{
19
- Audit: AuditPolicy<'connection', 'metadata_updated', 'environment'>;
22
+ Audit: {
23
+ kind: 'no-audit';
24
+ reason: 'data-plane operation';
25
+ };
20
26
  Method: 'PATCH';
21
27
  Path: '/connection/metadata';
22
28
  Body: MetadataBody;
@@ -30,6 +30,39 @@ export type PostEnvironment = ApiEndpoint<{
30
30
  Success: {
31
31
  data: Pick<DBEnvironment, 'id' | 'name'>;
32
32
  };
33
+ Error: ApiError<'conflict' | 'resource_capped' | 'invalid_is_prod_flag'>;
34
+ }>;
35
+ export type PostPublicEnvironment = ApiEndpoint<{
36
+ Audit: AuditPolicy<'environment', 'created', 'account'>;
37
+ Method: 'POST';
38
+ Path: '/environments';
39
+ Body: {
40
+ name: string;
41
+ is_production?: boolean | undefined;
42
+ callback_url?: string | undefined;
43
+ hmac_key?: string | undefined;
44
+ hmac_enabled?: boolean | undefined;
45
+ slack_notifications?: boolean | undefined;
46
+ otlp_endpoint?: string | undefined;
47
+ otlp_headers?: {
48
+ name: string;
49
+ value: string;
50
+ }[] | undefined;
51
+ };
52
+ Success: {
53
+ data: Pick<DBEnvironment, 'id' | 'name'>;
54
+ };
55
+ Error: ApiError<'conflict' | 'resource_capped' | 'invalid_is_prod_flag'>;
56
+ }>;
57
+ export type DeletePublicEnvironment = ApiEndpoint<{
58
+ Audit: AuditPolicy<'environment', 'deleted', 'account'>;
59
+ Method: 'DELETE';
60
+ Path: '/environments/:environmentId';
61
+ Params: {
62
+ environmentId: number;
63
+ };
64
+ Success: never;
65
+ Error: ApiError<'cannot_delete_prod_environment'>;
33
66
  }>;
34
67
  export type GetEnvironment = ApiEndpoint<{
35
68
  Audit: {
@@ -82,6 +115,28 @@ export type DeleteEnvironment = ApiEndpoint<{
82
115
  Success: never;
83
116
  Error: ApiError<'cannot_delete_prod_environment'>;
84
117
  }>;
118
+ export type PostRotateWebhookSigningKey = ApiEndpoint<{
119
+ Audit: AuditPolicy<'environment', 'webhook_signing_key_rotated', 'environment'>;
120
+ Method: 'POST';
121
+ Path: '/api/v1/environment/webhook-signing-key/rotate';
122
+ Success: {
123
+ data: {
124
+ webhook_signing_key: string;
125
+ };
126
+ };
127
+ Error: ApiError<'not_found'> | ApiError<'multiple_webhook_signing_keys'> | ApiError<'rotation_failed'>;
128
+ }>;
129
+ export type PostPublicRotateWebhookSigningKey = ApiEndpoint<{
130
+ Audit: AuditPolicy<'environment', 'webhook_signing_key_rotated', 'environment'>;
131
+ Method: 'POST';
132
+ Path: '/environment/webhook-signing-key/rotate';
133
+ Success: {
134
+ data: {
135
+ webhook_signing_key: string;
136
+ };
137
+ };
138
+ Error: ApiError<'not_found'> | ApiError<'multiple_webhook_signing_keys'> | ApiError<'rotation_failed'>;
139
+ }>;
85
140
  export type GetPublicEnvironmentVariables = ApiEndpoint<{
86
141
  Audit: {
87
142
  kind: 'no-audit';
@@ -131,6 +186,37 @@ export type CreateApiKey = ApiEndpoint<{
131
186
  };
132
187
  Error: ApiError<'conflict' | 'resource_capped'>;
133
188
  }>;
189
+ export type PostPublicApiKey = ApiEndpoint<{
190
+ Audit: AuditPolicy<'api_key', 'created', 'environment'>;
191
+ Method: 'POST';
192
+ Path: '/environment/api-keys';
193
+ Body: {
194
+ environment_id: number;
195
+ display_name: string;
196
+ };
197
+ Success: {
198
+ data: {
199
+ id: number;
200
+ display_name: string;
201
+ scopes: ApiKeyScope[];
202
+ secret: string;
203
+ created_at: string;
204
+ };
205
+ };
206
+ Error: ApiError<'conflict' | 'resource_capped'>;
207
+ }>;
208
+ export type DeletePublicApiKey = ApiEndpoint<{
209
+ Audit: AuditPolicy<'api_key', 'deleted', 'environment'>;
210
+ Method: 'DELETE';
211
+ Path: '/environment/api-keys';
212
+ Body: {
213
+ environment_id: number;
214
+ key_id: number;
215
+ };
216
+ Success: {
217
+ success: true;
218
+ };
219
+ }>;
134
220
  export type DeleteApiKey = ApiEndpoint<{
135
221
  Audit: AuditPolicy<'api_key', 'deleted', 'environment'>;
136
222
  Method: 'DELETE';
@@ -0,0 +1,61 @@
1
+ import type { HTTP_METHOD } from '../nangoYaml/index.js';
2
+ import type { OnEventType } from '../scripts/on-events/api.js';
3
+ import type { FunctionTriggerDefinition } from './config.js';
4
+ import type { JsonValue } from 'type-fest';
5
+ export type HttpRequest = {
6
+ method: HTTP_METHOD;
7
+ path: string;
8
+ headers: Record<string, string>;
9
+ query: Record<string, string>;
10
+ body: JsonValue;
11
+ };
12
+ export type CoalescedInfo = {
13
+ count: number;
14
+ firstSeenAt: string;
15
+ lastSeenAt: string;
16
+ };
17
+ type HttpPayload<TTrigger, TInput> = TTrigger extends {
18
+ debounce: {
19
+ take: 'all';
20
+ };
21
+ } ? TInput[] : TInput;
22
+ type TriggerBase = {
23
+ /**
24
+ * Present when the run carries connection context (invoke calls may pass one;
25
+ * HTTP/event may resolve one). Undefined for connection-less runs.
26
+ */
27
+ connection?: {
28
+ connectionId: string;
29
+ integrationId: string;
30
+ };
31
+ };
32
+ export type InvokeTrigger<TInput> = TriggerBase & {
33
+ kind: 'invoke';
34
+ input: TInput;
35
+ };
36
+ export type ScheduleTrigger = TriggerBase & {
37
+ kind: 'schedule';
38
+ input: null;
39
+ };
40
+ export type HttpTrigger<TTrigger, TInput> = TriggerBase & {
41
+ kind: 'http';
42
+ input: HttpPayload<TTrigger, TInput>;
43
+ request: HttpRequest;
44
+ subscriptions?: string[];
45
+ coalesced?: CoalescedInfo;
46
+ };
47
+ export type EventTrigger = TriggerBase & {
48
+ kind: 'event';
49
+ input: {
50
+ event: OnEventType;
51
+ };
52
+ };
53
+ export type Trigger<TTrigger extends FunctionTriggerDefinition | undefined, TInput> = TTrigger extends {
54
+ kind: 'schedule';
55
+ } ? ScheduleTrigger : TTrigger extends {
56
+ kind: 'http';
57
+ } ? HttpTrigger<TTrigger, TInput> : TTrigger extends {
58
+ kind: 'event';
59
+ } ? EventTrigger : InvokeTrigger<TInput>;
60
+ export type FunctionTrigger = Trigger<FunctionTriggerDefinition, JsonValue>;
61
+ export {};
@@ -221,6 +221,40 @@ export type PostFunctionDeploymentResult = ApiEndpoint<{
221
221
  ok: true;
222
222
  };
223
223
  }>;
224
+ export type FunctionInvocationType = 'wait' | 'no_wait';
225
+ export type FunctionInvocationErrorCode = 'function_failed' | 'server_error' | 'connection_not_found' | 'function_not_found' | 'function_disabled' | 'validation_error' | 'invalid_invocation';
226
+ type FunctionInvocationSuccess = any;
227
+ export type PostFunctionInvocation = ApiEndpoint<{
228
+ Audit: {
229
+ kind: 'no-audit';
230
+ reason: 'non-auditable';
231
+ };
232
+ Method: 'POST';
233
+ Path: '/functions/invocations';
234
+ Body: {
235
+ connection_id: string;
236
+ integration_id: string;
237
+ name: string;
238
+ input?: unknown | undefined;
239
+ invocation_type: FunctionInvocationType;
240
+ options?: Record<string, unknown> | undefined;
241
+ };
242
+ Error: ApiError<FunctionInvocationErrorCode>;
243
+ Success: FunctionInvocationSuccess;
244
+ }>;
245
+ export type GetFunctionInvocation = ApiEndpoint<{
246
+ Audit: {
247
+ kind: 'no-audit';
248
+ reason: 'non-auditable';
249
+ };
250
+ Method: 'GET';
251
+ Path: '/functions/invocations/:id';
252
+ Params: {
253
+ id: string;
254
+ };
255
+ Error: ApiError<'invalid_uri_params' | 'not_found' | 'function_failed' | 'server_error'>;
256
+ Success: FunctionInvocationSuccess;
257
+ }>;
224
258
  export interface FunctionListFilters {
225
259
  type?: FunctionType;
226
260
  search?: string;
@@ -448,3 +482,4 @@ export type PostFunctionDeploymentBundle = ApiEndpoint<{
448
482
  Error: ApiError<'functions_deployment_error' | 'concurrent_deployment' | 'integration_not_found'>;
449
483
  Success: FunctionDeploymentBundleSuccess;
450
484
  }>;
485
+ export {};
package/dist/index.d.ts CHANGED
@@ -11,6 +11,11 @@ export type * from './logs/api.js';
11
11
  export type * from './logs/messages.js';
12
12
  export type * from './keystore/index.js';
13
13
  export type * from './action/api.js';
14
+ export type * from './agent/api.js';
15
+ export type * from './agent/connections.js';
16
+ export type * from './agent/mcp.api.js';
17
+ export type * from './agent/session.js';
18
+ export type * from './agent/toolset.js';
14
19
  export type * from './admin/http.api.js';
15
20
  export type * from './account/api.js';
16
21
  export type * from './account/context.js';
@@ -71,8 +76,7 @@ export type * from './proxy/http.api.js';
71
76
  export type * from './dbConfig/db.js';
72
77
  export type * from './nangoYaml/index.js';
73
78
  export type * from './environment/db.js';
74
- export { ACCOUNT_API_KEY_SCOPES, API_KEY_SCOPES } from './api-keys/scopes.js';
75
- export type { AccountApiKeyScope, ApiKeyScope, CustomerKeyScope } from './api-keys/scopes.js';
79
+ export type { ACCOUNT_API_KEY_SCOPES, AccountApiKeyScope, API_KEY_SCOPES, ApiKeyScope, ConcreteAccountApiKeyScope, ConcreteApiKeyScope, CustomerKeyScope, WildcardsFor } from './api-keys/scopes.js';
76
80
  export type * from './api-keys/auth.js';
77
81
  export type * from './environment/api/index.js';
78
82
  export type * from './environment/api/webhook.js';
@@ -95,9 +99,11 @@ export type * from './checkpoint/types.js';
95
99
  export type * from './checkpoint/db.js';
96
100
  export type * from './mcp/api.js';
97
101
  export type * from './mfa/api.js';
102
+ export type * from './mfa/credential.js';
98
103
  export type * from './mfa/db.js';
99
104
  export type * from './function/config.js';
100
105
  export type * from './function/db.js';
106
+ export type * from './function/trigger.js';
101
107
  export type * from './functions/api.js';
102
108
  export type * from './functions/domain.js';
103
109
  export type * from './lambda/index.js';
@@ -1,4 +1,11 @@
1
- export type EntityType = 'connect_session' | 'connection' | 'environment';
1
+ export type EntityType = 'connect_session' | 'connection' | 'environment' | 'agent_session';
2
+ export type PrivateKeyEntityRef = {
3
+ entityType: Exclude<EntityType, 'agent_session'>;
4
+ entityId: number;
5
+ } | {
6
+ entityType: 'agent_session';
7
+ entityUuid: string;
8
+ };
2
9
  export interface PrivateKey {
3
10
  readonly id: number;
4
11
  readonly displayName: string;
@@ -10,5 +17,6 @@ export interface PrivateKey {
10
17
  readonly expiresAt: Date | null;
11
18
  readonly lastAccessAt: Date | null;
12
19
  readonly entityType: EntityType;
13
- readonly entityId: number;
20
+ readonly entityId: number | null;
21
+ readonly entityUuid: string | null;
14
22
  }
@@ -20,6 +20,10 @@ export type OperationState = 'waiting' | 'running' | 'success' | 'failed' | 'tim
20
20
  /**
21
21
  * Operations
22
22
  */
23
+ export interface OperationFunction {
24
+ type: 'function';
25
+ action: 'invoke';
26
+ }
23
27
  export interface OperationSync {
24
28
  type: 'sync';
25
29
  action: 'pause' | 'unpause' | 'run' | 'request_run' | 'request_run_full' | 'cancel' | 'init' | 'create_variant' | 'delete_variant';
@@ -52,7 +56,21 @@ export interface OperationDeploy {
52
56
  type: 'deploy';
53
57
  action: 'prebuilt' | 'custom';
54
58
  }
55
- export type OperationList = OperationSync | OperationProxy | OperationAction | OperationWebhook | OperationOnEvents | OperationDeploy | OperationAuth | OperationAdmin;
59
+ export interface OperationAgentSession {
60
+ type: 'agent_session';
61
+ action: 'create';
62
+ }
63
+ export type OperationList = OperationFunction | OperationSync | OperationProxy | OperationAction | OperationWebhook | OperationOnEvents | OperationDeploy | OperationAuth | OperationAdmin | OperationAgentSession;
64
+ /**
65
+ * Who triggered an operation
66
+ */
67
+ export type OperationActor = {
68
+ kind: 'user';
69
+ id: number;
70
+ } | {
71
+ kind: 'session';
72
+ id: string;
73
+ };
56
74
  export interface MessageError {
57
75
  name: string;
58
76
  message: string;
@@ -141,7 +159,10 @@ export interface OperationRow {
141
159
  syncConfigId?: number | undefined;
142
160
  syncConfigName?: string | undefined;
143
161
  jobId?: string | undefined;
144
- userId?: number | undefined;
162
+ /**
163
+ * Who triggered this operation, i.e: a dashboard user or an agent session
164
+ */
165
+ actor?: OperationActor | undefined;
145
166
  error?: MessageError | undefined;
146
167
  request?: MessageHTTPRequest | undefined;
147
168
  response?: MessageHTTPResponse | undefined;
package/dist/mfa/api.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { ApiEndpoint, ApiError } from '../api.js';
2
2
  import type { AuditPolicy } from '../audit-trail/event.js';
3
3
  import type { ApiUser } from '../user/api.js';
4
+ import type { MFACredential } from './credential.js';
4
5
  type MFAError = ApiError<'invalid_mfa_code'> | ApiError<'mfa_already_enabled'> | ApiError<'mfa_enrollment_not_found'> | ApiError<'mfa_not_enabled'>;
5
6
  export type GetMFAStatus = ApiEndpoint<{
6
7
  Audit: {
@@ -71,13 +72,7 @@ export type PostMFALoginVerification = ApiEndpoint<{
71
72
  Audit: AuditPolicy<'mfa', 'verified', 'account'>;
72
73
  Method: 'POST';
73
74
  Path: '/api/v1/account/mfa/login/verify';
74
- Body: {
75
- type: 'code';
76
- code: string;
77
- } | {
78
- type: 'recoveryCode';
79
- recoveryCode: string;
80
- };
75
+ Body: MFACredential;
81
76
  Error: ApiError<'invalid_mfa_code'> | ApiError<'mfa_login_expired'>;
82
77
  Success: {
83
78
  data: {
@@ -0,0 +1,7 @@
1
+ export type MFACredential = {
2
+ type: 'code';
3
+ code: string;
4
+ } | {
5
+ type: 'recoveryCode';
6
+ recoveryCode: string;
7
+ };
package/dist/mfa/db.d.ts CHANGED
@@ -9,6 +9,7 @@ export interface DBMFAFactor extends Timestamps {
9
9
  auth_tag: string;
10
10
  enabled_at: Date | null;
11
11
  last_accepted_counter: string | null;
12
+ clock_offset_steps: number;
12
13
  }
13
14
  export interface DBMFARecoveryCode {
14
15
  id: string;
@@ -23,7 +23,7 @@ type WithTags<T> = T & {
23
23
  };
24
24
  export type RunnerDataTransferTelemetry = WithTags<{
25
25
  type: 'data_transfer';
26
- callsite: 'proxy' | 'uncontrolled_fetch' | 'persist_records' | 'persist_logs';
26
+ callsite: 'proxy' | 'uncontrolled_fetch' | 'persist_records' | 'persist_customer_logs' | 'persist_system_logs' | 'persist_logs';
27
27
  bytesSent: number;
28
28
  bytesReceived: number;
29
29
  count: number;
@@ -44,6 +44,11 @@ export interface DBPlan extends Timestamps {
44
44
  * @default null
45
45
  */
46
46
  function_compute_gbms_max: number | null;
47
+ /** Limit the amount of function runtime (in "started seconds") that can be used in a month
48
+ * Set to null to remove limit
49
+ * @default null
50
+ */
51
+ function_duration_seconds_max: number | null;
47
52
  /** Limit the number of webhook forwards that can happen in a month
48
53
  * Set to null to remove limit
49
54
  * @default null
@@ -111,6 +116,16 @@ export interface DBPlan extends Timestamps {
111
116
  * @default false
112
117
  */
113
118
  has_rbac: boolean;
119
+ /**
120
+ * Record control-plane audit trail events
121
+ * @default false
122
+ */
123
+ has_audit_trail_control_plane: boolean;
124
+ /**
125
+ * Let the customer reach their audit trail, through the dashboard, the API and export
126
+ * @default false
127
+ */
128
+ has_audit_trail_access: boolean;
114
129
  /**
115
130
  * Enable or disable the ability to override the docs connect url from the connect session
116
131
  * @default false
@@ -151,6 +166,11 @@ export interface DBPlan extends Timestamps {
151
166
  * @default "runner"
152
167
  */
153
168
  on_event_function_runtime: FunctionRuntime;
169
+ /**
170
+ * Function Runtime
171
+ * @default "lambda"
172
+ */
173
+ function_runtime: FunctionRuntime;
154
174
  /**
155
175
  * Enable or disable records autopruning
156
176
  * @default true
@@ -134,6 +134,115 @@ export type GetBillingUsage = ApiEndpoint<{
134
134
  };
135
135
  };
136
136
  }>;
137
+ export type GetOverdueInvoices = ApiEndpoint<{
138
+ Audit: {
139
+ kind: 'no-audit';
140
+ reason: 'non-auditable';
141
+ };
142
+ Method: 'GET';
143
+ Path: '/api/v1/plans/billing/overdue';
144
+ Querystring: {
145
+ env: string;
146
+ };
147
+ Success: {
148
+ data: {
149
+ hasOverdue: boolean;
150
+ portalUrl: string | null;
151
+ };
152
+ };
153
+ }>;
154
+ export type GetUpcomingInvoice = ApiEndpoint<{
155
+ Audit: {
156
+ kind: 'no-audit';
157
+ reason: 'non-auditable';
158
+ };
159
+ Method: 'GET';
160
+ Path: '/api/v1/plans/billing/upcoming-invoice';
161
+ Querystring: {
162
+ env: string;
163
+ };
164
+ Success: {
165
+ data: {
166
+ amountInCents: number | null;
167
+ currency: string | null;
168
+ };
169
+ };
170
+ }>;
171
+ export type GetBillingPeriodCosts = ApiEndpoint<{
172
+ Audit: {
173
+ kind: 'no-audit';
174
+ reason: 'non-auditable';
175
+ };
176
+ Method: 'GET';
177
+ Path: '/api/v1/plans/billing/period-costs';
178
+ Querystring: {
179
+ env: string;
180
+ };
181
+ Success: {
182
+ data: {
183
+ metrics: Partial<Record<UsageMetric, number>>;
184
+ /** Metrics with a real price whose charge couldn't be read — show a dash, not $0. */
185
+ malformedMetrics: UsageMetric[];
186
+ /** False when some usage price mapped to no metric of ours — an absent metric can't safely
187
+ * read as $0, since the money might be one of theirs. */
188
+ fullyAttributed: boolean;
189
+ currency: string | null;
190
+ /** True when there's no billing period to report costs for — a free plan, no linked
191
+ * subscription, or an ended one. `metrics`/`currency` are otherwise never empty/null. */
192
+ noCosts: boolean;
193
+ };
194
+ };
195
+ }>;
196
+ export type GetSpendAlert = ApiEndpoint<{
197
+ Audit: {
198
+ kind: 'no-audit';
199
+ reason: 'non-auditable';
200
+ };
201
+ Method: 'GET';
202
+ Path: '/api/v1/plans/billing/spend-alert';
203
+ Querystring: {
204
+ env: string;
205
+ };
206
+ Success: {
207
+ data: {
208
+ /** Null when the plan gets no spend alerts, or none has been set. */
209
+ thresholdInCents: number | null;
210
+ /**
211
+ * ISO 4217. Null when there's nothing to price a threshold against — a non-spend plan,
212
+ * or no Orb subscription yet; otherwise set even when the threshold is null.
213
+ */
214
+ currency: string | null;
215
+ };
216
+ };
217
+ }>;
218
+ export type PutSpendAlert = ApiEndpoint<{
219
+ Audit: AuditPolicy<'billing', 'spend_alert_changed', 'account'>;
220
+ Method: 'PUT';
221
+ Path: '/api/v1/plans/billing/spend-alert';
222
+ Querystring: {
223
+ env: string;
224
+ };
225
+ Body: {
226
+ thresholdInCents: number;
227
+ };
228
+ Success: {
229
+ data: {
230
+ thresholdInCents: number;
231
+ currency: string | null;
232
+ };
233
+ };
234
+ }>;
235
+ export type DeleteSpendAlert = ApiEndpoint<{
236
+ Audit: AuditPolicy<'billing', 'spend_alert_removed', 'account'>;
237
+ Method: 'DELETE';
238
+ Path: '/api/v1/plans/billing/spend-alert';
239
+ Querystring: {
240
+ env: string;
241
+ };
242
+ Success: {
243
+ success: true;
244
+ };
245
+ }>;
137
246
  export type PutBillingInvoicingDetails = ApiEndpoint<{
138
247
  Audit: AuditPolicy<'billing', 'details_changed', 'account'>;
139
248
  Method: 'PUT';
@@ -72,7 +72,7 @@ export type UsageConnectionsEvent = UsageEventBase<'usage.connections', {
72
72
  export type UsageFunctionExecutionsEvent = UsageEventBase<'usage.function_executions', {
73
73
  value: number;
74
74
  properties: {
75
- type: 'sync' | 'action' | 'webhook' | 'on-event';
75
+ type: 'function' | 'sync' | 'action' | 'webhook' | 'on-event';
76
76
  success: boolean;
77
77
  functionName: string;
78
78
  runtime: FunctionRuntime | undefined;
@@ -97,7 +97,7 @@ export type UsageWebhookForwardEvent = UsageEventBase<'usage.webhook_forward', {
97
97
  success: boolean;
98
98
  };
99
99
  }>;
100
- export type DataTransferCallsite = 'credential_test_hook' | 'credential_verification_hook' | 'connection_hook' | 'webhook_forward' | 'proxy' | 'uncontrolled_fetch' | 'persist_logs' | 'persist_records' | 'get_/records' | 'get_/proxy' | 'patch_/proxy' | 'post_/proxy' | 'put_/proxy' | 'delete_/proxy' | 'unknown_/proxy';
100
+ export type DataTransferCallsite = 'credential_test_hook' | 'credential_verification_hook' | 'connection_hook' | 'webhook_forward' | 'proxy' | 'uncontrolled_fetch' | 'persist_customer_logs' | 'persist_system_logs' | 'persist_logs' | 'persist_records' | 'get_/records' | 'get_/proxy' | 'patch_/proxy' | 'post_/proxy' | 'put_/proxy' | 'delete_/proxy' | 'unknown_/proxy';
101
101
  export type UsageDataTransferEvent = UsageEventBase<'usage.data_transfer', {
102
102
  value: number;
103
103
  properties: {
@@ -8,7 +8,7 @@ export interface SdkLogger {
8
8
  level: LogLevel | 'off';
9
9
  }
10
10
  export type ConflictResolutionMode = 'IN_MEMORY' | 'DISTRIBUTED';
11
- export type ScriptType = 'sync' | 'action' | 'webhook' | 'on-event';
11
+ export type ScriptType = 'function' | 'sync' | 'action' | 'webhook' | 'on-event';
12
12
  export interface NangoProps {
13
13
  scriptType: ScriptType;
14
14
  host?: string;