Skip to content

Commit

Permalink
fix(types,clerk-js): Add missing property 'maxAllowedMemberships' in …
Browse files Browse the repository at this point in the history
…Organization resource
  • Loading branch information
chanioxaris committed Jul 11, 2023
1 parent 8a022d2 commit 73c9c1d
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/cyan-foxes-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@clerk/clerk-js': patch
'@clerk/types': patch
---

Add missing property 'maxAllowedMemberships' in Organization resource
2 changes: 2 additions & 0 deletions packages/clerk-js/src/core/resources/Organization.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ describe('Organization', () => {
updated_at: 5678,
members_count: 1,
pending_invitations_count: 10,
admin_delete_enabled: true,
max_allowed_memberships: 3,
});

expect(organization).toMatchSnapshot();
Expand Down
2 changes: 2 additions & 0 deletions packages/clerk-js/src/core/resources/Organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class Organization extends BaseResource implements OrganizationResource {
updatedAt!: Date;
membersCount = 0;
pendingInvitationsCount = 0;
maxAllowedMemberships!: number;

constructor(data: OrganizationJSON) {
super();
Expand Down Expand Up @@ -180,6 +181,7 @@ export class Organization extends BaseResource implements OrganizationResource {
this.publicMetadata = data.public_metadata;
this.membersCount = data.members_count;
this.pendingInvitationsCount = data.pending_invitations_count;
this.maxAllowedMemberships = data.max_allowed_memberships;
this.adminDeleteEnabled = data.admin_delete_enabled;
this.createdAt = unixEpochToDate(data.created_at);
this.updatedAt = unixEpochToDate(data.updated_at);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ describe('OrganizationMembership', () => {
updated_at: 67890,
members_count: 1,
pending_invitations_count: 10,
admin_delete_enabled: true,
max_allowed_memberships: 3,
},
public_metadata: {
foo: 'bar',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`Organization has the same initial properties 1`] = `
Organization {
"addMember": [Function],
"adminDeleteEnabled": undefined,
"adminDeleteEnabled": true,
"createdAt": 1970-01-01T00:00:12.345Z,
"destroy": [Function],
"getMemberships": [Function],
Expand All @@ -13,6 +13,7 @@ Organization {
"inviteMember": [Function],
"inviteMembers": [Function],
"logoUrl": "https://url-for-logo.png",
"maxAllowedMemberships": 3,
"membersCount": 1,
"name": "test_name",
"pathRoot": "/organizations",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ OrganizationMembership {
"id": "test_id",
"organization": Organization {
"addMember": [Function],
"adminDeleteEnabled": undefined,
"adminDeleteEnabled": true,
"createdAt": 1970-01-01T00:00:12.345Z,
"destroy": [Function],
"getMemberships": [Function],
Expand All @@ -17,6 +17,7 @@ OrganizationMembership {
"inviteMember": [Function],
"inviteMembers": [Function],
"logoUrl": "https://path-to-logo.png",
"maxAllowedMemberships": 3,
"membersCount": 1,
"name": "test_name",
"pathRoot": "/organizations",
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ export interface OrganizationJSON extends ClerkResourceJSON {
members_count: number;
pending_invitations_count: number;
admin_delete_enabled: boolean;
max_allowed_memberships: number;
}

export interface OrganizationMembershipJSON extends ClerkResourceJSON {
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface OrganizationResource extends ClerkResource {
pendingInvitationsCount: number;
publicMetadata: OrganizationPublicMetadata;
adminDeleteEnabled: boolean;
maxAllowedMemberships: number;
createdAt: Date;
updatedAt: Date;
update: (params: UpdateOrganizationParams) => Promise<OrganizationResource>;
Expand Down

0 comments on commit 73c9c1d

Please sign in to comment.