@rentman/rm-core 6.2.4 → 6.2.5

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 (109) hide show
  1. package/changelog.md +749 -746
  2. package/dist/rm-core.js +9683 -9695
  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 -31
  7. package/dist/types/classes/ChangesCompilation.d.ts +34 -34
  8. package/dist/types/classes/ChangesDelta.d.ts +61 -61
  9. package/dist/types/classes/ChangesDeltaBase.d.ts +50 -50
  10. package/dist/types/classes/ChangesProcessor.d.ts +47 -47
  11. package/dist/types/classes/CollectionEntryService.d.ts +26 -26
  12. package/dist/types/classes/CollectionMatcherBase.d.ts +21 -21
  13. package/dist/types/classes/CollectionMatcherCachedCollectionProcessor.d.ts +31 -31
  14. package/dist/types/classes/CollectionResourceService.d.ts +7 -7
  15. package/dist/types/classes/ColumnCache.d.ts +21 -21
  16. package/dist/types/classes/ColumnExpansion.d.ts +22 -22
  17. package/dist/types/classes/ColumnHandler.d.ts +21 -21
  18. package/dist/types/classes/ColumnInfo.d.ts +14 -14
  19. package/dist/types/classes/ColumnSet.d.ts +38 -38
  20. package/dist/types/classes/ColumnSubsetCache.d.ts +10 -10
  21. package/dist/types/classes/ColumnUtil.d.ts +99 -99
  22. package/dist/types/classes/ConversionMapService.d.ts +27 -27
  23. package/dist/types/classes/CreateRequest.d.ts +19 -19
  24. package/dist/types/classes/CreatedChangesDelta.d.ts +16 -16
  25. package/dist/types/classes/InternalChangesDelta.d.ts +39 -39
  26. package/dist/types/classes/ItemCache.d.ts +29 -29
  27. package/dist/types/classes/ItemCreateService.d.ts +24 -24
  28. package/dist/types/classes/ItemEntryService.d.ts +34 -34
  29. package/dist/types/classes/KeyService.d.ts +17 -17
  30. package/dist/types/classes/LockService.d.ts +32 -32
  31. package/dist/types/classes/ModuleChangesCompilation.d.ts +18 -18
  32. package/dist/types/classes/QueryColumnExtractor.d.ts +20 -20
  33. package/dist/types/classes/QueryLinkedToParser.d.ts +16 -16
  34. package/dist/types/classes/QueryLocallyMatchableParser.d.ts +19 -19
  35. package/dist/types/classes/QueryMatcher.d.ts +18 -18
  36. package/dist/types/classes/QueryParser.d.ts +24 -24
  37. package/dist/types/classes/QueryParserBase.d.ts +29 -29
  38. package/dist/types/classes/QueryParserIdUpdater.d.ts +16 -16
  39. package/dist/types/classes/QueryService.d.ts +18 -18
  40. package/dist/types/classes/RequestBuffer.d.ts +28 -28
  41. package/dist/types/classes/RequestBufferManager.d.ts +25 -25
  42. package/dist/types/classes/RequestColumnExpansion.d.ts +15 -15
  43. package/dist/types/classes/SocketMessageHandler.d.ts +39 -39
  44. package/dist/types/classes/TemplateCache.d.ts +66 -66
  45. package/dist/types/classes/Util.d.ts +30 -30
  46. package/dist/types/classes/cache/AbstractCache.d.ts +103 -103
  47. package/dist/types/classes/cache/CachedQueryHandlerBase.d.ts +74 -74
  48. package/dist/types/classes/cache/CollectionMatcherCachedQueryProcessor.d.ts +35 -35
  49. package/dist/types/classes/cache/ItemHandlerBase.d.ts +105 -105
  50. package/dist/types/classes/cache/server/ServerCache.d.ts +82 -82
  51. package/dist/types/classes/cache/server/ServerCachedQueryHandler.d.ts +34 -34
  52. package/dist/types/classes/cache/server/ServerItemHandler.d.ts +52 -52
  53. package/dist/types/classes/cache/transaction/TransactionCache.d.ts +331 -331
  54. package/dist/types/classes/cache/transaction/TransactionCachedQueryHandler.d.ts +23 -23
  55. package/dist/types/classes/cache/transaction/TransactionCollectionHandler.d.ts +28 -28
  56. package/dist/types/classes/cache/transaction/TransactionEventHandler.d.ts +24 -24
  57. package/dist/types/classes/cache/transaction/TransactionItemHandler.d.ts +90 -90
  58. package/dist/types/classes/cache/transaction/TransactionValidator.d.ts +34 -34
  59. package/dist/types/classes/index.d.ts +46 -46
  60. package/dist/types/constants.d.ts +7 -7
  61. package/dist/types/core.d.ts +51 -51
  62. package/dist/types/factories/ApiResponseProcessorFactory.d.ts +6 -6
  63. package/dist/types/factories/ChangesCompilationFactory.d.ts +6 -6
  64. package/dist/types/factories/ChangesDeltaFactory.d.ts +13 -13
  65. package/dist/types/factories/ChangesProcessorFactory.d.ts +22 -22
  66. package/dist/types/factories/CollectionEntryFactory.d.ts +14 -14
  67. package/dist/types/factories/CollectionMatcherFactory.d.ts +19 -19
  68. package/dist/types/factories/CollectionResourceFactory.d.ts +22 -22
  69. package/dist/types/factories/ColumnExpansionFactory.d.ts +8 -8
  70. package/dist/types/factories/ColumnInfoFactory.d.ts +7 -7
  71. package/dist/types/factories/ColumnSetFactory.d.ts +19 -19
  72. package/dist/types/factories/ColumnSubsetCacheFactory.d.ts +7 -7
  73. package/dist/types/factories/CreateRequestFactory.d.ts +11 -11
  74. package/dist/types/factories/ItemCacheFactory.d.ts +8 -8
  75. package/dist/types/factories/ItemEntryFactory.d.ts +15 -15
  76. package/dist/types/factories/ItemResourceFactory.d.ts +14 -14
  77. package/dist/types/factories/ModuleChangesCompilationFactory.d.ts +5 -5
  78. package/dist/types/factories/QueryMatcherFactory.d.ts +7 -7
  79. package/dist/types/factories/QueryParserFactory.d.ts +6 -6
  80. package/dist/types/factories/RequestColumnExpansionFactory.d.ts +6 -6
  81. package/dist/types/factories/TemplateFactory.d.ts +10 -10
  82. package/dist/types/factories/TransactionCacheFactory.d.ts +15 -15
  83. package/dist/types/factories/index.d.ts +21 -21
  84. package/dist/types/index.d.ts +7 -7
  85. package/dist/types/interfaces/AbstractCacheDependencyInterface.d.ts +43 -43
  86. package/dist/types/interfaces/ApiRequestServiceInterface.d.ts +11 -11
  87. package/dist/types/interfaces/AuthInterface.d.ts +9 -9
  88. package/dist/types/interfaces/ErrorHandlerInterface.d.ts +5 -5
  89. package/dist/types/interfaces/ExceptionHandlerInterface.d.ts +3 -3
  90. package/dist/types/interfaces/LinkTreeServiceInterface.d.ts +4 -4
  91. package/dist/types/interfaces/PromiseLibraryInterface.d.ts +25 -25
  92. package/dist/types/interfaces/ServerCacheDependencyInterface.d.ts +7 -7
  93. package/dist/types/interfaces/SocketMessageInterface.d.ts +3 -3
  94. package/dist/types/interfaces/TransactionCollectionHandlerDependencyInterface.d.ts +20 -20
  95. package/dist/types/interfaces/TransactionItemHandlerDependencyInterface.d.ts +26 -26
  96. package/dist/types/interfaces/index.d.ts +11 -11
  97. package/dist/types/models/CollectionEntry.d.ts +23 -23
  98. package/dist/types/models/CollectionOptions.d.ts +18 -18
  99. package/dist/types/models/CollectionResource.d.ts +72 -72
  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 +84 -84
  103. package/dist/types/models/Template.d.ts +11 -11
  104. package/dist/types/models/index.d.ts +7 -7
  105. package/dist/types/types/ItemTypesCollection.d.ts +263 -263
  106. package/dist/types/types/PromiseInterface.d.ts +2 -2
  107. package/dist/types/types/index.d.ts +2 -2
  108. package/package.json +36 -36
  109. package/readme.md +15 -15
