@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.
- package/buf.gen.yaml +1 -0
- package/lib/auth.d.ts +41 -9
- package/lib/auth.js +44 -12
- package/lib/auth.js.map +1 -1
- package/lib/connection.d.ts +195 -21
- package/lib/connection.js +197 -23
- package/lib/connection.js.map +1 -1
- package/lib/core.d.ts +2 -2
- package/lib/core.js +13 -12
- package/lib/core.js.map +1 -1
- package/lib/directory.d.ts +293 -40
- package/lib/directory.js +308 -44
- package/lib/directory.js.map +1 -1
- package/lib/domain.d.ts +166 -18
- package/lib/domain.js +178 -29
- package/lib/domain.js.map +1 -1
- package/lib/organization.d.ts +404 -44
- package/lib/organization.js +419 -54
- package/lib/organization.js.map +1 -1
- package/lib/permission.d.ts +179 -35
- package/lib/permission.js +190 -38
- package/lib/permission.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/auth/auth_connect.d.ts +3 -3
- package/lib/pkg/grpc/scalekit/v1/auth/auth_connect.js +2 -2
- package/lib/pkg/grpc/scalekit/v1/auth/auth_connect.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/auth/auth_pb.d.ts +16 -16
- package/lib/pkg/grpc/scalekit/v1/auth/auth_pb.js +21 -21
- package/lib/pkg/grpc/scalekit/v1/auth/auth_pb.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/auth/webauthn_connect.d.ts +82 -0
- package/lib/pkg/grpc/scalekit/v1/auth/webauthn_connect.js +90 -0
- package/lib/pkg/grpc/scalekit/v1/auth/webauthn_connect.js.map +1 -0
- package/lib/pkg/grpc/scalekit/v1/auth/webauthn_pb.d.ts +647 -0
- package/lib/pkg/grpc/scalekit/v1/auth/webauthn_pb.js +993 -0
- package/lib/pkg/grpc/scalekit/v1/auth/webauthn_pb.js.map +1 -0
- package/lib/pkg/grpc/scalekit/v1/commons/commons_pb.d.ts +142 -0
- package/lib/pkg/grpc/scalekit/v1/commons/commons_pb.js +165 -1
- package/lib/pkg/grpc/scalekit/v1/commons/commons_pb.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/connections/connections_connect.d.ts +1 -10
- package/lib/pkg/grpc/scalekit/v1/connections/connections_connect.js +0 -9
- package/lib/pkg/grpc/scalekit/v1/connections/connections_connect.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/connections/connections_pb.d.ts +28 -63
- package/lib/pkg/grpc/scalekit/v1/connections/connections_pb.js +9 -90
- package/lib/pkg/grpc/scalekit/v1/connections/connections_pb.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/users/users_pb.d.ts +2 -2
- package/lib/pkg/grpc/scalekit/v1/users/users_pb.js +1 -1
- package/lib/pkg/grpc/scalekit/v1/users/users_pb.js.map +1 -1
- package/lib/role.d.ts +252 -56
- package/lib/role.js +262 -62
- package/lib/role.js.map +1 -1
- package/lib/scalekit.d.ts +323 -54
- package/lib/scalekit.js +354 -76
- package/lib/scalekit.js.map +1 -1
- package/lib/session.d.ts +235 -22
- package/lib/session.js +237 -24
- package/lib/session.js.map +1 -1
- package/lib/user.d.ts +571 -53
- package/lib/user.js +598 -89
- package/lib/user.js.map +1 -1
- package/lib/webauthn.d.ts +33 -0
- package/lib/webauthn.js +80 -0
- package/lib/webauthn.js.map +1 -0
- package/package.json +2 -2
- package/src/auth.ts +53 -19
- package/src/connection.ts +237 -62
- package/src/core.ts +39 -33
- package/src/directory.ts +356 -98
- package/src/domain.ts +215 -68
- package/src/organization.ts +490 -112
- package/src/permission.ts +234 -88
- package/src/pkg/grpc/scalekit/v1/auth/auth_connect.ts +3 -3
- package/src/pkg/grpc/scalekit/v1/auth/auth_pb.ts +24 -24
- package/src/pkg/grpc/scalekit/v1/auth/webauthn_connect.ts +89 -0
- package/src/pkg/grpc/scalekit/v1/auth/webauthn_pb.ts +1263 -0
- package/src/pkg/grpc/scalekit/v1/commons/commons_pb.ts +217 -0
- package/src/pkg/grpc/scalekit/v1/connections/connections_connect.ts +1 -10
- package/src/pkg/grpc/scalekit/v1/connections/connections_pb.ts +42 -129
- package/src/pkg/grpc/scalekit/v1/users/users_pb.ts +3 -3
- package/src/role.ts +336 -136
- package/src/scalekit.ts +478 -149
- package/src/session.ts +266 -63
- package/src/user.ts +675 -168
- package/src/webauthn.ts +98 -0
package/lib/role.js
CHANGED
|
@@ -10,6 +10,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const roles_connect_1 = require("./pkg/grpc/scalekit/v1/roles/roles_connect");
|
|
13
|
+
/**
|
|
14
|
+
* Client for managing roles at both environment and organization levels.
|
|
15
|
+
*
|
|
16
|
+
* Roles define sets of permissions that control user access to resources and operations.
|
|
17
|
+
* This client provides comprehensive role management including role hierarchies, permission
|
|
18
|
+
* inheritance, and both environment-wide and organization-specific roles.
|
|
19
|
+
*
|
|
20
|
+
* **Environment Roles**: Available across your entire Scalekit environment, shared by all organizations
|
|
21
|
+
* **Organization Roles**: Scoped to specific organizations for multi-tenant isolation. These are additional custom roles
|
|
22
|
+
* that are only applicable for that organization beyond the Environment Roles that are applicable for all organizations.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* const scalekitClient = new ScalekitClient(envUrl, clientId, clientSecret);
|
|
26
|
+
* const roleClient = scalekitClient.role;
|
|
27
|
+
*
|
|
28
|
+
* @see {@link https://docs.scalekit.com/apis/#tag/roles | Role API Documentation}
|
|
29
|
+
*/
|
|
13
30
|
class RoleClient {
|
|
14
31
|
constructor(grpcConnect, coreClient) {
|
|
15
32
|
this.grpcConnect = grpcConnect;
|
|
@@ -17,9 +34,41 @@ class RoleClient {
|
|
|
17
34
|
this.client = this.grpcConnect.createClient(roles_connect_1.RolesService);
|
|
18
35
|
}
|
|
19
36
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
37
|
+
* Creates a new environment-level role with specified permissions.
|
|
38
|
+
*
|
|
39
|
+
* Environment roles are available across all organizations in your environment. Use this to
|
|
40
|
+
* establish foundational access control structures, create role hierarchies, or define granular
|
|
41
|
+
* permission sets that can be reused across organizations.
|
|
42
|
+
*
|
|
43
|
+
* @param {CreateRole} role - Role creation object containing:
|
|
44
|
+
* - name: Unique role identifier (alphanumeric with underscores, 1-64 chars)
|
|
45
|
+
* - displayName: Human-readable name for display
|
|
46
|
+
* - description: Purpose and scope of the role
|
|
47
|
+
* - permissions: Array of permission strings
|
|
48
|
+
* - baseRole?: Optional parent role for permission inheritance
|
|
49
|
+
*
|
|
50
|
+
* @returns {Promise<CreateRoleResponse>} The created role with metadata
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* // Create a basic role
|
|
54
|
+
* const response = await scalekitClient.role.createRole({
|
|
55
|
+
* name: 'content_editor',
|
|
56
|
+
* displayName: 'Content Editor',
|
|
57
|
+
* description: 'Can create and edit content',
|
|
58
|
+
* permissions: ['content:read', 'content:write', 'content:edit']
|
|
59
|
+
* });
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* // Create role with inheritance
|
|
63
|
+
* await scalekitClient.role.createRole({
|
|
64
|
+
* name: 'senior_editor',
|
|
65
|
+
* displayName: 'Senior Editor',
|
|
66
|
+
* description: 'Editor with publishing rights',
|
|
67
|
+
* baseRole: 'content_editor',
|
|
68
|
+
* permissions: ['content:publish', 'content:delete']
|
|
69
|
+
* });
|
|
70
|
+
*
|
|
71
|
+
* @see {@link https://docs.scalekit.com/apis/#tag/roles | Create Role API}
|
|
23
72
|
*/
|
|
24
73
|
createRole(role) {
|
|
25
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -27,9 +76,18 @@ class RoleClient {
|
|
|
27
76
|
});
|
|
28
77
|
}
|
|
29
78
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @
|
|
79
|
+
* Retrieves complete information for a specific environment role.
|
|
80
|
+
*
|
|
81
|
+
* @param {string} roleName - Unique role identifier (alphanumeric with underscores, 1-64 chars)
|
|
82
|
+
*
|
|
83
|
+
* @returns {Promise<GetRoleResponse>} Role details including permissions and inheritance
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* const response = await scalekitClient.role.getRole('content_editor');
|
|
87
|
+
* console.log('Role:', response.role.displayName);
|
|
88
|
+
* console.log('Permissions:', response.role.permissions);
|
|
89
|
+
*
|
|
90
|
+
* @see {@link https://docs.scalekit.com/apis/#tag/roles | Get Role API}
|
|
33
91
|
*/
|
|
34
92
|
getRole(roleName) {
|
|
35
93
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -37,8 +95,17 @@ class RoleClient {
|
|
|
37
95
|
});
|
|
38
96
|
}
|
|
39
97
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
98
|
+
* Lists all environment-level roles available in your Scalekit environment.
|
|
99
|
+
*
|
|
100
|
+
* @returns {Promise<ListRolesResponse>} Array of all roles with their metadata
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* const response = await scalekitClient.role.listRoles();
|
|
104
|
+
* response.roles.forEach(role => {
|
|
105
|
+
* console.log(`${role.displayName}: ${role.permissions.length} permissions`);
|
|
106
|
+
* });
|
|
107
|
+
*
|
|
108
|
+
* @see {@link https://docs.scalekit.com/apis/#tag/roles | List Roles API}
|
|
42
109
|
*/
|
|
43
110
|
listRoles() {
|
|
44
111
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -46,24 +113,46 @@ class RoleClient {
|
|
|
46
113
|
});
|
|
47
114
|
}
|
|
48
115
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
116
|
+
* Updates an existing environment role's properties and permissions.
|
|
117
|
+
*
|
|
118
|
+
* Only specified fields are updated. The new permission list replaces existing permissions.
|
|
119
|
+
*
|
|
120
|
+
* @param {string} roleName - Role to update
|
|
121
|
+
* @param {UpdateRole} role - Updated role properties
|
|
122
|
+
*
|
|
123
|
+
* @returns {Promise<UpdateRoleResponse>} Updated role details
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* await scalekitClient.role.updateRole('content_editor', {
|
|
127
|
+
* displayName: 'Content Editor (Updated)',
|
|
128
|
+
* permissions: ['content:read', 'content:write', 'content:edit', 'content:review']
|
|
129
|
+
* });
|
|
130
|
+
*
|
|
131
|
+
* @see {@link https://docs.scalekit.com/apis/#tag/roles | Update Role API}
|
|
53
132
|
*/
|
|
54
133
|
updateRole(roleName, role) {
|
|
55
134
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
135
|
return this.coreClient.connectExec(this.client.updateRole, {
|
|
57
136
|
roleName,
|
|
58
|
-
role
|
|
137
|
+
role,
|
|
59
138
|
});
|
|
60
139
|
});
|
|
61
140
|
}
|
|
62
141
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
142
|
+
* Deletes an environment role and reassigns its users to another role.
|
|
143
|
+
*
|
|
144
|
+
* Cannot delete if dependent roles exist. Users must be reassigned before deletion.
|
|
145
|
+
* This operation is irreversible.
|
|
146
|
+
*
|
|
147
|
+
* @param {string} roleName - Role to delete
|
|
148
|
+
* @param {string} [reassignRoleName] - Target role for user migration
|
|
149
|
+
*
|
|
150
|
+
* @returns {Promise<Empty>} Empty response on success
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* await scalekitClient.role.deleteRole('old_role', 'new_role');
|
|
154
|
+
*
|
|
155
|
+
* @see {@link https://docs.scalekit.com/apis/#tag/roles | Delete Role API}
|
|
67
156
|
*/
|
|
68
157
|
deleteRole(roleName, reassignRoleName) {
|
|
69
158
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -75,82 +164,163 @@ class RoleClient {
|
|
|
75
164
|
});
|
|
76
165
|
}
|
|
77
166
|
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
167
|
+
* Gets the number of users assigned to an environment role.
|
|
168
|
+
*
|
|
169
|
+
* Useful for capacity planning, security auditing, and impact assessment before role changes.
|
|
170
|
+
*
|
|
171
|
+
* @param {string} roleName - Role to count users for
|
|
172
|
+
*
|
|
173
|
+
* @returns {Promise<GetRoleUsersCountResponse>} Total user count (direct and inherited)
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* const response = await scalekitClient.role.getRoleUsersCount('admin');
|
|
177
|
+
* console.log(`${response.count} users have admin role`);
|
|
178
|
+
*
|
|
179
|
+
* @see {@link https://docs.scalekit.com/apis/#tag/roles | Get Role User Count API}
|
|
81
180
|
*/
|
|
82
181
|
getRoleUsersCount(roleName) {
|
|
83
182
|
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
return this.coreClient.connectExec(this.client.getRoleUsersCount, {
|
|
183
|
+
return this.coreClient.connectExec(this.client.getRoleUsersCount, {
|
|
184
|
+
roleName,
|
|
185
|
+
});
|
|
85
186
|
});
|
|
86
187
|
}
|
|
87
188
|
// Organization Role CRUD Methods
|
|
88
189
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
190
|
+
* Creates a new organization-specific role with custom permissions.
|
|
191
|
+
*
|
|
192
|
+
* Organization roles are scoped to a specific organization for multi-tenant isolation.
|
|
193
|
+
* Use this for organization-specific access control and compartmentalized role management.
|
|
194
|
+
*
|
|
195
|
+
* @param {string} orgId - Organization identifier (format: "org_...")
|
|
196
|
+
* @param {CreateOrganizationRole} role - Role configuration containing:
|
|
197
|
+
* - name: Unique role identifier within the organization
|
|
198
|
+
* - displayName: Human-readable name
|
|
199
|
+
* - description: Purpose and scope
|
|
200
|
+
* - permissions: Organization-specific permission array
|
|
201
|
+
* - baseRole?: Parent role for inheritance
|
|
202
|
+
*
|
|
203
|
+
* @returns {Promise<CreateOrganizationRoleResponse>} Created organization role
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* await scalekitClient.role.createOrganizationRole('org_123456', {
|
|
207
|
+
* name: 'department_lead',
|
|
208
|
+
* displayName: 'Department Lead',
|
|
209
|
+
* description: 'Manages department members',
|
|
210
|
+
* permissions: ['dept:members:read', 'dept:members:invite']
|
|
211
|
+
* });
|
|
212
|
+
*
|
|
213
|
+
* @see {@link https://docs.scalekit.com/apis/#tag/roles | Create Organization Role API}
|
|
93
214
|
*/
|
|
94
215
|
createOrganizationRole(orgId, role) {
|
|
95
216
|
return __awaiter(this, void 0, void 0, function* () {
|
|
96
217
|
return this.coreClient.connectExec(this.client.createOrganizationRole, {
|
|
97
218
|
orgId,
|
|
98
|
-
role
|
|
219
|
+
role,
|
|
99
220
|
});
|
|
100
221
|
});
|
|
101
222
|
}
|
|
102
223
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* @param {string}
|
|
106
|
-
* @
|
|
224
|
+
* Retrieves details for a specific organization role.
|
|
225
|
+
*
|
|
226
|
+
* @param {string} orgId - Organization identifier
|
|
227
|
+
* @param {string} roleName - Role name to retrieve
|
|
228
|
+
*
|
|
229
|
+
* @returns {Promise<GetOrganizationRoleResponse>} Organization role details
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* const response = await scalekitClient.role.getOrganizationRole(
|
|
233
|
+
* 'org_123456',
|
|
234
|
+
* 'department_lead'
|
|
235
|
+
* );
|
|
236
|
+
* console.log('Permissions:', response.role.permissions);
|
|
237
|
+
*
|
|
238
|
+
* @see {@link https://docs.scalekit.com/apis/#tag/roles | Get Organization Role API}
|
|
107
239
|
*/
|
|
108
240
|
getOrganizationRole(orgId, roleName) {
|
|
109
241
|
return __awaiter(this, void 0, void 0, function* () {
|
|
110
242
|
return this.coreClient.connectExec(this.client.getOrganizationRole, {
|
|
111
243
|
orgId,
|
|
112
|
-
roleName
|
|
244
|
+
roleName,
|
|
113
245
|
});
|
|
114
246
|
});
|
|
115
247
|
}
|
|
116
248
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
249
|
+
* Lists all roles available to an organization (environment + organization-specific).
|
|
250
|
+
*
|
|
251
|
+
* Returns both environment-level roles and organization-scoped roles.
|
|
252
|
+
*
|
|
253
|
+
* @param {string} orgId - Organization identifier
|
|
254
|
+
*
|
|
255
|
+
* @returns {Promise<ListOrganizationRolesResponse>} Array of available roles
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* const response = await scalekitClient.role.listOrganizationRoles('org_123456');
|
|
259
|
+
* response.roles.forEach(role => {
|
|
260
|
+
* console.log(`${role.displayName} (${role.scope})`);
|
|
261
|
+
* });
|
|
262
|
+
*
|
|
263
|
+
* @see {@link https://docs.scalekit.com/apis/#tag/roles | List Organization Roles API}
|
|
120
264
|
*/
|
|
121
265
|
listOrganizationRoles(orgId) {
|
|
122
266
|
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
-
return this.coreClient.connectExec(this.client.listOrganizationRoles, {
|
|
267
|
+
return this.coreClient.connectExec(this.client.listOrganizationRoles, {
|
|
268
|
+
orgId,
|
|
269
|
+
});
|
|
124
270
|
});
|
|
125
271
|
}
|
|
126
272
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* @
|
|
273
|
+
* Updates an organization role's properties and permissions.
|
|
274
|
+
*
|
|
275
|
+
* Only specified fields are updated. New permissions replace existing ones.
|
|
276
|
+
*
|
|
277
|
+
* @param {string} orgId - Organization identifier
|
|
278
|
+
* @param {string} roleName - Role to update
|
|
279
|
+
* @param {UpdateRole} role - Updated role properties
|
|
280
|
+
*
|
|
281
|
+
* @returns {Promise<UpdateOrganizationRoleResponse>} Updated role
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* await scalekitClient.role.updateOrganizationRole('org_123456', 'department_lead', {
|
|
285
|
+
* permissions: ['dept:members:read', 'dept:members:invite', 'dept:members:remove']
|
|
286
|
+
* });
|
|
287
|
+
*
|
|
288
|
+
* @see {@link https://docs.scalekit.com/apis/#tag/roles | Update Organization Role API}
|
|
132
289
|
*/
|
|
133
290
|
updateOrganizationRole(orgId, roleName, role) {
|
|
134
291
|
return __awaiter(this, void 0, void 0, function* () {
|
|
135
292
|
return this.coreClient.connectExec(this.client.updateOrganizationRole, {
|
|
136
293
|
orgId,
|
|
137
294
|
roleName,
|
|
138
|
-
role
|
|
295
|
+
role,
|
|
139
296
|
});
|
|
140
297
|
});
|
|
141
298
|
}
|
|
142
299
|
/**
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
* @
|
|
300
|
+
* Deletes an organization role and reassigns its users.
|
|
301
|
+
*
|
|
302
|
+
* Cannot delete if dependent roles exist. Users must be reassigned. Operation is irreversible.
|
|
303
|
+
*
|
|
304
|
+
* @param {string} orgId - Organization identifier
|
|
305
|
+
* @param {string} roleName - Role to delete
|
|
306
|
+
* @param {string} [reassignRoleName] - Target role for user migration
|
|
307
|
+
*
|
|
308
|
+
* @returns {Promise<Empty>} Empty response on success
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* await scalekitClient.role.deleteOrganizationRole(
|
|
312
|
+
* 'org_123456',
|
|
313
|
+
* 'old_role',
|
|
314
|
+
* 'new_role'
|
|
315
|
+
* );
|
|
316
|
+
*
|
|
317
|
+
* @see {@link https://docs.scalekit.com/apis/#tag/roles | Delete Organization Role API}
|
|
148
318
|
*/
|
|
149
319
|
deleteOrganizationRole(orgId, roleName, reassignRoleName) {
|
|
150
320
|
return __awaiter(this, void 0, void 0, function* () {
|
|
151
321
|
const request = {
|
|
152
322
|
orgId,
|
|
153
|
-
roleName
|
|
323
|
+
roleName,
|
|
154
324
|
};
|
|
155
325
|
if (reassignRoleName) {
|
|
156
326
|
request.reassignRoleName = reassignRoleName;
|
|
@@ -159,44 +329,74 @@ class RoleClient {
|
|
|
159
329
|
});
|
|
160
330
|
}
|
|
161
331
|
/**
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
* @param {string}
|
|
165
|
-
* @
|
|
332
|
+
* Gets the number of users assigned to an organization role.
|
|
333
|
+
*
|
|
334
|
+
* @param {string} orgId - Organization identifier
|
|
335
|
+
* @param {string} roleName - Role to count users for
|
|
336
|
+
*
|
|
337
|
+
* @returns {Promise<GetOrganizationRoleUsersCountResponse>} User count
|
|
338
|
+
*
|
|
339
|
+
* @example
|
|
340
|
+
* const response = await scalekitClient.role.getOrganizationRoleUsersCount(
|
|
341
|
+
* 'org_123456',
|
|
342
|
+
* 'admin'
|
|
343
|
+
* );
|
|
344
|
+
* console.log(`${response.count} admins in this organization`);
|
|
345
|
+
*
|
|
346
|
+
* @see {@link https://docs.scalekit.com/apis/#tag/roles | Get Organization Role User Count API}
|
|
166
347
|
*/
|
|
167
348
|
getOrganizationRoleUsersCount(orgId, roleName) {
|
|
168
349
|
return __awaiter(this, void 0, void 0, function* () {
|
|
169
350
|
return this.coreClient.connectExec(this.client.getOrganizationRoleUsersCount, {
|
|
170
351
|
orgId,
|
|
171
|
-
roleName
|
|
352
|
+
roleName,
|
|
172
353
|
});
|
|
173
354
|
});
|
|
174
355
|
}
|
|
175
356
|
/**
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
357
|
+
* Sets the default role automatically assigned to new organization members.
|
|
358
|
+
* This is the role that is by default assigned to every new user added to this organization.
|
|
359
|
+
*
|
|
360
|
+
* Affects all new user invitations and memberships within the organization.
|
|
361
|
+
*
|
|
362
|
+
* @param {string} orgId - Organization identifier
|
|
363
|
+
* @param {string} defaultMemberRole - Role name to assign by default
|
|
364
|
+
*
|
|
365
|
+
* @returns {Promise<UpdateDefaultOrganizationRolesResponse>} Updated configuration
|
|
366
|
+
*
|
|
367
|
+
* @example
|
|
368
|
+
* await scalekitClient.role.updateDefaultOrganizationRoles('org_123456', 'member');
|
|
369
|
+
*
|
|
370
|
+
* @see {@link https://docs.scalekit.com/apis/#tag/roles | Update Default Organization Roles API}
|
|
180
371
|
*/
|
|
181
372
|
updateDefaultOrganizationRoles(orgId, defaultMemberRole) {
|
|
182
373
|
return __awaiter(this, void 0, void 0, function* () {
|
|
183
374
|
return this.coreClient.connectExec(this.client.updateDefaultOrganizationRoles, {
|
|
184
375
|
orgId,
|
|
185
|
-
defaultMemberRole
|
|
376
|
+
defaultMemberRole,
|
|
186
377
|
});
|
|
187
378
|
});
|
|
188
379
|
}
|
|
189
380
|
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
381
|
+
* Removes a role's inheritance relationship, eliminating inherited permissions from base role.
|
|
382
|
+
*
|
|
383
|
+
* Role retains only directly assigned permissions after removal. This action cannot be undone.
|
|
384
|
+
*
|
|
385
|
+
* @param {string} orgId - Organization identifier
|
|
386
|
+
* @param {string} roleName - Role to remove inheritance from
|
|
387
|
+
*
|
|
388
|
+
* @returns {Promise<Empty>} Empty response on success
|
|
389
|
+
*
|
|
390
|
+
* @example
|
|
391
|
+
* await scalekitClient.role.deleteOrganizationRoleBase('org_123456', 'custom_role');
|
|
392
|
+
*
|
|
393
|
+
* @see {@link https://docs.scalekit.com/apis/#tag/roles | Delete Organization Role Base API}
|
|
194
394
|
*/
|
|
195
395
|
deleteOrganizationRoleBase(orgId, roleName) {
|
|
196
396
|
return __awaiter(this, void 0, void 0, function* () {
|
|
197
397
|
return this.coreClient.connectExec(this.client.deleteOrganizationRoleBase, {
|
|
198
398
|
orgId,
|
|
199
|
-
roleName
|
|
399
|
+
roleName,
|
|
200
400
|
});
|
|
201
401
|
});
|
|
202
402
|
}
|
package/lib/role.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role.js","sourceRoot":"","sources":["../src/role.ts"],"names":[],"mappings":";;;;;;;;;;;AAIA,8EAA0E;AAgC1E,MAAqB,UAAU;IAG7B,YACmB,WAAwB,EACxB,UAAsB;QADtB,gBAAW,GAAX,WAAW,CAAa;QACxB,eAAU,GAA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