@scalekit-sdk/node 2.2.0-beta.0 → 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 -96
  141. package/lib/connected-accounts.js +0 -186
  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 -283
  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 -434
  209. package/tests/tools.test.ts +0 -239
package/src/auth.ts CHANGED
@@ -1,15 +1,20 @@
1
- import { Empty, PartialMessage, Struct, JsonValue } from "@bufbuild/protobuf";
2
- import { PromiseClient } from "@connectrpc/connect";
1
+ import type { JsonObject } from "@bufbuild/protobuf";
2
+ import { create } from "@bufbuild/protobuf";
3
+ import type { MessageShape } from "@bufbuild/protobuf";
4
+ import { EmptySchema } from "@bufbuild/protobuf/wkt";
3
5
  import CoreClient from "./core";
6
+ import type { Client } from "@connectrpc/connect";
4
7
  import GrpcConnect from "./connect";
5
- import { AuthService } from "./pkg/grpc/scalekit/v1/auth/auth_connect";
6
8
  import {
7
- UpdateLoginUserDetailsRequest,
8
- User,
9
+ AuthService,
10
+ UpdateLoginUserDetailsRequestSchema,
11
+ UserSchema,
12
+ type User,
9
13
  } from "./pkg/grpc/scalekit/v1/auth/auth_pb";
10
14
 
