@holochain/client
Advanced tools
Comparing version 0.17.0-dev.6 to 0.17.0-dev.7
@@ -17,3 +17,3 @@ import Emittery, { UnsubscribeFunction } from "emittery"; | ||
installedAppId: InstalledAppId; | ||
cachedAppInfo?: AppInfo; | ||
cachedAppInfo?: AppInfo | null; | ||
myPubKey: AgentPubKey; | ||
@@ -20,0 +20,0 @@ readonly emitter: Emittery<AppAgentEvents>; |
@@ -6,3 +6,3 @@ import Emittery from "emittery"; | ||
import { AppWebsocket } from "../app/websocket.js"; | ||
import { getBaseRoleNameFromCloneId, isCloneId, } from "../common.js"; | ||
import { HolochainError, getBaseRoleNameFromCloneId, isCloneId, } from "../common.js"; | ||
/** | ||
@@ -22,2 +22,3 @@ * A class to establish a websocket connection to an App interface, for a | ||
this.appWebsocket = appWebsocket; | ||
this.cachedAppInfo = null; | ||
this.emitter = new Emittery(); | ||
@@ -51,2 +52,5 @@ // Ensure all super methods are bound to this instance because Emittery relies on `this` being the instance. | ||
}); | ||
if (!appInfo) { | ||
throw new HolochainError("AppNotFound", `App info not found for the provided id "${this.installedAppId}". App needs to be installed and enabled.`); | ||
} | ||
this.cachedAppInfo = appInfo; | ||
@@ -64,5 +68,6 @@ return appInfo; | ||
const appWebsocket = await AppWebsocket.connect(options); | ||
const appInfo = await appWebsocket.appInfo({ | ||
installed_app_id: installed_app_id, | ||
}); | ||
const appInfo = await appWebsocket.appInfo({ installed_app_id }); | ||
if (!appInfo) { | ||
throw new HolochainError("AppNotFound", `App info not found for the provided id "${installed_app_id}". App needs to be installed and enabled.`); | ||
} | ||
const appAgentWs = new AppAgentWebsocket(appWebsocket, installed_app_id, appInfo.agent_pub_key); | ||
@@ -69,0 +74,0 @@ appAgentWs.cachedAppInfo = appInfo; |
@@ -35,3 +35,3 @@ import { AgentPubKey, CellId, DnaHash, DnaProperties, InstalledAppId, NetworkInfo, RoleName, Timestamp } from "../../types.js"; | ||
*/ | ||
export type AppInfoResponse = AppInfo; | ||
export type AppInfoResponse = AppInfo | null; | ||
/** | ||
@@ -38,0 +38,0 @@ * @public |
@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard. | ||
"packageName": "@microsoft/api-extractor", | ||
"packageVersion": "7.39.4" | ||
"packageVersion": "7.41.0" | ||
} | ||
] | ||
} |
{ | ||
"name": "@holochain/client", | ||
"version": "0.17.0-dev.6", | ||
"version": "0.17.0-dev.7", | ||
"description": "A JavaScript client for the Holochain Conductor API", | ||
@@ -74,2 +74,2 @@ "author": "Holochain Foundation <info@holochain.org> (http://holochain.org)", | ||
} | ||
} | ||
} |
132069
3685