@atlantjs/arch 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/README.md +8 -0
- package/configs/env/env-vars.d.ts +3 -0
- package/configs/env/env-vars.js +20 -0
- package/external-files/biome.json +47 -0
- package/external-files/typescript/tsconfig-backend.json +3 -0
- package/external-files/typescript/tsconfig-default.json +42 -0
- package/external-files/typescript/tsconfig-frontend.json +3 -0
- package/external-files/typescript/tsconfig-lib.json +6 -0
- package/external-files/typescript/tsconfig-mobile.json +3 -0
- package/index.d.ts +51 -0
- package/index.js +106 -0
- package/objects/arch/application/errors/application-error.abstract.d.ts +8 -0
- package/objects/arch/application/errors/application-error.abstract.js +25 -0
- package/objects/arch/application/errors/application-error.abstract.type.d.ts +9 -0
- package/objects/arch/application/errors/application-error.abstract.type.js +2 -0
- package/objects/arch/application/errors/unknown-application-error.d.ts +15 -0
- package/objects/arch/application/errors/unknown-application-error.js +16 -0
- package/objects/arch/domain/entity.abstract.d.ts +3 -0
- package/objects/arch/domain/entity.abstract.js +6 -0
- package/objects/arch/domain/usecase.abstract.d.ts +4 -0
- package/objects/arch/domain/usecase.abstract.js +6 -0
- package/objects/arch/infrastructure/controller.abstract.d.ts +6 -0
- package/objects/arch/infrastructure/controller.abstract.js +6 -0
- package/objects/auth/entities/client/client-credentials.abstract.d.ts +13 -0
- package/objects/auth/entities/client/client-credentials.abstract.js +27 -0
- package/objects/auth/entities/client/client-credentials.abstract.type.d.ts +7 -0
- package/objects/auth/entities/client/client-credentials.abstract.type.js +2 -0
- package/objects/auth/entities/client/realm-credentials.abstract.d.ts +13 -0
- package/objects/auth/entities/client/realm-credentials.abstract.js +20 -0
- package/objects/auth/entities/token/access-token-signature.d.ts +10 -0
- package/objects/auth/entities/token/access-token-signature.js +58 -0
- package/objects/auth/entities/token/access-token.abstract.d.ts +10 -0
- package/objects/auth/entities/token/access-token.abstract.has-role.error.d.ts +4 -0
- package/objects/auth/entities/token/access-token.abstract.has-role.error.js +14 -0
- package/objects/auth/entities/token/access-token.abstract.js +25 -0
- package/objects/auth/entities/token/access-token.abstract.signature-verify.error.d.ts +4 -0
- package/objects/auth/entities/token/access-token.abstract.signature-verify.error.js +10 -0
- package/objects/auth/entities/token/access-token.abstract.type.d.ts +44 -0
- package/objects/auth/entities/token/access-token.abstract.type.js +2 -0
- package/objects/auth/entities/token/rotation.d.ts +12 -0
- package/objects/auth/entities/token/rotation.js +108 -0
- package/objects/auth/entities/token/rotation.type.d.ts +5 -0
- package/objects/auth/entities/token/rotation.type.js +2 -0
- package/objects/auth/entities/token/token.d.ts +16 -0
- package/objects/auth/entities/token/token.js +50 -0
- package/objects/auth/entities/token/token.type.d.ts +5 -0
- package/objects/auth/entities/token/token.type.js +2 -0
- package/objects/auth/entities/user/enums/user-status.enum.d.ts +4 -0
- package/objects/auth/entities/user/enums/user-status.enum.js +8 -0
- package/objects/auth/entities/user/password/password.abstract.d.ts +8 -0
- package/objects/auth/entities/user/password/password.abstract.js +41 -0
- package/objects/auth/entities/user/password/password.abstract.type.d.ts +5 -0
- package/objects/auth/entities/user/password/password.abstract.type.js +2 -0
- package/objects/auth/entities/user/password/steps/not-allowing-consecutive-chars-step.d.ts +11 -0
- package/objects/auth/entities/user/password/steps/not-allowing-consecutive-chars-step.js +34 -0
- package/objects/auth/entities/user/password/steps/not-allowing-date-step.d.ts +11 -0
- package/objects/auth/entities/user/password/steps/not-allowing-date-step.js +61 -0
- package/objects/auth/entities/user/password/steps/not-allowing-phone-step.d.ts +7 -0
- package/objects/auth/entities/user/password/steps/not-allowing-phone-step.js +27 -0
- package/objects/auth/entities/user/password/steps/not-allowing-repeated-chars-step.d.ts +11 -0
- package/objects/auth/entities/user/password/steps/not-allowing-repeated-chars-step.js +34 -0
- package/objects/auth/entities/user/password/steps/not-allowing-string-step.d.ts +7 -0
- package/objects/auth/entities/user/password/steps/not-allowing-string-step.js +19 -0
- package/objects/auth/entities/user/password/steps/not-allowing-these-chars-step.d.ts +10 -0
- package/objects/auth/entities/user/password/steps/not-allowing-these-chars-step.js +17 -0
- package/objects/auth/entities/user/password/steps/numeric-step.d.ts +5 -0
- package/objects/auth/entities/user/password/steps/numeric-step.js +13 -0
- package/objects/auth/entities/user/password/steps/with-at-least-one-letter-step.d.ts +5 -0
- package/objects/auth/entities/user/password/steps/with-at-least-one-letter-step.js +14 -0
- package/objects/auth/entities/user/password/steps/with-at-least-one-number-digit-step.d.ts +5 -0
- package/objects/auth/entities/user/password/steps/with-at-least-one-number-digit-step.js +14 -0
- package/objects/auth/entities/user/password/steps/with-at-least-one-special-char-step.d.ts +5 -0
- package/objects/auth/entities/user/password/steps/with-at-least-one-special-char-step.js +14 -0
- package/objects/auth/entities/user/password/steps/with-length-step.d.ts +11 -0
- package/objects/auth/entities/user/password/steps/with-length-step.js +18 -0
- package/objects/auth/entities/user/password/validation-step.d.ts +5 -0
- package/objects/auth/entities/user/password/validation-step.js +9 -0
- package/objects/auth/entities/user/password/validation-step.type.d.ts +4 -0
- package/objects/auth/entities/user/password/validation-step.type.js +2 -0
- package/objects/auth/entities/user/user-credentials.abstract.d.ts +9 -0
- package/objects/auth/entities/user/user-credentials.abstract.js +6 -0
- package/objects/auth/entities/user/user-tokens.abstract.d.ts +13 -0
- package/objects/auth/entities/user/user-tokens.abstract.js +27 -0
- package/objects/auth/entities/user/user-tokens.abstract.type.d.ts +5 -0
- package/objects/auth/entities/user/user-tokens.abstract.type.js +2 -0
- package/objects/auth/entities/user/user.abstract.d.ts +21 -0
- package/objects/auth/entities/user/user.abstract.js +29 -0
- package/objects/auth/entities/user/value-objects/email.d.ts +6 -0
- package/objects/auth/entities/user/value-objects/email.js +17 -0
- package/objects/auth/entities/user/value-objects/person-name.d.ts +7 -0
- package/objects/auth/entities/user/value-objects/person-name.js +17 -0
- package/objects/auth/entities/user/value-objects/user-id.d.ts +3 -0
- package/objects/auth/entities/user/value-objects/user-id.js +7 -0
- package/objects/auth/entities/user/value-objects/username.d.ts +3 -0
- package/objects/auth/entities/user/value-objects/username.js +7 -0
- package/objects/auth/enums/client.enum.d.ts +3 -0
- package/objects/auth/enums/client.enum.js +7 -0
- package/objects/auth/enums/realm.enum.d.ts +3 -0
- package/objects/auth/enums/realm.enum.js +7 -0
- package/objects/auth/enums/role-group.enum.d.ts +4 -0
- package/objects/auth/enums/role-group.enum.js +8 -0
- package/objects/auth/enums/role.enum.d.ts +17 -0
- package/objects/auth/enums/role.enum.js +21 -0
- package/objects/auth/enums/token-name-header.enum.d.ts +4 -0
- package/objects/auth/enums/token-name-header.enum.js +8 -0
- package/objects/configs/enums/node-envs.enum.d.ts +6 -0
- package/objects/configs/enums/node-envs.enum.js +10 -0
- package/objects/datatypes/entities/$boolean.abstract.d.ts +7 -0
- package/objects/datatypes/entities/$boolean.abstract.js +21 -0
- package/objects/datatypes/entities/$number.abstract.d.ts +13 -0
- package/objects/datatypes/entities/$number.abstract.js +60 -0
- package/objects/datatypes/entities/$string.abstract.d.ts +10 -0
- package/objects/datatypes/entities/$string.abstract.js +34 -0
- package/objects/datatypes/entities/uuid.abstract.d.ts +7 -0
- package/objects/datatypes/entities/uuid.abstract.js +20 -0
- package/package.json +66 -0
- package/tests/builders/auth/access-token-signature.builder.d.ts +6 -0
- package/tests/builders/auth/access-token-signature.builder.js +19 -0
- package/tests/builders/auth/access-token.builder.d.ts +6 -0
- package/tests/builders/auth/access-token.builder.js +15 -0
- package/tests/builders/auth/rotation.builder.d.ts +6 -0
- package/tests/builders/auth/rotation.builder.js +19 -0
- package/tests/builders/auth/token.builder.d.ts +7 -0
- package/tests/builders/auth/token.builder.js +15 -0
- package/tests/builders/auth/value-objects/client-credentials.builder.d.ts +6 -0
- package/tests/builders/auth/value-objects/client-credentials.builder.js +18 -0
- package/tests/builders/auth/value-objects/dummies/access-token.dummy.d.ts +3 -0
- package/tests/builders/auth/value-objects/dummies/access-token.dummy.js +7 -0
- package/tests/builders/auth/value-objects/dummies/client-credentials.dummy.d.ts +3 -0
- package/tests/builders/auth/value-objects/dummies/client-credentials.dummy.js +7 -0
- package/tests/builders/auth/value-objects/dummies/realm-credentials.dummy.d.ts +6 -0
- package/tests/builders/auth/value-objects/dummies/realm-credentials.dummy.js +12 -0
- package/tests/builders/auth/value-objects/dummies/user-tokens.dummy.d.ts +3 -0
- package/tests/builders/auth/value-objects/dummies/user-tokens.dummy.js +7 -0
- package/tests/builders/auth/value-objects/realm-credentials.builder.d.ts +6 -0
- package/tests/builders/auth/value-objects/realm-credentials.builder.js +17 -0
- package/tests/builders/auth/value-objects/user-tokens.builder.d.ts +7 -0
- package/tests/builders/auth/value-objects/user-tokens.builder.js +18 -0
- package/tests/builders/errors/application-error.builder.d.ts +6 -0
- package/tests/builders/errors/application-error.builder.js +21 -0
- package/tests/builders/errors/dummies/application-error.dummy.d.ts +3 -0
- package/tests/builders/errors/dummies/application-error.dummy.js +7 -0
- package/tests/builders/generic/dummies/uuid.dummy.d.ts +3 -0
- package/tests/builders/generic/dummies/uuid.dummy.js +7 -0
- package/tests/builders/generic/uuid.builder.d.ts +6 -0
- package/tests/builders/generic/uuid.builder.js +14 -0
- package/tests/builders/user/user-id.builder.d.ts +6 -0
- package/tests/builders/user/user-id.builder.js +15 -0
- package/tests/create-fake-stub.d.ts +8 -0
- package/tests/create-fake-stub.js +37 -0
- package/tests/entity-builder.util.d.ts +13 -0
- package/tests/entity-builder.util.js +39 -0
- package/tests/faker/faker.d.ts +2 -0
- package/tests/faker/faker.js +6 -0
- package/utils/arrays/extended-map.d.ts +5 -0
- package/utils/arrays/extended-map.js +23 -0
- package/utils/datatypes/generic-types.d.ts +7 -0
- package/utils/datatypes/generic-types.js +3 -0
- package/utils/datatypes/string-utils.d.ts +3 -0
- package/utils/datatypes/string-utils.js +4 -0
- package/utils/ducts/common.d.ts +9 -0
- package/utils/ducts/common.js +14 -0
- package/utils/ducts/optional-type.d.ts +25 -0
- package/utils/ducts/optional-type.js +50 -0
- package/utils/ducts/return-type.d.ts +22 -0
- package/utils/ducts/return-type.js +60 -0
- package/utils/randoms/random-enum-value.d.ts +2 -0
- package/utils/randoms/random-enum-value.js +20 -0
- package/utils/randoms/random-number.d.ts +6 -0
- package/utils/randoms/random-number.js +6 -0
- package/utils/type-guard/guardian-exception.d.ts +2 -0
- package/utils/type-guard/guardian-exception.js +6 -0
- package/utils/type-guard/guardian.d.ts +29 -0
- package/utils/type-guard/guardian.js +132 -0
- package/utils/type-guard/guardian.type.d.ts +1 -0
- package/utils/type-guard/guardian.type.js +2 -0
|
@@ -0,0 +1,17 @@
|
|
|
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;
|
|
@@ -0,0 +1,13 @@
|
|
|
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;
|
|
@@ -0,0 +1,14 @@
|
|
|
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;
|
|
@@ -0,0 +1,14 @@
|
|
|
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;
|
|
@@ -0,0 +1,14 @@
|
|
|
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;
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PasswordAbstract } from "./password/password.abstract";
|
|
2
|
+
import { Email } from "./value-objects/email";
|
|
3
|
+
import { Username } from "./value-objects/username";
|
|
4
|
+
import { Optional } from "../../../../utils/ducts/optional-type";
|
|
5
|
+
export declare abstract class UserCredentialsAbstract {
|
|
6
|
+
abstract usernameWrapped: Optional<Username>;
|
|
7
|
+
abstract emailWrapped: Optional<Email>;
|
|
8
|
+
abstract passwordWrapped: Optional<PasswordAbstract>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AccessTokenPayload, RefreshTokenPayload } from "../token/access-token.abstract.type";
|
|
2
|
+
import { Token } from "../token/token";
|
|
3
|
+
import { UserTokensPrimitive } from "./user-tokens.abstract.type";
|
|
4
|
+
export declare abstract class UserTokensAbstract {
|
|
5
|
+
protected readonly _accessToken: Token<AccessTokenPayload>;
|
|
6
|
+
protected readonly _refreshToken: Token<RefreshTokenPayload>;
|
|
7
|
+
protected readonly _accessTokenExpirationDate: Date;
|
|
8
|
+
constructor(_accessToken: Token<AccessTokenPayload>, _refreshToken: Token<RefreshTokenPayload>, _accessTokenExpirationDate: Date);
|
|
9
|
+
get accessToken(): Token<AccessTokenPayload>;
|
|
10
|
+
get refreshToken(): Token<RefreshTokenPayload>;
|
|
11
|
+
get accessTokenExpirationDate(): Date;
|
|
12
|
+
toPlain(): UserTokensPrimitive;
|
|
13
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { UserStatusEnum } from "./enums/user-status.enum";
|
|
2
|
+
import { UserCredentialsAbstract } from "./user-credentials.abstract";
|
|
3
|
+
import { PersonName } from "./value-objects/person-name";
|
|
4
|
+
import { UserId } from "./value-objects/user-id";
|
|
5
|
+
import { RoleGroupEnum } from "../../enums/role-group.enum";
|
|
6
|
+
import { RoleEnum } from "../../enums/role.enum";
|
|
7
|
+
import { Optional } from "../../../../utils/ducts/optional-type";
|
|
8
|
+
export declare abstract class UserAbstract {
|
|
9
|
+
protected _id: UserId;
|
|
10
|
+
protected _personName: PersonName;
|
|
11
|
+
protected _status: UserStatusEnum;
|
|
12
|
+
protected _roleGroups: RoleGroupEnum[];
|
|
13
|
+
abstract rolesWrapped: Optional<RoleEnum[]>;
|
|
14
|
+
abstract credentialsWrapped: Optional<UserCredentialsAbstract>;
|
|
15
|
+
constructor(_id: UserId, _personName: PersonName, _status: UserStatusEnum, _roleGroups: RoleGroupEnum[]);
|
|
16
|
+
get id(): UserId;
|
|
17
|
+
get status(): UserStatusEnum;
|
|
18
|
+
get roleGroups(): RoleGroupEnum[];
|
|
19
|
+
get personName(): PersonName;
|
|
20
|
+
isActive(): boolean;
|
|
21
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserAbstract = void 0;
|
|
4
|
+
const user_status_enum_1 = require("./enums/user-status.enum");
|
|
5
|
+
const guardian_1 = require("../../../../utils/type-guard/guardian");
|
|
6
|
+
class UserAbstract {
|
|
7
|
+
constructor(_id, _personName, _status, _roleGroups) {
|
|
8
|
+
this._id = _id;
|
|
9
|
+
this._personName = _personName;
|
|
10
|
+
this._status = _status;
|
|
11
|
+
this._roleGroups = _roleGroups;
|
|
12
|
+
}
|
|
13
|
+
get id() {
|
|
14
|
+
return this._id;
|
|
15
|
+
}
|
|
16
|
+
get status() {
|
|
17
|
+
return this._status;
|
|
18
|
+
}
|
|
19
|
+
get roleGroups() {
|
|
20
|
+
return this._roleGroups;
|
|
21
|
+
}
|
|
22
|
+
get personName() {
|
|
23
|
+
return this._personName;
|
|
24
|
+
}
|
|
25
|
+
isActive() {
|
|
26
|
+
return guardian_1.Guardian.isEqual(this._status, user_status_enum_1.UserStatusEnum.active);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.UserAbstract = UserAbstract;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Email = void 0;
|
|
4
|
+
const _string_abstract_1 = require("../../../../datatypes/entities/$string.abstract");
|
|
5
|
+
class Email extends _string_abstract_1.$string {
|
|
6
|
+
constructor(email) {
|
|
7
|
+
super(email);
|
|
8
|
+
this.email = email;
|
|
9
|
+
this.validation();
|
|
10
|
+
}
|
|
11
|
+
validation() {
|
|
12
|
+
if (!/^[\w-\\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(this.email)) {
|
|
13
|
+
throw new Error(`${this.constructor.name} should be valid.`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.Email = Email;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PersonName = void 0;
|
|
4
|
+
const _string_abstract_1 = require("../../../../datatypes/entities/$string.abstract");
|
|
5
|
+
class PersonName extends _string_abstract_1.$string {
|
|
6
|
+
constructor(name) {
|
|
7
|
+
super(name);
|
|
8
|
+
this.name = name;
|
|
9
|
+
}
|
|
10
|
+
get firstName() {
|
|
11
|
+
return this.name.split(" ")[0];
|
|
12
|
+
}
|
|
13
|
+
get lastName() {
|
|
14
|
+
return this.name.split(" ").slice(1).join(" ");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.PersonName = PersonName;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserId = void 0;
|
|
4
|
+
const uuid_abstract_1 = require("../../../../datatypes/entities/uuid.abstract");
|
|
5
|
+
class UserId extends uuid_abstract_1.UuidAbstract {
|
|
6
|
+
}
|
|
7
|
+
exports.UserId = UserId;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Username = void 0;
|
|
4
|
+
const _string_abstract_1 = require("../../../../datatypes/entities/$string.abstract");
|
|
5
|
+
class Username extends _string_abstract_1.$string {
|
|
6
|
+
}
|
|
7
|
+
exports.Username = Username;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientEnum = void 0;
|
|
4
|
+
var ClientEnum;
|
|
5
|
+
(function (ClientEnum) {
|
|
6
|
+
ClientEnum["movindentity"] = "movindentity_client";
|
|
7
|
+
})(ClientEnum || (exports.ClientEnum = ClientEnum = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RoleGroupEnum = void 0;
|
|
4
|
+
var RoleGroupEnum;
|
|
5
|
+
(function (RoleGroupEnum) {
|
|
6
|
+
RoleGroupEnum["freeUser"] = "free-user";
|
|
7
|
+
RoleGroupEnum["premiumUser"] = "premium-user";
|
|
8
|
+
})(RoleGroupEnum || (exports.RoleGroupEnum = RoleGroupEnum = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare enum RoleEnum {
|
|
2
|
+
readRecipe = "read-recipe",
|
|
3
|
+
writeRecipe = "write-recipe",
|
|
4
|
+
deleteRecipe = "delete-recipe",
|
|
5
|
+
manageRecipe = "manage-recipe",
|
|
6
|
+
readPremiumRecipe = "read-premium-recipe",
|
|
7
|
+
manageRecipePremium = "manage-recipe-premium",
|
|
8
|
+
readIngredient = "read-ingredient",
|
|
9
|
+
writeIngredient = "write-ingredient",
|
|
10
|
+
deleteIngredient = "delete-ingredient",
|
|
11
|
+
manageIngredient = "manage-ingredient",
|
|
12
|
+
readUtensil = "read-utensil",
|
|
13
|
+
writeUtensil = "write-utensil",
|
|
14
|
+
deleteUtensil = "delete-utensil",
|
|
15
|
+
manageUtensil = "manage-utensil",
|
|
16
|
+
umaAuthorization = "uma_authorization"
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RoleEnum = void 0;
|
|
4
|
+
var RoleEnum;
|
|
5
|
+
(function (RoleEnum) {
|
|
6
|
+
RoleEnum["readRecipe"] = "read-recipe";
|
|
7
|
+
RoleEnum["writeRecipe"] = "write-recipe";
|
|
8
|
+
RoleEnum["deleteRecipe"] = "delete-recipe";
|
|
9
|
+
RoleEnum["manageRecipe"] = "manage-recipe";
|
|
10
|
+
RoleEnum["readPremiumRecipe"] = "read-premium-recipe";
|
|
11
|
+
RoleEnum["manageRecipePremium"] = "manage-recipe-premium";
|
|
12
|
+
RoleEnum["readIngredient"] = "read-ingredient";
|
|
13
|
+
RoleEnum["writeIngredient"] = "write-ingredient";
|
|
14
|
+
RoleEnum["deleteIngredient"] = "delete-ingredient";
|
|
15
|
+
RoleEnum["manageIngredient"] = "manage-ingredient";
|
|
16
|
+
RoleEnum["readUtensil"] = "read-utensil";
|
|
17
|
+
RoleEnum["writeUtensil"] = "write-utensil";
|
|
18
|
+
RoleEnum["deleteUtensil"] = "delete-utensil";
|
|
19
|
+
RoleEnum["manageUtensil"] = "manage-utensil";
|
|
20
|
+
RoleEnum["umaAuthorization"] = "uma_authorization";
|
|
21
|
+
})(RoleEnum || (exports.RoleEnum = RoleEnum = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TokenNameHeaderEnum = void 0;
|
|
4
|
+
var TokenNameHeaderEnum;
|
|
5
|
+
(function (TokenNameHeaderEnum) {
|
|
6
|
+
TokenNameHeaderEnum["authorizationClient"] = "authorization_client";
|
|
7
|
+
TokenNameHeaderEnum["authorizationUser"] = "authorization_user";
|
|
8
|
+
})(TokenNameHeaderEnum || (exports.TokenNameHeaderEnum = TokenNameHeaderEnum = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NodeEnvs = void 0;
|
|
4
|
+
var NodeEnvs;
|
|
5
|
+
(function (NodeEnvs) {
|
|
6
|
+
NodeEnvs["production"] = "production";
|
|
7
|
+
NodeEnvs["homolog"] = "homolog";
|
|
8
|
+
NodeEnvs["development"] = "development";
|
|
9
|
+
NodeEnvs["test"] = "test";
|
|
10
|
+
})(NodeEnvs || (exports.NodeEnvs = NodeEnvs = {}));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.$boolean = void 0;
|
|
4
|
+
class $boolean {
|
|
5
|
+
constructor(value) {
|
|
6
|
+
this.value = value;
|
|
7
|
+
}
|
|
8
|
+
toBoolean() {
|
|
9
|
+
return this.value;
|
|
10
|
+
}
|
|
11
|
+
isEqual(value) {
|
|
12
|
+
if (value instanceof $boolean) {
|
|
13
|
+
return value.toBoolean() === this.value;
|
|
14
|
+
}
|
|
15
|
+
return this.value === value;
|
|
16
|
+
}
|
|
17
|
+
isDifferent(value) {
|
|
18
|
+
return this.value !== value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.$boolean = $boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare abstract class $number {
|
|
2
|
+
private value;
|
|
3
|
+
constructor(value: number);
|
|
4
|
+
toNumber(): number;
|
|
5
|
+
isEqual(value: number | $number): boolean;
|
|
6
|
+
isDifferent(value: number | $number): boolean;
|
|
7
|
+
isBiggerThan(value: number | $number): boolean;
|
|
8
|
+
isSmallerThan(value: number | $number): boolean;
|
|
9
|
+
isEqualOrBiggerThan(value: number | $number): boolean;
|
|
10
|
+
isEqualOrSmallerThan(value: number | $number): boolean;
|
|
11
|
+
isBetween(min: number | $number, max: number | $number): boolean;
|
|
12
|
+
private validate;
|
|
13
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.$number = void 0;
|
|
4
|
+
const guardian_1 = require("../../../utils/type-guard/guardian");
|
|
5
|
+
class $number {
|
|
6
|
+
constructor(value) {
|
|
7
|
+
this.value = value;
|
|
8
|
+
this.validate(value);
|
|
9
|
+
}
|
|
10
|
+
toNumber() {
|
|
11
|
+
return this.value;
|
|
12
|
+
}
|
|
13
|
+
isEqual(value) {
|
|
14
|
+
if (value instanceof $number) {
|
|
15
|
+
return value.toNumber() === this.value;
|
|
16
|
+
}
|
|
17
|
+
return this.value === value;
|
|
18
|
+
}
|
|
19
|
+
isDifferent(value) {
|
|
20
|
+
if (value instanceof $number) {
|
|
21
|
+
return value.toNumber() !== this.value;
|
|
22
|
+
}
|
|
23
|
+
return this.value !== value;
|
|
24
|
+
}
|
|
25
|
+
isBiggerThan(value) {
|
|
26
|
+
if (value instanceof $number) {
|
|
27
|
+
return value.toNumber() > this.value;
|
|
28
|
+
}
|
|
29
|
+
return this.value > value;
|
|
30
|
+
}
|
|
31
|
+
isSmallerThan(value) {
|
|
32
|
+
if (value instanceof $number) {
|
|
33
|
+
return value.toNumber() < this.value;
|
|
34
|
+
}
|
|
35
|
+
return this.value < value;
|
|
36
|
+
}
|
|
37
|
+
isEqualOrBiggerThan(value) {
|
|
38
|
+
if (value instanceof $number) {
|
|
39
|
+
return value.toNumber() >= this.value;
|
|
40
|
+
}
|
|
41
|
+
return this.value >= value;
|
|
42
|
+
}
|
|
43
|
+
isEqualOrSmallerThan(value) {
|
|
44
|
+
if (value instanceof $number) {
|
|
45
|
+
return value.toNumber() <= this.value;
|
|
46
|
+
}
|
|
47
|
+
return this.value <= value;
|
|
48
|
+
}
|
|
49
|
+
isBetween(min, max) {
|
|
50
|
+
const minimus = min instanceof $number ? min.toNumber() : min;
|
|
51
|
+
const maximus = max instanceof $number ? max.toNumber() : max;
|
|
52
|
+
return guardian_1.Guardian.isBetween(this.value, minimus, maximus);
|
|
53
|
+
}
|
|
54
|
+
validate(value) {
|
|
55
|
+
if (Number.isNaN(value)) {
|
|
56
|
+
throw new Error(`${this.constructor.name} should be valid.`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.$number = $number;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare abstract class $string {
|
|
2
|
+
private value;
|
|
3
|
+
constructor(value: string);
|
|
4
|
+
toString(): string;
|
|
5
|
+
has(value: string): boolean;
|
|
6
|
+
extract(start: string, end: string): string;
|
|
7
|
+
remove(substrings: string[]): string;
|
|
8
|
+
private sanitize;
|
|
9
|
+
private validate;
|
|
10
|
+
}
|