@atlantjs/arch 2.5.12 → 2.6.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.
Files changed (140) hide show
  1. package/README.md +8 -8
  2. package/external-files/biome.json +47 -47
  3. package/external-files/typescript/tsconfig-backend.json +3 -3
  4. package/external-files/typescript/tsconfig-default.json +45 -45
  5. package/external-files/typescript/tsconfig-frontend.json +3 -3
  6. package/external-files/typescript/tsconfig-lib.json +6 -6
  7. package/external-files/typescript/tsconfig-mobile.json +3 -3
  8. package/index.d.ts +1 -33
  9. package/index.js +3 -62
  10. package/objects/arch/application/errors/failure.abstract.js +1 -1
  11. package/objects/arch/application/errors/unknown-application-error.js +1 -1
  12. package/package.json +2 -1
  13. package/tsconfig.tsbuildinfo +1 -1
  14. package/utils/datatypes/string-utils.d.ts +13 -1
  15. package/utils/datatypes/string-utils.js +41 -1
  16. package/utils/http-client/http-client-exception.d.ts +3 -0
  17. package/utils/http-client/http-client-exception.js +12 -0
  18. package/utils/http-client/http-client-request.d.ts +9 -0
  19. package/utils/http-client/http-client-response.d.ts +18 -0
  20. package/utils/http-client/http-client-response.get-header.failure.d.ts +4 -0
  21. package/utils/http-client/http-client-response.get-header.failure.js +14 -0
  22. package/utils/http-client/http-client-response.js +39 -0
  23. package/utils/http-client/http-client.d.ts +9 -0
  24. package/utils/http-client/http-client.js +21 -0
  25. package/objects/auth/entities/client/client-credentials.abstract.d.ts +0 -13
  26. package/objects/auth/entities/client/client-credentials.abstract.js +0 -27
  27. package/objects/auth/entities/client/client-credentials.abstract.type.d.ts +0 -7
  28. package/objects/auth/entities/client/realm-credentials.abstract.d.ts +0 -16
  29. package/objects/auth/entities/client/realm-credentials.abstract.js +0 -23
  30. package/objects/auth/entities/token/access-token-signature.d.ts +0 -10
  31. package/objects/auth/entities/token/access-token-signature.js +0 -47
  32. package/objects/auth/entities/token/access-token.abstract.d.ts +0 -10
  33. package/objects/auth/entities/token/access-token.abstract.has-role.failure.d.ts +0 -4
  34. package/objects/auth/entities/token/access-token.abstract.has-role.failure.js +0 -14
  35. package/objects/auth/entities/token/access-token.abstract.js +0 -25
  36. package/objects/auth/entities/token/access-token.abstract.signature-verify.failure.d.ts +0 -4
  37. package/objects/auth/entities/token/access-token.abstract.signature-verify.failure.js +0 -10
  38. package/objects/auth/entities/token/access-token.abstract.type.d.ts +0 -44
  39. package/objects/auth/entities/token/access-token.abstract.type.js +0 -2
  40. package/objects/auth/entities/token/rotation.d.ts +0 -12
  41. package/objects/auth/entities/token/rotation.js +0 -97
  42. package/objects/auth/entities/token/rotation.type.d.ts +0 -5
  43. package/objects/auth/entities/token/rotation.type.js +0 -2
  44. package/objects/auth/entities/token/token.d.ts +0 -16
  45. package/objects/auth/entities/token/token.js +0 -50
  46. package/objects/auth/entities/token/token.type.d.ts +0 -5
  47. package/objects/auth/entities/token/token.type.js +0 -2
  48. package/objects/auth/entities/user/enums/user-status.enum.d.ts +0 -4
  49. package/objects/auth/entities/user/enums/user-status.enum.js +0 -8
  50. package/objects/auth/entities/user/password/password.abstract.d.ts +0 -8
  51. package/objects/auth/entities/user/password/password.abstract.js +0 -41
  52. package/objects/auth/entities/user/password/password.abstract.type.d.ts +0 -5
  53. package/objects/auth/entities/user/password/password.abstract.type.js +0 -2
  54. package/objects/auth/entities/user/password/steps/not-allowing-consecutive-chars-step.d.ts +0 -11
  55. package/objects/auth/entities/user/password/steps/not-allowing-consecutive-chars-step.js +0 -34
  56. package/objects/auth/entities/user/password/steps/not-allowing-date-step.d.ts +0 -11
  57. package/objects/auth/entities/user/password/steps/not-allowing-date-step.js +0 -61
  58. package/objects/auth/entities/user/password/steps/not-allowing-phone-step.d.ts +0 -7
  59. package/objects/auth/entities/user/password/steps/not-allowing-phone-step.js +0 -27
  60. package/objects/auth/entities/user/password/steps/not-allowing-repeated-chars-step.d.ts +0 -11
  61. package/objects/auth/entities/user/password/steps/not-allowing-repeated-chars-step.js +0 -34
  62. package/objects/auth/entities/user/password/steps/not-allowing-string-step.d.ts +0 -7
  63. package/objects/auth/entities/user/password/steps/not-allowing-string-step.js +0 -19
  64. package/objects/auth/entities/user/password/steps/not-allowing-these-chars-step.d.ts +0 -10
  65. package/objects/auth/entities/user/password/steps/not-allowing-these-chars-step.js +0 -17
  66. package/objects/auth/entities/user/password/steps/numeric-step.d.ts +0 -5
  67. package/objects/auth/entities/user/password/steps/numeric-step.js +0 -13
  68. package/objects/auth/entities/user/password/steps/with-at-least-one-letter-step.d.ts +0 -5
  69. package/objects/auth/entities/user/password/steps/with-at-least-one-letter-step.js +0 -14
  70. package/objects/auth/entities/user/password/steps/with-at-least-one-number-digit-step.d.ts +0 -5
  71. package/objects/auth/entities/user/password/steps/with-at-least-one-number-digit-step.js +0 -14
  72. package/objects/auth/entities/user/password/steps/with-at-least-one-special-char-step.d.ts +0 -5
  73. package/objects/auth/entities/user/password/steps/with-at-least-one-special-char-step.js +0 -14
  74. package/objects/auth/entities/user/password/steps/with-length-step.d.ts +0 -11
  75. package/objects/auth/entities/user/password/steps/with-length-step.js +0 -18
  76. package/objects/auth/entities/user/password/validation-step.d.ts +0 -5
  77. package/objects/auth/entities/user/password/validation-step.js +0 -9
  78. package/objects/auth/entities/user/password/validation-step.type.d.ts +0 -4
  79. package/objects/auth/entities/user/password/validation-step.type.js +0 -2
  80. package/objects/auth/entities/user/user-credentials.abstract.d.ts +0 -12
  81. package/objects/auth/entities/user/user-credentials.abstract.js +0 -9
  82. package/objects/auth/entities/user/user-tokens.abstract.d.ts +0 -14
  83. package/objects/auth/entities/user/user-tokens.abstract.js +0 -27
  84. package/objects/auth/entities/user/user-tokens.abstract.type.d.ts +0 -5
  85. package/objects/auth/entities/user/user-tokens.abstract.type.js +0 -2
  86. package/objects/auth/entities/user/user.abstract.d.ts +0 -24
  87. package/objects/auth/entities/user/user.abstract.js +0 -32
  88. package/objects/auth/entities/user/value-objects/email.d.ts +0 -6
  89. package/objects/auth/entities/user/value-objects/email.js +0 -17
  90. package/objects/auth/entities/user/value-objects/person-name.d.ts +0 -7
  91. package/objects/auth/entities/user/value-objects/person-name.js +0 -17
  92. package/objects/auth/entities/user/value-objects/user-id.d.ts +0 -3
  93. package/objects/auth/entities/user/value-objects/user-id.js +0 -7
  94. package/objects/auth/entities/user/value-objects/username.d.ts +0 -3
  95. package/objects/auth/entities/user/value-objects/username.js +0 -7
  96. package/objects/auth/enums/client-role-group.enum.d.ts +0 -3
  97. package/objects/auth/enums/client-role-group.enum.js +0 -7
  98. package/objects/auth/enums/client-role.enum.d.ts +0 -3
  99. package/objects/auth/enums/client-role.enum.js +0 -7
  100. package/objects/auth/enums/client.enum.d.ts +0 -3
  101. package/objects/auth/enums/client.enum.js +0 -7
  102. package/objects/auth/enums/realm.enum.d.ts +0 -3
  103. package/objects/auth/enums/realm.enum.js +0 -7
  104. package/objects/auth/enums/role-group.type.d.ts +0 -3
  105. package/objects/auth/enums/role-group.type.js +0 -2
  106. package/objects/auth/enums/role.type.d.ts +0 -3
  107. package/objects/auth/enums/role.type.js +0 -2
  108. package/objects/auth/enums/token-name-header.enum.d.ts +0 -6
  109. package/objects/auth/enums/token-name-header.enum.js +0 -10
  110. package/objects/auth/enums/user-role-group.enum.d.ts +0 -4
  111. package/objects/auth/enums/user-role-group.enum.js +0 -8
  112. package/objects/auth/enums/user-role.enum.d.ts +0 -17
  113. package/objects/auth/enums/user-role.enum.js +0 -21
  114. package/tests/builders/auth/access-token-signature.builder.d.ts +0 -6
  115. package/tests/builders/auth/access-token-signature.builder.js +0 -19
  116. package/tests/builders/auth/access-token.builder.d.ts +0 -6
  117. package/tests/builders/auth/access-token.builder.js +0 -15
  118. package/tests/builders/auth/rotation.builder.d.ts +0 -6
  119. package/tests/builders/auth/rotation.builder.js +0 -19
  120. package/tests/builders/auth/token.builder.d.ts +0 -7
  121. package/tests/builders/auth/token.builder.js +0 -15
  122. package/tests/builders/auth/value-objects/client-credentials.builder.d.ts +0 -6
  123. package/tests/builders/auth/value-objects/client-credentials.builder.js +0 -18
  124. package/tests/builders/auth/value-objects/dummies/access-token.dummy.d.ts +0 -3
  125. package/tests/builders/auth/value-objects/dummies/access-token.dummy.js +0 -7
  126. package/tests/builders/auth/value-objects/dummies/client-credentials.dummy.d.ts +0 -3
  127. package/tests/builders/auth/value-objects/dummies/client-credentials.dummy.js +0 -7
  128. package/tests/builders/auth/value-objects/dummies/realm-credentials.dummy.d.ts +0 -6
  129. package/tests/builders/auth/value-objects/dummies/realm-credentials.dummy.js +0 -12
  130. package/tests/builders/auth/value-objects/dummies/user-tokens.dummy.d.ts +0 -3
  131. package/tests/builders/auth/value-objects/dummies/user-tokens.dummy.js +0 -7
  132. package/tests/builders/auth/value-objects/realm-credentials.builder.d.ts +0 -6
  133. package/tests/builders/auth/value-objects/realm-credentials.builder.js +0 -17
  134. package/tests/builders/auth/value-objects/user-tokens.builder.d.ts +0 -7
  135. package/tests/builders/auth/value-objects/user-tokens.builder.js +0 -18
  136. package/tests/builders/user/person-name.builder.d.ts +0 -6
  137. package/tests/builders/user/person-name.builder.js +0 -15
  138. package/tests/builders/user/user-id.builder.d.ts +0 -6
  139. package/tests/builders/user/user-id.builder.js +0 -15
  140. /package/{objects/auth/entities/client/client-credentials.abstract.type.js → utils/http-client/http-client-request.js} +0 -0
