@rentman/rm-core 66.3.0 → 66.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,24 @@
1
+ import { ItemId } from '@rentman/backend-types';
2
+ import { ItemResource } from '../../../models/ItemResource';
3
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
+ import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
5
+ import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
6
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
7
+ declare const rolColumns: readonly ["medewerkers_loginfields", "medewerkers_lastseen"];
8
+ type ConditionResult = ItemId[];
9
+ type Dependency = ItemResource<'Rol', typeof rolColumns>[];
10
+ /**
11
+ * @description
12
+ * If you're not allowed to access the login fields, then you should not be able
13
+ * to see the "last seen" information either.
14
+ */
15
+ export declare class RolLoginFieldsLastSeenBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
16
+ condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
17
+ dependency(transaction: TransactionCache, rolIds: ConditionResult): Promise<Dependency>;
18
+ /**
19
+ * If access to the login fields is turned off,
20
+ * the "last seen" permission should be turned off as well.
21
+ */
22
+ apply(context: BusinessLogicRuleApplyContext, rolResources: Dependency): void;
23
+ }
24
+ export {};
@@ -53,6 +53,7 @@ import { ReparatiesExemplaarAantalBusinessLogicRule } from './Reparatie/Reparati
53
53
  import { ReparatieLostItemExemplaarLocationBusinessLogicRule } from './Reparatie/ReparatieLostItemExemplaarLocationBusinessLogicRule';
54
54
  import { RolEditOwnDataBusinessLogicRule } from './Rol/RolEditOwnDataBusinessLogicRule';
55
55
  import { RolFileAccessBusinessLogicRule } from './Rol/RolFileAccessBusinessLogicRule';
56
+ import { RolLoginFieldsLastSeenBusinessLogicRule } from './Rol/RolLoginFieldsLastSeenBusinessLogicRule';
56
57
  import { RolPersoneelsplannerToegangBusinessLogicRule } from './Rol/RolPersoneelsplannerToegangBusinessLogicRule';
57
58
  import { RolProjectenBewerkenBusinessLogicRule } from './Rol/RolProjectenBewerkenBusinessLogicRule';
58
59
  import { RolProjectenToegangBusinessLogicRule } from './Rol/RolProjectenToegangBusinessLogicRule';
@@ -68,4 +69,4 @@ import { TaakDeadlineTypeBusinessLogicRule } from './Taak/TaakDeadlineTypeBusine
68
69
  import { TaakDeadlineOffsetBusinessLogicRule } from './Taak/TaakDeadlineOffsetBusinessLogicRule';
69
70
  import { TijdPropagateNameToFunctiegroepBusinessLogicRule } from './Tijd/TijdPropagateNameToFunctiegroepBusinessLogicRule';
70
71
  import { TijdSubprojectChangedBusinessLogicRule } from './Tijd/TijdSubprojectChangedBusinessLogicRule';
