Skip to content

Commit

Permalink
feat(common): export addAllAgentsToAllConductors
Browse files Browse the repository at this point in the history
  • Loading branch information
jost-s committed Jun 7, 2022
1 parent 0358e3d commit 450e16f
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Changed
### Fixed

## [0.5.4]

### Added
- Export function to add all agents to all conductors.

## [0.5.3]

### Added
Expand Down
13 changes: 13 additions & 0 deletions docs/tryorama.addallagentstoallconductors.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/tryorama](./tryorama.md) &gt; [addAllAgentsToAllConductors](./tryorama.addallagentstoallconductors.md)

## addAllAgentsToAllConductors variable

Add all agents of all conductors to each other. Shortcuts peer discovery through a bootstrap server or gossiping.

<b>Signature:</b>

```typescript
addAllAgentsToAllConductors: (conductors: IConductor[]) => Promise<void>
```
2 changes: 1 addition & 1 deletion docs/tryorama.conductor.installagentshapps.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ installAgentsHapps(options: {

Promise&lt;[AgentHapp](./tryorama.agenthapp.md)<!-- -->\[\]&gt;

An array with each agent's hApp.
An array with each agent's hApps.

13 changes: 13 additions & 0 deletions docs/tryorama.getzomecaller.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/tryorama](./tryorama.md) &gt; [getZomeCaller](./tryorama.getzomecaller.md)

## getZomeCaller variable

Get a shorthand function to call a Cell's Zome.

<b>Signature:</b>

```typescript
getZomeCaller: (cell: CallableCell, zomeName: string) => <T>(fnName: string, payload: unknown) => Promise<T>
```
2 changes: 2 additions & 0 deletions docs/tryorama.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,13 @@ TryCP stands for Tryorama Control Protocol (TryCP) and is a protocol to enable r

| Variable | Description |
| --- | --- |
| [addAllAgentsToAllConductors](./tryorama.addallagentstoallconductors.md) | Add all agents of all conductors to each other. Shortcuts peer discovery through a bootstrap server or gossiping. |
| [cleanAllConductors](./tryorama.cleanallconductors.md) | Run the <code>hc</code> command to delete all conductor data. |
| [cleanAllTryCpConductors](./tryorama.cleanalltrycpconductors.md) | Run the <code>reset</code> command on the TryCP server to delete all conductor data. |
| [createConductor](./tryorama.createconductor.md) | The function to create a conductor. It starts a sandbox conductor via the Holochain CLI. |
| [createTryCpConductor](./tryorama.createtrycpconductor.md) | The function to create a TryCP Conductor (aka "Player"). |
| [DEFAULT\_PARTIAL\_PLAYER\_CONFIG](./tryorama.default_partial_player_config.md) | The default partial config for a TryCP conductor. |
| [getZomeCaller](./tryorama.getzomecaller.md) | Get a shorthand function to call a Cell's Zome. |
| [pause](./tryorama.pause.md) | A utility function to wait the given amount of time. |
| [runScenario](./tryorama.runscenario.md) | A wrapper function to create and run a scenario. A scenario is created and all involved conductors are shut down and cleaned up after running. |
| [TRYCP\_SUCCESS\_RESPONSE](./tryorama.trycp_success_response.md) | Empty success response. |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@holochain/tryorama",
"description": "Toolset to manage Holochain conductors and facilitate running test scenarios",
"version": "0.5.3",
"version": "0.5.4",
"author": "Holochain Foundation",
"keywords": [
"holochain",
Expand Down
17 changes: 17 additions & 0 deletions ts/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ import {
IConductor,
} from "./types.js";

/**
* Add all agents of all conductors to each other. Shortcuts peer discovery
* through a bootstrap server or gossiping.
*
* @param conductors - Conductors to mutually exchange all agents with.
*
* @public
*/
export const addAllAgentsToAllConductors = async (conductors: IConductor[]) => {
await Promise.all(
conductors.map(async (playerToShareAbout, playerToShareAboutIdx) => {
Expand Down Expand Up @@ -86,6 +94,15 @@ const getCallableCell = (
},
});

/**
* Get a shorthand function to call a Cell's Zome.
*
* @param cell - The Cell to call the Zome on.
* @param zomeName - The name of the Zome to call.
* @returns A function to call the specified Zome.
*
* @public
*/
export const getZomeCaller =
(cell: CallableCell, zomeName: string) =>
<T>(fnName: string, payload: unknown): Promise<T> =>
Expand Down
1 change: 1 addition & 0 deletions ts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
*/
export * from "./local/index.js";
export * from "./trycp/index.js";
export { addAllAgentsToAllConductors, getZomeCaller } from "./common.js";
export * from "./types.js";
export * from "./util.js";

0 comments on commit 450e16f

Please sign in to comment.