@thingd/sdk 0.49.1 → 0.49.3

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/README.md CHANGED
@@ -24,33 +24,46 @@ console.log(obj); // { id: "hello", text: "Hello world", collection: "notes", ve
24
24
  ## Subpath imports
25
25
 
26
26
  ```typescript
27
- // Lightweight HTTP client (browser + Node.js + Bun, zero dependencies)
28
- import { ThingD } from "@thingd/sdk/client";
27
+ // Full SDK (Node.js: MCP + REST + stores + native binding)
28
+ import { ThingD } from "@thingd/sdk";
29
+
30
+ // Lightweight HTTP client (Node.js + Bun, works in browsers via @thingd/client)
31
+ import { openThingD, HttpThingStore } from "@thingd/sdk/client";
29
32
 
30
- // Pure in-memory store (browser + Node.js + Bun, zero dependencies)
31
- import { ThingD } from "@thingd/sdk/memory";
33
+ // Pure in-memory store (browser + Node.js + Bun)
34
+ import { openMemoryThingD, InMemoryThingStore } from "@thingd/sdk/memory";
32
35
 
33
36
  // Types only (for type-safe dependency injection)
34
37
  import type { ThingDConnection } from "@thingd/sdk/types";
35
38
  ```
36
39
 
37
- ## Bun + Hono
40
+ ## Browser / Edge
38
41
 
39
- thingd's HTTP client (`@thingd/sdk/client`) uses only web-standard `fetch()` — it runs in **Bun**, Deno, Cloudflare Workers, and browsers. No Node.js dependencies.
42
+ For browser, Cloudflare Workers, and other edge runtimes, use the standalone
43
+ `@thingd/client` package — a zero-dependency REST client:
40
44
 
41
- Connect to the thingd sidecar (Rust binary) over HTTP:
45
+ ```bash
46
+ npm install @thingd/client
47
+ ```
42
48
 
43
49
  ```ts
44
- import { ThingD } from "@thingd/sdk/client";
50
+ import { ThingdClient } from "@thingd/client";
45
51
 
46
- const db = await ThingD.open({
47
- driver: "cloud",
48
- databaseUrl: "http://localhost:8757",
52
+ const db = new ThingdClient({
53
+ url: "https://api.thingd.cloud",
54
+ authToken: "sk-...",
49
55
  });
50
56
  ```
51
57
 
