@zajno/common 2.8.7 → 2.8.8
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/cjs/structures/promiseCache/cache.js +286 -0
- package/cjs/structures/promiseCache/cache.js.map +1 -0
- package/cjs/structures/promiseCache/core.js +301 -0
- package/cjs/structures/promiseCache/core.js.map +1 -0
- package/cjs/structures/promiseCache/index.js +7 -0
- package/cjs/structures/promiseCache/index.js.map +1 -0
- package/cjs/structures/promiseCache/types.js +15 -0
- package/cjs/structures/promiseCache/types.js.map +1 -0
- package/esm/structures/promiseCache/cache.js +282 -0
- package/esm/structures/promiseCache/cache.js.map +1 -0
- package/esm/structures/promiseCache/core.js +297 -0
- package/esm/structures/promiseCache/core.js.map +1 -0
- package/esm/structures/promiseCache/index.js +4 -0
- package/esm/structures/promiseCache/index.js.map +1 -0
- package/esm/structures/promiseCache/types.js +12 -0
- package/esm/structures/promiseCache/types.js.map +1 -0
- package/package.json +7 -1
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/tsconfig.esm.tsbuildinfo +1 -1
- package/tsconfig.types.tsbuildinfo +1 -1
- package/types/structures/promiseCache/cache.d.ts +95 -0
- package/types/structures/promiseCache/core.d.ts +157 -0
- package/types/structures/promiseCache/index.d.ts +3 -0
- package/types/structures/promiseCache/types.d.ts +55 -0
- package/cjs/structures/promiseCache.js +0 -399
- package/cjs/structures/promiseCache.js.map +0 -1
- package/esm/structures/promiseCache.js +0 -395
- package/esm/structures/promiseCache.js.map +0 -1
- package/types/structures/promiseCache.d.ts +0 -206
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PromiseCache = exports.DeferredGetter = void 0;
|
|
4
|
-
const debounce_js_1 = require("../functions/debounce.js");
|
|
5
|
-
const loggable_js_1 = require("../logger/loggable.js");
|
|
6
|
-
const Model_js_1 = require("../models/Model.js");
|
|
7
|
-
var DeferredGetter;
|
|
8
|
-
(function (DeferredGetter) {
|
|
9
|
-
const _resolvedPromise = Promise.resolve(null);
|
|
10
|
-
/** Empty resolved value. */
|
|
11
|
-
DeferredGetter.Empty = {
|
|
12
|
-
get current() { return null; },
|
|
13
|
-
get promise() { return _resolvedPromise; },
|
|
14
|
-
get isLoading() { return false; },
|
|
15
|
-
};
|
|
16
|
-
})(DeferredGetter || (exports.DeferredGetter = DeferredGetter = {}));
|
|
17
|
-
const BATCHING_DELAY = 200;
|
|
18
|
-
/**
|
|
19
|
-
* Caches items by a key (string or another type) which are resolved by an async fetcher (`Promise`).
|
|
20
|
-
*
|
|
21
|
-
* Supports:
|
|
22
|
-
* - custom key adapter and parser for non-string keys.
|
|
23
|
-
* - direct manual cache manipulation.
|
|
24
|
-
* - batching of fetches.
|
|
25
|
-
* - auto-invalidation of cached items.
|
|
26
|
-
*/
|
|
27
|
-
class PromiseCache extends loggable_js_1.Loggable {
|
|
28
|
-
fetcher;
|
|
29
|
-
keyAdapter;
|
|
30
|
-
keyParser;
|
|
31
|
-
/** Stores resolved items in map by id. */
|
|
32
|
-
_itemsCache;
|
|
33
|
-
/** Stores items loading state (loading or not) in map by id. */
|
|
34
|
-
_itemsStatus;
|
|
35
|
-
/** Stores items loading count. */
|
|
36
|
-
_loadingCount;
|
|
37
|
-
/** Stores items Promises state (if still loading) in map by id. */
|
|
38
|
-
_fetchCache;
|
|
39
|
-
/** Stores items resolve timestamps (for expiration) in map by id. */
|
|
40
|
-
_timestamps = new Map();
|
|
41
|
-
_batch = null;
|
|
42
|
-
_invalidationTimeMs = null;
|
|
43
|
-
_keepInstanceDuringInvalidation = false;
|
|
44
|
-
_version = 0;
|
|
45
|
-
/**
|
|
46
|
-
* Creates an instance of PromiseCache.
|
|
47
|
-
* @param fetcher Function to fetch data by key.
|
|
48
|
-
* @param keyAdapter Optional function to adapt non-string keys to strings.
|
|
49
|
-
* @param keyParser Optional function to parse string keys back to their original type.
|
|
50
|
-
*/
|
|
51
|
-
constructor(fetcher, keyAdapter, keyParser) {
|
|
52
|
-
super();
|
|
53
|
-
this.fetcher = fetcher;
|
|
54
|
-
this.keyAdapter = keyAdapter;
|
|
55
|
-
this.keyParser = keyParser;
|
|
56
|
-
this._loadingCount = this.pure_createBusyCount();
|
|
57
|
-
this._itemsCache = this.pure_createItemsCache();
|
|
58
|
-
this._itemsStatus = this.pure_createItemsStatus();
|
|
59
|
-
this._fetchCache = this.pure_createFetchCache();
|
|
60
|
-
}
|
|
61
|
-
get busyCount() { return this._loadingCount.value; }
|
|
62
|
-
/**
|
|
63
|
-
* @pure @const
|
|
64
|
-
* Creates a model for tracking the loading state. Override to inject own instance, e.g. for observability.
|
|
65
|
-
*
|
|
66
|
-
* Warning: as name indicates, this should be "pure"/"const" function, i.e. should not reference `this`/`super`.
|
|
67
|
-
*
|
|
68
|
-
* @returns A value model for the loading count.
|
|
69
|
-
*/
|
|
70
|
-
pure_createBusyCount() {
|
|
71
|
-
return new Model_js_1.Model(0);
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* @pure @const
|
|
75
|
-
* Creates a map for caching resolved items by id. Override to inject own instance, e.g. for observability.
|
|
76
|
-
*
|
|
77
|
-
* Warning: as name indicates, this should be "pure"/"const" function, i.e. should not reference `this`/`super`.
|
|
78
|
-
*
|
|
79
|
-
* @returns A map model for the items cache.
|
|
80
|
-
*/
|
|
81
|
-
pure_createItemsCache() {
|
|
82
|
-
return new Map();
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* @pure @const
|
|
86
|
-
* Creates a map for tracking the loading state of items by id. Override to inject own instance, e.g. for observability.
|
|
87
|
-
*
|
|
88
|
-
* Warning: as name indicates, this should be "pure"/"const" function, i.e. should not reference `this`/`super`.
|
|
89
|
-
*
|
|
90
|
-
* @returns A map model for the items loading state.
|
|
91
|
-
*/
|
|
92
|
-
pure_createItemsStatus() {
|
|
93
|
-
return new Map();
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* @pure @const
|
|
97
|
-
* Creates a map for caching promises of items by id. Override to inject own instance, e.g. for observability.
|
|
98
|
-
*
|
|
99
|
-
* Warning: as name indicates, this should be "pure"/"const" function, i.e. should not reference `this`/`super`.
|
|
100
|
-
*
|
|
101
|
-
* @returns A map model for the items promises cache.
|
|
102
|
-
*/
|
|
103
|
-
pure_createFetchCache() {
|
|
104
|
-
return new Map();
|
|
105
|
-
}
|
|
106
|
-
_pk(k) {
|
|
107
|
-
if (k == null) {
|
|
108
|
-
throw new Error('PromiseCache: null keys are not supported');
|
|
109
|
-
}
|
|
110
|
-
if (typeof k === 'string') {
|
|
111
|
-
return k;
|
|
112
|
-
}
|
|
113
|
-
if (!this.keyAdapter) {
|
|
114
|
-
throw new Error('Provide key adapter for non-string keys');
|
|
115
|
-
}
|
|
116
|
-
return this.keyAdapter(k);
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Creates a logger name for this instance.
|
|
120
|
-
* @param name The name of the cache instance.
|
|
121
|
-
* @returns The logger name.
|
|
122
|
-
*/
|
|
123
|
-
getLoggerName(name) {
|
|
124
|
-
return `[PromiseCache:${name || '?'}]`;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Provide a fetcher function that takes multiple ids and returns multiple results at once. Will be called with a slight delay to allow multiple ids to be collected.
|
|
128
|
-
*
|
|
129
|
-
* Warning: resolved array should have the same order as the input array.
|
|
130
|
-
*
|
|
131
|
-
* When provided, effectively replaces the main fetcher; but in case of fail, fallbacks to the main fetcher.
|
|
132
|
-
*/
|
|
133
|
-
useBatching(fetcher, delay = BATCHING_DELAY) {
|
|
134
|
-
this._batch = fetcher ? new debounce_js_1.DebounceProcessor(fetcher, delay) : null;
|
|
135
|
-
return this;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Enables auto-invalidation of cached items.
|
|
139
|
-
*
|
|
140
|
-
* @param ms Time in milliseconds after which the item will be considered invalid. If null, auto-invalidation is disabled.
|
|
141
|
-
* @param keepInstance If true, the cached item will not be removed during invalidation, but will be set to `undefined` instead. Defaults to false.
|
|
142
|
-
*/
|
|
143
|
-
useInvalidationTime(ms, keepInstance = false) {
|
|
144
|
-
this._invalidationTimeMs = ms;
|
|
145
|
-
this._keepInstanceDuringInvalidation = keepInstance;
|
|
146
|
-
return this;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Returns a {@link DeferredGetter} object for a specfied key.
|
|
150
|
-
*
|
|
151
|
-
* This can be used to access the current value, promise, and loading state of the item.
|
|
152
|
-
*
|
|
153
|
-
* @param key The key of the item.
|
|
154
|
-
*/
|
|
155
|
-
getDeferred(key) {
|
|
156
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
157
|
-
const self = this;
|
|
158
|
-
return {
|
|
159
|
-
get current() { return self.getCurrent(key); },
|
|
160
|
-
get promise() { return self.get(key); },
|
|
161
|
-
get isLoading() { return self.getIsBusy(key); },
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Returns the loading state of an item.
|
|
166
|
-
*
|
|
167
|
-
* @param id The id of the item.
|
|
168
|
-
* @returns The loading state of the item: true if loading, false if loading completed, undefined if loading was not started yet for the specified key.
|
|
169
|
-
*/
|
|
170
|
-
getIsBusy(id) {
|
|
171
|
-
const key = this._pk(id);
|
|
172
|
-
const res = this._itemsStatus.get(key);
|
|
173
|
-
if (res) {
|
|
174
|
-
return res;
|
|
175
|
-
}
|
|
176
|
-
const isInvalid = this.getIsInvalidated(key);
|
|
177
|
-
return isInvalid ? undefined : res;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Returns the current cached value for the specified key, without triggering a fetch.
|
|
181
|
-
* @param id The id of the item.
|
|
182
|
-
* @returns The current cached value of the item.
|
|
183
|
-
*/
|
|
184
|
-
_getCurrent(id) {
|
|
185
|
-
const key = this._pk(id);
|
|
186
|
-
const isInvalid = this.getIsInvalidated(key);
|
|
187
|
-
// make sure current item is hooked here from the cache (required by observers)
|
|
188
|
-
const item = this._itemsCache.get(key);
|
|
189
|
-
if (isInvalid) {
|
|
190
|
-
this.logger.log(key, 'item is invalidated');
|
|
191
|
-
}
|
|
192
|
-
return {
|
|
193
|
-
item: (isInvalid && !this._keepInstanceDuringInvalidation) ? undefined : item,
|
|
194
|
-
key,
|
|
195
|
-
isInvalid,
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Returns the current cached value for the specified key, optionally triggering a fetch.
|
|
200
|
-
* @param id The id of the item.
|
|
201
|
-
* @param initiateFetch If true, will initiate a fetch if the item is not cached.
|
|
202
|
-
* @returns The current cached value of the item.
|
|
203
|
-
*/
|
|
204
|
-
getCurrent(id, initiateFetch = true) {
|
|
205
|
-
const { item, key } = this._getCurrent(id);
|
|
206
|
-
if (initiateFetch) {
|
|
207
|
-
// spin fetch
|
|
208
|
-
this.get(id);
|
|
209
|
-
}
|
|
210
|
-
this.logger.log(key, 'getCurrent: returns', item);
|
|
211
|
-
return item;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Returns a promise that resolves to the cached value of the item if loaded already, otherwise starts fetching and the promise will be resolved to the final value.
|
|
215
|
-
*
|
|
216
|
-
* Consequent calls will return the same promise until it resolves.
|
|
217
|
-
*
|
|
218
|
-
* @param id The id of the item.
|
|
219
|
-
* @returns A promise that resolves to the result, whether it's cached or freshly fetched.
|
|
220
|
-
*/
|
|
221
|
-
get(id) {
|
|
222
|
-
const { item, key, isInvalid } = this._getCurrent(id);
|
|
223
|
-
// return cached item if it's not invalidated
|
|
224
|
-
if (item !== undefined && !isInvalid) {
|
|
225
|
-
this.logger.log(key, 'get: item resolved to', item, isInvalid ? '(invalidated)' : '');
|
|
226
|
-
return Promise.resolve(item);
|
|
227
|
-
}
|
|
228
|
-
let promise = this._fetchCache.get(key);
|
|
229
|
-
if (promise != null) {
|
|
230
|
-
this.logger.log(key, 'get: item resolved to <promise>');
|
|
231
|
-
return promise;
|
|
232
|
-
}
|
|
233
|
-
this.setStatus(key, true);
|
|
234
|
-
promise = this._doFetchAsync(id, key);
|
|
235
|
-
this.setPromise(key, promise);
|
|
236
|
-
return promise;
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Fetches the item asynchronously.
|
|
240
|
-
* @param id The id of the item.
|
|
241
|
-
* @param key The cache key.
|
|
242
|
-
* @returns A promise that resolves to the fetched item.
|
|
243
|
-
*/
|
|
244
|
-
_doFetchAsync = async (id, key) => {
|
|
245
|
-
let isInSameVersion = true;
|
|
246
|
-
try {
|
|
247
|
-
this.onBeforeFetch(key);
|
|
248
|
-
const v = this._version;
|
|
249
|
-
let res = await this.tryFetchInBatch(id);
|
|
250
|
-
if (v !== this._version) {
|
|
251
|
-
isInSameVersion = false;
|
|
252
|
-
// resolve with actual result but don't store it
|
|
253
|
-
return res;
|
|
254
|
-
}
|
|
255
|
-
if (this._fetchCache.get(key) != null) {
|
|
256
|
-
this.logger.log(key, 'item\'s <promise> resolved to', res);
|
|
257
|
-
res = this.prepareResult(res);
|
|
258
|
-
this.storeResult(key, res);
|
|
259
|
-
}
|
|
260
|
-
return res;
|
|
261
|
-
}
|
|
262
|
-
finally {
|
|
263
|
-
if (isInSameVersion) {
|
|
264
|
-
this.onFetchComplete(key);
|
|
265
|
-
}
|
|
266
|
-
else {
|
|
267
|
-
this.logger.log(key, 'skipping item\'s resolve due to version change ("clear()" has been called)');
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
};
|
|
271
|
-
/**
|
|
272
|
-
* Instantly invalidates the cached item for the specified id, like it was never fetched/accessed.
|
|
273
|
-
* @param id The id of the item.
|
|
274
|
-
*/
|
|
275
|
-
invalidate(id) {
|
|
276
|
-
const key = this._pk(id);
|
|
277
|
-
this._set(key, undefined, undefined, undefined);
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Updates the cached value for the specified id directly, like it was fetched already. Overrides existing value, if any.
|
|
281
|
-
* @param id The id of the item.
|
|
282
|
-
* @param value The new value to cache.
|
|
283
|
-
*/
|
|
284
|
-
updateValueDirectly(id, value) {
|
|
285
|
-
const key = this._pk(id);
|
|
286
|
-
this._set(key, value, undefined, undefined);
|
|
287
|
-
}
|
|
288
|
-
/** Returns true if the item is cached or fetching was initiated. Does not initiates fetching. */
|
|
289
|
-
hasKey(id) {
|
|
290
|
-
const key = this._pk(id);
|
|
291
|
-
return this._itemsCache.get(key) !== undefined || this._itemsStatus.get(key) !== undefined;
|
|
292
|
-
}
|
|
293
|
-
keys(iterate = false) {
|
|
294
|
-
const iterator = this._itemsCache.keys();
|
|
295
|
-
return iterate
|
|
296
|
-
? iterator
|
|
297
|
-
: Array.from(iterator);
|
|
298
|
-
}
|
|
299
|
-
keysParsed(iterate = false) {
|
|
300
|
-
const kp = this.keyParser;
|
|
301
|
-
if (!kp) {
|
|
302
|
-
return null;
|
|
303
|
-
}
|
|
304
|
-
const keysIterator = this.keys(true);
|
|
305
|
-
if (!iterate) {
|
|
306
|
-
return Array.from(keysIterator, key => kp(key));
|
|
307
|
-
}
|
|
308
|
-
return (function* () {
|
|
309
|
-
for (const key of keysIterator) {
|
|
310
|
-
yield kp(key);
|
|
311
|
-
}
|
|
312
|
-
})();
|
|
313
|
-
}
|
|
314
|
-
/** Clears the cache and resets the loading state. */
|
|
315
|
-
clear() {
|
|
316
|
-
++this._version;
|
|
317
|
-
this._loadingCount.value = 0;
|
|
318
|
-
this._batch?.clear();
|
|
319
|
-
this._itemsCache.clear();
|
|
320
|
-
this._itemsStatus.clear();
|
|
321
|
-
this._fetchCache.clear();
|
|
322
|
-
}
|
|
323
|
-
/** @internal updates all caches states at once. */
|
|
324
|
-
_set(key, item, promise, busy) {
|
|
325
|
-
_setX(key, this._fetchCache, promise);
|
|
326
|
-
_setX(key, this._itemsStatus, busy);
|
|
327
|
-
_setX(key, this._itemsCache, item);
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Checks if the cached item for the specified key is invalidated (expired).
|
|
331
|
-
* @param key The cache key.
|
|
332
|
-
* @returns True if the item is invalidated, false otherwise.
|
|
333
|
-
*/
|
|
334
|
-
getIsInvalidated(key) {
|
|
335
|
-
if (!this._invalidationTimeMs) {
|
|
336
|
-
return false;
|
|
337
|
-
}
|
|
338
|
-
const ts = this._timestamps.get(key);
|
|
339
|
-
return ts != null && Date.now() - ts > this._invalidationTimeMs;
|
|
340
|
-
}
|
|
341
|
-
/** Updates the loading status for the specified key. Override to add a hook. */
|
|
342
|
-
setStatus(key, status) {
|
|
343
|
-
this.logger.log(key, 'status update:', status);
|
|
344
|
-
this._itemsStatus.set(key, status);
|
|
345
|
-
}
|
|
346
|
-
/** Updates the promise for the specified key. Override to add a hook. */
|
|
347
|
-
setPromise(key, promise) {
|
|
348
|
-
this._fetchCache.set(key, promise);
|
|
349
|
-
}
|
|
350
|
-
/** Stores the result for the specified key. Override to add a hook. */
|
|
351
|
-
storeResult(key, res) {
|
|
352
|
-
this._itemsCache.set(key, res);
|
|
353
|
-
this._timestamps.set(key, Date.now());
|
|
354
|
-
}
|
|
355
|
-
/** Hooks into the fetch process before it starts. */
|
|
356
|
-
onBeforeFetch(_key) {
|
|
357
|
-
this._loadingCount.value = this._loadingCount.value + 1;
|
|
358
|
-
}
|
|
359
|
-
/** Hooks into the fetch process after it completes. */
|
|
360
|
-
onFetchComplete(key) {
|
|
361
|
-
this._loadingCount.value = this._loadingCount.value - 1;
|
|
362
|
-
this._fetchCache.delete(key);
|
|
363
|
-
this._itemsStatus.set(key, false);
|
|
364
|
-
}
|
|
365
|
-
/** Hooks into the result preparation process, before it's stored into the cache. */
|
|
366
|
-
prepareResult(res) {
|
|
367
|
-
return res || null;
|
|
368
|
-
}
|
|
369
|
-
/** @pure Performs a fetch operation in batch mode if available, otherwise uses the regular fetch. */
|
|
370
|
-
async tryFetchInBatch(id) {
|
|
371
|
-
const fetchWrap = () => this.fetcher(id).catch(err => {
|
|
372
|
-
this.logger.warn('fetcher failed', id, err);
|
|
373
|
-
return null;
|
|
374
|
-
});
|
|
375
|
-
if (!this._batch) {
|
|
376
|
-
return fetchWrap();
|
|
377
|
-
}
|
|
378
|
-
const res = await this._batch.push(id)
|
|
379
|
-
.catch(err => {
|
|
380
|
-
this.logger.warn('batch fetch failed', id, err);
|
|
381
|
-
return null;
|
|
382
|
-
});
|
|
383
|
-
if (!res || !res.result || res.result[res.index] === undefined) {
|
|
384
|
-
// If we got to batch call, should we fallback to the direct one?
|
|
385
|
-
return fetchWrap();
|
|
386
|
-
}
|
|
387
|
-
return res.result[res.index];
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
exports.PromiseCache = PromiseCache;
|
|
391
|
-
function _setX(key, map, val) {
|
|
392
|
-
if (val === undefined) {
|
|
393
|
-
map.delete(key);
|
|
394
|
-
}
|
|
395
|
-
else {
|
|
396
|
-
map.set(key, val);
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
//# sourceMappingURL=promiseCache.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"promiseCache.js","sourceRoot":"","sources":["../../../src/structures/promiseCache.ts"],"names":[],"mappings":";;;AAAA,0DAA6D;AAC7D,uDAAiD;AACjD,iDAA2C;AAe3C,IAAiB,cAAc,CAS9B;AATD,WAAiB,cAAc;IAC3B,MAAM,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAO,IAAI,CAAC,CAAC;IAErD,4BAA4B;IACf,oBAAK,GAAG;QACjB,IAAI,OAAO,KAAW,OAAO,IAAI,CAAC,CAAC,CAAC;QACpC,IAAI,OAAO,KAAoB,OAAO,gBAAgB,CAAC,CAAC,CAAC;QACzD,IAAI,SAAS,KAAK,OAAO,KAAK,CAAC,CAAC,CAAC;KACL,CAAC;AACrC,CAAC,EATgB,cAAc,8BAAd,cAAc,QAS9B;AAED,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B;;;;;;;;EAQE;AACF,MAAa,YAA4B,SAAQ,sBAAQ;IA8BhC;IACA;IACA;IA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