js-bao 0.2.11 → 0.3.0-alpha.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/README.md CHANGED
@@ -1229,6 +1229,32 @@ const user = new User({ name: "John Doe", email: "john@example.com" });
1229
1229
  await user.save({ targetDocument: "main-doc" });
1230
1230
  ```
1231
1231
 
1232
+ ## Client-Only Import (`js-bao/client`)
1233
+
1234
+ If you only need the HTTP client engine (e.g., for browser apps, React/Vue frontends, or Node.js clients that talk to a DO backend over HTTP), use `js-bao/client` instead of `js-bao/cloudflare`. This avoids pulling in server-side Durable Object code and its dependencies.
1235
+
1236
+ ```typescript
1237
+ import { connectDoDb } from "js-bao/client";
1238
+
1239
+ const db = connectDoDb({
1240
+ endpoint: "https://my-app.workers.dev",
1241
+ id: "my-document",
1242
+ });
1243
+
1244
+ // Save a record (schemaless)
1245
+ await db.engine.saveModel("todos", "todo-1", { title: "Buy milk", done: false });
1246
+
1247
+ // Query records
1248
+ const result = await db.engine.queryModel("todos", { done: false });
1249
+ console.log(result.data);
1250
+ ```
1251
+
1252
+ **When to use `js-bao/client`:** Browser apps, frontend builds, Node.js HTTP clients — any context where you don't need `createDatabaseDO` or `initJsBaoDO` server setup.
1253
+
1254
+ **When to use `js-bao/cloudflare`:** When building the Cloudflare Worker that hosts the Durable Object.
1255
+
1256
+ Key exports: `connectDoDb`, `DOClientEngine`, and types (`DoDb`, `DocumentFilter`, `QueryOptions`, `PaginatedResult`, `AggregationOptions`, etc.). This import has no dependencies on Cloudflare Workers APIs, better-sqlite3, sql.js, or Yjs — it's pure fetch-based HTTP.
1257
+
1232
1258
  ## Database Configuration
1233
1259
 
1234
1260
  ### SQLite (Node.js)
package/dist/browser.cjs CHANGED
@@ -349,7 +349,7 @@ var init_CursorManager = __esm({
349
349
  conditions.push(`(${levelCondition})`);
350
350
  params.push(...fieldParams);
351
351
  }
352
- const sql = conditions.join(" OR ");
352
+ const sql = `(${conditions.join(" OR ")})`;
353
353
  return { sql, params };
354
354
  }
355
355
  /**
package/dist/browser.js CHANGED
@@ -327,7 +327,7 @@ var init_CursorManager = __esm({
327
327
  conditions.push(`(${levelCondition})`);
328
328
  params.push(...fieldParams);
329
329
  }
330
- const sql = conditions.join(" OR ");
330
+ const sql = `(${conditions.join(" OR ")})`;
331
331
  return { sql, params };
332
332
  }
333
333
  /**