@rentman/rm-core 12.0.5 → 12.1.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.
@@ -21,7 +21,8 @@ import { SurfaceArticleSizeBusinessLogicRule } from './Materiaal/SurfaceArticleS
21
21
  import { OfferteContractDatumBusinessLogicRule } from './OfferteContract/OfferteContractDatumBusinessLogicRule';
22
22
  import { PlanningPersoneelTransportBusinessLogicRule } from './PlanningPersoneelTransport/PlanningPersoneelTransportBusinessLogicRule';
23
23
  import { ProjectClientNoteBusinessLogicRule } from './Project/ProjectClientNoteBusinessLogicRule';
24
- import { ReparatieAanschafdatumBusinessLogicRule } from './Reparatie/ReparatieExemplaarBusinessLogicRule';
24
+ import { ReparatiesExemplaarAantalBusinessLogicRule } from './Reparatie/ReparatieExemplaarAantalBusinessLogicRule';
25
+ import { ReparatiesExemplaarLocationBusinessLogicRule } from './Reparatie/ReparatieExemplaarLocationBusinessLogicRule';
25
26
  import { RolDocumentAccessBusinessLogicRule } from './Rol/RolDocumentAccessBusinessLogicRule';
26
27
  import { RolEditOwnDataBusinessLogicRule } from './Rol/RolEditOwnDataBusinessLogicRule';
27
28
  import { RolFileAccessBusinessLogicRule } from './Rol/RolFileAccessBusinessLogicRule';
@@ -58,7 +59,8 @@ export declare class BusinessLogicManager {
58
59
  RolProjectenBewerkenBusinessLogicRule: RolProjectenBewerkenBusinessLogicRule;
59
60
  RolProjectenToegangBusinessLogicRule: RolProjectenToegangBusinessLogicRule;
60
61
  ExemplaarAanschafdatumBusinessLogicRule: ExemplaarAanschafdatumBusinessLogicRule;
61
- ReparatieAanschafdatumBusinessLogicRule: ReparatieAanschafdatumBusinessLogicRule;
62
+ ReparatiesExemplaarAantalBusinessLogicRule: ReparatiesExemplaarAantalBusinessLogicRule;
63
+ ReparatiesExemplaarLocationBusinessLogicRule: ReparatiesExemplaarLocationBusinessLogicRule;
62
64
  MateriaalVerhuurBusinessLogicRule: MateriaalVerhuurBusinessLogicRule;
63
65
  MateriaalTypeBusinessLogicRule: MateriaalTypeBusinessLogicRule;
64
66
  SurfaceArticleSizeBusinessLogicRule: SurfaceArticleSizeBusinessLogicRule;
@@ -5,7 +5,7 @@ import { ChangesDelta } from '../../ChangesDelta';
5
5
  import { BusinessLogicRule } from '../BusinessLogicRule';
6
6
  declare type ConditionResult = ItemId[];
7
7
  declare type Dependency = ItemResource<ApiEnumItemType.Reparatie, ['aantal']>[];
8
- export declare class ReparatieAanschafdatumBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
8
+ export declare class ReparatiesExemplaarAantalBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
9
9
  condition(changesDelta: ChangesDelta): ConditionResult | undefined;
10
10
  dependency(transaction: TransactionCache, reparatieIds: ConditionResult): Promise<Dependency>;
11
11
  apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, reparatieResources: Dependency): void;
@@ -0,0 +1,23 @@
1
+ import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
2
+ import { ItemEntry } from '../../../models/ItemEntry';
3
+ import { ItemResource } from '../../../models/ItemResource';
4
+ import { ApiFormatter } from '../../ApiFormatter';
5
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
6
+ import { ChangesDelta } from '../../ChangesDelta';
7
+ import { BusinessLogicRule } from '../BusinessLogicRule';
8
+ declare type ConditionResult = {
9
+ entry: ItemEntry<ApiEnumItemType.Reparatie>;
10
+ exemplaar: ItemId;
11
+ }[];
12
+ declare type Dependency = {
13
+ entries: ItemEntry<ApiEnumItemType.Reparatie>[];
14
+ exemplaarResources: ItemResource<ApiEnumItemType.Exemplaar, ['id', 'asset_location']>[];
15
+ };
16
+ export declare class ReparatiesExemplaarLocationBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
17
+ protected apiFormatter: ApiFormatter;
18
+ constructor(apiFormatter: ApiFormatter);
19
+ condition(changesDelta: ChangesDelta): ConditionResult | undefined;
20
+ dependency(transaction: TransactionCache, conditionResult: ConditionResult): Promise<Dependency>;
21
+ apply(changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, dependency: Dependency): void;
22
+ }
23
+ export {};
@@ -61,16 +61,9 @@ export declare abstract class AbstractCache {
61
61
  * @internal
62
62
  */
63
63
  abstract applyChangesFromParent(parentChangesDelta: ParentChangesDelta, isCalledAfterSocketUpdate: boolean): void;
64
- abstract getParent<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean, providedFields?: FieldMap<ItemTypeType>): EntryParentNull;
64
+ getParent<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean): EntryParentNull;
65
65
  abstract getLocalItemEntryChangesTuple<ItemTypeType extends ApiEnumItemType>(itemEntryId: ItemEntry<ItemTypeType>['id']): ItemEntryChangesTuple<ItemTypeType>;
