alp-node-auth 10.0.0 → 11.0.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 +27 -0
- package/README.md +13 -13
- package/dist/definitions/MongoUsersManager.d.ts +2 -2
- package/dist/definitions/MongoUsersManager.d.ts.map +1 -1
- package/dist/definitions/authApolloContext.d.ts +4 -4
- package/dist/definitions/authApolloContext.d.ts.map +1 -1
- package/dist/definitions/authSocketIO.d.ts +4 -4
- package/dist/definitions/authSocketIO.d.ts.map +1 -1
- package/dist/definitions/createAuthController.d.ts +6 -9
- package/dist/definitions/createAuthController.d.ts.map +1 -1
- package/dist/definitions/createRoutes.d.ts +3 -3
- package/dist/definitions/createRoutes.d.ts.map +1 -1
- package/dist/definitions/index.d.ts +24 -25
- package/dist/definitions/index.d.ts.map +1 -1
- package/dist/definitions/services/authentification/AuthenticationService.d.ts +6 -8
- package/dist/definitions/services/authentification/AuthenticationService.d.ts.map +1 -1
- package/dist/definitions/services/authentification/types.d.ts +3 -3
- package/dist/definitions/services/user/UserAccountGoogleService.d.ts +4 -4
- package/dist/definitions/services/user/UserAccountGoogleService.d.ts.map +1 -1
- package/dist/definitions/services/user/UserAccountSlackService.d.ts +4 -4
- package/dist/definitions/services/user/UserAccountSlackService.d.ts.map +1 -1
- package/dist/definitions/services/user/UserAccountsService.d.ts +6 -7
- package/dist/definitions/services/user/UserAccountsService.d.ts.map +1 -1
- package/dist/definitions/services/user/types.d.ts +1 -1
- package/dist/definitions/types.d.ts +1 -1
- package/dist/definitions/utils/cookies.d.ts +3 -4
- package/dist/definitions/utils/cookies.d.ts.map +1 -1
- package/dist/definitions/utils/createFindLoggedInUser.d.ts +4 -4
- package/dist/definitions/utils/createFindLoggedInUser.d.ts.map +1 -1
- package/dist/{index-node18.mjs → index-node20.mjs} +101 -107
- package/dist/index-node20.mjs.map +1 -0
- package/package.json +24 -23
- package/src/MongoUsersManager.ts +5 -6
- package/src/authApolloContext.ts +10 -10
- package/src/authSocketIO.ts +10 -10
- package/src/createAuthController.ts +19 -16
- package/src/createRoutes.ts +8 -8
- package/src/index.ts +58 -63
- package/src/services/authentification/AuthenticationService.ts +37 -37
- package/src/services/authentification/types.ts +6 -6
- package/src/services/user/UserAccountGoogleService.ts +9 -9
- package/src/services/user/UserAccountSlackService.ts +9 -9
- package/src/services/user/UserAccountsService.ts +23 -25
- package/src/services/user/types.ts +1 -1
- package/src/types.ts +1 -1
- package/src/utils/cookies.ts +8 -8
- package/src/utils/createFindLoggedInUser.ts +9 -9
- package/src/utils/generators.ts +4 -4
- package/strategies/dropbox.js +7 -7
- package/strategies/facebook.js +7 -7
- package/strategies/foursquare.js +7 -7
- package/strategies/github.js +7 -7
- package/strategies/google.js +7 -7
- package/strategies/slack.js +7 -7
- package/strategies/strategies.d.ts +7 -7
- package/dist/index-node18.mjs.map +0 -1
- package/src/.eslintrc.json +0 -38
- package/strategies/.eslintrc.json +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [11.0.0](https://github.com/christophehurpeau/alp/compare/alp-node-auth@10.0.0...alp-node-auth@11.0.0) (2025-08-02)
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
* update dependencies and drop node 20
|
|
11
|
+
* update dev dependencies, replace parse-json-object-as-map with native JSON.parse, update koa
|
|
12
|
+
* namedRouteParam and otherRouteParam
|
|
13
|
+
* update koa
|
|
14
|
+
* update liwi-mongo
|
|
15
|
+
* update router-segments
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* update dependencies and drop node 20 ([fc5b322](https://github.com/christophehurpeau/alp/commit/fc5b322e076e9a3c7c4a235d16734b89fd85e211))
|
|
20
|
+
* update dev dependencies, replace parse-json-object-as-map with native JSON.parse, update koa ([5ae7723](https://github.com/christophehurpeau/alp/commit/5ae77238cafc573fe72c5eb63b103802b8b2e537))
|
|
21
|
+
* update koa ([e678114](https://github.com/christophehurpeau/alp/commit/e67811429d951287de715c3dffdbee7b798f3358))
|
|
22
|
+
* update liwi-mongo ([55e04ba](https://github.com/christophehurpeau/alp/commit/55e04baac1ccc46b83880dd03076b0ab0d705ae2))
|
|
23
|
+
* update router-segments ([07ff52b](https://github.com/christophehurpeau/alp/commit/07ff52b3f851204256509056d0a4b25e1f630e5b))
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* namedRouteParam and otherRouteParam ([73e9e2a](https://github.com/christophehurpeau/alp/commit/73e9e2aaf00fe956628efd1380f8e44329562c41))
|
|
28
|
+
|
|
29
|
+
Version bump for dependency: alp-node
|
|
30
|
+
Version bump for dependency: alp-node
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
## [10.0.0](https://github.com/christophehurpeau/alp/compare/alp-node-auth@9.3.0...alp-node-auth@10.0.0) (2024-01-06)
|
|
7
34
|
|
|
8
35
|
|
package/README.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
<
|
|
1
|
+
<h1 align="center">
|
|
2
2
|
alp-node-auth
|
|
3
|
-
</
|
|
3
|
+
</h1>
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
authentication with alp
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
|
-
<a href="https://npmjs.org/package/alp-node-auth"><img src="https://img.shields.io/npm/v/alp-node-auth.svg?style=flat-square"></a>
|
|
11
|
-
<a href="https://npmjs.org/package/alp-node-auth"><img src="https://img.shields.io/npm/dw/alp-node-auth.svg?style=flat-square"></a>
|
|
12
|
-
<a href="https://npmjs.org/package/alp-node-auth"><img src="https://img.shields.io/node/v/alp-node-auth.svg?style=flat-square"></a>
|
|
13
|
-
<a href="https://npmjs.org/package/alp-node-auth"><img src="https://img.shields.io/npm/types/alp-node-auth.svg?style=flat-square"></a>
|
|
10
|
+
<a href="https://npmjs.org/package/alp-node-auth"><img src="https://img.shields.io/npm/v/alp-node-auth.svg?style=flat-square" alt="npm version"></a>
|
|
11
|
+
<a href="https://npmjs.org/package/alp-node-auth"><img src="https://img.shields.io/npm/dw/alp-node-auth.svg?style=flat-square" alt="npm downloads"></a>
|
|
12
|
+
<a href="https://npmjs.org/package/alp-node-auth"><img src="https://img.shields.io/node/v/alp-node-auth.svg?style=flat-square" alt="node version"></a>
|
|
13
|
+
<a href="https://npmjs.org/package/alp-node-auth"><img src="https://img.shields.io/npm/types/alp-node-auth.svg?style=flat-square" alt="types"></a>
|
|
14
14
|
</p>
|
|
15
15
|
|
|
16
16
|
## Install
|
|
@@ -39,10 +39,10 @@ server:
|
|
|
39
39
|
> models/user/usersManager.server.js
|
|
40
40
|
|
|
41
41
|
```js
|
|
42
|
-
import MongoStore from
|
|
43
|
-
import { UsersManager } from
|
|
42
|
+
import MongoStore from "../../db/mongo";
|
|
43
|
+
import { UsersManager } from "alp-node-auth";
|
|
44
44
|
|
|
45
|
-
export default new UsersManager(new MongoStore(
|
|
45
|
+
export default new UsersManager(new MongoStore("users"));
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
> index.server.js
|
|
@@ -71,11 +71,11 @@ app.use(authMiddleware);
|
|
|
71
71
|
> routerBuilder.js
|
|
72
72
|
|
|
73
73
|
```js
|
|
74
|
-
import { routes as authRoutes } from
|
|
74
|
+
import { routes as authRoutes } from "alp-node-auth";
|
|
75
75
|
|
|
76
76
|
export default function buildRouter(builder) {
|
|
77
77
|
builder
|
|
78
|
-
.add(
|
|
78
|
+
.add("home", "/", "home.index")
|
|
79
79
|
.add(...authRoutes.login)
|
|
80
80
|
.add(...authRoutes.logout)
|
|
81
81
|
.addDefaultRoutes();
|
|
@@ -85,8 +85,8 @@ export default function buildRouter(builder) {
|
|
|
85
85
|
> modules/auth/login/index.js
|
|
86
86
|
|
|
87
87
|
```js
|
|
88
|
-
export const identifier =
|
|
89
|
-
export View from
|
|
88
|
+
export const identifier = "login";
|
|
89
|
+
export View from "./LoginView";
|
|
90
90
|
```
|
|
91
91
|
|
|
92
92
|
> modules/auth/login/LoginView.js
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MongoInsertType, MongoStore } from
|
|
2
|
-
import type {
|
|
1
|
+
import type { MongoInsertType, MongoStore } from "liwi-mongo";
|
|
2
|
+
import type { Account, User, UserSanitized } from "./types";
|
|
3
3
|
export default class MongoUsersManager<U extends User = User, USanitized extends UserSanitized = UserSanitized> {
|
|
4
4
|
store: MongoStore<U>;
|
|
5
5
|
constructor(store: MongoStore<U>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MongoUsersManager.d.ts","sourceRoot":"","sources":["../../src/MongoUsersManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAU,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"MongoUsersManager.d.ts","sourceRoot":"","sources":["../../src/MongoUsersManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAU,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE5D,MAAM,CAAC,OAAO,OAAO,iBAAiB,CACpC,CAAC,SAAS,IAAI,GAAG,IAAI,EACrB,UAAU,SAAS,aAAa,GAAG,aAAa;IAEhD,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;gBAET,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;IAIhC,uCAAuC;IACvC,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAIxD,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAIhD,SAAS,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IAIjD,UAAU,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IAIjC,QAAQ,CAAC,IAAI,EAAE,CAAC,GAAG,UAAU;IAI7B,wBAAwB,CAAC,EACvB,SAAS,EACT,MAAM,EACN,QAAQ,GACT,EAAE;QACD,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;QAC3B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAqB1B,aAAa,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAapD,gBAAgB,CAAC,IAAI,EAAE,CAAC,GAAG,aAAa;CAmBzC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { NodeConfig } from
|
|
2
|
-
import type MongoUsersManager from
|
|
3
|
-
import type { User } from
|
|
4
|
-
export declare const createAuthApolloContext: <U extends User = User>(config: NodeConfig, usersManager: MongoUsersManager<U
|
|
1
|
+
import type { NodeConfig } from "alp-node";
|
|
2
|
+
import type MongoUsersManager from "./MongoUsersManager";
|
|
3
|
+
import type { User } from "./types";
|
|
4
|
+
export declare const createAuthApolloContext: <U extends User = User>(config: NodeConfig, usersManager: MongoUsersManager<U>) => any;
|
|
5
5
|
//# sourceMappingURL=authApolloContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authApolloContext.d.ts","sourceRoot":"","sources":["../../src/authApolloContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAiBpC,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"authApolloContext.d.ts","sourceRoot":"","sources":["../../src/authApolloContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAiBpC,eAAO,MAAM,uBAAuB,GAAI,CAAC,SAAS,IAAI,GAAG,IAAI,EAC3D,QAAQ,UAAU,EAClB,cAAc,iBAAiB,CAAC,CAAC,CAAC,KACjC,GA2BF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { NodeApplication } from
|
|
2
|
-
import type MongoUsersManager from
|
|
3
|
-
import type { User } from
|
|
4
|
-
export declare const authSocketIO: <U extends User = User>(app: NodeApplication, usersManager: MongoUsersManager<U
|
|
1
|
+
import type { NodeApplication } from "alp-node";
|
|
2
|
+
import type MongoUsersManager from "./MongoUsersManager";
|
|
3
|
+
import type { User } from "./types";
|
|
4
|
+
export declare const authSocketIO: <U extends User = User>(app: NodeApplication, usersManager: MongoUsersManager<U>, io: any, jwtAudience?: string) => void;
|
|
5
5
|
//# sourceMappingURL=authSocketIO.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authSocketIO.d.ts","sourceRoot":"","sources":["../../src/authSocketIO.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAMpC,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"authSocketIO.d.ts","sourceRoot":"","sources":["../../src/authSocketIO.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAMpC,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,IAAI,GAAG,IAAI,EAChD,KAAK,eAAe,EACpB,cAAc,iBAAiB,CAAC,CAAC,CAAC,EAElC,IAAI,GAAG,EACP,cAAc,MAAM,KACnB,IAgCF,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import type
|
|
3
|
-
import type
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type { User, UserSanitized } from './types';
|
|
1
|
+
import type { AlpRouteRef, Context } from "alp-node";
|
|
2
|
+
import type MongoUsersManager from "./MongoUsersManager";
|
|
3
|
+
import type { AccessResponseHooks, AuthenticationService } from "./services/authentification/AuthenticationService";
|
|
4
|
+
import type { AllowedMapParamsStrategy, AllowedStrategyKeys } from "./services/authentification/types";
|
|
5
|
+
import type { User, UserSanitized } from "./types";
|
|
7
6
|
export interface CreateAuthControllerParams<StrategyKeys extends AllowedStrategyKeys, U extends User = User, USanitized extends UserSanitized = UserSanitized> {
|
|
8
7
|
authenticationService: AuthenticationService<StrategyKeys, U, UserSanitized>;
|
|
9
8
|
homeRouterKey?: string;
|
|
@@ -17,9 +16,7 @@ export interface AuthController {
|
|
|
17
16
|
response: AlpRouteRef;
|
|
18
17
|
logout: AlpRouteRef;
|
|
19
18
|
}
|
|
20
|
-
type OptionalRecord<K extends keyof any, T> =
|
|
21
|
-
[P in K]?: T;
|
|
22
|
-
};
|
|
19
|
+
type OptionalRecord<K extends keyof any, T> = Partial<Record<K, T>>;
|
|
23
20
|
export interface AuthHooks<StrategyKeys extends AllowedStrategyKeys> extends AccessResponseHooks<StrategyKeys> {
|
|
24
21
|
paramsForLogin?: <StrategyKey extends StrategyKeys>(strategy: StrategyKey, ctx: Context) => OptionalRecord<AllowedMapParamsStrategy[StrategyKey], any> | Promise<OptionalRecord<AllowedMapParamsStrategy[StrategyKey], any>> | Promise<void> | void;
|
|
25
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAuthController.d.ts","sourceRoot":"","sources":["../../src/createAuthController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createAuthController.d.ts","sourceRoot":"","sources":["../../src/createAuthController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,KAAK,EACV,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,WAAW,0BAA0B,CACzC,YAAY,SAAS,mBAAmB,EACxC,CAAC,SAAS,IAAI,GAAG,IAAI,EACrB,UAAU,SAAS,aAAa,GAAG,aAAa;IAEhD,qBAAqB,EAAE,qBAAqB,CAAC,YAAY,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC;IAC7E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,iBAAiB,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IAC/C,eAAe,CAAC,EAAE,YAAY,CAAC;IAC/B,SAAS,CAAC,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,WAAW,CAAC;IACtB,QAAQ,EAAE,WAAW,CAAC;IACtB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,KAAK,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,EAAE,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAEpE,MAAM,WAAW,SAAS,CAAC,YAAY,SAAS,mBAAmB,CACjE,SAAQ,mBAAmB,CAAC,YAAY,CAAC;IACzC,cAAc,CAAC,EAAE,CAAC,WAAW,SAAS,YAAY,EAChD,QAAQ,EAAE,WAAW,EACrB,GAAG,EAAE,OAAO,KAEV,cAAc,CAAC,wBAAwB,CAAC,WAAW,CAAC,EAAE,GAAG,CAAC,GAC1D,OAAO,CAAC,cAAc,CAAC,wBAAwB,CAAC,WAAW,CAAC,EAAE,GAAG,CAAC,CAAC,GACnE,OAAO,CAAC,IAAI,CAAC,GAEb,IAAI,CAAC;CACV;AAED,wBAAgB,oBAAoB,CAClC,YAAY,SAAS,mBAAmB,EACxC,CAAC,SAAS,IAAI,GAAG,IAAI,EACrB,UAAU,SAAS,aAAa,GAAG,aAAa,EAChD,EACA,YAAY,EACZ,qBAAqB,EACrB,aAAmB,EACnB,eAAe,EACf,SAAc,GACf,EAAE,0BAA0B,CAAC,YAAY,EAAE,CAAC,EAAE,UAAU,CAAC,GAAG,cAAc,CAyD1E"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { AuthController } from
|
|
1
|
+
import type { AuthController } from "./createAuthController";
|
|
2
2
|
export interface AuthRoutes {
|
|
3
3
|
login: [string, (segment: any) => void];
|
|
4
|
-
addScope: [string, AuthController[
|
|
5
|
-
logout: [string, AuthController[
|
|
4
|
+
addScope: [string, AuthController["addScope"]];
|
|
5
|
+
logout: [string, AuthController["logout"]];
|
|
6
6
|
}
|
|
7
7
|
export declare const createRoutes: (controller: AuthController) => AuthRoutes;
|
|
8
8
|
//# sourceMappingURL=createRoutes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRoutes.d.ts","sourceRoot":"","sources":["../../src/createRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC,CAAC;IACxC,QAAQ,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;IAC/C,MAAM,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;CAC5C;AAED,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"createRoutes.d.ts","sourceRoot":"","sources":["../../src/createRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC,CAAC;IACxC,QAAQ,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;IAC/C,MAAM,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;CAC5C;AAED,eAAO,MAAM,YAAY,GAAI,YAAY,cAAc,KAAG,UAUxD,CAAC"}
|
|
@@ -1,38 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
import type
|
|
4
|
-
import type
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
-
|
|
11
|
-
export { default as
|
|
12
|
-
export { default as
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
declare module 'alp-node' {
|
|
1
|
+
import type { IncomingMessage } from "node:http";
|
|
2
|
+
import type { Context, NodeApplication } from "alp-node";
|
|
3
|
+
import type MongoUsersManager from "./MongoUsersManager";
|
|
4
|
+
import type { AuthController as AuthControllerType, AuthHooks } from "./createAuthController";
|
|
5
|
+
import type { AuthRoutes as AuthRoutesType } from "./createRoutes";
|
|
6
|
+
import type { Strategies } from "./services/authentification/AuthenticationService";
|
|
7
|
+
import type { AllowedStrategyKeys } from "./services/authentification/types";
|
|
8
|
+
import type { AccountService } from "./services/user/types";
|
|
9
|
+
import type { User, UserSanitized } from "./types";
|
|
10
|
+
export { default as MongoUsersManager } from "./MongoUsersManager";
|
|
11
|
+
export { default as UserAccountGoogleService } from "./services/user/UserAccountGoogleService";
|
|
12
|
+
export { default as UserAccountSlackService } from "./services/user/UserAccountSlackService";
|
|
13
|
+
export { authSocketIO } from "./authSocketIO";
|
|
14
|
+
export { createAuthApolloContext } from "./authApolloContext";
|
|
15
|
+
export { STATUSES } from "./services/user/UserAccountsService";
|
|
16
|
+
export type * from "./types";
|
|
17
|
+
declare module "alp-node" {
|
|
19
18
|
interface ContextState {
|
|
20
|
-
loggedInUserId: NonNullable<ContextState[
|
|
19
|
+
loggedInUserId: NonNullable<ContextState["loggedInUser"]>["_id"] | null | undefined;
|
|
21
20
|
loggedInUser: User | null | undefined;
|
|
22
21
|
}
|
|
23
22
|
interface ContextSanitizedState {
|
|
24
|
-
loggedInUserId: NonNullable<ContextSanitizedState[
|
|
23
|
+
loggedInUserId: NonNullable<ContextSanitizedState["loggedInUser"]>["_id"] | null | undefined;
|
|
25
24
|
loggedInUser: UserSanitized | null | undefined;
|
|
26
25
|
}
|
|
27
26
|
interface BaseContext {
|
|
28
|
-
setLoggedIn: (loggedInUserId: NonNullable<ContextState[
|
|
27
|
+
setLoggedIn: (loggedInUserId: NonNullable<ContextState["loggedInUserId"]>, loggedInUser: NonNullable<ContextState["loggedInUser"]>) => Promise<void>;
|
|
29
28
|
logout: () => void;
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
31
|
export type AuthController = AuthControllerType;
|
|
33
32
|
export type AuthRoutes = AuthRoutesType;
|
|
34
|
-
export { AuthenticationService } from
|
|
35
|
-
export default function init<StrategyKeys extends AllowedStrategyKeys =
|
|
33
|
+
export { AuthenticationService } from "./services/authentification/AuthenticationService";
|
|
34
|
+
export default function init<StrategyKeys extends AllowedStrategyKeys = "google", U extends User = User, USanitized extends UserSanitized = UserSanitized>({ homeRouterKey, usersManager, strategies, defaultStrategy, strategyToService, authHooks, jwtAudience, }: {
|
|
36
35
|
homeRouterKey?: string;
|
|
37
36
|
usersManager: MongoUsersManager<U, USanitized>;
|
|
38
37
|
strategies: Strategies<StrategyKeys>;
|
|
@@ -42,8 +41,8 @@ export default function init<StrategyKeys extends AllowedStrategyKeys = 'google'
|
|
|
42
41
|
jwtAudience?: string;
|
|
43
42
|
}): (app: NodeApplication) => {
|
|
44
43
|
routes: AuthRoutesType;
|
|
45
|
-
findLoggedInUserFromRequest: (req: IncomingMessage) =>
|
|
44
|
+
findLoggedInUserFromRequest: (req: IncomingMessage) => ReturnType<import("./utils/createFindLoggedInUser").FindLoggedInUser<U>>;
|
|
46
45
|
findLoggedInUser: import("./utils/createFindLoggedInUser").FindLoggedInUser<U>;
|
|
47
|
-
middleware: <T>(ctx: Context, next: () => T |
|
|
46
|
+
middleware: <T>(ctx: Context, next: () => Promise<T> | T) => Promise<T>;
|
|
48
47
|
};
|
|
49
48
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import type {
|
|
5
|
-
import type
|
|
6
|
-
import type {
|
|
7
|
-
import type UserAccountsService from '../user/UserAccountsService';
|
|
8
|
-
import type { AllowedStrategyKeys, Tokens } from './types';
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
import type { Context, NodeConfig } from "alp-node";
|
|
3
|
+
import type { Strategy as Oauth2Strategy } from "../../../strategies/strategies.d";
|
|
4
|
+
import type { Account, AccountId, User, UserSanitized } from "../../types";
|
|
5
|
+
import type UserAccountsService from "../user/UserAccountsService";
|
|
6
|
+
import type { AllowedStrategyKeys, Tokens } from "./types";
|
|
9
7
|
export interface GenerateAuthUrlOptions {
|
|
10
8
|
accessType?: string;
|
|
11
9
|
grantType?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthenticationService.d.ts","sourceRoot":"","sources":["../../../../src/services/authentification/AuthenticationService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AuthenticationService.d.ts","sourceRoot":"","sources":["../../../../src/services/authentification/AuthenticationService.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export type GoogleParams =
|
|
2
|
-
export type SlackParams =
|
|
3
|
-
export type AllowedStrategyKeys =
|
|
1
|
+
export type GoogleParams = "access_type" | "include_granted_scopes" | "login_hint" | "prompt";
|
|
2
|
+
export type SlackParams = "client_id" | "team";
|
|
3
|
+
export type AllowedStrategyKeys = "google" | "slack";
|
|
4
4
|
export interface AllowedMapParamsStrategy {
|
|
5
5
|
google: GoogleParams;
|
|
6
6
|
slack: SlackParams;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Tokens } from
|
|
2
|
-
import type { AccountService, FullName } from
|
|
3
|
-
export default class UserAccountGoogleService<ScopeKeys extends
|
|
1
|
+
import type { Tokens } from "../authentification/types";
|
|
2
|
+
import type { AccountService, FullName } from "./types";
|
|
3
|
+
export default class UserAccountGoogleService<ScopeKeys extends "login"> implements AccountService<ScopeKeys> {
|
|
4
4
|
scopeKeyToScope: Record<ScopeKeys, string>;
|
|
5
|
-
constructor(scopeKeyToScope: Record<Exclude<
|
|
5
|
+
constructor(scopeKeyToScope: Record<Exclude<"login", ScopeKeys>, string>);
|
|
6
6
|
providerKey: string;
|
|
7
7
|
getProfile(tokens: Tokens): Promise<any>;
|
|
8
8
|
getId(profile: any): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserAccountGoogleService.d.ts","sourceRoot":"","sources":["../../../../src/services/user/UserAccountGoogleService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UserAccountGoogleService.d.ts","sourceRoot":"","sources":["../../../../src/services/user/UserAccountGoogleService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExD,MAAM,CAAC,OAAO,OAAO,wBAAwB,CAAC,SAAS,SAAS,OAAO,CACrE,YAAW,cAAc,CAAC,SAAS,CAAC;IAEpC,eAAe,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;gBAE/B,eAAe,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAOxE,WAAW,SAAY;IAEvB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAOxC,KAAK,CAAC,OAAO,EAAE,GAAG,GAAG,GAAG;IAIxB,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;IAIvD,SAAS,CAAC,OAAO,EAAE,GAAG,GAAG,MAAM,EAAE;IAUjC,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;IAIvD,WAAW,CAAC,OAAO,EAAE,GAAG,GAAG,QAAQ;IAOnC,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;IAI3C,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;CAOrE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Tokens } from
|
|
2
|
-
import type { AccountService, FullName } from
|
|
3
|
-
export default class UserAccountSlackService<ScopeKeys extends
|
|
1
|
+
import type { Tokens } from "../authentification/types";
|
|
2
|
+
import type { AccountService, FullName } from "./types";
|
|
3
|
+
export default class UserAccountSlackService<ScopeKeys extends "login"> implements AccountService<ScopeKeys> {
|
|
4
4
|
scopeKeyToScope: Record<ScopeKeys, string>;
|
|
5
|
-
constructor(scopeKeyToScope: Record<Exclude<
|
|
5
|
+
constructor(scopeKeyToScope: Record<Exclude<"login", ScopeKeys>, string>);
|
|
6
6
|
providerKey: string;
|
|
7
7
|
getProfile(tokens: Tokens): Promise<any>;
|
|
8
8
|
getId(profile: any): string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserAccountSlackService.d.ts","sourceRoot":"","sources":["../../../../src/services/user/UserAccountSlackService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UserAccountSlackService.d.ts","sourceRoot":"","sources":["../../../../src/services/user/UserAccountSlackService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIxD,MAAM,CAAC,OAAO,OAAO,uBAAuB,CAAC,SAAS,SAAS,OAAO,CACpE,YAAW,cAAc,CAAC,SAAS,CAAC;IAEpC,eAAe,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;gBAE/B,eAAe,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAOxE,WAAW,SAAY;IAEvB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAOxC,KAAK,CAAC,OAAO,EAAE,GAAG,GAAG,MAAM,GAAG,IAAI;IASlC,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;IAIvD,SAAS,CAAC,OAAO,EAAE,GAAG,GAAG,MAAM,EAAE;IAIjC,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;IAIvD,WAAW,CAAC,OAAO,EAAE,GAAG,GAAG,QAAQ,GAAG,IAAI;IAI1C,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;IAI3C,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;CAOrE"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import type
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type { AccountService, TokensObject } from './types';
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
import type MongoUsersManager from "../../MongoUsersManager";
|
|
3
|
+
import type { Account, AccountId, User, UserSanitized } from "../../types";
|
|
4
|
+
import type { AllowedStrategyKeys } from "../authentification/types";
|
|
5
|
+
import type { AccountService, TokensObject } from "./types";
|
|
7
6
|
export declare const STATUSES: {
|
|
8
7
|
VALIDATED: string;
|
|
9
8
|
DELETED: string;
|
|
@@ -15,7 +14,7 @@ export default class UserAccountsService<StrategyKeys extends AllowedStrategyKey
|
|
|
15
14
|
getScope(strategy: StrategyKeys, scopeKey: string, user?: U, accountId?: AccountId): string;
|
|
16
15
|
update(user: U, strategy: StrategyKeys, tokens: TokensObject, scope: string, subservice: string): Promise<{
|
|
17
16
|
user: U;
|
|
18
|
-
account: U[
|
|
17
|
+
account: U["accounts"][number];
|
|
19
18
|
}>;
|
|
20
19
|
findOrCreateFromStrategy(strategy: StrategyKeys, tokens: TokensObject, scope: string, subservice: string): Promise<U>;
|
|
21
20
|
updateAccount(user: U, account: Account): Promise<U>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserAccountsService.d.ts","sourceRoot":"","sources":["../../../../src/services/user/UserAccountsService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UserAccountsService.d.ts","sourceRoot":"","sources":["../../../../src/services/user/UserAccountsService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,KAAK,iBAAiB,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAI5D,eAAO,MAAM,QAAQ;;;CAGpB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,mBAAmB,CACtC,YAAY,SAAS,mBAAmB,EACxC,CAAC,SAAS,IAAI,GAAG,IAAI,EACrB,UAAU,SAAS,aAAa,GAAG,aAAa,CAEhD,SAAQ,YAAY;IACpB,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA4C;IAE9E,YAAY,EAAE,iBAAiB,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;gBAG7C,YAAY,EAAE,iBAAiB,CAAC,CAAC,EAAE,UAAU,CAAC,EAC9C,iBAAiB,EAAE,MAAM,CAAC,YAAY,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;IAO9D,QAAQ,CACN,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,CAAC,EACR,SAAS,CAAC,EAAE,SAAS,GACpB,MAAM;IAsBH,MAAM,CACV,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,OAAO,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAA;KAAE,CAAC;IA+BjD,wBAAwB,CAC5B,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,CAAC,CAAC;IA0FP,aAAa,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;CAI3D"}
|
|
@@ -10,7 +10,7 @@ export interface TokensObject {
|
|
|
10
10
|
expireDate: Date | null;
|
|
11
11
|
idToken: string;
|
|
12
12
|
}
|
|
13
|
-
export interface AccountService<ScopeKeys extends
|
|
13
|
+
export interface AccountService<ScopeKeys extends "login"> {
|
|
14
14
|
scopeKeyToScope: Record<ScopeKeys, string>;
|
|
15
15
|
providerKey: string;
|
|
16
16
|
getProfile: (tokens: TokensObject) => Promise<any>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
import type { Option } from 'cookies';
|
|
1
|
+
import type { IncomingMessage } from "node:http";
|
|
2
|
+
import type { Option } from "cookies";
|
|
4
3
|
export declare const COOKIE_NAME_TOKEN = "loggedInUserToken";
|
|
5
4
|
export declare const COOKIE_NAME_STATE = "loggedInUserState";
|
|
6
|
-
export declare const getTokenFromRequest: (req: IncomingMessage, options?: Pick<Option, Exclude<keyof Option,
|
|
5
|
+
export declare const getTokenFromRequest: (req: IncomingMessage, options?: Pick<Option, Exclude<keyof Option, "secure">>) => string | undefined;
|
|
7
6
|
//# sourceMappingURL=cookies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../../../src/utils/cookies.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../../../src/utils/cookies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGtC,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AACrD,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD,eAAO,MAAM,mBAAmB,GAC9B,KAAK,eAAe,EACpB,UAAU,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,MAAM,EAAE,QAAQ,CAAC,CAAC,KACtD,MAAM,GAAG,SAYX,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Logger } from
|
|
2
|
-
import type MongoUsersManager from
|
|
3
|
-
import type { User, UserSanitized } from
|
|
4
|
-
export type FindLoggedInUser<U extends User> = (jwtAudience?: string, token?: string) => Promise<[U[
|
|
1
|
+
import type { Logger } from "nightingale-logger";
|
|
2
|
+
import type MongoUsersManager from "../MongoUsersManager";
|
|
3
|
+
import type { User, UserSanitized } from "../types";
|
|
4
|
+
export type FindLoggedInUser<U extends User> = (jwtAudience?: string, token?: string) => Promise<[U["_id"] | null | undefined, U | null | undefined]>;
|
|
5
5
|
export declare const createFindLoggedInUser: <U extends User, USanitized extends UserSanitized>(secretKey: string, usersManager: MongoUsersManager<U, USanitized>, logger: Logger) => FindLoggedInUser<U>;
|
|
6
6
|
//# sourceMappingURL=createFindLoggedInUser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFindLoggedInUser.d.ts","sourceRoot":"","sources":["../../../src/utils/createFindLoggedInUser.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,iBAAiB,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA0BpD,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,IAAI,IAAI,CAC7C,WAAW,CAAC,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE,MAAM,KACX,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,SAAS,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC;AAElE,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"createFindLoggedInUser.d.ts","sourceRoot":"","sources":["../../../src/utils/createFindLoggedInUser.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,iBAAiB,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA0BpD,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,IAAI,IAAI,CAC7C,WAAW,CAAC,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE,MAAM,KACX,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,SAAS,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC;AAElE,eAAO,MAAM,sBAAsB,GACjC,CAAC,SAAS,IAAI,EACd,UAAU,SAAS,aAAa,EAEhC,WAAW,MAAM,EACjB,cAAc,iBAAiB,CAAC,CAAC,EAAE,UAAU,CAAC,EAC9C,QAAQ,MAAM,KACb,gBAAgB,CAAC,CAAC,CAuBpB,CAAC"}
|