class Matrix { constructor({ // config (create) name, masterTopUserId, masterTopUserEmail, // ego activation (optional legacy fields) rootUserId, egoActivatedAt, lastBfsFillAt, immediateChildrenCount, firstFreePosition, matrixInstanceId // ADDED (was missing → ReferenceError) }) { this.name = typeof name === 'string' ? name : null; this.masterTopUserId = masterTopUserId !== undefined ? Number(masterTopUserId) : null; this.masterTopUserEmail = masterTopUserEmail || null; this.rootUserId = rootUserId !== undefined ? Number(rootUserId) : null; this.egoActivatedAt = egoActivatedAt || null; this.lastBfsFillAt = lastBfsFillAt || null; this.immediateChildrenCount = immediateChildrenCount !== undefined ? Number(immediateChildrenCount || 0) : null; this.firstFreePosition = firstFreePosition !== undefined ? (firstFreePosition === null ? null : Number(firstFreePosition)) : null; this.matrixInstanceId = matrixInstanceId !== undefined ? Number(matrixInstanceId) : null; } } module.exports = Matrix;