@memory-bank/mcp
Version:
Memory-enabled Co-Pilot (MCP) server for managing project documentation and context
72 lines • 1.89 kB
JavaScript
/**
* Represents version information for a document
*/
export class DocumentVersionInfo {
_version;
_lastModified;
_modifiedBy;
_updateReason;
/**
* Creates a new document version info
* @param params Version info parameters
*/
constructor({ version, lastModified = new Date(), modifiedBy = 'system', updateReason, }) {
this._version = version;
this._lastModified = new Date(lastModified);
this._modifiedBy = modifiedBy;
this._updateReason = updateReason;
}
/**
* Get the document version
*/
get version() {
return this._version;
}
/**
* Get the last modified date
*/
get lastModified() {
return new Date(this._lastModified);
}
/**
* Get who modified the document
*/
get modifiedBy() {
return this._modifiedBy;
}
/**
* Get the reason for the update
*/
get updateReason() {
return this._updateReason;
}
/**
* Creates a new version info with incremented version
* @param updateReason Optional update reason
* @returns New version info
*/
nextVersion(updateReason) {
return new DocumentVersionInfo({
version: this._version + 1,
lastModified: new Date(),
modifiedBy: this._modifiedBy,
updateReason: updateReason || this._updateReason,
});
}
/**
* Converts version info to a plain object
* @returns Plain object representation
*/
toObject() {
const result = {
version: this._version,
lastModified: this._lastModified,
modifiedBy: this._modifiedBy,
};
if (this._updateReason) {
result.updateReason = this._updateReason;
}
return result;
}
}
//# sourceMappingURL=DocumentVersionInfo.js.map