71
- export declare const registeredBusinessLogicRules: readonly [typeof DefaultContactPersonUpdateBusinessLogicRule, typeof ContactAddressBusinessLogicRule, typeof CustomFieldLinkedItemTypeBusinessLogicRule, typeof CustomFieldTypeBusinessLogicRule, typeof DocumentTemplateBusinessLogicRule, typeof ExemplaarAanschafdatumBusinessLogicRule, typeof ExemplaarBarcodeDeleteBusinessLogicRule, typeof FactuurBetalingsconditieBusinessLogicRule, typeof FactuurDatumBusinessLogicRule, typeof FactuurNumberseriesBusinessLogicRule, typeof FilesNameExtensionBusinessLogicRule, typeof FunctieNaaminternBusinessLogicRule, typeof FunctieTravelDistanceFromLocationBusinessLogicRule, typeof FunctieTravelDistanceUnlinkLocationBusinessLogicRule, typeof FunctieTravelTimeFromLocationBusinessLogicRule, typeof FunctieTwowayBusinessLogicRule, typeof FunctieRecureindBusinessLogicRule, typeof FunctiegroepSubprojectBusinessLogicRule, typeof InhuurmateriaalAantaltotaalBusinessLogicRule, typeof InhuurmateriaalAantalRoundUpBusinessLogicRule, typeof MateriaalIsCombinationBusinessLogicRule, typeof MateriaalIsPhysicalCombinationBulkBusinessLogicRule, typeof MateriaalToVirtualBusinessLogicRule, typeof MateriaalToPhysicalBusinessLogicRule, typeof MateriaalBulkToSerialBusinessLogicRule, typeof MateriaalSerialToBulkBusinessLogicRule, typeof MateriaalTypePropertiesBusinessLogicRule, typeof MateriaalVerhuurBusinessLogicRule, typeof SurfaceArticleSizeBusinessLogicRule, typeof LinkedTimeItemDurationBusinessLogicRule, typeof LinkedTimeItemTimeSchemeBusinessLogicRule, typeof LinkedTimeItemTimeSchemeStartBusinessLogicRule, typeof LinkedTimeItemTimeValueStartBusinessLogicRule, typeof LinkedTimeItemSubprojectBusinessLogicRule, typeof LinkedTimeItemMateriaalCatBusinessLogicRule, typeof OfferteContractDatumBusinessLogicRule, typeof PlanningmateriaalAantalRoundUpBusinessLogicRule, typeof PlanningmateriaalAantaltotaalBusinessLogicRule, typeof PlanningmateriaalOptieBusinessLogicRule, typeof PlanningmateriaalParentBusinessLogicRule, typeof PlanningmateriaalStaysAtLocationBusinessLogicRule, typeof PlanningPersoneelTransportBusinessLogicRule, typeof ProjectClientChangedBusinessLogicRule, typeof ProjectContactProjectNoteBusinessLogicRule, typeof ProjectOneSubLocationAlignBusinessLogicRule, typeof ProjectSubprojectDefaultTimeBusinessLogicRule, typeof PurchaseOrderOwnerBusinessLogicRule, typeof PurchaseOrderApprovalStatusBusinessLogicRule, typeof RateDeactivateExistingOnCreateBusinessLogicRule, typeof ReparatiesExemplaarAantalBusinessLogicRule, typeof ReparatieLostItemExemplaarLocationBusinessLogicRule, typeof RolEditOwnDataBusinessLogicRule, typeof RolFileAccessBusinessLogicRule, typeof RolPersoneelsplannerToegangBusinessLogicRule, typeof RolProjectenBewerkenBusinessLogicRule, typeof RolProjectenToegangBusinessLogicRule, typeof RolVisibilityFinancialsBusinessLogicRule, typeof RolWarehouseTrackingLogAccessBusinessLogicRule, typeof RolPurchaseOrderAttachPlanningBusinessLogicRule, typeof SetinhoudCreateFixedBusinessLogicRule, typeof SetinhoudUpdateFixedBusinessLogicRule, typeof SubprojectOneSubLocationAlignBusinessLogicRule, typeof SubprojectOneSubNameAlignBusinessLogicRule, typeof SubprojectInPlanningBusinessLogicRule, typeof TaakDeadlineTypeBusinessLogicRule, typeof TaakDeadlineOffsetBusinessLogicRule, typeof TijdSubprojectChangedBusinessLogicRule, typeof TijdPropagateNameToFunctiegroepBusinessLogicRule, typeof AfspraakRecureindBusinessLogicRule, typeof BeschikbaarheidRecureindBusinessLogicRule];
72
+ export declare const registeredBusinessLogicRules: readonly [typeof DefaultContactPersonUpdateBusinessLogicRule, typeof ContactAddressBusinessLogicRule, typeof CustomFieldLinkedItemTypeBusinessLogicRule, typeof CustomFieldTypeBusinessLogicRule, typeof DocumentTemplateBusinessLogicRule, typeof ExemplaarAanschafdatumBusinessLogicRule, typeof ExemplaarBarcodeDeleteBusinessLogicRule, typeof FactuurBetalingsconditieBusinessLogicRule, typeof FactuurDatumBusinessLogicRule, typeof FactuurNumberseriesBusinessLogicRule, typeof FilesNameExtensionBusinessLogicRule, typeof FunctieNaaminternBusinessLogicRule, typeof FunctieTravelDistanceFromLocationBusinessLogicRule, typeof FunctieTravelDistanceUnlinkLocationBusinessLogicRule, typeof FunctieTravelTimeFromLocationBusinessLogicRule, typeof FunctieTwowayBusinessLogicRule, typeof FunctieRecureindBusinessLogicRule, typeof FunctiegroepSubprojectBusinessLogicRule, typeof InhuurmateriaalAantaltotaalBusinessLogicRule, typeof InhuurmateriaalAantalRoundUpBusinessLogicRule, typeof MateriaalIsCombinationBusinessLogicRule, typeof MateriaalIsPhysicalCombinationBulkBusinessLogicRule, typeof MateriaalToVirtualBusinessLogicRule, typeof MateriaalToPhysicalBusinessLogicRule, typeof MateriaalBulkToSerialBusinessLogicRule, typeof MateriaalSerialToBulkBusinessLogicRule, typeof MateriaalTypePropertiesBusinessLogicRule, typeof MateriaalVerhuurBusinessLogicRule, typeof SurfaceArticleSizeBusinessLogicRule, typeof LinkedTimeItemDurationBusinessLogicRule, typeof LinkedTimeItemTimeSchemeBusinessLogicRule, typeof LinkedTimeItemTimeSchemeStartBusinessLogicRule, typeof LinkedTimeItemTimeValueStartBusinessLogicRule, typeof LinkedTimeItemSubprojectBusinessLogicRule, typeof LinkedTimeItemMateriaalCatBusinessLogicRule, typeof OfferteContractDatumBusinessLogicRule, typeof PlanningmateriaalAantalRoundUpBusinessLogicRule, typeof PlanningmateriaalAantaltotaalBusinessLogicRule, typeof PlanningmateriaalOptieBusinessLogicRule, typeof PlanningmateriaalParentBusinessLogicRule, typeof PlanningmateriaalStaysAtLocationBusinessLogicRule, typeof PlanningPersoneelTransportBusinessLogicRule, typeof ProjectClientChangedBusinessLogicRule, typeof ProjectContactProjectNoteBusinessLogicRule, typeof ProjectOneSubLocationAlignBusinessLogicRule, typeof ProjectSubprojectDefaultTimeBusinessLogicRule, typeof PurchaseOrderOwnerBusinessLogicRule, typeof PurchaseOrderApprovalStatusBusinessLogicRule, typeof RateDeactivateExistingOnCreateBusinessLogicRule, typeof ReparatiesExemplaarAantalBusinessLogicRule, typeof ReparatieLostItemExemplaarLocationBusinessLogicRule, typeof RolEditOwnDataBusinessLogicRule, typeof RolFileAccessBusinessLogicRule, typeof RolLoginFieldsLastSeenBusinessLogicRule, typeof RolPersoneelsplannerToegangBusinessLogicRule, typeof RolProjectenBewerkenBusinessLogicRule, typeof RolProjectenToegangBusinessLogicRule, typeof RolVisibilityFinancialsBusinessLogicRule, typeof RolWarehouseTrackingLogAccessBusinessLogicRule, typeof RolPurchaseOrderAttachPlanningBusinessLogicRule, typeof SetinhoudCreateFixedBusinessLogicRule, typeof SetinhoudUpdateFixedBusinessLogicRule, typeof SubprojectOneSubLocationAlignBusinessLogicRule, typeof SubprojectOneSubNameAlignBusinessLogicRule, typeof SubprojectInPlanningBusinessLogicRule, typeof TaakDeadlineTypeBusinessLogicRule, typeof TaakDeadlineOffsetBusinessLogicRule, typeof TijdSubprojectChangedBusinessLogicRule, typeof TijdPropagateNameToFunctiegroepBusinessLogicRule, typeof AfspraakRecureindBusinessLogicRule, typeof BeschikbaarheidRecureindBusinessLogicRule];
@@ -7,6 +7,7 @@ export type TransactionOptions = {
7
7
  * Sets the TransactionCache to 'transparent' mode, whenever {@link AbstractCache.createChild createChild} is called it will actually be called on the parent
8
8
  */
9
9
  transparent: boolean;
10
+ autoSave: boolean;
10
11
  };
