@rentman/rm-core 63.4.1-blr-01 → 63.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rm-core.js +1 -1
- package/dist/rm-core.js.map +1 -1
- package/dist/types/src/classes/BusinessLogicManager/AantalBusinessLogicRuleBase.d.ts +11 -9
- package/dist/types/src/classes/BusinessLogicManager/AantaltotaalBusinessLogicRuleBase.d.ts +11 -12
- package/dist/types/src/classes/BusinessLogicManager/BusinessLogicManager.d.ts +7 -6
- package/dist/types/src/classes/BusinessLogicManager/BusinessLogicRule.d.ts +9 -2
- package/dist/types/src/classes/BusinessLogicManager/BusinessLogicRuleApplyContext.d.ts +10 -3
- package/dist/types/src/classes/BusinessLogicManager/BusinessLogicRuleConditionContext.d.ts +17 -5
- package/dist/types/src/classes/BusinessLogicManager/BusinessLogicRuleContextBase.d.ts +55 -4
- package/dist/types/src/classes/BusinessLogicManager/Customfield/CustomFieldLinkedItemTypeBusinessLogicRule.d.ts +1 -2
- package/dist/types/src/classes/BusinessLogicManager/Customfield/CustomFieldTypeBusinessLogicRule.d.ts +1 -2
- package/dist/types/src/classes/BusinessLogicManager/DefaultContactPersonUpdateBusinessLogicRule.d.ts +13 -34
- package/dist/types/src/classes/BusinessLogicManager/Documents/DocumentTemplateBusinessLogicRule.d.ts +2 -3
- package/dist/types/src/classes/BusinessLogicManager/Exemplaar/ExemplaarAanschafdatumBusinessLogicRule.d.ts +1 -2
- package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurBetalingsconditieBusinessLogicRule.d.ts +6 -11
- package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurDatumBusinessLogicRule.d.ts +4 -5
- package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurNumberseriesBusinessLogicRule.d.ts +1 -2
- package/dist/types/src/classes/BusinessLogicManager/Files/FilesNameExtensionBusinessLogicRule.d.ts +2 -3
- package/dist/types/src/classes/BusinessLogicManager/Functie/FunctieNaaminternBusinessLogicRule.d.ts +1 -2
- package/dist/types/src/classes/BusinessLogicManager/Functie/FunctieTwowayBusinessLogicRule.d.ts +1 -2
- package/dist/types/src/classes/BusinessLogicManager/Functie/functieTravelDistanceUtils.d.ts +1 -1
- package/dist/types/src/classes/BusinessLogicManager/Functiegroep/FunctiegroepSubprojectBusinessLogicRule.d.ts +3 -9
- package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalBulkToSerialBusinessLogicRule.d.ts +2 -4
- package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalSerialToBulkBusinessLogicRule.d.ts +2 -4
- package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalVerhuurBusinessLogicRule.d.ts +2 -2
- package/dist/types/src/classes/BusinessLogicManager/Materiaal/SurfaceArticleSizeBusinessLogicRule.d.ts +10 -2
- package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemBusinessLogicRuleBase.d.ts +17 -10
- package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemDurationBusinessLogicRule.d.ts +4 -4
- package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemMateriaalCatBusinessLogicRule.d.ts +7 -6
- package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemSubprojectBusinessLogicRule.d.ts +20 -5
- package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemTimeSchemeBusinessLogicRule.d.ts +5 -7
- package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemTimeSchemeStartBusinessLogicRule.d.ts +5 -7
- package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemTimeValueStartBusinessLogicRule.d.ts +5 -6
- package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/TimeColumnUtil.d.ts +1 -1
- package/dist/types/src/classes/BusinessLogicManager/OfferteContract/OfferteContractDatumBusinessLogicRule.d.ts +2 -3
- package/dist/types/src/classes/BusinessLogicManager/PlanningPersoneelTransport/PlanningPersoneelTransportBusinessLogicRule.d.ts +4 -6
- package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalOptieBusinessLogicRule.d.ts +1 -1
- package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalParentBusinessLogicRule.d.ts +3 -1
- package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalStaysAtLocationBusinessLogicRule.d.ts +10 -3
- package/dist/types/src/classes/BusinessLogicManager/Project/ProjectContactProjectNoteBusinessLogicRule.d.ts +3 -5
- package/dist/types/src/classes/BusinessLogicManager/Project/ProjectOneSubLocationAlignBusinessRule.d.ts +2 -4
- package/dist/types/src/classes/BusinessLogicManager/Rate/RateDeactivateExistingOnCreateBusinessLogicRule.d.ts +1 -2
- package/dist/types/src/classes/BusinessLogicManager/Reparatie/ReparatieExemplaarAantalBusinessLogicRule.d.ts +1 -2
- package/dist/types/src/classes/BusinessLogicManager/Reparatie/ReparatieLostItemExemplaarLocationBusinessLogicRule.d.ts +1 -2
- package/dist/types/src/classes/BusinessLogicManager/Rol/RolEditOwnDataBusinessLogicRule.d.ts +3 -2
- package/dist/types/src/classes/BusinessLogicManager/Rol/RolPersoneelsplannerToegangBusinessLogicRule.d.ts +3 -2
- package/dist/types/src/classes/BusinessLogicManager/Rol/RolProjectenBewerkenBusinessLogicRule.d.ts +3 -2
- package/dist/types/src/classes/BusinessLogicManager/Rol/RolProjectenToegangBusinessLogicRule.d.ts +4 -2
- package/dist/types/src/classes/BusinessLogicManager/Rol/RolVisibilityFinancialsBusinessLogicRule.d.ts +7 -2
- package/dist/types/src/classes/BusinessLogicManager/Rol/RolWarehosueTrackingLogAccessBusinessLogicRule.d.ts +3 -2
- package/dist/types/src/classes/BusinessLogicManager/Setinhoud/SetinhoudCreateFixedBusinessLogicRule.d.ts +4 -4
- package/dist/types/src/classes/BusinessLogicManager/Subproject/SubprojectInPlanningBusinessLogicRule.d.ts +1 -2
- package/dist/types/src/classes/BusinessLogicManager/Subproject/SubprojectOneSubLocationAlignBusinessRule.d.ts +2 -4
- package/dist/types/src/classes/BusinessLogicManager/Subproject/SubprojectOneSubNameAlignBusinessRule.d.ts +2 -4
- package/dist/types/src/classes/BusinessLogicManager/Taak/TaakDeadlineOffsetBusinessLogicRule.d.ts +2 -2
- package/dist/types/src/classes/BusinessLogicManager/Tijd/TijdPropagateNameToFunctiegroepBusinessLogicRule.d.ts +2 -4
- package/dist/types/src/classes/BusinessLogicManager/Tijd/TijdSubprojectChangedBusinessLogicRule.d.ts +2 -6
- package/dist/types/src/classes/BusinessLogicManager/Uren/HoursTypeBusinessLogicRuleBase.d.ts +2 -1
- package/dist/types/src/classes/ChangesDelta.d.ts +9 -7
- package/dist/types/src/classes/ChangesDeltaBase.d.ts +14 -11
- package/dist/types/src/classes/ChangesProcessor.d.ts +3 -3
- package/dist/types/src/classes/ChildChangesDelta.d.ts +7 -18
- package/dist/types/src/classes/CreatedChangesDelta.d.ts +2 -2
- package/dist/types/src/classes/ParentChangesDelta.d.ts +6 -7
- package/dist/types/src/classes/SocketMessageHandler.d.ts +2 -4
- package/dist/types/src/classes/Util.d.ts +0 -1
- package/dist/types/src/classes/cache/AbstractCache.d.ts +6 -1
- package/dist/types/src/classes/cache/server/ServerCache.d.ts +2 -4
- package/dist/types/src/classes/cache/transaction/TransactionCache.d.ts +23 -69
- package/dist/types/src/core.d.ts +2 -0
- package/dist/types/src/factories/ChangesCompilationFactory.d.ts +5 -0
- package/dist/types/src/interfaces/ServerCacheDependencyInterface.d.ts +2 -1
- package/dist/types/src/internal.d.ts +1 -0
- package/package.json +2 -2
|
@@ -4,12 +4,10 @@ import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
|
4
4
|
import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
|
|
5
5
|
import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
|
|
6
6
|
import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
|
|
7
|
-
declare const projectColumns: readonly ["id", "naam"];
|
|
8
|
-
declare const subprojectColumns: readonly ["id", "project", "naam"];
|
|
9
7
|
type ConditionResult = ItemId[];
|
|
10
8
|
type Dependency = {
|
|
11
|
-
projectResource: ItemResource<'Project',
|
|
12
|
-
subprojectResources: ItemResource<'Subproject',
|
|
9
|
+
projectResource: ItemResource<'Project', ['id', 'naam']>;
|
|
10
|
+
subprojectResources: ItemResource<'Subproject', ['id', 'project', 'naam']>[];
|
|
13
11
|
}[];
|
|
14
12
|
/**
|
|
15
13
|
* @description
|
package/dist/types/src/classes/BusinessLogicManager/Taak/TaakDeadlineOffsetBusinessLogicRule.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleCondition
|
|
|
7
7
|
declare const taakColumns: readonly [{
|
|
8
8
|
readonly deadline_relative_time_period: readonly ["tot", "van"];
|
|
9
9
|
}, "deadline_type", "deadline_relative_offset_amount", "deadline_relative_offset_base", "deadline_relative_offset_direction", "deadline_relative_offset_unit"];
|
|
10
|
-
declare const tijdColumns: readonly ["
|
|
10
|
+
declare const tijdColumns: readonly ["tot", "van"];
|
|
11
11
|
type ConditionResult = ItemId[];
|
|
12
12
|
type Dependency = {
|
|
13
13
|
taakResources: ItemResource<'Taak', typeof taakColumns>[];
|
|
@@ -21,7 +21,7 @@ type Dependency = {
|
|
|
21
21
|
export declare class TaakDeadlineOffsetBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
22
22
|
condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
|
|
23
23
|
dependency(transaction: TransactionCache, taakIds: ConditionResult): Promise<Dependency>;
|
|
24
|
-
apply(context: BusinessLogicRuleApplyContext, { taakResources,
|
|
24
|
+
apply(context: BusinessLogicRuleApplyContext, { taakResources, }: Dependency): void;
|
|
25
25
|
calculateTaskTimeWithOffset(context: BusinessLogicRuleApplyContext, selectedDateWithoutOffset: moment.Moment, taskResource: ItemResource<'Taak', any>): moment.Moment;
|
|
26
26
|
}
|
|
27
27
|
export {};
|
|
@@ -4,12 +4,10 @@ import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
|
4
4
|
import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
|
|
5
5
|
import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
|
|
6
6
|
import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
|
|
7
|
-
declare const tijdColumns: readonly ["naam", "id"];
|
|
8
|
-
declare const functiegroepColumns: readonly ["schema_pv", "schema_gv", "schema_pt", "schema_gt", "naam"];
|
|
9
7
|
type ConditionResult = ItemId[];
|
|
10
8
|
type Dependency = {
|
|
11
|
-
tijdResource: ItemResource<'Tijd',
|
|
12
|
-
functiegroepResource: ItemResource<'Functiegroep',
|
|
9
|
+
tijdResource: ItemResource<'Tijd', ['naam', 'id']>;
|
|
10
|
+
functiegroepResource: ItemResource<'Functiegroep', ['naam']>;
|
|
13
11
|
}[];
|
|
14
12
|
/**
|
|
15
13
|
* @description
|
package/dist/types/src/classes/BusinessLogicManager/Tijd/TijdSubprojectChangedBusinessLogicRule.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BLR_SKIP_RULE, BusinessLogicRule, BusinessLogicRuleApplyContext, BusinessLogicRuleConditionContext, CollectionResource, ItemEntry, ItemResource, TransactionCache } from '../../../internal';
|
|
1
|
+
import { BLR_SKIP_RULE, BusinessLogicConditionResult, BusinessLogicRule, BusinessLogicRuleApplyContext, BusinessLogicRuleConditionContext, CollectionResource, ItemResource, TransactionCache } from '../../../internal';
|
|
3
2
|
declare const projectDefaultTimeColumns: readonly ["id", "gebruiksperiode", "planperiode"];
|
|
4
|
-
type ConditionResult =
|
|
5
|
-
itemEntry: ItemEntry<'Tijd'>;
|
|
6
|
-
newValue: ItemId<'Subproject'>;
|
|
7
|
-
}[];
|
|
3
|
+
type ConditionResult = BusinessLogicConditionResult<'Tijd', 'subproject'>[];
|
|
8
4
|
type Dependency = ItemResource<'Project', typeof projectDefaultTimeColumns, {
|
|
9
5
|
Subproject: CollectionResource<'Subproject', typeof projectDefaultTimeColumns>;
|
|
10
6
|
}>;
|
package/dist/types/src/classes/BusinessLogicManager/Uren/HoursTypeBusinessLogicRuleBase.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ItemTypeColumnId } from '../../../types/ItemTypesCollection';
|
|
2
3
|
import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
|
|
3
4
|
import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
|
|
4
5
|
type ConditionResult = ItemId<'Uren'>[];
|
|
5
6
|
export declare abstract class HoursTypeBusinessLogicRuleBase<DependencyType> extends BusinessLogicRule<ConditionResult, DependencyType> {
|
|
6
|
-
protected abstract conditionColumnId: '
|
|
7
|
+
protected abstract conditionColumnId: ItemTypeColumnId<'HoursType'>;
|
|
7
8
|
condition(context: BusinessLogicRuleConditionContext): Promise<ConditionResult | typeof BLR_SKIP_RULE>;
|
|
8
9
|
}
|
|
9
10
|
export {};
|
|
@@ -22,10 +22,13 @@ export interface ChangesDeltaItemUpdateDelta<ItemTypeType extends ApiItemType> e
|
|
|
22
22
|
*
|
|
23
23
|
* Use this when calling {@link TransactionCache.applyChangesDelta applyChangesDelta}
|
|
24
24
|
*/
|
|
25
|
-
export declare class ChangesDelta extends ChangesDeltaBase<
|
|
25
|
+
export declare class ChangesDelta extends ChangesDeltaBase<ChangesDeltaItemDeleteDelta<any>> {
|
|
26
26
|
logMissingColumnErrors: boolean;
|
|
27
27
|
private errorHandler;
|
|
28
28
|
private itemCreateService;
|
|
29
|
+
updated: {
|
|
30
|
+
[itemEntryId: number]: ChangesDeltaItemUpdateDelta<any>;
|
|
31
|
+
};
|
|
29
32
|
created: CreatedChangesDelta;
|
|
30
33
|
/**
|
|
31
34
|
* Only contains remote items, when rolling back local items the whole entries are deleted.
|
|
@@ -34,11 +37,9 @@ export declare class ChangesDelta extends ChangesDeltaBase<ChangesDeltaItemCreat
|
|
|
34
37
|
[itemEntryId: number]: ItemEntryChangesTuple<any>;
|
|
35
38
|
};
|
|
36
39
|
constructor(logMissingColumnErrors: boolean, queryItemTypes: Iterable<ApiItemType> | undefined, errorHandler: ErrorHandlerInterface, itemCreateService: ItemCreateService, itemEntryService: ItemEntryService);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
getUpdatedTuplesIterator: <ItemTypes extends ApiItemType[]>(...itemTypes: ItemTypes) => IterableIterator<ChangesDeltaItemUpdateDelta<ItemTypes extends [] ? any : ItemTypes[number]>>;
|
|
41
|
-
getCreatedTuplesIterator<ItemTypes extends ApiItemType[]>(...itemTypes: ItemTypes): IterableIterator<ChangesDeltaItemCreateDelta<ItemTypes extends [] ? any : ItemTypes[number]>>;
|
|
40
|
+
getCreatedTuplesIterator<ItemTypeType extends ApiItemType>(itemType: ItemTypeType): IterableIterator<ChangesDeltaItemCreateDelta<ItemTypeType>>;
|
|
41
|
+
getUpdatedTuplesIterator<ItemTypes extends ApiItemType[]>(...itemTypes: ItemTypes): Generator<ChangesDeltaItemUpdateDelta<ItemTypes extends [] ? any : ItemTypes[number]>>;
|
|
42
|
+
merge(otherChangesDelta: ChangesDelta): ChangesDelta;
|
|
42
43
|
/**
|
|
43
44
|
* @description
|
|
44
45
|
* Fetches a template for the passed itemType and processes the passed values and sets the item to be created when the delta is applied
|
|
@@ -48,6 +49,7 @@ export declare class ChangesDelta extends ChangesDeltaBase<ChangesDeltaItemCreat
|
|
|
48
49
|
* - If you want to set a parent set the proper field, you can't pass it as a separate object
|
|
49
50
|
*/
|
|
50
51
|
setItemCreated<ItemTypeType extends ApiItemType>(itemType: ItemTypeType, values: Partial<FieldMap<ItemTypeType>>, templateOptions?: Partial<RequestParameters<ItemTypeType>>): Promise<this>;
|
|
52
|
+
setItemCreatedByTuple<ItemTypeType extends ApiItemType>(itemCreateTuple: ChangesDeltaItemCreateDelta<ItemTypeType>, updatedFields: Partial<FieldMap<ItemTypeType>>): ChangesDelta;
|
|
51
53
|
setItemUpdated<ItemTypeType extends ApiItemType>(entry: ItemEntry<ItemTypeType>, fields: Partial<FieldMap<ItemTypeType>>, columnExpansion?: ColumnExpansion<ItemTypeType> | null, parent?: EntryParentNull, mode?: ChangesDeltaItemUpdateMode): this;
|
|
52
54
|
setItemDeleted(entry: ItemEntry, __isCascaded?: boolean): this;
|
|
53
55
|
setItemsDeleted(deleted: ItemEntry[]): this;
|
|
@@ -73,7 +75,7 @@ export declare class ChangesDelta extends ChangesDeltaBase<ChangesDeltaItemCreat
|
|
|
73
75
|
* @internal
|
|
74
76
|
*/
|
|
75
77
|
_setItemCreated<ItemTypeType extends ApiItemType>(itemId: ItemId, fields: Partial<FieldMap<ItemTypeType>>, columns: ColumnSet<ItemTypeType>, parent?: EntryParentNull, isApiResponse?: boolean): this;
|
|
76
|
-
setItemRestored<ItemTypeType extends ApiItemType>(itemEntry: ItemEntry<ItemTypeType>, transactionItemEntryChanges: FieldMap<ItemTypeType>):
|
|
78
|
+
setItemRestored<ItemTypeType extends ApiItemType>(itemEntry: ItemEntry<ItemTypeType>, transactionItemEntryChanges: FieldMap<ItemTypeType>): void;
|
|
77
79
|
isEmpty(): boolean;
|
|
78
80
|
toJSON(): any;
|
|
79
81
|
}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { ApiItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
-
import { FieldMap, GetFieldValueType, ItemEntry, ItemEntryService, ItemTypeColumnId } from '../internal';
|
|
2
|
+
import { ChangesDelta, ChildChangesDelta, FieldMap, GetFieldValueType, ItemEntry, ItemEntryService, ItemTypeColumnId } from '../internal';
|
|
3
|
+
export type ChangesDeltaResult = {
|
|
4
|
+
/**
|
|
5
|
+
* The changes delta included in the changes delta result is not necessarily the same as the one being passed to
|
|
6
|
+
* the `applyChangesDelta()` method, as business logic rules might have been applied.
|
|
7
|
+
* TODO: Separate results for changes delta and child changes delta.
|
|
8
|
+
*/
|
|
9
|
+
changesDelta: ChangesDelta | ChildChangesDelta;
|
|
10
|
+
created: ItemEntry[];
|
|
11
|
+
allChildrenDonePromise: Promise<void>;
|
|
12
|
+
};
|
|
3
13
|
export type ChangesDeltaItemUpdateMode =
|
|
4
14
|
/**
|
|
5
15
|
* For create/update responses you always want to overwrite whatever is cached
|
|
@@ -31,10 +41,10 @@ export interface ChangesDeltaBaseItemUpdateDelta<ItemTypeType extends ApiItemTyp
|
|
|
31
41
|
export interface ChangesDeltaBaseItemDeleteDelta<ItemTypeType extends ApiItemType> {
|
|
32
42
|
entry: ItemEntry<ItemTypeType>;
|
|
33
43
|
}
|
|
34
|
-
export declare abstract class ChangesDeltaBase<
|
|
44
|
+
export declare abstract class ChangesDeltaBase<ItemDeleteDeltaType extends ChangesDeltaBaseItemDeleteDelta<any> = ChangesDeltaBaseItemDeleteDelta<any>> {
|
|
35
45
|
protected itemEntryService: ItemEntryService;
|
|
36
46
|
updated: {
|
|
37
|
-
[itemEntryId: number]:
|
|
47
|
+
[itemEntryId: number]: ChangesDeltaBaseItemUpdateDelta<any>;
|
|
38
48
|
};
|
|
39
49
|
protected deleted: {
|
|
40
50
|
[ItemType in ApiItemType]?: Map<ItemEntry<ItemType>, ItemDeleteDeltaType>;
|
|
@@ -52,15 +62,8 @@ export declare abstract class ChangesDeltaBase<ItemCreateDeltaType = unknown, It
|
|
|
52
62
|
* When set, only collections of this item type will be matched.
|
|
53
63
|
*/
|
|
54
64
|
_queryItemTypeSet?: Set<ApiItemType>;
|
|
55
|
-
constructor(itemEntryService: ItemEntryService, queryItemTypes?: Iterable<ApiItemType>);
|
|
65
|
+
protected constructor(itemEntryService: ItemEntryService, queryItemTypes?: Iterable<ApiItemType>);
|
|
56
66
|
addQueryItemType(itemType: ApiItemType): void;
|
|
57
|
-
abstract getCreatedTuplesIterator(...itemTypes: ApiItemType[]): IterableIterator<ItemCreateDeltaType>;
|
|
58
|
-
getUpdatedTuplesIterator(...itemTypes: ApiItemType[]): IterableIterator<ItemUpdateDeltaType>;
|
|
59
|
-
protected getItemEntryIdMapIterator<ValueType extends {
|
|
60
|
-
entry: ItemEntry<any>;
|
|
61
|
-
}>(itemTypes: ApiItemType[], itemEntryIdMap: {
|
|
62
|
-
[itemEntryId: number]: ValueType;
|
|
63
|
-
}): Generator<ValueType>;
|
|
64
67
|
getUpdatedValue<ItemTypeType extends ApiItemType, ColumnId extends ItemTypeColumnId<ItemTypeType>>(itemEntry: ItemEntry<ItemTypeType>, columnId: ColumnId): GetFieldValueType<ItemTypeType, ColumnId> | undefined;
|
|
65
68
|
hasDeletedItem<ItemTypeType extends ApiItemType>(itemEntry: ItemEntry<ItemTypeType>): boolean;
|
|
66
69
|
hasUpdatedValue<ItemTypeType extends ApiItemType>(itemEntry: ItemEntry<ItemTypeType>, columnId: ItemTypeColumnId<ItemTypeType>): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApiRequestService,
|
|
1
|
+
import { ApiRequestService, ChangesCompilationFactory, ChangesDeltaFactory, ErrorHandlerInterface, ItemIdConversionMap, RequestBufferManager, RequestColumnExpansionFactory, TransactionCache } from '../internal';
|
|
2
2
|
export type OnAfterCreateCallback = (conversionMap: ItemIdConversionMap) => void;
|
|
3
3
|
/**
|
|
4
4
|
* @description
|
|
@@ -6,17 +6,17 @@ export type OnAfterCreateCallback = (conversionMap: ItemIdConversionMap) => void
|
|
|
6
6
|
*/
|
|
7
7
|
export declare class ChangesProcessor {
|
|
8
8
|
private apiRequestService;
|
|
9
|
+
private changesCompilationFactory;
|
|
9
10
|
private changesDeltaFactory;
|
|
10
11
|
private errorHandler;
|
|
11
12
|
private requestBufferManager;
|
|
12
13
|
private requestColumnExpansionFactory;
|
|
13
14
|
private transaction;
|
|
14
|
-
private changesCompilation;
|
|
15
15
|
private breakUpByParent?;
|
|
16
16
|
private onAfterCreateCallback?;
|
|
17
17
|
private itemIdConversionMap;
|
|
18
18
|
private serverCache;
|
|
19
|
-
constructor(apiRequestService: ApiRequestService, changesDeltaFactory: ChangesDeltaFactory, errorHandler: ErrorHandlerInterface, requestBufferManager: RequestBufferManager, requestColumnExpansionFactory: RequestColumnExpansionFactory, transaction: TransactionCache,
|
|
19
|
+
constructor(apiRequestService: ApiRequestService, changesCompilationFactory: ChangesCompilationFactory, changesDeltaFactory: ChangesDeltaFactory, errorHandler: ErrorHandlerInterface, requestBufferManager: RequestBufferManager, requestColumnExpansionFactory: RequestColumnExpansionFactory, transaction: TransactionCache, breakUpByParent?: boolean | undefined, onAfterCreateCallback?: OnAfterCreateCallback | undefined);
|
|
20
20
|
/**
|
|
21
21
|
* @description
|
|
22
22
|
* Executes the requests in the order of:
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import { ApiItemType
|
|
2
|
-
import { ChangesDeltaBase, ChangesDeltaBaseItemDeleteDelta, ChangesDeltaBaseItemUpdateDelta, ChangesDeltaItemUpdateMode, FieldMap,
|
|
1
|
+
import { ApiItemType } from '@rentman/backend-types';
|
|
2
|
+
import { ChangesDeltaBase, ChangesDeltaBaseItemDeleteDelta, ChangesDeltaBaseItemUpdateDelta, ChangesDeltaItemUpdateMode, FieldMap, ItemEntry, ItemEntryService } from '../internal';
|
|
3
3
|
export type ChildChangesDeltaItemCreateDelta<ItemTypeType extends ApiItemType = any> = {
|
|
4
4
|
entry: ItemEntry<ItemTypeType>;
|
|
5
5
|
fields: FieldMap<ItemTypeType>;
|
|
6
6
|
};
|
|
7
|
-
export type ChangesDeltaResult = {
|
|
8
|
-
/**
|
|
9
|
-
* The changes delta included in the changes delta result is not necessarily the same as the one being passed to
|
|
10
|
-
* the `applyChangesDelta()` method, as business logic rules might have been applied.
|
|
11
|
-
*/
|
|
12
|
-
changesDelta: ChildChangesDelta;
|
|
13
|
-
created: ItemEntry[];
|
|
14
|
-
allChildrenDonePromise: Promise<void>;
|
|
15
|
-
};
|
|
16
7
|
export interface ChildChangesDeltaItemUpdateDelta<ItemTypeType extends ApiItemType> extends ChangesDeltaBaseItemUpdateDelta<ItemTypeType> {
|
|
17
8
|
entry: ItemEntry<ItemTypeType>;
|
|
18
9
|
changes: {
|
|
@@ -31,16 +22,14 @@ export interface ChildChangesDeltaItemDeleteDelta<ItemTypeType extends ApiItemTy
|
|
|
31
22
|
*
|
|
32
23
|
* Use this when calling {@link TransactionCache.applyChangesFromChild}.
|
|
33
24
|
*/
|
|
34
|
-
export declare class ChildChangesDelta extends ChangesDeltaBase<
|
|
25
|
+
export declare class ChildChangesDelta extends ChangesDeltaBase<ChildChangesDeltaItemDeleteDelta<any>> {
|
|
26
|
+
updated: {
|
|
27
|
+
[itemEntryId: number]: ChildChangesDeltaItemUpdateDelta<any>;
|
|
28
|
+
};
|
|
35
29
|
created: {
|
|
36
30
|
[itemEntryId: string]: ChildChangesDeltaItemCreateDelta;
|
|
37
31
|
};
|
|
38
|
-
|
|
39
|
-
* We declare this method to provide the `ItemType` type variable to the result.
|
|
40
|
-
*/
|
|
41
|
-
getUpdatedTuplesIterator: <ItemTypes extends ApiItemType[]>(...itemTypes: ItemTypes) => IterableIterator<ChildChangesDeltaItemUpdateDelta<ItemTypes extends [] ? any : ItemTypes[number]>>;
|
|
42
|
-
getCreatedTuplesIterator<ItemTypes extends ApiItemType[]>(...itemTypes: ItemTypes): IterableIterator<ChildChangesDeltaItemCreateDelta<ItemTypes extends [] ? any : ItemTypes[number]>>;
|
|
43
|
-
getCreatedValueByItemId<ItemTypeType extends ApiItemType, ColumnId extends ItemTypeColumnId<ItemTypeType>>(itemType: ItemTypeType, itemId: ItemId<ItemTypeType>, columnId: ColumnId): GetFieldValueType<ItemTypeType, ColumnId> | undefined;
|
|
32
|
+
constructor(itemEntryService: ItemEntryService);
|
|
44
33
|
setItemUpdated<ItemTypeType extends ApiItemType>(entry: ItemEntry<ItemTypeType>, fields: Readonly<Partial<FieldMap<ItemTypeType>>>, mode?: ChangesDeltaItemUpdateMode): this;
|
|
45
34
|
setItemDeleted(tuple: ChildChangesDeltaItemDeleteDelta<any>): this;
|
|
46
35
|
setItemsDeleted(deleted: ChildChangesDeltaItemDeleteDelta<any>[]): this;
|
|
@@ -12,10 +12,10 @@ export declare class CreatedChangesDelta {
|
|
|
12
12
|
remove(itemType: ApiItemType, itemId: ItemId): boolean;
|
|
13
13
|
add<ItemTypeType extends ApiItemType>(itemId: ItemId, fields: Partial<FieldMap<ItemTypeType>>, columns: ColumnSet<ItemTypeType>): void;
|
|
14
14
|
isEmpty(): boolean;
|
|
15
|
-
getTuplesIterator<
|
|
15
|
+
getTuplesIterator<ItemTypeType extends ApiItemType>(itemType: ItemTypeType): IterableIterator<ChangesDeltaItemCreateDelta<ItemTypeType>>;
|
|
16
16
|
forEach(callback: (tuple: ChangesDeltaItemCreateDelta, itemType: ApiItemType) => void): void;
|
|
17
|
+
forEachOfItemType(itemType: ApiItemType, callback: (tuple: ChangesDeltaItemCreateDelta) => void): void;
|
|
17
18
|
contains(itemType: ApiItemType): boolean;
|
|
18
19
|
getTupleByItemId<ItemTypeType extends ApiItemType>(itemType: ItemTypeType, itemId: ItemId): ChangesDeltaItemCreateDelta<ItemTypeType> | undefined;
|
|
19
20
|
matchTuplesToQueryGraph<ItemTypeType extends ApiItemType>(itemType: ItemTypeType, queryGraph: RootQueryNode<ItemTypeType>, matchesAccumulator: MatchesAccumulator<ChangesDeltaItemCreateDelta<ItemTypeType>>): MatchesAccumulator<ChangesDeltaItemCreateDelta<ItemTypeType>>;
|
|
20
|
-
[Symbol.iterator](): Generator<ChangesDeltaItemCreateDelta>;
|
|
21
21
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApiItemType } from '@rentman/backend-types';
|
|
2
|
-
import { ChangesDeltaBase, ChangesDeltaBaseItemUpdateDelta, ChangesDeltaItemUpdateMode, ChildChangesDeltaItemCreateDelta, FieldMap, ItemEntry } from '../internal';
|
|
2
|
+
import { ChangesDeltaBase, ChangesDeltaBaseItemUpdateDelta, ChangesDeltaItemUpdateMode, ChildChangesDeltaItemCreateDelta, FieldMap, ItemEntry, ItemEntryService } from '../internal';
|
|
3
3
|
export interface ParentChangesDeltaItemUpdateDelta<ItemTypeType extends ApiItemType> extends ChangesDeltaBaseItemUpdateDelta<ItemTypeType> {
|
|
4
4
|
entry: ItemEntry<ItemTypeType>;
|
|
5
5
|
changes: {
|
|
@@ -19,15 +19,14 @@ export interface ParentChangesDeltaItemUpdateDelta<ItemTypeType extends ApiItemT
|
|
|
19
19
|
*
|
|
20
20
|
* Use this when calling {@link TransactionCache.applyChangesFromParent applyChangesFromParent}
|
|
21
21
|
*/
|
|
22
|
-
export declare class ParentChangesDelta extends ChangesDeltaBase
|
|
22
|
+
export declare class ParentChangesDelta extends ChangesDeltaBase {
|
|
23
|
+
updated: {
|
|
24
|
+
[itemEntryId: number]: ParentChangesDeltaItemUpdateDelta<any>;
|
|
25
|
+
};
|
|
23
26
|
created: {
|
|
24
27
|
[itemEntryId: string]: ChildChangesDeltaItemCreateDelta;
|
|
25
28
|
};
|
|
26
|
-
|
|
27
|
-
* We declare this method to provide the `ItemType` type variable to the result.
|
|
28
|
-
*/
|
|
29
|
-
getUpdatedTuplesIterator: <ItemTypes extends ApiItemType[]>(...itemTypes: ItemTypes) => IterableIterator<ParentChangesDeltaItemUpdateDelta<ItemTypes extends [] ? any : ItemTypes[number]>>;
|
|
30
|
-
getCreatedTuplesIterator<ItemTypes extends ApiItemType[]>(...itemTypes: ItemTypes): IterableIterator<ChildChangesDeltaItemCreateDelta<ItemTypes extends [] ? any : ItemTypes[number]>>;
|
|
29
|
+
constructor(itemEntryService: ItemEntryService, queryItemTypes?: Iterable<ApiItemType>);
|
|
31
30
|
/**
|
|
32
31
|
* @param entry
|
|
33
32
|
* @param fields
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApiItemType } from '@rentman/backend-types';
|
|
2
|
-
import { ApiRequestService, ChangesDeltaFactory, ColumnCache, ErrorHandlerInterface, RequestColumnExpansionFactory, RequestColumnsOperationsCacheFactory, SocketMessage, TransactionCacheFactory } from '../internal';
|
|
2
|
+
import { ApiRequestService, ChangesDeltaFactory, ChangesDeltaResult, ColumnCache, ErrorHandlerInterface, RequestColumnExpansionFactory, RequestColumnsOperationsCacheFactory, SocketMessage, TransactionCacheFactory } from '../internal';
|
|
3
3
|
export declare class SocketMessageHandler {
|
|
4
4
|
private changesDeltaFactory;
|
|
5
5
|
private columnCache;
|
|
@@ -10,9 +10,7 @@ export declare class SocketMessageHandler {
|
|
|
10
10
|
private readonly logPrefix;
|
|
11
11
|
private readonly requestBufferManager;
|
|
12
12
|
constructor(changesDeltaFactory: ChangesDeltaFactory, columnCache: ColumnCache, errorHandler: ErrorHandlerInterface, requestColumnExpansionFactory: RequestColumnExpansionFactory, transactionCacheFactory: TransactionCacheFactory, apiRequestService: ApiRequestService, requestColumnsOperationsCacheFactory: RequestColumnsOperationsCacheFactory);
|
|
13
|
-
onMessagesReceived(messages: SocketMessage<any>[], flushTimeout?: number): Promise<
|
|
14
|
-
allChildrenDonePromise: Promise<void>;
|
|
15
|
-
}>;
|
|
13
|
+
onMessagesReceived(messages: SocketMessage<any>[], flushTimeout?: number): Promise<ChangesDeltaResult>;
|
|
16
14
|
refreshItemsOfType(itemType: ApiItemType): Promise<void>;
|
|
17
15
|
private handleDelete;
|
|
18
16
|
private logFetchedItems;
|
|
@@ -25,7 +25,6 @@ export interface Deferred<T> {
|
|
|
25
25
|
resolve(value?: T | PromiseLike<T>): void;
|
|
26
26
|
reject(reason?: any): void;
|
|
27
27
|
}
|
|
28
|
-
export declare function promiseWrapTimeout<T>(promise: Promise<T>, createError: () => Error, timeMilliseconds: number): Promise<T>;
|
|
29
28
|
export declare function promiseCreateDeferred<T>(): Deferred<T>;
|
|
30
29
|
export declare function isRegExp(value: any): boolean;
|
|
31
30
|
export declare function isBoolean(value: any): value is boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApiItemType } from '@rentman/backend-types';
|
|
2
2
|
import { RmCore } from '../../core';
|
|
3
|
-
import { AbstractCacheDependencyInterface, CachedQueryHandlerBase, CachedQueryItem, ChangesDelta, ChangesDeltaItemCreateDelta, ChildChangesDelta, CollectionQuery, EntryParentNull, FieldMap, ItemCache, ItemEntry, ItemEntryChangesTuple, ItemHandlerBase, ItemIdConversionMap, ParentChangesDelta, ServerCache, TransactionCache, TransactionValidatorFactory } from '../../internal';
|
|
3
|
+
import { AbstractCacheDependencyInterface, CachedQueryHandlerBase, CachedQueryItem, ChangesDelta, ChangesDeltaItemCreateDelta, ChildChangesDelta, CollectionQuery, EntryParentNull, FieldMap, ItemCache, ItemEntry, ItemEntryChangesTuple, ItemHandlerBase, ItemIdConversionMap, OnAfterCreateCallback, ParentChangesDelta, ServerCache, TransactionCache, TransactionValidatorFactory } from '../../internal';
|
|
4
4
|
export type TransactionOptions = {
|
|
5
5
|
/**
|
|
6
6
|
* @description
|
|
@@ -52,6 +52,11 @@ export declare abstract class AbstractCache {
|
|
|
52
52
|
* Gets an already cached {@link ItemEntry ItemEntry} and the changes of this specific transaction for that entry
|
|
53
53
|
*/
|
|
54
54
|
getLocalItemEntryChangesTuple<ItemTypeType extends ApiItemType>(itemEntryId: ItemEntry<ItemTypeType>['id']): ItemEntryChangesTuple<ItemTypeType>;
|
|
55
|
+
/**
|
|
56
|
+
* @description
|
|
57
|
+
* Applies changes from a child transaction to a parent
|
|
58
|
+
*/
|
|
59
|
+
abstract applyChangesFromChild(transaction: TransactionCache, breakUpByParent?: boolean, onAfterCreateCallback?: OnAfterCreateCallback): Promise<ItemIdConversionMap>;
|
|
55
60
|
/**
|
|
56
61
|
* @description
|
|
57
62
|
* Called by a parent transaction, propagates changes downwards to all child caches
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApiFieldsOnDeleteRule, ApiItemType } from '@rentman/backend-types';
|
|
2
|
-
import { AbstractCache, ApiRequestColumnMap, ApiRequestColumns, ApiResponseProcessor, CachedQueryItem, ChangesDelta, ChangesDeltaBase, ChangesDeltaItemUpdateMode, CollectionQuery, CollectionResource, ConversionMap, DeregFunction, EntryParent, FieldMap, ItemEntry, ItemIdConversionMap, OnAfterCreateCallback, ParentChangesDelta, RequestBufferManager, RequestColumnExpansion, ResponseColumnItemTypeMap, ResponseItemUpdateModeMap, RmCore, ServerCacheDependencyInterface, ServerCachedQueryHandler, ServerItemHandler, TransactionCache, TransactionOptions, TransactionValidatorFactory } from '../../../internal';
|
|
2
|
+
import { AbstractCache, ApiRequestColumnMap, ApiRequestColumns, ApiResponseProcessor, CachedQueryItem, ChangesDelta, ChangesDeltaBase, ChangesDeltaItemUpdateMode, ChangesDeltaResult, CollectionQuery, CollectionResource, ConversionMap, DeregFunction, EntryParent, FieldMap, ItemEntry, ItemIdConversionMap, OnAfterCreateCallback, ParentChangesDelta, RequestBufferManager, RequestColumnExpansion, ResponseColumnItemTypeMap, ResponseItemUpdateModeMap, RmCore, ServerCacheDependencyInterface, ServerCachedQueryHandler, ServerItemHandler, TransactionCache, TransactionOptions, TransactionValidatorFactory } from '../../../internal';
|
|
3
3
|
type OnDeltaAppliedCallback = (delta: ChangesDeltaBase) => unknown;
|
|
4
4
|
export type ActiveItemEntries = Set<ItemEntry>;
|
|
5
5
|
/**
|
|
@@ -64,9 +64,7 @@ export declare class ServerCache extends AbstractCache {
|
|
|
64
64
|
* `applyChangesDelta` also ensures any required derived values are properly fetched
|
|
65
65
|
* (which `applyChangesFromParent` doesn't)
|
|
66
66
|
*/
|
|
67
|
-
applyChangesDelta(changesDelta: ChangesDelta, isCalledAfterSocketUpdate?: boolean, conversionMap?: ItemIdConversionMap): Promise<
|
|
68
|
-
allChildrenDonePromise: Promise<void>;
|
|
69
|
-
}>;
|
|
67
|
+
applyChangesDelta(changesDelta: ChangesDelta, isCalledAfterSocketUpdate?: boolean, conversionMap?: ItemIdConversionMap): Promise<ChangesDeltaResult>;
|
|
70
68
|
getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry;
|
|
71
69
|
getLocalItemEntryByItemId<const ItemTypeType extends ApiItemType>(itemType: ItemTypeType, itemId: ItemEntry<ItemTypeType>['itemId']): ItemEntry<ItemTypeType>;
|
|
72
70
|
containsLocalItemEntryByItemId(itemType: ApiItemType, itemId: ItemEntry['itemId']): boolean;
|
|
@@ -93,8 +93,7 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
93
93
|
readonly validator?: TransactionValidator;
|
|
94
94
|
validatorWithDependencies?: TransactionValidatorWithDependencies<any>;
|
|
95
95
|
private readonly options;
|
|
96
|
-
private
|
|
97
|
-
private numPendingActions;
|
|
96
|
+
private changesDeltasBeingApplied;
|
|
98
97
|
private transactionStateSignal;
|
|
99
98
|
isSavingSignal: import("@angular/core").Signal<boolean>;
|
|
100
99
|
isReadySignal: import("@angular/core").Signal<boolean>;
|
|
@@ -107,21 +106,6 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
107
106
|
* For debugging purposes
|
|
108
107
|
*/
|
|
109
108
|
id?: string | undefined, validatorFactory?: TransactionValidatorFactory, options?: Partial<TransactionOptions>);
|
|
110
|
-
/**
|
|
111
|
-
* Ideally, in order for transaction changes to be deterministic, we only want to have a single process mutating the
|
|
112
|
-
* transaction. These can be:
|
|
113
|
-
* - a child transaction saving (calling `applyChangesFromChild`);
|
|
114
|
-
* - this transaction saving (which might cause changes coming down from the server cache);
|
|
115
|
-
* - a user applying changes to the transaction.
|
|
116
|
-
*
|
|
117
|
-
* Note that `applyChangesFromParent` should not enqueue an action, because this method is called when processing
|
|
118
|
-
* user changes and saving the transaction. This could potentially cause inconsistencies, when changes come down
|
|
119
|
-
* from the parent transaction, though the chance is very small.
|
|
120
|
-
*
|
|
121
|
-
* @param state When set, immediately set the transaction state property, overwriting any previous state. The state
|
|
122
|
-
* reverts to `Ready` when all pending actions have been completed.
|
|
123
|
-
*/
|
|
124
|
-
private enqueueAction;
|
|
125
109
|
/**
|
|
126
110
|
* @deprecated use rootItemSignal instead
|
|
127
111
|
*
|
|
@@ -167,15 +151,13 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
167
151
|
*/
|
|
168
152
|
isPending(): boolean;
|
|
169
153
|
/**
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* transaction while it is pending, use the `applyChangesDelta` parameter passed to the promise function.
|
|
154
|
+
* @description
|
|
155
|
+
* Sets the transactionstate to pending, must recieve a promise as a parameter, on promise resolve, transactionstate gets put back to ready
|
|
156
|
+
* If the transaction is already in state saving, we use that and let the save function return it to ready
|
|
157
|
+
* @param promise
|
|
175
158
|
*/
|
|
176
|
-
setPending
|
|
159
|
+
setPending(promise: Promise<any>): Promise<any>;
|
|
177
160
|
createChild(id?: string, validatorFactory?: TransactionValidatorFactory, options?: TransactionOptions): TransactionCache;
|
|
178
|
-
createBusinessLogicChild(): TransactionCache;
|
|
179
161
|
destroy(): void;
|
|
180
162
|
/**
|
|
181
163
|
* @deprecated use isDestroyedSignal instead
|
|
@@ -222,31 +204,21 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
222
204
|
*/
|
|
223
205
|
applyChangesFromParent(parentChangesDelta: ParentChangesDelta, isCalledAfterSocketUpdate?: boolean, conversionMap?: ItemIdConversionMap): Promise<void>;
|
|
224
206
|
/**
|
|
225
|
-
* Applies changes
|
|
226
|
-
* 1. create a child transaction;
|
|
227
|
-
* 2. apply the changes on the child transaction;
|
|
228
|
-
* 3. run business logic on the child transaction;
|
|
229
|
-
* 4. apply the resulting changes on this transaction using `applyChangesFromChild`.
|
|
207
|
+
* Applies changes to this transaction and its children.
|
|
230
208
|
*
|
|
231
|
-
*
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* See {@link applyChangesDelta}. We're introducing a separate method here to facilitate handling the resulting
|
|
236
|
-
* promise.
|
|
237
|
-
*/
|
|
238
|
-
private doApplyChangesFromUser;
|
|
239
|
-
/**
|
|
240
|
-
* This method is called:
|
|
241
|
-
* - when initially constructing the business logic child transaction;
|
|
242
|
-
* - when applying the changes resulting from running a business logic cycle.
|
|
209
|
+
* The difference between {@link TransactionCache.applyChangesFromParent} and {@link TransactionCache.applyChangesDelta}
|
|
210
|
+
* is that applyChangesFromParent assumes the change has already been processed on the parent, and applyChangesDelta
|
|
211
|
+
* will process the changes itself.
|
|
243
212
|
*
|
|
244
|
-
*
|
|
213
|
+
* Please note that the resulting promise resolves before deletes have been processed. Deletes are processed after
|
|
214
|
+
* the changes have been applied to child transactions. This is reflected by the `allChildrenDonePromise` on the
|
|
215
|
+
* result.
|
|
245
216
|
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
217
|
+
* However, {@link TransactionCache.save} waits until the complete changes delta has been applied, so calling `save`
|
|
218
|
+
* after `applyChangesDelta` should not cause any problems.
|
|
248
219
|
*/
|
|
249
|
-
|
|
220
|
+
applyChangesDelta(changesDelta: ChangesDelta | ChildChangesDelta): Promise<ChangesDeltaResult>;
|
|
221
|
+
private trackChangesDeltaBeingApplied;
|
|
250
222
|
getRootTransaction(): TransactionCache;
|
|
251
223
|
getServerCache(): ServerCache;
|
|
252
224
|
getCollectionChangesRecursively<const ItemTypeType extends ApiItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery<ItemTypeType>): CachedQueryItem<ItemTypeType> | undefined;
|
|
@@ -259,19 +231,10 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
259
231
|
* @description
|
|
260
232
|
* Saves the transaction, this has a different effect depending on the transaction's parent.
|
|
261
233
|
*
|
|
262
|
-
* - If the parent is another {@link TransactionCache TransactionCache} it will merge the changes of the child
|
|
263
|
-
*
|
|
264
|
-
* - If the parent is the {@link ServerCache ServerCache} it will save the changes to the API
|
|
265
|
-
*
|
|
266
|
-
* Note that, when saving, we need to await:
|
|
267
|
-
* - any changes being made on this transaction;
|
|
268
|
-
* - any changes being made on the parent transaction.
|
|
234
|
+
* - If the parent is another {@link TransactionCache TransactionCache} it will merge the changes of the child transaction in the the parent transaction
|
|
235
|
+
* - If the parent is the {@link ServerCache ServerCache} it will save the changes to the APi
|
|
269
236
|
*/
|
|
270
237
|
save(closeTab?: boolean, parameters?: CreateRequestParameterMap, breakUpByParent?: boolean, onAfterCreateCallback?: OnAfterCreateCallback): Promise<ItemIdConversionMap>;
|
|
271
|
-
/**
|
|
272
|
-
* See {@link save}. We're introducing a separate method here to facilitate handling the resulting promise.
|
|
273
|
-
*/
|
|
274
|
-
private doSave;
|
|
275
238
|
/**
|
|
276
239
|
* Rejects when another user is holding the lock, as opposed to {@link LockService.fetchLock}.
|
|
277
240
|
*/
|
|
@@ -342,20 +305,10 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
342
305
|
*/
|
|
343
306
|
fetchTitle(itemType: ApiItemType, itemId: ItemId): Promise<string>;
|
|
344
307
|
/**
|
|
345
|
-
*
|
|
346
|
-
* transactions
|
|
347
|
-
*
|
|
348
|
-
* This method is called when saving a child transaction and when applying user changes (after business logic is
|
|
349
|
-
* done.)
|
|
350
|
-
*
|
|
351
|
-
* This method assumes derived for updated and created items are already resolved.
|
|
352
|
-
*
|
|
353
|
-
* @param childTransaction - Note that we're passing the transaction itself here, as we should only read the changes
|
|
354
|
-
* before processing them. This assures that, when `applyChangesFromChild` is queued multiple times, the changes
|
|
355
|
-
* are only applied once. (However, this is largely a theoretical issue.)
|
|
308
|
+
* @description
|
|
309
|
+
* Merges the passed child Transaction into this transaction and then propagates them to the other child transactions
|
|
356
310
|
*/
|
|
357
|
-
applyChangesFromChild(childTransaction:
|
|
358
|
-
private doApplyChangesFromChild;
|
|
311
|
+
applyChangesFromChild(childTransaction: TransactionCache): Promise<ItemIdConversionMap>;
|
|
359
312
|
/**
|
|
360
313
|
* @description
|
|
361
314
|
* Gets an ItemEntry from the cache, doesn't do a API request, used for saving
|
|
@@ -380,6 +333,7 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
380
333
|
clearItemError(itemEntryId: ItemEntry['id'], columnId?: string, errorKey?: string): void;
|
|
381
334
|
clearItemError(itemEntryId: ItemEntry['id'], columnId: string, errorKey?: string): void;
|
|
382
335
|
clearItemError(itemEntryId: ItemEntry['id'], columnId: string, errorKey: string): void;
|
|
336
|
+
private doApplyChangesDelta;
|
|
383
337
|
private updateSignals;
|
|
384
338
|
/**
|
|
385
339
|
* This method:
|
package/dist/types/src/core.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { QueryService } from './classes/QueryService';
|
|
|
12
12
|
import { SocketMessageHandler } from './classes/SocketMessageHandler';
|
|
13
13
|
import { TemplateCache } from './classes/TemplateCache';
|
|
14
14
|
import { ApiResponseProcessorFactory } from './factories/ApiResponseProcessorFactory';
|
|
15
|
+
import { ChangesCompilationFactory } from './factories/ChangesCompilationFactory';
|
|
15
16
|
import { ChangesDeltaFactory } from './factories/ChangesDeltaFactory';
|
|
16
17
|
import { CollectionResourceFactory } from './factories/CollectionResourceFactory';
|
|
17
18
|
import { ColumnExpansionFactory } from './factories/ColumnExpansionFactory';
|
|
@@ -30,6 +31,7 @@ export declare class RmCore {
|
|
|
30
31
|
version: string;
|
|
31
32
|
apiRequestService: ApiRequestService;
|
|
32
33
|
apiResponseProcessorFactory: ApiResponseProcessorFactory;
|
|
34
|
+
changesCompilationFactory: ChangesCompilationFactory;
|
|
33
35
|
changesDeltaFactory: ChangesDeltaFactory;
|
|
34
36
|
collectionResourceFactory: CollectionResourceFactory;
|
|
35
37
|
columnCache: ColumnCache;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { AbstractCacheDependencyInterface, ApiRequestService, ItemCreateService } from '../internal';
|
|
1
|
+
import { AbstractCacheDependencyInterface, ApiRequestService, ChangesCompilationFactory, ItemCreateService } from '../internal';
|
|
2
2
|
export interface ServerCacheDependencyInterface extends AbstractCacheDependencyInterface {
|
|
3
3
|
apiRequestService: ApiRequestService;
|
|
4
4
|
itemCreateService: ItemCreateService;
|
|
5
|
+
changesCompilationFactory: ChangesCompilationFactory;
|
|
5
6
|
}
|
|
@@ -86,6 +86,7 @@ export * from './classes/BusinessLogicManager/registeredBusinessLogicRules';
|
|
|
86
86
|
export * from './classes/BusinessLogicManager/BusinessLogicManager';
|
|
87
87
|
export * from './classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/TimeColumnUtil';
|
|
88
88
|
export * from './factories/ApiResponseProcessorFactory';
|
|
89
|
+
export * from './factories/ChangesCompilationFactory';
|
|
89
90
|
export * from './factories/CollectionResourceFactory';
|
|
90
91
|
export * from './factories/ColumnExpansionFactory';
|
|
91
92
|
export * from './factories/ColumnInfoFactory';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rentman/rm-core",
|
|
3
|
-
"version": "63.4.1
|
|
3
|
+
"version": "63.4.1",
|
|
4
4
|
"description": "Rentman core functionalities",
|
|
5
5
|
"main": "./dist/rm-core.js",
|
|
6
6
|
"types": "./dist/types/src/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@angular/core": "^20",
|
|
17
17
|
"@eslint/js": "^9.8.0",
|
|
18
|
-
"@rentman/backend-types": "
|
|
18
|
+
"@rentman/backend-types": "4.849.0-25-g7d7a8df2b6",
|
|
19
19
|
"@stylistic/eslint-plugin-ts": "^2.7.2",
|
|
20
20
|
"@types/eslint__js": "^8.42.3",
|
|
21
21
|
"clean-webpack-plugin": "^0.1.19",
|