@holochain/client 0.11.12 → 0.11.14
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.
- package/README.md +1 -1
- package/lib/api/admin/index.js +0 -1
- package/lib/api/admin/types.d.ts +355 -41
- package/lib/api/admin/types.js +40 -1
- package/lib/api/admin/websocket.d.ts +80 -1
- package/lib/api/admin/websocket.js +82 -4
- package/lib/api/app/index.js +0 -1
- package/lib/api/app/types.d.ts +78 -3
- package/lib/api/app/types.js +3 -1
- package/lib/api/app/websocket.d.ts +54 -0
- package/lib/api/app/websocket.js +48 -1
- package/lib/api/app-agent/index.js +0 -1
- package/lib/api/app-agent/types.d.ts +27 -0
- package/lib/api/app-agent/types.js +0 -1
- package/lib/api/app-agent/websocket.d.ts +57 -0
- package/lib/api/app-agent/websocket.js +57 -1
- package/lib/api/client.d.ts +25 -9
- package/lib/api/client.js +37 -14
- package/lib/api/common.d.ts +30 -1
- package/lib/api/common.js +18 -2
- package/lib/api/index.d.ts +2 -1
- package/lib/api/index.js +1 -1
- package/lib/api/zome-call-signing.d.ts +24 -1
- package/lib/api/zome-call-signing.js +18 -2
- package/lib/environments/launcher.js +0 -1
- package/lib/hdk/action.d.ts +45 -0
- package/lib/hdk/action.js +3 -1
- package/lib/hdk/capabilities.d.ts +21 -0
- package/lib/hdk/capabilities.js +3 -1
- package/lib/hdk/countersigning.d.ts +30 -0
- package/lib/hdk/countersigning.js +0 -1
- package/lib/hdk/dht-ops.d.ts +18 -0
- package/lib/hdk/dht-ops.js +15 -1
- package/lib/hdk/entry.d.ts +15 -0
- package/lib/hdk/entry.js +0 -1
- package/lib/hdk/index.d.ts +1 -0
- package/lib/hdk/index.js +1 -1
- package/lib/hdk/record.d.ts +6 -0
- package/lib/hdk/record.js +0 -1
- package/lib/index.js +0 -1
- package/lib/tsdoc-metadata.json +11 -0
- package/lib/types.d.ts +81 -0
- package/lib/types.js +0 -1
- package/lib/utils/base64.d.ts +16 -0
- package/lib/utils/base64.js +16 -1
- package/lib/utils/fake-hash.d.ts +23 -1
- package/lib/utils/fake-hash.js +23 -2
- package/lib/utils/index.js +0 -1
- package/package.json +5 -2
- package/lib/api/admin/index.js.map +0 -1
- package/lib/api/admin/types.js.map +0 -1
- package/lib/api/admin/websocket.js.map +0 -1
- package/lib/api/app/index.js.map +0 -1
- package/lib/api/app/types.js.map +0 -1
- package/lib/api/app/websocket.js.map +0 -1
- package/lib/api/app-agent/index.js.map +0 -1
- package/lib/api/app-agent/types.js.map +0 -1
- package/lib/api/app-agent/websocket.js.map +0 -1
- package/lib/api/client.js.map +0 -1
- package/lib/api/common.js.map +0 -1
- package/lib/api/index.js.map +0 -1
- package/lib/api/zome-call-signing.js.map +0 -1
- package/lib/environments/launcher.js.map +0 -1
- package/lib/hdk/action.js.map +0 -1
- package/lib/hdk/capabilities.js.map +0 -1
- package/lib/hdk/countersigning.js.map +0 -1
- package/lib/hdk/dht-ops.js.map +0 -1
- package/lib/hdk/entry.js.map +0 -1
- package/lib/hdk/index.js.map +0 -1
- package/lib/hdk/record.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/types.js.map +0 -1
- package/lib/utils/base64.js.map +0 -1
- package/lib/utils/fake-hash.js.map +0 -1
- package/lib/utils/index.js.map +0 -1
package/lib/hdk/action.d.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { AgentPubKey, DnaHash, EntryHash, ActionHash, HoloHashed, Signature, Timestamp } from "../types.js";
|
|
2
2
|
import { EntryType } from "./entry.js";
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
3
6
|
export interface SignedActionHashed<H extends Action = Action> {
|
|
4
7
|
hashed: HoloHashed<H>;
|
|
5
8
|
signature: Signature;
|
|
6
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
7
13
|
export declare type ActionHashed = HoloHashed<Action>;
|
|
14
|
+
/**
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
8
17
|
export declare enum ActionType {
|
|
9
18
|
Dna = "Dna",
|
|
10
19
|
AgentValidationPkg = "AgentValidationPkg",
|
|
@@ -17,14 +26,26 @@ export declare enum ActionType {
|
|
|
17
26
|
Update = "Update",
|
|
18
27
|
Delete = "Delete"
|
|
19
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
20
32
|
export declare type Action = Dna | AgentValidationPkg | InitZomesComplete | CreateLink | DeleteLink | OpenChain | CloseChain | Delete | NewEntryAction;
|
|
33
|
+
/**
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
21
36
|
export declare type NewEntryAction = Create | Update;
|
|
37
|
+
/**
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
22
40
|
export interface Dna {
|
|
23
41
|
type: ActionType.Dna;
|
|
24
42
|
author: AgentPubKey;
|
|
25
43
|
timestamp: Timestamp;
|
|
26
44
|
hash: DnaHash;
|
|
27
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
28
49
|
export interface AgentValidationPkg {
|
|
29
50
|
type: ActionType.AgentValidationPkg;
|
|
30
51
|
author: AgentPubKey;
|
|
@@ -33,6 +54,9 @@ export interface AgentValidationPkg {
|
|
|
33
54
|
prev_action: ActionHash;
|
|
34
55
|
membrane_proof: any;
|
|
35
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
36
60
|
export interface InitZomesComplete {
|
|
37
61
|
type: ActionType.InitZomesComplete;
|
|
38
62
|
author: AgentPubKey;
|
|
@@ -40,6 +64,9 @@ export interface InitZomesComplete {
|
|
|
40
64
|
action_seq: number;
|
|
41
65
|
prev_action: ActionHash;
|
|
42
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
43
70
|
export interface CreateLink {
|
|
44
71
|
type: ActionType.CreateLink;
|
|
45
72
|
author: AgentPubKey;
|
|
@@ -51,6 +78,9 @@ export interface CreateLink {
|
|
|
51
78
|
zome_id: number;
|
|
52
79
|
tag: any;
|
|
53
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* @public
|
|
83
|
+
*/
|
|
54
84
|
export interface DeleteLink {
|
|
55
85
|
type: ActionType.DeleteLink;
|
|
56
86
|
author: AgentPubKey;
|
|
@@ -60,6 +90,9 @@ export interface DeleteLink {
|
|
|
60
90
|
base_address: EntryHash;
|
|
61
91
|
link_add_address: ActionHash;
|
|
62
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
63
96
|
export interface OpenChain {
|
|
64
97
|
type: ActionType.OpenChain;
|
|
65
98
|
author: AgentPubKey;
|
|
@@ -68,6 +101,9 @@ export interface OpenChain {
|
|
|
68
101
|
prev_action: ActionHash;
|
|
69
102
|
prev_dna_hash: DnaHash;
|
|
70
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* @public
|
|
106
|
+
*/
|
|
71
107
|
export interface CloseChain {
|
|
72
108
|
type: ActionType.CloseChain;
|
|
73
109
|
author: AgentPubKey;
|
|
@@ -76,6 +112,9 @@ export interface CloseChain {
|
|
|
76
112
|
prev_action: ActionHash;
|
|
77
113
|
new_dna_hash: DnaHash;
|
|
78
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* @public
|
|
117
|
+
*/
|
|
79
118
|
export interface Update {
|
|
80
119
|
type: ActionType.Update;
|
|
81
120
|
author: AgentPubKey;
|
|
@@ -87,6 +126,9 @@ export interface Update {
|
|
|
87
126
|
entry_type: EntryType;
|
|
88
127
|
entry_hash: EntryHash;
|
|
89
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* @public
|
|
131
|
+
*/
|
|
90
132
|
export interface Delete {
|
|
91
133
|
type: ActionType.Delete;
|
|
92
134
|
author: AgentPubKey;
|
|
@@ -96,6 +138,9 @@ export interface Delete {
|
|
|
96
138
|
deletes_address: ActionHash;
|
|
97
139
|
deletes_entry_address: EntryHash;
|
|
98
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* @public
|
|
143
|
+
*/
|
|
99
144
|
export interface Create {
|
|
100
145
|
type: ActionType.Create;
|
|
101
146
|
author: AgentPubKey;
|
package/lib/hdk/action.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @public
|
|
3
|
+
*/
|
|
1
4
|
export var ActionType;
|
|
2
5
|
(function (ActionType) {
|
|
3
6
|
ActionType["Dna"] = "Dna";
|
|
@@ -11,4 +14,3 @@ export var ActionType;
|
|
|
11
14
|
ActionType["Update"] = "Update";
|
|
12
15
|
ActionType["Delete"] = "Delete";
|
|
13
16
|
})(ActionType || (ActionType = {}));
|
|
14
|
-
//# sourceMappingURL=action.js.map
|
|
@@ -1,25 +1,43 @@
|
|
|
1
1
|
import { FunctionName, ZomeName } from "../api/index.js";
|
|
2
2
|
import { AgentPubKey } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
3
6
|
export declare type CapSecret = Uint8Array;
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
4
10
|
export interface CapClaim {
|
|
5
11
|
tag: string;
|
|
6
12
|
grantor: AgentPubKey;
|
|
7
13
|
secret: CapSecret;
|
|
8
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
9
18
|
export declare enum GrantedFunctionsType {
|
|
10
19
|
All = "All",
|
|
11
20
|
Listed = "Listed"
|
|
12
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
13
25
|
export declare type GrantedFunctions = {
|
|
14
26
|
[GrantedFunctionsType.All]: null;
|
|
15
27
|
} | {
|
|
16
28
|
[GrantedFunctionsType.Listed]: [ZomeName, FunctionName][];
|
|
17
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
18
33
|
export interface ZomeCallCapGrant {
|
|
19
34
|
tag: string;
|
|
20
35
|
access: CapAccess;
|
|
21
36
|
functions: GrantedFunctions;
|
|
22
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
23
41
|
export declare type CapAccess = "Unrestricted" | {
|
|
24
42
|
Transferable: {
|
|
25
43
|
secret: CapSecret;
|
|
@@ -30,6 +48,9 @@ export declare type CapAccess = "Unrestricted" | {
|
|
|
30
48
|
assignees: AgentPubKey[];
|
|
31
49
|
};
|
|
32
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
33
54
|
export declare type CapGrant = {
|
|
34
55
|
ChainAuthor: AgentPubKey;
|
|
35
56
|
} | {
|
package/lib/hdk/capabilities.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @public
|
|
3
|
+
*/
|
|
1
4
|
export var GrantedFunctionsType;
|
|
2
5
|
(function (GrantedFunctionsType) {
|
|
3
6
|
GrantedFunctionsType["All"] = "All";
|
|
4
7
|
GrantedFunctionsType["Listed"] = "Listed";
|
|
5
8
|
})(GrantedFunctionsType || (GrantedFunctionsType = {}));
|
|
6
|
-
//# sourceMappingURL=capabilities.js.map
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { ActionHash, AgentPubKey, EntryHash, Signature, Timestamp } from "../types.js";
|
|
2
2
|
import { EntryType } from "./entry.js";
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
3
6
|
export interface CounterSigningSessionData {
|
|
4
7
|
preflight_request: PreflightRequest;
|
|
5
8
|
responses: Array<[CountersigningAgentState, Signature]>;
|
|
6
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
7
13
|
export interface PreflightRequest {
|
|
8
14
|
app_entry_hash: EntryHash;
|
|
9
15
|
signing_agents: CounterSigningAgents;
|
|
@@ -12,26 +18,50 @@ export interface PreflightRequest {
|
|
|
12
18
|
action_base: ActionBase;
|
|
13
19
|
preflight_bytes: PreflightBytes;
|
|
14
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
15
24
|
export interface CounterSigningSessionTimes {
|
|
16
25
|
start: Timestamp;
|
|
17
26
|
end: Timestamp;
|
|
18
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
19
31
|
export declare type ActionBase = {
|
|
20
32
|
Create: CreateBase;
|
|
21
33
|
} | {
|
|
22
34
|
Update: UpdateBase;
|
|
23
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
24
39
|
export interface CreateBase {
|
|
25
40
|
entry_type: EntryType;
|
|
26
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
27
45
|
export interface UpdateBase {
|
|
28
46
|
original_action_address: ActionHash;
|
|
29
47
|
original_entry_address: EntryHash;
|
|
30
48
|
entry_type: EntryType;
|
|
31
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
32
53
|
export declare type CounterSigningAgents = Array<[AgentPubKey, Array<Role>]>;
|
|
54
|
+
/**
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
33
57
|
export declare type PreflightBytes = Uint8Array;
|
|
58
|
+
/**
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
34
61
|
export declare type Role = number;
|
|
62
|
+
/**
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
35
65
|
export interface CountersigningAgentState {
|
|
36
66
|
agent_index: number;
|
|
37
67
|
chain_top: ActionHash;
|
package/lib/hdk/dht-ops.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Signature } from "../types.js";
|
|
2
2
|
import { Entry } from "./entry.js";
|
|
3
3
|
import { CreateLink, Delete, DeleteLink, Action, NewEntryAction, Update } from "./action.js";
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
4
7
|
export declare enum DhtOpType {
|
|
5
8
|
StoreRecord = "StoreRecord",
|
|
6
9
|
StoreEntry = "StoreEntry",
|
|
@@ -12,6 +15,9 @@ export declare enum DhtOpType {
|
|
|
12
15
|
RegisterAddLink = "RegisterAddLink",
|
|
13
16
|
RegisterRemoveLink = "RegisterRemoveLink"
|
|
14
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
15
21
|
export declare type DhtOp = {
|
|
16
22
|
[DhtOpType.StoreRecord]: [Signature, Action, Entry | undefined];
|
|
17
23
|
} | {
|
|
@@ -35,7 +41,19 @@ export declare type DhtOp = {
|
|
|
35
41
|
} | {
|
|
36
42
|
[DhtOpType.RegisterRemoveLink]: [Signature, DeleteLink];
|
|
37
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
38
47
|
export declare function getDhtOpType(op: DhtOp): DhtOpType;
|
|
48
|
+
/**
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
39
51
|
export declare function getDhtOpAction(op: DhtOp): Action;
|
|
52
|
+
/**
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
40
55
|
export declare function getDhtOpEntry(op: DhtOp): Entry | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
41
59
|
export declare function getDhtOpSignature(op: DhtOp): Signature;
|
package/lib/hdk/dht-ops.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
// https://github.com/holochain/holochain/blob/develop/crates/types/src/dht_op.rs
|
|
2
|
+
/**
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
2
5
|
export var DhtOpType;
|
|
3
6
|
(function (DhtOpType) {
|
|
4
7
|
DhtOpType["StoreRecord"] = "StoreRecord";
|
|
@@ -11,9 +14,15 @@ export var DhtOpType;
|
|
|
11
14
|
DhtOpType["RegisterAddLink"] = "RegisterAddLink";
|
|
12
15
|
DhtOpType["RegisterRemoveLink"] = "RegisterRemoveLink";
|
|
13
16
|
})(DhtOpType || (DhtOpType = {}));
|
|
17
|
+
/**
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
14
20
|
export function getDhtOpType(op) {
|
|
15
21
|
return Object.keys(op)[0];
|
|
16
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
17
26
|
export function getDhtOpAction(op) {
|
|
18
27
|
const opType = getDhtOpType(op);
|
|
19
28
|
const action = Object.values(op)[0][1];
|
|
@@ -40,10 +49,15 @@ export function getDhtOpAction(op) {
|
|
|
40
49
|
};
|
|
41
50
|
}
|
|
42
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
43
55
|
export function getDhtOpEntry(op) {
|
|
44
56
|
return Object.values(op)[0][2];
|
|
45
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
46
61
|
export function getDhtOpSignature(op) {
|
|
47
62
|
return Object.values(op)[0][1];
|
|
48
63
|
}
|
|
49
|
-
//# sourceMappingURL=dht-ops.js.map
|
package/lib/hdk/entry.d.ts
CHANGED
|
@@ -1,21 +1,36 @@
|
|
|
1
1
|
import { CapClaim, ZomeCallCapGrant } from "./capabilities.js";
|
|
2
2
|
import { AgentPubKey } from "../types.js";
|
|
3
3
|
import { CounterSigningSessionData } from "./countersigning.js";
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
4
7
|
export declare type EntryVisibility = {
|
|
5
8
|
Public: null;
|
|
6
9
|
} | {
|
|
7
10
|
Private: null;
|
|
8
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
9
15
|
export declare type AppEntryDef = {
|
|
10
16
|
entry_index: number;
|
|
11
17
|
zome_index: number;
|
|
12
18
|
visibility: EntryVisibility;
|
|
13
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
14
23
|
export declare type EntryType = "Agent" | {
|
|
15
24
|
App: AppEntryDef;
|
|
16
25
|
} | "CapClaim" | "CapGrant";
|
|
26
|
+
/**
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
17
29
|
export interface EntryContent<E extends string, C> {
|
|
18
30
|
entry_type: E;
|
|
19
31
|
entry: C;
|
|
20
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
21
36
|
export declare type Entry = EntryContent<"Agent", AgentPubKey> | EntryContent<"App", Uint8Array> | EntryContent<"CounterSign", [CounterSigningSessionData, Uint8Array]> | EntryContent<"CapGrant", ZomeCallCapGrant> | EntryContent<"CapClaim", CapClaim>;
|
package/lib/hdk/entry.js
CHANGED
package/lib/hdk/index.d.ts
CHANGED
package/lib/hdk/index.js
CHANGED
package/lib/hdk/record.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { SignedActionHashed } from "./action.js";
|
|
2
2
|
import { Entry } from "./entry.js";
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
3
6
|
export declare type Record = {
|
|
4
7
|
signed_action: SignedActionHashed;
|
|
5
8
|
entry: RecordEntry;
|
|
6
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
7
13
|
export declare type RecordEntry = {
|
|
8
14
|
Present: Entry;
|
|
9
15
|
} | {
|
package/lib/hdk/record.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.33.7"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,41 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @public
|
|
3
|
+
*/
|
|
1
4
|
export declare type HoloHash = Uint8Array;
|
|
5
|
+
/**
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
2
8
|
export declare type AgentPubKey = HoloHash;
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
3
12
|
export declare type DnaHash = HoloHash;
|
|
13
|
+
/**
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
4
16
|
export declare type WasmHash = HoloHash;
|
|
17
|
+
/**
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
5
20
|
export declare type EntryHash = HoloHash;
|
|
21
|
+
/**
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
6
24
|
export declare type ActionHash = HoloHash;
|
|
25
|
+
/**
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
7
28
|
export declare type AnyDhtHash = HoloHash;
|
|
29
|
+
/**
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
8
32
|
export declare type KitsuneAgent = Uint8Array;
|
|
33
|
+
/**
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
9
36
|
export declare type KitsuneSpace = Uint8Array;
|
|
10
37
|
/** Base64 hash types */
|
|
38
|
+
/**
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
11
41
|
export declare type HoloHashB64 = string;
|
|
42
|
+
/**
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
12
45
|
export declare type AgentPubKeyB64 = HoloHashB64;
|
|
46
|
+
/**
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
13
49
|
export declare type DnaHashB64 = HoloHashB64;
|
|
50
|
+
/**
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
14
53
|
export declare type WasmHashB64 = HoloHashB64;
|
|
54
|
+
/**
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
15
57
|
export declare type EntryHashB64 = HoloHashB64;
|
|
58
|
+
/**
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
16
61
|
export declare type ActionHashB64 = HoloHashB64;
|
|
62
|
+
/**
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
17
65
|
export declare type AnyDhtHashB64 = HoloHashB64;
|
|
66
|
+
/**
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
18
69
|
export declare type InstalledAppId = string;
|
|
70
|
+
/**
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
19
73
|
export declare type Signature = Uint8Array;
|
|
74
|
+
/**
|
|
75
|
+
* @public
|
|
76
|
+
*/
|
|
20
77
|
export declare type CellId = [DnaHash, AgentPubKey];
|
|
78
|
+
/**
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
21
81
|
export declare type DnaProperties = any;
|
|
82
|
+
/**
|
|
83
|
+
* @public
|
|
84
|
+
*/
|
|
22
85
|
export declare type RoleName = string;
|
|
86
|
+
/**
|
|
87
|
+
* @public
|
|
88
|
+
*/
|
|
23
89
|
export declare type InstalledCell = {
|
|
24
90
|
cell_id: CellId;
|
|
25
91
|
role_name: RoleName;
|
|
26
92
|
};
|
|
93
|
+
/**
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
27
96
|
export declare type Timestamp = number;
|
|
97
|
+
/**
|
|
98
|
+
* @public
|
|
99
|
+
*/
|
|
28
100
|
export interface Duration {
|
|
29
101
|
secs: number;
|
|
30
102
|
nanos: number;
|
|
31
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* @public
|
|
106
|
+
*/
|
|
32
107
|
export interface HoloHashed<T> {
|
|
33
108
|
hash: HoloHash;
|
|
34
109
|
content: T;
|
|
35
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* @public
|
|
113
|
+
*/
|
|
36
114
|
export interface NetworkInfo {
|
|
37
115
|
fetch_queue_info: FetchQueueInfo;
|
|
38
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* @public
|
|
119
|
+
*/
|
|
39
120
|
export interface FetchQueueInfo {
|
|
40
121
|
op_bytes_to_fetch: number;
|
|
41
122
|
num_ops_to_fetch: number;
|
package/lib/types.js
CHANGED
package/lib/utils/base64.d.ts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
1
|
import { HoloHash, HoloHashB64 } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Decodes a Base64 encoded string to a byte array hash.
|
|
4
|
+
*
|
|
5
|
+
* @param hash - The Base64 encoded string to decode.
|
|
6
|
+
* @returns The hash in byte format.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
2
10
|
export declare function decodeHashFromBase64(hash: HoloHashB64): HoloHash;
|
|
11
|
+
/**
|
|
12
|
+
* Encode a byte array hash to a Base64 string.
|
|
13
|
+
*
|
|
14
|
+
* @param hash - The hash to encode to a Base64 string.
|
|
15
|
+
* @returns The Base64 encoded string
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
3
19
|
export declare function encodeHashToBase64(hash: HoloHash): HoloHashB64;
|
package/lib/utils/base64.js
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
import { Base64 } from "js-base64";
|
|
2
|
+
/**
|
|
3
|
+
* Decodes a Base64 encoded string to a byte array hash.
|
|
4
|
+
*
|
|
5
|
+
* @param hash - The Base64 encoded string to decode.
|
|
6
|
+
* @returns The hash in byte format.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
2
10
|
export function decodeHashFromBase64(hash) {
|
|
3
11
|
return Base64.toUint8Array(hash.slice(1));
|
|
4
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Encode a byte array hash to a Base64 string.
|
|
15
|
+
*
|
|
16
|
+
* @param hash - The hash to encode to a Base64 string.
|
|
17
|
+
* @returns The Base64 encoded string
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
5
21
|
export function encodeHashToBase64(hash) {
|
|
6
22
|
return `u${Base64.fromUint8Array(hash, true)}`;
|
|
7
23
|
}
|
|
8
|
-
//# sourceMappingURL=base64.js.map
|
package/lib/utils/fake-hash.d.ts
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
import { ActionHash, AgentPubKey, EntryHash } from "../types.js";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Generate a valid hash of a non-existing entry.
|
|
4
|
+
*
|
|
5
|
+
* From https://github.com/holochain/holochain/blob/develop/crates/holo_hash/src/hash_type/primitive.rs
|
|
6
|
+
*
|
|
7
|
+
* @returns An {@link EntryHash}.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
3
11
|
export declare function fakeEntryHash(): Promise<EntryHash>;
|
|
12
|
+
/**
|
|
13
|
+
* Generate a valid agent key of a non-existing agent.
|
|
14
|
+
*
|
|
15
|
+
* @returns An {@link AgentPubKey}.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
4
19
|
export declare function fakeAgentPubKey(): Promise<AgentPubKey>;
|
|
20
|
+
/**
|
|
21
|
+
* Generate a valid hash of a non-existing action.
|
|
22
|
+
*
|
|
23
|
+
* @returns An {@link ActionHash}.
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
5
27
|
export declare function fakeActionHash(): Promise<ActionHash>;
|
package/lib/utils/fake-hash.js
CHANGED
|
@@ -1,15 +1,36 @@
|
|
|
1
1
|
import { randomByteArray } from "../api/zome-call-signing.js";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Generate a valid hash of a non-existing entry.
|
|
4
|
+
*
|
|
5
|
+
* From https://github.com/holochain/holochain/blob/develop/crates/holo_hash/src/hash_type/primitive.rs
|
|
6
|
+
*
|
|
7
|
+
* @returns An {@link EntryHash}.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
3
11
|
export async function fakeEntryHash() {
|
|
4
12
|
const randomBytes = await randomByteArray(36);
|
|
5
13
|
return new Uint8Array([0x84, 0x21, 0x24, ...randomBytes]);
|
|
6
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Generate a valid agent key of a non-existing agent.
|
|
17
|
+
*
|
|
18
|
+
* @returns An {@link AgentPubKey}.
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
7
22
|
export async function fakeAgentPubKey() {
|
|
8
23
|
const randomBytes = await randomByteArray(36);
|
|
9
24
|
return new Uint8Array([0x84, 0x20, 0x24, ...randomBytes]);
|
|
10
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Generate a valid hash of a non-existing action.
|
|
28
|
+
*
|
|
29
|
+
* @returns An {@link ActionHash}.
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
11
33
|
export async function fakeActionHash() {
|
|
12
34
|
const randomBytes = await randomByteArray(36);
|
|
13
35
|
return new Uint8Array([0x84, 0x29, 0x24, ...randomBytes]);
|
|
14
36
|
}
|
|
15
|
-
//# sourceMappingURL=fake-hash.js.map
|
package/lib/utils/index.js
CHANGED