@rentman/rm-core 63.4.1 → 64.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/rm-core.js +1 -1
  2. package/dist/rm-core.js.map +1 -1
  3. package/dist/types/src/classes/BusinessLogicManager/AantalBusinessLogicRuleBase.d.ts +9 -11
  4. package/dist/types/src/classes/BusinessLogicManager/AantaltotaalBusinessLogicRuleBase.d.ts +12 -11
  5. package/dist/types/src/classes/BusinessLogicManager/BusinessLogicManager.d.ts +6 -7
  6. package/dist/types/src/classes/BusinessLogicManager/BusinessLogicRule.d.ts +2 -9
  7. package/dist/types/src/classes/BusinessLogicManager/BusinessLogicRuleApplyContext.d.ts +3 -10
  8. package/dist/types/src/classes/BusinessLogicManager/BusinessLogicRuleConditionContext.d.ts +5 -17
  9. package/dist/types/src/classes/BusinessLogicManager/BusinessLogicRuleContextBase.d.ts +4 -55
  10. package/dist/types/src/classes/BusinessLogicManager/Customfield/CustomFieldLinkedItemTypeBusinessLogicRule.d.ts +2 -1
  11. package/dist/types/src/classes/BusinessLogicManager/Customfield/CustomFieldTypeBusinessLogicRule.d.ts +2 -1
  12. package/dist/types/src/classes/BusinessLogicManager/DefaultContactPersonUpdateBusinessLogicRule.d.ts +34 -13
  13. package/dist/types/src/classes/BusinessLogicManager/Documents/DocumentTemplateBusinessLogicRule.d.ts +3 -2
  14. package/dist/types/src/classes/BusinessLogicManager/Exemplaar/ExemplaarAanschafdatumBusinessLogicRule.d.ts +2 -1
  15. package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurBetalingsconditieBusinessLogicRule.d.ts +11 -6
  16. package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurDatumBusinessLogicRule.d.ts +5 -4
  17. package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurNumberseriesBusinessLogicRule.d.ts +2 -1
  18. package/dist/types/src/classes/BusinessLogicManager/Files/FilesNameExtensionBusinessLogicRule.d.ts +3 -2
  19. package/dist/types/src/classes/BusinessLogicManager/Functie/FunctieNaaminternBusinessLogicRule.d.ts +2 -1
  20. package/dist/types/src/classes/BusinessLogicManager/Functie/FunctieTwowayBusinessLogicRule.d.ts +2 -1
  21. package/dist/types/src/classes/BusinessLogicManager/Functie/functieTravelDistanceUtils.d.ts +1 -1
  22. package/dist/types/src/classes/BusinessLogicManager/Functiegroep/FunctiegroepSubprojectBusinessLogicRule.d.ts +9 -3
  23. package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalBulkToSerialBusinessLogicRule.d.ts +4 -2
  24. package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalSerialToBulkBusinessLogicRule.d.ts +4 -2
  25. package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalVerhuurBusinessLogicRule.d.ts +2 -2
  26. package/dist/types/src/classes/BusinessLogicManager/Materiaal/SurfaceArticleSizeBusinessLogicRule.d.ts +2 -10
  27. package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemBusinessLogicRuleBase.d.ts +10 -17
  28. package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemDurationBusinessLogicRule.d.ts +4 -4
  29. package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemMateriaalCatBusinessLogicRule.d.ts +6 -7
  30. package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemSubprojectBusinessLogicRule.d.ts +5 -20
  31. package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemTimeSchemeBusinessLogicRule.d.ts +7 -5
  32. package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemTimeSchemeStartBusinessLogicRule.d.ts +7 -5
  33. package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemTimeValueStartBusinessLogicRule.d.ts +6 -5
  34. package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/TimeColumnUtil.d.ts +1 -1
  35. package/dist/types/src/classes/BusinessLogicManager/OfferteContract/OfferteContractDatumBusinessLogicRule.d.ts +3 -2
  36. package/dist/types/src/classes/BusinessLogicManager/PlanningPersoneelTransport/PlanningPersoneelTransportBusinessLogicRule.d.ts +6 -4
  37. package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalOptieBusinessLogicRule.d.ts +1 -1
  38. package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalParentBusinessLogicRule.d.ts +1 -3
  39. package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalStaysAtLocationBusinessLogicRule.d.ts +3 -10
  40. package/dist/types/src/classes/BusinessLogicManager/Project/ProjectContactProjectNoteBusinessLogicRule.d.ts +5 -3
  41. package/dist/types/src/classes/BusinessLogicManager/Project/ProjectOneSubLocationAlignBusinessRule.d.ts +4 -2
  42. package/dist/types/src/classes/BusinessLogicManager/Rate/RateDeactivateExistingOnCreateBusinessLogicRule.d.ts +2 -1
  43. package/dist/types/src/classes/BusinessLogicManager/Reparatie/ReparatieExemplaarAantalBusinessLogicRule.d.ts +2 -1
  44. package/dist/types/src/classes/BusinessLogicManager/Reparatie/ReparatieLostItemExemplaarLocationBusinessLogicRule.d.ts +2 -1
  45. package/dist/types/src/classes/BusinessLogicManager/Rol/RolEditOwnDataBusinessLogicRule.d.ts +2 -3
  46. package/dist/types/src/classes/BusinessLogicManager/Rol/RolPersoneelsplannerToegangBusinessLogicRule.d.ts +2 -3
  47. package/dist/types/src/classes/BusinessLogicManager/Rol/RolProjectenBewerkenBusinessLogicRule.d.ts +2 -3
  48. package/dist/types/src/classes/BusinessLogicManager/Rol/RolProjectenToegangBusinessLogicRule.d.ts +2 -4
  49. package/dist/types/src/classes/BusinessLogicManager/Rol/RolVisibilityFinancialsBusinessLogicRule.d.ts +2 -7
  50. package/dist/types/src/classes/BusinessLogicManager/Rol/RolWarehosueTrackingLogAccessBusinessLogicRule.d.ts +2 -3
  51. package/dist/types/src/classes/BusinessLogicManager/Setinhoud/SetinhoudCreateFixedBusinessLogicRule.d.ts +4 -4
  52. package/dist/types/src/classes/BusinessLogicManager/Subproject/SubprojectInPlanningBusinessLogicRule.d.ts +2 -1
  53. package/dist/types/src/classes/BusinessLogicManager/Subproject/SubprojectOneSubLocationAlignBusinessRule.d.ts +4 -2
  54. package/dist/types/src/classes/BusinessLogicManager/Subproject/SubprojectOneSubNameAlignBusinessRule.d.ts +4 -2
  55. package/dist/types/src/classes/BusinessLogicManager/Taak/TaakDeadlineOffsetBusinessLogicRule.d.ts +2 -2
  56. package/dist/types/src/classes/BusinessLogicManager/Tijd/TijdPropagateNameToFunctiegroepBusinessLogicRule.d.ts +4 -2
  57. package/dist/types/src/classes/BusinessLogicManager/Tijd/TijdSubprojectChangedBusinessLogicRule.d.ts +6 -2
  58. package/dist/types/src/classes/BusinessLogicManager/Uren/HoursTypeBusinessLogicRuleBase.d.ts +1 -2
  59. package/dist/types/src/classes/ChangesDelta.d.ts +7 -9
  60. package/dist/types/src/classes/ChangesDeltaBase.d.ts +11 -14
  61. package/dist/types/src/classes/ChangesProcessor.d.ts +3 -3
  62. package/dist/types/src/classes/ChildChangesDelta.d.ts +18 -7
  63. package/dist/types/src/classes/CreatedChangesDelta.d.ts +2 -2
  64. package/dist/types/src/classes/ParentChangesDelta.d.ts +7 -6
  65. package/dist/types/src/classes/SocketMessageHandler.d.ts +4 -2
  66. package/dist/types/src/classes/Util.d.ts +1 -0
  67. package/dist/types/src/classes/cache/AbstractCache.d.ts +1 -6
  68. package/dist/types/src/classes/cache/server/ServerCache.d.ts +4 -2
  69. package/dist/types/src/classes/cache/transaction/TransactionCache.d.ts +69 -23
  70. package/dist/types/src/core.d.ts +0 -2
  71. package/dist/types/src/interfaces/ServerCacheDependencyInterface.d.ts +1 -2
  72. package/dist/types/src/internal.d.ts +0 -1
  73. package/package.json +2 -2
  74. package/dist/types/src/factories/ChangesCompilationFactory.d.ts +0 -5
