@atlantjs/arch 15.6.7 → 15.7.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/index.js +60 -0
- package/package.json +5 -3
- package/tsconfig-lib.json +1 -0
- 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,269 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UrlEdge = void 0;
|
|
4
|
-
const string_edge_sketch_1 = require("#/objects/primitives/string.edge.sketch");
|
|
5
|
-
class UrlEdge extends string_edge_sketch_1.StringEdgeSketch {
|
|
6
|
-
constructor(_url) {
|
|
7
|
-
super(_url);
|
|
8
|
-
this._url = _url;
|
|
9
|
-
this.validateUrl();
|
|
10
|
-
}
|
|
11
|
-
validateUrl() {
|
|
12
|
-
try {
|
|
13
|
-
new URL(this._url);
|
|
14
|
-
}
|
|
15
|
-
catch {
|
|
16
|
-
throw new Error(`${this._url} should be a valid URL.`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
// ==================== Getters ====================
|
|
20
|
-
/**
|
|
21
|
-
* Retorna a URL completa como string.
|
|
22
|
-
* @returns String com a URL completa
|
|
23
|
-
* @example
|
|
24
|
-
* new UrlEdge("https://example.com/path?q=1").toString()
|
|
25
|
-
* // "https://example.com/path?q=1"
|
|
26
|
-
*/
|
|
27
|
-
toString() {
|
|
28
|
-
return this._url;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Retorna o protocolo da URL (sem "://").
|
|
32
|
-
* @returns String com o protocolo
|
|
33
|
-
* @example
|
|
34
|
-
* new UrlEdge("https://example.com").getProtocol() // "https:"
|
|
35
|
-
* new UrlEdge("http://example.com").getProtocol() // "http:"
|
|
36
|
-
*/
|
|
37
|
-
getProtocol() {
|
|
38
|
-
return new URL(this._url).protocol;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Retorna o hostname da URL (sem porta).
|
|
42
|
-
* @returns String com o hostname
|
|
43
|
-
* @example
|
|
44
|
-
* new UrlEdge("https://example.com:8080/path").getHostname() // "example.com"
|
|
45
|
-
*/
|
|
46
|
-
getHostname() {
|
|
47
|
-
return new URL(this._url).hostname;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Retorna o host da URL (hostname + porta, se existir).
|
|
51
|
-
* @returns String com o host
|
|
52
|
-
* @example
|
|
53
|
-
* new UrlEdge("https://example.com:8080/path").getHost() // "example.com:8080"
|
|
54
|
-
* new UrlEdge("https://example.com/path").getHost() // "example.com"
|
|
55
|
-
*/
|
|
56
|
-
getHost() {
|
|
57
|
-
return new URL(this._url).host;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Retorna a porta da URL, se definida.
|
|
61
|
-
* @returns String com a porta ou string vazia se não definida
|
|
62
|
-
* @example
|
|
63
|
-
* new UrlEdge("https://example.com:8080/path").getPort() // "8080"
|
|
64
|
-
* new UrlEdge("https://example.com/path").getPort() // ""
|
|
65
|
-
*/
|
|
66
|
-
getPort() {
|
|
67
|
-
return new URL(this._url).port;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Retorna o pathname da URL.
|
|
71
|
-
* @returns String com o caminho da URL
|
|
72
|
-
* @example
|
|
73
|
-
* new UrlEdge("https://example.com/foo/bar").getPathname() // "/foo/bar"
|
|
74
|
-
* new UrlEdge("https://example.com").getPathname() // "/"
|
|
75
|
-
*/
|
|
76
|
-
getPathname() {
|
|
77
|
-
return new URL(this._url).pathname;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Retorna a query string da URL (incluindo "?").
|
|
81
|
-
* @returns String com a query string ou string vazia se não existir
|
|
82
|
-
* @example
|
|
83
|
-
* new UrlEdge("https://example.com/path?q=1&page=2").getSearch() // "?q=1&page=2"
|
|
84
|
-
* new UrlEdge("https://example.com/path").getSearch() // ""
|
|
85
|
-
*/
|
|
86
|
-
getSearch() {
|
|
87
|
-
return new URL(this._url).search;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Retorna o valor de um parâmetro específico da query string.
|
|
91
|
-
* @param key - Nome do parâmetro a buscar
|
|
92
|
-
* @returns Valor do parâmetro ou null se não existir
|
|
93
|
-
* @example
|
|
94
|
-
* new UrlEdge("https://example.com?q=hello&page=2").getSearchParam("q") // "hello"
|
|
95
|
-
* new UrlEdge("https://example.com?q=hello").getSearchParam("page") // null
|
|
96
|
-
*/
|
|
97
|
-
getSearchParam(key) {
|
|
98
|
-
return new URL(this._url).searchParams.get(key);
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Retorna todos os parâmetros da query string como objeto.
|
|
102
|
-
* @returns Objeto com chave/valor de todos os parâmetros
|
|
103
|
-
* @example
|
|
104
|
-
* new UrlEdge("https://example.com?q=hello&page=2").getSearchParams()
|
|
105
|
-
* // { q: "hello", page: "2" }
|
|
106
|
-
*/
|
|
107
|
-
getSearchParams() {
|
|
108
|
-
const params = {};
|
|
109
|
-
new URL(this._url).searchParams.forEach((value, key) => {
|
|
110
|
-
params[key] = value;
|
|
111
|
-
});
|
|
112
|
-
return params;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Retorna o hash/fragmento da URL (incluindo "#").
|
|
116
|
-
* @returns String com o hash ou string vazia se não existir
|
|
117
|
-
* @example
|
|
118
|
-
* new UrlEdge("https://example.com/page#section-1").getHash() // "#section-1"
|
|
119
|
-
* new UrlEdge("https://example.com/page").getHash() // ""
|
|
120
|
-
*/
|
|
121
|
-
getHash() {
|
|
122
|
-
return new URL(this._url).hash;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Retorna a origem da URL (protocolo + host).
|
|
126
|
-
* @returns String com a origem
|
|
127
|
-
* @example
|
|
128
|
-
* new UrlEdge("https://example.com:8080/path?q=1").getOrigin() // "https://example.com:8080"
|
|
129
|
-
*/
|
|
130
|
-
getOrigin() {
|
|
131
|
-
return new URL(this._url).origin;
|
|
132
|
-
}
|
|
133
|
-
// ==================== Verificações ====================
|
|
134
|
-
/**
|
|
135
|
-
* Verifica se a URL usa o protocolo HTTPS.
|
|
136
|
-
* @returns true se o protocolo é HTTPS, false caso contrário
|
|
137
|
-
* @example
|
|
138
|
-
* new UrlEdge("https://example.com").isHttps() // true
|
|
139
|
-
* new UrlEdge("http://example.com").isHttps() // false
|
|
140
|
-
*/
|
|
141
|
-
isHttps() {
|
|
142
|
-
return new URL(this._url).protocol === "https:";
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Verifica se a URL usa o protocolo HTTP.
|
|
146
|
-
* @returns true se o protocolo é HTTP, false caso contrário
|
|
147
|
-
* @example
|
|
148
|
-
* new UrlEdge("http://example.com").isHttp() // true
|
|
149
|
-
* new UrlEdge("https://example.com").isHttp() // false
|
|
150
|
-
*/
|
|
151
|
-
isHttp() {
|
|
152
|
-
return new URL(this._url).protocol === "http:";
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Verifica se a URL possui query string.
|
|
156
|
-
* @returns true se a URL tem parâmetros de query, false caso contrário
|
|
157
|
-
* @example
|
|
158
|
-
* new UrlEdge("https://example.com?q=1").hasSearchParams() // true
|
|
159
|
-
* new UrlEdge("https://example.com").hasSearchParams() // false
|
|
160
|
-
*/
|
|
161
|
-
hasSearchParams() {
|
|
162
|
-
return new URL(this._url).searchParams.size > 0;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Verifica se a URL possui um parâmetro específico na query string.
|
|
166
|
-
* @param key - Nome do parâmetro a verificar
|
|
167
|
-
* @returns true se o parâmetro existe, false caso contrário
|
|
168
|
-
* @example
|
|
169
|
-
* new UrlEdge("https://example.com?q=1").hasSearchParam("q") // true
|
|
170
|
-
* new UrlEdge("https://example.com?q=1").hasSearchParam("page") // false
|
|
171
|
-
*/
|
|
172
|
-
hasSearchParam(key) {
|
|
173
|
-
return new URL(this._url).searchParams.has(key);
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Verifica se a URL possui hash/fragmento.
|
|
177
|
-
* @returns true se a URL tem hash, false caso contrário
|
|
178
|
-
* @example
|
|
179
|
-
* new UrlEdge("https://example.com#section").hasHash() // true
|
|
180
|
-
* new UrlEdge("https://example.com").hasHash() // false
|
|
181
|
-
*/
|
|
182
|
-
hasHash() {
|
|
183
|
-
return new URL(this._url).hash.length > 0;
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Verifica se esta URL é igual a outra.
|
|
187
|
-
* @param other - UrlEdge ou string para comparação
|
|
188
|
-
* @returns true se as URLs são iguais, false caso contrário
|
|
189
|
-
* @example
|
|
190
|
-
* const url = new UrlEdge("https://example.com");
|
|
191
|
-
* url.isEqual(new UrlEdge("https://example.com")) // true
|
|
192
|
-
* url.isEqual("https://other.com") // false
|
|
193
|
-
*/
|
|
194
|
-
isEqual(other) {
|
|
195
|
-
const comparand = other instanceof UrlEdge ? other.toString() : other;
|
|
196
|
-
return this._url === comparand;
|
|
197
|
-
}
|
|
198
|
-
// ==================== Transformação ====================
|
|
199
|
-
/**
|
|
200
|
-
* Retorna uma nova URL com um parâmetro de query adicionado ou atualizado.
|
|
201
|
-
* @param key - Nome do parâmetro
|
|
202
|
-
* @param value - Valor do parâmetro
|
|
203
|
-
* @returns Nova instância de UrlEdge com o parâmetro adicionado
|
|
204
|
-
* @example
|
|
205
|
-
* new UrlEdge("https://example.com?q=1").withSearchParam("page", "2")
|
|
206
|
-
* // UrlEdge("https://example.com?q=1&page=2")
|
|
207
|
-
*/
|
|
208
|
-
withSearchParam(key, value) {
|
|
209
|
-
const parsed = new URL(this._url);
|
|
210
|
-
parsed.searchParams.set(key, value);
|
|
211
|
-
return new UrlEdge(parsed.toString());
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Retorna uma nova URL sem um parâmetro de query específico.
|
|
215
|
-
* @param key - Nome do parâmetro a remover
|
|
216
|
-
* @returns Nova instância de UrlEdge sem o parâmetro
|
|
217
|
-
* @example
|
|
218
|
-
* new UrlEdge("https://example.com?q=1&page=2").withoutSearchParam("page")
|
|
219
|
-
* // UrlEdge("https://example.com?q=1")
|
|
220
|
-
*/
|
|
221
|
-
withoutSearchParam(key) {
|
|
222
|
-
const parsed = new URL(this._url);
|
|
223
|
-
parsed.searchParams.delete(key);
|
|
224
|
-
return new UrlEdge(parsed.toString());
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Retorna uma nova URL sem a query string.
|
|
228
|
-
* @returns Nova instância de UrlEdge sem query string
|
|
229
|
-
* @example
|
|
230
|
-
* new UrlEdge("https://example.com/path?q=1&page=2").withoutSearch()
|
|
231
|
-
* // UrlEdge("https://example.com/path")
|
|
232
|
-
*/
|
|
233
|
-
withoutSearch() {
|
|
234
|
-
const parsed = new URL(this._url);
|
|
235
|
-
parsed.search = "";
|
|
236
|
-
return new UrlEdge(parsed.toString());
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Retorna uma nova URL sem o hash/fragmento.
|
|
240
|
-
* @returns Nova instância de UrlEdge sem hash
|
|
241
|
-
* @example
|
|
242
|
-
* new UrlEdge("https://example.com/page#section").withoutHash()
|
|
243
|
-
* // UrlEdge("https://example.com/page")
|
|
244
|
-
*/
|
|
245
|
-
withoutHash() {
|
|
246
|
-
const parsed = new URL(this._url);
|
|
247
|
-
parsed.hash = "";
|
|
248
|
-
return new UrlEdge(parsed.toString());
|
|
249
|
-
}
|
|
250
|
-
// ==================== Métodos Estáticos ====================
|
|
251
|
-
/**
|
|
252
|
-
* Verifica se uma string é uma URL válida sem lançar exceção.
|
|
253
|
-
* @param value - String a ser verificada
|
|
254
|
-
* @returns true se a string é uma URL válida, false caso contrário
|
|
255
|
-
* @example
|
|
256
|
-
* UrlEdge.isValid("https://example.com") // true
|
|
257
|
-
* UrlEdge.isValid("not-a-url") // false
|
|
258
|
-
*/
|
|
259
|
-
static isValid(value) {
|
|
260
|
-
try {
|
|
261
|
-
new URL(value);
|
|
262
|
-
return true;
|
|
263
|
-
}
|
|
264
|
-
catch {
|
|
265
|
-
return false;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
exports.UrlEdge = UrlEdge;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UsernameEdge = void 0;
|
|
4
|
-
const string_edge_sketch_1 = require("#/objects/primitives/string.edge.sketch");
|
|
5
|
-
class UsernameEdge extends string_edge_sketch_1.StringEdgeSketch {
|
|
6
|
-
constructor(username) {
|
|
7
|
-
super(username);
|
|
8
|
-
this.validateUsername();
|
|
9
|
-
}
|
|
10
|
-
validateUsername() {
|
|
11
|
-
if (!UsernameEdge.pattern.test(this.toString())) {
|
|
12
|
-
throw new TypeError(`${this.constructor.name} should be valid (3-30, letters/numbers/._-, no separator at start/end).`);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
// ==================== Getters ====================
|
|
16
|
-
toString() {
|
|
17
|
-
return super.toString();
|
|
18
|
-
}
|
|
19
|
-
toNormalized() {
|
|
20
|
-
return this.toString().toLowerCase();
|
|
21
|
-
}
|
|
22
|
-
// ==================== Verificações ====================
|
|
23
|
-
isEqual(other, ignoreCase = true) {
|
|
24
|
-
const comparand = other instanceof UsernameEdge ? other.toString() : other.trim();
|
|
25
|
-
return ignoreCase
|
|
26
|
-
? this.toString().toLowerCase() === comparand.toLowerCase()
|
|
27
|
-
: this.toString() === comparand;
|
|
28
|
-
}
|
|
29
|
-
hasOnlyAlphanumeric() {
|
|
30
|
-
return /^[a-zA-Z0-9]+$/.test(this.toString());
|
|
31
|
-
}
|
|
32
|
-
startsWithLetter() {
|
|
33
|
-
return /^[a-zA-Z]/.test(this.toString());
|
|
34
|
-
}
|
|
35
|
-
// ==================== Métodos Estáticos ====================
|
|
36
|
-
static isValid(value) {
|
|
37
|
-
return UsernameEdge.pattern.test(value.trim());
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.UsernameEdge = UsernameEdge;
|
|
41
|
-
UsernameEdge.pattern = /^(?=.{3,30}$)[a-zA-Z0-9](?:[a-zA-Z0-9._-]*[a-zA-Z0-9])?$/;
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.UuidSketchEdge = void 0;
|
|
7
|
-
const react_native_uuid_1 = __importDefault(require("react-native-uuid"));
|
|
8
|
-
const index_1 = require("#/index");
|
|
9
|
-
class UuidSketchEdge {
|
|
10
|
-
constructor(value = String(react_native_uuid_1.default.v4())) {
|
|
11
|
-
this.value = value;
|
|
12
|
-
if (!UuidSketchEdge.pattern.test(this.value)) {
|
|
13
|
-
throw new TypeError("The provided UUID is invalid. Please ensure it is in the correct format");
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
// ==================== Getters ====================
|
|
17
|
-
/**
|
|
18
|
-
* Retorna o UUID como string.
|
|
19
|
-
* @returns String no formato UUID v4
|
|
20
|
-
* @example
|
|
21
|
-
* new MyUuidEdge("550e8400-e29b-41d4-a716-446655440000").toString()
|
|
22
|
-
* // "550e8400-e29b-41d4-a716-446655440000"
|
|
23
|
-
*/
|
|
24
|
-
toString() {
|
|
25
|
-
return this.value;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Retorna o UUID sem hífens.
|
|
29
|
-
* @returns String de 32 caracteres hexadecimais sem separadores
|
|
30
|
-
* @example
|
|
31
|
-
* new MyUuidEdge("550e8400-e29b-41d4-a716-446655440000").toRaw()
|
|
32
|
-
* // "550e8400e29b41d4a716446655440000"
|
|
33
|
-
*/
|
|
34
|
-
toRaw() {
|
|
35
|
-
return this.value.replace(/-/g, "");
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Retorna os segmentos do UUID separados em um array.
|
|
39
|
-
* @returns Array com 5 segmentos do UUID
|
|
40
|
-
* @example
|
|
41
|
-
* new MyUuidEdge("550e8400-e29b-41d4-a716-446655440000").toSegments()
|
|
42
|
-
* // ["550e8400", "e29b", "41d4", "a716", "446655440000"]
|
|
43
|
-
*/
|
|
44
|
-
toSegments() {
|
|
45
|
-
return this.value.split("-");
|
|
46
|
-
}
|
|
47
|
-
// ==================== Comparações ====================
|
|
48
|
-
/**
|
|
49
|
-
* Verifica se este UUID é igual a outro.
|
|
50
|
-
* @param other - UuidSketchEdge para comparação
|
|
51
|
-
* @returns true se os UUIDs são iguais, false caso contrário
|
|
52
|
-
* @example
|
|
53
|
-
* const id = new MyUuidEdge("550e8400-e29b-41d4-a716-446655440000");
|
|
54
|
-
* id.isEqual(id) // true
|
|
55
|
-
*/
|
|
56
|
-
isEqual(other) {
|
|
57
|
-
return index_1._.isEqual(this.value, other.toString());
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Verifica se este UUID é diferente de outro.
|
|
61
|
-
* @param other - UuidSketchEdge para comparação
|
|
62
|
-
* @returns true se os UUIDs são diferentes, false caso contrário
|
|
63
|
-
* @example
|
|
64
|
-
* const a = new MyUuidEdge("550e8400-e29b-41d4-a716-446655440000");
|
|
65
|
-
* const b = new MyUuidEdge("661f9511-f3ac-52e5-b827-557766551111");
|
|
66
|
-
* a.isDifferent(b) // true
|
|
67
|
-
*/
|
|
68
|
-
isDifferent(other) {
|
|
69
|
-
return !this.isEqual(other);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* @deprecated Use `isEqual` instead.
|
|
73
|
-
* Verifica se este UUID é igual a outro.
|
|
74
|
-
* @param other - UuidSketchEdge para comparação
|
|
75
|
-
* @returns true se os UUIDs são iguais, false caso contrário
|
|
76
|
-
*/
|
|
77
|
-
equals(other) {
|
|
78
|
-
return this.isEqual(other);
|
|
79
|
-
}
|
|
80
|
-
// ==================== Verificações ====================
|
|
81
|
-
/**
|
|
82
|
-
* Verifica se o UUID está em letras maiúsculas.
|
|
83
|
-
* @returns true se todos os caracteres alfabéticos são maiúsculos
|
|
84
|
-
* @example
|
|
85
|
-
* new MyUuidEdge("550E8400-E29B-41D4-A716-446655440000").isUpperCase() // true
|
|
86
|
-
* new MyUuidEdge("550e8400-e29b-41d4-a716-446655440000").isUpperCase() // false
|
|
87
|
-
*/
|
|
88
|
-
isUpperCase() {
|
|
89
|
-
return this.value === this.value.toUpperCase();
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Verifica se o UUID está em letras minúsculas.
|
|
93
|
-
* @returns true se todos os caracteres alfabéticos são minúsculos
|
|
94
|
-
* @example
|
|
95
|
-
* new MyUuidEdge("550e8400-e29b-41d4-a716-446655440000").isLowerCase() // true
|
|
96
|
-
* new MyUuidEdge("550E8400-E29B-41D4-A716-446655440000").isLowerCase() // false
|
|
97
|
-
*/
|
|
98
|
-
isLowerCase() {
|
|
99
|
-
return this.value === this.value.toLowerCase();
|
|
100
|
-
}
|
|
101
|
-
// ==================== Transformação ====================
|
|
102
|
-
/**
|
|
103
|
-
* Retorna o UUID em letras maiúsculas como string.
|
|
104
|
-
* @returns UUID em maiúsculas
|
|
105
|
-
* @example
|
|
106
|
-
* new MyUuidEdge("550e8400-e29b-41d4-a716-446655440000").toUpperCase()
|
|
107
|
-
* // "550E8400-E29B-41D4-A716-446655440000"
|
|
108
|
-
*/
|
|
109
|
-
toUpperCase() {
|
|
110
|
-
return this.value.toUpperCase();
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Retorna o UUID em letras minúsculas como string.
|
|
114
|
-
* @returns UUID em minúsculas
|
|
115
|
-
* @example
|
|
116
|
-
* new MyUuidEdge("550E8400-E29B-41D4-A716-446655440000").toLowerCase()
|
|
117
|
-
* // "550e8400-e29b-41d4-a716-446655440000"
|
|
118
|
-
*/
|
|
119
|
-
toLowerCase() {
|
|
120
|
-
return this.value.toLowerCase();
|
|
121
|
-
}
|
|
122
|
-
// ==================== Métodos Estáticos ====================
|
|
123
|
-
/**
|
|
124
|
-
* Verifica se uma string é um UUID válido sem lançar exceção.
|
|
125
|
-
* @param value - String a ser verificada
|
|
126
|
-
* @returns true se a string é um UUID válido, false caso contrário
|
|
127
|
-
* @example
|
|
128
|
-
* UuidSketchEdge.isValid("550e8400-e29b-41d4-a716-446655440000") // true
|
|
129
|
-
* UuidSketchEdge.isValid("invalid-uuid") // false
|
|
130
|
-
*/
|
|
131
|
-
static isValid(value) {
|
|
132
|
-
return UuidSketchEdge.pattern.test(value);
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Gera uma nova string UUID v4 sem instanciar a classe.
|
|
136
|
-
* @returns String no formato UUID v4
|
|
137
|
-
* @example
|
|
138
|
-
* UuidSketchEdge.generate() // "a3f8c210-4d92-11ec-81d3-0242ac130003"
|
|
139
|
-
*/
|
|
140
|
-
static generate() {
|
|
141
|
-
return String(react_native_uuid_1.default.v4());
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
exports.UuidSketchEdge = UuidSketchEdge;
|
|
145
|
-
UuidSketchEdge.pattern = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EnvironmentPoint = void 0;
|
|
4
|
-
var EnvironmentPoint;
|
|
5
|
-
(function (EnvironmentPoint) {
|
|
6
|
-
EnvironmentPoint["production"] = "production";
|
|
7
|
-
EnvironmentPoint["homolog"] = "homolog";
|
|
8
|
-
EnvironmentPoint["development"] = "development";
|
|
9
|
-
EnvironmentPoint["test"] = "test";
|
|
10
|
-
})(EnvironmentPoint || (exports.EnvironmentPoint = EnvironmentPoint = {}));
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HeaderTokenNamePoint = void 0;
|
|
4
|
-
var HeaderTokenNamePoint;
|
|
5
|
-
(function (HeaderTokenNamePoint) {
|
|
6
|
-
HeaderTokenNamePoint["authorizationClient"] = "authorization_client";
|
|
7
|
-
HeaderTokenNamePoint["requireRolesClient"] = "require_roles_client";
|
|
8
|
-
HeaderTokenNamePoint["authorizationUser"] = "authorization_user";
|
|
9
|
-
HeaderTokenNamePoint["requireRolesUser"] = "require_roles_user";
|
|
10
|
-
})(HeaderTokenNamePoint || (exports.HeaderTokenNamePoint = HeaderTokenNamePoint = {}));
|