@rentman/rm-core 1.1.11 → 1.1.13

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.
@@ -1,14 +1,15 @@
1
1
  import { ApiFormatter, ChangesProcessor, ItemResourceService, LockService } from '../classes';
2
2
  import { ErrorHandlerInterface, PromiseInterface } from '../interfaces';
3
- import { EditResource, ItemEntry, ItemResource, ViewResource } from '../models';
3
+ import { ItemEntry, ItemResource } from '../models';
4
+ import { ItemOptions } from '../types';
4
5
  export declare class ItemResourceFactory {
5
- private itemResourceService;
6
- private apiFormatter;
7
- private lockService;
8
- private changesProcessor;
9
- private errorHandler;
10
- private promiseService;
6
+ itemResourceService: ItemResourceService;
7
+ apiFormatter: ApiFormatter;
8
+ lockService: LockService;
9
+ changesProcessor: ChangesProcessor;
10
+ errorHandler: ErrorHandlerInterface;
11
+ promiseService: PromiseInterface;
11
12
  constructor(itemResourceService: ItemResourceService, apiFormatter: ApiFormatter, lockService: LockService, changesProcessor: ChangesProcessor, errorHandler: ErrorHandlerInterface, promiseService: PromiseInterface);
12
- getConstructor(options: any): (itemEntry: any) => EditResource | ViewResource;
13
- construct(itemEntry: ItemEntry, options: any): ItemResource;
13
+ getConstructor(options: ItemOptions): (itemEntry: ItemEntry) => ItemResource;
14
+ construct(itemEntry: ItemEntry, options: ItemOptions, isNew?: boolean): ItemResource;
14
15
  }
@@ -1,21 +1,13 @@
1
- import { ItemHandler, KeyService } from '../classes';
2
- import { ChangesProcessorFactory, ItemEntryFactory, ItemResourceFactory } from '../factories';
3
- import { ErrorHandlerInterface, PromiseInterface } from '../interfaces';
4
- import { CollectionEntry } from './CollectionEntry';
5
- import { CollectionResource } from './CollectionResource';
1
+ import { CollectionResourceFactory } from '../factories';
2
+ import { CollectionEntry, CollectionResource, ItemResource } from '../models';
6
3
  export declare class CollectionEditResource extends CollectionResource {
7
- private errorHandler;
8
- private itemHandler;
9
- private changesProcessorFactory;
10
- private keyService;
11
- private promiseService;
12
- private itemEntryFactory;
13
- constructor(errorHandler: ErrorHandlerInterface, itemHandler: ItemHandler, itemResourceFactory: ItemResourceFactory, changesProcessorFactory: ChangesProcessorFactory, keyService: KeyService, promiseService: PromiseInterface, itemEntryFactory: ItemEntryFactory, collectionEntry: CollectionEntry, options: any);
4
+ private factory;
5
+ constructor(factory: CollectionResourceFactory, collectionEntry: CollectionEntry, options: any);
14
6
  save(): Promise<any>;
15
- moveItems(idArray: any, destination: any, enableCallbacks: any): any;
7
+ moveItems(idArray: any, destination: any, enableCallbacks: any): ItemResource[];
16
8
  removeItems(idArray: any, enableCallbacks: any): Promise<any>;
17
9
  removeItem(itemId: any, enableCallbacks: any): Promise<any>;
18
10
  addItems(valuesArray: any, enableCallbacks?: boolean): Promise<any>;
19
11
  addItem(values: any, enableCallbacks: any): Promise<any>;
20
- clear(enableCallbacks: any): any;
12
+ clear(enableCallbacks: any): ItemResource[] | null;
21
13
  }
@@ -1,18 +1,9 @@
1
- import { CollectionEntryService, ColumnExpansion, ColumnInfo, ColumnSet, ItemEntryService, ItemRequestService, KeyService, QueryService } from '../classes';
2
- import { CollectionEntryFactory, ColumnSetFactory } from '../factories';
3
- import { ErrorHandlerInterface, PromiseInterface } from '../interfaces';
1
+ import { ColumnExpansion, ColumnInfo, ColumnSet } from '../classes';
2
+ import { CollectionEntryFactory } from '../factories';
4
3
  import { CollectionResource, ItemEntry, ItemResource } from '../models';
5
4
  import { EntryParentNull, ItemId, ItemIdConversionMap, ItemType, RequestColumns } from '../types';