@@ -4,10 +4,12 @@ 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"];
7
9
  type ConditionResult = ItemId[];
8
10
  type Dependency = {
9
- projectResource: ItemResource<'Project', ['id', 'naam']>;
10
- subprojectResources: ItemResource<'Subproject', ['id', 'project', 'naam']>[];
11
+ projectResource: ItemResource<'Project', typeof projectColumns>;
12
+ subprojectResources: ItemResource<'Subproject', typeof subprojectColumns>[];
11
13
  }[];
12
14
  /**
13
15
  * @description
@@ -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 ["tot", "van"];
10
+ declare const tijdColumns: readonly ["id", "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, }: Dependency): void;
24
+ apply(context: BusinessLogicRuleApplyContext, { taakResources, tijdResources, }: Dependency): void;
25
25
  calculateTaskTimeWithOffset(context: BusinessLogicRuleApplyContext, selectedDateWithoutOffset: moment.Moment, taskResource: ItemResource<'Taak', any>): moment.Moment;
26
26
  }
27
27
  export {};
@@ -4,10 +4,12 @@ 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"];
7
9
  type ConditionResult = ItemId[];
8
10
  type Dependency = {
9
- tijdResource: ItemResource<'Tijd', ['naam', 'id']>;
10
- functiegroepResource: ItemResource<'Functiegroep', ['naam']>;
11
+ tijdResource: ItemResource<'Tijd', typeof tijdColumns>;
12
+ functiegroepResource: ItemResource<'Functiegroep', typeof functiegroepColumns>;
11
13
  }[];
12
14
  /**
13
15
  * @description
@@ -1,6 +1,10 @@
1
- import { BLR_SKIP_RULE, BusinessLogicConditionResult, BusinessLogicRule, BusinessLogicRuleApplyContext, BusinessLogicRuleConditionContext, CollectionResource, ItemResource, TransactionCache } from '../../../internal';
1
+ import { ItemId } from '@rentman/backend-types';
2
+ import { BLR_SKIP_RULE, BusinessLogicRule, BusinessLogicRuleApplyContext, BusinessLogicRuleConditionContext, CollectionResource, ItemEntry, ItemResource, TransactionCache } from '../../../internal';
2
3
  declare const projectDefaultTimeColumns: readonly ["id", "gebruiksperiode", "planperiode"];
3
- type ConditionResult = BusinessLogicConditionResult<'Tijd', 'subproject'>[];
4
+ type ConditionResult = {
5
+ itemEntry: ItemEntry<'Tijd'>;
6
+ newValue: ItemId<'Subproject'>;
7
+ }[];
4
8
  type Dependency = ItemResource<'Project', typeof projectDefaultTimeColumns, {
5
9
  Subproject: CollectionResource<'Subproject', typeof projectDefaultTimeColumns>;
6
10
  }>;
@@ -1,10 +1,9 @@
1
1
  import { ItemId } from '@rentman/backend-types';
2
- import { ItemTypeColumnId } from '../../../types/ItemTypesCollection';
3
2
  import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
4
3
  import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
5
4
  type ConditionResult = ItemId<'Uren'>[];
6
5
  export declare abstract class HoursTypeBusinessLogicRuleBase<DependencyType> extends BusinessLogicRule<ConditionResult, DependencyType> {
7
- protected abstract conditionColumnId: ItemTypeColumnId<'HoursType'>;
6
+ protected abstract conditionColumnId: 'has_calculated_duration' | 'can_have_activities';
8
7
  condition(context: BusinessLogicRuleConditionContext): Promise<ConditionResult | typeof BLR_SKIP_RULE>;
9
8
  }
10
9
  export {};
@@ -22,13 +22,10 @@ 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<ChangesDeltaItemDeleteDelta<any>> {
25
+ export declare class ChangesDelta extends ChangesDeltaBase<ChangesDeltaItemCreateDelta, ChangesDeltaItemUpdateDelta<any>, ChangesDeltaItemDeleteDelta<any>> {
26
26
  logMissingColumnErrors: boolean;
27
27
  private errorHandler;
28
28
  private itemCreateService;
29
- updated: {
30
- [itemEntryId: number]: ChangesDeltaItemUpdateDelta<any>;
31
- };
32
29
  created: CreatedChangesDelta;
33
30
  /**
34
31
  * Only contains remote items, when rolling back local items the whole entries are deleted.
@@ -37,9 +34,11 @@ export declare class ChangesDelta extends ChangesDeltaBase<ChangesDeltaItemDelet
37
34
  [itemEntryId: number]: ItemEntryChangesTuple<any>;
38
35
  };
39
36
  constructor(logMissingColumnErrors: boolean, queryItemTypes: Iterable<ApiItemType> | undefined, errorHandler: ErrorHandlerInterface, itemCreateService: ItemCreateService, itemEntryService: ItemEntryService);
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;
37
+ /**
38
+ * We declare this method to provide the `ItemType` type variable to the result.
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]>>;
43
42
  /**
44
43
  * @description
45
44
  * Fetches a template for the passed itemType and processes the passed values and sets the item to be created when the delta is applied
@@ -49,7 +48,6 @@ export declare class ChangesDelta extends ChangesDeltaBase<ChangesDeltaItemDelet
49
48
  * - If you want to set a parent set the proper field, you can't pass it as a separate object
50
49
  */