package/changelog.md CHANGED
@@ -1,746 +1,749 @@
1
- #Changelog
2
- Contains new features, breaking changes and their reasoning
3
-
4
- ## 6.2.4
5
- - Fixed a bug where items would not appear in a collection after changes propagated from a parent transaction
6
-
7
- ## 6.2.3
8
- - Fixed a bug where `previous` would actually contain new values because the `previous` object was made after the values were already synced
9
-
10
- ## 6.2.2
11
- - Fixed a bug in syncing of initial values after saving an item causing the item to still be marked having changes
12
-
13
- ## 6.2.1
14
- - Fixed a bug where `ItemEntry`s created on the `ServerCache` where not matched on child `TransactionCache`s
15
-
16
- ## 6.2.0
17
- - Fixed a bug where synchronous validators would leave the validator in `pending` state
18
- - Only re-match items when values are actually changed
19
- - Removed `defered` from `CachedQueryItem` and added `resolve` and `reject`
20
- - Check if ItemEntries are already created before creating new ones, if that is the case treat it like an update
21
- > What could happen was that a faster request created an ItemEntry for the same item as another request
22
- > which caused the double creation of an ItemEntry
23
-
24
- ## 6.1.3
25
- - Add `isPending` function to `TransactionValidator`
26
- - `TransactionCache`s will now be invalid until all pending transaction validators are done
27
-
28
- ## 6.1.2
29
- - Check if an error key exists before deleting it in `TransactionCache.clearItemError`
30
-
31
- ## 6.1.1
32
- - Correctly pass `ErrorHandlerInterface` to `ChangesDeltaFactory`.
33
-
34
- ## 6.1.0
35
- - Return `ChangesDelta` instance in `setItemUpdated`, `setItemDeleted`, `setItemsDeleted` methods, and a promise that resolves to the instance in `setItemCreated` and `setItemsCreated`.
36
-
37
- ## 6.0.2
38
- - Update `query` parameter of `getByQuery`, `getLocalByQuery`, `batchGetLocalByParent`, and `matchQuery` in `ItemCache`.
39
-
40
- ## 6.0.1
41
- - Fixed a bug where a local item wouldn't be found when using `TransactionCache.getItemByState` on a child transaction
42
-
43
- ## 6.0.0
44
- - Refactored query caching structure
45
- - Properly implemented `limit` in collections
46
- - Removed extending of collections
47
-
48
- ## 5.0.1
49
- - Add 'icon' column type to non-selectable column types
50
-
51
- ## 5.0.0
52
- - Fixed a bug where created, creator and permissions was always set to default values
53
- - **Breaking:** Remove `onItemsCreated` collection callback.
54
-
55
- ## 4.0.4
56
- - Fixed a bug where ModuleChangesCompilation wouldn't include all changes
57
-
58
- ## 4.0.3
59
- - Local collections are now correctly identified when using a local ID in a linkTo request instead of the `parent` option
60
- - Fix issue where local collection entries were not moved to server cache after save.
61
-
62
- ## 4.0.2
63
- - Fixed a bug where clearing collections would error after saving a transaction
64
-
65
- ## 4.0.1
66
- - Remove thrown error in `ItemResource.callOnChange`
67
- > The frontend still relied on this and we won't refactor that at this point
68
-
69
- ## 4.0.0
70
- - Removed `ItemResourceOptions.onChange`, this is replaced by `TransactionCache.registerFieldChangeCallback`
71
- > Because the `onChange` is no longer stored on the ItemResource, the ItemResource doesn't have to be cached.
72
- > This way you don't have to call `ItemResource.clearResource` anymore (you do need to deregister the fieldChange callbacks)
73
-
74
- ## 3.1.0
75
- - **Breaking:** Remove `fields` property, add `getFields` method in `Template` class.
76
- - **Breaking:** Add `ConversionMapService`. Update `updateItemValues` to take a `source` and `destination` parameter.
77
- - Update `entry.itemId` for items created items in `TransactionCache.getDelta`.
78
- > This fixes an issue with updating IDs of local items.
79
- - Add dependency interfaces for `AbstractCache`, `ServerCache`, `TransactionCache`, `TransactionCollectionHandler`, `TransactionItemHandler`.
80
- - Add `CreatedChangesDelta` class, which replaces the `created` component of the `ChangesDelta` and includes some query methods. Add `isEmpty` method to `ChangesDelta`.
81
-
82
- ## 3.0.1
83
- - Fixed a bug where the `StateKeyType` enum couldn't be used when imported
84
-
85
- ## 3.0.0
86
- - Remove ViewResource, EditResource, CollectionViewResource and CollectionEditResource
87
- > There was no real distinction between them anymore since the core 2.0 update.
88
- > You can now use the base ItemResource and CollectionResource types instead
89
-
90
- ## 2.4.0
91
- - Update Typescript version to `3.7.2`, also update other plugins
92
-
93
- ## 2.3.0
94
- - Add callbacks when errors are set/cleared to `TransactionEventHandler`
95
- - Added the possibility to differentiate between errors to display below a field and on the save button in `TransactionValidator`
96
- - Changed the format of the error translations from `string` to `() => string` in `TransactionValidator`
97
- > Now the translation function will only be called when the error is actually set, not when it's cleared
98
-
99
- ## 2.2.1
100
- - Fixed a bug where resolving derived values for new items (in `TransactionCache.applyChangesDelta`) would sometimes error
101
-
102
- ## 2.2.0
103
- - `ChangesDelta.setItem(s)Created` will now accept incomplete input values
104
- > It will now fetch a template for you and process the items, so you no longer need to do that yourself
105
-
106
- ## 2.1.2
107
- - Fixed a bug where deleted ItemEntries weren't picked up when detecting transaction changes
108
-
109
- ## 2.1.1
110
- - Fixed a bug where an ItemEntry's errors wouldn't be deleted when the ItemEntry was deleted on a transaction
111
-
112
- ## 2.1.0
113
- - Refactor `TransactionCache.getItemsByQuery` to check cached entries (just like a collection)
114
- - Add `TransactionValidator`, allow passing of a `TransactionValidatorFactory` to a transaction
115
- > You can use these validators to set errors using `setItemError` and `setGlobalError`
116
- - Fixed a bug where `TransactionItemHandler.cloneItemEntry` could only clone entry with changes on the target transaction.
117
- > It will not look for changes recursively on the transaction change
118
-
119
- ## 2.0.19
120
- - Ensure all requestColumns for newly created ItemEntries from a template are available
121
- - Ensure derived values for newly created ItemEntries from a template are available
122
-
123
- ## 2.0.18
124
- - Include read-only columns when detecting changes in TransactionItemHandler.processItemEntryChanges
125
- > Read-only columns shouldn't count as changes on the tab, but they should be taking into account when deciding whether or not to call `onChange`
126
-
127
- ## 2.0.17
128
- - Fixed a bug where deleting an item that isn't in the transaction's item entry cache would result in an error
129
- - Fixed a bug where response columns weren't set for newly created local CollectionEntries
130
- - Fixed a bug where items weren't matched for newly created local CollectionEntries
131
-
132
- ## 2.0.16
133
- - Fixed a bug where queries with a link to a local parent item weren't updated on save
134
-
135
- ## 2.0.15
136
- - Cache ItemEntries that fit collections on the CollectionEntry's query instead of the CollectionEntry's id
137
- - Add a 'hint' to ChangesDeltas which allows skipping the extra request to validate `maybe` query matches
138
- - Create transaction changes for ItemEntry updates in the changesDelta if non exist yet when calling `TransactionCache.applyChangesDelta`
139
- > This allows you to update values on a transaction without having to fetch a resource for it by calling
140
- > `ChangesDelta.setItemUpdated()`
141
-
142
- ## 2.0.14
143
- - Fixed reading of derived values in `getItemIdByColumn` when a ChangesDelta is passed
144
-
145
- ## 2.0.13
146
- - Fixed a bug where the incorrect fields where applied to the ChangesDelta in `TransactionItemHandler.cloneItemEntry`
147
- - A RequestBuffer's promise will now resolve after the ServerCache.processResponse promise is done, ensuring all values are present before continuing
148
- - Request columns for the request ItemType will now properly be taken into account in ServerCache.processResponse ensuring root columns are always properly set. (This is used to update derived values)
149
-
150
- ## 2.0.12
151
- - Fixed a bug where created changes weren't copied to the itemchanges
152
- - Only take readonly parent columns instead of all readonly columns in `ApiFormatter.hasChanges`
153
- - Fixed a bug where ItemEntry's where still in `ItemCache.entriesByEntryId` after clearing them
154
-
155
- ## 2.0.11
156
- - Fixed a bug where changes weren't copied to the itemchanges
157
- - Fixed correct isCalledAfterApiSave values on calls to ServerCache.processResponse
158
-
159
- ## 2.0.10
160
- - Construct `ColumnSet` with proper `requestColumns` when creating a `Template` with additional columns
161
-
162
- ## 2.0.9
163
- - Properly process linked items from the template request in `TransactionItemHandler.createItems`
164
-
165
- ## 2.0.8
166
- - Fixed a bug where not all fields where available even tough an ItemResource with specific columns was created
167
-
168
- ## 2.0.7
169
- - Define abstract copyTransactionItemEntryChanges on ItemHandlerBase
170
- - Implement copyTransactionItemEntryChanges on TransactionItemHandler and ServerItemHandler
171
- - Fix AbstractCache/ServerCache/TransactionCache `getParent` function arguments
172
- > With the newly added arguments the function definitions didn't align anymore causing typescript errors
173
- > Even though the arguments aren't used in the `ServerCache` they're added in there
174
-
175
- ## 2.0.6
176
- - Remove `ApiFormatter.lazyClone`
177
- > You can't lazily clone moment objects because the moment you wanted to clone could be changed in the time the getter isn't invoked, resulting in a different value
178
-
179
- - Create a copy of the child transaction's field instead of copying the object reference in `TransactionCache.applyChangeFromChild` and `ChangesProcessor.executeCreateRequest`
180
- > When writing to the object references you're changing multiple transactions at once, while this should be handled by applyCHangesFromParent
181
-
182
- ## 2.0.5
183
- - Add `callOnAddWithInitialItems` option to `CollectionResourceOptions`
184
- > If `true` the `onAdd` callback will be called with the initial set of items
185
-
186
-
187
- ## 2.0.4
188
- - Add `isCalledAfterSocketUpdate` to `onAdd`, `onRemove` and `onChange` callbacks
189
- > You can use this if a data change should only trigger an action when the user caused it himself
190
-
191
- ## 2.0.3
192
- - Fix `CollectionEditResource.removeItems`
193
- - Move `getCurrentCollectionEntryCache` and `getCurrentItemEntryCache` from `TransactionCache` to `AbstractCache`
194
-
195
- ## 2.0.2
196
- - Fix marking entries as deleted and compiling this into a request
197
-
198
- ## 2.0.1
199
- - Expand CollectionEntry's columns in `ServerCollectionHandler.fetchCollectionData`
200
-
201
- ## 2.0.0 - Major caching refactor
202
- - Completely reworked internal caching structure, see [this Confluence page](https://rentman.atlassian.net/wiki/spaces/DEV/pages/704872456/) for the motivations behind it.
203
-
204
-
205
- ## 1.9.0
206
- - Don't create ItemResources when not returning links in `ItemAdministrator.getNewResourceWithId` and in `ItemAdministrator.constructOnItemsExpanded`
207
-
208
- ## 1.8.0
209
- - Remove `ResourceCache` and `resourceLevel`
210
- > You should now manually call `resource.clearResource` when you no longer need a resource
211
- - Add `onConstruct` function to `ItemResource` and `CollectionResource`
212
- > This is overwritten by the frontend to track resource creation
213
-
214
- ## 1.7.6
215
- - Add priority parameter to local cache callbacks. The callback condition (`always` / `onClose` / `skipOnClose`) no longer has any effect on the order in which the callbacks get executed.
216
- - **Breaking:** Remove `LocalCacheCallbackCondition` enum.
217
- - Add `itemId` parameter to `ItemHandler.fetchNewItem`. An error is thrown when an ID already exists. Add `getNewResourceWithId` to ItemAdministrator. Deprecate `getItemByState`.
218
-
219
- ## 1.7.5
220
- - For template column sets it is no longer assumed all columns are present. This fixes an issue with incomplete column
221
- sets in the front-end.
222
- - Fix issue where `changesProcessor` instance was undefined in `itemResourceFactory` and `collectionResourceFactory`.
223
- Create variables for each core service in order to get a TypeScript error when a dependency hasn't been initialized yet.
224
-
225
- ## 1.7.4
226
- - Add support for strict ItemType type checking in `FieldMap`
227
-
228
- ## 1.7.3
229
- - Add support for strict ItemType type checking
230
- > This is temporarily defaulted to `any` to prevent compile errors in the frontend
231
-
232
- ## 1.7.2
233
- - Fix some typing issues in:
234
- - ApiResponseProcessor
235
- - ItemCache
236
- - KeyService
237
-
238
- ## 1.7.1
239
- - Fix issue where `CreateRequestFactory` would be undefined in `ChangesProcessor`.
240
-
241
- ## 1.7.0
242
- - **Breaking:** remove `ChangesProcessorFactory`. Add `ChangesProcessor` instance to core directly.
243
-
244
- ### Resource caching
245
- - **Breaking:** the following properties are removed:
246
- - On `ItemEntry`: `clearResources`, `deactivateResources`.
247
- - On `CollectionEntry`: `clearResources`, `getCurrentResource`.
248
- - On `CollectionResourceOptions`: `clearOnTabChange`, `clearOnSubTabChange`.
249
- - An additional `level` parameter has been added to all methods that return resources.
250
- - When creating resources using `ItemResourceFactory` or `CollectionResourceFactory`, this parameter is mandatory.
251
- A `defaultResourceLevel` parameter has been added to the `LocalCache` constructor.
252
- - A `clearResources` method has been added to `ItemAdministrator`. When calling this method, all item / collection
253
- and collection resources with a level of `level` or higher will be removed.
254
- - The `clearResources` method has been removed from `LocalCache`.
255
- - The `setCurrentLocalCache` function has been removed from `LocalCacheManagerInterface`.
256
-
257
- ## 1.6.13
258
- - When encountering a collection entry with `PROMISED_EXPAND` status, call `getCachedEntryStatus` after the initial
259
- promise has been resolved.
260
-
261
- > This is the likely cause of the issue where `_resolve` is called on a non-deferred collection entry.
262
-
263
- ## 1.6.12
264
- - Fix error that occurs when trying to resolve a non-deferred collection entry.
265
-
266
- ## 1.6.11
267
- - Fix issue where `QueryMatcher.matchComplexQuery` would return the wrong value.
268
-
269
- ## 1.6.10
270
- - **Breaking**: Remove `linkType`, `linkIdArray` properties from `LinkCollectionDefinition`. Add `linkType`,
271
- `linkIdArray` parameters to `ItemAdministrator.getLinkCollectionsFromDef`.
272
-
273
- ## 1.6.9
274
- - Redeploy of `1.6.8`
275
-
276
- ## 1.6.8
277
- - Add support for `not` in queries
278
-
279
- ## 1.6.7
280
- - Fix issue where `CollectionMatcher.addToCollections` wouldn't return the correct type.
281
-
282
- ## 1.6.6
283
- - Add `callOnAdd` parameter in `CollectionHandler.batchExtend`. Set `updateInitial` to true. Remove `updateInitial` parameter in `CollectionEntry.extend`, as it should always be true.
284
- > The `extend` function only concerns itself with remote items, so no local changes should be generated.
285
-
286
- ## 1.6.5
287
- - Fix issue where a derived column could be marked as the `link` (parent) column in the column set.
288
- > This could lead to instances where a different column would be set to the value of the parent.
289
-
290
- ## 1.6.4
291
- - Fix issue where the `onChange` collection callback would not be called when updating it in the options.
292
- - Add `callOnAdd` parameter to collection matcher. When set to `false`, `onAdd` is not called for the `resultCollectionResource`.
293
-
294
- ## 1.6.3
295
- - Properly type ApiResponseProcessor - fetchObjectArray
296
-
297
- ## 1.6.2
298
- - Fix issue where the collection handler would return collection entries before they were resolved when calling `batchFetch`.
299
-
300
- ## 1.6.1-3
301
- - Check for linkedTo before checking for subqueries in QueryMatcher
302
- > Linkedto also has `.query` and was incorrectly marked as a subquery
303
-
304
- ## 1.6.1-2
305
- - Fixed shorthand query with null values
306
- > The QueryParser would incorrectly identify subqueries when using null in a shorthand
307
-
308
- ## 1.6.1-1
309
- - Fixed shorthand query with Moment values
310
- > The QueryParser would incorrectly identify Moment objects as a subquery
311
-
312
- ## 1.6.1
313
- - Added support for subqueries in QueryParser and QueryMatcher
314
- > Collections using subqueries will always return 'maybe' in the QueryMatcher
315
-
316
- ## 1.6.0
317
- - All external callbacks are now wrapped in a `try ... catch` block. This prevents them from breaking core functionality.
318
- - **Breaking**: Add `ExceptionHandlerInterface` parameter to core constructor.
319
-
320
- ## 1.5.9
321
- - Fix issue that occurs when trying to resolve a `ColumnSet` using a single non-existing column.
322
- Catch exceptions that might occur when resolving an `ItemEntry`.
323
- - Add `mergeRequestColumns`, `mergeResponseColumns` to `ColumnSet`. When encountering new items while expanding a collection, add them to the collection.
324
-
325
- ## 1.5.8
326
- - Introduce `RemoteViewResource` and `LocalViewResource`.
327
- > The `fields` property of a `RemoteViewResource` represents
328
- server values, while the `fields` property of a `LocalViewResource` represents local values.
329
- - The `fields` property of a `ViewResource` is now read only.
330
-
331
- ## 1.5.7-1
332
- - Make ItemResource/CollectionResource base class abstract
333
- - Add missing overload functions in some places
334
- - Fix default comparator `QueryMatcher.parseSimpleQuery`
335
- - Fix `ExtendedCollectionMatchResult` `collection` property type
336
-
337
- ## 1.5.7
338
- - Properly type Collections & ItemResources (and return values) in the whole core.
339
- > The core will now properly return Collections & ItemResources based on the passed CollectionOptions.
340
- > You can now also type the expected collection type
341
-
342
- ```
343
- // Expects a collection with editCollection and editItems both `true`
344
- // Will properly return EditResources for all collection functions
345
- const collection: CollectionEditResource<EditResource>;
346
-
347
- // other variations are:
348
- // CollectionViewResource<ViewResource>
349
- // CollectionViewResource<EditResource>
350
- // CollectionEditResource<ViewResource>
351
-
352
- this.core.itemAdministrator.getCollection(
353
- 'Notitie',
354
- {
355
- editCollection: true, // Will return a CollectionEditResource
356
- editItems: true // Will return EditResources instead of ViewResources in `.items`
357
- }
358
- )
359
- ```
360
-
361
- ## 1.5.6
362
- - Add `getAllLocalCaches` to `LocalCacheManagerInterface`, remove item entries from all local caches on socket delete.
363
-
364
- ## 1.5.5
365
- - Add 'order' column type handling to ApiFormatter functions
366
-
367
- ## 1.5.4
368
- - Fix issue where parent would be incorrectly set when cloning a single item.
369
- - Type functions related to expansion maps in `ItemEntryService`.
370
-
371
- ## 1.5.3
372
- - Fix issue where the `enableSave` collection resource option would default to `false`. This would throw an error when
373
- calling `save` on a collection resource where this option was not explicitly set.
374
-
375
- ## 1.5.2
376
- - Type functions in `ColumnUtil` class.
377
- - Add `getRequestColumnId` and `containsDerivedColumns` to `ColumnUtil`.
378
- > `getRequestColumnId` should be used instead of `Util.getFirstProperty` when retrieving a column ID.
379
- - **Breaking:** Remove `ColumnUtil.isColumnSubset`. Use `ColumnSet.isSuperSetOf` instead.
380
- - Remove `findColumnObject`. Rename `findColumn` to `findRequestColumn`.
381
-
382
- ## 1.5.1
383
- - Properly remove item entry stub from (local) cache when request fails.
384
- - Fix issue where item or collection options could be set to undefined.
385
-
386
- ## 1.5.0
387
- - Add `SocketMessage` type and add types to `SocketMessageHandler`
388
- - Expand local items requested using `getItemById` or `getItemsById` in `ItemAdministrator`.
389
- (`fetchItem` or `fetchItems` in `ItemHandler`.)
390
- - Implement expanding of local collections. This no longer leads to invalid requests.
391
- - **Breaking:** The `expand` function in `CollectionEntry` now has an `ItemCache` parameter.
392
- - **Warning:** This version contains major changes.
393
-
394
- ### Introduce typing of item and collection options
395
- - **Breaking:** Removed `QueryItemType` collection entry option.
396
- - **Breaking:** Removed `ItemResourceService`.
397
- - Removed `processOptions` parameter from `createCollectionResource` (`ItemAdministrator`). It is now equivalent to
398
- `addCollection`.
399
- - When creating an item resource using `ItemResourceFactory`, a collection entry using `CollectionResourceFactory` or a
400
- collection resource using `CollectionResourceFactory` it is no longer necessary to process options beforehand. It is
401
- still necessary when interacting with `CollectionHandler` or `ItemHandler` directly.
402
-
403
- ## v1.4.0
404
- - Add `expandProcessLinkedItems` and `expandAddToCollections` to `ItemAdministrator`. These are analogues to
405
- `processLinkedItems` and `addToCollections`, but also expand the items with (derived) values and columns as necessary.
406
- They have a slightly different type signature.
407
- - Whenever a collection is requested, the `CollectionHandler` now makes sure that added local items are expanded as
408
- necessary.
409
- - **Breaking:** Last parameter of `ItemHandler.createLocalEntries` is now a callback function.
410
- - **Breaking:** Rename `TemplateLinkedItemEntryMap` type to `TemplateItemEntryMap`.
411
-
412
- ## v1.3.8
413
- - Add `isSaving` to `LocalCache`
414
- > We use this to disable the cancel/save buttons while the localCache is saving in the frontend
415
-
416
- ## v1.3.7
417
- - Fix issues that generate invalid requests / changes when moving existing item to another collection, then deleting the parent.
418
- - Remove slip workarounds
419
- - Add api request types
420
- - Add types to `ModuleChangesCompilation`
421
-
422
- ## v1.3.6
423
- - Skip add / remove collection callbacks when calling `revertChanges` (`LocalCache`).
424
-
425
- ## v1.3.5
426
- - Fix issue where items added to collections when resolving wouldn't be removed in `revertChanges` (`LocalCache`).
427
-
428
- ## v1.3.4
429
- - Add country to isFilteredColumn in ColumnUtil
430
-
431
- ## v1.3.3
432
- - Move processLocalConfigColumns and consolidateColumns from ColumnUtil to frontend
433
- > These functions are specifically used for rendering ui-grid in the frontend, so there's
434
- no reason to have them in the core
435
-
436
- ## v1.3.2
437
- - Fix types path in package.json
438
-
439
- ## v1.3.1
440
- - Fix types path in package.json
441
-
442
- ## v1.3.0
443
- - Rename PromiseInterface to PromiseLibraryInterface
444
- > PromiseInterface is now used for the internal promise type
445
-
446
- - Use PromiseInterface instead of Promise as internal promise type
447
- > This allows us to overwrite the PromiseInterface definition in the frontend indicate usage of ng.IPromise
448
-
449
- ## v1.2.9
450
- - Call processOptions in fetchDerivedValuesByColumn
451
- > Bug was introduced earlier but got enabled in v1.2.7
452
-
453
- ## v1.2.8
454
- - Add toJSON methods for ItemResources, ItemEntries, and ColumnSets to fix circular dependencies in JSON.stringify
455
-
456
- ## v1.2.7
457
- - Set itemEntry parent when generating a stub
458
-
459
- ## v1.2.6
460
- - Fix an issue introduced in v1.2.5.
461
-
462
- ## v1.2.5
463
- - When a local item cannot by found, return a newly created item in `getItemByState` (`ItemAdministrator`) only. This
464
- solves an issue with refreshing on a local edit view.
465
-
466
- ## v1.2.4
467
- - **Breaking:** When a local item cannot by found, instead of a new item being created an error is thrown. This means it
468
- is no longer possible to create local items using `getItemById` or `getItemsById` in the `ItemAdministrator` class.
469
- - **Breaking:** Removed `getItemDefinition` and `getItemByDef` in the `ItemAdministrator` class. Added `getItemByState`.
470
- - Renamed types `TemplateResponseItemEntryMap` to `TemplateItemEntryMap` and `TemplateResponseLinkedItemEntryMap` to
471
- `TemplateLinkedItemEntryMap`.
472
- - Removed `getCollectionCacheKey` in `KeyService`. (Legacy code.)
473
-
474
- ## v1.2.3
475
- - Fixed issue where derived values deeper than one layer couldn't be resolved.
476
-
477
- ## v1.2.2
478
- - Fixed issue where in derived values weren't set after create request.
479
-
480
- ## v1.2.1
481
- - **Breaking:** Replaced the `initial` parameter with the `callOnChange` parameter (`true` by default) in the `commit`
482
- function of the `EditResource` class.
483
- - Fixed issue in `setLocalFields` (`ItemEntry`) where some values were wrongly assumed to be present in `initialValues`.
484
- - Optimization: Disabled automatic resolution of derived values in `addItems` (`CollectionEditResource`) when `modInstant` is set to true.
485
-
486
- ## v1.2.0
487
- - **Breaking:** When calling `addItems` or `addItem` on the `CollectionEditResource` class derived values are now
488
- resolved automatically. Instead of a compound object like `{fields: {key: 'value'}, derived: {}}` an object like
489
- `{key: 'value'}` should now be used as argument when calling these functions.
490
- - **Breaking:** Added `localCache` parameter to `CollectionResource` constructor.
491
-
492
- ## v1.1.20
493
- - Fixed minor issue where collection wouldn't be deferred properly before expanding.
494
- - `onChange` is now called automatically when when calling `commit` on an edit resource.
495
-
496
- ## v1.1.19
497
- - **Breaking:** Renamed `getCurrentChanges` to `getModuleChanges` in the `ItemAdministrator` class. Added optional
498
- `localCache` parameter.
499
-
500
- ### Local cache callback refactoring
501
- - Removed `onSaveWithoutClosing` event.
502
- - Added `condition` parameter to `onBeforeSave` and `onSaveSuccess` (possible values are `always`, `onClose` or
503
- `skipOnClose`, defaults to `always`). Callbacks registered with `condition: always` will get executed before other
504
- callbacks.
505
- - Pass the local cache itself to all registered callback functions. Pass the item ID conversion map as second argument
506
- to `onSaveSuccess` callback functions.
507
-
508
- ## v1.1.18
509
- - Calling `expand` on a `CollectionEntry` manually no longer defers the collection entry.
510
- - The `batchFetch` and `batchExpand` functions in the `CollectionHandler` class now properly defer and resolve the
511
- collection entries.
512
-
513
- ## v1.1.17
514
- - Fixed issue where the `getLocalByQuery` function in the `ItemCache` class wouldn't return any items.
515
- - When batch resolving collection entries, `CollectionHandler` now looks for matching items using `getByQuery` instead
516
- of `getByParent`.
517
-
518
- ### Cache invalidation
519
- - Added `queueReload` function to `ItemEntry` class. This will reload the item when the item entry itself or a
520
- collection entry containing the item is requested.
521
- - The `queueReload` function in the `CollectionEntry` class no longer directly defers the item.
522
- - Added `invalidateCache` function to the `ItemAdministrator` class. This will call `queueReload` on all item entries
523
- and collection entries.
524
-
525
- ### Item entry refactoring
526
- - Renamed `process` to `setFields`.
527
- - Replaced `processLocal` with `setLocalFields`. This function no longer has a `modified` parameter.
528
- - `setModified` now also sets local default values.
529
- - Removed `setCreator`. This function was called twice in some instances.
530
- - **Breaking:** Added `derived` parameter to `updateFields`
531
-
532
- ##v1.16
533
- - Pass `hasChanges` as second argument to `onBeforeSave` callbacks in the `LocalCache` class. This fixes an issue with
534
- project financial values in the front-end. [RM4-9577]
535
- - Added `callOnActivate` parameter to `addItems` function in `CollectionEditResource` class. Use this to prevent items
536
- from being added to the local cache.
537
-
538
- ##v1.15
539
- - Fix `fetchItemTypesTranslations` function in `ColumnHandler` class.
540
- - Fix type definition of `PromiseInterface.all`.
541
-
542
- ##v1.14
543
- - The `ChangesCompiler` now always processes local collections. (Even if they don't have edit resources.) This fixes an
544
- issue with recurring appointments in the front-end.
545
-
546
- ##v1.13
547
- - Add option to exclude itemTypes during createLocalEntries.
548
-
549
- ##v1.12
550
- - **Breaking:** `ItemResource.isNew` returns true *only* if the resource was created using
551
- `ItemAdministrator.getNewResource` or `ItemAdministrator.getItemByDef`. This fixes an issue where items where removed
552
- from the local cache inadvertently.
553
- - The `start`, `commit` and `rollback` functions of `EditResource` now return the resource itself to facilitate chaining.
554
- - When calling `CollectionEntry.revertChanges`, callbacks like `onAdd` / `onRemove` and `onActivate` / `onDeactivate`
555
- are now respected. This fixes an issue where items where *not* removed from the local cache.
556
- - When removing *local* items from collections, they are removed from `initial` as well as `modified`. This fixes an
557
- issue where changes were being detected continuously.
558
- - Updated the order of requests in `changesProcessor`. The `update` request is now executed before the `delete` request,
559
- except when updating documents. This fixes several issues.
560
- - `CollectionCache` now uses a map instead of an array to store collections. This fixes an issue where the same
561
- collection was added multiple times.
562
- - Updated all models to use dependency objects. This increases ease of debugging.
563
-
564
- ##v.1.11
565
- - Fixed issue that occurs when saving when having an existing item refer to a newly created item.
566
- - **Breaking:** Removed `ItemResourceService.isNewResource`.
567
- - **Breaking:** Renamed `ItemResource.isNewResource` to `ItemResource.isNew`. Removed parameter.
568
- - `ItemResource.isNew` is equivalent to `ItemResource.isLocal`, while `EditResource.isNew` checks also checks for
569
- completed transactions.
570
-
571
- ##v.1.10
572
- - Fixed issue where changes on different subtabs were not detected.
573
-
574
- ##v1.1.9
575
- - Exposed `noop` function on `RmCore` class.
576
- > This is used in order to check whether a callback has a default value.
577
- - Added `copyRequestColumns` function to `ColumnUtil` class.
578
- - Made parameters of `ItemAdministrator.saveCurrentLocalCache` and `LocalCache.save` optional.
579
- - **Breaking:** Reordered parameters of `ChangesProcessor.execute` to be consistent with
580
- `ItemAdministrator.saveCurrentLocalCache`. The new order is `singleItems` - `collections` - `parameters` -
581
- `breakUpByParent` - `onAfterCreateCallback`.
582
-
583
- ##v1.1.8
584
- - Set default value for `params` to `{filter: false}` in `request` function in `ColumnHandler` class.
585
-
586
- ##v1.1.7
587
- - Fixed issue where cached item entries or collection entries wouldn't be added to the local cache.
588
-
589
- ##v1.1.6
590
- - Fixed issue with deferred item entries.
591
- - Re-enable changes watcher after save.
592
- - Added optional `id` parameter to `LocalCache` constructor.
593
-
594
- ##v1.1.5
595
- - Added `clearItem` function to `LocalCache` class.
596
-
597
- ##v.1.1.4
598
- - Fix issue where items where not added to the local cache automatically when they where added to a collection.
599
- > This depends on the `callOnActivate` parameter. I've added this mainly because extending collections should *not* add
600
- the items to the local cache.
601
- > In other instances this might be debatable because it doesn't do any real harm. *Not*
602
- doing it however can definitely be harmful.
603
-
604
- ##v.1.1.3
605
- - Fixed an issue where all collections in a local cache would be cleared.
606
- - **Breaking:** Renamed `getCacheManager` to `getCurrentLocalCache` and `setCacheManager` to `setCurrentLocalCache` in
607
- `LocalCacheManagerInterface`.
608
-
609
- ##v1.1.2
610
- - Fixed an issue concerning derived values.
611
-
612
- ## v1.1.1
613
- - Fixed an issue where changes wouldn't be detected.
614
- - **Breaking:** Removed the `_hasChanges` function in the `localCache` class. If you want to force changes detection,
615
- call `detectChanges` instead. Otherwise, rely on the `hasChanges` variable.
616
- - **Breaking:** Removed the `enableWatcher` and `disableWatcher` functions. Use `enableChangesWatcher` and
617
- `disableChangesWatcher` instead.
618
-
619
- ## v1.1.0
620
- ### Development
621
-
622
- #### Strict TypeScript compilation
623
- Added the following TypeScript compiler options:
624
- - noImplicitThis
625
- - noImplicitReturns
626
- - strictNullChecks
627
- - noUnusedLocals
628
- - noUnusedParameters
629
-
630
- I would advise enabling these for all TypeScript projects from now on.
631
-
632
- #### Ordered imports and dependencies
633
- Imports are now ordered alphabetically and grouped by folder. Added a TSLint option to enforce this.
634
- Please note that this also applies for imports from the folder the file is currently in.
635
- For example, in `models/ItemResource.ts`, `itemEntry` should be imported like so:
636
- `import { ItemEntry } from '../models';`
637
-
638
- Also, factory and class dependencies should be ordered alphabetically as well. This will make it easier to add and
639
- remove dependencies in the future.
640
-
641
- ### Breaking changes
642
-
643
- - Renamed `changesCompiler` to `changesCompilation`, `changesCompilerFactory` to `changesCompilationFactory`,
644
- `moduleChangesCompiler` to `moduleChangesCompilation` and `moduleChangesCompilerFactory` to
645
- `moduleChangesCompilationFactory`.
646
- - Removed the `allLinks` parameter from the `query` function definition in the `ApiRequestServiceInterface`. This is
647
- no longer supported in the back-end.
648
-
649
- #### Item and collection entries
650
- - Moved *all* functions that handle item entries from the `ItemEntryService` to the `ItemEntry` class.
651
- - Added the following functions to `ItemEntryService`:
652
- - `createLocalConversionMap`;
653
- - `expandLocalConversionMap`;
654
- - `expandConversionMap`;
655
- - `batchExpandConversionMap`;
656
- - `batchClone`.
657
- - Cloning of item entries now works slightly differently. The function will attempt to generate a new
658
- item ID, and update the conversion map accordingly, but will respect the item ID that is already there.
659
-
660
- #### Rework item caching
661
- Newly created item entries and collection entries are no longer added to the global *or* local cache by default.
662
- All entries are added to the global cache on save. Item entries are added to the local cache when resources are created
663
- using the item administrator or when resources are created when adding the items to a collection.
664
-
665
- > This will increase reliability by ensuring the global cache is no longer 'polluted' with local items. Also, this will
666
- > allow for the creation item and collection entries without caching them directly. This is required for the copying and
667
- > pasting of items.
668
-
669
- Other changes:
670
-
671
- - Moved `saveLocal` to `ItemAdministrator`;
672
- - `ItemAdministrator.fetchTitle` should now be called instead of `ItemHandler.fetchTitle`;
673
- - The `ItemAdministrator` collection matching functions (`addToCollections`, `removeFromCollections`) should now be
674
- called instead of those in the `CollectionHandler`. The `CollectionHandler` should only be used to reflect changes
675
- already on the backend. (Use `getCollectionMatcher`.)
676
-
677
-
678
- ##v1.0.33
679
- - Really fix types path
680
-
681
- ##v1.0.33
682
- - Fix types path
683
-
684
- ##v1.0.32
685
- - Update `tsconfig.json` to put definitions in the root folder
686
- > The app had an issue with AOT compilation because of this
687
-
688
- ##v1.0.31
689
- - Fix `columnHandler.fetchItemTypeTranslations`
690
- > It incorrectly looped over the response map, it should now work again
691
-
692
- ##v1.0.30
693
- - Remove `updateTabParams` from LocalCacheManagerInterface
694
- > The function wasn't used
695
-
696
- - Reworked class export
697
- > Imports are now done from @rentman/rm-core, old imports are broken. This is because the old export structure didn't always work
698
-
699
- ##v1.0.29
700
- - Fix inverted inArray check in CollectionEntry.removeItems
701
- > A delete message from the socket deleted all BUT the deleted items, this should now be fixed
702
-
703
- ##v1.0.28
704
- Bug fixes only
705
-
706
- ##v1.0.27
707
- - `ItemEntry.initial` is now undefined by default
708
- > In the SocketMessageHandler we use this check to see if an ItemEntry is a stub
709
-
710
- ##v1.0.26
711
- Bundle both minified and unminified code, include sourcemaps from dev build
712
-
713
- ##v1.0.24, v1.0.25
714
- ! Use version `v1.0.26` !
715
-
716
- - The core now expects a `promiseInterface` that should implement the provided `promiseInterface`
717
- > We need to be able to hook into the promises in order to call a digest cycle to update the ui in the frontend
718
-
719
- - Rename `ItemEntry.entryId` to `ItemEntry.id
720
- > It used to be called `id`, but it was changed in the seperation of the core.
721
- > You can use the `id` to uniquely identify an entry, since itemId can be updated (local to saved id)
722
-
723
- - Rename ItemResource `startTransaction` to `start`
724
- > Other functions are called `commit` and `rollback` so having 'transaction' only for start doesn't make much sense
725
-
726
- - `SocketMessageHandler.onMessageReceived` now returns a promise
727
- > You can now use the updated items or hook into the result to update the ui for example
728
-
729
-
730
- ##v1.0.23
731
- - Rename ResourceCache to LocalCache
732
- > LocalCache only caches local items (name better reflects functionality)
733
-
734
- - Remove getter/setter for hasChanges
735
- > hasChanges is called in a digest loop in the frontend, so for performance reasons we don't want to recompute the value every time
736
-
737
- - Remove `_getCollection` from ItemAdministrator
738
- > `_getCollection` is now named `getCollection` and the old `getCollection` is removed. The query is part of the
739
- > options and should not be given as a separate argument. This was included to support the frontend
740
-
741
- - Remove `saveCurrentTab` from ItemAdministrator
742
- > `saveCurrentTab` makes no sense because the core has no concept of tabs, you should use `saveCurrentLocalCache` instead
743
-
744
- - Remove `getTabEntry` and `resetTabEntry` from ItemAdministrator
745
- > `getTabEntry` and `resetTabEntry` make no sense because the core has no concept of tabs, you should use `getLocalCache` and `resetLocalCache` instead
746
-
1
+ #Changelog
2
+ Contains new features, breaking changes and their reasoning
3
+
4
+ ## 6.2.5
5
+ - Remove overwriting itemType with itemType of rootItem during create
6
+
7
+ ## 6.2.4
8
+ - Fixed a bug where items would not appear in a collection after changes propagated from a parent transaction
9
+
10
+ ## 6.2.3
11
+ - Fixed a bug where `previous` would actually contain new values because the `previous` object was made after the values were already synced
12
+
13
+ ## 6.2.2
14
+ - Fixed a bug in syncing of initial values after saving an item causing the item to still be marked having changes
15
+
16
+ ## 6.2.1
17
+ - Fixed a bug where `ItemEntry`s created on the `ServerCache` where not matched on child `TransactionCache`s
18
+
19
+ ## 6.2.0
20
+ - Fixed a bug where synchronous validators would leave the validator in `pending` state
21
+ - Only re-match items when values are actually changed
22
+ - Removed `defered` from `CachedQueryItem` and added `resolve` and `reject`
23
+ - Check if ItemEntries are already created before creating new ones, if that is the case treat it like an update
24
+ > What could happen was that a faster request created an ItemEntry for the same item as another request
25
+ > which caused the double creation of an ItemEntry
26
+
27
+ ## 6.1.3
28
+ - Add `isPending` function to `TransactionValidator`
29
+ - `TransactionCache`s will now be invalid until all pending transaction validators are done
30
+
31
+ ## 6.1.2
32
+ - Check if an error key exists before deleting it in `TransactionCache.clearItemError`
33
+
34
+ ## 6.1.1
35
+ - Correctly pass `ErrorHandlerInterface` to `ChangesDeltaFactory`.
36
+
37
+ ## 6.1.0
38
+ - Return `ChangesDelta` instance in `setItemUpdated`, `setItemDeleted`, `setItemsDeleted` methods, and a promise that resolves to the instance in `setItemCreated` and `setItemsCreated`.
39
+
40
+ ## 6.0.2
41
+ - Update `query` parameter of `getByQuery`, `getLocalByQuery`, `batchGetLocalByParent`, and `matchQuery` in `ItemCache`.
42
+
43
+ ## 6.0.1
44
+ - Fixed a bug where a local item wouldn't be found when using `TransactionCache.getItemByState` on a child transaction
45
+
46
+ ## 6.0.0
47
+ - Refactored query caching structure
48
+ - Properly implemented `limit` in collections
49
+ - Removed extending of collections
50
+
51
+ ## 5.0.1
52
+ - Add 'icon' column type to non-selectable column types
53
+
54
+ ## 5.0.0
55
+ - Fixed a bug where created, creator and permissions was always set to default values
56
+ - **Breaking:** Remove `onItemsCreated` collection callback.
57
+
58
+ ## 4.0.4
59
+ - Fixed a bug where ModuleChangesCompilation wouldn't include all changes
60
+
61
+ ## 4.0.3
62
+ - Local collections are now correctly identified when using a local ID in a linkTo request instead of the `parent` option
63
+ - Fix issue where local collection entries were not moved to server cache after save.
64
+
65
+ ## 4.0.2
66
+ - Fixed a bug where clearing collections would error after saving a transaction
67
+
68
+ ## 4.0.1
69
+ - Remove thrown error in `ItemResource.callOnChange`
70
+ > The frontend still relied on this and we won't refactor that at this point
71
+
72
+ ## 4.0.0
73
+ - Removed `ItemResourceOptions.onChange`, this is replaced by `TransactionCache.registerFieldChangeCallback`
74
+ > Because the `onChange` is no longer stored on the ItemResource, the ItemResource doesn't have to be cached.
75
+ > This way you don't have to call `ItemResource.clearResource` anymore (you do need to deregister the fieldChange callbacks)
76
+
77
+ ## 3.1.0
78
+ - **Breaking:** Remove `fields` property, add `getFields` method in `Template` class.
79
+ - **Breaking:** Add `ConversionMapService`. Update `updateItemValues` to take a `source` and `destination` parameter.
80
+ - Update `entry.itemId` for items created items in `TransactionCache.getDelta`.
81
+ > This fixes an issue with updating IDs of local items.
82
+ - Add dependency interfaces for `AbstractCache`, `ServerCache`, `TransactionCache`, `TransactionCollectionHandler`, `TransactionItemHandler`.
83
+ - Add `CreatedChangesDelta` class, which replaces the `created` component of the `ChangesDelta` and includes some query methods. Add `isEmpty` method to `ChangesDelta`.
84
+
85
+ ## 3.0.1
86
+ - Fixed a bug where the `StateKeyType` enum couldn't be used when imported
87
+
88
+ ## 3.0.0
89
+ - Remove ViewResource, EditResource, CollectionViewResource and CollectionEditResource
90
+ > There was no real distinction between them anymore since the core 2.0 update.
91
+ > You can now use the base ItemResource and CollectionResource types instead
92
+
93
+ ## 2.4.0
94
+ - Update Typescript version to `3.7.2`, also update other plugins
95
+
96
+ ## 2.3.0
97
+ - Add callbacks when errors are set/cleared to `TransactionEventHandler`
98
+ - Added the possibility to differentiate between errors to display below a field and on the save button in `TransactionValidator`
99
+ - Changed the format of the error translations from `string` to `() => string` in `TransactionValidator`
100
+ > Now the translation function will only be called when the error is actually set, not when it's cleared
101
+
102
+ ## 2.2.1
103
+ - Fixed a bug where resolving derived values for new items (in `TransactionCache.applyChangesDelta`) would sometimes error
104
+
105
+ ## 2.2.0
106
+ - `ChangesDelta.setItem(s)Created` will now accept incomplete input values
107
+ > It will now fetch a template for you and process the items, so you no longer need to do that yourself
108
+
109
+ ## 2.1.2
110
+ - Fixed a bug where deleted ItemEntries weren't picked up when detecting transaction changes
111
+
112
+ ## 2.1.1
113
+ - Fixed a bug where an ItemEntry's errors wouldn't be deleted when the ItemEntry was deleted on a transaction
114
+
115
+ ## 2.1.0
116
+ - Refactor `TransactionCache.getItemsByQuery` to check cached entries (just like a collection)
117
+ - Add `TransactionValidator`, allow passing of a `TransactionValidatorFactory` to a transaction
118
+ > You can use these validators to set errors using `setItemError` and `setGlobalError`
119
+ - Fixed a bug where `TransactionItemHandler.cloneItemEntry` could only clone entry with changes on the target transaction.
120
+ > It will not look for changes recursively on the transaction change
121
+
122
+ ## 2.0.19
123
+ - Ensure all requestColumns for newly created ItemEntries from a template are available
124
+ - Ensure derived values for newly created ItemEntries from a template are available
125
+
126
+ ## 2.0.18
127
+ - Include read-only columns when detecting changes in TransactionItemHandler.processItemEntryChanges
128
+ > Read-only columns shouldn't count as changes on the tab, but they should be taking into account when deciding whether or not to call `onChange`
129
+
130
+ ## 2.0.17
131
+ - Fixed a bug where deleting an item that isn't in the transaction's item entry cache would result in an error
132
+ - Fixed a bug where response columns weren't set for newly created local CollectionEntries
133
+ - Fixed a bug where items weren't matched for newly created local CollectionEntries
134
+
135
+ ## 2.0.16
136
+ - Fixed a bug where queries with a link to a local parent item weren't updated on save
137
+
138
+ ## 2.0.15
139
+ - Cache ItemEntries that fit collections on the CollectionEntry's query instead of the CollectionEntry's id
140
+ - Add a 'hint' to ChangesDeltas which allows skipping the extra request to validate `maybe` query matches
141
+ - Create transaction changes for ItemEntry updates in the changesDelta if non exist yet when calling `TransactionCache.applyChangesDelta`
142
+ > This allows you to update values on a transaction without having to fetch a resource for it by calling
143
+ > `ChangesDelta.setItemUpdated()`
144
+
145
+ ## 2.0.14
146
+ - Fixed reading of derived values in `getItemIdByColumn` when a ChangesDelta is passed
147
+
148
+ ## 2.0.13
149
+ - Fixed a bug where the incorrect fields where applied to the ChangesDelta in `TransactionItemHandler.cloneItemEntry`
150
+ - A RequestBuffer's promise will now resolve after the ServerCache.processResponse promise is done, ensuring all values are present before continuing
151
+ - Request columns for the request ItemType will now properly be taken into account in ServerCache.processResponse ensuring root columns are always properly set. (This is used to update derived values)
152
+
153
+ ## 2.0.12
154
+ - Fixed a bug where created changes weren't copied to the itemchanges
155
+ - Only take readonly parent columns instead of all readonly columns in `ApiFormatter.hasChanges`
156
+ - Fixed a bug where ItemEntry's where still in `ItemCache.entriesByEntryId` after clearing them
157
+
158
+ ## 2.0.11
159
+ - Fixed a bug where changes weren't copied to the itemchanges
160
+ - Fixed correct isCalledAfterApiSave values on calls to ServerCache.processResponse
161
+
162
+ ## 2.0.10
163
+ - Construct `ColumnSet` with proper `requestColumns` when creating a `Template` with additional columns
164
+
165
+ ## 2.0.9
166
+ - Properly process linked items from the template request in `TransactionItemHandler.createItems`
167
+
168
+ ## 2.0.8
169
+ - Fixed a bug where not all fields where available even tough an ItemResource with specific columns was created
170
+
171
+ ## 2.0.7
172
+ - Define abstract copyTransactionItemEntryChanges on ItemHandlerBase
173
+ - Implement copyTransactionItemEntryChanges on TransactionItemHandler and ServerItemHandler
174
+ - Fix AbstractCache/ServerCache/TransactionCache `getParent` function arguments
175
+ > With the newly added arguments the function definitions didn't align anymore causing typescript errors
176
+ > Even though the arguments aren't used in the `ServerCache` they're added in there
177
+
178
+ ## 2.0.6
179
+ - Remove `ApiFormatter.lazyClone`
180
+ > You can't lazily clone moment objects because the moment you wanted to clone could be changed in the time the getter isn't invoked, resulting in a different value
181
+
182
+ - Create a copy of the child transaction's field instead of copying the object reference in `TransactionCache.applyChangeFromChild` and `ChangesProcessor.executeCreateRequest`
183
+ > When writing to the object references you're changing multiple transactions at once, while this should be handled by applyCHangesFromParent
184
+
185
+ ## 2.0.5
186
+ - Add `callOnAddWithInitialItems` option to `CollectionResourceOptions`
187
+ > If `true` the `onAdd` callback will be called with the initial set of items
188
+
189
+
190
+ ## 2.0.4
191
+ - Add `isCalledAfterSocketUpdate` to `onAdd`, `onRemove` and `onChange` callbacks
192
+ > You can use this if a data change should only trigger an action when the user caused it himself
193
+
194
+ ## 2.0.3
195
+ - Fix `CollectionEditResource.removeItems`
196
+ - Move `getCurrentCollectionEntryCache` and `getCurrentItemEntryCache` from `TransactionCache` to `AbstractCache`
197
+
198
+ ## 2.0.2
199
+ - Fix marking entries as deleted and compiling this into a request
200
+
201
+ ## 2.0.1
202
+ - Expand CollectionEntry's columns in `ServerCollectionHandler.fetchCollectionData`
203
+
204
+ ## 2.0.0 - Major caching refactor
205
+ - Completely reworked internal caching structure, see [this Confluence page](https://rentman.atlassian.net/wiki/spaces/DEV/pages/704872456/) for the motivations behind it.
206
+
207
+
208
+ ## 1.9.0
209
+ - Don't create ItemResources when not returning links in `ItemAdministrator.getNewResourceWithId` and in `ItemAdministrator.constructOnItemsExpanded`
210
+
211
+ ## 1.8.0
212
+ - Remove `ResourceCache` and `resourceLevel`
213
+ > You should now manually call `resource.clearResource` when you no longer need a resource
214
+ - Add `onConstruct` function to `ItemResource` and `CollectionResource`
215
+ > This is overwritten by the frontend to track resource creation
216
+
217
+ ## 1.7.6
218
+ - Add priority parameter to local cache callbacks. The callback condition (`always` / `onClose` / `skipOnClose`) no longer has any effect on the order in which the callbacks get executed.
219
+ - **Breaking:** Remove `LocalCacheCallbackCondition` enum.
220
+ - Add `itemId` parameter to `ItemHandler.fetchNewItem`. An error is thrown when an ID already exists. Add `getNewResourceWithId` to ItemAdministrator. Deprecate `getItemByState`.
221
+
222
+ ## 1.7.5
223
+ - For template column sets it is no longer assumed all columns are present. This fixes an issue with incomplete column
224
+ sets in the front-end.
225
+ - Fix issue where `changesProcessor` instance was undefined in `itemResourceFactory` and `collectionResourceFactory`.
226
+ Create variables for each core service in order to get a TypeScript error when a dependency hasn't been initialized yet.
227
+
228
+ ## 1.7.4
229
+ - Add support for strict ItemType type checking in `FieldMap`
230
+
231
+ ## 1.7.3
232
+ - Add support for strict ItemType type checking
233
+ > This is temporarily defaulted to `any` to prevent compile errors in the frontend
234
+
235
+ ## 1.7.2
236
+ - Fix some typing issues in:
237
+ - ApiResponseProcessor
238
+ - ItemCache
239
+ - KeyService
240
+
241
+ ## 1.7.1
242
+ - Fix issue where `CreateRequestFactory` would be undefined in `ChangesProcessor`.
243
+
244
+ ## 1.7.0
245
+ - **Breaking:** remove `ChangesProcessorFactory`. Add `ChangesProcessor` instance to core directly.
246
+
247
+ ### Resource caching
248
+ - **Breaking:** the following properties are removed:
249
+ - On `ItemEntry`: `clearResources`, `deactivateResources`.
250
+ - On `CollectionEntry`: `clearResources`, `getCurrentResource`.
251
+ - On `CollectionResourceOptions`: `clearOnTabChange`, `clearOnSubTabChange`.
252
+ - An additional `level` parameter has been added to all methods that return resources.
253
+ - When creating resources using `ItemResourceFactory` or `CollectionResourceFactory`, this parameter is mandatory.
254
+ A `defaultResourceLevel` parameter has been added to the `LocalCache` constructor.
255
+ - A `clearResources` method has been added to `ItemAdministrator`. When calling this method, all item / collection
256
+ and collection resources with a level of `level` or higher will be removed.
257
+ - The `clearResources` method has been removed from `LocalCache`.
258
+ - The `setCurrentLocalCache` function has been removed from `LocalCacheManagerInterface`.
259
+
260
+ ## 1.6.13
261
+ - When encountering a collection entry with `PROMISED_EXPAND` status, call `getCachedEntryStatus` after the initial
262
+ promise has been resolved.
263
+
264
+ > This is the likely cause of the issue where `_resolve` is called on a non-deferred collection entry.
265
+
266
+ ## 1.6.12
267
+ - Fix error that occurs when trying to resolve a non-deferred collection entry.
268
+
269
+ ## 1.6.11
270
+ - Fix issue where `QueryMatcher.matchComplexQuery` would return the wrong value.
271
+
272
+ ## 1.6.10
273
+ - **Breaking**: Remove `linkType`, `linkIdArray` properties from `LinkCollectionDefinition`. Add `linkType`,
274
+ `linkIdArray` parameters to `ItemAdministrator.getLinkCollectionsFromDef`.
275
+
276
+ ## 1.6.9
277
+ - Redeploy of `1.6.8`
278
+
279
+ ## 1.6.8
280
+ - Add support for `not` in queries
281
+
282
+ ## 1.6.7
283
+ - Fix issue where `CollectionMatcher.addToCollections` wouldn't return the correct type.
284
+
285
+ ## 1.6.6
286
+ - Add `callOnAdd` parameter in `CollectionHandler.batchExtend`. Set `updateInitial` to true. Remove `updateInitial` parameter in `CollectionEntry.extend`, as it should always be true.
287
+ > The `extend` function only concerns itself with remote items, so no local changes should be generated.
288
+
289
+ ## 1.6.5
290
+ - Fix issue where a derived column could be marked as the `link` (parent) column in the column set.
291
+ > This could lead to instances where a different column would be set to the value of the parent.
292
+
293
+ ## 1.6.4
294
+ - Fix issue where the `onChange` collection callback would not be called when updating it in the options.
295
+ - Add `callOnAdd` parameter to collection matcher. When set to `false`, `onAdd` is not called for the `resultCollectionResource`.
296
+
297
+ ## 1.6.3
298
+ - Properly type ApiResponseProcessor - fetchObjectArray
299
+
300
+ ## 1.6.2
301
+ - Fix issue where the collection handler would return collection entries before they were resolved when calling `batchFetch`.
302
+
303
+ ## 1.6.1-3
304
+ - Check for linkedTo before checking for subqueries in QueryMatcher
305
+ > Linkedto also has `.query` and was incorrectly marked as a subquery
306
+
307
+ ## 1.6.1-2
308
+ - Fixed shorthand query with null values
309
+ > The QueryParser would incorrectly identify subqueries when using null in a shorthand
310
+
311
+ ## 1.6.1-1
312
+ - Fixed shorthand query with Moment values
313
+ > The QueryParser would incorrectly identify Moment objects as a subquery
314
+
315
+ ## 1.6.1
316
+ - Added support for subqueries in QueryParser and QueryMatcher
317
+ > Collections using subqueries will always return 'maybe' in the QueryMatcher
318
+
319
+ ## 1.6.0
320
+ - All external callbacks are now wrapped in a `try ... catch` block. This prevents them from breaking core functionality.
321
+ - **Breaking**: Add `ExceptionHandlerInterface` parameter to core constructor.
322
+
323
+ ## 1.5.9
324
+ - Fix issue that occurs when trying to resolve a `ColumnSet` using a single non-existing column.
325
+ Catch exceptions that might occur when resolving an `ItemEntry`.
326
+ - Add `mergeRequestColumns`, `mergeResponseColumns` to `ColumnSet`. When encountering new items while expanding a collection, add them to the collection.
327
+
328
+ ## 1.5.8
329
+ - Introduce `RemoteViewResource` and `LocalViewResource`.
330
+ > The `fields` property of a `RemoteViewResource` represents
331
+ server values, while the `fields` property of a `LocalViewResource` represents local values.
332
+ - The `fields` property of a `ViewResource` is now read only.
333
+
334
+ ## 1.5.7-1
335
+ - Make ItemResource/CollectionResource base class abstract
336
+ - Add missing overload functions in some places
337
+ - Fix default comparator `QueryMatcher.parseSimpleQuery`
338
+ - Fix `ExtendedCollectionMatchResult` `collection` property type
339
+
340
+ ## 1.5.7
341
+ - Properly type Collections & ItemResources (and return values) in the whole core.
342
+ > The core will now properly return Collections & ItemResources based on the passed CollectionOptions.
343
+ > You can now also type the expected collection type
344
+
345
+ ```
346
+ // Expects a collection with editCollection and editItems both `true`
347
+ // Will properly return EditResources for all collection functions
348
+ const collection: CollectionEditResource<EditResource>;
349
+
350
+ // other variations are:
351
+ // CollectionViewResource<ViewResource>
352
+ // CollectionViewResource<EditResource>
353
+ // CollectionEditResource<ViewResource>
354
+
355
+ this.core.itemAdministrator.getCollection(
356
+ 'Notitie',
357
+ {
358
+ editCollection: true, // Will return a CollectionEditResource
359
+ editItems: true // Will return EditResources instead of ViewResources in `.items`
360
+ }
361
+ )
362
+ ```
363
+
364
+ ## 1.5.6
365
+ - Add `getAllLocalCaches` to `LocalCacheManagerInterface`, remove item entries from all local caches on socket delete.
366
+
367
+ ## 1.5.5
368
+ - Add 'order' column type handling to ApiFormatter functions
369
+
370
+ ## 1.5.4
371
+ - Fix issue where parent would be incorrectly set when cloning a single item.
372
+ - Type functions related to expansion maps in `ItemEntryService`.
373
+
374
+ ## 1.5.3
375
+ - Fix issue where the `enableSave` collection resource option would default to `false`. This would throw an error when
376
+ calling `save` on a collection resource where this option was not explicitly set.
377
+
378
+ ## 1.5.2
379
+ - Type functions in `ColumnUtil` class.
380
+ - Add `getRequestColumnId` and `containsDerivedColumns` to `ColumnUtil`.
381
+ > `getRequestColumnId` should be used instead of `Util.getFirstProperty` when retrieving a column ID.
382
+ - **Breaking:** Remove `ColumnUtil.isColumnSubset`. Use `ColumnSet.isSuperSetOf` instead.
383
+ - Remove `findColumnObject`. Rename `findColumn` to `findRequestColumn`.
384
+
385
+ ## 1.5.1
386
+ - Properly remove item entry stub from (local) cache when request fails.
387
+ - Fix issue where item or collection options could be set to undefined.
388
+
389
+ ## 1.5.0
390
+ - Add `SocketMessage` type and add types to `SocketMessageHandler`
391
+ - Expand local items requested using `getItemById` or `getItemsById` in `ItemAdministrator`.
392
+ (`fetchItem` or `fetchItems` in `ItemHandler`.)
393
+ - Implement expanding of local collections. This no longer leads to invalid requests.
394
+ - **Breaking:** The `expand` function in `CollectionEntry` now has an `ItemCache` parameter.
395
+ - **Warning:** This version contains major changes.
396
+
397
+ ### Introduce typing of item and collection options
398
+ - **Breaking:** Removed `QueryItemType` collection entry option.
399
+ - **Breaking:** Removed `ItemResourceService`.
400
+ - Removed `processOptions` parameter from `createCollectionResource` (`ItemAdministrator`). It is now equivalent to
401
+ `addCollection`.
402
+ - When creating an item resource using `ItemResourceFactory`, a collection entry using `CollectionResourceFactory` or a
403
+ collection resource using `CollectionResourceFactory` it is no longer necessary to process options beforehand. It is
404
+ still necessary when interacting with `CollectionHandler` or `ItemHandler` directly.
405
+
406
+ ## v1.4.0
407
+ - Add `expandProcessLinkedItems` and `expandAddToCollections` to `ItemAdministrator`. These are analogues to
408
+ `processLinkedItems` and `addToCollections`, but also expand the items with (derived) values and columns as necessary.
409
+ They have a slightly different type signature.
410
+ - Whenever a collection is requested, the `CollectionHandler` now makes sure that added local items are expanded as
411
+ necessary.
412
+ - **Breaking:** Last parameter of `ItemHandler.createLocalEntries` is now a callback function.
413
+ - **Breaking:** Rename `TemplateLinkedItemEntryMap` type to `TemplateItemEntryMap`.
414
+
415
+ ## v1.3.8
416
+ - Add `isSaving` to `LocalCache`
417
+ > We use this to disable the cancel/save buttons while the localCache is saving in the frontend
418
+
419
+ ## v1.3.7
420
+ - Fix issues that generate invalid requests / changes when moving existing item to another collection, then deleting the parent.
421
+ - Remove slip workarounds
422
+ - Add api request types
423
+ - Add types to `ModuleChangesCompilation`
424
+
425
+ ## v1.3.6
426
+ - Skip add / remove collection callbacks when calling `revertChanges` (`LocalCache`).
427
+
428
+ ## v1.3.5
429
+ - Fix issue where items added to collections when resolving wouldn't be removed in `revertChanges` (`LocalCache`).
430
+
431
+ ## v1.3.4
432
+ - Add country to isFilteredColumn in ColumnUtil
433
+
434
+ ## v1.3.3
435
+ - Move processLocalConfigColumns and consolidateColumns from ColumnUtil to frontend
436
+ > These functions are specifically used for rendering ui-grid in the frontend, so there's
437
+ no reason to have them in the core
438
+
439
+ ## v1.3.2
440
+ - Fix types path in package.json
441
+
442
+ ## v1.3.1
443
+ - Fix types path in package.json
444
+
445
+ ## v1.3.0
446
+ - Rename PromiseInterface to PromiseLibraryInterface
447
+ > PromiseInterface is now used for the internal promise type
448
+
449
+ - Use PromiseInterface instead of Promise as internal promise type
450
+ > This allows us to overwrite the PromiseInterface definition in the frontend indicate usage of ng.IPromise
451
+
452
+ ## v1.2.9
453
+ - Call processOptions in fetchDerivedValuesByColumn
454
+ > Bug was introduced earlier but got enabled in v1.2.7
455
+
456
+ ## v1.2.8
457
+ - Add toJSON methods for ItemResources, ItemEntries, and ColumnSets to fix circular dependencies in JSON.stringify
458
+
459
+ ## v1.2.7
460
+ - Set itemEntry parent when generating a stub
461
+
462
+ ## v1.2.6
463
+ - Fix an issue introduced in v1.2.5.
464
+
465
+ ## v1.2.5
466
+ - When a local item cannot by found, return a newly created item in `getItemByState` (`ItemAdministrator`) only. This
467
+ solves an issue with refreshing on a local edit view.
468
+
469
+ ## v1.2.4
470
+ - **Breaking:** When a local item cannot by found, instead of a new item being created an error is thrown. This means it
471
+ is no longer possible to create local items using `getItemById` or `getItemsById` in the `ItemAdministrator` class.
472
+ - **Breaking:** Removed `getItemDefinition` and `getItemByDef` in the `ItemAdministrator` class. Added `getItemByState`.
473
+ - Renamed types `TemplateResponseItemEntryMap` to `TemplateItemEntryMap` and `TemplateResponseLinkedItemEntryMap` to
474
+ `TemplateLinkedItemEntryMap`.
475
+ - Removed `getCollectionCacheKey` in `KeyService`. (Legacy code.)
476
+
477
+ ## v1.2.3
478
+ - Fixed issue where derived values deeper than one layer couldn't be resolved.
479
+
480
+ ## v1.2.2
481
+ - Fixed issue where in derived values weren't set after create request.
482
+
483
+ ## v1.2.1
484
+ - **Breaking:** Replaced the `initial` parameter with the `callOnChange` parameter (`true` by default) in the `commit`
485
+ function of the `EditResource` class.
486
+ - Fixed issue in `setLocalFields` (`ItemEntry`) where some values were wrongly assumed to be present in `initialValues`.
487
+ - Optimization: Disabled automatic resolution of derived values in `addItems` (`CollectionEditResource`) when `modInstant` is set to true.
488
+
489
+ ## v1.2.0
490
+ - **Breaking:** When calling `addItems` or `addItem` on the `CollectionEditResource` class derived values are now
491
+ resolved automatically. Instead of a compound object like `{fields: {key: 'value'}, derived: {}}` an object like
492
+ `{key: 'value'}` should now be used as argument when calling these functions.
493
+ - **Breaking:** Added `localCache` parameter to `CollectionResource` constructor.
494
+
495
+ ## v1.1.20
496
+ - Fixed minor issue where collection wouldn't be deferred properly before expanding.
497
+ - `onChange` is now called automatically when when calling `commit` on an edit resource.
498
+
499
+ ## v1.1.19
500
+ - **Breaking:** Renamed `getCurrentChanges` to `getModuleChanges` in the `ItemAdministrator` class. Added optional
501
+ `localCache` parameter.
502
+
503
+ ### Local cache callback refactoring
504
+ - Removed `onSaveWithoutClosing` event.
505
+ - Added `condition` parameter to `onBeforeSave` and `onSaveSuccess` (possible values are `always`, `onClose` or
506
+ `skipOnClose`, defaults to `always`). Callbacks registered with `condition: always` will get executed before other
507
+ callbacks.
508
+ - Pass the local cache itself to all registered callback functions. Pass the item ID conversion map as second argument
509
+ to `onSaveSuccess` callback functions.
510
+
511
+ ## v1.1.18
512
+ - Calling `expand` on a `CollectionEntry` manually no longer defers the collection entry.
513
+ - The `batchFetch` and `batchExpand` functions in the `CollectionHandler` class now properly defer and resolve the
514
+ collection entries.
515
+
516
+ ## v1.1.17
517
+ - Fixed issue where the `getLocalByQuery` function in the `ItemCache` class wouldn't return any items.
518
+ - When batch resolving collection entries, `CollectionHandler` now looks for matching items using `getByQuery` instead
519
+ of `getByParent`.
520
+
521
+ ### Cache invalidation
522
+ - Added `queueReload` function to `ItemEntry` class. This will reload the item when the item entry itself or a
523
+ collection entry containing the item is requested.
524
+ - The `queueReload` function in the `CollectionEntry` class no longer directly defers the item.
525
+ - Added `invalidateCache` function to the `ItemAdministrator` class. This will call `queueReload` on all item entries
526
+ and collection entries.
527
+
528
+ ### Item entry refactoring
529
+ - Renamed `process` to `setFields`.
530
+ - Replaced `processLocal` with `setLocalFields`. This function no longer has a `modified` parameter.
531
+ - `setModified` now also sets local default values.
532
+ - Removed `setCreator`. This function was called twice in some instances.
533
+ - **Breaking:** Added `derived` parameter to `updateFields`
534
+
535
+ ##v1.16
536
+ - Pass `hasChanges` as second argument to `onBeforeSave` callbacks in the `LocalCache` class. This fixes an issue with
537
+ project financial values in the front-end. [RM4-9577]
538
+ - Added `callOnActivate` parameter to `addItems` function in `CollectionEditResource` class. Use this to prevent items
539
+ from being added to the local cache.
540
+
541
+ ##v1.15
542
+ - Fix `fetchItemTypesTranslations` function in `ColumnHandler` class.
543
+ - Fix type definition of `PromiseInterface.all`.
544
+
545
+ ##v1.14
546
+ - The `ChangesCompiler` now always processes local collections. (Even if they don't have edit resources.) This fixes an
547
+ issue with recurring appointments in the front-end.
548
+
549
+ ##v1.13
550
+ - Add option to exclude itemTypes during createLocalEntries.
551
+
552
+ ##v1.12
553
+ - **Breaking:** `ItemResource.isNew` returns true *only* if the resource was created using
554
+ `ItemAdministrator.getNewResource` or `ItemAdministrator.getItemByDef`. This fixes an issue where items where removed
555
+ from the local cache inadvertently.
556
+ - The `start`, `commit` and `rollback` functions of `EditResource` now return the resource itself to facilitate chaining.
557
+ - When calling `CollectionEntry.revertChanges`, callbacks like `onAdd` / `onRemove` and `onActivate` / `onDeactivate`
558
+ are now respected. This fixes an issue where items where *not* removed from the local cache.
559
+ - When removing *local* items from collections, they are removed from `initial` as well as `modified`. This fixes an
560
+ issue where changes were being detected continuously.
561
+ - Updated the order of requests in `changesProcessor`. The `update` request is now executed before the `delete` request,
562
+ except when updating documents. This fixes several issues.
563
+ - `CollectionCache` now uses a map instead of an array to store collections. This fixes an issue where the same
564
+ collection was added multiple times.
565
+ - Updated all models to use dependency objects. This increases ease of debugging.
566
+
567
+ ##v.1.11
568
+ - Fixed issue that occurs when saving when having an existing item refer to a newly created item.
569
+ - **Breaking:** Removed `ItemResourceService.isNewResource`.
570
+ - **Breaking:** Renamed `ItemResource.isNewResource` to `ItemResource.isNew`. Removed parameter.
571
+ - `ItemResource.isNew` is equivalent to `ItemResource.isLocal`, while `EditResource.isNew` checks also checks for
572
+ completed transactions.
573
+
574
+ ##v.1.10
575
+ - Fixed issue where changes on different subtabs were not detected.
576
+
577
+ ##v1.1.9
578
+ - Exposed `noop` function on `RmCore` class.
579
+ > This is used in order to check whether a callback has a default value.
580
+ - Added `copyRequestColumns` function to `ColumnUtil` class.
581
+ - Made parameters of `ItemAdministrator.saveCurrentLocalCache` and `LocalCache.save` optional.
582
+ - **Breaking:** Reordered parameters of `ChangesProcessor.execute` to be consistent with
583
+ `ItemAdministrator.saveCurrentLocalCache`. The new order is `singleItems` - `collections` - `parameters` -
584
+ `breakUpByParent` - `onAfterCreateCallback`.
585
+
586
+ ##v1.1.8
587
+ - Set default value for `params` to `{filter: false}` in `request` function in `ColumnHandler` class.
588
+
589
+ ##v1.1.7
590
+ - Fixed issue where cached item entries or collection entries wouldn't be added to the local cache.
591
+
592
+ ##v1.1.6
593
+ - Fixed issue with deferred item entries.
594
+ - Re-enable changes watcher after save.
595
+ - Added optional `id` parameter to `LocalCache` constructor.
596
+
597
+ ##v1.1.5
598
+ - Added `clearItem` function to `LocalCache` class.
599
+
600
+ ##v.1.1.4
601
+ - Fix issue where items where not added to the local cache automatically when they where added to a collection.
602
+ > This depends on the `callOnActivate` parameter. I've added this mainly because extending collections should *not* add
603
+ the items to the local cache.
604
+ > In other instances this might be debatable because it doesn't do any real harm. *Not*
605
+ doing it however can definitely be harmful.
606
+
607
+ ##v.1.1.3
608
+ - Fixed an issue where all collections in a local cache would be cleared.
609
+ - **Breaking:** Renamed `getCacheManager` to `getCurrentLocalCache` and `setCacheManager` to `setCurrentLocalCache` in
610
+ `LocalCacheManagerInterface`.
611
+
612
+ ##v1.1.2
613
+ - Fixed an issue concerning derived values.
614
+
615
+ ## v1.1.1
616
+ - Fixed an issue where changes wouldn't be detected.
617
+ - **Breaking:** Removed the `_hasChanges` function in the `localCache` class. If you want to force changes detection,
618
+ call `detectChanges` instead. Otherwise, rely on the `hasChanges` variable.
619
+ - **Breaking:** Removed the `enableWatcher` and `disableWatcher` functions. Use `enableChangesWatcher` and
620
+ `disableChangesWatcher` instead.
621
+
622
+ ## v1.1.0
623
+ ### Development
624
+
625
+ #### Strict TypeScript compilation
626
+ Added the following TypeScript compiler options:
627
+ - noImplicitThis
628
+ - noImplicitReturns
629
+ - strictNullChecks
630
+ - noUnusedLocals
631
+ - noUnusedParameters
632
+
633
+ I would advise enabling these for all TypeScript projects from now on.
634
+
635
+ #### Ordered imports and dependencies
636
+ Imports are now ordered alphabetically and grouped by folder. Added a TSLint option to enforce this.
637
+ Please note that this also applies for imports from the folder the file is currently in.
638
+ For example, in `models/ItemResource.ts`, `itemEntry` should be imported like so:
639
+ `import { ItemEntry } from '../models';`
640
+
641
+ Also, factory and class dependencies should be ordered alphabetically as well. This will make it easier to add and
642
+ remove dependencies in the future.
643
+
644
+ ### Breaking changes
645
+
646
+ - Renamed `changesCompiler` to `changesCompilation`, `changesCompilerFactory` to `changesCompilationFactory`,
647
+ `moduleChangesCompiler` to `moduleChangesCompilation` and `moduleChangesCompilerFactory` to
648
+ `moduleChangesCompilationFactory`.
649
+ - Removed the `allLinks` parameter from the `query` function definition in the `ApiRequestServiceInterface`. This is
650
+ no longer supported in the back-end.
651
+
652
+ #### Item and collection entries
653
+ - Moved *all* functions that handle item entries from the `ItemEntryService` to the `ItemEntry` class.
654
+ - Added the following functions to `ItemEntryService`:
655
+ - `createLocalConversionMap`;
656
+ - `expandLocalConversionMap`;
657
+ - `expandConversionMap`;
658
+ - `batchExpandConversionMap`;
659
+ - `batchClone`.
660
+ - Cloning of item entries now works slightly differently. The function will attempt to generate a new
661
+ item ID, and update the conversion map accordingly, but will respect the item ID that is already there.
662
+
663
+ #### Rework item caching
664
+ Newly created item entries and collection entries are no longer added to the global *or* local cache by default.
665
+ All entries are added to the global cache on save. Item entries are added to the local cache when resources are created
666
+ using the item administrator or when resources are created when adding the items to a collection.
667
+
668
+ > This will increase reliability by ensuring the global cache is no longer 'polluted' with local items. Also, this will
669
+ > allow for the creation item and collection entries without caching them directly. This is required for the copying and
670
+ > pasting of items.
671
+
672
+ Other changes:
673
+
674
+ - Moved `saveLocal` to `ItemAdministrator`;
675
+ - `ItemAdministrator.fetchTitle` should now be called instead of `ItemHandler.fetchTitle`;
676
+ - The `ItemAdministrator` collection matching functions (`addToCollections`, `removeFromCollections`) should now be
677
+ called instead of those in the `CollectionHandler`. The `CollectionHandler` should only be used to reflect changes
678
+ already on the backend. (Use `getCollectionMatcher`.)
679
+
680
+
681
+ ##v1.0.33
682
+ - Really fix types path
683
+
684
+ ##v1.0.33
685
+ - Fix types path
686
+
687
+ ##v1.0.32
688
+ - Update `tsconfig.json` to put definitions in the root folder
689
+ > The app had an issue with AOT compilation because of this
690
+
691
+ ##v1.0.31
692
+ - Fix `columnHandler.fetchItemTypeTranslations`
693
+ > It incorrectly looped over the response map, it should now work again
694
+
695
+ ##v1.0.30
696
+ - Remove `updateTabParams` from LocalCacheManagerInterface
697
+ > The function wasn't used
698
+
699
+ - Reworked class export
700
+ > Imports are now done from @rentman/rm-core, old imports are broken. This is because the old export structure didn't always work
701
+
702
+ ##v1.0.29
703
+ - Fix inverted inArray check in CollectionEntry.removeItems
704
+ > A delete message from the socket deleted all BUT the deleted items, this should now be fixed
705
+
706
+ ##v1.0.28
707
+ Bug fixes only
708
+
709
+ ##v1.0.27
710
+ - `ItemEntry.initial` is now undefined by default
711
+ > In the SocketMessageHandler we use this check to see if an ItemEntry is a stub
712
+
713
+ ##v1.0.26
714
+ Bundle both minified and unminified code, include sourcemaps from dev build
715
+
716
+ ##v1.0.24, v1.0.25
717
+ ! Use version `v1.0.26` !
718
+
719
+ - The core now expects a `promiseInterface` that should implement the provided `promiseInterface`
720
+ > We need to be able to hook into the promises in order to call a digest cycle to update the ui in the frontend
721
+
722
+ - Rename `ItemEntry.entryId` to `ItemEntry.id
723
+ > It used to be called `id`, but it was changed in the seperation of the core.
724
+ > You can use the `id` to uniquely identify an entry, since itemId can be updated (local to saved id)
725
+
726
+ - Rename ItemResource `startTransaction` to `start`
727
+ > Other functions are called `commit` and `rollback` so having 'transaction' only for start doesn't make much sense
728
+
729
+ - `SocketMessageHandler.onMessageReceived` now returns a promise
730
+ > You can now use the updated items or hook into the result to update the ui for example
731
+
732
+
733
+ ##v1.0.23
734
+ - Rename ResourceCache to LocalCache
735
+ > LocalCache only caches local items (name better reflects functionality)
736
+
737
+ - Remove getter/setter for hasChanges
738
+ > hasChanges is called in a digest loop in the frontend, so for performance reasons we don't want to recompute the value every time
739
+
740
+ - Remove `_getCollection` from ItemAdministrator
741
+ > `_getCollection` is now named `getCollection` and the old `getCollection` is removed. The query is part of the
742
+ > options and should not be given as a separate argument. This was included to support the frontend
743
+
744
+ - Remove `saveCurrentTab` from ItemAdministrator
745
+ > `saveCurrentTab` makes no sense because the core has no concept of tabs, you should use `saveCurrentLocalCache` instead
746
+
747
+ - Remove `getTabEntry` and `resetTabEntry` from ItemAdministrator
748
+ > `getTabEntry` and `resetTabEntry` make no sense because the core has no concept of tabs, you should use `getLocalCache` and `resetLocalCache` instead
749
+