UNPKG

@adaptabletools/adaptable

Version:

Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

178 lines (177 loc) 4.89 kB
import { BaseState } from './BaseState'; import { AdaptableObject, AdaptableObjectTag } from './Common/AdaptableObject'; import { AdaptableModule } from '../types'; import { TypeUuid } from './Uuid'; import * as Redux from 'redux'; /** * State for Team Sharing; internal so not designed to be provided as part of Initial Adaptable State */ export interface TeamSharingState extends BaseState { /** * List of objects currently being Team Shared */ SharedEntities: SharedEntity[]; /** * Mapping of active AdaptableObjects which are shared with the local state. * Maps UUIDs of local AdaptableObjects to a snapshot of the latest synchronized SharedEntity */ ActiveSharedEntityMap: Record<TypeUuid, AdaptableSharedEntity>; /** * TRUE if an import is in progress, FALSE otherwise. * This is required to skip the TEAMSHARING_UPDATE_ITEM action as a result of the import */ importProcessInProgress: boolean; } /** * Defines an object used in Team Sharing. The union type is discriminated by the `EntityType` property (`adaptableEntity` / `customEntity`). */ export type SharedEntity = AdaptableSharedEntity | CustomSharedEntity; export declare const isAdaptableSharedEntity: (entity: SharedEntity) => entity is AdaptableSharedEntity; export declare const isCustomSharedEntity: (entity: SharedEntity) => entity is CustomSharedEntity<any>; /** * Defines an AdaptableObject shared with Team Sharing */ export interface AdaptableSharedEntity extends AdaptableObject { /** * Type of shared entity (either Adaptable specific or custom object) */ EntityType: 'adaptableEntity'; /** * Actual Adaptable Object being shared */ Entity: AdaptableObject; /** * Ids of direct entity dependencies */ EntityDependencyIds: TypeUuid[]; /** * Adaptable Module to which object belongs */ Module: AdaptableModule; /** * When the object was shared */ Timestamp: number; /** * User who shared the object */ UserName: string; /** * Description of object being shared */ Description: string; /** * Revision - incremental for 'Active', always 1 for 'Snapshot' */ Revision: number; /** * Last User who changed the object */ ChangedBy: string; /** * Last time when the object was changed */ ChangedAt: number; /** * 'Snapshot' (for 1-time sharing) or 'Active' (for continuous sharing) */ Type: SharedEntityType; } /** * Defines a Custom object that will be shared using Team Sharing */ export interface CustomSharedEntity<T = any> { /** * Type of shared entity (either Adaptable specific or custom object) */ EntityType: 'customEntity'; /** * Unique identifier for the Custom Shared Entity */ Uuid: TypeUuid; /** * Name of object being shared */ Name: string; /** * Description of object being shared */ Description: string; /** * Custom Object being shared */ Entity: T; /** * When the object was shared */ Timestamp: number; /** * User who shared the object */ UserName: string; /** * Last User who changed the object */ ChangedBy: string; /** * Last time when the object was changed */ ChangedAt: number; /** * Sets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full') */ IsReadOnly?: boolean; /** * List of Tags associated with the Object */ Tags?: AdaptableObjectTag[]; } /** * Defines Objects which have been imported into Team Sharing */ export interface TeamSharingImportInfo<T extends AdaptableObject> { ModuleEntities: T[]; AddAction: (entity: T) => any; EditAction: (entity: T) => any; } /** * Describes an AdaptableObject which is being Team Shared */ export interface AdaptableSharedEntityConfig { description: string; type: SharedEntityType; } /** * Describes a custom Object which is being Team Shared */ export interface CustomSharedEntityConfig { /** * Optional technical ID; if not provided, it will be auto-generated by Adaptable */ Uuid?: string; /** * Name of object being shared */ Name: string; /** * Description of object being shared */ Description: string; /** * List of Tags associated with the Object */ Tags?: AdaptableObjectTag[]; } /** * Type of Shared Entity - Snapshot or Active */ export type SharedEntityType = 'Snapshot' | 'Active'; export interface TeamSharingImportStep { sharedEntity: AdaptableSharedEntity; importAction: Redux.Action; } export type SharedEntityActiveStatus = Record<TypeUuid, { sharedEntity: AdaptableSharedEntity; importedRevision: number; sharedRevision: number; }>;