@etohq/workflow-engine-redis 1.3.0 → 1.5.0
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/LICENSE +21 -0
- package/dist/loaders/redis.d.ts +2 -2
- package/dist/loaders/redis.d.ts.map +1 -1
- package/dist/loaders/redis.js +4 -1
- package/dist/loaders/redis.js.map +1 -1
- package/dist/migrations/Migration20250120111059.d.ts +6 -0
- package/dist/migrations/Migration20250120111059.d.ts.map +1 -0
- package/dist/migrations/Migration20250120111059.js +14 -0
- package/dist/migrations/Migration20250120111059.js.map +1 -0
- package/dist/migrations/Migration20250128174354.d.ts +6 -0
- package/dist/migrations/Migration20250128174354.d.ts.map +1 -0
- package/dist/migrations/Migration20250128174354.js +24 -0
- package/dist/migrations/Migration20250128174354.js.map +1 -0
- package/dist/migrations/Migration20250505101505.d.ts +6 -0
- package/dist/migrations/Migration20250505101505.d.ts.map +1 -0
- package/dist/migrations/Migration20250505101505.js +40 -0
- package/dist/migrations/Migration20250505101505.js.map +1 -0
- package/dist/models/workflow-execution.d.ts +2 -0
- package/dist/models/workflow-execution.d.ts.map +1 -1
- package/dist/models/workflow-execution.js +7 -0
- package/dist/models/workflow-execution.js.map +1 -1
- package/dist/services/workflow-orchestrator.d.ts +16 -7
- package/dist/services/workflow-orchestrator.d.ts.map +1 -1
- package/dist/services/workflow-orchestrator.js +148 -97
- package/dist/services/workflow-orchestrator.js.map +1 -1
- package/dist/services/workflows-module.d.ts +110 -5
- package/dist/services/workflows-module.d.ts.map +1 -1
- package/dist/services/workflows-module.js +117 -13
- package/dist/services/workflows-module.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/workflow-orchestrator-storage.d.ts +15 -4
- package/dist/utils/workflow-orchestrator-storage.d.ts.map +1 -1
- package/dist/utils/workflow-orchestrator-storage.js +302 -56
- package/dist/utils/workflow-orchestrator-storage.js.map +1 -1
- package/package.json +30 -30
|
@@ -18,56 +18,153 @@ const types_1 = require("@etohq/framework/types");
|
|
|
18
18
|
const utils_1 = require("@etohq/framework/utils");
|
|
19
19
|
const _models_1 = require("../models");
|
|
20
20
|
class WorkflowsModuleService extends utils_1.ModulesSdkUtils.EtoService({ WorkflowExecution: _models_1.WorkflowExecution }) {
|
|
21
|
-
constructor({ baseRepository, workflowExecutionService, workflowOrchestratorService, redisDisconnectHandler, }, moduleDeclaration) {
|
|
21
|
+
constructor({ manager, baseRepository, workflowExecutionService, workflowOrchestratorService, redisDisconnectHandler, }, moduleDeclaration) {
|
|
22
22
|
// @ts-ignore
|
|
23
23
|
super(...arguments);
|
|
24
24
|
this.moduleDeclaration = moduleDeclaration;
|
|
25
25
|
this.__hooks = {
|
|
26
|
-
|
|
27
|
-
await this.workflowOrchestratorService_.
|
|
28
|
-
await this.redisDisconnectHandler_();
|
|
26
|
+
onApplicationStart: async () => {
|
|
27
|
+
await this.workflowOrchestratorService_.onApplicationStart();
|
|
29
28
|
},
|
|
30
29
|
onApplicationPrepareShutdown: async () => {
|
|
31
30
|
await this.workflowOrchestratorService_.onApplicationPrepareShutdown();
|
|
32
31
|
},
|
|
33
|
-
|
|
34
|
-
await this.workflowOrchestratorService_.
|
|
32
|
+
onApplicationShutdown: async () => {
|
|
33
|
+
await this.workflowOrchestratorService_.onApplicationShutdown();
|
|
34
|
+
await this.redisDisconnectHandler_();
|
|
35
35
|
},
|
|
36
36
|
};
|
|
37
|
+
this.manager_ = manager;
|
|
37
38
|
this.baseRepository_ = baseRepository;
|
|
38
39
|
this.workflowExecutionService_ = workflowExecutionService;
|
|
39
40
|
this.workflowOrchestratorService_ = workflowOrchestratorService;
|
|
40
41
|
this.redisDisconnectHandler_ = redisDisconnectHandler;
|
|
41
42
|
}
|
|
43
|
+
static prepareFilters(filters) {
|
|
44
|
+
const filters_ = { ...filters }; // shallow copy
|
|
45
|
+
if (filters_?.q) {
|
|
46
|
+
const q = filters_.q;
|
|
47
|
+
delete filters_.q;
|
|
48
|
+
const textSearch = { $ilike: `%${q}%` };
|
|
49
|
+
const textSearchFilters = {
|
|
50
|
+
$or: [
|
|
51
|
+
{
|
|
52
|
+
transaction_id: textSearch,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
workflow_id: textSearch,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
state: textSearch,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
execution: {
|
|
62
|
+
runId: textSearch,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
};
|
|
67
|
+
if (!Object.keys(filters_).length) {
|
|
68
|
+
return textSearchFilters;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
return { $and: [filters, textSearchFilters] };
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return filters;
|
|
75
|
+
}
|
|
76
|
+
// @ts-expect-error
|
|
77
|
+
async listWorkflowExecutions(filters = {}, config, sharedContext) {
|
|
78
|
+
const filters_ = WorkflowsModuleService.prepareFilters(filters);
|
|
79
|
+
return await super.listWorkflowExecutions(filters_, config, sharedContext);
|
|
80
|
+
}
|
|
81
|
+
// @ts-expect-error
|
|
82
|
+
async listAndCountWorkflowExecutions(filters = {}, config, sharedContext) {
|
|
83
|
+
const filters_ = WorkflowsModuleService.prepareFilters(filters);
|
|
84
|
+
return await super.listAndCountWorkflowExecutions(filters_, config, sharedContext);
|
|
85
|
+
}
|
|
42
86
|
async run(workflowIdOrWorkflow, options = {}, context = {}) {
|
|
43
|
-
const
|
|
87
|
+
const options_ = JSON.parse(JSON.stringify(options ?? {}));
|
|
88
|
+
const { manager, transactionManager, preventReleaseEvents, transactionId, parentStepIdempotencyKey, ...restContext } = context;
|
|
89
|
+
let localPreventReleaseEvents = false;
|
|
90
|
+
if ((0, utils_1.isDefined)(options_.context?.preventReleaseEvents)) {
|
|
91
|
+
localPreventReleaseEvents = options_.context.preventReleaseEvents;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
if ((0, utils_1.isDefined)(context.eventGroupId) &&
|
|
95
|
+
(0, utils_1.isDefined)(options_.context?.eventGroupId) &&
|
|
96
|
+
context.eventGroupId === options_.context?.eventGroupId) {
|
|
97
|
+
localPreventReleaseEvents = true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
let eventGroupId;
|
|
101
|
+
if (options_.context?.eventGroupId) {
|
|
102
|
+
eventGroupId = options_.context.eventGroupId;
|
|
103
|
+
}
|
|
104
|
+
else if (localPreventReleaseEvents && context.eventGroupId) {
|
|
105
|
+
eventGroupId = context.eventGroupId;
|
|
106
|
+
}
|
|
107
|
+
options_.context = {
|
|
108
|
+
...(restContext ?? {}),
|
|
109
|
+
...(options_.context ?? {}),
|
|
110
|
+
eventGroupId,
|
|
111
|
+
preventReleaseEvents: localPreventReleaseEvents,
|
|
112
|
+
};
|
|
113
|
+
const ret = await this.workflowOrchestratorService_.run(workflowIdOrWorkflow, options_);
|
|
44
114
|
return ret;
|
|
45
115
|
}
|
|
46
116
|
async getRunningTransaction(workflowId, transactionId, context = {}) {
|
|
47
117
|
return await this.workflowOrchestratorService_.getRunningTransaction(workflowId, transactionId, context);
|
|
48
118
|
}
|
|
49
119
|
async setStepSuccess({ idempotencyKey, stepResponse, options, }, context = {}) {
|
|
120
|
+
const options_ = JSON.parse(JSON.stringify(options ?? {}));
|
|
121
|
+
const { manager, transactionManager, ...restContext } = context;
|
|
122
|
+
options_.context ??= restContext;
|
|
50
123
|
return await this.workflowOrchestratorService_.setStepSuccess({
|
|
51
124
|
idempotencyKey,
|
|
52
125
|
stepResponse,
|
|
53
|
-
options,
|
|
54
|
-
}
|
|
126
|
+
options: options_,
|
|
127
|
+
});
|
|
55
128
|
}
|
|
56
129
|
async setStepFailure({ idempotencyKey, stepResponse, options, }, context = {}) {
|
|
130
|
+
const options_ = JSON.parse(JSON.stringify(options ?? {}));
|
|
131
|
+
const { manager, transactionManager, ...restContext } = context;
|
|
132
|
+
options_.context ??= restContext;
|
|
57
133
|
return await this.workflowOrchestratorService_.setStepFailure({
|
|
58
134
|
idempotencyKey,
|
|
59
135
|
stepResponse,
|
|
60
|
-
options,
|
|
61
|
-
}
|
|
136
|
+
options: options_,
|
|
137
|
+
});
|
|
62
138
|
}
|
|
63
139
|
async subscribe(args, context = {}) {
|
|
64
|
-
return this.workflowOrchestratorService_.subscribe(args
|
|
140
|
+
return this.workflowOrchestratorService_.subscribe(args);
|
|
65
141
|
}
|
|
66
142
|
async unsubscribe(args, context = {}) {
|
|
67
|
-
return this.workflowOrchestratorService_.unsubscribe(args
|
|
143
|
+
return this.workflowOrchestratorService_.unsubscribe(args);
|
|
144
|
+
}
|
|
145
|
+
async cancel(workflowId, options, context = {}) {
|
|
146
|
+
return await this.workflowOrchestratorService_.cancel(workflowId, options);
|
|
68
147
|
}
|
|
69
148
|
}
|
|
70
149
|
exports.WorkflowsModuleService = WorkflowsModuleService;
|
|
150
|
+
__decorate([
|
|
151
|
+
(0, utils_1.InjectManager)()
|
|
152
|
+
// @ts-expect-error
|
|
153
|
+
,
|
|
154
|
+
__param(2, (0, utils_1.EtoContext)()),
|
|
155
|
+
__metadata("design:type", Function),
|
|
156
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
|
157
|
+
__metadata("design:returntype", Promise)
|
|
158
|
+
], WorkflowsModuleService.prototype, "listWorkflowExecutions", null);
|
|
159
|
+
__decorate([
|
|
160
|
+
(0, utils_1.InjectManager)()
|
|
161
|
+
// @ts-expect-error
|
|
162
|
+
,
|
|
163
|
+
__param(2, (0, utils_1.EtoContext)()),
|
|
164
|
+
__metadata("design:type", Function),
|
|
165
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
|
166
|
+
__metadata("design:returntype", Promise)
|
|
167
|
+
], WorkflowsModuleService.prototype, "listAndCountWorkflowExecutions", null);
|
|
71
168
|
__decorate([
|
|
72
169
|
(0, utils_1.InjectSharedContext)(),
|
|
73
170
|
__param(2, (0, utils_1.EtoContext)()),
|
|
@@ -110,4 +207,11 @@ __decorate([
|
|
|
110
207
|
__metadata("design:paramtypes", [Object, Object]),
|
|
111
208
|
__metadata("design:returntype", Promise)
|
|
112
209
|
], WorkflowsModuleService.prototype, "unsubscribe", null);
|
|
210
|
+
__decorate([
|
|
211
|
+
(0, utils_1.InjectSharedContext)(),
|
|
212
|
+
__param(2, (0, utils_1.EtoContext)()),
|
|
213
|
+
__metadata("design:type", Function),
|
|
214
|
+
__metadata("design:paramtypes", [String, Object, Object]),
|
|
215
|
+
__metadata("design:returntype", Promise)
|
|
216
|
+
], WorkflowsModuleService.prototype, "cancel", null);
|
|
113
217
|
//# sourceMappingURL=workflows-module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows-module.js","sourceRoot":"","sources":["../../src/services/workflows-module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"workflows-module.js","sourceRoot":"","sources":["../../src/services/workflows-module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAU+B;AAC/B,kDAM+B;AAM/B,qCAA2C;AAc3C,MAAa,sBAIX,SAAQ,uBAAe,CAAC,UAAU,CAEjC,EAAE,iBAAiB,EAAjB,2BAAiB,EAAE,CAAC;IAOvB,YACE,EACE,OAAO,EACP,cAAc,EACd,wBAAwB,EACxB,2BAA2B,EAC3B,sBAAsB,GACD,EACJ,iBAA4C;QAE/D,aAAa;QACb,KAAK,CAAC,GAAG,SAAS,CAAC,CAAA;QAHA,sBAAiB,GAAjB,iBAAiB,CAA2B;QAYjE,YAAO,GAAG;YACR,kBAAkB,EAAE,KAAK,IAAI,EAAE;gBAC7B,MAAM,IAAI,CAAC,4BAA4B,CAAC,kBAAkB,EAAE,CAAA;YAC9D,CAAC;YACD,4BAA4B,EAAE,KAAK,IAAI,EAAE;gBACvC,MAAM,IAAI,CAAC,4BAA4B,CAAC,4BAA4B,EAAE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AAE;IAQnB,WAAA,IAAA,kBAAU,GAAE,CAAA;;yDANS,SAAS,oBAAT,SAAS;;iDAuDhC;AAGK;IADL,IAAA,2BAAmB,GAAE;IAInB,WAAA,IAAA,kBAAU,GAAE,CAAA;;;;mEAOd;AAGK;IADL,IAAA,2BAAmB,GAAE;IAWnB,WAAA,IAAA,kBAAU,GAAE,CAAA;;;;4DAad;AAGK;IADL,IAAA,2BAAmB,GAAE;IAWnB,WAAA,IAAA,kBAAU,GAAE,CAAA;;;;4DAad;AAGK;IADL,IAAA,2BAAmB,GAAE;IAQnB,WAAA,IAAA,kBAAU,GAAE,CAAA;;;;uDAGd;AAGK;IADL,IAAA,2BAAmB,GAAE;IAOnB,WAAA,IAAA,kBAAU,GAAE,CAAA;;;;yDAGd;AAGK;IADL,IAAA,2BAAmB,GAAE;IAInB,WAAA,IAAA,kBAAU,GAAE,CAAA;;;;oDAGd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/index.ts","../src/loaders/index.ts","../src/loaders/redis.ts","../src/loaders/utils.ts","../src/migrations/migration20231228143900.ts","../src/migrations/migration20241206123341.ts","../src/models/index.ts","../src/models/workflow-execution.ts","../src/schema/index.ts","../src/services/index.ts","../src/services/workflow-orchestrator.ts","../src/services/workflows-module.ts","../src/types/index.ts","../src/utils/index.ts","../src/utils/workflow-orchestrator-storage.ts"],"version":"5.8.3"}
|
|
1
|
+
{"root":["../src/index.ts","../src/loaders/index.ts","../src/loaders/redis.ts","../src/loaders/utils.ts","../src/migrations/migration20231228143900.ts","../src/migrations/migration20241206123341.ts","../src/migrations/migration20250120111059.ts","../src/migrations/migration20250128174354.ts","../src/migrations/migration20250505101505.ts","../src/models/index.ts","../src/models/workflow-execution.ts","../src/schema/index.ts","../src/services/index.ts","../src/services/workflow-orchestrator.ts","../src/services/workflows-module.ts","../src/types/index.ts","../src/utils/index.ts","../src/utils/workflow-orchestrator-storage.ts"],"version":"5.8.3"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,MAAM,MAAM,sCAAsC,GAAG;IACnD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,CAAA;IAEtB;;OAEG;IACH,MAAM,CAAC,EAAE;QACP,GAAG,EAAE,MAAM,CAAA;QACX,OAAO,CAAC,EAAE,YAAY,CAAA;KACvB,CAAA;CACF,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,MAAM,MAAM,sCAAsC,GAAG;IACnD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,CAAA;IAEtB;;OAEG;IACH,MAAM,CAAC,EAAE;QACP,GAAG,EAAE,MAAM,CAAA;QACX,OAAO,CAAC,EAAE,YAAY,CAAA;KACvB,CAAA;CACF,CAAA"}
|
|
@@ -2,21 +2,29 @@ import { DistributedTransactionType, IDistributedSchedulerStorage, IDistributedT
|
|
|
2
2
|
import { Logger, ModulesSdkTypes } from "@etohq/framework/types";
|
|
3
3
|
import Redis from "ioredis";
|
|
4
4
|
export declare class RedisDistributedTransactionStorage implements IDistributedTransactionStorage, IDistributedSchedulerStorage {
|
|
5
|
-
private
|
|
5
|
+
#private;
|
|
6
6
|
private workflowExecutionService_;
|
|
7
7
|
private logger_;
|
|
8
8
|
private workflowOrchestratorService_;
|
|
9
9
|
private redisClient;
|
|
10
10
|
private redisWorkerConnection;
|
|
11
11
|
private queueName;
|
|
12
|
+
private jobQueueName;
|
|
12
13
|
private queue;
|
|
14
|
+
private jobQueue?;
|
|
13
15
|
private worker;
|
|
14
|
-
|
|
16
|
+
private jobWorker?;
|
|
17
|
+
private cleanerQueueName;
|
|
18
|
+
private cleanerWorker_;
|
|
19
|
+
private cleanerQueue_?;
|
|
20
|
+
constructor({ workflowExecutionService, redisConnection, redisWorkerConnection, redisQueueName, redisJobQueueName, logger, isWorkerMode, }: {
|
|
15
21
|
workflowExecutionService: ModulesSdkTypes.IEtoInternalService<any>;
|
|
16
22
|
redisConnection: Redis;
|
|
17
23
|
redisWorkerConnection: Redis;
|
|
18
24
|
redisQueueName: string;
|
|
25
|
+
redisJobQueueName: string;
|
|
19
26
|
logger: Logger;
|
|
27
|
+
isWorkerMode: boolean;
|
|
20
28
|
});
|
|
21
29
|
onApplicationPrepareShutdown(): Promise<void>;
|
|
22
30
|
onApplicationShutdown(): Promise<void>;
|
|
@@ -26,8 +34,9 @@ export declare class RedisDistributedTransactionStorage implements IDistributedT
|
|
|
26
34
|
private deleteFromDb;
|
|
27
35
|
private executeTransaction;
|
|
28
36
|
private executeScheduledJob;
|
|
29
|
-
get(key: string, options?: TransactionOptions
|
|
30
|
-
|
|
37
|
+
get(key: string, options?: TransactionOptions & {
|
|
38
|
+
isCancelling?: boolean;
|
|
39
|
+
}): Promise<TransactionCheckpoint | undefined>;
|
|
31
40
|
save(key: string, data: TransactionCheckpoint, ttl?: number, options?: TransactionOptions): Promise<void>;
|
|
32
41
|
scheduleRetry(transaction: DistributedTransactionType, step: TransactionStep, timestamp: number, interval: number): Promise<void>;
|
|
33
42
|
clearRetry(transaction: DistributedTransactionType, step: TransactionStep): Promise<void>;
|
|
@@ -42,5 +51,7 @@ export declare class RedisDistributedTransactionStorage implements IDistributedT
|
|
|
42
51
|
}, schedulerOptions: SchedulerOptions): Promise<void>;
|
|
43
52
|
remove(jobId: string): Promise<void>;
|
|
44
53
|
removeAll(): Promise<void>;
|
|
54
|
+
private removeAllRepeatableJobs;
|
|
55
|
+
clearExpiredExecutions(): Promise<void>;
|
|
45
56
|
}
|
|
46
57
|
//# sourceMappingURL=workflow-orchestrator-storage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-orchestrator-storage.d.ts","sourceRoot":"","sources":["../../src/utils/workflow-orchestrator-storage.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"workflow-orchestrator-storage.d.ts","sourceRoot":"","sources":["../../src/utils/workflow-orchestrator-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,8BAA8B,EAC9B,gBAAgB,EAGhB,qBAAqB,EAGrB,kBAAkB,EAClB,eAAe,EAEhB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAWhE,OAAO,KAAK,MAAM,SAAS,CAAA;AAY3B,qBAAa,kCACX,YAAW,8BAA8B,EAAE,4BAA4B;;IAEvE,OAAO,CAAC,yBAAyB,CAA0C;IAC3E,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,4BAA4B,CAA6B;IAEjE,OAAO,CAAC,WAAW,CAAO;IAC1B,OAAO,CAAC,qBAAqB,CAAO;IACpC,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,YAAY,CA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