@rentman/rm-core 1.0.20 → 1.0.22

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 (33) hide show
  1. package/dist/definitions/src/classes/ApiRequestService.d.ts +10 -9
  2. package/dist/definitions/src/classes/ApiResponseProcessor.d.ts +4 -3
  3. package/dist/definitions/src/classes/BatchStatus.d.ts +11 -8
  4. package/dist/definitions/src/classes/CollectionCache.d.ts +14 -12
  5. package/dist/definitions/src/classes/CollectionEntryService.d.ts +10 -2
  6. package/dist/definitions/src/classes/CollectionHandler.d.ts +15 -23
  7. package/dist/definitions/src/classes/ColumnHandler.d.ts +3 -3
  8. package/dist/definitions/src/classes/ColumnUtil.d.ts +1 -0
  9. package/dist/definitions/src/classes/ItemAdministrator.d.ts +46 -20
  10. package/dist/definitions/src/classes/ItemCache.d.ts +1 -1
  11. package/dist/definitions/src/classes/ItemEntryService.d.ts +4 -3
  12. package/dist/definitions/src/classes/ItemHandler.d.ts +41 -22
  13. package/dist/definitions/src/classes/ItemRequestService.d.ts +5 -4
  14. package/dist/definitions/src/classes/ItemResourceService.d.ts +3 -4
  15. package/dist/definitions/src/classes/ModuleChangesCompiler.d.ts +5 -1
  16. package/dist/definitions/src/classes/QueryParser.d.ts +1 -1
  17. package/dist/definitions/src/classes/ResourceCache.d.ts +2 -2
  18. package/dist/definitions/src/classes/SocketMessageHandler.d.ts +1 -5
  19. package/dist/definitions/src/classes/Util.d.ts +1 -1
  20. package/dist/definitions/src/constants.d.ts +8 -8
  21. package/dist/definitions/src/factories/CollectionResourceFactory.d.ts +3 -1
  22. package/dist/definitions/src/factories/QueryParserFactory.d.ts +1 -1
  23. package/dist/definitions/src/index.d.ts +2 -2
  24. package/dist/definitions/src/interfaces/ApiRequestServiceInterface.d.ts +8 -8
  25. package/dist/definitions/src/models/CollectionEntry.d.ts +7 -6
  26. package/dist/definitions/src/models/CollectionResource.d.ts +19 -11
  27. package/dist/definitions/src/models/EditResource.d.ts +0 -1
  28. package/dist/definitions/src/models/ViewResource.d.ts +0 -1
  29. package/dist/definitions/src/types/ItemTypesCollection.d.ts +52 -0
  30. package/dist/rm-core.js +185 -75
  31. package/package.json +1 -1
  32. package/readme.md +2 -2
  33. package/dist/definitions/src/models/Column.d.ts +0 -2
@@ -1,16 +1,17 @@
1
1
  import ApiResponseProcessorFactory from '../factories/ApiResponseProcessorFactory';
2
2
  import ApiRequestServiceInterface from '../interfaces/ApiRequestServiceInterface';
3
+ import ApiResponseProcessor from './ApiResponseProcessor';
3
4
  export default class ApiRequestService {
4
5
  private externalApiRequestService;
5
6
  private apiResponseProcessorFactory;
6
7
  constructor(externalApiRequestService: ApiRequestServiceInterface, apiResponseProcessorFactory: ApiResponseProcessorFactory);
7
- template(itemType: string, params: any): Promise<any>;
8
- create(itemType: string, itemId: number, values: any, parentType?: string, parentId?: number): Promise<any>;
9
- delete(itemType: string, itemIds: number[]): Promise<any>;
10
- updateItems(itemType: string, items: object, columns: any): Promise<any>;
11
- requestSkeleton(params: any, requestCanceler?: Promise<any>): Promise<any>;
12
- moveItems(parentType: string, parentId: number, items: object): Promise<any>;
13
- columns(itemType: string, columns: object, params?: any): Promise<any>;
14
- query(itemType: string, query: object, columns: object, allLinks?: boolean, limit?: object): Promise<any>;
15
- processResponse(request: any): any;
8
+ template(itemType: string, params: any): PromiseLike<ApiResponseProcessor>;
9
+ create(itemType: string, itemId: number, values: any, parentType?: string, parentId?: number): PromiseLike<ApiResponseProcessor>;
10
+ delete(itemType: string, itemIds: number[]): PromiseLike<ApiResponseProcessor>;
11
+ updateItems(itemType: string, items: object, columns: any): PromiseLike<ApiResponseProcessor>;
12
+ requestSkeleton(params: any, requestCanceler?: PromiseLike<any>): PromiseLike<ApiResponseProcessor>;
13
+ moveItems(parentType: string, parentId: number, items: object): PromiseLike<ApiResponseProcessor>;
14
+ columns(itemType: string, columns: object, params?: any): PromiseLike<ApiResponseProcessor>;
15
+ query(itemType: string, query: object, columns: object, allLinks?: boolean, limit?: object): PromiseLike<ApiResponseProcessor>;
16
+ processResponse(request: any): PromiseLike<ApiResponseProcessor>;
16
17
  }
@@ -1,10 +1,11 @@
1
1
  import ApiFormatter from './ApiFormatter';