6
5
  export declare class CollectionEntry {
7
- private collectionEntryFactory;
8
- private collectionEntryService;
9
- private columnSetFactory;
10
- private errorHandler;
11
- private itemEntryService;
12
- private itemRequestService;
13
- private keyService;
14
- private promiseService;
15
- private queryService;
6
+ private factory;
16
7
  itemType: ItemType;
17
8
  options: any;
18
9
  id: number;
@@ -27,21 +18,23 @@ export declare class CollectionEntry {
27
18
  reloadQueued: boolean;
28
19
  hasEditResources: boolean;
29
20
  hasItemEditResources: boolean;
30
- constructor(collectionEntryFactory: CollectionEntryFactory, collectionEntryService: CollectionEntryService, columnSetFactory: ColumnSetFactory, errorHandler: ErrorHandlerInterface, itemEntryService: ItemEntryService, itemRequestService: ItemRequestService, keyService: KeyService, promiseService: PromiseInterface, queryService: QueryService, itemType: ItemType, options: any);
21
+ constructor(factory: CollectionEntryFactory, itemType: ItemType, options: any);
31
22
  isDeferred(): boolean;
32
23
  resolve(itemEntryCompound: {
33
24
  columns: ColumnSet;
34
25
  items: ItemEntry[];
35
26
  }): CollectionEntry;
36
27
  isLocal(): boolean;
37
- matchParent(itemType: any, itemId: any): boolean;
28
+ matchParent(itemType: ItemType, itemId: ItemId): boolean;
38
29
  forEach(callback: (itemEntry: ItemEntry) => void): void;
39
30
  getItemById(itemId: any): ItemEntry | undefined;
40
- getIdArray(accumulator?: never[]): ItemId[];
41
- addItems(itemEntries: any, resultResource: any, updateInitial?: boolean, callOnAdd?: boolean, callOnActivate?: boolean): ItemResource[] | null;
42
- removeItems(idArray: any, resultResource: any, updateInitial: any, enableCallback?: any): any;
43
- clear(resultResource: any, updateInitial: any, enableCallback?: any): any;
44
- handleRemovedItems(filterFunction: any, resultResource: any, updateInitial: any, enableCallback?: boolean): any;
31
+ getIdArray(accumulator?: ItemId[]): ItemId[];
32
+ addItems(itemEntries: ItemEntry[], resultResource?: CollectionResource | null, updateInitial?: boolean, callOnAdd?: boolean, callOnActivate?: boolean): ItemResource[] | null;
33
+ private handleAddedItemCallbacks(entriesAddedToInitial, entriesAddedToModified, resultResource?, callOnAdd?, callOnActivate?);
34
+ removeItems(idArray: ItemId[], resultResource?: CollectionResource | null, updateInitial?: boolean, enableCallback?: boolean): ItemResource[] | null;
35
+ clear(resultResource?: CollectionResource | null, updateInitial?: boolean, enableCallback?: boolean): ItemResource[] | null;
36
+ handleRemovedItems(filterFunction: (itemEntry: ItemEntry) => boolean, resultResource?: CollectionResource | null, updateInitial?: boolean, enableCallback?: boolean): ItemResource[] | null;
37
+ private handleRemovedItemCallbacks(removedFromInitial, removedFromModified, resultResource?, callOnRemove?);
45
38
  expand(newColumns: any): Promise<any>;
46
39
  extendQuery(callback: any): any;
47
40
  extend(queryCallback: any, collectionResource: any, callOnAdd?: any, updateInitial?: any): Promise<any>;
@@ -1,23 +1,18 @@
1
- import { ApiFormatter, ChangesProcessor, LockService } from '../classes';
2
- import { ErrorHandlerInterface, PromiseInterface } from '../interfaces';
1
+ import { ItemResourceFactory } from '../factories';
3
2
  import { FieldMap } from '../types';
4
3
  import { ItemEntry, ItemResource } from './';
5
4
  export declare class EditResource extends ItemResource {
6
- private apiFormatter;
7
- private lockService;
8
- private changesProcessor;
9
- private errorHandler;
10
- private promiseService;
5
+ private factory;
11
6
  localCopies: FieldMap[];
12
- transactions: number | undefined;
13
- constructor(apiFormatter: ApiFormatter, lockService: LockService, changesProcessor: ChangesProcessor, errorHandler: ErrorHandlerInterface, promiseService: PromiseInterface, entry: ItemEntry, options: any);
7
+ transactions: number;
8
+ constructor(factory: ItemResourceFactory, entry: ItemEntry, options: any, isNew?: boolean);
14
9
  isNew(): boolean;
15
- start(): void;
16
- rollback(): void;
17
- commit(initial?: boolean): void;
10
+ start(): this;
11
+ rollback(): this;
12
+ commit(initial?: boolean): this;
18
13
  getLocalCopy(): FieldMap | null;
19
- copyFields(destination?: any): any;
20
- setFields(values: any, callOnChange: any): this;
21
- callOnChange(previous: any): void;
22
- save(parameters?: any): any;
14
+ copyFields(destination?: FieldMap): FieldMap;
15
+ setFields(values: FieldMap, callOnChange?: boolean): this;
16
+ callOnChange(previous: FieldMap): this;
17
+ save(parameters?: any): Promise<this>;
23
18
  }
@@ -1,15 +1,9 @@
1
- import { ApiFormatter, ColumnSet, ItemEntryService, KeyService } from '../classes';
1
+ import { ColumnSet } from '../classes';
2
2
  import { ItemEntryFactory } from '../factories';
3
- import { AuthInterface, PromiseInterface } from '../interfaces';
4
3
  import { ItemResource } from '../models';
5
4
  import { EntryParentNull, FieldMap, ItemId, ItemIdConversionMap } from '../types';
6
5
  export declare class ItemEntry {
7
- private promiseService;
8
- private authInterface;
9
- private itemEntryFactory;
10
- private apiFormatter;
11
- private itemEntryService;
12
- private keyService;
6
+ private factory;
13
7
  itemType: string;
14
8
  itemId: ItemId;
15
9
  columns: ColumnSet;
@@ -21,7 +15,7 @@ export declare class ItemEntry {
21
15
  modified: FieldMap;
22
16
  derived: FieldMap;
23
17
  resources: ItemResource[];
24
- constructor(promiseService: PromiseInterface, authInterface: AuthInterface, itemEntryFactory: ItemEntryFactory, apiFormatter: ApiFormatter, itemEntryService: ItemEntryService, keyService: KeyService, itemType: string, itemId: ItemId, columns: ColumnSet);
18
+ constructor(factory: ItemEntryFactory, itemType: string, itemId: ItemId, columns: ColumnSet);
25
19
  defer(deferRequest: any): this;
26
20
  resolve(): this;
27
21
  resolveDeferred(initial: any, derived: any, columns: any): this;
@@ -3,12 +3,13 @@ import { FieldMap, ResponseColumn } from '../types';
3
3
  export declare class ItemResource {
4
4
  entry: ItemEntry;
5
5
  options: any;
6
+ protected readonly _isNew: boolean;
6
7
  columns: {
7
8
  [columnId: string]: ResponseColumn;
8
9
  };
9
10
  fields: FieldMap;
10
11
  derived: FieldMap;
11
- constructor(entry: ItemEntry, options: any);
12
+ constructor(entry: ItemEntry, options: any, _isNew?: boolean);
12
13
  isNew(): boolean;
13
14
  isLocal(): boolean;
14
15
  clearResource(): void;
@@ -1,4 +1,4 @@
1
1
  import { ItemEntry, ItemResource } from '../models';
2
2
  export declare class ViewResource extends ItemResource {
3
- constructor(entry: ItemEntry, options: any);
3
+ constructor(entry: ItemEntry, options: any, isNew?: boolean);
4
4
  }
@@ -9,6 +9,22 @@ export declare type EntryParentNull = EntryParent | null;
9
9
  export declare type FieldMap = {
10
10
  [key: string]: any;
11
11
  };
12
+ export declare type ItemOptions = any;
13
+ export declare type ItemDefinition = {
14
+ itemType: ItemType;
15
+ itemId: ItemId;
16
+ options: ItemOptions;
17
+ isNew: boolean;
18
+ };
19
+ export declare const enum StateKeyType {
20
+ New = 0,
21
+ Duplicate = 1,
22
+ }
23
+ export declare type StateKey = {
24
+ type: StateKeyType;
25
+ template?: string;
26
+ itemId?: string;
27
+ };
12
28
  export declare type ItemResourceItemIdMap = {
13
29
  [itemId: number]: ItemResource;
14
30
  };
@@ -39,9 +55,6 @@ export declare type CollectionEntryBatchStatusMap = {
39
55
  export declare type CollectionEntryParentIdMap = {
40
56
  [parentId: number]: CollectionEntry;
41
57
  };
42
- export declare type CollectionEntryItemTypeMap = {
43
- [itemType: string]: CollectionEntry[];
44
- };
45
58
  export declare type CollectionResourceParentIdMap = {
46
59
  [parentId: number]: CollectionResource;
47
60
  };