import { EntityPropertyValue, PersistedEntity } from './entity'; import { RelationshipPropertyValue, PersistedRelationship } from './relationship'; import { EntityOperationType, RelationshipOperationType, BulkOperationType } from './persister-operation-types'; import { CreateMappedRelationshipOperation as CreateMappedRelationshipIncomingOperation, PersisterPayloadSourceName, RemapEntityOperation } from './persister-incoming'; declare type DeleteOperationProperties = { /** * Is the graph object being permanently deleted? */ hardDelete: boolean; /** * `integrationDeleted` will be true if the delete operation is due * to integration be deleted. */ integrationDeleted: boolean; /** * `purgingOldData` will be `true` if the entity is being hard deleted as * part of a job to purge old soft-deleted data. */ purgingOldData: boolean; }; export interface BaseOutgoingPersistedOperation { correlationId: string; operationSource: PersisterPayloadSourceName; } /** * This is the base interface for an operation payload that describes * a create/update/delete of a entity that has been persisted. */ export interface EntityPersistedOperation extends BaseOutgoingPersistedOperation { type: EntityOperationType.CREATE_ENTITY | EntityOperationType.UPDATE_ENTITY | EntityOperationType.DELETE_ENTITY; /** * The `entity` property contains the state of the entity * after it has been persisted. */ entity: PersistedEntity; } /** * `EntityCreatedOperation` */ export interface EntityCreatedOperation extends EntityPersistedOperation { type: EntityOperationType.CREATE_ENTITY; } export interface EntityDiff { [k: string]: EntityPropertyValue; } export interface EntityUpdatedOperation extends EntityPersistedOperation { type: EntityOperationType.UPDATE_ENTITY; diff: EntityDiff; onlyAlertPropertiesChanged?: boolean; } export declare type EntityDeletedOperation = EntityPersistedOperation & { type: EntityOperationType.DELETE_ENTITY; } & DeleteOperationProperties; /** * The `RemapEntityOutgoingOperation` operation is the same as the * incoming operation of same type that is sent by integration with just * a couple additional properties. */ export interface RemapEntityOutgoingOperation extends RemapEntityOperation, BaseOutgoingPersistedOperation { source: PersisterPayloadSourceName; accountId: string; } /** * This is the base interface for an operation payload that describes * a create/update/delete of a relationship that has been persisted. */ export interface RelationshipPersistedOperation extends BaseOutgoingPersistedOperation { type: RelationshipOperationType.CREATE_RELATIONSHIP | RelationshipOperationType.CREATE_MAPPED_RELATIONSHIP | RelationshipOperationType.UPDATE_RELATIONSHIP | RelationshipOperationType.DELETE_RELATIONSHIP; /** * The `relationship` property contains the state of the relationship * after it has been persisted. */ relationship: PersistedRelationship; } export interface RelationshipCreatedOperation extends RelationshipPersistedOperation { type: RelationshipOperationType.CREATE_RELATIONSHIP; } export interface RelationshipDiff { [k: string]: RelationshipPropertyValue; } export interface RelationshipUpdatedOperation extends RelationshipPersistedOperation { type: RelationshipOperationType.UPDATE_RELATIONSHIP; diff: RelationshipDiff; } export declare type RelationshipDeletedOperation = RelationshipPersistedOperation & { type: RelationshipOperationType.DELETE_RELATIONSHIP; } & DeleteOperationProperties; export interface IntegrationDeletedOperation extends BaseOutgoingPersistedOperation { type: BulkOperationType.DELETE_INTEGRATION; integrationInstanceId: string; timestamp: number; accountId: string; } /** * The `CreateMappedRelationshipOperation` operation is the same as the * incoming operation of same type that is sent by integration with just * a few additional properties. * * `CreateMappedRelationshipOutgoingOperation` is a little different from the * rest because it expresses that a mapped relationship _should_ be created * (and not that it _was_ created). * The `CreateMappedRelationshipOutgoingOperation` comes from an integration, * passes through to the persister, and is ultimately handled by the mapper. * The mapper will then create the relationship and possibly create/update * the target entity via new operations that get sent to the persister. */ export interface CreateMappedRelationshipOutgoingOperation extends CreateMappedRelationshipIncomingOperation, BaseOutgoingPersistedOperation { source: PersisterPayloadSourceName; accountId: string; integrationInstanceId?: string; powerupName?: string; scope?: string; } /** * The `OutgoingPersisterRecord` type is the union of all operation types * that describe changes to entity/relationship that have been persisted. */ export declare type OutgoingPersisterRecord = EntityCreatedOperation | EntityUpdatedOperation | EntityDeletedOperation | RemapEntityOperation | RelationshipCreatedOperation | RelationshipUpdatedOperation | RelationshipDeletedOperation | IntegrationDeletedOperation | CreateMappedRelationshipOutgoingOperation; export {};