sqlite-hub-client 0.4.0 → 0.5.0

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.
@@ -1,19 +1,13 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.HttpAdapter = void 0;
7
- const fetch_1 = __importDefault(require("@pingpong-js/fetch"));
1
+ import pingpong from "@pingpong-js/fetch";
8
2
  /**
9
3
  * Adapter that executes SQL via the sqlite-hub HTTP API
10
4
  * (POST /api/db/:name/exec).
11
5
  */
12
- class HttpAdapter {
6
+ export class HttpAdapter {
13
7
  constructor(options) {
14
8
  this.options = options;
15
9
  this.dbPath = `/api/db/${encodeURIComponent(options.db)}/exec`;
16
- this.http = fetch_1.default.create({
10
+ this.http = pingpong.create({
17
11
  baseURL: options.url.replace(/\/$/, ""),
18
12
  timeout: options.timeout ?? 10000,
19
13
  headers: {
@@ -35,4 +29,3 @@ class HttpAdapter {
35
29
  return res.data;
36
30
  }
37
31
  }
38
- exports.HttpAdapter = HttpAdapter;
@@ -1,5 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HttpAdapter = void 0;
4
- var http_js_1 = require("./http.js");
5
- Object.defineProperty(exports, "HttpAdapter", { enumerable: true, get: function () { return http_js_1.HttpAdapter; } });
1
+ export { HttpAdapter } from "./http.js";
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/dist/database.js CHANGED
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Database = void 0;
4
1
  // ── SQL builder helpers ─────────────────────────────────────────────────────
5
2
  function buildWhere(where) {
6
3
  const keys = Object.keys(where);
@@ -24,7 +21,7 @@ function isExecResult(r) {
24
21
  * Accepts any `IAdapter` — currently `HttpAdapter`, extensible to direct
25
22
  * SQLite (via better-sqlite3 or sql.js) without changing business code.
26
23
  */
27
- class Database {
24
+ export class Database {
28
25
  constructor(adapter) {
29
26
  this.adapter = adapter;
30
27
  }
@@ -229,4 +226,3 @@ class Database {
229
226
  return result;
230
227
  }
231
228
  }
232
- exports.Database = Database;
package/dist/index.js CHANGED
@@ -1,14 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HttpAdapter = exports.Database = void 0;
4
- exports.connect = connect;
5
- var database_js_1 = require("./database.js");
6
- Object.defineProperty(exports, "Database", { enumerable: true, get: function () { return database_js_1.Database; } });
7
- var http_js_1 = require("./adapters/http.js");
8
- Object.defineProperty(exports, "HttpAdapter", { enumerable: true, get: function () { return http_js_1.HttpAdapter; } });
1
+ export { Database } from "./database.js";
2
+ export { HttpAdapter } from "./adapters/http.js";
9
3
  // ── Convenience factory ──────────────────────────────────────────────────────
10
- const http_js_2 = require("./adapters/http.js");
11
- const database_js_2 = require("./database.js");
4
+ import { HttpAdapter } from "./adapters/http.js";
5
+ import { Database } from "./database.js";
12
6
  /**
13
7
  * Create a Database connected to a sqlite-hub service over HTTP.
14
8
  *
@@ -19,7 +13,7 @@ const database_js_2 = require("./database.js");
19
13
  * db: "my-service",
20
14
  * });
21
15
  */
22
- function connect(options) {
23
- return new database_js_2.Database(new http_js_2.HttpAdapter(options));
16
+ export function connect(options) {
17
+ return new Database(new HttpAdapter(options));
24
18
  }
25
- exports.default = connect;
19
+ export default connect;
package/package.json CHANGED
@@ -1,9 +1,16 @@
1
1
  {
2
2
  "name": "sqlite-hub-client",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "High-level SQLite client for sqlite-hub — HTTP adapter included, direct SQLite coming soon",
5
+ "type": "module",
5
6
  "main": "dist/index.js",
6
7
  "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
7
14
  "files": ["dist", "README.md"],
8
15
  "scripts": {
9
16
  "build": "tsc"