@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
@@ -1,84 +1,444 @@
1
- import { Empty, PartialMessage } from '@bufbuild/protobuf';
2
- import GrpcConnect from './connect';
3
- import CoreClient from './core';
4
- import { CreateOrganizationResponse, GetOrganizationResponse, Link, ListOrganizationsResponse, OrganizationUserManagementSettings as OrganizationUserManagementSettingsMessage, UpdateOrganization, UpdateOrganizationResponse } from './pkg/grpc/scalekit/v1/organizations/organizations_pb';
5
- import { OrganizationSettings, OrganizationUserManagementSettingsInput } from './types/organization';
1
+ import { Empty, PartialMessage } from "@bufbuild/protobuf";
2
+ import GrpcConnect from "./connect";
3
+ import CoreClient from "./core";
4
+ import { CreateOrganizationResponse, GetOrganizationResponse, Link, ListOrganizationsResponse, OrganizationUserManagementSettings as OrganizationUserManagementSettingsMessage, UpdateOrganization, UpdateOrganizationResponse } from "./pkg/grpc/scalekit/v1/organizations/organizations_pb";
5
+ import { OrganizationSettings, OrganizationUserManagementSettingsInput } from "./types/organization";
6
+ /**
7
+ * Client for managing organizations (tenants) in your Scalekit application.
8
+ *
9
+ * Organizations represent your B2B customers or tenants. Each organization can have
10
+ * its own SSO connection, users, and settings. Use this client to perform CRUD
11
+ * operations on organizations and manage organization-level configurations.
12
+ *
13
+ * @example
14
+ * const scalekitClient = new ScalekitClient(envUrl, clientId, clientSecret);
15
+ * const orgClient = scalekitClient.organization;
16
+ *
17
+ * @see {@link https://docs.scalekit.com/apis/#tag/organizations | Organization API Documentation}
18
+ */
6
19
  export default class OrganizationClient {
7
20
  private readonly grpcConncet;
8
21
  private readonly coreClient;
9
22
  private client;
10
23
  constructor(grpcConncet: GrpcConnect, coreClient: CoreClient);
11
24
  /**
12
- * Create an organization with the given name. Optionally, you can provide an external id.
13
- * @param {string} name The organization name
14
- * @param {object} options The options to create an organization
15
- * @param {string} options.externalId The external id
16
- * @returns {Promise<CreateOrganizationResponse>} The created organization
17
- */
25
+ * Creates a new organization (tenant) in your Scalekit application.
26
+ *
27
+ * Organizations represent your B2B customers. Each organization can have its own
28
+ * SSO connections, users, and configuration. Use the external ID to map Scalekit
29
+ * organizations to your internal system's identifiers.
30
+ *
31
+ * @param {string} name - Display name for the organization (e.g., "Acme Corporation")
32
+ * @param {object} [options] - Optional configuration
33
+ * @param {string} [options.externalId] - Your system's unique identifier for this organization.
34
+ * Useful for mapping to your internal database.
35
+ *
36
+ * @returns {Promise<CreateOrganizationResponse>} The created organization with:
37
+ * - id: Scalekit's unique organization identifier
38
+ * - displayName: The organization's name
39
+ * - externalId: Unique Identifier of this organization as identified in your system. (if provided)
40
+ * - createTime: When the organization was created
41
+ * - updateTime: When the organization was last updated
42
+ *
43
+ * @example
44
+ * // Create a basic organization
45
+ * const org = await scalekitClient.organization.createOrganization('Acme Corp');
46
+ * console.log('Organization ID:', org.organization.id);
47
+ *
48
+ * @example
49
+ * // Create organization with external ID mapping
50
+ * const org = await scalekitClient.organization.createOrganization(
51
+ * 'Acme Corporation',
52
+ * { externalId: 'customer_12345' }
53
+ * );
54
+ * // Now you can look up this organization using either Scalekit ID or your external ID
55
+ *
56
+ * @see {@link https://docs.scalekit.com/apis/#tag/organizations | Create Organization API}
57
+ * @see {@link getOrganization} - Retrieve organization by Scalekit ID
58
+ * @see {@link getOrganizationByExternalId} - Retrieve organization by your external ID
59
+ */
18
60
  createOrganization(name: string, options?: {
19
61
  externalId?: string;
20
62
  }): Promise<CreateOrganizationResponse>;
21
63
  /**
22
- * List organizations with pagination
23
- * @param {object} options The options to list organizations
24
- * @param {number} options.pageSize The page size
25
- * @param {string} options.pageToken The page token
26
- * @returns {Promise<ListOrganizationResponse>} The list of organizations
64
+ * Retrieves a paginated list of all organizations in your Scalekit environment.
65
+ *
66
+ * This method returns all organizations with support for pagination. Use this to
67
+ * display a list of your B2B customers, search for organizations, or perform bulk operations.
68
+ *
69
+ * @param {object} [options] - Optional pagination parameters
70
+ * @param {number} [options.pageSize] - Number of organizations to return per page (default: 10, max: 100)
71
+ * @param {string} [options.pageToken] - Token for retrieving the next page of results.
72
+ * Obtained from the previous response's nextPageToken.
73
+ *
74
+ * @returns {Promise<ListOrganizationsResponse>} Response containing:
75
+ * - organizations: Array of organization objects
76
+ * - nextPageToken: Token for fetching the next page (empty if no more pages)
77
+ * - totalSize: Total number of organizations
78
+ *
79
+ * @example
80
+ * // List first page of organizations
81
+ * const response = await scalekitClient.organization.listOrganization({
82
+ * pageSize: 20
83
+ * });
84
+ *
85
+ * console.log('Organizations:', response.organizations);
86
+ * console.log('Total:', response.totalSize);
87
+ *
88
+ * @example
89
+ * // Paginate through all organizations
90
+ * let pageToken = undefined;
91
+ * let allOrgs = [];
92
+ *
93
+ * do {
94
+ * const response = await scalekitClient.organization.listOrganization({
95
+ * pageSize: 50,
96
+ * pageToken
97
+ * });
98
+ *
99
+ * allOrgs.push(...response.organizations);
100
+ * pageToken = response.nextPageToken;
101
+ * } while (pageToken);
102
+ *
103
+ * console.log('Fetched all organizations:', allOrgs.length);
104
+ *
105
+ * @see {@link https://docs.scalekit.com/apis/#tag/organizations | List Organizations API}
106
+ * @see {@link getOrganization} - Get a specific organization by ID
27
107
  */
28
108
  listOrganization(options?: {
29
109
  pageSize?: number;
30
110
  pageToken?: string;
31
111
  }): Promise<ListOrganizationsResponse>;
32
112
  /**
33
- * Get an organization by id
34
- * @param {string} id The organization id
35
- * @returns {Promise<GetOrganizationResponse>} The organization
113
+ * Retrieves detailed information about a specific organization using its Scalekit ID.
114
+ *
115
+ * Use this method to fetch complete organization details including display name, region,
116
+ * metadata, settings, and configuration. This is useful for displaying organization info
117
+ * in your application or checking organization status.
118
+ *
119
+ * @param {string} id - The Scalekit-generated organization identifier (format: "org_...")
120
+ *
121
+ * @returns {Promise<GetOrganizationResponse>} Response containing:
122
+ * - organization: Complete organization object with:
123
+ * - id: Scalekit's unique identifier
124
+ * - displayName: Organization's display name
125
+ * - externalId: Your system's identifier (if set)
126
+ * - metadata: Custom metadata key-value pairs
127
+ * - createTime: When the organization was created
128
+ * - updateTime: When the organization was last updated
129
+ *
130
+ * @throws {Error} If the organization is not found or access is denied
131
+ *
132
+ * @example
133
+ * // Get organization details
134
+ * const response = await scalekitClient.organization.getOrganization('org_12345');
135
+ * const org = response.organization;
136
+ *
137
+ * console.log('Organization:', org.displayName);
138
+ * console.log('External ID:', org.externalId);
139
+ *
140
+ * @example
141
+ * // Check if organization exists before operations
142
+ * try {
143
+ * const response = await scalekitClient.organization.getOrganization(orgId);
144
+ * // Proceed with organization operations
145
+ * } catch (error) {
146
+ * console.error('Organization not found:', error);
147
+ * }
148
+ *
149
+ * @see {@link https://docs.scalekit.com/apis/#tag/organizations | Get Organization API}
150
+ * @see {@link getOrganizationByExternalId} - Retrieve organization using your external ID
151
+ * @see {@link listOrganization} - List all organizations
36
152
  */
37
153
  getOrganization(id: string): Promise<GetOrganizationResponse>;
38
154
  /**
39
- * Get an organization by external id
40
- * @param {string} externalId The external id
41
- * @returns {Promise<GetOrganizationResponse>} The organization
155
+ * Retrieves detailed information about an organization using your system's external identifier.
156
+ *
157
+ * This is particularly useful when you need to look up an organization using your own
158
+ * internal identifiers rather than Scalekit's ID. The external ID is typically set when
159
+ * creating or updating an organization to maintain a mapping between your system and Scalekit.
160
+ *
161
+ * @param {string} externalId - Your system's unique identifier for the organization
162
+ * (e.g., "customer_12345", "tenant_abc")
163
+ *
164
+ * @returns {Promise<GetOrganizationResponse>} Response containing:
165
+ * - organization: Complete organization object with all details
166
+ * (same structure as {@link getOrganization})
167
+ *
168
+ * @throws {Error} If no organization is found with the provided external ID
169
+ *
170
+ * @example
171
+ * // Retrieve organization using your internal customer ID
172
+ * const response = await scalekitClient.organization.getOrganizationByExternalId('customer_12345');
173
+ * const org = response.organization;
174
+ *
175
+ * console.log('Scalekit ID:', org.id);
176
+ * console.log('Organization:', org.displayName);
177
+ *
178
+ * @example
179
+ * // Use in API endpoints where you have your customer ID
180
+ * app.get('/api/customers/:customerId/sso', async (req, res) => {
181
+ * const { customerId } = req.params;
182
+ *
183
+ * try {
184
+ * const response = await scalekitClient.organization.getOrganizationByExternalId(customerId);
185
+ * res.json({ organization: response.organization });
186
+ * } catch (error) {
187
+ * res.status(404).json({ error: 'Organization not found' });
188
+ * }
189
+ * });
190
+ *
191
+ * @see {@link https://docs.scalekit.com/apis/#tag/organizations | Get Organization API}
192
+ * @see {@link getOrganization} - Retrieve organization using Scalekit ID
193
+ * @see {@link createOrganization} - Create organization with external ID mapping
42
194
  */
43
195
  getOrganizationByExternalId(externalId: string): Promise<GetOrganizationResponse>;
44
196
  /**
45
- * Update an organization by id
46
- * @param {string} id The organization id
47
- * @param {PartialMessage<UpdateOrganization>} organization The organization to update
48
- * @returns {Promise<UpdateOrganizationResponse>} The updated organization
197
+ * Updates an organization's properties using its Scalekit ID.
198
+ *
199
+ * Use this method to modify an organization's display name, external ID, or custom metadata.
200
+ * Only the fields you specify in the update object will be changed; all other fields remain
201
+ * unchanged. Note that the region code cannot be modified once set.
202
+ *
203
+ * @param {string} id - The Scalekit organization identifier (format: "org_...")
204
+ * @param {PartialMessage<UpdateOrganization>} organization - Object containing fields to update:
205
+ * - displayName?: New display name for the organization
206
+ * - externalId?: New external ID to map to your system
207
+ * - metadata?: Custom key-value pairs for storing additional data
208
+ *
209
+ * @returns {Promise<UpdateOrganizationResponse>} Response containing:
210
+ * - organization: The updated organization object with all current values
211
+ *
212
+ * @throws {Error} If the organization is not found or update fails
213
+ *
214
+ * @example
215
+ * // Update organization display name
216
+ * const response = await scalekitClient.organization.updateOrganization('org_12345', {
217
+ * displayName: 'Acme Corporation (Updated)'
218
+ * });
219
+ *
220
+ * console.log('Updated:', response.organization.displayName);
221
+ *
222
+ * @example
223
+ * // Add external ID to existing organization
224
+ * await scalekitClient.organization.updateOrganization('org_12345', {
225
+ * externalId: 'customer_abc'
226
+ * });
227
+ *
228
+ * @example
229
+ * // Update multiple fields including metadata
230
+ * const response = await scalekitClient.organization.updateOrganization('org_12345', {
231
+ * displayName: 'Acme Corp',
232
+ * metadata: {
233
+ * industry: 'Technology',
234
+ * size: 'Enterprise',
235
+ * plan: 'Premium'
236
+ * }
237
+ * });
238
+ *
239
+ * @see {@link https://docs.scalekit.com/apis/#tag/organizations | Update Organization API}
240
+ * @see {@link updateOrganizationByExternalId} - Update using your external ID
241
+ * @see {@link getOrganization} - Retrieve current organization details
49
242
  */
50
243
  updateOrganization(id: string, organization: PartialMessage<UpdateOrganization>): Promise<UpdateOrganizationResponse>;
51
244
  /**
52
- * Update an organization by external id
53
- * @param {string} externalId The external id
54
- * @param {PartialMessage<UpdateOrganization>} organization The organization to update
55
- * @returns {Promise<UpdateOrganizationResponse>} The updated organization
245
+ * Updates an organization's properties using your system's external identifier.
246
+ *
247
+ * This method provides the same functionality as {@link updateOrganization} but allows you
248
+ * to reference the organization using your own internal identifier instead of Scalekit's ID.
249
+ * Only specified fields will be updated; all other fields remain unchanged.
250
+ *
251
+ * @param {string} externalId - Your system's unique identifier for the organization
252
+ * @param {PartialMessage<UpdateOrganization>} organization - Object containing fields to update:
253
+ * - displayName?: New display name for the organization
254
+ * - externalId?: New external ID (useful for migrating identifiers)
255
+ * - metadata?: Custom key-value pairs for storing additional data
256
+ *
257
+ * @returns {Promise<UpdateOrganizationResponse>} Response containing:
258
+ * - organization: The updated organization object with all current values
259
+ *
260
+ * @throws {Error} If no organization is found with the provided external ID
261
+ *
262
+ * @example
263
+ * // Update organization using your customer ID
264
+ * const response = await scalekitClient.organization.updateOrganizationByExternalId(
265
+ * 'customer_12345',
266
+ * { displayName: 'New Company Name' }
267
+ * );
268
+ *
269
+ * @example
270
+ * // Update metadata for reporting and analytics
271
+ * await scalekitClient.organization.updateOrganizationByExternalId('customer_12345', {
272
+ * metadata: {
273
+ * accountManager: 'john@example.com',
274
+ * renewalDate: '2025-12-31',
275
+ * tier: 'enterprise'
276
+ * }
277
+ * });
278
+ *
279
+ * @example
280
+ * // Use in API endpoints with your customer identifiers
281
+ * app.patch('/api/customers/:customerId', async (req, res) => {
282
+ * const { customerId } = req.params;
283
+ * const { name } = req.body;
284
+ *
285
+ * const response = await scalekitClient.organization.updateOrganizationByExternalId(
286
+ * customerId,
287
+ * { displayName: name }
288
+ * );
289
+ *
290
+ * res.json({ organization: response.organization });
291
+ * });
292
+ *
293
+ * @see {@link https://docs.scalekit.com/apis/#tag/organizations | Update Organization API}
294
+ * @see {@link updateOrganization} - Update using Scalekit ID
295
+ * @see {@link getOrganizationByExternalId} - Retrieve organization by external ID
56
296
  */
57
297
  updateOrganizationByExternalId(externalId: string, organization: PartialMessage<UpdateOrganization>): Promise<UpdateOrganizationResponse>;
58
298
  /**
59
- * Delete an organization by id
60
- * @param {string} organizationId The organization id
61
- * @returns {Promise<Empty>} Returns nothing
299
+ * Permanently deletes an organization from your Scalekit environment.
300
+ *
301
+ * This operation removes the organization and all associated data including SSO connections,
302
+ * users, and settings. This action cannot be undone, so use with caution.
303
+ *
304
+ * @param {string} organizationId - The Scalekit organization identifier to delete
305
+ *
306
+ * @returns {Promise<Empty>} Empty response on successful deletion
307
+ *
308
+ * @throws {Error} If the organization is not found or deletion fails
309
+ *
310
+ * @example
311
+ * // Delete an organization
312
+ * await scalekitClient.organization.deleteOrganization('org_12345');
313
+ * console.log('Organization deleted successfully');
314
+ *
315
+ * @example
316
+ * // Delete with confirmation flow
317
+ * const confirmDelete = await askUserConfirmation(
318
+ * 'Are you sure you want to delete this organization? This cannot be undone.'
319
+ * );
320
+ *
321
+ * if (confirmDelete) {
322
+ * try {
323
+ * await scalekitClient.organization.deleteOrganization(orgId);
324
+ * console.log('Organization deleted');
325
+ * } catch (error) {
326
+ * console.error('Failed to delete organization:', error);
327
+ * }
328
+ * }
329
+ *
330
+ * @see {@link https://docs.scalekit.com/apis/#tag/organizations | Delete Organization API}
331
+ * @see {@link getOrganization} - Check if organization exists before deletion
62
332
  */
63
333
  deleteOrganization(organizationId: string): Promise<Empty>;
64
334
  /**
65
- * Generate admin portal link for an organization
66
- * @param organizationId The organization id
67
- * @returns {Promise<Link>} The admin portal link object with expiration time and location
335
+ * Creates a single use Admin Portal URL valid for 1 minute.
336
+ *
337
+ * Once the generated admin portal URL is accessed or rendered, a temporary session of 6 hours
338
+ * is created to allow the admin to update SSO/SCIM configuration.
339
+ *
340
+ *
341
+ * @param {string} organizationId - The Scalekit organization ID
342
+ *
343
+ * @returns {Promise<Link>} Link object containing:
344
+ * - location: The complete portal URL to redirect the admin to
345
+ * - expiresAt: Timestamp when the link expires (60 seconds from generation)
346
+ *
347
+ * @throws {Error} When the link generation fails
348
+ *
349
+ * @example
350
+ * // Generate admin portal link
351
+ * app.get('/admin/sso-settings', async (req, res) => {
352
+ * const organizationId = req.user.organizationId;
353
+ *
354
+ * try {
355
+ * const link = await scalekitClient.organization.generatePortalLink(organizationId);
356
+ *
357
+ * // Redirect the admin to the portal
358
+ * res.redirect(link.location);
359
+ * } catch (error) {
360
+ * console.error('Failed to generate portal link:', error);
361
+ * res.status(500).send('Unable to access admin portal');
362
+ * }
363
+ * });
364
+ *
365
+ *
366
+ * @see {@link https://docs.scalekit.com/apis/#tag/organizations | Generate Portal Link API}
367
+ * @see {@link https://docs.scalekit.com/authenticate/sso/admin-portal/ | Admin Portal Guide}
68
368
  */
69
369
  generatePortalLink(organizationId: string): Promise<Link>;
70
370
  /**
71
- * Update organization settings for an organization
72
- * @param organizationId The organization id
73
- * @param settings The organization settings
74
- * @returns {Promise<GetOrganizationResponse>} The updated organization
371
+ * Updates configuration settings and feature flags for an organization.
372
+ *
373
+ * Use this method to enable or disable organization-level features such as SSO configuration,
374
+ * directory synchronization, session management, and other organization-specific settings.
375
+ * This allows you to customize the capabilities available to each organization based on
376
+ * their subscription tier or requirements.
377
+ *
378
+ * @param {string} organizationId - The Scalekit organization identifier (format: "org_...")
379
+ * @param {OrganizationSettings} settings - Configuration settings object containing:
380
+ * - features: Array of feature objects, each with:
381
+ * - name: Feature identifier (e.g., "sso", "directory_sync")
382
+ * - enabled: Boolean flag to enable/disable the feature
383
+ *
384
+ * @returns {Promise<GetOrganizationResponse>} Response containing:
385
+ * - organization: Complete organization object with updated settings
386
+ *
387
+ * @throws {Error} If the organization is not found or settings update fails
388
+ *
389
+ * @example
390
+ * // Enable SSO and directory sync for an organization
391
+ * const response = await scalekitClient.organization.updateOrganizationSettings('org_12345', {
392
+ * features: [
393
+ * { name: 'sso', enabled: true },
394
+ * { name: 'directory_sync', enabled: true }
395
+ * ]
396
+ * });
397
+ *
398
+ * console.log('Settings updated:', response.organization.settings);
399
+ *
400
+ *
401
+ * @see {@link https://docs.scalekit.com/apis/#tag/organizations | Update Organization Settings API}
402
+ * @see {@link getOrganization} - Retrieve current organization settings
403
+ * @see {@link upsertUserManagementSettings} - Update user management settings
75
404
  */
76
405
  updateOrganizationSettings(organizationId: string, settings: OrganizationSettings): Promise<GetOrganizationResponse>;
77
406
  /**
78
- * Upsert organization-level user management settings such as maximum allowed users.
79
- * @param organizationId The organization id
80
- * @param settings User management settings to apply
81
- * @returns {Promise<OrganizationUserManagementSettingsMessage | undefined>} The updated settings
407
+ * Creates or updates user management settings for an organization.
408
+ *
409
+ * This method allows you to configure user-related constraints and policies at the
410
+ * organization level, such as setting a maximum number of allowed users. This is
411
+ * useful for enforcing subscription limits, preventing overuse, or managing capacity.
412
+ * If settings already exist, they will be updated; otherwise, new settings are created.
413
+ *
414
+ * @param {string} organizationId - The Scalekit organization identifier (format: "org_...")
415
+ * @param {OrganizationUserManagementSettingsInput} settings - User management configuration:
416
+ * - maxAllowedUsers?: Maximum number of users allowed in the organization.
417
+ * Set to null or undefined to remove the limit.
418
+ *
419
+ * @returns {Promise<OrganizationUserManagementSettingsMessage | undefined>} The updated settings object containing:
420
+ * - maxAllowedUsers: The configured user limit (if set)
421
+ *
422
+ * @throws {Error} If the organization is not found or settings update fails
423
+ *
424
+ * @example
425
+ * // Set maximum user limit for an organization
426
+ * const settings = await scalekitClient.organization.upsertUserManagementSettings(
427
+ * 'org_12345',
428
+ * { maxAllowedUsers: 100 }
429
+ * );
430
+ *
431
+ * console.log('Max users allowed:', settings?.maxAllowedUsers);
432
+ *
433
+ * @example
434
+ * // Remove user limit (set to unlimited)
435
+ * await scalekitClient.organization.upsertUserManagementSettings('org_12345', {
436
+ * maxAllowedUsers: null
437
+ * });
438
+ *
439
+ * @see {@link https://docs.scalekit.com/apis/#tag/organizations | User Management Settings API}
440
+ * @see {@link getOrganization} - Retrieve current organization settings
441
+ * @see {@link updateOrganizationSettings} - Update other organization settings
82
442
  */
83
443
  upsertUserManagementSettings(organizationId: string, settings: OrganizationUserManagementSettingsInput): Promise<OrganizationUserManagementSettingsMessage | undefined>;
84
444
  }