nesthub 1.0.0 → 1.0.2
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/README.md +0 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/dist/queue/README.md +1 -1
- package/dist/queue/index.d.ts +4 -9
- package/dist/queue/index.js +5 -1
- package/dist/queue/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/queue/README.md +1 -1
- package/dist/cache/index.spec.d.ts +0 -1
- package/dist/cache/index.spec.js +0 -61
- package/dist/cache/index.spec.js.map +0 -1
- package/dist/excel/excel.module.d.ts +0 -2
- package/dist/excel/excel.module.js +0 -21
- package/dist/excel/excel.module.js.map +0 -1
- package/dist/excel/interfaces.d.ts +0 -19
- package/dist/excel/interfaces.js +0 -3
- package/dist/excel/interfaces.js.map +0 -1
- package/dist/index.spec.d.ts +0 -1
- package/dist/index.spec.js +0 -11
- package/dist/index.spec.js.map +0 -1
- package/dist/notification/email/index.d.ts +0 -62
- package/dist/notification/email/index.js +0 -253
- package/dist/notification/email/index.js.map +0 -1
- package/dist/notification/email/index.spec.d.ts +0 -1
- package/dist/notification/email/index.spec.js +0 -121
- package/dist/notification/email/index.spec.js.map +0 -1
- package/dist/notification/firebase/index.d.ts +0 -52
- package/dist/notification/firebase/index.js +0 -261
- package/dist/notification/firebase/index.js.map +0 -1
- package/dist/notification/firebase/index.spec.d.ts +0 -1
- package/dist/notification/firebase/index.spec.js +0 -114
- package/dist/notification/firebase/index.spec.js.map +0 -1
- package/dist/notification/index.spec.d.ts +0 -1
- package/dist/notification/index.spec.js +0 -336
- package/dist/notification/index.spec.js.map +0 -1
- package/dist/notification/shared.d.ts +0 -48
- package/dist/notification/shared.js +0 -95
- package/dist/notification/shared.js.map +0 -1
- package/dist/notification/sms/index.d.ts +0 -52
- package/dist/notification/sms/index.js +0 -234
- package/dist/notification/sms/index.js.map +0 -1
- package/dist/notification/sms/index.spec.d.ts +0 -1
- package/dist/notification/sms/index.spec.js +0 -123
- package/dist/notification/sms/index.spec.js.map +0 -1
- package/dist/notification/telegram/index.d.ts +0 -50
- package/dist/notification/telegram/index.js +0 -248
- package/dist/notification/telegram/index.js.map +0 -1
- package/dist/notification/telegram/index.spec.d.ts +0 -1
- package/dist/notification/telegram/index.spec.js +0 -108
- package/dist/notification/telegram/index.spec.js.map +0 -1
- package/dist/notification/typeorm-storage.d.ts +0 -28
- package/dist/notification/typeorm-storage.js +0 -56
- package/dist/notification/typeorm-storage.js.map +0 -1
- package/dist/notification/unified.d.ts +0 -47
- package/dist/notification/unified.js +0 -207
- package/dist/notification/unified.js.map +0 -1
- package/dist/queue/index.spec.d.ts +0 -1
- package/dist/queue/index.spec.js +0 -76
- package/dist/queue/index.spec.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/typeorm/index.spec.d.ts +0 -1
- package/dist/typeorm/index.spec.js +0 -109
- package/dist/typeorm/index.spec.js.map +0 -1
|
@@ -1,207 +0,0 @@
|
|
|
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
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
var NotificationModule_1;
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.NotificationModule = exports.NOTIFICATION_SERVICE = void 0;
|
|
17
|
-
const common_1 = require("@nestjs/common");
|
|
18
|
-
const email_1 = require("./email");
|
|
19
|
-
const sms_1 = require("./sms");
|
|
20
|
-
const firebase_1 = require("./firebase");
|
|
21
|
-
const telegram_1 = require("./telegram");
|
|
22
|
-
exports.NOTIFICATION_SERVICE = 'NOTIFICATION_SERVICE';
|
|
23
|
-
let UnifiedNotificationService = class UnifiedNotificationService {
|
|
24
|
-
emailService;
|
|
25
|
-
smsService;
|
|
26
|
-
firebaseService;
|
|
27
|
-
telegramService;
|
|
28
|
-
constructor(emailService, smsService, firebaseService, telegramService) {
|
|
29
|
-
this.emailService = emailService;
|
|
30
|
-
this.smsService = smsService;
|
|
31
|
-
this.firebaseService = firebaseService;
|
|
32
|
-
this.telegramService = telegramService;
|
|
33
|
-
}
|
|
34
|
-
async sendEmail(options) {
|
|
35
|
-
if (!this.emailService)
|
|
36
|
-
return {
|
|
37
|
-
success: false,
|
|
38
|
-
error: 'Email not configured. Add sendgrid option.',
|
|
39
|
-
};
|
|
40
|
-
return this.emailService.sendEmail(options);
|
|
41
|
-
}
|
|
42
|
-
async sendSms(options) {
|
|
43
|
-
if (!this.smsService)
|
|
44
|
-
return {
|
|
45
|
-
success: false,
|
|
46
|
-
error: 'SMS not configured. Add twilio option.',
|
|
47
|
-
};
|
|
48
|
-
return this.smsService.sendSms(options);
|
|
49
|
-
}
|
|
50
|
-
async sendPush(options) {
|
|
51
|
-
if (!this.firebaseService)
|
|
52
|
-
return {
|
|
53
|
-
success: false,
|
|
54
|
-
error: 'Push not configured. Add firebase option.',
|
|
55
|
-
};
|
|
56
|
-
return this.firebaseService.sendPush(options);
|
|
57
|
-
}
|
|
58
|
-
async sendTelegram(options) {
|
|
59
|
-
if (!this.telegramService)
|
|
60
|
-
return {
|
|
61
|
-
success: false,
|
|
62
|
-
error: 'Telegram not configured. Add botToken option.',
|
|
63
|
-
};
|
|
64
|
-
return this.telegramService.sendTelegram(options);
|
|
65
|
-
}
|
|
66
|
-
async cancelJob(dedupId) {
|
|
67
|
-
await Promise.allSettled([
|
|
68
|
-
this.emailService?.cancelJob(dedupId),
|
|
69
|
-
this.smsService?.cancelJob(dedupId),
|
|
70
|
-
this.firebaseService?.cancelJob(dedupId),
|
|
71
|
-
this.telegramService?.cancelJob(dedupId),
|
|
72
|
-
]);
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
UnifiedNotificationService = __decorate([
|
|
76
|
-
(0, common_1.Injectable)(),
|
|
77
|
-
__param(0, (0, common_1.Optional)()),
|
|
78
|
-
__param(0, (0, common_1.Inject)(email_1.EMAIL_SERVICE)),
|
|
79
|
-
__param(1, (0, common_1.Optional)()),
|
|
80
|
-
__param(1, (0, common_1.Inject)(sms_1.SMS_SERVICE)),
|
|
81
|
-
__param(2, (0, common_1.Optional)()),
|
|
82
|
-
__param(2, (0, common_1.Inject)(firebase_1.FIREBASE_SERVICE)),
|
|
83
|
-
__param(3, (0, common_1.Optional)()),
|
|
84
|
-
__param(3, (0, common_1.Inject)(telegram_1.TELEGRAM_SERVICE)),
|
|
85
|
-
__metadata("design:paramtypes", [Object, Object, Object, Object])
|
|
86
|
-
], UnifiedNotificationService);
|
|
87
|
-
let NotificationModule = NotificationModule_1 = class NotificationModule {
|
|
88
|
-
static forRoot(options = {}) {
|
|
89
|
-
const subImports = [];
|
|
90
|
-
if (hasDeclared(options.sendgrid)) {
|
|
91
|
-
subImports.push(email_1.EmailModule.forRoot({
|
|
92
|
-
defaultFrom: options.defaultFrom,
|
|
93
|
-
defaultLocale: options.defaultLocale,
|
|
94
|
-
sendgrid: options.sendgrid,
|
|
95
|
-
queue: options.queue,
|
|
96
|
-
templates: options.templates,
|
|
97
|
-
storage: options.storage,
|
|
98
|
-
}));
|
|
99
|
-
}
|
|
100
|
-
if (hasDeclared(options.twilio)) {
|
|
101
|
-
subImports.push(sms_1.SmsModule.forRoot({
|
|
102
|
-
defaultFrom: options.defaultFrom,
|
|
103
|
-
defaultLocale: options.defaultLocale,
|
|
104
|
-
twilio: options.twilio,
|
|
105
|
-
queue: options.queue,
|
|
106
|
-
templates: options.templates,
|
|
107
|
-
storage: options.storage,
|
|
108
|
-
}));
|
|
109
|
-
}
|
|
110
|
-
if (hasDeclared(options.firebase)) {
|
|
111
|
-
subImports.push(firebase_1.FirebaseModule.forRoot({
|
|
112
|
-
firebase: options.firebase,
|
|
113
|
-
queue: options.queue,
|
|
114
|
-
storage: options.storage,
|
|
115
|
-
}));
|
|
116
|
-
}
|
|
117
|
-
if (hasDeclared(options.botToken)) {
|
|
118
|
-
subImports.push(telegram_1.TelegramModule.forRoot({
|
|
119
|
-
botToken: options.botToken,
|
|
120
|
-
defaultLocale: options.defaultLocale,
|
|
121
|
-
queue: options.queue,
|
|
122
|
-
templates: options.templates,
|
|
123
|
-
storage: options.storage,
|
|
124
|
-
}));
|
|
125
|
-
}
|
|
126
|
-
return {
|
|
127
|
-
module: NotificationModule_1,
|
|
128
|
-
imports: subImports,
|
|
129
|
-
providers: [
|
|
130
|
-
{ provide: exports.NOTIFICATION_SERVICE, useClass: UnifiedNotificationService },
|
|
131
|
-
],
|
|
132
|
-
exports: [exports.NOTIFICATION_SERVICE],
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
static forRootAsync(options) {
|
|
136
|
-
return {
|
|
137
|
-
module: NotificationModule_1,
|
|
138
|
-
imports: [
|
|
139
|
-
email_1.EmailModule.forRootAsync({
|
|
140
|
-
useFactory: async (...args) => {
|
|
141
|
-
const unified = await options.useFactory(...args);
|
|
142
|
-
return {
|
|
143
|
-
defaultFrom: unified.defaultFrom,
|
|
144
|
-
defaultLocale: unified.defaultLocale,
|
|
145
|
-
sendgrid: unified.sendgrid,
|
|
146
|
-
queue: unified.queue,
|
|
147
|
-
templates: unified.templates,
|
|
148
|
-
storage: unified.storage,
|
|
149
|
-
};
|
|
150
|
-
},
|
|
151
|
-
inject: options.inject ?? [],
|
|
152
|
-
}),
|
|
153
|
-
sms_1.SmsModule.forRootAsync({
|
|
154
|
-
useFactory: async (...args) => {
|
|
155
|
-
const unified = await options.useFactory(...args);
|
|
156
|
-
return {
|
|
157
|
-
defaultFrom: unified.defaultFrom,
|
|
158
|
-
defaultLocale: unified.defaultLocale,
|
|
159
|
-
twilio: unified.twilio,
|
|
160
|
-
queue: unified.queue,
|
|
161
|
-
templates: unified.templates,
|
|
162
|
-
storage: unified.storage,
|
|
163
|
-
};
|
|
164
|
-
},
|
|
165
|
-
inject: options.inject ?? [],
|
|
166
|
-
}),
|
|
167
|
-
firebase_1.FirebaseModule.forRootAsync({
|
|
168
|
-
useFactory: async (...args) => {
|
|
169
|
-
const unified = await options.useFactory(...args);
|
|
170
|
-
return {
|
|
171
|
-
firebase: unified.firebase,
|
|
172
|
-
queue: unified.queue,
|
|
173
|
-
storage: unified.storage,
|
|
174
|
-
};
|
|
175
|
-
},
|
|
176
|
-
inject: options.inject ?? [],
|
|
177
|
-
}),
|
|
178
|
-
telegram_1.TelegramModule.forRootAsync({
|
|
179
|
-
useFactory: async (...args) => {
|
|
180
|
-
const unified = await options.useFactory(...args);
|
|
181
|
-
return {
|
|
182
|
-
botToken: unified.botToken ?? '',
|
|
183
|
-
defaultLocale: unified.defaultLocale,
|
|
184
|
-
queue: unified.queue,
|
|
185
|
-
templates: unified.templates,
|
|
186
|
-
storage: unified.storage,
|
|
187
|
-
};
|
|
188
|
-
},
|
|
189
|
-
inject: options.inject ?? [],
|
|
190
|
-
}),
|
|
191
|
-
],
|
|
192
|
-
providers: [
|
|
193
|
-
{ provide: exports.NOTIFICATION_SERVICE, useClass: UnifiedNotificationService },
|
|
194
|
-
],
|
|
195
|
-
exports: [exports.NOTIFICATION_SERVICE],
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
exports.NotificationModule = NotificationModule;
|
|
200
|
-
exports.NotificationModule = NotificationModule = NotificationModule_1 = __decorate([
|
|
201
|
-
(0, common_1.Global)(),
|
|
202
|
-
(0, common_1.Module)({})
|
|
203
|
-
], NotificationModule);
|
|
204
|
-
function hasDeclared(value) {
|
|
205
|
-
return value !== undefined && value !== null;
|
|
206
|
-
}
|
|
207
|
-
//# sourceMappingURL=unified.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unified.js","sourceRoot":"","sources":["../../src/notification/unified.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAKA,2CAA8E;AAW9E,mCAAqD;AAErD,+BAA+C;AAM/C,yCAA8D;AAE9D,yCAA8D;AAEjD,QAAA,oBAAoB,GAAG,sBAAsB,CAAC;AAmC3D,IACM,0BAA0B,GADhC,MACM,0BAA0B;IAIX;IACiC;IAGjC;IAGA;IAVnB,YAGmB,YAA4B,EACK,UAAwB,EAGzD,eAAkC,EAGlC,eAAkC;QAPlC,iBAAY,GAAZ,YAAY,CAAgB;QACK,eAAU,GAAV,UAAU,CAAc;QAGzD,oBAAe,GAAf,eAAe,CAAmB;QAGlC,oBAAe,GAAf,eAAe,CAAmB;IAClD,CAAC;IAEJ,KAAK,CAAC,SAAS,CAAC,OAAyB;QACvC,IAAI,CAAC,IAAI,CAAC,YAAY;YACpB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,4CAA4C;aACpD,CAAC;QACJ,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAAuB;QACnC,IAAI,CAAC,IAAI,CAAC,UAAU;YAClB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,wCAAwC;aAChD,CAAC;QACJ,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;I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aACxE;YACD,OAAO,EAAE,CAAC,4BAAoB,CAAC;SAChC,CAAC;IACJ,CAAC;CACF,CAAA;AAlIY,gDAAkB;6BAAlB,kBAAkB;IAF9B,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,kBAAkB,CAkI9B;AAED,SAAS,WAAW,CAAI,KAAoB;IAC1C,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC;AAC/C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/queue/index.spec.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const index_1 = require("./index");
|
|
4
|
-
function createMockConfigService(env = {}) {
|
|
5
|
-
return {
|
|
6
|
-
get: jest.fn((key, defaultValue) => {
|
|
7
|
-
return key in env ? env[key] : defaultValue;
|
|
8
|
-
}),
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
describe('@vn.chemgio/nestjs-utilities/queue', () => {
|
|
12
|
-
describe('configBullMQ', () => {
|
|
13
|
-
it('should read VALKEY_URL by default', () => {
|
|
14
|
-
const config = createMockConfigService({
|
|
15
|
-
VALKEY_URL: 'valkey://localhost:6379',
|
|
16
|
-
});
|
|
17
|
-
const result = (0, index_1.configBullMQ)(config);
|
|
18
|
-
expect(result.connection.url).toBe('valkey://localhost:6379');
|
|
19
|
-
expect(config.get).toHaveBeenCalledWith('VALKEY_URL');
|
|
20
|
-
});
|
|
21
|
-
it('should read REDIS_URL for redis store', () => {
|
|
22
|
-
const config = createMockConfigService({
|
|
23
|
-
REDIS_URL: 'redis://localhost:6379',
|
|
24
|
-
});
|
|
25
|
-
const result = (0, index_1.configBullMQ)(config, {
|
|
26
|
-
store: 'redis',
|
|
27
|
-
});
|
|
28
|
-
expect(result.connection.url).toBe('redis://localhost:6379');
|
|
29
|
-
expect(config.get).toHaveBeenCalledWith('REDIS_URL');
|
|
30
|
-
});
|
|
31
|
-
it('should throw on missing env var', () => {
|
|
32
|
-
const config = createMockConfigService();
|
|
33
|
-
expect(() => (0, index_1.configBullMQ)(config)).toThrow('Missing VALKEY_URL environment variable.');
|
|
34
|
-
});
|
|
35
|
-
it('should throw with REDIS_URL for redis store', () => {
|
|
36
|
-
const config = createMockConfigService();
|
|
37
|
-
expect(() => (0, index_1.configBullMQ)(config, { store: 'redis' })).toThrow('Missing REDIS_URL environment variable.');
|
|
38
|
-
});
|
|
39
|
-
it('should apply prefix option', () => {
|
|
40
|
-
const config = createMockConfigService({
|
|
41
|
-
VALKEY_URL: 'valkey://localhost:6379',
|
|
42
|
-
});
|
|
43
|
-
const result = (0, index_1.configBullMQ)(config, {
|
|
44
|
-
prefix: '{myapp}',
|
|
45
|
-
});
|
|
46
|
-
expect(result.prefix).toBe('{myapp}');
|
|
47
|
-
});
|
|
48
|
-
it('should default prefix to {default}', () => {
|
|
49
|
-
const config = createMockConfigService({
|
|
50
|
-
VALKEY_URL: 'valkey://localhost:6379',
|
|
51
|
-
});
|
|
52
|
-
const result = (0, index_1.configBullMQ)(config);
|
|
53
|
-
expect(result.prefix).toBe('{default}');
|
|
54
|
-
});
|
|
55
|
-
it('should apply defaultJobOptions', () => {
|
|
56
|
-
const config = createMockConfigService({
|
|
57
|
-
VALKEY_URL: 'valkey://localhost:6379',
|
|
58
|
-
});
|
|
59
|
-
const result = (0, index_1.configBullMQ)(config, {
|
|
60
|
-
defaultJobOptions: { attempts: 3, removeOnComplete: 100 },
|
|
61
|
-
});
|
|
62
|
-
expect(result.defaultJobOptions).toEqual({
|
|
63
|
-
attempts: 3,
|
|
64
|
-
removeOnComplete: 100,
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
it('should return undefined defaultJobOptions when not set', () => {
|
|
68
|
-
const config = createMockConfigService({
|
|
69
|
-
VALKEY_URL: 'valkey://localhost:6379',
|
|
70
|
-
});
|
|
71
|
-
const result = (0, index_1.configBullMQ)(config);
|
|
72
|
-
expect(result.defaultJobOptions).toBeUndefined();
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
//# sourceMappingURL=index.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../../src/queue/index.spec.ts"],"names":[],"mappings":";;AACA,mCAA2D;AAM3D,SAAS,uBAAuB,CAC9B,MAA8B,EAAE;IAEhC,OAAO;QACL,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,GAAW,EAAE,YAAsB,EAAE,EAAE;YACnD,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC;QAC9C,CAAC,CAAC;KACH,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,oCAAoC,EAAE,GAAG,EAAE;IAClD,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;QAC5B,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;YAC3C,MAAM,MAAM,GAAG,uBAAuB,CAAC;gBACrC,UAAU,EAAE,yBAAyB;aACtC,CAAC,CAAC;YACH,MAAM,MAAM,GAAG,IAAA,oBAAY,EAAC,MAAkC,CAAC,CAAC;YAEhE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;YAC9D,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;YAC/C,MAAM,MAAM,GAAG,uBAAuB,CAAC;gBACrC,SAAS,EAAE,wBAAwB;aACpC,CAAC,CAAC;YACH,MAAM,MAAM,GAAG,IAAA,oBAAY,EAAC,MAAkC,EAAE;gBAC9D,KAAK,EAAE,OAAO;aACf,CA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