@workos-inc/node 10.2.1 → 10.3.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.
@@ -5666,6 +5666,52 @@ const serializeRemoveRoleOptions = (options) => ({
5666
5666
  }
5667
5667
  });
5668
5668
  //#endregion
5669
+ //#region src/authorization/serializers/group-role-assignment.serializer.ts
5670
+ const deserializeGroupRoleAssignment = (response) => ({
5671
+ object: response.object,
5672
+ id: response.id,
5673
+ groupId: response.group_id,
5674
+ role: response.role,
5675
+ resource: {
5676
+ id: response.resource.id,
5677
+ externalId: response.resource.external_id,
5678
+ resourceTypeSlug: response.resource.resource_type_slug
5679
+ },
5680
+ createdAt: response.created_at,
5681
+ updatedAt: response.updated_at
5682
+ });
5683
+ //#endregion
5684
+ //#region src/authorization/serializers/create-group-role-assignment-options.serializer.ts
5685
+ const serializeCreateGroupRoleAssignmentOptions = (options) => ({
5686
+ role_slug: options.roleSlug,
5687
+ ..."resourceId" in options && { resource_id: options.resourceId },
5688
+ ..."resourceExternalId" in options && {
5689
+ resource_external_id: options.resourceExternalId,
5690
+ resource_type_slug: options.resourceTypeSlug
5691
+ }
5692
+ });
5693
+ //#endregion
5694
+ //#region src/authorization/serializers/remove-group-role-assignments-options.serializer.ts
5695
+ const serializeRemoveGroupRoleAssignmentsOptions = (options) => ({
5696
+ role_slug: options.roleSlug,
5697
+ ..."resourceId" in options && { resource_id: options.resourceId },
5698
+ ..."resourceExternalId" in options && {
5699
+ resource_external_id: options.resourceExternalId,
5700
+ resource_type_slug: options.resourceTypeSlug
5701
+ }
5702
+ });
5703
+ //#endregion
5704
+ //#region src/authorization/serializers/replace-group-role-assignments-options.serializer.ts
5705
+ const serializeEntry = (entry) => ({
5706
+ role_slug: entry.roleSlug,
5707
+ ..."resourceId" in entry && { resource_id: entry.resourceId },
5708
+ ..."resourceExternalId" in entry && {
5709
+ resource_external_id: entry.resourceExternalId,
5710
+ resource_type_slug: entry.resourceTypeSlug
5711
+ }
5712
+ });
5713
+ const serializeReplaceGroupRoleAssignmentsOptions = (options) => ({ role_assignments: options.roleAssignments.map(serializeEntry) });
5714
+ //#endregion
5669
5715
  //#region src/authorization/serializers/list-effective-permissions-options.serializer.ts
5670
5716
  const serializeListEffectivePermissionsOptions = (options) => ({ ...serializePaginationOptions(options) });
5671
5717
  //#endregion
@@ -6350,6 +6396,112 @@ var Authorization = class {
6350
6396
  await this.workos.delete(`/authorization/organization_memberships/${options.organizationMembershipId}/role_assignments/${options.roleAssignmentId}`);
6351
6397
  }
