tychat-contracts 1.0.109 → 1.0.112
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/analytics/analytics-query.dto.js +4 -4
- package/dist/conversations/conversation-contact-filters-query.validator.d.ts +5 -11
- package/dist/conversations/conversation-contact-filters-query.validator.d.ts.map +1 -1
- package/dist/conversations/conversation-contact-filters-query.validator.js +7 -163
- package/dist/conversations/list-conversation-contacts-filters.dto.d.ts +9 -17
- package/dist/conversations/list-conversation-contacts-filters.dto.d.ts.map +1 -1
- package/dist/conversations/list-conversation-contacts-filters.dto.js +6 -87
- package/dist/conversations/list-conversation-contacts-query.dto.d.ts +8 -2
- package/dist/conversations/list-conversation-contacts-query.dto.d.ts.map +1 -1
- package/dist/conversations/list-conversation-contacts-query.dto.js +20 -25
- package/dist/filters/index.d.ts +2 -0
- package/dist/filters/index.d.ts.map +1 -0
- package/dist/filters/index.js +17 -0
- package/dist/filters/parsed-filter.dto.d.ts +29 -0
- package/dist/filters/parsed-filter.dto.d.ts.map +1 -0
- package/dist/filters/parsed-filter.dto.js +23 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/notifications/admin-broadcast-push.dto.d.ts +14 -0
- package/dist/notifications/admin-broadcast-push.dto.d.ts.map +1 -0
- package/dist/notifications/admin-broadcast-push.dto.js +82 -0
- package/dist/notifications/index.d.ts +2 -1
- package/dist/notifications/index.d.ts.map +1 -1
- package/dist/notifications/index.js +4 -1
- package/dist/notifications/notification-list-item.dto.d.ts +3 -0
- package/dist/notifications/notification-list-item.dto.d.ts.map +1 -1
- package/dist/notifications/notification-list-item.dto.js +27 -0
- package/dist/notifications/notifications-kafka-topics.d.ts +2 -0
- package/dist/notifications/notifications-kafka-topics.d.ts.map +1 -1
- package/dist/notifications/notifications-kafka-topics.js +3 -1
- package/dist/patients/list-patients-filters.dto.d.ts +9 -16
- package/dist/patients/list-patients-filters.dto.d.ts.map +1 -1
- package/dist/patients/list-patients-filters.dto.js +6 -89
- package/dist/patients/list-patients-query.dto.d.ts +8 -2
- package/dist/patients/list-patients-query.dto.d.ts.map +1 -1
- package/dist/patients/list-patients-query.dto.js +24 -11
- package/package.json +1 -1
- package/src/analytics/analytics-query.dto.ts +4 -4
- package/src/conversations/conversation-contact-filters-query.validator.ts +10 -193
- package/src/conversations/list-conversation-contacts-filters.dto.ts +15 -91
- package/src/conversations/list-conversation-contacts-query.dto.ts +59 -61
- package/src/filters/index.ts +1 -0
- package/src/filters/parsed-filter.dto.ts +37 -0
- package/src/index.ts +1 -0
- package/src/notifications/admin-broadcast-push.dto.ts +65 -0
- package/src/notifications/index.ts +2 -0
- package/src/notifications/notification-list-item.dto.ts +21 -0
- package/src/notifications/notifications-kafka-topics.ts +4 -0
- package/src/patients/list-patients-filters.dto.ts +15 -92
- package/src/patients/list-patients-query.dto.ts +28 -23
|
@@ -211,22 +211,22 @@ class AnalyticsDashboardResponseDto {
|
|
|
211
211
|
}
|
|
212
212
|
exports.AnalyticsDashboardResponseDto = AnalyticsDashboardResponseDto;
|
|
213
213
|
__decorate([
|
|
214
|
-
(0, swagger_1.ApiProperty)({ description: '
|
|
214
|
+
(0, swagger_1.ApiProperty)({ description: 'Total de agendamentos no período (direto da tabela `appointments` filtrado por `date`)' }),
|
|
215
215
|
__metadata("design:type", Number)
|
|
216
216
|
], AnalyticsDashboardResponseDto.prototype, "appointmentsCreated", void 0);
|
|
217
217
|
__decorate([
|
|
218
|
-
(0, swagger_1.ApiProperty)({ description: 'Agendamentos
|
|
218
|
+
(0, swagger_1.ApiProperty)({ description: 'Agendamentos com status `finished` no período (direto da tabela `appointments`)' }),
|
|
219
219
|
__metadata("design:type", Number)
|
|
220
220
|
], AnalyticsDashboardResponseDto.prototype, "appointmentsFinished", void 0);
|
|
221
221
|
__decorate([
|
|
222
222
|
(0, swagger_1.ApiProperty)({
|
|
223
|
-
description: '
|
|
223
|
+
description: 'Total de procedimentos vinculados a agendamentos no período (direto da tabela `appointment_procedures` via JOIN com `appointments.date`)',
|
|
224
224
|
}),
|
|
225
225
|
__metadata("design:type", Number)
|
|
226
226
|
], AnalyticsDashboardResponseDto.prototype, "proceduresScheduled", void 0);
|
|
227
227
|
__decorate([
|
|
228
228
|
(0, swagger_1.ApiProperty)({
|
|
229
|
-
description: 'Procedimentos
|
|
229
|
+
description: 'Procedimentos com `finished = true` vinculados a agendamentos no período (direto da tabela `appointment_procedures`)',
|
|
230
230
|
}),
|
|
231
231
|
__metadata("design:type", Number)
|
|
232
232
|
], AnalyticsDashboardResponseDto.prototype, "proceduresFinished", void 0);
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import { ValidationArguments, ValidatorConstraintInterface } from 'class-validator';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* -
|
|
7
|
-
*
|
|
8
|
-
* Substitui `filters` no objeto pai por `ConversationContactListFilterDto[]` validado.
|
|
2
|
+
* @deprecated The filter validation logic has been moved to the API gateway.
|
|
3
|
+
* This file is kept only for backward compatibility with existing imports.
|
|
4
|
+
* The gateway now parses and validates the filters string before forwarding
|
|
5
|
+
* the pre-validated ParsedFilterDto[] to the microservice.
|
|
9
6
|
*/
|
|
10
|
-
export
|
|
11
|
-
validate(value: unknown, args: ValidationArguments): boolean;
|
|
12
|
-
defaultMessage(args: ValidationArguments): string;
|
|
13
|
-
}
|
|
7
|
+
export { CONVERSATION_CONTACT_LIST_FILTER_KEYS, type ConversationContactListFilterKeyDto, } from './list-conversation-contacts-query.dto';
|
|
14
8
|
//# sourceMappingURL=conversation-contact-filters-query.validator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-contact-filters-query.validator.d.ts","sourceRoot":"","sources":["../../src/conversations/conversation-contact-filters-query.validator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"conversation-contact-filters-query.validator.d.ts","sourceRoot":"","sources":["../../src/conversations/conversation-contact-filters-query.validator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,qCAAqC,EACrC,KAAK,mCAAmC,GACzC,MAAM,wCAAwC,CAAC"}
|
|
@@ -1,167 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
10
|
-
const class_transformer_1 = require("class-transformer");
|
|
11
|
-
const class_validator_1 = require("class-validator");
|
|
12
|
-
const list_conversation_contacts_filters_dto_1 = require("./list-conversation-contacts-filters.dto");
|
|
13
|
-
/** Evita colocar chave extra no DTO (whitelist / forbidNonWhitelisted no pai). */
|
|
14
|
-
const conversationContactFiltersQueryError = new WeakMap();
|
|
15
|
-
function flattenErrors(errors, prefix = '') {
|
|
16
|
-
const out = [];
|
|
17
|
-
for (const e of errors) {
|
|
18
|
-
const path = prefix ? `${prefix}.${e.property}` : e.property;
|
|
19
|
-
if (e.constraints) {
|
|
20
|
-
out.push(...Object.values(e.constraints).map((m) => `${path}: ${m}`));
|
|
21
|
-
}
|
|
22
|
-
if (e.children?.length) {
|
|
23
|
-
out.push(...flattenErrors(e.children, path));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return out;
|
|
27
|
-
}
|
|
28
|
-
/** Alguns gateways/parsers envolvem o item em um ou mais arrays de um elemento. */
|
|
29
|
-
function unwrapSingleElementArrays(el, maxDepth = 8) {
|
|
30
|
-
let cur = el;
|
|
31
|
-
let d = 0;
|
|
32
|
-
while (Array.isArray(cur) && cur.length === 1 && d < maxDepth) {
|
|
33
|
-
cur = cur[0];
|
|
34
|
-
d += 1;
|
|
35
|
-
}
|
|
36
|
-
return cur;
|
|
37
|
-
}
|
|
38
|
-
/** JSON string que, ao dar parse, ainda é string (double-encoded), até virar objeto/array. */
|
|
39
|
-
function jsonParseLoose(text) {
|
|
40
|
-
let parsed = JSON.parse(text);
|
|
41
|
-
let guard = 0;
|
|
42
|
-
while (typeof parsed === 'string' && guard < 4) {
|
|
43
|
-
const s = parsed.trim();
|
|
44
|
-
if (s === '') {
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
parsed = JSON.parse(s);
|
|
48
|
-
guard += 1;
|
|
49
|
-
}
|
|
50
|
-
return parsed;
|
|
51
|
-
}
|
|
3
|
+
exports.CONVERSATION_CONTACT_LIST_FILTER_KEYS = void 0;
|
|
52
4
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* -
|
|
57
|
-
*
|
|
58
|
-
* Substitui `filters` no objeto pai por `ConversationContactListFilterDto[]` validado.
|
|
5
|
+
* @deprecated The filter validation logic has been moved to the API gateway.
|
|
6
|
+
* This file is kept only for backward compatibility with existing imports.
|
|
7
|
+
* The gateway now parses and validates the filters string before forwarding
|
|
8
|
+
* the pre-validated ParsedFilterDto[] to the microservice.
|
|
59
9
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const parent = args.object;
|
|
63
|
-
conversationContactFiltersQueryError.delete(parent);
|
|
64
|
-
if (value === undefined || value === null) {
|
|
65
|
-
parent.filters = undefined;
|
|
66
|
-
return true;
|
|
67
|
-
}
|
|
68
|
-
let rawItems;
|
|
69
|
-
if (typeof value === 'string') {
|
|
70
|
-
const t = value.trim();
|
|
71
|
-
if (t === '') {
|
|
72
|
-
parent.filters = undefined;
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
let parsed;
|
|
76
|
-
try {
|
|
77
|
-
parsed = jsonParseLoose(t);
|
|
78
|
-
}
|
|
79
|
-
catch {
|
|
80
|
-
conversationContactFiltersQueryError.set(parent, 'filters: string não é JSON válido');
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
if (Array.isArray(parsed)) {
|
|
84
|
-
rawItems = parsed;
|
|
85
|
-
}
|
|
86
|
-
else if (parsed !== null &&
|
|
87
|
-
typeof parsed === 'object' &&
|
|
88
|
-
!Array.isArray(parsed)) {
|
|
89
|
-
rawItems = [parsed];
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
conversationContactFiltersQueryError.set(parent, 'filters: JSON deve ser array ou objeto');
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
else if (Array.isArray(value)) {
|
|
97
|
-
rawItems = value;
|
|
98
|
-
}
|
|
99
|
-
else if (value !== null &&
|
|
100
|
-
typeof value === 'object' &&
|
|
101
|
-
!Array.isArray(value)) {
|
|
102
|
-
rawItems = [value];
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
conversationContactFiltersQueryError.set(parent, 'filters deve ser array de strings JSON, array de objetos, ou string JSON');
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
const out = [];
|
|
109
|
-
for (let i = 0; i < rawItems.length; i++) {
|
|
110
|
-
const el = unwrapSingleElementArrays(rawItems[i]);
|
|
111
|
-
let plain;
|
|
112
|
-
if (typeof el === 'string') {
|
|
113
|
-
const s = el.trim();
|
|
114
|
-
if (s === '') {
|
|
115
|
-
conversationContactFiltersQueryError.set(parent, `filters[${i}] não pode ser string vazia`);
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
try {
|
|
119
|
-
plain = jsonParseLoose(s);
|
|
120
|
-
}
|
|
121
|
-
catch {
|
|
122
|
-
conversationContactFiltersQueryError.set(parent, `filters[${i}]: JSON inválido`);
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
plain = unwrapSingleElementArrays(plain);
|
|
126
|
-
}
|
|
127
|
-
else if (el !== null && typeof el === 'object' && !Array.isArray(el)) {
|
|
128
|
-
plain = el;
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
conversationContactFiltersQueryError.set(parent, `filters[${i}] deve ser string JSON, objeto, ou array de um único filtro (formato recebido inválido)`);
|
|
132
|
-
return false;
|
|
133
|
-
}
|
|
134
|
-
if (plain === null ||
|
|
135
|
-
typeof plain !== 'object' ||
|
|
136
|
-
Array.isArray(plain)) {
|
|
137
|
-
conversationContactFiltersQueryError.set(parent, `filters[${i}]: após parse deve ser um objeto (não array)`);
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
140
|
-
const dto = (0, class_transformer_1.plainToInstance)(list_conversation_contacts_filters_dto_1.ConversationContactListFilterDto, plain);
|
|
141
|
-
const errors = (0, class_validator_1.validateSync)(dto, {
|
|
142
|
-
whitelist: true,
|
|
143
|
-
forbidNonWhitelisted: true,
|
|
144
|
-
});
|
|
145
|
-
if (errors.length) {
|
|
146
|
-
const msg = flattenErrors(errors)
|
|
147
|
-
.map((line) => `filters[${i}] ${line}`)
|
|
148
|
-
.join('; ');
|
|
149
|
-
conversationContactFiltersQueryError.set(parent, msg);
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
out.push(dto);
|
|
153
|
-
}
|
|
154
|
-
parent.filters = out;
|
|
155
|
-
return true;
|
|
156
|
-
}
|
|
157
|
-
defaultMessage(args) {
|
|
158
|
-
const parent = args.object;
|
|
159
|
-
const msg = conversationContactFiltersQueryError.get(parent);
|
|
160
|
-
conversationContactFiltersQueryError.delete(parent);
|
|
161
|
-
return typeof msg === 'string' ? msg : 'filters inválidos';
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
exports.ConversationContactFiltersQueryConstraint = ConversationContactFiltersQueryConstraint;
|
|
165
|
-
exports.ConversationContactFiltersQueryConstraint = ConversationContactFiltersQueryConstraint = __decorate([
|
|
166
|
-
(0, class_validator_1.ValidatorConstraint)({ name: 'conversationContactFiltersQuery', async: false })
|
|
167
|
-
], ConversationContactFiltersQueryConstraint);
|
|
10
|
+
var list_conversation_contacts_query_dto_1 = require("./list-conversation-contacts-query.dto");
|
|
11
|
+
Object.defineProperty(exports, "CONVERSATION_CONTACT_LIST_FILTER_KEYS", { enumerable: true, get: function () { return list_conversation_contacts_query_dto_1.CONVERSATION_CONTACT_LIST_FILTER_KEYS; } });
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
import { ValidationArguments, ValidatorConstraintInterface } from 'class-validator';
|
|
2
|
-
/** Campos da sessão (`conversation_sessions`) em `filters[].key` (camelCase da API). */
|
|
3
|
-
export declare const CONVERSATION_CONTACT_LIST_FILTER_KEYS: readonly ["id", "sessionUuid", "patientId", "unitId", "tenantEvogoInstanceId", "conversationType", "intention", "unreadCount", "startedAt", "expiresAt"];
|
|
4
|
-
export type ConversationContactListFilterKeyDto = (typeof CONVERSATION_CONTACT_LIST_FILTER_KEYS)[number];
|
|
5
|
-
export declare const CONVERSATION_CONTACT_LIST_FILTER_OPS: readonly ["==", ">", "<", ">=", "<=", "!=", "in"];
|
|
6
|
-
export type ConversationContactListFilterOpDto = (typeof CONVERSATION_CONTACT_LIST_FILTER_OPS)[number];
|
|
7
|
-
export declare class ConversationContactListFilterValueConstraint implements ValidatorConstraintInterface {
|
|
8
|
-
validate(value: unknown, args: ValidationArguments): boolean;
|
|
9
|
-
defaultMessage(): string;
|
|
10
|
-
}
|
|
11
1
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
2
|
+
* Re-exports CONVERSATION_CONTACT_LIST_FILTER_KEYS from the query DTO
|
|
3
|
+
* for backward compatibility. The generic ParsedFilterDto from `../filters`
|
|
4
|
+
* is now the canonical filter shape used across all services.
|
|
14
5
|
*/
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
export { CONVERSATION_CONTACT_LIST_FILTER_KEYS, type ConversationContactListFilterKeyDto, } from './list-conversation-contacts-query.dto';
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use `ParsedFilterDto` from `../filters` instead.
|
|
9
|
+
* Kept as an alias for backward compatibility during migration.
|
|
10
|
+
*/
|
|
11
|
+
export type { ParsedFilterDto as ConversationContactListFilterDto } from '../filters/parsed-filter.dto';
|
|
20
12
|
//# sourceMappingURL=list-conversation-contacts-filters.dto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-conversation-contacts-filters.dto.d.ts","sourceRoot":"","sources":["../../src/conversations/list-conversation-contacts-filters.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list-conversation-contacts-filters.dto.d.ts","sourceRoot":"","sources":["../../src/conversations/list-conversation-contacts-filters.dto.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,qCAAqC,EACrC,KAAK,mCAAmC,GACzC,MAAM,wCAAwC,CAAC;AAEhD;;;GAGG;AACH,YAAY,EAAE,eAAe,IAAI,gCAAgC,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -1,91 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
-
const class_validator_1 = require("class-validator");
|
|
15
|
-
/** Campos da sessão (`conversation_sessions`) em `filters[].key` (camelCase da API). */
|
|
16
|
-
exports.CONVERSATION_CONTACT_LIST_FILTER_KEYS = [
|
|
17
|
-
'id',
|
|
18
|
-
'sessionUuid',
|
|
19
|
-
'patientId',
|
|
20
|
-
'unitId',
|
|
21
|
-
'tenantEvogoInstanceId',
|
|
22
|
-
'conversationType',
|
|
23
|
-
'intention',
|
|
24
|
-
'unreadCount',
|
|
25
|
-
'startedAt',
|
|
26
|
-
'expiresAt',
|
|
27
|
-
];
|
|
28
|
-
exports.CONVERSATION_CONTACT_LIST_FILTER_OPS = [
|
|
29
|
-
'==',
|
|
30
|
-
'>',
|
|
31
|
-
'<',
|
|
32
|
-
'>=',
|
|
33
|
-
'<=',
|
|
34
|
-
'!=',
|
|
35
|
-
'in',
|
|
36
|
-
];
|
|
37
|
-
let ConversationContactListFilterValueConstraint = class ConversationContactListFilterValueConstraint {
|
|
38
|
-
validate(value, args) {
|
|
39
|
-
const obj = args.object;
|
|
40
|
-
const op = obj?.op;
|
|
41
|
-
if (op === 'in') {
|
|
42
|
-
return Array.isArray(value) && value.length >= 1;
|
|
43
|
-
}
|
|
44
|
-
return !Array.isArray(value);
|
|
45
|
-
}
|
|
46
|
-
defaultMessage() {
|
|
47
|
-
return ('Para op "in", value deve ser um array não vazio; para as demais operações, value não pode ser array');
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
exports.ConversationContactListFilterValueConstraint = ConversationContactListFilterValueConstraint;
|
|
51
|
-
exports.ConversationContactListFilterValueConstraint = ConversationContactListFilterValueConstraint = __decorate([
|
|
52
|
-
(0, class_validator_1.ValidatorConstraint)({ name: 'conversationContactListFilterValueShape', async: false })
|
|
53
|
-
], ConversationContactListFilterValueConstraint);
|
|
3
|
+
exports.CONVERSATION_CONTACT_LIST_FILTER_KEYS = void 0;
|
|
54
4
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
5
|
+
* Re-exports CONVERSATION_CONTACT_LIST_FILTER_KEYS from the query DTO
|
|
6
|
+
* for backward compatibility. The generic ParsedFilterDto from `../filters`
|
|
7
|
+
* is now the canonical filter shape used across all services.
|
|
57
8
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
op;
|
|
61
|
-
value;
|
|
62
|
-
}
|
|
63
|
-
exports.ConversationContactListFilterDto = ConversationContactListFilterDto;
|
|
64
|
-
__decorate([
|
|
65
|
-
(0, swagger_1.ApiProperty)({
|
|
66
|
-
description: 'Campo da sessão (camelCase)',
|
|
67
|
-
enum: exports.CONVERSATION_CONTACT_LIST_FILTER_KEYS,
|
|
68
|
-
example: 'patientId',
|
|
69
|
-
}),
|
|
70
|
-
(0, class_validator_1.IsString)(),
|
|
71
|
-
(0, class_validator_1.IsIn)(exports.CONVERSATION_CONTACT_LIST_FILTER_KEYS),
|
|
72
|
-
__metadata("design:type", String)
|
|
73
|
-
], ConversationContactListFilterDto.prototype, "key", void 0);
|
|
74
|
-
__decorate([
|
|
75
|
-
(0, swagger_1.ApiProperty)({
|
|
76
|
-
description: 'Operador de comparação',
|
|
77
|
-
enum: exports.CONVERSATION_CONTACT_LIST_FILTER_OPS,
|
|
78
|
-
example: '==',
|
|
79
|
-
}),
|
|
80
|
-
(0, class_validator_1.IsString)(),
|
|
81
|
-
(0, class_validator_1.IsIn)(exports.CONVERSATION_CONTACT_LIST_FILTER_OPS),
|
|
82
|
-
__metadata("design:type", String)
|
|
83
|
-
], ConversationContactListFilterDto.prototype, "op", void 0);
|
|
84
|
-
__decorate([
|
|
85
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
86
|
-
description: 'Valor escalar ou, com op "in", array. null permitido para == / != em colunas opcionais (ex.: intention, unitId).',
|
|
87
|
-
example: '00000000-0000-4000-8000-000000000000',
|
|
88
|
-
}),
|
|
89
|
-
(0, class_validator_1.Validate)(ConversationContactListFilterValueConstraint),
|
|
90
|
-
__metadata("design:type", Object)
|
|
91
|
-
], ConversationContactListFilterDto.prototype, "value", void 0);
|
|
9
|
+
var list_conversation_contacts_query_dto_1 = require("./list-conversation-contacts-query.dto");
|
|
10
|
+
Object.defineProperty(exports, "CONVERSATION_CONTACT_LIST_FILTER_KEYS", { enumerable: true, get: function () { return list_conversation_contacts_query_dto_1.CONVERSATION_CONTACT_LIST_FILTER_KEYS; } });
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ParsedFilterDto } from '../filters/parsed-filter.dto';
|
|
2
|
+
/**
|
|
3
|
+
* Allowed conversation session entity columns for filtering (camelCase API keys).
|
|
4
|
+
* Microservice uses this whitelist to prevent access to non-existent columns.
|
|
5
|
+
*/
|
|
6
|
+
export declare const CONVERSATION_CONTACT_LIST_FILTER_KEYS: readonly ["id", "sessionUuid", "patientId", "unitId", "tenantEvogoInstanceId", "conversationType", "intention", "unreadCount", "startedAt", "expiresAt"];
|
|
7
|
+
export type ConversationContactListFilterKeyDto = (typeof CONVERSATION_CONTACT_LIST_FILTER_KEYS)[number];
|
|
2
8
|
export declare class ListConversationContactsQueryDto {
|
|
3
9
|
page?: number;
|
|
4
10
|
limit?: number;
|
|
5
|
-
filters?:
|
|
11
|
+
filters?: ParsedFilterDto[];
|
|
6
12
|
}
|
|
7
13
|
//# sourceMappingURL=list-conversation-contacts-query.dto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-conversation-contacts-query.dto.d.ts","sourceRoot":"","sources":["../../src/conversations/list-conversation-contacts-query.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list-conversation-contacts-query.dto.d.ts","sourceRoot":"","sources":["../../src/conversations/list-conversation-contacts-query.dto.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,qCAAqC,0JAWxC,CAAC;AACX,MAAM,MAAM,mCAAmC,GAC7C,CAAC,OAAO,qCAAqC,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,qBAAa,gCAAgC;IAU3C,IAAI,CAAC,EAAE,MAAM,CAAC;IAad,KAAK,CAAC,EAAE,MAAM,CAAC;IAWf,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;CAC7B"}
|
|
@@ -9,28 +9,25 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ListConversationContactsQueryDto = void 0;
|
|
12
|
+
exports.ListConversationContactsQueryDto = exports.CONVERSATION_CONTACT_LIST_FILTER_KEYS = void 0;
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
|
-
const conversation_contact_filters_query_validator_1 = require("./conversation-contact-filters-query.validator");
|
|
16
15
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* When `enableImplicitConversion` is true, class-transformer uses the reflected
|
|
20
|
-
* type to recursively transform array elements. For properties like `filters`
|
|
21
|
-
* whose raw value (string / mixed array) is fully parsed by a custom validator,
|
|
22
|
-
* the implicit conversion mangles the value before the validator sees it.
|
|
23
|
-
*
|
|
24
|
-
* Placing this decorator **first** (topmost) ensures it runs **last** in the
|
|
25
|
-
* decorator chain, overriding the `__metadata("design:type", Array)` emitted
|
|
26
|
-
* by TypeScript. With `design:type = Object`, class-transformer leaves the raw
|
|
27
|
-
* value intact.
|
|
16
|
+
* Allowed conversation session entity columns for filtering (camelCase API keys).
|
|
17
|
+
* Microservice uses this whitelist to prevent access to non-existent columns.
|
|
28
18
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
exports.CONVERSATION_CONTACT_LIST_FILTER_KEYS = [
|
|
20
|
+
'id',
|
|
21
|
+
'sessionUuid',
|
|
22
|
+
'patientId',
|
|
23
|
+
'unitId',
|
|
24
|
+
'tenantEvogoInstanceId',
|
|
25
|
+
'conversationType',
|
|
26
|
+
'intention',
|
|
27
|
+
'unreadCount',
|
|
28
|
+
'startedAt',
|
|
29
|
+
'expiresAt',
|
|
30
|
+
];
|
|
34
31
|
class ListConversationContactsQueryDto {
|
|
35
32
|
page;
|
|
36
33
|
limit;
|
|
@@ -65,14 +62,12 @@ __decorate([
|
|
|
65
62
|
], ListConversationContactsQueryDto.prototype, "limit", void 0);
|
|
66
63
|
__decorate([
|
|
67
64
|
(0, swagger_1.ApiPropertyOptional)({
|
|
68
|
-
description: '
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
description: 'JSON string with an array of filter objects `{ key, op, value }`. ' +
|
|
66
|
+
'Example: `[{"key":"intention","op":"==","value":"clinic_info"}]`. ' +
|
|
67
|
+
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`).',
|
|
68
|
+
type: String,
|
|
69
|
+
example: '[{"key":"intention","op":"==","value":"clinic_info"}]',
|
|
72
70
|
}),
|
|
73
|
-
RawQueryParam() // Must be first — overrides design:type from Array to Object so class-transformer won't mangle the value
|
|
74
|
-
,
|
|
75
71
|
(0, class_validator_1.IsOptional)(),
|
|
76
|
-
(0, class_validator_1.Validate)(conversation_contact_filters_query_validator_1.ConversationContactFiltersQueryConstraint),
|
|
77
72
|
__metadata("design:type", Array)
|
|
78
73
|
], ListConversationContactsQueryDto.prototype, "filters", void 0);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/filters/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./parsed-filter.dto"), exports);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Valid filter operators for query filters.
|
|
3
|
+
*
|
|
4
|
+
* - `==` : Equality
|
|
5
|
+
* - `!=` : Inequality
|
|
6
|
+
* - `>` : Greater than
|
|
7
|
+
* - `<` : Less than
|
|
8
|
+
* - `>=` : Greater than or equal
|
|
9
|
+
* - `<=` : Less than or equal
|
|
10
|
+
* - `in` : Value is one of the elements in the array
|
|
11
|
+
*/
|
|
12
|
+
export declare const VALID_FILTER_OPS: readonly ["==", "!=", ">", "<", ">=", "<=", "in"];
|
|
13
|
+
export type FilterOp = (typeof VALID_FILTER_OPS)[number];
|
|
14
|
+
/**
|
|
15
|
+
* Generic parsed filter object.
|
|
16
|
+
*
|
|
17
|
+
* Sent from the API gateway to microservices after validation.
|
|
18
|
+
* Each microservice is responsible for checking whether `key` is
|
|
19
|
+
* a valid column on its entity before applying the filter.
|
|
20
|
+
*/
|
|
21
|
+
export interface ParsedFilterDto {
|
|
22
|
+
/** Column name (camelCase, must map to a real entity column in the microservice). */
|
|
23
|
+
key: string;
|
|
24
|
+
/** Comparison operator. */
|
|
25
|
+
op: FilterOp;
|
|
26
|
+
/** Scalar value (string | number) or, for `in`, an array of string | number. */
|
|
27
|
+
value: string | number | (string | number)[];
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=parsed-filter.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsed-filter.dto.d.ts","sourceRoot":"","sources":["../../src/filters/parsed-filter.dto.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,mDAQnB,CAAC;AACX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,qFAAqF;IACrF,GAAG,EAAE,MAAM,CAAC;IACZ,2BAA2B;IAC3B,EAAE,EAAE,QAAQ,CAAC;IACb,gFAAgF;IAChF,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;CAC9C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VALID_FILTER_OPS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Valid filter operators for query filters.
|
|
6
|
+
*
|
|
7
|
+
* - `==` : Equality
|
|
8
|
+
* - `!=` : Inequality
|
|
9
|
+
* - `>` : Greater than
|
|
10
|
+
* - `<` : Less than
|
|
11
|
+
* - `>=` : Greater than or equal
|
|
12
|
+
* - `<=` : Less than or equal
|
|
13
|
+
* - `in` : Value is one of the elements in the array
|
|
14
|
+
*/
|
|
15
|
+
exports.VALID_FILTER_OPS = [
|
|
16
|
+
'==',
|
|
17
|
+
'!=',
|
|
18
|
+
'>',
|
|
19
|
+
'<',
|
|
20
|
+
'>=',
|
|
21
|
+
'<=',
|
|
22
|
+
'in',
|
|
23
|
+
];
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,MAAM,CAAC;AACrB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,MAAM,CAAC;AACrB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pedido de envio em massa de push (FCM) disparado pelo painel admin.
|
|
3
|
+
* O tenant-service publica no Kafka; o notifications-service consome e envia.
|
|
4
|
+
*/
|
|
5
|
+
export declare class AdminBroadcastPushDto {
|
|
6
|
+
allTenants: boolean;
|
|
7
|
+
tenantSlugs?: string[];
|
|
8
|
+
allUsers: boolean;
|
|
9
|
+
userIds?: string[];
|
|
10
|
+
title: string;
|
|
11
|
+
body: string;
|
|
12
|
+
data?: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=admin-broadcast-push.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-broadcast-push.dto.d.ts","sourceRoot":"","sources":["../../src/notifications/admin-broadcast-push.dto.ts"],"names":[],"mappings":"AAaA;;;GAGG;AACH,qBAAa,qBAAqB;IAGhC,UAAU,EAAG,OAAO,CAAC;IAUrB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAIvB,QAAQ,EAAG,OAAO,CAAC;IAUnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAKnB,KAAK,EAAG,MAAM,CAAC;IAKf,IAAI,EAAG,MAAM,CAAC;IASd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B"}
|