@rentman/rm-core 2.2.1 → 2.4.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.
Files changed (108) hide show
  1. package/changelog.md +9 -0
  2. package/dist/rm-core.js +9398 -8650
  3. package/dist/rm-core.min.js +16 -1
  4. package/dist/{src → types}/classes/ApiFormatter.d.ts +1 -1
  5. package/dist/{src → types}/classes/cache/ItemHandlerBase.d.ts +1 -1
  6. package/dist/{src → types}/classes/cache/server/ServerItemHandler.d.ts +1 -1
  7. package/dist/{src → types}/classes/cache/transaction/TransactionCache.d.ts +7 -5
  8. package/dist/{src → types}/classes/cache/transaction/TransactionEventHandler.d.ts +6 -1
  9. package/dist/{src → types}/classes/cache/transaction/TransactionValidator.d.ts +2 -2
  10. package/dist/{src → types}/classes/index.d.ts +1 -0
  11. package/dist/{src → types}/models/CollectionResource.d.ts +1 -1
  12. package/package.json +9 -9
  13. /package/dist/{src → types}/classes/ApiRequestService.d.ts +0 -0
  14. /package/dist/{src → types}/classes/ApiResponseProcessor.d.ts +0 -0
  15. /package/dist/{src → types}/classes/ChangesCompilation.d.ts +0 -0
  16. /package/dist/{src → types}/classes/ChangesDelta.d.ts +0 -0
  17. /package/dist/{src → types}/classes/ChangesDeltaBase.d.ts +0 -0
  18. /package/dist/{src → types}/classes/ChangesProcessor.d.ts +0 -0
  19. /package/dist/{src → types}/classes/CollectionCache.d.ts +0 -0
  20. /package/dist/{src → types}/classes/CollectionEntryService.d.ts +0 -0
  21. /package/dist/{src → types}/classes/CollectionMatcher.d.ts +0 -0
  22. /package/dist/{src → types}/classes/CollectionMatcherBase.d.ts +0 -0
  23. /package/dist/{src → types}/classes/CollectionResourceService.d.ts +0 -0
  24. /package/dist/{src → types}/classes/ColumnCache.d.ts +0 -0
  25. /package/dist/{src → types}/classes/ColumnExpansion.d.ts +0 -0
  26. /package/dist/{src → types}/classes/ColumnHandler.d.ts +0 -0
  27. /package/dist/{src → types}/classes/ColumnInfo.d.ts +0 -0
  28. /package/dist/{src → types}/classes/ColumnSet.d.ts +0 -0
  29. /package/dist/{src → types}/classes/ColumnSubsetCache.d.ts +0 -0
  30. /package/dist/{src → types}/classes/ColumnUtil.d.ts +0 -0
  31. /package/dist/{src → types}/classes/CreateRequest.d.ts +0 -0
  32. /package/dist/{src → types}/classes/InternalChangesDelta.d.ts +0 -0
  33. /package/dist/{src → types}/classes/ItemCache.d.ts +0 -0
  34. /package/dist/{src → types}/classes/ItemCreateService.d.ts +0 -0
  35. /package/dist/{src → types}/classes/ItemEntryService.d.ts +0 -0
  36. /package/dist/{src → types}/classes/KeyService.d.ts +0 -0
  37. /package/dist/{src → types}/classes/LockService.d.ts +0 -0
  38. /package/dist/{src → types}/classes/ModuleChangesCompilation.d.ts +0 -0
  39. /package/dist/{src → types}/classes/QueryColumnExtractor.d.ts +0 -0
  40. /package/dist/{src → types}/classes/QueryMatcher.d.ts +0 -0
  41. /package/dist/{src → types}/classes/QueryParser.d.ts +0 -0
  42. /package/dist/{src → types}/classes/QueryParserBase.d.ts +0 -0
  43. /package/dist/{src → types}/classes/QueryService.d.ts +0 -0
  44. /package/dist/{src → types}/classes/RequestBuffer.d.ts +0 -0
  45. /package/dist/{src → types}/classes/RequestBufferManager.d.ts +0 -0
  46. /package/dist/{src → types}/classes/RequestColumnExpansion.d.ts +0 -0
  47. /package/dist/{src → types}/classes/SocketMessageHandler.d.ts +0 -0
  48. /package/dist/{src → types}/classes/TemplateCache.d.ts +0 -0
  49. /package/dist/{src → types}/classes/Util.d.ts +0 -0
  50. /package/dist/{src → types}/classes/cache/AbstractCache.d.ts +0 -0
  51. /package/dist/{src → types}/classes/cache/CollectionHandlerBase.d.ts +0 -0
  52. /package/dist/{src → types}/classes/cache/CollectionMatcherCacheProcessor.d.ts +0 -0
  53. /package/dist/{src → types}/classes/cache/server/ServerCache.d.ts +0 -0
  54. /package/dist/{src → types}/classes/cache/server/ServerCollectionHandler.d.ts +0 -0
  55. /package/dist/{src → types}/classes/cache/transaction/TransactionCollectionHandler.d.ts +0 -0
  56. /package/dist/{src → types}/classes/cache/transaction/TransactionItemHandler.d.ts +0 -0
  57. /package/dist/{src → types}/constants.d.ts +0 -0
  58. /package/dist/{src → types}/core.d.ts +0 -0
  59. /package/dist/{src → types}/factories/ApiResponseProcessorFactory.d.ts +0 -0
  60. /package/dist/{src → types}/factories/ChangesCompilationFactory.d.ts +0 -0
  61. /package/dist/{src → types}/factories/ChangesDeltaFactory.d.ts +0 -0
  62. /package/dist/{src → types}/factories/ChangesProcessorFactory.d.ts +0 -0
  63. /package/dist/{src → types}/factories/CollectionCacheFactory.d.ts +0 -0
  64. /package/dist/{src → types}/factories/CollectionEntryFactory.d.ts +0 -0
  65. /package/dist/{src → types}/factories/CollectionMatcherFactory.d.ts +0 -0
  66. /package/dist/{src → types}/factories/CollectionResourceFactory.d.ts +0 -0
  67. /package/dist/{src → types}/factories/ColumnExpansionFactory.d.ts +0 -0
  68. /package/dist/{src → types}/factories/ColumnInfoFactory.d.ts +0 -0
  69. /package/dist/{src → types}/factories/ColumnSetFactory.d.ts +0 -0
  70. /package/dist/{src → types}/factories/ColumnSubsetCacheFactory.d.ts +0 -0
  71. /package/dist/{src → types}/factories/CreateRequestFactory.d.ts +0 -0
  72. /package/dist/{src → types}/factories/ItemCacheFactory.d.ts +0 -0
  73. /package/dist/{src → types}/factories/ItemEntryFactory.d.ts +0 -0
  74. /package/dist/{src → types}/factories/ItemResourceFactory.d.ts +0 -0
  75. /package/dist/{src → types}/factories/ModuleChangesCompilationFactory.d.ts +0 -0
  76. /package/dist/{src → types}/factories/QueryMatcherFactory.d.ts +0 -0
  77. /package/dist/{src → types}/factories/QueryParserFactory.d.ts +0 -0
  78. /package/dist/{src → types}/factories/RequestColumnExpansionFactory.d.ts +0 -0
  79. /package/dist/{src → types}/factories/TemplateFactory.d.ts +0 -0
  80. /package/dist/{src → types}/factories/TransactionCacheFactory.d.ts +0 -0
  81. /package/dist/{src → types}/factories/index.d.ts +0 -0
  82. /package/dist/{src → types}/index.d.ts +0 -0
  83. /package/dist/{src → types}/interfaces/ApiRequestServiceInterface.d.ts +0 -0
  84. /package/dist/{src → types}/interfaces/AuthInterface.d.ts +0 -0
  85. /package/dist/{src → types}/interfaces/ErrorHandlerInterface.d.ts +0 -0
  86. /package/dist/{src → types}/interfaces/ExceptionHandlerInterface.d.ts +0 -0
  87. /package/dist/{src → types}/interfaces/LinkTreeServiceInterface.d.ts +0 -0
  88. /package/dist/{src → types}/interfaces/PromiseLibraryInterface.d.ts +0 -0
  89. /package/dist/{src → types}/interfaces/SocketMessageInterface.d.ts +0 -0
  90. /package/dist/{src → types}/interfaces/index.d.ts +0 -0
  91. /package/dist/{src → types}/models/CollectionEditResource.d.ts +0 -0
  92. /package/dist/{src → types}/models/CollectionEntry.d.ts +0 -0
  93. /package/dist/{src → types}/models/CollectionEntryOptions.d.ts +0 -0
  94. /package/dist/{src → types}/models/CollectionResourceOptions.d.ts +0 -0
  95. /package/dist/{src → types}/models/CollectionViewResource.d.ts +0 -0
  96. /package/dist/{src → types}/models/EditResource.d.ts +0 -0
  97. /package/dist/{src → types}/models/ItemEntry.d.ts +0 -0
  98. /package/dist/{src → types}/models/ItemEntryOptions.d.ts +0 -0
  99. /package/dist/{src → types}/models/ItemResource.d.ts +0 -0
  100. /package/dist/{src → types}/models/ItemResourceOptions.d.ts +0 -0
  101. /package/dist/{src → types}/models/LocalViewResource.d.ts +0 -0
  102. /package/dist/{src → types}/models/RemoteViewResource.d.ts +0 -0
  103. /package/dist/{src → types}/models/Template.d.ts +0 -0
  104. /package/dist/{src → types}/models/ViewResource.d.ts +0 -0
  105. /package/dist/{src → types}/models/index.d.ts +0 -0
  106. /package/dist/{src → types}/types/ItemTypesCollection.d.ts +0 -0
  107. /package/dist/{src → types}/types/PromiseInterface.d.ts +0 -0
  108. /package/dist/{src → types}/types/index.d.ts +0 -0
