@rentman/rm-core 12.0.4 → 12.0.5-2

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.
Files changed (145) hide show
  1. package/changelog.md +1491 -1476
  2. package/dist/rm-core.js +972 -941
  3. package/dist/rm-core.min.js +1 -1
  4. package/dist/types/src/FieldLookupProxy.d.ts +4 -4
  5. package/dist/types/src/classes/ApiFormatter.d.ts +76 -76
  6. package/dist/types/src/classes/ApiRequestService.d.ts +18 -18
  7. package/dist/types/src/classes/ApiResponseProcessor.d.ts +29 -29
  8. package/dist/types/src/classes/BusinessLogicManager/BusinessLogicManager.d.ts +98 -98
  9. package/dist/types/src/classes/BusinessLogicManager/BusinessLogicRule.d.ts +93 -93
  10. package/dist/types/src/classes/BusinessLogicManager/Customfield/CustomFieldTypeBusinessLogicRule.d.ts +17 -17
  11. package/dist/types/src/classes/BusinessLogicManager/Documents/DocumentTemplateBusinessLogicRule.d.ts +24 -24
  12. package/dist/types/src/classes/BusinessLogicManager/Exemplaar/ExemplaarAanschafdatumBusinessLogicRule.d.ts +13 -13
  13. package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurBetalingsconditieBusinessLogicRule.d.ts +19 -19
  14. package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurDatumBusinessLogicRule.d.ts +18 -18
  15. package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurNumberseriesBusinessLogicRule.d.ts +13 -13
  16. package/dist/types/src/classes/BusinessLogicManager/Functie/FunctieNaaminternBusinessLogicRule.d.ts +17 -17
  17. package/dist/types/src/classes/BusinessLogicManager/Functie/FunctieTwowayBusinessLogicRule.d.ts +13 -13
  18. package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalTelexemplarenBusinessLogicRule.d.ts +15 -15
  19. package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalTypeBusinessLogicRule.d.ts +17 -17
  20. package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalVerhuurBusinessLogicRule.d.ts +17 -17
  21. package/dist/types/src/classes/BusinessLogicManager/Materiaal/SurfaceArticleSizeBusinessLogicRule.d.ts +18 -18
  22. package/dist/types/src/classes/BusinessLogicManager/OfferteContract/OfferteContractDatumBusinessLogicRule.d.ts +25 -25
  23. package/dist/types/src/classes/BusinessLogicManager/PlanningPersoneelTransport/PlanningPersoneelTransportBusinessLogicRule.d.ts +28 -28
  24. package/dist/types/src/classes/BusinessLogicManager/Project/ProjectClientNoteBusinessLogicRule.d.ts +22 -22
  25. package/dist/types/src/classes/BusinessLogicManager/Reparatie/ReparatieExemplaarBusinessLogicRule.d.ts +13 -13
  26. package/dist/types/src/classes/BusinessLogicManager/Rol/RolDocumentAccessBusinessLogicRule.d.ts +17 -17
  27. package/dist/types/src/classes/BusinessLogicManager/Rol/RolEditOwnDataBusinessLogicRule.d.ts +17 -17
  28. package/dist/types/src/classes/BusinessLogicManager/Rol/RolFileAccessBusinessLogicRule.d.ts +17 -17
  29. package/dist/types/src/classes/BusinessLogicManager/Rol/RolPersoneelsplannerToegangBusinessLogicRule.d.ts +17 -17
  30. package/dist/types/src/classes/BusinessLogicManager/Rol/RolProjectenBewerkenBusinessLogicRule.d.ts +17 -17
  31. package/dist/types/src/classes/BusinessLogicManager/Rol/RolProjectenToegangBusinessLogicRule.d.ts +17 -17
  32. package/dist/types/src/classes/CacheSyncer.d.ts +71 -71
  33. package/dist/types/src/classes/ChangesCompilation.d.ts +33 -33
  34. package/dist/types/src/classes/ChangesDelta.d.ts +65 -65
  35. package/dist/types/src/classes/ChangesDeltaBase.d.ts +88 -86
  36. package/dist/types/src/classes/ChangesProcessor.d.ts +40 -40
  37. package/dist/types/src/classes/CollectionEntryService.d.ts +24 -24
  38. package/dist/types/src/classes/CollectionResourceService.d.ts +6 -6
  39. package/dist/types/src/classes/ColumnCache.d.ts +19 -19
  40. package/dist/types/src/classes/ColumnExpansion.d.ts +19 -19
  41. package/dist/types/src/classes/ColumnHandler.d.ts +20 -20
  42. package/dist/types/src/classes/ColumnInfo.d.ts +15 -15
  43. package/dist/types/src/classes/ColumnSet.d.ts +37 -37
  44. package/dist/types/src/classes/ColumnUtil.d.ts +108 -108
  45. package/dist/types/src/classes/ConversionMapService.d.ts +25 -25
  46. package/dist/types/src/classes/CreateRequest.d.ts +17 -17
  47. package/dist/types/src/classes/CreatedChangesDelta.d.ts +17 -17
  48. package/dist/types/src/classes/InternalChangesDelta.d.ts +44 -44
  49. package/dist/types/src/classes/ItemCache.d.ts +27 -27
  50. package/dist/types/src/classes/ItemCreateService.d.ts +18 -18
  51. package/dist/types/src/classes/ItemEntryService.d.ts +32 -32
  52. package/dist/types/src/classes/KeyService.d.ts +18 -18
  53. package/dist/types/src/classes/LockService.d.ts +28 -28
  54. package/dist/types/src/classes/ModuleChangesCompilation.d.ts +17 -17
  55. package/dist/types/src/classes/ParentChangesDelta.d.ts +41 -41
  56. package/dist/types/src/classes/QueryColumnExtractor.d.ts +18 -18
  57. package/dist/types/src/classes/QueryContainsLocalIdParser.d.ts +17 -17
  58. package/dist/types/src/classes/QueryLinkedToParser.d.ts +17 -17
  59. package/dist/types/src/classes/QueryLocallyMatchableParser.d.ts +20 -20
  60. package/dist/types/src/classes/QueryMatcher.d.ts +25 -25
  61. package/dist/types/src/classes/QueryParser.d.ts +25 -25
  62. package/dist/types/src/classes/QueryParserBase.d.ts +20 -20
  63. package/dist/types/src/classes/QueryParserIdUpdater.d.ts +17 -17
  64. package/dist/types/src/classes/QueryService.d.ts +12 -12
  65. package/dist/types/src/classes/RequestBuffer.d.ts +26 -26
  66. package/dist/types/src/classes/RequestBufferManager.d.ts +21 -21
  67. package/dist/types/src/classes/RequestColumnExpansion.d.ts +13 -13
  68. package/dist/types/src/classes/RequestColumnsOperationsCache.d.ts +46 -46
  69. package/dist/types/src/classes/SocketMessageHandler.d.ts +34 -34
  70. package/dist/types/src/classes/TemplateCache.d.ts +64 -64
  71. package/dist/types/src/classes/Util.d.ts +28 -28
  72. package/dist/types/src/classes/cache/AbstractCache.d.ts +85 -92
  73. package/dist/types/src/classes/cache/CachedQueryHandlerBase.d.ts +70 -70
  74. package/dist/types/src/classes/cache/ItemHandlerBase.d.ts +107 -107
  75. package/dist/types/src/classes/cache/server/ServerCache.d.ts +65 -77
  76. package/dist/types/src/classes/cache/server/ServerCachedQueryHandler.d.ts +27 -27
  77. package/dist/types/src/classes/cache/server/ServerItemHandler.d.ts +39 -39
  78. package/dist/types/src/classes/cache/transaction/TransactionCache.d.ts +298 -310
  79. package/dist/types/src/classes/cache/transaction/TransactionCachedQueryHandler.d.ts +50 -50
  80. package/dist/types/src/classes/cache/transaction/TransactionCollectionHandler.d.ts +24 -24
  81. package/dist/types/src/classes/cache/transaction/TransactionEventHandler.d.ts +21 -21
  82. package/dist/types/src/classes/cache/transaction/TransactionItemHandler.d.ts +80 -80
  83. package/dist/types/src/classes/cache/transaction/TransactionValidator.d.ts +33 -33
  84. package/dist/types/src/constants.d.ts +7 -7
  85. package/dist/types/src/core.d.ts +48 -48
  86. package/dist/types/src/factories/ApiResponseProcessorFactory.d.ts +6 -6
  87. package/dist/types/src/factories/CacheSyncerFactory.d.ts +14 -14
  88. package/dist/types/src/factories/ChangesCompilationFactory.d.ts +5 -5
  89. package/dist/types/src/factories/ChangesDeltaFactory.d.ts +13 -13
  90. package/dist/types/src/factories/ChangesProcessorFactory.d.ts +13 -13
  91. package/dist/types/src/factories/CollectionEntryFactory.d.ts +11 -11
  92. package/dist/types/src/factories/CollectionResourceFactory.d.ts +18 -18
  93. package/dist/types/src/factories/ColumnExpansionFactory.d.ts +7 -7
  94. package/dist/types/src/factories/ColumnInfoFactory.d.ts +7 -7
  95. package/dist/types/src/factories/ColumnSetFactory.d.ts +18 -18
  96. package/dist/types/src/factories/CreateRequestFactory.d.ts +9 -9
  97. package/dist/types/src/factories/ItemCacheFactory.d.ts +6 -6
  98. package/dist/types/src/factories/ItemEntryFactory.d.ts +12 -12
  99. package/dist/types/src/factories/ItemResourceFactory.d.ts +11 -11
  100. package/dist/types/src/factories/ModuleChangesCompilationFactory.d.ts +6 -6
  101. package/dist/types/src/factories/QueryMatcherFactory.d.ts +8 -8
  102. package/dist/types/src/factories/QueryParserFactory.d.ts +5 -5
  103. package/dist/types/src/factories/RequestColumnExpansionFactory.d.ts +6 -6
  104. package/dist/types/src/factories/RequestColumnsOperationsCacheFactory.d.ts +8 -8
  105. package/dist/types/src/factories/TemplateFactory.d.ts +8 -8
  106. package/dist/types/src/factories/TransactionCacheFactory.d.ts +13 -13
  107. package/dist/types/src/index.d.ts +1 -1
  108. package/dist/types/src/interfaces/AbstractCacheDependencyInterface.d.ts +38 -38
  109. package/dist/types/src/interfaces/ApiRequestServiceInterface.d.ts +12 -12
  110. package/dist/types/src/interfaces/AuthInterface.d.ts +10 -10
  111. package/dist/types/src/interfaces/ErrorHandlerInterface.d.ts +6 -6
  112. package/dist/types/src/interfaces/ExceptionHandlerInterface.d.ts +3 -3
  113. package/dist/types/src/interfaces/LinkTreeServiceInterface.d.ts +4 -4
  114. package/dist/types/src/interfaces/PromiseLibraryInterface.d.ts +33 -33
  115. package/dist/types/src/interfaces/ServerCacheDependencyInterface.d.ts +5 -5
  116. package/dist/types/src/interfaces/SocketMessageInterface.d.ts +3 -3
  117. package/dist/types/src/interfaces/TransactionCollectionHandlerDependencyInterface.d.ts +17 -17
  118. package/dist/types/src/interfaces/TransactionItemHandlerDependencyInterface.d.ts +22 -22
  119. package/dist/types/src/internal.d.ts +128 -128
  120. package/dist/types/src/models/CachedQueryItem.d.ts +40 -40
  121. package/dist/types/src/models/CollectionEntry.d.ts +22 -22
  122. package/dist/types/src/models/CollectionOptions.d.ts +44 -44
  123. package/dist/types/src/models/CollectionResource.d.ts +87 -87
  124. package/dist/types/src/models/ItemEntry.d.ts +19 -19
  125. package/dist/types/src/models/ItemEntryOptions.d.ts +8 -8
  126. package/dist/types/src/models/ItemResource.d.ts +95 -90
  127. package/dist/types/src/models/Template.d.ts +11 -11
  128. package/dist/types/src/types/ItemTypesCollection.d.ts +361 -358
  129. package/dist/types/src/types/PromiseInterface.d.ts +2 -2
  130. package/dist/types/tests/integration/core.test.d.ts +1 -1
  131. package/dist/types/tests/integration/helpers/helpers.d.ts +32 -32
  132. package/dist/types/tests/integration/transactions/field_lookup.test.d.ts +1 -1
  133. package/dist/types/tests/integration/transactions/get_by.test.d.ts +1 -1
  134. package/dist/types/tests/integration/transactions/updates.test.d.ts +1 -1
  135. package/dist/types/tests/mocks/ApiMocked.d.ts +19 -19
  136. package/dist/types/tests/mocks/PromiseLibrary.mocked.d.ts +2 -2
  137. package/dist/types/tests/regression/RM4_17754.test.d.ts +1 -1
  138. package/dist/types/tests/regression/RM4_18216.test.d.ts +1 -1
  139. package/dist/types/tests/unit/query_contains_local_id_parser.test.d.ts +1 -1
  140. package/dist/types/tests/unit/query_linked_to_parser.test.d.ts +1 -1
  141. package/dist/types/tests/unit/query_matcher.test.d.ts +1 -1
  142. package/dist/types/tests/unit/query_parser_id_updater.test.d.ts +1 -1
  143. package/dist/types/tests/unit/query_service.test.d.ts +1 -1
  144. package/package.json +57 -57
  145. package/readme.md +16 -16
