@holochain/client 0.19.0-dev.7 → 0.19.0-rc.0

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.
@@ -303,14 +303,6 @@ export type GetDnaDefinitionRequest = DnaHash;
303
303
  * @public
304
304
  */
305
305
  export type GetDnaDefinitionResponse = DnaDefinition;
306
- /**
307
- * @public
308
- */
309
- export type GetCompatibleCellsRequest = DnaHashB64;
310
- /**
311
- * @public
312
- */
313
- export type GetCompatibleCellsResponse = Set<[InstalledAppId, Set<CellId>]>;
314
306
  /**
315
307
  * @public
316
308
  */
@@ -445,8 +437,8 @@ export type AppBundleSource = {
445
437
  type: "path";
446
438
  value: string;
447
439
  } | {
448
- type: "bundle";
449
- value: AppBundle;
440
+ type: "bytes";
441
+ value: Uint8Array;
450
442
  };
451
443
  /**
452
444
  * @public
@@ -568,12 +560,12 @@ export type AgentInfoRequest = {
568
560
  /**
569
561
  * @public
570
562
  */
571
- export type AgentInfoResponse = Array<AgentInfoSigned>;
563
+ export type AgentInfoResponse = Array<string>;
572
564
  /**
573
565
  * @public
574
566
  */
575
567
  export type AddAgentInfoRequest = {
576
- agent_infos: Array<AgentInfoSigned>;
568
+ agent_infos: Array<string>;
577
569
  };
578
570
  /**
579
571
  * @public
@@ -859,10 +851,272 @@ export interface IssueAppAuthenticationTokenResponse {
859
851
  * @public
860
852
  */
861
853
  export type DumpNetworkStatsRequest = void;
