@holochain/client 0.20.0 → 0.20.1

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.
@@ -266,13 +266,19 @@ export type CoordinatorZome = ZomeDefinition;
266
266
  /**
267
267
  * @public
268
268
  */
269
- export type DnaDefinition = {
269
+ export type DnaDef = {
270
270
  name: string;
271
271
  modifiers: DnaModifiers;
272
272
  lineage: DnaHashB64[];
273
273
  integrity_zomes: IntegrityZome[];
274
274
  coordinator_zomes: CoordinatorZome[];
275
275
  };
276
+ /**
277
+ * @public
278
+ *
279
+ * @deprecated Renamed to DnaDef. This alias will be removed in 0.22.0
280
+ */
281
+ export type DnaDefinition = DnaDef;
276
282
  /**
277
283
  * @public
278
284
  */
@@ -280,7 +286,7 @@ export type GetDnaDefinitionRequest = CellId;
280
286
  /**
281
287
  * @public
282
288
  */
283
- export type GetDnaDefinitionResponse = DnaDefinition;
289
+ export type GetDnaDefinitionResponse = DnaDef;
284
290
  /**
285
291
  * @public
286
292
  */
@@ -878,6 +884,9 @@ export interface IssueAppAuthenticationTokenResponse {
878
884
  * @public
879
885
  */
880
886
  export type DumpNetworkStatsRequest = void;
887
+ /**
888
+ * @public
889
+ */
881
890
  export interface ApiTransportStats {
882
891
  /**
883
892
  * Stats from the configured transport implementation.
@@ -886,16 +895,23 @@ export interface ApiTransportStats {
886
895
  /**
887
896
  * Blocked message counts.
888
897
  */
889
- blocked_message_counts: Record<Url, Record<SpaceId, MessageBlockCount>>;
898
+ blocked_message_counts: Record<PeerUrl, Record<SpaceId, MessageBlockCount>>;
890
899
  }
891
900
  /**
892
901
  * Peer Url
902
+ *
903
+ * @public
893
904
  */
894
- type Url = string;
905
+ export type PeerUrl = string;
895
906
  /**
896
907
  * kitsune2 space id
908
+ *
909
+ * @public
910
+ */
911
+ export type SpaceId = string;
912
+ /**
913
+ * @public
897
914
  */
898
- type SpaceId = string;
899
915
  export interface MessageBlockCount {
900
916
  /**
901
917
  * Count of incoming messages that have been blocked and dropped.
@@ -1199,4 +1215,3 @@ export interface AdminApi {
1199
1215
  issueAppAuthenticationToken: Requester<IssueAppAuthenticationTokenRequest, IssueAppAuthenticationTokenResponse>;
1200
1216
  dumpNetworkStats: Requester<DumpNetworkStatsRequest, DumpNetworkStatsResponse>;
1201
1217
  }
1202
- export {};
@@ -25,7 +25,7 @@ export declare class AdminWebsocket implements AdminApi {
25
25
  * @returns A promise for a new connected instance.
26
26
  */
27
27
  static connect(options?: WebsocketConnectionOptions): Promise<AdminWebsocket>;
28
- _requester<ReqI, ReqO, ResI, ResO>(tag: string, transformer?: Transformer<ReqI, ReqO, ResI, ResO>): (req: ReqI, timeout?: number | undefined) => Promise<ResO>;
28
+ _requester<ReqI, ReqO, ResI, ResO>(tag: string, transformer?: Transformer<ReqI, ReqO, ResI, ResO>): (req: ReqI, timeout?: number) => Promise<ResO>;
29
29
  /**
30
30
  * Send a request to open the given port for {@link AppWebsocket} connections.
31
31
  */
@@ -1,4 +1,3 @@
1
- /// <reference types="ws" />
2
1
  import Emittery from "emittery";
3
2
  import IsoWebSocket from "isomorphic-ws";
4
3
  import { WsClientOptions } from "./common.js";
@@ -1,4 +1,3 @@
1
- /// <reference types="ws" />
2
1
  import { RoleName } from "../types.js";
3
2
  import { IsoWebSocket } from "./client.js";
4
3
  export declare const DEFAULT_TIMEOUT = 60000;
@@ -51,7 +51,7 @@ export declare const randomNonce: () => Promise<Nonce256Bit>;
51
51
  /**
52
52
  * @public
53
53
  */
54
- export declare const randomByteArray: (length: number) => Promise<Uint8Array>;
54
+ export declare const randomByteArray: (length: number) => Promise<Uint8Array<ArrayBufferLike>>;
55
55
  /**
56
56
  * @public
57
57
  */
@@ -0,0 +1,19 @@
1
+ import { EntryDetails } from "./entry.js";
2
+ import { RecordDetails } from "./record.js";
3
+ /**
4
+ * @public
5
+ */
6
+ export declare enum DetailsType {
7
+ Entry = "entry",
8
+ Record = "record"
9
+ }
10
+ /**
11
+ * @public
12
+ */
13
+ export type Details = {
14
+ type: DetailsType.Record;
15
+ content: RecordDetails;
16
+ } | {
17
+ type: DetailsType.Entry;
18
+ content: EntryDetails;
19
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @public
3
+ */
4
+ export var DetailsType;
5
+ (function (DetailsType) {
6
+ DetailsType["Entry"] = "entry";
7
+ DetailsType["Record"] = "record";
8
+ })(DetailsType || (DetailsType = {}));
@@ -1,6 +1,7 @@
1
1
  import { CapClaim, ZomeCallCapGrant } from "./capabilities.js";
2
2
  import { AgentPubKey } from "../types.js";
3
3
  import { CounterSigningSessionData } from "./countersigning.js";
4
+ import { SignedActionHashed } from "./action.js";
4
5
  /**
5
6
  * @public
6
7
  */
@@ -30,3 +31,21 @@ export interface EntryContent<E extends string, C> {
30
31
  * @public
31
32
  */
32
33
  export type Entry = EntryContent<"Agent", AgentPubKey> | EntryContent<"App", Uint8Array> | EntryContent<"CounterSign", [CounterSigningSessionData, Uint8Array]> | EntryContent<"CapGrant", ZomeCallCapGrant> | EntryContent<"CapClaim", CapClaim>;
34
+ /**
35
+ * @public
36
+ */
37
+ export declare enum EntryDhtStatus {
38
+ Live = "live",
39
+ Dead = "dead"
40
+ }
41
+ /**
42
+ * @public
43
+ */
44
+ export interface EntryDetails {
45
+ entry: Entry;
46
+ actions: Array<SignedActionHashed>;
47
+ rejected_actions: Array<SignedActionHashed>;
48
+ deletes: Array<SignedActionHashed>;
49
+ updates: Array<SignedActionHashed>;
50
+ entry_dht_status: EntryDhtStatus;
51
+ }
package/lib/hdk/entry.js CHANGED
@@ -1 +1,8 @@
1
- export {};
1
+ /**
2
+ * @public
3
+ */
4
+ export var EntryDhtStatus;
5
+ (function (EntryDhtStatus) {
6
+ EntryDhtStatus["Live"] = "live";
7
+ EntryDhtStatus["Dead"] = "dead";
8
+ })(EntryDhtStatus || (EntryDhtStatus = {}));
@@ -1,7 +1,9 @@
1
1
  export * from "./action.js";
2
2
  export * from "./capabilities.js";
3
3
  export * from "./countersigning.js";
4
+ export * from "./details.js";
4
5
  export * from "./dht-ops.js";
5
6
  export * from "./entry.js";
6
7
  export * from "./link.js";
7
8
  export * from "./record.js";
9
+ export * from "./validation-receipts.js";
package/lib/hdk/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  export * from "./action.js";
2
2
  export * from "./capabilities.js";
3
3
  export * from "./countersigning.js";
4
+ export * from "./details.js";
4
5
  export * from "./dht-ops.js";
5
6
  export * from "./entry.js";
6
7
  export * from "./link.js";
7
8
  export * from "./record.js";
9
+ export * from "./validation-receipts.js";
@@ -1,5 +1,6 @@
1
1
  import { SignedActionHashed } from "./action.js";
2
2
  import { Entry } from "./entry.js";
3
+ import { ValidationStatus } from "./validation-receipts.js";
3
4
  /**
4
5
  * @public
5
6
  */
@@ -19,3 +20,12 @@ export type RecordEntry = {
19
20
  } | {
20
21
  NotStored: void;
21
22
  };
23
+ /**
24
+ * @public
25
+ */
26
+ export interface RecordDetails {
27
+ record: Record;
28
+ validation_status: ValidationStatus;
29
+ deletes: Array<SignedActionHashed>;
30
+ updates: Array<SignedActionHashed>;
31
+ }
@@ -0,0 +1,18 @@
1
+ import { AgentPubKey, DhtOpHash, Timestamp } from "../types";
2
+ /**
3
+ * @public
4
+ */
5
+ export declare enum ValidationStatus {
6
+ Valid = 0,
7
+ Rejected = 1,
8
+ Abandoned = 2
9
+ }
10
+ /**
11
+ * @public
12
+ */
13
+ export interface ValidationReceipt {
14
+ dht_op_hash: DhtOpHash;
15
+ validation_status: ValidationStatus;
16
+ validator: AgentPubKey;
17
+ when_integrated: Timestamp;
18
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @public
3
+ */
4
+ export var ValidationStatus;
5
+ (function (ValidationStatus) {
6
+ ValidationStatus[ValidationStatus["Valid"] = 0] = "Valid";
7
+ ValidationStatus[ValidationStatus["Rejected"] = 1] = "Rejected";
8
+ ValidationStatus[ValidationStatus["Abandoned"] = 2] = "Abandoned";
9
+ })(ValidationStatus || (ValidationStatus = {}));
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.52.3"
8
+ "packageVersion": "7.55.1"
9
9
  }
10
10
  ]
11
11
  }
package/lib/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /** HoloHash Types */
1
2
  /**
2
3
  * @public
3
4
  */
@@ -30,6 +31,27 @@ export type AnyDhtHash = HoloHash;
30
31
  * @public
31
32
  */
32
33
  export type ExternalHash = HoloHash;
34
+ /**
35
+ * @public
36
+ */
37
+ export type DhtOpHash = HoloHash;
38
+ /**
39
+ * @public
40
+ */
41
+ export type WarrantHash = HoloHash;
42
+ /**
43
+ * @public
44
+ */
45
+ export declare enum HoloHashType {
46
+ Agent = "agent",
47
+ Entry = "entry",
48
+ DhtOp = "dhtop",
49
+ Warrant = "warrant",
50
+ Dna = "dna",
51
+ Action = "action",
52
+ Wasm = "wasm",
53
+ External = "external"
54
+ }
33
55
  /**
34
56
  * @public
35
57
  */
@@ -67,6 +89,18 @@ export type ActionHashB64 = HoloHashB64;
67
89
  * @public
68
90
  */
69
91
  export type AnyDhtHashB64 = HoloHashB64;
92
+ /**
93
+ * @public
94
+ */
95
+ export type ExternalHashB64 = HoloHashB64;
96
+ /**
97
+ * @public
98
+ */
99
+ export type DhtOpHashB64 = HoloHashB64;
100
+ /**
101
+ * @public
102
+ */
103
+ export type WarrantHashB64 = HoloHashB64;
70
104
  /**
71
105
  * @public
72
106
  */
package/lib/types.js CHANGED
@@ -1 +1,15 @@
1
- export {};
1
+ /** HoloHash Types */
2
+ /**
3
+ * @public
4
+ */
5
+ export var HoloHashType;
6
+ (function (HoloHashType) {
7
+ HoloHashType["Agent"] = "agent";
8
+ HoloHashType["Entry"] = "entry";
9
+ HoloHashType["DhtOp"] = "dhtop";
10
+ HoloHashType["Warrant"] = "warrant";
11
+ HoloHashType["Dna"] = "dna";
12
+ HoloHashType["Action"] = "action";
13
+ HoloHashType["Wasm"] = "wasm";
14
+ HoloHashType["External"] = "external";
15
+ })(HoloHashType || (HoloHashType = {}));
@@ -0,0 +1,162 @@
1
+ import { HoloHash, DnaHash, ActionHash, AgentPubKey, AnyDhtHash, DhtOpHash, EntryHash, ExternalHash, WarrantHash, WasmHash } from "../types.js";
2
+ /**
3
+ * A Map of DnaHash to HoloHashMap.
4
+ *
5
+ * i.e. A Map of DnaHash to a Map of HoloHash to a value.
6
+ *
7
+ * @param initialEntries - Optional array of `[[DnaHash, HoloHash], value]` to insert into the map.
8
+ *
9
+ * @public
10
+ */
11
+ export declare class DnaHoloHashMap<K extends HoloHash, T> {
12
+ private _dnaMap;
13
+ constructor(initialEntries?: Array<[[DnaHash, K], T]>);
14
+ /**
15
+ * Gets the value associated with a [DnaHash, HoloHash] key pair.
16
+ *
17
+ * @param key - Array of [DnaHash, HoloHash]
18
+ * @returns The value if found, undefined otherwise
19
+ */
20
+ get([dnaHash, key]: [DnaHash, K]): T | undefined;
21
+ /**
22
+ * Checks if a [DnaHash, HoloHash] key pair exists in the map.
23
+ *
24
+ * @param cellKey - Array of [DnaHash, HoloHash] to check
25
+ * @returns True if the key exists, false otherwise
26
+ */
27
+ has([dnaHash, key]: [DnaHash, K]): boolean;
28
+ /**
29
+ * Sets a value for a [DnaHash, HoloHash] key pair.
30
+ *
31
+ * @param key - Tuple of [DnaHash, HoloHash]
32
+ * @param value - The value to store
33
+ * @returns This map instance for chaining
34
+ */
35
+ set([dnaHash, key]: [DnaHash, K], value: T): this;
36
+ /**
37
+ * Removes all entries from the map.
38
+ */
39
+ clear(): void;
40
+ /**
41
+ * Deletes an entry from the map. If this was the last entry for a DNA, the DNA entry is also removed.
42
+ *
43
+ * @param key - Array of [DnaHash, HoloHash] to delete
44
+ * @returns True if the DNA entry was deleted (last entry for that DNA), false otherwise
45
+ */
46
+ delete([dnaHash, key]: [DnaHash, K]): boolean;
47
+ /**
48
+ * Returns all [DnaHash, HoloHash] key pairs in the map.
49
+ *
50
+ * @returns Array of all key tuples
51
+ */
52
+ keys(): Array<[DnaHash, K]>;
53
+ /**
54
+ * Returns all values in the map.
55
+ *
56
+ * @returns Array of all values
57
+ */
58
+ values(): Array<T>;
59
+ /**
60
+ * Returns all entries as [[DnaHash, HoloHash], value] Arrays.
61
+ *
62
+ * @returns Array of all entries
63
+ */
64
+ entries(): Array<[[DnaHash, K], T]>;
65
+ /**
66
+ * Creates a new DnaHoloHashMap containing only entries that match the filter predicate.
67
+ *
68
+ * @param fn - Predicate function to test each value
69
+ * @returns A new filtered map
70
+ */
71
+ filter(fn: (value: T) => boolean): DnaHoloHashMap<K, T>;
72
+ /**
73
+ * Creates a new DnaHoloHashMap with values transformed by the mapping function.
74
+ *
75
+ * @param fn - Function to transform each value
76
+ * @returns A new mapped map
77
+ */
78
+ map<R>(fn: (value: T) => R): DnaHoloHashMap<K, R>;
79
+ /**
80
+ * Returns all HoloHash keys for a specific DNA.
81
+ *
82
+ * @param dnaHash - The DNA hash to query
83
+ * @returns Array of HoloHash keys for this DNA
84
+ */
85
+ keysForDna(dnaHash: DnaHash): Array<K>;
86
+ /**
87
+ * Returns all values for a specific DNA.
88
+ *
89
+ * @param dnaHash - The DNA hash to query
90
+ * @returns Array of values for this DNA
91
+ */
92
+ valuesForDna(dnaHash: DnaHash): Array<T>;
93
+ /**
94
+ * Returns all [HoloHash, value] entries for a specific DNA.
95
+ *
96
+ * @param dnaHash - The DNA hash to query
97
+ * @returns Array of entries for this DNA
98
+ */
99
+ entriesForDna(dnaHash: DnaHash): Array<[K, T]>;
100
+ /**
101
+ * Removes all entries for a specific DNA.
102
+ *
103
+ * @param dnaHash - The DNA hash to clear
104
+ */
105
+ clearForDna(dnaHash: DnaHash): void;
106
+ /**
107
+ * The number of DNA entries in the map.
108
+ *
109
+ * @returns The number of unique DNAs
110
+ */
111
+ get size(): number;
112
+ }
113
+ /**
114
+ * @public
115
+ */
116
+ export declare class DnaAgentPubKeyMap<V> extends DnaHoloHashMap<AgentPubKey, V> {
117
+ }
118
+ /**
119
+ * @public
120
+ */
121
+ export declare class DnaDnaHashMap<V> extends DnaHoloHashMap<DnaHash, V> {
122
+ }
123
+ /**
124
+ * @public
125
+ */
126
+ export declare class DnaWasmHashMap<V> extends DnaHoloHashMap<WasmHash, V> {
127
+ }
128
+ /**
129
+ * @public
130
+ */
131
+ export declare class DnaEntryHashMap<V> extends DnaHoloHashMap<EntryHash, V> {
132
+ }
133
+ /**
134
+ * @public
135
+ */
136
+ export declare class DnaActionHashMap<V> extends DnaHoloHashMap<ActionHash, V> {
137
+ }
138
+ /**
139
+ * @public
140
+ */
141
+ export declare class DnaAnyDhtHashMap<V> extends DnaHoloHashMap<AnyDhtHash, V> {
142
+ }
143
+ /**
144
+ * @public
145
+ */
146
+ export declare class DnaExternalHashMap<V> extends DnaHoloHashMap<ExternalHash, V> {
147
+ }
148
+ /**
149
+ * @public
150
+ */
151
+ export declare class DnaDhtOpHashMap<V> extends DnaHoloHashMap<DhtOpHash, V> {
152
+ }
153
+ /**
154
+ * @public
155
+ */
156
+ export declare class DnaWarrantHashMap<V> extends DnaHoloHashMap<WarrantHash, V> {
157
+ }
158
+ /**
159
+ * @public
160
+ */
161
+ export declare class CellMap<V> extends DnaAgentPubKeyMap<V> {
162
+ }