UNPKG

@mbc-cqrs-serverless/core

Version:
55 lines (54 loc) 1.5 kB
import { DataModel } from './data-model.interface'; import { DetailKey } from './detail-key.interface'; /** * Base entity class for all data stored in DynamoDB. * Implements the DataModel interface with common fields for CQRS operations. * * @example * ```typescript * const entity = new DataEntity({ * pk: 'TENANT001#ORDER', * sk: 'ORDER#123', * id: '123', * code: 'ORD-001', * name: 'Sample Order', * version: 1, * tenantCode: 'TENANT001', * type: 'ORDER', * }); * ``` */ export declare class DataEntity implements DataModel { cpk?: string; csk?: string; source?: string; requestId?: string; createdAt?: Date; updatedAt?: Date; createdBy?: string; updatedBy?: string; createdIp?: string; updatedIp?: string; /** Partition key for DynamoDB. Format: {tenantCode}#{entityType} */ pk: string; /** Sort key for DynamoDB. Format: {entityType}#{entityId} */ sk: string; /** Unique identifier for the entity */ id: string; /** Business code for the entity */ code: string; /** Display name of the entity */ name: string; /** Version number for optimistic locking */ version: number; /** Tenant code for multi-tenant isolation */ tenantCode: string; /** Entity type identifier */ type: string; seq?: number; ttl?: number; isDeleted?: boolean; attributes?: Record<string, any>; constructor(data: Partial<DataEntity>); get key(): DetailKey; }