@scalekit-sdk/node 2.1.7 → 2.1.8

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 (82) hide show
  1. package/buf.gen.yaml +1 -0
  2. package/lib/auth.d.ts +41 -9
  3. package/lib/auth.js +44 -12
  4. package/lib/auth.js.map +1 -1
  5. package/lib/connection.d.ts +195 -21
  6. package/lib/connection.js +197 -23
  7. package/lib/connection.js.map +1 -1
  8. package/lib/core.d.ts +2 -2
  9. package/lib/core.js +13 -12
  10. package/lib/core.js.map +1 -1
  11. package/lib/directory.d.ts +293 -40
  12. package/lib/directory.js +308 -44
  13. package/lib/directory.js.map +1 -1
  14. package/lib/domain.d.ts +166 -18
  15. package/lib/domain.js +178 -29
  16. package/lib/domain.js.map +1 -1
  17. package/lib/organization.d.ts +404 -44
  18. package/lib/organization.js +419 -54
  19. package/lib/organization.js.map +1 -1
  20. package/lib/permission.d.ts +179 -35
  21. package/lib/permission.js +190 -38
  22. package/lib/permission.js.map +1 -1
  23. package/lib/pkg/grpc/scalekit/v1/auth/auth_connect.d.ts +3 -3
  24. package/lib/pkg/grpc/scalekit/v1/auth/auth_connect.js +2 -2
  25. package/lib/pkg/grpc/scalekit/v1/auth/auth_connect.js.map +1 -1
  26. package/lib/pkg/grpc/scalekit/v1/auth/auth_pb.d.ts +16 -16
  27. package/lib/pkg/grpc/scalekit/v1/auth/auth_pb.js +21 -21
  28. package/lib/pkg/grpc/scalekit/v1/auth/auth_pb.js.map +1 -1
  29. package/lib/pkg/grpc/scalekit/v1/auth/webauthn_connect.d.ts +82 -0
  30. package/lib/pkg/grpc/scalekit/v1/auth/webauthn_connect.js +90 -0
  31. package/lib/pkg/grpc/scalekit/v1/auth/webauthn_connect.js.map +1 -0
  32. package/lib/pkg/grpc/scalekit/v1/auth/webauthn_pb.d.ts +647 -0
  33. package/lib/pkg/grpc/scalekit/v1/auth/webauthn_pb.js +993 -0
  34. package/lib/pkg/grpc/scalekit/v1/auth/webauthn_pb.js.map +1 -0
  35. package/lib/pkg/grpc/scalekit/v1/commons/commons_pb.d.ts +142 -0
  36. package/lib/pkg/grpc/scalekit/v1/commons/commons_pb.js +165 -1
  37. package/lib/pkg/grpc/scalekit/v1/commons/commons_pb.js.map +1 -1
  38. package/lib/pkg/grpc/scalekit/v1/connections/connections_connect.d.ts +1 -10
  39. package/lib/pkg/grpc/scalekit/v1/connections/connections_connect.js +0 -9
  40. package/lib/pkg/grpc/scalekit/v1/connections/connections_connect.js.map +1 -1
  41. package/lib/pkg/grpc/scalekit/v1/connections/connections_pb.d.ts +28 -63
  42. package/lib/pkg/grpc/scalekit/v1/connections/connections_pb.js +9 -90
  43. package/lib/pkg/grpc/scalekit/v1/connections/connections_pb.js.map +1 -1
  44. package/lib/pkg/grpc/scalekit/v1/users/users_pb.d.ts +2 -2
  45. package/lib/pkg/grpc/scalekit/v1/users/users_pb.js +1 -1
  46. package/lib/pkg/grpc/scalekit/v1/users/users_pb.js.map +1 -1
  47. package/lib/role.d.ts +252 -56
  48. package/lib/role.js +262 -62
  49. package/lib/role.js.map +1 -1
  50. package/lib/scalekit.d.ts +323 -54
  51. package/lib/scalekit.js +354 -76
  52. package/lib/scalekit.js.map +1 -1
  53. package/lib/session.d.ts +235 -22
  54. package/lib/session.js +237 -24
  55. package/lib/session.js.map +1 -1
  56. package/lib/user.d.ts +571 -53
  57. package/lib/user.js +598 -89
  58. package/lib/user.js.map +1 -1
  59. package/lib/webauthn.d.ts +33 -0
  60. package/lib/webauthn.js +80 -0
  61. package/lib/webauthn.js.map +1 -0
  62. package/package.json +2 -2
  63. package/src/auth.ts +53 -19
  64. package/src/connection.ts +237 -62
  65. package/src/core.ts +39 -33
  66. package/src/directory.ts +356 -98
  67. package/src/domain.ts +215 -68
  68. package/src/organization.ts +490 -112
  69. package/src/permission.ts +234 -88
  70. package/src/pkg/grpc/scalekit/v1/auth/auth_connect.ts +3 -3
  71. package/src/pkg/grpc/scalekit/v1/auth/auth_pb.ts +24 -24
  72. package/src/pkg/grpc/scalekit/v1/auth/webauthn_connect.ts +89 -0
  73. package/src/pkg/grpc/scalekit/v1/auth/webauthn_pb.ts +1263 -0
  74. package/src/pkg/grpc/scalekit/v1/commons/commons_pb.ts +217 -0
  75. package/src/pkg/grpc/scalekit/v1/connections/connections_connect.ts +1 -10
  76. package/src/pkg/grpc/scalekit/v1/connections/connections_pb.ts +42 -129
  77. package/src/pkg/grpc/scalekit/v1/users/users_pb.ts +3 -3
  78. package/src/role.ts +336 -136
  79. package/src/scalekit.ts +478 -149
  80. package/src/session.ts +266 -63
  81. package/src/user.ts +675 -168
  82. package/src/webauthn.ts +98 -0
