From f696b61deced4d9b36effce2cced1d7159efceae Mon Sep 17 00:00:00 2001
From: matthme <36768177+matthme@users.noreply.github.com>
Date: Sun, 1 Dec 2024 18:19:35 +0000
Subject: [PATCH 1/2] Backport Add roles settings (#246)
* add new roles-settings field
* fix role name
* added changelog
* buump holochain_conductor_api
* address suggestions
---
CHANGELOG.md | 5 +-
Cargo.lock | 95 ++++++++++++++++------
crates/trycp_server/Cargo.toml | 2 +-
docs/tryorama.appoptions.md | 12 +--
docs/tryorama.appoptions.membraneproofs.md | 13 ---
docs/tryorama.appoptions.rolessettings.md | 13 +++
flake.lock | 54 ++++++------
package-lock.json | 79 +++++++-----------
package.json | 3 +-
ts/src/local/conductor.ts | 9 +-
ts/src/trycp/conductor/conductor.ts | 13 ++-
ts/src/types.ts | 5 +-
ts/test/local/conductor.ts | 85 +++++++++++++++++--
ts/test/local/scenario.ts | 6 +-
ts/test/trycp/client.ts | 6 +-
ts/test/trycp/conductor.ts | 94 +++++++++++++++++++--
16 files changed, 330 insertions(+), 164 deletions(-)
delete mode 100644 docs/tryorama.appoptions.membraneproofs.md
create mode 100644 docs/tryorama.appoptions.rolessettings.md
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 53151e1b..f6ba558f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,9 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Disable tests with unstable features.
### Added
+- Support new `roles_settings` field in `AppOptions`.
### Removed
### Changed
-- Update dependencies to Holochain v0.4.0-rc.0
+- Update dependencies to Holochain v0.4.0-rc.2
### Fixed
## 2024-10-02: v0.17.0-dev.6
@@ -221,7 +222,7 @@ Compatible with Holochain v0.1.0
## [0.6.2]
### Added
-- feat(common): add app and role id options to hApp installation
+- feat(common): add app and role id options to hApp installation
- feat(common): add mem-proofs to installAgentsHapps (#139)
- feat(trycp): add multiple clients by array of URLs
- feat(trycp): add multiple clients/players
diff --git a/Cargo.lock b/Cargo.lock
index c604d949..95b6ce24 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1265,9 +1265,9 @@ dependencies = [
[[package]]
name = "holochain_conductor_api"
-version = "0.4.0-rc.1"
+version = "0.4.0-rc.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0247f089df123fc6ba826c7e62c843af3001d12a8d9b654bcb013b22220c9fe1"
+checksum = "0be8f80ae5531305d48ef868cd5d71e58d9c4f348e7ca90bad072c3f57e503b4"
dependencies = [
"cfg-if 1.0.0",
"derive_more",
@@ -1309,9 +1309,9 @@ dependencies = [
[[package]]
name = "holochain_keystore"
-version = "0.4.0-rc.1"
+version = "0.4.0-rc.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4146e850bae3c893ad12103f1e1c2d3dd7760385ad6364f776b3f90ff4af8584"
+checksum = "3d8234a44c072aa8a3766e5f2686d9eea9c85507f6582951ddb0a660d6ef1802"
dependencies = [
"base64 0.22.1",
"derive_more",
@@ -1385,9 +1385,9 @@ dependencies = [
[[package]]
name = "holochain_sqlite"
-version = "0.4.0-rc.1"
+version = "0.4.0-rc.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8556cafe6c0c9061845647abb6b7c066c96734dc5444866229e3dde25f664dc5"
+checksum = "00c081bca17e6a58157b5f45abcfdfba1067c3b38e575bdd65871854e049b293"
dependencies = [
"anyhow",
"async-trait",
@@ -1459,9 +1459,9 @@ dependencies = [
[[package]]
name = "holochain_types"
-version = "0.4.0-rc.1"
+version = "0.4.0-rc.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "300e3b6ff164d7e5f85139b0bd5d9c18d0d82da4e6bc32a634e44f9c708d57f1"
+checksum = "91090efe13869808982638d0bec270f5eeee7d2980b7bdd17ca5317853fb71db"
dependencies = [
"anyhow",
"async-trait",
@@ -1705,7 +1705,7 @@ dependencies = [
"iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
- "windows-core",
+ "windows-core 0.52.0",
]
[[package]]
@@ -1952,9 +1952,9 @@ dependencies = [
[[package]]
name = "kitsune_p2p_types"
-version = "0.4.0-rc.1"
+version = "0.4.0-rc.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2ddef0391cab11b43331284dedf55c43cc3ac932307f8a0ee97d230ab8a4ab24"
+checksum = "b09bc80d2b76e429470249e0979c0c52cf7db5ae1c9e5718ea836b2b0dff2b72"
dependencies = [
"base64 0.22.1",
"derive_more",
@@ -1983,9 +1983,9 @@ dependencies = [
[[package]]
name = "lair_keystore"
-version = "0.5.2"
+version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "64d28639d61fce26c920ba0a786cd662d609cd40832762c74716df1355cf53db"
+checksum = "d9b6f792c308afb82ceac6035fcf0ad321eaf271b892d08789d822e78b112a4d"
dependencies = [
"lair_keystore_api",
"pretty_assertions",
@@ -1999,9 +1999,9 @@ dependencies = [
[[package]]
name = "lair_keystore_api"
-version = "0.5.2"
+version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "20b5bd4a14c91039d6d28aaffe11c36060ec0e542123c81f901f661e3cfcb94f"
+checksum = "f5d6aa053bddb4e4c36652217349511ea9c51f1bdaf60530a7013d2d4c91204e"
dependencies = [
"base64 0.22.1",
"dunce",
@@ -2014,7 +2014,6 @@ dependencies = [
"serde",
"serde_json",
"serde_yaml",
- "time",
"tokio",
"toml",
"tracing",
@@ -2031,9 +2030,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "libc"
-version = "0.2.159"
+version = "0.2.167"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
+checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc"
[[package]]
name = "libflate"
@@ -3739,15 +3738,14 @@ dependencies = [
[[package]]
name = "sysinfo"
-version = "0.30.13"
+version = "0.32.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0a5b4ddaee55fb2bea2bf0e5000747e5f5c0de765e5a5ff87f4cd106439f4bb3"
+checksum = "4c33cd241af0f2e9e3b5c32163b873b29956890b5342e6745b917ce9d490f4af"
dependencies = [
- "cfg-if 1.0.0",
"core-foundation-sys",
"libc",
+ "memchr",
"ntapi",
- "once_cell",
"rayon",
"windows",
]
@@ -4507,11 +4505,11 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows"
-version = "0.52.0"
+version = "0.57.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
+checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143"
dependencies = [
- "windows-core",
+ "windows-core 0.57.0",
"windows-targets 0.52.6",
]
@@ -4524,17 +4522,60 @@ dependencies = [
"windows-targets 0.52.6",
]
+[[package]]
+name = "windows-core"
+version = "0.57.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d"
+dependencies = [
+ "windows-implement",
+ "windows-interface",
+ "windows-result 0.1.2",
+ "windows-targets 0.52.6",
+]
+
+[[package]]
+name = "windows-implement"
+version = "0.57.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7"
+dependencies = [
+ "proc-macro2 1.0.87",
+ "quote 1.0.37",
+ "syn 2.0.79",
+]
+
+[[package]]
+name = "windows-interface"
+version = "0.57.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7"
+dependencies = [
+ "proc-macro2 1.0.87",
+ "quote 1.0.37",
+ "syn 2.0.79",
+]
+
[[package]]
name = "windows-registry"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0"
dependencies = [
- "windows-result",
+ "windows-result 0.2.0",
"windows-strings",
"windows-targets 0.52.6",
]
+[[package]]
+name = "windows-result"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8"
+dependencies = [
+ "windows-targets 0.52.6",
+]
+
[[package]]
name = "windows-result"
version = "0.2.0"
@@ -4550,7 +4591,7 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
dependencies = [
- "windows-result",
+ "windows-result 0.2.0",
"windows-targets 0.52.6",
]
diff --git a/crates/trycp_server/Cargo.toml b/crates/trycp_server/Cargo.toml
index de939fd8..a2e5082b 100644
--- a/crates/trycp_server/Cargo.toml
+++ b/crates/trycp_server/Cargo.toml
@@ -37,7 +37,7 @@ trycp_api = { workspace = true }
url = { workspace = true }
[dev-dependencies]
-holochain_conductor_api = "0.4.0-rc.1"
+holochain_conductor_api = "0.4.0-rc.2"
rand = "0.8"
serde_yaml = "0.9"
trycp_client = { path = "../trycp_client" }
diff --git a/docs/tryorama.appoptions.md b/docs/tryorama.appoptions.md
index 7f1345b9..ce0ce695 100644
--- a/docs/tryorama.appoptions.md
+++ b/docs/tryorama.appoptions.md
@@ -75,7 +75,7 @@ _(Optional)_ App ID to override the app manifest's app name.
-[membraneProofs?](./tryorama.appoptions.membraneproofs.md)
+[networkSeed?](./tryorama.appoptions.networkseed.md)
|
@@ -83,18 +83,18 @@ _(Optional)_ App ID to override the app manifest's app name.
|
-Record<string, MembraneProof>
+string
|
-_(Optional)_ Proofs of membership for the hApp.
+_(Optional)_ A network seed to override the hApps' network seed.
|
-[networkSeed?](./tryorama.appoptions.networkseed.md)
+[rolesSettings?](./tryorama.appoptions.rolessettings.md)
|
@@ -102,12 +102,12 @@ _(Optional)_ Proofs of membership for the hApp.
|
-string
+RoleSettingsMap
|
-_(Optional)_ A network seed to override the hApps' network seed.
+_(Optional)_ Role specific settings or modifiers that will override any settings in the hApp's dna manifest(s).
|
diff --git a/docs/tryorama.appoptions.membraneproofs.md b/docs/tryorama.appoptions.membraneproofs.md
deleted file mode 100644
index 2d29defb..00000000
--- a/docs/tryorama.appoptions.membraneproofs.md
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-[Home](./index.md) > [@holochain/tryorama](./tryorama.md) > [AppOptions](./tryorama.appoptions.md) > [membraneProofs](./tryorama.appoptions.membraneproofs.md)
-
-## AppOptions.membraneProofs property
-
-Proofs of membership for the hApp.
-
-**Signature:**
-
-```typescript
-membraneProofs?: Record;
-```
diff --git a/docs/tryorama.appoptions.rolessettings.md b/docs/tryorama.appoptions.rolessettings.md
new file mode 100644
index 00000000..b4c48981
--- /dev/null
+++ b/docs/tryorama.appoptions.rolessettings.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [@holochain/tryorama](./tryorama.md) > [AppOptions](./tryorama.appoptions.md) > [rolesSettings](./tryorama.appoptions.rolessettings.md)
+
+## AppOptions.rolesSettings property
+
+Role specific settings or modifiers that will override any settings in the hApp's dna manifest(s).
+
+**Signature:**
+
+```typescript
+rolesSettings?: RoleSettingsMap;
+```
diff --git a/flake.lock b/flake.lock
index 7d50ac5c..a58bbdaa 100644
--- a/flake.lock
+++ b/flake.lock
@@ -2,11 +2,11 @@
"nodes": {
"crane": {
"locked": {
- "lastModified": 1727316705,
- "narHash": "sha256-/mumx8AQ5xFuCJqxCIOFCHTVlxHkMT21idpbgbm/TIE=",
+ "lastModified": 1733016477,
+ "narHash": "sha256-Hh0khbqBeCtiNS0SJgqdWrQDem9WlPEc2KF5pAY+st0=",
"owner": "ipetkov",
"repo": "crane",
- "rev": "5b03654ce046b5167e7b0bccbd8244cb56c16f0e",
+ "rev": "76d64e779e2fbaf172110038492343a8c4e29b55",
"type": "github"
},
"original": {
@@ -20,11 +20,11 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
- "lastModified": 1727826117,
- "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=",
+ "lastModified": 1730504689,
+ "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=",
"owner": "hercules-ci",
"repo": "flake-parts",
- "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1",
+ "rev": "506278e768c2a08bec68eb62932193e341f55c90",
"type": "github"
},
"original": {
@@ -53,11 +53,11 @@
"hc-scaffold": {
"flake": false,
"locked": {
- "lastModified": 1727375207,
- "narHash": "sha256-wGS+cOhvakLWscqPI0LaBZVZ3ryORV3YDvL+bfhI+WA=",
+ "lastModified": 1731921057,
+ "narHash": "sha256-8Qn6yXNVRTAiKCwlZpD9PDW6JQZh7lgOEa9kmnsbXnM=",
"owner": "holochain",
"repo": "scaffolding",
- "rev": "b218f253a124b6e7b5be0600c3aab7a57344f0f2",
+ "rev": "2c5dc235c2e42b458bbc40cdd8c35bf588a2c40c",
"type": "github"
},
"original": {
@@ -70,16 +70,16 @@
"holochain": {
"flake": false,
"locked": {
- "lastModified": 1728079169,
- "narHash": "sha256-sbQiTsh5dhI8ioQIfYkdNsCQCCT+vef+RhXumvYiVQQ=",
+ "lastModified": 1732794113,
+ "narHash": "sha256-p123iaQbIY7bkJWnRab3saVNTOBWwl4N6Sz1sYMPAWQ=",
"owner": "holochain",
"repo": "holochain",
- "rev": "d2868417b921850206247595f0e00d6eaf1b84f2",
+ "rev": "662cbcc45a685425355f5e3682c080a101271dfa",
"type": "github"
},
"original": {
"owner": "holochain",
- "ref": "holochain-0.4.0-rc.0",
+ "ref": "holochain-0.4.0-rc.2",
"repo": "holochain",
"type": "github"
}
@@ -100,11 +100,11 @@
]
},
"locked": {
- "lastModified": 1728325228,
- "narHash": "sha256-On5Kto/s/mEqHm1QfJ1+5FSwkQw4E7ArHVj2ImO58t0=",
+ "lastModified": 1732887221,
+ "narHash": "sha256-P+jweVdZGA3W2IWTCy5LNqfALOaPtRLVjnJ6glUWTgg=",
"owner": "holochain",
"repo": "holonix",
- "rev": "6df6c63e5c06720289a7e7376deec94b620af470",
+ "rev": "ee077eae3686922620dd18edd1b975d307890ce0",
"type": "github"
},
"original": {
@@ -117,16 +117,16 @@
"lair-keystore": {
"flake": false,
"locked": {
- "lastModified": 1726865440,
- "narHash": "sha256-+ARQs+Sfmh8QXMyjjHjm6Ib8Ag86Jm2vnyB6l3zTCgA=",
+ "lastModified": 1732721902,
+ "narHash": "sha256-D8sXIpOptaXib5bc6zS7KsGzu4D08jaL8Fx1W/mlADE=",
"owner": "holochain",
"repo": "lair",
- "rev": "9f306efed597765b70da704e1739ecc67f2510e0",
+ "rev": "e82937521ae9b7bdb30c8b0736c13cd4220a0223",
"type": "github"
},
"original": {
"owner": "holochain",
- "ref": "lair_keystore-v0.5.2",
+ "ref": "lair_keystore-v0.5.3",
"repo": "lair",
"type": "github"
}
@@ -149,14 +149,14 @@
},
"nixpkgs-lib": {
"locked": {
- "lastModified": 1727825735,
- "narHash": "sha256-0xHYkMkeLVQAMa7gvkddbPqpxph+hDzdu1XdGPJR+Os=",
+ "lastModified": 1730504152,
+ "narHash": "sha256-lXvH/vOfb4aGYyvFmZK/HlsNsr/0CVWlwYvo2rxJk3s=",
"type": "tarball",
- "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz"
+ "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz"
},
"original": {
"type": "tarball",
- "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz"
+ "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz"
}
},
"root": {
@@ -178,11 +178,11 @@
]
},
"locked": {
- "lastModified": 1727404165,
- "narHash": "sha256-kZCiYpQJBZ3kL9QymS88mCxpQwqo8KqvZeHk6LATuY8=",
+ "lastModified": 1733020719,
+ "narHash": "sha256-Chv9+3zrf1DhdB9JyskjoV0vJbCQEgkVqrU3p4RPLv8=",
"owner": "oxalica",
"repo": "rust-overlay",
- "rev": "76f0a61e733259e1034dd6523e039d04932ffefc",
+ "rev": "8e18f10703112e6c33e1c0d8b93e8305f6f0a75c",
"type": "github"
},
"original": {
diff --git a/package-lock.json b/package-lock.json
index 7164524f..c941dd02 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,7 +9,7 @@
"version": "0.17.0-dev.6",
"license": "MIT",
"dependencies": {
- "@holochain/client": "^0.18.0-dev.13",
+ "@holochain/client": "^0.18.0-rc.1",
"get-port": "^6.1.2",
"lodash": "^4.17.21",
"uuid": "^8.3.2",
@@ -32,6 +32,7 @@
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-tsdoc": "^0.2.17",
+ "js-yaml": "^4.1.0",
"prettier": "^2.8.1",
"rimraf": "^3.0.2",
"tape": "^5.7.5",
@@ -563,26 +564,6 @@
"url": "https://github.com/sponsors/epoberezkin"
}
},
- "node_modules/@eslint/eslintrc/node_modules/argparse": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
- "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
- "dev": true,
- "license": "Python-2.0"
- },
- "node_modules/@eslint/eslintrc/node_modules/js-yaml": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
- "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "argparse": "^2.0.1"
- },
- "bin": {
- "js-yaml": "bin/js-yaml.js"
- }
- },
"node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
@@ -614,9 +595,9 @@
}
},
"node_modules/@holochain/client": {
- "version": "0.18.0-dev.13",
- "resolved": "https://registry.npmjs.org/@holochain/client/-/client-0.18.0-dev.13.tgz",
- "integrity": "sha512-pwmqsVRhzERt036Ms3Nch7UT94u1+kEPnGF1rcYParrx8lE5aol5XxW5UqS1wiIoadd5iYjYXJE8CJI2fga0Sg==",
+ "version": "0.18.0-rc.1",
+ "resolved": "https://registry.npmjs.org/@holochain/client/-/client-0.18.0-rc.1.tgz",
+ "integrity": "sha512-01Xh5cpN0lHdtV41V2RtCUfTFEA9K9GWK5vvMPtdqj52WcSNO6gcrfVERKgSG/su8xJ3VmULPYNQyrEMmBReww==",
"license": "CAL-1.0",
"dependencies": {
"@bitgo/blake2b": "^3.2.4",
@@ -723,6 +704,20 @@
"api-documenter": "bin/api-documenter"
}
},
+ "node_modules/@microsoft/api-documenter/node_modules/js-yaml": {
+ "version": "3.13.1",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
+ "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "argparse": "^1.0.7",
+ "esprima": "^4.0.0"
+ },
+ "bin": {
+ "js-yaml": "bin/js-yaml.js"
+ }
+ },
"node_modules/@microsoft/api-extractor": {
"version": "7.47.9",
"resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.47.9.tgz",
@@ -2289,13 +2284,6 @@
"url": "https://github.com/sponsors/epoberezkin"
}
},
- "node_modules/eslint/node_modules/argparse": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
- "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
- "dev": true,
- "license": "Python-2.0"
- },
"node_modules/eslint/node_modules/eslint-scope": {
"version": "7.2.2",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz",
@@ -2323,19 +2311,6 @@
"node": ">=4.0"
}
},
- "node_modules/eslint/node_modules/js-yaml": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
- "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "argparse": "^2.0.1"
- },
- "bin": {
- "js-yaml": "bin/js-yaml.js"
- }
- },
"node_modules/eslint/node_modules/json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
@@ -3519,19 +3494,25 @@
"license": "BSD-3-Clause"
},
"node_modules/js-yaml": {
- "version": "3.13.1",
- "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
- "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
+ "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"dev": true,
"license": "MIT",
"dependencies": {
- "argparse": "^1.0.7",
- "esprima": "^4.0.0"
+ "argparse": "^2.0.1"
},
"bin": {
"js-yaml": "bin/js-yaml.js"
}
},
+ "node_modules/js-yaml/node_modules/argparse": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
+ "dev": true,
+ "license": "Python-2.0"
+ },
"node_modules/json-buffer": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",
diff --git a/package.json b/package.json
index 1a76af20..9775df55 100644
--- a/package.json
+++ b/package.json
@@ -43,7 +43,7 @@
"prepublishOnly": "npm run build"
},
"dependencies": {
- "@holochain/client": "^0.18.0-dev.13",
+ "@holochain/client": "^0.18.0-rc.1",
"get-port": "^6.1.2",
"lodash": "^4.17.21",
"uuid": "^8.3.2",
@@ -66,6 +66,7 @@
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-tsdoc": "^0.2.17",
+ "js-yaml": "^4.1.0",
"prettier": "^2.8.1",
"rimraf": "^3.0.2",
"tape": "^5.7.5",
diff --git a/ts/src/local/conductor.ts b/ts/src/local/conductor.ts
index 4daebeec..96f37ba3 100644
--- a/ts/src/local/conductor.ts
+++ b/ts/src/local/conductor.ts
@@ -8,7 +8,6 @@ import {
InstallAppRequest,
AppAuthenticationToken,
AppCallZomeRequest,
- NetworkSeed,
} from "@holochain/client";
import getPort, { portNumbers } from "get-port";
import pick from "lodash/pick.js";
@@ -382,21 +381,21 @@ export class Conductor implements IConductor {
const agent_key =
options?.agentPubKey ?? (await this.adminWs().generateAgentPubKey());
const installed_app_id = options?.installedAppId ?? `app-${uuidv4()}`;
- const membrane_proofs = options?.membraneProofs ?? {};
+ const roles_settings = options?.rolesSettings;
const network_seed = options?.networkSeed;
const installAppRequest: InstallAppRequest =
"bundle" in appBundleSource
? {
bundle: appBundleSource.bundle,
agent_key,
- membrane_proofs,
+ roles_settings,
installed_app_id,
network_seed,
}
: {
path: appBundleSource.path,
agent_key,
- membrane_proofs,
+ roles_settings,
installed_app_id,
network_seed,
};
@@ -416,7 +415,7 @@ export class Conductor implements IConductor {
options.agentsApps.map((appsForAgent) =>
this.installApp(appsForAgent.app, {
agentPubKey: appsForAgent.agentPubKey,
- membraneProofs: appsForAgent.membraneProofs,
+ rolesSettings: appsForAgent.rolesSettings,
installedAppId: options.installedAppId,
networkSeed: options.networkSeed,
})
diff --git a/ts/src/trycp/conductor/conductor.ts b/ts/src/trycp/conductor/conductor.ts
index d2a3c88a..de2e56ed 100644
--- a/ts/src/trycp/conductor/conductor.ts
+++ b/ts/src/trycp/conductor/conductor.ts
@@ -7,7 +7,6 @@ import {
SignalCb,
AttachAppInterfaceRequest,
CallZomeRequest,
- CallZomeRequestSigned,
CapSecret,
CellId,
CreateCloneCellRequest,
@@ -1045,7 +1044,7 @@ export class TryCpConductor implements IConductor {
async installApp(appBundleSource: AppBundleSource, options?: AppOptions) {
const agent_key =
options?.agentPubKey ?? (await this.adminWs().generateAgentPubKey());
- const membrane_proofs = options?.membraneProofs ?? {};
+ const roles_settings = options?.rolesSettings;
const installed_app_id = options?.installedAppId ?? `app-${uuidv4()}`;
const network_seed = options?.networkSeed;
const installAppRequest: InstallAppRequest =
@@ -1053,14 +1052,14 @@ export class TryCpConductor implements IConductor {
? {
bundle: appBundleSource.bundle,
agent_key,
- membrane_proofs,
+ roles_settings,
installed_app_id,
network_seed,
}
: {
path: appBundleSource.path,
agent_key,
- membrane_proofs,
+ roles_settings,
installed_app_id,
network_seed,
};
@@ -1079,7 +1078,7 @@ export class TryCpConductor implements IConductor {
const agent_key =
appForAgent.agentPubKey ??
(await this.adminWs().generateAgentPubKey());
- const membrane_proofs = appForAgent.membraneProofs ?? {};
+ const roles_settings = appForAgent.rolesSettings;
const installed_app_id = options.installedAppId ?? `app-${uuidv4()}`;
const network_seed = options.networkSeed;
const installAppRequest: InstallAppRequest =
@@ -1087,14 +1086,14 @@ export class TryCpConductor implements IConductor {
? {
bundle: appForAgent.app.bundle,
agent_key,
- membrane_proofs,
+ roles_settings,
installed_app_id,
network_seed,
}
: {
path: appForAgent.app.path,
agent_key,
- membrane_proofs,
+ roles_settings,
installed_app_id,
network_seed,
};
diff --git a/ts/src/types.ts b/ts/src/types.ts
index 7a5181b4..af937181 100644
--- a/ts/src/types.ts
+++ b/ts/src/types.ts
@@ -18,6 +18,7 @@ import type {
ProvisionedCell,
RegisterDnaRequest,
RoleName,
+ RoleSettingsMap,
} from "@holochain/client";
/**
@@ -145,9 +146,9 @@ export interface AppOptions {
*/
networkSeed?: string;
/**
- * Proofs of membership for the hApp.
+ * Role specific settings or modifiers that will override any settings in the hApp's dna manifest(s).
*/
- membraneProofs?: Record;
+ rolesSettings?: RoleSettingsMap;
/**
* A signal handler for the conductor.
*/
diff --git a/ts/test/local/conductor.ts b/ts/test/local/conductor.ts
index 83cc25d8..93ca4309 100644
--- a/ts/test/local/conductor.ts
+++ b/ts/test/local/conductor.ts
@@ -3,8 +3,12 @@ import {
AppBundleSource,
AppSignal,
CellProvisioningStrategy,
+ CellType,
CloneId,
+ Duration,
EntryHash,
+ fakeAgentPubKey,
+ ProvisionedCell,
RevokeAgentKeyResponse,
Signal,
SignalCb,
@@ -26,6 +30,8 @@ import {
stopLocalServices,
} from "../../src";
import { FIXTURE_DNA_URL, FIXTURE_HAPP_URL } from "../fixture";
+import { decode } from "@msgpack/msgpack";
+import yaml from "js-yaml";
const ROLE_NAME = "test";
@@ -300,6 +306,80 @@ test("Local Conductor - install app with deferred memproofs", async (t) => {
await cleanAllConductors();
});
+test("Local Conductor - install app with roles settings", async (t) => {
+ const { servicesProcess, signalingServerUrl } = await runLocalServices();
+ const conductor = await createConductor(signalingServerUrl);
+
+ const originTime = Date.now();
+ const quantumTime: Duration = {
+ secs: originTime,
+ nanos: 0,
+ };
+
+ const progenitorKey = Uint8Array.from(await fakeAgentPubKey());
+
+ const app = await conductor.installApp(
+ {
+ bundle: {
+ manifest: {
+ manifest_version: "1",
+ name: "app",
+ roles: [
+ {
+ name: ROLE_NAME,
+ provisioning: {
+ strategy: CellProvisioningStrategy.Create,
+ deferred: false,
+ },
+ dna: {
+ path: realpathSync(FIXTURE_DNA_URL),
+ modifiers: { network_seed: "some_seed" },
+ },
+ },
+ ],
+ membrane_proofs_deferred: true,
+ },
+ resources: {},
+ },
+ },
+ {
+ rolesSettings: {
+ [ROLE_NAME]: {
+ type: "Provisioned",
+ membrane_proof: new Uint8Array(6),
+ modifiers: {
+ network_seed: "hello",
+ properties: yaml.dump({ progenitor: progenitorKey }),
+ origin_time: originTime,
+ quantum_time: quantumTime,
+ },
+ },
+ },
+ }
+ );
+
+ const port = await conductor.attachAppInterface();
+ const issued = await conductor
+ .adminWs()
+ .issueAppAuthenticationToken({ installed_app_id: app.installed_app_id });
+ const appWs = await conductor.connectAppWs(issued.token, port);
+
+ const appInfo = await appWs.appInfo();
+ const provisionedCell: ProvisionedCell =
+ appInfo.cell_info[ROLE_NAME][0][CellType.Provisioned];
+ t.equal(provisionedCell.dna_modifiers.network_seed, "hello");
+ t.deepEqual(
+ yaml.load(decode(provisionedCell.dna_modifiers.properties) as string),
+ { progenitor: progenitorKey }
+ );
+ t.equal(provisionedCell.dna_modifiers.origin_time, originTime);
+ t.deepEqual(provisionedCell.dna_modifiers.quantum_time, quantumTime);
+
+ await conductor.shutDown();
+ await stopLocalServices(servicesProcess);
+ await cleanAllConductors();
+});
+
test("Local Conductor - install and call an app", async (t) => {
const { servicesProcess, signalingServerUrl } = await runLocalServices();
const conductor = await createConductor(signalingServerUrl);
@@ -478,7 +558,6 @@ test("Local Conductor - create and read an entry using the entry zome", async (t
const entryContent = "test-content";
const createEntryHash: EntryHash = await appWs.callZome({
- cap_secret: null,
cell_id,
zome_name: "coordinator",
fn_name: "create",
@@ -490,7 +569,6 @@ test("Local Conductor - create and read an entry using the entry zome", async (t
t.ok(createdEntryHashB64.startsWith("hCkk"));
const readEntryResponse: typeof entryContent = await appWs.callZome({
- cap_secret: null,
cell_id,
zome_name: "coordinator",
fn_name: "read",
@@ -545,7 +623,6 @@ test("Local Conductor - clone cell management", async (t) => {
zome_name: "coordinator",
fn_name: "create",
payload: testContent,
- cap_secret: null,
provenance: agentPubKey,
});
@@ -558,7 +635,6 @@ test("Local Conductor - clone cell management", async (t) => {
zome_name: "coordinator",
fn_name: "read",
payload: entryActionHash,
- cap_secret: null,
provenance: agentPubKey,
}),
"disabled clone cell cannot be called"
@@ -578,7 +654,6 @@ test("Local Conductor - clone cell management", async (t) => {
zome_name: "coordinator",
fn_name: "read",
payload: entryActionHash,
- cap_secret: null,
provenance: agentPubKey,
},
40000
diff --git a/ts/test/local/scenario.ts b/ts/test/local/scenario.ts
index 59384d88..339148e5 100644
--- a/ts/test/local/scenario.ts
+++ b/ts/test/local/scenario.ts
@@ -2,15 +2,12 @@ import {
ActionHash,
AppBundleSource,
AppSignal,
- AppWebsocket,
EntryHash,
- PreflightResponse,
Signal,
SignalCb,
SignalType,
} from "@holochain/client";
import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
import test from "tape-promise/tape.js";
import { Scenario, dhtSync, getZomeCaller, runScenario } from "../../src";
import { FIXTURE_HAPP_URL } from "../fixture";
@@ -374,8 +371,7 @@ test("Local Scenario - runScenario - call zome by role name", async (t) => {
path: FIXTURE_HAPP_URL.pathname,
});
- const result = (await alice.appWs.callZome({
- role_name: "test",
+ const result = (await alice.namedCells.get("test")?.callZome({
zome_name: "coordinator",
fn_name: "create",
payload: "hello",
diff --git a/ts/test/trycp/client.ts b/ts/test/trycp/client.ts
index a31a5475..c7e2dcd4 100644
--- a/ts/test/trycp/client.ts
+++ b/ts/test/trycp/client.ts
@@ -3,11 +3,7 @@ import { Buffer } from "node:buffer";
import { URL } from "node:url";
import test from "tape-promise/tape.js";
import { _ALLOWED_ORIGIN, enableAndGetAgentApp } from "../../src/common.js";
-import {
- createTryCpConductor,
- DEFAULT_PARTIAL_PLAYER_CONFIG,
- TryCpConductor,
-} from "../../src/trycp/index.js";
+import { createTryCpConductor, TryCpConductor } from "../../src/trycp/index.js";
import { TryCpClient } from "../../src/trycp/trycp-client.js";
import {
TRYCP_SERVER_HOST,
diff --git a/ts/test/trycp/conductor.ts b/ts/test/trycp/conductor.ts
index d4fcbc9e..c86ff519 100644
--- a/ts/test/trycp/conductor.ts
+++ b/ts/test/trycp/conductor.ts
@@ -10,6 +10,9 @@ import {
SignalType,
GrantedFunctionsType,
RevokeAgentKeyResponse,
+ Duration,
+ fakeAgentPubKey,
+ ProvisionedCell,
} from "@holochain/client";
import assert from "node:assert";
import { Buffer } from "node:buffer";
@@ -26,6 +29,8 @@ import { TryCpPlayer, createTryCpConductor } from "../../src";
import { TRYCP_SERVER_HOST, TRYCP_SERVER_PORT, TryCpServer } from "../../src";
import { TRYCP_SUCCESS_RESPONSE } from "../../src";
import { FIXTURE_DNA_URL, FIXTURE_HAPP_URL } from "../fixture";
+import { decode } from "@msgpack/msgpack";
+import yaml from "js-yaml";
const SERVER_URL = new URL(`ws://${TRYCP_SERVER_HOST}:${TRYCP_SERVER_PORT}`);
const ROLE_NAME = "test";
@@ -41,7 +46,6 @@ const ROLE_NAME = "test";
// const appInfo = await conductor.adminWs().installApp({
// path: FIXTURE_HAPP_URL.pathname,
// agent_key,
-// membrane_proofs: {},
// });
// await conductor
// .adminWs()
@@ -64,7 +68,6 @@ const ROLE_NAME = "test";
// const appInfo = await conductor.adminWs().installApp({
// path: FIXTURE_HAPP_URL.pathname,
// agent_key,
-// membrane_proofs: {},
// });
// await conductor
// .adminWs()
@@ -281,6 +284,86 @@ test("TryCP Conductor - install app with deferred memproofs", async (t) => {
await localTryCpServer.stop();
});
+test("TryCP Conductor - install app with roles settings", async (t) => {
+ const localTryCpServer = await TryCpServer.start();
+ const { servicesProcess, signalingServerUrl } = await runLocalServices();
+ const client = await TryCpClient.create(SERVER_URL);
+ client.signalingServerUrl = signalingServerUrl;
+ const conductor = await createTryCpConductor(client);
+ const adminWs = conductor.adminWs();
+
+ const originTime = Date.now();
+ const quantumTime: Duration = {
+ secs: originTime,
+ nanos: 0,
+ };
+
+ const progenitorKey = Uint8Array.from(await fakeAgentPubKey());
+
+ const app = await conductor.installApp(
+ {
+ bundle: {
+ manifest: {
+ manifest_version: "1",
+ name: "app",
+ roles: [
+ {
+ name: ROLE_NAME,
+ provisioning: {
+ strategy: CellProvisioningStrategy.Create,
+ deferred: false,
+ },
+ dna: {
+ path: realpathSync(FIXTURE_DNA_URL),
+ modifiers: { network_seed: "some_seed" },
+ },
+ },
+ ],
+ membrane_proofs_deferred: true,
+ },
+ resources: {},
+ },
+ },
+ {
+ rolesSettings: {
+ [ROLE_NAME]: {
+ type: "Provisioned",
+ membrane_proof: new Uint8Array(6),
+ modifiers: {
+ network_seed: "hello",
+ properties: yaml.dump({ progenitor: progenitorKey }),
+ origin_time: originTime,
+ quantum_time: quantumTime,
+ },
+ },
+ },
+ }
+ );
+
+ const { port } = await adminWs.attachAppInterface();
+ const issued = await adminWs.issueAppAuthenticationToken({
+ installed_app_id: app.installed_app_id,
+ });
+ await conductor.connectAppInterface(issued.token, port);
+ const appWs = await conductor.connectAppWs(issued.token, port);
+
+ const appInfo = await appWs.appInfo();
+ assert(appInfo);
+ const provisionedCell: ProvisionedCell =
+ appInfo.cell_info[ROLE_NAME][0][CellType.Provisioned];
+ t.equal(provisionedCell.dna_modifiers.network_seed, "hello");
+ t.deepEqual(
+ yaml.load(decode(provisionedCell.dna_modifiers.properties) as string),
+ { progenitor: progenitorKey }
+ );
+ t.equal(provisionedCell.dna_modifiers.origin_time, originTime);
+ t.deepEqual(provisionedCell.dna_modifiers.quantum_time, quantumTime);
+
+ await stopLocalServices(servicesProcess);
+ await client.cleanUp();
+ await localTryCpServer.stop();
+});
+
test("TryCP Conductor - install hApp bundle and access cell by role name", async (t) => {
const localTryCpServer = await TryCpServer.start();
const { servicesProcess, signalingServerUrl } = await runLocalServices();
@@ -390,7 +473,6 @@ test("TryCP Conductor - request storage info", async (t) => {
const appInfo = await conductor.adminWs().installApp({
path: FIXTURE_HAPP_URL.pathname,
agent_key: agentPubKey,
- membrane_proofs: {},
});
const storageInfo = await conductor.adminWs().storageInfo();
@@ -422,7 +504,6 @@ test("TryCP Conductor - request network info", async (t) => {
path: FIXTURE_HAPP_URL.pathname,
agent_key: agentPubKey,
network_seed: Date.now().toString(),
- membrane_proofs: {},
});
await conductor
.adminWs()
@@ -505,7 +586,6 @@ test("TryCP Conductor - receive a signal", async (t) => {
const appInfo = await conductor.adminWs().installApp({
path: FIXTURE_HAPP_URL.pathname,
agent_key: agentPubKey,
- membrane_proofs: {},
});
const { port } = await conductor.adminWs().attachAppInterface();
const issued = await conductor.adminWs().issueAppAuthenticationToken({
@@ -564,7 +644,6 @@ test("TryCP Conductor - create and read an entry using the entry zome", async (t
const appId = "entry-app";
const appInfo = await conductor.adminWs().installApp({
path: FIXTURE_HAPP_URL.pathname,
- membrane_proofs: {},
installed_app_id: appId,
agent_key: agentPubKey,
});
@@ -683,7 +762,6 @@ test("TryCP Conductor - create and read an entry using the entry zome, 1 conduct
path: FIXTURE_HAPP_URL.pathname,
installed_app_id: appId1,
agent_key: agent1PubKey,
- membrane_proofs: {},
});
assert(CellType.Provisioned in appInfo1.cell_info[ROLE_NAME][0]);
const cellId1 =
@@ -702,7 +780,6 @@ test("TryCP Conductor - create and read an entry using the entry zome, 1 conduct
path: FIXTURE_HAPP_URL.pathname,
installed_app_id: appId2,
agent_key: agent2PubKey,
- membrane_proofs: {},
});
assert(CellType.Provisioned in appInfo2.cell_info[ROLE_NAME][0]);
const cellId2 =
@@ -801,7 +878,6 @@ test("TryCP Conductor - clone cell management", async (t) => {
path: FIXTURE_HAPP_URL.pathname,
installed_app_id: appId,
agent_key: agentPubKey,
- membrane_proofs: {},
});
assert(CellType.Provisioned in appInfo.cell_info[ROLE_NAME][0]);
const { cell_id } = appInfo.cell_info[ROLE_NAME][0][CellType.Provisioned];
From 9e7b48b960a3aedd75843e502567b0d69adbb834 Mon Sep 17 00:00:00 2001
From: Matthias
Date: Sun, 1 Dec 2024 19:36:54 +0100
Subject: [PATCH 2/2] add missing import
---
ts/src/trycp/conductor/conductor.ts | 1 +
1 file changed, 1 insertion(+)
diff --git a/ts/src/trycp/conductor/conductor.ts b/ts/src/trycp/conductor/conductor.ts
index de2e56ed..92c0ff87 100644
--- a/ts/src/trycp/conductor/conductor.ts
+++ b/ts/src/trycp/conductor/conductor.ts
@@ -45,6 +45,7 @@ import {
UninstallAppRequest,
UpdateCoordinatorsRequest,
RevokeAgentKeyRequest,
+ CallZomeRequestSigned,
} from "@holochain/client";
import getPort, { portNumbers } from "get-port";
import assert from "node:assert";