@mastra/client-js 0.0.0-fix-9244-clickhouse-metadata-20251104223105 → 0.0.0-fix-thread-list-20251105222841
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +107 -3
- package/dist/client.d.ts +3 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/index.cjs +18 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -42
- package/dist/index.js.map +1 -1
- package/dist/resources/agent-builder.d.ts +0 -11
- package/dist/resources/agent-builder.d.ts.map +1 -1
- package/dist/resources/memory-thread.d.ts +1 -9
- package/dist/resources/memory-thread.d.ts.map +1 -1
- package/dist/resources/workflow.d.ts +0 -12
- package/dist/resources/workflow.d.ts.map +1 -1
- package/dist/types.d.ts +4 -11
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -4
package/dist/index.js
CHANGED
|
@@ -1415,20 +1415,6 @@ var MemoryThread = class extends BaseResource {
|
|
|
1415
1415
|
}
|
|
1416
1416
|
);
|
|
1417
1417
|
}
|
|
1418
|
-
/**
|
|
1419
|
-
* Retrieves messages associated with the thread (always returns mastra-db format)
|
|
1420
|
-
* @param params - Optional parameters including limit for number of messages to retrieve and request context
|
|
1421
|
-
* @returns Promise containing thread messages in mastra-db format
|
|
1422
|
-
*/
|
|
1423
|
-
getMessages(params) {
|
|
1424
|
-
const query = new URLSearchParams({
|
|
1425
|
-
agentId: this.agentId,
|
|
1426
|
-
...params?.limit ? { limit: params.limit.toString() } : {}
|
|
1427
|
-
});
|
|
1428
|
-
return this.request(
|
|
1429
|
-
`/api/memory/threads/${this.threadId}/messages?${query.toString()}${requestContextQueryString(params?.requestContext, "&")}`
|
|
1430
|
-
);
|
|
1431
|
-
}
|
|
1432
1418
|
/**
|
|
1433
1419
|
* Retrieves paginated messages associated with the thread with filtering and ordering options
|
|
1434
1420
|
* @param params - Pagination parameters including page, perPage, orderBy, filter, include options, and request context
|
|
@@ -1444,9 +1430,9 @@ var MemoryThread = class extends BaseResource {
|
|
|
1444
1430
|
if (filter) queryParams.filter = JSON.stringify(filter);
|
|
1445
1431
|
if (include) queryParams.include = JSON.stringify(include);
|
|
1446
1432
|
const query = new URLSearchParams(queryParams);
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
);
|
|
1433
|
+
const queryString = query.toString();
|
|
1434
|
+
const url = `/api/memory/threads/${this.threadId}/messages${queryString ? `?${queryString}` : ""}${requestContextQueryString(requestContext, queryString ? "&" : "?")}`;
|
|
1435
|
+
return this.request(url);
|
|
1450
1436
|
}
|
|
1451
1437
|
/**
|
|
1452
1438
|
* Deletes one or more messages from the thread
|
|
@@ -1656,17 +1642,6 @@ var Workflow = class extends BaseResource {
|
|
|
1656
1642
|
method: "POST"
|
|
1657
1643
|
});
|
|
1658
1644
|
}
|
|
1659
|
-
/**
|
|
1660
|
-
* Sends an event to a specific workflow run by its ID
|
|
1661
|
-
* @param params - Object containing the runId, event and data
|
|
1662
|
-
* @returns Promise containing a success message
|
|
1663
|
-
*/
|
|
1664
|
-
sendRunEvent(params) {
|
|
1665
|
-
return this.request(`/api/workflows/${this.workflowId}/runs/${params.runId}/send-event`, {
|
|
1666
|
-
method: "POST",
|
|
1667
|
-
body: { event: params.event, data: params.data }
|
|
1668
|
-
});
|
|
1669
|
-
}
|
|
1670
1645
|
/**
|
|
1671
1646
|
* Creates a new workflow run
|
|
1672
1647
|
* @param params - Optional object containing the optional runId
|
|
@@ -2580,17 +2555,6 @@ var AgentBuilder = class extends BaseResource {
|
|
|
2580
2555
|
method: "POST"
|
|
2581
2556
|
});
|
|
2582
2557
|
}
|
|
2583
|
-
/**
|
|
2584
|
-
* Sends an event to an agent builder action run.
|
|
2585
|
-
* This calls `/api/agent-builder/:actionId/runs/:runId/send-event`.
|
|
2586
|
-
*/
|
|
2587
|
-
async sendRunEvent(params) {
|
|
2588
|
-
const url = `/api/agent-builder/${this.actionId}/runs/${params.runId}/send-event`;
|
|
2589
|
-
return this.request(url, {
|
|
2590
|
-
method: "POST",
|
|
2591
|
-
body: { event: params.event, data: params.data }
|
|
2592
|
-
});
|
|
2593
|
-
}
|
|
2594
2558
|
};
|
|
2595
2559
|
|
|
2596
2560
|
// src/resources/observability.ts
|
|
@@ -2706,18 +2670,27 @@ var MastraClient = class extends BaseResource {
|
|
|
2706
2670
|
* @param params - Parameters containing resource ID, pagination options, and optional request context
|
|
2707
2671
|
* @returns Promise containing paginated array of memory threads with metadata
|
|
2708
2672
|
*/
|
|
2709
|
-
listMemoryThreads(params) {
|
|
2673
|
+
async listMemoryThreads(params) {
|
|
2710
2674
|
const queryParams = new URLSearchParams({
|
|
2711
2675
|
resourceId: params.resourceId,
|
|
2676
|
+
resourceid: params.resourceId,
|
|
2712
2677
|
agentId: params.agentId,
|
|
2713
2678
|
...params.page !== void 0 && { page: params.page.toString() },
|
|
2714
2679
|
...params.perPage !== void 0 && { perPage: params.perPage.toString() },
|
|
2715
2680
|
...params.orderBy && { orderBy: params.orderBy },
|
|
2716
2681
|
...params.sortDirection && { sortDirection: params.sortDirection }
|
|
2717
2682
|
});
|
|
2718
|
-
|
|
2683
|
+
const response = await this.request(
|
|
2719
2684
|
`/api/memory/threads?${queryParams.toString()}${requestContextQueryString(params.requestContext, "&")}`
|
|
2720
2685
|
);
|
|
2686
|
+
const actualResponse = "threads" in response ? response : {
|
|
2687
|
+
threads: response,
|
|
2688
|
+
total: response.length,
|
|
2689
|
+
page: params.page ?? 0,
|
|
2690
|
+
perPage: params.perPage ?? 100,
|
|
2691
|
+
hasMore: false
|
|
2692
|
+
};
|
|
2693
|
+
return actualResponse;
|
|
2721
2694
|
}
|
|
2722
2695
|
/**
|
|
2723
2696
|
* Retrieves memory config for a resource
|
|
@@ -2748,7 +2721,10 @@ var MastraClient = class extends BaseResource {
|
|
|
2748
2721
|
getMemoryThread({ threadId, agentId }) {
|
|
2749
2722
|
return new MemoryThread(this.options, threadId, agentId);
|
|
2750
2723
|
}
|
|
2751
|
-
|
|
2724
|
+
listThreadMessages(threadId, opts = {}) {
|
|
2725
|
+
if (!opts.agentId && !opts.networkId) {
|
|
2726
|
+
throw new Error("Either agentId or networkId must be provided");
|
|
2727
|
+
}
|
|
2752
2728
|
let url = "";
|
|
2753
2729
|
if (opts.agentId) {
|
|
2754
2730
|
url = `/api/memory/threads/${threadId}/messages?agentId=${opts.agentId}${requestContextQueryString(opts.requestContext, "&")}`;
|