@rentman/rm-core 66.2.0 → 66.4.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.
- package/dist/rm-core.js +1 -1
- package/dist/rm-core.js.map +1 -1
- package/dist/types/src/classes/cache/AbstractCache.d.ts +2 -1
- package/dist/types/src/classes/cache/server/ServerCache.d.ts +1 -1
- package/dist/types/src/classes/cache/transaction/TransactionCache.d.ts +16 -5
- package/dist/types/src/classes/cache/transaction/TransactionItemHandler.d.ts +2 -2
- package/dist/types/src/core.d.ts +2 -1
- package/dist/types/src/factories/TransactionCacheFactory.d.ts +1 -1
- package/dist/types/src/interfaces/AbstractCacheDependencyInterface.d.ts +2 -0
- package/package.json +1 -1
|
@@ -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> = {
|
|
@@ -84,6 +85,13 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
84
85
|
*/
|
|
85
86
|
tabRequestParameters: {};
|
|
86
87
|
hasChangesSignal: WritableSignal<boolean>;
|
|
88
|
+
aiChanges: WritableSignal<{
|
|
89
|
+
created: Set<ItemEntry['id']>;
|
|
90
|
+
deleted: Set<ItemEntry['id']>;
|
|
91
|
+
fields: Partial<{
|
|
92
|
+
[itemEntryId: number]: Set<string>;
|
|
93
|
+
}>;
|
|
94
|
+
}>;
|
|
87
95
|
/**
|
|
88
96
|
* @description
|
|
89
97
|
* The transaction's parent
|
|
@@ -94,10 +102,13 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
94
102
|
readonly eventHandler: TransactionEventHandler;
|
|
95
103
|
readonly validator?: TransactionValidator;
|
|
96
104
|
validatorWithDependencies?: TransactionValidatorWithDependencies<any>;
|
|
97
|
-
|
|
105
|
+
readonly options: TransactionOptions;
|
|
106
|
+
lastSaveSignal: WritableSignal<moment.Moment | null>;
|
|
107
|
+
private autoSaveEffect?;
|
|
108
|
+
private autoSaveInFlightSignal;
|
|
98
109
|
private actionsQueue;
|
|
99
110
|
private pendingActionLabels;
|
|
100
|
-
|
|
111
|
+
readonly transactionStateSignal: WritableSignal<TransactionState>;
|
|
101
112
|
isPendingSignal: any;
|
|
102
113
|
isDestroyedSignal: WritableSignal<boolean>;
|
|
103
114
|
isValidSignal: import("@angular/core").Signal<boolean>;
|
|
@@ -159,8 +170,8 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
159
170
|
* Note that the transaction can *not* be mutated while it is pending. If you need to apply changes on the
|
|
160
171
|
* transaction while it is pending, use the `applyChangesDelta` parameter passed to the promise function.
|
|
161
172
|
*/
|
|
162
|
-
setPending<Result>(promise: Promise<Result> | ((applyChangesDelta: (changesDelta: ChangesDelta) => Promise<ChangesDeltaResult>) => Promise<Result>)): Promise<Result>;
|
|
163
|
-
createChild(id?: string, validatorFactory?: TransactionValidatorFactory, options?: TransactionOptions): TransactionCache;
|
|
173
|
+
setPending<Result>(promise: Promise<Result> | ((applyChangesDelta: (changesDelta: ChangesDelta) => Promise<ChangesDeltaResult>) => Promise<Result>), isDoneByAi: boolean): Promise<Result>;
|
|
174
|
+
createChild(id?: string, validatorFactory?: TransactionValidatorFactory, options?: Partial<TransactionOptions>): TransactionCache;
|
|
164
175
|
createBusinessLogicChild(): TransactionCache;
|
|
165
176
|
destroy(): void;
|
|
166
177
|
/**
|
|
@@ -216,7 +227,7 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
216
227
|
*
|
|
217
228
|
* This method waits for other transaction processes to complete, see {@link enqueueAction}.
|
|
218
229
|
*/
|
|
219
|
-
applyChangesDelta(changesDelta: ChangesDelta): Promise<ChangesDeltaResult>;
|
|
230
|
+
applyChangesDelta(changesDelta: ChangesDelta, isDoneByAi?: boolean): Promise<ChangesDeltaResult>;
|
|
220
231
|
/**
|
|
221
232
|
* See {@link applyChangesDelta}. We're introducing a separate method here to facilitate handling the resulting
|
|
222
233
|
* promise.
|
|
@@ -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.
|
|
@@ -56,7 +56,7 @@ export declare class TransactionItemHandler extends ItemHandlerBase {
|
|
|
56
56
|
*/
|
|
57
57
|
processUpdatesFromDelta(updated: {
|
|
58
58
|
[itemEntryId: number]: ChangesDeltaBaseItemUpdateDelta<any>;
|
|
59
|
-
}, createItemChangesIfNoneExist: boolean, parentChangesDelta: ParentChangesDelta):
|
|
59
|
+
}, createItemChangesIfNoneExist: boolean, parentChangesDelta: ParentChangesDelta): Map<ItemEntry['id'], Set<string>>;
|
|
60
60
|
updateLocalItemIdReferences(itemType: ApiItemType, oldItemId: ItemId, newItemId: ItemId, changesDelta: ChangesDeltaBase): void;
|
|
61
61
|
registerFieldChangeCallback<ItemTypeType extends ApiItemType>(itemType: ItemTypeType, itemId: ItemId, callback: ItemChangesListener<ItemTypeType>): DeregFunction;
|
|
62
62
|
createItemEntry(createTuple: ChangesDeltaItemCreateDelta): ItemEntry;
|
package/dist/types/src/core.d.ts
CHANGED
|
@@ -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
|
|
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
|
}
|