@mastra/auth-workos 1.2.0 → 1.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.
- package/CHANGELOG.md +56 -0
- package/dist/index.cjs +17 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -1
- package/dist/rbac-provider.d.ts +16 -0
- package/dist/rbac-provider.d.ts.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,61 @@
|
|
|
1
1
|
# @mastra/auth-workos
|
|
2
2
|
|
|
3
|
+
## 1.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added optional `getAvailableRoles` and `getPermissionsForRole` methods to the WorkOS RBAC provider, so consumers can list configured roles and inspect their permissions through `@mastra/auth-workos`. ([#16578](https://github.com/mastra-ai/mastra/pull/16578))
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { MastraRBACWorkos } from '@mastra/auth-workos';
|
|
11
|
+
|
|
12
|
+
const rbac = new MastraRBACWorkos({
|
|
13
|
+
/* config */
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// List all available roles
|
|
17
|
+
const roles = await rbac.getAvailableRoles();
|
|
18
|
+
// [{ id: 'admin', name: 'Admin' }, { id: 'member', name: 'Member' }]
|
|
19
|
+
|
|
20
|
+
// Get permissions for a specific role
|
|
21
|
+
const permissions = await rbac.getPermissionsForRole('member');
|
|
22
|
+
// ['agents:read', 'workflows:read']
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [[`20787de`](https://github.com/mastra-ai/mastra/commit/20787de5965234a1af28fe35f49437c537dbfa0d), [`784ad98`](https://github.com/mastra-ai/mastra/commit/784ad989549de91dc5d33ab8ef36caa6f7dcd34e), [`fceae1f`](https://github.com/mastra-ai/mastra/commit/fceae1f5f5db4722cb078a663c6eb4bd22944123), [`090a647`](https://github.com/mastra-ai/mastra/commit/090a647ba5a66d36f203f9f49457e03a1ff4e6fb), [`bf02acb`](https://github.com/mastra-ai/mastra/commit/bf02acbb8a6110f638ac844e89f1ebf04cb7fe74), [`090a647`](https://github.com/mastra-ai/mastra/commit/090a647ba5a66d36f203f9f49457e03a1ff4e6fb), [`bdb4cbf`](https://github.com/mastra-ai/mastra/commit/bdb4cbf8ba4b685d7481f28bb9dc3de6c79c9ed2), [`0fd3fbe`](https://github.com/mastra-ai/mastra/commit/0fd3fbe40fb63657aedd72f6e7b38c8e8ee6940d), [`f84447d`](https://github.com/mastra-ai/mastra/commit/f84447d6c80f3471836a9b300d246b331fb47e0d), [`a1a5b3e`](https://github.com/mastra-ai/mastra/commit/a1a5b3e42ab2ca5161ea21db59ebf28442680fa7), [`af84f57`](https://github.com/mastra-ai/mastra/commit/af84f571ed762e92e8e61c5f9a72363520914274), [`8b3c6f9`](https://github.com/mastra-ai/mastra/commit/8b3c6f90f7879833ba7d1bc70937e1d8f69d0804), [`fed0475`](https://github.com/mastra-ai/mastra/commit/fed0475ccfea31e4fc251469ac05640d0742c1f0), [`0d53730`](https://github.com/mastra-ai/mastra/commit/0d53730c1ed87ef80c87caa5701c4170ea8028e6), [`522f44d`](https://github.com/mastra-ai/mastra/commit/522f44d947214bfc06cff50599bae1ef3494880d)]:
|
|
28
|
+
- @mastra/core@1.34.0
|
|
29
|
+
- @mastra/auth@1.0.2
|
|
30
|
+
|
|
31
|
+
## 1.3.0-alpha.0
|
|
32
|
+
|
|
33
|
+
### Minor Changes
|
|
34
|
+
|
|
35
|
+
- Added optional `getAvailableRoles` and `getPermissionsForRole` methods to the WorkOS RBAC provider, so consumers can list configured roles and inspect their permissions through `@mastra/auth-workos`. ([#16578](https://github.com/mastra-ai/mastra/pull/16578))
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { MastraRBACWorkos } from '@mastra/auth-workos';
|
|
39
|
+
|
|
40
|
+
const rbac = new MastraRBACWorkos({
|
|
41
|
+
/* config */
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// List all available roles
|
|
45
|
+
const roles = await rbac.getAvailableRoles();
|
|
46
|
+
// [{ id: 'admin', name: 'Admin' }, { id: 'member', name: 'Member' }]
|
|
47
|
+
|
|
48
|
+
// Get permissions for a specific role
|
|
49
|
+
const permissions = await rbac.getPermissionsForRole('member');
|
|
50
|
+
// ['agents:read', 'workflows:read']
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- Updated dependencies [[`090a647`](https://github.com/mastra-ai/mastra/commit/090a647ba5a66d36f203f9f49457e03a1ff4e6fb), [`090a647`](https://github.com/mastra-ai/mastra/commit/090a647ba5a66d36f203f9f49457e03a1ff4e6fb), [`f84447d`](https://github.com/mastra-ai/mastra/commit/f84447d6c80f3471836a9b300d246b331fb47e0d), [`a1a5b3e`](https://github.com/mastra-ai/mastra/commit/a1a5b3e42ab2ca5161ea21db59ebf28442680fa7), [`af84f57`](https://github.com/mastra-ai/mastra/commit/af84f571ed762e92e8e61c5f9a72363520914274), [`8b3c6f9`](https://github.com/mastra-ai/mastra/commit/8b3c6f90f7879833ba7d1bc70937e1d8f69d0804)]:
|
|
56
|
+
- @mastra/core@1.34.0-alpha.3
|
|
57
|
+
- @mastra/auth@1.0.2
|
|
58
|
+
|
|
3
59
|
## 1.2.0
|
|
4
60
|
|
|
5
61
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -724,6 +724,23 @@ var MastraRBACWorkos = class {
|
|
|
724
724
|
const userPermissions = await this.getPermissions(user);
|
|
725
725
|
return permissions.some((required) => userPermissions.some((p) => ee.matchesPermission(p, required)));
|
|
726
726
|
}
|
|
727
|
+
/**
|
|
728
|
+
* Get all available roles defined in the role mapping.
|
|
729
|
+
*
|
|
730
|
+
* Returns role IDs and names derived from the roleMapping keys,
|
|
731
|
+
* excluding the `_default` fallback entry.
|
|
732
|
+
*/
|
|
733
|
+
async getAvailableRoles() {
|
|
734
|
+
return Object.keys(this.options.roleMapping).filter((key) => key !== "_default").map((key) => ({ id: key, name: key.charAt(0).toUpperCase() + key.slice(1) }));
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Get resolved permissions for a specific role.
|
|
738
|
+
*
|
|
739
|
+
* Looks up the role in the roleMapping and returns its permissions.
|
|
740
|
+
*/
|
|
741
|
+
async getPermissionsForRole(roleId) {
|
|
742
|
+
return ee.resolvePermissionsFromMapping([roleId], this.options.roleMapping);
|
|
743
|
+
}
|
|
727
744
|
/**
|
|
728
745
|
* Clear the roles cache.
|
|
729
746
|
*
|