@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.
Files changed (47) hide show
  1. package/dist/account/api.d.ts +79 -6
  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/auth.d.ts +38 -0
  10. package/dist/api-keys/scopes.d.ts +10 -3
  11. package/dist/api.endpoints.d.ts +9 -7
  12. package/dist/audit-trail/api.d.ts +21 -7
  13. package/dist/audit-trail/event.d.ts +22 -3
  14. package/dist/auth/http.api.d.ts +11 -40
  15. package/dist/authz/types.d.ts +1 -1
  16. package/dist/billing/types.d.ts +46 -0
  17. package/dist/connection/api/get.d.ts +1 -1
  18. package/dist/connection/api/metadata.d.ts +8 -2
  19. package/dist/environment/api/index.d.ts +86 -0
  20. package/dist/{functions → function}/config.d.ts +20 -13
  21. package/dist/function/db.d.ts +2 -3
  22. package/dist/function/trigger.d.ts +61 -0
  23. package/dist/functions/api.d.ts +103 -0
  24. package/dist/index.d.ts +10 -4
  25. package/dist/integration/api.d.ts +1 -0
  26. package/dist/keystore/index.d.ts +10 -2
  27. package/dist/logs/messages.d.ts +23 -2
  28. package/dist/mcp/api.d.ts +3 -3
  29. package/dist/mfa/api.d.ts +2 -7
  30. package/dist/mfa/credential.d.ts +7 -0
  31. package/dist/mfa/db.d.ts +1 -0
  32. package/dist/persist/api.d.ts +1 -1
  33. package/dist/plans/db.d.ts +20 -0
  34. package/dist/plans/http.api.d.ts +109 -0
  35. package/dist/pubsub/events.d.ts +2 -2
  36. package/dist/runner/sdk.d.ts +1 -1
  37. package/dist/sharedCredentials/api.d.ts +2 -0
  38. package/dist/sharedCredentials/db.d.ts +1 -0
  39. package/dist/sharedCredentials/dto.d.ts +1 -1
  40. package/dist/stripe/http.api.d.ts +3 -0
  41. package/dist/sync/api.d.ts +1 -1
  42. package/dist/usage/index.d.ts +1 -1
  43. package/dist/user/api.d.ts +5 -1
  44. package/dist/user/db.d.ts +2 -0
  45. package/dist/web/env.d.ts +3 -0
  46. package/package.json +1 -1
  47. package/dist/functions/capabilities.d.ts +0 -7
@@ -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/mcp/api.d.ts CHANGED
@@ -23,17 +23,17 @@ export type GetConnectionToolsMcp = ApiEndpoint<{
23
23
  Path: '/mcp';
24
24
  Success: Record<string, unknown>;
25
25
  }>;
