@nangohq/types 0.71.14 → 0.72.1

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.
@@ -1,6 +1,6 @@
1
1
  /** Every wildcard in a namespace: `environment:*`, `environment:connections:*`, … */
2
2
  export type WildcardsFor<Namespace extends string> = `${Namespace}:*` | `${Namespace}:${string}:*`;
3
- export declare const API_KEY_SCOPES: readonly ["environment:integrations:list", "environment:integrations:list_credentials", "environment:integrations:list_functions", "environment:integrations:read", "environment:integrations:read_credentials", "environment:integrations:create", "environment:integrations:update", "environment:integrations:delete", "environment:connections:list", "environment:connections:list_credentials", "environment:connections:read", "environment:connections:read_credentials", "environment:connections:create", "environment:connections:update", "environment:connections:delete", "environment:connect_sessions:write", "environment:agent_sessions:write", "environment:syncs:read", "environment:syncs:execute", "environment:syncs:update", "environment:syncs:variant:create", "environment:syncs:variant:delete", "environment:functions:list", "environment:functions:read", "environment:functions:update", "environment:functions:delete", "environment:functions:compile", "environment:functions:dryrun", "environment:functions:invocations", "environment:deploy", "environment:records:read", "environment:records:write", "environment:logs:read", "environment:actions:execute", "environment:proxy", "environment:variables:read", "environment:webhook_signing_key:rotate", "environment:mcp"];
3
+ export declare const API_KEY_SCOPES: readonly ["environment:integrations:list", "environment:integrations:list_credentials", "environment:integrations:list_functions", "environment:integrations:read", "environment:integrations:read_credentials", "environment:integrations:create", "environment:integrations:update", "environment:integrations:delete", "environment:connections:list", "environment:connections:list_credentials", "environment:connections:read", "environment:connections:read_credentials", "environment:connections:create", "environment:connections:update", "environment:connections:delete", "environment:connect_sessions:write", "environment:agent_sessions:write", "environment:syncs:read", "environment:syncs:execute", "environment:syncs:update", "environment:syncs:variant:create", "environment:syncs:variant:delete", "environment:functions:list", "environment:functions:read", "environment:functions:update", "environment:functions:delete", "environment:functions:compile", "environment:functions:dryrun", "environment:functions:invocations", "environment:deploy", "environment:records:read", "environment:records:write", "environment:logs:read", "environment:tools:call", "environment:proxy", "environment:variables:read", "environment:webhook_signing_key:rotate", "environment:mcp"];
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'>;
@@ -18,7 +18,7 @@ import type { CreateApiKey, DeleteApiKey, DeleteEnvironment, DeletePublicApiKey,
18
18
  import type { PatchWebhook } from './environment/api/webhook.js';
19
19
  import type { PostEnvironmentVariables } from './environment/variable/api.js';
20
20
  import type { PatchFlowDisable, PatchFlowEnable, PatchFlowFrequency, PostPreBuiltDeploy, PutUpgradePreBuiltFlow } from './flow/http.api.js';
21
- import type { DeleteFunctionVariant, DeleteIntegrationFunction, DeletePublicIntegrationFunction, GetFunction, GetFunctionDeployment, GetFunctionDryrun, GetFunctionInvocation, GetFunctions, GetIntegrationFunction, GetIntegrationFunctions, GetIntegrationTemplates, GetProviderTemplates, GetPublicIntegrationFunction, GetPublicIntegrationFunctions, GetPublicProviderTemplates, PatchConnectionFunction, PatchFunction, PatchFunctionVariant, PostFunctionCompile, PostFunctionDeployment, PostFunctionDeploymentBundle, PostFunctionDeploymentBundlePreview, PostFunctionDeploymentResult, PostFunctionDryrun, PostFunctionDryrunResult, PostFunctionInvocation, PostFunctionVariant, PostToolCall } from './functions/api.js';
21
+ import type { DeleteFunctionVariant, DeleteIntegrationFunction, DeletePublicIntegrationFunction, GetFunction, GetFunctionDeployment, GetFunctionDryrun, GetFunctionInvocation, GetFunctions, GetIntegrationFunction, GetIntegrationFunctions, GetIntegrationTemplates, GetProviderTemplateCode, GetProviderTemplates, GetPublicIntegrationFunction, GetPublicIntegrationFunctions, GetPublicProviderTemplateCode, GetPublicProviderTemplates, PatchConnectionFunction, PatchFunction, PatchFunctionVariant, PostFunctionCompile, PostFunctionDeployment, PostFunctionDeploymentBundle, PostFunctionDeploymentBundlePreview, PostFunctionDeploymentResult, PostFunctionDryrun, PostFunctionDryrunResult, PostFunctionInvocation, PostFunctionVariant, PostToolCall } from './functions/api.js';
22
22
  import type { GetGettingStarted, PatchGettingStarted } from './gettingStarted/api.js';
23
23
  import type { DeleteIntegration, DeletePublicIntegration, GetFunctionCode, GetIntegration, GetIntegrationFlows, GetPublicFunctionCode, GetPublicIntegration, GetPublicListIntegrations, PatchIntegration, PatchPublicIntegration, PostIntegration, PostPublicIntegration, PostPublicQuickstartIntegration } from './integration/api.js';
24
24
  import type { DeleteInvite, GetInvite, PostInvite } from './invitations/api.js';
@@ -37,8 +37,8 @@ import type { GetConnectionSyncs, GetPublicSyncStatus, PostPublicSyncPause, Post
37
37
  import type { DeleteTeamUser, GetTeam, PatchTeamUser, PutTeam } from './team/api.js';
38
38
  import type { GetUser, PatchUser, PutUserPassword } from './user/api.js';
39
39
  import type { PostPublicWebhook } from './webhooks/http.api.js';
40
- export type PublicApiEndpoints = SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation | PostPublicTrigger | PostPublicTbaAuthorization | PostPublicJwtAuthorization | PostPublicUnauthenticatedAuthorization | PostPublicApiKeyAuthorization | PostPublicBasicAuthorization | GetPublicProviders | GetPublicProvider | GetPublicListIntegrations | GetPublicIntegration | DeletePublicIntegration | PostConnectSessions | PostAgentSessions | DeleteAgentSession | PostAgentSessionMcp | GetAgentSessionMcp | PostConnectionToolsMcp | GetConnectionToolsMcp | 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 | GetFunction | GetFunctions | PatchFunction | PostFunctionDryrun | GetFunctionDryrun | PostFunctionDryrunResult | PostFunctionDeployment | GetFunctionDeployment | PostFunctionDeploymentResult | PostFunctionInvocation | PostFunctionVariant | PatchFunctionVariant | PatchConnectionFunction | DeleteFunctionVariant | GetFunctionInvocation | PostFunctionDeploymentBundle | PostFunctionDeploymentBundlePreview | GetPublicFunctionCode | GetPublicIntegrationFunctions | GetPublicIntegrationFunction | PostToolCall | DeletePublicIntegrationFunction | GetPublicProviderTemplates | PostPublicRotateWebhookSigningKey | AllPublicProxy | PostPublicEnvironment | DeletePublicEnvironment | GetPublicEnvironment | GetPublicEnvironments | GetPublicApiKey | GetPublicApiKeys | PostPublicApiKey | PatchPublicApiKey | DeletePublicApiKey;
41
- 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 | PostInternalInvokeFunction | GetMFAStatus | PostMFAEnrollment | PostMFAActivation | PostMFARecoveryCodes | PostMFALoginVerification | DeleteMFA | GetPlainHmac | PostAgentPlaygroundChat;
40
+ export type PublicApiEndpoints = SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation | PostPublicTrigger | PostPublicTbaAuthorization | PostPublicJwtAuthorization | PostPublicUnauthenticatedAuthorization | PostPublicApiKeyAuthorization | PostPublicBasicAuthorization | GetPublicProviders | GetPublicProvider | GetPublicListIntegrations | GetPublicIntegration | DeletePublicIntegration | PostConnectSessions | PostAgentSessions | DeleteAgentSession | PostAgentSessionMcp | GetAgentSessionMcp | PostConnectionToolsMcp | GetConnectionToolsMcp | 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 | GetFunction | GetFunctions | PatchFunction | PostFunctionDryrun | GetFunctionDryrun | PostFunctionDryrunResult | PostFunctionDeployment | GetFunctionDeployment | PostFunctionDeploymentResult | PostFunctionInvocation | PostFunctionVariant | PatchFunctionVariant | PatchConnectionFunction | DeleteFunctionVariant | GetFunctionInvocation | PostFunctionDeploymentBundle | PostFunctionDeploymentBundlePreview | GetPublicFunctionCode | GetPublicIntegrationFunctions | GetPublicIntegrationFunction | PostToolCall | DeletePublicIntegrationFunction | GetPublicProviderTemplates | GetPublicProviderTemplateCode | PostPublicRotateWebhookSigningKey | AllPublicProxy | PostPublicEnvironment | DeletePublicEnvironment | GetPublicEnvironment | GetPublicEnvironments | GetPublicApiKey | GetPublicApiKeys | PostPublicApiKey | PatchPublicApiKey | DeletePublicApiKey;
41
+ 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 | GetProviderTemplateCode | 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 | PostInternalInvokeFunction | GetMFAStatus | PostMFAEnrollment | PostMFAActivation | PostMFARecoveryCodes | PostMFALoginVerification | DeleteMFA | GetPlainHmac | PostAgentPlaygroundChat;
42
42
  export type APIEndpoints = PrivateApiEndpoints | PublicApiEndpoints;
43
43
  /**
44
44
  * Automatically narrow endpoints type with Method + Path
@@ -103,6 +103,7 @@ export type PostPublicEnvironment = ApiEndpoint<{
103
103
  on_sync_error?: boolean | undefined;
104
104
  on_async_action_completion?: boolean | undefined;
105
105
  on_connection_deletion?: boolean | undefined;
106
+ signing_key?: string | undefined;
106
107
  } | undefined;
107
108
  };
108
109
  Success: {
@@ -1,5 +1,6 @@
1
1
  import type { OnEventType } from '../scripts/on-events/api.js';
2
- export type FunctionTags = Record<string, string | string[]>;
2
+ export type FunctionTagValue = string | string[];
3
+ export type FunctionTags = Record<string, FunctionTagValue>;
3
4
  export interface FunctionCapabilities {
4
5
  usesRecords: boolean;
5
6
  usesOutbound: boolean;
@@ -1,6 +1,7 @@
1
1
  import type { TimestampsAndDeletedAt } from '../db.js';
2
2
  import type { FunctionSource } from '../syncConfigs/db.js';
3
3
  import type { FunctionCapabilities, FunctionLimits, FunctionRequires, FunctionTags, FunctionTriggerDefinition } from './config.js';
4
+ import type { ToolTags } from './tool.js';
4
5
  import type { JSONSchema7 } from 'json-schema';
5
6
  export interface DBFunctionConfig extends TimestampsAndDeletedAt {
6
7
  id: number;
@@ -15,7 +16,7 @@ export interface DBFunctionConfigVersion extends TimestampsAndDeletedAt {
15
16
  id: number;
16
17
  function_config_id: number;
17
18
  description: string;
18
- tags: FunctionTags;
19
+ tags: FunctionTags | ToolTags;
19
20
  file_location: string;
20
21
  version: string;
21
22
  source: FunctionSource;
@@ -1,5 +1,20 @@
1
- import type { FunctionTags } from './config.js';
2
- export type ToolTags = {
3
- required_scopes?: string[];
1
+ import type { FunctionTagValue } from './config.js';
2
+ /** Explicit provider scope requirements; omit the declaration when requirements are unknown. */
3
+ export type RequiredScopes = {
4
+ all: [string, ...string[]];
5
+ any?: never;
6
+ none?: never;
7
+ } | {
8
+ any: [string, ...string[]];
9
+ all?: never;
10
+ none?: never;
11
+ } | {
12
+ none: true;
13
+ all?: never;
14
+ any?: never;
15
+ };
16
+ export interface ToolTags {
4
17
  instructions?: string;
5
- } & FunctionTags;
18
+ required_scopes?: RequiredScopes;
19
+ [key: string]: FunctionTagValue | RequiredScopes;
20
+ }
@@ -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 { FunctionCapabilities, FunctionLimits, FunctionRequires, FunctionTags, FunctionTriggerDefinition } from '../function/config.js';
4
+ import type { ToolTags } from '../function/tool.js';
4
5
  import type { FunctionSource } from '../syncConfigs/db.js';
5
6
  import type { FunctionListType, FunctionType, ListedNangoFunction, NangoActionFunction, NangoFunctionTemplate, NangoSyncFunction } from './domain.js';
6
7
  import type { JSONSchema7 } from 'json-schema';
@@ -229,7 +230,7 @@ export interface GetFunctionResponse {
229
230
  provider: string;
230
231
  name: string;
231
232
  description: string;
232
- tags: FunctionTags;
233
+ tags: FunctionTags | ToolTags;
233
234
  state: 'enabled' | 'disabled';
234
235
  source: FunctionSource;
235
236
  trigger: FunctionTriggerDefinition;
@@ -301,7 +302,7 @@ export type PostFunctionInvocation = ApiEndpoint<{
301
302
  invocation_type: FunctionInvocationType;
302
303
  options?: Record<string, unknown> | undefined;
303
304
  };
304
- Error: ApiError<FunctionInvocationErrorCode>;
305
+ Error: ApiError<FunctionInvocationErrorCode | 'function_runtime_error'>;
305
306
  Success: FunctionInvocationSuccess;
306
307
  }>;
307
308
  export type FunctionVariantErrorCode = 'invalid_variant' | 'function_not_found' | 'connection_not_found' | 'function_disabled' | 'function_variant_not_found' | 'invalid_frequency' | 'resource_capped' | 'server_error';
@@ -385,7 +386,7 @@ export type GetFunctionInvocation = ApiEndpoint<{
385
386
  functionUuid: string;
386
387
  id: string;
387
388
  };
388
- Error: ApiError<'invalid_uri_params' | 'not_found' | 'function_not_found' | 'connection_not_found' | 'function_failed' | 'server_error'>;
389
+ Error: ApiError<'invalid_uri_params' | 'not_found' | 'function_not_found' | 'connection_not_found' | 'function_failed' | 'function_runtime_error' | 'server_error'>;
389
390
  Success: FunctionInvocationSuccess;
390
391
  }>;
