@holochain/client 0.3.1 → 0.3.2

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.
Files changed (54) hide show
  1. package/README.md +5 -5
  2. package/lib/types/dht-ops.js.map +1 -1
  3. package/lib.es/api/admin.d.ts +224 -0
  4. package/lib.es/api/admin.js +9 -0
  5. package/lib.es/api/admin.js.map +1 -0
  6. package/lib.es/api/app.d.ts +32 -0
  7. package/lib.es/api/app.js +2 -0
  8. package/lib.es/api/app.js.map +1 -0
  9. package/lib.es/api/common.d.ts +16 -0
  10. package/lib.es/api/common.js +17 -0
  11. package/lib.es/api/common.js.map +1 -0
  12. package/lib.es/api/state-dump.d.ts +36 -0
  13. package/lib.es/api/state-dump.js +2 -0
  14. package/lib.es/api/state-dump.js.map +1 -0
  15. package/lib.es/api/types.d.ts +39 -0
  16. package/lib.es/api/types.js +4 -0
  17. package/lib.es/api/types.js.map +1 -0
  18. package/lib.es/environments/launcher.d.ts +8 -0
  19. package/lib.es/environments/launcher.js +35 -0
  20. package/lib.es/environments/launcher.js.map +1 -0
  21. package/lib.es/index.d.ts +6 -0
  22. package/lib.es/index.js +7 -0
  23. package/lib.es/index.js.map +1 -0
  24. package/lib.es/types/capabilities.d.ts +30 -0
  25. package/lib.es/types/capabilities.js +2 -0
  26. package/lib.es/types/capabilities.js.map +1 -0
  27. package/lib.es/types/common.d.ts +22 -0
  28. package/lib.es/types/common.js +2 -0
  29. package/lib.es/types/common.js.map +1 -0
  30. package/lib.es/types/dht-ops.d.ts +45 -0
  31. package/lib.es/types/dht-ops.js +35 -0
  32. package/lib.es/types/dht-ops.js.map +1 -0
  33. package/lib.es/types/entry.d.ts +16 -0
  34. package/lib.es/types/entry.js +2 -0
  35. package/lib.es/types/entry.js.map +1 -0
  36. package/lib.es/types/header.d.ts +108 -0
  37. package/lib.es/types/header.js +14 -0
  38. package/lib.es/types/header.js.map +1 -0
  39. package/lib.es/types/index.d.ts +5 -0
  40. package/lib.es/types/index.js +6 -0
  41. package/lib.es/types/index.js.map +1 -0
  42. package/lib.es/websocket/admin.d.ts +47 -0
  43. package/lib.es/websocket/admin.js +104 -0
  44. package/lib.es/websocket/admin.js.map +1 -0
  45. package/lib.es/websocket/app.d.ts +13 -0
  46. package/lib.es/websocket/app.js +66 -0
  47. package/lib.es/websocket/app.js.map +1 -0
  48. package/lib.es/websocket/client.d.ts +25 -0
  49. package/lib.es/websocket/client.js +122 -0
  50. package/lib.es/websocket/client.js.map +1 -0
  51. package/lib.es/websocket/common.d.ts +3 -0
  52. package/lib.es/websocket/common.js +29 -0
  53. package/lib.es/websocket/common.js.map +1 -0
  54. package/package.json +6 -3
