@modern-js/runtime-utils 2.68.0 → 2.68.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/cjs/remixRouter.js +21 -0
- package/dist/cjs/universal/cache.js +265 -142
- package/dist/esm/remixRouter.js +6 -0
- package/dist/esm/universal/cache.js +779 -189
- package/dist/esm-node/remixRouter.js +6 -0
- package/dist/esm-node/universal/cache.js +265 -142
- package/dist/types/remixRouter.d.ts +1 -0
- package/dist/types/universal/async_storage.server.d.ts +2 -0
- package/dist/types/universal/cache.d.ts +33 -10
- package/package.json +5 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
|
+
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
|
|
2
3
|
import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
|
|
3
4
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
4
5
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
@@ -20,64 +21,6 @@ var CacheTime = {
|
|
|
20
21
|
WEEK: 7 * 24 * 60 * 60 * 1e3,
|
|
21
22
|
MONTH: 30 * 24 * 60 * 60 * 1e3
|
|
22
23
|
};
|
|
23
|
-
var isServer = typeof window === "undefined";
|
|
24
|
-
var requestCacheMap = /* @__PURE__ */ new WeakMap();
|
|
25
|
-
var lruCache;
|
|
26
|
-
var cacheConfig = {
|
|
27
|
-
maxSize: CacheSize.GB
|
|
28
|
-
};
|
|
29
|
-
var tagKeyMap = /* @__PURE__ */ new Map();
|
|
30
|
-
function addTagKeyRelation(tag, key) {
|
|
31
|
-
var keys = tagKeyMap.get(tag);
|
|
32
|
-
if (!keys) {
|
|
33
|
-
keys = /* @__PURE__ */ new Set();
|
|
34
|
-
tagKeyMap.set(tag, keys);
|
|
35
|
-
}
|
|
36
|
-
keys.add(key);
|
|
37
|
-
}
|
|
38
|
-
function configureCache(config) {
|
|
39
|
-
cacheConfig = _object_spread({}, cacheConfig, config);
|
|
40
|
-
}
|
|
41
|
-
function getLRUCache() {
|
|
42
|
-
if (!lruCache) {
|
|
43
|
-
var _cacheConfig_maxSize;
|
|
44
|
-
lruCache = new LRUCache({
|
|
45
|
-
maxSize: (_cacheConfig_maxSize = cacheConfig.maxSize) !== null && _cacheConfig_maxSize !== void 0 ? _cacheConfig_maxSize : CacheSize.GB,
|
|
46
|
-
sizeCalculation: function(value) {
|
|
47
|
-
if (!value.size) {
|
|
48
|
-
return 1;
|
|
49
|
-
}
|
|
50
|
-
var size = 0;
|
|
51
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
52
|
-
try {
|
|
53
|
-
for (var _iterator = value.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
54
|
-
var _step_value = _sliced_to_array(_step.value, 2), k = _step_value[0], item = _step_value[1];
|
|
55
|
-
size += k.length * 2;
|
|
56
|
-
size += estimateObjectSize(item.data);
|
|
57
|
-
size += 8;
|
|
58
|
-
}
|
|
59
|
-
} catch (err) {
|
|
60
|
-
_didIteratorError = true;
|
|
61
|
-
_iteratorError = err;
|
|
62
|
-
} finally {
|
|
63
|
-
try {
|
|
64
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
65
|
-
_iterator.return();
|
|
66
|
-
}
|
|
67
|
-
} finally {
|
|
68
|
-
if (_didIteratorError) {
|
|
69
|
-
throw _iteratorError;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return size;
|
|
74
|
-
},
|
|
75
|
-
updateAgeOnGet: true,
|
|
76
|
-
updateAgeOnHas: true
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
return lruCache;
|
|
80
|
-
}
|
|
81
24
|
function estimateObjectSize(data) {
|
|
82
25
|
var type = typeof data === "undefined" ? "undefined" : _type_of(data);
|
|
83
26
|
if (type === "number")
|
|
@@ -110,6 +53,108 @@ function estimateObjectSize(data) {
|
|
|
110
53
|
}
|
|
111
54
|
return 1;
|
|
112
55
|
}
|
|
56
|
+
var MemoryContainer = /* @__PURE__ */ function() {
|
|
57
|
+
"use strict";
|
|
58
|
+
function MemoryContainer2(options) {
|
|
59
|
+
_class_call_check(this, MemoryContainer2);
|
|
60
|
+
var _options_maxSize;
|
|
61
|
+
this.lru = new LRUCache({
|
|
62
|
+
maxSize: (_options_maxSize = options === null || options === void 0 ? void 0 : options.maxSize) !== null && _options_maxSize !== void 0 ? _options_maxSize : CacheSize.GB,
|
|
63
|
+
sizeCalculation: estimateObjectSize,
|
|
64
|
+
updateAgeOnGet: true,
|
|
65
|
+
updateAgeOnHas: true
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
var _proto = MemoryContainer2.prototype;
|
|
69
|
+
_proto.get = function get(key) {
|
|
70
|
+
var _this = this;
|
|
71
|
+
return _async_to_generator(function() {
|
|
72
|
+
return _ts_generator(this, function(_state) {
|
|
73
|
+
return [
|
|
74
|
+
2,
|
|
75
|
+
_this.lru.get(key)
|
|
76
|
+
];
|
|
77
|
+
});
|
|
78
|
+
})();
|
|
79
|
+
};
|
|
80
|
+
_proto.set = function set(key, value, options) {
|
|
81
|
+
var _this = this;
|
|
82
|
+
return _async_to_generator(function() {
|
|
83
|
+
return _ts_generator(this, function(_state) {
|
|
84
|
+
if (options === null || options === void 0 ? void 0 : options.ttl) {
|
|
85
|
+
_this.lru.set(key, value, {
|
|
86
|
+
ttl: options.ttl * 1e3
|
|
87
|
+
});
|
|
88
|
+
} else {
|
|
89
|
+
_this.lru.set(key, value);
|
|
90
|
+
}
|
|
91
|
+
return [
|
|
92
|
+
2
|
|
93
|
+
];
|
|
94
|
+
});
|
|
95
|
+
})();
|
|
96
|
+
};
|
|
97
|
+
_proto.has = function has(key) {
|
|
98
|
+
var _this = this;
|
|
99
|
+
return _async_to_generator(function() {
|
|
100
|
+
return _ts_generator(this, function(_state) {
|
|
101
|
+
return [
|
|
102
|
+
2,
|
|
103
|
+
_this.lru.has(key)
|
|
104
|
+
];
|
|
105
|
+
});
|
|
106
|
+
})();
|
|
107
|
+
};
|
|
108
|
+
_proto.delete = function _delete(key) {
|
|
109
|
+
var _this = this;
|
|
110
|
+
return _async_to_generator(function() {
|
|
111
|
+
return _ts_generator(this, function(_state) {
|
|
112
|
+
return [
|
|
113
|
+
2,
|
|
114
|
+
_this.lru.delete(key)
|
|
115
|
+
];
|
|
116
|
+
});
|
|
117
|
+
})();
|
|
118
|
+
};
|
|
119
|
+
_proto.clear = function clear() {
|
|
120
|
+
var _this = this;
|
|
121
|
+
return _async_to_generator(function() {
|
|
122
|
+
return _ts_generator(this, function(_state) {
|
|
123
|
+
_this.lru.clear();
|
|
124
|
+
return [
|
|
125
|
+
2
|
|
126
|
+
];
|
|
127
|
+
});
|
|
128
|
+
})();
|
|
129
|
+
};
|
|
130
|
+
return MemoryContainer2;
|
|
131
|
+
}();
|
|
132
|
+
var isServer = typeof window === "undefined";
|
|
133
|
+
var requestCacheMap = /* @__PURE__ */ new WeakMap();
|
|
134
|
+
var TAG_PREFIX = "tag:";
|
|
135
|
+
var CACHE_PREFIX = "modernjs_cache:";
|
|
136
|
+
var ongoingRevalidations = /* @__PURE__ */ new Map();
|
|
137
|
+
var storage;
|
|
138
|
+
var cacheConfig = {
|
|
139
|
+
maxSize: CacheSize.GB
|
|
140
|
+
};
|
|
141
|
+
function getStorage() {
|
|
142
|
+
if (storage) {
|
|
143
|
+
return storage;
|
|
144
|
+
}
|
|
145
|
+
if (cacheConfig.container) {
|
|
146
|
+
storage = cacheConfig.container;
|
|
147
|
+
} else {
|
|
148
|
+
storage = new MemoryContainer({
|
|
149
|
+
maxSize: cacheConfig.maxSize
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return storage;
|
|
153
|
+
}
|
|
154
|
+
function configureCache(config) {
|
|
155
|
+
cacheConfig = _object_spread({}, cacheConfig, config);
|
|
156
|
+
storage = void 0;
|
|
157
|
+
}
|
|
113
158
|
function generateKey(args) {
|
|
114
159
|
return JSON.stringify(args, function(_, value) {
|
|
115
160
|
if (value && (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && !Array.isArray(value)) {
|
|
@@ -121,21 +166,19 @@ function generateKey(args) {
|
|
|
121
166
|
return value;
|
|
122
167
|
});
|
|
123
168
|
}
|
|
169
|
+
function generateStableFunctionId(fn) {
|
|
170
|
+
var fnString = fn.toString();
|
|
171
|
+
var hash = 0;
|
|
172
|
+
for (var i = 0; i < fnString.length; i++) {
|
|
173
|
+
var char = fnString.charCodeAt(i);
|
|
174
|
+
hash = (hash << 5) - hash + char;
|
|
175
|
+
hash = hash & hash;
|
|
176
|
+
}
|
|
177
|
+
return "fn_".concat(fn.name || "anonymous", "_").concat(Math.abs(hash).toString(36));
|
|
178
|
+
}
|
|
124
179
|
function cache(fn, options) {
|
|
125
|
-
var _ref = options || {}, _ref_tag = _ref.tag, tag = _ref_tag === void 0 ? "default" : _ref_tag, _ref_maxAge = _ref.maxAge, maxAge = _ref_maxAge === void 0 ? CacheTime.MINUTE * 5 : _ref_maxAge, _ref_revalidate = _ref.revalidate, revalidate = _ref_revalidate === void 0 ? 0 : _ref_revalidate, customKey = _ref.customKey, onCache = _ref.onCache, getKey = _ref.getKey;
|
|
126
|
-
var store = getLRUCache();
|
|
127
|
-
var tags = Array.isArray(tag) ? tag : [
|
|
128
|
-
tag
|
|
129
|
-
];
|
|
130
|
-
var getCacheKey = function(args, generatedKey) {
|
|
131
|
-
return customKey ? customKey({
|
|
132
|
-
params: args,
|
|
133
|
-
fn,
|
|
134
|
-
generatedKey
|
|
135
|
-
}) : fn;
|
|
136
|
-
};
|
|
137
180
|
return /* @__PURE__ */ _async_to_generator(function() {
|
|
138
|
-
var _len, args, _key, _storage_useContext,
|
|
181
|
+
var _len, args, _key, _storage_useContext, storage2, request, shouldDisableCaching, requestCache, fnCache, key, promise, data, error, tag, _options_maxAge, maxAge, _options_revalidate, revalidate, customKey, onCache, getKey, unstable_shouldCache, missReason, currentStorage, now, tags, genKey, finalKey, functionId, storageKey, shouldDisableCaching1, _asyncStorage_useContext, asyncStorage, request1, cached, cacheItem, age, revalidationPromise, data1, shouldCache, error1, data2, onCache1;
|
|
139
182
|
var _arguments = arguments;
|
|
140
183
|
return _ts_generator(this, function(_state) {
|
|
141
184
|
switch (_state.label) {
|
|
@@ -148,8 +191,8 @@ function cache(fn, options) {
|
|
|
148
191
|
3,
|
|
149
192
|
7
|
|
150
193
|
];
|
|
151
|
-
|
|
152
|
-
request =
|
|
194
|
+
storage2 = getAsyncLocalStorage();
|
|
195
|
+
request = storage2 === null || storage2 === void 0 ? void 0 : (_storage_useContext = storage2.useContext()) === null || _storage_useContext === void 0 ? void 0 : _storage_useContext.request;
|
|
153
196
|
if (!request)
|
|
154
197
|
return [
|
|
155
198
|
3,
|
|
@@ -221,38 +264,52 @@ function cache(fn, options) {
|
|
|
221
264
|
case 6:
|
|
222
265
|
return [
|
|
223
266
|
3,
|
|
224
|
-
|
|
267
|
+
23
|
|
225
268
|
];
|
|
226
269
|
case 7:
|
|
227
270
|
if (!(typeof options !== "undefined"))
|
|
228
271
|
return [
|
|
229
272
|
3,
|
|
230
|
-
|
|
273
|
+
22
|
|
231
274
|
];
|
|
232
|
-
|
|
275
|
+
_state.label = 8;
|
|
276
|
+
case 8:
|
|
277
|
+
_state.trys.push([
|
|
278
|
+
8,
|
|
279
|
+
19,
|
|
280
|
+
,
|
|
281
|
+
21
|
|
282
|
+
]);
|
|
283
|
+
tag = options.tag, _options_maxAge = options.maxAge, maxAge = _options_maxAge === void 0 ? CacheTime.MINUTE * 5 : _options_maxAge, _options_revalidate = options.revalidate, revalidate = _options_revalidate === void 0 ? 0 : _options_revalidate, customKey = options.customKey, onCache = options.onCache, getKey = options.getKey, unstable_shouldCache = options.unstable_shouldCache;
|
|
284
|
+
currentStorage = getStorage();
|
|
233
285
|
now = Date.now();
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
286
|
+
tags = tag ? Array.isArray(tag) ? tag : [
|
|
287
|
+
tag
|
|
288
|
+
] : [];
|
|
289
|
+
genKey = getKey ? getKey.apply(void 0, _to_consumable_array(args)) : generateKey(args);
|
|
290
|
+
if (customKey) {
|
|
291
|
+
finalKey = customKey({
|
|
292
|
+
params: args,
|
|
293
|
+
fn,
|
|
294
|
+
generatedKey: genKey
|
|
295
|
+
});
|
|
296
|
+
} else {
|
|
297
|
+
functionId = generateStableFunctionId(fn);
|
|
298
|
+
finalKey = "".concat(functionId, ":").concat(genKey);
|
|
242
299
|
}
|
|
243
|
-
|
|
300
|
+
storageKey = "".concat(CACHE_PREFIX).concat(finalKey);
|
|
244
301
|
shouldDisableCaching1 = false;
|
|
245
302
|
if (!(isServer && cacheConfig.unstable_shouldDisable))
|
|
246
303
|
return [
|
|
247
304
|
3,
|
|
248
|
-
|
|
305
|
+
10
|
|
249
306
|
];
|
|
250
|
-
|
|
251
|
-
request1 =
|
|
307
|
+
asyncStorage = getAsyncLocalStorage();
|
|
308
|
+
request1 = asyncStorage === null || asyncStorage === void 0 ? void 0 : (_asyncStorage_useContext = asyncStorage.useContext()) === null || _asyncStorage_useContext === void 0 ? void 0 : _asyncStorage_useContext.request;
|
|
252
309
|
if (!request1)
|
|
253
310
|
return [
|
|
254
311
|
3,
|
|
255
|
-
|
|
312
|
+
10
|
|
256
313
|
];
|
|
257
314
|
return [
|
|
258
315
|
4,
|
|
@@ -260,132 +317,489 @@ function cache(fn, options) {
|
|
|
260
317
|
request: request1
|
|
261
318
|
})
|
|
262
319
|
];
|
|
263
|
-
case 8:
|
|
264
|
-
shouldDisableCaching1 = _state.sent();
|
|
265
|
-
_state.label = 9;
|
|
266
320
|
case 9:
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
321
|
+
shouldDisableCaching1 = _state.sent();
|
|
322
|
+
_state.label = 10;
|
|
323
|
+
case 10:
|
|
324
|
+
if (!!shouldDisableCaching1)
|
|
325
|
+
return [
|
|
326
|
+
3,
|
|
327
|
+
12
|
|
328
|
+
];
|
|
329
|
+
return [
|
|
330
|
+
4,
|
|
331
|
+
currentStorage.get(storageKey)
|
|
332
|
+
];
|
|
333
|
+
case 11:
|
|
334
|
+
cached = _state.sent();
|
|
335
|
+
if (cached) {
|
|
336
|
+
try {
|
|
337
|
+
cacheItem = cached;
|
|
338
|
+
age = now - cacheItem.timestamp;
|
|
339
|
+
if (age < maxAge) {
|
|
340
|
+
onCache === null || onCache === void 0 ? void 0 : onCache({
|
|
273
341
|
status: "hit",
|
|
274
342
|
key: finalKey,
|
|
275
343
|
params: args,
|
|
276
|
-
result:
|
|
344
|
+
result: cacheItem.data
|
|
277
345
|
});
|
|
346
|
+
return [
|
|
347
|
+
2,
|
|
348
|
+
cacheItem.data
|
|
349
|
+
];
|
|
278
350
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
cached.data
|
|
282
|
-
];
|
|
283
|
-
}
|
|
284
|
-
if (revalidate > 0 && age < maxAge + revalidate) {
|
|
285
|
-
if (onCache) {
|
|
286
|
-
onCache({
|
|
351
|
+
if (revalidate > 0 && age < maxAge + revalidate) {
|
|
352
|
+
onCache === null || onCache === void 0 ? void 0 : onCache({
|
|
287
353
|
status: "stale",
|
|
288
354
|
key: finalKey,
|
|
289
355
|
params: args,
|
|
290
|
-
result:
|
|
356
|
+
result: cacheItem.data
|
|
291
357
|
});
|
|
358
|
+
if (!ongoingRevalidations.has(storageKey)) {
|
|
359
|
+
revalidationPromise = _async_to_generator(function() {
|
|
360
|
+
var newData, shouldCache2, error2, _asyncStorage_useContext_monitors, _asyncStorage_useContext2, asyncStorage2;
|
|
361
|
+
return _ts_generator(this, function(_state2) {
|
|
362
|
+
switch (_state2.label) {
|
|
363
|
+
case 0:
|
|
364
|
+
_state2.trys.push([
|
|
365
|
+
0,
|
|
366
|
+
6,
|
|
367
|
+
7,
|
|
368
|
+
8
|
|
369
|
+
]);
|
|
370
|
+
return [
|
|
371
|
+
4,
|
|
372
|
+
fn.apply(void 0, _to_consumable_array(args))
|
|
373
|
+
];
|
|
374
|
+
case 1:
|
|
375
|
+
newData = _state2.sent();
|
|
376
|
+
shouldCache2 = true;
|
|
377
|
+
if (!unstable_shouldCache)
|
|
378
|
+
return [
|
|
379
|
+
3,
|
|
380
|
+
3
|
|
381
|
+
];
|
|
382
|
+
return [
|
|
383
|
+
4,
|
|
384
|
+
unstable_shouldCache({
|
|
385
|
+
params: args,
|
|
386
|
+
result: newData
|
|
387
|
+
})
|
|
388
|
+
];
|
|
389
|
+
case 2:
|
|
390
|
+
shouldCache2 = _state2.sent();
|
|
391
|
+
_state2.label = 3;
|
|
392
|
+
case 3:
|
|
393
|
+
if (!shouldCache2)
|
|
394
|
+
return [
|
|
395
|
+
3,
|
|
396
|
+
5
|
|
397
|
+
];
|
|
398
|
+
return [
|
|
399
|
+
4,
|
|
400
|
+
setCacheItem(currentStorage, storageKey, newData, tags, maxAge, revalidate)
|
|
401
|
+
];
|
|
402
|
+
case 4:
|
|
403
|
+
_state2.sent();
|
|
404
|
+
_state2.label = 5;
|
|
405
|
+
case 5:
|
|
406
|
+
return [
|
|
407
|
+
3,
|
|
408
|
+
8
|
|
409
|
+
];
|
|
410
|
+
case 6:
|
|
411
|
+
error2 = _state2.sent();
|
|
412
|
+
if (isServer) {
|
|
413
|
+
;
|
|
414
|
+
asyncStorage2 = getAsyncLocalStorage();
|
|
415
|
+
asyncStorage2 === null || asyncStorage2 === void 0 ? void 0 : (_asyncStorage_useContext2 = asyncStorage2.useContext()) === null || _asyncStorage_useContext2 === void 0 ? void 0 : (_asyncStorage_useContext_monitors = _asyncStorage_useContext2.monitors) === null || _asyncStorage_useContext_monitors === void 0 ? void 0 : _asyncStorage_useContext_monitors.error(error2.message);
|
|
416
|
+
} else {
|
|
417
|
+
console.error("Background revalidation failed:", error2);
|
|
418
|
+
}
|
|
419
|
+
return [
|
|
420
|
+
3,
|
|
421
|
+
8
|
|
422
|
+
];
|
|
423
|
+
case 7:
|
|
424
|
+
ongoingRevalidations.delete(storageKey);
|
|
425
|
+
return [
|
|
426
|
+
7
|
|
427
|
+
];
|
|
428
|
+
case 8:
|
|
429
|
+
return [
|
|
430
|
+
2
|
|
431
|
+
];
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
})();
|
|
435
|
+
ongoingRevalidations.set(storageKey, revalidationPromise);
|
|
436
|
+
}
|
|
437
|
+
return [
|
|
438
|
+
2,
|
|
439
|
+
cacheItem.data
|
|
440
|
+
];
|
|
292
441
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
return _ts_generator(this, function(_state2) {
|
|
298
|
-
switch (_state2.label) {
|
|
299
|
-
case 0:
|
|
300
|
-
_state2.trys.push([
|
|
301
|
-
0,
|
|
302
|
-
2,
|
|
303
|
-
,
|
|
304
|
-
3
|
|
305
|
-
]);
|
|
306
|
-
return [
|
|
307
|
-
4,
|
|
308
|
-
fn.apply(void 0, _to_consumable_array(args))
|
|
309
|
-
];
|
|
310
|
-
case 1:
|
|
311
|
-
newData = _state2.sent();
|
|
312
|
-
cacheStore.set(storeKey, {
|
|
313
|
-
data: newData,
|
|
314
|
-
timestamp: Date.now(),
|
|
315
|
-
isRevalidating: false
|
|
316
|
-
});
|
|
317
|
-
store.set(cacheKey, cacheStore);
|
|
318
|
-
return [
|
|
319
|
-
3,
|
|
320
|
-
3
|
|
321
|
-
];
|
|
322
|
-
case 2:
|
|
323
|
-
error2 = _state2.sent();
|
|
324
|
-
cached.isRevalidating = false;
|
|
325
|
-
if (isServer) {
|
|
326
|
-
;
|
|
327
|
-
storage2 = getAsyncLocalStorage();
|
|
328
|
-
storage2 === null || storage2 === void 0 ? void 0 : (_storage_useContext2 = storage2.useContext()) === null || _storage_useContext2 === void 0 ? void 0 : (_storage_useContext_monitors = _storage_useContext2.monitors) === null || _storage_useContext_monitors === void 0 ? void 0 : _storage_useContext_monitors.error(error2.message);
|
|
329
|
-
} else {
|
|
330
|
-
console.error("Background revalidation failed:", error2);
|
|
331
|
-
}
|
|
332
|
-
return [
|
|
333
|
-
3,
|
|
334
|
-
3
|
|
335
|
-
];
|
|
336
|
-
case 3:
|
|
337
|
-
return [
|
|
338
|
-
2
|
|
339
|
-
];
|
|
340
|
-
}
|
|
341
|
-
});
|
|
342
|
-
}));
|
|
343
|
-
}
|
|
344
|
-
return [
|
|
345
|
-
2,
|
|
346
|
-
cached.data
|
|
347
|
-
];
|
|
442
|
+
missReason = 3;
|
|
443
|
+
} catch (error2) {
|
|
444
|
+
console.warn("Failed to parse cached data:", error2);
|
|
445
|
+
missReason = 4;
|
|
348
446
|
}
|
|
447
|
+
} else {
|
|
448
|
+
missReason = 2;
|
|
349
449
|
}
|
|
450
|
+
return [
|
|
451
|
+
3,
|
|
452
|
+
13
|
|
453
|
+
];
|
|
454
|
+
case 12:
|
|
455
|
+
missReason = 1;
|
|
456
|
+
_state.label = 13;
|
|
457
|
+
case 13:
|
|
350
458
|
return [
|
|
351
459
|
4,
|
|
352
460
|
fn.apply(void 0, _to_consumable_array(args))
|
|
353
461
|
];
|
|
354
|
-
case
|
|
462
|
+
case 14:
|
|
355
463
|
data1 = _state.sent();
|
|
356
|
-
if (
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
464
|
+
if (!!shouldDisableCaching1)
|
|
465
|
+
return [
|
|
466
|
+
3,
|
|
467
|
+
18
|
|
468
|
+
];
|
|
469
|
+
shouldCache = true;
|
|
470
|
+
if (!unstable_shouldCache)
|
|
471
|
+
return [
|
|
472
|
+
3,
|
|
473
|
+
16
|
|
474
|
+
];
|
|
475
|
+
return [
|
|
476
|
+
4,
|
|
477
|
+
unstable_shouldCache({
|
|
368
478
|
params: args,
|
|
369
479
|
result: data1
|
|
480
|
+
})
|
|
481
|
+
];
|
|
482
|
+
case 15:
|
|
483
|
+
shouldCache = _state.sent();
|
|
484
|
+
_state.label = 16;
|
|
485
|
+
case 16:
|
|
486
|
+
if (!shouldCache)
|
|
487
|
+
return [
|
|
488
|
+
3,
|
|
489
|
+
18
|
|
490
|
+
];
|
|
491
|
+
return [
|
|
492
|
+
4,
|
|
493
|
+
setCacheItem(currentStorage, storageKey, data1, tags, maxAge, revalidate)
|
|
494
|
+
];
|
|
495
|
+
case 17:
|
|
496
|
+
_state.sent();
|
|
497
|
+
_state.label = 18;
|
|
498
|
+
case 18:
|
|
499
|
+
onCache === null || onCache === void 0 ? void 0 : onCache({
|
|
500
|
+
status: "miss",
|
|
501
|
+
key: finalKey,
|
|
502
|
+
params: args,
|
|
503
|
+
result: data1,
|
|
504
|
+
reason: missReason
|
|
505
|
+
});
|
|
506
|
+
return [
|
|
507
|
+
2,
|
|
508
|
+
data1
|
|
509
|
+
];
|
|
510
|
+
case 19:
|
|
511
|
+
error1 = _state.sent();
|
|
512
|
+
console.warn("Cache operation failed, falling back to direct execution:", error1);
|
|
513
|
+
return [
|
|
514
|
+
4,
|
|
515
|
+
fn.apply(void 0, _to_consumable_array(args))
|
|
516
|
+
];
|
|
517
|
+
case 20:
|
|
518
|
+
data2 = _state.sent();
|
|
519
|
+
onCache1 = options.onCache;
|
|
520
|
+
try {
|
|
521
|
+
onCache1 === null || onCache1 === void 0 ? void 0 : onCache1({
|
|
522
|
+
status: "miss",
|
|
523
|
+
key: "cache_failed",
|
|
524
|
+
params: args,
|
|
525
|
+
result: data2,
|
|
526
|
+
reason: 5
|
|
370
527
|
});
|
|
528
|
+
} catch (callbackError) {
|
|
529
|
+
console.warn("Failed to call onCache callback:", callbackError);
|
|
371
530
|
}
|
|
372
531
|
return [
|
|
373
532
|
2,
|
|
374
|
-
|
|
533
|
+
data2
|
|
375
534
|
];
|
|
376
|
-
case
|
|
535
|
+
case 21:
|
|
536
|
+
return [
|
|
537
|
+
3,
|
|
538
|
+
23
|
|
539
|
+
];
|
|
540
|
+
case 22:
|
|
377
541
|
console.warn("The cache function will not work because it runs on the browser and there are no options are provided.");
|
|
378
542
|
return [
|
|
379
543
|
2,
|
|
380
544
|
fn.apply(void 0, _to_consumable_array(args))
|
|
381
545
|
];
|
|
546
|
+
case 23:
|
|
547
|
+
return [
|
|
548
|
+
2
|
|
549
|
+
];
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
function setCacheItem(storage2, storageKey, data, tags, maxAge, revalidate) {
|
|
555
|
+
return _setCacheItem.apply(this, arguments);
|
|
556
|
+
}
|
|
557
|
+
function _setCacheItem() {
|
|
558
|
+
_setCacheItem = _async_to_generator(function(storage2, storageKey, data, tags, maxAge, revalidate) {
|
|
559
|
+
var newItem, ttl;
|
|
560
|
+
return _ts_generator(this, function(_state) {
|
|
561
|
+
switch (_state.label) {
|
|
562
|
+
case 0:
|
|
563
|
+
newItem = {
|
|
564
|
+
data,
|
|
565
|
+
timestamp: Date.now(),
|
|
566
|
+
tags: tags.length > 0 ? tags : void 0
|
|
567
|
+
};
|
|
568
|
+
ttl = (maxAge + revalidate) / 1e3;
|
|
569
|
+
return [
|
|
570
|
+
4,
|
|
571
|
+
storage2.set(storageKey, newItem, {
|
|
572
|
+
ttl: ttl > 0 ? ttl : void 0
|
|
573
|
+
})
|
|
574
|
+
];
|
|
575
|
+
case 1:
|
|
576
|
+
_state.sent();
|
|
577
|
+
return [
|
|
578
|
+
4,
|
|
579
|
+
updateTagRelationships(storage2, storageKey, tags)
|
|
580
|
+
];
|
|
581
|
+
case 2:
|
|
582
|
+
_state.sent();
|
|
583
|
+
return [
|
|
584
|
+
2
|
|
585
|
+
];
|
|
586
|
+
}
|
|
587
|
+
});
|
|
588
|
+
});
|
|
589
|
+
return _setCacheItem.apply(this, arguments);
|
|
590
|
+
}
|
|
591
|
+
function updateTagRelationships(storage2, storageKey, tags) {
|
|
592
|
+
return _updateTagRelationships.apply(this, arguments);
|
|
593
|
+
}
|
|
594
|
+
function _updateTagRelationships() {
|
|
595
|
+
_updateTagRelationships = _async_to_generator(function(storage2, storageKey, tags) {
|
|
596
|
+
var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, tag, tagStoreKey, keyList, keyArray, err;
|
|
597
|
+
return _ts_generator(this, function(_state) {
|
|
598
|
+
switch (_state.label) {
|
|
599
|
+
case 0:
|
|
600
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
601
|
+
_state.label = 1;
|
|
602
|
+
case 1:
|
|
603
|
+
_state.trys.push([
|
|
604
|
+
1,
|
|
605
|
+
7,
|
|
606
|
+
8,
|
|
607
|
+
9
|
|
608
|
+
]);
|
|
609
|
+
_iterator = tags[Symbol.iterator]();
|
|
610
|
+
_state.label = 2;
|
|
611
|
+
case 2:
|
|
612
|
+
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done))
|
|
613
|
+
return [
|
|
614
|
+
3,
|
|
615
|
+
6
|
|
616
|
+
];
|
|
617
|
+
tag = _step.value;
|
|
618
|
+
tagStoreKey = "".concat(TAG_PREFIX).concat(tag);
|
|
619
|
+
return [
|
|
620
|
+
4,
|
|
621
|
+
storage2.get(tagStoreKey)
|
|
622
|
+
];
|
|
623
|
+
case 3:
|
|
624
|
+
keyList = _state.sent();
|
|
625
|
+
keyArray = keyList || [];
|
|
626
|
+
if (!keyArray.includes(storageKey)) {
|
|
627
|
+
keyArray.push(storageKey);
|
|
628
|
+
}
|
|
629
|
+
return [
|
|
630
|
+
4,
|
|
631
|
+
storage2.set(tagStoreKey, keyArray)
|
|
632
|
+
];
|
|
633
|
+
case 4:
|
|
634
|
+
_state.sent();
|
|
635
|
+
_state.label = 5;
|
|
636
|
+
case 5:
|
|
637
|
+
_iteratorNormalCompletion = true;
|
|
638
|
+
return [
|
|
639
|
+
3,
|
|
640
|
+
2
|
|
641
|
+
];
|
|
642
|
+
case 6:
|
|
643
|
+
return [
|
|
644
|
+
3,
|
|
645
|
+
9
|
|
646
|
+
];
|
|
647
|
+
case 7:
|
|
648
|
+
err = _state.sent();
|
|
649
|
+
_didIteratorError = true;
|
|
650
|
+
_iteratorError = err;
|
|
651
|
+
return [
|
|
652
|
+
3,
|
|
653
|
+
9
|
|
654
|
+
];
|
|
655
|
+
case 8:
|
|
656
|
+
try {
|
|
657
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
658
|
+
_iterator.return();
|
|
659
|
+
}
|
|
660
|
+
} finally {
|
|
661
|
+
if (_didIteratorError) {
|
|
662
|
+
throw _iteratorError;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
return [
|
|
666
|
+
7
|
|
667
|
+
];
|
|
668
|
+
case 9:
|
|
669
|
+
return [
|
|
670
|
+
2
|
|
671
|
+
];
|
|
672
|
+
}
|
|
673
|
+
});
|
|
674
|
+
});
|
|
675
|
+
return _updateTagRelationships.apply(this, arguments);
|
|
676
|
+
}
|
|
677
|
+
function removeKeyFromTags(storage2, storageKey, tags) {
|
|
678
|
+
return _removeKeyFromTags.apply(this, arguments);
|
|
679
|
+
}
|
|
680
|
+
function _removeKeyFromTags() {
|
|
681
|
+
_removeKeyFromTags = _async_to_generator(function(storage2, storageKey, tags) {
|
|
682
|
+
var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, tag, tagStoreKey, keyList, keyArray, updatedKeyList, error, err;
|
|
683
|
+
return _ts_generator(this, function(_state) {
|
|
684
|
+
switch (_state.label) {
|
|
685
|
+
case 0:
|
|
686
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
687
|
+
_state.label = 1;
|
|
688
|
+
case 1:
|
|
689
|
+
_state.trys.push([
|
|
690
|
+
1,
|
|
691
|
+
12,
|
|
692
|
+
13,
|
|
693
|
+
14
|
|
694
|
+
]);
|
|
695
|
+
_iterator = tags[Symbol.iterator]();
|
|
696
|
+
_state.label = 2;
|
|
697
|
+
case 2:
|
|
698
|
+
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done))
|
|
699
|
+
return [
|
|
700
|
+
3,
|
|
701
|
+
11
|
|
702
|
+
];
|
|
703
|
+
tag = _step.value;
|
|
704
|
+
tagStoreKey = "".concat(TAG_PREFIX).concat(tag);
|
|
705
|
+
return [
|
|
706
|
+
4,
|
|
707
|
+
storage2.get(tagStoreKey)
|
|
708
|
+
];
|
|
709
|
+
case 3:
|
|
710
|
+
keyList = _state.sent();
|
|
711
|
+
if (!keyList)
|
|
712
|
+
return [
|
|
713
|
+
3,
|
|
714
|
+
10
|
|
715
|
+
];
|
|
716
|
+
_state.label = 4;
|
|
717
|
+
case 4:
|
|
718
|
+
_state.trys.push([
|
|
719
|
+
4,
|
|
720
|
+
9,
|
|
721
|
+
,
|
|
722
|
+
10
|
|
723
|
+
]);
|
|
724
|
+
keyArray = Array.isArray(keyList) ? keyList : [];
|
|
725
|
+
updatedKeyList = keyArray.filter(function(key) {
|
|
726
|
+
return key !== storageKey;
|
|
727
|
+
});
|
|
728
|
+
if (!(updatedKeyList.length > 0))
|
|
729
|
+
return [
|
|
730
|
+
3,
|
|
731
|
+
6
|
|
732
|
+
];
|
|
733
|
+
return [
|
|
734
|
+
4,
|
|
735
|
+
storage2.set(tagStoreKey, updatedKeyList)
|
|
736
|
+
];
|
|
737
|
+
case 5:
|
|
738
|
+
_state.sent();
|
|
739
|
+
return [
|
|
740
|
+
3,
|
|
741
|
+
8
|
|
742
|
+
];
|
|
743
|
+
case 6:
|
|
744
|
+
return [
|
|
745
|
+
4,
|
|
746
|
+
storage2.delete(tagStoreKey)
|
|
747
|
+
];
|
|
748
|
+
case 7:
|
|
749
|
+
_state.sent();
|
|
750
|
+
_state.label = 8;
|
|
751
|
+
case 8:
|
|
752
|
+
return [
|
|
753
|
+
3,
|
|
754
|
+
10
|
|
755
|
+
];
|
|
756
|
+
case 9:
|
|
757
|
+
error = _state.sent();
|
|
758
|
+
console.warn("Failed to process tag key list for tag ".concat(tag, ":"), error);
|
|
759
|
+
return [
|
|
760
|
+
3,
|
|
761
|
+
10
|
|
762
|
+
];
|
|
763
|
+
case 10:
|
|
764
|
+
_iteratorNormalCompletion = true;
|
|
765
|
+
return [
|
|
766
|
+
3,
|
|
767
|
+
2
|
|
768
|
+
];
|
|
769
|
+
case 11:
|
|
770
|
+
return [
|
|
771
|
+
3,
|
|
772
|
+
14
|
|
773
|
+
];
|
|
382
774
|
case 12:
|
|
775
|
+
err = _state.sent();
|
|
776
|
+
_didIteratorError = true;
|
|
777
|
+
_iteratorError = err;
|
|
778
|
+
return [
|
|
779
|
+
3,
|
|
780
|
+
14
|
|
781
|
+
];
|
|
782
|
+
case 13:
|
|
783
|
+
try {
|
|
784
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
785
|
+
_iterator.return();
|
|
786
|
+
}
|
|
787
|
+
} finally {
|
|
788
|
+
if (_didIteratorError) {
|
|
789
|
+
throw _iteratorError;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
return [
|
|
793
|
+
7
|
|
794
|
+
];
|
|
795
|
+
case 14:
|
|
383
796
|
return [
|
|
384
797
|
2
|
|
385
798
|
];
|
|
386
799
|
}
|
|
387
800
|
});
|
|
388
801
|
});
|
|
802
|
+
return _removeKeyFromTags.apply(this, arguments);
|
|
389
803
|
}
|
|
390
804
|
function withRequestCache(handler) {
|
|
391
805
|
if (!isServer) {
|
|
@@ -393,16 +807,16 @@ function withRequestCache(handler) {
|
|
|
393
807
|
}
|
|
394
808
|
return function() {
|
|
395
809
|
var _ref = _async_to_generator(function(req) {
|
|
396
|
-
var _len, args, _key,
|
|
810
|
+
var _len, args, _key, storage2;
|
|
397
811
|
var _arguments = arguments;
|
|
398
812
|
return _ts_generator(this, function(_state) {
|
|
399
813
|
for (_len = _arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
400
814
|
args[_key - 1] = _arguments[_key];
|
|
401
815
|
}
|
|
402
|
-
|
|
816
|
+
storage2 = getAsyncLocalStorage();
|
|
403
817
|
return [
|
|
404
818
|
2,
|
|
405
|
-
|
|
819
|
+
storage2.run({
|
|
406
820
|
request: req
|
|
407
821
|
}, function() {
|
|
408
822
|
return handler.apply(void 0, [
|
|
@@ -418,17 +832,193 @@ function withRequestCache(handler) {
|
|
|
418
832
|
}();
|
|
419
833
|
}
|
|
420
834
|
function revalidateTag(tag) {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
835
|
+
return _revalidateTag.apply(this, arguments);
|
|
836
|
+
}
|
|
837
|
+
function _revalidateTag() {
|
|
838
|
+
_revalidateTag = _async_to_generator(function(tag) {
|
|
839
|
+
var currentStorage, tagStoreKey, keyList, keyArray, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, cacheKey, cached, cacheItem, otherTags, error, err, error1;
|
|
840
|
+
return _ts_generator(this, function(_state) {
|
|
841
|
+
switch (_state.label) {
|
|
842
|
+
case 0:
|
|
843
|
+
currentStorage = getStorage();
|
|
844
|
+
tagStoreKey = "".concat(TAG_PREFIX).concat(tag);
|
|
845
|
+
return [
|
|
846
|
+
4,
|
|
847
|
+
currentStorage.get(tagStoreKey)
|
|
848
|
+
];
|
|
849
|
+
case 1:
|
|
850
|
+
keyList = _state.sent();
|
|
851
|
+
if (!keyList)
|
|
852
|
+
return [
|
|
853
|
+
3,
|
|
854
|
+
19
|
|
855
|
+
];
|
|
856
|
+
_state.label = 2;
|
|
857
|
+
case 2:
|
|
858
|
+
_state.trys.push([
|
|
859
|
+
2,
|
|
860
|
+
18,
|
|
861
|
+
,
|
|
862
|
+
19
|
|
863
|
+
]);
|
|
864
|
+
keyArray = Array.isArray(keyList) ? keyList : [];
|
|
865
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
866
|
+
_state.label = 3;
|
|
867
|
+
case 3:
|
|
868
|
+
_state.trys.push([
|
|
869
|
+
3,
|
|
870
|
+
14,
|
|
871
|
+
15,
|
|
872
|
+
16
|
|
873
|
+
]);
|
|
874
|
+
_iterator = keyArray[Symbol.iterator]();
|
|
875
|
+
_state.label = 4;
|
|
876
|
+
case 4:
|
|
877
|
+
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done))
|
|
878
|
+
return [
|
|
879
|
+
3,
|
|
880
|
+
13
|
|
881
|
+
];
|
|
882
|
+
cacheKey = _step.value;
|
|
883
|
+
return [
|
|
884
|
+
4,
|
|
885
|
+
currentStorage.get(cacheKey)
|
|
886
|
+
];
|
|
887
|
+
case 5:
|
|
888
|
+
cached = _state.sent();
|
|
889
|
+
if (!cached)
|
|
890
|
+
return [
|
|
891
|
+
3,
|
|
892
|
+
10
|
|
893
|
+
];
|
|
894
|
+
_state.label = 6;
|
|
895
|
+
case 6:
|
|
896
|
+
_state.trys.push([
|
|
897
|
+
6,
|
|
898
|
+
9,
|
|
899
|
+
,
|
|
900
|
+
10
|
|
901
|
+
]);
|
|
902
|
+
cacheItem = cached;
|
|
903
|
+
if (!cacheItem.tags)
|
|
904
|
+
return [
|
|
905
|
+
3,
|
|
906
|
+
8
|
|
907
|
+
];
|
|
908
|
+
otherTags = cacheItem.tags.filter(function(t) {
|
|
909
|
+
return t !== tag;
|
|
910
|
+
});
|
|
911
|
+
return [
|
|
912
|
+
4,
|
|
913
|
+
removeKeyFromTags(currentStorage, cacheKey, otherTags)
|
|
914
|
+
];
|
|
915
|
+
case 7:
|
|
916
|
+
_state.sent();
|
|
917
|
+
_state.label = 8;
|
|
918
|
+
case 8:
|
|
919
|
+
return [
|
|
920
|
+
3,
|
|
921
|
+
10
|
|
922
|
+
];
|
|
923
|
+
case 9:
|
|
924
|
+
error = _state.sent();
|
|
925
|
+
console.warn("Failed to parse cached data while revalidating:", error);
|
|
926
|
+
return [
|
|
927
|
+
3,
|
|
928
|
+
10
|
|
929
|
+
];
|
|
930
|
+
case 10:
|
|
931
|
+
return [
|
|
932
|
+
4,
|
|
933
|
+
currentStorage.delete(cacheKey)
|
|
934
|
+
];
|
|
935
|
+
case 11:
|
|
936
|
+
_state.sent();
|
|
937
|
+
_state.label = 12;
|
|
938
|
+
case 12:
|
|
939
|
+
_iteratorNormalCompletion = true;
|
|
940
|
+
return [
|
|
941
|
+
3,
|
|
942
|
+
4
|
|
943
|
+
];
|
|
944
|
+
case 13:
|
|
945
|
+
return [
|
|
946
|
+
3,
|
|
947
|
+
16
|
|
948
|
+
];
|
|
949
|
+
case 14:
|
|
950
|
+
err = _state.sent();
|
|
951
|
+
_didIteratorError = true;
|
|
952
|
+
_iteratorError = err;
|
|
953
|
+
return [
|
|
954
|
+
3,
|
|
955
|
+
16
|
|
956
|
+
];
|
|
957
|
+
case 15:
|
|
958
|
+
try {
|
|
959
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
960
|
+
_iterator.return();
|
|
961
|
+
}
|
|
962
|
+
} finally {
|
|
963
|
+
if (_didIteratorError) {
|
|
964
|
+
throw _iteratorError;
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
return [
|
|
968
|
+
7
|
|
969
|
+
];
|
|
970
|
+
case 16:
|
|
971
|
+
return [
|
|
972
|
+
4,
|
|
973
|
+
currentStorage.delete(tagStoreKey)
|
|
974
|
+
];
|
|
975
|
+
case 17:
|
|
976
|
+
_state.sent();
|
|
977
|
+
return [
|
|
978
|
+
3,
|
|
979
|
+
19
|
|
980
|
+
];
|
|
981
|
+
case 18:
|
|
982
|
+
error1 = _state.sent();
|
|
983
|
+
console.warn("Failed to process tag key list:", error1);
|
|
984
|
+
return [
|
|
985
|
+
3,
|
|
986
|
+
19
|
|
987
|
+
];
|
|
988
|
+
case 19:
|
|
989
|
+
return [
|
|
990
|
+
2
|
|
991
|
+
];
|
|
992
|
+
}
|
|
425
993
|
});
|
|
426
|
-
}
|
|
994
|
+
});
|
|
995
|
+
return _revalidateTag.apply(this, arguments);
|
|
427
996
|
}
|
|
428
997
|
function clearStore() {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
998
|
+
return _clearStore.apply(this, arguments);
|
|
999
|
+
}
|
|
1000
|
+
function _clearStore() {
|
|
1001
|
+
_clearStore = _async_to_generator(function() {
|
|
1002
|
+
var currentStorage;
|
|
1003
|
+
return _ts_generator(this, function(_state) {
|
|
1004
|
+
switch (_state.label) {
|
|
1005
|
+
case 0:
|
|
1006
|
+
currentStorage = getStorage();
|
|
1007
|
+
return [
|
|
1008
|
+
4,
|
|
1009
|
+
currentStorage.clear()
|
|
1010
|
+
];
|
|
1011
|
+
case 1:
|
|
1012
|
+
_state.sent();
|
|
1013
|
+
storage = void 0;
|
|
1014
|
+
ongoingRevalidations.clear();
|
|
1015
|
+
return [
|
|
1016
|
+
2
|
|
1017
|
+
];
|
|
1018
|
+
}
|
|
1019
|
+
});
|
|
1020
|
+
});
|
|
1021
|
+
return _clearStore.apply(this, arguments);
|
|
432
1022
|
}
|
|
433
1023
|
export {
|
|
434
1024
|
CacheSize,
|