@rentman/rm-core 6.1.2 → 6.2.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.
@@ -8,6 +8,7 @@ export declare type ChangesDeltaItemCreateDelta<ItemTypeType extends ItemType =
8
8
  export declare class CreatedChangesDelta {
9
9
  private tuples;
10
10
  constructor();
11
+ remove(itemType: ItemType, itemId: ItemId): boolean;
11
12
  add<ItemTypeType extends ItemType>(itemId: ItemId, fields: FieldMap<ItemTypeType>, columns: ColumnSet<ItemTypeType>): void;
12
13
  isEmpty(): boolean;
13
14
  forEach(callback: (tuple: ChangesDeltaItemCreateDelta, itemType: ItemType, index: number) => void): void;
@@ -92,6 +92,7 @@ export declare abstract class AbstractCache {
92
92
  protected _applyChangesDelta(changesDelta: ChangesDelta): {
93
93
  result: ChangesDeltaResult;
94
94
  internalChangesDelta: InternalChangesDelta;
95
+ matchingDelta: InternalChangesDelta;
95
96
  rollbackFunctions: Array<(changesDelta: ChangesDelta) => void>;
96
97
  };
97
98
  /**
@@ -1,5 +1,5 @@
1
1
  import { RequestColumnExpansionFactory } from '../../factories';
2
- import { Deferred, PromiseLibraryInterface } from '../../interfaces';
2
+ import { PromiseLibraryInterface } from '../../interfaces';
3
3
  import { ItemEntry } from '../../models';
4
4
  import { CollectionOptions } from '../../models/CollectionOptions';
5
5
  import { ApiQuery, ApiRequestColumns, CollectionQuery, ItemId, ItemType, ParentIdMap, PromiseInterface } from '../../types';
@@ -12,8 +12,9 @@ export declare type CachedQueryItem<ItemTypeType extends ItemType = any> = {
12
12
  query: CollectionQuery;
13
13
  items: Array<ItemEntry<ItemTypeType>>;
14
14
  requestColumns: ApiRequestColumns;
15
- deferred: Deferred<CachedQueryItem<ItemTypeType>>;
16
15
  promise: PromiseInterface<CachedQueryItem<ItemTypeType>>;
16
+ resolve: () => void;
17
+ reject: (reason: string) => void;
17
18
  };
18
19
  export declare abstract class CachedQueryHandlerBase {
19
20
  protected collectionEntryService: CollectionEntryService;
@@ -56,7 +56,7 @@ export declare class TransactionCache extends AbstractCache {
56
56
  };
57
57
  };
58
58
  };
59
- isValid: boolean;
59
+ get isValid(): boolean;
60
60
  /**
61
61
  * @description
62
62
  * Stores the 'root' {@link ItemEntry ItemEntry}, this {@link ItemEntry ItemEntry} can be used as request parent to store the whole transaction at once
@@ -91,6 +91,7 @@ export declare class TransactionCache extends AbstractCache {
91
91
  readonly eventHandler: TransactionEventHandler;
92
92
  private readonly validator?;
93
93
  private changesInterval;
94
+ private _isValid;
94
95
  constructor(dependencies: AbstractCacheDependencyInterface, core: RmCore, parent: AbstractCache,
95
96
  /**
96
97
  * @description
@@ -59,7 +59,7 @@ export declare class TransactionItemHandler extends ItemHandlerBase {
59
59
  * @param createItemChangesIfNoneExist Is `true` when called from `applyChangesDelta`, we can assume that when you call `applyChangesDelta` with updates that aren't on the transaction yet you want to add those
60
60
  *
61
61
  * @returns
62
- * The previous changes {@link FieldMap FieldMap}
62
+ * The previous changes {@link FieldMap FieldMap}, returns `null` when the item was not cached or no fields were changed.
63
63
  */
64
64
  processItemEntryChanges<ItemTypeType extends ItemType = any>(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, forceOverwrite?: boolean, updateInitial?: boolean, isCalledAfterSocketUpdate?: boolean, createItemChangesIfNoneExist?: boolean): FieldMap<ItemTypeType> | null;
65
65
  cloneItemEntries<ItemTypeType extends ItemType>(changesDelta: ChangesDelta, itemEntries: Array<ItemEntry<ItemTypeType>>, conversionMap?: ItemIdConversionMap, modifyFieldsCallback?: ModifyFieldsCallback): ItemId[];
@@ -6,8 +6,14 @@ export interface TransactionValidatorFactory {
6
6
  }
7
7
  export declare abstract class TransactionValidator {
8
8
  protected transaction: TransactionCache;
9
- private lastCallId;
9
+ private lastCallIdMap;
10
+ private _lastCallId;
10
11
  protected constructor(transaction: TransactionCache);
12
+ /**
13
+ * @description
14
+ * Will return `true` if there are any validators pending
15
+ */
16
+ isPending(): boolean;
11
17
  /**
12
18
  * @description
13
19
  * Will be called after {@link TransactionCache.applyChangesFromParent applyChangesFromParent}, {@link TransactionCache.applyChangesFromChild applyChangesFromChild} or {@link TransactionCache.applyChangesDelta applyChangesDelta} is called
@@ -24,5 +30,5 @@ export declare abstract class TransactionValidator {
24
30
  abstract validateItem<ItemTypeType extends ItemType>(itemEntry: ItemEntry<ItemTypeType>, fields: FieldMap<ItemTypeType>, previous: FieldMap<ItemTypeType>): void;
25
31
  protected setGlobalError(key: string, isInvalid: boolean | PromiseInterface<boolean>, saveButtonErrorTranslationFn: () => string, level: TransactionErrorLevel): void;
26
32
  protected setItemError(itemEntryId: ItemEntry['id'], columnId: string, errorKey: string, isInvalid: boolean | PromiseInterface<boolean>, fieldErrorTranslationFn: () => string, saveButtonErrorTranslationFn: () => string, level: TransactionErrorLevel): void;
27
- private getRandomId;
33
+ private getHash;
28
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rentman/rm-core",
3
- "version": "6.1.2",
3
+ "version": "6.2.0",
4
4
  "description": "Rentman core functionalities",
5
5
  "main": "./dist/rm-core.js",
6
6
  "types": "./dist/types/index.d.ts",