@yolo-croket-dev/amqp-access 0.7.362 → 0.7.363

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.
@@ -27,6 +27,7 @@ exports.AmqpNotificationServiceModule = AmqpNotificationServiceModule = __decora
27
27
  services_1.AmqpSendNotificationService,
28
28
  services_1.AmqpNotificationBulkSendService,
29
29
  services_1.AmqpAmplitudeCohortExportJobService,
30
+ services_1.AmqpNotificationCampaignService,
30
31
  ],
31
32
  exports: [
32
33
  amqp_notification_service_provider_1.NotifiactionServiceProvider,
@@ -39,6 +40,7 @@ exports.AmqpNotificationServiceModule = AmqpNotificationServiceModule = __decora
39
40
  services_1.AmqpSendNotificationService,
40
41
  services_1.AmqpNotificationBulkSendService,
41
42
  services_1.AmqpAmplitudeCohortExportJobService,
43
+ services_1.AmqpNotificationCampaignService,
42
44
  ],
43
45
  })
44
46
  ], AmqpNotificationServiceModule);
@@ -3,3 +3,4 @@ export * from './app-bulk-push-log';
3
3
  export * from './notification';
4
4
  export * from './notification-bulk-send';
5
5
  export * from './amplitude-cohort-export-job';
6
+ export * from './notification-campaign';
@@ -19,3 +19,4 @@ __exportStar(require("./app-bulk-push-log"), exports);
19
19
  __exportStar(require("./notification"), exports);
20
20
  __exportStar(require("./notification-bulk-send"), exports);
21
21
  __exportStar(require("./amplitude-cohort-export-job"), exports);
