@nest-boot/schedule 4.2.3 → 5.0.0-alpha.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/dist/get-schedule-processor-name.util.d.ts +1 -0
- package/dist/get-schedule-processor-name.util.js +6 -0
- package/dist/get-schedule-processor-name.util.js.map +1 -0
- package/dist/schedule-module-options.interface.d.ts +2 -4
- package/dist/schedule.decorator.d.ts +3 -3
- package/dist/schedule.decorator.js +6 -1
- package/dist/schedule.decorator.js.map +1 -1
- package/dist/schedule.module-definition.d.ts +1 -8
- package/dist/schedule.module-definition.js +1 -8
- package/dist/schedule.module-definition.js.map +1 -1
- package/dist/schedule.module.d.ts +5 -1
- package/dist/schedule.module.js +23 -0
- package/dist/schedule.module.js.map +1 -1
- package/dist/schedule.service.d.ts +7 -16
- package/dist/schedule.service.js +15 -68
- package/dist/schedule.service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -18
- package/dist/schedule-server.interface.d.ts +0 -4
- package/dist/schedule-server.interface.js +0 -3
- package/dist/schedule-server.interface.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getScheduleProcessorName: (target: Object, propertyKey: string) => string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getScheduleProcessorName = void 0;
|
|
4
|
+
const getScheduleProcessorName = (target, propertyKey) => `schedule#${target.constructor.name}#${propertyKey}`;
|
|
5
|
+
exports.getScheduleProcessorName = getScheduleProcessorName;
|
|
6
|
+
//# sourceMappingURL=get-schedule-processor-name.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-schedule-processor-name.util.js","sourceRoot":"","sources":["../src/get-schedule-processor-name.util.ts"],"names":[],"mappings":";;;AAAO,MAAM,wBAAwB,GAAG,CAEtC,MAAc,EACd,WAAmB,EACnB,EAAE,CAAC,YAAY,MAAM,CAAC,WAAW,CAAC,IAAI,IAAI,WAAW,EAAE,CAAC;AAJ7C,QAAA,wBAAwB,4BAIqB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type ScheduleMetadataOptions } from "./schedule-metadata-options.interface";
|
|
2
|
-
export declare const Schedule: (options: ScheduleMetadataOptions) =>
|
|
3
|
-
export declare const Cron: (value: string, options?: Omit<ScheduleMetadataOptions, "type" | "value">) =>
|
|
4
|
-
export declare const Interval: (value: number | string) =>
|
|
2
|
+
export declare const Schedule: (options: ScheduleMetadataOptions) => <T>(target: Object, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => void;
|
|
3
|
+
export declare const Cron: (value: string, options?: Omit<ScheduleMetadataOptions, "type" | "value">) => <T>(target: Object, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => void;
|
|
4
|
+
export declare const Interval: (value: number | string) => <T>(target: Object, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => void;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Interval = exports.Cron = exports.Schedule = void 0;
|
|
4
|
+
const queue_1 = require("@nest-boot/queue");
|
|
4
5
|
const common_1 = require("@nestjs/common");
|
|
6
|
+
const get_schedule_processor_name_util_1 = require("./get-schedule-processor-name.util");
|
|
5
7
|
const schedule_module_definition_1 = require("./schedule.module-definition");
|
|
6
|
-
const Schedule = (options) => (target, propertyKey, descriptor) =>
|
|
8
|
+
const Schedule = (options) => (target, propertyKey, descriptor) => {
|
|
9
|
+
(0, queue_1.Processor)((0, get_schedule_processor_name_util_1.getScheduleProcessorName)(target, propertyKey))(target, propertyKey, descriptor);
|
|
10
|
+
(0, common_1.SetMetadata)(schedule_module_definition_1.SCHEDULE_METADATA_KEY, options)(target, propertyKey, descriptor);
|
|
11
|
+
};
|
|
7
12
|
exports.Schedule = Schedule;
|
|
8
13
|
const Cron = (value, options) => (0, exports.Schedule)({
|
|
9
14
|
type: "cron",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.decorator.js","sourceRoot":"","sources":["../src/schedule.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAE7C,6EAAqE;AAG9D,MAAM,QAAQ,GACnB,CAAC,OAAgC,
|
|
1
|
+
{"version":3,"file":"schedule.decorator.js","sourceRoot":"","sources":["../src/schedule.decorator.ts"],"names":[],"mappings":";;;AAAA,4CAA6C;AAC7C,2CAA6C;AAE7C,yFAA8E;AAC9E,6EAAqE;AAG9D,MAAM,QAAQ,GACnB,CAAC,OAAgC,EAAE,EAAE,CACrC,CAEE,MAAc,EACd,WAAmB,EACnB,UAAsC,EACtC,EAAE;IACF,IAAA,iBAAS,EAAC,IAAA,2DAAwB,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CACtD,MAAM,EACN,WAAW,EACX,UAAU,CACX,CAAC;IACF,IAAA,oBAAW,EACT,kDAAqB,EACrB,OAAO,CACR,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;AACrC,CAAC,CAAC;AAjBS,QAAA,QAAQ,YAiBjB;AAEG,MAAM,IAAI,GAAG,CAClB,KAAa,EACb,OAAyD,EACzD,EAAE,CACF,IAAA,gBAAQ,EAAC;IACP,IAAI,EAAE,MAAM;IACZ,KAAK;IACL,GAAG,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC;CACnB,CAAC,CAAC;AARQ,QAAA,IAAI,QAQZ;AAEE,MAAM,QAAQ,GAAG,CAAC,KAAsB,EAAE,EAAE,CACjD,IAAA,gBAAQ,EAAC;IACP,IAAI,EAAE,UAAU;IAChB,KAAK;CACN,CAAC,CAAC;AAJQ,QAAA,QAAQ,YAIhB"}
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
import { type ScheduleModuleOptions } from "./schedule-module-options.interface";
|
|
2
1
|
export declare const SCHEDULE_METADATA_KEY: `${string}-${string}-${string}-${string}-${string}`;
|
|
3
|
-
export declare const ConfigurableModuleClass: import("@nestjs/common").ConfigurableModuleCls<
|
|
4
|
-
isGlobal: boolean;
|
|
5
|
-
}>, MODULE_OPTIONS_TOKEN: string | symbol, OPTIONS_TYPE: ScheduleModuleOptions & Partial<{
|
|
6
|
-
isGlobal: boolean;
|
|
7
|
-
}>, ASYNC_OPTIONS_TYPE: import("@nestjs/common").ConfigurableModuleAsyncOptions<ScheduleModuleOptions, "create"> & Partial<{
|
|
8
|
-
isGlobal: boolean;
|
|
9
|
-
}>;
|
|
2
|
+
export declare const ConfigurableModuleClass: import("@nestjs/common").ConfigurableModuleCls<import("@nest-boot/queue").QueueModuleOptions, "register", "create", {}>, MODULE_OPTIONS_TOKEN: string | symbol, OPTIONS_TYPE: import("@nest-boot/queue").QueueModuleOptions & Partial<{}>, ASYNC_OPTIONS_TYPE: import("@nestjs/common").ConfigurableModuleAsyncOptions<import("@nest-boot/queue").QueueModuleOptions, "create"> & Partial<{}>;
|
|
@@ -5,12 +5,5 @@ exports.ASYNC_OPTIONS_TYPE = exports.OPTIONS_TYPE = exports.MODULE_OPTIONS_TOKEN
|
|
|
5
5
|
const common_1 = require("@nestjs/common");
|
|
6
6
|
const crypto_1 = require("crypto");
|
|
7
7
|
exports.SCHEDULE_METADATA_KEY = (0, crypto_1.randomUUID)();
|
|
8
|
-
_a = new common_1.ConfigurableModuleBuilder()
|
|
9
|
-
.setExtras({
|
|
10
|
-
isGlobal: true,
|
|
11
|
-
}, (definition, extras) => ({
|
|
12
|
-
...definition,
|
|
13
|
-
global: extras.isGlobal,
|
|
14
|
-
}))
|
|
15
|
-
.build(), exports.ConfigurableModuleClass = _a.ConfigurableModuleClass, exports.MODULE_OPTIONS_TOKEN = _a.MODULE_OPTIONS_TOKEN, exports.OPTIONS_TYPE = _a.OPTIONS_TYPE, exports.ASYNC_OPTIONS_TYPE = _a.ASYNC_OPTIONS_TYPE;
|
|
8
|
+
_a = new common_1.ConfigurableModuleBuilder().build(), exports.ConfigurableModuleClass = _a.ConfigurableModuleClass, exports.MODULE_OPTIONS_TOKEN = _a.MODULE_OPTIONS_TOKEN, exports.OPTIONS_TYPE = _a.OPTIONS_TYPE, exports.ASYNC_OPTIONS_TYPE = _a.ASYNC_OPTIONS_TYPE;
|
|
16
9
|
//# sourceMappingURL=schedule.module-definition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.module-definition.js","sourceRoot":"","sources":["../src/schedule.module-definition.ts"],"names":[],"mappings":";;;;AAAA,2CAA2D;AAC3D,mCAAoC;AAIvB,QAAA,qBAAqB,GAAG,IAAA,mBAAU,GAAE,CAAC;AAErC,KAKT,IAAI,kCAAyB,EAAyB
|
|
1
|
+
{"version":3,"file":"schedule.module-definition.js","sourceRoot":"","sources":["../src/schedule.module-definition.ts"],"names":[],"mappings":";;;;AAAA,2CAA2D;AAC3D,mCAAoC;AAIvB,QAAA,qBAAqB,GAAG,IAAA,mBAAU,GAAE,CAAC;AAErC,KAKT,IAAI,kCAAyB,EAAyB,CAAC,KAAK,EAAE,EAJhE,+BAAuB,+BACvB,4BAAoB,4BACpB,oBAAY,oBACZ,0BAAkB,yBAC+C"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type DynamicModule } from "@nestjs/common";
|
|
2
|
+
import { type ASYNC_OPTIONS_TYPE, ConfigurableModuleClass, type OPTIONS_TYPE } from "./schedule.module-definition";
|
|
2
3
|
export declare class ScheduleModule extends ConfigurableModuleClass {
|
|
4
|
+
static register(options: typeof OPTIONS_TYPE): DynamicModule;
|
|
5
|
+
static registerAsync(options: typeof ASYNC_OPTIONS_TYPE): DynamicModule;
|
|
6
|
+
private static withQueue;
|
|
3
7
|
}
|
package/dist/schedule.module.js
CHANGED
|
@@ -7,13 +7,36 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.ScheduleModule = void 0;
|
|
10
|
+
const queue_1 = require("@nest-boot/queue");
|
|
10
11
|
const common_1 = require("@nestjs/common");
|
|
11
12
|
const core_1 = require("@nestjs/core");
|
|
12
13
|
const schedule_module_definition_1 = require("./schedule.module-definition");
|
|
13
14
|
const schedule_service_1 = require("./schedule.service");
|
|
14
15
|
let ScheduleModule = exports.ScheduleModule = class ScheduleModule extends schedule_module_definition_1.ConfigurableModuleClass {
|
|
16
|
+
static register(options) {
|
|
17
|
+
return this.withQueue(super.register(options));
|
|
18
|
+
}
|
|
19
|
+
static registerAsync(options) {
|
|
20
|
+
return this.withQueue(super.registerAsync(options));
|
|
21
|
+
}
|
|
22
|
+
static withQueue(dynamicModule) {
|
|
23
|
+
var _a;
|
|
24
|
+
const ScheduleQueueDynamicModule = queue_1.QueueModule.registerAsync({
|
|
25
|
+
name: "schedule",
|
|
26
|
+
imports: [dynamicModule],
|
|
27
|
+
inject: [schedule_module_definition_1.MODULE_OPTIONS_TOKEN],
|
|
28
|
+
useFactory: (options) => options,
|
|
29
|
+
});
|
|
30
|
+
dynamicModule.imports = [
|
|
31
|
+
...((_a = dynamicModule.imports) !== null && _a !== void 0 ? _a : []),
|
|
32
|
+
ScheduleQueueDynamicModule,
|
|
33
|
+
];
|
|
34
|
+
dynamicModule.exports = [schedule_module_definition_1.MODULE_OPTIONS_TOKEN];
|
|
35
|
+
return dynamicModule;
|
|
36
|
+
}
|
|
15
37
|
};
|
|
16
38
|
exports.ScheduleModule = ScheduleModule = __decorate([
|
|
39
|
+
(0, common_1.Global)(),
|
|
17
40
|
(0, common_1.Module)({
|
|
18
41
|
providers: [core_1.DiscoveryService, core_1.MetadataScanner, common_1.Logger, schedule_service_1.ScheduleService],
|
|
19
42
|
exports: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.module.js","sourceRoot":"","sources":["../src/schedule.module.ts"],"names":[],"mappings":";;;;;;;;;AAA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
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
private readonly options;
|
|
7
|
-
private readonly moduleRef;
|
|
1
|
+
import { Queue } from "@nest-boot/queue";
|
|
2
|
+
import { type OnModuleInit } from "@nestjs/common";
|
|
3
|
+
import { DiscoveryService, MetadataScanner, Reflector } from "@nestjs/core";
|
|
4
|
+
export declare class ScheduleService implements OnModuleInit {
|
|
5
|
+
private readonly queue;
|
|
8
6
|
private readonly reflector;
|
|
9
7
|
private readonly discoveryService;
|
|
10
8
|
private readonly metadataScanner;
|
|
11
9
|
private readonly logger;
|
|
12
|
-
private readonly injector;
|
|
13
|
-
private readonly name;
|
|
14
|
-
private readonly queue;
|
|
15
|
-
private worker?;
|
|
16
10
|
private readonly schedules;
|
|
17
|
-
constructor(
|
|
18
|
-
discoverySchedules():
|
|
11
|
+
constructor(queue: Queue, reflector: Reflector, discoveryService: DiscoveryService, metadataScanner: MetadataScanner);
|
|
12
|
+
discoverySchedules(): void;
|
|
19
13
|
cleanUnregisteredSchedules(): Promise<void>;
|
|
20
14
|
registerSchedules(): Promise<void>;
|
|
21
|
-
processor(job: Job): Promise<void>;
|
|
22
|
-
run(): Promise<void>;
|
|
23
15
|
onModuleInit(): Promise<void>;
|
|
24
|
-
onApplicationShutdown(): Promise<void>;
|
|
25
16
|
}
|
package/dist/schedule.service.js
CHANGED
|
@@ -17,48 +17,32 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
var ScheduleService_1;
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.ScheduleService = void 0;
|
|
20
|
-
const
|
|
20
|
+
const queue_1 = require("@nest-boot/queue");
|
|
21
21
|
const common_1 = require("@nestjs/common");
|
|
22
22
|
const core_1 = require("@nestjs/core");
|
|
23
|
-
const injector_1 = require("@nestjs/core/injector/injector");
|
|
24
|
-
const bullmq_1 = require("bullmq");
|
|
25
23
|
const ms_1 = __importDefault(require("ms"));
|
|
24
|
+
const get_schedule_processor_name_util_1 = require("./get-schedule-processor-name.util");
|
|
26
25
|
const schedule_module_definition_1 = require("./schedule.module-definition");
|
|
27
26
|
let ScheduleService = exports.ScheduleService = ScheduleService_1 = class ScheduleService {
|
|
28
|
-
constructor(
|
|
29
|
-
|
|
30
|
-
this.options = options;
|
|
31
|
-
this.moduleRef = moduleRef;
|
|
27
|
+
constructor(queue, reflector, discoveryService, metadataScanner) {
|
|
28
|
+
this.queue = queue;
|
|
32
29
|
this.reflector = reflector;
|
|
33
30
|
this.discoveryService = discoveryService;
|
|
34
31
|
this.metadataScanner = metadataScanner;
|
|
35
32
|
this.logger = new common_1.Logger(ScheduleService_1.name);
|
|
36
|
-
this.injector = new injector_1.Injector();
|
|
37
33
|
this.schedules = new Map();
|
|
38
|
-
this.name = (_a = options.name) !== null && _a !== void 0 ? _a : "nest-boot-schedule";
|
|
39
|
-
this.queue = new bullmq_1.Queue(this.name, options);
|
|
40
34
|
}
|
|
41
|
-
|
|
35
|
+
discoverySchedules() {
|
|
42
36
|
this.discoveryService.getProviders().forEach((wrapper) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
if (typeof wrapper.instance === "object" && wrapper.instance !== null) {
|
|
38
|
+
const { instance } = wrapper;
|
|
39
|
+
this.metadataScanner
|
|
40
|
+
.getAllMethodNames(Object.getPrototypeOf(instance))
|
|
41
|
+
.forEach((key) => {
|
|
42
|
+
if (typeof instance.constructor.name === "string") {
|
|
49
43
|
const scheduleMetadataOptions = this.reflector.get(schedule_module_definition_1.SCHEDULE_METADATA_KEY, instance[key]);
|
|
50
44
|
if (typeof scheduleMetadataOptions !== "undefined") {
|
|
51
|
-
|
|
52
|
-
this.schedules.set(`${instance.constructor.name}#${key}`, {
|
|
53
|
-
...scheduleMetadataOptions,
|
|
54
|
-
processor: isRequestScoped
|
|
55
|
-
? async (job) => {
|
|
56
|
-
const contextId = (0, core_1.createContextId)();
|
|
57
|
-
const contextInstance = await this.injector.loadPerContext(instance, host, host.providers, contextId);
|
|
58
|
-
return contextInstance[key](job);
|
|
59
|
-
}
|
|
60
|
-
: (job) => instance[key](job),
|
|
61
|
-
});
|
|
45
|
+
this.schedules.set((0, get_schedule_processor_name_util_1.getScheduleProcessorName)(instance, key), scheduleMetadataOptions);
|
|
62
46
|
}
|
|
63
47
|
}
|
|
64
48
|
});
|
|
@@ -92,53 +76,16 @@ let ScheduleService = exports.ScheduleService = ScheduleService_1 = class Schedu
|
|
|
92
76
|
this.logger.log(`Registered {${name}, ${value}}`);
|
|
93
77
|
}));
|
|
94
78
|
}
|
|
95
|
-
async processor(job) {
|
|
96
|
-
var _a;
|
|
97
|
-
const ctx = new request_context_1.RequestContext(this.discoveryService);
|
|
98
|
-
ctx.set("job", job);
|
|
99
|
-
const processor = (_a = this.schedules.get(job.name)) === null || _a === void 0 ? void 0 : _a.processor;
|
|
100
|
-
if (typeof processor === "function") {
|
|
101
|
-
await request_context_1.RequestContext.run(ctx, async () => await processor(job));
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
async run() {
|
|
105
|
-
if (this.worker instanceof bullmq_1.Worker && !this.worker.isRunning()) {
|
|
106
|
-
void this.worker.run();
|
|
107
|
-
this.logger.log(`Worker started`);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
79
|
async onModuleInit() {
|
|
111
|
-
|
|
80
|
+
this.discoverySchedules();
|
|
112
81
|
await this.cleanUnregisteredSchedules();
|
|
113
82
|
await this.registerSchedules();
|
|
114
|
-
this.worker = new bullmq_1.Worker(this.name, async (job) => {
|
|
115
|
-
await this.processor(job);
|
|
116
|
-
}, {
|
|
117
|
-
autorun: false,
|
|
118
|
-
metrics: {
|
|
119
|
-
maxDataPoints: bullmq_1.MetricsTime.ONE_MONTH,
|
|
120
|
-
},
|
|
121
|
-
...this.options,
|
|
122
|
-
});
|
|
123
|
-
this.worker.on("failed", (job, err) => {
|
|
124
|
-
this.logger.error("schedule job failed", {
|
|
125
|
-
err,
|
|
126
|
-
...(typeof job !== "undefined"
|
|
127
|
-
? { queueName: job.queueName, jobName: job.name, jobId: job.id }
|
|
128
|
-
: {}),
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
async onApplicationShutdown() {
|
|
133
|
-
var _a;
|
|
134
|
-
await this.queue.close();
|
|
135
|
-
await ((_a = this.worker) === null || _a === void 0 ? void 0 : _a.close());
|
|
136
83
|
}
|
|
137
84
|
};
|
|
138
85
|
exports.ScheduleService = ScheduleService = ScheduleService_1 = __decorate([
|
|
139
86
|
(0, common_1.Injectable)(),
|
|
140
|
-
__param(0, (0,
|
|
141
|
-
__metadata("design:paramtypes", [
|
|
87
|
+
__param(0, (0, queue_1.InjectQueue)("schedule")),
|
|
88
|
+
__metadata("design:paramtypes", [queue_1.Queue,
|
|
142
89
|
core_1.Reflector,
|
|
143
90
|
core_1.DiscoveryService,
|
|
144
91
|
core_1.MetadataScanner])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.service.js","sourceRoot":"","sources":["../src/schedule.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"schedule.service.js","sourceRoot":"","sources":["../src/schedule.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,4CAAsD;AACtD,2CAAuE;AACvE,uCAA4E;AAC5E,4CAAoB;AAEpB,yFAA8E;AAC9E,6EAAqE;AAI9D,IAAM,eAAe,iDAArB,MAAM,eAAe;IAK1B,YAEE,KAA6B,EACZ,SAAoB,EACpB,gBAAkC,EAClC,eAAgC;QAHhC,UAAK,GAAL,KAAK,CAAO;QACZ,cAAS,GAAT,SAAS,CAAW;QACpB,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,oBAAe,GAAf,eAAe,CAAiB;QATlC,WAAM,GAAG,IAAI,eAAM,CAAC,iBAAe,CAAC,IAAI,CAAC,CAAC;QA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