26
- export type PostControlPlaneMcp = ApiEndpoint<{
26
+ export type PostManagementMcp = ApiEndpoint<{
27
27
  Audit: {
28
28
  kind: 'no-audit';
29
- reason: 'non-auditable';
29
+ reason: 'audited-per-tool';
30
30
  };
31
31
  Method: 'POST';
32
32
  Path: '/mcp';
33
33
  Body: Record<string, unknown>;
34
34
  Success: Record<string, unknown>;
35
35
  }>;
36
- export type GetControlPlaneMcp = ApiEndpoint<{
36
+ export type GetManagementMcp = ApiEndpoint<{
37
37
  Audit: {
38
38
  kind: 'no-audit';
39
39
  reason: 'non-auditable';
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;
@@ -44,6 +44,7 @@ export interface SharedCredentialsBodyInput {
44
44
  client_id: string;
45
45
  client_secret: string;
46
46
  scopes?: string | undefined;
47
+ app_link?: string | undefined;
47
48
  }
48
49
  export interface SharedCredentialsOutput {
49
50
  id: number;
@@ -52,6 +53,7 @@ export interface SharedCredentialsOutput {
52
53
  client_id: string;
53
54
  client_secret: string;
54
55
  scopes?: string | undefined;
56
+ app_link?: string | undefined;
55
57
  };
56
58
  created_at: string;
57
59
  updated_at: string;
@@ -5,6 +5,7 @@ export interface SharedCredentials {
5
5
  oauth_scopes?: string;
6
6
  oauth_client_secret_iv: string;
7
7
  oauth_client_secret_tag: string;
8
+ app_link?: string;
8
9
  }
9
10
  export interface DBSharedCredentials extends Timestamps {
10
11
  id: number;
@@ -1,2 +1,2 @@
1
1
  import type { SharedCredentials } from './db.js';
2
- export type SharedCredentialsInputDto = Pick<SharedCredentials, 'oauth_client_id' | 'oauth_client_secret' | 'oauth_scopes'>;
2
+ export type SharedCredentialsInputDto = Pick<SharedCredentials, 'oauth_client_id' | 'oauth_client_secret' | 'oauth_scopes' | 'app_link'>;
@@ -12,7 +12,10 @@ export type PostStripeCollectPayment = ApiEndpoint<{
12
12
  }>;
13
13
  export interface StripePaymentMethod {
14
14
  id: string;
15
+ brand: string;
15
16
  last4: string;
17
+ expMonth: number;
18
+ expYear: number;
16
19
  }
17
20
  export type GetStripePaymentMethods = ApiEndpoint<{
18
21
  Audit: {
@@ -4,7 +4,7 @@ import type { ReportedSyncJobStatus } from './index.js';
4
4
  export type PostPublicTrigger = ApiEndpoint<{
5
5
  Audit: {
6
6
  kind: 'no-audit';
7
- reason: 'TODO: audit coverage pending';
7
+ reason: 'data-plane operation';
8
8
  };
9
9
  Method: 'POST';
10
10
  Path: '/sync/trigger';
@@ -1,4 +1,4 @@
1
- export type UsageMetric = 'proxy' | 'connections' | 'function_executions' | 'function_compute_gbms' | 'records' | 'webhook_forwards' | 'function_logs' | 'data_transfer';
1
+ export type UsageMetric = 'proxy' | 'connections' | 'function_executions' | 'function_compute_gbms' | 'function_duration_seconds' | 'records' | 'webhook_forwards' | 'function_logs' | 'data_transfer';
2
2
  export interface MetricUsageSummary {
3
3
  label: string;
4
4
  usage: number;
@@ -1,5 +1,6 @@
1
- import type { ApiEndpoint, Endpoint } from '../api.js';
1
+ import type { ApiEndpoint, ApiError, Endpoint } from '../api.js';
2
2
  import type { AuditPolicy } from '../audit-trail/event.js';
3
+ import type { MFACredential } from '../mfa/credential.js';
3
4
  import type { Role } from './db.js';
4
5
  export type GetUser = ApiEndpoint<{
5
6
  Audit: {
@@ -47,6 +48,7 @@ export type AllowedPermissions = Partial<Record<string, Partial<Record<'producti
47
48
  export type ApiUserWithPermissions = ApiUser & {
48
49
  role: Role;
49
50
  permissions: AllowedPermissions;
51
+ hasPassword: boolean;
50
52
  };
51
53
  export type PutUserPassword = ApiEndpoint<{
52
54
  Audit: AuditPolicy<'app_auth', 'password_changed', 'account'>;
@@ -55,7 +57,9 @@ export type PutUserPassword = ApiEndpoint<{
55
57
  Body: {
56
58
  oldPassword: string;
57
59
  newPassword: string;
60
+ mfa?: MFACredential | undefined;
58
61
  };
62
+ Error: ApiError<'incorrect_password'> | ApiError<'invalid_mfa_code'> | ApiError<'mfa_code_required'>;
59
63
  Success: {
60
64
  success: true;
61
65
  };
package/dist/user/db.d.ts CHANGED
@@ -15,5 +15,7 @@ export interface DBUser extends Timestamps {
15
15
  email_verification_token_expires_at: Date | null;
16
16
  uuid: string;
17
17
  getting_started_closed: boolean;
18
+ account_discovery_pending: boolean;
19
+ account_invitation_requested_at: Date | null;
18
20
  role: Role;
19
21
  }
package/dist/web/env.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  export interface WindowEnv {
2
+ /** Public API host: OAuth callbacks, webhooks, and the `apiURL` handed to the SDK / Connect UI. */
2
3
  apiUrl: string;
4
+ /** Where the dashboard sends its own API requests. Equals `apiUrl` unless NANGO_DASHBOARD_API_URL is set. `/` means same-origin. */
5
+ dashboardApiUrl: string;
3
6
  publicUrl: string;
4
7
  connectUrl: string;
5
8
  gitHash: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/types",
3
- "version": "0.71.3",
3
+ "version": "0.71.5",
4
4
  "description": "Types used in Nango applications",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",
@@ -1,7 +0,0 @@
1
- export interface FunctionCapabilities {
2
- usesRecords: boolean;
3
- usesCheckpoints: boolean;
4
- usesMetadata: boolean;
5
- usesOutbound: boolean;
6
- usesInvoke: boolean;
7
- }