@holochain/client 0.19.0-dev.6 → 0.19.0-dev.8

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
@@ -142,12 +146,16 @@ export type RoleSettingsMap = {
142
146
  * @public
143
147
  */
144
148
  export type RoleSettings = {
145
- type: "UseExisting";
146
- cell_id: CellId;
149
+ type: "use_existing";
150
+ value: {
151
+ cell_id: CellId;
152
+ };
147
153
  } | {
148
- type: "Provisioned";
149
- membrane_proof?: MembraneProof;
150
- modifiers?: DnaModifiersOpt;
154
+ type: "provisioned";
155
+ value: {
156
+ membrane_proof?: MembraneProof;
157
+ modifiers?: DnaModifiersOpt;
158
+ };
151
159
  };
152
160
  /**
153
161
  * @public
@@ -232,11 +240,12 @@ export type RevokeAgentKeyResponse = [CellId, string][];
232
240
  * @public
233
241
  */
234
242
  export type RegisterDnaRequest = {
243
+ source: DnaSource;
235
244
  modifiers?: {
236
245
  network_seed?: string;
237
246
  properties?: DnaProperties;
238
247
  };
239
- } & DnaSource;
248
+ };
240
249
  /**
241
250
  * @public
242
251
  */
@@ -316,8 +325,9 @@ export type UninstallAppResponse = null;
316
325
  * @public
317
326
  */
318
327
  export type UpdateCoordinatorsRequest = {
328
+ source: CoordinatorSource;
319
329
  dna_hash: DnaHash;
320
- } & CoordinatorSource;
330
+ };
321
331
  /**
322
332
  * @public
323
333
  */
@@ -432,9 +442,11 @@ export type AppBundle = {
432
442
  * @public
433
443
  */
434
444
  export type AppBundleSource = {
435
- bundle: AppBundle;
445
+ type: "path";
446
+ value: string;
436
447
  } | {
437
- path: string;
448
+ type: "bytes";
449
+ value: Uint8Array;
438
450
  };
439
451
  /**
440
452
  * @public
@@ -444,6 +456,11 @@ export type NetworkSeed = string;
444
456
  * @public
445
457
  */
446
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;
447
464
  /**
448
465
  * The agent to use when creating Cells for this App.
449
466
  * If not specified, a new agent will be generated by Holochain.
@@ -471,7 +488,7 @@ export type InstallAppRequest = {
471
488
  * using graft_records_onto_source_chain, or for diagnostics.
472
489
  */
473
490
  ignore_genesis_failure?: boolean;
474
- } & AppBundleSource;
491
+ };
475
492
  /**
476
493
  * @public
477
494
  */
@@ -504,11 +521,11 @@ export type ListActiveAppsResponse = Array<InstalledAppId>;
504
521
  * @public
505
522
  */
506
523
  export declare enum AppStatusFilter {
507
- Enabled = "Enabled",
508
- Disabled = "Disabled",
509
- Running = "Running",
510
- Stopped = "Stopped",
511
- Paused = "Paused"
524
+ Enabled = "enabled",
525
+ Disabled = "disabled",
526
+ Running = "running",
527
+ Stopped = "stopped",
528
+ Paused = "paused"
512
529
  }
513
530
  /**
514
531
  * @public
@@ -573,7 +590,7 @@ export interface DeleteCloneCellRequest {
573
590
  /**
574
591
  * The clone id or cell id of the clone cell
575
592
  */
576
- clone_cell_id: RoleName | DnaHash;
593
+ clone_cell_id: CloneCellId;
577
594
  }
578
595
  /**
579
596
  * @public
@@ -640,9 +657,11 @@ export interface CoordinatorBundle {
640
657
  * @public
641
658
  */
642
659
  export type CoordinatorSource = {
643
- path: string;
660
+ type: "path";
661
+ value: string;
644
662
  } | {
645
- bundle: CoordinatorBundle;
663
+ type: "bundle";
664
+ value: CoordinatorBundle;
646
665
  };
647
666
  /**
648
667
  * @public
@@ -701,11 +720,14 @@ export type DnaBundle = {
701
720
  * @public
702
721
  */
703
722
  export type DnaSource = {
704
- hash: HoloHash;
723
+ type: "path";
724
+ value: string;
705
725
  } | {
706
- path: string;
726
+ type: "bundle";
727
+ value: DnaBundle;
707
728
  } | {
708
- bundle: DnaBundle;
729
+ type: "hash";
730
+ value: HoloHash;
709
731
  };
710
732
  /**
711
733
  * @public
@@ -796,9 +818,10 @@ export interface DnaStorageInfo {
796
818
  /**
797
819
  * @public
798
820
  */
799
- export interface DnaStorageBlob {
800
- dna: DnaStorageInfo;
801
- }
821
+ export type DnaStorageBlob = {
822
+ type: "dna";
823
+ value: DnaStorageInfo;
824
+ };
802
825
  /**
803
826
  * @public
804
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.6",
3
+ "version": "0.19.0-dev.8",
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",