@rentman/rm-core 9.2.3 → 9.3.0

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.
@@ -6,12 +6,13 @@ export declare type CacheSyncerQueryMap = ItemTypeMap<{
6
6
  collectionResources: CollectionResource[];
7
7
  };
8
8
  }>;
9
- export declare type CacheSyncerMatches<ItemTypeType extends ApiEnumItemType> = {
10
- [itemId: number]: {
11
- item: ItemEntry<ItemTypeType>;
12
- isMatch: boolean | 'maybe';
13
- };
9
+ declare type CacheSyncerMatchesMapEntry = {
10
+ query: CollectionQuery;
11
+ items: ItemEntry[];
14
12
  };
13
+ declare type CacheSyncerMatchesMap = ItemTypeMap<{
14
+ [cachedQueryString: string]: CacheSyncerMatchesMapEntry;
15
+ }>;
15
16
  export declare class CacheSyncer {
16
17
  private queryService;
17
18
  private queryMatcherFactory;
@@ -19,15 +20,39 @@ export declare class CacheSyncer {
19
20
  private promiseService;
20
21
  private transaction;
21
22
  private cachedQueryMap;
22
- private matchedItemEntryMap;
23
+ matches: {
24
+ true: CacheSyncerMatchesMap;
25
+ false: CacheSyncerMatchesMap;
26
+ maybe: CacheSyncerMatchesMap;
27
+ };
23
28
  constructor(queryService: QueryService, queryMatcherFactory: QueryMatcherFactory, apiRequestService: ApiRequestService, promiseService: PromiseLibraryInterface, transaction: AbstractCache, cachedQueryMap: CacheSyncerQueryMap);
29
+ getMatches<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, queryString: string, type: 'true' | 'false' | 'maybe'): ItemEntry<ItemTypeType>[];
30
+ /**
31
+ * Syncing of collections always runs in 3 phases:
32
+ * - Remove items from collections
33
+ * - Add items to collections
34
+ * - Process MAYBE matches
35
+ * -- Remove MAYBE items from collections
36
+ * -- Add MAYBE items to collections
37
+ *
38
+ * @param isCalledAfterSocketUpdate
39
+ * @param changesDelta
40
+ */
24
41
  syncCollections(isCalledAfterSocketUpdate?: boolean, changesDelta?: ChangesDeltaBase): PromiseInterface<void>;
42
+ /**
43
+ * Syncing of cached queries runs in 3 phases:
44
+ * - Remove items from collections
45
+ * - Add items to collections
46
+ * - Process MAYBE matches
47
+ * -- Remove MAYBE items from collections
48
+ * -- Add MAYBE items to collections
49
+ *
50
+ * @param _isCalledAfterSocketUpdate
51
+ * @param changesDelta
52
+ */
25
53
  syncCachedQueries(_isCalledAfterSocketUpdate?: boolean, changesDelta?: ChangesDeltaBase): PromiseInterface<void[]>;
26
54
  expand<ItemEntryType extends ItemEntry>(itemEntry: ItemEntryType, fields: FieldMap<ItemEntryType['itemType']>): this;
27
55
  processDelta(parentChangesDelta: ParentChangesDelta): this;
28
- groupMatchedItemEntries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, query: CollectionQuery): {
29
- [key in 'fitting' | 'notFitting' | 'maybe']: ItemEntry<ItemTypeType>[];
30
- };
31
56
  _expand<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, matchFunction: (itemType: ItemTypeType, parsedQuery: CollectionQuery) => boolean | 'maybe'): this;
32
57
  /**
33
58
  * Unlike the functions that use a promise accumulator, this function *can* result in a rejection. It should be handled
@@ -38,7 +63,8 @@ export declare class CacheSyncer {
38
63
  * Returns null if none of the promises resulted in an exception, or the exception otherwise.
39
64
  */
40
65
  private resolveAll;
41
- private syncCollection;
42
- private syncCachedQuery;
43
66
  private addMatchedEntriesToCollections;
67
+ private processCollectionMaybe;
68
+ private processCachedQueryMaybe;
44
69
  }
70
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rentman/rm-core",
3
- "version": "9.2.3",
3
+ "version": "9.3.0",
4
4
  "description": "Rentman core functionalities",
5
5
  "main": "./dist/rm-core.js",
6
6
  "types": "./dist/types/index.d.ts",