toolbox-x 1.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/LICENSE +201 -0
- package/dist/Color-B3mgF9Dh.d.cts +486 -0
- package/dist/Color-D38Xrw65.d.mts +486 -0
- package/dist/Stylog-Df7eq3-j.d.cts +519 -0
- package/dist/Stylog-jvlLcMQq.d.mts +519 -0
- package/dist/array-DvW0zIu6.d.mts +130 -0
- package/dist/array-rUnEVisO.d.cts +130 -0
- package/dist/basics-D_eSv0cu.cjs +132 -0
- package/dist/basics-Dp_aEK81.mjs +115 -0
- package/dist/basics-WEYWlnRO.d.cts +95 -0
- package/dist/basics-uBSfkBEI.d.mts +95 -0
- package/dist/case-BWIt8Ash.mjs +449 -0
- package/dist/case-C-S-b5YP.d.cts +327 -0
- package/dist/case-CS8Ii3A7.cjs +526 -0
- package/dist/case-CybASFPD.d.mts +327 -0
- package/dist/change-case.cjs +32 -0
- package/dist/change-case.d.cts +18 -0
- package/dist/change-case.d.mts +18 -0
- package/dist/change-case.mjs +19 -0
- package/dist/colors.cjs +574 -0
- package/dist/colors.d.cts +355 -0
- package/dist/colors.d.mts +355 -0
- package/dist/colors.mjs +547 -0
- package/dist/constants-2gAw23_7.mjs +144 -0
- package/dist/constants-B34K0QPi.d.cts +21 -0
- package/dist/constants-BIBDKY1u.cjs +924 -0
- package/dist/constants-BWT-810U.cjs +158 -0
- package/dist/constants-BwbHnXlM.mjs +662 -0
- package/dist/constants-BxN9l5el.cjs +74 -0
- package/dist/constants-CLS_bgKD.d.mts +847 -0
- package/dist/constants-D73iFu8g.mjs +171 -0
- package/dist/constants-DAfRxaa8.mjs +62 -0
- package/dist/constants-DQYeCjlx.cjs +207 -0
- package/dist/constants-Deeie-iH.d.mts +21 -0
- package/dist/constants-DpTG9RP6.d.mts +29 -0
- package/dist/constants-DqwnkJ_d.cjs +740 -0
- package/dist/constants-DvRUY_FY.cjs +150 -0
- package/dist/constants-VcRtQu0K.d.cts +29 -0
- package/dist/constants-X5hm1UtB.mjs +912 -0
- package/dist/constants-eNd-iYsV.mjs +134 -0
- package/dist/constants-qm8FafmD.d.cts +847 -0
- package/dist/constants.cjs +415 -0
- package/dist/constants.d.cts +184 -0
- package/dist/constants.d.mts +184 -0
- package/dist/constants.mjs +378 -0
- package/dist/convert-BOCgUv2D.cjs +252 -0
- package/dist/convert-Bn4jFomQ.mjs +169 -0
- package/dist/convert-BrzlG-m_.cjs +475 -0
- package/dist/convert-DhaUoPVU.mjs +368 -0
- package/dist/converter-1P90_RcP.d.mts +402 -0
- package/dist/converter-CmkcAppi.d.cts +402 -0
- package/dist/converter.cjs +780 -0
- package/dist/converter.d.cts +29 -0
- package/dist/converter.d.mts +29 -0
- package/dist/converter.mjs +771 -0
- package/dist/countries-CIpmtEzV.cjs +1469 -0
- package/dist/countries-Cy0xiqS3.mjs +1463 -0
- package/dist/css-colors-Bx947Ng3.d.cts +179 -0
- package/dist/css-colors-CXCDqQbG.cjs +186 -0
- package/dist/css-colors-CXTp1vvy.d.mts +179 -0
- package/dist/css-colors-DfUW3nTR.mjs +180 -0
- package/dist/date.cjs +332 -0
- package/dist/date.d.cts +213 -0
- package/dist/date.d.mts +213 -0
- package/dist/date.mjs +298 -0
- package/dist/dom.cjs +461 -0
- package/dist/dom.d.cts +228 -0
- package/dist/dom.d.mts +228 -0
- package/dist/dom.mjs +429 -0
- package/dist/form-BMFVGUrN.d.mts +118 -0
- package/dist/form-DRFbryvK.d.cts +118 -0
- package/dist/guards-3kaUX66g.mjs +157 -0
- package/dist/guards-C8gkvIHb.cjs +240 -0
- package/dist/guards-DdyU4h4o.mjs +110 -0
- package/dist/guards-Efhp1mNy.cjs +151 -0
- package/dist/guards.cjs +172 -0
- package/dist/guards.d.cts +399 -0
- package/dist/guards.d.mts +399 -0
- package/dist/guards.mjs +75 -0
- package/dist/hash-B6JPEyAz.d.mts +131 -0
- package/dist/hash-NTpeKYB_.d.cts +131 -0
- package/dist/hash.cjs +2126 -0
- package/dist/hash.d.cts +1239 -0
- package/dist/hash.d.mts +1239 -0
- package/dist/hash.mjs +2095 -0
- package/dist/http-status-BAZdtr7-.d.mts +65 -0
- package/dist/http-status-U_3MtoGb.d.cts +65 -0
- package/dist/http-status.cjs +173 -0
- package/dist/http-status.d.cts +142 -0
- package/dist/http-status.d.mts +142 -0
- package/dist/http-status.mjs +171 -0
- package/dist/index.cjs +2551 -0
- package/dist/index.d.cts +1493 -0
- package/dist/index.d.mts +1493 -0
- package/dist/index.mjs +2357 -0
- package/dist/object-B0TV3eHx.d.mts +8052 -0
- package/dist/object-Blq0Amdv.d.cts +8052 -0
- package/dist/objectify-CDs0Fbr1.mjs +417 -0
- package/dist/objectify-DIJ-OBmo.cjs +524 -0
- package/dist/paginator.cjs +245 -0
- package/dist/paginator.d.cts +144 -0
- package/dist/paginator.d.mts +144 -0
- package/dist/paginator.mjs +243 -0
- package/dist/parse-2ubxXZRp.cjs +211 -0
- package/dist/parse-N7g942uy.mjs +164 -0
- package/dist/pluralizer-BjMIc6uT.d.mts +42 -0
- package/dist/pluralizer-Cb6ZmrDl.d.cts +42 -0
- package/dist/pluralizer.cjs +678 -0
- package/dist/pluralizer.d.cts +152 -0
- package/dist/pluralizer.d.mts +152 -0
- package/dist/pluralizer.mjs +676 -0
- package/dist/primitives-B26uZolQ.cjs +228 -0
- package/dist/primitives-KsFUp3kQ.mjs +144 -0
- package/dist/specials-D48_IZbd.d.mts +108 -0
- package/dist/specials-DzLr1ZgU.cjs +477 -0
- package/dist/specials-LVONlKbQ.d.cts +108 -0
- package/dist/specials-uhDuRg8H.mjs +292 -0
- package/dist/string-CBAbxaG1.d.mts +258 -0
- package/dist/string-CsNsm_65.d.cts +258 -0
- package/dist/stylog.cjs +621 -0
- package/dist/stylog.d.cts +49 -0
- package/dist/stylog.d.mts +49 -0
- package/dist/stylog.mjs +614 -0
- package/dist/timezone-B2OYK6Fh.mjs +5589 -0
- package/dist/timezone-Beh9IGpw.cjs +5625 -0
- package/dist/types/array.cjs +16 -0
- package/dist/types/array.d.cts +18 -0
- package/dist/types/array.d.mts +18 -0
- package/dist/types/array.mjs +17 -0
- package/dist/types/colors.cjs +16 -0
- package/dist/types/colors.d.cts +18 -0
- package/dist/types/colors.d.mts +18 -0
- package/dist/types/colors.mjs +17 -0
- package/dist/types/converter.cjs +16 -0
- package/dist/types/converter.d.cts +18 -0
- package/dist/types/converter.d.mts +18 -0
- package/dist/types/converter.mjs +17 -0
- package/dist/types/form.cjs +16 -0
- package/dist/types/form.d.cts +18 -0
- package/dist/types/form.d.mts +18 -0
- package/dist/types/form.mjs +17 -0
- package/dist/types/hash.cjs +16 -0
- package/dist/types/hash.d.cts +18 -0
- package/dist/types/hash.d.mts +18 -0
- package/dist/types/hash.mjs +17 -0
- package/dist/types/http-status.cjs +16 -0
- package/dist/types/http-status.d.cts +18 -0
- package/dist/types/http-status.d.mts +18 -0
- package/dist/types/http-status.mjs +17 -0
- package/dist/types/index.cjs +16 -0
- package/dist/types/index.d.cts +18 -0
- package/dist/types/index.d.mts +18 -0
- package/dist/types/index.mjs +17 -0
- package/dist/types/number.cjs +16 -0
- package/dist/types/number.d.cts +18 -0
- package/dist/types/number.d.mts +18 -0
- package/dist/types/number.mjs +17 -0
- package/dist/types/object.cjs +16 -0
- package/dist/types/object.d.cts +18 -0
- package/dist/types/object.d.mts +18 -0
- package/dist/types/object.mjs +17 -0
- package/dist/types/pluralizer.cjs +16 -0
- package/dist/types/pluralizer.d.cts +18 -0
- package/dist/types/pluralizer.d.mts +18 -0
- package/dist/types/pluralizer.mjs +17 -0
- package/dist/types/string.cjs +16 -0
- package/dist/types/string.d.cts +18 -0
- package/dist/types/string.d.mts +18 -0
- package/dist/types/string.mjs +17 -0
- package/dist/types/stylog.cjs +16 -0
- package/dist/types/stylog.d.cts +18 -0
- package/dist/types/stylog.d.mts +18 -0
- package/dist/types/stylog.mjs +17 -0
- package/dist/types/utils.cjs +16 -0
- package/dist/types/utils.d.cts +18 -0
- package/dist/types/utils.d.mts +18 -0
- package/dist/types/utils.mjs +17 -0
- package/dist/types/verbalizer.cjs +16 -0
- package/dist/types/verbalizer.d.cts +30 -0
- package/dist/types/verbalizer.d.mts +30 -0
- package/dist/types/verbalizer.mjs +17 -0
- package/dist/utilities-CLUmdQeV.cjs +140 -0
- package/dist/utilities-m5yFKqLd.mjs +105 -0
- package/dist/utils-ClW9LA6f.mjs +449 -0
- package/dist/utils-DLFRgXUC.cjs +568 -0
- package/dist/verbalizer.cjs +998 -0
- package/dist/verbalizer.d.cts +148 -0
- package/dist/verbalizer.d.mts +148 -0
- package/dist/verbalizer.mjs +996 -0
- package/package.json +249 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { V as Branded, it as Numeric, xt as TimeWithUnit, y as GenericObject } from "./object-Blq0Amdv.cjs";
|
|
18
|
+
|
|
19
|
+
//#region src/types/hash.d.ts
|
|
20
|
+
/** UUID versions as number from `1-8` */
|
|
21
|
+
type $UUIDVersion = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
22
|
+
/** UUID versions as string from `v1-v8` */
|
|
23
|
+
type UUIDVersion = `v${$UUIDVersion}`;
|
|
24
|
+
/** Supported UUID versions (without `v2`) as string */
|
|
25
|
+
type SupportedVersion = `v${Exclude<$UUIDVersion, 2>}`;
|
|
26
|
+
/** General 5 parts UUID string type */
|
|
27
|
+
type $UUID = `${string}-${string}-${string}-${string}-${string}`;
|
|
28
|
+
/** General 5 parts UUID string as {@link Branded} type */
|
|
29
|
+
type UUID<V extends UUIDVersion> = Branded<$UUID, V>;
|
|
30
|
+
/** * Options for generating UUID for `v3` and `v5` */
|
|
31
|
+
interface $UUIDOptionsV3V5<V extends 'v3' | 'v5'> extends $UUIDOptions<V> {
|
|
32
|
+
/** Namespace for `v3` and `v5` UUID (must be another valid UUID) */
|
|
33
|
+
namespace: $UUID;
|
|
34
|
+
/** Name for `v3` and `v5` UUID (must be a non-empty string) */
|
|
35
|
+
name: string;
|
|
36
|
+
}
|
|
37
|
+
/** * General Options for generating UUID */
|
|
38
|
+
interface $UUIDOptions<V extends SupportedVersion = 'v4'> {
|
|
39
|
+
/** UUID version, default `'v4'` */
|
|
40
|
+
version?: V | SupportedVersion;
|
|
41
|
+
/** Whether to use uppercase characters (default `false`) */
|
|
42
|
+
uppercase?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/** * Options for generating UUID */
|
|
45
|
+
type UUIDOptions<V extends SupportedVersion = 'v4'> = V extends 'v3' | 'v5' ? $UUIDOptionsV3V5<V> : $UUIDOptions<V>;
|
|
46
|
+
/** Type representing decoded UUID info */
|
|
47
|
+
interface DecodedUUID {
|
|
48
|
+
/** Original UUID */
|
|
49
|
+
raw: UUID<UUIDVersion>;
|
|
50
|
+
/** Plain version of the UUID without hyphens (`-`) */
|
|
51
|
+
plain: string;
|
|
52
|
+
/** Version of the UUID as number */
|
|
53
|
+
version: $UUIDVersion;
|
|
54
|
+
/** Variant of the UUID */
|
|
55
|
+
variant: 'NCS' | 'RFC4122' | 'Microsoft' | 'Future';
|
|
56
|
+
/** Single integer value of the UUID in bigint */
|
|
57
|
+
singleInt: bigint;
|
|
58
|
+
/** Timestamp for `v1`, `v6`, `v7` and `v8` (in ms since epoch) */
|
|
59
|
+
timestamp?: number;
|
|
60
|
+
/** v1 node (MAC) */
|
|
61
|
+
node?: string;
|
|
62
|
+
}
|
|
63
|
+
/** Header for `Signet` */
|
|
64
|
+
type SignetHeader = {
|
|
65
|
+
/** Algorithm used. Currently supports `'HS256'` only */alg: 'HS256'; /** Type of token. Fixed `'SIGNET+JWT'` */
|
|
66
|
+
typ: 'SIGNET+JWT';
|
|
67
|
+
};
|
|
68
|
+
/** Options for token verification */
|
|
69
|
+
type VerifyOptions = {
|
|
70
|
+
/** Where the token is allowed to be used */audience?: string | string[]; /** Who the token is about */
|
|
71
|
+
subject?: string; /** From where/who the token is issued */
|
|
72
|
+
issuer?: string;
|
|
73
|
+
};
|
|
74
|
+
/** Token signing options */
|
|
75
|
+
interface SignOptions extends VerifyOptions {
|
|
76
|
+
/**
|
|
77
|
+
* * Specifies when the token expires after issuing it.
|
|
78
|
+
*
|
|
79
|
+
* @remarks
|
|
80
|
+
* - A numeric value (number or numeric string ({@link Numeric})) is interpreted as seconds count, e.g., `120` or `'120'` will be treated as `'120 seconds'`.
|
|
81
|
+
* - If you use time value with unit ({@link TimeWithUnit}) be sure you provide the time units (days, hours, etc.), otherwise it will return `NaN`, e.g., `'120 unknown'` will return `NaN`.
|
|
82
|
+
*/
|
|
83
|
+
expiresIn?: TimeWithUnit | Numeric;
|
|
84
|
+
/**
|
|
85
|
+
* * Specifies when the token becomes active/valid in the future.
|
|
86
|
+
*
|
|
87
|
+
* @remarks
|
|
88
|
+
* - A numeric value (number or numeric string ({@link Numeric})) is interpreted as seconds count, e.g., `120` or `'120'` will be treated as `'120 seconds'`.
|
|
89
|
+
* - If you use time value with unit ({@link TimeWithUnit}) be sure you provide the time units (days, hours, etc.), otherwise it will return `NaN`, e.g., `'120 unknown'` will return `NaN`.
|
|
90
|
+
*/
|
|
91
|
+
notBefore?: TimeWithUnit | Numeric;
|
|
92
|
+
}
|
|
93
|
+
/** 3-parts dot separated token string */
|
|
94
|
+
type TokenString = `${string}.${string}.${string}`;
|
|
95
|
+
/** Interface of token verification result if token is valid */
|
|
96
|
+
type $ValidToken<T extends GenericObject = GenericObject> = {
|
|
97
|
+
/** Whether the token is valid */isValid: true; /** Decoded payload after successful verification with common {@link SignetPayload} properties */
|
|
98
|
+
payload: SignetPayload<T>;
|
|
99
|
+
};
|
|
100
|
+
/** Interface of token verification result if token is invalid */
|
|
101
|
+
type $InvalidToken = {
|
|
102
|
+
/** Whether the token is valid */isValid: false; /** Error message if the token is invalid */
|
|
103
|
+
error: string;
|
|
104
|
+
};
|
|
105
|
+
/** Result of token verification */
|
|
106
|
+
type VerifiedToken<T extends GenericObject = GenericObject> = $ValidToken<T> | $InvalidToken;
|
|
107
|
+
/** Decoded `Signet` payload with `iat` and optional claims */
|
|
108
|
+
type SignetPayload<T extends GenericObject = GenericObject> = {
|
|
109
|
+
/** When the token was created (unix timestamp in seconds) */iat: number; /** When the token was created (as JavaScript {@link Date}) */
|
|
110
|
+
iatDate: Date; /** When the token expires (unix timestamp in seconds) */
|
|
111
|
+
exp?: number; /** When the token expires (as JavaScript {@link Date}) */
|
|
112
|
+
expDate?: Date; /** When the token becomes valid (unix timestamp in seconds) */
|
|
113
|
+
nbf?: number; /** When the token becomes valid (as JavaScript {@link Date}) */
|
|
114
|
+
nbfDate?: Date; /** Where the token is allowed to be used */
|
|
115
|
+
aud?: string | string[]; /** Who the token is about */
|
|
116
|
+
sub?: string; /** From where/who the token is issued */
|
|
117
|
+
iss?: string;
|
|
118
|
+
} & T;
|
|
119
|
+
/** Interface of a decoded token */
|
|
120
|
+
type DecodedToken<T extends GenericObject = GenericObject> = {
|
|
121
|
+
/** Token header info, algorithm, type etc. */header: SignetHeader; /** Decoded payload after with common {@link SignetPayload} properties */
|
|
122
|
+
payload: SignetPayload<T>;
|
|
123
|
+
/**
|
|
124
|
+
* The `Base64`-encoded signature from the token.
|
|
125
|
+
* This is the third part of the token string.
|
|
126
|
+
*/
|
|
127
|
+
signature: string; /** The header and payload in encrypted `Base64` format.*/
|
|
128
|
+
signingInput: `${string}.${string}`;
|
|
129
|
+
};
|
|
130
|
+
//#endregion
|
|
131
|
+
export { VerifiedToken as _, $UUIDVersion as a, DecodedUUID as c, SignetPayload as d, SupportedVersion as f, UUIDVersion as g, UUIDOptions as h, $UUIDOptionsV3V5 as i, SignOptions as l, UUID as m, $UUID as n, $ValidToken as o, TokenString as p, $UUIDOptions as r, DecodedToken as s, $InvalidToken as t, SignetHeader as u, VerifyOptions as v };
|