@withwiz/toolkit 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/index.js +17 -17
- package/dist/{chunk-HWX3INO5.js → chunk-2NNLUXPF.js} +2 -2
- package/dist/{chunk-S54PFAEU.js → chunk-AZASEBSP.js} +1 -1
- package/dist/{chunk-IJCVFLEY.js → chunk-MZRYR3UQ.js} +1 -1
- package/dist/{chunk-WSUFD4SO.js → chunk-P6VSEFZE.js} +1 -1
- package/dist/{chunk-SNSLMP6S.js → chunk-QMZ75GBU.js} +25 -9
- package/dist/components/ui/DataTable.js +3 -3
- package/dist/components/ui/data-table/DataTable.js +3 -3
- package/dist/error/error-display.js +4 -4
- package/dist/error/friendly-messages-v2.js +3 -3
- package/dist/error/index.js +4 -4
- package/dist/error/messages/index.js +2 -2
- package/dist/geolocation/index.js +4 -4
- package/dist/geolocation/providers/index.js +4 -4
- package/dist/middleware/error-handler.js +3 -3
- package/dist/middleware/index.js +5 -5
- package/dist/middleware/rate-limit.js +1 -1
- package/dist/middleware/wrappers.js +5 -5
- package/package.json +1 -1
- package/dist/{chunk-Y2JYA2AR.js → chunk-ASXZ2NZJ.js} +3 -3
- package/dist/{chunk-M2S3OMKX.js → chunk-GSUQE3SZ.js} +6 -6
- package/dist/{chunk-QF6FH4GZ.js → chunk-S73334QY.js} +3 -3
package/dist/auth/index.js
CHANGED
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
clearTokens,
|
|
5
|
-
createApiHeaders,
|
|
6
|
-
createAuthHeader,
|
|
7
|
-
decodeJWTPayload,
|
|
8
|
-
extractUserFromToken,
|
|
9
|
-
getStoredTokens,
|
|
10
|
-
getTokenExpirationString,
|
|
11
|
-
getTokenIssuedAtString,
|
|
12
|
-
getTokenRemainingTime,
|
|
13
|
-
isTokenExpired,
|
|
14
|
-
isTokenExpiringSoon,
|
|
15
|
-
storeTokens
|
|
16
|
-
} from "../chunk-XRRPEBKB.js";
|
|
2
|
+
OAuthManager
|
|
3
|
+
} from "../chunk-V5K5FYU7.js";
|
|
17
4
|
import {
|
|
18
5
|
DEFAULT_PASSWORD_CONFIG,
|
|
19
6
|
createPasswordHasher,
|
|
@@ -33,8 +20,21 @@ import {
|
|
|
33
20
|
TokenGenerator
|
|
34
21
|
} from "../chunk-GDWEDUHO.js";
|
|
35
22
|
import {
|
|
36
|
-
|
|
37
|
-
|
|
23
|
+
JWTClientManager,
|
|
24
|
+
clearStoredTokens,
|
|
25
|
+
clearTokens,
|
|
26
|
+
createApiHeaders,
|
|
27
|
+
createAuthHeader,
|
|
28
|
+
decodeJWTPayload,
|
|
29
|
+
extractUserFromToken,
|
|
30
|
+
getStoredTokens,
|
|
31
|
+
getTokenExpirationString,
|
|
32
|
+
getTokenIssuedAtString,
|
|
33
|
+
getTokenRemainingTime,
|
|
34
|
+
isTokenExpired,
|
|
35
|
+
isTokenExpiringSoon,
|
|
36
|
+
storeTokens
|
|
37
|
+
} from "../chunk-XRRPEBKB.js";
|
|
38
38
|
import {
|
|
39
39
|
OAuthProvider,
|
|
40
40
|
PasswordStrength,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-AOZVTVJG.js";
|
|
4
4
|
import {
|
|
5
5
|
rateLimitMiddleware
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QMZ75GBU.js";
|
|
7
7
|
import {
|
|
8
8
|
responseLoggerMiddleware
|
|
9
9
|
} from "./chunk-M5LIX3TD.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "./chunk-WDJLAZCW.js";
|
|
21
21
|
import {
|
|
22
22
|
errorHandlerMiddleware
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-P6VSEFZE.js";
|
|
24
24
|
import {
|
|
25
25
|
initRequestMiddleware
|
|
26
26
|
} from "./chunk-62Q7DN5G.js";
|
|
@@ -9,14 +9,29 @@ import {
|
|
|
9
9
|
} from "./chunk-5A2L6TXD.js";
|
|
10
10
|
|
|
11
11
|
// src/middleware/rate-limit.ts
|
|
12
|
-
var
|
|
13
|
-
var
|
|
12
|
+
var GLOBAL_KEY = "__withwiz_rateLimitAdapter__";
|
|
13
|
+
var GLOBAL_WARN_KEY = "__withwiz_rateLimitWarningLogged__";
|
|
14
|
+
function _getAdapter() {
|
|
15
|
+
var _a;
|
|
16
|
+
return (_a = globalThis[GLOBAL_KEY]) != null ? _a : null;
|
|
17
|
+
}
|
|
18
|
+
function _setAdapter(adapter) {
|
|
19
|
+
globalThis[GLOBAL_KEY] = adapter;
|
|
20
|
+
}
|
|
21
|
+
function _isWarningLogged() {
|
|
22
|
+
var _a;
|
|
23
|
+
return (_a = globalThis[GLOBAL_WARN_KEY]) != null ? _a : false;
|
|
24
|
+
}
|
|
25
|
+
function _setWarningLogged(value) {
|
|
26
|
+
globalThis[GLOBAL_WARN_KEY] = value;
|
|
27
|
+
}
|
|
14
28
|
function setRateLimitAdapter(adapter) {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
29
|
+
const current = _getAdapter();
|
|
30
|
+
const isInitialSetup = current === null;
|
|
31
|
+
const previousTypes = current ? Object.keys(current.rateLimiters).join(", ") : "none";
|
|
17
32
|
const newTypes = Object.keys(adapter.rateLimiters).join(", ");
|
|
18
|
-
|
|
19
|
-
|
|
33
|
+
_setAdapter(adapter);
|
|
34
|
+
_setWarningLogged(false);
|
|
20
35
|
if (isInitialSetup) {
|
|
21
36
|
logger.info(
|
|
22
37
|
`[Rate Limit Middleware] \u2705 Initialized with types: [${newTypes}]`
|
|
@@ -28,13 +43,14 @@ function setRateLimitAdapter(adapter) {
|
|
|
28
43
|
}
|
|
29
44
|
}
|
|
30
45
|
function getRateLimitAdapter() {
|
|
31
|
-
|
|
46
|
+
const adapter = _getAdapter();
|
|
47
|
+
if (!adapter && !_isWarningLogged()) {
|
|
32
48
|
logger.warn(
|
|
33
49
|
"[Rate Limit Middleware] Adapter not configured. Rate limiting is DISABLED.\nTo enable: Call setRateLimitAdapter() in instrumentation.ts"
|
|
34
50
|
);
|
|
35
|
-
|
|
51
|
+
_setWarningLogged(true);
|
|
36
52
|
}
|
|
37
|
-
return
|
|
53
|
+
return adapter;
|
|
38
54
|
}
|
|
39
55
|
function createRateLimitMiddleware(type) {
|
|
40
56
|
return async (context, next) => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DataTable
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-7IY3RQQL.js";
|
|
5
|
-
import "../../chunk-MAATEX2R.js";
|
|
3
|
+
} from "../../chunk-GSUQE3SZ.js";
|
|
6
4
|
import "../../chunk-LJEGM4OO.js";
|
|
7
5
|
import "../../chunk-IPXPCBDO.js";
|
|
8
6
|
import "../../chunk-TH45RVP7.js";
|
|
7
|
+
import "../../chunk-7IY3RQQL.js";
|
|
8
|
+
import "../../chunk-MAATEX2R.js";
|
|
9
9
|
import "../../chunk-NY5QXT33.js";
|
|
10
10
|
import "../../chunk-IJEZ7G7S.js";
|
|
11
11
|
import "../../chunk-YJWLWUFK.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
DataTable
|
|
4
|
-
} from "../../../chunk-
|
|
5
|
-
import "../../../chunk-7IY3RQQL.js";
|
|
6
|
-
import "../../../chunk-MAATEX2R.js";
|
|
4
|
+
} from "../../../chunk-GSUQE3SZ.js";
|
|
7
5
|
import "../../../chunk-LJEGM4OO.js";
|
|
8
6
|
import "../../../chunk-IPXPCBDO.js";
|
|
9
7
|
import "../../../chunk-TH45RVP7.js";
|
|
8
|
+
import "../../../chunk-7IY3RQQL.js";
|
|
9
|
+
import "../../../chunk-MAATEX2R.js";
|
|
10
10
|
import "../../../chunk-NY5QXT33.js";
|
|
11
11
|
import "../../../chunk-IJEZ7G7S.js";
|
|
12
12
|
import "../../../chunk-YJWLWUFK.js";
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
getErrorIcon,
|
|
6
6
|
handleApiResponse,
|
|
7
7
|
showFriendlyError
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-MZRYR3UQ.js";
|
|
9
9
|
import {
|
|
10
10
|
getErrorDisplayInfo,
|
|
11
11
|
getFriendlyMessage
|
|
12
|
-
} from "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-HCF3C3AQ.js";
|
|
12
|
+
} from "../chunk-AZASEBSP.js";
|
|
13
|
+
import "../chunk-ASXZ2NZJ.js";
|
|
15
14
|
import "../chunk-IYXMGIEP.js";
|
|
15
|
+
import "../chunk-HCF3C3AQ.js";
|
|
16
16
|
import "../chunk-KXXROUA5.js";
|
|
17
17
|
import "../chunk-SNVGJPPX.js";
|
|
18
18
|
import "../chunk-ORMEWXMH.js";
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
formatFriendlyError,
|
|
3
3
|
getErrorDisplayInfo,
|
|
4
4
|
getFriendlyMessage
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-HCF3C3AQ.js";
|
|
5
|
+
} from "../chunk-AZASEBSP.js";
|
|
6
|
+
import "../chunk-ASXZ2NZJ.js";
|
|
8
7
|
import "../chunk-IYXMGIEP.js";
|
|
8
|
+
import "../chunk-HCF3C3AQ.js";
|
|
9
9
|
import "../chunk-SNVGJPPX.js";
|
|
10
10
|
import "../chunk-ORMEWXMH.js";
|
|
11
11
|
export {
|
package/dist/error/index.js
CHANGED
|
@@ -15,21 +15,21 @@ import {
|
|
|
15
15
|
getErrorIcon,
|
|
16
16
|
handleApiResponse,
|
|
17
17
|
showFriendlyError
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-MZRYR3UQ.js";
|
|
19
19
|
import {
|
|
20
20
|
formatFriendlyError,
|
|
21
21
|
getErrorDisplayInfo,
|
|
22
22
|
getFriendlyMessage
|
|
23
|
-
} from "../chunk-
|
|
23
|
+
} from "../chunk-AZASEBSP.js";
|
|
24
24
|
import {
|
|
25
25
|
getAllMessages,
|
|
26
26
|
getErrorMessage,
|
|
27
27
|
hasMessage,
|
|
28
28
|
isLocaleSupported,
|
|
29
29
|
supportedLocales
|
|
30
|
-
} from "../chunk-
|
|
31
|
-
import "../chunk-HCF3C3AQ.js";
|
|
30
|
+
} from "../chunk-ASXZ2NZJ.js";
|
|
32
31
|
import "../chunk-IYXMGIEP.js";
|
|
32
|
+
import "../chunk-HCF3C3AQ.js";
|
|
33
33
|
import {
|
|
34
34
|
AppError
|
|
35
35
|
} from "../chunk-KXXROUA5.js";
|
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
hasMessage,
|
|
5
5
|
isLocaleSupported,
|
|
6
6
|
supportedLocales
|
|
7
|
-
} from "../../chunk-
|
|
8
|
-
import "../../chunk-HCF3C3AQ.js";
|
|
7
|
+
} from "../../chunk-ASXZ2NZJ.js";
|
|
9
8
|
import "../../chunk-IYXMGIEP.js";
|
|
9
|
+
import "../../chunk-HCF3C3AQ.js";
|
|
10
10
|
import "../../chunk-ORMEWXMH.js";
|
|
11
11
|
export {
|
|
12
12
|
getAllMessages,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GeoIPProviderFactory
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-S73334QY.js";
|
|
4
|
+
import {
|
|
5
|
+
IPApiProvider
|
|
6
|
+
} from "../chunk-DEEJBDJE.js";
|
|
4
7
|
import {
|
|
5
8
|
IPApiCoProvider
|
|
6
9
|
} from "../chunk-VSGKVZB4.js";
|
|
@@ -10,9 +13,6 @@ import {
|
|
|
10
13
|
import {
|
|
11
14
|
MaxMindProvider
|
|
12
15
|
} from "../chunk-4NWJ3WCZ.js";
|
|
13
|
-
import {
|
|
14
|
-
IPApiProvider
|
|
15
|
-
} from "../chunk-DEEJBDJE.js";
|
|
16
16
|
import {
|
|
17
17
|
BaseGeoIPProvider,
|
|
18
18
|
truncateString
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GeoIPProviderFactory
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-S73334QY.js";
|
|
4
|
+
import {
|
|
5
|
+
IPApiProvider
|
|
6
|
+
} from "../../chunk-DEEJBDJE.js";
|
|
4
7
|
import {
|
|
5
8
|
IPApiCoProvider
|
|
6
9
|
} from "../../chunk-VSGKVZB4.js";
|
|
@@ -10,9 +13,6 @@ import {
|
|
|
10
13
|
import {
|
|
11
14
|
MaxMindProvider
|
|
12
15
|
} from "../../chunk-4NWJ3WCZ.js";
|
|
13
|
-
import {
|
|
14
|
-
IPApiProvider
|
|
15
|
-
} from "../../chunk-DEEJBDJE.js";
|
|
16
16
|
import {
|
|
17
17
|
BaseGeoIPProvider,
|
|
18
18
|
truncateString
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
errorHandlerMiddleware
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-P6VSEFZE.js";
|
|
4
4
|
import "../chunk-JWZSWMOM.js";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-HCF3C3AQ.js";
|
|
5
|
+
import "../chunk-ASXZ2NZJ.js";
|
|
7
6
|
import "../chunk-IYXMGIEP.js";
|
|
7
|
+
import "../chunk-HCF3C3AQ.js";
|
|
8
8
|
import "../chunk-KXXROUA5.js";
|
|
9
9
|
import "../chunk-SNVGJPPX.js";
|
|
10
10
|
import "../chunk-AIH3F7JV.js";
|
package/dist/middleware/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
withCustomApi,
|
|
5
5
|
withOptionalAuthApi,
|
|
6
6
|
withPublicApi
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-2NNLUXPF.js";
|
|
8
8
|
import {
|
|
9
9
|
MiddlewareChain
|
|
10
10
|
} from "../chunk-AOZVTVJG.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
createRateLimitMiddleware,
|
|
13
13
|
rateLimitMiddleware,
|
|
14
14
|
setRateLimitAdapter
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-QMZ75GBU.js";
|
|
16
16
|
import {
|
|
17
17
|
responseLoggerMiddleware
|
|
18
18
|
} from "../chunk-M5LIX3TD.js";
|
|
@@ -33,15 +33,15 @@ import {
|
|
|
33
33
|
} from "../chunk-WDJLAZCW.js";
|
|
34
34
|
import {
|
|
35
35
|
errorHandlerMiddleware
|
|
36
|
-
} from "../chunk-
|
|
36
|
+
} from "../chunk-P6VSEFZE.js";
|
|
37
37
|
import {
|
|
38
38
|
initRequestMiddleware
|
|
39
39
|
} from "../chunk-62Q7DN5G.js";
|
|
40
40
|
import "../chunk-XHZ5L4FO.js";
|
|
41
41
|
import "../chunk-JWZSWMOM.js";
|
|
42
|
-
import "../chunk-
|
|
43
|
-
import "../chunk-HCF3C3AQ.js";
|
|
42
|
+
import "../chunk-ASXZ2NZJ.js";
|
|
44
43
|
import "../chunk-IYXMGIEP.js";
|
|
44
|
+
import "../chunk-HCF3C3AQ.js";
|
|
45
45
|
import "../chunk-KXXROUA5.js";
|
|
46
46
|
import "../chunk-SNVGJPPX.js";
|
|
47
47
|
import "../chunk-2ATBAIRL.js";
|
|
@@ -4,20 +4,20 @@ import {
|
|
|
4
4
|
withCustomApi,
|
|
5
5
|
withOptionalAuthApi,
|
|
6
6
|
withPublicApi
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-2NNLUXPF.js";
|
|
8
8
|
import "../chunk-AOZVTVJG.js";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-QMZ75GBU.js";
|
|
10
10
|
import "../chunk-M5LIX3TD.js";
|
|
11
11
|
import "../chunk-NJXCFTOE.js";
|
|
12
12
|
import "../chunk-74MSBKYW.js";
|
|
13
13
|
import "../chunk-WDJLAZCW.js";
|
|
14
|
-
import "../chunk-
|
|
14
|
+
import "../chunk-P6VSEFZE.js";
|
|
15
15
|
import "../chunk-62Q7DN5G.js";
|
|
16
16
|
import "../chunk-XHZ5L4FO.js";
|
|
17
17
|
import "../chunk-JWZSWMOM.js";
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-HCF3C3AQ.js";
|
|
18
|
+
import "../chunk-ASXZ2NZJ.js";
|
|
20
19
|
import "../chunk-IYXMGIEP.js";
|
|
20
|
+
import "../chunk-HCF3C3AQ.js";
|
|
21
21
|
import "../chunk-KXXROUA5.js";
|
|
22
22
|
import "../chunk-SNVGJPPX.js";
|
|
23
23
|
import "../chunk-2ATBAIRL.js";
|
package/package.json
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DataTableBody
|
|
3
|
-
} from "./chunk-7IY3RQQL.js";
|
|
4
|
-
import {
|
|
5
|
-
DataTableBulkActions
|
|
6
|
-
} from "./chunk-MAATEX2R.js";
|
|
7
1
|
import {
|
|
8
2
|
DataTableFilters
|
|
9
3
|
} from "./chunk-LJEGM4OO.js";
|
|
@@ -13,6 +7,12 @@ import {
|
|
|
13
7
|
import {
|
|
14
8
|
DataTableSearch
|
|
15
9
|
} from "./chunk-TH45RVP7.js";
|
|
10
|
+
import {
|
|
11
|
+
DataTableBody
|
|
12
|
+
} from "./chunk-7IY3RQQL.js";
|
|
13
|
+
import {
|
|
14
|
+
DataTableBulkActions
|
|
15
|
+
} from "./chunk-MAATEX2R.js";
|
|
16
16
|
import {
|
|
17
17
|
DEFAULT_LABELS
|
|
18
18
|
} from "./chunk-NY5QXT33.js";
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IPApiProvider
|
|
3
|
+
} from "./chunk-DEEJBDJE.js";
|
|
1
4
|
import {
|
|
2
5
|
IPApiCoProvider
|
|
3
6
|
} from "./chunk-VSGKVZB4.js";
|
|
@@ -7,9 +10,6 @@ import {
|
|
|
7
10
|
import {
|
|
8
11
|
MaxMindProvider
|
|
9
12
|
} from "./chunk-4NWJ3WCZ.js";
|
|
10
|
-
import {
|
|
11
|
-
IPApiProvider
|
|
12
|
-
} from "./chunk-DEEJBDJE.js";
|
|
13
13
|
|
|
14
14
|
// src/geolocation/providers/index.ts
|
|
15
15
|
var GeoIPProviderFactory = class {
|