diff --git a/ts/src/local/conductor.ts b/ts/src/local/conductor.ts index 159ea237..571f93f8 100644 --- a/ts/src/local/conductor.ts +++ b/ts/src/local/conductor.ts @@ -386,13 +386,11 @@ export class Conductor implements IConductor { installed_app_id, network_seed, }; - if (!!agent_key) { - logger.debug( - `installing app with id ${installed_app_id} for agent ${encodeHashToBase64( - agent_key - )}` - ); - } + logger.debug( + `installing app with id ${installed_app_id} for agent ${encodeHashToBase64( + agent_key + )}` + ); return this.adminWs().installApp(installAppRequest); } diff --git a/ts/src/trycp/util.ts b/ts/src/trycp/util.ts index d667d5b1..bd995031 100644 --- a/ts/src/trycp/util.ts +++ b/ts/src/trycp/util.ts @@ -1,7 +1,8 @@ -import { Signal, SignalType } from "@holochain/client"; +import { AppSignal, RawSignal, EncodedAppSignal, Signal, SignalType } from "@holochain/client"; import msgpack from "@msgpack/msgpack"; import assert from "node:assert"; import { TryCpApiResponse, _TryCpResponseWrapper } from "./types.js"; +import { inspect } from "util"; /** * Deserialize the binary response from TryCP @@ -24,14 +25,17 @@ export const deserializeTryCpResponse = (response: Uint8Array) => { * @returns The deserialized signal. */ export const deserializeTryCpSignal = (signal: Uint8Array) => { - const deserializedSignal = msgpack.decode(signal); + const deserializedSignal = msgpack.decode(signal) as RawSignal; assertIsSignal(deserializedSignal); if (SignalType.App in deserializedSignal) { - const { - [SignalType.App]: { cell_id, payload: decodedPayload, zome_name }, - } = deserializedSignal; - let app_payload = { cell_id, payload: decodedPayload, zome_name }; - return { App: app_payload } as Signal + const { cell_id, signal, zome_name } = deserializedSignal[SignalType.App] as EncodedAppSignal; + const decodedPayload = msgpack.decode(signal); + const app_signal: AppSignal = { + cell_id, + zome_name, + payload: decodedPayload, + }; + return { App: app_signal } as Signal; } else { throw new Error("Receiving system signals is not implemented yet"); } diff --git a/ts/test/trycp/conductor.ts b/ts/test/trycp/conductor.ts index cf400600..8f711758 100644 --- a/ts/test/trycp/conductor.ts +++ b/ts/test/trycp/conductor.ts @@ -8,6 +8,7 @@ import { CloneId, encodeHashToBase64, EntryHash, + SignalType, GrantedFunctionsType, } from "@holochain/client"; import assert from "node:assert"; @@ -433,7 +434,7 @@ test("TryCP Conductor - receive a signal", async (t) => { }); const actualSignal = await signalReceived; t.deepEqual( - actualSignal.payload, + actualSignal[SignalType.App].payload, testSignal, "received signal matches expected signal" ); diff --git a/ts/test/trycp/scenario.ts b/ts/test/trycp/scenario.ts index c34b45ae..cb5d14d0 100644 --- a/ts/test/trycp/scenario.ts +++ b/ts/test/trycp/scenario.ts @@ -1,4 +1,4 @@ -import { Signal, SignalCb, EntryHash } from "@holochain/client"; +import { Signal, SignalCb, EntryHash, SignalType } from "@holochain/client"; import { URL } from "node:url"; import test from "tape-promise/tape.js"; import { runLocalServices } from "../../src/common.js"; @@ -192,12 +192,14 @@ test("TryCP Scenario - receive signals with 2 conductors", async (t) => { signalReceivedAlice, signalReceivedBob, ]); + t.deepEqual( - actualSignalAlice.payload, + actualSignalAlice[SignalType.App].payload, signalAlice, "received alice's signal" ); - t.deepEqual(actualSignalBob.payload, signalBob, "received bob's signal"); + + t.deepEqual(actualSignalBob[SignalType.App].payload, signalBob, "received bob's signal"); await scenario.cleanUp(); await tryCpServer.stop();