@rentman/rm-core 2.0.6 → 2.0.7

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.
Files changed (107) hide show
  1. package/changelog.md +582 -575
  2. package/dist/rm-core.js +9312 -9304
  3. package/dist/rm-core.min.js +1 -1
  4. package/dist/src/classes/ApiFormatter.d.ts +55 -55
  5. package/dist/src/classes/ApiRequestService.d.ts +20 -20
  6. package/dist/src/classes/ApiResponseProcessor.d.ts +29 -29
  7. package/dist/src/classes/ChangesCompilation.d.ts +34 -34
  8. package/dist/src/classes/ChangesDelta.d.ts +42 -42
  9. package/dist/src/classes/ChangesDeltaBase.d.ts +33 -33
  10. package/dist/src/classes/ChangesProcessor.d.ts +47 -48
  11. package/dist/src/classes/CollectionCache.d.ts +37 -37
  12. package/dist/src/classes/CollectionEntryService.d.ts +25 -25
  13. package/dist/src/classes/CollectionMatcher.d.ts +9 -9
  14. package/dist/src/classes/CollectionMatcherBase.d.ts +26 -26
  15. package/dist/src/classes/CollectionResourceService.d.ts +6 -6
  16. package/dist/src/classes/ColumnCache.d.ts +21 -21
  17. package/dist/src/classes/ColumnExpansion.d.ts +22 -22
  18. package/dist/src/classes/ColumnHandler.d.ts +21 -21
  19. package/dist/src/classes/ColumnInfo.d.ts +14 -14
  20. package/dist/src/classes/ColumnSet.d.ts +39 -39
  21. package/dist/src/classes/ColumnSubsetCache.d.ts +8 -8
  22. package/dist/src/classes/ColumnUtil.d.ts +99 -99
  23. package/dist/src/classes/CreateRequest.d.ts +19 -19
  24. package/dist/src/classes/InternalChangesDelta.d.ts +38 -38
  25. package/dist/src/classes/ItemCache.d.ts +29 -29
  26. package/dist/src/classes/ItemEntryService.d.ts +41 -41
  27. package/dist/src/classes/KeyService.d.ts +16 -16
  28. package/dist/src/classes/LockService.d.ts +32 -32
  29. package/dist/src/classes/ModuleChangesCompilation.d.ts +18 -18
  30. package/dist/src/classes/QueryColumnExtractor.d.ts +20 -20
  31. package/dist/src/classes/QueryMatcher.d.ts +14 -14
  32. package/dist/src/classes/QueryParser.d.ts +25 -25
  33. package/dist/src/classes/QueryParserBase.d.ts +29 -29
  34. package/dist/src/classes/QueryService.d.ts +14 -14
  35. package/dist/src/classes/RequestBuffer.d.ts +25 -25
  36. package/dist/src/classes/RequestBufferManager.d.ts +31 -31
  37. package/dist/src/classes/RequestColumnExpansion.d.ts +15 -15
  38. package/dist/src/classes/SocketMessageHandler.d.ts +31 -31
  39. package/dist/src/classes/TemplateCache.d.ts +63 -63
  40. package/dist/src/classes/Util.d.ts +28 -28
  41. package/dist/src/classes/cache/AbstractCache.d.ts +135 -134
  42. package/dist/src/classes/cache/CollectionHandlerBase.d.ts +64 -64
  43. package/dist/src/classes/cache/CollectionMatcherCacheProcessor.d.ts +26 -26
  44. package/dist/src/classes/cache/ItemHandlerBase.d.ts +93 -86
  45. package/dist/src/classes/cache/server/ServerCache.d.ts +98 -87
  46. package/dist/src/classes/cache/server/ServerCollectionHandler.d.ts +43 -43
  47. package/dist/src/classes/cache/server/ServerItemHandler.d.ts +50 -49
  48. package/dist/src/classes/cache/transaction/TransactionCache.d.ts +417 -417
  49. package/dist/src/classes/cache/transaction/TransactionCollectionHandler.d.ts +72 -72
  50. package/dist/src/classes/cache/transaction/TransactionEventHandler.d.ts +19 -19
  51. package/dist/src/classes/cache/transaction/TransactionItemHandler.d.ts +115 -114
  52. package/dist/src/classes/index.d.ts +41 -41
  53. package/dist/src/constants.d.ts +7 -7
  54. package/dist/src/core.d.ts +49 -49
  55. package/dist/src/factories/ApiResponseProcessorFactory.d.ts +6 -6
  56. package/dist/src/factories/ChangesCompilationFactory.d.ts +6 -6
  57. package/dist/src/factories/ChangesDeltaFactory.d.ts +9 -9
  58. package/dist/src/factories/ChangesProcessorFactory.d.ts +22 -23
  59. package/dist/src/factories/CollectionCacheFactory.d.ts +8 -8
  60. package/dist/src/factories/CollectionEntryFactory.d.ts +11 -11
  61. package/dist/src/factories/CollectionMatcherFactory.d.ts +9 -9
  62. package/dist/src/factories/CollectionResourceFactory.d.ts +34 -34
  63. package/dist/src/factories/ColumnExpansionFactory.d.ts +8 -8
  64. package/dist/src/factories/ColumnInfoFactory.d.ts +7 -7
  65. package/dist/src/factories/ColumnSetFactory.d.ts +19 -19
  66. package/dist/src/factories/ColumnSubsetCacheFactory.d.ts +6 -6
  67. package/dist/src/factories/CreateRequestFactory.d.ts +11 -11
  68. package/dist/src/factories/ItemCacheFactory.d.ts +8 -8
  69. package/dist/src/factories/ItemEntryFactory.d.ts +17 -17
  70. package/dist/src/factories/ItemResourceFactory.d.ts +32 -32
  71. package/dist/src/factories/ModuleChangesCompilationFactory.d.ts +5 -5
  72. package/dist/src/factories/QueryMatcherFactory.d.ts +7 -7
  73. package/dist/src/factories/QueryParserFactory.d.ts +6 -6
  74. package/dist/src/factories/RequestColumnExpansionFactory.d.ts +6 -6
  75. package/dist/src/factories/TemplateFactory.d.ts +10 -10
  76. package/dist/src/factories/TransactionCacheFactory.d.ts +55 -55
  77. package/dist/src/factories/index.d.ts +22 -22
  78. package/dist/src/index.d.ts +7 -7
  79. package/dist/src/interfaces/ApiRequestServiceInterface.d.ts +11 -11
  80. package/dist/src/interfaces/AuthInterface.d.ts +9 -9
  81. package/dist/src/interfaces/ErrorHandlerInterface.d.ts +5 -5
  82. package/dist/src/interfaces/ExceptionHandlerInterface.d.ts +3 -3
  83. package/dist/src/interfaces/LinkTreeServiceInterface.d.ts +4 -4
  84. package/dist/src/interfaces/PromiseLibraryInterface.d.ts +25 -25
  85. package/dist/src/interfaces/SocketMessageInterface.d.ts +3 -3
  86. package/dist/src/interfaces/index.d.ts +7 -7
  87. package/dist/src/models/CollectionEditResource.d.ts +17 -17
  88. package/dist/src/models/CollectionEntry.d.ts +27 -27
  89. package/dist/src/models/CollectionEntryOptions.d.ts +13 -13
  90. package/dist/src/models/CollectionResource.d.ts +52 -52
  91. package/dist/src/models/CollectionResourceOptions.d.ts +27 -27
  92. package/dist/src/models/CollectionViewResource.d.ts +7 -7
  93. package/dist/src/models/EditResource.d.ts +16 -16
  94. package/dist/src/models/ItemEntry.d.ts +19 -19
  95. package/dist/src/models/ItemEntryOptions.d.ts +9 -9
  96. package/dist/src/models/ItemResource.d.ts +87 -87
  97. package/dist/src/models/ItemResourceOptions.d.ts +9 -9
  98. package/dist/src/models/LocalViewResource.d.ts +7 -7
  99. package/dist/src/models/RemoteViewResource.d.ts +7 -7
  100. package/dist/src/models/Template.d.ts +11 -11
  101. package/dist/src/models/ViewResource.d.ts +8 -8
  102. package/dist/src/models/index.d.ts +15 -15
  103. package/dist/src/types/ItemTypesCollection.d.ts +256 -256
  104. package/dist/src/types/PromiseInterface.d.ts +2 -2
  105. package/dist/src/types/index.d.ts +2 -2
  106. package/package.json +36 -36
  107. package/readme.md +15 -15