66
66
  abstract applyChangesDelta(changesDelta: ChangesDelta): PromiseInterface<ChangesDeltaResult>;
67
- /**
68
- * Differs from {@link getParent getParent} that it only does minimal field lookups (but you cannot provide it with fields) instead of doing {@link ItemHandlerBase.collectFields collectFields}
69
- * todo: clean this up some time (merge the 2 functions)
70
- *
71
- * @param itemEntry
72
- */
73
- getParentFast(itemEntry: ItemEntry): EntryParentNull;
74
67
  protected getParentFromFields<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fields?: FieldMap<ItemTypeType>): EntryParentNull;
75
68
  /**
76
69
  * @description
@@ -1,5 +1,5 @@
1
1
  import { ApiEnumItemType } from '@rentman/backend-types';
2
- import { AbstractCache, ApiRequestColumnArray, ApiRequestColumnMap, ApiResponseProcessor, CachedQueryItem, ChangesDelta, ChangesDeltaResult, CollectionQuery, CollectionResourceParentIdMap, EntryParent, EntryParentNull, FieldMap, ItemEntry, ItemEntryChangesTuple, ItemIdConversionMap, OnAfterCreateCallback, ParentChangesDelta, PromiseInterface, ResponseItemUpdateModeMap, RmCore, ServerCacheDependencyInterface, ServerCachedQueryHandler, ServerItemHandler, TransactionCache, TransactionOptions, TransactionValidatorFactory } from '../../../internal';
2
+ import { AbstractCache, ApiRequestColumnArray, ApiRequestColumnMap, ApiResponseProcessor, CachedQueryItem, ChangesDelta, ChangesDeltaResult, CollectionQuery, CollectionResourceParentIdMap, EntryParent, FieldMap, ItemEntry, ItemEntryChangesTuple, ItemIdConversionMap, OnAfterCreateCallback, ParentChangesDelta, PromiseInterface, ResponseItemUpdateModeMap, RmCore, ServerCacheDependencyInterface, ServerCachedQueryHandler, ServerItemHandler, TransactionCache, TransactionOptions, TransactionValidatorFactory } from '../../../internal';
3
3
  /**
4
4
  * @description
5
5
  * The {@link ServerCache ServerCache} is responsible for keeping track of {@link ItemEntry ItemEntries} and {@link CollectionEntry CollectionEntries}
@@ -37,18 +37,6 @@ export declare class ServerCache extends AbstractCache {
37
37
  * Gets the fields required to set the parent
38
38
  */
39
39
  getLinkFieldsByParent<ItemTypeType extends ApiEnumItemType>(parent: EntryParent, itemType: ItemTypeType): Partial<FieldMap<ItemTypeType>>;
40
- /**
41
- * @description
42
- * Gets the entry's parent
43
- *
44
- * @param itemEntry The entry to get the parent from
45
- * @param _fromInitial Unused parameter, there for alignment with {@link TransactionCache.getParent TransactionCache.getParent]
46
- * @param _providedFields Unused parameter, there for alignment with {@link TransactionCache.getParent TransactionCache.getParent]
47
- *
48
- * @remark
49
- * Use {@link CollectionResource.getParent CollectionResource.getParent} instead of {@link TransactionCache.getParent TransactionCache.getParent} if you're getting the parent in the onRemove callback
50
- */
51
- getParent<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, _fromInitial?: boolean, _providedFields?: FieldMap<ItemTypeType>): EntryParentNull;
52
40
  /**
53
41
  * @description
54
42
  * Only takes the local changes into account, used for saving
@@ -1,5 +1,5 @@
1
1
  import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
2
- import { AbstractCache, AbstractCacheDependencyInterface, ApiQuery, ApiRequestColumnArray, ApiRequestColumns, CachedQueryItem, CachedQueryItemTree, ChangesDelta, ChangesDeltaResult, ChildCollectionOptions, ChildCollectionResources, ChildCollectionResourcesNull, CollectionDefinition, CollectionOptionsInterface, CollectionQuery, CollectionResource, CollectionResourceParentIdMap, ConversionMap, CreateRequestParameterMap, DeregFunction, EntryParentNull, FieldChangeCallback, FieldMap, InternalChangesDelta, ItemEntry, ItemEntryChangesTuple, ItemEntryOptions, ItemIdConversionMap, ItemOptionsInterface, ItemResource, ItemResourcesItemTypeMap, ItemTypeColumnIds, ItemTypeMap, LinkCollectionDefinition, ModuleChangesCompilationResult, OnAfterCreateCallback, ParentChangesDelta, ParentItemMap, PromiseInterface, RmCore, ServerCache, TransactionCacheCallbackCondition, TransactionCacheCallbackType, TransactionCachedQueryHandler, TransactionCollectionHandler, TransactionEventHandler, TransactionItemHandler, TransactionOptions, TransactionValidatorFactory } from '../../../internal';
2
+ import { AbstractCache, AbstractCacheDependencyInterface, ApiQuery, ApiRequestColumnArray, ApiRequestColumns, CachedQueryItem, CachedQueryItemTree, ChangesDelta, ChangesDeltaResult, ChildCollectionOptions, ChildCollectionResources, ChildCollectionResourcesNull, CollectionDefinition, CollectionOptionsInterface, CollectionQuery, CollectionResource, CollectionResourceParentIdMap, ConversionMap, CreateRequestParameterMap, DeregFunction, FieldChangeCallback, InternalChangesDelta, ItemEntry, ItemEntryChangesTuple, ItemEntryOptions, ItemIdConversionMap, ItemOptionsInterface, ItemResource, ItemResourcesItemTypeMap, ItemTypeColumnIds, ItemTypeMap, LinkCollectionDefinition, ModuleChangesCompilationResult, OnAfterCreateCallback, ParentChangesDelta, ParentItemMap, PromiseInterface, RmCore, ServerCache, TransactionCacheCallbackCondition, TransactionCacheCallbackType, TransactionCachedQueryHandler, TransactionCollectionHandler, TransactionEventHandler, TransactionItemHandler, TransactionOptions, TransactionValidatorFactory } from '../../../internal';
3
3
  declare type ItemResourceLinks<ItemTypeType extends ApiEnumItemType> = {
4
4
  main: ItemResource<ItemTypeType>;
5
5
  linked: ItemResourcesItemTypeMap;
@@ -146,18 +146,6 @@ export declare class TransactionCache extends AbstractCache {
146
146
  */
