@holochain/client 0.18.0-dev.5 → 0.18.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,5 @@
1
1
  import { Action, DhtOp, Entry, ZomeCallCapGrant } from "../../hdk/index.js";
2
- import { ActionHash, AgentPubKey, CellId, DnaHash, DnaProperties, Duration, HoloHash, HoloHashB64, InstalledAppId, KitsuneAgent, KitsuneSpace, RoleName, Signature, Timestamp, WasmHash } from "../../types.js";
2
+ import { ActionHash, AgentPubKey, CellId, DnaHash, DnaHashB64, DnaProperties, Duration, HoloHash, HoloHashB64, InstalledAppId, KitsuneAgent, KitsuneSpace, RoleName, Signature, Timestamp, WasmHash } from "../../types.js";
3
3
  import { Requester } from "../common.js";
4
4
  /**
5
5
  * @public
@@ -52,7 +52,7 @@ export type PausedAppReason = {
52
52
  /**
53
53
  * @public
54
54
  */
55
- export type DisabledAppReason = "never_started" | "user" | {
55
+ export type DisabledAppReason = "never_started" | "user" | "not_started_after_providing_memproofs" | {
56
56
  error: string;
57
57
  };
58
58
  /**
@@ -234,6 +234,7 @@ export type CoordinatorZome = ZomeDefinition;
234
234
  export type DnaDefinition = {
235
235
  name: string;
236
236
  modifiers: DnaModifiers;
237
+ lineage: DnaHashB64[];
237
238
  integrity_zomes: IntegrityZome[];
238
239
  coordinator_zomes: CoordinatorZome[];
239
240
  };
@@ -245,6 +246,14 @@ export type GetDnaDefinitionRequest = DnaHash;
245
246
  * @public
246
247
  */
247
248
  export type GetDnaDefinitionResponse = DnaDefinition;
249
+ /**
250
+ * @public
251
+ */
252
+ export type GetCompatibleCellsRequest = DnaHashB64;
253
+ /**
254
+ * @public
255
+ */
256
+ export type GetCompatibleCellsResponse = Set<[InstalledAppId, Set<CellId>]>;
248
257
  /**
249
258
  * @public
250
259
  */
@@ -610,6 +619,26 @@ export type DnaManifest = {
610
619
  * The order is significant: it determines initialization order.
611
620
  */
612
621
  zomes: Array<ZomeManifest>;
622
+ /**
623
+ * A list of past "ancestors" of this DNA.
624
+ *
625
+ * Whenever a DNA is created which is intended to be used as a migration from
626
+ * a previous DNA, the lineage should be updated to include the hash of the
627
+ * DNA being migrated from. DNA hashes may also be removed from this list if
628
+ * it is desired to remove them from the lineage.
629
+ *
630
+ * The meaning of the "ancestor" relationship is as follows:
631
+ * - For any DNA, there is a migration path from any of its ancestors to itself.
632
+ * - When an app depends on a DnaHash via UseExisting, it means that any installed
633
+ * DNA in the lineage which contains that DnaHash can be used.
634
+ * - The app's Coordinator interface is expected to be compatible across the lineage.
635
+ * (Though this cannot be enforced, since Coordinators can be swapped out at
636
+ * will by the user, the intention is still there.)
637
+ *
638
+ * Holochain does nothing to ensure the correctness of the lineage, it is up to
639
+ * the app developer to make the necessary guarantees.
640
+ */
641
+ lineage: DnaHashB64[];
613
642
  };
614
643
  /**
615
644
  * @public
@@ -2,7 +2,7 @@ import { CapSecret, GrantedFunctions } from "../../hdk/index.js";
2
2
  import type { AgentPubKey, CellId } from "../../types.js";
3
3
  import { WsClient } from "../client.js";
4
4
  import { Requester, Transformer, WebsocketConnectionOptions } from "../common.js";
5
- import { AddAgentInfoRequest, AddAgentInfoResponse, AdminApi, AgentInfoRequest, AgentInfoResponse, AttachAppInterfaceRequest, AttachAppInterfaceResponse, DeleteCloneCellRequest, DeleteCloneCellResponse, DisableAppRequest, DisableAppResponse, DumpFullStateRequest, DumpFullStateResponse, DumpNetworkStatsRequest, DumpNetworkStatsResponse, DumpStateRequest, DumpStateResponse, EnableAppRequest, EnableAppResponse, GenerateAgentPubKeyRequest, GenerateAgentPubKeyResponse, GetDnaDefinitionRequest, GetDnaDefinitionResponse, GrantZomeCallCapabilityRequest, GrantZomeCallCapabilityResponse, InstallAppRequest, InstallAppResponse, IssueAppAuthenticationTokenRequest, IssueAppAuthenticationTokenResponse, ListAppInterfacesRequest, ListAppInterfacesResponse, ListAppsRequest, ListAppsResponse, ListCellIdsRequest, ListCellIdsResponse, ListDnasRequest, ListDnasResponse, RegisterDnaRequest, RegisterDnaResponse, StorageInfoRequest, StorageInfoResponse, UninstallAppRequest, UninstallAppResponse, UpdateCoordinatorsRequest, UpdateCoordinatorsResponse } from "./types.js";
5
+ import { AddAgentInfoRequest, AddAgentInfoResponse, AdminApi, AgentInfoRequest, AgentInfoResponse, AttachAppInterfaceRequest, AttachAppInterfaceResponse, DeleteCloneCellRequest, DeleteCloneCellResponse, DisableAppRequest, DisableAppResponse, DumpFullStateRequest, DumpFullStateResponse, DumpNetworkStatsRequest, DumpNetworkStatsResponse, DumpStateRequest, DumpStateResponse, EnableAppRequest, EnableAppResponse, GenerateAgentPubKeyRequest, GenerateAgentPubKeyResponse, GetCompatibleCellsRequest, GetCompatibleCellsResponse, GetDnaDefinitionRequest, GetDnaDefinitionResponse, GrantZomeCallCapabilityRequest, GrantZomeCallCapabilityResponse, InstallAppRequest, InstallAppResponse, IssueAppAuthenticationTokenRequest, IssueAppAuthenticationTokenResponse, ListAppInterfacesRequest, ListAppInterfacesResponse, ListAppsRequest, ListAppsResponse, ListCellIdsRequest, ListCellIdsResponse, ListDnasRequest, ListDnasResponse, RegisterDnaRequest, RegisterDnaResponse, StorageInfoRequest, StorageInfoResponse, UninstallAppRequest, UninstallAppResponse, UpdateCoordinatorsRequest, UpdateCoordinatorsResponse } from "./types.js";
6
6
  /**
7
7
  * A class for interacting with a conductor's Admin API.
8
8
  *
@@ -61,6 +61,7 @@ export declare class AdminWebsocket implements AdminApi {
61
61
  * Get the DNA definition for the specified DNA hash.
62
62
  */
63
63
  getDnaDefinition: Requester<GetDnaDefinitionRequest, GetDnaDefinitionResponse>;
64
+ getCompatibleCells: Requester<GetCompatibleCellsRequest, GetCompatibleCellsResponse>;
64
65
  /**
65
66
  * Uninstall the specified app from Holochain.
66
67
  */
@@ -78,6 +78,9 @@ export class AdminWebsocket {
78
78
  * Get the DNA definition for the specified DNA hash.
79
79
  */
80
80
  getDnaDefinition = this._requester("get_dna_definition");
81
+ /// Find installed cells which use a DNA that's forward-compatible with the given DNA hash.
82
+ /// Namely, this finds cells with DNAs whose manifest lists the given DNA hash in its `lineage` field.
83
+ getCompatibleCells = this._requester("get_compatible_cells");
81
84
  /**
82
85
  * Uninstall the specified app from Holochain.
83
86
  */
@@ -90,6 +90,14 @@ export type ProvideMemproofsRequest = MemproofMap;
90
90
  * @public
91
91
  */
92
92
  export type ProvideMemproofsResponse = void;
93
+ /**
94
+ * @public
95
+ */
96
+ export type EnableRequest = void;
97
+ /**
98
+ * @public
99
+ */
100
+ export type EnableResponse = void;
93
101
  /**
94
102
  * @public
95
103
  */
@@ -20,6 +20,7 @@ export declare class AppWebsocket implements AppClient {
20
20
  private readonly appInfoRequester;
21
21
  private readonly callZomeRequester;
22
22
  private readonly provideMemproofRequester;
23
+ private readonly enableAppRequester;
23
24
  private readonly createCloneCellRequester;
24
25
  private readonly enableCloneCellRequester;
25
26
  private readonly disableCloneCellRequester;
@@ -46,6 +47,11 @@ export declare class AppWebsocket implements AppClient {
46
47
  * @param memproofs - A map of {@link MembraneProof}s.
47
48
  */
48
49
  provideMemproofs(memproofs: MemproofMap): Promise<void>;
50
+ /**
51
+ * Enablie an app only if the app is in the `AppStatus::Disabled(DisabledAppReason::NotStartedAfterProvidingMemproofs)`
52
+ * state. Attempting to enable the app from other states (other than Running) will fail.
53
+ */
54
+ enableApp(): Promise<void>;
49
55
  /**
50
56
  * Get a cell id by its role name or clone id.
51
57
  *
@@ -26,6 +26,7 @@ export class AppWebsocket {
26
26
  appInfoRequester;
27
27
  callZomeRequester;
28
28
  provideMemproofRequester;
29
+ enableAppRequester;
29
30
  createCloneCellRequester;
30
31
  enableCloneCellRequester;
31
32
  disableCloneCellRequester;
@@ -41,6 +42,7 @@ export class AppWebsocket {
41
42
  this.appInfoRequester = AppWebsocket.requester(this.client, "app_info", this.defaultTimeout);
42
43
  this.callZomeRequester = AppWebsocket.requester(this.client, "call_zome", this.defaultTimeout, this.callZomeTransform);
43
44
  this.provideMemproofRequester = AppWebsocket.requester(this.client, "provide_memproofs", this.defaultTimeout);
45
+ this.enableAppRequester = AppWebsocket.requester(this.client, "enable_app", this.defaultTimeout);
44
46
  this.createCloneCellRequester = AppWebsocket.requester(this.client, "create_clone_cell", this.defaultTimeout);
45
47
  this.enableCloneCellRequester = AppWebsocket.requester(this.client, "enable_clone_cell", this.defaultTimeout);
46
48
  this.disableCloneCellRequester = AppWebsocket.requester(this.client, "disable_clone_cell", this.defaultTimeout);
@@ -115,6 +117,13 @@ export class AppWebsocket {
115
117
  async provideMemproofs(memproofs) {
116
118
  await this.provideMemproofRequester(memproofs);
117
119
  }
120
+ /**
121
+ * Enablie an app only if the app is in the `AppStatus::Disabled(DisabledAppReason::NotStartedAfterProvidingMemproofs)`
122
+ * state. Attempting to enable the app from other states (other than Running) will fail.
123
+ */
124
+ async enableApp() {
125
+ await this.enableAppRequester();
126
+ }
118
127
  /**
119
128
  * Get a cell id by its role name or clone id.
120
129
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holochain/client",
3
- "version": "0.18.0-dev.5",
3
+ "version": "0.18.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",