@rentman/rm-core 1.0.34 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/changelog.md +66 -0
  2. package/dist/dist/classes/ApiFormatter.d.ts +37 -37
  3. package/dist/dist/classes/ApiRequestService.d.ts +18 -17
  4. package/dist/dist/classes/ApiResponseProcessor.d.ts +33 -31
  5. package/dist/dist/classes/BatchStatus.d.ts +18 -18
  6. package/dist/dist/classes/ChangesCompilation.d.ts +26 -0
  7. package/dist/dist/classes/ChangesProcessor.d.ts +34 -41
  8. package/dist/dist/classes/CollectionCache.d.ts +33 -40
  9. package/dist/dist/classes/CollectionEntryService.d.ts +26 -23
  10. package/dist/dist/classes/CollectionHandler.d.ts +49 -64
  11. package/dist/dist/classes/CollectionMatcher.d.ts +28 -0
  12. package/dist/dist/classes/CollectionResourceService.d.ts +5 -5
  13. package/dist/dist/classes/ColumnCache.d.ts +18 -18
  14. package/dist/dist/classes/ColumnExpansion.d.ts +14 -16
  15. package/dist/dist/classes/ColumnHandler.d.ts +16 -17
  16. package/dist/dist/classes/ColumnInfo.d.ts +12 -0
  17. package/dist/dist/classes/ColumnSet.d.ts +34 -54
  18. package/dist/dist/classes/ColumnUtil.d.ts +79 -81
  19. package/dist/dist/classes/CreateRequest.d.ts +20 -20
  20. package/dist/dist/classes/ItemAdministrator.d.ts +99 -114
  21. package/dist/dist/classes/ItemCache.d.ts +25 -22
  22. package/dist/dist/classes/ItemEntryService.d.ts +18 -51
  23. package/dist/dist/classes/ItemHandler.d.ts +57 -82
  24. package/dist/dist/classes/ItemRequestService.d.ts +22 -28
  25. package/dist/dist/classes/ItemResourceService.d.ts +7 -7
  26. package/dist/dist/classes/KeyService.d.ts +25 -28
  27. package/dist/dist/classes/LocalCache.d.ts +48 -66
  28. package/dist/dist/classes/LockService.d.ts +23 -23
  29. package/dist/dist/classes/{ModuleChangesCompiler.d.ts → ModuleChangesCompilation.d.ts} +19 -22
  30. package/dist/dist/classes/QueryMatcher.d.ts +14 -14
  31. package/dist/dist/classes/QueryParser.d.ts +16 -16
  32. package/dist/dist/classes/QueryService.d.ts +19 -19
  33. package/dist/dist/classes/RequestColumnExpansion.d.ts +9 -9
  34. package/dist/dist/classes/SocketMessageHandler.d.ts +32 -32
  35. package/dist/dist/classes/Util.d.ts +25 -25
  36. package/dist/dist/classes/index.d.ts +34 -32
  37. package/dist/dist/constants.d.ts +15 -10
  38. package/dist/dist/factories/ApiResponseProcessorFactory.d.ts +6 -6
  39. package/dist/dist/factories/BatchStatusFactory.d.ts +9 -8
  40. package/dist/dist/factories/ChangesCompilationFactory.d.ts +8 -0
  41. package/dist/dist/factories/ChangesProcessorFactory.d.ts +18 -23
  42. package/dist/dist/factories/CollectionCacheFactory.d.ts +7 -7
  43. package/dist/dist/factories/CollectionEntryFactory.d.ts +14 -14
  44. package/dist/dist/factories/CollectionMatcherFactory.d.ts +7 -0
  45. package/dist/dist/factories/CollectionResourceFactory.d.ts +16 -16
  46. package/dist/dist/factories/ColumnExpansionFactory.d.ts +8 -9
  47. package/dist/dist/factories/ColumnInfoFactory.d.ts +6 -0
  48. package/dist/dist/factories/ColumnSetFactory.d.ts +11 -7
  49. package/dist/dist/factories/CreateRequestFactory.d.ts +10 -10
  50. package/dist/dist/factories/ItemCacheFactory.d.ts +7 -8
  51. package/dist/dist/factories/ItemEntryFactory.d.ts +19 -5
  52. package/dist/dist/factories/ItemResourceFactory.d.ts +14 -16
  53. package/dist/dist/factories/LocalCacheFactory.d.ts +16 -25
  54. package/dist/dist/factories/ModuleChangesCompilationFactory.d.ts +5 -0
  55. package/dist/dist/factories/QueryMatcherFactory.d.ts +7 -6
  56. package/dist/dist/factories/QueryParserFactory.d.ts +5 -5
  57. package/dist/dist/factories/RequestColumnExpansionFactory.d.ts +6 -6
  58. package/dist/dist/factories/index.d.ts +20 -18
  59. package/dist/dist/index.d.ts +7 -7
  60. package/dist/dist/interfaces/ApiRequestServiceInterface.d.ts +11 -10
  61. package/dist/dist/interfaces/AuthInterface.d.ts +9 -9
  62. package/dist/dist/interfaces/ErrorHandlerInterface.d.ts +4 -4
  63. package/dist/dist/interfaces/LocalCacheManagerInterface.d.ts +5 -5
  64. package/dist/dist/interfaces/PromiseInterface.d.ts +11 -11
  65. package/dist/dist/interfaces/SocketMessageInterface.d.ts +3 -3
  66. package/dist/dist/interfaces/index.d.ts +6 -6
  67. package/dist/dist/main.d.ts +46 -44
  68. package/dist/dist/models/CollectionEditResource.d.ts +21 -20
  69. package/dist/dist/models/CollectionEntry.d.ts +60 -57
  70. package/dist/dist/models/CollectionResource.d.ts +36 -37
  71. package/dist/dist/models/CollectionViewResource.d.ts +5 -13
  72. package/dist/dist/models/EditResource.d.ts +22 -25
  73. package/dist/dist/models/ItemEntry.d.ts +62 -18
  74. package/dist/dist/models/ItemResource.d.ts +16 -15
  75. package/dist/dist/models/ViewResource.d.ts +4 -6
  76. package/dist/dist/models/index.d.ts +8 -8
  77. package/dist/dist/types/ItemTypesCollection.d.ts +87 -49
  78. package/dist/dist/types/index.d.ts +1 -0
  79. package/dist/rm-core.js +6678 -6531
  80. package/dist/rm-core.min.js +1 -1
  81. package/package.json +2 -2
  82. package/readme.md +15 -15
  83. package/dist/dist/classes/ChangesCompiler.d.ts +0 -33
  84. package/dist/dist/factories/ChangesCompilerFactory.d.ts +0 -7
  85. package/dist/dist/factories/ModuleChangesCompilerFactory.d.ts +0 -7
