diff --git a/ts/src/local/conductor.ts b/ts/src/local/conductor.ts index 37fce1dd..67bfc5ca 100644 --- a/ts/src/local/conductor.ts +++ b/ts/src/local/conductor.ts @@ -275,10 +275,10 @@ export class Conductor implements IConductor { } private async connectAdminWs() { - this._adminWs = await AdminWebsocket.connect( - this.adminApiUrl, - this.timeout - ); + this._adminWs = await AdminWebsocket.connect({ + url: this.adminApiUrl, + defaultTimeout: this.timeout, + }); logger.debug(`connected to Admin API @ ${this.adminApiUrl.href}\n`); } @@ -307,7 +307,10 @@ export class Conductor implements IConductor { logger.debug(`connecting App WebSocket to port ${port}\n`); const appApiUrl = new URL(this.adminApiUrl.href); appApiUrl.port = port.toString(); - const appWs = await AppWebsocket.connect(appApiUrl, this.timeout); + const appWs = await AppWebsocket.connect({ + url: appApiUrl, + defaultTimeout: this.timeout, + }); // set up automatic zome call signing const callZome = appWs.callZome; @@ -335,11 +338,10 @@ export class Conductor implements IConductor { logger.debug(`connecting App Agent WebSocket to port ${port}\n`); const appApiUrl = new URL(HOST_URL.href); appApiUrl.port = port.toString(); - const appAgentWs = await AppAgentWebsocket.connect( - appApiUrl, - appId, - this.timeout - ); + const appAgentWs = await AppAgentWebsocket.connect(appId, { + url: appApiUrl, + defaultTimeout: this.timeout, + }); // set up automatic zome call signing const callZome = appAgentWs.callZome.bind(appAgentWs); diff --git a/ts/src/trycp/conductor/conductor.ts b/ts/src/trycp/conductor/conductor.ts index 4fb56f2a..b54f8eed 100644 --- a/ts/src/trycp/conductor/conductor.ts +++ b/ts/src/trycp/conductor/conductor.ts @@ -33,6 +33,7 @@ import { GrantedFunctions, GrantedFunctionsType, GrantZomeCallCapabilityRequest, + HolochainError, InstallAppRequest, InstalledAppId, ListAppsRequest, @@ -959,12 +960,24 @@ export class TryCpConductor implements IConductor { const appInfo = appWs.appInfo.bind(appWs); appWs.appInfo = async () => { const currentAppInfo = await appInfo({ installed_app_id: appId }); + if (!currentAppInfo) { + throw new HolochainError( + "AppNotFound", + `App info not found for the provided id "${appId}". App needs to be installed and enabled.` + ); + } cachedAppInfo = currentAppInfo; return currentAppInfo; }; const callZome = appWs.callZome.bind(appWs); appWs.callZome = async (request: AppAgentCallZomeRequest) => { + if (!cachedAppInfo) { + throw new HolochainError( + "AppNotFound", + `App info not found for the provided id "${appId}". App needs to be installed and enabled.` + ); + } if ("role_name" in request && request.role_name) { const cell_id = this.getCellIdFromRoleName( request.role_name, @@ -973,7 +986,6 @@ export class TryCpConductor implements IConductor { const zomeCallPayload = { ...request, - // ...omit(request, "role_name"), provenance: cachedAppInfo.agent_pub_key, cell_id, }; diff --git a/ts/test/fixture/zomes/integrity/src/lib.rs b/ts/test/fixture/zomes/integrity/src/lib.rs index 42fef8c8..df7007c1 100644 --- a/ts/test/fixture/zomes/integrity/src/lib.rs +++ b/ts/test/fixture/zomes/integrity/src/lib.rs @@ -9,7 +9,7 @@ pub struct UpdateInput { pub content: String, } -#[hdk_entry_defs] +#[hdk_entry_types] #[unit_enum(EntryTypesUnit)] pub enum EntryTypes { Content(Content), diff --git a/ts/test/local/conductor.ts b/ts/test/local/conductor.ts index 9c5d0252..7ca77e19 100644 --- a/ts/test/local/conductor.ts +++ b/ts/test/local/conductor.ts @@ -100,6 +100,7 @@ test("Local Conductor - get app info with app ws", async (t) => { const appInfo = await appWs.appInfo({ installed_app_id: app.installed_app_id, }); + assert(appInfo); t.deepEqual(appInfo.status, { running: null }); await conductor.shutDown(); await stopLocalServices(servicesProcess); diff --git a/ts/test/trycp/client.ts b/ts/test/trycp/client.ts index 8e44def8..a9a80eda 100644 --- a/ts/test/trycp/client.ts +++ b/ts/test/trycp/client.ts @@ -1,6 +1,8 @@ +import assert from "node:assert/strict"; import { Buffer } from "node:buffer"; import { URL } from "node:url"; import test from "tape-promise/tape.js"; +import { enableAndGetAgentApp } from "../../src/common.js"; import { createTryCpConductor, DEFAULT_PARTIAL_PLAYER_CONFIG, @@ -13,7 +15,6 @@ import { } from "../../src/trycp/trycp-server.js"; import { TRYCP_SUCCESS_RESPONSE } from "../../src/trycp/types.js"; import { FIXTURE_DNA_URL, FIXTURE_HAPP_URL } from "../fixture/index.js"; -import { enableAndGetAgentApp } from "../../src/common.js"; const SERVER_URL = new URL(`ws://${TRYCP_SERVER_HOST}:${TRYCP_SERVER_PORT}`); const createTryCpClient = () => TryCpClient.create(SERVER_URL); @@ -287,6 +288,7 @@ test("TryCP Server - App API - get app info", async (t) => { const alice = await enableAndGetAgentApp(adminWs, appWs, aliceApp); const appInfo = await appWs.appInfo({ installed_app_id: alice.appId }); + assert(appInfo); t.deepEqual(appInfo.status, { running: null }); await conductor.disconnectAppInterface(port);