chore: update user facing timestamp for a memory (#4066)

This commit is contained in:
Mragank Shekhar
2026-02-18 03:27:46 +05:30
committed by GitHub
parent a6810819ca
commit a140829395
6 changed files with 69 additions and 23 deletions
+21 -7
View File
@@ -253,18 +253,32 @@ export default class MemoryClient {
async update(
memoryId: string,
{ text, metadata }: { text?: string; metadata?: Record<string, any> },
{
text,
metadata,
timestamp,
}: {
text?: string;
metadata?: Record<string, any>;
timestamp?: number | string;
},
): Promise<Array<Memory>> {
if (text === undefined && metadata === undefined) {
throw new Error("Either text or metadata must be provided for update.");
if (
text === undefined &&
metadata === undefined &&
timestamp === undefined
) {
throw new Error(
"At least one of text, metadata, or timestamp must be provided for update.",
);
}
if (this.telemetryId === "") await this.ping();
this._validateOrgProject();
const payload = {
text: text,
metadata: metadata,
};
const payload: Record<string, any> = {};
if (text !== undefined) payload.text = text;
if (metadata !== undefined) payload.metadata = metadata;
if (timestamp !== undefined) payload.timestamp = timestamp;
const payloadKeys = Object.keys(payload);
this._captureEvent("update", [payloadKeys]);