@holochain/client 0.11.14 → 0.11.15
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
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
A JavaScript client for the Holochain Conductor API (works with browsers as well as Nodejs).
|
|
10
10
|
|
|
11
|
+
## API Reference
|
|
12
|
+
|
|
11
13
|
[Complete API reference](./docs/client.md)
|
|
12
14
|
|
|
13
15
|
## Installation
|
|
@@ -21,12 +23,6 @@ npm install --save-exact @holochain/client
|
|
|
21
23
|
|
|
22
24
|
## Sample usage
|
|
23
25
|
|
|
24
|
-
### Use AdminWebsocket
|
|
25
|
-
```typescript
|
|
26
|
-
const admin = await AdminWebsocket.connect(`ws://127.0.0.1:8000`, TIMEOUT)
|
|
27
|
-
const agentPubKey = await admin.generateAgentPubKey()
|
|
28
|
-
```
|
|
29
|
-
|
|
30
26
|
### Use AppAgentWebsocket with implicit zome call signing
|
|
31
27
|
```typescript
|
|
32
28
|
const signalCb = (signal: AppSignal) => {
|
|
@@ -100,17 +96,12 @@ setSigningCredentials(cell_id, signingCredentials);
|
|
|
100
96
|
localStorage.setItem(cellIdB64, JSON.stringify(signingCredentials));
|
|
101
97
|
```
|
|
102
98
|
|
|
103
|
-
## API Reference
|
|
104
|
-
|
|
105
|
-
See [docs/API.md](docs/API.md)
|
|
106
|
-
|
|
107
|
-
|
|
108
99
|
# Holochain Compatibility
|
|
109
100
|
|
|
110
101
|
See [default.nix](./default.nix) for the Holochain version this package is compatible with.
|
|
111
102
|
|
|
112
103
|
If updating the Holochain version included in holonix, please use `niv update` as explained in the
|
|
113
|
-
[Holochain Installation Guide](https://developer.holochain.org/install/#upgrading-the-holochain-version).
|
|
104
|
+
[Holochain Installation Guide](https://developer.holochain.org/install-advanced/#upgrading-the-holochain-version).
|
|
114
105
|
|
|
115
106
|
## Running tests
|
|
116
107
|
|
package/lib/api/admin/types.d.ts
CHANGED
|
@@ -81,9 +81,18 @@ export interface StemCell {
|
|
|
81
81
|
/**
|
|
82
82
|
* @public
|
|
83
83
|
*/
|
|
84
|
-
export interface
|
|
84
|
+
export interface ProvisionedCell {
|
|
85
85
|
cell_id: CellId;
|
|
86
|
-
|
|
86
|
+
dna_modifiers: DnaModifiers;
|
|
87
|
+
name: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* @public
|
|
91
|
+
*/
|
|
92
|
+
export interface ClonedCell {
|
|
93
|
+
cell_id: CellId;
|
|
94
|
+
clone_id: RoleName;
|
|
95
|
+
original_dna_hash: DnaHash;
|
|
87
96
|
dna_modifiers: DnaModifiers;
|
|
88
97
|
name: string;
|
|
89
98
|
enabled: boolean;
|
|
@@ -92,17 +101,17 @@ export interface Cell {
|
|
|
92
101
|
* @public
|
|
93
102
|
*/
|
|
94
103
|
export declare enum CellType {
|
|
95
|
-
Provisioned = "
|
|
96
|
-
Cloned = "
|
|
97
|
-
Stem = "
|
|
104
|
+
Provisioned = "provisioned",
|
|
105
|
+
Cloned = "cloned",
|
|
106
|
+
Stem = "stem"
|
|
98
107
|
}
|
|
99
108
|
/**
|
|
100
109
|
* @public
|
|
101
110
|
*/
|
|
102
111
|
export declare type CellInfo = {
|
|
103
|
-
[CellType.Provisioned]:
|
|
112
|
+
[CellType.Provisioned]: ProvisionedCell;
|
|
104
113
|
} | {
|
|
105
|
-
[CellType.Cloned]:
|
|
114
|
+
[CellType.Cloned]: ClonedCell;
|
|
106
115
|
} | {
|
|
107
116
|
[CellType.Stem]: StemCell;
|
|
108
117
|
};
|
|
@@ -110,6 +119,7 @@ export declare type CellInfo = {
|
|
|
110
119
|
* @public
|
|
111
120
|
*/
|
|
112
121
|
export declare type AppInfo = {
|
|
122
|
+
agent_pub_key: AgentPubKey;
|
|
113
123
|
installed_app_id: InstalledAppId;
|
|
114
124
|
cell_info: Record<RoleName, Array<CellInfo>>;
|
|
115
125
|
status: InstalledAppInfoStatus;
|
|
@@ -245,7 +255,7 @@ export declare type UninstallAppResponse = null;
|
|
|
245
255
|
/**
|
|
246
256
|
* @public
|
|
247
257
|
*/
|
|
248
|
-
export declare type ResourceBytes =
|
|
258
|
+
export declare type ResourceBytes = Uint8Array;
|
|
249
259
|
/**
|
|
250
260
|
* @public
|
|
251
261
|
*/
|
|
@@ -621,7 +631,6 @@ export interface AdminApi {
|
|
|
621
631
|
attachAppInterface: Requester<AttachAppInterfaceRequest, AttachAppInterfaceResponse>;
|
|
622
632
|
enableApp: Requester<EnableAppRequest, EnableAppResponse>;
|
|
623
633
|
disableApp: Requester<DisableAppRequest, DisableAppResponse>;
|
|
624
|
-
startApp: Requester<StartAppRequest, StartAppResponse>;
|
|
625
634
|
dumpState: Requester<DumpStateRequest, DumpStateResponse>;
|
|
626
635
|
dumpFullState: Requester<DumpFullStateRequest, DumpFullStateResponse>;
|
|
627
636
|
generateAgentPubKey: Requester<GenerateAgentPubKeyRequest, GenerateAgentPubKeyResponse>;
|
package/lib/api/admin/types.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export var CellType;
|
|
5
5
|
(function (CellType) {
|
|
6
|
-
CellType["Provisioned"] = "
|
|
7
|
-
CellType["Cloned"] = "
|
|
8
|
-
CellType["Stem"] = "
|
|
6
|
+
CellType["Provisioned"] = "provisioned";
|
|
7
|
+
CellType["Cloned"] = "cloned";
|
|
8
|
+
CellType["Stem"] = "stem";
|
|
9
9
|
})(CellType || (CellType = {}));
|
|
10
10
|
/**
|
|
11
11
|
* @public
|
|
@@ -2,7 +2,7 @@ import { CapSecret, GrantedFunctions } from "../../hdk/capabilities.js";
|
|
|
2
2
|
import type { AgentPubKey, CellId } from "../../types.js";
|
|
3
3
|
import { WsClient } from "../client.js";
|
|
4
4
|
import { Requester, Transformer } from "../common.js";
|
|
5
|
-
import { AddAgentInfoRequest, AddAgentInfoResponse, AdminApi, AgentInfoRequest, AgentInfoResponse, AttachAppInterfaceRequest, AttachAppInterfaceResponse, DeleteCloneCellRequest, DeleteCloneCellResponse, DisableAppRequest, DisableAppResponse, DumpFullStateRequest, DumpFullStateResponse, DumpStateRequest, DumpStateResponse, EnableAppRequest, EnableAppResponse, GenerateAgentPubKeyRequest, GenerateAgentPubKeyResponse, GetDnaDefinitionRequest, GetDnaDefinitionResponse, GrantZomeCallCapabilityRequest, GrantZomeCallCapabilityResponse, InstallAppRequest, InstallAppResponse, ListAppInterfacesRequest, ListAppInterfacesResponse, ListAppsRequest, ListAppsResponse, ListCellIdsRequest, ListCellIdsResponse, ListDnasRequest, ListDnasResponse, RegisterDnaRequest, RegisterDnaResponse,
|
|
5
|
+
import { AddAgentInfoRequest, AddAgentInfoResponse, AdminApi, AgentInfoRequest, AgentInfoResponse, AttachAppInterfaceRequest, AttachAppInterfaceResponse, DeleteCloneCellRequest, DeleteCloneCellResponse, DisableAppRequest, DisableAppResponse, DumpFullStateRequest, DumpFullStateResponse, DumpStateRequest, DumpStateResponse, EnableAppRequest, EnableAppResponse, GenerateAgentPubKeyRequest, GenerateAgentPubKeyResponse, GetDnaDefinitionRequest, GetDnaDefinitionResponse, GrantZomeCallCapabilityRequest, GrantZomeCallCapabilityResponse, InstallAppRequest, InstallAppResponse, ListAppInterfacesRequest, ListAppInterfacesResponse, ListAppsRequest, ListAppsResponse, ListCellIdsRequest, ListCellIdsResponse, ListDnasRequest, ListDnasResponse, RegisterDnaRequest, RegisterDnaResponse, UninstallAppRequest, UninstallAppResponse } from "./types.js";
|
|
6
6
|
/**
|
|
7
7
|
* A class for interacting with a conductor's Admin API.
|
|
8
8
|
*
|
|
@@ -39,10 +39,6 @@ export declare class AdminWebsocket implements AdminApi {
|
|
|
39
39
|
* Disable a running app.
|
|
40
40
|
*/
|
|
41
41
|
disableApp: Requester<DisableAppRequest, DisableAppResponse>;
|
|
42
|
-
/**
|
|
43
|
-
* Start an app.
|
|
44
|
-
*/
|
|
45
|
-
startApp: Requester<StartAppRequest, StartAppResponse>;
|
|
46
42
|
/**
|
|
47
43
|
* Dump the state of the specified cell, including its source chain, as JSON.
|
|
48
44
|
*/
|
|
@@ -54,10 +54,6 @@ export class AdminWebsocket {
|
|
|
54
54
|
* Disable a running app.
|
|
55
55
|
*/
|
|
56
56
|
disableApp = this._requester("disable_app");
|
|
57
|
-
/**
|
|
58
|
-
* Start an app.
|
|
59
|
-
*/
|
|
60
|
-
startApp = this._requester("start_app");
|
|
61
57
|
/**
|
|
62
58
|
* Dump the state of the specified cell, including its source chain, as JSON.
|
|
63
59
|
*/
|
package/lib/api/app/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AgentPubKey, CellId, DnaHash, DnaProperties, InstalledAppId,
|
|
2
|
-
import { AppInfo, FunctionName, MembraneProof, NetworkSeed, ZomeName } from "../admin/index.js";
|
|
1
|
+
import { AgentPubKey, CellId, DnaHash, DnaProperties, InstalledAppId, NetworkInfo, RoleName, Timestamp } from "../../types.js";
|
|
2
|
+
import { AppInfo, ClonedCell, FunctionName, MembraneProof, NetworkSeed, ZomeName } from "../admin/index.js";
|
|
3
3
|
import { Requester } from "../common.js";
|
|
4
4
|
/**
|
|
5
5
|
* @public
|
|
@@ -83,7 +83,7 @@ export interface CreateCloneCellRequest {
|
|
|
83
83
|
/**
|
|
84
84
|
* @public
|
|
85
85
|
*/
|
|
86
|
-
export declare type CreateCloneCellResponse =
|
|
86
|
+
export declare type CreateCloneCellResponse = ClonedCell;
|
|
87
87
|
/**
|
|
88
88
|
* @public
|
|
89
89
|
*/
|
|
@@ -9,10 +9,10 @@ function getPubKey(appInfo) {
|
|
|
9
9
|
for (const cells of Object.values(appInfo.cell_info)) {
|
|
10
10
|
for (const cell of cells) {
|
|
11
11
|
if (CellType.Provisioned in cell) {
|
|
12
|
-
return cell.Provisioned.cell_id[1];
|
|
12
|
+
return cell[CellType.Provisioned].cell_id[1];
|
|
13
13
|
}
|
|
14
14
|
else if (CellType.Cloned in cell) {
|
|
15
|
-
return cell.Cloned.cell_id[1];
|
|
15
|
+
return cell[CellType.Cloned].cell_id[1];
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -85,11 +85,11 @@ export class AppAgentWebsocket {
|
|
|
85
85
|
if (!(baseRoleName in appInfo.cell_info)) {
|
|
86
86
|
throw new Error(`No cell found with role_name ${roleName}`);
|
|
87
87
|
}
|
|
88
|
-
const cloneCell = appInfo.cell_info[baseRoleName].find((c) => CellType.Cloned in c && c.Cloned.clone_id === roleName);
|
|
88
|
+
const cloneCell = appInfo.cell_info[baseRoleName].find((c) => CellType.Cloned in c && c[CellType.Cloned].clone_id === roleName);
|
|
89
89
|
if (!cloneCell || !(CellType.Cloned in cloneCell)) {
|
|
90
90
|
throw new Error(`No clone cell found with clone id ${roleName}`);
|
|
91
91
|
}
|
|
92
|
-
return cloneCell.Cloned.cell_id;
|
|
92
|
+
return cloneCell[CellType.Cloned].cell_id;
|
|
93
93
|
}
|
|
94
94
|
if (!(roleName in appInfo.cell_info)) {
|
|
95
95
|
throw new Error(`No cell found with role_name ${roleName}`);
|
package/package.json
CHANGED