11
12
  export declare abstract class AbstractCache {
12
13
  dependencies: AbstractCacheDependencyInterface;
@@ -18,7 +19,7 @@ export declare abstract class AbstractCache {
18
19
  protected constructor(dependencies: AbstractCacheDependencyInterface, core: RmCore);
19
20
  getChildren(): TransactionCache[];
20
21
  getDescendantsIterator(): IterableIterator<TransactionCache>;
21
- abstract createChild(id?: string, validatorFactory?: TransactionValidatorFactory, options?: TransactionOptions): TransactionCache;
22
+ abstract createChild(id?: string, validatorFactory?: TransactionValidatorFactory, options?: Partial<TransactionOptions>): TransactionCache;
22
23
  onChildDestroy(transactionCache: TransactionCache): void;
23
24
  /**
24
25
  * @description
@@ -20,7 +20,7 @@ export declare class ServerCache extends AbstractCache {
20
20
  constructor(dependencies: ServerCacheDependencyInterface, apiFieldsOnDeleteRule: typeof ApiFieldsOnDeleteRule, core: RmCore);
21
21
  onDeltaApplied(callback: OnDeltaAppliedCallback): DeregFunction;
22
22
  getServerCache(): ServerCache;
23
- createChild(id?: string, validatorFactory?: TransactionValidatorFactory, options?: TransactionOptions): TransactionCache;
23
+ createChild(id?: string, validatorFactory?: TransactionValidatorFactory, options?: Partial<TransactionOptions>): TransactionCache;
24
24
  getActiveItemEntries(): ActiveItemEntries;
25
25
  processResponseByItemType<ItemTypeType extends ApiItemType>(itemType: ItemTypeType, requestColumns: ApiRequestColumns<ItemTypeType> | null, responseColumns: ResponseColumnItemTypeMap, responseItems: Iterable<FieldMap<ItemTypeType>>, changesDelta: ChangesDelta, itemUpdateModeMap?: {
26
26
  [itemId: string]: ChangesDeltaItemUpdateMode;
@@ -1,5 +1,6 @@
1
1
  import { WritableSignal } from '@angular/core';
2
2
  import { ApiItemType, ItemId } from '@rentman/backend-types';
3
+ import moment from 'moment';
3
4
  import { AbstractCache, AbstractCacheDependencyInterface, ApiQuery, ApiRequestColumnArray, ApiRequestColumns, CachedQueryItem, ChangesDelta, ChangesDeltaResult, ChildChangesDelta, ChildCollectionResources, CollectionQuery, CollectionResource, ConversionMap, CreateRequestParameterMap, DeregFunction, FieldMap, ItemAggregatedChangesListener, ItemChangesListener, ItemEntry, ItemIdConversionMap, ItemOptions, ItemResource, ItemResourcesItemTypeMap, ItemsByQueryOptions, ItemTypeMap, LimitedCollectionResource, ModuleChangesCompilationResult, NewItemOptions, OnAfterCreateCallback, ParentChangesDelta, ParentIdMap, RmCore, RootCollectionOptions, ServerCache, TimeoutPromiseHandler, TransactionCacheCallbackCondition, TransactionCacheCallbackType, TransactionCachedQueryHandler, TransactionEventHandler, TransactionItemHandler, TransactionOptions, TransactionValidator, TransactionValidatorFactory } from '../../../internal';
4
5
  import { TransactionValidatorWithDependencies } from './TransactionValidatorWithDependencies';
5
6
  type ItemResourceLinks<ItemTypeType extends ApiItemType, ColumnIds extends ApiRequestColumnArray<ItemTypeType>, Children extends ChildCollectionResources | undefined> = {
@@ -101,10 +102,13 @@ export declare class TransactionCache extends AbstractCache {
101
102
  readonly eventHandler: TransactionEventHandler;
102
103
  readonly validator?: TransactionValidator;
103
104
  validatorWithDependencies?: TransactionValidatorWithDependencies<any>;
104
- private readonly options;
105
+ readonly options: TransactionOptions;
106
+ lastSaveSignal: WritableSignal<moment.Moment | null>;
107
+ private autoSaveEffect?;
108
+ private autoSaveInFlightSignal;
105
109
  private actionsQueue;
106
110
  private pendingActionLabels;
107
- private transactionStateSignal;
111
+ readonly transactionStateSignal: WritableSignal<TransactionState>;
108
112
  isPendingSignal: any;
109
113
  isDestroyedSignal: WritableSignal<boolean>;
110
114
  isValidSignal: import("@angular/core").Signal<boolean>;
@@ -167,7 +171,7 @@ export declare class TransactionCache extends AbstractCache {
167
171
  * transaction while it is pending, use the `applyChangesDelta` parameter passed to the promise function.
168
172
  */
169
173
  setPending<Result>(promise: Promise<Result> | ((applyChangesDelta: (changesDelta: ChangesDelta) => Promise<ChangesDeltaResult>) => Promise<Result>), isDoneByAi: boolean): Promise<Result>;
170
- createChild(id?: string, validatorFactory?: TransactionValidatorFactory, options?: TransactionOptions): TransactionCache;
174
+ createChild(id?: string, validatorFactory?: TransactionValidatorFactory, options?: Partial<TransactionOptions>): TransactionCache;
171
175
  createBusinessLogicChild(): TransactionCache;
172
176
  destroy(): void;
173
177
  /**
@@ -45,7 +45,7 @@ export declare class TransactionItemHandler extends ItemHandlerBase {
45
45
  * The fields will come from the parent transaction, if avaiable.
46
46
  */
47
47
  constructInitialProxy<ItemTypeType extends ApiItemType>(itemEntry: ItemEntry<ItemTypeType>): FieldMap<ItemTypeType>;
48
- getItemEntriesWithChangesIterator(): Generator<ItemEntry<any>>;
48
+ getItemEntriesWithChangesIterator(itemType?: ApiItemType): Generator<ItemEntry<any>>;
49
49
  /**
50
50
  * Processes the changes on the transaction, and stores the changes as well as the previous values in
51
51
  * `parentChangesDelta`. Also handles changes listeners and validators.
@@ -1,3 +1,4 @@
1
+ import { Injector } from '@angular/core';
1
2
  import { ApiFieldsOnDeleteRule, ItemId } from '@rentman/backend-types';
2
3
  import { ApiRequestService } from './classes/ApiRequestService';
3
4
  import { BusinessLogicManager } from './classes/BusinessLogicManager/BusinessLogicManager';
@@ -56,6 +57,6 @@ export declare class RmCore {
56
57
  * We specify an `apiFieldsOnDeleteRule` parameter in order to easily mock it in unit tests. This prevents
57
58
  * issues where a mocked API response does not contain required fields that are added at a later point in time.
58
59
  */
59
- apiFieldsOnDeleteRule?: typeof ApiFieldsOnDeleteRule);
60
+ apiFieldsOnDeleteRule: typeof ApiFieldsOnDeleteRule | undefined, rootInjector: Injector);
60
61
  }
