@rentman/rm-core 3.0.0 → 3.1.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.
Files changed (110) hide show
  1. package/changelog.md +668 -665
  2. package/dist/rm-core.js +9780 -9910
  3. package/dist/rm-core.min.js +2 -2
  4. package/dist/types/classes/ApiFormatter.d.ts +55 -55
  5. package/dist/types/classes/ApiRequestService.d.ts +20 -20
  6. package/dist/types/classes/ApiResponseProcessor.d.ts +31 -30
  7. package/dist/types/classes/ChangesCompilation.d.ts +34 -34
  8. package/dist/types/classes/ChangesDelta.d.ts +59 -62
  9. package/dist/types/classes/ChangesDeltaBase.d.ts +50 -49
  10. package/dist/types/classes/ChangesProcessor.d.ts +47 -47
  11. package/dist/types/classes/CollectionCache.d.ts +38 -38
  12. package/dist/types/classes/CollectionEntryService.d.ts +25 -25
  13. package/dist/types/classes/CollectionMatcher.d.ts +9 -9
  14. package/dist/types/classes/CollectionMatcherBase.d.ts +26 -26
  15. package/dist/types/classes/CollectionResourceService.d.ts +6 -6
  16. package/dist/types/classes/ColumnCache.d.ts +21 -21
  17. package/dist/types/classes/ColumnExpansion.d.ts +22 -22
  18. package/dist/types/classes/ColumnHandler.d.ts +21 -21
  19. package/dist/types/classes/ColumnInfo.d.ts +14 -14
  20. package/dist/types/classes/ColumnSet.d.ts +39 -39
  21. package/dist/types/classes/ColumnSubsetCache.d.ts +8 -8
  22. package/dist/types/classes/ColumnUtil.d.ts +99 -99
  23. package/dist/types/classes/ConversionMapService.d.ts +27 -0
  24. package/dist/types/classes/CreateRequest.d.ts +19 -19
  25. package/dist/types/classes/CreatedChangesDelta.d.ts +15 -0
  26. package/dist/types/classes/InternalChangesDelta.d.ts +39 -38
  27. package/dist/types/classes/ItemCache.d.ts +29 -29
  28. package/dist/types/classes/ItemCreateService.d.ts +24 -28
  29. package/dist/types/classes/ItemEntryService.d.ts +34 -41
  30. package/dist/types/classes/KeyService.d.ts +16 -16
  31. package/dist/types/classes/LockService.d.ts +32 -32
  32. package/dist/types/classes/ModuleChangesCompilation.d.ts +18 -18
  33. package/dist/types/classes/QueryColumnExtractor.d.ts +20 -20
  34. package/dist/types/classes/QueryMatcher.d.ts +14 -14
  35. package/dist/types/classes/QueryParser.d.ts +25 -25
  36. package/dist/types/classes/QueryParserBase.d.ts +29 -29
  37. package/dist/types/classes/QueryService.d.ts +14 -14
  38. package/dist/types/classes/RequestBuffer.d.ts +28 -28
  39. package/dist/types/classes/RequestBufferManager.d.ts +24 -24
  40. package/dist/types/classes/RequestColumnExpansion.d.ts +15 -15
  41. package/dist/types/classes/SocketMessageHandler.d.ts +31 -31
  42. package/dist/types/classes/TemplateCache.d.ts +66 -66
  43. package/dist/types/classes/Util.d.ts +30 -30
  44. package/dist/types/classes/cache/AbstractCache.d.ts +101 -149
  45. package/dist/types/classes/cache/CollectionHandlerBase.d.ts +68 -68
  46. package/dist/types/classes/cache/CollectionMatcherCacheProcessor.d.ts +26 -26
  47. package/dist/types/classes/cache/ItemHandlerBase.d.ts +95 -95
  48. package/dist/types/classes/cache/server/ServerCache.d.ts +83 -100
  49. package/dist/types/classes/cache/server/ServerCollectionHandler.d.ts +44 -44
  50. package/dist/types/classes/cache/server/ServerItemHandler.d.ts +51 -50
  51. package/dist/types/classes/cache/transaction/TransactionCache.d.ts +344 -366
  52. package/dist/types/classes/cache/transaction/TransactionCollectionHandler.d.ts +62 -73
  53. package/dist/types/classes/cache/transaction/TransactionEventHandler.d.ts +24 -24
  54. package/dist/types/classes/cache/transaction/TransactionItemHandler.d.ts +99 -110
  55. package/dist/types/classes/cache/transaction/TransactionValidator.d.ts +28 -28
  56. package/dist/types/classes/index.d.ts +46 -44
  57. package/dist/types/constants.d.ts +7 -7
  58. package/dist/types/core.d.ts +52 -51
  59. package/dist/types/factories/ApiResponseProcessorFactory.d.ts +6 -6
  60. package/dist/types/factories/ChangesCompilationFactory.d.ts +6 -6
  61. package/dist/types/factories/ChangesDeltaFactory.d.ts +11 -11
  62. package/dist/types/factories/ChangesProcessorFactory.d.ts +22 -22
  63. package/dist/types/factories/CollectionCacheFactory.d.ts +8 -8
  64. package/dist/types/factories/CollectionEntryFactory.d.ts +11 -11
  65. package/dist/types/factories/CollectionMatcherFactory.d.ts +9 -9
  66. package/dist/types/factories/CollectionResourceFactory.d.ts +16 -16
  67. package/dist/types/factories/ColumnExpansionFactory.d.ts +8 -8
  68. package/dist/types/factories/ColumnInfoFactory.d.ts +7 -7
  69. package/dist/types/factories/ColumnSetFactory.d.ts +19 -19
  70. package/dist/types/factories/ColumnSubsetCacheFactory.d.ts +6 -6
  71. package/dist/types/factories/CreateRequestFactory.d.ts +11 -11
  72. package/dist/types/factories/ItemCacheFactory.d.ts +8 -8
  73. package/dist/types/factories/ItemEntryFactory.d.ts +15 -15
  74. package/dist/types/factories/ItemResourceFactory.d.ts +17 -17
  75. package/dist/types/factories/ModuleChangesCompilationFactory.d.ts +5 -5
  76. package/dist/types/factories/QueryMatcherFactory.d.ts +7 -7
  77. package/dist/types/factories/QueryParserFactory.d.ts +6 -6
  78. package/dist/types/factories/RequestColumnExpansionFactory.d.ts +6 -6
  79. package/dist/types/factories/TemplateFactory.d.ts +10 -10
  80. package/dist/types/factories/TransactionCacheFactory.d.ts +15 -58
  81. package/dist/types/factories/index.d.ts +22 -22
  82. package/dist/types/index.d.ts +7 -7
  83. package/dist/types/interfaces/AbstractCacheDependencyInterface.d.ts +44 -0
  84. package/dist/types/interfaces/ApiRequestServiceInterface.d.ts +11 -11
  85. package/dist/types/interfaces/AuthInterface.d.ts +9 -9
  86. package/dist/types/interfaces/ErrorHandlerInterface.d.ts +5 -5
  87. package/dist/types/interfaces/ExceptionHandlerInterface.d.ts +3 -3
  88. package/dist/types/interfaces/LinkTreeServiceInterface.d.ts +4 -4
  89. package/dist/types/interfaces/PromiseLibraryInterface.d.ts +25 -25
  90. package/dist/types/interfaces/ServerCacheDependencyInterface.d.ts +7 -0
  91. package/dist/types/interfaces/SocketMessageInterface.d.ts +3 -3
  92. package/dist/types/interfaces/TransactionCacheDependencyInterface.d.ts +3 -0
  93. package/dist/types/interfaces/TransactionCollectionHandlerDependencyInterface.d.ts +20 -0
  94. package/dist/types/interfaces/TransactionItemHandlerDependencyInterface.d.ts +26 -0
  95. package/dist/types/interfaces/index.d.ts +12 -7
  96. package/dist/types/models/CollectionEntry.d.ts +27 -27
  97. package/dist/types/models/CollectionEntryOptions.d.ts +13 -13
  98. package/dist/types/models/CollectionResource.d.ts +62 -62
  99. package/dist/types/models/CollectionResourceOptions.d.ts +23 -23
  100. package/dist/types/models/ItemEntry.d.ts +19 -19
  101. package/dist/types/models/ItemEntryOptions.d.ts +8 -8
  102. package/dist/types/models/ItemResource.d.ts +93 -93
  103. package/dist/types/models/ItemResourceOptions.d.ts +6 -6
  104. package/dist/types/models/Template.d.ts +11 -11
  105. package/dist/types/models/index.d.ts +9 -9
  106. package/dist/types/types/ItemTypesCollection.d.ts +262 -262
  107. package/dist/types/types/PromiseInterface.d.ts +2 -2
  108. package/dist/types/types/index.d.ts +2 -2
  109. package/package.json +36 -36
  110. package/readme.md +15 -15