2
+ import { ItemTypeMap } from '../types/ItemTypesCollection';
2
3
  export default class ApiResponseProcessor {
3
4
  apiFormatter: ApiFormatter;
4
5
  response: any;
5
- columns: any[];
6
- items: any[];
7
- links: any[];
6
+ columns: ItemTypeMap;
7
+ items: ItemTypeMap;
8
+ links: ItemTypeMap;
8
9
  cacheable: boolean;
9
10
  map: any;
10
11
  columnIndexMap: any;
@@ -1,16 +1,19 @@
1
+ import { ENTRY_STATUS } from "../constants";
1
2
  import ItemEntry from "../models/ItemEntry";
2
3
  import PromiseService from "./PromiseService";
4
+ import { EntryStatus } from '../types/ItemTypesCollection';
5
+ import { ItemEntryEntryStatusMap } from '../types/ItemTypesCollection';
3
6
  export default class BatchStatus {
4
7
  private promiseService;
5
8
  getItemId: (itemEntry: ItemEntry) => number;
6
- getPromise: (itemEntry: ItemEntry) => Promise<any>;
7
- entries: {};
8
- constructor(promiseService: PromiseService, getItemId: (itemEntry: ItemEntry) => number, getPromise: (itemEntry: ItemEntry) => Promise<any>);
9
- add(entryStatus: any): void;
10
- hasEntries(statusArray: any): boolean;
9
+ getPromise: (itemEntry: ItemEntry) => Promise<ItemEntry>;
10
+ entries: ItemEntryEntryStatusMap;
11
+ constructor(promiseService: PromiseService, getItemId: (itemEntry: ItemEntry) => number, getPromise: (itemEntry: ItemEntry) => Promise<ItemEntry>);
12
+ add(entryStatus: EntryStatus<ItemEntry>): void;
13
+ hasEntries(statusArray: ENTRY_STATUS[]): boolean;
11
14
  hasRequests(): boolean;
12
- forEachEntry(statusArray: any[], callback: any): void;
13
- getPromises(): any;
15
+ forEachEntry(statusArray: ENTRY_STATUS[], callback: (itemEntry: ItemEntry) => void): void;
16
+ getPromises(): PromiseLike<ItemEntry[]>;
14
17
  getRequestIds(): number[];
15
- getArray(): any[];
18
+ getArray(): ItemEntry[];
16
19
  }
@@ -1,26 +1,28 @@
1
1
  import QueryMatcherFactory from "../factories/QueryMatcherFactory";
2
2
  import CollectionEntry from "../models/CollectionEntry";
3
+ import CollectionResource from '../models/CollectionResource';
4
+ import { CollectionEntryItemTypeMap } from '../types/ItemTypesCollection';
3
5
  export default class CollectionCache {
4
6
  private queryMatcherFactory;
5
- entries: {};
7
+ entries: CollectionEntryItemTypeMap;
6
8
  constructor(queryMatcherFactory: QueryMatcherFactory);
7
- contains(collectionEntry: any): boolean;
8
- some(callback: any): boolean;
9
- forEach(callback: any): void;
10
- toArray(): any[];
9
+ contains(collectionEntry: CollectionEntry): boolean;
10
+ some(callback: (entry: CollectionEntry) => void): boolean;
11
+ forEach(callback: (entry: CollectionEntry) => void): void;
12
+ toArray(): CollectionEntry[];
11
13
  add(collectionEntry: CollectionEntry): CollectionEntry;
12
14
  clear(collectionEntry?: CollectionEntry): boolean;
13
- getByItemType(itemType: any): any;
14
- getByParent(parentType: any, parentId: any, itemType: any): any;
15
- getResourceByParent(parentType: any, parentId: any, itemType: any): any;
16
- getCollectionsByParent(parentType: any, parentId: any): any[];
15
+ getByItemType(itemType: string): CollectionEntry[];
16
+ getByParent(parentType: any, parentId: any, itemType: any): CollectionEntry | null;
17
+ getResourceByParent(parentType: any, parentId: any, itemType: any): CollectionResource;
18
+ getCollectionsByParent(parentType: any, parentId: any): CollectionEntry[];
17
19
  /**
18
20
  * Only resources
19
21
  * @param {String} itemType
20
22
  * @param {String|Integer} itemId
21
23
  * @returns {Object} Array of collections.
22
24
  */
23
- getByContainingItem(itemType: any, itemId: any): any[];
25
+ getByContainingItem(itemType: any, itemId: any): CollectionEntry[];
24
26
  /**
25
27
  * Returns an array of collections the item 'belongs' in.
26
28
  * @param {String} parentType
@@ -33,7 +35,7 @@ export default class CollectionCache {
33
35
  notfitting: any[];
34
36
  maybe: any[];
35
37
  };
36
- getByQuery(itemType: any, query: any): any;
37
- getByKey(itemType: any, entryKey: any): any[];
38
+ getByQuery(itemType: any, query: any): CollectionEntry;
39
+ getByKey(itemType: any, entryKey: any): CollectionEntry[];
38
40
  getResourceByKey(itemType: any, resourceKey: any): any[];
39
41
  }
@@ -10,6 +10,14 @@ export default class CollectionEntryService {
10
10
  object: any;
11
11
  string: any;
12
12
  };
13
- getIdArray(itemEntries: ItemEntry[], accumulator: any): any;
14
- filterArray(itemEntries: ItemEntry[], callback: any): any[];
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[];
15
23
  }
@@ -18,6 +18,7 @@ import ItemRequestService from "./ItemRequestService";
18
18
  import KeyService from "./KeyService";
19
19
  import PromiseService from "./PromiseService";
20
20
  import QueryService from "./QueryService";
21
+ import { CollectionEntryBatchStatusMap, CollectionEntryParentIdMap, EntryStatus, ItemResourceItemIdMap } from '../types/ItemTypesCollection';
21
22
  export default class CollectionHandler {
22
23
  private errorHandler;
23
24
  private itemRequestService;
@@ -35,37 +36,28 @@ export default class CollectionHandler {
35
36
  private columnUtil;
36
37
  entries: CollectionCache;
37
38
  constructor(errorHandler: ErrorHandlerInterface, itemRequestService: ItemRequestService, itemHandler: ItemHandler, columnHandler: ColumnHandler, collectionEntryFactory: CollectionEntryFactory, collectionCacheFactory: CollectionCacheFactory, queryParserFactory: QueryParserFactory, collectionEntryService: CollectionEntryService, columnSetFactory: ColumnSetFactory, itemEntryService: ItemEntryService, keyService: KeyService, promiseService: PromiseService, queryService: QueryService, columnUtil: ColumnUtil);
38
- getPromises(statusResource: any): any[];
39
+ getPromises(statusResource: CollectionEntryBatchStatusMap): any[];
39
40
  getRequestIds(statusResource: any): any[];
40
41
  removeFromAndAddToCollections(collectionMap: any, updateInitial?: any): void;
41
42
  removeFromCollections(collectionMap: any, updateInitial?: any, resultResource?: CollectionResource | null): any;
42
43
  /**
43
44
  * @deprecated
44
45
  */
45
- addItemsToCollections(itemEntries: ItemEntry[]): any;
46
- addToCollections(collectionMap: any, updateInitial: boolean, resultResource?: ItemResource | null): any;
47
- batchExpand(parentType: string, itemType: string, collections: CollectionResource[], newColumns: any): any;
48
- batchExtend(parentType: string, itemType: string, options: any, queryCallback: any, collections: CollectionResource[], returnAllItems?: boolean): {};
49
- batchFetch(parentType: string, parentIdArray: number[], itemType: string, options: any, deferredCollectionCache: CollectionCache): any;
46
+ addItemsToCollections(itemEntries: ItemEntry[]): ItemResource[];
47
+ addToCollections(collectionMap: any, updateInitial: boolean, resultResource?: ItemResource | null): ItemResource[];
48
+ batchExpand(parentType: string, itemType: string, collections: CollectionResource[], newColumns: any): PromiseLike<CollectionResource[]>;
49
+ batchExtend(parentType: string, itemType: string, options: any, queryCallback: any, collections: CollectionResource[], returnAllItems?: boolean): PromiseLike<ItemResourceItemIdMap>;
50
+ batchFetch(parentType: string, parentIdArray: number[], itemType: string, options: any, deferredCollectionCache: CollectionCache): PromiseLike<CollectionEntryParentIdMap>;
50
51
  clone(collectionEntry: CollectionEntry, options: any, conversionMap?: {}): CollectionEntry;
51
52
  create(itemType: string, options: any, columns: any, items: ItemEntry[]): CollectionEntry;
52
53
  createCollectionMap(itemEntries: ItemEntry[]): {};
53
- createStatusResource(parentType: string, parentIdArray: number[], itemType: string, options: any, deferredCollectionCache: CollectionCache): {};
54
+ createStatusResource(parentType: string, parentIdArray: number[], itemType: string, options: any, deferredCollectionCache: CollectionCache): CollectionEntryBatchStatusMap;
54
55
  expandCollectionMap(itemEntry: ItemEntry, accumulator: any, collectionCache?: CollectionCache): void;
55
- fetch(itemType: string, options: any, itemCache: ItemCache, deferredCollectionCache: CollectionCache): any;
56
- getDeferredEntryStatus(collectionEntry: CollectionEntry, options: any): {
57
- entry: CollectionEntry;
58
- status: string;
59
- };
60
- getEntryStatus(itemType: string, options: any, deferredEntries: CollectionCache): {
61
- entry: any;
62
- status: string;
63
- };
64
- getNewEntryStatus(itemType: string, query: any, options: any, deferredEntries: CollectionCache): {
65
- entry: any;
66
- status: string;
67
- };
68
- handleBatchResponse(statusResource: any, itemEntryResource: any): {};
56
+ fetch(itemType: string, options: any, itemCache: ItemCache, deferredCollectionCache: CollectionCache): PromiseLike<CollectionEntry>;
57
+ getDeferredEntryStatus(collectionEntry: CollectionEntry, options: any): EntryStatus<CollectionEntry>;
58
+ getEntryStatus(itemType: string, options: any, deferredEntries: CollectionCache): EntryStatus<CollectionEntry>;
59
+ getNewEntryStatus(itemType: string, query: any, options: any, deferredEntries: CollectionCache): EntryStatus<CollectionEntry>;
60
+ handleBatchResponse(statusResource: any, itemEntryResource: any): CollectionEntryParentIdMap;
69
61
  /**
70
62
  * @deprecated
71
63
  */
@@ -74,6 +66,6 @@ export default class CollectionHandler {
74
66
  * @deprecated
75
67
  */
76
68
  removeItemsFromCollections(itemEntries: ItemEntry[]): any;
77
- resolveLocal(collectionEntry: CollectionEntry, itemCache: any): Promise<any>;
78
- resolveRemote(collectionEntry: any, itemCache: any): Promise<any>;
69
+ resolveLocal(collectionEntry: CollectionEntry, itemCache: any): PromiseLike<CollectionEntry>;
70
+ resolveRemote(collectionEntry: any, itemCache: any): PromiseLike<CollectionEntry>;
79
71
  }
@@ -13,7 +13,7 @@ export default class ColumnHandler {
13
13
  setColumn(itemType: any, responseColumn: any): any;
14
14
  setColumns(itemType: any, requestColumns: any, responseColumns: any): {};
15
15
  fetchItemTypeTranslations(itemTypes: any): Promise<any>;
16
- request(itemType: any, columns: any, params?: {}): Promise<any>;
17
- fetch(itemType: any, requestColumns: any, params?: {}): Promise<any>;
18
- fetchAll(itemType: any): Promise<any>;
16
+ request(itemType: any, columns: any, params?: {}): PromiseLike<any>;
17
+ fetch(itemType: any, requestColumns: any, params?: {}): PromiseLike<any>;
18
+ fetchAll(itemType: any): PromiseLike<any>;
19
19
  }
@@ -11,6 +11,7 @@ export default class ColumnUtil {
11
11
  'D': string;
12
12
  'd': string;
13
13
  };
14
+ isStringColumn(column: any): boolean;
14
15
  isFloatColumn(column: any): boolean;
15
16
  isIntColumn(column: any): boolean;
16
17
  isNumberColumn(column: any): boolean;
@@ -18,6 +18,8 @@ import ItemRequestService from "./ItemRequestService";
18
18
  import KeyService from "./KeyService";
19
19
  import QueryService from "./QueryService";
20
20
  import ResourceCache from "./ResourceCache";
21
+ import ItemEntry from '../models/ItemEntry';
22
+ import { CollectionEntryParentIdMap, CollectionResourceParentIdMap, ItemResourceItemTypeMap, TemplateResponseItemEntryMap } from '../types/ItemTypesCollection';
21
23
  export default class ItemAdministrator {
22
24
  private apiRequestService;
23
25
  private resourceCacheInterface;
@@ -41,11 +43,31 @@ export default class ItemAdministrator {
41
43
  itemId: any;
42
44
  };
43
45
  createCollectionMap(itemEntries: any[], addToTab: boolean): {};
44
- getItemById(itemType: string, itemId: number, options: any): any;
45
- getItemsById(itemType: string, itemIds: number[], options: any): any;
46
- getItemsByQuery(itemType: string, query: any, options: any): Promise<any>;
47
- getDuplicateById(itemType: string, duplicateId: number, options: any): any;
48
- getNewResource(itemType: string, options: any, returnLinks: boolean, isRoot: boolean): any;
46
+ /**
47
+ *
48
+ * @param {string} itemType
49
+ * @param {number} itemId
50
+ * @param options
51
+ * @returns {PromiseLike<ItemResource>}
52
+ *
53
+ * I expect not a template request from itemhandler.fetchItem because addSingleItem does not handle the
54
+ * TemplateResponseItemEntryMap
55
+ */
56
+ getItemById(itemType: string, itemId: number, options: any): PromiseLike<ItemResource>;
57
+ getItemsById(itemType: string, itemIds: number[], options: any): PromiseLike<ItemResource[]>;
58
+ getItemsByQuery(itemType: string, query: any, options: any): PromiseLike<ItemResource[]>;
59
+ getDuplicateById(itemType: string, duplicateId: number, options: any): PromiseLike<any>;
60
+ /**
61
+ * The return value is depended on the return links boolean. true returns the TemplateResponseItemEntryMap.
62
+ * The type has to be asserted at use since you only know the type of the return value when the function is called
63
+ *
64
+ * @param {string} itemType
65
+ * @param options
66
+ * @param {boolean} returnLinks
67
+ * @param {boolean} isRoot
68
+ * @returns {PromiseLike<ItemResource> | PromiseLike<TemplateResponseItemEntryMap>}
69
+ */
70
+ getNewResource(itemType: string, options: any, returnLinks: boolean, isRoot: boolean): PromiseLike<ItemResource> | PromiseLike<TemplateResponseItemEntryMap>;
49
71
  getCollectionDef(itemType: string, options: any): {
50
72
  itemType: string;
51
73
  options: {
@@ -64,14 +86,14 @@ export default class ItemAdministrator {
64
86
  };
65
87
  };
66
88
  /** @deprecated */
67
- getCollection(itemType: string, query: any, options: any): any;
68
- _getCollection(itemType: string, options: any): any;
69
- getCollectionFromDef(definition: any): any;
70
- getLinkCollection(linkType: string, linkId: number, itemType: string, options: any): any;
71
- getLinkCollections(linkType: string, linkIdArray: number[], itemType: string, options: any): any;
72
- getLinkCollectionsFromDef(definition: any): any;
73
- getAllLinkCollections(linkType: string, itemType: string, options: any): Promise<any>;
74
- getItemByDef(definition: any, isRoot: boolean): any;
89
+ getCollection(itemType: string, query: any, options: any): PromiseLike<any>;
90
+ _getCollection(itemType: string, options: any): PromiseLike<CollectionResource>;
91
+ getCollectionFromDef(definition: any): PromiseLike<CollectionResource>;
92
+ getLinkCollection(linkType: string, linkId: number, itemType: string, options: any): PromiseLike<CollectionResource>;
93
+ getLinkCollections(linkType: string, linkIdArray: number[], itemType: string, options: any): PromiseLike<CollectionResourceParentIdMap>;
94
+ getLinkCollectionsFromDef(definition: any): PromiseLike<CollectionResourceParentIdMap>;
95
+ getAllLinkCollections(linkType: string, itemType: string, options: any): PromiseLike<CollectionEntryParentIdMap>;
96
+ getItemByDef(definition: any, isRoot: boolean): PromiseLike<any>;
75
97
  cloneItem(newItemId: number, itemResource: any, options: any): ItemResource;
76
98
  cloneCollection(collectionResource: any, options: any, conversionMap: any): CollectionResource;
77
99
  /**
@@ -81,12 +103,16 @@ export default class ItemAdministrator {
81
103
  saveCurrentResourceCache(closeTab: boolean, parameters: any, breakupByParent: boolean, onAfterCreateCallback: any, keepTabHeading?: boolean): any;
82
104
  getCurrentCollections(): CollectionCache;
83
105
  getCurrentItems(): ItemCache;
84
- getCurrentChanges(): void;
85
- addSingleItem(itemEntry: any, options: any, isRoot?: boolean): ItemResource;
86
- addSingleItems(itemEntries: any[], options: any): any[];
106
+ getCurrentChanges(): {
107
+ itemType: string;
108
+ itemId: number;
109
+ items: any;
110
+ };
111
+ addSingleItem(itemEntry: ItemEntry, options: any, isRoot?: boolean): ItemResource;
112
+ addSingleItems(itemEntries: ItemEntry[], options: any): ItemResource[];
87
113
  addCollection(collectionEntry: any, resourceOptions: any, processOptions?: any): CollectionResource;
88
- addCollections(collectionEntries: any[], resourceOptions: any): {};
89
- processLinkedItems(linkedEntries: any[], options: any, addToCollections: boolean): {};
114
+ addCollections(collectionEntries: CollectionEntryParentIdMap, resourceOptions: any): CollectionResourceParentIdMap;
115
+ processLinkedItems(linkedEntries: any[], options: any, addToCollections: boolean): ItemResourceItemTypeMap;
90
116
  /**
91
117
  * @deprecated
92
118
  */
@@ -97,12 +123,12 @@ export default class ItemAdministrator {
97
123
  */
98
124
  resetTabEntry(): void;
99
125
  resetResourceCache(): void;
100
- addToCollections(itemEntries: any[], resultCollectionResource: any): any;
126
+ addToCollections(itemEntries: any[], resultCollectionResource: any): ItemResource[];
101
127
  removeFromCollections(itemEntries: any[], resultCollectionResource: any): any;
102
128
  updateItemIdMap(collectionMap: any, conversionMap: any): void;
103
129
  createCollectionResource(collectionEntry: any, resourceOptions: any, processOptions?: any): CollectionResource;
104
130
  createItemResource(itemEntry: any, options: any, isRoot: boolean): ItemResource;
105
- createItemResources(itemEntries: any[], options: any): any[];
131
+ createItemResources(itemEntries: any[], options: any): ItemResource[];
106
132
  /**
107
133
  * @deprecated
108
134
  */
@@ -6,7 +6,7 @@ export default class ItemCache {
6
6
  private itemEntryService;
7
7
  entries: {};
8
8
  constructor(queryMatcherFactory: QueryMatcherFactory, itemEntryService: ItemEntryService);
9
- some(callback: any): boolean;
9
+ some(callback: (itemEntry) => boolean): boolean;
10
10
  getByItemType(itemType: any): any[];
11
11
  getByQuery(itemType: any, query: any): any[];
12
12
  getLocalByQuery(itemType: any, query: any): any[];
@@ -1,6 +1,7 @@
1
1
  import ApiFormatter from './ApiFormatter';
2
2
  import KeyService from './KeyService';
3
3
  import PromiseService from "./PromiseService";
4
+ import ItemEntry from '../models/ItemEntry';
4
5
  export default class ItemEntryService {
5
6
  private apiFormatter;
6
7
  private keyService;
@@ -9,9 +10,9 @@ export default class ItemEntryService {
9
10
  ALL_PERMISSIONS: number;
10
11
  constructor(apiFormatter: ApiFormatter, keyService: KeyService, promiseService: PromiseService);
11
12
  resetDerived(itemEntry: any, columnIds: any): void;
12
- defer(itemEntry: any, deferRequest: any): any;
13
- resolve(itemEntry: any): any;
14
- reject(itemEntry: any, error?: string): any;
13
+ defer(itemEntry: ItemEntry, deferRequest: any): ItemEntry;
14
+ resolve(itemEntry: any): ItemEntry;
15
+ reject(itemEntry: any, error?: string): ItemEntry;
15
16
  clearResources(itemEntry: any): void;
16
17
  deactivateResources(itemEntry: any): void;
17
18
  getFields(itemEntry: any): any;
@@ -1,3 +1,4 @@
1
+ import { ENTRY_STATUS } from "../constants";
1
2
  import BatchStatusFactory from "../factories/BatchStatusFactory";
2
3
  import ColumnExpansionFactory from "../factories/ColumnExpansionFactory";
3
4
  import ColumnSetFactory from "../factories/ColumnSetFactory";
@@ -14,6 +15,9 @@ import ItemCache from "./ItemCache";
14
15
  import ItemEntryService from "./ItemEntryService";
15
16
  import KeyService from "./KeyService";
16
17
  import PromiseService from "./PromiseService";
18
+ import BatchStatus from './BatchStatus';
19
+ import ApiResponseProcessor from './ApiResponseProcessor';
20
+ import { ApiTemplateItemTypeMap, EntryStatus, TemplateResponseItemEntryMap, TemplateResponseLinkedItemEntryMap } from '../types/ItemTypesCollection';
17
21
  export default class ItemHandler {
18
22
  private apiRequestService;
19
23
  private authInterface;
@@ -30,41 +34,56 @@ export default class ItemHandler {
30
34
  private promiseService;
31
35
  private columnUtil;
32
36
  entries: ItemCache;
33
- templates: {};
37
+ templates: ApiTemplateItemTypeMap;
34
38
  constructor(apiRequestService: ApiRequestServiceInterface, authInterface: AuthInterface, errorHandler: ErrorHandlerInterface, itemEntryFactory: ItemEntryFactory, columnHandler: ColumnHandler, itemCacheFactory: ItemCacheFactory, batchStatusFactory: BatchStatusFactory, columnExpansionFactory: ColumnExpansionFactory, columnSetFactory: ColumnSetFactory, itemEntryService: ItemEntryService, apiFormatter: ApiFormatter, keyService: KeyService, promiseService: PromiseService, columnUtil: ColumnUtil);
35
39
  getItemId(itemEntry: ItemEntry): number;
36
40
  getPromise(itemEntry: ItemEntry): any;
37
- fetchItem(itemType: string, itemId: number, options: any): any;
38
- fetchItems(itemType: any, itemIds: any, options: any): any;
39
- resolveCached(itemEntry: ItemEntry, status: any, options: any): any;
40
- resolveLocal(itemEntry: ItemEntry, parent: any, template: any): {
41
- main: ItemEntry;
42
- linked: any[];
43
- };
44
- resolveExpansion(itemEntry: any, columnExpansion: any, response: any): any;
45
- resolveRemote(itemEntry: any, columnInfo: any, response: any): any;
41
+ fetchItem(itemType: string, itemId: number, options: any): PromiseLike<ItemEntry | TemplateResponseItemEntryMap>;
42
+ /**
43
+ *
44
+ * @param itemType
45
+ * @param itemIds
46
+ * @param options
47
+ * @returns {PromiseLike<ItemEntry[]>}
48
+ *
49
+ * For every itemid find the status of the ItemEntry and resolve the promises so the result is
50
+ * a usable ItemEntry
51
+ */
52
+ fetchItems(itemType: any, itemIds: any, options: any): PromiseLike<ItemEntry[]>;
53
+ resolveCached(itemEntry: ItemEntry, status: ENTRY_STATUS, options: any): PromiseLike<ItemEntry>;
54
+ resolveLocal(itemEntry: ItemEntry, parent: any, template: any): TemplateResponseItemEntryMap;
55
+ resolveExpansion(itemEntry: any, columnExpansion: any, response: any): ItemEntry;
56
+ resolveRemote(itemEntry: any, columnInfo: any, response: any): ItemEntry;
46
57
  fetchTemplate(itemType: string, templateOptions?: any, templateColumns?: any): Promise<any>;
47
- getEntryStatus(itemType: string, itemId: number, options: any): {
48
- entry: any;
49
- status: string;
50
- };
51
- getCachedEntryStatus(itemEntry: ItemEntry, options: any): string;
52
- createDeferredEntry(itemType: string, itemId: number, requestColumns: any, deferRequest: any): any;
58
+ getEntryStatus(itemType: string, itemId: number, options: any): EntryStatus<ItemEntry>;
59
+ getCachedEntryStatus(itemEntry: ItemEntry, options: any): ENTRY_STATUS;
60
+ createDeferredEntry(itemType: string, itemId: number, requestColumns: any, deferRequest: any): ItemEntry;
53
61
  createEntryStub(itemType: string, itemId: number): ItemEntry;
54
- createEntry(itemId: number, initial: any, derived: any, columnInfo: any): any;
55
- resolveDeferredEntry(itemEntry: any, initial: any, derived: any, columns: any): any;
56
- batchResolve(itemType: any, batchStatus: any, requestColumns: any, resolved: any): any;
62
+ createEntry(itemId: number, initial: any, derived: any, columnInfo: any): ItemEntry;
63
+ resolveDeferredEntry(itemEntry: any, initial: any, derived: any, columns: any): ItemEntry;
64
+ /**
65
+ *
66
+ * @param itemType
67
+ * @param {BatchStatus} batchStatus
68
+ * @param requestColumns
69
+ * @param resolved
70
+ * @returns {ItemEntry[]}
71
+ *
72
+ * for every type of entry status there is in this batch request make sure the entries get resolved.
73
+ * then return a array of the resulting ItemEntryArray
74
+ */
75
+ batchResolve(itemType: any, batchStatus: BatchStatus, requestColumns: any, resolved: any): ItemEntry[] | PromiseLike<any>;
57
76
  cloneItem(newItemId: any, itemEntry: any, conversionMap?: any): any;
58
77
  createConversionMap(itemType: string, itemId: number, extend: boolean, response: any): {
59
78
  [x: string]: {
60
79
  [x: number]: number;
61
80
  };
62
81
  };
63
- createLocalEntries(parentType: string, localParentId: number, template: any, conversionMap: any): any[];
82
+ createLocalEntries(parentType: string, localParentId: number, template: any, conversionMap: any): TemplateResponseLinkedItemEntryMap[];
64
83
  createLocalEntry(itemId: number, template: any, modified: any, derived: any, parent?: any): ItemEntry;
65
84
  extendConversionMap(conversionMap: any, links: any, apiResponse: any): void;
66
- fetchTitle(itemType: string, itemId: number, deferRequest?: boolean): any;
67
- requestItem(itemType: string, itemId: number | number[], columns: any): Promise<any>;
85
+ fetchTitle(itemType: string, itemId: number, deferRequest?: boolean): PromiseLike<any>;
86
+ requestItem(itemType: string, itemId: number | number[], columns: any): PromiseLike<ApiResponseProcessor>;
68
87
  updateItemId(itemEntry: any, itemId: any): ItemEntry;
69
88
  private setCreator(itemEntry);
70
89
  }
@@ -10,6 +10,7 @@ import ItemEntryService from "./ItemEntryService";
10
10
  import ItemHandler from "./ItemHandler";
11
11
  import PromiseService from "./PromiseService";
12
12
  import QueryService from "./QueryService";
13
+ import ApiResponseProcessor from './ApiResponseProcessor';
13
14
  export default class ItemRequestService {
14
15
  private apiRequestService;
15
16
  private errorHandler;
@@ -21,11 +22,11 @@ export default class ItemRequestService {
21
22
  private queryService;
22
23
  private promiseService;
23
24
  constructor(apiRequestService: ApiRequestServiceInterface, errorHandler: ErrorHandlerInterface, itemHandler: ItemHandler, columnHandler: ColumnHandler, columnExpansionFactory: ColumnExpansionFactory, columnSetFactory: ColumnSetFactory, itemEntryService: ItemEntryService, queryService: QueryService, promiseService: PromiseService);
24
- requestItem(itemType: any, itemId: any, columns: any): Promise<any>;
25
- requestItems(collectionEntry: CollectionEntry, query?: any, columns?: any): Promise<any>;
26
- requestLinkItems(parentType: any, parentIdArray: any, itemType: any, query: any, columns: any): Promise<any>;
25
+ requestItem(itemType: any, itemId: any, columns: any): PromiseLike<ApiResponseProcessor>;
26
+ requestItems(collectionEntry: CollectionEntry, query?: any, columns?: any): PromiseLike<ApiResponseProcessor>;
27
+ requestLinkItems(parentType: any, parentIdArray: any, itemType: any, query: any, columns: any): PromiseLike<ApiResponseProcessor>;
27
28
  processExpansion(requestColumns: any, response: any, itemType: string, itemEntries: ItemEntry[]): ColumnExpansion;
28
- processResponse(response: any, idArray: any, parent: any, columnInfo: any, columnExpansion?: any): Promise<ItemEntry[]>;
29
+ processResponse(response: any, idArray: any, parent: any, columnInfo: any, columnExpansion?: any): PromiseLike<ItemEntry[]>;
29
30
  handleCachedItem(itemEntry: any, response: any, columnExpansion: ColumnExpansion): any;
30
31
  processLinkResponse(response: any, parentType: any, parentIdArray: any, itemType: any, options: any): any;
31
32
  }
@@ -1,8 +1,7 @@
1
- import ItemEntryService from "./ItemEntryService";
1
+ import { EditResource } from '../models/EditResource';
2
2
  export default class ItemResourceService {
3
- private itemEntryService;
4
- constructor(itemEntryService: ItemEntryService);
3
+ constructor();
5
4
  processOptions(options: any): any;
6
5
  compareOptions(first: any, second: any): boolean;
7
- isNew(resource: any): boolean;
6
+ isNewResource(resource: EditResource): boolean;
8
7
  }
@@ -10,7 +10,11 @@ export default class ModuleChangesCompiler {
10
10
  parentMap: any;
11
11
  destination: any;
12
12
  constructor(itemEntryService: ItemEntryService, rootItemEntry: ItemEntry, singleItemCache: ItemCache, collectionCache: CollectionCache);
13
- process(): void;
13
+ process(): {
14
+ itemType: string;
15
+ itemId: number;
16
+ items: any;
17
+ };
14
18
  private createParentMap(itemCache);
15
19
  private processItems(itemType, itemEntries, linkAccumulator);
16
20
  private processItem(itemEntry);
@@ -1,7 +1,7 @@
1
1
  export default class QueryParser {
2
2
  query: any;
3
3
  parameters: any;
4
- constructor(query: any, parameters: any);
4
+ constructor(query: any, parameters?: any);
5
5
  private processValue(value);
6
6
  private compareParsedQueries(a, b);
7
7
  parse(query?: any): any;
@@ -53,9 +53,9 @@ export default class ResourceCache {
53
53
  clearItem(itemResource: ItemResource): void;
54
54
  clearResources(isSubTabChange?: boolean): void;
55
55
  updateSingleItems(conversionMap: any): void;
56
- revertChanges(): void;
56
+ revertChanges(): any;
57
57
  resetCollection(collectionEntry: CollectionEntry): void;
58
- hasChanges(): boolean;
58
+ hasChanges: boolean;
59
59
  detectChanges(): boolean;
60
60
  collectionHasChanges(collectionEntry: CollectionEntry): boolean;
61
61
  isLockable(): boolean;
@@ -3,7 +3,6 @@ import ColumnSetFactory from '../factories/ColumnSetFactory';
3
3
  import RequestColumnExpansionFactory from '../factories/RequestColumnExpansionFactory';
4
4
  import ApiRequestServiceInterface from '../interfaces/ApiRequestServiceInterface';
5
5
  import ErrorHandlerInterface from '../interfaces/ErrorHandlerInterface';
6
- import SocketMessageInterface from '../interfaces/SocketMessageInterface';
7
6
  import ApiFormatter from './ApiFormatter';
8
7
  import CollectionHandler from './CollectionHandler';
9
8
  import ItemEntryService from './ItemEntryService';
@@ -12,7 +11,6 @@ import PromiseService from './PromiseService';
12
11
  export default class SocketMessageHandler {
13
12
  private promiseService;
14
13
  private apiRequestService;
15
- private socketMessageService;
16
14
  private itemHandler;
17
15
  private itemEntryService;
18
16
  private collectionHandler;
@@ -21,9 +19,7 @@ export default class SocketMessageHandler {
21
19
  private requestColumnExpansionFactory;
22
20
  private apiFormatter;
23
21
  private errorHandler;
24
- private deregisterEventListener;
25
- constructor(promiseService: PromiseService, apiRequestService: ApiRequestServiceInterface, socketMessageService: SocketMessageInterface, itemHandler: ItemHandler, itemEntryService: ItemEntryService, collectionHandler: CollectionHandler, columnSetFactory: ColumnSetFactory, columnExpansionFactory: ColumnExpansionFactory, requestColumnExpansionFactory: RequestColumnExpansionFactory, apiFormatter: ApiFormatter, errorHandler: ErrorHandlerInterface);
26
- destroy(): void;
22
+ constructor(promiseService: PromiseService, apiRequestService: ApiRequestServiceInterface, itemHandler: ItemHandler, itemEntryService: ItemEntryService, collectionHandler: CollectionHandler, columnSetFactory: ColumnSetFactory, columnExpansionFactory: ColumnExpansionFactory, requestColumnExpansionFactory: RequestColumnExpansionFactory, apiFormatter: ApiFormatter, errorHandler: ErrorHandlerInterface);
27
23
  onMessageReceived(message: any): void;
28
24
  formatMessageValues(values: any, columns: any): {};
29
25
  createCollectionMap(itemType: any, items: any, columns: any): {};
@@ -22,4 +22,4 @@ export declare function isElement(node: any): boolean;
22
22
  export declare function isWindow(obj: any): boolean;
23
23
  export declare function isDefined(value: any): boolean;
24
24
  export declare function equals(o1: any, o2: any): boolean;
25
- export declare function copy(source: any, destination?: any, maxDepth?: number): any;
25
+ export declare function copy(source: any, destination?: any, maxDepth?: any): any;
@@ -1,10 +1,10 @@
1
- export declare const ENTRY_STATUS: {
2
- CACHED: string;
3
- PROMISED: string;
4
- EXPAND: string;
5
- PROMISED_EXPAND: string;
6
- RESOLVE: string;
7
- LOCAL: string;
8
- };
1
+ export declare enum ENTRY_STATUS {
2
+ CACHED = "cached",
3
+ PROMISED = "promised",
4
+ EXPAND = "expand",
5
+ PROMISED_EXPAND = "promised-expand",
6
+ RESOLVE = "resolve",
7
+ LOCAL = "local",
8
+ }
9
9
  export declare const COLUMN_SEPERATOR = ">";
10
10
  export declare const RENDER_AS_SEPERATOR = ":";
@@ -1,3 +1,4 @@
1
+ import CollectionResourceService from '../classes/CollectionResourceService';
1
2
  import ItemHandler from "../classes/ItemHandler";
2
3
  import KeyService from '../classes/KeyService';
3
4
  import PromiseService from '../classes/PromiseService';
@@ -13,6 +14,7 @@ export default class CollectionResourceFactory {
13
14
  private changesProcessorFactory;
14
15
  private keyService;
15
16
  private promiseService;
16
- constructor(errorHandler: ErrorHandlerInterface, itemHandler: ItemHandler, itemResourceFactory: ItemResourceFactory, changesProcessorFactory: ChangesProcessorFactory, keyService: KeyService, promiseService: PromiseService);
17
+ private collectionResourceService;
18
+ constructor(errorHandler: ErrorHandlerInterface, itemHandler: ItemHandler, itemResourceFactory: ItemResourceFactory, changesProcessorFactory: ChangesProcessorFactory, keyService: KeyService, promiseService: PromiseService, collectionResourceService: CollectionResourceService);
17
19
  construct(collectionEntry: CollectionEntry, options: any): CollectionResource;
18
20
  }
@@ -1,5 +1,5 @@
1
1
  import QueryParser from "../classes/QueryParser";
2
2
  export default class QueryParserFactory {
3
3
  constructor();
4
- construct(query: any, parameters: any): QueryParser;
4
+ construct(query: any, parameters?: any): QueryParser;
5
5
  }