@rentman/rm-core 1.5.6 → 1.5.7-1

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