@rentman/rm-core 1.7.5 → 1.8.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 (94) hide show
  1. package/changelog.md +11 -0
  2. package/dist/rm-core.js +8479 -7672
  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 +39 -39
  7. package/dist/src/classes/BatchStatus.d.ts +28 -28
  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 +32 -34
  11. package/dist/src/classes/CollectionEntryService.d.ts +22 -23
  12. package/dist/src/classes/CollectionHandler.d.ts +54 -54
  13. package/dist/src/classes/CollectionMatcher.d.ts +42 -42
  14. package/dist/src/classes/CollectionResourceService.d.ts +6 -6
  15. package/dist/src/classes/ColumnCache.d.ts +21 -21
  16. package/dist/src/classes/ColumnExpansion.d.ts +18 -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 +39 -39
  20. package/dist/src/classes/ColumnSubsetCache.d.ts +8 -8
  21. package/dist/src/classes/ColumnUtil.d.ts +88 -89
  22. package/dist/src/classes/CreateRequest.d.ts +20 -20
  23. package/dist/src/classes/ItemAdministrator.d.ts +234 -238
  24. package/dist/src/classes/ItemCache.d.ts +23 -23
  25. package/dist/src/classes/ItemEntryService.d.ts +23 -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 +112 -97
  30. package/dist/src/classes/LocalCacheEventHandler.d.ts +19 -0
  31. package/dist/src/classes/LockService.d.ts +32 -32
  32. package/dist/src/classes/ModuleChangesCompilation.d.ts +21 -21
  33. package/dist/src/classes/QueryMatcher.d.ts +14 -14
  34. package/dist/src/classes/QueryParser.d.ts +34 -34
  35. package/dist/src/classes/QueryService.d.ts +14 -14
  36. package/dist/src/classes/RequestColumnExpansion.d.ts +14 -14
  37. package/dist/src/classes/SocketMessageHandler.d.ts +41 -41
  38. package/dist/src/classes/Util.d.ts +28 -28
  39. package/dist/src/classes/index.d.ts +35 -35
  40. package/dist/src/constants.d.ts +18 -18
  41. package/dist/src/core.d.ts +48 -48
  42. package/dist/src/factories/ApiResponseProcessorFactory.d.ts +6 -6
  43. package/dist/src/factories/BatchStatusFactory.d.ts +9 -9
  44. package/dist/src/factories/ChangesCompilationFactory.d.ts +10 -10
  45. package/dist/src/factories/CollectionCacheFactory.d.ts +7 -8
  46. package/dist/src/factories/CollectionEntryFactory.d.ts +23 -23
  47. package/dist/src/factories/CollectionMatcherFactory.d.ts +8 -8
  48. package/dist/src/factories/CollectionResourceFactory.d.ts +32 -33
  49. package/dist/src/factories/ColumnExpansionFactory.d.ts +8 -8
  50. package/dist/src/factories/ColumnInfoFactory.d.ts +7 -7
  51. package/dist/src/factories/ColumnSetFactory.d.ts +17 -17
  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 +21 -21
  56. package/dist/src/factories/ItemResourceFactory.d.ts +28 -29
  57. package/dist/src/factories/LocalCacheFactory.d.ts +16 -16
  58. package/dist/src/factories/ModuleChangesCompilationFactory.d.ts +6 -6
  59. package/dist/src/factories/QueryMatcherFactory.d.ts +7 -7
  60. package/dist/src/factories/QueryParserFactory.d.ts +6 -6
  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 +21 -21
  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/ExceptionHandlerInterface.d.ts +3 -3
  69. package/dist/src/interfaces/LocalCacheManagerInterface.d.ts +5 -5
  70. package/dist/src/interfaces/PromiseLibraryInterface.d.ts +25 -25
  71. package/dist/src/interfaces/SocketMessageInterface.d.ts +3 -3
  72. package/dist/src/interfaces/index.d.ts +7 -7
  73. package/dist/src/models/CollectionEditResource.d.ts +14 -14
  74. package/dist/src/models/CollectionEntry.d.ts +87 -82
  75. package/dist/src/models/CollectionEntryOptions.d.ts +12 -12
  76. package/dist/src/models/CollectionResource.d.ts +52 -41
  77. package/dist/src/models/CollectionResourceOptions.d.ts +22 -22
  78. package/dist/src/models/CollectionViewResource.d.ts +7 -7
  79. package/dist/src/models/EditResource.d.ts +18 -18
  80. package/dist/src/models/ItemEntry.d.ts +76 -70
  81. package/dist/src/models/ItemEntryOptions.d.ts +10 -11
  82. package/dist/src/models/ItemResource.d.ts +45 -27
  83. package/dist/src/models/ItemResourceOptions.d.ts +9 -9
  84. package/dist/src/models/LocalViewResource.d.ts +7 -7
  85. package/dist/src/models/RemoteViewResource.d.ts +7 -7
  86. package/dist/src/models/Template.d.ts +11 -11
  87. package/dist/src/models/ViewResource.d.ts +8 -8
  88. package/dist/src/models/index.d.ts +15 -15
  89. package/dist/src/types/ItemTypesCollection.d.ts +197 -213
  90. package/dist/src/types/PromiseInterface.d.ts +2 -2
  91. package/dist/src/types/index.d.ts +2 -2
  92. package/package.json +1 -1
  93. package/readme.md +15 -15
  94. package/dist/src/classes/ResourceCache.d.ts +0 -25
