@temboplus/afloat 0.1.8 → 0.1.10
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/src/features/auth/manager.d.ts +17 -13
- package/esm/src/features/auth/manager.d.ts.map +1 -1
- package/esm/src/features/auth/manager.js +19 -26
- package/esm/src/features/auth/storage/client_store.d.ts.map +1 -1
- package/esm/src/features/auth/storage/client_store.js +3 -3
- package/package.json +4 -4
- package/script/src/features/auth/manager.d.ts +17 -13
- package/script/src/features/auth/manager.d.ts.map +1 -1
- package/script/src/features/auth/manager.js +19 -26
- package/script/src/features/auth/storage/client_store.d.ts.map +1 -1
- package/script/src/features/auth/storage/client_store.js +1 -1
- package/esm/_dnt.shims.d.ts +0 -6
- package/esm/_dnt.shims.d.ts.map +0 -1
- package/esm/_dnt.shims.js +0 -61
- package/esm/src/utils/env_detect.d.ts +0 -28
- package/esm/src/utils/env_detect.d.ts.map +0 -1
- package/esm/src/utils/env_detect.js +0 -75
- package/script/_dnt.shims.d.ts +0 -6
- package/script/_dnt.shims.d.ts.map +0 -1
- package/script/_dnt.shims.js +0 -65
- package/script/src/utils/env_detect.d.ts +0 -28
- package/script/src/utils/env_detect.d.ts.map +0 -1
- package/script/src/utils/env_detect.js +0 -105
|
@@ -9,6 +9,7 @@ export declare class AfloatAuth {
|
|
|
9
9
|
private store;
|
|
10
10
|
/** The token handler implementation */
|
|
11
11
|
private tokenHandler;
|
|
12
|
+
/** client AfloatAuth instance */
|
|
12
13
|
private static _instance;
|
|
13
14
|
/**
|
|
14
15
|
* Private constructor to prevent direct instantiation.
|
|
@@ -17,25 +18,28 @@ export declare class AfloatAuth {
|
|
|
17
18
|
*/
|
|
18
19
|
private constructor();
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
-
* This
|
|
22
|
-
*
|
|
21
|
+
* Gets or creates the client-side singleton instance of AfloatAuth.
|
|
22
|
+
* This getter will automatically initialize the client instance if it hasn't been created yet.
|
|
23
|
+
* For server-side usage, use initializeServer() instead.
|
|
24
|
+
*
|
|
25
|
+
* @returns {AfloatAuth} The client-side singleton instance
|
|
26
|
+
* @example
|
|
27
|
+
* // Client-side usage
|
|
28
|
+
* const auth = AfloatAuth.instance;
|
|
29
|
+
*
|
|
30
|
+
* // Server-side usage (don't use .instance)
|
|
31
|
+
* const serverAuth = await AfloatAuth.initializeServer(token);
|
|
23
32
|
*/
|
|
24
|
-
static
|
|
33
|
+
static get instance(): AfloatAuth;
|
|
25
34
|
/**
|
|
26
|
-
* Creates a new instance of AfloatAuth
|
|
27
|
-
*
|
|
35
|
+
* Creates a new server-side instance of AfloatAuth.
|
|
36
|
+
* Unlike the client-side instance getter, this creates a new instance each time.
|
|
37
|
+
*
|
|
28
38
|
* @param {string} token - Authentication token
|
|
29
|
-
* @returns {Promise<AfloatAuth>} A new
|
|
39
|
+
* @returns {Promise<AfloatAuth>} A new server-side instance
|
|
30
40
|
* @throws {Error} If token is invalid or required data cannot be fetched
|
|
31
41
|
*/
|
|
32
42
|
static initializeServer(token: string): Promise<AfloatAuth>;
|
|
33
|
-
/**
|
|
34
|
-
* Gets the singleton instance of AfloatAuth.
|
|
35
|
-
* @throws {Error} If AfloatAuth hasn't been initialized
|
|
36
|
-
* @returns {AfloatAuth} The singleton instance
|
|
37
|
-
*/
|
|
38
|
-
static get instance(): AfloatAuth;
|
|
39
43
|
/**
|
|
40
44
|
* Gets the authentication repository instance.
|
|
41
45
|
* @private
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../../src/src/features/auth/manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../../src/src/features/auth/manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAU7D;;;GAGG;AACH,qBAAa,UAAU;IACrB,oCAAoC;IACpC,OAAO,CAAC,KAAK,CAAY;IAEzB,uCAAuC;IACvC,OAAO,CAAC,YAAY,CAAe;IAEnC,iCAAiC;IACjC,OAAO,CAAC,MAAM,CAAC,SAAS,CAA2B;IACnD;;;;OAIG;IACH,OAAO;IAKP;;;;;;;;;;;;OAYG;IACH,WAAkB,QAAQ,IAAI,UAAU,CAKvC;IAED;;;;;;;OAOG;WACiB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAwBxE;;;;OAIG;IACH,OAAO,KAAK,IAAI,GAEf;IAED;;;OAGG;IACH,YAAY,IAAI,MAAM,GAAG,SAAS;IAIlC;;;OAGG;IACH,IAAI,WAAW,IAAI,IAAI,GAAG,SAAS,CAElC;IAED;;;;OAIG;IACH,cAAc,IAAI,IAAI,GAAG,SAAS;IAIlC;;;;OAIG;IACH,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO;IAI1C;;;;;;OAMG;IACG,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ3D;;;;;;OAMG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAMvE;;OAEG;IACH,MAAM,IAAI,IAAI;IAId;;;OAGG;IACH,OAAO,CAAC,cAAc;CAIvB"}
|
|
@@ -3,7 +3,6 @@ import { createClientStore, useClientUser, } from "./storage/client_store.js";
|
|
|
3
3
|
import { ClientTokenHandler } from "./storage/client_token_handler.js";
|
|
4
4
|
import { ServerStore } from "./storage/server_store.js";
|
|
5
5
|
import { ServerTokenHandler } from "./storage/server_token_handler.js";
|
|
6
|
-
import { EnvironmentDetector } from "../../utils/env_detect.js";
|
|
7
6
|
/**
|
|
8
7
|
* Main authentication class that works in both client and server environments.
|
|
9
8
|
* Provides authentication functionality and user management.
|
|
@@ -33,19 +32,27 @@ export class AfloatAuth {
|
|
|
33
32
|
this.tokenHandler = tokenHandler;
|
|
34
33
|
}
|
|
35
34
|
/**
|
|
36
|
-
*
|
|
37
|
-
* This
|
|
38
|
-
*
|
|
35
|
+
* Gets or creates the client-side singleton instance of AfloatAuth.
|
|
36
|
+
* This getter will automatically initialize the client instance if it hasn't been created yet.
|
|
37
|
+
* For server-side usage, use initializeServer() instead.
|
|
38
|
+
*
|
|
39
|
+
* @returns {AfloatAuth} The client-side singleton instance
|
|
40
|
+
* @example
|
|
41
|
+
* // Client-side usage
|
|
42
|
+
* const auth = AfloatAuth.instance;
|
|
43
|
+
*
|
|
44
|
+
* // Server-side usage (don't use .instance)
|
|
45
|
+
* const serverAuth = await AfloatAuth.initializeServer(token);
|
|
39
46
|
*/
|
|
40
|
-
static
|
|
41
|
-
|
|
42
|
-
return this._instance;
|
|
47
|
+
static get instance() {
|
|
48
|
+
return AfloatAuth._instance || (AfloatAuth._instance = new AfloatAuth(createClientStore(), ClientTokenHandler.instance));
|
|
43
49
|
}
|
|
44
50
|
/**
|
|
45
|
-
* Creates a new instance of AfloatAuth
|
|
46
|
-
*
|
|
51
|
+
* Creates a new server-side instance of AfloatAuth.
|
|
52
|
+
* Unlike the client-side instance getter, this creates a new instance each time.
|
|
53
|
+
*
|
|
47
54
|
* @param {string} token - Authentication token
|
|
48
|
-
* @returns {Promise<AfloatAuth>} A new
|
|
55
|
+
* @returns {Promise<AfloatAuth>} A new server-side instance
|
|
49
56
|
* @throws {Error} If token is invalid or required data cannot be fetched
|
|
50
57
|
*/
|
|
51
58
|
static async initializeServer(token) {
|
|
@@ -59,8 +66,7 @@ export class AfloatAuth {
|
|
|
59
66
|
const user = await tokenHandler.constructUser();
|
|
60
67
|
store.setUser(user);
|
|
61
68
|
// Create and initialize auth instance
|
|
62
|
-
|
|
63
|
-
return this._instance;
|
|
69
|
+
return new AfloatAuth(store, tokenHandler);
|
|
64
70
|
}
|
|
65
71
|
catch (error) {
|
|
66
72
|
if (error instanceof Error) {
|
|
@@ -69,20 +75,6 @@ export class AfloatAuth {
|
|
|
69
75
|
throw new Error("Failed to initialize server auth");
|
|
70
76
|
}
|
|
71
77
|
}
|
|
72
|
-
/**
|
|
73
|
-
* Gets the singleton instance of AfloatAuth.
|
|
74
|
-
* @throws {Error} If AfloatAuth hasn't been initialized
|
|
75
|
-
* @returns {AfloatAuth} The singleton instance
|
|
76
|
-
*/
|
|
77
|
-
static get instance() {
|
|
78
|
-
if (!this._instance) {
|
|
79
|
-
if (EnvironmentDetector.isClient()) {
|
|
80
|
-
return this.initializeClient();
|
|
81
|
-
}
|
|
82
|
-
throw new Error("AfloatAuth has not been initialized");
|
|
83
|
-
}
|
|
84
|
-
return this._instance;
|
|
85
|
-
}
|
|
86
78
|
/**
|
|
87
79
|
* Gets the authentication repository instance.
|
|
88
80
|
* @private
|
|
@@ -162,6 +154,7 @@ export class AfloatAuth {
|
|
|
162
154
|
this.tokenHandler.clearToken();
|
|
163
155
|
}
|
|
164
156
|
}
|
|
157
|
+
/** client AfloatAuth instance */
|
|
165
158
|
Object.defineProperty(AfloatAuth, "_instance", {
|
|
166
159
|
enumerable: true,
|
|
167
160
|
configurable: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client_store.d.ts","sourceRoot":"","sources":["../../../../../src/src/features/auth/storage/client_store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAU,KAAK,QAAQ,EAAE,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"client_store.d.ts","sourceRoot":"","sources":["../../../../../src/src/features/auth/storage/client_store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAU,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAY,MAAM,SAAS,CAAC;AAE9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAK5C,4CAA4C;AAC5C,KAAK,KAAK,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAE1C,8CAA8C;AAC9C,UAAU,OAAO;IACf,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC9B,OAAO,EAAE,MAAM,IAAI,GAAG,SAAS,CAAC;IAChC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,QAAQ,CAAC,KAAK,GAAG,OAAO,CAAC,CA2BhE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,SAMpC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,QAAO,IAAI,GAAG,SAEvC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { User } from "../../../models/user/index.js";
|
|
2
|
-
import { create } from "zustand";
|
|
3
|
-
import {
|
|
2
|
+
import { create, useStore } from "zustand";
|
|
3
|
+
import { createJSONStorage, persist } from "zustand/middleware";
|
|
4
4
|
/** Key used for storing auth data in session storage */
|
|
5
5
|
const AUTH_STORE_SESSION_STORAGE_KEY = "auth-store";
|
|
6
6
|
/**
|
|
@@ -42,5 +42,5 @@ export const createClientStore = () => {
|
|
|
42
42
|
* @returns {User | undefined} The current user or undefined if not authenticated
|
|
43
43
|
*/
|
|
44
44
|
export const useClientUser = () => {
|
|
45
|
-
return clientStore
|
|
45
|
+
return useStore(clientStore).getUser();
|
|
46
46
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temboplus/afloat",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "A JavaScript/TypeScript package providing common utilities and logic shared across all Temboplus-Afloat Projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"antd": "^5.22.7",
|
|
29
29
|
"uuid": "^11.0.3",
|
|
30
30
|
"zod": "^3.24.1",
|
|
31
|
-
"zustand": "^5.0.2"
|
|
32
|
-
"@deno/shim-deno": "~0.18.0"
|
|
31
|
+
"zustand": "^5.0.2"
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {
|
|
35
34
|
"@types/node": "^20.9.0",
|
|
36
35
|
"picocolors": "^1.0.0",
|
|
37
|
-
"@faker-js/faker": "9.3.0"
|
|
36
|
+
"@faker-js/faker": "9.3.0",
|
|
37
|
+
"@deno/shim-deno": "~0.18.0"
|
|
38
38
|
},
|
|
39
39
|
"_generatedBy": "dnt@dev"
|
|
40
40
|
}
|
|
@@ -9,6 +9,7 @@ export declare class AfloatAuth {
|
|
|
9
9
|
private store;
|
|
10
10
|
/** The token handler implementation */
|
|
11
11
|
private tokenHandler;
|
|
12
|
+
/** client AfloatAuth instance */
|
|
12
13
|
private static _instance;
|
|
13
14
|
/**
|
|
14
15
|
* Private constructor to prevent direct instantiation.
|
|
@@ -17,25 +18,28 @@ export declare class AfloatAuth {
|
|
|
17
18
|
*/
|
|
18
19
|
private constructor();
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
-
* This
|
|
22
|
-
*
|
|
21
|
+
* Gets or creates the client-side singleton instance of AfloatAuth.
|
|
22
|
+
* This getter will automatically initialize the client instance if it hasn't been created yet.
|
|
23
|
+
* For server-side usage, use initializeServer() instead.
|
|
24
|
+
*
|
|
25
|
+
* @returns {AfloatAuth} The client-side singleton instance
|
|
26
|
+
* @example
|
|
27
|
+
* // Client-side usage
|
|
28
|
+
* const auth = AfloatAuth.instance;
|
|
29
|
+
*
|
|
30
|
+
* // Server-side usage (don't use .instance)
|
|
31
|
+
* const serverAuth = await AfloatAuth.initializeServer(token);
|
|
23
32
|
*/
|
|
24
|
-
static
|
|
33
|
+
static get instance(): AfloatAuth;
|
|
25
34
|
/**
|
|
26
|
-
* Creates a new instance of AfloatAuth
|
|
27
|
-
*
|
|
35
|
+
* Creates a new server-side instance of AfloatAuth.
|
|
36
|
+
* Unlike the client-side instance getter, this creates a new instance each time.
|
|
37
|
+
*
|
|
28
38
|
* @param {string} token - Authentication token
|
|
29
|
-
* @returns {Promise<AfloatAuth>} A new
|
|
39
|
+
* @returns {Promise<AfloatAuth>} A new server-side instance
|
|
30
40
|
* @throws {Error} If token is invalid or required data cannot be fetched
|
|
31
41
|
*/
|
|
32
42
|
static initializeServer(token: string): Promise<AfloatAuth>;
|
|
33
|
-
/**
|
|
34
|
-
* Gets the singleton instance of AfloatAuth.
|
|
35
|
-
* @throws {Error} If AfloatAuth hasn't been initialized
|
|
36
|
-
* @returns {AfloatAuth} The singleton instance
|
|
37
|
-
*/
|
|
38
|
-
static get instance(): AfloatAuth;
|
|
39
43
|
/**
|
|
40
44
|
* Gets the authentication repository instance.
|
|
41
45
|
* @private
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../../src/src/features/auth/manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../../src/src/features/auth/manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAU7D;;;GAGG;AACH,qBAAa,UAAU;IACrB,oCAAoC;IACpC,OAAO,CAAC,KAAK,CAAY;IAEzB,uCAAuC;IACvC,OAAO,CAAC,YAAY,CAAe;IAEnC,iCAAiC;IACjC,OAAO,CAAC,MAAM,CAAC,SAAS,CAA2B;IACnD;;;;OAIG;IACH,OAAO;IAKP;;;;;;;;;;;;OAYG;IACH,WAAkB,QAAQ,IAAI,UAAU,CAKvC;IAED;;;;;;;OAOG;WACiB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAwBxE;;;;OAIG;IACH,OAAO,KAAK,IAAI,GAEf;IAED;;;OAGG;IACH,YAAY,IAAI,MAAM,GAAG,SAAS;IAIlC;;;OAGG;IACH,IAAI,WAAW,IAAI,IAAI,GAAG,SAAS,CAElC;IAED;;;;OAIG;IACH,cAAc,IAAI,IAAI,GAAG,SAAS;IAIlC;;;;OAIG;IACH,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO;IAI1C;;;;;;OAMG;IACG,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ3D;;;;;;OAMG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAMvE;;OAEG;IACH,MAAM,IAAI,IAAI;IAId;;;OAGG;IACH,OAAO,CAAC,cAAc;CAIvB"}
|
|
@@ -6,7 +6,6 @@ const client_store_js_1 = require("./storage/client_store.js");
|
|
|
6
6
|
const client_token_handler_js_1 = require("./storage/client_token_handler.js");
|
|
7
7
|
const server_store_js_1 = require("./storage/server_store.js");
|
|
8
8
|
const server_token_handler_js_1 = require("./storage/server_token_handler.js");
|
|
9
|
-
const env_detect_js_1 = require("../../utils/env_detect.js");
|
|
10
9
|
/**
|
|
11
10
|
* Main authentication class that works in both client and server environments.
|
|
12
11
|
* Provides authentication functionality and user management.
|
|
@@ -36,19 +35,27 @@ class AfloatAuth {
|
|
|
36
35
|
this.tokenHandler = tokenHandler;
|
|
37
36
|
}
|
|
38
37
|
/**
|
|
39
|
-
*
|
|
40
|
-
* This
|
|
41
|
-
*
|
|
38
|
+
* Gets or creates the client-side singleton instance of AfloatAuth.
|
|
39
|
+
* This getter will automatically initialize the client instance if it hasn't been created yet.
|
|
40
|
+
* For server-side usage, use initializeServer() instead.
|
|
41
|
+
*
|
|
42
|
+
* @returns {AfloatAuth} The client-side singleton instance
|
|
43
|
+
* @example
|
|
44
|
+
* // Client-side usage
|
|
45
|
+
* const auth = AfloatAuth.instance;
|
|
46
|
+
*
|
|
47
|
+
* // Server-side usage (don't use .instance)
|
|
48
|
+
* const serverAuth = await AfloatAuth.initializeServer(token);
|
|
42
49
|
*/
|
|
43
|
-
static
|
|
44
|
-
|
|
45
|
-
return this._instance;
|
|
50
|
+
static get instance() {
|
|
51
|
+
return AfloatAuth._instance || (AfloatAuth._instance = new AfloatAuth((0, client_store_js_1.createClientStore)(), client_token_handler_js_1.ClientTokenHandler.instance));
|
|
46
52
|
}
|
|
47
53
|
/**
|
|
48
|
-
* Creates a new instance of AfloatAuth
|
|
49
|
-
*
|
|
54
|
+
* Creates a new server-side instance of AfloatAuth.
|
|
55
|
+
* Unlike the client-side instance getter, this creates a new instance each time.
|
|
56
|
+
*
|
|
50
57
|
* @param {string} token - Authentication token
|
|
51
|
-
* @returns {Promise<AfloatAuth>} A new
|
|
58
|
+
* @returns {Promise<AfloatAuth>} A new server-side instance
|
|
52
59
|
* @throws {Error} If token is invalid or required data cannot be fetched
|
|
53
60
|
*/
|
|
54
61
|
static async initializeServer(token) {
|
|
@@ -62,8 +69,7 @@ class AfloatAuth {
|
|
|
62
69
|
const user = await tokenHandler.constructUser();
|
|
63
70
|
store.setUser(user);
|
|
64
71
|
// Create and initialize auth instance
|
|
65
|
-
|
|
66
|
-
return this._instance;
|
|
72
|
+
return new AfloatAuth(store, tokenHandler);
|
|
67
73
|
}
|
|
68
74
|
catch (error) {
|
|
69
75
|
if (error instanceof Error) {
|
|
@@ -72,20 +78,6 @@ class AfloatAuth {
|
|
|
72
78
|
throw new Error("Failed to initialize server auth");
|
|
73
79
|
}
|
|
74
80
|
}
|
|
75
|
-
/**
|
|
76
|
-
* Gets the singleton instance of AfloatAuth.
|
|
77
|
-
* @throws {Error} If AfloatAuth hasn't been initialized
|
|
78
|
-
* @returns {AfloatAuth} The singleton instance
|
|
79
|
-
*/
|
|
80
|
-
static get instance() {
|
|
81
|
-
if (!this._instance) {
|
|
82
|
-
if (env_detect_js_1.EnvironmentDetector.isClient()) {
|
|
83
|
-
return this.initializeClient();
|
|
84
|
-
}
|
|
85
|
-
throw new Error("AfloatAuth has not been initialized");
|
|
86
|
-
}
|
|
87
|
-
return this._instance;
|
|
88
|
-
}
|
|
89
81
|
/**
|
|
90
82
|
* Gets the authentication repository instance.
|
|
91
83
|
* @private
|
|
@@ -166,6 +158,7 @@ class AfloatAuth {
|
|
|
166
158
|
}
|
|
167
159
|
}
|
|
168
160
|
exports.AfloatAuth = AfloatAuth;
|
|
161
|
+
/** client AfloatAuth instance */
|
|
169
162
|
Object.defineProperty(AfloatAuth, "_instance", {
|
|
170
163
|
enumerable: true,
|
|
171
164
|
configurable: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client_store.d.ts","sourceRoot":"","sources":["../../../../../src/src/features/auth/storage/client_store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAU,KAAK,QAAQ,EAAE,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"client_store.d.ts","sourceRoot":"","sources":["../../../../../src/src/features/auth/storage/client_store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAU,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAY,MAAM,SAAS,CAAC;AAE9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAK5C,4CAA4C;AAC5C,KAAK,KAAK,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAE1C,8CAA8C;AAC9C,UAAU,OAAO;IACf,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC9B,OAAO,EAAE,MAAM,IAAI,GAAG,SAAS,CAAC;IAChC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,QAAQ,CAAC,KAAK,GAAG,OAAO,CAAC,CA2BhE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,SAMpC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,QAAO,IAAI,GAAG,SAEvC,CAAC"}
|
|
@@ -46,6 +46,6 @@ exports.createClientStore = createClientStore;
|
|
|
46
46
|
* @returns {User | undefined} The current user or undefined if not authenticated
|
|
47
47
|
*/
|
|
48
48
|
const useClientUser = () => {
|
|
49
|
-
return (0, exports.clientStore)
|
|
49
|
+
return (0, zustand_1.useStore)(exports.clientStore).getUser();
|
|
50
50
|
};
|
|
51
51
|
exports.useClientUser = useClientUser;
|
package/esm/_dnt.shims.d.ts
DELETED
package/esm/_dnt.shims.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_dnt.shims.d.ts","sourceRoot":"","sources":["../src/_dnt.shims.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAKvC,eAAO,MAAM,aAAa;;CAA2C,CAAC"}
|
package/esm/_dnt.shims.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Deno } from "@deno/shim-deno";
|
|
2
|
-
export { Deno } from "@deno/shim-deno";
|
|
3
|
-
const dntGlobals = {
|
|
4
|
-
Deno,
|
|
5
|
-
};
|
|
6
|
-
export const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
|
|
7
|
-
function createMergeProxy(baseObj, extObj) {
|
|
8
|
-
return new Proxy(baseObj, {
|
|
9
|
-
get(_target, prop, _receiver) {
|
|
10
|
-
if (prop in extObj) {
|
|
11
|
-
return extObj[prop];
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
return baseObj[prop];
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
set(_target, prop, value) {
|
|
18
|
-
if (prop in extObj) {
|
|
19
|
-
delete extObj[prop];
|
|
20
|
-
}
|
|
21
|
-
baseObj[prop] = value;
|
|
22
|
-
return true;
|
|
23
|
-
},
|
|
24
|
-
deleteProperty(_target, prop) {
|
|
25
|
-
let success = false;
|
|
26
|
-
if (prop in extObj) {
|
|
27
|
-
delete extObj[prop];
|
|
28
|
-
success = true;
|
|
29
|
-
}
|
|
30
|
-
if (prop in baseObj) {
|
|
31
|
-
delete baseObj[prop];
|
|
32
|
-
success = true;
|
|
33
|
-
}
|
|
34
|
-
return success;
|
|
35
|
-
},
|
|
36
|
-
ownKeys(_target) {
|
|
37
|
-
const baseKeys = Reflect.ownKeys(baseObj);
|
|
38
|
-
const extKeys = Reflect.ownKeys(extObj);
|
|
39
|
-
const extKeysSet = new Set(extKeys);
|
|
40
|
-
return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
|
|
41
|
-
},
|
|
42
|
-
defineProperty(_target, prop, desc) {
|
|
43
|
-
if (prop in extObj) {
|
|
44
|
-
delete extObj[prop];
|
|
45
|
-
}
|
|
46
|
-
Reflect.defineProperty(baseObj, prop, desc);
|
|
47
|
-
return true;
|
|
48
|
-
},
|
|
49
|
-
getOwnPropertyDescriptor(_target, prop) {
|
|
50
|
-
if (prop in extObj) {
|
|
51
|
-
return Reflect.getOwnPropertyDescriptor(extObj, prop);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
return Reflect.getOwnPropertyDescriptor(baseObj, prop);
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
has(_target, prop) {
|
|
58
|
-
return prop in extObj || prop in baseObj;
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export type RuntimeEnvironment = "client" | "server";
|
|
2
|
-
export declare class EnvironmentDetector {
|
|
3
|
-
private static _environment;
|
|
4
|
-
/**
|
|
5
|
-
* Detects the current runtime environment
|
|
6
|
-
* @returns {RuntimeEnvironment}
|
|
7
|
-
* @throws {Error} If environment cannot be definitively determined
|
|
8
|
-
*/
|
|
9
|
-
static detect(): RuntimeEnvironment;
|
|
10
|
-
/**
|
|
11
|
-
* Checks if code is running in client environment
|
|
12
|
-
*/
|
|
13
|
-
static isClient(): boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Checks if code is running in server environment
|
|
16
|
-
*/
|
|
17
|
-
static isServer(): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Explicitly sets the environment (useful for testing)
|
|
20
|
-
* @param {RuntimeEnvironment} env
|
|
21
|
-
*/
|
|
22
|
-
static setEnvironment(env: RuntimeEnvironment): void;
|
|
23
|
-
/**
|
|
24
|
-
* Resets the detected environment (useful for testing)
|
|
25
|
-
*/
|
|
26
|
-
static reset(): void;
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=env_detect.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env_detect.d.ts","sourceRoot":"","sources":["../../../src/src/utils/env_detect.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAErD,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAC,YAAY,CAAmC;IAE9D;;;;OAIG;WACW,MAAM,IAAI,kBAAkB;IAyC1C;;OAEG;WACW,QAAQ,IAAI,OAAO;IAIjC;;OAEG;WACW,QAAQ,IAAI,OAAO;IAIjC;;;OAGG;WACW,cAAc,CAAC,GAAG,EAAE,kBAAkB,GAAG,IAAI;IAI3D;;OAEG;WACW,KAAK,IAAI,IAAI;CAG5B"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import * as dntShim from "../../_dnt.shims.js";
|
|
2
|
-
import process from "node:process";
|
|
3
|
-
export class EnvironmentDetector {
|
|
4
|
-
/**
|
|
5
|
-
* Detects the current runtime environment
|
|
6
|
-
* @returns {RuntimeEnvironment}
|
|
7
|
-
* @throws {Error} If environment cannot be definitively determined
|
|
8
|
-
*/
|
|
9
|
-
static detect() {
|
|
10
|
-
// If already detected, return cached result
|
|
11
|
-
if (this._environment) {
|
|
12
|
-
return this._environment;
|
|
13
|
-
}
|
|
14
|
-
try {
|
|
15
|
-
// Check for Deno specific global
|
|
16
|
-
if (typeof dntShim.Deno !== "undefined") {
|
|
17
|
-
this._environment = "server";
|
|
18
|
-
return this._environment;
|
|
19
|
-
}
|
|
20
|
-
// For non-Deno environments, we can use process
|
|
21
|
-
if (typeof process !== "undefined" &&
|
|
22
|
-
process.versions?.node &&
|
|
23
|
-
!process.versions?.bun) {
|
|
24
|
-
this._environment = "server";
|
|
25
|
-
return this._environment;
|
|
26
|
-
}
|
|
27
|
-
// For client environments, check window
|
|
28
|
-
// This will throw ReferenceError in Deno
|
|
29
|
-
if (typeof dntShim.dntGlobalThis !== "undefined") {
|
|
30
|
-
this._environment = "client";
|
|
31
|
-
return this._environment;
|
|
32
|
-
}
|
|
33
|
-
throw new Error("Unable to determine runtime environment");
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
// If we get a ReferenceError for 'window' in Deno, we're in server
|
|
37
|
-
if (error instanceof ReferenceError) {
|
|
38
|
-
this._environment = "server";
|
|
39
|
-
return this._environment;
|
|
40
|
-
}
|
|
41
|
-
throw error;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Checks if code is running in client environment
|
|
46
|
-
*/
|
|
47
|
-
static isClient() {
|
|
48
|
-
return this.detect() === "client";
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Checks if code is running in server environment
|
|
52
|
-
*/
|
|
53
|
-
static isServer() {
|
|
54
|
-
return this.detect() === "server";
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Explicitly sets the environment (useful for testing)
|
|
58
|
-
* @param {RuntimeEnvironment} env
|
|
59
|
-
*/
|
|
60
|
-
static setEnvironment(env) {
|
|
61
|
-
this._environment = env;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Resets the detected environment (useful for testing)
|
|
65
|
-
*/
|
|
66
|
-
static reset() {
|
|
67
|
-
this._environment = null;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
Object.defineProperty(EnvironmentDetector, "_environment", {
|
|
71
|
-
enumerable: true,
|
|
72
|
-
configurable: true,
|
|
73
|
-
writable: true,
|
|
74
|
-
value: null
|
|
75
|
-
});
|
package/script/_dnt.shims.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_dnt.shims.d.ts","sourceRoot":"","sources":["../src/_dnt.shims.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAKvC,eAAO,MAAM,aAAa;;CAA2C,CAAC"}
|
package/script/_dnt.shims.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dntGlobalThis = exports.Deno = void 0;
|
|
4
|
-
const shim_deno_1 = require("@deno/shim-deno");
|
|
5
|
-
var shim_deno_2 = require("@deno/shim-deno");
|
|
6
|
-
Object.defineProperty(exports, "Deno", { enumerable: true, get: function () { return shim_deno_2.Deno; } });
|
|
7
|
-
const dntGlobals = {
|
|
8
|
-
Deno: shim_deno_1.Deno,
|
|
9
|
-
};
|
|
10
|
-
exports.dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
|
|
11
|
-
function createMergeProxy(baseObj, extObj) {
|
|
12
|
-
return new Proxy(baseObj, {
|
|
13
|
-
get(_target, prop, _receiver) {
|
|
14
|
-
if (prop in extObj) {
|
|
15
|
-
return extObj[prop];
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
return baseObj[prop];
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
set(_target, prop, value) {
|
|
22
|
-
if (prop in extObj) {
|
|
23
|
-
delete extObj[prop];
|
|
24
|
-
}
|
|
25
|
-
baseObj[prop] = value;
|
|
26
|
-
return true;
|
|
27
|
-
},
|
|
28
|
-
deleteProperty(_target, prop) {
|
|
29
|
-
let success = false;
|
|
30
|
-
if (prop in extObj) {
|
|
31
|
-
delete extObj[prop];
|
|
32
|
-
success = true;
|
|
33
|
-
}
|
|
34
|
-
if (prop in baseObj) {
|
|
35
|
-
delete baseObj[prop];
|
|
36
|
-
success = true;
|
|
37
|
-
}
|
|
38
|
-
return success;
|
|
39
|
-
},
|
|
40
|
-
ownKeys(_target) {
|
|
41
|
-
const baseKeys = Reflect.ownKeys(baseObj);
|
|
42
|
-
const extKeys = Reflect.ownKeys(extObj);
|
|
43
|
-
const extKeysSet = new Set(extKeys);
|
|
44
|
-
return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
|
|
45
|
-
},
|
|
46
|
-
defineProperty(_target, prop, desc) {
|
|
47
|
-
if (prop in extObj) {
|
|
48
|
-
delete extObj[prop];
|
|
49
|
-
}
|
|
50
|
-
Reflect.defineProperty(baseObj, prop, desc);
|
|
51
|
-
return true;
|
|
52
|
-
},
|
|
53
|
-
getOwnPropertyDescriptor(_target, prop) {
|
|
54
|
-
if (prop in extObj) {
|
|
55
|
-
return Reflect.getOwnPropertyDescriptor(extObj, prop);
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
return Reflect.getOwnPropertyDescriptor(baseObj, prop);
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
has(_target, prop) {
|
|
62
|
-
return prop in extObj || prop in baseObj;
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export type RuntimeEnvironment = "client" | "server";
|
|
2
|
-
export declare class EnvironmentDetector {
|
|
3
|
-
private static _environment;
|
|
4
|
-
/**
|
|
5
|
-
* Detects the current runtime environment
|
|
6
|
-
* @returns {RuntimeEnvironment}
|
|
7
|
-
* @throws {Error} If environment cannot be definitively determined
|
|
8
|
-
*/
|
|
9
|
-
static detect(): RuntimeEnvironment;
|
|
10
|
-
/**
|
|
11
|
-
* Checks if code is running in client environment
|
|
12
|
-
*/
|
|
13
|
-
static isClient(): boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Checks if code is running in server environment
|
|
16
|
-
*/
|
|
17
|
-
static isServer(): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Explicitly sets the environment (useful for testing)
|
|
20
|
-
* @param {RuntimeEnvironment} env
|
|
21
|
-
*/
|
|
22
|
-
static setEnvironment(env: RuntimeEnvironment): void;
|
|
23
|
-
/**
|
|
24
|
-
* Resets the detected environment (useful for testing)
|
|
25
|
-
*/
|
|
26
|
-
static reset(): void;
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=env_detect.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env_detect.d.ts","sourceRoot":"","sources":["../../../src/src/utils/env_detect.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAErD,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAC,YAAY,CAAmC;IAE9D;;;;OAIG;WACW,MAAM,IAAI,kBAAkB;IAyC1C;;OAEG;WACW,QAAQ,IAAI,OAAO;IAIjC;;OAEG;WACW,QAAQ,IAAI,OAAO;IAIjC;;;OAGG;WACW,cAAc,CAAC,GAAG,EAAE,kBAAkB,GAAG,IAAI;IAI3D;;OAEG;WACW,KAAK,IAAI,IAAI;CAG5B"}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.EnvironmentDetector = void 0;
|
|
30
|
-
const dntShim = __importStar(require("../../_dnt.shims.js"));
|
|
31
|
-
const node_process_1 = __importDefault(require("node:process"));
|
|
32
|
-
class EnvironmentDetector {
|
|
33
|
-
/**
|
|
34
|
-
* Detects the current runtime environment
|
|
35
|
-
* @returns {RuntimeEnvironment}
|
|
36
|
-
* @throws {Error} If environment cannot be definitively determined
|
|
37
|
-
*/
|
|
38
|
-
static detect() {
|
|
39
|
-
// If already detected, return cached result
|
|
40
|
-
if (this._environment) {
|
|
41
|
-
return this._environment;
|
|
42
|
-
}
|
|
43
|
-
try {
|
|
44
|
-
// Check for Deno specific global
|
|
45
|
-
if (typeof dntShim.Deno !== "undefined") {
|
|
46
|
-
this._environment = "server";
|
|
47
|
-
return this._environment;
|
|
48
|
-
}
|
|
49
|
-
// For non-Deno environments, we can use process
|
|
50
|
-
if (typeof node_process_1.default !== "undefined" &&
|
|
51
|
-
node_process_1.default.versions?.node &&
|
|
52
|
-
!node_process_1.default.versions?.bun) {
|
|
53
|
-
this._environment = "server";
|
|
54
|
-
return this._environment;
|
|
55
|
-
}
|
|
56
|
-
// For client environments, check window
|
|
57
|
-
// This will throw ReferenceError in Deno
|
|
58
|
-
if (typeof dntShim.dntGlobalThis !== "undefined") {
|
|
59
|
-
this._environment = "client";
|
|
60
|
-
return this._environment;
|
|
61
|
-
}
|
|
62
|
-
throw new Error("Unable to determine runtime environment");
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
// If we get a ReferenceError for 'window' in Deno, we're in server
|
|
66
|
-
if (error instanceof ReferenceError) {
|
|
67
|
-
this._environment = "server";
|
|
68
|
-
return this._environment;
|
|
69
|
-
}
|
|
70
|
-
throw error;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Checks if code is running in client environment
|
|
75
|
-
*/
|
|
76
|
-
static isClient() {
|
|
77
|
-
return this.detect() === "client";
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Checks if code is running in server environment
|
|
81
|
-
*/
|
|
82
|
-
static isServer() {
|
|
83
|
-
return this.detect() === "server";
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Explicitly sets the environment (useful for testing)
|
|
87
|
-
* @param {RuntimeEnvironment} env
|
|
88
|
-
*/
|
|
89
|
-
static setEnvironment(env) {
|
|
90
|
-
this._environment = env;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Resets the detected environment (useful for testing)
|
|
94
|
-
*/
|
|
95
|
-
static reset() {
|
|
96
|
-
this._environment = null;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
exports.EnvironmentDetector = EnvironmentDetector;
|
|
100
|
-
Object.defineProperty(EnvironmentDetector, "_environment", {
|
|
101
|
-
enumerable: true,
|
|
102
|
-
configurable: true,
|
|
103
|
-
writable: true,
|
|
104
|
-
value: null
|
|
105
|
-
});
|