@rentman/rm-core 1.5.5 → 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.
- package/changelog.md +33 -0
- package/dist/rm-core.js +219 -253
- package/dist/rm-core.min.js +1 -1
- package/dist/src/classes/ApiFormatter.d.ts +20 -21
- package/dist/src/classes/ApiResponseProcessor.d.ts +24 -16
- package/dist/src/classes/ChangesCompilation.d.ts +3 -3
- package/dist/src/classes/ChangesProcessor.d.ts +15 -15
- package/dist/src/classes/CollectionCache.d.ts +9 -9
- package/dist/src/classes/CollectionEntryService.d.ts +4 -7
- package/dist/src/classes/CollectionHandler.d.ts +8 -8
- package/dist/src/classes/CollectionMatcher.d.ts +24 -13
- package/dist/src/classes/CollectionResourceService.d.ts +2 -1
- package/dist/src/classes/ColumnCache.d.ts +4 -4
- package/dist/src/classes/ColumnExpansion.d.ts +5 -4
- package/dist/src/classes/ColumnSet.d.ts +7 -7
- package/dist/src/classes/ColumnUtil.d.ts +36 -22
- package/dist/src/classes/CreateRequest.d.ts +1 -1
- package/dist/src/classes/ItemAdministrator.d.ts +123 -45
- package/dist/src/classes/ItemCache.d.ts +8 -7
- package/dist/src/classes/ItemEntryService.d.ts +2 -2
- package/dist/src/classes/ItemHandler.d.ts +8 -8
- package/dist/src/classes/ItemRequestService.d.ts +2 -2
- package/dist/src/classes/KeyService.d.ts +1 -1
- package/dist/src/classes/LocalCache.d.ts +40 -16
- package/dist/src/classes/LockService.d.ts +22 -13
- package/dist/src/classes/ModuleChangesCompilation.d.ts +4 -4
- package/dist/src/classes/QueryMatcher.d.ts +5 -5
- package/dist/src/classes/QueryParser.d.ts +14 -13
- package/dist/src/classes/QueryService.d.ts +5 -16
- package/dist/src/classes/RequestColumnExpansion.d.ts +5 -3
- package/dist/src/classes/SocketMessageHandler.d.ts +10 -9
- package/dist/src/classes/Util.d.ts +6 -5
- package/dist/src/constants.d.ts +1 -1
- package/dist/src/factories/ChangesCompilationFactory.d.ts +2 -2
- package/dist/src/factories/CollectionResourceFactory.d.ts +12 -2
- package/dist/src/factories/ColumnInfoFactory.d.ts +1 -1
- package/dist/src/factories/ColumnSetFactory.d.ts +1 -1
- package/dist/src/factories/ItemEntryFactory.d.ts +1 -1
- package/dist/src/factories/ItemResourceFactory.d.ts +9 -3
- package/dist/src/factories/QueryParserFactory.d.ts +2 -1
- package/dist/src/interfaces/LocalCacheManagerInterface.d.ts +1 -0
- package/dist/src/interfaces/PromiseLibraryInterface.d.ts +19 -9
- package/dist/src/models/CollectionEditResource.d.ts +8 -8
- package/dist/src/models/CollectionEntry.d.ts +37 -23
- package/dist/src/models/CollectionEntryOptions.d.ts +9 -17
- package/dist/src/models/CollectionResource.d.ts +20 -20
- package/dist/src/models/CollectionResourceOptions.d.ts +17 -32
- package/dist/src/models/CollectionViewResource.d.ts +2 -2
- package/dist/src/models/EditResource.d.ts +1 -1
- package/dist/src/models/ItemEntry.d.ts +9 -7
- package/dist/src/models/ItemEntryOptions.d.ts +8 -15
- package/dist/src/models/ItemResource.d.ts +1 -1
- package/dist/src/models/ItemResourceOptions.d.ts +6 -10
- package/dist/src/types/ItemTypesCollection.d.ts +27 -34
- package/package.json +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ChangesCompilation } from '../classes';
|
|
1
|
+
import { ChangesCompilation, KeyService } from '../classes';
|
|
2
2
|
import { CollectionEntry, ItemEntry } from '../models';
|
|
3
3
|
import { CollectionCacheFactory } from './';
|
|
4
4
|
export declare class ChangesCompilationFactory {
|
|
5
5
|
private collectionCacheFactory;
|
|
6
6
|
private keyService;
|
|
7
|
-
constructor(collectionCacheFactory: CollectionCacheFactory, keyService:
|
|
7
|
+
constructor(collectionCacheFactory: CollectionCacheFactory, keyService: KeyService);
|
|
8
8
|
construct(singleItems: ItemEntry[], collections: CollectionEntry[]): ChangesCompilation;
|
|
9
9
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { KeyService, LocalCache } from '../classes';
|
|
2
2
|
import { ChangesProcessorFactory, ItemResourceFactory } from '../factories';
|
|
3
3
|
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../interfaces';
|
|
4
|
-
import {
|
|
4
|
+
import { CollectionEditResource, CollectionEntry, CollectionResourceOptionsInterface, CollectionViewResource, EditResource, ViewResource } from '../models';
|
|
5
5
|
export declare class CollectionResourceFactory {
|
|
6
6
|
errorHandler: ErrorHandlerInterface;
|
|
7
7
|
itemResourceFactory: ItemResourceFactory;
|
|
@@ -9,5 +9,15 @@ export declare class CollectionResourceFactory {
|
|
|
9
9
|
keyService: KeyService;
|
|
10
10
|
promiseService: PromiseLibraryInterface;
|
|
11
11
|
constructor(errorHandler: ErrorHandlerInterface, itemResourceFactory: ItemResourceFactory, changesProcessorFactory: ChangesProcessorFactory, keyService: KeyService, promiseService: PromiseLibraryInterface);
|
|
12
|
-
construct(collectionEntry: CollectionEntry, options: CollectionResourceOptionsInterface
|
|
12
|
+
construct(collectionEntry: CollectionEntry, options: CollectionResourceOptionsInterface & {
|
|
13
|
+
editItems: true;
|
|
14
|
+
editCollection: true;
|
|
15
|
+
}, localCache: LocalCache): CollectionEditResource<EditResource>;
|
|
16
|
+
construct(collectionEntry: CollectionEntry, options: CollectionResourceOptionsInterface & {
|
|
17
|
+
editCollection: true;
|
|
18
|
+
}, localCache: LocalCache): CollectionEditResource<ViewResource>;
|
|
19
|
+
construct(collectionEntry: CollectionEntry, options: CollectionResourceOptionsInterface & {
|
|
20
|
+
editItems: true;
|
|
21
|
+
}, localCache: LocalCache): CollectionViewResource<EditResource>;
|
|
22
|
+
construct(collectionEntry: CollectionEntry, options: CollectionResourceOptionsInterface, localCache: LocalCache): CollectionViewResource<ViewResource>;
|
|
13
23
|
}
|
|
@@ -2,5 +2,5 @@ import { ColumnInfo } from '../classes';
|
|
|
2
2
|
import { ResponseColumn } from '../types';
|
|
3
3
|
export declare class ColumnInfoFactory {
|
|
4
4
|
constructor();
|
|
5
|
-
construct(apiColumn: ResponseColumn, parent: ColumnInfo): ColumnInfo;
|
|
5
|
+
construct(apiColumn: ResponseColumn, parent: ColumnInfo | null): ColumnInfo;
|
|
6
6
|
}
|
|
@@ -7,5 +7,5 @@ export declare class ColumnSetFactory {
|
|
|
7
7
|
private columnInfoFactory;
|
|
8
8
|
constructor(columnHandler: ColumnHandler, columnUtil: ColumnUtil, columnInfoFactory: ColumnInfoFactory);
|
|
9
9
|
constructStub(itemType: ItemType, requestColumns: ApiRequestColumns): ColumnSet;
|
|
10
|
-
construct(itemType: ItemType, requestColumns: ApiRequestColumns, responseColumns: ResponseColumnMap, enableCaching?:
|
|
10
|
+
construct(itemType: ItemType, requestColumns: ApiRequestColumns, responseColumns: ResponseColumnMap, enableCaching?: boolean, includeIdColumn?: boolean): ColumnSet;
|
|
11
11
|
}
|
|
@@ -13,7 +13,7 @@ export declare class ItemEntryFactory {
|
|
|
13
13
|
constructor(authInterface: AuthInterface, apiFormatter: ApiFormatter, columnSetFactory: ColumnSetFactory, itemEntryService: ItemEntryService, keyService: KeyService, promiseService: PromiseLibraryInterface);
|
|
14
14
|
constructStub(itemType: ItemType, itemId: ItemId, columnSetStub: ColumnSet): ItemEntry;
|
|
15
15
|
constructLocalLinked(itemType: ItemType, itemId: ItemId, initial: FieldMap, parent: EntryParentNull, columnSet: ColumnSet, conversionMap: ItemIdConversionMap): ItemEntry;
|
|
16
|
-
constructLocal(itemId: ItemId, template: Template, modified: FieldMap, derived: FieldMap, parent?: EntryParentNull, columnSet?: ColumnSet, conversionMap?:
|
|
16
|
+
constructLocal(itemId: ItemId, template: Template, modified: FieldMap, derived: FieldMap, parent?: EntryParentNull, columnSet?: ColumnSet, conversionMap?: ItemIdConversionMap): ItemEntry;
|
|
17
17
|
constructDeferred(itemType: ItemType, itemId: ItemId, requestColumns: ApiRequestColumns, deferRequest: boolean): ItemEntry;
|
|
18
18
|
construct(itemId: ItemId, initial: FieldMap, derived: FieldMap, columnInfo: ColumnSet): ItemEntry;
|
|
19
19
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApiFormatter, ChangesProcessor, LockService } from '../classes';
|
|
2
2
|
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../interfaces';
|
|
3
|
-
import { ItemEntry,
|
|
3
|
+
import { EditResource, ItemEntry, ViewResource } from '../models';
|
|
4
4
|
import { ItemOptionsInterface } from '../types';
|
|
5
5
|
export declare class ItemResourceFactory {
|
|
6
6
|
apiFormatter: ApiFormatter;
|
|
@@ -9,6 +9,12 @@ export declare class ItemResourceFactory {
|
|
|
9
9
|
errorHandler: ErrorHandlerInterface;
|
|
10
10
|
promiseService: PromiseLibraryInterface;
|
|
11
11
|
constructor(apiFormatter: ApiFormatter, lockService: LockService, changesProcessor: ChangesProcessor, errorHandler: ErrorHandlerInterface, promiseService: PromiseLibraryInterface);
|
|
12
|
-
getConstructor(options: ItemOptionsInterface
|
|
13
|
-
|
|
12
|
+
getConstructor(options: ItemOptionsInterface & {
|
|
13
|
+
edit: true;
|
|
14
|
+
}): (itemEntry: ItemEntry) => EditResource;
|
|
15
|
+
getConstructor(options: ItemOptionsInterface): (itemEntry: ItemEntry) => ViewResource;
|
|
16
|
+
construct(itemEntry: ItemEntry, options: ItemOptionsInterface & {
|
|
17
|
+
edit: true;
|
|
18
|
+
}, isNew?: boolean): EditResource;
|
|
19
|
+
construct(itemEntry: ItemEntry, options: ItemOptionsInterface, isNew?: boolean): ViewResource;
|
|
14
20
|
}
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import { PromiseInterface } from '../types';
|
|
2
|
+
export interface Deferred<T> {
|
|
3
|
+
resolve(value?: T | PromiseInterface<T>): void;
|
|
4
|
+
reject(reason?: any): void;
|
|
5
|
+
promise: PromiseInterface<T>;
|
|
6
|
+
}
|
|
2
7
|
export interface PromiseLibraryInterface {
|
|
8
|
+
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseInterface<T1>, T2 | PromiseInterface<T2>, T3 | PromiseInterface<T3>, T4 | PromiseInterface<T4>, T5 | PromiseInterface<T5>, T6 | PromiseInterface<T6>, T7 | PromiseInterface<T7>, T8 | PromiseInterface<T8>, T9 | PromiseInterface<T9>, T10 | PromiseInterface<T10>]): PromiseInterface<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
|
|
9
|
+
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseInterface<T1>, T2 | PromiseInterface<T2>, T3 | PromiseInterface<T3>, T4 | PromiseInterface<T4>, T5 | PromiseInterface<T5>, T6 | PromiseInterface<T6>, T7 | PromiseInterface<T7>, T8 | PromiseInterface<T8>, T9 | PromiseInterface<T9>]): PromiseInterface<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
|
|
10
|
+
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseInterface<T1>, T2 | PromiseInterface<T2>, T3 | PromiseInterface<T3>, T4 | PromiseInterface<T4>, T5 | PromiseInterface<T5>, T6 | PromiseInterface<T6>, T7 | PromiseInterface<T7>, T8 | PromiseInterface<T8>]): PromiseInterface<[T1, T2, T3, T4, T5, T6, T7, T8]>;
|
|
11
|
+
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseInterface<T1>, T2 | PromiseInterface<T2>, T3 | PromiseInterface<T3>, T4 | PromiseInterface<T4>, T5 | PromiseInterface<T5>, T6 | PromiseInterface<T6>, T7 | PromiseInterface<T7>]): PromiseInterface<[T1, T2, T3, T4, T5, T6, T7]>;
|
|
12
|
+
all<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseInterface<T1>, T2 | PromiseInterface<T2>, T3 | PromiseInterface<T3>, T4 | PromiseInterface<T4>, T5 | PromiseInterface<T5>, T6 | PromiseInterface<T6>]): PromiseInterface<[T1, T2, T3, T4, T5, T6]>;
|
|
13
|
+
all<T1, T2, T3, T4, T5>(values: [T1 | PromiseInterface<T1>, T2 | PromiseInterface<T2>, T3 | PromiseInterface<T3>, T4 | PromiseInterface<T4>, T5 | PromiseInterface<T5>]): PromiseInterface<[T1, T2, T3, T4, T5]>;
|
|
14
|
+
all<T1, T2, T3, T4>(values: [T1 | PromiseInterface<T1>, T2 | PromiseInterface<T2>, T3 | PromiseInterface<T3>, T4 | PromiseInterface<T4>]): PromiseInterface<[T1, T2, T3, T4]>;
|
|
15
|
+
all<T1, T2, T3>(values: [T1 | PromiseInterface<T1>, T2 | PromiseInterface<T2>, T3 | PromiseInterface<T3>]): PromiseInterface<[T1, T2, T3]>;
|
|
16
|
+
all<T1, T2>(values: [T1 | PromiseInterface<T1>, T2 | PromiseInterface<T2>]): PromiseInterface<[T1, T2]>;
|
|
17
|
+
all<TAll>(promises: Array<TAll | PromiseInterface<TAll>>): PromiseInterface<TAll[]>;
|
|
3
18
|
all(iterable: Array<PromiseInterface<any> | any>): PromiseInterface<any[]>;
|
|
4
|
-
all(
|
|
5
|
-
[
|
|
6
|
-
}): PromiseInterface<
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
}>;
|
|
19
|
+
all<T>(promises: {
|
|
20
|
+
[K in keyof T]: (PromiseInterface<T[K]> | T[K]);
|
|
21
|
+
}): PromiseInterface<T>;
|
|
9
22
|
when<T>(value?: PromiseInterface<T> | T): PromiseInterface<T>;
|
|
10
23
|
reject(value?: any): PromiseInterface<any>;
|
|
11
|
-
defer():
|
|
12
|
-
(value?): any;
|
|
13
|
-
(value?): any;
|
|
14
|
-
};
|
|
24
|
+
defer<T>(): Deferred<T>;
|
|
15
25
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { LocalCache } from '../classes';
|
|
2
2
|
import { CollectionResourceFactory } from '../factories';
|
|
3
|
-
import { CollectionEntry, CollectionResource, CollectionResourceOptions, ItemResource } from '../models';
|
|
3
|
+
import { CollectionEntry, CollectionResource, CollectionResourceOptions, ItemResource, ViewResource } from '../models';
|
|
4
4
|
import { FieldMap, ItemId, ItemIdConversionMap, PromiseInterface } from '../types';
|
|
5
|
-
export declare class CollectionEditResource extends CollectionResource {
|
|
5
|
+
export declare class CollectionEditResource<T extends ItemResource = ViewResource> extends CollectionResource<T> {
|
|
6
6
|
private factory;
|
|
7
7
|
constructor(factory: CollectionResourceFactory, collectionEntry: CollectionEntry, options: CollectionResourceOptions, localCache: LocalCache);
|
|
8
8
|
save(): PromiseInterface<ItemIdConversionMap>;
|
|
9
|
-
moveItems(idArray: ItemId[], destination: CollectionResource, enableCallbacks?: boolean):
|
|
10
|
-
removeItems(idArray: ItemId[], callOnRemove?: boolean): PromiseInterface<
|
|
11
|
-
removeItem(itemId: ItemId, callOnRemove?: boolean): PromiseInterface<
|
|
12
|
-
addItems(valuesArray: FieldMap[], callOnAdd?: boolean, callOnActivate?: boolean): PromiseInterface<
|
|
13
|
-
addItem(values: FieldMap, callOnAdd?: boolean, callOnActivate?: boolean): PromiseInterface<
|
|
14
|
-
clear(enableCallbacks:
|
|
9
|
+
moveItems(idArray: ItemId[], destination: CollectionResource, enableCallbacks?: boolean): this['items'];
|
|
10
|
+
removeItems(idArray: ItemId[], callOnRemove?: boolean): PromiseInterface<this['items']>;
|
|
11
|
+
removeItem(itemId: ItemId, callOnRemove?: boolean): PromiseInterface<T>;
|
|
12
|
+
addItems(valuesArray: FieldMap[], callOnAdd?: boolean, callOnActivate?: boolean): PromiseInterface<this['items']>;
|
|
13
|
+
addItem(values: FieldMap, callOnAdd?: boolean, callOnActivate?: boolean): PromiseInterface<T>;
|
|
14
|
+
clear(enableCallbacks: boolean): this["items"];
|
|
15
15
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { ColumnExpansion, ColumnInfo, ColumnSet, ItemCache } from '../classes';
|
|
2
2
|
import { CollectionEntryFactory } from '../factories';
|
|
3
|
-
import { CollectionEntryOptions, CollectionResource, ItemEntry,
|
|
4
|
-
import {
|
|
3
|
+
import { CollectionEditResource, CollectionEntryOptions, CollectionResource, CollectionViewResource, ItemEntry, ViewResource } from '../models';
|
|
4
|
+
import { ApiRequestColumns, CollectionQuery, ConversionMap, EntryParentNull, FieldMap, ItemId, ItemIdConversionMap, ItemType, PromiseInterface, QueryCallback } from '../types';
|
|
5
5
|
export declare class CollectionEntry {
|
|
6
6
|
private factory;
|
|
7
7
|
itemType: ItemType;
|
|
8
8
|
options: CollectionEntryOptions;
|
|
9
9
|
id: number;
|
|
10
|
-
query:
|
|
10
|
+
query: CollectionQuery;
|
|
11
11
|
columns: ColumnSet;
|
|
12
12
|
templateColumns: ColumnSet | null;
|
|
13
13
|
parent: EntryParentNull;
|
|
14
14
|
initial: ItemEntry[];
|
|
15
15
|
items: ItemEntry[];
|
|
16
|
-
resources:
|
|
16
|
+
resources: Array<CollectionViewResource | CollectionEditResource>;
|
|
17
17
|
deferred: any;
|
|
18
|
-
promise: PromiseInterface<
|
|
18
|
+
promise: PromiseInterface<this>;
|
|
19
19
|
reloadQueued: boolean;
|
|
20
20
|
hasEditResources: boolean;
|
|
21
21
|
hasItemEditResources: boolean;
|
|
@@ -31,37 +31,51 @@ export declare class CollectionEntry {
|
|
|
31
31
|
isLocal(): boolean;
|
|
32
32
|
matchParent(itemType: ItemType, itemId: ItemId): boolean;
|
|
33
33
|
forEach(callback: (itemEntry: ItemEntry) => void): void;
|
|
34
|
-
getItemById(itemId:
|
|
34
|
+
getItemById(itemId: ItemId): ItemEntry | undefined;
|
|
35
35
|
getIdArray(accumulator?: ItemId[]): ItemId[];
|
|
36
36
|
createItems(valuesArray: FieldMap[]): PromiseInterface<ItemEntry[]>;
|
|
37
37
|
resolveDerivedValues(itemEntries: ItemEntry[], localItemCache: ItemCache): PromiseInterface<ItemEntry[]>;
|
|
38
|
-
addItems(itemEntries: ItemEntry[], resultResource
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
addItems<U extends CollectionResource>(itemEntries: ItemEntry[], resultResource: U, updateInitial?: boolean, callOnAdd?: boolean, callOnActivate?: boolean): U['items'];
|
|
39
|
+
addItems(itemEntries: ItemEntry[], resultResource?: null, updateInitial?: boolean, callOnAdd?: boolean, callOnActivate?: boolean): null;
|
|
40
|
+
addItems<U extends CollectionResource>(itemEntries: ItemEntry[], resultResource?: U | null, updateInitial?: boolean, callOnAdd?: boolean, callOnActivate?: boolean): U['items'] | null;
|
|
41
|
+
private handleAddedItemCallbacks;
|
|
42
|
+
removeItems<U extends CollectionResource>(idArray: ItemId[], resultResource: U, updateInitial?: boolean, callOnRemove?: boolean): U['items'];
|
|
43
|
+
removeItems(idArray: ItemId[], resultResource?: null, updateInitial?: boolean, callOnRemove?: boolean): null;
|
|
44
|
+
removeItems<U extends CollectionResource>(idArray: ItemId[], resultResource?: U | null, updateInitial?: boolean, callOnRemove?: boolean): U['items'] | null;
|
|
45
|
+
clear<U extends CollectionResource>(resultResource: U, updateInitial?: boolean, callOnRemove?: boolean): U['items'];
|
|
46
|
+
clear(resultResource?: null, updateInitial?: boolean, callOnRemove?: boolean): null;
|
|
47
|
+
handleRemovedItems<U extends CollectionResource>(filterFunction: (itemEntry: ItemEntry) => boolean, resultResource: U, updateInitial?: boolean, callOnRemove?: boolean): U['items'];
|
|
48
|
+
handleRemovedItems(filterFunction: (itemEntry: ItemEntry) => boolean, resultResource?: null, updateInitial?: boolean, callOnRemove?: boolean): null;
|
|
49
|
+
handleRemovedItems<U extends CollectionResource>(filterFunction: (itemEntry: ItemEntry) => boolean, resultResource?: U | null, updateInitial?: boolean, callOnRemove?: boolean): U['items'] | null;
|
|
50
|
+
private handleRemovedItemCallbacks;
|
|
51
|
+
private createBatchStatus;
|
|
52
|
+
private expandLocal;
|
|
53
|
+
private expandRemote;
|
|
47
54
|
expand(newColumns: ApiRequestColumns, localItemCache: ItemCache): PromiseInterface<this>;
|
|
48
|
-
extendQuery(callback?: QueryCallback):
|
|
49
|
-
extend(queryCallback: QueryCallback, collectionResource?:
|
|
55
|
+
extendQuery(callback?: QueryCallback): CollectionQuery;
|
|
56
|
+
extend<U extends CollectionResource>(queryCallback: QueryCallback, collectionResource?: U, callOnAdd?: boolean, updateInitial?: boolean): PromiseInterface<U['items']>;
|
|
57
|
+
extend(queryCallback: QueryCallback, collectionResource?: null, callOnAdd?: boolean, updateInitial?: boolean): PromiseInterface<null>;
|
|
50
58
|
queueReload(): void;
|
|
51
59
|
expandColumns(columnExpansion: ColumnExpansion): void;
|
|
52
60
|
expandRequestColumns(requestColumns: ApiRequestColumns): void;
|
|
53
|
-
getAddedItems(returnItemIds
|
|
54
|
-
|
|
61
|
+
getAddedItems(returnItemIds: true): ItemId[];
|
|
62
|
+
getAddedItems(returnItemIds?: boolean): ItemEntry[];
|
|
63
|
+
getRemovedItems(returnItemIds: true): ItemId[];
|
|
64
|
+
getRemovedItems(returnItemIds?: boolean): ItemEntry[];
|
|
55
65
|
getUpdatedItems(): ItemEntry[];
|
|
56
66
|
hasAddedItems(): boolean;
|
|
57
67
|
hasRemovedItems(): boolean;
|
|
58
68
|
hasUpdatedItems(): boolean;
|
|
59
|
-
getCurrentResource():
|
|
69
|
+
getCurrentResource<T extends CollectionViewResource = CollectionViewResource<ViewResource>>(): T;
|
|
60
70
|
clearResources(isSubtabChange?: boolean): void;
|
|
71
|
+
/**
|
|
72
|
+
* @description
|
|
73
|
+
* this doesn't revert updates
|
|
74
|
+
*/
|
|
61
75
|
revertChanges(): void;
|
|
62
|
-
onItemsCreated(conversionMap:
|
|
63
|
-
getUpdatedItemColumns(conversionMap:
|
|
76
|
+
onItemsCreated(conversionMap: ConversionMap): void;
|
|
77
|
+
getUpdatedItemColumns(conversionMap: ItemIdConversionMap): {
|
|
64
78
|
[columnId: string]: ColumnInfo;
|
|
65
79
|
};
|
|
66
|
-
clone(parent:
|
|
80
|
+
clone(parent: EntryParentNull, conversionMap?: ItemIdConversionMap): CollectionEntry;
|
|
67
81
|
}
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
import { ApiQuery, ApiRequestColumns, ApiRequestLimit, EntryParentNull
|
|
2
|
-
export declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
parent?: EntryParentNull;
|
|
7
|
-
deferRequest?: boolean;
|
|
8
|
-
limit?: ApiRequestLimit | null;
|
|
9
|
-
entryKey?: string | null;
|
|
10
|
-
}
|
|
11
|
-
export declare class CollectionEntryOptions extends CollectionEntryOptionsInterface {
|
|
12
|
-
columns: any;
|
|
13
|
-
query: any;
|
|
1
|
+
import { ApiQuery, ApiRequestColumns, ApiRequestLimit, EntryParentNull } from '../types';
|
|
2
|
+
export declare type CollectionEntryOptionsInterface = Partial<CollectionEntryOptions>;
|
|
3
|
+
export declare class CollectionEntryOptions {
|
|
4
|
+
columns: ApiRequestColumns;
|
|
5
|
+
query: ApiQuery | null;
|
|
14
6
|
queryParams: any;
|
|
15
|
-
parent:
|
|
16
|
-
deferRequest:
|
|
17
|
-
limit:
|
|
18
|
-
entryKey:
|
|
7
|
+
parent: EntryParentNull;
|
|
8
|
+
deferRequest: boolean;
|
|
9
|
+
limit: ApiRequestLimit | null;
|
|
10
|
+
entryKey: string | null;
|
|
19
11
|
constructor(values: CollectionEntryOptionsInterface);
|
|
20
12
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { LocalCache } from '../classes';
|
|
2
2
|
import { ItemResourceFactory } from '../factories';
|
|
3
|
-
import { CollectionResourceOptions, ItemEntry, ItemResource } from '../models';
|
|
4
|
-
import { ItemResourceItemIdMap, PromiseInterface } from '../types';
|
|
3
|
+
import { CollectionResourceOptions, ItemEntry, ItemResource, ViewResource } from '../models';
|
|
4
|
+
import { ItemResourceItemIdMap, PromiseInterface, QueryCallback, ResponseColumnMap } from '../types';
|
|
5
5
|
import { CollectionEntry } from './CollectionEntry';
|
|
6
|
-
export declare class CollectionResource {
|
|
6
|
+
export declare abstract class CollectionResource<T extends ItemResource = ViewResource> {
|
|
7
7
|
private itemResourceFactory;
|
|
8
8
|
entry: CollectionEntry;
|
|
9
9
|
options: CollectionResourceOptions;
|
|
10
10
|
localCache: LocalCache;
|
|
11
|
-
items:
|
|
12
|
-
itemIdMap: ItemResourceItemIdMap
|
|
13
|
-
columns:
|
|
11
|
+
items: T[];
|
|
12
|
+
itemIdMap: ItemResourceItemIdMap<T>;
|
|
13
|
+
columns: ResponseColumnMap;
|
|
14
14
|
constructor(itemResourceFactory: ItemResourceFactory, entry: CollectionEntry, options: CollectionResourceOptions, localCache: LocalCache);
|
|
15
|
-
getItemById(itemId: number):
|
|
15
|
+
getItemById(itemId: number): T;
|
|
16
16
|
rebuildMap(): void;
|
|
17
|
-
addItemResources(itemEntries: ItemEntry[]):
|
|
17
|
+
addItemResources(itemEntries: ItemEntry[]): T[];
|
|
18
18
|
/**
|
|
19
19
|
* @param itemEntries
|
|
20
20
|
* @returns {ItemResource[]}
|
|
@@ -22,19 +22,19 @@ export declare class CollectionResource {
|
|
|
22
22
|
* Returns the Itemresources that where removed Collection.
|
|
23
23
|
* Filters on ItemResource.entry === ItemEntry
|
|
24
24
|
*/
|
|
25
|
-
removeItemResources(itemEntries: ItemEntry[]):
|
|
26
|
-
callOnAdd(itemResources:
|
|
27
|
-
callOnRemove(itemResources:
|
|
28
|
-
forEach(callback: (itemResource:
|
|
29
|
-
filter(callback: (itemResource:
|
|
30
|
-
first(callback: (itemResource:
|
|
31
|
-
some(callback: (itemResource:
|
|
32
|
-
groupBy(argument: string | ((itemResource:
|
|
33
|
-
[key: string]:
|
|
25
|
+
removeItemResources(itemEntries: ItemEntry[]): T[];
|
|
26
|
+
callOnAdd(itemResources: this['items']): void;
|
|
27
|
+
callOnRemove(itemResources: this['items']): void;
|
|
28
|
+
forEach(callback: (itemResource: T) => void): void;
|
|
29
|
+
filter(callback: (itemResource: T) => boolean): T[];
|
|
30
|
+
first(callback: (itemResource: T) => boolean): T | null;
|
|
31
|
+
some(callback: (itemResource: T) => boolean): boolean;
|
|
32
|
+
groupBy(argument: string | ((itemResource: T) => string | null)): {
|
|
33
|
+
[key: string]: T[];
|
|
34
34
|
};
|
|
35
|
-
map<
|
|
36
|
-
reduce<
|
|
37
|
-
extend(queryCallback:
|
|
35
|
+
map<U>(argument: string | ((itemResource: T) => U)): U[];
|
|
36
|
+
reduce<U>(callback: (itemResource: T, value: U) => U, value: U): U;
|
|
37
|
+
extend(queryCallback: QueryCallback, returnAllItems?: boolean, callOnAdd?: boolean): PromiseInterface<this['items']>;
|
|
38
38
|
deactivate(): void;
|
|
39
39
|
clearResource(): void;
|
|
40
40
|
}
|
|
@@ -1,38 +1,23 @@
|
|
|
1
1
|
import { CollectionEntry, CollectionResource, ItemEntry, ItemResource } from '../models';
|
|
2
|
-
import {
|
|
2
|
+
import { ConversionMap, OnChangeFunction } from '../types';
|
|
3
3
|
export declare type CollectionResourceCallback = (itemResources: ItemResource[], collectionResource: CollectionResource) => void;
|
|
4
4
|
export declare type CollectionResourceInitialCallback = (itemEntries: ItemEntry[], collectionEntry: CollectionEntry) => void;
|
|
5
|
-
export declare type OnItemsCreatedCallback = (conversionMap:
|
|
6
|
-
export declare
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
export declare class CollectionResourceOptions extends CollectionResourceOptionsInterface {
|
|
23
|
-
editItems: any;
|
|
24
|
-
editCollection: any;
|
|
25
|
-
modInstant: any;
|
|
26
|
-
enableSave: any;
|
|
27
|
-
onItemsCreated: any;
|
|
28
|
-
onChange: any;
|
|
29
|
-
onAdd: any;
|
|
30
|
-
onRemove: any;
|
|
31
|
-
onAddInitial: any;
|
|
32
|
-
onRemoveInitial: any;
|
|
33
|
-
resourceKey: any;
|
|
34
|
-
clearOnTabChange: any;
|
|
35
|
-
clearOnSubTabChange: any;
|
|
5
|
+
export declare type OnItemsCreatedCallback = (conversionMap: ConversionMap) => void;
|
|
6
|
+
export declare type CollectionResourceOptionsInterface = Partial<CollectionResourceOptions>;
|
|
7
|
+
export declare class CollectionResourceOptions {
|
|
8
|
+
editItems: boolean;
|
|
9
|
+
editCollection: boolean;
|
|
10
|
+
modInstant: boolean;
|
|
11
|
+
enableSave: boolean;
|
|
12
|
+
onItemsCreated: OnItemsCreatedCallback;
|
|
13
|
+
onChange: OnChangeFunction;
|
|
14
|
+
onAdd: CollectionResourceCallback;
|
|
15
|
+
onRemove: CollectionResourceCallback;
|
|
16
|
+
onAddInitial: CollectionResourceInitialCallback;
|
|
17
|
+
onRemoveInitial: CollectionResourceInitialCallback;
|
|
18
|
+
resourceKey: string | null;
|
|
19
|
+
clearOnTabChange: boolean;
|
|
20
|
+
clearOnSubTabChange: boolean;
|
|
36
21
|
custom: any;
|
|
37
22
|
constructor(values: CollectionResourceOptionsInterface);
|
|
38
23
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LocalCache } from '../classes';
|
|
2
2
|
import { ItemResourceFactory } from '../factories';
|
|
3
|
-
import { CollectionEntry, CollectionResource, CollectionResourceOptions } from '../models';
|
|
4
|
-
export declare class CollectionViewResource extends CollectionResource {
|
|
3
|
+
import { CollectionEntry, CollectionResource, CollectionResourceOptions, EditResource, ViewResource } from '../models';
|
|
4
|
+
export declare class CollectionViewResource<T extends EditResource | ViewResource = ViewResource> extends CollectionResource<T> {
|
|
5
5
|
constructor(itemResourceFactory: ItemResourceFactory, collectionEntry: CollectionEntry, options: CollectionResourceOptions, localCache: LocalCache);
|
|
6
6
|
}
|
|
@@ -13,6 +13,6 @@ export declare class EditResource extends ItemResource {
|
|
|
13
13
|
getLocalCopy(): FieldMap | null;
|
|
14
14
|
copyFields(destination?: FieldMap): FieldMap;
|
|
15
15
|
setFields(values: FieldMap, callOnChange?: boolean): this;
|
|
16
|
-
callOnChange(previous
|
|
16
|
+
callOnChange(previous?: FieldMap): this;
|
|
17
17
|
save(parameters?: any): PromiseInterface<this>;
|
|
18
18
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ColumnSet } from '../classes';
|
|
2
2
|
import { ItemEntryFactory } from '../factories';
|
|
3
3
|
import { ItemResource } from '../models';
|
|
4
|
-
import { ColumnExpansionResult, EntryParentNull, FieldMap, ItemError, ItemId, ItemIdConversionMap, ItemType } from '../types';
|
|
4
|
+
import { ColumnExpansionResult, EntryParentNull, FieldMap, ItemError, ItemId, ItemIdConversionMap, ItemType, PromiseInterface } from '../types';
|
|
5
|
+
import { Deferred } from '../interfaces';
|
|
5
6
|
export declare class ItemEntry {
|
|
6
7
|
private factory;
|
|
7
8
|
itemType: string;
|
|
@@ -10,7 +11,7 @@ export declare class ItemEntry {
|
|
|
10
11
|
id: number;
|
|
11
12
|
reloadQueued: boolean;
|
|
12
13
|
deferRequest: boolean;
|
|
13
|
-
deferred
|
|
14
|
+
deferred?: Deferred<this>;
|
|
14
15
|
parent: EntryParentNull;
|
|
15
16
|
initial: FieldMap;
|
|
16
17
|
modified: FieldMap;
|
|
@@ -19,26 +20,27 @@ export declare class ItemEntry {
|
|
|
19
20
|
constructor(factory: ItemEntryFactory, itemType: string, itemId: ItemId, columns: ColumnSet);
|
|
20
21
|
queueReload(): this;
|
|
21
22
|
defer(deferRequest?: boolean): this;
|
|
23
|
+
getPromise(): PromiseInterface<this>;
|
|
22
24
|
resolve(): this;
|
|
23
|
-
resolveDeferred(initial:
|
|
25
|
+
resolveDeferred(initial: FieldMap, derived: FieldMap, columns: ColumnSet): this;
|
|
24
26
|
isDeferred(): boolean;
|
|
25
27
|
reject(error?: ItemError): this;
|
|
26
28
|
setFields(initial: FieldMap, derived: FieldMap): this;
|
|
27
29
|
setLocalFields(initialValues: FieldMap, conversionMap: ItemIdConversionMap, columns?: ColumnSet): this;
|
|
28
30
|
clone(conversionMap?: ItemIdConversionMap): ItemEntry;
|
|
29
|
-
resetDerived(columnIds:
|
|
31
|
+
resetDerived(columnIds: string[]): this;
|
|
30
32
|
clearResources(): this;
|
|
31
33
|
deactivateResources(): this;
|
|
32
34
|
getFields(): FieldMap;
|
|
33
35
|
expand(main: FieldMap, derived: FieldMap, columnExpansionResult: ColumnExpansionResult): this;
|
|
34
36
|
expandLocal(columnExpansionResult: ColumnExpansionResult): this;
|
|
35
|
-
private setLocalValues
|
|
37
|
+
private setLocalValues;
|
|
36
38
|
/**
|
|
37
39
|
* This function assumes the initial, modified, derived properties are already set. It will update the values
|
|
38
40
|
* themselves to preserve references in existing item resources.
|
|
39
41
|
*/
|
|
40
42
|
updateFields(fields: FieldMap, derived?: FieldMap | null, overwrite?: boolean): this;
|
|
41
|
-
private updateItemValues
|
|
43
|
+
private updateItemValues;
|
|
42
44
|
updateItemFields(conversionMap: ItemIdConversionMap, columns?: ColumnSet): this;
|
|
43
45
|
formatRequest(): FieldMap;
|
|
44
46
|
setDisplayName(): this;
|
|
@@ -59,7 +61,7 @@ export declare class ItemEntry {
|
|
|
59
61
|
setModified(values?: FieldMap): this;
|
|
60
62
|
setDerived(values: FieldMap): this;
|
|
61
63
|
setParent(parentType: ItemType, parentId: ItemId): this;
|
|
62
|
-
callOnChange(previous
|
|
64
|
+
callOnChange(previous?: FieldMap): this;
|
|
63
65
|
toJSON(): {
|
|
64
66
|
id: number;
|
|
65
67
|
parent: EntryParentNull;
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
import { ApiRequestColumnMap, ApiRequestColumns, EntryParentNull
|
|
2
|
-
export declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
templateColumns?: ApiRequestColumnMap;
|
|
7
|
-
deferRequest?: boolean;
|
|
8
|
-
isDuplicate?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare class ItemEntryOptions extends ItemEntryOptionsInterface {
|
|
11
|
-
columns: any;
|
|
12
|
-
parent: any;
|
|
1
|
+
import { ApiRequestColumnMap, ApiRequestColumns, EntryParentNull } from '../types';
|
|
2
|
+
export declare type ItemEntryOptionsInterface = Partial<ItemEntryOptions>;
|
|
3
|
+
export declare class ItemEntryOptions {
|
|
4
|
+
columns: ApiRequestColumns;
|
|
5
|
+
parent: EntryParentNull;
|
|
13
6
|
templateOptions: any;
|
|
14
|
-
templateColumns:
|
|
15
|
-
deferRequest:
|
|
16
|
-
isDuplicate:
|
|
7
|
+
templateColumns: ApiRequestColumnMap;
|
|
8
|
+
deferRequest: boolean;
|
|
9
|
+
isDuplicate: boolean;
|
|
17
10
|
constructor(values: ItemEntryOptionsInterface);
|
|
18
11
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ItemEntry, ItemResourceOptions } from '../models';
|
|
2
2
|
import { FieldMap, ResponseColumn } from '../types';
|
|
3
|
-
export declare class ItemResource {
|
|
3
|
+
export declare abstract class ItemResource {
|
|
4
4
|
entry: ItemEntry;
|
|
5
5
|
options: ItemResourceOptions;
|
|
6
6
|
protected readonly _isNew: boolean;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { ItemEntry } from '../models';
|
|
2
|
-
import {
|
|
3
|
-
export declare
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export declare class ItemResourceOptions extends ItemResourceOptionsInterface {
|
|
9
|
-
edit: any;
|
|
10
|
-
onChange: any;
|
|
11
|
-
onDeactivate: any;
|
|
2
|
+
import { OnChangeFunction } from '../types';
|
|
3
|
+
export declare type ItemResourceOptionsInterface = Partial<ItemResourceOptions>;
|
|
4
|
+
export declare class ItemResourceOptions {
|
|
5
|
+
edit: boolean;
|
|
6
|
+
onChange: OnChangeFunction;
|
|
7
|
+
onDeactivate: (itemEntry: ItemEntry) => void;
|
|
12
8
|
constructor(values: ItemResourceOptionsInterface);
|
|
13
9
|
}
|