@olivia-db/client 0.1.0 → 0.1.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 +40 -0
- package/dist/native.js +1 -1
- package/package.json +3 -2
- package/src/native.ts +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<!-- SPDX-License-Identifier: Apache-2.0 -->
|
|
2
|
+
# @olivia-db/client
|
|
3
|
+
|
|
4
|
+
The TypeScript client of [OliviaDB](https://olivia-db.com/)'s network API: agent memory
|
|
5
|
+
(remember, recall), agent state, layer-1 reads and writes of aggregates, change streams, and
|
|
6
|
+
the native protocol (`@olivia-db/client/native`, Node.js: one connection, many requests,
|
|
7
|
+
rows decoded only when a field is read). A list of node URLs fails over to the primary.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install @olivia-db/client
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Node.js 22.18 or later.
|
|
16
|
+
|
|
17
|
+
## Example
|
|
18
|
+
|
|
19
|
+
A server from the core image (`docker run -d -p 8443:8443 -v oliviadb-data:/data
|
|
20
|
+
ghcr.io/oliviadb/oliviadb`), its API key in `OLIVIADB_API_KEY` and its certificate in
|
|
21
|
+
`NODE_EXTRA_CA_CERTS`:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { OliviaDbClient } from "@olivia-db/client";
|
|
25
|
+
|
|
26
|
+
const db = new OliviaDbClient({ baseUrl: "https://localhost:8443", apiKey: process.env.OLIVIADB_API_KEY });
|
|
27
|
+
await db.remember({ thread: "t1", step_id: "ann-1", text: "Ann works at Acme.",
|
|
28
|
+
facts: [{ entity: "Ann", attr: "employer", value: "Acme" }] });
|
|
29
|
+
console.log((await db.recall({ query: "Where does Ann work?", budget: 300 })).text);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Failures throw `OliviaDbError` (an RFC 9457 problem document); retryable ones are retried as
|
|
33
|
+
the network API defines.
|
|
34
|
+
|
|
35
|
+
## Links
|
|
36
|
+
|
|
37
|
+
* Documentation: <https://docs.olivia-db.com/>
|
|
38
|
+
* Repository: <https://github.com/OliviaDB/oliviadb-js>
|
|
39
|
+
|
|
40
|
+
Licence: Apache-2.0.
|
package/dist/native.js
CHANGED
|
@@ -945,7 +945,7 @@ export class NativeClient {
|
|
|
945
945
|
const hello = [0, 1, 0, 1];
|
|
946
946
|
putVarint(hello, 1);
|
|
947
947
|
putLp(hello, enc.encode("client"));
|
|
948
|
-
putLp(hello, enc.encode("oliviadb-js 0.1.
|
|
948
|
+
putLp(hello, enc.encode("oliviadb-js 0.1.1"));
|
|
949
949
|
const auth = [];
|
|
950
950
|
putLp(auth, enc.encode(scheme));
|
|
951
951
|
putLp(auth, enc.encode(credential));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olivia-db/client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Client for OliviaDB's network API: agent memory and layer-1 reads, and the native protocol (Node.js)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
20
|
"dist",
|
|
21
|
-
"src"
|
|
21
|
+
"src",
|
|
22
|
+
"README.md"
|
|
22
23
|
],
|
|
23
24
|
"repository": {
|
|
24
25
|
"type": "git",
|
package/src/native.ts
CHANGED
|
@@ -1005,7 +1005,7 @@ export class NativeClient {
|
|
|
1005
1005
|
const hello: number[] = [0, 1, 0, 1];
|
|
1006
1006
|
putVarint(hello, 1);
|
|
1007
1007
|
putLp(hello, enc.encode("client"));
|
|
1008
|
-
putLp(hello, enc.encode("oliviadb-js 0.1.
|
|
1008
|
+
putLp(hello, enc.encode("oliviadb-js 0.1.1"));
|
|
1009
1009
|
const auth: number[] = [];
|
|
1010
1010
|
putLp(auth, enc.encode(scheme));
|
|
1011
1011
|
putLp(auth, enc.encode(credential));
|