52
- Full example: [`examples/bun-hono/`](https://github.com/sayanmohsin/thingd/tree/main/examples/bun-hono)
53
- Guide: [`docs/bun-hono.md`](https://github.com/sayanmohsin/thingd/tree/main/docs/bun-hono.md)
58
+ Or use the subpath import (works in Node.js and Bun, bundled for browser):
59
+
60
+ ```ts
61
+ import { HttpThingStore } from "@thingd/sdk/client";
62
+ const store = await HttpThingStore.open({
63
+ url: "http://localhost:8757",
64
+ authToken: "change-me",
65
+ });
66
+ ```
54
67
 
55
68
  ## API
56
69
 
@@ -1,4 +1,4 @@
1
- import type { ConnectorAuth, ConnectorSchema, ConnectorSyncOptions, ConnectorSyncResult, ListEventsOptions, ListObjectsOptions, MemoryEvent, MemoryObject, MemorySearchOptions, MemorySearchResult, QueueClaimOptions, QueueJob, QueueJobOptions, QueueJobPayload, QueueJobResult, QueueNackOptions, StoredMemoryEvent, StoredMemoryObject, ThingDeleteResult, ThingStore } from "../types.js";
1
+ import type { AggregateOptions, AggregateResult, CollectionSchema, ConnectorAuth, ConnectorSchema, ConnectorSyncOptions, ConnectorSyncResult, ListEventsOptions, ListObjectsOptions, MemoryEvent, MemoryObject, MemorySearchOptions, MemorySearchResult, NlqOptions, NlqResult, QueueClaimOptions, QueueJob, QueueJobOptions, QueueJobPayload, QueueJobResult, QueueNackOptions, SchemaOptions, StoredMemoryEvent, StoredMemoryObject, ThingDeleteResult, ThingStore, TimeSeriesOptions, TimeSeriesResult } from "../types.js";
2
2
  export type HttpThingStoreOptions = {
3
3
  url: string;
4
4
  authToken?: string;
@@ -40,5 +40,9 @@ export declare class HttpThingStore implements ThingStore {
40
40
  listConnectors(): Promise<string[]>;
41
41
  discoverConnectorSchema(type: string, query: string, auth?: ConnectorAuth): Promise<ConnectorSchema>;
42
42
  connectorSync(type: string, options: ConnectorSyncOptions): Promise<ConnectorSyncResult>;
43
+ aggregate(collection: string, options: AggregateOptions): Promise<AggregateResult>;
44
+ timeseries(collection: string, options: TimeSeriesOptions): Promise<TimeSeriesResult>;
45
+ schema(collection?: string, _options?: SchemaOptions): Promise<CollectionSchema[]>;
46
+ nlqQuery(question: string, options?: NlqOptions): Promise<NlqResult>;
43
47
  }
44
48
  //# sourceMappingURL=http-thing-store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http-thing-store.d.ts","sourceRoot":"","sources":["../../src/client/http-thing-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,EACR,eAAe,EACf,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACX,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,qBAAqB,GAAG;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,qBAAa,cAAe,YAAW,UAAU;IAMnC,OAAO,CAAC,QAAQ,CAAC,OAAO;IALpC,OAAa,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,qBAAqB,GAAG,OAAO,CAAC,cAAc,CAAC,CAGvF;IAED,YAA6B,OAAO,EAAE,qBAAqB,EAAI;IAE/D,OAAO,KAAK,IAAI,GAGf;YAEa,OAAO;IAqBf,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAM/E;IAEK,GAAG,CAAC,CAAC,GAAG,kBAAkB,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAYnF;IAEK,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAMvE;IAEK,WAAW,CAAC,CAAC,GAAG,kBAAkB,E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eAAe,CAAC,CAU1B;IAEK,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAM7F;CACF"}
1
+ {"version":3,"file":"http-thing-store.d.ts","sourceRoot":"","sources":["../../src/client/http-thing-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,eAAe,EACf,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,qBAAqB,GAAG;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,qBAAa,cAAe,YAAW,UAAU;IAMnC,OAAO,CAAC,QAAQ,CAAC,OAAO;IALpC,OAAa,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,qBAAqB,GAAG,OAAO,CAAC,cAAc,CAAC,CAGvF;IAED,YAA6B,OAAO,EAAE,qBAAqB,EAAI;IAE/D,OAAO,KAAK,IAAI,GAGf;YAEa,OAAO;IAqBf,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAM/E;IAEK,GAAG,CAAC,CAAC,GAAG,kBAAkB,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAYnF;IAEK,MAAM,CAAC,UAAU,EAAE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IAEK,uBAAuB,CAC3B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,aAAa,GACnB,OAAO,CAAC,eAAe,CAAC,CAU1B;IAEK,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAM7F;IAEK,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAEvF;IAEK,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAE1F;IAEK,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAKvF;IAEK,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAEzE;CACF"}
@@ -188,4 +188,19 @@ export class HttpThingStore {
188
188
  async connectorSync(type, options) {
189
189
  return this.request("POST", `/connectors/${encodeURIComponent(type)}/pull`, options);
190
190
  }
191
+ async aggregate(collection, options) {
192
+ return this.request("POST", "/aggregate", { collection, ...options });
193
+ }
194
+ async timeseries(collection, options) {
195
+ return this.request("POST", "/aggregate/timeseries", { collection, ...options });
196
+ }
197
+ async schema(collection, _options) {
198
+ if (collection) {
199
+ return this.request("GET", `/collections/${encodeURIComponent(collection)}/schema`);
200
+ }
201
+ return this.request("GET", "/collections/schema");
202
+ }
203
+ async nlqQuery(question, options) {
204
+ return this.request("POST", "/nlq", { question, ...options });
205
+ }
191
206
  }
@@ -1,5 +1,5 @@
1
1
  export type { Link, LinkDirection, LinkQueryOptions, ListEventsOptions, ListObjectsOptions, MemoryEvent, MemoryObject, MemoryQueue, MemorySearchOptions, MemorySearchResult, QueueClaimOptions, QueueJob, QueueJobOptions, QueueJobPayload, QueueJobResult, QueueJobStatus, QueueNackOptions, SortBy, SortDirection, StoredMemoryEvent, StoredMemoryObject, ThingDConnection, ThingDeleteResult, ThingStore, } from "../types.js";
2
2
  export { HttpThingStore, type HttpThingStoreOptions } from "./http-thing-store.js";
3
3
  export { InMemoryThingStore } from "./in-memory-thing-store.js";
4
- export { ThingD, type ThingDDriver, type ThingDOpenConfig, type ThingDOpenOptions, } from "./thingd.js";
4
+ export { openThingD, type ThingDClientOptions, } from "./thingd.js";
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,IAAI,EACJ,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,EACR,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EACL,MAAM,EACN,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,IAAI,EACJ,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,EACR,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EACL,UAAU,EACV,KAAK,mBAAmB,GACzB,MAAM,aAAa,CAAC"}
@@ -1,3 +1,3 @@
1
1
  export { HttpThingStore } from "./http-thing-store.js";
2
2
  export { InMemoryThingStore } from "./in-memory-thing-store.js";
3
- export { ThingD, } from "./thingd.js";
3
+ export { openThingD, } from "./thingd.js";
@@ -1,3 +1,24 @@
1
+ import { HttpThingStore } from "./http-thing-store.js";
2
+ import { InMemoryThingStore } from "./in-memory-thing-store.js";
1
3
  export type { ThingDDriver, ThingDOpenConfig, ThingDOpenOptions, } from "../thingd.js";
2
- export { ThingD } from "../thingd.js";
4
+ export type ThingDClientOptions = {
5
+ driver?: "memory" | "cloud";
6
+ url?: string;
7
+ authToken?: string;
8
+ apiKey?: string;
9
+ };
10
+ /**
11
+ * Open a thingd connection from a browser/edge-compatible environment.
12
+ *
13
+ * Unlike ThingD.open() from the main entry point, this does NOT read from
14
+ * process.env — all configuration must be passed explicitly.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const db = await openThingD({ url: "http://localhost:8757" });
19
+ * await db.put("notes", { id: "1", text: "hello" });
20
+ * ```
21
+ */
22
+ export declare function openThingD(options?: ThingDClientOptions): Promise<HttpThingStore | InMemoryThingStore>;
23
+ export { HttpThingStore, InMemoryThingStore };
3
24
  //# sourceMappingURL=thingd.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"thingd.d.ts","sourceRoot":"","sources":["../../src/client/thingd.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"thingd.d.ts","sourceRoot":"","sources":["../../src/client/thingd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAMF;;;;;;;;;;;GAWG;AACH,wBAAsB,UAAU,CAC9B,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,cAAc,GAAG,kBAAkB,CAAC,CAS9C;AAED,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC"}
@@ -1 +1,27 @@
1
- export { ThingD } from "../thingd.js";
1
+ import { HttpThingStore } from "./http-thing-store.js";
2
+ import { InMemoryThingStore } from "./in-memory-thing-store.js";
3
+ function resolveToken(options) {
4
+ return options.authToken ?? options.apiKey;
5
+ }
6
+ /**
7
+ * Open a thingd connection from a browser/edge-compatible environment.
8
+ *
9
+ * Unlike ThingD.open() from the main entry point, this does NOT read from
10
+ * process.env — all configuration must be passed explicitly.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const db = await openThingD({ url: "http://localhost:8757" });
15
+ * await db.put("notes", { id: "1", text: "hello" });
16
+ * ```
17
+ */
18
+ export async function openThingD(options = {}) {
19
+ if (options.driver === "memory" || !options.url) {
20
+ return new InMemoryThingStore();
21
+ }
22
+ return HttpThingStore.open({
23
+ url: options.url,
24
+ authToken: resolveToken(options),
25
+ });
26
+ }
27
+ export { HttpThingStore, InMemoryThingStore };
@@ -1,3 +1,7 @@
1
- export { InMemoryThingStore } from "../stores/in-memory-thing-store.js";
2
- export { ThingD } from "../thingd.js";
1
+ export { InMemoryThingStore } from "../client/in-memory-thing-store.js";
2
+ /**
3
+ * Open a pure in-memory thingd connection.
4
+ * Browser-safe — no Node.js dependencies.
5
+ */
6
+ export declare const openMemoryThingD: () => Promise<import("../client/http-thing-store.js").HttpThingStore | import("../client/in-memory-thing-store.js").InMemoryThingStore>;
3
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/memory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/memory/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,gBAAgB,yIAAyC,CAAC"}
@@ -1,2 +1,7 @@
1
- export { InMemoryThingStore } from "../stores/in-memory-thing-store.js";
2
- export { ThingD } from "../thingd.js";
1
+ import { openThingD } from "../client/thingd.js";
2
+ export { InMemoryThingStore } from "../client/in-memory-thing-store.js";
3
+ /**
4
+ * Open a pure in-memory thingd connection.
5
+ * Browser-safe — no Node.js dependencies.
6
+ */
7
+ export const openMemoryThingD = () => openThingD({ driver: "memory" });
@@ -253,7 +253,7 @@ async function loadNativeModule() {
253
253
  catch {
254
254
  // fallback resolution failed
255
255
  }
256
- throw new Error(`The native thingd driver is not available. Run "pnpm --filter thingd-native build" before using driver: "native". ${formatUnknownError(importError)}`);
256
+ throw new Error(`The native thingd driver is not available. Install @thingd/native with "npm install @thingd/native" or set THINGD_NATIVE_PATH. For monorepo development: "pnpm --filter thingd-native build". ${formatUnknownError(importError)}`);
257
257
  }
258
258
  }
259
259
  function objectFromNative(record) {
package/dist/thingd.js CHANGED
@@ -1,4 +1,4 @@
1
- import { CloudThingStore } from "./stores/cloud-thing-store.js";
1
+ import { HttpThingStore } from "./client/http-thing-store.js";
2
2
  import { InMemoryThingStore } from "./stores/in-memory-thing-store.js";
3
3
  import { NativeThingStore } from "./stores/native-thing-store.js";
4
4
  export class ThingD {
@@ -190,7 +190,7 @@ async function openStore(path, options) {
190
190
  return options.store;
191
191
  }
192
192
  if (options.driver === "cloud") {
193
- return CloudThingStore.open({
193
+ return HttpThingStore.open({
194
194
  url: path,
195
195
  authToken: options.authToken,
196
196
  });
@@ -198,7 +198,7 @@ async function openStore(path, options) {
198
198
  const hasNative = await NativeThingStore.isAvailable();
199
199
  if (options.driver === "native") {
200
200
  if (!hasNative) {
201
- throw new Error(`The native thingd driver is not available. Run "pnpm --filter thingd-native build" before using driver: "native".`);
201
+ throw new Error(`The native thingd driver is not available. Install @thingd/native with "npm install @thingd/native". For monorepo development: "pnpm --filter thingd-native build".`);
202
202
  }
203
203
  return NativeThingStore.open(path);
204
204
  }
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.49.0";
5
+ export declare const SDK_VERSION = "0.49.2";
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.49.0";
5
+ export const SDK_VERSION = "0.49.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thingd/sdk",
3
- "version": "0.49.1",
3
+ "version": "0.49.3",
4
4
  "description": "A fast object-first data engine for applications and AI agents.",
5
5
  "type": "module",
6
6
  "author": "Sayan Mohsin",
@@ -56,6 +56,11 @@
56
56
  "types": "./dist/types/index.d.ts",
57
57
  "import": "./dist/types/index.js",
58
58
  "require": "./dist/types/index.js"
59
+ },
60
+ "./browser": {
61
+ "types": "./dist/client/index.d.ts",
62
+ "import": "./dist/client/index.js",
63
+ "require": "./dist/client/index.js"
59
64
  }
60
65
  },
61
66
  "files": [
@@ -67,7 +72,7 @@
67
72
  "zod": "^4.4.3"
68
73
  },
69
74
  "optionalDependencies": {
70
- "@thingd/native": "0.49.1"
75
+ "@thingd/native": "0.49.3"
71
76
  },
72
77
  "engines": {
73
78
  "node": ">=24.0.0"