51
50
  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;
53
51
  setItemUpdated<ItemTypeType extends ApiItemType>(entry: ItemEntry<ItemTypeType>, fields: Partial<FieldMap<ItemTypeType>>, columnExpansion?: ColumnExpansion<ItemTypeType> | null, parent?: EntryParentNull, mode?: ChangesDeltaItemUpdateMode): this;
54
52
  setItemDeleted(entry: ItemEntry, __isCascaded?: boolean): this;
55
53
  setItemsDeleted(deleted: ItemEntry[]): this;
@@ -75,7 +73,7 @@ export declare class ChangesDelta extends ChangesDeltaBase<ChangesDeltaItemDelet
75
73
  * @internal
76
74
  */
77
75
  _setItemCreated<ItemTypeType extends ApiItemType>(itemId: ItemId, fields: Partial<FieldMap<ItemTypeType>>, columns: ColumnSet<ItemTypeType>, parent?: EntryParentNull, isApiResponse?: boolean): this;
78
- setItemRestored<ItemTypeType extends ApiItemType>(itemEntry: ItemEntry<ItemTypeType>, transactionItemEntryChanges: FieldMap<ItemTypeType>): void;
76
+ setItemRestored<ItemTypeType extends ApiItemType>(itemEntry: ItemEntry<ItemTypeType>, transactionItemEntryChanges: FieldMap<ItemTypeType>): this;
79
77
  isEmpty(): boolean;
