@rentman/rm-core 7.0.0 → 7.0.2

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