@rentman/rm-core 2.0.11 → 2.0.13

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