@c9up/warden 0.1.0 → 0.1.3

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.
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c9up/warden",
3
- "version": "0.1.0",
3
+ "version": "0.1.3",
4
4
  "description": "Warden — Authentication for the Ream framework",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -3,7 +3,7 @@ import type { WardenConfig } from "./config.js";
3
3
  import { WardenError } from "./errors.js";
4
4
  import { MemoryRightsStore } from "./rights/MemoryRightsStore.js";
5
5
  import { RightsResolver } from "./rights/RightsResolver.js";
6
- import { _setAuth } from "./services/main.js";
6
+ import { setAuth } from "./services/main.js";
7
7
  import { JwtStrategy } from "./strategies/JwtStrategy.js";
8
8
 
9
9
  interface WardenContainer {
@@ -79,6 +79,6 @@ export default class WardenProvider {
79
79
  }
80
80
 
81
81
  async boot() {
82
- _setAuth(this.app.container.resolve(AuthManager) as AuthManager);
82
+ setAuth(this.app.container.resolve(AuthManager) as AuthManager);
83
83
  }
84
84
  }
@@ -12,28 +12,28 @@
12
12
 
13
13
  import type { AuthManager } from "../AuthManager.js";
14
14
 
15
- let _instance: AuthManager | undefined;
15
+ let instance: AuthManager | undefined;
16
16
 
17
17
  /** @internal Bind the singleton (called by WardenProvider). */
18
- export function _setAuth(instance: AuthManager): void {
19
- _instance = instance;
18
+ export function setAuth(value: AuthManager): void {
19
+ instance = value;
20
20
  }
21
21
 
22
22
  /** @internal Read the singleton (or `undefined` pre-boot). */
23
- export function _getAuth(): AuthManager | undefined {
24
- return _instance;
23
+ export function getAuth(): AuthManager | undefined {
24
+ return instance;
25
25
  }
26
26
 
27
27
  const auth: AuthManager = new Proxy({} as AuthManager, {
28
28
  get(_target, prop) {
29
- if (!_instance) {
29
+ if (!instance) {
30
30
  throw new Error(
31
31
  "[warden] AuthManager singleton accessed before WardenProvider.boot() ran. " +
32
32
  "Check that `@c9up/warden/provider` is listed in your reamrc.ts providers.",
33
33
  );
34
34
  }
35
- const value = Reflect.get(_instance, prop, _instance);
36
- return typeof value === "function" ? value.bind(_instance) : value;
35
+ const value = Reflect.get(instance, prop, instance);
36
+ return typeof value === "function" ? value.bind(instance) : value;
37
37
  },
38
38
  });
39
39