@atlantjs/arch 15.6.7 → 15.7.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/index.js +60 -0
- package/package.json +4 -3
- package/{tsconfig.tsbuildinfo → tsconfig.build.tsbuildinfo} +1 -1
- package/src/@tool-box/tests/builder.abstract.util.js +0 -39
- package/src/@tool-box/tests/builders/datetime/datetime.edge.builder.js +0 -15
- package/src/@tool-box/tests/builders/failures/dummies/failure.dummy.js +0 -13
- package/src/@tool-box/tests/builders/failures/failure.builder.js +0 -17
- package/src/@tool-box/tests/builders/metadata/metadata-uv.builder.js +0 -18
- package/src/@tool-box/tests/builders/metadata/metadata.edge.builder.js +0 -15
- package/src/@tool-box/tests/builders/user/email.edge.builder.js +0 -15
- package/src/@tool-box/tests/builders/user/username.edge.builder.js +0 -15
- package/src/@tool-box/tests/faker/faker.js +0 -208
- package/src/@tool-box/utils/convert-units/convert-units.js +0 -154
- package/src/@tool-box/utils/datatypes/boolean-utils.js +0 -155
- package/src/@tool-box/utils/datatypes/generic-types.js +0 -3
- package/src/@tool-box/utils/datatypes/plainify.js +0 -2
- package/src/@tool-box/utils/datatypes/string-utils.js +0 -292
- package/src/@tool-box/utils/datetime/mappers/month.mapper.js +0 -58
- package/src/@tool-box/utils/datetime/mappers/points/month-abbreviation.enum.js +0 -18
- package/src/@tool-box/utils/datetime/mappers/points/month-number.enum.js +0 -18
- package/src/@tool-box/utils/ducts/common.js +0 -47
- package/src/@tool-box/utils/ducts/optional-type.js +0 -128
- package/src/@tool-box/utils/ducts/return-type.js +0 -67
- package/src/@tool-box/utils/http-provider/http-provider-failure-response.js +0 -19
- package/src/@tool-box/utils/http-provider/http-provider-success-response.js +0 -20
- package/src/@tool-box/utils/http-provider/http-provider.js +0 -85
- package/src/@tool-box/utils/logger/index.js +0 -31
- package/src/@tool-box/utils/map/map.abstract.js +0 -84
- package/src/@tool-box/utils/random/random.js +0 -260
- package/src/@tool-box/utils/type-guard/guardian-exception.js +0 -6
- package/src/@tool-box/utils/type-guard/guardian.js +0 -625
- package/src/@tool-box/utils/type-guard/guardian.type.js +0 -2
- package/src/@tool-box/utils/validators/is-cron-expression.js +0 -39
- package/src/@tool-box/utils/validators/is-date-string.js +0 -42
- package/src/@tool-box/utils/validators/is-password-match.js +0 -27
- package/src/@tool-box/utils/validators/is-password-policy.validator.js +0 -30
- package/src/@tool-box/utils/validators/is-schedule.js +0 -43
- package/src/@tool-box/utils/validators/is-time-string.js +0 -39
- package/src/@tool-box/utils/validators/is-ulid.js +0 -39
- package/src/index.js +0 -179
- package/src/objects/@common/edges/email.edge.js +0 -94
- package/src/objects/@common/edges/ulid.sketch.edge.js +0 -91
- package/src/objects/@common/edges/url.edge.js +0 -269
- package/src/objects/@common/edges/username.edge.js +0 -41
- package/src/objects/@common/edges/uuid.sketch.edge.js +0 -145
- package/src/objects/@common/points/environment.point.js +0 -10
- package/src/objects/@common/points/header-token-name.point.js +0 -10
- package/src/objects/@common/points/http-status-codes.point.js +0 -244
- package/src/objects/amount/amount-value.edge.js +0 -76
- package/src/objects/amount/amount.edge.js +0 -626
- package/src/objects/amount/amount.polygon.js +0 -2
- package/src/objects/amount/amount.uv.js +0 -29
- package/src/objects/amount/points/duration-unit.point.js +0 -15
- package/src/objects/amount/points/energy-unit.point.js +0 -10
- package/src/objects/amount/points/length-unit.point.js +0 -10
- package/src/objects/amount/points/mass-unit.point.js +0 -11
- package/src/objects/amount/points/month-name.point.js +0 -18
- package/src/objects/amount/points/object-unit.point.js +0 -7
- package/src/objects/amount/points/units.point.js +0 -2
- package/src/objects/amount/points/volume-unit.point.js +0 -8
- package/src/objects/amount/points/week-day.point.js +0 -13
- package/src/objects/datetime/edges/datetime.edge.js +0 -672
- package/src/objects/datetime/edges/locale/day/day-name-to-english.mapper.js +0 -19
- package/src/objects/datetime/edges/locale/day/day-name-to-portuguese.mapper.js +0 -19
- package/src/objects/datetime/edges/locale/day/today-to-language.mapper.js +0 -15
- package/src/objects/datetime/edges/locale/holidays-country.type.js +0 -2
- package/src/objects/datetime/edges/locale/month/month-to-english.mapper.js +0 -24
- package/src/objects/datetime/edges/locale/month/month-to-portuguese.mapper.js +0 -24
- package/src/objects/datetime/points/month-name.enum.js +0 -18
- package/src/objects/datetime/points/week-day.enum.js +0 -13
- package/src/objects/failure/edges/failure.abstract.js +0 -24
- package/src/objects/failure/edges/failure.abstract.polygon.js +0 -2
- package/src/objects/language/points/language.point.js +0 -135
- package/src/objects/metadata/metadata.edge.js +0 -25
- package/src/objects/metadata/metadata.polygon.js +0 -2
- package/src/objects/metadata/metadata.uv.js +0 -29
- package/src/objects/password/password.edge.js +0 -175
- package/src/objects/password/password.polygon.js +0 -2
- package/src/objects/password/steps/not-allowing-consecutive-chars-step.js +0 -34
- package/src/objects/password/steps/not-allowing-date-step.js +0 -61
- package/src/objects/password/steps/not-allowing-phone-step.js +0 -27
- package/src/objects/password/steps/not-allowing-repeated-chars-step.js +0 -34
- package/src/objects/password/steps/not-allowing-string-step.js +0 -19
- package/src/objects/password/steps/not-allowing-these-chars-step.js +0 -17
- package/src/objects/password/steps/numeric-step.js +0 -13
- package/src/objects/password/steps/with-at-least-one-letter-step.js +0 -14
- package/src/objects/password/steps/with-at-least-one-number-digit-step.js +0 -14
- package/src/objects/password/steps/with-at-least-one-special-char-step.js +0 -14
- package/src/objects/password/steps/with-length-step.js +0 -18
- package/src/objects/password/validation-step.js +0 -9
- package/src/objects/password/validation-step.type.js +0 -2
- package/src/objects/primitives/boolean.edge.sketch.js +0 -147
- package/src/objects/primitives/datetime.edge.sketch.js +0 -7
- package/src/objects/primitives/number.edge.sketch.js +0 -346
- package/src/objects/primitives/string.edge.sketch.js +0 -218
- package/src/objects/scheduling/scheduling.edge.failure.js +0 -14
- package/src/objects/scheduling/scheduling.edge.js +0 -280
- package/src/objects/time/time.edge.js +0 -447
- package/src/objects-interface/edges/edge.abstract.js +0 -6
- package/src/objects-interface/face.abstract.js +0 -6
- package/src/objects-interface/solid.abstract.js +0 -11
- package/src/objects-interface/uv.abstract.js +0 -6
- package/src/objects-interface/vertices/vertex.abstract.js +0 -11
- package/src/shared/payload.abstract.js +0 -6
- package/src/shared/request.abstract.js +0 -3
- package/src/shared/response.abstract.js +0 -6
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DayNameToPortugueseMapper = void 0;
|
|
4
|
-
const map_abstract_1 = require("#/@tool-box/utils/map/map.abstract");
|
|
5
|
-
class DayNameToPortugueseMapper extends map_abstract_1.MapAbstract {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.map = new Map([
|
|
9
|
-
[0, "Domingo"],
|
|
10
|
-
[1, "Segunda-feira"],
|
|
11
|
-
[2, "Terça-feira"],
|
|
12
|
-
[3, "Quarta-feira"],
|
|
13
|
-
[4, "Quinta-feira"],
|
|
14
|
-
[5, "Sexta-feira"],
|
|
15
|
-
[6, "Sábado"],
|
|
16
|
-
]);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.DayNameToPortugueseMapper = DayNameToPortugueseMapper;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TodayToLanguageMapper = void 0;
|
|
4
|
-
const map_abstract_1 = require("#/@tool-box/utils/map/map.abstract");
|
|
5
|
-
const language_point_1 = require("#/objects/language/points/language.point");
|
|
6
|
-
class TodayToLanguageMapper extends map_abstract_1.MapAbstract {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.map = new Map([
|
|
10
|
-
[language_point_1.LanguagePoint.english, "Today"],
|
|
11
|
-
[language_point_1.LanguagePoint.portuguese, "Hoje"],
|
|
12
|
-
]);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.TodayToLanguageMapper = TodayToLanguageMapper;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MonthNameToEnglishMapper = void 0;
|
|
4
|
-
const map_abstract_1 = require("#/@tool-box/utils/map/map.abstract");
|
|
5
|
-
class MonthNameToEnglishMapper extends map_abstract_1.MapAbstract {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.map = new Map([
|
|
9
|
-
[0, "January"],
|
|
10
|
-
[1, "February"],
|
|
11
|
-
[2, "March"],
|
|
12
|
-
[3, "April"],
|
|
13
|
-
[4, "May"],
|
|
14
|
-
[5, "June"],
|
|
15
|
-
[6, "July"],
|
|
16
|
-
[7, "August"],
|
|
17
|
-
[8, "September"],
|
|
18
|
-
[9, "October"],
|
|
19
|
-
[10, "November"],
|
|
20
|
-
[11, "December"],
|
|
21
|
-
]);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.MonthNameToEnglishMapper = MonthNameToEnglishMapper;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MonthNameToPortugueseMapper = void 0;
|
|
4
|
-
const map_abstract_1 = require("#/@tool-box/utils/map/map.abstract");
|
|
5
|
-
class MonthNameToPortugueseMapper extends map_abstract_1.MapAbstract {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.map = new Map([
|
|
9
|
-
[0, "Janeiro"],
|
|
10
|
-
[1, "Fevereiro"],
|
|
11
|
-
[2, "Março"],
|
|
12
|
-
[3, "Abril"],
|
|
13
|
-
[4, "Maio"],
|
|
14
|
-
[5, "Junho"],
|
|
15
|
-
[6, "Julho"],
|
|
16
|
-
[7, "Agosto"],
|
|
17
|
-
[8, "Setembro"],
|
|
18
|
-
[9, "Outubro"],
|
|
19
|
-
[10, "Novembro"],
|
|
20
|
-
[11, "Dezembro"],
|
|
21
|
-
]);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.MonthNameToPortugueseMapper = MonthNameToPortugueseMapper;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MonthNameEnum = void 0;
|
|
4
|
-
var MonthNameEnum;
|
|
5
|
-
(function (MonthNameEnum) {
|
|
6
|
-
MonthNameEnum["january"] = "january";
|
|
7
|
-
MonthNameEnum["february"] = "february";
|
|
8
|
-
MonthNameEnum["march"] = "march";
|
|
9
|
-
MonthNameEnum["april"] = "april";
|
|
10
|
-
MonthNameEnum["may"] = "may";
|
|
11
|
-
MonthNameEnum["june"] = "june";
|
|
12
|
-
MonthNameEnum["july"] = "july";
|
|
13
|
-
MonthNameEnum["august"] = "august";
|
|
14
|
-
MonthNameEnum["september"] = "september";
|
|
15
|
-
MonthNameEnum["october"] = "october";
|
|
16
|
-
MonthNameEnum["november"] = "november";
|
|
17
|
-
MonthNameEnum["december"] = "december";
|
|
18
|
-
})(MonthNameEnum || (exports.MonthNameEnum = MonthNameEnum = {}));
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WeekDayEnum = void 0;
|
|
4
|
-
var WeekDayEnum;
|
|
5
|
-
(function (WeekDayEnum) {
|
|
6
|
-
WeekDayEnum["sunday"] = "sunday";
|
|
7
|
-
WeekDayEnum["monday"] = "monday";
|
|
8
|
-
WeekDayEnum["tuesday"] = "tuesday";
|
|
9
|
-
WeekDayEnum["wednesday"] = "wednesday";
|
|
10
|
-
WeekDayEnum["thursday"] = "thursday";
|
|
11
|
-
WeekDayEnum["friday"] = "friday";
|
|
12
|
-
WeekDayEnum["saturday"] = "saturday";
|
|
13
|
-
})(WeekDayEnum || (exports.WeekDayEnum = WeekDayEnum = {}));
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FailureAbstract = void 0;
|
|
4
|
-
const index_1 = require("#/index");
|
|
5
|
-
const environment_point_1 = require("#/objects/@common/points/environment.point");
|
|
6
|
-
class FailureAbstract {
|
|
7
|
-
constructor(props) {
|
|
8
|
-
this.props = props;
|
|
9
|
-
this._code = this.props.failureClass.name.toKebabCase();
|
|
10
|
-
if (index_1._.and(index_1._.isEqual(process.env.ENVIRONMENT, environment_point_1.EnvironmentPoint.development), index_1._.isNotNullOrUndefined(this.props.stackTrace))) {
|
|
11
|
-
this._message = `${this.props.message} - ${this.props.stackTrace.toString()}`;
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
this._message = this.props.message;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
toPolygon() {
|
|
18
|
-
return {
|
|
19
|
-
code: this._code,
|
|
20
|
-
message: this._message,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.FailureAbstract = FailureAbstract;
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LanguagePoint = void 0;
|
|
4
|
-
// Android-supported BCP 47 locale tags
|
|
5
|
-
// Reference: https://developer.android.com/reference/java/util/Locale
|
|
6
|
-
var LanguagePoint;
|
|
7
|
-
(function (LanguagePoint) {
|
|
8
|
-
// =========================
|
|
9
|
-
// AFRO-ASIATIC
|
|
10
|
-
// =========================
|
|
11
|
-
LanguagePoint["amharic"] = "am";
|
|
12
|
-
LanguagePoint["arabic"] = "ar";
|
|
13
|
-
LanguagePoint["hebrew"] = "he";
|
|
14
|
-
// =========================
|
|
15
|
-
// AUSTRONESIAN
|
|
16
|
-
// =========================
|
|
17
|
-
LanguagePoint["filipino"] = "fil";
|
|
18
|
-
LanguagePoint["indonesian"] = "id";
|
|
19
|
-
LanguagePoint["malay"] = "ms";
|
|
20
|
-
// =========================
|
|
21
|
-
// DRAVIDIAN
|
|
22
|
-
// =========================
|
|
23
|
-
LanguagePoint["kannada"] = "kn";
|
|
24
|
-
LanguagePoint["malayalam"] = "ml";
|
|
25
|
-
LanguagePoint["tamil"] = "ta";
|
|
26
|
-
LanguagePoint["telugu"] = "te";
|
|
27
|
-
// =========================
|
|
28
|
-
// INDO-EUROPEAN — GERMANIC
|
|
29
|
-
// =========================
|
|
30
|
-
LanguagePoint["afrikaans"] = "af";
|
|
31
|
-
LanguagePoint["danish"] = "da";
|
|
32
|
-
LanguagePoint["dutch"] = "nl";
|
|
33
|
-
LanguagePoint["english"] = "en";
|
|
34
|
-
LanguagePoint["englishUs"] = "en-US";
|
|
35
|
-
LanguagePoint["englishGb"] = "en-GB";
|
|
36
|
-
LanguagePoint["german"] = "de";
|
|
37
|
-
LanguagePoint["icelandic"] = "is";
|
|
38
|
-
LanguagePoint["norwegian"] = "no";
|
|
39
|
-
LanguagePoint["swedish"] = "sv";
|
|
40
|
-
// =========================
|
|
41
|
-
// INDO-EUROPEAN — ROMANCE
|
|
42
|
-
// =========================
|
|
43
|
-
LanguagePoint["catalan"] = "ca";
|
|
44
|
-
LanguagePoint["french"] = "fr";
|
|
45
|
-
LanguagePoint["frenchFr"] = "fr-FR";
|
|
46
|
-
LanguagePoint["frenchCa"] = "fr-CA";
|
|
47
|
-
LanguagePoint["galician"] = "gl";
|
|
48
|
-
LanguagePoint["italian"] = "it";
|
|
49
|
-
LanguagePoint["portuguese"] = "pt";
|
|
50
|
-
LanguagePoint["portugueseBr"] = "pt-BR";
|
|
51
|
-
LanguagePoint["portuguesePt"] = "pt-PT";
|
|
52
|
-
LanguagePoint["romanian"] = "ro";
|
|
53
|
-
LanguagePoint["spanish"] = "es";
|
|
54
|
-
LanguagePoint["spanishEs"] = "es-ES";
|
|
55
|
-
LanguagePoint["spanishMx"] = "es-MX";
|
|
56
|
-
LanguagePoint["spanishAr"] = "es-AR";
|
|
57
|
-
// =========================
|
|
58
|
-
// INDO-EUROPEAN — SLAVIC
|
|
59
|
-
// =========================
|
|
60
|
-
LanguagePoint["bulgarian"] = "bg";
|
|
61
|
-
LanguagePoint["croatian"] = "hr";
|
|
62
|
-
LanguagePoint["czech"] = "cs";
|
|
63
|
-
LanguagePoint["polish"] = "pl";
|
|
64
|
-
LanguagePoint["russian"] = "ru";
|
|
65
|
-
LanguagePoint["serbian"] = "sr";
|
|
66
|
-
LanguagePoint["slovak"] = "sk";
|
|
67
|
-
LanguagePoint["slovenian"] = "sl";
|
|
68
|
-
LanguagePoint["ukrainian"] = "uk";
|
|
69
|
-
// =========================
|
|
70
|
-
// INDO-EUROPEAN — INDO-ARYAN
|
|
71
|
-
// =========================
|
|
72
|
-
LanguagePoint["bengali"] = "bn";
|
|
73
|
-
LanguagePoint["gujarati"] = "gu";
|
|
74
|
-
LanguagePoint["hindi"] = "hi";
|
|
75
|
-
LanguagePoint["marathi"] = "mr";
|
|
76
|
-
LanguagePoint["nepali"] = "ne";
|
|
77
|
-
LanguagePoint["punjabi"] = "pa";
|
|
78
|
-
LanguagePoint["sinhala"] = "si";
|
|
79
|
-
LanguagePoint["urdu"] = "ur";
|
|
80
|
-
// =========================
|
|
81
|
-
// INDO-EUROPEAN — OTHER
|
|
82
|
-
// =========================
|
|
83
|
-
LanguagePoint["armenian"] = "hy";
|
|
84
|
-
LanguagePoint["greek"] = "el";
|
|
85
|
-
LanguagePoint["latvian"] = "lv";
|
|
86
|
-
LanguagePoint["lithuanian"] = "lt";
|
|
87
|
-
LanguagePoint["persian"] = "fa";
|
|
88
|
-
// =========================
|
|
89
|
-
// KARTVELIAN
|
|
90
|
-
// =========================
|
|
91
|
-
LanguagePoint["georgian"] = "ka";
|
|
92
|
-
// =========================
|
|
93
|
-
// JAPONIC
|
|
94
|
-
// =========================
|
|
95
|
-
LanguagePoint["japanese"] = "ja";
|
|
96
|
-
// =========================
|
|
97
|
-
// KOREANIC
|
|
98
|
-
// =========================
|
|
99
|
-
LanguagePoint["korean"] = "ko";
|
|
100
|
-
// =========================
|
|
101
|
-
// SINO-TIBETAN
|
|
102
|
-
// =========================
|
|
103
|
-
LanguagePoint["chineseSimplified"] = "zh-CN";
|
|
104
|
-
LanguagePoint["chineseTraditional"] = "zh-TW";
|
|
105
|
-
LanguagePoint["burmese"] = "my";
|
|
106
|
-
// =========================
|
|
107
|
-
// TAI-KADAI
|
|
108
|
-
// =========================
|
|
109
|
-
LanguagePoint["thai"] = "th";
|
|
110
|
-
LanguagePoint["lao"] = "lo";
|
|
111
|
-
// =========================
|
|
112
|
-
// TURKIC
|
|
113
|
-
// =========================
|
|
114
|
-
LanguagePoint["azerbaijani"] = "az";
|
|
115
|
-
LanguagePoint["kazakh"] = "kk";
|
|
116
|
-
LanguagePoint["turkish"] = "tr";
|
|
117
|
-
LanguagePoint["uzbek"] = "uz";
|
|
118
|
-
// =========================
|
|
119
|
-
// URALIC
|
|
120
|
-
// =========================
|
|
121
|
-
LanguagePoint["estonian"] = "et";
|
|
122
|
-
LanguagePoint["finnish"] = "fi";
|
|
123
|
-
LanguagePoint["hungarian"] = "hu";
|
|
124
|
-
// =========================
|
|
125
|
-
// AUSTROASIATIC
|
|
126
|
-
// =========================
|
|
127
|
-
LanguagePoint["khmer"] = "km";
|
|
128
|
-
LanguagePoint["vietnamese"] = "vi";
|
|
129
|
-
// =========================
|
|
130
|
-
// OTHER
|
|
131
|
-
// =========================
|
|
132
|
-
LanguagePoint["basque"] = "eu";
|
|
133
|
-
LanguagePoint["swahili"] = "sw";
|
|
134
|
-
LanguagePoint["zulu"] = "zu";
|
|
135
|
-
})(LanguagePoint || (exports.LanguagePoint = LanguagePoint = {}));
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MetadataEdge = void 0;
|
|
4
|
-
const edge_abstract_1 = require("#/objects-interface/edges/edge.abstract");
|
|
5
|
-
const datetime_edge_1 = require("#/objects/datetime/edges/datetime.edge");
|
|
6
|
-
class MetadataEdge extends edge_abstract_1.EdgeAbstract {
|
|
7
|
-
constructor(_createdAt = new datetime_edge_1.DatetimeEdge(), _updatedAt = new datetime_edge_1.DatetimeEdge()) {
|
|
8
|
-
super();
|
|
9
|
-
this._createdAt = _createdAt;
|
|
10
|
-
this._updatedAt = _updatedAt;
|
|
11
|
-
}
|
|
12
|
-
get createdAt() {
|
|
13
|
-
return this._createdAt;
|
|
14
|
-
}
|
|
15
|
-
get updatedAt() {
|
|
16
|
-
return this._updatedAt;
|
|
17
|
-
}
|
|
18
|
-
toPolygon() {
|
|
19
|
-
return {
|
|
20
|
-
createdAt: this._createdAt.toISOString(),
|
|
21
|
-
updatedAt: this._updatedAt.toISOString(),
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.MetadataEdge = MetadataEdge;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.MetadataUv = void 0;
|
|
13
|
-
const class_validator_1 = require("class-validator");
|
|
14
|
-
const datetime_edge_1 = require("#/objects/datetime/edges/datetime.edge");
|
|
15
|
-
const metadata_edge_1 = require("#/objects/metadata/metadata.edge");
|
|
16
|
-
class MetadataUv {
|
|
17
|
-
toEntity() {
|
|
18
|
-
return new metadata_edge_1.MetadataEdge(new datetime_edge_1.DatetimeEdge(this.createdAt), new datetime_edge_1.DatetimeEdge(this.updatedAt));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.MetadataUv = MetadataUv;
|
|
22
|
-
__decorate([
|
|
23
|
-
(0, class_validator_1.IsDateString)(),
|
|
24
|
-
__metadata("design:type", String)
|
|
25
|
-
], MetadataUv.prototype, "createdAt", void 0);
|
|
26
|
-
__decorate([
|
|
27
|
-
(0, class_validator_1.IsDateString)(),
|
|
28
|
-
__metadata("design:type", String)
|
|
29
|
-
], MetadataUv.prototype, "updatedAt", void 0);
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PasswordEdge = void 0;
|
|
4
|
-
const guardian_1 = require("#/@tool-box/utils/type-guard/guardian");
|
|
5
|
-
const with_at_least_one_letter_step_1 = require("#/objects/password/steps/with-at-least-one-letter-step");
|
|
6
|
-
const with_at_least_one_number_digit_step_1 = require("#/objects/password/steps/with-at-least-one-number-digit-step");
|
|
7
|
-
const with_at_least_one_special_char_step_1 = require("#/objects/password/steps/with-at-least-one-special-char-step");
|
|
8
|
-
const with_length_step_1 = require("#/objects/password/steps/with-length-step");
|
|
9
|
-
class PasswordEdge {
|
|
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 (!valid) {
|
|
20
|
-
// 🐛 fix: valid é boolean, não tem método .falsy()
|
|
21
|
-
throw new TypeError(`Password is invalid: ${validationStepsResults.map((result) => result.name).join(", ")}`);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
validate(password) {
|
|
25
|
-
if (guardian_1._.isEqual(this.validationSteps.length, 0)) {
|
|
26
|
-
throw new TypeError("No validations found");
|
|
27
|
-
}
|
|
28
|
-
const validationStepsResults = [];
|
|
29
|
-
for (const step of this.validationSteps) {
|
|
30
|
-
validationStepsResults.push(step.validate(password));
|
|
31
|
-
}
|
|
32
|
-
const valid = validationStepsResults.every((result) => result.valid);
|
|
33
|
-
return { valid, validationStepsResults };
|
|
34
|
-
}
|
|
35
|
-
// ==================== Getters ====================
|
|
36
|
-
/**
|
|
37
|
-
* Retorna a senha como string.
|
|
38
|
-
* @returns String interna da senha
|
|
39
|
-
* @example
|
|
40
|
-
* new PasswordEdge("Abc@123").toString() // "Abc@123"
|
|
41
|
-
*/
|
|
42
|
-
toString() {
|
|
43
|
-
return this.password;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Retorna o comprimento da senha.
|
|
47
|
-
* @returns Número de caracteres da senha
|
|
48
|
-
* @example
|
|
49
|
-
* new PasswordEdge("Abc@123").length() // 7
|
|
50
|
-
*/
|
|
51
|
-
length() {
|
|
52
|
-
return this.password.length;
|
|
53
|
-
}
|
|
54
|
-
// ==================== Verificações ====================
|
|
55
|
-
/**
|
|
56
|
-
* Verifica se a senha contém ao menos uma letra maiúscula.
|
|
57
|
-
* @returns true se contém ao menos uma letra maiúscula, false caso contrário
|
|
58
|
-
* @example
|
|
59
|
-
* new PasswordEdge("Abc@123").hasUpperCase() // true
|
|
60
|
-
* new PasswordEdge("abc@123").hasUpperCase() // false
|
|
61
|
-
*/
|
|
62
|
-
hasUpperCase() {
|
|
63
|
-
return /[A-Z]/.test(this.password);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Verifica se a senha contém ao menos uma letra minúscula.
|
|
67
|
-
* @returns true se contém ao menos uma letra minúscula, false caso contrário
|
|
68
|
-
* @example
|
|
69
|
-
* new PasswordEdge("Abc@123").hasLowerCase() // true
|
|
70
|
-
* new PasswordEdge("ABC@123").hasLowerCase() // false
|
|
71
|
-
*/
|
|
72
|
-
hasLowerCase() {
|
|
73
|
-
return /[a-z]/.test(this.password);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Verifica se a senha contém ao menos um dígito numérico.
|
|
77
|
-
* @returns true se contém ao menos um número, false caso contrário
|
|
78
|
-
* @example
|
|
79
|
-
* new PasswordEdge("Abc@123").hasNumber() // true
|
|
80
|
-
* new PasswordEdge("Abcdef@").hasNumber() // false
|
|
81
|
-
*/
|
|
82
|
-
hasNumber() {
|
|
83
|
-
return /[0-9]/.test(this.password);
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Verifica se a senha contém ao menos um caractere especial.
|
|
87
|
-
* @returns true se contém ao menos um caractere especial, false caso contrário
|
|
88
|
-
* @example
|
|
89
|
-
* new PasswordEdge("Abc@123").hasSpecialChar() // true
|
|
90
|
-
* new PasswordEdge("Abc1234").hasSpecialChar() // false
|
|
91
|
-
*/
|
|
92
|
-
hasSpecialChar() {
|
|
93
|
-
return /[^a-zA-Z0-9]/.test(this.password);
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Verifica se a senha contém espaços.
|
|
97
|
-
* @returns true se contém ao menos um espaço, false caso contrário
|
|
98
|
-
* @example
|
|
99
|
-
* new PasswordEdge("Abc @123").hasWhitespace() // true
|
|
100
|
-
* new PasswordEdge("Abc@123").hasWhitespace() // false
|
|
101
|
-
*/
|
|
102
|
-
hasWhitespace() {
|
|
103
|
-
return /\s/.test(this.password);
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Verifica se a senha é igual a outra.
|
|
107
|
-
* @param password - String ou PasswordEdge para comparação
|
|
108
|
-
* @returns true se as senhas são iguais, false caso contrário
|
|
109
|
-
* @example
|
|
110
|
-
* new PasswordEdge("Abc@123").isEqual(new PasswordEdge("Abc@123")) // true
|
|
111
|
-
* new PasswordEdge("Abc@123").isEqual("Abc@123") // true
|
|
112
|
-
* new PasswordEdge("Abc@123").isEqual("xyz@999") // false
|
|
113
|
-
*/
|
|
114
|
-
isEqual(password) {
|
|
115
|
-
const comparand = password instanceof PasswordEdge ? password.toString() : password;
|
|
116
|
-
return this.password === comparand;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Avalia a força da senha com base em critérios de complexidade.
|
|
120
|
-
* @returns "weak" | "medium" | "strong" conforme a pontuação
|
|
121
|
-
* @example
|
|
122
|
-
* new PasswordEdge("abc@123").strength() // "weak"
|
|
123
|
-
* new PasswordEdge("Abcd@123").strength() // "medium"
|
|
124
|
-
* new PasswordEdge("Abcd@1234!X").strength() // "strong"
|
|
125
|
-
*/
|
|
126
|
-
strength() {
|
|
127
|
-
let score = 0;
|
|
128
|
-
if (this.hasUpperCase())
|
|
129
|
-
score++;
|
|
130
|
-
if (this.hasLowerCase())
|
|
131
|
-
score++;
|
|
132
|
-
if (this.hasNumber())
|
|
133
|
-
score++;
|
|
134
|
-
if (this.hasSpecialChar())
|
|
135
|
-
score++;
|
|
136
|
-
if (this.password.length >= 10)
|
|
137
|
-
score++;
|
|
138
|
-
if (this.password.length >= 16)
|
|
139
|
-
score++;
|
|
140
|
-
if (score <= 2)
|
|
141
|
-
return "weak";
|
|
142
|
-
if (score <= 4)
|
|
143
|
-
return "medium";
|
|
144
|
-
return "strong";
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Retorna o resultado detalhado de cada etapa de validação da senha.
|
|
148
|
-
* @returns Array com o resultado de cada ValidationStep
|
|
149
|
-
* @example
|
|
150
|
-
* new PasswordEdge("Abc@123").validationResults()
|
|
151
|
-
* // [{ name: "WithAtLeastOneLetterStep", valid: true }, ...]
|
|
152
|
-
*/
|
|
153
|
-
validationResults() {
|
|
154
|
-
return this.validate(this.password).validationStepsResults;
|
|
155
|
-
}
|
|
156
|
-
// ==================== Métodos Estáticos ====================
|
|
157
|
-
/**
|
|
158
|
-
* Verifica se uma string é uma senha válida sem lançar exceção.
|
|
159
|
-
* @param password - String a ser verificada
|
|
160
|
-
* @returns true se a senha é válida, false caso contrário
|
|
161
|
-
* @example
|
|
162
|
-
* PasswordEdge.isValid("Abc@123") // true
|
|
163
|
-
* PasswordEdge.isValid("abc") // false
|
|
164
|
-
*/
|
|
165
|
-
static isValid(password) {
|
|
166
|
-
try {
|
|
167
|
-
new PasswordEdge(password);
|
|
168
|
-
return true;
|
|
169
|
-
}
|
|
170
|
-
catch {
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
exports.PasswordEdge = PasswordEdge;
|
|
@@ -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("#/objects/password/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,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NotAllowingDateStep = void 0;
|
|
4
|
-
const validation_step_1 = require("#/objects/password/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,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NotAllowingPhoneStep = void 0;
|
|
4
|
-
const validation_step_1 = require("#/objects/password/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;
|