80
78
  toJSON(): any;
81
79
  }
@@ -1,15 +1,5 @@
1
1
  import { ApiItemType, ItemId } from '@rentman/backend-types';
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
- };
2
+ import { FieldMap, GetFieldValueType, ItemEntry, ItemEntryService, ItemTypeColumnId } from '../internal';
13
3
  export type ChangesDeltaItemUpdateMode =
14
4
  /**
15
5
  * For create/update responses you always want to overwrite whatever is cached
@@ -41,10 +31,10 @@ export interface ChangesDeltaBaseItemUpdateDelta<ItemTypeType extends ApiItemTyp
41
31
  export interface ChangesDeltaBaseItemDeleteDelta<ItemTypeType extends ApiItemType> {
42
32
  entry: ItemEntry<ItemTypeType>;
43
33
  }
44
- export declare abstract class ChangesDeltaBase<ItemDeleteDeltaType extends ChangesDeltaBaseItemDeleteDelta<any> = ChangesDeltaBaseItemDeleteDelta<any>> {
34
+ export declare abstract class ChangesDeltaBase<ItemCreateDeltaType = unknown, ItemUpdateDeltaType extends ChangesDeltaBaseItemUpdateDelta<any> = ChangesDeltaBaseItemUpdateDelta<any>, ItemDeleteDeltaType extends ChangesDeltaBaseItemDeleteDelta<any> = ChangesDeltaBaseItemDeleteDelta<any>> {
45
35
  protected itemEntryService: ItemEntryService;
46
36
  updated: {
47
- [itemEntryId: number]: ChangesDeltaBaseItemUpdateDelta<any>;
37
+ [itemEntryId: number]: ItemUpdateDeltaType;
48
38
  };
49
39
  protected deleted: {
50
40
  [ItemType in ApiItemType]?: Map<ItemEntry<ItemType>, ItemDeleteDeltaType>;
@@ -62,8 +52,15 @@ export declare abstract class ChangesDeltaBase<ItemDeleteDeltaType extends Chang
62
52
  * When set, only collections of this item type will be matched.
63
53
  */
