tychat-contracts 1.6.21 → 1.6.23

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 (118) hide show
  1. package/README.md +33 -33
  2. package/dist/storage/delete-object-rpc.dto.d.ts +9 -0
  3. package/dist/storage/delete-object-rpc.dto.d.ts.map +1 -0
  4. package/dist/storage/delete-object-rpc.dto.js +48 -0
  5. package/dist/storage/index.d.ts +1 -0
  6. package/dist/storage/index.d.ts.map +1 -1
  7. package/dist/storage/index.js +1 -0
  8. package/dist/storage/storage-rmq-patterns.d.ts +2 -0
  9. package/dist/storage/storage-rmq-patterns.d.ts.map +1 -1
  10. package/dist/storage/storage-rmq-patterns.js +3 -1
  11. package/jest.config.ts +5 -5
  12. package/package.json +2 -1
  13. package/src/ai/ai-usage-response.dto.ts +47 -47
  14. package/src/ai/create-ai-usage.dto.ts +43 -43
  15. package/src/analytics/analytics-emitter.helper.ts +54 -54
  16. package/src/analytics/analytics-query.dto.ts +222 -222
  17. package/src/analytics/create-analytic-event.dto.ts +85 -85
  18. package/src/analytics/event-analytic.enum.ts +119 -119
  19. package/src/appointments/appointment-procedure.dto.ts +76 -76
  20. package/src/appointments/create-appointment.dto.ts +153 -153
  21. package/src/appointments/index.ts +10 -10
  22. package/src/appointments/list-appointments-query.dto.ts +157 -157
  23. package/src/appointments/update-appointment-procedure.dto.ts +10 -10
  24. package/src/appointments/update-appointment.dto.ts +4 -4
  25. package/src/auth/refresh-token.dto.ts +10 -10
  26. package/src/billing/billing-response.dto.ts +68 -68
  27. package/src/billing/create-billing.dto.ts +70 -70
  28. package/src/billing/index.ts +6 -6
  29. package/src/billing/list-billings-query.dto.ts +61 -61
  30. package/src/billing/update-billing.dto.ts +4 -4
  31. package/src/cashback/cashback-balance-response.dto.ts +33 -33
  32. package/src/cashback/cashback-config-response.dto.ts +43 -43
  33. package/src/cashback/cashback-enums.ts +33 -33
  34. package/src/cashback/cashback-kafka-payloads.ts +102 -102
  35. package/src/cashback/cashback-kafka-topics.ts +23 -23
  36. package/src/cashback/index.ts +7 -7
  37. package/src/cashback/referral-code-response.dto.ts +49 -49
  38. package/src/cashback/use-referral-code-response.dto.ts +15 -15
  39. package/src/configurations/clinic-configuration.dto.ts +39 -39
  40. package/src/configurations/opening-hours-slot.dto.ts +41 -41
  41. package/src/configurations/update-clinic-configuration.dto.ts +39 -39
  42. package/src/connections/whatsapp-official.dto.ts +113 -113
  43. package/src/conversations/conversation-contact-filters-query.validator.spec.ts +221 -221
  44. package/src/conversations/conversation-contact-filters-query.validator.ts +10 -10
  45. package/src/conversations/conversation-intention.dto.ts +24 -24
  46. package/src/conversations/conversation-response.dto.ts +69 -69
  47. package/src/conversations/conversation-session-response.dto.ts +65 -65
  48. package/src/conversations/conversation-type.dto.ts +15 -15
  49. package/src/conversations/create-conversation-session.dto.ts +28 -28
  50. package/src/conversations/create-conversation.dto.ts +69 -69
  51. package/src/conversations/followup-config-response.dto.ts +290 -290
  52. package/src/conversations/followup-log-response.dto.ts +58 -58
  53. package/src/conversations/followup-type.dto.ts +22 -22
  54. package/src/conversations/index.ts +17 -17
  55. package/src/conversations/list-conversation-contacts-filters.dto.ts +15 -15
  56. package/src/conversations/list-conversation-contacts-query.dto.ts +81 -81
  57. package/src/conversations/satisfaction-response.dto.ts +116 -116
  58. package/src/filters/index.ts +1 -1
  59. package/src/filters/parsed-filter.dto.ts +41 -41
  60. package/src/index.ts +23 -23
  61. package/src/patients/create-patient.dto.ts +122 -122
  62. package/src/patients/index.ts +10 -10
  63. package/src/patients/list-patients-filters.dto.ts +15 -15
  64. package/src/patients/list-patients-query.dto.ts +61 -61
  65. package/src/patients/patient-document-response.dto.ts +33 -33
  66. package/src/patients/patient-history-entry.dto.ts +22 -22
  67. package/src/patients/patient-status.dto.ts +9 -9
  68. package/src/patients/update-patient-document.dto.ts +10 -10
  69. package/src/patients/update-patient.dto.ts +15 -15
  70. package/src/payment-gateway/create-gateway-payment.dto.ts +123 -123
  71. package/src/payment-gateway/gateway-payment-response.dto.ts +65 -65
  72. package/src/payment-gateway/index.ts +12 -12
  73. package/src/payment-gateway/list-gateway-payments-query.dto.ts +63 -63
  74. package/src/payment-gateway/payment-gateway-kafka-topics.ts +25 -25
  75. package/src/payment-gateway/payment-gateway.enums.ts +34 -34
  76. package/src/payment-gateway/update-gateway-payment.dto.ts +7 -7
  77. package/src/payment-gateway/webhook-payload.dto.ts +32 -32
  78. package/src/payments/create-payment.dto.ts +73 -73
  79. package/src/payments/index.ts +6 -6
  80. package/src/payments/list-payments-query.dto.ts +44 -44
  81. package/src/payments/payment-response.dto.ts +67 -67
  82. package/src/payments/update-payment.dto.ts +4 -4
  83. package/src/procedures/create-procedure.dto.ts +104 -104
  84. package/src/procedures/index.ts +6 -6
  85. package/src/procedures/list-procedures-query.dto.ts +59 -59
  86. package/src/procedures/update-procedure.dto.ts +4 -4
  87. package/src/storage/delete-object-rpc.dto.ts +28 -0
  88. package/src/storage/index.ts +1 -0
  89. package/src/storage/storage-rmq-patterns.ts +3 -0
  90. package/src/tenants/index.ts +10 -10
  91. package/src/tenants/whatsapp-provider-kind.dto.ts +12 -12
  92. package/dist/analytics/should-skip-analytics-tenant-lookup.d.ts +0 -7
  93. package/dist/analytics/should-skip-analytics-tenant-lookup.d.ts.map +0 -1
  94. package/dist/analytics/should-skip-analytics-tenant-lookup.js +0 -13
  95. package/dist/appointments/opening-hours-slot.dto.d.ts +0 -6
  96. package/dist/appointments/opening-hours-slot.dto.d.ts.map +0 -1
  97. package/dist/appointments/opening-hours-slot.dto.js +0 -2
  98. package/dist/patients/patient-procedure.dto.d.ts +0 -9
  99. package/dist/patients/patient-procedure.dto.d.ts.map +0 -1
  100. package/dist/patients/patient-procedure.dto.js +0 -79
  101. package/dist/patients/update-patient-procedure.dto.d.ts +0 -6
  102. package/dist/patients/update-patient-procedure.dto.d.ts.map +0 -1
  103. package/dist/patients/update-patient-procedure.dto.js +0 -8
  104. package/dist/payments/payment.dto.d.ts +0 -15
  105. package/dist/payments/payment.dto.d.ts.map +0 -1
  106. package/dist/payments/payment.dto.js +0 -2
  107. package/dist/tenants/create-tenant.dto.d.ts +0 -10
  108. package/dist/tenants/create-tenant.dto.d.ts.map +0 -1
  109. package/dist/tenants/create-tenant.dto.js +0 -73
  110. package/dist/tenants/tenant-slug.util.spec.d.ts +0 -2
  111. package/dist/tenants/tenant-slug.util.spec.d.ts.map +0 -1
  112. package/dist/tenants/tenant-slug.util.spec.js +0 -102
  113. package/dist/tenants/update-tenant-payload.dto.d.ts +0 -6
  114. package/dist/tenants/update-tenant-payload.dto.d.ts.map +0 -1
  115. package/dist/tenants/update-tenant-payload.dto.js +0 -25
  116. package/dist/tenants/update-tenant.dto.d.ts +0 -10
  117. package/dist/tenants/update-tenant.dto.d.ts.map +0 -1
  118. package/dist/tenants/update-tenant.dto.js +0 -78
