@rentman/rm-core 1.6.0-1 → 1.6.0

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.
package/changelog.md CHANGED
@@ -1,434 +1,434 @@
1
- #Changelog
2
- Contains new features, breaking changes and their reasoning
3
-
4
- ## 1.6.0
5
- - All external callbacks are now wrapped in a `try ... catch` block. This prevents them from breaking core functionality.
6
- - **Breaking**: Add `ExceptionHandlerInterface` parameter to core constructor.
7
-
8
- ## 1.5.9
9
- - Fix issue that occurs when trying to resolve a `ColumnSet` using a single non-existing column.
10
- Catch exceptions that might occur when resolving an `ItemEntry`.
11
- - Add `mergeRequestColumns`, `mergeResponseColumns` to `ColumnSet`. When encountering new items while expanding a collection, add them to the collection.
12
-
13
- ## 1.5.8
14
- - Introduce `RemoteViewResource` and `LocalViewResource`.
15
- > The `fields` property of a `RemoteViewResource` represents
16
- server values, while the `fields` property of a `LocalViewResource` represents local values.
17
- - The `fields` property of a `ViewResource` is now read only.
18
-
19
- ## 1.5.7-1
20
- - Make ItemResource/CollectionResource base class abstract
21
- - Add missing overload functions in some places
22
- - Fix default comparator `QueryMatcher.parseSimpleQuery`
23
- - Fix `ExtendedCollectionMatchResult` `collection` property type
24
-
25
- ## 1.5.7
26
- - Properly type Collections & ItemResources (and return values) in the whole core.
27
- > The core will now properly return Collections & ItemResources based on the passed CollectionOptions.
28
- > You can now also type the expected collection type
29
-
30
- ```
31
- // Expects a collection with editCollection and editItems both `true`
32
- // Will properly return EditResources for all collection functions
33
- const collection: CollectionEditResource<EditResource>;
34
-
35
- // other variations are:
36
- // CollectionViewResource<ViewResource>
37
- // CollectionViewResource<EditResource>
38
- // CollectionEditResource<ViewResource>
39
-
40
- this.core.itemAdministrator.getCollection(
41
- 'Notitie',
42
- {
43
- editCollection: true, // Will return a CollectionEditResource
44
- editItems: true // Will return EditResources instead of ViewResources in `.items`
45
- }
46
- )
47
- ```
48
-
49
- ## 1.5.6
50
- - Add `getAllLocalCaches` to `LocalCacheManagerInterface`, remove item entries from all local caches on socket delete.
51
-
52
- ## 1.5.5
53
- - Add 'order' column type handling to ApiFormatter functions
54
-
55
- ## 1.5.4
56
- - Fix issue where parent would be incorrectly set when cloning a single item.
57
- - Type functions related to expansion maps in `ItemEntryService`.
58
-
59
- ## 1.5.3
60
- - Fix issue where the `enableSave` collection resource option would default to `false`. This would throw an error when
61
- calling `save` on a collection resource where this option was not explicitly set.
62
-
63
- ## 1.5.2
64
- - Type functions in `ColumnUtil` class.
65
- - Add `getRequestColumnId` and `containsDerivedColumns` to `ColumnUtil`.
66
- > `getRequestColumnId` should be used instead of `Util.getFirstProperty` when retrieving a column ID.
67
- - **Breaking:** Remove `ColumnUtil.isColumnSubset`. Use `ColumnSet.isSuperSetOf` instead.
68
- - Remove `findColumnObject`. Rename `findColumn` to `findRequestColumn`.
69
-
70
- ## 1.5.1
71
- - Properly remove item entry stub from (local) cache when request fails.
72
- - Fix issue where item or collection options could be set to undefined.
73
-
74
- ## 1.5.0
75
- - Add `SocketMessage` type and add types to `SocketMessageHandler`
76
- - Expand local items requested using `getItemById` or `getItemsById` in `ItemAdministrator`.
77
- (`fetchItem` or `fetchItems` in `ItemHandler`.)
78
- - Implement expanding of local collections. This no longer leads to invalid requests.
79
- - **Breaking:** The `expand` function in `CollectionEntry` now has an `ItemCache` parameter.
80
- - **Warning:** This version contains major changes.
81
-
82
- ### Introduce typing of item and collection options
83
- - **Breaking:** Removed `QueryItemType` collection entry option.
84
- - **Breaking:** Removed `ItemResourceService`.
85
- - Removed `processOptions` parameter from `createCollectionResource` (`ItemAdministrator`). It is now equivalent to
86
- `addCollection`.
87
- - When creating an item resource using `ItemResourceFactory`, a collection entry using `CollectionResourceFactory` or a
88
- collection resource using `CollectionResourceFactory` it is no longer necessary to process options beforehand. It is
89
- still necessary when interacting with `CollectionHandler` or `ItemHandler` directly.
90
-
91
- ## v1.4.0
92
- - Add `expandProcessLinkedItems` and `expandAddToCollections` to `ItemAdministrator`. These are analogues to
93
- `processLinkedItems` and `addToCollections`, but also expand the items with (derived) values and columns as necessary.
94
- They have a slightly different type signature.
95
- - Whenever a collection is requested, the `CollectionHandler` now makes sure that added local items are expanded as
96
- necessary.
97
- - **Breaking:** Last parameter of `ItemHandler.createLocalEntries` is now a callback function.
98
- - **Breaking:** Rename `TemplateLinkedItemEntryMap` type to `TemplateItemEntryMap`.
99
-
100
- ## v1.3.8
101
- - Add `isSaving` to `LocalCache`
102
- > We use this to disable the cancel/save buttons while the localCache is saving in the frontend
103
-
104
- ## v1.3.7
105
- - Fix issues that generate invalid requests / changes when moving existing item to another collection, then deleting the parent.
106
- - Remove slip workarounds
107
- - Add api request types
108
- - Add types to `ModuleChangesCompilation`
109
-
110
- ## v1.3.6
111
- - Skip add / remove collection callbacks when calling `revertChanges` (`LocalCache`).
112
-
113
- ## v1.3.5
114
- - Fix issue where items added to collections when resolving wouldn't be removed in `revertChanges` (`LocalCache`).
115
-
116
- ## v1.3.4
117
- - Add country to isFilteredColumn in ColumnUtil
118
-
119
- ## v1.3.3
120
- - Move processLocalConfigColumns and consolidateColumns from ColumnUtil to frontend
121
- > These functions are specifically used for rendering ui-grid in the frontend, so there's
122
- no reason to have them in the core
123
-
124
- ## v1.3.2
125
- - Fix types path in package.json
126
-
127
- ## v1.3.1
128
- - Fix types path in package.json
129
-
130
- ## v1.3.0
131
- - Rename PromiseInterface to PromiseLibraryInterface
132
- > PromiseInterface is now used for the internal promise type
133
-
134
- - Use PromiseInterface instead of Promise as internal promise type
135
- > This allows us to overwrite the PromiseInterface definition in the frontend indicate usage of ng.IPromise
136
-
137
- ## v1.2.9
138
- - Call processOptions in fetchDerivedValuesByColumn
139
- > Bug was introduced earlier but got enabled in v1.2.7
140
-
141
- ## v1.2.8
142
- - Add toJSON methods for ItemResources, ItemEntries, and ColumnSets to fix circular dependencies in JSON.stringify
143
-
144
- ## v1.2.7
145
- - Set itemEntry parent when generating a stub
146
-
147
- ## v1.2.6
148
- - Fix an issue introduced in v1.2.5.
149
-
150
- ## v1.2.5
151
- - When a local item cannot by found, return a newly created item in `getItemByState` (`ItemAdministrator`) only. This
152
- solves an issue with refreshing on a local edit view.
153
-
154
- ## v1.2.4
155
- - **Breaking:** When a local item cannot by found, instead of a new item being created an error is thrown. This means it
156
- is no longer possible to create local items using `getItemById` or `getItemsById` in the `ItemAdministrator` class.
157
- - **Breaking:** Removed `getItemDefinition` and `getItemByDef` in the `ItemAdministrator` class. Added `getItemByState`.
158
- - Renamed types `TemplateResponseItemEntryMap` to `TemplateItemEntryMap` and `TemplateResponseLinkedItemEntryMap` to
159
- `TemplateLinkedItemEntryMap`.
160
- - Removed `getCollectionCacheKey` in `KeyService`. (Legacy code.)
161
-
162
- ## v1.2.3
163
- - Fixed issue where derived values deeper than one layer couldn't be resolved.
164
-
165
- ## v1.2.2
166
- - Fixed issue where in derived values weren't set after create request.
167
-
168
- ## v1.2.1
169
- - **Breaking:** Replaced the `initial` parameter with the `callOnChange` parameter (`true` by default) in the `commit`
170
- function of the `EditResource` class.
171
- - Fixed issue in `setLocalFields` (`ItemEntry`) where some values were wrongly assumed to be present in `initialValues`.
172
- - Optimization: Disabled automatic resolution of derived values in `addItems` (`CollectionEditResource`) when `modInstant` is set to true.
173
-
174
- ## v1.2.0
175
- - **Breaking:** When calling `addItems` or `addItem` on the `CollectionEditResource` class derived values are now
176
- resolved automatically. Instead of a compound object like `{fields: {key: 'value'}, derived: {}}` an object like
177
- `{key: 'value'}` should now be used as argument when calling these functions.
178
- - **Breaking:** Added `localCache` parameter to `CollectionResource` constructor.
179
-
180
- ## v1.1.20
181
- - Fixed minor issue where collection wouldn't be deferred properly before expanding.
182
- - `onChange` is now called automatically when when calling `commit` on an edit resource.
183
-
184
- ## v1.1.19
185
- - **Breaking:** Renamed `getCurrentChanges` to `getModuleChanges` in the `ItemAdministrator` class. Added optional
186
- `localCache` parameter.
187
-
188
- ### Local cache callback refactoring
189
- - Removed `onSaveWithoutClosing` event.
190
- - Added `condition` parameter to `onBeforeSave` and `onSaveSuccess` (possible values are `always`, `onClose` or
191
- `skipOnClose`, defaults to `always`). Callbacks registered with `condition: always` will get executed before other
192
- callbacks.
193
- - Pass the local cache itself to all registered callback functions. Pass the item ID conversion map as second argument
194
- to `onSaveSuccess` callback functions.
195
-
196
- ## v1.1.18
197
- - Calling `expand` on a `CollectionEntry` manually no longer defers the collection entry.
198
- - The `batchFetch` and `batchExpand` functions in the `CollectionHandler` class now properly defer and resolve the
199
- collection entries.
200
-
201
- ## v1.1.17
202
- - Fixed issue where the `getLocalByQuery` function in the `ItemCache` class wouldn't return any items.
203
- - When batch resolving collection entries, `CollectionHandler` now looks for matching items using `getByQuery` instead
204
- of `getByParent`.
205
-
206
- ### Cache invalidation
207
- - Added `queueReload` function to `ItemEntry` class. This will reload the item when the item entry itself or a
208
- collection entry containing the item is requested.
209
- - The `queueReload` function in the `CollectionEntry` class no longer directly defers the item.
210
- - Added `invalidateCache` function to the `ItemAdministrator` class. This will call `queueReload` on all item entries
211
- and collection entries.
212
-
213
- ### Item entry refactoring
214
- - Renamed `process` to `setFields`.
215
- - Replaced `processLocal` with `setLocalFields`. This function no longer has a `modified` parameter.
216
- - `setModified` now also sets local default values.
217
- - Removed `setCreator`. This function was called twice in some instances.
218
- - **Breaking:** Added `derived` parameter to `updateFields`
219
-
220
- ##v1.16
221
- - Pass `hasChanges` as second argument to `onBeforeSave` callbacks in the `LocalCache` class. This fixes an issue with
222
- project financial values in the front-end. [RM4-9577]
223
- - Added `callOnActivate` parameter to `addItems` function in `CollectionEditResource` class. Use this to prevent items
224
- from being added to the local cache.
225
-
226
- ##v1.15
227
- - Fix `fetchItemTypesTranslations` function in `ColumnHandler` class.
228
- - Fix type definition of `PromiseInterface.all`.
229
-
230
- ##v1.14
231
- - The `ChangesCompiler` now always processes local collections. (Even if they don't have edit resources.) This fixes an
232
- issue with recurring appointments in the front-end.
233
-
234
- ##v1.13
235
- - Add option to exclude itemTypes during createLocalEntries.
236
-
237
- ##v1.12
238
- - **Breaking:** `ItemResource.isNew` returns true *only* if the resource was created using
239
- `ItemAdministrator.getNewResource` or `ItemAdministrator.getItemByDef`. This fixes an issue where items where removed
240
- from the local cache inadvertently.
241
- - The `start`, `commit` and `rollback` functions of `EditResource` now return the resource itself to facilitate chaining.
242
- - When calling `CollectionEntry.revertChanges`, callbacks like `onAdd` / `onRemove` and `onActivate` / `onDeactivate`
243
- are now respected. This fixes an issue where items where *not* removed from the local cache.
244
- - When removing *local* items from collections, they are removed from `initial` as well as `modified`. This fixes an
245
- issue where changes were being detected continuously.
246
- - Updated the order of requests in `changesProcessor`. The `update` request is now executed before the `delete` request,
247
- except when updating documents. This fixes several issues.
248
- - `CollectionCache` now uses a map instead of an array to store collections. This fixes an issue where the same
249
- collection was added multiple times.
250
- - Updated all models to use dependency objects. This increases ease of debugging.
251
-
252
- ##v.1.11
253
- - Fixed issue that occurs when saving when having an existing item refer to a newly created item.
254
- - **Breaking:** Removed `ItemResourceService.isNewResource`.
255
- - **Breaking:** Renamed `ItemResource.isNewResource` to `ItemResource.isNew`. Removed parameter.
256
- - `ItemResource.isNew` is equivalent to `ItemResource.isLocal`, while `EditResource.isNew` checks also checks for
257
- completed transactions.
258
-
259
- ##v.1.10
260
- - Fixed issue where changes on different subtabs were not detected.
261
-
262
- ##v1.1.9
263
- - Exposed `noop` function on `RmCore` class.
264
- > This is used in order to check whether a callback has a default value.
265
- - Added `copyRequestColumns` function to `ColumnUtil` class.
266
- - Made parameters of `ItemAdministrator.saveCurrentLocalCache` and `LocalCache.save` optional.
267
- - **Breaking:** Reordered parameters of `ChangesProcessor.execute` to be consistent with
268
- `ItemAdministrator.saveCurrentLocalCache`. The new order is `singleItems` - `collections` - `parameters` -
269
- `breakUpByParent` - `onAfterCreateCallback`.
270
-
271
- ##v1.1.8
272
- - Set default value for `params` to `{filter: false}` in `request` function in `ColumnHandler` class.
273
-
274
- ##v1.1.7
275
- - Fixed issue where cached item entries or collection entries wouldn't be added to the local cache.
276
-
277
- ##v1.1.6
278
- - Fixed issue with deferred item entries.
279
- - Re-enable changes watcher after save.
280
- - Added optional `id` parameter to `LocalCache` constructor.
281
-
282
- ##v1.1.5
283
- - Added `clearItem` function to `LocalCache` class.
284
-
285
- ##v.1.1.4
286
- - Fix issue where items where not added to the local cache automatically when they where added to a collection.
287
- > This depends on the `callOnActivate` parameter. I've added this mainly because extending collections should *not* add
288
- the items to the local cache.
289
- > In other instances this might be debatable because it doesn't do any real harm. *Not*
290
- doing it however can definitely be harmful.
291
-
292
- ##v.1.1.3
293
- - Fixed an issue where all collections in a local cache would be cleared.
294
- - **Breaking:** Renamed `getCacheManager` to `getCurrentLocalCache` and `setCacheManager` to `setCurrentLocalCache` in
295
- `LocalCacheManagerInterface`.
296
-
297
- ##v1.1.2
298
- - Fixed an issue concerning derived values.
299
-
300
- ## v1.1.1
301
- - Fixed an issue where changes wouldn't be detected.
302
- - **Breaking:** Removed the `_hasChanges` function in the `localCache` class. If you want to force changes detection,
303
- call `detectChanges` instead. Otherwise, rely on the `hasChanges` variable.
304
- - **Breaking:** Removed the `enableWatcher` and `disableWatcher` functions. Use `enableChangesWatcher` and
305
- `disableChangesWatcher` instead.
306
-
307
- ## v1.1.0
308
- ### Development
309
-
310
- #### Strict TypeScript compilation
311
- Added the following TypeScript compiler options:
312
- - noImplicitThis
313
- - noImplicitReturns
314
- - strictNullChecks
315
- - noUnusedLocals
316
- - noUnusedParameters
317
-
318
- I would advise enabling these for all TypeScript projects from now on.
319
-
320
- #### Ordered imports and dependencies
321
- Imports are now ordered alphabetically and grouped by folder. Added a TSLint option to enforce this.
322
- Please note that this also applies for imports from the folder the file is currently in.
323
- For example, in `models/ItemResource.ts`, `itemEntry` should be imported like so:
324
- `import { ItemEntry } from '../models';`
325
-
326
- Also, factory and class dependencies should be ordered alphabetically as well. This will make it easier to add and
327
- remove dependencies in the future.
328
-
329
- ### Breaking changes
330
-
331
- - Renamed `changesCompiler` to `changesCompilation`, `changesCompilerFactory` to `changesCompilationFactory`,
332
- `moduleChangesCompiler` to `moduleChangesCompilation` and `moduleChangesCompilerFactory` to
333
- `moduleChangesCompilationFactory`.
334
- - Removed the `allLinks` parameter from the `query` function definition in the `ApiRequestServiceInterface`. This is
335
- no longer supported in the back-end.
336
-
337
- #### Item and collection entries
338
- - Moved *all* functions that handle item entries from the `ItemEntryService` to the `ItemEntry` class.
339
- - Added the following functions to `ItemEntryService`:
340
- - `createLocalConversionMap`;
341
- - `expandLocalConversionMap`;
342
- - `expandConversionMap`;
343
- - `batchExpandConversionMap`;
344
- - `batchClone`.
345
- - Cloning of item entries now works slightly differently. The function will attempt to generate a new
346
- item ID, and update the conversion map accordingly, but will respect the item ID that is already there.
347
-
348
- #### Rework item caching
349
- Newly created item entries and collection entries are no longer added to the global *or* local cache by default.
350
- All entries are added to the global cache on save. Item entries are added to the local cache when resources are created
351
- using the item administrator or when resources are created when adding the items to a collection.
352
-
353
- > This will increase reliability by ensuring the global cache is no longer 'polluted' with local items. Also, this will
354
- > allow for the creation item and collection entries without caching them directly. This is required for the copying and
355
- > pasting of items.
356
-
357
- Other changes:
358
-
359
- - Moved `saveLocal` to `ItemAdministrator`;
360
- - `ItemAdministrator.fetchTitle` should now be called instead of `ItemHandler.fetchTitle`;
361
- - The `ItemAdministrator` collection matching functions (`addToCollections`, `removeFromCollections`) should now be
362
- called instead of those in the `CollectionHandler`. The `CollectionHandler` should only be used to reflect changes
363
- already on the backend. (Use `getCollectionMatcher`.)
364
-
365
-
366
- ##v1.0.33
367
- - Really fix types path
368
-
369
- ##v1.0.33
370
- - Fix types path
371
-
372
- ##v1.0.32
373
- - Update `tsconfig.json` to put definitions in the root folder
374
- > The app had an issue with AOT compilation because of this
375
-
376
- ##v1.0.31
377
- - Fix `columnHandler.fetchItemTypeTranslations`
378
- > It incorrectly looped over the response map, it should now work again
379
-
380
- ##v1.0.30
381
- - Remove `updateTabParams` from LocalCacheManagerInterface
382
- > The function wasn't used
383
-
384
- - Reworked class export
385
- > Imports are now done from @rentman/rm-core, old imports are broken. This is because the old export structure didn't always work
386
-
387
- ##v1.0.29
388
- - Fix inverted inArray check in CollectionEntry.removeItems
389
- > A delete message from the socket deleted all BUT the deleted items, this should now be fixed
390
-
391
- ##v1.0.28
392
- Bug fixes only
393
-
394
- ##v1.0.27
395
- - `ItemEntry.initial` is now undefined by default
396
- > In the SocketMessageHandler we use this check to see if an ItemEntry is a stub
397
-
398
- ##v1.0.26
399
- Bundle both minified and unminified code, include sourcemaps from dev build
400
-
401
- ##v1.0.24, v1.0.25
402
- ! Use version `v1.0.26` !
403
-
404
- - The core now expects a `promiseInterface` that should implement the provided `promiseInterface`
405
- > We need to be able to hook into the promises in order to call a digest cycle to update the ui in the frontend
406
-
407
- - Rename `ItemEntry.entryId` to `ItemEntry.id
408
- > It used to be called `id`, but it was changed in the seperation of the core.
409
- > You can use the `id` to uniquely identify an entry, since itemId can be updated (local to saved id)
410
-
411
- - Rename ItemResource `startTransaction` to `start`
412
- > Other functions are called `commit` and `rollback` so having 'transaction' only for start doesn't make much sense
413
-
414
- - `SocketMessageHandler.onMessageReceived` now returns a promise
415
- > You can now use the updated items or hook into the result to update the ui for example
416
-
417
-
418
- ##v1.0.23
419
- - Rename ResourceCache to LocalCache
420
- > LocalCache only caches local items (name better reflects functionality)
421
-
422
- - Remove getter/setter for hasChanges
423
- > hasChanges is called in a digest loop in the frontend, so for performance reasons we don't want to recompute the value every time
424
-
425
- - Remove `_getCollection` from ItemAdministrator
426
- > `_getCollection` is now named `getCollection` and the old `getCollection` is removed. The query is part of the
427
- > options and should not be given as a separate argument. This was included to support the frontend
428
-
429
- - Remove `saveCurrentTab` from ItemAdministrator
430
- > `saveCurrentTab` makes no sense because the core has no concept of tabs, you should use `saveCurrentLocalCache` instead
431
-
432
- - Remove `getTabEntry` and `resetTabEntry` from ItemAdministrator
433
- > `getTabEntry` and `resetTabEntry` make no sense because the core has no concept of tabs, you should use `getLocalCache` and `resetLocalCache` instead
434
-
1
+ #Changelog
2
+ Contains new features, breaking changes and their reasoning
3
+
4
+ ## 1.6.0
5
+ - All external callbacks are now wrapped in a `try ... catch` block. This prevents them from breaking core functionality.
6
+ - **Breaking**: Add `ExceptionHandlerInterface` parameter to core constructor.
7
+
8
+ ## 1.5.9
9
+ - Fix issue that occurs when trying to resolve a `ColumnSet` using a single non-existing column.
10
+ Catch exceptions that might occur when resolving an `ItemEntry`.
11
+ - Add `mergeRequestColumns`, `mergeResponseColumns` to `ColumnSet`. When encountering new items while expanding a collection, add them to the collection.
12
+
13
+ ## 1.5.8
14
+ - Introduce `RemoteViewResource` and `LocalViewResource`.
15
+ > The `fields` property of a `RemoteViewResource` represents
16
+ server values, while the `fields` property of a `LocalViewResource` represents local values.
17
+ - The `fields` property of a `ViewResource` is now read only.
18
+
19
+ ## 1.5.7-1
20
+ - Make ItemResource/CollectionResource base class abstract
21
+ - Add missing overload functions in some places
22
+ - Fix default comparator `QueryMatcher.parseSimpleQuery`
23
+ - Fix `ExtendedCollectionMatchResult` `collection` property type
24
+
25
+ ## 1.5.7
26
+ - Properly type Collections & ItemResources (and return values) in the whole core.
27
+ > The core will now properly return Collections & ItemResources based on the passed CollectionOptions.
28
+ > You can now also type the expected collection type
29
+
30
+ ```
31
+ // Expects a collection with editCollection and editItems both `true`
32
+ // Will properly return EditResources for all collection functions
33
+ const collection: CollectionEditResource<EditResource>;
34
+
35
+ // other variations are:
36
+ // CollectionViewResource<ViewResource>
37
+ // CollectionViewResource<EditResource>
38
+ // CollectionEditResource<ViewResource>
39
+
40
+ this.core.itemAdministrator.getCollection(
41
+ 'Notitie',
42
+ {
43
+ editCollection: true, // Will return a CollectionEditResource
44
+ editItems: true // Will return EditResources instead of ViewResources in `.items`
45
+ }
46
+ )
47
+ ```
48
+
49
+ ## 1.5.6
50
+ - Add `getAllLocalCaches` to `LocalCacheManagerInterface`, remove item entries from all local caches on socket delete.
51
+
52
+ ## 1.5.5
53
+ - Add 'order' column type handling to ApiFormatter functions
54
+
55
+ ## 1.5.4
56
+ - Fix issue where parent would be incorrectly set when cloning a single item.
57
+ - Type functions related to expansion maps in `ItemEntryService`.
58
+
59
+ ## 1.5.3
60
+ - Fix issue where the `enableSave` collection resource option would default to `false`. This would throw an error when
61
+ calling `save` on a collection resource where this option was not explicitly set.
62
+
63
+ ## 1.5.2
64
+ - Type functions in `ColumnUtil` class.
65
+ - Add `getRequestColumnId` and `containsDerivedColumns` to `ColumnUtil`.
66
+ > `getRequestColumnId` should be used instead of `Util.getFirstProperty` when retrieving a column ID.
67
+ - **Breaking:** Remove `ColumnUtil.isColumnSubset`. Use `ColumnSet.isSuperSetOf` instead.
68
+ - Remove `findColumnObject`. Rename `findColumn` to `findRequestColumn`.
69
+
70
+ ## 1.5.1
71
+ - Properly remove item entry stub from (local) cache when request fails.
72
+ - Fix issue where item or collection options could be set to undefined.
73
+
74
+ ## 1.5.0
75
+ - Add `SocketMessage` type and add types to `SocketMessageHandler`
76
+ - Expand local items requested using `getItemById` or `getItemsById` in `ItemAdministrator`.
77
+ (`fetchItem` or `fetchItems` in `ItemHandler`.)
78
+ - Implement expanding of local collections. This no longer leads to invalid requests.
79
+ - **Breaking:** The `expand` function in `CollectionEntry` now has an `ItemCache` parameter.
80
+ - **Warning:** This version contains major changes.
81
+
82
+ ### Introduce typing of item and collection options
83
+ - **Breaking:** Removed `QueryItemType` collection entry option.
84
+ - **Breaking:** Removed `ItemResourceService`.
85
+ - Removed `processOptions` parameter from `createCollectionResource` (`ItemAdministrator`). It is now equivalent to
86
+ `addCollection`.
87
+ - When creating an item resource using `ItemResourceFactory`, a collection entry using `CollectionResourceFactory` or a
88
+ collection resource using `CollectionResourceFactory` it is no longer necessary to process options beforehand. It is
89
+ still necessary when interacting with `CollectionHandler` or `ItemHandler` directly.
90
+
91
+ ## v1.4.0
92
+ - Add `expandProcessLinkedItems` and `expandAddToCollections` to `ItemAdministrator`. These are analogues to
93
+ `processLinkedItems` and `addToCollections`, but also expand the items with (derived) values and columns as necessary.
94
+ They have a slightly different type signature.
95
+ - Whenever a collection is requested, the `CollectionHandler` now makes sure that added local items are expanded as
96
+ necessary.
97
+ - **Breaking:** Last parameter of `ItemHandler.createLocalEntries` is now a callback function.
98
+ - **Breaking:** Rename `TemplateLinkedItemEntryMap` type to `TemplateItemEntryMap`.
99
+
100
+ ## v1.3.8
101
+ - Add `isSaving` to `LocalCache`
102
+ > We use this to disable the cancel/save buttons while the localCache is saving in the frontend
103
+
104
+ ## v1.3.7
105
+ - Fix issues that generate invalid requests / changes when moving existing item to another collection, then deleting the parent.
106
+ - Remove slip workarounds
107
+ - Add api request types
108
+ - Add types to `ModuleChangesCompilation`
109
+
110
+ ## v1.3.6
111
+ - Skip add / remove collection callbacks when calling `revertChanges` (`LocalCache`).
112
+
113
+ ## v1.3.5
114
+ - Fix issue where items added to collections when resolving wouldn't be removed in `revertChanges` (`LocalCache`).
115
+
116
+ ## v1.3.4
117
+ - Add country to isFilteredColumn in ColumnUtil
118
+
119
+ ## v1.3.3
120
+ - Move processLocalConfigColumns and consolidateColumns from ColumnUtil to frontend
121
+ > These functions are specifically used for rendering ui-grid in the frontend, so there's
122
+ no reason to have them in the core
123
+
124
+ ## v1.3.2
125
+ - Fix types path in package.json
126
+
127
+ ## v1.3.1
128
+ - Fix types path in package.json
129
+
130
+ ## v1.3.0
131
+ - Rename PromiseInterface to PromiseLibraryInterface
132
+ > PromiseInterface is now used for the internal promise type
133
+
134
+ - Use PromiseInterface instead of Promise as internal promise type
135
+ > This allows us to overwrite the PromiseInterface definition in the frontend indicate usage of ng.IPromise
136
+
137
+ ## v1.2.9
138
+ - Call processOptions in fetchDerivedValuesByColumn
139
+ > Bug was introduced earlier but got enabled in v1.2.7
140
+
141
+ ## v1.2.8
142
+ - Add toJSON methods for ItemResources, ItemEntries, and ColumnSets to fix circular dependencies in JSON.stringify
143
+
144
+ ## v1.2.7
145
+ - Set itemEntry parent when generating a stub
146
+
147
+ ## v1.2.6
148
+ - Fix an issue introduced in v1.2.5.
149
+
150
+ ## v1.2.5
151
+ - When a local item cannot by found, return a newly created item in `getItemByState` (`ItemAdministrator`) only. This
152
+ solves an issue with refreshing on a local edit view.
153
+
154
+ ## v1.2.4
155
+ - **Breaking:** When a local item cannot by found, instead of a new item being created an error is thrown. This means it
156
+ is no longer possible to create local items using `getItemById` or `getItemsById` in the `ItemAdministrator` class.
157
+ - **Breaking:** Removed `getItemDefinition` and `getItemByDef` in the `ItemAdministrator` class. Added `getItemByState`.
158
+ - Renamed types `TemplateResponseItemEntryMap` to `TemplateItemEntryMap` and `TemplateResponseLinkedItemEntryMap` to
159
+ `TemplateLinkedItemEntryMap`.
160
+ - Removed `getCollectionCacheKey` in `KeyService`. (Legacy code.)
161
+
162
+ ## v1.2.3
163
+ - Fixed issue where derived values deeper than one layer couldn't be resolved.
164
+
165
+ ## v1.2.2
166
+ - Fixed issue where in derived values weren't set after create request.
167
+
168
+ ## v1.2.1
169
+ - **Breaking:** Replaced the `initial` parameter with the `callOnChange` parameter (`true` by default) in the `commit`
170
+ function of the `EditResource` class.
171
+ - Fixed issue in `setLocalFields` (`ItemEntry`) where some values were wrongly assumed to be present in `initialValues`.
172
+ - Optimization: Disabled automatic resolution of derived values in `addItems` (`CollectionEditResource`) when `modInstant` is set to true.
173
+
174
+ ## v1.2.0
175
+ - **Breaking:** When calling `addItems` or `addItem` on the `CollectionEditResource` class derived values are now
176
+ resolved automatically. Instead of a compound object like `{fields: {key: 'value'}, derived: {}}` an object like
177
+ `{key: 'value'}` should now be used as argument when calling these functions.
178
+ - **Breaking:** Added `localCache` parameter to `CollectionResource` constructor.
179
+
180
+ ## v1.1.20
181
+ - Fixed minor issue where collection wouldn't be deferred properly before expanding.
182
+ - `onChange` is now called automatically when when calling `commit` on an edit resource.
183
+
184
+ ## v1.1.19
185
+ - **Breaking:** Renamed `getCurrentChanges` to `getModuleChanges` in the `ItemAdministrator` class. Added optional
186
+ `localCache` parameter.
187
+
188
+ ### Local cache callback refactoring
189
+ - Removed `onSaveWithoutClosing` event.
190
+ - Added `condition` parameter to `onBeforeSave` and `onSaveSuccess` (possible values are `always`, `onClose` or
191
+ `skipOnClose`, defaults to `always`). Callbacks registered with `condition: always` will get executed before other
192
+ callbacks.
193
+ - Pass the local cache itself to all registered callback functions. Pass the item ID conversion map as second argument
194
+ to `onSaveSuccess` callback functions.
195
+
196
+ ## v1.1.18
197
+ - Calling `expand` on a `CollectionEntry` manually no longer defers the collection entry.
198
+ - The `batchFetch` and `batchExpand` functions in the `CollectionHandler` class now properly defer and resolve the
199
+ collection entries.
200
+
201
+ ## v1.1.17
202
+ - Fixed issue where the `getLocalByQuery` function in the `ItemCache` class wouldn't return any items.
203
+ - When batch resolving collection entries, `CollectionHandler` now looks for matching items using `getByQuery` instead
204
+ of `getByParent`.
205
+
206
+ ### Cache invalidation
207
+ - Added `queueReload` function to `ItemEntry` class. This will reload the item when the item entry itself or a
208
+ collection entry containing the item is requested.
209
+ - The `queueReload` function in the `CollectionEntry` class no longer directly defers the item.
210
+ - Added `invalidateCache` function to the `ItemAdministrator` class. This will call `queueReload` on all item entries
211
+ and collection entries.
212
+
213
+ ### Item entry refactoring
214
+ - Renamed `process` to `setFields`.
215
+ - Replaced `processLocal` with `setLocalFields`. This function no longer has a `modified` parameter.
216
+ - `setModified` now also sets local default values.
217
+ - Removed `setCreator`. This function was called twice in some instances.
218
+ - **Breaking:** Added `derived` parameter to `updateFields`
219
+
220
+ ##v1.16
221
+ - Pass `hasChanges` as second argument to `onBeforeSave` callbacks in the `LocalCache` class. This fixes an issue with
222
+ project financial values in the front-end. [RM4-9577]
223
+ - Added `callOnActivate` parameter to `addItems` function in `CollectionEditResource` class. Use this to prevent items
224
+ from being added to the local cache.
225
+
226
+ ##v1.15
227
+ - Fix `fetchItemTypesTranslations` function in `ColumnHandler` class.
228
+ - Fix type definition of `PromiseInterface.all`.
229
+
230
+ ##v1.14
231
+ - The `ChangesCompiler` now always processes local collections. (Even if they don't have edit resources.) This fixes an
232
+ issue with recurring appointments in the front-end.
233
+
234
+ ##v1.13
235
+ - Add option to exclude itemTypes during createLocalEntries.
236
+
237
+ ##v1.12
238
+ - **Breaking:** `ItemResource.isNew` returns true *only* if the resource was created using
239
+ `ItemAdministrator.getNewResource` or `ItemAdministrator.getItemByDef`. This fixes an issue where items where removed
240
+ from the local cache inadvertently.
241
+ - The `start`, `commit` and `rollback` functions of `EditResource` now return the resource itself to facilitate chaining.
242
+ - When calling `CollectionEntry.revertChanges`, callbacks like `onAdd` / `onRemove` and `onActivate` / `onDeactivate`
243
+ are now respected. This fixes an issue where items where *not* removed from the local cache.
244
+ - When removing *local* items from collections, they are removed from `initial` as well as `modified`. This fixes an
245
+ issue where changes were being detected continuously.
246
+ - Updated the order of requests in `changesProcessor`. The `update` request is now executed before the `delete` request,
247
+ except when updating documents. This fixes several issues.
248
+ - `CollectionCache` now uses a map instead of an array to store collections. This fixes an issue where the same
249
+ collection was added multiple times.
250
+ - Updated all models to use dependency objects. This increases ease of debugging.
251
+
252
+ ##v.1.11
253
+ - Fixed issue that occurs when saving when having an existing item refer to a newly created item.
254
+ - **Breaking:** Removed `ItemResourceService.isNewResource`.
255
+ - **Breaking:** Renamed `ItemResource.isNewResource` to `ItemResource.isNew`. Removed parameter.
256
+ - `ItemResource.isNew` is equivalent to `ItemResource.isLocal`, while `EditResource.isNew` checks also checks for
257
+ completed transactions.
258
+
259
+ ##v.1.10
260
+ - Fixed issue where changes on different subtabs were not detected.
261
+
262
+ ##v1.1.9
263
+ - Exposed `noop` function on `RmCore` class.
264
+ > This is used in order to check whether a callback has a default value.
265
+ - Added `copyRequestColumns` function to `ColumnUtil` class.
266
+ - Made parameters of `ItemAdministrator.saveCurrentLocalCache` and `LocalCache.save` optional.
267
+ - **Breaking:** Reordered parameters of `ChangesProcessor.execute` to be consistent with
268
+ `ItemAdministrator.saveCurrentLocalCache`. The new order is `singleItems` - `collections` - `parameters` -
269
+ `breakUpByParent` - `onAfterCreateCallback`.
270
+
271
+ ##v1.1.8
272
+ - Set default value for `params` to `{filter: false}` in `request` function in `ColumnHandler` class.
273
+
274
+ ##v1.1.7
275
+ - Fixed issue where cached item entries or collection entries wouldn't be added to the local cache.
276
+
277
+ ##v1.1.6
278
+ - Fixed issue with deferred item entries.
279
+ - Re-enable changes watcher after save.
280
+ - Added optional `id` parameter to `LocalCache` constructor.
281
+
282
+ ##v1.1.5
283
+ - Added `clearItem` function to `LocalCache` class.
284
+
285
+ ##v.1.1.4
286
+ - Fix issue where items where not added to the local cache automatically when they where added to a collection.
287
+ > This depends on the `callOnActivate` parameter. I've added this mainly because extending collections should *not* add
288
+ the items to the local cache.
289
+ > In other instances this might be debatable because it doesn't do any real harm. *Not*
290
+ doing it however can definitely be harmful.
291
+
292
+ ##v.1.1.3
293
+ - Fixed an issue where all collections in a local cache would be cleared.
294
+ - **Breaking:** Renamed `getCacheManager` to `getCurrentLocalCache` and `setCacheManager` to `setCurrentLocalCache` in
295
+ `LocalCacheManagerInterface`.
296
+
297
+ ##v1.1.2
298
+ - Fixed an issue concerning derived values.
299
+
300
+ ## v1.1.1
301
+ - Fixed an issue where changes wouldn't be detected.
302
+ - **Breaking:** Removed the `_hasChanges` function in the `localCache` class. If you want to force changes detection,
303
+ call `detectChanges` instead. Otherwise, rely on the `hasChanges` variable.
304
+ - **Breaking:** Removed the `enableWatcher` and `disableWatcher` functions. Use `enableChangesWatcher` and
305
+ `disableChangesWatcher` instead.
306
+
307
+ ## v1.1.0
308
+ ### Development
309
+
310
+ #### Strict TypeScript compilation
311
+ Added the following TypeScript compiler options:
312
+ - noImplicitThis
313
+ - noImplicitReturns
314
+ - strictNullChecks
315
+ - noUnusedLocals
316
+ - noUnusedParameters
317
+
318
+ I would advise enabling these for all TypeScript projects from now on.
319
+
320
+ #### Ordered imports and dependencies
321
+ Imports are now ordered alphabetically and grouped by folder. Added a TSLint option to enforce this.
322
+ Please note that this also applies for imports from the folder the file is currently in.
323
+ For example, in `models/ItemResource.ts`, `itemEntry` should be imported like so:
324
+ `import { ItemEntry } from '../models';`
325
+
326
+ Also, factory and class dependencies should be ordered alphabetically as well. This will make it easier to add and
327
+ remove dependencies in the future.
328
+
329
+ ### Breaking changes
330
+
331
+ - Renamed `changesCompiler` to `changesCompilation`, `changesCompilerFactory` to `changesCompilationFactory`,
332
+ `moduleChangesCompiler` to `moduleChangesCompilation` and `moduleChangesCompilerFactory` to
333
+ `moduleChangesCompilationFactory`.
334
+ - Removed the `allLinks` parameter from the `query` function definition in the `ApiRequestServiceInterface`. This is
335
+ no longer supported in the back-end.
336
+
337
+ #### Item and collection entries
338
+ - Moved *all* functions that handle item entries from the `ItemEntryService` to the `ItemEntry` class.
339
+ - Added the following functions to `ItemEntryService`:
340
+ - `createLocalConversionMap`;
341
+ - `expandLocalConversionMap`;
342
+ - `expandConversionMap`;
343
+ - `batchExpandConversionMap`;
344
+ - `batchClone`.
345
+ - Cloning of item entries now works slightly differently. The function will attempt to generate a new
346
+ item ID, and update the conversion map accordingly, but will respect the item ID that is already there.
347
+
348
+ #### Rework item caching
349
+ Newly created item entries and collection entries are no longer added to the global *or* local cache by default.
350
+ All entries are added to the global cache on save. Item entries are added to the local cache when resources are created
351
+ using the item administrator or when resources are created when adding the items to a collection.
352
+
353
+ > This will increase reliability by ensuring the global cache is no longer 'polluted' with local items. Also, this will
354
+ > allow for the creation item and collection entries without caching them directly. This is required for the copying and
355
+ > pasting of items.
356
+
357
+ Other changes:
358
+
359
+ - Moved `saveLocal` to `ItemAdministrator`;
360
+ - `ItemAdministrator.fetchTitle` should now be called instead of `ItemHandler.fetchTitle`;
361
+ - The `ItemAdministrator` collection matching functions (`addToCollections`, `removeFromCollections`) should now be
362
+ called instead of those in the `CollectionHandler`. The `CollectionHandler` should only be used to reflect changes
363
+ already on the backend. (Use `getCollectionMatcher`.)
364
+
365
+
366
+ ##v1.0.33
367
+ - Really fix types path
368
+
369
+ ##v1.0.33
370
+ - Fix types path
371
+
372
+ ##v1.0.32
373
+ - Update `tsconfig.json` to put definitions in the root folder
374
+ > The app had an issue with AOT compilation because of this
375
+
376
+ ##v1.0.31
377
+ - Fix `columnHandler.fetchItemTypeTranslations`
378
+ > It incorrectly looped over the response map, it should now work again
379
+
380
+ ##v1.0.30
381
+ - Remove `updateTabParams` from LocalCacheManagerInterface
382
+ > The function wasn't used
383
+
384
+ - Reworked class export
385
+ > Imports are now done from @rentman/rm-core, old imports are broken. This is because the old export structure didn't always work
386
+
387
+ ##v1.0.29
388
+ - Fix inverted inArray check in CollectionEntry.removeItems
389
+ > A delete message from the socket deleted all BUT the deleted items, this should now be fixed
390
+
391
+ ##v1.0.28
392
+ Bug fixes only
393
+
394
+ ##v1.0.27
395
+ - `ItemEntry.initial` is now undefined by default
396
+ > In the SocketMessageHandler we use this check to see if an ItemEntry is a stub
397
+
398
+ ##v1.0.26
399
+ Bundle both minified and unminified code, include sourcemaps from dev build
400
+
401
+ ##v1.0.24, v1.0.25
402
+ ! Use version `v1.0.26` !
403
+
404
+ - The core now expects a `promiseInterface` that should implement the provided `promiseInterface`
405
+ > We need to be able to hook into the promises in order to call a digest cycle to update the ui in the frontend
406
+
407
+ - Rename `ItemEntry.entryId` to `ItemEntry.id
408
+ > It used to be called `id`, but it was changed in the seperation of the core.
409
+ > You can use the `id` to uniquely identify an entry, since itemId can be updated (local to saved id)
410
+
411
+ - Rename ItemResource `startTransaction` to `start`
412
+ > Other functions are called `commit` and `rollback` so having 'transaction' only for start doesn't make much sense
413
+
414
+ - `SocketMessageHandler.onMessageReceived` now returns a promise
415
+ > You can now use the updated items or hook into the result to update the ui for example
416
+
417
+
418
+ ##v1.0.23
419
+ - Rename ResourceCache to LocalCache
420
+ > LocalCache only caches local items (name better reflects functionality)
421
+
422
+ - Remove getter/setter for hasChanges
423
+ > hasChanges is called in a digest loop in the frontend, so for performance reasons we don't want to recompute the value every time
424
+
425
+ - Remove `_getCollection` from ItemAdministrator
426
+ > `_getCollection` is now named `getCollection` and the old `getCollection` is removed. The query is part of the
427
+ > options and should not be given as a separate argument. This was included to support the frontend
428
+
429
+ - Remove `saveCurrentTab` from ItemAdministrator
430
+ > `saveCurrentTab` makes no sense because the core has no concept of tabs, you should use `saveCurrentLocalCache` instead
431
+
432
+ - Remove `getTabEntry` and `resetTabEntry` from ItemAdministrator
433
+ > `getTabEntry` and `resetTabEntry` make no sense because the core has no concept of tabs, you should use `getLocalCache` and `resetLocalCache` instead
434
+