64
54
  _queryItemTypeSet?: Set<ApiItemType>;
65
- protected constructor(itemEntryService: ItemEntryService, queryItemTypes?: Iterable<ApiItemType>);
55
+ constructor(itemEntryService: ItemEntryService, queryItemTypes?: Iterable<ApiItemType>);
66
56
  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>;
67
64
  getUpdatedValue<ItemTypeType extends ApiItemType, ColumnId extends ItemTypeColumnId<ItemTypeType>>(itemEntry: ItemEntry<ItemTypeType>, columnId: ColumnId): GetFieldValueType<ItemTypeType, ColumnId> | undefined;
68
65
  hasDeletedItem<ItemTypeType extends ApiItemType>(itemEntry: ItemEntry<ItemTypeType>): boolean;
69
66
  hasUpdatedValue<ItemTypeType extends ApiItemType>(itemEntry: ItemEntry<ItemTypeType>, columnId: ItemTypeColumnId<ItemTypeType>): boolean;
@@ -1,4 +1,4 @@
1
- import { ApiRequestService, ChangesCompilationFactory, ChangesDeltaFactory, ErrorHandlerInterface, ItemIdConversionMap, RequestBufferManager, RequestColumnExpansionFactory, TransactionCache } from '../internal';
1
+ import { ApiRequestService, ChangesCompilation, 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;
10
9
  private changesDeltaFactory;
11
10
  private errorHandler;
12
11
  private requestBufferManager;
13
12
  private requestColumnExpansionFactory;
14
13
  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, changesCompilationFactory: ChangesCompilationFactory, changesDeltaFactory: ChangesDeltaFactory, errorHandler: ErrorHandlerInterface, requestBufferManager: RequestBufferManager, requestColumnExpansionFactory: RequestColumnExpansionFactory, transaction: TransactionCache, breakUpByParent?: boolean | undefined, onAfterCreateCallback?: OnAfterCreateCallback | undefined);
19
+ constructor(apiRequestService: ApiRequestService, changesDeltaFactory: ChangesDeltaFactory, errorHandler: ErrorHandlerInterface, requestBufferManager: RequestBufferManager, requestColumnExpansionFactory: RequestColumnExpansionFactory, transaction: TransactionCache, changesCompilation: ChangesCompilation, breakUpByParent?: boolean | undefined, onAfterCreateCallback?: OnAfterCreateCallback | undefined);
20
20
  /**
21
21
  * @description
22
22
  * Executes the requests in the order of:
@@ -1,9 +1,18 @@
1
- import { ApiItemType } from '@rentman/backend-types';
2
- import { ChangesDeltaBase, ChangesDeltaBaseItemDeleteDelta, ChangesDeltaBaseItemUpdateDelta, ChangesDeltaItemUpdateMode, FieldMap, ItemEntry, ItemEntryService } from '../internal';
1
+ import { ApiItemType, ItemId } from '@rentman/backend-types';
2
+ import { ChangesDeltaBase, ChangesDeltaBaseItemDeleteDelta, ChangesDeltaBaseItemUpdateDelta, ChangesDeltaItemUpdateMode, FieldMap, GetFieldValueType, ItemEntry, ItemTypeColumnId } 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
+ };
7
16
  export interface ChildChangesDeltaItemUpdateDelta<ItemTypeType extends ApiItemType> extends ChangesDeltaBaseItemUpdateDelta<ItemTypeType> {
8
17
  entry: ItemEntry<ItemTypeType>;
9
18
  changes: {
@@ -22,14 +31,16 @@ export interface ChildChangesDeltaItemDeleteDelta<ItemTypeType extends ApiItemTy
22
31
  *
23
32
  * Use this when calling {@link TransactionCache.applyChangesFromChild}.
24
33
  */