@@ -1,119 +1,119 @@
1
- /**
2
- * Enum of all analytic event types emitted by microservices.
3
- * Each value follows the pattern: `domain.action`.
4
- */
5
- export const EVENT_ANALYTIC_TYPES = [
6
- // ── Patient events ──────────────────────────────────────────────
7
- 'patient.created',
8
- 'patient.updated',
9
- 'patient.deleted',
10
- 'patient.status_changed',
11
-
12
- // ── Appointment events ──────────────────────────────────────────
13
- 'appointment.created',
14
- 'appointment.updated',
15
- 'appointment.canceled',
16
- 'appointment.rescheduled',
17
- 'appointment.no_show',
18
- 'appointment.finished',
19
- /** Procedimento do agendamento marcado como concluído (add/update com finished). */
20
- 'appointment.procedure_finished',
21
-
22
- // ── Check-in / Check-out events ─────────────────────────────────
23
- 'checkin.effectued',
24
- 'checkout.effectued',
25
-
26
- // ── Message events ──────────────────────────────────────────────
27
- 'message.sent',
28
- 'message.received',
29
-
30
- // ── Conversation / Session events ───────────────────────────────
31
- 'conversation.session_started',
32
- 'conversation.session_ended',
33
- 'conversation.transferred_to_human',
34
-
35
- // ── Follow-up events (tychat-followup-service) ─────────────────
36
- 'followup.abandonment.sent',
37
- 'followup.appointment_confirmation.sent',
38
- 'followup.satisfaction_booking.sent',
39
- 'followup.satisfaction_finished.sent',
40
- 'followup.no_show_reschedule.sent',
41
- 'followup.wellness_check.sent',
42
- 'followup.return_suggestion.sent',
43
- 'followup.satisfaction_booking.response_received',
44
- 'followup.satisfaction_finished.response_received',
45
- 'followup.config_updated',
46
-
47
- // ── Payment events ──────────────────────────────────────────────
48
- 'payment.created',
49
- 'payment.payed',
50
- 'payment.refunded',
51
- 'payment.canceled',
52
- 'payment.overdue',
53
-
54
- // ── Payment Gateway events ─────────────────────────────────────
55
- 'payment_gateway.payment_created',
56
- 'payment_gateway.payment_confirmed',
57
- 'payment_gateway.payment_failed',
58
- 'payment_gateway.payment_refunded',
59
- 'payment_gateway.payment_canceled',
60
- 'payment_gateway.payment_expired',
61
- 'payment_gateway.webhook_received',
62
-
63
- // ── Billing events ──────────────────────────────────────────────
64
- 'billing.invoice_created',
65
- 'billing.invoice_paid',
66
-
67
- // ── AI events ───────────────────────────────────────────────────
68
- 'ai.interaction',
69
- 'ai.fallback',
70
-
71
- // ── Auth events ─────────────────────────────────────────────────
72
- 'auth.login',
73
- 'auth.logout',
74
- 'auth.password_reset',
75
-
76
- // ── User / Staff events ─────────────────────────────────────────
77
- 'user.created',
78
- 'user.updated',
79
- 'user.deleted',
80
-
81
- // ── Notification events ─────────────────────────────────────────
82
- 'notification.sent',
83
- 'notification.failed',
84
-
85
- // ── WhatsApp events ─────────────────────────────────────────────
86
- 'whatsapp.connection_established',
87
- 'whatsapp.connection_lost',
88
-
89
- // ── Procedure events ────────────────────────────────────────────
90
- 'procedure.created',
91
- 'procedure.updated',
92
- 'procedure.deleted',
93
-
94
- // ── Specialty events ────────────────────────────────────────────
95
- 'specialty.created',
96
- 'specialty.updated',
97
- 'specialty.deleted',
98
-
99
- // ── Professional events ─────────────────────────────────────────
100
- 'professional.created',
101
- 'professional.updated',
102
- 'professional.deleted',
103
-
104
- // ── Configuration events ────────────────────────────────────────
105
- 'configuration.updated',
106
-
107
- // ── Legal term (clinic template) ────────────────────────────────
108
- 'legal_term.template.updated',
109
-
110
- // ── Storage events ──────────────────────────────────────────────
111
- 'storage.file_uploaded',
112
- 'storage.file_deleted',
113
-
114
- // ── Tenant events ───────────────────────────────────────────────
115
- 'tenant.created',
116
- 'tenant.updated',
117
- ] as const;
118
-
119
- export type EventAnalyticType = (typeof EVENT_ANALYTIC_TYPES)[number];
1
+ /**
2
+ * Enum of all analytic event types emitted by microservices.
3
+ * Each value follows the pattern: `domain.action`.
4
+ */
5
+ export const EVENT_ANALYTIC_TYPES = [
6
+ // ── Patient events ──────────────────────────────────────────────
7
+ 'patient.created',
8
+ 'patient.updated',
9
+ 'patient.deleted',
10
+ 'patient.status_changed',
11
+
12
+ // ── Appointment events ──────────────────────────────────────────
13
+ 'appointment.created',
14
+ 'appointment.updated',
15
+ 'appointment.canceled',
16
+ 'appointment.rescheduled',
17
+ 'appointment.no_show',
18
+ 'appointment.finished',
19
+ /** Procedimento do agendamento marcado como concluído (add/update com finished). */
20
+ 'appointment.procedure_finished',
21
+
22
+ // ── Check-in / Check-out events ─────────────────────────────────
23
+ 'checkin.effectued',
24
+ 'checkout.effectued',
25
+
26
+ // ── Message events ──────────────────────────────────────────────
27
+ 'message.sent',
28
+ 'message.received',
29
+
30
+ // ── Conversation / Session events ───────────────────────────────
31
+ 'conversation.session_started',
32
+ 'conversation.session_ended',
33
+ 'conversation.transferred_to_human',
34
+
35
+ // ── Follow-up events (tychat-followup-service) ─────────────────
36
+ 'followup.abandonment.sent',
37
+ 'followup.appointment_confirmation.sent',
38
+ 'followup.satisfaction_booking.sent',
39
+ 'followup.satisfaction_finished.sent',
40
+ 'followup.no_show_reschedule.sent',
41
+ 'followup.wellness_check.sent',
42
+ 'followup.return_suggestion.sent',
43
+ 'followup.satisfaction_booking.response_received',
44
+ 'followup.satisfaction_finished.response_received',
45
+ 'followup.config_updated',
46
+
47
+ // ── Payment events ──────────────────────────────────────────────
48
+ 'payment.created',
49
+ 'payment.payed',
50
+ 'payment.refunded',
51
+ 'payment.canceled',
52
+ 'payment.overdue',
53
+
54
+ // ── Payment Gateway events ─────────────────────────────────────
55
+ 'payment_gateway.payment_created',
56
+ 'payment_gateway.payment_confirmed',
57
+ 'payment_gateway.payment_failed',
58
+ 'payment_gateway.payment_refunded',
59
+ 'payment_gateway.payment_canceled',
60
+ 'payment_gateway.payment_expired',
61
+ 'payment_gateway.webhook_received',
62
+
63
+ // ── Billing events ──────────────────────────────────────────────
64
+ 'billing.invoice_created',
65
+ 'billing.invoice_paid',
66
+
67
+ // ── AI events ───────────────────────────────────────────────────
68
+ 'ai.interaction',
69
+ 'ai.fallback',
70
+
71
+ // ── Auth events ─────────────────────────────────────────────────
72
+ 'auth.login',
73
+ 'auth.logout',
74
+ 'auth.password_reset',
75
+
76
+ // ── User / Staff events ─────────────────────────────────────────
77
+ 'user.created',
78
+ 'user.updated',
79
+ 'user.deleted',
80
+
81
+ // ── Notification events ─────────────────────────────────────────
82
+ 'notification.sent',
83
+ 'notification.failed',
84
+
85
+ // ── WhatsApp events ─────────────────────────────────────────────
86
+ 'whatsapp.connection_established',
87
+ 'whatsapp.connection_lost',
88
+
89
+ // ── Procedure events ────────────────────────────────────────────
90
+ 'procedure.created',
91
+ 'procedure.updated',
92
+ 'procedure.deleted',
93
+
94
+ // ── Specialty events ────────────────────────────────────────────
95
+ 'specialty.created',
96
+ 'specialty.updated',
97
+ 'specialty.deleted',
98
+
99
+ // ── Professional events ─────────────────────────────────────────
100
+ 'professional.created',
101
+ 'professional.updated',
102
+ 'professional.deleted',
103
+
104
+ // ── Configuration events ────────────────────────────────────────
105
+ 'configuration.updated',
106
+
107
+ // ── Legal term (clinic template) ────────────────────────────────
108
+ 'legal_term.template.updated',
109
+
110
+ // ── Storage events ──────────────────────────────────────────────
111
+ 'storage.file_uploaded',
112
+ 'storage.file_deleted',
113
+
114
+ // ── Tenant events ───────────────────────────────────────────────
115
+ 'tenant.created',
116
+ 'tenant.updated',
117
+ ] as const;
118
+
119
+ export type EventAnalyticType = (typeof EVENT_ANALYTIC_TYPES)[number];
@@ -1,76 +1,76 @@
1
- import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
- import {
3
- IsBoolean,
4
- IsDateString,
5
- IsNotEmpty,
6
- IsNumber,
7
- IsOptional,
8
- IsString,
9
- MaxLength,
10
- } from 'class-validator';
11
-
12
- /**
13
- * DTO for creating a procedure linked to an appointment.
14
- * Procedures belong to appointments (not directly to patients).
15
- */
16
- export class AppointmentProcedureDto {
17
- @ApiProperty({
18
- description: 'Name of the procedure to be performed or already performed',
19
- example: 'Consulta clínica',
20
- maxLength: 255,
21
- })
22
- @IsString()
23
- @IsNotEmpty()
24
- @MaxLength(255)
25
- name: string;
26
-
27
- @ApiProperty({
28
- description: 'Monetary value of the procedure',
29
- example: 150.5,
30
- })
31
- @IsNumber({ maxDecimalPlaces: 2 })
32
- value: number;
33
-
34
- @ApiProperty({
35
- description: 'Indicates whether the procedure has been completed',
36
- example: false,
37
- })
38
- @IsBoolean()
39
- finished: boolean;
40
-
41
- @ApiPropertyOptional({
42
- description: 'Date and time when the procedure was completed (ISO 8601)',
43
- example: '2026-03-10T14:30:00.000Z',
44
- })
45
- @IsOptional()
46
- @IsDateString()
47
- finished_at?: string | null;
48
-
49
- @ApiPropertyOptional({
50
- description: 'Additional observation about the procedure',
51
- example: 'Paciente chegou em jejum',
52
- maxLength: 2000,
53
- })
54
- @IsString()
55
- @IsOptional()
56
- @MaxLength(2000)
57
- observation?: string | null;
58
-
59
- @ApiPropertyOptional({
60
- description: 'Known side effects of the procedure (used for wellness follow-up after appointment)',
61
- example: 'Possivel inchaço na area tratada, sensibilidade ao toque por 24-48h',
62
- maxLength: 2000,
63
- })
64
- @IsString()
65
- @IsOptional()
66
- @MaxLength(2000)
67
- side_effects?: string | null;
68
-
69
- @ApiPropertyOptional({
70
- description: 'Recommended number of days until a return visit',
71
- example: 30,
72
- })
73
- @IsOptional()
74
- @IsNumber({ maxDecimalPlaces: 0 })
75
- return_days?: number | null;
76
- }
1
+ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
+ import {
3
+ IsBoolean,
4
+ IsDateString,
5
+ IsNotEmpty,
6
+ IsNumber,
7
+ IsOptional,
8
+ IsString,
9
+ MaxLength,
10
+ } from 'class-validator';
11
+
12
+ /**
13
+ * DTO for creating a procedure linked to an appointment.
14
+ * Procedures belong to appointments (not directly to patients).
15
+ */
16
+ export class AppointmentProcedureDto {
17
+ @ApiProperty({
18
+ description: 'Name of the procedure to be performed or already performed',
19
+ example: 'Consulta clínica',
20
+ maxLength: 255,
21
+ })
22
+ @IsString()
23
+ @IsNotEmpty()
24
+ @MaxLength(255)
25
+ name: string;
26
+
27
+ @ApiProperty({
28
+ description: 'Monetary value of the procedure',
29
+ example: 150.5,
30
+ })
31
+ @IsNumber({ maxDecimalPlaces: 2 })
32
+ value: number;
33
+
34
+ @ApiProperty({
35
+ description: 'Indicates whether the procedure has been completed',
36
+ example: false,
37
+ })
38
+ @IsBoolean()
39
+ finished: boolean;
40
+
41
+ @ApiPropertyOptional({
42
+ description: 'Date and time when the procedure was completed (ISO 8601)',
43
+ example: '2026-03-10T14:30:00.000Z',
44
+ })
45
+ @IsOptional()
46
+ @IsDateString()
47
+ finished_at?: string | null;
48
+
49
+ @ApiPropertyOptional({
50
+ description: 'Additional observation about the procedure',
51
+ example: 'Paciente chegou em jejum',
52
+ maxLength: 2000,
53
+ })
54
+ @IsString()
55
+ @IsOptional()
56
+ @MaxLength(2000)
57
+ observation?: string | null;
58
+
59
+ @ApiPropertyOptional({
60
+ description: 'Known side effects of the procedure (used for wellness follow-up after appointment)',
61
+ example: 'Possivel inchaço na area tratada, sensibilidade ao toque por 24-48h',
62
+ maxLength: 2000,
63
+ })
64
+ @IsString()
65
+ @IsOptional()
66
+ @MaxLength(2000)
67
+ side_effects?: string | null;
68
+
69
+ @ApiPropertyOptional({
70
+ description: 'Recommended number of days until a return visit',
71
+ example: 30,
72
+ })
73
+ @IsOptional()
74
+ @IsNumber({ maxDecimalPlaces: 0 })
75
+ return_days?: number | null;
76
+ }