@@ -1,3 +1,3 @@
1
- export interface ExceptionHandlerInterface {
2
- (exception: any): void;
3
- }
1
+ export interface ExceptionHandlerInterface {
2
+ (exception: any): void;
3
+ }
@@ -1,5 +1,5 @@
1
- import { LocalCache } from '../classes';
2
- export interface LocalCacheManagerInterface {
3
- getCurrentLocalCache(userId: string): LocalCache;
4
- getAllLocalCaches(): LocalCache[];
5
- }
1
+ import { LocalCache } from '../classes';
2
+ export interface LocalCacheManagerInterface {
3
+ getCurrentLocalCache(userId: string): LocalCache;
4
+ getAllLocalCaches(): LocalCache[];
5
+ }
@@ -1,25 +1,25 @@
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
- }
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[]>;
18
- all(iterable: Array<PromiseInterface<any> | any>): PromiseInterface<any[]>;
19
- all<T>(promises: {
20
- [K in keyof T]: (PromiseInterface<T[K]> | T[K] | null);
21
- }): PromiseInterface<T>;
22
- when<T>(value?: PromiseInterface<T> | T): PromiseInterface<T>;
23
- reject(value?: any): PromiseInterface<any>;
24
- defer<T>(): Deferred<T>;
25
- }
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
+ }
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[]>;
18
+ all(iterable: Array<PromiseInterface<any> | any>): PromiseInterface<any[]>;
19
+ all<T>(promises: {
20
+ [K in keyof T]: (PromiseInterface<T[K]> | T[K] | null);
21
+ }): PromiseInterface<T>;
22
+ when<T>(value?: PromiseInterface<T> | T): PromiseInterface<T>;
23
+ reject(value?: any): PromiseInterface<any>;
24
+ defer<T>(): Deferred<T>;
25
+ }
@@ -1,3 +1,3 @@
1
- export interface SocketMessageInterface {
2
- on(event: string, messageHandler: (message: any) => void): () => boolean;
3
- }
1
+ export interface SocketMessageInterface {
2
+ on(event: string, messageHandler: (message: any) => void): () => boolean;
3
+ }
@@ -1,7 +1,7 @@
1
- export * from './PromiseLibraryInterface';
2
- export * from './LocalCacheManagerInterface';
3
- export * from './ErrorHandlerInterface';
4
- export * from './ExceptionHandlerInterface';
5
- export * from './AuthInterface';
6
- export * from './ApiRequestServiceInterface';
7
- export * from './SocketMessageInterface';
1
+ export * from './PromiseLibraryInterface';
2
+ export * from './LocalCacheManagerInterface';
3
+ export * from './ErrorHandlerInterface';
4
+ export * from './ExceptionHandlerInterface';
5
+ export * from './AuthInterface';
6
+ export * from './ApiRequestServiceInterface';
7
+ export * from './SocketMessageInterface';
@@ -1,14 +1,14 @@
1
- import { LocalCache } from '../classes';
2
- import { CollectionResourceFactory } from '../factories';
3
- import { CollectionEntry, CollectionResource, CollectionResourceOptions, ItemResource, LocalViewResource } from '../models';
4
- import { FieldMap, ItemId, ItemIdConversionMap, ItemType, PromiseInterface } from '../types';
5
- export declare class CollectionEditResource<ItemTypeType extends ItemType = any, T extends ItemResource<ItemTypeType> = LocalViewResource<ItemTypeType>> extends CollectionResource<ItemTypeType, T> {
6
- constructor(factory: CollectionResourceFactory, collectionEntry: CollectionEntry<ItemTypeType>, options: CollectionResourceOptions<ItemTypeType>, level: number, localCache: LocalCache | null);
7
- save(): PromiseInterface<ItemIdConversionMap>;
8
- moveItems(idArray: ItemId[], destination: CollectionResource<ItemTypeType>, enableCallbacks?: boolean): T[];
9
- removeItems(idArray: ItemId[], callOnRemove?: boolean): PromiseInterface<T[]>;
10
- removeItem(itemId: ItemId, callOnRemove?: boolean): PromiseInterface<T>;
11
- addItems(valuesArray: Array<FieldMap<ItemTypeType>>, callOnAdd?: boolean, callOnActivate?: boolean): PromiseInterface<T[]>;
12
- addItem(values: FieldMap<ItemTypeType>, callOnAdd?: boolean, callOnActivate?: boolean): PromiseInterface<T>;
13
- clear(enableCallbacks: boolean): this["items"];
14
- }
1
+ import { LocalCache } from '../classes';
2
+ import { CollectionResourceFactory } from '../factories';
3
+ import { CollectionEntry, CollectionResource, CollectionResourceOptions, ItemResource, LocalViewResource } from '../models';
4
+ import { FieldMap, ItemId, ItemIdConversionMap, ItemType, PromiseInterface } from '../types';
5
+ export declare class CollectionEditResource<ItemTypeType extends ItemType = any, T extends ItemResource<ItemTypeType> = LocalViewResource<ItemTypeType>> extends CollectionResource<ItemTypeType, T> {
6
+ constructor(factory: CollectionResourceFactory, collectionEntry: CollectionEntry<ItemTypeType>, options: CollectionResourceOptions<ItemTypeType>, localCache: LocalCache | null);
7
+ save(): PromiseInterface<ItemIdConversionMap>;
8
+ moveItems(idArray: ItemId[], destination: CollectionResource<ItemTypeType>, enableCallbacks?: boolean): T[];
9
+ removeItems(idArray: ItemId[], callOnRemove?: boolean): PromiseInterface<T[]>;
10
+ removeItem(itemId: ItemId, callOnRemove?: boolean): PromiseInterface<T>;
11
+ addItems(valuesArray: Array<FieldMap<ItemTypeType>>, callOnAdd?: boolean, callOnActivate?: boolean): PromiseInterface<T[]>;
12
+ addItem(values: FieldMap<ItemTypeType>, callOnAdd?: boolean, callOnActivate?: boolean): PromiseInterface<T>;
13
+ clear(enableCallbacks: boolean): this["items"];
14
+ }
@@ -1,82 +1,87 @@
1
- import { ColumnExpansion, ColumnInfo, ColumnSet, ItemCache } from '../classes';
2
- import { CollectionEntryFactory } from '../factories';
3
- import { Deferred } from '../interfaces';
4
- import { CollectionEntryOptions, CollectionResource, ItemEntry } from '../models';
5
- import { ApiRequestColumns, CollectionQuery, ConversionMap, EntryParentNull, FieldMap, ItemId, ItemIdConversionMap, ItemType, PromiseInterface, QueryCallback } from '../types';
6
- export declare class CollectionEntry<ItemTypeType extends ItemType = any> {
7
- private factory;
8
- itemType: ItemTypeType;
9
- options: CollectionEntryOptions;
10
- id: number;
11
- parent: EntryParentNull;
12
- query: CollectionQuery;
13
- columns: ColumnSet<ItemTypeType>;
14
- private templateColumns;
15
- initial: Array<ItemEntry<ItemTypeType>>;
16
- items: Array<ItemEntry<ItemTypeType>>;
17
- deferred?: Deferred<this>;
18
- promise: PromiseInterface<this>;
19
- reloadQueued: boolean;
20
- hasEditResources: boolean;
21
- hasItemEditResources: boolean;
22
- constructor(factory: CollectionEntryFactory, itemType: ItemTypeType, options: CollectionEntryOptions);
23
- private getResources;
24
- defer(): this;
25
- isDeferred(): boolean;
26
- _resolve(): this;
27
- resolve(itemEntryCompound: {
28
- columns: ColumnSet<ItemTypeType>;
29
- initial: Array<ItemEntry<ItemTypeType>>;
30
- modified?: Array<ItemEntry<ItemTypeType>>;
31
- }): this;
32
- isLocal(): boolean;
33
- matchParent(itemType: ItemType, itemId: ItemId): boolean;
34
- forEach(callback: (itemEntry: this['items'][0]) => void): void;
35
- getItemById(itemId: ItemId): this['items'][0] | undefined;
36
- getIdArray(accumulator?: ItemId[]): ItemId[];
37
- createItems(valuesArray: Array<FieldMap<ItemTypeType>>): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
38
- resolveDerivedValues(itemEntries: Array<ItemEntry<ItemTypeType>>, localItemCache: ItemCache): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
39
- addItems<U extends CollectionResource<ItemTypeType>>(itemEntries: Array<ItemEntry<ItemTypeType>>, resultResource: U, updateInitial?: boolean, callOnAdd?: boolean, callOnActivate?: boolean): U['items'];
40
- addItems(itemEntries: Array<ItemEntry<ItemTypeType>>, resultResource?: null, updateInitial?: boolean, callOnAdd?: boolean, callOnActivate?: boolean): null;
41
- addItems<U extends CollectionResource<ItemTypeType>>(itemEntries: Array<ItemEntry<ItemTypeType>>, resultResource?: U | null, updateInitial?: boolean, callOnAdd?: boolean, callOnActivate?: boolean): U['items'] | null;
42
- private handleAddedItemCallbacks;
43
- removeItems<U extends CollectionResource<ItemTypeType>>(idArray: ItemId[], resultResource: U, updateInitial?: boolean, callOnRemove?: boolean): U['items'];
44
- removeItems(idArray: ItemId[], resultResource?: null, updateInitial?: boolean, callOnRemove?: boolean): null;
45
- removeItems<U extends CollectionResource<ItemTypeType>>(idArray: ItemId[], resultResource?: U | null, updateInitial?: boolean, callOnRemove?: boolean): U['items'] | null;
46
- clear<U extends CollectionResource<ItemTypeType>>(resultResource: U, updateInitial?: boolean, callOnRemove?: boolean): U['items'];
47
- clear(resultResource?: null, updateInitial?: boolean, callOnRemove?: boolean): null;
48
- handleRemovedItems<U extends CollectionResource<ItemTypeType>>(filterFunction: (itemEntry: this['items'][0]) => boolean, resultResource: U, updateInitial?: boolean, callOnRemove?: boolean): U['items'];
49
- handleRemovedItems(filterFunction: (itemEntry: this['items'][0]) => boolean, resultResource?: null, updateInitial?: boolean, callOnRemove?: boolean): null;
50
- handleRemovedItems<U extends CollectionResource<ItemTypeType>>(filterFunction: (itemEntry: this['items'][0]) => boolean, resultResource?: U | null, updateInitial?: boolean, callOnRemove?: boolean): U['items'] | null;
51
- private handleRemovedItemCallbacks;
52
- private createBatchStatus;
53
- private expandLocal;
54
- private expandRemote;
55
- expand(newColumns: ApiRequestColumns, localItemCache: ItemCache): PromiseInterface<this>;
56
- extendQuery(callback?: QueryCallback): CollectionQuery;
57
- extend<U extends CollectionResource<ItemTypeType>>(queryCallback: QueryCallback, collectionResource?: U, callOnAdd?: boolean): PromiseInterface<U['items']>;
58
- extend(queryCallback: QueryCallback, collectionResource?: null, callOnAdd?: boolean): PromiseInterface<null>;
59
- queueReload(): void;
60
- expandColumns(columnExpansion: ColumnExpansion<ItemTypeType>): void;
61
- expandRequestColumns(requestColumns: ApiRequestColumns): void;
62
- getAddedItems(returnItemIds: true): ItemId[];
63
- getAddedItems(returnItemIds?: boolean): Array<ItemEntry<ItemTypeType>>;
64
- getRemovedItems(returnItemIds: true): ItemId[];
65
- getRemovedItems(returnItemIds?: boolean): Array<ItemEntry<ItemTypeType>>;
66
- getUpdatedItems(): Array<ItemEntry<ItemTypeType>>;
67
- hasAddedItems(): boolean;
68
- hasRemovedItems(): boolean;
69
- hasUpdatedItems(): boolean;
70
- /**
71
- * @description
72
- * this doesn't revert updates
73
- */
74
- revertChanges(): void;
75
- onItemsCreated(conversionMap: ConversionMap): void;
76
- private onAddInitial;
77
- private onRemoveInitial;
78
- getUpdatedItemColumns(conversionMap: ItemIdConversionMap): {
79
- [columnId: string]: ColumnInfo<ItemTypeType>;
80
- };
81
- clone(parent: EntryParentNull, conversionMap?: ItemIdConversionMap): CollectionEntry<ItemTypeType>;
82
- }
1
+ import { ColumnExpansion, ColumnInfo, ColumnSet, ItemCache } from '../classes';
2
+ import { CollectionEntryFactory } from '../factories';
3
+ import { Deferred } from '../interfaces';
4
+ import { CollectionEntryOptions, CollectionResource, ItemEntry } from '../models';
5
+ import { ApiRequestColumns, CollectionQuery, ConversionMap, EntryParentNull, FieldMap, ItemId, ItemIdConversionMap, ItemType, PromiseInterface, QueryCallback } from '../types';
6
+ export declare class CollectionEntry<ItemTypeType extends ItemType = any> {
7
+ private factory;
8
+ itemType: ItemTypeType;
9
+ options: CollectionEntryOptions;
10
+ id: number;
11
+ parent: EntryParentNull;
12
+ query: CollectionQuery;
13
+ columns: ColumnSet<ItemTypeType>;
14
+ initial: Array<ItemEntry<ItemTypeType>>;
15
+ items: Array<ItemEntry<ItemTypeType>>;
16
+ resources: Array<CollectionResource<ItemTypeType>>;
17
+ deferred?: Deferred<this>;
18
+ promise: PromiseInterface<this>;
19
+ reloadQueued: boolean;
20
+ hasEditResources: boolean;
21
+ hasItemEditResources: boolean;
22
+ private templateColumns;
23
+ constructor(factory: CollectionEntryFactory, itemType: ItemTypeType, options: CollectionEntryOptions);
24
+ clearResource(resource: CollectionResource): void;
25
+ clearResources(): void;
26
+ defer(): this;
27
+ isDeferred(): boolean;
28
+ _resolve(): this;
29
+ resolve(itemEntryCompound: {
30
+ columns: ColumnSet<ItemTypeType>;
31
+ initial: Array<ItemEntry<ItemTypeType>>;
32
+ modified?: Array<ItemEntry<ItemTypeType>>;
33
+ }): this;
34
+ isLocal(): boolean;
35
+ matchParent(itemType: ItemType, itemId: ItemId): boolean;
36
+ forEach(callback: (itemEntry: this['items'][0]) => void): void;
37
+ getItemById(itemId: ItemId): this['items'][0] | undefined;
38
+ getIdArray(accumulator?: ItemId[]): ItemId[];
39
+ createItems(valuesArray: Array<FieldMap<ItemTypeType>>): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
40
+ resolveDerivedValues(itemEntries: Array<ItemEntry<ItemTypeType>>, localItemCache: ItemCache): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
41
+ addItems<U extends CollectionResource<ItemTypeType>>(itemEntries: Array<ItemEntry<ItemTypeType>>, resultResource: U, updateInitial?: boolean, callOnAdd?: boolean, callOnActivate?: boolean): U['items'];
42
+ addItems(itemEntries: Array<ItemEntry<ItemTypeType>>, resultResource?: null, updateInitial?: boolean, callOnAdd?: boolean, callOnActivate?: boolean): null;
43
+ addItems<U extends CollectionResource<ItemTypeType>>(itemEntries: Array<ItemEntry<ItemTypeType>>, resultResource?: U | null, updateInitial?: boolean, callOnAdd?: boolean, callOnActivate?: boolean): U['items'] | null;
44
+ private handleAddedItemCallbacks;
45
+ removeItems<U extends CollectionResource<ItemTypeType>>(idArray: ItemId[], resultResource: U, updateInitial?: boolean, callOnRemove?: boolean): U['items'];
46
+ removeItems(idArray: ItemId[], resultResource?: null, updateInitial?: boolean, callOnRemove?: boolean): null;
47
+ removeItems<U extends CollectionResource<ItemTypeType>>(idArray: ItemId[], resultResource?: U | null, updateInitial?: boolean, callOnRemove?: boolean): U['items'] | null;
48
+ clear<U extends CollectionResource<ItemTypeType>>(resultResource: U, updateInitial?: boolean, callOnRemove?: boolean): U['items'];
49
+ clear(resultResource?: null, updateInitial?: boolean, callOnRemove?: boolean): null;
50
+ handleRemovedItems<U extends CollectionResource<ItemTypeType>>(filterFunction: (itemEntry: this['items'][0]) => boolean, resultResource: U, updateInitial?: boolean, callOnRemove?: boolean): U['items'];
51
+ handleRemovedItems(filterFunction: (itemEntry: this['items'][0]) => boolean, resultResource?: null, updateInitial?: boolean, callOnRemove?: boolean): null;
52
+ handleRemovedItems<U extends CollectionResource<ItemTypeType>>(filterFunction: (itemEntry: this['items'][0]) => boolean, resultResource?: U | null, updateInitial?: boolean, callOnRemove?: boolean): U['items'] | null;
53
+ private handleRemovedItemCallbacks;
54
+ private createBatchStatus;
55
+ private expandLocal;
56
+ private expandRemote;
57
+ expand(newColumns: ApiRequestColumns, localItemCache: ItemCache): PromiseInterface<this>;
58
+ extendQuery(callback?: QueryCallback): CollectionQuery;
59
+ extend<U extends CollectionResource<ItemTypeType>>(queryCallback: QueryCallback, collectionResource?: U, callOnAdd?: boolean): PromiseInterface<U['items']>;
60
+ extend(queryCallback: QueryCallback, collectionResource?: null, callOnAdd?: boolean): PromiseInterface<null>;
61
+ queueReload(): void;
62
+ expandColumns(columnExpansion: ColumnExpansion<ItemTypeType>): void;
63
+ expandRequestColumns(requestColumns: ApiRequestColumns): void;
64
+ getAddedItems(returnItemIds: true): ItemId[];
65
+ getAddedItems(returnItemIds?: boolean): Array<ItemEntry<ItemTypeType>>;
66
+ getRemovedItems(returnItemIds: true): ItemId[];
67
+ getRemovedItems(returnItemIds?: boolean): Array<ItemEntry<ItemTypeType>>;
68
+ getUpdatedItems(): Array<ItemEntry<ItemTypeType>>;
69
+ hasAddedItems(): boolean;
70
+ hasRemovedItems(): boolean;
71
+ hasUpdatedItems(): boolean;
72
+ /**
73
+ * @description
74
+ * Reverts added and removed items
75
+ *
76
+ * @remarks
77
+ * - Doesn't revert changes on the items themselves
78
+ */
79
+ revertChanges(): void;
80
+ onItemsCreated(conversionMap: ConversionMap): void;
81
+ private onAddInitial;
82
+ private onRemoveInitial;
83
+ getUpdatedItemColumns(conversionMap: ItemIdConversionMap): {
84
+ [columnId: string]: ColumnInfo<ItemTypeType>;
85
+ };
86
+ clone(parent: EntryParentNull, conversionMap?: ItemIdConversionMap): CollectionEntry<ItemTypeType>;
87
+ }
@@ -1,12 +1,12 @@
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;
6
- queryParams: any;
7
- parent: EntryParentNull;
8
- deferRequest: boolean;
9
- limit: ApiRequestLimit | null;
10
- entryKey: string | null;
11
- constructor(values: CollectionEntryOptionsInterface);
12
- }
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;
6
+ queryParams: any;
7
+ parent: EntryParentNull;
8
+ deferRequest: boolean;
9
+ limit: ApiRequestLimit | null;
10
+ entryKey: string | null;
11
+ constructor(values: CollectionEntryOptionsInterface);
12
+ }
@@ -1,41 +1,52 @@
1
- import { LocalCache } from '../classes';
2
- import { CollectionResourceFactory } from '../factories';
3
- import { CollectionEntry, CollectionResourceOptions, ItemEntry, ItemResource, LocalViewResource } from '../models';
4
- import { ItemResourceItemIdMap, ItemType, PromiseInterface, QueryCallback, ResponseColumnMap } from '../types';
5
- export declare abstract class CollectionResource<ItemTypeType extends ItemType = any, T extends ItemResource<ItemTypeType> = LocalViewResource<ItemTypeType>> {
6
- protected factory: CollectionResourceFactory;
7
- entry: CollectionEntry<ItemTypeType>;
8
- options: CollectionResourceOptions<ItemTypeType>;
9
- level: number;
10
- localCache: LocalCache | null;
11
- items: T[];
12
- columns: ResponseColumnMap;
13
- protected itemIdMap: ItemResourceItemIdMap<T>;
14
- private readonly onChange;
15
- protected constructor(factory: CollectionResourceFactory, entry: CollectionEntry<ItemTypeType>, options: CollectionResourceOptions<ItemTypeType>, level: number, localCache: LocalCache | null);
16
- getItemById(itemId: number): T;
17
- rebuildMap(): void;
18
- addItemResources(itemEntries: Array<ItemEntry<ItemTypeType>>): T[];
19
- /**
20
- * @param itemEntries
21
- * @returns {ItemResource[]}
22
- *
23
- * Returns the Itemresources that where removed Collection.
24
- * Filters on ItemResource.entry === ItemEntry
25
- */
26
- removeItemResources(itemEntries: Array<ItemEntry<ItemTypeType>>): T[];
27
- callOnAdd(itemResources: T[]): void;
28
- callOnRemove(itemResources: T[]): void;
29
- forEach(callback: (itemResource: T) => void): void;
30
- filter(callback: (itemResource: T) => boolean): T[];
31
- first(callback: (itemResource: T) => boolean): T | null;
32
- some(callback: (itemResource: T) => boolean): boolean;
33
- groupBy(argument: string | ((itemResource: T) => string | null)): {
34
- [key: string]: T[];
35
- };
36
- map<U>(argument: string | ((itemResource: T) => U)): U[];
37
- reduce<U>(callback: (itemResource: T, value: U) => U, value: U): U;
38
- extend(queryCallback: QueryCallback, returnAllItems?: boolean, callOnAdd?: boolean): PromiseInterface<T[]>;
39
- clearResource(): void;
40
- deactivate(): void;
41
- }
1
+ import { LocalCache } from '../classes';
2
+ import { CollectionResourceFactory } from '../factories';
3
+ import { CollectionEntry, CollectionResourceOptions, ItemEntry, ItemResource, LocalViewResource } from '../models';
4
+ import { ItemResourceItemIdMap, ItemType, PromiseInterface, QueryCallback, ResponseColumnItemTypeMap } from '../types';
5
+ export declare abstract class CollectionResource<ItemTypeType extends ItemType = any, T extends ItemResource<ItemTypeType> = LocalViewResource<ItemTypeType>> {
6
+ protected factory: CollectionResourceFactory;
7
+ entry: CollectionEntry<ItemTypeType>;
8
+ options: CollectionResourceOptions<ItemTypeType>;
9
+ localCache: LocalCache | null;
10
+ items: T[];
11
+ columns: ResponseColumnItemTypeMap;
12
+ protected itemIdMap: ItemResourceItemIdMap<T>;
13
+ private readonly onChange;
14
+ protected constructor(factory: CollectionResourceFactory, entry: CollectionEntry<ItemTypeType>, options: CollectionResourceOptions<ItemTypeType>, localCache: LocalCache | null);
15
+ onConstruct(): void;
16
+ getItemById(itemId: number): T;
17
+ rebuildMap(): void;
18
+ addItemResources(itemEntries: Array<ItemEntry<ItemTypeType>>): T[];
19
+ /**
20
+ * @description
21
+ * Returns the {@link ItemResource ItemResources} that where removed from the {@link CollectionResource collection}.
22
+ * Filters on {@link ItemResource ItemResource}.{@link ItemEntry entry} === {@link ItemEntry entry}
23
+ */
24
+ removeItemResources(itemEntries: Array<ItemEntry<ItemTypeType>>): T[];
25
+ callOnAdd(itemResources: T[]): void;
26
+ callOnRemove(itemResources: T[]): void;
27
+ forEach(callback: (itemResource: T) => void): void;
28
+ filter(callback: (itemResource: T) => boolean): T[];
29
+ first(callback: (itemResource: T) => boolean): T | null;
30
+ some(callback: (itemResource: T) => boolean): boolean;
31
+ groupBy(argument: string | ((itemResource: T) => string | null)): {
32
+ [key: string]: T[];
33
+ };
34
+ map<U>(argument: string | ((itemResource: T) => U)): U[];
35
+ reduce<U>(callback: (itemResource: T, value: U) => U, value: U): U;
36
+ extend(queryCallback: QueryCallback, returnAllItems?: boolean, callOnAdd?: boolean): PromiseInterface<T[]>;
37
+ /**
38
+ * @description
39
+ * Removes the reference to the {@link CollectionResource CollectionResource} from the {@link CollectionEntry CollectionEntry}
40
+ *
41
+ * @remarks
42
+ * - Doesn't revert changes on the items themselves
43
+ */
44
+ clearResource(clearItems?: boolean): void;
45
+ /**
46
+ * @deprecated
47
+ *
48
+ * @remarks
49
+ * - Does *not* clear resources
50
+ */
51
+ deactivate(): void;
52
+ }
@@ -1,22 +1,22 @@
1
- import { CollectionEntry, CollectionResource, ItemEntry, ItemResource } from '../models';
2
- import { ConversionMap, ItemType, OnChangeFunction } from '../types';
3
- export declare type CollectionResourceCallback<ItemTypeType extends ItemType> = (itemResources: Array<ItemResource<ItemTypeType>>, collectionResource: CollectionResource<ItemTypeType>) => void;
4
- export declare type CollectionResourceInitialCallback<ItemTypeType extends ItemType> = (itemEntries: Array<ItemEntry<ItemTypeType>>, collectionEntry: CollectionEntry<ItemTypeType>) => void;
5
- export declare type OnItemsCreatedCallback = (conversionMap: ConversionMap) => void;
6
- export declare type CollectionResourceOptionsInterface<ItemTypeType extends ItemType> = Partial<CollectionResourceOptions<ItemTypeType>>;
7
- export declare class CollectionResourceOptions<ItemTypeType extends ItemType> {
8
- editItems: boolean;
9
- remoteItems: boolean;
10
- editCollection: boolean;
11
- modInstant: boolean;
12
- enableSave: boolean;
13
- onItemsCreated: OnItemsCreatedCallback;
14
- onChange: OnChangeFunction;
15
- onAdd: CollectionResourceCallback<ItemTypeType>;
16
- onRemove: CollectionResourceCallback<ItemTypeType>;
17
- onAddInitial: CollectionResourceInitialCallback<ItemTypeType>;
18
- onRemoveInitial: CollectionResourceInitialCallback<ItemTypeType>;
19
- resourceKey: string | null;
20
- custom: any;
21
- constructor(values: CollectionResourceOptionsInterface<ItemTypeType>);
22
- }
1
+ import { CollectionEntry, CollectionResource, ItemEntry, ItemResource } from '../models';
2
+ import { ConversionMap, ItemType, OnChangeFunction } from '../types';
3
+ export declare type CollectionResourceCallback<ItemTypeType extends ItemType> = (itemResources: Array<ItemResource<ItemTypeType>>, collectionResource: CollectionResource<ItemTypeType>) => void;
4
+ export declare type CollectionResourceInitialCallback<ItemTypeType extends ItemType> = (itemEntries: Array<ItemEntry<ItemTypeType>>, collectionEntry: CollectionEntry<ItemTypeType>) => void;
5
+ export declare type OnItemsCreatedCallback = (conversionMap: ConversionMap) => void;
6
+ export declare type CollectionResourceOptionsInterface<ItemTypeType extends ItemType> = Partial<CollectionResourceOptions<ItemTypeType>>;
7
+ export declare class CollectionResourceOptions<ItemTypeType extends ItemType> {
8
+ editItems: boolean;
9
+ remoteItems: boolean;
10
+ editCollection: boolean;
11
+ modInstant: boolean;
12
+ enableSave: boolean;
13
+ onItemsCreated: OnItemsCreatedCallback;
14
+ onChange: OnChangeFunction;
15
+ onAdd: CollectionResourceCallback<ItemTypeType>;
16
+ onRemove: CollectionResourceCallback<ItemTypeType>;
17
+ onAddInitial: CollectionResourceInitialCallback<ItemTypeType>;
18
+ onRemoveInitial: CollectionResourceInitialCallback<ItemTypeType>;
19
+ resourceKey: string | null;
20
+ custom: any;
21
+ constructor(values: CollectionResourceOptionsInterface<ItemTypeType>);
22
+ }
@@ -1,7 +1,7 @@
1
- import { LocalCache } from '../classes';
2
- import { CollectionResourceFactory } from '../factories';
3
- import { CollectionEntry, CollectionResource, CollectionResourceOptions, ItemResource, LocalViewResource } from '../models';
4
- import { ItemType } from '../types';
5
- export declare class CollectionViewResource<ItemTypeType extends ItemType = any, T extends ItemResource<ItemTypeType> = LocalViewResource<ItemTypeType>> extends CollectionResource<ItemTypeType, T> {
6
- constructor(collectionResourceFactory: CollectionResourceFactory, collectionEntry: CollectionEntry<ItemTypeType>, options: CollectionResourceOptions<ItemTypeType>, level: number, localCache: LocalCache | null);
7
- }
1
+ import { LocalCache } from '../classes';
2
+ import { CollectionResourceFactory } from '../factories';
3
+ import { CollectionEntry, CollectionResource, CollectionResourceOptions, ItemResource, LocalViewResource } from '../models';
4
+ import { ItemType } from '../types';
5
+ export declare class CollectionViewResource<ItemTypeType extends ItemType = any, T extends ItemResource<ItemTypeType> = LocalViewResource<ItemTypeType>> extends CollectionResource<ItemTypeType, T> {
6
+ constructor(collectionResourceFactory: CollectionResourceFactory, collectionEntry: CollectionEntry<ItemTypeType>, options: CollectionResourceOptions<ItemTypeType>, localCache: LocalCache | null);
7
+ }
@@ -1,18 +1,18 @@
1
- import { LocalCache } from '../classes';
2
- import { ItemResourceFactory } from '../factories';
3
- import { ItemEntry, ItemResource, ItemResourceOptions } from '../models';
4
- import { FieldMap, ItemType, PromiseInterface } from '../types';
5
- export declare class EditResource<ItemTypeType extends ItemType = any> extends ItemResource<ItemTypeType> {
6
- protected localCopies: Array<FieldMap<ItemTypeType>>;
7
- protected transactions: number;
8
- constructor(factory: ItemResourceFactory, entry: ItemEntry<ItemTypeType>, options: ItemResourceOptions, isNew: boolean, localCache: LocalCache | null);
9
- isNew(): boolean;
10
- start(): this;
11
- rollback(): this;
12
- commit(callOnChange?: boolean): this;
13
- getLocalCopy(): FieldMap<ItemTypeType> | null;
14
- copyFields(destination?: FieldMap<ItemTypeType>): FieldMap<ItemTypeType>;
15
- setFields(values: FieldMap<ItemTypeType>, callOnChange?: boolean): this;
16
- callOnChange(previous?: FieldMap<ItemTypeType>): this;
17
- save(parameters?: any): PromiseInterface<this>;
18
- }
1
+ import { LocalCache } from '../classes';
2
+ import { ItemResourceFactory } from '../factories';
3
+ import { ItemEntry, ItemResource, ItemResourceOptions } from '../models';
4
+ import { FieldMap, ItemType, PromiseInterface } from '../types';
5
+ export declare class EditResource<ItemTypeType extends ItemType = any> extends ItemResource<ItemTypeType> {
6
+ protected localCopies: Array<FieldMap<ItemTypeType>>;
7
+ protected transactions: number;
8
+ constructor(factory: ItemResourceFactory, entry: ItemEntry<ItemTypeType>, options: ItemResourceOptions, isNew: boolean, localCache: LocalCache | null);
9
+ isNew(): boolean;
10
+ start(): this;
11
+ rollback(): this;
12
+ commit(callOnChange?: boolean): this;
13
+ getLocalCopy(): FieldMap<ItemTypeType> | null;
14
+ copyFields(destination?: FieldMap<ItemTypeType>): FieldMap<ItemTypeType>;
15
+ setFields(values: FieldMap<ItemTypeType>, callOnChange?: boolean): this;
16
+ callOnChange(previous?: FieldMap<ItemTypeType>): this;
17
+ save(parameters?: any): PromiseInterface<this>;
18
+ }