@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/auth/http.api.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ApiEndpoint, ApiError } from '../api.js';
|
|
2
|
+
import type { AuditPolicy } from '../audit-trail/event.js';
|
|
2
3
|
export type ConnectionQueryString = {
|
|
3
4
|
connection_id?: string | undefined;
|
|
4
5
|
params?: Record<string, any> | undefined;
|
|
@@ -35,10 +36,7 @@ export interface WebSocketConnectionResponseSuccess {
|
|
|
35
36
|
}
|
|
36
37
|
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
38
|
export type PostPublicApiKeyAuthorization = ApiEndpoint<{
|
|
38
|
-
Audit:
|
|
39
|
-
kind: 'no-audit';
|
|
40
|
-
reason: 'TODO: audit coverage pending';
|
|
41
|
-
};
|
|
39
|
+
Audit: AuditPolicy<'connection', 'created', 'environment'>;
|
|
42
40
|
Method: 'POST';
|
|
43
41
|
Body: {
|
|
44
42
|
apiKey: string;
|
|
@@ -52,10 +50,7 @@ export type PostPublicApiKeyAuthorization = ApiEndpoint<{
|
|
|
52
50
|
Success: ConnectionResponseSuccess;
|
|
53
51
|
}>;
|
|
54
52
|
export type PostPublicBasicAuthorization = ApiEndpoint<{
|
|
55
|
-
Audit:
|
|
56
|
-
kind: 'no-audit';
|
|
57
|
-
reason: 'TODO: audit coverage pending';
|
|
58
|
-
};
|
|
53
|
+
Audit: AuditPolicy<'connection', 'created', 'environment'>;
|
|
59
54
|
Method: 'POST';
|
|
60
55
|
Body: {
|
|
61
56
|
username: string;
|
|
@@ -70,10 +65,7 @@ export type PostPublicBasicAuthorization = ApiEndpoint<{
|
|
|
70
65
|
Success: ConnectionResponseSuccess;
|
|
71
66
|
}>;
|
|
72
67
|
export type PostPublicTbaAuthorization = ApiEndpoint<{
|
|
73
|
-
Audit:
|
|
74
|
-
kind: 'no-audit';
|
|
75
|
-
reason: 'TODO: audit coverage pending';
|
|
76
|
-
};
|
|
68
|
+
Audit: AuditPolicy<'connection', 'created', 'environment'>;
|
|
77
69
|
Method: 'POST';
|
|
78
70
|
Body: {
|
|
79
71
|
token_id: string;
|
|
@@ -91,10 +83,7 @@ export type PostPublicTbaAuthorization = ApiEndpoint<{
|
|
|
91
83
|
Success: ConnectionResponseSuccess;
|
|
92
84
|
}>;
|
|
93
85
|
export type PostPublicJwtAuthorization = ApiEndpoint<{
|
|
94
|
-
Audit:
|
|
95
|
-
kind: 'no-audit';
|
|
96
|
-
reason: 'TODO: audit coverage pending';
|
|
97
|
-
};
|
|
86
|
+
Audit: AuditPolicy<'connection', 'created', 'environment'>;
|
|
98
87
|
Method: 'POST';
|
|
99
88
|
Body: Record<string, any>;
|
|
100
89
|
Querystring: ConnectionQueryString;
|
|
@@ -106,10 +95,7 @@ export type PostPublicJwtAuthorization = ApiEndpoint<{
|
|
|
106
95
|
Success: ConnectionResponseSuccess;
|
|
107
96
|
}>;
|
|
108
97
|
export type PostPublicUnauthenticatedAuthorization = ApiEndpoint<{
|
|
109
|
-
Audit:
|
|
110
|
-
kind: 'no-audit';
|
|
111
|
-
reason: 'TODO: audit coverage pending';
|
|
112
|
-
};
|
|
98
|
+
Audit: AuditPolicy<'connection', 'created', 'environment'>;
|
|
113
99
|
Method: 'POST';
|
|
114
100
|
Querystring: ConnectionQueryString;
|
|
115
101
|
Params: {
|
|
@@ -120,10 +106,7 @@ export type PostPublicUnauthenticatedAuthorization = ApiEndpoint<{
|
|
|
120
106
|
Success: ConnectionResponseSuccess;
|
|
121
107
|
}>;
|
|
122
108
|
export type PostPublicBillAuthorization = ApiEndpoint<{
|
|
123
|
-
Audit:
|
|
124
|
-
kind: 'no-audit';
|
|
125
|
-
reason: 'TODO: audit coverage pending';
|
|
126
|
-
};
|
|
109
|
+
Audit: AuditPolicy<'connection', 'created', 'environment'>;
|
|
127
110
|
Method: 'POST';
|
|
128
111
|
Body: {
|
|
129
112
|
username: string;
|
|
@@ -140,10 +123,7 @@ export type PostPublicBillAuthorization = ApiEndpoint<{
|
|
|
140
123
|
Success: ConnectionResponseSuccess;
|
|
141
124
|
}>;
|
|
142
125
|
export type PostPublicTwoStepAuthorization = ApiEndpoint<{
|
|
143
|
-
Audit:
|
|
144
|
-
kind: 'no-audit';
|
|
145
|
-
reason: 'TODO: audit coverage pending';
|
|
146
|
-
};
|
|
126
|
+
Audit: AuditPolicy<'connection', 'created', 'environment'>;
|
|
147
127
|
Method: 'POST';
|
|
148
128
|
Body: Record<string, any>;
|
|
149
129
|
Querystring: ConnectionQueryString;
|
|
@@ -155,10 +135,7 @@ export type PostPublicTwoStepAuthorization = ApiEndpoint<{
|
|
|
155
135
|
Success: ConnectionResponseSuccess;
|
|
156
136
|
}>;
|
|
157
137
|
export type PostPublicSignatureAuthorization = ApiEndpoint<{
|
|
158
|
-
Audit:
|
|
159
|
-
kind: 'no-audit';
|
|
160
|
-
reason: 'TODO: audit coverage pending';
|
|
161
|
-
};
|
|
138
|
+
Audit: AuditPolicy<'connection', 'created', 'environment'>;
|
|
162
139
|
Method: 'POST';
|
|
163
140
|
Body: {
|
|
164
141
|
username: string;
|
|
@@ -174,10 +151,7 @@ export type PostPublicSignatureAuthorization = ApiEndpoint<{
|
|
|
174
151
|
}>;
|
|
175
152
|
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'>;
|
|
176
153
|
export type PostPublicAwsSigV4Authorization = ApiEndpoint<{
|
|
177
|
-
Audit:
|
|
178
|
-
kind: 'no-audit';
|
|
179
|
-
reason: 'TODO: audit coverage pending';
|
|
180
|
-
};
|
|
154
|
+
Audit: AuditPolicy<'connection', 'created', 'environment'>;
|
|
181
155
|
Method: 'POST';
|
|
182
156
|
Body: {
|
|
183
157
|
role_arn: string;
|
|
@@ -192,10 +166,7 @@ export type PostPublicAwsSigV4Authorization = ApiEndpoint<{
|
|
|
192
166
|
Success: ConnectionResponseSuccess;
|
|
193
167
|
}>;
|
|
194
168
|
export type PostPublicOauthOutboundAuthorization = ApiEndpoint<{
|
|
195
|
-
Audit:
|
|
196
|
-
kind: 'no-audit';
|
|
197
|
-
reason: 'TODO: audit coverage pending';
|
|
198
|
-
};
|
|
169
|
+
Audit: AuditPolicy<'connection', 'created', 'environment'>;
|
|
199
170
|
Method: 'POST';
|
|
200
171
|
Body: {
|
|
201
172
|
username: string;
|
package/dist/authz/types.d.ts
CHANGED
|
@@ -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' | 'audit_trail' | '*';
|
|
3
|
+
export type Resource = 'team' | 'team_member' | 'invite' | 'connect_ui_settings' | 'billing' | 'plan' | 'environment' | 'environment_production_flag' | 'environment_key' | 'account_key' | 'environment_variable' | 'webhook' | 'integration' | 'connection' | 'flow' | 'sync_command' | 'secret_key' | 'connection_credential' | 'log' | 'audit_trail' | '*';
|
|
4
4
|
export type Scope = 'production' | 'non-production' | 'global';
|
|
5
5
|
export interface Permission {
|
|
6
6
|
action: Action;
|
package/dist/billing/types.d.ts
CHANGED
|
@@ -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:
|
|
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:
|
|
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';
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import type { OnEventType } from '../scripts/on-events/api.js';
|
|
2
|
+
export interface FunctionCapabilities {
|
|
3
|
+
usesRecords: boolean;
|
|
4
|
+
usesOutbound: boolean;
|
|
5
|
+
usesCheckpoints: boolean;
|
|
6
|
+
usesMetadata: boolean;
|
|
7
|
+
usesInvoke: boolean;
|
|
8
|
+
}
|
|
2
9
|
/**
|
|
3
10
|
* Declares where the debounce/coalescing key is extracted from:
|
|
4
11
|
* - `{ body: '$.portalId' }`: dot notation path into the body
|
|
@@ -12,13 +19,13 @@ export type DebounceKeySource = {
|
|
|
12
19
|
/** Coalesces a burst of inbound HTTP requests into a single function run within a sliding window. */
|
|
13
20
|
export interface DebounceOptions {
|
|
14
21
|
/** Events sharing the same resolved key coalesce together. */
|
|
15
|
-
keyBy?: DebounceKeySource | DebounceKeySource[];
|
|
22
|
+
keyBy?: DebounceKeySource | DebounceKeySource[] | undefined;
|
|
16
23
|
/** Sliding window in milliseconds. */
|
|
17
24
|
windowMs: number;
|
|
18
25
|
/** When exceeded, the window stops sliding. */
|
|
19
|
-
maxEntities?: number;
|
|
26
|
+
maxEntities?: number | undefined;
|
|
20
27
|
/** Which payloads from the coalesced window the handler receives. */
|
|
21
|
-
take?: 'latest' | 'first' | 'all';
|
|
28
|
+
take?: 'latest' | 'first' | 'all' | undefined;
|
|
22
29
|
}
|
|
23
30
|
/**
|
|
24
31
|
* Declares how a function is initiated from outside; `kind` discriminates the source.
|
|
@@ -32,11 +39,11 @@ export type FunctionTriggerDefinition = {
|
|
|
32
39
|
} | {
|
|
33
40
|
kind: 'schedule';
|
|
34
41
|
frequency: string;
|
|
35
|
-
autoStart?: boolean;
|
|
42
|
+
autoStart?: boolean | undefined;
|
|
36
43
|
} | {
|
|
37
44
|
kind: 'http';
|
|
38
|
-
subscriptions?: string[];
|
|
39
|
-
debounce?: DebounceOptions;
|
|
45
|
+
subscriptions?: string[] | undefined;
|
|
46
|
+
debounce?: DebounceOptions | undefined;
|
|
40
47
|
} | {
|
|
41
48
|
kind: 'event';
|
|
42
49
|
events: OnEventType[];
|
|
@@ -45,14 +52,14 @@ export type FunctionConcurrencyLimit = 1 | 'max';
|
|
|
45
52
|
export interface FunctionLimits {
|
|
46
53
|
concurrency?: {
|
|
47
54
|
perConnection: FunctionConcurrencyLimit;
|
|
48
|
-
};
|
|
55
|
+
} | undefined;
|
|
49
56
|
}
|
|
50
|
-
export type
|
|
51
|
-
connection?: true;
|
|
52
|
-
outbound?: boolean;
|
|
53
|
-
invoke?: boolean;
|
|
57
|
+
export type FunctionRequires = {
|
|
58
|
+
connection?: true | undefined;
|
|
59
|
+
outbound?: boolean | undefined;
|
|
60
|
+
invoke?: boolean | undefined;
|
|
54
61
|
} | {
|
|
55
62
|
connection: false;
|
|
56
|
-
outbound?: false;
|
|
57
|
-
invoke?: boolean;
|
|
63
|
+
outbound?: false | undefined;
|
|
64
|
+
invoke?: boolean | undefined;
|
|
58
65
|
};
|
package/dist/function/db.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { TimestampsAndDeletedAt } from '../db.js';
|
|
2
|
-
import type { FunctionCapabilities } from '../functions/capabilities.js';
|
|
3
|
-
import type { FunctionLimits, FunctionTriggerDefinition, Requires } from '../functions/config.js';
|
|
4
2
|
import type { FunctionSource } from '../syncConfigs/db.js';
|
|
3
|
+
import type { FunctionCapabilities, FunctionLimits, FunctionRequires, FunctionTriggerDefinition } from './config.js';
|
|
5
4
|
import type { JSONSchema7 } from 'json-schema';
|
|
6
5
|
export interface DBFunctionConfig extends TimestampsAndDeletedAt {
|
|
7
6
|
id: number;
|
|
@@ -19,7 +18,7 @@ export interface DBFunctionConfigVersion extends TimestampsAndDeletedAt {
|
|
|
19
18
|
version: string;
|
|
20
19
|
source: FunctionSource;
|
|
21
20
|
trigger: FunctionTriggerDefinition;
|
|
22
|
-
requires:
|
|
21
|
+
requires: FunctionRequires;
|
|
23
22
|
capabilities: FunctionCapabilities;
|
|
24
23
|
limits: FunctionLimits;
|
|
25
24
|
input_schema_ref: string | null;
|
|
@@ -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 {};
|
package/dist/functions/api.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ApiEndpoint, ApiError } from '../api.js';
|
|
2
2
|
import type { AuditPolicy } from '../audit-trail/event.js';
|
|
3
|
+
import type { FunctionCapabilities, FunctionLimits, FunctionRequires, FunctionTriggerDefinition } from '../function/config.js';
|
|
3
4
|
import type { DeployedNangoFunction, FunctionType, NangoActionFunction, NangoFunctionTemplate, NangoSyncFunction } from './domain.js';
|
|
5
|
+
import type { JSONSchema7 } from 'json-schema';
|
|
4
6
|
export type RunnableFunctionType = Extract<FunctionType, 'action' | 'sync'>;
|
|
5
7
|
export type FunctionErrorCode = 'invalid_request' | 'server_error' | 'integration_not_found' | 'compilation_error' | 'dryrun_error' | 'deployment_error' | 'connection_not_found' | 'dryrun_not_found' | 'deployment_not_found' | 'function_disabled' | 'execution_environment_unavailable' | 'timeout' | 'validation_error';
|
|
6
8
|
export interface ProxyCall {
|
|
@@ -219,6 +221,40 @@ export type PostFunctionDeploymentResult = ApiEndpoint<{
|
|
|
219
221
|
ok: true;
|
|
220
222
|
};
|
|
221
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
|
+
}>;
|
|
222
258
|
export interface FunctionListFilters {
|
|
223
259
|
type?: FunctionType;
|
|
224
260
|
search?: string;
|
|
@@ -380,3 +416,70 @@ export type GetIntegrationTemplates = ApiEndpoint<{
|
|
|
380
416
|
data: NangoFunctionTemplate[];
|
|
381
417
|
};
|
|
382
418
|
}>;
|
|
419
|
+
export interface FunctionDeploymentArtifact {
|
|
420
|
+
name: string;
|
|
421
|
+
integrationId: string;
|
|
422
|
+
description: string;
|
|
423
|
+
trigger: FunctionTriggerDefinition;
|
|
424
|
+
requires: FunctionRequires;
|
|
425
|
+
capabilities: FunctionCapabilities;
|
|
426
|
+
limits: FunctionLimits;
|
|
427
|
+
input_schema_ref: string | null;
|
|
428
|
+
output_schema_ref: string | null;
|
|
429
|
+
model_schema_refs: string[];
|
|
430
|
+
metadata_schema_ref: string | null;
|
|
431
|
+
checkpoint_schema_ref: string | null;
|
|
432
|
+
json_schema: JSONSchema7;
|
|
433
|
+
fileBody: {
|
|
434
|
+
js: string;
|
|
435
|
+
ts: string;
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
export type FunctionReconciliationScope = {
|
|
439
|
+
kind: 'environment';
|
|
440
|
+
} | {
|
|
441
|
+
kind: 'integration';
|
|
442
|
+
integrationId: string;
|
|
443
|
+
};
|
|
444
|
+
export interface FunctionDeploymentBundleBody {
|
|
445
|
+
reconciliationScope: FunctionReconciliationScope;
|
|
446
|
+
functions: FunctionDeploymentArtifact[];
|
|
447
|
+
}
|
|
448
|
+
export interface FunctionDeploymentBundleSuccess {
|
|
449
|
+
created: {
|
|
450
|
+
integrationId: string;
|
|
451
|
+
name: string;
|
|
452
|
+
}[];
|
|
453
|
+
updated: {
|
|
454
|
+
integrationId: string;
|
|
455
|
+
name: string;
|
|
456
|
+
}[];
|
|
457
|
+
unchanged: {
|
|
458
|
+
integrationId: string;
|
|
459
|
+
name: string;
|
|
460
|
+
}[];
|
|
461
|
+
deleted: {
|
|
462
|
+
integrationId: string;
|
|
463
|
+
name: string;
|
|
464
|
+
}[];
|
|
465
|
+
}
|
|
466
|
+
export type PostFunctionDeploymentBundlePreview = ApiEndpoint<{
|
|
467
|
+
Audit: {
|
|
468
|
+
kind: 'no-audit';
|
|
469
|
+
reason: 'non-auditable';
|
|
470
|
+
};
|
|
471
|
+
Method: 'POST';
|
|
472
|
+
Path: '/functions/deployments/bundle/preview';
|
|
473
|
+
Body: FunctionDeploymentBundleBody;
|
|
474
|
+
Error: ApiError<'functions_deployment_error' | 'integration_not_found'>;
|
|
475
|
+
Success: FunctionDeploymentBundleSuccess;
|
|
476
|
+
}>;
|
|
477
|
+
export type PostFunctionDeploymentBundle = ApiEndpoint<{
|
|
478
|
+
Audit: AuditPolicy<'function', 'deployed', 'environment'>;
|
|
479
|
+
Method: 'POST';
|
|
480
|
+
Path: '/functions/deployments/bundle';
|
|
481
|
+
Body: FunctionDeploymentBundleBody;
|
|
482
|
+
Error: ApiError<'functions_deployment_error' | 'concurrent_deployment' | 'integration_not_found'>;
|
|
483
|
+
Success: FunctionDeploymentBundleSuccess;
|
|
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,8 @@ 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 {
|
|
75
|
-
export type
|
|
79
|
+
export type { ACCOUNT_API_KEY_SCOPES, AccountApiKeyScope, API_KEY_SCOPES, ApiKeyScope, ConcreteAccountApiKeyScope, ConcreteApiKeyScope, CustomerKeyScope, WildcardsFor } from './api-keys/scopes.js';
|
|
80
|
+
export type * from './api-keys/auth.js';
|
|
76
81
|
export type * from './environment/api/index.js';
|
|
77
82
|
export type * from './environment/api/webhook.js';
|
|
78
83
|
export type * from './environment/api/otlp.js';
|
|
@@ -94,11 +99,12 @@ export type * from './checkpoint/types.js';
|
|
|
94
99
|
export type * from './checkpoint/db.js';
|
|
95
100
|
export type * from './mcp/api.js';
|
|
96
101
|
export type * from './mfa/api.js';
|
|
102
|
+
export type * from './mfa/credential.js';
|
|
97
103
|
export type * from './mfa/db.js';
|
|
104
|
+
export type * from './function/config.js';
|
|
98
105
|
export type * from './function/db.js';
|
|
106
|
+
export type * from './function/trigger.js';
|
|
99
107
|
export type * from './functions/api.js';
|
|
100
|
-
export type * from './functions/capabilities.js';
|
|
101
|
-
export type * from './functions/config.js';
|
|
102
108
|
export type * from './functions/domain.js';
|
|
103
109
|
export type * from './lambda/index.js';
|
|
104
110
|
export type * from './authz/types.js';
|
|
@@ -58,6 +58,7 @@ export type PostPublicIntegration = ApiEndpoint<{
|
|
|
58
58
|
credentials?: ApiPublicIntegrationCredentials | undefined;
|
|
59
59
|
forward_webhooks?: boolean | undefined;
|
|
60
60
|
integration_config?: Record<string, string> | undefined;
|
|
61
|
+
custom?: Record<string, string> | undefined;
|
|
61
62
|
};
|
|
62
63
|
Success: {
|
|
63
64
|
data: ApiPublicIntegration;
|