Updated TS client to use proper types for deleteUsers (#2612)

This commit is contained in:
Saket Aryan
2025-05-02 23:11:40 +05:30
committed by GitHub
parent 7b3abd06d0
commit 63e22382de
3 changed files with 14 additions and 6 deletions

View File

@@ -209,6 +209,11 @@ mode: "wide"
<Tab title="TypeScript">
<Update label="2025-05-02" description="v2.1.22">
**New Features:**
- **Client:** Updated `deleteUser` to use `entity_id` and `entity_type`
</Update>
<Update label="2025-05-01" description="v2.1.21">
**Improvements:**
- **OSS SDK:** Bumped version of `@anthropic-ai/sdk` to `0.40.1`

View File

@@ -1,6 +1,6 @@
{
"name": "mem0ai",
"version": "2.1.21",
"version": "2.1.22",
"description": "The Memory Layer For Your AI Apps",
"main": "./dist/index.js",
"module": "./dist/index.mjs",

View File

@@ -431,14 +431,17 @@ export default class MemoryClient {
return response;
}
async deleteUser(
entityId: string,
entity: { type: string } = { type: "user" },
): Promise<{ message: string }> {
async deleteUser(data: {
entity_id: number;
entity_type: string;
}): Promise<{ message: string }> {
if (this.telemetryId === "") await this.ping();
this._captureEvent("delete_user", []);
if (!data.entity_type) {
data.entity_type = "user";
}
const response = await this._fetchWithErrorHandling(
`${this.host}/v1/entities/${entity.type}/${entityId}/`,
`${this.host}/v1/entities/${data.entity_type}/${data.entity_id}/`,
{
method: "DELETE",
headers: this.headers,