Skip to content

Commit 41907db

Browse files
committed
bump js-client to 0.19.0-dev.7 and adapt code accordingly
1 parent b1e5475 commit 41907db

File tree

16 files changed

+309
-254
lines changed

16 files changed

+309
-254
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
77
### Added
88
### Removed
99
### Changed
10+
- Update to `@holochain/[email protected]` and update types accordingly.
1011
### Fixed
1112

1213
## 2025-02-12: v0.18.0-dev.4

docs/tryorama.trycpconductor.adminws.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ adminWs(): {
3232
listApps: (request: ListAppsRequest) => Promise<import("@holochain/client").ListAppsResponse>;
3333
listCellIds: () => Promise<import("@holochain/client").ListCellIdsResponse>;
3434
listDnas: () => Promise<import("@holochain/client").ListDnasResponse>;
35-
registerDna: (request: RegisterDnaRequest & DnaSource) => Promise<DnaHash>;
35+
registerDna: (request: RegisterDnaRequest) => Promise<DnaHash>;
3636
revokeAgentKey: (data: RevokeAgentKeyRequest) => Promise<import("@holochain/client").RevokeAgentKeyResponse>;
3737
startApp: (request: StartAppRequest) => Promise<boolean>;
3838
storageInfo: (request: StorageInfoRequest) => Promise<import("@holochain/client").StorageInfo>;
@@ -43,7 +43,7 @@ adminWs(): {
4343
```
4444
**Returns:**
4545

46-
{ addAgentInfo: (request: AddAgentInfoRequest) =&gt; Promise&lt;void&gt;; agentInfo: (req: AgentInfoRequest) =&gt; Promise&lt;import("@holochain/client").AgentInfoResponse&gt;; attachAppInterface: (request?: AttachAppInterfaceRequest) =&gt; Promise&lt;{ port: number; }&gt;; authorizeSigningCredentials: (cellId: CellId, functions?: GrantedFunctions) =&gt; Promise&lt;void&gt;; deleteCloneCell: (request: DeleteCloneCellRequest) =&gt; Promise&lt;void&gt;; disableApp: (request: DisableAppRequest) =&gt; Promise&lt;null&gt;; dumpFullState: (request: DumpFullStateRequest) =&gt; Promise&lt;FullStateDump&gt;; dumpNetworkStats: (request: DumpNetworkStatsRequest) =&gt; Promise&lt;string&gt;; dumpState: (request: DumpStateRequest) =&gt; Promise&lt;\[FullStateDump, string\]&gt;; enableApp: (request: EnableAppRequest) =&gt; Promise&lt;import("@holochain/client").EnableAppResponse&gt;; generateAgentPubKey: () =&gt; Promise&lt;AgentPubKey&gt;; getCompatibleCells: (dnaHash: GetCompatibleCellsRequest) =&gt; Promise&lt;GetCompatibleCellsResponse&gt;; getDnaDefinition: (dnaHash: GetDnaDefinitionRequest) =&gt; Promise&lt;DnaDefinition&gt;; grantSigningKey: (cellId: CellId, functions: GrantedFunctions, signingKey: AgentPubKey) =&gt; Promise&lt;CapSecret&gt;; grantZomeCallCapability: (request: GrantZomeCallCapabilityRequest) =&gt; Promise&lt;void&gt;; installApp: (data: InstallAppRequest) =&gt; Promise&lt;import("@holochain/client").AppInfo&gt;; listAppInterfaces: () =&gt; Promise&lt;import("@holochain/client").ListAppInterfacesResponse&gt;; listApps: (request: ListAppsRequest) =&gt; Promise&lt;import("@holochain/client").ListAppsResponse&gt;; listCellIds: () =&gt; Promise&lt;import("@holochain/client").ListCellIdsResponse&gt;; listDnas: () =&gt; Promise&lt;import("@holochain/client").ListDnasResponse&gt;; registerDna: (request: RegisterDnaRequest &amp; DnaSource) =&gt; Promise&lt;DnaHash&gt;; revokeAgentKey: (data: RevokeAgentKeyRequest) =&gt; Promise&lt;import("@holochain/client").RevokeAgentKeyResponse&gt;; startApp: (request: StartAppRequest) =&gt; Promise&lt;boolean&gt;; storageInfo: (request: StorageInfoRequest) =&gt; Promise&lt;import("@holochain/client").StorageInfo&gt;; uninstallApp: (request: UninstallAppRequest) =&gt; Promise&lt;null&gt;; updateCoordinators: (request: UpdateCoordinatorsRequest) =&gt; Promise&lt;void&gt;; issueAppAuthenticationToken: (request: IssueAppAuthenticationTokenRequest) =&gt; Promise&lt;import("@holochain/client").IssueAppAuthenticationTokenResponse&gt;; }
46+
{ addAgentInfo: (request: AddAgentInfoRequest) =&gt; Promise&lt;void&gt;; agentInfo: (req: AgentInfoRequest) =&gt; Promise&lt;import("@holochain/client").AgentInfoResponse&gt;; attachAppInterface: (request?: AttachAppInterfaceRequest) =&gt; Promise&lt;{ port: number; }&gt;; authorizeSigningCredentials: (cellId: CellId, functions?: GrantedFunctions) =&gt; Promise&lt;void&gt;; deleteCloneCell: (request: DeleteCloneCellRequest) =&gt; Promise&lt;void&gt;; disableApp: (request: DisableAppRequest) =&gt; Promise&lt;null&gt;; dumpFullState: (request: DumpFullStateRequest) =&gt; Promise&lt;FullStateDump&gt;; dumpNetworkStats: (request: DumpNetworkStatsRequest) =&gt; Promise&lt;string&gt;; dumpState: (request: DumpStateRequest) =&gt; Promise&lt;\[FullStateDump, string\]&gt;; enableApp: (request: EnableAppRequest) =&gt; Promise&lt;import("@holochain/client").EnableAppResponse&gt;; generateAgentPubKey: () =&gt; Promise&lt;AgentPubKey&gt;; getCompatibleCells: (dnaHash: GetCompatibleCellsRequest) =&gt; Promise&lt;GetCompatibleCellsResponse&gt;; getDnaDefinition: (dnaHash: GetDnaDefinitionRequest) =&gt; Promise&lt;DnaDefinition&gt;; grantSigningKey: (cellId: CellId, functions: GrantedFunctions, signingKey: AgentPubKey) =&gt; Promise&lt;CapSecret&gt;; grantZomeCallCapability: (request: GrantZomeCallCapabilityRequest) =&gt; Promise&lt;void&gt;; installApp: (data: InstallAppRequest) =&gt; Promise&lt;import("@holochain/client").AppInfo&gt;; listAppInterfaces: () =&gt; Promise&lt;import("@holochain/client").ListAppInterfacesResponse&gt;; listApps: (request: ListAppsRequest) =&gt; Promise&lt;import("@holochain/client").ListAppsResponse&gt;; listCellIds: () =&gt; Promise&lt;import("@holochain/client").ListCellIdsResponse&gt;; listDnas: () =&gt; Promise&lt;import("@holochain/client").ListDnasResponse&gt;; registerDna: (request: RegisterDnaRequest) =&gt; Promise&lt;DnaHash&gt;; revokeAgentKey: (data: RevokeAgentKeyRequest) =&gt; Promise&lt;import("@holochain/client").RevokeAgentKeyResponse&gt;; startApp: (request: StartAppRequest) =&gt; Promise&lt;boolean&gt;; storageInfo: (request: StorageInfoRequest) =&gt; Promise&lt;import("@holochain/client").StorageInfo&gt;; uninstallApp: (request: UninstallAppRequest) =&gt; Promise&lt;null&gt;; updateCoordinators: (request: UpdateCoordinatorsRequest) =&gt; Promise&lt;void&gt;; issueAppAuthenticationToken: (request: IssueAppAuthenticationTokenRequest) =&gt; Promise&lt;import("@holochain/client").IssueAppAuthenticationTokenResponse&gt;; }
4747

4848
The Admin API web socket.
4949

flake.lock

Lines changed: 23 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
11
{
2-
inputs = {
2+
inputs = {
33
holonix = {
44
url = "github:holochain/holonix?ref=main";
5-
inputs.crane.follows = "crane";
6-
inputs.rust-overlay.follows = "rust-overlay";
75
};
86

97
nixpkgs.follows = "holonix/nixpkgs";
108

9+
1110
# lib to build a nix package from a rust crate
12-
crane = {
13-
url = "github:ipetkov/crane";
14-
};
11+
crane.follows = "holonix/crane";
1512

1613
# Rust toolchain
17-
rust-overlay = {
18-
url = "github:oxalica/rust-overlay";
19-
inputs.nixpkgs.follows = "holonix/nixpkgs";
20-
};
14+
rust-overlay.follows = "holonix/rust-overlay";
2115
};
2216

2317
outputs = inputs@{ nixpkgs, holonix, crane, rust-overlay, ... }:

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"prepublishOnly": "npm run build"
4444
},
4545
"dependencies": {
46-
"@holochain/client": "^0.19.0-dev.6",
46+
"@holochain/client": "^0.19.0-dev.7",
4747
"get-port": "^6.1.2",
4848
"lodash": "^4.17.21",
4949
"uuid": "^8.3.2",

ts/src/common.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,20 +143,14 @@ export const enableAndGetAgentApp = async (
143143
const namedCells = new Map<RoleName, CallableCell>();
144144
Object.keys(appInfo.cell_info).forEach((role_name) => {
145145
appInfo.cell_info[role_name].forEach((cellInfo) => {
146-
if (CellType.Provisioned in cellInfo) {
147-
const callableCell = getCallableCell(
148-
appWs,
149-
cellInfo[CellType.Provisioned]
150-
);
146+
if (cellInfo.type === CellType.Provisioned) {
147+
const callableCell = getCallableCell(appWs, cellInfo.value);
151148
cells.push(callableCell);
152149
namedCells.set(role_name, callableCell);
153-
} else if (
154-
CellType.Cloned in cellInfo &&
155-
cellInfo[CellType.Cloned].clone_id
156-
) {
157-
const callableCell = getCallableCell(appWs, cellInfo[CellType.Cloned]);
150+
} else if (cellInfo.type === CellType.Cloned && cellInfo.value.clone_id) {
151+
const callableCell = getCallableCell(appWs, cellInfo.value);
158152
cells.push(callableCell);
159-
namedCells.set(cellInfo[CellType.Cloned].clone_id, callableCell);
153+
namedCells.set(cellInfo.value.clone_id, callableCell);
160154
} else {
161155
throw new Error("Stem cells are not implemented");
162156
}

ts/src/local/conductor.ts

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -378,22 +378,13 @@ export class Conductor implements IConductor {
378378
const installed_app_id = options?.installedAppId ?? `app-${uuidv4()}`;
379379
const roles_settings = options?.rolesSettings;
380380
const network_seed = options?.networkSeed;
381-
const installAppRequest: InstallAppRequest =
382-
"bundle" in appBundleSource
383-
? {
384-
bundle: appBundleSource.bundle,
385-
agent_key,
386-
roles_settings,
387-
installed_app_id,
388-
network_seed,
389-
}
390-
: {
391-
path: appBundleSource.path,
392-
agent_key,
393-
roles_settings,
394-
installed_app_id,
395-
network_seed,
396-
};
381+
const installAppRequest: InstallAppRequest = {
382+
source: appBundleSource,
383+
agent_key,
384+
roles_settings,
385+
installed_app_id,
386+
network_seed,
387+
};
397388
logger.debug(
398389
`installing app with id ${installed_app_id} for agent ${encodeHashToBase64(
399390
agent_key

ts/src/trycp/conductor/conductor.ts

Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
DisableCloneCellRequest,
1616
DnaDefinition,
1717
DnaHash,
18-
DnaSource,
1918
DumpFullStateRequest,
2019
DumpNetworkStatsRequest,
2120
DumpStateRequest,
@@ -29,7 +28,6 @@ import {
2928
GetDnaDefinitionRequest,
3029
getSigningCredentials,
3130
GrantedFunctions,
32-
GrantedFunctionsType,
3331
GrantZomeCallCapabilityRequest,
3432
InstallAppRequest,
3533
IssueAppAuthenticationTokenRequest,
@@ -412,7 +410,7 @@ export class TryCpConductor implements IConductor {
412410
* @returns The registered DNA's {@link HoloHash}.
413411
*/
414412
const registerDna = async (
415-
request: RegisterDnaRequest & DnaSource
413+
request: RegisterDnaRequest
416414
): Promise<DnaHash> => {
417415
const response = await this.callAdminApi({
418416
type: "register_dna",
@@ -800,7 +798,8 @@ export class TryCpConductor implements IConductor {
800798
tag: "zome-call-signing-key",
801799
functions,
802800
access: {
803-
Assigned: {
801+
type: "assigned",
802+
value: {
804803
secret: capSecret,
805804
assignees: [signingKey],
806805
},
@@ -823,7 +822,7 @@ export class TryCpConductor implements IConductor {
823822
const [keyPair, signingKey] = await generateSigningKeyPair();
824823
const capSecret = await grantSigningKey(
825824
cellId,
826-
functions || GrantedFunctionsType.All,
825+
functions || { type: "all" },
827826
signingKey
828827
);
829828
setSigningCredentials(cellId, { capSecret, keyPair, signingKey });
@@ -1039,22 +1038,13 @@ export class TryCpConductor implements IConductor {
10391038
const roles_settings = options?.rolesSettings;
10401039
const installed_app_id = options?.installedAppId ?? `app-${uuidv4()}`;
10411040
const network_seed = options?.networkSeed;
1042-
const installAppRequest: InstallAppRequest =
1043-
"bundle" in appBundleSource
1044-
? {
1045-
bundle: appBundleSource.bundle,
1046-
agent_key,
1047-
roles_settings,
1048-
installed_app_id,
1049-
network_seed,
1050-
}
1051-
: {
1052-
path: appBundleSource.path,
1053-
agent_key,
1054-
roles_settings,
1055-
installed_app_id,
1056-
network_seed,
1057-
};
1041+
const installAppRequest: InstallAppRequest = {
1042+
source: appBundleSource,
1043+
agent_key,
1044+
roles_settings,
1045+
installed_app_id,
1046+
network_seed,
1047+
};
10581048
return this.adminWs().installApp(installAppRequest);
10591049
}
10601050

@@ -1073,22 +1063,13 @@ export class TryCpConductor implements IConductor {
10731063
const roles_settings = appForAgent.rolesSettings;
10741064
const installed_app_id = options.installedAppId ?? `app-${uuidv4()}`;
10751065
const network_seed = options.networkSeed;
1076-
const installAppRequest: InstallAppRequest =
1077-
"bundle" in appForAgent.app
1078-
? {
1079-
bundle: appForAgent.app.bundle,
1080-
agent_key,
1081-
roles_settings,
1082-
installed_app_id,
1083-
network_seed,
1084-
}
1085-
: {
1086-
path: appForAgent.app.path,
1087-
agent_key,
1088-
roles_settings,
1089-
installed_app_id,
1090-
network_seed,
1091-
};
1066+
const installAppRequest: InstallAppRequest = {
1067+
source: appForAgent.app,
1068+
agent_key,
1069+
roles_settings,
1070+
installed_app_id,
1071+
network_seed,
1072+
};
10921073

10931074
logger.debug(
10941075
`installing app with id ${installed_app_id} for agent ${encodeHashToBase64(

ts/src/trycp/trycp-client.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { SignalCb, CallZomeRequestSigned } from "@holochain/client";
1+
import { SignalCb } from "@holochain/client";
22
import msgpack from "@msgpack/msgpack";
3-
import cloneDeep from "lodash/cloneDeep.js";
43
import assert from "node:assert";
54
import { URL } from "node:url";
65
import { WebSocket } from "ws";

0 commit comments

Comments
 (0)