@@ -1,28 +1,28 @@
1
- import { PromiseInterface } from '../internal';
2
- export declare function findIndex<T>(haystack: T[], callback: (item: T) => boolean): number;
3
- export declare function shallowMerge(object: any, defaults: any): any;
4
- export declare function hasProperties(object: any): boolean;
5
- export declare function getFirstProperty(object: any): string | null;
6
- export declare function inArray(needle: any, haystack: any): boolean;
7
- export declare function filterArray<T>(source: T[], callback: (elem: T) => boolean): boolean;
8
- export declare function emptyArray(array: any[]): void;
9
- export declare function pathExists(source: any, path: string[]): boolean;
10
- export declare function createPath<T>(object: any, path: (number | string)[], defaults: any[]): T;
11
- export declare function getPath(object: {}, path: (number | string)[], create?: boolean): any;
12
- export declare function extend(dst: any, ...args: any[]): any;
13
- export declare function merge(dst: any, ...args: any[]): any;
14
- export declare function isObject(value: any): boolean;
15
- export declare function isBlankObject(value: any): boolean;
16
- export declare function isString(value: any): boolean;
17
- export declare function isNumber(value: any): boolean;
18
- export declare function isDate(value: any): boolean;
19
- export declare const isArray: (arg: any) => arg is any[];
20
- export declare function isFunction<T>(value: any): value is T;
21
- export declare function isPromiseLike<T = any>(obj: any): obj is PromiseInterface<T>;
22
- export declare function isRegExp(value: any): boolean;
23
- export declare function isBoolean(value: any): boolean;
24
- export declare function isElement(node: any): boolean;
25
- export declare function isWindow(obj: any): boolean;
26
- export declare function isDefined(value: any): boolean;
27
- export declare function equals(o1: any, o2: any): boolean;
28
- export declare function copy(source: object, destination?: object, maxDepth?: any): any;
1
+ import { PromiseInterface } from '../internal';
2
+ export declare function findIndex<T>(haystack: T[], callback: (item: T) => boolean): number;
3
+ export declare function shallowMerge(object: any, defaults: any): any;
4
+ export declare function hasProperties(object: any): boolean;
5
+ export declare function getFirstProperty(object: any): string | null;
6
+ export declare function inArray(needle: any, haystack: any): boolean;
7
+ export declare function filterArray<T>(source: T[], callback: (elem: T) => boolean): boolean;
8
+ export declare function emptyArray(array: any[]): void;
9
+ export declare function pathExists(source: any, path: string[]): boolean;
10
+ export declare function createPath<T>(object: any, path: (number | string)[], defaults: any[]): T;
11
+ export declare function getPath(object: {}, path: (number | string)[], create?: boolean): any;
12
+ export declare function extend(dst: any, ...args: any[]): any;
13
+ export declare function merge(dst: any, ...args: any[]): any;
14
+ export declare function isObject(value: any): boolean;
15
+ export declare function isBlankObject(value: any): boolean;
16
+ export declare function isString(value: any): boolean;
17
+ export declare function isNumber(value: any): boolean;
18
+ export declare function isDate(value: any): boolean;
19
+ export declare const isArray: (arg: any) => arg is any[];
20
+ export declare function isFunction<T>(value: any): value is T;
21
+ export declare function isPromiseLike<T = any>(obj: any): obj is PromiseInterface<T>;
22
+ export declare function isRegExp(value: any): boolean;
23
+ export declare function isBoolean(value: any): boolean;
24
+ export declare function isElement(node: any): boolean;
25
+ export declare function isWindow(obj: any): boolean;
26
+ export declare function isDefined(value: any): boolean;
27
+ export declare function equals(o1: any, o2: any): boolean;
28
+ export declare function copy(source: object, destination?: object, maxDepth?: any): any;
@@ -1,92 +1,85 @@
1
- import { ApiEnumItemType } from '@rentman/backend-types';
2
- import { RmCore } from '../../core';
3
- import { AbstractCacheDependencyInterface, ApiRequestColumnArray, CachedQueryItem, ChangesDelta, ChangesDeltaBase, ChangesDeltaResult, CollectionQuery, CollectionResourceParentIdMap, EntryParentNull, FieldMap, InternalChangesDelta, ItemCache, ItemEntry, ItemEntryChangesTuple, ItemHandlerBase, ItemIdConversionMap, OnAfterCreateCallback, ParentChangesDelta, PromiseInterface, ServerCache, ServerCachedQueryHandler, TransactionCache, TransactionCachedQueryHandler, TransactionValidatorFactory } from '../../internal';
4
- export declare type TransactionOptions = {
5
- /**
6
- * @description
7
- * Sets the TransactionCache to 'transparent' mode, whenever {@link AbstractCache.createChild createChild} is called it will actually be called on the parent
8
- */
9
- transparent: boolean;
10
- };
11
- export declare abstract class AbstractCache {
12
- dependencies: AbstractCacheDependencyInterface;
13
- core: RmCore;
14
- children: TransactionCache[];
15
- readonly itemHandler: ItemHandlerBase;
16
- readonly cachedQueryHandler: TransactionCachedQueryHandler | ServerCachedQueryHandler;
17
- parent: AbstractCache | null;
18
- protected constructor(dependencies: AbstractCacheDependencyInterface, core: RmCore);
19
- abstract createChild(id?: string, validatorFactory?: TransactionValidatorFactory, options?: TransactionOptions): TransactionCache;
20
- onChildDestroy(cache: TransactionCache): void;
21
- /**
22
- * @description
23
- * Expands the items in the collections with the passed columns
24
- *
25
- * todo[limit] move to TransactionCache ?
26
- */
27
- abstract expandCollectionResources<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, collections: CollectionResourceParentIdMap<ItemTypeType>, newColumns: ApiRequestColumnArray): PromiseInterface<CollectionResourceParentIdMap>;
28
- /**
29
- * @description
30
- * Returns {@link ItemEntry ItemEntries} that fit the collection's query, copies over the collectionChanges on all transactions in the chain.
31
- */
32
- abstract getCollectionChangesRecursively<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery): CachedQueryItem<ItemTypeType> | undefined;
33
- /**
34
- * @description
35
- * Returns this transaction and all parents
36
- */
37
- getTransactionChain(includeServerCache: false): TransactionCache[];
38
- getTransactionChain(includeServerCache?: true): AbstractCache[];
39
- /**
40
- * @description
41
- * Returns the {@link TransactionItemHandler.entries ItemCache} of the transaction
42
- */
43
- getCurrentItemEntryCache(): ItemCache;
44
- abstract getServerCache(): ServerCache;
45
- abstract getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry | undefined;
46
- abstract getLocalItemEntryByItemId(itemType: ApiEnumItemType, itemId: ItemEntry['itemId']): ItemEntry | undefined;
47
- /**
48
- * @description
49
- * Applies changes from a child transaction to a parent
50
- */
51
- abstract applyChangesFromChild(transaction: TransactionCache, breakUpByParent?: boolean, onAfterCreateCallback?: OnAfterCreateCallback): PromiseInterface<ItemIdConversionMap>;
52
- /**
53
- * @description
54
- * Called by a parent transaction, propagates changes downwards to all child caches
55
- *
56
- * @remarks
57
- * - Should only be used by the core
58
- *
59
- * todo[cache] Should we refetch derived values just like in applyChangesDelta ?
60
- *
61
- * @internal
62
- */
63
- abstract applyChangesFromParent(parentChangesDelta: ParentChangesDelta, isCalledAfterSocketUpdate: boolean): void;
64
- abstract getParent<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean, providedFields?: FieldMap<ItemTypeType>): EntryParentNull;
65
- abstract getLocalItemEntryChangesTuple<ItemTypeType extends ApiEnumItemType>(itemEntryId: ItemEntry<ItemTypeType>['id']): ItemEntryChangesTuple<ItemTypeType>;
66
- abstract applyChangesDelta(changesDelta: ChangesDelta): PromiseInterface<ChangesDeltaResult>;
67
- /**
68
- * Differs from {@link getParent getParent} that it only does minimal field lookups (but you cannot provide it with fields) instead of doing {@link ItemHandlerBase.collectFields collectFields}
69
- * todo: clean this up some time (merge the 2 functions)
70
- *
71
- * @param itemEntry
72
- */
73
- getParentFast(itemEntry: ItemEntry): EntryParentNull;
74
- protected getParentFromFields<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fields?: FieldMap<ItemTypeType>): EntryParentNull;
75
- /**
76
- * @description
77
- * Called by applyChangesDelta from ServerCache and TransactionCache. Applies creates, updates and moves, doesn't apply deletes
78
- *
79
- * @private
80
- */
81
- protected _applyChangesDelta(changesDelta: ChangesDelta | InternalChangesDelta): {
82
- result: ChangesDeltaResult;
83
- parentChangesDelta: ParentChangesDelta;
84
- matchingDelta: ParentChangesDelta;
85
- undoFunctions: ((changesDelta: InternalChangesDelta) => void)[];
86
- };
87
- /**
88
- * @description
89
- * Ensures that for all updated items in the delta the required derived values are present
90
- */
91
- protected fetchUpdatedDerivedValuesFromDelta(changesDelta: ChangesDeltaBase): PromiseInterface<void>;
92
- }
1
+ import { ApiEnumItemType } from '@rentman/backend-types';
2
+ import { RmCore } from '../../core';
3
+ import { AbstractCacheDependencyInterface, ApiRequestColumnArray, CachedQueryItem, ChangesDelta, ChangesDeltaBase, ChangesDeltaResult, CollectionQuery, CollectionResourceParentIdMap, EntryParentNull, FieldMap, InternalChangesDelta, ItemCache, ItemEntry, ItemEntryChangesTuple, ItemHandlerBase, ItemIdConversionMap, OnAfterCreateCallback, ParentChangesDelta, PromiseInterface, ServerCache, ServerCachedQueryHandler, TransactionCache, TransactionCachedQueryHandler, TransactionValidatorFactory } from '../../internal';
4
+ export declare type TransactionOptions = {
5
+ /**
6
+ * @description
7
+ * Sets the TransactionCache to 'transparent' mode, whenever {@link AbstractCache.createChild createChild} is called it will actually be called on the parent
8
+ */
9
+ transparent: boolean;
10
+ };
11
+ export declare abstract class AbstractCache {
12
+ dependencies: AbstractCacheDependencyInterface;
13
+ core: RmCore;
14
+ children: TransactionCache[];
15
+ readonly itemHandler: ItemHandlerBase;
16
+ readonly cachedQueryHandler: TransactionCachedQueryHandler | ServerCachedQueryHandler;
17
+ parent: AbstractCache | null;
18
+ protected constructor(dependencies: AbstractCacheDependencyInterface, core: RmCore);
19
+ abstract createChild(id?: string, validatorFactory?: TransactionValidatorFactory, options?: TransactionOptions): TransactionCache;
20
+ onChildDestroy(cache: TransactionCache): void;
21
+ /**
22
+ * @description
23
+ * Expands the items in the collections with the passed columns
24
+ *
25
+ * todo[limit] move to TransactionCache ?
26
+ */
27
+ abstract expandCollectionResources<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, collections: CollectionResourceParentIdMap<ItemTypeType>, newColumns: ApiRequestColumnArray): PromiseInterface<CollectionResourceParentIdMap>;
28
+ /**
29
+ * @description
30
+ * Returns {@link ItemEntry ItemEntries} that fit the collection's query, copies over the collectionChanges on all transactions in the chain.
31
+ */
32
+ abstract getCollectionChangesRecursively<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery): CachedQueryItem<ItemTypeType> | undefined;
33
+ /**
34
+ * @description
35
+ * Returns this transaction and all parents
36
+ */
37
+ getTransactionChain(includeServerCache: false): TransactionCache[];
38
+ getTransactionChain(includeServerCache?: true): AbstractCache[];
39
+ /**
40
+ * @description
41
+ * Returns the {@link TransactionItemHandler.entries ItemCache} of the transaction
42
+ */
43
+ getCurrentItemEntryCache(): ItemCache;
44
+ abstract getServerCache(): ServerCache;
45
+ abstract getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry | undefined;
46
+ abstract getLocalItemEntryByItemId(itemType: ApiEnumItemType, itemId: ItemEntry['itemId']): ItemEntry | undefined;
47
+ /**
48
+ * @description
49
+ * Applies changes from a child transaction to a parent
50
+ */
51
+ abstract applyChangesFromChild(transaction: TransactionCache, breakUpByParent?: boolean, onAfterCreateCallback?: OnAfterCreateCallback): PromiseInterface<ItemIdConversionMap>;
52
+ /**
53
+ * @description
54
+ * Called by a parent transaction, propagates changes downwards to all child caches
55
+ *
56
+ * @remarks
57
+ * - Should only be used by the core
58
+ *
59
+ * todo[cache] Should we refetch derived values just like in applyChangesDelta ?
60
+ *
61
+ * @internal
62
+ */
63
+ abstract applyChangesFromParent(parentChangesDelta: ParentChangesDelta, isCalledAfterSocketUpdate: boolean): void;
64
+ getParent<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean): EntryParentNull;
65
+ abstract getLocalItemEntryChangesTuple<ItemTypeType extends ApiEnumItemType>(itemEntryId: ItemEntry<ItemTypeType>['id']): ItemEntryChangesTuple<ItemTypeType>;
66
+ abstract applyChangesDelta(changesDelta: ChangesDelta): PromiseInterface<ChangesDeltaResult>;
67
+ protected getParentFromFields<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fields?: FieldMap<ItemTypeType>): EntryParentNull;
68
+ /**
69
+ * @description
70
+ * Called by applyChangesDelta from ServerCache and TransactionCache. Applies creates, updates and moves, doesn't apply deletes
71
+ *
72
+ * @private
73
+ */
74
+ protected _applyChangesDelta(changesDelta: ChangesDelta | InternalChangesDelta): {
75
+ result: ChangesDeltaResult;
76
+ parentChangesDelta: ParentChangesDelta;
77
+ matchingDelta: ParentChangesDelta;
78
+ undoFunctions: ((changesDelta: InternalChangesDelta) => void)[];
79
+ };
80
+ /**
81
+ * @description
82
+ * Ensures that for all updated items in the delta the required derived values are present
83
+ */
84
+ protected fetchUpdatedDerivedValuesFromDelta(changesDelta: ChangesDeltaBase): PromiseInterface<void>;
85
+ }
@@ -1,70 +1,70 @@
1
- import { ApiEnumItemType } from '@rentman/backend-types';
2
- import { AbstractCache, ApiQuery, ApiRequestLimit, CachedQueryItem, CollectionEntryService, CollectionOptions, CollectionQuery, ColumnUtil, EntryParentNull, ItemEntry, ParentItemMap, PromiseInterface, PromiseLibraryInterface, RequestColumnExpansionFactory, RequestColumnsOperationsCache, RequestColumnsOperationsCacheFactory, RequestColumnsTuple } from '../../internal';
3
- export declare type CachedQueryItemTree<ItemTypeType extends ApiEnumItemType = any> = {
4
- item: CachedQueryItem<ItemTypeType>;
5
- children: ParentItemMap<CachedQueryItemTree> | null;
6
- };
7
- /**
8
- * We're using a subset of the collection options here, because whenever we access the columns, we'd want to do it
9
- * through the columns operations cache.
10
- */
11
- export declare type CachedQueryOptions = {
12
- limit: ApiRequestLimit | null;
13
- preventCaching: boolean;
14
- usePrivateBuffer: boolean;
15
- parent: EntryParentNull;
16
- };
17
- export declare abstract class CachedQueryHandlerBase {
18
- protected collectionEntryService: CollectionEntryService;
19
- protected columnUtil: ColumnUtil;
20
- protected requestColumnExpansionFactory: RequestColumnExpansionFactory;
21
- protected requestColumnsOperationsCacheFactory: RequestColumnsOperationsCacheFactory;
22
- protected promiseService: PromiseLibraryInterface;
23
- protected transaction: AbstractCache;
24
- /**
25
- * @description
26
- * Items (per ItemType) that fit in a query
27
- *
28
- * @remark
29
- * Contains the requestColumns so that new items can include these columns (saving requests when they match)
30
- */
31
- cachedQueries: {
32
- [itemType: string]: {
33
- [queryString: string]: CachedQueryItem;
34
- };
35
- };
36
- protected constructor(collectionEntryService: CollectionEntryService, columnUtil: ColumnUtil, requestColumnExpansionFactory: RequestColumnExpansionFactory, requestColumnsOperationsCacheFactory: RequestColumnsOperationsCacheFactory, promiseService: PromiseLibraryInterface, transaction: AbstractCache);
37
- /**
38
- * Every time a cached query item is created, either 'resolve' or 'reject' has to be called on the cached query item.
39
- */
40
- setCachedQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, requestColumnsTuple: RequestColumnsTuple, itemEntries?: ItemEntry<ItemTypeType>[]): CachedQueryItem<ItemTypeType>;
41
- getCachedQueryItems<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, queryString: string): undefined | ItemEntry<ItemTypeType>[];
42
- getCachedQueryObjectsByItemType(itemType: ApiEnumItemType): CachedQueryItem[];
43
- /**
44
- * @description
45
- * Fetches collections linked to the passed parents
46
- */
47
- abstract __fetchItemEntriesByQueryData<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, options: CachedQueryOptions, columnsOperationsCache: RequestColumnsOperationsCache<ItemTypeType>, collectionQuery: CollectionQuery, batchedLinkedToQuery?: CollectionQuery): PromiseInterface<CachedQueryItem<ItemTypeType>>;
48
- /**
49
- * @description
50
- * Removes the passed {@link ItemId ItemIds} from the Transaction's query cache
51
- */
52
- __removeItemEntriesFromCachedQueries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: ItemEntry<ItemTypeType>[]): ItemEntry<ItemTypeType>[];
53
- abstract __expandCachedQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, queryString: string, columnsOperationsCache: RequestColumnsOperationsCache<ItemTypeType>, usePrivateBuffer: boolean, batchedLinkedToQuery?: CollectionQuery): PromiseInterface<CachedQueryItem<ItemTypeType>>;
54
- /**
55
- * @description
56
- * Expands the option's {@link CollectionOptions.columns columns} with the columns required for the {@link CacheSyncer CacheSyncer} to function.
57
- * Data fetched for a parent transaction might also fit in a child transaction, so those {@link CollectionOptions.queryColumns queryColumns} should also be taken into account
58
- */
59
- expandColumnsWithQueryColumns(itemType: ApiEnumItemType, options: CollectionOptions, query: ApiQuery): void;
60
- /**
61
- * Every time a cached query item is created, either 'resolve' or 'reject' has to be called on the cached query item.
62
- */
63
- protected constructCachedQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: ItemEntry<ItemTypeType>[], requestColumnsTuple: RequestColumnsTuple): CachedQueryItem<ItemTypeType>;
64
- /**
65
- * @description
66
- * Adds the passed {@link ItemEntry ItemEntries} to the Transaction's query cache,
67
- * will skip the ItemEntry if the `skipEntryFilterFn` callback returns `true`
68
- */
69
- protected __addItemEntriesToCachedQueries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: ItemEntry<ItemTypeType>[], skipEntryFilterFn: (temEntry: ItemEntry) => boolean): void;
70
- }
1
+ import { ApiEnumItemType } from '@rentman/backend-types';
2
+ import { AbstractCache, ApiQuery, ApiRequestLimit, CachedQueryItem, CollectionEntryService, CollectionOptions, CollectionQuery, ColumnUtil, EntryParentNull, ItemEntry, ParentItemMap, PromiseInterface, PromiseLibraryInterface, RequestColumnExpansionFactory, RequestColumnsOperationsCache, RequestColumnsOperationsCacheFactory, RequestColumnsTuple } from '../../internal';
3
+ export declare type CachedQueryItemTree<ItemTypeType extends ApiEnumItemType = any> = {
4
+ item: CachedQueryItem<ItemTypeType>;
5
+ children: ParentItemMap<CachedQueryItemTree> | null;
6
+ };
7
+ /**
8
+ * We're using a subset of the collection options here, because whenever we access the columns, we'd want to do it
9
+ * through the columns operations cache.
10
+ */
11
+ export declare type CachedQueryOptions = {
12
+ limit: ApiRequestLimit | null;
13
+ preventCaching: boolean;
14
+ usePrivateBuffer: boolean;
15
+ parent: EntryParentNull;
16
+ };
17
+ export declare abstract class CachedQueryHandlerBase {
18
+ protected collectionEntryService: CollectionEntryService;
19
+ protected columnUtil: ColumnUtil;
20
+ protected requestColumnExpansionFactory: RequestColumnExpansionFactory;
21
+ protected requestColumnsOperationsCacheFactory: RequestColumnsOperationsCacheFactory;
22
+ protected promiseService: PromiseLibraryInterface;
23
+ protected transaction: AbstractCache;
24
+ /**
25
+ * @description
26
+ * Items (per ItemType) that fit in a query
27
+ *
28
+ * @remark
29
+ * Contains the requestColumns so that new items can include these columns (saving requests when they match)
30
+ */
31
+ cachedQueries: {
32
+ [itemType: string]: {
33
+ [queryString: string]: CachedQueryItem;
34
+ };
35
+ };
36
+ protected constructor(collectionEntryService: CollectionEntryService, columnUtil: ColumnUtil, requestColumnExpansionFactory: RequestColumnExpansionFactory, requestColumnsOperationsCacheFactory: RequestColumnsOperationsCacheFactory, promiseService: PromiseLibraryInterface, transaction: AbstractCache);
37
+ /**
38
+ * Every time a cached query item is created, either 'resolve' or 'reject' has to be called on the cached query item.
39
+ */
40
+ setCachedQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, requestColumnsTuple: RequestColumnsTuple, itemEntries?: ItemEntry<ItemTypeType>[]): CachedQueryItem<ItemTypeType>;
41
+ getCachedQueryItems<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, queryString: string): undefined | ItemEntry<ItemTypeType>[];
42
+ getCachedQueryObjectsByItemType(itemType: ApiEnumItemType): CachedQueryItem[];
43
+ /**
44
+ * @description
45
+ * Fetches collections linked to the passed parents
46
+ */
47
+ abstract __fetchItemEntriesByQueryData<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, options: CachedQueryOptions, columnsOperationsCache: RequestColumnsOperationsCache<ItemTypeType>, collectionQuery: CollectionQuery, batchedLinkedToQuery?: CollectionQuery): PromiseInterface<CachedQueryItem<ItemTypeType>>;
48
+ /**
49
+ * @description
50
+ * Removes the passed {@link ItemId ItemIds} from the Transaction's query cache
51
+ */
52
+ __removeItemEntriesFromCachedQueries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: ItemEntry<ItemTypeType>[]): ItemEntry<ItemTypeType>[];
53
+ abstract __expandCachedQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, queryString: string, columnsOperationsCache: RequestColumnsOperationsCache<ItemTypeType>, usePrivateBuffer: boolean, batchedLinkedToQuery?: CollectionQuery): PromiseInterface<CachedQueryItem<ItemTypeType>>;
54
+ /**
55
+ * @description
56
+ * Expands the option's {@link CollectionOptions.columns columns} with the columns required for the {@link CacheSyncer CacheSyncer} to function.
57
+ * Data fetched for a parent transaction might also fit in a child transaction, so those {@link CollectionOptions.queryColumns queryColumns} should also be taken into account
58
+ */
59
+ expandColumnsWithQueryColumns(itemType: ApiEnumItemType, options: CollectionOptions, query: ApiQuery): void;
60
+ /**
61
+ * Every time a cached query item is created, either 'resolve' or 'reject' has to be called on the cached query item.
62
+ */
63
+ protected constructCachedQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: ItemEntry<ItemTypeType>[], requestColumnsTuple: RequestColumnsTuple): CachedQueryItem<ItemTypeType>;
64
+ /**
65
+ * @description
66
+ * Adds the passed {@link ItemEntry ItemEntries} to the Transaction's query cache,
67
+ * will skip the ItemEntry if the `skipEntryFilterFn` callback returns `true`
68
+ */
69
+ protected __addItemEntriesToCachedQueries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: ItemEntry<ItemTypeType>[], skipEntryFilterFn: (temEntry: ItemEntry) => boolean): void;
70
+ }
@@ -1,107 +1,107 @@
1
- import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
2
- import { AbstractCache, ApiFormatter, ApiQuery, ChangesDeltaBase, ChangesDeltaItemCreateDelta, ChangesDeltaItemUpdateDelta, ColumnInfo, ColumnUtil, ErrorHandlerInterface, FieldMap, ItemCache, ItemCacheFactory, ItemEntry, ItemEntryFactory, ItemEntryOptions, ItemTypeColumnId, PromiseInterface, PromiseLibraryInterface, RequestColumnExpansionFactory } from '../../internal';
3
- export declare enum ItemCacheStatus {
4
- CACHED = "cached",
5
- NOT_CACHED = "not_cached",
6
- NO_CHANGES = "no_changes"
7
- }
8
- export interface ItemEntryChangesTuple<ItemTypeType extends ApiEnumItemType> {
9
- entry: ItemEntry<ItemTypeType>;
10
- changes: FieldMap<ItemTypeType>;
11
- }
12
- export declare type ProcessItemEntryChangesResult<ItemTypeType extends ApiEnumItemType> = {
13
- status: ItemCacheStatus.NO_CHANGES | ItemCacheStatus.NOT_CACHED;
14
- previous: {
15
- rollback: null;
16
- complete: null | FieldMap<ItemTypeType>;
17
- };
18
- } | {
19
- status: ItemCacheStatus.CACHED;
20
- previous: {
21
- rollback: Partial<FieldMap<ItemTypeType>>;
22
- complete: null | FieldMap<ItemTypeType>;
23
- };
24
- };
25
- export declare abstract class ItemHandlerBase {
26
- protected columnUtil: ColumnUtil;
27
- protected apiFormatter: ApiFormatter;
28
- protected itemEntryFactory: ItemEntryFactory;
29
- protected promiseService: PromiseLibraryInterface;
30
- protected errorHandler: ErrorHandlerInterface;
31
- protected requestColumnExpansionFactory: RequestColumnExpansionFactory;
32
- protected transaction: AbstractCache;
33
- readonly entries: ItemCache;
34
- itemChanges: {
35
- [itemEntryId: number]: FieldMap;
36
- };
37
- protected constructor(columnUtil: ColumnUtil, apiFormatter: ApiFormatter, itemEntryFactory: ItemEntryFactory, promiseService: PromiseLibraryInterface, errorHandler: ErrorHandlerInterface, requestColumnExpansionFactory: RequestColumnExpansionFactory, itemCacheFactory: ItemCacheFactory, transaction: AbstractCache);
38
- lookUpItemField<ItemTypeType extends ApiEnumItemType, ColumnId extends ItemTypeColumnId<ItemTypeType>>(entry: ItemEntry<ItemTypeType>, columnId: ColumnId): undefined | FieldMap<ItemTypeType>[ColumnId];
39
- collectFields<ItemTypeType extends ApiEnumItemType>(itemEntry: ItemEntry<ItemTypeType>): FieldMap<ItemTypeType>;
40
- /**
41
- * @description
42
- * Copies the passed ItemEntryChanges into a format the implementing ItemHandler can put in his ItemChanges
43
- * @param itemEntryChanges
44
- * @param entry
45
- */
46
- copyTransactionItemEntryChanges<ItemTypeType extends ApiEnumItemType>(itemEntryChanges: FieldMap<ItemTypeType>, entry: ItemEntry<ItemTypeType>): FieldMap<ItemTypeType>;
47
- /**
48
- * @description
49
- * Fetches the ItemEntries for the given query, does not look in the cache, since we don't know which ItemIds belong to the query !
50
- */
51
- abstract fetchItemEntriesByQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, query: ApiQuery, entryOptions: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>[]>;
52
- /**
53
- * @description
54
- * Fetches the ItemEntries for the given ItemIds
55
- */
56
- abstract fetchItemEntries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>[]>;
57
- /**
58
- * @description
59
- * Fetches an ItemEntry with the given itemId
60
- */
61
- abstract fetchItemEntry<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemEntryOptions, isRoot?: boolean): PromiseInterface<ItemEntry<ItemTypeType>>;
62
- /**
63
- * @description
64
- * Processes the passed {@link ChangesDeltaItemUpdateDelta update delta} on the transaction, if there are no {@link TransactionItemHandler.itemChanges itemChanges} the new values will not be processed
65
- */
66
- abstract processItemEntryChanges<ItemTypeType extends ApiEnumItemType>(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, isCalledAfterSocketUpdate: boolean, createItemChangesIfNoneExist: boolean): ProcessItemEntryChangesResult<ItemTypeType>;
67
- /**
68
- * @description
69
- * Traverses the column path and returns the fields of the derived item, returns undefined if the item isn't found
70
- *
71
- * ---------------------
72
- *
73
- * @remark
74
- * Assumes the derived item's values are already cached
75
- */
76
- getDerivedValues(itemEntry: ItemEntry, columnPath: string[]): Readonly<FieldMap> | undefined;
77
- /**
78
- * @description
79
- * Returns the value of the columnPath, or undefined when the path couldn't be traversed
80
- *
81
- * @param itemEntry The root entry to start the path from
82
- * @param columnPath Can either be an array of columnIds (['column', 'column2']) or a config column string ('column>column2')
83
- */
84
- getDerivedValue<T extends any = any>(itemEntry: ItemEntry, columnPath: string[] | string): T | undefined;
85
- /**
86
- * @description
87
- * Clears the entry from this transaction, removing it from the {@link ItemCache ItemCache} and removing all changes
88
- */
89
- clearItemEntry(entry: ItemEntry): void;
90
- /**
91
- * @description
92
- * Recursively fetches derived values as separate requests, instead of as columns of a primary item
93
- * Can be used when derived values of a local item have to be fetched, since a local item can't be used as root item of a query
94
- */
95
- fetchDerivedValuesByColumn<ItemTypeType extends ApiEnumItemType>(itemEntries: ItemEntry<ItemTypeType>[], rootColumn: ColumnInfo<ItemTypeType>, changesDelta?: ChangesDeltaBase): PromiseInterface<void | ItemEntry<ItemTypeType>[]>;
96
- resolveDerivedValues<ItemTypeType extends ApiEnumItemType>(itemEntries: ItemEntry<ItemTypeType>[], columns: ColumnInfo<ItemTypeType>[], changesDelta?: ChangesDeltaBase): PromiseInterface<ItemEntry<ItemTypeType>[]>;
97
- /**
98
- * @description
99
- * Creates a new {@link ItemEntry ItemEntry} from the passed {@link ChangesDeltaItemCreateDelta ChangesDeltaItemCreateDelta} and stores it in this transaction's {@link ItemCache ItemCache}
100
- */
101
- createItemEntry(createTuple: ChangesDeltaItemCreateDelta): ItemEntry;
102
- /**
103
- * @description
104
- * Gets the value of the given column, will look into the current delta before attempting to read itemChanges
105
- */
106
- protected getItemIdByColumn<ItemTypeType extends ApiEnumItemType>(itemEntry: ItemEntry<ItemTypeType>, column: ColumnInfo<ItemTypeType>, changesDelta?: ChangesDeltaBase): ItemId;
107
- }
1
+ import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
2
+ import { AbstractCache, ApiFormatter, ApiQuery, ChangesDeltaBase, ChangesDeltaItemCreateDelta, ChangesDeltaItemUpdateDelta, ColumnInfo, ColumnUtil, ErrorHandlerInterface, FieldMap, ItemCache, ItemCacheFactory, ItemEntry, ItemEntryFactory, ItemEntryOptions, ItemTypeColumnId, PromiseInterface, PromiseLibraryInterface, RequestColumnExpansionFactory } from '../../internal';
3
+ export declare enum ItemCacheStatus {
4
+ CACHED = "cached",
5
+ NOT_CACHED = "not_cached",
6
+ NO_CHANGES = "no_changes"
7
+ }
8
+ export interface ItemEntryChangesTuple<ItemTypeType extends ApiEnumItemType> {
9
+ entry: ItemEntry<ItemTypeType>;
10
+ changes: FieldMap<ItemTypeType>;
11
+ }
12
+ export declare type ProcessItemEntryChangesResult<ItemTypeType extends ApiEnumItemType> = {
13
+ status: ItemCacheStatus.NO_CHANGES | ItemCacheStatus.NOT_CACHED;
14
+ previous: {
15
+ rollback: null;
16
+ complete: null | FieldMap<ItemTypeType>;
17
+ };
18
+ } | {
19
+ status: ItemCacheStatus.CACHED;
20
+ previous: {
21
+ rollback: Partial<FieldMap<ItemTypeType>>;
22
+ complete: null | FieldMap<ItemTypeType>;
23
+ };
24
+ };
25
+ export declare abstract class ItemHandlerBase {
26
+ protected columnUtil: ColumnUtil;
27
+ protected apiFormatter: ApiFormatter;
28
+ protected itemEntryFactory: ItemEntryFactory;
29
+ protected promiseService: PromiseLibraryInterface;
30
+ protected errorHandler: ErrorHandlerInterface;
31
+ protected requestColumnExpansionFactory: RequestColumnExpansionFactory;
32
+ protected transaction: AbstractCache;
33
+ readonly entries: ItemCache;
34
+ itemChanges: {
35
+ [itemEntryId: number]: FieldMap;
36
+ };
37
+ protected constructor(columnUtil: ColumnUtil, apiFormatter: ApiFormatter, itemEntryFactory: ItemEntryFactory, promiseService: PromiseLibraryInterface, errorHandler: ErrorHandlerInterface, requestColumnExpansionFactory: RequestColumnExpansionFactory, itemCacheFactory: ItemCacheFactory, transaction: AbstractCache);
38
+ lookUpItemField<ItemTypeType extends ApiEnumItemType, ColumnId extends ItemTypeColumnId<ItemTypeType>>(entry: ItemEntry<ItemTypeType>, columnId: ColumnId): undefined | FieldMap<ItemTypeType>[ColumnId];
39
+ collectFields<ItemTypeType extends ApiEnumItemType>(itemEntry: ItemEntry<ItemTypeType>): FieldMap<ItemTypeType>;
40
+ /**
41
+ * @description
42
+ * Copies the passed ItemEntryChanges into a format the implementing ItemHandler can put in his ItemChanges
43
+ * @param itemEntryChanges
44
+ * @param entry
45
+ */
46
+ copyTransactionItemEntryChanges<ItemTypeType extends ApiEnumItemType>(itemEntryChanges: FieldMap<ItemTypeType>, entry: ItemEntry<ItemTypeType>): FieldMap<ItemTypeType>;
47
+ /**
48
+ * @description
49
+ * Fetches the ItemEntries for the given query, does not look in the cache, since we don't know which ItemIds belong to the query !
50
+ */
51
+ abstract fetchItemEntriesByQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, query: ApiQuery, entryOptions: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>[]>;
52
+ /**
53
+ * @description
54
+ * Fetches the ItemEntries for the given ItemIds
55
+ */
56
+ abstract fetchItemEntries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>[]>;
57
+ /**
58
+ * @description
59
+ * Fetches an ItemEntry with the given itemId
60
+ */
61
+ abstract fetchItemEntry<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemEntryOptions, isRoot?: boolean): PromiseInterface<ItemEntry<ItemTypeType>>;
62
+ /**
63
+ * @description
64
+ * Processes the passed {@link ChangesDeltaItemUpdateDelta update delta} on the transaction, if there are no {@link TransactionItemHandler.itemChanges itemChanges} the new values will not be processed
65
+ */
66
+ abstract processItemEntryChanges<ItemTypeType extends ApiEnumItemType>(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, isCalledAfterSocketUpdate: boolean, createItemChangesIfNoneExist: boolean): ProcessItemEntryChangesResult<ItemTypeType>;
67
+ /**
68
+ * @description
69
+ * Traverses the column path and returns the fields of the derived item, returns undefined if the item isn't found
70
+ *
71
+ * ---------------------
72
+ *
73
+ * @remark
74
+ * Assumes the derived item's values are already cached
75
+ */
76
+ getDerivedValues(itemEntry: ItemEntry, columnPath: string[]): Readonly<FieldMap> | undefined;
77
+ /**
78
+ * @description
79
+ * Returns the value of the columnPath, or undefined when the path couldn't be traversed
80
+ *
81
+ * @param itemEntry The root entry to start the path from
82
+ * @param columnPath Can either be an array of columnIds (['column', 'column2']) or a config column string ('column>column2')
83
+ */
84
+ getDerivedValue<T extends any = any>(itemEntry: ItemEntry, columnPath: string[] | string): T | undefined;
85
+ /**
86
+ * @description
87
+ * Clears the entry from this transaction, removing it from the {@link ItemCache ItemCache} and removing all changes
88
+ */
89
+ clearItemEntry(entry: ItemEntry): void;
90
+ /**
91
+ * @description
92
+ * Recursively fetches derived values as separate requests, instead of as columns of a primary item
93
+ * Can be used when derived values of a local item have to be fetched, since a local item can't be used as root item of a query
94
+ */
95
+ fetchDerivedValuesByColumn<ItemTypeType extends ApiEnumItemType>(itemEntries: ItemEntry<ItemTypeType>[], rootColumn: ColumnInfo<ItemTypeType>, changesDelta?: ChangesDeltaBase): PromiseInterface<void | ItemEntry<ItemTypeType>[]>;
96
+ resolveDerivedValues<ItemTypeType extends ApiEnumItemType>(itemEntries: ItemEntry<ItemTypeType>[], columns: ColumnInfo<ItemTypeType>[], changesDelta?: ChangesDeltaBase): PromiseInterface<ItemEntry<ItemTypeType>[]>;
97
+ /**
98
+ * @description
99
+ * Creates a new {@link ItemEntry ItemEntry} from the passed {@link ChangesDeltaItemCreateDelta ChangesDeltaItemCreateDelta} and stores it in this transaction's {@link ItemCache ItemCache}
100
+ */
101
+ createItemEntry(createTuple: ChangesDeltaItemCreateDelta): ItemEntry;
102
+ /**
103
+ * @description
104
+ * Gets the value of the given column, will look into the current delta before attempting to read itemChanges
105
+ */
106
+ protected getItemIdByColumn<ItemTypeType extends ApiEnumItemType>(itemEntry: ItemEntry<ItemTypeType>, column: ColumnInfo<ItemTypeType>, changesDelta?: ChangesDeltaBase): ItemId;
107
+ }