@devix-tecnologia/value-objects 2.1.4

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 (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +42 -0
  3. package/dist/cjs/cpf_cnpj/index.js +152 -0
  4. package/dist/cjs/imagem_base64/image-formats.js +90 -0
  5. package/dist/cjs/imagem_base64/index.js +132 -0
  6. package/dist/cjs/index.js +9 -0
  7. package/dist/cjs/telefone/country_codes.js +1146 -0
  8. package/dist/cjs/telefone/ddd.js +73 -0
  9. package/dist/cjs/telefone/index.js +127 -0
  10. package/dist/cjs/types/base_class.js +2 -0
  11. package/dist/cjs/types/cpf_cnpj/index.d.ts +25 -0
  12. package/dist/cjs/types/cpf_cnpj/index.d.ts.map +1 -0
  13. package/dist/cjs/types/imagem_base64/image-formats.d.ts +14 -0
  14. package/dist/cjs/types/imagem_base64/image-formats.d.ts.map +1 -0
  15. package/dist/cjs/types/imagem_base64/index.d.ts +32 -0
  16. package/dist/cjs/types/imagem_base64/index.d.ts.map +1 -0
  17. package/dist/cjs/types/index.d.ts +5 -0
  18. package/dist/cjs/types/index.d.ts.map +1 -0
  19. package/dist/cjs/types/telefone/country_codes.d.ts +7 -0
  20. package/dist/cjs/types/telefone/country_codes.d.ts.map +1 -0
  21. package/dist/cjs/types/telefone/ddd.d.ts +3 -0
  22. package/dist/cjs/types/telefone/ddd.d.ts.map +1 -0
  23. package/dist/cjs/types/telefone/index.d.ts +38 -0
  24. package/dist/cjs/types/telefone/index.d.ts.map +1 -0
  25. package/dist/cjs/types/types/base_class.d.ts +26 -0
  26. package/dist/cjs/types/types/base_class.d.ts.map +1 -0
  27. package/dist/esm/cpf_cnpj/index.js +151 -0
  28. package/dist/esm/imagem_base64/image-formats.js +86 -0
  29. package/dist/esm/imagem_base64/index.js +129 -0
  30. package/dist/esm/index.mjs +4 -0
  31. package/dist/esm/package.json +1 -0
  32. package/dist/esm/telefone/country_codes.js +1143 -0
  33. package/dist/esm/telefone/ddd.js +70 -0
  34. package/dist/esm/telefone/index.js +124 -0
  35. package/dist/esm/types/base_class.js +1 -0
  36. package/dist/esm/types/cpf_cnpj/index.d.ts +25 -0
  37. package/dist/esm/types/cpf_cnpj/index.d.ts.map +1 -0
  38. package/dist/esm/types/imagem_base64/image-formats.d.ts +14 -0
  39. package/dist/esm/types/imagem_base64/image-formats.d.ts.map +1 -0
  40. package/dist/esm/types/imagem_base64/index.d.ts +32 -0
  41. package/dist/esm/types/imagem_base64/index.d.ts.map +1 -0
  42. package/dist/esm/types/index.d.ts +5 -0
  43. package/dist/esm/types/index.d.ts.map +1 -0
  44. package/dist/esm/types/telefone/country_codes.d.ts +7 -0
  45. package/dist/esm/types/telefone/country_codes.d.ts.map +1 -0
  46. package/dist/esm/types/telefone/ddd.d.ts +3 -0
  47. package/dist/esm/types/telefone/ddd.d.ts.map +1 -0
  48. package/dist/esm/types/telefone/index.d.ts +38 -0
  49. package/dist/esm/types/telefone/index.d.ts.map +1 -0
  50. package/dist/esm/types/types/base_class.d.ts +26 -0
  51. package/dist/esm/types/types/base_class.d.ts.map +1 -0
  52. package/package.json +71 -0
@@ -0,0 +1,70 @@
1
+ const DDD = {
2
+ '11': 'SP',
3
+ '12': 'SP',
4
+ '13': 'SP',
5
+ '14': 'SP',
6
+ '15': 'SP',
7
+ '16': 'SP',
8
+ '17': 'SP',
9
+ '18': 'SP',
10
+ '19': 'SP',
11
+ '21': 'RJ',
12
+ '22': 'RJ',
13
+ '24': 'RJ',
14
+ '27': 'ES',
15
+ '28': 'ES',
16
+ '31': 'MG',
17
+ '32': 'MG',
18
+ '33': 'MG',
19
+ '34': 'MG',
20
+ '35': 'MG',
21
+ '37': 'MG',
22
+ '38': 'MG',
23
+ '41': 'PR',
24
+ '42': 'PR',
25
+ '43': 'PR',
26
+ '44': 'PR',
27
+ '45': 'PR',
28
+ '46': 'PR',
29
+ '47': 'SC',
30
+ '48': 'SC',
31
+ '49': 'SC',
32
+ '51': 'RS',
33
+ '53': 'RS',
34
+ '54': 'RS',
35
+ '55': 'RS',
36
+ '61': 'DF',
37
+ '62': 'GO',
38
+ '63': 'TO',
39
+ '64': 'GO',
40
+ '65': 'MT',
41
+ '66': 'MT',
42
+ '67': 'MS',
43
+ '68': 'AC',
44
+ '69': 'RO',
45
+ '71': 'BA',
46
+ '73': 'BA',
47
+ '74': 'BA',
48
+ '75': 'BA',
49
+ '77': 'BA',
50
+ '79': 'SE',
51
+ '81': 'PE',
52
+ '82': 'AL',
53
+ '83': 'PB',
54
+ '84': 'RN',
55
+ '85': 'CE',
56
+ '86': 'PI',
57
+ '87': 'PE',
58
+ '88': 'CE',
59
+ '89': 'PI',
60
+ '91': 'PA',
61
+ '92': 'AM',
62
+ '93': 'PA',
63
+ '94': 'PA',
64
+ '95': 'RR',
65
+ '96': 'AP',
66
+ '97': 'AM',
67
+ '98': 'MA',
68
+ '99': 'MA',
69
+ };
70
+ export { DDD };
@@ -0,0 +1,124 @@
1
+ import { countryCodes } from './country_codes.js';
2
+ import { DDD } from './ddd.js';
3
+ /**
4
+ * Cria objeto de valor para número de telefone.
5
+ * Valida DDD e código do país.
6
+ * É possível cadastrar usando formato string para números Brasileiros.
7
+ * Aceita formatos como: 27 97645-5555 ou 55 27 97645-5555.
8
+ * Desconsidera espaços e qq caracter não numérico
9
+ */
10
+ class Telefone {
11
+ _phoneNum = '';
12
+ _areaCode = '';
13
+ _countryCode = '';
14
+ _isValid = false;
15
+ static VERSION = '1.0.0';
16
+ constructor(phoneNum) {
17
+ if (typeof phoneNum === 'string') {
18
+ this.parseFromString(phoneNum);
19
+ }
20
+ else {
21
+ this.parseFromObject(phoneNum);
22
+ }
23
+ }
24
+ parseFromString(phoneStr) {
25
+ let tel = phoneStr.replace(/[^\d]+/g, '');
26
+ if ((tel.length === 12 || tel.length === 11) && tel[0] === '0') {
27
+ tel = tel.slice(1);
28
+ }
29
+ if (tel.length === 10 || tel.length === 11) {
30
+ this._countryCode = '55';
31
+ this._areaCode = tel.slice(0, 2);
32
+ this._phoneNum = tel.slice(2);
33
+ this._isValid = this.isDDDValid();
34
+ }
35
+ else if (tel.length === 12 || tel.length === 13) {
36
+ this._countryCode = tel.slice(0, 2);
37
+ this._areaCode = tel.slice(2, 4);
38
+ this._phoneNum = tel.slice(4);
39
+ this._isValid = this.isDDDValid() && this._countryCode === '55';
40
+ }
41
+ else {
42
+ throw new Error('Could not parse phone number from string. Try creating the record using an object { countryCode: string; areaCode: string; phoneNum: string }');
43
+ }
44
+ }
45
+ parseFromObject(phone) {
46
+ this._countryCode = phone.countryCode.replace(/[^\d]+/g, '');
47
+ this._areaCode = phone.areaCode.replace(/[^\d]+/g, '');
48
+ this._phoneNum = phone.phoneNum.replace(/[^\d]+/g, '');
49
+ if (this._countryCode === '55') {
50
+ this._isValid = this.isDDDValid() && this.isCountryCodeValid();
51
+ }
52
+ else {
53
+ this._isValid = this.isCountryCodeValid();
54
+ }
55
+ }
56
+ get type() {
57
+ return 'PHONE';
58
+ }
59
+ get version() {
60
+ return Telefone.VERSION;
61
+ }
62
+ get validation() {
63
+ if (this._countryCode === '55') {
64
+ return 'Validação de DDD brasileiro e código de país';
65
+ }
66
+ return 'Validação de código de país';
67
+ }
68
+ get formatted() {
69
+ this.isValid({ raiseException: true });
70
+ const num = this._phoneNum.split('');
71
+ const lastDigits = num.splice(-4, 4);
72
+ return `+${this._countryCode} ${this._areaCode} ${num.join('')}-${lastDigits.join('')}`;
73
+ }
74
+ get onlyNumbers() {
75
+ this.isValid({ raiseException: true });
76
+ return `${this._countryCode}${this._areaCode}${this._phoneNum}`;
77
+ }
78
+ get country() {
79
+ return countryCodes[this._countryCode].code;
80
+ }
81
+ get estate() {
82
+ if (this._countryCode === '55')
83
+ return DDD[this._areaCode];
84
+ return null;
85
+ }
86
+ toJSON() {
87
+ return {
88
+ type: this.type,
89
+ value: this.onlyNumbers,
90
+ formatted: this.formatted,
91
+ isValid: this._isValid,
92
+ version: this.version,
93
+ country: this.country,
94
+ estate: this.estate,
95
+ };
96
+ }
97
+ toString() {
98
+ return this.formatted;
99
+ }
100
+ isValid(config = { raiseException: false }) {
101
+ if (config.raiseException && !this._isValid) {
102
+ throw new Error('Invalid phone number');
103
+ }
104
+ return this._isValid;
105
+ }
106
+ equals(other) {
107
+ if (!this._isValid)
108
+ return false;
109
+ try {
110
+ const otherPhone = other instanceof Telefone ? other : new Telefone(other);
111
+ return this.onlyNumbers === otherPhone.onlyNumbers;
112
+ }
113
+ catch {
114
+ return false;
115
+ }
116
+ }
117
+ isDDDValid() {
118
+ return DDD[this._areaCode] !== undefined;
119
+ }
120
+ isCountryCodeValid() {
121
+ return countryCodes[this._countryCode] !== undefined;
122
+ }
123
+ }
124
+ export { Telefone };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ import { IBaseClassNumbers, ValidConfig } from '../types/base_class.js';
2
+ declare class CpfCnpj implements IBaseClassNumbers {
3
+ private _docId;
4
+ private _docType;
5
+ private _isValid;
6
+ private static readonly VERSION;
7
+ constructor(numDoc: string | number);
8
+ get type(): string;
9
+ get version(): string;
10
+ get validation(): string;
11
+ get formatted(): string;
12
+ get onlyNumbers(): string;
13
+ toJSON(): object;
14
+ toString(): string;
15
+ isValid(config?: ValidConfig): boolean;
16
+ equals(other: CpfCnpj | unknown): boolean;
17
+ static newCpf(): CpfCnpj;
18
+ static newCnpj(): CpfCnpj;
19
+ private isCpfValid;
20
+ private isCnpjValid;
21
+ private static CpfVerifierDigits;
22
+ private static CnpjVerifierDigits;
23
+ }
24
+ export { CpfCnpj };
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cpf_cnpj/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAIvE,cAAM,OAAQ,YAAW,iBAAiB;IACxC,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAU;gBAE7B,MAAM,EAAE,MAAM,GAAG,MAAM;IAcnC,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,UAAU,IAAI,MAAM,CAIvB;IAED,IAAI,SAAS,IAAI,MAAM,CAatB;IAED,IAAI,WAAW,IAAI,MAAM,CAGxB;IAED,MAAM,IAAI,MAAM;IAUhB,QAAQ,IAAI,MAAM;IAIlB,OAAO,CAAC,MAAM,GAAE,WAAuC,GAAG,OAAO;IAOjE,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO;IAYzC,MAAM,CAAC,MAAM,IAAI,OAAO;IAUxB,MAAM,CAAC,OAAO,IAAI,OAAO;IAUzB,OAAO,CAAC,UAAU;IAuBlB,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAUhC,OAAO,CAAC,MAAM,CAAC,kBAAkB;CAiBlC;AAED,OAAO,EAAE,OAAO,EAAE,CAAA"}
@@ -0,0 +1,14 @@
1
+ interface ImageFormatInfo {
2
+ name: string;
3
+ extension: string;
4
+ mimeType: string;
5
+ base64Prefix: string[];
6
+ }
7
+ declare const imageFormats: Record<string, ImageFormatInfo>;
8
+ type ImageFormat = keyof typeof imageFormats | 'unknown';
9
+ /**
10
+ * Detecta o formato da imagem pelo seu prefixo base64
11
+ */
12
+ declare function findFormatByPrefix(base64Str: string): ImageFormat;
13
+ export { imageFormats, type ImageFormat, type ImageFormatInfo, findFormatByPrefix, };
14
+ //# sourceMappingURL=image-formats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-formats.d.ts","sourceRoot":"","sources":["../../../../src/imagem_base64/image-formats.ts"],"names":[],"mappings":"AAAA,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,EAAE,CAAA;CACvB;AAED,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAyExC,CAAA;AAEV,KAAK,WAAW,GAAG,MAAM,OAAO,YAAY,GAAG,SAAS,CAAA;AAExD;;GAEG;AACH,iBAAS,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,CAO1D;AAED,OAAO,EACL,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,kBAAkB,GACnB,CAAA"}
@@ -0,0 +1,32 @@
1
+ import { IBaseClassText, ValidConfig } from '../types/base_class.js';
2
+ import { type ImageFormat, type ImageFormatInfo } from './image-formats.js';
3
+ /**
4
+ * Cria objeto de valor para imagens em base64.
5
+ * Valida se a string fornecida é uma imagem base64 válida.
6
+ * Detecta o formato da imagem.
7
+ * Aceita tanto strings base64 puras quanto data URIs.
8
+ */
9
+ declare class ImagemBase64 implements IBaseClassText {
10
+ private _content;
11
+ private _format;
12
+ private _isValid;
13
+ private _isDataUri;
14
+ private static readonly VERSION;
15
+ constructor(content: string);
16
+ get type(): string;
17
+ get version(): string;
18
+ get validation(): string;
19
+ get formatted(): string;
20
+ get format(): ImageFormat;
21
+ get content(): string;
22
+ get formatInfo(): ImageFormatInfo;
23
+ private get DataUri();
24
+ toJSON(): object;
25
+ toString(): string;
26
+ isValid(config?: ValidConfig): boolean;
27
+ equals(other: ImagemBase64 | unknown): boolean;
28
+ private validate;
29
+ private isBase64String;
30
+ }
31
+ export { ImagemBase64 };
32
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/imagem_base64/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpE,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,eAAe,EAErB,MAAM,oBAAoB,CAAA;AAE3B;;;;;GAKG;AACH,cAAM,YAAa,YAAW,cAAc;IAC1C,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,OAAO,CAAyB;IACxC,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,UAAU,CAAiB;IACnC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAU;gBAE7B,OAAO,EAAE,MAAM;IAK3B,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,MAAM,IAAI,WAAW,CAGxB;IAED,IAAI,OAAO,IAAI,MAAM,CAGpB;IAED,IAAI,UAAU,IAAI,eAAe,CAGhC;IAED,OAAO,KAAK,OAAO,GAMlB;IAED,MAAM,IAAI,MAAM;IAoBhB,QAAQ,IAAI,MAAM;IAKlB,OAAO,CAAC,MAAM,GAAE,WAAuC,GAAG,OAAO;IAOjE,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,GAAG,OAAO;IAgB9C,OAAO,CAAC,QAAQ;IA8BhB,OAAO,CAAC,cAAc;CAUvB;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { Telefone } from './telefone/index.js';
2
+ import { CpfCnpj } from './cpf_cnpj/index.js';
3
+ import { ImagemBase64 } from './imagem_base64/index.js';
4
+ export { Telefone, CpfCnpj, ImagemBase64 };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,CAAA"}
@@ -0,0 +1,7 @@
1
+ declare const countryCodes: Record<string, {
2
+ name: string;
3
+ code: string;
4
+ dial_code: string;
5
+ }>;
6
+ export { countryCodes };
7
+ //# sourceMappingURL=country_codes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"country_codes.d.ts","sourceRoot":"","sources":["../../../../src/telefone/country_codes.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,YAAY,EAAE,MAAM,CACxB,MAAM,EACN;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAsnClD,CAAA;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
@@ -0,0 +1,3 @@
1
+ declare const DDD: Record<string, string>;
2
+ export { DDD };
3
+ //# sourceMappingURL=ddd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ddd.d.ts","sourceRoot":"","sources":["../../../../src/telefone/ddd.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAoE/B,CAAA;AACD,OAAO,EAAE,GAAG,EAAE,CAAA"}
@@ -0,0 +1,38 @@
1
+ import { IBaseClassNumbers, ValidConfig } from '../types/base_class.js';
2
+ interface PhoneInput {
3
+ countryCode: string;
4
+ areaCode: string;
5
+ phoneNum: string;
6
+ }
7
+ /**
8
+ * Cria objeto de valor para número de telefone.
9
+ * Valida DDD e código do país.
10
+ * É possível cadastrar usando formato string para números Brasileiros.
11
+ * Aceita formatos como: 27 97645-5555 ou 55 27 97645-5555.
12
+ * Desconsidera espaços e qq caracter não numérico
13
+ */
14
+ declare class Telefone implements IBaseClassNumbers {
15
+ private _phoneNum;
16
+ private _areaCode;
17
+ private _countryCode;
18
+ private _isValid;
19
+ private static readonly VERSION;
20
+ constructor(phoneNum: string | PhoneInput);
21
+ private parseFromString;
22
+ private parseFromObject;
23
+ get type(): string;
24
+ get version(): string;
25
+ get validation(): string;
26
+ get formatted(): string;
27
+ get onlyNumbers(): string;
28
+ get country(): string;
29
+ get estate(): string | null;
30
+ toJSON(): object;
31
+ toString(): string;
32
+ isValid(config?: ValidConfig): boolean;
33
+ equals(other: Telefone | unknown): boolean;
34
+ private isDDDValid;
35
+ private isCountryCodeValid;
36
+ }
37
+ export { Telefone, type PhoneInput };
38
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/telefone/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEvE,UAAU,UAAU;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;;;;;GAMG;AACH,cAAM,QAAS,YAAW,iBAAiB;IACzC,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAU;gBAE7B,QAAQ,EAAE,MAAM,GAAG,UAAU;IAQzC,OAAO,CAAC,eAAe;IAwBvB,OAAO,CAAC,eAAe;IAYvB,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,UAAU,IAAI,MAAM,CAKvB;IAED,IAAI,SAAS,IAAI,MAAM,CAKtB;IAED,IAAI,WAAW,IAAI,MAAM,CAGxB;IAED,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,MAAM,IAAI,MAAM,GAAG,IAAI,CAG1B;IAED,MAAM,IAAI,MAAM;IAYhB,QAAQ,IAAI,MAAM;IAIlB,OAAO,CAAC,MAAM,GAAE,WAAuC,GAAG,OAAO;IAOjE,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO;IAY1C,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,kBAAkB;CAG3B;AAED,OAAO,EAAE,QAAQ,EAAE,KAAK,UAAU,EAAE,CAAA"}
@@ -0,0 +1,26 @@
1
+ interface ValidConfig {
2
+ raiseException: boolean;
3
+ }
4
+ interface IMetadata {
5
+ get type(): string;
6
+ get version(): string;
7
+ get validation(): string;
8
+ }
9
+ interface IBaseClass<T> extends IMetadata {
10
+ get formatted(): string;
11
+ isValid(config: ValidConfig): boolean;
12
+ equals(other: T | unknown): boolean;
13
+ toJSON(): object;
14
+ toString(): string;
15
+ }
16
+ interface IBaseClassNumbers extends IBaseClass<IBaseClassNumbers> {
17
+ get onlyNumbers(): string;
18
+ }
19
+ interface IBaseClassText extends IBaseClass<IBaseClassText> {
20
+ }
21
+ interface IBase64<T = unknown> extends IBaseClass<T> {
22
+ get onlyContent(): string;
23
+ get dataUri(): string;
24
+ }
25
+ export type { IBaseClassNumbers, IBaseClassText, IBase64, ValidConfig };
26
+ //# sourceMappingURL=base_class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base_class.d.ts","sourceRoot":"","sources":["../../../../src/types/base_class.ts"],"names":[],"mappings":"AAAA,UAAU,WAAW;IACnB,cAAc,EAAE,OAAO,CAAA;CACxB;AAED,UAAU,SAAS;IACjB,IAAI,IAAI,IAAI,MAAM,CAAA;IAClB,IAAI,OAAO,IAAI,MAAM,CAAA;IACrB,IAAI,UAAU,IAAI,MAAM,CAAA;CACzB;AAED,UAAU,UAAU,CAAC,CAAC,CAAE,SAAQ,SAAS;IACvC,IAAI,SAAS,IAAI,MAAM,CAAA;IACvB,OAAO,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAA;IACrC,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,GAAG,OAAO,CAAA;IACnC,MAAM,IAAI,MAAM,CAAA;IAChB,QAAQ,IAAI,MAAM,CAAA;CACnB;AAED,UAAU,iBAAkB,SAAQ,UAAU,CAAC,iBAAiB,CAAC;IAC/D,IAAI,WAAW,IAAI,MAAM,CAAA;CAC1B;AAED,UAAU,cAAe,SAAQ,UAAU,CAAC,cAAc,CAAC;CAAG;AAE9D,UAAU,OAAO,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;IAClD,IAAI,WAAW,IAAI,MAAM,CAAA;IACzB,IAAI,OAAO,IAAI,MAAM,CAAA;CACtB;AAED,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,CAAA"}
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "@devix-tecnologia/value-objects",
3
+ "version": "2.1.4",
4
+ "description": "Coleção de objetos de valores para implementação em sistemas.",
5
+ "main": "./dist/index.js",
6
+ "type": "module",
7
+ "types": "./dist/cjs/types/index.d.ts",
8
+ "files": [
9
+ "dist/**/*",
10
+ "LICENSE",
11
+ "README.md"
12
+ ],
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/devix-tecnologia/value-objects.git"
16
+ },
17
+ "private": false,
18
+ "keywords": [
19
+ "value-objects",
20
+ "devix",
21
+ "devix-tecnologia"
22
+ ],
23
+ "scripts": {
24
+ "test": "vitest run",
25
+ "clean": "rm -rf ./dist",
26
+ "build": "npm run clean && npm run build:esm && npm run build:cjs",
27
+ "build:esm": "tsc -p ./tsconfig.esm.json && mv dist/esm/index.js dist/esm/index.mjs",
28
+ "build:cjs": "tsc -p ./tsconfig.cjs.json",
29
+ "postbuild": "node ./scripts/prepare-package-json",
30
+ "prepack": "npm run build",
31
+ "semantic-release": "semantic-release",
32
+ "format": "prettier --write \"src/**/*.{ts,tsx}\"",
33
+ "lint": "eslint --fix --ext .ts,.tsx --no-error-on-unmatched-pattern --max-warnings=0 --config eslint.config.js src/",
34
+ "publish": "npm publish --access public",
35
+ "publish:npm": "npm publish --access public --registry=https://registry.npmjs.org/"
36
+ },
37
+ "author": "Roberto Seba@Devix Tecnologia 2023",
38
+ "license": "MIT",
39
+ "devDependencies": {
40
+ "@eslint/js": "^9.32.0",
41
+ "@semantic-release/git": "^10.0.1",
42
+ "@semantic-release/github": "^11.0.1",
43
+ "@semantic-release/npm": "^12.0.1",
44
+ "@types/node": "^22.13.4",
45
+ "@typescript-eslint/eslint-plugin": "^8.24.1",
46
+ "@typescript-eslint/parser": "^8.24.1",
47
+ "@vitest/ui": "^3.2.4",
48
+ "assert": "^2.1.0",
49
+ "eslint": "^9.20.1",
50
+ "eslint-config-prettier": "^10.0.1",
51
+ "eslint-plugin-prettier": "^5.1.3",
52
+ "prettier": "^3.5.1",
53
+ "semantic-release": "^24.2.3",
54
+ "ts-node": "^10.9.2",
55
+ "tsx": "^4.7.1",
56
+ "typescript": "^5.3.3",
57
+ "vitest": "^3.2.4"
58
+ },
59
+ "exports": {
60
+ ".": {
61
+ "import": {
62
+ "types": "./dist/esm/types/index.d.ts",
63
+ "default": "./dist/esm/index.mjs"
64
+ },
65
+ "require": {
66
+ "types": "./dist/cjs/types/index.d.ts",
67
+ "default": "./dist/cjs/index.js"
68
+ }
69
+ }
70
+ }
71
+ }