@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.
- package/dist/stores/native-thing-store.js +17 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -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
|
|
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 =
|
|
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
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thingd/sdk",
|
|
3
|
-
"version": "0.37.
|
|
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.
|
|
66
|
+
"@thingd/native": "0.37.1"
|
|
67
67
|
},
|
|
68
68
|
"engines": {
|
|
69
69
|
"node": ">=24.0.0"
|