tychat-contracts 1.0.92 → 1.0.94
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/index.d.ts +0 -1
- package/dist/analytics/index.d.ts.map +1 -1
- package/dist/analytics/index.js +0 -1
- package/dist/notifications/index.d.ts +4 -0
- package/dist/notifications/index.d.ts.map +1 -1
- package/dist/notifications/index.js +13 -1
- package/dist/notifications/list-notifications-query.dto.d.ts +15 -0
- package/dist/notifications/list-notifications-query.dto.d.ts.map +1 -0
- package/dist/notifications/list-notifications-query.dto.js +82 -0
- package/dist/notifications/notification-list-item.dto.d.ts +10 -0
- package/dist/notifications/notification-list-item.dto.d.ts.map +1 -0
- package/dist/notifications/notification-list-item.dto.js +47 -0
- package/dist/notifications/notifications-kafka-topics.d.ts +4 -0
- package/dist/notifications/notifications-kafka-topics.d.ts.map +1 -0
- package/dist/notifications/notifications-kafka-topics.js +6 -0
- package/dist/notifications/register-push-token.dto.d.ts +15 -0
- package/dist/notifications/register-push-token.dto.d.ts.map +1 -0
- package/dist/notifications/register-push-token.dto.js +56 -0
- package/package.json +1 -1
- package/src/analytics/index.ts +0 -1
- package/src/notifications/index.ts +16 -0
- package/src/notifications/list-notifications-query.dto.ts +65 -0
- package/src/notifications/notification-list-item.dto.ts +22 -0
- package/src/notifications/notifications-kafka-topics.ts +5 -0
- package/src/notifications/register-push-token.dto.ts +40 -0
- package/src/analytics/should-skip-analytics-tenant-lookup.ts +0 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/analytics/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/analytics/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC"}
|
package/dist/analytics/index.js
CHANGED
|
@@ -20,4 +20,3 @@ __exportStar(require("./create-analytic-event.dto"), exports);
|
|
|
20
20
|
__exportStar(require("./analytics-query.dto"), exports);
|
|
21
21
|
__exportStar(require("./analytics-kafka-topics"), exports);
|
|
22
22
|
__exportStar(require("./analytics-emitter.helper"), exports);
|
|
23
|
-
__exportStar(require("./should-skip-analytics-tenant-lookup"), exports);
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export { NotificationUserCreatedEventPayload, NotificationPasswordResetRequestedEventPayload, } from './notifications-kafka.payloads';
|
|
2
|
+
export { TOPIC_NOTIFICATIONS_FIND_ALL, TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN, } from './notifications-kafka-topics';
|
|
3
|
+
export { RegisterPushTokenDto, NotificationsRegisterPushTokenKafkaDto, } from './register-push-token.dto';
|
|
4
|
+
export { ListNotificationsQueryDto, NOTIFICATION_PROVIDER_FILTERS, NOTIFICATION_STATUS_FILTERS, type NotificationProviderFilterDto, type NotificationStatusFilterDto, } from './list-notifications-query.dto';
|
|
5
|
+
export { NotificationListItemDto } from './notification-list-item.dto';
|
|
2
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,8CAA8C,GAC/C,MAAM,gCAAgC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,8CAA8C,GAC/C,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,4BAA4B,EAC5B,uCAAuC,GACxC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,oBAAoB,EACpB,sCAAsC,GACvC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAC7B,2BAA2B,EAC3B,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,GACjC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NotificationPasswordResetRequestedEventPayload = exports.NotificationUserCreatedEventPayload = void 0;
|
|
3
|
+
exports.NotificationListItemDto = exports.NOTIFICATION_STATUS_FILTERS = exports.NOTIFICATION_PROVIDER_FILTERS = exports.ListNotificationsQueryDto = exports.NotificationsRegisterPushTokenKafkaDto = exports.RegisterPushTokenDto = exports.TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN = exports.TOPIC_NOTIFICATIONS_FIND_ALL = exports.NotificationPasswordResetRequestedEventPayload = exports.NotificationUserCreatedEventPayload = void 0;
|
|
4
4
|
var notifications_kafka_payloads_1 = require("./notifications-kafka.payloads");
|
|
5
5
|
Object.defineProperty(exports, "NotificationUserCreatedEventPayload", { enumerable: true, get: function () { return notifications_kafka_payloads_1.NotificationUserCreatedEventPayload; } });
|
|
6
6
|
Object.defineProperty(exports, "NotificationPasswordResetRequestedEventPayload", { enumerable: true, get: function () { return notifications_kafka_payloads_1.NotificationPasswordResetRequestedEventPayload; } });
|
|
7
|
+
var notifications_kafka_topics_1 = require("./notifications-kafka-topics");
|
|
8
|
+
Object.defineProperty(exports, "TOPIC_NOTIFICATIONS_FIND_ALL", { enumerable: true, get: function () { return notifications_kafka_topics_1.TOPIC_NOTIFICATIONS_FIND_ALL; } });
|
|
9
|
+
Object.defineProperty(exports, "TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN", { enumerable: true, get: function () { return notifications_kafka_topics_1.TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN; } });
|
|
10
|
+
var register_push_token_dto_1 = require("./register-push-token.dto");
|
|
11
|
+
Object.defineProperty(exports, "RegisterPushTokenDto", { enumerable: true, get: function () { return register_push_token_dto_1.RegisterPushTokenDto; } });
|
|
12
|
+
Object.defineProperty(exports, "NotificationsRegisterPushTokenKafkaDto", { enumerable: true, get: function () { return register_push_token_dto_1.NotificationsRegisterPushTokenKafkaDto; } });
|
|
13
|
+
var list_notifications_query_dto_1 = require("./list-notifications-query.dto");
|
|
14
|
+
Object.defineProperty(exports, "ListNotificationsQueryDto", { enumerable: true, get: function () { return list_notifications_query_dto_1.ListNotificationsQueryDto; } });
|
|
15
|
+
Object.defineProperty(exports, "NOTIFICATION_PROVIDER_FILTERS", { enumerable: true, get: function () { return list_notifications_query_dto_1.NOTIFICATION_PROVIDER_FILTERS; } });
|
|
16
|
+
Object.defineProperty(exports, "NOTIFICATION_STATUS_FILTERS", { enumerable: true, get: function () { return list_notifications_query_dto_1.NOTIFICATION_STATUS_FILTERS; } });
|
|
17
|
+
var notification_list_item_dto_1 = require("./notification-list-item.dto");
|
|
18
|
+
Object.defineProperty(exports, "NotificationListItemDto", { enumerable: true, get: function () { return notification_list_item_dto_1.NotificationListItemDto; } });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const NOTIFICATION_PROVIDER_FILTERS: readonly ["email", "whatsapp", "sms", "push"];
|
|
2
|
+
export type NotificationProviderFilterDto = (typeof NOTIFICATION_PROVIDER_FILTERS)[number];
|
|
3
|
+
export declare const NOTIFICATION_STATUS_FILTERS: readonly ["pending", "sent", "failed"];
|
|
4
|
+
export type NotificationStatusFilterDto = (typeof NOTIFICATION_STATUS_FILTERS)[number];
|
|
5
|
+
/**
|
|
6
|
+
* Query HTTP + payload Kafka para listar notificações do tenant.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ListNotificationsQueryDto {
|
|
9
|
+
page?: number;
|
|
10
|
+
limit?: number;
|
|
11
|
+
provider?: NotificationProviderFilterDto;
|
|
12
|
+
status?: NotificationStatusFilterDto;
|
|
13
|
+
notificationEvent?: string;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=list-notifications-query.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-notifications-query.dto.d.ts","sourceRoot":"","sources":["../../src/notifications/list-notifications-query.dto.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,6BAA6B,+CAKhC,CAAC;AACX,MAAM,MAAM,6BAA6B,GACvC,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjD,eAAO,MAAM,2BAA2B,wCAI9B,CAAC;AACX,MAAM,MAAM,2BAA2B,GACrC,CAAC,OAAO,2BAA2B,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/C;;GAEG;AACH,qBAAa,yBAAyB;IAMpC,IAAI,CAAC,EAAE,MAAM,CAAC;IAQd,KAAK,CAAC,EAAE,MAAM,CAAC;IAQf,QAAQ,CAAC,EAAE,6BAA6B,CAAC;IAQzC,MAAM,CAAC,EAAE,2BAA2B,CAAC;IASrC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B"}
|
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ListNotificationsQueryDto = exports.NOTIFICATION_STATUS_FILTERS = exports.NOTIFICATION_PROVIDER_FILTERS = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const class_validator_1 = require("class-validator");
|
|
16
|
+
exports.NOTIFICATION_PROVIDER_FILTERS = [
|
|
17
|
+
'email',
|
|
18
|
+
'whatsapp',
|
|
19
|
+
'sms',
|
|
20
|
+
'push',
|
|
21
|
+
];
|
|
22
|
+
exports.NOTIFICATION_STATUS_FILTERS = [
|
|
23
|
+
'pending',
|
|
24
|
+
'sent',
|
|
25
|
+
'failed',
|
|
26
|
+
];
|
|
27
|
+
/**
|
|
28
|
+
* Query HTTP + payload Kafka para listar notificações do tenant.
|
|
29
|
+
*/
|
|
30
|
+
class ListNotificationsQueryDto {
|
|
31
|
+
page;
|
|
32
|
+
limit;
|
|
33
|
+
provider;
|
|
34
|
+
status;
|
|
35
|
+
notificationEvent;
|
|
36
|
+
}
|
|
37
|
+
exports.ListNotificationsQueryDto = ListNotificationsQueryDto;
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, swagger_1.ApiPropertyOptional)({ minimum: 1, default: 1 }),
|
|
40
|
+
(0, class_validator_1.IsOptional)(),
|
|
41
|
+
(0, class_transformer_1.Type)(() => Number),
|
|
42
|
+
(0, class_validator_1.IsInt)(),
|
|
43
|
+
(0, class_validator_1.Min)(1),
|
|
44
|
+
__metadata("design:type", Number)
|
|
45
|
+
], ListNotificationsQueryDto.prototype, "page", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, swagger_1.ApiPropertyOptional)({ minimum: 1, maximum: 100, default: 20 }),
|
|
48
|
+
(0, class_validator_1.IsOptional)(),
|
|
49
|
+
(0, class_transformer_1.Type)(() => Number),
|
|
50
|
+
(0, class_validator_1.IsInt)(),
|
|
51
|
+
(0, class_validator_1.Min)(1),
|
|
52
|
+
(0, class_validator_1.Max)(100),
|
|
53
|
+
__metadata("design:type", Number)
|
|
54
|
+
], ListNotificationsQueryDto.prototype, "limit", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
57
|
+
enum: exports.NOTIFICATION_PROVIDER_FILTERS,
|
|
58
|
+
description: 'Filtrar por canal',
|
|
59
|
+
}),
|
|
60
|
+
(0, class_validator_1.IsOptional)(),
|
|
61
|
+
(0, class_validator_1.IsIn)([...exports.NOTIFICATION_PROVIDER_FILTERS]),
|
|
62
|
+
__metadata("design:type", String)
|
|
63
|
+
], ListNotificationsQueryDto.prototype, "provider", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
66
|
+
enum: exports.NOTIFICATION_STATUS_FILTERS,
|
|
67
|
+
description: 'Filtrar por status',
|
|
68
|
+
}),
|
|
69
|
+
(0, class_validator_1.IsOptional)(),
|
|
70
|
+
(0, class_validator_1.IsIn)([...exports.NOTIFICATION_STATUS_FILTERS]),
|
|
71
|
+
__metadata("design:type", String)
|
|
72
|
+
], ListNotificationsQueryDto.prototype, "status", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
75
|
+
description: 'Filtrar por evento (igualdade exata, ex.: notifications.user_created)',
|
|
76
|
+
maxLength: 255,
|
|
77
|
+
}),
|
|
78
|
+
(0, class_validator_1.IsOptional)(),
|
|
79
|
+
(0, class_validator_1.IsString)(),
|
|
80
|
+
(0, class_validator_1.MaxLength)(255),
|
|
81
|
+
__metadata("design:type", String)
|
|
82
|
+
], ListNotificationsQueryDto.prototype, "notificationEvent", void 0);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Item retornado em GET /notifications (e RPC notifications.findAll). */
|
|
2
|
+
export declare class NotificationListItemDto {
|
|
3
|
+
id: string;
|
|
4
|
+
notificationEvent: string;
|
|
5
|
+
provider: string;
|
|
6
|
+
status: string;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
updatedAt: string;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=notification-list-item.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-list-item.dto.d.ts","sourceRoot":"","sources":["../../src/notifications/notification-list-item.dto.ts"],"names":[],"mappings":"AAEA,0EAA0E;AAC1E,qBAAa,uBAAuB;IAElC,EAAE,EAAE,MAAM,CAAC;IAGX,iBAAiB,EAAE,MAAM,CAAC;IAG1B,QAAQ,EAAE,MAAM,CAAC;IAGjB,MAAM,EAAE,MAAM,CAAC;IAGf,SAAS,EAAE,MAAM,CAAC;IAGlB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.NotificationListItemDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
/** Item retornado em GET /notifications (e RPC notifications.findAll). */
|
|
15
|
+
class NotificationListItemDto {
|
|
16
|
+
id;
|
|
17
|
+
notificationEvent;
|
|
18
|
+
provider;
|
|
19
|
+
status;
|
|
20
|
+
createdAt;
|
|
21
|
+
updatedAt;
|
|
22
|
+
}
|
|
23
|
+
exports.NotificationListItemDto = NotificationListItemDto;
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, swagger_1.ApiProperty)({ format: 'uuid' }),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], NotificationListItemDto.prototype, "id", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, swagger_1.ApiProperty)({ example: 'notifications.user_created' }),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], NotificationListItemDto.prototype, "notificationEvent", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, swagger_1.ApiProperty)({ enum: ['email', 'whatsapp', 'sms', 'push'] }),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], NotificationListItemDto.prototype, "provider", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, swagger_1.ApiProperty)({ enum: ['pending', 'sent', 'failed'] }),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], NotificationListItemDto.prototype, "status", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, swagger_1.ApiProperty)({ example: '2026-04-08T12:00:00.000Z' }),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], NotificationListItemDto.prototype, "createdAt", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, swagger_1.ApiProperty)({ example: '2026-04-08T12:00:00.000Z' }),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], NotificationListItemDto.prototype, "updatedAt", void 0);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Kafka request–reply: lista notificações persistidas no banco do tenant. */
|
|
2
|
+
export declare const TOPIC_NOTIFICATIONS_FIND_ALL = "notifications.findAll";
|
|
3
|
+
export declare const TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN = "notifications.registerPushToken";
|
|
4
|
+
//# sourceMappingURL=notifications-kafka-topics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications-kafka-topics.d.ts","sourceRoot":"","sources":["../../src/notifications/notifications-kafka-topics.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,eAAO,MAAM,4BAA4B,0BAA0B,CAAC;AAEpE,eAAO,MAAM,uCAAuC,oCACjB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN = exports.TOPIC_NOTIFICATIONS_FIND_ALL = void 0;
|
|
4
|
+
/** Kafka request–reply: lista notificações persistidas no banco do tenant. */
|
|
5
|
+
exports.TOPIC_NOTIFICATIONS_FIND_ALL = 'notifications.findAll';
|
|
6
|
+
exports.TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN = 'notifications.registerPushToken';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Corpo HTTP e campo `payload` no RPC Kafka para registrar token FCM do utilizador autenticado.
|
|
3
|
+
*/
|
|
4
|
+
export declare class RegisterPushTokenDto {
|
|
5
|
+
token: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Payload Kafka `notifications.registerPushToken`.
|
|
9
|
+
*/
|
|
10
|
+
export declare class NotificationsRegisterPushTokenKafkaDto {
|
|
11
|
+
tenant: string;
|
|
12
|
+
userId: string;
|
|
13
|
+
payload: RegisterPushTokenDto;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=register-push-token.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-push-token.dto.d.ts","sourceRoot":"","sources":["../../src/notifications/register-push-token.dto.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH,qBAAa,oBAAoB;IAS/B,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,qBAAa,sCAAsC;IAGjD,MAAM,EAAE,MAAM,CAAC;IAGf,MAAM,EAAE,MAAM,CAAC;IAIf,OAAO,EAAE,oBAAoB,CAAC;CAC/B"}
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.NotificationsRegisterPushTokenKafkaDto = exports.RegisterPushTokenDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const class_validator_1 = require("class-validator");
|
|
16
|
+
/**
|
|
17
|
+
* Corpo HTTP e campo `payload` no RPC Kafka para registrar token FCM do utilizador autenticado.
|
|
18
|
+
*/
|
|
19
|
+
class RegisterPushTokenDto {
|
|
20
|
+
token;
|
|
21
|
+
}
|
|
22
|
+
exports.RegisterPushTokenDto = RegisterPushTokenDto;
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, swagger_1.ApiProperty)({
|
|
25
|
+
description: 'Token FCM (Firebase Cloud Messaging) do dispositivo',
|
|
26
|
+
example: 'dK3p...',
|
|
27
|
+
maxLength: 4096,
|
|
28
|
+
}),
|
|
29
|
+
(0, class_validator_1.IsString)(),
|
|
30
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
31
|
+
(0, class_validator_1.MaxLength)(4096),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], RegisterPushTokenDto.prototype, "token", void 0);
|
|
34
|
+
/**
|
|
35
|
+
* Payload Kafka `notifications.registerPushToken`.
|
|
36
|
+
*/
|
|
37
|
+
class NotificationsRegisterPushTokenKafkaDto {
|
|
38
|
+
tenant;
|
|
39
|
+
userId;
|
|
40
|
+
payload;
|
|
41
|
+
}
|
|
42
|
+
exports.NotificationsRegisterPushTokenKafkaDto = NotificationsRegisterPushTokenKafkaDto;
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, class_validator_1.IsString)(),
|
|
45
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], NotificationsRegisterPushTokenKafkaDto.prototype, "tenant", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, class_validator_1.IsUUID)('4'),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], NotificationsRegisterPushTokenKafkaDto.prototype, "userId", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, class_validator_1.ValidateNested)(),
|
|
54
|
+
(0, class_transformer_1.Type)(() => RegisterPushTokenDto),
|
|
55
|
+
__metadata("design:type", RegisterPushTokenDto)
|
|
56
|
+
], NotificationsRegisterPushTokenKafkaDto.prototype, "payload", void 0);
|
package/package.json
CHANGED
package/src/analytics/index.ts
CHANGED
|
@@ -2,3 +2,19 @@ export {
|
|
|
2
2
|
NotificationUserCreatedEventPayload,
|
|
3
3
|
NotificationPasswordResetRequestedEventPayload,
|
|
4
4
|
} from './notifications-kafka.payloads';
|
|
5
|
+
export {
|
|
6
|
+
TOPIC_NOTIFICATIONS_FIND_ALL,
|
|
7
|
+
TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN,
|
|
8
|
+
} from './notifications-kafka-topics';
|
|
9
|
+
export {
|
|
10
|
+
RegisterPushTokenDto,
|
|
11
|
+
NotificationsRegisterPushTokenKafkaDto,
|
|
12
|
+
} from './register-push-token.dto';
|
|
13
|
+
export {
|
|
14
|
+
ListNotificationsQueryDto,
|
|
15
|
+
NOTIFICATION_PROVIDER_FILTERS,
|
|
16
|
+
NOTIFICATION_STATUS_FILTERS,
|
|
17
|
+
type NotificationProviderFilterDto,
|
|
18
|
+
type NotificationStatusFilterDto,
|
|
19
|
+
} from './list-notifications-query.dto';
|
|
20
|
+
export { NotificationListItemDto } from './notification-list-item.dto';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import { Type } from 'class-transformer';
|
|
3
|
+
import { IsIn, IsInt, IsOptional, IsString, Max, MaxLength, Min } from 'class-validator';
|
|
4
|
+
|
|
5
|
+
export const NOTIFICATION_PROVIDER_FILTERS = [
|
|
6
|
+
'email',
|
|
7
|
+
'whatsapp',
|
|
8
|
+
'sms',
|
|
9
|
+
'push',
|
|
10
|
+
] as const;
|
|
11
|
+
export type NotificationProviderFilterDto =
|
|
12
|
+
(typeof NOTIFICATION_PROVIDER_FILTERS)[number];
|
|
13
|
+
|
|
14
|
+
export const NOTIFICATION_STATUS_FILTERS = [
|
|
15
|
+
'pending',
|
|
16
|
+
'sent',
|
|
17
|
+
'failed',
|
|
18
|
+
] as const;
|
|
19
|
+
export type NotificationStatusFilterDto =
|
|
20
|
+
(typeof NOTIFICATION_STATUS_FILTERS)[number];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Query HTTP + payload Kafka para listar notificações do tenant.
|
|
24
|
+
*/
|
|
25
|
+
export class ListNotificationsQueryDto {
|
|
26
|
+
@ApiPropertyOptional({ minimum: 1, default: 1 })
|
|
27
|
+
@IsOptional()
|
|
28
|
+
@Type(() => Number)
|
|
29
|
+
@IsInt()
|
|
30
|
+
@Min(1)
|
|
31
|
+
page?: number;
|
|
32
|
+
|
|
33
|
+
@ApiPropertyOptional({ minimum: 1, maximum: 100, default: 20 })
|
|
34
|
+
@IsOptional()
|
|
35
|
+
@Type(() => Number)
|
|
36
|
+
@IsInt()
|
|
37
|
+
@Min(1)
|
|
38
|
+
@Max(100)
|
|
39
|
+
limit?: number;
|
|
40
|
+
|
|
41
|
+
@ApiPropertyOptional({
|
|
42
|
+
enum: NOTIFICATION_PROVIDER_FILTERS,
|
|
43
|
+
description: 'Filtrar por canal',
|
|
44
|
+
})
|
|
45
|
+
@IsOptional()
|
|
46
|
+
@IsIn([...NOTIFICATION_PROVIDER_FILTERS])
|
|
47
|
+
provider?: NotificationProviderFilterDto;
|
|
48
|
+
|
|
49
|
+
@ApiPropertyOptional({
|
|
50
|
+
enum: NOTIFICATION_STATUS_FILTERS,
|
|
51
|
+
description: 'Filtrar por status',
|
|
52
|
+
})
|
|
53
|
+
@IsOptional()
|
|
54
|
+
@IsIn([...NOTIFICATION_STATUS_FILTERS])
|
|
55
|
+
status?: NotificationStatusFilterDto;
|
|
56
|
+
|
|
57
|
+
@ApiPropertyOptional({
|
|
58
|
+
description: 'Filtrar por evento (igualdade exata, ex.: notifications.user_created)',
|
|
59
|
+
maxLength: 255,
|
|
60
|
+
})
|
|
61
|
+
@IsOptional()
|
|
62
|
+
@IsString()
|
|
63
|
+
@MaxLength(255)
|
|
64
|
+
notificationEvent?: string;
|
|
65
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
|
|
3
|
+
/** Item retornado em GET /notifications (e RPC notifications.findAll). */
|
|
4
|
+
export class NotificationListItemDto {
|
|
5
|
+
@ApiProperty({ format: 'uuid' })
|
|
6
|
+
id: string;
|
|
7
|
+
|
|
8
|
+
@ApiProperty({ example: 'notifications.user_created' })
|
|
9
|
+
notificationEvent: string;
|
|
10
|
+
|
|
11
|
+
@ApiProperty({ enum: ['email', 'whatsapp', 'sms', 'push'] })
|
|
12
|
+
provider: string;
|
|
13
|
+
|
|
14
|
+
@ApiProperty({ enum: ['pending', 'sent', 'failed'] })
|
|
15
|
+
status: string;
|
|
16
|
+
|
|
17
|
+
@ApiProperty({ example: '2026-04-08T12:00:00.000Z' })
|
|
18
|
+
createdAt: string;
|
|
19
|
+
|
|
20
|
+
@ApiProperty({ example: '2026-04-08T12:00:00.000Z' })
|
|
21
|
+
updatedAt: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
import { Type } from 'class-transformer';
|
|
3
|
+
import {
|
|
4
|
+
IsNotEmpty,
|
|
5
|
+
IsString,
|
|
6
|
+
IsUUID,
|
|
7
|
+
MaxLength,
|
|
8
|
+
ValidateNested,
|
|
9
|
+
} from 'class-validator';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Corpo HTTP e campo `payload` no RPC Kafka para registrar token FCM do utilizador autenticado.
|
|
13
|
+
*/
|
|
14
|
+
export class RegisterPushTokenDto {
|
|
15
|
+
@ApiProperty({
|
|
16
|
+
description: 'Token FCM (Firebase Cloud Messaging) do dispositivo',
|
|
17
|
+
example: 'dK3p...',
|
|
18
|
+
maxLength: 4096,
|
|
19
|
+
})
|
|
20
|
+
@IsString()
|
|
21
|
+
@IsNotEmpty()
|
|
22
|
+
@MaxLength(4096)
|
|
23
|
+
token: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Payload Kafka `notifications.registerPushToken`.
|
|
28
|
+
*/
|
|
29
|
+
export class NotificationsRegisterPushTokenKafkaDto {
|
|
30
|
+
@IsString()
|
|
31
|
+
@IsNotEmpty()
|
|
32
|
+
tenant: string;
|
|
33
|
+
|
|
34
|
+
@IsUUID('4')
|
|
35
|
+
userId: string;
|
|
36
|
+
|
|
37
|
+
@ValidateNested()
|
|
38
|
+
@Type(() => RegisterPushTokenDto)
|
|
39
|
+
payload: RegisterPushTokenDto;
|
|
40
|
+
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tenants that must not trigger tenant-service DB resolution for analytics ingestion.
|
|
3
|
-
* Events for these slugs are acknowledged without persistence (no per-tenant DB row).
|
|
4
|
-
*/
|
|
5
|
-
export const TYCHAT_ANALYTICS_SKIP_TENANT_LOOKUP_SLUG = '__tychat_system__';
|
|
6
|
-
|
|
7
|
-
export function shouldSkipAnalyticsTenantLookup(tenantSlug: string): boolean {
|
|
8
|
-
const t = tenantSlug?.trim();
|
|
9
|
-
return t === TYCHAT_ANALYTICS_SKIP_TENANT_LOOKUP_SLUG;
|
|
10
|
-
}
|