@mastra/auth-workos 1.4.0-alpha.0 → 1.4.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.
Files changed (2) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,63 @@
1
1
  # @mastra/auth-workos
2
2
 
3
+ ## 1.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Added FGA route policy coverage controls, built-in resource route metadata resolution, and resolver hooks. ([#16485](https://github.com/mastra-ai/mastra/pull/16485))
8
+
9
+ For example:
10
+
11
+ ```ts
12
+ import { MastraFGAWorkos } from '@mastra/auth-workos';
13
+ import type { FGARouteConfig, FGARouteResolver, IFGAProvider } from '@mastra/core/auth/ee';
14
+ import { createRoute } from '@mastra/server/server-adapter';
15
+
16
+ const routeFGA = {
17
+ 'GET /billing/:accountId': {
18
+ resourceType: 'account',
19
+ resourceIdParam: 'accountId',
20
+ permission: 'billing:read',
21
+ },
22
+ } satisfies Record<string, FGARouteConfig>;
23
+
24
+ const resolveRouteFGA: FGARouteResolver = ({ route }) => routeFGA[`${route.method} ${route.path}`];
25
+
26
+ const fga: IFGAProvider = new MastraFGAWorkos({
27
+ apiKey: process.env.WORKOS_API_KEY!,
28
+ clientId: process.env.WORKOS_CLIENT_ID!,
29
+ requireForProtectedRoutes: true,
30
+ auditProtectedRoutes: 'warn',
31
+ resolveRouteFGA,
32
+ validatePermissions: async permissions => {
33
+ /* validate mappings */
34
+ },
35
+ });
36
+
37
+ export const getProjectRoute = createRoute({
38
+ method: 'GET',
39
+ path: '/projects/:projectId',
40
+ responseType: 'json',
41
+ requiresAuth: true,
42
+ fga: {
43
+ resourceType: 'project',
44
+ resourceIdParam: 'projectId',
45
+ permission: 'projects:read',
46
+ },
47
+ handler: async () => {
48
+ return { project: null };
49
+ },
50
+ });
51
+ ```
52
+
53
+ ### Patch Changes
54
+
55
+ - Fixed WorkOS FGA missing resources so authorization checks deny access instead of surfacing provider errors. ([#16485](https://github.com/mastra-ai/mastra/pull/16485))
56
+
57
+ - Updated dependencies [[`b661349`](https://github.com/mastra-ai/mastra/commit/b661349281514691db78941a9044e6e4f1cde7a7), [`816b974`](https://github.com/mastra-ai/mastra/commit/816b974b424e4a1bfae3af30cc41263b6f1c0344), [`271c044`](https://github.com/mastra-ai/mastra/commit/271c044f6b79ff38cfa3409f4385fbd26a0f3185), [`bad08e9`](https://github.com/mastra-ai/mastra/commit/bad08e99c5291884c3ac76743c78c74f53a302c2), [`816b974`](https://github.com/mastra-ai/mastra/commit/816b974b424e4a1bfae3af30cc41263b6f1c0344), [`b32ba5f`](https://github.com/mastra-ai/mastra/commit/b32ba5fde524b46a4ff1bdf38e30d62a2bb29b04), [`75c7c38`](https://github.com/mastra-ai/mastra/commit/75c7c38a4e9af9821931539dd339f57fcc6414e3)]:
58
+ - @mastra/core@1.35.0
59
+ - @mastra/auth@1.0.2
60
+
3
61
  ## 1.4.0-alpha.0
4
62
 
5
63
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/auth-workos",
3
- "version": "1.4.0-alpha.0",
3
+ "version": "1.4.0",
4
4
  "description": "Mastra WorkOS Auth integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -37,9 +37,9 @@
37
37
  "tsup": "^8.5.1",
38
38
  "typescript": "^6.0.3",
39
39
  "vitest": "4.1.5",
40
- "@internal/lint": "0.0.95",
41
- "@internal/types-builder": "0.0.70",
42
- "@mastra/core": "1.35.0-alpha.1"
40
+ "@internal/lint": "0.0.96",
41
+ "@internal/types-builder": "0.0.71",
42
+ "@mastra/core": "1.35.0"
43
43
  },
44
44
  "files": [
45
45
  "dist",