xypriss 1.1.3 → 1.1.4
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 +13 -13
- package/dist/cjs/mods/security/src/index.js +35 -12
- package/dist/cjs/mods/security/src/index.js.map +1 -1
- package/dist/cjs/src/plugins/modules/PluginEngine.js +378 -0
- package/dist/cjs/src/plugins/modules/PluginEngine.js.map +1 -0
- package/dist/cjs/src/plugins/modules/PluginRegistry.js +339 -0
- package/dist/cjs/src/plugins/modules/PluginRegistry.js.map +1 -0
- package/dist/cjs/src/plugins/modules/builtin/JWTAuthPlugin.js +591 -0
- package/dist/cjs/src/plugins/modules/builtin/JWTAuthPlugin.js.map +1 -0
- package/dist/cjs/src/plugins/modules/builtin/ResponseTimePlugin.js +413 -0
- package/dist/cjs/src/plugins/modules/builtin/ResponseTimePlugin.js.map +1 -0
- package/dist/cjs/src/plugins/modules/builtin/SmartCachePlugin.js +843 -0
- package/dist/cjs/src/plugins/modules/builtin/SmartCachePlugin.js.map +1 -0
- package/dist/cjs/src/plugins/modules/core/CachePlugin.js +1975 -0
- package/dist/cjs/src/plugins/modules/core/CachePlugin.js.map +1 -0
- package/dist/cjs/src/plugins/modules/core/PerformancePlugin.js +894 -0
- package/dist/cjs/src/plugins/modules/core/PerformancePlugin.js.map +1 -0
- package/dist/cjs/src/plugins/modules/core/SecurityPlugin.js +799 -0
- package/dist/cjs/src/plugins/modules/core/SecurityPlugin.js.map +1 -0
- package/dist/cjs/src/plugins/modules/types/PluginTypes.js +47 -0
- package/dist/cjs/src/plugins/modules/types/PluginTypes.js.map +1 -0
- package/dist/cjs/src/server/FastServer.js +22 -3
- package/dist/cjs/src/server/FastServer.js.map +1 -1
- package/dist/cjs/src/server/components/fastapi/PluginManager.js +5 -5
- package/dist/cjs/src/server/components/fastapi/PluginManager.js.map +1 -1
- package/dist/cjs/src/server/components/fastapi/RequestProcessor.js +1 -1
- package/dist/esm/mods/security/src/index.js +14 -10
- package/dist/esm/mods/security/src/index.js.map +1 -1
- package/dist/esm/src/plugins/modules/PluginEngine.js +376 -0
- package/dist/esm/src/plugins/modules/PluginEngine.js.map +1 -0
- package/dist/esm/src/plugins/modules/PluginRegistry.js +337 -0
- package/dist/esm/src/plugins/modules/PluginRegistry.js.map +1 -0
- package/dist/esm/src/plugins/modules/builtin/JWTAuthPlugin.js +589 -0
- package/dist/esm/src/plugins/modules/builtin/JWTAuthPlugin.js.map +1 -0
- package/dist/esm/src/plugins/modules/builtin/ResponseTimePlugin.js +411 -0
- package/dist/esm/src/plugins/modules/builtin/ResponseTimePlugin.js.map +1 -0
- package/dist/esm/src/plugins/modules/builtin/SmartCachePlugin.js +841 -0
- package/dist/esm/src/plugins/modules/builtin/SmartCachePlugin.js.map +1 -0
- package/dist/esm/src/plugins/modules/core/CachePlugin.js +1973 -0
- package/dist/esm/src/plugins/modules/core/CachePlugin.js.map +1 -0
- package/dist/esm/src/plugins/modules/core/PerformancePlugin.js +872 -0
- package/dist/esm/src/plugins/modules/core/PerformancePlugin.js.map +1 -0
- package/dist/esm/src/plugins/modules/core/SecurityPlugin.js +797 -0
- package/dist/esm/src/plugins/modules/core/SecurityPlugin.js.map +1 -0
- package/dist/esm/src/plugins/modules/types/PluginTypes.js +47 -0
- package/dist/esm/src/plugins/modules/types/PluginTypes.js.map +1 -0
- package/dist/esm/src/server/FastServer.js +22 -3
- package/dist/esm/src/server/FastServer.js.map +1 -1
- package/dist/esm/src/server/components/fastapi/PluginManager.js +5 -5
- package/dist/esm/src/server/components/fastapi/PluginManager.js.map +1 -1
- package/dist/esm/src/server/components/fastapi/RequestProcessor.js +1 -1
- package/dist/index.d.ts +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import { NehoID } from 'nehoid';
|
|
3
|
+
import { PluginEventType, PluginType } from './types/PluginTypes.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Ultra-Fast Plugin Execution Engine
|
|
7
|
+
*
|
|
8
|
+
* High-performance plugin execution engine designed to achieve <1ms overhead
|
|
9
|
+
* while maintaining security and comprehensive error handling.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Ultra-fast plugin execution engine with intelligent optimization
|
|
13
|
+
*/
|
|
14
|
+
class PluginEngine extends EventEmitter {
|
|
15
|
+
constructor(registry, cache, cluster) {
|
|
16
|
+
super();
|
|
17
|
+
this.executionPool = new Map();
|
|
18
|
+
this.warmupCache = new Map();
|
|
19
|
+
// Performance optimization: Object pooling for contexts
|
|
20
|
+
this.contextPool = [];
|
|
21
|
+
this.MAX_POOL_SIZE = 100;
|
|
22
|
+
// Circuit breaker for failing plugins
|
|
23
|
+
this.circuitBreakers = new Map();
|
|
24
|
+
this.registry = registry;
|
|
25
|
+
this.cache = cache;
|
|
26
|
+
this.cluster = cluster;
|
|
27
|
+
// Listen to registry events
|
|
28
|
+
this.setupRegistryEventHandlers();
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Execute plugins for a specific type with ultra-fast performance
|
|
32
|
+
*/
|
|
33
|
+
async executePlugins(type, req, res, next) {
|
|
34
|
+
const startTime = performance.now();
|
|
35
|
+
const executionId = NehoID.generate({ prefix: "plug.exec", size: 8 });
|
|
36
|
+
try {
|
|
37
|
+
// Get plugins for this type (pre-sorted by priority)
|
|
38
|
+
const plugins = this.registry.getPluginsByType(type);
|
|
39
|
+
if (plugins.length === 0) {
|
|
40
|
+
return true; // Continue execution if no plugins
|
|
41
|
+
}
|
|
42
|
+
// Create or reuse execution context
|
|
43
|
+
const context = this.createExecutionContext(req, res, next, executionId, startTime);
|
|
44
|
+
// Execute plugins based on type strategy
|
|
45
|
+
const success = await this.executePluginChain(plugins, context);
|
|
46
|
+
// Update performance metrics
|
|
47
|
+
const totalExecutionTime = performance.now() - startTime;
|
|
48
|
+
this.updatePerformanceMetrics(type, totalExecutionTime, success);
|
|
49
|
+
// Return context to pool
|
|
50
|
+
this.returnContextToPool(context);
|
|
51
|
+
return success;
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
const executionTime = performance.now() - startTime;
|
|
55
|
+
this.handleExecutionError(type, executionId, error, executionTime);
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Execute a single plugin with comprehensive error handling
|
|
61
|
+
*/
|
|
62
|
+
async executePlugin(plugin, context) {
|
|
63
|
+
const startTime = performance.now();
|
|
64
|
+
try {
|
|
65
|
+
// Check circuit breaker
|
|
66
|
+
if (this.isCircuitBreakerOpen(plugin.id)) {
|
|
67
|
+
return {
|
|
68
|
+
success: false,
|
|
69
|
+
executionTime: 0,
|
|
70
|
+
error: new Error(`Circuit breaker open for plugin ${plugin.id}`),
|
|
71
|
+
shouldContinue: true,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
// Warm up plugin if needed
|
|
75
|
+
await this.warmupPlugin(plugin, context);
|
|
76
|
+
// Execute plugin with timeout
|
|
77
|
+
const result = await this.executeWithTimeout(plugin, context);
|
|
78
|
+
const executionTime = performance.now() - startTime;
|
|
79
|
+
result.executionTime = executionTime;
|
|
80
|
+
// Update plugin statistics
|
|
81
|
+
this.registry.updateStats(plugin.id, executionTime, result.success);
|
|
82
|
+
// Reset circuit breaker on success
|
|
83
|
+
if (result.success) {
|
|
84
|
+
this.resetCircuitBreaker(plugin.id);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
this.updateCircuitBreaker(plugin.id);
|
|
88
|
+
}
|
|
89
|
+
// Emit execution event
|
|
90
|
+
this.emitPluginEvent(PluginEventType.PLUGIN_EXECUTED, plugin.id, {
|
|
91
|
+
executionTime,
|
|
92
|
+
success: result.success,
|
|
93
|
+
type: plugin.type,
|
|
94
|
+
});
|
|
95
|
+
return result;
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
const executionTime = performance.now() - startTime;
|
|
99
|
+
// Update circuit breaker
|
|
100
|
+
this.updateCircuitBreaker(plugin.id);
|
|
101
|
+
// Update error statistics
|
|
102
|
+
this.registry.updateStats(plugin.id, executionTime, false);
|
|
103
|
+
// Emit error event
|
|
104
|
+
this.emitPluginEvent(PluginEventType.PLUGIN_ERROR, plugin.id, {
|
|
105
|
+
error: error.message,
|
|
106
|
+
executionTime,
|
|
107
|
+
type: plugin.type,
|
|
108
|
+
});
|
|
109
|
+
return {
|
|
110
|
+
success: false,
|
|
111
|
+
executionTime,
|
|
112
|
+
error,
|
|
113
|
+
shouldContinue: true,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Execute plugin chain with intelligent optimization
|
|
119
|
+
*/
|
|
120
|
+
async executePluginChain(plugins, context) {
|
|
121
|
+
// For critical performance plugins, execute in parallel
|
|
122
|
+
if (plugins.length > 0 && plugins[0].type === PluginType.PERFORMANCE) {
|
|
123
|
+
return await this.executePluginsParallel(plugins, context);
|
|
124
|
+
}
|
|
125
|
+
// For security and cache plugins, execute sequentially
|
|
126
|
+
return await this.executePluginsSequential(plugins, context);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Execute plugins sequentially (for security, cache operations)
|
|
130
|
+
*/
|
|
131
|
+
async executePluginsSequential(plugins, context) {
|
|
132
|
+
for (const plugin of plugins) {
|
|
133
|
+
const result = await this.executePlugin(plugin, context);
|
|
134
|
+
if (!result.success && plugin.type === PluginType.SECURITY) {
|
|
135
|
+
// Security plugins must succeed
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
if (!result.shouldContinue) {
|
|
139
|
+
// Plugin requested to stop execution
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
// Store plugin result data
|
|
143
|
+
if (result.data) {
|
|
144
|
+
context.pluginData.set(plugin.id, result.data);
|
|
145
|
+
}
|
|
146
|
+
// Handle cache data
|
|
147
|
+
if (result.cacheData) {
|
|
148
|
+
await this.cache.set(result.cacheData.key, result.cacheData.value, { ttl: result.cacheData.ttl });
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Execute plugins in parallel (for performance monitoring)
|
|
155
|
+
*/
|
|
156
|
+
async executePluginsParallel(plugins, context) {
|
|
157
|
+
const promises = plugins.map((plugin) => this.executePlugin(plugin, context));
|
|
158
|
+
const results = await Promise.allSettled(promises);
|
|
159
|
+
let allSuccessful = true;
|
|
160
|
+
results.forEach((result, index) => {
|
|
161
|
+
if (result.status === "fulfilled") {
|
|
162
|
+
const pluginResult = result.value;
|
|
163
|
+
if (!pluginResult.success) {
|
|
164
|
+
allSuccessful = false;
|
|
165
|
+
}
|
|
166
|
+
// Store plugin result data
|
|
167
|
+
if (pluginResult.data) {
|
|
168
|
+
context.pluginData.set(plugins[index].id, pluginResult.data);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
allSuccessful = false;
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
return allSuccessful;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Execute plugin with timeout protection
|
|
179
|
+
*/
|
|
180
|
+
async executeWithTimeout(plugin, context) {
|
|
181
|
+
const timeoutMs = plugin.maxExecutionTime;
|
|
182
|
+
return new Promise((resolve, reject) => {
|
|
183
|
+
const timeout = setTimeout(() => {
|
|
184
|
+
this.emitPluginEvent(PluginEventType.PLUGIN_TIMEOUT, plugin.id, {
|
|
185
|
+
timeout: timeoutMs,
|
|
186
|
+
type: plugin.type,
|
|
187
|
+
});
|
|
188
|
+
reject(new Error(`Plugin ${plugin.id} timed out after ${timeoutMs}ms`));
|
|
189
|
+
}, timeoutMs);
|
|
190
|
+
// Execute plugin
|
|
191
|
+
const execution = plugin.isAsync
|
|
192
|
+
? plugin.execute(context)
|
|
193
|
+
: Promise.resolve(plugin.execute(context));
|
|
194
|
+
execution
|
|
195
|
+
.then((result) => {
|
|
196
|
+
clearTimeout(timeout);
|
|
197
|
+
resolve(result);
|
|
198
|
+
})
|
|
199
|
+
.catch((error) => {
|
|
200
|
+
clearTimeout(timeout);
|
|
201
|
+
reject(error);
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Create optimized execution context with object pooling
|
|
207
|
+
*/
|
|
208
|
+
createExecutionContext(req, res, next, executionId, startTime) {
|
|
209
|
+
// Try to reuse context from pool
|
|
210
|
+
let context = this.contextPool.pop();
|
|
211
|
+
if (!context) {
|
|
212
|
+
context = {
|
|
213
|
+
req,
|
|
214
|
+
res,
|
|
215
|
+
next,
|
|
216
|
+
startTime,
|
|
217
|
+
executionId,
|
|
218
|
+
cache: this.cache,
|
|
219
|
+
cluster: this.cluster,
|
|
220
|
+
pluginData: new Map(),
|
|
221
|
+
security: {
|
|
222
|
+
isAuthenticated: false,
|
|
223
|
+
roles: [],
|
|
224
|
+
permissions: [],
|
|
225
|
+
},
|
|
226
|
+
metrics: {
|
|
227
|
+
requestStartTime: startTime,
|
|
228
|
+
pluginExecutionTimes: new Map(),
|
|
229
|
+
cacheHits: 0,
|
|
230
|
+
cacheMisses: 0,
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
// Reset reused context
|
|
236
|
+
context.req = req;
|
|
237
|
+
context.res = res;
|
|
238
|
+
context.next = next;
|
|
239
|
+
context.startTime = startTime;
|
|
240
|
+
context.executionId = executionId;
|
|
241
|
+
context.pluginData.clear();
|
|
242
|
+
context.metrics.pluginExecutionTimes.clear();
|
|
243
|
+
context.metrics.requestStartTime = startTime;
|
|
244
|
+
context.metrics.cacheHits = 0;
|
|
245
|
+
context.metrics.cacheMisses = 0;
|
|
246
|
+
}
|
|
247
|
+
return context;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Return context to pool for reuse
|
|
251
|
+
*/
|
|
252
|
+
returnContextToPool(context) {
|
|
253
|
+
if (this.contextPool.length < this.MAX_POOL_SIZE) {
|
|
254
|
+
// Clear sensitive data before returning to pool
|
|
255
|
+
context.pluginData.clear();
|
|
256
|
+
context.metrics.pluginExecutionTimes.clear();
|
|
257
|
+
this.contextPool.push(context);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Warm up plugin for optimal performance
|
|
262
|
+
*/
|
|
263
|
+
async warmupPlugin(plugin, context) {
|
|
264
|
+
if (this.warmupCache.has(plugin.id)) {
|
|
265
|
+
return; // Already warmed up
|
|
266
|
+
}
|
|
267
|
+
if (plugin.warmup) {
|
|
268
|
+
try {
|
|
269
|
+
await plugin.warmup(context);
|
|
270
|
+
this.warmupCache.set(plugin.id, true);
|
|
271
|
+
}
|
|
272
|
+
catch (error) {
|
|
273
|
+
// Warmup failure is not critical
|
|
274
|
+
console.warn(`Plugin ${plugin.id} warmup failed:`, error);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Circuit breaker management
|
|
280
|
+
*/
|
|
281
|
+
isCircuitBreakerOpen(pluginId) {
|
|
282
|
+
const breaker = this.circuitBreakers.get(pluginId);
|
|
283
|
+
if (!breaker)
|
|
284
|
+
return false;
|
|
285
|
+
// Reset circuit breaker after 60 seconds
|
|
286
|
+
if (breaker.isOpen && Date.now() - breaker.lastFailure > 60000) {
|
|
287
|
+
breaker.isOpen = false;
|
|
288
|
+
breaker.failures = 0;
|
|
289
|
+
}
|
|
290
|
+
return breaker.isOpen;
|
|
291
|
+
}
|
|
292
|
+
updateCircuitBreaker(pluginId) {
|
|
293
|
+
const breaker = this.circuitBreakers.get(pluginId) || {
|
|
294
|
+
failures: 0,
|
|
295
|
+
lastFailure: 0,
|
|
296
|
+
isOpen: false,
|
|
297
|
+
};
|
|
298
|
+
breaker.failures++;
|
|
299
|
+
breaker.lastFailure = Date.now();
|
|
300
|
+
// Open circuit breaker after 5 failures
|
|
301
|
+
if (breaker.failures >= 5) {
|
|
302
|
+
breaker.isOpen = true;
|
|
303
|
+
}
|
|
304
|
+
this.circuitBreakers.set(pluginId, breaker);
|
|
305
|
+
}
|
|
306
|
+
resetCircuitBreaker(pluginId) {
|
|
307
|
+
this.circuitBreakers.delete(pluginId);
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Setup registry event handlers
|
|
311
|
+
*/
|
|
312
|
+
setupRegistryEventHandlers() {
|
|
313
|
+
this.registry.on(PluginEventType.PLUGIN_UNREGISTERED, (event) => {
|
|
314
|
+
// Clean up plugin-specific data
|
|
315
|
+
this.circuitBreakers.delete(event.pluginId);
|
|
316
|
+
this.warmupCache.delete(event.pluginId);
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Update performance metrics
|
|
321
|
+
*/
|
|
322
|
+
updatePerformanceMetrics(type, executionTime, success) {
|
|
323
|
+
// Emit performance metrics for monitoring
|
|
324
|
+
this.emit("performance", {
|
|
325
|
+
type,
|
|
326
|
+
executionTime,
|
|
327
|
+
success,
|
|
328
|
+
timestamp: Date.now(),
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Handle execution errors
|
|
333
|
+
*/
|
|
334
|
+
handleExecutionError(type, executionId, error, executionTime) {
|
|
335
|
+
console.error(`Plugin execution error [${type}] [${executionId}]:`, error);
|
|
336
|
+
this.emit("error", {
|
|
337
|
+
type,
|
|
338
|
+
executionId,
|
|
339
|
+
error,
|
|
340
|
+
executionTime,
|
|
341
|
+
timestamp: Date.now(),
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Emit plugin event
|
|
346
|
+
*/
|
|
347
|
+
emitPluginEvent(type, pluginId, data) {
|
|
348
|
+
const event = {
|
|
349
|
+
type,
|
|
350
|
+
pluginId,
|
|
351
|
+
timestamp: new Date(),
|
|
352
|
+
data,
|
|
353
|
+
};
|
|
354
|
+
this.emit(type, event);
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Get engine statistics (ultra-fast optimized)
|
|
358
|
+
*/
|
|
359
|
+
getEngineStats() {
|
|
360
|
+
// Ultra-fast: Count open circuit breakers without creating arrays
|
|
361
|
+
let circuitBreakersOpen = 0;
|
|
362
|
+
this.circuitBreakers.forEach((breaker) => {
|
|
363
|
+
if (breaker.isOpen)
|
|
364
|
+
circuitBreakersOpen++;
|
|
365
|
+
});
|
|
366
|
+
return {
|
|
367
|
+
contextPoolSize: this.contextPool.length,
|
|
368
|
+
circuitBreakersOpen,
|
|
369
|
+
warmedUpPlugins: this.warmupCache.size,
|
|
370
|
+
activeExecutions: this.executionPool.size,
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export { PluginEngine };
|
|
376
|
+
//# sourceMappingURL=PluginEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginEngine.js","sources":["../../../../../src/plugins/modules/PluginEngine.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAA;;;;;AAKG;AAkBH;;AAEG;AACG,MAAO,YAAa,SAAQ,YAAY,CAAA;AAsB1C,IAAA,WAAA,CACI,QAAwB,EACxB,KAAyB,EACzB,OAAwB,EAAA;AAExB,QAAA,KAAK,EAAE,CAAC;AAvBJ,QAAA,IAAA,CAAA,aAAa,GACjB,IAAI,GAAG,EAAE,CAAC;AACN,QAAA,IAAA,CAAA,WAAW,GAAyB,IAAI,GAAG,EAAE,CAAC;;QAG9C,IAAW,CAAA,WAAA,GAA6B,EAAE,CAAC;QAClC,IAAa,CAAA,aAAA,GAAG,GAAG,CAAC;;AAG7B,QAAA,IAAA,CAAA,eAAe,GAOnB,IAAI,GAAG,EAAE,CAAC;AAQV,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACnB,QAAA,IAAI,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