@atlantjs/arch 9.1.2 → 10.0.1
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/@tool-box/tests/{entity-builder.util.d.ts → builder.abstract.util.d.ts} +1 -1
- package/@tool-box/tests/{entity-builder.util.js → builder.abstract.util.js} +3 -6
- package/@tool-box/tests/builders/failures/dummies/failure.edge.dummy.d.ts +3 -0
- package/@tool-box/tests/builders/failures/dummies/failure.edge.dummy.js +3 -0
- package/@tool-box/tests/builders/failures/failure.edge.builder.d.ts +6 -0
- package/@tool-box/tests/builders/failures/failure.edge.builder.js +18 -0
- package/@tool-box/tests/builders/user/email.edge.builder.d.ts +6 -0
- package/@tool-box/tests/builders/user/email.edge.builder.js +11 -0
- package/@tool-box/tests/builders/user/person-name.edge.builder.d.ts +6 -0
- package/@tool-box/tests/builders/user/person-name.edge.builder.js +11 -0
- package/@tool-box/tests/builders/user/username.edge.builder.d.ts +6 -0
- package/@tool-box/tests/builders/user/username.edge.builder.js +11 -0
- package/@tool-box/tests/create-fake-command.d.ts +9 -0
- package/@tool-box/tests/create-fake-command.js +23 -0
- package/@tool-box/tests/faker/faker.js +7 -10
- package/@tool-box/utils/datatypes/boolean-utils.d.ts +1 -0
- package/@tool-box/utils/datatypes/boolean-utils.js +5 -2
- package/@tool-box/utils/datatypes/generic-types.d.ts +1 -1
- package/@tool-box/utils/datatypes/generic-types.js +1 -2
- package/@tool-box/utils/datatypes/string-utils.d.ts +1 -3
- package/@tool-box/utils/datatypes/string-utils.js +1 -10
- package/@tool-box/utils/ducts/common.js +7 -11
- package/@tool-box/utils/ducts/optional-type.d.ts +0 -1
- package/@tool-box/utils/ducts/optional-type.js +19 -22
- package/@tool-box/utils/ducts/return-type.d.ts +2 -2
- package/@tool-box/utils/ducts/return-type.js +21 -26
- package/@tool-box/utils/{arrays/extended-map.d.ts → map/map.abstract.d.ts} +1 -2
- package/@tool-box/utils/map/map.abstract.js +13 -0
- package/@tool-box/utils/random/random.d.ts +5 -0
- package/@tool-box/utils/{randoms/random-value.js → random/random.js} +4 -8
- package/@tool-box/utils/type-guard/guardian-exception.js +1 -5
- package/@tool-box/utils/type-guard/guardian.d.ts +11 -13
- package/@tool-box/utils/type-guard/guardian.js +19 -51
- package/@tool-box/utils/type-guard/guardian.type.js +1 -2
- package/README.md +0 -8
- package/index.d.ts +28 -37
- package/index.js +30 -81
- package/objects/@common/edges/email.edge.d.ts +6 -0
- package/{arch/modules/domain/entities/user/value-objects/email.js → objects/@common/edges/email.edge.js} +3 -6
- package/objects/@common/edges/person-name.edge.d.ts +7 -0
- package/objects/@common/edges/person-name.edge.js +14 -0
- package/objects/@common/edges/url.edge.d.ts +6 -0
- package/objects/@common/edges/url.edge.js +17 -0
- package/objects/@common/edges/username.edge.d.ts +3 -0
- package/objects/@common/edges/username.edge.js +3 -0
- package/{arch/modules/domain/entities/uuid.abstract.d.ts → objects/@common/edges/uuid.sketch.edge.d.ts} +2 -2
- package/objects/@common/edges/uuid.sketch.edge.js +18 -0
- package/{arch/modules/domain/enums → objects/@common/points}/header-token-name.enum.js +2 -5
- package/{arch/modules/domain/enums → objects/@common/points}/http-status-codes.enum.js +2 -5
- package/{arch/modules/domain/enums → objects/@common/points}/node-envs.enum.js +2 -5
- package/objects/datetime/edges/datetime.edge.d.ts +27 -0
- package/objects/datetime/edges/datetime.edge.js +133 -0
- package/objects/datetime/points/month-name.enum.d.ts +14 -0
- package/objects/datetime/points/month-name.enum.js +15 -0
- package/objects/datetime/points/week-day.enum.d.ts +9 -0
- package/objects/datetime/points/week-day.enum.js +10 -0
- package/objects/failure/edges/failure.sketch.edge.d.ts +8 -0
- package/objects/failure/edges/failure.sketch.edge.js +23 -0
- package/objects/failure/edges/failure.sketch.polygon.d.ts +9 -0
- package/objects/failure/edges/failure.sketch.polygon.js +1 -0
- package/objects/password/password.edge.d.ts +8 -0
- package/objects/password/password.edge.js +38 -0
- package/{arch/modules/domain/entities/user/password/password.abstract.type.d.ts → objects/password/password.polygon.d.ts} +1 -1
- package/objects/password/password.polygon.js +1 -0
- package/{arch/modules/domain/entities/user → objects}/password/steps/not-allowing-consecutive-chars-step.js +3 -6
- package/{arch/modules/domain/entities/user → objects}/password/steps/not-allowing-date-step.js +3 -6
- package/{arch/modules/domain/entities/user → objects}/password/steps/not-allowing-phone-step.js +3 -6
- package/{arch/modules/domain/entities/user → objects}/password/steps/not-allowing-repeated-chars-step.js +3 -6
- package/{arch/modules/domain/entities/user → objects}/password/steps/not-allowing-string-step.js +3 -6
- package/objects/password/steps/not-allowing-these-chars-step.js +14 -0
- package/objects/password/steps/numeric-step.js +9 -0
- package/objects/password/steps/with-at-least-one-letter-step.js +10 -0
- package/objects/password/steps/with-at-least-one-number-digit-step.js +10 -0
- package/objects/password/steps/with-at-least-one-special-char-step.js +10 -0
- package/{arch/modules/domain/entities/user → objects}/password/steps/with-length-step.js +3 -6
- package/objects/password/validation-step.js +5 -0
- package/objects/password/validation-step.type.js +1 -0
- package/objects/primitives/boolean.edge.sketch.d.ts +7 -0
- package/objects/primitives/boolean.edge.sketch.js +18 -0
- package/objects/primitives/datetime.edge.sketch.d.ts +3 -0
- package/objects/primitives/datetime.edge.sketch.js +3 -0
- package/objects/primitives/number.edge.sketch.d.ts +13 -0
- package/{arch/modules/domain/entities/$number.abstract.js → objects/primitives/number.edge.sketch.js} +12 -15
- package/{arch/modules/domain/entities/$string.abstract.d.ts → objects/primitives/string.edge.sketch.d.ts} +1 -1
- package/{arch/modules/domain/entities/$string.abstract.js → objects/primitives/string.edge.sketch.js} +2 -5
- package/package.json +6 -11
- package/tsconfig.tsbuildinfo +1 -1
- package/@tool-box/tests/builders/failures/dummies/failure.dummy.d.ts +0 -3
- package/@tool-box/tests/builders/failures/dummies/failure.dummy.js +0 -7
- package/@tool-box/tests/builders/failures/failure.builder.d.ts +0 -6
- package/@tool-box/tests/builders/failures/failure.builder.js +0 -21
- package/@tool-box/tests/builders/generic/dummies/uuid.dummy.d.ts +0 -3
- package/@tool-box/tests/builders/generic/dummies/uuid.dummy.js +0 -7
- package/@tool-box/tests/builders/generic/uuid.builder.d.ts +0 -6
- package/@tool-box/tests/builders/generic/uuid.builder.js +0 -14
- package/@tool-box/tests/builders/user/email.builder.d.ts +0 -6
- package/@tool-box/tests/builders/user/email.builder.js +0 -15
- package/@tool-box/tests/builders/user/person-name.builder.d.ts +0 -6
- package/@tool-box/tests/builders/user/person-name.builder.js +0 -15
- package/@tool-box/tests/builders/user/user-id.builder.d.ts +0 -6
- package/@tool-box/tests/builders/user/user-id.builder.js +0 -14
- package/@tool-box/tests/builders/user/username.builder.d.ts +0 -6
- package/@tool-box/tests/builders/user/username.builder.js +0 -15
- package/@tool-box/tests/create-fake-usecase.d.ts +0 -9
- package/@tool-box/tests/create-fake-usecase.js +0 -26
- package/@tool-box/utils/arrays/extended-map.js +0 -22
- package/@tool-box/utils/http-client/http-client-exception.d.ts +0 -3
- package/@tool-box/utils/http-client/http-client-exception.js +0 -12
- package/@tool-box/utils/http-client/http-client-request.d.ts +0 -9
- package/@tool-box/utils/http-client/http-client-request.js +0 -2
- package/@tool-box/utils/http-client/http-client-response.d.ts +0 -18
- package/@tool-box/utils/http-client/http-client-response.get-header.failure.d.ts +0 -4
- package/@tool-box/utils/http-client/http-client-response.get-header.failure.js +0 -14
- package/@tool-box/utils/http-client/http-client-response.js +0 -39
- package/@tool-box/utils/http-client/http-client.d.ts +0 -9
- package/@tool-box/utils/http-client/http-client.js +0 -21
- package/@tool-box/utils/randoms/random-value.d.ts +0 -5
- package/arch/@atlantjs.json +0 -3
- package/arch/biome.json +0 -47
- package/arch/modules/application/failures/failure.abstract.d.ts +0 -9
- package/arch/modules/application/failures/failure.abstract.js +0 -24
- package/arch/modules/application/failures/failure.abstract.type.d.ts +0 -9
- package/arch/modules/application/failures/failure.abstract.type.js +0 -2
- package/arch/modules/application/failures/unknown-failure.d.ts +0 -15
- package/arch/modules/application/failures/unknown-failure.js +0 -16
- package/arch/modules/domain/entities/$array.abstract.d.ts +0 -2
- package/arch/modules/domain/entities/$array.abstract.js +0 -6
- package/arch/modules/domain/entities/$boolean.abstract.d.ts +0 -7
- package/arch/modules/domain/entities/$boolean.abstract.js +0 -21
- package/arch/modules/domain/entities/$date.abstract.d.ts +0 -2
- package/arch/modules/domain/entities/$date.abstract.js +0 -6
- package/arch/modules/domain/entities/$number.abstract.d.ts +0 -13
- package/arch/modules/domain/entities/$object.abstract.d.ts +0 -2
- package/arch/modules/domain/entities/$object.abstract.js +0 -6
- package/arch/modules/domain/entities/entity-frontend.abstract.d.ts +0 -6
- package/arch/modules/domain/entities/entity-frontend.abstract.js +0 -11
- package/arch/modules/domain/entities/solid.abstract.d.ts +0 -4
- package/arch/modules/domain/entities/solid.abstract.js +0 -6
- package/arch/modules/domain/entities/url.abstract.d.ts +0 -3
- package/arch/modules/domain/entities/url.abstract.js +0 -7
- package/arch/modules/domain/entities/user/password/password.abstract.d.ts +0 -8
- package/arch/modules/domain/entities/user/password/password.abstract.js +0 -41
- package/arch/modules/domain/entities/user/password/password.abstract.type.js +0 -2
- package/arch/modules/domain/entities/user/password/steps/not-allowing-these-chars-step.js +0 -17
- package/arch/modules/domain/entities/user/password/steps/numeric-step.js +0 -13
- package/arch/modules/domain/entities/user/password/steps/with-at-least-one-letter-step.js +0 -14
- package/arch/modules/domain/entities/user/password/steps/with-at-least-one-number-digit-step.js +0 -14
- package/arch/modules/domain/entities/user/password/steps/with-at-least-one-special-char-step.js +0 -14
- package/arch/modules/domain/entities/user/password/validation-step.js +0 -9
- package/arch/modules/domain/entities/user/password/validation-step.type.js +0 -2
- package/arch/modules/domain/entities/user/value-objects/email.d.ts +0 -6
- package/arch/modules/domain/entities/user/value-objects/person-name.d.ts +0 -7
- package/arch/modules/domain/entities/user/value-objects/person-name.js +0 -17
- package/arch/modules/domain/entities/user/value-objects/user-id.d.ts +0 -3
- package/arch/modules/domain/entities/user/value-objects/user-id.js +0 -7
- package/arch/modules/domain/entities/user/value-objects/username.d.ts +0 -3
- package/arch/modules/domain/entities/user/value-objects/username.js +0 -7
- package/arch/modules/domain/entities/uuid.abstract.js +0 -23
- package/arch/modules/domain/entities/value-object.abstract.d.ts +0 -3
- package/arch/modules/domain/entities/value-object.abstract.js +0 -7
- package/arch/modules/infrastructure/services/http-client.abstract.d.ts +0 -0
- package/arch/modules/infrastructure/services/http-client.abstract.js +0 -1
- package/arch/modules/infrastructure/services/payloads/service.payload.abstract.d.ts +0 -0
- package/arch/modules/infrastructure/services/payloads/service.payload.abstract.js +0 -1
- package/arch/modules/infrastructure/services/responses/service.response.abstract.d.ts +0 -0
- package/arch/modules/infrastructure/services/responses/service.response.abstract.js +0 -1
- package/arch/tsconfig-backend.json +0 -3
- package/arch/tsconfig-default.json +0 -45
- package/arch/tsconfig-frontend.json +0 -3
- package/arch/tsconfig-lib.json +0 -6
- package/arch/tsconfig-mobile.json +0 -3
- /package/{arch/modules/domain/enums → objects/@common/points}/header-token-name.enum.d.ts +0 -0
- /package/{arch/modules/domain/enums → objects/@common/points}/http-status-codes.enum.d.ts +0 -0
- /package/{arch/modules/domain/enums → objects/@common/points}/node-envs.enum.d.ts +0 -0
- /package/{arch/modules/domain/entities/user → objects}/password/steps/not-allowing-consecutive-chars-step.d.ts +0 -0
- /package/{arch/modules/domain/entities/user → objects}/password/steps/not-allowing-date-step.d.ts +0 -0
- /package/{arch/modules/domain/entities/user → objects}/password/steps/not-allowing-phone-step.d.ts +0 -0
- /package/{arch/modules/domain/entities/user → objects}/password/steps/not-allowing-repeated-chars-step.d.ts +0 -0
- /package/{arch/modules/domain/entities/user → objects}/password/steps/not-allowing-string-step.d.ts +0 -0
- /package/{arch/modules/domain/entities/user → objects}/password/steps/not-allowing-these-chars-step.d.ts +0 -0
- /package/{arch/modules/domain/entities/user → objects}/password/steps/numeric-step.d.ts +0 -0
- /package/{arch/modules/domain/entities/user → objects}/password/steps/with-at-least-one-letter-step.d.ts +0 -0
- /package/{arch/modules/domain/entities/user → objects}/password/steps/with-at-least-one-number-digit-step.d.ts +0 -0
- /package/{arch/modules/domain/entities/user → objects}/password/steps/with-at-least-one-special-char-step.d.ts +0 -0
- /package/{arch/modules/domain/entities/user → objects}/password/steps/with-length-step.d.ts +0 -0
- /package/{arch/modules/domain/entities/user → objects}/password/validation-step.d.ts +0 -0
- /package/{arch/modules/domain/entities/user → objects}/password/validation-step.type.d.ts +0 -0
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Guardian = void 0;
|
|
4
|
-
const guardian_exception_1 = require("./guardian-exception");
|
|
1
|
+
import { GuardianException } from "./guardian-exception";
|
|
5
2
|
class Guardian {
|
|
6
3
|
static and(...args) {
|
|
7
4
|
return args.every((func) => func);
|
|
@@ -15,24 +12,30 @@ class Guardian {
|
|
|
15
12
|
static lessThan(value, reference) {
|
|
16
13
|
return value < reference;
|
|
17
14
|
}
|
|
18
|
-
static
|
|
19
|
-
if (Guardian.
|
|
20
|
-
throw new
|
|
15
|
+
static isEmptyArray(value) {
|
|
16
|
+
if (Guardian.isArray(value).falsy()) {
|
|
17
|
+
throw new GuardianException("The value is not an array");
|
|
21
18
|
}
|
|
22
19
|
if (Guardian.isNullOrUndefined(value)) {
|
|
23
20
|
return true;
|
|
24
21
|
}
|
|
25
22
|
return value.length === 0;
|
|
26
23
|
}
|
|
27
|
-
static
|
|
24
|
+
static isFilledArray(value) {
|
|
28
25
|
if (Guardian.isNullOrUndefined(value)) {
|
|
29
26
|
return false;
|
|
30
27
|
}
|
|
31
|
-
if (Guardian.
|
|
32
|
-
throw new
|
|
28
|
+
if (Guardian.isArray(value).falsy()) {
|
|
29
|
+
throw new GuardianException("The value is not an array");
|
|
33
30
|
}
|
|
34
31
|
return value.length !== 0;
|
|
35
32
|
}
|
|
33
|
+
static isLengthArray(value, reference) {
|
|
34
|
+
if (Guardian.isArray(value).falsy()) {
|
|
35
|
+
throw new GuardianException("The value is not an array");
|
|
36
|
+
}
|
|
37
|
+
return value?.length === reference;
|
|
38
|
+
}
|
|
36
39
|
static isEmpty(value) {
|
|
37
40
|
if (Guardian.isNullOrUndefined(value)) {
|
|
38
41
|
return true;
|
|
@@ -45,19 +48,6 @@ class Guardian {
|
|
|
45
48
|
}
|
|
46
49
|
return false;
|
|
47
50
|
}
|
|
48
|
-
static isNotEmpty(value) {
|
|
49
|
-
if (Guardian.isNullOrUndefined(value)) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
if ((Guardian.isString(value) || Guardian.isArray(value)) &&
|
|
53
|
-
value.length === 0) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
if (Guardian.isObject(value) && Object.keys(value).length === 0) {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
51
|
static isUndefined(value) {
|
|
62
52
|
return value === undefined;
|
|
63
53
|
}
|
|
@@ -73,6 +63,9 @@ class Guardian {
|
|
|
73
63
|
static isEqual(valueA, valueB) {
|
|
74
64
|
return valueA === valueB;
|
|
75
65
|
}
|
|
66
|
+
static isDifferent(valueA, valueB) {
|
|
67
|
+
return valueA !== valueB;
|
|
68
|
+
}
|
|
76
69
|
static isAnyOf(reference, anyValues) {
|
|
77
70
|
for (const value of anyValues) {
|
|
78
71
|
if (Guardian.isEqual(reference, value)) {
|
|
@@ -81,43 +74,18 @@ class Guardian {
|
|
|
81
74
|
}
|
|
82
75
|
return false;
|
|
83
76
|
}
|
|
84
|
-
static isDifferent(valueA, valueB) {
|
|
85
|
-
return valueA !== valueB;
|
|
86
|
-
}
|
|
87
|
-
static isTruthy(value) {
|
|
88
|
-
return value;
|
|
89
|
-
}
|
|
90
|
-
static isFalsy(value) {
|
|
91
|
-
return value === false;
|
|
92
|
-
}
|
|
93
77
|
static ternaryCondition(condition, returnIfTrue, returnIfFalse) {
|
|
94
78
|
return condition ? returnIfTrue : returnIfFalse;
|
|
95
79
|
}
|
|
96
80
|
static isBetween(value, min, max) {
|
|
97
81
|
if (min > max)
|
|
98
|
-
throw new
|
|
82
|
+
throw new GuardianException(`Max ${max} should be greater than min ${min}.`);
|
|
99
83
|
if (Guardian.isEmpty(value)) {
|
|
100
|
-
throw new
|
|
84
|
+
throw new GuardianException("Cannot check length of a value. Provided value is empty");
|
|
101
85
|
}
|
|
102
86
|
const valueLength = Guardian.isNumber(value) ? value : Number(value);
|
|
103
87
|
return valueLength >= min && valueLength <= max;
|
|
104
88
|
}
|
|
105
|
-
static isLengthEqual(value, length) {
|
|
106
|
-
if (Guardian.isEmpty(value)) {
|
|
107
|
-
throw new guardian_exception_1.GuardianException("Cannot check length of a value. Provided value is empty");
|
|
108
|
-
}
|
|
109
|
-
let valueLength;
|
|
110
|
-
if (Guardian.isNumber(value)) {
|
|
111
|
-
valueLength = length;
|
|
112
|
-
}
|
|
113
|
-
else if (Guardian.isString(value) || Guardian.isArray(value)) {
|
|
114
|
-
valueLength = value.length;
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
throw new guardian_exception_1.GuardianException("Unsupported value type");
|
|
118
|
-
}
|
|
119
|
-
return valueLength === length;
|
|
120
|
-
}
|
|
121
89
|
static isNullOrUndefined(value) {
|
|
122
90
|
if (value === null || value === undefined)
|
|
123
91
|
return true;
|
|
@@ -147,4 +115,4 @@ class Guardian {
|
|
|
147
115
|
return Guardian.isDifferent(typeof value, type);
|
|
148
116
|
}
|
|
149
117
|
}
|
|
150
|
-
|
|
118
|
+
export { Guardian as _ };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/README.md
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,40 +1,31 @@
|
|
|
1
1
|
import "./@tool-box/utils/datatypes/string-utils";
|
|
2
2
|
import "./@tool-box/utils/datatypes/boolean-utils";
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
export {
|
|
29
|
-
export {
|
|
30
|
-
export {
|
|
31
|
-
export { $boolean } from "./arch/modules/domain/entities/$boolean.abstract";
|
|
32
|
-
export { $date } from "./arch/modules/domain/entities/$date.abstract";
|
|
33
|
-
export { $number } from "./arch/modules/domain/entities/$number.abstract";
|
|
34
|
-
export { $object } from "./arch/modules/domain/entities/$object.abstract";
|
|
35
|
-
export { $string } from "./arch/modules/domain/entities/$string.abstract";
|
|
36
|
-
export { UuidAbstract } from "./arch/modules/domain/entities/uuid.abstract";
|
|
37
|
-
export { Url } from "./arch/modules/domain/entities/url.abstract";
|
|
38
|
-
export { HttpStatusCodes } from "./arch/modules/domain/enums/http-status-codes.enum";
|
|
39
|
-
export { NodeEnvs } from "./arch/modules/domain/enums/node-envs.enum";
|
|
3
|
+
export { StringEdgeSketch } from "./objects/primitives/string.edge.sketch";
|
|
4
|
+
export { NumberEdgeSketch } from "./objects/primitives/number.edge.sketch";
|
|
5
|
+
export { DatetimeEdgeSketch } from "./objects/primitives/datetime.edge.sketch";
|
|
6
|
+
export { BooleanEdgeSketch } from "./objects/primitives/boolean.edge.sketch";
|
|
7
|
+
export { PasswordEdge } from "./objects/password/password.edge";
|
|
8
|
+
export { FailureSketchEdge } from "./objects/failure/edges/failure.sketch.edge";
|
|
9
|
+
export { DatetimeEdge } from "./objects/datetime/edges/datetime.edge";
|
|
10
|
+
export { MonthNameEnum } from "./objects/datetime/points/month-name.enum";
|
|
11
|
+
export { WeekDayEnum } from "./objects/datetime/points/week-day.enum";
|
|
12
|
+
export { HeaderTokenNameEnum } from "./objects/@common/points/header-token-name.enum";
|
|
13
|
+
export { HttpStatusCodes } from "./objects/@common/points/http-status-codes.enum";
|
|
14
|
+
export { NodeEnvs } from "./objects/@common/points/node-envs.enum";
|
|
15
|
+
export { EmailEdge } from "./objects/@common/edges/email.edge";
|
|
16
|
+
export { PersonNameEdge } from "./objects/@common/edges/person-name.edge";
|
|
17
|
+
export { UrlEdge } from "./objects/@common/edges/url.edge";
|
|
18
|
+
export { UsernameEdge } from "./objects/@common/edges/username.edge";
|
|
19
|
+
export { UuidSketchEdge } from "./objects/@common/edges/uuid.sketch.edge";
|
|
20
|
+
export { _ } from "./@tool-box/utils/type-guard/guardian";
|
|
21
|
+
export { Random } from "./@tool-box/utils/random/random";
|
|
22
|
+
export { Nothing, Optional } from "./@tool-box/utils/ducts/optional-type";
|
|
23
|
+
export { Newable, ObjectType, Sketch } from "./@tool-box/utils/datatypes/generic-types";
|
|
24
|
+
export { MapAbstract } from "./@tool-box/utils/map/map.abstract";
|
|
25
|
+
export { BuilderAbstract } from "./@tool-box/tests/builder.abstract.util";
|
|
26
|
+
export { FailureEdgeBuilder } from "./@tool-box/tests/builders/failures/failure.edge.builder";
|
|
27
|
+
export { EmailEdgeBuilder } from "./@tool-box/tests/builders/user/email.edge.builder";
|
|
28
|
+
export { PersonNameEdgeBuilder } from "./@tool-box/tests/builders/user/person-name.edge.builder";
|
|
29
|
+
export { UsernameEdgeBuilder } from "./@tool-box/tests/builders/user/username.edge.builder";
|
|
30
|
+
export { CreateFakeCommand } from "./@tool-box/tests/create-fake-command";
|
|
40
31
|
export { faker } from "./@tool-box/tests/faker/faker";
|
package/index.js
CHANGED
|
@@ -1,81 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
Object.defineProperty(exports, "ValueObjectAbstract", { enumerable: true, get: function () { return value_object_abstract_1.ValueObjectAbstract; } });
|
|
32
|
-
var failure_builder_1 = require("./@tool-box/tests/builders/failures/failure.builder");
|
|
33
|
-
Object.defineProperty(exports, "FailureBuilder", { enumerable: true, get: function () { return failure_builder_1.FailureBuilder; } });
|
|
34
|
-
var uuid_builder_1 = require("./@tool-box/tests/builders/generic/uuid.builder");
|
|
35
|
-
Object.defineProperty(exports, "UuidBuilder", { enumerable: true, get: function () { return uuid_builder_1.UuidBuilder; } });
|
|
36
|
-
var create_fake_usecase_1 = require("./@tool-box/tests/create-fake-usecase");
|
|
37
|
-
Object.defineProperty(exports, "CreateFakeUsecase", { enumerable: true, get: function () { return create_fake_usecase_1.CreateFakeUsecase; } });
|
|
38
|
-
var entity_builder_util_1 = require("./@tool-box/tests/entity-builder.util");
|
|
39
|
-
Object.defineProperty(exports, "EntityBuilder", { enumerable: true, get: function () { return entity_builder_util_1.EntityBuilder; } });
|
|
40
|
-
var extended_map_1 = require("./@tool-box/utils/arrays/extended-map");
|
|
41
|
-
Object.defineProperty(exports, "ExtendedMap", { enumerable: true, get: function () { return extended_map_1.ExtendedMap; } });
|
|
42
|
-
var optional_type_1 = require("./@tool-box/utils/ducts/optional-type");
|
|
43
|
-
Object.defineProperty(exports, "Something", { enumerable: true, get: function () { return optional_type_1.Something; } });
|
|
44
|
-
Object.defineProperty(exports, "Nothing", { enumerable: true, get: function () { return optional_type_1.Nothing; } });
|
|
45
|
-
Object.defineProperty(exports, "Optional", { enumerable: true, get: function () { return optional_type_1.Optional; } });
|
|
46
|
-
var return_type_1 = require("./@tool-box/utils/ducts/return-type");
|
|
47
|
-
Object.defineProperty(exports, "Success", { enumerable: true, get: function () { return return_type_1.Success; } });
|
|
48
|
-
Object.defineProperty(exports, "Failure", { enumerable: true, get: function () { return return_type_1.Failure; } });
|
|
49
|
-
Object.defineProperty(exports, "Return", { enumerable: true, get: function () { return return_type_1.Return; } });
|
|
50
|
-
var http_client_1 = require("./@tool-box/utils/http-client/http-client");
|
|
51
|
-
Object.defineProperty(exports, "HttpClient", { enumerable: true, get: function () { return http_client_1.HttpClient; } });
|
|
52
|
-
var random_value_1 = require("./@tool-box/utils/randoms/random-value");
|
|
53
|
-
Object.defineProperty(exports, "RandomValue", { enumerable: true, get: function () { return random_value_1.RandomValue; } });
|
|
54
|
-
var guardian_1 = require("./@tool-box/utils/type-guard/guardian");
|
|
55
|
-
Object.defineProperty(exports, "_", { enumerable: true, get: function () { return guardian_1.Guardian; } });
|
|
56
|
-
var failure_abstract_1 = require("./arch/modules/application/failures/failure.abstract");
|
|
57
|
-
Object.defineProperty(exports, "FailureAbstract", { enumerable: true, get: function () { return failure_abstract_1.FailureAbstract; } });
|
|
58
|
-
var unknown_failure_1 = require("./arch/modules/application/failures/unknown-failure");
|
|
59
|
-
Object.defineProperty(exports, "UnknownFailure", { enumerable: true, get: function () { return unknown_failure_1.UnknownFailure; } });
|
|
60
|
-
var _array_abstract_1 = require("./arch/modules/domain/entities/$array.abstract");
|
|
61
|
-
Object.defineProperty(exports, "$array", { enumerable: true, get: function () { return _array_abstract_1.$array; } });
|
|
62
|
-
var _boolean_abstract_1 = require("./arch/modules/domain/entities/$boolean.abstract");
|
|
63
|
-
Object.defineProperty(exports, "$boolean", { enumerable: true, get: function () { return _boolean_abstract_1.$boolean; } });
|
|
64
|
-
var _date_abstract_1 = require("./arch/modules/domain/entities/$date.abstract");
|
|
65
|
-
Object.defineProperty(exports, "$date", { enumerable: true, get: function () { return _date_abstract_1.$date; } });
|
|
66
|
-
var _number_abstract_1 = require("./arch/modules/domain/entities/$number.abstract");
|
|
67
|
-
Object.defineProperty(exports, "$number", { enumerable: true, get: function () { return _number_abstract_1.$number; } });
|
|
68
|
-
var _object_abstract_1 = require("./arch/modules/domain/entities/$object.abstract");
|
|
69
|
-
Object.defineProperty(exports, "$object", { enumerable: true, get: function () { return _object_abstract_1.$object; } });
|
|
70
|
-
var _string_abstract_1 = require("./arch/modules/domain/entities/$string.abstract");
|
|
71
|
-
Object.defineProperty(exports, "$string", { enumerable: true, get: function () { return _string_abstract_1.$string; } });
|
|
72
|
-
var uuid_abstract_1 = require("./arch/modules/domain/entities/uuid.abstract");
|
|
73
|
-
Object.defineProperty(exports, "UuidAbstract", { enumerable: true, get: function () { return uuid_abstract_1.UuidAbstract; } });
|
|
74
|
-
var url_abstract_1 = require("./arch/modules/domain/entities/url.abstract");
|
|
75
|
-
Object.defineProperty(exports, "Url", { enumerable: true, get: function () { return url_abstract_1.Url; } });
|
|
76
|
-
var http_status_codes_enum_1 = require("./arch/modules/domain/enums/http-status-codes.enum");
|
|
77
|
-
Object.defineProperty(exports, "HttpStatusCodes", { enumerable: true, get: function () { return http_status_codes_enum_1.HttpStatusCodes; } });
|
|
78
|
-
var node_envs_enum_1 = require("./arch/modules/domain/enums/node-envs.enum");
|
|
79
|
-
Object.defineProperty(exports, "NodeEnvs", { enumerable: true, get: function () { return node_envs_enum_1.NodeEnvs; } });
|
|
80
|
-
var faker_1 = require("./@tool-box/tests/faker/faker");
|
|
81
|
-
Object.defineProperty(exports, "faker", { enumerable: true, get: function () { return faker_1.faker; } });
|
|
1
|
+
import "./@tool-box/utils/datatypes/string-utils";
|
|
2
|
+
import "./@tool-box/utils/datatypes/boolean-utils";
|
|
3
|
+
export { StringEdgeSketch } from "./objects/primitives/string.edge.sketch";
|
|
4
|
+
export { NumberEdgeSketch } from "./objects/primitives/number.edge.sketch";
|
|
5
|
+
export { DatetimeEdgeSketch } from "./objects/primitives/datetime.edge.sketch";
|
|
6
|
+
export { BooleanEdgeSketch } from "./objects/primitives/boolean.edge.sketch";
|
|
7
|
+
export { PasswordEdge } from "./objects/password/password.edge";
|
|
8
|
+
export { FailureSketchEdge } from "./objects/failure/edges/failure.sketch.edge";
|
|
9
|
+
export { DatetimeEdge } from "./objects/datetime/edges/datetime.edge";
|
|
10
|
+
export { MonthNameEnum } from "./objects/datetime/points/month-name.enum";
|
|
11
|
+
export { WeekDayEnum } from "./objects/datetime/points/week-day.enum";
|
|
12
|
+
export { HeaderTokenNameEnum } from "./objects/@common/points/header-token-name.enum";
|
|
13
|
+
export { HttpStatusCodes } from "./objects/@common/points/http-status-codes.enum";
|
|
14
|
+
export { NodeEnvs } from "./objects/@common/points/node-envs.enum";
|
|
15
|
+
export { EmailEdge } from "./objects/@common/edges/email.edge";
|
|
16
|
+
export { PersonNameEdge } from "./objects/@common/edges/person-name.edge";
|
|
17
|
+
export { UrlEdge } from "./objects/@common/edges/url.edge";
|
|
18
|
+
export { UsernameEdge } from "./objects/@common/edges/username.edge";
|
|
19
|
+
export { UuidSketchEdge } from "./objects/@common/edges/uuid.sketch.edge";
|
|
20
|
+
export { _ } from "./@tool-box/utils/type-guard/guardian";
|
|
21
|
+
export { Random } from "./@tool-box/utils/random/random";
|
|
22
|
+
export { Nothing, Optional } from "./@tool-box/utils/ducts/optional-type";
|
|
23
|
+
export { MapAbstract } from "./@tool-box/utils/map/map.abstract";
|
|
24
|
+
export { BuilderAbstract } from "./@tool-box/tests/builder.abstract.util";
|
|
25
|
+
export { FailureEdgeBuilder } from "./@tool-box/tests/builders/failures/failure.edge.builder";
|
|
26
|
+
export { EmailEdgeBuilder } from "./@tool-box/tests/builders/user/email.edge.builder";
|
|
27
|
+
export { PersonNameEdgeBuilder } from "./@tool-box/tests/builders/user/person-name.edge.builder";
|
|
28
|
+
export { UsernameEdgeBuilder } from "./@tool-box/tests/builders/user/username.edge.builder";
|
|
29
|
+
export { CreateFakeCommand } from "./@tool-box/tests/create-fake-command";
|
|
30
|
+
export { faker } from "./@tool-box/tests/faker/faker";
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const _string_abstract_1 = require("../../$string.abstract");
|
|
5
|
-
class Email extends _string_abstract_1.$string {
|
|
1
|
+
import { StringEdgeSketch } from "../../primitives/string.edge.sketch";
|
|
2
|
+
export class EmailEdge extends StringEdgeSketch {
|
|
3
|
+
email;
|
|
6
4
|
constructor(email) {
|
|
7
5
|
super(email);
|
|
8
6
|
this.email = email;
|
|
@@ -14,4 +12,3 @@ class Email extends _string_abstract_1.$string {
|
|
|
14
12
|
}
|
|
15
13
|
}
|
|
16
14
|
}
|
|
17
|
-
exports.Email = Email;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StringEdgeSketch } from "../../primitives/string.edge.sketch";
|
|
2
|
+
export class PersonNameEdge extends StringEdgeSketch {
|
|
3
|
+
name;
|
|
4
|
+
constructor(name) {
|
|
5
|
+
super(name);
|
|
6
|
+
this.name = name;
|
|
7
|
+
}
|
|
8
|
+
get firstName() {
|
|
9
|
+
return this.name.split(" ")[0];
|
|
10
|
+
}
|
|
11
|
+
get lastName() {
|
|
12
|
+
return this.name.split(" ").slice(1).join(" ");
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StringEdgeSketch } from "../../primitives/string.edge.sketch";
|
|
2
|
+
export class UrlEdge extends StringEdgeSketch {
|
|
3
|
+
_url;
|
|
4
|
+
constructor(_url) {
|
|
5
|
+
super(_url);
|
|
6
|
+
this._url = _url;
|
|
7
|
+
this.validateUrl();
|
|
8
|
+
}
|
|
9
|
+
validateUrl() {
|
|
10
|
+
try {
|
|
11
|
+
new URL(this._url);
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
throw new Error(`${this._url} should be a valid URL.`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export declare abstract class
|
|
1
|
+
export declare abstract class UuidSketchEdge {
|
|
2
2
|
private readonly value;
|
|
3
3
|
private static readonly pattern;
|
|
4
4
|
constructor(value?: string);
|
|
5
|
-
equals(uuid:
|
|
5
|
+
equals(uuid: UuidSketchEdge): boolean;
|
|
6
6
|
toString(): string;
|
|
7
7
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { _ } from "../../../index";
|
|
2
|
+
import uuid from "react-native-uuid";
|
|
3
|
+
export class UuidSketchEdge {
|
|
4
|
+
value;
|
|
5
|
+
static pattern = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
6
|
+
constructor(value = uuid.v4()) {
|
|
7
|
+
this.value = value;
|
|
8
|
+
if (!UuidSketchEdge.pattern.test(value)) {
|
|
9
|
+
throw new TypeError("The provided UUID is invalid. Please ensure it is in the correct format");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
equals(uuid) {
|
|
13
|
+
return _.isEqual(this.toString(), uuid.toString());
|
|
14
|
+
}
|
|
15
|
+
toString() {
|
|
16
|
+
return this.value;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HeaderTokenNameEnum = void 0;
|
|
4
|
-
var HeaderTokenNameEnum;
|
|
1
|
+
export var HeaderTokenNameEnum;
|
|
5
2
|
(function (HeaderTokenNameEnum) {
|
|
6
3
|
HeaderTokenNameEnum["authorizationClient"] = "authorization_client";
|
|
7
4
|
HeaderTokenNameEnum["requireRolesClient"] = "require_roles_client";
|
|
8
5
|
HeaderTokenNameEnum["authorizationUser"] = "authorization_user";
|
|
9
6
|
HeaderTokenNameEnum["requireRolesUser"] = "require_roles_user";
|
|
10
|
-
})(HeaderTokenNameEnum || (
|
|
7
|
+
})(HeaderTokenNameEnum || (HeaderTokenNameEnum = {}));
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HttpStatusCodes = void 0;
|
|
4
|
-
var HttpStatusCodes;
|
|
1
|
+
export var HttpStatusCodes;
|
|
5
2
|
(function (HttpStatusCodes) {
|
|
6
3
|
/**
|
|
7
4
|
* This interim response indicates that everything so far is OK and that the client should continue with the request or ignore it if it is already finished.
|
|
@@ -241,4 +238,4 @@ var HttpStatusCodes;
|
|
|
241
238
|
* The 511 status code indicates that the client needs to authenticate to gain network access.
|
|
242
239
|
*/
|
|
243
240
|
HttpStatusCodes[HttpStatusCodes["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
|
|
244
|
-
})(HttpStatusCodes || (
|
|
241
|
+
})(HttpStatusCodes || (HttpStatusCodes = {}));
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NodeEnvs = void 0;
|
|
4
|
-
var NodeEnvs;
|
|
1
|
+
export var NodeEnvs;
|
|
5
2
|
(function (NodeEnvs) {
|
|
6
3
|
NodeEnvs["production"] = "production";
|
|
7
4
|
NodeEnvs["homolog"] = "homolog";
|
|
8
5
|
NodeEnvs["development"] = "development";
|
|
9
6
|
NodeEnvs["test"] = "test";
|
|
10
|
-
})(NodeEnvs || (
|
|
7
|
+
})(NodeEnvs || (NodeEnvs = {}));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Moment } from "moment";
|
|
2
|
+
import { MonthNameEnum } from "../points/month-name.enum";
|
|
3
|
+
import { WeekDayEnum } from "../points/week-day.enum";
|
|
4
|
+
export declare class DatetimeEdge {
|
|
5
|
+
private readonly value?;
|
|
6
|
+
protected readonly date: Moment;
|
|
7
|
+
constructor(value?: (Date | string) | undefined);
|
|
8
|
+
isAfter(other: DatetimeEdge): boolean;
|
|
9
|
+
diffFromNow(): string;
|
|
10
|
+
isEquals(other: DatetimeEdge): boolean;
|
|
11
|
+
isBefore(other: DatetimeEdge): boolean;
|
|
12
|
+
isBetween(initialDate: DatetimeEdge, finalDate: DatetimeEdge): boolean;
|
|
13
|
+
isWeekend(): boolean;
|
|
14
|
+
isHoliday(): boolean;
|
|
15
|
+
isBusinessDay(): boolean;
|
|
16
|
+
getDayOfWeek(): WeekDayEnum;
|
|
17
|
+
getNameOfMonth(): MonthNameEnum;
|
|
18
|
+
getDayOfMonth(): number;
|
|
19
|
+
getNumberOfMonth(): number;
|
|
20
|
+
getYear(): number;
|
|
21
|
+
toISOStringPoint(): string;
|
|
22
|
+
timestamp(): number;
|
|
23
|
+
unix(): number;
|
|
24
|
+
toDatePoint(): Date;
|
|
25
|
+
toYYYYMMDD(): string;
|
|
26
|
+
protected validate(): void;
|
|
27
|
+
}
|