@holochain/client 0.16.0 → 0.16.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 +9 -19
- package/lib/api/admin/types.d.ts +21 -0
- package/lib/api/app-agent/websocket.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ npm install --save-exact @holochain/client
|
|
|
30
30
|
|
|
31
31
|
### Use AppAgentWebsocket with implicit zome call signing
|
|
32
32
|
```typescript
|
|
33
|
-
import { AdminWebsocket, AppAgentWebsocket, CellType } from "@holochain/client";
|
|
33
|
+
import { ActionHash, AdminWebsocket, AppAgentWebsocket, CellType } from "@holochain/client";
|
|
34
34
|
|
|
35
35
|
const adminWs = await AdminWebsocket.connect("ws://127.0.0.1:65000");
|
|
36
36
|
const agent_key = await adminWs.generateAgentPubKey();
|
|
@@ -54,25 +54,15 @@ const appAgentWs = await AppAgentWebsocket.connect(
|
|
|
54
54
|
installed_app_id
|
|
55
55
|
);
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
appAgentWs.on("signal", signalCb);
|
|
57
|
+
const zomeCallPayload: CallZomeRequest = {
|
|
58
|
+
cell_id,
|
|
59
|
+
zome_name: "zome_name",
|
|
60
|
+
fn_name: "create_entry",
|
|
61
|
+
provenance: agent_key,
|
|
62
|
+
payload: "some_content",
|
|
63
|
+
};
|
|
67
64
|
|
|
68
|
-
|
|
69
|
-
await appAgentWs.callZome({
|
|
70
|
-
role_name,
|
|
71
|
-
zome_name: "zome",
|
|
72
|
-
fn_name: "emitter",
|
|
73
|
-
payload: null,
|
|
74
|
-
});
|
|
75
|
-
await signalReceived;
|
|
65
|
+
const response: ActionHash = await appAgentWs.callZome(zomeCallPayload, 30000);
|
|
76
66
|
|
|
77
67
|
await appAgentWs.appWebsocket.client.close();
|
|
78
68
|
await adminWs.client.close();
|
package/lib/api/admin/types.d.ts
CHANGED
|
@@ -382,12 +382,33 @@ export type NetworkSeed = string;
|
|
|
382
382
|
* @public
|
|
383
383
|
*/
|
|
384
384
|
export type InstallAppRequest = {
|
|
385
|
+
/**
|
|
386
|
+
* The agent to use when creating Cells for this App.
|
|
387
|
+
*/
|
|
385
388
|
agent_key: AgentPubKey;
|
|
389
|
+
/**
|
|
390
|
+
* The unique identifier for an installed app in this conductor.
|
|
391
|
+
* If not specified, it will be derived from the app name in the bundle manifest.
|
|
392
|
+
*/
|
|
386
393
|
installed_app_id?: InstalledAppId;
|
|
394
|
+
/**
|
|
395
|
+
* Include proof-of-membrane-membership data for cells that require it,
|
|
396
|
+
* keyed by the CellNick specified in the app bundle manifest.
|
|
397
|
+
*/
|
|
387
398
|
membrane_proofs: {
|
|
388
399
|
[key: string]: MembraneProof;
|
|
389
400
|
};
|
|
401
|
+
/**
|
|
402
|
+
* Optional global network seed override. If set will override the network seed value for all
|
|
403
|
+
* DNAs in the bundle.
|
|
404
|
+
*/
|
|
390
405
|
network_seed?: NetworkSeed;
|
|
406
|
+
/**
|
|
407
|
+
* Optional: If app installation fails due to genesis failure, normally the app will be immediately uninstalled.
|
|
408
|
+
* When this flag is set, the app is left installed with empty cells intact. This can be useful for
|
|
409
|
+
* using graft_records_onto_source_chain, or for diagnostics.
|
|
410
|
+
*/
|
|
411
|
+
ignore_genesis_failure?: boolean;
|
|
391
412
|
} & AppBundleSource;
|
|
392
413
|
/**
|
|
393
414
|
* @public
|
|
@@ -23,8 +23,9 @@ export class AppAgentWebsocket {
|
|
|
23
23
|
// Please retain until the upstream is fixed https://github.com/sindresorhus/emittery/issues/86.
|
|
24
24
|
Object.getOwnPropertyNames(Emittery.prototype).forEach((name) => {
|
|
25
25
|
const to_bind = this.emitter[name];
|
|
26
|
-
if (typeof to_bind ===
|
|
27
|
-
this.emitter[name] =
|
|
26
|
+
if (typeof to_bind === "function") {
|
|
27
|
+
this.emitter[name] =
|
|
28
|
+
to_bind.bind(this.emitter);
|
|
28
29
|
}
|
|
29
30
|
});
|
|
30
31
|
const env = getLauncherEnvironment();
|
package/package.json
CHANGED