@@ -0,0 +1,98 @@
1
+ import { PromiseClient } from '@connectrpc/connect';
2
+ import GrpcConnect from './connect';
3
+ import CoreClient from './core';
4
+ import { WebAuthnService } from './pkg/grpc/scalekit/v1/auth/webauthn_connect';
5
+ import {
6
+ ListCredentialsRequest,
7
+ ListCredentialsResponse,
8
+ UpdateCredentialRequest,
9
+ UpdateCredentialResponse,
10
+ DeleteCredentialRequest,
11
+ DeleteCredentialResponse
12
+ } from './pkg/grpc/scalekit/v1/auth/webauthn_pb';
13
+
14
+ export default class WebAuthnClient {
15
+ private client: PromiseClient<typeof WebAuthnService>;
16
+
17
+ constructor(
18
+ private readonly grpcConnect: GrpcConnect,
19
+ private readonly coreClient: CoreClient
20
+ ) {
21
+ this.client = this.grpcConnect.createClient(WebAuthnService);
22
+ }
23
+
24
+ /**
25
+ * List all WebAuthn credentials for a user
26
+ * @param {string} userId The user ID to list credentials for
27
+ * @returns {Promise<ListCredentialsResponse>} The response containing:
28
+ * - credentials: Array of WebAuthn credentials
29
+ * - allAcceptedCredentialsOptions: Options for all accepted credentials
30
+ */
31
+ async listCredentials(userId: string): Promise<ListCredentialsResponse> {
32
+ if (!userId || typeof userId !== 'string') {
33
+ throw new Error('userId must be a non-empty string');
34
+ }
35
+
36
+ const request = new ListCredentialsRequest({
37
+ userId
38
+ });
39
+
40
+ return this.coreClient.connectExec(
41
+ this.client.listCredentials,
42
+ request
43
+ );
44
+ }
45
+
46
+ /**
47
+ * Update a WebAuthn credential's display name
48
+ * @param {string} credentialId The credential ID to update
49
+ * @param {string} displayName The new display name for the credential
50
+ * @returns {Promise<UpdateCredentialResponse>} The response containing:
51
+ * - credential: The updated WebAuthn credential
52
+ */
53
+ async updateCredential(
54
+ credentialId: string,
55
+ displayName: string
56
+ ): Promise<UpdateCredentialResponse> {
57
+ if (!credentialId || typeof credentialId !== 'string') {
58
+ throw new Error('credentialId must be a non-empty string');
59
+ }
60
+
61
+ if (!displayName || typeof displayName !== 'string') {
62
+ throw new Error('displayName must be a non-empty string');
63
+ }
64
+
65
+ const request = new UpdateCredentialRequest({
66
+ credentialId,
67
+ displayName
68
+ });
69
+
70
+ return this.coreClient.connectExec(
71
+ this.client.updateCredential,
72
+ request
73
+ );
74
+ }
75
+
76
+ /**
77
+ * Delete a WebAuthn credential
78
+ * @param {string} credentialId The credential ID to delete
79
+ * @returns {Promise<DeleteCredentialResponse>} The response containing:
80
+ * - success: Boolean indicating if the deletion was successful
81
+ * - unknownCredentialOptions: Options if the credential was not found
82
+ */
83
+ async deleteCredential(credentialId: string): Promise<DeleteCredentialResponse> {
84
+ if (!credentialId || typeof credentialId !== 'string') {
85
+ throw new Error('credentialId must be a non-empty string');
86
+ }
87
+
88
+ const request = new DeleteCredentialRequest({
89
+ credentialId
90
+ });
91
+
92
+ return this.coreClient.connectExec(
93
+ this.client.deleteCredential,
94
+ request
95
+ );
96
+ }
97
+ }
98
+