@holochain/client 0.11.15 → 0.11.16

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.
@@ -9,10 +9,10 @@ import { AppAgentCallZomeRequest, AppAgentClient, AppAgentEvents, AppCreateClone
9
9
  * @public
10
10
  */
11
11
  export declare class AppAgentWebsocket implements AppAgentClient {
12
- myPubKey: AgentPubKey;
13
12
  readonly appWebsocket: AppWebsocket;
14
13
  installedAppId: InstalledAppId;
15
14
  cachedAppInfo?: AppInfo;
15
+ myPubKey: AgentPubKey;
16
16
  readonly emitter: Emittery<AppAgentEvents>;
17
17
  private constructor();
18
18
  /**
@@ -3,21 +3,6 @@ import { omit } from "lodash-es";
3
3
  import { getLauncherEnvironment } from "../../environments/launcher.js";
4
4
  import { getBaseRoleNameFromCloneId, isCloneId } from "../common.js";
5
5
  import { AppWebsocket, CellType, } from "../index.js";
6
- function getPubKey(appInfo) {
7
- // This is fine for now cause `UseExisting` as a provisioning strategy doesn't work yet.
8
- // TODO: change this when AppInfo contains the `AgentPubKey` for this app, like `return appInfo.my_pub_key`
9
- for (const cells of Object.values(appInfo.cell_info)) {
10
- for (const cell of cells) {
11
- if (CellType.Provisioned in cell) {
12
- return cell[CellType.Provisioned].cell_id[1];
13
- }
14
- else if (CellType.Cloned in cell) {
15
- return cell[CellType.Cloned].cell_id[1];
16
- }
17
- }
18
- }
19
- throw new Error(`This app doesn't have any cells, so we can't return the agent public key for it. This is a known issue, and is going to be fixed in the near future.`);
20
- }
21
6
  /**
22
7
  * A class to establish a websocket connection to an App interface, for a
23
8
  * specific agent and app.
@@ -25,17 +10,17 @@ function getPubKey(appInfo) {
25
10
  * @public
26
11
  */
27
12
  export class AppAgentWebsocket {
28
- myPubKey;
29
13
  appWebsocket;
30
14
  installedAppId;
31
15
  cachedAppInfo;
16
+ myPubKey;
32
17
  emitter;
33
18
  constructor(appWebsocket, installedAppId, myPubKey) {
34
- this.myPubKey = myPubKey;
35
19
  this.appWebsocket = appWebsocket;
36
20
  this.emitter = new Emittery();
37
21
  const env = getLauncherEnvironment();
38
22
  this.installedAppId = env?.INSTALLED_APP_ID || installedAppId;
23
+ this.myPubKey = myPubKey;
39
24
  this.appWebsocket.on("signal", (signal) => {
40
25
  if (this.containsCell(signal.cell_id)) {
41
26
  this.emitter.emit("signal", signal);
@@ -67,8 +52,7 @@ export class AppAgentWebsocket {
67
52
  const appInfo = await appWebsocket.appInfo({
68
53
  installed_app_id: installed_app_id,
69
54
  });
70
- const myPubKey = getPubKey(appInfo);
71
- const appAgentWs = new AppAgentWebsocket(appWebsocket, installed_app_id, myPubKey);
55
+ const appAgentWs = new AppAgentWebsocket(appWebsocket, installed_app_id, appInfo.agent_pub_key);
72
56
  appAgentWs.cachedAppInfo = appInfo;
73
57
  return appAgentWs;
74
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holochain/client",
3
- "version": "0.11.15",
3
+ "version": "0.11.16",
4
4
  "description": "A JavaScript client for the Holochain Conductor API",
5
5
  "author": "Holochain Foundation <info@holochain.org> (http://holochain.org)",
6
6
  "license": "CAL-1.0",