@rentman/rm-core 2.0.11 → 2.0.12

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