@rentman/rm-core 8.0.2 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +13 -0
- package/dist/rm-core.js +6409 -6003
- package/dist/rm-core.min.js +2 -2
- package/dist/types/classes/ApiFormatter.d.ts +3 -3
- package/dist/types/classes/ChangesDelta.d.ts +8 -2
- package/dist/types/classes/ChangesDeltaBase.d.ts +35 -7
- package/dist/types/classes/ChangesProcessor.d.ts +3 -5
- package/dist/types/classes/CollectionMatcherBase.d.ts +2 -2
- package/dist/types/classes/ConversionMapService.d.ts +1 -1
- package/dist/types/classes/CreatedChangesDelta.d.ts +2 -1
- package/dist/types/classes/InternalChangesDelta.d.ts +12 -1
- package/dist/types/classes/ItemCreateService.d.ts +1 -1
- package/dist/types/classes/ParentChangesDelta.d.ts +47 -0
- package/dist/types/classes/QueryParserIdUpdater.d.ts +9 -9
- package/dist/types/classes/TemplateCache.d.ts +11 -8
- package/dist/types/classes/cache/AbstractCache.d.ts +16 -7
- package/dist/types/classes/cache/ItemHandlerBase.d.ts +4 -6
- package/dist/types/classes/cache/server/ServerCache.d.ts +19 -8
- package/dist/types/classes/cache/server/ServerItemHandler.d.ts +2 -2
- package/dist/types/classes/cache/transaction/TransactionCache.d.ts +14 -13
- package/dist/types/classes/cache/transaction/TransactionCachedQueryHandler.d.ts +2 -1
- package/dist/types/classes/cache/transaction/TransactionCollectionHandler.d.ts +1 -0
- package/dist/types/classes/cache/transaction/TransactionItemHandler.d.ts +6 -7
- package/dist/types/factories/ChangesDeltaFactory.d.ts +8 -6
- package/dist/types/factories/ChangesProcessorFactory.d.ts +2 -5
- package/dist/types/factories/RequestColumnExpansionFactory.d.ts +4 -1
- package/dist/types/factories/TemplateFactory.d.ts +2 -2
- package/dist/types/interfaces/TransactionItemHandlerDependencyInterface.d.ts +2 -1
- package/dist/types/models/Template.d.ts +3 -2
- package/dist/types/types/ItemTypesCollection.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ApiEnumApiType,
|
|
1
|
+
import { ApiEnumApiType, ApiEnumItemType, ApiFields, ResponseColumn } from '@rentman/backend-types';
|
|
2
2
|
import moment from 'moment';
|
|
3
3
|
import { ColumnInfo } from '../classes';
|
|
4
|
-
import { FieldMap } from '../types';
|
|
4
|
+
import { ApiEnumApiTypeToTsTypeMap, FieldMap } from '../types';
|
|
5
5
|
declare type GetChangesResult<ItemTypeType extends ApiEnumItemType = any, ColumnId extends keyof ApiFields[ItemTypeType] = any> = {
|
|
6
6
|
oldValue: FieldMap<ItemTypeType, [ColumnId]>[ColumnId];
|
|
7
7
|
newValue: FieldMap<ItemTypeType, [ColumnId]>[ColumnId];
|
|
@@ -42,7 +42,7 @@ export declare class ApiFormatter {
|
|
|
42
42
|
* @description
|
|
43
43
|
* Compares the given fields, returns `true` when the fields are equal
|
|
44
44
|
*/
|
|
45
|
-
compareFields<ColumnType extends ApiEnumApiType>(columnType: ColumnType, first?:
|
|
45
|
+
compareFields<ColumnType extends ApiEnumApiType>(columnType: ColumnType, first?: ApiEnumApiTypeToTsTypeMap[ColumnType], second?: ApiEnumApiTypeToTsTypeMap[ColumnType]): boolean;
|
|
46
46
|
compareFloats(a: number, b: number): boolean;
|
|
47
47
|
compareMomentObjects(first: moment.Moment, second: moment.Moment): boolean;
|
|
48
48
|
compareDurations(first: moment.Duration, second: moment.Duration): boolean;
|
|
@@ -7,6 +7,7 @@ import { ColumnSet } from './ColumnSet';
|
|
|
7
7
|
import { CreatedChangesDelta } from './CreatedChangesDelta';
|
|
8
8
|
import { ItemCreateService } from './ItemCreateService';
|
|
9
9
|
import { ItemEntryService } from './ItemEntryService';
|
|
10
|
+
export declare type ChangesDeltaItemDeleteDelta = ItemEntry;
|
|
10
11
|
/**
|
|
11
12
|
* @description
|
|
12
13
|
* ChangesDelta used to apply changes from outside of the core to a transaction
|
|
@@ -22,6 +23,9 @@ export declare class ChangesDelta extends ChangesDeltaBase {
|
|
|
22
23
|
private errorHandler;
|
|
23
24
|
private itemCreateService;
|
|
24
25
|
created: CreatedChangesDelta;
|
|
26
|
+
deleted: {
|
|
27
|
+
[itemType: string]: ChangesDeltaItemDeleteDelta[];
|
|
28
|
+
};
|
|
25
29
|
constructor(errorHandler: ErrorHandlerInterface, itemCreateService: ItemCreateService, itemEntryService: ItemEntryService);
|
|
26
30
|
/**
|
|
27
31
|
* @description
|
|
@@ -32,6 +36,8 @@ export declare class ChangesDelta extends ChangesDeltaBase {
|
|
|
32
36
|
* - If you want to set a parent set the proper field, you can't pass it as a separate object
|
|
33
37
|
*/
|
|
34
38
|
setItemCreated<ItemTypeType extends ApiEnumItemType, Fields extends Partial<FieldMap<ItemTypeType>>>(itemType: ItemTypeType, values: Fields): PromiseInterface<this>;
|
|
39
|
+
setItemDeleted(deleted: ChangesDeltaItemDeleteDelta): this;
|
|
40
|
+
setItemsDeleted(deleted: ChangesDeltaItemDeleteDelta[]): this;
|
|
35
41
|
/**
|
|
36
42
|
* @description
|
|
37
43
|
* Fetches a template for the passed itemType and processes the passed values and sets the items to be created when the delta is applied
|
|
@@ -52,11 +58,11 @@ export declare class ChangesDelta extends ChangesDeltaBase {
|
|
|
52
58
|
*
|
|
53
59
|
* @internal
|
|
54
60
|
*/
|
|
55
|
-
_setItemCreated<ItemTypeType extends ApiEnumItemType, Fields extends FieldMap<ItemTypeType>>(itemId: ItemId, fields: Fields, columns: ColumnSet<ItemTypeType>, parent?: EntryParentNull): this;
|
|
61
|
+
_setItemCreated<ItemTypeType extends ApiEnumItemType, Fields extends FieldMap<ItemTypeType>>(itemId: ItemId, fields: Fields, columns: ColumnSet<ItemTypeType>, parent?: EntryParentNull, isRoot?: boolean): this;
|
|
56
62
|
/**
|
|
57
63
|
* @description
|
|
58
64
|
* Convenience function to assign the proper parent fields, will call {@link ChangesDeltaBase.setItemUpdated setItemUpdated} internally
|
|
59
65
|
*/
|
|
60
|
-
setItemMoved(entry: ItemEntry, to: EntryParent): this;
|
|
66
|
+
setItemMoved(entry: ItemEntry, to: EntryParent, updateModified?: boolean, updateInitial?: boolean): this;
|
|
61
67
|
isEmpty(): boolean;
|
|
62
68
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
2
|
import { ItemEntry } from '../models';
|
|
3
3
|
import { ColumnExpansionResult, EntryParentNull, FieldMap, ItemIdConversionMap } from '../types';
|
|
4
|
+
import { TransactionItemEntryChanges } from './cache/transaction/TransactionItemHandler';
|
|
4
5
|
import { ItemEntryService } from './ItemEntryService';
|
|
5
6
|
export declare type ChangesDeltaResult = {
|
|
7
|
+
itemIdConversionMap: ItemIdConversionMap;
|
|
6
8
|
created: ItemEntry[];
|
|
7
9
|
};
|
|
8
10
|
/**
|
|
@@ -16,17 +18,44 @@ export declare type ChangesDeltaItemUpdateDelta<ItemTypeType extends ApiEnumItem
|
|
|
16
18
|
fields: FieldMap<ItemTypeType>;
|
|
17
19
|
parent: EntryParentNull;
|
|
18
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* @description
|
|
23
|
+
* Should be set to `true` when either the changes are made by the user, or when it's the direct result (not derived value) of a create/update API call
|
|
24
|
+
*/
|
|
25
|
+
updateModified: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* @description
|
|
28
|
+
* Should be set to `true` when the changes are a result of an API call
|
|
29
|
+
*/
|
|
30
|
+
updateInitial: boolean;
|
|
19
31
|
};
|
|
20
|
-
export declare type ChangesDeltaItemDeleteDelta = ItemEntry[];
|
|
21
32
|
export declare abstract class ChangesDeltaBase {
|
|
22
33
|
protected itemEntryService: ItemEntryService;
|
|
23
34
|
updated: {
|
|
24
35
|
[itemEntryId: number]: ChangesDeltaItemUpdateDelta;
|
|
25
36
|
};
|
|
26
|
-
deleted: {
|
|
27
|
-
[itemType: string]: ChangesDeltaItemDeleteDelta;
|
|
28
|
-
};
|
|
29
37
|
itemIdConversionMap: ItemIdConversionMap;
|
|
38
|
+
/**
|
|
39
|
+
* Only contains remote items, when rolling back local items the whole entries are deleted.
|
|
40
|
+
*/
|
|
41
|
+
restored: {
|
|
42
|
+
[itemEntryId: number]: {
|
|
43
|
+
entry: ItemEntry;
|
|
44
|
+
changes: TransactionItemEntryChanges;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* @private
|
|
49
|
+
* @warning
|
|
50
|
+
* Do not set in frontend
|
|
51
|
+
*/
|
|
52
|
+
__isUndo: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* @private
|
|
55
|
+
* @warning
|
|
56
|
+
* Do not set in frontend
|
|
57
|
+
*/
|
|
58
|
+
__isRedo: boolean;
|
|
30
59
|
/**
|
|
31
60
|
* @private
|
|
32
61
|
*/
|
|
@@ -44,8 +73,7 @@ export declare abstract class ChangesDeltaBase {
|
|
|
44
73
|
* @private
|
|
45
74
|
*/
|
|
46
75
|
_setQueryResult(itemType: ApiEnumItemType, queryString: string, itemIds: ItemId[]): void;
|
|
47
|
-
setItemUpdated<ItemTypeType extends ApiEnumItemType>(entry: ItemEntry<ItemTypeType>, fields: Partial<FieldMap<ItemTypeType>>, columnExpansionResult?: ColumnExpansionResult<ItemTypeType> | null, parent?: EntryParentNull): this;
|
|
48
|
-
|
|
49
|
-
setItemsDeleted(deleted: ItemEntry[]): this;
|
|
76
|
+
setItemUpdated<ItemTypeType extends ApiEnumItemType>(entry: ItemEntry<ItemTypeType>, fields: Partial<FieldMap<ItemTypeType>>, columnExpansionResult?: ColumnExpansionResult<ItemTypeType> | null, parent?: EntryParentNull, updateModified?: boolean, updateInitial?: boolean): this;
|
|
77
|
+
setItemRestored(itemEntry: ItemEntry, transactionItemEntryChanges: TransactionItemEntryChanges): void;
|
|
50
78
|
isEmpty(): boolean;
|
|
51
79
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ApiRequestService,
|
|
2
|
-
import { ChangesCompilationFactory,
|
|
1
|
+
import { ApiRequestService, ItemEntryService } from '../classes';
|
|
2
|
+
import { ChangesCompilationFactory, CreateRequestFactory, RequestColumnExpansionFactory } from '../factories';
|
|
3
3
|
import { ChangesDeltaFactory } from '../factories/ChangesDeltaFactory';
|
|
4
4
|
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../interfaces';
|
|
5
5
|
import { ItemIdConversionMap, PromiseInterface } from '../types';
|
|
@@ -13,19 +13,17 @@ export declare class ChangesProcessor {
|
|
|
13
13
|
private changesDeltaFactory;
|
|
14
14
|
private apiRequestService;
|
|
15
15
|
private changesCompilationFactory;
|
|
16
|
-
private columnExpansionFactory;
|
|
17
16
|
private createRequestFactory;
|
|
18
17
|
private errorHandler;
|
|
19
18
|
private promiseService;
|
|
20
19
|
private requestColumnExpansionFactory;
|
|
21
|
-
private collectionEntryService;
|
|
22
20
|
private itemEntryService;
|
|
23
21
|
private transaction;
|
|
24
22
|
private breakUpByParent?;
|
|
25
23
|
private onAfterCreateCallback?;
|
|
26
24
|
private itemIdConversionMap;
|
|
27
25
|
private serverCache;
|
|
28
|
-
constructor(changesDeltaFactory: ChangesDeltaFactory, apiRequestService: ApiRequestService, changesCompilationFactory: ChangesCompilationFactory,
|
|
26
|
+
constructor(changesDeltaFactory: ChangesDeltaFactory, apiRequestService: ApiRequestService, changesCompilationFactory: ChangesCompilationFactory, createRequestFactory: CreateRequestFactory, errorHandler: ErrorHandlerInterface, promiseService: PromiseLibraryInterface, requestColumnExpansionFactory: RequestColumnExpansionFactory, itemEntryService: ItemEntryService, transaction: TransactionCache, breakUpByParent?: boolean | undefined, onAfterCreateCallback?: OnAfterCreateCallback | undefined);
|
|
29
27
|
/**
|
|
30
28
|
* @description
|
|
31
29
|
* Executes the requests in the order of:
|
|
@@ -3,7 +3,7 @@ import { AbstractCache, CollectionQuery, FieldMap, QueryService } from '../';
|
|
|
3
3
|
import { QueryMatcherFactory } from '../factories/';
|
|
4
4
|
import { ItemEntry } from '../models';
|
|
5
5
|
import { GroupedCollectionMatcherResult } from './cache/CollectionMatcherCachedQueryProcessor';
|
|
6
|
-
import {
|
|
6
|
+
import { ParentChangesDelta } from './ParentChangesDelta';
|
|
7
7
|
export declare type CollectionMatcherMatches<ItemTypeType extends ApiEnumItemType = any> = {
|
|
8
8
|
[itemId: number]: {
|
|
9
9
|
item: ItemEntry<ItemTypeType>;
|
|
@@ -16,7 +16,7 @@ export declare abstract class CollectionMatcherBase {
|
|
|
16
16
|
protected transaction: AbstractCache;
|
|
17
17
|
protected constructor(queryService: QueryService, queryMatcherFactory: QueryMatcherFactory, transaction: AbstractCache);
|
|
18
18
|
expand<ItemEntryType extends ItemEntry>(itemEntry: ItemEntryType, fields: FieldMap<ItemEntryType['itemType']>): this;
|
|
19
|
-
processDelta(
|
|
19
|
+
processDelta(parentChangesDelta: ParentChangesDelta): this;
|
|
20
20
|
protected groupItemEntries<ItemTypeType extends ApiEnumItemType>(matches: CollectionMatcherMatches<ItemTypeType>): GroupedCollectionMatcherResult<ItemTypeType>;
|
|
21
21
|
protected abstract _expand<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, matchFunction: (itemType: ItemTypeType, parsedQuery: CollectionQuery) => boolean | 'maybe'): this;
|
|
22
22
|
}
|
|
@@ -15,7 +15,7 @@ export declare class ConversionMapService {
|
|
|
15
15
|
constructor(keyService: KeyService);
|
|
16
16
|
createLocalConversionMap(itemType: ApiEnumItemType, itemId: ItemId, doExtend: boolean | undefined, apiResponse: ApiResponse): ItemIdConversionMap;
|
|
17
17
|
expandLocalConversionMap(parentType: ApiEnumItemType, parentId: ItemId, apiResponse: ApiResponse, conversionMap: ItemIdConversionMap): void;
|
|
18
|
-
expandConversionMap(
|
|
18
|
+
expandConversionMap(itemType: ApiEnumItemType, itemId: ItemId, conversionMap: ItemIdConversionMap, newItemId?: ItemId): ItemId;
|
|
19
19
|
batchExpandConversionMap(itemEntries: Array<ItemEntry<any>>, conversionMap: ItemIdConversionMap): ItemIdConversionMap;
|
|
20
20
|
getConversionValue(itemType: ApiEnumItemType, itemId: ItemId, map: ItemIdConversionMap): ItemId | undefined;
|
|
21
21
|
/**
|
|
@@ -5,12 +5,13 @@ export declare type ChangesDeltaItemCreateDelta<ItemTypeType extends ApiEnumItem
|
|
|
5
5
|
itemId: ItemId;
|
|
6
6
|
fields: FieldMap<ItemTypeType>;
|
|
7
7
|
columns: ColumnSet<ItemTypeType>;
|
|
8
|
+
isRoot: boolean;
|
|
8
9
|
};
|
|
9
10
|
export declare class CreatedChangesDelta {
|
|
10
11
|
private tuples;
|
|
11
12
|
constructor();
|
|
12
13
|
remove(itemType: ApiEnumItemType, itemId: ItemId): boolean;
|
|
13
|
-
add<ItemTypeType extends ApiEnumItemType>(itemId: ItemId, fields: FieldMap<ItemTypeType>, columns: ColumnSet<ItemTypeType
|
|
14
|
+
add<ItemTypeType extends ApiEnumItemType>(itemId: ItemId, fields: FieldMap<ItemTypeType>, columns: ColumnSet<ItemTypeType>, isRoot?: boolean): void;
|
|
14
15
|
isEmpty(): boolean;
|
|
15
16
|
forEach(callback: (tuple: ChangesDeltaItemCreateDelta, itemType: ApiEnumItemType, index: number) => void): void;
|
|
16
17
|
contains(itemType: ApiEnumItemType): boolean;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
2
|
import { ItemEntry } from '../models';
|
|
3
3
|
import { EntryParent, FieldMap, ItemIdConversionMap } from '../types';
|
|
4
|
+
import { TransactionItemEntryChanges } from './cache/transaction/TransactionItemHandler';
|
|
4
5
|
import { ChangesDeltaBase } from './ChangesDeltaBase';
|
|
5
6
|
import { ItemEntryService } from './ItemEntryService';
|
|
6
7
|
export declare type InternalCreateDelta<ItemTypeType extends ApiEnumItemType = any> = {
|
|
7
8
|
entry: ItemEntry<ItemTypeType>;
|
|
8
9
|
fields: FieldMap<ItemTypeType>;
|
|
9
10
|
};
|
|
11
|
+
export declare type InternalChangesDeltaItemDeleteDelta = {
|
|
12
|
+
entry: ItemEntry;
|
|
13
|
+
changes: TransactionItemEntryChanges;
|
|
14
|
+
};
|
|
10
15
|
/**
|
|
11
16
|
* @description
|
|
12
17
|
* ChangesDelta used internally by the core
|
|
@@ -16,12 +21,15 @@ export declare type InternalCreateDelta<ItemTypeType extends ApiEnumItemType = a
|
|
|
16
21
|
* The difference between {@link InternalChangesDelta InternalChangesDelta} and {@link ChangesDelta ChangesDelta} is that the InternalChangesDelta
|
|
17
22
|
* assumes 'created' entries are already existing, so it has a different format.
|
|
18
23
|
*
|
|
19
|
-
* Use this when calling {@link TransactionCache.
|
|
24
|
+
* Use this when calling {@link TransactionCache.applyChangesFromChild applyChangesFromChild}
|
|
20
25
|
*/
|
|
21
26
|
export declare class InternalChangesDelta extends ChangesDeltaBase {
|
|
22
27
|
created: {
|
|
23
28
|
[itemEntryId: string]: InternalCreateDelta;
|
|
24
29
|
};
|
|
30
|
+
deleted: {
|
|
31
|
+
[itemType: string]: InternalChangesDeltaItemDeleteDelta[];
|
|
32
|
+
};
|
|
25
33
|
moved: {
|
|
26
34
|
[itemEntryId: number]: {
|
|
27
35
|
entry: ItemEntry;
|
|
@@ -30,6 +38,9 @@ export declare class InternalChangesDelta extends ChangesDeltaBase {
|
|
|
30
38
|
};
|
|
31
39
|
itemIdConversionMap: ItemIdConversionMap;
|
|
32
40
|
constructor(itemEntryService: ItemEntryService);
|
|
41
|
+
setItemDeleted(tuple: InternalChangesDeltaItemDeleteDelta): this;
|
|
42
|
+
setItemsDeleted(deleted: InternalChangesDeltaItemDeleteDelta[]): this;
|
|
43
|
+
private itemIsDeleted;
|
|
33
44
|
setItemCreated<ItemTypeType extends ApiEnumItemType>(itemEntry: ItemEntry<ItemTypeType>, fields: FieldMap<ItemTypeType>): void;
|
|
34
45
|
/**
|
|
35
46
|
* @remark
|
|
@@ -20,6 +20,6 @@ export declare class ItemCreateService {
|
|
|
20
20
|
* Fetches a new {@link Template template} and sets the items created on the passed {@link ChangesDelta}
|
|
21
21
|
*/
|
|
22
22
|
createItemsFromValues<ItemTypeType extends ApiEnumItemType, ColumnIds extends Array<keyof ApiFields[ItemTypeType]> = Array<keyof ApiFields[ItemTypeType]>>(changesDelta: ChangesDelta, itemType: ItemTypeType, valuesArray: Array<Partial<FieldMap<ItemTypeType, ColumnIds>>>, parent?: EntryParentNull): PromiseInterface<void>;
|
|
23
|
-
processTemplate<ItemTypeType extends ApiEnumItemType, ColumnIds extends Array<keyof ApiFields[ItemTypeType]> = Array<keyof ApiFields[ItemTypeType]>>(changesDelta: ChangesDelta, itemType: ItemTypeType, itemId: ItemId, parent: EntryParentNull, template: Template<ItemTypeType, ColumnIds>, filterItemEntryCallback?: FilterItemEntryCallback, modifyFieldsCallback?: ModifyFieldsCallback): void;
|
|
23
|
+
processTemplate<ItemTypeType extends ApiEnumItemType, ColumnIds extends Array<keyof ApiFields[ItemTypeType]> = Array<keyof ApiFields[ItemTypeType]>>(changesDelta: ChangesDelta, itemType: ItemTypeType, itemId: ItemId, parent: EntryParentNull, template: Template<ItemTypeType, ColumnIds>, filterItemEntryCallback?: FilterItemEntryCallback, modifyFieldsCallback?: ModifyFieldsCallback, isRoot?: boolean): void;
|
|
24
24
|
processTemplateLinkItems<ParentItemType extends ApiEnumItemType>(changesDelta: ChangesDelta, parentType: ParentItemType, localParentId: ItemId, template: Template<ParentItemType>, itemIdConversion: ItemIdConversionMap, filterItemEntryCallback?: FilterItemEntryCallback, modifyFieldsCallback?: ModifyFieldsCallback): void;
|
|
25
25
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
+
import { ItemEntry } from '../models';
|
|
3
|
+
import { EntryParent, FieldMap, ItemIdConversionMap } from '../types';
|
|
4
|
+
import { ChangesDeltaItemDeleteDelta } from './ChangesDelta';
|
|
5
|
+
import { ChangesDeltaBase } from './ChangesDeltaBase';
|
|
6
|
+
import { ItemEntryService } from './ItemEntryService';
|
|
7
|
+
export declare type InternalCreateDelta<ItemTypeType extends ApiEnumItemType = any> = {
|
|
8
|
+
entry: ItemEntry<ItemTypeType>;
|
|
9
|
+
fields: FieldMap<ItemTypeType>;
|
|
10
|
+
};
|
|
11
|
+
export declare type ParentChangesDeltaItemDeleteDelta = ItemEntry;
|
|
12
|
+
/**
|
|
13
|
+
* @description
|
|
14
|
+
* ChangesDelta used internally by the core
|
|
15
|
+
*
|
|
16
|
+
* ----------
|
|
17
|
+
*
|
|
18
|
+
* The difference between {@link ParentChangesDelta ParentChangesDelta} and {@link ChangesDelta ChangesDelta} is that the ParentChangesDelta
|
|
19
|
+
* assumes 'created' entries are already existing, and deletedEntries don't have changes (since you cannot undo an action that happened on a parent on a child transaction)
|
|
20
|
+
*
|
|
21
|
+
* Use this when calling {@link TransactionCache.applyChangesFromParent applyChangesFromParent}
|
|
22
|
+
*/
|
|
23
|
+
export declare class ParentChangesDelta extends ChangesDeltaBase {
|
|
24
|
+
created: {
|
|
25
|
+
[itemEntryId: string]: InternalCreateDelta;
|
|
26
|
+
};
|
|
27
|
+
deleted: {
|
|
28
|
+
[itemType: string]: ParentChangesDeltaItemDeleteDelta[];
|
|
29
|
+
};
|
|
30
|
+
moved: {
|
|
31
|
+
[itemEntryId: number]: {
|
|
32
|
+
entry: ItemEntry;
|
|
33
|
+
to: EntryParent;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
itemIdConversionMap: ItemIdConversionMap;
|
|
37
|
+
constructor(itemEntryService: ItemEntryService);
|
|
38
|
+
setItemDeleted(deleted: ChangesDeltaItemDeleteDelta): this;
|
|
39
|
+
setItemsDeleted(deleted: ChangesDeltaItemDeleteDelta[]): this;
|
|
40
|
+
setItemCreated<ItemTypeType extends ApiEnumItemType>(itemEntry: ItemEntry<ItemTypeType>, fields: FieldMap<ItemTypeType>): void;
|
|
41
|
+
/**
|
|
42
|
+
* @remark
|
|
43
|
+
* Parent fields are non-writable so we need to keep track of moved entries another way (to do a linkTo request)
|
|
44
|
+
*/
|
|
45
|
+
setItemMoved(entry: ItemEntry, to: EntryParent): void;
|
|
46
|
+
isEmpty(): boolean;
|
|
47
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { ApiQueryConditionLinkedTo, ApiQueryConditionSubQuery } from '@rentman/backend-types';
|
|
2
2
|
import { ApiQuery, ApiQueryConditionComparator, ApiQueryWithConditions, ItemIdConversionMap } from '../types';
|
|
3
3
|
import { QueryParserBase } from './QueryParserBase';
|
|
4
|
-
export declare class QueryParserIdUpdater extends QueryParserBase<
|
|
4
|
+
export declare class QueryParserIdUpdater extends QueryParserBase<boolean> {
|
|
5
5
|
private itemIdConversionMap;
|
|
6
6
|
constructor(itemIdConversionMap: ItemIdConversionMap, query: ApiQuery);
|
|
7
|
-
protected parseEmptyQuery():
|
|
8
|
-
protected parseSubQuery<T extends ApiQueryConditionSubQuery>(_key: T['key'], subQuery: T['query']):
|
|
9
|
-
protected parseSubFieldQuery():
|
|
10
|
-
protected parseSearchQuery():
|
|
11
|
-
protected parseCustomQuery():
|
|
12
|
-
protected parseSimpleQuery<T extends ApiQueryConditionComparator>(_key: T['key'], value: T['value'], _comparator: T['comparator'], _not: T['not'], queryPart: T):
|
|
13
|
-
protected parseLinkedToQuery<T extends ApiQueryConditionLinkedTo>(_linkedTo: T['linkedTo'], query?: T['query']):
|
|
14
|
-
protected parseComplexQuery<T extends ApiQueryWithConditions>(conditions: T['conditions']):
|
|
7
|
+
protected parseEmptyQuery(): boolean;
|
|
8
|
+
protected parseSubQuery<T extends ApiQueryConditionSubQuery>(_key: T['key'], subQuery: T['query']): boolean;
|
|
9
|
+
protected parseSubFieldQuery(): boolean;
|
|
10
|
+
protected parseSearchQuery(): boolean;
|
|
11
|
+
protected parseCustomQuery(): boolean;
|
|
12
|
+
protected parseSimpleQuery<T extends ApiQueryConditionComparator>(_key: T['key'], value: T['value'], _comparator: T['comparator'], _not: T['not'], queryPart: T): boolean;
|
|
13
|
+
protected parseLinkedToQuery<T extends ApiQueryConditionLinkedTo>(_linkedTo: T['linkedTo'], query?: T['query']): boolean;
|
|
14
|
+
protected parseComplexQuery<T extends ApiQueryWithConditions>(conditions: T['conditions']): boolean;
|
|
15
15
|
private parseConditions;
|
|
16
16
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { ApiEnumItemType, ApiFields, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { RmCore } from '../core';
|
|
2
3
|
import { RequestColumnExpansionFactory, TemplateFactory } from '../factories';
|
|
3
4
|
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../interfaces';
|
|
4
5
|
import { Template } from '../models';
|
|
5
|
-
import { EntryParentNull, PromiseInterface } from '../types';
|
|
6
|
+
import { ApiResponse, EntryParentNull, PromiseInterface } from '../types';
|
|
6
7
|
import { ApiRequestService } from './ApiRequestService';
|
|
7
8
|
import { ColumnHandler } from './ColumnHandler';
|
|
8
9
|
import { ColumnUtil } from './ColumnUtil';
|
|
9
10
|
export declare class TemplateCache {
|
|
11
|
+
private core;
|
|
10
12
|
private columnUtil;
|
|
11
13
|
private promiseService;
|
|
12
14
|
private columnHandler;
|
|
@@ -15,19 +17,20 @@ export declare class TemplateCache {
|
|
|
15
17
|
private requestColumnExpansionFactory;
|
|
16
18
|
private apiRequestService;
|
|
17
19
|
private pendingTemplateBufferMap;
|
|
18
|
-
|
|
19
|
-
[itemType: string]:
|
|
20
|
+
templateResponses: {
|
|
21
|
+
[itemType: string]: ApiResponse;
|
|
20
22
|
};
|
|
21
|
-
constructor(columnUtil: ColumnUtil, promiseService: PromiseLibraryInterface, columnHandler: ColumnHandler, templateFactory: TemplateFactory, errorHandler: ErrorHandlerInterface, requestColumnExpansionFactory: RequestColumnExpansionFactory, apiRequestService: ApiRequestService);
|
|
23
|
+
constructor(core: RmCore, columnUtil: ColumnUtil, promiseService: PromiseLibraryInterface, columnHandler: ColumnHandler, templateFactory: TemplateFactory, errorHandler: ErrorHandlerInterface, requestColumnExpansionFactory: RequestColumnExpansionFactory, apiRequestService: ApiRequestService);
|
|
22
24
|
/**
|
|
23
25
|
* @description
|
|
24
|
-
* Fetches a {@link Template template}, {@link
|
|
26
|
+
* Fetches a {@link Template template}, use {@link ItemCreateService.createItemsFromValues createItemsFromValues} to easily create new items from a set of values.
|
|
27
|
+
* The best way to process the template's values is to call {@link ItemCreateService.processTemplate processTemplate}
|
|
25
28
|
*
|
|
26
29
|
* @param itemType The {@link ApiEnumItemType ItemType} of the template item
|
|
27
30
|
* @param itemId Used for caching, multiple concurrent template calls for the same itemId will return the same template
|
|
28
31
|
* @param templateOptions
|
|
29
32
|
* @param templateColumns Additional columns to be fetched, will be stored in the template - warning - the Template won't have values for those columns
|
|
30
|
-
* @param entryParentOrParentItemType An optional {@link EntryParentNull entry parent} or {@link
|
|
33
|
+
* @param entryParentOrParentItemType An optional {@link EntryParentNull entry parent} or {@link ApiEnumItemType parent itemType}, if the parent is passed the templateColumns will be expanded with the proper link columns (Through {@link ColumnUtil.getColumnsFromLink ColumnUtil.getColumnsFromLink})
|
|
31
34
|
*
|
|
32
35
|
* @example
|
|
33
36
|
* ```
|
|
@@ -51,13 +54,13 @@ export declare class TemplateCache {
|
|
|
51
54
|
* for (const itemResource of selectedItems) {
|
|
52
55
|
* changesDelta.setItemCreated(
|
|
53
56
|
* core.keyService.getLocalId(),
|
|
54
|
-
* template.
|
|
57
|
+
* template.getFields(),
|
|
55
58
|
* template.columns,
|
|
56
59
|
* parent,
|
|
57
60
|
* );
|
|
58
61
|
* }
|
|
59
62
|
*
|
|
60
|
-
* transaction.applyChangesDelta(changesDelta);
|
|
63
|
+
* return transaction.applyChangesDelta(changesDelta);
|
|
61
64
|
* );
|
|
62
65
|
* ```
|
|
63
66
|
*/
|
|
@@ -4,10 +4,11 @@ import { AbstractCacheDependencyInterface } from '../../interfaces';
|
|
|
4
4
|
import { ItemEntry } from '../../models';
|
|
5
5
|
import { ApiRequestColumn, CollectionQuery, CollectionResourceParentIdMap, EntryParentNull, FieldMap, ItemIdConversionMap, PromiseInterface } from '../../types';
|
|
6
6
|
import { ChangesDelta } from '../ChangesDelta';
|
|
7
|
-
import { ChangesDeltaResult } from '../ChangesDeltaBase';
|
|
7
|
+
import { ChangesDeltaBase, ChangesDeltaResult } from '../ChangesDeltaBase';
|
|
8
8
|
import { OnAfterCreateCallback } from '../ChangesProcessor';
|
|
9
9
|
import { InternalChangesDelta } from '../InternalChangesDelta';
|
|
10
10
|
import { ItemCache } from '../ItemCache';
|
|
11
|
+
import { ParentChangesDelta } from '../ParentChangesDelta';
|
|
11
12
|
import { CachedQueryItem } from './CachedQueryHandlerBase';
|
|
12
13
|
import { ItemHandlerBase } from './ItemHandlerBase';
|
|
13
14
|
import { ServerCache } from './server/ServerCache';
|
|
@@ -17,6 +18,13 @@ import { TransactionCache } from './transaction/TransactionCache';
|
|
|
17
18
|
import { TransactionCachedQueryHandler } from './transaction/TransactionCachedQueryHandler';
|
|
18
19
|
import { TransactionItemEntryChanges } from './transaction/TransactionItemHandler';
|
|
19
20
|
import { TransactionValidatorFactory } from './transaction/TransactionValidator';
|
|
21
|
+
export declare type TransactionOptions = {
|
|
22
|
+
/**
|
|
23
|
+
* @description
|
|
24
|
+
* Sets the TransactionCache to 'transparent' mode, whenever {@link AbstractCache.createChild createChild} is called it will actually be called on the parent
|
|
25
|
+
*/
|
|
26
|
+
transparent: boolean;
|
|
27
|
+
};
|
|
20
28
|
export declare abstract class AbstractCache {
|
|
21
29
|
dependencies: AbstractCacheDependencyInterface;
|
|
22
30
|
core: RmCore;
|
|
@@ -25,7 +33,7 @@ export declare abstract class AbstractCache {
|
|
|
25
33
|
readonly cachedQueryHandler: TransactionCachedQueryHandler | ServerCachedQueryHandler;
|
|
26
34
|
parent: AbstractCache | null;
|
|
27
35
|
protected constructor(dependencies: AbstractCacheDependencyInterface, core: RmCore);
|
|
28
|
-
abstract createChild(id?: string, validatorFactory?: TransactionValidatorFactory): TransactionCache;
|
|
36
|
+
abstract createChild(id?: string, validatorFactory?: TransactionValidatorFactory, options?: TransactionOptions): TransactionCache;
|
|
29
37
|
onChildDestroy(cache: TransactionCache): void;
|
|
30
38
|
/**
|
|
31
39
|
* @description
|
|
@@ -68,7 +76,7 @@ export declare abstract class AbstractCache {
|
|
|
68
76
|
*
|
|
69
77
|
* @internal
|
|
70
78
|
*/
|
|
71
|
-
abstract applyChangesFromParent(
|
|
79
|
+
abstract applyChangesFromParent(parentChangesDelta: ParentChangesDelta, isCalledAfterSocketUpdate: boolean): void;
|
|
72
80
|
abstract getParent<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean, providedFields?: FieldMap<ItemTypeType>): EntryParentNull;
|
|
73
81
|
abstract getItemChangesRecursively(itemEntryId: ItemEntry['id'], copyFields?: boolean): FieldMap;
|
|
74
82
|
abstract getLocalItemEntryChangesTuple(itemEntryId: ItemEntry['id']): any;
|
|
@@ -90,14 +98,15 @@ export declare abstract class AbstractCache {
|
|
|
90
98
|
*
|
|
91
99
|
* @private
|
|
92
100
|
*/
|
|
93
|
-
protected _applyChangesDelta(changesDelta: ChangesDelta): {
|
|
101
|
+
protected _applyChangesDelta(changesDelta: ChangesDelta | InternalChangesDelta): {
|
|
94
102
|
result: ChangesDeltaResult;
|
|
95
|
-
|
|
96
|
-
matchingDelta:
|
|
103
|
+
parentChangesDelta: ParentChangesDelta;
|
|
104
|
+
matchingDelta: ParentChangesDelta;
|
|
105
|
+
undoFunctions: Array<(changesDelta: InternalChangesDelta) => void>;
|
|
97
106
|
};
|
|
98
107
|
/**
|
|
99
108
|
* @description
|
|
100
109
|
* Ensures that for all updated items in the delta the required derived values are present
|
|
101
110
|
*/
|
|
102
|
-
protected fetchUpdatedDerivedValuesFromDelta(changesDelta:
|
|
111
|
+
protected fetchUpdatedDerivedValuesFromDelta(changesDelta: ChangesDeltaBase): PromiseInterface<void>;
|
|
103
112
|
}
|
|
@@ -2,7 +2,7 @@ import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
|
2
2
|
import { ItemCacheFactory, ItemEntryFactory, RequestColumnExpansionFactory } from '../../factories';
|
|
3
3
|
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../../interfaces';
|
|
4
4
|
import { ItemEntry, ItemEntryOptions } from '../../models';
|
|
5
|
-
import { ApiQuery,
|
|
5
|
+
import { ApiQuery, FieldMap, PromiseInterface } from '../../types';
|
|
6
6
|
import { ApiFormatter } from '../ApiFormatter';
|
|
7
7
|
import { ChangesDeltaBase, ChangesDeltaItemUpdateDelta } from '../ChangesDeltaBase';
|
|
8
8
|
import { ColumnInfo } from '../ColumnInfo';
|
|
@@ -10,7 +10,6 @@ import { ColumnUtil } from '../ColumnUtil';
|
|
|
10
10
|
import { ChangesDeltaItemCreateDelta } from '../CreatedChangesDelta';
|
|
11
11
|
import { ItemCache } from '../ItemCache';
|
|
12
12
|
import { AbstractCache } from './AbstractCache';
|
|
13
|
-
import { ServerItemEntryChanges } from './server/ServerItemHandler';
|
|
14
13
|
import { TransactionItemEntryChanges } from './transaction/TransactionItemHandler';
|
|
15
14
|
export declare enum ItemCacheStatus {
|
|
16
15
|
CACHED = "cached",
|
|
@@ -34,7 +33,7 @@ export declare abstract class ItemHandlerBase {
|
|
|
34
33
|
protected transaction: AbstractCache;
|
|
35
34
|
readonly entries: ItemCache;
|
|
36
35
|
abstract itemChanges: {
|
|
37
|
-
[itemEntryId: string]:
|
|
36
|
+
[itemEntryId: string]: any;
|
|
38
37
|
};
|
|
39
38
|
protected constructor(columnUtil: ColumnUtil, apiFormatter: ApiFormatter, itemEntryFactory: ItemEntryFactory, promiseService: PromiseLibraryInterface, errorHandler: ErrorHandlerInterface, requestColumnExpansionFactory: RequestColumnExpansionFactory, itemCacheFactory: ItemCacheFactory, transaction: AbstractCache);
|
|
40
39
|
/**
|
|
@@ -58,12 +57,12 @@ export declare abstract class ItemHandlerBase {
|
|
|
58
57
|
* @description
|
|
59
58
|
* Fetches an ItemEntry with the given itemId
|
|
60
59
|
*/
|
|
61
|
-
abstract fetchItemEntry<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>>;
|
|
60
|
+
abstract fetchItemEntry<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemEntryOptions, isRoot?: boolean): PromiseInterface<ItemEntry<ItemTypeType>>;
|
|
62
61
|
/**
|
|
63
62
|
* @description
|
|
64
63
|
* Processes the passed {@link ChangesDeltaItemUpdateDelta update delta} on the transaction, if there are no {@link TransactionItemHandler.itemChanges itemChanges} the new values will not be processed
|
|
65
64
|
*/
|
|
66
|
-
abstract processItemEntryChanges<ItemTypeType extends ApiEnumItemType>(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta<ItemTypeType>,
|
|
65
|
+
abstract processItemEntryChanges<ItemTypeType extends ApiEnumItemType>(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, isCalledAfterSocketUpdate: boolean, createItemChangesIfNoneExist: boolean): ProcessItemEntryChangesResult<ItemTypeType>;
|
|
67
66
|
/**
|
|
68
67
|
* @description
|
|
69
68
|
* Traverses the column path and returns the fields of the derived item, returns undefined if the item isn't found
|
|
@@ -104,5 +103,4 @@ export declare abstract class ItemHandlerBase {
|
|
|
104
103
|
* Gets the value of the given column, will look into the current delta before attempting to read itemChanges
|
|
105
104
|
*/
|
|
106
105
|
protected getItemIdByColumn<ItemTypeType extends ApiEnumItemType>(itemEntry: ItemEntry<ItemTypeType>, column: ColumnInfo<ItemTypeType>, changesDelta?: ChangesDeltaBase): ItemId;
|
|
107
|
-
expandColumnsWithCachedQueryColumns(itemType: ApiEnumItemType, requestColumns?: ApiRequestColumns): ApiRequestColumns;
|
|
108
106
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
-
import { ChangesDelta,
|
|
2
|
+
import { ChangesDelta, TransactionCache, TransactionOptions, TransactionValidatorFactory } from '../..';
|
|
3
3
|
import { RmCore } from '../../../core';
|
|
4
4
|
import { ServerCacheDependencyInterface } from '../../../interfaces/ServerCacheDependencyInterface';
|
|
5
5
|
import { ItemEntry } from '../../../models';
|
|
6
|
-
import { ApiRequestColumn, ApiRequestColumnMap, CollectionQuery, CollectionResourceParentIdMap, EntryParent, EntryParentNull, FieldMap, ItemIdConversionMap, PromiseInterface } from '../../../types';
|
|
6
|
+
import { ApiRequestColumn, ApiRequestColumnMap, CollectionQuery, CollectionResourceParentIdMap, EntryParent, EntryParentNull, FieldMap, ItemIdConversionMap, ItemTypeMap, PromiseInterface } from '../../../types';
|
|
7
7
|
import { ApiResponseProcessor } from '../../ApiResponseProcessor';
|
|
8
8
|
import { ChangesDeltaResult } from '../../ChangesDeltaBase';
|
|
9
9
|
import { OnAfterCreateCallback } from '../../ChangesProcessor';
|
|
10
|
+
import { ParentChangesDelta } from '../../ParentChangesDelta';
|
|
10
11
|
import { AbstractCache } from '../AbstractCache';
|
|
11
12
|
import { CachedQueryItem } from '../CachedQueryHandlerBase';
|
|
12
13
|
import { ServerCachedQueryHandler } from './ServerCachedQueryHandler';
|
|
@@ -25,14 +26,24 @@ export declare class ServerCache extends AbstractCache {
|
|
|
25
26
|
parent: null;
|
|
26
27
|
constructor(dependencies: ServerCacheDependencyInterface, core: RmCore);
|
|
27
28
|
getServerCache(): ServerCache;
|
|
28
|
-
createChild(id?: string, validatorFactory?: TransactionValidatorFactory): TransactionCache;
|
|
29
|
+
createChild(id?: string, validatorFactory?: TransactionValidatorFactory, options?: TransactionOptions): TransactionCache;
|
|
29
30
|
expandCollectionResources<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, collections: CollectionResourceParentIdMap<ItemTypeType>, newRequestColumns: ApiRequestColumn[]): PromiseInterface<CollectionResourceParentIdMap>;
|
|
30
|
-
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @param response
|
|
34
|
+
* @param requestColumnMap
|
|
35
|
+
* @param isCalledAfterSocketUpdate
|
|
36
|
+
* @param changesDelta
|
|
37
|
+
* @param conversionMap
|
|
38
|
+
* @param directRequestItemMap Should be a map of ItemType->ItemId of items that were directly part of the create/update request (queries should be excluded from this because we don't want to overwrite the user's changes (derived values are also queries))
|
|
39
|
+
*/
|
|
40
|
+
processResponse(response: ApiResponseProcessor, requestColumnMap: ApiRequestColumnMap, isCalledAfterSocketUpdate?: boolean, changesDelta?: ChangesDelta, directRequestItemMap?: ItemTypeMap<Record<string, boolean>>, conversionMap?: ItemIdConversionMap): PromiseInterface<ChangesDeltaResult>;
|
|
31
41
|
/**
|
|
32
42
|
* @description
|
|
33
|
-
* Applies
|
|
43
|
+
* Applies changes to this transaction and its children
|
|
44
|
+
* ServerCache.applyChangesFromParent should be used when processing an API update/create/delete
|
|
34
45
|
*/
|
|
35
|
-
applyChangesFromParent(
|
|
46
|
+
applyChangesFromParent(parentChangesDelta: ParentChangesDelta, isCalledAfterSocketUpdate?: boolean): PromiseInterface<void>;
|
|
36
47
|
/**
|
|
37
48
|
* @description
|
|
38
49
|
* Gets the fields required to set the parent
|
|
@@ -74,9 +85,9 @@ export declare class ServerCache extends AbstractCache {
|
|
|
74
85
|
/**
|
|
75
86
|
* @description
|
|
76
87
|
* Applies changes to this transaction and its children
|
|
77
|
-
*
|
|
88
|
+
* ServerCache.applyChangesDelta should be used when processing an API response which should create new entries on the ServerCache (such as a Query)
|
|
78
89
|
*/
|
|
79
|
-
applyChangesDelta(changesDelta: ChangesDelta,
|
|
90
|
+
applyChangesDelta(changesDelta: ChangesDelta, isCalledAfterSocketUpdate?: boolean, conversionMap?: ItemIdConversionMap): PromiseInterface<ChangesDeltaResult>;
|
|
80
91
|
getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry | undefined;
|
|
81
92
|
getLocalItemEntryByItemId(itemType: ApiEnumItemType, itemId: ItemEntry['itemId']): ItemEntry | undefined;
|
|
82
93
|
getChangesFromItemChanges<ItemTypeType extends ApiEnumItemType = any>(changesObject: ServerItemEntryChanges<ItemTypeType>): FieldMap<ItemTypeType>;
|
|
@@ -25,7 +25,7 @@ export declare class ServerItemHandler extends ItemHandlerBase {
|
|
|
25
25
|
* @description
|
|
26
26
|
* Processes updates on a cached entry
|
|
27
27
|
*/
|
|
28
|
-
processItemEntryChanges<ItemTypeType extends ApiEnumItemType = any>(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta<ItemTypeType>,
|
|
28
|
+
processItemEntryChanges<ItemTypeType extends ApiEnumItemType = any>(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, _isCalledAfterSocketUpdate?: boolean, _createItemChangesIfNoneExist?: boolean): ProcessItemEntryChangesResult<ItemTypeType>;
|
|
29
29
|
copyTransactionItemEntryChanges(itemEntryChanges: TransactionItemEntryChanges, entry: ItemEntry): ServerItemEntryChanges;
|
|
30
30
|
fetchItemEntry<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>>;
|
|
31
31
|
fetchItemEntriesByQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, query: ApiQuery, entryOptions: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
@@ -43,7 +43,7 @@ export declare class ServerItemHandler extends ItemHandlerBase {
|
|
|
43
43
|
* General way to process an API response.
|
|
44
44
|
* Will call {@link ChangesDelta.setItemCreated setItemCreated} if an entry doesn't exist yet, and otherwise {@link ChangesDelta.setItemUpdated setItemUpdated} if it does.
|
|
45
45
|
*/
|
|
46
|
-
processApiResponse<ItemTypeType extends ApiEnumItemType>(changesDelta: ChangesDelta, response: ApiResponseProcessor, itemType: ItemTypeType, itemIdOfExistingItem: ItemId, itemIdInResponse: ItemId, columnSet: ColumnSet<ItemTypeType>, columnExpansion: ColumnExpansion<ItemTypeType
|
|
46
|
+
processApiResponse<ItemTypeType extends ApiEnumItemType>(changesDelta: ChangesDelta, response: ApiResponseProcessor, itemType: ItemTypeType, itemIdOfExistingItem: ItemId, itemIdInResponse: ItemId, columnSet: ColumnSet<ItemTypeType>, columnExpansion: ColumnExpansion<ItemTypeType>, updateModified?: boolean): void;
|
|
47
47
|
/**
|
|
48
48
|
* @description
|
|
49
49
|
* Fetches the data for the passed ItemType/ItemId/columns, will do nothing if the requested ItemEntry/columns are already cached.
|