@@ -1,4 +1,4 @@
1
- import * as moment from 'moment';
1
+ import moment from 'moment';
2
2
  import { ColumnInfo } from '../classes';
3
3
  import { FieldMap, ItemType } from '../types';
4
4
  export declare class ApiFormatter {
@@ -50,7 +50,7 @@ export declare abstract class ItemHandlerBase {
50
50
  * @description
51
51
  * Processes the passed {@link ChangesDeltaItemUpdateDelta update delta} on the transaction, if there are no {@link TransactionItemHandler.itemChanges itemChanges} the new values will not be processed
52
52
  */
53
- abstract processItemEntryChanges(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta): void;
53
+ abstract processItemEntryChanges(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta, forceOverwrite: boolean, updateInitial: boolean, isCalledAfterSocketUpdate: boolean, createItemChangesIfNoneExist: boolean): void;
54
54
  /**
55
55
  * @description
56
56
  * Traverses the column path and returns the fields of the derived item, returns undefined if the item isn't found
@@ -23,7 +23,7 @@ export declare class ServerItemHandler extends ItemHandlerBase {
23
23
  * @description
24
24
  * Processes updates on a cached entry
25
25
  */
26
- processItemEntryChanges<ItemTypeType extends ItemType = any>(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, _forceOverwrite?: boolean, _updateInitial?: boolean, _isCalledAfterSocketUpdate?: boolean, _createItemChangesIfNoneExist?: boolean): FieldMap<ItemTypeType>;
26
+ processItemEntryChanges<ItemTypeType extends ItemType = any>(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, _forceOverwrite?: boolean, _updateInitial?: boolean, _isCalledAfterSocketUpdate?: boolean, _createItemChangesIfNoneExist?: boolean): FieldMap<ItemTypeType> | null;
27
27
  copyTransactionItemEntryChanges(itemEntryChanges: TransactionItemEntryChanges, entry: ItemEntry): ServerItemEntryChanges;
28
28
  fetchItemEntry<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>>;
29
29
  fetchItemEntriesByQuery<ItemTypeType extends ItemType>(itemType: ItemTypeType, query: ApiQuery, entryOptions: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
@@ -19,6 +19,7 @@ import { QueryService } from '../../QueryService';
19
19
  import { TemplateCache } from '../../TemplateCache';
20
20
  import { AbstractCache } from '../AbstractCache';
21
21
  import { ServerCache } from '../server/ServerCache';
22
+ import { TransactionEventHandler } from './TransactionEventHandler';
22
23
  declare type EditResourceLinks<ItemTypeType extends ItemType> = {
23
24
  main: EditResource<ItemTypeType>;
24
25
  linked: ItemResourcesItemTypeMap;
@@ -50,6 +51,7 @@ export declare class TransactionCache extends AbstractCache {
50
51
  [itemEntryId: string]: {
51
52
  [columnId: string]: {
52
53
  [errorKey: string]: {
54
+ fieldString: string;
53
55
  string: string;
54
56
  level: TransactionErrorLevel;
55
57
  };
@@ -94,9 +96,9 @@ export declare class TransactionCache extends AbstractCache {
94
96
  readonly parent: AbstractCache;
95
97
  readonly itemHandler: TransactionItemHandler;
96
98
  readonly collectionHandler: TransactionCollectionHandler;
97
- private readonly eventHandler;
99
+ readonly eventHandler: TransactionEventHandler;
100
+ private readonly validator?;
98
101
  private changesInterval;
99
- private validator?;
100
102
  constructor(core: RmCore, columnCache: ColumnCache, requestBufferManager: RequestBufferManager, requestColumnExpansionFactory: RequestColumnExpansionFactory, queryMatcherFactory: QueryMatcherFactory, authInterface: AuthInterface, changesDeltaFactory: ChangesDeltaFactory, lockService: LockService, moduleChangesCompilationFactory: ModuleChangesCompilationFactory, collectionResourceFactory: CollectionResourceFactory, itemResourceFactory: ItemResourceFactory, templateCache: TemplateCache, itemCacheFactory: ItemCacheFactory, collectionCacheFactory: CollectionCacheFactory, errorHandler: ErrorHandlerInterface, exceptionHandler: ExceptionHandlerInterface, promiseService: PromiseLibraryInterface, apiRequestService: ApiRequestService, columnExpansionFactory: ColumnExpansionFactory, columnHandler: ColumnHandler, columnSetFactory: ColumnSetFactory, columnSubsetCacheFactory: ColumnSubsetCacheFactory, columnUtil: ColumnUtil, itemEntryFactory: ItemEntryFactory, itemEntryService: ItemEntryService, keyService: KeyService, collectionEntryFactory: CollectionEntryFactory, collectionEntryService: CollectionEntryService, collectionMatcherFactory: CollectionMatcherFactory, queryParserFactory: QueryParserFactory, queryService: QueryService, apiFormatter: ApiFormatter, linkTreeService: LinkTreeServiceInterface, changesDeltaService: ItemCreateService, parent: AbstractCache,
101
103
  /**
102
104
  * @description
@@ -111,13 +113,13 @@ export declare class TransactionCache extends AbstractCache {
111
113
  * Should only be called by {@link TransactionValidator TransactionValidator}
112
114
  * @internal
113
115
  */
114
- _setGlobalError(key: string, isInvalid: boolean, errorTranslation: string, level: TransactionErrorLevel): void;
116
+ _setGlobalError(key: string, isInvalid: boolean, saveButtonErrorTranslationFn: () => string, level: TransactionErrorLevel): void;
115
117
  /**
116
118
  * @description
117
119
  * Should only be called by {@link TransactionValidator TransactionValidator}
118
120
  * @internal
119
121
  */
120
- _setItemError(itemEntryId: ItemEntry['id'], columnId: string, errorKey: string, isInvalid: boolean, errorTranslation: string, level: TransactionErrorLevel): void;
122
+ _setItemError(itemEntryId: ItemEntry['id'], columnId: string, errorKey: string, isInvalid: boolean, fieldErrorTranslationFn: () => string, saveButtonErrorTranslationFn: () => string, level: TransactionErrorLevel): void;
121
123
  /**
122
124
  * @internal
123
125
  */
@@ -417,7 +419,7 @@ export declare class TransactionCache extends AbstractCache {
417
419
  getDelta(): InternalChangesDelta;
418
420
  createItemResource<ItemTypeType extends ItemType>(itemEntry: ItemEntry<ItemTypeType>, options: ItemOptionsInterface<EditResource<ItemTypeType>> & {
419
421
  edit: true;
420
- }, isRoot?: boolean, isNew?: boolean): EditResource<ItemTypeType>;
422
+ }, isRoot: boolean, isNew?: boolean): EditResource<ItemTypeType>;
421
423
  createItemResource<ItemTypeType extends ItemType>(itemEntry: ItemEntry<ItemTypeType>, options: ItemOptionsInterface<RemoteViewResource<ItemTypeType>> & {
422
424
  remote: true;
423
425
  }, isRoot?: boolean, isNew?: boolean): RemoteViewResource<ItemTypeType>;
@@ -1,10 +1,15 @@
1
1
  import { ErrorHandlerInterface, ExceptionHandlerInterface, PromiseLibraryInterface } from '../../../interfaces';
2
+ import { ItemEntry } from '../../../models';
2
3
  import { ItemIdConversionMap, PromiseInterface } from '../../../types';
3
- import { TransactionCache } from './TransactionCache';
4
+ import { TransactionCache, TransactionErrorLevel } from './TransactionCache';
4
5
  export declare type TransactionCacheCallbackCondition = 'always' | 'onClose' | 'skipOnClose';
5
6
  export declare type TransactionCacheCallbackType = {
6
7
  onBeforeSave: (transaction: TransactionCache) => any;
7
8
  onSaveSuccess: (transaction: TransactionCache, conversionMap: ItemIdConversionMap) => any;
9
+ onSetItemError: (itemEntryId: ItemEntry['id'], columnId: string, key: string) => void;
10
+ onClearItemError: (itemEntryId: ItemEntry['id'], columnId: string, key: string) => void;
11
+ onSetGlobalError: (key: string, level: TransactionErrorLevel) => void;
12
+ onClearGlobalError: (key: string) => void;
8
13
  };
9
14
  export declare class TransactionEventHandler {
10
15
  private errorHandler;
@@ -22,7 +22,7 @@ export declare abstract class TransactionValidator {
22
22
  * @param previous
23
23
  */
24
24
  abstract validateItem<ItemTypeType extends ItemType>(itemEntry: ItemEntry<ItemTypeType>, fields: FieldMap<ItemTypeType>, previous: FieldMap<ItemTypeType>): void;
25
- protected setGlobalError(key: string, isInvalid: boolean | PromiseInterface<boolean>, errorTranslation: string, level: TransactionErrorLevel): void;
26
- protected setItemError(itemEntryId: ItemEntry['id'], columnId: string, errorKey: string, isInvalid: boolean | PromiseInterface<boolean>, errorTranslation: string, level: TransactionErrorLevel): void;
25
+ protected setGlobalError(key: string, isInvalid: boolean | PromiseInterface<boolean>, saveButtonErrorTranslationFn: () => string, level: TransactionErrorLevel): void;
26
+ protected setItemError(itemEntryId: ItemEntry['id'], columnId: string, errorKey: string, isInvalid: boolean | PromiseInterface<boolean>, fieldErrorTranslationFn: () => string, saveButtonErrorTranslationFn: () => string, level: TransactionErrorLevel): void;
27
27
  private getRandomId;
28
28
  }
@@ -36,6 +36,7 @@ export * from './cache/transaction/TransactionItemHandler';
36
36
  export * from './cache/transaction/TransactionCollectionHandler';
37
37
  export * from './cache/transaction/TransactionEventHandler';
38
38
  export * from './cache/transaction/TransactionValidator';
39
+ export * from './ChangesDeltaBase';
39
40
  export * from './ChangesDelta';
40
41
  export * from './InternalChangesDelta';
41
42
  export * from './RequestBufferManager';
@@ -7,7 +7,7 @@ export declare abstract class CollectionResource<ItemTypeType extends ItemType =
7
7
  entry: CollectionEntry<ItemTypeType>;
8
8
  options: CollectionResourceOptions<ItemTypeType>;
9
9
  transaction: TransactionCache;
10
- items: Readonly<T[]>;
10
+ items: T[];
11
11
  columns: ResponseColumnItemTypeMap;
12
12
  protected itemIdMap: ItemResourceItemIdMap<T>;
13
13
  private readonly onChange;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@rentman/rm-core",
3
- "version": "2.2.1",
3
+ "version": "2.4.0",
4
4
  "description": "Rentman core functionalities",
5
5
  "main": "./dist/rm-core.js",
6
- "types": "./dist/src/index.d.ts",
6
+ "types": "./dist/types/index.d.ts",
7
7
  "dependencies": {},
8
8
  "repository": {
9
9
  "type": "git",
@@ -13,14 +13,14 @@
13
13
  "@types/moment": "^2.13.0",
14
14
  "@types/q": "^1.5.0",
15
15
  "clean-webpack-plugin": "^0.1.19",
16
- "ts-loader": "^4.4.1",
17
- "tslint": "^5.12.1",
18
- "typescript": "3.3.3",
19
- "typescript-tslint-plugin": "^0.5.3",
16
+ "ts-loader": "^6.2.1",
17
+ "tslint": "5.19.0",
18
+ "typescript": "^3.7.2",
19
+ "typescript-tslint-plugin": "^0.5.5",
20
20
  "uglifyjs-webpack-plugin": "^1.2.5",
21
- "webpack": "^4.16.3",
22
- "webpack-cli": "^3.0.6",
23
- "webpack-merge": "^4.1.3"
21
+ "webpack": "4.41.2",
22
+ "webpack-cli": "3.3.6",
23
+ "webpack-merge": "^4.1.4"
24
24
  },
25
25
  "files": [
26
26
  "dist"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes