@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
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-undefined, max-params */
|
|
2
|
-
import LibLogger from "./logger";
|
|
3
|
-
export const toCacheConfig = (config) => {
|
|
4
|
-
let cacheConfig;
|
|
5
|
-
if (config.optional === undefined) {
|
|
6
|
-
cacheConfig = { cache: config, optional: false };
|
|
7
|
-
}
|
|
8
|
-
else {
|
|
9
|
-
cacheConfig = config;
|
|
10
|
-
}
|
|
11
|
-
return cacheConfig;
|
|
12
|
-
};
|
|
13
|
-
export class AItemAggregator {
|
|
14
|
-
cache;
|
|
15
|
-
logger;
|
|
16
|
-
aggregates = {};
|
|
17
|
-
events = {};
|
|
18
|
-
constructor(cache, { aggregates = {}, events = {} }) {
|
|
19
|
-
this.cache = cache;
|
|
20
|
-
this.aggregates = aggregates;
|
|
21
|
-
this.events = events;
|
|
22
|
-
// istanbul ignore next
|
|
23
|
-
this.logger = LibLogger.get("AItemAggregator", ...aggregates ? Object.keys(aggregates) : []);
|
|
24
|
-
}
|
|
25
|
-
async populate(item) {
|
|
26
|
-
this.logger.default('populate', { item });
|
|
27
|
-
for (const key in this.aggregates) {
|
|
28
|
-
await this.populateAggregate(key, item);
|
|
29
|
-
}
|
|
30
|
-
for (const key in this.events) {
|
|
31
|
-
await this.populateEvent(key, item);
|
|
32
|
-
}
|
|
33
|
-
this.logger.default('populate done', { item });
|
|
34
|
-
return item;
|
|
35
|
-
}
|
|
36
|
-
async populateAggregate(key, item) {
|
|
37
|
-
this.logger.default('populate aggregate key', { key });
|
|
38
|
-
const cacheConfig = toCacheConfig(this.aggregates[key]);
|
|
39
|
-
if (item.refs === undefined) {
|
|
40
|
-
if (cacheConfig.optional === false) {
|
|
41
|
-
this.logger.error('Item does not have refs an is not optional ' + JSON.stringify(item));
|
|
42
|
-
throw new Error('Item does not have refs an is not optional ' + JSON.stringify(item));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
else if (item.refs[key] === undefined) {
|
|
46
|
-
if (cacheConfig.optional === false) {
|
|
47
|
-
this.logger.error('Item does not have mandatory ref with key, not optional ' +
|
|
48
|
-
key + ' ' + JSON.stringify(item));
|
|
49
|
-
throw new Error('Item does not have mandatory ref with key, not optional ' +
|
|
50
|
-
key + ' ' + JSON.stringify(item));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
const ref = item.refs[key];
|
|
55
|
-
this.logger.default('AGG Retrieving Item in Populate', { key: ref });
|
|
56
|
-
const [, newItem] = await cacheConfig.cache.retrieve(ref);
|
|
57
|
-
if (newItem) {
|
|
58
|
-
if (item.aggs === undefined) {
|
|
59
|
-
item.aggs = {};
|
|
60
|
-
}
|
|
61
|
-
item.aggs[key] = {
|
|
62
|
-
key: ref,
|
|
63
|
-
item: newItem,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
// TODO: I'm not a big fan that this just "automatically" assumes that the "by" key in event is a ref.
|
|
69
|
-
async populateEvent(key, item) {
|
|
70
|
-
this.logger.default('populate event key', { key });
|
|
71
|
-
const cacheConfig = toCacheConfig(this.events[key]);
|
|
72
|
-
if (item.events === undefined) {
|
|
73
|
-
throw new Error('Item does not have events ' + JSON.stringify(item));
|
|
74
|
-
}
|
|
75
|
-
else if (item.events[key] === undefined) {
|
|
76
|
-
if (cacheConfig.optional === false) {
|
|
77
|
-
this.logger.error('Item does not have mandatory event with key ' + key + ' ' + JSON.stringify(item));
|
|
78
|
-
throw new Error('Item does not have mandatory event with key ' + key + ' ' + JSON.stringify(item));
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
const event = item.events[key];
|
|
83
|
-
if (event.by === undefined) {
|
|
84
|
-
this.logger.error('populateEvent with an Event that does not have by', { event, ik: item.key, eventKey: key });
|
|
85
|
-
throw new Error('populateEvent with an Event that does not have by: ' + JSON.stringify({ key, event }));
|
|
86
|
-
}
|
|
87
|
-
this.logger.default('EVENT Retrieving Item in Populate', { key: event.by });
|
|
88
|
-
const [, newItem] = await cacheConfig.cache.retrieve(event.by);
|
|
89
|
-
if (newItem) {
|
|
90
|
-
event.agg = newItem;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
async all(query = {}, locations = []) {
|
|
95
|
-
this.logger.default('all', { query, locations });
|
|
96
|
-
const [cacheMap, items] = await this.cache.all(query, locations);
|
|
97
|
-
const populatedItems = await Promise.all(items.map(async (item) => this.populate(item)));
|
|
98
|
-
return [cacheMap, populatedItems];
|
|
99
|
-
}
|
|
100
|
-
async one(query = {}, locations = []) {
|
|
101
|
-
this.logger.default('one', { query, locations });
|
|
102
|
-
const [cacheMap, item] = await this.cache.one(query, locations);
|
|
103
|
-
let populatedItem = null;
|
|
104
|
-
if (item) {
|
|
105
|
-
populatedItem = await this.populate(item);
|
|
106
|
-
}
|
|
107
|
-
return [cacheMap, populatedItem];
|
|
108
|
-
}
|
|
109
|
-
async action(key, action, body = {}) {
|
|
110
|
-
this.logger.default('action', { key, action, body });
|
|
111
|
-
const [cacheMap, item] = await this.cache.action(key, action, body);
|
|
112
|
-
const populatedItem = await this.populate(item);
|
|
113
|
-
return [cacheMap, populatedItem];
|
|
114
|
-
}
|
|
115
|
-
async allAction(action, body = {}, locations = []) {
|
|
116
|
-
this.logger.default('action', { action, body, locations });
|
|
117
|
-
const [cacheMap, items] = await this.cache.allAction(action, body, locations);
|
|
118
|
-
const populatedItems = await Promise.all(items.map(async (item) => this.populate(item)));
|
|
119
|
-
return [cacheMap, populatedItems];
|
|
120
|
-
}
|
|
121
|
-
async create(v, locations = []) {
|
|
122
|
-
this.logger.default('create', { v, locations });
|
|
123
|
-
const [cacheMap, item] = await this.cache.create(v, locations);
|
|
124
|
-
const populatedItem = await this.populate(item);
|
|
125
|
-
return [cacheMap, populatedItem];
|
|
126
|
-
}
|
|
127
|
-
async get(key) {
|
|
128
|
-
this.logger.default('get', { key });
|
|
129
|
-
const [cacheMap, item] = await this.cache.get(key);
|
|
130
|
-
let populatedItem = null;
|
|
131
|
-
if (item) {
|
|
132
|
-
populatedItem = await this.populate(item);
|
|
133
|
-
}
|
|
134
|
-
return [cacheMap, populatedItem];
|
|
135
|
-
}
|
|
136
|
-
async retrieve(key) {
|
|
137
|
-
this.logger.default('retrieve', { key });
|
|
138
|
-
const [cacheMap, item] = await this.cache.retrieve(key);
|
|
139
|
-
let populatedItem = null;
|
|
140
|
-
if (item) {
|
|
141
|
-
populatedItem = await this.populate(item);
|
|
142
|
-
}
|
|
143
|
-
return [cacheMap, populatedItem];
|
|
144
|
-
}
|
|
145
|
-
async remove(key) {
|
|
146
|
-
this.logger.default('remove', { key });
|
|
147
|
-
const cacheMap = await this.cache.remove(key);
|
|
148
|
-
return cacheMap;
|
|
149
|
-
}
|
|
150
|
-
async update(key, v) {
|
|
151
|
-
this.logger.default('update', { key, v });
|
|
152
|
-
const [cacheMap, item] = await this.cache.update(key, v);
|
|
153
|
-
const populatedItem = await this.populate(item);
|
|
154
|
-
return [cacheMap, populatedItem];
|
|
155
|
-
}
|
|
156
|
-
async find(finder, finderParams, locations = []) {
|
|
157
|
-
this.logger.default('find', { finder, finderParams, locations });
|
|
158
|
-
const [cacheMap, items] = await this.cache.find(finder, finderParams, locations);
|
|
159
|
-
const populatedItems = await Promise.all(items.map(async (item) => this.populate(item)));
|
|
160
|
-
return [cacheMap, populatedItems];
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
//# sourceMappingURL=AItemAggregator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AItemAggregator.js","sourceRoot":"","sources":["../../src/AItemAggregator.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAa7C,OAAO,SAAS,MAAM,UAAU,CAAC;AAMjC,MAAM,CAAC,MAAM,aAAa,GAAG,CAQ3B,MAAqD,EAAe,EAAE;IACtE,IAAI,WAAwB,CAAC;IAC7B,IAAK,MAAsB,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACnD,WAAW,GAAG,EAAE,KAAK,EAAE,MAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC1D,CAAC;SAAM,CAAC;QACN,WAAW,GAAG,MAAqB,CAAC;IACtC,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC,CAAA;AAED,MAAM,OAAO,eAAe;IAUlB,KAAK,CAAuC;IAC5C,MAAM,CAAC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"@fjell/client-api";
|
|
2
|
-
import { AItemService, ComKey, Item, ItemQuery, LocKeyArray, PriKey, TypesProperties } from "@fjell/core";
|
|
3
|
-
import { Cache } from "./Cache";
|
|
4
|
-
import { CacheMap } from "./CacheMap";
|
|
5
|
-
export declare class AItemCache<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 AItemService<S, L1, L2, L3, L4, L5> implements Cache<V, S, L1, L2, L3, L4, L5> {
|
|
6
|
-
protected cacheName: string;
|
|
7
|
-
protected api: ClientApi<V, S, L1, L2, L3, L4, L5>;
|
|
8
|
-
cacheMap: CacheMap<V, S, L1, L2, L3, L4, L5>;
|
|
9
|
-
constructor(cacheName: string, api: ClientApi<V, S, L1, L2, L3, L4, L5>, pkType: S, parentCache?: AItemCache<Item<L1, L2, L3, L4, L5>, L1, L2, L3, L4, L5>);
|
|
10
|
-
all(query?: ItemQuery, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V[]]>;
|
|
11
|
-
one(query?: ItemQuery, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V | null]>;
|
|
12
|
-
action(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, action: string, body?: any): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
|
|
13
|
-
allAction(action: string, body?: any, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V[]]>;
|
|
14
|
-
create(v: TypesProperties<V, S, L1, L2, L3, L4, L5>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
|
|
15
|
-
get(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V | null]>;
|
|
16
|
-
retrieve(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5> | null, V | null]>;
|
|
17
|
-
remove(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>): Promise<CacheMap<V, S, L1, L2, L3, L4, L5>>;
|
|
18
|
-
update(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, v: TypesProperties<V, S, L1, L2, L3, L4, L5>): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
|
|
19
|
-
find(finder: string, finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V[]]>;
|
|
20
|
-
loadCache: (cache: CacheMap<V, S, L1, L2, L3, L4, L5>) => Promise<void>;
|
|
21
|
-
}
|
package/dist/src/AItemCache.js
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-undefined, max-params */
|
|
2
|
-
import { AItemService, isValidItemKey, validatePK } from "@fjell/core";
|
|
3
|
-
import { NotFoundError } from "@fjell/http-api";
|
|
4
|
-
import { CacheMap } from "./CacheMap";
|
|
5
|
-
import LibLogger from "./logger";
|
|
6
|
-
const logger = LibLogger.get('AItemCache');
|
|
7
|
-
export class AItemCache extends AItemService {
|
|
8
|
-
cacheName;
|
|
9
|
-
api;
|
|
10
|
-
cacheMap;
|
|
11
|
-
constructor(cacheName, api, pkType, parentCache) {
|
|
12
|
-
super(pkType, parentCache);
|
|
13
|
-
this.cacheName = cacheName;
|
|
14
|
-
this.api = api;
|
|
15
|
-
// TODO: I wonder if this is even going to work - can you access an instance of a class in a constructor?
|
|
16
|
-
this.cacheMap =
|
|
17
|
-
new CacheMap(this.getKeyTypes());
|
|
18
|
-
}
|
|
19
|
-
async all(query = {}, locations = []) {
|
|
20
|
-
logger.default('all', { query, locations });
|
|
21
|
-
let ret = [];
|
|
22
|
-
try {
|
|
23
|
-
ret = await this.api.all(query, {}, locations);
|
|
24
|
-
ret.forEach((v) => {
|
|
25
|
-
this.cacheMap.set(v.key, v);
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
catch (e) {
|
|
29
|
-
if (e instanceof NotFoundError) {
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
throw e;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return [this.cacheMap, validatePK(ret, this.getPkType())];
|
|
36
|
-
}
|
|
37
|
-
async one(query = {}, locations = []) {
|
|
38
|
-
logger.default('one', { query, locations });
|
|
39
|
-
let retItem = null;
|
|
40
|
-
try {
|
|
41
|
-
retItem = await this.api.one(query, {}, locations);
|
|
42
|
-
if (retItem) {
|
|
43
|
-
this.cacheMap.set(retItem.key, retItem);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
catch (e) {
|
|
47
|
-
if (e instanceof NotFoundError) {
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
throw e;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return [
|
|
54
|
-
this.cacheMap,
|
|
55
|
-
retItem ?
|
|
56
|
-
validatePK(retItem, this.getPkType()) :
|
|
57
|
-
null
|
|
58
|
-
];
|
|
59
|
-
}
|
|
60
|
-
async action(key, action, body = {}) {
|
|
61
|
-
logger.default('action', { key, action, body });
|
|
62
|
-
if (!isValidItemKey(key)) {
|
|
63
|
-
logger.error('Key for Action is not a valid ItemKey: %j', key);
|
|
64
|
-
throw new Error('Key for Action is not a valid ItemKey');
|
|
65
|
-
}
|
|
66
|
-
const updated = await this.api.action(key, action, body, {});
|
|
67
|
-
this.cacheMap.set(updated.key, updated);
|
|
68
|
-
return [this.cacheMap, validatePK(updated, this.getPkType())];
|
|
69
|
-
}
|
|
70
|
-
async allAction(action, body = {}, locations = []) {
|
|
71
|
-
logger.default('allAction', { action, body, locations });
|
|
72
|
-
let ret = [];
|
|
73
|
-
try {
|
|
74
|
-
ret = await this.api.allAction(action, body, {}, locations);
|
|
75
|
-
ret.forEach((v) => {
|
|
76
|
-
this.cacheMap.set(v.key, v);
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
catch (e) {
|
|
80
|
-
// istanbul ignore next
|
|
81
|
-
if (e instanceof NotFoundError) {
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
throw e;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return [this.cacheMap, validatePK(ret, this.getPkType())];
|
|
88
|
-
}
|
|
89
|
-
async create(v, locations = []) {
|
|
90
|
-
logger.default('create', { v, locations });
|
|
91
|
-
const created = await this.api.create(v, {}, locations);
|
|
92
|
-
this.cacheMap.set(created.key, created);
|
|
93
|
-
return [this.cacheMap, validatePK(created, this.getPkType())];
|
|
94
|
-
}
|
|
95
|
-
async get(key) {
|
|
96
|
-
logger.default('get', { key });
|
|
97
|
-
if (!isValidItemKey(key)) {
|
|
98
|
-
logger.error('Key for Get is not a valid ItemKey: %j', key);
|
|
99
|
-
throw new Error('Key for Get is not a valid ItemKey');
|
|
100
|
-
}
|
|
101
|
-
let ret;
|
|
102
|
-
try {
|
|
103
|
-
ret = await this.api.get(key, {});
|
|
104
|
-
if (ret) {
|
|
105
|
-
this.cacheMap.set(ret.key, ret);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
catch (e) {
|
|
109
|
-
logger.error("Error getting item for key", { key, message: e.message, stack: e.stack });
|
|
110
|
-
throw e;
|
|
111
|
-
}
|
|
112
|
-
return [
|
|
113
|
-
this.cacheMap,
|
|
114
|
-
ret ?
|
|
115
|
-
validatePK(ret, this.getPkType()) :
|
|
116
|
-
null
|
|
117
|
-
];
|
|
118
|
-
}
|
|
119
|
-
async retrieve(key) {
|
|
120
|
-
logger.default('retrieve', { key });
|
|
121
|
-
if (!isValidItemKey(key)) {
|
|
122
|
-
logger.error('Key for Retrieve is not a valid ItemKey: %j', key);
|
|
123
|
-
throw new Error('Key for Retrieve is not a valid ItemKey');
|
|
124
|
-
}
|
|
125
|
-
const containsItemKey = this.cacheMap.includesKey(key);
|
|
126
|
-
let retrieved;
|
|
127
|
-
if (containsItemKey) {
|
|
128
|
-
logger.default('Looking for Object in Cache', key);
|
|
129
|
-
retrieved = this.cacheMap.get(key);
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
logger.default('Object Not Found in Cache, Retrieving from Server API', { key });
|
|
133
|
-
[, retrieved] = await this.get(key);
|
|
134
|
-
}
|
|
135
|
-
const retValue = [
|
|
136
|
-
containsItemKey ? null : this.cacheMap,
|
|
137
|
-
retrieved ?
|
|
138
|
-
validatePK(retrieved, this.getPkType()) :
|
|
139
|
-
null
|
|
140
|
-
];
|
|
141
|
-
// logger.debug('Returning from retrieve', { retValue });
|
|
142
|
-
return retValue;
|
|
143
|
-
}
|
|
144
|
-
async remove(key) {
|
|
145
|
-
logger.default('remove', { key });
|
|
146
|
-
if (!isValidItemKey(key)) {
|
|
147
|
-
logger.error('Key for Remove is not a valid ItemKey: %j', key);
|
|
148
|
-
throw new Error('Key for Remove is not a valid ItemKey');
|
|
149
|
-
}
|
|
150
|
-
try {
|
|
151
|
-
await this.api.remove(key, {});
|
|
152
|
-
this.cacheMap.delete(key);
|
|
153
|
-
}
|
|
154
|
-
catch (e) {
|
|
155
|
-
logger.error("Error deleting item", { error: e });
|
|
156
|
-
throw e;
|
|
157
|
-
}
|
|
158
|
-
return this.cacheMap;
|
|
159
|
-
}
|
|
160
|
-
async update(key, v) {
|
|
161
|
-
logger.default('update', { key, v });
|
|
162
|
-
if (!isValidItemKey(key)) {
|
|
163
|
-
logger.error('Key for Update is not a valid ItemKey: %j', key);
|
|
164
|
-
throw new Error('Key for Update is not a valid ItemKey');
|
|
165
|
-
}
|
|
166
|
-
try {
|
|
167
|
-
const updated = await this.api.update(key, v, {});
|
|
168
|
-
// }
|
|
169
|
-
this.cacheMap.set(updated.key, updated);
|
|
170
|
-
return [this.cacheMap, validatePK(updated, this.getPkType())];
|
|
171
|
-
}
|
|
172
|
-
catch (e) {
|
|
173
|
-
logger.error("Error updating chat", { error: e });
|
|
174
|
-
throw e;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
async find(finder, finderParams, locations = []) {
|
|
178
|
-
logger.default('find', { finder, finderParams, locations });
|
|
179
|
-
const ret = await this.api.find(finder, finderParams, {}, locations);
|
|
180
|
-
ret.forEach((v) => {
|
|
181
|
-
this.cacheMap.set(v.key, v);
|
|
182
|
-
});
|
|
183
|
-
return [this.cacheMap, validatePK(ret, this.getPkType())];
|
|
184
|
-
}
|
|
185
|
-
loadCache = async (cache) => {
|
|
186
|
-
this.cacheMap = cache;
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
//# sourceMappingURL=AItemCache.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AItemCache.js","sourceRoot":"","sources":["../../src/AItemCache.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAG7C,OAAO,EACL,YAAY,EAEZ,cAAc,EAMd,UAAU,EACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,SAAS,MAAM,UAAU,CAAC;AAEjC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AAE3C,MAAM,OAAO,UAQX,SAAQ,YAAmC;IAEjC,SAAS,CAAS;IAClB,GAAG,CAAsC;IAE5C,QAAQ,CAAqC;IAEpD,YACE,SAAiB,EACjB,GAAwC,EACxC,MAAS,EACT,WAAsE;QAEtE,KAAK,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,yGAAyG;QACzG,IAAI,CAAC,QAAQ;YACX,IAAI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CAAC,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,CAAQ,CAAC,CAAC;IACnE,CAAC;IAEM,SAAS,GAAG,KAAK,EAAE,KAAyC,EAAE,EAAE;QACrE,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,CAAC,CAAA;CAEF"}
|
package/dist/src/CItemCache.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ClientApi } from "@fjell/client-api";
|
|
2
|
-
import { ComKey, Item, ItemQuery, LocKeyArray, PriKey, TypesProperties } from "@fjell/core";
|
|
3
|
-
import { AItemCache } from "./AItemCache";
|
|
4
|
-
import { CacheMap } from "./CacheMap";
|
|
5
|
-
export declare class CItemCache<V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> extends AItemCache<V, S, L1, L2, L3, L4, L5> {
|
|
6
|
-
constructor(cacheName: string, api: ClientApi<V, S, L1, L2, L3, L4, L5>, pkType: S, parentCache: AItemCache<Item<L1, L2, L3, L4, L5, never>, L1, L2, L3, L4, L5>);
|
|
7
|
-
all(query?: ItemQuery, locations?: LocKeyArray<L1, L2, L3, L4, L5>): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V[]]>;
|
|
8
|
-
one(query?: ItemQuery, locations?: LocKeyArray<L1, L2, L3, L4, L5>): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V | null]>;
|
|
9
|
-
action(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, action: string, body?: any): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
|
|
10
|
-
allAction(action: string, body?: any, locations?: LocKeyArray<L1, L2, L3, L4, L5>): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V[]]>;
|
|
11
|
-
create(v: TypesProperties<V, S, L1, L2, L3, L4, L5>, locations?: LocKeyArray<L1, L2, L3, L4, L5>): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
|
|
12
|
-
get(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V | null]>;
|
|
13
|
-
retrieve(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5> | null, V | null]>;
|
|
14
|
-
remove(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>): Promise<CacheMap<V, S, L1, L2, L3, L4, L5>>;
|
|
15
|
-
update(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, v: TypesProperties<V, S, L1, L2, L3, L4, L5>): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
|
|
16
|
-
find(finder: string, finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V[]]>;
|
|
17
|
-
}
|
package/dist/src/CItemCache.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { AItemCache } from "./AItemCache";
|
|
2
|
-
import LibLogger from "./logger";
|
|
3
|
-
const logger = LibLogger.get('CItemCache');
|
|
4
|
-
export class CItemCache extends AItemCache {
|
|
5
|
-
constructor(cacheName, api, pkType, parentCache) {
|
|
6
|
-
super(cacheName, api, pkType, parentCache);
|
|
7
|
-
}
|
|
8
|
-
// TODO: There's something annoying about these parameters. Location isn't option in a CItem, but query is.
|
|
9
|
-
async all(
|
|
10
|
-
// istanbul ignore next
|
|
11
|
-
query = {}, locations) {
|
|
12
|
-
logger.default('all', { query, locations });
|
|
13
|
-
return await super.all(query, locations);
|
|
14
|
-
}
|
|
15
|
-
// TODO: There's something annoying about these parameters. Location isn't option in a CItem, but query is.
|
|
16
|
-
async one(
|
|
17
|
-
// istanbul ignore next
|
|
18
|
-
query = {}, locations) {
|
|
19
|
-
logger.default('one', { query, locations });
|
|
20
|
-
return await super.one(query, locations);
|
|
21
|
-
}
|
|
22
|
-
async action(key, action, body = {}) {
|
|
23
|
-
logger.default('action', { key, action, body });
|
|
24
|
-
return await super.action(key, action, body);
|
|
25
|
-
}
|
|
26
|
-
// TODO: There's something annoying about these parameters. Location isn't option in a CItem, but query is.
|
|
27
|
-
async allAction(action,
|
|
28
|
-
// istanbul ignore next
|
|
29
|
-
body = {}, locations) {
|
|
30
|
-
logger.default('action', { action, body, locations });
|
|
31
|
-
return await super.allAction(action, body, locations);
|
|
32
|
-
}
|
|
33
|
-
async create(v, locations) {
|
|
34
|
-
logger.default('create', { v });
|
|
35
|
-
return await super.create(v, locations);
|
|
36
|
-
}
|
|
37
|
-
async get(key) {
|
|
38
|
-
logger.default('get', { key });
|
|
39
|
-
return await super.get(key);
|
|
40
|
-
}
|
|
41
|
-
async retrieve(key) {
|
|
42
|
-
logger.default('retrieve', { key });
|
|
43
|
-
return await super.retrieve(key);
|
|
44
|
-
}
|
|
45
|
-
async remove(key) {
|
|
46
|
-
logger.default('remove', { key });
|
|
47
|
-
return await super.remove(key);
|
|
48
|
-
}
|
|
49
|
-
async update(key, v) {
|
|
50
|
-
logger.default('update', { key, v });
|
|
51
|
-
return await super.update(key, v);
|
|
52
|
-
}
|
|
53
|
-
async find(finder, finderParams, locations = []) {
|
|
54
|
-
logger.default('find', { finder, finderParams, locations });
|
|
55
|
-
return await super.find(finder, finderParams, locations);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=CItemCache.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CItemCache.js","sourceRoot":"","sources":["../../src/CItemCache.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,SAAS,MAAM,UAAU,CAAC;AAEjC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,YAAY,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,EAAE,YAAY,EAAE,SAAS,CAA8C,CAAC;IACxG,CAAC;CAEF"}
|
package/dist/src/PItemCache.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ClientApi } from "@fjell/client-api";
|
|
2
|
-
import { Item, ItemQuery, PriKey, TypesProperties } from "@fjell/core";
|
|
3
|
-
import { AItemCache } from "./AItemCache";
|
|
4
|
-
import { CacheMap } from "./CacheMap";
|
|
5
|
-
export declare class PItemCache<V extends Item<S>, S extends string> extends AItemCache<V, S> {
|
|
6
|
-
constructor(cacheName: string, api: ClientApi<V, S>, pkType: S);
|
|
7
|
-
all(query?: ItemQuery): Promise<[CacheMap<V, S>, V[]]>;
|
|
8
|
-
one(query?: ItemQuery): Promise<[CacheMap<V, S>, V | null]>;
|
|
9
|
-
action(key: PriKey<S>, action: string, body?: any): Promise<[CacheMap<V, S>, V]>;
|
|
10
|
-
allAction(action: string, body?: any): Promise<[CacheMap<V, S>, V[]]>;
|
|
11
|
-
create(v: TypesProperties<V, S, never, never, never, never, never>): Promise<[CacheMap<V, S>, V]>;
|
|
12
|
-
get(key: PriKey<S>): Promise<[CacheMap<V, S>, V | null]>;
|
|
13
|
-
retrieve(key: PriKey<S>): Promise<[CacheMap<V, S> | null, V | null]>;
|
|
14
|
-
remove(key: PriKey<S>): Promise<CacheMap<V, S>>;
|
|
15
|
-
update(key: PriKey<S>, v: TypesProperties<V, S>): Promise<[CacheMap<V, S>, V]>;
|
|
16
|
-
find(finder: string, finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>): Promise<[CacheMap<V, S>, V[]]>;
|
|
17
|
-
}
|
package/dist/src/PItemCache.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-undefined, max-params */
|
|
2
|
-
import { AItemCache } from "./AItemCache";
|
|
3
|
-
import LibLogger from './logger';
|
|
4
|
-
const logger = LibLogger.get('PItemCache');
|
|
5
|
-
export class PItemCache extends AItemCache {
|
|
6
|
-
constructor(cacheName, api, pkType) {
|
|
7
|
-
super(cacheName, api, pkType);
|
|
8
|
-
}
|
|
9
|
-
async all(query = {}) {
|
|
10
|
-
logger.default('all', { query });
|
|
11
|
-
return await super.all(query);
|
|
12
|
-
}
|
|
13
|
-
async one(query = {}) {
|
|
14
|
-
logger.default('one', { query });
|
|
15
|
-
return await super.one(query);
|
|
16
|
-
}
|
|
17
|
-
async action(key, action, body = {}) {
|
|
18
|
-
logger.default('action', { key, action, body });
|
|
19
|
-
return await super.action(key, action, body);
|
|
20
|
-
}
|
|
21
|
-
async allAction(action, body = {}) {
|
|
22
|
-
logger.default('action', { action, body });
|
|
23
|
-
return await super.allAction(action, body);
|
|
24
|
-
}
|
|
25
|
-
async create(v) {
|
|
26
|
-
logger.default('create', { v });
|
|
27
|
-
return await super.create(v);
|
|
28
|
-
}
|
|
29
|
-
async get(key) {
|
|
30
|
-
logger.default('get', { key });
|
|
31
|
-
return await super.get(key);
|
|
32
|
-
}
|
|
33
|
-
async retrieve(key) {
|
|
34
|
-
logger.default('retrieve', { key });
|
|
35
|
-
return await super.retrieve(key);
|
|
36
|
-
}
|
|
37
|
-
async remove(key) {
|
|
38
|
-
logger.default('remove', { key });
|
|
39
|
-
return await super.remove(key);
|
|
40
|
-
}
|
|
41
|
-
async update(key, v) {
|
|
42
|
-
logger.default('update', { key, v });
|
|
43
|
-
return await super.update(key, v);
|
|
44
|
-
}
|
|
45
|
-
async find(finder, finderParams) {
|
|
46
|
-
logger.default('find', { finder, finderParams });
|
|
47
|
-
return await super.find(finder, finderParams);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=PItemCache.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PItemCache.js","sourceRoot":"","sources":["../../src/PItemCache.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAI7C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,SAAS,MAAM,UAAU,CA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AM,CAAC,CAAC,CAAwB,CAAC;IACtD,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,GAAc;QAE7B,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QAC/B,OAAO,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,CAA+B,CAAC;IAC5D,CAAC;IAEM,KAAK,CAAC,QAAQ,CACnB,GAAc;QAEd,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QACpC,OAAO,MAAM,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAsC,CAAC;IACxE,CAAC;IAEM,KAAK,CAAC,MAAM,CACjB,GAAc;QAEd,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QAClC,OAAO,MAAM,KAAK,CAAC,MAAM,CAAC,GAAG,CAAmB,CAAC;IACnD,CAAC;IAEM,KAAK,CAAC,MAAM,CACjB,GAAc,EACd,CAAwB;QAExB,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;QACrC,OAAO,MAAM,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAwB,CAAC;IAC3D,CAAC;IAEM,KAAK,CAAC,IAAI,CACf,MAAc,EACd,YAAwG;QAExG,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;QACjD,OAAO,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,CAA0B,CAAC;IACzE,CAAC;CAEF"}
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { Cache } from "./Cache";
|
|
2
|
-
export { CacheMap } from "./CacheMap";
|
|
3
|
-
export { CacheRegistry } from "./CacheRegistry";
|
|
4
|
-
export { AggregateConfig, AItemAggregator } from "./AItemAggregator";
|
|
5
|
-
export { AItemCache } from "./AItemCache";
|
|
6
|
-
export { CItemCache } from "./CItemCache";
|
|
7
|
-
export { PItemCache } from "./PItemCache";
|
package/dist/src/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { CacheMap } from "./CacheMap";
|
|
2
|
-
export { CacheRegistry } from "./CacheRegistry";
|
|
3
|
-
export { AItemAggregator } from "./AItemAggregator";
|
|
4
|
-
export { AItemCache } from "./AItemCache";
|
|
5
|
-
export { CItemCache } from "./CItemCache";
|
|
6
|
-
export { PItemCache } from "./PItemCache";
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAmB,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|