@fjell/cache 4.4.3 → 4.5.1
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/src/Aggregator.d.ts +19 -0
- package/dist/src/Aggregator.js +182 -0
- package/dist/src/Aggregator.js.map +1 -0
- package/dist/src/Cache.d.ts +7 -1
- package/dist/src/Cache.js +222 -1
- package/dist/src/Cache.js.map +1 -1
- package/dist/src/CacheRegistry.d.ts +2 -3
- package/dist/src/CacheRegistry.js +1 -1
- package/dist/src/CacheRegistry.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -10
- package/src/Aggregator.ts +289 -0
- package/src/Cache.ts +305 -2
- package/src/CacheRegistry.ts +3 -6
- package/dist/src/AItemAggregator.d.ts +0 -35
- package/dist/src/AItemAggregator.js +0 -163
- package/dist/src/AItemAggregator.js.map +0 -1
- package/dist/src/AItemCache.d.ts +0 -21
- package/dist/src/AItemCache.js +0 -189
- package/dist/src/AItemCache.js.map +0 -1
- package/dist/src/CItemCache.d.ts +0 -17
- package/dist/src/CItemCache.js +0 -58
- package/dist/src/CItemCache.js.map +0 -1
- package/dist/src/PItemCache.d.ts +0 -17
- package/dist/src/PItemCache.js +0 -50
- package/dist/src/PItemCache.js.map +0 -1
- package/dist/src/index.d.ts +0 -7
- package/dist/src/index.js +0 -7
- package/dist/src/index.js.map +0 -1
- package/src/AItemAggregator.ts +0 -251
- package/src/AItemCache.ts +0 -262
- package/src/CItemCache.ts +0 -117
- package/src/PItemCache.ts +0 -99
- package/src/index.ts +0 -10
package/src/PItemCache.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-undefined, max-params */
|
|
2
|
-
|
|
3
|
-
import { ClientApi } from "@fjell/client-api";
|
|
4
|
-
import { Item, ItemQuery, PriKey, TypesProperties } from "@fjell/core";
|
|
5
|
-
import { AItemCache } from "./AItemCache";
|
|
6
|
-
import { CacheMap } from "./CacheMap";
|
|
7
|
-
import LibLogger from './logger';
|
|
8
|
-
|
|
9
|
-
const logger = LibLogger.get('PItemCache');
|
|
10
|
-
export class PItemCache<
|
|
11
|
-
V extends Item<S>,
|
|
12
|
-
S extends string
|
|
13
|
-
> extends AItemCache<V,S> {
|
|
14
|
-
|
|
15
|
-
public constructor(
|
|
16
|
-
cacheName: string,
|
|
17
|
-
api: ClientApi<V, S>,
|
|
18
|
-
pkType: S,
|
|
19
|
-
) {
|
|
20
|
-
super(cacheName, api, pkType);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public async all(
|
|
24
|
-
query: ItemQuery = {},
|
|
25
|
-
):
|
|
26
|
-
Promise<[CacheMap<V, S>, V[]]> {
|
|
27
|
-
logger.default('all', { query });
|
|
28
|
-
return await super.all(query) as [CacheMap<V, S>, V[]];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public async one(
|
|
32
|
-
query: ItemQuery = {},
|
|
33
|
-
):
|
|
34
|
-
Promise<[CacheMap<V, S>, V | null]> {
|
|
35
|
-
logger.default('one', { query });
|
|
36
|
-
return await super.one(query) as [CacheMap<V, S>, V | null];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
public async action(
|
|
40
|
-
key: PriKey<S>,
|
|
41
|
-
action: string,
|
|
42
|
-
body: any = {}
|
|
43
|
-
): Promise<[CacheMap<V, S>, V]> {
|
|
44
|
-
logger.default('action', { key, action, body });
|
|
45
|
-
return await super.action(key, action, body) as [CacheMap<V, S>, V];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
public async allAction(
|
|
49
|
-
action: string,
|
|
50
|
-
body: any = {}
|
|
51
|
-
): Promise<[CacheMap<V, S>, V[]]> {
|
|
52
|
-
logger.default('action', { action, body });
|
|
53
|
-
return await super.allAction(action, body) as [CacheMap<V, S>, V[]];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
public async create(
|
|
57
|
-
v: TypesProperties<V, S, never, never, never, never, never>,
|
|
58
|
-
): Promise<[CacheMap<V, S>, V]> {
|
|
59
|
-
logger.default('create', { v });
|
|
60
|
-
return await super.create(v) as [CacheMap<V, S>, V];
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public async get(key: PriKey<S>,
|
|
64
|
-
): Promise<[CacheMap<V, S>, V | null]> {
|
|
65
|
-
logger.default('get', { key });
|
|
66
|
-
return await super.get(key) as [CacheMap<V, S>, V | null];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
public async retrieve(
|
|
70
|
-
key: PriKey<S>,
|
|
71
|
-
): Promise<[CacheMap<V, S> | null, V | null]> {
|
|
72
|
-
logger.default('retrieve', { key });
|
|
73
|
-
return await super.retrieve(key) as [CacheMap<V, S> | null, V | null];
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
public async remove(
|
|
77
|
-
key: PriKey<S>
|
|
78
|
-
): Promise<CacheMap<V, S>> {
|
|
79
|
-
logger.default('remove', { key });
|
|
80
|
-
return await super.remove(key) as CacheMap<V, S>;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
public async update(
|
|
84
|
-
key: PriKey<S>,
|
|
85
|
-
v: TypesProperties<V, S>
|
|
86
|
-
): Promise<[CacheMap<V, S>, V]> {
|
|
87
|
-
logger.default('update', { key, v });
|
|
88
|
-
return await super.update(key, v) as [CacheMap<V, S>, V];
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
public async find(
|
|
92
|
-
finder: string,
|
|
93
|
-
finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
|
|
94
|
-
): Promise<[CacheMap<V, S>, V[]]> {
|
|
95
|
-
logger.default('find', { finder, finderParams });
|
|
96
|
-
return await super.find(finder, finderParams) as [CacheMap<V, S>, V[]];
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export { Cache } from "./Cache";
|
|
3
|
-
export { CacheMap } from "./CacheMap";
|
|
4
|
-
export { CacheRegistry } from "./CacheRegistry";
|
|
5
|
-
|
|
6
|
-
export { AggregateConfig, AItemAggregator } from "./AItemAggregator";
|
|
7
|
-
|
|
8
|
-
export { AItemCache } from "./AItemCache";
|
|
9
|
-
export { CItemCache } from "./CItemCache";
|
|
10
|
-
export { PItemCache } from "./PItemCache";
|