@@ -1,50 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Token = void 0;
7
- const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
8
- const optional_type_1 = require("../../../../utils/ducts/optional-type");
9
- const return_type_1 = require("../../../../utils/ducts/return-type");
10
- const guardian_1 = require("../../../../utils/type-guard/guardian");
11
- class Token {
12
- constructor(token) {
13
- this._token = token.replace(/^bearer/i, "").trim();
14
- const tokenParts = this._token.split(".");
15
- this._header = JSON.parse(Buffer.from(tokenParts[0], "base64").toString());
16
- const payload = jsonwebtoken_1.default.decode(this._token);
17
- if (guardian_1.Guardian.isEmpty(payload) || guardian_1.Guardian.isTypeOf(payload, "string")) {
18
- throw new Error("Invalid token");
19
- }
20
- this._payload = payload;
21
- }
22
- static isValid(token) {
23
- try {
24
- new Token(token);
25
- return true;
26
- }
27
- catch {
28
- return false;
29
- }
30
- }
31
- getClaim(key) {
32
- return (0, optional_type_1.Optional)(this._payload[key]);
33
- }
34
- get header() {
35
- return this._header;
36
- }
37
- get payload() {
38
- return this._payload;
39
- }
40
- isExpired() {
41
- if (guardian_1.Guardian.isEmpty(this._payload.exp)) {
42
- return (0, return_type_1.Success)(false);
43
- }
44
- return (0, return_type_1.Success)(this._payload.exp * 1000 < Date.now());
45
- }
46
- toString() {
47
- return this._token;
48
- }
49
- }
50
- exports.Token = Token;
@@ -1,5 +0,0 @@
1
- export interface TokenHeader {
2
- alg: string;
3
- typ: string;
4
- kid?: string;
5
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +0,0 @@
1
- export declare enum UserStatusEnum {
2
- active = "active",
3
- inactive = "inactive"
4
- }
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserStatusEnum = void 0;
4
- var UserStatusEnum;
5
- (function (UserStatusEnum) {
6
- UserStatusEnum["active"] = "active";
7
- UserStatusEnum["inactive"] = "inactive";
8
- })(UserStatusEnum || (exports.UserStatusEnum = UserStatusEnum = {}));
@@ -1,8 +0,0 @@
1
- import { PasswordPolicyResult } from "./password.abstract.type";
2
- export declare abstract class PasswordAbstract {
3
- private readonly password;
4
- private readonly validationSteps;
5
- constructor(password: string);
6
- protected validate(password: string): PasswordPolicyResult;
7
- toString(): string;
8
- }
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PasswordAbstract = void 0;
4
- const with_at_least_one_letter_step_1 = require("./steps/with-at-least-one-letter-step");
5
- const with_at_least_one_number_digit_step_1 = require("./steps/with-at-least-one-number-digit-step");
6
- const with_at_least_one_special_char_step_1 = require("./steps/with-at-least-one-special-char-step");
7
- const with_length_step_1 = require("./steps/with-length-step");
8
- const guardian_1 = require("../../../../../utils/type-guard/guardian");
9
- class PasswordAbstract {
10
- constructor(password) {
11
- this.password = password;
12
- this.validationSteps = [
13
- new with_at_least_one_letter_step_1.WithAtLeastOneLetterStep(),
14
- new with_at_least_one_number_digit_step_1.WithAtLeastOneNumberDigitStep(),
15
- new with_at_least_one_special_char_step_1.WithAtLeastOneSpecialCharStep(),
16
- new with_length_step_1.WithLengthStep({ min: 6, max: 999 }),
17
- ];
18
- const { valid, validationStepsResults } = this.validate(this.password);
19
- if (guardian_1.Guardian.isFalsy(valid)) {
20
- throw new TypeError(`Password is invalid: ${validationStepsResults.map((result) => result.name)}`);
21
- }
22
- }
23
- validate(password) {
24
- if (guardian_1.Guardian.isEqual(this.validationSteps.length, 0)) {
25
- throw new TypeError("No validations found");
26
- }
27
- const validationStepsResults = [];
28
- for (const step of this.validationSteps) {
29
- validationStepsResults.push(step.validate(password));
30
- }
31
- const valid = validationStepsResults.every((result) => result.valid);
32
- return {
33
- valid,
34
- validationStepsResults,
35
- };
36
- }
37
- toString() {
38
- return this.password;
39
- }
40
- }
41
- exports.PasswordAbstract = PasswordAbstract;
@@ -1,5 +0,0 @@
1
- import { ValidationStepResult } from "./validation-step.type";
2
- export interface PasswordPolicyResult {
3
- valid: boolean;
4
- validationStepsResults: ValidationStepResult[];
5
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,11 +0,0 @@
1
- import { ValidationStep } from "../validation-step";
2
- import { ValidationStepResult } from "../validation-step.type";
3
- export interface NotAllowingConsecutiveCharsStepOptions {
4
- maxAllowedConsecutiveChars: number;
5
- }
6
- export declare class NotAllowingConsecutiveCharsStep extends ValidationStep {
7
- private readonly params;
8
- constructor(params: NotAllowingConsecutiveCharsStepOptions);
9
- validate(password: string): ValidationStepResult;
10
- private getMaxNumberOfConsecutiveChars;
11
- }
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NotAllowingConsecutiveCharsStep = void 0;
4
- const validation_step_1 = require("../validation-step");
5
- class NotAllowingConsecutiveCharsStep extends validation_step_1.ValidationStep {
6
- constructor(params) {
7
- super();
8
- this.params = params;
9
- }
10
- validate(password) {
11
- return {
12
- valid: this.getMaxNumberOfConsecutiveChars(password) <=
13
- this.params.maxAllowedConsecutiveChars,
14
- name: this.name,
15
- };
16
- }
17
- getMaxNumberOfConsecutiveChars(password) {
18
- let numberOfConsecutiveChars = 1;
19
- let maxNumberOfConsecutiveChars = 1;
20
- for (let i = 1; i < password.length; i++) {
21
- const previousChar = password[i - 1];
22
- const char = password[i];
23
- if (Math.abs(previousChar.charCodeAt(0) - char.charCodeAt(0)) === 1) {
24
- numberOfConsecutiveChars += 1;
25
- }
26
- else {
27
- maxNumberOfConsecutiveChars = Math.max(numberOfConsecutiveChars, maxNumberOfConsecutiveChars);
28
- numberOfConsecutiveChars = 1;
29
- }
30
- }
31
- return Math.max(numberOfConsecutiveChars, maxNumberOfConsecutiveChars);
32
- }
33
- }
34
- exports.NotAllowingConsecutiveCharsStep = NotAllowingConsecutiveCharsStep;
@@ -1,11 +0,0 @@
1
- import { ValidationStep } from "../validation-step";
2
- import { ValidationStepResult } from "../validation-step.type";
3
- export declare class NotAllowingDateStep extends ValidationStep {
4
- private readonly notAllowedDate;
5
- constructor(notAllowedDate: Date);
6
- validate(password: string): ValidationStepResult;
7
- private possibleDateCombinations;
8
- private buildDayFormats;
9
- private buildMonthFormats;
10
- private buildYearFormat;
11
- }
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NotAllowingDateStep = void 0;
4
- const validation_step_1 = require("../validation-step");
5
- class NotAllowingDateStep extends validation_step_1.ValidationStep {
6
- constructor(notAllowedDate) {
7
- super();
8
- this.notAllowedDate = notAllowedDate;
9
- }
10
- validate(password) {
11
- const cleanPassword = password.replace(/[^\w]/gi, "");
12
- const result = this.possibleDateCombinations().every((dateFormat) => !cleanPassword.includes(dateFormat.toLowerCase()));
13
- return {
14
- valid: result,
15
- name: this.name,
16
- };
17
- }
18
- possibleDateCombinations() {
19
- const formats = [];
20
- this.buildDayFormats().forEach((day) => {
21
- this.buildMonthFormats().forEach((month) => {
22
- this.buildYearFormat().forEach((year) => {
23
- formats.push(`${day}${month}`);
24
- formats.push(`${month}${day}`);
25
- formats.push(`${day}${month}${year}`);
26
- formats.push(`${month}${day}${year}`);
27
- formats.push(`${year}${month}${day}`);
28
- });
29
- });
30
- });
31
- return [...new Set(formats)];
32
- }
33
- buildDayFormats() {
34
- const day = this.notAllowedDate.getUTCDate();
35
- const dayLength = 2;
36
- return [
37
- ...new Set([day.toString(), day.toString().padStart(dayLength, "0")]),
38
- ];
39
- }
40
- buildMonthFormats() {
41
- const month = this.notAllowedDate.getUTCMonth() + 1;
42
- const monthLength = 2;
43
- return [
44
- ...new Set([
45
- month.toString(),
46
- month.toString().padStart(monthLength, "0"),
47
- ]),
48
- ];
49
- }
50
- buildYearFormat() {
51
- const year = this.notAllowedDate.getUTCFullYear();
52
- const abbreviateYearLength = 2;
53
- return [
54
- ...new Set([
55
- year.toString(),
56
- year.toString().slice(-abbreviateYearLength),
57
- ]),
58
- ];
59
- }
60
- }
61
- exports.NotAllowingDateStep = NotAllowingDateStep;
@@ -1,7 +0,0 @@
1
- import { ValidationStep } from "../validation-step";
2
- import { ValidationStepResult } from "../validation-step.type";
3
- export declare class NotAllowingPhoneStep extends ValidationStep {
4
- private readonly notAllowedPhone?;
5
- constructor(phone: string);
6
- validate(password: string): ValidationStepResult;
7
- }
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NotAllowingPhoneStep = void 0;
4
- const validation_step_1 = require("../validation-step");
5
- class NotAllowingPhoneStep extends validation_step_1.ValidationStep {
6
- constructor(phone) {
7
- super();
8
- const matches = phone.match(/\d{4}\-?\d{4}$/);
9
- if (matches) {
10
- this.notAllowedPhone = matches[0].replace(/\-/, "");
11
- }
12
- }
13
- validate(password) {
14
- if (!this.notAllowedPhone) {
15
- return {
16
- valid: true,
17
- name: this.name,
18
- };
19
- }
20
- const cleanPassword = password.replace(/[\-\s]/gi, "");
21
- return {
22
- valid: !cleanPassword.includes(this.notAllowedPhone),
23
- name: this.name,
24
- };
25
- }
26
- }
27
- exports.NotAllowingPhoneStep = NotAllowingPhoneStep;
@@ -1,11 +0,0 @@
1
- import { ValidationStep } from "../validation-step";
2
- import { ValidationStepResult } from "../validation-step.type";
3
- export interface NotAllowingRepeatedCharsStepOptions {
4
- maxAllowedRepeatedChars: number;
5
- }
6
- export declare class NotAllowingRepeatedCharsStep extends ValidationStep {
7
- private readonly options;
8
- constructor(options: NotAllowingRepeatedCharsStepOptions);
9
- validate(password: string): ValidationStepResult;
10
- private getMaxNumberOfRepeatedChars;
11
- }
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NotAllowingRepeatedCharsStep = void 0;
4
- const validation_step_1 = require("../validation-step");
5
- class NotAllowingRepeatedCharsStep extends validation_step_1.ValidationStep {
6
- constructor(options) {
7
- super();
8
- this.options = options;
9
- }
10
- validate(password) {
11
- return {
12
- valid: this.getMaxNumberOfRepeatedChars(password) <=
13
- this.options.maxAllowedRepeatedChars,
14
- name: this.name,
15
- };
16
- }
17
- getMaxNumberOfRepeatedChars(password) {
18
- let numberOfRepeatedChars = 1;
19
- let maxNumberOfRepeatedChars = 1;
20
- for (let i = 1; i < password.length; i++) {
21
- const previousChar = password[i - 1];
22
- const char = password[i];
23
- if (previousChar === char) {
24
- numberOfRepeatedChars += 1;
25
- }
26
- else {
27
- maxNumberOfRepeatedChars = Math.max(numberOfRepeatedChars, maxNumberOfRepeatedChars);
28
- numberOfRepeatedChars = 1;
29
- }
30
- }
31
- return Math.max(numberOfRepeatedChars, maxNumberOfRepeatedChars);
32
- }
33
- }
34
- exports.NotAllowingRepeatedCharsStep = NotAllowingRepeatedCharsStep;
@@ -1,7 +0,0 @@
1
- import { ValidationStep } from "../validation-step";
2
- import { ValidationStepResult } from "../validation-step.type";
3
- export declare class NotAllowingStringStep extends ValidationStep {
4
- private readonly forbiddenString;
5
- constructor(forbiddenString: string);
6
- validate(password: string): ValidationStepResult;
7
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NotAllowingStringStep = void 0;
4
- const validation_step_1 = require("../validation-step");
5
- class NotAllowingStringStep extends validation_step_1.ValidationStep {
6
- constructor(forbiddenString) {
7
- super();
8
- this.forbiddenString = forbiddenString;
9
- }
10
- validate(password) {
11
- return {
12
- valid: !password
13
- .toLowerCase()
14
- .includes(this.forbiddenString.toLowerCase()),
15
- name: this.name,
16
- };
17
- }
18
- }
19
- exports.NotAllowingStringStep = NotAllowingStringStep;
@@ -1,10 +0,0 @@
1
- import { ValidationStep } from "../validation-step";
2
- import { ValidationStepResult } from "../validation-step.type";
3
- export interface NotAllowingTheseCharsStepOptions {
4
- notAllowedCharsList: string[];
5
- }
6
- export declare class NotAllowingTheseCharsStep extends ValidationStep {
7
- private readonly options;
8
- constructor(options: NotAllowingTheseCharsStepOptions);
9
- validate(password: string): ValidationStepResult;
10
- }
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NotAllowingTheseCharsStep = void 0;
4
- const validation_step_1 = require("../validation-step");
5
- class NotAllowingTheseCharsStep extends validation_step_1.ValidationStep {
6
- constructor(options) {
7
- super();
8
- this.options = options;
9
- }
10
- validate(password) {
11
- return {
12
- valid: this.options.notAllowedCharsList.every((char) => !password.toLowerCase().includes(char.toLowerCase())),
13
- name: this.name,
14
- };
15
- }
16
- }
17
- exports.NotAllowingTheseCharsStep = NotAllowingTheseCharsStep;
@@ -1,5 +0,0 @@
1
- import { ValidationStep } from "../validation-step";
2
- import { ValidationStepResult } from "../validation-step.type";
3
- export declare class NumericStep extends ValidationStep {
4
- validate(password: string): ValidationStepResult;
5
- }
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NumericStep = void 0;
4
- const validation_step_1 = require("../validation-step");
5
- class NumericStep extends validation_step_1.ValidationStep {
6
- validate(password) {
7
- return {
8
- valid: /^\d+$/.test(password),
9
- name: this.name,
10
- };
11
- }
12
- }
13
- exports.NumericStep = NumericStep;
@@ -1,5 +0,0 @@
1
- import { ValidationStep } from "../validation-step";
2
- import { ValidationStepResult } from "../validation-step.type";
3
- export declare class WithAtLeastOneLetterStep extends ValidationStep {
4
- validate(password: string): ValidationStepResult;
5
- }
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WithAtLeastOneLetterStep = void 0;
4
- const validation_step_1 = require("../validation-step");
5
- class WithAtLeastOneLetterStep extends validation_step_1.ValidationStep {
6
- validate(password) {
7
- const regex = /[a-zA-Z]/;
8
- return {
9
- valid: regex.test(password),
10
- name: this.name,
11
- };
12
- }
13
- }
14
- exports.WithAtLeastOneLetterStep = WithAtLeastOneLetterStep;
@@ -1,5 +0,0 @@
1
- import { ValidationStep } from "../validation-step";
2
- import { ValidationStepResult } from "../validation-step.type";
3
- export declare class WithAtLeastOneNumberDigitStep extends ValidationStep {
4
- validate(password: string): ValidationStepResult;
5
- }
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WithAtLeastOneNumberDigitStep = void 0;
4
- const validation_step_1 = require("../validation-step");
5
- class WithAtLeastOneNumberDigitStep extends validation_step_1.ValidationStep {
6
- validate(password) {
7
- const regex = /\d/;
8
- return {
9
- valid: regex.test(password),
10
- name: this.name,
11
- };
12
- }
13
- }
14
- exports.WithAtLeastOneNumberDigitStep = WithAtLeastOneNumberDigitStep;
@@ -1,5 +0,0 @@
1
- import { ValidationStep } from "../validation-step";
2
- import { ValidationStepResult } from "../validation-step.type";
3
- export declare class WithAtLeastOneSpecialCharStep extends ValidationStep {
4
- validate(password: string): ValidationStepResult;
5
- }
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WithAtLeastOneSpecialCharStep = void 0;
4
- const validation_step_1 = require("../validation-step");
5
- class WithAtLeastOneSpecialCharStep extends validation_step_1.ValidationStep {
6
- validate(password) {
7
- const regex = /[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/;
8
- return {
9
- valid: regex.test(password),
10
- name: this.name,
11
- };
12
- }
13
- }
14
- exports.WithAtLeastOneSpecialCharStep = WithAtLeastOneSpecialCharStep;
@@ -1,11 +0,0 @@
1
- import { ValidationStep } from "../validation-step";
2
- import { ValidationStepResult } from "../validation-step.type";
3
- export interface WithLengthStepOptions {
4
- min: number;
5
- max: number;
6
- }
7
- export declare class WithLengthStep extends ValidationStep {
8
- private readonly options;
9
- constructor(options: WithLengthStepOptions);
10
- validate(password: string): ValidationStepResult;
11
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WithLengthStep = void 0;
4
- const validation_step_1 = require("../validation-step");
5
- class WithLengthStep extends validation_step_1.ValidationStep {
6
- constructor(options) {
7
- super();
8
- this.options = options;
9
- }
10
- validate(password) {
11
- return {
12
- valid: password.length >= this.options.min &&
13
- password.length <= this.options.max,
14
- name: this.name,
15
- };
16
- }
17
- }
18
- exports.WithLengthStep = WithLengthStep;
@@ -1,5 +0,0 @@
1
- import { ValidationStepResult } from "./validation-step.type";
2
- export declare abstract class ValidationStep {
3
- abstract validate(password: string): ValidationStepResult;
4
- protected get name(): string;
5
- }
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ValidationStep = void 0;
4
- class ValidationStep {
5
- get name() {
6
- return this.constructor.name;
7
- }
8
- }
9
- exports.ValidationStep = ValidationStep;
@@ -1,4 +0,0 @@
1
- export interface ValidationStepResult {
2
- valid: boolean;
3
- name: string;
4
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,12 +0,0 @@
1
- import { SolidAbstract } from "../../../arch/domain/solid.abstract";
2
- import { PasswordAbstract } from "./password/password.abstract";
3
- import { Email } from "./value-objects/email";
4
- import { Username } from "./value-objects/username";
5
- import { ObjectType } from "../../../../utils/datatypes/generic-types";
6
- import { Optional } from "../../../../utils/ducts/optional-type";
7
- export declare abstract class UserCredentialsAbstract implements SolidAbstract {
8
- abstract usernamePacked: Optional<Username>;
9
- abstract emailPacked: Optional<Email>;
10
- abstract passwordPacked: Optional<PasswordAbstract>;
11
- toPlain(): ObjectType;
12
- }
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserCredentialsAbstract = void 0;
4
- class UserCredentialsAbstract {
5
- toPlain() {
6
- throw new Error("Method not implemented.");
7
- }
8
- }
9
- exports.UserCredentialsAbstract = UserCredentialsAbstract;
@@ -1,14 +0,0 @@
1
- import { SolidAbstract } from "../../../arch/domain/solid.abstract";
2
- import { AccessTokenPayload, RefreshTokenPayload } from "../token/access-token.abstract.type";
3
- import { Token } from "../token/token";
4
- import { UserTokensPrimitive } from "./user-tokens.abstract.type";
5
- export declare abstract class UserTokensAbstract implements SolidAbstract {
6
- protected readonly _accessToken: Token<AccessTokenPayload>;
7
- protected readonly _refreshToken: Token<RefreshTokenPayload>;
8
- protected readonly _accessTokenExpirationDate: Date;
9
- constructor(_accessToken: Token<AccessTokenPayload>, _refreshToken: Token<RefreshTokenPayload>, _accessTokenExpirationDate: Date);
10
- get accessToken(): Token<AccessTokenPayload>;
11
- get refreshToken(): Token<RefreshTokenPayload>;
12
- get accessTokenExpirationDate(): Date;
13
- toPlain(): UserTokensPrimitive;
14
- }
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserTokensAbstract = void 0;
4
- class UserTokensAbstract {
5
- constructor(_accessToken, _refreshToken, _accessTokenExpirationDate) {
6
- this._accessToken = _accessToken;
7
- this._refreshToken = _refreshToken;
8
- this._accessTokenExpirationDate = _accessTokenExpirationDate;
9
- }
10
- get accessToken() {
11
- return this._accessToken;
12
- }
13
- get refreshToken() {
14
- return this._refreshToken;
15
- }
16
- get accessTokenExpirationDate() {
17
- return this._accessTokenExpirationDate;
18
- }
19
- toPlain() {
20
- return {
21
- accessToken: this.accessToken.toString(),
22
- refreshToken: this.refreshToken.toString(),
23
- accessTokenExpirationDate: this.accessTokenExpirationDate,
24
- };
25
- }
26
- }
27
- exports.UserTokensAbstract = UserTokensAbstract;
@@ -1,5 +0,0 @@
1
- export interface UserTokensPrimitive {
2
- accessToken: string;
3
- refreshToken: string;
4
- accessTokenExpirationDate: Date;
5
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });