@temboplus/afloat 0.1.2 → 0.1.4
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/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/almost_equals.d.ts.map +1 -1
- package/{script/deps/jsr.io/@std/assert/1.0.10 → esm/deps/jsr.io/@std/assert/1.0.11}/array_includes.d.ts.map +1 -1
- package/{script/deps/jsr.io/@std/assert/1.0.10 → esm/deps/jsr.io/@std/assert/1.0.11}/assert.d.ts.map +1 -1
- package/{script/deps/jsr.io/@std/assert/1.0.10 → esm/deps/jsr.io/@std/assert/1.0.11}/assertion_error.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/equal.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/equals.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/exists.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/fail.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/false.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/greater.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/greater_or_equal.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/instance_of.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/is_error.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/less.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/less_or_equal.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/match.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/mod.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/not_equals.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/not_instance_of.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/not_match.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/not_strict_equals.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/object_match.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/rejects.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/strict_equals.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/string_includes.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/throws.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/unimplemented.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/unreachable.d.ts.map +1 -1
- package/esm/src/features/auth/contract.d.ts +14 -25
- package/esm/src/features/auth/contract.d.ts.map +1 -1
- package/esm/src/features/auth/contract.js +8 -15
- package/esm/src/features/auth/identity/contract.d.ts +30 -0
- package/esm/src/features/auth/identity/contract.d.ts.map +1 -0
- package/esm/src/features/auth/identity/contract.js +18 -0
- package/esm/src/features/auth/identity/repository.d.ts +22 -0
- package/esm/src/features/auth/identity/repository.d.ts.map +1 -0
- package/esm/src/features/auth/identity/repository.js +30 -0
- package/esm/src/features/auth/manager.d.ts +50 -27
- package/esm/src/features/auth/manager.d.ts.map +1 -1
- package/esm/src/features/auth/manager.js +101 -58
- package/esm/src/features/auth/profile/contract.d.ts +45 -0
- package/esm/src/features/auth/profile/contract.d.ts.map +1 -0
- package/esm/src/features/auth/profile/contract.js +16 -0
- package/esm/src/features/auth/profile/repository.d.ts +11 -0
- package/esm/src/features/auth/profile/repository.d.ts.map +1 -0
- package/esm/src/features/auth/profile/repository.js +21 -0
- package/esm/src/features/auth/repository.d.ts +1 -0
- package/esm/src/features/auth/repository.d.ts.map +1 -1
- package/esm/src/features/auth/repository.js +5 -22
- package/esm/src/features/auth/storage/client_store.d.ts +30 -0
- package/esm/src/features/auth/storage/client_store.d.ts.map +1 -0
- package/esm/src/features/auth/storage/client_store.js +47 -0
- package/esm/src/features/auth/storage/client_token_handler.d.ts +32 -0
- package/esm/src/features/auth/storage/client_token_handler.d.ts.map +1 -0
- package/esm/src/features/auth/storage/client_token_handler.js +36 -0
- package/esm/src/features/auth/storage/server_store.d.ts +24 -0
- package/esm/src/features/auth/storage/server_store.d.ts.map +1 -0
- package/esm/src/features/auth/storage/server_store.js +34 -0
- package/esm/src/features/auth/storage/server_token_handler.d.ts +35 -0
- package/esm/src/features/auth/storage/server_token_handler.d.ts.map +1 -0
- package/esm/src/features/auth/storage/server_token_handler.js +68 -0
- package/esm/src/features/auth/storage/types.d.ts +42 -0
- package/esm/src/features/auth/storage/types.d.ts.map +1 -0
- package/esm/src/features/auth/storage/types.js +1 -0
- package/esm/src/models/contact/derivatives/contact.d.ts +4 -0
- package/esm/src/models/contact/derivatives/contact.d.ts.map +1 -1
- package/esm/src/models/contact/derivatives/contact.js +6 -0
- package/package.json +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/almost_equals.d.ts.map +1 -1
- package/{esm/deps/jsr.io/@std/assert/1.0.10 → script/deps/jsr.io/@std/assert/1.0.11}/array_includes.d.ts.map +1 -1
- package/{esm/deps/jsr.io/@std/assert/1.0.10 → script/deps/jsr.io/@std/assert/1.0.11}/assert.d.ts.map +1 -1
- package/{esm/deps/jsr.io/@std/assert/1.0.10 → script/deps/jsr.io/@std/assert/1.0.11}/assertion_error.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/equal.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/equals.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/exists.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/fail.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/false.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/greater.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/greater_or_equal.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/instance_of.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/is_error.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/less.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/less_or_equal.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/match.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/mod.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/not_equals.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/not_instance_of.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/not_match.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/not_strict_equals.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/object_match.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/rejects.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/strict_equals.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/string_includes.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/throws.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/unimplemented.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.10 → 1.0.11}/unreachable.d.ts.map +1 -1
- package/script/src/features/auth/contract.d.ts +14 -25
- package/script/src/features/auth/contract.d.ts.map +1 -1
- package/script/src/features/auth/contract.js +9 -16
- package/script/src/features/auth/identity/contract.d.ts +30 -0
- package/script/src/features/auth/identity/contract.d.ts.map +1 -0
- package/script/src/features/auth/identity/contract.js +21 -0
- package/script/src/features/auth/identity/repository.d.ts +22 -0
- package/script/src/features/auth/identity/repository.d.ts.map +1 -0
- package/script/src/features/auth/identity/repository.js +34 -0
- package/script/src/features/auth/manager.d.ts +50 -27
- package/script/src/features/auth/manager.d.ts.map +1 -1
- package/script/src/features/auth/manager.js +101 -58
- package/script/src/features/auth/profile/contract.d.ts +45 -0
- package/script/src/features/auth/profile/contract.d.ts.map +1 -0
- package/script/src/features/auth/profile/contract.js +19 -0
- package/script/src/features/auth/profile/repository.d.ts +11 -0
- package/script/src/features/auth/profile/repository.d.ts.map +1 -0
- package/script/src/features/auth/profile/repository.js +25 -0
- package/script/src/features/auth/repository.d.ts +1 -0
- package/script/src/features/auth/repository.d.ts.map +1 -1
- package/script/src/features/auth/repository.js +6 -23
- package/script/src/features/auth/storage/client_store.d.ts +30 -0
- package/script/src/features/auth/storage/client_store.d.ts.map +1 -0
- package/script/src/features/auth/storage/client_store.js +52 -0
- package/script/src/features/auth/storage/client_token_handler.d.ts +32 -0
- package/script/src/features/auth/storage/client_token_handler.d.ts.map +1 -0
- package/script/src/features/auth/storage/client_token_handler.js +40 -0
- package/script/src/features/auth/storage/server_store.d.ts +24 -0
- package/script/src/features/auth/storage/server_store.d.ts.map +1 -0
- package/script/src/features/auth/storage/server_store.js +38 -0
- package/script/src/features/auth/storage/server_token_handler.d.ts +35 -0
- package/script/src/features/auth/storage/server_token_handler.d.ts.map +1 -0
- package/script/src/features/auth/storage/server_token_handler.js +72 -0
- package/script/src/features/auth/storage/types.d.ts +42 -0
- package/script/src/features/auth/storage/types.d.ts.map +1 -0
- package/script/src/features/auth/storage/types.js +2 -0
- package/script/src/models/contact/derivatives/contact.d.ts +4 -0
- package/script/src/models/contact/derivatives/contact.d.ts.map +1 -1
- package/script/src/models/contact/derivatives/contact.js +6 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client_token_handler.d.ts","sourceRoot":"","sources":["../../../../../src/src/features/auth/storage/client_token_handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,YAAY;IACrD,yBAAyB;IACzB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAqB;IAE7C,uDAAuD;IACvD,OAAO;IAEP;;;OAGG;IACH,MAAM,KAAK,QAAQ,IAAI,kBAAkB,CAExC;IAED;;;OAGG;IACH,YAAY,IAAI,MAAM,GAAG,SAAS;IAIlC;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIjC;;OAEG;IACH,UAAU,IAAI,IAAI;CAGnB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientTokenHandler = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Client-side implementation of TokenHandler.
|
|
6
|
+
* Manages tokens using sessionStorage.
|
|
7
|
+
* @implements {TokenHandler}
|
|
8
|
+
*/
|
|
9
|
+
class ClientTokenHandler {
|
|
10
|
+
/** Private constructor to enforce singleton pattern */
|
|
11
|
+
constructor() { }
|
|
12
|
+
/**
|
|
13
|
+
* Gets the singleton instance of ClientTokenHandler.
|
|
14
|
+
* @returns {ClientTokenHandler} The singleton instance
|
|
15
|
+
*/
|
|
16
|
+
static get instance() {
|
|
17
|
+
return this._instance || (this._instance = new this());
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves the token from sessionStorage.
|
|
21
|
+
* @returns {string | undefined} The stored token or undefined if not present
|
|
22
|
+
*/
|
|
23
|
+
getUserToken() {
|
|
24
|
+
return sessionStorage.getItem("auth_token") || undefined;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Stores the token in sessionStorage.
|
|
28
|
+
* @param {string} token - The token to store
|
|
29
|
+
*/
|
|
30
|
+
setUserToken(token) {
|
|
31
|
+
sessionStorage.setItem("auth_token", token);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Removes the token from sessionStorage.
|
|
35
|
+
*/
|
|
36
|
+
clearToken() {
|
|
37
|
+
sessionStorage.removeItem("auth_token");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.ClientTokenHandler = ClientTokenHandler;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { User } from "../../../models/user/index.js";
|
|
2
|
+
import type { AuthStore } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Server-side implementation of AuthStore.
|
|
5
|
+
* Maintains user state in memory for the duration of a request.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ServerStore implements AuthStore {
|
|
8
|
+
private user?;
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves the current user from memory.
|
|
11
|
+
* @returns {User | undefined} The current user or undefined if not set
|
|
12
|
+
*/
|
|
13
|
+
getUser(): User | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Sets the current user in memory.
|
|
16
|
+
* @param {User} user - The user to store
|
|
17
|
+
*/
|
|
18
|
+
setUser(user: User): void;
|
|
19
|
+
/**
|
|
20
|
+
* Clears the stored user from memory.
|
|
21
|
+
*/
|
|
22
|
+
refresh(): void;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=server_store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server_store.d.ts","sourceRoot":"","sources":["../../../../../src/src/features/auth/storage/server_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;GAGG;AACH,qBAAa,WAAY,YAAW,SAAS;IAC3C,OAAO,CAAC,IAAI,CAAC,CAAO;IAEpB;;;OAGG;IACH,OAAO,IAAI,IAAI,GAAG,SAAS;IAI3B;;;OAGG;IACH,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAIzB;;OAEG;IACH,OAAO,IAAI,IAAI;CAGhB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServerStore = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Server-side implementation of AuthStore.
|
|
6
|
+
* Maintains user state in memory for the duration of a request.
|
|
7
|
+
*/
|
|
8
|
+
class ServerStore {
|
|
9
|
+
constructor() {
|
|
10
|
+
Object.defineProperty(this, "user", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: void 0
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves the current user from memory.
|
|
19
|
+
* @returns {User | undefined} The current user or undefined if not set
|
|
20
|
+
*/
|
|
21
|
+
getUser() {
|
|
22
|
+
return this.user;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Sets the current user in memory.
|
|
26
|
+
* @param {User} user - The user to store
|
|
27
|
+
*/
|
|
28
|
+
setUser(user) {
|
|
29
|
+
this.user = user;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Clears the stored user from memory.
|
|
33
|
+
*/
|
|
34
|
+
refresh() {
|
|
35
|
+
this.user = undefined;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.ServerStore = ServerStore;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { TokenHandler } from "./types.js";
|
|
2
|
+
import { User } from "../../../models/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Server-side implementation of TokenHandler.
|
|
5
|
+
* Manages tokens in memory for the duration of a request.
|
|
6
|
+
* @implements {TokenHandler}
|
|
7
|
+
*/
|
|
8
|
+
export declare class ServerTokenHandler implements TokenHandler {
|
|
9
|
+
private token?;
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new instance of ServerTokenHandler.
|
|
12
|
+
* @param {string} [token] - Optional initial token value
|
|
13
|
+
*/
|
|
14
|
+
constructor(token?: string | undefined);
|
|
15
|
+
/**
|
|
16
|
+
* Returns the stored token.
|
|
17
|
+
* @returns {string | undefined} The current token or undefined if not set
|
|
18
|
+
*/
|
|
19
|
+
getUserToken(): string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Stores the provided token in memory.
|
|
22
|
+
* @param {string} token - The token to store
|
|
23
|
+
*/
|
|
24
|
+
setUserToken(token: string): void;
|
|
25
|
+
/**
|
|
26
|
+
* Clears the stored token from memory.
|
|
27
|
+
*/
|
|
28
|
+
clearToken(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Fetches and constructs the full user data
|
|
31
|
+
* @returns {Promise<User>}
|
|
32
|
+
*/
|
|
33
|
+
constructUser(): Promise<User>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=server_token_handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server_token_handler.d.ts","sourceRoot":"","sources":["../../../../../src/src/features/auth/storage/server_token_handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAKhD;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,YAAY;IAKzC,OAAO,CAAC,KAAK,CAAC;IAJ1B;;;OAGG;gBACiB,KAAK,CAAC,EAAE,MAAM,YAAA;IAElC;;;OAGG;IACH,YAAY,IAAI,MAAM,GAAG,SAAS;IAIlC;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIjC;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;CAyBrC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServerTokenHandler = void 0;
|
|
4
|
+
const index_js_1 = require("../../../models/index.js");
|
|
5
|
+
const repository_js_1 = require("../profile/repository.js");
|
|
6
|
+
const repository_js_2 = require("../identity/repository.js");
|
|
7
|
+
const repository_js_3 = require("../repository.js");
|
|
8
|
+
/**
|
|
9
|
+
* Server-side implementation of TokenHandler.
|
|
10
|
+
* Manages tokens in memory for the duration of a request.
|
|
11
|
+
* @implements {TokenHandler}
|
|
12
|
+
*/
|
|
13
|
+
class ServerTokenHandler {
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new instance of ServerTokenHandler.
|
|
16
|
+
* @param {string} [token] - Optional initial token value
|
|
17
|
+
*/
|
|
18
|
+
constructor(token) {
|
|
19
|
+
Object.defineProperty(this, "token", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true,
|
|
23
|
+
value: token
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Returns the stored token.
|
|
28
|
+
* @returns {string | undefined} The current token or undefined if not set
|
|
29
|
+
*/
|
|
30
|
+
getUserToken() {
|
|
31
|
+
return this.token;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Stores the provided token in memory.
|
|
35
|
+
* @param {string} token - The token to store
|
|
36
|
+
*/
|
|
37
|
+
setUserToken(token) {
|
|
38
|
+
this.token = token;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Clears the stored token from memory.
|
|
42
|
+
*/
|
|
43
|
+
clearToken() {
|
|
44
|
+
this.token = undefined;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Fetches and constructs the full user data
|
|
48
|
+
* @returns {Promise<User>}
|
|
49
|
+
*/
|
|
50
|
+
async constructUser() {
|
|
51
|
+
if (!this.token) {
|
|
52
|
+
throw new Error("Token is required to construct user");
|
|
53
|
+
}
|
|
54
|
+
const profileRepo = new repository_js_1.ProfileRepository();
|
|
55
|
+
const authRepo = new repository_js_3.AuthRepository();
|
|
56
|
+
const logInRepo = new repository_js_2.LoginRepository();
|
|
57
|
+
const token = this.token;
|
|
58
|
+
const [access, profile, identity] = await Promise.all([
|
|
59
|
+
authRepo.getAccessList(token),
|
|
60
|
+
profileRepo.getCurrentProfile(token),
|
|
61
|
+
logInRepo.getIdentity(token),
|
|
62
|
+
]);
|
|
63
|
+
return new index_js_1.User({
|
|
64
|
+
token,
|
|
65
|
+
profile,
|
|
66
|
+
access,
|
|
67
|
+
resetPassword: false,
|
|
68
|
+
loginCredentials: identity,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.ServerTokenHandler = ServerTokenHandler;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { User } from "../../../models/user/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Interface defining the contract for auth storage implementations.
|
|
4
|
+
* This allows for different storage strategies in different environments.
|
|
5
|
+
*/
|
|
6
|
+
export interface AuthStore {
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves the currently authenticated user.
|
|
9
|
+
* @returns {User | undefined} The current user or undefined if not authenticated
|
|
10
|
+
*/
|
|
11
|
+
getUser(): User | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Sets the current authenticated user.
|
|
14
|
+
* @param {User} user - The user to set as currently authenticated
|
|
15
|
+
*/
|
|
16
|
+
setUser(user: User): void;
|
|
17
|
+
/**
|
|
18
|
+
* Clears the current authentication state.
|
|
19
|
+
*/
|
|
20
|
+
refresh(): void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Interface defining the contract for token handling implementations.
|
|
24
|
+
* This allows for different token storage strategies in different environments.
|
|
25
|
+
*/
|
|
26
|
+
export interface TokenHandler {
|
|
27
|
+
/**
|
|
28
|
+
* Retrieves the current authentication token.
|
|
29
|
+
* @returns {string | undefined} The current token or undefined if not present
|
|
30
|
+
*/
|
|
31
|
+
getUserToken(): string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Sets the authentication token.
|
|
34
|
+
* @param {string} token - The token to store
|
|
35
|
+
*/
|
|
36
|
+
setUserToken(token: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* Clears the stored authentication token.
|
|
39
|
+
*/
|
|
40
|
+
clearToken(): void;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/src/features/auth/storage/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAE1D;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB;;;OAGG;IACH,OAAO,IAAI,IAAI,GAAG,SAAS,CAAC;IAE5B;;;OAGG;IACH,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAE1B;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,YAAY,IAAI,MAAM,GAAG,SAAS,CAAC;IAEnC;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAElC;;OAEG;IACH,UAAU,IAAI,IAAI,CAAC;CACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact.d.ts","sourceRoot":"","sources":["../../../../../src/src/models/contact/derivatives/contact.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAc;IAEnC;;OAEG;IACH,OAAO;IAIP;;OAEG;IACH,IAAI,EAAE,IAAI,MAAM,CAEf;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,WAAW,CAEtB;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,IAAI,CAEpB;IAED;;;;;;;;;;;OAWG;IACH,IAAI,IAAI,IAAI,WAAW,GAAG,SAAS,CAoBlC;IAED;;;;;;OAMG;IACH,IAAI,OAAO,IAAI,MAAM,CAIpB;IAED;;;;;;OAMG;IACH,IAAI,KAAK,IAAI,MAAM,CAIlB;IAED;;;OAGG;IACH,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED;;;;;;;OAOG;IACH,IAAI,UAAU,IAAI,MAAM,CAKvB;IAED;;;;;;;OAOG;IACH,IAAI,YAAY,IAAI,MAAM,CAKzB;IAED;;;;;;;OAOG;IACH,IAAI,YAAY,IAAI,MAAM,CAKzB;IAED;;;OAGG;WACW,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO;IAIhD;;;OAGG;WACW,UAAU,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,OAAO,EAAE;IAI7D;;;OAGG;WACW,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,GAAG,IAAI;IAQ3D;;;;;;;;;;;;;;;;;;;;;OAqBG;WACW,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,OAAO;IAUxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;WACW,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,OAAO;IAO9C;;OAEG;IACH,MAAM,IAAI,WAAW;CAGtB"}
|
|
1
|
+
{"version":3,"file":"contact.d.ts","sourceRoot":"","sources":["../../../../../src/src/models/contact/derivatives/contact.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAc;IAEnC;;OAEG;IACH,OAAO;IAIP;;OAEG;IACH,IAAI,EAAE,IAAI,MAAM,CAEf;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,WAAW,CAEtB;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,IAAI,CAEpB;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,IAAI,CAEpB;IAED;;;;;;;;;;;OAWG;IACH,IAAI,IAAI,IAAI,WAAW,GAAG,SAAS,CAoBlC;IAED;;;;;;OAMG;IACH,IAAI,OAAO,IAAI,MAAM,CAIpB;IAED;;;;;;OAMG;IACH,IAAI,KAAK,IAAI,MAAM,CAIlB;IAED;;;OAGG;IACH,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED;;;;;;;OAOG;IACH,IAAI,UAAU,IAAI,MAAM,CAKvB;IAED;;;;;;;OAOG;IACH,IAAI,YAAY,IAAI,MAAM,CAKzB;IAED;;;;;;;OAOG;IACH,IAAI,YAAY,IAAI,MAAM,CAKzB;IAED;;;OAGG;WACW,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO;IAIhD;;;OAGG;WACW,UAAU,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,OAAO,EAAE;IAI7D;;;OAGG;WACW,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,GAAG,IAAI;IAQ3D;;;;;;;;;;;;;;;;;;;;;OAqBG;WACW,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,OAAO;IAUxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;WACW,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,OAAO;IAO9C;;OAEG;IACH,MAAM,IAAI,WAAW;CAGtB"}
|