@rentman/rm-core 7.0.0 → 7.0.1

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