@scalekit-sdk/node 2.3.0 → 2.5.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.
- package/lib/actions.d.ts +154 -0
- package/lib/actions.js +270 -0
- package/lib/actions.js.map +1 -0
- package/lib/connected-accounts.d.ts +134 -0
- package/lib/connected-accounts.js +187 -0
- package/lib/connected-accounts.js.map +1 -0
- package/lib/connection.d.ts +25 -1
- package/lib/connection.js +36 -0
- package/lib/connection.js.map +1 -1
- package/lib/core.d.ts +13 -3
- package/lib/core.js +36 -14
- package/lib/core.js.map +1 -1
- package/lib/directory.d.ts +25 -1
- package/lib/directory.js +36 -0
- package/lib/directory.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/auditlogs/auditlogs_pb.js +1 -1
- package/lib/pkg/grpc/scalekit/v1/connected_accounts/connected_accounts_pb.d.ts +742 -0
- package/lib/pkg/grpc/scalekit/v1/connected_accounts/connected_accounts_pb.js +216 -0
- package/lib/pkg/grpc/scalekit/v1/connected_accounts/connected_accounts_pb.js.map +1 -0
- package/lib/pkg/grpc/scalekit/v1/connections/connections_pb.d.ts +78 -0
- package/lib/pkg/grpc/scalekit/v1/connections/connections_pb.js +17 -2
- package/lib/pkg/grpc/scalekit/v1/connections/connections_pb.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/directories/directories_pb.d.ts +70 -0
- package/lib/pkg/grpc/scalekit/v1/directories/directories_pb.js +18 -2
- package/lib/pkg/grpc/scalekit/v1/directories/directories_pb.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/domains/domains_pb.js +1 -1
- package/lib/pkg/grpc/scalekit/v1/domains/domains_pb.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/organizations/organizations_pb.d.ts +8 -0
- package/lib/pkg/grpc/scalekit/v1/organizations/organizations_pb.js +1 -1
- package/lib/pkg/grpc/scalekit/v1/organizations/organizations_pb.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/roles/roles_pb.js +1 -1
- package/lib/pkg/grpc/scalekit/v1/roles/roles_pb.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/sessions/sessions_pb.js +1 -1
- package/lib/pkg/grpc/scalekit/v1/tools/tools_pb.d.ts +504 -0
- package/lib/pkg/grpc/scalekit/v1/tools/tools_pb.js +118 -0
- package/lib/pkg/grpc/scalekit/v1/tools/tools_pb.js.map +1 -0
- package/lib/pkg/grpc/scalekit/v1/users/users_pb.js +1 -1
- package/lib/pkg/grpc/scalekit/v1/users/users_pb.js.map +1 -1
- package/lib/role.d.ts +17 -0
- package/lib/role.js +22 -0
- package/lib/role.js.map +1 -1
- package/lib/scalekit.d.ts +23 -0
- package/lib/scalekit.js +53 -0
- package/lib/scalekit.js.map +1 -1
- package/lib/tools.d.ts +96 -0
- package/lib/tools.js +108 -0
- package/lib/tools.js.map +1 -0
- package/lib/user.d.ts +0 -3
- package/lib/user.js +0 -3
- package/lib/user.js.map +1 -1
- package/package.json +6 -3
package/lib/actions.d.ts
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import CoreClient from './core';
|
|
3
|
+
import ToolsClient from './tools';
|
|
4
|
+
import ConnectedAccountsClient from './connected-accounts';
|
|
5
|
+
import { CreateConnectedAccount, CreateConnectedAccountResponse, DeleteConnectedAccountResponse, GetConnectedAccountByIdentifierResponse, GetMagicLinkForConnectedAccountResponse, ListConnectedAccountsResponse, UpdateConnectedAccount, UpdateConnectedAccountResponse } from './pkg/grpc/scalekit/v1/connected_accounts/connected_accounts_pb';
|
|
6
|
+
import { ExecuteToolResponse } from './pkg/grpc/scalekit/v1/tools/tools_pb';
|
|
7
|
+
/**
|
|
8
|
+
* This class is intended to be accessed via `ScalekitClient.actions`.
|
|
9
|
+
* It composes the existing ToolsClient and ConnectedAccountsClient
|
|
10
|
+
* without changing their behavior.
|
|
11
|
+
*/
|
|
12
|
+
export default class ActionsClient {
|
|
13
|
+
private readonly tools;
|
|
14
|
+
private readonly connectedAccounts;
|
|
15
|
+
private readonly coreClient;
|
|
16
|
+
constructor(tools: ToolsClient, connectedAccounts: ConnectedAccountsClient, coreClient: CoreClient);
|
|
17
|
+
/**
|
|
18
|
+
* Execute a tool on behalf of a connected account.
|
|
19
|
+
*
|
|
20
|
+
* Thin wrapper around ToolsClient.executeTool, reserved for future
|
|
21
|
+
* pre/post modifier support.
|
|
22
|
+
*
|
|
23
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
24
|
+
* @throws {ScalekitException} If toolName is missing or an unexpected error occurs.
|
|
25
|
+
*/
|
|
26
|
+
executeTool(params: {
|
|
27
|
+
toolName: string;
|
|
28
|
+
toolInput: Record<string, unknown>;
|
|
29
|
+
identifier?: string;
|
|
30
|
+
connectedAccountId?: string;
|
|
31
|
+
connector?: string;
|
|
32
|
+
organizationId?: string;
|
|
33
|
+
userId?: string;
|
|
34
|
+
}): Promise<ExecuteToolResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* Get an authorization magic link for a connected account.
|
|
37
|
+
*
|
|
38
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
39
|
+
*/
|
|
40
|
+
getAuthorizationLink(params: {
|
|
41
|
+
connectionName?: string;
|
|
42
|
+
identifier?: string;
|
|
43
|
+
connectedAccountId?: string;
|
|
44
|
+
organizationId?: string;
|
|
45
|
+
userId?: string;
|
|
46
|
+
}): Promise<GetMagicLinkForConnectedAccountResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* List connected accounts with optional filters.
|
|
49
|
+
*
|
|
50
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
51
|
+
*/
|
|
52
|
+
listConnectedAccounts(params?: {
|
|
53
|
+
connectionName?: string;
|
|
54
|
+
identifier?: string;
|
|
55
|
+
provider?: string;
|
|
56
|
+
organizationId?: string;
|
|
57
|
+
userId?: string;
|
|
58
|
+
pageSize?: number;
|
|
59
|
+
pageToken?: string;
|
|
60
|
+
query?: string;
|
|
61
|
+
}): Promise<ListConnectedAccountsResponse>;
|
|
62
|
+
/**
|
|
63
|
+
* Delete a connected account.
|
|
64
|
+
* Requires either `connectedAccountId` or both `connectionName` + `identifier`.
|
|
65
|
+
*
|
|
66
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
67
|
+
* @throws {ScalekitException} If required parameters are missing.
|
|
68
|
+
*/
|
|
69
|
+
deleteConnectedAccount(params: {
|
|
70
|
+
connectionName?: string;
|
|
71
|
+
identifier?: string;
|
|
72
|
+
connectedAccountId?: string;
|
|
73
|
+
organizationId?: string;
|
|
74
|
+
userId?: string;
|
|
75
|
+
}): Promise<DeleteConnectedAccountResponse>;
|
|
76
|
+
/**
|
|
77
|
+
* Get connected account authorization details.
|
|
78
|
+
* Requires either `connectedAccountId` or both `connectionName` + `identifier`.
|
|
79
|
+
*
|
|
80
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
81
|
+
* @throws {ScalekitException} If required parameters are missing.
|
|
82
|
+
*/
|
|
83
|
+
getConnectedAccount(params: {
|
|
84
|
+
connectionName?: string;
|
|
85
|
+
identifier?: string;
|
|
86
|
+
connectedAccountId?: string;
|
|
87
|
+
organizationId?: string;
|
|
88
|
+
userId?: string;
|
|
89
|
+
}): Promise<GetConnectedAccountByIdentifierResponse>;
|
|
90
|
+
/**
|
|
91
|
+
* Create a new connected account.
|
|
92
|
+
*
|
|
93
|
+
* This helper accepts a high-level payload and builds the
|
|
94
|
+
* underlying CreateConnectedAccount message.
|
|
95
|
+
*
|
|
96
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
97
|
+
* @throws {ScalekitException} If connectionName or identifier is missing.
|
|
98
|
+
*/
|
|
99
|
+
createConnectedAccount(params: {
|
|
100
|
+
connectionName: string;
|
|
101
|
+
identifier: string;
|
|
102
|
+
authorizationDetails: CreateConnectedAccount['authorizationDetails'];
|
|
103
|
+
organizationId?: string;
|
|
104
|
+
userId?: string;
|
|
105
|
+
apiConfig?: Record<string, unknown>;
|
|
106
|
+
}): Promise<CreateConnectedAccountResponse>;
|
|
107
|
+
/**
|
|
108
|
+
* Get an existing connected account or create a new one if it doesn't exist.
|
|
109
|
+
*
|
|
110
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
111
|
+
* @throws {ScalekitException} If connectionName or identifier is missing.
|
|
112
|
+
*/
|
|
113
|
+
getOrCreateConnectedAccount(params: {
|
|
114
|
+
connectionName: string;
|
|
115
|
+
identifier: string;
|
|
116
|
+
authorizationDetails?: CreateConnectedAccount['authorizationDetails'];
|
|
117
|
+
organizationId?: string;
|
|
118
|
+
userId?: string;
|
|
119
|
+
apiConfig?: Record<string, unknown>;
|
|
120
|
+
}): Promise<CreateConnectedAccountResponse>;
|
|
121
|
+
/**
|
|
122
|
+
* Update an existing connected account.
|
|
123
|
+
* Requires either `connectedAccountId` or both `connectionName` + `identifier`.
|
|
124
|
+
*
|
|
125
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
126
|
+
* @throws {ScalekitException} If required parameters are missing.
|
|
127
|
+
*/
|
|
128
|
+
updateConnectedAccount(params: {
|
|
129
|
+
connectionName?: string;
|
|
130
|
+
identifier?: string;
|
|
131
|
+
authorizationDetails?: UpdateConnectedAccount['authorizationDetails'];
|
|
132
|
+
organizationId?: string;
|
|
133
|
+
userId?: string;
|
|
134
|
+
connectedAccountId?: string;
|
|
135
|
+
apiConfig?: UpdateConnectedAccount['apiConfig'];
|
|
136
|
+
}): Promise<UpdateConnectedAccountResponse>;
|
|
137
|
+
/**
|
|
138
|
+
* Make a proxied REST API call on behalf of a connected account.
|
|
139
|
+
*
|
|
140
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
141
|
+
* @throws {ScalekitException} If required parameters are missing or an unexpected error occurs.
|
|
142
|
+
*/
|
|
143
|
+
request(params: {
|
|
144
|
+
connectionName: string;
|
|
145
|
+
identifier: string;
|
|
146
|
+
path: string;
|
|
147
|
+
method?: string;
|
|
148
|
+
queryParams?: Record<string, unknown>;
|
|
149
|
+
body?: unknown;
|
|
150
|
+
formData?: Record<string, unknown>;
|
|
151
|
+
headers?: Record<string, string>;
|
|
152
|
+
timeoutMs?: number;
|
|
153
|
+
}): Promise<AxiosResponse<any>>;
|
|
154
|
+
}
|
package/lib/actions.js
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const protobuf_1 = require("@bufbuild/protobuf");
|
|
13
|
+
const axios_1 = require("axios");
|
|
14
|
+
const errors_1 = require("./errors");
|
|
15
|
+
const connected_accounts_pb_1 = require("./pkg/grpc/scalekit/v1/connected_accounts/connected_accounts_pb");
|
|
16
|
+
/**
|
|
17
|
+
* This class is intended to be accessed via `ScalekitClient.actions`.
|
|
18
|
+
* It composes the existing ToolsClient and ConnectedAccountsClient
|
|
19
|
+
* without changing their behavior.
|
|
20
|
+
*/
|
|
21
|
+
class ActionsClient {
|
|
22
|
+
constructor(tools, connectedAccounts, coreClient) {
|
|
23
|
+
this.tools = tools;
|
|
24
|
+
this.connectedAccounts = connectedAccounts;
|
|
25
|
+
this.coreClient = coreClient;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Execute a tool on behalf of a connected account.
|
|
29
|
+
*
|
|
30
|
+
* Thin wrapper around ToolsClient.executeTool, reserved for future
|
|
31
|
+
* pre/post modifier support.
|
|
32
|
+
*
|
|
33
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
34
|
+
* @throws {ScalekitException} If toolName is missing or an unexpected error occurs.
|
|
35
|
+
*/
|
|
36
|
+
executeTool(params) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const { toolName, toolInput, identifier, connectedAccountId, connector, organizationId, userId, } = params;
|
|
39
|
+
if (!(toolName === null || toolName === void 0 ? void 0 : toolName.trim())) {
|
|
40
|
+
throw new Error('toolName is required');
|
|
41
|
+
}
|
|
42
|
+
return this.tools.executeTool({
|
|
43
|
+
toolName,
|
|
44
|
+
identifier,
|
|
45
|
+
params: toolInput,
|
|
46
|
+
connectedAccountId,
|
|
47
|
+
connector,
|
|
48
|
+
organizationId,
|
|
49
|
+
userId,
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Get an authorization magic link for a connected account.
|
|
55
|
+
*
|
|
56
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
57
|
+
*/
|
|
58
|
+
getAuthorizationLink(params) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
const { connectionName, identifier, connectedAccountId, organizationId, userId, } = params;
|
|
61
|
+
return this.connectedAccounts.getMagicLinkForConnectedAccount({
|
|
62
|
+
connector: connectionName,
|
|
63
|
+
identifier,
|
|
64
|
+
organizationId,
|
|
65
|
+
userId,
|
|
66
|
+
connectedAccountId,
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* List connected accounts with optional filters.
|
|
72
|
+
*
|
|
73
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
74
|
+
*/
|
|
75
|
+
listConnectedAccounts(params) {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
return this.connectedAccounts.listConnectedAccounts({
|
|
78
|
+
organizationId: params === null || params === void 0 ? void 0 : params.organizationId,
|
|
79
|
+
userId: params === null || params === void 0 ? void 0 : params.userId,
|
|
80
|
+
connector: params === null || params === void 0 ? void 0 : params.connectionName,
|
|
81
|
+
identifier: params === null || params === void 0 ? void 0 : params.identifier,
|
|
82
|
+
provider: params === null || params === void 0 ? void 0 : params.provider,
|
|
83
|
+
pageSize: params === null || params === void 0 ? void 0 : params.pageSize,
|
|
84
|
+
pageToken: params === null || params === void 0 ? void 0 : params.pageToken,
|
|
85
|
+
query: params === null || params === void 0 ? void 0 : params.query,
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Delete a connected account.
|
|
91
|
+
* Requires either `connectedAccountId` or both `connectionName` + `identifier`.
|
|
92
|
+
*
|
|
93
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
94
|
+
* @throws {ScalekitException} If required parameters are missing.
|
|
95
|
+
*/
|
|
96
|
+
deleteConnectedAccount(params) {
|
|
97
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
const { connectionName, identifier, connectedAccountId, organizationId, userId, } = params;
|
|
99
|
+
const trimmedConnectionName = connectionName === null || connectionName === void 0 ? void 0 : connectionName.trim();
|
|
100
|
+
const trimmedIdentifier = identifier === null || identifier === void 0 ? void 0 : identifier.trim();
|
|
101
|
+
const trimmedConnectedAccountId = connectedAccountId === null || connectedAccountId === void 0 ? void 0 : connectedAccountId.trim();
|
|
102
|
+
if (!trimmedConnectedAccountId &&
|
|
103
|
+
!(trimmedConnectionName && trimmedIdentifier)) {
|
|
104
|
+
throw new Error('either connectedAccountId or connectionName + identifier is required');
|
|
105
|
+
}
|
|
106
|
+
return this.connectedAccounts.deleteConnectedAccount({
|
|
107
|
+
connector: trimmedConnectionName,
|
|
108
|
+
identifier: trimmedIdentifier,
|
|
109
|
+
organizationId,
|
|
110
|
+
userId,
|
|
111
|
+
connectedAccountId: trimmedConnectedAccountId,
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Get connected account authorization details.
|
|
117
|
+
* Requires either `connectedAccountId` or both `connectionName` + `identifier`.
|
|
118
|
+
*
|
|
119
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
120
|
+
* @throws {ScalekitException} If required parameters are missing.
|
|
121
|
+
*/
|
|
122
|
+
getConnectedAccount(params) {
|
|
123
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
+
const { connectionName, identifier, connectedAccountId, organizationId, userId, } = params;
|
|
125
|
+
const trimmedConnectionName = connectionName === null || connectionName === void 0 ? void 0 : connectionName.trim();
|
|
126
|
+
const trimmedIdentifier = identifier === null || identifier === void 0 ? void 0 : identifier.trim();
|
|
127
|
+
const trimmedConnectedAccountId = connectedAccountId === null || connectedAccountId === void 0 ? void 0 : connectedAccountId.trim();
|
|
128
|
+
if (!trimmedConnectedAccountId &&
|
|
129
|
+
!(trimmedConnectionName && trimmedIdentifier)) {
|
|
130
|
+
throw new Error('either connectedAccountId or connectionName + identifier is required');
|
|
131
|
+
}
|
|
132
|
+
return this.connectedAccounts.getConnectedAccountByIdentifier({
|
|
133
|
+
connector: trimmedConnectionName,
|
|
134
|
+
identifier: trimmedIdentifier,
|
|
135
|
+
organizationId,
|
|
136
|
+
userId,
|
|
137
|
+
connectedAccountId: trimmedConnectedAccountId,
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Create a new connected account.
|
|
143
|
+
*
|
|
144
|
+
* This helper accepts a high-level payload and builds the
|
|
145
|
+
* underlying CreateConnectedAccount message.
|
|
146
|
+
*
|
|
147
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
148
|
+
* @throws {ScalekitException} If connectionName or identifier is missing.
|
|
149
|
+
*/
|
|
150
|
+
createConnectedAccount(params) {
|
|
151
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
152
|
+
const { connectionName, identifier, authorizationDetails, organizationId, userId, apiConfig, } = params;
|
|
153
|
+
if (!(connectionName === null || connectionName === void 0 ? void 0 : connectionName.trim())) {
|
|
154
|
+
throw new Error('connectionName is required');
|
|
155
|
+
}
|
|
156
|
+
if (!(identifier === null || identifier === void 0 ? void 0 : identifier.trim())) {
|
|
157
|
+
throw new Error('identifier is required');
|
|
158
|
+
}
|
|
159
|
+
const connectedAccount = (0, protobuf_1.create)(connected_accounts_pb_1.CreateConnectedAccountSchema, Object.assign({ authorizationDetails }, (apiConfig != null && {
|
|
160
|
+
apiConfig: apiConfig,
|
|
161
|
+
})));
|
|
162
|
+
return this.connectedAccounts.createConnectedAccount({
|
|
163
|
+
connector: connectionName,
|
|
164
|
+
identifier,
|
|
165
|
+
connectedAccount,
|
|
166
|
+
organizationId,
|
|
167
|
+
userId,
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Get an existing connected account or create a new one if it doesn't exist.
|
|
173
|
+
*
|
|
174
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
175
|
+
* @throws {ScalekitException} If connectionName or identifier is missing.
|
|
176
|
+
*/
|
|
177
|
+
getOrCreateConnectedAccount(params) {
|
|
178
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
179
|
+
const { connectionName, identifier, authorizationDetails, organizationId, userId, apiConfig, } = params;
|
|
180
|
+
if (!(connectionName === null || connectionName === void 0 ? void 0 : connectionName.trim())) {
|
|
181
|
+
throw new Error('connectionName is required');
|
|
182
|
+
}
|
|
183
|
+
if (!(identifier === null || identifier === void 0 ? void 0 : identifier.trim())) {
|
|
184
|
+
throw new Error('identifier is required');
|
|
185
|
+
}
|
|
186
|
+
return this.connectedAccounts.getOrCreateConnectedAccount({
|
|
187
|
+
connector: connectionName.trim(),
|
|
188
|
+
identifier: identifier.trim(),
|
|
189
|
+
authorizationDetails,
|
|
190
|
+
organizationId,
|
|
191
|
+
userId,
|
|
192
|
+
apiConfig,
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Update an existing connected account.
|
|
198
|
+
* Requires either `connectedAccountId` or both `connectionName` + `identifier`.
|
|
199
|
+
*
|
|
200
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
201
|
+
* @throws {ScalekitException} If required parameters are missing.
|
|
202
|
+
*/
|
|
203
|
+
updateConnectedAccount(params) {
|
|
204
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
205
|
+
const { connectionName, identifier, authorizationDetails, organizationId, userId, connectedAccountId, apiConfig, } = params;
|
|
206
|
+
const trimmedConnectionName = connectionName === null || connectionName === void 0 ? void 0 : connectionName.trim();
|
|
207
|
+
const trimmedIdentifier = identifier === null || identifier === void 0 ? void 0 : identifier.trim();
|
|
208
|
+
const trimmedConnectedAccountId = connectedAccountId === null || connectedAccountId === void 0 ? void 0 : connectedAccountId.trim();
|
|
209
|
+
if (!trimmedConnectedAccountId &&
|
|
210
|
+
!(trimmedConnectionName && trimmedIdentifier)) {
|
|
211
|
+
throw new Error('either connectedAccountId or connectionName + identifier is required');
|
|
212
|
+
}
|
|
213
|
+
const connectedAccount = (0, protobuf_1.create)(connected_accounts_pb_1.UpdateConnectedAccountSchema, Object.assign(Object.assign({}, (authorizationDetails && { authorizationDetails })), (apiConfig != null && { apiConfig })));
|
|
214
|
+
return this.connectedAccounts.updateConnectedAccount({
|
|
215
|
+
connector: trimmedConnectionName,
|
|
216
|
+
identifier: trimmedIdentifier,
|
|
217
|
+
connectedAccount,
|
|
218
|
+
organizationId,
|
|
219
|
+
userId,
|
|
220
|
+
connectedAccountId: trimmedConnectedAccountId,
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Make a proxied REST API call on behalf of a connected account.
|
|
226
|
+
*
|
|
227
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
228
|
+
* @throws {ScalekitException} If required parameters are missing or an unexpected error occurs.
|
|
229
|
+
*/
|
|
230
|
+
request(params) {
|
|
231
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
232
|
+
const { connectionName, identifier, path, method = 'GET', queryParams, body, formData, headers, timeoutMs, } = params;
|
|
233
|
+
if (!(connectionName === null || connectionName === void 0 ? void 0 : connectionName.trim())) {
|
|
234
|
+
throw new Error('connectionName is required');
|
|
235
|
+
}
|
|
236
|
+
if (!(identifier === null || identifier === void 0 ? void 0 : identifier.trim())) {
|
|
237
|
+
throw new Error('identifier is required');
|
|
238
|
+
}
|
|
239
|
+
if (!(path === null || path === void 0 ? void 0 : path.trim())) {
|
|
240
|
+
throw new Error('path is required');
|
|
241
|
+
}
|
|
242
|
+
const normalizedPath = path.startsWith('/') ? path : `/${path}`;
|
|
243
|
+
const url = `${this.coreClient.envUrl.replace(/\/$/, '')}/proxy${normalizedPath}`;
|
|
244
|
+
const timeout = timeoutMs !== null && timeoutMs !== void 0 ? timeoutMs : 30000;
|
|
245
|
+
const proxyHeaders = Object.assign(Object.assign({}, (headers !== null && headers !== void 0 ? headers : {})), { connection_name: connectionName, identifier });
|
|
246
|
+
try {
|
|
247
|
+
return yield this.coreClient.axios.request({
|
|
248
|
+
url,
|
|
249
|
+
method: method.toUpperCase(),
|
|
250
|
+
params: queryParams,
|
|
251
|
+
data: body !== null && body !== void 0 ? body : formData,
|
|
252
|
+
headers: proxyHeaders,
|
|
253
|
+
timeout,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
catch (error) {
|
|
257
|
+
if (error instanceof errors_1.ScalekitException)
|
|
258
|
+
throw error;
|
|
259
|
+
if (error instanceof axios_1.AxiosError) {
|
|
260
|
+
if (error.response)
|
|
261
|
+
throw errors_1.ScalekitServerException.promote(error.response);
|
|
262
|
+
throw new errors_1.ScalekitException(error);
|
|
263
|
+
}
|
|
264
|
+
throw new errors_1.ScalekitException(error);
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
exports.default = ActionsClient;
|
|
270
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iDAA4C;AAC5C,iCAAkD;AAElD,qCAAsE;AAGtE,2GAWyE;AAGzE;;;;GAIG;AACH,MAAqB,aAAa;IAChC,YACmB,KAAkB,EAClB,iBAA0C,EAC1C,UAAsB;QAFtB,UAAK,GAAL,KAAK,CAAa;QAClB,sBAAiB,GAAjB,iBAAiB,CAAyB;QAC1C,eAAU,GAAV,UAAU,CAAY;IACtC,CAAC;IAEJ;;;;;;;;OAQG;IACG,WAAW,CAAC,MAQjB;;YACC,MAAM,EACJ,QAAQ,EACR,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,MAAM,GACP,GAAG,MAAM,CAAC;YAEX,IAAI,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,EAAE,CAAA,EAAE,CAAC;gBACtB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;YAC1C,CAAC;YAED,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;gBAC5B,QAAQ;gBACR,UAAU;gBACV,MAAM,EAAE,SAAS;gBACjB,kBAAkB;gBAClB,SAAS;gBACT,cAAc;gBACd,MAAM;aACP,CAAC,CAAC;QACL,CAAC;KAAA;IAED;;;;OAIG;IACG,oBAAoB,CAAC,MAM1B;;YACC,MAAM,EACJ,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,MAAM,GACP,GAAG,MAAM,CAAC;YAEX,OAAO,IAAI,CAAC,iBAAiB,CAAC,+BAA+B,CAAC;gBAC5D,SAAS,EAAE,cAAc;gBACzB,UAAU;gBACV,cAAc;gBACd,MAAM;gBACN,kBAAkB;aACnB,CAAC,CAAC;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AuB,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;oBACxD,MAAM,IAAI,0BAAiB,CAAC,KAAK,CAAC,CAAC;gBACrC,CAAC;gBACD,MAAM,IAAI,0BAAiB,CAAC,KAAK,CAAC,CAAC;YACrC,CAAC;QACH,CAAC;KAAA;CACF;AArZD,gCAqZC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { type MessageInitShape } from '@bufbuild/protobuf';
|
|
2
|
+
import GrpcConnect from './connect';
|
|
3
|
+
import CoreClient from './core';
|
|
4
|
+
import { AuthorizationDetailsSchema, CreateConnectedAccount, CreateConnectedAccountResponse, DeleteConnectedAccountResponse, GetConnectedAccountByIdentifierResponse, GetMagicLinkForConnectedAccountResponse, ListConnectedAccountsResponse, UpdateConnectedAccount, UpdateConnectedAccountResponse } from './pkg/grpc/scalekit/v1/connected_accounts/connected_accounts_pb';
|
|
5
|
+
/**
|
|
6
|
+
* Client for managing connected accounts for third-party integrations.
|
|
7
|
+
*
|
|
8
|
+
* This mirrors the Python SDK `ConnectedAccountsClient` and exposes a typed,
|
|
9
|
+
* ergonomic API around the `ConnectedAccountService` to:
|
|
10
|
+
* - list connected accounts
|
|
11
|
+
* - create/update/delete connected accounts
|
|
12
|
+
* - generate magic links for authorization
|
|
13
|
+
* - fetch full authentication details for a connected account
|
|
14
|
+
*/
|
|
15
|
+
export default class ConnectedAccountsClient {
|
|
16
|
+
private readonly grpcConnect;
|
|
17
|
+
private readonly coreClient;
|
|
18
|
+
private client;
|
|
19
|
+
constructor(grpcConnect: GrpcConnect, coreClient: CoreClient);
|
|
20
|
+
/**
|
|
21
|
+
* Lists connected accounts with optional filters and pagination.
|
|
22
|
+
*
|
|
23
|
+
* @param options Optional filtering and pagination parameters
|
|
24
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
25
|
+
*/
|
|
26
|
+
listConnectedAccounts(options?: {
|
|
27
|
+
organizationId?: string;
|
|
28
|
+
userId?: string;
|
|
29
|
+
connector?: string;
|
|
30
|
+
identifier?: string;
|
|
31
|
+
provider?: string;
|
|
32
|
+
pageSize?: number;
|
|
33
|
+
pageToken?: string;
|
|
34
|
+
query?: string;
|
|
35
|
+
}): Promise<ListConnectedAccountsResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* Creates a new connected account.
|
|
38
|
+
*
|
|
39
|
+
* @param params Connected account creation parameters
|
|
40
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
41
|
+
*/
|
|
42
|
+
createConnectedAccount(params: {
|
|
43
|
+
connector: string;
|
|
44
|
+
identifier: string;
|
|
45
|
+
connectedAccount: CreateConnectedAccount;
|
|
46
|
+
organizationId?: string;
|
|
47
|
+
userId?: string;
|
|
48
|
+
}): Promise<CreateConnectedAccountResponse>;
|
|
49
|
+
/**
|
|
50
|
+
* Gets an existing connected account by connector and identifier, or creates one if none exists.
|
|
51
|
+
* Mirrors the Python SDK `get_or_create_connected_account`. When creating, the backend may require
|
|
52
|
+
* valid authorization details; if omitted, a minimal payload is sent and the server may return
|
|
53
|
+
* a validation error.
|
|
54
|
+
*
|
|
55
|
+
* @param params Get-or-create parameters
|
|
56
|
+
* @param params.connector Connector identifier (required)
|
|
57
|
+
* @param params.identifier Connected account identifier (required)
|
|
58
|
+
* @param params.authorizationDetails Optional auth details for the create path (OAuth token or static auth)
|
|
59
|
+
* @param params.organizationId Optional organization ID
|
|
60
|
+
* @param params.userId Optional user ID
|
|
61
|
+
* @param params.apiConfig Optional API config for the create path
|
|
62
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
63
|
+
* @throws {ScalekitException} If connector or identifier is missing.
|
|
64
|
+
*/
|
|
65
|
+
getOrCreateConnectedAccount(params: {
|
|
66
|
+
connector: string;
|
|
67
|
+
identifier: string;
|
|
68
|
+
authorizationDetails?: MessageInitShape<typeof AuthorizationDetailsSchema>;
|
|
69
|
+
organizationId?: string;
|
|
70
|
+
userId?: string;
|
|
71
|
+
apiConfig?: Record<string, unknown>;
|
|
72
|
+
}): Promise<CreateConnectedAccountResponse>;
|
|
73
|
+
/**
|
|
74
|
+
* Updates an existing connected account.
|
|
75
|
+
*
|
|
76
|
+
* You can target the account either by `connectedAccountId` alone, or by the
|
|
77
|
+
* combination of `connector` and `identifier`.
|
|
78
|
+
*
|
|
79
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
80
|
+
* @throws {ScalekitException} If required parameters are missing.
|
|
81
|
+
*/
|
|
82
|
+
updateConnectedAccount(params: {
|
|
83
|
+
connector?: string;
|
|
84
|
+
identifier?: string;
|
|
85
|
+
connectedAccount: UpdateConnectedAccount;
|
|
86
|
+
organizationId?: string;
|
|
87
|
+
userId?: string;
|
|
88
|
+
connectedAccountId?: string;
|
|
89
|
+
}): Promise<UpdateConnectedAccountResponse>;
|
|
90
|
+
/**
|
|
91
|
+
* Deletes a connected account and revokes its credentials.
|
|
92
|
+
*
|
|
93
|
+
* You can target the account either by `connectedAccountId` alone, or by the
|
|
94
|
+
* combination of `connector` and `identifier`.
|
|
95
|
+
*
|
|
96
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
97
|
+
* @throws {ScalekitException} If required parameters are missing.
|
|
98
|
+
*/
|
|
99
|
+
deleteConnectedAccount(params: {
|
|
100
|
+
connector?: string;
|
|
101
|
+
identifier?: string;
|
|
102
|
+
organizationId?: string;
|
|
103
|
+
userId?: string;
|
|
104
|
+
connectedAccountId?: string;
|
|
105
|
+
}): Promise<DeleteConnectedAccountResponse>;
|
|
106
|
+
/**
|
|
107
|
+
* Generates a time-limited magic link for connecting or re-authorizing a third-party account.
|
|
108
|
+
*
|
|
109
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
110
|
+
*/
|
|
111
|
+
getMagicLinkForConnectedAccount(params: {
|
|
112
|
+
connector?: string;
|
|
113
|
+
identifier?: string;
|
|
114
|
+
organizationId?: string;
|
|
115
|
+
userId?: string;
|
|
116
|
+
connectedAccountId?: string;
|
|
117
|
+
}): Promise<GetMagicLinkForConnectedAccountResponse>;
|
|
118
|
+
/**
|
|
119
|
+
* Retrieves complete authentication details for a connected account.
|
|
120
|
+
*
|
|
121
|
+
* This method returns sensitive credential information, so ensure you protect access
|
|
122
|
+
* to this in your application.
|
|
123
|
+
*
|
|
124
|
+
* @throws {ScalekitServerException} If a network or server error occurs.
|
|
125
|
+
* @throws {ScalekitNotFoundException} If no matching connected account is found.
|
|
126
|
+
*/
|
|
127
|
+
getConnectedAccountByIdentifier(params: {
|
|
128
|
+
connector?: string;
|
|
129
|
+
identifier?: string;
|
|
130
|
+
organizationId?: string;
|
|
131
|
+
userId?: string;
|
|
132
|
+
connectedAccountId?: string;
|
|
133
|
+
}): Promise<GetConnectedAccountByIdentifierResponse>;
|
|
134
|
+
}
|