391
392
  export interface FunctionListFilters {
@@ -537,7 +538,7 @@ export type PostToolCall = ApiEndpoint<{
537
538
  Body: {
538
539
  input?: unknown | undefined;
539
540
  };
540
- Error: ApiError<FunctionInvocationErrorCode | 'ambiguous_connection'>;
541
+ Error: ApiError<FunctionInvocationErrorCode | 'function_runtime_error' | 'ambiguous_connection'>;
541
542
  Success: FunctionInvocationSuccess;
542
543
  }>;
543
544
  export type GetPublicProviderTemplates = ApiEndpoint<{
@@ -552,6 +553,53 @@ export type GetPublicProviderTemplates = ApiEndpoint<{
552
553
  };
553
554
  Success: ProviderTemplatesSuccess;
554
555
  }>;
556
+ type ProviderTemplateCodeError = ApiError<'unknown_function'> | ApiError<'source_unavailable'> | ApiError<'ambiguous_function', undefined, {
557
+ matches: {
558
+ type: FunctionType;
559
+ name: string;
560
+ }[];
561
+ }>;
562
+ export type GetPublicProviderTemplateCode = ApiEndpoint<{
563
+ Audit: {
564
+ kind: 'no-audit';
565
+ reason: 'non-auditable';
566
+ };
567
+ Method: 'GET';
568
+ Path: '/providers/:provider/templates/:name/code';
569
+ Params: {
570
+ provider: string;
571
+ name: string;
572
+ };
573
+ Querystring: {
574
+ type?: FunctionType | undefined;
575
+ };
576
+ Success: {
577
+ type: FunctionType;
578
+ code: string;
579
+ };
580
+ Error: ProviderTemplateCodeError;
581
+ }>;
582
+ export type GetProviderTemplateCode = ApiEndpoint<{
583
+ Audit: {
584
+ kind: 'no-audit';
585
+ reason: 'non-auditable';
586
+ };
587
+ Method: 'GET';
588
+ Path: '/api/v1/providers/:providerConfigKey/templates/:name/code';
589
+ Params: {
590
+ providerConfigKey: string;
591
+ name: string;
592
+ };
593
+ Querystring: {
594
+ env: string;
595
+ type?: FunctionType | undefined;
596
+ };
597
+ Success: {
598
+ type: FunctionType;
599
+ code: string;
600
+ };
601
+ Error: ProviderTemplateCodeError;
602
+ }>;
555
603
  export type GetIntegrationTemplates = ApiEndpoint<{
556
604
  Audit: {
557
605
  kind: 'no-audit';
@@ -573,7 +621,7 @@ export interface FunctionDeploymentArtifact {
573
621
  name: string;
574
622
  integrationId: string;
575
623
  description: string;
576
- tags?: FunctionTags | undefined;
624
+ tags?: FunctionTags | ToolTags | undefined;
577
625
  trigger: FunctionTriggerDefinition;
578
626
  requires: FunctionRequires;
579
627
  capabilities: FunctionCapabilities;
package/dist/index.d.ts CHANGED
@@ -118,3 +118,4 @@ export type * from './functions/domain.js';
118
118
  export type * from './lambda/index.js';
119
119
  export type * from './pubsub/events.js';
120
120
  export type { SignupAdvertising } from './account/signupAdvertising.js';
121
+ export type * from './self-hosting/db.js';
@@ -2,7 +2,7 @@ import type { ApiEndpoint, ApiError, ApiTimestamps } from '../api.js';
2
2
  import type { AuditPolicy } from '../audit-trail/event.js';
3
3
  import type { AuthModes, AuthModeType } from '../auth/api.js';
4
4
  import type { NangoSyncConfig } from '../flow/index.js';
5
- import type { ScriptTypeLiteral } from '../nangoYaml/index.js';
5
+ import type { FunctionListType } from '../functions/domain.js';
6
6
  import type { Provider } from '../providers/provider.js';
7
7
  import type { IntegrationConfig } from './db.js';
8
8
  import type { Merge } from 'type-fest';
@@ -70,11 +70,18 @@ export type PostPublicIntegration = ApiEndpoint<{
70
70
  provider: string;
71
71
  unique_key: string;
72
72
  display_name?: string | undefined;
73
- credentials?: ApiPublicIntegrationCredentials | undefined;
74
73
  forward_webhooks?: boolean | undefined;
74
+ } & ({
75
+ credentials?: ApiPublicIntegrationCredentials | undefined;
75
76
  integration_config?: Record<string, string> | undefined;
76
77
  custom?: Record<string, string> | undefined;
77
- };
78
+ } | {
79
+ credentials: {
80
+ type: 'NANGO_MANAGED';
81
+ };
82
+ integration_config?: never;
83
+ custom?: never;
84
+ });
78
85
  Success: {
79
86
  data: ApiPublicIntegration;
80
87
  };
@@ -152,18 +159,13 @@ export type GetPublicFunctionCode = ApiEndpoint<{
152
159
  name: string;
153
160
  };
154
161
  Querystring: {
155
- type?: ScriptTypeLiteral | undefined;
162
+ type?: FunctionListType | undefined;
156
163
  };
157
164
  Success: {
158
- type: ScriptTypeLiteral;
165
+ type: FunctionListType;
159
166
  code: string;
160
167
  };
161
- Error: ApiError<'not_found'> | ApiError<'ambiguous_function', undefined, {
162
- matches: {
163
- type: ScriptTypeLiteral;
164
- name: string;
165
- }[];
166
- }>;
168
+ Error: ApiError<'not_found'>;
167
169
  }>;
168
170
  export type GetFunctionCode = ApiEndpoint<{
169
171
  Audit: {
@@ -178,18 +180,13 @@ export type GetFunctionCode = ApiEndpoint<{
178
180
  };
179
181
  Querystring: {
180
182
  env: string;
181
- type?: ScriptTypeLiteral | undefined;
183
+ type?: FunctionListType | undefined;
182
184
  };
183
185
  Success: {
184
- type: ScriptTypeLiteral;
186
+ type: FunctionListType;
185
187
  code: string;
186
188
  };
187
- Error: ApiError<'not_found'> | ApiError<'ambiguous_function', undefined, {
188
- matches: {
189
- type: ScriptTypeLiteral;
190
- name: string;
191
- }[];
192
- }>;
189
+ Error: ApiError<'not_found'>;
193
190
  }>;
194
191
  export type ApiIntegration = Omit<Merge<IntegrationConfig, ApiTimestamps>, 'oauth_client_secret_iv' | 'oauth_client_secret_tag'>;
195
192
  export type ApiIntegrationList = ApiIntegration & {
@@ -1,3 +1,4 @@
1
+ import type { ApiKeyPrincipal } from '../api-keys/auth.js';
1
2
  import type { AllAuthCredentials } from '../auth/api.js';
2
3
  import type { DBConnectionDecrypted } from '../connection/db.js';
3
4
  import type { DBIntegrationDecrypted } from '../integration/db.js';
@@ -53,7 +54,7 @@ export type ConnectionForProxy = Pick<DBConnectionDecrypted, 'connection_id' | '
53
54
  credentials: AllAuthCredentials;
54
55
  };
55
56
  export type IntegrationConfigForProxy = Pick<DBIntegrationDecrypted, 'oauth_client_id' | 'oauth_client_secret' | 'custom'>;
56
- export interface ApplicationConstructedProxyConfiguration extends BaseProxyConfiguration {
57
+ export interface ApplicationConstructedProxyConfiguration extends BaseProxyConfiguration, InternalProxyConfiguration {
57
58
  decompress: boolean;
58
59
  method: HTTP_METHOD;
59
60
  providerName: string;
@@ -62,6 +63,13 @@ export interface ApplicationConstructedProxyConfiguration extends BaseProxyConfi
62
63
  export type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream';
63
64
  export interface InternalProxyConfiguration {
64
65
  providerName: string;
66
+ /** Only set for customer API/MCP proxy requests or calls from deployed code. */
67
+ monitoringContext?: {
68
+ accountId: number;
69
+ environmentId: number;
70
+ apiKey?: ApiKeyPrincipal | undefined;
71
+ callsite: 'proxy' | 'sdk';
72
+ };
65
73
  }
66
74
  export interface RetryHeaderConfig {
67
75
  at?: string[] | string;
@@ -0,0 +1,44 @@
1
+ import type { Timestamps } from '../db.js';
2
+ export type SelfHostingInstallationMode = 'byoc' | 'self_managed';
3
+ export type SelfHostingInstallationStage = 'production' | 'staging' | 'development';
4
+ export type SelfHostingInstallationAlerts = 'off' | 'slack' | 'oncall';
5
+ export interface DBSelfHostingCustomer extends Timestamps {
6
+ id: number;
7
+ name: string;
8
+ deleted_at: Date | null;
9
+ }
10
+ export interface DBSelfHostingInstallation extends Timestamps {
11
+ id: number;
12
+ /** The only identity that leaves the registry: in the license, the tokens and the export files. */
13
+ uuid: string;
14
+ customer_id: number;
15
+ name: string;
16
+ mode: SelfHostingInstallationMode;
17
+ stage: SelfHostingInstallationStage;
18
+ telemetry: boolean;
19
+ alerts: SelfHostingInstallationAlerts;
20
+ deleted_at: Date | null;
21
+ last_seen_at: Date | null;
22
+ }
23
+ export interface DBSelfHostingInstallationKey {
24
+ id: number;
25
+ installation_id: number;
26
+ kid: string;
27
+ public_key: string;
28
+ created_at: Date;
29
+ /** Set on rotation; the key still verifies files it signed until it is pruned. */
30
+ deleted_at: Date | null;
31
+ }
32
+ export interface DBSelfHostingInstallationLicense {
33
+ id: number;
34
+ installation_id: number;
35
+ issued_at: Date;
36
+ expires_at: Date;
37
+ grace_until: Date;
38
+ /** The exact signed text, so the signature can be re-verified from the row. */
39
+ license: string;
40
+ signature: string;
41
+ signing_kid: string;
42
+ active: boolean;
43
+ created_at: Date;
44
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/types",
3
- "version": "0.71.14",
3
+ "version": "0.72.1",
4
4
  "description": "Types used in Nango applications",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",