@holochain/client 0.20.1 → 0.21.0-dev.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 +5 -5
- package/lib/api/admin/types.d.ts +1 -1
- package/lib/api/client.js +2 -2
- package/lib/api/common.js +2 -0
- package/lib/utils/hash-parts.js +3 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
[](http://holochain.org/)
|
|
2
2
|
[](https://discord.gg/k55DS5dmPH)
|
|
3
3
|
[](https://github.com/holochain/cryptographic-autonomy-license)
|
|
4
|
-

|
|
5
|
-

|
|
6
|
-
[](https://
|
|
4
|
+
[](https://github.com/holochain/holochain-client-js/actions/workflows/integration-test.yml)
|
|
5
|
+
[](https://github.com/holochain/holochain-client-js/actions/workflows/bundling-test.yml)
|
|
6
|
+
[](https://x.com/holochain)
|
|
7
7
|
|
|
8
8
|
# Holochain Client - JavaScript
|
|
9
9
|
|
|
@@ -15,12 +15,12 @@ A JavaScript client for the Holochain Conductor API (works with browsers as well
|
|
|
15
15
|
|
|
16
16
|
## Installation
|
|
17
17
|
|
|
18
|
+
**JS client v0.21.x** is compatible with **Holochain v0.7.x**.
|
|
19
|
+
|
|
18
20
|
**JS client v0.20.x** is compatible with **Holochain v0.6.x**.
|
|
19
21
|
|
|
20
22
|
**JS client v0.19.x** is compatible with **Holochain v0.5.x**.
|
|
21
23
|
|
|
22
|
-
**JS client v0.18.x** is compatible with **Holochain v0.4.x**.
|
|
23
|
-
|
|
24
24
|
To install from NPM, run
|
|
25
25
|
```bash
|
|
26
26
|
npm install --save-exact @holochain/client
|
package/lib/api/admin/types.d.ts
CHANGED
package/lib/api/client.js
CHANGED
|
@@ -42,7 +42,7 @@ export class WsClient extends Emittery {
|
|
|
42
42
|
socket.addEventListener("error", (errorEvent) => {
|
|
43
43
|
reject(new HolochainError("ConnectionError", `could not connect to Holochain Conductor API at ${url} - ${errorEvent.error}`));
|
|
44
44
|
});
|
|
45
|
-
socket.addEventListener("open", (
|
|
45
|
+
socket.addEventListener("open", () => {
|
|
46
46
|
const client = new WsClient(socket, url, options);
|
|
47
47
|
resolve(client);
|
|
48
48
|
}, { once: true });
|
|
@@ -216,7 +216,7 @@ export class WsClient extends Emittery {
|
|
|
216
216
|
this.socket.addEventListener("close", invalidTokenCloseListener, {
|
|
217
217
|
once: true,
|
|
218
218
|
});
|
|
219
|
-
this.socket.addEventListener("open", async (
|
|
219
|
+
this.socket.addEventListener("open", async () => {
|
|
220
220
|
const encodedMsg = encode({
|
|
221
221
|
type: "authenticate",
|
|
222
222
|
data: encode({ token }),
|
package/lib/api/common.js
CHANGED
|
@@ -13,6 +13,7 @@ export const requesterTransformer = (requester, tag, transform = identityTransfo
|
|
|
13
13
|
const response = await requester(input, timeout);
|
|
14
14
|
return transform.output(response.value);
|
|
15
15
|
};
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
17
|
const identity = (x) => x;
|
|
17
18
|
const identityTransformer = {
|
|
18
19
|
input: identity,
|
|
@@ -31,6 +32,7 @@ export class HolochainError extends Error {
|
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
// this determines the error format of all error responses
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
36
|
export const catchError = (response) => {
|
|
35
37
|
if (response.type === ERROR_TYPE) {
|
|
36
38
|
const errorName = response.value.type;
|
package/lib/utils/hash-parts.js
CHANGED
|
@@ -145,7 +145,9 @@ export function hashFrom32AndType(hashCore, hashType) {
|
|
|
145
145
|
*
|
|
146
146
|
* @public
|
|
147
147
|
*/
|
|
148
|
-
export function hashFromContentAndType(
|
|
148
|
+
export function hashFromContentAndType(
|
|
149
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
150
|
+
content, hashType) {
|
|
149
151
|
const hashCore = new Uint8Array(32);
|
|
150
152
|
blake2b(hashCore.length).update(encode(content)).digest(hashCore);
|
|
151
153
|
return Uint8Array.from([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holochain/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0-dev.0",
|
|
4
4
|
"description": "A JavaScript client for the Holochain Conductor API",
|
|
5
5
|
"author": "Holochain Foundation <info@holochain.org> (https://holochain.org)",
|
|
6
6
|
"license": "CAL-1.0",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://github.com/holochain/holochain-client-js#readme",
|
|
20
20
|
"engines": {
|
|
21
|
-
"node": ">=
|
|
21
|
+
"node": ">=20.0.0 || >=22.0.0 || >= 24.0.0"
|
|
22
22
|
},
|
|
23
23
|
"main": "lib/index.js",
|
|
24
24
|
"module": "lib/index.js",
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
"test": "RUST_LOG=error RUST_BACKTRACE=1 tsx test/index.ts",
|
|
39
39
|
"build:lib": "rimraf ./lib && tsc -p tsconfig.build.json",
|
|
40
40
|
"build:docs": "api-extractor run --local && api-documenter markdown -i docs/temp -o docs",
|
|
41
|
-
"build": "npm run build:lib && npm run build:docs"
|
|
41
|
+
"build": "npm run build:lib && npm run build:docs",
|
|
42
|
+
"prepublishOnly": "npm run lint && npm run build"
|
|
42
43
|
},
|
|
43
44
|
"dependencies": {
|
|
44
45
|
"@bitgo/blake2b": "^3.2.4",
|