sqlite-hub-client 0.3.0 → 0.4.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.
- package/README.md +4 -8
- package/dist/adapters/http.d.ts +3 -3
- package/dist/index.d.ts +1 -10
- package/dist/index.js +1 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,16 +14,12 @@ npm install sqlite-hub-client
|
|
|
14
14
|
```ts
|
|
15
15
|
import { connect } from "sqlite-hub-client";
|
|
16
16
|
|
|
17
|
-
// Using a per-DB service secret (recommended for services)
|
|
18
17
|
const db = connect({
|
|
19
|
-
url:
|
|
20
|
-
token: process.env.SQLITE_HUB_SERVICE_SECRET, // service_secret
|
|
21
|
-
db:
|
|
18
|
+
url: process.env.SQLITE_HUB_URL, // e.g. https://my-app.up.railway.app
|
|
19
|
+
token: process.env.SQLITE_HUB_SERVICE_SECRET, // service_secret from admin Settings
|
|
20
|
+
db: "my-service",
|
|
22
21
|
});
|
|
23
22
|
|
|
24
|
-
// Or use the global admin token (dev / admin tooling)
|
|
25
|
-
// token: process.env.SQLITE_HUB_ADMIN_TOKEN
|
|
26
|
-
|
|
27
23
|
// Create table
|
|
28
24
|
await db.createTable("users", [
|
|
29
25
|
{ name: "id", type: "INTEGER", primaryKey: true, autoIncrement: true },
|
|
@@ -97,7 +93,7 @@ const result = await db.exec("PRAGMA table_info(users)");
|
|
|
97
93
|
| Option | Type | Required | Description |
|
|
98
94
|
| --------- | -------- | -------- | ----------------------------------------------------------------------------------------------- |
|
|
99
95
|
| `url` | `string` | ✅ | Base URL of your sqlite-hub deployment |
|
|
100
|
-
| `token` | `string` | ✅ | Per-DB `service_secret`
|
|
96
|
+
| `token` | `string` | ✅ | Per-DB `service_secret` — generate one in the admin dashboard under Settings → Service secret |
|
|
101
97
|
| `db` | `string` | ✅ | Name of the database to operate on |
|
|
102
98
|
| `timeout` | `number` | ❌ | Request timeout in ms (default: `10000`) |
|
|
103
99
|
|
package/dist/adapters/http.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ export interface HttpAdapterOptions {
|
|
|
3
3
|
/** Base URL of the sqlite-hub deployment, e.g. https://my-app.up.railway.app */
|
|
4
4
|
url: string;
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* Per-DB `service_secret` for this database.
|
|
7
|
+
* Generate one in the sqlite-hub admin dashboard under Settings → Service secret.
|
|
8
|
+
* Sent as `Authorization: Bearer <token>` on every request.
|
|
9
9
|
*/
|
|
10
10
|
token: string;
|
|
11
11
|
/** Name of the database to operate on */
|
package/dist/index.d.ts
CHANGED
|
@@ -9,18 +9,9 @@ import { Database } from "./database.js";
|
|
|
9
9
|
* Create a Database connected to a sqlite-hub service over HTTP.
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
|
-
* // Using a per-DB service secret (recommended for services)
|
|
13
12
|
* const db = connect({
|
|
14
13
|
* url: process.env.SQLITE_HUB_URL,
|
|
15
|
-
* token: process.env.SQLITE_HUB_SERVICE_SECRET,
|
|
16
|
-
* db: "my-service",
|
|
17
|
-
* });
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* // Using the global admin token (dev / admin tooling)
|
|
21
|
-
* const db = connect({
|
|
22
|
-
* url: process.env.SQLITE_HUB_URL,
|
|
23
|
-
* token: process.env.SQLITE_HUB_ADMIN_TOKEN,
|
|
14
|
+
* token: process.env.SQLITE_HUB_SERVICE_SECRET, // service_secret from admin Settings
|
|
24
15
|
* db: "my-service",
|
|
25
16
|
* });
|
|
26
17
|
*/
|
package/dist/index.js
CHANGED
|
@@ -13,18 +13,9 @@ const database_js_2 = require("./database.js");
|
|
|
13
13
|
* Create a Database connected to a sqlite-hub service over HTTP.
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
|
-
* // Using a per-DB service secret (recommended for services)
|
|
17
16
|
* const db = connect({
|
|
18
17
|
* url: process.env.SQLITE_HUB_URL,
|
|
19
|
-
* token: process.env.SQLITE_HUB_SERVICE_SECRET,
|
|
20
|
-
* db: "my-service",
|
|
21
|
-
* });
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* // Using the global admin token (dev / admin tooling)
|
|
25
|
-
* const db = connect({
|
|
26
|
-
* url: process.env.SQLITE_HUB_URL,
|
|
27
|
-
* token: process.env.SQLITE_HUB_ADMIN_TOKEN,
|
|
18
|
+
* token: process.env.SQLITE_HUB_SERVICE_SECRET, // service_secret from admin Settings
|
|
28
19
|
* db: "my-service",
|
|
29
20
|
* });
|
|
30
21
|
*/
|
package/package.json
CHANGED