@fjell/cache 4.6.10 → 4.6.13
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 +96 -0
- package/dist/Aggregator.cjs.js +26 -20
- package/dist/Aggregator.d.ts +17 -1
- package/dist/Aggregator.es.js +26 -20
- package/dist/Cache.cjs.js +22 -345
- package/dist/Cache.d.ts +25 -20
- package/dist/Cache.es.js +22 -346
- package/dist/Instance.cjs.js +7 -11
- package/dist/Instance.d.ts +5 -8
- package/dist/Instance.es.js +6 -10
- package/dist/InstanceFactory.cjs.js +17 -5
- package/dist/InstanceFactory.d.ts +3 -3
- package/dist/InstanceFactory.es.js +17 -5
- package/dist/Operations.cjs.js +43 -0
- package/dist/Operations.d.ts +70 -0
- package/dist/Operations.es.js +39 -0
- package/dist/index.cjs +416 -369
- package/dist/index.cjs.js +4 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +3 -2
- package/dist/ops/action.cjs.js +28 -0
- package/dist/ops/action.d.ts +4 -0
- package/dist/ops/action.es.js +24 -0
- package/dist/ops/all.cjs.js +33 -0
- package/dist/ops/all.d.ts +4 -0
- package/dist/ops/all.es.js +29 -0
- package/dist/ops/allAction.cjs.js +35 -0
- package/dist/ops/allAction.d.ts +4 -0
- package/dist/ops/allAction.es.js +31 -0
- package/dist/ops/allFacet.cjs.js +22 -0
- package/dist/ops/allFacet.d.ts +4 -0
- package/dist/ops/allFacet.es.js +18 -0
- package/dist/ops/create.cjs.js +23 -0
- package/dist/ops/create.d.ts +4 -0
- package/dist/ops/create.es.js +19 -0
- package/dist/ops/facet.cjs.js +21 -0
- package/dist/ops/facet.d.ts +4 -0
- package/dist/ops/facet.es.js +17 -0
- package/dist/ops/find.cjs.js +26 -0
- package/dist/ops/find.d.ts +4 -0
- package/dist/ops/find.es.js +22 -0
- package/dist/ops/findOne.cjs.js +24 -0
- package/dist/ops/findOne.d.ts +4 -0
- package/dist/ops/findOne.es.js +20 -0
- package/dist/ops/get.cjs.js +38 -0
- package/dist/ops/get.d.ts +4 -0
- package/dist/ops/get.es.js +34 -0
- package/dist/ops/one.cjs.js +33 -0
- package/dist/ops/one.d.ts +4 -0
- package/dist/ops/one.es.js +29 -0
- package/dist/ops/remove.cjs.js +30 -0
- package/dist/ops/remove.d.ts +4 -0
- package/dist/ops/remove.es.js +26 -0
- package/dist/ops/reset.cjs.js +15 -0
- package/dist/ops/reset.d.ts +4 -0
- package/dist/ops/reset.es.js +11 -0
- package/dist/ops/retrieve.cjs.js +37 -0
- package/dist/ops/retrieve.d.ts +4 -0
- package/dist/ops/retrieve.es.js +33 -0
- package/dist/ops/set.cjs.js +71 -0
- package/dist/ops/set.d.ts +3 -0
- package/dist/ops/set.es.js +67 -0
- package/dist/ops/update.cjs.js +34 -0
- package/dist/ops/update.d.ts +4 -0
- package/dist/ops/update.es.js +30 -0
- package/docs/docs.config.ts +75 -0
- package/docs/index.html +18 -0
- package/docs/package.json +34 -0
- package/docs/public/README.md +96 -0
- package/docs/public/examples-README.md +302 -0
- package/docs/public/test.txt +0 -0
- package/docs/src/index.css +3 -0
- package/docs/src/main.tsx +12 -0
- package/docs/src/test/setup.ts +1 -0
- package/docs/tsconfig.node.json +15 -0
- package/examples/README.md +34 -39
- package/examples/aggregator-example.ts +9 -14
- package/examples/basic-cache-example.ts +18 -21
- package/package.json +16 -11
- package/vitest.config.ts +1 -1
package/dist/Cache.cjs.js
CHANGED
|
@@ -2,357 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const core = require('@fjell/core');
|
|
6
5
|
const CacheMap = require('./CacheMap.cjs.js');
|
|
6
|
+
const Operations = require('./Operations.cjs.js');
|
|
7
7
|
const logger$1 = require('./logger.cjs.js');
|
|
8
|
-
const httpApi = require('@fjell/http-api');
|
|
9
8
|
|
|
10
9
|
const logger = logger$1.default.get('Cache');
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// Helper function to normalize a key
|
|
23
|
-
const normalizeKey = (key)=>{
|
|
24
|
-
if (typeof key === 'object' && key !== null) {
|
|
25
|
-
const normalizedKey = JSON.parse(JSON.stringify(key));
|
|
26
|
-
// Normalize pk values
|
|
27
|
-
if ('pk' in normalizedKey && normalizedKey.pk !== null) {
|
|
28
|
-
normalizedKey.pk = normalizeKeyValue(normalizedKey.pk);
|
|
29
|
-
}
|
|
30
|
-
// Normalize lk values
|
|
31
|
-
if ('lk' in normalizedKey && normalizedKey.lk !== null) {
|
|
32
|
-
normalizedKey.lk = normalizeKeyValue(normalizedKey.lk);
|
|
33
|
-
}
|
|
34
|
-
// Normalize loc array lk values
|
|
35
|
-
if ('loc' in normalizedKey && Array.isArray(normalizedKey.loc)) {
|
|
36
|
-
normalizedKey.loc = normalizedKey.loc.map((locItem)=>{
|
|
37
|
-
if (locItem && 'lk' in locItem && locItem.lk !== null) {
|
|
38
|
-
return {
|
|
39
|
-
...locItem,
|
|
40
|
-
lk: normalizeKeyValue(locItem.lk)
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
return locItem;
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
return normalizedKey;
|
|
47
|
-
}
|
|
48
|
-
return key;
|
|
49
|
-
};
|
|
50
|
-
const createCache = async (api, pkType, parentCache)=>{
|
|
51
|
-
let pkTypes = [
|
|
52
|
-
pkType
|
|
53
|
-
];
|
|
54
|
-
if (parentCache) {
|
|
55
|
-
pkTypes = pkTypes.concat(parentCache.pkTypes);
|
|
56
|
-
}
|
|
57
|
-
let cacheMap = new CacheMap.CacheMap(pkTypes);
|
|
58
|
-
const all = async (query = {}, locations = [])=>{
|
|
59
|
-
logger.default('all', {
|
|
60
|
-
query,
|
|
61
|
-
locations
|
|
62
|
-
});
|
|
63
|
-
let ret = [];
|
|
64
|
-
try {
|
|
65
|
-
ret = await api.all(query, locations);
|
|
66
|
-
ret.forEach((v)=>{
|
|
67
|
-
cacheMap.set(v.key, v);
|
|
68
|
-
});
|
|
69
|
-
} catch (e) {
|
|
70
|
-
if (e instanceof httpApi.NotFoundError) ; else {
|
|
71
|
-
throw e;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return [
|
|
75
|
-
cacheMap,
|
|
76
|
-
core.validatePK(ret, pkType)
|
|
77
|
-
];
|
|
78
|
-
};
|
|
79
|
-
const one = async (query = {}, locations = [])=>{
|
|
80
|
-
logger.default('one', {
|
|
81
|
-
query,
|
|
82
|
-
locations
|
|
83
|
-
});
|
|
84
|
-
let retItem = null;
|
|
85
|
-
try {
|
|
86
|
-
retItem = await api.one(query, locations);
|
|
87
|
-
if (retItem) {
|
|
88
|
-
cacheMap.set(retItem.key, retItem);
|
|
89
|
-
}
|
|
90
|
-
} catch (e) {
|
|
91
|
-
if (e instanceof httpApi.NotFoundError) ; else {
|
|
92
|
-
throw e;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return [
|
|
96
|
-
cacheMap,
|
|
97
|
-
retItem ? core.validatePK(retItem, pkType) : null
|
|
98
|
-
];
|
|
99
|
-
};
|
|
100
|
-
const action = async (key, action, body = {})=>{
|
|
101
|
-
logger.default('action', {
|
|
102
|
-
key,
|
|
103
|
-
action,
|
|
104
|
-
body
|
|
105
|
-
});
|
|
106
|
-
// TODO: This is validating the key, but it doesn't have knowledge of the pkType
|
|
107
|
-
// This should be looking at the parentCaches and calculating an array of pkTypes
|
|
108
|
-
if (!core.isValidItemKey(key)) {
|
|
109
|
-
logger.error('Key for Action is not a valid ItemKey: %j', key);
|
|
110
|
-
throw new Error('Key for Action is not a valid ItemKey');
|
|
111
|
-
}
|
|
112
|
-
const updated = await api.action(key, action, body);
|
|
113
|
-
cacheMap.set(updated.key, updated);
|
|
114
|
-
return [
|
|
115
|
-
cacheMap,
|
|
116
|
-
core.validatePK(updated, pkType)
|
|
117
|
-
];
|
|
118
|
-
};
|
|
119
|
-
const allAction = async (action, body = {}, locations = [])=>{
|
|
120
|
-
logger.default('allAction', {
|
|
121
|
-
action,
|
|
122
|
-
body,
|
|
123
|
-
locations
|
|
124
|
-
});
|
|
125
|
-
let ret = [];
|
|
126
|
-
try {
|
|
127
|
-
ret = await api.allAction(action, body, locations);
|
|
128
|
-
ret.forEach((v)=>{
|
|
129
|
-
cacheMap.set(v.key, v);
|
|
130
|
-
});
|
|
131
|
-
} catch (e) {
|
|
132
|
-
// istanbul ignore next
|
|
133
|
-
if (e instanceof httpApi.NotFoundError) ; else {
|
|
134
|
-
throw e;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return [
|
|
138
|
-
cacheMap,
|
|
139
|
-
core.validatePK(ret, pkType)
|
|
140
|
-
];
|
|
141
|
-
};
|
|
142
|
-
const allFacet = async (facet, params = {}, locations = [])=>{
|
|
143
|
-
logger.default('allFacet', {
|
|
144
|
-
facet,
|
|
145
|
-
params,
|
|
146
|
-
locations
|
|
147
|
-
});
|
|
148
|
-
const ret = await api.allFacet(facet, params, locations);
|
|
149
|
-
return [
|
|
150
|
-
cacheMap,
|
|
151
|
-
ret
|
|
152
|
-
];
|
|
153
|
-
};
|
|
154
|
-
const create = async (v, locations = [])=>{
|
|
155
|
-
logger.default('create', {
|
|
156
|
-
v,
|
|
157
|
-
locations
|
|
158
|
-
});
|
|
159
|
-
const created = await api.create(v, locations);
|
|
160
|
-
cacheMap.set(created.key, created);
|
|
161
|
-
return [
|
|
162
|
-
cacheMap,
|
|
163
|
-
core.validatePK(created, pkType)
|
|
164
|
-
];
|
|
165
|
-
};
|
|
166
|
-
const get = async (key)=>{
|
|
167
|
-
logger.default('get', {
|
|
168
|
-
key
|
|
169
|
-
});
|
|
170
|
-
// TODO: This is validating the key, but it doesn't have knowledge of the pkType
|
|
171
|
-
// This should be looking at the parentCaches and calculating an array of pkTypes
|
|
172
|
-
if (!core.isValidItemKey(key)) {
|
|
173
|
-
logger.error('Key for Get is not a valid ItemKey: %j', key);
|
|
174
|
-
throw new Error('Key for Get is not a valid ItemKey');
|
|
175
|
-
}
|
|
176
|
-
let ret;
|
|
177
|
-
try {
|
|
178
|
-
ret = await api.get(key);
|
|
179
|
-
if (ret) {
|
|
180
|
-
cacheMap.set(ret.key, ret);
|
|
181
|
-
}
|
|
182
|
-
} catch (e) {
|
|
183
|
-
logger.error("Error getting item for key", {
|
|
184
|
-
key,
|
|
185
|
-
message: e.message,
|
|
186
|
-
stack: e.stack
|
|
187
|
-
});
|
|
188
|
-
throw e;
|
|
189
|
-
}
|
|
190
|
-
return [
|
|
191
|
-
cacheMap,
|
|
192
|
-
ret ? core.validatePK(ret, pkType) : null
|
|
193
|
-
];
|
|
194
|
-
};
|
|
195
|
-
const retrieve = async (key)=>{
|
|
196
|
-
logger.default('retrieve', {
|
|
197
|
-
key
|
|
198
|
-
});
|
|
199
|
-
if (!core.isValidItemKey(key)) {
|
|
200
|
-
logger.error('Key for Retrieve is not a valid ItemKey: %j', key);
|
|
201
|
-
throw new Error('Key for Retrieve is not a valid ItemKey');
|
|
202
|
-
}
|
|
203
|
-
const containsItemKey = cacheMap.includesKey(key);
|
|
204
|
-
let retrieved;
|
|
205
|
-
if (containsItemKey) {
|
|
206
|
-
logger.default('Looking for Object in Cache', key);
|
|
207
|
-
retrieved = cacheMap.get(key);
|
|
208
|
-
} else {
|
|
209
|
-
logger.default('Object Not Found in Cache, Retrieving from Server API', {
|
|
210
|
-
key
|
|
211
|
-
});
|
|
212
|
-
[, retrieved] = await get(key);
|
|
213
|
-
}
|
|
214
|
-
const retValue = [
|
|
215
|
-
containsItemKey ? null : cacheMap,
|
|
216
|
-
retrieved ? core.validatePK(retrieved, pkType) : null
|
|
217
|
-
];
|
|
218
|
-
// logger.debug('Returning from retrieve', { retValue });
|
|
219
|
-
return retValue;
|
|
220
|
-
};
|
|
221
|
-
const remove = async (key)=>{
|
|
222
|
-
logger.default('remove', {
|
|
223
|
-
key
|
|
224
|
-
});
|
|
225
|
-
// TODO: This is validating the key, but it doesn't have knowledge of the pkType
|
|
226
|
-
// This should be looking at the parentCaches and calculating an array of pkTypes
|
|
227
|
-
if (!core.isValidItemKey(key)) {
|
|
228
|
-
logger.error('Key for Remove is not a valid ItemKey: %j', key);
|
|
229
|
-
throw new Error('Key for Remove is not a valid ItemKey');
|
|
230
|
-
}
|
|
231
|
-
try {
|
|
232
|
-
await api.remove(key);
|
|
233
|
-
cacheMap.delete(key);
|
|
234
|
-
} catch (e) {
|
|
235
|
-
logger.error("Error deleting item", {
|
|
236
|
-
error: e
|
|
237
|
-
});
|
|
238
|
-
throw e;
|
|
239
|
-
}
|
|
240
|
-
return cacheMap;
|
|
241
|
-
};
|
|
242
|
-
const update = async (key, v)=>{
|
|
243
|
-
logger.default('update', {
|
|
244
|
-
key,
|
|
245
|
-
v
|
|
246
|
-
});
|
|
247
|
-
// TODO: This is validating the key, but it doesn't have knowledge of the pkType
|
|
248
|
-
// This should be looking at the parentCaches and calculating an array of pkTypes
|
|
249
|
-
if (!core.isValidItemKey(key)) {
|
|
250
|
-
logger.error('Key for Update is not a valid ItemKey: %j', key);
|
|
251
|
-
throw new Error('Key for Update is not a valid ItemKey');
|
|
252
|
-
}
|
|
253
|
-
try {
|
|
254
|
-
const updated = await api.update(key, v);
|
|
255
|
-
cacheMap.set(updated.key, updated);
|
|
256
|
-
return [
|
|
257
|
-
cacheMap,
|
|
258
|
-
core.validatePK(updated, pkType)
|
|
259
|
-
];
|
|
260
|
-
} catch (e) {
|
|
261
|
-
logger.error("Error updating chat", {
|
|
262
|
-
error: e
|
|
263
|
-
});
|
|
264
|
-
throw e;
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
// Facets are a pass-thru for caches
|
|
268
|
-
const facet = async (key, facet, params = {})=>{
|
|
269
|
-
logger.default('facet', {
|
|
270
|
-
key,
|
|
271
|
-
facet
|
|
272
|
-
});
|
|
273
|
-
const ret = await api.facet(key, facet, params);
|
|
274
|
-
return [
|
|
275
|
-
cacheMap,
|
|
276
|
-
ret
|
|
277
|
-
];
|
|
278
|
-
};
|
|
279
|
-
const find = async (finder, params = {}, locations = [])=>{
|
|
280
|
-
logger.default('find', {
|
|
281
|
-
finder,
|
|
282
|
-
params,
|
|
283
|
-
locations
|
|
284
|
-
});
|
|
285
|
-
const ret = await api.find(finder, params, locations);
|
|
286
|
-
ret.forEach((v)=>{
|
|
287
|
-
cacheMap.set(v.key, v);
|
|
288
|
-
});
|
|
289
|
-
return [
|
|
290
|
-
cacheMap,
|
|
291
|
-
core.validatePK(ret, pkType)
|
|
292
|
-
];
|
|
293
|
-
};
|
|
294
|
-
const findOne = async (finder, finderParams = {}, locations = [])=>{
|
|
295
|
-
logger.default('findOne', {
|
|
296
|
-
finder,
|
|
297
|
-
finderParams,
|
|
298
|
-
locations
|
|
299
|
-
});
|
|
300
|
-
const ret = await api.findOne(finder, finderParams, locations);
|
|
301
|
-
cacheMap.set(ret.key, ret);
|
|
302
|
-
return [
|
|
303
|
-
cacheMap,
|
|
304
|
-
core.validatePK(ret, pkType)
|
|
305
|
-
];
|
|
306
|
-
};
|
|
307
|
-
const reset = async ()=>{
|
|
308
|
-
cacheMap = new CacheMap.CacheMap(pkTypes);
|
|
309
|
-
return [
|
|
310
|
-
cacheMap
|
|
311
|
-
];
|
|
312
|
-
};
|
|
313
|
-
const set = async (key, v)=>{
|
|
314
|
-
logger.default('set', {
|
|
315
|
-
key,
|
|
316
|
-
v
|
|
317
|
-
});
|
|
318
|
-
// TODO: This is validating the key, but it doesn't have knowledge of the pkType
|
|
319
|
-
// This should be looking at the parentCaches and calculating an array of pkTypes
|
|
320
|
-
if (!core.isValidItemKey(key)) {
|
|
321
|
-
logger.error('Key for Update is not a valid ItemKey: %j', key);
|
|
322
|
-
throw new Error('Key for Update is not a valid ItemKey');
|
|
323
|
-
}
|
|
324
|
-
// TODO: This could be merged with the isValidItemKey check, later.
|
|
325
|
-
core.validatePK(v, pkType);
|
|
326
|
-
if (!isItemKeyEqualNormalized(key, v.key)) {
|
|
327
|
-
logger.error('Key does not match item key: %j != %j', key, v.key);
|
|
328
|
-
throw new Error('Key does not match item key');
|
|
329
|
-
}
|
|
330
|
-
cacheMap.set(key, v);
|
|
331
|
-
return [
|
|
332
|
-
cacheMap,
|
|
333
|
-
core.validatePK(v, pkType)
|
|
334
|
-
];
|
|
335
|
-
};
|
|
10
|
+
const createCache = async (api, coordinate, registry)=>{
|
|
11
|
+
logger.debug('createCache', {
|
|
12
|
+
coordinate,
|
|
13
|
+
registry
|
|
14
|
+
});
|
|
15
|
+
// Create the cache map using the coordinate's key type array
|
|
16
|
+
const cacheMap = new CacheMap.CacheMap(coordinate.kta);
|
|
17
|
+
// Get the primary key type from the coordinate
|
|
18
|
+
const pkType = coordinate.kta[0];
|
|
19
|
+
// Create operations
|
|
20
|
+
const operations = Operations.createOperations(api, coordinate, cacheMap, pkType);
|
|
336
21
|
return {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
create,
|
|
343
|
-
get,
|
|
344
|
-
retrieve,
|
|
345
|
-
remove,
|
|
346
|
-
update,
|
|
347
|
-
facet,
|
|
348
|
-
find,
|
|
349
|
-
findOne,
|
|
350
|
-
reset,
|
|
351
|
-
set,
|
|
352
|
-
pkTypes,
|
|
353
|
-
cacheMap
|
|
22
|
+
coordinate,
|
|
23
|
+
registry,
|
|
24
|
+
api,
|
|
25
|
+
cacheMap,
|
|
26
|
+
operations
|
|
354
27
|
};
|
|
355
28
|
};
|
|
29
|
+
const isCache = (cache)=>{
|
|
30
|
+
return cache !== null && typeof cache === 'object' && 'coordinate' in cache && 'registry' in cache && 'api' in cache && 'cacheMap' in cache && 'operations' in cache;
|
|
31
|
+
};
|
|
356
32
|
|
|
357
33
|
exports.createCache = createCache;
|
|
358
|
-
|
|
34
|
+
exports.isCache = isCache;
|
|
35
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ2FjaGUuY2pzLmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7In0=
|
package/dist/Cache.d.ts
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Item } from '@fjell/core';
|
|
2
|
+
import { Instance as BaseInstance, Coordinate, Registry } from '@fjell/registry';
|
|
3
3
|
import { ClientApi } from '@fjell/client-api';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
import { CacheMap } from './CacheMap';
|
|
5
|
+
import { Operations } from './Operations';
|
|
6
|
+
/**
|
|
7
|
+
* The Cache interface extends the base Instance from @fjell/registry and adds cache operations
|
|
8
|
+
* for interacting with cached data.
|
|
9
|
+
*
|
|
10
|
+
* The interface extends the base Instance (which provides coordinate and registry) with:
|
|
11
|
+
* - api: Provides methods for interacting with server API
|
|
12
|
+
* - cacheMap: Local cache storage for items
|
|
13
|
+
* - operations: All cache operations (get, set, all, etc.) that work with both cache and API
|
|
14
|
+
*
|
|
15
|
+
* @template V - The type of the data model item, extending Item
|
|
16
|
+
* @template S - The string literal type representing the model's key type
|
|
17
|
+
* @template L1-L5 - Optional string literal types for location hierarchy levels
|
|
18
|
+
*/
|
|
19
|
+
export interface Cache<V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> extends BaseInstance<S, L1, L2, L3, L4, L5> {
|
|
20
|
+
/** The API client for interacting with server endpoints */
|
|
21
|
+
api: ClientApi<V, S, L1, L2, L3, L4, L5>;
|
|
22
|
+
/** The cache map that stores cached items */
|
|
21
23
|
cacheMap: CacheMap<V, S, L1, L2, L3, L4, L5>;
|
|
24
|
+
/** All cache operations that work with both cache and API */
|
|
25
|
+
operations: Operations<V, S, L1, L2, L3, L4, L5>;
|
|
22
26
|
}
|
|
23
|
-
export declare const createCache: <V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(api: ClientApi<V, S, L1, L2, L3, L4, L5>,
|
|
27
|
+
export declare const createCache: <V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(api: ClientApi<V, S, L1, L2, L3, L4, L5>, coordinate: Coordinate<S, L1, L2, L3, L4, L5>, registry: Registry) => Promise<Cache<V, S, L1, L2, L3, L4, L5>>;
|
|
28
|
+
export declare const isCache: (cache: any) => cache is Cache<any, any, any, any, any, any, any>;
|