package/README.md CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  [![Project](https://img.shields.io/badge/Project-Holochain-blue.svg?style=flat-square)](http://holochain.org/)
4
4
  [![Forum](https://img.shields.io/badge/Forum-forum%2eholochain%2enet-blue.svg?style=flat-square)](https://forum.holochain.org)
5
- ![CI](https://github.com/holochain/holochain-client-js/actions/workflows/test.yml/badge.svg?branch=main)
5
+ [![License: CAL 1.0](https://img.shields.io/badge/License-CAL%201.0-blue.svg)](https://github.com/holochain/cryptographic-autonomy-license)
6
+ ![Test](https://github.com/holochain/holochain-client-js/actions/workflows/test.yml/badge.svg?branch=main)
6
7
 
7
8
  [![Twitter Follow](https://img.shields.io/twitter/follow/holochain.svg?style=social&label=Follow)](https://twitter.com/holochain)
8
- License: [![License: CAL 1.0](https://img.shields.io/badge/License-CAL%201.0-blue.svg)](https://github.com/holochain/cryptographic-autonomy-license)
9
9
 
10
- A Nodejs client for the Holochain Conductor API
10
+ A JavaScript client for the Holochain Conductor API (works with browsers as well as Nodejs)
11
11
 
12
12
  > Holochain's Conductor API is under active development. This client package tracks that development fairly closely but sometimes gets behind.
13
13
 
@@ -58,8 +58,8 @@ See [docs/API.md](docs/API.md)
58
58
  # Holochain Compatibility
59
59
 
60
60
  This version of `@holochain/client` is currently working with
61
- - `holochain/holochain` at tag [holochain-0.0.121](https://github.com/holochain/holochain/tree/holochain-0.0.121)
62
- - hdk version [0.0.117 from crates.io](https://crates.io/crates/hdk/0.0.117)
61
+ - `holochain/holochain` at tag [holochain-0.0.122](https://github.com/holochain/holochain/tree/holochain-0.0.122)
62
+ - hdk version [0.0.118 from crates.io](https://crates.io/crates/hdk/0.0.118)
63
63
 
64
64
  If updating this code, please make changes to the git `rev/sha` above. (You can get this from `hn-introspect` after updating the holonix-hash)
65
65
 
@@ -1 +1 @@
1
- {"version":3,"file":"dht-ops.js","sourceRoot":"","sources":["../../src/types/dht-ops.ts"],"names":[],"mappings":";;;AAcA,iFAAiF;AAEjF,IAAY,SAUX;AAVD,WAAY,SAAS;IACnB,0CAA6B,CAAA;IAC7B,sCAAyB,CAAA;IACzB,4DAA+C,CAAA;IAC/C,8DAAiD,CAAA;IACjD,8DAAiD,CAAA;IACjD,oDAAuC,CAAA;IACvC,sEAAyD,CAAA;IACzD,gDAAmC,CAAA;IACnC,sDAAyC,CAAA;AAC3C,CAAC,EAVW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAUpB;AAyBD,SAAgB,YAAY,CAAC,EAAS;IACpC,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAc,CAAA;AACxC,CAAC;AAFD,oCAEC;AAED,SAAgB,cAAc,CAAC,EAAS;IACtC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAEtC,IAAI,MAAM,CAAC,MAAM;QAAE,OAAO,MAAM,CAAA;SAC3B;QACH,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;QACzC,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,GAAG,MAAM,CAAC,UAAU,CAAC;SACtB,CAAA;KACF;AACH,CAAC;AAXD,wCAWC;AAED,SAAgB,aAAa,CAAC,EAAS;IACrC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAChC,CAAC;AAFD,sCAEC;AAED,SAAgB,iBAAiB,CAAC,EAAS;IACzC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAChC,CAAC;AAFD,8CAEC"}
1
+ {"version":3,"file":"dht-ops.js","sourceRoot":"","sources":["../../src/types/dht-ops.ts"],"names":[],"mappings":";;;AAWA,iFAAiF;AAEjF,IAAY,SAUX;AAVD,WAAY,SAAS;IACnB,0CAA6B,CAAA;IAC7B,sCAAyB,CAAA;IACzB,4DAA+C,CAAA;IAC/C,8DAAiD,CAAA;IACjD,8DAAiD,CAAA;IACjD,oDAAuC,CAAA;IACvC,sEAAyD,CAAA;IACzD,gDAAmC,CAAA;IACnC,sDAAyC,CAAA;AAC3C,CAAC,EAVW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAUpB;AAyBD,SAAgB,YAAY,CAAC,EAAS;IACpC,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAc,CAAA;AACxC,CAAC;AAFD,oCAEC;AAED,SAAgB,cAAc,CAAC,EAAS;IACtC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAEtC,IAAI,MAAM,CAAC,MAAM;QAAE,OAAO,MAAM,CAAA;SAC3B;QACH,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;QACzC,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,GAAG,MAAM,CAAC,UAAU,CAAC;SACtB,CAAA;KACF;AACH,CAAC;AAXD,wCAWC;AAED,SAAgB,aAAa,CAAC,EAAS;IACrC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAChC,CAAC;AAFD,sCAEC;AAED,SAAgB,iBAAiB,CAAC,EAAS;IACzC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAChC,CAAC;AAFD,8CAEC"}
@@ -0,0 +1,224 @@
1
+ /// <reference types="node" />
2
+ import { Requester } from "./common";
3
+ import { HoloHash, AgentPubKey, DnaProperties, InstalledAppId, CellId, RoleId } from "../types/common";
4
+ import { InstalledAppInfo, MembraneProof } from "./types";
5
+ import { FullStateDump } from "./state-dump";
6
+ export declare type AttachAppInterfaceRequest = {
7
+ port: number;
8
+ };
9
+ export declare type AttachAppInterfaceResponse = {
10
+ port: number;
11
+ };
12
+ export declare type ActivateAppRequest = EnableAppRequest;
13
+ export declare type ActivateAppResponse = EnableAppResponse;
14
+ export declare type DeactivateAppRequest = {
15
+ installed_app_id: InstalledAppId;
16
+ };
17
+ export declare type DeactivateAppResponse = null;
18
+ export declare type EnableAppRequest = {
19
+ installed_app_id: InstalledAppId;
20
+ };
21
+ export declare type EnableAppResponse = {
22
+ app: InstalledAppInfo;
23
+ errors: Array<[CellId, string]>;
24
+ };
25
+ export declare type DisableAppRequest = {
26
+ installed_app_id: InstalledAppId;
27
+ };
28
+ export declare type DisableAppResponse = null;
29
+ export declare type StartAppRequest = {
30
+ installed_app_id: InstalledAppId;
31
+ };
32
+ export declare type StartAppResponse = boolean;
33
+ export declare type DumpStateRequest = {
34
+ cell_id: CellId;
35
+ };
36
+ export declare type DumpStateResponse = any;
37
+ export declare type DumpFullStateRequest = {
38
+ cell_id: CellId;
39
+ dht_ops_cursor: number | undefined;
40
+ };
41
+ export declare type DumpFullStateResponse = FullStateDump;
42
+ export declare type GenerateAgentPubKeyRequest = void;
43
+ export declare type GenerateAgentPubKeyResponse = AgentPubKey;
44
+ export declare type RegisterDnaRequest = {
45
+ uid?: string;
46
+ properties?: DnaProperties;
47
+ } & DnaSource;
48
+ export declare type RegisterDnaResponse = HoloHash;
49
+ export declare type InstallAppRequest = {
50
+ installed_app_id: InstalledAppId;
51
+ agent_key: AgentPubKey;
52
+ dnas: Array<InstallAppDnaPayload>;
53
+ };
54
+ export declare type InstallAppResponse = InstalledAppInfo;
55
+ export declare type UninstallAppRequest = {
56
+ installed_app_id: InstalledAppId;
57
+ };
58
+ export declare type UninstallAppResponse = null;
59
+ export declare type CreateCloneCellRequest = {
60
+ properties?: DnaProperties;
61
+ dna_hash: HoloHash;
62
+ agent_key: AgentPubKey;
63
+ installed_app_id: InstalledAppId;
64
+ role_id: RoleId;
65
+ membrane_proof?: MembraneProof;
66
+ };
67
+ export declare type CreateCloneCellResponse = CellId;
68
+ export declare type ResourceBytes = Buffer;
69
+ export declare type ResourceMap = {
70
+ [key: string]: ResourceBytes;
71
+ };
72
+ export declare type CellProvisioning = {
73
+ create: {
74
+ deferred: boolean;
75
+ };
76
+ } | {
77
+ create_clone: {
78
+ deferred: boolean;
79
+ };
80
+ } | {
81
+ use_existing: {
82
+ deferred: boolean;
83
+ };
84
+ } | {
85
+ create_if_no_exists: {
86
+ deferred: boolean;
87
+ };
88
+ } | {
89
+ disabled: Record<string, never>;
90
+ };
91
+ export declare type HoloHashB64 = string;
92
+ export declare type DnaVersionSpec = Array<HoloHashB64>;
93
+ export declare type DnaVersionFlexible = {
94
+ singleton: HoloHashB64;
95
+ } | {
96
+ multiple: DnaVersionSpec;
97
+ };
98
+ export declare type AppRoleDnaManifest = {
99
+ location?: Location;
100
+ properties?: DnaProperties;
101
+ uid?: string;
102
+ version?: DnaVersionFlexible;
103
+ };
104
+ export declare type AppRoleManifest = {
105
+ id: RoleId;
106
+ provisioning?: CellProvisioning;
107
+ dna: AppRoleDnaManifest;
108
+ };
109
+ export declare type AppManifest = {
110
+ manifest_version: string;
111
+ name: string;
112
+ description?: string;
113
+ roles: Array<AppRoleManifest>;
114
+ };
115
+ export declare type AppBundle = {
116
+ manifest: AppManifest;
117
+ resources: ResourceMap;
118
+ };
119
+ export declare type AppBundleSource = {
120
+ bundle: AppBundle;
121
+ } | {
122
+ path: string;
123
+ };
124
+ export declare type Uid = string;
125
+ export declare type InstallAppBundleRequest = {
126
+ agent_key: AgentPubKey;
127
+ installed_app_id?: InstalledAppId;
128
+ membrane_proofs: {
129
+ [key: string]: MembraneProof;
130
+ };
131
+ uid?: Uid;
132
+ } & AppBundleSource;
133
+ export declare type InstallAppBundleResponse = InstalledAppInfo;
134
+ export declare type ListDnasRequest = void;
135
+ export declare type ListDnasResponse = Array<string>;
136
+ export declare type ListCellIdsRequest = void;
137
+ export declare type ListCellIdsResponse = Array<CellId>;
138
+ export declare type ListActiveAppsRequest = void;
139
+ export declare type ListActiveAppsResponse = Array<InstalledAppId>;
140
+ export declare enum AppStatusFilter {
141
+ Enabled = "enabled",
142
+ Disabled = "disabled",
143
+ Running = "running",
144
+ Stopped = "stopped",
145
+ Paused = "paused"
146
+ }
147
+ export declare type ListAppsRequest = {
148
+ status_filter?: AppStatusFilter;
149
+ };
150
+ export declare type ListAppsResponse = Array<InstalledAppInfo>;
151
+ export declare type ListAppInterfacesRequest = void;
152
+ export declare type ListAppInterfacesResponse = Array<number>;
153
+ export declare type AgentInfoSigned = any;
154
+ export declare type RequestAgentInfoRequest = {
155
+ cell_id: CellId | null;
156
+ };
157
+ export declare type RequestAgentInfoResponse = Array<AgentInfoSigned>;
158
+ export declare type AddAgentInfoRequest = {
159
+ agent_infos: Array<AgentInfoSigned>;
160
+ };
161
+ export declare type AddAgentInfoResponse = any;
162
+ export interface AdminApi {
163
+ attachAppInterface: Requester<AttachAppInterfaceRequest, AttachAppInterfaceResponse>;
164
+ activateApp: Requester<ActivateAppRequest, ActivateAppResponse>;
165
+ deactivateApp: Requester<DeactivateAppRequest, DeactivateAppResponse>;
166
+ enableApp: Requester<EnableAppRequest, EnableAppResponse>;
167
+ disableApp: Requester<DisableAppRequest, DisableAppResponse>;
168
+ startApp: Requester<StartAppRequest, StartAppResponse>;
169
+ dumpState: Requester<DumpStateRequest, DumpStateResponse>;
170
+ dumpFullState: Requester<DumpFullStateRequest, DumpFullStateResponse>;
171
+ generateAgentPubKey: Requester<GenerateAgentPubKeyRequest, GenerateAgentPubKeyResponse>;
172
+ registerDna: Requester<RegisterDnaRequest, RegisterDnaResponse>;
173
+ installApp: Requester<InstallAppRequest, InstallAppResponse>;
174
+ uninstallApp: Requester<UninstallAppRequest, UninstallAppResponse>;
175
+ createCloneCell: Requester<CreateCloneCellRequest, CreateCloneCellResponse>;
176
+ installAppBundle: Requester<InstallAppBundleRequest, InstallAppBundleResponse>;
177
+ listDnas: Requester<ListDnasRequest, ListDnasResponse>;
178
+ listCellIds: Requester<ListCellIdsRequest, ListCellIdsResponse>;
179
+ listActiveApps: Requester<ListActiveAppsRequest, ListActiveAppsResponse>;
180
+ listApps: Requester<ListAppsRequest, ListAppsResponse>;
181
+ listAppInterfaces: Requester<ListAppInterfacesRequest, ListAppInterfacesResponse>;
182
+ requestAgentInfo: Requester<RequestAgentInfoRequest, RequestAgentInfoResponse>;
183
+ addAgentInfo: Requester<AddAgentInfoRequest, AddAgentInfoResponse>;
184
+ }
185
+ export declare type InstallAppDnaPayload = {
186
+ hash: HoloHash;
187
+ role_id: RoleId;
188
+ membrane_proof?: MembraneProof;
189
+ };
190
+ export declare type ZomeLocation = {
191
+ bundled: string;
192
+ } | {
193
+ path: string;
194
+ } | {
195
+ url: string;
196
+ };
197
+ export declare type ZomeManifest = {
198
+ name: string;
199
+ hash?: string;
200
+ } & ZomeLocation;
201
+ export declare type DnaManifest = {
202
+ manifest_version: string;
203
+ name: string;
204
+ uid?: string;
205
+ properties?: DnaProperties;
206
+ zomes: Array<ZomeManifest>;
207
+ };
208
+ export declare type DnaBundle = {
209
+ manifest: DnaManifest;
210
+ resources: ResourceMap;
211
+ };
212
+ export declare type DnaSource = {
213
+ hash: HoloHash;
214
+ } | {
215
+ path: string;
216
+ } | {
217
+ bundle: DnaBundle;
218
+ };
219
+ export declare type Zomes = Array<[string, {
220
+ wasm_hash: Array<HoloHash>;
221
+ }]>;
222
+ export declare type WasmCode = [HoloHash, {
223
+ code: Array<number>;
224
+ }];
@@ -0,0 +1,9 @@
1
+ export var AppStatusFilter;
2
+ (function (AppStatusFilter) {
3
+ AppStatusFilter["Enabled"] = "enabled";
4
+ AppStatusFilter["Disabled"] = "disabled";
5
+ AppStatusFilter["Running"] = "running";
6
+ AppStatusFilter["Stopped"] = "stopped";
7
+ AppStatusFilter["Paused"] = "paused";
8
+ })(AppStatusFilter || (AppStatusFilter = {}));
9
+ //# sourceMappingURL=admin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin.js","sourceRoot":"","sources":["../../src/api/admin.ts"],"names":[],"mappings":"AAsLA,MAAM,CAAN,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,wCAAqB,CAAA;IACrB,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;IACnB,oCAAiB,CAAA;AACnB,CAAC,EANW,eAAe,KAAf,eAAe,QAM1B"}
@@ -0,0 +1,32 @@
1
+ import { Requester } from "./common";
2
+ import { CellId, AgentPubKey, InstalledAppId } from "../types/common";
3
+ import { InstalledAppInfo } from "./types";
4
+ import { CapSecret } from "../types/capabilities";
5
+ export declare type CallZomeRequestGeneric<Payload> = {
6
+ cap_secret: CapSecret | null;
7
+ cell_id: CellId;
8
+ zome_name: string;
9
+ fn_name: string;
10
+ payload: Payload;
11
+ provenance: AgentPubKey;
12
+ };
13
+ export declare type CallZomeResponseGeneric<Payload> = Payload;
14
+ export declare type CallZomeRequest = CallZomeRequestGeneric<any>;
15
+ export declare type CallZomeResponse = CallZomeResponseGeneric<any>;
16
+ export declare type AppInfoRequest = {
17
+ installed_app_id: InstalledAppId;
18
+ };
19
+ export declare type AppInfoResponse = InstalledAppInfo;
20
+ export declare type AppSignal = {
21
+ type: string;
22
+ data: {
23
+ cellId: CellId;
24
+ payload: any;
25
+ };
26
+ };
27
+ export declare type AppSignalCb = (signal: AppSignal) => void;
28
+ export declare type SignalResponseGeneric<Payload> = Payload;
29
+ export interface AppApi {
30
+ appInfo: Requester<AppInfoRequest, AppInfoResponse>;
31
+ callZome: Requester<CallZomeRequest, CallZomeResponse>;
32
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/api/app.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Take a Requester function which deals with tagged requests and responses,
3
+ * and return a Requester which deals only with the inner data types, also
4
+ * with the optional Transformer applied to further modify the input and output.
5
+ */
6
+ export declare const requesterTransformer: <ReqO, ReqI, ResI, ResO>(requester: Requester<Tagged<ReqI>, Tagged<ResI>>, tag: string, transform?: Transformer<ReqO, ReqI, ResI, ResO>) => (req: ReqO, timeout?: number | undefined) => Promise<ResO>;
7
+ export declare type Transformer<ReqO, ReqI, ResI, ResO> = {
8
+ input: (req: ReqO) => ReqI;
9
+ output: (res: ResI) => ResO;
10
+ };
11
+ export declare type Requester<Req, Res> = (req: Req, timeout?: number) => Promise<Res>;
12
+ export declare type RequesterUnit<Res> = () => Promise<Res>;
13
+ export declare type Tagged<T> = {
14
+ type: string;
15
+ data: T;
16
+ };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Take a Requester function which deals with tagged requests and responses,
3
+ * and return a Requester which deals only with the inner data types, also
4
+ * with the optional Transformer applied to further modify the input and output.
5
+ */
6
+ export const requesterTransformer = (requester, tag, transform = identityTransformer) => (async (req, timeout) => {
7
+ const input = { type: tag, data: transform.input(req) };
8
+ const response = await requester(input, timeout);
9
+ const output = transform.output(response.data);
10
+ return output;
11
+ });
12
+ const identity = (x) => x;
13
+ const identityTransformer = {
14
+ input: identity,
15
+ output: identity,
16
+ };
17
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/api/common.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAC/B,CACE,SAAgD,EAChD,GAAW,EACX,YAAiD,mBAAmB,EACpE,EAAE,CAAC,CACH,KAAK,EAAE,GAAS,EAAE,OAAgB,EAAE,EAAE;IACpC,MAAM,KAAK,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAA;IACvD,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAChD,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IAC9C,OAAO,MAAM,CAAA;AACf,CAAC,CACF,CAAA;AAOH,MAAM,QAAQ,GAAG,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAA;AAC9B,MAAM,mBAAmB,GAAG;IAC1B,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,QAAQ;CACjB,CAAA"}
@@ -0,0 +1,36 @@
1
+ import { AgentPubKey, DnaHash, HeaderHash, KitsuneAgent, KitsuneSpace, Signature } from "../types/common";
2
+ import { DhtOp } from "../types/dht-ops";
3
+ import { Entry } from "../types/entry";
4
+ import { Header } from "../types/header";
5
+ export interface AgentInfoDump {
6
+ kitsune_agent: KitsuneAgent;
7
+ kitsune_space: KitsuneSpace;
8
+ dump: string;
9
+ }
10
+ export interface P2pAgentsDump {
11
+ this_agent_info: AgentInfoDump | undefined;
12
+ this_dna: [DnaHash, KitsuneSpace] | undefined;
13
+ this_agent: [AgentPubKey, KitsuneAgent] | undefined;
14
+ peers: Array<AgentInfoDump>;
15
+ }
16
+ export interface FullIntegrationStateDump {
17
+ validation_limbo: Array<DhtOp>;
18
+ integration_limbo: Array<DhtOp>;
19
+ integrated: Array<DhtOp>;
20
+ dht_ops_cursor: number;
21
+ }
22
+ export interface SourceChainJsonElement {
23
+ signature: Signature;
24
+ header_address: HeaderHash;
25
+ header: Header;
26
+ entry: Entry | undefined;
27
+ }
28
+ export interface SourceChainJsonDump {
29
+ elements: Array<SourceChainJsonElement>;
30
+ published_ops_count: number;
31
+ }
32
+ export interface FullStateDump {
33
+ peer_dump: P2pAgentsDump;
34
+ source_chain_dump: SourceChainJsonDump;
35
+ integration_dump: FullIntegrationStateDump;
36
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=state-dump.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-dump.js","sourceRoot":"","sources":["../../src/api/state-dump.ts"],"names":[],"mappings":""}
@@ -0,0 +1,39 @@
1
+ /// <reference types="node" />
2
+ import { InstalledAppId, InstalledCell } from "../types/common";
3
+ export declare type DeactivationReason = {
4
+ never_activated: null;
5
+ } | {
6
+ normal: null;
7
+ } | {
8
+ quarantined: {
9
+ error: string;
10
+ };
11
+ };
12
+ export declare type PausedAppReason = {
13
+ error: string;
14
+ };
15
+ export declare type DisabledAppReason = {
16
+ never_started: null;
17
+ } | {
18
+ user: null;
19
+ } | {
20
+ error: string;
21
+ };
22
+ export declare type InstalledAppInfoStatus = {
23
+ paused: {
24
+ reason: PausedAppReason;
25
+ };
26
+ } | {
27
+ disabled: {
28
+ reason: DisabledAppReason;
29
+ };
30
+ } | {
31
+ running: null;
32
+ };
33
+ export declare type InstalledAppInfo = {
34
+ installed_app_id: InstalledAppId;
35
+ cell_data: Array<InstalledCell>;
36
+ status: InstalledAppInfoStatus;
37
+ };
38
+ export declare type MembraneProof = Buffer;
39
+ export declare const fakeAgentPubKey: () => Buffer;
@@ -0,0 +1,4 @@
1
+ export const fakeAgentPubKey = () => Buffer.from([0x84, 0x20, 0x24].concat("000000000000000000000000000000000000"
2
+ .split("")
3
+ .map((x) => parseInt(x, 10))));
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAqCA,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE,CAClC,MAAM,CAAC,IAAI,CACT,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,MAAM,CACvB,sCAAsC;KACnC,KAAK,CAAC,EAAE,CAAC;KACT,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAC/B,CACF,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { InstalledAppId } from "../types/common";
2
+ export declare const LAUNCHER_ENV_URL = "/.launcher-env.json";
3
+ export interface LauncherEnvironment {
4
+ APP_INTERFACE_PORT: number;
5
+ ADMIN_INTERFACE_PORT: number;
6
+ INSTALLED_APP_ID: InstalledAppId;
7
+ }
8
+ export declare function getLauncherEnvironment(): Promise<LauncherEnvironment | undefined>;
@@ -0,0 +1,35 @@
1
+ import fetch from "cross-fetch";
2
+ // This is coupled with https://github.com/holochain/launcher/blob/develop/src-tauri/src/uis/caddy.rs#L13
3
+ export const LAUNCHER_ENV_URL = "/.launcher-env.json";
4
+ async function fetchLauncherEnvironment() {
5
+ const env = await fetch(LAUNCHER_ENV_URL);
6
+ if (env.ok) {
7
+ const launcherEnvironment = await env.json();
8
+ return launcherEnvironment;
9
+ }
10
+ else {
11
+ // We are not in the launcher environment
12
+ if (env.status === 404) {
13
+ console.warn("[@holochain/conductor-api]: you are in a development environment. When this UI is run in the Holochain Launcher, `AppWebsocket.connect()`, `AdminWebsocket.connect()` and `appWebsocket.appInfo()` will have their parameters ignored and substituted by the ones provided by the Holochain Launcher.");
14
+ return undefined;
15
+ }
16
+ else {
17
+ throw new Error(`Error trying to fetch the launcher environment: ${env.statusText}`);
18
+ }
19
+ }
20
+ }
21
+ const isBrowser = typeof window !== "undefined";
22
+ const isJest = typeof process !== "undefined" && process.env && process.env.JEST_WORKER_ID !== undefined;
23
+ let promise;
24
+ if (isBrowser && !isJest) {
25
+ promise = fetchLauncherEnvironment().catch(console.error);
26
+ }
27
+ export async function getLauncherEnvironment() {
28
+ if (isBrowser) {
29
+ return promise;
30
+ }
31
+ else {
32
+ return undefined;
33
+ }
34
+ }
35
+ //# sourceMappingURL=launcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launcher.js","sourceRoot":"","sources":["../../src/environments/launcher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,aAAa,CAAA;AAE/B,yGAAyG;AACzG,MAAM,CAAC,MAAM,gBAAgB,GAAG,qBAAqB,CAAA;AAQrD,KAAK,UAAU,wBAAwB;IAGrC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,gBAAgB,CAAC,CAAA;IAEzC,IAAI,GAAG,CAAC,EAAE,EAAE;QACV,MAAM,mBAAmB,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAA;QAC5C,OAAO,mBAAmB,CAAA;KAC3B;SAAM;QACL,yCAAyC;QACzC,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE;YACtB,OAAO,CAAC,IAAI,CACV,uSAAuS,CACxS,CAAA;YACD,OAAO,SAAS,CAAA;SACjB;aAAM;YACL,MAAM,IAAI,KAAK,CACb,mDAAmD,GAAG,CAAC,UAAU,EAAE,CACpE,CAAA;SACF;KACF;AACH,CAAC;AAED,MAAM,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW,CAAA;AAC/C,MAAM,MAAM,GACV,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,SAAS,CAAA;AAE3F,IAAI,OAAqB,CAAA;AAEzB,IAAI,SAAS,IAAI,CAAC,MAAM,EAAE;IACxB,OAAO,GAAG,wBAAwB,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;CAC1D;AAED,MAAM,CAAC,KAAK,UAAU,sBAAsB;IAG1C,IAAI,SAAS,EAAE;QACb,OAAO,OAAO,CAAA;KACf;SAAM;QACL,OAAO,SAAS,CAAA;KACjB;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './api/admin';
2
+ export * from './api/app';
3
+ export * from './api/types';
4
+ export * from './websocket/admin';
5
+ export * from './websocket/app';
6
+ export * from './types';
@@ -0,0 +1,7 @@
1
+ export * from './api/admin';
2
+ export * from './api/app';
3
+ export * from './api/types';
4
+ export * from './websocket/admin';
5
+ export * from './websocket/app';
6
+ export * from './types';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { AgentPubKey } from "./common";
2
+ export declare type CapSecret = Uint8Array;
3
+ export interface CapClaim {
4
+ tag: string;
5
+ grantor: AgentPubKey;
6
+ secret: CapSecret;
7
+ }
8
+ export interface ZomeCallCapGrant {
9
+ tag: string;
10
+ access: CapAccess;
11
+ functions: Array<{
12
+ zome: string;
13
+ fn_name: string;
14
+ }>;
15
+ }
16
+ export declare type CapAccess = "Unrestricted" | {
17
+ Transferable: {
18
+ secret: CapSecret;
19
+ };
20
+ } | {
21
+ Assigned: {
22
+ secret: CapSecret;
23
+ assignees: AgentPubKey[];
24
+ };
25
+ };
26
+ export declare type CapGrant = {
27
+ ChainAuthor: AgentPubKey;
28
+ } | {
29
+ RemoteAgent: ZomeCallCapGrant;
30
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=capabilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../src/types/capabilities.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ export declare type HoloHash = Uint8Array;
2
+ export declare type AgentPubKey = HoloHash;
3
+ export declare type DnaHash = HoloHash;
4
+ export declare type EntryHash = HoloHash;
5
+ export declare type HeaderHash = HoloHash;
6
+ export declare type AnyDhtHash = HoloHash;
7
+ export declare type KitsuneAgent = Uint8Array;
8
+ export declare type KitsuneSpace = Uint8Array;
9
+ export declare type InstalledAppId = string;
10
+ export declare type Signature = Uint8Array;
11
+ export declare type CellId = [HoloHash, AgentPubKey];
12
+ export declare type DnaProperties = any;
13
+ export declare type RoleId = string;
14
+ export declare type InstalledCell = {
15
+ cell_id: CellId;
16
+ role_id: RoleId;
17
+ };
18
+ export declare type Timestamp = number;
19
+ export interface HoloHashed<T> {
20
+ hash: HoloHash;
21
+ content: T;
22
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":""}
@@ -0,0 +1,45 @@
1
+ import { CreateLink, Delete, DeleteLink, Header, NewEntryHeader, Update } from "./header";
2
+ import { Entry } from "./entry";
3
+ import { Signature } from "./common";
4
+ export declare enum DhtOpType {
5
+ StoreElement = "StoreElement",
6
+ StoreEntry = "StoreEntry",
7
+ RegisterAgentActivity = "RegisterAgentActivity",
8
+ RegisterUpdatedContent = "RegisterUpdatedContent",
9
+ RegisterUpdatedElement = "RegisterUpdatedElement",
10
+ RegisterDeletedBy = "RegisterDeletedBy",
11
+ RegisterDeletedEntryHeader = "RegisterDeletedEntryHeader",
12
+ RegisterAddLink = "RegisterAddLink",
13
+ RegisterRemoveLink = "RegisterRemoveLink"
14
+ }
15
+ export declare type DhtOp = {
16
+ [DhtOpType.StoreElement]: [Signature, Header, Entry | undefined];
17
+ } | {
18
+ [DhtOpType.StoreEntry]: [Signature, NewEntryHeader, Entry];
19
+ } | {
20
+ [DhtOpType.RegisterAgentActivity]: [Signature, Header];
21
+ } | {
22
+ [DhtOpType.RegisterUpdatedContent]: [
23
+ Signature,
24
+ Update,
25
+ Entry | undefined
26
+ ];
27
+ } | {
28
+ [DhtOpType.RegisterUpdatedElement]: [
29
+ Signature,
30
+ Update,
31
+ Entry | undefined
32
+ ];
33
+ } | {
34
+ [DhtOpType.RegisterDeletedBy]: [Signature, Delete];
35
+ } | {
36
+ [DhtOpType.RegisterDeletedEntryHeader]: [Signature, Delete];
37
+ } | {
38
+ [DhtOpType.RegisterAddLink]: [Signature, CreateLink];
39
+ } | {
40
+ [DhtOpType.RegisterRemoveLink]: [Signature, DeleteLink];
41
+ };
42
+ export declare function getDhtOpType(op: DhtOp): DhtOpType;
43
+ export declare function getDhtOpHeader(op: DhtOp): Header;
44
+ export declare function getDhtOpEntry(op: DhtOp): Entry | undefined;
45
+ export declare function getDhtOpSignature(op: DhtOp): Signature;