854
+ /**
855
+ * Stats for a transport connection.
856
+ *
857
+ * This is intended to be a state dump that gives some insight into what the transport is doing.
858
+ *
859
+ * @public
860
+ */
861
+ export interface TransportStats {
862
+ /**
863
+ * The networking backend that is in use.
864
+ */
865
+ backend: string;
866
+ /**
867
+ * The list of peer urls that this Kitsune2 instance can currently be reached at.
868
+ */
869
+ peer_urls: string[];
870
+ /**
871
+ * The list of current connections.
872
+ *
873
+ * @public
874
+ */
875
+ connections: TransportConnectionStats[];
876
+ }
877
+ /**
878
+ * Stats for a single transport connection.
879
+ *
880
+ * @public
881
+ */
882
+ export interface TransportConnectionStats {
883
+ /**
884
+ * The public key of the remote peer.
885
+ */
886
+ pub_key: string;
887
+ /**
888
+ * The message count sent on this connection.
889
+ */
890
+ send_message_count: number;
891
+ /**
892
+ * The bytes sent on this connection.
893
+ */
894
+ send_bytes: number;
895
+ /**
896
+ * The message count received on this connection.
897
+ */
898
+ recv_message_count: number;
899
+ /**
900
+ * The bytes received on this connection
901
+ */
902
+ recv_bytes: number;
903
+ /**
904
+ * UNIX epoch timestamp in seconds when this connection was opened.
905
+ */
906
+ opened_at_s: number;
907
+ /**
908
+ * True if this connection has successfully upgraded to webrtc.
909
+ */
910
+ is_webrtc: boolean;
911
+ }
912
+ /**
913
+ * @public
914
+ */
915
+ export type DumpNetworkStatsResponse = TransportStats;
916
+ /**
917
+ * Arguments for dumping network metrics.
918
+ *
919
+ * @public
920
+ */
921
+ export interface DumpNetworkMetricsRequest {
922
+ /**
923
+ * The DNA hash of the app network to dump.
924
+ */
925
+ dna?: DnaHash;
926
+ /**
927
+ * Include DHT summary in the response.
928
+ */
929
+ include_dht_summary: boolean;
930
+ }
931
+ /**
932
+ * The definition of a storage arc compatible with the concept of
933
+ * storage and querying of items in a store that fall within that arc.
934
+ *
935
+ * @public
936
+ */
937
+ export type DhtArc = {
938
+ /**
939
+ * No DHT locations are contained within this arc.
940
+ */
941
+ type: "empty";
942
+ } | {
943
+ /**
944
+ * A specific range of DHT locations are contained within this arc.
945
+ *
946
+ * The lower and upper bounds are inclusive.
947
+ */
948
+ type: "arc";
949
+ value: [number, number];
950
+ };
951
+ /**
952
+ * Summary of a local agent's network state.
953
+ *
954
+ * @public
955
+ */
956
+ export interface LocalAgentSummary {
957
+ /**
958
+ * The agent's public key.
959
+ */
960
+ agent: AgentPubKey;
961
+ /**
962
+ * The current storage arc that the agent is declaring.
963
+ *
964
+ * This is the arc that the agent is claiming that it is an authority for.
965
+ */
966
+ storage_arc: DhtArc;
967
+ /**
968
+ * The target arc that the agent is trying to achieve as a storage arc.
969
+ *
970
+ * This is not declared to other peers on the network. It is used during gossip to try to sync
971
+ * ops in the target arc. Once the DHT state appears to be in sync with the target arc, the
972
+ * storage arc can be updated towards the target arc.
973
+ */
974
+ target_arc: DhtArc;
975
+ }
976
+ /**
977
+ * Summary of the fetch state.
978
+ *
979
+ * @public
980
+ */
981
+ export interface FetchStateSummary {
982
+ /**
983
+ * The op ids that are currently being fetched.
984
+ *
985
+ * Each op id is associated with one or more peer URL from which the op data could be
986
+ * requested.
987
+ */
988
+ pending_requests: Record<HoloHashB64, string[]>;
989
+ /**
990
+ * The peer URL for nodes that are currently on backoff because of failed fetch requests, and the timestamp when that backoff will expire.
991
+ *
992
+ * If peers are in here then they are not being used as potential sources in
993
+ * [`FetchStateSummary::pending_requests`].
994
+ */
995
+ peers_on_backoff: Map<string, number>;
996
+ }
997
+ /**
998
+ * DHT segment state.
999
+ *
1000
+ * @public
1001
+ */
1002
+ export interface DhtSegmentState {
1003
+ /**
1004
+ * The top hash of the DHT ring segment.
1005
+ */
1006
+ disc_top_hash: Uint8Array;
1007
+ /**
1008
+ * The boundary timestamp of the DHT ring segment.
1009
+ */
1010
+ disc_boundary: Timestamp;
1011
+ /**
1012
+ * The top hashes of each DHT ring segment.
1013
+ */
1014
+ ring_top_hashes: Uint8Array[];
1015
+ }
1016
+ /**
1017
+ * Peer metadata dump.
1018
+ *
1019
+ * @public
1020
+ */
1021
+ export interface PeerMeta {
1022
+ /**
1023
+ * The timestamp of the last gossip round.
1024
+ */
1025
+ last_gossip_timestamp?: Timestamp;
1026
+ /**
1027
+ * The bookmark of the last op bookmark received.
1028
+ */
1029
+ new_ops_bookmark?: Timestamp;
1030
+ /**
1031
+ * The number of behavior errors observed.
1032
+ */
1033
+ peer_behavior_errors?: number;
1034
+ /**
1035
+ * The number of local errors.
1036
+ */
1037
+ local_errors?: number;
1038
+ /**
1039
+ * The number of busy peer errors.
1040
+ */
1041
+ peer_busy?: number;
1042
+ /**
1043
+ * The number of terminated rounds.
1044
+ *
1045
+ * Note that termination is not necessarily an error.
1046
+ */
1047
+ peer_terminated?: number;
1048
+ /**
1049
+ * The number of completed rounds.
1050
+ */
1051
+ completed_rounds?: number;
1052
+ /**
1053
+ * The number of peer timeouts.
1054
+ */
1055
+ peer_timeouts?: number;
1056
+ }
1057
+ /**
1058
+ * Gossip round state summary.
1059
+ *
1060
+ * @public
1061
+ */
1062
+ export interface GossipRoundStateSummary {
1063
+ /**
1064
+ * The URL of the peer with which the round is initiated.
1065
+ */
1066
+ session_with_peer: string;
1067
+ }
1068
+ /**
1069
+ * Gossip state summary.
1070
+ *
1071
+ * @public
1072
+ */
1073
+ export interface GossipStateSummary {
1074
+ /**
1075
+ * The current initiated round summary.
1076
+ */
1077
+ initiated_round?: GossipRoundStateSummary;
1078
+ /**
1079
+ * The list of accepted round summaries.
1080
+ */
1081
+ accepted_rounds: GossipRoundStateSummary[];
1082
+ /**
1083
+ * DHT summary.
1084
+ */
1085
+ dht_summary: Record<string, DhtSegmentState>;
1086
+ /**
1087
+ * Peer metadata dump for each agent in this space.
1088
+ */
1089
+ peer_meta: Record<string, PeerMeta>;
1090
+ }
1091
+ /**
1092
+ * Network metrics from Kitsune2.
1093
+ *
1094
+ * @public
1095
+ */
1096
+ export interface NetworkMetrics {
1097
+ /**
1098
+ * A summary of the fetch queue.
1099
+ *
1100
+ * The fetch queue is used to retrieve op data based on op ids that have been discovered
1101
+ * through publish or gossip.
1102
+ */
1103
+ fetch_state_summary: FetchStateSummary;
1104
+ /**
1105
+ * A summary of the gossip state.
1106
+ *
1107
+ * This includes both live gossip rounds and metrics about peers that we've gossiped with.
1108
+ * Optionally, it can include a summary of the DHT state as Kitsune2 sees it.
1109
+ */
1110
+ gossip_state_summary: GossipStateSummary;
1111
+ /**
1112
+ * A summary of the state of each local agent.
1113
+ */
1114
+ local_agents: LocalAgentSummary[];
1115
+ }
862
1116
  /**
863
1117
  * @public
864
1118
  */
