@holochain/client 0.13.0 → 0.14.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/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  [![Project](https://img.shields.io/badge/Project-Holochain-blue.svg?style=flat-square)](http://holochain.org/)
2
2
  [![Discord](https://img.shields.io/badge/Discord-DEV.HC-blue.svg?style=flat-square)](https://discord.gg/k55DS5dmPH)
3
3
  [![License: CAL 1.0](https://img.shields.io/badge/License-CAL%201.0-blue.svg)](https://github.com/holochain/cryptographic-autonomy-license)
4
- ![Test](https://github.com/holochain/holochain-client-js/actions/workflows/test.yml/badge.svg?branch=main)
4
+ ![Integration Tests](https://github.com/holochain/holochain-client-js/actions/workflows/integration-test.yml/badge.svg?branch=main)
5
+ ![Bundling Tests](https://github.com/holochain/holochain-client-js/actions/workflows/bundling-test.yml/badge.svg?branch=main)
5
6
  [![Twitter Follow](https://img.shields.io/twitter/follow/holochain.svg?style=social&label=Follow)](https://twitter.com/holochain)
6
7
 
7
8
  # Holochain Client - JavaScript
@@ -14,7 +15,7 @@ A JavaScript client for the Holochain Conductor API (works with browsers as well
14
15
 
15
16
  ## Compatibility
16
17
 
17
- **JS client v0.12.x** is compatible with **Holochain v0.1.x**.
18
+ **JS client v0.12.x** is compatible with **Holochain v0.1.x**.
18
19
  **JS client v0.13.x** is compatible with **Holochain v0.2.x**.
19
20
 
20
21
  ## Installation
@@ -6,32 +6,32 @@ import { DisableCloneCellRequest } from "../index.js";
6
6
  /**
7
7
  * @public
8
8
  */
9
- export declare type AttachAppInterfaceRequest = {
9
+ export type AttachAppInterfaceRequest = {
10
10
  port: number;
11
11
  };
12
12
  /**
13
13
  * @public
14
14
  */
15
- export declare type AttachAppInterfaceResponse = {
15
+ export type AttachAppInterfaceResponse = {
16
16
  port: number;
17
17
  };
18
18
  /**
19
19
  * @public
20
20
  */
21
- export declare type EnableAppRequest = {
21
+ export type EnableAppRequest = {
22
22
  installed_app_id: InstalledAppId;
23
23
  };
24
24
  /**
25
25
  * @public
26
26
  */
27
- export declare type EnableAppResponse = {
27
+ export type EnableAppResponse = {
28
28
  app: AppInfo;
29
29
  errors: Array<[CellId, string]>;
30
30
  };
31
31
  /**
32
32
  * @public
33
33
  */
34
- export declare type DeactivationReason = {
34
+ export type DeactivationReason = {
35
35
  never_activated: null;
36
36
  } | {
37
37
  normal: null;
@@ -43,13 +43,13 @@ export declare type DeactivationReason = {
43
43
  /**
44
44
  * @public
45
45
  */
46
- export declare type PausedAppReason = {
46
+ export type PausedAppReason = {
47
47
  error: string;
48
48
  };
49
49
  /**
50
50
  * @public
51
51
  */
52
- export declare type DisabledAppReason = {
52
+ export type DisabledAppReason = {
53
53
  never_started: null;
54
54
  } | {
55
55
  user: null;
@@ -59,7 +59,7 @@ export declare type DisabledAppReason = {
59
59
  /**
60
60
  * @public
61
61
  */
62
- export declare type InstalledAppInfoStatus = {
62
+ export type InstalledAppInfoStatus = {
63
63
  paused: {
64
64
  reason: PausedAppReason;
65
65
  };
@@ -108,7 +108,7 @@ export declare enum CellType {
108
108
  /**
109
109
  * @public
110
110
  */
111
- export declare type CellInfo = {
111
+ export type CellInfo = {
112
112
  [CellType.Provisioned]: ProvisionedCell;
113
113
  } | {
114
114
  [CellType.Cloned]: ClonedCell;
@@ -118,7 +118,7 @@ export declare type CellInfo = {
118
118
  /**
119
119
  * @public
120
120
  */
121
- export declare type AppInfo = {
121
+ export type AppInfo = {
122
122
  agent_pub_key: AgentPubKey;
123
123
  installed_app_id: InstalledAppId;
124
124
  cell_info: Record<RoleName, Array<CellInfo>>;
@@ -127,60 +127,60 @@ export declare type AppInfo = {
127
127
  /**
128
128
  * @public
129
129
  */
130
- export declare type MembraneProof = Buffer;
130
+ export type MembraneProof = Buffer;
131
131
  /**
132
132
  * @public
133
133
  */
134
- export declare type DisableAppRequest = {
134
+ export type DisableAppRequest = {
135
135
  installed_app_id: InstalledAppId;
136
136
  };
137
137
  /**
138
138
  * @public
139
139
  */
140
- export declare type DisableAppResponse = null;
140
+ export type DisableAppResponse = null;
141
141
  /**
142
142
  * @public
143
143
  */
144
- export declare type StartAppRequest = {
144
+ export type StartAppRequest = {
145
145
  installed_app_id: InstalledAppId;
146
146
  };
147
147
  /**
148
148
  * @public
149
149
  */
150
- export declare type StartAppResponse = boolean;
150
+ export type StartAppResponse = boolean;
151
151
  /**
152
152
  * @public
153
153
  */
154
- export declare type DumpStateRequest = {
154
+ export type DumpStateRequest = {
155
155
  cell_id: CellId;
156
156
  };
157
157
  /**
158
158
  * @public
159
159
  */
160
- export declare type DumpStateResponse = any;
160
+ export type DumpStateResponse = any;
161
161
  /**
162
162
  * @public
163
163
  */
164
- export declare type DumpFullStateRequest = {
164
+ export type DumpFullStateRequest = {
165
165
  cell_id: CellId;
166
166
  dht_ops_cursor: number | undefined;
167
167
  };
168
168
  /**
169
169
  * @public
170
170
  */
171
- export declare type DumpFullStateResponse = FullStateDump;
171
+ export type DumpFullStateResponse = FullStateDump;
172
172
  /**
173
173
  * @public
174
174
  */
175
- export declare type GenerateAgentPubKeyRequest = void;
175
+ export type GenerateAgentPubKeyRequest = void;
176
176
  /**
177
177
  * @public
178
178
  */
179
- export declare type GenerateAgentPubKeyResponse = AgentPubKey;
179
+ export type GenerateAgentPubKeyResponse = AgentPubKey;
180
180
  /**
181
181
  * @public
182
182
  */
183
- export declare type RegisterDnaRequest = {
183
+ export type RegisterDnaRequest = {
184
184
  modifiers?: {
185
185
  network_seed?: string;
186
186
  properties?: DnaProperties;
@@ -189,11 +189,11 @@ export declare type RegisterDnaRequest = {
189
189
  /**
190
190
  * @public
191
191
  */
192
- export declare type RegisterDnaResponse = HoloHash;
192
+ export type RegisterDnaResponse = HoloHash;
193
193
  /**
194
194
  * @public
195
195
  */
196
- export declare type DnaModifiers = {
196
+ export type DnaModifiers = {
197
197
  network_seed: NetworkSeed;
198
198
  properties: DnaProperties;
199
199
  origin_time: Timestamp;
@@ -202,15 +202,15 @@ export declare type DnaModifiers = {
202
202
  /**
203
203
  * @public
204
204
  */
205
- export declare type FunctionName = string;
205
+ export type FunctionName = string;
206
206
  /**
207
207
  * @public
208
208
  */
209
- export declare type ZomeName = string;
209
+ export type ZomeName = string;
210
210
  /**
211
211
  * @public
212
212
  */
213
- export declare type ZomeDefinition = [
213
+ export type ZomeDefinition = [
214
214
  ZomeName,
215
215
  {
216
216
  wasm_hash: WasmHash;
@@ -220,15 +220,15 @@ export declare type ZomeDefinition = [
220
220
  /**
221
221
  * @public
222
222
  */
223
- export declare type IntegrityZome = ZomeDefinition;
223
+ export type IntegrityZome = ZomeDefinition;
224
224
  /**
225
225
  * @public
226
226
  */
227
- export declare type CoordinatorZome = ZomeDefinition;
227
+ export type CoordinatorZome = ZomeDefinition;
228
228
  /**
229
229
  * @public
230
230
  */
231
- export declare type DnaDefinition = {
231
+ export type DnaDefinition = {
232
232
  name: string;
233
233
  modifiers: DnaModifiers;
234
234
  integrity_zomes: IntegrityZome[];
@@ -237,39 +237,39 @@ export declare type DnaDefinition = {
237
237
  /**
238
238
  * @public
239
239
  */
240
- export declare type GetDnaDefinitionRequest = DnaHash;
240
+ export type GetDnaDefinitionRequest = DnaHash;
241
241
  /**
242
242
  * @public
243
243
  */
244
- export declare type GetDnaDefinitionResponse = DnaDefinition;
244
+ export type GetDnaDefinitionResponse = DnaDefinition;
245
245
  /**
246
246
  * @public
247
247
  */
248
- export declare type UninstallAppRequest = {
248
+ export type UninstallAppRequest = {
249
249
  installed_app_id: InstalledAppId;
250
250
  };
251
251
  /**
252
252
  * @public
253
253
  */
254
- export declare type UninstallAppResponse = null;
254
+ export type UninstallAppResponse = null;
255
255
  /**
256
256
  * @public
257
257
  */
258
- export declare type UpdateCoordinatorsRequest = {
258
+ export type UpdateCoordinatorsRequest = {
259
259
  dna_hash: DnaHash;
260
260
  } & CoordinatorSource;
261
261
  /**
262
262
  * @public
263
263
  */
264
- export declare type UpdateCoordinatorsResponse = void;
264
+ export type UpdateCoordinatorsResponse = void;
265
265
  /**
266
266
  * @public
267
267
  */
268
- export declare type ResourceBytes = Uint8Array;
268
+ export type ResourceBytes = Uint8Array;
269
269
  /**
270
270
  * @public
271
271
  */
272
- export declare type ResourceMap = {
272
+ export type ResourceMap = {
273
273
  [key: string]: ResourceBytes;
274
274
  };
275
275
  /**
@@ -307,7 +307,7 @@ export interface CellProvisioning {
307
307
  /**
308
308
  * @public
309
309
  */
310
- export declare type Location = {
310
+ export type Location = {
311
311
  /**
312
312
  * Expect file to be part of this bundle
313
313
  */
@@ -326,11 +326,11 @@ export declare type Location = {
326
326
  /**
327
327
  * @public
328
328
  */
329
- export declare type DnaVersionSpec = Array<HoloHashB64>;
329
+ export type DnaVersionSpec = Array<HoloHashB64>;
330
330
  /**
331
331
  * @public
332
332
  */
333
- export declare type DnaVersionFlexible = {
333
+ export type DnaVersionFlexible = {
334
334
  singleton: HoloHashB64;
335
335
  } | {
336
336
  multiple: DnaVersionSpec;
@@ -338,7 +338,7 @@ export declare type DnaVersionFlexible = {
338
338
  /**
339
339
  * @public
340
340
  */
341
- export declare type AppRoleDnaManifest = {
341
+ export type AppRoleDnaManifest = {
342
342
  clone_limit?: number;
343
343
  modifiers?: Partial<DnaModifiers>;
344
344
  version?: DnaVersionFlexible;
@@ -346,7 +346,7 @@ export declare type AppRoleDnaManifest = {
346
346
  /**
347
347
  * @public
348
348
  */
349
- export declare type AppRoleManifest = {
349
+ export type AppRoleManifest = {
350
350
  name: RoleName;
351
351
  provisioning?: CellProvisioning;
352
352
  dna: AppRoleDnaManifest;
@@ -354,7 +354,7 @@ export declare type AppRoleManifest = {
354
354
  /**
355
355
  * @public
356
356
  */
357
- export declare type AppManifest = {
357
+ export type AppManifest = {
358
358
  manifest_version: string;
359
359
  name: string;
360
360
  description?: string;
@@ -363,14 +363,14 @@ export declare type AppManifest = {
363
363
  /**
364
364
  * @public
365
365
  */
366
- export declare type AppBundle = {
366
+ export type AppBundle = {
367
367
  manifest: AppManifest;
368
368
  resources: ResourceMap;
369
369
  };
370
370
  /**
371
371
  * @public
372
372
  */
373
- export declare type AppBundleSource = {
373
+ export type AppBundleSource = {
374
374
  bundle: AppBundle;
375
375
  } | {
376
376
  path: string;
@@ -378,11 +378,11 @@ export declare type AppBundleSource = {
378
378
  /**
379
379
  * @public
380
380
  */
381
- export declare type NetworkSeed = string;
381
+ export type NetworkSeed = string;
382
382
  /**
383
383
  * @public
384
384
  */
385
- export declare type InstallAppRequest = {
385
+ export type InstallAppRequest = {
386
386
  agent_key: AgentPubKey;
387
387
  installed_app_id?: InstalledAppId;
388
388
  membrane_proofs: {
@@ -393,31 +393,31 @@ export declare type InstallAppRequest = {
393
393
  /**
394
394
  * @public
395
395
  */
396
- export declare type InstallAppResponse = AppInfo;
396
+ export type InstallAppResponse = AppInfo;
397
397
  /**
398
398
  * @public
399
399
  */
400
- export declare type ListDnasRequest = void;
400
+ export type ListDnasRequest = void;
401
401
  /**
402
402
  * @public
403
403
  */
404
- export declare type ListDnasResponse = Array<string>;
404
+ export type ListDnasResponse = Array<string>;
405
405
  /**
406
406
  * @public
407
407
  */
408
- export declare type ListCellIdsRequest = void;
408
+ export type ListCellIdsRequest = void;
409
409
  /**
410
410
  * @public
411
411
  */
412
- export declare type ListCellIdsResponse = Array<CellId>;
412
+ export type ListCellIdsResponse = Array<CellId>;
413
413
  /**
414
414
  * @public
415
415
  */
416
- export declare type ListActiveAppsRequest = void;
416
+ export type ListActiveAppsRequest = void;
417
417
  /**
418
418
  * @public
419
419
  */
420
- export declare type ListActiveAppsResponse = Array<InstalledAppId>;
420
+ export type ListActiveAppsResponse = Array<InstalledAppId>;
421
421
  /**
422
422
  * @public
423
423
  */
@@ -431,55 +431,55 @@ export declare enum AppStatusFilter {
431
431
  /**
432
432
  * @public
433
433
  */
434
- export declare type ListAppsRequest = {
434
+ export type ListAppsRequest = {
435
435
  status_filter?: AppStatusFilter;
436
436
  };
437
437
  /**
438
438
  * @public
439
439
  */
440
- export declare type ListAppsResponse = Array<AppInfo>;
440
+ export type ListAppsResponse = Array<AppInfo>;
441
441
  /**
442
442
  * @public
443
443
  */
444
- export declare type ListAppInterfacesRequest = void;
444
+ export type ListAppInterfacesRequest = void;
445
445
  /**
446
446
  * @public
447
447
  */
448
- export declare type ListAppInterfacesResponse = Array<number>;
448
+ export type ListAppInterfacesResponse = Array<number>;
449
449
  /**
450
450
  * This type is meant to be opaque
451
451
  *
452
452
  * @public
453
453
  */
454
- export declare type AgentInfoSigned = unknown;
454
+ export type AgentInfoSigned = unknown;
455
455
  /**
456
456
  * @public
457
457
  */
458
- export declare type AgentInfoRequest = {
458
+ export type AgentInfoRequest = {
459
459
  cell_id: CellId | null;
460
460
  };
461
461
  /**
462
462
  * @public
463
463
  */
464
- export declare type AgentInfoResponse = Array<AgentInfoSigned>;
464
+ export type AgentInfoResponse = Array<AgentInfoSigned>;
465
465
  /**
466
466
  * @public
467
467
  */
468
- export declare type AddAgentInfoRequest = {
468
+ export type AddAgentInfoRequest = {
469
469
  agent_infos: Array<AgentInfoSigned>;
470
470
  };
471
471
  /**
472
472
  * @public
473
473
  */
474
- export declare type AddAgentInfoResponse = any;
474
+ export type AddAgentInfoResponse = any;
475
475
  /**
476
476
  * @public
477
477
  */
478
- export declare type DeleteCloneCellRequest = DisableCloneCellRequest;
478
+ export type DeleteCloneCellRequest = DisableCloneCellRequest;
479
479
  /**
480
480
  * @public
481
481
  */
482
- export declare type DeleteCloneCellResponse = void;
482
+ export type DeleteCloneCellResponse = void;
483
483
  /**
484
484
  * @public
485
485
  */
@@ -497,11 +497,11 @@ export interface GrantZomeCallCapabilityRequest {
497
497
  /**
498
498
  * @public
499
499
  */
500
- export declare type GrantZomeCallCapabilityResponse = void;
500
+ export type GrantZomeCallCapabilityResponse = void;
501
501
  /**
502
502
  * @public
503
503
  */
504
- export declare type InstallAppDnaPayload = {
504
+ export type InstallAppDnaPayload = {
505
505
  hash: HoloHash;
506
506
  role_name: RoleName;
507
507
  membrane_proof?: MembraneProof;
@@ -509,7 +509,7 @@ export declare type InstallAppDnaPayload = {
509
509
  /**
510
510
  * @public
511
511
  */
512
- export declare type ZomeLocation = Location;
512
+ export type ZomeLocation = Location;
513
513
  /**
514
514
  * @public
515
515
  */
@@ -519,7 +519,7 @@ export interface ZomeDependency {
519
519
  /**
520
520
  * @public
521
521
  */
522
- export declare type ZomeManifest = {
522
+ export type ZomeManifest = {
523
523
  name: string;
524
524
  hash?: string;
525
525
  dependencies?: ZomeDependency[];
@@ -540,7 +540,7 @@ export interface CoordinatorBundle {
540
540
  /**
541
541
  * @public
542
542
  */
543
- export declare type CoordinatorSource = {
543
+ export type CoordinatorSource = {
544
544
  path: string;
545
545
  } | {
546
546
  bundle: CoordinatorBundle;
@@ -548,7 +548,7 @@ export declare type CoordinatorSource = {
548
548
  /**
549
549
  * @public
550
550
  */
551
- export declare type DnaManifest = {
551
+ export type DnaManifest = {
552
552
  /**
553
553
  * Currently one "1" is supported
554
554
  */
@@ -574,14 +574,14 @@ export declare type DnaManifest = {
574
574
  /**
575
575
  * @public
576
576
  */
577
- export declare type DnaBundle = {
577
+ export type DnaBundle = {
578
578
  manifest: DnaManifest;
579
579
  resources: ResourceMap;
580
580
  };
581
581
  /**
582
582
  * @public
583
583
  */
584
- export declare type DnaSource = {
584
+ export type DnaSource = {
585
585
  hash: HoloHash;
586
586
  } | {
587
587
  path: string;
@@ -591,13 +591,13 @@ export declare type DnaSource = {
591
591
  /**
592
592
  * @public
593
593
  */
594
- export declare type Zomes = Array<[string, {
594
+ export type Zomes = Array<[string, {
595
595
  wasm_hash: Array<HoloHash>;
596
596
  }]>;
597
597
  /**
598
598
  * @public
599
599
  */
600
- export declare type WasmCode = [HoloHash, {
600
+ export type WasmCode = [HoloHash, {
601
601
  code: Array<number>;
602
602
  }];
603
603
  /**
@@ -678,7 +678,7 @@ export interface DnaStorageInfo {
678
678
  * @public
679
679
  */
680
680
  export interface DnaStorageBlob {
681
- Dna: DnaStorageInfo;
681
+ dna: DnaStorageInfo;
682
682
  }
683
683
  /**
684
684
  * @public
@@ -689,19 +689,19 @@ export interface StorageInfo {
689
689
  /**
690
690
  * @public
691
691
  */
692
- export declare type StorageInfoRequest = void;
692
+ export type StorageInfoRequest = void;
693
693
  /**
694
694
  * @public
695
695
  */
696
- export declare type StorageInfoResponse = StorageInfo;
696
+ export type StorageInfoResponse = StorageInfo;
697
697
  /**
698
698
  * @public
699
699
  */
700
- export declare type DumpNetworkStatsRequest = void;
700
+ export type DumpNetworkStatsRequest = void;
701
701
  /**
702
702
  * @public
703
703
  */
704
- export declare type DumpNetworkStatsResponse = string;
704
+ export type DumpNetworkStatsResponse = string;
705
705
  /**
706
706
  * @public
707
707
  */
@@ -134,7 +134,7 @@ export class AdminWebsocket {
134
134
  * @returns The cap secret of the created capability.
135
135
  */
136
136
  grantSigningKey = async (cellId, functions, signingKey) => {
137
- const capSecret = await randomCapSecret();
137
+ const capSecret = randomCapSecret();
138
138
  await this.grantZomeCallCapability({
139
139
  cell_id: cellId,
140
140
  cap_grant: {
@@ -159,7 +159,7 @@ export class AdminWebsocket {
159
159
  * granted for all zomes and functions.
160
160
  */
161
161
  authorizeSigningCredentials = async (cellId, functions) => {
162
- const [keyPair, signingKey] = generateSigningKeyPair();
162
+ const [keyPair, signingKey] = await generateSigningKeyPair();
163
163
  const capSecret = await this.grantSigningKey(cellId, functions || { [GrantedFunctionsType.All]: null }, signingKey);
164
164
  setSigningCredentials(cellId, { capSecret, keyPair, signingKey });
165
165
  };