61
62
  export declare function identity<T extends any>(value: T): T;
@@ -7,6 +7,6 @@ export declare class TransactionCacheFactory {
7
7
  * Todo[cache] Store a map of all transactions by transaction id ?
8
8
  */
9
9
  getById(id: string): TransactionCache | undefined;
10
- construct(id?: string, validatorFactory?: TransactionValidatorFactory, transactionOptions?: TransactionOptions): TransactionCache;
10
+ construct(id?: string, validatorFactory?: TransactionValidatorFactory, transactionOptions?: Partial<TransactionOptions>): TransactionCache;
11
11
  getServerCache(): ServerCache;
12
12
  }
@@ -1,3 +1,4 @@
1
+ import { Injector } from '@angular/core';
1
2
  import { ApiRequestService } from '../classes/ApiRequestService';
2
3
  import { BusinessLogicManager } from '../classes/BusinessLogicManager/BusinessLogicManager';
3
4
  import { ColumnCache } from '../classes/ColumnCache';
@@ -43,4 +44,5 @@ export interface AbstractCacheDependencyInterface {
43
44
  requestColumnExpansionFactory: RequestColumnExpansionFactory;
44
45
  requestColumnsOperationsCacheFactory: RequestColumnsOperationsCacheFactory;
45
46
  templateCache: TemplateCache;
47
+ rootInjector: Injector;
46
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rentman/rm-core",
3
- "version": "66.3.0",
3
+ "version": "66.5.0",
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.870.0-g705cf3ad62",
18
+ "@rentman/backend-types": "4.896.0-15-gb92d0b7abe",
19
19
  "@stylistic/eslint-plugin-ts": "^2.7.2",
20
20
  "@types/eslint__js": "^8.42.3",
21
21
  "@vitest/coverage-v8": "^3.2.3",