@scalekit-sdk/node 2.2.0-beta.1 → 2.2.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 (209) hide show
  1. package/.nvmrc +1 -1
  2. package/README.md +5 -5
  3. package/buf.gen.yaml +1 -5
  4. package/lib/auth.d.ts +9 -6
  5. package/lib/auth.js +4 -20
  6. package/lib/auth.js.map +1 -1
  7. package/lib/connect.d.ts +3 -3
  8. package/lib/connect.js +1 -2
  9. package/lib/connect.js.map +1 -1
  10. package/lib/connection.d.ts +2 -2
  11. package/lib/connection.js +4 -4
  12. package/lib/connection.js.map +1 -1
  13. package/lib/core.js +2 -2
  14. package/lib/core.js.map +1 -1
  15. package/lib/directory.d.ts +2 -2
  16. package/lib/directory.js +7 -7
  17. package/lib/directory.js.map +1 -1
  18. package/lib/domain.d.ts +6 -5
  19. package/lib/domain.js +4 -5
  20. package/lib/domain.js.map +1 -1
  21. package/lib/errors/base-exception.d.ts +1 -1
  22. package/lib/errors/base-exception.js +1 -1
  23. package/lib/errors/base-exception.js.map +1 -1
  24. package/lib/organization.d.ts +10 -9
  25. package/lib/organization.js +11 -9
  26. package/lib/organization.js.map +1 -1
  27. package/lib/passwordless.d.ts +2 -2
  28. package/lib/passwordless.js +8 -7
  29. package/lib/passwordless.js.map +1 -1
  30. package/lib/permission.d.ts +6 -5
  31. package/lib/permission.js +10 -11
  32. package/lib/permission.js.map +1 -1
  33. package/lib/pkg/grpc/buf/validate/validate_pb.d.ts +7 -0
  34. package/lib/pkg/grpc/buf/validate/validate_pb.js +25 -0
  35. package/lib/pkg/grpc/buf/validate/validate_pb.js.map +1 -0
  36. package/lib/pkg/grpc/google/api/annotations_pb.d.ts +7 -0
  37. package/lib/pkg/grpc/google/api/annotations_pb.js +25 -0
  38. package/lib/pkg/grpc/google/api/annotations_pb.js.map +1 -0
  39. package/lib/pkg/grpc/google/api/field_behavior_pb.d.ts +7 -0
  40. package/lib/pkg/grpc/google/api/field_behavior_pb.js +25 -0
  41. package/lib/pkg/grpc/google/api/field_behavior_pb.js.map +1 -0
  42. package/lib/pkg/grpc/google/api/visibility_pb.d.ts +7 -0
  43. package/lib/pkg/grpc/google/api/visibility_pb.js +25 -0
  44. package/lib/pkg/grpc/google/api/visibility_pb.js.map +1 -0
  45. package/lib/pkg/grpc/protoc-gen-openapiv2/options/annotations_pb.d.ts +7 -0
  46. package/lib/pkg/grpc/protoc-gen-openapiv2/options/annotations_pb.js +25 -0
  47. package/lib/pkg/grpc/protoc-gen-openapiv2/options/annotations_pb.js.map +1 -0
  48. package/lib/pkg/grpc/scalekit/v1/auditlogs/auditlogs_pb.d.ts +48 -42
  49. package/lib/pkg/grpc/scalekit/v1/auditlogs/auditlogs_pb.js +27 -263
  50. package/lib/pkg/grpc/scalekit/v1/auditlogs/auditlogs_pb.js.map +1 -1
  51. package/lib/pkg/grpc/scalekit/v1/auth/auth_pb.d.ts +371 -325
  52. package/lib/pkg/grpc/scalekit/v1/auth/auth_pb.js +132 -835
  53. package/lib/pkg/grpc/scalekit/v1/auth/auth_pb.js.map +1 -1
  54. package/lib/pkg/grpc/scalekit/v1/auth/passwordless_pb.d.ts +113 -87
  55. package/lib/pkg/grpc/scalekit/v1/auth/passwordless_pb.js +45 -201
  56. package/lib/pkg/grpc/scalekit/v1/auth/passwordless_pb.js.map +1 -1
  57. package/lib/pkg/grpc/scalekit/v1/auth/webauthn_pb.d.ts +262 -265
  58. package/lib/pkg/grpc/scalekit/v1/auth/webauthn_pb.js +92 -938
  59. package/lib/pkg/grpc/scalekit/v1/auth/webauthn_pb.js.map +1 -1
  60. package/lib/pkg/grpc/scalekit/v1/commons/commons_pb.d.ts +162 -157
  61. package/lib/pkg/grpc/scalekit/v1/commons/commons_pb.js +42 -313
  62. package/lib/pkg/grpc/scalekit/v1/commons/commons_pb.js.map +1 -1
  63. package/lib/pkg/grpc/scalekit/v1/connections/connections_pb.d.ts +1488 -1459
  64. package/lib/pkg/grpc/scalekit/v1/connections/connections_pb.js +353 -2362
  65. package/lib/pkg/grpc/scalekit/v1/connections/connections_pb.js.map +1 -1
  66. package/lib/pkg/grpc/scalekit/v1/directories/directories_pb.d.ts +520 -483
  67. package/lib/pkg/grpc/scalekit/v1/directories/directories_pb.js +224 -1555
  68. package/lib/pkg/grpc/scalekit/v1/directories/directories_pb.js.map +1 -1
  69. package/lib/pkg/grpc/scalekit/v1/domains/domains_pb.d.ts +219 -191
  70. package/lib/pkg/grpc/scalekit/v1/domains/domains_pb.js +96 -553
  71. package/lib/pkg/grpc/scalekit/v1/domains/domains_pb.js.map +1 -1
  72. package/lib/pkg/grpc/scalekit/v1/errdetails/errdetails_pb.d.ts +76 -102
  73. package/lib/pkg/grpc/scalekit/v1/errdetails/errdetails_pb.js +37 -393
  74. package/lib/pkg/grpc/scalekit/v1/errdetails/errdetails_pb.js.map +1 -1
  75. package/lib/pkg/grpc/scalekit/v1/options/options_pb.d.ts +36 -26
  76. package/lib/pkg/grpc/scalekit/v1/options/options_pb.js +20 -69
  77. package/lib/pkg/grpc/scalekit/v1/options/options_pb.js.map +1 -1
  78. package/lib/pkg/grpc/scalekit/v1/organizations/organizations_pb.d.ts +447 -400
  79. package/lib/pkg/grpc/scalekit/v1/organizations/organizations_pb.js +163 -1238
  80. package/lib/pkg/grpc/scalekit/v1/organizations/organizations_pb.js.map +1 -1
  81. package/lib/pkg/grpc/scalekit/v1/roles/roles_pb.d.ts +622 -556
  82. package/lib/pkg/grpc/scalekit/v1/roles/roles_pb.js +201 -1718
  83. package/lib/pkg/grpc/scalekit/v1/roles/roles_pb.js.map +1 -1
  84. package/lib/pkg/grpc/scalekit/v1/sessions/sessions_pb.d.ts +135 -132
  85. package/lib/pkg/grpc/scalekit/v1/sessions/sessions_pb.js +55 -518
  86. package/lib/pkg/grpc/scalekit/v1/sessions/sessions_pb.js.map +1 -1
  87. package/lib/pkg/grpc/scalekit/v1/users/users_pb.d.ts +445 -413
  88. package/lib/pkg/grpc/scalekit/v1/users/users_pb.js +142 -1490
  89. package/lib/pkg/grpc/scalekit/v1/users/users_pb.js.map +1 -1
  90. package/lib/role.d.ts +8 -7
  91. package/lib/role.js +14 -14
  92. package/lib/role.js.map +1 -1
  93. package/lib/scalekit.d.ts +0 -4
  94. package/lib/scalekit.js +0 -4
  95. package/lib/scalekit.js.map +1 -1
  96. package/lib/session.js +15 -24
  97. package/lib/session.js.map +1 -1
  98. package/lib/user.d.ts +6 -5
  99. package/lib/user.js +17 -20
  100. package/lib/user.js.map +1 -1
  101. package/lib/webauthn.js +6 -5
  102. package/lib/webauthn.js.map +1 -1
  103. package/package.json +6 -10
  104. package/reference.md +0 -671
  105. package/src/auth.ts +17 -17
  106. package/src/connect.ts +4 -5
  107. package/src/connection.ts +5 -5
  108. package/src/core.ts +2 -2
  109. package/src/directory.ts +8 -8
  110. package/src/domain.ts +9 -8
  111. package/src/errors/base-exception.ts +3 -2
  112. package/src/organization.ts +18 -15
  113. package/src/passwordless.ts +12 -11
  114. package/src/permission.ts +15 -15
  115. package/src/pkg/grpc/buf/validate/validate_pb.ts +28 -0
  116. package/src/pkg/grpc/google/api/annotations_pb.ts +28 -0
  117. package/src/pkg/grpc/google/api/field_behavior_pb.ts +28 -0
  118. package/src/pkg/grpc/google/api/visibility_pb.ts +28 -0
  119. package/src/pkg/grpc/protoc-gen-openapiv2/options/annotations_pb.ts +28 -0
  120. package/src/pkg/grpc/scalekit/v1/auditlogs/auditlogs_pb.ts +97 -182
  121. package/src/pkg/grpc/scalekit/v1/auth/auth_pb.ts +473 -850
  122. package/src/pkg/grpc/scalekit/v1/auth/passwordless_pb.ts +153 -225
  123. package/src/pkg/grpc/scalekit/v1/auth/webauthn_pb.ts +361 -830
  124. package/src/pkg/grpc/scalekit/v1/commons/commons_pb.ts +237 -358
  125. package/src/pkg/grpc/scalekit/v1/connections/connections_pb.ts +1625 -2826
  126. package/src/pkg/grpc/scalekit/v1/directories/directories_pb.ts +687 -1413
  127. package/src/pkg/grpc/scalekit/v1/domains/domains_pb.ts +286 -542
  128. package/src/pkg/grpc/scalekit/v1/errdetails/errdetails_pb.ts +115 -328
  129. package/src/pkg/grpc/scalekit/v1/options/options_pb.ts +50 -80
  130. package/src/pkg/grpc/scalekit/v1/organizations/organizations_pb.ts +558 -1183
  131. package/src/pkg/grpc/scalekit/v1/roles/roles_pb.ts +765 -1669
  132. package/src/pkg/grpc/scalekit/v1/sessions/sessions_pb.ts +195 -447
  133. package/src/pkg/grpc/scalekit/v1/users/users_pb.ts +592 -1339
  134. package/src/role.ts +21 -19
  135. package/src/scalekit.ts +0 -9
  136. package/src/session.ts +20 -34
  137. package/src/user.ts +30 -26
  138. package/src/webauthn.ts +10 -9
  139. package/tests/utils/test-data.ts +17 -8
  140. package/lib/connected-accounts.d.ts +0 -119
  141. package/lib/connected-accounts.js +0 -241
  142. package/lib/connected-accounts.js.map +0 -1
  143. package/lib/pkg/grpc/scalekit/v1/auditlogs/auditlogs_connect.d.ts +0 -19
  144. package/lib/pkg/grpc/scalekit/v1/auditlogs/auditlogs_connect.js +0 -27
  145. package/lib/pkg/grpc/scalekit/v1/auditlogs/auditlogs_connect.js.map +0 -1
  146. package/lib/pkg/grpc/scalekit/v1/auth/auth_connect.d.ts +0 -118
  147. package/lib/pkg/grpc/scalekit/v1/auth/auth_connect.js +0 -126
  148. package/lib/pkg/grpc/scalekit/v1/auth/auth_connect.js.map +0 -1
  149. package/lib/pkg/grpc/scalekit/v1/auth/passwordless_connect.d.ts +0 -37
  150. package/lib/pkg/grpc/scalekit/v1/auth/passwordless_connect.js +0 -45
  151. package/lib/pkg/grpc/scalekit/v1/auth/passwordless_connect.js.map +0 -1
  152. package/lib/pkg/grpc/scalekit/v1/auth/webauthn_connect.d.ts +0 -82
  153. package/lib/pkg/grpc/scalekit/v1/auth/webauthn_connect.js +0 -90
  154. package/lib/pkg/grpc/scalekit/v1/auth/webauthn_connect.js.map +0 -1
  155. package/lib/pkg/grpc/scalekit/v1/connected_accounts/connected_accounts_connect.d.ts +0 -87
  156. package/lib/pkg/grpc/scalekit/v1/connected_accounts/connected_accounts_connect.js +0 -95
  157. package/lib/pkg/grpc/scalekit/v1/connected_accounts/connected_accounts_connect.js.map +0 -1
  158. package/lib/pkg/grpc/scalekit/v1/connected_accounts/connected_accounts_pb.d.ts +0 -718
  159. package/lib/pkg/grpc/scalekit/v1/connected_accounts/connected_accounts_pb.js +0 -893
  160. package/lib/pkg/grpc/scalekit/v1/connected_accounts/connected_accounts_pb.js.map +0 -1
  161. package/lib/pkg/grpc/scalekit/v1/connections/connections_connect.d.ts +0 -172
  162. package/lib/pkg/grpc/scalekit/v1/connections/connections_connect.js +0 -180
  163. package/lib/pkg/grpc/scalekit/v1/connections/connections_connect.js.map +0 -1
  164. package/lib/pkg/grpc/scalekit/v1/directories/directories_connect.d.ts +0 -154
  165. package/lib/pkg/grpc/scalekit/v1/directories/directories_connect.js +0 -162
  166. package/lib/pkg/grpc/scalekit/v1/directories/directories_connect.js.map +0 -1
  167. package/lib/pkg/grpc/scalekit/v1/domains/domains_connect.d.ts +0 -73
  168. package/lib/pkg/grpc/scalekit/v1/domains/domains_connect.js +0 -81
  169. package/lib/pkg/grpc/scalekit/v1/domains/domains_connect.js.map +0 -1
  170. package/lib/pkg/grpc/scalekit/v1/organizations/organizations_connect.d.ts +0 -171
  171. package/lib/pkg/grpc/scalekit/v1/organizations/organizations_connect.js +0 -179
  172. package/lib/pkg/grpc/scalekit/v1/organizations/organizations_connect.js.map +0 -1
  173. package/lib/pkg/grpc/scalekit/v1/roles/roles_connect.d.ts +0 -250
  174. package/lib/pkg/grpc/scalekit/v1/roles/roles_connect.js +0 -258
  175. package/lib/pkg/grpc/scalekit/v1/roles/roles_connect.js.map +0 -1
  176. package/lib/pkg/grpc/scalekit/v1/sessions/sessions_connect.d.ts +0 -46
  177. package/lib/pkg/grpc/scalekit/v1/sessions/sessions_connect.js +0 -54
  178. package/lib/pkg/grpc/scalekit/v1/sessions/sessions_connect.js.map +0 -1
  179. package/lib/pkg/grpc/scalekit/v1/tools/tools_connect.d.ts +0 -75
  180. package/lib/pkg/grpc/scalekit/v1/tools/tools_connect.js +0 -83
  181. package/lib/pkg/grpc/scalekit/v1/tools/tools_connect.js.map +0 -1
  182. package/lib/pkg/grpc/scalekit/v1/tools/tools_pb.d.ts +0 -431
  183. package/lib/pkg/grpc/scalekit/v1/tools/tools_pb.js +0 -627
  184. package/lib/pkg/grpc/scalekit/v1/tools/tools_pb.js.map +0 -1
  185. package/lib/pkg/grpc/scalekit/v1/users/users_connect.d.ts +0 -173
  186. package/lib/pkg/grpc/scalekit/v1/users/users_connect.js +0 -181
  187. package/lib/pkg/grpc/scalekit/v1/users/users_connect.js.map +0 -1
  188. package/lib/tools.d.ts +0 -75
  189. package/lib/tools.js +0 -127
  190. package/lib/tools.js.map +0 -1
  191. package/src/connected-accounts.ts +0 -358
  192. package/src/pkg/grpc/scalekit/v1/auditlogs/auditlogs_connect.ts +0 -26
  193. package/src/pkg/grpc/scalekit/v1/auth/auth_connect.ts +0 -125
  194. package/src/pkg/grpc/scalekit/v1/auth/passwordless_connect.ts +0 -44
  195. package/src/pkg/grpc/scalekit/v1/auth/webauthn_connect.ts +0 -89
  196. package/src/pkg/grpc/scalekit/v1/connected_accounts/connected_accounts_connect.ts +0 -94
  197. package/src/pkg/grpc/scalekit/v1/connected_accounts/connected_accounts_pb.ts +0 -1294
  198. package/src/pkg/grpc/scalekit/v1/connections/connections_connect.ts +0 -179
  199. package/src/pkg/grpc/scalekit/v1/directories/directories_connect.ts +0 -161
  200. package/src/pkg/grpc/scalekit/v1/domains/domains_connect.ts +0 -80
  201. package/src/pkg/grpc/scalekit/v1/organizations/organizations_connect.ts +0 -178
  202. package/src/pkg/grpc/scalekit/v1/roles/roles_connect.ts +0 -257
  203. package/src/pkg/grpc/scalekit/v1/sessions/sessions_connect.ts +0 -53
  204. package/src/pkg/grpc/scalekit/v1/tools/tools_connect.ts +0 -82
  205. package/src/pkg/grpc/scalekit/v1/tools/tools_pb.ts +0 -847
  206. package/src/pkg/grpc/scalekit/v1/users/users_connect.ts +0 -180
  207. package/src/tools.ts +0 -166
  208. package/tests/connected-accounts.test.ts +0 -472
  209. package/tests/tools.test.ts +0 -239
@@ -1,358 +0,0 @@
1
- import { PartialMessage } from "@bufbuild/protobuf";
2
- import { PromiseClient } from "@connectrpc/connect";
3
- import GrpcConnect from "./connect";
4
- import CoreClient from "./core";
5
- import { ScalekitNotFoundException } from "./errors";
6
- import { ConnectedAccountService } from "./pkg/grpc/scalekit/v1/connected_accounts/connected_accounts_connect";
7
- import {
8
- AuthorizationDetails,
9
- CreateConnectedAccount,
10
- CreateConnectedAccountRequest,
11
- CreateConnectedAccountResponse,
12
- DeleteConnectedAccountRequest,
13
- DeleteConnectedAccountResponse,
14
- GetConnectedAccountByIdentifierRequest,
15
- GetConnectedAccountByIdentifierResponse,
16
- GetMagicLinkForConnectedAccountRequest,
17
- GetMagicLinkForConnectedAccountResponse,
18
- ListConnectedAccountsRequest,
19
- ListConnectedAccountsResponse,
20
- OauthToken,
21
- UpdateConnectedAccount,
22
- UpdateConnectedAccountRequest,
23
- UpdateConnectedAccountResponse,
24
- } from "./pkg/grpc/scalekit/v1/connected_accounts/connected_accounts_pb";
25
-
26
- /**
27
- * Client for managing connected accounts for third-party integrations.
28
- *
29
- * This mirrors the Python SDK `ConnectedAccountsClient` and exposes a typed,
30
- * ergonomic API around the `ConnectedAccountService` to:
31
- * - list connected accounts
32
- * - create/update/delete connected accounts
33
- * - generate magic links for authorization
34
- * - fetch full authentication details for a connected account
35
- */
36
- export default class ConnectedAccountsClient {
37
- private client: PromiseClient<typeof ConnectedAccountService>;
38
-
39
- constructor(
40
- private readonly grpcConnect: GrpcConnect,
41
- private readonly coreClient: CoreClient
42
- ) {
43
- this.client = this.grpcConnect.createClient(ConnectedAccountService);
44
- }
45
-
46
- /**
47
- * Lists connected accounts with optional filters and pagination.
48
- *
49
- * @param options Optional filtering and pagination parameters
50
- */
51
- async listConnectedAccounts(options?: {
52
- organizationId?: string;
53
- userId?: string;
54
- connector?: string;
55
- identifier?: string;
56
- provider?: string;
57
- pageSize?: number;
58
- pageToken?: string;
59
- query?: string;
60
- }): Promise<ListConnectedAccountsResponse> {
61
- const request: PartialMessage<ListConnectedAccountsRequest> = {};
62
-
63
- if (options?.organizationId) {
64
- request.organizationId = options.organizationId;
65
- }
66
- if (options?.userId) {
67
- request.userId = options.userId;
68
- }
69
- if (options?.connector) {
70
- request.connector = options.connector;
71
- }
72
- if (options?.identifier) {
73
- request.identifier = options.identifier;
74
- }
75
- if (options?.provider) {
76
- request.provider = options.provider;
77
- }
78
- if (options?.pageSize !== undefined) {
79
- request.pageSize = options.pageSize;
80
- }
81
- if (options?.pageToken) {
82
- request.pageToken = options.pageToken;
83
- }
84
- if (options?.query) {
85
- request.query = options.query;
86
- }
87
-
88
- return this.coreClient.connectExec(
89
- this.client.listConnectedAccounts,
90
- request
91
- );
92
- }
93
-
94
- /**
95
- * Creates a new connected account.
96
- *
97
- * @param params Connected account creation parameters
98
- */
99
- async createConnectedAccount(params: {
100
- connector: string;
101
- identifier: string;
102
- connectedAccount: CreateConnectedAccount;
103
- organizationId?: string;
104
- userId?: string;
105
- }): Promise<CreateConnectedAccountResponse> {
106
- const {
107
- connector,
108
- identifier,
109
- connectedAccount,
110
- organizationId,
111
- userId,
112
- } = params;
113
-
114
- const request: PartialMessage<CreateConnectedAccountRequest> = {
115
- connector,
116
- identifier,
117
- connectedAccount,
118
- };
119
-
120
- if (organizationId) {
121
- request.organizationId = organizationId;
122
- }
123
- if (userId) {
124
- request.userId = userId;
125
- }
126
-
127
- return this.coreClient.connectExec(
128
- this.client.createConnectedAccount,
129
- request
130
- );
131
- }
132
-
133
- /**
134
- * Gets an existing connected account by connector and identifier, or creates one if none exists.
135
- * Mirrors the Python SDK `get_or_create_connected_account`. When creating, the backend may require
136
- * valid authorization details; if omitted, a minimal payload is sent and the server may return
137
- * a validation error.
138
- *
139
- * @param params Get-or-create parameters
140
- * @param params.connector Connector identifier (required)
141
- * @param params.identifier Connected account identifier (required)
142
- * @param params.authorizationDetails Optional auth details for the create path (OAuth token or static auth)
143
- * @param params.organizationId Optional organization ID
144
- * @param params.userId Optional user ID
145
- * @param params.apiConfig Optional API config for the create path
146
- */
147
- async getOrCreateConnectedAccount(params: {
148
- connector: string;
149
- identifier: string;
150
- authorizationDetails?: PartialMessage<AuthorizationDetails>;
151
- organizationId?: string;
152
- userId?: string;
153
- apiConfig?: Record<string, unknown>;
154
- }): Promise<CreateConnectedAccountResponse> {
155
- const {
156
- connector,
157
- identifier,
158
- authorizationDetails,
159
- organizationId,
160
- userId,
161
- apiConfig,
162
- } = params;
163
-
164
- if (!connector?.trim()) {
165
- throw new Error("connector is required");
166
- }
167
- if (!identifier?.trim()) {
168
- throw new Error("identifier is required");
169
- }
170
-
171
- try {
172
- const getResponse = await this.getConnectedAccountByIdentifier({
173
- connector,
174
- identifier,
175
- organizationId,
176
- userId,
177
- });
178
- return new CreateConnectedAccountResponse({
179
- connectedAccount: getResponse.connectedAccount,
180
- });
181
- } catch (err) {
182
- if (!(err instanceof ScalekitNotFoundException)) {
183
- throw err;
184
- }
185
- }
186
-
187
- const connectedAccountPayload = new CreateConnectedAccount({
188
- authorizationDetails: authorizationDetails
189
- ? (authorizationDetails as AuthorizationDetails)
190
- : new AuthorizationDetails({
191
- details: { case: "oauthToken", value: new OauthToken({}) },
192
- }),
193
- ...(apiConfig != null && { apiConfig: apiConfig as unknown as CreateConnectedAccount["apiConfig"] }),
194
- });
195
-
196
- return this.createConnectedAccount({
197
- connector,
198
- identifier,
199
- connectedAccount: connectedAccountPayload,
200
- organizationId,
201
- userId,
202
- });
203
- }
204
-
205
- /**
206
- * Updates an existing connected account.
207
- *
208
- * You can target the account either by `connectedAccountId` or by the combination
209
- * of `organizationId`/`userId`, `connector`, and `identifier`.
210
- */
211
- async updateConnectedAccount(params: {
212
- connector: string;
213
- identifier: string;
214
- connectedAccount: UpdateConnectedAccount;
215
- organizationId?: string;
216
- userId?: string;
217
- connectedAccountId?: string;
218
- }): Promise<UpdateConnectedAccountResponse> {
219
- const {
220
- connector,
221
- identifier,
222
- connectedAccount,
223
- organizationId,
224
- userId,
225
- connectedAccountId,
226
- } = params;
227
-
228
- const request: PartialMessage<UpdateConnectedAccountRequest> = {
229
- connector,
230
- identifier,
231
- connectedAccount,
232
- };
233
-
234
- if (organizationId) {
235
- request.organizationId = organizationId;
236
- }
237
- if (userId) {
238
- request.userId = userId;
239
- }
240
- if (connectedAccountId) {
241
- request.id = connectedAccountId;
242
- }
243
-
244
- return this.coreClient.connectExec(
245
- this.client.updateConnectedAccount,
246
- request
247
- );
248
- }
249
-
250
- /**
251
- * Deletes a connected account and revokes its credentials.
252
- *
253
- * You can target the account either by `connectedAccountId` or by the combination
254
- * of `organizationId`/`userId`, `connector`, and `identifier`.
255
- */
256
- async deleteConnectedAccount(params: {
257
- connector: string;
258
- identifier: string;
259
- organizationId?: string;
260
- userId?: string;
261
- connectedAccountId?: string;
262
- }): Promise<DeleteConnectedAccountResponse> {
263
- const { connector, identifier, organizationId, userId, connectedAccountId } =
264
- params;
265
-
266
- const request: PartialMessage<DeleteConnectedAccountRequest> = {
267
- connector,
268
- identifier,
269
- };
270
-
271
- if (organizationId) {
272
- request.organizationId = organizationId;
273
- }
274
- if (userId) {
275
- request.userId = userId;
276
- }
277
- if (connectedAccountId) {
278
- request.id = connectedAccountId;
279
- }
280
-
281
- return this.coreClient.connectExec(
282
- this.client.deleteConnectedAccount,
283
- request
284
- );
285
- }
286
-
287
- /**
288
- * Generates a time-limited magic link for connecting or re-authorizing a third-party account.
289
- */
290
- async getMagicLinkForConnectedAccount(params: {
291
- connector: string;
292
- identifier: string;
293
- organizationId?: string;
294
- userId?: string;
295
- connectedAccountId?: string;
296
- }): Promise<GetMagicLinkForConnectedAccountResponse> {
297
- const { connector, identifier, organizationId, userId, connectedAccountId } =
298
- params;
299
-
300
- const request: PartialMessage<GetMagicLinkForConnectedAccountRequest> = {
301
- connector,
302
- identifier,
303
- };
304
-
305
- if (organizationId) {
306
- request.organizationId = organizationId;
307
- }
308
- if (userId) {
309
- request.userId = userId;
310
- }
311
- if (connectedAccountId) {
312
- request.id = connectedAccountId;
313
- }
314
-
315
- return this.coreClient.connectExec(
316
- this.client.getMagicLinkForConnectedAccount,
317
- request
318
- );
319
- }
320
-
321
- /**
322
- * Retrieves complete authentication details for a connected account.
323
- *
324
- * This method returns sensitive credential information, so ensure you protect access
325
- * to this in your application.
326
- */
327
- async getConnectedAccountByIdentifier(params: {
328
- connector: string;
329
- identifier: string;
330
- organizationId?: string;
331
- userId?: string;
332
- connectedAccountId?: string;
333
- }): Promise<GetConnectedAccountByIdentifierResponse> {
334
- const { connector, identifier, organizationId, userId, connectedAccountId } =
335
- params;
336
-
337
- const request: PartialMessage<GetConnectedAccountByIdentifierRequest> = {
338
- connector,
339
- identifier,
340
- };
341
-
342
- if (organizationId) {
343
- request.organizationId = organizationId;
344
- }
345
- if (userId) {
346
- request.userId = userId;
347
- }
348
- if (connectedAccountId) {
349
- request.id = connectedAccountId;
350
- }
351
-
352
- return this.coreClient.connectExec(
353
- this.client.getConnectedAccountAuth,
354
- request
355
- );
356
- }
357
- }
358
-
@@ -1,26 +0,0 @@
1
- // @generated by protoc-gen-connect-es v1.4.0 with parameter "target=ts"
2
- // @generated from file scalekit/v1/auditlogs/auditlogs.proto (package scalekit.v1.auditlogs, syntax proto3)
3
- /* eslint-disable */
4
- // @ts-nocheck
5
-
6
- import { ListAuthLogRequest, ListAuthLogResponse } from "./auditlogs_pb.js";
7
- import { MethodKind } from "@bufbuild/protobuf";
8
-
9
- /**
10
- * @generated from service scalekit.v1.auditlogs.AuditLogsService
11
- */
12
- export const AuditLogsService = {
13
- typeName: "scalekit.v1.auditlogs.AuditLogsService",
14
- methods: {
15
- /**
16
- * @generated from rpc scalekit.v1.auditlogs.AuditLogsService.ListAuthRequests
17
- */
18
- listAuthRequests: {
19
- name: "ListAuthRequests",
20
- I: ListAuthLogRequest,
21
- O: ListAuthLogResponse,
22
- kind: MethodKind.Unary,
23
- },
24
- }
25
- } as const;
26
-
@@ -1,125 +0,0 @@
1
- // @generated by protoc-gen-connect-es v1.4.0 with parameter "target=ts"
2
- // @generated from file scalekit/v1/auth/auth.proto (package scalekit.v1.auth, syntax proto3)
3
- /* eslint-disable */
4
- // @ts-nocheck
5
-
6
- import { DiscoveryAuthMethodRequest, DiscoveryAuthMethodResponse, GetAuthCustomizationsRequest, GetAuthCustomizationsResponse, GetAuthErrorRequest, GetAuthErrorResponse, GetAuthFeaturesResponse, GetAuthStateResponse, ListAuthMethodsRequest, ListAuthMethodsResponse, ListUserOrganizationsResponse, SignupOrganizationRequest, SignupOrganizationResponse, UpdateLoginUserDetailsRequest, VerifyPasswordLessOtpRequest, VerifyPasswordLessOtpResponse } from "./auth_pb.js";
7
- import { Empty, MethodKind } from "@bufbuild/protobuf";
8
-
9
- /**
10
- * @generated from service scalekit.v1.auth.AuthService
11
- */
12
- export const AuthService = {
13
- typeName: "scalekit.v1.auth.AuthService",
14
- methods: {
15
- /**
16
- * @generated from rpc scalekit.v1.auth.AuthService.ListAuthMethods
17
- */
18
- listAuthMethods: {
19
- name: "ListAuthMethods",
20
- I: ListAuthMethodsRequest,
21
- O: ListAuthMethodsResponse,
22
- kind: MethodKind.Unary,
23
- },
24
- /**
25
- * @generated from rpc scalekit.v1.auth.AuthService.DiscoveryAuthMethod
26
- */
27
- discoveryAuthMethod: {
28
- name: "DiscoveryAuthMethod",
29
- I: DiscoveryAuthMethodRequest,
30
- O: DiscoveryAuthMethodResponse,
31
- kind: MethodKind.Unary,
32
- },
33
- /**
34
- * @generated from rpc scalekit.v1.auth.AuthService.VerifyPasswordLessOtp
35
- */
36
- verifyPasswordLessOtp: {
37
- name: "VerifyPasswordLessOtp",
38
- I: VerifyPasswordLessOtpRequest,
39
- O: VerifyPasswordLessOtpResponse,
40
- kind: MethodKind.Unary,
41
- },
42
- /**
43
- * @generated from rpc scalekit.v1.auth.AuthService.ResendPasswordless
44
- */
45
- resendPasswordless: {
46
- name: "ResendPasswordless",
47
- I: Empty,
48
- O: Empty,
49
- kind: MethodKind.Unary,
50
- },
51
- /**
52
- * @generated from rpc scalekit.v1.auth.AuthService.ListUserOrganizations
53
- */
54
- listUserOrganizations: {
55
- name: "ListUserOrganizations",
56
- I: Empty,
57
- O: ListUserOrganizationsResponse,
58
- kind: MethodKind.Unary,
59
- },
60
- /**
61
- * @generated from rpc scalekit.v1.auth.AuthService.SignupOrganization
62
- */
63
- signupOrganization: {
64
- name: "SignupOrganization",
65
- I: SignupOrganizationRequest,
66
- O: SignupOrganizationResponse,
67
- kind: MethodKind.Unary,
68
- },
69
- /**
70
- * @generated from rpc scalekit.v1.auth.AuthService.GetAuthState
71
- */
72
- getAuthState: {
73
- name: "GetAuthState",
74
- I: Empty,
75
- O: GetAuthStateResponse,
76
- kind: MethodKind.Unary,
77
- },
78
- /**
79
- * @generated from rpc scalekit.v1.auth.AuthService.GetAuthError
80
- */
81
- getAuthError: {
82
- name: "GetAuthError",
83
- I: GetAuthErrorRequest,
84
- O: GetAuthErrorResponse,
85
- kind: MethodKind.Unary,
86
- },
87
- /**
88
- * @generated from rpc scalekit.v1.auth.AuthService.Logout
89
- */
90
- logout: {
91
- name: "Logout",
92
- I: Empty,
93
- O: Empty,
94
- kind: MethodKind.Unary,
95
- },
96
- /**
97
- * @generated from rpc scalekit.v1.auth.AuthService.GetAuthCustomizations
98
- */
99
- getAuthCustomizations: {
100
- name: "GetAuthCustomizations",
101
- I: GetAuthCustomizationsRequest,
102
- O: GetAuthCustomizationsResponse,
103
- kind: MethodKind.Unary,
104
- },
105
- /**
106
- * @generated from rpc scalekit.v1.auth.AuthService.GetAuthFeatures
107
- */
108
- getAuthFeatures: {
109
- name: "GetAuthFeatures",
110
- I: Empty,
111
- O: GetAuthFeaturesResponse,
112
- kind: MethodKind.Unary,
113
- },
114
- /**
115
- * @generated from rpc scalekit.v1.auth.AuthService.UpdateLoginUserDetails
116
- */
117
- updateLoginUserDetails: {
118
- name: "UpdateLoginUserDetails",
119
- I: UpdateLoginUserDetailsRequest,
120
- O: Empty,
121
- kind: MethodKind.Unary,
122
- },
123
- }
124
- } as const;
125
-
@@ -1,44 +0,0 @@
1
- // @generated by protoc-gen-connect-es v1.4.0 with parameter "target=ts"
2
- // @generated from file scalekit/v1/auth/passwordless.proto (package scalekit.v1.auth.passwordless, syntax proto3)
3
- /* eslint-disable */
4
- // @ts-nocheck
5
-
6
- import { ResendPasswordlessRequest, SendPasswordlessRequest, SendPasswordlessResponse, VerifyPasswordLessRequest, VerifyPasswordLessResponse } from "./passwordless_pb.js";
7
- import { MethodKind } from "@bufbuild/protobuf";
8
-
9
- /**
10
- * @generated from service scalekit.v1.auth.passwordless.PasswordlessService
11
- */
12
- export const PasswordlessService = {
13
- typeName: "scalekit.v1.auth.passwordless.PasswordlessService",
14
- methods: {
15
- /**
16
- * @generated from rpc scalekit.v1.auth.passwordless.PasswordlessService.SendPasswordlessEmail
17
- */
18
- sendPasswordlessEmail: {
19
- name: "SendPasswordlessEmail",
20
- I: SendPasswordlessRequest,
21
- O: SendPasswordlessResponse,
22
- kind: MethodKind.Unary,
23
- },
24
- /**
25
- * @generated from rpc scalekit.v1.auth.passwordless.PasswordlessService.VerifyPasswordlessEmail
26
- */
27
- verifyPasswordlessEmail: {
28
- name: "VerifyPasswordlessEmail",
29
- I: VerifyPasswordLessRequest,
30
- O: VerifyPasswordLessResponse,
31
- kind: MethodKind.Unary,
32
- },
33
- /**
34
- * @generated from rpc scalekit.v1.auth.passwordless.PasswordlessService.ResendPasswordlessEmail
35
- */
36
- resendPasswordlessEmail: {
37
- name: "ResendPasswordlessEmail",
38
- I: ResendPasswordlessRequest,
39
- O: SendPasswordlessResponse,
40
- kind: MethodKind.Unary,
41
- },
42
- }
43
- } as const;
44
-
@@ -1,89 +0,0 @@
1
- // @generated by protoc-gen-connect-es v1.4.0 with parameter "target=ts"
2
- // @generated from file scalekit/v1/auth/webauthn.proto (package scalekit.v1.auth.webauthn, syntax proto3)
3
- /* eslint-disable */
4
- // @ts-nocheck
5
-
6
- import { BeginAuthenticationRequest, BeginAuthenticationResponse, BeginRegistrationRequest, BeginRegistrationResponse, DeleteCredentialRequest, DeleteCredentialResponse, FinishAuthenticationRequest, FinishAuthenticationResponse, FinishRegistrationRequest, FinishRegistrationResponse, GetRelatedOriginsRequest, GetRelatedOriginsResponse, ListCredentialsRequest, ListCredentialsResponse, UpdateCredentialRequest, UpdateCredentialResponse } from "./webauthn_pb.js";
7
- import { MethodKind } from "@bufbuild/protobuf";
8
-
9
- /**
10
- * @generated from service scalekit.v1.auth.webauthn.WebAuthnService
11
- */
12
- export const WebAuthnService = {
13
- typeName: "scalekit.v1.auth.webauthn.WebAuthnService",
14
- methods: {
15
- /**
16
- * @generated from rpc scalekit.v1.auth.webauthn.WebAuthnService.BeginRegistration
17
- */
18
- beginRegistration: {
19
- name: "BeginRegistration",
20
- I: BeginRegistrationRequest,
21
- O: BeginRegistrationResponse,
22
- kind: MethodKind.Unary,
23
- },
24
- /**
25
- * @generated from rpc scalekit.v1.auth.webauthn.WebAuthnService.FinishRegistration
26
- */
27
- finishRegistration: {
28
- name: "FinishRegistration",
29
- I: FinishRegistrationRequest,
30
- O: FinishRegistrationResponse,
31
- kind: MethodKind.Unary,
32
- },
33
- /**
34
- * @generated from rpc scalekit.v1.auth.webauthn.WebAuthnService.BeginAuthentication
35
- */
36
- beginAuthentication: {
37
- name: "BeginAuthentication",
38
- I: BeginAuthenticationRequest,
39
- O: BeginAuthenticationResponse,
40
- kind: MethodKind.Unary,
41
- },
42
- /**
43
- * @generated from rpc scalekit.v1.auth.webauthn.WebAuthnService.FinishAuthentication
44
- */
45
- finishAuthentication: {
46
- name: "FinishAuthentication",
47
- I: FinishAuthenticationRequest,
48
- O: FinishAuthenticationResponse,
49
- kind: MethodKind.Unary,
50
- },
51
- /**
52
- * @generated from rpc scalekit.v1.auth.webauthn.WebAuthnService.ListCredentials
53
- */
54
- listCredentials: {
55
- name: "ListCredentials",
56
- I: ListCredentialsRequest,
57
- O: ListCredentialsResponse,
58
- kind: MethodKind.Unary,
59
- },
60
- /**
61
- * @generated from rpc scalekit.v1.auth.webauthn.WebAuthnService.DeleteCredential
62
- */
63
- deleteCredential: {
64
- name: "DeleteCredential",
65
- I: DeleteCredentialRequest,
66
- O: DeleteCredentialResponse,
67
- kind: MethodKind.Unary,
68
- },
69
- /**
70
- * @generated from rpc scalekit.v1.auth.webauthn.WebAuthnService.UpdateCredential
71
- */
72
- updateCredential: {
73
- name: "UpdateCredential",
74
- I: UpdateCredentialRequest,
75
- O: UpdateCredentialResponse,
76
- kind: MethodKind.Unary,
77
- },
78
- /**
79
- * @generated from rpc scalekit.v1.auth.webauthn.WebAuthnService.GetRelatedOrigins
80
- */
81
- getRelatedOrigins: {
82
- name: "GetRelatedOrigins",
83
- I: GetRelatedOriginsRequest,
84
- O: GetRelatedOriginsResponse,
85
- kind: MethodKind.Unary,
86
- },
87
- }
88
- } as const;
89
-