11
- type UserInput = PartialMessage<User> & {
12
- customAttributes?: Record<string, JsonValue>;
15
+ /** User input for updateLoginUserDetails; customAttributes is a plain object (proto Struct → JsonObject in v2). */
16
+ type UserInput = Partial<User> & {
17
+ customAttributes?: JsonObject;
13
18
  };
14
19
 
15
20
  /**
@@ -23,7 +28,7 @@ type UserInput = PartialMessage<User> & {
23
28
  * @see {@link https://docs.scalekit.com/apis/#tag/api%20auth | Authentication API Documentation}
24
29
  */
25
30
  export default class AuthClient {
26
- private readonly client: PromiseClient<typeof AuthService>;
31
+ private readonly client: Client<typeof AuthService>;
27
32
 
28
33
  constructor(
29
34
  private readonly grpcConnect: GrpcConnect,
@@ -42,7 +47,7 @@ export default class AuthClient {
42
47
  * @param {string} [user.email] - User's email address
43
48
  * @param {string} [user.sub] - Unique user identifier (subject)
44
49
  *
45
- * @returns {Promise<Empty>} Empty response on successful update
50
+ * @returns {Promise<MessageShape<EmptySchema>>} Empty response on successful update
46
51
  *
47
52
  * @throws {Error} When connectionId is missing or invalid
48
53
  * @throws {Error} When loginRequestId is missing or invalid
@@ -65,7 +70,7 @@ export default class AuthClient {
65
70
  connectionId: string,
66
71
  loginRequestId: string,
67
72
  user: UserInput
68
- ): Promise<Empty> {
73
+ ): Promise<MessageShape<typeof EmptySchema>> {
69
74
  if (!connectionId || typeof connectionId !== "string") {
70
75
  throw new Error("connectionId must be a non-empty string");
71
76
  }
@@ -78,14 +83,9 @@ export default class AuthClient {
78
83
  throw new Error("user must be a valid object");
79
84
  }
80
85
 
81
- const { customAttributes, ...rest } = user;
82
- const userMessage = new User(rest as PartialMessage<User>);
86
+ const userMessage = create(UserSchema, user as Parameters<typeof create<typeof UserSchema>>[1]);
83
87
 
84
- if (customAttributes !== undefined) {
85
- userMessage.customAttributes = Struct.fromJson(customAttributes);
86
- }
87
-
88
- const request = new UpdateLoginUserDetailsRequest({
88
+ const request = create(UpdateLoginUserDetailsRequestSchema, {
89
89
  connectionId,
90
90
  loginRequestId,
91
91
  user: userMessage,
package/src/connect.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ServiceType } from '@bufbuild/protobuf';
2
- import { PromiseClient, Transport, createPromiseClient } from '@connectrpc/connect';
1
+ import type { DescService } from '@bufbuild/protobuf';
2
+ import { type Client, type Transport, createClient } from '@connectrpc/connect';
3
3
  import { createGrpcTransport } from '@connectrpc/connect-node';
4
4
  import CoreClient, { headers } from './core';
5
5
 
@@ -10,7 +10,6 @@ export default class GrpcConnect {
10
10
  ) {
11
11
  this.transport = createGrpcTransport({
12
12
  baseUrl: this.coreClient.envUrl,
13
- httpVersion: "2",
14
13
  interceptors: [
15
14
  (next) => {
16
15
  return (req) => {
@@ -27,7 +26,7 @@ export default class GrpcConnect {
27
26
  });
28
27
  }
29
28
 
30
- createClient<T extends ServiceType>(service: T): PromiseClient<T> {
31
- return createPromiseClient(service, this.transport);
29
+ createClient<T extends DescService>(service: T): Client<T> {
30
+ return createClient(service, this.transport);
32
31
  }
33
32
  }
package/src/connection.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { PromiseClient } from "@connectrpc/connect";
1
+ import type { Client } from "@connectrpc/connect";
2
2
  import GrpcConnect from "./connect";
3
3
  import CoreClient from "./core";
4
- import { ConnectionService } from "./pkg/grpc/scalekit/v1/connections/connections_connect";
4
+ import { ConnectionService } from "./pkg/grpc/scalekit/v1/connections/connections_pb";
5
5
  import {
6
6
  GetConnectionResponse,
7
7
  ToggleConnectionResponse,
@@ -23,12 +23,12 @@ import {
23
23
  * @see {@link https://docs.scalekit.com/apis/#tag/connections | Connection API Documentation}
24
24
  */
25
25
  export default class ConnectionClient {
26
- private client: PromiseClient<typeof ConnectionService>;
26
+ private client: Client<typeof ConnectionService>;
27
27
  constructor(
28
- private readonly grpcConncet: GrpcConnect,
28
+ private readonly grpcConnect: GrpcConnect,
29
29
  private readonly coreClient: CoreClient
30
30
  ) {
31
- this.client = this.grpcConncet.createClient(ConnectionService);
31
+ this.client = this.grpcConnect.createClient(ConnectionService);
32
32
  }
33
33
 
34
34
  /**
package/src/core.ts CHANGED
@@ -23,8 +23,8 @@ export default class CoreClient {
23
23
  public keys: JWK[] = [];
24
24
  public accessToken: string | null = null;
25
25
  public axios: Axios;
26
- public sdkVersion = `Scalekit-Node/2.2.0-beta.0`;
27
- public apiVersion = "20260123";
26
+ public sdkVersion = `Scalekit-Node/2.2.0`;
27
+ public apiVersion = "20260202";
28
28
  public userAgent = `${this.sdkVersion} Node/${process.version} (${
29
29
  process.platform
30
30
  }; ${os.arch()})`;
package/src/directory.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { Timestamp } from "@bufbuild/protobuf";
2
- import { PromiseClient } from "@connectrpc/connect";
1
+ import { timestampFromDate } from "@bufbuild/protobuf/wkt";
2
+ import type { Client } from "@connectrpc/connect";
3
3
  import GrpcConnect from "./connect";
4
4
  import CoreClient from "./core";
5
- import { DirectoryService } from "./pkg/grpc/scalekit/v1/directories/directories_connect";
5
+ import { DirectoryService } from "./pkg/grpc/scalekit/v1/directories/directories_pb";
6
6
  import {
7
7
  GetDirectoryResponse,
8
8
  Directory,
@@ -28,12 +28,12 @@ import {
28
28
  * @see {@link https://docs.scalekit.com/directory/scim/quickstart/ | SCIM Directory Sync Guide}
29
29
  */
30
30
  export default class DirectoryClient {
31
- private client: PromiseClient<typeof DirectoryService>;
31
+ private client: Client<typeof DirectoryService>;
32
32
  constructor(
33
- private readonly grpcConncet: GrpcConnect,
33
+ private readonly grpcConnect: GrpcConnect,
34
34
  private readonly coreClient: CoreClient
35
35
  ) {
36
- this.client = this.grpcConncet.createClient(DirectoryService);
36
+ this.client = this.grpcConnect.createClient(DirectoryService);
37
37
  }
38
38
 
39
39
  /**
@@ -249,7 +249,7 @@ export default class DirectoryClient {
249
249
  requestOptions = {
250
250
  ...options,
251
251
  ...(options.updatedAfter && {
252
- updatedAfter: Timestamp.fromDate(new Date(options.updatedAfter)),
252
+ updatedAfter: timestampFromDate(new Date(options.updatedAfter)),
253
253
  }),
254
254
  };
255
255
  }
@@ -333,7 +333,7 @@ export default class DirectoryClient {
333
333
  requestOptions = {
334
334
  ...options,
335
335
  ...(options.updatedAfter && {
336
- updatedAfter: Timestamp.fromDate(new Date(options.updatedAfter)),
336
+ updatedAfter: timestampFromDate(new Date(options.updatedAfter)),
337
337
  }),
338
338
  };
339
339
  }
package/src/domain.ts CHANGED
@@ -1,14 +1,15 @@
1
- import { PromiseClient } from "@connectrpc/connect";
1
+ import type { MessageShape } from "@bufbuild/protobuf";
2
+ import { EmptySchema } from "@bufbuild/protobuf/wkt";
3
+ import type { Client } from "@connectrpc/connect";
2
4
  import GrpcConnect from "./connect";
3
5
  import CoreClient from "./core";
4
- import { DomainService } from "./pkg/grpc/scalekit/v1/domains/domains_connect";
5
6
  import {
7
+ DomainService,
6
8
  CreateDomainResponse,
7
9
  GetDomainResponse,
8
10
  ListDomainResponse,
9
11
  DomainType,
10
12
  } from "./pkg/grpc/scalekit/v1/domains/domains_pb";
11
- import { Empty } from "@bufbuild/protobuf";
12
13
 
13
14
  /**
14
15
  * Client for managing domains for organizations.
@@ -24,12 +25,12 @@ import { Empty } from "@bufbuild/protobuf";
24
25
  * @see {@link https://docs.scalekit.com/apis/#tag/domains | Domain API Documentation}
25
26
  */
26
27
  export default class DomainClient {
27
- private client: PromiseClient<typeof DomainService>;
28
+ private client: Client<typeof DomainService>;
28
29
  constructor(
29
- private readonly grpcConncet: GrpcConnect,
30
+ private readonly grpcConnect: GrpcConnect,
30
31
  private readonly coreClient: CoreClient
31
32
  ) {
32
- this.client = this.grpcConncet.createClient(DomainService);
33
+ this.client = this.grpcConnect.createClient(DomainService);
33
34
  }
34
35
 
35
36
  /**
@@ -249,7 +250,7 @@ export default class DomainClient {
249
250
  * @param {string} organizationId - The organization ID
250
251
  * @param {string} domainId - The domain ID to delete
251
252
  *
252
- * @returns {Promise<Empty>} Empty response on successful deletion
253
+ * @returns {Promise<MessageShape<EmptySchema>>} Empty response on successful deletion
253
254
  *
254
255
  * @example
255
256
  * // Remove a domain from an organization
@@ -260,7 +261,7 @@ export default class DomainClient {
260
261
  * @see {@link createDomain} - Add a new domain
261
262
  * @see {@link listDomains} - List all domains for an organization
262
263
  */
263
- async deleteDomain(organizationId: string, domainId: string): Promise<Empty> {
264
+ async deleteDomain(organizationId: string, domainId: string): Promise<MessageShape<typeof EmptySchema>> {
264
265
  return this.coreClient.connectExec(this.client.deleteDomain, {
265
266
  id: domainId,
266
267
  identities: {
@@ -1,6 +1,7 @@
1
1
  import { ConnectError, Code } from '@connectrpc/connect';
2
2
  import { AxiosResponse } from 'axios';
3
- import { ErrorInfo } from '../pkg/grpc/scalekit/v1/errdetails/errdetails_pb';
3
+ import type { ErrorInfo } from '../pkg/grpc/scalekit/v1/errdetails/errdetails_pb';
4
+ import { ErrorInfoSchema } from '../pkg/grpc/scalekit/v1/errdetails/errdetails_pb';
4
5
 
5
6
  // gRPC to HTTP status mapping
6
7
  const GRPC_TO_HTTP: Record<number, number> = {
@@ -106,7 +107,7 @@ export class ScalekitServerException extends ScalekitException {
106
107
  this._grpcStatus = error.code;
107
108
  this._httpStatus = GRPC_TO_HTTP[error.code] || 500;
108
109
  this._message = error.message;
109
- this._errDetails = error.findDetails(ErrorInfo);
110
+ this._errDetails = error.findDetails(ErrorInfoSchema);
110
111
  this._errorCode = null;
111
112
 
112
113
  // Unpack error details
@@ -1,8 +1,10 @@
1
- import { Empty, PartialMessage } from "@bufbuild/protobuf";
2
- import { PromiseClient } from "@connectrpc/connect";
1
+ import type { MessageShape } from "@bufbuild/protobuf";
2
+ import { create } from "@bufbuild/protobuf";
3
+ import { EmptySchema } from "@bufbuild/protobuf/wkt";
4
+ import type { Client } from "@connectrpc/connect";
3
5
  import GrpcConnect from "./connect";
4
6
  import CoreClient from "./core";
5
- import { OrganizationService } from "./pkg/grpc/scalekit/v1/organizations/organizations_connect";
7
+ import { OrganizationService } from "./pkg/grpc/scalekit/v1/organizations/organizations_pb";
6
8
  import {
7
9
  CreateOrganizationResponse,
8
10
  GetOrganizationResponse,
@@ -11,6 +13,7 @@ import {
11
13
  OrganizationUserManagementSettings as OrganizationUserManagementSettingsMessage,
12
14
  UpdateOrganization,
13
15
  UpdateOrganizationResponse,
16
+ UpdateOrganizationSchema,
14
17
  } from "./pkg/grpc/scalekit/v1/organizations/organizations_pb";
15
18
  import {
16
19
  OrganizationSettings,
@@ -31,12 +34,12 @@ import {
31
34
  * @see {@link https://docs.scalekit.com/apis/#tag/organizations | Organization API Documentation}
32
35
  */
33
36
  export default class OrganizationClient {
34
- private client: PromiseClient<typeof OrganizationService>;
37
+ private client: Client<typeof OrganizationService>;
35
38
  constructor(
36
- private readonly grpcConncet: GrpcConnect,
39
+ private readonly grpcConnect: GrpcConnect,
37
40
  private readonly coreClient: CoreClient
38
41
  ) {
39
- this.client = this.grpcConncet.createClient(OrganizationService);
42
+ this.client = this.grpcConnect.createClient(OrganizationService);
40
43
  }
41
44
 
42
45
  /**
@@ -248,7 +251,7 @@ export default class OrganizationClient {
248
251
  * unchanged. Note that the region code cannot be modified once set.
249
252
  *
250
253
  * @param {string} id - The Scalekit organization identifier (format: "org_...")
251
- * @param {PartialMessage<UpdateOrganization>} organization - Object containing fields to update:
254
+ * @param {Partial<UpdateOrganization>} organization - Object containing fields to update:
252
255
  * - displayName?: New display name for the organization
253
256
  * - externalId?: New external ID to map to your system
254
257
  * - metadata?: Custom key-value pairs for storing additional data
@@ -289,11 +292,11 @@ export default class OrganizationClient {
289
292
  */
290
293
  async updateOrganization(
291
294
  id: string,
292
- organization: PartialMessage<UpdateOrganization>
295
+ organization: Partial<UpdateOrganization>
293
296
  ): Promise<UpdateOrganizationResponse> {
294
297
  return this.coreClient.connectExec(this.client.updateOrganization, {
295
298
  identities: { case: "id", value: id },
296
- organization,
299
+ organization: create(UpdateOrganizationSchema, organization as Parameters<typeof create<typeof UpdateOrganizationSchema>>[1]),
297
300
  });
298
301
  }
299
302
 
@@ -305,7 +308,7 @@ export default class OrganizationClient {
305
308
  * Only specified fields will be updated; all other fields remain unchanged.
306
309
  *
307
310
  * @param {string} externalId - Your system's unique identifier for the organization
308
- * @param {PartialMessage<UpdateOrganization>} organization - Object containing fields to update:
311
+ * @param {Partial<UpdateOrganization>} organization - Object containing fields to update:
309
312
  * - displayName?: New display name for the organization
310
313
  * - externalId?: New external ID (useful for migrating identifiers)
311
314
  * - metadata?: Custom key-value pairs for storing additional data
@@ -352,11 +355,11 @@ export default class OrganizationClient {
352
355
  */
353
356
  async updateOrganizationByExternalId(
354
357
  externalId: string,
355
- organization: PartialMessage<UpdateOrganization>
358
+ organization: Partial<UpdateOrganization>
356
359
  ): Promise<UpdateOrganizationResponse> {
357
360
  return this.coreClient.connectExec(this.client.updateOrganization, {
358
361
  identities: { case: "externalId", value: externalId },
359
- organization,
362
+ organization: create(UpdateOrganizationSchema, organization as Parameters<typeof create<typeof UpdateOrganizationSchema>>[1]),
360
363
  });
361
364
  }
362
365
 
@@ -368,7 +371,7 @@ export default class OrganizationClient {
368
371
  *
369
372
  * @param {string} organizationId - The Scalekit organization identifier to delete
370
373
  *
371
- * @returns {Promise<Empty>} Empty response on successful deletion
374
+ * @returns {Promise<MessageShape<EmptySchema>>} Empty response on successful deletion
372
375
  *
373
376
  * @throws {Error} If the organization is not found or deletion fails
374
377
  *
@@ -395,7 +398,7 @@ export default class OrganizationClient {
395
398
  * @see {@link https://docs.scalekit.com/apis/#tag/organizations | Delete Organization API}
396
399
  * @see {@link getOrganization} - Check if organization exists before deletion
397
400
  */
398
- async deleteOrganization(organizationId: string): Promise<Empty> {
401
+ async deleteOrganization(organizationId: string): Promise<MessageShape<typeof EmptySchema>> {
399
402
  return this.coreClient.connectExec(this.client.deleteOrganization, {
400
403
  identities: { case: "id", value: organizationId },
401
404
  });
@@ -546,7 +549,7 @@ export default class OrganizationClient {
546
549
  organizationId: string,
547
550
  settings: OrganizationUserManagementSettingsInput
548
551
  ): Promise<OrganizationUserManagementSettingsMessage | undefined> {
549
- const requestSettings: PartialMessage<OrganizationUserManagementSettingsMessage> =
552
+ const requestSettings: Partial<OrganizationUserManagementSettingsMessage> =
550
553
  {};
551
554
  if (
552
555
  settings.maxAllowedUsers !== undefined &&
@@ -1,22 +1,23 @@
1
- import { PromiseClient } from '@connectrpc/connect';
1
+ import { create } from '@bufbuild/protobuf';
2
+ import type { Client } from '@connectrpc/connect';
2
3
  import GrpcConnect from './connect';
3
4
  import CoreClient from './core';
4
- import { PasswordlessService } from './pkg/grpc/scalekit/v1/auth/passwordless_connect';
5
- import {
6
- SendPasswordlessResponse,
5
+ import { PasswordlessService } from './pkg/grpc/scalekit/v1/auth/passwordless_pb';
6
+ import {
7
+ SendPasswordlessRequestSchema,
8
+ VerifyPasswordLessRequestSchema,
9
+ SendPasswordlessResponse,
7
10
  VerifyPasswordLessResponse,
8
11
  TemplateType,
9
- SendPasswordlessRequest,
10
- VerifyPasswordLessRequest
11
12
  } from './pkg/grpc/scalekit/v1/auth/passwordless_pb';
12
13
 
13
14
  export default class PasswordlessClient {
14
- private client: PromiseClient<typeof PasswordlessService>;
15
+ private client: Client<typeof PasswordlessService>;
15
16
  constructor(
16
- private readonly grpcConncet: GrpcConnect,
17
+ private readonly grpcConnect: GrpcConnect,
17
18
  private readonly coreClient: CoreClient
18
19
  ) {
19
- this.client = this.grpcConncet.createClient(PasswordlessService);
20
+ this.client = this.grpcConnect.createClient(PasswordlessService);
20
21
  }
21
22
 
22
23
  /**
@@ -68,7 +69,7 @@ export default class PasswordlessClient {
68
69
  throw new Error('Magic link auth URI must be a string');
69
70
  }
70
71
 
71
- const request: SendPasswordlessRequest = new SendPasswordlessRequest({
72
+ const request = create(SendPasswordlessRequestSchema, {
72
73
  email,
73
74
  template: templateValue,
74
75
  state: options?.state,
@@ -103,7 +104,7 @@ export default class PasswordlessClient {
103
104
  throw new Error('Either code or linkToken must be provided');
104
105
  }
105
106
 
106
- const request = new VerifyPasswordLessRequest({
107
+ const request = create(VerifyPasswordLessRequestSchema, {
107
108
  authRequestId,
108
109
  authCredential: credential.code
109
110
  ? { case: "code", value: credential.code }
package/src/permission.ts CHANGED
@@ -1,8 +1,10 @@
1
- import { Empty, PartialMessage } from "@bufbuild/protobuf";
2
- import { PromiseClient } from "@connectrpc/connect";
1
+ import type { MessageShape } from "@bufbuild/protobuf";
2
+ import { create } from "@bufbuild/protobuf";
3
+ import { EmptySchema } from "@bufbuild/protobuf/wkt";
4
+ import type { Client } from "@connectrpc/connect";
3
5
  import GrpcConnect from "./connect";
4
6
  import CoreClient from "./core";
5
- import { RolesService } from "./pkg/grpc/scalekit/v1/roles/roles_connect";
7
+ import { RolesService } from "./pkg/grpc/scalekit/v1/roles/roles_pb";
6
8
  import {
7
9
  CreatePermissionRequest,
8
10
  CreatePermissionResponse,
@@ -21,6 +23,7 @@ import {
21
23
  ListEffectiveRolePermissionsRequest,
22
24
  ListEffectiveRolePermissionsResponse,
23
25
  CreatePermission,
26
+ ListPermissionsRequestSchema,
24
27
  } from "./pkg/grpc/scalekit/v1/roles/roles_pb";
25
28
 
26
29
  /**
@@ -42,7 +45,7 @@ import {
42
45
  * @see {@link https://docs.scalekit.com/apis/#tag/permissions | Permission API Documentation}
43
46
  */
44
47
  export default class PermissionClient {
45
- private client: PromiseClient<typeof RolesService>;
48
+ private client: Client<typeof RolesService>;
46
49
 
47
50
  constructor(
48
51
  private readonly grpcConnect: GrpcConnect,
@@ -132,13 +135,10 @@ export default class PermissionClient {
132
135
  pageToken?: string,
133
136
  pageSize?: number
134
137
  ): Promise<ListPermissionsResponse> {
135
- const request: PartialMessage<ListPermissionsRequest> = {};
136
- if (pageToken) {
137
- request.pageToken = pageToken;
138
- }
139
- if (pageSize) {
140
- request.pageSize = pageSize;
141
- }
138
+ const request = create(ListPermissionsRequestSchema, {
139
+ pageToken,
140
+ pageSize,
141
+ });
142
142
 
143
143
  return this.coreClient.connectExec(this.client.listPermissions, request);
144
144
  }
@@ -178,14 +178,14 @@ export default class PermissionClient {
178
178
  *
179
179
  * @param {string} permissionName - Permission identifier to delete
180
180
  *
181
- * @returns {Promise<Empty>} Empty response on success
181
+ * @returns {Promise<MessageShape<typeof EmptySchema>>} Empty response on success
182
182
  *
183
183
  * @example
184
184
  * await scalekitClient.permission.deletePermission('deprecated:feature');
185
185
  *
186
186
  * @see {@link https://docs.scalekit.com/apis/#tag/permissions | Delete Permission API}
187
187
  */
188
- async deletePermission(permissionName: string): Promise<Empty> {
188
+ async deletePermission(permissionName: string): Promise<MessageShape<typeof EmptySchema>> {
189
189
  return this.coreClient.connectExec(this.client.deletePermission, {
190
190
  permissionName,
191
191
  });
@@ -259,7 +259,7 @@ export default class PermissionClient {
259
259
  * @param {string} roleName - Role to modify
260
260
  * @param {string} permissionName - Permission to remove
261
261
  *
262
- * @returns {Promise<Empty>} Empty response on success
262
+ * @returns {Promise<MessageShape<typeof EmptySchema>>} Empty response on success
263
263
  *
264
264
  * @example
265
265
  * // Remove delete permission from editor role
@@ -270,7 +270,7 @@ export default class PermissionClient {
270
270
  async removePermissionFromRole(
271
271
  roleName: string,
272
272
  permissionName: string
273
- ): Promise<Empty> {
273
+ ): Promise<MessageShape<typeof EmptySchema>> {
274
274
  return this.coreClient.connectExec(this.client.removePermissionFromRole, {
275
275
  roleName,
276
276
  permissionName,
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Stub for buf/validate/validate.proto dependency.
3
+ * The generated code references this for file descriptor linking; we export a minimal
4
+ * placeholder so the SDK builds without the full buf validate proto source.
5
+ */
6
+ import type { GenFile } from "@bufbuild/protobuf/codegenv2";
7
+
8
+ const NAME = "buf/validate/validate.proto";
9
+ const EMPTY_ARR: never[] = [];
10
+ export const file_buf_validate_validate: GenFile = {
11
+ get name() { return NAME; },
12
+ get syntax() { return "proto3"; },
13
+ get dependency() { return []; },
14
+ get enumType() { return EMPTY_ARR; },
15
+ get messageType() { return EMPTY_ARR; },
16
+ get service() { return EMPTY_ARR; },
17
+ get extension() { return EMPTY_ARR; },
18
+ get proto() {
19
+ return {
20
+ name: NAME,
21
+ syntax: "proto3",
22
+ enumType: EMPTY_ARR,
23
+ messageType: EMPTY_ARR,
24
+ service: EMPTY_ARR,
25
+ extension: EMPTY_ARR,
26
+ };
27
+ },
28
+ } as unknown as GenFile;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Stub for google/api/annotations.proto dependency.
3
+ * The generated code references this for file descriptor linking; we export a minimal
4
+ * placeholder so the SDK builds without the full google API proto source.
5
+ */
6
+ import type { GenFile } from "@bufbuild/protobuf/codegenv2";
7
+
8
+ const NAME = "google/api/annotations.proto";
9
+ const EMPTY_ARR: never[] = [];
10
+ export const file_google_api_annotations: GenFile = {
11
+ get name() { return NAME; },
12
+ get syntax() { return "proto3"; },
13
+ get dependency() { return []; },
14
+ get enumType() { return EMPTY_ARR; },
15
+ get messageType() { return EMPTY_ARR; },
16
+ get service() { return EMPTY_ARR; },
17
+ get extension() { return EMPTY_ARR; },
18
+ get proto() {
19
+ return {
20
+ name: NAME,
21
+ syntax: "proto3",
22
+ enumType: EMPTY_ARR,
23
+ messageType: EMPTY_ARR,
24
+ service: EMPTY_ARR,
25
+ extension: EMPTY_ARR,
26
+ };
27
+ },
28
+ } as unknown as GenFile;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Stub for google/api/field_behavior.proto dependency.
3
+ * The generated code references this for file descriptor linking; we export a minimal
4
+ * placeholder so the SDK builds without the full google API proto source.
5
+ */
6
+ import type { GenFile } from "@bufbuild/protobuf/codegenv2";
7
+
8
+ const NAME = "google/api/field_behavior.proto";
9
+ const EMPTY_ARR: never[] = [];
10
+ export const file_google_api_field_behavior: GenFile = {
11
+ get name() { return NAME; },
12
+ get syntax() { return "proto3"; },
13
+ get dependency() { return []; },
14
+ get enumType() { return EMPTY_ARR; },
15
+ get messageType() { return EMPTY_ARR; },
16
+ get service() { return EMPTY_ARR; },
17
+ get extension() { return EMPTY_ARR; },
18
+ get proto() {
19
+ return {
20
+ name: NAME,
21
+ syntax: "proto3",
22
+ enumType: EMPTY_ARR,
23
+ messageType: EMPTY_ARR,
24
+ service: EMPTY_ARR,
25
+ extension: EMPTY_ARR,
26
+ };
27
+ },
28
+ } as unknown as GenFile;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Stub for google/api/visibility.proto dependency.
3
+ * The generated code references this for file descriptor linking; we export a minimal
4
+ * placeholder so the SDK builds without the full google API proto source.
5
+ */
6
+ import type { GenFile } from "@bufbuild/protobuf/codegenv2";
7
+
8
+ const NAME = "google/api/visibility.proto";
9
+ const EMPTY_ARR: never[] = [];
10
+ export const file_google_api_visibility: GenFile = {
11
+ get name() { return NAME; },
12
+ get syntax() { return "proto3"; },
13
+ get dependency() { return []; },
14
+ get enumType() { return EMPTY_ARR; },
15
+ get messageType() { return EMPTY_ARR; },
16
+ get service() { return EMPTY_ARR; },
17
+ get extension() { return EMPTY_ARR; },
18
+ get proto() {
19
+ return {
20
+ name: NAME,
21
+ syntax: "proto3",
22
+ enumType: EMPTY_ARR,
23
+ messageType: EMPTY_ARR,
24
+ service: EMPTY_ARR,
25
+ extension: EMPTY_ARR,
26
+ };
27
+ },
28
+ } as unknown as GenFile;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Stub for protoc-gen-openapiv2/options/annotations.proto dependency.
3
+ * The generated code references this for file descriptor linking; we export a minimal
4
+ * placeholder so the SDK builds without the full openapiv2 options proto source.
5
+ */
6
+ import type { GenFile } from "@bufbuild/protobuf/codegenv2";
7
+
8
+ const NAME = "protoc-gen-openapiv2/options/annotations.proto";
9
+ const EMPTY_ARR: never[] = [];
10
+ export const file_protoc_gen_openapiv2_options_annotations: GenFile = {
11
+ get name() { return NAME; },
12
+ get syntax() { return "proto3"; },
13
+ get dependency() { return []; },
14
+ get enumType() { return EMPTY_ARR; },
15
+ get messageType() { return EMPTY_ARR; },
16
+ get service() { return EMPTY_ARR; },
17
+ get extension() { return EMPTY_ARR; },
18
+ get proto() {
19
+ return {
20
+ name: NAME,
21
+ syntax: "proto3",
22
+ enumType: EMPTY_ARR,
23
+ messageType: EMPTY_ARR,
24
+ service: EMPTY_ARR,
25
+ extension: EMPTY_ARR,
26
+ };
27
+ },
28
+ } as unknown as GenFile;