package/changelog.md CHANGED
@@ -1,6 +1,72 @@
1
1
  #Changelog
2
2
  Contains new features, breaking changes and their reasoning
3
3
 
4
+ ## v1.1.1
5
+ - Fixed an issue where changes wouldn't be detected.
6
+ - **Breaking:** Removed the `_hasChanges` function in the `localCache` class. If you want to force changes detection,
7
+ call `detectChanges` instead. Otherwise, rely on the `hasChanges` variable.
8
+ - **Breaking:** Removed the `enableWatcher` and `disableWatcher` functions. Use `enableChangesWatcher` and
9
+ `disableChangesWatcher` instead.
10
+
11
+ ## v1.1.0
12
+ ### Development
13
+
14
+ #### Strict TypeScript compilation
15
+ Added the following TypeScript compiler options:
16
+ - noImplicitThis
17
+ - noImplicitReturns
18
+ - strictNullChecks
19
+ - noUnusedLocals
20
+ - noUnusedParameters
21
+
22
+ I would advise enabling these for all TypeScript projects from now on.
23
+
24
+ #### Ordered imports and dependencies
25
+ Imports are now ordered alphabetically and grouped by folder. Added a TSLint option to enforce this.
26
+ Please note that this also applies for imports from the folder the file is currently in.
27
+ For example, in `models/ItemResource.ts`, `itemEntry` should be imported like so:
28
+ `import { ItemEntry } from '../models';`
29
+
30
+ Also, factory and class dependencies should be ordered alphabetically as well. This will make it easier to add and
31
+ remove dependencies in the future.
32
+
33
+ ### Breaking changes
34
+
35
+ - Renamed `changesCompiler` to `changesCompilation`, `changesCompilerFactory` to `changesCompilationFactory`,
36
+ `moduleChangesCompiler` to `moduleChangesCompilation` and `moduleChangesCompilerFactory` to
37
+ `moduleChangesCompilationFactory`.
38
+ - Removed the `allLinks` parameter from the `query` function definition in the `ApiRequestServiceInterface`. This is
39
+ no longer supported in the back-end.
40
+
41
+ #### Item and collection entries
42
+ - Moved *all* functions that handle item entries from the `ItemEntryService` to the `ItemEntry` class.
43
+ - Added the following functions to `ItemEntryService`:
44
+ - `createLocalConversionMap`;
45
+ - `expandLocalConversionMap`;
46
+ - `expandConversionMap`;
47
+ - `batchExpandConversionMap`;
48
+ - `batchClone`.
49
+ - Cloning of item entries now works slightly differently. The function will attempt to generate a new
50
+ item ID, and update the conversion map accordingly, but will respect the item ID that is already there.
51
+
52
+ #### Rework item caching
53
+ Newly created item entries and collection entries are no longer added to the global *or* local cache by default.
54
+ All entries are added to the global cache on save. Item entries are added to the local cache when resources are created
55
+ using the item administrator or when resources are created when adding the items to a collection.
56
+
57
+ > This will increase reliability by ensuring the global cache is no longer 'polluted' with local items. Also, this will
58
+ > allow for the creation item and collection entries without caching them directly. This is required for the copying and
59
+ > pasting of items.
60
+
61
+ Other changes:
62
+
63
+ - Moved `saveLocal` to `ItemAdministrator`;
64
+ - `ItemAdministrator.fetchTitle` should now be called instead of `ItemHandler.fetchTitle`;
65
+ - The `ItemAdministrator` collection matching functions (`addToCollections`, `removeFromCollections`) should now be
66
+ called instead of those in the `CollectionHandler`. The `CollectionHandler` should only be used to reflect changes
67
+ already on the backend. (Use `getCollectionMatcher`.)
68
+
69
+
4
70
  ##v1.0.33
