@rentman/rm-core 1.5.9 → 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 +4 -0
- package/dist/rm-core.js +107 -66
- package/dist/rm-core.min.js +1 -1
- package/dist/src/classes/LocalCache.d.ts +8 -7
- package/dist/src/core.d.ts +2 -2
- package/dist/src/factories/CollectionEntryFactory.d.ts +3 -2
- package/dist/src/factories/CollectionResourceFactory.d.ts +3 -2
- package/dist/src/factories/ItemEntryFactory.d.ts +3 -2
- package/dist/src/factories/LocalCacheFactory.d.ts +8 -7
- package/dist/src/interfaces/ExceptionHandlerInterface.d.ts +3 -0
- package/dist/src/interfaces/index.d.ts +1 -0
- package/dist/src/models/CollectionEditResource.d.ts +0 -1
- package/dist/src/models/CollectionEntry.d.ts +2 -0
- package/dist/src/models/CollectionResource.d.ts +6 -6
- package/dist/src/models/CollectionViewResource.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { CollectionCache, ItemCache, LockService } from '../classes';
|
|
2
2
|
import { ChangesProcessorFactory, CollectionCacheFactory, CollectionResourceFactory, ItemCacheFactory, ItemResourceFactory } from '../factories';
|
|
3
|
-
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../interfaces';
|
|
3
|
+
import { ErrorHandlerInterface, ExceptionHandlerInterface, PromiseLibraryInterface } from '../interfaces';
|
|
4
4
|
import { CollectionEditResource, CollectionEntry, CollectionResource, CollectionResourceOptionsInterface, CollectionViewResource, EditResource, ItemEntry, ItemResource, LocalViewResource, RemoteViewResource } from '../models';
|
|
5
5
|
import { CollectionEntryParentIdMap, CollectionResourceParentIdMap, CreateRequestParameterMap, ItemIdConversionMap, ItemOptionsInterface, LocalCacheCallbackCondition, OnSaveCallback, PromiseInterface } from '../types';
|
|
6
6
|
export declare class LocalCache {
|
|
7
|
-
private errorHandler;
|
|
8
|
-
private lockService;
|
|
9
|
-
private itemResourceFactory;
|
|
10
|
-
private collectionCacheFactory;
|
|
11
7
|
private changesProcessorFactory;
|
|
12
|
-
private
|
|
8
|
+
private collectionCacheFactory;
|
|
13
9
|
private collectionResourceFactory;
|
|
10
|
+
private errorHandler;
|
|
11
|
+
private exceptionHandler;
|
|
12
|
+
private itemCacheFactory;
|
|
13
|
+
private itemResourceFactory;
|
|
14
|
+
private lockService;
|
|
14
15
|
private promiseService;
|
|
15
16
|
id: string;
|
|
16
17
|
items: ItemCache;
|
|
@@ -22,7 +23,7 @@ export declare class LocalCache {
|
|
|
22
23
|
private callbacks;
|
|
23
24
|
private changesInterval;
|
|
24
25
|
hasChanges: boolean;
|
|
25
|
-
constructor(
|
|
26
|
+
constructor(changesProcessorFactory: ChangesProcessorFactory, collectionCacheFactory: CollectionCacheFactory, collectionResourceFactory: CollectionResourceFactory, errorHandler: ErrorHandlerInterface, exceptionHandler: ExceptionHandlerInterface, itemCacheFactory: ItemCacheFactory, itemResourceFactory: ItemResourceFactory, lockService: LockService, promiseService: PromiseLibraryInterface, id?: string);
|
|
26
27
|
createItemResource(itemEntry: ItemEntry, options: ItemOptionsInterface & {
|
|
27
28
|
edit: true;
|
|
28
29
|
}, isRoot?: boolean, isNew?: boolean): EditResource;
|
package/dist/src/core.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApiFormatter, ApiRequestService, CollectionEntryService, CollectionHandler, CollectionResourceService, ColumnCache, ColumnHandler, ColumnUtil, ItemAdministrator, ItemEntryService, ItemHandler, ItemRequestService, KeyService, LockService, QueryService, SocketMessageHandler } from './classes';
|
|
2
2
|
import { ApiResponseProcessorFactory, BatchStatusFactory, ChangesCompilationFactory, ChangesProcessorFactory, CollectionCacheFactory, CollectionEntryFactory, CollectionMatcherFactory, CollectionResourceFactory, ColumnExpansionFactory, ColumnInfoFactory, ColumnSetFactory, ColumnSubsetCacheFactory, CreateRequestFactory, ItemCacheFactory, ItemEntryFactory, ItemResourceFactory, LocalCacheFactory, ModuleChangesCompilationFactory, QueryMatcherFactory, QueryParserFactory, RequestColumnExpansionFactory, TemplateFactory } from './factories';
|
|
3
|
-
import { ApiRequestServiceInterface, AuthInterface, ErrorHandlerInterface, LocalCacheManagerInterface, PromiseLibraryInterface } from './interfaces';
|
|
3
|
+
import { ApiRequestServiceInterface, AuthInterface, ErrorHandlerInterface, ExceptionHandlerInterface, LocalCacheManagerInterface, PromiseLibraryInterface } from './interfaces';
|
|
4
4
|
export declare class RmCore {
|
|
5
5
|
version: string;
|
|
6
6
|
noop: typeof noop;
|
|
@@ -42,7 +42,7 @@ export declare class RmCore {
|
|
|
42
42
|
requestColumnExpansionFactory: RequestColumnExpansionFactory;
|
|
43
43
|
socketMessageHandler: SocketMessageHandler;
|
|
44
44
|
templateFactory: TemplateFactory;
|
|
45
|
-
constructor(
|
|
45
|
+
constructor(apiRequestServiceInterface: ApiRequestServiceInterface, authInterface: AuthInterface, errorHandlerInterface: ErrorHandlerInterface, exceptionHandlerInterface: ExceptionHandlerInterface, localCacheManager: LocalCacheManagerInterface, promiseLibraryInterface: PromiseLibraryInterface);
|
|
46
46
|
}
|
|
47
47
|
export declare function noop(): void;
|
|
48
48
|
export declare function identity(value: any): any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CollectionEntryService, ColumnHandler, ItemEntryService, ItemHandler, ItemRequestService, KeyService, QueryService } from '../classes/';
|
|
2
2
|
import { ColumnExpansionFactory, ColumnSetFactory, ItemEntryFactory } from '../factories/';
|
|
3
|
-
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../interfaces/';
|
|
3
|
+
import { ErrorHandlerInterface, ExceptionHandlerInterface, PromiseLibraryInterface } from '../interfaces/';
|
|
4
4
|
import { CollectionEntry, CollectionEntryOptionsInterface } from '../models/';
|
|
5
5
|
import { ItemType } from '../types/';
|
|
6
6
|
export declare class CollectionEntryFactory {
|
|
@@ -9,6 +9,7 @@ export declare class CollectionEntryFactory {
|
|
|
9
9
|
columnExpansionFactory: ColumnExpansionFactory;
|
|
10
10
|
columnSetFactory: ColumnSetFactory;
|
|
11
11
|
errorHandler: ErrorHandlerInterface;
|
|
12
|
+
exceptionHandler: ExceptionHandlerInterface;
|
|
12
13
|
itemEntryFactory: ItemEntryFactory;
|
|
13
14
|
itemEntryService: ItemEntryService;
|
|
14
15
|
itemHandler: ItemHandler;
|
|
@@ -16,6 +17,6 @@ export declare class CollectionEntryFactory {
|
|
|
16
17
|
keyService: KeyService;
|
|
17
18
|
promiseService: PromiseLibraryInterface;
|
|
18
19
|
queryService: QueryService;
|
|
19
|
-
constructor(collectionEntryService: CollectionEntryService, columnHandler: ColumnHandler, columnExpansionFactory: ColumnExpansionFactory, columnSetFactory: ColumnSetFactory, errorHandler: ErrorHandlerInterface, itemEntryFactory: ItemEntryFactory, itemEntryService: ItemEntryService, itemHandler: ItemHandler, itemRequestService: ItemRequestService, keyService: KeyService, promiseService: PromiseLibraryInterface, queryService: QueryService);
|
|
20
|
+
constructor(collectionEntryService: CollectionEntryService, columnHandler: ColumnHandler, columnExpansionFactory: ColumnExpansionFactory, columnSetFactory: ColumnSetFactory, errorHandler: ErrorHandlerInterface, exceptionHandler: ExceptionHandlerInterface, itemEntryFactory: ItemEntryFactory, itemEntryService: ItemEntryService, itemHandler: ItemHandler, itemRequestService: ItemRequestService, keyService: KeyService, promiseService: PromiseLibraryInterface, queryService: QueryService);
|
|
20
21
|
construct(itemType: ItemType, options: CollectionEntryOptionsInterface): CollectionEntry;
|
|
21
22
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { KeyService, LocalCache } from '../classes';
|
|
2
2
|
import { ChangesProcessorFactory, ItemResourceFactory } from '../factories';
|
|
3
|
-
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../interfaces';
|
|
3
|
+
import { ErrorHandlerInterface, ExceptionHandlerInterface, PromiseLibraryInterface } from '../interfaces';
|
|
4
4
|
import { CollectionEditResource, CollectionEntry, CollectionResourceOptionsInterface, CollectionViewResource, EditResource, LocalViewResource, RemoteViewResource } from '../models';
|
|
5
5
|
export declare class CollectionResourceFactory {
|
|
6
6
|
errorHandler: ErrorHandlerInterface;
|
|
7
|
+
exceptionHandler: ExceptionHandlerInterface;
|
|
7
8
|
itemResourceFactory: ItemResourceFactory;
|
|
8
9
|
changesProcessorFactory: ChangesProcessorFactory;
|
|
9
10
|
keyService: KeyService;
|
|
10
11
|
promiseService: PromiseLibraryInterface;
|
|
11
|
-
constructor(errorHandler: ErrorHandlerInterface, itemResourceFactory: ItemResourceFactory, changesProcessorFactory: ChangesProcessorFactory, keyService: KeyService, promiseService: PromiseLibraryInterface);
|
|
12
|
+
constructor(errorHandler: ErrorHandlerInterface, exceptionHandler: ExceptionHandlerInterface, itemResourceFactory: ItemResourceFactory, changesProcessorFactory: ChangesProcessorFactory, keyService: KeyService, promiseService: PromiseLibraryInterface);
|
|
12
13
|
construct(collectionEntry: CollectionEntry, options: CollectionResourceOptionsInterface & {
|
|
13
14
|
editItems: true;
|
|
14
15
|
editCollection: true;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { ApiFormatter, ColumnSet, ItemEntryService, KeyService } from '../classes';
|
|
2
2
|
import { ColumnSetFactory } from '../factories';
|
|
3
|
-
import { AuthInterface, PromiseLibraryInterface } from '../interfaces';
|
|
3
|
+
import { ExceptionHandlerInterface, AuthInterface, PromiseLibraryInterface } from '../interfaces';
|
|
4
4
|
import { ItemEntry, Template } from '../models';
|
|
5
5
|
import { ApiRequestColumns, EntryParentNull, FieldMap, ItemId, ItemIdConversionMap, ItemType } from '../types';
|
|
6
6
|
export declare class ItemEntryFactory {
|
|
7
7
|
authInterface: AuthInterface;
|
|
8
8
|
apiFormatter: ApiFormatter;
|
|
9
9
|
columnSetFactory: ColumnSetFactory;
|
|
10
|
+
exceptionHandler: ExceptionHandlerInterface;
|
|
10
11
|
itemEntryService: ItemEntryService;
|
|
11
12
|
keyService: KeyService;
|
|
12
13
|
promiseService: PromiseLibraryInterface;
|
|
13
|
-
constructor(authInterface: AuthInterface, apiFormatter: ApiFormatter, columnSetFactory: ColumnSetFactory, itemEntryService: ItemEntryService, keyService: KeyService, promiseService: PromiseLibraryInterface);
|
|
14
|
+
constructor(authInterface: AuthInterface, apiFormatter: ApiFormatter, columnSetFactory: ColumnSetFactory, exceptionHandler: ExceptionHandlerInterface, itemEntryService: ItemEntryService, keyService: KeyService, promiseService: PromiseLibraryInterface);
|
|
14
15
|
constructStub(itemType: ItemType, itemId: ItemId, columnSetStub: ColumnSet): ItemEntry;
|
|
15
16
|
constructLocalLinked(itemType: ItemType, itemId: ItemId, initial: FieldMap, parent: EntryParentNull, columnSet: ColumnSet, conversionMap: ItemIdConversionMap): ItemEntry;
|
|
16
17
|
constructLocal(itemId: ItemId, template: Template, modified: FieldMap, derived: FieldMap, parent?: EntryParentNull, columnSet?: ColumnSet, conversionMap?: ItemIdConversionMap): ItemEntry;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { LocalCache, LockService } from '../classes';
|
|
2
2
|
import { ChangesProcessorFactory, CollectionCacheFactory, CollectionResourceFactory, ItemCacheFactory, ItemResourceFactory } from '../factories';
|
|
3
|
-
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../interfaces';
|
|
3
|
+
import { ErrorHandlerInterface, ExceptionHandlerInterface, PromiseLibraryInterface } from '../interfaces';
|
|
4
4
|
export declare class LocalCacheFactory {
|
|
5
|
-
private errorHandler;
|
|
6
|
-
private lockService;
|
|
7
|
-
private itemResourceFactory;
|
|
8
|
-
private collectionCacheFactory;
|
|
9
5
|
private changesProcessorFactory;
|
|
10
|
-
private
|
|
6
|
+
private collectionCacheFactory;
|
|
11
7
|
private collectionResourceFactory;
|
|
8
|
+
private errorHandler;
|
|
9
|
+
private exceptionHandler;
|
|
10
|
+
private itemCacheFactory;
|
|
11
|
+
private itemResourceFactory;
|
|
12
|
+
private lockService;
|
|
12
13
|
private promiseService;
|
|
13
|
-
constructor(
|
|
14
|
+
constructor(changesProcessorFactory: ChangesProcessorFactory, collectionCacheFactory: CollectionCacheFactory, collectionResourceFactory: CollectionResourceFactory, errorHandler: ErrorHandlerInterface, exceptionHandler: ExceptionHandlerInterface, itemCacheFactory: ItemCacheFactory, itemResourceFactory: ItemResourceFactory, lockService: LockService, promiseService: PromiseLibraryInterface);
|
|
14
15
|
construct(id?: string): LocalCache;
|
|
15
16
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './PromiseLibraryInterface';
|
|
2
2
|
export * from './LocalCacheManagerInterface';
|
|
3
3
|
export * from './ErrorHandlerInterface';
|
|
4
|
+
export * from './ExceptionHandlerInterface';
|
|
4
5
|
export * from './AuthInterface';
|
|
5
6
|
export * from './ApiRequestServiceInterface';
|
|
6
7
|
export * from './SocketMessageInterface';
|
|
@@ -3,7 +3,6 @@ import { CollectionResourceFactory } from '../factories';
|
|
|
3
3
|
import { CollectionEntry, CollectionResource, CollectionResourceOptions, ItemResource, LocalViewResource } from '../models';
|
|
4
4
|
import { FieldMap, ItemId, ItemIdConversionMap, PromiseInterface } from '../types';
|
|
5
5
|
export declare class CollectionEditResource<T extends ItemResource = LocalViewResource> extends CollectionResource<T> {
|
|
6
|
-
private factory;
|
|
7
6
|
constructor(factory: CollectionResourceFactory, collectionEntry: CollectionEntry, options: CollectionResourceOptions, localCache: LocalCache);
|
|
8
7
|
save(): PromiseInterface<ItemIdConversionMap>;
|
|
9
8
|
moveItems(idArray: ItemId[], destination: CollectionResource, enableCallbacks?: boolean): T[];
|
|
@@ -74,6 +74,8 @@ export declare class CollectionEntry {
|
|
|
74
74
|
*/
|
|
75
75
|
revertChanges(): void;
|
|
76
76
|
onItemsCreated(conversionMap: ConversionMap): void;
|
|
77
|
+
private onAddInitial;
|
|
78
|
+
private onRemoveInitial;
|
|
77
79
|
getUpdatedItemColumns(conversionMap: ItemIdConversionMap): {
|
|
78
80
|
[columnId: string]: ColumnInfo;
|
|
79
81
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { LocalCache } from '../classes';
|
|
2
|
-
import {
|
|
2
|
+
import { CollectionResourceFactory } from '../factories';
|
|
3
3
|
import { CollectionEntry, CollectionResourceOptions, ItemEntry, ItemResource, LocalViewResource } from '../models';
|
|
4
4
|
import { ItemResourceItemIdMap, PromiseInterface, QueryCallback, ResponseColumnMap } from '../types';
|
|
5
5
|
export declare abstract class CollectionResource<T extends ItemResource = LocalViewResource> {
|
|
6
|
-
|
|
6
|
+
protected factory: CollectionResourceFactory;
|
|
7
7
|
entry: CollectionEntry;
|
|
8
8
|
options: CollectionResourceOptions;
|
|
9
9
|
localCache: LocalCache;
|
|
10
10
|
items: T[];
|
|
11
11
|
itemIdMap: ItemResourceItemIdMap<T>;
|
|
12
12
|
columns: ResponseColumnMap;
|
|
13
|
-
protected constructor(
|
|
13
|
+
protected constructor(factory: CollectionResourceFactory, entry: CollectionEntry, options: CollectionResourceOptions, localCache: LocalCache);
|
|
14
14
|
getItemById(itemId: number): T;
|
|
15
15
|
rebuildMap(): void;
|
|
16
16
|
addItemResources(itemEntries: ItemEntry[]): T[];
|
|
@@ -22,8 +22,8 @@ export declare abstract class CollectionResource<T extends ItemResource = LocalV
|
|
|
22
22
|
* Filters on ItemResource.entry === ItemEntry
|
|
23
23
|
*/
|
|
24
24
|
removeItemResources(itemEntries: ItemEntry[]): T[];
|
|
25
|
-
callOnAdd(itemResources:
|
|
26
|
-
callOnRemove(itemResources:
|
|
25
|
+
callOnAdd(itemResources: T[]): void;
|
|
26
|
+
callOnRemove(itemResources: T[]): void;
|
|
27
27
|
forEach(callback: (itemResource: T) => void): void;
|
|
28
28
|
filter(callback: (itemResource: T) => boolean): T[];
|
|
29
29
|
first(callback: (itemResource: T) => boolean): T | null;
|
|
@@ -33,7 +33,7 @@ export declare abstract class CollectionResource<T extends ItemResource = LocalV
|
|
|
33
33
|
};
|
|
34
34
|
map<U>(argument: string | ((itemResource: T) => U)): U[];
|
|
35
35
|
reduce<U>(callback: (itemResource: T, value: U) => U, value: U): U;
|
|
36
|
-
extend(queryCallback: QueryCallback, returnAllItems?: boolean, callOnAdd?: boolean): PromiseInterface<
|
|
36
|
+
extend(queryCallback: QueryCallback, returnAllItems?: boolean, callOnAdd?: boolean): PromiseInterface<T[]>;
|
|
37
37
|
deactivate(): void;
|
|
38
38
|
clearResource(): void;
|
|
39
39
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LocalCache } from '../classes';
|
|
2
|
-
import {
|
|
2
|
+
import { CollectionResourceFactory } from '../factories';
|
|
3
3
|
import { CollectionEntry, CollectionResource, CollectionResourceOptions, ItemResource, LocalViewResource } from '../models';
|
|
4
4
|
export declare class CollectionViewResource<T extends ItemResource = LocalViewResource> extends CollectionResource<T> {
|
|
5
|
-
constructor(
|
|
5
|
+
constructor(collectionResourceFactory: CollectionResourceFactory, collectionEntry: CollectionEntry, options: CollectionResourceOptions, localCache: LocalCache);
|
|
6
6
|
}
|