@holochain/client 0.19.0-dev.5 → 0.19.0-dev.7

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.
@@ -1,5 +1,6 @@
1
1
  import { Action, DhtOp, Entry, ZomeCallCapGrant } from "../../hdk/index.js";
2
2
  import { ActionHash, AgentPubKey, CellId, DnaHash, DnaHashB64, DnaProperties, Duration, HoloHash, HoloHashB64, InstalledAppId, KitsuneAgent, KitsuneSpace, RoleName, Signature, Timestamp, WasmHash } from "../../types.js";
3
+ import { CloneCellId } from "../app/types.js";
3
4
  import { Requester } from "../common.js";
4
5
  /**
5
6
  * @public
@@ -106,11 +107,14 @@ export declare enum CellType {
106
107
  * @public
107
108
  */
108
109
  export type CellInfo = {
109
- [CellType.Provisioned]: ProvisionedCell;
110
+ type: CellType.Provisioned;
111
+ value: ProvisionedCell;
110
112
  } | {
111
- [CellType.Cloned]: ClonedCell;
113
+ type: CellType.Cloned;
114
+ value: ClonedCell;
112
115
  } | {
113
- [CellType.Stem]: StemCell;
116
+ type: CellType.Stem;
117
+ value: StemCell;
114
118
  };
115
119
  /**
116
120
  * @public
@@ -130,7 +134,42 @@ export type MembraneProof = Uint8Array;
130
134
  * @public
131
135
  */
132
136
  export type MemproofMap = {
133
- [key: string]: MembraneProof;
137
+ [key: RoleName]: MembraneProof;
138
+ };
139
+ /**
140
+ * @public
141
+ */
142
+ export type RoleSettingsMap = {
143
+ [key: RoleName]: RoleSettings;
144
+ };
145
+ /**
146
+ * @public
147
+ */
148
+ export type RoleSettings = {
149
+ type: "use_existing";
150
+ value: {
151
+ cell_id: CellId;
152
+ };
153
+ } | {
154
+ type: "provisioned";
155
+ value: {
156
+ membrane_proof?: MembraneProof;
157
+ modifiers?: DnaModifiersOpt;
158
+ };
159
+ };
160
+ /**
161
+ * @public
162
+ * Any value that is serializable to a Yaml value
163
+ */
164
+ export type YamlProperties = unknown;
165
+ /**
166
+ * @public
167
+ */
168
+ export type DnaModifiersOpt = {
169
+ network_seed?: NetworkSeed;
170
+ properties?: YamlProperties;
171
+ origin_time?: Timestamp;
172
+ quantum_time?: Duration;
134
173
  };
135
174
  /**
136
175
  * @public
@@ -201,11 +240,12 @@ export type RevokeAgentKeyResponse = [CellId, string][];
201
240
  * @public
202
241
  */
203
242
  export type RegisterDnaRequest = {
243
+ source: DnaSource;
204
244
  modifiers?: {
205
245
  network_seed?: string;
206
246
  properties?: DnaProperties;
207
247
  };
208
- } & DnaSource;
248
+ };
209
249
  /**
210
250
  * @public
211
251
  */
@@ -285,8 +325,9 @@ export type UninstallAppResponse = null;
285
325
  * @public
286
326
  */
287
327
  export type UpdateCoordinatorsRequest = {
328
+ source: CoordinatorSource;
288
329
  dna_hash: DnaHash;
289
- } & CoordinatorSource;
330
+ };
290
331
  /**
291
332
  * @public
292
333
  */
