Skip to content

Commit

Permalink
Update InstallAppRequest type to new format (#298)
Browse files Browse the repository at this point in the history
* update InstallAppRequest type to new format

* add new YamlProperties type and test that installs app with roles_settings set

* use js-yaml in test

* remove unnecessary fields, remove js-yaml from dependencies, convert pubkey to Uint8Array to have deepEqual work properly

* more redundant membrane_proof fields, revert hdk bump

* removed unused roles_settings fields
  • Loading branch information
matthme authored Nov 28, 2024
1 parent 7660915 commit 43d5e9e
Show file tree
Hide file tree
Showing 16 changed files with 256 additions and 76 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added
### Fixed
### Changed
- Change `InstallAppRequest` type to adhere to the new format that includes the `roles_settings` field and removes
the `membrane_proofs` field as membrane proofs are now specified as part of the `roles_settings`.
### Removed

## 2024-11-21: v0.19.0-dev.5
Expand All @@ -24,7 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## 2024-11-12: v0.19.0-dev.2
### Added
- AppWebsocket calls to interact with countersigning sessions, i.e. `GetCountersigningSessionState` as well as `AbandonCountersigningSession` and `PublishCountersigningSession` when a session could not be resolved automatically. Countersigning is an unstable feature which must explicitly be enabled in Holochain.

## 2024-10-28: v0.19.0-dev.1
### Added
- Bring back a websocket reconnection automation for Admin and App websockets. When either of them is closed and a new request made, it will attempt to reconnect using the same app authentication token that was used to initially authenticate the websocket. A specific `InvalidTokenError` is returned if that fails.
Expand Down
1 change: 0 additions & 1 deletion doc-test-app-ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const appInfo = await adminWs.installApp({
agent_key,
path: "./test/e2e/fixture/test.happ",
installed_app_id,
membrane_proofs: {},
});
await adminWs.enableApp({ installed_app_id });
if (!(CellType.Provisioned in appInfo.cell_info[role_name][0])) {
Expand Down
1 change: 0 additions & 1 deletion doc-test-signal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const appInfo = await adminWs.installApp({
agent_key,
path: "./test/e2e/fixture/test.happ",
installed_app_id,
membrane_proofs: {},
});
await adminWs.enableApp({ installed_app_id });
if (!(CellType.Provisioned in appInfo.cell_info[role_name][0])) {
Expand Down
19 changes: 19 additions & 0 deletions docs/client.dnamodifiersopt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@holochain/client](./client.md) &gt; [DnaModifiersOpt](./client.dnamodifiersopt.md)

## DnaModifiersOpt type


**Signature:**

```typescript
export type DnaModifiersOpt = {
network_seed?: NetworkSeed;
properties?: YamlProperties;
origin_time?: Timestamp;
quantum_time?: Duration;
};
```
**References:** [NetworkSeed](./client.networkseed.md)<!-- -->, [YamlProperties](./client.yamlproperties.md)<!-- -->, [Timestamp](./client.timestamp.md)<!-- -->, [Duration](./client.duration.md)

4 changes: 2 additions & 2 deletions docs/client.installapprequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
export type InstallAppRequest = {
agent_key?: AgentPubKey;
installed_app_id?: InstalledAppId;
membrane_proofs: MemproofMap;
network_seed?: NetworkSeed;
roles_settings?: RoleSettingsMap;
ignore_genesis_failure?: boolean;
} & AppBundleSource;
```
**References:** [AgentPubKey](./client.agentpubkey.md)<!-- -->, [InstalledAppId](./client.installedappid.md)<!-- -->, [MemproofMap](./client.memproofmap.md)<!-- -->, [NetworkSeed](./client.networkseed.md)<!-- -->, [AppBundleSource](./client.appbundlesource.md)
**References:** [AgentPubKey](./client.agentpubkey.md)<!-- -->, [InstalledAppId](./client.installedappid.md)<!-- -->, [NetworkSeed](./client.networkseed.md)<!-- -->, [RoleSettingsMap](./client.rolesettingsmap.md)<!-- -->, [AppBundleSource](./client.appbundlesource.md)

41 changes: 41 additions & 0 deletions docs/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -1862,6 +1862,16 @@ This type is meant to be opaque



</td></tr>
<tr><td>

[DnaModifiersOpt](./client.dnamodifiersopt.md)


</td><td>



</td></tr>
<tr><td>

Expand Down Expand Up @@ -2718,6 +2728,26 @@ If the key could not be deleted from all cells, the call [RevokeAgentKeyRequest]



</td></tr>
<tr><td>

[RoleSettings](./client.rolesettings.md)


</td><td>



</td></tr>
<tr><td>

[RoleSettingsMap](./client.rolesettingsmap.md)


</td><td>



</td></tr>
<tr><td>

Expand Down Expand Up @@ -2918,6 +2948,17 @@ If the key could not be deleted from all cells, the call [RevokeAgentKeyRequest]



</td></tr>
<tr><td>

[YamlProperties](./client.yamlproperties.md)


</td><td>

Any value that is serializable to a Yaml value


</td></tr>
<tr><td>

Expand Down
4 changes: 2 additions & 2 deletions docs/client.memproofmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

```typescript
export type MemproofMap = {
[key: string]: MembraneProof;
[key: RoleName]: MembraneProof;
};
```
**References:** [MembraneProof](./client.membraneproof.md)
**References:** [RoleName](./client.rolename.md)<!-- -->, [MembraneProof](./client.membraneproof.md)

21 changes: 21 additions & 0 deletions docs/client.rolesettings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@holochain/client](./client.md) &gt; [RoleSettings](./client.rolesettings.md)

## RoleSettings type


**Signature:**

```typescript
export type RoleSettings = {
type: "UseExisting";
cell_id: CellId;
} | {
type: "Provisioned";
membrane_proof?: MembraneProof;
modifiers?: DnaModifiersOpt;
};
```
**References:** [CellId](./client.cellid.md)<!-- -->, [MembraneProof](./client.membraneproof.md)<!-- -->, [DnaModifiersOpt](./client.dnamodifiersopt.md)

16 changes: 16 additions & 0 deletions docs/client.rolesettingsmap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@holochain/client](./client.md) &gt; [RoleSettingsMap](./client.rolesettingsmap.md)

## RoleSettingsMap type


**Signature:**

```typescript
export type RoleSettingsMap = {
[key: RoleName]: RoleSettings;
};
```
**References:** [RoleName](./client.rolename.md)<!-- -->, [RoleSettings](./client.rolesettings.md)

13 changes: 13 additions & 0 deletions docs/client.yamlproperties.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@holochain/client](./client.md) &gt; [YamlProperties](./client.yamlproperties.md)

## YamlProperties type

Any value that is serializable to a Yaml value

**Signature:**

```typescript
export type YamlProperties = unknown;
```
63 changes: 21 additions & 42 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"devDependencies": {
"@microsoft/api-documenter": "^7.21.7",
"@microsoft/api-extractor": "^7.34.4",
"@types/js-yaml": "4.0.9",
"@types/libsodium-wrappers": "^0.7.11",
"@types/lodash-es": "^4.17.6",
"@types/tape": "^4.13.2",
Expand All @@ -65,7 +66,7 @@
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-tsdoc": "^0.2.17",
"js-yaml": "^3.14.1",
"js-yaml": "^4.1.0",
"prettier": "^2.8.8",
"rimraf": "^3.0.2",
"tape": "^5.6.6",
Expand Down
48 changes: 41 additions & 7 deletions src/api/admin/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,42 @@ export type MembraneProof = Uint8Array;
/**
* @public
*/
export type MemproofMap = { [key: string]: MembraneProof };
export type MemproofMap = { [key: RoleName]: MembraneProof };

/**
* @public
*/
export type RoleSettingsMap = { [key: RoleName]: RoleSettings };

/**
* @public
*/
export type RoleSettings =
| {
type: "UseExisting";
cell_id: CellId;
}
| {
type: "Provisioned";
membrane_proof?: MembraneProof;
modifiers?: DnaModifiersOpt;
};

/**
* @public
* Any value that is serializable to a Yaml value
*/
export type YamlProperties = unknown;

/**
* @public
*/
export type DnaModifiersOpt = {
network_seed?: NetworkSeed;
properties?: YamlProperties;
origin_time?: Timestamp;
quantum_time?: Duration;
};

/**
* @public
Expand Down Expand Up @@ -477,18 +512,17 @@ export type InstallAppRequest = {
*/
installed_app_id?: InstalledAppId;

/**
* Include proof-of-membrane-membership data for cells that require it,
* keyed by the CellNick specified in the app bundle manifest.
*/
membrane_proofs: MemproofMap;

/**
* Optional global network seed override. If set will override the network seed value for all
* DNAs in the bundle.
*/
network_seed?: NetworkSeed;

/**
* Specify role specific settings or modifiers that will override any settings in the dna manifest.
*/
roles_settings?: RoleSettingsMap;

/**
* Optional: If app installation fails due to genesis failure, normally the app will be immediately uninstalled.
* When this flag is set, the app is left installed with empty cells intact. This can be useful for
Expand Down
Loading

0 comments on commit 43d5e9e

Please sign in to comment.