tychat-contracts 1.6.59 → 1.6.61
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/dist/anamneses/anamnesis-token-session.dto.d.ts +5 -0
- package/dist/anamneses/anamnesis-token-session.dto.d.ts.map +1 -1
- package/dist/anamneses/anamnesis-token-session.dto.js +25 -0
- package/dist/anamneses/normalize-anamnesis-access-token.d.ts +9 -0
- package/dist/anamneses/normalize-anamnesis-access-token.d.ts.map +1 -0
- package/dist/anamneses/normalize-anamnesis-access-token.js +21 -0
- package/dist/anamneses/normalize-anamnesis-access-token.spec.d.ts +2 -0
- package/dist/anamneses/normalize-anamnesis-access-token.spec.d.ts.map +1 -0
- package/dist/anamneses/normalize-anamnesis-access-token.spec.js +18 -0
- package/dist/patients/create-patient.dto.d.ts +2 -0
- package/dist/patients/create-patient.dto.d.ts.map +1 -1
- package/dist/patients/create-patient.dto.js +24 -0
- package/package.json +1 -1
- package/src/anamneses/anamnesis-token-session.dto.ts +15 -0
- package/src/patients/create-patient.dto.ts +20 -0
|
@@ -4,6 +4,11 @@ export declare class AnamnesisTokenSessionPatientDto {
|
|
|
4
4
|
name: string;
|
|
5
5
|
cpf: string | null;
|
|
6
6
|
phone: string | null;
|
|
7
|
+
rg: string | null;
|
|
8
|
+
birthDate: string | null;
|
|
9
|
+
email: string | null;
|
|
10
|
+
address: string | null;
|
|
11
|
+
emergencyContact: string | null;
|
|
7
12
|
}
|
|
8
13
|
export declare class AnamnesisTokenSessionDto {
|
|
9
14
|
valid: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anamnesis-token-session.dto.d.ts","sourceRoot":"","sources":["../../src/anamneses/anamnesis-token-session.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,qBAAa,+BAA+B;IAE1C,EAAE,EAAE,MAAM,CAAC;IAGX,IAAI,EAAE,MAAM,CAAC;IAGb,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAGnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"anamnesis-token-session.dto.d.ts","sourceRoot":"","sources":["../../src/anamneses/anamnesis-token-session.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,qBAAa,+BAA+B;IAE1C,EAAE,EAAE,MAAM,CAAC;IAGX,IAAI,EAAE,MAAM,CAAC;IAGb,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAGnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAGrB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAGlB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAGzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAGrB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAGvB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,qBAAa,wBAAwB;IAEnC,KAAK,EAAE,OAAO,CAAC;IAMf,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,eAAe,CAAC;IAGhE,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,OAAO,CAAC,EAAE,+BAA+B,CAAC;IAM1C,qBAAqB,CAAC,EAAE,uBAAuB,EAAE,CAAC;CACnD"}
|
|
@@ -17,6 +17,11 @@ class AnamnesisTokenSessionPatientDto {
|
|
|
17
17
|
name;
|
|
18
18
|
cpf;
|
|
19
19
|
phone;
|
|
20
|
+
rg;
|
|
21
|
+
birthDate;
|
|
22
|
+
email;
|
|
23
|
+
address;
|
|
24
|
+
emergencyContact;
|
|
20
25
|
}
|
|
21
26
|
exports.AnamnesisTokenSessionPatientDto = AnamnesisTokenSessionPatientDto;
|
|
22
27
|
__decorate([
|
|
@@ -35,6 +40,26 @@ __decorate([
|
|
|
35
40
|
(0, swagger_1.ApiPropertyOptional)({ example: '+5511999999999', nullable: true }),
|
|
36
41
|
__metadata("design:type", Object)
|
|
37
42
|
], AnamnesisTokenSessionPatientDto.prototype, "phone", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, swagger_1.ApiPropertyOptional)({ example: '12.345.678-9', nullable: true }),
|
|
45
|
+
__metadata("design:type", Object)
|
|
46
|
+
], AnamnesisTokenSessionPatientDto.prototype, "rg", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, swagger_1.ApiPropertyOptional)({ example: '1990-05-12', nullable: true }),
|
|
49
|
+
__metadata("design:type", Object)
|
|
50
|
+
], AnamnesisTokenSessionPatientDto.prototype, "birthDate", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, swagger_1.ApiPropertyOptional)({ example: 'maria@email.com', nullable: true }),
|
|
53
|
+
__metadata("design:type", Object)
|
|
54
|
+
], AnamnesisTokenSessionPatientDto.prototype, "email", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, swagger_1.ApiPropertyOptional)({ example: 'Rua Exemplo, 123 — Centro', nullable: true }),
|
|
57
|
+
__metadata("design:type", Object)
|
|
58
|
+
], AnamnesisTokenSessionPatientDto.prototype, "address", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, swagger_1.ApiPropertyOptional)({ example: '+5584999999999', nullable: true }),
|
|
61
|
+
__metadata("design:type", Object)
|
|
62
|
+
], AnamnesisTokenSessionPatientDto.prototype, "emergencyContact", void 0);
|
|
38
63
|
class AnamnesisTokenSessionDto {
|
|
39
64
|
valid;
|
|
40
65
|
reason;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Hex length of `randomBytes(32).toString('hex')` anamnesis tokens. */
|
|
2
|
+
export declare const ANAMNESIS_ACCESS_TOKEN_HEX_LENGTH = 64;
|
|
3
|
+
/**
|
|
4
|
+
* Normalizes a raw token from URL/query/WhatsApp linkification.
|
|
5
|
+
* Meta templates often place punctuation right after {{1}} (e.g. "{{1}}."),
|
|
6
|
+
* which mobile clients include in the tapped URL and breaks SHA-256 lookup.
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizeAnamnesisAccessToken(raw: string | null | undefined): string;
|
|
9
|
+
//# sourceMappingURL=normalize-anamnesis-access-token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-anamnesis-access-token.d.ts","sourceRoot":"","sources":["../../src/anamneses/normalize-anamnesis-access-token.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,eAAO,MAAM,iCAAiC,KAAK,CAAC;AAEpD;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAYpF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ANAMNESIS_ACCESS_TOKEN_HEX_LENGTH = void 0;
|
|
4
|
+
exports.normalizeAnamnesisAccessToken = normalizeAnamnesisAccessToken;
|
|
5
|
+
/** Hex length of `randomBytes(32).toString('hex')` anamnesis tokens. */
|
|
6
|
+
exports.ANAMNESIS_ACCESS_TOKEN_HEX_LENGTH = 64;
|
|
7
|
+
/**
|
|
8
|
+
* Normalizes a raw token from URL/query/WhatsApp linkification.
|
|
9
|
+
* Meta templates often place punctuation right after {{1}} (e.g. "{{1}}."),
|
|
10
|
+
* which mobile clients include in the tapped URL and breaks SHA-256 lookup.
|
|
11
|
+
*/
|
|
12
|
+
function normalizeAnamnesisAccessToken(raw) {
|
|
13
|
+
const trimmed = (raw ?? '').trim();
|
|
14
|
+
if (!trimmed)
|
|
15
|
+
return '';
|
|
16
|
+
const exact = trimmed.match(new RegExp(`^([a-fA-F0-9]{${exports.ANAMNESIS_ACCESS_TOKEN_HEX_LENGTH}})`));
|
|
17
|
+
if (exact?.[1]) {
|
|
18
|
+
return exact[1].toLowerCase();
|
|
19
|
+
}
|
|
20
|
+
return trimmed.replace(/[.,;:!?)>\]"']+$/g, '').trim();
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-anamnesis-access-token.spec.d.ts","sourceRoot":"","sources":["../../src/anamneses/normalize-anamnesis-access-token.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const normalize_anamnesis_access_token_1 = require("./normalize-anamnesis-access-token");
|
|
4
|
+
const TOKEN = '22d58c2cd36a147d464d1525cfd45657bd42491276bdc9ae5bef580d70b57168';
|
|
5
|
+
describe('normalizeAnamnesisAccessToken', () => {
|
|
6
|
+
it('returns valid 64-char hex token unchanged (lowercased)', () => {
|
|
7
|
+
expect((0, normalize_anamnesis_access_token_1.normalizeAnamnesisAccessToken)(TOKEN)).toBe(TOKEN);
|
|
8
|
+
});
|
|
9
|
+
it('strips trailing period from WhatsApp linkification', () => {
|
|
10
|
+
expect((0, normalize_anamnesis_access_token_1.normalizeAnamnesisAccessToken)(`${TOKEN}.`)).toBe(TOKEN);
|
|
11
|
+
});
|
|
12
|
+
it('strips trailing punctuation cluster', () => {
|
|
13
|
+
expect((0, normalize_anamnesis_access_token_1.normalizeAnamnesisAccessToken)(`${TOKEN}).`)).toBe(TOKEN);
|
|
14
|
+
});
|
|
15
|
+
it('returns empty for blank input', () => {
|
|
16
|
+
expect((0, normalize_anamnesis_access_token_1.normalizeAnamnesisAccessToken)(' ')).toBe('');
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -4,8 +4,10 @@ export declare class CreatePatientDto {
|
|
|
4
4
|
birthDate: string;
|
|
5
5
|
email?: string | null;
|
|
6
6
|
phone?: string | null;
|
|
7
|
+
rg?: string | null;
|
|
7
8
|
gender?: string | null;
|
|
8
9
|
address?: string | null;
|
|
10
|
+
emergencyContact?: string | null;
|
|
9
11
|
hasDisability: boolean;
|
|
10
12
|
disabilityDescription?: string | null;
|
|
11
13
|
initialObservation?: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-patient.dto.d.ts","sourceRoot":"","sources":["../../src/patients/create-patient.dto.ts"],"names":[],"mappings":"AAaA,qBAAa,gBAAgB;IAS3B,IAAI,EAAE,MAAM,CAAC;IAUb,GAAG,EAAE,MAAM,CAAC;IAOZ,SAAS,EAAE,MAAM,CAAC;IAUlB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAUtB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAUtB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAUvB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"create-patient.dto.d.ts","sourceRoot":"","sources":["../../src/patients/create-patient.dto.ts"],"names":[],"mappings":"AAaA,qBAAa,gBAAgB;IAS3B,IAAI,EAAE,MAAM,CAAC;IAUb,GAAG,EAAE,MAAM,CAAC;IAOZ,SAAS,EAAE,MAAM,CAAC;IAUlB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAUtB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAUtB,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAUnB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAUvB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAUxB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAOjC,aAAa,EAAE,OAAO,CAAC;IAWvB,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAUtC,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAYnC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B"}
|
|
@@ -19,8 +19,10 @@ class CreatePatientDto {
|
|
|
19
19
|
birthDate;
|
|
20
20
|
email;
|
|
21
21
|
phone;
|
|
22
|
+
rg;
|
|
22
23
|
gender;
|
|
23
24
|
address;
|
|
25
|
+
emergencyContact;
|
|
24
26
|
hasDisability;
|
|
25
27
|
disabilityDescription;
|
|
26
28
|
initialObservation;
|
|
@@ -79,6 +81,17 @@ __decorate([
|
|
|
79
81
|
(0, class_validator_1.MaxLength)(30),
|
|
80
82
|
__metadata("design:type", Object)
|
|
81
83
|
], CreatePatientDto.prototype, "phone", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
86
|
+
description: 'RG do paciente',
|
|
87
|
+
example: '12.345.678-9',
|
|
88
|
+
maxLength: 20,
|
|
89
|
+
}),
|
|
90
|
+
(0, class_validator_1.IsString)(),
|
|
91
|
+
(0, class_validator_1.IsOptional)(),
|
|
92
|
+
(0, class_validator_1.MaxLength)(20),
|
|
93
|
+
__metadata("design:type", Object)
|
|
94
|
+
], CreatePatientDto.prototype, "rg", void 0);
|
|
82
95
|
__decorate([
|
|
83
96
|
(0, swagger_1.ApiPropertyOptional)({
|
|
84
97
|
description: 'Gênero do paciente',
|
|
@@ -101,6 +114,17 @@ __decorate([
|
|
|
101
114
|
(0, class_validator_1.MaxLength)(500),
|
|
102
115
|
__metadata("design:type", Object)
|
|
103
116
|
], CreatePatientDto.prototype, "address", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
119
|
+
description: 'Contato de emergência do paciente',
|
|
120
|
+
example: '+55 84 99999-9999',
|
|
121
|
+
maxLength: 30,
|
|
122
|
+
}),
|
|
123
|
+
(0, class_validator_1.IsString)(),
|
|
124
|
+
(0, class_validator_1.IsOptional)(),
|
|
125
|
+
(0, class_validator_1.MaxLength)(30),
|
|
126
|
+
__metadata("design:type", Object)
|
|
127
|
+
], CreatePatientDto.prototype, "emergencyContact", void 0);
|
|
104
128
|
__decorate([
|
|
105
129
|
(0, swagger_1.ApiProperty)({
|
|
106
130
|
description: 'Indica se o paciente possui alguma deficiência',
|
package/package.json
CHANGED
|
@@ -13,6 +13,21 @@ export class AnamnesisTokenSessionPatientDto {
|
|
|
13
13
|
|
|
14
14
|
@ApiPropertyOptional({ example: '+5511999999999', nullable: true })
|
|
15
15
|
phone: string | null;
|
|
16
|
+
|
|
17
|
+
@ApiPropertyOptional({ example: '12.345.678-9', nullable: true })
|
|
18
|
+
rg: string | null;
|
|
19
|
+
|
|
20
|
+
@ApiPropertyOptional({ example: '1990-05-12', nullable: true })
|
|
21
|
+
birthDate: string | null;
|
|
22
|
+
|
|
23
|
+
@ApiPropertyOptional({ example: 'maria@email.com', nullable: true })
|
|
24
|
+
email: string | null;
|
|
25
|
+
|
|
26
|
+
@ApiPropertyOptional({ example: 'Rua Exemplo, 123 — Centro', nullable: true })
|
|
27
|
+
address: string | null;
|
|
28
|
+
|
|
29
|
+
@ApiPropertyOptional({ example: '+5584999999999', nullable: true })
|
|
30
|
+
emergencyContact: string | null;
|
|
16
31
|
}
|
|
17
32
|
|
|
18
33
|
export class AnamnesisTokenSessionDto {
|
|
@@ -59,6 +59,16 @@ export class CreatePatientDto {
|
|
|
59
59
|
@MaxLength(30)
|
|
60
60
|
phone?: string | null;
|
|
61
61
|
|
|
62
|
+
@ApiPropertyOptional({
|
|
63
|
+
description: 'RG do paciente',
|
|
64
|
+
example: '12.345.678-9',
|
|
65
|
+
maxLength: 20,
|
|
66
|
+
})
|
|
67
|
+
@IsString()
|
|
68
|
+
@IsOptional()
|
|
69
|
+
@MaxLength(20)
|
|
70
|
+
rg?: string | null;
|
|
71
|
+
|
|
62
72
|
@ApiPropertyOptional({
|
|
63
73
|
description: 'Gênero do paciente',
|
|
64
74
|
example: 'masculino',
|
|
@@ -79,6 +89,16 @@ export class CreatePatientDto {
|
|
|
79
89
|
@MaxLength(500)
|
|
80
90
|
address?: string | null;
|
|
81
91
|
|
|
92
|
+
@ApiPropertyOptional({
|
|
93
|
+
description: 'Contato de emergência do paciente',
|
|
94
|
+
example: '+55 84 99999-9999',
|
|
95
|
+
maxLength: 30,
|
|
96
|
+
})
|
|
97
|
+
@IsString()
|
|
98
|
+
@IsOptional()
|
|
99
|
+
@MaxLength(30)
|
|
100
|
+
emergencyContact?: string | null;
|
|
101
|
+
|
|
82
102
|
@ApiProperty({
|
|
83
103
|
description: 'Indica se o paciente possui alguma deficiência',
|
|
84
104
|
example: true,
|