@workos-inc/node 9.1.1 → 9.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.
@@ -4787,6 +4787,7 @@ const serializeListMembershipsForResourceOptions = (options) => ({
4787
4787
  const deserializeRoleAssignment = (response) => ({
4788
4788
  object: response.object,
4789
4789
  id: response.id,
4790
+ organizationMembershipId: response.organization_membership_id,
4790
4791
  role: response.role,
4791
4792
  resource: {
4792
4793
  id: response.resource.id,
@@ -4797,6 +4798,20 @@ const deserializeRoleAssignment = (response) => ({
4797
4798
  updatedAt: response.updated_at
4798
4799
  });
4799
4800
  //#endregion
4801
+ //#region src/authorization/serializers/list-role-assignments-options.serializer.ts
4802
+ const serializeListRoleAssignmentsOptions = (options) => ({
4803
+ ...options.resourceId && { resource_id: options.resourceId },
4804
+ ...options.resourceExternalId && { resource_external_id: options.resourceExternalId },
4805
+ ...options.resourceTypeSlug && { resource_type_slug: options.resourceTypeSlug },
4806
+ ...serializePaginationOptions(options)
4807
+ });
4808
+ //#endregion
4809
+ //#region src/authorization/serializers/list-role-assignments-for-resource-options.serializer.ts
4810
+ const serializeListRoleAssignmentsForResourceOptions = (options) => ({
4811
+ ...options.roleSlug && { role_slug: options.roleSlug },
4812
+ ...serializePaginationOptions(options)
4813
+ });
4814
+ //#endregion
4800
4815
  //#region src/authorization/serializers/assign-role-options.serializer.ts
4801
4816
  const serializeAssignRoleOptions = (options) => ({
4802
4817
  role_slug: options.roleSlug,
@@ -5398,7 +5413,58 @@ var Authorization = class {
5398
5413
  async listRoleAssignments(options) {
5399
5414
  const { organizationMembershipId, ...queryOptions } = options;
5400
5415
  const endpoint = `/authorization/organization_memberships/${organizationMembershipId}/role_assignments`;
5401
- return new AutoPaginatable(await fetchAndDeserialize(this.workos, endpoint, deserializeRoleAssignment, queryOptions), (params) => fetchAndDeserialize(this.workos, endpoint, deserializeRoleAssignment, params), queryOptions);
5416
+ const serializedOptions = serializeListRoleAssignmentsOptions(queryOptions);
5417
+ return new AutoPaginatable(await fetchAndDeserialize(this.workos, endpoint, deserializeRoleAssignment, serializedOptions), (params) => fetchAndDeserialize(this.workos, endpoint, deserializeRoleAssignment, params), serializedOptions);
5418
+ }
5419
+ /**
5420
+ * List role assignments for a resource
5421
+ *
5422
+ * List all role assignments granted on a resource. This returns every role assignment scoped to the resource, regardless of which organization membership received it.
5423
+ * @param resourceId - The ID of the authorization resource.
5424
+ *
5425
+ * @example
5426
+ * "authz_resource_01HXYZ123456789ABCDEFGHIJ"
5427
+ *
5428
+ * @param options - Pagination and filter options.
5429
+ * @returns {Promise<AutoPaginatable<RoleAssignment>>}
5430
+ * @throws 403 response from the API.
5431
+ * @throws {NotFoundException} 404
5432
+ */
5433
+ async listRoleAssignmentsForResource(options) {
5434
+ const { resourceId, ...queryOptions } = options;
5435
+ const endpoint = `/authorization/resources/${resourceId}/role_assignments`;
5436
+ const serializedOptions = serializeListRoleAssignmentsForResourceOptions(queryOptions);
5437
+ return new AutoPaginatable(await fetchAndDeserialize(this.workos, endpoint, deserializeRoleAssignment, serializedOptions), (params) => fetchAndDeserialize(this.workos, endpoint, deserializeRoleAssignment, params), serializedOptions);
5438
+ }
5439
+ /**
5440
+ * List role assignments for a resource by external ID
5441
+ *
5442
+ * List all role assignments granted on a resource identified by its external ID, organization, and resource type. This returns every role assignment scoped to the resource, regardless of which organization membership received it.
5443
+ * @param organizationId - The ID of the organization that owns the resource.
5444
+ *
5445
+ * @example
5446
+ * "org_01EHZNVPK3SFK441A1RGBFSHRT"
5447
+ *
5448
+ * @param resourceTypeSlug - The slug of the resource type this resource belongs to.
5449
+ *
5450
+ * @example
5451
+ * "project"
5452
+ *
5453
+ * @param externalId - An identifier you provide to reference the resource in your system.
5454
+ *
5455
+ * @example
5456
+ * "proj-456"
5457
+ *
5458
+ * @param options - Pagination and filter options.
5459
+ * @returns {Promise<AutoPaginatable<RoleAssignment>>}
5460
+ * @throws 403 response from the API.
5461
+ * @throws {NotFoundException} 404
5462
+ */
5463
+ async listResourceRoleAssignments(options) {
5464
+ const { organizationId, resourceTypeSlug, externalId, ...queryOptions } = options;
5465
+ const endpoint = `/authorization/organizations/${organizationId}/resources/${resourceTypeSlug}/${externalId}/role_assignments`;
5466
+ const serializedOptions = serializeListRoleAssignmentsForResourceOptions(queryOptions);
5467
+ return new AutoPaginatable(await fetchAndDeserialize(this.workos, endpoint, deserializeRoleAssignment, serializedOptions), (params) => fetchAndDeserialize(this.workos, endpoint, deserializeRoleAssignment, params), serializedOptions);
5402
5468
  }
5403
5469
  /**
5404
5470
  * Assign a role
@@ -5858,7 +5924,7 @@ function extractBunVersionFromUserAgent() {
5858
5924
  }
5859
5925
  //#endregion
5860
5926
  //#region package.json
5861
- var version = "9.1.1";
5927
+ var version = "9.3.0";
5862
5928
  //#endregion
5863
5929
  //#region src/workos.ts
5864
5930
  const DEFAULT_HOSTNAME = "api.workos.com";
@@ -6428,4 +6494,4 @@ Object.defineProperty(exports, "serializeRevokeSessionOptions", {
6428
6494
  }
6429
6495
  });
6430
6496
 
6431
- //# sourceMappingURL=factory-jUrF-sdI.cjs.map
6497
+ //# sourceMappingURL=factory-5S80C27h.cjs.map