@nangohq/types 0.57.0 → 0.57.2
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/auth/api.d.ts +2 -0
- package/dist/connect/api.d.ts +17 -3
- package/dist/connect/session.d.ts +10 -8
- package/dist/connection/db.d.ts +8 -1
- package/dist/logs/messages.d.ts +2 -2
- package/dist/providers/provider.d.ts +11 -2
- package/dist/utils.d.ts +3 -0
- package/package.json +1 -1
package/dist/api.endpoints.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { GetUser, PatchUser } from './user/api';
|
|
|
10
10
|
import type { DeleteIntegration, DeletePublicIntegration, GetIntegration, GetIntegrationFlows, GetPublicIntegration, GetPublicListIntegrations, GetPublicListIntegrationsLegacy, PatchIntegration, PostIntegration } from './integration/api';
|
|
11
11
|
import type { PostPublicTableauAuthorization, PostPublicTbaAuthorization, PostPublicUnauthenticatedAuthorization, PostPublicJwtAuthorization, PostPublicBillAuthorization, PostPublicSignatureAuthorization, PostPublicTwoStepAuthorization, PostPublicApiKeyAuthorization, PostPublicBasicAuthorization, PostPublicAppStoreAuthorization } from './auth/http.api';
|
|
12
12
|
import type { GetPublicProvider, GetPublicProviders } from './providers/api';
|
|
13
|
-
import type { DeleteConnectSession, GetConnectSession, PostConnectSessions, PostInternalConnectSessions, PostPublicConnectSessionsReconnect } from './connect/api';
|
|
13
|
+
import type { DeleteConnectSession, GetConnectSession, PostConnectSessions, PostInternalConnectSessions, PostPublicConnectSessionsReconnect, PostPublicConnectTelemetry } from './connect/api';
|
|
14
14
|
import type { DeletePublicConnection, GetConnection, GetConnections, GetConnectionsCount, GetPublicConnection, GetPublicConnections, PostConnectionRefresh } from './connection/api/get';
|
|
15
15
|
import type { GetMeta } from './meta/api';
|
|
16
16
|
import type { PatchFlowDisable, PatchFlowEnable, PatchFlowFrequency, PostPreBuiltDeploy, PutUpgradePreBuiltFlow } from './flow/http.api';
|
|
@@ -20,7 +20,7 @@ import type { PatchWebhook } from './environment/api/webhook';
|
|
|
20
20
|
import type { PostEnvironmentVariables } from './environment/variable/api';
|
|
21
21
|
import type { GetPublicRecords } from './record/api';
|
|
22
22
|
import type { GetPublicScriptsConfig } from './scripts/http.api';
|
|
23
|
-
export type PublicApiEndpoints = SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation | 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;
|
|
23
|
+
export type PublicApiEndpoints = SetMetadata | UpdateMetadata | PostDeploy | PostDeployConfirmation | 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;
|
|
24
24
|
export type PrivateApiEndpoints = PostSignup | PostSignin | GetTeam | PutTeam | 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 | PatchWebhook | PostEnvironmentVariables;
|
|
25
25
|
export type APIEndpoints = PrivateApiEndpoints | PublicApiEndpoints;
|
|
26
26
|
/**
|
package/dist/auth/api.d.ts
CHANGED
|
@@ -158,4 +158,6 @@ export type RefreshTokenResponse = AuthorizationTokenResponse;
|
|
|
158
158
|
export interface AuthorizationTokenResponse extends Omit<OAuth2Credentials, 'type' | 'raw'> {
|
|
159
159
|
expires_in?: number;
|
|
160
160
|
}
|
|
161
|
+
export type TestableCredentials = ApiKeyCredentials | BasicApiCredentials | TbaCredentials | JwtCredentials | SignatureCredentials;
|
|
162
|
+
export type RefreshableCredentials = OAuth2Credentials | AppCredentials | AppStoreCredentials | OAuth2ClientCredentials | TableauCredentials | JwtCredentials | TwoStepCredentials | BillCredentials | SignatureCredentials;
|
|
161
163
|
export type AllAuthCredentials = OAuth1Credentials | OAuth2Credentials | OAuth2ClientCredentials | BasicApiCredentials | ApiKeyCredentials | AppCredentials | AppStoreCredentials | UnauthCredentials | CustomCredentials | TbaCredentials | TableauCredentials | JwtCredentials | BillCredentials | TwoStepCredentials | SignatureCredentials;
|
package/dist/connect/api.d.ts
CHANGED
|
@@ -3,10 +3,11 @@ export interface ConnectSessionInput {
|
|
|
3
3
|
allowed_integrations?: string[] | undefined;
|
|
4
4
|
integrations_config_defaults?: Record<string, {
|
|
5
5
|
user_scopes?: string | undefined;
|
|
6
|
-
|
|
6
|
+
authorization_params?: Record<string, string> | undefined;
|
|
7
|
+
connection_config?: {
|
|
7
8
|
[key: string]: unknown;
|
|
8
9
|
oauth_scopes_override?: string | undefined;
|
|
9
|
-
};
|
|
10
|
+
} | undefined;
|
|
10
11
|
}> | undefined;
|
|
11
12
|
end_user: {
|
|
12
13
|
id: string;
|
|
@@ -65,5 +66,18 @@ export type PostInternalConnectSessions = Endpoint<{
|
|
|
65
66
|
Method: 'POST';
|
|
66
67
|
Path: '/api/v1/connect/sessions';
|
|
67
68
|
Success: PostConnectSessions['Success'];
|
|
68
|
-
Body: Pick<ConnectSessionInput, 'allowed_integrations' | 'end_user' | 'organization'>;
|
|
69
|
+
Body: Pick<ConnectSessionInput, 'allowed_integrations' | 'end_user' | 'organization' | 'integrations_config_defaults'>;
|
|
70
|
+
}>;
|
|
71
|
+
export type PostPublicConnectTelemetry = Endpoint<{
|
|
72
|
+
Method: 'POST';
|
|
73
|
+
Path: '/connect/telemetry';
|
|
74
|
+
Body: {
|
|
75
|
+
token: string;
|
|
76
|
+
event: 'open' | 'view:list' | 'view:integration' | 'view:unknown_error' | 'view:credentials_error' | 'view:success' | 'click:integration' | 'click:doc' | 'click:doc_section' | 'click:connect' | 'click:close' | 'click:finish' | 'click:outside' | 'popup:blocked_by_browser' | 'popup:closed_early';
|
|
77
|
+
timestamp: Date;
|
|
78
|
+
dimensions?: {
|
|
79
|
+
integration?: string | undefined;
|
|
80
|
+
} | undefined;
|
|
81
|
+
};
|
|
82
|
+
Success: never;
|
|
69
83
|
}>;
|
|
@@ -6,14 +6,16 @@ export interface ConnectSession {
|
|
|
6
6
|
readonly connectionId: number | null;
|
|
7
7
|
readonly operationId: string | null;
|
|
8
8
|
readonly allowedIntegrations: string[] | null;
|
|
9
|
-
readonly integrationsConfigDefaults: Record<string,
|
|
10
|
-
/** Only used by Slack */
|
|
11
|
-
user_scopes?: string | undefined;
|
|
12
|
-
connectionConfig: {
|
|
13
|
-
[key: string]: unknown;
|
|
14
|
-
oauth_scopes_override?: string | undefined;
|
|
15
|
-
};
|
|
16
|
-
}> | null;
|
|
9
|
+
readonly integrationsConfigDefaults: Record<string, ConnectSessionIntegrationConfigDefaults> | null;
|
|
17
10
|
readonly createdAt: Date;
|
|
18
11
|
readonly updatedAt: Date | null;
|
|
19
12
|
}
|
|
13
|
+
export interface ConnectSessionIntegrationConfigDefaults {
|
|
14
|
+
/** Only used by Slack */
|
|
15
|
+
user_scopes?: string | undefined;
|
|
16
|
+
authorization_params?: Record<string, string> | undefined;
|
|
17
|
+
connectionConfig?: {
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
oauth_scopes_override?: string | undefined;
|
|
20
|
+
} | undefined;
|
|
21
|
+
}
|
package/dist/connection/db.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ import type { TimestampsAndDeletedCorrect } from '../db.js';
|
|
|
2
2
|
import type { AuthModeType, AuthOperationType, AllAuthCredentials } from '../auth/api.js';
|
|
3
3
|
import type { DBEnvironment } from '../environment/db.js';
|
|
4
4
|
import type { DBTeam } from '../team/db.js';
|
|
5
|
-
import type { Merge } from 'type-fest';
|
|
5
|
+
import type { Merge, Simplify } from 'type-fest';
|
|
6
6
|
import type { EndUser } from '../endUser/index.js';
|
|
7
|
+
import type { ReplaceInObject } from '../utils.js';
|
|
7
8
|
export type Metadata = Record<string, unknown>;
|
|
8
9
|
export type ConnectionConfig = Record<string, any>;
|
|
9
10
|
export interface DBConnection extends TimestampsAndDeletedCorrect {
|
|
@@ -24,7 +25,13 @@ export interface DBConnection extends TimestampsAndDeletedCorrect {
|
|
|
24
25
|
credentials_iv: string | null;
|
|
25
26
|
credentials_tag: string | null;
|
|
26
27
|
last_fetched_at: Date | null;
|
|
28
|
+
credentials_expires_at: Date | null;
|
|
29
|
+
last_refresh_failure: Date | null;
|
|
30
|
+
last_refresh_success: Date | null;
|
|
31
|
+
refresh_attempts: number | null;
|
|
32
|
+
refresh_exhausted: boolean;
|
|
27
33
|
}
|
|
34
|
+
export type DBConnectionAsJSONRow = Simplify<ReplaceInObject<DBConnection, Date, string>>;
|
|
28
35
|
export type DBConnectionDecrypted = Merge<DBConnection, {
|
|
29
36
|
credentials: AllAuthCredentials;
|
|
30
37
|
}>;
|
package/dist/logs/messages.d.ts
CHANGED
|
@@ -87,7 +87,7 @@ export interface MessageRow {
|
|
|
87
87
|
level: LogLevel;
|
|
88
88
|
type: MessageType;
|
|
89
89
|
message: string;
|
|
90
|
-
context?: 'script' | 'proxy' | 'webhook';
|
|
90
|
+
context?: 'script' | 'proxy' | 'webhook' | undefined;
|
|
91
91
|
parentId: string;
|
|
92
92
|
error?: MessageError | undefined;
|
|
93
93
|
request?: MessageHTTPRequest | undefined;
|
|
@@ -148,7 +148,7 @@ export type OperationRowInsert = Merge<Partial<OperationRow>, Pick<OperationRow,
|
|
|
148
148
|
/**
|
|
149
149
|
* What is required to insert a Message
|
|
150
150
|
*/
|
|
151
|
-
export type MessageRowInsert = Pick<MessageRow, 'type' | 'message' | 'createdAt'> & Partial<Omit<MessageRow, 'type' | 'message'>> & {
|
|
151
|
+
export type MessageRowInsert = Pick<MessageRow, 'type' | 'message' | 'createdAt' | 'level'> & Partial<Omit<MessageRow, 'type' | 'message'>> & {
|
|
152
152
|
id?: never;
|
|
153
153
|
};
|
|
154
154
|
export type MessageOrOperationRow = MessageRow | OperationRow;
|
|
@@ -50,7 +50,7 @@ export interface BaseProvider {
|
|
|
50
50
|
paginate?: LinkPagination | CursorPagination | OffsetPagination;
|
|
51
51
|
verification?: {
|
|
52
52
|
method: EndpointMethod;
|
|
53
|
-
|
|
53
|
+
endpoints: string[];
|
|
54
54
|
base_url_override?: string;
|
|
55
55
|
headers?: Record<string, string>;
|
|
56
56
|
};
|
|
@@ -74,6 +74,7 @@ export interface BaseProvider {
|
|
|
74
74
|
webhook_routing_script?: string;
|
|
75
75
|
webhook_user_defined_secret?: boolean;
|
|
76
76
|
post_connection_script?: string;
|
|
77
|
+
credentials_verification_script?: string;
|
|
77
78
|
categories?: string[];
|
|
78
79
|
connection_configuration?: string[];
|
|
79
80
|
connection_config?: Record<string, SimplifiedJSONSchema>;
|
|
@@ -104,6 +105,7 @@ export interface ProviderOAuth1 extends BaseProvider {
|
|
|
104
105
|
signature_method: 'HMAC-SHA1' | 'RSA-SHA1' | 'PLAINTEXT';
|
|
105
106
|
}
|
|
106
107
|
export interface ProviderJwt extends BaseProvider {
|
|
108
|
+
auth_mode: 'JWT';
|
|
107
109
|
token: {
|
|
108
110
|
expires_in_ms: number;
|
|
109
111
|
headers: {
|
|
@@ -115,6 +117,7 @@ export interface ProviderJwt extends BaseProvider {
|
|
|
115
117
|
};
|
|
116
118
|
}
|
|
117
119
|
export interface ProviderTwoStep extends Omit<BaseProvider, 'body_format'> {
|
|
120
|
+
auth_mode: 'TWO_STEP';
|
|
118
121
|
token_headers?: Record<string, string>;
|
|
119
122
|
token_response: {
|
|
120
123
|
token: string;
|
|
@@ -132,6 +135,7 @@ export interface ProviderTwoStep extends Omit<BaseProvider, 'body_format'> {
|
|
|
132
135
|
body_format?: 'xml' | 'json' | 'form';
|
|
133
136
|
}
|
|
134
137
|
export interface ProviderSignature extends BaseProvider {
|
|
138
|
+
auth_mode: 'SIGNATURE';
|
|
135
139
|
signature: {
|
|
136
140
|
protocol: 'WSSE';
|
|
137
141
|
};
|
|
@@ -139,4 +143,9 @@ export interface ProviderSignature extends BaseProvider {
|
|
|
139
143
|
expires_in_ms: number;
|
|
140
144
|
};
|
|
141
145
|
}
|
|
142
|
-
export
|
|
146
|
+
export interface ProviderApiKey extends BaseProvider {
|
|
147
|
+
auth_mode: 'API_KEY';
|
|
148
|
+
}
|
|
149
|
+
export type Provider = BaseProvider | ProviderOAuth1 | ProviderOAuth2 | ProviderJwt | ProviderTwoStep | ProviderSignature | ProviderApiKey;
|
|
150
|
+
export type RefreshableProvider = ProviderTwoStep | ProviderJwt | ProviderSignature | ProviderOAuth2;
|
|
151
|
+
export type TestableProvider = ProviderApiKey;
|
package/dist/utils.d.ts
CHANGED
|
@@ -18,4 +18,7 @@ export type Jsonable = string | number | boolean | null | undefined | readonly J
|
|
|
18
18
|
} | {
|
|
19
19
|
toJSON(): Jsonable;
|
|
20
20
|
};
|
|
21
|
+
export type ReplaceInObject<T, From, To> = {
|
|
22
|
+
[K in keyof T]: T[K] extends infer U ? (U extends From ? Exclude<U, From> | To : U) : never;
|
|
23
|
+
};
|
|
21
24
|
export {};
|