@rentman/rm-core 2.0.7 → 2.0.8

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