@occupop/lib-auth 1.0.1 → 1.0.2

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/dist/index.d.ts CHANGED
@@ -23,10 +23,10 @@ export declare function makeAuthContextValueFunction<IContainer extends AwilixCo
23
23
  container: IContainer;
24
24
  }): ({ req }: {
25
25
  req: Request;
26
- }) => {
26
+ }) => Promise<{
27
27
  container: AwilixContainer<any>;
28
- };
28
+ }>;
29
29
  export declare function makeAuthContextMiddleware<IContainer extends AwilixContainer>({ container, }: {
30
30
  container: IContainer;
31
- }): (req: Request) => void;
31
+ }): (req: Request) => Promise<void>;
32
32
  export {};
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ export function getScopedUser(req) {
32
32
  return null;
33
33
  }
34
34
  export function makeAuthContextValueFunction({ container }) {
35
- return ({ req }) => {
35
+ return async ({ req }) => {
36
36
  const authUser = getAuthUser(req);
37
37
  const scopedUser = getScopedUser(req);
38
38
  const scopedContainer = container.createScope();
@@ -44,9 +44,9 @@ export function makeAuthContextValueFunction({ container }) {
44
44
  };
45
45
  }
46
46
  export function makeAuthContextMiddleware({ container, }) {
47
- return (req) => {
47
+ return async (req) => {
48
48
  const authContextValueFunction = makeAuthContextValueFunction({ container });
49
- const contextValue = authContextValueFunction({ req });
49
+ const contextValue = await authContextValueFunction({ req });
50
50
  req.container = contextValue.container;
51
51
  };
52
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@occupop/lib-auth",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "index.ts",
6
6
  "description": "...",