@holochain/client 0.4.3 → 0.7.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.
- package/lib/api/admin/types.d.ts +6 -6
- package/lib/api/app/websocket.d.ts +1 -1
- package/lib/api/app/websocket.js +4 -4
- package/lib/api/app/websocket.js.map +1 -1
- package/lib/environments/launcher.js +2 -1
- package/lib/environments/launcher.js.map +1 -1
- package/lib/hdk/{header.d.ts → action.d.ts} +37 -37
- package/lib/hdk/action.js +14 -0
- package/lib/hdk/{header.js.map → action.js.map} +1 -1
- package/lib/hdk/countersigning.d.ts +39 -0
- package/lib/hdk/countersigning.js +2 -0
- package/lib/hdk/countersigning.js.map +1 -0
- package/lib/hdk/dht-ops.d.ts +10 -14
- package/lib/hdk/dht-ops.js +24 -10
- package/lib/hdk/dht-ops.js.map +1 -1
- package/lib/hdk/entry.d.ts +2 -1
- package/lib/hdk/index.d.ts +2 -1
- package/lib/hdk/index.js +2 -1
- package/lib/hdk/index.js.map +1 -1
- package/lib/hdk/record.d.ts +15 -0
- package/lib/hdk/record.js +2 -0
- package/lib/hdk/record.js.map +1 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/types.d.ts +2 -2
- package/package.json +3 -1
- package/lib/bundle.d.ts +0 -6
- package/lib/bundle.js +0 -32
- package/lib/bundle.js.map +0 -1
- package/lib/hdk/header.js +0 -14
package/lib/api/admin/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { AgentPubKey, CellId, DnaHash, DnaProperties,
|
|
3
|
-
import { DhtOp, Entry,
|
|
2
|
+
import { AgentPubKey, CellId, DnaHash, DnaProperties, ActionHash, HoloHash, InstalledAppId, InstalledCell, KitsuneAgent, KitsuneSpace, RoleId, Signature } from "../../types.js";
|
|
3
|
+
import { DhtOp, Entry, Action } from "../../hdk/index.js";
|
|
4
4
|
import { Requester } from "../common.js";
|
|
5
5
|
export declare type AttachAppInterfaceRequest = {
|
|
6
6
|
port: number;
|
|
@@ -274,14 +274,14 @@ export interface FullIntegrationStateDump {
|
|
|
274
274
|
integrated: Array<DhtOp>;
|
|
275
275
|
dht_ops_cursor: number;
|
|
276
276
|
}
|
|
277
|
-
export interface
|
|
277
|
+
export interface SourceChainJsonRecord {
|
|
278
278
|
signature: Signature;
|
|
279
|
-
|
|
280
|
-
|
|
279
|
+
action_address: ActionHash;
|
|
280
|
+
action: Action;
|
|
281
281
|
entry: Entry | undefined;
|
|
282
282
|
}
|
|
283
283
|
export interface SourceChainJsonDump {
|
|
284
|
-
|
|
284
|
+
records: Array<SourceChainJsonRecord>;
|
|
285
285
|
published_ops_count: number;
|
|
286
286
|
}
|
|
287
287
|
export interface FullStateDump {
|
|
@@ -5,7 +5,7 @@ import { AppApi, AppInfoRequest, AppInfoResponse, AppSignalCb, CallZomeRequestGe
|
|
|
5
5
|
export declare class AppWebsocket implements AppApi {
|
|
6
6
|
client: WsClient;
|
|
7
7
|
defaultTimeout: number;
|
|
8
|
-
|
|
8
|
+
overrideInstalledAppId?: InstalledAppId;
|
|
9
9
|
constructor(client: WsClient, defaultTimeout?: number, overrideInstalledAppId?: InstalledAppId);
|
|
10
10
|
static connect(url: string, defaultTimeout?: number, signalCb?: AppSignalCb): Promise<AppWebsocket>;
|
|
11
11
|
_requester: <ReqO, ReqI, ResI, ResO>(tag: string, transformer?: Transformer<ReqO, ReqI, ResI, ResO> | undefined) => (req: ReqO, timeout?: number | undefined) => Promise<ResO>;
|
package/lib/api/app/websocket.js
CHANGED
|
@@ -39,7 +39,7 @@ export class AppWebsocket {
|
|
|
39
39
|
return new AppWebsocket(wsClient, defaultTimeout, env ? env.INSTALLED_APP_ID : undefined);
|
|
40
40
|
}
|
|
41
41
|
_requester = (tag, transformer) => requesterTransformer((req, timeout) => promiseTimeout(this.client.request(req), tag, timeout || this.defaultTimeout).then(catchError), tag, transformer);
|
|
42
|
-
appInfo = this._requester("app_info", appInfoTransform(this
|
|
42
|
+
appInfo = this._requester("app_info", appInfoTransform(this));
|
|
43
43
|
callZome = this._requester("zome_call", callZomeTransform);
|
|
44
44
|
}
|
|
45
45
|
const callZomeTransform = {
|
|
@@ -53,11 +53,11 @@ const callZomeTransform = {
|
|
|
53
53
|
return decode(res);
|
|
54
54
|
},
|
|
55
55
|
};
|
|
56
|
-
const appInfoTransform = (
|
|
56
|
+
const appInfoTransform = (appWs) => ({
|
|
57
57
|
input: (req) => {
|
|
58
|
-
if (overrideInstalledAppId) {
|
|
58
|
+
if (appWs.overrideInstalledAppId) {
|
|
59
59
|
return {
|
|
60
|
-
installed_app_id: overrideInstalledAppId,
|
|
60
|
+
installed_app_id: appWs.overrideInstalledAppId,
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
return req;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"websocket.js","sourceRoot":"","sources":["../../../src/api/app/websocket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EACL,UAAU,EACV,eAAe,EACf,cAAc,EAEd,oBAAoB,GAErB,MAAM,cAAc,CAAC;AAUtB,MAAM,OAAO,YAAY;IACvB,MAAM,CAAW;IACjB,cAAc,CAAS;
|
|
1
|
+
{"version":3,"file":"websocket.js","sourceRoot":"","sources":["../../../src/api/app/websocket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE,OAAO,EAAE,QAAQ,EAAE,MAAM,cA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,gBAAgB,CAAC,IAAI,CAAC,CACvB,CAAC;IACF,QAAQ,GAGJ,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;CACrD;AAED,MAAM,iBAAiB,GAKnB;IACF,KAAK,EAAE,CACL,GAAgC,EACI,EAAE;QACtC,OAAO;YACL,GAAG,GAAG;YACN,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC;SAC7B,CAAC;IACJ,CAAC;IACD,MAAM,EAAE,CACN,GAAwC,EACV,EAAE;QAChC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;CACF,CAAC;AAEF,MAAM,gBAAgB,GAAG,CACvB,KAAmB,EAMnB,EAAE,CAAC,CAAC;IACJ,KAAK,EAAE,CAAC,GAAmB,EAAkB,EAAE;QAC7C,IAAI,KAAK,CAAC,sBAAsB,EAAE;YAChC,OAAO;gBACL,gBAAgB,EAAE,KAAK,CAAC,sBAAsB;aAC/C,CAAC;SACH;QAED,OAAO,GAAG,CAAC;IACb,CAAC;IACD,MAAM,EAAE,CAAC,GAAoB,EAAmB,EAAE;QAChD,OAAO,GAAG,CAAC;IACb,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fetch from "cross-fetch";
|
|
2
|
-
// This is
|
|
2
|
+
// This is based on
|
|
3
|
+
// https://github.com/holochain/launcher/blob/213aae208c58f2496811d80859723b71f6750426/crates/holochain_web_app_manager/src/caddy/utils.rs#L49
|
|
3
4
|
export const LAUNCHER_ENV_URL = "/.launcher-env.json";
|
|
4
5
|
async function fetchLauncherEnvironment() {
|
|
5
6
|
const env = await fetch(LAUNCHER_ENV_URL);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.js","sourceRoot":"","sources":["../../src/environments/launcher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC,
|
|
1
|
+
{"version":3,"file":"launcher.js","sourceRoot":"","sources":["../../src/environments/launcher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC,mBAAmB;AACnB,8IAA8I;AAC9I,MAAM,CAAC,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAQtD,KAAK,UAAU,wBAAwB;IAGrC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAE1C,IAAI,GAAG,CAAC,EAAE,EAAE;QACV,MAAM,mBAAmB,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAC7C,OAAO,mBAAmB,CAAC;KAC5B;SAAM;QACL,yCAAyC;QACzC,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE;YACtB,OAAO,CAAC,IAAI,CACV,uSAAuS,CACxS,CAAC;YACF,OAAO,SAAS,CAAC;SAClB;aAAM;YACL,MAAM,IAAI,KAAK,CACb,mDAAmD,GAAG,CAAC,UAAU,EAAE,CACpE,CAAC;SACH;KACF;AACH,CAAC;AAED,MAAM,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC;AAChD,MAAM,MAAM,GACV,OAAO,OAAO,KAAK,WAAW;IAC9B,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,SAAS,CAAC;AAE3C,IAAI,OAAqB,CAAC;AAE1B,IAAI,SAAS,IAAI,CAAC,MAAM,EAAE;IACxB,OAAO,GAAG,wBAAwB,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;CAC3D;AAED,MAAM,CAAC,KAAK,UAAU,sBAAsB;IAG1C,IAAI,SAAS,EAAE;QACb,OAAO,OAAO,CAAC;KAChB;SAAM;QACL,OAAO,SAAS,CAAC;KAClB;AACH,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { AgentPubKey, DnaHash, EntryHash,
|
|
1
|
+
import { AgentPubKey, DnaHash, EntryHash, ActionHash, HoloHashed, Signature, Timestamp } from "../types.js";
|
|
2
2
|
import { EntryType } from "./entry.js";
|
|
3
|
-
export interface
|
|
3
|
+
export interface SignedActionHashed<H extends Action = Action> {
|
|
4
4
|
hashed: HoloHashed<H>;
|
|
5
5
|
signature: Signature;
|
|
6
6
|
}
|
|
7
|
-
export declare type
|
|
8
|
-
export declare enum
|
|
7
|
+
export declare type ActionHashed = HoloHashed<Action>;
|
|
8
|
+
export declare enum ActionType {
|
|
9
9
|
Dna = "Dna",
|
|
10
10
|
AgentValidationPkg = "AgentValidationPkg",
|
|
11
11
|
InitZomesComplete = "InitZomesComplete",
|
|
@@ -17,91 +17,91 @@ export declare enum HeaderType {
|
|
|
17
17
|
Update = "Update",
|
|
18
18
|
Delete = "Delete"
|
|
19
19
|
}
|
|
20
|
-
export declare type
|
|
21
|
-
export declare type
|
|
20
|
+
export declare type Action = Dna | AgentValidationPkg | InitZomesComplete | CreateLink | DeleteLink | OpenChain | CloseChain | Delete | NewEntryAction;
|
|
21
|
+
export declare type NewEntryAction = Create | Update;
|
|
22
22
|
export interface Dna {
|
|
23
|
-
type:
|
|
23
|
+
type: ActionType.Dna;
|
|
24
24
|
author: AgentPubKey;
|
|
25
25
|
timestamp: Timestamp;
|
|
26
26
|
hash: DnaHash;
|
|
27
27
|
}
|
|
28
28
|
export interface AgentValidationPkg {
|
|
29
|
-
type:
|
|
29
|
+
type: ActionType.AgentValidationPkg;
|
|
30
30
|
author: AgentPubKey;
|
|
31
31
|
timestamp: Timestamp;
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
action_seq: number;
|
|
33
|
+
prev_action: ActionHash;
|
|
34
34
|
membrane_proof: any;
|
|
35
35
|
}
|
|
36
36
|
export interface InitZomesComplete {
|
|
37
|
-
type:
|
|
37
|
+
type: ActionType.InitZomesComplete;
|
|
38
38
|
author: AgentPubKey;
|
|
39
39
|
timestamp: Timestamp;
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
action_seq: number;
|
|
41
|
+
prev_action: ActionHash;
|
|
42
42
|
}
|
|
43
43
|
export interface CreateLink {
|
|
44
|
-
type:
|
|
44
|
+
type: ActionType.CreateLink;
|
|
45
45
|
author: AgentPubKey;
|
|
46
46
|
timestamp: Timestamp;
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
action_seq: number;
|
|
48
|
+
prev_action: ActionHash;
|
|
49
49
|
base_address: EntryHash;
|
|
50
50
|
target_address: EntryHash;
|
|
51
51
|
zome_id: number;
|
|
52
52
|
tag: any;
|
|
53
53
|
}
|
|
54
54
|
export interface DeleteLink {
|
|
55
|
-
type:
|
|
55
|
+
type: ActionType.DeleteLink;
|
|
56
56
|
author: AgentPubKey;
|
|
57
57
|
timestamp: Timestamp;
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
action_seq: number;
|
|
59
|
+
prev_action: ActionHash;
|
|
60
60
|
base_address: EntryHash;
|
|
61
|
-
link_add_address:
|
|
61
|
+
link_add_address: ActionHash;
|
|
62
62
|
}
|
|
63
63
|
export interface OpenChain {
|
|
64
|
-
type:
|
|
64
|
+
type: ActionType.OpenChain;
|
|
65
65
|
author: AgentPubKey;
|
|
66
66
|
timestamp: Timestamp;
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
action_seq: number;
|
|
68
|
+
prev_action: ActionHash;
|
|
69
69
|
prev_dna_hash: DnaHash;
|
|
70
70
|
}
|
|
71
71
|
export interface CloseChain {
|
|
72
|
-
type:
|
|
72
|
+
type: ActionType.CloseChain;
|
|
73
73
|
author: AgentPubKey;
|
|
74
74
|
timestamp: Timestamp;
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
action_seq: number;
|
|
76
|
+
prev_action: ActionHash;
|
|
77
77
|
new_dna_hash: DnaHash;
|
|
78
78
|
}
|
|
79
79
|
export interface Update {
|
|
80
|
-
type:
|
|
80
|
+
type: ActionType.Update;
|
|
81
81
|
author: AgentPubKey;
|
|
82
82
|
timestamp: Timestamp;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
action_seq: number;
|
|
84
|
+
prev_action: ActionHash;
|
|
85
|
+
original_action_address: ActionHash;
|
|
86
86
|
original_entry_address: EntryHash;
|
|
87
87
|
entry_type: EntryType;
|
|
88
88
|
entry_hash: EntryHash;
|
|
89
89
|
}
|
|
90
90
|
export interface Delete {
|
|
91
|
-
type:
|
|
91
|
+
type: ActionType.Delete;
|
|
92
92
|
author: AgentPubKey;
|
|
93
93
|
timestamp: Timestamp;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
deletes_address:
|
|
94
|
+
action_seq: number;
|
|
95
|
+
prev_action: ActionHash;
|
|
96
|
+
deletes_address: ActionHash;
|
|
97
97
|
deletes_entry_address: EntryHash;
|
|
98
98
|
}
|
|
99
99
|
export interface Create {
|
|
100
|
-
type:
|
|
100
|
+
type: ActionType.Create;
|
|
101
101
|
author: AgentPubKey;
|
|
102
102
|
timestamp: Timestamp;
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
action_seq: number;
|
|
104
|
+
prev_action: ActionHash;
|
|
105
105
|
entry_type: EntryType;
|
|
106
106
|
entry_hash: EntryHash;
|
|
107
107
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export var ActionType;
|
|
2
|
+
(function (ActionType) {
|
|
3
|
+
ActionType["Dna"] = "Dna";
|
|
4
|
+
ActionType["AgentValidationPkg"] = "AgentValidationPkg";
|
|
5
|
+
ActionType["InitZomesComplete"] = "InitZomesComplete";
|
|
6
|
+
ActionType["CreateLink"] = "CreateLink";
|
|
7
|
+
ActionType["DeleteLink"] = "DeleteLink";
|
|
8
|
+
ActionType["OpenChain"] = "OpenChain";
|
|
9
|
+
ActionType["CloseChain"] = "CloseChain";
|
|
10
|
+
ActionType["Create"] = "Create";
|
|
11
|
+
ActionType["Update"] = "Update";
|
|
12
|
+
ActionType["Delete"] = "Delete";
|
|
13
|
+
})(ActionType || (ActionType = {}));
|
|
14
|
+
//# sourceMappingURL=action.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/hdk/action.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAN,IAAY,UAWX;AAXD,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,uDAAyC,CAAA;IACzC,qDAAuC,CAAA;IACvC,uCAAyB,CAAA;IACzB,uCAAyB,CAAA;IACzB,qCAAuB,CAAA;IACvB,uCAAyB,CAAA;IACzB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;AACnB,CAAC,EAXW,UAAU,KAAV,UAAU,QAWrB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ActionHash, AgentPubKey, EntryHash, Signature, Timestamp } from "../types";
|
|
2
|
+
import { EntryType } from "./entry";
|
|
3
|
+
export interface CounterSigningSessionData {
|
|
4
|
+
preflight_request: PreflightRequest;
|
|
5
|
+
responses: Array<[CountersigningAgentState, Signature]>;
|
|
6
|
+
}
|
|
7
|
+
export interface PreflightRequest {
|
|
8
|
+
app_entry_hash: EntryHash;
|
|
9
|
+
signing_agents: CounterSigningAgents;
|
|
10
|
+
enzyme_index: number | undefined;
|
|
11
|
+
session_times: CounterSigningSessionTimes;
|
|
12
|
+
action_base: ActionBase;
|
|
13
|
+
preflight_bytes: PreflightBytes;
|
|
14
|
+
}
|
|
15
|
+
export interface CounterSigningSessionTimes {
|
|
16
|
+
start: Timestamp;
|
|
17
|
+
end: Timestamp;
|
|
18
|
+
}
|
|
19
|
+
export declare type ActionBase = {
|
|
20
|
+
Create: CreateBase;
|
|
21
|
+
} | {
|
|
22
|
+
Update: UpdateBase;
|
|
23
|
+
};
|
|
24
|
+
export interface CreateBase {
|
|
25
|
+
entry_type: EntryType;
|
|
26
|
+
}
|
|
27
|
+
export interface UpdateBase {
|
|
28
|
+
original_action_address: ActionHash;
|
|
29
|
+
original_entry_address: EntryHash;
|
|
30
|
+
entry_type: EntryType;
|
|
31
|
+
}
|
|
32
|
+
export declare type CounterSigningAgents = Array<[AgentPubKey, Array<Role>]>;
|
|
33
|
+
export declare type PreflightBytes = Uint8Array;
|
|
34
|
+
export declare type Role = number;
|
|
35
|
+
export interface CountersigningAgentState {
|
|
36
|
+
agent_index: number;
|
|
37
|
+
chain_top: ActionHash;
|
|
38
|
+
action_seq: number;
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countersigning.js","sourceRoot":"","sources":["../../src/hdk/countersigning.ts"],"names":[],"mappings":""}
|
package/lib/hdk/dht-ops.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { Signature } from "../types.js";
|
|
2
2
|
import { Entry } from "./entry.js";
|
|
3
|
-
import { CreateLink, Delete, DeleteLink,
|
|
3
|
+
import { CreateLink, Delete, DeleteLink, Action, NewEntryAction, Update } from "./action.js";
|
|
4
4
|
export declare enum DhtOpType {
|
|
5
|
-
|
|
5
|
+
StoreRecord = "StoreRecord",
|
|
6
6
|
StoreEntry = "StoreEntry",
|
|
7
7
|
RegisterAgentActivity = "RegisterAgentActivity",
|
|
8
8
|
RegisterUpdatedContent = "RegisterUpdatedContent",
|
|
9
|
-
|
|
9
|
+
RegisterUpdatedRecord = "RegisterUpdatedRecord",
|
|
10
10
|
RegisterDeletedBy = "RegisterDeletedBy",
|
|
11
|
-
|
|
11
|
+
RegisterDeletedEntryAction = "RegisterDeletedEntryAction",
|
|
12
12
|
RegisterAddLink = "RegisterAddLink",
|
|
13
13
|
RegisterRemoveLink = "RegisterRemoveLink"
|
|
14
14
|
}
|
|
15
15
|
export declare type DhtOp = {
|
|
16
|
-
[DhtOpType.
|
|
16
|
+
[DhtOpType.StoreRecord]: [Signature, Action, Entry | undefined];
|
|
17
17
|
} | {
|
|
18
|
-
[DhtOpType.StoreEntry]: [Signature,
|
|
18
|
+
[DhtOpType.StoreEntry]: [Signature, NewEntryAction, Entry];
|
|
19
19
|
} | {
|
|
20
|
-
[DhtOpType.RegisterAgentActivity]: [Signature,
|
|
20
|
+
[DhtOpType.RegisterAgentActivity]: [Signature, Action];
|
|
21
21
|
} | {
|
|
22
22
|
[DhtOpType.RegisterUpdatedContent]: [
|
|
23
23
|
Signature,
|
|
@@ -25,21 +25,17 @@ export declare type DhtOp = {
|
|
|
25
25
|
Entry | undefined
|
|
26
26
|
];
|
|
27
27
|
} | {
|
|
28
|
-
[DhtOpType.
|
|
29
|
-
Signature,
|
|
30
|
-
Update,
|
|
31
|
-
Entry | undefined
|
|
32
|
-
];
|
|
28
|
+
[DhtOpType.RegisterUpdatedRecord]: [Signature, Update, Entry | undefined];
|
|
33
29
|
} | {
|
|
34
30
|
[DhtOpType.RegisterDeletedBy]: [Signature, Delete];
|
|
35
31
|
} | {
|
|
36
|
-
[DhtOpType.
|
|
32
|
+
[DhtOpType.RegisterDeletedEntryAction]: [Signature, Delete];
|
|
37
33
|
} | {
|
|
38
34
|
[DhtOpType.RegisterAddLink]: [Signature, CreateLink];
|
|
39
35
|
} | {
|
|
40
36
|
[DhtOpType.RegisterRemoveLink]: [Signature, DeleteLink];
|
|
41
37
|
};
|
|
42
38
|
export declare function getDhtOpType(op: DhtOp): DhtOpType;
|
|
43
|
-
export declare function
|
|
39
|
+
export declare function getDhtOpAction(op: DhtOp): Action;
|
|
44
40
|
export declare function getDhtOpEntry(op: DhtOp): Entry | undefined;
|
|
45
41
|
export declare function getDhtOpSignature(op: DhtOp): Signature;
|
package/lib/hdk/dht-ops.js
CHANGED
|
@@ -1,28 +1,42 @@
|
|
|
1
1
|
// https://github.com/holochain/holochain/blob/develop/crates/types/src/dht_op.rs
|
|
2
2
|
export var DhtOpType;
|
|
3
3
|
(function (DhtOpType) {
|
|
4
|
-
DhtOpType["
|
|
4
|
+
DhtOpType["StoreRecord"] = "StoreRecord";
|
|
5
5
|
DhtOpType["StoreEntry"] = "StoreEntry";
|
|
6
6
|
DhtOpType["RegisterAgentActivity"] = "RegisterAgentActivity";
|
|
7
7
|
DhtOpType["RegisterUpdatedContent"] = "RegisterUpdatedContent";
|
|
8
|
-
DhtOpType["
|
|
8
|
+
DhtOpType["RegisterUpdatedRecord"] = "RegisterUpdatedRecord";
|
|
9
9
|
DhtOpType["RegisterDeletedBy"] = "RegisterDeletedBy";
|
|
10
|
-
DhtOpType["
|
|
10
|
+
DhtOpType["RegisterDeletedEntryAction"] = "RegisterDeletedEntryAction";
|
|
11
11
|
DhtOpType["RegisterAddLink"] = "RegisterAddLink";
|
|
12
12
|
DhtOpType["RegisterRemoveLink"] = "RegisterRemoveLink";
|
|
13
13
|
})(DhtOpType || (DhtOpType = {}));
|
|
14
14
|
export function getDhtOpType(op) {
|
|
15
15
|
return Object.keys(op)[0];
|
|
16
16
|
}
|
|
17
|
-
export function
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
export function getDhtOpAction(op) {
|
|
18
|
+
const opType = getDhtOpType(op);
|
|
19
|
+
const action = Object.values(op)[0][1];
|
|
20
|
+
if (opType === DhtOpType.RegisterAddLink) {
|
|
21
|
+
return {
|
|
22
|
+
type: "CreateLink",
|
|
23
|
+
...action,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
if (opType === DhtOpType.RegisterUpdatedContent ||
|
|
27
|
+
opType === DhtOpType.RegisterUpdatedRecord) {
|
|
28
|
+
return {
|
|
29
|
+
type: "Update",
|
|
30
|
+
...action,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
if (action.author)
|
|
34
|
+
return action;
|
|
21
35
|
else {
|
|
22
|
-
const
|
|
36
|
+
const actionType = Object.keys(action)[0];
|
|
23
37
|
return {
|
|
24
|
-
type:
|
|
25
|
-
...
|
|
38
|
+
type: actionType,
|
|
39
|
+
...action[actionType],
|
|
26
40
|
};
|
|
27
41
|
}
|
|
28
42
|
}
|
package/lib/hdk/dht-ops.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dht-ops.js","sourceRoot":"","sources":["../../src/hdk/dht-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,UAAU;YAChB,GAAG,MAAM,CAAC,UAAU,CAAC;SACtB,CAAC;KACH;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,EAAS;IACrC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,EAAS;IACzC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC"}
|
package/lib/hdk/entry.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CapClaim, ZomeCallCapGrant } from "./capabilities.js";
|
|
2
2
|
import { AgentPubKey } from "../types.js";
|
|
3
|
+
import { CounterSigningSessionData } from "./countersigning.js";
|
|
3
4
|
export declare type EntryVisibility = "Public" | "Private";
|
|
4
5
|
export declare type AppEntryType = {
|
|
5
6
|
id: number;
|
|
@@ -13,4 +14,4 @@ export interface EntryContent<E extends string, C> {
|
|
|
13
14
|
entry_type: E;
|
|
14
15
|
entry: C;
|
|
15
16
|
}
|
|
16
|
-
export declare type Entry = EntryContent<"Agent", AgentPubKey> | EntryContent<"App",
|
|
17
|
+
export declare type Entry = EntryContent<"Agent", AgentPubKey> | EntryContent<"App", Uint8Array> | EntryContent<"CounterSign", [CounterSigningSessionData, Uint8Array]> | EntryContent<"CapGrant", ZomeCallCapGrant> | EntryContent<"CapClaim", CapClaim>;
|
package/lib/hdk/index.d.ts
CHANGED
package/lib/hdk/index.js
CHANGED
package/lib/hdk/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hdk/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hdk/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SignedActionHashed } from "./action.js";
|
|
2
|
+
import { Entry } from "./entry.js";
|
|
3
|
+
export declare type Record = {
|
|
4
|
+
signed_action: SignedActionHashed;
|
|
5
|
+
entry: RecordEntry;
|
|
6
|
+
};
|
|
7
|
+
export declare type RecordEntry = {
|
|
8
|
+
Present: Entry;
|
|
9
|
+
} | {
|
|
10
|
+
Hidden: void;
|
|
11
|
+
} | {
|
|
12
|
+
NotApplicable: void;
|
|
13
|
+
} | {
|
|
14
|
+
NotStored: void;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record.js","sourceRoot":"","sources":["../../src/hdk/record.ts"],"names":[],"mappings":""}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
|
package/lib/types.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ export declare type HoloHash = Uint8Array;
|
|
|
2
2
|
export declare type AgentPubKey = HoloHash;
|
|
3
3
|
export declare type DnaHash = HoloHash;
|
|
4
4
|
export declare type EntryHash = HoloHash;
|
|
5
|
-
export declare type
|
|
5
|
+
export declare type ActionHash = HoloHash;
|
|
6
6
|
export declare type AnyDhtHash = HoloHash;
|
|
7
7
|
export declare type KitsuneAgent = Uint8Array;
|
|
8
8
|
export declare type KitsuneSpace = Uint8Array;
|
|
9
9
|
export declare type InstalledAppId = string;
|
|
10
10
|
export declare type Signature = Uint8Array;
|
|
11
|
-
export declare type CellId = [
|
|
11
|
+
export declare type CellId = [DnaHash, AgentPubKey];
|
|
12
12
|
export declare type DnaProperties = any;
|
|
13
13
|
export declare type RoleId = string;
|
|
14
14
|
export declare type InstalledCell = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holochain/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
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",
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": "^14.13.1 || >=16.0.0 || >=18.0.0"
|
|
22
22
|
},
|
|
23
|
+
"main": "lib/index.js",
|
|
24
|
+
"module": "lib/index.js",
|
|
23
25
|
"type": "module",
|
|
24
26
|
"exports": {
|
|
25
27
|
".": "./lib/index.js"
|
package/lib/bundle.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { AppBundleSource } from "./api/index.js";
|
|
2
|
-
import { DnaProperties } from "./types.js";
|
|
3
|
-
export declare type HappProperties = {
|
|
4
|
-
[role_id: string]: DnaProperties;
|
|
5
|
-
};
|
|
6
|
-
export declare const appBundleWithProperties: (source: AppBundleSource, properties: HappProperties) => Promise<AppBundleSource>;
|
package/lib/bundle.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { decode } from "@msgpack/msgpack";
|
|
2
|
-
const readAppBundleFromPath = async (path) => {
|
|
3
|
-
const isBrowser = typeof window !== "undefined";
|
|
4
|
-
if (isBrowser) {
|
|
5
|
-
throw new Error("Cannot read app bundle from path in browser context");
|
|
6
|
-
}
|
|
7
|
-
const { promises: { readFile }, } = await import("node:fs");
|
|
8
|
-
const { gunzip } = await import("node:zlib");
|
|
9
|
-
const compressed = await readFile(path);
|
|
10
|
-
const encoded = await new Promise((resolve, reject) => gunzip(compressed, (err, bytes) => err === null ? resolve(bytes) : reject(err)));
|
|
11
|
-
return decode(encoded);
|
|
12
|
-
};
|
|
13
|
-
/// Adds properties to app bundle. Requires node if passed a path.
|
|
14
|
-
export const appBundleWithProperties = async (source, properties) => {
|
|
15
|
-
const originalBundle = "path" in source ? await readAppBundleFromPath(source.path) : source.bundle;
|
|
16
|
-
return {
|
|
17
|
-
bundle: {
|
|
18
|
-
...originalBundle,
|
|
19
|
-
manifest: {
|
|
20
|
-
...originalBundle.manifest,
|
|
21
|
-
roles: originalBundle.manifest.roles.map((roleManifest) => ({
|
|
22
|
-
...roleManifest,
|
|
23
|
-
dna: {
|
|
24
|
-
...roleManifest.dna,
|
|
25
|
-
properties: properties[roleManifest.id],
|
|
26
|
-
},
|
|
27
|
-
})),
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=bundle.js.map
|
package/lib/bundle.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAM1C,MAAM,qBAAqB,GAAG,KAAK,EAAE,IAAY,EAAsB,EAAE;IACvE,MAAM,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC;IAChD,IAAI,SAAS,EAAE;QACb,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;KACxE;IACD,MAAM,EACJ,QAAQ,EAAE,EAAE,QAAQ,EAAE,GACvB,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC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Type["Dna"] = "Dna";
|
|
4
|
-
HeaderType["AgentValidationPkg"] = "AgentValidationPkg";
|
|
5
|
-
HeaderType["InitZomesComplete"] = "InitZomesComplete";
|
|
6
|
-
HeaderType["CreateLink"] = "CreateLink";
|
|
7
|
-
HeaderType["DeleteLink"] = "DeleteLink";
|
|
8
|
-
HeaderType["OpenChain"] = "OpenChain";
|
|
9
|
-
HeaderType["CloseChain"] = "CloseChain";
|
|
10
|
-
HeaderType["Create"] = "Create";
|
|
11
|
-
HeaderType["Update"] = "Update";
|
|
12
|
-
HeaderType["Delete"] = "Delete";
|
|
13
|
-
})(HeaderType || (HeaderType = {}));
|
|
14
|
-
//# sourceMappingURL=header.js.map
|