@thingd/sdk 0.37.0 → 0.37.1

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.
@@ -44,7 +44,7 @@ export class NativeThingStore {
44
44
  }
45
45
  async listObjects(collection, options) {
46
46
  const collectionsJson = JSON.stringify([collection]);
47
- const filterJson = options?.filter ? JSON.stringify(options.filter) : undefined;
47
+ const filterJson = serializeFilter(options?.filter);
48
48
  const sortField = options?.sortBy?.field;
49
49
  const sortDirection = options?.sortBy?.direction;
50
50
  return parseJson(this.binding.listObjectsJson(collectionsJson, filterJson, options?.limit, options?.offset, sortField, sortDirection)).map(objectFromNative);
@@ -79,7 +79,7 @@ export class NativeThingStore {
79
79
  }
80
80
  async search(query, options = {}) {
81
81
  const collectionsJson = options.collections ? JSON.stringify(options.collections) : undefined;
82
- const filterJson = options.filter ? JSON.stringify(options.filter) : undefined;
82
+ const filterJson = serializeFilter(options.filter);
83
83
  const hits = parseJson(this.binding.searchJson(query, collectionsJson, options.limit, filterJson));
84
84
  return hits.map((hit) => {
85
85
  if (hit.kind === "object") {
@@ -316,3 +316,18 @@ function formatUnknownError(error) {
316
316
  }
317
317
  return `Original error: ${String(error)}`;
318
318
  }
319
+ function serializeFilter(filter) {
320
+ if (!filter) {
321
+ return undefined;
322
+ }
323
+ const cleaned = {};
324
+ for (const [key, value] of Object.entries(filter)) {
325
+ if (value !== undefined) {
326
+ cleaned[key] = value;
327
+ }
328
+ }
329
+ if (Object.keys(cleaned).length === 0) {
330
+ return undefined;
331
+ }
332
+ return JSON.stringify(cleaned);
333
+ }
package/dist/version.d.ts CHANGED
@@ -2,5 +2,5 @@
2
2
  * The published version of the thingd SDK.
3
3
  * Updated automatically by semantic-release during the publish process.
4
4
  */
5
- export declare const SDK_VERSION = "0.37.0";
5
+ export declare const SDK_VERSION = "0.37.1";
6
6
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -2,4 +2,4 @@
2
2
  * The published version of the thingd SDK.
3
3
  * Updated automatically by semantic-release during the publish process.
4
4
  */
5
- export const SDK_VERSION = "0.37.0";
5
+ export const SDK_VERSION = "0.37.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thingd/sdk",
3
- "version": "0.37.0",
3
+ "version": "0.37.1",
4
4
  "description": "A fast object-first data engine for applications and AI agents.",
5
5
  "type": "module",
6
6
  "author": "Sayan Mohsin",
@@ -63,7 +63,7 @@
63
63
  "zod": "^4.4.3"
64
64
  },
65
65
  "optionalDependencies": {
66
- "@thingd/native": "0.37.0"
66
+ "@thingd/native": "0.37.1"
67
67
  },
68
68
  "engines": {
69
69
  "node": ">=24.0.0"