@props-labs/mesh-os 0.1.11 → 0.1.13
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/dist/core/client.d.ts +0 -1
- package/dist/core/client.js +11 -6
- package/package.json +1 -1
package/dist/core/client.d.ts
CHANGED
package/dist/core/client.js
CHANGED
@@ -742,7 +742,13 @@ class MeshOS {
|
|
742
742
|
* Query memories with flexible filtering, sorting, and pagination.
|
743
743
|
*/
|
744
744
|
async getMemories(options) {
|
745
|
-
const { where, orderBy, limit, offset,
|
745
|
+
const { where, orderBy, limit, offset, distinctOn } = options;
|
746
|
+
// Convert orderBy to Hasura format
|
747
|
+
const hasuraOrderBy = orderBy?.map(({ column, order }) => {
|
748
|
+
// Convert camelCase to snake_case for column names
|
749
|
+
const snakeCaseColumn = column.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`);
|
750
|
+
return { [snakeCaseColumn]: order };
|
751
|
+
});
|
746
752
|
// Build the GraphQL query dynamically
|
747
753
|
const query = `
|
748
754
|
query GetMemories(
|
@@ -756,9 +762,8 @@ class MeshOS {
|
|
756
762
|
where: $where,
|
757
763
|
order_by: $orderBy,
|
758
764
|
limit: $limit,
|
759
|
-
offset: $offset
|
760
|
-
|
761
|
-
distinct_on: $distinctOn
|
765
|
+
offset: $offset
|
766
|
+
${distinctOn ? ', distinct_on: $distinctOn' : ''}
|
762
767
|
) {
|
763
768
|
id
|
764
769
|
agent_id
|
@@ -773,10 +778,10 @@ class MeshOS {
|
|
773
778
|
`;
|
774
779
|
const result = await this.executeQuery(query, {
|
775
780
|
where,
|
776
|
-
orderBy,
|
781
|
+
orderBy: hasuraOrderBy,
|
777
782
|
limit,
|
778
783
|
offset,
|
779
|
-
distinctOn
|
784
|
+
...(distinctOn ? { distinctOn } : {})
|
780
785
|
});
|
781
786
|
return result.memories.map(memory => ({
|
782
787
|
id: memory.id,
|