@cedarjs/testing 8.0.0-canary.3539 → 8.0.0-canary.3540

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.
@@ -15,6 +15,7 @@ export declare function useAuth(): {
15
15
  getCurrentUser: () => Promise<import("@cedarjs/auth").CurrentUser>;
16
16
  hasRole: (roles: string | string[]) => boolean;
17
17
  hasUserRole: (roles: string | string[]) => boolean;
18
+ hasPermission: (permission: string) => boolean;
18
19
  reauthenticate: () => Promise<void>;
19
20
  forgotPassword: () => Promise<void>;
20
21
  resetPassword: () => Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"mockAuth.d.ts","sourceRoot":"","sources":["../../src/web/mockAuth.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,cAAc,eAAe,CAAA;AAM7B,UAAU,KAAK;IACb,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAQD,wBAAgB,OAAO;;;;;;;;;;qBACG,MAAM,GAAG,MAAM,EAAE;yBAAjB,MAAM,GAAG,MAAM,EAAE;;;;;;;;;EAwB1C;AAED,eAAO,MAAM,oBAAoB;;;CAEhC,CAAA"}
1
+ {"version":3,"file":"mockAuth.d.ts","sourceRoot":"","sources":["../../src/web/mockAuth.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,cAAc,eAAe,CAAA;AAO7B,UAAU,KAAK;IACb,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAUD,wBAAgB,OAAO;;;;;;;;;;qBAEG,MAAM,GAAG,MAAM,EAAE;yBAAjB,MAAM,GAAG,MAAM,EAAE;;;;;;;;;;EAyB1C;AAED,eAAO,MAAM,oBAAoB;;;CAEhC,CAAA"}
@@ -1,11 +1,13 @@
1
1
  import React from "react";
2
2
  export * from "@cedarjs/auth";
3
+ import { HasPermissionContext } from "@cedarjs/auth";
3
4
  import { currentUserHasRole } from "@cedarjs/auth/currentUserHasRole";
4
5
  import { mockedUserMeta } from "./mockRequests.js";
5
6
  const AuthProvider = ({ children }) => {
6
7
  return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
7
8
  };
8
9
  function useAuth() {
10
+ const scopedHasPermission = React.useContext(HasPermissionContext);
9
11
  const hasRole = (roles) => currentUserHasRole(mockedUserMeta.currentUser, roles);
10
12
  return {
11
13
  loading: false,
@@ -22,6 +24,7 @@ function useAuth() {
22
24
  getCurrentUser: async () => mockedUserMeta.currentUser,
23
25
  hasRole,
24
26
  hasUserRole: hasRole,
27
+ hasPermission: scopedHasPermission ?? (() => false),
25
28
  reauthenticate: async () => {
26
29
  },
27
30
  forgotPassword: async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/testing",
3
- "version": "8.0.0-canary.3539",
3
+ "version": "8.0.0-canary.3540",
4
4
  "description": "Tools, wrappers and configuration for testing a Cedar project.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -54,9 +54,9 @@
54
54
  "test:watch": "vitest watch"
55
55
  },
56
56
  "dependencies": {
57
- "@cedarjs/context": "8.0.0-canary.3539",
58
- "@cedarjs/graphql-server": "8.0.0-canary.3539",
59
- "@cedarjs/project-config": "8.0.0-canary.3539",
57
+ "@cedarjs/context": "8.0.0-canary.3540",
58
+ "@cedarjs/graphql-server": "8.0.0-canary.3540",
59
+ "@cedarjs/project-config": "8.0.0-canary.3540",
60
60
  "@prisma/internals": "7.10.1",
61
61
  "@testing-library/dom": "10.4.2",
62
62
  "@testing-library/jest-dom": "6.9.1",
@@ -74,19 +74,19 @@
74
74
  },
75
75
  "devDependencies": {
76
76
  "@arethetypeswrong/cli": "0.18.5",
77
- "@cedarjs/auth": "8.0.0-canary.3539",
78
- "@cedarjs/framework-tools": "8.0.0-canary.3539",
79
- "@cedarjs/router": "8.0.0-canary.3539",
80
- "@cedarjs/web": "8.0.0-canary.3539",
77
+ "@cedarjs/auth": "8.0.0-canary.3540",
78
+ "@cedarjs/framework-tools": "8.0.0-canary.3540",
79
+ "@cedarjs/router": "8.0.0-canary.3540",
80
+ "@cedarjs/web": "8.0.0-canary.3540",
81
81
  "concurrently": "9.2.5",
82
82
  "publint": "0.3.25",
83
83
  "typescript": "5.9.3",
84
84
  "vitest": "4.1.12"
85
85
  },
86
86
  "peerDependencies": {
87
- "@cedarjs/auth": "8.0.0-canary.3539",
88
- "@cedarjs/router": "8.0.0-canary.3539",
89
- "@cedarjs/web": "8.0.0-canary.3539",
87
+ "@cedarjs/auth": "8.0.0-canary.3540",
88
+ "@cedarjs/router": "8.0.0-canary.3540",
89
+ "@cedarjs/web": "8.0.0-canary.3540",
90
90
  "vitest": "4.1.12"
91
91
  },
92
92
  "peerDependenciesMeta": {