@scalekit-sdk/node 2.1.7 → 2.1.9

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 (83) 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 +172 -19
  15. package/lib/domain.js +192 -31
  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 +231 -62
  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
  83. package/tests/domain.test.ts +54 -0
package/buf.gen.yaml CHANGED
@@ -19,3 +19,4 @@ types:
19
19
  - scalekit.v1.sessions
20
20
  - scalekit.v1.roles
21
21
  - scalekit.v1.auth
22
+ - scalekit.v1.auth.webauthn
package/lib/auth.d.ts CHANGED
@@ -1,21 +1,53 @@
1
- import { Empty, PartialMessage, JsonValue } from '@bufbuild/protobuf';
2
- import CoreClient from './core';
3
- import GrpcConnect from './connect';
4
- import { User } from './pkg/grpc/scalekit/v1/auth/auth_pb';
1
+ import { Empty, PartialMessage, JsonValue } from "@bufbuild/protobuf";
2
+ import CoreClient from "./core";
3
+ import GrpcConnect from "./connect";
4
+ import { User } from "./pkg/grpc/scalekit/v1/auth/auth_pb";
5
5
  type UserInput = PartialMessage<User> & {
6
6
  customAttributes?: Record<string, JsonValue>;
7
7
  };
8
+ /**
9
+ * If you are using Auth for MCP solution of Scalekit in "Bring your own Auth" mode, this client helps updating Scalekit with the currently logged in user details for the ongoing authentication request.
10
+ *
11
+ *
12
+ * @example
13
+ * const scalekitClient = new ScalekitClient(envUrl, clientId, clientSecret);
14
+ * const authClient = scalekitClient.auth;
15
+ *
16
+ * @see {@link https://docs.scalekit.com/apis/#tag/api%20auth | Authentication API Documentation}
17
+ */
8
18
  export default class AuthClient {
9
19
  private readonly grpcConnect;
10
20
  private readonly coreClient;
11
21
  private readonly client;
12
22
  constructor(grpcConnect: GrpcConnect, coreClient: CoreClient);
13
23
  /**
14
- * Update user details for an ongoing login request.
15
- * @param {string} connectionId The connection ID used for authentication.
16
- * @param {string} loginRequestId The login request identifier issued during auth initiation.
17
- * @param {UserInput} user User details to associate with the login request.
18
- * @returns {Promise<Empty>} Empty response.
24
+ * Updates user details for an ongoing authentication request.
25
+ *
26
+ *
27
+ * @param {string} connectionId - The SSO connection ID being used for authentication
28
+ * @param {string} loginRequestId - The unique login request identifier from the auth flow
29
+ * @param {UserInput} user - User details to update or associate with the login request
30
+ * @param {string} [user.email] - User's email address
31
+ * @param {string} [user.sub] - Unique user identifier (subject)
32
+ *
33
+ * @returns {Promise<Empty>} Empty response on successful update
34
+ *
35
+ * @throws {Error} When connectionId is missing or invalid
36
+ * @throws {Error} When loginRequestId is missing or invalid
37
+ * @throws {Error} When user object is invalid
38
+ *
39
+ * @example
40
+ * await scalekitClient.auth.updateLoginUserDetails(
41
+ * 'conn_abc123',
42
+ * 'login_xyz789',
43
+ * {
44
+ * email: 'john.doe@company.com',
45
+ * sub: 'unique_user_id_456',
46
+ * }
47
+ * );
48
+ *
49
+ *
50
+ * @see {@link https://docs.scalekit.com/apis/#tag/api%20auth | Update Login User Details API}
19
51
  */
20
52
  updateLoginUserDetails(connectionId: string, loginRequestId: string, user: UserInput): Promise<Empty>;
21
53
  }
package/lib/auth.js CHANGED
@@ -23,6 +23,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  const protobuf_1 = require("@bufbuild/protobuf");
24
24
  const auth_connect_1 = require("./pkg/grpc/scalekit/v1/auth/auth_connect");
25
25
  const auth_pb_1 = require("./pkg/grpc/scalekit/v1/auth/auth_pb");
