@nangohq/types 0.69.49 → 0.69.50

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.
@@ -26,6 +26,21 @@ export type PostPublicTriggerAction = Endpoint<{
26
26
  };
27
27
  Success: any;
28
28
  }>;
29
+ export type PostInternalTriggerFunction = Endpoint<{
30
+ Method: 'POST';
31
+ Path: '/api/v1/trigger/function';
32
+ Body: {
33
+ type: 'action' | 'sync';
34
+ function_name: string;
35
+ provider_config_key: string;
36
+ connection_id: string;
37
+ input?: unknown;
38
+ };
39
+ Querystring: {
40
+ env: string;
41
+ };
42
+ Success: any;
43
+ }>;
29
44
  /** @deprecated Use POST /action/trigger to trigger actions and GET /records to fetch sync records instead. */
30
45
  export type GetPublicV1 = Endpoint<{
31
46
  Method: 'GET';
@@ -1,5 +1,5 @@
1
1
  import type { GetEmailByExpiredToken, GetEmailByUuid, GetManagedCallback, GetManagedEmailVerification, PostForgotPassword, PostLogout, PostManagedEmailVerification, PostManagedSignup, PostSignin, PostSignup, PutResetPassword } from './account/api.js';
2
- import type { GetAsyncActionResult, GetPublicV1, PostPublicTriggerAction } from './action/api.js';
2
+ import type { GetAsyncActionResult, GetPublicV1, PostInternalTriggerFunction, PostPublicTriggerAction } from './action/api.js';
3
3
  import type { PostImpersonate } from './admin/http.api.js';
4
4
  import type { EndpointMethod } from './api.js';
5
5
  import type { PostPublicApiKeyAuthorization, PostPublicAppStoreAuthorization, PostPublicBasicAuthorization, PostPublicBillAuthorization, PostPublicJwtAuthorization, PostPublicOauthOutboundAuthorization, PostPublicSignatureAuthorization, PostPublicTbaAuthorization, PostPublicTwoStepAuthorization, PostPublicUnauthenticatedAuthorization } from './auth/http.api.js';
@@ -17,7 +17,7 @@ import type { DeleteIntegration, DeletePublicIntegration, GetIntegration, GetInt
17
17
  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
- import type { PostPlanChange, PostPlanExtendTrial } from './plans/http.api.js';
20
+ import type { PostPlanChange, PostPlanExtendTrial, PutBillingInvoicingDetails } from './plans/http.api.js';
21
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, PatchPublicPruneRecords } from './record/api.js';
@@ -28,7 +28,7 @@ import type { DeleteTeamUser, GetTeam, PatchTeamUser, PutTeam } from './team/api
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 | PatchPublicPruneRecords | GetPublicScriptsConfig | PostPublicConnectTelemetry | PutPublicSyncConnectionFrequency | PostPublicIntegration | PatchPublicIntegration | GetAsyncActionResult | PostPublicOauthOutboundAuthorization | PostPublicConnection | PatchPublicConnection | PostPublicSyncStart | PostPublicSyncPause | GetPublicSyncStatus | GetPublicV1 | PostPublicTriggerAction | AllPublicProxy;
31
- export type PrivateApiEndpoints = PostSignup | PostSignin | PostLogout | GetTeam | PutTeam | PostPlanExtendTrial | PostPlanChange | GetUser | PatchUser | PostInvite | DeleteInvite | DeleteTeamUser | PatchTeamUser | PostInsights | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | PostInternalConnectSessions | GetIntegrationFlows | DeleteIntegration | PatchIntegration | GetIntegration | PostIntegration | GetConnections | GetConnectionsCount | GetConnection | GetInvite | GetMeta | GetEmailByExpiredToken | GetEmailByUuid | GetManagedCallback | GetManagedEmailVerification | PatchFlowDisable | PatchFlowEnable | PatchFlowFrequency | PutUpgradePreBuiltFlow | PostConnectionRefresh | PostManagedEmailVerification | PostManagedSignup | PostPreBuiltDeploy | PostEnvironment | PatchEnvironment | DeleteEnvironment | GetEnvironments | GetEnvironment | PatchWebhook | PostEnvironmentVariables | PostImpersonate | GetSharedCredentialsProviders | GetSharedCredentialsProvider | PostSharedCredentialsProvider | PatchSharedCredentialsProvider | GetGettingStarted | PatchGettingStarted | GetConnectUISettings | PutConnectUISettings | GetProviders | GetProvider;
31
+ export type PrivateApiEndpoints = PostSignup | PostSignin | PostLogout | GetTeam | PutTeam | PostPlanExtendTrial | PostPlanChange | PutBillingInvoicingDetails | GetUser | PatchUser | PostInvite | DeleteInvite | DeleteTeamUser | PatchTeamUser | PostInsights | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | PostInternalConnectSessions | GetIntegrationFlows | DeleteIntegration | PatchIntegration | GetIntegration | PostIntegration | GetConnections | GetConnectionsCount | GetConnection | GetInvite | GetMeta | GetEmailByExpiredToken | GetEmailByUuid | GetManagedCallback | GetManagedEmailVerification | PatchFlowDisable | PatchFlowEnable | PatchFlowFrequency | PutUpgradePreBuiltFlow | PostConnectionRefresh | PostManagedEmailVerification | PostManagedSignup | PostPreBuiltDeploy | PostEnvironment | PatchEnvironment | DeleteEnvironment | GetEnvironments | GetEnvironment | PatchWebhook | PostEnvironmentVariables | PostImpersonate | GetSharedCredentialsProviders | GetSharedCredentialsProvider | PostSharedCredentialsProvider | PatchSharedCredentialsProvider | GetGettingStarted | PatchGettingStarted | GetConnectUISettings | PutConnectUISettings | GetProviders | GetProvider | PostInternalTriggerFunction;
32
32
  export type APIEndpoints = PrivateApiEndpoints | PublicApiEndpoints;
33
33
  /**
34
34
  * Automatically narrow endpoints type with Method + Path
@@ -1,13 +1,12 @@
1
1
  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
- import type { DBUser } from '../user/db.js';
5
4
  export interface BillingClient {
6
5
  ingest: (events: BillingEvent[]) => Promise<Result<void>>;
7
- upsertCustomer: (team: DBTeam, user: DBUser) => Promise<Result<BillingCustomer>>;
8
- updateCustomer: (customerId: string, name: string) => Promise<Result<void>>;
9
6
  linkStripeToCustomer(teamId: number, customerId: string): Promise<Result<void>>;
7
+ getOrCreateCustomer: (accountId: number, defaultTo: Pick<BillingInvoicingDetails, 'legalEntityName' | 'email'>) => Promise<Result<BillingCustomer>>;
10
8
  getCustomer: (accountId: number) => Promise<Result<BillingCustomer>>;
9
+ putCustomer: (accountId: number, invoicingDetails: BillingInvoicingDetails) => Promise<Result<BillingCustomer>>;
11
10
  getSubscription: (accountId: number) => Promise<Result<BillingSubscription | null>>;
12
11
  createSubscription: (team: DBTeam, planExternalId: string) => Promise<Result<BillingSubscription>>;
13
12
  getUsage: (subscriptionId: string, opts?: GetBillingUsageOpts) => Promise<Result<BillingUsageMetrics>>;
@@ -37,8 +36,28 @@ export interface BillingClient {
37
36
  }
38
37
  export interface BillingCustomer {
39
38
  id: string;
39
+ invoicingDetails: BillingInvoicingDetails;
40
40
  portalUrl: string | null;
41
41
  }
42
+ export interface BillingInvoicingDetails {
43
+ legalEntityName: string;
44
+ email: string;
45
+ address: BillingAddress | null;
46
+ taxId: BillingTaxId | null;
47
+ }
48
+ export interface BillingAddress {
49
+ line1: string | null;
50
+ line2: string | null;
51
+ city: string | null;
52
+ state: string | null;
53
+ postalCode: string | null;
54
+ country: string | null;
55
+ }
56
+ export interface BillingTaxId {
57
+ country: string;
58
+ type: string;
59
+ value: string;
60
+ }
42
61
  export interface BillingSubscription {
43
62
  id: string;
44
63
  pendingChangeId?: string | undefined;
@@ -1,4 +1,4 @@
1
- import type { ApiBillingUsageMetrics, BillingCustomer } from '../billing/types.js';
1
+ import type { ApiBillingUsageMetrics, BillingCustomer, BillingInvoicingDetails } from '../billing/types.js';
2
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';
@@ -76,6 +76,17 @@ export type GetBillingUsage = Endpoint<{
76
76
  };
77
77
  };
78
78
  }>;
79
+ export type PutBillingInvoicingDetails = Endpoint<{
80
+ Method: 'PUT';
81
+ Path: '/api/v1/plans/billing/invoicing';
82
+ Querystring: {
83
+ env: string;
84
+ };
85
+ Body: BillingInvoicingDetails;
86
+ Success: {
87
+ data: BillingCustomer;
88
+ };
89
+ }>;
79
90
  export type PostPlanChange = Endpoint<{
80
91
  Method: 'POST';
81
92
  Path: '/api/v1/plans/change';
@@ -33,6 +33,7 @@ export interface ApiProviderListItem {
33
33
  name: string;
34
34
  displayName: string;
35
35
  defaultScopes?: string[] | undefined;
36
+ availableScopes?: string[] | undefined;
36
37
  authMode: AuthModeType;
37
38
  categories?: string[] | undefined;
38
39
  docs: string;
@@ -90,6 +90,7 @@ export interface BaseProvider {
90
90
  body_format?: OAuthBodyFormatType;
91
91
  require_client_certificate?: boolean;
92
92
  token_request_auth_method?: 'basic' | 'custom' | 'private_key_jwt';
93
+ available_scopes?: string[];
93
94
  }
94
95
  export interface ProviderOAuth2 extends BaseProvider {
95
96
  auth_mode: 'OAUTH2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/types",
3
- "version": "0.69.49",
3
+ "version": "0.69.50",
4
4
  "description": "Types used in Nango applications",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",