@@ -401,9 +442,11 @@ export type AppBundle = {
401
442
  * @public
402
443
  */
403
444
  export type AppBundleSource = {
404
- bundle: AppBundle;
445
+ type: "path";
446
+ value: string;
405
447
  } | {
406
- path: string;
448
+ type: "bundle";
449
+ value: AppBundle;
407
450
  };
408
451
  /**
409
452
  * @public
@@ -413,6 +456,11 @@ export type NetworkSeed = string;
413
456
  * @public
414
457
  */
415
458
  export type InstallAppRequest = {
459
+ /**
460
+ * Where to obtain the AppBundle, which contains the app manifest and DNA bundles
461
+ * to be installed. This is the main payload of app installation.
462
+ */
463
+ source: AppBundleSource;
416
464
  /**
417
465
  * The agent to use when creating Cells for this App.
418
466
  * If not specified, a new agent will be generated by Holochain.
@@ -425,23 +473,22 @@ export type InstallAppRequest = {
425
473
  * If not specified, it will be derived from the app name in the bundle manifest.
426
474
  */
427
475
  installed_app_id?: InstalledAppId;
428
- /**
429
- * Include proof-of-membrane-membership data for cells that require it,
430
- * keyed by the CellNick specified in the app bundle manifest.
431
- */
432
- membrane_proofs: MemproofMap;
433
476
  /**
434
477
  * Optional global network seed override. If set will override the network seed value for all
435
478
  * DNAs in the bundle.
436
479
  */
437
480
  network_seed?: NetworkSeed;
481
+ /**
482
+ * Specify role specific settings or modifiers that will override any settings in the dna manifest.
483
+ */
484
+ roles_settings?: RoleSettingsMap;
438
485
  /**
439
486
  * Optional: If app installation fails due to genesis failure, normally the app will be immediately uninstalled.
440
487
  * When this flag is set, the app is left installed with empty cells intact. This can be useful for
441
488
  * using graft_records_onto_source_chain, or for diagnostics.
442
489
  */
443
490
  ignore_genesis_failure?: boolean;
444
- } & AppBundleSource;
491
+ };
445
492
  /**
446
493
  * @public
447
494
  */
@@ -474,11 +521,11 @@ export type ListActiveAppsResponse = Array<InstalledAppId>;
474
521
  * @public
475
522
  */
476
523
  export declare enum AppStatusFilter {
477
- Enabled = "Enabled",
478
- Disabled = "Disabled",
479
- Running = "Running",
480
- Stopped = "Stopped",
481
- Paused = "Paused"
524
+ Enabled = "enabled",
525
+ Disabled = "disabled",
526
+ Running = "running",
527
+ Stopped = "stopped",
528
+ Paused = "paused"
482
529
  }
483
530
  /**
484
531
  * @public
@@ -543,7 +590,7 @@ export interface DeleteCloneCellRequest {
543
590
  /**
544
591
  * The clone id or cell id of the clone cell
545
592
  */
546
- clone_cell_id: RoleName | DnaHash;
593
+ clone_cell_id: CloneCellId;
547
594
  }
548
595
  /**
549
596
  * @public
@@ -610,9 +657,11 @@ export interface CoordinatorBundle {
610
657
  * @public
611
658
  */
612
659
  export type CoordinatorSource = {
613
- path: string;
660
+ type: "path";
661
+ value: string;
614
662
  } | {
615
- bundle: CoordinatorBundle;
663
+ type: "bundle";
664
+ value: CoordinatorBundle;
616
665
  };
617
666
  /**
618
667
  * @public
@@ -671,11 +720,14 @@ export type DnaBundle = {
671
720
  * @public
672
721
  */
673
722
  export type DnaSource = {
674
- hash: HoloHash;
723
+ type: "path";
724
+ value: string;
675
725
  } | {
676
- path: string;
726
+ type: "bundle";
727
+ value: DnaBundle;
677
728
  } | {
678
- bundle: DnaBundle;
729
+ type: "hash";
730
+ value: HoloHash;
679
731
  };
680
732
  /**
681
733
  * @public
@@ -766,9 +818,10 @@ export interface DnaStorageInfo {
766
818
  /**
767
819
  * @public
768
820
  */
769
- export interface DnaStorageBlob {
770
- dna: DnaStorageInfo;
771
- }
821
+ export type DnaStorageBlob = {
822
+ type: "dna";
823
+ value: DnaStorageInfo;
824
+ };
772
825
  /**
773
826
  * @public
774
827
  */
@@ -46,9 +46,9 @@ export var CellProvisioningStrategy;
46
46
  */
47
47
  export var AppStatusFilter;
48
48
  (function (AppStatusFilter) {
49
- AppStatusFilter["Enabled"] = "Enabled";
50
- AppStatusFilter["Disabled"] = "Disabled";
51
- AppStatusFilter["Running"] = "Running";
52
- AppStatusFilter["Stopped"] = "Stopped";
53
- AppStatusFilter["Paused"] = "Paused";
49
+ AppStatusFilter["Enabled"] = "enabled";
50
+ AppStatusFilter["Disabled"] = "disabled";
51
+ AppStatusFilter["Running"] = "running";
52
+ AppStatusFilter["Stopped"] = "stopped";
53
+ AppStatusFilter["Paused"] = "paused";
54
54
  })(AppStatusFilter || (AppStatusFilter = {}));