25
- export declare class ChildChangesDelta extends ChangesDeltaBase<ChildChangesDeltaItemDeleteDelta<any>> {
26
- updated: {
27
- [itemEntryId: number]: ChildChangesDeltaItemUpdateDelta<any>;
28
- };
34
+ export declare class ChildChangesDelta extends ChangesDeltaBase<ChildChangesDeltaItemCreateDelta<any>, ChildChangesDeltaItemUpdateDelta<any>, ChildChangesDeltaItemDeleteDelta<any>> {
29
35
  created: {
30
36
  [itemEntryId: string]: ChildChangesDeltaItemCreateDelta;
31
37
  };
32
- constructor(itemEntryService: ItemEntryService);
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;
33
44
  setItemUpdated<ItemTypeType extends ApiItemType>(entry: ItemEntry<ItemTypeType>, fields: Readonly<Partial<FieldMap<ItemTypeType>>>, mode?: ChangesDeltaItemUpdateMode): this;
34
45
  setItemDeleted(tuple: ChildChangesDeltaItemDeleteDelta<any>): this;
35
46
  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<ItemTypeType extends ApiItemType>(itemType: ItemTypeType): IterableIterator<ChangesDeltaItemCreateDelta<ItemTypeType>>;
15
+ getTuplesIterator<ItemTypes extends ApiItemType[]>(itemTypes: ItemTypes): Generator<ChangesDeltaItemCreateDelta<ItemTypes extends [] ? any : ItemTypes[number]>>;
16
16
  forEach(callback: (tuple: ChangesDeltaItemCreateDelta, itemType: ApiItemType) => void): void;
17
- forEachOfItemType(itemType: ApiItemType, callback: (tuple: ChangesDeltaItemCreateDelta) => void): void;
18
17
  contains(itemType: ApiItemType): boolean;
19
18
  getTupleByItemId<ItemTypeType extends ApiItemType>(itemType: ItemTypeType, itemId: ItemId): ChangesDeltaItemCreateDelta<ItemTypeType> | undefined;
20
19
  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, ItemEntryService } from '../internal';
2
+ import { ChangesDeltaBase, ChangesDeltaBaseItemUpdateDelta, ChangesDeltaItemUpdateMode, ChildChangesDeltaItemCreateDelta, FieldMap, ItemEntry } from '../internal';
3
3
  export interface ParentChangesDeltaItemUpdateDelta<ItemTypeType extends ApiItemType> extends ChangesDeltaBaseItemUpdateDelta<ItemTypeType> {
4
4
  entry: ItemEntry<ItemTypeType>;
5
5
  changes: {
@@ -19,14 +19,15 @@ 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 {
23
- updated: {
24
- [itemEntryId: number]: ParentChangesDeltaItemUpdateDelta<any>;
25
- };
22
+ export declare class ParentChangesDelta extends ChangesDeltaBase<ChildChangesDeltaItemCreateDelta<any>, ParentChangesDeltaItemUpdateDelta<any>> {
26
23
  created: {
27
24
  [itemEntryId: string]: ChildChangesDeltaItemCreateDelta;
28
25
  };
29
- constructor(itemEntryService: ItemEntryService, queryItemTypes?: Iterable<ApiItemType>);
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]>>;
30
31
  /**
31
32
  * @param entry
32
33
  * @param fields
@@ -1,5 +1,5 @@
1
1
  import { ApiItemType } from '@rentman/backend-types';
2
- import { ApiRequestService, ChangesDeltaFactory, ChangesDeltaResult, ColumnCache, ErrorHandlerInterface, RequestColumnExpansionFactory, RequestColumnsOperationsCacheFactory, SocketMessage, TransactionCacheFactory } from '../internal';
2
+ import { ApiRequestService, ChangesDeltaFactory, ColumnCache, ErrorHandlerInterface, RequestColumnExpansionFactory, RequestColumnsOperationsCacheFactory, SocketMessage, TransactionCacheFactory } from '../internal';
3
3
  export declare class SocketMessageHandler {
4
4
  private changesDeltaFactory;
5
5
  private columnCache;
@@ -10,7 +10,9 @@ 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<ChangesDeltaResult>;
13
+ onMessagesReceived(messages: SocketMessage<any>[], flushTimeout?: number): Promise<{
14
+ allChildrenDonePromise: Promise<void>;
15
+ }>;
14
16
  refreshItemsOfType(itemType: ApiItemType): Promise<void>;
15
17
  private handleDelete;
16
18
  private logFetchedItems;
@@ -25,6 +25,7 @@ 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>;
28
29
  export declare function promiseCreateDeferred<T>(): Deferred<T>;
29
30
  export declare function isRegExp(value: any): boolean;
30
31
  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, OnAfterCreateCallback, ParentChangesDelta, ServerCache, TransactionCache, TransactionValidatorFactory } from '../../internal';
3
+ import { AbstractCacheDependencyInterface, CachedQueryHandlerBase, CachedQueryItem, ChangesDelta, ChangesDeltaItemCreateDelta, ChildChangesDelta, CollectionQuery, EntryParentNull, FieldMap, ItemCache, ItemEntry, ItemEntryChangesTuple, ItemHandlerBase, ItemIdConversionMap, ParentChangesDelta, ServerCache, TransactionCache, TransactionValidatorFactory } from '../../internal';
4
4
  export type TransactionOptions = {
5
5
  /**
6
6
  * @description
@@ -52,11 +52,6 @@ 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>;
60
55
  /**
61
56
  * @description
62
57
  * 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, ChangesDeltaResult, 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, 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,7 +64,9 @@ 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<ChangesDeltaResult>;
67
+ applyChangesDelta(changesDelta: ChangesDelta, isCalledAfterSocketUpdate?: boolean, conversionMap?: ItemIdConversionMap): Promise<{
68
+ allChildrenDonePromise: Promise<void>;
69
+ }>;
68
70
  getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry;
69
71
  getLocalItemEntryByItemId<const ItemTypeType extends ApiItemType>(itemType: ItemTypeType, itemId: ItemEntry<ItemTypeType>['itemId']): ItemEntry<ItemTypeType>;
70
72
  containsLocalItemEntryByItemId(itemType: ApiItemType, itemId: ItemEntry['itemId']): boolean;
@@ -93,7 +93,8 @@ export declare class TransactionCache extends AbstractCache {
93
93
  readonly validator?: TransactionValidator;
94
94
  validatorWithDependencies?: TransactionValidatorWithDependencies<any>;
95
95
  private readonly options;
96
- private changesDeltasBeingApplied;
96
+ private actionsQueue;
97
+ private numPendingActions;
97
98
  private transactionStateSignal;
98
99
  isSavingSignal: import("@angular/core").Signal<boolean>;
99
100
  isReadySignal: import("@angular/core").Signal<boolean>;
@@ -106,6 +107,21 @@ export declare class TransactionCache extends AbstractCache {
106
107
  * For debugging purposes
107
108
  */
108
109
  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;
109
125
  /**
110
126
  * @deprecated use rootItemSignal instead
111
127
  *
@@ -151,13 +167,15 @@ export declare class TransactionCache extends AbstractCache {
151
167
  */
152
168
  isPending(): boolean;
153
169
  /**
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
170
+ * When this method is called multiple times, the transaction state is set to `pending` until all promises are
171
+ * settled.
172
+ *
173
+ * Note that the transaction can *not* be mutated while it is pending. If you need to apply changes on the
174
+ * transaction while it is pending, use the `applyChangesDelta` parameter passed to the promise function.
158
175
  */
159
- setPending(promise: Promise<any>): Promise<any>;
176
+ setPending<Result>(promise: Promise<Result> | ((applyChangesDelta: (changesDelta: ChangesDelta) => Promise<ChangesDeltaResult>) => Promise<Result>)): Promise<Result>;
160
177
  createChild(id?: string, validatorFactory?: TransactionValidatorFactory, options?: TransactionOptions): TransactionCache;
178
+ createBusinessLogicChild(): TransactionCache;
161
179
  destroy(): void;
162
180
  /**
163
181
  * @deprecated use isDestroyedSignal instead
@@ -204,21 +222,31 @@ export declare class TransactionCache extends AbstractCache {
204
222
  */
205
223
  applyChangesFromParent(parentChangesDelta: ParentChangesDelta, isCalledAfterSocketUpdate?: boolean, conversionMap?: ItemIdConversionMap): Promise<void>;
206
224
  /**
207
- * Applies changes to this transaction and its children.
225
+ * Applies changes from the user on the transaction. This will:
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`.
208
230
  *
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.
231
+ * This method waits for other transaction processes to complete, see {@link enqueueAction}.
232
+ */
233
+ applyChangesDelta(changesDelta: ChangesDelta): Promise<ChangesDeltaResult>;
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.
212
243
  *
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.
244
+ * It does not consider children.
216
245
  *
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.
246
+ * The result of this method will be used to trigger a (new) business logic cycle. It should not contain changes
247
+ * already present on the transaction.
219
248
  */
220
- applyChangesDelta(changesDelta: ChangesDelta | ChildChangesDelta): Promise<ChangesDeltaResult>;
221
- private trackChangesDeltaBeingApplied;
249
+ applyChangesDirectly(changesDelta: ChangesDelta): Promise<ParentChangesDelta>;
222
250
  getRootTransaction(): TransactionCache;
223
251
  getServerCache(): ServerCache;
224
252
  getCollectionChangesRecursively<const ItemTypeType extends ApiItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery<ItemTypeType>): CachedQueryItem<ItemTypeType> | undefined;
@@ -231,10 +259,19 @@ export declare class TransactionCache extends AbstractCache {
231
259
  * @description
232
260
  * Saves the transaction, this has a different effect depending on the transaction's parent.
233
261
  *
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
262
+ * - If the parent is another {@link TransactionCache TransactionCache} it will merge the changes of the child
263
+ * transaction in the parent transaction
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.
236
269
  */
237
270
  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;
238
275
  /**
239
276
  * Rejects when another user is holding the lock, as opposed to {@link LockService.fetchLock}.
240
277
  */
@@ -305,10 +342,20 @@ export declare class TransactionCache extends AbstractCache {
305
342
  */
306
343
  fetchTitle(itemType: ApiItemType, itemId: ItemId): Promise<string>;
307
344
  /**
308
- * @description
309
- * Merges the passed child Transaction into this transaction and then propagates them to the other child transactions
345
+ * Merges the passed child transaction into this transaction and then propagates the changes to the other child
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.)
310
356
  */
311
- applyChangesFromChild(childTransaction: TransactionCache): Promise<ItemIdConversionMap>;
357
+ applyChangesFromChild(childTransaction: Pick<TransactionCache, 'getDelta' | 'cachedQueryHandler'>, tabRequestParameters: any): Promise<ChangesDeltaResult>;
358
+ private doApplyChangesFromChild;
312
359
  /**
313
360
  * @description
314
361
  * Gets an ItemEntry from the cache, doesn't do a API request, used for saving
@@ -333,7 +380,6 @@ export declare class TransactionCache extends AbstractCache {
333
380
  clearItemError(itemEntryId: ItemEntry['id'], columnId?: string, errorKey?: string): void;
334
381
  clearItemError(itemEntryId: ItemEntry['id'], columnId: string, errorKey?: string): void;
335
382
  clearItemError(itemEntryId: ItemEntry['id'], columnId: string, errorKey: string): void;
336
- private doApplyChangesDelta;
337
383
  private updateSignals;
338
384
  /**
339
385
  * This method:
@@ -12,7 +12,6 @@ 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';
16
15
  import { ChangesDeltaFactory } from './factories/ChangesDeltaFactory';
17
16
  import { CollectionResourceFactory } from './factories/CollectionResourceFactory';
18
17
  import { ColumnExpansionFactory } from './factories/ColumnExpansionFactory';
@@ -31,7 +30,6 @@ export declare class RmCore {
31
30
  version: string;
32
31
  apiRequestService: ApiRequestService;
33
32
  apiResponseProcessorFactory: ApiResponseProcessorFactory;
34
- changesCompilationFactory: ChangesCompilationFactory;
35
33
  changesDeltaFactory: ChangesDeltaFactory;
36
34
  collectionResourceFactory: CollectionResourceFactory;
37
35
  columnCache: ColumnCache;
@@ -1,6 +1,5 @@
1
- import { AbstractCacheDependencyInterface, ApiRequestService, ChangesCompilationFactory, ItemCreateService } from '../internal';
1
+ import { AbstractCacheDependencyInterface, ApiRequestService, ItemCreateService } from '../internal';
2
2
  export interface ServerCacheDependencyInterface extends AbstractCacheDependencyInterface {
3
3
  apiRequestService: ApiRequestService;
4
4
  itemCreateService: ItemCreateService;
5
- changesCompilationFactory: ChangesCompilationFactory;
6
5
  }
@@ -86,7 +86,6 @@ 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';
90
89
  export * from './factories/CollectionResourceFactory';
91
90
  export * from './factories/ColumnExpansionFactory';
92
91
  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": "64.0.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": "4.849.0-25-g7d7a8df2b6",
18
+ "@rentman/backend-types": "^4.852.0-ga86275b6a5",
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",
@@ -1,5 +0,0 @@
1
- import { ChangesCompilation, TransactionCache } from '../internal';
2
- export declare class ChangesCompilationFactory {
3
- constructor();
4
- construct(transaction: TransactionCache): ChangesCompilation;
5
- }