@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.
Files changed (106) hide show
  1. package/index.js +60 -0
  2. package/package.json +4 -3
  3. package/{tsconfig.tsbuildinfo → tsconfig.build.tsbuildinfo} +1 -1
  4. package/src/@tool-box/tests/builder.abstract.util.js +0 -39
  5. package/src/@tool-box/tests/builders/datetime/datetime.edge.builder.js +0 -15
  6. package/src/@tool-box/tests/builders/failures/dummies/failure.dummy.js +0 -13
  7. package/src/@tool-box/tests/builders/failures/failure.builder.js +0 -17
  8. package/src/@tool-box/tests/builders/metadata/metadata-uv.builder.js +0 -18
  9. package/src/@tool-box/tests/builders/metadata/metadata.edge.builder.js +0 -15
  10. package/src/@tool-box/tests/builders/user/email.edge.builder.js +0 -15
  11. package/src/@tool-box/tests/builders/user/username.edge.builder.js +0 -15
  12. package/src/@tool-box/tests/faker/faker.js +0 -208
  13. package/src/@tool-box/utils/convert-units/convert-units.js +0 -154
  14. package/src/@tool-box/utils/datatypes/boolean-utils.js +0 -155
  15. package/src/@tool-box/utils/datatypes/generic-types.js +0 -3
  16. package/src/@tool-box/utils/datatypes/plainify.js +0 -2
  17. package/src/@tool-box/utils/datatypes/string-utils.js +0 -292
  18. package/src/@tool-box/utils/datetime/mappers/month.mapper.js +0 -58
  19. package/src/@tool-box/utils/datetime/mappers/points/month-abbreviation.enum.js +0 -18
  20. package/src/@tool-box/utils/datetime/mappers/points/month-number.enum.js +0 -18
  21. package/src/@tool-box/utils/ducts/common.js +0 -47
  22. package/src/@tool-box/utils/ducts/optional-type.js +0 -128
  23. package/src/@tool-box/utils/ducts/return-type.js +0 -67
  24. package/src/@tool-box/utils/http-provider/http-provider-failure-response.js +0 -19
  25. package/src/@tool-box/utils/http-provider/http-provider-success-response.js +0 -20
  26. package/src/@tool-box/utils/http-provider/http-provider.js +0 -85
  27. package/src/@tool-box/utils/logger/index.js +0 -31
  28. package/src/@tool-box/utils/map/map.abstract.js +0 -84
  29. package/src/@tool-box/utils/random/random.js +0 -260
  30. package/src/@tool-box/utils/type-guard/guardian-exception.js +0 -6
  31. package/src/@tool-box/utils/type-guard/guardian.js +0 -625
  32. package/src/@tool-box/utils/type-guard/guardian.type.js +0 -2
  33. package/src/@tool-box/utils/validators/is-cron-expression.js +0 -39
  34. package/src/@tool-box/utils/validators/is-date-string.js +0 -42
  35. package/src/@tool-box/utils/validators/is-password-match.js +0 -27
  36. package/src/@tool-box/utils/validators/is-password-policy.validator.js +0 -30
  37. package/src/@tool-box/utils/validators/is-schedule.js +0 -43
  38. package/src/@tool-box/utils/validators/is-time-string.js +0 -39
  39. package/src/@tool-box/utils/validators/is-ulid.js +0 -39
  40. package/src/index.js +0 -179
  41. package/src/objects/@common/edges/email.edge.js +0 -94
  42. package/src/objects/@common/edges/ulid.sketch.edge.js +0 -91
  43. package/src/objects/@common/edges/url.edge.js +0 -269
  44. package/src/objects/@common/edges/username.edge.js +0 -41
  45. package/src/objects/@common/edges/uuid.sketch.edge.js +0 -145
  46. package/src/objects/@common/points/environment.point.js +0 -10
  47. package/src/objects/@common/points/header-token-name.point.js +0 -10
  48. package/src/objects/@common/points/http-status-codes.point.js +0 -244
  49. package/src/objects/amount/amount-value.edge.js +0 -76
  50. package/src/objects/amount/amount.edge.js +0 -626
  51. package/src/objects/amount/amount.polygon.js +0 -2
  52. package/src/objects/amount/amount.uv.js +0 -29
  53. package/src/objects/amount/points/duration-unit.point.js +0 -15
  54. package/src/objects/amount/points/energy-unit.point.js +0 -10
  55. package/src/objects/amount/points/length-unit.point.js +0 -10
  56. package/src/objects/amount/points/mass-unit.point.js +0 -11
  57. package/src/objects/amount/points/month-name.point.js +0 -18
  58. package/src/objects/amount/points/object-unit.point.js +0 -7
  59. package/src/objects/amount/points/units.point.js +0 -2
  60. package/src/objects/amount/points/volume-unit.point.js +0 -8
  61. package/src/objects/amount/points/week-day.point.js +0 -13
  62. package/src/objects/datetime/edges/datetime.edge.js +0 -672
  63. package/src/objects/datetime/edges/locale/day/day-name-to-english.mapper.js +0 -19
  64. package/src/objects/datetime/edges/locale/day/day-name-to-portuguese.mapper.js +0 -19
  65. package/src/objects/datetime/edges/locale/day/today-to-language.mapper.js +0 -15
  66. package/src/objects/datetime/edges/locale/holidays-country.type.js +0 -2
  67. package/src/objects/datetime/edges/locale/month/month-to-english.mapper.js +0 -24
  68. package/src/objects/datetime/edges/locale/month/month-to-portuguese.mapper.js +0 -24
  69. package/src/objects/datetime/points/month-name.enum.js +0 -18
  70. package/src/objects/datetime/points/week-day.enum.js +0 -13
  71. package/src/objects/failure/edges/failure.abstract.js +0 -24
  72. package/src/objects/failure/edges/failure.abstract.polygon.js +0 -2
  73. package/src/objects/language/points/language.point.js +0 -135
  74. package/src/objects/metadata/metadata.edge.js +0 -25
  75. package/src/objects/metadata/metadata.polygon.js +0 -2
  76. package/src/objects/metadata/metadata.uv.js +0 -29
  77. package/src/objects/password/password.edge.js +0 -175
  78. package/src/objects/password/password.polygon.js +0 -2
  79. package/src/objects/password/steps/not-allowing-consecutive-chars-step.js +0 -34
  80. package/src/objects/password/steps/not-allowing-date-step.js +0 -61
  81. package/src/objects/password/steps/not-allowing-phone-step.js +0 -27
  82. package/src/objects/password/steps/not-allowing-repeated-chars-step.js +0 -34
  83. package/src/objects/password/steps/not-allowing-string-step.js +0 -19
  84. package/src/objects/password/steps/not-allowing-these-chars-step.js +0 -17
  85. package/src/objects/password/steps/numeric-step.js +0 -13
  86. package/src/objects/password/steps/with-at-least-one-letter-step.js +0 -14
  87. package/src/objects/password/steps/with-at-least-one-number-digit-step.js +0 -14
  88. package/src/objects/password/steps/with-at-least-one-special-char-step.js +0 -14
  89. package/src/objects/password/steps/with-length-step.js +0 -18
  90. package/src/objects/password/validation-step.js +0 -9
  91. package/src/objects/password/validation-step.type.js +0 -2
  92. package/src/objects/primitives/boolean.edge.sketch.js +0 -147
  93. package/src/objects/primitives/datetime.edge.sketch.js +0 -7
  94. package/src/objects/primitives/number.edge.sketch.js +0 -346
  95. package/src/objects/primitives/string.edge.sketch.js +0 -218
  96. package/src/objects/scheduling/scheduling.edge.failure.js +0 -14
  97. package/src/objects/scheduling/scheduling.edge.js +0 -280
  98. package/src/objects/time/time.edge.js +0 -447
  99. package/src/objects-interface/edges/edge.abstract.js +0 -6
  100. package/src/objects-interface/face.abstract.js +0 -6
  101. package/src/objects-interface/solid.abstract.js +0 -11
  102. package/src/objects-interface/uv.abstract.js +0 -6
  103. package/src/objects-interface/vertices/vertex.abstract.js +0 -11
  104. package/src/shared/payload.abstract.js +0 -6
  105. package/src/shared/request.abstract.js +0 -3
  106. package/src/shared/response.abstract.js +0 -6
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,292 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // ==================== Transformação de Casing ====================
4
- /**
5
- * Converte a string para o formato kebab-case.
6
- * Separa palavras com hífen e converte tudo para minúsculas.
7
- * @returns String no formato kebab-case
8
- * @example
9
- * "helloWorld".toKebabCase() // "hello-world"
10
- * "FooBarBaz".toKebabCase() // "foo-bar-baz"
11
- */
12
- String.prototype.toKebabCase = function () {
13
- return this.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
14
- };
15
- /**
16
- * Converte a string para o formato snake_case.
17
- * Separa palavras com underscore e converte tudo para minúsculas.
18
- * @returns String no formato snake_case
19
- * @example
20
- * "helloWorld".toSnakeCase() // "hello_world"
21
- * "FooBarBaz".toSnakeCase() // "foo_bar_baz"
22
- */
23
- String.prototype.toSnakeCase = function () {
24
- return this.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
25
- };
26
- /**
27
- * Converte a string para o formato camelCase.
28
- * Remove espaços e capitaliza a primeira letra de cada palavra, exceto a primeira.
29
- * @returns String no formato camelCase
30
- * @example
31
- * "hello world".toCamelCase() // "helloWorld"
32
- * "foo bar baz".toCamelCase() // "fooBarBaz"
33
- */
34
- String.prototype.toCamelCase = function () {
35
- return this.valueOf()
36
- .replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, (match, index) => index === 0 ? match.toLowerCase() : match.toUpperCase())
37
- .replace(/\s+/g, "");
38
- };
39
- /**
40
- * Converte a string para o formato PascalCase.
41
- * Remove espaços e capitaliza a primeira letra de cada palavra.
42
- * @returns String no formato PascalCase
43
- * @example
44
- * "hello world".toPascalCase() // "HelloWorld"
45
- * "foo bar baz".toPascalCase() // "FooBarBaz"
46
- */
47
- String.prototype.toPascalCase = function () {
48
- return this.valueOf()
49
- .replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, (match) => match.toUpperCase())
50
- .replace(/\s+/g, "");
51
- };
52
- /**
53
- * Converte a string para o formato Title Case.
54
- * Capitaliza a primeira letra de cada palavra, mantendo as demais em minúsculo.
55
- * @returns String no formato Title Case
56
- * @example
57
- * "hello world".toTitleCase() // "Hello World"
58
- * "the quick brown fox".toTitleCase() // "The Quick Brown Fox"
59
- */
60
- String.prototype.toTitleCase = function () {
61
- return this.valueOf()
62
- .toLowerCase()
63
- .replace(/(?:^|\s)\w/g, (match) => match.toUpperCase());
64
- };
65
- /**
66
- * Capitaliza a primeira letra de cada palavra da string.
67
- * @returns String com a primeira letra de cada palavra em maiúsculo
68
- * @example
69
- * "hello world".capitalize() // "Hello World"
70
- * "foo BAR".capitalize() // "Foo Bar"
71
- */
72
- String.prototype.capitalize = function () {
73
- return this.valueOf()
74
- .split(" ")
75
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
76
- .join(" ");
77
- };
78
- // ==================== Manipulação ====================
79
- /**
80
- * Remove espaços extras e faz trim na string.
81
- * Substitui múltiplos espaços consecutivos por um único espaço.
82
- * @returns String sem espaços extras
83
- * @example
84
- * " hello world ".sanitize() // "hello world"
85
- * "foo bar".sanitize() // "foo bar"
86
- */
87
- String.prototype.sanitize = function () {
88
- return this.valueOf().replace(/\s+/g, " ").trim();
89
- };
90
- /**
91
- * Trunca a string para um comprimento máximo, adicionando "..." ao final.
92
- * Se a string já for menor ou igual ao comprimento, retorna sem alteração.
93
- * @param length - Comprimento máximo da string resultante (incluindo "...")
94
- * @returns String truncada com "..." se necessário
95
- * @example
96
- * "Hello World".truncate(8) // "Hello..."
97
- * "Hi".truncate(8) // "Hi"
98
- */
99
- String.prototype.truncate = function (length) {
100
- if (this.valueOf().length <= length)
101
- return this.valueOf();
102
- return `${this.valueOf().substring(0, length - 3)}...`;
103
- };
104
- /**
105
- * Remove todos os espaços em branco da string.
106
- * @returns String sem nenhum espaço em branco
107
- * @example
108
- * "hello world".removeWhitespace() // "helloworld"
109
- * " foo bar ".removeWhitespace() // "foobar"
110
- */
111
- String.prototype.removeWhitespace = function () {
112
- return this.valueOf().replace(/\s+/g, "");
113
- };
114
- /**
115
- * Inverte os caracteres da string.
116
- * @returns String com os caracteres em ordem inversa
117
- * @example
118
- * "hello".reverse() // "olleh"
119
- * "abcd".reverse() // "dcba"
120
- */
121
- String.prototype.reverse = function () {
122
- return this.valueOf().split("").reverse().join("");
123
- };
124
- /**
125
- * Preenche o início (esquerda) da string com um caractere até atingir o comprimento especificado.
126
- * @param length - Comprimento total desejado da string
127
- * @param char - Caractere de preenchimento (padrão: " ")
128
- * @returns String preenchida à esquerda
129
- * @example
130
- * "5".padLeft(3, "0") // "005"
131
- * "hi".padLeft(5) // " hi"
132
- */
133
- String.prototype.padLeft = function (length, char = " ") {
134
- return this.valueOf().padStart(length, char);
135
- };
136
- /**
137
- * Preenche o final (direita) da string com um caractere até atingir o comprimento especificado.
138
- * @param length - Comprimento total desejado da string
139
- * @param char - Caractere de preenchimento (padrão: " ")
140
- * @returns String preenchida à direita
141
- * @example
142
- * "5".padRight(3, "0") // "500"
143
- * "hi".padRight(5) // "hi "
144
- */
145
- String.prototype.padRight = function (length, char = " ") {
146
- return this.valueOf().padEnd(length, char);
147
- };
148
- function escapeRegExp(value) {
149
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
150
- }
151
- /**
152
- * Substitui todas as ocorrências de uma substring por outra.
153
- * @param search - Substring/RegExp a ser substituída
154
- * @param replacement - String de substituição ou função de substituição
155
- * @returns Nova string com todas as ocorrências substituídas
156
- * @example
157
- * "foo bar foo".replaceAll("foo", "baz") // "baz bar baz"
158
- */
159
- String.prototype.replaceAll = function (search, replacement) {
160
- const source = this.valueOf();
161
- if (search instanceof RegExp) {
162
- const flags = search.flags.includes("g")
163
- ? search.flags
164
- : `${search.flags}g`;
165
- return source.replace(new RegExp(search.source, flags), replacement);
166
- }
167
- const literalGlobalRegex = new RegExp(escapeRegExp(search), "g");
168
- return source.replace(literalGlobalRegex, replacement);
169
- };
170
- // ==================== Verificação de Conteúdo ====================
171
- /**
172
- * Verifica se a string contém uma substring específica.
173
- * @param substring - Substring a ser procurada
174
- * @returns true se a substring foi encontrada, false caso contrário
175
- * @example
176
- * "hello world".contains("world") // true
177
- * "hello world".contains("foo") // false
178
- */
179
- String.prototype.contains = function (substring) {
180
- return this.valueOf().indexOf(substring) !== -1;
181
- };
182
- /**
183
- * Conta o número de ocorrências de uma substring na string.
184
- * @param substring - Substring a ser contada
185
- * @returns Número de ocorrências encontradas
186
- * @example
187
- * "hello world hello".countOccurrences("hello") // 2
188
- * "aaaa".countOccurrences("aa") // 2
189
- */
190
- String.prototype.countOccurrences = function (substring) {
191
- if (substring.length === 0)
192
- return 0;
193
- return this.valueOf().split(substring).length - 1;
194
- };
195
- // ==================== Validações ====================
196
- /**
197
- * Verifica se a string está vazia (sem nenhum caractere).
198
- * @returns true se a string não possui caracteres, false caso contrário
199
- * @example
200
- * "".isEmpty() // true
201
- * "hello".isEmpty() // false
202
- */
203
- String.prototype.isEmpty = function () {
204
- return this.valueOf().length === 0;
205
- };
206
- /**
207
- * Verifica se a string possui conteúdo (não está vazia).
208
- * @returns true se a string possui pelo menos um caractere, false caso contrário
209
- * @example
210
- * "hello".isFilled() // true
211
- * "".isFilled() // false
212
- */
213
- String.prototype.isFilled = function () {
214
- return this.valueOf().length > 0;
215
- };
216
- /**
217
- * Verifica se a string é um palíndromo (lida da mesma forma de frente para trás).
218
- * @returns true se a string é um palíndromo, false caso contrário
219
- * @example
220
- * "racecar".isPalindrome() // true
221
- * "hello".isPalindrome() // false
222
- */
223
- String.prototype.isPalindrome = function () {
224
- const clean = this.valueOf().toLowerCase().removeWhitespace();
225
- return clean === clean.split("").reverse().join("");
226
- };
227
- /**
228
- * Verifica se a string representa um valor numérico válido.
229
- * @returns true se a string pode ser convertida para número, false caso contrário
230
- * @example
231
- * "42".isNumeric() // true
232
- * "3.14".isNumeric() // true
233
- * "hello".isNumeric() // false
234
- */
235
- String.prototype.isNumeric = function () {
236
- return !Number.isNaN(Number(this.valueOf())) && this.valueOf().isFilled();
237
- };
238
- /**
239
- * Verifica se a string é um endereço de e-mail válido.
240
- * @returns true se a string é um e-mail válido, false caso contrário
241
- * @example
242
- * "user@example.com".isEmail() // true
243
- * "invalid-email".isEmail() // false
244
- */
245
- String.prototype.isEmail = function () {
246
- return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(this.valueOf());
247
- };
248
- /**
249
- * Verifica se a string é uma URL válida.
250
- * @returns true se a string é uma URL válida, false caso contrário
251
- * @example
252
- * "https://example.com".isURL() // true
253
- * "not a url".isURL() // false
254
- */
255
- String.prototype.isURL = function () {
256
- try {
257
- new URL(this.valueOf());
258
- return true;
259
- }
260
- catch {
261
- return false;
262
- }
263
- };
264
- /**
265
- * Verifica se a string é um UUID (Universally Unique Identifier) válido.
266
- * @returns true se a string é um UUID válido, false caso contrário
267
- * @example
268
- * "550e8400-e29b-41d4-a716-446655440000".isUUID() // true
269
- * "invalid-uuid".isUUID() // false
270
- */
271
- String.prototype.isUUID = function () {
272
- return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(this.valueOf());
273
- };
274
- // ==================== Conversão ====================
275
- /**
276
- * Converte a string para o formato Base64.
277
- * @returns String codificada em Base64
278
- * @example
279
- * "hello".toBase64() // "aGVsbG8="
280
- */
281
- String.prototype.toBase64 = function () {
282
- return btoa(this.valueOf());
283
- };
284
- /**
285
- * Decodifica a string do formato Base64.
286
- * @returns String decodificada do Base64
287
- * @example
288
- * "aGVsbG8=".fromBase64() // "hello"
289
- */
290
- String.prototype.fromBase64 = function () {
291
- return atob(this.valueOf());
292
- };
@@ -1,58 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MonthMapper = void 0;
4
- const month_abbreviation_enum_1 = require("#/@tool-box/utils/datetime/mappers/points/month-abbreviation.enum");
5
- const month_number_enum_1 = require("#/@tool-box/utils/datetime/mappers/points/month-number.enum");
6
- class MonthMapper {
7
- static toNumber(monthAbbreviation) {
8
- if (monthAbbreviation === month_abbreviation_enum_1.MonthAbbreviationEnum.january)
9
- return month_number_enum_1.MonthNumberEnum.january;
10
- if (monthAbbreviation === month_abbreviation_enum_1.MonthAbbreviationEnum.february)
11
- return month_number_enum_1.MonthNumberEnum.february;
12
- if (monthAbbreviation === month_abbreviation_enum_1.MonthAbbreviationEnum.march)
13
- return month_number_enum_1.MonthNumberEnum.march;
14
- if (monthAbbreviation === month_abbreviation_enum_1.MonthAbbreviationEnum.april)
15
- return month_number_enum_1.MonthNumberEnum.april;
16
- if (monthAbbreviation === month_abbreviation_enum_1.MonthAbbreviationEnum.may)
17
- return month_number_enum_1.MonthNumberEnum.may;
18
- if (monthAbbreviation === month_abbreviation_enum_1.MonthAbbreviationEnum.june)
19
- return month_number_enum_1.MonthNumberEnum.june;
20
- if (monthAbbreviation === month_abbreviation_enum_1.MonthAbbreviationEnum.july)
21
- return month_number_enum_1.MonthNumberEnum.july;
22
- if (monthAbbreviation === month_abbreviation_enum_1.MonthAbbreviationEnum.august)
23
- return month_number_enum_1.MonthNumberEnum.august;
24
- if (monthAbbreviation === month_abbreviation_enum_1.MonthAbbreviationEnum.september)
25
- return month_number_enum_1.MonthNumberEnum.september;
26
- if (monthAbbreviation === month_abbreviation_enum_1.MonthAbbreviationEnum.october)
27
- return month_number_enum_1.MonthNumberEnum.october;
28
- if (monthAbbreviation === month_abbreviation_enum_1.MonthAbbreviationEnum.november)
29
- return month_number_enum_1.MonthNumberEnum.november;
30
- return month_number_enum_1.MonthNumberEnum.december;
31
- }
32
- static toAbbreviation(monthNumber) {
33
- if (monthNumber === month_number_enum_1.MonthNumberEnum.january)
34
- return month_abbreviation_enum_1.MonthAbbreviationEnum.january;
35
- if (monthNumber === month_number_enum_1.MonthNumberEnum.february)
36
- return month_abbreviation_enum_1.MonthAbbreviationEnum.february;
37
- if (monthNumber === month_number_enum_1.MonthNumberEnum.march)
38
- return month_abbreviation_enum_1.MonthAbbreviationEnum.march;
39
- if (monthNumber === month_number_enum_1.MonthNumberEnum.april)
40
- return month_abbreviation_enum_1.MonthAbbreviationEnum.april;
41
- if (monthNumber === month_number_enum_1.MonthNumberEnum.may)
42
- return month_abbreviation_enum_1.MonthAbbreviationEnum.may;
43
- if (monthNumber === month_number_enum_1.MonthNumberEnum.june)
44
- return month_abbreviation_enum_1.MonthAbbreviationEnum.june;
45
- if (monthNumber === month_number_enum_1.MonthNumberEnum.july)
46
- return month_abbreviation_enum_1.MonthAbbreviationEnum.july;
47
- if (monthNumber === month_number_enum_1.MonthNumberEnum.august)
48
- return month_abbreviation_enum_1.MonthAbbreviationEnum.august;
49
- if (monthNumber === month_number_enum_1.MonthNumberEnum.september)
50
- return month_abbreviation_enum_1.MonthAbbreviationEnum.september;
51
- if (monthNumber === month_number_enum_1.MonthNumberEnum.october)
52
- return month_abbreviation_enum_1.MonthAbbreviationEnum.october;
53
- if (monthNumber === month_number_enum_1.MonthNumberEnum.november)
54
- return month_abbreviation_enum_1.MonthAbbreviationEnum.november;
55
- return month_abbreviation_enum_1.MonthAbbreviationEnum.december;
56
- }
57
- }
58
- exports.MonthMapper = MonthMapper;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MonthAbbreviationEnum = void 0;
4
- var MonthAbbreviationEnum;
5
- (function (MonthAbbreviationEnum) {
6
- MonthAbbreviationEnum["january"] = "jan";
7
- MonthAbbreviationEnum["february"] = "fev";
8
- MonthAbbreviationEnum["march"] = "mar";
9
- MonthAbbreviationEnum["april"] = "abr";
10
- MonthAbbreviationEnum["may"] = "mai";
11
- MonthAbbreviationEnum["june"] = "jun";
12
- MonthAbbreviationEnum["july"] = "jul";
13
- MonthAbbreviationEnum["august"] = "ago";
14
- MonthAbbreviationEnum["september"] = "set";
15
- MonthAbbreviationEnum["october"] = "out";
16
- MonthAbbreviationEnum["november"] = "nov";
17
- MonthAbbreviationEnum["december"] = "dez";
18
- })(MonthAbbreviationEnum || (exports.MonthAbbreviationEnum = MonthAbbreviationEnum = {}));
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MonthNumberEnum = void 0;
4
- var MonthNumberEnum;
5
- (function (MonthNumberEnum) {
6
- MonthNumberEnum["january"] = "01";
7
- MonthNumberEnum["february"] = "02";
8
- MonthNumberEnum["march"] = "03";
9
- MonthNumberEnum["april"] = "04";
10
- MonthNumberEnum["may"] = "05";
11
- MonthNumberEnum["june"] = "06";
12
- MonthNumberEnum["july"] = "07";
13
- MonthNumberEnum["august"] = "08";
14
- MonthNumberEnum["september"] = "09";
15
- MonthNumberEnum["october"] = "10";
16
- MonthNumberEnum["november"] = "11";
17
- MonthNumberEnum["december"] = "12";
18
- })(MonthNumberEnum || (exports.MonthNumberEnum = MonthNumberEnum = {}));
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EmptyArray = exports.FnVal = exports.ValueReturn = exports.SuccessReturn = void 0;
4
- exports.isTruthy = isTruthy;
5
- const guardian_1 = require("#/@tool-box/utils/type-guard/guardian");
6
- /**
7
- * Symbol que representa o estado de sucesso em estruturas de dutos.
8
- * @example
9
- * const isSuccess = result[SuccessReturn];
10
- */
11
- exports.SuccessReturn = Symbol("SuccessReturn");
12
- /**
13
- * Symbol que representa o valor encapsulado em estruturas de dutos.
14
- * @example
15
- * const value = result[ValueReturn];
16
- */
17
- exports.ValueReturn = Symbol("ValueReturn");
18
- /**
19
- * Symbol utilitário para armazenar referência de função/valor.
20
- * @example
21
- * const fnHolder = { [FnVal]: () => "ok" };
22
- */
23
- exports.FnVal = Symbol("FnVal");
24
- /**
25
- * Array vazio imutável para reuso seguro.
26
- * @example
27
- * for (const item of EmptyArray) {
28
- * // não executa
29
- * }
30
- */
31
- exports.EmptyArray = Object.freeze([]);
32
- /**
33
- * Verifica se um valor deve ser tratado como "truthy".
34
- * - Para Date, valida se o timestamp é válido (não-NaN).
35
- * - Para demais tipos, usa coerção booleana.
36
- *
37
- * @param val Valor a ser verificado.
38
- * @returns true quando o valor é considerado válido/truthy.
39
- * @example
40
- * isTruthy("abc"); // true
41
- * isTruthy(""); // false
42
- * isTruthy(new Date()); // true
43
- * isTruthy(new Date("invalid")); // false
44
- */
45
- function isTruthy(val) {
46
- return val instanceof Date ? guardian_1._.isEqual(val.getTime(), val.getTime()) : !!val;
47
- }
@@ -1,128 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Nothing = void 0;
4
- exports.Optional = Optional;
5
- const common_1 = require("#/@tool-box/utils/ducts/common");
6
- class OptionalType {
7
- /**
8
- * Cria uma nova instância de OptionalType.
9
- * @param val Valor interno.
10
- * @param something Indica presença de valor.
11
- * @example
12
- * const some = new (class extends OptionalType<string> {})("x", true);
13
- */
14
- constructor(val, something) {
15
- this[common_1.SuccessReturn] = something;
16
- this[common_1.ValueReturn] = val;
17
- }
18
- /**
19
- * Permite iteração quando houver valor iterável.
20
- * @example
21
- * const maybeArr = Optional([1, 2, 3]);
22
- * for (const n of maybeArr) {
23
- * // 1, 2, 3
24
- * }
25
- */
26
- [Symbol.iterator]() {
27
- return this[common_1.SuccessReturn]
28
- ? this[common_1.ValueReturn][Symbol.iterator]()
29
- : common_1.EmptyArray[Symbol.iterator]();
30
- }
31
- /**
32
- * Verifica se existe valor.
33
- * @returns true se houver valor.
34
- * @example
35
- * Optional("abc").hasSomething(); // true
36
- * Optional("").hasSomething(); // false
37
- */
38
- hasSomething() {
39
- return this[common_1.SuccessReturn];
40
- }
41
- /**
42
- * Verifica se não existe valor.
43
- * @returns true se não houver valor.
44
- * @example
45
- * Optional(null).hasNothing(); // true
46
- */
47
- hasNothing() {
48
- return !this[common_1.SuccessReturn];
49
- }
50
- /**
51
- * Retorna o valor interno.
52
- * @throws {Error} Se não houver valor.
53
- * @example
54
- * Optional(10).unpack(); // 10
55
- */
56
- unpack() {
57
- if (this[common_1.SuccessReturn]) {
58
- return this[common_1.ValueReturn];
59
- }
60
- throw new Error("Failed to unpack optional value. There is nothing in here");
61
- }
62
- /**
63
- * Retorna o valor interno mesmo quando vazio.
64
- * @returns Valor interno ou undefined.
65
- * @example
66
- * Optional("x").unpackAnyway(); // "x"
67
- * Optional("").unpackAnyway(); // undefined
68
- */
69
- unpackAnyway() {
70
- return this[common_1.ValueReturn];
71
- }
72
- /**
73
- * Retorna o valor interno ou valor padrão.
74
- * @param def Valor padrão.
75
- * @example
76
- * Optional("").unpackOr("default"); // "default"
77
- */
78
- unpackOr(def) {
79
- return this[common_1.SuccessReturn] ? this[common_1.ValueReturn] : def;
80
- }
81
- /**
82
- * Retorna o valor interno ou calcula valor padrão sob demanda.
83
- * @param f Função para gerar valor padrão.
84
- * @example
85
- * Optional("").unpackOrElse(() => "fallback"); // "fallback"
86
- */
87
- unpackOrElse(f) {
88
- return this[common_1.SuccessReturn] ? this[common_1.ValueReturn] : f();
89
- }
90
- }
91
- /**
92
- * Cria um Optional a partir de um valor.
93
- * Valores falsey e Error resultam em Nothing.
94
- * @param val Valor de entrada.
95
- * @example
96
- * Optional("abc").hasSomething(); // true
97
- * Optional(0).hasNothing(); // true
98
- */
99
- function Optional(val) {
100
- return from(val);
101
- }
102
- /**
103
- * Cria um Optional no estado Something.
104
- * @param val Valor presente.
105
- * @example
106
- * const some = Something("ok");
107
- */
108
- function Something(val) {
109
- return new OptionalType(val, true);
110
- }
111
- /**
112
- * Singleton representando ausência de valor.
113
- * @example
114
- * Nothing.hasNothing(); // true
115
- */
116
- exports.Nothing = Object.freeze(new OptionalType(undefined, false));
117
- /**
118
- * Converte valor para Optional conforme regra de truthy.
119
- * @param val Valor de entrada.
120
- * @example
121
- * from("x").hasSomething(); // true
122
- * from(false).hasNothing(); // true
123
- */
124
- function from(val) {
125
- return (0, common_1.isTruthy)(val) && !(val instanceof Error)
126
- ? Something(val)
127
- : exports.Nothing;
128
- }
@@ -1,67 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ReturnType = void 0;
4
- exports.Return = Return;
5
- exports.Success = Success;
6
- exports.Failure = Failure;
7
- const common_1 = require("#/@tool-box/utils/ducts/common");
8
- class ReturnType {
9
- constructor(value, hasSuccess) {
10
- this[common_1.ValueReturn] = value;
11
- this[common_1.SuccessReturn] = hasSuccess;
12
- }
13
- [Symbol.iterator]() {
14
- if (!this[common_1.SuccessReturn]) {
15
- return common_1.EmptyArray[Symbol.iterator]();
16
- }
17
- const value = this[common_1.ValueReturn];
18
- if (value !== null &&
19
- value !== undefined &&
20
- typeof value[Symbol.iterator] ===
21
- "function") {
22
- return value[Symbol.iterator]();
23
- }
24
- return common_1.EmptyArray[Symbol.iterator]();
25
- }
26
- hasSuccess() {
27
- return this[common_1.SuccessReturn];
28
- }
29
- hasFailure() {
30
- return !this[common_1.SuccessReturn];
31
- }
32
- unwrap() {
33
- if (this[common_1.SuccessReturn]) {
34
- return this[common_1.ValueReturn];
35
- }
36
- throw new Error("Failed to unwrap Return. There is failure in here");
37
- }
38
- unwrapFail() {
39
- if (this[common_1.SuccessReturn]) {
40
- throw new Error("Failed to unwrapFail Return. There is success in here");
41
- }
42
- return this[common_1.ValueReturn];
43
- }
44
- unwrapOr(def) {
45
- return this[common_1.SuccessReturn]
46
- ? this[common_1.ValueReturn]
47
- : def;
48
- }
49
- unwrapAnyway() {
50
- return this[common_1.ValueReturn];
51
- }
52
- }
53
- exports.ReturnType = ReturnType;
54
- function Return(val) {
55
- return from(val);
56
- }
57
- function Success(successValue) {
58
- return new ReturnType(successValue, true);
59
- }
60
- function Failure(failureValue) {
61
- return new ReturnType(failureValue, false);
62
- }
63
- function from(val) {
64
- return (0, common_1.isTruthy)(val)
65
- ? new ReturnType(val, !(val instanceof Error))
66
- : Failure(null);
67
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HttpProviderFailureResponse = void 0;
4
- const failure_abstract_1 = require("#/objects/failure/edges/failure.abstract");
5
- class HttpProviderFailureResponse extends failure_abstract_1.FailureAbstract {
6
- constructor(_message, _statusCode, _request) {
7
- super({
8
- failureClass: HttpProviderFailureResponse,
9
- message: `${_message}`,
10
- });
11
- this._message = _message;
12
- this._statusCode = _statusCode;
13
- this._request = _request;
14
- }
15
- hasStatus(status) {
16
- return this._statusCode === status;
17
- }
18
- }
19
- exports.HttpProviderFailureResponse = HttpProviderFailureResponse;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HttpProviderSuccessResponse = void 0;
4
- const class_transformer_1 = require("class-transformer");
5
- const class_validator_1 = require("class-validator");
6
- class HttpProviderSuccessResponse {
7
- constructor(statusCode, data) {
8
- this.statusCode = statusCode;
9
- this.data = data;
10
- }
11
- hasStatus(status) {
12
- return this.statusCode === status;
13
- }
14
- async getData(dataType) {
15
- const data = (0, class_transformer_1.plainToClass)(dataType, this.data);
16
- await (0, class_validator_1.validateOrReject)(data);
17
- return data;
18
- }
19
- }
20
- exports.HttpProviderSuccessResponse = HttpProviderSuccessResponse;