@nangohq/types 0.61.2 → 0.62.0

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.
Files changed (43) hide show
  1. package/dist/account/api.d.ts +2 -2
  2. package/dist/action/api.d.ts +1 -1
  3. package/dist/api.endpoints.d.ts +26 -26
  4. package/dist/auth/api.d.ts +4 -11
  5. package/dist/auth/http.api.d.ts +15 -16
  6. package/dist/billing/http.api.d.ts +12 -0
  7. package/dist/billing/types.d.ts +17 -2
  8. package/dist/connection/api/metadata.d.ts +2 -2
  9. package/dist/deploy/incomingFlow.d.ts +2 -2
  10. package/dist/deploy/index.d.ts +2 -2
  11. package/dist/endpoints/db.d.ts +2 -2
  12. package/dist/environment/api/index.d.ts +4 -4
  13. package/dist/environment/db.d.ts +1 -1
  14. package/dist/environment/variable/api.d.ts +2 -2
  15. package/dist/flow/http.api.d.ts +2 -2
  16. package/dist/flow/index.d.ts +2 -2
  17. package/dist/index.d.ts +2 -0
  18. package/dist/integration/api.d.ts +7 -5
  19. package/dist/invitations/api.d.ts +3 -3
  20. package/dist/invitations/db.d.ts +1 -1
  21. package/dist/jobs/api.d.ts +3 -3
  22. package/dist/logs/api.d.ts +3 -3
  23. package/dist/meta/api.d.ts +2 -2
  24. package/dist/nangoYaml/index.d.ts +1 -1
  25. package/dist/onboarding/api.d.ts +1 -1
  26. package/dist/onboarding/db.d.ts +1 -1
  27. package/dist/plans/db.d.ts +12 -1
  28. package/dist/plans/http.api.d.ts +8 -3
  29. package/dist/providers/api.d.ts +2 -2
  30. package/dist/providers/provider.d.ts +6 -4
  31. package/dist/record/api.d.ts +1 -1
  32. package/dist/runner/sdk.d.ts +3 -3
  33. package/dist/scripts/http.api.d.ts +2 -2
  34. package/dist/slackNotifications/db.d.ts +1 -1
  35. package/dist/stripe/http.api.d.ts +43 -0
  36. package/dist/syncConfigs/api.d.ts +2 -2
  37. package/dist/syncConfigs/db.d.ts +3 -3
  38. package/dist/team/api.d.ts +4 -4
  39. package/dist/team/db.d.ts +1 -1
  40. package/dist/user/api.d.ts +1 -1
  41. package/dist/user/db.d.ts +1 -1
  42. package/dist/webhooks/http.api.d.ts +1 -1
  43. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import type { ApiError, Endpoint } from '../api';