6352
6398
  /**
6399
+ * List role assignments for a group
6400
+ *
6401
+ * List all role assignments granted to a group. Each assignment represents a role granted to the group on a resource.
6402
+ * @param options - Pagination options.
6403
+ * @param options.groupId - The ID of the group.
6404
+ *
6405
+ * @example
6406
+ * "group_01HXYZ123456789ABCDEFGHIJ"
6407
+ *
6408
+ * @returns {Promise<AutoPaginatable<GroupRoleAssignment>>}
6409
+ * @throws 403 response from the API.
6410
+ * @throws {NotFoundException} 404
6411
+ */
6412
+ async listGroupRoleAssignments(options) {
6413
+ const { groupId, ...paginationOptions } = options;
6414
+ const endpoint = `/authorization/groups/${groupId}/role_assignments`;
6415
+ return new AutoPaginatable(await fetchAndDeserialize(this.workos, endpoint, deserializeGroupRoleAssignment, paginationOptions), (params) => fetchAndDeserialize(this.workos, endpoint, deserializeGroupRoleAssignment, params), paginationOptions);
6416
+ }
6417
+ /**
6418
+ * Get a group role assignment
6419
+ *
6420
+ * Get a specific role assignment for a group by its ID.
6421
+ * @param options - Object containing groupId and roleAssignmentId.
6422
+ * @param options.groupId - The ID of the group.
6423
+ *
6424
+ * @example
6425
+ * "group_01HXYZ123456789ABCDEFGHIJ"
6426
+ *
6427
+ * @param options.roleAssignmentId - The ID of the group role assignment.
6428
+ *
6429
+ * @example
6430
+ * "gra_01HXYZ123456789ABCDEFGH"
6431
+ *
6432
+ * @returns {Promise<GroupRoleAssignment>}
6433
+ * @throws 403 response from the API.
6434
+ * @throws {NotFoundException} 404
6435
+ */
6436
+ async getGroupRoleAssignment(options) {
6437
+ const { data } = await this.workos.get(`/authorization/groups/${options.groupId}/role_assignments/${options.roleAssignmentId}`);
6438
+ return deserializeGroupRoleAssignment(data);
6439
+ }
6440
+ /**
6441
+ * Assign a role to a group
6442
+ *
6443
+ * Assign a role to a group on a specific resource. Omit the resource fields to assign the role on the organization itself.
6444
+ * @param options - Object containing groupId and roleSlug.
6445
+ * @returns {Promise<GroupRoleAssignment>}
6446
+ * @throws 403 response from the API.
6447
+ * @throws {NotFoundException} 404
6448
+ * @throws {ConflictException} 409
6449
+ * @throws {UnprocessableEntityException} 422
6450
+ */
6451
+ async createGroupRoleAssignment(options) {
6452
+ const { data } = await this.workos.post(`/authorization/groups/${options.groupId}/role_assignments`, serializeCreateGroupRoleAssignmentOptions(options));
6453
+ return deserializeGroupRoleAssignment(data);
6454
+ }
6455
+ /**
6456
+ * Remove a group role assignment
6457
+ *
6458
+ * Remove a specific role assignment from a group by its ID.
6459
+ * @param options - Object containing groupId and roleAssignmentId.
6460
+ * @param options.groupId - The ID of the group.
6461
+ *
6462
+ * @example
6463
+ * "group_01HXYZ123456789ABCDEFGHIJ"
6464
+ *
6465
+ * @param options.roleAssignmentId - The ID of the group role assignment to remove.
6466
+ *
6467
+ * @example
6468
+ * "gra_01HXYZ123456789ABCDEFGH"
6469
+ *
6470
+ * @returns {Promise<void>}
6471
+ * @throws 403 response from the API.
6472
+ * @throws {NotFoundException} 404
6473
+ */
6474
+ async removeGroupRoleAssignment(options) {
6475
+ await this.workos.delete(`/authorization/groups/${options.groupId}/role_assignments/${options.roleAssignmentId}`);
6476
+ }
6477
+ /**
6478
+ * Remove group role assignments by criteria
6479
+ *
6480
+ * Remove role assignments from a group that match the provided role and resource. Omit the resource fields to target the organization itself.
6481
+ * @param options - Object containing groupId and roleSlug.
6482
+ * @returns {Promise<void>}
6483
+ * @throws 403 response from the API.
6484
+ * @throws {NotFoundException} 404
6485
+ * @throws {UnprocessableEntityException} 422
6486
+ */
6487
+ async removeGroupRoleAssignments(options) {
6488
+ await this.workos.deleteWithBody(`/authorization/groups/${options.groupId}/role_assignments`, serializeRemoveGroupRoleAssignmentsOptions(options));
6489
+ }
6490
+ /**
6491
+ * Replace role assignments for a group
6492
+ *
6493
+ * Replace all of a group's role assignments with the provided list. Assignments not present in the list are removed and new ones are created. Pass an empty `roleAssignments` array to clear all assignments. Returns the resulting set of assignments.
6494
+ * @param options - Object containing groupId and roleAssignments.
6495
+ * @returns {Promise<List<GroupRoleAssignment>>}
6496
+ * @throws 403 response from the API.
6497
+ * @throws {NotFoundException} 404
6498
+ * @throws {UnprocessableEntityException} 422
6499
+ */
6500
+ async replaceGroupRoleAssignments(options) {
6501
+ const { data } = await this.workos.put(`/authorization/groups/${options.groupId}/role_assignments`, serializeReplaceGroupRoleAssignmentsOptions(options));
6502
+ return deserializeList(data, deserializeGroupRoleAssignment);
6503
+ }
6504
+ /**
6353
6505
  * List resources for organization membership
6354
6506
  *
6355
6507
  * Returns all child resources of a parent resource where the organization membership has a specific permission. This is useful for resource discovery—answering "What projects can this user access in this workspace?"
@@ -6917,7 +7069,7 @@ var Vault = class {
6917
7069
  };
6918
7070
  //#endregion
6919
7071
  //#region package.json
6920
- var version = "10.2.1";
7072
+ var version = "10.3.0";
6921
7073
  //#endregion
6922
7074
  //#region src/workos.ts
6923
7075
  const DEFAULT_HOSTNAME = "api.workos.com";
@@ -7263,4 +7415,4 @@ function createWorkOS(options) {
7263
7415
  //#endregion
7264
7416
  export { FetchHttpClient as A, NoApiKeyProvidedException as C, isAuthenticationErrorData as D, AuthenticationException as E, GenericServerException as O, NotFoundException as S, BadRequestException as T, UnprocessableEntityException as _, DomainDataState as a, RateLimitExceededException as b, FeatureFlagsRuntimeClient as c, serializeRevokeSessionOptions as d, AuthenticateWithSessionCookieFailureReason as f, Actions as g, AutoPaginatable as h, OrganizationDomainVerificationStrategy as i, SubtleCryptoProvider as j, ApiKeyRequiredException as k, CookieSession as l, Webhooks as m, ConnectionType as n, GenerateLinkIntent as o, PKCE as p, OrganizationDomainState as r, WorkOS as s, createWorkOS as t, RefreshSessionFailureReason as u, UnauthorizedException as v, ConflictException as w, OauthException as x, SignatureVerificationException as y };
7265
7417
 
7266
- //# sourceMappingURL=factory-Bp8G8dsp.mjs.map
7418
+ //# sourceMappingURL=factory-Bh2PZgM6.mjs.map