fix(sdk): removing the enable graph flag and switching from snake case to camel case for client ts sdk (#4776)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kartik
2026-04-12 02:40:54 +05:30
committed by GitHub
co-authored by Claude Opus 4.6
parent e44b46ef2e
commit 9d6b79a14e
45 changed files with 292 additions and 1927 deletions
@@ -51,7 +51,7 @@ describeIntegration("MemoryClient Integration — CRUD", () => {
},
];
const result = await client.add(messages, { user_id: TEST_USER_ID });
const result = await client.add(messages, { userId: TEST_USER_ID });
// API processes memories asynchronously — returns PENDING
expect(Array.isArray(result)).toBe(true);
@@ -60,7 +60,7 @@ describeIntegration("MemoryClient Integration — CRUD", () => {
// Validate response shape
for (const item of result) {
expect(item).toHaveProperty("status");
expect(item).toHaveProperty("event_id");
expect(item).toHaveProperty("eventId");
}
});
@@ -76,7 +76,7 @@ describeIntegration("MemoryClient Integration — CRUD", () => {
},
];
const result = await client.add(messages, { user_id: TEST_USER_ID });
const result = await client.add(messages, { userId: TEST_USER_ID });
expect(Array.isArray(result)).toBe(true);
});
@@ -103,17 +103,17 @@ describeIntegration("MemoryClient Integration — CRUD", () => {
expect(memory.id).toBe(memoryId);
expect(typeof memory.memory).toBe("string");
expect(memory.memory!.length).toBeGreaterThan(0);
expect(typeof memory.user_id).toBe("string");
expect(typeof memory.userId).toBe("string");
expect(
memory.metadata === null || typeof memory.metadata === "object",
).toBe(true);
expect(
Array.isArray(memory.categories) || memory.categories === null,
).toBe(true);
expect(new Date(memory.created_at || "").toString()).not.toBe(
expect(new Date(memory.createdAt || "").toString()).not.toBe(
"Invalid Date",
);
expect(new Date(memory.updated_at || "").toString()).not.toBe(
expect(new Date(memory.updatedAt || "").toString()).not.toBe(
"Invalid Date",
);
});
@@ -123,7 +123,7 @@ describeIntegration("MemoryClient Integration — CRUD", () => {
describe("get all memories", () => {
test("returns all memories for test user", async () => {
const memories = await client.getAll({
filters: { user_id: TEST_USER_ID },
filters: { userId: TEST_USER_ID },
});
expect(Array.isArray(memories)).toBe(true);
@@ -137,9 +137,9 @@ describeIntegration("MemoryClient Integration — CRUD", () => {
test("returns paginated results with page and page_size", async () => {
const page1 = await client.getAll({
filters: { user_id: TEST_USER_ID },
filters: { userId: TEST_USER_ID },
page: 1,
page_size: 1,
pageSize: 1,
});
// Paginated response is an object with results array
@@ -191,7 +191,7 @@ describeIntegration("MemoryClient Integration — CRUD", () => {
},
],
{
user_id: TEST_USER_ID,
userId: TEST_USER_ID,
metadata: { source: "integration-test", category: "preferences" },
},
);
@@ -202,7 +202,7 @@ describeIntegration("MemoryClient Integration — CRUD", () => {
test("getAll for non-existent user returns empty array", async () => {
const memories = await client.getAll({
filters: { user_id: `nonexistent-user-${randomUUID()}` },
filters: { userId: `nonexistent-user-${randomUUID()}` },
});
expect(Array.isArray(memories)).toBe(true);
@@ -211,7 +211,7 @@ describeIntegration("MemoryClient Integration — CRUD", () => {
test("deleteAll for non-existent user does not throw", async () => {
const result = await client.deleteAll({
user_id: `nonexistent-user-${randomUUID()}`,
userId: `nonexistent-user-${randomUUID()}`,
});
expect(result).toBeDefined();
@@ -241,13 +241,13 @@ describeIntegration("MemoryClient Integration — CRUD", () => {
// ─── Delete all + delete user ─────────────────────────────
describe("cleanup operations", () => {
test("deletes all memories for test user", async () => {
const result = await client.deleteAll({ user_id: TEST_USER_ID });
const result = await client.deleteAll({ userId: TEST_USER_ID });
expect(result).toBeDefined();
expect(typeof result.message).toBe("string");
});
test("deletes the test user entity", async () => {
const result = await client.deleteUsers({ user_id: TEST_USER_ID });
const result = await client.deleteUsers({ userId: TEST_USER_ID });
expect(result).toBeDefined();
expect(result.message).toBe("Entity deleted successfully.");
});
@@ -18,10 +18,10 @@ export default async function globalSetup() {
// Full project wipe — all four filters set explicitly
try {
await client.deleteAll({
user_id: "*",
agent_id: "*",
app_id: "*",
run_id: "*",
userId: "*",
agentId: "*",
appId: "*",
runId: "*",
});
} catch {
// ignore — may 404 if no data exists
@@ -17,10 +17,10 @@ export default async function globalTeardown() {
try {
await client.deleteAll({
user_id: "*",
agent_id: "*",
app_id: "*",
run_id: "*",
userId: "*",
agentId: "*",
appId: "*",
runId: "*",
});
} catch {
// ignore
@@ -64,7 +64,7 @@ export async function waitForMemories(
): Promise<Memory[]> {
for (let attempt = 1; attempt <= maxRetries; attempt++) {
const memories = await withRetry(() =>
client.getAll({ filters: { user_id: userId } }),
client.getAll({ filters: { userId } }),
);
if (Array.isArray(memories) && memories.length >= minCount) {
return memories;
@@ -154,7 +154,7 @@ export async function seedTestMemories(
"Nice to meet you! I'll remember that your favorite color is blue.",
},
],
{ user_id: userId },
{ userId },
),
);
@@ -170,7 +170,7 @@ export async function seedTestMemories(
content: "Got it, you're a software engineer at Acme Corp!",
},
],
{ user_id: userId },
{ userId },
),
);
@@ -186,12 +186,12 @@ export async function cleanupTestUser(
userId: string,
): Promise<void> {
try {
await client.deleteAll({ user_id: userId });
await client.deleteAll({ userId });
} catch {
// ignore
}
try {
await client.deleteUsers({ user_id: userId });
await client.deleteUsers({ userId });
} catch {
// ignore
}
@@ -209,10 +209,10 @@ export async function fullProjectCleanup(client: MemoryClient): Promise<void> {
// Delete all memories — all four filters set explicitly
try {
await client.deleteAll({
user_id: "*",
agent_id: "*",
app_id: "*",
run_id: "*",
userId: "*",
agentId: "*",
appId: "*",
runId: "*",
});
} catch {
// ignore — may 404 if no data exists
@@ -67,16 +67,16 @@ describeIntegration("MemoryClient Integration — Users & Project", () => {
expect(project).toBeDefined();
expect(typeof project).toBe("object");
expect("custom_instructions" in project).toBe(true);
expect("customInstructions" in project).toBe(true);
originalInstructions = project.custom_instructions;
originalInstructions = project.customInstructions;
});
test("updates project custom_instructions via updateProject()", async () => {
const testInstruction = `integration-test-${randomUUID().slice(0, 8)}`;
const result = await client.updateProject({
custom_instructions: testInstruction,
customInstructions: testInstruction,
});
expect(result).toBeDefined();
@@ -85,11 +85,11 @@ describeIntegration("MemoryClient Integration — Users & Project", () => {
const project = await client.getProject({
fields: ["custom_instructions"],
});
expect(project.custom_instructions).toBe(testInstruction);
expect(project.customInstructions).toBe(testInstruction);
// Restore original
await client.updateProject({
custom_instructions: originalInstructions || "",
customInstructions: originalInstructions || "",
});
});
});
@@ -120,26 +120,26 @@ describeIntegration("MemoryClient Integration — Users & Project", () => {
eventTypes: [WebhookEvent.MEMORY_ADDED, WebhookEvent.MEMORY_UPDATED],
}),
);
createdWebhookId = result.webhook_id!;
expect(result.webhook_id).toBeDefined();
createdWebhookId = result.webhookId!;
expect(result.webhookId).toBeDefined();
});
test("createWebhook returns the correct name", async () => {
const webhooks = await withRetry(() => client.getWebhooks());
const wh = webhooks.find((w) => w.webhook_id === createdWebhookId);
const wh = webhooks.find((w) => w.webhookId === createdWebhookId);
expect(wh!.name).toBe(hookName);
});
test("createWebhook returns the correct url", async () => {
const webhooks = await withRetry(() => client.getWebhooks());
const wh = webhooks.find((w) => w.webhook_id === createdWebhookId);
const wh = webhooks.find((w) => w.webhookId === createdWebhookId);
expect(wh!.url).toBe(hookUrl);
});
test("createWebhook returns the correct event_types", async () => {
const webhooks = await withRetry(() => client.getWebhooks());
const wh = webhooks.find((w) => w.webhook_id === createdWebhookId);
expect(wh!.event_types?.sort()).toStrictEqual(
const wh = webhooks.find((w) => w.webhookId === createdWebhookId);
expect(wh!.eventTypes?.sort()).toStrictEqual(
[WebhookEvent.MEMORY_ADDED, WebhookEvent.MEMORY_UPDATED].sort(),
);
});
@@ -152,14 +152,14 @@ describeIntegration("MemoryClient Integration — Users & Project", () => {
test("getWebhooks includes the created webhook", async () => {
const webhooks = await withRetry(() => client.getWebhooks());
const found = webhooks.find((w) => w.webhook_id === createdWebhookId);
const found = webhooks.find((w) => w.webhookId === createdWebhookId);
expect(found).toBeDefined();
});
test("getWebhooks shows the webhook as active", async () => {
const webhooks = await withRetry(() => client.getWebhooks());
const found = webhooks.find((w) => w.webhook_id === createdWebhookId);
expect(found!.is_active).toBe(true);
const found = webhooks.find((w) => w.webhookId === createdWebhookId);
expect(found!.isActive).toBe(true);
});
// ─── Update ────────────────────────────────────────────
@@ -177,14 +177,14 @@ describeIntegration("MemoryClient Integration — Users & Project", () => {
test("updateWebhook persists the new name", async () => {
const webhooks = await withRetry(() => client.getWebhooks());
const updated = webhooks.find((w) => w.webhook_id === createdWebhookId);
const updated = webhooks.find((w) => w.webhookId === createdWebhookId);
expect(updated!.name).toBe(updatedName);
});
test("updateWebhook persists the new event_types", async () => {
const webhooks = await withRetry(() => client.getWebhooks());
const updated = webhooks.find((w) => w.webhook_id === createdWebhookId);
expect(updated!.event_types?.sort()).toStrictEqual(
const updated = webhooks.find((w) => w.webhookId === createdWebhookId);
expect(updated!.eventTypes?.sort()).toStrictEqual(
[WebhookEvent.MEMORY_DELETED].sort(),
);
});
@@ -199,7 +199,7 @@ describeIntegration("MemoryClient Integration — Users & Project", () => {
test("deleteWebhook removes the webhook from the list", async () => {
const webhooks = await withRetry(() => client.getWebhooks());
const found = webhooks.find((w) => w.webhook_id === createdWebhookId);
const found = webhooks.find((w) => w.webhookId === createdWebhookId);
expect(found).toBeUndefined();
createdWebhookId = "";
});
@@ -43,7 +43,7 @@ describeIntegration("MemoryClient Integration — Search & History", () => {
const results = await waitForSearchResults(
client,
"What is my favorite color?",
{ filters: { user_id: TEST_USER_ID } },
{ filters: { userId: TEST_USER_ID } },
);
expect(Array.isArray(results)).toBe(true);
@@ -64,7 +64,7 @@ describeIntegration("MemoryClient Integration — Search & History", () => {
client,
"What do you know about me?",
{
filters: { OR: [{ user_id: TEST_USER_ID }] },
filters: { OR: [{ userId: TEST_USER_ID }] },
},
);
@@ -89,15 +89,15 @@ describeIntegration("MemoryClient Integration — Search & History", () => {
const entry = history[0];
expect(typeof entry.id).toBe("string");
expect(typeof entry.memory_id).toBe("string");
expect(typeof entry.memoryId).toBe("string");
expect(["ADD", "UPDATE", "DELETE", "NOOP"]).toContain(entry.event);
expect(new Date(entry.created_at).toString()).not.toBe("Invalid Date");
expect(new Date(entry.updated_at).toString()).not.toBe("Invalid Date");
expect(new Date(entry.createdAt).toString()).not.toBe("Invalid Date");
expect(new Date(entry.updatedAt).toString()).not.toBe("Invalid Date");
expect(
entry.new_memory === null || typeof entry.new_memory === "string",
entry.newMemory === null || typeof entry.newMemory === "string",
).toBe(true);
expect(
entry.old_memory === null || typeof entry.old_memory === "string",
entry.oldMemory === null || typeof entry.oldMemory === "string",
).toBe(true);
const events = history.map((h) => h.event);
@@ -109,7 +109,7 @@ describeIntegration("MemoryClient Integration — Search & History", () => {
describe("edge cases", () => {
test("search for non-existent user returns empty results", async () => {
const results = await client.search("anything", {
filters: { user_id: `nonexistent-user-${randomUUID()}` },
filters: { userId: `nonexistent-user-${randomUUID()}` },
});
expect(Array.isArray(results)).toBe(true);
@@ -120,8 +120,8 @@ describeIntegration("MemoryClient Integration — Search & History", () => {
const results = await client.search(
"Tell me about integration test user",
{
filters: { user_id: TEST_USER_ID },
top_k: 1,
filters: { userId: TEST_USER_ID },
topK: 1,
},
);