147
147
  applyChangesDelta(changesDelta: ChangesDelta | InternalChangesDelta): PromiseInterface<ChangesDeltaResult>;
148
148
  getServerCache(): ServerCache;
149
- /**
150
- * @description
151
- * Gets the entry's parent from the closest transaction
152
- *
153
- * @param itemEntry The entry to get the parent from
154
- * @param fromInitial If `true` the parent values will be read from {@link TransactionItemEntryChanges.initial initial} (Useful for when you've moved an entry)
155
- * @param providedFields Use the provided fields instead of the cached fields, used by {@link CollectionResource.getParent CollectionResource.getParent}
156
- *
157
- * @remark
158
- * Use {@link CollectionResource.getParent CollectionResource.getParent} instead of {@link TransactionCache.getParent TransactionCache.getParent} if you're getting the parent in the onRemove callback
159
- */
160
- getParent<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean, providedFields?: FieldMap<ItemTypeType>): EntryParentNull;
161
149
  getCollectionChangesRecursively<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery): CachedQueryItem<ItemTypeType> | undefined;
162
150
  /**
163
151
  * @description
@@ -93,7 +93,7 @@ export * from './classes/BusinessLogicManager/Materiaal/MateriaalTelexemplarenBu
93
93
  export * from './classes/BusinessLogicManager/OfferteContract/OfferteContractDatumBusinessLogicRule';
94
94
  export * from './classes/BusinessLogicManager/PlanningPersoneelTransport/PlanningPersoneelTransportBusinessLogicRule';
95
95
  export * from './classes/BusinessLogicManager/Project/ProjectClientNoteBusinessLogicRule';
96
- export * from './classes/BusinessLogicManager/Reparatie/ReparatieExemplaarBusinessLogicRule';
96
+ export * from './classes/BusinessLogicManager/Reparatie/ReparatieExemplaarAantalBusinessLogicRule';
97
97
  export * from './classes/BusinessLogicManager/Rol/RolDocumentAccessBusinessLogicRule';
98
98
  export * from './classes/BusinessLogicManager/Rol/RolEditOwnDataBusinessLogicRule';
99
99
  export * from './classes/BusinessLogicManager/Rol/RolFileAccessBusinessLogicRule';
@@ -15,6 +15,11 @@ export declare class ItemResource<ItemTypeType extends ApiEnumItemType = any, Co
15
15
  initial: Readonly<FieldMap<ItemTypeType, ColumnIds>>;
16
16
  constructor(factory: ItemResourceFactory, entry: ItemEntry<ItemTypeType>, transaction: TransactionCache, children: Children, _isNew: boolean);
17
17
  onConstruct(): void;
18
+ /**
19
+ * Collects all the fields from this item, useful while debugging when you want to look at the complete fieldset
20
+ * (because this.fields is now a proxy class)
21
+ */
22
+ collectFields(): FieldMap<ItemTypeType, ColumnIds>;
18
23
  /**
19
24
  * @description
20
25
  * Updates the fields of the item and calls onChange, when updating many fields of many items it's better to create a {@link ChangesDelta ChangesDelta} yourself so all changes can be applied at once
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rentman/rm-core",
3
- "version": "12.0.5",
3
+ "version": "12.1.1",
4
4
  "description": "Rentman core functionalities",
5
5
  "main": "./dist/rm-core.js",
6
6
  "types": "./dist/types/src/index.d.ts",