@@ -1,5 +1,4 @@
1
1
  import { getLauncherEnvironment } from "../../environments/launcher.js";
2
- import { GrantedFunctionsType, } from "../../hdk/index.js";
3
2
  import { WsClient } from "../client.js";
4
3
  import { DEFAULT_TIMEOUT, HolochainError, catchError, promiseTimeout, requesterTransformer, } from "../common.js";
5
4
  import { generateSigningKeyPair, randomCapSecret, setSigningCredentials, } from "../zome-call-signing.js";
@@ -150,7 +149,8 @@ export class AdminWebsocket {
150
149
  tag: "zome-call-signing-key",
151
150
  functions,
152
151
  access: {
153
- Assigned: {
152
+ type: "assigned",
153
+ value: {
154
154
  secret: capSecret,
155
155
  assignees: [signingKey],
156
156
  },
@@ -169,7 +169,7 @@ export class AdminWebsocket {
169
169
  */
170
170
  authorizeSigningCredentials = async (cellId, functions) => {
171
171
  const [keyPair, signingKey] = await generateSigningKeyPair();
172
- const capSecret = await this.grantSigningKey(cellId, functions || GrantedFunctionsType.All, signingKey);
172
+ const capSecret = await this.grantSigningKey(cellId, functions || { type: "all" }, signingKey);
173
173
  setSigningCredentials(cellId, { capSecret, keyPair, signingKey });
174
174
  };
175
175
  }
@@ -1,17 +1,5 @@
1
1
  import { UnsubscribeFunction } from "emittery";
2
2
  import { AgentPubKey, AppAuthenticationToken, AppInfo, CapSecret, CellId, ClonedCell, DnaHash, DnaProperties, EntryHash, FunctionName, InstalledAppId, MembraneProof, MemproofMap, NetworkInfo, NetworkSeed, Nonce256Bit, RoleName, Timestamp, Transformer, WebsocketConnectionOptions, ZomeName, PreflightRequest, SignedAction, SignedActionHashed } from "../../index.js";
3
- /**
4
- * @public
5
- */
6
- export type AppCreateCloneCellRequest = Omit<CreateCloneCellRequest, "app_id">;
7
- /**
8
- * @public
9
- */
10
- export type AppEnableCloneCellRequest = Omit<EnableCloneCellRequest, "app_id">;
11
- /**
12
- * @public
13
- */
14
- export type AppDisableCloneCellRequest = Omit<DisableCloneCellRequest, "app_id">;
15
3
  /**
16
4
  * @public
17
5
  */
@@ -127,6 +115,20 @@ export interface CreateCloneCellRequest {
127
115
  * @public
128
116
  */
129
117
  export type CreateCloneCellResponse = ClonedCell;
118
+ /**
119
+ * @public
120
+ */
121
+ export type CloneId = string;
122
+ /**
123
+ * @public
124
+ */
125
+ export type CloneCellId = {
126
+ type: "clone_id";
127
+ value: CloneId;
128
+ } | {
129
+ type: "dna_hash";
130
+ value: DnaHash;
131
+ };
130
132
  /**
131
133
  * @public
132
134
  */
@@ -134,7 +136,7 @@ export interface DisableCloneCellRequest {
134
136
  /**
135
137
  * The clone id or cell id of the clone cell
136
138
  */
137
- clone_cell_id: RoleName | DnaHash;
139
+ clone_cell_id: CloneCellId;
138
140
  }
139
141
  /**
140
142
  * @public
@@ -370,28 +372,25 @@ export declare enum SessionCompletionDecisionType {
370
372
  export type SessionCompletionDecision = {
371
373
  [SessionCompletionDecisionType.Complete]: SignedActionHashed;
372
374
  } | SessionCompletionDecisionType.Abandoned | SessionCompletionDecisionType.Indeterminate | SessionCompletionDecisionType.Failed;
373
- /**
374
- * @public
375
- */
376
- export declare const SignalType: {
377
- readonly App: "App";
378
- readonly System: "System";
379
- };
380
375
  /**
381
376
  * @public
382
377
  */
383
378
  export type RawSignal = {
384
- [SignalType.App]: EncodedAppSignal;
379
+ type: "app";
380
+ value: EncodedAppSignal;
385
381
  } | {
386
- [SignalType.System]: SystemSignal;
382
+ type: "system";
383
+ value: SystemSignal;
387
384
  };
388
385
  /**
389
386
  * @public
390
387
  */
391
388
  export type Signal = {
392
- [SignalType.App]: AppSignal;
389
+ type: "app";
390
+ value: AppSignal;
393
391
  } | {
394
- [SignalType.System]: SystemSignal;
392
+ type: "system";
393
+ value: SystemSignal;
395
394
  };
396
395
  /**
397
396
  * @public
@@ -432,9 +431,9 @@ export interface AppClient {
432
431
  appInfo(): Promise<AppInfoResponse>;
433
432
  myPubKey: AgentPubKey;
434
433
  installedAppId: InstalledAppId;
435
- createCloneCell(args: AppCreateCloneCellRequest): Promise<CreateCloneCellResponse>;
436
- enableCloneCell(args: AppEnableCloneCellRequest): Promise<EnableCloneCellResponse>;
437
- disableCloneCell(args: AppDisableCloneCellRequest): Promise<DisableCloneCellResponse>;
434
+ createCloneCell(args: CreateCloneCellRequest): Promise<CreateCloneCellResponse>;
435
+ enableCloneCell(args: EnableCloneCellRequest): Promise<EnableCloneCellResponse>;
436
+ disableCloneCell(args: DisableCloneCellRequest): Promise<DisableCloneCellResponse>;
438
437
  networkInfo(args: AppNetworkInfoRequest): Promise<NetworkInfoResponse>;
439
438
  }
440
439
  /**
@@ -45,10 +45,3 @@ export var SessionCompletionDecisionType;
45
45
  */
46
46
  SessionCompletionDecisionType["Failed"] = "Failed";
47
47
  })(SessionCompletionDecisionType || (SessionCompletionDecisionType = {}));
48
- /**
49
- * @public
50
- */
51
- export const SignalType = {
52
- App: "App",
53
- System: "System",
54
- };
@@ -1,7 +1,7 @@
1
1
  import { UnsubscribeFunction } from "emittery";
2
- import { AgentPubKey, CellId, InstalledAppId, RoleName } from "../../types.js";
3
- import { AppInfo, MemproofMap } from "../admin/index.js";
4
- import { AppClient, AppEvents, AppNetworkInfoRequest, AppCreateCloneCellRequest, AppDisableCloneCellRequest, AppEnableCloneCellRequest, SignalCb, CallZomeRequest, CallZomeRequestSigned, NetworkInfoResponse, AppWebsocketConnectionOptions, GetCountersigningSessionStateRequest, GetCountersigningSessionStateResponse, AbandonCountersigningSessionStateRequest, PublishCountersigningSessionStateRequest, RoleNameCallZomeRequest } from "./types.js";
2
+ import { AgentPubKey, InstalledAppId, RoleName } from "../../types.js";
3
+ import { AppInfo, ClonedCell, MemproofMap } from "../admin/index.js";
4
+ import { AppClient, AppEvents, AppNetworkInfoRequest, SignalCb, CallZomeRequest, CallZomeRequestSigned, CreateCloneCellRequest, DisableCloneCellRequest, EnableCloneCellRequest, NetworkInfoResponse, AppWebsocketConnectionOptions, GetCountersigningSessionStateRequest, GetCountersigningSessionStateResponse, AbandonCountersigningSessionStateRequest, PublishCountersigningSessionStateRequest, RoleNameCallZomeRequest } from "./types.js";
5
5
  import { WsClient } from "../client.js";
6
6
  /**
7
7
  * A class to establish a websocket connection to an App interface, for a
@@ -62,7 +62,7 @@ export declare class AppWebsocket implements AppClient {
62
62
  * @param appInfo - The app info containing all cell infos.
63
63
  * @returns The cell id or throws an error if not found.
64
64
  */
65
- getCellIdFromRoleName(roleName: RoleName, appInfo: AppInfo): CellId;
65
+ getCellIdFromRoleName(roleName: RoleName, appInfo: AppInfo): import("../../types.js").CellId;
66
66
  /**
67
67
  * Call a zome.
68
68
  *
@@ -77,20 +77,20 @@ export declare class AppWebsocket implements AppClient {
77
77
  * @param args - Specify the cell to clone.
78
78
  * @returns The created clone cell.
79
79
  */
80
- createCloneCell(args: AppCreateCloneCellRequest): Promise<import("../admin/types.js").ClonedCell>;
80
+ createCloneCell(args: CreateCloneCellRequest): Promise<ClonedCell>;
81
81
  /**
82
82
  * Enable a disabled clone cell.
83
83
  *
84
84
  * @param args - Specify the clone cell to enable.
85
85
  * @returns The enabled clone cell.
86
86
  */
87
- enableCloneCell(args: AppEnableCloneCellRequest): Promise<import("../admin/types.js").ClonedCell>;
87
+ enableCloneCell(args: EnableCloneCellRequest): Promise<ClonedCell>;
88
88
  /**
89
89
  * Disable an enabled clone cell.
90
90
  *
91
91
  * @param args - Specify the clone cell to disable.
92
92
  */
93
- disableCloneCell(args: AppDisableCloneCellRequest): Promise<void>;
93
+ disableCloneCell(args: DisableCloneCellRequest): Promise<void>;
94
94
  /**
95
95
  * Request network info about gossip status.
96
96
  * @param args - Specify the DNAs for which you want network info
@@ -135,20 +135,20 @@ export class AppWebsocket {
135
135
  if (!(baseRoleName in appInfo.cell_info)) {
136
136
  throw new HolochainError("NoCellForRoleName", `no cell found with role_name ${roleName}`);
137
137
  }
138
- const cloneCell = appInfo.cell_info[baseRoleName].find((c) => CellType.Cloned in c && c[CellType.Cloned].clone_id === roleName);
139
- if (!cloneCell || !(CellType.Cloned in cloneCell)) {
138
+ const cloneCell = appInfo.cell_info[baseRoleName].find((c) => c.type === CellType.Cloned && c.value.clone_id === roleName);
139
+ if (!cloneCell || cloneCell.type !== CellType.Cloned) {
140
140
  throw new HolochainError("NoCellForCloneId", `no clone cell found with clone id ${roleName}`);
141
141
  }
142
- return cloneCell[CellType.Cloned].cell_id;
142
+ return cloneCell.value.cell_id;
143
143
  }
144
144
  if (!(roleName in appInfo.cell_info)) {
145
145
  throw new HolochainError("NoCellForRoleName", `no cell found with role_name ${roleName}`);
146
146
  }
147
- const cell = appInfo.cell_info[roleName].find((c) => CellType.Provisioned in c);
148
- if (!cell || !(CellType.Provisioned in cell)) {
147
+ const cell = appInfo.cell_info[roleName].find((c) => c.type === CellType.Provisioned);
148
+ if (!cell || cell.type !== CellType.Provisioned) {
149
149
  throw new HolochainError("NoProvisionedCellForRoleName", `no provisioned cell found with role_name ${roleName}`);
150
150
  }
151
- return cell[CellType.Provisioned].cell_id;
151
+ return cell.value.cell_id;
152
152
  }
153
153
  /**
154
154
  * Call a zome.
package/lib/api/client.js CHANGED
@@ -2,7 +2,6 @@ import { decode, encode } from "@msgpack/msgpack";
2
2
  import Emittery from "emittery";
3
3
  import IsoWebSocket from "isomorphic-ws";
4
4
  import { HolochainError } from "./common.js";
5
- import { SignalType } from "./app/index.js";
6
5
  /**
7
6
  * A WebSocket client which can make requests and receive responses,
8
7
  * as well as send and receive signals.
@@ -159,13 +158,14 @@ export class WsClient extends Emittery {
159
158
  }
160
159
  const deserializedSignal = decode(message.data);
161
160
  assertHolochainSignal(deserializedSignal);
162
- if (SignalType.System in deserializedSignal) {
161
+ if (deserializedSignal.type === "system") {
163
162
  this.emit("signal", {
164
- System: deserializedSignal[SignalType.System],
163
+ type: "system",
164
+ value: deserializedSignal.value,
165
165
  });
166
166
  }
167
167
  else {
168
- const encodedAppSignal = deserializedSignal[SignalType.App];
168
+ const encodedAppSignal = deserializedSignal.value;
169
169
  // In order to return readable content to the UI, the signal payload must also be deserialized.
170
170
  const payload = decode(encodedAppSignal.signal);
171
171
  const signal = {
@@ -173,7 +173,7 @@ export class WsClient extends Emittery {
173
173
  zome_name: encodedAppSignal.zome_name,
174
174
  payload,
175
175
  };
176
- this.emit("signal", { App: signal });
176
+ this.emit("signal", { type: "app", value: signal });
177
177
  }
178
178
  }
179
179
  else if (message.type === "response") {
@@ -253,7 +253,9 @@ function assertHolochainMessage(message) {
253
253
  function assertHolochainSignal(signal) {
254
254
  if (typeof signal === "object" &&
255
255
  signal !== null &&
256
- Object.values(SignalType).some((type) => type in signal)) {
256
+ "type" in signal &&
257
+ "value" in signal &&
258
+ ["app", "signal"].some((type) => signal.type === type)) {
257
259
  return;
258
260
  }
259
261
  throw new HolochainError("UnknownSignalFormat", `incoming signal has unknown signal format ${JSON.stringify(signal, null, 4)}`);
@@ -22,7 +22,7 @@ export type RequesterNoArg<Res> = (timeout?: number) => Promise<Res>;
22
22
  */
23
23
  export type Tagged<T> = {
24
24
  type: string;
25
- data: T;
25
+ value: T;
26
26
  };
27
27
  /**
28
28
  * Take a Requester function which deals with tagged requests and responses,
package/lib/api/common.js CHANGED
@@ -9,9 +9,9 @@ export const DEFAULT_TIMEOUT = 60000;
9
9
  */
10
10
  export const requesterTransformer = (requester, tag, transform = identityTransformer) => async (req, timeout) => {
11
11
  const transformedInput = await transform.input(req);
12
- const input = { type: tag, data: transformedInput };
12
+ const input = { type: tag, value: transformedInput };
13
13
  const response = await requester(input, timeout);
14
- return transform.output(response.data);
14
+ return transform.output(response.value);
15
15
  };
16
16
  const identity = (x) => x;
17
17
  const identityTransformer = {
@@ -33,8 +33,8 @@ export class HolochainError extends Error {
33
33
  // this determines the error format of all error responses
34
34
  export const catchError = (response) => {
35
35
  if (response.type === ERROR_TYPE) {
36
- const errorName = response.data.type;
37
- const error = new HolochainError(errorName, response.data.data);
36
+ const errorName = response.value.type;
37
+ const error = new HolochainError(errorName, response.value.value);
38
38
  return Promise.reject(error);
39
39
  }
40
40
  else {
@@ -22,8 +22,11 @@ export declare enum GrantedFunctionsType {
22
22
  /**
23
23
  * @public
24
24
  */
25
- export type GrantedFunctions = GrantedFunctionsType.All | {
26
- [GrantedFunctionsType.Listed]: [ZomeName, FunctionName][];
25
+ export type GrantedFunctions = {
26
+ type: "all";
27
+ } | {
28
+ type: "listed";
29
+ value: [ZomeName, FunctionName][];
27
30
  };
28
31
  /**
29
32
  * @public
@@ -36,20 +39,16 @@ export interface ZomeCallCapGrant {
36
39
  /**
37
40
  * @public
38
41
  */
39
- export declare enum CapAccessType {
40
- Unrestricted = "Unrestricted",
41
- Transferable = "Transferable",
42
- Assigned = "Assigned"
43
- }
44
- /**
45
- * @public
46
- */
47
- export type CapAccess = [CapAccessType.Unrestricted] | {
48
- [CapAccessType.Transferable]: {
42
+ export type CapAccess = {
43
+ type: "unrestricted";
44
+ } | {
45
+ type: "transferable";
46
+ value: {
49
47
  secret: CapSecret;
50
48
  };
51
49
  } | {
52
- [CapAccessType.Assigned]: {
50
+ type: "assigned";
51
+ value: {
53
52
  secret: CapSecret;
54
53
  assignees: AgentPubKey[];
55
54
  };
@@ -6,12 +6,3 @@ export var GrantedFunctionsType;
6
6
  GrantedFunctionsType["All"] = "All";
7
7
  GrantedFunctionsType["Listed"] = "Listed";
8
8
  })(GrantedFunctionsType || (GrantedFunctionsType = {}));
9
- /**
10
- * @public
11
- */
12
- export var CapAccessType;
13
- (function (CapAccessType) {
14
- CapAccessType["Unrestricted"] = "Unrestricted";
15
- CapAccessType["Transferable"] = "Transferable";
16
- CapAccessType["Assigned"] = "Assigned";
17
- })(CapAccessType || (CapAccessType = {}));
@@ -4,7 +4,7 @@ import { CreateLink, Delete, DeleteLink, Action, NewEntryAction, Update } from "
4
4
  /**
5
5
  * @public
6
6
  */
7
- export declare enum DhtOpType {
7
+ export declare enum ChainOpType {
8
8
  StoreRecord = "StoreRecord",
9
9
  StoreEntry = "StoreEntry",
10
10
  RegisterAgentActivity = "RegisterAgentActivity",
@@ -40,27 +40,31 @@ export interface WarrantOp {
40
40
  * @public
41
41
  */
42
42
  export type ChainOp = {
43
- [DhtOpType.StoreRecord]: [Signature, Action, Entry | undefined];
43
+ [ChainOpType.StoreRecord]: [Signature, Action, Entry | undefined];
44
44
  } | {
45
- [DhtOpType.StoreEntry]: [Signature, NewEntryAction, Entry];
45
+ [ChainOpType.StoreEntry]: [Signature, NewEntryAction, Entry];
46
46
  } | {
47
- [DhtOpType.RegisterAgentActivity]: [Signature, Action];
47
+ [ChainOpType.RegisterAgentActivity]: [Signature, Action];
48
48
  } | {
49
- [DhtOpType.RegisterUpdatedContent]: [
49
+ [ChainOpType.RegisterUpdatedContent]: [
50
50
  Signature,
51
51
  Update,
52
52
  Entry | undefined
53
53
  ];
54
54
  } | {
55
- [DhtOpType.RegisterUpdatedRecord]: [Signature, Update, Entry | undefined];
55
+ [ChainOpType.RegisterUpdatedRecord]: [
56
+ Signature,
57
+ Update,
58
+ Entry | undefined
59
+ ];
56
60
  } | {
57
- [DhtOpType.RegisterDeletedBy]: [Signature, Delete];
61
+ [ChainOpType.RegisterDeletedBy]: [Signature, Delete];
58
62
  } | {
59
- [DhtOpType.RegisterDeletedEntryAction]: [Signature, Delete];
63
+ [ChainOpType.RegisterDeletedEntryAction]: [Signature, Delete];
60
64
  } | {
61
- [DhtOpType.RegisterAddLink]: [Signature, CreateLink];
65
+ [ChainOpType.RegisterAddLink]: [Signature, CreateLink];
62
66
  } | {
63
- [DhtOpType.RegisterRemoveLink]: [Signature, DeleteLink];
67
+ [ChainOpType.RegisterRemoveLink]: [Signature, DeleteLink];
64
68
  };
65
69
  /**
66
70
  * @public
@@ -87,14 +91,14 @@ export type ChainIntegrityWarrant = {
87
91
  action: ActionHashAndSig;
88
92
  /** Whether to run app or sys validation */
89
93
  validation_type: ValidationType;
90
- } | {
91
- /** Proof of chain fork. */
92
- ChainFork: {
93
- /** Author of the chain which is forked */
94
- chain_author: AgentPubKey;
95
- /** Two actions of the same seq number which prove the fork */
96
- action_pair: [ActionHashAndSig, ActionHashAndSig];
97
- };
94
+ };
95
+ } | {
96
+ /** Proof of chain fork. */
97
+ ChainFork: {
98
+ /** Author of the chain which is forked */
99
+ chain_author: AgentPubKey;
100
+ /** Two actions of the same seq number which prove the fork */
101
+ action_pair: [ActionHashAndSig, ActionHashAndSig];
98
102
  };
99
103
  };
100
104
  /**
@@ -114,16 +118,16 @@ export type ActionHashAndSig = [ActionHash, Signature];
114
118
  /**
115
119
  * @public
116
120
  */
117
- export declare function getDhtOpType(op: DhtOp): DhtOpType;
121
+ export declare function getChainOpType(op: ChainOp): ChainOpType;
118
122
  /**
119
123
  * @public
120
124
  */
121
- export declare function getDhtOpAction(op: DhtOp): Action;
125
+ export declare function getChainOpAction(op: ChainOp): Action;
122
126
  /**
123
127
  * @public
124
128
  */
125
- export declare function getDhtOpEntry(op: DhtOp): Entry | undefined;
129
+ export declare function getChainOpEntry(op: ChainOp): Entry | undefined;
126
130
  /**
127
131
  * @public
128
132
  */
129
- export declare function getDhtOpSignature(op: DhtOp): Signature;
133
+ export declare function getChainOpSignature(op: ChainOp): Signature;
@@ -2,38 +2,38 @@
2
2
  /**
3
3
  * @public
4
4
  */
5
- export var DhtOpType;
6
- (function (DhtOpType) {
7
- DhtOpType["StoreRecord"] = "StoreRecord";
8
- DhtOpType["StoreEntry"] = "StoreEntry";
9
- DhtOpType["RegisterAgentActivity"] = "RegisterAgentActivity";
10
- DhtOpType["RegisterUpdatedContent"] = "RegisterUpdatedContent";
11
- DhtOpType["RegisterUpdatedRecord"] = "RegisterUpdatedRecord";
12
- DhtOpType["RegisterDeletedBy"] = "RegisterDeletedBy";
13
- DhtOpType["RegisterDeletedEntryAction"] = "RegisterDeletedEntryAction";
14
- DhtOpType["RegisterAddLink"] = "RegisterAddLink";
15
- DhtOpType["RegisterRemoveLink"] = "RegisterRemoveLink";
16
- })(DhtOpType || (DhtOpType = {}));
5
+ export var ChainOpType;
6
+ (function (ChainOpType) {
7
+ ChainOpType["StoreRecord"] = "StoreRecord";
8
+ ChainOpType["StoreEntry"] = "StoreEntry";
9
+ ChainOpType["RegisterAgentActivity"] = "RegisterAgentActivity";
10
+ ChainOpType["RegisterUpdatedContent"] = "RegisterUpdatedContent";
11
+ ChainOpType["RegisterUpdatedRecord"] = "RegisterUpdatedRecord";
12
+ ChainOpType["RegisterDeletedBy"] = "RegisterDeletedBy";
13
+ ChainOpType["RegisterDeletedEntryAction"] = "RegisterDeletedEntryAction";
14
+ ChainOpType["RegisterAddLink"] = "RegisterAddLink";
15
+ ChainOpType["RegisterRemoveLink"] = "RegisterRemoveLink";
16
+ })(ChainOpType || (ChainOpType = {}));
17
17
  /**
18
18
  * @public
19
19
  */
20
- export function getDhtOpType(op) {
20
+ export function getChainOpType(op) {
21
21
  return Object.keys(op)[0];
22
22
  }
23
23
  /**
24
24
  * @public
25
25
  */
26
- export function getDhtOpAction(op) {
27
- const opType = getDhtOpType(op);
26
+ export function getChainOpAction(op) {
27
+ const opType = getChainOpType(op);
28
28
  const action = Object.values(op)[0][1];
29
- if (opType === DhtOpType.RegisterAddLink) {
29
+ if (opType === ChainOpType.RegisterAddLink) {
30
30
  return {
31
31
  type: "CreateLink",
32
32
  ...action,
33
33
  };
34
34
  }
35
- if (opType === DhtOpType.RegisterUpdatedContent ||
36
- opType === DhtOpType.RegisterUpdatedRecord) {
35
+ if (opType === ChainOpType.RegisterUpdatedContent ||
36
+ opType === ChainOpType.RegisterUpdatedRecord) {
37
37
  return {
38
38
  type: "Update",
39
39
  ...action,
@@ -52,12 +52,12 @@ export function getDhtOpAction(op) {
52
52
  /**
53
53
  * @public
54
54
  */
55
- export function getDhtOpEntry(op) {
55
+ export function getChainOpEntry(op) {
56
56
  return Object.values(op)[0][2];
57
57
  }
58
58
  /**
59
59
  * @public
60
60
  */
61
- export function getDhtOpSignature(op) {
61
+ export function getChainOpSignature(op) {
62
62
  return Object.values(op)[0][1];
63
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holochain/client",
3
- "version": "0.19.0-dev.5",
3
+ "version": "0.19.0-dev.7",
4
4
  "description": "A JavaScript client for the Holochain Conductor API",
5
5
  "author": "Holochain Foundation <info@holochain.org> (https://holochain.org)",
6
6
  "license": "CAL-1.0",
@@ -55,6 +55,7 @@
55
55
  "devDependencies": {
56
56
  "@microsoft/api-documenter": "^7.21.7",
57
57
  "@microsoft/api-extractor": "^7.34.4",
58
+ "@types/js-yaml": "4.0.9",
58
59
  "@types/libsodium-wrappers": "^0.7.11",
59
60
  "@types/lodash-es": "^4.17.6",
60
61
  "@types/tape": "^4.13.2",
@@ -65,7 +66,7 @@
65
66
  "eslint-config-prettier": "^8.10.0",
66
67
  "eslint-plugin-prettier": "^4.2.1",
67
68
  "eslint-plugin-tsdoc": "^0.2.17",
68
- "js-yaml": "^3.14.1",
69
+ "js-yaml": "^4.1.0",
69
70
  "prettier": "^2.8.8",
70
71
  "rimraf": "^3.0.2",
71
72
  "tape": "^5.6.6",