@@ -1,366 +1,344 @@
1
- import { RmCore } from '../../../core';
2
- import { CollectionCacheFactory, CollectionEntryFactory, CollectionMatcherFactory, CollectionResourceFactory, ColumnExpansionFactory, ColumnSetFactory, ColumnSubsetCacheFactory, ItemCacheFactory, ItemEntryFactory, ItemResourceFactory, ModuleChangesCompilationFactory, QueryMatcherFactory, QueryParserFactory, RequestColumnExpansionFactory } from '../../../factories';
3
- import { ChangesDeltaFactory } from '../../../factories/ChangesDeltaFactory';
4
- import { AuthInterface, ErrorHandlerInterface, ExceptionHandlerInterface, PromiseLibraryInterface } from '../../../interfaces';
5
- import { LinkTreeServiceInterface } from '../../../interfaces/LinkTreeServiceInterface';
6
- import { CollectionEntry, CollectionResource, CollectionResourceOptionsInterface, ItemEntry, ItemResource } from '../../../models';
7
- import { ApiQuery, CollectionDefinition, CollectionOptionsInterface, CollectionResourceParentIdMap, ConversionMap, CreateRequestParameterMap, EntryParentNull, FieldMap, ItemId, ItemIdConversionMap, ItemOptionsInterface, ItemResourcesItemTypeMap, ItemType, ItemTypeMap, LinkCollectionDefinition, PromiseInterface } from '../../../types';
8
- import { ChangesDelta } from '../../ChangesDelta';
9
- import { ChangesDeltaResult } from '../../ChangesDeltaBase';
10
- import { CollectionEntryService } from '../../CollectionEntryService';
11
- import { ColumnHandler } from '../../ColumnHandler';
12
- import { ColumnUtil } from '../../ColumnUtil';
13
- import { ApiFormatter, ApiRequestService, ColumnCache, LockService, ModuleChangesCompilationResult, OnAfterCreateCallback, RequestBufferManager, TransactionCacheCallbackCondition, TransactionCacheCallbackType, TransactionCollectionHandler, TransactionItemEntryChanges, TransactionItemHandler, TransactionValidatorFactory } from '../../index';
14
- import { InternalChangesDelta } from '../../InternalChangesDelta';
15
- import { ItemCreateService } from '../../ItemCreateService';
16
- import { ItemEntryService } from '../../ItemEntryService';
17
- import { KeyService } from '../../KeyService';
18
- import { QueryService } from '../../QueryService';
19
- import { TemplateCache } from '../../TemplateCache';
20
- import { AbstractCache } from '../AbstractCache';
21
- import { ServerCache } from '../server/ServerCache';
22
- import { TransactionEventHandler } from './TransactionEventHandler';
23
- declare type ItemResourceLinks<ItemTypeType extends ItemType> = {
24
- main: ItemResource<ItemTypeType>;
25
- linked: ItemResourcesItemTypeMap;
26
- };
27
- export declare enum TransactionErrorLevel {
28
- warning = "warning",
29
- error = "error"
30
- }
31
- /**
32
- * @description
33
- * The {@link TransactionCache TransactionCache} is responsible for keeping track of newly created {@link ItemEntry ItemEntries}
34
- * and {@link CollectionEntry CollectionEntries}, and the changes of existing ItemEntries and CollectionEntries.
35
- *
36
- * The TransactionCache is also responsible for creating {@link ItemResource ItemResources}, which is a combination of an {@link ItemEntry ItemEntry} and the current transaction's changes on this ItemEntry
37
- */
38
- export declare class TransactionCache extends AbstractCache {
39
- /**
40
- * @description
41
- * For debugging purposes
42
- */
43
- id?: string | undefined;
44
- /**
45
- * @description
46
- * A map of all item errors, can be populated using {@link TransactionValidator.setGlobalError TransactionValidator.setGlobalError} and {@link TransactionValidator.setItemError TransactionValidator.setItemError}.
47
- * Contains a translation and level for every error
48
- */
49
- errors: {
50
- item: {
51
- [itemEntryId: string]: {
52
- [columnId: string]: {
53
- [errorKey: string]: {
54
- fieldString: string;
55
- string: string;
56
- level: TransactionErrorLevel;
57
- };
58
- };
59
- };
60
- };
61
- global: {
62
- [key: string]: {
63
- string: string;
64
- level: TransactionErrorLevel;
65
- };
66
- };
67
- };
68
- isValid: boolean;
69
- /**
70
- * @description
71
- * Stores the 'root' {@link ItemEntry ItemEntry}, this {@link ItemEntry ItemEntry} can be used as request parent to store the whole transaction at once
72
- */
73
- rootItem: ItemEntry<any> | undefined;
74
- /**
75
- * @description
76
- * Stores additional request parameters for when the transaction is stored to the server
77
- */
78
- tabRequestParameters: {};
79
- /**
80
- * @description
81
- * Is true while the {@link TransactionCache TransactionCache} is applying changes to the parent (can either be through a merge or an Api save)
82
- */
83
- isSaving: boolean;
84
- /**
85
- * @description
86
- * Is true when the current transaction has:
87
- * - Newly created items
88
- * - Removed items (from collections)
89
- * - Changes on existing items
90
- */
91
- hasChanges: boolean;
92
- /**
93
- * @description
94
- * The transaction's parent
95
- */
96
- readonly parent: AbstractCache;
97
- readonly itemHandler: TransactionItemHandler;
98
- readonly collectionHandler: TransactionCollectionHandler;
99
- readonly eventHandler: TransactionEventHandler;
100
- private readonly validator?;
101
- private changesInterval;
102
- constructor(core: RmCore, columnCache: ColumnCache, requestBufferManager: RequestBufferManager, requestColumnExpansionFactory: RequestColumnExpansionFactory, queryMatcherFactory: QueryMatcherFactory, authInterface: AuthInterface, changesDeltaFactory: ChangesDeltaFactory, lockService: LockService, moduleChangesCompilationFactory: ModuleChangesCompilationFactory, collectionResourceFactory: CollectionResourceFactory, itemResourceFactory: ItemResourceFactory, templateCache: TemplateCache, itemCacheFactory: ItemCacheFactory, collectionCacheFactory: CollectionCacheFactory, errorHandler: ErrorHandlerInterface, exceptionHandler: ExceptionHandlerInterface, promiseService: PromiseLibraryInterface, apiRequestService: ApiRequestService, columnExpansionFactory: ColumnExpansionFactory, columnHandler: ColumnHandler, columnSetFactory: ColumnSetFactory, columnSubsetCacheFactory: ColumnSubsetCacheFactory, columnUtil: ColumnUtil, itemEntryFactory: ItemEntryFactory, itemEntryService: ItemEntryService, keyService: KeyService, collectionEntryFactory: CollectionEntryFactory, collectionEntryService: CollectionEntryService, collectionMatcherFactory: CollectionMatcherFactory, queryParserFactory: QueryParserFactory, queryService: QueryService, apiFormatter: ApiFormatter, linkTreeService: LinkTreeServiceInterface, changesDeltaService: ItemCreateService, parent: AbstractCache,
103
- /**
104
- * @description
105
- * For debugging purposes
106
- */
107
- id?: string | undefined, validatorFactory?: TransactionValidatorFactory);
108
- destroy(): void;
109
- createChangesDelta(): ChangesDelta;
110
- getFirstErrorString(): undefined | string;
111
- /**
112
- * @description
113
- * Should only be called by {@link TransactionValidator TransactionValidator}
114
- * @internal
115
- */
116
- _setGlobalError(key: string, isInvalid: boolean, saveButtonErrorTranslationFn: () => string, level: TransactionErrorLevel): void;
117
- /**
118
- * @description
119
- * Should only be called by {@link TransactionValidator TransactionValidator}
120
- * @internal
121
- */
122
- _setItemError(itemEntryId: ItemEntry['id'], columnId: string, errorKey: string, isInvalid: boolean, fieldErrorTranslationFn: () => string, saveButtonErrorTranslationFn: () => string, level: TransactionErrorLevel): void;
123
- /**
124
- * @internal
125
- */
126
- _setIsValid(): void;
127
- /**
128
- * @description
129
- * Merges the passed changes from the parent Transaction into this Transaction's own changes and then propagates
130
- * them to all child Transactions, this assumes that an action is already handled in a parent, so it does't handle created entries
131
- * and removes entries that were in {@link TransactionItemHandler.deletedItems deletedItems} since they are already deleted
132
- *
133
- * ------------------
134
- *
135
- * The difference between {@link TransactionCache.applyChangesFromParent} and {@link TransactionCache.applyChangesDelta} is that applyChangesFromParent assumes
136
- * the change has already been processed, and applyChangesDelta will process the changes once you save the transaction
137
- *
138
- * ------------------
139
- * Use {@link TransactionCache.applyChangesDelta applyChangesDelta} if you want to apply changes from outside the core
140
- *
141
- * @param internalChangesDelta Changes to be applied
142
- * @param isCalledAfterApiSave If 'isCalledAfterApiSave' is true local changes will always be overwritten (instead of only when there are no changes)
143
- */
144
- applyChangesFromParent(internalChangesDelta: InternalChangesDelta, isCalledAfterApiSave?: boolean, isCalledAfterSocketUpdate?: boolean): void;
145
- /**
146
- * @description
147
- * Applies changes to this transaction and its children
148
- *
149
- * ------------------
150
- *
151
- * The difference between {@link TransactionCache.applyChangesFromParent} and {@link TransactionCache.applyChangesDelta} is that applyChangesFromParent assumes
152
- * the change has already been processed, and applyChangesDelta will process the changes itself (result vs cause)
153
- *
154
- * ------------------
155
- *
156
- * Differs from {@link ServerCache.applyChangesDelta ServerCache.applyChangesDelta} in the handling of deleted entries and the applyChangesFromParent call
157
- */
158
- applyChangesDelta(changesDelta: ChangesDelta): PromiseInterface<ChangesDeltaResult>;
159
- getServerCache(): ServerCache;
160
- /**
161
- * @description
162
- * Gets the entry's parent from the closest transaction
163
- *
164
- * @param itemEntry The entry to get the parent from
165
- * @param fromInitial If `true` the parent values will be read from {@link TransactionItemEntryChanges.initial initial} (Useful for when you've moved an entry)
166
- * @param providedFields Use the provided fields instead of the cached fields, used by {@link CollectionResource.getParent CollectionResource.getParent}
167
- *
168
- * @remark
169
- * Use {@link CollectionResource.getParent CollectionResource.getParent} instead of {@link TransactionCache.getParent TransactionCache.getParent} if you're getting the parent in the onRemove callback
170
- */
171
- getParent<ItemTypeType extends ItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean, providedFields?: FieldMap<ItemTypeType>): EntryParentNull;
172
- getCollectionChangesRecursively(collectionEntryId: CollectionEntry['id']): ItemEntry[];
173
- /**
174
- * @description
175
- * Traverses the transaction chain and returns the changes of the item on the first transaction
176
- *
177
- * @param copyFields If set, will call {@link ApiFormatter.copyFields ApiFormatter.copyFields}, otherwise just returns the object
178
- */
179
- getItemChangesRecursively(itemEntryId: ItemEntry['id'], copyFields?: boolean): FieldMap;
180
- /**
181
- * @description
182
- * Removes the {@link ItemResource ItemResource} from the transaction, preventing the {@link ItemResource.options.onChange the onChange callback} from being called.
183
- * You should call this function when the resource is no longer needed
184
- *
185
- * @remark
186
- * Does not remove changes
187
- */
188
- clearItemResource(resource: ItemResource): void;
189
- /**
190
- * @description
191
- * Removes the {@link CollectionResource CollectionResource} from the transaction, preventing the {@link CollectionResource.options.onAdd onAdd} and {@link CollectionResource.options.onRemove onRemove} callbacks from being called.
192
- * You should call this function when the resource is no longer needed
193
- *
194
- * @remark
195
- * Does not remove changes
196
- */
197
- clearCollectionResource(resource: CollectionResource): void;
198
- /**
199
- * @description
200
- * Returns whether or not the {@link TransactionCache.rootItem rootItem} is uses locks
201
- */
202
- isLockable(): boolean;
203
- /**
204
- * @description
205
- * Disables the transaction's changes watcher, the transaction will no longer automatically detect changes on items
206
- */
207
- disableChangesWatcher(): void;
208
- /**
209
- * @description
210
- * Enables the transaction's changes watcher, the transaction will now automatically detect changes on items
211
- */
212
- enableChangesWatcher(): void;
213
- /**
214
- * @description
215
- * Saves the transaction, this has a different effect depending on the transaction's parent.
216
- *
217
- * - If the parent is another {@link TransactionCache TransactionCache} it will merge the changes of the child transaction in the the parent transaction
218
- * - If the parent is the {@link ServerCache ServerCache} it will save the changes to the APi
219
- */
220
- save(closeTab?: boolean, parameters?: CreateRequestParameterMap, breakUpByParent?: boolean, onAfterCreateCallback?: OnAfterCreateCallback): PromiseInterface<void>;
221
- detectChanges(): boolean;
222
- /**
223
- * @description
224
- * Removes an {@link ItemEntry ItemEntry} through an {@link ItemResource ItemResource} from the {@link TransactionCache TransactionCache} which means that changes on this entry will no longer be tracked.
225
- */
226
- clearItem(itemResource: ItemResource<any>): void;
227
- /**
228
- * @description
229
- * Removes an {@link ItemEntry ItemEntry} from the {@link TransactionCache TransactionCache} which means that changes on this entry will no longer be tracked.
230
- */
231
- clearItemEntry(itemEntry: ItemEntry<any>): void;
232
- /**
233
- * @description
234
- * Removes a {@link CollectionEntry CollectionEntry} through a {@link CollectionResource CollectionResource} from the {@link TransactionCache TransactionCache} which means that changes on this collection will no longer be tracked.
235
- */
236
- clearCollection(collectionResource: CollectionResource<any>): void;
237
- /**
238
- * @description
239
- * Adds a callback that will fire before the transaction is saved, rejecting this callback will prevent the transaction from saving
240
- */
241
- onBeforeSave(key: string, callback: TransactionCacheCallbackType['onBeforeSave'], condition?: TransactionCacheCallbackCondition, priority?: number): () => void;
242
- /**
243
- * @description
244
- * Adds a callback that will fire when the transaction is saved successfully
245
- */
246
- onSaveSuccess(key: string, callback: TransactionCacheCallbackType['onSaveSuccess'], condition?: TransactionCacheCallbackCondition, priority?: number): () => void;
247
- /**
248
- * @description
249
- * Returns a {@link ModuleChangesCompilationResult ModuleChangesCompilationResult} for the transaction
250
- */
251
- getModuleChanges(): ModuleChangesCompilationResult;
252
- /**
253
- * @description
254
- * Updates the passed map with the new {@link ConversionMap CconversionMap} values
255
- */
256
- updateItemIdMap(collectionMap: {
257
- [itemId: number]: any;
258
- }, conversionMap: ConversionMap): void;
259
- /**
260
- * @description
261
- * Clones the {@link CollectionEntry CollectionEntry} and all {@link ItemEntry ItemEntries} in it, and sets the parent of the new entries.
262
- * Returns a {@link CollectionResource CollectionResource} of the newly cloned {@link CollectionEntry CollectionEntry}
263
- */
264
- cloneCollection<ItemTypeType extends ItemType>(collectionResource: CollectionResource<ItemTypeType>, options: CollectionOptionsInterface<ItemTypeType>, conversionMap: ItemIdConversionMap): CollectionResource<ItemTypeType>;
265
- /**
266
- * @description
267
- * Clones the {@link ItemEntry ItemEntry} and returns a {@link ItemResource ItemResource} of the newly cloned {@link ItemEntry ItemEntry}
268
- */
269
- cloneItem<ItemTypeType extends ItemType>(itemResource: ItemResource<ItemTypeType>, options: ItemOptionsInterface): PromiseInterface<ItemResource<ItemTypeType>>;
270
- getAllLinkCollections<ItemTypeType extends ItemType>(linkType: ItemType, itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>): PromiseInterface<CollectionResourceParentIdMap<ItemTypeType>>;
271
- getLinkCollectionsFromDef<ItemTypeType extends ItemType>(linkType: ItemType, linkIdArray: ItemId[], definition: LinkCollectionDefinition<ItemTypeType>): PromiseInterface<CollectionResourceParentIdMap<ItemTypeType>>;
272
- getLinkCollections<ItemTypeType extends ItemType>(linkType: ItemType, linkIdArray: ItemId[], itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>): PromiseInterface<CollectionResourceParentIdMap<ItemTypeType>>;
273
- getCollectionFromDef<ItemTypeType extends ItemType>(definition: CollectionDefinition<ItemTypeType>): PromiseInterface<CollectionResource<ItemTypeType>>;
274
- getCollection<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>): PromiseInterface<CollectionResource<ItemTypeType>>;
275
- getCollectionDef<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>): CollectionDefinition<ItemTypeType>;
276
- getLinkCollectionsDef<ItemTypeType extends ItemType>(itemType: ItemTypeType, linkField: string, options: CollectionOptionsInterface<ItemTypeType>): LinkCollectionDefinition<ItemTypeType>;
277
- /**
278
- * @deprecated
279
- * Use getItemById/getNewResourceWithId
280
- *
281
- * @remarks
282
- * stateKey can be a keyword or a local id (in case of a refresh)
283
- */
284
- getItemByState<ItemTypeType extends ItemType>(itemType: ItemTypeType, stateKey: ItemId | string, options?: ItemOptionsInterface, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
285
- getDuplicateById<ItemTypeType extends ItemType>(itemType: ItemTypeType, duplicateId: ItemId, options: ItemOptionsInterface, returnLinks: true, isRoot?: boolean): PromiseInterface<ItemResourceLinks<ItemTypeType>>;
286
- getDuplicateById<ItemTypeType extends ItemType>(itemType: ItemTypeType, duplicateId: ItemId, options: ItemOptionsInterface, returnLinks?: boolean, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
287
- getNewResourceWithId<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemOptionsInterface, returnLinks: true, isRoot?: boolean): PromiseInterface<ItemResourceLinks<ItemTypeType>>;
288
- getNewResourceWithId<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemOptionsInterface, returnLinks?: boolean, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
289
- getNewResource<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: ItemOptionsInterface, returnLinks: true, isRoot?: boolean): PromiseInterface<ItemResourceLinks<ItemTypeType>>;
290
- getNewResource<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: ItemOptionsInterface, returnLinks?: boolean, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
291
- /**
292
- * @description
293
- * Fetches multiple items with their respective changes of the current {@link TransactionCache transaction}
294
- */
295
- getItemsByQuery<ItemTypeType extends ItemType>(itemType: ItemTypeType, query: ApiQuery, options?: ItemOptionsInterface): PromiseInterface<Array<ItemResource<ItemTypeType>>>;
296
- /**
297
- * @description
298
- * Fetches multiple items with their respective changes of the current {@link TransactionCache transaction}
299
- */
300
- getItemsById<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemIds: ItemId[], options?: ItemOptionsInterface): PromiseInterface<Array<ItemResource<ItemTypeType>>>;
301
- /**
302
- * @description
303
- * Fetches the item with the changes of the current {@link TransactionCache transaction}
304
- *
305
- * @param isRoot Sets the item as the root item of the transaction, new items will be linked to this item (if there's a connection in the LinkTree)
306
- */
307
- getItemById<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options?: ItemOptionsInterface, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
308
- /**
309
- * @description
310
- * Fetches the title of an item, does not create an {@link ItemResource ItemResource}
311
- */
312
- fetchTitle(itemType: ItemType, itemId: ItemId): PromiseInterface<string>;
313
- /**
314
- * @description
315
- * Merges the passed child Transaction into this transaction and then propagates them to the other child transactions
316
- */
317
- applyChangesFromChild(childTransaction: TransactionCache, _breakUpByParent?: boolean, _onAfterCreateCallback?: OnAfterCreateCallback): PromiseInterface<ItemIdConversionMap>;
318
- /**
319
- * @description
320
- * Gets an already cached {@link ItemEntry ItemEntry} and the changes of this specific transaction for that entry
321
- */
322
- getLocalItemEntryChangesTuple(itemEntryId: ItemEntry['id']): {
323
- entry: ItemEntry;
324
- changes: TransactionItemEntryChanges;
325
- };
326
- /**
327
- * @description
328
- * Gets an ItemEntry from the cache, doesn't do a API request, used for saving
329
- */
330
- getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry | undefined;
331
- /**
332
- * @description
333
- * Gets an ItemEntry from the cache by ItemId
334
- */
335
- getLocalItemEntryByItemId(itemType: ItemType, itemId: ItemEntry['itemId']): ItemEntry | undefined;
336
- /**
337
- * @description
338
- * Gets an CollectionEntry from the cache, doesn't do a API request, used for saving
339
- */
340
- getLocalCollectionEntryByQueryString(itemType: ItemType, queryString: string): CollectionEntry | undefined;
341
- /**
342
- * @description
343
- * Gets an CollectionEntry from the cache, doesn't do a API request, used for saving
344
- */
345
- getLocalCollectionEntry(collectionEntryId: CollectionEntry['id']): CollectionEntry | undefined;
346
- /**
347
- * @description
348
- * Returns the complete {@link InternalChangesDelta InternalChangesDelta} of the TransactionCache, this only takes into account the end result (initial is compared to changes), so changing something and reverting it
349
- * won't be included
350
- */
351
- getDelta(): InternalChangesDelta;
352
- createItemResource<ItemTypeType extends ItemType>(itemEntry: ItemEntry<ItemTypeType>, options: ItemOptionsInterface, isRoot?: boolean, isNew?: boolean): ItemResource<ItemTypeType>;
353
- createItemResources<ItemTypeType extends ItemType>(itemEntries: Array<ItemEntry<ItemTypeType>>, options: ItemOptionsInterface): Array<ItemResource<ItemTypeType>>;
354
- processLinkedItems<ItemTypeType extends ItemType>(linkedEntries: ItemTypeMap<ItemEntry[]>, options: ItemOptionsInterface): ItemResourcesItemTypeMap<ItemResource<ItemTypeType>>;
355
- createCollectionResource<ItemTypeType extends ItemType>(collectionEntry: CollectionEntry<ItemTypeType>, resourceOptions: CollectionResourceOptionsInterface<ItemTypeType>): CollectionResource<ItemTypeType>;
356
- getChangesFromItemChanges<ItemTypeType extends ItemType = any>(changesObject: TransactionItemEntryChanges<ItemTypeType>): FieldMap<ItemTypeType>;
357
- private createCollectionResources;
358
- /**
359
- * @description
360
- * Fetches all required columns to match/fit in collections
361
- */
362
- private expandItemsFromDelta;
363
- private clearGlobalError;
364
- private clearItemError;
365
- }
366
- export {};
1
+ import { RmCore } from '../../../core';
2
+ import { TransactionCacheDependencyInterface } from '../../../interfaces/TransactionCacheDependencyInterface';
3
+ import { CollectionEntry, CollectionResource, CollectionResourceOptionsInterface, ItemEntry, ItemResource, ItemResourceOptionsInterface } from '../../../models';
4
+ import { ApiQuery, CollectionDefinition, CollectionOptionsInterface, CollectionResourceParentIdMap, ConversionMap, CreateRequestParameterMap, EntryParentNull, FieldMap, ItemId, ItemIdConversionMap, ItemOptionsInterface, ItemResourcesItemTypeMap, ItemType, ItemTypeMap, LinkCollectionDefinition, PromiseInterface } from '../../../types';
5
+ import { ChangesDelta } from '../../ChangesDelta';
6
+ import { ChangesDeltaResult } from '../../ChangesDeltaBase';
7
+ import { ModuleChangesCompilationResult, OnAfterCreateCallback, TransactionCacheCallbackCondition, TransactionCacheCallbackType, TransactionCollectionHandler, TransactionItemEntryChanges, TransactionItemHandler, TransactionValidatorFactory } from '../../index';
8
+ import { InternalChangesDelta } from '../../InternalChangesDelta';
9
+ import { AbstractCache } from '../AbstractCache';
10
+ import { ServerCache } from '../server/ServerCache';
11
+ import { TransactionEventHandler } from './TransactionEventHandler';
12
+ declare type ItemResourceLinks<ItemTypeType extends ItemType> = {
13
+ main: ItemResource<ItemTypeType>;
14
+ linked: ItemResourcesItemTypeMap;
15
+ };
16
+ export declare enum TransactionErrorLevel {
17
+ warning = "warning",
18
+ error = "error"
19
+ }
20
+ /**
21
+ * @description
22
+ * The {@link TransactionCache TransactionCache} is responsible for keeping track of newly created {@link ItemEntry ItemEntries}
23
+ * and {@link CollectionEntry CollectionEntries}, and the changes of existing ItemEntries and CollectionEntries.
24
+ *
25
+ * The TransactionCache is also responsible for creating {@link ItemResource ItemResources}, which is a combination of an {@link ItemEntry ItemEntry} and the current transaction's changes on this ItemEntry
26
+ */
27
+ export declare class TransactionCache extends AbstractCache {
28
+ /**
29
+ * @description
30
+ * For debugging purposes
31
+ */
32
+ id?: string | undefined;
33
+ /**
34
+ * @description
35
+ * A map of all item errors, can be populated using {@link TransactionValidator.setGlobalError TransactionValidator.setGlobalError} and {@link TransactionValidator.setItemError TransactionValidator.setItemError}.
36
+ * Contains a translation and level for every error
37
+ */
38
+ errors: {
39
+ item: {
40
+ [itemEntryId: string]: {
41
+ [columnId: string]: {
42
+ [errorKey: string]: {
43
+ fieldString: string;
44
+ string: string;
45
+ level: TransactionErrorLevel;
46
+ };
47
+ };
48
+ };
49
+ };
50
+ global: {
51
+ [key: string]: {
52
+ string: string;
53
+ level: TransactionErrorLevel;
54
+ };
55
+ };
56
+ };
57
+ isValid: boolean;
58
+ /**
59
+ * @description
60
+ * Stores the 'root' {@link ItemEntry ItemEntry}, this {@link ItemEntry ItemEntry} can be used as request parent to store the whole transaction at once
61
+ */
62
+ rootItem: ItemEntry<any> | undefined;
63
+ /**
64
+ * @description
65
+ * Stores additional request parameters for when the transaction is stored to the server
66
+ */
67
+ tabRequestParameters: {};
68
+ /**
69
+ * @description
70
+ * Is true while the {@link TransactionCache TransactionCache} is applying changes to the parent (can either be through a merge or an Api save)
71
+ */
72
+ isSaving: boolean;
73
+ /**
74
+ * @description
75
+ * Is true when the current transaction has:
76
+ * - Newly created items
77
+ * - Removed items (from collections)
78
+ * - Changes on existing items
79
+ */
80
+ hasChanges: boolean;
81
+ /**
82
+ * @description
83
+ * The transaction's parent
84
+ */
85
+ readonly parent: AbstractCache;
86
+ readonly itemHandler: TransactionItemHandler;
87
+ readonly collectionHandler: TransactionCollectionHandler;
88
+ readonly eventHandler: TransactionEventHandler;
89
+ private readonly validator?;
90
+ private changesInterval;
91
+ constructor(dependencies: TransactionCacheDependencyInterface, core: RmCore, parent: AbstractCache,
92
+ /**
93
+ * @description
94
+ * For debugging purposes
95
+ */
96
+ id?: string | undefined, validatorFactory?: TransactionValidatorFactory);
97
+ destroy(): void;
98
+ createChangesDelta(): ChangesDelta;
99
+ getFirstErrorString(): undefined | string;
100
+ /**
101
+ * @description
102
+ * Should only be called by {@link TransactionValidator TransactionValidator}
103
+ * @internal
104
+ */
105
+ _setGlobalError(key: string, isInvalid: boolean, saveButtonErrorTranslationFn: () => string, level: TransactionErrorLevel): void;
106
+ /**
107
+ * @description
108
+ * Should only be called by {@link TransactionValidator TransactionValidator}
109
+ * @internal
110
+ */
111
+ _setItemError(itemEntryId: ItemEntry['id'], columnId: string, errorKey: string, isInvalid: boolean, fieldErrorTranslationFn: () => string, saveButtonErrorTranslationFn: () => string, level: TransactionErrorLevel): void;
112
+ /**
113
+ * @internal
114
+ */
115
+ _setIsValid(): void;
116
+ /**
117
+ * @description
118
+ * Merges the passed changes from the parent Transaction into this Transaction's own changes and then propagates
119
+ * them to all child Transactions, this assumes that an action is already handled in a parent, so it does't handle created entries
120
+ * and removes entries that were in {@link TransactionItemHandler.deletedItems deletedItems} since they are already deleted
121
+ *
122
+ * ------------------
123
+ *
124
+ * The difference between {@link TransactionCache.applyChangesFromParent} and {@link TransactionCache.applyChangesDelta} is that applyChangesFromParent assumes
125
+ * the change has already been processed, and applyChangesDelta will process the changes once you save the transaction
126
+ *
127
+ * ------------------
128
+ * Use {@link TransactionCache.applyChangesDelta applyChangesDelta} if you want to apply changes from outside the core
129
+ *
130
+ * @param internalChangesDelta Changes to be applied
131
+ * @param isCalledAfterApiSave If 'isCalledAfterApiSave' is true local changes will always be overwritten (instead of only when there are no changes)
132
+ */
133
+ applyChangesFromParent(internalChangesDelta: InternalChangesDelta, isCalledAfterApiSave?: boolean, isCalledAfterSocketUpdate?: boolean): void;
134
+ /**
135
+ * @description
136
+ * Applies changes to this transaction and its children
137
+ *
138
+ * ------------------
139
+ *
140
+ * The difference between {@link TransactionCache.applyChangesFromParent} and {@link TransactionCache.applyChangesDelta} is that applyChangesFromParent assumes
141
+ * the change has already been processed, and applyChangesDelta will process the changes itself (result vs cause)
142
+ *
143
+ * ------------------
144
+ *
145
+ * Differs from {@link ServerCache.applyChangesDelta ServerCache.applyChangesDelta} in the handling of deleted entries and the applyChangesFromParent call
146
+ */
147
+ applyChangesDelta(changesDelta: ChangesDelta): PromiseInterface<ChangesDeltaResult>;
148
+ getServerCache(): ServerCache;
149
+ /**
150
+ * @description
151
+ * Gets the entry's parent from the closest transaction
152
+ *
153
+ * @param itemEntry The entry to get the parent from
154
+ * @param fromInitial If `true` the parent values will be read from {@link TransactionItemEntryChanges.initial initial} (Useful for when you've moved an entry)
155
+ * @param providedFields Use the provided fields instead of the cached fields, used by {@link CollectionResource.getParent CollectionResource.getParent}
156
+ *
157
+ * @remark
158
+ * Use {@link CollectionResource.getParent CollectionResource.getParent} instead of {@link TransactionCache.getParent TransactionCache.getParent} if you're getting the parent in the onRemove callback
159
+ */
160
+ getParent<ItemTypeType extends ItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean, providedFields?: FieldMap<ItemTypeType>): EntryParentNull;
161
+ getCollectionChangesRecursively(collectionEntryId: CollectionEntry['id']): ItemEntry[];
162
+ /**
163
+ * @description
164
+ * Traverses the transaction chain and returns the changes of the item on the first transaction
165
+ *
166
+ * @param copyFields If set, will call {@link ApiFormatter.copyFields ApiFormatter.copyFields}, otherwise just returns the object
167
+ */
168
+ getItemChangesRecursively(itemEntryId: ItemEntry['id'], copyFields?: boolean): FieldMap;
169
+ /**
170
+ * @description
171
+ * Removes the {@link ItemResource ItemResource} from the transaction, preventing the {@link ItemResource.options.onChange the onChange callback} from being called.
172
+ * You should call this function when the resource is no longer needed
173
+ *
174
+ * @remark
175
+ * Does not remove changes
176
+ */
177
+ clearItemResource(resource: ItemResource): void;
178
+ /**
179
+ * @description
180
+ * Removes the {@link CollectionResource CollectionResource} from the transaction, preventing the {@link CollectionResource.options.onAdd onAdd} and {@link CollectionResource.options.onRemove onRemove} callbacks from being called.
181
+ * You should call this function when the resource is no longer needed
182
+ *
183
+ * @remark
184
+ * Does not remove changes
185
+ */
186
+ clearCollectionResource(resource: CollectionResource): void;
187
+ /**
188
+ * @description
189
+ * Returns whether or not the {@link TransactionCache.rootItem rootItem} is uses locks
190
+ */
191
+ isLockable(): boolean;
192
+ /**
193
+ * @description
194
+ * Disables the transaction's changes watcher, the transaction will no longer automatically detect changes on items
195
+ */
196
+ disableChangesWatcher(): void;
197
+ /**
198
+ * @description
199
+ * Enables the transaction's changes watcher, the transaction will now automatically detect changes on items
200
+ */
201
+ enableChangesWatcher(): void;
202
+ /**
203
+ * @description
204
+ * Saves the transaction, this has a different effect depending on the transaction's parent.
205
+ *
206
+ * - If the parent is another {@link TransactionCache TransactionCache} it will merge the changes of the child transaction in the the parent transaction
207
+ * - If the parent is the {@link ServerCache ServerCache} it will save the changes to the APi
208
+ */
209
+ save(closeTab?: boolean, parameters?: CreateRequestParameterMap, breakUpByParent?: boolean, onAfterCreateCallback?: OnAfterCreateCallback): PromiseInterface<void>;
210
+ detectChanges(): boolean;
211
+ /**
212
+ * @description
213
+ * Removes an {@link ItemEntry ItemEntry} through an {@link ItemResource ItemResource} from the {@link TransactionCache TransactionCache} which means that changes on this entry will no longer be tracked.
214
+ */
215
+ clearItem(itemResource: ItemResource<any>): void;
216
+ /**
217
+ * @description
218
+ * Removes an {@link ItemEntry ItemEntry} from the {@link TransactionCache TransactionCache} which means that changes on this entry will no longer be tracked.
219
+ */
220
+ clearItemEntry(itemEntry: ItemEntry<any>): void;
221
+ /**
222
+ * @description
223
+ * Removes a {@link CollectionEntry CollectionEntry} through a {@link CollectionResource CollectionResource} from the {@link TransactionCache TransactionCache} which means that changes on this collection will no longer be tracked.
224
+ */
225
+ clearCollection(collectionResource: CollectionResource<any>): void;
226
+ /**
227
+ * @description
228
+ * Adds a callback that will fire before the transaction is saved, rejecting this callback will prevent the transaction from saving
229
+ */
230
+ onBeforeSave(key: string, callback: TransactionCacheCallbackType['onBeforeSave'], condition?: TransactionCacheCallbackCondition, priority?: number): () => void;
231
+ /**
232
+ * @description
233
+ * Adds a callback that will fire when the transaction is saved successfully
234
+ */
235
+ onSaveSuccess(key: string, callback: TransactionCacheCallbackType['onSaveSuccess'], condition?: TransactionCacheCallbackCondition, priority?: number): () => void;
236
+ /**
237
+ * @description
238
+ * Returns a {@link ModuleChangesCompilationResult ModuleChangesCompilationResult} for the transaction
239
+ */
240
+ getModuleChanges(): ModuleChangesCompilationResult;
241
+ /**
242
+ * @description
243
+ * Updates the passed map with the new {@link ConversionMap CconversionMap} values
244
+ */
245
+ updateItemIdMap(collectionMap: {
246
+ [itemId: number]: any;
247
+ }, conversionMap: ConversionMap): void;
248
+ getAllLinkCollections<ItemTypeType extends ItemType>(linkType: ItemType, itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>): PromiseInterface<CollectionResourceParentIdMap<ItemTypeType>>;
249
+ getLinkCollectionsFromDef<ItemTypeType extends ItemType>(linkType: ItemType, linkIdArray: ItemId[], definition: LinkCollectionDefinition<ItemTypeType>): PromiseInterface<CollectionResourceParentIdMap<ItemTypeType>>;
250
+ getLinkCollections<ItemTypeType extends ItemType>(linkType: ItemType, linkIdArray: ItemId[], itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>): PromiseInterface<CollectionResourceParentIdMap<ItemTypeType>>;
251
+ getCollectionFromDef<ItemTypeType extends ItemType>(definition: CollectionDefinition<ItemTypeType>): PromiseInterface<CollectionResource<ItemTypeType>>;
252
+ getCollection<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>): PromiseInterface<CollectionResource<ItemTypeType>>;
253
+ getCollectionDef<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>): CollectionDefinition<ItemTypeType>;
254
+ getLinkCollectionsDef<ItemTypeType extends ItemType>(itemType: ItemTypeType, linkField: string, options: CollectionOptionsInterface<ItemTypeType>): LinkCollectionDefinition<ItemTypeType>;
255
+ /**
256
+ * @deprecated
257
+ * Use getItemById/getNewResourceWithId
258
+ *
259
+ * @remarks
260
+ * stateKey can be a keyword or a local id (in case of a refresh)
261
+ */
262
+ getItemByState<ItemTypeType extends ItemType>(itemType: ItemTypeType, stateKey: ItemId | string, options?: ItemOptionsInterface, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
263
+ getDuplicateById<ItemTypeType extends ItemType>(itemType: ItemTypeType, duplicateId: ItemId, options: ItemOptionsInterface, returnLinks: true, isRoot?: boolean): PromiseInterface<ItemResourceLinks<ItemTypeType>>;
264
+ getDuplicateById<ItemTypeType extends ItemType>(itemType: ItemTypeType, duplicateId: ItemId, options: ItemOptionsInterface, returnLinks?: boolean, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
265
+ getNewResourceWithId<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemOptionsInterface, returnLinks: true, isRoot?: boolean): PromiseInterface<ItemResourceLinks<ItemTypeType>>;
266
+ getNewResourceWithId<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemOptionsInterface, returnLinks?: boolean, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
267
+ getNewResource<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: ItemOptionsInterface, returnLinks: true, isRoot?: boolean): PromiseInterface<ItemResourceLinks<ItemTypeType>>;
268
+ getNewResource<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: ItemOptionsInterface, returnLinks?: boolean, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
269
+ /**
270
+ * @description
271
+ * Fetches multiple items with their respective changes of the current {@link TransactionCache transaction}
272
+ */
273
+ getItemsByQuery<ItemTypeType extends ItemType>(itemType: ItemTypeType, query: ApiQuery, options?: ItemOptionsInterface): PromiseInterface<Array<ItemResource<ItemTypeType>>>;
274
+ /**
275
+ * @description
276
+ * Fetches multiple items with their respective changes of the current {@link TransactionCache transaction}
277
+ */
278
+ getItemsById<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemIds: ItemId[], options?: ItemOptionsInterface): PromiseInterface<Array<ItemResource<ItemTypeType>>>;
279
+ /**
280
+ * @description
281
+ * Fetches the item with the changes of the current {@link TransactionCache transaction}
282
+ *
283
+ * @param isRoot Sets the item as the root item of the transaction, new items will be linked to this item (if there's a connection in the LinkTree)
284
+ */
285
+ getItemById<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options?: ItemOptionsInterface, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
286
+ /**
287
+ * @description
288
+ * Fetches the title of an item, does not create an {@link ItemResource ItemResource}
289
+ */
290
+ fetchTitle(itemType: ItemType, itemId: ItemId): PromiseInterface<string>;
291
+ /**
292
+ * @description
293
+ * Merges the passed child Transaction into this transaction and then propagates them to the other child transactions
294
+ */
295
+ applyChangesFromChild(childTransaction: TransactionCache, _breakUpByParent?: boolean, _onAfterCreateCallback?: OnAfterCreateCallback): PromiseInterface<ItemIdConversionMap>;
296
+ /**
297
+ * @description
298
+ * Gets an already cached {@link ItemEntry ItemEntry} and the changes of this specific transaction for that entry
299
+ */
300
+ getLocalItemEntryChangesTuple(itemEntryId: ItemEntry['id']): {
301
+ entry: ItemEntry;
302
+ changes: TransactionItemEntryChanges;
303
+ };
304
+ /**
305
+ * @description
306
+ * Gets an ItemEntry from the cache, doesn't do a API request, used for saving
307
+ */
308
+ getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry | undefined;
309
+ /**
310
+ * @description
311
+ * Gets an ItemEntry from the cache by ItemId
312
+ */
313
+ getLocalItemEntryByItemId(itemType: ItemType, itemId: ItemEntry['itemId']): ItemEntry | undefined;
314
+ /**
315
+ * @description
316
+ * Gets an CollectionEntry from the cache, doesn't do a API request, used for saving
317
+ */
318
+ getLocalCollectionEntryByQueryString(itemType: ItemType, queryString: string): CollectionEntry | undefined;
319
+ /**
320
+ * @description
321
+ * Gets an CollectionEntry from the cache, doesn't do a API request, used for saving
322
+ */
323
+ getLocalCollectionEntry(collectionEntryId: CollectionEntry['id']): CollectionEntry | undefined;
324
+ /**
325
+ * @description
326
+ * Returns the complete {@link InternalChangesDelta InternalChangesDelta} of the TransactionCache, this only takes into account the end result (initial is compared to changes), so changing something and reverting it
327
+ * won't be included
328
+ */
329
+ getDelta(): InternalChangesDelta;
330
+ createItemResource<ItemTypeType extends ItemType>(itemEntry: ItemEntry<ItemTypeType>, options: ItemResourceOptionsInterface, isRoot?: boolean, isNew?: boolean): ItemResource<ItemTypeType>;
331
+ createItemResources<ItemTypeType extends ItemType>(itemEntries: Array<ItemEntry<ItemTypeType>>, options: ItemResourceOptionsInterface): Array<ItemResource<ItemTypeType>>;
332
+ processLinkedItems<ItemTypeType extends ItemType>(linkedEntries: ItemTypeMap<ItemEntry[]>, options: ItemOptionsInterface): ItemResourcesItemTypeMap<ItemResource<ItemTypeType>>;
333
+ createCollectionResource<ItemTypeType extends ItemType>(collectionEntry: CollectionEntry<ItemTypeType>, resourceOptions: CollectionResourceOptionsInterface<ItemTypeType>): CollectionResource<ItemTypeType>;
334
+ getChangesFromItemChanges<ItemTypeType extends ItemType = any>(changesObject: TransactionItemEntryChanges<ItemTypeType>): FieldMap<ItemTypeType>;
335
+ private createCollectionResources;
336
+ /**
337
+ * @description
338
+ * Fetches all required columns to match/fit in collections
339
+ */
340
+ private expandItemsFromDelta;
341
+ private clearGlobalError;
342
+ private clearItemError;
343
+ }
344
+ export {};