@nangohq/types 0.71.6 → 0.71.7
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/agent/api.d.ts +21 -0
- package/dist/agent/session.d.ts +1 -0
- package/dist/api-keys/scopes.d.ts +1 -1
- package/dist/api.endpoints.d.ts +6 -6
- package/dist/audit-trail/api.d.ts +14 -0
- package/dist/billing/types.d.ts +29 -80
- package/dist/connect/api.d.ts +6 -1
- package/dist/environment/api/index.d.ts +61 -0
- package/dist/index.d.ts +0 -1
- package/dist/logs/messages.d.ts +1 -1
- package/dist/meta/api.d.ts +2 -2
- package/dist/plans/db.d.ts +2 -0
- package/dist/plans/http.api.d.ts +37 -0
- package/dist/sync/api.d.ts +48 -1
- package/dist/team/api.d.ts +0 -1
- package/dist/user/api.d.ts +7 -5
- package/dist/webhooks/dispatch.d.ts +39 -19
- package/package.json +1 -1
- package/dist/authz/types.d.ts +0 -12
package/dist/agent/api.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ApiEndpoint, ApiError } from '../api.js';
|
|
2
2
|
import type { Tags } from '../db.js';
|
|
3
3
|
import type { AgentSessionUnknownPinnedConnectionsPayload } from './connections.js';
|
|
4
|
+
import type { AgentSessionEndedReason } from './session.js';
|
|
4
5
|
import type { AgentSessionToolsNotInToolsetPayload, AgentSessionUnknownIntegrationsPayload, AgentSessionUnknownToolsPayload, AgentSessionUnsupportedFunctionTypesPayload } from './toolset.js';
|
|
5
6
|
export interface AgentSessionToolListInput {
|
|
6
7
|
tools: string[];
|
|
@@ -34,6 +35,7 @@ export interface AgentSessionToolsetSummary {
|
|
|
34
35
|
export interface AgentSessionMetaToolsSummary {
|
|
35
36
|
nango_tool_search: boolean;
|
|
36
37
|
nango_execute: boolean;
|
|
38
|
+
nango_proxy: boolean;
|
|
37
39
|
}
|
|
38
40
|
export interface AgentSessionUnknownMetaToolsPayload {
|
|
39
41
|
meta_tools: string[];
|
|
@@ -86,3 +88,22 @@ export type PostAgentSessions = ApiEndpoint<{
|
|
|
86
88
|
};
|
|
87
89
|
};
|
|
88
90
|
}>;
|
|
91
|
+
export interface ApiTerminatedAgentSession {
|
|
92
|
+
session_id: string;
|
|
93
|
+
ended_at: string;
|
|
94
|
+
reason: AgentSessionEndedReason;
|
|
95
|
+
}
|
|
96
|
+
export type DeleteAgentSession = ApiEndpoint<{
|
|
97
|
+
Audit: {
|
|
98
|
+
kind: 'no-audit';
|
|
99
|
+
reason: 'TODO: audit coverage pending';
|
|
100
|
+
};
|
|
101
|
+
Method: 'DELETE';
|
|
102
|
+
Path: '/sessions/:sessionId';
|
|
103
|
+
Params: {
|
|
104
|
+
sessionId: string;
|
|
105
|
+
};
|
|
106
|
+
Success: {
|
|
107
|
+
data: ApiTerminatedAgentSession;
|
|
108
|
+
};
|
|
109
|
+
}>;
|
package/dist/agent/session.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { AgentSessionCompiledToolset } from './toolset.js';
|
|
|
3
3
|
export interface AgentSessionMetaTools {
|
|
4
4
|
readonly nangoToolSearch: boolean;
|
|
5
5
|
readonly nangoExecute: boolean;
|
|
6
|
+
readonly nangoProxy: boolean;
|
|
6
7
|
}
|
|
7
8
|
export type AgentSessionEndedReason = 'terminated' | 'expired';
|
|
8
9
|
export interface AgentSession {
|
|
@@ -4,7 +4,7 @@ export declare const API_KEY_SCOPES: readonly ["environment:integrations:list",
|
|
|
4
4
|
export type ConcreteApiKeyScope = (typeof API_KEY_SCOPES)[number];
|
|
5
5
|
/** A scope, or a wildcard over scopes. Which wildcards resolve to something is checked at runtime. */
|
|
6
6
|
export type ApiKeyScope = ConcreteApiKeyScope | WildcardsFor<'environment'>;
|
|
7
|
-
export declare const ACCOUNT_API_KEY_SCOPES: readonly ["account:environments:create", "account:environments:delete", "account:environments:set_production", "account:environments:api_keys:create", "account:environments:api_keys:delete"];
|
|
7
|
+
export declare const ACCOUNT_API_KEY_SCOPES: readonly ["account:environments:list", "account:environments:create", "account:environments:delete", "account:environments:set_production", "account:environments:api_keys:list", "account:environments:api_keys:read", "account:environments:api_keys:create", "account:environments:api_keys:delete"];
|
|
8
8
|
export type ConcreteAccountApiKeyScope = (typeof ACCOUNT_API_KEY_SCOPES)[number];
|
|
9
9
|
export type AccountApiKeyScope = ConcreteAccountApiKeyScope | WildcardsFor<'account'>;
|
|
10
10
|
export type CustomerKeyScope = ApiKeyScope | AccountApiKeyScope;
|
package/dist/api.endpoints.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ConfirmEmail, CreateAccountApiKey, DeleteAccountApiKey, GetEmailByExpiredToken, GetEmailByUuid, GetManagedCallback, GetManagedEmailVerification, GetOnboardingAccountDiscovery, ListAccountApiKeys, PostForgotPassword, PostLogout, PostManagedEmailVerification, PostManagedSignup, PostOnboardingRequestInvite, PostSignin, PostSignup, PutResetPassword } from './account/api.js';
|
|
2
2
|
import type { GetAsyncActionResult, GetPublicV1, PostInternalTriggerFunction, PostPublicTriggerAction } from './action/api.js';
|
|
3
3
|
import type { PostImpersonate } from './admin/http.api.js';
|
|
4
|
-
import type { PostAgentSessions } from './agent/api.js';
|
|
4
|
+
import type { DeleteAgentSession, PostAgentSessions } from './agent/api.js';
|
|
5
5
|
import type { GetAgentSessionMcp, PostAgentSessionMcp } from './agent/mcp.api.js';
|
|
6
6
|
import type { EndpointMethod } from './api.js';
|
|
7
7
|
import type { GetAuditTrail, GetAuditTrailExport } from './audit-trail/api.js';
|
|
@@ -13,7 +13,7 @@ import type { DeleteConnection, DeletePublicConnection, GetConnection, GetConnec
|
|
|
13
13
|
import type { PostConnectionMetadata, SetMetadata, UpdateMetadata } from './connection/api/metadata.js';
|
|
14
14
|
import type { GetConnectUISettings, PutConnectUISettings } from './connectUISettings/api.js';
|
|
15
15
|
import type { PostDeploy, PostDeployConfirmation, PostDeployInternal } from './deploy/api.js';
|
|
16
|
-
import type { CreateApiKey, DeleteApiKey, DeleteEnvironment, DeletePublicApiKey, DeletePublicEnvironment, GetEnvironment, GetEnvironments, ListApiKeys, PatchApiKey, PatchEnvironment, PostEnvironment, PostPublicApiKey, PostPublicEnvironment, PostPublicRotateWebhookSigningKey, PostRotateWebhookSigningKey } from './environment/api/index.js';
|
|
16
|
+
import type { CreateApiKey, DeleteApiKey, DeleteEnvironment, DeletePublicApiKey, DeletePublicEnvironment, GetEnvironment, GetEnvironments, GetPublicApiKey, GetPublicApiKeys, GetPublicEnvironments, ListApiKeys, PatchApiKey, PatchEnvironment, PostEnvironment, PostPublicApiKey, PostPublicEnvironment, PostPublicRotateWebhookSigningKey, PostRotateWebhookSigningKey } from './environment/api/index.js';
|
|
17
17
|
import type { PatchWebhook } from './environment/api/webhook.js';
|
|
18
18
|
import type { PostEnvironmentVariables } from './environment/variable/api.js';
|
|
19
19
|
import type { PatchFlowDisable, PatchFlowEnable, PatchFlowFrequency, PostPreBuiltDeploy, PutUpgradePreBuiltFlow } from './flow/http.api.js';
|
|
@@ -25,18 +25,18 @@ import type { GetOperation, PostInsights, SearchFilters, SearchMessages, SearchO
|
|
|
25
25
|
import type { GetMeta } from './meta/api.js';
|
|
26
26
|
import type { DeleteMFA, GetMFAStatus, PostMFAActivation, PostMFAEnrollment, PostMFALoginVerification, PostMFARecoveryCodes } from './mfa/api.js';
|
|
27
27
|
import type { GetPlainHmac } from './plain/api.js';
|
|
28
|
-
import type { DeleteSpendAlert, GetBillingPeriodCosts, GetBillingUsage, GetBillingUsageTopDimensionValues, GetOverdueInvoices, GetSpendAlert, GetUpcomingInvoice, PostPlanChange, PostPlanExtendTrial, PutBillingInvoicingDetails, PutSpendAlert } from './plans/http.api.js';
|
|
28
|
+
import type { DeleteSpendAlert, GetBillingPeriodCosts, GetBillingUsage, GetBillingUsageTopDimensionValues, GetOverdueInvoices, GetProjectedCosts, GetSpendAlert, GetUpcomingInvoice, PostPlanChange, PostPlanExtendTrial, PutBillingInvoicingDetails, PutSpendAlert } from './plans/http.api.js';
|
|
29
29
|
import type { GetProvider, GetProviders, GetPublicProvider, GetPublicProviders } from './providers/api.js';
|
|
30
30
|
import type { AllPublicProxy } from './proxy/http.api.js';
|
|
31
31
|
import type { GetConnectionRecordModels, GetConnectionRecords, GetPublicRecords, PatchPublicPruneRecords } from './record/api.js';
|
|
32
32
|
import type { GetPublicScriptsConfig } from './scripts/http.api.js';
|
|
33
33
|
import type { GetSharedCredentialsProvider, GetSharedCredentialsProviders, PatchSharedCredentialsProvider, PostSharedCredentialsProvider } from './sharedCredentials/api.js';
|
|
34
|
-
import type { GetPublicSyncStatus, PostPublicSyncPause, PostPublicSyncStart, PostPublicTrigger, PutPublicSyncConnectionFrequency } from './sync/api.js';
|
|
34
|
+
import type { GetConnectionSyncs, GetPublicSyncStatus, PostPublicSyncPause, PostPublicSyncStart, PostPublicTrigger, PutPublicSyncConnectionFrequency } from './sync/api.js';
|
|
35
35
|
import type { DeleteTeamUser, GetTeam, PatchTeamUser, PutTeam } from './team/api.js';
|
|
36
36
|
import type { GetUser, PatchUser, PutUserPassword } from './user/api.js';
|
|
37
37
|
import type { PostPublicWebhook } from './webhooks/http.api.js';
|
|
38
|
-
export type PublicApiEndpoints = SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation | PostPublicTrigger | PostPublicTbaAuthorization | PostPublicJwtAuthorization | PostPublicUnauthenticatedAuthorization | PostPublicApiKeyAuthorization | PostPublicBasicAuthorization | GetPublicProviders | GetPublicProvider | GetPublicListIntegrations | GetPublicIntegration | DeletePublicIntegration | PostConnectSessions | PostAgentSessions | PostAgentSessionMcp | GetAgentSessionMcp | PostPublicConnectSessionsReconnect | GetPublicConnections | GetPublicConnection | GetConnectSession | DeleteConnectSession | PostDeployInternal | PostPublicBillAuthorization | DeletePublicConnection | DeleteConnection | PostPublicSignatureAuthorization | PostPublicTwoStepAuthorization | PostPublicWebhook | GetPublicClientMetadata | GetPublicRecords | PatchPublicPruneRecords | GetPublicScriptsConfig | PostPublicConnectTelemetry | PostCliTelemetry | PutPublicSyncConnectionFrequency | PostPublicIntegration | PostPublicQuickstartIntegration | PatchPublicIntegration | GetAsyncActionResult | PostPublicOauthOutboundAuthorization | PostPublicAwsSigV4Authorization | PostPublicConnection | PatchPublicConnection | PostPublicSyncStart | PostPublicSyncPause | GetPublicSyncStatus | GetPublicV1 | PostPublicTriggerAction | PostFunctionCompile | PostFunctionDryrun | GetFunctionDryrun | PostFunctionDryrunResult | PostFunctionDeployment | GetFunctionDeployment | PostFunctionDeploymentResult | PostFunctionInvocation | GetFunctionInvocation | PostFunctionDeploymentBundle | PostFunctionDeploymentBundlePreview | GetPublicFunctionCode | GetPublicIntegrationFunctions | GetPublicIntegrationFunction | DeletePublicIntegrationFunction | GetPublicProviderTemplates | PostPublicRotateWebhookSigningKey | AllPublicProxy | PostPublicEnvironment | DeletePublicEnvironment | PostPublicApiKey | DeletePublicApiKey;
|
|
39
|
-
export type PrivateApiEndpoints = GetAuditTrail | GetAuditTrailExport | ListAccountApiKeys | CreateAccountApiKey | DeleteAccountApiKey | ConfirmEmail | PostSignup | PostSignin | PostLogout | GetTeam | PutTeam | PostPlanExtendTrial | PostPlanChange | PutBillingInvoicingDetails | GetOverdueInvoices | GetBillingUsage | GetBillingUsageTopDimensionValues | GetUpcomingInvoice | GetBillingPeriodCosts | GetSpendAlert | PutSpendAlert | DeleteSpendAlert | GetUser | PatchUser | PutUserPassword | PostInvite | DeleteInvite | DeleteTeamUser | PatchTeamUser | PostInsights | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | PostInternalConnectSessions | GetIntegrationFlows | GetIntegrationFunction | GetIntegrationFunctions | GetFunctionCode | DeleteIntegrationFunction | GetIntegrationTemplates | GetProviderTemplates | DeleteIntegration | PatchIntegration | GetIntegration | PostIntegration | GetConnections | GetConnectionsCount | GetConnection | PatchConnection | PostConnectionMetadata | GetConnectionRecordModels | GetConnectionRecords | GetInvite | GetMeta | GetEmailByExpiredToken | GetEmailByUuid | GetManagedCallback | GetManagedEmailVerification | GetOnboardingAccountDiscovery | PostOnboardingRequestInvite | PatchFlowDisable | PatchFlowEnable | PatchFlowFrequency | PutUpgradePreBuiltFlow | PostConnectionRefresh | PostManagedEmailVerification | PostManagedSignup | PostPreBuiltDeploy | PostEnvironment | PatchEnvironment | DeleteEnvironment | GetEnvironments | GetEnvironment | PostRotateWebhookSigningKey | ListApiKeys | CreateApiKey | DeleteApiKey | PatchApiKey | PatchWebhook | PostEnvironmentVariables | PostImpersonate | GetSharedCredentialsProviders | GetSharedCredentialsProvider | PostSharedCredentialsProvider | PatchSharedCredentialsProvider | GetGettingStarted | PatchGettingStarted | GetConnectUISettings | PutConnectUISettings | GetProviders | GetProvider | PostInternalTriggerFunction | GetMFAStatus | PostMFAEnrollment | PostMFAActivation | PostMFARecoveryCodes | PostMFALoginVerification | DeleteMFA | GetPlainHmac;
|
|
38
|
+
export type PublicApiEndpoints = SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation | PostPublicTrigger | PostPublicTbaAuthorization | PostPublicJwtAuthorization | PostPublicUnauthenticatedAuthorization | PostPublicApiKeyAuthorization | PostPublicBasicAuthorization | GetPublicProviders | GetPublicProvider | GetPublicListIntegrations | GetPublicIntegration | DeletePublicIntegration | PostConnectSessions | PostAgentSessions | DeleteAgentSession | PostAgentSessionMcp | GetAgentSessionMcp | PostPublicConnectSessionsReconnect | GetPublicConnections | GetPublicConnection | GetConnectSession | DeleteConnectSession | PostDeployInternal | PostPublicBillAuthorization | DeletePublicConnection | DeleteConnection | PostPublicSignatureAuthorization | PostPublicTwoStepAuthorization | PostPublicWebhook | GetPublicClientMetadata | GetPublicRecords | PatchPublicPruneRecords | GetPublicScriptsConfig | PostPublicConnectTelemetry | PostCliTelemetry | PutPublicSyncConnectionFrequency | PostPublicIntegration | PostPublicQuickstartIntegration | PatchPublicIntegration | GetAsyncActionResult | PostPublicOauthOutboundAuthorization | PostPublicAwsSigV4Authorization | PostPublicConnection | PatchPublicConnection | PostPublicSyncStart | PostPublicSyncPause | GetPublicSyncStatus | GetPublicV1 | PostPublicTriggerAction | PostFunctionCompile | PostFunctionDryrun | GetFunctionDryrun | PostFunctionDryrunResult | PostFunctionDeployment | GetFunctionDeployment | PostFunctionDeploymentResult | PostFunctionInvocation | GetFunctionInvocation | PostFunctionDeploymentBundle | PostFunctionDeploymentBundlePreview | GetPublicFunctionCode | GetPublicIntegrationFunctions | GetPublicIntegrationFunction | DeletePublicIntegrationFunction | GetPublicProviderTemplates | PostPublicRotateWebhookSigningKey | AllPublicProxy | PostPublicEnvironment | DeletePublicEnvironment | GetPublicEnvironments | GetPublicApiKey | GetPublicApiKeys | PostPublicApiKey | DeletePublicApiKey;
|
|
39
|
+
export type PrivateApiEndpoints = GetAuditTrail | GetAuditTrailExport | ListAccountApiKeys | CreateAccountApiKey | DeleteAccountApiKey | ConfirmEmail | PostSignup | PostSignin | PostLogout | GetTeam | PutTeam | PostPlanExtendTrial | PostPlanChange | PutBillingInvoicingDetails | GetOverdueInvoices | GetBillingUsage | GetBillingUsageTopDimensionValues | GetUpcomingInvoice | GetBillingPeriodCosts | GetProjectedCosts | GetSpendAlert | PutSpendAlert | DeleteSpendAlert | GetUser | PatchUser | PutUserPassword | PostInvite | DeleteInvite | DeleteTeamUser | PatchTeamUser | PostInsights | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | PostInternalConnectSessions | GetIntegrationFlows | GetIntegrationFunction | GetIntegrationFunctions | GetFunctionCode | DeleteIntegrationFunction | GetIntegrationTemplates | GetProviderTemplates | DeleteIntegration | PatchIntegration | GetIntegration | PostIntegration | GetConnections | GetConnectionsCount | GetConnection | PatchConnection | PostConnectionMetadata | GetConnectionRecordModels | GetConnectionRecords | GetConnectionSyncs | GetInvite | GetMeta | GetEmailByExpiredToken | GetEmailByUuid | GetManagedCallback | GetManagedEmailVerification | GetOnboardingAccountDiscovery | PostOnboardingRequestInvite | PatchFlowDisable | PatchFlowEnable | PatchFlowFrequency | PutUpgradePreBuiltFlow | PostConnectionRefresh | PostManagedEmailVerification | PostManagedSignup | PostPreBuiltDeploy | PostEnvironment | PatchEnvironment | DeleteEnvironment | GetEnvironments | GetEnvironment | PostRotateWebhookSigningKey | ListApiKeys | CreateApiKey | DeleteApiKey | PatchApiKey | PatchWebhook | PostEnvironmentVariables | PostImpersonate | GetSharedCredentialsProviders | GetSharedCredentialsProvider | PostSharedCredentialsProvider | PatchSharedCredentialsProvider | GetGettingStarted | PatchGettingStarted | GetConnectUISettings | PutConnectUISettings | GetProviders | GetProvider | PostInternalTriggerFunction | GetMFAStatus | PostMFAEnrollment | PostMFAActivation | PostMFARecoveryCodes | PostMFALoginVerification | DeleteMFA | GetPlainHmac;
|
|
40
40
|
export type APIEndpoints = PrivateApiEndpoints | PublicApiEndpoints;
|
|
41
41
|
/**
|
|
42
42
|
* Automatically narrow endpoints type with Method + Path
|
|
@@ -30,14 +30,28 @@ export type GetAuditTrail = ApiEndpoint<{
|
|
|
30
30
|
to?: string;
|
|
31
31
|
resources?: string;
|
|
32
32
|
actions?: string;
|
|
33
|
+
showTotal?: boolean | undefined;
|
|
33
34
|
};
|
|
34
35
|
Success: {
|
|
35
36
|
data: ApiAuditTrailEvent[];
|
|
37
|
+
total?: AuditTrailTotal;
|
|
36
38
|
pagination: {
|
|
37
39
|
nextCursor: string | null;
|
|
38
40
|
};
|
|
39
41
|
};
|
|
40
42
|
}>;
|
|
43
|
+
/**
|
|
44
|
+
* How many events the filters match, not how many the page holds. Absent unless `showTotal` was
|
|
45
|
+
* asked for, and when the count failed.
|
|
46
|
+
*
|
|
47
|
+
* The read is bounded, so `relation` says whether `value` is the answer or a floor — `gte` means the
|
|
48
|
+
* account has at least this many and the count stopped looking. Shaped after Elasticsearch's `hits.total`
|
|
49
|
+
* so a caller cannot read the number without seeing which it is.
|
|
50
|
+
*/
|
|
51
|
+
export interface AuditTrailTotal {
|
|
52
|
+
value: number;
|
|
53
|
+
relation: 'eq' | 'gte';
|
|
54
|
+
}
|
|
41
55
|
export type AuditExportMaxRows = 50_000;
|
|
42
56
|
export type GetAuditTrailExport = ApiEndpoint<{
|
|
43
57
|
Audit: AuditPolicy<'audit_trail', 'exported', 'account'>;
|
package/dist/billing/types.d.ts
CHANGED
|
@@ -2,15 +2,17 @@ import type { Result } from '../result.js';
|
|
|
2
2
|
import type { DBTeam } from '../team/db.js';
|
|
3
3
|
import type { UsageMetric } from '../usage/index.js';
|
|
4
4
|
export interface BillingClient {
|
|
5
|
-
ingest: (events: BillingEvent[]) => Promise<Result<void>>;
|
|
6
5
|
linkStripeToCustomer(teamId: number, customerId: string): Promise<Result<void>>;
|
|
7
6
|
getOrCreateCustomer: (accountId: number, defaultTo: Pick<BillingInvoicingDetails, 'legalEntityName' | 'email'>) => Promise<Result<BillingCustomer>>;
|
|
8
7
|
getCustomer: (accountId: number) => Promise<Result<BillingCustomer>>;
|
|
9
8
|
putCustomer: (accountId: number, invoicingDetails: BillingInvoicingDetails) => Promise<Result<BillingCustomer>>;
|
|
10
|
-
getSubscription: (accountId: number) => Promise<Result<BillingSubscription
|
|
9
|
+
getSubscription: (accountId: number) => Promise<Result<BillingSubscription>>;
|
|
11
10
|
getOverdueInvoices: (accountId: number) => Promise<Result<BillingOverdueInvoices>>;
|
|
12
11
|
getUpcomingInvoice: (subscriptionId: string) => Promise<Result<BillingUpcomingInvoice | null>>;
|
|
13
|
-
getPeriodCosts: (subscriptionId: string
|
|
12
|
+
getPeriodCosts: (subscriptionId: string, timeframe?: {
|
|
13
|
+
start: Date;
|
|
14
|
+
end: Date;
|
|
15
|
+
}) => Promise<Result<BillingPeriodCosts | null>>;
|
|
14
16
|
getSpendAlert: (subscriptionId: string) => Promise<Result<BillingSpendAlert | null>>;
|
|
15
17
|
setSpendAlert: (subscriptionId: string, opts: {
|
|
16
18
|
thresholdInCents: number;
|
|
@@ -18,17 +20,22 @@ export interface BillingClient {
|
|
|
18
20
|
removeSpendAlert: (subscriptionId: string) => Promise<Result<void>>;
|
|
19
21
|
createSubscription: (team: DBTeam, planExternalId: string) => Promise<Result<BillingSubscription>>;
|
|
20
22
|
getUsage: (subscriptionId: string, opts?: GetBillingUsageOpts) => Promise<Result<BillingUsageMetrics>>;
|
|
21
|
-
upgrade: (opts: {
|
|
22
|
-
subscriptionId: string;
|
|
23
|
-
planExternalId: string;
|
|
24
|
-
}) => Promise<Result<{
|
|
23
|
+
upgrade: (opts: PlanChangeRequest) => Promise<Result<{
|
|
25
24
|
pendingChangeId: string;
|
|
26
25
|
amountInCents: number | null;
|
|
27
26
|
}>>;
|
|
28
|
-
downgrade: (opts:
|
|
27
|
+
downgrade: (opts: PlanChangeRequest) => Promise<Result<void>>;
|
|
28
|
+
startGrowthAddon: (opts: {
|
|
29
29
|
subscriptionId: string;
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
}) => Promise<Result<{
|
|
31
|
+
priceIntervalId: string | null;
|
|
32
|
+
}>>;
|
|
33
|
+
endGrowthAddon: (opts: {
|
|
34
|
+
subscriptionId: string;
|
|
35
|
+
priceIntervalId: string;
|
|
36
|
+
}) => Promise<Result<{
|
|
37
|
+
growthFeaturesEndsAt: Date | null;
|
|
38
|
+
}>>;
|
|
32
39
|
applyPendingChanges: (opts: {
|
|
33
40
|
pendingChangeId: string;
|
|
34
41
|
/**
|
|
@@ -49,6 +56,10 @@ export interface BillingClient {
|
|
|
49
56
|
verifyWebhookSignature(body: string, headers: Record<string, unknown>, secret: string): Result<true>;
|
|
50
57
|
getPlanById(planId: string): Promise<Result<BillingPlan>>;
|
|
51
58
|
}
|
|
59
|
+
export interface PlanChangeRequest {
|
|
60
|
+
subscriptionId: string;
|
|
61
|
+
planExternalId: string;
|
|
62
|
+
}
|
|
52
63
|
export interface BillingCustomer {
|
|
53
64
|
id: string;
|
|
54
65
|
invoicingDetails: BillingInvoicingDetails;
|
|
@@ -78,6 +89,13 @@ export interface BillingSubscription {
|
|
|
78
89
|
id: string;
|
|
79
90
|
pendingChangeId?: string | undefined;
|
|
80
91
|
planExternalId: string;
|
|
92
|
+
hasGrowthFeatures: boolean;
|
|
93
|
+
growthFeaturesEndsAt: Date | null;
|
|
94
|
+
/** Orb's price interval is the allocation of a price for a given time period.
|
|
95
|
+
* The Growth add-on is an external price that gets attached to the plan, so we must parse
|
|
96
|
+
* its interval in order to know whether there's a scheduled operation in the future.
|
|
97
|
+
*/
|
|
98
|
+
growthFeaturesPriceIntervalId: string | null;
|
|
81
99
|
}
|
|
82
100
|
export interface BillingOverdueInvoices {
|
|
83
101
|
hasOverdue: boolean;
|
|
@@ -113,6 +131,7 @@ export interface BillingPeriodCosts {
|
|
|
113
131
|
metric: UsageMetric | null;
|
|
114
132
|
amountInCents: number | null;
|
|
115
133
|
}[];
|
|
134
|
+
fixedInCents: number;
|
|
116
135
|
currency: string;
|
|
117
136
|
}
|
|
118
137
|
export type CounterUsageMetric = Exclude<UsageMetric, 'records' | 'connections'>;
|
|
@@ -221,73 +240,3 @@ export interface BillingPlan {
|
|
|
221
240
|
id: string;
|
|
222
241
|
external_plan_id: string;
|
|
223
242
|
}
|
|
224
|
-
type BillingPropertyValue = string | number | boolean | Date | undefined;
|
|
225
|
-
type BillingProperties = Record<string, BillingPropertyValue | Record<string, BillingPropertyValue>>;
|
|
226
|
-
interface BillingEventBase<TType extends string, TProperties extends BillingProperties = BillingProperties> {
|
|
227
|
-
type: TType;
|
|
228
|
-
properties: {
|
|
229
|
-
timestamp: Date;
|
|
230
|
-
idempotencyKey?: string | undefined;
|
|
231
|
-
accountId: number;
|
|
232
|
-
count: number;
|
|
233
|
-
} & TProperties;
|
|
234
|
-
}
|
|
235
|
-
export type MarBillingEvent = BillingEventBase<'monthly_active_records', {
|
|
236
|
-
environmentId: number;
|
|
237
|
-
environmentName: string;
|
|
238
|
-
integrationId: string;
|
|
239
|
-
syncId: string;
|
|
240
|
-
model: string;
|
|
241
|
-
}>;
|
|
242
|
-
export type RecordsBillingEvent = BillingEventBase<'records', {
|
|
243
|
-
frequencyMs: number;
|
|
244
|
-
telemetry: {
|
|
245
|
-
sizeBytes: number;
|
|
246
|
-
};
|
|
247
|
-
}>;
|
|
248
|
-
export type ActionsBillingEvent = BillingEventBase<'billable_actions', {
|
|
249
|
-
environmentId: number;
|
|
250
|
-
environmentName: string;
|
|
251
|
-
integrationId: string;
|
|
252
|
-
actionName: string;
|
|
253
|
-
}>;
|
|
254
|
-
export type FunctionExecutionsBillingEvent = BillingEventBase<'function_executions', {
|
|
255
|
-
environmentId: number;
|
|
256
|
-
environmentName: string;
|
|
257
|
-
integrationId: string;
|
|
258
|
-
type: string;
|
|
259
|
-
functionName: string;
|
|
260
|
-
telemetry: {
|
|
261
|
-
successes: number;
|
|
262
|
-
failures: number;
|
|
263
|
-
durationMs: number;
|
|
264
|
-
compute: number;
|
|
265
|
-
customLogs: number;
|
|
266
|
-
proxyCalls: number;
|
|
267
|
-
};
|
|
268
|
-
frequencyMs?: number | undefined;
|
|
269
|
-
}>;
|
|
270
|
-
export type ProxyBillingEvent = BillingEventBase<'proxy', {
|
|
271
|
-
environmentId: number;
|
|
272
|
-
environmentName: string;
|
|
273
|
-
integrationId: string;
|
|
274
|
-
telemetry: {
|
|
275
|
-
successes: number;
|
|
276
|
-
failures: number;
|
|
277
|
-
};
|
|
278
|
-
}>;
|
|
279
|
-
export type WebhookForwardBillingEvent = BillingEventBase<'webhook_forwards', {
|
|
280
|
-
environmentId: number;
|
|
281
|
-
environmentName: string;
|
|
282
|
-
integrationId: string;
|
|
283
|
-
telemetry: {
|
|
284
|
-
successes: number;
|
|
285
|
-
failures: number;
|
|
286
|
-
};
|
|
287
|
-
}>;
|
|
288
|
-
export type ConnectionsBillingEvent = BillingEventBase<'billable_connections'>;
|
|
289
|
-
export type ConnectionsBillingEventV2 = BillingEventBase<'billable_connections_v2', {
|
|
290
|
-
frequencyMs: number;
|
|
291
|
-
}>;
|
|
292
|
-
export type BillingEvent = MarBillingEvent | RecordsBillingEvent | ActionsBillingEvent | ProxyBillingEvent | WebhookForwardBillingEvent | FunctionExecutionsBillingEvent | ConnectionsBillingEvent | ConnectionsBillingEventV2;
|
|
293
|
-
export {};
|
package/dist/connect/api.d.ts
CHANGED
|
@@ -114,8 +114,13 @@ export type PostInternalConnectSessions = ApiEndpoint<{
|
|
|
114
114
|
};
|
|
115
115
|
Method: 'POST';
|
|
116
116
|
Path: '/api/v1/connect/sessions';
|
|
117
|
+
Querystring: {
|
|
118
|
+
env: string;
|
|
119
|
+
};
|
|
117
120
|
Success: PostConnectSessions['Success'];
|
|
118
|
-
Body: Pick<ConnectSessionInput, 'allowed_integrations' | 'end_user' | 'organization' | 'integrations_config_defaults' | 'overrides' | 'webhook_url_override'
|
|
121
|
+
Body: Pick<ConnectSessionInput, 'allowed_integrations' | 'end_user' | 'organization' | 'integrations_config_defaults' | 'overrides' | 'webhook_url_override'> & {
|
|
122
|
+
is_preview?: boolean | undefined;
|
|
123
|
+
};
|
|
119
124
|
}>;
|
|
120
125
|
export type PostPublicConnectTelemetry = ApiEndpoint<{
|
|
121
126
|
Audit: {
|
|
@@ -20,6 +20,20 @@ export type GetEnvironments = ApiEndpoint<{
|
|
|
20
20
|
data: Pick<DBEnvironment, 'name' | 'is_production'>[];
|
|
21
21
|
};
|
|
22
22
|
}>;
|
|
23
|
+
export type GetPublicEnvironments = ApiEndpoint<{
|
|
24
|
+
Audit: {
|
|
25
|
+
kind: 'no-audit';
|
|
26
|
+
reason: 'non-auditable';
|
|
27
|
+
};
|
|
28
|
+
Method: 'GET';
|
|
29
|
+
Path: '/environments';
|
|
30
|
+
Querystring: {
|
|
31
|
+
name?: string | undefined;
|
|
32
|
+
};
|
|
33
|
+
Success: {
|
|
34
|
+
data: Pick<DBEnvironment, 'id' | 'uuid' | 'name' | 'is_production'>[];
|
|
35
|
+
};
|
|
36
|
+
}>;
|
|
23
37
|
export type PostEnvironment = ApiEndpoint<{
|
|
24
38
|
Audit: AuditPolicy<'environment', 'created', 'account'>;
|
|
25
39
|
Method: 'POST';
|
|
@@ -210,6 +224,53 @@ export type PostPublicApiKey = ApiEndpoint<{
|
|
|
210
224
|
};
|
|
211
225
|
Error: ApiError<'conflict' | 'resource_capped'>;
|
|
212
226
|
}>;
|
|
227
|
+
export type GetPublicApiKeys = ApiEndpoint<{
|
|
228
|
+
Audit: {
|
|
229
|
+
kind: 'no-audit';
|
|
230
|
+
reason: 'non-auditable';
|
|
231
|
+
};
|
|
232
|
+
Method: 'GET';
|
|
233
|
+
Path: '/environments/:environmentUuid/api-keys';
|
|
234
|
+
Params: {
|
|
235
|
+
environmentUuid: string;
|
|
236
|
+
};
|
|
237
|
+
Querystring: {
|
|
238
|
+
display_name?: string | undefined;
|
|
239
|
+
};
|
|
240
|
+
Success: {
|
|
241
|
+
data: {
|
|
242
|
+
id: number;
|
|
243
|
+
uuid: string;
|
|
244
|
+
display_name: string;
|
|
245
|
+
scopes: ApiKeyScope[];
|
|
246
|
+
last_used_at: string | null;
|
|
247
|
+
created_at: string;
|
|
248
|
+
}[];
|
|
249
|
+
};
|
|
250
|
+
}>;
|
|
251
|
+
export type GetPublicApiKey = ApiEndpoint<{
|
|
252
|
+
Audit: {
|
|
253
|
+
kind: 'no-audit';
|
|
254
|
+
reason: 'non-auditable';
|
|
255
|
+
};
|
|
256
|
+
Method: 'GET';
|
|
257
|
+
Path: '/environments/:environmentUuid/api-keys/:keyUuid';
|
|
258
|
+
Params: {
|
|
259
|
+
environmentUuid: string;
|
|
260
|
+
keyUuid: string;
|
|
261
|
+
};
|
|
262
|
+
Success: {
|
|
263
|
+
data: {
|
|
264
|
+
id: number;
|
|
265
|
+
uuid: string;
|
|
266
|
+
display_name: string;
|
|
267
|
+
scopes: ApiKeyScope[];
|
|
268
|
+
secret: string;
|
|
269
|
+
last_used_at: string | null;
|
|
270
|
+
created_at: string;
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
}>;
|
|
213
274
|
export type DeletePublicApiKey = ApiEndpoint<{
|
|
214
275
|
Audit: AuditPolicy<'api_key', 'deleted', 'environment'>;
|
|
215
276
|
Method: 'DELETE';
|
package/dist/index.d.ts
CHANGED
|
@@ -109,5 +109,4 @@ export type * from './function/trigger.js';
|
|
|
109
109
|
export type * from './functions/api.js';
|
|
110
110
|
export type * from './functions/domain.js';
|
|
111
111
|
export type * from './lambda/index.js';
|
|
112
|
-
export type * from './authz/types.js';
|
|
113
112
|
export type * from './pubsub/events.js';
|
package/dist/logs/messages.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export interface OperationDeploy {
|
|
|
58
58
|
}
|
|
59
59
|
export interface OperationAgentSession {
|
|
60
60
|
type: 'agent_session';
|
|
61
|
-
action: 'create';
|
|
61
|
+
action: 'create' | 'terminate';
|
|
62
62
|
}
|
|
63
63
|
export type OperationList = OperationFunction | OperationSync | OperationProxy | OperationAction | OperationWebhook | OperationOnEvents | OperationDeploy | OperationAuth | OperationAdmin | OperationAgentSession;
|
|
64
64
|
/**
|
package/dist/meta/api.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ApiEndpoint, ApiError } from '../api.js';
|
|
2
2
|
import type { DBEnvironment } from '../environment/db.js';
|
|
3
|
+
export type ApiEnvironmentSummary = Pick<DBEnvironment, 'id' | 'account_id' | 'name' | 'is_production'>;
|
|
3
4
|
export type GetMeta = ApiEndpoint<{
|
|
4
5
|
Audit: {
|
|
5
6
|
kind: 'no-audit';
|
|
@@ -13,13 +14,12 @@ export type GetMeta = ApiEndpoint<{
|
|
|
13
14
|
Error: ApiError<'user_not_found'>;
|
|
14
15
|
Success: {
|
|
15
16
|
data: {
|
|
16
|
-
environments:
|
|
17
|
+
environments: ApiEnvironmentSummary[];
|
|
17
18
|
version: string;
|
|
18
19
|
baseUrl: string;
|
|
19
20
|
debugMode: boolean;
|
|
20
21
|
gettingStartedClosed: boolean;
|
|
21
22
|
auditTrail: boolean;
|
|
22
|
-
s26Pricing: boolean;
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
}>;
|
package/dist/plans/db.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export interface DBPlan extends Timestamps {
|
|
|
11
11
|
orb_future_plan: string | null;
|
|
12
12
|
orb_future_plan_at: Date | null;
|
|
13
13
|
orb_subscribed_at: Date | null;
|
|
14
|
+
has_growth_features: boolean;
|
|
15
|
+
growth_features_ends_at: Date | null;
|
|
14
16
|
trial_start_at: Date | null;
|
|
15
17
|
trial_end_at: Date | null;
|
|
16
18
|
trial_extension_count: number;
|
package/dist/plans/http.api.d.ts
CHANGED
|
@@ -29,8 +29,11 @@ export interface PlanDefinition {
|
|
|
29
29
|
nextPlan: string[] | null;
|
|
30
30
|
prevPlan: string[] | null;
|
|
31
31
|
basePrice?: number;
|
|
32
|
+
keepsGrowthAddOnOnMigration?: boolean;
|
|
32
33
|
cta?: string;
|
|
33
34
|
hidden?: boolean;
|
|
35
|
+
/** No longer sold, but accounts already on it keep it. */
|
|
36
|
+
retired?: boolean;
|
|
34
37
|
flags: Omit<Partial<DBPlan>, 'id' | 'account_id' | 'name'>;
|
|
35
38
|
}
|
|
36
39
|
export type GetPlans = ApiEndpoint<{
|
|
@@ -175,8 +178,11 @@ export type GetBillingPeriodCosts = ApiEndpoint<{
|
|
|
175
178
|
};
|
|
176
179
|
Method: 'GET';
|
|
177
180
|
Path: '/api/v1/plans/billing/period-costs';
|
|
181
|
+
/** Omitting `from` and `to` uses the current billing period. */
|
|
178
182
|
Querystring: {
|
|
179
183
|
env: string;
|
|
184
|
+
from?: string;
|
|
185
|
+
to?: string;
|
|
180
186
|
};
|
|
181
187
|
Success: {
|
|
182
188
|
data: {
|
|
@@ -186,6 +192,7 @@ export type GetBillingPeriodCosts = ApiEndpoint<{
|
|
|
186
192
|
/** False when some usage price mapped to no metric of ours — an absent metric can't safely
|
|
187
193
|
* read as $0, since the money might be one of theirs. */
|
|
188
194
|
fullyAttributed: boolean;
|
|
195
|
+
fixedInCents: number;
|
|
189
196
|
currency: string | null;
|
|
190
197
|
/** True when there's no billing period to report costs for — a free plan, no linked
|
|
191
198
|
* subscription, or an ended one. `metrics`/`currency` are otherwise never empty/null. */
|
|
@@ -193,6 +200,35 @@ export type GetBillingPeriodCosts = ApiEndpoint<{
|
|
|
193
200
|
};
|
|
194
201
|
};
|
|
195
202
|
}>;
|
|
203
|
+
export type GetProjectedCosts = ApiEndpoint<{
|
|
204
|
+
Audit: {
|
|
205
|
+
kind: 'no-audit';
|
|
206
|
+
reason: 'non-auditable';
|
|
207
|
+
};
|
|
208
|
+
Method: 'GET';
|
|
209
|
+
Path: '/api/v1/plans/billing/projected-costs';
|
|
210
|
+
Querystring: {
|
|
211
|
+
env: string;
|
|
212
|
+
} | {
|
|
213
|
+
env: string;
|
|
214
|
+
from: string;
|
|
215
|
+
to: string;
|
|
216
|
+
};
|
|
217
|
+
Success: {
|
|
218
|
+
data: {
|
|
219
|
+
metrics: Partial<Record<UsageMetric, number>>;
|
|
220
|
+
subtotalInCents: number;
|
|
221
|
+
minimumInCents: number;
|
|
222
|
+
minimumApplied: boolean;
|
|
223
|
+
growthAddOnInCents: number;
|
|
224
|
+
totalInCents: number;
|
|
225
|
+
periodComplete: boolean;
|
|
226
|
+
currency: string;
|
|
227
|
+
/** True when no Pay-as-you-go migration is scheduled. */
|
|
228
|
+
notApplicable: boolean;
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
}>;
|
|
196
232
|
export type GetSpendAlert = ApiEndpoint<{
|
|
197
233
|
Audit: {
|
|
198
234
|
kind: 'no-audit';
|
|
@@ -264,6 +300,7 @@ export type PostPlanChange = ApiEndpoint<{
|
|
|
264
300
|
};
|
|
265
301
|
Body: {
|
|
266
302
|
orbId: string;
|
|
303
|
+
withGrowthFeatures: boolean;
|
|
267
304
|
};
|
|
268
305
|
Success: {
|
|
269
306
|
data: {
|
package/dist/sync/api.d.ts
CHANGED
|
@@ -1,6 +1,53 @@
|
|
|
1
1
|
import type { ApiEndpoint, ApiError } from '../api.js';
|
|
2
2
|
import type { AuditPolicy } from '../audit-trail/event.js';
|
|
3
|
-
import type { ReportedSyncJobStatus } from './index.js';
|
|
3
|
+
import type { ReportedSyncJobStatus, SyncResultByModel, SyncStatus } from './index.js';
|
|
4
|
+
export interface ApiConnectionSyncJob {
|
|
5
|
+
created_at: string;
|
|
6
|
+
updated_at: string;
|
|
7
|
+
status: SyncStatus;
|
|
8
|
+
result: SyncResultByModel | null;
|
|
9
|
+
}
|
|
10
|
+
export interface ApiConnectionSync {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
variant: string;
|
|
14
|
+
nango_connection_id: number;
|
|
15
|
+
models: string[];
|
|
16
|
+
frequency: string | null;
|
|
17
|
+
/** null when the orchestrator has no schedule for the sync, or could not be reached. */
|
|
18
|
+
schedule_status: 'STARTED' | 'PAUSED' | 'DELETED' | null;
|
|
19
|
+
status: SyncStatus;
|
|
20
|
+
/** Unix seconds. */
|
|
21
|
+
futureActionTimes: number[];
|
|
22
|
+
latest_sync: ApiConnectionSyncJob | null;
|
|
23
|
+
/** Keyed by bare model name; null when the record store could not be reached. */
|
|
24
|
+
record_count: Record<string, number> | null;
|
|
25
|
+
}
|
|
26
|
+
export type GetConnectionSyncs = ApiEndpoint<{
|
|
27
|
+
Audit: {
|
|
28
|
+
kind: 'no-audit';
|
|
29
|
+
reason: 'non-auditable';
|
|
30
|
+
};
|
|
31
|
+
Method: 'GET';
|
|
32
|
+
Path: '/api/v1/sync';
|
|
33
|
+
Querystring: {
|
|
34
|
+
env: string;
|
|
35
|
+
connection_id: string;
|
|
36
|
+
provider_config_key: string;
|
|
37
|
+
name?: string | undefined;
|
|
38
|
+
variant?: string | undefined;
|
|
39
|
+
page?: number | undefined;
|
|
40
|
+
limit?: number | undefined;
|
|
41
|
+
};
|
|
42
|
+
Success: {
|
|
43
|
+
data: ApiConnectionSync[];
|
|
44
|
+
pagination: {
|
|
45
|
+
total: number;
|
|
46
|
+
page: number;
|
|
47
|
+
limit: number;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
}>;
|
|
4
51
|
export type PostPublicTrigger = ApiEndpoint<{
|
|
5
52
|
Audit: {
|
|
6
53
|
kind: 'no-audit';
|
package/dist/team/api.d.ts
CHANGED
package/dist/user/api.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type GetUser = ApiEndpoint<{
|
|
|
10
10
|
Method: 'GET';
|
|
11
11
|
Path: `/api/v1/user`;
|
|
12
12
|
Success: {
|
|
13
|
-
data:
|
|
13
|
+
data: ApiUserWithGrants;
|
|
14
14
|
};
|
|
15
15
|
}>;
|
|
16
16
|
export type InternalGetUsers = Endpoint<{
|
|
@@ -44,10 +44,12 @@ export interface ApiUser {
|
|
|
44
44
|
role: Role;
|
|
45
45
|
gettingStartedClosed: boolean;
|
|
46
46
|
}
|
|
47
|
-
export type
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
export type ApiGrant = {
|
|
48
|
+
can: string[];
|
|
49
|
+
where: string[];
|
|
50
|
+
};
|
|
51
|
+
export type ApiUserWithGrants = ApiUser & {
|
|
52
|
+
grants: readonly ApiGrant[];
|
|
51
53
|
hasPassword: boolean;
|
|
52
54
|
};
|
|
53
55
|
export type PutUserPassword = ApiEndpoint<{
|
|
@@ -1,28 +1,12 @@
|
|
|
1
|
+
import type { FunctionTrigger } from '../function/trigger.js';
|
|
1
2
|
import type { JsonValue } from 'type-fest';
|
|
2
|
-
|
|
3
|
-
* SQS message envelope for the webhook task-dispatch queue.
|
|
4
|
-
*
|
|
5
|
-
* The server produces one of these per (syncConfig × webhook subscription × connection)
|
|
6
|
-
* triple resulting from an inbound provider webhook. The jobs consumer parses these and
|
|
7
|
-
* calls the orchestrator to schedule the actual webhook task using `taskName` as the
|
|
8
|
-
* idempotency key.
|
|
9
|
-
*/
|
|
10
|
-
export interface WebhookDispatchMessage {
|
|
3
|
+
interface DispatchMessageBase {
|
|
11
4
|
version: 1;
|
|
12
|
-
kind: 'webhook';
|
|
13
|
-
/**
|
|
14
|
-
* Deterministic scheduler task name; used by the orchestrator as the
|
|
15
|
-
* idempotency key so duplicate SQS deliveries resolve to the same task.
|
|
16
|
-
*/
|
|
17
|
-
taskName: string;
|
|
18
5
|
createdAt: string;
|
|
19
6
|
accountId: number;
|
|
20
7
|
integrationId: number;
|
|
21
8
|
provider: string;
|
|
22
|
-
|
|
23
|
-
/** Webhook subscription name matched on the inbound payload; passed to executeWebhook as args.webhookName. */
|
|
24
|
-
webhookName: string;
|
|
25
|
-
/** Activity log id created before enqueue; reused so redelivery of this published message keeps the same taskName. */
|
|
9
|
+
/** Activity log created before enqueue and reused by the eventual execution. */
|
|
26
10
|
activityLogId: string;
|
|
27
11
|
connection: {
|
|
28
12
|
id: number;
|
|
@@ -30,5 +14,41 @@ export interface WebhookDispatchMessage {
|
|
|
30
14
|
provider_config_key: string;
|
|
31
15
|
environment_id: number;
|
|
32
16
|
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* SQS message envelope for the webhook task-dispatch queue.
|
|
20
|
+
*
|
|
21
|
+
* The server produces one of these per (syncConfig × webhook subscription × connection)
|
|
22
|
+
* triple resulting from an inbound provider webhook. The jobs consumer parses these and
|
|
23
|
+
* calls the orchestrator to schedule the legacy webhook task using `taskName` as its
|
|
24
|
+
* task name.
|
|
25
|
+
*/
|
|
26
|
+
export interface LegacyDispatchMessage extends DispatchMessageBase {
|
|
27
|
+
kind: 'webhook';
|
|
28
|
+
/** Deterministic scheduler task name used to deduplicate queue redeliveries. */
|
|
29
|
+
taskName: string;
|
|
30
|
+
parentSyncName: string;
|
|
31
|
+
/** Webhook subscription name matched on the inbound payload; passed to executeWebhook as args.webhookName. */
|
|
32
|
+
webhookName: string;
|
|
33
33
|
payload: JsonValue;
|
|
34
34
|
}
|
|
35
|
+
export interface FunctionDispatchMessage extends DispatchMessageBase {
|
|
36
|
+
kind: 'function';
|
|
37
|
+
/** Deterministic key used to deduplicate queue redeliveries. */
|
|
38
|
+
idempotencyKey: string;
|
|
39
|
+
functionName: string;
|
|
40
|
+
trigger: Omit<Extract<FunctionTrigger, {
|
|
41
|
+
kind: 'http';
|
|
42
|
+
}>, 'request' | 'connection'> & {
|
|
43
|
+
request: Extract<FunctionTrigger, {
|
|
44
|
+
kind: 'http';
|
|
45
|
+
}>['request'];
|
|
46
|
+
subscriptions: string[];
|
|
47
|
+
connection: NonNullable<Extract<FunctionTrigger, {
|
|
48
|
+
kind: 'http';
|
|
49
|
+
}>['connection']>;
|
|
50
|
+
};
|
|
51
|
+
maxConcurrency: number;
|
|
52
|
+
}
|
|
53
|
+
export type DispatchMessage = LegacyDispatchMessage | FunctionDispatchMessage;
|
|
54
|
+
export {};
|
package/package.json
CHANGED
package/dist/authz/types.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Role } from '../user/db.js';
|
|
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' | 'account_key' | 'environment_variable' | 'webhook' | 'integration' | 'connection' | 'flow' | 'sync_command' | 'secret_key' | 'connection_credential' | 'log' | 'audit_trail' | '*';
|
|
4
|
-
export type Scope = 'production' | 'non-production' | 'global';
|
|
5
|
-
export interface Permission {
|
|
6
|
-
action: Action;
|
|
7
|
-
resource: Resource;
|
|
8
|
-
scope: Scope;
|
|
9
|
-
}
|
|
10
|
-
export interface PermissionEvaluator {
|
|
11
|
-
evaluate(role: Role, permission: Permission): Promise<boolean>;
|
|
12
|
-
}
|