5
71
  - Really fix types path
6
72
 
@@ -1,37 +1,37 @@
1
- /// <reference types="moment" />
2
- import * as moment from 'moment';
3
- export declare class ApiFormatter {
4
- MOMENT_INVALID: string;
5
- SERVER_DATETIME_FORMAT: string;
6
- SERVER_TIME_FORMAT: string;
7
- SERVER_DATE_FORMAT: string;
8
- constructor();
9
- formatResponse(fields: any, columns: any): void;
10
- expandResponse(current: any, expanded: any, columns: any): void;
11
- formatRequest(initial: any, modified: any, columns: any): {};
12
- hasChanges(initial: any, modified: any, columns: any): boolean;
13
- getChanges(initial: any, modified: any, columns: any): any[];
14
- copyFields(source: any, destination: any, columns: any): any;
15
- shallowCopyFields(shallowSource: any, deepSource: any, destination: any, columns: any): any;
16
- setDefaultValues(destination: any, columns: any): any;
17
- compareFields(columnType: any, first: any, second: any): any;
18
- compareFloats(a: any, b: any): boolean;
19
- compareMomentObjects(first: any, second: any): any;
20
- compareDurations(first: any, second: any): boolean;
21
- formatResponseValue(columnType: any, value: any): any;
22
- formatRequestValue(columnType: any, value: any): any;
23
- formatResponseDate(value: any): moment.Moment;
24
- formatResponseDuration(value: any): moment.Duration;
25
- formatResponseColor(value: any): any;
26
- formatRequestDateTime(value: any): any;
27
- formatRequestDate(value: any): any;
28
- formatRequestDuration(value: any): any;
29
- formatRequestColor(value: any): any;
30
- getDefaultValue(columnType: any): false | moment.Moment | 0 | moment.Duration | "" | "0" | "#000000";
31
- isDefaultValue(columnType: any, value: any): any;
32
- clone(columnType: any, value: any): any;
33
- getCloneFunction(columnType: any): (date: any) => any;
34
- cloneDuration(duration: any): moment.Duration;
35
- cloneDate(date: any): any;
36
- identity(input: any): any;
37
- }
1
+ /// <reference types="moment" />
2
+ import * as moment from 'moment';
3
+ export declare class ApiFormatter {
4
+ MOMENT_INVALID: string;
5
+ SERVER_DATETIME_FORMAT: string;
6
+ SERVER_TIME_FORMAT: string;
7
+ SERVER_DATE_FORMAT: string;
8
+ constructor();
9
+ formatResponse(fields: any, columns: any): void;
10
+ expandResponse(current: any, expanded: any, columns: any): void;
11
+ formatRequest(initial: any, modified: any, columns: any): {};
12
+ hasChanges(initial: any, modified: any, columns: any): boolean;
13
+ getChanges(initial: any, modified: any, columns: any): object[];
14
+ copyFields(source: any, destination: any, columns: any): any;
15
+ shallowCopyFields(shallowSource: any, deepSource: any, destination: any, columns: any): any;
16
+ setDefaultValues(destination: any, columns: any): any;
17
+ compareFields(columnType: any, first: any, second: any): any;
18
+ compareFloats(a: any, b: any): boolean;
19
+ compareMomentObjects(first: any, second: any): any;
20
+ compareDurations(first: any, second: any): boolean;
21
+ formatResponseValue(columnType: any, value: any): any;
22
+ formatRequestValue(columnType: any, value: any): any;
23
+ formatResponseDate(value: any): moment.Moment;
24
+ formatResponseDuration(value: any): moment.Duration;
25
+ formatResponseColor(value: any): any;
26
+ formatRequestDateTime(value: any): any;
27
+ formatRequestDate(value: any): any;
28
+ formatRequestDuration(value: any): any;
29
+ formatRequestColor(value: any): any;
30
+ getDefaultValue(columnType: any): false | "" | 0 | moment.Moment | moment.Duration | "0" | "#000000" | null;
31
+ isDefaultValue(columnType: any, value: any): any;
32
+ clone(columnType: any, value: any): any;
33
+ getCloneFunction(columnType: any): (date: any) => any;
34
+ cloneDuration(duration: any): moment.Duration;
35
+ cloneDate(date: any): any;
36
+ identity(input: any): any;
37
+ }
@@ -1,17 +1,18 @@
1
- import { ApiResponseProcessorFactory } from '../factories';
2
- import { ApiRequestServiceInterface } from '../interfaces';
3
- import { ApiResponseProcessor } from './ApiResponseProcessor';
4
- export declare class ApiRequestService {
5
- private externalApiRequestService;
6
- private apiResponseProcessorFactory;
7
- constructor(externalApiRequestService: ApiRequestServiceInterface, apiResponseProcessorFactory: ApiResponseProcessorFactory);
8
- template(itemType: string, params: any): Promise<ApiResponseProcessor>;
9
- create(itemType: string, itemId: number, values: any, parentType?: string, parentId?: number): Promise<ApiResponseProcessor>;
10
- delete(itemType: string, itemIds: number[]): Promise<ApiResponseProcessor>;
11
- updateItems(itemType: string, items: object, columns: any): Promise<ApiResponseProcessor>;
12
- requestSkeleton(params: any, requestCanceler?: Promise<any>): Promise<ApiResponseProcessor>;
13
- moveItems(parentType: string, parentId: number, items: object): Promise<ApiResponseProcessor>;
14
- columns(itemType: string, columns: object, params?: any): Promise<ApiResponseProcessor>;
15
- query(itemType: string, query: object, columns: object, allLinks?: boolean, limit?: object): Promise<ApiResponseProcessor>;
16
- processResponse(request: any): Promise<ApiResponseProcessor>;
17
- }
1
+ import { ApiResponseProcessor } from '../classes';
2
+ import { ApiResponseProcessorFactory } from '../factories';
3
+ import { ApiRequestServiceInterface } from '../interfaces';
4
+ import { ItemId, ItemType } from '../types';
5
+ export declare class ApiRequestService {
6
+ private externalApiRequestService;
7
+ private apiResponseProcessorFactory;
8
+ constructor(externalApiRequestService: ApiRequestServiceInterface, apiResponseProcessorFactory: ApiResponseProcessorFactory);
9
+ template(itemType: ItemType, params: any): Promise<ApiResponseProcessor>;
10
+ create(itemType: ItemType, itemId: ItemId, values: any, parentType?: ItemType, parentId?: ItemId): Promise<ApiResponseProcessor>;
11
+ delete(itemType: ItemType, itemIds: ItemId[]): Promise<ApiResponseProcessor>;
12
+ updateItems(itemType: ItemType, items: object, columns: any): Promise<ApiResponseProcessor>;
13
+ requestSkeleton(params: any, requestCanceler?: Promise<any>): Promise<ApiResponseProcessor>;
14
+ moveItems(parentType: ItemType, parentId: ItemId, items: object): Promise<ApiResponseProcessor>;
15
+ columns(itemType: ItemType, columns: object, params?: any): Promise<ApiResponseProcessor>;
16
+ query(itemType: ItemType, query: object, columns: object, limit?: object): Promise<ApiResponseProcessor>;
17
+ processResponse(request: any): Promise<ApiResponseProcessor>;
18
+ }
@@ -1,31 +1,33 @@
1
- import { ItemTypeMap } from '../types/ItemTypesCollection';
2
- import { ApiFormatter } from './ApiFormatter';
3
- export declare class ApiResponseProcessor {
4
- apiFormatter: ApiFormatter;
5
- response: any;
6
- columns: ItemTypeMap;
7
- items: ItemTypeMap;
8
- links: ItemTypeMap;
9
- cacheable: boolean;
10
- map: any;
11
- columnIndexMap: any;
12
- columnMap: any;
13
- constructor(apiFormatter: ApiFormatter, response: any);
14
- createColumnMaps(): void;
15
- fetchValue(itemType: any, itemId: any, columnId: any): any;
16
- fetchDerivedObject(itemType: any, itemId: any, rootColumns: any): {};
17
- fetchDerivedValues(value: any, column: any, destination: any): void;
18
- fetchObject(itemType: any, itemId: any, includeLinks?: boolean): any;
19
- fetchObjectArray(itemType: any, includeLinks: any, idArray: any): any;
20
- fetchObjectMap(itemType: any, columnId: any, includeLinks: any, returnKeys: any): {};
21
- fetchFieldMap(itemType: any, columnId: any): {};
22
- fetchColumnArray(itemType: any): any[];
23
- fetchColumnObject(itemType: any): any;
24
- fetchColumnsObject(): any;
25
- createResource(itemType: any, id: any): {
26
- object: any;
27
- links: any;
28
- };
29
- hasItems(itemType: any): boolean;
30
- getIdArray(itemType: any): any[];
31
- }
1
+ import { ApiFormatter } from '../classes';
2
+ import { ItemTypeMap } from '../types';
3
+ export declare class ApiResponseProcessor {
4
+ apiFormatter: ApiFormatter;
5
+ response: any;
6
+ columns: ItemTypeMap;
7
+ items: ItemTypeMap;
8
+ links: ItemTypeMap;
9
+ cacheable: boolean;
10
+ map: any;
11
+ columnIndexMap: any;
12
+ columnMap: any;
13
+ constructor(apiFormatter: ApiFormatter, response: any);
14
+ createColumnMaps(): void;
15
+ fetchValue(itemType: any, itemId: any, columnId: any): any;
16
+ fetchDerivedObject(itemType: any, itemId: any, rootColumns: any): {};
17
+ fetchDerivedValues(value: any, column: any, destination: any): void;
18
+ fetchObject(itemType: any, itemId: any, includeLinks?: boolean): any;
19
+ fetchObjectArray(itemType: any, includeLinks: any, idArray: any): any;
20
+ fetchObjectMap(itemType: any, columnId: any, includeLinks: any, returnKeys: any): {
21
+ [key: string]: any;
22
+ };
23
+ fetchFieldMap(itemType: any, columnId: any): {};
24
+ fetchColumnArray(itemType: any): any[];
25
+ fetchColumnObject(itemType: any): any;
26
+ fetchColumnsObject(): any;
27
+ createResource(itemType: any, id: any): {
28
+ object: any;
29
+ links: any;
30
+ };
31
+ hasItems(itemType: any): boolean;
32
+ getIdArray(itemType: any): string[];
33
+ }
@@ -1,18 +1,18 @@
1
- import { ENTRY_STATUS } from "../constants";
2
- import { PromiseInterface } from '../interfaces';
3
- import { ItemEntry } from "../models";
4
- import { EntryStatus, ItemEntryEntryStatusMap } from '../types/ItemTypesCollection';
5
- export declare class BatchStatus {
6
- private promiseService;
7
- getItemId: (itemEntry: ItemEntry) => number;
8
- getPromise: (itemEntry: ItemEntry) => Promise<ItemEntry>;
9
- entries: ItemEntryEntryStatusMap;
10
- constructor(promiseService: PromiseInterface, getItemId: (itemEntry: ItemEntry) => number, getPromise: (itemEntry: ItemEntry) => Promise<ItemEntry>);
11
- add(entryStatus: EntryStatus<ItemEntry>): void;
12
- hasEntries(statusArray: ENTRY_STATUS[]): boolean;
13
- hasRequests(): boolean;
14
- forEachEntry(statusArray: ENTRY_STATUS[], callback: (itemEntry: ItemEntry) => void): void;
15
- getPromises(): Promise<ItemEntry[]>;
16
- getRequestIds(): number[];
17
- getArray(): ItemEntry[];
18
- }
1
+ import { ENTRY_STATUS } from '../constants';
2
+ import { PromiseInterface } from '../interfaces';
3
+ import { ItemEntry } from '../models';
4
+ import { EntryStatus, ItemEntryEntryStatusMap, ItemId } from '../types';
5
+ export declare class BatchStatus {
6
+ private promiseService;
7
+ getItemId: (itemEntry: ItemEntry) => ItemId;
8
+ getPromise: (itemEntry: ItemEntry) => Promise<ItemEntry>;
9
+ entries: ItemEntryEntryStatusMap;
10
+ constructor(promiseService: PromiseInterface, getItemId: (itemEntry: ItemEntry) => ItemId, getPromise: (itemEntry: ItemEntry) => Promise<ItemEntry>);
11
+ add(entryStatus: EntryStatus<ItemEntry>): void;
12
+ hasEntries(statusArray: ENTRY_STATUS[]): boolean;
13
+ hasRequests(): boolean;
14
+ forEachEntry(statusArray: ENTRY_STATUS[], callback: (itemEntry: ItemEntry) => void): void;
15
+ getPromises(): Promise<ItemEntry[]>;
16
+ getRequestIds(): number[];
17
+ getArray(): ItemEntry[];
18
+ }
@@ -0,0 +1,26 @@
1
+ import { CollectionCache } from '../classes';
2
+ import { CollectionCacheFactory } from '../factories';
3
+ import { CollectionEntry, ItemEntry } from '../models';
4
+ import { EntryParent } from '../types';
5
+ export declare class ChangesCompilation {
6
+ private collectionCacheFactory;
7
+ singleItems: ItemEntry[];
8
+ compilation: {
9
+ create: {};
10
+ delete: {};
11
+ update: {};
12
+ move: {};
13
+ };
14
+ collections: CollectionCache;
15
+ private moveArray;
16
+ private deleteMap;
17
+ constructor(collectionCacheFactory: CollectionCacheFactory, singleItems: ItemEntry[], collectionEntries: CollectionEntry[]);
18
+ getDefaultParent(): EntryParent;
19
+ addMoveEntry(itemEntry: any): void;
20
+ addDeleteEntry(itemEntry: any, parentId: any, parentType: any): void;
21
+ addUpdateEntry(itemEntry: any): void;
22
+ addCreateEntry(itemEntry: any): void;
23
+ postProcess(): void;
24
+ private processSingleItems();
25
+ private processCollections(collectionEntries);
26
+ }
@@ -1,41 +1,34 @@
1
- import { ChangesCompilerFactory, ColumnExpansionFactory, CreateRequestFactory, RequestColumnExpansionFactory } from "../factories";
2
- import { ApiRequestServiceInterface, ErrorHandlerInterface, PromiseInterface } from '../interfaces';
3
- import { ApiFormatter } from "./ApiFormatter";
4
- import { CollectionEntryService } from "./CollectionEntryService";
5
- import { CollectionHandler } from "./CollectionHandler";
6
- import { ColumnHandler } from "./ColumnHandler";
7
- import { ItemEntryService } from "./ItemEntryService";
8
- import { ItemHandler } from "./ItemHandler";
9
- export declare class ChangesProcessor {
10
- private apiRequestService;
11
- private itemHandler;
12
- private errorHandler;
13
- private collectionHandler;
14
- private columnHandler;
15
- private changesCompilerFactory;
16
- private createRequestFactory;
17
- private columnExpansionFactory;
18
- private requestColumnExpansionFactory;
19
- private collectionEntryService;
20
- private itemEntryService;
21
- private apiFormatter;
22
- private promiseService;
23
- constructor(apiRequestService: ApiRequestServiceInterface, itemHandler: ItemHandler, errorHandler: ErrorHandlerInterface, collectionHandler: CollectionHandler, columnHandler: ColumnHandler, changesCompilerFactory: ChangesCompilerFactory, createRequestFactory: CreateRequestFactory, columnExpansionFactory: ColumnExpansionFactory, requestColumnExpansionFactory: RequestColumnExpansionFactory, collectionEntryService: CollectionEntryService, itemEntryService: ItemEntryService, apiFormatter: ApiFormatter, promiseService: PromiseInterface);
24
- getItemTypeUpdatePriority(itemType: any): 0 | 1 | 2;
25
- buildMoveRequest(compilationEntries: any): {};
26
- getMapValue(itemType: any, itemId: any, map: any): any;
27
- execute(singleItems: any, collections: any, breakupByParent?: boolean, parameters?: any, collectionOptions?: any, onAfterCreateCallback?: any): Promise<any>;
28
- private executeCreateRequests(compilation, parameters, conversionMap, breakupByParent, onAfterCreateCallback);
29
- private executeCreateRequest(requestResource, conversionMap);
30
- private prioritizeUpdateRequests(compilation, parameters);
31
- private executeUpdateRequests(itemTypes, compilation, parameters);
32
- private executeUpdateRequest(itemType, itemEntries, parameterMap);
33
- private executeDeleteRequests(compilation);
34
- private executeDeleteRequest(itemType, itemEntries);
35
- private executeMoveRequests(compilation, conversionMap);
36
- private processMoveResponse(response, compilationEntries);
37
- private addCollectionMapEntry(collectionMap, parentId, itemEntry, value);
38
- private forEachCollection(collectionMap, method);
39
- private onItemsCreated(conversionMap, singleItems, collections);
40
- private executeRequests(changes, parameters, breakupByParent, onAfterCreateCallback);
41
- }
1
+ import { ApiFormatter, CollectionEntryService, CollectionHandler, ItemHandler } from '../classes';
2
+ import { ChangesCompilationFactory, ColumnExpansionFactory, CreateRequestFactory, RequestColumnExpansionFactory } from '../factories';
3
+ import { ApiRequestServiceInterface, ErrorHandlerInterface, PromiseInterface } from '../interfaces';
4
+ export declare class ChangesProcessor {
5
+ private apiRequestService;
6
+ private itemHandler;
7
+ private errorHandler;
8
+ private collectionHandler;
9
+ private changesCompilationFactory;
10
+ private createRequestFactory;
11
+ private columnExpansionFactory;
12
+ private requestColumnExpansionFactory;
13
+ private collectionEntryService;
14
+ private apiFormatter;
15
+ private promiseService;
16
+ constructor(apiRequestService: ApiRequestServiceInterface, itemHandler: ItemHandler, errorHandler: ErrorHandlerInterface, collectionHandler: CollectionHandler, changesCompilationFactory: ChangesCompilationFactory, createRequestFactory: CreateRequestFactory, columnExpansionFactory: ColumnExpansionFactory, requestColumnExpansionFactory: RequestColumnExpansionFactory, collectionEntryService: CollectionEntryService, apiFormatter: ApiFormatter, promiseService: PromiseInterface);
17
+ getItemTypeUpdatePriority(itemType: any): 0 | 1 | 2;
18
+ buildMoveRequest(compilationEntries: any): {};
19
+ getMapValue(itemType: any, itemId: any, map: any): any;
20
+ execute(singleItems: any, collections: any, breakupByParent?: boolean, parameters?: any, onAfterCreateCallback?: any): Promise<any>;
21
+ private executeCreateRequests(changesCompilation, parameters, conversionMap, breakupByParent, onAfterCreateCallback);
22
+ private executeCreateRequest(requestResource, conversionMap);
23
+ private prioritizeUpdateRequests(compilation, parameters);
24
+ private executeUpdateRequests(itemTypes, compilation, parameters);
25
+ private executeUpdateRequest(itemType, itemEntries, parameterMap);
26
+ private executeDeleteRequests(compilation);
27
+ private executeDeleteRequest(itemType, itemEntries);
28
+ private executeMoveRequests(compilation, conversionMap);
29
+ private processMoveResponse(compilationEntries);
30
+ private addCollectionMapEntry(collectionMap, parentId, itemEntry, value);
31
+ private forEachCollection(collectionMap, method);
32
+ private onItemsCreated(conversionMap, singleItems, collections);
33
+ private executeRequests(changesCompilation, parameters, breakupByParent, onAfterCreateCallback);
34
+ }
@@ -1,40 +1,33 @@
1
- import { QueryMatcherFactory } from "../factories";
2
- import { CollectionEntry, CollectionResource } from "../models";
3
- import { CollectionEntryItemTypeMap } from '../types/ItemTypesCollection';
4
- export declare class CollectionCache {
5
- private queryMatcherFactory;
6
- entries: CollectionEntryItemTypeMap;
7
- constructor(queryMatcherFactory: QueryMatcherFactory);
8
- contains(collectionEntry: CollectionEntry): boolean;
9
- some(callback: (entry: CollectionEntry) => void): boolean;
10
- forEach(callback: (entry: CollectionEntry) => void): void;
11
- toArray(): CollectionEntry[];
12
- add(collectionEntry: CollectionEntry): CollectionEntry;
13
- clear(collectionEntry?: CollectionEntry): boolean;
14
- getByItemType(itemType: string): CollectionEntry[];
15
- getByParent(parentType: any, parentId: any, itemType: any): CollectionEntry | null;
16
- getResourceByParent(parentType: any, parentId: any, itemType: any): CollectionResource;
17
- getCollectionsByParent(parentType: any, parentId: any): CollectionEntry[];
18
- /**
19
- * Only resources
20
- * @param {String} itemType
21
- * @param {String|Integer} itemId
22
- * @returns {Object} Array of collections.
23
- */
24
- getByContainingItem(itemType: any, itemId: any): CollectionEntry[];
25
- /**
26
- * Returns an array of collections the item 'belongs' in.
27
- * @param {String} parentType
28
- * @param {String} parentId
29
- * @param {String} itemType
30
- * @returns {Object}
31
- */
32
- getByFittingItem(parentType: any, parentId: any, itemType: any, fields: any): {
33
- fitting: any[];
34
- notfitting: any[];
35
- maybe: any[];
36
- };
37
- getByQuery(itemType: any, query: any): CollectionEntry;
38
- getByKey(itemType: any, entryKey: any): CollectionEntry[];
39
- getResourceByKey(itemType: any, resourceKey: any): any[];
40
- }
1
+ import { QueryMatcherFactory } from '../factories';
2
+ import { CollectionEntry, CollectionResource } from '../models';
3
+ import { CollectionEntryItemTypeMap, CollectionMatchResult, EntryParentNull, FieldMap, ItemType } from '../types';
4
+ export declare class CollectionCache {
5
+ private queryMatcherFactory;
6
+ entries: CollectionEntryItemTypeMap;
7
+ constructor(queryMatcherFactory: QueryMatcherFactory);
8
+ contains(collectionEntry: CollectionEntry): boolean;
9
+ some(callback: (entry: CollectionEntry) => void): boolean;
10
+ forEach(callback: (entry: CollectionEntry) => void): void;
11
+ toArray(): CollectionEntry[];
12
+ add(collectionEntry: CollectionEntry): CollectionEntry;
13
+ clear(collectionEntry?: CollectionEntry): boolean;
14
+ getByItemType(itemType: string): CollectionEntry[];
15
+ matchParent(collectionEntry: CollectionEntry, itemType: string, itemId: any): boolean;
16
+ getByParent(parentType: any, parentId: any, itemType: any): CollectionEntry | null;
17
+ getResourceByParent(parentType: any, parentId: any, itemType: any): CollectionResource | null;
18
+ getCollectionsByParent(parentType: any, parentId: any): CollectionEntry[];
19
+ /**
20
+ * Only resources
21
+ * @param {String} itemType
22
+ * @param {String|Integer} itemId
23
+ * @returns {Object} Array of collections.
24
+ */
25
+ getByContainingItem(itemType: any, itemId: any): CollectionEntry[];
26
+ /**
27
+ * Returns an array of collections the item 'belongs' in.
28
+ */
29
+ getByFittingItem(itemType: ItemType, fields: FieldMap, parent: EntryParentNull): CollectionMatchResult;
30
+ getByQuery(itemType: any, query: any): CollectionEntry | null;
31
+ getByKey(itemType: any, entryKey: any): CollectionEntry[];
32
+ getResourceByKey(itemType: any, resourceKey: any): CollectionResource[];
33
+ }
@@ -1,23 +1,26 @@
1
- import { QueryParserFactory } from "../factories";
2
- import { ItemEntry } from "../models";
3
- import { QueryService } from './QueryService';
4
- export declare class CollectionEntryService {
5
- private queryParserFactory;
6
- private queryService;
7
- constructor(queryParserFactory: QueryParserFactory, queryService: QueryService);
8
- processOptions(options: any): any;
9
- createQuery(options: any): {
10
- object: any;
11
- string: any;
12
- };
13
- getIdArray(itemEntries: ItemEntry[], accumulator: any): number[];
14
- /**
15
- * @param {ItemEntry[]} itemEntries
16
- * @param {(itemEntry: ItemEntry) => boolean} callback
17
- * @returns {ItemEntry[]}
18
- *
19
- * filter an array according to the callback function. Return the entries that failed the condition
20
- * Replace the given array with the entries that didn't fail the condition.
21
- */
22
- filterArray(itemEntries: ItemEntry[], callback: (itemEntry: ItemEntry) => boolean): ItemEntry[];
23
- }
1
+ import { QueryService } from '../classes';
2
+ import { QueryParserFactory } from '../factories';
3
+ import { ItemEntry } from '../models';
4
+ import { ItemId } from '../types';
5
+ export declare class CollectionEntryService {
6
+ private queryParserFactory;
7
+ private queryService;
8
+ constructor(queryParserFactory: QueryParserFactory, queryService: QueryService);
9
+ cloneOptions(options: any, parent: any): any;
10
+ cloneQueryParams(parameters: any): {};
11
+ processOptions(options: any): any;
12
+ createQuery(options: any): {
13
+ object: any;
14
+ string: any;
15
+ };
16
+ getIdArray(itemEntries: ItemEntry[], accumulator: any): ItemId[];
17
+ /**
18
+ * @param {ItemEntry[]} itemEntries
19
+ * @param {(itemEntry: ItemEntry) => boolean} callback
20
+ * @returns {ItemEntry[]}
21
+ *
22
+ * filter an array according to the callback function. Return the entries that failed the condition
23
+ * Replace the given array with the entries that didn't fail the condition.
24
+ */
25
+ filterArray(itemEntries: ItemEntry[], callback: (itemEntry: ItemEntry) => boolean): ItemEntry[];
26
+ }