@props-labs/mesh-os 0.1.11 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -157,7 +157,6 @@ export declare class MeshOS {
157
157
  }>;
158
158
  limit?: number;
159
159
  offset?: number;
160
- distinct?: boolean;
161
160
  distinctOn?: string[];
162
161
  }): Promise<Memory[]>;
163
162
  }
@@ -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, distinct, distinctOn } = options;
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
- distinct: ${distinct ? 'true' : 'false'},
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@props-labs/mesh-os",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "MeshOS - A memory system for AI agents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",