26
+ /**
27
+ * If you are using Auth for MCP solution of Scalekit in "Bring your own Auth" mode, this client helps updating Scalekit with the currently logged in user details for the ongoing authentication request.
28
+ *
29
+ *
30
+ * @example
31
+ * const scalekitClient = new ScalekitClient(envUrl, clientId, clientSecret);
32
+ * const authClient = scalekitClient.auth;
33
+ *
34
+ * @see {@link https://docs.scalekit.com/apis/#tag/api%20auth | Authentication API Documentation}
35
+ */
26
36
  class AuthClient {
27
37
  constructor(grpcConnect, coreClient) {
28
38
  this.grpcConnect = grpcConnect;
@@ -30,22 +40,44 @@ class AuthClient {
30
40
  this.client = this.grpcConnect.createClient(auth_connect_1.AuthService);
31
41
  }
32
42
  /**
33
- * Update user details for an ongoing login request.
34
- * @param {string} connectionId The connection ID used for authentication.
35
- * @param {string} loginRequestId The login request identifier issued during auth initiation.
36
- * @param {UserInput} user User details to associate with the login request.
37
- * @returns {Promise<Empty>} Empty response.
43
+ * Updates user details for an ongoing authentication request.
44
+ *
45
+ *
46
+ * @param {string} connectionId - The SSO connection ID being used for authentication
47
+ * @param {string} loginRequestId - The unique login request identifier from the auth flow
48
+ * @param {UserInput} user - User details to update or associate with the login request
49
+ * @param {string} [user.email] - User's email address
50
+ * @param {string} [user.sub] - Unique user identifier (subject)
51
+ *
52
+ * @returns {Promise<Empty>} Empty response on successful update
53
+ *
54
+ * @throws {Error} When connectionId is missing or invalid
55
+ * @throws {Error} When loginRequestId is missing or invalid
56
+ * @throws {Error} When user object is invalid
57
+ *
58
+ * @example
59
+ * await scalekitClient.auth.updateLoginUserDetails(
60
+ * 'conn_abc123',
61
+ * 'login_xyz789',
62
+ * {
63
+ * email: 'john.doe@company.com',
64
+ * sub: 'unique_user_id_456',
65
+ * }
66
+ * );
67
+ *
68
+ *
69
+ * @see {@link https://docs.scalekit.com/apis/#tag/api%20auth | Update Login User Details API}
38
70
  */
39
71
  updateLoginUserDetails(connectionId, loginRequestId, user) {
40
72
  return __awaiter(this, void 0, void 0, function* () {
41
- if (!connectionId || typeof connectionId !== 'string') {
42
- throw new Error('connectionId must be a non-empty string');
73
+ if (!connectionId || typeof connectionId !== "string") {
74
+ throw new Error("connectionId must be a non-empty string");
43
75
  }
44
- if (!loginRequestId || typeof loginRequestId !== 'string') {
45
- throw new Error('loginRequestId must be a non-empty string');
76
+ if (!loginRequestId || typeof loginRequestId !== "string") {
77
+ throw new Error("loginRequestId must be a non-empty string");
46
78
  }
47
- if (!user || typeof user !== 'object') {
48
- throw new Error('user must be a valid object');
79
+ if (!user || typeof user !== "object") {
80
+ throw new Error("user must be a valid object");
49
81
  }
50
82
  const { customAttributes } = user, rest = __rest(user, ["customAttributes"]);
51
83
  const userMessage = new auth_pb_1.User(rest);
@@ -55,7 +87,7 @@ class AuthClient {
55
87
  const request = new auth_pb_1.UpdateLoginUserDetailsRequest({
56
88
  connectionId,
57
89
  loginRequestId,
58
- user: userMessage
90
+ user: userMessage,
59
91
  });
60
92
  return this.coreClient.connectExec(this.client.updateLoginUserDetails, request);
61
93
  });
package/lib/auth.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA8E;AAI9E,2EAAuE;AACvE,iEAA0F;AAM1F,MAAqB,UAAU;IAG7B,YACmB,WAAwB,EACxB,UAAsB;QADtB,gBAAW,GAAX,WAAW,CAAa;QACxB,eAAU,GAAV,UAAU,CAAY;QAEvC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,0BAAW,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;OAMG;IACG,sBAAsB,CAC1B,YAAoB,EACpB,cAAsB,EACtB,IAAe;;YAEf,IAAI,CAAC,YAAY,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;gBACtD,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;YAC7D,CAAC;YAED,IAAI,CAAC,cAAc,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;gBAC1D,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;YAC/D,CAAC;YAED,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACtC,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;YACjD,CAAC;YAED,MAAM,EAAE,gBAAgB,KAAc,IAAI,EAAb,IAAI,UAAK,IAAI,EAApC,oBAA6B,CAAO,CAAC;YAC3C,MAAM,WAAW,GAAG,IAAI,cAAI,CAAC,IAA4B,CAAC,CAAC;YAE3D,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;gBACnC,WAAW,CAAC,gBAAgB,GAAG,iBAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;YACnE,CAAC;YAED,MAAM,OAAO,GAAG,IAAI,uCAA6B,CAAC;gBAChD,YAAY;gBACZ,cAAc;gBACd,IAAI,EAAE,WAAW;aAClB,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAClC,OAAO,CACR,CAAC;QACJ,CAAC;KAAA;CACF;AApDD,6BAoDC"}
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA8E;AAI9E,2EAAuE;AACvE,iEAG6C;AAM7C;;;;;;;;;GASG;AACH,MAAqB,UAAU;IAG7B,YACmB,WAAwB,EACxB,UAAsB;QADtB,gBAAW,GAAX,WAAW,CAAa;QACxB,eAAU,GAAV,UAAU,CAAY;QAEvC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,0BAAW,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,sBAAsB,CAC1B,YAAoB,EACpB,cAAsB,EACtB,IAAe;;YAEf,IAAI,CAAC,YAAY,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;gBACtD,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;YAC7D,CAAC;YAED,IAAI,CAAC,cAAc,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;gBAC1D,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;YAC/D,CAAC;YAED,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACtC,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;YACjD,CAAC;YAED,MAAM,EAAE,gBAAgB,KAAc,IAAI,EAAb,IAAI,UAAK,IAAI,EAApC,oBAA6B,CAAO,CAAC;YAC3C,MAAM,WAAW,GAAG,IAAI,cAAI,CAAC,IAA4B,CAAC,CAAC;YAE3D,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;gBACnC,WAAW,CAAC,gBAAgB,GAAG,iBAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;YACnE,CAAC;YAED,MAAM,OAAO,GAAG,IAAI,uCAA6B,CAAC;gBAChD,YAAY;gBACZ,cAAc;gBACd,IAAI,EAAE,WAAW;aAClB,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAClC,OAAO,CACR,CAAC;QACJ,CAAC;KAAA;CACF;AA1ED,6BA0EC"}
@@ -1,42 +1,216 @@
1
- import GrpcConnect from './connect';
2
- import CoreClient from './core';
3
- import { GetConnectionResponse, ToggleConnectionResponse, ListConnectionsResponse } from './pkg/grpc/scalekit/v1/connections/connections_pb';
1
+ import GrpcConnect from "./connect";
2
+ import CoreClient from "./core";
3
+ import { GetConnectionResponse, ToggleConnectionResponse, ListConnectionsResponse } from "./pkg/grpc/scalekit/v1/connections/connections_pb";
4
+ /**
5
+ * Client for managing enterprise SSO connections for organizations.
6
+ *
7
+ * Connections represent the SSO integration between an organization and their identity provider (IdP).
8
+ * Each organization can have an enterprise connection supporting different protocols (SAML, OIDC) and
9
+ * providers (Okta, Azure AD, Google Workspace, etc.). Use this client to retrieve connection details,
10
+ * list connections, and enable/disable them.
11
+ *
12
+ * @example
13
+ * const scalekitClient = new ScalekitClient(envUrl, clientId, clientSecret);
14
+ * const connectionClient = scalekitClient.connection;
15
+ *
16
+ * @see {@link https://docs.scalekit.com/apis/#tag/connections | Connection API Documentation}
17
+ */
4
18
  export default class ConnectionClient {
5
19
  private readonly grpcConncet;
6
20
  private readonly coreClient;
7
21
  private client;
8
22
  constructor(grpcConncet: GrpcConnect, coreClient: CoreClient);
9
23
  /**
10
- * Get a connection by id and organization id
11
- * @param organizationId The organization id
12
- * @param id The connection id
13
- * @returns {Promise<GetConnectionResponse>} The connection
24
+ * Retrieves complete configuration and status details for a specific SSO connection.
25
+ *
26
+ * Use this method to fetch comprehensive information about an organization's SSO connection,
27
+ * including provider settings, protocol details (SAML/OIDC), enabled status, and configuration
28
+ * metadata. This is useful for verifying connection setup, auditing configurations, checking
29
+ * connection health before authentication flows, or displaying connection details to administrators.
30
+ *
31
+ * @param {string} organizationId - The organization ID that owns the connection (format: "org_...")
32
+ * @param {string} id - The connection identifier to retrieve (format: "conn_...")
33
+ *
34
+ * @returns {Promise<GetConnectionResponse>} Response containing:
35
+ * - connection: Complete connection object with:
36
+ * - id: Unique connection identifier
37
+ * - organizationId: Parent organization ID
38
+ * - provider: Identity provider name (e.g., "okta", "azure_ad", "google")
39
+ * - type: Protocol type ("saml", "oidc")
40
+ * - enabled: Whether the connection is active
41
+ * - status: Configuration status
42
+ * - domains: Associated email domains for this connection
43
+ * - metadata: Provider-specific configuration details
44
+ * - createTime: When the connection was created
45
+ * - updateTime: When the connection was last modified
46
+ *
47
+ * @throws {Error} If the organization or connection is not found
48
+ *
49
+ * @example
50
+ * // Get connection details
51
+ * const response = await scalekitClient.connection.getConnection(
52
+ * 'org_123456',
53
+ * 'conn_abc123'
54
+ * );
55
+ *
56
+ * const conn = response.connection;
57
+ * console.log('Provider:', conn.provider);
58
+ * console.log('Type:', conn.type);
59
+ * console.log('Status:', conn.enabled ? 'Enabled' : 'Disabled');
60
+ * console.log('Domains:', conn.domains);
61
+ *
62
+ * @example
63
+ * // Verify connection is ready for authentication
64
+ * const response = await scalekitClient.connection.getConnection(orgId, connId);
65
+ *
66
+ * if (response.connection.enabled && response.connection.status === 'active') {
67
+ * console.log('Connection is ready for SSO authentication');
68
+ * } else {
69
+ * console.log('Connection not ready:', response.connection.status);
70
+ * }
71
+ *
72
+ *
73
+ * @see {@link https://docs.scalekit.com/apis/#tag/connections | Get Connection API}
74
+ * @see {@link listConnections} - List all connections for an organization
75
+ * @see {@link enableConnection} - Enable this connection
76
+ * @see {@link disableConnection} - Disable this connection
14
77
  */
15
78
  getConnection(organizationId: string, id: string): Promise<GetConnectionResponse>;
16
79
  /**
17
- * List connections by domain
18
- * @param domain The domain
19
- * @returns {Promise<ListConnectionsResponse>} The connection
80
+ * Lists all SSO connections associated with a specific email domain.
81
+ *
82
+ * Use this method to discover which organizations have SSO configured for a particular
83
+ * domain. This is useful for implementing domain-based SSO routing where users are
84
+ * automatically directed to their organization's SSO based on their email domain.
85
+ *
86
+ * @param {string} domain - The email domain to search for (e.g., "acme.com")
87
+ *
88
+ * @returns {Promise<ListConnectionsResponse>} Response containing:
89
+ * - connections: Array of connection objects for the domain
90
+ *
91
+ * @example
92
+ * // Find SSO connections for a domain
93
+ * const response = await scalekitClient.connection.listConnectionsByDomain('acme.com');
94
+ *
95
+ * if (response.connections.length > 0) {
96
+ * console.log('SSO available for domain acme.com');
97
+ * const connection = response.connections[0];
98
+ * console.log('Organization:', connection.organizationId);
99
+ * console.log('Provider:', connection.provider);
100
+ * }
101
+ *
102
+ * @example
103
+ * // Implement domain-based SSO routing
104
+ * app.post('/auth/login', async (req, res) => {
105
+ * const email = req.body.email;
106
+ * const domain = email.split('@')[1];
107
+ *
108
+ * const response = await scalekitClient.connection.listConnectionsByDomain(domain);
109
+ *
110
+ * if (response.connections.length > 0) {
111
+ * // Redirect to SSO
112
+ * const authUrl = scalekitClient.getAuthorizationUrl(redirectUri, {
113
+ * connectionId: response.connections[0].id,
114
+ * loginHint: email
115
+ * });
116
+ * return res.redirect(authUrl);
117
+ * } else {
118
+ * // Use password-based login
119
+ * return res.render('password-login');
120
+ * }
121
+ * });
122
+ *
123
+ * @see {@link https://docs.scalekit.com/apis/#tag/connections | List Connections API}
124
+ * @see {@link listConnections} - List all connections for an organization
20
125
  */
21
126
  listConnectionsByDomain(domain: string): Promise<ListConnectionsResponse>;
22
127
  /**
23
- * List connections by organization id
24
- * @param organizationId The organization id
25
- * @returns {Promise<ListConnectionsResponse>} The list of connections
128
+ * Lists all SSO connections configured for an organization.
129
+ *
130
+ * Retrieves all enterprise SSO connections (SAML, OIDC) that have been configured for
131
+ * the specified organization. Each connection includes details about the provider,
132
+ * status, and configuration.
133
+ *
134
+ * @param {string} organizationId - The organization ID
135
+ *
136
+ * @returns {Promise<ListConnectionsResponse>} Response containing:
137
+ * - connections: Array of connection objects with provider details and status
138
+ *
139
+ * @example
140
+ * // List all SSO connections for an organization
141
+ * const response = await scalekitClient.connection.listConnections('org_123456');
142
+ *
143
+ * console.log(`Found ${response.connections.length} connections`);
144
+ * response.connections.forEach(conn => {
145
+ * console.log(`- ${conn.provider} (${conn.type}): ${conn.enabled ? 'Enabled' : 'Disabled'}`);
146
+ * });
147
+ *
148
+ * @example
149
+ * // Check if organization has any enabled connections
150
+ * const response = await scalekitClient.connection.listConnections('org_123456');
151
+ * const hasEnabledSSO = response.connections.some(conn => conn.enabled);
152
+ *
153
+ * if (!hasEnabledSSO) {
154
+ * console.log('No SSO connections enabled for this organization');
155
+ * }
156
+ *
157
+ * @see {@link https://docs.scalekit.com/apis/#tag/connections | List Connections API}
158
+ * @see {@link getConnection} - Get details of a specific connection
159
+ * @see {@link enableConnection} - Enable a connection
160
+ * @see {@link disableConnection} - Disable a connection
26
161
  */
27
162
  listConnections(organizationId: string): Promise<ListConnectionsResponse>;
28
163
  /**
29
- * Enable a connection by id and organization id
30
- * @param organizationId The organization id
31
- * @param id The connection id
32
- * @returns {Promise<ToggleConnectionResponse>} The connection enable response
164
+ * Enables an SSO connection for an organization.
165
+ *
166
+ * Activates a previously disabled or newly configured SSO connection, allowing users
167
+ * from the organization to authenticate using this identity provider. Once enabled,
168
+ * users can immediately start using SSO to log in.
169
+ *
170
+ * @param {string} organizationId - The organization ID
171
+ * @param {string} id - The connection ID to enable
172
+ *
173
+ * @returns {Promise<ToggleConnectionResponse>} Response with updated connection status
174
+ *
175
+ * @example
176
+ * // Enable an SSO connection
177
+ * const response = await scalekitClient.connection.enableConnection(
178
+ * 'org_123456',
179
+ * 'conn_abc123'
180
+ * );
181
+ *
182
+ * console.log('Connection enabled:', response.connection.enabled); // true
183
+ *
184
+ *
185
+ * @see {@link https://docs.scalekit.com/apis/#tag/connections | Enable Connection API}
186
+ * @see {@link disableConnection} - Disable a connection
187
+ * @see {@link listConnections} - List all connections
33
188
  */
34
189
  enableConnection(organizationId: string, id: string): Promise<ToggleConnectionResponse>;
35
190
  /**
36
- * Disable a connection by id and organization id
37
- * @param organizationId The organization id
38
- * @param id The connection id
39
- * @returns {Promise<ToggleConnectionResponse>} The connection enable response
191
+ * Disables an SSO connection for an organization.
192
+ *
193
+ * Deactivates an SSO connection, preventing users from authenticating via this identity
194
+ * provider. This is useful for temporarily suspending SSO access, during maintenance,
195
+ * or when migrating to a different provider. Existing user sessions remain valid.
196
+ *
197
+ * @param {string} organizationId - The organization ID
198
+ * @param {string} id - The connection ID to disable
199
+ *
200
+ * @returns {Promise<ToggleConnectionResponse>} Response with updated connection status
201
+ *
202
+ * @example
203
+ * // Disable an SSO connection
204
+ * const response = await scalekitClient.connection.disableConnection(
205
+ * 'org_123456',
206
+ * 'conn_abc123'
207
+ * );
208
+ *
209
+ * console.log('Connection disabled:', !response.connection.enabled); // true
210
+ *
211
+ * @see {@link https://docs.scalekit.com/apis/#tag/connections | Disable Connection API}
212
+ * @see {@link enableConnection} - Enable a connection
213
+ * @see {@link listConnections} - List all connections
40
214
  */
41
215
  disableConnection(organizationId: string, id: string): Promise<ToggleConnectionResponse>;
42
216
  }