@rentman/rm-core 12.0.5-7 → 12.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +0 -34
- package/dist/rm-core.js +455 -690
- package/dist/rm-core.min.js +1 -1
- package/dist/types/src/classes/BusinessLogicManager/BusinessLogicManager.d.ts +0 -2
- package/dist/types/src/classes/ChangesDeltaBase.d.ts +0 -15
- package/dist/types/src/classes/cache/AbstractCache.d.ts +8 -1
- package/dist/types/src/classes/cache/server/ServerCache.d.ts +13 -1
- package/dist/types/src/classes/cache/transaction/TransactionCache.d.ts +13 -1
- package/dist/types/src/classes/cache/transaction/TransactionItemHandler.d.ts +1 -1
- package/dist/types/src/models/ItemResource.d.ts +0 -5
- package/package.json +1 -1
- package/dist/types/src/classes/BusinessLogicManager/Contact/ContactAddressBusinessLogicRule.d.ts +0 -14
|
@@ -6,7 +6,6 @@ import { PromiseInterface } from '../../types/PromiseInterface';
|
|
|
6
6
|
import { ApiFormatter } from '../ApiFormatter';
|
|
7
7
|
import { TransactionCache } from '../cache/transaction/TransactionCache';
|
|
8
8
|
import { ChangesDelta } from '../ChangesDelta';
|
|
9
|
-
import { ContactAddressBusinessLogicRule } from './Contact/ContactAddressBusinessLogicRule';
|
|
10
9
|
import { CustomFieldTypeBusinessLogicRule } from './Customfield/CustomFieldTypeBusinessLogicRule';
|
|
11
10
|
import { DocumentTemplateBusinessLogicRule } from './Documents/DocumentTemplateBusinessLogicRule';
|
|
12
11
|
import { ExemplaarAanschafdatumBusinessLogicRule } from './Exemplaar/ExemplaarAanschafdatumBusinessLogicRule';
|
|
@@ -52,7 +51,6 @@ export declare class BusinessLogicManager {
|
|
|
52
51
|
FunctieTwowayBusinessLogicRule: FunctieTwowayBusinessLogicRule;
|
|
53
52
|
FunctieNaaminternBusinessLogicRule: FunctieNaaminternBusinessLogicRule;
|
|
54
53
|
CustomFieldTypeBusinessLogicRule: CustomFieldTypeBusinessLogicRule;
|
|
55
|
-
ContactAddressBusinessLogicRule: ContactAddressBusinessLogicRule;
|
|
56
54
|
RolDocumentAccessBusinessLogicRule: RolDocumentAccessBusinessLogicRule;
|
|
57
55
|
RolEditOwnDataBusinessLogicRule: RolEditOwnDataBusinessLogicRule;
|
|
58
56
|
RolFileAccessBusinessLogicRule: RolFileAccessBusinessLogicRule;
|
|
@@ -5,25 +5,10 @@ export declare type ChangesDeltaResult = {
|
|
|
5
5
|
created: ItemEntry[];
|
|
6
6
|
};
|
|
7
7
|
export declare enum ChangesDeltaItemUpdateMode {
|
|
8
|
-
/**
|
|
9
|
-
* For create/update responses you always want to overwrite whatever is cached
|
|
10
|
-
*/
|
|
11
8
|
CLEAR_ALWAYS = "overwrite",
|
|
12
|
-
/**
|
|
13
|
-
* For socket messages you want to clear the user's changes if they are the same as what is received
|
|
14
|
-
*/
|
|
15
9
|
CLEAR_WHEN_SAME = "same",
|
|
16
|
-
/**
|
|
17
|
-
* For user changes you want to store them if they are different than on a parent
|
|
18
|
-
*/
|
|
19
10
|
KEEP_WHEN_DIFFERENT = "different",
|
|
20
|
-
/**
|
|
21
|
-
* Used when expanding local items
|
|
22
|
-
*/
|
|
23
11
|
APPEND = "append",
|
|
24
|
-
/**
|
|
25
|
-
* Used for query responses (you don't want to do anything with user changes)
|
|
26
|
-
*/
|
|
27
12
|
QUERY = "query"
|
|
28
13
|
}
|
|
29
14
|
/**
|
|
@@ -61,9 +61,16 @@ export declare abstract class AbstractCache {
|
|
|
61
61
|
* @internal
|
|
62
62
|
*/
|
|
63
63
|
abstract applyChangesFromParent(parentChangesDelta: ParentChangesDelta, isCalledAfterSocketUpdate: boolean): void;
|
|
64
|
-
getParent<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean): EntryParentNull;
|
|
64
|
+
abstract getParent<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean, providedFields?: FieldMap<ItemTypeType>): 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;
|
|
67
74
|
protected getParentFromFields<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fields?: FieldMap<ItemTypeType>): EntryParentNull;
|
|
68
75
|
/**
|
|
69
76
|
* @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, 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, EntryParentNull, 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,6 +37,18 @@ 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;
|
|
40
52
|
/**
|
|
41
53
|
* @description
|
|
42
54
|
* 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, 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';
|
|
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';
|
|
3
3
|
declare type ItemResourceLinks<ItemTypeType extends ApiEnumItemType> = {
|
|
4
4
|
main: ItemResource<ItemTypeType>;
|
|
5
5
|
linked: ItemResourcesItemTypeMap;
|
|
@@ -146,6 +146,18 @@ 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;
|
|
149
161
|
getCollectionChangesRecursively<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery): CachedQueryItem<ItemTypeType> | undefined;
|
|
150
162
|
/**
|
|
151
163
|
* @description
|
|
@@ -20,7 +20,7 @@ export declare class TransactionItemHandler extends ItemHandlerBase {
|
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
constructor(dependencies: TransactionItemHandlerDependencyInterface, transaction: TransactionCache, validator?: TransactionValidator | undefined);
|
|
23
|
-
updateLocalItemIdReferences(itemType: ApiEnumItemType, oldItemId: ItemId, newItemId: ItemId
|
|
23
|
+
updateLocalItemIdReferences(itemType: ApiEnumItemType, oldItemId: ItemId, newItemId: ItemId): void;
|
|
24
24
|
registerFieldChangeCallback<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemId: ItemId, callback: FieldChangeCallback<ItemTypeType>): DeregFunction;
|
|
25
25
|
createItemEntry(createTuple: ChangesDeltaItemCreateDelta): ItemEntry;
|
|
26
26
|
/**
|
|
@@ -15,11 +15,6 @@ 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>;
|
|
23
18
|
/**
|
|
24
19
|
* @description
|
|
25
20
|
* 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
package/dist/types/src/classes/BusinessLogicManager/Contact/ContactAddressBusinessLogicRule.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
-
import { ItemResource } from '../../../models/ItemResource';
|
|
3
|
-
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
4
|
-
import { ChangesDelta } from '../../ChangesDelta';
|
|
5
|
-
import { BusinessLogicRule } from '../BusinessLogicRule';
|
|
6
|
-
declare type ConditionResult = ItemId[];
|
|
7
|
-
declare type Dependency = ItemResource<ApiEnumItemType.Contact, ['bezoekstraat', 'bezoekhuisnummer', 'bezoekpostcode', 'bezoekstad', 'bezoekprovincie', 'bezoekland', 'poststraat', 'posthuisnummer', 'postpostcode', 'poststad', 'postprovincie', 'postland', 'factuurstraat', 'factuurhuisnummer', 'factuurpostcode', 'factuurstad', 'factuurprovincie', 'factuurland']>[];
|
|
8
|
-
export declare class ContactAddressBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
9
|
-
condition(changesDelta: ChangesDelta, transaction: TransactionCache): ConditionResult | undefined;
|
|
10
|
-
dependency(transaction: TransactionCache, contactIds: ConditionResult): Promise<Dependency>;
|
|
11
|
-
apply(changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, contactResources: Dependency): void;
|
|
12
|
-
private addressEqualsVisitingAddress;
|
|
13
|
-
}
|
|
14
|
-
export {};
|