@fjell/cache 4.6.2 → 4.6.4

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.
@@ -3,8 +3,12 @@ model: gpt-4.1
3
3
  contextDirectories:
4
4
  - .kodrdriv/context
5
5
  commit:
6
+ add: true
6
7
  cached: true
7
8
  sendit: true
8
9
  release:
9
10
  from: main
10
11
  to: HEAD
12
+ publish:
13
+ mergeMethod: squash
14
+ dependencyUpdatePatterns: ["@fjell/*"]
package/commit.sh ADDED
@@ -0,0 +1,8 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ echo "Staging all changes..."
5
+ git add .
6
+
7
+ echo "Running kodrdriv commit..."
8
+ pnpm dlx @eldrforge/kodrdriv commit
@@ -161,6 +161,18 @@ const createAggregator = async (cache, { aggregates = {}, events = {} })=>{
161
161
  populatedItems
162
162
  ];
163
163
  };
164
+ const allFacet = async (facet, params = {}, locations = [])=>{
165
+ logger.default('allFacet', {
166
+ facet,
167
+ params,
168
+ locations
169
+ });
170
+ const [cacheMap, response] = await cache.allFacet(facet, params, locations);
171
+ return [
172
+ cacheMap,
173
+ response
174
+ ];
175
+ };
164
176
  const create = async (v, locations = [])=>{
165
177
  logger.default('create', {
166
178
  v,
@@ -232,7 +244,7 @@ const createAggregator = async (cache, { aggregates = {}, events = {} })=>{
232
244
  response
233
245
  ];
234
246
  };
235
- const find = async (finder, finderParams, locations = [])=>{
247
+ const find = async (finder, finderParams = {}, locations = [])=>{
236
248
  logger.default('find', {
237
249
  finder,
238
250
  finderParams,
@@ -245,7 +257,7 @@ const createAggregator = async (cache, { aggregates = {}, events = {} })=>{
245
257
  populatedItems
246
258
  ];
247
259
  };
248
- const findOne = async (finder, finderParams, locations = [])=>{
260
+ const findOne = async (finder, finderParams = {}, locations = [])=>{
249
261
  logger.default('find', {
250
262
  finder,
251
263
  finderParams,
@@ -280,6 +292,7 @@ const createAggregator = async (cache, { aggregates = {}, events = {} })=>{
280
292
  one,
281
293
  action,
282
294
  allAction,
295
+ allFacet,
283
296
  create,
284
297
  get,
285
298
  retrieve,
@@ -300,4 +313,4 @@ const createAggregator = async (cache, { aggregates = {}, events = {} })=>{
300
313
 
301
314
  exports.createAggregator = createAggregator;
302
315
  exports.toCacheConfig = toCacheConfig;
303
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQWdncmVnYXRvci5janMuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7In0=
316
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQWdncmVnYXRvci5janMuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyJ9
@@ -157,6 +157,18 @@ const createAggregator = async (cache, { aggregates = {}, events = {} })=>{
157
157
  populatedItems
158
158
  ];
159
159
  };
160
+ const allFacet = async (facet, params = {}, locations = [])=>{
161
+ logger.default('allFacet', {
162
+ facet,
163
+ params,
164
+ locations
165
+ });
166
+ const [cacheMap, response] = await cache.allFacet(facet, params, locations);
167
+ return [
168
+ cacheMap,
169
+ response
170
+ ];
171
+ };
160
172
  const create = async (v, locations = [])=>{
161
173
  logger.default('create', {
162
174
  v,
@@ -228,7 +240,7 @@ const createAggregator = async (cache, { aggregates = {}, events = {} })=>{
228
240
  response
229
241
  ];
230
242
  };
231
- const find = async (finder, finderParams, locations = [])=>{
243
+ const find = async (finder, finderParams = {}, locations = [])=>{
232
244
  logger.default('find', {
233
245
  finder,
234
246
  finderParams,
@@ -241,7 +253,7 @@ const createAggregator = async (cache, { aggregates = {}, events = {} })=>{
241
253
  populatedItems
242
254
  ];
243
255
  };
244
- const findOne = async (finder, finderParams, locations = [])=>{
256
+ const findOne = async (finder, finderParams = {}, locations = [])=>{
245
257
  logger.default('find', {
246
258
  finder,
247
259
  finderParams,
@@ -276,6 +288,7 @@ const createAggregator = async (cache, { aggregates = {}, events = {} })=>{
276
288
  one,
277
289
  action,
278
290
  allAction,
291
+ allFacet,
279
292
  create,
280
293
  get,
281
294
  retrieve,
@@ -295,4 +308,4 @@ const createAggregator = async (cache, { aggregates = {}, events = {} })=>{
295
308
  };
296
309
 
297
310
  export { createAggregator, toCacheConfig };
298
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQWdncmVnYXRvci5lcy5qcyIsInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W10sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7In0=
311
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQWdncmVnYXRvci5lcy5qcyIsInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W10sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyJ9
package/dist/Cache.cjs.js CHANGED
@@ -23,7 +23,7 @@ const createCache = async (api, pkType, parentCache)=>{
23
23
  });
24
24
  let ret = [];
25
25
  try {
26
- ret = await api.all(query, {}, locations);
26
+ ret = await api.all(query, locations);
27
27
  ret.forEach((v)=>{
28
28
  cacheMap.set(v.key, v);
29
29
  });
@@ -44,7 +44,7 @@ const createCache = async (api, pkType, parentCache)=>{
44
44
  });
45
45
  let retItem = null;
46
46
  try {
47
- retItem = await api.one(query, {}, locations);
47
+ retItem = await api.one(query, locations);
48
48
  if (retItem) {
49
49
  cacheMap.set(retItem.key, retItem);
50
50
  }
@@ -70,7 +70,7 @@ const createCache = async (api, pkType, parentCache)=>{
70
70
  logger.error('Key for Action is not a valid ItemKey: %j', key);
71
71
  throw new Error('Key for Action is not a valid ItemKey');
72
72
  }
73
- const updated = await api.action(key, action, body, {});
73
+ const updated = await api.action(key, action, body);
74
74
  cacheMap.set(updated.key, updated);
75
75
  return [
76
76
  cacheMap,
@@ -85,7 +85,7 @@ const createCache = async (api, pkType, parentCache)=>{
85
85
  });
86
86
  let ret = [];
87
87
  try {
88
- ret = await api.allAction(action, body, {}, locations);
88
+ ret = await api.allAction(action, body, locations);
89
89
  ret.forEach((v)=>{
90
90
  cacheMap.set(v.key, v);
91
91
  });
@@ -100,12 +100,24 @@ const createCache = async (api, pkType, parentCache)=>{
100
100
  core.validatePK(ret, pkType)
101
101
  ];
102
102
  };
103
+ const allFacet = async (facet, params = {}, locations = [])=>{
104
+ logger.default('allFacet', {
105
+ facet,
106
+ params,
107
+ locations
108
+ });
109
+ const ret = await api.allFacet(facet, params, locations);
110
+ return [
111
+ cacheMap,
112
+ ret
113
+ ];
114
+ };
103
115
  const create = async (v, locations = [])=>{
104
116
  logger.default('create', {
105
117
  v,
106
118
  locations
107
119
  });
108
- const created = await api.create(v, {}, locations);
120
+ const created = await api.create(v, locations);
109
121
  cacheMap.set(created.key, created);
110
122
  return [
111
123
  cacheMap,
@@ -124,7 +136,7 @@ const createCache = async (api, pkType, parentCache)=>{
124
136
  }
125
137
  let ret;
126
138
  try {
127
- ret = await api.get(key, {});
139
+ ret = await api.get(key);
128
140
  if (ret) {
129
141
  cacheMap.set(ret.key, ret);
130
142
  }
@@ -178,7 +190,7 @@ const createCache = async (api, pkType, parentCache)=>{
178
190
  throw new Error('Key for Remove is not a valid ItemKey');
179
191
  }
180
192
  try {
181
- await api.remove(key, {});
193
+ await api.remove(key);
182
194
  cacheMap.delete(key);
183
195
  } catch (e) {
184
196
  logger.error("Error deleting item", {
@@ -200,7 +212,7 @@ const createCache = async (api, pkType, parentCache)=>{
200
212
  throw new Error('Key for Update is not a valid ItemKey');
201
213
  }
202
214
  try {
203
- const updated = await api.update(key, v, {});
215
+ const updated = await api.update(key, v);
204
216
  cacheMap.set(updated.key, updated);
205
217
  return [
206
218
  cacheMap,
@@ -214,24 +226,24 @@ const createCache = async (api, pkType, parentCache)=>{
214
226
  }
215
227
  };
216
228
  // Facets are a pass-thru for caches
217
- const facet = async (key, facet)=>{
229
+ const facet = async (key, facet, params = {})=>{
218
230
  logger.default('facet', {
219
231
  key,
220
232
  facet
221
233
  });
222
- const ret = await api.facet(key, facet, {});
234
+ const ret = await api.facet(key, facet, params);
223
235
  return [
224
236
  cacheMap,
225
237
  ret
226
238
  ];
227
239
  };
228
- const find = async (finder, finderParams, locations = [])=>{
240
+ const find = async (finder, params = {}, locations = [])=>{
229
241
  logger.default('find', {
230
242
  finder,
231
- finderParams,
243
+ params,
232
244
  locations
233
245
  });
234
- const ret = await api.find(finder, finderParams, {}, locations);
246
+ const ret = await api.find(finder, params, locations);
235
247
  ret.forEach((v)=>{
236
248
  cacheMap.set(v.key, v);
237
249
  });
@@ -240,13 +252,13 @@ const createCache = async (api, pkType, parentCache)=>{
240
252
  core.validatePK(ret, pkType)
241
253
  ];
242
254
  };
243
- const findOne = async (finder, finderParams, locations = [])=>{
255
+ const findOne = async (finder, finderParams = {}, locations = [])=>{
244
256
  logger.default('findOne', {
245
257
  finder,
246
258
  finderParams,
247
259
  locations
248
260
  });
249
- const ret = await api.findOne(finder, finderParams, {}, locations);
261
+ const ret = await api.findOne(finder, finderParams, locations);
250
262
  cacheMap.set(ret.key, ret);
251
263
  return [
252
264
  cacheMap,
@@ -287,6 +299,7 @@ const createCache = async (api, pkType, parentCache)=>{
287
299
  one,
288
300
  action,
289
301
  allAction,
302
+ allFacet,
290
303
  create,
291
304
  get,
292
305
  retrieve,
@@ -303,4 +316,4 @@ const createCache = async (api, pkType, parentCache)=>{
303
316
  };
304
317
 
305
318
  exports.createCache = createCache;
306
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ2FjaGUuY2pzLmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7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7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsifQ==
package/dist/Cache.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AllItemTypeArrays, ComKey, Item, ItemQuery, LocKeyArray, PriKey, TypesProperties } from '@fjell/core';
1
+ import { AllItemTypeArrays, ComKey, Item, ItemQuery, LocKeyArray, PriKey } from '@fjell/core';
2
2
  import { CacheMap } from './CacheMap';
3
3
  import { ClientApi } from '@fjell/client-api';
4
4
  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> {
@@ -6,15 +6,16 @@ export interface Cache<V extends Item<S, L1, L2, L3, L4, L5>, S extends string,
6
6
  one: (query?: ItemQuery, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V | null]>;
7
7
  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]>;
8
8
  allAction: (action: string, body?: any, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V[]]>;
9
- 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]>;
9
+ allFacet: (facet: string, params?: 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>, any]>;
10
+ create: (item: Partial<Item<S, L1, L2, L3, L4, L5>>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
10
11
  get: (key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V | null]>;
11
12
  retrieve: (key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5> | null, V | null]>;
12
13
  remove: (key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>) => Promise<CacheMap<V, S, L1, L2, L3, L4, L5>>;
13
- 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]>;
14
- facet: (key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, facet: string) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, any]>;
15
- 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[]]>;
16
- findOne: (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
- set: (key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, v: Item<S, L1, L2, L3, L4, L5>) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
14
+ update: (key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, item: Partial<Item<S, L1, L2, L3, L4, L5>>) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
15
+ facet: (key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, facet: string, params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, any]>;
16
+ find: (finder: string, params?: 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
+ findOne: (finder: string, params?: 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]>;
18
+ set: (key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, item: Item<S, L1, L2, L3, L4, L5>) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
18
19
  reset: () => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>]>;
19
20
  pkTypes: AllItemTypeArrays<S, L1, L2, L3, L4, L5>;
20
21
  cacheMap: CacheMap<V, S, L1, L2, L3, L4, L5>;
package/dist/Cache.es.js CHANGED
@@ -19,7 +19,7 @@ const createCache = async (api, pkType, parentCache)=>{
19
19
  });
20
20
  let ret = [];
21
21
  try {
22
- ret = await api.all(query, {}, locations);
22
+ ret = await api.all(query, locations);
23
23
  ret.forEach((v)=>{
24
24
  cacheMap.set(v.key, v);
25
25
  });
@@ -40,7 +40,7 @@ const createCache = async (api, pkType, parentCache)=>{
40
40
  });
41
41
  let retItem = null;
42
42
  try {
43
- retItem = await api.one(query, {}, locations);
43
+ retItem = await api.one(query, locations);
44
44
  if (retItem) {
45
45
  cacheMap.set(retItem.key, retItem);
46
46
  }
@@ -66,7 +66,7 @@ const createCache = async (api, pkType, parentCache)=>{
66
66
  logger.error('Key for Action is not a valid ItemKey: %j', key);
67
67
  throw new Error('Key for Action is not a valid ItemKey');
68
68
  }
69
- const updated = await api.action(key, action, body, {});
69
+ const updated = await api.action(key, action, body);
70
70
  cacheMap.set(updated.key, updated);
71
71
  return [
72
72
  cacheMap,
@@ -81,7 +81,7 @@ const createCache = async (api, pkType, parentCache)=>{
81
81
  });
82
82
  let ret = [];
83
83
  try {
84
- ret = await api.allAction(action, body, {}, locations);
84
+ ret = await api.allAction(action, body, locations);
85
85
  ret.forEach((v)=>{
86
86
  cacheMap.set(v.key, v);
87
87
  });
@@ -96,12 +96,24 @@ const createCache = async (api, pkType, parentCache)=>{
96
96
  validatePK(ret, pkType)
97
97
  ];
98
98
  };
99
+ const allFacet = async (facet, params = {}, locations = [])=>{
100
+ logger.default('allFacet', {
101
+ facet,
102
+ params,
103
+ locations
104
+ });
105
+ const ret = await api.allFacet(facet, params, locations);
106
+ return [
107
+ cacheMap,
108
+ ret
109
+ ];
110
+ };
99
111
  const create = async (v, locations = [])=>{
100
112
  logger.default('create', {
101
113
  v,
102
114
  locations
103
115
  });
104
- const created = await api.create(v, {}, locations);
116
+ const created = await api.create(v, locations);
105
117
  cacheMap.set(created.key, created);
106
118
  return [
107
119
  cacheMap,
@@ -120,7 +132,7 @@ const createCache = async (api, pkType, parentCache)=>{
120
132
  }
121
133
  let ret;
122
134
  try {
123
- ret = await api.get(key, {});
135
+ ret = await api.get(key);
124
136
  if (ret) {
125
137
  cacheMap.set(ret.key, ret);
126
138
  }
@@ -174,7 +186,7 @@ const createCache = async (api, pkType, parentCache)=>{
174
186
  throw new Error('Key for Remove is not a valid ItemKey');
175
187
  }
176
188
  try {
177
- await api.remove(key, {});
189
+ await api.remove(key);
178
190
  cacheMap.delete(key);
179
191
  } catch (e) {
180
192
  logger.error("Error deleting item", {
@@ -196,7 +208,7 @@ const createCache = async (api, pkType, parentCache)=>{
196
208
  throw new Error('Key for Update is not a valid ItemKey');
197
209
  }
198
210
  try {
199
- const updated = await api.update(key, v, {});
211
+ const updated = await api.update(key, v);
200
212
  cacheMap.set(updated.key, updated);
201
213
  return [
202
214
  cacheMap,
@@ -210,24 +222,24 @@ const createCache = async (api, pkType, parentCache)=>{
210
222
  }
211
223
  };
212
224
  // Facets are a pass-thru for caches
213
- const facet = async (key, facet)=>{
225
+ const facet = async (key, facet, params = {})=>{
214
226
  logger.default('facet', {
215
227
  key,
216
228
  facet
217
229
  });
218
- const ret = await api.facet(key, facet, {});
230
+ const ret = await api.facet(key, facet, params);
219
231
  return [
220
232
  cacheMap,
221
233
  ret
222
234
  ];
223
235
  };
224
- const find = async (finder, finderParams, locations = [])=>{
236
+ const find = async (finder, params = {}, locations = [])=>{
225
237
  logger.default('find', {
226
238
  finder,
227
- finderParams,
239
+ params,
228
240
  locations
229
241
  });
230
- const ret = await api.find(finder, finderParams, {}, locations);
242
+ const ret = await api.find(finder, params, locations);
231
243
  ret.forEach((v)=>{
232
244
  cacheMap.set(v.key, v);
233
245
  });
@@ -236,13 +248,13 @@ const createCache = async (api, pkType, parentCache)=>{
236
248
  validatePK(ret, pkType)
237
249
  ];
238
250
  };
239
- const findOne = async (finder, finderParams, locations = [])=>{
251
+ const findOne = async (finder, finderParams = {}, locations = [])=>{
240
252
  logger.default('findOne', {
241
253
  finder,
242
254
  finderParams,
243
255
  locations
244
256
  });
245
- const ret = await api.findOne(finder, finderParams, {}, locations);
257
+ const ret = await api.findOne(finder, finderParams, locations);
246
258
  cacheMap.set(ret.key, ret);
247
259
  return [
248
260
  cacheMap,
@@ -283,6 +295,7 @@ const createCache = async (api, pkType, parentCache)=>{
283
295
  one,
284
296
  action,
285
297
  allAction,
298
+ allFacet,
286
299
  create,
287
300
  get,
288
301
  retrieve,
@@ -299,4 +312,4 @@ const createCache = async (api, pkType, parentCache)=>{
299
312
  };
300
313
 
301
314
  export { createCache };
302
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ2FjaGUuZXMuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7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@@ -165,6 +165,18 @@ const createAggregator = async (cache, { aggregates = {}, events = {} })=>{
165
165
  populatedItems
166
166
  ];
167
167
  };
168
+ const allFacet = async (facet, params = {}, locations = [])=>{
169
+ logger$3.default('allFacet', {
170
+ facet,
171
+ params,
172
+ locations
173
+ });
174
+ const [cacheMap, response] = await cache.allFacet(facet, params, locations);
175
+ return [
176
+ cacheMap,
177
+ response
178
+ ];
179
+ };
168
180
  const create = async (v, locations = [])=>{
169
181
  logger$3.default('create', {
170
182
  v,
@@ -236,7 +248,7 @@ const createAggregator = async (cache, { aggregates = {}, events = {} })=>{
236
248
  response
237
249
  ];
238
250
  };
239
- const find = async (finder, finderParams, locations = [])=>{
251
+ const find = async (finder, finderParams = {}, locations = [])=>{
240
252
  logger$3.default('find', {
241
253
  finder,
242
254
  finderParams,
@@ -249,7 +261,7 @@ const createAggregator = async (cache, { aggregates = {}, events = {} })=>{
249
261
  populatedItems
250
262
  ];
251
263
  };
252
- const findOne = async (finder, finderParams, locations = [])=>{
264
+ const findOne = async (finder, finderParams = {}, locations = [])=>{
253
265
  logger$3.default('find', {
254
266
  finder,
255
267
  finderParams,
@@ -284,6 +296,7 @@ const createAggregator = async (cache, { aggregates = {}, events = {} })=>{
284
296
  one,
285
297
  action,
286
298
  allAction,
299
+ allFacet,
287
300
  create,
288
301
  get,
289
302
  retrieve,
@@ -417,7 +430,7 @@ const createCache = async (api, pkType, parentCache)=>{
417
430
  });
418
431
  let ret = [];
419
432
  try {
420
- ret = await api.all(query, {}, locations);
433
+ ret = await api.all(query, locations);
421
434
  ret.forEach((v)=>{
422
435
  cacheMap.set(v.key, v);
423
436
  });
@@ -438,7 +451,7 @@ const createCache = async (api, pkType, parentCache)=>{
438
451
  });
439
452
  let retItem = null;
440
453
  try {
441
- retItem = await api.one(query, {}, locations);
454
+ retItem = await api.one(query, locations);
442
455
  if (retItem) {
443
456
  cacheMap.set(retItem.key, retItem);
444
457
  }
@@ -464,7 +477,7 @@ const createCache = async (api, pkType, parentCache)=>{
464
477
  logger$1.error('Key for Action is not a valid ItemKey: %j', key);
465
478
  throw new Error('Key for Action is not a valid ItemKey');
466
479
  }
467
- const updated = await api.action(key, action, body, {});
480
+ const updated = await api.action(key, action, body);
468
481
  cacheMap.set(updated.key, updated);
469
482
  return [
470
483
  cacheMap,
@@ -479,7 +492,7 @@ const createCache = async (api, pkType, parentCache)=>{
479
492
  });
480
493
  let ret = [];
481
494
  try {
482
- ret = await api.allAction(action, body, {}, locations);
495
+ ret = await api.allAction(action, body, locations);
483
496
  ret.forEach((v)=>{
484
497
  cacheMap.set(v.key, v);
485
498
  });
@@ -494,12 +507,24 @@ const createCache = async (api, pkType, parentCache)=>{
494
507
  core.validatePK(ret, pkType)
495
508
  ];
496
509
  };
510
+ const allFacet = async (facet, params = {}, locations = [])=>{
511
+ logger$1.default('allFacet', {
512
+ facet,
513
+ params,
514
+ locations
515
+ });
516
+ const ret = await api.allFacet(facet, params, locations);
517
+ return [
518
+ cacheMap,
519
+ ret
520
+ ];
521
+ };
497
522
  const create = async (v, locations = [])=>{
498
523
  logger$1.default('create', {
499
524
  v,
500
525
  locations
501
526
  });
502
- const created = await api.create(v, {}, locations);
527
+ const created = await api.create(v, locations);
503
528
  cacheMap.set(created.key, created);
504
529
  return [
505
530
  cacheMap,
@@ -518,7 +543,7 @@ const createCache = async (api, pkType, parentCache)=>{
518
543
  }
519
544
  let ret;
520
545
  try {
521
- ret = await api.get(key, {});
546
+ ret = await api.get(key);
522
547
  if (ret) {
523
548
  cacheMap.set(ret.key, ret);
524
549
  }
@@ -572,7 +597,7 @@ const createCache = async (api, pkType, parentCache)=>{
572
597
  throw new Error('Key for Remove is not a valid ItemKey');
573
598
  }
574
599
  try {
575
- await api.remove(key, {});
600
+ await api.remove(key);
576
601
  cacheMap.delete(key);
577
602
  } catch (e) {
578
603
  logger$1.error("Error deleting item", {
@@ -594,7 +619,7 @@ const createCache = async (api, pkType, parentCache)=>{
594
619
  throw new Error('Key for Update is not a valid ItemKey');
595
620
  }
596
621
  try {
597
- const updated = await api.update(key, v, {});
622
+ const updated = await api.update(key, v);
598
623
  cacheMap.set(updated.key, updated);
599
624
  return [
600
625
  cacheMap,
@@ -608,24 +633,24 @@ const createCache = async (api, pkType, parentCache)=>{
608
633
  }
609
634
  };
610
635
  // Facets are a pass-thru for caches
611
- const facet = async (key, facet)=>{
636
+ const facet = async (key, facet, params = {})=>{
612
637
  logger$1.default('facet', {
613
638
  key,
614
639
  facet
615
640
  });
616
- const ret = await api.facet(key, facet, {});
641
+ const ret = await api.facet(key, facet, params);
617
642
  return [
618
643
  cacheMap,
619
644
  ret
620
645
  ];
621
646
  };
622
- const find = async (finder, finderParams, locations = [])=>{
647
+ const find = async (finder, params = {}, locations = [])=>{
623
648
  logger$1.default('find', {
624
649
  finder,
625
- finderParams,
650
+ params,
626
651
  locations
627
652
  });
628
- const ret = await api.find(finder, finderParams, {}, locations);
653
+ const ret = await api.find(finder, params, locations);
629
654
  ret.forEach((v)=>{
630
655
  cacheMap.set(v.key, v);
631
656
  });
@@ -634,13 +659,13 @@ const createCache = async (api, pkType, parentCache)=>{
634
659
  core.validatePK(ret, pkType)
635
660
  ];
636
661
  };
637
- const findOne = async (finder, finderParams, locations = [])=>{
662
+ const findOne = async (finder, finderParams = {}, locations = [])=>{
638
663
  logger$1.default('findOne', {
639
664
  finder,
640
665
  finderParams,
641
666
  locations
642
667
  });
643
- const ret = await api.findOne(finder, finderParams, {}, locations);
668
+ const ret = await api.findOne(finder, finderParams, locations);
644
669
  cacheMap.set(ret.key, ret);
645
670
  return [
646
671
  cacheMap,
@@ -681,6 +706,7 @@ const createCache = async (api, pkType, parentCache)=>{
681
706
  one,
682
707
  action,
683
708
  allAction,
709
+ allFacet,
684
710
  create,
685
711
  get,
686
712
  retrieve,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fjell/cache",
3
3
  "description": "Cache for Fjell",
4
- "version": "4.6.2",
4
+ "version": "4.6.4",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./dist/index.cjs.js",
@@ -15,40 +15,40 @@
15
15
  }
16
16
  },
17
17
  "dependencies": {
18
- "@fjell/client-api": "^4.4.2",
19
- "@fjell/core": "^4.4.2",
20
- "@fjell/http-api": "^4.4.0",
21
- "@fjell/logging": "^4.4.2",
18
+ "@fjell/client-api": "^4.4.4",
19
+ "@fjell/core": "^4.4.5",
20
+ "@fjell/http-api": "^4.4.3",
21
+ "@fjell/logging": "^4.4.5",
22
22
  "d3": "^7.9.0",
23
23
  "dayjs": "^1.11.13",
24
24
  "react": "19.1.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@babel/preset-env": "^7.26.9",
28
- "@babel/preset-typescript": "^7.26.0",
27
+ "@babel/preset-env": "^7.27.2",
28
+ "@babel/preset-typescript": "^7.27.1",
29
29
  "@eslint/eslintrc": "^3.3.1",
30
- "@eslint/js": "^9.27.0",
31
- "@swc/core": "^1.11.24",
32
- "@tsconfig/recommended": "^1.0.8",
30
+ "@eslint/js": "^9.30.0",
31
+ "@swc/core": "^1.12.7",
32
+ "@tsconfig/recommended": "^1.0.10",
33
33
  "@types/babel__preset-env": "^7.10.0",
34
34
  "@types/d3": "^7.4.3",
35
- "@types/multer": "^1.4.12",
36
- "@types/node": "^24.0.3",
37
- "@typescript-eslint/eslint-plugin": "^8.24.1",
38
- "@typescript-eslint/parser": "^8.24.1",
39
- "@vitest/coverage-v8": "^3.1.4",
40
- "@vitest/ui": "^3.1.4",
41
- "concurrently": "^9.1.2",
42
- "eslint": "^9.21.0",
43
- "nodemon": "^3.1.9",
35
+ "@types/multer": "^1.4.13",
36
+ "@types/node": "^24.0.7",
37
+ "@typescript-eslint/eslint-plugin": "^8.35.0",
38
+ "@typescript-eslint/parser": "^8.35.0",
39
+ "@vitest/coverage-v8": "^3.2.4",
40
+ "@vitest/ui": "^3.2.4",
41
+ "concurrently": "^9.2.0",
42
+ "eslint": "^9.30.0",
43
+ "nodemon": "^3.1.10",
44
44
  "rimraf": "^6.0.1",
45
45
  "ts-node": "^10.9.2",
46
- "tsc-alias": "^1.8.10",
47
- "typescript": "^5.7.3",
48
- "vite": "^6.3.5",
46
+ "tsc-alias": "^1.8.16",
47
+ "typescript": "^5.8.3",
48
+ "vite": "^7.0.0",
49
49
  "vite-plugin-dts": "^4.5.4",
50
50
  "vite-plugin-node": "^5.0.1",
51
- "vitest": "^3.1.4"
51
+ "vitest": "^3.2.4"
52
52
  },
53
53
  "repository": {
54
54
  "type": "git",
@@ -57,6 +57,7 @@
57
57
  "scripts": {
58
58
  "dev": "concurrently \"tsc --noEmit --watch\" \"vite build --watch\"",
59
59
  "build": "pnpm run lint && tsc --noEmit && vite build",
60
+ "typecheck": "tsc --noEmit",
60
61
  "lint": "eslint . --ext .ts --fix",
61
62
  "clean": "rimraf dist",
62
63
  "test": "pnpm run lint && vitest run --coverage"
package/release.sh ADDED
@@ -0,0 +1,89 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+
5
+ echo "Preparing for release: switching from workspace to remote dependencies."
6
+ if [ -f "pnpm-workspace.yaml" ]; then
7
+ echo "Renaming pnpm-workspace.yaml to prevent workspace-protocol resolution"
8
+ mv pnpm-workspace.yaml pnpm-workspace.yaml.bak
9
+ else
10
+ echo "pnpm-workspace.yaml not found, skipping rename."
11
+ fi
12
+
13
+ echo "Updating dependencies to latest versions from registry"
14
+ pnpm update --latest
15
+
16
+ echo "Staging changes for release commit"
17
+ git add package.json pnpm-lock.yaml
18
+
19
+ echo "Running clean, lint, build, and test..."
20
+ pnpm run clean && pnpm run lint && pnpm run build && pnpm run test
21
+
22
+ if git diff --staged --quiet; then
23
+ echo "No changes to commit, skipping commit."
24
+ else
25
+ ./commit.sh
26
+ fi
27
+
28
+ echo "Bumping version..."
29
+ pnpm version patch
30
+
31
+ echo "Generating release notes..."
32
+ pnpm dlx @eldrforge/kodrdriv release > RELEASE_NOTES.md
33
+
34
+ echo "Pushing to origin..."
35
+ git push --follow-tags
36
+
37
+ echo "Creating GitHub pull request..."
38
+ PR_URL=$(gh pr create --fill)
39
+ PR_NUM=$(echo "$PR_URL" | grep -o '[0-9]*$')
40
+ echo "Pull request created: $PR_URL"
41
+
42
+ echo "Waiting for PR #$PR_NUM checks to complete..."
43
+ while true; do
44
+ STATUS=$(gh pr view "$PR_NUM" --json statusCheckRollup --jq '.statusCheckRollup.state' 2>/dev/null)
45
+ if [[ -z "$STATUS" ]]; then
46
+ STATUS="PENDING"
47
+ fi
48
+ echo "PR status: $STATUS"
49
+ if [[ "$STATUS" == "SUCCESS" ]]; then
50
+ echo "All checks passed!"
51
+ break
52
+ elif [[ "$STATUS" == "FAILURE" || "$STATUS" == "ERROR" ]]; then
53
+ echo "PR checks failed."
54
+ gh pr checks "$PR_NUM"
55
+ exit 1
56
+ elif [[ "$STATUS" == "PENDING" || "$STATUS" == "EXPECTED" ]]; then
57
+ echo "Checks are pending... waiting 10 seconds."
58
+ sleep 10
59
+ else
60
+ echo "Unknown PR status: $STATUS. Waiting 10 seconds."
61
+ sleep 10
62
+ fi
63
+ done
64
+
65
+ echo "Merging PR #$PR_NUM..."
66
+ gh pr merge "$PR_NUM" --squash --delete-branch
67
+
68
+ echo "Checking out main branch..."
69
+ git checkout main
70
+ git pull origin main
71
+
72
+ echo "Creating GitHub release..."
73
+ TAG_NAME="v$(jq -r .version package.json)"
74
+ gh release create "$TAG_NAME" --notes-file RELEASE_NOTES.md
75
+
76
+ echo "Creating next release branch..."
77
+ CURRENT_VERSION=$(jq -r .version package.json)
78
+ MAJOR=$(echo "$CURRENT_VERSION" | cut -d. -f1)
79
+ MINOR=$(echo "$CURRENT_VERSION" | cut -d. -f2)
80
+ PATCH=$(echo "$CURRENT_VERSION" | cut -d. -f3)
81
+ NEXT_PATCH=$((PATCH + 1))
82
+ NEXT_VERSION="$MAJOR.$MINOR.$NEXT_PATCH"
83
+
84
+ echo "Next version is $NEXT_VERSION"
85
+ git checkout -b "release/v$NEXT_VERSION"
86
+ git commit -m "feat: Start release v$NEXT_VERSION"
87
+ git push -u origin "release/v$NEXT_VERSION"
88
+
89
+ echo "Release process completed."
package/src/Aggregator.ts CHANGED
@@ -4,8 +4,7 @@ import {
4
4
  Item,
5
5
  ItemQuery,
6
6
  LocKeyArray,
7
- PriKey,
8
- TypesProperties
7
+ PriKey
9
8
  } from "@fjell/core";
10
9
  import { Cache } from "./Cache";
11
10
  import { CacheMap } from "./CacheMap";
@@ -60,10 +59,10 @@ export const createAggregator = async <
60
59
  >(
61
60
  cache: Cache<V, S, L1, L2, L3, L4, L5>,
62
61
  { aggregates = {}, events = {} }:
63
- {
64
- aggregates?: AggregateConfig,
65
- events?: AggregateConfig
66
- }
62
+ {
63
+ aggregates?: AggregateConfig,
64
+ events?: AggregateConfig
65
+ }
67
66
  ): Promise<Aggregator<V, S, L1, L2, L3, L4, L5>> => {
68
67
 
69
68
  const populate = async (item: V): Promise<V> => {
@@ -93,9 +92,9 @@ export const createAggregator = async <
93
92
  } else if (item.refs[key] === undefined) {
94
93
  if (cacheConfig.optional === false) {
95
94
  logger.error('Item does not have mandatory ref with key, not optional ' +
96
- key + ' ' + JSON.stringify(item));
95
+ key + ' ' + JSON.stringify(item));
97
96
  throw new Error('Item does not have mandatory ref with key, not optional ' +
98
- key + ' ' + JSON.stringify(item));
97
+ key + ' ' + JSON.stringify(item));
99
98
  } else {
100
99
  if (item.events && Object.prototype.hasOwnProperty.call(item.events, key)) {
101
100
  delete item.events[key];
@@ -195,8 +194,18 @@ export const createAggregator = async <
195
194
  return [cacheMap, populatedItems];
196
195
  }
197
196
 
197
+ const allFacet = async (
198
+ facet: string,
199
+ params: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},
200
+ locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []
201
+ ): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, any]> => {
202
+ logger.default('allFacet', { facet, params, locations });
203
+ const [cacheMap, response] = await cache.allFacet(facet, params, locations);
204
+ return [cacheMap, response];
205
+ }
206
+
198
207
  const create = async (
199
- v: TypesProperties<V, S, L1, L2, L3, L4, L5>,
208
+ v: Partial<Item<S, L1, L2, L3, L4, L5>>,
200
209
  locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []
201
210
  ): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]> => {
202
211
  logger.default('create', { v, locations });
@@ -239,7 +248,7 @@ export const createAggregator = async <
239
248
 
240
249
  const update = async (
241
250
  key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
242
- v: TypesProperties<V, S, L1, L2, L3, L4, L5>,
251
+ v: Partial<Item<S, L1, L2, L3, L4, L5>>,
243
252
  ): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]> => {
244
253
  logger.default('update', { key, v });
245
254
  const [cacheMap, item] = await cache.update(key, v);
@@ -259,7 +268,7 @@ export const createAggregator = async <
259
268
 
260
269
  const find = async (
261
270
  finder: string,
262
- finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
271
+ finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},
263
272
  locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []
264
273
  ): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V[]]> => {
265
274
  logger.default('find', { finder, finderParams, locations });
@@ -270,7 +279,7 @@ export const createAggregator = async <
270
279
 
271
280
  const findOne = async (
272
281
  finder: string,
273
- finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
282
+ finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},
274
283
  locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []
275
284
  ): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]> => {
276
285
  logger.default('find', { finder, finderParams, locations });
@@ -301,6 +310,7 @@ export const createAggregator = async <
301
310
  one,
302
311
  action,
303
312
  allAction,
313
+ allFacet,
304
314
  create,
305
315
  get,
306
316
  retrieve,
package/src/Cache.ts CHANGED
@@ -7,7 +7,6 @@ import {
7
7
  ItemQuery,
8
8
  LocKeyArray,
9
9
  PriKey,
10
- TypesProperties,
11
10
  validatePK
12
11
  } from "@fjell/core";
13
12
  import { CacheMap } from "./CacheMap";
@@ -51,8 +50,14 @@ export interface Cache<
51
50
  locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
52
51
  ) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V[]]>
53
52
 
53
+ allFacet: (
54
+ facet: string,
55
+ params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
56
+ locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
57
+ ) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, any]>;
58
+
54
59
  create: (
55
- v: TypesProperties<V, S, L1, L2, L3, L4, L5>,
60
+ item: Partial<Item<S, L1, L2, L3, L4, L5>>,
56
61
  locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
57
62
  ) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
58
63
 
@@ -70,29 +75,30 @@ export interface Cache<
70
75
 
71
76
  update: (
72
77
  key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
73
- v: TypesProperties<V, S, L1, L2, L3, L4, L5>,
78
+ item: Partial<Item<S, L1, L2, L3, L4, L5>>,
74
79
  ) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
75
80
 
76
81
  facet: (
77
82
  key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
78
83
  facet: string,
84
+ params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
79
85
  ) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, any]>;
80
86
 
81
87
  find: (
82
88
  finder: string,
83
- finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
89
+ params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
84
90
  locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
85
91
  ) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V[]]>;
86
92
 
87
93
  findOne: (
88
94
  finder: string,
89
- finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
95
+ params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
90
96
  locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
91
97
  ) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
92
98
 
93
99
  set: (
94
100
  key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
95
- v: Item<S, L1, L2, L3, L4, L5>
101
+ item: Item<S, L1, L2, L3, L4, L5>
96
102
  ) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
97
103
 
98
104
  reset: () => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>]>;
@@ -132,7 +138,7 @@ export const createCache = async <
132
138
  logger.default('all', { query, locations });
133
139
  let ret: V[] = [];
134
140
  try {
135
- ret = await api.all(query, {}, locations);
141
+ ret = await api.all(query, locations);
136
142
  ret.forEach((v) => {
137
143
  cacheMap.set(v.key, v);
138
144
  });
@@ -155,7 +161,7 @@ export const createCache = async <
155
161
 
156
162
  let retItem: V | null = null;
157
163
  try {
158
- retItem = await api.one(query, {}, locations);
164
+ retItem = await api.one(query, locations);
159
165
  if (retItem) {
160
166
  cacheMap.set(retItem.key, retItem);
161
167
  }
@@ -188,7 +194,7 @@ export const createCache = async <
188
194
  throw new Error('Key for Action is not a valid ItemKey');
189
195
  }
190
196
 
191
- const updated = await api.action(key, action, body, {});
197
+ const updated = await api.action(key, action, body);
192
198
  cacheMap.set(updated.key, updated);
193
199
  return [cacheMap, validatePK(updated, pkType) as V];
194
200
  }
@@ -201,7 +207,7 @@ export const createCache = async <
201
207
  logger.default('allAction', { action, body, locations });
202
208
  let ret: V[] = [];
203
209
  try {
204
- ret = await api.allAction(action, body, {}, locations);
210
+ ret = await api.allAction(action, body, locations);
205
211
  ret.forEach((v) => {
206
212
  cacheMap.set(v.key, v);
207
213
  });
@@ -216,12 +222,22 @@ export const createCache = async <
216
222
  return [cacheMap, validatePK(ret, pkType) as V[]];
217
223
  }
218
224
 
225
+ const allFacet = async (
226
+ facet: string,
227
+ params: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},
228
+ locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []
229
+ ): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, any]> => {
230
+ logger.default('allFacet', { facet, params, locations });
231
+ const ret = await api.allFacet(facet, params, locations);
232
+ return [cacheMap, ret];
233
+ }
234
+
219
235
  const create = async (
220
- v: TypesProperties<V, S, L1, L2, L3, L4, L5>,
236
+ v: Partial<Item<S, L1, L2, L3, L4, L5>>,
221
237
  locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []
222
238
  ): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]> => {
223
239
  logger.default('create', { v, locations });
224
- const created = await api.create(v, {}, locations);
240
+ const created = await api.create(v, locations);
225
241
  cacheMap.set(created.key, created);
226
242
  return [cacheMap, validatePK(created, pkType) as V];
227
243
  }
@@ -238,7 +254,7 @@ export const createCache = async <
238
254
  }
239
255
  let ret: V | null;
240
256
  try {
241
- ret = await api.get(key, {});
257
+ ret = await api.get(key);
242
258
  if (ret) {
243
259
  cacheMap.set(ret.key, ret);
244
260
  }
@@ -293,7 +309,7 @@ export const createCache = async <
293
309
  throw new Error('Key for Remove is not a valid ItemKey');
294
310
  }
295
311
  try {
296
- await api.remove(key, {});
312
+ await api.remove(key);
297
313
  cacheMap.delete(key);
298
314
  } catch (e) {
299
315
  logger.error("Error deleting item", { error: e });
@@ -304,7 +320,7 @@ export const createCache = async <
304
320
 
305
321
  const update = async (
306
322
  key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
307
- v: TypesProperties<V, S, L1, L2, L3, L4, L5>,
323
+ v: Partial<Item<S, L1, L2, L3, L4, L5>>,
308
324
  ): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]> => {
309
325
  logger.default('update', { key, v });
310
326
 
@@ -316,7 +332,7 @@ export const createCache = async <
316
332
  }
317
333
 
318
334
  try {
319
- const updated = await api.update(key, v, {});
335
+ const updated = await api.update(key, v);
320
336
  cacheMap.set(updated.key, updated);
321
337
  return [cacheMap, validatePK(updated, pkType) as V];
322
338
  } catch (e) {
@@ -329,19 +345,20 @@ export const createCache = async <
329
345
  const facet = async (
330
346
  key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
331
347
  facet: string,
348
+ params: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},
332
349
  ): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, any]> => {
333
350
  logger.default('facet', { key, facet });
334
- const ret = await api.facet(key, facet, {});
351
+ const ret = await api.facet(key, facet, params);
335
352
  return [cacheMap, ret];
336
353
  }
337
354
 
338
355
  const find = async (
339
356
  finder: string,
340
- finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
357
+ params: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},
341
358
  locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []
342
359
  ): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V[]]> => {
343
- logger.default('find', { finder, finderParams, locations });
344
- const ret: V[] = await api.find(finder, finderParams, {}, locations);
360
+ logger.default('find', { finder, params, locations });
361
+ const ret: V[] = await api.find(finder, params, locations);
345
362
  ret.forEach((v) => {
346
363
  cacheMap.set(v.key, v);
347
364
  });
@@ -350,11 +367,11 @@ export const createCache = async <
350
367
 
351
368
  const findOne = async (
352
369
  finder: string,
353
- finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
370
+ finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},
354
371
  locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []
355
372
  ): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]> => {
356
373
  logger.default('findOne', { finder, finderParams, locations });
357
- const ret = await api.findOne(finder, finderParams, {}, locations);
374
+ const ret = await api.findOne(finder, finderParams, locations);
358
375
  cacheMap.set(ret.key, ret);
359
376
  return [cacheMap, validatePK(ret, pkType) as V];
360
377
  }
@@ -394,6 +411,7 @@ export const createCache = async <
394
411
  one,
395
412
  action,
396
413
  allAction,
414
+ allFacet,
397
415
  create,
398
416
  get,
399
417
  retrieve,