@nangohq/types 0.58.6 → 0.58.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/api.endpoints.d.ts +2 -2
- package/dist/billing/types.d.ts +35 -0
- package/dist/index.d.ts +2 -0
- package/dist/integration/api.d.ts +56 -0
- package/dist/integration/db.d.ts +2 -1
- package/dist/logs/api.d.ts +1 -0
- package/dist/plans/http.api.d.ts +15 -0
- package/dist/providers/provider.d.ts +10 -2
- package/dist/result.d.ts +17 -0
- package/package.json +3 -3
package/dist/api.endpoints.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { DeleteEnvironment, PatchEnvironment, PostEnvironment } from './env
|
|
|
9
9
|
import type { PatchWebhook } from './environment/api/webhook';
|
|
10
10
|
import type { PostEnvironmentVariables } from './environment/variable/api';
|
|
11
11
|
import type { PatchFlowDisable, PatchFlowEnable, PatchFlowFrequency, PostPreBuiltDeploy, PutUpgradePreBuiltFlow } from './flow/http.api';
|
|
12
|
-
import type { DeleteIntegration, DeletePublicIntegration, GetIntegration, GetIntegrationFlows, GetPublicIntegration, GetPublicListIntegrations, GetPublicListIntegrationsLegacy, PatchIntegration, PostIntegration } from './integration/api';
|
|
12
|
+
import type { DeleteIntegration, DeletePublicIntegration, GetIntegration, GetIntegrationFlows, GetPublicIntegration, GetPublicListIntegrations, GetPublicListIntegrationsLegacy, PatchIntegration, PatchPublicIntegration, PostIntegration, PostPublicIntegration } from './integration/api';
|
|
13
13
|
import type { DeleteInvite, GetInvite, PostInvite } from './invitations/api';
|
|
14
14
|
import type { GetOperation, PostInsights, SearchFilters, SearchMessages, SearchOperations } from './logs/api';
|
|
15
15
|
import type { GetMeta } from './meta/api';
|
|
@@ -22,7 +22,7 @@ import type { PostPublicTrigger, PutPublicSyncConnectionFrequency } from './sync
|
|
|
22
22
|
import type { DeleteTeamUser, GetTeam, PutTeam } from './team/api';
|
|
23
23
|
import type { GetUser, PatchUser } from './user/api';
|
|
24
24
|
import type { PostPublicWebhook } from './webhooks/http.api';
|
|
25
|
-
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;
|
|
25
|
+
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;
|
|
26
26
|
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;
|
|
27
27
|
export type APIEndpoints = PrivateApiEndpoints | PublicApiEndpoints;
|
|
28
28
|
/**
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Result } from '../result';
|
|
2
|
+
export interface BillingClient {
|
|
3
|
+
ingest: (events: BillingIngestEvent[]) => Promise<void>;
|
|
4
|
+
getCustomer: (accountId: number) => Promise<Result<BillingCustomer>>;
|
|
5
|
+
getSubscription: (accountId: number) => Promise<Result<BillingSubscription | null>>;
|
|
6
|
+
getUsage: (subscriptionId: string, period?: 'previous') => Promise<Result<BillingUsageMetric[]>>;
|
|
7
|
+
}
|
|
8
|
+
export interface BillingCustomer {
|
|
9
|
+
id: string;
|
|
10
|
+
portalUrl: string | null;
|
|
11
|
+
}
|
|
12
|
+
export interface BillingSubscription {
|
|
13
|
+
id: string;
|
|
14
|
+
}
|
|
15
|
+
export interface BillingUsageMetric {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
quantity: number;
|
|
19
|
+
}
|
|
20
|
+
export interface BillingIngestEvent {
|
|
21
|
+
type: 'monthly_active_records' | 'billable_connections' | 'billable_actions';
|
|
22
|
+
idempotencyKey: string;
|
|
23
|
+
accountId: number;
|
|
24
|
+
timestamp: Date;
|
|
25
|
+
properties: Record<string, string | number>;
|
|
26
|
+
}
|
|
27
|
+
export interface BillingMetric {
|
|
28
|
+
type: BillingIngestEvent['type'];
|
|
29
|
+
value: number;
|
|
30
|
+
properties: {
|
|
31
|
+
accountId: number;
|
|
32
|
+
timestamp?: Date | undefined;
|
|
33
|
+
idempotencyKey?: string | undefined;
|
|
34
|
+
};
|
|
35
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -19,8 +19,10 @@ export type * from './syncConfigs/db.js';
|
|
|
19
19
|
export type * from './syncConfigs/api.js';
|
|
20
20
|
export type * from './team/api.js';
|
|
21
21
|
export type * from './team/db.js';
|
|
22
|
+
export type * from './billing/types.js';
|
|
22
23
|
export type * from './providers/api.js';
|
|
23
24
|
export type * from './proxy/api.js';
|
|
25
|
+
export type * from './result.js';
|
|
24
26
|
export type * from './scripts/on-events/db.js';
|
|
25
27
|
export type * from './scripts/on-events/api.js';
|
|
26
28
|
export type * from './scripts/syncs/api.js';
|
|
@@ -38,6 +38,19 @@ export type GetPublicListIntegrations = Endpoint<{
|
|
|
38
38
|
data: ApiPublicIntegration[];
|
|
39
39
|
};
|
|
40
40
|
}>;
|
|
41
|
+
export type PostPublicIntegration = Endpoint<{
|
|
42
|
+
Method: 'POST';
|
|
43
|
+
Path: '/integrations';
|
|
44
|
+
Body: {
|
|
45
|
+
provider: string;
|
|
46
|
+
unique_key: string;
|
|
47
|
+
display_name?: string | undefined;
|
|
48
|
+
credentials?: ApiPublicIntegrationCredentials | undefined;
|
|
49
|
+
};
|
|
50
|
+
Success: {
|
|
51
|
+
data: ApiPublicIntegration;
|
|
52
|
+
};
|
|
53
|
+
}>;
|
|
41
54
|
export type GetPublicIntegration = Endpoint<{
|
|
42
55
|
Method: 'GET';
|
|
43
56
|
Path: '/integrations/:uniqueKey';
|
|
@@ -51,7 +64,32 @@ export type GetPublicIntegration = Endpoint<{
|
|
|
51
64
|
data: ApiPublicIntegration;
|
|
52
65
|
};
|
|
53
66
|
}>;
|
|
67
|
+
export type PatchPublicIntegration = Endpoint<{
|
|
68
|
+
Method: 'PATCH';
|
|
69
|
+
Path: '/integrations/:uniqueKey';
|
|
70
|
+
Params: {
|
|
71
|
+
uniqueKey: string;
|
|
72
|
+
};
|
|
73
|
+
Body: {
|
|
74
|
+
unique_key?: string | undefined;
|
|
75
|
+
display_name?: string | undefined;
|
|
76
|
+
credentials?: ApiPublicIntegrationCredentials | undefined;
|
|
77
|
+
};
|
|
78
|
+
Success: {
|
|
79
|
+
data: ApiPublicIntegration;
|
|
80
|
+
};
|
|
81
|
+
}>;
|
|
54
82
|
export type DeletePublicIntegration = Endpoint<{
|
|
83
|
+
Method: 'DELETE';
|
|
84
|
+
Path: '/integrations/:uniqueKey';
|
|
85
|
+
Params: {
|
|
86
|
+
uniqueKey: string;
|
|
87
|
+
};
|
|
88
|
+
Success: {
|
|
89
|
+
success: true;
|
|
90
|
+
};
|
|
91
|
+
}>;
|
|
92
|
+
export type DeletePublicIntegrationDeprecated = Endpoint<{
|
|
55
93
|
Method: 'DELETE';
|
|
56
94
|
Path: '/config/:providerConfigKey';
|
|
57
95
|
Params: {
|
|
@@ -182,3 +220,21 @@ export type GetIntegrationFlows = Endpoint<{
|
|
|
182
220
|
};
|
|
183
221
|
};
|
|
184
222
|
}>;
|
|
223
|
+
export type ApiPublicIntegrationCredentials = {
|
|
224
|
+
type: Extract<AuthModeType, 'OAUTH1' | 'OAUTH2' | 'TBA'>;
|
|
225
|
+
client_id: string;
|
|
226
|
+
client_secret: string;
|
|
227
|
+
scopes?: string | undefined;
|
|
228
|
+
} | {
|
|
229
|
+
type: Extract<AuthModeType, 'APP'>;
|
|
230
|
+
app_id: string;
|
|
231
|
+
app_link: string;
|
|
232
|
+
private_key: string;
|
|
233
|
+
} | {
|
|
234
|
+
type: Extract<AuthModeType, 'CUSTOM'>;
|
|
235
|
+
client_id: string;
|
|
236
|
+
client_secret: string;
|
|
237
|
+
app_id: string;
|
|
238
|
+
app_link: string;
|
|
239
|
+
private_key: string;
|
|
240
|
+
};
|
package/dist/integration/db.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TimestampsAndDeleted } from '../db.js';
|
|
2
2
|
import type { NullablePartial } from '../utils.js';
|
|
3
|
-
import type { SetOptional } from 'type-fest';
|
|
3
|
+
import type { SetOptional, Tagged } from 'type-fest';
|
|
4
4
|
export interface IntegrationConfig extends TimestampsAndDeleted {
|
|
5
5
|
id?: number | undefined;
|
|
6
6
|
unique_key: string;
|
|
@@ -16,4 +16,5 @@ export interface IntegrationConfig extends TimestampsAndDeleted {
|
|
|
16
16
|
missing_fields: string[];
|
|
17
17
|
display_name: string | null;
|
|
18
18
|
}
|
|
19
|
+
export type DBIntegrationCrypted = Tagged<IntegrationConfig, 'IntegrationCrypted'>;
|
|
19
20
|
export type DBCreateIntegration = SetOptional<NullablePartial<Omit<IntegrationConfig, 'created_at' | 'updated_at'>>, 'missing_fields'>;
|
package/dist/logs/api.d.ts
CHANGED
package/dist/plans/http.api.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BillingCustomer, BillingUsageMetric } from '../billing/types';
|
|
1
2
|
import type { ReplaceInObject } from '../utils';
|
|
2
3
|
import type { DBPlan } from './db.js';
|
|
3
4
|
import type { Endpoint } from '../api';
|
|
@@ -34,3 +35,17 @@ export type GetPlans = Endpoint<{
|
|
|
34
35
|
data: PlanDefinition[];
|
|
35
36
|
};
|
|
36
37
|
}>;
|
|
38
|
+
export type GetUsage = Endpoint<{
|
|
39
|
+
Method: 'GET';
|
|
40
|
+
Path: '/api/v1/plans/usage';
|
|
41
|
+
Querystring: {
|
|
42
|
+
env: string;
|
|
43
|
+
};
|
|
44
|
+
Success: {
|
|
45
|
+
data: {
|
|
46
|
+
customer: BillingCustomer;
|
|
47
|
+
current: BillingUsageMetric[];
|
|
48
|
+
previous: BillingUsageMetric[];
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
}>;
|
|
@@ -84,7 +84,7 @@ export interface BaseProvider {
|
|
|
84
84
|
body_format?: OAuthBodyFormatType;
|
|
85
85
|
}
|
|
86
86
|
export interface ProviderOAuth2 extends BaseProvider {
|
|
87
|
-
auth_mode: 'OAUTH2'
|
|
87
|
+
auth_mode: 'OAUTH2';
|
|
88
88
|
disable_pkce?: boolean;
|
|
89
89
|
token_params?: {
|
|
90
90
|
grant_type?: 'authorization_code' | 'client_credentials';
|
|
@@ -93,6 +93,7 @@ export interface ProviderOAuth2 extends BaseProvider {
|
|
|
93
93
|
grant_type: 'refresh_token';
|
|
94
94
|
};
|
|
95
95
|
authorization_method?: OAuthAuthorizationMethodType;
|
|
96
|
+
alternate_access_token_response_path?: string;
|
|
96
97
|
refresh_url?: string;
|
|
97
98
|
expires_in_unit?: 'milliseconds';
|
|
98
99
|
token_request_auth_method?: 'basic' | 'custom';
|
|
@@ -105,6 +106,13 @@ export interface ProviderOAuth1 extends BaseProvider {
|
|
|
105
106
|
token_http_method?: 'GET' | 'PUT' | 'POST';
|
|
106
107
|
signature_method: 'HMAC-SHA1' | 'RSA-SHA1' | 'PLAINTEXT';
|
|
107
108
|
}
|
|
109
|
+
export interface ProviderCustom extends Omit<ProviderOAuth2, 'auth_mode'> {
|
|
110
|
+
auth_mode: 'CUSTOM';
|
|
111
|
+
token_url: {
|
|
112
|
+
OAUTH2: string;
|
|
113
|
+
APP: string;
|
|
114
|
+
};
|
|
115
|
+
}
|
|
108
116
|
export interface ProviderJwt extends BaseProvider {
|
|
109
117
|
auth_mode: 'JWT';
|
|
110
118
|
signature: {
|
|
@@ -170,6 +178,6 @@ export interface ProviderSignature extends BaseProvider {
|
|
|
170
178
|
export interface ProviderApiKey extends BaseProvider {
|
|
171
179
|
auth_mode: 'API_KEY';
|
|
172
180
|
}
|
|
173
|
-
export type Provider = BaseProvider | ProviderOAuth1 | ProviderOAuth2 | ProviderJwt | ProviderTwoStep | ProviderSignature | ProviderApiKey | ProviderTableau | ProviderBill | ProviderGithubApp | ProviderAppleAppStore;
|
|
181
|
+
export type Provider = BaseProvider | ProviderOAuth1 | ProviderOAuth2 | ProviderJwt | ProviderTwoStep | ProviderSignature | ProviderApiKey | ProviderTableau | ProviderBill | ProviderGithubApp | ProviderAppleAppStore | ProviderCustom;
|
|
174
182
|
export type RefreshableProvider = ProviderTwoStep | ProviderJwt | ProviderSignature | ProviderOAuth2;
|
|
175
183
|
export type TestableProvider = ProviderApiKey;
|
package/dist/result.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface Left<T, E extends Error> {
|
|
2
|
+
error: E;
|
|
3
|
+
isErr(this: Result<T, E>): this is Left<T, E>;
|
|
4
|
+
isOk(this: Result<T, E>): this is Right<T, E>;
|
|
5
|
+
unwrap(): T;
|
|
6
|
+
map<U>(fn: (value: T) => U): Result<T, E>;
|
|
7
|
+
mapError<U extends Error>(fn: (error: E) => U): Result<T, U>;
|
|
8
|
+
}
|
|
9
|
+
export interface Right<T, E extends Error> {
|
|
10
|
+
value: T;
|
|
11
|
+
isErr(this: Result<T, E>): this is Left<T, E>;
|
|
12
|
+
isOk(this: Result<T, E>): this is Right<T, E>;
|
|
13
|
+
unwrap(): T;
|
|
14
|
+
map<U>(fn: (value: T) => U): Result<U, E>;
|
|
15
|
+
mapError<U extends Error>(fn: (error: E) => U): Result<T, U>;
|
|
16
|
+
}
|
|
17
|
+
export type Result<T, E extends Error = Error> = Left<T, E> | Right<T, E>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nangohq/types",
|
|
3
|
-
"version": "0.58.
|
|
3
|
+
"version": "0.58.7",
|
|
4
4
|
"description": "Types used in Nango applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"directory": "packages/utils"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"axios": "
|
|
15
|
+
"axios": "1.9.0",
|
|
16
16
|
"json-schema": "0.4.0",
|
|
17
|
-
"type-fest": "4.
|
|
17
|
+
"type-fest": "4.40.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/json-schema": "7.0.15"
|