865
- export type DumpNetworkStatsResponse = string;
1119
+ export type DumpNetworkMetricsResponse = Record<DnaHashB64, NetworkMetrics>;
866
1120
  /**
867
1121
  * @public
868
1122
  */
@@ -2,7 +2,7 @@ import { CapSecret, GrantedFunctions } from "../../hdk/index.js";
2
2
  import type { AgentPubKey, CellId } from "../../types.js";
3
3
  import { WsClient } from "../client.js";
4
4
  import { Requester, Transformer, WebsocketConnectionOptions } from "../common.js";
5
- import { AddAgentInfoRequest, AddAgentInfoResponse, AdminApi, AgentInfoRequest, AgentInfoResponse, AttachAppInterfaceRequest, AttachAppInterfaceResponse, DeleteCloneCellRequest, DeleteCloneCellResponse, DisableAppRequest, DisableAppResponse, DumpFullStateRequest, DumpFullStateResponse, DumpNetworkStatsRequest, DumpNetworkStatsResponse, DumpStateRequest, DumpStateResponse, EnableAppRequest, EnableAppResponse, GenerateAgentPubKeyRequest, GenerateAgentPubKeyResponse, GetCompatibleCellsRequest, GetCompatibleCellsResponse, GetDnaDefinitionRequest, GetDnaDefinitionResponse, GrantZomeCallCapabilityRequest, GrantZomeCallCapabilityResponse, InstallAppRequest, InstallAppResponse, IssueAppAuthenticationTokenRequest, IssueAppAuthenticationTokenResponse, ListAppInterfacesRequest, ListAppInterfacesResponse, ListAppsRequest, ListAppsResponse, ListCellIdsRequest, ListCellIdsResponse, ListDnasRequest, ListDnasResponse, RegisterDnaRequest, RegisterDnaResponse, RevokeAgentKeyRequest, RevokeAgentKeyResponse, StorageInfoRequest, StorageInfoResponse, UninstallAppRequest, UninstallAppResponse, UpdateCoordinatorsRequest, UpdateCoordinatorsResponse } from "./types.js";
5
+ import { AddAgentInfoRequest, AddAgentInfoResponse, AdminApi, AgentInfoRequest, AgentInfoResponse, AttachAppInterfaceRequest, AttachAppInterfaceResponse, DeleteCloneCellRequest, DeleteCloneCellResponse, DisableAppRequest, DisableAppResponse, DumpFullStateRequest, DumpFullStateResponse, DumpNetworkMetricsRequest, DumpNetworkMetricsResponse, DumpNetworkStatsRequest, DumpNetworkStatsResponse, DumpStateRequest, DumpStateResponse, EnableAppRequest, EnableAppResponse, GenerateAgentPubKeyRequest, GenerateAgentPubKeyResponse, GetDnaDefinitionRequest, GetDnaDefinitionResponse, GrantZomeCallCapabilityRequest, GrantZomeCallCapabilityResponse, InstallAppRequest, InstallAppResponse, IssueAppAuthenticationTokenRequest, IssueAppAuthenticationTokenResponse, ListAppInterfacesRequest, ListAppInterfacesResponse, ListAppsRequest, ListAppsResponse, ListCellIdsRequest, ListCellIdsResponse, ListDnasRequest, ListDnasResponse, RegisterDnaRequest, RegisterDnaResponse, RevokeAgentKeyRequest, RevokeAgentKeyResponse, StorageInfoRequest, StorageInfoResponse, UninstallAppRequest, UninstallAppResponse, UpdateCoordinatorsRequest, UpdateCoordinatorsResponse } from "./types.js";
6
6
  /**
7
7
  * A class for interacting with a conductor's Admin API.
8
8
  *
@@ -65,7 +65,6 @@ export declare class AdminWebsocket implements AdminApi {
65
65
  * Get the DNA definition for the specified DNA hash.
66
66
  */