@@ -1,27 +1,27 @@
1
- import { CollectionEntry, CollectionResource, ItemEntry, ItemResource } from '../models';
2
- import { ConversionMap, ItemType, OnChangeFunction } from '../types';
3
- export declare type CollectionResourceCallback<ItemTypeType extends ItemType> = (itemResources: Array<ItemResource<ItemTypeType>>, collectionResource: CollectionResource<ItemTypeType>) => void;
4
- export declare type CollectionResourceOnAddCallback<ItemTypeType extends ItemType> = (itemResources: Array<ItemResource<ItemTypeType>>, collectionResource: CollectionResource<ItemTypeType>, isInitialCall: boolean) => void;
5
- export declare type CollectionResourceInitialCallback<ItemTypeType extends ItemType> = (itemEntries: Array<ItemEntry<ItemTypeType>>, collectionEntry: CollectionEntry<ItemTypeType>) => void;
6
- export declare type OnItemsCreatedCallback = (conversionMap: ConversionMap) => void;
7
- export declare type CollectionResourceOptionsInterface<ItemTypeType extends ItemType> = Partial<CollectionResourceOptions<ItemTypeType>>;
8
- export declare class CollectionResourceOptions<ItemTypeType extends ItemType> {
9
- editItems: boolean;
10
- remoteItems: boolean;
11
- editCollection: boolean;
12
- enableSave: boolean;
13
- callOnAddWithInitialItems: boolean;
14
- /**
15
- * @deprecated
16
- * You should use itemResource.onChange and compare previous.id with fields.id
17
- */
18
- onItemsCreated: OnItemsCreatedCallback;
19
- onChange: OnChangeFunction;
20
- onAdd: CollectionResourceOnAddCallback<ItemTypeType>;
21
- onRemove: CollectionResourceCallback<ItemTypeType>;
22
- onAddInitial: CollectionResourceInitialCallback<ItemTypeType>;
23
- onRemoveInitial: CollectionResourceInitialCallback<ItemTypeType>;
24
- resourceKey: string | null;
25
- custom: any;
26
- constructor(values: CollectionResourceOptionsInterface<ItemTypeType>);
27
- }
1
+ import { CollectionEntry, CollectionResource, ItemEntry, ItemResource } from '../models';
2
+ import { ConversionMap, ItemType, OnChangeFunction } from '../types';
3
+ export declare type CollectionResourceCallback<ItemTypeType extends ItemType> = (itemResources: Array<ItemResource<ItemTypeType>>, collectionResource: CollectionResource<ItemTypeType>) => void;
4
+ export declare type CollectionResourceOnAddCallback<ItemTypeType extends ItemType> = (itemResources: Array<ItemResource<ItemTypeType>>, collectionResource: CollectionResource<ItemTypeType>, isInitialCall: boolean) => void;
5
+ export declare type CollectionResourceInitialCallback<ItemTypeType extends ItemType> = (itemEntries: Array<ItemEntry<ItemTypeType>>, collectionEntry: CollectionEntry<ItemTypeType>) => void;
6
+ export declare type OnItemsCreatedCallback = (conversionMap: ConversionMap) => void;
7
+ export declare type CollectionResourceOptionsInterface<ItemTypeType extends ItemType> = Partial<CollectionResourceOptions<ItemTypeType>>;
8
+ export declare class CollectionResourceOptions<ItemTypeType extends ItemType> {
9
+ editItems: boolean;
10
+ remoteItems: boolean;
11
+ editCollection: boolean;
12
+ enableSave: boolean;
13
+ callOnAddWithInitialItems: boolean;
14
+ /**
15
+ * @deprecated
16
+ * You should use itemResource.onChange and compare previous.id with fields.id
17
+ */
18
+ onItemsCreated: OnItemsCreatedCallback;
19
+ onChange: OnChangeFunction;
20
+ onAdd: CollectionResourceOnAddCallback<ItemTypeType>;
21
+ onRemove: CollectionResourceCallback<ItemTypeType>;
22
+ onAddInitial: CollectionResourceInitialCallback<ItemTypeType>;
23
+ onRemoveInitial: CollectionResourceInitialCallback<ItemTypeType>;
24
+ resourceKey: string | null;
25
+ custom: any;
26
+ constructor(values: CollectionResourceOptionsInterface<ItemTypeType>);
27
+ }
@@ -1,7 +1,7 @@
1
- import { TransactionCache } from '../classes/cache/transaction/TransactionCache';
2
- import { CollectionResourceFactory } from '../factories';
3
- import { CollectionEntry, CollectionResource, CollectionResourceOptions, ItemResource, LocalViewResource } from '../models';
4
- import { ItemType } from '../types';
5
- export declare class CollectionViewResource<ItemTypeType extends ItemType = any, T extends ItemResource<ItemTypeType> = LocalViewResource<ItemTypeType>> extends CollectionResource<ItemTypeType, T> {
6
- constructor(collectionResourceFactory: CollectionResourceFactory, collectionEntry: CollectionEntry<ItemTypeType>, options: CollectionResourceOptions<ItemTypeType>, transactionCache: TransactionCache);
7
- }
1
+ import { TransactionCache } from '../classes/cache/transaction/TransactionCache';
2
+ import { CollectionResourceFactory } from '../factories';
3
+ import { CollectionEntry, CollectionResource, CollectionResourceOptions, ItemResource, LocalViewResource } from '../models';
4
+ import { ItemType } from '../types';
5
+ export declare class CollectionViewResource<ItemTypeType extends ItemType = any, T extends ItemResource<ItemTypeType> = LocalViewResource<ItemTypeType>> extends CollectionResource<ItemTypeType, T> {
6
+ constructor(collectionResourceFactory: CollectionResourceFactory, collectionEntry: CollectionEntry<ItemTypeType>, options: CollectionResourceOptions<ItemTypeType>, transactionCache: TransactionCache);
7
+ }
@@ -1,16 +1,16 @@
1
- import { TransactionCache } from '../classes/cache/transaction/TransactionCache';
2
- import { ItemResourceFactory } from '../factories';
3
- import { ItemEntry, ItemResource, ItemResourceOptions } from '../models';
4
- import { FieldMap, ItemType, PromiseInterface } from '../types';
5
- export declare class EditResource<ItemTypeType extends ItemType = any> extends ItemResource<ItemTypeType> {
6
- protected localCopies: Array<FieldMap<ItemTypeType>>;
7
- fields: FieldMap<ItemTypeType>;
8
- constructor(factory: ItemResourceFactory, entry: ItemEntry<ItemTypeType>, options: ItemResourceOptions, isNew: boolean, transaction: TransactionCache);
9
- isNew(): boolean;
10
- copyFields(destination?: FieldMap<ItemTypeType>): FieldMap<ItemTypeType>;
11
- /**
12
- * @description
13
- * 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
14
- */
15
- setFields(values: FieldMap<ItemTypeType>): PromiseInterface<this>;
16
- }
1
+ import { TransactionCache } from '../classes/cache/transaction/TransactionCache';
2
+ import { ItemResourceFactory } from '../factories';
3
+ import { ItemEntry, ItemResource, ItemResourceOptions } from '../models';
4
+ import { FieldMap, ItemType, PromiseInterface } from '../types';
5
+ export declare class EditResource<ItemTypeType extends ItemType = any> extends ItemResource<ItemTypeType> {
6
+ protected localCopies: Array<FieldMap<ItemTypeType>>;
7
+ fields: FieldMap<ItemTypeType>;
8
+ constructor(factory: ItemResourceFactory, entry: ItemEntry<ItemTypeType>, options: ItemResourceOptions, isNew: boolean, transaction: TransactionCache);
9
+ isNew(): boolean;
10
+ copyFields(destination?: FieldMap<ItemTypeType>): FieldMap<ItemTypeType>;
11
+ /**
12
+ * @description
13
+ * 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
14
+ */
15
+ setFields(values: FieldMap<ItemTypeType>): PromiseInterface<this>;
16
+ }
@@ -1,19 +1,19 @@
1
- import { ColumnSet } from '../classes';
2
- import { ItemEntryFactory } from '../factories';
3
- import { ItemId, ItemType } from '../types';
4
- export declare class ItemEntry<ItemTypeType extends ItemType = any> {
5
- private factory;
6
- itemType: ItemTypeType;
7
- itemId: ItemId;
8
- columns: ColumnSet<ItemTypeType>;
9
- id: number;
10
- reloadQueued: boolean;
11
- constructor(factory: ItemEntryFactory, itemType: ItemTypeType, itemId: ItemId, columns: ColumnSet<ItemTypeType>);
12
- queueReload(): this;
13
- isLocal(): boolean;
14
- isLockable(): boolean;
15
- toJSON(): {
16
- id: number;
17
- columns: ColumnSet<ItemTypeType>;
18
- };
19
- }
1
+ import { ColumnSet } from '../classes';
2
+ import { ItemEntryFactory } from '../factories';
3
+ import { ItemId, ItemType } from '../types';
4
+ export declare class ItemEntry<ItemTypeType extends ItemType = any> {
5
+ private factory;
6
+ itemType: ItemTypeType;
7
+ itemId: ItemId;
8
+ columns: ColumnSet<ItemTypeType>;
9
+ id: number;
10
+ reloadQueued: boolean;
11
+ constructor(factory: ItemEntryFactory, itemType: ItemTypeType, itemId: ItemId, columns: ColumnSet<ItemTypeType>);
12
+ queueReload(): this;
13
+ isLocal(): boolean;
14
+ isLockable(): boolean;
15
+ toJSON(): {
16
+ id: number;
17
+ columns: ColumnSet<ItemTypeType>;
18
+ };
19
+ }
@@ -1,9 +1,9 @@
1
- import { ApiRequestColumnMap, ApiRequestColumns, EntryParentNull } from '../types';
2
- export declare type ItemEntryOptionsInterface = Partial<ItemEntryOptions>;
3
- export declare class ItemEntryOptions {
4
- columns: ApiRequestColumns;
5
- parent: EntryParentNull;
6
- templateOptions: any;
7
- templateColumns: ApiRequestColumnMap;
8
- constructor(values: ItemEntryOptionsInterface);
9
- }
1
+ import { ApiRequestColumnMap, ApiRequestColumns, EntryParentNull } from '../types';
2
+ export declare type ItemEntryOptionsInterface = Partial<ItemEntryOptions>;
3
+ export declare class ItemEntryOptions {
4
+ columns: ApiRequestColumns;
5
+ parent: EntryParentNull;
6
+ templateOptions: any;
7
+ templateColumns: ApiRequestColumnMap;
8
+ constructor(values: ItemEntryOptionsInterface);
9
+ }
@@ -1,87 +1,87 @@
1
- import { TransactionCache } from '../classes';
2
- import { ItemResourceFactory } from '../factories';
3
- import { ItemEntry, ItemResourceOptions } from '../models';
4
- import { EntryParentNull, FieldMap, ItemType, ResponseColumn } from '../types';
5
- export declare abstract class ItemResource<ItemTypeType extends ItemType = any> {
6
- protected readonly factory: ItemResourceFactory;
7
- readonly entry: ItemEntry<ItemTypeType>;
8
- readonly options: ItemResourceOptions<ItemResource<ItemTypeType>>;
9
- protected readonly _isNew: boolean;
10
- protected readonly transaction: TransactionCache;
11
- columns: {
12
- [columnId: string]: ResponseColumn;
13
- };
14
- fields: Readonly<FieldMap<ItemTypeType>>;
15
- initial: Readonly<FieldMap<ItemTypeType>>;
16
- protected constructor(factory: ItemResourceFactory, entry: ItemEntry<ItemTypeType>, options: ItemResourceOptions<ItemResource<ItemTypeType>>, _isNew: boolean, transaction: TransactionCache);
17
- onConstruct(): void;
18
- /**
19
- * Fetches the ItemResource's parent with the current fields
20
- *
21
- * ----------------
22
- *
23
- * @remark
24
- * Use this if you need to get the parent after an item has been deleted
25
- */
26
- getParent(fromInitial?: boolean): EntryParentNull;
27
- /**
28
- * @deprecated
29
- * Use {@link TransactionCache.applyChangesDelta transaction.applyChangesDelta} instead
30
- */
31
- callOnChange(previous: FieldMap<ItemTypeType>): void;
32
- /**
33
- * @description
34
- * Utility function to easily check if a field is changed.
35
- * Will return `false` if the field is changed
36
- *
37
- * @example
38
- * onChange: (
39
- * itemResource,
40
- * previous,
41
- * compareItemField
42
- * ) {
43
- * if (!compareItemField('columnId')) {
44
- * processItem(itemResource);
45
- * }
46
- * }
47
- */
48
- compareItemField(columnId: keyof FieldMap<ItemTypeType>, previous: FieldMap<ItemTypeType>): boolean;
49
- hasChanges(): boolean;
50
- setTransactionParameters(parameters: any): void;
51
- /**
52
- * @description
53
- * 'isNew' means that the {@link ItemEntry ItemEntry} is a local item and that this resource was created when the {@link ItemEntry ItemEntry} was first created
54
- */
55
- isNew(): boolean;
56
- isLocal(): boolean;
57
- /**
58
- * @description
59
- * Removes the reference to the {@link ItemResource ItemResource} from the {@link TransactionCache TransactionCache}, so that the OnChange callback won't be called anymore.
60
- *
61
- * Warning:
62
- * This doesn't revert any changes made to the item, in order to revert the changes you should use {@link TransactionItemHandler.clearItemEntry TransactionItemHandler.clearItemEntry}
63
- */
64
- clearResource(): void;
65
- toJSON(): {
66
- columns: string[];
67
- fields: Readonly<FieldMap<ItemTypeType>>;
68
- entry: ItemEntry<ItemTypeType>;
69
- };
70
- /**
71
- * @description
72
- * Returns the value of the columnPath, or undefined when the path couldn't be traversed
73
- *
74
- * @param columnPath Can either be an array of columnIds (['column', 'column2']) or a config column string ('column>column2')
75
- */
76
- getDerivedValue<T extends any = any>(columnPath: string[] | string): T | undefined;
77
- /**
78
- * @description
79
- * Traverses the column path and returns the fields of the derived item, returns undefined if the item isn't found
80
- *
81
- * ---------------------
82
- *
83
- * @remark
84
- * Assumes the derived item's values are already cached
85
- */
86
- getDerivedValues(columnPath: string[]): Readonly<FieldMap> | undefined;
87
- }
1
+ import { TransactionCache } from '../classes';
2
+ import { ItemResourceFactory } from '../factories';
3
+ import { ItemEntry, ItemResourceOptions } from '../models';
4
+ import { EntryParentNull, FieldMap, ItemType, ResponseColumn } from '../types';
5
+ export declare abstract class ItemResource<ItemTypeType extends ItemType = any> {
6
+ protected readonly factory: ItemResourceFactory;
7
+ readonly entry: ItemEntry<ItemTypeType>;
8
+ readonly options: ItemResourceOptions<ItemResource<ItemTypeType>>;
9
+ protected readonly _isNew: boolean;
10
+ protected readonly transaction: TransactionCache;
11
+ columns: {
12
+ [columnId: string]: ResponseColumn;
13
+ };
14
+ fields: Readonly<FieldMap<ItemTypeType>>;
15
+ initial: Readonly<FieldMap<ItemTypeType>>;
16
+ protected constructor(factory: ItemResourceFactory, entry: ItemEntry<ItemTypeType>, options: ItemResourceOptions<ItemResource<ItemTypeType>>, _isNew: boolean, transaction: TransactionCache);
17
+ onConstruct(): void;
18
+ /**
19
+ * Fetches the ItemResource's parent with the current fields
20
+ *
21
+ * ----------------
22
+ *
23
+ * @remark
24
+ * Use this if you need to get the parent after an item has been deleted
25
+ */
26
+ getParent(fromInitial?: boolean): EntryParentNull;
27
+ /**
28
+ * @deprecated
29
+ * Use {@link TransactionCache.applyChangesDelta transaction.applyChangesDelta} instead
30
+ */
31
+ callOnChange(previous: FieldMap<ItemTypeType>): void;
32
+ /**
33
+ * @description
34
+ * Utility function to easily check if a field is changed.
35
+ * Will return `false` if the field is changed
36
+ *
37
+ * @example
38
+ * onChange: (
39
+ * itemResource,
40
+ * previous,
41
+ * compareItemField
42
+ * ) {
43
+ * if (!compareItemField('columnId')) {
44
+ * processItem(itemResource);
45
+ * }
46
+ * }
47
+ */
48
+ compareItemField(columnId: keyof FieldMap<ItemTypeType>, previous: FieldMap<ItemTypeType>): boolean;
49
+ hasChanges(): boolean;
50
+ setTransactionParameters(parameters: any): void;
51
+ /**
52
+ * @description
53
+ * 'isNew' means that the {@link ItemEntry ItemEntry} is a local item and that this resource was created when the {@link ItemEntry ItemEntry} was first created
54
+ */
55
+ isNew(): boolean;
56
+ isLocal(): boolean;
57
+ /**
58
+ * @description
59
+ * Removes the reference to the {@link ItemResource ItemResource} from the {@link TransactionCache TransactionCache}, so that the OnChange callback won't be called anymore.
60
+ *
61
+ * Warning:
62
+ * This doesn't revert any changes made to the item, in order to revert the changes you should use {@link TransactionItemHandler.clearItemEntry TransactionItemHandler.clearItemEntry}
63
+ */
64
+ clearResource(): void;
65
+ toJSON(): {
66
+ columns: string[];
67
+ fields: Readonly<FieldMap<ItemTypeType>>;
68
+ entry: ItemEntry<ItemTypeType>;
69
+ };
70
+ /**
71
+ * @description
72
+ * Returns the value of the columnPath, or undefined when the path couldn't be traversed
73
+ *
74
+ * @param columnPath Can either be an array of columnIds (['column', 'column2']) or a config column string ('column>column2')
75
+ */
76
+ getDerivedValue<T extends any = any>(columnPath: string[] | string): T | undefined;
77
+ /**
78
+ * @description
79
+ * Traverses the column path and returns the fields of the derived item, returns undefined if the item isn't found
80
+ *
81
+ * ---------------------
82
+ *
83
+ * @remark
84
+ * Assumes the derived item's values are already cached
85
+ */
86
+ getDerivedValues(columnPath: string[]): Readonly<FieldMap> | undefined;
87
+ }
@@ -1,9 +1,9 @@
1
- import { OnChangeFunction } from '../types';
2
- import { ItemResource } from './ItemResource';
3
- export declare type ItemResourceOptionsInterface<ItemResourceType extends ItemResource<any> = ItemResource<any>> = Partial<ItemResourceOptions<ItemResourceType>>;
4
- export declare class ItemResourceOptions<ItemResourceType extends ItemResource<any> = ItemResource<any>> {
5
- edit: boolean;
6
- remote: boolean;
7
- onChange: OnChangeFunction<ItemResourceType>;
8
- constructor(values: ItemResourceOptionsInterface<ItemResourceType>);
9
- }
1
+ import { OnChangeFunction } from '../types';
2
+ import { ItemResource } from './ItemResource';
3
+ export declare type ItemResourceOptionsInterface<ItemResourceType extends ItemResource<any> = ItemResource<any>> = Partial<ItemResourceOptions<ItemResourceType>>;
4
+ export declare class ItemResourceOptions<ItemResourceType extends ItemResource<any> = ItemResource<any>> {
5
+ edit: boolean;
6
+ remote: boolean;
7
+ onChange: OnChangeFunction<ItemResourceType>;
8
+ constructor(values: ItemResourceOptionsInterface<ItemResourceType>);
9
+ }
@@ -1,7 +1,7 @@
1
- import { TransactionCache } from '../classes/cache/transaction/TransactionCache';
2
- import { ItemResourceFactory } from '../factories';
3
- import { ItemEntry, ItemResourceOptions, ViewResource } from '../models';
4
- import { ItemType } from '../types';
5
- export declare class LocalViewResource<ItemTypeType extends ItemType = any> extends ViewResource<ItemTypeType> {
6
- constructor(factory: ItemResourceFactory, entry: ItemEntry<ItemTypeType>, options: ItemResourceOptions, isNew: boolean, transaction: TransactionCache);
7
- }
1
+ import { TransactionCache } from '../classes/cache/transaction/TransactionCache';
2
+ import { ItemResourceFactory } from '../factories';
3
+ import { ItemEntry, ItemResourceOptions, ViewResource } from '../models';
4
+ import { ItemType } from '../types';
5
+ export declare class LocalViewResource<ItemTypeType extends ItemType = any> extends ViewResource<ItemTypeType> {
6
+ constructor(factory: ItemResourceFactory, entry: ItemEntry<ItemTypeType>, options: ItemResourceOptions, isNew: boolean, transaction: TransactionCache);
7
+ }
@@ -1,7 +1,7 @@
1
- import { TransactionCache } from '../classes/cache/transaction/TransactionCache';
2
- import { ItemResourceFactory } from '../factories';
3
- import { ItemEntry, ItemResourceOptions, ViewResource } from '../models';
4
- import { ItemType } from '../types';
5
- export declare class RemoteViewResource<ItemTypeType extends ItemType = any> extends ViewResource<ItemTypeType> {
6
- constructor(factory: ItemResourceFactory, entry: ItemEntry<ItemTypeType>, options: ItemResourceOptions<RemoteViewResource<ItemTypeType>>, isNew: boolean, transaction: TransactionCache);
7
- }
1
+ import { TransactionCache } from '../classes/cache/transaction/TransactionCache';
2
+ import { ItemResourceFactory } from '../factories';
3
+ import { ItemEntry, ItemResourceOptions, ViewResource } from '../models';
4
+ import { ItemType } from '../types';
5
+ export declare class RemoteViewResource<ItemTypeType extends ItemType = any> extends ViewResource<ItemTypeType> {
6
+ constructor(factory: ItemResourceFactory, entry: ItemEntry<ItemTypeType>, options: ItemResourceOptions<RemoteViewResource<ItemTypeType>>, isNew: boolean, transaction: TransactionCache);
7
+ }
@@ -1,11 +1,11 @@
1
- import { ColumnSet } from '../classes';
2
- import { TemplateFactory } from '../factories';
3
- import { ApiResponse, FieldMap, ItemType, ResponseColumnItemTypeMap } from '../types';
4
- export declare class Template<ItemTypeType extends ItemType = any> {
5
- itemType: ItemTypeType;
6
- response: ApiResponse;
7
- fields: FieldMap<ItemTypeType>;
8
- responseColumns: ResponseColumnItemTypeMap;
9
- columns: ColumnSet<ItemTypeType>;
10
- constructor(factory: TemplateFactory, itemType: ItemTypeType, response: ApiResponse, additionalColumns: ResponseColumnItemTypeMap);
11
- }
1
+ import { ColumnSet } from '../classes';
2
+ import { TemplateFactory } from '../factories';
3
+ import { ApiResponse, FieldMap, ItemType, ResponseColumnItemTypeMap } from '../types';
4
+ export declare class Template<ItemTypeType extends ItemType = any> {
5
+ itemType: ItemTypeType;
6
+ response: ApiResponse;
7
+ fields: FieldMap<ItemTypeType>;
8
+ responseColumns: ResponseColumnItemTypeMap;
9
+ columns: ColumnSet<ItemTypeType>;
10
+ constructor(factory: TemplateFactory, itemType: ItemTypeType, response: ApiResponse, additionalColumns: ResponseColumnItemTypeMap);
11
+ }
@@ -1,8 +1,8 @@
1
- import { TransactionCache } from '../classes/cache/transaction/TransactionCache';
2
- import { ItemResourceFactory } from '../factories';
3
- import { ItemEntry, ItemResource, ItemResourceOptions } from '../models';
4
- import { FieldMap, ItemType } from '../types';
5
- export declare abstract class ViewResource<ItemTypeType extends ItemType = any> extends ItemResource<ItemTypeType> {
6
- fields: Readonly<FieldMap<ItemTypeType>>;
7
- protected constructor(factory: ItemResourceFactory, entry: ItemEntry<ItemTypeType>, options: ItemResourceOptions<ViewResource<ItemTypeType>>, isNew: boolean, transaction: TransactionCache);
8
- }
1
+ import { TransactionCache } from '../classes/cache/transaction/TransactionCache';
2
+ import { ItemResourceFactory } from '../factories';
3
+ import { ItemEntry, ItemResource, ItemResourceOptions } from '../models';
4
+ import { FieldMap, ItemType } from '../types';
5
+ export declare abstract class ViewResource<ItemTypeType extends ItemType = any> extends ItemResource<ItemTypeType> {
6
+ fields: Readonly<FieldMap<ItemTypeType>>;
7
+ protected constructor(factory: ItemResourceFactory, entry: ItemEntry<ItemTypeType>, options: ItemResourceOptions<ViewResource<ItemTypeType>>, isNew: boolean, transaction: TransactionCache);
8
+ }
@@ -1,15 +1,15 @@
1
- export * from './ItemEntryOptions';
2
- export * from './ItemResourceOptions';
3
- export * from './ItemEntry';
4
- export * from './ItemResource';
5
- export * from './ViewResource';
6
- export * from './EditResource';
7
- export * from './CollectionEntryOptions';
8
- export * from './CollectionResourceOptions';
9
- export * from './CollectionEntry';
10
- export * from './CollectionResource';
11
- export * from './CollectionViewResource';
12
- export * from './CollectionEditResource';
13
- export * from './Template';
14
- export * from './RemoteViewResource';
15
- export * from './LocalViewResource';
1
+ export * from './ItemEntryOptions';
2
+ export * from './ItemResourceOptions';
3
+ export * from './ItemEntry';
4
+ export * from './ItemResource';
5
+ export * from './ViewResource';
6
+ export * from './EditResource';
7
+ export * from './CollectionEntryOptions';
8
+ export * from './CollectionResourceOptions';
9
+ export * from './CollectionEntry';
10
+ export * from './CollectionResource';
11
+ export * from './CollectionViewResource';
12
+ export * from './CollectionEditResource';
13
+ export * from './Template';
14
+ export * from './RemoteViewResource';
15
+ export * from './LocalViewResource';