@nangohq/types 0.69.13 → 0.69.15

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.
@@ -24,7 +24,7 @@ export type ValidateEmailAndLogin = Endpoint<{
24
24
  Body: {
25
25
  token: string;
26
26
  };
27
- Error: ApiError<'error_logging_in'> | ApiError<'error_validating_user'> | ApiError<'token_expired'> | ApiError<'error_refreshing_token'>;
27
+ Error: ApiError<'error_logging_in'> | ApiError<'error_validating_user'> | ApiError<'invalid_token'> | ApiError<'token_expired'> | ApiError<'error_refreshing_token'>;
28
28
  Success: {
29
29
  user: ApiUser;
30
30
  };
@@ -18,7 +18,7 @@ import type { DeleteInvite, GetInvite, PostInvite } from './invitations/api.js';
18
18
  import type { GetOperation, PostInsights, SearchFilters, SearchMessages, SearchOperations } from './logs/api.js';
19
19
  import type { GetMeta } from './meta/api.js';
20
20
  import type { PostPlanExtendTrial } from './plans/http.api.js';
21
- import type { GetPublicProvider, GetPublicProviders } from './providers/api.js';
21
+ import type { GetProvider, GetProviders, GetPublicProvider, GetPublicProviders } from './providers/api.js';
22
22
  import type { AllPublicProxy } from './proxy/http.api.js';
23
23
  import type { GetPublicRecords } from './record/api.js';
24
24
  import type { GetPublicScriptsConfig } from './scripts/http.api.js';
@@ -28,7 +28,7 @@ import type { DeleteTeamUser, GetTeam, PutTeam } from './team/api.js';
28
28
  import type { GetUser, PatchUser } from './user/api.js';
29
29
  import type { PostPublicWebhook } from './webhooks/http.api.js';
30
30
  export type PublicApiEndpoints = SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation | PostPublicTrigger | PostPublicTbaAuthorization | PostPublicJwtAuthorization | PostPublicUnauthenticatedAuthorization | PostPublicApiKeyAuthorization | PostPublicBasicAuthorization | PostPublicAppStoreAuthorization | GetPublicProviders | GetPublicProvider | GetPublicListIntegrations | GetPublicIntegration | DeletePublicIntegration | PostConnectSessions | PostPublicConnectSessionsReconnect | GetPublicConnections | GetPublicConnection | GetConnectSession | DeleteConnectSession | PostDeployInternal | PostPublicBillAuthorization | DeletePublicConnection | PostPublicSignatureAuthorization | PostPublicTwoStepAuthorization | PostPublicWebhook | GetPublicRecords | GetPublicScriptsConfig | PostPublicConnectTelemetry | PutPublicSyncConnectionFrequency | PostPublicIntegration | PatchPublicIntegration | GetAsyncActionResult | PostPublicOauthOutboundAuthorization | PostPublicConnection | PostPublicSyncStart | PostPublicSyncPause | GetPublicSyncStatus | GetPublicV1 | PostPublicTriggerAction | AllPublicProxy;
31
- export type PrivateApiEndpoints = PostSignup | PostSignin | PostLogout | GetTeam | PutTeam | PostPlanExtendTrial | GetUser | PatchUser | PostInvite | DeleteInvite | DeleteTeamUser | PostInsights | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | PostInternalConnectSessions | GetIntegrationFlows | DeleteIntegration | PatchIntegration | GetIntegration | PostIntegration | GetConnections | GetConnectionsCount | GetConnection | GetInvite | GetMeta | GetEmailByExpiredToken | GetEmailByUuid | GetManagedCallback | PatchFlowDisable | PatchFlowEnable | PatchFlowFrequency | PutUpgradePreBuiltFlow | PostConnectionRefresh | PostManagedSignup | PostPreBuiltDeploy | PostEnvironment | PatchEnvironment | DeleteEnvironment | PatchWebhook | PostEnvironmentVariables | PostImpersonate | GetSharedCredentialsProviders | GetSharedCredentialsProvider | PostSharedCredentialsProvider | PatchSharedCredentialsProvider | GetGettingStarted | PatchGettingStarted | GetConnectUISettings | PutConnectUISettings;
31
+ export type PrivateApiEndpoints = PostSignup | PostSignin | PostLogout | GetTeam | PutTeam | PostPlanExtendTrial | GetUser | PatchUser | PostInvite | DeleteInvite | DeleteTeamUser | PostInsights | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | PostInternalConnectSessions | GetIntegrationFlows | DeleteIntegration | PatchIntegration | GetIntegration | PostIntegration | GetConnections | GetConnectionsCount | GetConnection | GetInvite | GetMeta | GetEmailByExpiredToken | GetEmailByUuid | GetManagedCallback | PatchFlowDisable | PatchFlowEnable | PatchFlowFrequency | PutUpgradePreBuiltFlow | PostConnectionRefresh | PostManagedSignup | PostPreBuiltDeploy | PostEnvironment | PatchEnvironment | DeleteEnvironment | PatchWebhook | PostEnvironmentVariables | PostImpersonate | GetSharedCredentialsProviders | GetSharedCredentialsProvider | PostSharedCredentialsProvider | PatchSharedCredentialsProvider | GetGettingStarted | PatchGettingStarted | GetConnectUISettings | PutConnectUISettings | GetProviders | GetProvider;
32
32
  export type APIEndpoints = PrivateApiEndpoints | PublicApiEndpoints;
33
33
  /**
34
34
  * Automatically narrow endpoints type with Method + Path
@@ -130,6 +130,7 @@ export interface TwoStepCredentials extends CredentialsCommon {
130
130
  type: AuthModes['TwoStep'];
131
131
  [key: string]: any;
132
132
  token?: string;
133
+ refresh_token?: string;
133
134
  expires_at?: Date | undefined;
134
135
  }
135
136
  export interface SignatureCredentials {
@@ -1,5 +1,6 @@
1
1
  import type { Result } from '../result.js';
2
2
  import type { DBTeam } from '../team/db.js';
3
+ import type { UsageMetric } from '../usage/index.js';
3
4
  import type { DBUser } from '../user/db.js';
4
5
  export interface BillingClient {
5
6
  ingest: (events: BillingEvent[]) => Promise<Result<void>>;
@@ -9,7 +10,7 @@ export interface BillingClient {
9
10
  getCustomer: (accountId: number) => Promise<Result<BillingCustomer>>;
10
11
  getSubscription: (accountId: number) => Promise<Result<BillingSubscription | null>>;
11
12
  createSubscription: (team: DBTeam, planExternalId: string) => Promise<Result<BillingSubscription>>;
12
- getUsage: (subscriptionId: string, opts?: GetBillingUsageOpts) => Promise<Result<BillingUsageMetric[]>>;
13
+ getUsage: (subscriptionId: string, opts?: GetBillingUsageOpts) => Promise<Result<BillingUsageMetrics>>;
13
14
  upgrade: (opts: {
14
15
  subscriptionId: string;
15
16
  planExternalId: string;
@@ -51,12 +52,11 @@ export interface GetBillingUsageOpts {
51
52
  granularity?: 'day';
52
53
  billingMetric?: {
53
54
  id: string;
54
- group_by?: 'environmentId' | 'provider' | 'providerConfigKey' | 'connectionId' | 'type' | 'functionName' | 'model';
55
+ group_by?: 'environmentId' | 'environmentName' | 'integrationId' | 'type' | 'functionName' | 'model';
55
56
  };
56
57
  }
57
58
  export interface BillingUsageMetric {
58
- id: string;
59
- name: string;
59
+ externalId: string;
60
60
  group?: {
61
61
  key: string;
62
62
  value: string;
@@ -67,7 +67,13 @@ export interface BillingUsageMetric {
67
67
  timeframeEnd: Date;
68
68
  quantity: number;
69
69
  }[];
70
+ view_mode: 'cumulative' | 'periodic';
71
+ }
72
+ export type BillingUsageMetrics = Partial<Record<UsageMetric, BillingUsageMetric | undefined>>;
73
+ export interface ApiBillingUsageMetric extends BillingUsageMetric {
74
+ label: string;
70
75
  }
76
+ export type ApiBillingUsageMetrics = Record<UsageMetric, ApiBillingUsageMetric>;
71
77
  export interface BillingPlan {
72
78
  id: string;
73
79
  external_plan_id: string;
@@ -84,9 +90,9 @@ interface BillingEventBase<TType extends string, TProperties extends BillingProp
84
90
  } & TProperties;
85
91
  }
86
92
  export type MarBillingEvent = BillingEventBase<'monthly_active_records', {
87
- connectionId: number;
88
93
  environmentId: number;
89
- providerConfigKey: string;
94
+ environmentName: string;
95
+ integrationId: string;
90
96
  syncId: string;
91
97
  model: string;
92
98
  }>;
@@ -97,14 +103,17 @@ export type RecordsBillingEvent = BillingEventBase<'records', {
97
103
  };
98
104
  }>;
99
105
  export type ActionsBillingEvent = BillingEventBase<'billable_actions', {
100
- connectionId: number;
101
106
  environmentId: number;
102
- providerConfigKey: string;
107
+ environmentName: string;
108
+ integrationId: string;
103
109
  actionName: string;
104
110
  }>;
105
111
  export type FunctionExecutionsBillingEvent = BillingEventBase<'function_executions', {
112
+ environmentId: number;
113
+ environmentName: string;
114
+ integrationId: string;
106
115
  type: string;
107
- connectionId: number;
116
+ functionName: string;
108
117
  telemetry: {
109
118
  successes: number;
110
119
  failures: number;
@@ -116,10 +125,9 @@ export type FunctionExecutionsBillingEvent = BillingEventBase<'function_executio
116
125
  frequencyMs?: number | undefined;
117
126
  }>;
118
127
  export type ProxyBillingEvent = BillingEventBase<'proxy', {
119
- connectionId: number;
120
128
  environmentId: number;
121
- providerConfigKey: string;
122
- provider: string;
129
+ environmentName: string;
130
+ integrationId: string;
123
131
  telemetry: {
124
132
  successes: number;
125
133
  failures: number;
@@ -127,8 +135,8 @@ export type ProxyBillingEvent = BillingEventBase<'proxy', {
127
135
  }>;
128
136
  export type WebhookForwardBillingEvent = BillingEventBase<'webhook_forwards', {
129
137
  environmentId: number;
130
- providerConfigKey: string;
131
- provider: string;
138
+ environmentName: string;
139
+ integrationId: string;
132
140
  telemetry: {
133
141
  successes: number;
134
142
  failures: number;
@@ -1,5 +1,5 @@
1
- import type { BillingCustomer, BillingUsageMetric } from '../billing/types.js';
2
- import type { MetricUsageSummary } from '../usage/index.js';
1
+ import type { ApiBillingUsageMetrics, BillingCustomer } from '../billing/types.js';
2
+ import type { MetricUsageSummary, UsageMetric } from '../usage/index.js';
3
3
  import type { ReplaceInObject } from '../utils.js';
4
4
  import type { DBPlan } from './db.js';
5
5
  import type { Endpoint } from '../api.js';
@@ -58,7 +58,7 @@ export type GetUsage = Endpoint<{
58
58
  env: string;
59
59
  };
60
60
  Success: {
61
- data: Record<string, MetricUsageSummary>;
61
+ data: Record<UsageMetric, MetricUsageSummary>;
62
62
  };
63
63
  }>;
64
64
  export type GetBillingUsage = Endpoint<{
@@ -66,12 +66,13 @@ export type GetBillingUsage = Endpoint<{
66
66
  Path: '/api/v1/plans/billing-usage';
67
67
  Querystring: {
68
68
  env: string;
69
+ from?: string | undefined;
70
+ to?: string | undefined;
69
71
  };
70
72
  Success: {
71
73
  data: {
72
74
  customer: BillingCustomer;
73
- current: BillingUsageMetric[];
74
- previous: BillingUsageMetric[];
75
+ usage: ApiBillingUsageMetrics;
75
76
  };
76
77
  };
77
78
  }>;
@@ -1,5 +1,6 @@
1
1
  import type { Endpoint } from '../api.js';
2
2
  import type { Provider } from './provider.js';
3
+ import type { AuthModeType } from '../auth/api.js';
3
4
  export type GetPublicProviders = Endpoint<{
4
5
  Method: 'GET';
5
6
  Path: `/providers`;
@@ -27,3 +28,30 @@ export type GetPublicProvider = Endpoint<{
27
28
  data: ApiProvider;
28
29
  };
29
30
  }>;
31
+ export interface ApiProviderListItem {
32
+ name: string;
33
+ displayName: string;
34
+ defaultScopes?: string[] | undefined;
35
+ authMode: AuthModeType;
36
+ categories?: string[] | undefined;
37
+ docs: string;
38
+ preConfigured: boolean;
39
+ preConfiguredScopes: string[];
40
+ }
41
+ export type GetProviders = Endpoint<{
42
+ Method: 'GET';
43
+ Path: '/api/v1/providers';
44
+ Success: {
45
+ data: ApiProviderListItem[];
46
+ };
47
+ }>;
48
+ export type GetProvider = Endpoint<{
49
+ Method: 'GET';
50
+ Path: '/api/v1/providers/:providerConfigKey';
51
+ Params: {
52
+ providerConfigKey: string;
53
+ };
54
+ Success: {
55
+ data: ApiProviderListItem;
56
+ };
57
+ }>;
@@ -175,10 +175,13 @@ export interface ProviderTwoStep extends Omit<BaseProvider, 'body_format'> {
175
175
  };
176
176
  token_request_method?: 'GET';
177
177
  token_headers?: Record<string, string>;
178
+ refresh_url?: string;
179
+ refresh_token_params?: Record<string, string>;
178
180
  token_response: {
179
181
  token: string;
180
182
  token_expiration?: string;
181
183
  token_expiration_strategy?: 'expireAt' | 'expireIn';
184
+ refresh_token?: string;
182
185
  };
183
186
  additional_steps?: {
184
187
  body_format?: 'json' | 'form';
@@ -1,4 +1,5 @@
1
1
  import type { DBConnectionDecrypted } from '../connection/db.js';
2
+ import type { DBIntegrationDecrypted } from '../integration/db.js';
2
3
  import type { HTTP_METHOD } from '../nangoYaml/index.js';
3
4
  import type { Provider } from '../providers/provider.js';
4
5
  import type { AxiosResponse } from 'axios';
@@ -32,6 +33,7 @@ export interface UserProvidedProxyConfiguration extends BaseProxyConfiguration {
32
33
  paginate?: Partial<CursorPagination> | Partial<LinkPagination> | Partial<OffsetPagination>;
33
34
  }
34
35
  export type ConnectionForProxy = Pick<DBConnectionDecrypted, 'connection_id' | 'connection_config' | 'credentials' | 'metadata'>;
36
+ export type IntegrationConfigForProxy = Pick<DBIntegrationDecrypted, 'oauth_client_id' | 'oauth_client_secret'>;
35
37
  export interface ApplicationConstructedProxyConfiguration extends BaseProxyConfiguration {
36
38
  decompress: boolean;
37
39
  method: HTTP_METHOD;
@@ -1,5 +1,6 @@
1
1
  import type { RunnerFlags } from './index.js';
2
2
  import type { LogLevel } from '../logs/messages.js';
3
+ import type { IntegrationConfigForProxy } from '../proxy/api.js';
3
4
  import type { DBSyncConfig } from '../syncConfigs/db.js';
4
5
  import type { DBTeam } from '../team/db.js';
5
6
  import type { AxiosError, AxiosInterceptorManager, AxiosRequestConfig, AxiosResponse } from 'axios';
@@ -40,6 +41,7 @@ export interface NangoProps {
40
41
  } | null;
41
42
  heartbeatTimeoutSecs?: number | undefined;
42
43
  isCLI?: boolean | undefined;
44
+ integrationConfig?: IntegrationConfigForProxy;
43
45
  axios?: {
44
46
  request?: AxiosInterceptorManager<AxiosRequestConfig>;
45
47
  response?: {
package/dist/web/env.d.ts CHANGED
@@ -10,6 +10,8 @@ export interface WindowEnv {
10
10
  publicLogoDevKey: string;
11
11
  publicStripeKey: string;
12
12
  isCloud: boolean;
13
+ isHosted: boolean;
14
+ isEnterprise: boolean;
13
15
  features: {
14
16
  logs: boolean;
15
17
  scripts: boolean;
@@ -47,6 +47,7 @@ export interface NangoAuthWebhookBodyBase extends NangoWebhookBase {
47
47
  endUser?: {
48
48
  endUserId: string;
49
49
  organizationId?: string | undefined;
50
+ endUserEmail?: string | undefined | null;
50
51
  tags: Record<string, string>;
51
52
  } | undefined;
52
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/types",
3
- "version": "0.69.13",
3
+ "version": "0.69.15",
4
4
  "description": "Types used in Nango applications",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",