67
67
  getDnaDefinition: Requester<GetDnaDefinitionRequest, GetDnaDefinitionResponse>;
68
- getCompatibleCells: Requester<GetCompatibleCellsRequest, GetCompatibleCellsResponse>;
69
68
  /**
70
69
  * Uninstall the specified app from Holochain.
71
70
  */
@@ -114,6 +113,7 @@ export declare class AdminWebsocket implements AdminApi {
114
113
  storageInfo: Requester<StorageInfoRequest, StorageInfoResponse>;
115
114
  issueAppAuthenticationToken: Requester<IssueAppAuthenticationTokenRequest, IssueAppAuthenticationTokenResponse>;
116
115
  dumpNetworkStats: Requester<DumpNetworkStatsRequest, DumpNetworkStatsResponse>;
116
+ dumpNetworkMetrics: Requester<DumpNetworkMetricsRequest, DumpNetworkMetricsResponse>;
117
117
  /**
118
118
  * Grant a capability for signing zome calls.
119
119
  *
@@ -81,9 +81,6 @@ export class AdminWebsocket {
81
81
  * Get the DNA definition for the specified DNA hash.
82
82
  */
83
83
  getDnaDefinition = this._requester("get_dna_definition");
84
- /// Find installed cells which use a DNA that's forward-compatible with the given DNA hash.
85
- /// Namely, this finds cells with DNAs whose manifest lists the given DNA hash in its `lineage` field.
86
- getCompatibleCells = this._requester("get_compatible_cells");
87
84
  /**
88
85
  * Uninstall the specified app from Holochain.
89
86
  */
@@ -132,6 +129,7 @@ export class AdminWebsocket {
132
129
  storageInfo = this._requester("storage_info");
133
130
  issueAppAuthenticationToken = this._requester("issue_app_authentication_token");
134
131
  dumpNetworkStats = this._requester("dump_network_stats");
132
+ dumpNetworkMetrics = this._requester("dump_network_metrics");
135
133
  // zome call signing related methods
136
134
  /**
137
135
  * Grant a capability for signing zome calls.
@@ -1,9 +1,5 @@
1
1
  import { UnsubscribeFunction } from "emittery";
2
- import { AgentPubKey, AppAuthenticationToken, AppInfo, CapSecret, CellId, ClonedCell, DnaHash, DnaProperties, EntryHash, FunctionName, InstalledAppId, MembraneProof, MemproofMap, NetworkInfo, NetworkSeed, Nonce256Bit, RoleName, Timestamp, Transformer, WebsocketConnectionOptions, ZomeName, PreflightRequest, SignedAction, SignedActionHashed } from "../../index.js";
3
- /**
4
- * @public
5
- */
6
- export type AppNetworkInfoRequest = Omit<NetworkInfoRequest, "agent_pub_key">;
2
+ import { AgentPubKey, AppAuthenticationToken, AppInfo, CapSecret, CellId, ClonedCell, DnaHash, DnaProperties, EntryHash, FunctionName, InstalledAppId, MembraneProof, MemproofMap, NetworkSeed, Nonce256Bit, RoleName, Timestamp, Transformer, WebsocketConnectionOptions, ZomeName, PreflightRequest, SignedAction, SignedActionHashed, DumpNetworkStatsResponse, DumpNetworkMetricsResponse, DumpNetworkMetricsRequest } from "../../index.js";
7
3
  /**
8
4
  * @public
9
5
  */
@@ -150,23 +146,6 @@ export type EnableCloneCellRequest = DisableCloneCellRequest;
150
146
  * @public
151
147
  */
152
148
  export type EnableCloneCellResponse = CreateCloneCellResponse;
153
- /**
154
- * @public
155
- */
156
- export interface NetworkInfoRequest {
157
- /**
158
- * The calling agent
159
- */
160
- agent_pub_key: AgentPubKey;
161
- /**
162
- * Get network info for these DNAs
163
- */
164
- dnas: DnaHash[];
165
- /**
166
- * Timestamp in ms since which received amount of bytes from peers will be returned. Defaults to UNIX_EPOCH.
167
- */
168
- last_time_queried?: number;
169
- }
170
149
  /**
171
150
  * Cell id for which the countersigning session state is requested.
172
151
  *
@@ -418,10 +397,6 @@ export type SystemSignal = {
418
397
  * @public
419
398
  */
420
399
  export type SignalCb = (signal: Signal) => void;
421
- /**
422
- * @public
423
- */
424
- export type NetworkInfoResponse = NetworkInfo[];
425
400
  /**
426
401
  * @public
427
402
  */
@@ -431,10 +406,11 @@ export interface AppClient {
431
406
  appInfo(): Promise<AppInfoResponse>;
432
407
  myPubKey: AgentPubKey;
433
408
  installedAppId: InstalledAppId;
409
+ dumpNetworkStats(): Promise<DumpNetworkStatsResponse>;
410
+ dumpNetworkMetrics(args: DumpNetworkMetricsRequest): Promise<DumpNetworkMetricsResponse>;
434
411
  createCloneCell(args: CreateCloneCellRequest): Promise<CreateCloneCellResponse>;
435
412
  enableCloneCell(args: EnableCloneCellRequest): Promise<EnableCloneCellResponse>;
436
413
  disableCloneCell(args: DisableCloneCellRequest): Promise<DisableCloneCellResponse>;
437
- networkInfo(args: AppNetworkInfoRequest): Promise<NetworkInfoResponse>;
438
414
  }
439
415
  /**
440
416
  * @public
@@ -1,8 +1,8 @@
1
1
  import { UnsubscribeFunction } from "emittery";
2
2
  import { AgentPubKey, InstalledAppId, RoleName } from "../../types.js";
3
- import { AppInfo, ClonedCell, MemproofMap } from "../admin/index.js";
4
- import { AppClient, AppEvents, AppNetworkInfoRequest, SignalCb, CallZomeRequest, CallZomeRequestSigned, CreateCloneCellRequest, DisableCloneCellRequest, EnableCloneCellRequest, NetworkInfoResponse, AppWebsocketConnectionOptions, GetCountersigningSessionStateRequest, GetCountersigningSessionStateResponse, AbandonCountersigningSessionStateRequest, PublishCountersigningSessionStateRequest, RoleNameCallZomeRequest } from "./types.js";
3
+ import { AppInfo, ClonedCell, DumpNetworkMetricsRequest, DumpNetworkMetricsResponse, DumpNetworkStatsResponse, MemproofMap } from "../admin/index.js";
5
4
  import { WsClient } from "../client.js";
5
+ import { AbandonCountersigningSessionStateRequest, AppClient, AppEvents, AppWebsocketConnectionOptions, CallZomeRequest, CallZomeRequestSigned, CreateCloneCellRequest, DisableCloneCellRequest, EnableCloneCellRequest, GetCountersigningSessionStateRequest, GetCountersigningSessionStateResponse, PublishCountersigningSessionStateRequest, RoleNameCallZomeRequest, SignalCb } from "./types.js";
6
6
  /**
7
7
  * A class to establish a websocket connection to an App interface, for a
8
8
  * specific agent and app.
@@ -24,7 +24,8 @@ export declare class AppWebsocket implements AppClient {
24
24
  private readonly createCloneCellRequester;
25
25
  private readonly enableCloneCellRequester;
26
26
  private readonly disableCloneCellRequester;
27
- private readonly networkInfoRequester;
27
+ private readonly dumpNetworkStatsRequester;
28
+ private readonly dumpNetworkMetricsRequester;
28
29
  private readonly getCountersigningSessionStateRequester;
29
30
  private readonly abandonCountersigningSessionRequester;
30
31
  private readonly publishCountersigningSessionRequester;
@@ -44,6 +45,18 @@ export declare class AppWebsocket implements AppClient {
44
45
  * @returns The app's {@link AppInfo}.
45
46
  */
46
47
  appInfo(timeout?: number): Promise<AppInfo>;
48
+ /**
49
+ * Request network stats.
50
+ *
51
+ * @returns The conductor's {@link TransportStats}.
52
+ */
53
+ dumpNetworkStats(timeout?: number): Promise<DumpNetworkStatsResponse>;
54
+ /**
55
+ * Request network metrics.
56
+ *
57
+ * @returns The {@link NetworkMetrics}.
58
+ */
59
+ dumpNetworkMetrics(req: DumpNetworkMetricsRequest, timeout?: number): Promise<DumpNetworkMetricsResponse>;
47
60
  /**
48
61
  * Provide membrane proofs for the app.
49
62
  *
@@ -51,7 +64,7 @@ export declare class AppWebsocket implements AppClient {
51
64
  */
52
65
  provideMemproofs(memproofs: MemproofMap): Promise<void>;
53
66
  /**
54
- * Enablie an app only if the app is in the `AppStatus::Disabled(DisabledAppReason::NotStartedAfterProvidingMemproofs)`
67
+ * Enable an app only if the app is in the `AppStatus::Disabled(DisabledAppReason::NotStartedAfterProvidingMemproofs)`
55
68
  * state. Attempting to enable the app from other states (other than Running) will fail.
56
69
  */
57
70
  enableApp(): Promise<void>;
@@ -91,12 +104,6 @@ export declare class AppWebsocket implements AppClient {
91
104
  * @param args - Specify the clone cell to disable.
92
105
  */
93
106
  disableCloneCell(args: DisableCloneCellRequest): Promise<void>;
94
- /**
95
- * Request network info about gossip status.
96
- * @param args - Specify the DNAs for which you want network info
97
- * @returns Network info for the specified DNAs
98
- */
99
- networkInfo(args: AppNetworkInfoRequest): Promise<NetworkInfoResponse>;
100
107
  /**
101
108
  * Get the state of a countersigning session.
102
109
  */
@@ -1,14 +1,14 @@
1
+ import { decode, encode } from "@msgpack/msgpack";
1
2
  import Emittery from "emittery";
3
+ import { sha512 } from "js-sha512";
4
+ import _sodium from "libsodium-wrappers";
2
5
  import { omit } from "lodash-es";
3
- import { CellType, } from "../admin/index.js";
4
- import { catchError, DEFAULT_TIMEOUT, getBaseRoleNameFromCloneId, HolochainError, isCloneId, promiseTimeout, requesterTransformer, } from "../common.js";
5
6
  import { getHostZomeCallSigner, getLauncherEnvironment, } from "../../environments/launcher.js";
6
- import { decode, encode } from "@msgpack/msgpack";
7
- import { getNonceExpiration, getSigningCredentials, randomNonce, } from "../zome-call-signing.js";
8
7
  import { encodeHashToBase64 } from "../../utils/index.js";
9
- import _sodium from "libsodium-wrappers";
8
+ import { CellType, } from "../admin/index.js";
10
9
  import { WsClient } from "../client.js";
11
- import { sha512 } from "js-sha512";
10
+ import { catchError, DEFAULT_TIMEOUT, getBaseRoleNameFromCloneId, HolochainError, isCloneId, promiseTimeout, requesterTransformer, } from "../common.js";
11
+ import { getNonceExpiration, getSigningCredentials, randomNonce, } from "../zome-call-signing.js";
12
12
  /**
13
13
  * A class to establish a websocket connection to an App interface, for a
14
14
  * specific agent and app.
@@ -30,7 +30,8 @@ export class AppWebsocket {
30
30
  createCloneCellRequester;
31
31
  enableCloneCellRequester;
32
32
  disableCloneCellRequester;
33
- networkInfoRequester;
33
+ dumpNetworkStatsRequester;
34
+ dumpNetworkMetricsRequester;
34
35
  getCountersigningSessionStateRequester;
35
36
  abandonCountersigningSessionRequester;
36
37
  publishCountersigningSessionRequester;
@@ -49,7 +50,8 @@ export class AppWebsocket {
49
50
  this.createCloneCellRequester = AppWebsocket.requester(this.client, "create_clone_cell", this.defaultTimeout);
50
51
  this.enableCloneCellRequester = AppWebsocket.requester(this.client, "enable_clone_cell", this.defaultTimeout);
51
52
  this.disableCloneCellRequester = AppWebsocket.requester(this.client, "disable_clone_cell", this.defaultTimeout);
52
- this.networkInfoRequester = AppWebsocket.requester(this.client, "network_info", this.defaultTimeout);
53
+ this.dumpNetworkStatsRequester = AppWebsocket.requester(this.client, "dump_network_stats", this.defaultTimeout);
54
+ this.dumpNetworkMetricsRequester = AppWebsocket.requester(this.client, "dump_network_metrics", this.defaultTimeout);
53
55
  this.getCountersigningSessionStateRequester = AppWebsocket.requester(this.client, "get_countersigning_session_state", this.defaultTimeout);
54
56
  this.abandonCountersigningSessionRequester = AppWebsocket.requester(this.client, "abandon_countersigning_session", this.defaultTimeout);
55
57
  this.publishCountersigningSessionRequester = AppWebsocket.requester(this.client, "publish_countersigning_session", this.defaultTimeout);
@@ -107,6 +109,22 @@ export class AppWebsocket {
107
109
  this.cachedAppInfo = appInfo;
108
110
  return appInfo;
109
111
  }
112
+ /**
113
+ * Request network stats.
114
+ *
115
+ * @returns The conductor's {@link TransportStats}.
116
+ */
117
+ async dumpNetworkStats(timeout) {
118
+ return await this.dumpNetworkStatsRequester(undefined, timeout);
119
+ }
120
+ /**
121
+ * Request network metrics.
122
+ *
123
+ * @returns The {@link NetworkMetrics}.
124
+ */
125
+ async dumpNetworkMetrics(req, timeout) {
126
+ return await this.dumpNetworkMetricsRequester(req, timeout);
127
+ }
110
128
  /**
111
129
  * Provide membrane proofs for the app.
112
130
  *
@@ -116,7 +134,7 @@ export class AppWebsocket {
116
134
  await this.provideMemproofRequester(memproofs);
117
135
  }
118
136
  /**
119
- * Enablie an app only if the app is in the `AppStatus::Disabled(DisabledAppReason::NotStartedAfterProvidingMemproofs)`
137
+ * Enable an app only if the app is in the `AppStatus::Disabled(DisabledAppReason::NotStartedAfterProvidingMemproofs)`
120
138
  * state. Attempting to enable the app from other states (other than Running) will fail.
121
139
  */
122
140
  async enableApp() {
@@ -212,17 +230,6 @@ export class AppWebsocket {
212
230
  ...args,
213
231
  });
214
232
  }
215
- /**
216
- * Request network info about gossip status.
217
- * @param args - Specify the DNAs for which you want network info
218
- * @returns Network info for the specified DNAs
219
- */
220
- async networkInfo(args) {
221
- return this.networkInfoRequester({
222
- ...args,
223
- agent_pub_key: this.myPubKey,
224
- });
225
- }
226
233
  /**
227
234
  * Get the state of a countersigning session.
228
235
  */
package/lib/api/client.js CHANGED
@@ -2,6 +2,7 @@ import { decode, encode } from "@msgpack/msgpack";
2
2
  import Emittery from "emittery";
3
3
  import IsoWebSocket from "isomorphic-ws";
4
4
  import { HolochainError } from "./common.js";
5
+ import { encodeHashToBase64 } from "../utils/base64.js";
5
6
  /**
6
7
  * A WebSocket client which can make requests and receive responses,
7
8
  * as well as send and receive signals.
@@ -232,7 +233,19 @@ export class WsClient extends Emittery {
232
233
  this.pendingRequests[id].reject(new Error("Response canceled by responder"));
233
234
  }
234
235
  else {
235
- this.pendingRequests[id].resolve(decode(msg.data));
236
+ this.pendingRequests[id].resolve(decode(msg.data, {
237
+ mapKeyConverter: (key) => {
238
+ if (typeof key === "string" || typeof key === "number") {
239
+ return key;
240
+ }
241
+ if (key && typeof key === "object" && key instanceof Uint8Array) {
242
+ // Key of type byte array, must be a HoloHash.
243
+ return encodeHashToBase64(key);
244
+ }
245
+ throw new HolochainError("DeserializationError", "Encountered map with key of type 'object', but not HoloHash " +
246
+ key);
247
+ },
248
+ }));
236
249
  }
237
250
  delete this.pendingRequests[id];
238
251
  }
@@ -65,7 +65,7 @@ export declare const getBaseRoleNameFromCloneId: (roleName: RoleName) => string;
65
65
  *
66
66
  * @public
67
67
  */
68
- export declare class CloneId {
68
+ export declare class CloneIdHelper {
69
69
  private readonly roleName;
70
70
  private readonly index;
71
71
  constructor(roleName: RoleName, index: number);
@@ -74,7 +74,7 @@ export declare class CloneId {
74
74
  * @param roleName - Role id to parse.
75
75
  * @returns A clone id instance.
76
76
  */
77
- static fromRoleName(roleName: RoleName): CloneId;
77
+ static fromRoleName(roleName: RoleName): CloneIdHelper;
78
78
  toString(): string;
79
79
  getBaseRoleName(): string;
80
80
  }
package/lib/api/common.js CHANGED
@@ -85,7 +85,7 @@ export const getBaseRoleNameFromCloneId = (roleName) => {
85
85
  *
86
86
  * @public
87
87
  */
88
- export class CloneId {
88
+ export class CloneIdHelper {
89
89
  roleName;
90
90
  index;
91
91
  constructor(roleName, index) {
@@ -102,7 +102,7 @@ export class CloneId {
102
102
  if (parts.length !== 2) {
103
103
  throw new HolochainError("MalformedCloneId", `clone id must consist of 'role_id.clone_index', but got ${roleName}`);
104
104
  }
105
- return new CloneId(parts[0], parseInt(parts[1]));
105
+ return new CloneIdHelper(parts[0], parseInt(parts[1]));
106
106
  }
107
107
  toString() {
108
108
  return `${this.roleName}${CLONE_ID_DELIMITER}${this.index}`;
@@ -1,5 +1,5 @@
1
1
  export * from "./admin/index.js";
2
2
  export * from "./app/index.js";
3
3
  export { IsoWebSocket, WsClient, type AppAuthenticationRequest, } from "./client.js";
4
- export { CloneId, HolochainError, getBaseRoleNameFromCloneId, isCloneId, type Requester, type Transformer, type WebsocketConnectionOptions, type WsClientOptions, } from "./common.js";
4
+ export { CloneIdHelper, HolochainError, getBaseRoleNameFromCloneId, isCloneId, type Requester, type Transformer, type WebsocketConnectionOptions, type WsClientOptions, } from "./common.js";
5
5
  export * from "./zome-call-signing.js";
package/lib/api/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "./admin/index.js";
2
2
  export * from "./app/index.js";
3
3
  export { IsoWebSocket, WsClient, } from "./client.js";
4
- export { CloneId, HolochainError, getBaseRoleNameFromCloneId, isCloneId, } from "./common.js";
4
+ export { CloneIdHelper, HolochainError, getBaseRoleNameFromCloneId, isCloneId, } from "./common.js";
5
5
  export * from "./zome-call-signing.js";
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.47.11"
8
+ "packageVersion": "7.52.3"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holochain/client",
3
- "version": "0.19.0-dev.7",
3
+ "version": "0.19.0-rc.0",
4
4
  "description": "A JavaScript client for the Holochain Conductor API",
5
5
  "author": "Holochain Foundation <info@holochain.org> (https://holochain.org)",
6
6
  "license": "CAL-1.0",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@bitgo/blake2b": "^3.2.4",
46
- "@msgpack/msgpack": "^2.8.0",
46
+ "@msgpack/msgpack": "^3.1.1",
47
47
  "emittery": "^1.0.1",
48
48
  "isomorphic-ws": "^5.0.0",
49
49
  "js-base64": "^3.7.5",