22
+ __exportStar(require("./notification-campaign"), exports);
@@ -0,0 +1,50 @@
1
+ import { NotificationCampaignMessage, NotificationCampaignStatus } from '@yolo-croket-dev/entity-v2';
2
+ /**
3
+ * @author jun
4
+ * @description 시트에서 확정된 개인별 메시지 계약
5
+ * @process 경계 검증 후 notification-service에 전달
6
+ */
7
+ export declare class NotificationCampaignMessagePayload implements NotificationCampaignMessage {
8
+ userId: string;
9
+ itemId: string;
10
+ couponCode: string;
11
+ pushTitle: string;
12
+ pushBody: string;
13
+ pushAppLink: string;
14
+ pushWebLink: string;
15
+ pushImage: string;
16
+ }
17
+ export declare class GetNotificationCampaignPayload {
18
+ campaignId: string;
19
+ afterUserId?: string;
20
+ }
21
+ export declare class RegisterNotificationCampaignPayload {
22
+ campaignId: string;
23
+ snapshotHash: string;
24
+ startsAt: string;
25
+ endsAt: string;
26
+ recipients: NotificationCampaignMessagePayload[];
27
+ }
28
+ export declare class SendNotificationCampaignPayload {
29
+ campaignId: string;
30
+ userId: string;
31
+ snapshotHash: string;
32
+ }
33
+ export interface NotificationCampaignRecipientResult {
34
+ userId: string;
35
+ itemId: string;
36
+ couponCode: string;
37
+ snapshotHash: string;
38
+ messageHash: string;
39
+ status: NotificationCampaignStatus;
40
+ reason: string;
41
+ providerRequestId?: string;
42
+ updatedAt: string;
43
+ }
44
+ export interface RegisterNotificationCampaignResult {
45
+ registered: number;
46
+ }
47
+ export interface GetNotificationCampaignResult {
48
+ recipients: NotificationCampaignRecipientResult[];
49
+ nextUserId?: string;
50
+ }
@@ -0,0 +1,119 @@
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.SendNotificationCampaignPayload = exports.RegisterNotificationCampaignPayload = exports.GetNotificationCampaignPayload = exports.NotificationCampaignMessagePayload = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ /**
16
+ * @author jun
17
+ * @description 시트에서 확정된 개인별 메시지 계약
18
+ * @process 경계 검증 후 notification-service에 전달
19
+ */
20
+ class NotificationCampaignMessagePayload {
21
+ }
22
+ exports.NotificationCampaignMessagePayload = NotificationCampaignMessagePayload;
23
+ __decorate([
24
+ (0, class_validator_1.IsMongoId)(),
25
+ __metadata("design:type", String)
26
+ ], NotificationCampaignMessagePayload.prototype, "userId", void 0);
27
+ __decorate([
28
+ (0, class_validator_1.IsMongoId)(),
29
+ __metadata("design:type", String)
30
+ ], NotificationCampaignMessagePayload.prototype, "itemId", void 0);
31
+ __decorate([
32
+ (0, class_validator_1.IsString)(),
33
+ (0, class_validator_1.MinLength)(1),
34
+ (0, class_validator_1.MaxLength)(100),
35
+ __metadata("design:type", String)
36
+ ], NotificationCampaignMessagePayload.prototype, "couponCode", void 0);
37
+ __decorate([
38
+ (0, class_validator_1.IsString)(),
39
+ (0, class_validator_1.MinLength)(1),
40
+ (0, class_validator_1.MaxLength)(100),
41
+ __metadata("design:type", String)
42
+ ], NotificationCampaignMessagePayload.prototype, "pushTitle", void 0);
43
+ __decorate([
44
+ (0, class_validator_1.IsString)(),
45
+ (0, class_validator_1.MinLength)(1),
46
+ (0, class_validator_1.MaxLength)(500),
47
+ __metadata("design:type", String)
48
+ ], NotificationCampaignMessagePayload.prototype, "pushBody", void 0);
49
+ __decorate([
50
+ (0, class_validator_1.Matches)(/^yeogoo:\/\//),
51
+ (0, class_validator_1.MaxLength)(1500),
52
+ __metadata("design:type", String)
53
+ ], NotificationCampaignMessagePayload.prototype, "pushAppLink", void 0);
54
+ __decorate([
55
+ (0, class_validator_1.Matches)(/^https:\/\//),
56
+ (0, class_validator_1.MaxLength)(1500),
57
+ __metadata("design:type", String)
58
+ ], NotificationCampaignMessagePayload.prototype, "pushWebLink", void 0);
59
+ __decorate([
60
+ (0, class_validator_1.Matches)(/^https:\/\//),
61
+ (0, class_validator_1.MaxLength)(1500),
62
+ __metadata("design:type", String)
63
+ ], NotificationCampaignMessagePayload.prototype, "pushImage", void 0);
64
+ class GetNotificationCampaignPayload {
65
+ }
66
+ exports.GetNotificationCampaignPayload = GetNotificationCampaignPayload;
67
+ __decorate([
68
+ (0, class_validator_1.Matches)(/^[a-z0-9][a-z0-9_-]{0,59}$/),
69
+ __metadata("design:type", String)
70
+ ], GetNotificationCampaignPayload.prototype, "campaignId", void 0);
71
+ __decorate([
72
+ (0, class_validator_1.IsOptional)(),
73
+ (0, class_validator_1.IsMongoId)(),
74
+ __metadata("design:type", String)
75
+ ], GetNotificationCampaignPayload.prototype, "afterUserId", void 0);
76
+ class RegisterNotificationCampaignPayload {
77
+ }
78
+ exports.RegisterNotificationCampaignPayload = RegisterNotificationCampaignPayload;
79
+ __decorate([
80
+ (0, class_validator_1.Matches)(/^[a-z0-9][a-z0-9_-]{0,59}$/),
81
+ __metadata("design:type", String)
82
+ ], RegisterNotificationCampaignPayload.prototype, "campaignId", void 0);
83
+ __decorate([
84
+ (0, class_validator_1.Matches)(/^[a-f0-9]{64}$/),
85
+ __metadata("design:type", String)
86
+ ], RegisterNotificationCampaignPayload.prototype, "snapshotHash", void 0);
87
+ __decorate([
88
+ (0, class_validator_1.IsISO8601)({ strict: true }),
89
+ (0, class_validator_1.Matches)(/(Z|[+-]\d{2}:\d{2})$/),
90
+ __metadata("design:type", String)
91
+ ], RegisterNotificationCampaignPayload.prototype, "startsAt", void 0);
92
+ __decorate([
93
+ (0, class_validator_1.IsISO8601)({ strict: true }),
94
+ (0, class_validator_1.Matches)(/(Z|[+-]\d{2}:\d{2})$/),
95
+ __metadata("design:type", String)
96
+ ], RegisterNotificationCampaignPayload.prototype, "endsAt", void 0);
97
+ __decorate([
98
+ (0, class_validator_1.IsArray)(),
99
+ (0, class_validator_1.ArrayMinSize)(1),
100
+ (0, class_validator_1.ArrayMaxSize)(100),
101
+ (0, class_validator_1.ValidateNested)({ each: true }),
102
+ (0, class_transformer_1.Type)(() => NotificationCampaignMessagePayload),
103
+ __metadata("design:type", Array)
104
+ ], RegisterNotificationCampaignPayload.prototype, "recipients", void 0);
105
+ class SendNotificationCampaignPayload {
106
+ }
107
+ exports.SendNotificationCampaignPayload = SendNotificationCampaignPayload;
108
+ __decorate([
109
+ (0, class_validator_1.Matches)(/^[a-z0-9][a-z0-9_-]{0,59}$/),
110
+ __metadata("design:type", String)
111
+ ], SendNotificationCampaignPayload.prototype, "campaignId", void 0);
112
+ __decorate([
113
+ (0, class_validator_1.IsMongoId)(),
114
+ __metadata("design:type", String)
115
+ ], SendNotificationCampaignPayload.prototype, "userId", void 0);
116
+ __decorate([
117
+ (0, class_validator_1.Matches)(/^[a-f0-9]{64}$/),
118
+ __metadata("design:type", String)
119
+ ], SendNotificationCampaignPayload.prototype, "snapshotHash", void 0);
@@ -0,0 +1,15 @@
1
+ import { ClientProxy } from '@nestjs/microservices';
2
+ import { AbstractParam } from '@yolo-croket-dev/core';
3
+ import { RegisterNotificationCampaignPayload, RegisterNotificationCampaignResult, SendNotificationCampaignPayload, NotificationCampaignRecipientResult, GetNotificationCampaignPayload, GetNotificationCampaignResult } from '../dto';
4
+ /**
5
+ * @author jun
6
+ * @description 운영 스크립트의 저빈도 순차 요청용 RPC client
7
+ * @process 등록/수신자 한 명 실행/결과 페이지 조회; 재시도는 서버의 저장 상태로 차단
8
+ */
9
+ export declare class AmqpNotificationCampaignService {
10
+ private readonly manager;
11
+ constructor(client: ClientProxy);
12
+ register(payload: RegisterNotificationCampaignPayload, param: AbstractParam): Promise<RegisterNotificationCampaignResult>;
13
+ send(payload: SendNotificationCampaignPayload, param: AbstractParam): Promise<NotificationCampaignRecipientResult>;
14
+ get(payload: GetNotificationCampaignPayload, param: AbstractParam): Promise<GetNotificationCampaignResult>;
15
+ }
@@ -12,27 +12,32 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.AmqpSignupCertificationService = void 0;
15
+ exports.AmqpNotificationCampaignService = void 0;
16
16
  const common_1 = require("@nestjs/common");
17
17
  const microservices_1 = require("@nestjs/microservices");
18
18
  const functions_1 = require("@yolo-croket-dev/core/functions");
19
19
  /**
20
- * @author 홍준
21
- * @description 가입 전 본인인증 귀속 AMQP client
22
- * @process 가입 완료 후 로그인된 사용자에게 일회성 인증 결과를 연결한다.
20
+ * @author jun
21
+ * @description 운영 스크립트의 저빈도 순차 요청용 RPC client
22
+ * @process 등록/수신자 한 명 실행/결과 페이지 조회; 재시도는 서버의 저장 상태로 차단
23
23
  */
24
- let AmqpSignupCertificationService = class AmqpSignupCertificationService {
24
+ let AmqpNotificationCampaignService = class AmqpNotificationCampaignService {
25
25
  constructor(client) {
26
- this.client = client;
27
- this.amqpManager = new functions_1.AmqpManagement(this.client);
26
+ this.manager = new functions_1.AmqpManagement(client);
28
27
  }
29
- async claim(payload, param) {
30
- return this.amqpManager.call('가입 전 본인인증 사용자 귀속', 'signup-certification.claim', payload, param, { isErrorThrowing: true });
28
+ register(payload, param) {
29
+ return this.manager.call('캠페인 등록', 'notification-campaign.register.recipients', payload, param, { isErrorThrowing: true });
30
+ }
31
+ send(payload, param) {
32
+ return this.manager.call('캠페인 수신자 발송', 'notification-campaign.send.recipient', payload, param, { isErrorThrowing: true });
33
+ }
34
+ get(payload, param) {
35
+ return this.manager.call('캠페인 결과 조회', 'notification-campaign.get.results', payload, param, { isErrorThrowing: true });
31
36
  }
32
37
  };
33
- exports.AmqpSignupCertificationService = AmqpSignupCertificationService;
34
- exports.AmqpSignupCertificationService = AmqpSignupCertificationService = __decorate([
38
+ exports.AmqpNotificationCampaignService = AmqpNotificationCampaignService;
39
+ exports.AmqpNotificationCampaignService = AmqpNotificationCampaignService = __decorate([
35
40
  (0, common_1.Injectable)(),
36
- __param(0, (0, common_1.Inject)('USER_SERVICE_PROVIDER')),
41
+ __param(0, (0, common_1.Inject)('NOTIFICATION_SERVICE_PROVIDER')),
37
42
  __metadata("design:paramtypes", [microservices_1.ClientProxy])
38
- ], AmqpSignupCertificationService);
43
+ ], AmqpNotificationCampaignService);
@@ -6,3 +6,4 @@ export * from './amqp.app-bulk-push.service';
6
6
  export * from './amqp.send-notification.service';
7
7
  export * from './amqp.notification-bulk-send.service';
8
8
  export * from './amqp.amplitude-cohort-export-job.service';
9
+ export * from './amqp.notification-campaign.service';
@@ -22,3 +22,4 @@ __exportStar(require("./amqp.app-bulk-push.service"), exports);
22
22
  __exportStar(require("./amqp.send-notification.service"), exports);
23
23
  __exportStar(require("./amqp.notification-bulk-send.service"), exports);
24
24
  __exportStar(require("./amqp.amplitude-cohort-export-job.service"), exports);
25
+ __exportStar(require("./amqp.notification-campaign.service"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yolo-croket-dev/amqp-access",
3
- "version": "0.7.362",
3
+ "version": "0.7.363",
4
4
  "main": "index.js",
5
5
  "author": "Yolo Co., Ltd.",
6
6
  "description": "크로켓 amqp-access npm",
@@ -23,7 +23,7 @@
23
23
  "@yolo-croket-dev/domain": "0.2.50",
24
24
  "@yolo-croket-dev/dto-v2": "0.2.31",
25
25
  "@yolo-croket-dev/entity": "0.2.109",
26
- "@yolo-croket-dev/entity-v2": "0.3.54",
26
+ "@yolo-croket-dev/entity-v2": "0.3.55",
27
27
  "class-transformer": "^0.5.1",
28
28
  "class-validator": "^0.13.2",
29
29
  "dotenv": "^16.3.1"
@@ -1,14 +0,0 @@
1
- import { ClientProxy } from '@nestjs/microservices';
2
- import { AbstractParam } from '@yolo-croket-dev/core';
3
- import { ClaimSignupCertificationPayload, ClaimSignupCertificationResult } from '../dto/signup-certification';
4
- /**
5
- * @author 홍준
6
- * @description 가입 전 본인인증 귀속 AMQP client
7
- * @process 가입 완료 후 로그인된 사용자에게 일회성 인증 결과를 연결한다.
8
- */
9
- export declare class AmqpSignupCertificationService {
10
- private readonly client;
11
- private readonly amqpManager;
12
- constructor(client: ClientProxy);
13
- claim(payload: ClaimSignupCertificationPayload, param: AbstractParam): Promise<ClaimSignupCertificationResult>;
14
- }