2
- import type { ApiUser } from '../user/api';
1
+ import type { ApiError, Endpoint } from '../api.js';
2
+ import type { ApiUser } from '../user/api.js';
3
3
  export type PostSignup = Endpoint<{
4
4
  Method: 'POST';
5
5
  Path: '/api/v1/account/signup';
@@ -1,4 +1,4 @@
1
- import type { Endpoint } from '../api';
1
+ import type { Endpoint } from '../api.js';
2
2
  export interface AsyncActionResponse {
3
3
  id: string;
4
4
  statusUrl: string;
@@ -1,29 +1,29 @@
1
- import type { GetEmailByExpiredToken, GetEmailByUuid, GetManagedCallback, PostForgotPassword, PostLogout, PostManagedSignup, PostSignin, PostSignup, PutResetPassword } from './account/api';
2
- import type { GetAsyncActionResult } from './action/api';
3
- import type { EndpointMethod } from './api';
4
- import type { PostPublicApiKeyAuthorization, PostPublicAppStoreAuthorization, PostPublicBasicAuthorization, PostPublicBillAuthorization, PostPublicJwtAuthorization, PostPublicSignatureAuthorization, PostPublicTableauAuthorization, PostPublicTbaAuthorization, PostPublicTwoStepAuthorization, PostPublicUnauthenticatedAuthorization } from './auth/http.api';
5
- import type { DeleteConnectSession, GetConnectSession, PostConnectSessions, PostInternalConnectSessions, PostPublicConnectSessionsReconnect, PostPublicConnectTelemetry } from './connect/api';
6
- import type { DeletePublicConnection, GetConnection, GetConnections, GetConnectionsCount, GetPublicConnection, GetPublicConnections, PostConnectionRefresh } from './connection/api/get';
7
- import type { SetMetadata, UpdateMetadata } from './connection/api/metadata';
8
- import type { PostDeploy, PostDeployConfirmation, PostDeployInternal } from './deploy/api';
9
- import type { DeleteEnvironment, PatchEnvironment, PostEnvironment } from './environment/api';
10
- import type { PatchWebhook } from './environment/api/webhook';
11
- import type { PostEnvironmentVariables } from './environment/variable/api';
12
- import type { PatchFlowDisable, PatchFlowEnable, PatchFlowFrequency, PostPreBuiltDeploy, PutUpgradePreBuiltFlow } from './flow/http.api';
13
- import type { DeleteIntegration, DeletePublicIntegration, GetIntegration, GetIntegrationFlows, GetPublicIntegration, GetPublicListIntegrations, GetPublicListIntegrationsLegacy, PatchIntegration, PatchPublicIntegration, PostIntegration, PostPublicIntegration } from './integration/api';
14
- import type { DeleteInvite, GetInvite, PostInvite } from './invitations/api';
15
- import type { GetOperation, PostInsights, SearchFilters, SearchMessages, SearchOperations } from './logs/api';
16
- import type { GetMeta } from './meta/api';
17
- import type { PatchOnboarding } from './onboarding/api';
18
- import type { PostPlanExtendTrial } from './plans/http.api';
19
- import type { GetPublicProvider, GetPublicProviders } from './providers/api';
20
- import type { GetPublicRecords } from './record/api';
21
- import type { GetPublicScriptsConfig } from './scripts/http.api';
22
- import type { PostPublicTrigger, PutPublicSyncConnectionFrequency } from './sync/api';
23
- import type { DeleteTeamUser, GetTeam, PutTeam } from './team/api';
24
- import type { GetUser, PatchUser } from './user/api';
25
- import type { PostPublicWebhook } from './webhooks/http.api';
26
- export type PublicApiEndpoints = SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation | PostPublicTrigger | PostPublicTbaAuthorization | PostPublicTableauAuthorization | PostPublicJwtAuthorization | PostPublicUnauthenticatedAuthorization | PostPublicApiKeyAuthorization | PostPublicBasicAuthorization | PostPublicAppStoreAuthorization | GetPublicProviders | GetPublicProvider | GetPublicListIntegrationsLegacy | GetPublicListIntegrations | GetPublicIntegration | DeletePublicIntegration | PostConnectSessions | PostPublicConnectSessionsReconnect | GetPublicConnections | GetPublicConnection | GetConnectSession | DeleteConnectSession | PostDeployInternal | PostPublicBillAuthorization | DeletePublicConnection | PostPublicSignatureAuthorization | PostPublicTwoStepAuthorization | PostPublicWebhook | GetPublicRecords | GetPublicScriptsConfig | PostPublicConnectTelemetry | PutPublicSyncConnectionFrequency | PostPublicIntegration | PatchPublicIntegration | GetAsyncActionResult;
1
+ import type { GetEmailByExpiredToken, GetEmailByUuid, GetManagedCallback, PostForgotPassword, PostLogout, PostManagedSignup, PostSignin, PostSignup, PutResetPassword } from './account/api.js';
2
+ import type { GetAsyncActionResult } from './action/api.js';
3
+ import type { EndpointMethod } from './api.js';
4
+ import type { PostPublicApiKeyAuthorization, PostPublicAppStoreAuthorization, PostPublicBasicAuthorization, PostPublicBillAuthorization, PostPublicJwtAuthorization, PostPublicSignatureAuthorization, PostPublicTbaAuthorization, PostPublicTwoStepAuthorization, PostPublicUnauthenticatedAuthorization, PostPublicOauthOutboundAuthorization } from './auth/http.api.js';
5
+ import type { DeleteConnectSession, GetConnectSession, PostConnectSessions, PostInternalConnectSessions, PostPublicConnectSessionsReconnect, PostPublicConnectTelemetry } from './connect/api.js';
6
+ import type { DeletePublicConnection, GetConnection, GetConnections, GetConnectionsCount, GetPublicConnection, GetPublicConnections, PostConnectionRefresh } from './connection/api/get.js';
7
+ import type { SetMetadata, UpdateMetadata } from './connection/api/metadata.js';
8
+ import type { PostDeploy, PostDeployConfirmation, PostDeployInternal } from './deploy/api.js';
9
+ import type { DeleteEnvironment, PatchEnvironment, PostEnvironment } from './environment/api/index.js';
10
+ import type { PatchWebhook } from './environment/api/webhook.js';
11
+ import type { PostEnvironmentVariables } from './environment/variable/api.js';
12
+ import type { PatchFlowDisable, PatchFlowEnable, PatchFlowFrequency, PostPreBuiltDeploy, PutUpgradePreBuiltFlow } from './flow/http.api.js';
13
+ import type { DeleteIntegration, DeletePublicIntegration, GetIntegration, GetIntegrationFlows, GetPublicIntegration, GetPublicListIntegrations, GetPublicListIntegrationsLegacy, PatchIntegration, PatchPublicIntegration, PostIntegration, PostPublicIntegration } from './integration/api.js';
14
+ import type { DeleteInvite, GetInvite, PostInvite } from './invitations/api.js';
15
+ import type { GetOperation, PostInsights, SearchFilters, SearchMessages, SearchOperations } from './logs/api.js';
16
+ import type { GetMeta } from './meta/api.js';
17
+ import type { PatchOnboarding } from './onboarding/api.js';
18
+ import type { PostPlanExtendTrial } from './plans/http.api.js';
19
+ import type { GetPublicProvider, GetPublicProviders } from './providers/api.js';
20
+ import type { GetPublicRecords } from './record/api.js';
21
+ import type { GetPublicScriptsConfig } from './scripts/http.api.js';
22
+ import type { PostPublicTrigger, PutPublicSyncConnectionFrequency } from './sync/api.js';
23
+ import type { DeleteTeamUser, GetTeam, PutTeam } from './team/api.js';
24
+ import type { GetUser, PatchUser } from './user/api.js';
25
+ import type { PostPublicWebhook } from './webhooks/http.api.js';
26
+ export type PublicApiEndpoints = SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation | PostPublicTrigger | PostPublicTbaAuthorization | PostPublicJwtAuthorization | PostPublicUnauthenticatedAuthorization | PostPublicApiKeyAuthorization | PostPublicBasicAuthorization | PostPublicAppStoreAuthorization | GetPublicProviders | GetPublicProvider | GetPublicListIntegrationsLegacy | GetPublicListIntegrations | GetPublicIntegration | DeletePublicIntegration | PostConnectSessions | PostPublicConnectSessionsReconnect | GetPublicConnections | GetPublicConnection | GetConnectSession | DeleteConnectSession | PostDeployInternal | PostPublicBillAuthorization | DeletePublicConnection | PostPublicSignatureAuthorization | PostPublicTwoStepAuthorization | PostPublicWebhook | GetPublicRecords | GetPublicScriptsConfig | PostPublicConnectTelemetry | PutPublicSyncConnectionFrequency | PostPublicIntegration | PatchPublicIntegration | GetAsyncActionResult | PostPublicOauthOutboundAuthorization;
27
27
  export type PrivateApiEndpoints = PostSignup | PostSignin | PostLogout | GetTeam | PutTeam | PostPlanExtendTrial | GetUser | PatchUser | PostInvite | DeleteInvite | DeleteTeamUser | PostInsights | PostForgotPassword | PutResetPassword | SearchOperations | GetOperation | SearchMessages | SearchFilters | PatchOnboarding | 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;
28
28
  export type APIEndpoints = PrivateApiEndpoints | PublicApiEndpoints;
29
29
  /**
@@ -9,7 +9,6 @@ export interface AuthModes {
9
9
  App: 'APP';
10
10
  None: 'NONE';
11
11
  TBA: 'TBA';
12
- Tableau: 'TABLEAU';
13
12
  Jwt: 'JWT';
14
13
  Bill: 'BILL';
15
14
  TwoStep: 'TWO_STEP';
@@ -91,6 +90,8 @@ export interface OAuth2ClientCredentials extends CredentialsCommon {
91
90
  expires_at?: Date | undefined;
92
91
  client_id: string;
93
92
  client_secret: string;
93
+ client_certificate?: string | undefined;
94
+ client_private_key?: string | undefined;
94
95
  }
95
96
  export interface OAuth1Credentials extends CredentialsCommon {
96
97
  type: AuthModes['OAuth1'];
@@ -121,14 +122,6 @@ export interface BillCredentials extends CredentialsCommon {
121
122
  user_id?: string;
122
123
  expires_at?: Date | undefined;
123
124
  }
124
- export interface TableauCredentials extends CredentialsCommon {
125
- type: AuthModes['Tableau'];
126
- pat_name: string;
127
- pat_secret: string;
128
- content_url?: string;
129
- token?: string;
130
- expires_at?: Date | undefined;
131
- }
132
125
  export interface JwtCredentials {
133
126
  type: AuthModes['Jwt'];
134
127
  [key: string]: any;
@@ -154,5 +147,5 @@ export interface AuthorizationTokenResponse extends Omit<OAuth2Credentials, 'typ
154
147
  expires_in?: number;
155
148
  }
156
149
  export type TestableCredentials = ApiKeyCredentials | BasicApiCredentials | TbaCredentials | JwtCredentials | SignatureCredentials;
157
- export type RefreshableCredentials = OAuth2Credentials | AppCredentials | AppStoreCredentials | OAuth2ClientCredentials | TableauCredentials | JwtCredentials | TwoStepCredentials | BillCredentials | SignatureCredentials;
158
- export type AllAuthCredentials = OAuth1Credentials | OAuth2Credentials | OAuth2ClientCredentials | BasicApiCredentials | ApiKeyCredentials | AppCredentials | AppStoreCredentials | UnauthCredentials | CustomCredentials | TbaCredentials | TableauCredentials | JwtCredentials | BillCredentials | TwoStepCredentials | SignatureCredentials;
150
+ export type RefreshableCredentials = OAuth2Credentials | AppCredentials | AppStoreCredentials | OAuth2ClientCredentials | JwtCredentials | TwoStepCredentials | BillCredentials | SignatureCredentials;
151
+ export type AllAuthCredentials = OAuth1Credentials | OAuth2Credentials | OAuth2ClientCredentials | BasicApiCredentials | ApiKeyCredentials | AppCredentials | AppStoreCredentials | UnauthCredentials | CustomCredentials | TbaCredentials | JwtCredentials | BillCredentials | TwoStepCredentials | SignatureCredentials;
@@ -1,4 +1,4 @@
1
- import type { ApiError, Endpoint } from '../api';
1
+ import type { ApiError, Endpoint } from '../api.js';
2
2
  export type ConnectionQueryString = {
3
3
  connection_id?: string | undefined;
4
4
  params?: Record<string, any> | undefined;
@@ -73,21 +73,6 @@ export type PostPublicTbaAuthorization = Endpoint<{
73
73
  Error: AuthErrors;
74
74
  Success: ConnectionResponse;
75
75
  }>;
76
- export type PostPublicTableauAuthorization = Endpoint<{
77
- Method: 'POST';
78
- Body: {
79
- pat_name: string;
80
- pat_secret: string;
81
- content_url?: string | undefined;
82
- };
83
- Querystring: ConnectionQueryString;
84
- Params: {
85
- providerConfigKey: string;
86
- };
87
- Path: '/auth/tableau/:providerConfigKey';
88
- Error: AuthErrors;
89
- Success: ConnectionResponse;
90
- }>;
91
76
  export type PostPublicJwtAuthorization = Endpoint<{
92
77
  Method: 'POST';
93
78
  Body: Record<string, any>;
@@ -150,4 +135,18 @@ export type PostPublicSignatureAuthorization = Endpoint<{
150
135
  Error: AuthErrors;
151
136
  Success: ConnectionResponse;
152
137
  }>;
138
+ export type PostPublicOauthOutboundAuthorization = Endpoint<{
139
+ Method: 'POST';
140
+ Body: {
141
+ username: string;
142
+ password: string;
143
+ };
144
+ Querystring: ConnectionQueryString;
145
+ Params: {
146
+ providerConfigKey: string;
147
+ };
148
+ Path: '/auth/oauth-outbound/:providerConfigKey';
149
+ Error: AuthErrors;
150
+ Success: ConnectionResponse;
151
+ }>;
153
152
  export {};
@@ -0,0 +1,12 @@
1
+ import type { Endpoint } from '../api.js';
2
+ export type PostOrbWebhooks = Endpoint<{
3
+ Method: 'POST';
4
+ Path: '/api/v1/orb/webhooks';
5
+ Body: any;
6
+ Headers: {
7
+ 'X-Orb-Signature': string;
8
+ };
9
+ Success: {
10
+ success: boolean;
11
+ };
12
+ }>;
@@ -1,9 +1,20 @@
1
- import type { Result } from '../result';
1
+ import type { Result } from '../result.js';
2
+ import type { DBTeam } from '../team/db.js';
3
+ import type { DBUser } from '../user/db.js';
2
4
  export interface BillingClient {
3
5
  ingest: (events: BillingIngestEvent[]) => Promise<void>;
6
+ upsertCustomer: (team: DBTeam, user: DBUser) => Promise<Result<BillingCustomer>>;
7
+ linkStripeToCustomer(teamId: number, customerId: string): Promise<Result<void>>;
4
8
  getCustomer: (accountId: number) => Promise<Result<BillingCustomer>>;
5
9
  getSubscription: (accountId: number) => Promise<Result<BillingSubscription | null>>;
6
10
  getUsage: (subscriptionId: string, period?: 'previous') => Promise<Result<BillingUsageMetric[]>>;
11
+ upgrade: (opts: {
12
+ subscriptionId: string;
13
+ planExternalId: string;
14
+ immediate: boolean;
15
+ }) => Promise<Result<void>>;
16
+ verifyWebhookSignature(body: string, headers: Record<string, unknown>, secret: string): Result<true>;
17
+ getPlanById(planId: string): Promise<Result<BillingPlan>>;
7
18
  }
8
19
  export interface BillingCustomer {
9
20
  id: string;
@@ -17,8 +28,12 @@ export interface BillingUsageMetric {
17
28
  name: string;
18
29
  quantity: number;
19
30
  }
31
+ export interface BillingPlan {
32
+ id: string;
33
+ external_plan_id: string;
34
+ }
20
35
  export interface BillingIngestEvent {
21
- type: 'monthly_active_records' | 'billable_connections' | 'billable_actions';
36
+ type: 'monthly_active_records' | 'billable_connections' | 'billable_actions' | 'billable_active_connections';
22
37
  idempotencyKey: string;
23
38
  accountId: number;
24
39
  timestamp: Date;
@@ -1,5 +1,5 @@
1
- import type { ApiError, Endpoint } from '../../api';
2
- import type { Metadata } from '../db';
1
+ import type { ApiError, Endpoint } from '../../api.js';
2
+ import type { Metadata } from '../db.js';
3
3
  export interface MetadataBody {
4
4
  connection_id: string | string[];
5
5
  provider_config_key: string;
@@ -1,5 +1,5 @@
1
- import type { NangoModel, NangoSyncEndpointOld, NangoSyncEndpointV2, ScriptTypeLiteral, SyncTypeLiteral } from '../nangoYaml';
2
- import type { OnEventType } from '../scripts/on-events/api';
1
+ import type { NangoModel, NangoSyncEndpointOld, NangoSyncEndpointV2, ScriptTypeLiteral, SyncTypeLiteral } from '../nangoYaml/index.js';
2
+ import type { OnEventType } from '../scripts/on-events/api.js';
3
3
  import type { Merge } from 'type-fest';
4
4
  export interface IncomingScriptFiles {
5
5
  js: string;
@@ -1,5 +1,5 @@
1
- import type { ScriptTypeLiteral } from '../nangoYaml';
2
- import type { LegacySyncModelSchema } from './incomingFlow';
1
+ import type { LegacySyncModelSchema } from './incomingFlow.js';
2
+ import type { ScriptTypeLiteral } from '../nangoYaml/index.js';
3
3
  export interface SyncDeploymentResult {
4
4
  name: string;
5
5
  version?: string;
@@ -1,6 +1,6 @@
1
+ import type { Timestamps } from '../db.js';
2
+ import type { HTTP_METHOD } from '../nangoYaml/index.js';
1
3
  import type { SetOptional } from 'type-fest';
2
- import type { Timestamps } from '../db';
3
- import type { HTTP_METHOD } from '../nangoYaml';
4
4
  export interface DBSyncEndpoint extends Timestamps {
5
5
  id: number;
6
6
  sync_config_id: number;
@@ -1,7 +1,7 @@
1
- import type { ApiError, ApiTimestamps, Endpoint } from '../../api';
2
- import type { ApiPlan } from '../../plans/http.api';
3
- import type { DBEnvironment, DBExternalWebhook } from '../db';
4
- import type { ApiEnvironmentVariable } from '../variable/api';
1
+ import type { ApiError, ApiTimestamps, Endpoint } from '../../api.js';
2
+ import type { ApiPlan } from '../../plans/http.api.js';
3
+ import type { DBEnvironment, DBExternalWebhook } from '../db.js';
4
+ import type { ApiEnvironmentVariable } from '../variable/api.js';
5
5
  import type { Merge } from 'type-fest';
6
6
  export type ApiEnvironment = Omit<Merge<DBEnvironment, {
7
7
  callback_url: string;
@@ -1,4 +1,4 @@
1
- import type { Timestamps, TimestampsAndDeletedCorrect } from '../db';
1
+ import type { Timestamps, TimestampsAndDeletedCorrect } from '../db.js';
2
2
  export interface DBEnvironmentVariable extends Timestamps {
3
3
  id: number;
4
4
  name: string;
@@ -1,5 +1,5 @@
1
- import type { Endpoint } from '../../api';
2
- import type { DBEnvironmentVariable } from '../db';
1
+ import type { Endpoint } from '../../api.js';
2
+ import type { DBEnvironmentVariable } from '../db.js';
3
3
  export type ApiEnvironmentVariable = Pick<DBEnvironmentVariable, 'name' | 'value'>;
4
4
  export type PostEnvironmentVariables = Endpoint<{
5
5
  Method: 'POST';
@@ -1,5 +1,5 @@
1
- import type { ApiError, Endpoint } from '../api';
2
- import type { ScriptTypeLiteral } from '../nangoYaml';
1
+ import type { ApiError, Endpoint } from '../api.js';
2
+ import type { ScriptTypeLiteral } from '../nangoYaml/index.js';
3
3
  export type PutUpgradePreBuiltFlow = Endpoint<{
4
4
  Method: 'PUT';
5
5
  Path: '/api/v1/flows/pre-built/upgrade';
@@ -1,5 +1,5 @@
1
- import type { LegacySyncModelSchema, NangoConfigMetadata } from '../deploy/incomingFlow';
2
- import type { NangoModel, NangoSyncEndpointV2, ScriptTypeLiteral, SyncTypeLiteral } from '../nangoYaml';
1
+ import type { LegacySyncModelSchema, NangoConfigMetadata } from '../deploy/incomingFlow.js';
2
+ import type { NangoModel, NangoSyncEndpointV2, ScriptTypeLiteral, SyncTypeLiteral } from '../nangoYaml/index.js';
3
3
  import type { JSONSchema7 } from 'json-schema';
4
4
  export interface NangoSyncConfig {
5
5
  name: string;
package/dist/index.d.ts CHANGED
@@ -21,6 +21,7 @@ export type * from './syncConfigs/api.js';
21
21
  export type * from './team/api.js';
22
22
  export type * from './team/db.js';
23
23
  export type * from './billing/types.js';
24
+ export type * from './billing/http.api.js';
24
25
  export type * from './providers/api.js';
25
26
  export type * from './proxy/api.js';
26
27
  export type * from './result.js';
@@ -49,6 +50,7 @@ export type * from './runner/index.js';
49
50
  export type * from './runner/sdk.js';
50
51
  export type * from './plans/db.js';
51
52
  export type * from './plans/http.api.js';
53
+ export type * from './stripe/http.api.js';
52
54
  export type * from './nangoYaml/index.js';
53
55
  export type * from './environment/db.js';
54
56
  export type * from './environment/api/index.js';
@@ -1,8 +1,8 @@
1
- import type { ApiTimestamps, Endpoint } from '../api';
2
- import type { IntegrationConfig } from './db';
3
- import type { AuthModeType, AuthModes } from '../auth/api';
4
- import type { NangoSyncConfig } from '../flow';
5
- import type { Provider } from '../providers/provider';
1
+ import type { ApiTimestamps, Endpoint } from '../api.js';
2
+ import type { IntegrationConfig } from './db.js';
3
+ import type { AuthModeType, AuthModes } from '../auth/api.js';
4
+ import type { NangoSyncConfig } from '../flow/index.js';
5
+ import type { Provider } from '../providers/provider.js';
6
6
  import type { Merge } from 'type-fest';
7
7
  export type ApiPublicIntegration = Merge<Pick<IntegrationConfig, 'created_at' | 'updated_at' | 'unique_key' | 'provider' | 'display_name' | 'forward_webhooks'>, ApiTimestamps> & {
8
8
  logo: string;
@@ -112,6 +112,8 @@ export type ApiIntegrationList = ApiIntegration & {
112
112
  connectionConfigParams?: string[];
113
113
  credentialParams?: string[];
114
114
  displayName: string;
115
+ requireClientCertificate?: boolean;
116
+ installation?: 'outbound';
115
117
  };
116
118
  };
117
119
  export type GetIntegrations = Endpoint<{
@@ -1,6 +1,6 @@
1
- import type { Endpoint } from '../api';
2
- import type { ApiInvitation, ApiTeam } from '../team/api';
3
- import type { ApiUser } from '../user/api';
1
+ import type { Endpoint } from '../api.js';
2
+ import type { ApiInvitation, ApiTeam } from '../team/api.js';
3
+ import type { ApiUser } from '../user/api.js';
4
4
  export type PostInvite = Endpoint<{
5
5
  Method: 'POST';
6
6
  Path: '/api/v1/invite';
@@ -1,4 +1,4 @@
1
- import type { Timestamps } from '../db';
1
+ import type { Timestamps } from '../db.js';
2
2
  export interface DBInvitation extends Timestamps {
3
3
  id: number;
4
4
  name: string;
@@ -1,7 +1,7 @@
1
+ import type { ApiError, Endpoint } from '../api.js';
2
+ import type { RunnerOutputError } from '../runner/index.js';
3
+ import type { NangoProps } from '../runner/sdk.js';
1
4
  import type { JsonValue } from 'type-fest';
2
- import type { ApiError, Endpoint } from '../api';
3
- import type { RunnerOutputError } from '../runner';
4
- import type { NangoProps } from '../runner/sdk';
5
5
  export type PostHeartbeat = Endpoint<{
6
6
  Method: 'POST';
7
7
  Path: '/tasks/:taskId/heartbeat';
@@ -1,6 +1,6 @@
1
- import type { Endpoint } from '../api';
2
- import type { PickFromUnion } from '../utils';
3
- import type { MessageRow, OperationList, OperationRow, OperationState } from './messages';
1
+ import type { Endpoint } from '../api.js';
2
+ import type { PickFromUnion } from '../utils.js';
3
+ import type { MessageRow, OperationList, OperationRow, OperationState } from './messages.js';
4
4
  type Concat<T extends OperationList> = T extends {
5
5
  action: string;
6
6
  } ? `${T['type']}:${T['action']}` : never;
@@ -1,5 +1,5 @@
1
- import type { ApiError, Endpoint } from '../api';
2
- import type { DBEnvironment } from '../environment/db';
1
+ import type { ApiError, Endpoint } from '../api.js';
2
+ import type { DBEnvironment } from '../environment/db.js';
3
3
  export type GetMeta = Endpoint<{
4
4
  Method: 'GET';
5
5
  Path: '/api/v1/meta';
@@ -1,4 +1,4 @@
1
- import type { OnEventType } from '../scripts/on-events/api';
1
+ import type { OnEventType } from '../scripts/on-events/api.js';
2
2
  export type HTTP_METHOD = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
3
3
  export type SyncTypeLiteral = 'incremental' | 'full';
4
4
  export type ScriptFileType = 'actions' | 'syncs' | 'on-events' | 'post-connection-scripts';
@@ -1,4 +1,4 @@
1
- import type { Endpoint } from '../api';
1
+ import type { Endpoint } from '../api.js';
2
2
  export type PatchOnboarding = Endpoint<{
3
3
  Method: 'PATCH';
4
4
  Path: '/api/v1/onboarding';
@@ -1,4 +1,4 @@
1
- import type { Timestamps } from '../db';
1
+ import type { Timestamps } from '../db.js';
2
2
  /**
3
3
  * Onboarding row in database
4
4
  */
@@ -1,8 +1,14 @@
1
- import type { Timestamps } from '../db';
1
+ import type { Timestamps } from '../db.js';
2
2
  export interface DBPlan extends Timestamps {
3
3
  id: number;
4
4
  account_id: number;
5
5
  name: string;
6
+ stripe_customer_id: string | null;
7
+ stripe_payment_id: string | null;
8
+ orb_customer_id: string | null;
9
+ orb_subscription_id: string | null;
10
+ orb_future_plan: string | null;
11
+ orb_future_plan_at: Date | null;
6
12
  trial_start_at: Date | null;
7
13
  trial_end_at: Date | null;
8
14
  trial_extension_count: number;
@@ -46,4 +52,9 @@ export interface DBPlan extends Timestamps {
46
52
  * @default "m"
47
53
  */
48
54
  api_rate_limit_size: 's' | 'm' | 'l' | 'xl' | '2xl' | '3xl' | '4xl';
55
+ /**
56
+ * Enable or disable machine auto idling
57
+ * @default true
58
+ */
59
+ auto_idle: boolean;
49
60
  }
@@ -1,7 +1,7 @@
1
- import type { BillingCustomer, BillingUsageMetric } from '../billing/types';
2
- import type { ReplaceInObject } from '../utils';
1
+ import type { BillingCustomer, BillingUsageMetric } from '../billing/types.js';
2
+ import type { ReplaceInObject } from '../utils.js';
3
3
  import type { DBPlan } from './db.js';
4
- import type { Endpoint } from '../api';
4
+ import type { Endpoint } from '../api.js';
5
5
  export type ApiPlan = ReplaceInObject<DBPlan, Date, string>;
6
6
  export type PostPlanExtendTrial = Endpoint<{
7
7
  Method: 'POST';
@@ -21,6 +21,11 @@ export interface PlanDefinition {
21
21
  description: string;
22
22
  canUpgrade: boolean;
23
23
  canDowngrade: false;
24
+ /**
25
+ * OrbId is the custom external_plan_id that we can setup
26
+ * It's handy because you can set the same id in staging and prod
27
+ */
28
+ orbId?: string;
24
29
  cta?: string;
25
30
  hidden?: boolean;
26
31
  flags: Omit<Partial<DBPlan>, 'id' | 'account_id'>;
@@ -1,5 +1,5 @@
1
- import type { Endpoint } from '../api';
2
- import type { Provider } from './provider';
1
+ import type { Endpoint } from '../api.js';
2
+ import type { Provider } from './provider.js';
3
3
  export type GetPublicProviders = Endpoint<{
4
4
  Method: 'GET';
5
5
  Path: `/providers`;
@@ -38,6 +38,7 @@ export interface SimplifiedJSONSchema {
38
38
  export interface BaseProvider {
39
39
  display_name: string;
40
40
  auth_mode: AuthModeType;
41
+ installation?: 'outbound';
41
42
  proxy?: {
42
43
  base_url: string;
43
44
  headers?: Record<string, string>;
@@ -70,12 +71,15 @@ export interface BaseProvider {
70
71
  authorization_url_replacements?: Record<string, string>;
71
72
  redirect_uri_metadata?: string[];
72
73
  token_response_metadata?: string[];
74
+ webhook_response_metadata?: string[];
75
+ authorization_code_param_in_webhook?: string;
73
76
  docs: string;
74
77
  docs_connect?: string;
75
78
  token_expiration_buffer?: number;
76
79
  webhook_routing_script?: string;
77
80
  webhook_user_defined_secret?: boolean;
78
81
  post_connection_script?: string;
82
+ pre_connection_deletion_script?: string;
79
83
  credentials_verification_script?: string;
80
84
  categories?: string[];
81
85
  connection_configuration?: string[];
@@ -83,6 +87,7 @@ export interface BaseProvider {
83
87
  credentials?: Record<string, SimplifiedJSONSchema>;
84
88
  authorization_url_fragment?: string;
85
89
  body_format?: OAuthBodyFormatType;
90
+ require_client_certificate?: boolean;
86
91
  }
87
92
  export interface ProviderOAuth2 extends BaseProvider {
88
93
  auth_mode: 'OAUTH2';
@@ -137,9 +142,6 @@ export interface ProviderAppleAppStore extends BaseProvider {
137
142
  auth_mode: 'APP_STORE';
138
143
  token_url: string;
139
144
  }
140
- export interface ProviderTableau extends BaseProvider {
141
- auth_mode: 'TABLEAU';
142
- }
143
145
  export interface ProviderBill extends BaseProvider {
144
146
  auth_mode: 'BILL';
145
147
  }
@@ -179,6 +181,6 @@ export interface ProviderSignature extends BaseProvider {
179
181
  export interface ProviderApiKey extends BaseProvider {
180
182
  auth_mode: 'API_KEY';
181
183
  }
182
- export type Provider = BaseProvider | ProviderOAuth1 | ProviderOAuth2 | ProviderJwt | ProviderTwoStep | ProviderSignature | ProviderApiKey | ProviderTableau | ProviderBill | ProviderGithubApp | ProviderAppleAppStore | ProviderCustom;
184
+ export type Provider = BaseProvider | ProviderOAuth1 | ProviderOAuth2 | ProviderJwt | ProviderTwoStep | ProviderSignature | ProviderApiKey | ProviderBill | ProviderGithubApp | ProviderAppleAppStore | ProviderCustom;
183
185
  export type RefreshableProvider = ProviderTwoStep | ProviderJwt | ProviderSignature | ProviderOAuth2;
184
186
  export type TestableProvider = ProviderApiKey;
@@ -1,4 +1,4 @@
1
- import type { ApiError, Endpoint } from '../api';
1
+ import type { ApiError, Endpoint } from '../api.js';
2
2
  export type RecordLastAction = 'ADDED' | 'UPDATED' | 'DELETED' | 'added' | 'updated' | 'deleted';
3
3
  export type CombinedFilterAction = `${RecordLastAction},${RecordLastAction}`;
4
4
  export interface RecordMetadata {
@@ -1,6 +1,6 @@
1
- import type { RunnerFlags } from '.';
2
- import type { DBSyncConfig } from '../syncConfigs/db';
3
- import type { DBTeam } from '../team/db';
1
+ import type { RunnerFlags } from './index.js';
2
+ import type { DBSyncConfig } from '../syncConfigs/db.js';
3
+ import type { DBTeam } from '../team/db.js';
4
4
  import type { AxiosError, AxiosInterceptorManager, AxiosRequestConfig, AxiosResponse } from 'axios';
5
5
  export interface NangoProps {
6
6
  scriptType: 'sync' | 'action' | 'webhook' | 'on-event';
@@ -1,5 +1,5 @@
1
- import type { Endpoint } from '../api';
2
- import type { StandardNangoConfig } from '../flow';
1
+ import type { Endpoint } from '../api.js';
2
+ import type { StandardNangoConfig } from '../flow/index.js';
3
3
  export interface OpenAIFunction {
4
4
  name: string;
5
5
  description: string;
@@ -1,4 +1,4 @@
1
- import type { Timestamps } from '../db';
1
+ import type { Timestamps } from '../db.js';
2
2
  export interface DBSlackNotification extends Timestamps {
3
3
  id: number;
4
4
  open: boolean;
@@ -0,0 +1,43 @@
1
+ import type { Endpoint } from '../api.js';
2
+ export type PostStripeCollectPayment = Endpoint<{
3
+ Method: 'POST';
4
+ Path: '/api/v1/stripe/payment_methods';
5
+ Success: {
6
+ data: {
7
+ secret: string;
8
+ };
9
+ };
10
+ }>;
11
+ export type GetStripePaymentMethods = Endpoint<{
12
+ Method: 'GET';
13
+ Path: '/api/v1/stripe/payment_methods';
14
+ Success: {
15
+ data: {
16
+ id: string;
17
+ last4: string;
18
+ }[];
19
+ };
20
+ }>;
21
+ export type DeleteStripePayment = Endpoint<{
22
+ Method: 'DELETE';
23
+ Path: '/api/v1/stripe/payment_methods';
24
+ Querystring: {
25
+ payment_id: string;
26
+ };
27
+ Success: {
28
+ data: {
29
+ deleted: boolean;
30
+ };
31
+ };
32
+ }>;
33
+ export type PostStripeWebhooks = Endpoint<{
34
+ Method: 'POST';
35
+ Path: '/api/v1/stripe/webhooks';
36
+ Body: any;
37
+ Headers: {
38
+ 'stripe-signature': string;
39
+ };
40
+ Success: {
41
+ success: boolean;
42
+ };
43
+ }>;
@@ -1,4 +1,4 @@
1
+ import type { ApiTimestamps } from '../api.js';
2
+ import type { DBSyncConfig } from './db.js';
1
3
  import type { Merge } from 'type-fest';
2
- import type { ApiTimestamps } from '../api';
3
- import type { DBSyncConfig } from './db';
4
4
  export type ApiSyncConfig = Merge<DBSyncConfig, ApiTimestamps>;
@@ -1,6 +1,6 @@
1
- import type { TimestampsAndDeleted } from '../db';
2
- import type { LegacySyncModelSchema, NangoConfigMetadata } from '../deploy/incomingFlow';
3
- import type { NangoModel, ScriptTypeLiteral, SyncTypeLiteral } from '../nangoYaml';
1
+ import type { TimestampsAndDeleted } from '../db.js';
2
+ import type { LegacySyncModelSchema, NangoConfigMetadata } from '../deploy/incomingFlow.js';
3
+ import type { NangoModel, ScriptTypeLiteral, SyncTypeLiteral } from '../nangoYaml/index.js';
4
4
  import type { JSONSchema7 } from 'json-schema';
5
5
  export interface DBSyncConfig extends TimestampsAndDeleted {
6
6
  id: number;
@@ -1,7 +1,7 @@
1
- import type { ApiError, ApiTimestamps, Endpoint } from '../api';
2
- import type { DBTeam } from './db';
3
- import type { DBInvitation } from '../invitations/db';
4
- import type { ApiUser } from '../user/api';
1
+ import type { ApiError, ApiTimestamps, Endpoint } from '../api.js';
2
+ import type { DBTeam } from './db.js';
3
+ import type { DBInvitation } from '../invitations/db.js';
4
+ import type { ApiUser } from '../user/api.js';
5
5
  import type { Merge } from 'type-fest';
6
6
  export type GetTeam = Endpoint<{
7
7
  Method: 'GET';
package/dist/team/db.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Timestamps } from '../db';
1
+ import type { Timestamps } from '../db.js';
2
2
  export interface DBTeam extends Timestamps {
3
3
  id: number;
4
4
  name: string;
@@ -1,4 +1,4 @@
1
- import type { Endpoint } from '../api';
1
+ import type { Endpoint } from '../api.js';
2
2
  export type GetUser = Endpoint<{
3
3
  Method: 'GET';
4
4
  Path: `/api/v1/user`;
package/dist/user/db.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Timestamps } from '../db';
1
+ import type { Timestamps } from '../db.js';
2
2
  export interface DBUser extends Timestamps {
3
3
  id: number;
4
4
  email: string;
@@ -1,4 +1,4 @@
1
- import type { ApiError, Endpoint } from '../api';
1
+ import type { ApiError, Endpoint } from '../api.js';
2
2
  export type PostPublicWebhook = Endpoint<{
3
3
  Method: 'POST';
4
4
  Path: '/webhook/:environmentUuid/:providerConfigKey';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/types",
3
- "version": "0.61.2",
3
+ "version": "0.62.0",
4
4
  "description": "Types used in Nango applications",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",