@rentman/rm-core 7.0.0 → 7.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.
- package/changelog.md +804 -801
- package/dist/rm-core.js +9895 -9890
- package/dist/rm-core.min.js +2 -2
- package/dist/types/classes/ApiFormatter.d.ts +65 -65
- package/dist/types/classes/ApiRequestService.d.ts +20 -20
- package/dist/types/classes/ApiResponseProcessor.d.ts +31 -31
- package/dist/types/classes/ChangesCompilation.d.ts +34 -34
- package/dist/types/classes/ChangesDelta.d.ts +61 -61
- package/dist/types/classes/ChangesDeltaBase.d.ts +51 -51
- package/dist/types/classes/ChangesProcessor.d.ts +47 -47
- package/dist/types/classes/CollectionEntryService.d.ts +26 -26
- package/dist/types/classes/CollectionMatcherBase.d.ts +21 -21
- package/dist/types/classes/CollectionMatcherCachedCollectionProcessor.d.ts +31 -31
- package/dist/types/classes/CollectionResourceService.d.ts +7 -7
- package/dist/types/classes/ColumnCache.d.ts +21 -21
- package/dist/types/classes/ColumnExpansion.d.ts +22 -22
- package/dist/types/classes/ColumnHandler.d.ts +21 -21
- package/dist/types/classes/ColumnInfo.d.ts +14 -14
- package/dist/types/classes/ColumnSet.d.ts +38 -38
- package/dist/types/classes/ColumnSubsetCache.d.ts +10 -10
- package/dist/types/classes/ColumnUtil.d.ts +99 -99
- package/dist/types/classes/ConversionMapService.d.ts +27 -27
- package/dist/types/classes/CreateRequest.d.ts +19 -19
- package/dist/types/classes/CreatedChangesDelta.d.ts +16 -16
- package/dist/types/classes/InternalChangesDelta.d.ts +39 -39
- package/dist/types/classes/ItemCache.d.ts +29 -29
- package/dist/types/classes/ItemCreateService.d.ts +24 -24
- package/dist/types/classes/ItemEntryService.d.ts +34 -34
- package/dist/types/classes/KeyService.d.ts +17 -17
- package/dist/types/classes/LockService.d.ts +32 -32
- package/dist/types/classes/ModuleChangesCompilation.d.ts +18 -18
- package/dist/types/classes/QueryColumnExtractor.d.ts +20 -20
- package/dist/types/classes/QueryContainsLocalIdParser.d.ts +17 -17
- package/dist/types/classes/QueryLinkedToParser.d.ts +16 -16
- package/dist/types/classes/QueryLocallyMatchableParser.d.ts +19 -19
- package/dist/types/classes/QueryMatcher.d.ts +18 -18
- package/dist/types/classes/QueryParser.d.ts +24 -24
- package/dist/types/classes/QueryParserBase.d.ts +29 -29
- package/dist/types/classes/QueryParserIdUpdater.d.ts +16 -16
- package/dist/types/classes/QueryService.d.ts +18 -18
- package/dist/types/classes/RequestBuffer.d.ts +28 -28
- package/dist/types/classes/RequestBufferManager.d.ts +25 -25
- package/dist/types/classes/RequestColumnExpansion.d.ts +15 -15
- package/dist/types/classes/SocketMessageHandler.d.ts +39 -39
- package/dist/types/classes/TemplateCache.d.ts +66 -66
- package/dist/types/classes/Util.d.ts +31 -31
- package/dist/types/classes/cache/AbstractCache.d.ts +103 -103
- package/dist/types/classes/cache/CachedQueryHandlerBase.d.ts +74 -74
- package/dist/types/classes/cache/CollectionMatcherCachedQueryProcessor.d.ts +35 -35
- package/dist/types/classes/cache/ItemHandlerBase.d.ts +105 -105
- package/dist/types/classes/cache/server/ServerCache.d.ts +82 -82
- package/dist/types/classes/cache/server/ServerCachedQueryHandler.d.ts +34 -34
- package/dist/types/classes/cache/server/ServerItemHandler.d.ts +52 -52
- package/dist/types/classes/cache/transaction/TransactionCache.d.ts +324 -324
- package/dist/types/classes/cache/transaction/TransactionCachedQueryHandler.d.ts +23 -23
- package/dist/types/classes/cache/transaction/TransactionCollectionHandler.d.ts +28 -28
- package/dist/types/classes/cache/transaction/TransactionEventHandler.d.ts +24 -24
- package/dist/types/classes/cache/transaction/TransactionItemHandler.d.ts +90 -90
- package/dist/types/classes/cache/transaction/TransactionValidator.d.ts +34 -34
- package/dist/types/classes/index.d.ts +46 -46
- package/dist/types/constants.d.ts +7 -7
- package/dist/types/core.d.ts +51 -51
- package/dist/types/factories/ApiResponseProcessorFactory.d.ts +6 -6
- package/dist/types/factories/ChangesCompilationFactory.d.ts +6 -6
- package/dist/types/factories/ChangesDeltaFactory.d.ts +13 -13
- package/dist/types/factories/ChangesProcessorFactory.d.ts +22 -22
- package/dist/types/factories/CollectionEntryFactory.d.ts +14 -14
- package/dist/types/factories/CollectionMatcherFactory.d.ts +19 -19
- package/dist/types/factories/CollectionResourceFactory.d.ts +22 -22
- package/dist/types/factories/ColumnExpansionFactory.d.ts +8 -8
- package/dist/types/factories/ColumnInfoFactory.d.ts +7 -7
- package/dist/types/factories/ColumnSetFactory.d.ts +19 -19
- package/dist/types/factories/ColumnSubsetCacheFactory.d.ts +7 -7
- package/dist/types/factories/CreateRequestFactory.d.ts +11 -11
- package/dist/types/factories/ItemCacheFactory.d.ts +8 -8
- package/dist/types/factories/ItemEntryFactory.d.ts +15 -15
- package/dist/types/factories/ItemResourceFactory.d.ts +14 -14
- package/dist/types/factories/ModuleChangesCompilationFactory.d.ts +5 -5
- package/dist/types/factories/QueryMatcherFactory.d.ts +7 -7
- package/dist/types/factories/QueryParserFactory.d.ts +6 -6
- package/dist/types/factories/RequestColumnExpansionFactory.d.ts +6 -6
- package/dist/types/factories/TemplateFactory.d.ts +10 -10
- package/dist/types/factories/TransactionCacheFactory.d.ts +15 -15
- package/dist/types/factories/index.d.ts +21 -21
- package/dist/types/index.d.ts +7 -7
- package/dist/types/interfaces/AbstractCacheDependencyInterface.d.ts +43 -43
- package/dist/types/interfaces/ApiRequestServiceInterface.d.ts +11 -11
- package/dist/types/interfaces/AuthInterface.d.ts +9 -9
- package/dist/types/interfaces/ErrorHandlerInterface.d.ts +5 -5
- package/dist/types/interfaces/ExceptionHandlerInterface.d.ts +3 -3
- package/dist/types/interfaces/LinkTreeServiceInterface.d.ts +4 -4
- package/dist/types/interfaces/PromiseLibraryInterface.d.ts +25 -25
- package/dist/types/interfaces/ServerCacheDependencyInterface.d.ts +7 -7
- package/dist/types/interfaces/SocketMessageInterface.d.ts +3 -3
- package/dist/types/interfaces/TransactionCollectionHandlerDependencyInterface.d.ts +20 -20
- package/dist/types/interfaces/TransactionItemHandlerDependencyInterface.d.ts +27 -27
- package/dist/types/interfaces/index.d.ts +11 -11
- package/dist/types/models/CollectionEntry.d.ts +23 -23
- package/dist/types/models/CollectionOptions.d.ts +18 -18
- package/dist/types/models/CollectionResource.d.ts +72 -72
- package/dist/types/models/ItemEntry.d.ts +19 -19
- package/dist/types/models/ItemEntryOptions.d.ts +8 -8
- package/dist/types/models/ItemResource.d.ts +84 -84
- package/dist/types/models/Template.d.ts +11 -11
- package/dist/types/models/index.d.ts +7 -7
- package/dist/types/types/ItemTypesCollection.d.ts +262 -262
- package/dist/types/types/PromiseInterface.d.ts +2 -2
- package/dist/types/types/index.d.ts +2 -2
- package/package.json +36 -36
- package/readme.md +15 -15
|
@@ -1,324 +1,324 @@
|
|
|
1
|
-
import { ChangesDelta, InternalChangesDelta, ServerCache, TransactionCollectionHandler, TransactionItemEntryChanges, TransactionItemHandler, TransactionValidatorFactory } from '../..';
|
|
2
|
-
import { RmCore } from '../../../core';
|
|
3
|
-
import { AbstractCacheDependencyInterface } from '../../../interfaces/AbstractCacheDependencyInterface';
|
|
4
|
-
import { CollectionResource, ItemEntry, ItemEntryOptions, ItemResource } from '../../../models';
|
|
5
|
-
import { CollectionOptionsInterface } from '../../../models/CollectionOptions';
|
|
6
|
-
import { ApiQuery, ApiRequestColumn, ApiRequestColumns, CollectionDefinition, CollectionQuery, CollectionResourceParentIdMap, ColumnIdTypeMap, ConversionMap, CreateRequestParameterMap, DeregFunction, EntryParentNull, FieldChangeCallback, FieldMap, ItemId, ItemIdConversionMap, ItemOptionsInterface, ItemResourcesItemTypeMap, ItemType, ItemTypeMap, LinkCollectionDefinition, PromiseInterface } from '../../../types';
|
|
7
|
-
import { ChangesDeltaResult } from '../../ChangesDeltaBase';
|
|
8
|
-
import { OnAfterCreateCallback } from '../../ChangesProcessor';
|
|
9
|
-
import { ModuleChangesCompilationResult } from '../../ModuleChangesCompilation';
|
|
10
|
-
import { AbstractCache } from '../AbstractCache';
|
|
11
|
-
import { CachedQueryItem } from '../CachedQueryHandlerBase';
|
|
12
|
-
import { TransactionCachedQueryHandler } from './TransactionCachedQueryHandler';
|
|
13
|
-
import { TransactionCacheCallbackCondition, TransactionCacheCallbackType, TransactionEventHandler } from './TransactionEventHandler';
|
|
14
|
-
declare type ItemResourceLinks<ItemTypeType extends ItemType> = {
|
|
15
|
-
main: ItemResource<ItemTypeType>;
|
|
16
|
-
linked: ItemResourcesItemTypeMap;
|
|
17
|
-
};
|
|
18
|
-
export declare enum TransactionErrorLevel {
|
|
19
|
-
warning = "warning",
|
|
20
|
-
error = "error"
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* @description
|
|
24
|
-
* The {@link TransactionCache TransactionCache} is responsible for keeping track of newly created {@link ItemEntry ItemEntries}
|
|
25
|
-
* and {@link CollectionEntry CollectionEntries}, and the changes of existing ItemEntries and CollectionEntries.
|
|
26
|
-
*
|
|
27
|
-
* The TransactionCache is also responsible for creating {@link ItemResource ItemResources}, which is a combination of an {@link ItemEntry ItemEntry} and the current transaction's changes on this ItemEntry
|
|
28
|
-
*/
|
|
29
|
-
export declare class TransactionCache extends AbstractCache {
|
|
30
|
-
/**
|
|
31
|
-
* @description
|
|
32
|
-
* For debugging purposes
|
|
33
|
-
*/
|
|
34
|
-
id?: string | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* @description
|
|
37
|
-
* A map of all item errors, can be populated using {@link TransactionValidator.setGlobalError TransactionValidator.setGlobalError} and {@link TransactionValidator.setItemError TransactionValidator.setItemError}.
|
|
38
|
-
* Contains a translation and level for every error
|
|
39
|
-
*/
|
|
40
|
-
errors: {
|
|
41
|
-
item: {
|
|
42
|
-
[itemEntryId: string]: {
|
|
43
|
-
[columnId: string]: {
|
|
44
|
-
[errorKey: string]: {
|
|
45
|
-
fieldString: string;
|
|
46
|
-
string: string;
|
|
47
|
-
level: TransactionErrorLevel;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
global: {
|
|
53
|
-
[key: string]: {
|
|
54
|
-
string: string;
|
|
55
|
-
level: TransactionErrorLevel;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
get isValid(): boolean;
|
|
60
|
-
/**
|
|
61
|
-
* @description
|
|
62
|
-
* Stores the 'root' {@link ItemEntry ItemEntry}, this {@link ItemEntry ItemEntry} can be used as request parent to store the whole transaction at once
|
|
63
|
-
*/
|
|
64
|
-
rootItem: ItemEntry | undefined;
|
|
65
|
-
/**
|
|
66
|
-
* @description
|
|
67
|
-
* Stores additional request parameters for when the transaction is stored to the server
|
|
68
|
-
*/
|
|
69
|
-
tabRequestParameters: {};
|
|
70
|
-
/**
|
|
71
|
-
* @description
|
|
72
|
-
* Is true while the {@link TransactionCache TransactionCache} is applying changes to the parent (can either be through a merge or an Api save)
|
|
73
|
-
*/
|
|
74
|
-
isSaving: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* @description
|
|
77
|
-
* Is true when the current transaction has:
|
|
78
|
-
* - Newly created items
|
|
79
|
-
* - Removed items (from collections)
|
|
80
|
-
* - Changes on existing items
|
|
81
|
-
*/
|
|
82
|
-
hasChanges: boolean;
|
|
83
|
-
/**
|
|
84
|
-
* @description
|
|
85
|
-
* The transaction's parent
|
|
86
|
-
*/
|
|
87
|
-
readonly parent: AbstractCache;
|
|
88
|
-
readonly itemHandler: TransactionItemHandler;
|
|
89
|
-
readonly cachedQueryHandler: TransactionCachedQueryHandler;
|
|
90
|
-
readonly collectionHandler: TransactionCollectionHandler;
|
|
91
|
-
readonly eventHandler: TransactionEventHandler;
|
|
92
|
-
private readonly validator?;
|
|
93
|
-
private _isValid;
|
|
94
|
-
constructor(dependencies: AbstractCacheDependencyInterface, core: RmCore, parent: AbstractCache,
|
|
95
|
-
/**
|
|
96
|
-
* @description
|
|
97
|
-
* For debugging purposes
|
|
98
|
-
*/
|
|
99
|
-
id?: string | undefined, validatorFactory?: TransactionValidatorFactory);
|
|
100
|
-
createChild(id?: string, validatorFactory?: TransactionValidatorFactory): TransactionCache;
|
|
101
|
-
destroy(): void;
|
|
102
|
-
expandCollectionResource(collectionResource: CollectionResource, newColumns: ApiRequestColumns): PromiseInterface<void>;
|
|
103
|
-
/**
|
|
104
|
-
* @description
|
|
105
|
-
* Expands the collection with the new request columns, assumes that all collections have the same itemType
|
|
106
|
-
*/
|
|
107
|
-
expandCollectionResources<ItemTypeType extends ItemType>(itemType: ItemTypeType, collections: CollectionResourceParentIdMap<ItemTypeType>, newColumns: ApiRequestColumn[]): PromiseInterface<CollectionResourceParentIdMap>;
|
|
108
|
-
registerFieldChangeCallback<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, callback: FieldChangeCallback<ItemTypeType>): DeregFunction;
|
|
109
|
-
createChangesDelta(): ChangesDelta;
|
|
110
|
-
getFirstErrorString(): undefined | string;
|
|
111
|
-
/**
|
|
112
|
-
* @description
|
|
113
|
-
* Should only be called by {@link TransactionValidator TransactionValidator}
|
|
114
|
-
* @internal
|
|
115
|
-
*/
|
|
116
|
-
_setGlobalError(key: string, isInvalid: boolean, saveButtonErrorTranslationFn: () => string, level: TransactionErrorLevel): void;
|
|
117
|
-
/**
|
|
118
|
-
* @description
|
|
119
|
-
* Should only be called by {@link TransactionValidator TransactionValidator}
|
|
120
|
-
* @internal
|
|
121
|
-
*/
|
|
122
|
-
_setItemError(itemEntryId: ItemEntry['id'], columnId: string, errorKey: string, isInvalid: boolean, fieldErrorTranslationFn: () => string, saveButtonErrorTranslationFn: () => string, level: TransactionErrorLevel): void;
|
|
123
|
-
/**
|
|
124
|
-
* @internal
|
|
125
|
-
*/
|
|
126
|
-
_setIsValid(): void;
|
|
127
|
-
/**
|
|
128
|
-
* @description
|
|
129
|
-
* Merges the passed changes from the parent Transaction into this Transaction's own changes and then propagates
|
|
130
|
-
* them to all child Transactions, this assumes that an action is already handled in a parent, so it does't handle created entries
|
|
131
|
-
* and removes entries that were in {@link TransactionItemHandler.deletedItems deletedItems} since they are already deleted
|
|
132
|
-
*
|
|
133
|
-
* ------------------
|
|
134
|
-
*
|
|
135
|
-
* The difference between {@link TransactionCache.applyChangesFromParent} and {@link TransactionCache.applyChangesDelta} is that applyChangesFromParent assumes
|
|
136
|
-
* the change has already been processed, and applyChangesDelta will process the changes once you save the transaction
|
|
137
|
-
*
|
|
138
|
-
* ------------------
|
|
139
|
-
* Use {@link TransactionCache.applyChangesDelta applyChangesDelta} if you want to apply changes from outside the core
|
|
140
|
-
*
|
|
141
|
-
* @param internalChangesDelta Changes to be applied
|
|
142
|
-
* @param isCalledAfterApiSave If 'isCalledAfterApiSave' is true local changes will always be overwritten (instead of only when there are no changes)
|
|
143
|
-
*/
|
|
144
|
-
applyChangesFromParent(internalChangesDelta: InternalChangesDelta, isCalledAfterApiSave?: boolean, isCalledAfterSocketUpdate?: boolean): PromiseInterface<void>;
|
|
145
|
-
/**
|
|
146
|
-
* @description
|
|
147
|
-
* Applies changes to this transaction and its children
|
|
148
|
-
*
|
|
149
|
-
* ------------------
|
|
150
|
-
*
|
|
151
|
-
* The difference between {@link TransactionCache.applyChangesFromParent} and {@link TransactionCache.applyChangesDelta} is that applyChangesFromParent assumes
|
|
152
|
-
* the change has already been processed, and applyChangesDelta will process the changes itself (result vs cause)
|
|
153
|
-
*
|
|
154
|
-
* ------------------
|
|
155
|
-
*
|
|
156
|
-
* Differs from {@link ServerCache.applyChangesDelta ServerCache.applyChangesDelta} in the handling of deleted entries and the applyChangesFromParent call
|
|
157
|
-
*/
|
|
158
|
-
applyChangesDelta(changesDelta: ChangesDelta): PromiseInterface<ChangesDeltaResult>;
|
|
159
|
-
getServerCache(): ServerCache;
|
|
160
|
-
/**
|
|
161
|
-
* @description
|
|
162
|
-
* Gets the entry's parent from the closest transaction
|
|
163
|
-
*
|
|
164
|
-
* @param itemEntry The entry to get the parent from
|
|
165
|
-
* @param fromInitial If `true` the parent values will be read from {@link TransactionItemEntryChanges.initial initial} (Useful for when you've moved an entry)
|
|
166
|
-
* @param providedFields Use the provided fields instead of the cached fields, used by {@link CollectionResource.getParent CollectionResource.getParent}
|
|
167
|
-
*
|
|
168
|
-
* @remark
|
|
169
|
-
* Use {@link CollectionResource.getParent CollectionResource.getParent} instead of {@link TransactionCache.getParent TransactionCache.getParent} if you're getting the parent in the onRemove callback
|
|
170
|
-
*/
|
|
171
|
-
getParent<ItemTypeType extends ItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean, providedFields?: FieldMap<ItemTypeType>): EntryParentNull;
|
|
172
|
-
getCollectionChangesRecursively<ItemTypeType extends ItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery): CachedQueryItem<ItemTypeType> | undefined;
|
|
173
|
-
/**
|
|
174
|
-
* @description
|
|
175
|
-
* Traverses the transaction chain and returns the changes of the item on the first transaction
|
|
176
|
-
*
|
|
177
|
-
* @param copyFields If set, will call {@link ApiFormatter.copyFields ApiFormatter.copyFields}, otherwise just returns the object
|
|
178
|
-
*/
|
|
179
|
-
getItemChangesRecursively(itemEntryId: ItemEntry['id'], copyFields?: boolean): FieldMap;
|
|
180
|
-
/**
|
|
181
|
-
* @description
|
|
182
|
-
* Removes the {@link CollectionResource CollectionResource} from the transaction, preventing the {@link CollectionResource.options.onAdd onAdd} and {@link CollectionResource.options.onRemove onRemove} callbacks from being called.
|
|
183
|
-
* You should call this function when the resource is no longer needed
|
|
184
|
-
*
|
|
185
|
-
* @remark
|
|
186
|
-
* Does not remove cached queries
|
|
187
|
-
*/
|
|
188
|
-
clearCollectionResource(resource: CollectionResource): void;
|
|
189
|
-
/**
|
|
190
|
-
* @description
|
|
191
|
-
* Returns whether or not the {@link TransactionCache.rootItem rootItem} is uses locks
|
|
192
|
-
*/
|
|
193
|
-
isLockable(): boolean;
|
|
194
|
-
/**
|
|
195
|
-
* @description
|
|
196
|
-
* Saves the transaction, this has a different effect depending on the transaction's parent.
|
|
197
|
-
*
|
|
198
|
-
* - If the parent is another {@link TransactionCache TransactionCache} it will merge the changes of the child transaction in the the parent transaction
|
|
199
|
-
* - If the parent is the {@link ServerCache ServerCache} it will save the changes to the APi
|
|
200
|
-
*/
|
|
201
|
-
save(closeTab?: boolean, parameters?: CreateRequestParameterMap, breakUpByParent?: boolean, onAfterCreateCallback?: OnAfterCreateCallback): PromiseInterface<void>;
|
|
202
|
-
/**
|
|
203
|
-
* Rejects when another user is holding the lock, as opposed to {@link LockService.fetchLock}.
|
|
204
|
-
*/
|
|
205
|
-
fetchLock(): PromiseInterface<void>;
|
|
206
|
-
detectChanges(): boolean;
|
|
207
|
-
/**
|
|
208
|
-
* @description
|
|
209
|
-
* Removes an {@link ItemEntry ItemEntry} through an {@link ItemResource ItemResource} from the {@link TransactionCache TransactionCache} which means that changes on this entry will no longer be tracked.
|
|
210
|
-
*/
|
|
211
|
-
clearItem(itemResource: ItemResource<any>): void;
|
|
212
|
-
/**
|
|
213
|
-
* @description
|
|
214
|
-
* Removes an {@link ItemEntry ItemEntry} from the {@link TransactionCache TransactionCache} which means that changes on this entry will no longer be tracked.
|
|
215
|
-
*/
|
|
216
|
-
clearItemEntry(itemEntry: ItemEntry<any>): void;
|
|
217
|
-
/**
|
|
218
|
-
* @description
|
|
219
|
-
* Adds a callback that will fire before the transaction is saved, rejecting this callback will prevent the transaction from saving
|
|
220
|
-
*/
|
|
221
|
-
onBeforeSave(key: string, callback: TransactionCacheCallbackType['onBeforeSave'], condition?: TransactionCacheCallbackCondition, priority?: number): () => void;
|
|
222
|
-
/**
|
|
223
|
-
* @description
|
|
224
|
-
* Adds a callback that will fire when the transaction is saved successfully
|
|
225
|
-
*/
|
|
226
|
-
onSaveSuccess(key: string, callback: TransactionCacheCallbackType['onSaveSuccess'], condition?: TransactionCacheCallbackCondition, priority?: number): () => void;
|
|
227
|
-
/**
|
|
228
|
-
* @description
|
|
229
|
-
* Returns a {@link ModuleChangesCompilationResult ModuleChangesCompilationResult} for the transaction
|
|
230
|
-
*/
|
|
231
|
-
getModuleChanges(): ModuleChangesCompilationResult;
|
|
232
|
-
/**
|
|
233
|
-
* @description
|
|
234
|
-
* Updates the passed map with the new {@link ConversionMap CconversionMap} values
|
|
235
|
-
*/
|
|
236
|
-
updateItemIdMap(collectionMap: {
|
|
237
|
-
[itemId: number]: any;
|
|
238
|
-
}, conversionMap: ConversionMap): void;
|
|
239
|
-
getAllLinkCollections<ItemTypeType extends ItemType>(linkType: ItemType, itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>): PromiseInterface<CollectionResourceParentIdMap<ItemTypeType>>;
|
|
240
|
-
getLinkCollectionsFromDef<ItemTypeType extends ItemType>(linkType: ItemType, linkIdArray: ItemId[], definition: LinkCollectionDefinition<ItemTypeType>): PromiseInterface<CollectionResourceParentIdMap<ItemTypeType>>;
|
|
241
|
-
getLinkCollections<ItemTypeType extends ItemType>(linkType: ItemType, linkIdArray: ItemId[], itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>): PromiseInterface<CollectionResourceParentIdMap<ItemTypeType>>;
|
|
242
|
-
getCollectionFromDef<ItemTypeType extends ItemType>(definition: CollectionDefinition<ItemTypeType>): PromiseInterface<CollectionResource<ItemTypeType>>;
|
|
243
|
-
getCollection<ItemTypeType extends ItemType, Fields extends FieldMap<ItemTypeType> = FieldMap<ItemTypeType>>(itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>): PromiseInterface<CollectionResource<ItemTypeType, Fields>>;
|
|
244
|
-
getCollectionDef<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>): CollectionDefinition<ItemTypeType>;
|
|
245
|
-
getLinkCollectionsDef<ItemTypeType extends ItemType>(itemType: ItemTypeType, linkField: string, options: CollectionOptionsInterface<ItemTypeType>): LinkCollectionDefinition<ItemTypeType>;
|
|
246
|
-
/**
|
|
247
|
-
* @deprecated
|
|
248
|
-
* Use getItemById/getNewResourceWithId
|
|
249
|
-
*
|
|
250
|
-
* @remarks
|
|
251
|
-
* stateKey can be a keyword or a local id (in case of a refresh)
|
|
252
|
-
*/
|
|
253
|
-
getItemByState<ItemTypeType extends ItemType>(itemType: ItemTypeType, stateKey: ItemId | string, options?: ItemOptionsInterface, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
|
|
254
|
-
getDuplicateById<ItemTypeType extends ItemType>(itemType: ItemTypeType, duplicateId: ItemId, options: ItemOptionsInterface, returnLinks: true, isRoot?: boolean): PromiseInterface<ItemResourceLinks<ItemTypeType>>;
|
|
255
|
-
getDuplicateById<ItemTypeType extends ItemType>(itemType: ItemTypeType, duplicateId: ItemId, options: ItemOptionsInterface, returnLinks?: boolean, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
|
|
256
|
-
getNewResourceWithId<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options: Partial<ItemEntryOptions>, returnLinks: true, isRoot?: boolean): PromiseInterface<ItemResourceLinks<ItemTypeType>>;
|
|
257
|
-
getNewResourceWithId<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options: Partial<ItemEntryOptions>, returnLinks?: boolean, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
|
|
258
|
-
getNewResource<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: ItemOptionsInterface, returnLinks: true, isRoot?: boolean): PromiseInterface<ItemResourceLinks<ItemTypeType>>;
|
|
259
|
-
getNewResource<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: ItemOptionsInterface, returnLinks?: boolean, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
|
|
260
|
-
/**
|
|
261
|
-
* @description
|
|
262
|
-
* Fetches multiple items with their respective changes of the current {@link TransactionCache transaction}
|
|
263
|
-
*/
|
|
264
|
-
getItemsByQuery<ItemTypeType extends ItemType>(itemType: ItemTypeType, query: ApiQuery, options?: Partial<ItemEntryOptions>): PromiseInterface<Array<ItemResource<ItemTypeType>>>;
|
|
265
|
-
/**
|
|
266
|
-
* @description
|
|
267
|
-
* Fetches multiple items with their respective changes of the current {@link TransactionCache transaction}
|
|
268
|
-
*/
|
|
269
|
-
getItemsById<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemIds: ItemId[], options?: Partial<ItemEntryOptions>): PromiseInterface<Array<ItemResource<ItemTypeType>>>;
|
|
270
|
-
/**
|
|
271
|
-
* @description
|
|
272
|
-
* Fetches the item with the changes of the current {@link TransactionCache transaction}
|
|
273
|
-
*
|
|
274
|
-
* @param isRoot Sets the item as the root item of the transaction, new items will be linked to this item (if there's a connection in the LinkTree)
|
|
275
|
-
*/
|
|
276
|
-
getItemById<ItemTypeType extends ItemType, Fields extends FieldMap<ItemTypeType> = FieldMap<ItemTypeType>>(itemType: ItemTypeType, itemId: ItemId, options?: Partial<ItemEntryOptions>, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType, Fields>>;
|
|
277
|
-
/**
|
|
278
|
-
* @description
|
|
279
|
-
* Fetches the title of an item, does not create an {@link ItemResource ItemResource}
|
|
280
|
-
*/
|
|
281
|
-
fetchTitle(itemType: ItemType, itemId: ItemId): PromiseInterface<string>;
|
|
282
|
-
/**
|
|
283
|
-
* @description
|
|
284
|
-
* Merges the passed child Transaction into this transaction and then propagates them to the other child transactions
|
|
285
|
-
*/
|
|
286
|
-
applyChangesFromChild(childTransaction: TransactionCache, _breakUpByParent?: boolean, _onAfterCreateCallback?: OnAfterCreateCallback): PromiseInterface<ItemIdConversionMap>;
|
|
287
|
-
/**
|
|
288
|
-
* @description
|
|
289
|
-
* Gets an already cached {@link ItemEntry ItemEntry} and the changes of this specific transaction for that entry
|
|
290
|
-
*/
|
|
291
|
-
getLocalItemEntryChangesTuple(itemEntryId: ItemEntry['id']): {
|
|
292
|
-
entry: ItemEntry;
|
|
293
|
-
changes: TransactionItemEntryChanges;
|
|
294
|
-
};
|
|
295
|
-
/**
|
|
296
|
-
* @description
|
|
297
|
-
* Gets an ItemEntry from the cache, doesn't do a API request, used for saving
|
|
298
|
-
*/
|
|
299
|
-
getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry | undefined;
|
|
300
|
-
/**
|
|
301
|
-
* @description
|
|
302
|
-
* Gets an ItemEntry from the cache by ItemId
|
|
303
|
-
*/
|
|
304
|
-
getLocalItemEntryByItemId(itemType: ItemType, itemId: ItemEntry['itemId']): ItemEntry | undefined;
|
|
305
|
-
/**
|
|
306
|
-
* @description
|
|
307
|
-
* Returns the complete {@link InternalChangesDelta InternalChangesDelta} of the TransactionCache, this only takes into account the end result (initial is compared to changes), so changing something and reverting it
|
|
308
|
-
* won't be included
|
|
309
|
-
*/
|
|
310
|
-
getDelta(): InternalChangesDelta;
|
|
311
|
-
createItemResource<ItemTypeType extends ItemType>(itemEntry: ItemEntry<ItemTypeType>, isRoot?: boolean, isNew?: boolean): ItemResource<ItemTypeType>;
|
|
312
|
-
createItemResources<ItemTypeType extends ItemType, Fields extends ColumnIdTypeMap = any>(itemEntries: Array<ItemEntry<ItemTypeType>>): Array<ItemResource<ItemTypeType, Fields>>;
|
|
313
|
-
processLinkedItems<ItemTypeType extends ItemType>(linkedEntries: ItemTypeMap<ItemEntry[]>): ItemResourcesItemTypeMap<ItemResource<ItemTypeType>>;
|
|
314
|
-
createCollectionResource<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>, initialEntries: Array<ItemEntry<ItemTypeType>>): CollectionResource<ItemTypeType>;
|
|
315
|
-
getChangesFromItemChanges<ItemTypeType extends ItemType = any>(changesObject: TransactionItemEntryChanges<ItemTypeType>): FieldMap<ItemTypeType>;
|
|
316
|
-
/**
|
|
317
|
-
* @description
|
|
318
|
-
* Fetches all required columns to match/fit in collections
|
|
319
|
-
*/
|
|
320
|
-
private expandItemsFromDelta;
|
|
321
|
-
private clearGlobalError;
|
|
322
|
-
clearItemError(itemEntryId?: ItemEntry['id'], columnId?: string, errorKey?: string): void;
|
|
323
|
-
}
|
|
324
|
-
export {};
|
|
1
|
+
import { ChangesDelta, InternalChangesDelta, ServerCache, TransactionCollectionHandler, TransactionItemEntryChanges, TransactionItemHandler, TransactionValidatorFactory } from '../..';
|
|
2
|
+
import { RmCore } from '../../../core';
|
|
3
|
+
import { AbstractCacheDependencyInterface } from '../../../interfaces/AbstractCacheDependencyInterface';
|
|
4
|
+
import { CollectionResource, ItemEntry, ItemEntryOptions, ItemResource } from '../../../models';
|
|
5
|
+
import { CollectionOptionsInterface } from '../../../models/CollectionOptions';
|
|
6
|
+
import { ApiQuery, ApiRequestColumn, ApiRequestColumns, CollectionDefinition, CollectionQuery, CollectionResourceParentIdMap, ColumnIdTypeMap, ConversionMap, CreateRequestParameterMap, DeregFunction, EntryParentNull, FieldChangeCallback, FieldMap, ItemId, ItemIdConversionMap, ItemOptionsInterface, ItemResourcesItemTypeMap, ItemType, ItemTypeMap, LinkCollectionDefinition, PromiseInterface } from '../../../types';
|
|
7
|
+
import { ChangesDeltaResult } from '../../ChangesDeltaBase';
|
|
8
|
+
import { OnAfterCreateCallback } from '../../ChangesProcessor';
|
|
9
|
+
import { ModuleChangesCompilationResult } from '../../ModuleChangesCompilation';
|
|
10
|
+
import { AbstractCache } from '../AbstractCache';
|
|
11
|
+
import { CachedQueryItem } from '../CachedQueryHandlerBase';
|
|
12
|
+
import { TransactionCachedQueryHandler } from './TransactionCachedQueryHandler';
|
|
13
|
+
import { TransactionCacheCallbackCondition, TransactionCacheCallbackType, TransactionEventHandler } from './TransactionEventHandler';
|
|
14
|
+
declare type ItemResourceLinks<ItemTypeType extends ItemType> = {
|
|
15
|
+
main: ItemResource<ItemTypeType>;
|
|
16
|
+
linked: ItemResourcesItemTypeMap;
|
|
17
|
+
};
|
|
18
|
+
export declare enum TransactionErrorLevel {
|
|
19
|
+
warning = "warning",
|
|
20
|
+
error = "error"
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @description
|
|
24
|
+
* The {@link TransactionCache TransactionCache} is responsible for keeping track of newly created {@link ItemEntry ItemEntries}
|
|
25
|
+
* and {@link CollectionEntry CollectionEntries}, and the changes of existing ItemEntries and CollectionEntries.
|
|
26
|
+
*
|
|
27
|
+
* The TransactionCache is also responsible for creating {@link ItemResource ItemResources}, which is a combination of an {@link ItemEntry ItemEntry} and the current transaction's changes on this ItemEntry
|
|
28
|
+
*/
|
|
29
|
+
export declare class TransactionCache extends AbstractCache {
|
|
30
|
+
/**
|
|
31
|
+
* @description
|
|
32
|
+
* For debugging purposes
|
|
33
|
+
*/
|
|
34
|
+
id?: string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* @description
|
|
37
|
+
* A map of all item errors, can be populated using {@link TransactionValidator.setGlobalError TransactionValidator.setGlobalError} and {@link TransactionValidator.setItemError TransactionValidator.setItemError}.
|
|
38
|
+
* Contains a translation and level for every error
|
|
39
|
+
*/
|
|
40
|
+
errors: {
|
|
41
|
+
item: {
|
|
42
|
+
[itemEntryId: string]: {
|
|
43
|
+
[columnId: string]: {
|
|
44
|
+
[errorKey: string]: {
|
|
45
|
+
fieldString: string;
|
|
46
|
+
string: string;
|
|
47
|
+
level: TransactionErrorLevel;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
global: {
|
|
53
|
+
[key: string]: {
|
|
54
|
+
string: string;
|
|
55
|
+
level: TransactionErrorLevel;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
get isValid(): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* @description
|
|
62
|
+
* Stores the 'root' {@link ItemEntry ItemEntry}, this {@link ItemEntry ItemEntry} can be used as request parent to store the whole transaction at once
|
|
63
|
+
*/
|
|
64
|
+
rootItem: ItemEntry | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* @description
|
|
67
|
+
* Stores additional request parameters for when the transaction is stored to the server
|
|
68
|
+
*/
|
|
69
|
+
tabRequestParameters: {};
|
|
70
|
+
/**
|
|
71
|
+
* @description
|
|
72
|
+
* Is true while the {@link TransactionCache TransactionCache} is applying changes to the parent (can either be through a merge or an Api save)
|
|
73
|
+
*/
|
|
74
|
+
isSaving: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* @description
|
|
77
|
+
* Is true when the current transaction has:
|
|
78
|
+
* - Newly created items
|
|
79
|
+
* - Removed items (from collections)
|
|
80
|
+
* - Changes on existing items
|
|
81
|
+
*/
|
|
82
|
+
hasChanges: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* @description
|
|
85
|
+
* The transaction's parent
|
|
86
|
+
*/
|
|
87
|
+
readonly parent: AbstractCache;
|
|
88
|
+
readonly itemHandler: TransactionItemHandler;
|
|
89
|
+
readonly cachedQueryHandler: TransactionCachedQueryHandler;
|
|
90
|
+
readonly collectionHandler: TransactionCollectionHandler;
|
|
91
|
+
readonly eventHandler: TransactionEventHandler;
|
|
92
|
+
private readonly validator?;
|
|
93
|
+
private _isValid;
|
|
94
|
+
constructor(dependencies: AbstractCacheDependencyInterface, core: RmCore, parent: AbstractCache,
|
|
95
|
+
/**
|
|
96
|
+
* @description
|
|
97
|
+
* For debugging purposes
|
|
98
|
+
*/
|
|
99
|
+
id?: string | undefined, validatorFactory?: TransactionValidatorFactory);
|
|
100
|
+
createChild(id?: string, validatorFactory?: TransactionValidatorFactory): TransactionCache;
|
|
101
|
+
destroy(): void;
|
|
102
|
+
expandCollectionResource(collectionResource: CollectionResource, newColumns: ApiRequestColumns): PromiseInterface<void>;
|
|
103
|
+
/**
|
|
104
|
+
* @description
|
|
105
|
+
* Expands the collection with the new request columns, assumes that all collections have the same itemType
|
|
106
|
+
*/
|
|
107
|
+
expandCollectionResources<ItemTypeType extends ItemType>(itemType: ItemTypeType, collections: CollectionResourceParentIdMap<ItemTypeType>, newColumns: ApiRequestColumn[]): PromiseInterface<CollectionResourceParentIdMap>;
|
|
108
|
+
registerFieldChangeCallback<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, callback: FieldChangeCallback<ItemTypeType>): DeregFunction;
|
|
109
|
+
createChangesDelta(): ChangesDelta;
|
|
110
|
+
getFirstErrorString(): undefined | string;
|
|
111
|
+
/**
|
|
112
|
+
* @description
|
|
113
|
+
* Should only be called by {@link TransactionValidator TransactionValidator}
|
|
114
|
+
* @internal
|
|
115
|
+
*/
|
|
116
|
+
_setGlobalError(key: string, isInvalid: boolean, saveButtonErrorTranslationFn: () => string, level: TransactionErrorLevel): void;
|
|
117
|
+
/**
|
|
118
|
+
* @description
|
|
119
|
+
* Should only be called by {@link TransactionValidator TransactionValidator}
|
|
120
|
+
* @internal
|
|
121
|
+
*/
|
|
122
|
+
_setItemError(itemEntryId: ItemEntry['id'], columnId: string, errorKey: string, isInvalid: boolean, fieldErrorTranslationFn: () => string, saveButtonErrorTranslationFn: () => string, level: TransactionErrorLevel): void;
|
|
123
|
+
/**
|
|
124
|
+
* @internal
|
|
125
|
+
*/
|
|
126
|
+
_setIsValid(): void;
|
|
127
|
+
/**
|
|
128
|
+
* @description
|
|
129
|
+
* Merges the passed changes from the parent Transaction into this Transaction's own changes and then propagates
|
|
130
|
+
* them to all child Transactions, this assumes that an action is already handled in a parent, so it does't handle created entries
|
|
131
|
+
* and removes entries that were in {@link TransactionItemHandler.deletedItems deletedItems} since they are already deleted
|
|
132
|
+
*
|
|
133
|
+
* ------------------
|
|
134
|
+
*
|
|
135
|
+
* The difference between {@link TransactionCache.applyChangesFromParent} and {@link TransactionCache.applyChangesDelta} is that applyChangesFromParent assumes
|
|
136
|
+
* the change has already been processed, and applyChangesDelta will process the changes once you save the transaction
|
|
137
|
+
*
|
|
138
|
+
* ------------------
|
|
139
|
+
* Use {@link TransactionCache.applyChangesDelta applyChangesDelta} if you want to apply changes from outside the core
|
|
140
|
+
*
|
|
141
|
+
* @param internalChangesDelta Changes to be applied
|
|
142
|
+
* @param isCalledAfterApiSave If 'isCalledAfterApiSave' is true local changes will always be overwritten (instead of only when there are no changes)
|
|
143
|
+
*/
|
|
144
|
+
applyChangesFromParent(internalChangesDelta: InternalChangesDelta, isCalledAfterApiSave?: boolean, isCalledAfterSocketUpdate?: boolean): PromiseInterface<void>;
|
|
145
|
+
/**
|
|
146
|
+
* @description
|
|
147
|
+
* Applies changes to this transaction and its children
|
|
148
|
+
*
|
|
149
|
+
* ------------------
|
|
150
|
+
*
|
|
151
|
+
* The difference between {@link TransactionCache.applyChangesFromParent} and {@link TransactionCache.applyChangesDelta} is that applyChangesFromParent assumes
|
|
152
|
+
* the change has already been processed, and applyChangesDelta will process the changes itself (result vs cause)
|
|
153
|
+
*
|
|
154
|
+
* ------------------
|
|
155
|
+
*
|
|
156
|
+
* Differs from {@link ServerCache.applyChangesDelta ServerCache.applyChangesDelta} in the handling of deleted entries and the applyChangesFromParent call
|
|
157
|
+
*/
|
|
158
|
+
applyChangesDelta(changesDelta: ChangesDelta): PromiseInterface<ChangesDeltaResult>;
|
|
159
|
+
getServerCache(): ServerCache;
|
|
160
|
+
/**
|
|
161
|
+
* @description
|
|
162
|
+
* Gets the entry's parent from the closest transaction
|
|
163
|
+
*
|
|
164
|
+
* @param itemEntry The entry to get the parent from
|
|
165
|
+
* @param fromInitial If `true` the parent values will be read from {@link TransactionItemEntryChanges.initial initial} (Useful for when you've moved an entry)
|
|
166
|
+
* @param providedFields Use the provided fields instead of the cached fields, used by {@link CollectionResource.getParent CollectionResource.getParent}
|
|
167
|
+
*
|
|
168
|
+
* @remark
|
|
169
|
+
* Use {@link CollectionResource.getParent CollectionResource.getParent} instead of {@link TransactionCache.getParent TransactionCache.getParent} if you're getting the parent in the onRemove callback
|
|
170
|
+
*/
|
|
171
|
+
getParent<ItemTypeType extends ItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean, providedFields?: FieldMap<ItemTypeType>): EntryParentNull;
|
|
172
|
+
getCollectionChangesRecursively<ItemTypeType extends ItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery): CachedQueryItem<ItemTypeType> | undefined;
|
|
173
|
+
/**
|
|
174
|
+
* @description
|
|
175
|
+
* Traverses the transaction chain and returns the changes of the item on the first transaction
|
|
176
|
+
*
|
|
177
|
+
* @param copyFields If set, will call {@link ApiFormatter.copyFields ApiFormatter.copyFields}, otherwise just returns the object
|
|
178
|
+
*/
|
|
179
|
+
getItemChangesRecursively(itemEntryId: ItemEntry['id'], copyFields?: boolean): FieldMap;
|
|
180
|
+
/**
|
|
181
|
+
* @description
|
|
182
|
+
* Removes the {@link CollectionResource CollectionResource} from the transaction, preventing the {@link CollectionResource.options.onAdd onAdd} and {@link CollectionResource.options.onRemove onRemove} callbacks from being called.
|
|
183
|
+
* You should call this function when the resource is no longer needed
|
|
184
|
+
*
|
|
185
|
+
* @remark
|
|
186
|
+
* Does not remove cached queries
|
|
187
|
+
*/
|
|
188
|
+
clearCollectionResource(resource: CollectionResource): void;
|
|
189
|
+
/**
|
|
190
|
+
* @description
|
|
191
|
+
* Returns whether or not the {@link TransactionCache.rootItem rootItem} is uses locks
|
|
192
|
+
*/
|
|
193
|
+
isLockable(): boolean;
|
|
194
|
+
/**
|
|
195
|
+
* @description
|
|
196
|
+
* Saves the transaction, this has a different effect depending on the transaction's parent.
|
|
197
|
+
*
|
|
198
|
+
* - If the parent is another {@link TransactionCache TransactionCache} it will merge the changes of the child transaction in the the parent transaction
|
|
199
|
+
* - If the parent is the {@link ServerCache ServerCache} it will save the changes to the APi
|
|
200
|
+
*/
|
|
201
|
+
save(closeTab?: boolean, parameters?: CreateRequestParameterMap, breakUpByParent?: boolean, onAfterCreateCallback?: OnAfterCreateCallback): PromiseInterface<void>;
|
|
202
|
+
/**
|
|
203
|
+
* Rejects when another user is holding the lock, as opposed to {@link LockService.fetchLock}.
|
|
204
|
+
*/
|
|
205
|
+
fetchLock(): PromiseInterface<void>;
|
|
206
|
+
detectChanges(): boolean;
|
|
207
|
+
/**
|
|
208
|
+
* @description
|
|
209
|
+
* Removes an {@link ItemEntry ItemEntry} through an {@link ItemResource ItemResource} from the {@link TransactionCache TransactionCache} which means that changes on this entry will no longer be tracked.
|
|
210
|
+
*/
|
|
211
|
+
clearItem(itemResource: ItemResource<any>): void;
|
|
212
|
+
/**
|
|
213
|
+
* @description
|
|
214
|
+
* Removes an {@link ItemEntry ItemEntry} from the {@link TransactionCache TransactionCache} which means that changes on this entry will no longer be tracked.
|
|
215
|
+
*/
|
|
216
|
+
clearItemEntry(itemEntry: ItemEntry<any>): void;
|
|
217
|
+
/**
|
|
218
|
+
* @description
|
|
219
|
+
* Adds a callback that will fire before the transaction is saved, rejecting this callback will prevent the transaction from saving
|
|
220
|
+
*/
|
|
221
|
+
onBeforeSave(key: string, callback: TransactionCacheCallbackType['onBeforeSave'], condition?: TransactionCacheCallbackCondition, priority?: number): () => void;
|
|
222
|
+
/**
|
|
223
|
+
* @description
|
|
224
|
+
* Adds a callback that will fire when the transaction is saved successfully
|
|
225
|
+
*/
|
|
226
|
+
onSaveSuccess(key: string, callback: TransactionCacheCallbackType['onSaveSuccess'], condition?: TransactionCacheCallbackCondition, priority?: number): () => void;
|
|
227
|
+
/**
|
|
228
|
+
* @description
|
|
229
|
+
* Returns a {@link ModuleChangesCompilationResult ModuleChangesCompilationResult} for the transaction
|
|
230
|
+
*/
|
|
231
|
+
getModuleChanges(): ModuleChangesCompilationResult;
|
|
232
|
+
/**
|
|
233
|
+
* @description
|
|
234
|
+
* Updates the passed map with the new {@link ConversionMap CconversionMap} values
|
|
235
|
+
*/
|
|
236
|
+
updateItemIdMap(collectionMap: {
|
|
237
|
+
[itemId: number]: any;
|
|
238
|
+
}, conversionMap: ConversionMap): void;
|
|
239
|
+
getAllLinkCollections<ItemTypeType extends ItemType>(linkType: ItemType, itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>): PromiseInterface<CollectionResourceParentIdMap<ItemTypeType>>;
|
|
240
|
+
getLinkCollectionsFromDef<ItemTypeType extends ItemType>(linkType: ItemType, linkIdArray: ItemId[], definition: LinkCollectionDefinition<ItemTypeType>): PromiseInterface<CollectionResourceParentIdMap<ItemTypeType>>;
|
|
241
|
+
getLinkCollections<ItemTypeType extends ItemType>(linkType: ItemType, linkIdArray: ItemId[], itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>): PromiseInterface<CollectionResourceParentIdMap<ItemTypeType>>;
|
|
242
|
+
getCollectionFromDef<ItemTypeType extends ItemType>(definition: CollectionDefinition<ItemTypeType>): PromiseInterface<CollectionResource<ItemTypeType>>;
|
|
243
|
+
getCollection<ItemTypeType extends ItemType, Fields extends FieldMap<ItemTypeType> = FieldMap<ItemTypeType>>(itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>): PromiseInterface<CollectionResource<ItemTypeType, Fields>>;
|
|
244
|
+
getCollectionDef<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>): CollectionDefinition<ItemTypeType>;
|
|
245
|
+
getLinkCollectionsDef<ItemTypeType extends ItemType>(itemType: ItemTypeType, linkField: string, options: CollectionOptionsInterface<ItemTypeType>): LinkCollectionDefinition<ItemTypeType>;
|
|
246
|
+
/**
|
|
247
|
+
* @deprecated
|
|
248
|
+
* Use getItemById/getNewResourceWithId
|
|
249
|
+
*
|
|
250
|
+
* @remarks
|
|
251
|
+
* stateKey can be a keyword or a local id (in case of a refresh)
|
|
252
|
+
*/
|
|
253
|
+
getItemByState<ItemTypeType extends ItemType>(itemType: ItemTypeType, stateKey: ItemId | string, options?: ItemOptionsInterface, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
|
|
254
|
+
getDuplicateById<ItemTypeType extends ItemType>(itemType: ItemTypeType, duplicateId: ItemId, options: ItemOptionsInterface, returnLinks: true, isRoot?: boolean): PromiseInterface<ItemResourceLinks<ItemTypeType>>;
|
|
255
|
+
getDuplicateById<ItemTypeType extends ItemType>(itemType: ItemTypeType, duplicateId: ItemId, options: ItemOptionsInterface, returnLinks?: boolean, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
|
|
256
|
+
getNewResourceWithId<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options: Partial<ItemEntryOptions>, returnLinks: true, isRoot?: boolean): PromiseInterface<ItemResourceLinks<ItemTypeType>>;
|
|
257
|
+
getNewResourceWithId<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options: Partial<ItemEntryOptions>, returnLinks?: boolean, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
|
|
258
|
+
getNewResource<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: ItemOptionsInterface, returnLinks: true, isRoot?: boolean): PromiseInterface<ItemResourceLinks<ItemTypeType>>;
|
|
259
|
+
getNewResource<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: ItemOptionsInterface, returnLinks?: boolean, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
|
|
260
|
+
/**
|
|
261
|
+
* @description
|
|
262
|
+
* Fetches multiple items with their respective changes of the current {@link TransactionCache transaction}
|
|
263
|
+
*/
|
|
264
|
+
getItemsByQuery<ItemTypeType extends ItemType>(itemType: ItemTypeType, query: ApiQuery, options?: Partial<ItemEntryOptions>): PromiseInterface<Array<ItemResource<ItemTypeType>>>;
|
|
265
|
+
/**
|
|
266
|
+
* @description
|
|
267
|
+
* Fetches multiple items with their respective changes of the current {@link TransactionCache transaction}
|
|
268
|
+
*/
|
|
269
|
+
getItemsById<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemIds: ItemId[], options?: Partial<ItemEntryOptions>): PromiseInterface<Array<ItemResource<ItemTypeType>>>;
|
|
270
|
+
/**
|
|
271
|
+
* @description
|
|
272
|
+
* Fetches the item with the changes of the current {@link TransactionCache transaction}
|
|
273
|
+
*
|
|
274
|
+
* @param isRoot Sets the item as the root item of the transaction, new items will be linked to this item (if there's a connection in the LinkTree)
|
|
275
|
+
*/
|
|
276
|
+
getItemById<ItemTypeType extends ItemType, Fields extends FieldMap<ItemTypeType> = FieldMap<ItemTypeType>>(itemType: ItemTypeType, itemId: ItemId, options?: Partial<ItemEntryOptions>, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType, Fields>>;
|
|
277
|
+
/**
|
|
278
|
+
* @description
|
|
279
|
+
* Fetches the title of an item, does not create an {@link ItemResource ItemResource}
|
|
280
|
+
*/
|
|
281
|
+
fetchTitle(itemType: ItemType, itemId: ItemId): PromiseInterface<string>;
|
|
282
|
+
/**
|
|
283
|
+
* @description
|
|
284
|
+
* Merges the passed child Transaction into this transaction and then propagates them to the other child transactions
|
|
285
|
+
*/
|
|
286
|
+
applyChangesFromChild(childTransaction: TransactionCache, _breakUpByParent?: boolean, _onAfterCreateCallback?: OnAfterCreateCallback): PromiseInterface<ItemIdConversionMap>;
|
|
287
|
+
/**
|
|
288
|
+
* @description
|
|
289
|
+
* Gets an already cached {@link ItemEntry ItemEntry} and the changes of this specific transaction for that entry
|
|
290
|
+
*/
|
|
291
|
+
getLocalItemEntryChangesTuple(itemEntryId: ItemEntry['id']): {
|
|
292
|
+
entry: ItemEntry;
|
|
293
|
+
changes: TransactionItemEntryChanges;
|
|
294
|
+
};
|
|
295
|
+
/**
|
|
296
|
+
* @description
|
|
297
|
+
* Gets an ItemEntry from the cache, doesn't do a API request, used for saving
|
|
298
|
+
*/
|
|
299
|
+
getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry | undefined;
|
|
300
|
+
/**
|
|
301
|
+
* @description
|
|
302
|
+
* Gets an ItemEntry from the cache by ItemId
|
|
303
|
+
*/
|
|
304
|
+
getLocalItemEntryByItemId(itemType: ItemType, itemId: ItemEntry['itemId']): ItemEntry | undefined;
|
|
305
|
+
/**
|
|
306
|
+
* @description
|
|
307
|
+
* Returns the complete {@link InternalChangesDelta InternalChangesDelta} of the TransactionCache, this only takes into account the end result (initial is compared to changes), so changing something and reverting it
|
|
308
|
+
* won't be included
|
|
309
|
+
*/
|
|
310
|
+
getDelta(): InternalChangesDelta;
|
|
311
|
+
createItemResource<ItemTypeType extends ItemType>(itemEntry: ItemEntry<ItemTypeType>, isRoot?: boolean, isNew?: boolean): ItemResource<ItemTypeType>;
|
|
312
|
+
createItemResources<ItemTypeType extends ItemType, Fields extends ColumnIdTypeMap = any>(itemEntries: Array<ItemEntry<ItemTypeType>>): Array<ItemResource<ItemTypeType, Fields>>;
|
|
313
|
+
processLinkedItems<ItemTypeType extends ItemType>(linkedEntries: ItemTypeMap<ItemEntry[]>): ItemResourcesItemTypeMap<ItemResource<ItemTypeType>>;
|
|
314
|
+
createCollectionResource<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>, initialEntries: Array<ItemEntry<ItemTypeType>>): CollectionResource<ItemTypeType>;
|
|
315
|
+
getChangesFromItemChanges<ItemTypeType extends ItemType = any>(changesObject: TransactionItemEntryChanges<ItemTypeType>): FieldMap<ItemTypeType>;
|
|
316
|
+
/**
|
|
317
|
+
* @description
|
|
318
|
+
* Fetches all required columns to match/fit in collections
|
|
319
|
+
*/
|
|
320
|
+
private expandItemsFromDelta;
|
|
321
|
+
private clearGlobalError;
|
|
322
|
+
clearItemError(itemEntryId?: ItemEntry['id'], columnId?: string, errorKey?: string): void;
|
|
323
|
+
}
|
|
324
|
+
export {};
|