@digitaldefiance/suite-core-lib 1.3.20 → 2.1.3
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/README.md +121 -3
- package/package.json +7 -4
- package/src/builders/index.d.ts +6 -0
- package/src/builders/index.d.ts.map +1 -0
- package/src/builders/index.js +9 -0
- package/src/builders/index.js.map +1 -0
- package/src/builders/role-builder.d.ts +19 -0
- package/src/builders/role-builder.d.ts.map +1 -0
- package/src/builders/role-builder.js +57 -0
- package/src/builders/role-builder.js.map +1 -0
- package/src/builders/user-builder.d.ts +23 -0
- package/src/builders/user-builder.d.ts.map +1 -0
- package/src/builders/user-builder.js +63 -0
- package/src/builders/user-builder.js.map +1 -0
- package/src/core/errors.d.ts +14 -0
- package/src/core/errors.d.ts.map +1 -0
- package/src/core/errors.js +29 -0
- package/src/core/errors.js.map +1 -0
- package/src/core/index.d.ts +7 -0
- package/src/core/index.d.ts.map +1 -0
- package/src/core/index.js +10 -0
- package/src/core/index.js.map +1 -0
- package/src/core/result.d.ts +34 -0
- package/src/core/result.d.ts.map +1 -0
- package/src/core/result.js +35 -0
- package/src/core/result.js.map +1 -0
- package/src/core/types.d.ts +17 -0
- package/src/core/types.d.ts.map +1 -0
- package/src/core/types.js +6 -0
- package/src/core/types.js.map +1 -0
- package/src/enumerations/suite-core-string-key.d.ts +13 -0
- package/src/enumerations/suite-core-string-key.d.ts.map +1 -1
- package/src/enumerations/suite-core-string-key.js +13 -0
- package/src/enumerations/suite-core-string-key.js.map +1 -1
- package/src/errors/admin-role-not-found.d.ts +2 -2
- package/src/errors/admin-role-not-found.d.ts.map +1 -1
- package/src/errors/admin-role-not-found.js +3 -3
- package/src/errors/admin-role-not-found.js.map +1 -1
- package/src/errors/core-typed-handleable.d.ts +2 -2
- package/src/errors/core-typed-handleable.d.ts.map +1 -1
- package/src/errors/core-typed-handleable.js +3 -3
- package/src/errors/core-typed-handleable.js.map +1 -1
- package/src/errors/email-token-expired.js +2 -2
- package/src/errors/email-token-expired.js.map +1 -1
- package/src/errors/fec-error.d.ts +3 -3
- package/src/errors/fec-error.d.ts.map +1 -1
- package/src/errors/fec-error.js +1 -2
- package/src/errors/fec-error.js.map +1 -1
- package/src/errors/invalid-email.d.ts +3 -3
- package/src/errors/invalid-email.d.ts.map +1 -1
- package/src/errors/invalid-email.js +1 -1
- package/src/errors/invalid-email.js.map +1 -1
- package/src/errors/member-role-not-found.d.ts +2 -2
- package/src/errors/member-role-not-found.d.ts.map +1 -1
- package/src/errors/member-role-not-found.js +3 -3
- package/src/errors/member-role-not-found.js.map +1 -1
- package/src/errors/pbkdf2-error.d.ts +3 -3
- package/src/errors/pbkdf2-error.d.ts.map +1 -1
- package/src/errors/pbkdf2-error.js +1 -1
- package/src/errors/pbkdf2-error.js.map +1 -1
- package/src/errors/system-role-not-found.d.ts +2 -2
- package/src/errors/system-role-not-found.d.ts.map +1 -1
- package/src/errors/system-role-not-found.js +5 -5
- package/src/errors/system-role-not-found.js.map +1 -1
- package/src/errors/translatable-suite-handleable.d.ts +2 -10
- package/src/errors/translatable-suite-handleable.d.ts.map +1 -1
- package/src/errors/translatable-suite-handleable.js +7 -24
- package/src/errors/translatable-suite-handleable.js.map +1 -1
- package/src/errors/translatable-suite.d.ts.map +1 -1
- package/src/errors/translatable-suite.js +1 -10
- package/src/errors/translatable-suite.js.map +1 -1
- package/src/i18n-setup.d.ts +6 -34
- package/src/i18n-setup.d.ts.map +1 -1
- package/src/i18n-setup.js +131 -95
- package/src/i18n-setup.js.map +1 -1
- package/src/index.d.ts +3 -0
- package/src/index.d.ts.map +1 -1
- package/src/index.js +3 -0
- package/src/index.js.map +1 -1
- package/src/lib/formatters.d.ts +16 -0
- package/src/lib/formatters.d.ts.map +1 -0
- package/src/lib/formatters.js +29 -0
- package/src/lib/formatters.js.map +1 -0
- package/src/lib/index.d.ts +7 -0
- package/src/lib/index.d.ts.map +1 -0
- package/src/lib/index.js +10 -0
- package/src/lib/index.js.map +1 -0
- package/src/lib/validators-with-constants.d.ts +73 -0
- package/src/lib/validators-with-constants.d.ts.map +1 -0
- package/src/lib/validators-with-constants.js +64 -0
- package/src/lib/validators-with-constants.js.map +1 -0
- package/src/lib/validators.d.ts +37 -0
- package/src/lib/validators.d.ts.map +1 -0
- package/src/lib/validators.js +74 -0
- package/src/lib/validators.js.map +1 -0
package/src/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export * from './backup-code-string';
|
|
2
|
+
export * from './builders';
|
|
2
3
|
export * from './constants';
|
|
4
|
+
export * from './core';
|
|
3
5
|
export * from './enumerations';
|
|
4
6
|
export * from './errors';
|
|
5
7
|
export * from './i18n-setup';
|
|
6
8
|
export * from './interfaces';
|
|
9
|
+
export * from './lib';
|
|
7
10
|
export * from './local-storage-manager';
|
|
8
11
|
export * from './defaults';
|
|
9
12
|
//# sourceMappingURL=index.d.ts.map
|
package/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-suite-core-lib/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-suite-core-lib/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,OAAO,CAAC;AACtB,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC"}
|
package/src/index.js
CHANGED
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./backup-code-string"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./builders"), exports);
|
|
5
6
|
tslib_1.__exportStar(require("./constants"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./core"), exports);
|
|
6
8
|
tslib_1.__exportStar(require("./enumerations"), exports);
|
|
7
9
|
tslib_1.__exportStar(require("./errors"), exports);
|
|
8
10
|
tslib_1.__exportStar(require("./i18n-setup"), exports);
|
|
9
11
|
tslib_1.__exportStar(require("./interfaces"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./lib"), exports);
|
|
10
13
|
tslib_1.__exportStar(require("./local-storage-manager"), exports);
|
|
11
14
|
tslib_1.__exportStar(require("./defaults"), exports);
|
|
12
15
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-suite-core-lib/src/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,sDAA4B;AAC5B,yDAA+B;AAC/B,mDAAyB;AACzB,uDAA6B;AAC7B,uDAA6B;AAC7B,kEAAwC;AACxC,qDAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-suite-core-lib/src/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,qDAA2B;AAC3B,sDAA4B;AAC5B,iDAAuB;AACvB,yDAA+B;AAC/B,mDAAyB;AACzB,uDAA6B;AAC7B,uDAA6B;AAC7B,gDAAsB;AACtB,kEAAwC;AACxC,qDAA2B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common formatting helpers
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Format backup code with dashes (XXXX-XXXX-XXXX-XXXX)
|
|
6
|
+
*/
|
|
7
|
+
export declare function formatBackupCode(code: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Validate backup code format
|
|
10
|
+
*/
|
|
11
|
+
export declare function isValidBackupCodeFormat(code: string): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Normalize backup code (remove dashes, uppercase)
|
|
14
|
+
*/
|
|
15
|
+
export declare function normalizeBackupCode(code: string): string;
|
|
16
|
+
//# sourceMappingURL=formatters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-suite-core-lib/src/lib/formatters.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAG7D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Common formatting helpers
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.formatBackupCode = formatBackupCode;
|
|
7
|
+
exports.isValidBackupCodeFormat = isValidBackupCodeFormat;
|
|
8
|
+
exports.normalizeBackupCode = normalizeBackupCode;
|
|
9
|
+
/**
|
|
10
|
+
* Format backup code with dashes (XXXX-XXXX-XXXX-XXXX)
|
|
11
|
+
*/
|
|
12
|
+
function formatBackupCode(code) {
|
|
13
|
+
const cleaned = code.replace(/[^A-Z0-9]/gi, '').toUpperCase();
|
|
14
|
+
return cleaned.match(/.{1,4}/g)?.join('-') || cleaned;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Validate backup code format
|
|
18
|
+
*/
|
|
19
|
+
function isValidBackupCodeFormat(code) {
|
|
20
|
+
const cleaned = code.replace(/[^A-Z0-9]/gi, '');
|
|
21
|
+
return cleaned.length === 16;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Normalize backup code (remove dashes, uppercase)
|
|
25
|
+
*/
|
|
26
|
+
function normalizeBackupCode(code) {
|
|
27
|
+
return code.replace(/[^A-Z0-9]/gi, '').toUpperCase();
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=formatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-suite-core-lib/src/lib/formatters.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAOH,4CAGC;AAKD,0DAGC;AAKD,kDAEC;AArBD;;GAEG;AACH,SAAgB,gBAAgB,CAAC,IAAY;IAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IAC9D,OAAO,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC;AACxD,CAAC;AAED;;GAEG;AACH,SAAgB,uBAAuB,CAAC,IAAY;IAClD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IAChD,OAAO,OAAO,CAAC,MAAM,KAAK,EAAE,CAAC;AAC/B,CAAC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,IAAY;IAC9C,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-suite-core-lib/src/lib/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,cAAc,CAAC"}
|
package/src/lib/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Library utilities - validators, formatters, and helpers
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
tslib_1.__exportStar(require("./validators"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./validators-with-constants"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./formatters"), exports);
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-suite-core-lib/src/lib/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,uDAA6B;AAC7B,sEAA4C;AAC5C,uDAA6B"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validators that accept custom constants
|
|
3
|
+
* Allows consumers to pass their own IConstants implementation
|
|
4
|
+
*/
|
|
5
|
+
import { IConstants } from '../interfaces/constants';
|
|
6
|
+
import { ICoreConstants } from '../interfaces/core-consts';
|
|
7
|
+
/**
|
|
8
|
+
* Create validators bound to specific constants
|
|
9
|
+
*/
|
|
10
|
+
export declare function createValidators(constants?: ICoreConstants | IConstants): {
|
|
11
|
+
/**
|
|
12
|
+
* Validate username format using provided constants
|
|
13
|
+
*/
|
|
14
|
+
isValidUsername(username: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Validate password format using provided constants
|
|
17
|
+
*/
|
|
18
|
+
isValidPassword(password: string): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Validate mnemonic format using provided constants
|
|
21
|
+
*/
|
|
22
|
+
isValidMnemonic(mnemonic: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Validate backup code normalized format using provided constants
|
|
25
|
+
*/
|
|
26
|
+
isValidBackupCodeNormalized(code: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Validate backup code display format using provided constants
|
|
29
|
+
*/
|
|
30
|
+
isValidBackupCodeDisplay(code: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Validate username length using provided constants
|
|
33
|
+
*/
|
|
34
|
+
isValidUsernameLength(username: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Validate password length using provided constants
|
|
37
|
+
*/
|
|
38
|
+
isValidPasswordLength(password: string): boolean;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Default validators using CORE constants
|
|
42
|
+
*/
|
|
43
|
+
export declare const defaultValidators: {
|
|
44
|
+
/**
|
|
45
|
+
* Validate username format using provided constants
|
|
46
|
+
*/
|
|
47
|
+
isValidUsername(username: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Validate password format using provided constants
|
|
50
|
+
*/
|
|
51
|
+
isValidPassword(password: string): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Validate mnemonic format using provided constants
|
|
54
|
+
*/
|
|
55
|
+
isValidMnemonic(mnemonic: string): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Validate backup code normalized format using provided constants
|
|
58
|
+
*/
|
|
59
|
+
isValidBackupCodeNormalized(code: string): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Validate backup code display format using provided constants
|
|
62
|
+
*/
|
|
63
|
+
isValidBackupCodeDisplay(code: string): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Validate username length using provided constants
|
|
66
|
+
*/
|
|
67
|
+
isValidUsernameLength(username: string): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Validate password length using provided constants
|
|
70
|
+
*/
|
|
71
|
+
isValidPasswordLength(password: string): boolean;
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=validators-with-constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators-with-constants.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-suite-core-lib/src/lib/validators-with-constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,GAAE,cAAc,GAAG,UAAiB;IAE1E;;OAEG;8BACuB,MAAM,GAAG,OAAO;IAI1C;;OAEG;8BACuB,MAAM,GAAG,OAAO;IAI1C;;OAEG;8BACuB,MAAM,GAAG,OAAO;IAI1C;;OAEG;sCAC+B,MAAM,GAAG,OAAO;IAIlD;;OAEG;mCAC4B,MAAM,GAAG,OAAO;IAI/C;;OAEG;oCAC6B,MAAM,GAAG,OAAO;IAOhD;;OAEG;oCAC6B,MAAM,GAAG,OAAO;EAInD;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB;IAzD1B;;OAEG;8BACuB,MAAM,GAAG,OAAO;IAI1C;;OAEG;8BACuB,MAAM,GAAG,OAAO;IAI1C;;OAEG;8BACuB,MAAM,GAAG,OAAO;IAI1C;;OAEG;sCAC+B,MAAM,GAAG,OAAO;IAIlD;;OAEG;mCAC4B,MAAM,GAAG,OAAO;IAI/C;;OAEG;oCAC6B,MAAM,GAAG,OAAO;IAOhD;;OAEG;oCAC6B,MAAM,GAAG,OAAO;CASD,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Validators that accept custom constants
|
|
4
|
+
* Allows consumers to pass their own IConstants implementation
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.defaultValidators = void 0;
|
|
8
|
+
exports.createValidators = createValidators;
|
|
9
|
+
const constants_1 = require("../constants");
|
|
10
|
+
/**
|
|
11
|
+
* Create validators bound to specific constants
|
|
12
|
+
*/
|
|
13
|
+
function createValidators(constants = constants_1.CORE) {
|
|
14
|
+
return {
|
|
15
|
+
/**
|
|
16
|
+
* Validate username format using provided constants
|
|
17
|
+
*/
|
|
18
|
+
isValidUsername(username) {
|
|
19
|
+
return constants.UsernameRegex.test(username);
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* Validate password format using provided constants
|
|
23
|
+
*/
|
|
24
|
+
isValidPassword(password) {
|
|
25
|
+
return constants.PasswordRegex.test(password);
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* Validate mnemonic format using provided constants
|
|
29
|
+
*/
|
|
30
|
+
isValidMnemonic(mnemonic) {
|
|
31
|
+
return constants.MnemonicRegex.test(mnemonic);
|
|
32
|
+
},
|
|
33
|
+
/**
|
|
34
|
+
* Validate backup code normalized format using provided constants
|
|
35
|
+
*/
|
|
36
|
+
isValidBackupCodeNormalized(code) {
|
|
37
|
+
return constants.BACKUP_CODES.NormalizedHexRegex.test(code);
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* Validate backup code display format using provided constants
|
|
41
|
+
*/
|
|
42
|
+
isValidBackupCodeDisplay(code) {
|
|
43
|
+
return constants.BACKUP_CODES.DisplayRegex.test(code);
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* Validate username length using provided constants
|
|
47
|
+
*/
|
|
48
|
+
isValidUsernameLength(username) {
|
|
49
|
+
return (username.length >= constants.UsernameMinLength &&
|
|
50
|
+
username.length <= constants.UsernameMaxLength);
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* Validate password length using provided constants
|
|
54
|
+
*/
|
|
55
|
+
isValidPasswordLength(password) {
|
|
56
|
+
return password.length >= constants.PasswordMinLength;
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Default validators using CORE constants
|
|
62
|
+
*/
|
|
63
|
+
exports.defaultValidators = createValidators();
|
|
64
|
+
//# sourceMappingURL=validators-with-constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators-with-constants.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-suite-core-lib/src/lib/validators-with-constants.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,4CAsDC;AA3DD,4CAAoC;AAEpC;;GAEG;AACH,SAAgB,gBAAgB,CAAC,YAAyC,gBAAI;IAC5E,OAAO;QACL;;WAEG;QACH,eAAe,CAAC,QAAgB;YAC9B,OAAO,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChD,CAAC;QAED;;WAEG;QACH,eAAe,CAAC,QAAgB;YAC9B,OAAO,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChD,CAAC;QAED;;WAEG;QACH,eAAe,CAAC,QAAgB;YAC9B,OAAO,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChD,CAAC;QAED;;WAEG;QACH,2BAA2B,CAAC,IAAY;YACtC,OAAO,SAAS,CAAC,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9D,CAAC;QAED;;WAEG;QACH,wBAAwB,CAAC,IAAY;YACnC,OAAO,SAAS,CAAC,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxD,CAAC;QAED;;WAEG;QACH,qBAAqB,CAAC,QAAgB;YACpC,OAAO,CACL,QAAQ,CAAC,MAAM,IAAI,SAAS,CAAC,iBAAiB;gBAC9C,QAAQ,CAAC,MAAM,IAAI,SAAS,CAAC,iBAAiB,CAC/C,CAAC;QACJ,CAAC;QAED;;WAEG;QACH,qBAAqB,CAAC,QAAgB;YACpC,OAAO,QAAQ,CAAC,MAAM,IAAI,SAAS,CAAC,iBAAiB,CAAC;QACxD,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACU,QAAA,iBAAiB,GAAG,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validate email format
|
|
3
|
+
*/
|
|
4
|
+
export declare function isValidEmail(email: string): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Validate username format using constants
|
|
7
|
+
*/
|
|
8
|
+
export declare function isValidUsername(username: string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Validate password format using constants
|
|
11
|
+
*/
|
|
12
|
+
export declare function isValidPassword(password: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Validate mnemonic format using constants
|
|
15
|
+
*/
|
|
16
|
+
export declare function isValidMnemonic(mnemonic: string): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Validate backup code format using constants
|
|
19
|
+
*/
|
|
20
|
+
export declare function isValidBackupCodeNormalized(code: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Validate backup code display format using constants
|
|
23
|
+
*/
|
|
24
|
+
export declare function isValidBackupCodeDisplay(code: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Validate that a value is not empty
|
|
27
|
+
*/
|
|
28
|
+
export declare function isNotEmpty(value: string | null | undefined): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Validate minimum length
|
|
31
|
+
*/
|
|
32
|
+
export declare function hasMinLength(value: string, minLength: number): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Validate maximum length
|
|
35
|
+
*/
|
|
36
|
+
export declare function hasMaxLength(value: string, maxLength: number): boolean;
|
|
37
|
+
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-suite-core-lib/src/lib/validators.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjE;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAEpE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAEtE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAEtE"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isValidEmail = isValidEmail;
|
|
4
|
+
exports.isValidUsername = isValidUsername;
|
|
5
|
+
exports.isValidPassword = isValidPassword;
|
|
6
|
+
exports.isValidMnemonic = isValidMnemonic;
|
|
7
|
+
exports.isValidBackupCodeNormalized = isValidBackupCodeNormalized;
|
|
8
|
+
exports.isValidBackupCodeDisplay = isValidBackupCodeDisplay;
|
|
9
|
+
exports.isNotEmpty = isNotEmpty;
|
|
10
|
+
exports.hasMinLength = hasMinLength;
|
|
11
|
+
exports.hasMaxLength = hasMaxLength;
|
|
12
|
+
/**
|
|
13
|
+
* Common validation helpers
|
|
14
|
+
*/
|
|
15
|
+
const constants_1 = require("../constants");
|
|
16
|
+
/**
|
|
17
|
+
* Email validation regex (RFC 5322 simplified)
|
|
18
|
+
*/
|
|
19
|
+
const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
20
|
+
/**
|
|
21
|
+
* Validate email format
|
|
22
|
+
*/
|
|
23
|
+
function isValidEmail(email) {
|
|
24
|
+
return EMAIL_REGEX.test(email);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Validate username format using constants
|
|
28
|
+
*/
|
|
29
|
+
function isValidUsername(username) {
|
|
30
|
+
return constants_1.CORE.UsernameRegex.test(username);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Validate password format using constants
|
|
34
|
+
*/
|
|
35
|
+
function isValidPassword(password) {
|
|
36
|
+
return constants_1.CORE.PasswordRegex.test(password);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Validate mnemonic format using constants
|
|
40
|
+
*/
|
|
41
|
+
function isValidMnemonic(mnemonic) {
|
|
42
|
+
return constants_1.CORE.MnemonicRegex.test(mnemonic);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Validate backup code format using constants
|
|
46
|
+
*/
|
|
47
|
+
function isValidBackupCodeNormalized(code) {
|
|
48
|
+
return constants_1.CORE.BACKUP_CODES.NormalizedHexRegex.test(code);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Validate backup code display format using constants
|
|
52
|
+
*/
|
|
53
|
+
function isValidBackupCodeDisplay(code) {
|
|
54
|
+
return constants_1.CORE.BACKUP_CODES.DisplayRegex.test(code);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Validate that a value is not empty
|
|
58
|
+
*/
|
|
59
|
+
function isNotEmpty(value) {
|
|
60
|
+
return value !== null && value !== undefined && value.trim().length > 0;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Validate minimum length
|
|
64
|
+
*/
|
|
65
|
+
function hasMinLength(value, minLength) {
|
|
66
|
+
return value.length >= minLength;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Validate maximum length
|
|
70
|
+
*/
|
|
71
|
+
function hasMaxLength(value, maxLength) {
|
|
72
|
+
return value.length <= maxLength;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=validators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-suite-core-lib/src/lib/validators.ts"],"names":[],"mappings":";;AAaA,oCAEC;AAKD,0CAEC;AAKD,0CAEC;AAKD,0CAEC;AAKD,kEAEC;AAKD,4DAEC;AAKD,gCAEC;AAKD,oCAEC;AAKD,oCAEC;AAvED;;GAEG;AACH,4CAAoC;AAEpC;;GAEG;AACH,MAAM,WAAW,GAAG,4BAA4B,CAAC;AAEjD;;GAEG;AACH,SAAgB,YAAY,CAAC,KAAa;IACxC,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,QAAgB;IAC9C,OAAO,gBAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,QAAgB;IAC9C,OAAO,gBAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,QAAgB;IAC9C,OAAO,gBAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,SAAgB,2BAA2B,CAAC,IAAY;IACtD,OAAO,gBAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzD,CAAC;AAED;;GAEG;AACH,SAAgB,wBAAwB,CAAC,IAAY;IACnD,OAAO,gBAAI,CAAC,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnD,CAAC;AAED;;GAEG;AACH,SAAgB,UAAU,CAAC,KAAgC;IACzD,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;AAC1E,CAAC;AAED;;GAEG;AACH,SAAgB,YAAY,CAAC,KAAa,EAAE,SAAiB;IAC3D,OAAO,KAAK,CAAC,MAAM,IAAI,SAAS,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,SAAgB,YAAY,CAAC,KAAa,EAAE,SAAiB;IAC3D,OAAO,KAAK,CAAC,MAAM,IAAI,SAAS,CAAC;AACnC,CAAC"}
|